- Jan 18, 2022
-
-
Thomas Huth authored
Instead of failing the tests, we should rather skip them if ncat is not available. While we're at it, also mention ncat in the README.md file as a requirement for the migration tests. Resolves: https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/issues/4 Signed-off-by:
Thomas Huth <thuth@redhat.com> Message-Id: <20211221092130.444225-1-thuth@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Manali Shukla authored
Add coverage for OF exception handling in L2 when only L2 OF exception handler is registered. OF exception generated using instrumented code and it is handled by L2 OF exception handler. Signed-off-by:
Manali Shukla <manali.shukla@amd.com> Message-Id: <20211229062201.26269-4-manali.shukla@amd.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Manali Shukla authored
Add coverage for BP exception handling in L2 when only L2 BP exception handler is registered BP exception is generated using int3 instruction and it is handled by L2 BP exception handler. Signed-off-by:
Manali Shukla <manali.shukla@amd.com> Message-Id: <20211229062201.26269-3-manali.shukla@amd.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Manali Shukla authored
Add coverage for NM exception handling in L2 when only L2 NM exception handler is registered Verifies 3 different conditions for which #NM is generated and handled in L2 1) CR0.TS is set - #NM is generated and handled in L2 exception handler 2) CR0.TS is cleared and CR0.EM is set - #NM is generated and handled in L2 exception handler 3) CR0.TS and CR0.EM are cleared - #NM is not generated Signed-off-by:
Manali Shukla <manali.shukla@amd.com> Message-Id: <20211229062201.26269-2-manali.shukla@amd.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Barzen, Benjamin authored
From e107317d029b5298c88701b4bcc93bc64e28384b Mon Sep 17 00:00:00 2001 From: bbarzen <bbarzen@amazon.com> Date: Wed, 29 Dec 2021 12:50:14 +0100 Subject: [PATCH] ACPI: fix ACPI RSDP located before 0xF0000 is not found The function find_acpi_table_addr locates the ACPI RSDP by searching the BIOS read only memory space. The official ACPI specification states that this space goes from 0xE0000 to 0xFFFFF. The function currently starts searching at 0xF0000. Any RSDP located before that address can subsequently not be found. Change the start address of the search to 0xE0000. Singed-off-by:
Benjamin Barzen <bbarzen@amazon.de> Message-Id: <6DFC2BF8-5CAC-410C-9A36-36E92FFC7817@amazon.de> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Zhenzhong Duan authored
Accidently we see pcid test failed as INVPCID_DESC[127:64] is uninitialized before execute invpcid. According to Intel spec: "#GP If INVPCID_TYPE is 0 and the linear address in INVPCID_DESC[127:64] is not canonical." By zeroing the whole invpcid_desc structure, ensure the address canonical and reserved bit zero in desc. Also change invpcid_desc to be clearly 128bit in size no matter in 64bit or 32bit mode to match the description in spec. Fixes: b44d84da ("Add PCID/INVPCID test") Suggested-by:
Sean Christopherson <seanjc@google.com> Signed-off-by:
Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20220117084618.442906-1-zhenzhong.duan@intel.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Aaron Lewis authored
Setting the stack to PAGE_SIZE - 1 sets the stack to being 1-byte aligned, which fails in usermode with alignment checks enabled (ie: with flags cr0.am set and eflags.ac set). This was causing an #AC in usermode.c when preparing to call the callback in run_in_user(). Aligning the stack fixes the issue. For the purposes of fixing the #AC in usermode.c the stack has to be aligned to at least an 8-byte boundary. Setting it to a page aligned boundary ensures any stack alignment requirements are met as x86_64 stacks generally want to be 16-byte aligned. Signed-off-by:
Aaron Lewis <aaronlewis@google.com> Message-Id: <20211214011823.3277011-3-aaronlewis@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Aaron Lewis authored
When handling an exception in usermode.c the exception handler #GPs when executing IRET to return from the exception handler. This happens because the stack segment selector does not have the same privilege level as the return code segment selector. Set the stack segment selector to match the code segment selector's privilege level to fix the issue. This problem has been disguised in kvm-unit-tests because a #GP exception handler has been registered with run_in_user() for the tests that are currently using this feature. With a #GP exception handler registered, the first exception will be processed then #GP on the IRET. The IRET from the second #GP will then succeed, and the subsequent lngjmp() will restore RSP to a sane value. But if no #GP handler is installed, e.g. if a test wants to handle only #ACs, the #GP on the initial IRET will be fatal. This is only a problem in 64-bit mode because 64-bit mode unconditionally pops SS:RSP (SDM vol 3, 6.14.3 "IRET in IA-32e Mode"). In 32-bit mode SS:RSP is not popped because there is no privilege level change when executing IRET at the end of the #GP handler. Signed-off-by:
Aaron Lewis <aaronlewis@google.com> Reviewed-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211214011823.3277011-2-aaronlewis@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Dec 23, 2021
-
-
Paolo Bonzini authored
The VPID tests take quite a long time (about 12 minutes overall), so separate them from vmx_pf_exception_test and do not run vmx_pf_invvpid_test twice. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Dec 14, 2021
-
-
Zhenzhong Duan authored
When X86_FEATURE_WAITPKG(CPUID.7.0:ECX.WAITPKG[bit 5]) supported, ".byte 0x66, 0x0f, 0xae, 0xf0" sequence no longer represents clwb instruction with invalid operand but tpause instruction with %eax as input register. Execute tpause with invalid input triggers #GP with below customed qemu command line: qemu -kernel x86/memory.flat -overcommit cpu-pm=on ... Signed-off-by:
Zhenzhong Duan <zhenzhong.duan@intel.com> Message-Id: <20211201092619.60298-1-zhenzhong.duan@intel.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
David Matlack authored
When testing with debug kernels (e.g. CONFIG_DEBUG_VM) vmx_vmcs_shadow_test exceeds the default 90s timeout. The test ends up taking about 120s to complete (on a barmetal host), so increase the timeout to 180s. Signed-off-by:
David Matlack <dmatlack@google.com> Message-Id: <20211213195912.447258-1-dmatlack@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Dec 09, 2021
-
-
Thomas Huth authored
s390x: I/O allocation fixes and firq test See merge request kvm-unit-tests/kvm-unit-tests!21
-
- Dec 07, 2021
-
-
David Hildenbrand authored
We had a KVM BUG fixed by kernel commit a3e03bc1368c ("KVM: s390: index kvm->arch.idle_mask by vcpu_idx"), whereby a floating interrupt might get stuck forever because a CPU in the wait state would not get woken up. The issue can be triggered when CPUs are created in a nonlinear fashion, such that the CPU address ("core-id") and the KVM cpu id don't match. So let's start with a floating interrupt test that will trigger a floating interrupt (via SCLP) to be delivered to a CPU in the wait state. Signed-off-by:
David Hildenbrand <david@redhat.com> Reviewed-by:
Thomas Huth <thuth@redhat.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Message-Id: <20211202123553.96412-3-david@redhat.com> Signed-off-by:
Claudio Imbrenda <imbrenda@linux.ibm.com>
-
David Hildenbrand authored
Properly return "0" on success so callers can check if the setup was successful. The return value is yet unused, which is why this wasn't noticed so far. Reviewed-by:
Thomas Huth <thuth@redhat.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by:
Janosch Frank <frankja@linux.ibm.com> Signed-off-by:
David Hildenbrand <david@redhat.com> Message-Id: <20211202123553.96412-2-david@redhat.com> Signed-off-by:
Claudio Imbrenda <imbrenda@linux.ibm.com>
-
Pierre Morel authored
The allocator allocates pages, so the size must be rounded up to whole pages before the allocation. Fixes: b0fe3988 "s390x: define UV compatible I/O allocation" Signed-off-by:
Pierre Morel <pmorel@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by:
Janosch Frank <frankja@linux.ibm.com> Message-Id: <20211111100153.86088-1-pmorel@linux.ibm.com> Signed-off-by:
Claudio Imbrenda <imbrenda@linux.ibm.com>
-
- Nov 26, 2021
-
-
Andrew Jones authored
Groups are space separated, so we can remove the 'grep -w', which has caused problems in the past with testnames, see b3733048 ("scripts: Fix the check whether testname is in the only_tests list") and use find_word. Signed-off-by:
Andrew Jones <drjones@redhat.com> Message-Id: <20211112133739.103327-3-drjones@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Andrew Jones authored
As specified in the comment blocks at the tops of the unittests.cfg files, multiple groups assigned to 'groups' should be space separated. Currently any nonword character works for the deliminator, but the implementation may change. Stick to the specs. Signed-off-by:
Andrew Jones <drjones@redhat.com> Message-Id: <20211112133739.103327-2-drjones@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
TCG does not emulate the PMU nor the intricacies of the VMware backdoor I/O port. Disable those tests unless running on KVM. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Add three variants of the #PF interception access test to handle TLB invalidations by relying on VPID rules. Intercept the access test's INVLPG and perform invalidation by: 1. Implicity flush on VM-Enter by disabling VPID 2. Explicitly perform INVVPID on the target address 3. Implicitly "flush" by moving to a new VPID Case #3 exposes a bug where KVM fails to update unsync SPTEs when using shadow paging and L1 changes the VPID it uses for L2, i.e. vmcs12->vpid. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-40-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Add a helper to check for VPID support to deduplicate code, now and in the future. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-39-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Rename ctrl to is_ctrl_valid in several tests. The variables are bools that, *** drum roll ***, track if a control setting is valid. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-38-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Eliminate a now-pointless and horribly name boolean in the EPT test. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-37-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Add a helper to check if a given memtype can be used for EPT structures, and use the helper to clean up the EPT test code. An informational message is lost along the way, but that's not necessarily a bad thing. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-36-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Rename EPT_CAP_WT to EPT_CAP_EXEC_ONLY. In x86, "WT" generally refers to write-through memtype, and is especially confusing considering that EPT capabilities also report UC and WB memtypes. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-35-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Add helpers to check for 4-level and 5-level EPT support. Yet another baby step toward removing unnecessary RDMSRs... Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-34-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Use the existing helper to check for EPT A/D support instead of rereading the capabilities MSR and open-coding the check. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-33-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Deduplicate some clever/interesting code for retrieving the first supported INVVPID type, and opportunistically avoid RDMSR on every test. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-32-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Add a helper to check for basic INVVPID, it will gain more users in the future. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-31-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Add a helper to deduplicate code, now and in the future, and to avoid a RDMSR every time a VPID test wants to do a basic functionality check. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-30-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Yank out the old INVVPID and drop the version info from the new test, which is a complete superset. That, and the old test was apparently trying to win an obfuscated C contest. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-29-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Drop vpid_sync(), it's unused. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-28-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Move the EPT capability helpers to vmx.h, ept_vpid is available and there's no reason to hide the trivial implementations. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-27-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Drop ept_sync(), it's nothing more than a wrapper to invept() with open-coded "assertions" that the desired flavor of INVEPT is supported. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-26-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Assert if INVEPT or INVVPID fails instead of silently ignoring potential problems and hoping they'll show up later. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-25-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Add a version of VMX's TEST_ASSERT that doesn't report. The output of basic assertions is annoying, and other than inflating the number of tests to make KUT look good, there's no value in reporting that KUT is working as intended. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-24-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Move VMX's assert macros to the top of vmx.h so that they can be used in inlined helpers. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-23-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
EPT can technically be supported without INVEPT(SINGLE_CONTEXT), skip the EPT tests if SINGLE_CONTEXT isn't supported as it's heavily used (without the result being checked, yay). Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-22-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
The access test now takes less than 5 seconds when TDP is enabled, and is well under the default 90 second timeout when TDP is disabled. Ditto for VMX's #PF interception variant, which is no longer being penalized by unnecessary CR exits and other general stupidity. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-21-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Drop the now-unused overrides from the PTE insertion helper. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-20-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Drop the overrides from the check_pfec_on_prefetch_pte() test now that pre-allocating page tables will naturally have them use the same PUD and PMD entries. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-19-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-