devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lina Iyer <lina.iyer-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Bjorn Andersson
	<bjorn.andersson-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
Cc: "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org"
	<agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	"msivasub-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org"
	<msivasub-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	"sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org"
	<sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	"robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Jeffrey Hugo <jhugo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Subject: Re: [PATCH RFC 08/10] hwspinlock: qcom: Lock #7 is special lock, uses dynamic proc_id
Date: Fri, 14 Aug 2015 08:12:22 -0600	[thread overview]
Message-ID: <20150814141222.GC86880@linaro.org> (raw)
In-Reply-To: <20150813043036.GJ13472-P9SbAA3LsXe39TS3lRcy0mP6iJigPa5YXqFh9Ls21Oc@public.gmane.org>

On Wed, Aug 12 2015 at 22:30 -0600, Bjorn Andersson wrote:
>On Wed 05 Aug 09:32 PDT 2015, Lina Iyer wrote:
>
>> Hwspinlocks are widely used between processors in an SoC, and also
>> between elevation levels within in the same processor.  QCOM SoC's use
>> hwspinlock to serialize entry into a low power mode when the context
>> switches from Linux to secure monitor.
>>
>> Lock #7 has been assigned for this purpose. In order to differentiate
>> between one cpu core holding a lock while another cpu is contending for
>> the same lock, the proc id written into the lock is (128 + cpu id). This
>> makes it unique value among the cpu cores and therefore when a core
>> locks the hwspinlock, other cores would wait for the lock to be released
>> since they would have a different proc id.  This value is specific for
>> the lock #7 only.
>>
>
>As I was thinking about this, I came to the conclusion that my argument
>that it's system configuration and not a property of the block that lock
>#7 is special is actually biting myself.
>
>Just as #7 is system configuration, so is the fact that 1 is the lock
>value for all other locks.
>
>I've been meaning to answer you, but I haven't come to a good conclusion
>in this matter. I think that both of these properties should be possible
>to express in DT, but I don't know how.
>
I thought about that. These are s/w imposed behavior. As a far as the
h/w is concerned, you could just write a non-zero value and the lock is
considered acquired. So placing that in DT may not be appropriate.

>
>Perhaps we should just list each lock that we expose as a subnode in DT
>with a property to indicate the lock value - with the possibility of
>indicating cpu_id.
>
>Something like:
>
>tcsr-mutex {
>	compatible = "qcom,tcsr-mutex";
>	syscon = <&tcsr_mutex_block 0 0x80>;
>
>	#hwlock-cells = <1>;
>	#address-cells = <1>;
>	#size-cells = <0>;
>
>	smem-lock@3 {
>		reg = <3>;
>		qcom,lock-value = <1>;
>	};
>
>	scm-lock@7 {
>		reg = <7>;
>		qcom,lock-value-from-cpu-id;
>		qcom,lock-raw;
>	};
>};
>
>As we don't reference most of these locks anyways I don't think this
>would still be reasonable. And if reg is an array it's quite compact.
>
But, looking at the DT, its not evident what lock-value-from-cpu-id,
would mean.  It is an implementation detail of Linux (as a result of
firmware). May be better to just hide it in the hwspinlock driver.

I am not sure about lock-raw, but I would think its not QCOM specific.
Imagine the case, when hwspinlock framework does not s/w spinlock around
the hwspinlock, we wouldnt have this property. The reason why we
spinlock around the hwspinlock is because we dont have a good way to
generate a unique value for the hwspinlock, so multiple threads
acquiring the same locks could safely be assured that they have acquired
the lock. While convenient and probably more effecient to just have s/w
spinlocks around the hwspinlock, the problem here is it is mandated
across all locks.

To me it seems OK to explicity call out lock #7 as unique entity in the
bank that is compatible with a raw hwspinlock in the DT. But the value
that lock #7 uses is an implementation detail and should rest wth the
drivers.

Thanks,
Lina
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-08-14 14:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <438731339-58317-1-git-send-email-lina.iyer@linaro.org>
2015-08-05 16:32 ` [PATCH RFC 00/10] qcom: 8084: Cluster idle support Lina Iyer
2015-08-05 16:32   ` [PATCH RFC 01/10] drivers: qcom: spm: Support cache SPMs Lina Iyer
2015-08-05 16:32   ` [PATCH RFC 02/10] drivers: qcom: spm: Add 8084 L2 SPM register data Lina Iyer
2015-08-05 16:32   ` [PATCH RFC 03/10] drivers: qcom: spm: Enable runtime suspend/resume of CPU PM domain Lina Iyer
2015-08-05 16:32   ` [PATCH RFC 04/10] arm: dts: Add L2 power-controller device bindings for APQ8084 Lina Iyer
2015-08-05 16:32   ` [PATCH RFC 05/10] arm: dts: Add power domain " Lina Iyer
2015-08-05 16:32   ` [PATCH RFC 06/10] drivers: qcom: Enable genpd on selecting QCOM_PM Lina Iyer
2015-08-05 16:38     ` Andy Gross
2015-08-05 16:32   ` [PATCH RFC 07/10] hwspinlock: Introduce raw capability for hwspinlocks Lina Iyer
     [not found]   ` <1438792366-2737-1-git-send-email-lina.iyer-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-08-05 16:32     ` [PATCH RFC 08/10] hwspinlock: qcom: Lock #7 is special lock, uses dynamic proc_id Lina Iyer
     [not found]       ` <1438792366-2737-9-git-send-email-lina.iyer-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-08-13  4:30         ` Bjorn Andersson
     [not found]           ` <20150813043036.GJ13472-P9SbAA3LsXe39TS3lRcy0mP6iJigPa5YXqFh9Ls21Oc@public.gmane.org>
2015-08-14 14:12             ` Lina Iyer [this message]
2015-08-05 16:32     ` [PATCH RFC 10/10] arm: dts: qcom: Add TCSR mutex device bindings for APQ8084 Lina Iyer
2015-08-05 16:32   ` [PATCH RFC 09/10] drivers: qcom: spm: Use hwspinlock to serialize entry into SCM Lina Iyer

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=20150814141222.GC86880@linaro.org \
    --to=lina.iyer-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=bjorn.andersson-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jhugo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=msivasub-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.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).