devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Coresight: Set correct cs_mode for TPDM to fix disable issue
@ 2024-06-25  2:12 Jie Gan
  2024-06-25 12:24 ` Suzuki K Poulose
  0 siblings, 1 reply; 3+ messages in thread
From: Jie Gan @ 2024-06-25  2:12 UTC (permalink / raw)
  To: Mathieu Poirier, Suzuki K Poulose, Alexander Shishkin,
	Konrad Dybcio, Mike Leach, Rob Herring, Krzysztof Kozlowski
  Cc: Jinlong Mao, Greg Kroah-Hartman, coresight, linux-arm-kernel,
	linux-kernel, devicetree, Tingwei Zhang, Yuanfang Zhang,
	Tao Zhang, Trilok Soni, Song Chai, linux-arm-msm, andersson,
	quic_yijiyang, quic_yuanjiey, quic_liuxin, quic_yanzl,
	quic_xinlon, quic_xueqnie, quic_sijiwu

The coresight_disable_source_sysfs function should verify the
mode of the coresight device before disabling the source.
However, the mode for the TPDM device is always set to
CS_MODE_DISABLED, resulting in the check consistently failing.
As a result, TPDM cannot be properly disabled.

To fix the issue:
Configure CS_MODE_SYSFS/CS_MODE_PERF during the enablement of TPDM.
Configure CS_MODE_DISABLED during the disablement of TPDM.

Fixes: 1f5149c7751c("coresight: Move all sysfs code to sysfs file")
Signed-off-by: Jie Gan <quic_jiegan@quicinc.com>
---
 drivers/hwtracing/coresight/coresight-tpdm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c
index a9708ab0d488..90a5105f6199 100644
--- a/drivers/hwtracing/coresight/coresight-tpdm.c
+++ b/drivers/hwtracing/coresight/coresight-tpdm.c
@@ -449,6 +449,11 @@ static int tpdm_enable(struct coresight_device *csdev, struct perf_event *event,
 		return -EBUSY;
 	}
 
+	if (!coresight_take_mode(csdev, mode)) {
+		spin_unlock(&drvdata->spinlock);
+		return -EBUSY;
+	}
+
 	__tpdm_enable(drvdata);
 	drvdata->enable = true;
 	spin_unlock(&drvdata->spinlock);
@@ -506,6 +511,7 @@ static void tpdm_disable(struct coresight_device *csdev,
 	}
 
 	__tpdm_disable(drvdata);
+	coresight_set_mode(csdev, CS_MODE_DISABLED);
 	drvdata->enable = false;
 	spin_unlock(&drvdata->spinlock);
 
-- 
2.34.1


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

* Re: [PATCH] Coresight: Set correct cs_mode for TPDM to fix disable issue
  2024-06-25  2:12 [PATCH] Coresight: Set correct cs_mode for TPDM to fix disable issue Jie Gan
@ 2024-06-25 12:24 ` Suzuki K Poulose
  2024-06-26  1:24   ` JieGan
  0 siblings, 1 reply; 3+ messages in thread
From: Suzuki K Poulose @ 2024-06-25 12:24 UTC (permalink / raw)
  To: Jie Gan, Mathieu Poirier, Alexander Shishkin, Konrad Dybcio,
	Mike Leach, Rob Herring, Krzysztof Kozlowski
  Cc: Jinlong Mao, Greg Kroah-Hartman, coresight, linux-arm-kernel,
	linux-kernel, devicetree, Tingwei Zhang, Yuanfang Zhang,
	Tao Zhang, Trilok Soni, Song Chai, linux-arm-msm, andersson,
	quic_yijiyang, quic_yuanjiey, quic_liuxin, quic_yanzl,
	quic_xinlon, quic_xueqnie, quic_sijiwu

On 25/06/2024 03:12, Jie Gan wrote:
> The coresight_disable_source_sysfs function should verify the
> mode of the coresight device before disabling the source.
> However, the mode for the TPDM device is always set to
> CS_MODE_DISABLED, resulting in the check consistently failing.
> As a result, TPDM cannot be properly disabled.
> 
> To fix the issue:
> Configure CS_MODE_SYSFS/CS_MODE_PERF during the enablement of TPDM.
> Configure CS_MODE_DISABLED during the disablement of TPDM.
> 
> Fixes: 1f5149c7751c("coresight: Move all sysfs code to sysfs file")

That looks like the wrong commit. This was a problem since the original
TPDM driver. I would say :

Fixes: b3c71626a933 ("Coresight: Add coresight TPDM source driver")

> Signed-off-by: Jie Gan <quic_jiegan@quicinc.com>

Otherwise, the patch looks good to me.

Please could you also fixup "dummy" source driver in a separate patch.

Suzuki


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

* Re: [PATCH] Coresight: Set correct cs_mode for TPDM to fix disable issue
  2024-06-25 12:24 ` Suzuki K Poulose
@ 2024-06-26  1:24   ` JieGan
  0 siblings, 0 replies; 3+ messages in thread
From: JieGan @ 2024-06-26  1:24 UTC (permalink / raw)
  To: Suzuki K Poulose
  Cc: Mathieu Poirier, Alexander Shishkin, Konrad Dybcio, Mike Leach,
	Rob Herring, Krzysztof Kozlowski, Jinlong Mao, Greg Kroah-Hartman,
	coresight, linux-arm-kernel, linux-kernel, devicetree,
	Tingwei Zhang, Yuanfang Zhang, Tao Zhang, Trilok Soni, Song Chai,
	linux-arm-msm, andersson, quic_yijiyang, quic_yuanjiey,
	quic_liuxin, quic_yanzl, quic_xinlon, quic_xueqnie, quic_sijiwu

On Tue, Jun 25, 2024 at 01:24:11PM +0100, Suzuki K Poulose wrote:
> On 25/06/2024 03:12, Jie Gan wrote:
> > The coresight_disable_source_sysfs function should verify the
> > mode of the coresight device before disabling the source.
> > However, the mode for the TPDM device is always set to
> > CS_MODE_DISABLED, resulting in the check consistently failing.
> > As a result, TPDM cannot be properly disabled.
> > 
> > To fix the issue:
> > Configure CS_MODE_SYSFS/CS_MODE_PERF during the enablement of TPDM.
> > Configure CS_MODE_DISABLED during the disablement of TPDM.
> > 
> > Fixes: 1f5149c7751c("coresight: Move all sysfs code to sysfs file")
> 
> That looks like the wrong commit. This was a problem since the original
> TPDM driver. I would say :
> 
> Fixes: b3c71626a933 ("Coresight: Add coresight TPDM source driver")
I will correct the Fixes tag and re-send the patch.

> 
> > Signed-off-by: Jie Gan <quic_jiegan@quicinc.com>
> 
> Otherwise, the patch looks good to me.
> 
> Please could you also fixup "dummy" source driver in a separate patch.
Sure.

> 
> Suzuki
> 

Thanks,
Jie

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

end of thread, other threads:[~2024-06-26  1:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25  2:12 [PATCH] Coresight: Set correct cs_mode for TPDM to fix disable issue Jie Gan
2024-06-25 12:24 ` Suzuki K Poulose
2024-06-26  1:24   ` JieGan

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