Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jie Gan <jie.gan@oss.qualcomm.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@arm.com>,
	James Clark <james.clark@linaro.org>, Leo Yan <leo.yan@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Richard Cheng <icheng@nvidia.com>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Jie Gan <jie.gan@oss.qualcomm.com>
Subject: [PATCH] coresight: fix trace ID search skipping pass-through NoC devices
Date: Mon, 17 Aug 2026 16:50:15 +0800	[thread overview]
Message-ID: <20260817-fix-trace-id-assign-issue-v1-1-b2164e33f9fa@oss.qualcomm.com> (raw)

coresight_path_assign_trace_id() only treats a trace_id of 0 as "this
device has no ID assignment, keep searching downstream". Pass-through
NoC links such as itnoc (qcom,coresight-itnoc) intentionally return
-EOPNOTSUPP from their .trace_id callback since they have no ATID
register to program, but that negative value falls through to the
IS_VALID_CS_TRACE_ID() check and is rejected, aborting the whole path
with -EINVAL before the real trace ID owner further downstream is
ever reached.

This breaks enabling any source whose path traverses an itnoc, e.g.
writing 1 to tpdm/enable_source for a TPDM fails with:

  sh: write error: Invalid argument

Skip devices that return -EOPNOTSUPP the same way as devices that
return 0, so the search continues to the next device on the path.

Fixes: f4526ffee6ff ("coresight: fix missing error code when trace ID is invalid")
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
---
 drivers/hwtracing/coresight/coresight-core.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index 6d65c43d574f..949ee9f00097 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -953,8 +953,12 @@ int coresight_path_assign_trace_id(struct coresight_path *path,
 		/* Assign a trace ID to the path for the first device that wants to do it */
 		trace_id = coresight_get_trace_id(nd->csdev, mode, sink);
 
-		/* 0 means the device has no ID assignment, so keep searching */
-		if (trace_id == 0)
+		/*
+		 * 0 means the device has no ID assignment, and -EOPNOTSUPP
+		 * means the device explicitly declines to assign one (e.g. a
+		 * pass-through NoC) - in both cases keep searching downstream.
+		 */
+		if (trace_id == 0 || trace_id == -EOPNOTSUPP)
 			continue;
 
 		if (!IS_VALID_CS_TRACE_ID(trace_id))

---
base-commit: 4477a78374a57c3809b172ad30cceabda48c47c6
change-id: 20260817-fix-trace-id-assign-issue-d269e90d1c62

Best regards,
-- 
Jie Gan <jie.gan@oss.qualcomm.com>



             reply	other threads:[~2026-08-17  8:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17  8:50 Jie Gan [this message]
2026-09-02  6:00 ` [PATCH] coresight: fix trace ID search skipping pass-through NoC devices Jie Gan
2026-09-02  8:22 ` Leo Yan
2026-09-02  8:35   ` Jie Gan
2026-09-02  8:45     ` Leo Yan
2026-09-02  8:52       ` Jie Gan

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=20260817-fix-trace-id-assign-issue-v1-1-b2164e33f9fa@oss.qualcomm.com \
    --to=jie.gan@oss.qualcomm.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=icheng@nvidia.com \
    --cc=james.clark@linaro.org \
    --cc=leo.yan@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@arm.com \
    --cc=suzuki.poulose@arm.com \
    /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