[PATCH v1 05/11] coresight: Save activated path into source device
James Clark
james.clark at linaro.org
Tue Jun 3 07:49:26 PDT 2025
On 16/05/2025 5:07 pm, Leo Yan wrote:
> For a source device, save activated path into the coresight_device
> structure.
>
> This will be used by sequential changes for controlling the path during
> CPU idle.
>
> Signed-off-by: Leo Yan <leo.yan at arm.com>
> ---
> drivers/hwtracing/coresight/coresight-core.c | 10 ++++++++++
> include/linux/coresight.h | 3 +++
> 2 files changed, 13 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
> index 7ab7321ca8d5..8f565bb3c535 100644
> --- a/drivers/hwtracing/coresight/coresight-core.c
> +++ b/drivers/hwtracing/coresight/coresight-core.c
> @@ -495,6 +495,12 @@ static void coresight_disable_path_from(struct coresight_path *path,
>
> void coresight_disable_path(struct coresight_path *path)
> {
> + struct coresight_device *source;
> +
> + source = coresight_get_source(path);
> + if (coresight_is_percpu_source(source))
> + source->path = NULL;
> +
> coresight_disable_path_from(path, NULL);
> }
> EXPORT_SYMBOL_GPL(coresight_disable_path);
> @@ -577,6 +583,10 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode,
> }
> }
>
> + source = coresight_get_source(path);
> + if (coresight_is_percpu_source(source))
> + source->path = path;
> +
> out:
> return ret;
> err_disable_helpers:
> diff --git a/include/linux/coresight.h b/include/linux/coresight.h
> index 64cee4040daa..cd9709a36b9c 100644
> --- a/include/linux/coresight.h
> +++ b/include/linux/coresight.h
> @@ -265,6 +265,7 @@ struct coresight_trace_id_map {
> * CS_MODE_SYSFS. Otherwise it must be accessed from inside the
> * spinlock.
> * @orphan: true if the component has connections that haven't been linked.
> + * @path: activated path pointer (only used for source device).
> * @sysfs_sink_activated: 'true' when a sink has been selected for use via sysfs
> * by writing a 1 to the 'enable_sink' file. A sink can be
> * activated but not yet enabled. Enabling for a _sink_ happens
> @@ -291,6 +292,8 @@ struct coresight_device {
> local_t mode;
> int refcnt;
> bool orphan;
> + /* activated path (for source only) */
> + struct coresight_path *path;
This is probably cleaner if it's saved in the new global per-cpu you
added in patch 2. It's even more specific than "for source only", it's
actually only for per-cpu sources so it's not worth having it on every
device.
> /* sink specific fields */
> bool sysfs_sink_activated;
> struct dev_ext_attribute *ea;
More information about the linux-arm-kernel
mailing list