Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1445788

[PATCH 06/10] coresight: etm4x: adding range filter configuration function

From Mathieu Poirier <mathieu.poirier@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 06/10] coresight: etm4x: adding range filter configuration function
Date 2016-07-18 22:00 +0200
Message-ID <rWmRQ-26O-11@gated-at.bofh.it> (permalink)
References <rWmRP-26O-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Introducing a new function to do address range configuration
generic enough to work for any address range and any comparator.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 drivers/hwtracing/coresight/coresight-etm4x.c | 56 ++++++++++++++++++---------
 1 file changed, 38 insertions(+), 18 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
index e348c18086f5..4a4d2ef35ad6 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x.c
@@ -584,16 +584,10 @@ static void etm4_set_default_config(struct etmv4_config *config)
 	config->vinst_ctrl |= BIT(0);
 }
 
-static void etm4_set_default_filter(struct etmv4_config *config)
+static void etm4_set_comparator_filter(struct etmv4_config *config,
+				       u64 start, u64 stop, int comparator)
 {
-	u64 start, stop, access_type = 0;
-
-	/*
-	 * Configure address range comparator '0' to encompass all
-	 * possible addresses.
-	 */
-	start = 0x0;
-	stop = ~0x0;
+	u64 access_type = 0;
 
 	/* EXLEVEL_NS, bits[12:15], always stay away from hypervisor mode. */
 	access_type = ETM_EXLEVEL_NS_HYP;
@@ -607,20 +601,46 @@ static void etm4_set_default_filter(struct etmv4_config *config)
 			ETM_EXLEVEL_S_HYP);
 
 	/* First half of default address comparator */
-	config->addr_val[ETM_DEFAULT_ADDR_COMP] = start;
-	config->addr_acc[ETM_DEFAULT_ADDR_COMP] = access_type;
-	config->addr_type[ETM_DEFAULT_ADDR_COMP] = ETM_ADDR_TYPE_RANGE;
+	config->addr_val[comparator] = start;
+	config->addr_acc[comparator] = access_type;
+	config->addr_type[comparator] = ETM_ADDR_TYPE_RANGE;
 
 	/* Second half of default address comparator */
-	config->addr_val[ETM_DEFAULT_ADDR_COMP + 1] = stop;
-	config->addr_acc[ETM_DEFAULT_ADDR_COMP + 1] = access_type;
-	config->addr_type[ETM_DEFAULT_ADDR_COMP + 1] = ETM_ADDR_TYPE_RANGE;
+	config->addr_val[comparator + 1] = stop;
+	config->addr_acc[comparator + 1] = access_type;
+	config->addr_type[comparator + 1] = ETM_ADDR_TYPE_RANGE;
+
+	/*
+	 * Configure the ViewInst function to include this address range
+	 * comparator.
+	 *
+	 * @comparator is divided by two since it is the index in the
+	 * etmv4_config::addr_val array but register TRCVIIECTLR deals with
+	 * address range comparator _pairs_.
+	 *
+	 * Therefore:
+	 *	index 0 -> compatator pair 0
+	 *	index 2 -> comparator pair 1
+	 *	index 4 -> comparator pair 2
+	 *	...
+	 *	index 14 -> comparator pair 7
+	 */
+	config->viiectlr |= BIT(comparator / 2);
+}
+
+static void etm4_set_default_filter(struct etmv4_config *config)
+{
+	u64 start, stop;
 
 	/*
-	 * Configure the ViewInst function to filter on address range
-	 * comparator '0'.
+	 * Configure address range comparator '0' to encompass all
+	 * possible addresses.
 	 */
-	config->viiectlr = BIT(0);
+	start = 0x0;
+	stop = ~0x0;
+
+	etm4_set_comparator_filter(config, start, stop,
+				   ETM_DEFAULT_ADDR_COMP);
 
 	/*
 	 * TRCVICTLR::SSSTATUS == 1, the start-stop logic is
-- 
2.7.4

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/10] coresight: implementing address filtering  Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-18 22:00 +0200
  [PATCH 09/10] coresight: etm4x: adding configurable start/stop filtering Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-18 22:00 +0200
  [PATCH 06/10] coresight: etm4x: adding range filter configuration function Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-18 22:00 +0200
  [PATCH 04/10] coresight: etm4x: split default and filter configuration Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-18 22:00 +0200
  [PATCH 10/10] coresight: documenting range and start/stop filtering Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-18 22:00 +0200
  [PATCH 02/10] coresight: remove duplicated enumeration Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-18 22:00 +0200
  [PATCH 07/10] coresight: etm4x: configuring include/exclude function Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-18 22:00 +0200
  [PATCH 01/10] coresight: etm-perf: pass struct perf_event to source::enable/disable() Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-18 22:00 +0200
    Re: [PATCH 01/10] coresight: etm-perf: pass struct perf_event to  source::enable/disable() Suzuki K Poulose <Suzuki.Poulose@arm.com> - 2016-07-20 17:40 +0200
      Re: [PATCH 01/10] coresight: etm-perf: pass struct perf_event to source::enable/disable() Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-21 17:30 +0200
  [PATCH 03/10] coresight: etm-perf: configuring filters from perf core Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-18 22:00 +0200
    Re: [PATCH 03/10] coresight: etm-perf: configuring filters from perf  core Suzuki K Poulose <Suzuki.Poulose@arm.com> - 2016-07-20 18:10 +0200
      Re: [PATCH 03/10] coresight: etm-perf: configuring filters from perf core Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-21 17:20 +0200
        Re: [PATCH 03/10] coresight: etm-perf: configuring filters from perf core Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-21 19:20 +0200
  [PATCH 05/10] coresight: etm4x: cleaning up default filter configuration Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-18 22:00 +0200
  [PATCH 08/10] coresight: etm4x: adding configurable address range filtering Mathieu Poirier <mathieu.poirier@linaro.org> - 2016-07-18 22:00 +0200

csiph-web