x86/cpufeatures: Make X86_FEATURE leaf 17 Linux-specific
PATCH 1/1 x86/cpufeatures: Make X86_FEATURE leaf 17 Linux-specific
From: "Borislav Petkov (AMD)" <[email protected]>
That cap element was supposed to mirror CPUID flags from CPUID_0x80000007_EBX but that leaf has still to this day only three bits defined in it. So move those bits to scattered.c and free the leaf for synthetic flags.
No functional changes.
--- arch/x86/include/asm/cpufeature.h | 2 +- arch/x86/include/asm/cpufeatures.h | 5 ++++- arch/x86/kernel/cpu/common.c | 8 ++------ arch/x86/kernel/cpu/scattered.c | 3 +++ arch/x86/kvm/reverse_cpuid.h | 1 - tools/arch/x86/include/asm/cpufeatures.h | 5 ++++- 6 files changed, 14 insertions(+), 10 deletions(-)
arch/x86/include/asm/cpufeature.h +1 -1
@@ -30,7 +30,7 @@ enum cpuid_leafsCPUID_6_EAX ,CPUID_8000_000A_EDX ,CPUID_7_ECX , -CPUID_8000_0007_EBX , +CPUID_LNX_6 ,CPUID_7_EDX ,CPUID_8000_001F_EAX , CPUID_8000_0021_EAX,
arch/x86/include/asm/cpufeatures.h +4 -1
@@ -407,9 +407,12 @@#define X86_FEATURE_ENQCMD (16*32+29)/* "enqcmd" ENQCMD and ENQCMDS instructions */ #define X86_FEATURE_SGX_LC (16*32+30)/* "sgx_lc" Software Guard Extensions Launch Control */ -/* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ +/* +* Linux-defined word for use with scattered/synthetic bits. +*/ #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0)/* "overflow_recov" MCA overflow recovery support */ #define X86_FEATURE_SUCCOR (17*32+ 1)/* "succor" Uncorrectable error containment and recovery */ +#define X86_FEATURE_SMCA (17*32+ 3)/* "smca" Scalable MCA */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */
arch/x86/kernel/cpu/common.c +2 -6
@@ -1021,12 +1021,8 @@ void get_cpu_cap(struct cpuinfo_x86 *c) c->x86_capability[CPUID_8000_0001_EDX ] = edx; } -if (c->extended_cpuid_level >=0x80000007 ) { -cpuid (0x80000007 , &eax, &ebx, &ecx, &edx); - - c->x86_capability[CPUID_8000_0007_EBX ] = ebx; - c->x86_power = edx; - } +if (c->extended_cpuid_level >=0x80000007 ) + c->x86_power =cpuid_edx (0x80000007 );if (c->extended_cpuid_level >=0x80000008 ) {cpuid (0x80000008 , &eax, &ebx, &ecx, &edx);
arch/x86/kernel/cpu/scattered.c +3 -0
@@ -43,6 +43,9 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_SGX1, CPUID_EAX, 0, 0x00000012, 0 }, { X86_FEATURE_SGX2, CPUID_EAX, 1, 0x00000012, 0 }, { X86_FEATURE_SGX_EDECCSSA, CPUID_EAX, 11, 0x00000012, 0 }, + { X86_FEATURE_OVERFLOW_RECOV, CPUID_EBX, 0, 0x80000007, 0 }, + { X86_FEATURE_SUCCOR, CPUID_EBX, 1, 0x80000007, 0 }, + { X86_FEATURE_SMCA, CPUID_EBX, 3, 0x80000007, 0 }, { X86_FEATURE_HW_PSTATE, CPUID_EDX, 7, 0x80000007, 0 }, { X86_FEATURE_CPB, CPUID_EDX, 9, 0x80000007, 0 }, { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 },
arch/x86/kvm/reverse_cpuid.h +0 -1
@@ -75,7 +75,6 @@ static const struct cpuid_reg reverse_cpuid[] = { [CPUID_6_EAX] = { 6, 0, CPUID_EAX}, [CPUID_8000_000A_EDX] = {0x8000000a, 0, CPUID_EDX}, [CPUID_7_ECX] = { 7, 0, CPUID_ECX}, - [CPUID_8000_0007_EBX] = {0x80000007, 0, CPUID_EBX}, [CPUID_7_EDX] = { 7, 0, CPUID_EDX}, [CPUID_7_1_EAX] = { 7, 1, CPUID_EAX}, [CPUID_12_EAX] = {0x00000012, 0, CPUID_EAX},
tools/arch/x86/include/asm/cpufeatures.h +4 -1
@@ -407,9 +407,12 @@#define X86_FEATURE_ENQCMD (16*32+29)/* "enqcmd" ENQCMD and ENQCMDS instructions */ #define X86_FEATURE_SGX_LC (16*32+30)/* "sgx_lc" Software Guard Extensions Launch Control */ -/* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ +/* +* Linux-defined word for use with scattered/synthetic bits. +*/ #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0)/* "overflow_recov" MCA overflow recovery support */ #define X86_FEATURE_SUCCOR (17*32+ 1)/* "succor" Uncorrectable error containment and recovery */ +#define X86_FEATURE_SMCA (17*32+ 3)/* "smca" Scalable MCA */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */
Signature · 1 line
2.51.0
The following commit has been merged into the x86/cpu branch of tip:
The following commit has been merged into the x86/cpu branch of tip:
Commit-ID: ddde4abaa0ecc8395e0fcfa3e92f65d481890cc8 Gitweb: https://git.kernel.org/tip/ddde4abaa0ecc8395e0fcfa3e92f65d481890cc8 Author: Borislav Petkov (AMD) <[email protected]> AuthorDate: Wed, 24 Sep 2025 14:59:35 +02:00 Committer: Borislav Petkov (AMD) <[email protected]> CommitterDate: Mon, 13 Oct 2025 16:21:25 +02:00
x86/cpufeatures: Make X86_FEATURE leaf 17 Linux-specific
That cpuinfo_x86.x86_capability[] element was supposed to mirror CPUID flags from CPUID_0x80000007_EBX but that leaf has still to this day only three bits defined in it. So move those bits to scattered.c and free the capability element for synthetic flags.
No functional changes.
--- arch/x86/include/asm/cpufeature.h | 2 +- arch/x86/include/asm/cpufeatures.h | 5 ++++- arch/x86/kernel/cpu/common.c | 8 ++------ arch/x86/kernel/cpu/scattered.c | 3 +++ arch/x86/kvm/reverse_cpuid.h | 1 - tools/arch/x86/include/asm/cpufeatures.h | 5 ++++- 6 files changed, 14 insertions(+), 10 deletions(-)
arch/x86/include/asm/cpufeature.h +1 -1
@@ -30,7 +30,7 @@ enum cpuid_leafsCPUID_6_EAX ,CPUID_8000_000A_EDX ,CPUID_7_ECX , -CPUID_8000_0007_EBX , +CPUID_LNX_6 ,CPUID_7_EDX ,CPUID_8000_001F_EAX , CPUID_8000_0021_EAX,
arch/x86/include/asm/cpufeatures.h +4 -1
@@ -407,9 +407,12 @@#define X86_FEATURE_ENQCMD (16*32+29)/* "enqcmd" ENQCMD and ENQCMDS instructions */ #define X86_FEATURE_SGX_LC (16*32+30)/* "sgx_lc" Software Guard Extensions Launch Control */ -/* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ +/* +* Linux-defined word for use with scattered/synthetic bits. +*/ #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0)/* "overflow_recov" MCA overflow recovery support */ #define X86_FEATURE_SUCCOR (17*32+ 1)/* "succor" Uncorrectable error containment and recovery */ +#define X86_FEATURE_SMCA (17*32+ 3)/* "smca" Scalable MCA */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */
arch/x86/kernel/cpu/common.c +2 -6
@@ -1021,12 +1021,8 @@ void get_cpu_cap(struct cpuinfo_x86 *c) c->x86_capability[CPUID_8000_0001_EDX ] = edx; } -if (c->extended_cpuid_level >=0x80000007 ) { -cpuid (0x80000007 , &eax, &ebx, &ecx, &edx); - - c->x86_capability[CPUID_8000_0007_EBX ] = ebx; - c->x86_power = edx; - } +if (c->extended_cpuid_level >=0x80000007 ) + c->x86_power =cpuid_edx (0x80000007 );if (c->extended_cpuid_level >=0x80000008 ) {cpuid (0x80000008 , &eax, &ebx, &ecx, &edx);
arch/x86/kernel/cpu/scattered.c +3 -0
@@ -44,6 +44,9 @@ static const struct cpuid_bit cpuid_bits[] = { { X86_FEATURE_SGX1, CPUID_EAX, 0, 0x00000012, 0 }, { X86_FEATURE_SGX2, CPUID_EAX, 1, 0x00000012, 0 }, { X86_FEATURE_SGX_EDECCSSA, CPUID_EAX, 11, 0x00000012, 0 }, + { X86_FEATURE_OVERFLOW_RECOV, CPUID_EBX, 0, 0x80000007, 0 }, + { X86_FEATURE_SUCCOR, CPUID_EBX, 1, 0x80000007, 0 }, + { X86_FEATURE_SMCA, CPUID_EBX, 3, 0x80000007, 0 }, { X86_FEATURE_HW_PSTATE, CPUID_EDX, 7, 0x80000007, 0 }, { X86_FEATURE_CPB, CPUID_EDX, 9, 0x80000007, 0 }, { X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 },
arch/x86/kvm/reverse_cpuid.h +0 -1
@@ -78,7 +78,6 @@ static const struct cpuid_reg reverse_cpuid[] = { [CPUID_6_EAX] = { 6, 0, CPUID_EAX}, [CPUID_8000_000A_EDX] = {0x8000000a, 0, CPUID_EDX}, [CPUID_7_ECX] = { 7, 0, CPUID_ECX}, - [CPUID_8000_0007_EBX] = {0x80000007, 0, CPUID_EBX}, [CPUID_7_EDX] = { 7, 0, CPUID_EDX}, [CPUID_7_1_EAX] = { 7, 1, CPUID_EAX}, [CPUID_12_EAX] = {0x00000012, 0, CPUID_EAX},
tools/arch/x86/include/asm/cpufeatures.h +4 -1
@@ -407,9 +407,12 @@#define X86_FEATURE_ENQCMD (16*32+29)/* "enqcmd" ENQCMD and ENQCMDS instructions */ #define X86_FEATURE_SGX_LC (16*32+30)/* "sgx_lc" Software Guard Extensions Launch Control */ -/* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ +/* +* Linux-defined word for use with scattered/synthetic bits. +*/ #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0)/* "overflow_recov" MCA overflow recovery support */ #define X86_FEATURE_SUCCOR (17*32+ 1)/* "succor" Uncorrectable error containment and recovery */ +#define X86_FEATURE_SMCA (17*32+ 3)/* "smca" Scalable MCA */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */