]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/virt/tdx: Consolidate TDX global initialization states
authorChao Gao <chao.gao@intel.com>
Wed, 20 May 2026 22:28:48 +0000 (15:28 -0700)
committerDave Hansen <dave.hansen@linux.intel.com>
Wed, 3 Jun 2026 15:14:51 +0000 (08:14 -0700)
commit451735bf90bfb294bb542cb2fa39ed01822aab86
tree75a906c2fcbef2d80254055c1feff8010ffdfcec
parent9c0c68708dc48e8ae4f9043c96b387a0173361f1
x86/virt/tdx: Consolidate TDX global initialization states

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.

Signed-off-by: Chao Gao <chao.gao@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://patch.msgid.link/20260520133909.409394-4-chao.gao@intel.com
arch/x86/virt/vmx/tdx/tdx.c