[PATCH v2 02/21] x86/virt/tdx: Use %# prefix for hex values in SEAMCALL error messages

From: Chao Gao

Date: Tue Sep 30 2025 - 22:54:51 EST


"%#" format specifier automatically adds the "0x" prefix and has one less
character than "0x%".

For conciseness, replace "0x%" with "%#" when printing hexadecimal values
in SEAMCALL error messages.

Suggested-by: Dan Williams <dan.j.williams@xxxxxxxxx>
Signed-off-by: Chao Gao <chao.gao@xxxxxxxxx>
---
"0x%" is also used to print TDMR ranges. I didn't convert them to reduce
code churn, but if they should be converted for consistency, I'm happy
to do that.

v2: new
---
arch/x86/virt/vmx/tdx/tdx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
index e406edd28687..f429a5fdced2 100644
--- a/arch/x86/virt/vmx/tdx/tdx.c
+++ b/arch/x86/virt/vmx/tdx/tdx.c
@@ -62,16 +62,16 @@ typedef void (*sc_err_func_t)(u64 fn, u64 err, struct tdx_module_args *args);

static inline void seamcall_err(u64 fn, u64 err, struct tdx_module_args *args)
{
- pr_err("SEAMCALL (%llu) failed: 0x%016llx\n", fn, err);
+ pr_err("SEAMCALL (%llu) failed: %#016llx\n", fn, err);
}

static inline void seamcall_err_ret(u64 fn, u64 err,
struct tdx_module_args *args)
{
seamcall_err(fn, err, args);
- pr_err("RCX 0x%016llx RDX 0x%016llx R08 0x%016llx\n",
+ pr_err("RCX %#016llx RDX %#016llx R08 %#016llx\n",
args->rcx, args->rdx, args->r8);
- pr_err("R09 0x%016llx R10 0x%016llx R11 0x%016llx\n",
+ pr_err("R09 %#016llx R10 %#016llx R11 %#016llx\n",
args->r9, args->r10, args->r11);
}

--
2.47.3