Re: [PATCH] x86/virt/tdx: Formalize SEAMCALL version encoding support
From: Xiaoyao Li
Date: Thu Jul 02 2026 - 20:00:58 EST
On 7/2/2026 10:46 PM, Xu Yilun wrote:
+/*
+ * SEAMCALL leaf:
+ *
+ * Bit 15:0 Leaf number
+ * Bit 23:16 Version number
+ */
+#define SEAMCALL_VERSION_MASK GENMASK_U64(23, 16)
+
+static __always_inline u64 __seamcall_encode_fn(sc_func_t func, u64 fn,
+ struct tdx_module_args *args)
+{
+ FIELD_MODIFY(SEAMCALL_VERSION_MASK, &fn, args->version);
+
+ return func(fn, args);
+}
+
static __always_inline u64 __seamcall_dirty_cache(sc_func_t func, u64 fn,
struct tdx_module_args *args)
{
@@ -39,7 +56,7 @@ static __always_inline u64 __seamcall_dirty_cache(sc_func_t func, u64 fn,
*/
this_cpu_write(cache_state_incoherent, true);
- return func(fn, args);
+ return __seamcall_encode_fn(func, fn, args);
}
Can we drop the new wrapper? I don't see why we need it. The wrapper makes the code harder to read.