]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
arm64: sysreg: Add validation checks to sysreg header generation script
authorFuad Tabba <tabba@google.com>
Fri, 29 Aug 2025 09:51:43 +0000 (10:51 +0100)
committerWill Deacon <will@kernel.org>
Thu, 11 Sep 2025 13:46:07 +0000 (14:46 +0100)
commit382cbbe7fb2ae841a7e7b4c40a02f12afc803c69
treeba0e3398dbd7a7aafa87966f4556d06f6f1b1791
parentf4d4ebc84995178273740f3e601e97fdefc561d2
arm64: sysreg: Add validation checks to sysreg header generation script

The gen_sysreg.awk script processes the system register specification in
the sysreg text file to generate C macro definitions. The current script
will silently accept certain errors in the specification file, leading
to incorrect header generation.

For example, a Sysreg or SysregFields can be accidentally duplicated,
causing its macros to be emitted twice. An Enum can contain duplicate
values for different items, which is architecturally incorrect.

Add checks to catch these errors at build time. The script now tracks
all seen Sysreg and SysregFields definitions and checks for duplicates.
It also tracks values within each Enum block to ensure entries are
unique.

Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Fuad Tabba <tabba@google.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/tools/gen-sysreg.awk