Re: [PATCH 10/16] KVM: x86/tdp_mmu: Support TDX private mapping for TDP MMU
From: Paolo Bonzini
Date: Tue May 28 2024 - 13:48:05 EST
On Tue, May 28, 2024 at 6:27 PM Edgecombe, Rick P
<rick.p.edgecombe@xxxxxxxxx> wrote:
> > I don't see benefit of x86_ops.max_gfn() compared to kvm->arch.max_gfn.
> > But I don't have strong preference. Either way will work.
>
> The non-TDX VM's won't need per-VM data, right? So it's just unneeded extra
> state per-vm.
It's just a cached value like there are many in the MMU. It's easier
for me to read code without the mental overhead of a function call.
> For TDX it will be based on the shared bit, so we actually already have the per-
> vm data we need. So we don't even need both gfn_shared_mask and max_gfn for TDX.
But they are independent, for example AMD placed the encryption bit
highest, then the reduced physical address space bits, then finally
the rest of the gfn. I think it's consistent with the kvm_has_*
approach, to not assume much and just store separate data.
Paolo