linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lina Iyer <lina.iyer@linaro.org>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: bjorn.andersson@sonymobile.com, 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
Date: Thu, 12 Mar 2015 14:48:59 -0600	[thread overview]
Message-ID: <20150312204859.GD497@linaro.org> (raw)
In-Reply-To: <5501F889.1020800@codeaurora.org>

On Thu, Mar 12 2015 at 14:35 -0600, Stephen Boyd wrote:
>On 03/12/15 12:38, Lina Iyer wrote:
>> ---
>
>sign off?
>
:) I was just hacking it to make it easier to understand. Sure.

>>  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.

The remote side (SCM) doesnt care the value written. We use 128+cpu to
be unique in Linux(128 is to make sure it doesnt clash with predefined
values used across by other processors.

>
>Perhaps it would be better to have a way to tell the hwspinlock
>framework what value we want written to the lock value.
>
That would be good, if there is value in that for other platforms, I
will gladly make the change.

Thoughts?

>> +			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.
>
Good point. I missed it.

>-- 
>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
>a Linux Foundation Collaborative Project
>

  reply	other threads:[~2015-03-12 20:48 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-27 22:30 [PATCH v6 1/2] DT: hwspinlock: Add binding documentation for Qualcomm hwmutex Bjorn Andersson
2015-02-27 22:30 ` [PATCH v6 2/2] hwspinlock: qcom: Add support for Qualcomm HW Mutex block Bjorn Andersson
2015-03-11 21:09   ` Andy Gross
2015-03-12 19:31   ` Lina Iyer
2015-03-12 19:43     ` Andy Gross
2015-03-12 19:55       ` Lina Iyer
2015-03-18 16:10         ` Bjorn Andersson
2015-03-18 15:55     ` Bjorn Andersson
2015-03-18 16:45       ` Lina Iyer
2015-03-18 21:59         ` Bjorn Andersson
2015-03-12 19:38   ` [PATCH] Lock 7 is cpuidle specific, use non-generic value for locking Lina Iyer
2015-03-12 20:35     ` Stephen Boyd
2015-03-12 20:48       ` Lina Iyer [this message]
2015-03-12 21:12         ` Stephen Boyd
2015-03-12 22:16           ` Lina Iyer
2015-03-13 20:02             ` Andy Gross
2015-03-13 21:27               ` Lina Iyer
2015-03-12 20:49     ` Andy Gross
2015-03-12 20:56       ` Lina Iyer
2015-03-12 22:29   ` [PATCH v6 2/2] hwspinlock: qcom: Add support for Qualcomm HW Mutex block Lina Iyer
2015-03-18 16:12     ` Bjorn Andersson
2015-03-18 19:41       ` Lina Iyer
2015-03-16 22:38   ` Jeffrey Hugo
     [not found] ` <1425076217-10415-1-git-send-email-bjorn.andersson-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
2015-03-02  5:05   ` [PATCH v6 1/2] DT: hwspinlock: Add binding documentation for Qualcomm hwmutex Andy Gross
2015-04-14 19:18   ` Kumar Gala
2015-04-15 18:20     ` Ohad Ben-Cohen
2015-03-12  9:29 ` Ohad Ben-Cohen
2015-04-01 21:32   ` Tim Bird
2015-04-02  4:40     ` Ohad Ben-Cohen
2015-04-02 18:11       ` Tim Bird
     [not found]         ` <CA+bK7J6rXtF54Tp1+mkDbv8Hok88MVZeC+mLvjjGjzZ4KtTHEw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-03 13:55           ` Ohad Ben-Cohen
2015-04-06 16:22             ` Tim Bird
     [not found]               ` <CA+bK7J7OB2bbGna7y-O4egF-rhig-bdf1W5Uw+GG7F0VjDepUg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-06 16:31                 ` Ohad Ben-Cohen
2015-04-06 16:48                   ` Bjorn Andersson
2015-04-06 19:04                     ` Ohad Ben-Cohen
2015-04-13 10:23                       ` Ohad Ben-Cohen
2015-04-15 19:40                         ` Rob Herring
     [not found]                           ` <CAL_Jsq+GhhhoHgRDOkK4=oWtSVmvw=UpLoU-Ey5M7tdNi5OZ2Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-16 12:01                             ` Mark Rutland
2015-03-12  9:51 ` Mark Rutland
2015-03-12 11:14   ` Bjorn Andersson
2015-03-16 22:35 ` Jeffrey Hugo
2015-04-16 11:52 ` Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150312204859.GD497@linaro.org \
    --to=lina.iyer@linaro.org \
    --cc=agross@codeaurora.org \
    --cc=bjorn.andersson@sonymobile.com \
    --cc=jhugo@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).