Re: [PATCH v10 03/25] x86/virt/tdx: Consolidate TDX global initialization states
From: Kiryl Shutsemau
Date: Wed May 27 2026 - 06:57:24 EST
On Wed, May 20, 2026 at 06:38:06AM -0700, Chao Gao wrote:
> The kernel uses several global flags to guard one-time TDX initialization
> flows and prevent them from being repeated.
>
> When the TDX module is updated, all of those states must be reset so that
> the module can be initialized again. Today those states are kept as
> separate global variables, which makes the reset path awkward and easy to
> miss when a new state is added.
>
> Group the states into a single structure so they can be reset together, for
> example with memset(), and so a newly added state won't be missed.
>
> Drop the __ro_after_init annotation from tdx_module_initialized because
> the other two states do not have it. And with TDX module update support,
> all the states need to be writable at runtime.
You still can use __read_mostly.
> Signed-off-by: Chao Gao <chao.gao@xxxxxxxxx>
Reviewed-by: Kiryl Shutsemau <kas@xxxxxxxxxx>
--
Kiryl Shutsemau / Kirill A. Shutemov