x86: Fix the name for the SMEP CPUID bit
PATCH 1/1 x86: Fix the name for the SMEP CPUID bit
Fix the X86_FEATURE_* name for SMEP, which is incorrectly named X86_FEATURE_INVPCID_SINGLE and is a wee bit confusing when looking at the SMEP unit tests.
Note, there is no INVPCID_SINGLE CPUID bit, the bogus name likely came from the Linux kernel, which has a synthetic feature flag for INVPCID_SINGLE in word 7, bit 7 (CPUID 0x7.EBX is stored in word 9).
--- lib/x86/processor.h | 2 +- x86/access.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
lib/x86/processor.h +1 -1
@@ -138,7 +138,7 @@ static inline u8 cpuid_maxphyaddr(void)#define X86_FEATURE_XMM2 (CPUID(0x1, 0, EDX, 26))#define X86_FEATURE_TSC_ADJUST (CPUID(0x7, 0, EBX, 1))#define X86_FEATURE_HLE (CPUID(0x7, 0, EBX, 4)) -#define X86_FEATURE_INVPCID_SINGLE (CPUID(0x7, 0, EBX, 7)) +#define X86_FEATURE_SMEP (CPUID(0x7, 0, EBX, 7))#define X86_FEATURE_INVPCID (CPUID(0x7, 0, EBX, 10))#define X86_FEATURE_RTM (CPUID(0x7, 0, EBX, 11))#define X86_FEATURE_SMAP (CPUID(0x7, 0, EBX, 20))
x86/access.c +2 -2
@@ -860,7 +860,7 @@ static int check_smep_andnot_wp(ac_pool_t *pool)ac_test_t at1;int err_prepare_andnot_wp, err_smep_andnot_wp; -if (!this_cpu_has (X86_FEATURE_INVPCID_SINGLE )) { +if (!this_cpu_has (X86_FEATURE_SMEP )) {return 1 ; }
@@ -955,7 +955,7 @@ static int ac_test_run(void) } } -if (!this_cpu_has (X86_FEATURE_INVPCID_SINGLE )) { +if (!this_cpu_has (X86_FEATURE_SMEP )) { tests++;if (set_cr4_smep (1 ) ==GP_VECTOR ) { successes++;
Signature · 1 line
2.24.1
Quoted 42 lines · Sean Christopherson
Fix the X86_FEATURE_* name for SMEP, which is incorrectly named
X86_FEATURE_INVPCID_SINGLEand is a wee bit confusing when looking at the SMEP unit tests.Note, there is no
INVPCID_SINGLECPUID bit, the bogus name likely came from the Linux kernel, which has a synthetic feature flag forINVPCID_SINGLEin word 7, bit 7 (CPUID 0x7.EBX is stored in word 9).Fixes 6ddcc29 ("kvm-unit-test: x86: Implement a generic wrapper for cpuid/cpuid_indexed functions")Signed-off-by Sean Christopherson <[email protected]>--- lib/x86/processor.h | 2 +- x86/access.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)lib/x86/processor.h +1
-1@@ -138,7 +138,7 @@ static inline u8 cpuid_maxphyaddr(void)#define X86_FEATURE_XMM2 (CPUID(0x1, 0, EDX, 26))#define X86_FEATURE_TSC_ADJUST (CPUID(0x7, 0, EBX, 1))#define X86_FEATURE_HLE (CPUID(0x7, 0, EBX, 4)) -#define X86_FEATURE_INVPCID_SINGLE (CPUID(0x7, 0, EBX, 7)) +#define X86_FEATURE_SMEP (CPUID(0x7, 0, EBX, 7))#define X86_FEATURE_INVPCID (CPUID(0x7, 0, EBX, 10))#define X86_FEATURE_RTM (CPUID(0x7, 0, EBX, 11))#define X86_FEATURE_SMAP (CPUID(0x7, 0, EBX, 20))x86/access.c +1
-1@@ -860,7 +860,7 @@ static int check_smep_andnot_wp(ac_pool_t *pool)ac_test_t at1;int err_prepare_andnot_wp, err_smep_andnot_wp; -if (!this_cpu_has (X86_FEATURE_INVPCID_SINGLE )) { +if (!this_cpu_has (X86_FEATURE_SMEP )) {return 1 ; }
x86/access.c static int ac_test_run(void) · line 961
Quoted 8 lines
x86/access.c +1
-1@@ -955,7 +955,7 @@ static int ac_test_run(void) } } -if (!this_cpu_has (X86_FEATURE_INVPCID_SINGLE )) { +if (!this_cpu_has (X86_FEATURE_SMEP )) { tests++;if (set_cr4_smep (1 ) ==GP_VECTOR ) { successes++;
Quoted 42 lines · Sean Christopherson
Fix the X86_FEATURE_* name for SMEP, which is incorrectly named
X86_FEATURE_INVPCID_SINGLEand is a wee bit confusing when looking at the SMEP unit tests.Note, there is no
INVPCID_SINGLECPUID bit, the bogus name likely came from the Linux kernel, which has a synthetic feature flag forINVPCID_SINGLEin word 7, bit 7 (CPUID 0x7.EBX is stored in word 9).Fixes 6ddcc29 ("kvm-unit-test: x86: Implement a generic wrapper for cpuid/cpuid_indexed functions")Signed-off-by Sean Christopherson <[email protected]>--- lib/x86/processor.h | 2 +- x86/access.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)lib/x86/processor.h +1
-1@@ -138,7 +138,7 @@ static inline u8 cpuid_maxphyaddr(void)#define X86_FEATURE_XMM2 (CPUID(0x1, 0, EDX, 26))#define X86_FEATURE_TSC_ADJUST (CPUID(0x7, 0, EBX, 1))#define X86_FEATURE_HLE (CPUID(0x7, 0, EBX, 4)) -#define X86_FEATURE_INVPCID_SINGLE (CPUID(0x7, 0, EBX, 7)) +#define X86_FEATURE_SMEP (CPUID(0x7, 0, EBX, 7))#define X86_FEATURE_INVPCID (CPUID(0x7, 0, EBX, 10))#define X86_FEATURE_RTM (CPUID(0x7, 0, EBX, 11))#define X86_FEATURE_SMAP (CPUID(0x7, 0, EBX, 20))x86/access.c +1
-1@@ -860,7 +860,7 @@ static int check_smep_andnot_wp(ac_pool_t *pool)ac_test_t at1;int err_prepare_andnot_wp, err_smep_andnot_wp; -if (!this_cpu_has (X86_FEATURE_INVPCID_SINGLE )) { +if (!this_cpu_has (X86_FEATURE_SMEP )) {return 1 ; }
x86/access.c static int ac_test_run(void) · line 961
Quoted 8 lines
x86/access.c +1
-1@@ -955,7 +955,7 @@ static int ac_test_run(void) } } -if (!this_cpu_has (X86_FEATURE_INVPCID_SINGLE )) { +if (!this_cpu_has (X86_FEATURE_SMEP )) { tests++;if (set_cr4_smep (1 ) ==GP_VECTOR ) { successes++;
"No functional change intended" :-)
Signature · 1 line
Vitaly
Quoted 43 lines · Sean Christopherson
Fix the X86_FEATURE_* name for SMEP, which is incorrectly named
X86_FEATURE_INVPCID_SINGLEand is a wee bit confusing when looking at the SMEP unit tests.Note, there is no
INVPCID_SINGLECPUID bit, the bogus name likely came from the Linux kernel, which has a synthetic feature flag forINVPCID_SINGLEin word 7, bit 7 (CPUID 0x7.EBX is stored in word 9).Fixes 6ddcc29 ("kvm-unit-test: x86: Implement a generic wrapper for cpuid/cpuid_indexed functions")Signed-off-by Sean Christopherson <[email protected]>--- lib/x86/processor.h | 2 +- x86/access.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)lib/x86/processor.h +1
-1@@ -138,7 +138,7 @@ static inline u8 cpuid_maxphyaddr(void)#define X86_FEATURE_XMM2 (CPUID(0x1, 0, EDX, 26))#define X86_FEATURE_TSC_ADJUST (CPUID(0x7, 0, EBX, 1))#define X86_FEATURE_HLE (CPUID(0x7, 0, EBX, 4)) -#define X86_FEATURE_INVPCID_SINGLE (CPUID(0x7, 0, EBX, 7)) +#define X86_FEATURE_SMEP (CPUID(0x7, 0, EBX, 7))#define X86_FEATURE_INVPCID (CPUID(0x7, 0, EBX, 10))#define X86_FEATURE_RTM (CPUID(0x7, 0, EBX, 11))#define X86_FEATURE_SMAP (CPUID(0x7, 0, EBX, 20))x86/access.c +1
-1@@ -860,7 +860,7 @@ static int check_smep_andnot_wp(ac_pool_t *pool)ac_test_t at1;int err_prepare_andnot_wp, err_smep_andnot_wp; -if (!this_cpu_has (X86_FEATURE_INVPCID_SINGLE )) { +if (!this_cpu_has (X86_FEATURE_SMEP )) {return 1 ; }
x86/access.c static int ac_test_run(void) · line 961
Quoted 8 lines
x86/access.c +1
-1@@ -955,7 +955,7 @@ static int ac_test_run(void) } } -if (!this_cpu_has (X86_FEATURE_INVPCID_SINGLE )) { +if (!this_cpu_has (X86_FEATURE_SMEP )) { tests++;if (set_cr4_smep (1 ) ==GP_VECTOR ) { successes++;
Queued, thanks.
Paolo