Re: [PATCH v4 08/17] KVM: TDX: Adjust the topup count of DPAMT page pairs for splitting S-EPT
From: Yan Zhao
Date: Fri Oct 09 2026 - 05:17:47 EST
On Thu, Oct 08, 2026 at 09:16:12AM +0800, Edgecombe, Rick P wrote:
> On Wed, 2026-10-07 at 15:47 -0700, Rick Edgecombe wrote:
> > Another idea, change the op to be:
> > int topup_external_cache(struct kvm_vcpu *vcpu, bool root, bool private_page,
> > int min_nr_spts);
> >
> > Normal topup can set:
> > root=true
> > private_page=true
> > min_nr_spts = PT64_ROOT_MAX_LEVEL - 1
> >
> > Then we can calculate exactly what we need. And even better, the existing code
> > won't nee a comment to explain the weirdness.
>
> Actually since this gets a struct kvm arg later in the series, maybe we could
> just have two ops. One for topping up from a fault and another for a split.
Hmm, no? That would make the min_nr_spts arg meaningless.
Reusing the topping up op for the fault also scales better, e.g., it could
support splitting under the fault path in the future.
Besides, I actually introduced a separate cache and op for split in v3,
https://lore.kernel.org/all/20260106102345.25261-1-yan.y.zhao@xxxxxxxxx.
Sean merged the cache/op for split with the cache/op for fault in
DPAMT+Hugepage v5.