diff options
author | Mike Leach <mike.leach@linaro.org> | 2023-01-16 12:49:14 +0000 |
---|---|---|
committer | Suzuki K Poulose <suzuki.poulose@arm.com> | 2023-01-19 10:16:46 +0000 |
commit | 338a588e9db3c5ea7a35bb332cb3bdb532fd1f08 (patch) | |
tree | 2fd20657d99c0259094533840ee49082b75c568c /include/linux/coresight-pmu.h | |
parent | 3f3047493b4dc68165505f22cce1af6cc4d36643 (diff) | |
download | lwn-338a588e9db3c5ea7a35bb332cb3bdb532fd1f08.tar.gz lwn-338a588e9db3c5ea7a35bb332cb3bdb532fd1f08.zip |
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
Diffstat (limited to 'include/linux/coresight-pmu.h')
-rw-r--r-- | include/linux/coresight-pmu.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/coresight-pmu.h b/include/linux/coresight-pmu.h index 6c2fd6cc5a98..ffff4e6277e5 100644 --- a/include/linux/coresight-pmu.h +++ b/include/linux/coresight-pmu.h @@ -11,6 +11,16 @@ #define CORESIGHT_ETM_PMU_SEED 0x10 /* + * The legacy Trace ID system based on fixed calculation from the cpu + * number. This has been replaced by drivers using a dynamic allocation + * system - but need to retain the legacy algorithm for backward comparibility + * in certain situations:- + * a) new perf running on older systems that generate the legacy mapping + * b) older tools that may not update at the same time as the kernel. + */ +#define CORESIGHT_LEGACY_CPU_TRACE_ID(cpu) (0x10 + (cpu * 2)) + +/* * Below are the definition of bit offsets for perf option, and works as * arbitrary values for all ETM versions. * |