[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALs-HsvdXu+Ag50FpdCRthZamP+pzsqhxr2rnA+=Ko_sZ98z9A@mail.gmail.com>
Date: Wed, 28 Jun 2023 10:50:55 -0700
From: Evan Green <evan@...osinc.com>
To: Conor Dooley <conor@...nel.org>
Cc: Conor Dooley <conor.dooley@...rochip.com>, palmer@...belt.com,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Albert Ou <aou@...s.berkeley.edu>,
Andrew Jones <ajones@...tanamicro.com>,
Heiko Stuebner <heiko.stuebner@...ll.eu>,
Sunil V L <sunilvl@...tanamicro.com>,
linux-riscv@...ts.infradead.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 6/9] RISC-V: add single letter extensions to riscv_isa_ext
On Wed, Jun 28, 2023 at 10:43 AM Conor Dooley <conor@...nel.org> wrote:
>
> On Wed, Jun 28, 2023 at 10:33:20AM -0700, Evan Green wrote:
> > On Mon, Jun 26, 2023 at 4:21 AM Conor Dooley <conor.dooley@...rochip.com> wrote:
> > >
> > > So that riscv_fill_hwcap() can use riscv_isa_ext to probe for single
> > > letter extensions, add them to it. riscv_isa_ext_data grows a new
> > > member, signifying whether an extension is multi-letter & thus requiring
> > > special handling.
> > > As a result, what gets spat out in /proc/cpuinfo will become borked, as
> > > single letter extensions will be printed as part of the base extensions
> > > and while printing from riscv_isa_arr. Take the opportunity to unify the
> > > printing of the isa string, using the new member of riscv_isa_ext_data
> > > in the process.
> > >
> > > Signed-off-by: Conor Dooley <conor.dooley@...rochip.com>
> > > ---
> > > arch/riscv/include/asm/hwcap.h | 1 +
> > > arch/riscv/kernel/cpu.c | 36 ++++++----------------
> > > arch/riscv/kernel/cpufeature.c | 56 +++++++++++++++++++++-------------
> > > 3 files changed, 46 insertions(+), 47 deletions(-)
> > >
> > > diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h
> > > index a35bee219dd7..6ad896dc4342 100644
> > > --- a/arch/riscv/include/asm/hwcap.h
> > > +++ b/arch/riscv/include/asm/hwcap.h
> > > @@ -77,6 +77,7 @@ unsigned long riscv_get_elf_hwcap(void);
> > > struct riscv_isa_ext_data {
> > > const unsigned int id;
> > > const char *name;
> > > + const bool multi_letter;
> >
> > Instead of defining a new member, could we just infer this by making a
> > macro like #define MULTI_LETTER(name) (name[0] && name[1])?
>
> Or don't even try to be clever like this and just call strnlen on the
> name & check if it is 1? It's only used in 2 places.
Sounds good to me!
Powered by blists - more mailing lists