* [tip: x86/tdx] x86/virt/tdx: Refresh TDX module version after update
[not found] <20260520222912.75D9589C@davehans-spike.ostc.intel.com>
@ 2026-05-22 17:26 ` tip-bot2 for Chao Gao
2026-05-26 15:32 ` tip-bot2 for Chao Gao
2026-05-26 15:43 ` tip-bot2 for Chao Gao
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Chao Gao @ 2026-05-22 17:26 UTC (permalink / raw)
To: linux-tip-commits
Cc: Chao Gao, Dave Hansen, Rick Edgecombe, x86, linux-kernel
The following commit has been merged into the x86/tdx branch of tip:
Commit-ID: 6e49a980dea9ca6ca12ca78e33578d11b6752fcd
Gitweb: https://git.kernel.org/tip/6e49a980dea9ca6ca12ca78e33578d11b6752fcd
Author: Chao Gao <chao.gao@intel.com>
AuthorDate: Wed, 20 May 2026 15:29:12 -07:00
Committer: Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Fri, 22 May 2026 10:20:10 -07:00
x86/virt/tdx: Refresh TDX module version after update
The kernel exposes the TDX module version through sysfs so userspace
can check update compatibility. That information needs to remain
accurate across runtime updates.
A runtime update may change the module's update_version, so refresh
the cached version right after a successful update.
Drop __ro_after_init from tdx_sysinfo because it is now updated at
runtime.
Do not refresh the rest of tdx_sysinfo, even if some values change
across updates. TDX module updates are backward compatible, so
existing tdx_sysinfo consumers, such as KVM, can continue to operate
without seeing the new values.
[ dhansen: trim changelog ]
Signed-off-by: Chao Gao <chao.gao@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Link: https://patch.msgid.link/20260520133909.409394-22-chao.gao@intel.com
Link: https://patch.msgid.link/20260520222912.75D9589C@davehans-spike.ostc.intel.com
---
arch/x86/virt/vmx/tdx/tdx.c | 9 ++++++++-
arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index d54c2ec..b15269b 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -67,7 +67,7 @@ static struct tdmr_info_list tdx_tdmr_list;
/* All TDX-usable memory regions. Protected by mem_hotplug_lock. */
static LIST_HEAD(tdx_memlist);
-static struct tdx_sys_info tdx_sysinfo __ro_after_init;
+static struct tdx_sys_info tdx_sysinfo;
static DEFINE_RAW_SPINLOCK(sysinit_lock);
@@ -1321,6 +1321,13 @@ int tdx_module_run_update(void)
if (ret)
return ret;
+ ret = get_tdx_sys_info_version(&tdx_sysinfo.version);
+ /*
+ * Only fails if there is something unexpected
+ * and severely wrong with the module.
+ */
+ WARN_ON_ONCE(ret);
+
tdx_module_state.initialized = true;
return 0;
}
diff --git a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
index e793dec..e49c300 100644
--- a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
+++ b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
@@ -7,7 +7,7 @@
* Include this file to other C file instead.
*/
-static __init int get_tdx_sys_info_version(struct tdx_sys_info_version *sysinfo_version)
+static int get_tdx_sys_info_version(struct tdx_sys_info_version *sysinfo_version)
{
int ret = 0;
u64 val;
^ permalink raw reply [flat|nested] 4+ messages in thread* [tip: x86/tdx] x86/virt/tdx: Refresh TDX module version after update
[not found] <20260520222912.75D9589C@davehans-spike.ostc.intel.com>
2026-05-22 17:26 ` [tip: x86/tdx] x86/virt/tdx: Refresh TDX module version after update tip-bot2 for Chao Gao
@ 2026-05-26 15:32 ` tip-bot2 for Chao Gao
2026-05-26 15:43 ` tip-bot2 for Chao Gao
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Chao Gao @ 2026-05-26 15:32 UTC (permalink / raw)
To: linux-tip-commits
Cc: Chao Gao, Dave Hansen, Rick Edgecombe, x86, linux-kernel
The following commit has been merged into the x86/tdx branch of tip:
Commit-ID: 451223436f1cbb8122be0ec9ea1d16446c019a34
Gitweb: https://git.kernel.org/tip/451223436f1cbb8122be0ec9ea1d16446c019a34
Author: Chao Gao <chao.gao@intel.com>
AuthorDate: Wed, 20 May 2026 15:29:12 -07:00
Committer: Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Tue, 26 May 2026 08:29:15 -07:00
x86/virt/tdx: Refresh TDX module version after update
The kernel exposes the TDX module version through sysfs so userspace
can check update compatibility. That information needs to remain
accurate across runtime updates.
A runtime update may change the module's update_version, so refresh
the cached version right after a successful update.
Drop __ro_after_init from tdx_sysinfo because it is now updated at
runtime.
Do not refresh the rest of tdx_sysinfo, even if some values change
across updates. TDX module updates are backward compatible, so
existing tdx_sysinfo consumers, such as KVM, can continue to operate
without seeing the new values.
[ dhansen: trim changelog ]
Signed-off-by: Chao Gao <chao.gao@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Link: https://patch.msgid.link/20260520133909.409394-22-chao.gao@intel.com
Link: https://patch.msgid.link/20260520222912.75D9589C@davehans-spike.ostc.intel.com
---
arch/x86/virt/vmx/tdx/tdx.c | 9 ++++++++-
arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index d54c2ec..b15269b 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -67,7 +67,7 @@ static struct tdmr_info_list tdx_tdmr_list;
/* All TDX-usable memory regions. Protected by mem_hotplug_lock. */
static LIST_HEAD(tdx_memlist);
-static struct tdx_sys_info tdx_sysinfo __ro_after_init;
+static struct tdx_sys_info tdx_sysinfo;
static DEFINE_RAW_SPINLOCK(sysinit_lock);
@@ -1321,6 +1321,13 @@ int tdx_module_run_update(void)
if (ret)
return ret;
+ ret = get_tdx_sys_info_version(&tdx_sysinfo.version);
+ /*
+ * Only fails if there is something unexpected
+ * and severely wrong with the module.
+ */
+ WARN_ON_ONCE(ret);
+
tdx_module_state.initialized = true;
return 0;
}
diff --git a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
index e793dec..e49c300 100644
--- a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
+++ b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
@@ -7,7 +7,7 @@
* Include this file to other C file instead.
*/
-static __init int get_tdx_sys_info_version(struct tdx_sys_info_version *sysinfo_version)
+static int get_tdx_sys_info_version(struct tdx_sys_info_version *sysinfo_version)
{
int ret = 0;
u64 val;
^ permalink raw reply [flat|nested] 4+ messages in thread* [tip: x86/tdx] x86/virt/tdx: Refresh TDX module version after update
[not found] <20260520222912.75D9589C@davehans-spike.ostc.intel.com>
2026-05-22 17:26 ` [tip: x86/tdx] x86/virt/tdx: Refresh TDX module version after update tip-bot2 for Chao Gao
2026-05-26 15:32 ` tip-bot2 for Chao Gao
@ 2026-05-26 15:43 ` tip-bot2 for Chao Gao
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Chao Gao @ 2026-05-26 15:43 UTC (permalink / raw)
To: linux-tip-commits
Cc: Chao Gao, Dave Hansen, Rick Edgecombe, x86, linux-kernel
The following commit has been merged into the x86/tdx branch of tip:
Commit-ID: 73be1bb72f4ce52191767a1f59f6a6ac9ef3d7fb
Gitweb: https://git.kernel.org/tip/73be1bb72f4ce52191767a1f59f6a6ac9ef3d7fb
Author: Chao Gao <chao.gao@intel.com>
AuthorDate: Wed, 20 May 2026 15:29:12 -07:00
Committer: Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Tue, 26 May 2026 08:41:51 -07:00
x86/virt/tdx: Refresh TDX module version after update
The kernel exposes the TDX module version through sysfs so userspace
can check update compatibility. That information needs to remain
accurate across runtime updates.
A runtime update may change the module's update_version, so refresh
the cached version right after a successful update.
Drop __ro_after_init from tdx_sysinfo because it is now updated at
runtime.
Do not refresh the rest of tdx_sysinfo, even if some values change
across updates. TDX module updates are backward compatible, so
existing tdx_sysinfo consumers, such as KVM, can continue to operate
without seeing the new values.
[ dhansen: trim changelog ]
Signed-off-by: Chao Gao <chao.gao@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Link: https://patch.msgid.link/20260520133909.409394-22-chao.gao@intel.com
Link: https://patch.msgid.link/20260520222912.75D9589C@davehans-spike.ostc.intel.com
---
arch/x86/virt/vmx/tdx/tdx.c | 9 ++++++++-
arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index d54c2ec..b15269b 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -67,7 +67,7 @@ static struct tdmr_info_list tdx_tdmr_list;
/* All TDX-usable memory regions. Protected by mem_hotplug_lock. */
static LIST_HEAD(tdx_memlist);
-static struct tdx_sys_info tdx_sysinfo __ro_after_init;
+static struct tdx_sys_info tdx_sysinfo;
static DEFINE_RAW_SPINLOCK(sysinit_lock);
@@ -1321,6 +1321,13 @@ int tdx_module_run_update(void)
if (ret)
return ret;
+ ret = get_tdx_sys_info_version(&tdx_sysinfo.version);
+ /*
+ * Only fails if there is something unexpected
+ * and severely wrong with the module.
+ */
+ WARN_ON_ONCE(ret);
+
tdx_module_state.initialized = true;
return 0;
}
diff --git a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
index e793dec..e49c300 100644
--- a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
+++ b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
@@ -7,7 +7,7 @@
* Include this file to other C file instead.
*/
-static __init int get_tdx_sys_info_version(struct tdx_sys_info_version *sysinfo_version)
+static int get_tdx_sys_info_version(struct tdx_sys_info_version *sysinfo_version)
{
int ret = 0;
u64 val;
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v10 21/25] x86/virt/tdx: Refresh TDX module version after update
@ 2026-05-20 13:38 Chao Gao
2026-06-05 21:25 ` [tip: x86/tdx] " tip-bot2 for Chao Gao
0 siblings, 1 reply; 4+ messages in thread
From: Chao Gao @ 2026-05-20 13:38 UTC (permalink / raw)
To: kvm, linux-coco, linux-kernel
Cc: binbin.wu, dave.hansen, djbw, ira.weiny, kai.huang, kas,
nik.borisov, paulmck, pbonzini, reinette.chatre,
rick.p.edgecombe, sagis, seanjc, tony.lindgren, vannapurve,
vishal.l.verma, yilun.xu, xiaoyao.li, yan.y.zhao, Chao Gao,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
H. Peter Anvin
The kernel exposes the TDX module version through sysfs so userspace can
check update compatibility. That information needs to remain accurate
across runtime updates.
A runtime update may change the module's update_version, so refresh the
cached version right after a successful update.
Drop __ro_after_init from tdx_sysinfo because it is now updated at runtime.
Do not refresh the rest of tdx_sysinfo, even if some values change across
updates. TDX module updates are backward compatible, so existing
tdx_sysinfo consumers, such as KVM, can continue to operate without seeing
the new values.
Refreshing the full structure would be risky. A tdx_sysinfo consumer may
initialize its TDX support based on the features originally reported in
tdx_sysinfo. If a runtime update adds new features and the full structure
is refreshed, that consumer could observe and use the newly reported
features without having performed the setup required to use them safely.
Signed-off-by: Chao Gao <chao.gao@intel.com>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
---
v9:
- don't print old and new version [Dave]
- explain why it's OK to hide changes from the tdx_sysinfo users [Dave]
- update versions in stop_machine context
- don't mention major/minor versions are idential across updates. That fact is
not relevant here.
---
arch/x86/virt/vmx/tdx/tdx.c | 6 +++++-
arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index e3f5aa272850..55670365a388 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -67,7 +67,7 @@ static struct tdmr_info_list tdx_tdmr_list;
/* All TDX-usable memory regions. Protected by mem_hotplug_lock. */
static LIST_HEAD(tdx_memlist);
-static struct tdx_sys_info tdx_sysinfo __ro_after_init;
+static struct tdx_sys_info tdx_sysinfo;
static DEFINE_RAW_SPINLOCK(sysinit_lock);
@@ -1314,6 +1314,10 @@ int tdx_module_run_update(void)
if (ret)
return ret;
+ /* Shouldn't fail as the update has succeeded. */
+ ret = get_tdx_sys_info_version(&tdx_sysinfo.version);
+ WARN_ON_ONCE(ret);
+
tdx_module_state.initialized = true;
return 0;
}
diff --git a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
index e793dec688ab..e49c300f23d4 100644
--- a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
+++ b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
@@ -7,7 +7,7 @@
* Include this file to other C file instead.
*/
-static __init int get_tdx_sys_info_version(struct tdx_sys_info_version *sysinfo_version)
+static int get_tdx_sys_info_version(struct tdx_sys_info_version *sysinfo_version)
{
int ret = 0;
u64 val;
--
2.52.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [tip: x86/tdx] x86/virt/tdx: Refresh TDX module version after update
2026-05-20 13:38 [PATCH v10 21/25] " Chao Gao
@ 2026-06-05 21:25 ` tip-bot2 for Chao Gao
0 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Chao Gao @ 2026-06-05 21:25 UTC (permalink / raw)
To: linux-tip-commits
Cc: Chao Gao, Dave Hansen, Rick Edgecombe, x86, linux-kernel
The following commit has been merged into the x86/tdx branch of tip:
Commit-ID: 856bc8bb990e21546fadff83502cdad33660a18e
Gitweb: https://git.kernel.org/tip/856bc8bb990e21546fadff83502cdad33660a18e
Author: Chao Gao <chao.gao@intel.com>
AuthorDate: Wed, 20 May 2026 15:29:12 -07:00
Committer: Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Wed, 03 Jun 2026 08:59:44 -07:00
x86/virt/tdx: Refresh TDX module version after update
The kernel exposes the TDX module version through sysfs so userspace
can check update compatibility. That information needs to remain
accurate across runtime updates.
A runtime update may change the module's update_version, so refresh
the cached version right after a successful update.
Drop __ro_after_init from tdx_sysinfo because it is now updated at
runtime.
Do not refresh the rest of tdx_sysinfo, even if some values change
across updates. TDX module updates are backward compatible, so
existing tdx_sysinfo consumers, such as KVM, can continue to operate
without seeing the new values.
[ dhansen: trim changelog ]
Signed-off-by: Chao Gao <chao.gao@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Link: https://patch.msgid.link/20260520133909.409394-22-chao.gao@intel.com
---
arch/x86/virt/vmx/tdx/tdx.c | 9 ++++++++-
arch/x86/virt/vmx/tdx/tdx_global_metadata.c | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index d54c2ec..b15269b 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -67,7 +67,7 @@ static struct tdmr_info_list tdx_tdmr_list;
/* All TDX-usable memory regions. Protected by mem_hotplug_lock. */
static LIST_HEAD(tdx_memlist);
-static struct tdx_sys_info tdx_sysinfo __ro_after_init;
+static struct tdx_sys_info tdx_sysinfo;
static DEFINE_RAW_SPINLOCK(sysinit_lock);
@@ -1321,6 +1321,13 @@ int tdx_module_run_update(void)
if (ret)
return ret;
+ ret = get_tdx_sys_info_version(&tdx_sysinfo.version);
+ /*
+ * Only fails if there is something unexpected
+ * and severely wrong with the module.
+ */
+ WARN_ON_ONCE(ret);
+
tdx_module_state.initialized = true;
return 0;
}
diff --git a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
index e793dec..e49c300 100644
--- a/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
+++ b/arch/x86/virt/vmx/tdx/tdx_global_metadata.c
@@ -7,7 +7,7 @@
* Include this file to other C file instead.
*/
-static __init int get_tdx_sys_info_version(struct tdx_sys_info_version *sysinfo_version)
+static int get_tdx_sys_info_version(struct tdx_sys_info_version *sysinfo_version)
{
int ret = 0;
u64 val;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-05 21:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20260520222912.75D9589C@davehans-spike.ostc.intel.com>
2026-05-22 17:26 ` [tip: x86/tdx] x86/virt/tdx: Refresh TDX module version after update tip-bot2 for Chao Gao
2026-05-26 15:32 ` tip-bot2 for Chao Gao
2026-05-26 15:43 ` tip-bot2 for Chao Gao
2026-05-20 13:38 [PATCH v10 21/25] " Chao Gao
2026-06-05 21:25 ` [tip: x86/tdx] " tip-bot2 for Chao Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®