Re: [PATCH v6 2/2] coresight: add coresight Trace Network On Chip driver
From: Yuanfang Zhang
Date: Mon Jun 02 2025 - 23:23:31 EST
On 5/30/2025 8:59 PM, Leo Yan wrote:
> On Fri, May 30, 2025 at 12:32:23PM +0100, Suzuki Kuruppassery Poulose wrote:
>
> [...]
>
>>>> 2) How does the source driver know the TraceID for exposing via sysfs ?
>>>> Does it expose its own traceid ?
>>> No, sources connecting to TNOC don't have their own traceid, it expose the ATID which allocated in TNOC.
>>> TNOC will maintain the ID in coresight_path:: trace_id, when enable source, the source can get it from path.
>>>
>>> Here is the patch to expose id in source:
>>> https://patchwork.kernel.org/project/linux-arm-kernel/patch/20250530-showtraceid-v1-1-2761352cf7b4@xxxxxxxxxxx/
>>
>> Please don't do that. We don't have to fake a traceid for all sources.
>> It is only of use to the decoder, with manual input from the user. So,
>> someone using the TNOC based system must be aware of how to collect the
>> traceid and as such expose it from the TNOC and not all the other
>> sources connected to it.
>>
>> Simply expose it on the TNOC device node
>
> [...]
>
>>>> Good question, since we have the "path" maintaining the TraceID, we
>>>> should use that here for the TNOC. But the other question is, can there be multiple sources connected to a single TNOC ? (I am guessing, yes!. And thus it may not work with what you are proposing.
>>>>
>>> yes, there can be multiple sources connected to one TNOC, and these sources share one Trace ID which allocate in TNOC.
>>> To decode the scenario relay on TraceID + Inport number, TraceID identifies the TNOC, the decoder maintains a table that maps each TNOC inport to its corresponding source.
>
> If the Trace ID is only used to identify a TNOC, I am just wandering
> if can use self-contained method.
>
> For example, you can generate a ID number based on the register base
> address, something like:
>
> /* TNOC physical address */
> drvdata->paddr = res->start;
>
> if (IS_ENABLED(CONFIG_PHYS_ADDR_T_64BIT))
> drvdata->atid = (drvdata->paddr >> 32) ^ (drvdata->paddr & 0xffffffffUL);
> else
> drvdata->atid = drvdata->paddr;
>
> Then, you can get a unique ID for each TNOC in the system, and the
> ID is determined by the pyshical address and can be calculated
> directly by decoder.
>
> Leo
Using both dynamic and self-contained IDs within the same system can result in ID conflicts, which may cause decoding failures.