From: Vishal Verma Alongside exposing the TDX Module version via sysfs, it is useful to have a record of it in dmesg logs. This allows for a quick spot check for whether the correct/expected TDX module is being loaded, and also creates a record for any future problems being investigated. This was also requested in [1]. The log message will look like: virt/tdx: TDX-Module version: 1.5.24 Print this early in init_tdx_module(), right after the global metadata is read, which makes it available even if there are subsequent initialization failures. Based on a patch by Kai Huang [2] [ Chao: s/TDX module/TDX-Module in the log message tag print_module_version() as __init ] Signed-off-by: Vishal Verma Signed-off-by: Chao Gao Cc: Rick Edgecombe Cc: Kai Huang Link: https://lore.kernel.org/all/CAGtprH8eXwi-TcH2+-Fo5YdbEwGmgLBh9ggcDvd6N=bsKEJ_WQ@mail.gmail.com/ # [1] Link: https://lore.kernel.org/all/6b5553756f56a8e3222bfc36d0bdb3e5192137b7.1731318868.git.kai.huang@intel.com # [2] --- v2 - new arch/x86/virt/vmx/tdx/tdx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c index ef77135ec373..3282dce5003b 100644 --- a/arch/x86/virt/vmx/tdx/tdx.c +++ b/arch/x86/virt/vmx/tdx/tdx.c @@ -352,6 +352,13 @@ static __init int read_sys_metadata_field(u64 field_id, u64 *data) #include "tdx_global_metadata.c" +static __init void print_module_version(struct tdx_sys_info_version *version) +{ + pr_info("TDX-Module version: %u.%u.%02u\n", + version->major_version, version->minor_version, + version->update_version); +} + static __init int check_features(struct tdx_sys_info *sysinfo) { u64 tdx_features0 = sysinfo->features.tdx_features0; @@ -1158,6 +1165,8 @@ static __init int init_tdx_module(void) if (ret) return ret; + print_module_version(&tdx_sysinfo.version); + /* Check whether the kernel can support this module */ ret = check_features(&tdx_sysinfo); if (ret) -- 2.47.3