Re: [PATCH 02/15] x86/virt/tdx: Add extra memory to TDX Module for Extensions
From: Xiaoyao Li
Date: Wed May 27 2026 - 04:18:55 EST
On 5/27/2026 3:32 PM, Xu Yilun wrote:
On Wed, May 27, 2026 at 02:38:27PM +0800, Xiaoyao Li wrote:
On 5/27/2026 11:47 AM, Xu Yilun wrote:
+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.
Because we want/need to flush page as late as possible so that the page
flush needs to happen right before SEAMCALL?
I think so. Let the flushing be part of the tdh call semantic.
How about we pass in the struct page * and number into tdx_ext_mem_add() and
construct the root page inside it?
I assume you don't suggest allocate root page inside the call, then we
need 3 parameters for the HPA_LIST_INFO:
struct page *, unsigned int nr_pages, struct page *root
which I think too much.
yeah, sort of.
I think your concern is to try not to introduce another tdx_clflush_
variant, but I believe this will happen, pfn based memory description is
on the way:
https://lore.kernel.org/all/20260430014929.24210-1-yan.y.zhao@xxxxxxxxx/
I don't object the variant of tdx_clflush_hpa_list(), but suggest if tdx_clflush_page() can be used instead of raw clflush_cache_range()
Maybe we can try to put tdx_clflush_hpa_list() along with tdx_clflush_page() and tdx_clflush_pfn()? This way, I think we can save the separate comment.