From nobody Wed Nov 19 11:05:01 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F4B31917F0; Thu, 13 Nov 2025 04:42:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763008935; cv=none; b=pNHAZflefYqzPl+C+jFUiVk/gGd3BKI+SKvpRYdObd4NBPZ7fXOOruLBuSlJX3GgK9VrG6pf0aeRmO36zRLDe3lAnLRy3T3ZPCZtryVST1IejBWrinavi0vH7GvmdcVmW18QoXTLii79ozZ85KcPuPfMOD5l4+VuqJB4T1rWsNc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763008935; c=relaxed/simple; bh=zb9ctwwC3vJcUTeCQetdrK8Z4hDHpHZHrnpRCACTCPs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YmpTikNHRFYuWO3ooyvIPR7nxC5jQfDTM/lMZPyJfuliwC50VuC58C8QIGbmVy3vyABmFWesC6S7Jo6gyvG3Gl3nfX8z8TB4y6RuHjq+Cq6T+tgohanDzQSTB1i8W3tkRTrOq0KJqw3C8DrW8YdF0gSO5N15cCMb06OvbKcYF6k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=loxMAWcz; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="loxMAWcz" Received: from CPC-namja-1AYIP.redmond.corp.microsoft.com (unknown [4.213.232.42]) by linux.microsoft.com (Postfix) with ESMTPSA id 795D72013368; Wed, 12 Nov 2025 20:42:04 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 795D72013368 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1763008933; bh=JqciPxRzBkt61liiMOa1OS2vxRfLzlC77SqEfbDb2oU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=loxMAWczoRWyFlEd/m/WHVdqhR1P68pCDbtvBnCJDXjGgujKinQ95rZ/Xkka5EG7s brIhLGOZvnPrRUldG4mR1GAgZmk8vPH1c+L1FKYoFOJbrUbcK8o6Z88Po+fN7iT9J8 42zrTzGuCVyuBs9srzhO8HRbrgYzjhUlPc2Oftl8= From: Naman Jain To: "K . Y . Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Peter Zijlstra , Josh Poimboeuf , Jason Baron , Michael Kelley , Paolo Bonzini , Steven Rostedt , Ard Biesheuvel Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, Nuno Das Neves , Magnus Kulke , Kees Cook , Nathan Chancellor , Miguel Ojeda , Andrew Morton , Marc Herbert , Jan Hendrik Farr , Naman Jain , Heiko Carstens , Uros Bizjak , Sean Christopherson , Christoph Hellwig , Saurabh Sengar , ALOK TIWARI Subject: [PATCH v12 1/3] static_call: allow using STATIC_CALL_TRAMP_STR() from assembly Date: Thu, 13 Nov 2025 04:41:47 +0000 Message-ID: <20251113044149.3710877-2-namjain@linux.microsoft.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251113044149.3710877-1-namjain@linux.microsoft.com> References: <20251113044149.3710877-1-namjain@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" STATIC_CALL_TRAMP_STR() could not be used from .S files because static_call_types.h was not safe to include in assembly as it pulled in C types/constructs that are unavailable under __ASSEMBLY__. Make the header assembly-friendly by adding __ASSEMBLY__ checks and providing only the minimal definitions needed for assembly, so that it can be safely included by .S code. This enables emitting the static call trampoline symbol name via STATIC_CALL_TRAMP_STR() directly in assembly sources, to be used with 'call' instruction. Also, move a certain definitions out of __ASSEMBLY__ checks in compiler_types.h to meet the dependencies. No functional change for C compilation. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Naman Jain --- include/linux/compiler_types.h | 8 ++++---- include/linux/static_call_types.h | 4 ++++ tools/include/linux/static_call_types.h | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 0a1b9598940d..c46855162a8a 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -11,6 +11,10 @@ #define __has_builtin(x) (0) #endif =20 +/* Indirect macros required for expanded argument pasting, eg. __LINE__. */ +#define ___PASTE(a, b) a##b +#define __PASTE(a, b) ___PASTE(a, b) + #ifndef __ASSEMBLY__ =20 /* @@ -79,10 +83,6 @@ static inline void __chk_io_ptr(const volatile void __io= mem *ptr) { } # define __builtin_warning(x, y...) (1) #endif /* __CHECKER__ */ =20 -/* Indirect macros required for expanded argument pasting, eg. __LINE__. */ -#define ___PASTE(a,b) a##b -#define __PASTE(a,b) ___PASTE(a,b) - #ifdef __KERNEL__ =20 /* Attributes */ diff --git a/include/linux/static_call_types.h b/include/linux/static_call_= types.h index 5a00b8b2cf9f..cfb6ddeb292b 100644 --- a/include/linux/static_call_types.h +++ b/include/linux/static_call_types.h @@ -25,6 +25,8 @@ #define STATIC_CALL_SITE_INIT 2UL /* init section */ #define STATIC_CALL_SITE_FLAGS 3UL =20 +#ifndef __ASSEMBLY__ + /* * The static call site table needs to be created by external tooling (obj= tool * or a compiler plugin). @@ -100,4 +102,6 @@ struct static_call_key { =20 #endif /* CONFIG_HAVE_STATIC_CALL */ =20 +#endif /* __ASSEMBLY__ */ + #endif /* _STATIC_CALL_TYPES_H */ diff --git a/tools/include/linux/static_call_types.h b/tools/include/linux/= static_call_types.h index 5a00b8b2cf9f..cfb6ddeb292b 100644 --- a/tools/include/linux/static_call_types.h +++ b/tools/include/linux/static_call_types.h @@ -25,6 +25,8 @@ #define STATIC_CALL_SITE_INIT 2UL /* init section */ #define STATIC_CALL_SITE_FLAGS 3UL =20 +#ifndef __ASSEMBLY__ + /* * The static call site table needs to be created by external tooling (obj= tool * or a compiler plugin). @@ -100,4 +102,6 @@ struct static_call_key { =20 #endif /* CONFIG_HAVE_STATIC_CALL */ =20 +#endif /* __ASSEMBLY__ */ + #endif /* _STATIC_CALL_TYPES_H */ --=20 2.43.0