]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: x86: Move shadow_phys_bits into "kvm_host", as "maxphyaddr"
authorSean Christopherson <seanjc@google.com>
Tue, 23 Apr 2024 22:15:21 +0000 (15:15 -0700)
committerSean Christopherson <seanjc@google.com>
Mon, 3 Jun 2024 15:58:55 +0000 (08:58 -0700)
commit82897db91215d57caefdfacfc2f5e3ef9cf31fe3
tree73d838c895f8058307995b7766586926d0bb8572
parentc043eaaa6be0858a9eb04a168cba84422369e026
KVM: x86: Move shadow_phys_bits into "kvm_host", as "maxphyaddr"

Move shadow_phys_bits into "struct kvm_host_values", i.e. into KVM's
global "kvm_host" variable, so that it is automatically exported for use
in vendor modules.  Rename the variable/field to maxphyaddr to more
clearly capture what value it holds, now that it's used outside of the
MMU (and because the "shadow" part is more than a bit misleading as the
variable is not at all unique to shadow paging).

Recomputing the raw/true host.MAXPHYADDR on every use can be subtly
expensive, e.g. it will incur a VM-Exit on the CPUID if KVM is running as
a nested hypervisor.  Vendor code already has access to the information,
e.g. by directly doing CPUID or by invoking kvm_get_shadow_phys_bits(), so
there's no tangible benefit to making it MMU-only.

Link: https://lore.kernel.org/r/20240423221521.2923759-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu.h
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/spte.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx.h
arch/x86/kvm/x86.h