It is useful to print the TDX module version 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].
Include the version in the log messages during init, e.g.:
virt/tdx: TDX module version: 1.5.24
virt/tdx: 1034220 KB allocated for PAMT
virt/tdx: module initialized
..followed by remaining TDX initialization messages (or errors).
Print the version 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 <kai.huang@intel.com> [2]
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Reviewed-by: Chao Gao <chao.gao@intel.com>
Cc: Chao Gao <chao.gao@intel.com>
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: Kai Huang <kai.huang@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
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]
---
arch/x86/virt/vmx/tdx/tdx.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index 5ce4ebe99774..fba00ddc11f1 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -1084,6 +1084,11 @@ static int init_tdx_module(void)
if (ret)
return ret;
+ pr_info("Module version: %u.%u.%02u\n",
+ tdx_sysinfo.version.major_version,
+ tdx_sysinfo.version.minor_version,
+ tdx_sysinfo.version.update_version);
+
/* Check whether the kernel can support this module */
ret = check_features(&tdx_sysinfo);
if (ret)
--
2.52.0
On Wed, 2026-01-07 at 17:31 -0700, Vishal Verma wrote:
> It is useful to print the TDX module version 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.
>
It is more then a spot check, it's the only way to know which version is loaded.
> This was also requested in [1].
>
> Include the version in the log messages during init, e.g.:
>
> virt/tdx: TDX module version: 1.5.24
> virt/tdx: 1034220 KB allocated for PAMT
> virt/tdx: module initialized
>
> ..followed by remaining TDX initialization messages (or errors).
The TDX initialization errors would be before "module initialized", right?
>
> Print the version 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 <kai.huang@intel.com> [2]
>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> Reviewed-by: Chao Gao <chao.gao@intel.com>
> Cc: Chao Gao <chao.gao@intel.com>
> Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
> Cc: Kai Huang <kai.huang@intel.com>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> 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]
> ---
> arch/x86/virt/vmx/tdx/tdx.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> index 5ce4ebe99774..fba00ddc11f1 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.c
> +++ b/arch/x86/virt/vmx/tdx/tdx.c
> @@ -1084,6 +1084,11 @@ static int init_tdx_module(void)
> if (ret)
> return ret;
>
> + pr_info("Module version: %u.%u.%02u\n",
> + tdx_sysinfo.version.major_version,
> + tdx_sysinfo.version.minor_version,
> + tdx_sysinfo.version.update_version);
> +
> /* Check whether the kernel can support this module */
> ret = check_features(&tdx_sysinfo);
> if (ret)
>
On Thu, 2026-01-08 at 20:24 +0000, Edgecombe, Rick P wrote: > On Wed, 2026-01-07 at 17:31 -0700, Vishal Verma wrote: > > It is useful to print the TDX module version 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. > > > > It is more then a spot check, it's the only way to know which version is loaded. I'll update to: It is useful to print the TDX module version in dmesg logs. This is currently the only way to determine the module version from the host. It also creates a record for... > > > This was also requested in [1]. > > > > Include the version in the log messages during init, e.g.: > > > > virt/tdx: TDX module version: 1.5.24 > > virt/tdx: 1034220 KB allocated for PAMT > > virt/tdx: module initialized > > > > ..followed by remaining TDX initialization messages (or errors). > > The TDX initialization errors would be before "module initialized", right? Yep, I think this whole line can just be removed to avoid confusion.
On Wed, Jan 07, 2026 at 05:31:29PM -0700, Vishal Verma wrote: > It is useful to print the TDX module version 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]. > > Include the version in the log messages during init, e.g.: > > virt/tdx: TDX module version: 1.5.24 > virt/tdx: 1034220 KB allocated for PAMT > virt/tdx: module initialized > > ..followed by remaining TDX initialization messages (or errors). > > Print the version early in init_tdx_module(), right after the global > metadata is read, which makes it available even if there are subsequent > initialization failures. One thing to note that if metadata read fails, we will not get there. The daisy chaining we use for metadata read makes it fragile. Some metadata fields are version/feature dependant, like you can see in DPAMT case. It can be useful to dump version information, even if get_tdx_sys_info() fails. Version info is likely to be valid on failure. -- Kiryl Shutsemau / Kirill A. Shutemov
On Thu, 2026-01-08 at 10:50 +0000, Kiryl Shutsemau wrote:
> On Wed, Jan 07, 2026 at 05:31:29PM -0700, Vishal Verma wrote:
> > It is useful to print the TDX module version 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].
> >
> > Include the version in the log messages during init, e.g.:
> >
> > virt/tdx: TDX module version: 1.5.24
> > virt/tdx: 1034220 KB allocated for PAMT
> > virt/tdx: module initialized
> >
> > ..followed by remaining TDX initialization messages (or errors).
> >
> > Print the version early in init_tdx_module(), right after the global
> > metadata is read, which makes it available even if there are subsequent
> > initialization failures.
>
> One thing to note that if metadata read fails, we will not get there.
>
> The daisy chaining we use for metadata read makes it fragile. Some
> metadata fields are version/feature dependant, like you can see in DPAMT
> case.
>
> It can be useful to dump version information, even if get_tdx_sys_info()
> fails. Version info is likely to be valid on failure.
Good point, maybe something like this to print it as soon as it is
retrieved?
---3<---
diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index fba00ddc11f1..5ce4ebe99774 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -1084,11 +1084,6 @@ static int init_tdx_module(void)
if (ret)
return ret;
- pr_info("Module version: %u.%u.%02u\n",
- tdx_sysinfo.version.major_version,
- tdx_sysinfo.version.minor_version,
- tdx_sysinfo.version.update_version);
-
/* Check whether the kernel can support this module */
ret = check_features(&tdx_sysinfo);
if (ret)
diff --git a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
index 0454124803f3..4c9917a9c2c3 100644
--- a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
+++ b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
@@ -105,6 +105,12 @@ static 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: %u.%u.%02u\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);
On 1/8/26 10:39, Verma, Vishal L wrote:
> ret = ret ?: get_tdx_sys_info_version(&sysinfo->version);
> +
> + pr_info("Module version: %u.%u.%02u\n",
> + sysinfo->version.major_version,
> + sysinfo->version.minor_version,
> + sysinfo->version.update_version);
This is wonky, but it's also fine.
If we can't even get the module version, we have pretty big problems on
our hands Seeing "Module version: 0.0.00" is a nice indication. It'll
almost certainly be followed by a bunch of other nasty messages, so one
wonky message before them will be a drop in the bucket.
On Thu, 2026-01-08 at 18:39 +0000, Verma, Vishal L wrote:
> > It can be useful to dump version information, even if get_tdx_sys_info()
> > fails. Version info is likely to be valid on failure.
>
> Good point, maybe something like this to print it as soon as it is
> retrieved?
>
> ---3<---
>
> diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> index fba00ddc11f1..5ce4ebe99774 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.c
> +++ b/arch/x86/virt/vmx/tdx/tdx.c
> @@ -1084,11 +1084,6 @@ static int init_tdx_module(void)
> if (ret)
> return ret;
>
> - pr_info("Module version: %u.%u.%02u\n",
> - tdx_sysinfo.version.major_version,
> - tdx_sysinfo.version.minor_version,
> - tdx_sysinfo.version.update_version);
> -
> /* Check whether the kernel can support this module */
> ret = check_features(&tdx_sysinfo);
> if (ret)
> diff --git a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
> b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
> index 0454124803f3..4c9917a9c2c3 100644
> --- a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
> +++ b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
> @@ -105,6 +105,12 @@ static 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: %u.%u.%02u\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);
It's awkward because it doesn't check if get_tdx_sys_info_version() fails, even
the though the rest of the code handles this case. I'd just leave it. Let's keep
this as simple as possible, because anything here will be a huge upgrade.
On Thu, 2026-01-08 at 20:20 +0000, Edgecombe, Rick P wrote:
> On Thu, 2026-01-08 at 18:39 +0000, Verma, Vishal L wrote:
> > > It can be useful to dump version information, even if get_tdx_sys_info()
> > > fails. Version info is likely to be valid on failure.
> >
> > Good point, maybe something like this to print it as soon as it is
> > retrieved?
> >
> > ---3<---
> >
> > diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> > index fba00ddc11f1..5ce4ebe99774 100644
> > --- a/arch/x86/virt/vmx/tdx/tdx.c
> > +++ b/arch/x86/virt/vmx/tdx/tdx.c
> > @@ -1084,11 +1084,6 @@ static int init_tdx_module(void)
> > if (ret)
> > return ret;
> >
> > - pr_info("Module version: %u.%u.%02u\n",
> > - tdx_sysinfo.version.major_version,
> > - tdx_sysinfo.version.minor_version,
> > - tdx_sysinfo.version.update_version);
> > -
> > /* Check whether the kernel can support this module */
> > ret = check_features(&tdx_sysinfo);
> > if (ret)
> > diff --git a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
> > b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
> > index 0454124803f3..4c9917a9c2c3 100644
> > --- a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
> > +++ b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
> > @@ -105,6 +105,12 @@ static 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: %u.%u.%02u\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);
>
> It's awkward because it doesn't check if get_tdx_sys_info_version() fails, even
> the though the rest of the code handles this case. I'd just leave it. Let's keep
> this as simple as possible, because anything here will be a huge upgrade.
I considered gating it on 'ret', but making it unconditional also
provides us an indirect hint as to which field failed to retrieve.
Do you mean leave it as in stick to printing only after
get_tdx_sys_info()?
© 2016 - 2026 Red Hat, Inc.