1. 18 Jun, 2021 2 commits
    • Sean Christopherson's avatar
      KVM: SVM: Refuse to load kvm_amd if NX support is not available · b26a71a1
      Sean Christopherson authored
      Refuse to load KVM if NX support is not available.  Shadow paging has
      assumed NX support since commit 9167ab79 ("KVM: vmx, svm: always run
      with EFER.NXE=1 when shadow paging is active"), and NPT has assumed NX
      support since commit b8e8c830 ("kvm: mmu: ITLB_MULTIHIT mitigation").
      While the NX huge pages mitigation should not be enabled by default for
      AMD CPUs, it can be turned on by userspace at will.
      
      Unlike Intel CPUs, AMD does not provide a way for firmware to disable NX
      support, and Linux always sets EFER.NX=1 if it is supported.  Given that
      it's extremely unlikely that a CPU supports NPT but not NX, making NX a
      formal requirement is far simpler than adding requirements to the
      mitigation flow.
      
      Fixes: 9167ab79 ("KVM: vmx, svm: always run with EFER.NXE=1 when shadow paging is active")
      Fixes: b8e8c830 ("kvm: mmu: ITLB_MULTIHIT mitigation")
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Reviewed-by: default avatarJim Mattson <jmattson@google.com>
      Message-Id: <20210615164535.2146172-3-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b26a71a1
    • Sean Christopherson's avatar
      KVM: VMX: Refuse to load kvm_intel if EPT and NX are disabled · 23f079c2
      Sean Christopherson authored
      Refuse to load KVM if NX support is not available and EPT is not enabled.
      Shadow paging has assumed NX support since commit 9167ab79 ("KVM:
      vmx, svm: always run with EFER.NXE=1 when shadow paging is active"), so
      for all intents and purposes this has been a de facto requirement for
      over a year.
      
      Do not require NX support if EPT is enabled purely because Intel CPUs let
      firmware disable NX support via MSR_IA32_MISC_ENABLES.  If not for that,
      VMX (and KVM as a whole) could require NX support with minimal risk to
      breaking userspace.
      
      Fixes: 9167ab79 ("KVM: vmx, svm: always run with EFER.NXE=1 when shadow paging is active")
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Reviewed-by: default avatarJim Mattson <jmattson@google.com>
      Message-Id: <20210615164535.2146172-2-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      23f079c2
  2. 17 Jun, 2021 38 commits