[RFC PATCH 04/12] arm: mm: cache-l2x0: add l2x0 suspend and resume functions

Daniel Walker dwalker at codeaurora.org
Fri Jan 29 13:29:32 EST 2010


On Fri, 2010-01-29 at 10:23 -0800, Ruan, Willie wrote:
> > From: Daniel Walker [mailto:dwalker at codeaurora.org] 
> > Sent: Friday, January 29, 2010 9:59 AM
> >
> > What if there are multiple cpu's calling cache_sync() at the same time?
> > Disable interrupt wouldn't prevent it ..
> 
> cache_sync() is calling sync_writel(), which is using spin_lock_irqsave().
> So, each call of cache_sync() and sync_writel() is SMP safe individually
> in l2x0_flush_all() as in l2x0_inv_all(), unless we need to protect the
> two calls together, which seems not necessary to me.

This is the current version,

static inline void cache_wait(void __iomem *reg, unsigned long mask)
{
        /* wait for the operation to complete */
        while (readl(reg) & mask)
                ;
}

static inline void cache_sync(void)
{
        void __iomem *base = l2x0_base;
        writel(0, base + L2X0_CACHE_SYNC);
        cache_wait(base + L2X0_CACHE_SYNC, 1);
}

Maybe cache_sync was recently changed to "writel" instead sync_writel()
due it getting called with the lock already held.

Daniel




More information about the linux-arm-kernel mailing list