From patchwork Wed Mar 22 04:00:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Poimboeuf X-Patchwork-Id: 13183522 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AD16C74A5B for ; Wed, 22 Mar 2023 04:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WM9QcI74HD47hJICvPPKvTwv84lGnkQtzOQhujFP3vQ=; b=P/ZywSJeBU92we e86s3HKsKLuqNv79Np2OFqreUG5gXjmkpmnojdr5g1d4zXCpINclyNTdtnTv0IgFJnexFL83+H5UG 7jA86GNuEqqAr7fbzyjSZlqvq7IAUsbCSvX81fKLE+ZV9hdxMSdMGxt5iFV+Y+AEq6nFps/fCsP39 RSwBzMBio/pUMeEkOUGPxRrBiZJfQ5maz8DjARhnJLG1/RuKoB8Qm0n+UjDdrb95zFHfAZEX25a7+ aWvFZqBW4L13PkBeiUqV6cUk9FWBT97KCLlxaUmvd0LtpgTQP7pHaIj/t8wPasxoZRZUUEzqRN0zL fBpnyvYPAfLFTVJzK1jA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pepel-00EVRZ-1G; Wed, 22 Mar 2023 04:00:59 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pepeE-00EVBl-0j for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 04:00:30 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BE75361E67; Wed, 22 Mar 2023 04:00:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CBB5C433A0; Wed, 22 Mar 2023 04:00:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679457625; bh=sFv6ysPUwwSbqqWjEUzZkiH5GZXLdn6WWf8JJtLGU/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FZJk/OvUzmqLG/R/sYpJ6Vr6cd1GnPQkyYrekaqKgoZ5rBsnjCby6AB+sj1A0BEdm VubwVNbQmJDhiUSbSRGqKopbYYaDbAXY6NgBSOYz3d7ATuiyJqChlBE/A0bMRlRJi+ sr0RIFPgITofS1+T43065v5YQs6L3DX4ahWtO/hg+z/CzJYIM0t7rNJhmLxmLIsdhO MbUka1rwx6N/txtdlG2qJTR6qTacHU3+q06f6H6XT5EhEFxYQNEDdAakAd5HUaLQa2 o8SdapoGOryqKsXD4VMhPRxOfvhPF+iS6oti4kMGhC70sHYv3B2ukSP9jZicqsK+w9 6JJlwBTXj3rUA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Mark Rutland , Jason Baron , Steven Rostedt , Ard Biesheuvel , Christophe Leroy , Paolo Bonzini , Sean Christopherson , Sami Tolvanen , Nick Desaulniers , Will McVicker , Kees Cook , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 05/11] static_call: Make ARCH_ADD_TRAMP_KEY() generic Date: Tue, 21 Mar 2023 21:00:11 -0700 Message-Id: <6a0d8889143580b3eac61ecabca783a5e8ad1bad.1679456900.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_210026_305026_526C2CEA X-CRM114-Status: GOOD ( 12.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There's nothing arch-specific about ARCH_ADD_TRAMP_KEY(). Move it to the generic static_call.h. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/static_call.h | 6 ------ include/linux/static_call.h | 11 +++++++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/static_call.h b/arch/x86/include/asm/static_call.h index 343b722ccaf2..52abbdfd6106 100644 --- a/arch/x86/include/asm/static_call.h +++ b/arch/x86/include/asm/static_call.h @@ -57,12 +57,6 @@ #define ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name) \ ARCH_DEFINE_STATIC_CALL_TRAMP(name, __static_call_return0) -#define ARCH_ADD_TRAMP_KEY(name) \ - asm(".pushsection .static_call_tramp_key, \"a\" \n" \ - ".long " STATIC_CALL_TRAMP_STR(name) " - . \n" \ - ".long " STATIC_CALL_KEY_STR(name) " - . \n" \ - ".popsection \n") - extern bool __static_call_fixup(void *tramp, u8 op, void *dest); #endif /* _ASM_STATIC_CALL_H */ diff --git a/include/linux/static_call.h b/include/linux/static_call.h index abce40166039..013022a8611d 100644 --- a/include/linux/static_call.h +++ b/include/linux/static_call.h @@ -213,10 +213,17 @@ extern long __static_call_return0(void); /* Leave the key unexported, so modules can't change static call targets: */ #define EXPORT_STATIC_CALL_TRAMP(name) \ EXPORT_SYMBOL(STATIC_CALL_TRAMP(name)); \ - ARCH_ADD_TRAMP_KEY(name) + __STATIC_CALL_ADD_TRAMP_KEY(name) #define EXPORT_STATIC_CALL_TRAMP_GPL(name) \ EXPORT_SYMBOL_GPL(STATIC_CALL_TRAMP(name)); \ - ARCH_ADD_TRAMP_KEY(name) + __STATIC_CALL_ADD_TRAMP_KEY(name) + +/* Unexported key lookup table */ +#define __STATIC_CALL_ADD_TRAMP_KEY(name) \ + asm(".pushsection .static_call_tramp_key, \"a\" \n" \ + ".long " STATIC_CALL_TRAMP_STR(name) " - . \n" \ + ".long " STATIC_CALL_KEY_STR(name) " - . \n" \ + ".popsection \n") #elif defined(CONFIG_HAVE_STATIC_CALL)