Re: [PATCH v2 06/17] x86/virt/tdx: Re-initialize the extensions on runtime TDX module update
"Edgecombe, Rick P" <[email protected]> Mon, 27 Jul 2026 18:36:58 +0000
| Newsgroups | dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Chao,
On Thu, 2026-06-18 at 16:13 +0800, Xu Yilun wrote:
> +static int update_tdx_module_extensions(void)
> +{
> + struct tdx_sys_info_ext sysinfo_ext;
> + int ret;
> +
> + if (!(tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_EXT))
> + return 0;
> +
> + ret = get_tdx_sys_info_ext(&sysinfo_ext);
> + if (ret)
> + return ret;
> +
> + if (!sysinfo_ext.ext_required)
> + return 0;
> +
> + if (sysinfo_ext.memory_pool_required_pages)
> + return -EFAULT;
> +
> + return tdx_ext_init();
> +}
> +
These update and init functions are looking very similar, any idea how the could
be combined?
static __init int init_tdx_module_extensions(void)
{
struct tdx_sys_info_ext sysinfo_ext;
int ret;
if (!(tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_EXT))
return 0;
ret = get_tdx_sys_info_ext(&sysinfo_ext);
if (ret)
return ret;
/* Skip if no feature requires TDX module extensions. */
if (!sysinfo_ext.ext_required)
return 0;
ret = tdx_ext_mem_setup(sysinfo_ext.memory_pool_required_pages);
if (ret)
return ret;
return tdx_ext_init();
}