* [PATCH] coresight: fix trace ID search skipping pass-through NoC devices
@ 2026-08-17 8:50 Jie Gan
2026-09-02 6:00 ` Jie Gan
2026-09-02 8:22 ` Leo Yan
0 siblings, 2 replies; 6+ messages in thread
From: Jie Gan @ 2026-08-17 8:50 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan,
Alexander Shishkin, Richard Cheng
Cc: coresight, linux-arm-kernel, linux-kernel, Jie Gan
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>
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] coresight: fix trace ID search skipping pass-through NoC devices
2026-08-17 8:50 [PATCH] coresight: fix trace ID search skipping pass-through NoC devices Jie Gan
@ 2026-09-02 6:00 ` Jie Gan
2026-09-02 8:22 ` Leo Yan
1 sibling, 0 replies; 6+ messages in thread
From: Jie Gan @ 2026-09-02 6:00 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Leo Yan,
Alexander Shishkin, Richard Cheng
Cc: coresight, linux-arm-kernel, linux-kernel
On 8/17/2026 4:50 PM, Jie Gan wrote:
> 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.
>
Gentle reminder
> 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,
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] coresight: fix trace ID search skipping pass-through NoC devices
2026-08-17 8:50 [PATCH] coresight: fix trace ID search skipping pass-through NoC devices Jie Gan
2026-09-02 6:00 ` Jie Gan
@ 2026-09-02 8:22 ` Leo Yan
2026-09-02 8:35 ` Jie Gan
1 sibling, 1 reply; 6+ messages in thread
From: Leo Yan @ 2026-09-02 8:22 UTC (permalink / raw)
To: Jie Gan
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
Richard Cheng, coresight, linux-arm-kernel, linux-kernel
Hi Jie,
On Mon, Aug 17, 2026 at 04:50:15PM +0800, Jie Gan wrote:
[...]
> @@ -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;
Based on IS_VALID_CS_TRACE_ID(), I see 0 is for no ID assignment,
could you improve a bit tnoc.c instead?
If so, We don't need to add a new error for the same purpose.
---8<---
diff --git a/drivers/hwtracing/coresight/coresight-tnoc.c b/drivers/hwtracing/coresight/coresight-tnoc.c
index 9e8de4323d28..bf221c1e5c48 100644
--- a/drivers/hwtracing/coresight/coresight-tnoc.c
+++ b/drivers/hwtracing/coresight/coresight-tnoc.c
@@ -51,8 +51,8 @@ static void trace_noc_enable_hw(struct trace_noc_drvdata *drvdata)
{
u32 val;
- /* No valid ATID, simply enable the unit */
- if (drvdata->atid == -EOPNOTSUPP) {
+ /* 0 means no ID assignment, simply enable the unit */
+ if (!drvdata->atid) {
writel(TRACE_NOC_CTRL_PORTEN, drvdata->base + TRACE_NOC_CTRL);
return;
}
@@ -130,10 +130,8 @@ static int trace_noc_init_default_data(struct trace_noc_drvdata *drvdata)
{
int atid;
- if (!dev_is_amba(drvdata->dev)) {
- drvdata->atid = -EOPNOTSUPP;
+ if (!dev_is_amba(drvdata->dev))
return 0;
- }
atid = coresight_trace_id_get_system_id();
if (atid < 0)
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] coresight: fix trace ID search skipping pass-through NoC devices
2026-09-02 8:22 ` Leo Yan
@ 2026-09-02 8:35 ` Jie Gan
2026-09-02 8:45 ` Leo Yan
0 siblings, 1 reply; 6+ messages in thread
From: Jie Gan @ 2026-09-02 8:35 UTC (permalink / raw)
To: Leo Yan
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
Richard Cheng, coresight, linux-arm-kernel, linux-kernel
On 9/2/2026 4:22 PM, Leo Yan wrote:
> Hi Jie,
>
> On Mon, Aug 17, 2026 at 04:50:15PM +0800, Jie Gan wrote:
>
> [...]
>
>> @@ -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;
>
> Based on IS_VALID_CS_TRACE_ID(), I see 0 is for no ID assignment,
> could you improve a bit tnoc.c instead?
>
> If so, We don't need to add a new error for the same purpose.
>
Hi Leo,
Thanks for the suggestion.
I will fix this in the TNOC driver. I agree that there is no need to use
additional error codes to report the failure.
I will post the new fix patch after below patch[1] to be applied to
avoid conflict.
[1]
https://lore.kernel.org/all/20260710-fix-tracenoc-probe-issue-v6-2-41eb36fef8d9@oss.qualcomm.com/
Thanks,
Jie
> ---8<---
>
> diff --git a/drivers/hwtracing/coresight/coresight-tnoc.c b/drivers/hwtracing/coresight/coresight-tnoc.c
> index 9e8de4323d28..bf221c1e5c48 100644
> --- a/drivers/hwtracing/coresight/coresight-tnoc.c
> +++ b/drivers/hwtracing/coresight/coresight-tnoc.c
> @@ -51,8 +51,8 @@ static void trace_noc_enable_hw(struct trace_noc_drvdata *drvdata)
> {
> u32 val;
>
> - /* No valid ATID, simply enable the unit */
> - if (drvdata->atid == -EOPNOTSUPP) {
> + /* 0 means no ID assignment, simply enable the unit */
> + if (!drvdata->atid) {
> writel(TRACE_NOC_CTRL_PORTEN, drvdata->base + TRACE_NOC_CTRL);
> return;
> }
> @@ -130,10 +130,8 @@ static int trace_noc_init_default_data(struct trace_noc_drvdata *drvdata)
> {
> int atid;
>
> - if (!dev_is_amba(drvdata->dev)) {
> - drvdata->atid = -EOPNOTSUPP;
> + if (!dev_is_amba(drvdata->dev))
> return 0;
> - }
>
> atid = coresight_trace_id_get_system_id();
> if (atid < 0)
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] coresight: fix trace ID search skipping pass-through NoC devices
2026-09-02 8:35 ` Jie Gan
@ 2026-09-02 8:45 ` Leo Yan
2026-09-02 8:52 ` Jie Gan
0 siblings, 1 reply; 6+ messages in thread
From: Leo Yan @ 2026-09-02 8:45 UTC (permalink / raw)
To: Jie Gan
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
Richard Cheng, coresight, linux-arm-kernel, linux-kernel
On Wed, Sep 02, 2026 at 04:35:11PM +0800, Jie Gan wrote:
[...]
> Hi Leo,
>
> Thanks for the suggestion.
You're welcome!
> I will fix this in the TNOC driver. I agree that there is no need to use
> additional error codes to report the failure.
>
> I will post the new fix patch after below patch[1] to be applied to avoid
> conflict.
The patch in the link has no fix tag, but current patch is a simple fix.
I'd suggest to give priority this patch - this is friendly for porting
to stable kernels.
If there have dependency (based on your local test), you could explictly
mention the dependency in cover letter and resend the tnoc probe series.
Thanks,
Leo
> [1] https://lore.kernel.org/all/20260710-fix-tracenoc-probe-issue-v6-2-41eb36fef8d9@oss.qualcomm.com/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] coresight: fix trace ID search skipping pass-through NoC devices
2026-09-02 8:45 ` Leo Yan
@ 2026-09-02 8:52 ` Jie Gan
0 siblings, 0 replies; 6+ messages in thread
From: Jie Gan @ 2026-09-02 8:52 UTC (permalink / raw)
To: Leo Yan
Cc: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin,
Richard Cheng, coresight, linux-arm-kernel, linux-kernel
On 9/2/2026 4:45 PM, Leo Yan wrote:
> On Wed, Sep 02, 2026 at 04:35:11PM +0800, Jie Gan wrote:
>
> [...]
>
>> Hi Leo,
>>
>> Thanks for the suggestion.
>
> You're welcome!
>
>> I will fix this in the TNOC driver. I agree that there is no need to use
>> additional error codes to report the failure.
>>
>> I will post the new fix patch after below patch[1] to be applied to avoid
>> conflict.
>
> The patch in the link has no fix tag, but current patch is a simple fix.
I called it as a fix because the TNOC device cannot be probed by the
AMBA driver unless the PID is manually assigned. This is a hardware
limitation rather than a driver issue. The problem is resolved by
switching the device to use a platform driver, so I didnt add a fixes tag.
I will send the simple fix first. Depending on which patch gets applied
first, I'll respin the other one to avoid conflicts.
Thanks,
Jie
> I'd suggest to give priority this patch - this is friendly for porting
> to stable kernels.
>
> If there have dependency (based on your local test), you could explictly
> mention the dependency in cover letter and resend the tnoc probe series.
>
> Thanks,
> Leo
>
>> [1] https://lore.kernel.org/all/20260710-fix-tracenoc-probe-issue-v6-2-41eb36fef8d9@oss.qualcomm.com/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-02 8:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17 8:50 [PATCH] coresight: fix trace ID search skipping pass-through NoC devices Jie Gan
2026-09-02 6:00 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox