]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: SVM: Refuse to load kvm_amd if NX support is not available
authorSean Christopherson <seanjc@google.com>
Tue, 15 Jun 2021 16:45:33 +0000 (09:45 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 18 Jun 2021 10:24:49 +0000 (06:24 -0400)
commit2e3dfe7a60066b864c6e83f48fb19a23cd9fec46
treecd6d6ca03ce6e6b92e9b608a5a4fc61fd7f859ef
parentb122dcce1b66a5d2cf32c52657b3241550fe346f
KVM: SVM: Refuse to load kvm_amd if NX support is not available

Refuse to load KVM if NX support is not available.  Shadow paging has
assumed NX support since commit e4549f5d84d0 ("KVM: vmx, svm: always run
with EFER.NXE=1 when shadow paging is active"), and NPT has assumed NX
support since commit e1f01549e95e ("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: e4549f5d84d0 ("KVM: vmx, svm: always run with EFER.NXE=1 when shadow paging is active")
Fixes: e1f01549e95e ("kvm: mmu: ITLB_MULTIHIT mitigation")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Message-Id: <20210615164535.2146172-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/svm.c