Commit 07620976 authored by Catalin Marinas's avatar Catalin Marinas Committed by Russell King

[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: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 13a63ab2
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/spinlock.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -25,14 +26,19 @@ ...@@ -25,14 +26,19 @@
#define CACHE_LINE_SIZE 32 #define CACHE_LINE_SIZE 32
static void __iomem *l2x0_base; static void __iomem *l2x0_base;
static DEFINE_SPINLOCK(l2x0_lock);
static inline void sync_writel(unsigned long val, unsigned long reg, static inline void sync_writel(unsigned long val, unsigned long reg,
unsigned long complete_mask) unsigned long complete_mask)
{ {
unsigned long flags;
spin_lock_irqsave(&l2x0_lock, flags);
writel(val, l2x0_base + reg); writel(val, l2x0_base + reg);
/* wait for the operation to complete */ /* wait for the operation to complete */
while (readl(l2x0_base + reg) & complete_mask) while (readl(l2x0_base + reg) & complete_mask)
; ;
spin_unlock_irqrestore(&l2x0_lock, flags);
} }
static inline void cache_sync(void) static inline void cache_sync(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment