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: 73185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2154609wrt; Tue, 21 Mar 2023 21:26:40 -0700 (PDT) X-Google-Smtp-Source: AK7set9YmYLdFzyqvP+hgwTZaIn0id7fySC3xAYX1vImZx07L67bM2/vLCJxQO7LZcmQ6uevFB4Y X-Received: by 2002:a17:902:db01:b0:19f:2dff:21a2 with SMTP id m1-20020a170902db0100b0019f2dff21a2mr1319349plx.64.1679459200406; Tue, 21 Mar 2023 21:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679459200; cv=none; d=google.com; s=arc-20160816; b=ImlWy9YPfoHRxAfzZX2aArkeH6WhTSnZsUln3oVXgK2FYO3E7pz4SYrV9vjx+xCMyl ZAbB1yH8r0qehaXhqDm1h/nU17LQWvsJl2eEVoOMVMQ27yvc2blZtML6vR1wdokUD+bP E1eVRJbfASzyDgYQc8/RXxGC8ga23PobHc28Rt02m2j5hOfNLHu1pZo8EAvuIWbS+XG7 8f24+3a9npEmBibYsrrWx1lwE/5GDhaf6TTgl3DsNuBkTzoYuiiWT4bCwuc9XdT0qKLd 8M3uSnocJoOPln6pJm1i3iOGGPSt9wy7yCUeguESleVMfQS6nq3fLDtmnyfS0TMWyng3 Oeqw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a170902ecc700b001a1c005bd39si10278137plh.97.2023.03.21.21.26.27; Tue, 21 Mar 2023 21:26:40 -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 S230344AbjCVEAr (ORCPT + 99 others); Wed, 22 Mar 2023 00:00:47 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761040610263920843?= X-GMAIL-MSGID: =?utf-8?q?1761040610263920843?= 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)