History log of /kvm-unit-tests/x86/svm.c (Results 1 – 25 of 82)
Revision Date Author Comments
# 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 ...


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


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


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


# 2b2ac67d 28-Jun-2022 Manali Shukla <manali.shukla@amd.com>

x86: nSVM: Correct indentation for svm.c

Replace spaces with tabs in svm.c and fix myriad indentation issues.

No functional changes intended.

Signed-off-by: Manali Shukla <manali.shukla@amd.com>
L

x86: nSVM: Correct indentation for svm.c

Replace spaces with tabs in svm.c and fix myriad indentation issues.

No functional changes intended.

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

show more ...


# 6f5ce7c1 28-Jun-2022 Manali Shukla <manali.shukla@amd.com>

x86: nSVM: Build up the nested page table dynamically

Build up nested page table dynamically based on the RAM size of VM
instead of building it statically with 2048 PTEs and one PML4 entry,
so that

x86: nSVM: Build up the nested page table dynamically

Build up nested page table dynamically based on the RAM size of VM
instead of building it statically with 2048 PTEs and one PML4 entry,
so that nested page table can be easily extensible to provide
seperate range of addressses to test various test cases, if needed.

Signed-off-by: Manali Shukla <manali.shukla@amd.com>
Link: https://lore.kernel.org/r/20220628113853.392569-6-manali.shukla@amd.com
[sean: use enum, rename "nested" flag to "user", rework changelog]
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


# 712840d5 28-Jun-2022 Manali Shukla <manali.shukla@amd.com>

x86: nSVM: Extract core functionality of main() to helper run_svm_tests()

Move common functionalities of main() to run_svm_tests(), so that
nNPT tests can be moved to their own file to make other te

x86: nSVM: Extract core functionality of main() to helper run_svm_tests()

Move common functionalities of main() to run_svm_tests(), so that
nNPT tests can be moved to their own file to make other test cases run
without nNPT test cases fiddling with page table midway.

No functional change intended.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Manali Shukla <manali.shukla@amd.com>
Link: https://lore.kernel.org/r/20220628113853.392569-2-manali.shukla@amd.com
[sean: pass in test array instead of defining it globally in two places]
Signed-off-by: Sean Christopherson <seanjc@google.com>

show more ...


# 912c0d72 30-May-2022 Thomas Huth <thuth@redhat.com>

x86: Fix typos

Correct typos which were discovered with the "codespell" utility.

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


# 8650dffe 22-Mar-2022 Maxim Levitsky <mlevitsk@redhat.com>

svm: add test for pause filter and threshold

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20220322205613.250925-10-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@red

svm: add test for pause filter and threshold

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20220322205613.250925-10-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# a8503d50 22-Mar-2022 Maxim Levitsky <mlevitsk@redhat.com>

svm: add test for nested tsc scaling

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20220322205613.250925-9-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


# 537d39df 22-Mar-2022 Maxim Levitsky <mlevitsk@redhat.com>

svm: add tests for LBR virtualization

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20220322205613.250925-7-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


# ea9bf4ad 22-Mar-2022 Maxim Levitsky <mlevitsk@redhat.com>

svm: add SVM_BARE_VMRUN

This will be useful in nested LBR tests to ensure that no extra
branches are made in the guest entry.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <202203

svm: add SVM_BARE_VMRUN

This will be useful in nested LBR tests to ensure that no extra
branches are made in the guest entry.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20220322205613.250925-6-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# eb8a146b 22-Mar-2022 Maxim Levitsky <mlevitsk@redhat.com>

svm: intercept shutdown in all svm tests by default

If L1 doesn't intercept shutdown, then L1 itself gets it,
which doesn't allow it to report the error that happened.

Signed-off-by: Maxim Levitsky

svm: intercept shutdown in all svm tests by default

If L1 doesn't intercept shutdown, then L1 itself gets it,
which doesn't allow it to report the error that happened.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20220322205613.250925-5-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 440c4fc3 09-Sep-2021 Bill Wendling <morbo@google.com>

x86: svm: mark test_run as noinline

test_run uses inline asm that defines globally visible labels. Clang
decides that it can inline this function, which causes the assembler to
complain about duplic

x86: svm: mark test_run as noinline

test_run uses inline asm that defines globally visible labels. Clang
decides that it can inline this function, which causes the assembler to
complain about duplicate symbols. Mark the function as "noinline" to
prevent this.

Signed-off-by: Bill Wendling <morbo@google.com>
[sean: call out the globally visible aspect]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210909183207.2228273-6-seanjc@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 0c22fd44 26-Jul-2021 Paolo Bonzini <pbonzini@redhat.com>

svm: do not use pointer types for asm labels

asm labels do not really have any type, making them a pointer
(so that &vmrun_rip for example is an u64**) adds more
complication.

Signed-off-by: Paolo

svm: do not use pointer types for asm labels

asm labels do not really have any type, making them a pointer
(so that &vmrun_rip for example is an u64**) adds more
complication.

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

show more ...


# a6495564 19-Jul-2021 Krish Sadhukhan <krish.sadhukhan@oracle.com>

nSVM: Add a variant of svm_vmrun() for setting guest RIP to custom code

Current implementations of svm_vmrun() and test_run() set the guest RIP to a
wrapper function which executes the guest code be

nSVM: Add a variant of svm_vmrun() for setting guest RIP to custom code

Current implementations of svm_vmrun() and test_run() set the guest RIP to a
wrapper function which executes the guest code being used by tests. This is
not suitable for tests like testing the effect of guest EFLAGS.TF on VMRUN
because the trap handler will point to the second guest instruction to which
the test code does not have access.

Therefore, move the contents of svm_vmrun() to a new function called
__svm_vmrun() and add guest RIP as a function parameter so that it will
set the VMCB guest RIP field to the memory location passed in. Call this
new function in svm_vmrun() and pass the wrapper guest code in order to
maintain the existing interface.

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Message-Id: <20210719174617.241568-2-krish.sadhukhan@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# f6972bd6 22-Jul-2021 Lara Lazier <laramglazier@gmail.com>

nSVM: Added test for VGIF feature

When VGIF is enabled STGI executed in guest mode
sets bit 9, while CLGI clears bit 9 in the int_ctl (offset 60h)
of the VMCB.

Signed-off-by: Lara Lazier <laramglaz

nSVM: Added test for VGIF feature

When VGIF is enabled STGI executed in guest mode
sets bit 9, while CLGI clears bit 9 in the int_ctl (offset 60h)
of the VMCB.

Signed-off-by: Lara Lazier <laramglazier@gmail.com>
Message-Id: <20210722131718.11667-1-laramglazier@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 916635a8 22-Jun-2021 Sean Christopherson <seanjc@google.com>

nSVM: Add test for NPT reserved bit and #NPF error code behavior

Add a test to verify that KVM generates the correct #NPF and PFEC when
host and guest EFER.NX and CR4.SMEP values diverge, and that K

nSVM: Add test for NPT reserved bit and #NPF error code behavior

Add a test to verify that KVM generates the correct #NPF and PFEC when
host and guest EFER.NX and CR4.SMEP values diverge, and that KVM
correctly detects reserved bits in the first place.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210622210047.3691840-13-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 779fd1fa 22-Jun-2021 Sean Christopherson <seanjc@google.com>

nSVM: Stop forcing EFER.NX=1 for all tests

Don't force EFER.NX=1 for SVM tests now that the one NPT test that needs
EFER.NX=1 does its own housekeeping.

Signed-off-by: Sean Christopherson <seanjc@g

nSVM: Stop forcing EFER.NX=1 for all tests

Don't force EFER.NX=1 for SVM tests now that the one NPT test that needs
EFER.NX=1 does its own housekeeping.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210622210047.3691840-7-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# cf851077 22-Jun-2021 Sean Christopherson <seanjc@google.com>

nSVM: Reset the VMCB before every v1 test

Refresh the VMCB before every v1 test to fix bugs where tests neglect to
initialize the VMCB and end up taking a dependency on previous tests,
e.g. looking

nSVM: Reset the VMCB before every v1 test

Refresh the VMCB before every v1 test to fix bugs where tests neglect to
initialize the VMCB and end up taking a dependency on previous tests,
e.g. looking at you mode_test and next_rip. This will also allow tests
to modify VMCB fields without having to do their own manual save/restore.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210622210047.3691840-4-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 48c13f32 12-Apr-2021 Krish Sadhukhan <krish.sadhukhan@oracle.com>

SVM: Use ALIGN macro when aligning 'io_bitmap_area'

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Message-Id: <20210412215611.110095-6-krish.sadhukhan@oracle.com>
Signed-off-by: Paolo

SVM: Use ALIGN macro when aligning 'io_bitmap_area'

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Message-Id: <20210412215611.110095-6-krish.sadhukhan@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 44480895 23-Mar-2021 Krish Sadhukhan <krish.sadhukhan@oracle.com>

KVM: nSVM: Add assembly label to VMRUN instruction

Add an assembly label to the VMRUN instruction so that its RIP can be known
to test cases. This will be used by the test in the next patch.

Sugges

KVM: nSVM: Add assembly label to VMRUN instruction

Add an assembly label to the VMRUN instruction so that its RIP can be known
to test cases. This will be used by the test in the next patch.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Message-Id: <20210323175006.73249-4-krish.sadhukhan@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


# 48f67910 17-Jul-2020 Cathy Avery <cavery@redhat.com>

svm: Add ability to execute test via test_run on a vcpu other than vcpu 0

When running tests that can result in a vcpu being left in an
indeterminate state it is useful to be able to run the test on

svm: Add ability to execute test via test_run on a vcpu other than vcpu 0

When running tests that can result in a vcpu being left in an
indeterminate state it is useful to be able to run the test on
a vcpu other than 0. This patch allows test_run to be executed
on any vcpu indicated by the on_vcpu member of the svm_test struct.
The initialized state of the vcpu0 registers used to populate the
vmcb is carried forward to the other vcpus.

Signed-off-by: Cathy Avery <cavery@redhat.com>
Message-Id: <20200717113422.19575-2-cavery@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

show more ...


1234