[PATCH v4 0/5] arm64/cpufeature: Make use of sysreg helpers for hwcaps

Mark Brown broonie at kernel.org
Mon Jan 30 16:18:42 PST 2023


Now that all the ID registers we use have been converted to automatic
register generation we can start to make use of the regular definitions
we have for the registers and their bitfields to make the hwcap tables
easier to write and review.  This series does that, updating the macros
used to generate the hwcaps to provide what should be clearer and less
error prone specifications for the hwcaps.  We move from specifying like
this:

      HWCAP_CAP(SYS_ID_AA64PFR1_EL1, ID_AA64PFR1_EL1_BT_SHIFT, 4, FTR_UNSIGNED, ID_AA64PFR1_EL1_BT_IMP, CAP_HWCAP, KERNEL_HWCAP_BTI),

to this:

      HWCAP_CAP(ID_AA64PFR1_EL1, BT, IMP, CAP_HWCAP, KERNEL_HWCAP_BTI),

which is shorter due to having less duplicate information and makes it
much harder to make an error like specifying the wrong field width or
an invalid enumeration value since everything must be a constant defined
for the sysreg and names are only typed once.

Due to the fact that this will conflict with anything else that touches
the hwcaps it would be good to either merge this late in a release cycle 
after any other updates have been merged or very early, before anything
else has been merged.

There is no difference in the .rodata generated before and after these
changes.

While doing this I found some errors which I have previously posted,
I've rolled those fixes into this series for simplicity.

Changes in v4:
- Rebase onto current for-next/core, rolling in SME2 and compat hwcaps.
- Link to v3: https://lore.kernel.org/r/20221207-arm64-sysreg-helpers-v3-0-0d71a7b174a8@kernel.org
v3:
- Rebase onto v6.2-rc1.
- Link to v2: https://lore.kernel.org/r/20221207-arm64-sysreg-helpers-v2-0-19f0e63dbb36@kernel.org
v2:
- Also add an explicit UnsignedEnum and don't generate sign defines for
  unannotated enums.
- Annotate the unsigned enums that we use.
- Rename the new defines from _SIGN to _SIGNED.
- Commit message rewording and thinko fixes.
- Link to v1: https://lore.kernel.org/r/20221207-arm64-sysreg-helpers-v1-0-149fa1308a23@kernel.org

Signed-off-by: Mark Brown <broonie at kernel.org>
---
Mark Brown (5):
      arm64/sysreg: Allow enumerations to be declared as signed or unsigned
      arm64/sysreg: Initial annotation of signed ID registers
      arm64/sysreg: Initial unsigned annotations for ID registers
      arm64/cpufeature: Always use symbolic name for feature value in hwcaps
      arm64/cpufeature: Use helper macros to specify hwcaps

 arch/arm64/kernel/cpufeature.c  | 209 +++++++++++-----------
 arch/arm64/tools/gen-sysreg.awk |  29 +++
 arch/arm64/tools/sysreg         | 381 ++++++++++++++++++++--------------------
 3 files changed, 321 insertions(+), 298 deletions(-)
---
base-commit: f54a337ba1f5c4b0215837a8c17629a0e9af8a8a
change-id: 20221207-arm64-sysreg-helpers-6734642b7fb9

Best regards,
-- 
Mark Brown <broonie at kernel.org>




More information about the linux-arm-kernel mailing list