Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Fuad Tabba <fuad.tabba@linux.dev>
To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
	Mark Brown <broonie@kernel.org>,
	Sascha Bischoff <Sascha.Bischoff@arm.com>,
	Steffen Eiden <seiden@linux.ibm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Fuad Tabba <tabba@google.com>
Subject: [PATCH 3/9] arm64: sysreg: Reject a Sysreg and a SysregFields with the same name
Date: Mon, 23 Nov 2026 07:52:13 +0000	[thread overview]
Message-ID: <20261123075219.369042-4-fuad.tabba@linux.dev> (raw)
In-Reply-To: <20261123075219.369042-1-fuad.tabba@linux.dev>

The generator rejects two Sysreg blocks, or two SysregFields blocks,
with the same name, but tracks the two kinds separately. Both kinds name
their macros for the block, so a Sysreg FOO and a SysregFields FOO that
each have a field A both define FOO_A, as well as FOO_RES0 and the other
masks, and the compiler warns only where the definitions differ.

Track both kinds of name in defined_regs, so that a block is rejected
when either kind already has its name, and leave the kind out of the
error.

Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
---
 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 b299342463631..8ce4981273dd3 100755
--- a/arch/arm64/tools/gen-sysreg.awk
+++ b/arch/arm64/tools/gen-sysreg.awk
@@ -137,9 +137,9 @@ $1 == "SysregFields" && block_current() == "Root" {
 	res1 = "UL(0)"
 	unkn = "UL(0)"
 
-	if (reg in defined_fields)
-		fatal("Duplicate SysregFields definition for " reg)
-	defined_fields[reg] = 1
+	if (reg in defined_regs)
+		fatal("Duplicate definition for " reg)
+	defined_regs[reg] = 1
 
 	next_bit = 63
 
@@ -181,7 +181,7 @@ $1 == "Sysreg" && block_current() == "Root" {
 	unkn = "UL(0)"
 
 	if (reg in defined_regs)
-		fatal("Duplicate Sysreg definition for " reg)
+		fatal("Duplicate definition for " reg)
 	defined_regs[reg] = 1
 
 	define_reg("REG_" reg, "S" op0 "_" op1 "_C" crn "_C" crm "_" op2)
-- 
2.47.3



  parent reply	other threads:[~2026-11-23  7:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261123075219.369042-1-fuad.tabba@linux.dev>
2026-11-23  7:52 ` [PATCH 1/9] arm64: sysreg: Map MPAM1_EL12 to MPAM1_EL1 Fuad Tabba
2026-11-23  7:52 ` [PATCH 2/9] arm64: sysreg: Remove the dead range check from parse_bitdef() Fuad Tabba
2026-11-23  7:52 ` Fuad Tabba [this message]
2026-11-23  7:52 ` [PATCH 6/9] arm64: sysreg: Reject an enum value not written at its field's width Fuad Tabba
2026-11-23  7:52 ` [PATCH 7/9] arm64: sysreg: Reject a macro name defined twice Fuad Tabba
2026-11-23  7:52 ` [PATCH 9/9] arm64: sysreg: Reject a bit position written with a leading zero Fuad Tabba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123075219.369042-4-fuad.tabba@linux.dev \
    --to=fuad.tabba@linux.dev \
    --cc=Sascha.Bischoff@arm.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=tabba@google.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox