Skip to contentSkip to conversation

x86: clean up EFER definitions

PATCH In review Paolo Bonzini 2 participants 3 messages Feb 18, 2021 KVM

lore
Share & tools
lore

Paolo Bonzini

author maintainer
#0 lore raw

PATCH 1/1 x86: clean up EFER definitions

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.

---
 lib/x86/processor.h | 2 --
 x86/pks.c           | 1 -
 x86/pku.c           | 1 -
 3 files changed, 4 deletions(-)
lib/x86/processor.h +0 -2
index 9f85fd2..dda57a1 100644
@@ -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
x86/pks.c +0 -1
index a506622..ef95fb9 100644
@@ -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");
x86/pku.c +0 -1
index 7e8247c..51ff412 100644
@@ -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");
Signature · 1 line
2.26.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Paolo Bonzini

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.

Quoted 1 line
author maintainer
#2 lore raw
Quoted 7 lines · Sean Christopherson
Quoted 3 lines · Paolo Bonzini

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

Quoted 4 lines
Quoted 1 line