Re: [PATCH 2/2] x86/virt/tdx: Drop tdh_phymem_page_wbinvd_*()
From: Xiaoyao Li
Date: Tue Sep 22 2026 - 22:21:37 EST
On 9/23/2026 4:52 AM, Rick Edgecombe wrote:
> In the early days of TDX it was expected that pages being reclaimed from
> the TDX module would need any cacheline from their private KeyID alias
> flushed. The TDX docs describe doing this in a couple cases, for example
> reclaiming the TDR memory:
> Flush MODIFIED cache lines: this is required to avoid corruption due to
> cache line aliasing. Note that all cache lines for all other TD pages
> must have been flushed before the TDR page was reclaimed.
>
> For a similar reasons as why the CLFLUSH_BEFORE_ALLOC features0 bit was
> never actually set in any TDX module, this flush of the private KeyID
> cachelines turned out to not be needed by the final TDX solution. However,
> the TDX docs were never updated to reflect that.
>
> Since private KeyID virtual mappings are reserved for TDX use, the TDX
> module has to do the clflush itself. The TDH.PHYMEM.PAGE.WBINVD SEAMCALL
> leaf was created for this purpose.
>
> So drop the kernel code that calls this SEAMCALL and the two helpers that
> facilitate it. With the removal of tdh_phymem_page_wbinvd_tdr(),
> tdx_global_keyid no longer needs to be kept around as a global variable.
> It just needs to be selected and provided to the TDX module during initial
> setup. However, don't churn the code to remove the global variable because
> it fits neatly with the other KeyID partitioning global data. It is also
> foreseeable that this would be used in the future for other SEAMCALLs that
> require the passing the global KeyID.
What about TDH.PHYMEM.CACHE.WB? Can it be dropped as well?