The CPU keeps track of TCB versions for each TDX Module that has been loaded. Since this tracking database has finite capacity, there's a maximum number of module updates that can be performed. After each successful update, the number reduces by one. Once it reaches zero, further updates will fail until next reboot. Before updating the TDX Module, ensure that the limit on TDX Module updates has not been exceeded to prevent update failures in a later phase where TDs have to be killed. Signed-off-by: Chao Gao Tested-by: Farrah Chen --- arch/x86/virt/vmx/tdx/seamldr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamldr.c index 88388aa0fb5f..d1d4f96c4963 100644 --- a/arch/x86/virt/vmx/tdx/seamldr.c +++ b/arch/x86/virt/vmx/tdx/seamldr.c @@ -83,6 +83,14 @@ EXPORT_SYMBOL_FOR_MODULES(seamldr_get_info, "tdx-host"); */ int seamldr_install_module(const u8 *data, u32 size) { + const struct seamldr_info *info = seamldr_get_info(); + + if (!info) + return -EIO; + + if (!info->num_remaining_updates) + return -ENOSPC; + if (!is_vmalloc_addr(data)) return -EINVAL; -- 2.47.3