Re: [PATCH v10 22/25] x86/virt/tdx: Reject updates during compatibility-sensitive operations

From: Chao Gao

Date: Thu May 21 2026 - 08:09:03 EST


>This function is pretty tidy. More or less:
>
> ret = get_tdx_sys_info_handoff(&handoff);
> if (ret)
> return
>
> args.foo = handoff.bar;
> ret = seamcall_prerr(TDH_SYS_SHUTDOWN, &args);
> if (ret)
> return
>
> memset(&tdx_module_state, 0, sizeof(tdx_module_state));
> for_each_possible_cpu(cpu)
> per_cpu(tdx_lp_initialized, cpu) = false;
>
>The logic's not bad, right? Get the handoff data, hand it off to
>something, then go set some fields.
>
>Then what does this patch do? It goes and globs a just huge blob of
>TDH_SYS_SHUTDOWN errata handling and implementation details right smack
>in the middle. Our tidy little function is no more.
>
>I really with this would trigger folks' gag reflexes. It's *SO* easy to
>fix. It's *so* easy to keep the code tidy and hide the dead bodies so
>that the logic can still be followed.

Apologies.

FWIW, we can add a tdh_sys_shutdown() helper and hide those details there.