Skip to content

arm64: sysreg: More input checks in the sysreg generator

Fuad Tabba linux-arm-kernel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 19 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9arm64: sysreg: Map MPAM1_EL12 to MPAM1_EL1arch/arm64/tools/sysreg+1 -12 replies
2/9arm64: sysreg: Remove the dead range check from parse_bitdef()arch/arm64/tools/gen-sysreg.awk+0 -22 replies
3/9arm64: sysreg: Reject a Sysreg and a SysregFields with the same namearch/arm64/tools/gen-sysreg.awk+4 -42 replies
4/9arm64: sysreg: Don't run the end-of-file checks after an errorarch/arm64/tools/gen-sysreg.awk+5 -02 replies
5/9arm64: sysreg: Reject a Fields or Mapping line with an undefined targetarch/arm64/tools/gen-sysreg.awk+9 -22 replies
6/9arm64: sysreg: Reject an enum value not written at its field's widtharch/arm64/tools/gen-sysreg.awk arch/arm64/tools/sysreg+10 -73 replies
7/9arm64: sysreg: Reject a macro name defined twicearch/arm64/tools/gen-sysreg.awk+4 -02 replies
8/9arm64: sysreg: Reject an out-of-range register encodingarch/arm64/tools/gen-sysreg.awk+12 -02 replies
9/9arm64: sysreg: Reject a bit position written with a leading zeroarch/arm64/tools/gen-sysreg.awk+2 -12 replies

Reviews trailers per patch

8 of 9 patches have a Reviewed-by or Acked-by.

PatchSteffen EidenMark Brown
1/9R-b R-b
2/9R-b R-b
3/9R-b R-b
4/9R-b R-b
5/9R-b R-b
6/9R-b
7/9R-b R-b
8/9R-b R-b
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/9] arm64: sysreg: More input checks in the sysreg generator

Hi folks,

After finding yet another bug in the sysreg file, I think it's time to stop filling potholes and have the generator reject them instead.

The bug is in MPAM1_EL12. Its Fields line refers to a SysregFields block that doesn't exist, so its RES0, RES1 and UNKN masks expand to undefined names. The masks aren't used yet. Patch 1 fixes it.

The rest of the series adds checks to gen-sysreg.awk for input it accepts while the kernel still builds: a Sysreg and a SysregFields with the same name (Mark's suggestion [1]), a Fields or Mapping target that isn't defined, an enum value not written at its field's width, a macro defined twice, and an encoding or a bit position that's out of range or has a leading zero. Two patches prepare for them. One removes a range check that can never fail, and the other stops the end-of-file checks from running after an error.

With gawk, mawk and busybox awk, the generated header is the same before and after the series, apart from the MPAM1_EL12 lines and the number of digits in the TRFCR_ELx.TS values.

Based on Linux 7.4-rc3 (aebb727447640).

Cheers,
/fuad

[1] https://lore.kernel.org/all/aLF9mSCs1B2gk8BU@J2N7QTR9R3/

Fuad Tabba (9):
arm64: sysreg: Map MPAM1_EL12 to MPAM1_EL1
arm64: sysreg: Remove the dead range check from parse_bitdef()
arm64: sysreg: Reject a Sysreg and a SysregFields with the same name
arm64: sysreg: Don't run the end-of-file checks after an error
arm64: sysreg: Reject a Fields or Mapping line with an undefined
target
arm64: sysreg: Reject an enum value not written at its field's width
arm64: sysreg: Reject a macro name defined twice
arm64: sysreg: Reject an out-of-range register encoding
arm64: sysreg: Reject a bit position written with a leading zero

 arch/arm64/tools/gen-sysreg.awk | 48 ++++++++++++++++++++++++++-------
 arch/arm64/tools/sysreg         | 16 +++++------
 2 files changed, 47 insertions(+), 17 deletions(-)

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3

Signature · 1 line
2.47.3