OSDN Git Service

kvm: x86/mmu: Use cpuid to determine max gfn
authorRick Edgecombe <rick.p.edgecombe@intel.com>
Thu, 3 Dec 2020 23:11:20 +0000 (15:11 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 4 Dec 2020 08:48:33 +0000 (03:48 -0500)
commit339f5a7fb2d6350fdb11f067da5240fd97e4f284
treedb7dc3f7df7eb0b880bb8ab711601c1d426b0c7c
parenta2b2d4bf5076832339762556b816eec58ca38f77
kvm: x86/mmu: Use cpuid to determine max gfn

In the TDP MMU, use shadow_phys_bits to dermine the maximum possible GFN
mapped in the guest for zapping operations. boot_cpu_data.x86_phys_bits
may be reduced in the case of HW features that steal HPA bits for other
purposes. However, this doesn't necessarily reduce GPA space that can be
accessed via TDP. So zap based on a maximum gfn calculated with MAXPHYADDR
retrieved from CPUID. This is already stored in shadow_phys_bits, so use
it instead of x86_phys_bits.

Fixes: faaf05b00aec ("kvm: x86/mmu: Support zapping SPTEs in the TDP MMU")
Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Message-Id: <20201203231120.27307-1-rick.p.edgecombe@intel.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/tdp_mmu.c