KVM: x86: Don't advertise guest.MAXPHYADDR as host.MAXPHYADDR in CPUID
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 13 Mar 2024 12:58:42 +0000 (13:58 +0100)
committerSean Christopherson <seanjc@google.com>
Tue, 9 Apr 2024 19:18:22 +0000 (12:18 -0700)
commit6f5c9600621b4efb5c61b482d767432eb1ad3a9c
treebae3a5ec39af8bee26f7e0d3d6d20eac527176de
parentfec50db7033ea478773b159e0e2efb135270e3b7
KVM: x86: Don't advertise guest.MAXPHYADDR as host.MAXPHYADDR in CPUID

Drop KVM's propagation of GuestPhysBits (CPUID leaf 80000008, EAX[23:16])
to HostPhysBits (same leaf, EAX[7:0]) when advertising the address widths
to userspace via KVM_GET_SUPPORTED_CPUID.

Per AMD, GuestPhysBits is intended for software use, and physical CPUs do
not set that field.  I.e. GuestPhysBits will be non-zero if and only if
KVM is running as a nested hypervisor, and in that case, GuestPhysBits is
NOT guaranteed to capture the CPU's effective MAXPHYADDR when running with
TDP enabled.

E.g. KVM will soon use GuestPhysBits to communicate the CPU's maximum
*addressable* guest physical address, which would result in KVM under-
reporting PhysBits when running as an L1 on a CPU with MAXPHYADDR=52,
but without 5-level paging.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: stable@vger.kernel.org
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20240313125844.912415-2-kraxel@redhat.com
[sean: rewrite changelog with --verbose, Cc stable@]
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/cpuid.c