* [kvm-unit-tests PATCH] x86: Fix the name for the SMEP CPUID bit
@ 2020-02-04 17:50 Sean Christopherson
2020-02-04 19:17 ` Krish Sadhukhan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sean Christopherson @ 2020-02-04 17:50 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm
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).
Fixes: 6ddcc29 ("kvm-unit-test: x86: Implement a generic wrapper for cpuid/cpuid_indexed functions")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
lib/x86/processor.h | 2 +-
x86/access.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/x86/processor.h b/lib/x86/processor.h
index 7057180..03fdf64 100644
--- a/lib/x86/processor.h
+++ b/lib/x86/processor.h
@@ -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))
diff --git a/x86/access.c b/x86/access.c
index 5233713..7303fc3 100644
--- a/x86/access.c
+++ b/x86/access.c
@@ -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++;
--
2.24.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [kvm-unit-tests PATCH] x86: Fix the name for the SMEP CPUID bit
2020-02-04 17:50 [kvm-unit-tests PATCH] x86: Fix the name for the SMEP CPUID bit Sean Christopherson
@ 2020-02-04 19:17 ` Krish Sadhukhan
2020-02-05 11:41 ` Vitaly Kuznetsov
2020-02-05 14:56 ` Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Krish Sadhukhan @ 2020-02-04 19:17 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm
On 2/4/20 9:50 AM, Sean Christopherson wrote:
> 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).
>
> Fixes: 6ddcc29 ("kvm-unit-test: x86: Implement a generic wrapper for cpuid/cpuid_indexed functions")
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> lib/x86/processor.h | 2 +-
> x86/access.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/x86/processor.h b/lib/x86/processor.h
> index 7057180..03fdf64 100644
> --- a/lib/x86/processor.h
> +++ b/lib/x86/processor.h
> @@ -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))
> diff --git a/x86/access.c b/x86/access.c
> index 5233713..7303fc3 100644
> --- a/x86/access.c
> +++ b/x86/access.c
> @@ -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++;
Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [kvm-unit-tests PATCH] x86: Fix the name for the SMEP CPUID bit
2020-02-04 17:50 [kvm-unit-tests PATCH] x86: Fix the name for the SMEP CPUID bit Sean Christopherson
2020-02-04 19:17 ` Krish Sadhukhan
@ 2020-02-05 11:41 ` Vitaly Kuznetsov
2020-02-05 14:56 ` Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Vitaly Kuznetsov @ 2020-02-05 11:41 UTC (permalink / raw)
To: Sean Christopherson; +Cc: kvm, Paolo Bonzini
Sean Christopherson <sean.j.christopherson@intel.com> writes:
> 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).
>
> Fixes: 6ddcc29 ("kvm-unit-test: x86: Implement a generic wrapper for cpuid/cpuid_indexed functions")
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> lib/x86/processor.h | 2 +-
> x86/access.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/x86/processor.h b/lib/x86/processor.h
> index 7057180..03fdf64 100644
> --- a/lib/x86/processor.h
> +++ b/lib/x86/processor.h
> @@ -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))
> diff --git a/x86/access.c b/x86/access.c
> index 5233713..7303fc3 100644
> --- a/x86/access.c
> +++ b/x86/access.c
> @@ -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++;
"No functional change intended" :-)
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
--
Vitaly
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [kvm-unit-tests PATCH] x86: Fix the name for the SMEP CPUID bit
2020-02-04 17:50 [kvm-unit-tests PATCH] x86: Fix the name for the SMEP CPUID bit Sean Christopherson
2020-02-04 19:17 ` Krish Sadhukhan
2020-02-05 11:41 ` Vitaly Kuznetsov
@ 2020-02-05 14:56 ` Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2020-02-05 14:56 UTC (permalink / raw)
To: Sean Christopherson; +Cc: kvm
On 04/02/20 18:50, Sean Christopherson wrote:
> 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).
>
> Fixes: 6ddcc29 ("kvm-unit-test: x86: Implement a generic wrapper for cpuid/cpuid_indexed functions")
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> lib/x86/processor.h | 2 +-
> x86/access.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/x86/processor.h b/lib/x86/processor.h
> index 7057180..03fdf64 100644
> --- a/lib/x86/processor.h
> +++ b/lib/x86/processor.h
> @@ -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))
> diff --git a/x86/access.c b/x86/access.c
> index 5233713..7303fc3 100644
> --- a/x86/access.c
> +++ b/x86/access.c
> @@ -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++;
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-02-05 14:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 17:50 [kvm-unit-tests PATCH] x86: Fix the name for the SMEP CPUID bit Sean Christopherson
2020-02-04 19:17 ` Krish Sadhukhan
2020-02-05 11:41 ` Vitaly Kuznetsov
2020-02-05 14:56 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).