#
2169fc79 |
| 01-Sep-2023 |
Sean Christopherson <seanjc@google.com> |
nVMX: Assert that the test is configured for 64-bit mode
The nVMX tests are 64-bit only, assert as much to reduce the probability of the tests not actually running due to some funky bug. It's easy
nVMX: Assert that the test is configured for 64-bit mode
The nVMX tests are 64-bit only, assert as much to reduce the probability of the tests not actually running due to some funky bug. It's easy to re-add an if-statement if the nVMX tests ever gain 32-bit support, whereas most developers lack the psychic powers necessary to detect that a test isn't doing anything useful.
Link: https://lore.kernel.org/r/20230901225004.3604702-4-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
show more ...
|
#
9681be6b |
| 01-Sep-2023 |
Sean Christopherson <seanjc@google.com> |
nVMX: Assert CR4.PAE is set when testing 64-bit host
Assert that PAE is set in the original CR4 value when the host is setup to VM-Exit to 64-bit mode in test_host_addr_size(). If CR4.PAE isn't set
nVMX: Assert CR4.PAE is set when testing 64-bit host
Assert that PAE is set in the original CR4 value when the host is setup to VM-Exit to 64-bit mode in test_host_addr_size(). If CR4.PAE isn't set then something is wildly broken and all bets are off as VM-Enter can't possibly succeed.
Link: https://lore.kernel.org/r/20230901225004.3604702-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
show more ...
|
#
6105c06b |
| 01-Sep-2023 |
Sean Christopherson <seanjc@google.com> |
nVMX: Test CR4.PCIDE can be set for 64-bit host iff PCID is supported
Check that PCID is actually supported before verifying that it can be set in vmcs.HOST_CR4 for 64-bit hosts. PCID is all but ub
nVMX: Test CR4.PCIDE can be set for 64-bit host iff PCID is supported
Check that PCID is actually supported before verifying that it can be set in vmcs.HOST_CR4 for 64-bit hosts. PCID is all but ubiquitous on modern CPUs, but PCID may be hidden by the host to workaround a TLB flushing bug on Alderlake and Raptorlake.
Link: https://lore.kernel.org/r/20230901225004.3604702-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
show more ...
|
#
dacbea0f |
| 13-Apr-2023 |
Mathias Krause <minipli@grsecurity.net> |
x86: Drop types.h
The file types.h never declared any types, only exception vectors which are partially re-defined in processor.h.
Move the remaining vector definitions to processor.h and remove ty
x86: Drop types.h
The file types.h never declared any types, only exception vectors which are partially re-defined in processor.h.
Move the remaining vector definitions to processor.h and remove types.h, as all users already include processor.h
Signed-off-by: Mathias Krause <minipli@grsecurity.net> Link: https://lore.kernel.org/r/20230413184219.36404-2-minipli@grsecurity.net Signed-off-by: Sean Christopherson <seanjc@google.com>
show more ...
|
#
e4007e62 |
| 22-Nov-2022 |
Maxim Levitsky <mlevitsk@redhat.com> |
x86: introduce sti_nop() and sti_nop_cli()
Add functions that shorten the common usage of sti
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@r
x86: introduce sti_nop() and sti_nop_cli()
Add functions that shorten the common usage of sti
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Link: https://lore.kernel.org/r/20221122161152.293072-3-mlevitsk@redhat.com [sean: massage comments] Signed-off-by: Sean Christopherson <seanjc@google.com>
show more ...
|
#
787f0aeb |
| 22-Nov-2022 |
Maxim Levitsky <mlevitsk@redhat.com> |
x86: replace irq_{enable|disable}() with sti()/cli()
This removes a layer of indirection which is strictly speaking not needed since its x86 code anyway.
Signed-off-by: Maxim Levitsky <mlevitsk@red
x86: replace irq_{enable|disable}() with sti()/cli()
This removes a layer of indirection which is strictly speaking not needed since its x86 code anyway.
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Link: https://lore.kernel.org/r/20221122161152.293072-2-mlevitsk@redhat.com [sean: move and reword IRQ shadow to be above and about safe_halt()] Signed-off-by: Sean Christopherson <seanjc@google.com>
show more ...
|
#
f399af21 |
| 07-Jan-2023 |
Sean Christopherson <seanjc@google.com> |
x86/apic: Refactor x2APIC reg helper to provide exact semantics
Refactor x2apic_reg_reserved() into get_x2apic_reg_semantics() and have it provide the semantics for all registers. The full semantic
x86/apic: Refactor x2APIC reg helper to provide exact semantics
Refactor x2apic_reg_reserved() into get_x2apic_reg_semantics() and have it provide the semantics for all registers. The full semantics will be used by the MSR test to verify KVM correctly emulates all x2APIC MSRs.
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20230107011737.577244-3-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
14432cc3 |
| 07-Jan-2023 |
Sean Christopherson <seanjc@google.com> |
x86/apic: Refactor x2APIC reg helper to provide exact semantics
Refactor x2apic_reg_reserved() into get_x2apic_reg_semantics() and have it provide the semantics for all registers. The full semantic
x86/apic: Refactor x2APIC reg helper to provide exact semantics
Refactor x2apic_reg_reserved() into get_x2apic_reg_semantics() and have it provide the semantics for all registers. The full semantics will be used by the MSR test to verify KVM correctly emulates all x2APIC MSRs.
No functional change intended.
Link: https://lore.kernel.org/r/20230107011737.577244-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
show more ...
|
#
723a5703 |
| 04-Apr-2023 |
Sean Christopherson <seanjc@google.com> |
nVMX: Add forced emulation variant of #PF access test
Add a forced emulation variant of vmx_pf_exception_test to exercise KVM emulation of L2 instructions and accesses. Like the non-nested version,
nVMX: Add forced emulation variant of #PF access test
Add a forced emulation variant of vmx_pf_exception_test to exercise KVM emulation of L2 instructions and accesses. Like the non-nested version, make the test nodefault as forcing KVM to emulate drastically increases the runtime.
Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20230404165341.163500-10-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
76ffc801 |
| 04-Apr-2023 |
Mathias Krause <minipli@grsecurity.net> |
x86/access: Add forced emulation support
Add support to force access tests to be handled by the emulator, if supported by KVM. Due to emulation being rather slow, make the forced emulation nodefaul
x86/access: Add forced emulation support
Add support to force access tests to be handled by the emulator, if supported by KVM. Due to emulation being rather slow, make the forced emulation nodefault, i.e. a manual-only testcase. Note, "manual" just means the test runner needs to specify a specific group(s), i.e. the test is still easy to enable in CI for compatible setups.
Manually check for FEP support in the test instead of using the "check" option to query the module param, as any non-zero force_emulation_prefix value enables FEP (see KVM commit d500e1ed3dc8 ("KVM: x86: Allow clearing RFLAGS.RF on forced emulation to test code #DBs") and scripts/runtime.bash only supports checking for a single value.
Defer enabling FEP for the nested VMX variants to a future patch. KVM has a bug related to emulating NOP (yes, NOP) for L2, and the nVMX varaints will require additional massaging to propagate the "allow emulation" flag.
Signed-off-by: Mathias Krause <minipli@grsecurity.net> [sean: make generic fep testcase nodefault instead of impossible] Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20230404165341.163500-6-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
9f17508d |
| 02-Nov-2022 |
Like Xu <likexu@tencent.com> |
x86/pmu: Add lib/x86/pmu.[c.h] and move common code to header files
Given all the PMU stuff coming in, we need e.g. lib/x86/pmu.h to hold all of the hardware-defined stuff, e.g. #defines, accessors,
x86/pmu: Add lib/x86/pmu.[c.h] and move common code to header files
Given all the PMU stuff coming in, we need e.g. lib/x86/pmu.h to hold all of the hardware-defined stuff, e.g. #defines, accessors, helpers and structs that are dictated by hardware. This will greatly help with code reuse and reduce unnecessary vm-exit.
Opportunistically move lbr msrs definition to header processor.h.
Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Like Xu <likexu@tencent.com> Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20221102225110.3023543-14-seanjc@google.com
show more ...
|
#
720caae4 |
| 05-Oct-2022 |
Sean Christopherson <seanjc@google.com> |
nVMX: Move #NM test to generic exception test framework
Move the #NM test cases to the generic exception test framework, and rename the dedicated test to note that it tests the "no #NM" case.
Signe
nVMX: Move #NM test to generic exception test framework
Move the #NM test cases to the generic exception test framework, and rename the dedicated test to note that it tests the "no #NM" case.
Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20221005235212.57836-10-seanjc@google.com
show more ...
|
#
c4a19b49 |
| 05-Oct-2022 |
Sean Christopherson <seanjc@google.com> |
nVMX: Drop one-off INT3=>#BP test
Drop the dedicated INT3=>#BP test, it's a subset of what is covered by the INT3=>#BP case in the generic exceptions test.
Signed-off-by: Sean Christopherson <seanj
nVMX: Drop one-off INT3=>#BP test
Drop the dedicated INT3=>#BP test, it's a subset of what is covered by the INT3=>#BP case in the generic exceptions test.
Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20221005235212.57836-5-seanjc@google.com
show more ...
|
#
5faf5f60 |
| 05-Oct-2022 |
Sean Christopherson <seanjc@google.com> |
nVMX: Move #OF test to generic exceptions test
Move the INTO=>#OF test, along with its more precise checking of the exit interrupt info, to the generic nVMX exceptions test.
Move the helper that g
nVMX: Move #OF test to generic exceptions test
Move the INTO=>#OF test, along with its more precise checking of the exit interrupt info, to the generic nVMX exceptions test.
Move the helper that generates #OF to processor.h so that it can be reused by nSVM for an identical test.
Note, this effectively adds new checks for all other vectors, i.e. affects more vectors than just #OF.
Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20221005235212.57836-4-seanjc@google.com
show more ...
|
#
e39bee8f |
| 05-Oct-2022 |
Sean Christopherson <seanjc@google.com> |
x86: Move helpers to generate misc exceptions to processor.h
Move nested VMX's helpers to generate miscellaenous exceptions, e.g. #DE, to processor.h so that they can be used for nearly-identical ne
x86: Move helpers to generate misc exceptions to processor.h
Move nested VMX's helpers to generate miscellaenous exceptions, e.g. #DE, to processor.h so that they can be used for nearly-identical nested SVM tests.
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20221005235212.57836-3-seanjc@google.com
show more ...
|
#
579c93d0 |
| 05-Oct-2022 |
Sean Christopherson <seanjc@google.com> |
nVMX: Add "nop" after setting EFLAGS.TF to guarantee single-step #DB
Add a "nop" after enabling single-stepping in vmx_l2_db_test() to ensure a #DB is generated in the scope of the function even if
nVMX: Add "nop" after setting EFLAGS.TF to guarantee single-step #DB
Add a "nop" after enabling single-stepping in vmx_l2_db_test() to ensure a #DB is generated in the scope of the function even if the helper is inlined. Enabling single-step #DBs have a one-instruction delay, e.g. if the function were inlined and the caller generated a "terminal" VM-Exit immediately after invoking the helper, then no #DB would be generated.
Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20221005235212.57836-2-seanjc@google.com
show more ...
|
#
14b54ed7 |
| 26-Jul-2022 |
Paolo Bonzini <pbonzini@redhat.com> |
Merge tag 'for_paolo' of https://github.com/sean-jc/kvm-unit-tests into HEAD
x86 fixes, cleanups, and new sub-tests:
- Bug fix for the VMX-preemption timer expiration test - Refactor SVM tests
Merge tag 'for_paolo' of https://github.com/sean-jc/kvm-unit-tests into HEAD
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
show more ...
|
#
2b4c8e50 |
| 11-Jul-2022 |
Yang Weijiang <weijiang.yang@intel.com> |
x86: Skip perf related tests when platform cannot support
Add helpers to check whether MSR_CORE_PERF_GLOBAL_CTRL and rdpmc are supported in KVM. When pmu is disabled with enable_pmu=0, reading MSR_C
x86: Skip perf related tests when platform cannot support
Add helpers to check whether MSR_CORE_PERF_GLOBAL_CTRL and rdpmc are supported in KVM. When pmu is disabled with enable_pmu=0, reading MSR_CORE_PERF_GLOBAL_CTRL or executing rdpmc leads to #GP, so skip related tests in this case to avoid test failure.
Opportunistically hoist mwait support check function as helper and change related code.
Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Yang Weijiang <weijiang.yang@intel.com> Link: https://lore.kernel.org/r/20220711041841.126648-4-weijiang.yang@intel.com Signed-off-by: Sean Christopherson <seanjc@google.com>
show more ...
|
#
01d0ec2e |
| 21-Jul-2022 |
Sean Christopherson <seanjc@google.com> |
nVMX: Rename monitor_support() to this_cpu_has_mwait(), drop #define
Rename VMX's callback wrapper for checking MONITOR/MWAIT support to align with X86_FEATURE_MWAIT, and drop a related #define that
nVMX: Rename monitor_support() to this_cpu_has_mwait(), drop #define
Rename VMX's callback wrapper for checking MONITOR/MWAIT support to align with X86_FEATURE_MWAIT, and drop a related #define that's no longer used.
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@google.com>
show more ...
|
#
45472bc5 |
| 21-Jul-2022 |
Sean Christopherson <seanjc@google.com> |
nVMX: Move wrappers of this_cpu_has() to nVMX's VM-Exit test
Move wrappers of this_cpu_has() whose sole purpose is to be queried as a callback in VM-Exit tests into vmxexit.c in order to discourage
nVMX: Move wrappers of this_cpu_has() to nVMX's VM-Exit test
Move wrappers of this_cpu_has() whose sole purpose is to be queried as a callback in VM-Exit tests into vmxexit.c in order to discourage general use, i.e. force tests to use this_cpu_has().
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@google.com>
show more ...
|
#
816c0359 |
| 21-Jul-2022 |
Sean Christopherson <seanjc@google.com> |
x86: Drop cpuid_osxsave(), just use this_cpu_has(X86_FEATURE_OSXSAVE)
Drop cpuid_osxsave(), which is just an open coded implementation of this_cpu_has(X86_FEATURE_OSXSAVE).
Signed-off-by: Sean Chri
x86: Drop cpuid_osxsave(), just use this_cpu_has(X86_FEATURE_OSXSAVE)
Drop cpuid_osxsave(), which is just an open coded implementation of this_cpu_has(X86_FEATURE_OSXSAVE).
Signed-off-by: Sean Christopherson <seanjc@google.com>
show more ...
|
#
489a4305 |
| 11-Jul-2022 |
Yang Weijiang <weijiang.yang@intel.com> |
x86: nVMX: Use report_skip() to print messages when VMX tests are skipped
Use report_skip() for VMX tests so that the message contains the "SKIP:" prefix, and so that the test is counted as skipped.
x86: nVMX: Use report_skip() to print messages when VMX tests are skipped
Use report_skip() for VMX tests so that the message contains the "SKIP:" prefix, and so that the test is counted as skipped.
Opportunistically unify the message format for report_skip().
Signed-off-by: Yang Weijiang <weijiang.yang@intel.com> Link: https://lore.kernel.org/r/20220711041841.126648-2-weijiang.yang@intel.com [sean: add a space after the colon, fix more reports] Signed-off-by: Sean Christopherson <seanjc@google.com>
show more ...
|
#
2171b69b |
| 08-Jun-2022 |
Sean Christopherson <seanjc@google.com> |
nVMX: Wrap VMXON in ASM_TRY(), a.k.a. in exception fixup
Gracefully handle and return faults on VMXON instead of letting VMXON explode. The primary motivation is to be able to reuse the helper in t
nVMX: Wrap VMXON in ASM_TRY(), a.k.a. in exception fixup
Gracefully handle and return faults on VMXON instead of letting VMXON explode. The primary motivation is to be able to reuse the helper in tests that verify VMXON faults when it's supposed to, but printing a nice error message on fault is also nice.
Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20220608235238.3881916-9-seanjc@google.com
show more ...
|
#
2a514826 |
| 08-Jun-2022 |
Sean Christopherson <seanjc@google.com> |
nVMX: Check result of VMXON in INIT/SIPI tests
Assert that VMXON succeeds in the INIT/SIPI tests, _vmx_on() doesn't check the result, i.e. doesn't guarantee success.
Signed-off-by: Sean Christopher
nVMX: Check result of VMXON in INIT/SIPI tests
Assert that VMXON succeeds in the INIT/SIPI tests, _vmx_on() doesn't check the result, i.e. doesn't guarantee success.
Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20220608235238.3881916-8-seanjc@google.com
show more ...
|
#
4143fbfd |
| 08-Jun-2022 |
Sean Christopherson <seanjc@google.com> |
x86: Use "safe" terminology instead of "checking"
Rename all helpers that eat (and return) exceptions to use "safe" instead of "checking". This aligns KUT with the kernel and KVM selftests.
Signed
x86: Use "safe" terminology instead of "checking"
Rename all helpers that eat (and return) exceptions to use "safe" instead of "checking". This aligns KUT with the kernel and KVM selftests.
Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20220608235238.3881916-4-seanjc@google.com
show more ...
|