Skip to contentSkip to conversation

Another Errata 430973 Update

PATCH In review Sebastian Reichel 5 participants 13 messages Jul 23, 2015 – Oct 5, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Another Errata 430973 Update

Hi,

This patchset is a followup to e748994 and a6d74678, that unconditionally enable the errata 430973 workaround for Cortex A8 CPUs.

The first patch removes the CONFIG_ARM_ERRATA_430973 guard in the Nokia N900's IBE code, since all sold N900s are affected by the bug (AFAIK).

The next two patches update the errata's Kconfig entry, so that it's no longer shown for multiplatform kernels and informs about the bootloader method.

-- Sebastian

Sebastian Reichel (3):
ARM: OMAP2+: N900: always enable IBE bit
ARM: update errata 430973 documentation
ARM: errata 430973: move !ARCH_MULTIPLATFORM to Kconfig

 arch/arm/Kconfig                   |  5 +++++
 arch/arm/mach-omap2/board-rx51.c   |  2 --
 arch/arm/mach-omap2/pdata-quirks.c | 11 ++---------
 arch/arm/mm/proc-v7.S              |  2 +-
 4 files changed, 8 insertions(+), 12 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/3 ARM: OMAP2+: N900: always enable IBE bit

The kernel's workaround for Errata 430973 consists of a BTAC/BTB flush at context switch. This requires the IBE bit being set, which should normally be done by the bootloader.

Since the Nokia N900's bootloader is not easily replaceable, a pdata quirk enables the IBE bit for the Nokia N900. Until e748994f5cc5, the flush at context switch required CONFIG_ARM_ERRATA_430973, so the same check has been used for setting the IBE bit.

Since all sold N900s are assumed to be affected, the guard can be removed now, so that the IBE bit is always set.

---
 arch/arm/mach-omap2/board-rx51.c   |  2 --
 arch/arm/mach-omap2/pdata-quirks.c | 11 ++---------
 2 files changed, 2 insertions(+), 11 deletions(-)
arch/arm/mach-omap2/board-rx51.c +0 -2
index 2d1e5a6..3df01cc 100644
@@ -108,11 +108,9 @@ static void __init rx51_init(void)
 	rx51_peripherals_init();
 
 	if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
-#ifdef CONFIG_ARM_ERRATA_430973
 		pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
 		/* set IBE to 1 */
 		rx51_secure_update_aux_cr(BIT(6), 0);
-#endif
 	}
 
 	/* Ensure SDRC pins are mux'd for self-refresh */
arch/arm/mach-omap2/pdata-quirks.c +2 -9
index 821171c..0aa438d 100644
@@ -249,18 +249,11 @@ static void __init nokia_n900_legacy_init(void)
 	hsmmc2_internal_input_clk();
 
 	if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
-		if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) {
-			pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
-			/* set IBE to 1 */
-			rx51_secure_update_aux_cr(BIT(6), 0);
-		} else {
-			pr_warn("RX-51: Not enabling ARM errata 430973 workaround\n");
-			pr_warn("Thumb binaries may crash randomly without this workaround\n");
-		}
+		pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
+		rx51_secure_update_aux_cr(BIT(6), 0); /* set IBE to 1 */
 
 		pr_info("RX-51: Registring OMAP3 HWRNG device\n");
 		platform_device_register(&omap3_rom_rng_device);
-
 	}
 }
 
Signature · 1 line
2.1.4
maintainer Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] ARM: OMAP2+: N900: always enable IBE bit

Quoted 4 lines · Sebastian Reichel

The kernel's workaround for Errata 430973 consists of a BTAC/BTB flush at context switch. This requires the IBE bit being set, which should normally be done by the bootloader.

Quoted 8 lines

Since the Nokia N900's bootloader is not easily replaceable, a pdata quirk enables the IBE bit for the Nokia N900. Until e748994f5cc5, the flush at context switch required CONFIG_ARM_ERRATA_430973, so the same check has been used for setting the IBE bit.

Since all sold N900s are assumed to be affected, the guard can be removed now, so that the IBE bit is always set.

OK makes sense to me. It's best that you upload these into Russell's patch tracking system after waiting for some more comments. Please feel free to add for the whole series:

#3 lore raw

Re: [PATCH 1/3] ARM: OMAP2+: N900: always enable IBE bit

In reply to Sebastian Reichel

Hi!

Quoted 4 lines

The kernel's workaround for Errata 430973 consists of a BTAC/BTB flush at context switch. This requires the IBE bit being set, which should normally be done by the bootloader.

Quoted 8 lines

Since the Nokia N900's bootloader is not easily replaceable, a pdata quirk enables the IBE bit for the Nokia N900. Until e748994f5cc5, the flush at context switch required CONFIG_ARM_ERRATA_430973, so the same check has been used for setting the IBE bit.

Since all sold N900s are assumed to be affected, the guard can be removed now, so that the IBE bit is always set.

Is the qemu affected?

Does qemu have enough secure support not to fail on this?

Best regards,

Pavel

Quoted 56 lines
---
 arch/arm/mach-omap2/board-rx51.c   |  2 --
 arch/arm/mach-omap2/pdata-quirks.c | 11 ++---------
 2 files changed, 2 insertions(+), 11 deletions(-)
arch/arm/mach-omap2/board-rx51.c +0 -2
index 2d1e5a6..3df01cc 100644
@@ -108,11 +108,9 @@ static void __init rx51_init(void)
 	rx51_peripherals_init();
 
 	if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
-#ifdef CONFIG_ARM_ERRATA_430973
 		pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
 		/* set IBE to 1 */
 		rx51_secure_update_aux_cr(BIT(6), 0);
-#endif
 	}
 
 	/* Ensure SDRC pins are mux'd for self-refresh */
arch/arm/mach-omap2/pdata-quirks.c +2 -9
index 821171c..0aa438d 100644
@@ -249,18 +249,11 @@ static void __init nokia_n900_legacy_init(void)
 	hsmmc2_internal_input_clk();
 
 	if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
-		if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) {
-			pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
-			/* set IBE to 1 */
-			rx51_secure_update_aux_cr(BIT(6), 0);
-		} else {
-			pr_warn("RX-51: Not enabling ARM errata 430973 workaround\n");
-			pr_warn("Thumb binaries may crash randomly without this workaround\n");
-		}
+		pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
+		rx51_secure_update_aux_cr(BIT(6), 0); /* set IBE to 1 */
 
 		pr_info("RX-51: Registring OMAP3 HWRNG device\n");
 		platform_device_register(&omap3_rom_rng_device);
-
 	}
 }
 
Signature · 7 lines
2.1.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#4 lore raw

PATCH 2/3 ARM: update errata 430973 documentation

In reply to Sebastian Reichel

The Errata 430973 workaround config option only enables the IBE bit, which should be done by the bootloader if possible.

---
 arch/arm/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/Kconfig +4 -0
index 1c50210..0e4929b 100644
@@ -1078,6 +1078,10 @@ config ARM_ERRATA_430973
 	  and also flushes the branch target cache at every context switch.
 	  Note that setting specific bits in the ACTLR register may not be
 	  available in non-secure mode.
+	  Instead of enabling this option, it is recommended to enable the
+	  workaround by setting the IBE bit from the bootloader, since the
+	  BTB/BTAC operations are always executed for context switches on
+	  Cortex-A8.
 
 config ARM_ERRATA_458693
 	bool "ARM errata: Processor deadlock when a false hazard is created"
Signature · 1 line
2.1.4
#5 lore raw

PATCH 3/3 ARM: errata 430973: move !ARCH_MULTIPLATFORM to Kconfig

In reply to Sebastian Reichel

Having the !ARCH_MULTIPLATFORM dependency in the Kconfig file results in one option less to think about when configuring the kernel.

---
 arch/arm/Kconfig      | 1 +
 arch/arm/mm/proc-v7.S | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm/Kconfig +1 -0
index 0e4929b..f0e2d92 100644
@@ -1066,6 +1066,7 @@ config ARM_ERRATA_411920
 config ARM_ERRATA_430973
 	bool "ARM errata: Stale prediction on replaced interworking branch"
 	depends on CPU_V7
+	depends on !ARCH_MULTIPLATFORM
 	help
 	  This option enables the workaround for the 430973 Cortex-A8
 	  r1p* erratum. If a code sequence containing an ARM/Thumb
arch/arm/mm/proc-v7.S +1 -1
index 0716bbe..494e844 100644
@@ -294,7 +294,7 @@ __v7_ca17mp_setup:
  *  r9: MIDR
  */
 __ca8_errata:
-#if defined(CONFIG_ARM_ERRATA_430973) && !defined(CONFIG_ARCH_MULTIPLATFORM)
+#ifdef CONFIG_ARM_ERRATA_430973
 	teq	r3, #0x00100000			@ only present in r1p*
 	mrceq	p15, 0, r0, c1, c0, 1		@ read aux control register
 	orreq	r0, r0, #(1 << 6)		@ set IBE to 1
Signature · 1 line
2.1.4
#6 lore raw

Re: [PATCH 3/3] ARM: errata 430973: move !ARCH_MULTIPLATFORM to Kconfig

arch/arm/mm/proc-v7.S __v7_ca17mp_setup: · line 300

Quoted 8 lines · Sebastian Reichel

Having the !ARCH_MULTIPLATFORM dependency in the Kconfig file results in one option less to think about when configuring the kernel.

arch/arm/mm/proc-v7.S +1 -1
-#if defined(CONFIG_ARM_ERRATA_430973) && !defined(CONFIG_ARCH_MULTIPLATFORM)
+#ifdef CONFIG_ARM_ERRATA_430973
 	teq	r3, #0x00100000			@ only present in r1p*
 	mrceq	p15, 0, r0, c1, c0, 1		@ read aux control register
 	orreq	r0, r0, #(1 << 6)		@ set IBE to 1

NAK. Please read the mailing list history, I'm not repeating myself again on this. Thanks.

Signature · 2 lines
FTTC broadband for 0.8mile line: [email protected] down 400kbps up
according to speedtest.net.
#7 lore raw

Re: [PATCH 3/3] ARM: errata 430973: move !ARCH_MULTIPLATFORM to Kconfig

Hi Russel,

Quoted 4 lines · Russell King - ARM Linux
Quoted 2 lines · Sebastian Reichel

Having the !ARCH_MULTIPLATFORM dependency in the Kconfig file results in one option less to think about when configuring the kernel.

Quoted 8 lines

arch/arm/mm/proc-v7.S __v7_ca17mp_setup: · line 300

Quoted 5 lines
arch/arm/mm/proc-v7.S +1 -1
-#if defined(CONFIG_ARM_ERRATA_430973) && !defined(CONFIG_ARCH_MULTIPLATFORM)
+#ifdef CONFIG_ARM_ERRATA_430973
 	teq	r3, #0x00100000			@ only present in r1p*
 	mrceq	p15, 0, r0, c1, c0, 1		@ read aux control register
 	orreq	r0, r0, #(1 << 6)		@ set IBE to 1

NAK. Please read the mailing list history, I'm not repeating myself again on this. Thanks.

It's a bit hard to search the mailing list history without a bit more information.

I guess you prefer to just add the !ARCH_MULTIPLATFORM dependency to the Kconfig entry without removing the additional check in the code?

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150724/98dc4c4b/attachment.sig>

#8 lore raw

Re: [PATCH 3/3] ARM: errata 430973: move !ARCH_MULTIPLATFORM to Kconfig

Quoted 16 lines · Sebastian Reichel

Hi Russel,

Quoted 4 lines · Russell King - ARM Linux
Quoted 2 lines · Sebastian Reichel

Having the !ARCH_MULTIPLATFORM dependency in the Kconfig file results in one option less to think about when configuring the kernel.

Quoted 8 lines

arch/arm/mm/proc-v7.S __v7_ca17mp_setup: · line 300

Quoted 5 lines
arch/arm/mm/proc-v7.S +1 -1
-#if defined(CONFIG_ARM_ERRATA_430973) && !defined(CONFIG_ARCH_MULTIPLATFORM)
+#ifdef CONFIG_ARM_ERRATA_430973
 	teq	r3, #0x00100000			@ only present in r1p*
 	mrceq	p15, 0, r0, c1, c0, 1		@ read aux control register
 	orreq	r0, r0, #(1 << 6)		@ set IBE to 1

NAK. Please read the mailing list history, I'm not repeating myself again on this. Thanks.

Quoted 2 lines

It's a bit hard to search the mailing list history without a bit more information.

You were Cc'd on the previous round of review...

Quoted 2 lines

I guess you prefer to just add the !ARCH_MULTIPLATFORM dependency to the Kconfig entry without removing the additional check in the code?

I was referring to the above change.

However, having discussed with Will Deacon and checked the manuals, I think the change is okay after all: the auxillary control register is banked on secure parts, and the bit we'll be trying to change will be read-only in non-secure mode - and importantly won't fault.

So, the change is fine, thanks.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#9 lore raw

Re: [PATCH 3/3] ARM: errata 430973: move !ARCH_MULTIPLATFORM to Kconfig

Hi,

Quoted 15 lines · Russell King - ARM Linux
Quoted 14 lines · Sebastian Reichel
Quoted 12 lines · Russell King - ARM Linux

arch/arm/mm/proc-v7.S __v7_ca17mp_setup: · line 300

Quoted 8 lines · Sebastian Reichel

Having the !ARCH_MULTIPLATFORM dependency in the Kconfig file results in one option less to think about when configuring the kernel.

arch/arm/mm/proc-v7.S +1 -1
-#if defined(CONFIG_ARM_ERRATA_430973) && !defined(CONFIG_ARCH_MULTIPLATFORM)
+#ifdef CONFIG_ARM_ERRATA_430973
 	teq	r3, #0x00100000			@ only present in r1p*
 	mrceq	p15, 0, r0, c1, c0, 1		@ read aux control register
 	orreq	r0, r0, #(1 << 6)		@ set IBE to 1

NAK. Please read the mailing list history, I'm not repeating myself again on this. Thanks.

Quoted 4 lines
Quoted 2 lines

It's a bit hard to search the mailing list history without a bit more information.

You were Cc'd on the previous round of review...

But that discussion was about removing the check alltogether iirc. This patch does not remove the !ARCH_MULTIPLATFORM check. It just *moves* it from the sourcecode to the errata's Kconfig entry.

The intention was to hide the Kconfig option on multiplatform kernels, since it's completely useless there after the N900 boardcode has been changed (PATCH 1/3).

Quoted 11 lines
Quoted 2 lines

I guess you prefer to just add the !ARCH_MULTIPLATFORM dependency to the Kconfig entry without removing the additional check in the code?

I was referring to the above change.

However, having discussed with Will Deacon and checked the manuals, I think the change is okay after all: the auxillary control register is banked on secure parts, and the bit we'll be trying to change will be read-only in non-secure mode - and importantly won't fault.

So, the change is fine, thanks.

I think you missed the part adding the !ARCH_MULTIPLATFORM dependency in Kconfig for ARM_ERRATA_430973. I only removed the check in the sourcecode, since it is no longer required with the dependency being in Kconfig.

So I guess there are 3 options now:

1. Add !ARCH_MULTIPLATFORM dependency to Kconfig, keep extra check in the sourcecode
2. Add !ARCH_MULTIPLATFORM dependency to Kconfig, remove extra check in the sourcecode
3. Remove !ARCH_MULTIPLATFORM dependency alltogether

I will send an appropriate patch, if you tell me your preferred option.

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150727/a8b16f11/attachment.sig>

#10 lore raw

Re: [PATCH 3/3] ARM: errata 430973: move !ARCH_MULTIPLATFORM to Kconfig

Quoted 57 lines · Sebastian Reichel

Hi,

Quoted 16 lines · Russell King - ARM Linux
Quoted 14 lines · Sebastian Reichel
Quoted 12 lines · Russell King - ARM Linux
Quoted 9 lines · Sebastian Reichel

Having the !ARCH_MULTIPLATFORM dependency in the Kconfig file results in one option less to think about when configuring the kernel.

-#if defined(CONFIG_ARM_ERRATA_430973) &&
!defined(CONFIG_ARCH_MULTIPLATFORM) +#ifdef
CONFIG_ARM_ERRATA_430973 teq r3, #0x00100000 @ only
present in r1p* mrceq p15, 0, r0, c1, c0, 1 @ read aux
control register orreq r0, r0, #(1 << 6) @ set IBE to 1

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

NAK. Please read the mailing list history, I'm not repeating myself again on this. Thanks.

It's a bit hard to search the mailing list history without a bit more information.

You were Cc'd on the previous round of review...

But that discussion was about removing the check alltogether iirc.
This patch does not remove the !ARCH_MULTIPLATFORM check. It just *moves* it from the sourcecode to the errata's Kconfig entry.

The intention was to hide the Kconfig option on multiplatform kernels, since it's completely useless there after the N900 boardcode has been changed (PATCH 1/3).

Quoted 6 lines
Quoted 3 lines

I guess you prefer to just add the !ARCH_MULTIPLATFORM dependency to the Kconfig entry without removing the additional check in the code?

I was referring to the above change.

Quoted 7 lines

However, having discussed with Will Deacon and checked the manuals, I think the change is okay after all: the auxillary control register is banked on secure parts, and the bit we'll be trying to change will be read-only in non-secure mode - and importantly won't fault.

So, the change is fine, thanks.

I think you missed the part adding the !ARCH_MULTIPLATFORM dependency in Kconfig for ARM_ERRATA_430973. I only removed the check in the sourcecode, since it is no longer required with the dependency being in Kconfig.

So I guess there are 3 options now:

Quoted 7 lines

1. Add !ARCH_MULTIPLATFORM dependency to Kconfig, keep extra check in the sourcecode 2. Add !ARCH_MULTIPLATFORM dependency to Kconfig, remove extra check in the sourcecode 3. Remove !ARCH_MULTIPLATFORM dependency alltogether

I will send an appropriate patch, if you tell me your preferred option.

This isn't the only place ARM_ERRATA_430973 is used, and if you make it configurable on !ARCH_MULTIPLATFORM then it makes it impossible to use a ARCH_MULTIPLATFORM kernel on something that is an Cortex-A8.

See arch/arm/mm/proc-v7-2level.S

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#11 lore raw

Re: [PATCH 3/3] ARM: errata 430973: move !ARCH_MULTIPLATFORM to Kconfig

Quoted 6 lines · Ben Dooks

This isn't the only place ARM_ERRATA_430973 is used, and if you make it configurable on !ARCH_MULTIPLATFORM then it makes it impossible to use a ARCH_MULTIPLATFORM kernel on something that is an Cortex-A8.

See arch/arm/mm/proc-v7-2level.S

That has been fixed so that the BTAC/BTB always gets flushed on each context switch for all Cortex-A8 CPUs, but none of the other v7 CPUs.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#12 lore raw

Re: [PATCH 3/3] ARM: errata 430973: move !ARCH_MULTIPLATFORM to Kconfig

In reply to Ben Dooks

Hi Ben,

Quoted 12 lines · Ben Dooks
Quoted 12 lines

I think you missed the part adding the !ARCH_MULTIPLATFORM dependency in Kconfig for ARM_ERRATA_430973. I only removed the check in the sourcecode, since it is no longer required with the dependency being in Kconfig.

So I guess there are 3 options now:

1. Add !ARCH_MULTIPLATFORM dependency to Kconfig, keep extra check in the sourcecode 2. Add !ARCH_MULTIPLATFORM dependency to Kconfig, remove extra check in the sourcecode 3. Remove !ARCH_MULTIPLATFORM dependency alltogether

Quoted 4 lines
Quoted 2 lines

I will send an appropriate patch, if you tell me your preferred option.

This isn't the only place ARM_ERRATA_430973 is used, [...]

The dependency on ARM_ERRATA_430973 has been removed from arch/arm/mm/proc-v7-2level.S in 4.1 (commit id e748994), so that it always flushes. The only additional places are in the Nokia N900 boardcode and the N900 pdata-quirk, which are removed in PATCH 1/3.

So actually it is the only place.

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150727/7c76e4e5/attachment.sig>