[ARM] 4500/1: Add locking around the background L2x0 cache operations

The background operations of the L2x0 cache controllers are aborted if
another operation is issued on the same or different core. This patch
protects the maintenance operation issuing/polling with a spinlock.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by Catalin Marinas and committed by Russell King 07620976 13a63ab2

+6
+6
arch/arm/mm/cache-l2x0.c
··· 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 #include <linux/init.h> 20 21 #include <asm/cacheflush.h> 22 #include <asm/io.h> ··· 26 #define CACHE_LINE_SIZE 32 27 28 static void __iomem *l2x0_base; 29 30 static inline void sync_writel(unsigned long val, unsigned long reg, 31 unsigned long complete_mask) 32 { 33 writel(val, l2x0_base + reg); 34 /* wait for the operation to complete */ 35 while (readl(l2x0_base + reg) & complete_mask) 36 ; 37 } 38 39 static inline void cache_sync(void)
··· 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 #include <linux/init.h> 20 + #include <linux/spinlock.h> 21 22 #include <asm/cacheflush.h> 23 #include <asm/io.h> ··· 25 #define CACHE_LINE_SIZE 32 26 27 static void __iomem *l2x0_base; 28 + static DEFINE_SPINLOCK(l2x0_lock); 29 30 static inline void sync_writel(unsigned long val, unsigned long reg, 31 unsigned long complete_mask) 32 { 33 + unsigned long flags; 34 + 35 + spin_lock_irqsave(&l2x0_lock, flags); 36 writel(val, l2x0_base + reg); 37 /* wait for the operation to complete */ 38 while (readl(l2x0_base + reg) & complete_mask) 39 ; 40 + spin_unlock_irqrestore(&l2x0_lock, flags); 41 } 42 43 static inline void cache_sync(void)