Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp172308pxb; Fri, 15 Oct 2021 03:14:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIQok1D1k3Y4b4KGmsx1h0dL/61XhKf6K3qZROBPdFf9Ohoc5ReB0IDD+rDDskSbf+DLtk X-Received: by 2002:a17:906:4f13:: with SMTP id t19mr5875215eju.53.1634292872327; Fri, 15 Oct 2021 03:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634292872; cv=none; d=google.com; s=arc-20160816; b=yppq4sFffTyIem5VTiV67KYChC4wDgUFtnv4h3J0ikkaTliVouZRtzdTx9Z8GSBwG1 B87+vukc2vAgVGHZpFRwRceiNHWEV7QLT0GWIIb1Dhubhbg9EHW83drK+W1BCPdxt1IF eHIr3+ThgC1bEX53cZf544gOK8sjxSLIXhkCGRXV80Z5Z383GraPSNZjSM7slcw4QXdH GnK43eXmAOb7B6tEmwdWnYKkSRzgO9RC6Ils9S4+PhN9adzSYrlKFdeVPtozpMBYe5NP 4tDxowDGKFZXfkR870Ls2KegY2xokkTpW9qgR5l/OeoaiKhE4f8h47Qy00gGEr+zcwqF a83g== 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=a0QlIBSwa8Sfkm3ncNnZ66ijbSmBxDzHL00Gh1+jgG8=; b=Svvu3yZnyHVztPaFrMlj2h8eCTZ5SmJWpt4bM4/Qv61YRBrf/fMBevPUhB+z919vnJ swmmqd5bODpekD6xnn5XC5Tz2O+E7uPVfFgdf0hy1YXZbjNbbGlLJ6z3wlK3ZYeD689+ 4E836phKov/Hj1FfO/STeZt/zXlZrMD6Q4kZEvFUw7MIM0dIjm8gnMdB7e/EWUxL2/m1 6nFPoAcIfdpNfc6uoQqP5VchsRm24AGeee/j7bByxxAAYwN4vLVhWS+Zm/V35hQexCeM H99Q5NLR6Gfa2AWN1zBycjsV5HSGgbBSN0+qn9PZtzizmUsbhImwtVy0dQpWT99B+Kvz qS1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YDjjTJxr; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=HBGw1Y5L; 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 b15si8373553edm.143.2021.10.15.03.14.05; Fri, 15 Oct 2021 03:14:32 -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=YDjjTJxr; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=HBGw1Y5L; 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 S233899AbhJOBTE (ORCPT + 99 others); Thu, 14 Oct 2021 21:19:04 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:46502 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233864AbhJOBS2 (ORCPT ); Thu, 14 Oct 2021 21:18:28 -0400 Message-ID: <20211015011539.401510559@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1634260582; 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=a0QlIBSwa8Sfkm3ncNnZ66ijbSmBxDzHL00Gh1+jgG8=; b=YDjjTJxr2ss7qy7lo8vvqjbv9xjUaysd0vgtrniH8KxrwdZwT0r4fXuS8qQqoJcbvCui2/ jDlIuUXYnnj/DtRgPZivQq59ppY+j1HoIpF973tqQWmuVKk3HqceyZoBENJurdwUGbLNMf HSv3bvdNV+HqknCOPsaaLN4tzTU6TpsxqoEAkN2fGZiB5htGSdh3clnf36zFRLBTiiKDRV wiza3WdOHAWS/C3g+laQFT+QnG5qwhZV5vQwdBEwPqsBIN3s3iM2drEnxoGKeOB0Qd6hX2 qfpsMeP7+5C3BuPVoUpoNaC7GGQHd6aCMq7B7HAdJLNK6G0ShwP5E5HgxFovXg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1634260582; 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=a0QlIBSwa8Sfkm3ncNnZ66ijbSmBxDzHL00Gh1+jgG8=; b=HBGw1Y5LebYxp8ouulS1s0IpM5DHTqSMKydMf10sIB+ByhoMSd86cX3I/reWLbxHMYanhe QnS1aeUA02MkA7Cg== 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 18/30] x86/fpu: Clean up cpu feature tests References: <20211015011411.304289784@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Fri, 15 Oct 2021 03:16:21 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Further disintegration of internal.h: Move the cpu feature tests to a core header and remove the unused one. Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/fpu/internal.h | 18 ------------------ arch/x86/kernel/fpu/core.c | 1 + arch/x86/kernel/fpu/internal.h | 11 +++++++++++ arch/x86/kernel/fpu/regset.c | 2 ++ 4 files changed, 14 insertions(+), 18 deletions(-) --- diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h index 398c87c8e199..5da7528b3b2f 100644 --- a/arch/x86/include/asm/fpu/internal.h +++ b/arch/x86/include/asm/fpu/internal.h @@ -51,24 +51,6 @@ extern void fpu__resume_cpu(void); # define WARN_ON_FPU(x) ({ (void)(x); 0; }) #endif -/* - * FPU related CPU feature flag helper routines: - */ -static __always_inline __pure bool use_xsaveopt(void) -{ - return static_cpu_has(X86_FEATURE_XSAVEOPT); -} - -static __always_inline __pure bool use_xsave(void) -{ - return static_cpu_has(X86_FEATURE_XSAVE); -} - -static __always_inline __pure bool use_fxsr(void) -{ - return static_cpu_has(X86_FEATURE_FXSR); -} - extern union fpregs_state init_fpstate; extern void fpstate_init_user(union fpregs_state *state); diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c index 4fb63a0cb4ef..058df2643999 100644 --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c @@ -17,6 +17,7 @@ #include #include +#include "internal.h" #include "xstate.h" #define CREATE_TRACE_POINTS diff --git a/arch/x86/kernel/fpu/internal.h b/arch/x86/kernel/fpu/internal.h index 036f84c236dd..a8aac21ba364 100644 --- a/arch/x86/kernel/fpu/internal.h +++ b/arch/x86/kernel/fpu/internal.h @@ -2,6 +2,17 @@ #ifndef __X86_KERNEL_FPU_INTERNAL_H #define __X86_KERNEL_FPU_INTERNAL_H +/* CPU feature check wrappers */ +static __always_inline __pure bool use_xsave(void) +{ + return cpu_feature_enabled(X86_FEATURE_XSAVE); +} + +static __always_inline __pure bool use_fxsr(void) +{ + return cpu_feature_enabled(X86_FEATURE_FXSR); +} + /* Init functions */ extern void fpu__init_prepare_fx_sw_frame(void); diff --git a/arch/x86/kernel/fpu/regset.c b/arch/x86/kernel/fpu/regset.c index 66ed317ebc0d..ccf0c59955f1 100644 --- a/arch/x86/kernel/fpu/regset.c +++ b/arch/x86/kernel/fpu/regset.c @@ -10,6 +10,8 @@ #include #include +#include "internal.h" + /* * The xstateregs_active() routine is the same as the regset_fpregs_active() routine, * as the "regset->n" for the xstate regset will be updated based on the feature