[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57eaa1b17429315f8b5207774307f3c1dd40cf37.1730118186.git.kai.huang@intel.com>
Date: Tue, 29 Oct 2024 01:41:12 +1300
From: Kai Huang <kai.huang@...el.com>
To: dave.hansen@...el.com,
kirill.shutemov@...ux.intel.com,
tglx@...utronix.de,
bp@...en8.de,
peterz@...radead.org,
mingo@...hat.com,
hpa@...or.com,
dan.j.williams@...el.com,
seanjc@...gle.com,
pbonzini@...hat.com
Cc: x86@...nel.org,
linux-kernel@...r.kernel.org,
kvm@...r.kernel.org,
rick.p.edgecombe@...el.com,
isaku.yamahata@...el.com,
adrian.hunter@...el.com,
nik.borisov@...e.com,
kai.huang@...el.com
Subject: [PATCH v6 10/10] x86/virt/tdx: Print TDX module version
Currently the kernel doesn't print any TDX module version information.
In practice such information is useful, especially to the developers.
For instance:
1) When something goes wrong around using TDX, the module version is
normally the first information the users want to know [1].
2) The users want to quickly know module version to see whether the
loaded module is the expected one.
Dump TDX module version. The actual dmesg will look like:
virt/tdx: module version: 1.5.00.00.0481 (build_date 20230323).
And dump right after reading global metadata, so that this information is
printed no matter whether module initialization fails or not.
Link: https://lore.kernel.org/lkml/4b3adb59-50ea-419e-ad02-e19e8ca20dee@intel.com/ [1]
Signed-off-by: Kai Huang <kai.huang@...el.com>
---
arch/x86/virt/vmx/tdx/tdx.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index 9bc827a6cee8..6982e100536d 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -312,6 +312,23 @@ static void print_cmrs(struct tdx_sys_info_cmr *sysinfo_cmr)
}
}
+static void print_module_version(struct tdx_sys_info_version *version)
+{
+ /*
+ * TDX module version encoding:
+ *
+ * <major>.<minor>.<update>.<internal>.<build_num>
+ *
+ * When printed as text, <major> and <minor> are 1-digit,
+ * <update> and <internal> are 2-digits and <build_num>
+ * is 4-digits.
+ */
+ pr_info("module version: %u.%u.%02u.%02u.%04u (build_date %u).\n",
+ version->major_version, version->minor_version,
+ version->update_version, version->internal_version,
+ version->build_num, version->build_date);
+}
+
static int init_tdx_sys_info(struct tdx_sys_info *sysinfo)
{
int ret;
@@ -322,6 +339,7 @@ static int init_tdx_sys_info(struct tdx_sys_info *sysinfo)
trim_null_tail_cmrs(&sysinfo->cmr);
print_cmrs(&sysinfo->cmr);
+ print_module_version(&sysinfo->version);
return 0;
}
--
2.46.2
Powered by blists - more mailing lists