x86/virt/tdx: Print TDX module version to dmesg
Subsystems (3)
v2 cover x86/virt/tdx: Print TDX module version to dmesg
=== Problem & Solution ===
Currently, there is neither an ABI, nor any other way to determine from the host system, what version of the TDX module is running. A sysfs ABI for this has been proposed in [1], but it may need additional discussion.
Many/most TDX developers already carry patches like this in their development branches. It can be tricky to know which TDX module is actually loaded on a system, and so this functionality has been needed regularly for development and processing bug reports. Hence, it is prudent to break out the patches to retrieve and print the TDX module version, as those parts are very straightforward, and get some level of debugability and traceability for TDX host systems.
=== Dependencies ===
None. This is based on v6.19-rc4, and applies cleanly to tip.git.
=== Patch details ===
Patch 1 is a prerequisite that adds the infrastructure to retrieve the TDX module version from its global metadata. This was originally posted in [2].
Patch 2 is based on a patch from Kai Huang [3], and prints the version to dmesg during init.
=== Testing ===
This has passed the usual suite of tests, including successful 0day builds, KVM Unit tests, KVM selftests, a TD creation smoke test, and selected KVM tests from the Avocado test suite.
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/
[3]: https://lore.kernel.org/all/57eaa1b17429315f8b5207774307f3c1dd40cf37.1730118186.git.kai.huang@intel.com/
---
Changes in v2:
- Collect review tags (Kiryl, Rick)
- Reword commit messages for clarity (Rick)
- Move the version print get_tdx_sys_info() (Kiryl, Dave)
- Link to v1: https://patch.msgid.link/[email protected]
---
Chao Gao (1):
x86/virt/tdx: Retrieve TDX module version
Vishal Verma (1):
x86/virt/tdx: Print TDX module version during init
arch/x86/include/asm/tdx_global_metadata.h | 7 +++++++ arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+)
---
base-commit: 9ace4753a5202b02191d54e9fdf7f9e3d02b85eb
change-id: 20260107-tdx_print_module_version-e4ca7edc2022
Best regards,
Signature · 1 line
Vishal Verma <[email protected]>
PATCH v2 1/2 x86/virt/tdx: Retrieve TDX module version
From: Chao Gao <[email protected]>
Each TDX module has several bits of metadata about which specific TDX module it is. The primary bit of info is the version, which has an x.y.z format. These represent the major version, minor version, and update version respectively. Knowing the running TDX Module version is valuable for bug reporting and debugging. Note that the module does expose other pieces of version-related metadata, such as build number and date. Those aren't retrieved for now, that can be added if needed in the future.
Retrieve the TDX Module version using the existing metadata reading interface. Later changes will expose this information. The metadata reading interfaces have existed for quite some time, so this will work with older versions of the TDX module as well - i.e. this isn't a new interface.
As a side note, the global metadata reading code was originally set up to be auto-generated from a JSON definition [1]. However, later [2] this was found to be unsustainable, and the autogeneration approach was dropped in favor of just manually adding fields as needed (e.g. as in this patch).
--- arch/x86/include/asm/tdx_global_metadata.h | 7 +++++++ arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+)
arch/x86/include/asm/tdx_global_metadata.h +7 -0
@@ -5,6 +5,12 @@#include <linux/types.h> +struct tdx_sys_info_version { +u16 minor_version; +u16 major_version; +u16 update_version; +}; +struct tdx_sys_info_features {u64 tdx_features0; };
@@ -35,6 +41,7 @@ struct tdx_sys_info_td_conf { };struct tdx_sys_info { +struct tdx_sys_info_version version;struct tdx_sys_info_features features;struct tdx_sys_info_tdmr tdmr;struct tdx_sys_info_td_ctrl td_ctrl;
arch/x86/virt/vmx/tdx/tdx_global_metadata.c +16 -0
@@ -7,6 +7,21 @@* Include this file to other C file instead. */ +static int get_tdx_sys_info_version (struct tdx_sys_info_version *sysinfo_version) +{ +int ret =0 ; +u64 val; + +if (!ret && !(ret =read_sys_metadata_field (0x0800000100000003 , &val))) + sysinfo_version->minor_version = val; +if (!ret && !(ret =read_sys_metadata_field (0x0800000100000004 , &val))) + sysinfo_version->major_version = val; +if (!ret && !(ret =read_sys_metadata_field (0x0800000100000005 , &val))) + sysinfo_version->update_version = val; + +return ret; +} +static int get_tdx_sys_info_features (struct tdx_sys_info_features *sysinfo_features) {int ret =0 ;
@@ -89,6 +104,7 @@ static int get_tdx_sys_info(struct tdx_sys_info *sysinfo) {int ret =0 ; + ret = ret ?:get_tdx_sys_info_version (&sysinfo->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);
Signature · 1 line
2.52.0
Re: [PATCH v2 1/2] x86/virt/tdx: Retrieve TDX module version
Quoted 22 lines · Vishal Verma
From: Chao Gao <[email protected]>
Each TDX module has several bits of metadata about which specific TDX module it is. The primary bit of info is the version, which has an x.y.z format. These represent the major version, minor version, and update version respectively. Knowing the running TDX Module version is valuable for bug reporting and debugging. Note that the module does expose other pieces of version-related metadata, such as build number and date. Those aren't retrieved for now, that can be added if needed in the future.
Retrieve the TDX Module version using the existing metadata reading interface. Later changes will expose this information. The metadata reading interfaces have existed for quite some time, so this will work with older versions of the TDX module as well - i.e. this isn't a new interface.
As a side note, the global metadata reading code was originally set up to be auto-generated from a JSON definition [1]. However, later [2] this was found to be unsustainable, and the autogeneration approach was dropped in favor of just manually adding fields as needed (e.g. as in this patch).
Quoted 10 lines
Signed-off-by Chao Gao <[email protected]>Link https://lore.kernel.org/kvm/CABgObfYXUxqQV_FoxKjC8U3t5DnyM45nz5DpTxYZv2x_uFK_Kw@mail.gmail.com/ # [1] open hereCc Rick Edgecombe <[email protected]>Cc Kai Huang <[email protected]>Cc Dave Hansen <[email protected]>Cc Dan Williams <[email protected]>Reviewed-by Kiryl Shutsemau <[email protected]>Reviewed-by Rick Edgecombe <[email protected]>Signed-off-by Vishal Verma <[email protected]>
Though one nit below,
Quoted 10 lines
--- arch/x86/include/asm/tdx_global_metadata.h | 7 +++++++ arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+)arch/x86/include/asm/tdx_global_metadata.h +0
-0
arch/x86/include/asm/tdx_global_metadata.h line 10
Quoted 6 lines
arch/x86/include/asm/tdx_global_metadata.h +3
-0@@ -5,6 +5,12 @@#include <linux/types.h> +struct tdx_sys_info_version { +u16 minor_version; +u16 major_version;
Nit, not sure if better to move major_version before minor_version.
and ...
arch/x86/include/asm/tdx_global_metadata.h
Quoted 11 lines
arch/x86/include/asm/tdx_global_metadata.h +11
-0+static int get_tdx_sys_info_version (struct tdx_sys_info_version *sysinfo_version) +{ +int ret =0 ; +u64 val; + +if (!ret && !(ret =read_sys_metadata_field (0x0800000100000003 , &val))) + sysinfo_version->minor_version = val; +if (!ret && !(ret =read_sys_metadata_field (0x0800000100000004 , &val))) + sysinfo_version->major_version = val; +if (!ret && !(ret =read_sys_metadata_field (0x0800000100000005 , &val))) + sysinfo_version->update_version = val;
... I know it's because minor_version has the least field ID among the three. But the order of the field IDs doesn't stand for the order of the reading. Reading the middle part y of x.y.z as first step looks a bit odd.
Re: [PATCH v2 1/2] x86/virt/tdx: Retrieve TDX module version
Quoted 3 lines · Xiaoyao Li
... I know it's because
minor_versionhas the least field ID among the three. But the order of the field IDs doesn't stand for the order of the reading. Reading the middle part y of x.y.z as first step looks a bit odd.
I wouldn't sweat it either way. Reading 4, 3, 5 would also look odd. I'm fine with it as-is in the patch.
Re: [PATCH v2 1/2] x86/virt/tdx: Retrieve TDX module version
Quoted 7 lines · Dave Hansen
Quoted 3 lines · Xiaoyao Li
... I know it's because
minor_versionhas the least field ID among the three. But the order of the field IDs doesn't stand for the order of the reading. Reading the middle part y of x.y.z as first step looks a bit odd.I wouldn't sweat it either way. Reading 4, 3, 5 would also look odd. I'm fine with it as-is in the patch.
I prefer 3, 4, 5. The field IDs are not human readable hex magic so should take extra care when copying from excel file to C file manually, A different list order would make the code adding & reviewing even harder.
Quoted 1 line
Re: [PATCH v2 1/2] x86/virt/tdx: Retrieve TDX module version
Quoted 6 lines · Xu Yilun
Quoted 5 lines · Dave Hansen
Quoted 3 lines · Xiaoyao Li
... I know it's because
minor_versionhas the least field ID among the three. But the order of the field IDs doesn't stand for the order of the reading. Reading the middle part y of x.y.z as first step looks a bit odd.
Quoted 7 lines
Quoted 2 lines
I wouldn't sweat it either way. Reading 4, 3, 5 would also look odd. I'm fine with it as-is in the patch.
I prefer 3, 4, 5. The field IDs are not human readable hex magic so should take extra care when copying from excel file to C file manually, A different list order would make the code adding & reviewing even harder.
I guess eventually we will introduce MACROs for these magic numbers to make the code more readable given that the decision is no longer auto-generate the code by the script? Though I'm not sure when that will happen.
Re: [PATCH v2 1/2] x86/virt/tdx: Retrieve TDX module version
In reply to Vishal VermaQuoted 16 lines · Vishal Verma
From: Chao Gao <[email protected]>
Each TDX module has several bits of metadata about which specific TDX module it is. The primary bit of info is the version, which has an x.y.z format. These represent the major version, minor version, and update version respectively. Knowing the running TDX Module version is valuable for bug reporting and debugging. Note that the module does expose other pieces of version-related metadata, such as build number and date. Those aren't retrieved for now, that can be added if needed in the future.
Retrieve the TDX Module version using the existing metadata reading interface. Later changes will expose this information. The metadata reading interfaces have existed for quite some time, so this will work with older versions of the TDX module as well - i.e. this isn't a new interface.
Quoted 5 lines
As a side note, the global metadata reading code was originally set up to be auto-generated from a JSON definition [1]. However, later [2] this was found to be unsustainable, and the autogeneration approach was dropped in favor of just manually adding fields as needed (e.g. as in this patch).
Quoted 76 lines
Signed-off-by Chao Gao <[email protected]>Link https://lore.kernel.org/kvm/CABgObfYXUxqQV_FoxKjC8U3t5DnyM45nz5DpTxYZv2x_uFK_Kw@mail.gmail.com/ # [1] open hereCc Rick Edgecombe <[email protected]>Cc Kai Huang <[email protected]>Cc Dave Hansen <[email protected]>Cc Dan Williams <[email protected]>Reviewed-by Kiryl Shutsemau <[email protected]>Reviewed-by Rick Edgecombe <[email protected]>Signed-off-by Vishal Verma <[email protected]>--- arch/x86/include/asm/tdx_global_metadata.h | 7 +++++++ arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+)arch/x86/include/asm/tdx_global_metadata.h +7
-0@@ -5,6 +5,12 @@#include <linux/types.h> +struct tdx_sys_info_version { +u16 minor_version; +u16 major_version; +u16 update_version; +}; +struct tdx_sys_info_features {u64 tdx_features0; };@@ -35,6 +41,7 @@ struct tdx_sys_info_td_conf { };struct tdx_sys_info { +struct tdx_sys_info_version version;struct tdx_sys_info_features features;struct tdx_sys_info_tdmr tdmr;struct tdx_sys_info_td_ctrl td_ctrl;arch/x86/virt/vmx/tdx/tdx_global_metadata.c +16
-0@@ -7,6 +7,21 @@* Include this file to other C file instead. */ +static int get_tdx_sys_info_version (struct tdx_sys_info_version *sysinfo_version) +{ +int ret =0 ; +u64 val; + +if (!ret && !(ret =read_sys_metadata_field (0x0800000100000003 , &val))) + sysinfo_version->minor_version = val; +if (!ret && !(ret =read_sys_metadata_field (0x0800000100000004 , &val))) + sysinfo_version->major_version = val; +if (!ret && !(ret =read_sys_metadata_field (0x0800000100000005 , &val))) + sysinfo_version->update_version = val; + +return ret; +} +static int get_tdx_sys_info_features (struct tdx_sys_info_features *sysinfo_features) {int ret =0 ;@@ -89,6 +104,7 @@ static int get_tdx_sys_info(struct tdx_sys_info *sysinfo) {int ret =0 ; + ret = ret ?:get_tdx_sys_info_version (&sysinfo->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);
Re: [PATCH v2 1/2] x86/virt/tdx: Retrieve TDX module version
In reply to Vishal VermaQuoted 10 lines · Vishal Verma
From: Chao Gao <[email protected]>
Each TDX module has several bits of metadata about which specific TDX module it is. The primary bit of info is the version, which has an x.y.z format. These represent the major version, minor version, and update version respectively. Knowing the running TDX Module version is valuable for bug reporting and debugging. Note that the module does expose other pieces of version-related metadata, such as build number and date. Those aren't retrieved for now, that can be added if needed in the future.
Quoted 5 lines
Retrieve the TDX Module version using the existing metadata reading interface. Later changes will expose this information. The metadata reading interfaces have existed for quite some time, so this will work with older versions of the TDX module as well - i.e. this isn't a new interface.
This is great to have for debugging, if not too late:
[tip: x86/tdx] x86/virt/tdx: Retrieve TDX module version
In reply to Vishal VermaThe following commit has been merged into the x86/tdx branch of tip:
The following commit has been merged into the x86/tdx branch of tip:
Commit-ID: 311214bf1df4b110f6b0646615aecfab388a25ef Gitweb: https://git.kernel.org/tip/311214bf1df4b110f6b0646615aecfab388a25ef Author: Chao Gao <[email protected]> AuthorDate: Fri, 09 Jan 2026 12:14:30 -07:00 Committer: Dave Hansen <[email protected]> CommitterDate: Wed, 25 Feb 2026 14:46:33 -08:00
x86/virt/tdx: Retrieve TDX module version
Each TDX module has several bits of metadata about which specific TDX module it is. The primary bit of info is the version, which has an x.y.z format. These represent the major version, minor version, and update version respectively. Knowing the running TDX Module version is valuable for bug reporting and debugging. Note that the module does expose other pieces of version-related metadata, such as build number and date. Those aren't retrieved for now, that can be added if needed in the future.
Retrieve the TDX Module version using the existing metadata reading interface. Later changes will expose this information. The metadata reading interfaces have existed for quite some time, so this will work with older versions of the TDX module as well - i.e. this isn't a new interface.
As a side note, the global metadata reading code was originally set up to be auto-generated from a JSON definition [1]. However, later [2] this was found to be unsustainable, and the autogeneration approach was dropped in favor of just manually adding fields as needed (e.g. as in this patch).
--- arch/x86/include/asm/tdx_global_metadata.h | 7 +++++++ arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 16 ++++++++++++++++ 2 files changed, 23 insertions(+)
arch/x86/include/asm/tdx_global_metadata.h +7 -0
@@ -5,6 +5,12 @@#include <linux/types.h> +struct tdx_sys_info_version { +u16 minor_version; +u16 major_version; +u16 update_version; +}; +struct tdx_sys_info_features {u64 tdx_features0; };
@@ -35,6 +41,7 @@ struct tdx_sys_info_td_conf { };struct tdx_sys_info { +struct tdx_sys_info_version version;struct tdx_sys_info_features features;struct tdx_sys_info_tdmr tdmr;struct tdx_sys_info_td_ctrl td_ctrl;
arch/x86/virt/vmx/tdx/tdx_global_metadata.c +16 -0
@@ -7,6 +7,21 @@* Include this file to other C file instead. */ +static int get_tdx_sys_info_version (struct tdx_sys_info_version *sysinfo_version) +{ +int ret =0 ; +u64 val; + +if (!ret && !(ret =read_sys_metadata_field (0x0800000100000003 , &val))) + sysinfo_version->minor_version = val; +if (!ret && !(ret =read_sys_metadata_field (0x0800000100000004 , &val))) + sysinfo_version->major_version = val; +if (!ret && !(ret =read_sys_metadata_field (0x0800000100000005 , &val))) + sysinfo_version->update_version = val; + +return ret; +} +static int get_tdx_sys_info_features (struct tdx_sys_info_features *sysinfo_features) {int ret =0 ;
@@ -89,6 +104,7 @@ static int get_tdx_sys_info(struct tdx_sys_info *sysinfo) {int ret =0 ; + ret = ret ?:get_tdx_sys_info_version (&sysinfo->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);
PATCH v2 2/2 x86/virt/tdx: Print TDX module version during init
In reply to Vishal VermaIt 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 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
Print the version in get_tdx_sys_info(), right after the version metadata is read, which makes it available even if there are subsequent initialization failures.
Based on a patch by Kai Huang <[email protected]> [2]
--- arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/x86/virt/vmx/tdx/tdx_global_metadata.c +6 -0
@@ -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);
Signature · 1 line
2.52.0
Re: [PATCH v2 2/2] x86/virt/tdx: Print TDX module version during init
Quoted 26 lines · Vishal Verma
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 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 initializedPrint the version in
get_tdx_sys_info(), right after the version metadata is read, which makes it available even if there are subsequent initialization failures.Based on a patch by Kai Huang <[email protected]> [2]
Signed-off-by Vishal Verma <[email protected]>Reviewed-by Chao Gao <[email protected]>Cc Chao Gao <[email protected]>Cc Rick Edgecombe <[email protected]>Cc Kai Huang <[email protected]>Cc Dave Hansen <[email protected]>Cc Dan Williams <[email protected]>
Quoted 1 line
---
Re: [PATCH v2 2/2] x86/virt/tdx: Print TDX module version during init
In reply to Vishal VermaQuoted 11 lines · Vishal Verma
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 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
Quoted 8 lines
Print the version in
get_tdx_sys_info(), right after the version metadata is read, which makes it available even if there are subsequent initialization failures.Based on a patch by Kai Huang <[email protected]> [2]
Signed-off-by Vishal Verma <[email protected]>Reviewed-by Chao Gao <[email protected]>
Quoted 29 lines
Cc Chao Gao <[email protected]>Cc Rick Edgecombe <[email protected]>Cc Kai Huang <[email protected]>Cc Dave Hansen <[email protected]>Cc Dan Williams <[email protected]>--- arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/x86/virt/vmx/tdx/tdx_global_metadata.c +6
-0@@ -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);
Re: [PATCH v2 2/2] x86/virt/tdx: Print TDX module version during init
In reply to Vishal VermaQuoted 11 lines · Vishal Verma
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 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
Quoted 5 lines
Print the version in
get_tdx_sys_info(), right after the version metadata is read, which makes it available even if there are subsequent initialization failures.Based on a patch by Kai Huang <[email protected]> [2]
One nit below.
Quoted 19 lines
Signed-off-by Vishal Verma <[email protected]>Reviewed-by Chao Gao <[email protected]>Cc Chao Gao <[email protected]>Cc Rick Edgecombe <[email protected]>Cc Kai Huang <[email protected]>Cc Dave Hansen <[email protected]>Cc Dan Williams <[email protected]>--- arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/x86/virt/vmx/tdx/tdx_global_metadata.c +0
-0
arch/x86/virt/vmx/tdx/tdx_global_metadata.c static int get_tdx_sys_info(struct tdx_sys_info *sysinfo) · line 113
Quoted 9 lines
arch/x86/virt/vmx/tdx/tdx_global_metadata.c +6
-0@@ -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); +
Nit:
There is a mismatch b/t the change log and the code.
The printed message will be
virt/tdx: Module version: x.x.xx
instead of the format in the change log
virt/tdx: TDX module version: x.x.xx
Quoted 4 lines
arch/x86/virt/vmx/tdx/tdx_global_metadata.c +0
-0ret = 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);
Re: [PATCH v2 2/2] x86/virt/tdx: Print TDX module version during init
In reply to Vishal VermaQuoted 17 lines · Vishal Verma
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 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 initializedPrint the version in
get_tdx_sys_info(), right after the version metadata is read, which makes it available even if there are subsequent initialization failures.Based on a patch by Kai Huang <[email protected]> [2]
Quoted 9 lines
Signed-off-by Vishal Verma <[email protected]>Reviewed-by Chao Gao <[email protected]>Cc Chao Gao <[email protected]>Cc Rick Edgecombe <[email protected]>Cc Kai Huang <[email protected]>Cc Dave Hansen <[email protected]>Cc Dan Williams <[email protected]>
Signature · 1 line
Kiryl Shutsemau / Kirill A. Shutemov
Re: [PATCH v2 2/2] x86/virt/tdx: Print TDX module version during init
In reply to Vishal VermaQuoted 7 lines · Vishal Verma
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 any future problems being investigated. This was also requested in [1].
Include the version in the log messages during init, e.g.:
Quoted 7 lines
virt/tdx: TDX module version: 1.5.24
virt/tdx: 1034220 KB allocated for PAMT
virt/tdx: module initializedPrint the version in
get_tdx_sys_info(), right after the version metadata is read, which makes it available even if there are subsequent initialization failures.
[tip: x86/tdx] x86/virt/tdx: Print TDX module version during init
In reply to Vishal VermaThe following commit has been merged into the x86/tdx branch of tip:
The following commit has been merged into the x86/tdx branch of tip:
Commit-ID: b5425f5406ee1b4bd84720f68020ef18ce380bab Gitweb: https://git.kernel.org/tip/b5425f5406ee1b4bd84720f68020ef18ce380bab Author: Vishal Verma <[email protected]> AuthorDate: Fri, 09 Jan 2026 12:14:31 -07:00 Committer: Dave Hansen <[email protected]> CommitterDate: Wed, 25 Feb 2026 14:46:33 -08:00
x86/virt/tdx: Print TDX module version during init
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 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
Print the version in get_tdx_sys_info(), right after the version metadata is read, which makes it available even if there are subsequent initialization failures.
Based on a patch by Kai Huang <[email protected]> [2]
--- arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/x86/virt/vmx/tdx/tdx_global_metadata.c +6 -0
@@ -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);
Quoted 6 lines · Vishal L
=== Problem & Solution ===
Currently, there is neither an ABI, nor any other way to determine from the host system, what version of the TDX module is running. A sysfs ABI for this has been proposed in [1], but it may need additional discussion.
Quoted 7 lines
Many/most TDX developers already carry patches like this in their development branches. It can be tricky to know which TDX module is actually loaded on a system, and so this functionality has been needed regularly for development and processing bug reports. Hence, it is prudent to break out the patches to retrieve and print the TDX module version, as those parts are very straightforward, and get some level of debugability and traceability for TDX host systems.
Big thanks for picking this up:
Quoted 32 lines · Vishal Verma
=== Problem & Solution ===
Currently, there is neither an ABI, nor any other way to determine from the host system, what version of the TDX module is running. A sysfs ABI for this has been proposed in [1], but it may need additional discussion.
Many/most TDX developers already carry patches like this in their development branches. It can be tricky to know which TDX module is actually loaded on a system, and so this functionality has been needed regularly for development and processing bug reports. Hence, it is prudent to break out the patches to retrieve and print the TDX module version, as those parts are very straightforward, and get some level of debugability and traceability for TDX host systems.
=== Dependencies ===
None. This is based on v6.19-rc4, and applies cleanly to tip.git.
=== Patch details ===
Patch 1 is a prerequisite that adds the infrastructure to retrieve the TDX module version from its global metadata. This was originally posted in [2].
Patch 2 is based on a patch from Kai Huang [3], and prints the version to dmesg during init.
=== Testing ===
This has passed the usual suite of tests, including successful 0day builds, KVM Unit tests, KVM selftests, a TD creation smoke test, and selected KVM tests from the Avocado test suite.
Quoted 5 lines
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/
[3]: https://lore.kernel.org/all/57eaa1b17429315f8b5207774307f3c1dd40cf37.1730118186.git.kai.huang@intel.com/Signed-off-by Vishal Verma <[email protected]>
Hi Kiryl, just wanted to check on the plan for this, I didn't see it merged in tip.git x86/tdx (or any other tip branch). Were you planning to take it through x86/tdx? Can I help with anything to move it along?
Thank you,
Vishal
Kiryl Shutsemau
maintainerQuoted 37 lines · Vishal L
Quoted 36 lines · Vishal Verma
=== Problem & Solution ===
Currently, there is neither an ABI, nor any other way to determine from the host system, what version of the TDX module is running. A sysfs ABI for this has been proposed in [1], but it may need additional discussion.
Many/most TDX developers already carry patches like this in their development branches. It can be tricky to know which TDX module is actually loaded on a system, and so this functionality has been needed regularly for development and processing bug reports. Hence, it is prudent to break out the patches to retrieve and print the TDX module version, as those parts are very straightforward, and get some level of debugability and traceability for TDX host systems.
=== Dependencies ===
None. This is based on v6.19-rc4, and applies cleanly to tip.git.
=== Patch details ===
Patch 1 is a prerequisite that adds the infrastructure to retrieve the TDX module version from its global metadata. This was originally posted in [2].
Patch 2 is based on a patch from Kai Huang [3], and prints the version to dmesg during init.
=== Testing ===
This has passed the usual suite of tests, including successful 0day builds, KVM Unit tests, KVM selftests, a TD creation smoke test, and selected KVM tests from the Avocado test suite.
[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/
[3]: https://lore.kernel.org/all/57eaa1b17429315f8b5207774307f3c1dd40cf37.1730118186.git.kai.huang@intel.com/
Quoted 5 lines
Quoted 1 line
Signed-off-by Vishal Verma <[email protected]>Hi Kiryl, just wanted to check on the plan for this, I didn't see it merged in tip.git x86/tdx (or any other tip branch). Were you planning to take it through x86/tdx? Can I help with anything to move it along?
I guess it has to wait after the merge window at this point.
Dave, could you queue this after -rc1 is tagged?
Signature · 1 line
Kiryl Shutsemau / Kirill A. Shutemov
Quoted 6 lines · Kiryl Shutsemau
Quoted 3 lines
Hi Kiryl, just wanted to check on the plan for this, I didn't see it merged in tip.git x86/tdx (or any other tip branch). Were you planning to take it through x86/tdx? Can I help with anything to move it along?
I guess it has to wait after the merge window at this point.
Dave, could you queue this after -rc1 is tagged?
Sure.
Is there any other TDX stuff that needs to get picked up at the same time that's been languishing?
Edgecombe, Rick P
maintainerQuoted 2 lines · Dave Hansen
Is there any other TDX stuff that needs to get picked up at the same time that's been languishing?
Xiaoyao is going to send a rebase of this after RC1:
https://lore.kernel.org/kvm/[email protected]/
It has pretty wide agreement, and ack's from the KVM side. Also, we have internal branches that are carrying forms of it. So if we merge it now we can have less dependencies later.
Kiryl Shutsemau
maintainerQuoted 4 lines · Dave Hansen
Quoted 3 lines · Kiryl Shutsemau
Quoted 3 lines
Hi Kiryl, just wanted to check on the plan for this, I didn't see it merged in tip.git x86/tdx (or any other tip branch). Were you planning to take it through x86/tdx? Can I help with anything to move it along?
Quoted 8 lines
Quoted 3 lines
I guess it has to wait after the merge window at this point.
Dave, could you queue this after -rc1 is tagged?
Sure.
Is there any other TDX stuff that needs to get picked up at the same time that's been languishing?
Nothing on my side.
Signature · 1 line
Kiryl Shutsemau / Kirill A. Shutemov