Thread (31 messages) 31 messages, 4 authors, 21h ago

[RFC PATCH 13/15] x86/tdx: Add __tdcall_saved() helper

flat view
HOTtoday

From: Zhenzhong Duan <hidden>
Date: 2026-09-24 04:11:53
Also in: lkml
Subsystem: the rest, x86 architecture (32-bit and 64-bit) · Maintainers: Linus Torvalds, Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen

The TDX Connect ABI defines TDCALL leaves that use registers up to r15
in struct tdx_module_args as input, without returning output arguments.

Add __tdcall_saved() for these leaves.

Signed-off-by: Zhenzhong Duan <redacted>
---
 arch/x86/coco/tdx/tdcall.S        | 17 +++++++++++++++++
 arch/x86/include/asm/shared/tdx.h |  1 +
 2 files changed, 18 insertions(+)
diff --git a/arch/x86/coco/tdx/tdcall.S b/arch/x86/coco/tdx/tdcall.S
index 52d9786da308..1dca01909dee 100644
--- a/arch/x86/coco/tdx/tdcall.S
+++ b/arch/x86/coco/tdx/tdcall.S
@@ -44,6 +44,23 @@ SYM_FUNC_START(__tdcall_ret)
 	TDX_MODULE_CALL host=0 ret=1
 SYM_FUNC_END(__tdcall_ret)
 
+/*
+ * __tdcall_saved() - Used by TDX guests to request services from the TDX
+ * module (does not include VMM services) using TDCALL instruction.
+ *
+ * __tdcall_saved() function ABI:
+ *
+ * @fn   (RDI)	- TDCALL Leaf ID, moved to RAX
+ * @args (RSI)	- struct tdx_module_args for input
+ *
+ * All registers in @args are used as input registers.
+ *
+ * Return status of TDCALL via RAX.
+ */
+SYM_FUNC_START(__tdcall_saved)
+	TDX_MODULE_CALL host=0 saved=1
+SYM_FUNC_END(__tdcall_saved)
+
 /*
  * __tdcall_saved_ret() - Used by TDX guests to request services from the
  * TDX module (including VMM services) using TDCALL instruction, with
diff --git a/arch/x86/include/asm/shared/tdx.h b/arch/x86/include/asm/shared/tdx.h
index 72520f09ef3f..90f2842f4253 100644
--- a/arch/x86/include/asm/shared/tdx.h
+++ b/arch/x86/include/asm/shared/tdx.h
@@ -153,6 +153,7 @@ struct tdx_module_args {
 /* Used to communicate with the TDX module */
 u64 __tdcall(u64 fn, struct tdx_module_args *args);
 u64 __tdcall_ret(u64 fn, struct tdx_module_args *args);
+u64 __tdcall_saved(u64 fn, struct tdx_module_args *args);
 u64 __tdcall_saved_ret(u64 fn, struct tdx_module_args *args);
 
 /* Used to request services from the VMM */
-- 
2.52.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help