nVMX: Add a test to toggle host (L1) CR4.LA57 on VM-Exit
Sean Christopherson
reviewerPATCH 1/1 nVMX: Add a test to toggle host (L1) CR4.LA57 on VM-Exit
Expand vmx_cr_load_test() to verify that KVM correclty handles toggling L1's CR4.LA57 on nested VM-Exit. LA57 can only be toggled in isolation via VM-Exit, i.e. be the lone bit the causes a MMU role change, because MOV CR4 #GPs if LA57 is changed while long mode is active.
Test both nested EPT and shadow paging (for L2); the latter will also toggle KVM's guest_mode bit in the MMU role due to L1 and L2 sharing an MMU context, but it obviously shouldn't break.
Signed-off-by Sean Christopherson <[email protected]>
--- x86/vmx.h | 12 +++++++++ x86/vmx_tests.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 79 insertions(+), 1 deletion(-)
x86/vmx.h +12 -0
@@ -783,6 +783,18 @@ static inline u64 vmcs_read(enum Encoding enc)return val; } +/* +* VMREAD with a guaranteed memory operand, used to test KVM's MMU by forcing +* KVM to translate GVA->GPA. +*/ +static inline u64 vmcs_readm (enum Encoding enc) +{ +u64 val; + + asmvolatile ("vmread %1, %0" :"=m" (val) :"r" ((u64 )enc) :"cc" ); +return val; +} +static inline int vmcs_read_checking (enum Encoding enc,u64 *value) {u64 rflags =read_rflags () |X86_EFLAGS_CF |X86_EFLAGS_ZF ;
x86/vmx_tests.c +67 -1
89 lines not on this page · raw message
Signature · 1 line
2.32.0.288.g62a8d224e6-goog