Re: [PATCH v4 01/24] x86/virt/tdx: Move low level SEAMCALL helpers out of <asm/tdx.h>

From: Chao Gao

Date: Mon Mar 02 2026 - 07:27:25 EST


>-static __always_inline u64 sc_retry(sc_func_t func, u64 fn,
>- struct tdx_module_args *args)
>-{
>- int retry = RDRAND_RETRY_LOOPS;
>- u64 ret;
>-
>- do {
>- preempt_disable();
>- ret = __seamcall_dirty_cache(func, fn, args);
>- preempt_enable();

...

>- } while (ret == TDX_RND_NO_ENTROPY && --retry);
>-
>- return ret;
>-}
>-

<snip>

>+
>+static __always_inline u64 sc_retry(sc_func_t func, u64 fn,
>+ struct tdx_module_args *args)
>+{
>+ int retry = RDRAND_RETRY_LOOPS;
>+ u64 ret;
>+
>+ do {
>+ ret = func(fn, args);

Here should be:

preempt_disable();
ret = __seamcall_dirty_cache(func, fn, args);
preempt_enable();

This looks like a bug I introduced when resolving conflicts with

commit 10df8607bf1a ("x86/virt/tdx: Mark memory cache state incoherent when making SEAMCALL")

Sorry for this issue. I will fix it in the next version.


>+ } while (ret == TDX_RND_NO_ENTROPY && --retry);
>+
>+ return ret;
>+}