From patchwork Thu Aug 25 21:19:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 74747 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1049489qga; Thu, 25 Aug 2016 14:27:15 -0700 (PDT) X-Received: by 10.98.10.157 with SMTP id 29mr20286123pfk.62.1472160435317; Thu, 25 Aug 2016 14:27:15 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id l29si17341864pfk.67.2016.08.25.14.27.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Aug 2016 14:27:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org 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 1bd29y-00048J-Dd; Thu, 25 Aug 2016 21:26:02 +0000 Received: from mail-it0-x22d.google.com ([2607:f8b0:4001:c0b::22d]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bd24j-00071e-HB for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2016 21:20:41 +0000 Received: by mail-it0-x22d.google.com with SMTP id x131so296644934ite.0 for ; Thu, 25 Aug 2016 14:20:16 -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=NMLCtTz0aiz0h2SliVqfLkXeen5MpVKm3iqQmWbpEZ8=; b=UcPQ/RQNWYxjkN+/FLIKpzwgAG/YUmv3PzIEzMuev8KlTod4N8LX/NGkY7G/q8eiHy 9VN+y17qFgFZphWxBFhu/mKrTcKeRtX70Oer3/Ptyu7YzfqDlrNV1yeG+YlzIKnxVsUU q3FLUywXCNm29NLBCWPyJGRE5vwOw46TyDkaM= 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=NMLCtTz0aiz0h2SliVqfLkXeen5MpVKm3iqQmWbpEZ8=; b=Px+5RiX1dOOcsYy6i2+ieAFWWYDfzJKKjDe576OQyTCnfrHgWG+Y9+9ZqdWFpwhZOx kMnwjly7y8brhoVvGPT3R7NeBrFrP/moGL0zoARtL2dFbh5108asXL3nAH31olNDw+kL 4nluBg5iN3ub0ZSaOJWtLzU/oh9pCDOwXLOMRskUSIdMfLXGVNVF0GMG2ESkyaqxsHJn EguopGaVev83hCGsm69h1bf8knSwfYXScLm3fnqpS/zhSyJby+HV8uFMUENLwiKHYb4M hKg1sc3JPMrSp8yAbsV62wHDIFzMsPW3whAa7ltJPxTJmj0nrznUxAyC63wKFN/rwvbj dETA== X-Gm-Message-State: AE9vXwMmY1a9ER1UiUCz4WFRAw3kpF70IKRC+GjobCwhxMWq4iiVVUR+MLnmlRQ/wBg8LBZB X-Received: by 10.107.14.4 with SMTP id 4mr12571482ioo.160.1472160016185; Thu, 25 Aug 2016 14:20:16 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id o5sm14506120ith.20.2016.08.25.14.20.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Aug 2016 14:20:15 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 25/28] coresight: etm4x: adding range filter configuration function Date: Thu, 25 Aug 2016 15:19:15 -0600 Message-Id: <1472159958-5981-26-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472159958-5981-1-git-send-email-mathieu.poirier@linaro.org> References: <1472159958-5981-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160825_142037_858003_6EADF219 X-CRM114-Status: GOOD ( 14.12 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:4001:c0b:0:0:0:22d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org 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(-) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 04462fffe8e4..aca624010b9f 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -581,16 +581,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; @@ -604,20 +598,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