linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] coresight: add PM runtime calls to coresight_simple_func()
@ 2016-06-17 17:41 Mathieu Poirier
  2016-06-23 16:37 ` Sudeep Holla
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Poirier @ 2016-06-17 17:41 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-kernel

It is mandatory to enable a coresight block's power domain before
trying to access management registers.  Otherwise the transaction
simply stalls, leading to a system hang.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 drivers/hwtracing/coresight/coresight-priv.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
index ad975c58080d..b047241e7496 100644
--- a/drivers/hwtracing/coresight/coresight-priv.h
+++ b/drivers/hwtracing/coresight/coresight-priv.h
@@ -16,6 +16,7 @@
 #include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/coresight.h>
+#include <linux/pm_runtime.h>
 
 /*
  * Coresight management registers (0xf00-0xfcc)
@@ -42,8 +43,10 @@ static ssize_t name##_show(struct device *_dev,				\
 			   struct device_attribute *attr, char *buf)	\
 {									\
 	type *drvdata = dev_get_drvdata(_dev->parent);			\
+	pm_runtime_get_sync(_dev->parent);				\
 	return scnprintf(buf, PAGE_SIZE, "0x%x\n",			\
 			 readl_relaxed(drvdata->base + offset));	\
+	pm_runtime_put_sync(_dev->parent);				\
 }									\
 static DEVICE_ATTR_RO(name)
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] coresight: add PM runtime calls to coresight_simple_func()
  2016-06-17 17:41 [PATCH] coresight: add PM runtime calls to coresight_simple_func() Mathieu Poirier
@ 2016-06-23 16:37 ` Sudeep Holla
  2016-06-23 17:10   ` Mathieu Poirier
  0 siblings, 1 reply; 3+ messages in thread
From: Sudeep Holla @ 2016-06-23 16:37 UTC (permalink / raw)
  To: Mathieu Poirier, linux-arm-kernel; +Cc: Sudeep Holla, linux-kernel



On 17/06/16 18:41, Mathieu Poirier wrote:
> It is mandatory to enable a coresight block's power domain before
> trying to access management registers.  Otherwise the transaction
> simply stalls, leading to a system hang.
>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
>   drivers/hwtracing/coresight/coresight-priv.h | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
> index ad975c58080d..b047241e7496 100644
> --- a/drivers/hwtracing/coresight/coresight-priv.h
> +++ b/drivers/hwtracing/coresight/coresight-priv.h
> @@ -16,6 +16,7 @@
>   #include <linux/bitops.h>
>   #include <linux/io.h>
>   #include <linux/coresight.h>
> +#include <linux/pm_runtime.h>
>
>   /*
>    * Coresight management registers (0xf00-0xfcc)
> @@ -42,8 +43,10 @@ static ssize_t name##_show(struct device *_dev,				\
>   			   struct device_attribute *attr, char *buf)	\
>   {									\
>   	type *drvdata = dev_get_drvdata(_dev->parent);			\
> +	pm_runtime_get_sync(_dev->parent);				\
>   	return scnprintf(buf, PAGE_SIZE, "0x%x\n",			\
>   			 readl_relaxed(drvdata->base + offset));	\
> +	pm_runtime_put_sync(_dev->parent);				\

This is wrong, I just noticed when I was playing around this.
Perhaps you meant to do this before returning ? I wonder why compiler
doesn't throw any error.

-- 
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] coresight: add PM runtime calls to coresight_simple_func()
  2016-06-23 16:37 ` Sudeep Holla
@ 2016-06-23 17:10   ` Mathieu Poirier
  0 siblings, 0 replies; 3+ messages in thread
From: Mathieu Poirier @ 2016-06-23 17:10 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: linux-arm-kernel, linux-kernel

On 23 June 2016 at 10:37, Sudeep Holla <sudeep.holla@arm.com> wrote:
>
>
> On 17/06/16 18:41, Mathieu Poirier wrote:
>>
>> It is mandatory to enable a coresight block's power domain before
>> trying to access management registers.  Otherwise the transaction
>> simply stalls, leading to a system hang.
>>
>> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
>> ---
>>   drivers/hwtracing/coresight/coresight-priv.h | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-priv.h
>> b/drivers/hwtracing/coresight/coresight-priv.h
>> index ad975c58080d..b047241e7496 100644
>> --- a/drivers/hwtracing/coresight/coresight-priv.h
>> +++ b/drivers/hwtracing/coresight/coresight-priv.h
>> @@ -16,6 +16,7 @@
>>   #include <linux/bitops.h>
>>   #include <linux/io.h>
>>   #include <linux/coresight.h>
>> +#include <linux/pm_runtime.h>
>>
>>   /*
>>    * Coresight management registers (0xf00-0xfcc)
>> @@ -42,8 +43,10 @@ static ssize_t name##_show(struct device *_dev,
>> \
>>                            struct device_attribute *attr, char *buf)    \
>>   {                                                                     \
>>         type *drvdata = dev_get_drvdata(_dev->parent);                  \
>> +       pm_runtime_get_sync(_dev->parent);                              \
>>         return scnprintf(buf, PAGE_SIZE, "0x%x\n",                      \
>>                          readl_relaxed(drvdata->base + offset));        \
>> +       pm_runtime_put_sync(_dev->parent);                              \
>
>
> This is wrong, I just noticed when I was playing around this.
> Perhaps you meant to do this before returning ? I wonder why compiler
> doesn't throw any error.

Yes of course - I'll respin.

>
> --
> Regards,
> Sudeep

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-23 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-17 17:41 [PATCH] coresight: add PM runtime calls to coresight_simple_func() Mathieu Poirier
2016-06-23 16:37 ` Sudeep Holla
2016-06-23 17:10   ` Mathieu Poirier

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