From: Ada Couprie Diaz <ada.coupriediaz@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Mark Rutland <mark.rutland@arm.com>,
Marc Zyngier <maz@kernel.org>, Barry Song <baohua@kernel.org>,
Vladimir Murzin <vladimir.murzin@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Lucas Wei <lucaswei@google.com>, Mark Brown <broonie@kernel.org>,
Andre Przywara <andre.przywara@arm.com>,
Tejun Heo <tj@kernel.org>, Oliver Upton <oupton@kernel.org>,
Will Deacon <will@kernel.org>,
Sascha Bischoff <Sascha.Bischoff@arm.com>
Subject: [PATCH 2/4] arm64: insn: fix system register inconsistencies
Date: Fri, 16 Oct 2026 17:46:46 +0100 [thread overview]
Message-ID: <20261016164648.251258-3-ada.coupriediaz@arm.com> (raw)
In-Reply-To: <20261016164648.251258-1-ada.coupriediaz@arm.com>
Two registers in `enum aarch64_insn_special_register` are defined
incorrectly :
- SPSR_IRQ is named SPSR_I*N*Q
- SP_EL2's encoding is incorrect and does not correspond to ant register
Fix those issues and re-order the registers by value.
Update `enum aarch64_insn_system_register` values and order to be in line
with `enum aarch64_insn_special_register`, so that we can make
`aarch64_insn_gen_mrs()` use the same mask as
`aarch64_insn_extract_system_reg()` while we're here.
This does not change the behaviour, as `aarch64_insn_encode_register()`
always masks the lower bits and the top bit of registers are always set.
Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
---
arch/arm64/include/asm/insn.h | 12 ++++++------
arch/arm64/lib/insn.c | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h
index c91a8431c961e..2e45f6e80d15f 100644
--- a/arch/arm64/include/asm/insn.h
+++ b/arch/arm64/include/asm/insn.h
@@ -119,27 +119,27 @@ enum aarch64_insn_special_register {
AARCH64_INSN_SPCLREG_SP_EL0 = 0xC208,
AARCH64_INSN_SPCLREG_SPSEL = 0xC210,
AARCH64_INSN_SPCLREG_CURRENTEL = 0xC212,
- AARCH64_INSN_SPCLREG_DAIF = 0xDA11,
AARCH64_INSN_SPCLREG_NZCV = 0xDA10,
+ AARCH64_INSN_SPCLREG_DAIF = 0xDA11,
AARCH64_INSN_SPCLREG_FPCR = 0xDA20,
AARCH64_INSN_SPCLREG_DSPSR_EL0 = 0xDA28,
AARCH64_INSN_SPCLREG_DLR_EL0 = 0xDA29,
AARCH64_INSN_SPCLREG_SPSR_EL2 = 0xE200,
AARCH64_INSN_SPCLREG_ELR_EL2 = 0xE201,
AARCH64_INSN_SPCLREG_SP_EL1 = 0xE208,
- AARCH64_INSN_SPCLREG_SPSR_INQ = 0xE218,
+ AARCH64_INSN_SPCLREG_SPSR_IRQ = 0xE218,
AARCH64_INSN_SPCLREG_SPSR_ABT = 0xE219,
AARCH64_INSN_SPCLREG_SPSR_UND = 0xE21A,
AARCH64_INSN_SPCLREG_SPSR_FIQ = 0xE21B,
AARCH64_INSN_SPCLREG_SPSR_EL3 = 0xF200,
AARCH64_INSN_SPCLREG_ELR_EL3 = 0xF201,
- AARCH64_INSN_SPCLREG_SP_EL2 = 0xF210
+ AARCH64_INSN_SPCLREG_SP_EL2 = 0xF208,
};
enum aarch64_insn_system_register {
- AARCH64_INSN_SYSREG_TPIDR_EL1 = 0x4684,
- AARCH64_INSN_SYSREG_TPIDR_EL2 = 0x6682,
- AARCH64_INSN_SYSREG_SP_EL0 = 0x4208,
+ AARCH64_INSN_SYSREG_SP_EL0 = 0xC208,
+ AARCH64_INSN_SYSREG_TPIDR_EL1 = 0xC684,
+ AARCH64_INSN_SYSREG_TPIDR_EL2 = 0xE682,
};
enum aarch64_insn_variant {
diff --git a/arch/arm64/lib/insn.c b/arch/arm64/lib/insn.c
index 5c37f3a4c402b..94ee1aae2f5b7 100644
--- a/arch/arm64/lib/insn.c
+++ b/arch/arm64/lib/insn.c
@@ -1566,7 +1566,7 @@ u32 aarch64_insn_gen_mrs(enum aarch64_insn_register result,
{
u32 insn = aarch64_insn_get_mrs_value();
- insn &= ~GENMASK(19, 0);
+ insn &= ~GENMASK(20, 5);
insn |= sysreg << 5;
return aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RT,
insn, result);
--
2.43.0
next prev parent reply other threads:[~2026-10-16 16:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 16:46 [PATCH 0/4] arm64: insn: fix sysreg encodings, simplify dependent code Ada Couprie Diaz
2026-10-16 16:46 ` [PATCH 1/4] arm64: sysreg: generate TPIDR, SP and DAIF encodings Ada Couprie Diaz
2026-10-20 9:16 ` Vladimir Murzin
2026-10-16 16:46 ` Ada Couprie Diaz [this message]
2026-10-20 9:47 ` [PATCH 2/4] arm64: insn: fix system register inconsistencies Vladimir Murzin
2026-10-16 16:46 ` [PATCH 3/4] arm64: insn: operate on MSR/MRS sysreg field via defines Ada Couprie Diaz
2026-10-20 10:12 ` Vladimir Murzin
2026-10-16 16:46 ` [PATCH 4/4] arm64: insn: clean-up sysregs handling Ada Couprie Diaz
2026-10-20 10:45 ` Vladimir Murzin
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=20261016164648.251258-3-ada.coupriediaz@arm.com \
--to=ada.coupriediaz@arm.com \
--cc=Sascha.Bischoff@arm.com \
--cc=andre.przywara@arm.com \
--cc=baohua@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=lucaswei@google.com \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=tj@kernel.org \
--cc=vladimir.murzin@arm.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