[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250605140739.GS39944@noisy.programming.kicks-ass.net>
Date: Thu, 5 Jun 2025 16:07:39 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Kai Huang <kai.huang@...el.com>
Cc: dave.hansen@...el.com, tglx@...utronix.de, bp@...en8.de,
mingo@...hat.com, hpa@...or.com, kirill.shutemov@...ux.intel.com,
rick.p.edgecombe@...el.com, x86@...nel.org, samitolvanen@...gle.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/virt/tdx: Add ENDBR for low level SEAMCALL assembly
functions
On Wed, Jun 04, 2025 at 12:38:48PM +1200, Kai Huang wrote:
> Build warnings about missing ENDBR around making SEAMCALLs[*] were
> observed when using some randconfig[1] to build today's Linus's tree.
>
> In the C code, the low level SEAMCALL assembly functions (__seamcall(),
> __seamcall_ret() and __seamcall_saved_ret()) are indirectly called via
> the common sc_retry() function:
>
> static inline u64 sc_retry(sc_func_t func, u64 fn,
> struct tdx_module_args *args)
> { ... }
>
> #define seamcall(_fn, _args) sc_retry(__seamcall, (_fn), (_args))
>
> It turns out compilers may not always be smart enough to figure out how
> to call those assembly functions directly.
Did you try something like so?
diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h
index 8b19294600c4..9662580c4b94 100644
--- a/arch/x86/include/asm/tdx.h
+++ b/arch/x86/include/asm/tdx.h
@@ -106,8 +106,8 @@ void tdx_init(void);
typedef u64 (*sc_func_t)(u64 fn, struct tdx_module_args *args);
-static inline u64 sc_retry(sc_func_t func, u64 fn,
- struct tdx_module_args *args)
+static __always_inline u64 sc_retry(const sc_func_t func, u64 fn,
+ struct tdx_module_args *args)
{
int retry = RDRAND_RETRY_LOOPS;
u64 ret;
Powered by blists - more mailing lists