Re: [PATCH 02/15] x86/virt/tdx: Add extra memory to TDX Module for Extensions
From: Xu Yilun
Date: Wed May 27 2026 - 00:11:43 EST
> > +static void tdx_clflush_hpa_list(struct page *root, unsigned int nr_pages)
> > +{
> > + u64 *entries = page_to_virt(root);
> > + int i;
> > +
> > + for (i = 0; i < nr_pages; i++)
> > + clflush_cache_range(__va(entries[i]), PAGE_SIZE);
>
> Is the page flush only needed when CLFLUSH_BEFORE_ALLOC is true?
>
> If so, it inherits the same decision to always flush as what
Yes it is basically the same as tdx_clflush_page().
> tdx_clflush_page() did. Then, any chance we can use tdx_clflush_page() here
But I don't think we should convert hpa/page/va back and forth just for
re-using one line of code.
> so that we have a single central place of the comment to explain the kernel
> design decision.
How about I add a comment here to connect this wrapper to
tdx_clflush_page():
/*
* Unconditionally flush the pages regardless of CLFLUSH_BEFORE_ALLOC. Inherit
* the same decision as tdx_clflush_page().
*/
static void tdx_clflush_hpa_list(struct page *root, unsigned int nr_pages)
...