1. 22 10月, 2021 4 次提交
  2. 01 10月, 2021 7 次提交
  3. 21 8月, 2021 2 次提交
  4. 25 6月, 2021 4 次提交
  5. 18 6月, 2021 3 次提交
  6. 15 3月, 2021 5 次提交
    • S
      KVM: x86: Get active PCID only when writing a CR3 value · e83bc09c
      Sean Christopherson 提交于
      Retrieve the active PCID only when writing a guest CR3 value, i.e. don't
      get the PCID when using EPT or NPT.  The PCID is especially problematic
      for EPT as the bits have different meaning, and so the PCID and must be
      manually stripped, which is annoying and unnecessary.  And on VMX,
      getting the active PCID also involves reading the guest's CR3 and
      CR4.PCIDE, i.e. may add pointless VMREADs.
      
      Opportunistically rename the pgd/pgd_level params to root_hpa and
      root_level to better reflect their new roles.  Keep the function names,
      as "load the guest PGD" is still accurate/correct.
      
      Last, and probably least, pass root_hpa as a hpa_t/u64 instead of an
      unsigned long.  The EPTP holds a 64-bit value, even in 32-bit mode, so
      in theory EPT could support HIGHMEM for 32-bit KVM.  Never mind that
      doing so would require changing the MMU page allocators and reworking
      the MMU to use kmap().
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20210305183123.3978098-2-seanjc@google.com>
      Reviewed-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e83bc09c
    • S
      KVM: x86/mmu: Make Host-writable and MMU-writable bit locations dynamic · 5fc3424f
      Sean Christopherson 提交于
      Make the location of the HOST_WRITABLE and MMU_WRITABLE configurable for
      a given KVM instance.  This will allow EPT to use high available bits,
      which in turn will free up bit 11 for a constant MMU_PRESENT bit.
      
      No functional change intended.
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20210225204749.1512652-19-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      5fc3424f
    • S
      KVM: x86/mmu: Move logic for setting SPTE masks for EPT into the MMU proper · e7b7bdea
      Sean Christopherson 提交于
      Let the MMU deal with the SPTE masks to avoid splitting the logic and
      knowledge across the MMU and VMX.
      
      The SPTE masks that are used for EPT are very, very tightly coupled to
      the MMU implementation.  The use of available bits, the existence of A/D
      types, the fact that shadow_x_mask even exists, and so on and so forth
      are all baked into the MMU implementation.  Cross referencing the params
      to the masks is also a nightmare, as pretty much every param is a u64.
      
      A future patch will make the location of the MMU_WRITABLE and
      HOST_WRITABLE bits MMU specific, to free up bit 11 for a MMU_PRESENT bit.
      Doing that change with the current kvm_mmu_set_mask_ptes() would be an
      absolute mess.
      
      No functional change intended.
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20210225204749.1512652-18-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e7b7bdea
    • S
      KVM: x86/mmu: Stop using software available bits to denote MMIO SPTEs · 8120337a
      Sean Christopherson 提交于
      Stop tagging MMIO SPTEs with specific available bits and instead detect
      MMIO SPTEs by checking for their unique SPTE value.  The value is
      guaranteed to be unique on shadow paging and NPT as setting reserved
      physical address bits on any other type of SPTE would consistute a KVM
      bug.  Ditto for EPT, as creating a WX non-MMIO would also be a bug.
      
      Note, this approach is also future-compatibile with TDX, which will need
      to reflect MMIO EPT violations as #VEs into the guest.  To create an EPT
      violation instead of a misconfig, TDX EPTs will need to have RWX=0,  But,
      MMIO SPTEs will also be the only case where KVM clears SUPPRESS_VE, so
      MMIO SPTEs will still be guaranteed to have a unique value within a given
      MMU context.
      
      The main motivation is to make it easier to reason about which types of
      SPTEs use which available bits.  As a happy side effect, this frees up
      two more bits for storing the MMIO generation.
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20210225204749.1512652-11-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      8120337a
    • S
      KVM: x86/mmu: Unexport MMU load/unload functions · 61a1773e
      Sean Christopherson 提交于
      Unexport the MMU load and unload helpers now that they are no longer
      used (incorrectly) in vendor code.
      
      Opportunistically move the kvm_mmu_sync_roots() declaration into mmu.h,
      it should not be exposed to vendor code.
      
      No functional change intended.
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20210305011101.3597423-16-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      61a1773e
  7. 04 2月, 2021 2 次提交
    • J
      KVM: x86: use static calls to reduce kvm_x86_ops overhead · b3646477
      Jason Baron 提交于
      Convert kvm_x86_ops to use static calls. Note that all kvm_x86_ops are
      covered here except for 'pmu_ops and 'nested ops'.
      
      Here are some numbers running cpuid in a loop of 1 million calls averaged
      over 5 runs, measured in the vm (lower is better).
      
      Intel Xeon 3000MHz:
      
                 |default    |mitigations=off
      -------------------------------------
      vanilla    |.671s      |.486s
      static call|.573s(-15%)|.458s(-6%)
      
      AMD EPYC 2500MHz:
      
                 |default    |mitigations=off
      -------------------------------------
      vanilla    |.710s      |.609s
      static call|.664s(-6%) |.609s(0%)
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Signed-off-by: NJason Baron <jbaron@akamai.com>
      Message-Id: <e057bf1b8a7ad15652df6eeba3f907ae758d3399.1610680941.git.jbaron@akamai.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b3646477
    • S
      KVM: x86/mmu: Use boolean returns for (S)PTE accessors · 15e6a7e5
      Sean Christopherson 提交于
      Return a 'bool' instead of an 'int' for various PTE accessors that are
      boolean in nature, e.g. is_shadow_present_pte().  Returning an int is
      goofy and potentially dangerous, e.g. if a flag being checked is moved
      into the upper 32 bits of a SPTE, then the compiler may silently squash
      the entire check since casting to an int is guaranteed to yield a
      return value of '0'.
      
      Opportunistically refactor is_last_spte() so that it naturally returns
      a bool value instead of letting it implicitly cast 0/1 to false/true.
      
      No functional change intended.
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20210123003003.3137525-1-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      15e6a7e5
  8. 26 1月, 2021 1 次提交
  9. 08 1月, 2021 1 次提交
  10. 28 9月, 2020 1 次提交
  11. 31 7月, 2020 1 次提交
    • S
      KVM: x86: Pull the PGD's level from the MMU instead of recalculating it · 2a40b900
      Sean Christopherson 提交于
      Use the shadow_root_level from the current MMU as the root level for the
      PGD, i.e. for VMX's EPTP.  This eliminates the weird dependency between
      VMX and the MMU where both must independently calculate the same root
      level for things to work correctly.  Temporarily keep VMX's calculation
      of the level and use it to WARN if the incoming level diverges.
      
      Opportunistically refactor kvm_mmu_load_pgd() to avoid indentation hell,
      and rename a 'cr3' param in the load_mmu_pgd prototype that managed to
      survive the cr3 purge.
      
      No functional change intended.
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Message-Id: <20200716034122.5998-6-sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2a40b900
  12. 11 7月, 2020 2 次提交
  13. 09 7月, 2020 3 次提交
  14. 23 6月, 2020 1 次提交
  15. 01 6月, 2020 1 次提交
  16. 28 5月, 2020 1 次提交
  17. 31 3月, 2020 1 次提交