From patchwork Mon Jul 18 19:51:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 72254 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp291387qga; Mon, 18 Jul 2016 12:53:32 -0700 (PDT) X-Received: by 10.66.181.139 with SMTP id dw11mr59559451pac.2.1468871612094; Mon, 18 Jul 2016 12:53:32 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y196si5061176pfg.99.2016.07.18.12.53.31; Mon, 18 Jul 2016 12:53:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752574AbcGRTxQ (ORCPT + 29 others); Mon, 18 Jul 2016 15:53:16 -0400 Received: from mail-io0-f174.google.com ([209.85.223.174]:33944 "EHLO mail-io0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752267AbcGRTvm (ORCPT ); Mon, 18 Jul 2016 15:51:42 -0400 Received: by mail-io0-f174.google.com with SMTP id q83so426005iod.1 for ; Mon, 18 Jul 2016 12:51:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GCeQO2cjSi6IDbWRExrEOeq7IqP7AB/nqVl7vaknfIk=; b=LvKu8eegKRtk97J7lqcaLRipZN0pmDU64ibkQE6goTo3yiR9fcJclFBwht3PutY/M+ aTsykNyRSh/QtmyEQi1wIkwQJ40QPQxQdCgzthmuEgsEYdj656krY6R2OpeNtmb3zm+Q etUanWIorRelBbrKr5slkEN6qrw+v3Mz8uxmA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GCeQO2cjSi6IDbWRExrEOeq7IqP7AB/nqVl7vaknfIk=; b=CS8DQzY+PItHNkjUGJTsxyK3/O01TmdfSrzvYmt4L2zyKcy0elAh5lszEBZmucfr+k 42bMyrUFGbgYCxT+p6d3HNcB/1l2OzNwSNXdkyVAR87h6TSK3+641x2Aw00Z/FJ7LThx Rq6Fa9A4817Z/FKuBjuMXxHU7CBD7O55m9TczI5m89Ks+GOZCN1Ou9gp9M8gtKcDtSlQ Uchq4/a3DnExR9k06OjrdV+YPhLX1FU/izwSjZT0Ufm1Yn9+UneIMaWD3bIbECt7fz/d RQUoDltMHOECmO0pcS2CF1aN0Et5VpPOl5b8piCOnWMW5VzbEA2k58n5x5icKv769I1y R0PA== X-Gm-Message-State: ALyK8tJPQ25p4sLuabu8vzlAzExyTmIrYUygSmqdnPB90vUDdyMgcl/v9jJmx8uHg4wwX+2/ X-Received: by 10.107.3.70 with SMTP id 67mr5027292iod.97.1468871501636; Mon, 18 Jul 2016 12:51:41 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id r128sm5270676ita.6.2016.07.18.12.51.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jul 2016 12:51:41 -0700 (PDT) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, Mathieu Poirier Subject: [PATCH 07/10] coresight: etm4x: configuring include/exclude function Date: Mon, 18 Jul 2016 13:51:28 -0600 Message-Id: <1468871491-10997-8-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1468871491-10997-1-git-send-email-mathieu.poirier@linaro.org> References: <1468871491-10997-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/hwtracing/coresight/coresight-etm4x.c | 35 +++++++++++++++++++-------- 1 file changed, 25 insertions(+), 10 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 4a4d2ef35ad6..9eba6d8f4633 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -213,13 +213,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; @@ -584,14 +577,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. @@ -600,6 +607,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;