KVM: x86: Use guest MAXPHYADDR from CPUID.0x8000_0008 iff TDP is enabled
authorSean Christopherson <seanjc@google.com>
Wed, 23 Jun 2021 23:05:46 +0000 (16:05 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 14 Jul 2021 16:17:55 +0000 (12:17 -0400)
commit4bf48e3c0aafd32b960d341c4925b48f416f14a5
tree6c1f5b8a0fcb3b124cefd2b9c4ca74d64ff2e09a
parentf0414b078dd11641a7a64027c2741396f47718fd
KVM: x86: Use guest MAXPHYADDR from CPUID.0x8000_0008 iff TDP is enabled

Ignore the guest MAXPHYADDR reported by CPUID.0x8000_0008 if TDP, i.e.
NPT, is disabled, and instead use the host's MAXPHYADDR.  Per AMD'S APM:

  Maximum guest physical address size in bits. This number applies only
  to guests using nested paging. When this field is zero, refer to the
  PhysAddrSize field for the maximum guest physical address size.

Fixes: 24c82e576b78 ("KVM: Sanitize cpuid")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210623230552.4027702-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c