[PATCH 1/2] ARM: l2x0: Errata fix for flush by Wayoperationcan cause data corruption
From: Santosh Shilimkar <hidden>
Date: 2011-03-07 12:25:22
Also in:
linux-omap
Thanks Will for reporting it.
-----Original Message----- From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux- arm-kernel-bounces at lists.infradead.org] On Behalf Of Will Deacon Sent: Monday, March 07, 2011 5:38 PM To: 'Santosh Shilimkar'; Russell King - ARM Linux Cc: tony at atomide.com; Catalin Marinas; linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org Subject: RE: [PATCH 1/2] ARM: l2x0: Errata fix for flush by Wayoperationcan cause data corruption Hi Santosh,quoted
quoted
On Sun, Feb 27, 2011 at 12:00:21PM +0000, Russell King - ARMLinuxquoted
quoted
wrote:quoted
quoted
+#else +/* Optimised out for non-errata case */ +static inline void debug_writel(unsigned long val) +{ }#define l2x0_set_debug NULLquoted
+#endifI notice you got rid of the inline function. Have you tried building this without the errata enabled?I accidently dropped the inline function while incorporating the comment from you. :( Fixed it. Updated version # 6770/1This version of the patch (as it appears in -next) is broken: +#define debug_writel(val) outer_cache.set_debug(val) + +static void l2x0_set_debug(unsigned long val) +{ + writel(val, l2x0_base + L2X0_DEBUG_CTRL);
This should have been "writel_relaxed()" to avoid the cache sync.
quoted hunk ↗ jump to hunk
} [...]@@ -119,9 +120,11 @@ static void l2x0_flush_all(void) /* clean all ways */ spin_lock_irqsave(&l2x0_lock, flags); + debug_writel(0x03); writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_INV_WAY); cache_wait_way(l2x0_base + L2X0_CLEAN_INV_WAY, l2x0_way_mask); cache_sync(); + debug_writel(0x00); spin_unlock_irqrestore(&l2x0_lock, flags); }This deadlocks because the writel forces an outer cache sync, which then tries to acquire the spinlock which is held by the calling function. If you change l2x0_set_debug to use writel_relaxed then you can avoid the problem.
Ya understood. I couldn't test non-errata case because direct right doesn't work because of security and henced missed it. Below is the updated version. Also attached. Russell, Do you want me to push this to patch system or you can apply this one? Regards, Santosh ------