[PATCH V4 1/2] arm64/sysreg: Update TCR_EL1 register

Anshuman Khandual posted 2 patches 5 months ago
There is a newer version of this series
[PATCH V4 1/2] arm64/sysreg: Update TCR_EL1 register
Posted by Anshuman Khandual 5 months ago
Update TCR_EL1 register fields as per latest ARM ARM DDI 0487 L.B and while
here drop an explicit sysreg definition SYS_TCR_EL1 from sysreg.h, which is
now redundant.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
The updated TCR_EL1 fields also matches with latest released TCR_EL1 layout.

https://developer.arm.com/documentation/ddi0601/2025-06/AArch64-Registers/TCR-EL1--Translation-Control-Register--EL1-?lang=en

 arch/arm64/include/asm/sysreg.h |  2 --
 arch/arm64/tools/sysreg         | 52 ++++++++++++++++++++++++++++-----
 2 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index 6604fd6f33f4..71febc944adb 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -281,8 +281,6 @@
 #define SYS_RGSR_EL1			sys_reg(3, 0, 1, 0, 5)
 #define SYS_GCR_EL1			sys_reg(3, 0, 1, 0, 6)
 
-#define SYS_TCR_EL1			sys_reg(3, 0, 2, 0, 2)
-
 #define SYS_APIAKEYLO_EL1		sys_reg(3, 0, 2, 1, 0)
 #define SYS_APIAKEYHI_EL1		sys_reg(3, 0, 2, 1, 1)
 #define SYS_APIBKEYLO_EL1		sys_reg(3, 0, 2, 1, 2)
diff --git a/arch/arm64/tools/sysreg b/arch/arm64/tools/sysreg
index 696ab1f32a67..85da09795527 100644
--- a/arch/arm64/tools/sysreg
+++ b/arch/arm64/tools/sysreg
@@ -4756,17 +4756,53 @@ Field   37      TBI0
 Field   36      AS
 Res0    35
 Field   34:32   IPS
-Field   31:30   TG1
-Field   29:28   SH1
-Field   27:26   ORGN1
-Field   25:24   IRGN1
+Enum	31:30   TG1
+	0b01	16K
+	0b10	4K
+	0b11	64K
+EndEnum
+Enum	29:28   SH1
+	0b00	NONE
+	0b10	OUTER
+	0b11	INNER
+EndEnum
+Enum	27:26  ORGN1
+	0b00	NC
+	0b01	WBWA
+	0b10	WT
+	0b11	WBnWA
+EndEnum
+Enum	25:24   IRGN1
+	0b00	NC
+	0b01	WBWA
+	0b10	WT
+	0b11	WBnWA
+EndEnum
 Field   23      EPD1
 Field   22      A1
 Field   21:16   T1SZ
-Field   15:14   TG0
-Field   13:12   SH0
-Field   11:10   ORGN0
-Field   9:8     IRGN0
+Enum	15:14   TG0
+	0b00	4K
+	0b01	64K
+	0b10	16K
+EndEnum
+Enum	13:12   SH0
+	0b00	NONE
+	0b10	OUTER
+	0b11	INNER
+EndEnum
+Enum	11:10  ORGN0
+	0b00	NC
+	0b01	WBWA
+	0b10	WT
+	0b11	WBnWA
+EndEnum
+Enum	9:8   IRGN0
+	0b00	NC
+	0b01	WBWA
+	0b10	WT
+	0b11	WBnWA
+EndEnum
 Field   7       EPD0
 Res0    6
 Field   5:0     T0SZ
-- 
2.25.1
Re: [PATCH V4 1/2] arm64/sysreg: Update TCR_EL1 register
Posted by Mark Brown 5 months ago
On Sun, Sep 07, 2025 at 05:59:59PM +0530, Anshuman Khandual wrote:

> Update TCR_EL1 register fields as per latest ARM ARM DDI 0487 L.B and while
> here drop an explicit sysreg definition SYS_TCR_EL1 from sysreg.h, which is
> now redundant.

I actually checked against DDI0601 2025-06 to spare my poor machine the
strain of loading the ARM.

Reviewed-by: Mark Brown <broonie@kernel.org>

I guess the cleanup of the redundant definition could've been a separate
patch but it's not super important.
Re: [PATCH V4 1/2] arm64/sysreg: Update TCR_EL1 register
Posted by Anshuman Khandual 5 months ago

On 08/09/25 7:28 PM, Mark Brown wrote:
> On Sun, Sep 07, 2025 at 05:59:59PM +0530, Anshuman Khandual wrote:
> 
>> Update TCR_EL1 register fields as per latest ARM ARM DDI 0487 L.B and while
>> here drop an explicit sysreg definition SYS_TCR_EL1 from sysreg.h, which is
>> now redundant.
> 
> I actually checked against DDI0601 2025-06 to spare my poor machine the
> strain of loading the ARM.

Right, they are the same.
> 
> Reviewed-by: Mark Brown <broonie@kernel.org>

Thanks !
> 
> I guess the cleanup of the redundant definition could've been a separate
> patch but it's not super important.

Dropping SYS_TCR_EL1 definition from header (asm/sysreg.h)
into a separate patch ?

#define SYS_TCR_EL1 	sys_reg(3, 0, 2, 0, 2)
Re: [PATCH V4 1/2] arm64/sysreg: Update TCR_EL1 register
Posted by Mark Brown 5 months ago
On Tue, Sep 09, 2025 at 09:20:26AM +0530, Anshuman Khandual wrote:
> On 08/09/25 7:28 PM, Mark Brown wrote:

> > I guess the cleanup of the redundant definition could've been a separate
> > patch but it's not super important.

> Dropping SYS_TCR_EL1 definition from header (asm/sysreg.h)
> into a separate patch ?

> #define SYS_TCR_EL1 	sys_reg(3, 0, 2, 0, 2)

Yes.