1. 16 11月, 2021 2 次提交
  2. 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
  3. 19 10月, 2021 2 次提交
  4. 06 7月, 2021 1 次提交
  5. 25 6月, 2021 1 次提交
  6. 24 6月, 2021 7 次提交
  7. 18 6月, 2021 1 次提交
  8. 09 6月, 2021 2 次提交
    • Z
      selftests: kvm: Add support for customized slot0 memory size · f53b16ad
      Zhenzhong Duan 提交于
      Until commit 39fe2fc9 ("selftests: kvm: make allocation of extra
      memory take effect", 2021-05-27), parameter extra_mem_pages was used
      only to calculate the page table size for all the memory chunks,
      because real memory allocation happened with calls of
      vm_userspace_mem_region_add() after vm_create_default().
      
      Commit 39fe2fc9 however changed the meaning of extra_mem_pages to
      the size of memory slot 0.  This makes the memory allocation more
      flexible, but makes it harder to account for the number of
      pages needed for the page tables.  For example, memslot_perf_test
      has a small amount of memory in slot 0 but a lot in other slots,
      and adding that memory twice (both in slot 0 and with later
      calls to vm_userspace_mem_region_add()) causes an error that
      was fixed in commit 000ac429 ("selftests: kvm: fix overlapping
      addresses in memslot_perf_test", 2021-05-29)
      
      Since both uses are sensible, add a new parameter slot0_mem_pages
      to vm_create_with_vcpus() and some comments to clarify the meaning of
      slot0_mem_pages and extra_mem_pages.  With this change,
      memslot_perf_test can go back to passing the number of memory
      pages as extra_mem_pages.
      Signed-off-by: NZhenzhong Duan <zhenzhong.duan@intel.com>
      Message-Id: <20210608233816.423958-4-zhenzhong.duan@intel.com>
      [Squashed in a single patch and rewrote the commit message. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f53b16ad
    • C
      KVM: selftests: introduce P47V64 for s390x · 1bc603af
      Christian Borntraeger 提交于
      s390x can have up to 47bits of physical guest and 64bits of virtual
      address  bits. Add a new address mode to avoid errors of testcases
      going beyond 47bits.
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Message-Id: <20210608123954.10991-1-borntraeger@de.ibm.com>
      Fixes: ef4c9f4f ("KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn()")
      Cc: stable@vger.kernel.org
      Reviewed-by: NDavid Matlack <dmatlack@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      1bc603af
  9. 27 5月, 2021 10 次提交
  10. 26 4月, 2021 1 次提交
  11. 20 4月, 2021 3 次提交
  12. 07 4月, 2021 1 次提交
  13. 06 4月, 2021 1 次提交
  14. 19 3月, 2021 1 次提交
  15. 03 3月, 2021 1 次提交
  16. 04 2月, 2021 1 次提交
    • J
      KVM: x86/xen: intercept xen hypercalls if enabled · 23200b7a
      Joao Martins 提交于
      Add a new exit reason for emulator to handle Xen hypercalls.
      
      Since this means KVM owns the ABI, dispense with the facility for the
      VMM to provide its own copy of the hypercall pages; just fill them in
      directly using VMCALL/VMMCALL as we do for the Hyper-V hypercall page.
      
      This behaviour is enabled by a new INTERCEPT_HCALL flag in the
      KVM_XEN_HVM_CONFIG ioctl structure, and advertised by the same flag
      being returned from the KVM_CAP_XEN_HVM check.
      
      Rename xen_hvm_config() to kvm_xen_write_hypercall_page() and move it
      to the nascent xen.c while we're at it, and add a test case.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      Signed-off-by: NDavid Woodhouse <dwmw@amazon.co.uk>
      23200b7a
  17. 08 1月, 2021 1 次提交
  18. 12 12月, 2020 1 次提交
    • A
      selftests: kvm: Test MSR exiting to userspace · 3cea1891
      Aaron Lewis 提交于
      Add a selftest to test that when the ioctl KVM_X86_SET_MSR_FILTER is
      called with an MSR list, those MSRs exit to userspace.
      
      This test uses 3 MSRs to test this:
        1. MSR_IA32_XSS, an MSR the kernel knows about.
        2. MSR_IA32_FLUSH_CMD, an MSR the kernel does not know about.
        3. MSR_NON_EXISTENT, an MSR invented in this test for the purposes of
           passing a fake MSR from the guest to userspace.  KVM just acts as a
           pass through.
      
      Userspace is also able to inject a #GP.  This is demonstrated when
      MSR_IA32_XSS and MSR_IA32_FLUSH_CMD are misused in the test.  When this
      happens a #GP is initiated in userspace to be thrown in the guest which is
      handled gracefully by the exception handling framework introduced earlier
      in this series.
      
      Tests for the generic instruction emulator were also added.  For this to
      work the module parameter kvm.force_emulation_prefix=1 has to be enabled.
      If it isn't enabled the tests will be skipped.
      
      A test was also added to ensure the MSR permission bitmap is being set
      correctly by executing reads and writes of MSR_FS_BASE and MSR_GS_BASE
      in the guest while alternating which MSR userspace should intercept.  If
      the permission bitmap is being set correctly only one of the MSRs should
      be coming through at a time, and the guest should be able to read and
      write the other one directly.
      Signed-off-by: NAaron Lewis <aaronlewis@google.com>
      Reviewed-by: NAlexander Graf <graf@amazon.com>
      Message-Id: <20201012194716.3950330-5-aaronlewis@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      3cea1891
  19. 17 11月, 2020 1 次提交
  20. 15 11月, 2020 1 次提交