From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bjorn Andersson Subject: Re: [PATCH v3] hwspinlock/msm: Add support for Qualcomm MSM HW Mutex block Date: Thu, 27 Feb 2014 21:52:43 -0800 Message-ID: References: <1376507361-26907-1-git-send-email-galak@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: In-Reply-To: <1376507361-26907-1-git-send-email-galak@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org To: Kumar Gala Cc: Ohad Ben-Cohen , Rob Herring , Pawel Moll , Mark Rutland , Stephen Warren , Ian Campbell , Grant Likely , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , linux-arm-msm , Jeffrey Hugo , Eric Holmberg List-Id: linux-arm-msm@vger.kernel.org Hi Kumar, I pulled this in to my 3.14 tree and gave it a spin. But I keep hitting the case of unlock below telling me that someone else is holding the lock. On Wed, Aug 14, 2013 at 12:09 PM, Kumar Gala wrote: [...] > + > +static int msm_hwspinlock_trylock(struct hwspinlock *lock) > +{ > + void __iomem *lock_addr = lock->priv; > + > + writel_relaxed(SPINLOCK_ID_APPS_PROC, lock_addr); You need some sort of barrier here; the caf code have a smp_mb() here, inserting that solves the problem. > + > + return readl_relaxed(lock_addr) == SPINLOCK_ID_APPS_PROC; > +} > + > +static void msm_hwspinlock_unlock(struct hwspinlock *lock) > +{ > + u32 lock_owner; > + void __iomem *lock_addr = lock->priv; > + > + lock_owner = readl_relaxed(lock_addr); > + if (lock_owner != SPINLOCK_ID_APPS_PROC) { > + pr_err("%s: spinlock not owned by us (actual owner is %d)\n", > + __func__, lock_owner); > + } > + > + writel_relaxed(0, lock_addr); > +} > + Part of this I think this driver looks good, it would be nice to get the last details cleaned up so we could get it into the tree. Regards, Bjorn