ARM: 7161/1: errata: no automatic store buffer drain
authorWill Deacon <will.deacon@arm.com>
Mon, 14 Nov 2011 16:24:58 +0000 (17:24 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 9 Dec 2011 17:21:36 +0000 (09:21 -0800)
commit 11ed0ba1754841316d4095478944300acf19acc3 upstream.

This patch implements a workaround for PL310 erratum 769419. On
revisions of the PL310 prior to r3p2, the Store Buffer does not
automatically drain. This can cause normal, non-cacheable writes to be
retained when the memory system is idle, leading to suboptimal I/O
performance for drivers using coherent DMA.

This patch adds an optional wmb() call to the cpu_idle loop. On systems
with an outer cache, this causes an explicit flush of the store buffer.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/arm/Kconfig
arch/arm/kernel/process.c

index e516aa23af0f52257be31b171a40f0964ae079dc..b68faef7ca0cb2660ed4cd9767712de4a74ec3b3 100644 (file)
@@ -1332,6 +1332,18 @@ config ATAGS_PROC
          Should the atags used to boot the kernel be exported in an "atags"
          file in procfs. Useful with kexec.
 
+config PL310_ERRATA_769419
+       bool "PL310 errata: no automatic Store Buffer drain"
+       depends on CACHE_L2X0
+       help
+         On revisions of the PL310 prior to r3p2, the Store Buffer does
+         not automatically drain. This can cause normal, non-cacheable
+         writes to be retained when the memory system is idle, leading
+         to suboptimal I/O performance for drivers using coherent DMA.
+         This option adds a write barrier to the cpu_idle loop so that,
+         on systems with an outer cache, the store buffer is drained
+         explicitly.
+
 endmenu
 
 menu "CPU Power Management"
index 0d96d0171c05601bf59a5e44c579cd7f59e9af23..61f90d390547c088bf075dd9e2034780f5532314 100644 (file)
@@ -156,6 +156,9 @@ void cpu_idle(void)
 #endif
 
                        local_irq_disable();
+#ifdef CONFIG_PL310_ERRATA_769419
+                       wmb();
+#endif
                        if (hlt_counter) {
                                local_irq_enable();
                                cpu_relax();