From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755003AbbCLUf3 (ORCPT ); Thu, 12 Mar 2015 16:35:29 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33496 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754743AbbCLUfX (ORCPT ); Thu, 12 Mar 2015 16:35:23 -0400 Message-ID: <5501F889.1020800@codeaurora.org> Date: Thu, 12 Mar 2015 13:35:21 -0700 From: Stephen Boyd User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Lina Iyer , bjorn.andersson@sonymobile.com CC: linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, agross@codeaurora.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Lock 7 is cpuidle specific, use non-generic value for locking References: <1425076217-10415-2-git-send-email-bjorn.andersson@sonymobile.com> <1426189108-35488-1-git-send-email-lina.iyer@linaro.org> In-Reply-To: <1426189108-35488-1-git-send-email-lina.iyer@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/12/15 12:38, Lina Iyer wrote: > --- sign off? > drivers/hwspinlock/qcom_hwspinlock.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c > index 93b62e0..7642524 100644 > --- a/drivers/hwspinlock/qcom_hwspinlock.c > +++ b/drivers/hwspinlock/qcom_hwspinlock.c > @@ -25,16 +25,23 @@ > > #include "hwspinlock_internal.h" > > -#define QCOM_MUTEX_APPS_PROC_ID 1 > -#define QCOM_MUTEX_NUM_LOCKS 32 > +#define QCOM_MUTEX_APPS_PROC_ID 1 > +#define QCOM_MUTEX_CPUIDLE_OFFSET 128 > +#define QCOM_CPUIDLE_LOCK 7 > +#define QCOM_MUTEX_NUM_LOCKS 32 > > static int qcom_hwspinlock_trylock(struct hwspinlock *lock) > { > struct regmap_field *field = lock->priv; > u32 lock_owner; > int ret; > + u32 proc_id; > > - ret = regmap_field_write(field, QCOM_MUTEX_APPS_PROC_ID); > + proc_id = hwspin_lock_get_id(lock) == QCOM_CPUIDLE_LOCK ? > + QCOM_MUTEX_CPUIDLE_OFFSET + smp_processor_id(): So we assume that the caller will always be the CPU that is locking the lock? Also, do we assume that the remote side knows our CPU scheme here? smp_processor_id() returns the logical CPU and not the physical CPU number so hopefully the remote side doesn't care about logical CPU numbers being written to the lock value. Perhaps it would be better to have a way to tell the hwspinlock framework what value we want written to the lock value. > + QCOM_MUTEX_APPS_PROC_ID; > + > + ret = regmap_field_write(field, proc_id); > if (ret) > return ret; > > @@ -42,7 +49,7 @@ static int qcom_hwspinlock_trylock(struct hwspinlock *lock) > if (ret) > return ret; > > - return lock_owner == QCOM_MUTEX_APPS_PROC_ID; > + return lock_owner == proc_id; > } > > static void qcom_hwspinlock_unlock(struct hwspinlock *lock) The unlock path checks proc_id so we need to update the path there too. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project