From: Peter Zijlstra <peterz@infradead.org>
To: Kai Huang <kai.huang@intel.com>
Cc: dave.hansen@intel.com, tglx@linutronix.de, bp@alien8.de,
mingo@redhat.com, hpa@zytor.com, kirill.shutemov@linux.intel.com,
rick.p.edgecombe@intel.com, x86@kernel.org,
samitolvanen@google.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/virt/tdx: Add ENDBR for low level SEAMCALL assembly functions
Date: Thu, 5 Jun 2025 16:07:39 +0200 [thread overview]
Message-ID: <20250605140739.GS39944@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250604003848.13154-1-kai.huang@intel.com>
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;
next prev parent reply other threads:[~2025-06-05 14:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-04 0:38 [PATCH] x86/virt/tdx: Add ENDBR for low level SEAMCALL assembly functions Kai Huang
2025-06-04 19:46 ` Dave Hansen
2025-06-04 23:16 ` Huang, Kai
2025-06-04 23:23 ` Dave Hansen
2025-06-04 23:27 ` Huang, Kai
2025-06-04 23:57 ` Huang, Kai
2025-06-05 13:12 ` Huang, Kai
2025-06-05 13:10 ` [PATCH v2] x86/virt/tdx: Annotate TDX assembly to allow indirect calls Kai Huang
2025-06-05 14:07 ` Peter Zijlstra [this message]
2025-06-05 14:21 ` [PATCH] x86/virt/tdx: Add ENDBR for low level SEAMCALL assembly functions Peter Zijlstra
2025-06-05 14:54 ` Dave Hansen
2025-06-05 14:59 ` Peter Zijlstra
2025-06-05 23:20 ` Huang, Kai
2025-06-05 23:23 ` Dave Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250605140739.GS39944@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=hpa@zytor.com \
--cc=kai.huang@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=samitolvanen@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.