Re: [PATCH v2 17/21] x86/virt/seamldr: Install a new TDX Module

From: Chao Gao

Date: Sun Jan 18 2026 - 19:28:47 EST


On Thu, Jan 15, 2026 at 02:15:31PM +0800, Xu Yilun wrote:
>> static int do_seamldr_install_module(void *params)
>> {
>> + struct tdx_module_args args = { .rcx = __pa(params) };
>
>Is it better we put the definition, or at least the value assignment in
>case TDP_CPU_INSTALL? This pattern always appears here for a seamcall
>wrapper but this function is far more complex than that.
>
>And the .rcx = __pa(params) also confuse me a bit. Better we name it
>e.g. seamldr_params which looks reasonable for seamcall arguments.

Sounds good. I will do the following changes:

diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamldr.c
index a0b59d6c53c9..f2933c7e3852 100644
--- a/arch/x86/virt/vmx/tdx/seamldr.c
+++ b/arch/x86/virt/vmx/tdx/seamldr.c
@@ -313,10 +313,10 @@ static void print_update_failure_message(void)
* See multi_cpu_stop() from where this multi-cpu state-machine was
* adopted, and the rationale for touch_nmi_watchdog()
*/
-static int do_seamldr_install_module(void *params)
+static int do_seamldr_install_module(void *seamldr_params)
{
- struct tdx_module_args args = { .rcx = __pa(params) };
enum tdp_state newstate, curstate = TDP_START;
+ struct tdx_module_args args = {};
int cpu = smp_processor_id();
bool primary;
int ret = 0;
@@ -336,6 +336,7 @@ static int do_seamldr_install_module(void *params)
ret = tdx_module_shutdown();
break;
case TDP_CPU_INSTALL:
+ args.rcx = __pa(seamldr_params);
scoped_guard(raw_spinlock, &seamldr_lock)
ret = seamldr_call(P_SEAMLDR_INSTALL, &args);
break;