linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] coresight: replicator: Reset replicator if context is lost
@ 2020-05-11  8:34 Sai Prakash Ranjan
  2020-05-11 16:19 ` Mathieu Poirier
  0 siblings, 1 reply; 3+ messages in thread
From: Sai Prakash Ranjan @ 2020-05-11  8:34 UTC (permalink / raw)
  To: Mathieu Poirier, Suzuki K Poulose, Mike Leach
  Cc: Stephen Boyd, linux-kernel, linux-arm-msm, linux-arm-kernel,
	coresight, Sai Prakash Ranjan

On some QCOM SoCs, replicators in Always-On domain loses its
context as soon as the clock is disabled. Currently as a part
of pm_runtime workqueue, clock is disabled after the replicator
is initialized by amba_pm_runtime_suspend assuming that context
is not lost which is not true for replicators with such
limitations. Hence check the replicator idfilter registers
in dynamic_replicator_enable() and reset again.

Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
---

More info here - https://lore.kernel.org/patchwork/patch/1231182/

---
 drivers/hwtracing/coresight/coresight-replicator.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
index e7dc1c31d20d..11df63f51071 100644
--- a/drivers/hwtracing/coresight/coresight-replicator.c
+++ b/drivers/hwtracing/coresight/coresight-replicator.c
@@ -68,6 +68,17 @@ static int dynamic_replicator_enable(struct replicator_drvdata *drvdata,
 	int rc = 0;
 	u32 reg;
 
+	/*
+	 * On some QCOM SoCs with replicators in Always-On domain, disabling
+	 * clock will result in replicator losing its context. Currently
+	 * as a part of pm_runtime workqueue, amba_pm_runtime_suspend disables
+	 * clock assuming the context is not lost which is not true for cases
+	 * with hardware limitations as the above.
+	 */
+	if ((readl_relaxed(drvdata->base + REPLICATOR_IDFILTER0) == 0) &&
+	    (readl_relaxed(drvdata->base + REPLICATOR_IDFILTER1) == 0))
+		dynamic_replicator_reset(drvdata);
+
 	switch (outport) {
 	case 0:
 		reg = REPLICATOR_IDFILTER0;
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

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

* Re: [PATCH] coresight: replicator: Reset replicator if context is lost
  2020-05-11  8:34 [PATCH] coresight: replicator: Reset replicator if context is lost Sai Prakash Ranjan
@ 2020-05-11 16:19 ` Mathieu Poirier
  2020-05-11 16:26   ` Sai Prakash Ranjan
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Poirier @ 2020-05-11 16:19 UTC (permalink / raw)
  To: Sai Prakash Ranjan
  Cc: Suzuki K Poulose, Mike Leach, linux-arm-msm, Coresight ML,
	Linux Kernel Mailing List, Stephen Boyd, linux-arm-kernel

Hi Sai,

On Mon, 11 May 2020 at 02:34, Sai Prakash Ranjan
<saiprakash.ranjan@codeaurora.org> wrote:
>
> On some QCOM SoCs, replicators in Always-On domain loses its
> context as soon as the clock is disabled. Currently as a part
> of pm_runtime workqueue, clock is disabled after the replicator
> is initialized by amba_pm_runtime_suspend assuming that context
> is not lost which is not true for replicators with such
> limitations. Hence check the replicator idfilter registers
> in dynamic_replicator_enable() and reset again.
>
> Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
> ---
>
> More info here - https://lore.kernel.org/patchwork/patch/1231182/
>
> ---
>  drivers/hwtracing/coresight/coresight-replicator.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
> index e7dc1c31d20d..11df63f51071 100644
> --- a/drivers/hwtracing/coresight/coresight-replicator.c
> +++ b/drivers/hwtracing/coresight/coresight-replicator.c
> @@ -68,6 +68,17 @@ static int dynamic_replicator_enable(struct replicator_drvdata *drvdata,
>         int rc = 0;
>         u32 reg;
>
> +       /*
> +        * On some QCOM SoCs with replicators in Always-On domain, disabling
> +        * clock will result in replicator losing its context. Currently
> +        * as a part of pm_runtime workqueue, amba_pm_runtime_suspend disables
> +        * clock assuming the context is not lost which is not true for cases
> +        * with hardware limitations as the above.
> +        */
> +       if ((readl_relaxed(drvdata->base + REPLICATOR_IDFILTER0) == 0) &&
> +           (readl_relaxed(drvdata->base + REPLICATOR_IDFILTER1) == 0))
> +               dynamic_replicator_reset(drvdata);
> +

Based on your comment here[1] and the ongoing conversation, I will
wait for a V2.

Thanks,
Mathieu

[1]. https://lkml.org/lkml/2020/5/11/650

>         switch (outport) {
>         case 0:
>                 reg = REPLICATOR_IDFILTER0;
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] coresight: replicator: Reset replicator if context is lost
  2020-05-11 16:19 ` Mathieu Poirier
@ 2020-05-11 16:26   ` Sai Prakash Ranjan
  0 siblings, 0 replies; 3+ messages in thread
From: Sai Prakash Ranjan @ 2020-05-11 16:26 UTC (permalink / raw)
  To: Mathieu Poirier
  Cc: Suzuki K Poulose, Mike Leach, linux-arm-msm, Coresight ML,
	Linux Kernel Mailing List, Stephen Boyd, linux-arm-kernel

Hi Mathieu,

On 2020-05-11 21:49, Mathieu Poirier wrote:
> Hi Sai,
> 
> On Mon, 11 May 2020 at 02:34, Sai Prakash Ranjan
> <saiprakash.ranjan@codeaurora.org> wrote:
>> 
>> On some QCOM SoCs, replicators in Always-On domain loses its
>> context as soon as the clock is disabled. Currently as a part
>> of pm_runtime workqueue, clock is disabled after the replicator
>> is initialized by amba_pm_runtime_suspend assuming that context
>> is not lost which is not true for replicators with such
>> limitations. Hence check the replicator idfilter registers
>> in dynamic_replicator_enable() and reset again.
>> 
>> Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
>> ---
>> 
>> More info here - https://lore.kernel.org/patchwork/patch/1231182/
>> 
>> ---
>>  drivers/hwtracing/coresight/coresight-replicator.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>> 
>> diff --git a/drivers/hwtracing/coresight/coresight-replicator.c 
>> b/drivers/hwtracing/coresight/coresight-replicator.c
>> index e7dc1c31d20d..11df63f51071 100644
>> --- a/drivers/hwtracing/coresight/coresight-replicator.c
>> +++ b/drivers/hwtracing/coresight/coresight-replicator.c
>> @@ -68,6 +68,17 @@ static int dynamic_replicator_enable(struct 
>> replicator_drvdata *drvdata,
>>         int rc = 0;
>>         u32 reg;
>> 
>> +       /*
>> +        * On some QCOM SoCs with replicators in Always-On domain, 
>> disabling
>> +        * clock will result in replicator losing its context. 
>> Currently
>> +        * as a part of pm_runtime workqueue, amba_pm_runtime_suspend 
>> disables
>> +        * clock assuming the context is not lost which is not true 
>> for cases
>> +        * with hardware limitations as the above.
>> +        */
>> +       if ((readl_relaxed(drvdata->base + REPLICATOR_IDFILTER0) == 0) 
>> &&
>> +           (readl_relaxed(drvdata->base + REPLICATOR_IDFILTER1) == 
>> 0))
>> +               dynamic_replicator_reset(drvdata);
>> +
> 
> Based on your comment here[1] and the ongoing conversation, I will
> wait for a V2.
> 
> Thanks,
> Mathieu
> 
> [1]. https://lkml.org/lkml/2020/5/11/650
> 

Yes, I will post a v2 once we have consensus regarding which way we need 
to
add a workaround for such QCOM SoCs.

Thanks,
Sai

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
member
of Code Aurora Forum, hosted by The Linux Foundation

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

end of thread, other threads:[~2020-05-11 16:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11  8:34 [PATCH] coresight: replicator: Reset replicator if context is lost Sai Prakash Ranjan
2020-05-11 16:19 ` Mathieu Poirier
2020-05-11 16:26   ` Sai Prakash Ranjan

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