aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing
diff options
context:
space:
mode:
authorMathieu Poirier <mathieu.poirier@linaro.org>2016-08-25 17:19:16 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-31 07:05:44 -0400
commitf0d30cc30e545d0b059948f5d6be1b62ee54a355 (patch)
tree6eca29466021623c4fdd229db234e57e2a8fbfa2 /drivers/hwtracing
parent6cccf66354fabb48de88238bf1343f774113a133 (diff)
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,
205 /* Always start from the default config */ 205 /* Always start from the default config */
206 etm4_set_default(config); 206 etm4_set_default(config);
207 207
208 /*
209 * By default the tracers are configured to trace the whole address
210 * range. Narrow the field only if requested by user space.
211 */
212 if (config->mode)
213 etm4_config_trace_mode(config);
214
215 /* Go from generic option to ETMv4 specifics */ 208 /* Go from generic option to ETMv4 specifics */
216 if (attr->config & BIT(ETM_OPT_CYCACC)) 209 if (attr->config & BIT(ETM_OPT_CYCACC))
217 config->cfg |= ETMv4_MODE_CYCACC; 210 config->cfg |= ETMv4_MODE_CYCACC;
@@ -581,14 +574,28 @@ static void etm4_set_default_config(struct etmv4_config *config)
581 config->vinst_ctrl |= BIT(0); 574 config->vinst_ctrl |= BIT(0);
582} 575}
583 576
584static void etm4_set_comparator_filter(struct etmv4_config *config, 577static u64 etm4_get_access_type(struct etmv4_config *config)
585 u64 start, u64 stop, int comparator)
586{ 578{
587 u64 access_type = 0; 579 u64 access_type = 0;
588 580
589 /* EXLEVEL_NS, bits[12:15], always stay away from hypervisor mode. */ 581 /*
582 * EXLEVEL_NS, bits[15:12]
583 * The Exception levels are:
584 * Bit[12] Exception level 0 - Application
585 * Bit[13] Exception level 1 - OS
586 * Bit[14] Exception level 2 - Hypervisor
587 * Bit[15] Never implemented
588 *
589 * Always stay away from hypervisor mode.
590 */
590 access_type = ETM_EXLEVEL_NS_HYP; 591 access_type = ETM_EXLEVEL_NS_HYP;
591 592
593 if (config->mode & ETM_MODE_EXCL_KERN)
594 access_type |= ETM_EXLEVEL_NS_OS;
595
596 if (config->mode & ETM_MODE_EXCL_USER)
597 access_type |= ETM_EXLEVEL_NS_APP;
598
592 /* 599 /*
593 * EXLEVEL_S, bits[11:8], don't trace anything happening 600 * EXLEVEL_S, bits[11:8], don't trace anything happening
594 * in secure state. 601 * in secure state.
@@ -597,6 +604,14 @@ static void etm4_set_comparator_filter(struct etmv4_config *config,
597 ETM_EXLEVEL_S_OS | 604 ETM_EXLEVEL_S_OS |
598 ETM_EXLEVEL_S_HYP); 605 ETM_EXLEVEL_S_HYP);
599 606
607 return access_type;
608}
609
610static void etm4_set_comparator_filter(struct etmv4_config *config,
611 u64 start, u64 stop, int comparator)
612{
613 u64 access_type = etm4_get_access_type(config);
614
600 /* First half of default address comparator */ 615 /* First half of default address comparator */
601 config->addr_val[comparator] = start; 616 config->addr_val[comparator] = start;
602 config->addr_acc[comparator] = access_type; 617 config->addr_acc[comparator] = access_type;