[PATCH v4 01/29] arm64: sysreg: Emit RESx/UNKN values for Mapping/Fields definitions
Mark Rutland
mark.rutland at arm.com
Thu Jul 30 03:23:34 PDT 2026
On Thu, Jul 30, 2026 at 08:09:54AM +0100, Marc Zyngier wrote:
> The sysreg file is using the Mapping or Fields qualifiers to indicate
> that a given encoding is only a mapping to a particular register (or
> an instance of a more generic register definition).
>
> As a result, we don't output any definition, and instead expect
> the canonical definitions to be used.
>
> This works rather well for individual fields, but creates problems
> for macros that refer to more generic classes of bits such as RESx.
>
> Relax the above rule by emitting the RESx and UNKN values for Mapping
> and Fields qualifiers as well.
It might be worth stating a bit more explicitly, something like:
Emit RESx and UNKN values for Mapping and Fields qualifiers as well,
defining these in terms of the RESx and UNKN values for the canonical
Sysreg or SysregFields definition.
For example, the following defintion:
| Sysreg FOO ...
| Fields BAR
| EndSysreg
... will generate:
| #define FOO_RES0 (BAR_RES0)
| #define FOO_RES1 (BAR_RES1)
| #define FOO_RES0 (BAR_UNKN)
Regardless of the above, the patch looks reasonable to me, so:
Acked-by: Mark Rutland <mark.rutland at arm.com>
Mark.
> Signed-off-by: Marc Zyngier <maz at kernel.org>
> ---
> arch/arm64/tools/gen-sysreg.awk | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/tools/gen-sysreg.awk b/arch/arm64/tools/gen-sysreg.awk
> index 86860ab672dc7..53844f5c5e525 100755
> --- a/arch/arm64/tools/gen-sysreg.awk
> +++ b/arch/arm64/tools/gen-sysreg.awk
> @@ -228,7 +228,7 @@ $1 == "EndSysreg" && block_current() == "Sysreg" {
> }
>
> # Currently this is effectivey a comment, in future we may want to emit
> -# defines for the fields.
> +# defines for the fields. We do emit RESx and UNKN values in any case.
> ($1 == "Fields" || $1 == "Mapping") && block_current() == "Sysreg" {
> expect_fields(2)
>
> @@ -239,9 +239,9 @@ $1 == "EndSysreg" && block_current() == "Sysreg" {
> print ""
>
> next_bit = -1
> - res0 = null
> - res1 = null
> - unkn = null
> + res0 = $2 "_RES0"
> + res1 = $2 "_RES1"
> + unkn = $2 "_UNKN"
>
> next
> }
> --
> 2.47.3
>
>
More information about the linux-arm-kernel
mailing list