On Tue, 31 Mar 2026 18:05:22 +0800, Jie Gan wrote:
> Save the trace ID in drvdata during TPDM enablement and expose it
> to userspace to support trace data parsing.
>
> The TPDM device’s trace ID corresponds to the trace ID allocated
> to the connected TPDA device.
>
>
> [...]
Applied, thanks!
[1/1] coresight: tpdm: add traceid_show for checking traceid
commit: ec687ba84000d7d50cf243558041f6729d1d8119
Best regards,
--
Suzuki K Poulose <suzuki.poulose(a)arm.com>
On 31/03/2026 10:33 am, Jie Gan wrote:
>
>
> On 3/31/2026 5:26 PM, James Clark wrote:
>>
>>
>> On 31/03/2026 4:18 am, Jie Gan wrote:
>>> Hi James,
>>>
>>> On 3/31/2026 9:29 AM, Jie Gan wrote:
>>>>
>>>> Hi James,
>>>>
>>>> On 3/30/2026 10:55 PM, James Clark wrote:
>>>>>
>>>>>
>>>>> On 25/03/2026 3:10 am, Jie Gan wrote:
>>>>>> Save the trace ID in drvdata during TPDM enablement and expose it
>>>>>> to userspace to support trace data parsing.
>>>>>>
>>>>>> The TPDM device’s trace ID corresponds to the trace ID allocated
>>>>>> to the connected TPDA device.
>>>>>>
>>>>>> Signed-off-by: Jie Gan <jie.gan(a)oss.qualcomm.com>
>>>>>> ---
>>>>>> Changes in v3:
>>>>>> 1. Only allow user to read the traceid while the TPDM device is
>>>>>> enabled.
>>>>>> - Link to v2: https://lore.kernel.org/r/20260316-add-traceid-show-
>>>>>> for- tpdm-v2-1-1dec2a67e4ed(a)oss.qualcomm.com
>>>>>>
>>>>>> Changes in V2:
>>>>>> 1. Use sysfs_emit instead of sprintf.
>>>>>> Link to V1 - https://lore.kernel.org/all/20260306-add-traceid-
>>>>>> show- for-tpdm-v1-1-0658a8edb972(a)oss.qualcomm.com/
>>>>>> ---
>>>>>> drivers/hwtracing/coresight/coresight-tpdm.c | 34 ++++++++++++++
>>>>>> + + + + +++++++++-
>>>>>> drivers/hwtracing/coresight/coresight-tpdm.h | 2 ++
>>>>>> 2 files changed, 35 insertions(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/
>>>>>> drivers/ hwtracing/coresight/coresight-tpdm.c
>>>>>> index da77bdaad0a4..c8339b973bfc 100644
>>>>>> --- a/drivers/hwtracing/coresight/coresight-tpdm.c
>>>>>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c
>>>>>> @@ -481,7 +481,7 @@ static void __tpdm_enable(struct tpdm_drvdata
>>>>>> *drvdata)
>>>>>> static int tpdm_enable(struct coresight_device *csdev, struct
>>>>>> perf_event *event,
>>>>>> enum cs_mode mode,
>>>>>> - __maybe_unused struct coresight_path *path)
>>>>>> + struct coresight_path *path)
>>>>>> {
>>>>>> struct tpdm_drvdata *drvdata = dev_get_drvdata(csdev-
>>>>>> >dev.parent);
>>>>>> @@ -497,6 +497,7 @@ static int tpdm_enable(struct coresight_device
>>>>>> *csdev, struct perf_event *event,
>>>>>> }
>>>>>> __tpdm_enable(drvdata);
>>>>>> + drvdata->traceid = path->trace_id;
>>>>>> drvdata->enable = true;
>>>>>> spin_unlock(&drvdata->spinlock);
>>>>>> @@ -693,6 +694,29 @@ static struct attribute_group tpdm_attr_grp = {
>>>>>> .attrs = tpdm_attrs,
>>>>>> };
>>>>>> +static ssize_t traceid_show(struct device *dev,
>>>>>> + struct device_attribute *attr, char *buf)
>>>>>> +{
>>>>>> + unsigned long val;
>>>>>> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
>>>>>> +
>>>>>> + if (coresight_get_mode(drvdata->csdev) == CS_MODE_DISABLED)
>>>>>> + return -EINVAL;
>>>>>> +
>>>>>> + val = drvdata->traceid;
>>>>>
>>>>> You probably need to take the coresight_mutex here otherwise you
>>>>> could still return an invalid or stale value despite checking the
>>>>> mode.
>>>>>
>>>>
>>>> Acked. I have missed this potential race condition.
>>>>
>>>>> There might also be some value in it returning the last used trace
>>>>> ID even if the mode isn't enabled anymore. Because you can still
>>>>> read out of the sink after disabling, so it makes more sense for a
>>>>> script to read it at that point rather than when it's enabled.
>>>>> Also, you probably don't want to be doing other things in your
>>>>> script in the point between enabling and disabling.
>>>>
>>>> That's making sense. I shouldnt add such restriction for the read
>>>> process.
>>>>
>>>
>>> I missed one point in last message.
>>>
>>> Is that acceptable to export the coresight_mutex from the core module?
>>> Currently, the coresight_mutex is used within the module only.
>>>
>>> Thanks,
>>> Jie
>>>
>>
>> If the plan is to only check for non-zero trace ID and not check the
>> mode any more then you don't need to lock. Maybe lets see what Suzuki
>> thinks about returning the last trace ID though as it was his idea to
>> add -EINVAL.
>>
>
> Sure. The trace ID is allocated during TPDA device probe and remains
> unchanged for the entire lifetime of the device.
>
> Thanks,
> Jie
>
>
Oh I missed that because it's assigned every time in tpdm_enable(). In
that case I don't see why it can't be just:
val = drvdata->traceid;
if (!val)
return -EINVAL;
return sysfs_emit(...)
>>>> Scenarios for reading:
>>>> 1. device is enabled -> trace ID is valid
>>>> 2. device is enabled then disabled -> trace ID is valid for the last
>>>> trace event
>>>> 3. device is never enabled -> invalid trace ID (value 0)
>>>>
>>>> we only need to check the validation of the trace ID.
>>>>
>>>> mutex_lock(&coresight_mutex);
>>>> val = drvdata->traceid;
>>>> mutex_unlock(&coresight_mutex);
>>>>
>>>> if (!val)
>>>> return -EINVAL;
>>>>
>>>> return sysfs_emit(buf, "%#lx\n", val);
>>>>
>>>> Thanks,
>>>> Jie
>>>>
>>>>>
>>>>>> + return sysfs_emit(buf, "%#lx\n", val);
>>>>>> +}
>>>>>> +static DEVICE_ATTR_RO(traceid);
>>>>>> +
>>>>>> +static struct attribute *traceid_attrs[] = {
>>>>>> + &dev_attr_traceid.attr,
>>>>>> + NULL,
>>>>>> +};
>>>>>> +
>>>>>> +static struct attribute_group traceid_attr_grp = {
>>>>>> + .attrs = traceid_attrs,
>>>>>> +};
>>>>>> +
>>>>>> static ssize_t dsb_mode_show(struct device *dev,
>>>>>> struct device_attribute *attr,
>>>>>> char *buf)
>>>>>> @@ -1367,6 +1391,12 @@ static const struct attribute_group
>>>>>> *tpdm_attr_grps[] = {
>>>>>> &tpdm_cmb_patt_grp,
>>>>>> &tpdm_cmb_msr_grp,
>>>>>> &tpdm_mcmb_attr_grp,
>>>>>> + &traceid_attr_grp,
>>>>>> + NULL,
>>>>>> +};
>>>>>> +
>>>>>> +static const struct attribute_group *static_tpdm_attr_grps[] = {
>>>>>> + &traceid_attr_grp,
>>>>>> NULL,
>>>>>> };
>>>>>> @@ -1425,6 +1455,8 @@ static int tpdm_probe(struct device *dev,
>>>>>> struct resource *res)
>>>>>> desc.access = CSDEV_ACCESS_IOMEM(base);
>>>>>> if (res)
>>>>>> desc.groups = tpdm_attr_grps;
>>>>>> + else
>>>>>> + desc.groups = static_tpdm_attr_grps;
>>>>>> drvdata->csdev = coresight_register(&desc);
>>>>>> if (IS_ERR(drvdata->csdev))
>>>>>> return PTR_ERR(drvdata->csdev);
>>>>>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h b/
>>>>>> drivers/ hwtracing/coresight/coresight-tpdm.h
>>>>>> index 2867f3ab8186..11da64e1ade8 100644
>>>>>> --- a/drivers/hwtracing/coresight/coresight-tpdm.h
>>>>>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.h
>>>>>> @@ -300,6 +300,7 @@ struct cmb_dataset {
>>>>>> * @cmb Specifics associated to TPDM CMB.
>>>>>> * @dsb_msr_num Number of MSR supported by DSB TPDM
>>>>>> * @cmb_msr_num Number of MSR supported by CMB TPDM
>>>>>> + * @traceid Trace ID of the path.
>>>>>> */
>>>>>> struct tpdm_drvdata {
>>>>>> @@ -313,6 +314,7 @@ struct tpdm_drvdata {
>>>>>> struct cmb_dataset *cmb;
>>>>>> u32 dsb_msr_num;
>>>>>> u32 cmb_msr_num;
>>>>>> + u8 traceid;
>>>>>> };
>>>>>> /* Enumerate members of various datasets */
>>>>>>
>>>>>> ---
>>>>>> base-commit: b84a0ebe421ca56995ff78b66307667b62b3a900
>>>>>> change-id: 20260316-add-traceid-show-for-tpdm-88d040651f00
>>>>>>
>>>>>> Best regards,
>>>>>
>>>>
>>>
>>
>
On 31/03/2026 4:18 am, Jie Gan wrote:
> Hi James,
>
> On 3/31/2026 9:29 AM, Jie Gan wrote:
>>
>> Hi James,
>>
>> On 3/30/2026 10:55 PM, James Clark wrote:
>>>
>>>
>>> On 25/03/2026 3:10 am, Jie Gan wrote:
>>>> Save the trace ID in drvdata during TPDM enablement and expose it
>>>> to userspace to support trace data parsing.
>>>>
>>>> The TPDM device’s trace ID corresponds to the trace ID allocated
>>>> to the connected TPDA device.
>>>>
>>>> Signed-off-by: Jie Gan <jie.gan(a)oss.qualcomm.com>
>>>> ---
>>>> Changes in v3:
>>>> 1. Only allow user to read the traceid while the TPDM device is
>>>> enabled.
>>>> - Link to v2: https://lore.kernel.org/r/20260316-add-traceid-show-
>>>> for- tpdm-v2-1-1dec2a67e4ed(a)oss.qualcomm.com
>>>>
>>>> Changes in V2:
>>>> 1. Use sysfs_emit instead of sprintf.
>>>> Link to V1 - https://lore.kernel.org/all/20260306-add-traceid-show-
>>>> for-tpdm-v1-1-0658a8edb972(a)oss.qualcomm.com/
>>>> ---
>>>> drivers/hwtracing/coresight/coresight-tpdm.c | 34 ++++++++++++++++
>>>> + + +++++++++-
>>>> drivers/hwtracing/coresight/coresight-tpdm.h | 2 ++
>>>> 2 files changed, 35 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/
>>>> hwtracing/coresight/coresight-tpdm.c
>>>> index da77bdaad0a4..c8339b973bfc 100644
>>>> --- a/drivers/hwtracing/coresight/coresight-tpdm.c
>>>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c
>>>> @@ -481,7 +481,7 @@ static void __tpdm_enable(struct tpdm_drvdata
>>>> *drvdata)
>>>> static int tpdm_enable(struct coresight_device *csdev, struct
>>>> perf_event *event,
>>>> enum cs_mode mode,
>>>> - __maybe_unused struct coresight_path *path)
>>>> + struct coresight_path *path)
>>>> {
>>>> struct tpdm_drvdata *drvdata = dev_get_drvdata(csdev-
>>>> >dev.parent);
>>>> @@ -497,6 +497,7 @@ static int tpdm_enable(struct coresight_device
>>>> *csdev, struct perf_event *event,
>>>> }
>>>> __tpdm_enable(drvdata);
>>>> + drvdata->traceid = path->trace_id;
>>>> drvdata->enable = true;
>>>> spin_unlock(&drvdata->spinlock);
>>>> @@ -693,6 +694,29 @@ static struct attribute_group tpdm_attr_grp = {
>>>> .attrs = tpdm_attrs,
>>>> };
>>>> +static ssize_t traceid_show(struct device *dev,
>>>> + struct device_attribute *attr, char *buf)
>>>> +{
>>>> + unsigned long val;
>>>> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
>>>> +
>>>> + if (coresight_get_mode(drvdata->csdev) == CS_MODE_DISABLED)
>>>> + return -EINVAL;
>>>> +
>>>> + val = drvdata->traceid;
>>>
>>> You probably need to take the coresight_mutex here otherwise you
>>> could still return an invalid or stale value despite checking the mode.
>>>
>>
>> Acked. I have missed this potential race condition.
>>
>>> There might also be some value in it returning the last used trace ID
>>> even if the mode isn't enabled anymore. Because you can still read
>>> out of the sink after disabling, so it makes more sense for a script
>>> to read it at that point rather than when it's enabled. Also, you
>>> probably don't want to be doing other things in your script in the
>>> point between enabling and disabling.
>>
>> That's making sense. I shouldnt add such restriction for the read
>> process.
>>
>
> I missed one point in last message.
>
> Is that acceptable to export the coresight_mutex from the core module?
> Currently, the coresight_mutex is used within the module only.
>
> Thanks,
> Jie
>
If the plan is to only check for non-zero trace ID and not check the
mode any more then you don't need to lock. Maybe lets see what Suzuki
thinks about returning the last trace ID though as it was his idea to
add -EINVAL.
>> Scenarios for reading:
>> 1. device is enabled -> trace ID is valid
>> 2. device is enabled then disabled -> trace ID is valid for the last
>> trace event
>> 3. device is never enabled -> invalid trace ID (value 0)
>>
>> we only need to check the validation of the trace ID.
>>
>> mutex_lock(&coresight_mutex);
>> val = drvdata->traceid;
>> mutex_unlock(&coresight_mutex);
>>
>> if (!val)
>> return -EINVAL;
>>
>> return sysfs_emit(buf, "%#lx\n", val);
>>
>> Thanks,
>> Jie
>>
>>>
>>>> + return sysfs_emit(buf, "%#lx\n", val);
>>>> +}
>>>> +static DEVICE_ATTR_RO(traceid);
>>>> +
>>>> +static struct attribute *traceid_attrs[] = {
>>>> + &dev_attr_traceid.attr,
>>>> + NULL,
>>>> +};
>>>> +
>>>> +static struct attribute_group traceid_attr_grp = {
>>>> + .attrs = traceid_attrs,
>>>> +};
>>>> +
>>>> static ssize_t dsb_mode_show(struct device *dev,
>>>> struct device_attribute *attr,
>>>> char *buf)
>>>> @@ -1367,6 +1391,12 @@ static const struct attribute_group
>>>> *tpdm_attr_grps[] = {
>>>> &tpdm_cmb_patt_grp,
>>>> &tpdm_cmb_msr_grp,
>>>> &tpdm_mcmb_attr_grp,
>>>> + &traceid_attr_grp,
>>>> + NULL,
>>>> +};
>>>> +
>>>> +static const struct attribute_group *static_tpdm_attr_grps[] = {
>>>> + &traceid_attr_grp,
>>>> NULL,
>>>> };
>>>> @@ -1425,6 +1455,8 @@ static int tpdm_probe(struct device *dev,
>>>> struct resource *res)
>>>> desc.access = CSDEV_ACCESS_IOMEM(base);
>>>> if (res)
>>>> desc.groups = tpdm_attr_grps;
>>>> + else
>>>> + desc.groups = static_tpdm_attr_grps;
>>>> drvdata->csdev = coresight_register(&desc);
>>>> if (IS_ERR(drvdata->csdev))
>>>> return PTR_ERR(drvdata->csdev);
>>>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h b/drivers/
>>>> hwtracing/coresight/coresight-tpdm.h
>>>> index 2867f3ab8186..11da64e1ade8 100644
>>>> --- a/drivers/hwtracing/coresight/coresight-tpdm.h
>>>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.h
>>>> @@ -300,6 +300,7 @@ struct cmb_dataset {
>>>> * @cmb Specifics associated to TPDM CMB.
>>>> * @dsb_msr_num Number of MSR supported by DSB TPDM
>>>> * @cmb_msr_num Number of MSR supported by CMB TPDM
>>>> + * @traceid Trace ID of the path.
>>>> */
>>>> struct tpdm_drvdata {
>>>> @@ -313,6 +314,7 @@ struct tpdm_drvdata {
>>>> struct cmb_dataset *cmb;
>>>> u32 dsb_msr_num;
>>>> u32 cmb_msr_num;
>>>> + u8 traceid;
>>>> };
>>>> /* Enumerate members of various datasets */
>>>>
>>>> ---
>>>> base-commit: b84a0ebe421ca56995ff78b66307667b62b3a900
>>>> change-id: 20260316-add-traceid-show-for-tpdm-88d040651f00
>>>>
>>>> Best regards,
>>>
>>
>
On 25/03/2026 3:10 am, Jie Gan wrote:
> Save the trace ID in drvdata during TPDM enablement and expose it
> to userspace to support trace data parsing.
>
> The TPDM device’s trace ID corresponds to the trace ID allocated
> to the connected TPDA device.
>
> Signed-off-by: Jie Gan <jie.gan(a)oss.qualcomm.com>
> ---
> Changes in v3:
> 1. Only allow user to read the traceid while the TPDM device is enabled.
> - Link to v2: https://lore.kernel.org/r/20260316-add-traceid-show-for-tpdm-v2-1-1dec2a67e…
>
> Changes in V2:
> 1. Use sysfs_emit instead of sprintf.
> Link to V1 - https://lore.kernel.org/all/20260306-add-traceid-show-for-tpdm-v1-1-0658a8e…
> ---
> drivers/hwtracing/coresight/coresight-tpdm.c | 34 +++++++++++++++++++++++++++-
> drivers/hwtracing/coresight/coresight-tpdm.h | 2 ++
> 2 files changed, 35 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c
> index da77bdaad0a4..c8339b973bfc 100644
> --- a/drivers/hwtracing/coresight/coresight-tpdm.c
> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c
> @@ -481,7 +481,7 @@ static void __tpdm_enable(struct tpdm_drvdata *drvdata)
>
> static int tpdm_enable(struct coresight_device *csdev, struct perf_event *event,
> enum cs_mode mode,
> - __maybe_unused struct coresight_path *path)
> + struct coresight_path *path)
> {
> struct tpdm_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
>
> @@ -497,6 +497,7 @@ static int tpdm_enable(struct coresight_device *csdev, struct perf_event *event,
> }
>
> __tpdm_enable(drvdata);
> + drvdata->traceid = path->trace_id;
> drvdata->enable = true;
> spin_unlock(&drvdata->spinlock);
>
> @@ -693,6 +694,29 @@ static struct attribute_group tpdm_attr_grp = {
> .attrs = tpdm_attrs,
> };
>
> +static ssize_t traceid_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + unsigned long val;
> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
> +
> + if (coresight_get_mode(drvdata->csdev) == CS_MODE_DISABLED)
> + return -EINVAL;
> +
> + val = drvdata->traceid;
You probably need to take the coresight_mutex here otherwise you could
still return an invalid or stale value despite checking the mode.
There might also be some value in it returning the last used trace ID
even if the mode isn't enabled anymore. Because you can still read out
of the sink after disabling, so it makes more sense for a script to read
it at that point rather than when it's enabled. Also, you probably don't
want to be doing other things in your script in the point between
enabling and disabling.
> + return sysfs_emit(buf, "%#lx\n", val);
> +}
> +static DEVICE_ATTR_RO(traceid);
> +
> +static struct attribute *traceid_attrs[] = {
> + &dev_attr_traceid.attr,
> + NULL,
> +};
> +
> +static struct attribute_group traceid_attr_grp = {
> + .attrs = traceid_attrs,
> +};
> +
> static ssize_t dsb_mode_show(struct device *dev,
> struct device_attribute *attr,
> char *buf)
> @@ -1367,6 +1391,12 @@ static const struct attribute_group *tpdm_attr_grps[] = {
> &tpdm_cmb_patt_grp,
> &tpdm_cmb_msr_grp,
> &tpdm_mcmb_attr_grp,
> + &traceid_attr_grp,
> + NULL,
> +};
> +
> +static const struct attribute_group *static_tpdm_attr_grps[] = {
> + &traceid_attr_grp,
> NULL,
> };
>
> @@ -1425,6 +1455,8 @@ static int tpdm_probe(struct device *dev, struct resource *res)
> desc.access = CSDEV_ACCESS_IOMEM(base);
> if (res)
> desc.groups = tpdm_attr_grps;
> + else
> + desc.groups = static_tpdm_attr_grps;
> drvdata->csdev = coresight_register(&desc);
> if (IS_ERR(drvdata->csdev))
> return PTR_ERR(drvdata->csdev);
> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h b/drivers/hwtracing/coresight/coresight-tpdm.h
> index 2867f3ab8186..11da64e1ade8 100644
> --- a/drivers/hwtracing/coresight/coresight-tpdm.h
> +++ b/drivers/hwtracing/coresight/coresight-tpdm.h
> @@ -300,6 +300,7 @@ struct cmb_dataset {
> * @cmb Specifics associated to TPDM CMB.
> * @dsb_msr_num Number of MSR supported by DSB TPDM
> * @cmb_msr_num Number of MSR supported by CMB TPDM
> + * @traceid Trace ID of the path.
> */
>
> struct tpdm_drvdata {
> @@ -313,6 +314,7 @@ struct tpdm_drvdata {
> struct cmb_dataset *cmb;
> u32 dsb_msr_num;
> u32 cmb_msr_num;
> + u8 traceid;
> };
>
> /* Enumerate members of various datasets */
>
> ---
> base-commit: b84a0ebe421ca56995ff78b66307667b62b3a900
> change-id: 20260316-add-traceid-show-for-tpdm-88d040651f00
>
> Best regards,
On Fri, 27 Mar 2026 14:24:14 +0800, Jie Gan wrote:
> Correct the upper bound from CTIINOUTEN_MAX to config->nr_trig_max,
> since nr_trig_max varies across CTI devices. An out-of-bounds issue
> occurs when a value greater than config->nr_trig_max is provided,
> leading to unexpected errors.
>
>
Applied, thanks!
[1/1] coresight: cti: fix the check condition in inout_sel_store
https://git.kernel.org/coresight/c/08643a8760e8
Best regards,
--
Suzuki K Poulose <suzuki.poulose(a)arm.com>
On Fri, Mar 27, 2026 at 02:24:14PM +0800, Jie Gan wrote:
> Correct the upper bound from CTIINOUTEN_MAX to config->nr_trig_max,
> since nr_trig_max varies across CTI devices. An out-of-bounds issue
> occurs when a value greater than config->nr_trig_max is provided,
> leading to unexpected errors.
>
> Fixes: b5213376c240 ("coresight: cti: Add sysfs access to program function registers")
> Signed-off-by: Jie Gan <jie.gan(a)oss.qualcomm.com>
Reviewed-by: Leo Yan <leo.yan(a)arm.com>
This series focuses on CoreSight path power management. The changes can
be divided into four parts for review:
Patches 01 - 08: Refactor the CPU idle flow with moving common code into
the CoreSight core layer.
Patches 09 - 18: Refactor path enabling and disabling with range, add
path control during CPU idle.
Patches 19 - 20: Support the sink (TRBE) control during CPU idle.
Patches 21 - 23: Move the CPU hotplug flow into the coresight core layer
and simplify the code.
This series is rebased on the coresight-next branch and has been verified
on Juno-r2 (ETM + ETR) and FVP RevC (ETE + TRBE).
---
Changes in v8:
- Moved the "cpu" field in coresight_device for better pack with new
patch 01 (Suzuki).
- Added check if not set CPU for per_cpu_source/per_cpu_sink (Suzuki).
- Renamed spinlock name in syscfg (Suzuki).
- Refactored paired enable and disable path with new patches
10 and 12 (Suzuki).
- Link to v7: https://lore.kernel.org/r/20260320-arm_coresight_path_power_management_impr…
Changes in v7:
- Added a flag in coresight_desc to indicate CPU bound device (Suzuki).
- Used coresight_mutex to protect per-CPU source pointer (Suzuki).
- Added a spinlock for exclusive access per-CPU source pointer (Suzuki).
- Dropped .pm_is_needed() callback (Suzuki).
- Supported range in path enabling / disabling (Suzuki).
- Gathered test and review tags (Levi / James).
- Link to v6: https://lore.kernel.org/r/20260305-arm_coresight_path_power_management_impr…
Changes in v6:
- Rebase on the latest coresight-next branch.
- Always save and restore TRBE context during idle (Will).
- Use get_cpu() / put_cpu() when set the per CPU source pointer.
- Link to v5: https://lore.kernel.org/r/20251119-arm_coresight_path_power_management_impr…
Signed-off-by: Leo Yan <leo.yan(a)arm.com>
---
Leo Yan (22):
coresight: Extract device init into coresight_init_dev()
coresight: Populate CPU ID into coresight_device
coresight: Remove .cpu_id() callback from source ops
coresight: sysfs: Validate CPU online status for per-CPU sources
coresight: Move per-CPU source pointer to core layer
coresight: Register CPU PM notifier in core layer
coresight: etm4x: Hook CPU PM callbacks
coresight: etm4x: Remove redundant condition checks in save and restore
coresight: syscfg: Use spinlock to protect active variables
coresight: Move source helper disabling to coresight_disable_path()
coresight: Control path with range
coresight: Use helpers to fetch first and last nodes
coresight: Introduce coresight_enable_source() helper
coresight: Save active path for system tracers
coresight: etm4x: Set active path on target CPU
coresight: etm3x: Set active path on target CPU
coresight: sysfs: Use source's path pointer for path control
coresight: Control path during CPU idle
coresight: Add PM callbacks for sink device
coresight: sysfs: Increment refcount only for system tracers
coresight: Take hotplug lock in enable_source_store() for Sysfs mode
coresight: Move CPU hotplug callbacks to core layer
Yabin Cui (1):
coresight: trbe: Save and restore state across CPU low power state
drivers/hwtracing/coresight/coresight-catu.c | 2 +-
drivers/hwtracing/coresight/coresight-core.c | 428 ++++++++++++++++++---
drivers/hwtracing/coresight/coresight-cti-core.c | 9 +-
drivers/hwtracing/coresight/coresight-etm-perf.c | 25 +-
drivers/hwtracing/coresight/coresight-etm3x-core.c | 73 +---
drivers/hwtracing/coresight/coresight-etm4x-core.c | 154 ++------
drivers/hwtracing/coresight/coresight-priv.h | 4 +
drivers/hwtracing/coresight/coresight-syscfg.c | 21 +-
drivers/hwtracing/coresight/coresight-syscfg.h | 2 +
drivers/hwtracing/coresight/coresight-sysfs.c | 126 ++----
drivers/hwtracing/coresight/coresight-trbe.c | 61 ++-
include/linux/coresight.h | 15 +-
12 files changed, 570 insertions(+), 350 deletions(-)
---
base-commit: a90863095f84f6d17c49716e4e2212d28a6b25b5
change-id: 20251104-arm_coresight_path_power_management_improvement-dab4966f8280
Best regards,
--
Leo Yan <leo.yan(a)arm.com>
This series focuses on CoreSight path power management. The changes can
be divided into four parts for review:
Patches 01~07: Refactor the CPU idle flow with moving common code into
the CoreSight core layer.
Patches 08~15: Refactor path enabling and disabling with range, add
path control during CPU idle.
Patches 16~17: Support the sink (TRBE) control during CPU idle.
Patches 18~20: Move the CPU hotplug flow into the coresight core layer
and simplify the code.
This series is rebased on the coresight-next branch and has been verified
on Juno-r2 (ETM + ETR) and FVP RevC (ETE + TRBE).
---
Changes in v7:
- Added a flag in coresight_desc to indicate CPU bound device (Suzuki).
- Used coresight_mutex to protect per-CPU source pointer (Suzuki).
- Added a spinlock for exclusive access per-CPU source pointer (Suzuki).
- Dropped .pm_is_needed() callback (Suzuki).
- Supported range in path enabling / disabling (Suzuki).
- Gathered test and review tags (Levi / James).
- Link to v6: https://lore.kernel.org/r/20260305-arm_coresight_path_power_management_impr…
Changes in v6:
- Rebase on the latest coresight-next branch.
- Always save and restore TRBE context during idle (Will).
- Use get_cpu() / put_cpu() when set the per CPU source pointer.
- Link to v5: https://lore.kernel.org/r/20251119-arm_coresight_path_power_management_impr…
Changes in v5:
- Set the per-CPU source pointer on target CPU (Suzuki).
- Reused existed enable/disable buffer functions in TRBE callbacks
(James).
- Refactored refcount for source devices in SysFS mode.
- Released path in cpu-hotplug off flow to avoid memory leak.
- Updated ETMv3 driver when move common code into core layer.
- Rebased on the latest coresight-next branch.
- Link to v4: https://lore.kernel.org/r/20251104-arm_coresight_path_power_management_impr…
Signed-off-by: Leo Yan <leo.yan(a)arm.com>
---
Leo Yan (19):
coresight: Populate CPU ID into coresight_device
coresight: Remove .cpu_id() callback from source ops
coresight: sysfs: Validate CPU online status for per-CPU sources
coresight: Move per-CPU source pointer to core layer
coresight: Register CPU PM notifier in core layer
coresight: etm4x: Hook CPU PM callbacks
coresight: etm4x: Remove redundant condition checks in save and restore
coresight: syscfg: Use spinlock to protect active variables
coresight: Introduce coresight_enable_source() helper
coresight: Save active path for system tracers
coresight: etm4x: Set active path on target CPU
coresight: etm3x: Set active path on target CPU
coresight: sysfs: Use source's path pointer for path control
coresight: Control path with range
coresight: Control path during CPU idle
coresight: Add PM callbacks for sink device
coresight: sysfs: Increment refcount only for system tracers
coresight: Take hotplug lock in enable_source_store() for Sysfs mode
coresight: Move CPU hotplug callbacks to core layer
Yabin Cui (1):
coresight: trbe: Save and restore state across CPU low power state
drivers/hwtracing/coresight/coresight-catu.c | 2 +-
drivers/hwtracing/coresight/coresight-core.c | 377 +++++++++++++++++++--
drivers/hwtracing/coresight/coresight-cti-core.c | 9 +-
drivers/hwtracing/coresight/coresight-etm-perf.c | 25 +-
drivers/hwtracing/coresight/coresight-etm3x-core.c | 73 +---
drivers/hwtracing/coresight/coresight-etm4x-core.c | 154 ++-------
drivers/hwtracing/coresight/coresight-priv.h | 4 +
drivers/hwtracing/coresight/coresight-syscfg.c | 21 +-
drivers/hwtracing/coresight/coresight-syscfg.h | 2 +
drivers/hwtracing/coresight/coresight-sysfs.c | 126 +++----
drivers/hwtracing/coresight/coresight-trbe.c | 61 +++-
include/linux/coresight.h | 15 +-
12 files changed, 546 insertions(+), 323 deletions(-)
---
base-commit: a90863095f84f6d17c49716e4e2212d28a6b25b5
change-id: 20251104-arm_coresight_path_power_management_improvement-dab4966f8280
Best regards,
--
Leo Yan <leo.yan(a)arm.com>
Hi Jie,
On Fri, Mar 20, 2026 at 04:44:54PM +0800, Jie Gan wrote:
[...]
> It's about the coresight_find_device_by_fwnode() returns NULL, resulting in
> -EPROBE_DEFER. So the probe process will re-start after several seconds, but
> always failed because we have a "disabled" device node in DT(we can see this
> device in DT, but it never becomes available). It's ok if the device only
> has one remote device, but has issue with more than one remote devices.
>
> Consider below situation:
>
> device0
> | |
> device1 device2(status = "disabled")
>
> The probe of device0 succeeds only when device1 and device2 are available at
> probe time. But I think it's ok to probe the device0 only with device1
> available.
Thanks a lot for details. We might need to report warning or error if
all remote endpoints fail (e.g., device1/device2 both are disabled),
this is a rare case so would be low priority.
For this patch:
Reviewed-by: Leo Yan <leo.yan(a)arm.com>