From patchwork Tue Sep 15 11:36:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 11776229 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7D7D139F for ; Tue, 15 Sep 2020 11:36:44 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7290E20872 for ; Tue, 15 Sep 2020 11:36:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="m7bb57+w"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pLvVGlgE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7290E20872 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=bCWow83hdyjQdlX1jT8Z/4rRn6EAK9cP7q80Houj07s=; b=m7bb57+wM1zLEiuDl/aiVRPA2j MQbILAlLbrLhI7Mj00WFEEFyb8/dI1/qDH9y+9D52wNB5GWFMufUTcluTRnO5d65UC7GRTFsDLb+B tJDDm/Jzkd/gxyydlKRzwbHIb7vlQIqQXaL8hcE+DRKYDCDjsgRe5GL7HdbYG76gJSgdIZKXE4Udb x+NQoAsJ3Bot9XgHF9cIwQRYXiBI6k9IPsgik4OyLioijcnjIb57aqaiOTB+YzmMkyfRMZgJRMCgL u3Kat+5XYyxus56MrEBENK4UFGA8SCxbGhurQHnzk+x677FYgYVlV3TppQdIrrugxJCcScr/QIR5P QvFBzHMA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kI9GC-0001d0-76; Tue, 15 Sep 2020 11:36:33 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kI9G7-0001bo-4p for linux-arm-kernel@lists.infradead.org; Tue, 15 Sep 2020 11:36:28 +0000 Received: by mail-wr1-x442.google.com with SMTP id e16so2970787wrm.2 for ; Tue, 15 Sep 2020 04:36:25 -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; bh=3MyEy4BK6kEo887h97p70YmoMv0NR97lsBq3Kzgdrxw=; b=pLvVGlgEtP2vr+qDa6+teEfzTYfTOdYWa6FmyaIGHr0lKJKIhL/AGHFxJu3O211va4 Nhbfv5xoFxpbtE5meyHHUfYLCUbUwqbaeGUVORmmtK5BkS9hFw4VPeP902ARpJ0jVHLt Iq729LpkL80Oj9M0KT6KuFmS4PUdDVQPw6GjgUnktPRZBpYkBmoH2DLeY7UOP0k04Qps Or9mlx9JNU4/HhsRNkGy9n3c/lPpujQbbPh5Ws3CJqjiSW4cMGHrZNvY6cp+OVKQ+0c9 L7KgGIvHxyTmu+HB/F2Em9wgaDK3ZWWr65AjwiVtckzzfBg9o1+scIoJPwZ6UdVO/wTs 8iig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=3MyEy4BK6kEo887h97p70YmoMv0NR97lsBq3Kzgdrxw=; b=UiB51jB1IJkyZakkcGVFr/Udq2F6vNsT1/JydMoYOCArIhOuIPNQGwkVSCFFB5N5AF lYmQS7FALyttpYEUGNhP2Zjbphz6lhx0CNLG1uCLCOeRtHahR7ygfO4URgrF0PiMwHBq FJ30zgb6MMxxE6utTYO1lrTA8nb/X9hd1ROKbFk/NfVUmtfHu9PWhEVm2YjvoFA+2j8v sgarUa6Q9N4VCK5W+9cON//yFmI4PbvUragkGiJmAr0zp1ToJ4aerEYH5LogApGVww7H 3LoFNLHxqiAmTBwINx2/iFkYz5Kt7WQR49xYEBcXougf6tBYht+29dRf9WnAWWVdB0kI ctsg== X-Gm-Message-State: AOAM5303bEepFjcjau5PHmCUwEnz6hSw04d5S/4eujKYjNrApCtrpOAc +Tpo3XWQQoI1WW9jkmr2SpiTUDI6T2xIXw== X-Google-Smtp-Source: ABdhPJxP7Oxl0i6ofQCMaLEGjMtWPiTB4mg1lI79dyorjKsgOlyEKZmKld06ZCquGdDWSboBaK/w9w== X-Received: by 2002:a5d:5702:: with SMTP id a2mr20533260wrv.284.1600169784214; Tue, 15 Sep 2020 04:36:24 -0700 (PDT) Received: from linaro.org ([2a00:23c5:6801:1801:a950:5c8a:93ce:d498]) by smtp.gmail.com with ESMTPSA id q8sm26162895wrx.79.2020.09.15.04.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2020 04:36:23 -0700 (PDT) From: Mike Leach To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org Subject: [PATCH] coresight: etm4x: Fix number of resources check for ETM 4.3 and above. Date: Tue, 15 Sep 2020 12:36:21 +0100 Message-Id: <20200915113621.10838-1-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200915_073627_510792_7341CF13 X-CRM114-Status: GOOD ( 15.10 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:442 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mike Leach , suzuki.poulose@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The initialisation code checks TRCIDR4 to determine the number of resource selectors available on the system. Since ETM v 4.3, the value 0 has a different meaning. This patch takes into account this change. Signed-off-by: Mike Leach --- drivers/hwtracing/coresight/coresight-etm4x.c | 8 +++++++- drivers/hwtracing/coresight/coresight-etm4x.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 00c9f0bb8b1a..be687276704c 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -742,8 +742,14 @@ static void etm4_init_arch_data(void *info) * The number of resource pairs conveyed by the HW starts at 0, i.e a * value of 0x0 indicate 1 resource pair, 0x1 indicate two and so on. * As such add 1 to the value of NUMRSPAIR for a better representation. + * + * For ETM v4.3 and later, 0x0 means 0, and no pairs are available - + * the default TRUE and FALSE resource selectors are omitted. + * Otherwise for values 0x1 and above the number is N + 1 as per v4.2. */ - drvdata->nr_resource = BMVAL(etmidr4, 16, 19) + 1; + drvdata->nr_resource = BMVAL(etmidr4, 16, 19); + if ((drvdata->arch < ETM4X_ARCH_4V3) || (drvdata->nr_resource > 0)) + drvdata->nr_resource += 1; /* * NUMSSCC, bits[23:20] the number of single-shot * comparator control for tracing. Read any status regs as these diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index 5259f96fd28a..eefc7371c6c4 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -200,6 +200,9 @@ /* NS MON (EL3) mode never implemented */ #define ETM_EXLEVEL_NS_VICTLR_MASK GENMASK(22, 20) +/* Interpretation of resource numbers change at ETM v4.3 architecture */ +#define ETM4X_ARCH_4V3 0x43 + /** * struct etmv4_config - configuration information related to an ETMv4 * @mode: Controls various modes supported by this ETM.