linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mike Leach <mike.leach@linaro.org>
To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org,
	mathieu.poirier@linaro.org, suzuki.poulose@arm.com
Cc: leo.yan@linaro.org, alexander.shishkin@linux.intel.com,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	Mike Leach <mike.leach@linaro.org>
Subject: [PATCH v8 06/10] coresight: etm-perf: Update to activate selected configuration
Date: Wed,  7 Jul 2021 14:29:59 +0100	[thread overview]
Message-ID: <20210707133003.5414-7-mike.leach@linaro.org> (raw)
In-Reply-To: <20210707133003.5414-1-mike.leach@linaro.org>

Add calls to activate the selected configuration as perf starts
and stops the tracing session.

Signed-off-by: Mike Leach <mike.leach@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 drivers/hwtracing/coresight/coresight-etm-perf.c | 14 +++++++++++++-
 drivers/hwtracing/coresight/coresight-etm-perf.h |  2 ++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
index e42ab919ddc3..8ebd728d3a80 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.c
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
@@ -215,6 +215,10 @@ static void free_event_data(struct work_struct *work)
 	/* Free the sink buffers, if there are any */
 	free_sink_buffer(event_data);
 
+	/* clear any configuration we were using */
+	if (event_data->cfg_hash)
+		cscfg_deactivate_config(event_data->cfg_hash);
+
 	for_each_cpu(cpu, mask) {
 		struct list_head **ppath;
 
@@ -292,7 +296,7 @@ static bool sinks_compatible(struct coresight_device *a,
 static void *etm_setup_aux(struct perf_event *event, void **pages,
 			   int nr_pages, bool overwrite)
 {
-	u32 id;
+	u32 id, cfg_hash;
 	int cpu = event->cpu;
 	cpumask_t *mask;
 	struct coresight_device *sink = NULL;
@@ -310,6 +314,14 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
 		sink = user_sink = coresight_get_sink_by_id(id);
 	}
 
+	/* check if user wants a coresight configuration selected */
+	cfg_hash = (u32)((event->attr.config2 & GENMASK_ULL(63, 32)) >> 32);
+	if (cfg_hash) {
+		if (cscfg_activate_config(cfg_hash))
+			goto err;
+		event_data->cfg_hash = cfg_hash;
+	}
+
 	mask = &event_data->mask;
 
 	/*
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwtracing/coresight/coresight-etm-perf.h
index ba617fe2217e..468f7799ab4f 100644
--- a/drivers/hwtracing/coresight/coresight-etm-perf.h
+++ b/drivers/hwtracing/coresight/coresight-etm-perf.h
@@ -49,12 +49,14 @@ struct etm_filters {
  * @work:		Handle to free allocated memory outside IRQ context.
  * @mask:		Hold the CPU(s) this event was set for.
  * @snk_config:		The sink configuration.
+ * @cfg_hash:		The hash id of any coresight config selected.
  * @path:		An array of path, each slot for one CPU.
  */
 struct etm_event_data {
 	struct work_struct work;
 	cpumask_t mask;
 	void *snk_config;
+	u32 cfg_hash;
 	struct list_head * __percpu *path;
 };
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-07-07 13:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 13:29 [PATCH v8 00/10] CoreSight configuration management; ETM strobing Mike Leach
2021-07-07 13:29 ` [PATCH v8 01/10] coresight: syscfg: Initial coresight system configuration Mike Leach
2021-07-07 13:29 ` [PATCH v8 02/10] coresight: syscfg: Add registration and feature loading for cs devices Mike Leach
2021-07-07 13:29 ` [PATCH v8 03/10] coresight: config: Add configuration and feature generic functions Mike Leach
2021-07-07 13:29 ` [PATCH v8 04/10] coresight: etm-perf: update to handle configuration selection Mike Leach
2021-07-07 13:29 ` [PATCH v8 05/10] coresight: syscfg: Add API to activate and enable configurations Mike Leach
2021-07-20 17:41   ` Mathieu Poirier
2021-07-20 18:07     ` Mathieu Poirier
2021-07-07 13:29 ` Mike Leach [this message]
2021-07-07 13:30 ` [PATCH v8 07/10] coresight: etm4x: Add complex configuration handlers to etmv4 Mike Leach
2021-07-07 13:30 ` [PATCH v8 08/10] coresight: config: Add preloaded configurations Mike Leach
2021-07-07 13:30 ` [PATCH v8 09/10] coresight: syscfg: Add initial configfs support Mike Leach
2021-07-07 13:30 ` [PATCH v8 10/10] Documentation: coresight: Add documentation for CoreSight config Mike Leach
2021-07-12 16:44 ` [PATCH v8 00/10] CoreSight configuration management; ETM strobing Mathieu Poirier
2021-07-13  9:42   ` Branislav Rankov
2021-07-16 10:25     ` Mike Leach
2021-07-21 17:44       ` Mathieu Poirier
2021-07-21 21:35         ` Mike Leach
2021-07-22 16:17           ` Mathieu Poirier
2021-07-23 14:43             ` Mike Leach
2021-07-26 16:49               ` Mathieu Poirier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210707133003.5414-7-mike.leach@linaro.org \
    --to=mike.leach@linaro.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=suzuki.poulose@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).