Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp9407147rwb; Thu, 24 Nov 2022 12:23:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf7A4czevzG4ca21RxSf0Mvc4rU3J2PkvjEKjRjxLIKKit8M9KBoFR8Pk23a+yQ8XGj6Bmyo X-Received: by 2002:a17:902:7442:b0:189:371b:596a with SMTP id e2-20020a170902744200b00189371b596amr13153145plt.68.1669321385729; Thu, 24 Nov 2022 12:23:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669321385; cv=none; d=google.com; s=arc-20160816; b=u0ckFQ2WRZ6aHW6A6q9j8pZgdlMi+Kx0+8ILJhaMOJCDexogLCh297EvbMJSXr8zeD /1zihyKGbTFIIMvnCJw5akf60cL7PI8/epVx/4NeKWSMcnmkavMVZDkZN3UEAITxEaCr /yxqDIqRfBVp8Nl853Akj7j67pa6SV6f+yy7Pa2lSoq7JhGF+94uceKpDGCuzX5I0tjz JYhM+EvA3wiBlcGH7rx18SBF5hkhByIAldW6ji07MKRvYpYy3AMX2bmTY0oityywdWG0 LWMU4VU7KxhKU14XzBWb1KvIgBzCCeLfNtovkcqq0IoPNKxsrEbnVaE15guq9UrlJvf8 mylg== 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; bh=6ogz08th21bYo6QJx7TblYiyckwrpNlcuUe6fmJq7Og=; b=C6OvZr6bjen8rOjM3TS01s5+IqHZKKrAPxKD7dV4fGgxk7KhmZjojpkp3oeOtGqzHr eH2tUWLGqbx1QjpeyxiFJXS3wyMVkpZMNNoGyO8PnpdNK0HUX6JUMoLjiTPzbtBJ22p5 mr6azOYcJLFwGbMH3R0nvBqcteTqwi9yxNeWHiaNgU9gFaJ+D/QNKUtes7s+KM2Df6bE /PGRjqYGm9ePgsxaMGs+NZu4HkVCKBb/IYLG9KlLunCSJV3GPWOCeHO/FBp9XrGuney+ rb42s5djTjCgexGGfFbpoUe5EWJzayep3OtehBMKi+O3IrHkc+cktUds1mqTVDWU9bWG hC4Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t23-20020a170902b21700b00186f1ccf36bsi1772998plr.45.2022.11.24.12.22.53; Thu, 24 Nov 2022 12:23:05 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229807AbiKXT7B (ORCPT + 88 others); Thu, 24 Nov 2022 14:59:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbiKXT67 (ORCPT ); Thu, 24 Nov 2022 14:58:59 -0500 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6294060E6; Thu, 24 Nov 2022 11:58:56 -0800 (PST) Received: from ip5b412258.dynamic.kabel-deutschland.de ([91.65.34.88] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oyIMs-0007eH-Pe; Thu, 24 Nov 2022 20:58:42 +0100 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Prabhakar , Conor Dooley Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Geert Uytterhoeven , Magnus Damm , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Guo Ren , Jisheng Zhang , Atish Patra , Anup Patel , Andrew Jones , Nathan Chancellor , Philipp Tomsich , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Biju Das , Lad Prabhakar Subject: Re: [PATCH v4 1/7] riscv: asm: alternative-macros: Introduce ALTERNATIVE_3() macro Date: Thu, 24 Nov 2022 20:58:41 +0100 Message-ID: <4801607.MHq7AAxBmi@diego> In-Reply-To: References: <20221124172207.153718-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20221124172207.153718-2-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_SPF_HELO_TEMPERROR 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 Am Donnerstag, 24. November 2022, 20:52:33 CET schrieb Conor Dooley: > On Thu, Nov 24, 2022 at 05:22:01PM +0000, Prabhakar wrote: > > From: Lad Prabhakar > > > > Introduce ALTERNATIVE_3() macro. > > Bit perfunctory I think! There's a lovely comment down below that would > make for a better commit message if you were to yoink it. > Content looks about what I'd expect to see though. Also both the comment on the original ALTERNATIVE_2 and the new ALTERNATIVE_3 should probably be merged into a single comment explaining this once for all ALTERNATIVE_x variants. Especially with the dma stuff, I'm pretty sure we'll get at least an ALTERNATIVE_4 if not even more ;-) . So we defnitly don't want to repeat this multiple times. Heiko > > Signed-off-by: Lad Prabhakar > > --- > > RFC v3 -> v4 > > * New patch > > --- > > arch/riscv/include/asm/alternative-macros.h | 94 +++++++++++++++++++++ > > 1 file changed, 94 insertions(+) > > > > diff --git a/arch/riscv/include/asm/alternative-macros.h b/arch/riscv/include/asm/alternative-macros.h > > index ec2f3f1b836f..1caf4306b3d6 100644 > > --- a/arch/riscv/include/asm/alternative-macros.h > > +++ b/arch/riscv/include/asm/alternative-macros.h > > @@ -69,6 +69,34 @@ > > new_c_2, vendor_id_2, errata_id_2, \ > > IS_ENABLED(CONFIG_k_2) > > > > +.macro __ALTERNATIVE_CFG_3 old_c, new_c_1, vendor_id_1, errata_id_1, enable_1, \ > > + new_c_2, vendor_id_2, errata_id_2, enable_2, \ > > + new_c_3, vendor_id_3, errata_id_3, enable_3 > > +886 : > > + .option push > > + .option norvc > > + .option norelax > > + \old_c > > + .option pop > > +887 : > > + ALT_NEW_CONTENT \vendor_id_1, \errata_id_1, \enable_1, \new_c_1 > > + ALT_NEW_CONTENT \vendor_id_2, \errata_id_2, \enable_2, \new_c_2 > > + ALT_NEW_CONTENT \vendor_id_3, \errata_id_3, \enable_3, \new_c_3 > > +.endm > > + > > +#define _ALTERNATIVE_CFG_3(old_c, new_c_1, vendor_id_1, errata_id_1, \ > > + CONFIG_k_1, \ > > + new_c_2, vendor_id_2, errata_id_2, \ > > + CONFIG_k_2, \ > > + new_c_3, vendor_id_3, errata_id_3, \ > > + CONFIG_k_3) \ > > + __ALTERNATIVE_CFG_3 old_c, new_c_1, vendor_id_1, errata_id_1, \ > > + IS_ENABLED(CONFIG_k_1), \ > > + new_c_2, vendor_id_2, errata_id_2, \ > > + IS_ENABLED(CONFIG_k_2), \ > > + new_c_3, vendor_id_3, errata_id_3, \ > > + IS_ENABLED(CONFIG_k_3) > > + > > #else /* !__ASSEMBLY__ */ > > > > #include > > @@ -135,6 +163,36 @@ > > new_c_2, vendor_id_2, errata_id_2, \ > > IS_ENABLED(CONFIG_k_2)) > > > > +#define __ALTERNATIVE_CFG_3(old_c, new_c_1, vendor_id_1, errata_id_1, \ > > + enable_1, \ > > + new_c_2, vendor_id_2, errata_id_2, \ > > + enable_2, \ > > + new_c_3, vendor_id_3, errata_id_3, \ > > + enable_3) \ > > + "886 :\n" \ > > + ".option push\n" \ > > + ".option norvc\n" \ > > + ".option norelax\n" \ > > + old_c "\n" \ > > + ".option pop\n" \ > > + "887 :\n" \ > > + ALT_NEW_CONTENT(vendor_id_1, errata_id_1, enable_1, new_c_1) \ > > + ALT_NEW_CONTENT(vendor_id_2, errata_id_2, enable_2, new_c_2) \ > > + ALT_NEW_CONTENT(vendor_id_3, errata_id_3, enable_3, new_c_3) > > + > > +#define _ALTERNATIVE_CFG_3(old_c, new_c_1, vendor_id_1, errata_id_1, \ > > + CONFIG_k_1, \ > > + new_c_2, vendor_id_2, errata_id_2, \ > > + CONFIG_k_2, \ > > + new_c_3, vendor_id_3, errata_id_3, \ > > + CONFIG_k_3) \ > > + __ALTERNATIVE_CFG_3(old_c, new_c_1, vendor_id_1, errata_id_1, \ > > + IS_ENABLED(CONFIG_k_1), \ > > + new_c_2, vendor_id_2, errata_id_2, \ > > + IS_ENABLED(CONFIG_k_2), \ > > + new_c_3, vendor_id_3, errata_id_3, \ > > + IS_ENABLED(CONFIG_k_3)) > > + > > #endif /* __ASSEMBLY__ */ > > > > #else /* CONFIG_RISCV_ALTERNATIVE */ > > @@ -153,6 +211,14 @@ > > CONFIG_k_2) \ > > __ALTERNATIVE_CFG old_c > > > > +#define _ALTERNATIVE_CFG_3(old_c, new_c_1, vendor_id_1, errata_id_1, \ > > + CONFIG_k_1, \ > > + new_c_2, vendor_id_2, errata_id_2, \ > > + CONFIG_k_2, \ > > + new_c_3, vendor_id_3, errata_id_3, \ > > + CONFIG_k_3) \ > > + __ALTERNATIVE_CFG old_c > > + > > #else /* !__ASSEMBLY__ */ > > > > #define __ALTERNATIVE_CFG(old_c) \ > > @@ -167,6 +233,14 @@ > > CONFIG_k_2) \ > > __ALTERNATIVE_CFG(old_c) > > > > +#define _ALTERNATIVE_CFG_3(old_c, new_c_1, vendor_id_1, errata_id_1, \ > > + CONFIG_k_1, \ > > + new_c_2, vendor_id_2, errata_id_2, \ > > + CONFIG_k_2, \ > > + new_c_3, vendor_id_3, errata_id_3, \ > > + CONFIG_k_3) \ > > + __ALTERNATIVE_CFG(old_c) > > + > > #endif /* __ASSEMBLY__ */ > > #endif /* CONFIG_RISCV_ALTERNATIVE */ > > > > @@ -202,4 +276,24 @@ > > new_content_2, vendor_id_2, \ > > errata_id_2, CONFIG_k_2) > > > > +/* > > + * A vendor wants to replace an old_content, but another vendor has used > > + * ALTERNATIVE_2() to patch its customized content at the same location. In > > + * this case, this vendor can create a new macro ALTERNATIVE_3() based > > + * on the following sample code and then replace ALTERNATIVE_2() with > > + * ALTERNATIVE_3() to append its customized content. > > + */ > > +#define ALTERNATIVE_3(old_content, new_content_1, vendor_id_1, \ > > + errata_id_1, CONFIG_k_1, \ > > + new_content_2, vendor_id_2, \ > > + errata_id_2, CONFIG_k_2, \ > > + new_content_3, vendor_id_3, \ > > + errata_id_3, CONFIG_k_3) \ > > + _ALTERNATIVE_CFG_3(old_content, new_content_1, vendor_id_1, \ > > + errata_id_1, CONFIG_k_1, \ > > + new_content_2, vendor_id_2, \ > > + errata_id_2, CONFIG_k_2, \ > > + new_content_3, vendor_id_3, \ > > + errata_id_3, CONFIG_k_3) > > + > > #endif >