Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp1686545qtg; Tue, 21 Mar 2023 21:01:25 -0700 (PDT) X-Google-Smtp-Source: AK7set9uicz4/QZ1lvmMzVdo1u4t7YCl46VTVDmIV2F4IgQ2EhmgE+rw7eLLJ+Q3wSL+coZ7pC4Z X-Received: by 2002:a17:902:e74a:b0:1a1:8c05:70d0 with SMTP id p10-20020a170902e74a00b001a18c0570d0mr1621295plf.34.1679457685097; Tue, 21 Mar 2023 21:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679457685; cv=none; d=google.com; s=arc-20160816; b=RuOErVk46u9cUEFz2q8/Se72XsmY7qOBSCw63jJ2th0T/Pq0hC4VapIwxGBFpBV291 JAXFdJ/9DDN50WFm09/67Qr6AdyEmIHaXUo42Vf7LIbYmqA8TSpZ7wHeAL1SRfDQLZPg w43mBO984HXV17nQ5w4FP+eKDzurolVAs8Atx1EOlU1Gyyj2Rbzyea2l744F2IcVKHHa apyG9hYs7oHPYPiFgpVr6I+hCaCzGUsXgoyp+Jj+Cvxrsm7j5yJL8zsos5GWNQ1XMd1G hN+2crk1Z3s03OWHVO8vVZXaTQsXkImff9lJBXdeH3lPl+T+dKWQawx5rL82pecCiiEb KwKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ACU4A0oUi5RO3JT8qfAgzKfYiBWrmEQbUvRCoVapV54=; b=VZcJhAMqxu7aEH1zd2euQF/r/jFNuAqvRC7E/Etgsv4j9QaCikpHkJBHcxt5gUANiB ikgyM/ch+8pLA+kiJNSRDAdmvyeixzyDOd81HscKceFkTNWBXz3OmAvsRjF+D9W5esZw TQBN4rJ1JPz0gWoDYKVqKxzLdaQMMHfx92+ha7jdXxUZ4sp7DJUAt/xB5/D5ygPCoppQ 7rpmPm3JFmB7PwPXklHAf7scMxdxJMxpY2HXOdmrTCNo5czT+7xLVZUT4xqH1g7p9KfV yBiMYrr65ZhWuFDri7pXQrPdWKMxrj4XnxPgT8uN61/yoZj+5+/vWrFX8AXzvJrDhNTr yALw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="FZJk/OvU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n6-20020a170902e54600b0019fe9a63cf2si15860403plf.609.2023.03.21.21.01.12; Tue, 21 Mar 2023 21:01:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="FZJk/OvU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230342AbjCVEAq (ORCPT + 99 others); Wed, 22 Mar 2023 00:00:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230274AbjCVEA3 (ORCPT ); Wed, 22 Mar 2023 00:00:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32F64498BE for ; Tue, 21 Mar 2023 21:00:28 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id DD019B81B00 for ; Wed, 22 Mar 2023 04:00:26 +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 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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) -- 2.39.2