diff mbox series

[v1,RESEND] Coresight: Set correct cs_mode for dummy source to fix disable issue

Message ID 20240812042844.2890115-1-quic_jiegan@quicinc.com (mailing list archive)
State Not Applicable
Headers show
Series [v1,RESEND] Coresight: Set correct cs_mode for dummy source to fix disable issue | expand

Commit Message

Jie Gan Aug. 12, 2024, 4:28 a.m. UTC
The coresight_disable_source_sysfs function should verify the
mode of the coresight device before disabling the source.
However, the mode for the dummy source device is always set to
CS_MODE_DISABLED, resulting in the check consistently failing.
As a result, dummy source cannot be properly disabled.

Configure CS_MODE_SYSFS/CS_MODE_PERF during the enablement.
Configure CS_MODE_DISABLED during the disablement.

Fixes: 9d3ba0b6c056 ("Coresight: Add coresight dummy driver")
Signed-off-by: Jie Gan <quic_jiegan@quicinc.com>
---
 drivers/hwtracing/coresight/coresight-dummy.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Suzuki K Poulose Aug. 19, 2024, 3:40 p.m. UTC | #1
On Mon, 12 Aug 2024 12:28:44 +0800, 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 dummy source device is always set to
> CS_MODE_DISABLED, resulting in the check consistently failing.
> As a result, dummy source cannot be properly disabled.
> 
> Configure CS_MODE_SYSFS/CS_MODE_PERF during the enablement.
> Configure CS_MODE_DISABLED during the disablement.
> 
> [...]

Applied, thanks!

[1/1] Coresight: Set correct cs_mode for dummy source to fix disable issue
      https://git.kernel.org/coresight/c/e6b64cda393efd84709ab3df2e42d36d36d7553e

Best regards,
diff mbox series

Patch

diff --git a/drivers/hwtracing/coresight/coresight-dummy.c b/drivers/hwtracing/coresight/coresight-dummy.c
index ac70c0b491be..dab389a5507c 100644
--- a/drivers/hwtracing/coresight/coresight-dummy.c
+++ b/drivers/hwtracing/coresight/coresight-dummy.c
@@ -23,6 +23,9 @@  DEFINE_CORESIGHT_DEVLIST(sink_devs, "dummy_sink");
 static int dummy_source_enable(struct coresight_device *csdev,
 			       struct perf_event *event, enum cs_mode mode)
 {
+	if (!coresight_take_mode(csdev, mode))
+		return -EBUSY;
+
 	dev_dbg(csdev->dev.parent, "Dummy source enabled\n");
 
 	return 0;
@@ -31,6 +34,7 @@  static int dummy_source_enable(struct coresight_device *csdev,
 static void dummy_source_disable(struct coresight_device *csdev,
 				 struct perf_event *event)
 {
+	coresight_set_mode(csdev, CS_MODE_DISABLED);
 	dev_dbg(csdev->dev.parent, "Dummy source disabled\n");
 }