Skip to contentSkip to conversation

arm64: sysreg: Fix sysreg field definitions and generation script

PATCH In review Fuad Tabba 1 participant 2 messages Sep 9, 2025 KVM arm64

lore
Share & tools
lore

Fuad Tabba

author
#0 lore raw

v3 cover arm64: sysreg: Fix sysreg field definitions and generation script

The sysreg definitions file has a few errors. In Enum Security, NSACR_RFR is set to 0b0001 instead of the spec value of 0b0010. Additionaly, the sign of the Enums DoubleLock and EIESB are wrong (should be Signed and Unsigned, respectively).

Moreover, the file has some redundant definitions, e.g., RCWSMASK_EL1. While these redundant definitions are not wrong per se, they add unnecessary code into the generated header file and could be a source of future bugs.

Fix the Enums and remove the redundant Sysreg definitions.

To reduce the chance of this happening in the future, add validation to the sysreg header generation script. I didn't want to go overboard with validation, so I only added validation that would catch most of the errors that I've seen, which also are errors that wouldn't generate a build error later on.

Changes since v2 [1]:
- Added patch that fixes field sign definitions for DoubleLock and EIESB
- Removed whitespace fixes from first patch, since there are more inconsistent whitespace use in the file, and fixing it all would lead to too much churn.
- Collected Reviews/Acks
- Rebased on 6.17-rc3

Cheers,
/fuad

[1] https://lore.kernel.org/all/[email protected]/

Fuad Tabba (3):
arm64: sysreg: Fix and tidy up sysreg field definitions
arm64: sysreg: Correct sign definitions for EIESB and DoubleLock
arm64: sysreg: Add validation checks to sysreg header generation
script

 arch/arm64/tools/gen-sysreg.awk | 20 ++++++++++++++++++++
 arch/arm64/tools/sysreg         | 18 +++++-------------
 2 files changed, 25 insertions(+), 13 deletions(-)

base-commit: 1b237f190eb3d36f52dffe07a40b5eb210280e00

Signature · 1 line
2.51.0.338.gd7d06c2dae-goog
author
#1 lore raw

I sent this cover letter out by mistake. Sorry for the noise.

Cheers,
/fuad

Quoted 47 lines · Fuad Tabba

The sysreg definitions file has a few errors. In Enum Security, NSACR_RFR is set to 0b0001 instead of the spec value of 0b0010. Additionaly, the sign of the Enums DoubleLock and EIESB are wrong (should be Signed and Unsigned, respectively).

Moreover, the file has some redundant definitions, e.g., RCWSMASK_EL1. While these redundant definitions are not wrong per se, they add unnecessary code into the generated header file and could be a source of future bugs.

Fix the Enums and remove the redundant Sysreg definitions.

To reduce the chance of this happening in the future, add validation to the sysreg header generation script. I didn't want to go overboard with validation, so I only added validation that would catch most of the errors that I've seen, which also are errors that wouldn't generate a build error later on.

Changes since v2 [1]:
- Added patch that fixes field sign definitions for DoubleLock and EIESB
- Removed whitespace fixes from first patch, since there are more inconsistent whitespace use in the file, and fixing it all would lead to too much churn.
- Collected Reviews/Acks
- Rebased on 6.17-rc3

Cheers,
/fuad

[1] https://lore.kernel.org/all/[email protected]/

Fuad Tabba (3):
arm64: sysreg: Fix and tidy up sysreg field definitions
arm64: sysreg: Correct sign definitions for EIESB and DoubleLock
arm64: sysreg: Add validation checks to sysreg header generation
script

 arch/arm64/tools/gen-sysreg.awk | 20 ++++++++++++++++++++
 arch/arm64/tools/sysreg         | 18 +++++-------------
 2 files changed, 25 insertions(+), 13 deletions(-)

base-commit: 1b237f190eb3d36f52dffe07a40b5eb210280e00 --
2.51.0.338.gd7d06c2dae-goog