Re: [PATCH v2 10/31] x86/virt/tdx: Add extra memory to TDX Module for Extensions

From: Huang, Kai

Date: Fri Apr 24 2026 - 05:11:27 EST


On Fri, 2026-04-24 at 08:09 +0000, Huang, Kai wrote:
> I believe we can use some smart hack to implement a common one to cover all
> cases above, but I am not sure whether it's worth to do (maybe we can have a try
> to see how does it look like, though, I think).

So the problem is use what as input when retry, and one way is to provide a
callback to allow the user to provide a specific function to update the 'args'
before retrying.

Something like below? I am not sure I like it though, because as Rick said
there's too much SEAMCALL wrapper/macros already.

typedef void (*args_update_func_t)(struct tdx_module_args *args,
struct tdx_module_args *ori);

static __always_inline u64 sc_retry_intr(sc_func_t func, u64 fn,
struct tdx_module_args *args,
args_update_func_t update_args)
{
struct tdx_module_args _args = *args;
u64 ret;

do {
ret = sc_retry(func, fn, &_args);

if (ret != TDX_INTERRUPT_RESUMABLE)
break;

update_args(&_args, args);
} while (1);

*args = _args;

return ret;
}

#define seamcall_ret_intr(_fn, _args, _args_update_f) \
sc_retry_intr(__seamcall_ret, (_fn), (_args), (_args_update_f))