ARM errata fixes for multiple-platform kernels
cover ARM errata fixes for multiple-platform kernels
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(-)
Signature · 1 line
1.7.4.1
PATCH 1/3 ARM: errata: only handle ARM erratum #326103 on affected cores
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.
--- arch/arm/Kconfig | 9 +++++++++ arch/arm/mm/abort-ev6.S | 17 +++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-)
arch/arm/Kconfig +9 -0
@@ -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
arch/arm/mm/abort-ev6.S +11 -6
@@ -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
Signature · 1 line
1.7.4.1
PATCH 2/3 ARM: l2x0: only apply workaround for erratum #753970 on PL310
In reply to Will DeaconThe 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.
--- arch/arm/mm/cache-l2x0.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/mm/cache-l2x0.c +6 -6
@@ -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 ;
Signature · 1 line
1.7.4.1
PATCH 3/3 ARM: l2x0: only write to debug registers on PL310
In reply to Will DeaconPL310 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.
--- arch/arm/mm/cache-l2x0.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
arch/arm/mm/cache-l2x0.c +8 -5
@@ -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",
Signature · 1 line
1.7.4.1