[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4801607.MHq7AAxBmi@diego>
Date: Thu, 24 Nov 2022 20:58:41 +0100
From: Heiko Stübner <heiko@...ech.de>
To: Prabhakar <prabhakar.csengg@...il.com>,
Conor Dooley <conor@...nel.org>
Cc: Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor.dooley@...rochip.com>,
Guo Ren <guoren@...nel.org>,
Jisheng Zhang <jszhang@...nel.org>,
Atish Patra <atishp@...osinc.com>,
Anup Patel <apatel@...tanamicro.com>,
Andrew Jones <ajones@...tanamicro.com>,
Nathan Chancellor <nathan@...nel.org>,
Philipp Tomsich <philipp.tomsich@...ll.eu>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org, linux-renesas-soc@...r.kernel.org,
Biju Das <biju.das.jz@...renesas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
Subject: Re: [PATCH v4 1/7] riscv: asm: alternative-macros: Introduce ALTERNATIVE_3() macro
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 <prabhakar.mahadev-lad.rj@...renesas.com>
> >
> > 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 <prabhakar.mahadev-lad.rj@...renesas.com>
> > ---
> > 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 <asm/asm.h>
> > @@ -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
>
Powered by blists - more mailing lists