]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
KVM: x86: Use kernel's x86_phys_bits to handle reduced MAXPHYADDR
authorSean Christopherson <seanjc@google.com>
Wed, 23 Jun 2021 23:05:47 +0000 (16:05 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 14 Jul 2021 16:17:55 +0000 (12:17 -0400)
commite39f00f60ebd2e7b295c37a05e6349df656d3eb8
treecf1086cced8615763f9a05f2adc20682afe42f67
parent4bf48e3c0aafd32b960d341c4925b48f416f14a5
KVM: x86: Use kernel's x86_phys_bits to handle reduced MAXPHYADDR

Use boot_cpu_data.x86_phys_bits instead of the raw CPUID information to
enumerate the MAXPHYADDR for KVM guests when TDP is disabled (the guest
version is only relevant to NPT/TDP).

When using shadow paging, any reductions to the host's MAXPHYADDR apply
to KVM and its guests as well, i.e. using the raw CPUID info will cause
KVM to misreport the number of PA bits available to the guest.

Unconditionally zero out the "Physical Address bit reduction" entry.
For !TDP, the adjustment is already done, and for TDP enumerating the
host's reduction is wrong as the reduction does not apply to GPAs.

Fixes: 9af9b94068fb ("x86/cpu/AMD: Handle SME reduction in physical address size")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210623230552.4027702-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c