[PATCH v2] coresight: tnoc: fix trace ID path assignment failure on non-AMBA tnoc
Jie Gan
jie.gan at oss.qualcomm.com
Sun Nov 8 17:28:46 PST 2026
On 9/2/2026 5:41 PM, Jie Gan wrote:
> For a tnoc device not on the AMBA bus, atid was set to -EOPNOTSUPP.
> trace_noc_id() returns this value directly to
> coresight_path_assign_trace_id(), which only treats a literal 0
> return as "this device has no ID, keep searching the path" -
> any other value is checked against IS_VALID_CS_TRACE_ID() and
> rejected. A negative atid therefore made path assignment fail with
> -EINVAL instead of falling through to the next device in the path
> that could supply a valid trace ID.
>
> Use 0, the same sentinel coresight_path_assign_trace_id() already
> recognizes as "not allocated", instead of -EOPNOTSUPP.
>
Gentle ping
> Fixes: 5799dee92dc2 ("coresight-tnoc: add platform driver to support Interconnect TNOC")
> Signed-off-by: Jie Gan <jie.gan at oss.qualcomm.com>
> ---
> Changes in v2:
> - fixes the issue in TNOC driver instead of in generic framework.
> Link to v1 - https://lore.kernel.org/all/20260817-fix-trace-id-assign-issue-v1-1-b2164e33f9fa@oss.qualcomm.com/
> ---
> drivers/hwtracing/coresight/coresight-tnoc.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-tnoc.c b/drivers/hwtracing/coresight/coresight-tnoc.c
> index 9e8de4323d28..8924b61ad076 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 == 0) {
> 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)
> @@ -166,7 +164,7 @@ static umode_t trace_id_is_visible(struct kobject *kobj,
> struct device *dev = kobj_to_dev(kobj);
> struct trace_noc_drvdata *drvdata = dev_get_drvdata(dev->parent);
>
> - if (attr == &dev_attr_traceid.attr && drvdata->atid < 0)
> + if (attr == &dev_attr_traceid.attr && drvdata->atid == 0)
> return 0;
>
> return attr->mode;
>
> ---
> base-commit: 8b72f6626dc39b9e7e82b2721d4f7c3b86286012
> change-id: 20260902-fix-trace-id-error-in-tnoc-driver-eda88ea30662
>
> Best regards,
More information about the linux-arm-kernel
mailing list