Re: [PATCH v2 1/2] x86/virt/tdx: Drop tdx_clflush_*()

From: Xu Yilun

Date: Tue Oct 20 2026 - 07:01:59 EST


On Thu, Oct 15, 2026 at 12:17:09PM -0700, Rick Edgecombe wrote:
> The TDX module exposes a bit (CLFLUSH_BEFORE_ALLOC) to say whether it
> requires certain types of memory to be flushed from the cache before being
> handed to the TDX module.
>
> During the initial TDX upstreaming, it was decided it would be simplest
> to just always flush rather than checking for the bit and having
> conditional logic. So based on the TDX docs:
> When allocating a memory page to be used as TD private memory or TD
> control structure page, the host VMM is required to ensure that none of
> the cache lines associated with the page is in a MODIFIED state.
>
> ...currently the kernel flushes before handing over private memory and TD
> control structure pages.
>
> The CLFLUSH_BEFORE_ALLOC bit has never been set by any TDX module, so this
> flushing has yet to be needed in practice. Going forward, the TDX docs will
> be updated to clarify that actually CLFLUSH_BEFORE_ALLOC will *never* be
> set in any future TDX module either.
>
> So make code even simpler by just deleting all the CLFLUSH_BEFORE_ALLOC
> handling.
>
> AI was used to review the change.
>
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>
> Reviewed-by: Yan Zhao <yan.y.zhao@xxxxxxxxx>
> Reviewed-by: Binbin Wu <binbin.wu@xxxxxxxxxxxxxxx>

Reviewed-by: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx>