From patchwork Wed Dec 28 16:19:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 37234 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1971927wrt; Wed, 28 Dec 2022 08:23:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXt4MSCzERtc5Sc3UO9rNrBNU0jO4zRzM8q4jdi6tILqhbEdUNGdhZ7w6Ei+0pFbTkBK1Oko X-Received: by 2002:a17:902:7590:b0:189:7100:c50e with SMTP id j16-20020a170902759000b001897100c50emr38359370pll.48.1672244609588; Wed, 28 Dec 2022 08:23:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672244609; cv=none; d=google.com; s=arc-20160816; b=h8xubsqhRowWcGpu+BuVskiGQTQDGppub6uC/X5doNnqqAJS8lCTTLknD3QyTaJ73p K1GdlEjneYazwK5AUUxaeF6MKC2aJZNBOw8+BJNagM0pVGjXSmHIIjs+SwN4LeWG90um QmZfmHcVoqFeSLKTrKqnN2Q8KGiEeSlOc9TumNPHBGs2If2xeU/5vBGN2Ib1mQnG5F9s LdnRI2pFkhbbCpwm0LN//0LWvQwaAt3qTBalGrcxur4wARKlAqtnFYHP/Wu1SsJ9dvFk qLDiPrRjQX8th+jYSYyTncw2bm4MBNw9G0OglgojmFZbGXyrXUhj4Mdx5afAV33TgNNe lSQw== 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 :feedback-id:dkim-signature:dkim-signature; bh=ESstYnp5wyCE49c6/wy64Qn4j/wTNxpyUZDW8WgeRUg=; b=mAHNiGMnYqodtVKTC3dQf2nKfABQttrconOrmplxpFp4HBILeoONaTzEhqa4KadVZc C+obLm7in7uHXRVxKkTHDQS3r0juA9cpRnGODT4STYN1rtICzacfBpcKbaw/rBs13+Og Ejx4mqb3ogrFZYGpNXsyL1UXFZhjCxdKoC40NY6Wr3YEpeFwaqZC/QTv5H1CSlc+YIi5 O+aLAIH1hPW0nsIk1BXMIvYs/ozlfkvs/8tS7phb2skQP69kndYspwKIdiQGIC12E3Q1 yCm0okfpTPkgwOa3yid7PHYNYvctQFR7dOmI75FvdSqJKv7os+TZ27Olzt+zDSK4dp83 S1Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sholland.org header.s=fm3 header.b=KGPw76T8; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=HmXYANKp; 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=sholland.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a170902e88800b001890b070acesi18169143plg.38.2022.12.28.08.23.17; Wed, 28 Dec 2022 08:23:29 -0800 (PST) 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=@sholland.org header.s=fm3 header.b=KGPw76T8; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=HmXYANKp; 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=sholland.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233372AbiL1QW6 (ORCPT + 99 others); Wed, 28 Dec 2022 11:22:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234445AbiL1QVY (ORCPT ); Wed, 28 Dec 2022 11:21:24 -0500 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CDDC1B796 for ; Wed, 28 Dec 2022 08:19:22 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EBBFE5C018A; Wed, 28 Dec 2022 11:19:21 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 28 Dec 2022 11:19:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1672244361; x=1672330761; bh=ES stYnp5wyCE49c6/wy64Qn4j/wTNxpyUZDW8WgeRUg=; b=KGPw76T8n9MIoY9Oog 5UaC3+g6MNNikDTuxkQ4OAuqigX6iTB3WI4R4Sk2uXqOKSqCGlnxKQAoO1BjwqNN he8M+zq2JjzvpS0ot0vIfuvCpwG2LzU7uB5W8xpL5Gctu51tYHgkXEdtA1QzOKQm OiNjf2Aqz3+GAccv3ggUvuItBTG3r47dxR+6HRJfaTWKtmGIq6TEQrQUGiY8BJdx 3Uj6zgyEF4ONDf6EdlUW4BoUD/VKO2pPNzpVdupP6TgL0pBdkX7AnOD9YdwmKsjM MGcqjK9iCpxA+QzbzBKp+ZkcuytmmHnQ3CHL2vTKf/2zaC+gAAmgPcj16asE1nTx daPg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1672244361; x=1672330761; bh=ESstYnp5wyCE4 9c6/wy64Qn4j/wTNxpyUZDW8WgeRUg=; b=HmXYANKpWMSa6HeXX9i9y1m493z9A HUeDYwPYYbRqMVqN5vrsMkn7f03KMMc0/NRYQKzIKuXx2tFPFTczPkvCgP2CMBWN Rj3bZDhT/zn6JnqMW1OR2HeQh0NTLMBxcUEreyZsXOseWS/srZGbIpOEV9xXm9K4 /rE7uvzfg33XRbit+JUF3L8kYDN163hqwxuVvFDIcxnu1Td3c6bw843Am2khLZMY Rf30Bb7vk7KFGFdn/KqFW1fKjV0qfP9lehYVcFXpd9YxMLmbP+6Xl2yTgIFxWCKS mZcdr2antmAc6VhECZkiCn9bVphwwgtX9UmCWfQMStTYm0Um+IbNf9dKg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedriedvgdekkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpedukeetueduhedtleetvefguddvvdejhfefudelgfduveeggeehgfdu feeitdevteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Dec 2022 11:19:20 -0500 (EST) From: Samuel Holland To: Palmer Dabbelt , Dmitry Osipenko , "Rafael J . Wysocki" Cc: Samuel Holland , Albert Ou , Anup Patel , Atish Patra , Geert Uytterhoeven , Heiko Stuebner , Kai-Heng Feng , Luis Chamberlain , "Paul E. McKenney" , Paul Walmsley , Petr Mladek , YueHaibing , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, tangmeng Subject: [PATCH 2/3] riscv: sbi: Share the code for unsupported extension warnings Date: Wed, 28 Dec 2022 10:19:14 -0600 Message-Id: <20221228161915.13194-3-samuel@sholland.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221228161915.13194-1-samuel@sholland.org> References: <20221228161915.13194-1-samuel@sholland.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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?1753475563956857525?= X-GMAIL-MSGID: =?utf-8?q?1753475563956857525?= This reduces the code size by sharing most of the code and the format string across all affected extensions. Signed-off-by: Samuel Holland Reviewed-by: Geert Uytterhoeven --- arch/riscv/kernel/sbi.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c index 5c87db8fdff2..1196c12299f6 100644 --- a/arch/riscv/kernel/sbi.c +++ b/arch/riscv/kernel/sbi.c @@ -210,16 +210,20 @@ static void sbi_set_power_off(void) pm_power_off = sbi_shutdown; } #else +static void __sbi_warn_unsupported(const char *extension) +{ + pr_warn("%s extension is not available in SBI v%lu.%lu\n", + extension, sbi_major_version(), sbi_minor_version()); +} + static void __sbi_set_timer_v01(uint64_t stime_value) { - pr_warn("Timer extension is not available in SBI v%lu.%lu\n", - sbi_major_version(), sbi_minor_version()); + __sbi_warn_unsupported("Timer"); } static int __sbi_send_ipi_v01(const struct cpumask *cpu_mask) { - pr_warn("IPI extension is not available in SBI v%lu.%lu\n", - sbi_major_version(), sbi_minor_version()); + __sbi_warn_unsupported("IPI"); return 0; } @@ -228,8 +232,7 @@ static int __sbi_rfence_v01(int fid, const struct cpumask *cpu_mask, unsigned long start, unsigned long size, unsigned long arg4, unsigned long arg5) { - pr_warn("remote fence extension is not available in SBI v%lu.%lu\n", - sbi_major_version(), sbi_minor_version()); + __sbi_warn_unsupported("Remote fence"); return 0; }