From: Dave Hansen With all metadata classes converted, the only thing left in the auto-generated tdx_global_metadata.c is get_tdx_sys_info(). Move it into tdx.c so that the auto-generated file can be deleted, along with the unusual `#include "tdx_global_metadata.c"`. No functional change intended. Assisted-by: Claude:claude-opus-5 Not-yet-signed-off-by: Dave Hansen Signed-off-by: Chao Gao --- arch/x86/virt/vmx/tdx/tdx.c | 19 ++++++++++++++- arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 27 --------------------- 2 files changed, 18 insertions(+), 28 deletions(-) delete mode 100644 arch/x86/virt/vmx/tdx/tdx_global_metadata.c diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c index 98534e702144..1b8cd7656f36 100644 --- a/arch/x86/virt/vmx/tdx/tdx.c +++ b/arch/x86/virt/vmx/tdx/tdx.c @@ -527,7 +527,24 @@ static __init int get_tdx_sys_info_td_conf(struct tdx_sys_info_td_conf *td_conf) return 0; } -#include "tdx_global_metadata.c" +static __init int get_tdx_sys_info(struct tdx_sys_info *sysinfo) +{ + int ret = 0; + + ret = ret ?: get_tdx_sys_info_version(&sysinfo->version); + + pr_info("Module version: " TDX_VERSION_FMT "\n", + sysinfo->version.major_version, + sysinfo->version.minor_version, + sysinfo->version.update_version); + + ret = ret ?: get_tdx_sys_info_features(&sysinfo->features); + ret = ret ?: get_tdx_sys_info_tdmr(&sysinfo->tdmr); + ret = ret ?: get_tdx_sys_info_td_ctrl(&sysinfo->td_ctrl); + ret = ret ?: get_tdx_sys_info_td_conf(&sysinfo->td_conf); + + return ret; +} static __init int check_features(struct tdx_sys_info *sysinfo) { diff --git a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c deleted file mode 100644 index 4d673cac0976..000000000000 --- a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Automatically generated functions to read TDX global metadata. - * - * This file doesn't compile on its own as it lacks of inclusion - * of SEAMCALL wrapper primitive which reads global metadata. - * Include this file to other C file instead. - */ - -static __init int get_tdx_sys_info(struct tdx_sys_info *sysinfo) -{ - int ret = 0; - - ret = ret ?: get_tdx_sys_info_version(&sysinfo->version); - - pr_info("Module version: " TDX_VERSION_FMT "\n", - sysinfo->version.major_version, - sysinfo->version.minor_version, - sysinfo->version.update_version); - - ret = ret ?: get_tdx_sys_info_features(&sysinfo->features); - ret = ret ?: get_tdx_sys_info_tdmr(&sysinfo->tdmr); - ret = ret ?: get_tdx_sys_info_td_ctrl(&sysinfo->td_ctrl); - ret = ret ?: get_tdx_sys_info_td_conf(&sysinfo->td_conf); - - return ret; -} -- 2.52.0