KVM: VMX: Ignore MKTME KeyID bits when intercepting #PF for allow_smaller_maxphyaddr
Use the raw/true host.MAXPHYADDR when deciding whether or not KVM must intercept #PFs when allow_smaller_maxphyaddr is enabled, as any adjustments the kernel makes to boot_cpu_data.x86_phys_bits to account for MKTME KeyID bits do not apply to the guest physical address space. I.e. the KeyID are off-limits for host physical addresses, but are not reserved for GPAs as far as hardware is concerned. Signed-off-by: Tao Su <tao1.su@linux.intel.com> Link: https://lore.kernel.org/r/20240319031111.495006-1-tao1.su@linux.intel.com [sean: massage changelog] Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
449c0811d8
commit
7f2817ef52
@ -15,6 +15,7 @@
|
|||||||
#include "vmx_ops.h"
|
#include "vmx_ops.h"
|
||||||
#include "../cpuid.h"
|
#include "../cpuid.h"
|
||||||
#include "run_flags.h"
|
#include "run_flags.h"
|
||||||
|
#include "../mmu.h"
|
||||||
|
|
||||||
#define MSR_TYPE_R 1
|
#define MSR_TYPE_R 1
|
||||||
#define MSR_TYPE_W 2
|
#define MSR_TYPE_W 2
|
||||||
@ -719,7 +720,8 @@ static inline bool vmx_need_pf_intercept(struct kvm_vcpu *vcpu)
|
|||||||
if (!enable_ept)
|
if (!enable_ept)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return allow_smaller_maxphyaddr && cpuid_maxphyaddr(vcpu) < boot_cpu_data.x86_phys_bits;
|
return allow_smaller_maxphyaddr &&
|
||||||
|
cpuid_maxphyaddr(vcpu) < kvm_get_shadow_phys_bits();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool is_unrestricted_guest(struct kvm_vcpu *vcpu)
|
static inline bool is_unrestricted_guest(struct kvm_vcpu *vcpu)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user