From patchwork Mon Jul 18 19:51:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 9235181 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 77F7C602F0 for ; Mon, 18 Jul 2016 19:54:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69B2E20008 for ; Mon, 18 Jul 2016 19:54:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CF6C205AD; Mon, 18 Jul 2016 19:54:04 +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 DD52920008 for ; Mon, 18 Jul 2016 19:54:03 +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 1bPEan-0007Rp-NS; Mon, 18 Jul 2016 19:52:41 +0000 Received: from mail-io0-x234.google.com ([2607:f8b0:4001:c06::234]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPEa7-00076s-EV for linux-arm-kernel@lists.infradead.org; Mon, 18 Jul 2016 19:52:02 +0000 Received: by mail-io0-x234.google.com with SMTP id b62so326937iod.3 for ; Mon, 18 Jul 2016 12:51:41 -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=tvLsOGgrV+wGf5u35/r/N/zDP5tXrWWY69UEEVygaaI=; b=gIxaCWlCcsmqPg4wWv2+rNKUN41kB3BJSDGbPiGRlSr7HJNPxWI60IY3fzXcUaPbPL 0BP6+049YZ7fz9EF0dpDQ3yv6KUF2bxTVIbuBat99QNnhm0LmoQGQWbl+IF1Svtchvgk +4qGqJkCj9LIzjKnubuuUklTqyybl9+/IVouY= 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=tvLsOGgrV+wGf5u35/r/N/zDP5tXrWWY69UEEVygaaI=; b=kTz0N15j5R9o1TAqIvvjhJLMwRXC7z93smY5YYzcMwNBBCBUstik4uZFzv7Jj77+av NDeQtFMKu/RmeBLYL/yqxlNSU9QsUais42LQHrO64q8GaYd06/D05UxyYyl6GDnFwhVl gv+o6qC4wFS4jQl1zpofNHKOJXoKLzCpA2TE9OnzBoK79ZgbUVKwHCq7aS32X1TD1Q16 TJNaoUfsNQ6Ig/+YYlyK5XUamdQYrfNdGf2Kir3pBZrelNyAlgsE2wla/inEkoqeFtMh MYIxZhW4JltQwuOrfSLAKjPigQfvM0u7FaDovH4/azNvWXx8RB3TcTjUCYgyQcZ6NdBI o/UQ== X-Gm-Message-State: ALyK8tLb1ccYVawAqhGxLlFrW/bwaZX51lkTXbAiJky6Vbin0tkrSWTdEZar32i/2doNrKgN X-Received: by 10.107.179.9 with SMTP id c9mr27356965iof.170.1468871500642; Mon, 18 Jul 2016 12:51:40 -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.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jul 2016 12:51:40 -0700 (PDT) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 06/10] coresight: etm4x: adding range filter configuration function Date: Mon, 18 Jul 2016 13:51:27 -0600 Message-Id: <1468871491-10997-7-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_125159_837616_7247259E X-CRM114-Status: GOOD ( 13.76 ) 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 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 --- 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