Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp177474pxb; Fri, 15 Oct 2021 03:20:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQ17RTlj81HOJSeKvSm+n2n2gnvAxCPCrvYCkz+3/R5hx7dLydYSMu3jC5kmlM1ocgVvHf X-Received: by 2002:a17:90a:4483:: with SMTP id t3mr26656223pjg.44.1634293252533; Fri, 15 Oct 2021 03:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634293252; cv=none; d=google.com; s=arc-20160816; b=bA4z+4oKeuliwKWD/tCrmOWq6xCTKx43yfGtNrdNNaiyRbaOAjN0ivewudwPAhmZYK yNL5VbvHvvqimKz8aDZW8FDXUZuCcbbvk9TUr3eaNEPihczgTxz9uQYoxWYZAqlOzdpF TcNRLE7XecHDVcfzsoxeW+VkidObGAOuLekploWJVE4rJlZkMLvP0myUCf8/p9MpAVh3 RrvCnXa+b8S2V/hwtwF9WvFc6q5RIR2vI8SciuHrM2d/ByFm5IbqOFNQL5YbWVvsnGRZ 1iDNA1qgmLlFCB/Z6WrRhk4yftKdb7oQaW1rM2a1V+exRIncc+BEkw0DzmoszaPEn8pO 6BxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=wJvwI4BBDt6Cu2A9JXCnL4YOdGbXc9WWklcRk7yFEcs=; b=dC4TmYHsjE93Q+m67H0/77BZ7wzTp+i7B7VbAdpdRBdb6g2rTsxy6vRw5eFniTyGZ6 iaO1jz2SjtAWmDpginizoDKSTQmYJp5oUZbuIFE0Tmztn2QdSeG3dFNp0WPCHyvXmsk1 x8K2Jtn9KmktEF8WI3Zj54TFPK5yZyABpl2NpIy1F9itXCGi9wNZNRb6SP+iMrqWZ87c Gtgim4xROYkrMQbQLVZaRZdkErP7Xqq4qS6p9KoVpdPZgbrl+9nApdAGedE8zOc2D0qL QA8onfsjK38DcjR6Th90icH01NoOX7flSrbi3kItqgOOokvVHkgqAqJMrt+hFlhAmGVe Qe4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=djEf3dzp; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kk3si21463200pjb.71.2021.10.15.03.20.39; Fri, 15 Oct 2021 03:20:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=djEf3dzp; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232729AbhJOBTl (ORCPT + 99 others); Thu, 14 Oct 2021 21:19:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234818AbhJOBSw (ORCPT ); Thu, 14 Oct 2021 21:18:52 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 119C2C0613DF; Thu, 14 Oct 2021 18:16:25 -0700 (PDT) Message-ID: <20211015011539.455836597@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1634260583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=wJvwI4BBDt6Cu2A9JXCnL4YOdGbXc9WWklcRk7yFEcs=; b=djEf3dzpPDWlJIyINEdUxOtyf9wyx7r2m6ijWqcdjlIx3JY5ooQ2HVj3o6wlMZgETA1Mwo oLo9tFCPtuGu/7e8gKrmdITlVbjOAqGBMXYv/4tAX6Ipl9tj1vUEoDN708NCALua8BgU3O dFTpl0XRibNHOHEiPhi1c/rTgGwzRoP2hw1IdTZ5Y/io+uT+DnuGhUgPBoWFW5rDS1bNYc UX7AMn2lWV6NyZy/kyMZllpsIONC784jwcAFiS9I83Vimi3OzXb8riJrEfOFHaSCxmFdmE n0ybNoBEnujOahDHHdXjlxZUZGBRHp7RViKp1eDrHvydVGHNsHBQifRuESqmTA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1634260583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=wJvwI4BBDt6Cu2A9JXCnL4YOdGbXc9WWklcRk7yFEcs=; b=yLESv1KV5SSVoWAQKMcbQMC/QU0QKqrczYcoCh+XX4XntrEPRBVM/LBKV89ayyv3/JMuwF 3O6SQ+SXNYlWCdDg== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, "Chang S. Bae" , Dave Hansen , Arjan van de Ven , kvm@vger.kernel.org, Paolo Bonzini , "Liu, Jing2" , Sean Christopherson , Xiaoyao Li Subject: [patch V2 19/30] x86/fpu: Make os_xrstor_booting() private References: <20211015011411.304289784@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Fri, 15 Oct 2021 03:16:23 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's only required in the xstate init code. Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/fpu/internal.h | 25 ------------------------- arch/x86/kernel/fpu/xstate.c | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 25 deletions(-) --- diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h index 5da7528b3b2f..3ad2ae73efa5 100644 --- a/arch/x86/include/asm/fpu/internal.h +++ b/arch/x86/include/asm/fpu/internal.h @@ -226,31 +226,6 @@ static inline void fxsave(struct fxregs_state *fx) : "memory") /* - * This function is called only during boot time when x86 caps are not set - * up and alternative can not be used yet. - */ -static inline void os_xrstor_booting(struct xregs_state *xstate) -{ - u64 mask = xfeatures_mask_fpstate(); - u32 lmask = mask; - u32 hmask = mask >> 32; - int err; - - WARN_ON(system_state != SYSTEM_BOOTING); - - if (boot_cpu_has(X86_FEATURE_XSAVES)) - XSTATE_OP(XRSTORS, xstate, lmask, hmask, err); - else - XSTATE_OP(XRSTOR, xstate, lmask, hmask, err); - - /* - * We should never fault when copying from a kernel buffer, and the FPU - * state we set at boot time should be valid. - */ - WARN_ON_FPU(err); -} - -/* * Save processor xstate to xsave area. * * Uses either XSAVE or XSAVEOPT or XSAVES depending on the CPU features diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index 1f5a66a38671..b712c06cbbfb 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -351,6 +351,29 @@ static void __init print_xstate_offset_size(void) } /* + * This function is called only during boot time when x86 caps are not set + * up and alternative can not be used yet. + */ +static __init void os_xrstor_booting(struct xregs_state *xstate) +{ + u64 mask = xfeatures_mask_fpstate(); + u32 lmask = mask; + u32 hmask = mask >> 32; + int err; + + if (cpu_feature_enabled(X86_FEATURE_XSAVES)) + XSTATE_OP(XRSTORS, xstate, lmask, hmask, err); + else + XSTATE_OP(XRSTOR, xstate, lmask, hmask, err); + + /* + * We should never fault when copying from a kernel buffer, and the FPU + * state we set at boot time should be valid. + */ + WARN_ON_FPU(err); +} + +/* * All supported features have either init state all zeros or are * handled in setup_init_fpu() individually. This is an explicit * feature list and does not use XFEATURE_MASK*SUPPORTED to catch