1. 16 11月, 2021 3 次提交
  2. 23 10月, 2021 1 次提交
    • J
      KVM: selftests: Fix nested SVM tests when built with clang · ed290e1c
      Jim Mattson 提交于
      Though gcc conveniently compiles a simple memset to "rep stos," clang
      prefers to call the libc version of memset. If a test is dynamically
      linked, the libc memset isn't available in L1 (nor is the PLT or the
      GOT, for that matter). Even if the test is statically linked, the libc
      memset may choose to use some CPU features, like AVX, which may not be
      enabled in L1. Note that __builtin_memset doesn't solve the problem,
      because (a) the compiler is free to call memset anyway, and (b)
      __builtin_memset may also choose to use features like AVX, which may
      not be available in L1.
      
      To avoid a myriad of problems, use an explicit "rep stos" to clear the
      VMCB in generic_svm_setup(), which is called both from L0 and L1.
      Reported-by: NRicardo Koller <ricarkol@google.com>
      Signed-off-by: NJim Mattson <jmattson@google.com>
      Fixes: 20ba262f ("selftests: KVM: AMD Nested test infrastructure")
      Message-Id: <20210930003649.4026553-1-jmattson@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ed290e1c
  3. 22 10月, 2021 1 次提交
    • M
      KVM: selftests: set CPUID before setting sregs in vcpu creation · 413eaa4e
      Michael Roth 提交于
      Recent kernels have checks to ensure the GPA values in special-purpose
      registers like CR3 are within the maximum physical address range and
      don't overlap with anything in the upper/reserved range. In the case of
      SEV kselftest guests booting directly into 64-bit mode, CR3 needs to be
      initialized to the GPA of the page table root, with the encryption bit
      set. The kernel accounts for this encryption bit by removing it from
      reserved bit range when the guest advertises the bit position via
      KVM_SET_CPUID*, but kselftests currently call KVM_SET_SREGS as part of
      vm_vcpu_add_default(), before KVM_SET_CPUID*.
      
      As a result, KVM_SET_SREGS will return an error in these cases.
      Address this by moving vcpu_set_cpuid() (which calls KVM_SET_CPUID*)
      ahead of vcpu_setup() (which calls KVM_SET_SREGS).
      
      While there, address a typo in the assertion that triggers when
      KVM_SET_SREGS fails.
      Suggested-by: NSean Christopherson <seanjc@google.com>
      Signed-off-by: NMichael Roth <michael.roth@amd.com>
      Message-Id: <20211006203617.13045-1-michael.roth@amd.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NNathan Tempelman <natet@google.com>
      413eaa4e
  4. 21 10月, 2021 2 次提交
  5. 19 10月, 2021 4 次提交
  6. 17 10月, 2021 14 次提交
  7. 11 10月, 2021 6 次提交
  8. 30 9月, 2021 4 次提交
  9. 28 9月, 2021 3 次提交
  10. 24 9月, 2021 2 次提交
    • O
      selftests: KVM: Explicitly use movq to read xmm registers · 386ca9d7
      Oliver Upton 提交于
      Compiling the KVM selftests with clang emits the following warning:
      
      >> include/x86_64/processor.h:297:25: error: variable 'xmm0' is uninitialized when used here [-Werror,-Wuninitialized]
      >>                return (unsigned long)xmm0;
      
      where xmm0 is accessed via an uninitialized register variable.
      
      Indeed, this is a misuse of register variables, which really should only
      be used for specifying register constraints on variables passed to
      inline assembly. Rather than attempting to read xmm registers via
      register variables, just explicitly perform the movq from the desired
      xmm register.
      
      Fixes: 783e9e51 ("kvm: selftests: add API testing infrastructure")
      Signed-off-by: NOliver Upton <oupton@google.com>
      Message-Id: <20210924005147.1122357-1-oupton@google.com>
      Reviewed-by: NRicardo Koller <ricarkol@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      386ca9d7
    • O
      selftests: KVM: Call ucall_init when setting up in rseq_test · fbf094ce
      Oliver Upton 提交于
      While x86 does not require any additional setup to use the ucall
      infrastructure, arm64 needs to set up the MMIO address used to signal a
      ucall to userspace. rseq_test does not initialize the MMIO address,
      resulting in the test spinning indefinitely.
      
      Fix the issue by calling ucall_init() during setup.
      
      Fixes: 61e52f16 ("KVM: selftests: Add a test for KVM_RUN+rseq to detect task migration bugs")
      Signed-off-by: NOliver Upton <oupton@google.com>
      Message-Id: <20210923220033.4172362-1-oupton@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      fbf094ce