coresight: trace-id: Add API to dynamically assign Trace ID values
authorMike Leach <mike.leach@linaro.org>
Mon, 16 Jan 2023 12:49:14 +0000 (12:49 +0000)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Thu, 19 Jan 2023 10:16:46 +0000 (10:16 +0000)
commit338a588e9db3c5ea7a35bb332cb3bdb532fd1f08
tree2fd20657d99c0259094533840ee49082b75c568c
parent3f3047493b4dc68165505f22cce1af6cc4d36643
coresight: trace-id: Add API to dynamically assign Trace ID values

The existing mechanism to assign Trace ID values to sources is limited
and does not scale for larger multicore / multi trace source systems.

The API introduces functions that reserve IDs based on availabilty
represented by a coresight_trace_id_map structure. This records the
used and free IDs in a bitmap.

CPU bound sources such as ETMs use the coresight_trace_id_get_cpu_id
coresight_trace_id_put_cpu_id pair of functions. The API will record
the ID associated with the CPU. This ensures that the same ID will be
re-used while perf events are active on the CPU. The put_cpu_id function
will pend release of the ID until all perf cs_etm sessions are complete.

For backward compatibility the functions will attempt to use the same
CPU IDs as the legacy system would have used if these are still available.

Non-cpu sources, such as the STM can use coresight_trace_id_get_system_id /
coresight_trace_id_put_system_id.

Signed-off-by: Mike Leach <mike.leach@linaro.org>
[ Fix checkpatch warning in drivers/hwtracing/coresight/coresight-trace-id.c ]
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230116124928.5440-2-mike.leach@linaro.org
drivers/hwtracing/coresight/Makefile
drivers/hwtracing/coresight/coresight-trace-id.c [new file with mode: 0644]
drivers/hwtracing/coresight/coresight-trace-id.h [new file with mode: 0644]
include/linux/coresight-pmu.h