Re: [RESEND v1 1/3] x86/cpufeatures: Add {required,disabled} feature configs

From: Xin Li
Date: Wed Jun 12 2024 - 22:57:52 EST


On 6/12/2024 6:33 AM, Borislav Petkov wrote:
On Thu, May 09, 2024 at 01:53:38PM -0700, Xin Li (Intel) wrote:
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 2a7279d80460..719302d37053 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -358,6 +358,10 @@ config X86_P6_NOP
depends on X86_64
depends on (MCORE2 || MPENTIUM4 || MPSC)
+config X86_REQUIRED_FEATURE_NOPL

Can we keep the X86_{REQUIRED,DISABLED}_ prefixes solely in
arch/x86/Kconfig.cpufeatures and not spill them out into the rest of the tree?

Good point, let me try.


This way there will be no confusion between X86_FEATURE_, X86_REQUIRED_FEATURE_,
X86_DISABLED_FEATURE_ and so on, and which one I am supposed to use where...

Currently X86_DISABLED_FEATURE_ macros are defined only in:
arch/x86/Kconfig.cpufeatures. But X86_REQUIRED_FEATURE_ macros are not.


diff --git a/arch/x86/Kconfig.cpufeatures b/arch/x86/Kconfig.cpufeatures
new file mode 100644
index 000000000000..326a8410ff06
--- /dev/null
+++ b/arch/x86/Kconfig.cpufeatures
@@ -0,0 +1,153 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# x86 feature bits (see arch/x86/include/asm/cpufeatures.h) that are
+# either REQUIRED to be enabled, or DISABLED (always ignored) for this
+# particular compile-time configuration. The tests for these features
+# are turned into compile-time constants via the generated
+# <asm/featuremasks.h>.
+#
+# The naming of these variables *must* match asm/cpufeatures.h.

I presume they must match X86_FEATURE_<name>?

Right, let me add this.


And REQUIRED and DISABLED is manipulated in by the script?

I guess I'll see later.

Yep!

Thanks!
Xin