All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests] x86: clean up EFER definitions
@ 2021-02-18 13:26 Paolo Bonzini
  2021-02-18 18:02 ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2021-02-18 13:26 UTC (permalink / raw)
  To: kvm

The X86_EFER_LMA definition is wrong, while X86_IA32_EFER is unused.
There are also two useless WRMSRs that try to set EFER_LMA in
x86/pks.c and x86/pku.c.  Clean them all up.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 lib/x86/processor.h | 2 --
 x86/pks.c           | 1 -
 x86/pku.c           | 1 -
 3 files changed, 4 deletions(-)

diff --git a/lib/x86/processor.h b/lib/x86/processor.h
index 9f85fd2..dda57a1 100644
--- a/lib/x86/processor.h
+++ b/lib/x86/processor.h
@@ -72,8 +72,6 @@
 #define X86_EFLAGS_ALU (X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_AF | \
 			X86_EFLAGS_ZF | X86_EFLAGS_SF | X86_EFLAGS_OF)
 
-#define X86_IA32_EFER          0xc0000080
-#define X86_EFER_LMA           (1UL << 8)
 
 /*
  * CPU features
diff --git a/x86/pks.c b/x86/pks.c
index a506622..ef95fb9 100644
--- a/x86/pks.c
+++ b/x86/pks.c
@@ -77,7 +77,6 @@ int main(int ac, char **av)
     setup_vm();
     setup_alt_stack();
     set_intr_alt_stack(14, pf_tss);
-    wrmsr(MSR_EFER, rdmsr(MSR_EFER) | EFER_LMA);
 
     if (reserve_pages(SUPER_BASE, SUPER_BASE >> 12))
         report_abort("Could not reserve memory");
diff --git a/x86/pku.c b/x86/pku.c
index 7e8247c..51ff412 100644
--- a/x86/pku.c
+++ b/x86/pku.c
@@ -76,7 +76,6 @@ int main(int ac, char **av)
     setup_vm();
     setup_alt_stack();
     set_intr_alt_stack(14, pf_tss);
-    wrmsr(MSR_EFER, rdmsr(MSR_EFER) | EFER_LMA);
 
     if (reserve_pages(USER_BASE, USER_BASE >> 12))
         report_abort("Could not reserve memory");
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH kvm-unit-tests] x86: clean up EFER definitions
  2021-02-18 13:26 [PATCH kvm-unit-tests] x86: clean up EFER definitions Paolo Bonzini
@ 2021-02-18 18:02 ` Sean Christopherson
  2021-02-18 18:31   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Christopherson @ 2021-02-18 18:02 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm

On Thu, Feb 18, 2021, Paolo Bonzini wrote:
> The X86_EFER_LMA definition is wrong, while X86_IA32_EFER is unused.
> There are also two useless WRMSRs that try to set EFER_LMA in
> x86/pks.c and x86/pku.c.  Clean them all up.

For posterity: EFER_LMA is incorrectly defined as EFER_LME, and both PKS and PKU
tests are 64-bit only, so the WRMSRs are guaranteed to be nops.

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Sean Christopherson <seanjc@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH kvm-unit-tests] x86: clean up EFER definitions
  2021-02-18 18:02 ` Sean Christopherson
@ 2021-02-18 18:31   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2021-02-18 18:31 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm

On 18/02/21 19:02, Sean Christopherson wrote:
> On Thu, Feb 18, 2021, Paolo Bonzini wrote:
>> The X86_EFER_LMA definition is wrong, while X86_IA32_EFER is unused.
>> There are also two useless WRMSRs that try to set EFER_LMA in
>> x86/pks.c and x86/pku.c.  Clean them all up.
> 
> For posterity: EFER_LMA is incorrectly defined as EFER_LME, and both PKS and PKU
> tests are 64-bit only, so the WRMSRs are guaranteed to be nops.

Added to the commit message and pushed, thanks.

Paolo

>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> Reviewed-by: Sean Christopherson <seanjc@google.com>
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-18 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-18 13:26 [PATCH kvm-unit-tests] x86: clean up EFER definitions Paolo Bonzini
2021-02-18 18:02 ` Sean Christopherson
2021-02-18 18:31   ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.