Re: [PATCH v4 12/16] x86/virt/tdx: Add helpers to allow for pre-allocating pages
From: Binbin Wu
Date: Wed Nov 26 2025 - 21:38:42 EST
On 11/27/2025 6:33 AM, Edgecombe, Rick P wrote:
Oh, right!I'm not sure I follow. We need DPAMT backing for each S-EPT page table.static int tdx_topup_external_fault_cache(struct kvm_vcpu *vcpu, unsigned int cnt)Is the value PT64_ROOT_MAX_LEVEL intended, since dynamic PAMT pages are only
{
- struct vcpu_tdx *tdx = to_tdx(vcpu);
+ struct tdx_prealloc *prealloc = &to_tdx(vcpu)->prealloc;
+ int min_fault_cache_size;
- return kvm_mmu_topup_memory_cache(&tdx->mmu_external_spt_cache, cnt);
+ /* External page tables */
+ min_fault_cache_size = cnt;
+ /* Dynamic PAMT pages (if enabled) */
+ min_fault_cache_size += tdx_dpamt_entry_pages() * PT64_ROOT_MAX_LEVEL;
needed for 4KB level?
IIUIC, PT64_ROOT_MAX_LEVEL is actually
- PT64_ROOT_MAX_LEVEL - 1 for S-ETP pages since root page is not needed.
- 1 for TD private memory page
It's better to add a comment about it.