Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp590104pxb; Thu, 19 Nov 2020 08:49:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJylySkxOZkn4wVIN4X4ElZ6sPt+BFZlJAJJFdDYBEVLwZUAsXYAlPetGMDNIA0ePtZk+4/d X-Received: by 2002:a17:906:8398:: with SMTP id p24mr29784294ejx.401.1605804550700; Thu, 19 Nov 2020 08:49:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605804550; cv=none; d=google.com; s=arc-20160816; b=QrWoqxKfWyu3KCvAglr7xDUMbR9mrSoAiRVkJ6KQ5p/3Nc1t7yR6EY/jEH5v6bfnxc NzmTl1h7PfCir32ddUWPo98G6wqKthUv0cRcuZbAfXp6svgkz0HdC6wFw96OzJiZ/1tm Msk3ecM3bTCNnmljVP6cnCSfQyrjEWi1vxS6ApvKhnSxu8Jhnhv7egpbxf7CeAudVmLf QTDWRTNxCecAxPJyfdB+wvNAxacOb4azODJ9lq8c89FBZpbaRvSFS/zdCk4AmuAuaf/7 UgWQ6OCpBNA2sGcu5AqfQbOEPElpQbo78dMfqkKEVFmvFkBGr0Xm3V4LWnLJN2MYjSP6 +1Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rXdKDsuLd9oa6GMYCimcQ8IldgScWY1YjRfEiwd5OOo=; b=UCRxdkihi8TczDRsYix0MlOPGb7LHZyQhtroy44djjFu7oAIM4BbMC7X8Q9FzviO6J oJZycv0tyBLpqTK2L5r/xOkkp7Its1mGyk9Nkf+WUbqOsKw75Eoh15ai217EXmrR6Vix 0qe1WUlpqQhluUxIl+ifMt4NmtzouU4NKoNWGVsHBom1z8eBz8ZE+tvRi5bVoSJD18FW vhSy7a8ByZ4hhCnjp0WZTFynFOmCVdPBOdGYlOsL9JiZ6SQjw8AhKyFeM3py1NLuQT6W lsI5tfzfHWCm0xNNmRS6jgZ+2oUm534/2gGlNjqZP3D6U0E43vPxBeObuPFBrWuVJKUV 8D6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si127497ejd.678.2020.11.19.08.48.47; Thu, 19 Nov 2020 08:49:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729124AbgKSQqG (ORCPT + 99 others); Thu, 19 Nov 2020 11:46:06 -0500 Received: from foss.arm.com ([217.140.110.172]:34434 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727369AbgKSQqG (ORCPT ); Thu, 19 Nov 2020 11:46:06 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5875615AD; Thu, 19 Nov 2020 08:46:04 -0800 (PST) Received: from ewhatever.cambridge.arm.com (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 078303F719; Thu, 19 Nov 2020 08:46:02 -0800 (PST) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: mathieu.poirier@linaro.org, mike.leach@linaro.org, linux-kernel@vger.kernel.org, anshuman.khandual@arm.com, jonathan.zhouwen@huawei.com, coresight@lists.linaro.org, Suzuki K Poulose , Sai Prakash Ranjan , Tingwei Zhang Subject: [PATCH v4 02/25] coresight: etm4x: Skip accessing TRCPDCR in save/restore Date: Thu, 19 Nov 2020 16:45:24 +0000 Message-Id: <20201119164547.2982871-3-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20201119164547.2982871-1-suzuki.poulose@arm.com> References: <20201119164547.2982871-1-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the ETM is affected by Qualcomm errata, modifying the TRCPDCR could cause the system hang. Even though this is taken care of during enable/disable ETM, the ETM state save/restore could still access the TRCPDCR. Make sure we skip the access during the save/restore. Found by code inspection. Fixes: commit 02510a5aa78df45 ("coresight: etm4x: Add support to skip trace unit power up") Cc: Mathieu Poirier Cc: Mike Leach Cc: Sai Prakash Ranjan Cc: Tingwei Zhang Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 59a4a166adf4..ea2e317ddb7d 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -1277,7 +1277,8 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) state->trcclaimset = readl(drvdata->base + TRCCLAIMCLR); - state->trcpdcr = readl(drvdata->base + TRCPDCR); + if (!drvdata->skip_power_up) + state->trcpdcr = readl(drvdata->base + TRCPDCR); /* wait for TRCSTATR.IDLE to go up */ if (coresight_timeout(drvdata->base, TRCSTATR, TRCSTATR_IDLE_BIT, 1)) { @@ -1295,9 +1296,9 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) * potentially save power on systems that respect the TRCPDCR_PU * despite requesting software to save/restore state. */ - writel_relaxed((state->trcpdcr & ~TRCPDCR_PU), - drvdata->base + TRCPDCR); - + if (!drvdata->skip_power_up) + writel_relaxed((state->trcpdcr & ~TRCPDCR_PU), + drvdata->base + TRCPDCR); out: CS_LOCK(drvdata->base); return ret; @@ -1392,7 +1393,8 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata) writel_relaxed(state->trcclaimset, drvdata->base + TRCCLAIMSET); - writel_relaxed(state->trcpdcr, drvdata->base + TRCPDCR); + if (!drvdata->skip_power_up) + writel_relaxed(state->trcpdcr, drvdata->base + TRCPDCR); drvdata->state_needs_restore = false; -- 2.24.1