x86: LA57 canonical testcases
Sean Christopherson
reviewerv2 cover x86: LA57 canonical testcases
v2 of Maxim's series to add testcases for canonical checks of various MSRs, segment bases, and instructions that were found to ignore CR4.LA57 on CPUs that support 5 level paging.
v2:
- Fold into existing la57 test.
- Always skip SYSENTER tests (they fail when run in a VM).
- Lots of cosmetics cleanups (see v1 feedback for details).
v1: https://lore.kernel.org/all/[email protected]
Maxim Levitsky (5):
x86: Add _safe() and _fep_safe() variants to segment base load
instructions
x86: Add a few functions for gdt manipulation
x86: Move struct invpcid_desc descriptor to processor.h
x86: Add testcases for writing (non)canonical LA57 values to MSRs and
bases
nVMX: add a test for canonical checks of various host state vmcs12
fields.
Sean Christopherson (1):
x86: Expand LA57 test to 64-bit mode (to prep for canonical testing)
lib/x86/desc.c | 38 ++++- lib/x86/desc.h | 9 +- lib/x86/msr.h | 42 ++++++ lib/x86/processor.h | 58 +++++++- x86/Makefile.common | 3 +- x86/Makefile.i386 | 2 +- x86/la57.c | 342 +++++++++++++++++++++++++++++++++++++++++++- x86/pcid.c | 6 - x86/unittests.cfg | 2 +- x86/vmx_tests.c | 167 +++++++++++++++++++++ 10 files changed, 645 insertions(+), 24 deletions(-)
base-commit: f77fb696cfd0e4a5562cdca189be557946bf522f
Signature · 1 line
2.48.1.601.g30ceb7b040-goog
Sean Christopherson
reviewerPATCH v2 1/6 x86: Add _safe() and _fep_safe() variants to segment base load instructions
From: Maxim Levitsky <[email protected]>
Add _safe() and _fep_safe() helpers for segment/base instructions; the helpers will be used to validate various ways of setting the segment bases and GDT/LDT bases.
--- lib/x86/desc.h | 4 ++-- lib/x86/processor.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-)
lib/x86/desc.h +2 -2
@@ -286,8 +286,8 @@ extern unsigned long get_gdt_entry_limit(gdt_entry_t *entry); #define asm_safe(insn, inputs...) \ __asm_safe("", insn, inputs) -#define asm_fep_safe(insn, output, inputs...) \ - __asm_safe_out1(KVM_FEP, insn, output, inputs) +#define asm_fep_safe(insn, inputs...) \ + __asm_safe_out1(KVM_FEP, insn,, inputs) #define __asm_safe_out1(fep, insn, output, inputs...) \ ({ \
lib/x86/processor.h +45 -0
75 lines not on this page · raw message
Signature · 1 line
2.48.1.601.g30ceb7b040-goog
Sean Christopherson
reviewerPATCH v2 2/6 x86: Add a few functions for gdt manipulation
In reply to Sean ChristophersonFrom: Maxim Levitsky <[email protected]>
Add a few functions that will be used to manipulate various segment bases that are loaded via GDT.
--- lib/x86/desc.c | 38 +++++++++++++++++++++++++++++++------- lib/x86/desc.h | 5 +++++ 2 files changed, 36 insertions(+), 7 deletions(-)
lib/x86/desc.c +31 -7
@@ -338,7 +338,7 @@ bool exception_rflags_rf(void)static char intr_alt_stack[4096 ]; -void set_gdt_entry (int sel,unsigned long base,u32 limit,u8 type,u8 flags) +void set_gdt_entry_base (int sel,unsigned long base) {gdt_entry_t *entry = &gdt[sel >>3 ];
@@ -347,10 +347,6 @@ void set_gdt_entry(int sel, unsigned long base, u32 limit, u8 type, u8 flags) entry->base2 = (base >>16 ) &0xFF ; entry->base3 = (base >>24 ) &0xFF ; -/* Setup the descriptor limits, type and flags */ - entry->limit1 = (limit &0xFFFF ); - entry->type_limit_flags = ((limit &0xF0000 ) >>8 ) | ((flags &0xF0 ) <<8 ) | type; -#ifdef __x86_64__if (!entry->s) {struct system_desc64 *entry16 = (struct system_desc64 *)entry;
@@ -360,6 +356,24 @@ void set_gdt_entry(int sel, unsigned long base, u32 limit, u8 type, u8 flags)#endif } +void set_gdt_entry (int sel,unsigned long base,u32 limit,u8 type,u8 flags) +{ +gdt_entry_t *entry = &gdt[sel >>3 ]; + +/* Setup the descriptor limits, type and flags */ + entry->limit1 = (limit &0xFFFF ); + entry->type_limit_flags = ((limit &0xF0000 ) >>8 ) | ((flags &0xF0 ) <<8 ) | type; +set_gdt_entry_base (sel, base); +} + +void clear_tss_busy (int sel) +{ +gdt_entry_t *entry = &gdt[sel >>3 ]; + + entry->type_limit_flags &= ~0xFF ; + entry->type_limit_flags |=0x89 ; +} +void load_gdt_tss (size_t tss_offset) {lgdt (&gdt_descr);
@@ -483,14 +497,24 @@ void __set_exception_jmpbuf(jmp_buf *addr) exception_jmpbuf = addr; } -gdt_entry_t *get_tss_descr (void ) +gdt_entry_t *get_gdt_entry (u16 sel) {struct descriptor_table_ptr gdt_ptr;gdt_entry_t *gdt;sgdt (&gdt_ptr); gdt = (gdt_entry_t *)gdt_ptr.base; -return &gdt[str () /8 ]; +return &gdt[sel /8 ]; +} + +gdt_entry_t *get_tss_descr (void ) +{ +return get_gdt_entry (str ()); +} + +gdt_entry_t *get_ldt_descr (void ) +{ +return get_gdt_entry (sldt ()); }unsigned long get_gdt_entry_base (gdt_entry_t *entry)
lib/x86/desc.h +5 -0
@@ -246,6 +246,8 @@ void set_idt_entry(int vec, void *addr, int dpl);void set_idt_sel (int vec,u16 sel);void set_idt_dpl (int vec,u16 dpl);void set_gdt_entry (int sel,unsigned long base,u32 limit,u8 access,u8 gran); +void set_gdt_entry_base (int sel,unsigned long base); +void clear_tss_busy (int sel);void load_gdt_tss (size_t tss_offset);void set_intr_alt_stack (int e,void *fn);void print_current_tss_info (void );
@@ -268,7 +270,10 @@ static inline void *get_idt_addr(idt_entry_t *entry)return (void *)addr; } +extern gdt_entry_t *get_gdt_entry (u16 sel);extern gdt_entry_t *get_tss_descr (void ); +gdt_entry_t *get_ldt_descr (void ); +extern unsigned long get_gdt_entry_base (gdt_entry_t *entry);extern unsigned long get_gdt_entry_limit (gdt_entry_t *entry);
Signature · 1 line
2.48.1.601.g30ceb7b040-goog
Sean Christopherson
reviewerPATCH v2 3/6 x86: Move struct invpcid_desc descriptor to processor.h
In reply to Sean ChristophersonFrom: Maxim Levitsky <[email protected]>
Move struct invpcid_desc descriptor to processor.h so that it can be used in tests that are external to pcid.c.
--- lib/x86/processor.h | 7 ++++++- x86/pcid.c | 6 ------ 2 files changed, 6 insertions(+), 7 deletions(-)
lib/x86/processor.h +6 -1
@@ -836,8 +836,13 @@ static inline void invlpg(volatile void *va) asmvolatile ("invlpg (%0)" ::"r" (va) :"memory" ); } +struct invpcid_desc { +u64 pcid :12 ; +u64 rsv :52 ; +u64 addr :64 ; +}; -static inline int invpcid_safe (unsigned long type,void *desc) +static inline int invpcid_safe (unsigned long type,struct invpcid_desc *desc) {/* invpcid (%rax), %rbx */ return asm_safe (".byte 0x66,0x0f,0x38,0x82,0x18" ,"a" (desc),"b" (type));
x86/pcid.c +0 -6
@@ -4,12 +4,6 @@#include "processor.h" #include "desc.h" -struct invpcid_desc { -u64 pcid :12 ; -u64 rsv :52 ; -u64 addr :64 ; -}; -static void test_pcid_enabled (void ) {int passed =0 ;
Signature · 1 line
2.48.1.601.g30ceb7b040-goog
Sean Christopherson
reviewerPATCH v2 4/6 x86: Expand LA57 test to 64-bit mode (to prep for canonical testing)
In reply to Sean ChristophersonExpand the LA57 test to also validate that attempting to toggle LA57 while in 64-bit mode fails. The extra test coverage isn't terribly interesting, but it's still useful, and extending the LA57 test to 64-bit configs will allow extending it further with LA57-specific canonical tests.
--- x86/Makefile.common | 3 ++- x86/Makefile.i386 | 2 +- x86/la57.c | 9 ++++++--- x86/unittests.cfg | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-)
x86/Makefile.common +2 -1
@@ -96,7 +96,8 @@ tests-common = $(TEST_DIR)/vmexit.$(exe) $(TEST_DIR)/tsc.$(exe) \ # use absolute addresses in their inline assembly code, which cannot compile # with the '-fPIC' flag ifneq ($(CONFIG_EFI),y) -tests-common += $(TEST_DIR)/realmode.$(exe) +tests-common += $(TEST_DIR)/realmode.$(exe) \ + $(TEST_DIR)/la57.$(exe) endif test_cases: $(tests-common) $(tests)
x86/Makefile.i386 +1 -1
@@ -9,6 +9,6 @@ arch_LDFLAGS = -m elf_i386 cflatobjs += lib/x86/setjmp32.o lib/ldiv32.o tests = $(TEST_DIR)/taskswitch.$(exe) $(TEST_DIR)/taskswitch2.$(exe) \ - $(TEST_DIR)/cmpxchg8b.$(exe) $(TEST_DIR)/la57.$(exe) + $(TEST_DIR)/cmpxchg8b.$(exe) include $(SRCDIR)/$(TEST_DIR)/Makefile.common
x86/la57.c +6 -3
@@ -5,9 +5,12 @@int main (int ac,char **av) {int vector =write_cr4_safe (read_cr4 () |X86_CR4_LA57 ); -int expected =this_cpu_has (X86_FEATURE_LA57 ) ?0 :13 ; +bool is_64bit =rdmsr (MSR_EFER ) &EFER_LMA ; +int expected = !is_64bit &&this_cpu_has (X86_FEATURE_LA57 ) ?0 :GP_VECTOR ; + +report (vector == expected,"%s when CR4.LA57 %ssupported (in %u-bit mode)" , + expected ?"#GP" :"No fault" , +this_cpu_has (X86_FEATURE_LA57 ) ?"un" :"" , is_64bit ?64 :32 ); -report (vector == expected,"%s when CR4.LA57 %ssupported" , - expected ?"#GP" :"No fault" , expected ?"un" :"" );return report_summary (); }
x86/unittests.cfg +1 -1
@@ -316,7 +316,7 @@ extra_params = -cpu qemu64,+umip [la57] file = la57.flat -arch = i386 +extra_params = -cpu max,host-phys-bits [vmx] file = vmx.flat
Signature · 1 line
2.48.1.601.g30ceb7b040-goog
Sean Christopherson
reviewerPATCH v2 5/6 x86: Add testcases for writing (non)canonical LA57 values to MSRs and bases
In reply to Sean ChristophersonFrom: Maxim Levitsky <[email protected]>
Extend the LA57 test to thoroughly validate the canonical checks that are done when setting various MSRs and CPU registers. CPUs that support LA57 have convoluted behavior when it comes to canonical checks. Writes to MSRs, descriptor table bases, and for TLB invalidation instructions, don't consult CR4.LA57, and so a value that is 57-bit canonical but not 48-bit canonical is allowed irrespective of CR4.LA57 if the CPU supports 5-level paging.
--- lib/x86/msr.h | 42 ++++++ lib/x86/processor.h | 6 +- x86/la57.c | 333 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 379 insertions(+), 2 deletions(-)
lib/x86/msr.h +42 -0
@@ -131,6 +131,48 @@#define MSR_P6_EVNTSEL0 0x00000186#define MSR_P6_EVNTSEL1 0x00000187 +#define MSR_IA32_RTIT_CTL 0x00000570 +#define RTIT_CTL_TRACEEN BIT(0) +#define RTIT_CTL_CYCLEACC BIT(1) +#define RTIT_CTL_OS BIT(2) +#define RTIT_CTL_USR BIT(3) +#define RTIT_CTL_PWR_EVT_EN BIT(4) +#define RTIT_CTL_FUP_ON_PTW BIT(5) +#define RTIT_CTL_FABRIC_EN BIT(6) +#define RTIT_CTL_CR3EN BIT(7) +#define RTIT_CTL_TOPA BIT(8) +#define RTIT_CTL_MTC_EN BIT(9) +#define RTIT_CTL_TSC_EN BIT(10) +#define RTIT_CTL_DISRETC BIT(11) +#define RTIT_CTL_PTW_EN BIT(12) +#define RTIT_CTL_BRANCH_EN BIT(13) +#define RTIT_CTL_EVENT_EN BIT(31) +#define RTIT_CTL_NOTNT BIT_ULL(55) +#define RTIT_CTL_MTC_RANGE_OFFSET 14 +#define RTIT_CTL_MTC_RANGE (0x0full << RTIT_CTL_MTC_RANGE_OFFSET) +#define RTIT_CTL_CYC_THRESH_OFFSET 19 +#define RTIT_CTL_CYC_THRESH (0x0full << RTIT_CTL_CYC_THRESH_OFFSET) +#define RTIT_CTL_PSB_FREQ_OFFSET 24 +#define RTIT_CTL_PSB_FREQ (0x0full << RTIT_CTL_PSB_FREQ_OFFSET) +#define RTIT_CTL_ADDR0_OFFSET 32 +#define RTIT_CTL_ADDR0 (0x0full << RTIT_CTL_ADDR0_OFFSET) +#define RTIT_CTL_ADDR1_OFFSET 36 +#define RTIT_CTL_ADDR1 (0x0full << RTIT_CTL_ADDR1_OFFSET) +#define RTIT_CTL_ADDR2_OFFSET 40 +#define RTIT_CTL_ADDR2 (0x0full << RTIT_CTL_ADDR2_OFFSET) +#define RTIT_CTL_ADDR3_OFFSET 44 +#define RTIT_CTL_ADDR3 (0x0full << RTIT_CTL_ADDR3_OFFSET) + + +#define MSR_IA32_RTIT_ADDR0_A 0x00000580 +#define MSR_IA32_RTIT_ADDR0_B 0x00000581 +#define MSR_IA32_RTIT_ADDR1_A 0x00000582 +#define MSR_IA32_RTIT_ADDR1_B 0x00000583 +#define MSR_IA32_RTIT_ADDR2_A 0x00000584 +#define MSR_IA32_RTIT_ADDR2_B 0x00000585 +#define MSR_IA32_RTIT_ADDR3_A 0x00000586 +#define MSR_IA32_RTIT_ADDR3_B 0x00000587 +/* AMD64 MSRs. Not complete. See the architecture manual for a more complete list. */
lib/x86/processor.h +5 -1
@@ -7,7 +7,9 @@#include <bitops.h> #include <stdint.h> -#define NONCANONICAL 0xaaaaaaaaaaaaaaaaull +#define CANONICAL_48_VAL 0xffffaaaaaaaaaaaaull +#define CANONICAL_57_VAL 0xffaaaaaaaaaaaaaaull +#define NONCANONICAL 0xaaaaaaaaaaaaaaaaull#ifdef __x86_64__# define R "r"
@@ -241,6 +243,7 @@ static inline bool is_intel(void)#define X86_FEATURE_MCE (CPUID(0x1, 0, EDX, 7))#define X86_FEATURE_APIC (CPUID(0x1, 0, EDX, 9))#define X86_FEATURE_CLFLUSH (CPUID(0x1, 0, EDX, 19)) +#define X86_FEATURE_DS (CPUID(0x1, 0, EDX, 21))#define X86_FEATURE_XMM (CPUID(0x1, 0, EDX, 25))#define X86_FEATURE_XMM2 (CPUID(0x1, 0, EDX, 26))#define X86_FEATURE_TSC_ADJUST (CPUID(0x7, 0, EBX, 1))
@@ -252,6 +255,7 @@ static inline bool is_intel(void)#define X86_FEATURE_PCOMMIT (CPUID(0x7, 0, EBX, 22))#define X86_FEATURE_CLFLUSHOPT (CPUID(0x7, 0, EBX, 23))#define X86_FEATURE_CLWB (CPUID(0x7, 0, EBX, 24)) +#define X86_FEATURE_INTEL_PT (CPUID(0x7, 0, EBX, 25))#define X86_FEATURE_UMIP (CPUID(0x7, 0, ECX, 2))#define X86_FEATURE_PKU (CPUID(0x7, 0, ECX, 3))#define X86_FEATURE_LA57 (CPUID(0x7, 0, ECX, 16))
x86/la57.c +332 -1
343 lines not on this page · raw message
Signature · 1 line
2.48.1.601.g30ceb7b040-goog
Sean Christopherson
reviewerPATCH v2 6/6 nVMX: add a test for canonical checks of various host state vmcs12 fields.
In reply to Sean ChristophersonFrom: Maxim Levitsky <[email protected]>
This test tests canonical VM entry checks of various host state fields (mostly segment bases) in vmcs12.
--- x86/vmx_tests.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+)
x86/vmx_tests.c +167 -0
@@ -10754,6 +10754,172 @@ static void vmx_exception_test(void)test_set_guest_finished (); } +/* +* Arbitrary canonical values for validating direct writes in the host, e.g. to +* an MSR, and for indirect writes via loads from VMCS fields on VM-Exit. +*/ +#define TEST_DIRECT_VALUE 0xff45454545000000 +#define TEST_VMCS_VALUE 0xff55555555000000 + +static void vmx_canonical_test_guest (void ) +{ +while (true) +vmcall (); +} + +static int get_host_value (u64 vmcs_field,u64 *value) +{ +struct descriptor_table_ptr dt_ptr; + +switch (vmcs_field) { +case HOST_SYSENTER_ESP : + *value =rdmsr (MSR_IA32_SYSENTER_ESP ); +break ; +case HOST_SYSENTER_EIP : + *value =rdmsr (MSR_IA32_SYSENTER_EIP ); +break ; +case HOST_BASE_FS : + *value =rdmsr (MSR_FS_BASE ); +break ; +case HOST_BASE_GS : + *value =rdmsr (MSR_GS_BASE ); +break ; +case HOST_BASE_GDTR : +sgdt (&dt_ptr); + *value = dt_ptr.base; +break ; +case HOST_BASE_IDTR : +sidt (&dt_ptr); + *value = dt_ptr.base; +break ; +case HOST_BASE_TR : + *value =get_gdt_entry_base (get_tss_descr ()); +/* value might not reflect the actual base if changed by VMX */ +return 1 ; +default : +assert (0 ); +return 1 ; + } +return 0 ; +} + +static int set_host_value (u64 vmcs_field,u64 value) +{ +struct descriptor_table_ptr dt_ptr; + +switch (vmcs_field) { +case HOST_SYSENTER_ESP : +return wrmsr_safe (MSR_IA32_SYSENTER_ESP , value); +case HOST_SYSENTER_EIP : +return wrmsr_safe (MSR_IA32_SYSENTER_EIP , value); +case HOST_BASE_FS : +return wrmsr_safe (MSR_FS_BASE , value); +case HOST_BASE_GS : +/* TODO: _safe variants assume per-cpu gs base*/ +wrmsr (MSR_GS_BASE , value); +return 0 ; +case HOST_BASE_GDTR : +sgdt (&dt_ptr); + dt_ptr.base = value; +lgdt (&dt_ptr); +return lgdt_fep_safe (&dt_ptr); +case HOST_BASE_IDTR : +sidt (&dt_ptr); + dt_ptr.base = value; +return lidt_fep_safe (&dt_ptr); +case HOST_BASE_TR : +/* Set the base and clear the busy bit */ +set_gdt_entry (FIRST_SPARE_SEL , value,0x200 ,0x89 ,0 ); +return ltr_safe (FIRST_SPARE_SEL ); +default : +assert (0 ); + } +} + +static void test_host_value_direct (const char *field_name,u64 vmcs_field) +{ +u64 value =0 ; +int vector; + +/* +* Set the directly register via host ISA (e.g lgdt) and check that we +* got no exception. +*/ + vector =set_host_value (vmcs_field,TEST_DIRECT_VALUE ); +if (vector) { +report_fail ("Exception %d when setting %s to 0x%lx via direct write" , + vector, field_name,TEST_DIRECT_VALUE ); +return ; + } + +/* +* Now check that the host value matches what we expect for fields +* that can be read back (these that we can't we assume that are correct) +*/ +report (get_host_value (vmcs_field, &value) || value ==TEST_DIRECT_VALUE , +"%s: HOST value set to 0x%lx (wanted 0x%lx) via direct write" , + field_name, value,TEST_DIRECT_VALUE ); +} + +static void test_host_value_vmcs (const char *field_name,u64 vmcs_field) +{ +u64 value =0 ; + +/* Set host state field in the vmcs and do the VM entry +* Success of VM entry already shows that L0 accepted the value +*/ +vmcs_write (vmcs_field,TEST_VMCS_VALUE ); +enter_guest (); +skip_exit_vmcall (); + +/* +* Now check that the host value matches what we expect for fields +* that can be read back (these that we can't we assume that are correct) +*/ +report (get_host_value (vmcs_field, &value) || value ==TEST_VMCS_VALUE , +"%s: HOST value set to 0x%lx (wanted 0x%lx) via VMLAUNCH/VMRESUME" , + field_name, value,TEST_VMCS_VALUE ); +} + +static void do_vmx_canonical_test_one_field (const char *field_name,u64 field) +{ +u64 host_org_value, field_org_value; + +/* Backup the current host value and vmcs field value values */ +get_host_value (field, &host_org_value); + field_org_value =vmcs_read (field); + +test_host_value_direct (field_name, field); +test_host_value_vmcs (field_name, field); + +/* Restore original values */ +vmcs_write (field, field_org_value); +set_host_value (field, host_org_value); +} + +#define vmx_canonical_test_one_field (field) \ + do_vmx_canonical_test_one_field(#field, field) + +static void vmx_canonical_test (void ) +{ +report (!(read_cr4 () &X86_CR4_LA57 ),"4 level paging" ); + +if (!this_cpu_has (X86_FEATURE_LA57 )) +test_skip ("5 level paging not supported" ); + +test_set_guest (vmx_canonical_test_guest); + +vmx_canonical_test_one_field (HOST_SYSENTER_ESP ); +vmx_canonical_test_one_field (HOST_SYSENTER_EIP ); +vmx_canonical_test_one_field (HOST_BASE_FS ); +vmx_canonical_test_one_field (HOST_BASE_GS ); +vmx_canonical_test_one_field (HOST_BASE_GDTR ); +vmx_canonical_test_one_field (HOST_BASE_IDTR ); +vmx_canonical_test_one_field (HOST_BASE_TR ); + +test_set_guest_finished (); +} +enum Vid_op {VID_OP_SET_ISR ,VID_OP_NOP ,
@@ -11262,5 +11428,6 @@ struct vmx_test vmx_tests[] = {TEST (vmx_pf_invvpid_test),TEST (vmx_pf_vpid_test),TEST (vmx_exception_test), +TEST (vmx_canonical_test), { NULL, NULL, NULL, NULL, NULL, {0} }, };
Signature · 1 line
2.48.1.601.g30ceb7b040-goog
Quoted 37 lines · Sean Christopherson
v2 of Maxim's series to add testcases for canonical checks of various MSRs, segment bases, and instructions that were found to ignore CR4.LA57 on CPUs that support 5 level paging.
v2:
- Fold into existing la57 test.
- Always skip SYSENTER tests (they fail when run in a VM).
- Lots of cosmetics cleanups (see v1 feedback for details).v1: https://lore.kernel.org/all/[email protected]
Maxim Levitsky (5):
x86: Add_safe()and_fep_safe()variants to segment base load
instructions
x86: Add a few functions for gdt manipulation
x86: Move structinvpcid_descdescriptor toprocessor.h
x86: Add testcases for writing (non)canonical LA57 values to MSRs and
bases
nVMX: add a test for canonical checks of various host state vmcs12
fields.Sean Christopherson (1):
x86: Expand LA57 test to 64-bit mode (to prep for canonical testing)lib/x86/desc.c | 38 ++++- lib/x86/desc.h | 9 +- lib/x86/msr.h | 42 ++++++ lib/x86/processor.h | 58 +++++++- x86/Makefile.common | 3 +- x86/Makefile.i386 | 2 +- x86/la57.c | 342 +++++++++++++++++++++++++++++++++++++++++++- x86/pcid.c | 6 - x86/unittests.cfg | 2 +- x86/vmx_tests.c | 167 +++++++++++++++++++++ 10 files changed, 645 insertions(+), 24 deletions(-)
Quoted 1 line
base-commit:
f77fb696cfd0e4a5562cdca189be557946bf522f
Hi!
No major objections to any of the changes.
Can you also take a look at my other patch to kvm-unit-tests:
"pmu_lbr: drop check for MSR_LBR_TOS != 0"
Thanks,
Best regards,
Maxim Levitsky
Quoted 10 lines · Sean Christopherson
v2 of Maxim's series to add testcases for canonical checks of various MSRs, segment bases, and instructions that were found to ignore CR4.LA57 on CPUs that support 5 level paging.
v2:
- Fold into existing la57 test.
- Always skip SYSENTER tests (they fail when run in a VM).
- Lots of cosmetics cleanups (see v1 feedback for details).[...]
Applied to kvm-x86 next (and now pulled by Paolo), thanks!
[1/6] x86: Add _safe() and _fep_safe() variants to segment base load instructions
https://github.com/kvm-x86/kvm-unit-tests/commit/5047281ab3e1 [2/6] x86: Add a few functions for gdt manipulation https://github.com/kvm-x86/kvm-unit-tests/commit/b1f3eec1b59b [3/6] x86: Move struct invpcid_desc descriptor to processor.h https://github.com/kvm-x86/kvm-unit-tests/commit/b88e90e64526 [4/6] x86: Expand LA57 test to 64-bit mode (to prep for canonical testing) https://github.com/kvm-x86/kvm-unit-tests/commit/81dcf3f7d568 [5/6] x86: Add testcases for writing (non)canonical LA57 values to MSRs and bases https://github.com/kvm-x86/kvm-unit-tests/commit/f6257e242a52 [6/6] nVMX: add a test for canonical checks of various host state vmcs12 fields. https://github.com/kvm-x86/kvm-unit-tests/commit/05fbb364b5b2