summaryrefslogtreecommitdiff
path: root/drivers/hwtracing
diff options
context:
space:
mode:
authorMathieu Poirier <mathieu.poirier@linaro.org>2016-08-26 00:19:16 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-31 14:05:44 +0300
commitf0d30cc30e545d0b059948f5d6be1b62ee54a355 (patch)
tree6eca29466021623c4fdd229db234e57e2a8fbfa2 /drivers/hwtracing
parent6cccf66354fabb48de88238bf1343f774113a133 (diff)
downloadlinux-f0d30cc30e545d0b059948f5d6be1b62ee54a355.tar.xz
coresight: etm4x: configuring include/exclude function
The include/exclude function of a tracer is applicable to address range and start/stop filters. To avoid duplication and reuse code moving the include/exclude configuration to a function of its own. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing')
-rw-r--r--drivers/hwtracing/coresight/coresight-etm4x.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
index aca624010b9f..1044ed609d81 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x.c
@@ -205,13 +205,6 @@ static int etm4_parse_event_config(struct etmv4_drvdata *drvdata,
/* Always start from the default config */
etm4_set_default(config);
- /*
- * By default the tracers are configured to trace the whole address
- * range. Narrow the field only if requested by user space.
- */
- if (config->mode)
- etm4_config_trace_mode(config);
-
/* Go from generic option to ETMv4 specifics */
if (attr->config & BIT(ETM_OPT_CYCACC))
config->cfg |= ETMv4_MODE_CYCACC;
@@ -581,14 +574,28 @@ static void etm4_set_default_config(struct etmv4_config *config)
config->vinst_ctrl |= BIT(0);
}
-static void etm4_set_comparator_filter(struct etmv4_config *config,
- u64 start, u64 stop, int comparator)
+static u64 etm4_get_access_type(struct etmv4_config *config)
{
u64 access_type = 0;
- /* EXLEVEL_NS, bits[12:15], always stay away from hypervisor mode. */
+ /*
+ * EXLEVEL_NS, bits[15:12]
+ * The Exception levels are:
+ * Bit[12] Exception level 0 - Application
+ * Bit[13] Exception level 1 - OS
+ * Bit[14] Exception level 2 - Hypervisor
+ * Bit[15] Never implemented
+ *
+ * Always stay away from hypervisor mode.
+ */
access_type = ETM_EXLEVEL_NS_HYP;
+ if (config->mode & ETM_MODE_EXCL_KERN)
+ access_type |= ETM_EXLEVEL_NS_OS;
+
+ if (config->mode & ETM_MODE_EXCL_USER)
+ access_type |= ETM_EXLEVEL_NS_APP;
+
/*
* EXLEVEL_S, bits[11:8], don't trace anything happening
* in secure state.
@@ -597,6 +604,14 @@ static void etm4_set_comparator_filter(struct etmv4_config *config,
ETM_EXLEVEL_S_OS |
ETM_EXLEVEL_S_HYP);
+ return access_type;
+}
+
+static void etm4_set_comparator_filter(struct etmv4_config *config,
+ u64 start, u64 stop, int comparator)
+{
+ u64 access_type = etm4_get_access_type(config);
+
/* First half of default address comparator */
config->addr_val[comparator] = start;
config->addr_acc[comparator] = access_type;