History log of /kvm-unit-tests/x86/svm_tests.c (Results 1 – 25 of 101)
Revision Date Author Comments
# 98eb2a39 03-Jun-2024 Paolo Bonzini <pbonzini@redhat.com>

svm: make the interrupt_test a bit longer

When running under QEMU, a 1-nanosecond periodic timer leaves no room
for the test code to run. Make the period longer.

Signed-off-by: Paolo Bonzini <pbon

svm: make the interrupt_test a bit longer

When running under QEMU, a 1-nanosecond periodic timer leaves no room
for the test code to run. Make the period longer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 4b3c6114 29-May-2024 Paolo Bonzini <pbonzini@redhat.com>

svm: add test for VMRUN with interrupt shadow enabled

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


# d4ae0a71 09-Jan-2024 Thomas Huth <thuth@redhat.com>

x86: Fix various typos

Fix typos that have been discovered with the "codespell" utility.

Message-ID: <20240109132902.129377-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


# cd5f2fb4 20-Sep-2023 Paolo Bonzini <pbonzini@redhat.com>

Merge tag 'kvm-x86-2023.09.01' of https://github.com/kvm-x86/kvm-unit-tests into HEAD

x86 fixes, cleanups, and new testcases, and a few generic changes

- Fix a bug in runtime.bash that caused it t

Merge tag 'kvm-x86-2023.09.01' of https://github.com/kvm-x86/kvm-unit-tests into HEAD

x86 fixes, cleanups, and new testcases, and a few generic changes

- Fix a bug in runtime.bash that caused it to mishandle "check" strings with
multiple entries, e.g. a test that depends on multiple module params
- Make the PMU tests depend on vPMU support being enabled in KVM
- Fix PMU's forced emulation test on CPUs with full-width writes
- Add a PMU testcase for measuring TSX transactional cycles
- Nested SVM testcase for virtual NMIs
- Move a pile of code to ASM_TRY() and "safe" helpers
- Set up the guest stack in the LBRV tests so that the tests don't fail if the
compiler decides to generate function calls in guest code
- Ignore the "mispredict" flag in nSVM's LBRV tests to fix false failures
- Clean up usage of helpers that disable interrupts, e.g. stop inserting
unnecessary nops
- Add helpers to dedup code for programming the APIC timer
- Fix a variety of bugs in nVMX testcases related to being a 64-bit host

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 ...


# c64f24fd 22-Nov-2022 Maxim Levitsky <mlevitsk@redhat.com>

x86: nSVM: Add nested shutdown interception test

Add a simple test that a shutdown in L2 is correctly routed to L1 when L1
wants to intercept shutdown.

Signed-off-by: Maxim Levitsky <mlevitsk@redha

x86: nSVM: Add nested shutdown interception test

Add a simple test that a shutdown in L2 is correctly routed to L1 when L1
wants to intercept shutdown.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Link: https://lore.kernel.org/r/20221122161152.293072-10-mlevitsk@redhat.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


# a2c7dff7 22-Nov-2022 Maxim Levitsky <mlevitsk@redhat.com>

x86: nSVM: use apic_start_timer/apic_stop_timer instead of open coding it

This simplified code and ensures that after a subtest uses apic timer,
it won't leave the timer running and potentially affe

x86: nSVM: use apic_start_timer/apic_stop_timer instead of open coding it

This simplified code and ensures that after a subtest uses apic timer,
it won't leave the timer running and potentially affect subtests which are
run after it.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Link: https://lore.kernel.org/r/20221122161152.293072-7-mlevitsk@redhat.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


# 2602a896 22-Nov-2022 Maxim Levitsky <mlevitsk@redhat.com>

x86: nSVM: make svm_intr_intercept_mix_if/gif test a bit more robust

When injecting self IPI the test assumes that initial EFLAGS.IF flag is
zero, but previous tests might have set it.

Explicitly d

x86: nSVM: make svm_intr_intercept_mix_if/gif test a bit more robust

When injecting self IPI the test assumes that initial EFLAGS.IF flag is
zero, but previous tests might have set it.

Explicitly disable interrupts to avoid this assumption.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Link: https://lore.kernel.org/r/20221122161152.293072-6-mlevitsk@redhat.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


# d0458710 22-Nov-2022 Maxim Levitsky <mlevitsk@redhat.com>

x86: nSVM: Remove nop after stgi/clgi

Remove pointless nop after stgi/clgi - these instructions don't have an
interrupt window.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Link: https://lor

x86: nSVM: Remove nop after stgi/clgi

Remove pointless nop after stgi/clgi - these instructions don't have an
interrupt window.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Link: https://lore.kernel.org/r/20221122161152.293072-5-mlevitsk@redhat.com
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 ...


# 92098120 07-Jun-2023 Sean Christopherson <seanjc@google.com>

x86: nSVM: Print out RIP and LBRs from VMCB if LBRV guest test fails

Print out the RIP and LBRs from the VMCB's save are if a LBRV guest test
fails, i.e. exits for a reason other than VMMCALL. Debu

x86: nSVM: Print out RIP and LBRs from VMCB if LBRV guest test fails

Print out the RIP and LBRs from the VMCB's save are if a LBRV guest test
fails, i.e. exits for a reason other than VMMCALL. Debugging the guests
is still beyond painful, but with the guest RIP and LBRs, it's at least
possible to piece together things like shutdowns due to unexpected #PF
because the tests neglected to setup the guest stack.

Link: https://lore.kernel.org/r/20230607210959.1577847-7-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


# 554fa461 07-Jun-2023 Sean Christopherson <seanjc@google.com>

x86: nSVM: Replace check_dbgctl() with TEST_EXPECT_EQ() in LBRV test

Use TEST_EXPECT_EQ() to check the expected vs. actual DEBUGCTL instead
of using a one-off implementation that doesn't even print

x86: nSVM: Replace check_dbgctl() with TEST_EXPECT_EQ() in LBRV test

Use TEST_EXPECT_EQ() to check the expected vs. actual DEBUGCTL instead
of using a one-off implementation that doesn't even print the expected
value.

Link: https://lore.kernel.org/r/20230607210959.1577847-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


# ddb85855 07-Jun-2023 Sean Christopherson <seanjc@google.com>

x86: nSVM: Ignore mispredict bit in LBR records

Ignore the mispredict bit when comparing the expected versus actual LBR
records. Unsurprisingly, relying on the whims of the CPU's branch
predictor r

x86: nSVM: Ignore mispredict bit in LBR records

Ignore the mispredict bit when comparing the expected versus actual LBR
records. Unsurprisingly, relying on the whims of the CPU's branch
predictor results in false failures.

Fixes: 537d39df ("svm: add tests for LBR virtualization")
Link: https://lore.kernel.org/r/20230607210959.1577847-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


# 5200c1f1 07-Jun-2023 Sean Christopherson <seanjc@google.com>

x86: nSVM: Set up a guest stack in LBRV tests

Add a helper to configure save.rip and save.rsp, and use it in the LBRV
tests, which use a "bare" VMRUN to avoid branches around VMRUN. This
fixes a bu

x86: nSVM: Set up a guest stack in LBRV tests

Add a helper to configure save.rip and save.rsp, and use it in the LBRV
tests, which use a "bare" VMRUN to avoid branches around VMRUN. This
fixes a bug where the LBRV tests explode in confusing ways if the
compiler generates guest code that touches the stack in *any* way.

Link: https://lore.kernel.org/r/20230607210959.1577847-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


# 08200397 05-Apr-2023 Santosh Shukla <santosh.shukla@amd.com>

x86: nSVM: Add support for VNMI test

Add a VNMI test case to test Virtual NMI in a nested environment,
The test covers the Virtual NMI (VNMI) delivery.

Signed-off-by: Santosh Shukla <santosh.shukla

x86: nSVM: Add support for VNMI test

Add a VNMI test case to test Virtual NMI in a nested environment,
The test covers the Virtual NMI (VNMI) delivery.

Signed-off-by: Santosh Shukla <santosh.shukla@amd.com>
[sean: reuse pieces of NMI test framework, fix formatting issues]
Link: https://lore.kernel.org/r/20230405205138.525310-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


# 493d27d4 05-Apr-2023 Sean Christopherson <seanjc@google.com>

nSVM: Add helper to report fatal errors in guest

Add a helper macro to dedup nSVM test code that handles fatal errors
by reporting the failure, setting the test stage to a magic number, and
invoking

nSVM: Add helper to report fatal errors in guest

Add a helper macro to dedup nSVM test code that handles fatal errors
by reporting the failure, setting the test stage to a magic number, and
invoking VMMCALL to bail to the host and terminate.

Note, the V_TPR fails if report() is invoked. Punt on the issue for
now as most users already report only failures, but leave a TODO for
future developers.

Link: https://lore.kernel.org/r/20230405205138.525310-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


# 694e59ba 05-Oct-2022 Manali Shukla <manali.shukla@amd.com>

x86: nSVM: Move part of #NM test to exception test framework

Remove the boiler plate code for #NM test and move #NM exception test
into the exception test framework.

Keep the test case for the cond

x86: nSVM: Move part of #NM test to exception test framework

Remove the boiler plate code for #NM test and move #NM exception test
into the exception test framework.

Keep the test case for the condition where #NM exception is not
generated, but drop the #NM handler entirely and rely on an unexpected
exception being reported as such (the VMMCALL assertion would also fail).

Signed-off-by: Manali Shukla <manali.shukla@amd.com>
Co-developed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20221005235212.57836-9-seanjc@google.com

show more ...


# 0851b7f7 05-Oct-2022 Manali Shukla <manali.shukla@amd.com>

x86: nSVM: Move #OF test to exception test framework

Remove the boiler plate code for #OF test and move #OF exception test in
exception test framework.

Signed-off-by: Manali Shukla <manali.shukla@a

x86: nSVM: Move #OF test to exception test framework

Remove the boiler plate code for #OF test and move #OF exception test in
exception test framework.

Signed-off-by: Manali Shukla <manali.shukla@amd.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20221005235212.57836-8-seanjc@google.com

show more ...


# 44550f53 05-Oct-2022 Manali Shukla <manali.shukla@amd.com>

x86: nSVM: Move #BP test to exception test framework

Remove boiler plate code for #BP test and move #BP exception test into
the exception test framework.

Signed-off-by: Manali Shukla <manali.shukla

x86: nSVM: Move #BP test to exception test framework

Remove boiler plate code for #BP test and move #BP exception test into
the exception test framework.

Signed-off-by: Manali Shukla <manali.shukla@amd.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20221005235212.57836-7-seanjc@google.com

show more ...


# 8177dc62 05-Oct-2022 Manali Shukla <manali.shukla@amd.com>

x86: nSVM: Add an exception test framework and tests

Copy nVMX's test that verifies an exception occurring in L2 is
forwarded to the right place (L1 or L2).

The test verifies two conditions for eac

x86: nSVM: Add an exception test framework and tests

Copy nVMX's test that verifies an exception occurring in L2 is
forwarded to the right place (L1 or L2).

The test verifies two conditions for each exception.
1) Exception generated in L2, is handled by L2 when L2 exception handler
is registered.
2) Exception generated in L2, is handled by L1 when intercept exception
bit map is set in L1.

Note, v2 SVM tests have no parameters, but the SVM framework doesn't
differentiate between v1 and v2 when setting the guest code. Fudge
around this shortcoming by casting to test_guest_func when invoking
test_set_guest().

Signed-off-by: Manali Shukla <manali.shukla@amd.com>
[sean: use common helpers to generate exception, call out this copies nVMX]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20221005235212.57836-6-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 ...


# 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 ...


# d36b378f 15-Jun-2022 Varad Gautam <varad.gautam@suse.com>

x86: Move ap_init() to smp.c

ap_init() copies the SIPI vector to lowmem, sends INIT/SIPI to APs
and waits on the APs to come up.

Port this routine to C from asm and move it to smp.c to allow sharin

x86: Move ap_init() to smp.c

ap_init() copies the SIPI vector to lowmem, sends INIT/SIPI to APs
and waits on the APs to come up.

Port this routine to C from asm and move it to smp.c to allow sharing
this functionality between the EFI (-fPIC) and non-EFI builds.

Call ap_init() from the EFI setup path to reset the APs to a known
location.

Signed-off-by: Varad Gautam <varad.gautam@suse.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20220615232943.1465490-4-seanjc@google.com

show more ...


# 3f27d772 28-Jun-2022 Manali Shukla <manali.shukla@amd.com>

x86: nSVM: Correct indentation for svm_tests.c

Replace spaces with tabs and fix indentation errors in svm_tests.c.

No functional changes intended.

Signed-off-by: Manali Shukla <manali.shukla@amd.c

x86: nSVM: Correct indentation for svm_tests.c

Replace spaces with tabs and fix indentation errors in svm_tests.c.

No functional changes intended.

Signed-off-by: Manali Shukla <manali.shukla@amd.com>
Link: https://lore.kernel.org/r/20220628113853.392569-8-manali.shukla@amd.com
Link: https://lore.kernel.org/r/20220628113853.392569-9-manali.shukla@amd.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


12345