Re: [PATCH 6/9] arm64: sysreg: Reject an enum value not written at its field's width

From: Fuad Tabba

Date: Mon Nov 23 2026 - 05:48:06 EST


Hi Steffen,

On Mon, 23 Nov 2026 at 10:45, Steffen Eiden <seiden@xxxxxxxxxxxxx> wrote:
>
> On Mon, Nov 23, 2026 at 07:52:16AM +0000, Fuad Tabba wrote:
> > The generator emits each enum value as written and doesn't check it
> > against the width of its field, so a value wider than the field defines
> > a constant the field can't hold. The duplicate value check compares the
> > strings as written, so 0b01 and 0b001 in the same field pass as distinct
> > values, and the rule's pattern, an unanchored /0b[01]+/, accepts 0b12
> > too.
> >
> > Require each value to be 0b followed by exactly as many binary digits as
> > its field has bits. The one enum written otherwise is TS, a two-bit
> > field of TRFCR_EL1 and TRFCR_EL2 whose values have four digits. Write
> > them with two digits, which leaves the numbers unchanged.
> >
> > Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
> > ---
> > arch/arm64/tools/gen-sysreg.awk | 3 +++
> > arch/arm64/tools/sysreg | 14 +++++++-------
> > 2 files changed, 10 insertions(+), 7 deletions(-)
> >
>
> Lets split this patch into two:
>
> 1. Fix the bitwidth of the Enums
> 2. Add the new check to the awk script
>
> Then the fix is split apart from the enforcement.

Ack.

Thanks for the reviews!
/fuad