[PATCH 1/4] arm64/sysreg: Allow a 'Mapping' descriptor for system registers
Mark Rutland
mark.rutland at arm.com
Mon Dec 9 05:56:23 PST 2024
On Sat, Dec 07, 2024 at 07:07:37PM +0000, Marc Zyngier wrote:
> *EL02 and *_EL12 system registers are actually only accessors for
> EL0 and EL1 registers accessed from EL2 when HCR_EL2.E2H==1. They
> do not have fields of their own.
>
> To that effect, introduce a 'Mapping' entry, describing which
> system register an _EL12 register maps to.
>
> Implementation wise, this is handled the same was as Fields,
> which ls only a comment.
>
> Signed-off-by: Marc Zyngier <maz at kernel.org>
> ---
> arch/arm64/tools/gen-sysreg.awk | 2 +-
> arch/arm64/tools/sysreg | 7 +++++++
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/tools/gen-sysreg.awk b/arch/arm64/tools/gen-sysreg.awk
> index d1254a056114e..1a2afc9fdd42e 100755
> --- a/arch/arm64/tools/gen-sysreg.awk
> +++ b/arch/arm64/tools/gen-sysreg.awk
> @@ -206,7 +206,7 @@ END {
>
> # Currently this is effectivey a comment, in future we may want to emit
> # defines for the fields.
> -/^Fields/ && block_current() == "Sysreg" {
> +(/^Fields/ || /^Mapping/) && block_current() == "Sysreg" {
> expect_fields(2)
>
> if (next_bit != 63)
> diff --git a/arch/arm64/tools/sysreg b/arch/arm64/tools/sysreg
> index b081b54d6d227..b6846c601df6c 100644
> --- a/arch/arm64/tools/sysreg
> +++ b/arch/arm64/tools/sysreg
> @@ -38,6 +38,13 @@
> # Fields <fieldsname>
> # EndSysreg
>
> +# For register names indicating a cross-EL access (*_EL12, *EL02),
> +# a Mapping entry describes the register it actually accesses:
It might be better to say:
| For VHE aliases (*_EL12, *_EL02) of system registers, a Mapping entry
| describes the register the alias actually accesses:
... and with that'd it's probably best to place this above the
description of SysregFields, so that people see this first and don't
copy the anti-pattern you're trying to remove.
For SysregFields we could clarify the existing wording to:
| Where multiple system regsiters are not VHE aliases but share a common
| layout, a SysregFields block can be used to describe the shared
| layout:
With or without those changes:
Acked-by: Mark Rutland <mark.rutland at arm.com>
Mark.
> +
> +# Sysreg <name_EL12> <op0> <op1> <crn> <crm> <op2>
> +# Mapping <name_EL1>
> +# EndSysreg
> +
> # For ID registers we adopt a few conventions for translating the
> # language in the ARM into defines:
> #
> --
> 2.39.2
>
More information about the linux-arm-kernel
mailing list