Skip to contentSkip to conversation

ARM: Enable I$/D$/BrPredict based on config

PATCH New Bryan Buckley 3 participants 7 messages May 3, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: Enable I$/D$/BrPredict based on config

Currently we only disable these bits based on config. Now we will use this config option to explicitly enable these features at this point regardless of what bootloader, other SW, or HW did before.

---
 arch/arm/kernel/head.S |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/kernel/head.S +6 -0
index 3bf0c7f..cec0de5 100644
@@ -411,12 +411,18 @@ __enable_mmu:
 #endif
 #ifdef CONFIG_CPU_DCACHE_DISABLE
 	bic	r0, r0, #CR_C
+#else
+	orr	r0, r0, #CR_C
 #endif
 #ifdef CONFIG_CPU_BPREDICT_DISABLE
 	bic	r0, r0, #CR_Z
+#else
+	orr	r0, r0, #CR_Z
 #endif
 #ifdef CONFIG_CPU_ICACHE_DISABLE
 	bic	r0, r0, #CR_I
+#else
+	orr	r0, r0, #CR_I
 #endif
 #ifdef CONFIG_ARM_LPAE
 	mov	r5, #0
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/1 ARM: Enable I$/D$/BrPredict based on config

Quoted 23 lines · Bryan Buckley

Currently we only disable these bits based on config. Now we will use this config option to explicitly enable these features at this point regardless of what bootloader, other SW, or HW did before.

---
 arch/arm/kernel/head.S |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/kernel/head.S +2 -0
index 3bf0c7f..cec0de5 100644
@@ -411,12 +411,18 @@ __enable_mmu:
 #endif
 #ifdef CONFIG_CPU_DCACHE_DISABLE
 	bic	r0, r0, #CR_C
+#else
+	orr	r0, r0, #CR_C
 #endif
 #ifdef CONFIG_CPU_BPREDICT_DISABLE
 	bic	r0, r0, #CR_Z

arch/arm/kernel/head.S __enable_mmu: · line 428

Quoted 10 lines
arch/arm/kernel/head.S +4 -0
+#else
+	orr	r0, r0, #CR_Z
 #endif
 #ifdef CONFIG_CPU_ICACHE_DISABLE
 	bic	r0, r0, #CR_I
+#else
+	orr	r0, r0, #CR_I
 #endif
 #ifdef CONFIG_ARM_LPAE
 	mov	r5, #0

Caches and branch predictors may require implementation defined invalidation before being enabled.

Signature · 2 lines
M?ns Rullg?rd
mans at mansr.com
#2 lore raw

PATCH 1/1 ARM: Enable I$/D$/BrPredict based on config

Quoted 31 lines · M?ns Rullg?rd
Quoted 28 lines · Bryan Buckley

Currently we only disable these bits based on config. Now we will use this config option to explicitly enable these features at this point regardless of what bootloader, other SW, or HW did before.

---
?arch/arm/kernel/head.S | ? ?6 ++++++
?1 files changed, 6 insertions(+), 0 deletions(-)

arch/arm/kernel/head.S +0 -0
index 3bf0c7f..cec0de5 100644
@@ -411,12 +411,18 @@ __enable_mmu:

?#endif
?#ifdef CONFIG_CPU_DCACHE_DISABLE
? ? ? bic ? ? r0, r0, #CR_C
+#else
+ ? ? orr ? ? r0, r0, #CR_C
?#endif
?#ifdef CONFIG_CPU_BPREDICT_DISABLE
? ? ? bic ? ? r0, r0, #CR_Z
+#else
+ ? ? orr ? ? r0, r0, #CR_Z
?#endif
?#ifdef CONFIG_CPU_ICACHE_DISABLE
? ? ? bic ? ? r0, r0, #CR_I
+#else

Quoted 9 lines
Quoted 5 lines

+ ? ? orr ? ? r0, r0, #CR_I
?#endif
?#ifdef CONFIG_ARM_LPAE
? ? ? mov ? ? r5, #0
--

Caches and branch predictors may require implementation defined invalidation before being enabled.

True.. I was relying on going through arch/arm/boot/compressed/head.S to do that for me. Was that unreasonable?

Quoted 3 lines

--
M?ns Rullg?rd
mans at mansr.com

#6 lore raw

PATCH 1/1 ARM: Enable I$/D$/BrPredict based on config

In reply to Bryan Buckley
Quoted 3 lines · Bryan Buckley

Currently we only disable these bits based on config. Now we will use this config option to explicitly enable these features at this point regardless of what bootloader, other SW, or HW did before.

NAK. r0 comes from the CPU specific file. It is up to the CPU specific support file to decide what setting is appropriate. For example, a CPU not implementing the I bit will require this bit to be preserved, rather than being explicitly written as one or zero.

The ifdefs here are just disable-overrides for that, primerily to allow testing of new CPUs.

#3 lore raw

PATCH 1/1 ARM: Enable I$/D$/BrPredict based on config

In reply to Buckley, Bryan
Quoted 41 lines · Bryan
Quoted 31 lines · M?ns Rullg?rd
Quoted 28 lines · Bryan Buckley

Currently we only disable these bits based on config. Now we will use this config option to explicitly enable these features at this point regardless of what bootloader, other SW, or HW did before.

---
?arch/arm/kernel/head.S | ? ?6 ++++++
?1 files changed, 6 insertions(+), 0 deletions(-)

arch/arm/kernel/head.S +0 -0
index 3bf0c7f..cec0de5 100644
@@ -411,12 +411,18 @@ __enable_mmu:

?#endif
?#ifdef CONFIG_CPU_DCACHE_DISABLE
? ? ? bic ? ? r0, r0, #CR_C
+#else
+ ? ? orr ? ? r0, r0, #CR_C
?#endif
?#ifdef CONFIG_CPU_BPREDICT_DISABLE
? ? ? bic ? ? r0, r0, #CR_Z
+#else
+ ? ? orr ? ? r0, r0, #CR_Z
?#endif
?#ifdef CONFIG_CPU_ICACHE_DISABLE
? ? ? bic ? ? r0, r0, #CR_I
+#else

Quoted 8 lines
Quoted 5 lines

+ ? ? orr ? ? r0, r0, #CR_I
?#endif
?#ifdef CONFIG_ARM_LPAE
? ? ? mov ? ? r5, #0
--

Caches and branch predictors may require implementation defined invalidation before being enabled.

Quoted 2 lines

True.. I was relying on going through arch/arm/boot/compressed/head.S to do that for me. Was that unreasonable?

Yes, because that may not always be used.

Where that _is_ dealt with is in the CPU specific setup assembly code, just as providing the CPU specific default value for the CPU control register in r0 is done.

#4 lore raw

PATCH 1/1 ARM: Enable I$/D$/BrPredict based on config

In reply to Buckley, Bryan
Quoted 41 lines · Bryan
Quoted 31 lines · M?ns Rullg?rd
Quoted 28 lines · Bryan Buckley

Currently we only disable these bits based on config. Now we will use this config option to explicitly enable these features at this point regardless of what bootloader, other SW, or HW did before.

---
?arch/arm/kernel/head.S | ? ?6 ++++++
?1 files changed, 6 insertions(+), 0 deletions(-)

arch/arm/kernel/head.S +0 -0
index 3bf0c7f..cec0de5 100644
@@ -411,12 +411,18 @@ __enable_mmu:

?#endif
?#ifdef CONFIG_CPU_DCACHE_DISABLE
? ? ? bic ? ? r0, r0, #CR_C
+#else
+ ? ? orr ? ? r0, r0, #CR_C
?#endif
?#ifdef CONFIG_CPU_BPREDICT_DISABLE
? ? ? bic ? ? r0, r0, #CR_Z
+#else
+ ? ? orr ? ? r0, r0, #CR_Z
?#endif
?#ifdef CONFIG_CPU_ICACHE_DISABLE
? ? ? bic ? ? r0, r0, #CR_I
+#else

Quoted 8 lines
Quoted 5 lines

+ ? ? orr ? ? r0, r0, #CR_I
?#endif
?#ifdef CONFIG_ARM_LPAE
? ? ? mov ? ? r5, #0
--

Caches and branch predictors may require implementation defined invalidation before being enabled.

Quoted 2 lines

True.. I was relying on going through arch/arm/boot/compressed/head.S to do that for me. Was that unreasonable?

I'd be inclined to qualify that as "other SW." It is possible to start the kernel without using that code, even if it is not typically done.

Signature · 2 lines
M?ns Rullg?rd
mans at mansr.com
#5 lore raw

PATCH 1/1 ARM: Enable I$/D$/BrPredict based on config

Quoted 43 lines · M?ns Rullg?rd
Quoted 41 lines · Bryan
Quoted 39 lines · M?ns Rullg?rd
Quoted 25 lines · Bryan Buckley

Currently we only disable these bits based on config. Now we will use this config option to explicitly enable these features at this point regardless of what bootloader, other SW, or HW did before.

---
?arch/arm/kernel/head.S | ? ?6 ++++++
?1 files changed, 6 insertions(+), 0 deletions(-)

arch/arm/kernel/head.S +0 -0
index 3bf0c7f..cec0de5 100644
@@ -411,12 +411,18 @@ __enable_mmu:

?#endif
?#ifdef CONFIG_CPU_DCACHE_DISABLE
? ? ? bic ? ? r0, r0, #CR_C
+#else
+ ? ? orr ? ? r0, r0, #CR_C
?#endif
?#ifdef CONFIG_CPU_BPREDICT_DISABLE
? ? ? bic ? ? r0, r0, #CR_Z
+#else
+ ? ? orr ? ? r0, r0, #CR_Z
?#endif

Quoted 8 lines

?#ifdef CONFIG_CPU_ICACHE_DISABLE
? ? ? bic ? ? r0, r0, #CR_I
+#else
+ ? ? orr ? ? r0, r0, #CR_I
?#endif
?#ifdef CONFIG_ARM_LPAE
? ? ? mov ? ? r5, #0
--

Caches and branch predictors may require implementation defined invalidation before being enabled.

Quoted 6 lines
Quoted 2 lines

True.. I was relying on going through arch/arm/boot/compressed/head.S to do that for me. Was that unreasonable?

I'd be inclined to qualify that as "other SW." ?It is possible to start the kernel without using that code, even if it is not typically done.

haha, yeah me too.

Thanks M?ns and Russel.

Quoted 3 lines

--
M?ns Rullg?rd
mans at mansr.com