All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] ARM errata fixes for multiple-platform kernels
@ 2012-04-12 14:12 Will Deacon
  2012-04-12 14:12 ` [PATCH 1/3] ARM: errata: only handle ARM erratum #326103 on affected cores Will Deacon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Will Deacon @ 2012-04-12 14:12 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

This series fixes three errata workarounds so that they are only applied
on platforms known to be affected at runtime, since applying them on
other platforms can cause nasty side effects (lockups).

Comments and any tested-bys are more than welcome,

Will


Will Deacon (3):
  ARM: errata: only handle ARM erratum #326103 on affected cores
  ARM: l2x0: only apply workaround for erratum #753970 on PL310
  ARM: l2x0: only write to debug registers on PL310

 arch/arm/Kconfig         |    9 +++++++++
 arch/arm/mm/abort-ev6.S  |   17 +++++++++++------
 arch/arm/mm/cache-l2x0.c |   25 ++++++++++++++-----------
 3 files changed, 34 insertions(+), 17 deletions(-)

-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] ARM: errata: only handle ARM erratum #326103 on affected cores
  2012-04-12 14:12 [PATCH 0/3] ARM errata fixes for multiple-platform kernels Will Deacon
@ 2012-04-12 14:12 ` Will Deacon
  2012-04-12 14:12 ` [PATCH 2/3] ARM: l2x0: only apply workaround for erratum #753970 on PL310 Will Deacon
  2012-04-12 14:12 ` [PATCH 3/3] ARM: l2x0: only write to debug registers " Will Deacon
  2 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2012-04-12 14:12 UTC (permalink / raw)
  To: linux-arm-kernel

Erratum #326103 ("FSR write bit incorrect on a SWP to read-only memory")
only affects the ARM 1136 core prior to r1p0. The workaround
disassembles the faulting instruction to determine whether it was a read
or write access on all v6 cores.

An issue has been reported on the ARM 11MPCore whereby loading the
faulting instruction may happen in parallel with that page being
unmapped, resulting in a deadlock due to the lack of TLB broadcasting
in hardware:

http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/091561.html

This patch limits the workaround so that it is only used on affected
cores, which are known to be UP only. Other v6 cores can rely on the
FSR to indicate the access type correctly.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/Kconfig        |    9 +++++++++
 arch/arm/mm/abort-ev6.S |   17 +++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index cf006d4..36586dba 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1186,6 +1186,15 @@ if !MMU
 source "arch/arm/Kconfig-nommu"
 endif
 
+config ARM_ERRATA_326103
+	bool "ARM errata: FSR write bit incorrect on a SWP to read-only memory"
+	depends on CPU_V6
+	help
+	  Executing a SWP instruction to read-only memory does not set bit 11
+	  of the FSR on the ARM 1136 prior to r1p0. This causes the kernel to
+	  treat the access as a read, preventing a COW from occurring and
+	  causing the faulting task to livelock.
+
 config ARM_ERRATA_411920
 	bool "ARM errata: Invalidation of the Instruction Cache operation can fail"
 	depends on CPU_V6 || CPU_V6K
diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S
index ff1f7cc..8074199 100644
--- a/arch/arm/mm/abort-ev6.S
+++ b/arch/arm/mm/abort-ev6.S
@@ -26,18 +26,23 @@ ENTRY(v6_early_abort)
 	mrc	p15, 0, r1, c5, c0, 0		@ get FSR
 	mrc	p15, 0, r0, c6, c0, 0		@ get FAR
 /*
- * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR (erratum 326103).
- * The test below covers all the write situations, including Java bytecodes
+ * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR.
  */
-	bic	r1, r1, #1 << 11		@ clear bit 11 of FSR
+#ifdef CONFIG_ARM_ERRATA_326103
+	ldr	ip, =0x4107b36
+	mrc	p15, 0, r3, c0, c0, 0		@ get processor id
+	teq	ip, r3, lsr #4			@ r0 ARM1136?
+	bne	do_DataAbort
 	tst	r5, #PSR_J_BIT			@ Java?
+	tsteq	r5, #PSR_T_BIT			@ Thumb?
 	bne	do_DataAbort
-	do_thumb_abort fsr=r1, pc=r4, psr=r5, tmp=r3
-	ldreq	r3, [r4]			@ read aborted ARM instruction
+	bic	r1, r1, #1 << 11		@ clear bit 11 of FSR
+	ldr	r3, [r4]			@ read aborted ARM instruction
 #ifdef CONFIG_CPU_ENDIAN_BE8
-	reveq	r3, r3
+	rev	r3, r3
 #endif
 	do_ldrd_abort tmp=ip, insn=r3
 	tst	r3, #1 << 20			@ L = 0 -> write
 	orreq	r1, r1, #1 << 11		@ yes.
+#endif
 	b	do_DataAbort
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] ARM: l2x0: only apply workaround for erratum #753970 on PL310
  2012-04-12 14:12 [PATCH 0/3] ARM errata fixes for multiple-platform kernels Will Deacon
  2012-04-12 14:12 ` [PATCH 1/3] ARM: errata: only handle ARM erratum #326103 on affected cores Will Deacon
@ 2012-04-12 14:12 ` Will Deacon
  2012-04-12 14:12 ` [PATCH 3/3] ARM: l2x0: only write to debug registers " Will Deacon
  2 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2012-04-12 14:12 UTC (permalink / raw)
  To: linux-arm-kernel

The workaround for PL310 erratum #753970 can lead to deadlock on systems
with an L220 cache controller.

This patch makes the workaround effective only when the cache controller
is identified as a PL310 at probe time.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mm/cache-l2x0.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index a53fd2a..a8d02c0 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -32,6 +32,7 @@ static void __iomem *l2x0_base;
 static DEFINE_RAW_SPINLOCK(l2x0_lock);
 static u32 l2x0_way_mask;	/* Bitmask of active ways */
 static u32 l2x0_size;
+static unsigned long sync_reg_offset = L2X0_CACHE_SYNC;
 
 struct l2x0_regs l2x0_saved_regs;
 
@@ -61,12 +62,7 @@ static inline void cache_sync(void)
 {
 	void __iomem *base = l2x0_base;
 
-#ifdef CONFIG_PL310_ERRATA_753970
-	/* write to an unmmapped register */
-	writel_relaxed(0, base + L2X0_DUMMY_REG);
-#else
-	writel_relaxed(0, base + L2X0_CACHE_SYNC);
-#endif
+	writel_relaxed(0, base + sync_reg_offset);
 	cache_wait(base + L2X0_CACHE_SYNC, 1);
 }
 
@@ -331,6 +327,10 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
 		else
 			ways = 8;
 		type = "L310";
+#ifdef CONFIG_PL310_ERRATA_753970
+		/* Unmapped register. */
+		sync_reg_offset = L2X0_DUMMY_REG;
+#endif
 		break;
 	case L2X0_CACHE_ID_PART_L210:
 		ways = (aux >> 13) & 0xf;
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] ARM: l2x0: only write to debug registers on PL310
  2012-04-12 14:12 [PATCH 0/3] ARM errata fixes for multiple-platform kernels Will Deacon
  2012-04-12 14:12 ` [PATCH 1/3] ARM: errata: only handle ARM erratum #326103 on affected cores Will Deacon
  2012-04-12 14:12 ` [PATCH 2/3] ARM: l2x0: only apply workaround for erratum #753970 on PL310 Will Deacon
@ 2012-04-12 14:12 ` Will Deacon
  2 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2012-04-12 14:12 UTC (permalink / raw)
  To: linux-arm-kernel

PL310 errata #588369 and #727915 require writes to the debug registers
of the cache controller to work around known problems. Writing these
registers on L220 may cause deadlock, so ensure that we only perform
this operation when we identify a PL310 at probe time.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/mm/cache-l2x0.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index a8d02c0..2a8e380 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -81,10 +81,13 @@ static inline void l2x0_inv_line(unsigned long addr)
 }
 
 #if defined(CONFIG_PL310_ERRATA_588369) || defined(CONFIG_PL310_ERRATA_727915)
+static inline void debug_writel(unsigned long val)
+{
+	if (outer_cache.set_debug)
+		outer_cache.set_debug(val);
+}
 
-#define debug_writel(val)	outer_cache.set_debug(val)
-
-static void l2x0_set_debug(unsigned long val)
+static void pl310_set_debug(unsigned long val)
 {
 	writel_relaxed(val, l2x0_base + L2X0_DEBUG_CTRL);
 }
@@ -94,7 +97,7 @@ static inline void debug_writel(unsigned long val)
 {
 }
 
-#define l2x0_set_debug	NULL
+#define pl310_set_debug	NULL
 #endif
 
 #ifdef CONFIG_PL310_ERRATA_588369
@@ -331,6 +334,7 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
 		/* Unmapped register. */
 		sync_reg_offset = L2X0_DUMMY_REG;
 #endif
+		outer_cache.set_debug = pl310_set_debug;
 		break;
 	case L2X0_CACHE_ID_PART_L210:
 		ways = (aux >> 13) & 0xf;
@@ -379,7 +383,6 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
 	outer_cache.flush_all = l2x0_flush_all;
 	outer_cache.inv_all = l2x0_inv_all;
 	outer_cache.disable = l2x0_disable;
-	outer_cache.set_debug = l2x0_set_debug;
 
 	printk(KERN_INFO "%s cache controller enabled\n", type);
 	printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-12 14:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 14:12 [PATCH 0/3] ARM errata fixes for multiple-platform kernels Will Deacon
2012-04-12 14:12 ` [PATCH 1/3] ARM: errata: only handle ARM erratum #326103 on affected cores Will Deacon
2012-04-12 14:12 ` [PATCH 2/3] ARM: l2x0: only apply workaround for erratum #753970 on PL310 Will Deacon
2012-04-12 14:12 ` [PATCH 3/3] ARM: l2x0: only write to debug registers " Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.