Re: [PATCH v3 1/3] KVM: x86/mmu: Use KVM's max TDP level to determine need for 32-bit TDP root
From: Sean Christopherson
Date: Wed Sep 16 2026 - 20:12:19 EST
On Mon, Sep 14, 2026, Yan Zhao wrote:
> On a separate note, though it shouldn't be a real issue, is the below change
> necessary?
I would say this is technically correct, but unnecessary, because I can't imagine
any 32-bit guest firmware would try to relocate BARs above 4G.
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index bb68a021cfaf..abbba26dbdc6 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -1810,7 +1810,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
> phys_as = entry->eax & 0xff;
> g_phys_as = phys_as;
> if (kvm_mmu_get_max_tdp_level() < 5)
> - g_phys_as = min(g_phys_as, 48U);
> + g_phys_as = min(g_phys_as, kvm_mmu_get_max_tdp_level() == 3 ? 32U : 48U);
FWIW, if we wanted to do this, my vote would be for:
if (kvm_mmu_get_max_tdp_level() < 4)
g_phys_as = min(g_phys_as, 32U);
else if (kvm_mmu_get_max_tdp_level() < 5)
g_phys_as = min(g_phys_as, 48U);
but I think I'd prefer to just leave this be. Rr better, drop 32-bit kVM support :-D