Re: [PATCH v2 04/17] x86/virt/tdx: Add extra memory to TDX module for the extensions
From: Xu Yilun
Date: Tue Jun 30 2026 - 06:28:39 EST
> >+static __init int tdx_ext_mem_setup(unsigned int required_pages)
> >+{
> >+ struct tdx_hpa_list *hpa_list;
> >+ struct page *page;
> >+ unsigned int i;
> >+ int ret;
> >+
> >+ /*
> >+ * memory_pool_required_pages == 0 means no need to add pages,
> >+ * skip the memory setup.
> >+ */
>
> There is no "memory_pool_required_pages" here.
OK.
BTW, sashiko says the comment restates what the if-statement. So I
change to:
/*
* This required_pages comes from the metadata
* memory_pool_required_pages. TDX module uses it to indicate how much
* memory is still needed. This value decreases each time memory is
* added via TDH.EXT.MEM.ADD.
*
* On first time initialization, a value of 0 before any memory is
* added is unusual. But host makes no assumptions. Skip the memory
* setup and let subsequent steps catch any actual errors.
*/
>
> >+ if (!required_pages)
> >+ return 0;
Other comments are all good, included.