Skip to contentSkip to conversation

Misc cleanups

PATCH In review Mark Rutland 3 participants 12 messages Aug 24, 2021 – Aug 25, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Misc cleanups

These are a few cleanup patches I've split out of my ongoing bootwrapper rework, and intend to apply by the end of this week.

My WIP cleanup branch with subsequent patches can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/mark/boot-wrapper-aarch64.git cleanup

Thanks,
Mark.

Mark Rutland (5):
Remove unused Set/Way cache helpers
aarch32: simplify _switch_monitor
GICv3: initialize without RMW
Rename kernel *_RESET values to *_KERNEL
Rename CNTFRQ -> COUNTER_FREQ

 Makefile.am                       |  4 ++--
 arch/aarch32/boot.S               | 25 +++++++------------------
 arch/aarch32/include/asm/cpu.h    | 30 ++----------------------------
 arch/aarch32/include/asm/gic-v3.h |  7 -------
 arch/aarch64/boot.S               |  6 +++---
 arch/aarch64/include/asm/cpu.h    | 32 +++-----------------------------
 arch/aarch64/include/asm/gic-v3.h |  7 -------
 common/gic-v3.c                   |  8 +++-----
 8 files changed, 20 insertions(+), 99 deletions(-)
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

PATCH 1/5 Remove unused Set/Way cache helpers

We removed the Set/Way cache maintenance in commit:

864182b26c20a39d ("Remove cache maintenance")

... but forgot to remove the arch helpers which are now unused.

Remove the unused helpers.

---
 arch/aarch32/include/asm/cpu.h | 26 --------------------------
 arch/aarch64/include/asm/cpu.h | 26 --------------------------
 2 files changed, 52 deletions(-)
arch/aarch32/include/asm/cpu.h +0 -26
index 878be67..a7993f0 100644
@@ -56,32 +56,6 @@ static inline uint32_t read_id_pfr1(void)
 	return val;
 }
 
-static inline uint32_t read_clidr(void)
-{
-	uint32_t val;
-
-	asm volatile ("mrc	p15, 1, %0, c0, c0, 1" : "=r" (val));
-	return val;
-}
-
-static inline uint32_t read_ccsidr(void)
-{
-	uint32_t val;
-
-	asm volatile ("mrc	p15, 1, %0, c0, c0, 0" : "=r" (val));
-	return val;
-}
-
-static inline void write_csselr(uint32_t val)
-{
-	asm volatile ("mcr	p15, 2, %0, c0, c0, 0" : : "r" (val));
-}
-
-static inline void dccisw(uint32_t val)
-{
-	asm volatile ("mcr	p15, 0, %0, c7, c14, 2" : : "r" (val));
-}
-
 static inline void iciallu(void)
 {
 	uint32_t val = 0;
arch/aarch64/include/asm/cpu.h +0 -26
index ccb5397..1cddbb8 100644
@@ -66,32 +66,6 @@ static inline uint64_t read_id_aa64pfr0(void)
 	return val;
 }
 
-static inline uint32_t read_clidr(void)
-{
-	uint32_t val;
-
-	asm volatile ("mrs	%0, clidr_el1" : "=r" (val));
-	return val;
-}
-
-static inline uint32_t read_ccsidr(void)
-{
-	uint32_t val;
-
-	asm volatile ("mrs	%0, ccsidr_el1" : "=r" (val));
-	return val;
-}
-
-static inline void write_csselr(uint32_t val)
-{
-	asm volatile ("msr	csselr_el1, %0" : : "r" (val));
-}
-
-static inline void dccisw(uint32_t val)
-{
-	asm volatile ("dc	cisw, %0" : : "r" (val));
-}
-
 static inline void iciallu(void)
 {
 	asm volatile ("ic	iallu");
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by on v1 1/5
#2 lore raw

Re: [boot-wrapper PATCH 1/5] Remove unused Set/Way cache helpers

Quoted 7 lines · Mark Rutland

We removed the Set/Way cache maintenance in commit:

   864182b26c20a39d ("Remove cache maintenance")

... but forgot to remove the arch helpers which are now unused.

Remove the unused helpers.

Indeed, no users in the tree.

Quoted 1 line

Thanks,
Andre

Quoted 70 lines
---
  arch/aarch32/include/asm/cpu.h | 26 --------------------------
  arch/aarch64/include/asm/cpu.h | 26 --------------------------
  2 files changed, 52 deletions(-)
arch/aarch32/include/asm/cpu.h +0 -26
index 878be67..a7993f0 100644
@@ -56,32 +56,6 @@ static inline uint32_t read_id_pfr1(void)
  	return val;
  }
 
-static inline uint32_t read_clidr(void)
-{
-	uint32_t val;
-
-	asm volatile ("mrc	p15, 1, %0, c0, c0, 1" : "=r" (val));
-	return val;
-}
-
-static inline uint32_t read_ccsidr(void)
-{
-	uint32_t val;
-
-	asm volatile ("mrc	p15, 1, %0, c0, c0, 0" : "=r" (val));
-	return val;
-}
-
-static inline void write_csselr(uint32_t val)
-{
-	asm volatile ("mcr	p15, 2, %0, c0, c0, 0" : : "r" (val));
-}
-
-static inline void dccisw(uint32_t val)
-{
-	asm volatile ("mcr	p15, 0, %0, c7, c14, 2" : : "r" (val));
-}
-
  static inline void iciallu(void)
  {
  	uint32_t val = 0;
arch/aarch64/include/asm/cpu.h +0 -19
index ccb5397..1cddbb8 100644
@@ -66,32 +66,6 @@ static inline uint64_t read_id_aa64pfr0(void)
  	return val;
  }
 
-static inline uint32_t read_clidr(void)
-{
-	uint32_t val;
-
-	asm volatile ("mrs	%0, clidr_el1" : "=r" (val));
-	return val;
-}
-
-static inline uint32_t read_ccsidr(void)
-{
-	uint32_t val;
-
-	asm volatile ("mrs	%0, ccsidr_el1" : "=r" (val));
-	return val;
-}
-
-static inline void write_csselr(uint32_t val)
-{
-	asm volatile ("msr	csselr_el1, %0" : : "r" (val));

arch/aarch64/include/asm/cpu.h static inline uint64_t read_id_aa64pfr0(void) · line 71

Quoted 10 lines
arch/aarch64/include/asm/cpu.h +0 -7
-}
-
-static inline void dccisw(uint32_t val)
-{
-	asm volatile ("dc	cisw, %0" : : "r" (val));
-}
-
  static inline void iciallu(void)
  {
  	asm volatile ("ic	iallu");

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw

PATCH 2/5 aarch32: simplify _switch_monitor

In reply to Mark Rutland

If we're lucky enough to have been booted into secure PL1, we can switch to monitor mode with an exception return rather than an SMC call, which avoids the need for boot-time vectors.

Note that while all Secure PL1 register state is accessible in Secure SVC mode, we must switch to Monitor mode before we set SCR.NS=1.

---
 arch/aarch32/boot.S | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
arch/aarch32/boot.S +4 -15
index 82927de..e397cb0 100644
@@ -37,9 +37,10 @@ ASM_FUNC(_start)
 	b	start_no_el3
 
 _switch_monitor:
-	ldr	r0, =boot_vectors
-	bl	setup_vector
-	smc	#0
+	adr	lr, _monitor
+	ldr	r0, =(PSR_A | PSR_I | PSR_F | PSR_MON)
+	msr	spsr, r0
+	movs	pc, lr
 
 _monitor:
 	/* Move the stack to Monitor mode*/
@@ -102,18 +103,6 @@ ASM_FUNC(jump_kernel)
 	msr	spsr_cxf, r4
 	movs	pc, lr
 
-	.section .vectors
-	.align 6
-boot_vectors:
-	b	.
-	b	.
-	b	_monitor
-	b	.
-	b	.
-	b	.
-	b	.
-	b	.
-
 	.section .data
 	.align 2
 flag_no_el3:
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by on v1 2/5
#4 lore raw

Re: [boot-wrapper PATCH 2/5] aarch32: simplify _switch_monitor

Quoted 8 lines · Mark Rutland

If we're lucky enough to have been booted into secure PL1, we can switch to monitor mode with an exception return rather than an SMC call, which avoids the need for boot-time vectors.

Note that while all Secure PL1 register state is accessible in Secure SVC mode, we must switch to Monitor mode before we set SCR.NS=1.

I don't know much about the subtle differences between smc, movs pc and eret, but from what I read this is indeed an easier way to get to MON.

Cheers,
Andre

Quoted 32 lines
---
  arch/aarch32/boot.S | 19 ++++---------------
  1 file changed, 4 insertions(+), 15 deletions(-)
arch/aarch32/boot.S +4 -8
index 82927de..e397cb0 100644
@@ -37,9 +37,10 @@ ASM_FUNC(_start)
  	b	start_no_el3
 
  _switch_monitor:
-	ldr	r0, =boot_vectors
-	bl	setup_vector
-	smc	#0
+	adr	lr, _monitor
+	ldr	r0, =(PSR_A | PSR_I | PSR_F | PSR_MON)
+	msr	spsr, r0
+	movs	pc, lr
 
  _monitor:
  	/* Move the stack to Monitor mode*/
@@ -102,18 +103,6 @@ ASM_FUNC(jump_kernel)
  	msr	spsr_cxf, r4
  	movs	pc, lr
 
-	.section .vectors
-	.align 6
-boot_vectors:
-	b	.
-	b	.

arch/aarch32/boot.S ASM_FUNC(jump_kernel) · line 108

Quoted 10 lines
arch/aarch32/boot.S +0 -7
-	b	_monitor
-	b	.
-	b	.
-	b	.
-	b	.
-	b	.
-
  	.section .data
  	.align 2
  flag_no_el3:

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw

PATCH 3/5 GICv3: initialize without RMW

In reply to Mark Rutland

There's no need to perform an RMW sequence to initialize ICC_SRE_EL3, as there are no bits that we need to preserve, and generally we should reset registers to specific values such that RESx bits aren't configured to UNKNOWN values that could be problematic in future architecture versions.

Instead, let's initialize ICC_SRE_EL3 with a constant value. Since the DIB and DFB fields are RAO/WI in some configurations and we have no reason to initialize these to 0, we always initialize these to 1, in addition to SRE and SRE_Enable.

Cc Marc Zyngier <[email protected]>
Cc Alexandru Elisei <[email protected]>
Cc Andre Przywara <[email protected]>
---
 arch/aarch32/include/asm/gic-v3.h | 7 -------
 arch/aarch64/include/asm/gic-v3.h | 7 -------
 common/gic-v3.c                   | 8 +++-----
 3 files changed, 3 insertions(+), 19 deletions(-)
arch/aarch32/include/asm/gic-v3.h +0 -7
index ec9a327..65f38de 100644
@@ -9,13 +9,6 @@
 #ifndef __ASM_AARCH32_GICV3_H
 #define __ASM_AARCH32_GICV3_H
 
-static inline uint32_t gic_read_icc_sre(void)
-{
-	uint32_t val;
-	asm volatile ("mrc p15, 6, %0, c12, c12, 5" : "=r" (val));
-	return val;
-}
-
 static inline void gic_write_icc_sre(uint32_t val)
 {
 	asm volatile ("mcr p15, 6, %0, c12, c12, 5" : : "r" (val));
arch/aarch64/include/asm/gic-v3.h +0 -7
index e743c02..5b32380 100644
@@ -15,13 +15,6 @@
 #define ICC_CTLR_EL3	"S3_6_C12_C12_4"
 #define ICC_PMR_EL1	"S3_0_C4_C6_0"
 
-static inline uint32_t gic_read_icc_sre(void)
-{
-	uint32_t val;
-	asm volatile ("mrs %0, " ICC_SRE_EL3 : "=r" (val));
-	return val;
-}
-
 static inline void gic_write_icc_sre(uint32_t val)
 {
 	asm volatile ("msr " ICC_SRE_EL3 ", %0" : : "r" (val));
common/gic-v3.c +3 -5
index 62f9676..6207007 100644
@@ -42,6 +42,8 @@
 #define GICR_TYPER_Last			(1 << 4)
 
 #define ICC_SRE_SRE			(1 << 0)
+#define ICC_SRE_DFB			(1 << 1)
+#define ICC_SRE_DIB			(1 << 2)
 #define ICC_SRE_Enable			(1 << 3)
 
 void gic_secure_init_primary(void)
@@ -101,8 +103,6 @@ void gic_secure_init_primary(void)
 
 void gic_secure_init(void)
 {
-	uint32_t sre;
-
 	/*
 	 * If GICv3 is not available, skip initialisation. The OS will probably
 	 * fail with a warning, but this should be easier to debug than a
@@ -114,9 +114,7 @@ void gic_secure_init(void)
 	if (this_cpu_logical_id() == 0)
 		gic_secure_init_primary();
 
-	sre = gic_read_icc_sre();
-	sre |= ICC_SRE_Enable | ICC_SRE_SRE;
-	gic_write_icc_sre(sre);
+	gic_write_icc_sre(ICC_SRE_Enable | ICC_SRE_DIB | ICC_SRE_DFB | ICC_SRE_SRE);
 	isb();
 
 	gic_write_icc_ctlr(0);
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by on v1 3/5
#6 lore raw

Re: [boot-wrapper PATCH 3/5] GICv3: initialize without RMW

Quoted 10 lines · Mark Rutland

There's no need to perform an RMW sequence to initialize ICC_SRE_EL3, as there are no bits that we need to preserve, and generally we should reset registers to specific values such that RESx bits aren't configured to UNKNOWN values that could be problematic in future architecture versions.

Instead, let's initialize ICC_SRE_EL3 with a constant value. Since the DIB and DFB fields are RAO/WI in some configurations and we have no reason to initialize these to 0, we always initialize these to 1, in addition to SRE and SRE_Enable.

Indeed, actually the architectural reset value is 0 (bypass enabled), and we seem to be just saved by the fact that the model implements them as RAO/WI. So forcing a value is the right thing to do.

Quoted 4 lines
Cc Marc Zyngier <[email protected]>
Cc Alexandru Elisei <[email protected]>
Cc Andre Przywara <[email protected]>

Cheers,
Andre

Quoted 66 lines
---
  arch/aarch32/include/asm/gic-v3.h | 7 -------
  arch/aarch64/include/asm/gic-v3.h | 7 -------
  common/gic-v3.c                   | 8 +++-----
  3 files changed, 3 insertions(+), 19 deletions(-)
arch/aarch32/include/asm/gic-v3.h +0 -7
index ec9a327..65f38de 100644
@@ -9,13 +9,6 @@
  #ifndef __ASM_AARCH32_GICV3_H
  #define __ASM_AARCH32_GICV3_H
 
-static inline uint32_t gic_read_icc_sre(void)
-{
-	uint32_t val;
-	asm volatile ("mrc p15, 6, %0, c12, c12, 5" : "=r" (val));
-	return val;
-}
-
  static inline void gic_write_icc_sre(uint32_t val)
  {
  	asm volatile ("mcr p15, 6, %0, c12, c12, 5" : : "r" (val));
arch/aarch64/include/asm/gic-v3.h +0 -7
index e743c02..5b32380 100644
@@ -15,13 +15,6 @@
  #define ICC_CTLR_EL3	"S3_6_C12_C12_4"
  #define ICC_PMR_EL1	"S3_0_C4_C6_0"
 
-static inline uint32_t gic_read_icc_sre(void)
-{
-	uint32_t val;
-	asm volatile ("mrs %0, " ICC_SRE_EL3 : "=r" (val));
-	return val;
-}
-
  static inline void gic_write_icc_sre(uint32_t val)
  {
  	asm volatile ("msr " ICC_SRE_EL3 ", %0" : : "r" (val));
common/gic-v3.c +2 -2
index 62f9676..6207007 100644
@@ -42,6 +42,8 @@
  #define GICR_TYPER_Last			(1 << 4)
 
  #define ICC_SRE_SRE			(1 << 0)
+#define ICC_SRE_DFB			(1 << 1)
+#define ICC_SRE_DIB			(1 << 2)
  #define ICC_SRE_Enable			(1 << 3)
 
  void gic_secure_init_primary(void)
@@ -101,8 +103,6 @@ void gic_secure_init_primary(void)
 
  void gic_secure_init(void)
  {
-	uint32_t sre;
-
  	/*
  	 * If GICv3 is not available, skip initialisation. The OS will probably
  	 * fail with a warning, but this should be easier to debug than a

common/gic-v3.c void gic_secure_init(void) · line 120

Quoted 10 lines
common/gic-v3.c +1 -3
@@ -114,9 +114,7 @@ void gic_secure_init(void)
  	if (this_cpu_logical_id() == 0)
  		gic_secure_init_primary();
 
-	sre = gic_read_icc_sre();
-	sre |= ICC_SRE_Enable | ICC_SRE_SRE;
-	gic_write_icc_sre(sre);
+	gic_write_icc_sre(ICC_SRE_Enable | ICC_SRE_DIB | ICC_SRE_DFB | ICC_SRE_SRE);
  	isb();
 
  	gic_write_icc_ctlr(0);

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#7 lore raw

PATCH 4/5 Rename kernel *_RESET values to *_KERNEL

In reply to Mark Rutland

Our *_RESET constants are used to initalize state for the kernel rather than the bootwrapper itself, so for clarity we should use a *_KERNEL suffix rather than a _RESET suffix.

---
 arch/aarch32/boot.S            | 4 ++--
 arch/aarch32/include/asm/cpu.h | 4 ++--
 arch/aarch64/boot.S            | 4 ++--
 arch/aarch64/include/asm/cpu.h | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)
arch/aarch32/boot.S +2 -2
index e397cb0..08bf932 100644
@@ -76,10 +76,10 @@ ASM_FUNC(jump_kernel)
 	push	{r0 - r3}
 	mov	r5, sp
 
-	ldr	r0, =HSCTLR_RESET
+	ldr	r0, =HSCTLR_KERNEL
 	mcr	p15, 4, r0, c1, c0, 0		@ HSCTLR
 
-	ldr	r0, =SCTLR_RESET
+	ldr	r0, =SCTLR_KERNEL
 	mcr	p15, 0, r0, c1, c0, 0		@ SCTLR
 
 	/* Reset our stack pointer */
arch/aarch32/include/asm/cpu.h +2 -2
index a7993f0..105cae5 100644
@@ -13,8 +13,8 @@
 #define MPIDR_INVALID		(-1)
 
 /* Only RES1 bits and CP15 barriers for the kernel */
-#define HSCTLR_RESET		(3 << 28 | 3 << 22 | 1 << 18 | 1 << 16 | 1 << 11 | 3 << 4)
-#define SCTLR_RESET		(3 << 22 | 1 << 11 | 1 << 5 | 3 << 4)
+#define HSCTLR_KERNEL		(3 << 28 | 3 << 22 | 1 << 18 | 1 << 16 | 1 << 11 | 3 << 4)
+#define SCTLR_KERNEL		(3 << 22 | 1 << 11 | 1 << 5 | 3 << 4)
 
 #define PSR_SVC			0x13
 #define PSR_HYP			0x1a
arch/aarch64/boot.S +2 -2
index d8d7ccd..587a25f 100644
@@ -140,10 +140,10 @@ ASM_FUNC(jump_kernel)
 	mov	x22, x3
 	mov	x23, x4
 
-	ldr	x0, =SCTLR_EL1_RESET
+	ldr	x0, =SCTLR_EL1_KERNEL
 	msr	sctlr_el1, x0
 
-	ldr	x0, =SCTLR_EL2_RESET
+	ldr	x0, =SCTLR_EL2_KERNEL
 	msr	sctlr_el2, x0
 
 	cpuid	x0, x1
arch/aarch64/include/asm/cpu.h +3 -3
index 1cddbb8..63eb1c3 100644
@@ -17,7 +17,7 @@
  * RES1 bits,  little-endian, caches and MMU off, no alignment checking,
  * no WXN.
  */
-#define SCTLR_EL2_RESET		(3 << 28 | 3 << 22 | 1 << 18 | 1 << 16 | 1 << 11 | 3 << 4)
+#define SCTLR_EL2_KERNEL	(3 << 28 | 3 << 22 | 1 << 18 | 1 << 16 | 1 << 11 | 3 << 4)
 
 #define SPSR_A			(1 << 8)	/* System Error masked */
 #define SPSR_D			(1 << 9)	/* Debug masked */
@@ -37,10 +37,10 @@
 
 #ifdef KERNEL_32
 /* 32-bit kernel decompressor uses CP15 barriers */
-#define SCTLR_EL1_RESET		(SCTLR_EL1_RES1 | SCTLR_EL1_CP15BEN)
+#define SCTLR_EL1_KERNEL	(SCTLR_EL1_RES1 | SCTLR_EL1_CP15BEN)
 #define SPSR_KERNEL		(SPSR_A | SPSR_I | SPSR_F | SPSR_HYP)
 #else
-#define SCTLR_EL1_RESET		SCTLR_EL1_RES1
+#define SCTLR_EL1_KERNEL	SCTLR_EL1_RES1
 #define SPSR_KERNEL		(SPSR_A | SPSR_D | SPSR_I | SPSR_F | SPSR_EL2H)
 #endif
 
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by on v1 4/5
#8 lore raw

Re: [boot-wrapper PATCH 4/5] Rename kernel *_RESET values to *_KERNEL

Quoted 5 lines · Mark Rutland

Our *_RESET constants are used to initalize state for the kernel rather than the bootwrapper itself, so for clarity we should use a *_KERNEL suffix rather than a _RESET suffix.

It's indeed only renaming:

Cheers,
Andre

Quoted 73 lines
---
  arch/aarch32/boot.S            | 4 ++--
  arch/aarch32/include/asm/cpu.h | 4 ++--
  arch/aarch64/boot.S            | 4 ++--
  arch/aarch64/include/asm/cpu.h | 6 +++---
  4 files changed, 9 insertions(+), 9 deletions(-)
arch/aarch32/boot.S +2 -2
index e397cb0..08bf932 100644
@@ -76,10 +76,10 @@ ASM_FUNC(jump_kernel)
  	push	{r0 - r3}
  	mov	r5, sp
 
-	ldr	r0, =HSCTLR_RESET
+	ldr	r0, =HSCTLR_KERNEL
  	mcr	p15, 4, r0, c1, c0, 0		@ HSCTLR
 
-	ldr	r0, =SCTLR_RESET
+	ldr	r0, =SCTLR_KERNEL
  	mcr	p15, 0, r0, c1, c0, 0		@ SCTLR
 
  	/* Reset our stack pointer */
arch/aarch32/include/asm/cpu.h +2 -2
index a7993f0..105cae5 100644
@@ -13,8 +13,8 @@
  #define MPIDR_INVALID		(-1)
 
  /* Only RES1 bits and CP15 barriers for the kernel */
-#define HSCTLR_RESET		(3 << 28 | 3 << 22 | 1 << 18 | 1 << 16 | 1 << 11 | 3 << 4)
-#define SCTLR_RESET		(3 << 22 | 1 << 11 | 1 << 5 | 3 << 4)
+#define HSCTLR_KERNEL		(3 << 28 | 3 << 22 | 1 << 18 | 1 << 16 | 1 << 11 | 3 << 4)
+#define SCTLR_KERNEL		(3 << 22 | 1 << 11 | 1 << 5 | 3 << 4)
 
  #define PSR_SVC			0x13
  #define PSR_HYP			0x1a
arch/aarch64/boot.S +2 -2
index d8d7ccd..587a25f 100644
@@ -140,10 +140,10 @@ ASM_FUNC(jump_kernel)
  	mov	x22, x3
  	mov	x23, x4
 
-	ldr	x0, =SCTLR_EL1_RESET
+	ldr	x0, =SCTLR_EL1_KERNEL
  	msr	sctlr_el1, x0
 
-	ldr	x0, =SCTLR_EL2_RESET
+	ldr	x0, =SCTLR_EL2_KERNEL
  	msr	sctlr_el2, x0
 
  	cpuid	x0, x1
arch/aarch64/include/asm/cpu.h +1 -1
index 1cddbb8..63eb1c3 100644
@@ -17,7 +17,7 @@
   * RES1 bits,  little-endian, caches and MMU off, no alignment checking,
   * no WXN.
   */
-#define SCTLR_EL2_RESET		(3 << 28 | 3 << 22 | 1 << 18 | 1 << 16 | 1 << 11 | 3 << 4)
+#define SCTLR_EL2_KERNEL	(3 << 28 | 3 << 22 | 1 << 18 | 1 << 16 | 1 << 11 | 3 << 4)
 
  #define SPSR_A			(1 << 8)	/* System Error masked */
  #define SPSR_D			(1 << 9)	/* Debug masked */
@@ -37,10 +37,10 @@
 
  #ifdef KERNEL_32

arch/aarch64/include/asm/cpu.h line 46

Quoted 10 lines
arch/aarch64/include/asm/cpu.h +2 -2
  /* 32-bit kernel decompressor uses CP15 barriers */
-#define SCTLR_EL1_RESET		(SCTLR_EL1_RES1 | SCTLR_EL1_CP15BEN)
+#define SCTLR_EL1_KERNEL	(SCTLR_EL1_RES1 | SCTLR_EL1_CP15BEN)
  #define SPSR_KERNEL		(SPSR_A | SPSR_I | SPSR_F | SPSR_HYP)
  #else
-#define SCTLR_EL1_RESET		SCTLR_EL1_RES1
+#define SCTLR_EL1_KERNEL	SCTLR_EL1_RES1
  #define SPSR_KERNEL		(SPSR_A | SPSR_D | SPSR_I | SPSR_F | SPSR_EL2H)
  #endif
 

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#9 lore raw

PATCH 5/5 Rename `CNTFRQ` -> `COUNTER_FREQ`

In reply to Mark Rutland

To avoid any confusuion between the CNTFRQ/CNTFRQ_EL0 register and the vallue it will be progrmamed with, rename the CNTFRQ constant to `COUNTER_FREQ.

In future patches this will allow us to use CNTFRQ as a macro for the AArch32 CP15 register encoding.

There should be no functional change as a result of this patch.

---
 Makefile.am         | 4 ++--
 arch/aarch32/boot.S | 2 +-
 arch/aarch64/boot.S | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
Makefile.am +2 -2
index 3591d23..d0a68df 100644
@@ -13,12 +13,12 @@ SCRIPT_DIR	:= $(top_srcdir)/scripts
 PHYS_OFFSET	:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findmem.pl $(KERNEL_DTB))
 UART_BASE	:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 0 'arm,pl011')
 SYSREGS_BASE	:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 0 'arm,vexpress-sysreg' 2> /dev/null)
-CNTFRQ		:= 24000000
+COUNTER_FREQ	:= 24000000
 
 CPU_IDS		:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findcpuids.pl $(KERNEL_DTB))
 NR_CPUS         := $(shell echo $(CPU_IDS) | tr ',' ' ' | wc -w)
 
-DEFINES		= -DCNTFRQ=$(CNTFRQ)
+DEFINES		= -DCOUNTER_FREQ=$(COUNTER_FREQ)
 DEFINES		+= -DCPU_IDS=$(CPU_IDS)
 DEFINES		+= -DNR_CPUS=$(NR_CPUS)
 DEFINES		+= $(if $(SYSREGS_BASE), -DSYSREGS_BASE=$(SYSREGS_BASE), )
arch/aarch32/boot.S +1 -1
index 08bf932..4add338 100644
@@ -54,7 +54,7 @@ _monitor:
 	mov	r0, #(1 << 10 | 1 << 11)	@ Enable NS access to CPACR
 	mcr	p15, 0, r0, c1, c1, 2		@ NSACR
 
-	ldr	r0, =CNTFRQ
+	ldr	r0, =COUNTER_FREQ
 	mcr	p15, 0, r0, c14, c0, 0		@ CNTFRQ
 
 	bl	gic_secure_init
arch/aarch64/boot.S +1 -1
index 587a25f..bfbb6ec 100644
@@ -118,7 +118,7 @@ ASM_FUNC(_start)
 	msr	ZCR_EL3, x0			// for EL2.
 
 1:
-	ldr	x0, =CNTFRQ
+	ldr	x0, =COUNTER_FREQ
 	msr	cntfrq_el0, x0
 
 	bl	gic_secure_init
Signature · 7 lines
2.11.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by on v1 5/5
#10 lore raw

Re: [boot-wrapper PATCH 5/5] Rename `CNTFRQ` -> `COUNTER_FREQ`

Quoted 10 lines · Mark Rutland

To avoid any confusuion between the CNTFRQ/CNTFRQ_EL0 register and the vallue it will be progrmamed with, rename the CNTFRQ constant to `COUNTER_FREQ.

In future patches this will allow us to use CNTFRQ as a macro for the AArch32 CP15 register encoding.

There should be no functional change as a result of this patch.

Confirmed to be just renaming:

Cheers,
Andre

Quoted 44 lines
---
  Makefile.am         | 4 ++--
  arch/aarch32/boot.S | 2 +-
  arch/aarch64/boot.S | 2 +-
  3 files changed, 4 insertions(+), 4 deletions(-)
Makefile.am +2 -2
index 3591d23..d0a68df 100644
@@ -13,12 +13,12 @@ SCRIPT_DIR	:= $(top_srcdir)/scripts
  PHYS_OFFSET	:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findmem.pl $(KERNEL_DTB))
  UART_BASE	:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 0 'arm,pl011')
  SYSREGS_BASE	:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findbase.pl $(KERNEL_DTB) 0 'arm,vexpress-sysreg' 2> /dev/null)
-CNTFRQ		:= 24000000
+COUNTER_FREQ	:= 24000000
 
  CPU_IDS		:= $(shell perl -I $(SCRIPT_DIR) $(SCRIPT_DIR)/findcpuids.pl $(KERNEL_DTB))
  NR_CPUS         := $(shell echo $(CPU_IDS) | tr ',' ' ' | wc -w)
 
-DEFINES		= -DCNTFRQ=$(CNTFRQ)
+DEFINES		= -DCOUNTER_FREQ=$(COUNTER_FREQ)
  DEFINES		+= -DCPU_IDS=$(CPU_IDS)
  DEFINES		+= -DNR_CPUS=$(NR_CPUS)
  DEFINES		+= $(if $(SYSREGS_BASE), -DSYSREGS_BASE=$(SYSREGS_BASE), )
arch/aarch32/boot.S +1 -1
index 08bf932..4add338 100644
@@ -54,7 +54,7 @@ _monitor:
  	mov	r0, #(1 << 10 | 1 << 11)	@ Enable NS access to CPACR
  	mcr	p15, 0, r0, c1, c1, 2		@ NSACR
 
-	ldr	r0, =CNTFRQ
+	ldr	r0, =COUNTER_FREQ
  	mcr	p15, 0, r0, c14, c0, 0		@ CNTFRQ
 
  	bl	gic_secure_init
arch/aarch64/boot.S +0 -0
index 587a25f..bfbb6ec 100644

arch/aarch64/boot.S ASM_FUNC(_start) · line 124

Quoted 8 lines
arch/aarch64/boot.S +1 -1
@@ -118,7 +118,7 @@ ASM_FUNC(_start)
  	msr	ZCR_EL3, x0			// for EL2.
 
  1:
-	ldr	x0, =CNTFRQ
+	ldr	x0, =COUNTER_FREQ
  	msr	cntfrq_el0, x0
 
  	bl	gic_secure_init

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Acked-by on the v1 series
#11 lore raw
In reply to Mark Rutland
Quoted 18 lines · Mark Rutland

These are a few cleanup patches I've split out of my ongoing bootwrapper rework, and intend to apply by the end of this week.

My WIP cleanup branch with subsequent patches can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/mark/boot-wrapper-aarch64.git cleanup

Thanks,
Mark.

Mark Rutland (5):
Remove unused Set/Way cache helpers
aarch32: simplify _switch_monitor
GICv3: initialize without RMW
Rename kernel *_RESET values to *_KERNEL
Rename CNTFRQ -> COUNTER_FREQ

Quoted 9 lines
 Makefile.am                       |  4 ++--
 arch/aarch32/boot.S               | 25 +++++++------------------
 arch/aarch32/include/asm/cpu.h    | 30 ++----------------------------
 arch/aarch32/include/asm/gic-v3.h |  7 -------
 arch/aarch64/boot.S               |  6 +++---
 arch/aarch64/include/asm/cpu.h    | 32 +++-----------------------------
 arch/aarch64/include/asm/gic-v3.h |  7 -------
 common/gic-v3.c                   |  8 +++-----
 8 files changed, 20 insertions(+), 99 deletions(-)

For the whole series:

	M.
Signature · 6 lines
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel