Skip to contentSkip to conversation

x86: Fixes, cleanups, and new sub-tests

GIT PULL Sean Christopherson 2 participants 2 messages Jul 25, 2022 – Jul 26, 2022 KVM

lore
Share & tools
lore

Sean Christopherson

author reviewer
#0 lore raw

Attempt #2. Only difference is the addition of two patches[*] (effectively just one when all is said and done) to fix the x2APIC+INIT+SIPI SVM test bug.

[*] https://lore.kernel.org/all/[email protected]

The following changes since commit 7b2e41767bb8caf91972ee32e4ca85ec630584e2:

Merge branch 's390x-next-2022-07' into 'master' (2022-07-21 14:41:56 +0000)

are available in the Git repository at:

https://github.com/sean-jc/kvm-unit-tests.git tags/for_paolo

for you to fetch changes up to f7b730bcac4432f9ea239faeb963392d1854b9b0:

nVMX: Add subtest to verify VMXON succeeds/#UDs on good/bad CR0/CR4 (2022-07-25 13:20:29 -0700)

----------------------------------------------------------------
x86 fixes, cleanups, and new sub-tests:

- Bug fix for the VMX-preemption timer expiration test
- Refactor SVM tests to split out NPT tests
- Add tests for MCE banks to MSR test
- Add SMP Support for x86 UEFI tests
- x86: nVMX: Add VMXON #UD test (and exception cleanup)
- PMU cleanup and related nVMX bug fixes

----------------------------------------------------------------
Jim Mattson (1):
x86: VMX: Fix the VMX-preemption timer expiration test

Manali Shukla (5):
x86: nSVM: Extract core functionality of main() to helper run_svm_tests()
x86: Add flags to control behavior of set_mmu_range()
x86: nSVM: Build up the nested page table dynamically
x86: nSVM: Correct indentation for svm.c
x86: nSVM: Correct indentation for svm_tests.c

Sean Christopherson (23):
x86: nSVM: Move all nNPT test cases from svm_tests.c to a separate file.
x86: nSVM: Run non-NPT nSVM tests with PT_USER_MASK enabled
x86: nSVM: Add macros to create SVM's NPT tests, reduce boilerplate code
x86: msr: Take the MSR index and name separately in low level helpers
x86: msr: Add tests for MCE bank MSRs
x86: Use an explicit magic string to detect that dummy.efi passes
x86: apic: Play nice with x2APIC being enabled when getting "pre-boot" ID
x86: cstart64: Put APIC into xAPIC after loading TSS
x86: Rename ap_init() to bringup_aps()
x86: Add ap_online() to consolidate final "AP is alive!" code
x86: Use BIT() to define architectural bits
x86: Replace spaces with tables in processor.h
x86: Use "safe" terminology instead of "checking"
x86: Use "safe" helpers to implement unsafe CRs accessors
x86: Provide result of RDMSR from "safe" variant
nVMX: Check the results of VMXON/VMXOFF in feature control test
nVMX: Check result of VMXON in INIT/SIPI tests
nVMX: Wrap VMXON in ASM_TRY(), a.k.a. in exception fixup
nVMX: Simplify test_vmxon() by returning directly on failure
x86: Drop cpuid_osxsave(), just use this_cpu_has(X86_FEATURE_OSXSAVE)
nVMX: Move wrappers of this_cpu_has() to nVMX's VM-Exit test
nVMX: Rename monitor_support() to this_cpu_has_mwait(), drop #define
nVMX: Add subtest to verify VMXON succeeds/#UDs on good/bad CR0/CR4

Varad Gautam (10):
x86: Share realmode trampoline between i386 and x86_64
x86: Move ap_init() to smp.c
x86: Move load_idt() to desc.c
x86: desc: Split IDT entry setup into a generic helper
x86: Move load_gdt_tss() to desc.c
x86: efi: Provide a stack within testcase memory
x86: efi: Provide percpu storage
x86: Move 32-bit => 64-bit transition code to trampolines.S
x86: efi, smp: Transition APs from 16-bit to 32-bit mode
x86: Provide a common 64-bit AP entrypoint for EFI and non-EFI

Yang Weijiang (4):
x86: nVMX: Use report_skip() to print messages when VMX tests are skipped
x86: Use helpers to fetch supported perf capabilities
x86: Skip perf related tests when platform cannot support
x86: Check platform pmu capabilities before run lbr tests

 lib/alloc_page.h          |    3 +
 lib/x86/apic.c            |   16 +-
 lib/x86/asm/setup.h       |    3 +
 lib/x86/desc.c            |   46 +-
 lib/x86/desc.h            |    5 +-
 lib/x86/processor.h       |  455 +++++++++++--------
 lib/x86/setup.c           |   81 +++-
 lib/x86/smp.c             |  150 ++++++-
 lib/x86/smp.h             |   11 +
 lib/x86/vm.c              |   22 +-
 lib/x86/vm.h              |   10 +
 scripts/runtime.bash      |    2 +-
 x86/Makefile.common       |    2 +
 x86/Makefile.x86_64       |    2 +
 x86/access.c              |    8 +-
 x86/cstart.S              |   48 +-
 x86/cstart64.S            |  127 +-----
 x86/dummy.c               |    8 +
 x86/efi/crt0-efi-x86_64.S |    3 +
 x86/efi/efistart64.S      |   79 ++--
 x86/la57.c                |    2 +-
 x86/msr.c                 |  113 ++++-
 x86/pcid.c                |   28 +-
 x86/pmu.c                 |  116 ++---
 x86/pmu_lbr.c             |   35 +-
 x86/rdpru.c               |    4 +-
 x86/svm.c                 |  219 ++++-----
 x86/svm.h                 |    5 +-
 x86/svm_npt.c             |  380 ++++++++++++++++
 x86/svm_tests.c           | 3365 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------
 x86/trampolines.S         |  129 ++++++
 x86/unittests.cfg         |    6 +
 x86/vmexit.c              |   12 +-
 x86/vmx.c                 |  141 ++++--
 x86/vmx.h                 |   31 +-
 x86/vmx_tests.c           |  136 +++---
 x86/xsave.c               |   31 +-
 37 files changed, 3170 insertions(+), 2664 deletions(-)
 create mode 100644 x86/svm_npt.c
 create mode 100644 x86/trampolines.S
maintainer
#1 lore raw

Pulled, thanks.

Paolo

Quoted 124 lines · Sean Christopherson

Attempt #2. Only difference is the addition of two patches[*] (effectively just one when all is said and done) to fix the x2APIC+INIT+SIPI SVM test bug.

[*] https://lore.kernel.org/all/[email protected]

The following changes since commit 7b2e41767bb8caf91972ee32e4ca85ec630584e2:

Merge branch 's390x-next-2022-07' into 'master' (2022-07-21 14:41:56 +0000)

are available in the Git repository at:

https://github.com/sean-jc/kvm-unit-tests.git tags/for_paolo

for you to fetch changes up to f7b730bcac4432f9ea239faeb963392d1854b9b0:

nVMX: Add subtest to verify VMXON succeeds/#UDs on good/bad CR0/CR4 (2022-07-25 13:20:29 -0700)

----------------------------------------------------------------
x86 fixes, cleanups, and new sub-tests:

- Bug fix for the VMX-preemption timer expiration test
- Refactor SVM tests to split out NPT tests
- Add tests for MCE banks to MSR test
- Add SMP Support for x86 UEFI tests
- x86: nVMX: Add VMXON #UD test (and exception cleanup)
- PMU cleanup and related nVMX bug fixes

----------------------------------------------------------------
Jim Mattson (1):
x86: VMX: Fix the VMX-preemption timer expiration test

Manali Shukla (5):
x86: nSVM: Extract core functionality of main() to helper run_svm_tests()
x86: Add flags to control behavior of set_mmu_range()
x86: nSVM: Build up the nested page table dynamically
x86: nSVM: Correct indentation for svm.c
x86: nSVM: Correct indentation for svm_tests.c

Sean Christopherson (23):
x86: nSVM: Move all nNPT test cases from svm_tests.c to a separate file.
x86: nSVM: Run non-NPT nSVM tests with PT_USER_MASK enabled
x86: nSVM: Add macros to create SVM's NPT tests, reduce boilerplate code
x86: msr: Take the MSR index and name separately in low level helpers
x86: msr: Add tests for MCE bank MSRs
x86: Use an explicit magic string to detect that dummy.efi passes
x86: apic: Play nice with x2APIC being enabled when getting "pre-boot" ID
x86: cstart64: Put APIC into xAPIC after loading TSS
x86: Rename ap_init() to bringup_aps()
x86: Add ap_online() to consolidate final "AP is alive!" code
x86: Use BIT() to define architectural bits
x86: Replace spaces with tables in processor.h
x86: Use "safe" terminology instead of "checking"
x86: Use "safe" helpers to implement unsafe CRs accessors
x86: Provide result of RDMSR from "safe" variant
nVMX: Check the results of VMXON/VMXOFF in feature control test
nVMX: Check result of VMXON in INIT/SIPI tests
nVMX: Wrap VMXON in ASM_TRY(), a.k.a. in exception fixup
nVMX: Simplify test_vmxon() by returning directly on failure
x86: Drop cpuid_osxsave(), just use this_cpu_has(X86_FEATURE_OSXSAVE)
nVMX: Move wrappers of this_cpu_has() to nVMX's VM-Exit test
nVMX: Rename monitor_support() to this_cpu_has_mwait(), drop #define
nVMX: Add subtest to verify VMXON succeeds/#UDs on good/bad CR0/CR4

Varad Gautam (10):
x86: Share realmode trampoline between i386 and x86_64
x86: Move ap_init() to smp.c
x86: Move load_idt() to desc.c
x86: desc: Split IDT entry setup into a generic helper
x86: Move load_gdt_tss() to desc.c
x86: efi: Provide a stack within testcase memory
x86: efi: Provide percpu storage
x86: Move 32-bit => 64-bit transition code to trampolines.S
x86: efi, smp: Transition APs from 16-bit to 32-bit mode
x86: Provide a common 64-bit AP entrypoint for EFI and non-EFI

Yang Weijiang (4):
x86: nVMX: Use report_skip() to print messages when VMX tests are skipped
x86: Use helpers to fetch supported perf capabilities
x86: Skip perf related tests when platform cannot support
x86: Check platform pmu capabilities before run lbr tests

 lib/alloc_page.h          |    3 +
 lib/x86/apic.c            |   16 +-
 lib/x86/asm/setup.h       |    3 +
 lib/x86/desc.c            |   46 +-
 lib/x86/desc.h            |    5 +-
 lib/x86/processor.h       |  455 +++++++++++--------
 lib/x86/setup.c           |   81 +++-
 lib/x86/smp.c             |  150 ++++++-
 lib/x86/smp.h             |   11 +
 lib/x86/vm.c              |   22 +-
 lib/x86/vm.h              |   10 +
 scripts/runtime.bash      |    2 +-
 x86/Makefile.common       |    2 +
 x86/Makefile.x86_64       |    2 +
 x86/access.c              |    8 +-
 x86/cstart.S              |   48 +-
 x86/cstart64.S            |  127 +-----
 x86/dummy.c               |    8 +
 x86/efi/crt0-efi-x86_64.S |    3 +
 x86/efi/efistart64.S      |   79 ++--
 x86/la57.c                |    2 +-
 x86/msr.c                 |  113 ++++-
 x86/pcid.c                |   28 +-
 x86/pmu.c                 |  116 ++---
 x86/pmu_lbr.c             |   35 +-
 x86/rdpru.c               |    4 +-
 x86/svm.c                 |  219 ++++-----
 x86/svm.h                 |    5 +-
 x86/svm_npt.c             |  380 ++++++++++++++++
 x86/svm_tests.c           | 3365 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------
 x86/trampolines.S         |  129 ++++++
 x86/unittests.cfg         |    6 +
 x86/vmexit.c              |   12 +-
 x86/vmx.c                 |  141 ++++--
 x86/vmx.h                 |   31 +-
 x86/vmx_tests.c           |  136 +++---
 x86/xsave.c               |   31 +-
 37 files changed, 3170 insertions(+), 2664 deletions(-)
 create mode 100644 x86/svm_npt.c
 create mode 100644 x86/trampolines.S