Re: [PATCH v3 1/7] arm64/sysreg: Convert CCSIDR_EL1 to automatic generation

From: Marc Zyngier
Date: Mon Dec 19 2022 - 10:27:30 EST


On Mon, 19 Dec 2022 15:00:15 +0000,
Mark Brown <broonie@xxxxxxxxxx> wrote:
>
> [1 <text/plain; us-ascii (7bit)>]
> On Sun, Dec 18, 2022 at 01:11:01PM +0000, Marc Zyngier wrote:
> > Akihiko Odaki <akihiko.odaki@xxxxxxxxxx> wrote:
>
> > > arch/arm64/tools/gen-sysreg.awk does not allow a hole and requires all
> > > bits are described hence these descriptions. If you have an
> > > alternative idea I'd like to hear.
>
> > I'd simply suggest creating an UNKNOWN field encompassing bits
> > [21:28]. Alternatively, feel free to try the patch below, which allows
> > you to describe these 4 bits as "Unkn 31:28", similar to Res0/Res1.
>
> I agree, where practical we should add new field types and other
> features as needed rather than trying to shoehorn things into what the
> tool currently supports. It is very much a work in progress which can't
> fully represent everything in the spec yet. For things like the
> registers with multiple possible views it's much more effort which
> shouldn't get in the way of progress on features but with something like
> this just updating the tool so we can match the architecture spec is the
> right thing.

I was tempted to add a Namespace tag that wouldn't generate the sysreg
#defines, but only generate the fields with a feature-specific
namespace. For example:

Sysreg CCSIDR_EL1 3 1 0 0 0
Res0 63:32
Unkn 31:28
Field 27:13 NumSets
Field 12:3 Associativity
Field 2:0 LineSize
EndSysreg

Namespace CCIDX CCSIDR_EL1
Res0 63:56
Field 55:32 NumSets
Res0 31:25
Field 24:3 Associativity
Field 2:0 LineSize
EndSysreg

the later generating:

#define CCIDR_EL1_CCIDX_RES0 (GENMASK(63, 56) | GENMASK(31, 25))
#define CCIDR_EL1_CCIDX_NumSets GENMASK(55, 32)
#define CCIDR_EL1_CCIDX_Associativity GENMASK(24, 3)
#define CCIDR_EL1_CCIDX_LineSize GENMASK(2, 0)

Thoughts?

>
> > Define an 'Unkn' field type modeled after the Res0/Res1 types
> > to allow such description. This allows the generation of
>
> I'd be tempted to spell out Unknown fully since Unkn is not such a
> common abbreviation but I can see the desire to keep the name shorter
> and it doesn't really matter so either way:
>
> Reviewed-by: Mark Brown <broonie@xxxxxxxxxx>

Yeah, this stuff is write-only most of the time, and I like my fields
aligned if at all possible.

Thanks,

M.

--
Without deviation from the norm, progress is not possible.