Re: [PATCH v4 03/17] KVM: TDX: Reset private huge pages after S-EPT page removal

From: Edgecombe, Rick P

Date: Tue Oct 06 2026 - 20:06:58 EST


On Mon, 2026-09-28 at 17:08 +0800, Yan Zhao wrote:
> "Resetting" TDX pages is a workaround for the TDX_PW_MCE erratum. Once a
> leaf SPTE can map to a huge page in the S-EPT, the entire huge physical
> range, rather than just the first 4KB, needs to be reset before the host
> can reuse it.

Code looks good and simple enough, but the log is a tiny bit rough. Probably add
about TDX_PW_MCE needing to reset any private memory in a special way, and make
it clearer that TDX huge pages will be enabled in upcoming changes. And is not
supported today (so this is not a bug fix).

>
> Signed-off-by: Yan Zhao <yan.y.zhao@xxxxxxxxx>
> ---
> arch/x86/kvm/vmx/tdx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index 410c149bf776..11792a490330 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -1865,7 +1865,7 @@ static int tdx_sept_remove_leaf_spte(struct kvm *kvm, gfn_t gfn,
> if (TDX_BUG_ON_2(err, TDH_MEM_PAGE_REMOVE, entry, level_state, kvm))
> return -EIO;
>
> - tdx_quirk_reset_paddr(PFN_PHYS(pfn), PAGE_SIZE);
> + tdx_quirk_reset_paddr(PFN_PHYS(pfn), KVM_HPAGE_SIZE(level));
> tdx_pamt_put(pfn, level);
> return 0;
> }