1. Oct 03, 2019
    • Paolo Bonzini's avatar
      Merge tag 'kvmarm-fixes-5.4-1' of... · d53a4c8e
      Paolo Bonzini authored
      Merge tag 'kvmarm-fixes-5.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
      
      KVM/arm fixes for 5.4, take #1
      
      - Remove the now obsolete hyp_alternate_select construct
      - Fix the TRACE_INCLUDE_PATH macro in the vgic code
      d53a4c8e
    • Paolo Bonzini's avatar
      KVM: x86: omit absent pmu MSRs from MSR list · 24c29b7a
      Paolo Bonzini authored
      
      
      INTEL_PMC_MAX_GENERIC is currently 32, which exceeds the 18 contiguous
      MSR indices reserved by Intel for event selectors.  Since some machines
      actually have MSRs past the reserved range, these may survive the
      filtering of msrs_to_save array and would be rejected by KVM_GET/SET_MSR.
      To avoid this, cut the list to whatever CPUID reports for the host's
      architectural PMU.
      
      Reported-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Suggested-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Cc: Jim Mattson <jmattson@google.com>
      Fixes: e2ada66e
      
       ("kvm: x86: Add Intel PMU MSRs to msrs_to_save[]", 2019-08-21)
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      24c29b7a
    • Shuah Khan's avatar
      selftests: kvm: Fix libkvm build error · 6e06983d
      Shuah Khan authored
      
      
      Fix the following build error from "make TARGETS=kvm kselftest":
      
      libkvm.a(assert.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
      
      This error is seen when build is done from the main Makefile using
      kselftest target. In this case KBUILD_CPPFLAGS and CC_OPTION_CFLAGS
      are defined.
      
      When build is invoked using:
      
      "make -C tools/testing/selftests/kvm" KBUILD_CPPFLAGS and CC_OPTION_CFLAGS
      aren't defined.
      
      There is no need to pass in KBUILD_CPPFLAGS and CC_OPTION_CFLAGS for the
      check to determine if --no-pie is necessary, which is the case when these
      two aren't defined when "make -C tools/testing/selftests/kvm" runs.
      
      Fix it by simplifying the no-pie-option logic. With this change, both
      build variations work.
      
      "make TARGETS=kvm kselftest"
      "make -C tools/testing/selftests/kvm"
      
      Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      6e06983d
  2. Oct 01, 2019
  3. Sep 28, 2019
  4. Sep 27, 2019
    • Paolo Bonzini's avatar
      selftests: kvm: add test for dirty logging inside nested guests · 09444420
      Paolo Bonzini authored
      
      
      Check that accesses by nested guests are logged according to the
      L1 physical addresses rather than L2.
      
      Most of the patch is really adding EPT support to the testing
      framework.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      09444420
    • Paolo Bonzini's avatar
      KVM: x86: fix nested guest live migration with PML · 1f4e5fc8
      Paolo Bonzini authored
      
      
      Shadow paging is fundamentally incompatible with the page-modification
      log, because the GPAs in the log come from the wrong memory map.
      In particular, for the EPT page-modification log, the GPAs in the log come
      from L2 rather than L1.  (If there was a non-EPT page-modification log,
      we couldn't use it for shadow paging because it would log GVAs rather
      than GPAs).
      
      Therefore, we need to rely on write protection to record dirty pages.
      This has the side effect of bypassing PML, since writes now result in an
      EPT violation vmexit.
      
      This is relatively easy to add to KVM, because pretty much the only place
      that needs changing is spte_clear_dirty.  The first access to the page
      already goes through the page fault path and records the correct GPA;
      it's only subsequent accesses that are wrong.  Therefore, we can equip
      set_spte (where the first access happens) to record that the SPTE will
      have to be write protected, and then spte_clear_dirty will use this
      information to do the right thing.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      1f4e5fc8
    • Paolo Bonzini's avatar
      KVM: x86: assign two bits to track SPTE kinds · 6eeb4ef0
      Paolo Bonzini authored
      
      
      Currently, we are overloading SPTE_SPECIAL_MASK to mean both
      "A/D bits unavailable" and MMIO, where the difference between the
      two is determined by mio_mask and mmio_value.
      
      However, the next patch will need two bits to distinguish
      availability of A/D bits from write protection.  So, while at
      it give MMIO its own bit pattern, and move the two bits from
      bit 62 to bits 52..53 since Intel is allocating EPT page table
      bits from the top.
      
      Reviewed-by: default avatarJunaid Shahid <junaids@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      6eeb4ef0
  5. Sep 26, 2019
  6. Sep 25, 2019
  7. Sep 24, 2019