Re: [PATCH v7 12/22] x86/virt/tdx: Reset software states during TDX module shutdown

Edgecombe, Rick P
2026-04-11T01:56:57Z

On Tue, 2026-03-31 at 05:41 -0700, Chao Gao wrote:
> The TDX module requires a one-time global initialization (TDH.SYS.INIT) and
> per-CPU initialization (TDH.SYS.LP.INIT) before use. These initializations
> are guarded by software flags to prevent repetition.
>
> After TDX module updates, the new TDX module requires the same global and
> per-CPU initializations, but the existing software flags prevent
> re-initialization.
>
> Reset all software flags guarding the initialization flows to allow the
> global and per-CPU initializations to be triggered again after updates.
>
> Set tdx_module_status to ERROR to indicate the module is unavailable. This
> is to prevent re-initialization/tdx_sysinfo reporting on a failed update.
> Using ERROR instead of UNINITIALIZED as the latter implicitly depends on
> get_tdx_sys_info() failing early to prevent re-init after successful
> shutdown followed by failed update.
>
> Signed-off-by: Chao Gao <chao.gao@intel.com>
> Reviewed-by: Tony Lindgren <tony.lindgren@linux.intel.com>
> Reviewed-by: Kai Huang <kai.huang@intel.com>

Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>

The existing code around sysinit_done/ret is very strange to me. It makes this
patch seem a bit strained, but that is not it's fault.