From patchwork Wed Sep 16 19:17:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11780637 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 8858459D for ; Wed, 16 Sep 2020 19:20:42 +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 11D382076B for ; Wed, 16 Sep 2020 19:20:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ltzeisA8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Luh/b7D+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11D382076B 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=5vog5/F/aWVk1mBz9ZWgt9kVHnClhhIYatPIT+IFsKE=; b=ltzeisA8zH6AOyRprybc8j0Y0 cxj7umXOzwbw3ZNOXHs8BCxTiQQBROSblP6KIjslJhoqwhK/2Rc1TL1tRXaOI8V6jk7iu1Y5P0nh0 sy05z8xWWpbBFTJy9c01eUOSO7kdGYlQirrX4R8L8p6xPEVEc1BvFCJRX07ulMq7XVbhRVyzCJRB3 vDRr9eM/lXvbnh1tJEN4PAetsTKPhbanDmmhUBdx5IZAp48arB2RmbEEXtPXpJqkBf4YT4/Xp5sgw w2uje9dEAcg5QqTK5RuxolYTlnMP3ZoHWOvcUM2IRc4m+d60ZFufCa4BkDbKgis91Nr0E8UnA3JiE L0lYSwXaA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcyd-0006JR-S1; Wed, 16 Sep 2020 19:20:23 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIcwJ-0005BF-23 for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 19:18:01 +0000 Received: by mail-pf1-x443.google.com with SMTP id x123so4545316pfc.7 for ; Wed, 16 Sep 2020 12:17:58 -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 :mime-version:content-transfer-encoding; bh=FvuIkxfcV8X2+0uLwFbqf+4k5/cPYO6E0EaPLwQPqlo=; b=Luh/b7D+Lf+LfdLUezJT3ubo9A0S1/9jkPh4OV9s9bnQg34RQf9lIOzHtwy58a3ulp vFwptqbcVUkLtuoZS4du3f378wGMkGi0BKtlxX4XZ2NayetoyaM5RqqvR7paTs7oTERa Vs9sb40BXq+/+v3s83tb1D3a5EyuMew+WHnYpDJDdubbPp6yV1bIeYCNcHoc+TBr6+P4 y4scvLjawCyis9UHi93mzAfUM3EnrMI69Yl9h+VrYtpRGD3Ie/oeySvn+suNg341hsmG N4z1L7vOP0Rxpsq1HMBQnnK1B1QxbwBUmnxPr2FTshphyoB//hlEVe0zi6WUO5TKMRk5 q6/A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=FvuIkxfcV8X2+0uLwFbqf+4k5/cPYO6E0EaPLwQPqlo=; b=csNPkiRBrWmi0YOauR+bo9Hhpe5huAC5SofjhCJtU7DFhfBsdpaaHi4S1RHafhVGQw HznCreXYHfOZBL96j46bMFT+vAULx8E5V30AqAZe1vYqz4rCoHyqRsvRvkTl0X/t6/b8 ZLiOkt3d8CgMGx4HIOJ2pIud5v7HTx1MZRFJN0RE2ed1fuhORpaUqOrePDEcq/Yr4n1t lPv7HYRrv+6pBFMiaxZZUgDEVyTvyKMrxmubYVa8mzYSjcINndUKG5rFOHN2Tt+jBuje MswkR5zqhFFYYrpC4MYCqVrgUpJ4hY2SVCsSkewI4E+/8JytbPf4+ork3jjKm0lcbks3 I9TQ== X-Gm-Message-State: AOAM531WX5/JMU2RnxgLBn6pKfFk9gFMngzd6k+/yi01k6i9zuO0BA+q 3ijVzVBrGPQqFKo9V0ppgIfK+A== X-Google-Smtp-Source: ABdhPJzHmItbqylQSYz5sL8T8+nFutv+uJU4HY+dHmj307pl4G6qohVb9lC8U4O6R4MHQjbNdSkUpw== X-Received: by 2002:a65:685a:: with SMTP id q26mr10324522pgt.28.1600283876831; Wed, 16 Sep 2020 12:17:56 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b2sm11373688pfp.3.2020.09.16.12.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 12:17:56 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 16/16] coresight: etm4x: Fix number of resources check for ETM 4.3 and above Date: Wed, 16 Sep 2020 13:17:37 -0600 Message-Id: <20200916191737.4001561-17-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200916191737.4001561-1-mathieu.poirier@linaro.org> References: <20200916191737.4001561-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_151759_153823_1DA7BBF1 X-CRM114-Status: GOOD ( 15.57 ) 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 [2607:f8b0:4864:20:0:0:0:443 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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.29 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 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Leach 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. Cc: stable@vger.kernel.org Signed-off-by: Mike Leach [Removed '.' in patch title, added stable] Signed-off-by: Mathieu Poirier --- 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 b29ad4f7fac2..f5ab13aaecea 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.