perf will output additional CoreSight debug information, from the
'perf report --dump' command, when the build option CSTRACE_RAW=1
is added to the usual CORESIGHT=1 at build time.
This additional information consists of raw trace data in the form of
CoreSight formatted trace frames. This is intended to be used to
investigate possible issues relating to trace data corruption,
trace hardware issues or problems with decode.
The CoreSight formatted trace frames are used when multiple ETMs trace
into an ETR, and not present when a single ETE traces into the TRBE.
When the build option is used and perf is used to dump an ETE/TRBE
generated buffer a segfault will occur in the OpenCSD library.
Patch 1 of this set removes the unnecessary call to print the raw trace
frames when not needed, and fixes the segfault where older versions
of OpenCSD are in use.
Patch 2 enhances the debug output to associate raw data with individual
packets, which means that raw data is now present for ETE and extended
for ETM.
OpenCSD is being fixed independently.
Mike Leach (2):
perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE
trace
perf: tools: cs-etm: Enhance raw Coresight trace debug display
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--
2.43.0
This series focuses on CoreSight path power management. The changes can
be divided into four parts for review:
Patches 01~06: Refactor the CPU idle flow with moving common code into
the CoreSight core layer.
Patches 07~14: Add link control during CPU idle.
Patches 15~16: Support the sink (TRBE) control during CPU idle.
Patches 17~19: 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 and FVP RevC.
---
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…
Changes in v4:
- Changed to store path pointer in coresight_device, this is easier for
fetching path pointer based on source device (Mike).
- Dropped changes in CTI driver.
- Only disabled path for CPU hot-plugged off but not enable path for
hot-plugged in.
- Removed James' test tags for modified patches.
- Link to v3: https://lore.kernel.org/r/20250915-arm_coresight_power_management_fix-v3-0-…
Signed-off-by: Leo Yan <leo.yan(a)arm.com>
---
Leo Yan (18):
coresight: sysfs: Validate CPU online status for per-CPU sources
coresight: Set per-CPU source pointer
coresight: Register CPU PM notifier in core layer
coresight: etm4x: Hook CPU PM callbacks
coresight: Add callback to determine if PM is needed
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: Add 'in_idle' argument to path
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 | 1 +
drivers/hwtracing/coresight/coresight-core.c | 273 ++++++++++++++++++++-
drivers/hwtracing/coresight/coresight-ctcu-core.c | 1 +
drivers/hwtracing/coresight/coresight-cti-core.c | 1 +
drivers/hwtracing/coresight/coresight-dummy.c | 1 +
drivers/hwtracing/coresight/coresight-etb10.c | 1 +
drivers/hwtracing/coresight/coresight-etm-perf.c | 2 +-
drivers/hwtracing/coresight/coresight-etm3x-core.c | 65 ++---
drivers/hwtracing/coresight/coresight-etm4x-core.c | 153 +++---------
drivers/hwtracing/coresight/coresight-funnel.c | 1 +
drivers/hwtracing/coresight/coresight-priv.h | 3 +
drivers/hwtracing/coresight/coresight-replicator.c | 1 +
drivers/hwtracing/coresight/coresight-stm.c | 1 +
drivers/hwtracing/coresight/coresight-syscfg.c | 22 +-
drivers/hwtracing/coresight/coresight-syscfg.h | 2 +
drivers/hwtracing/coresight/coresight-sysfs.c | 126 +++-------
drivers/hwtracing/coresight/coresight-tmc-core.c | 1 +
drivers/hwtracing/coresight/coresight-tnoc.c | 2 +
drivers/hwtracing/coresight/coresight-tpda.c | 1 +
drivers/hwtracing/coresight/coresight-tpdm.c | 1 +
drivers/hwtracing/coresight/coresight-tpiu.c | 1 +
drivers/hwtracing/coresight/coresight-trbe.c | 60 ++++-
drivers/hwtracing/coresight/ultrasoc-smb.c | 1 +
include/linux/coresight.h | 11 +
24 files changed, 458 insertions(+), 274 deletions(-)
---
base-commit: 9c5ef7a30d9044f8706bd02bfdc4eff7266f3e25
change-id: 20251104-arm_coresight_path_power_management_improvement-dab4966f8280
Best regards,
--
Leo Yan <leo.yan(a)arm.com>
Leo has been an active contributor and reviewer for CoreSight subsystem for
years. Add him as a Reviewer for CORESIGHT.
Cc: Leo Yan <leo.yan(a)arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose(a)arm.com>
---
MAINTAINERS | 1 +
1 file changed, 1 insertion(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9c5491001908..eaf928246aaf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2710,6 +2710,7 @@ ARM/CORESIGHT FRAMEWORK AND DRIVERS
M: Suzuki K Poulose <suzuki.poulose(a)arm.com>
R: Mike Leach <mike.leach(a)arm.com>
R: James Clark <james.clark(a)linaro.org>
+R: Leo Yan <leo.yan(a)arm.com>
L: coresight(a)lists.linaro.org (moderated for non-subscribers)
L: linux-arm-kernel(a)lists.infradead.org (moderated for non-subscribers)
S: Maintained
--
2.43.0
On 10/03/2026 03:01, Jie Gan wrote:
>
>
> On 3/9/2026 8:43 PM, Suzuki K Poulose wrote:
>> On 09/03/2026 09:47, Jie Gan wrote:
>>> The byte-cntr function provided by the CTCU device is used to
>>> transfer data
>>> from the ETR buffer to the userspace. An interrupt is triggered if
>>> the data
>>> size exceeds the threshold set in the BYTECNTRVAL register. The
>>> interrupt
>>> handler counts the number of triggered interruptions and the read
>>> function
>>> will read the data from the synced ETR buffer.
>>>
>>> Switching the sysfs_buf when current buffer is full or the timeout is
>>> triggered and resets rrp and rwp registers after switched the buffer.
>>> The synced buffer will become available for reading after the switch.
>>>
>>> Signed-off-by: Jie Gan <jie.gan(a)oss.qualcomm.com>
>>> ---
>>> .../ABI/testing/sysfs-bus-coresight-devices-ctcu | 8 +
>>> drivers/hwtracing/coresight/Makefile | 2 +-
>>> .../hwtracing/coresight/coresight-ctcu-byte-cntr.c | 351 ++++++++++
>>> + ++++++++++
>>> drivers/hwtracing/coresight/coresight-ctcu-core.c | 103 +++++-
>>> drivers/hwtracing/coresight/coresight-ctcu.h | 76 ++++-
>>> drivers/hwtracing/coresight/coresight-tmc-core.c | 8 +-
>>> drivers/hwtracing/coresight/coresight-tmc-etr.c | 18 ++
>>> drivers/hwtracing/coresight/coresight-tmc.h | 4 +
>>> 8 files changed, 555 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-
>>> ctcu b/Documentation/ABI/testing/sysfs-bus-coresight-devices-ctcu
>>> new file mode 100644
>>> index 000000000000..6ff1708fb944
>>> --- /dev/null
>>> +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-ctcu
>>> @@ -0,0 +1,8 @@
>>> +What: /sys/bus/coresight/devices/<ctcu-name>/
>>> irq_threshold[0:1]
>>> +Date: March 2026
>>> +KernelVersion: 7.1
>>> +Contact: Tingwei Zhang <tingwei.zhang(a)oss.qualcomm.com>;
>>> Jinlong Mao <jinlong.mao(a)oss.qualcomm.com>; Jie Gan
>>> <jie.gan(a)oss.qualcomm.com>
>>> +Description:
>>> + (RW) Configure the byte-cntr IRQ register for the specified
>>> ETR device
>>> + based on its port number. An interrupt is generated when the
>>> data size
>>> + exceeds the value set in the IRQ register.
>>> diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/
>>> hwtracing/ coresight/Makefile
>>> index ab16d06783a5..821a1b06b20c 100644
>>> --- a/drivers/hwtracing/coresight/Makefile
>>> +++ b/drivers/hwtracing/coresight/Makefile
>>> @@ -55,5 +55,5 @@ coresight-cti-y := coresight-cti-core.o coresight-
>>> cti-platform.o \
>>> obj-$(CONFIG_ULTRASOC_SMB) += ultrasoc-smb.o
>>> obj-$(CONFIG_CORESIGHT_DUMMY) += coresight-dummy.o
>>> obj-$(CONFIG_CORESIGHT_CTCU) += coresight-ctcu.o
>>> -coresight-ctcu-y := coresight-ctcu-core.o
>>> +coresight-ctcu-y := coresight-ctcu-core.o coresight-ctcu-byte-cntr.o
>>> obj-$(CONFIG_CORESIGHT_KUNIT_TESTS) += coresight-kunit-tests.o
>>> diff --git a/drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c
>>> b/ drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c
>>> new file mode 100644
>>> index 000000000000..0bf738d6c283
>>> --- /dev/null
>>> +++ b/drivers/hwtracing/coresight/coresight-ctcu-byte-cntr.c
>>> @@ -0,0 +1,351 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>>> +/*
>>> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
>>> + */
>>> +
>>> +#include <linux/coresight.h>
>>> +#include <linux/device.h>
>>> +#include <linux/fs.h>
>>> +#include <linux/interrupt.h>
>>> +#include <linux/of_irq.h>
>>> +#include <linux/uaccess.h>
>>> +
>>> +#include "coresight-ctcu.h"
>>> +#include "coresight-priv.h"
>>> +#include "coresight-tmc.h"
>>> +
>>> +static irqreturn_t byte_cntr_handler(int irq, void *data)
>>> +{
>>> + struct ctcu_byte_cntr *byte_cntr_data = (struct ctcu_byte_cntr
>>> *)data;
>>> +
>>> + atomic_inc(&byte_cntr_data->irq_cnt);
>>> + wake_up(&byte_cntr_data->wq);
>>> +
>>> + return IRQ_HANDLED;
>>> +}
>>> +
>>> +static void ctcu_reset_sysfs_buf(struct tmc_drvdata *drvdata)
>>
>> minor nit: This has nothing to do with the CTCU. For what it is worth,
>> it must be called, tmc_etr_reset_sysf_buf(). But more on this below,
>> and even do we need it, further below.
>>
>>> +{
>>> + u32 sts;
>>> +
>>> + CS_UNLOCK(drvdata->base);
>>> + tmc_write_rrp(drvdata, drvdata->sysfs_buf->hwaddr);
>>> + tmc_write_rwp(drvdata, drvdata->sysfs_buf->hwaddr);
>>> + sts = readl_relaxed(drvdata->base + TMC_STS) & ~TMC_STS_FULL;
>>> + writel_relaxed(sts, drvdata->base + TMC_STS);
>>> + CS_LOCK(drvdata->base);
>>
>> Could we not keep this function in the tmc-etr.c and invoke from here ?
>>
>
> Sure, will move the function tmc-etr.c
>
>>> +}
>>> +
>>> +static void ctcu_cfg_byte_cntr_reg(struct tmc_drvdata *drvdata, u32
>>> val, u32 offset)
>>> +{
>>> + struct ctcu_drvdata *ctcu_drvdata;
>>> + struct coresight_device *helper;
>>> +
>>> + helper = tmc_etr_get_ctcu_device(drvdata);
>>> + if (!helper)
>>> + return;
>>> +
>>> + ctcu_drvdata = dev_get_drvdata(helper->dev.parent);
>>> + /* A one value for IRQCTRL register represents 8 bytes */
>>> + ctcu_program_register(ctcu_drvdata, val / 8, offset);
>>> +}
>>> +
>>> +static struct ctcu_byte_cntr *ctcu_get_byte_cntr_data(struct
>>> tmc_drvdata *drvdata)
>>> +{
>>> + struct ctcu_byte_cntr *byte_cntr_data;
>>> + struct ctcu_drvdata *ctcu_drvdata;
>>> + struct coresight_device *helper;
>>> + int port;
>>> +
>>> + helper = tmc_etr_get_ctcu_device(drvdata);
>>> + if (!helper)
>>> + return NULL;
>>> +
>>
>>
>>
>>> + port = coresight_get_in_port(drvdata->csdev, helper);
>>> + if (port < 0)
>>> + return NULL;
>>> +
>>
>> Please validate that the port_num you get is valid for the CTCU ? That
>> applies to all uses of this construct.
>>
>
> Will validate it before using.
>
>>> + ctcu_drvdata = dev_get_drvdata(helper->dev.parent);
>>> + byte_cntr_data = &ctcu_drvdata->byte_cntr_data[port];
>>> + return byte_cntr_data;
>>
>>
>>
>> nit:
>> return &ctcu_drvdata->byte_cntr_data[port]; ?
>>
>> Also, why not make this into a helper, as we seem to use this other
>> places too ?
>>
>
> Didnt get the point here. We may run more than one ETR devices
> concurrently. So we should get the proper byte_cntr_data according to
> the port number at runtime.
>
static struct ctcu_byte_cntr *ctcu_byte_cntr(struct coresight_device
*cctcu_dev, struct coresight_device *tmc_etr, ) {
port = coresight_get_in_port()..
// Verify the port in this helper and everyone uses this.
if (//!validate_port//)
return NULL
return ...
}
Suzuki
Finish removal of ETM_OPT_* defines so the coresight-pmu.h header can
by synced from the kernel.
Signed-off-by: James Clark <james.clark(a)linaro.org>
---
Changes in v2:
- Access metadata through existing etm pointer (Leo)
- Link to v1: https://lore.kernel.org/r/20260306-james-perf-remove-etm_opt-v1-0-03c662380…
---
James Clark (2):
perf cs-etm: Finish removal of ETM_OPT_*
tools: Sync coresight-pmu.h header
tools/include/linux/coresight-pmu.h | 24 -----------------
tools/perf/arch/arm/util/cs-etm.c | 14 ----------
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 2 +-
tools/perf/util/cs-etm.c | 36 +++++++++----------------
tools/perf/util/cs-etm.h | 15 +++++++++++
5 files changed, 29 insertions(+), 62 deletions(-)
---
base-commit: b1718b0367ba31e8db273e3896ebd1707bcbe59e
change-id: 20260306-james-perf-remove-etm_opt-c0e9a768dce8
Best regards,
--
James Clark <james.clark(a)linaro.org>
Finish removal of ETM_OPT_* defines so the coresight-pmu.h header can
by synced from the kernel.
Signed-off-by: James Clark <james.clark(a)linaro.org>
---
James Clark (2):
perf cs-etm: Finish removal of ETM_OPT_*
tools: Sync coresight-pmu.h header
tools/include/linux/coresight-pmu.h | 24 -----------------
tools/perf/arch/arm/util/cs-etm.c | 14 ----------
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 2 +-
tools/perf/util/cs-etm.c | 36 +++++++++----------------
tools/perf/util/cs-etm.h | 15 +++++++++++
5 files changed, 28 insertions(+), 63 deletions(-)
---
base-commit: b1718b0367ba31e8db273e3896ebd1707bcbe59e
change-id: 20260306-james-perf-remove-etm_opt-c0e9a768dce8
Best regards,
--
James Clark <james.clark(a)linaro.org>