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: 9235189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B4C2F602F0 for ; Mon, 18 Jul 2016 19:55:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A75DC205A8 for ; Mon, 18 Jul 2016 19:55:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A78C205AF; Mon, 18 Jul 2016 19:55:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 48311205A8 for ; Mon, 18 Jul 2016 19:55:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPEbw-0008Dr-Dd; Mon, 18 Jul 2016 19:53:52 +0000 Received: from mail-io0-x22a.google.com ([2607:f8b0:4001:c06::22a]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPEaA-000776-G2 for linux-arm-kernel@lists.infradead.org; Mon, 18 Jul 2016 19:52:04 +0000 Received: by mail-io0-x22a.google.com with SMTP id b62so327244iod.3 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=CspeEY9vpAfpe2DB1NJ5pFxOKSkpunrkHcd0P2c7SRfIrxIWHWpTTfv3LXcXfa5kFo M9+S212p5M/obOWItwmKzkNPb+IO0ZGGOJpl59bhKrKkcHFgidcX9UXBvF1jJAE6UmrD lfNbPzAyJ7Yl4SlHEMOA814h9Y/HrZ/VXW2pPYibGl6e1/Bju0g7Xqif+QGxOXb1x3V8 0ye16q9EbjypX5Rn+kabny3XoBvTodyKEY/P6wu900aYg2AzvitlQlfBNHdcTqohlS/1 FpwilyhqNB0VipQYjmvCPLcBQN3FA/Mv7i+PvTpEys5AnSDRJa9Hv6RoLa6Zx8DoYXI5 bjOQ== X-Gm-Message-State: ALyK8tJ2W0Lxphx1m9/11ptls3yECXfD+8pw0YLHOIaeAu58wpVnZNQBLS/euFClvFR4IUC+ 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160718_125202_770801_D2C0EE7C X-CRM114-Status: GOOD ( 13.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org, Mathieu Poirier MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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;