mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Clark <james.clark@linaro.org>
To: linux-arm-kernel@lists.infradead.org, robh@kernel.org,
	broonie@kernel.org, maz@kernel.org
Cc: James Clark <james.clark@linaro.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Oliver Upton <oliver.upton@linux.dev>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	James Morse <james.morse@arm.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 5/5] arm64/sysreg: Enforce sorting
Date: Wed, 15 Jan 2025 13:42:57 +0000	[thread overview]
Message-ID: <20250115134259.1864060-6-james.clark@linaro.org> (raw)
In-Reply-To: <20250115134259.1864060-1-james.clark@linaro.org>

Make an unsorted sysreg file a build error so it stays sorted.

Signed-off-by: James Clark <james.clark@linaro.org>
---
 arch/arm64/tools/gen-sysreg.awk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm64/tools/gen-sysreg.awk b/arch/arm64/tools/gen-sysreg.awk
index 7f578216dc68..00a8391f373d 100755
--- a/arch/arm64/tools/gen-sysreg.awk
+++ b/arch/arm64/tools/gen-sysreg.awk
@@ -98,6 +98,7 @@ BEGIN {
 
 	__current_block_depth = 0
 	__current_block[__current_block_depth] = "Root"
+	__last_sysreg_sort_val = 0
 }
 
 END {
@@ -156,6 +157,12 @@ $1 == "Sysreg" && block_current() == "Root" {
 	crm = $6
 	op2 = $7
 
+	sort_val = sprintf("%02d", $3) sprintf("%02d", $4) sprintf("%02d", $5) \
+			sprintf("%02d", $6) sprintf("%02d", $7)
+	if (sort_val < __last_sysreg_sort_val)
+		fatal($2 ": Sysregs should be sorted by encoding")
+	__last_sysreg_sort_val = sort_val
+
 	res0 = "UL(0)"
 	res1 = "UL(0)"
 	unkn = "UL(0)"
-- 
2.34.1


  parent reply	other threads:[~2025-01-15 13:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-15 13:42 [PATCH 0/5] arm64/sysreg: Sort sysreg by encoding James Clark
2025-01-15 13:42 ` [PATCH 1/5] arm64/sysreg: Fix unbalanced closing block James Clark
2025-01-15 13:42 ` [PATCH 2/5] arm64/sysreg: Enforce whole line match for closing blocks James Clark
2025-01-15 13:47   ` Mark Brown
2025-01-15 14:17   ` Marc Zyngier
2025-01-15 15:48     ` James Clark
2025-01-15 13:42 ` [PATCH 3/5] arm64/sysreg: Enforce whole word for opening blocks James Clark
2025-01-15 13:42 ` [PATCH 4/5] arm64/sysreg: Sort sysreg by encoding James Clark
2025-01-15 13:42 ` James Clark [this message]
2025-01-15 14:12   ` [PATCH 5/5] arm64/sysreg: Enforce sorting Mark Brown

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=20250115134259.1864060-6-james.clark@linaro.org \
    --to=james.clark@linaro.org \
    --cc=anshuman.khandual@arm.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@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=oliver.upton@linux.dev \
    --cc=robh@kernel.org \
    --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

all inboxes | Powered by JetHome®