From patchwork Mon Mar 1 16:11:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 388735 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp3659262jap; Mon, 1 Mar 2021 12:11:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxOZqozHvGwkPIb71OWTL6ZeTmxZF3zrwkj+0cQijiC/pNH4gxqlZZAtmv/A1dsVxfVWzk X-Received: by 2002:a50:8a90:: with SMTP id j16mr17566928edj.334.1614629391883; Mon, 01 Mar 2021 12:09:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614629391; cv=none; d=google.com; s=arc-20160816; b=Z0tPq2h8pTscrwrZZpRzcbVB1i/wId/ERz9R5dStnBdsAnS1bR7cp+MSHWZRS2Ts4I f88ZvPNMYz1byj2OpGJe7S5YTNOXbWcyEPiS6kO/sD41yXp3/Mi5hMY+WPe/+HGpzNDn Tbufbcuh7I1DPAYG12zfvv+SWAjOg3naeuEA7V61FGxdIDpgUYH2oSSZYcEdrXJPM+ip +6JeEiw0U0MUy76mMJDHDgip49e7ntCEQAKLcv5VcyQzS/F3d/zzDuCUVEcMlhyE4i2U 64QfiV/M4XCPRm2RNRww0tdD6RaqPx3pbJg1RRiMalbHk7ZxNdz2QqGZ3WUEwNmPzZGy P9Ew== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wox1L6rtQmtBaRegjuhDjQBgHF+3rpw+2t9grhxtHko=; b=uPNenWfvAghOHiwB5lSrs6xj/nbswaYFah43t1kgcnTS7/CF+YFt39p4y5ZM8jzyHx d4Gb8P24W8VmW+8KKIs/dQrXBJWxmGEEKZ4eXJo/CtcHcqUE6DuFIf5OmkN8iClJpejM V9xdWH0dARLOF3LGQwy98YiDEz9cNJyiGWsBrGL91/En+dICo1GDXO+hNG4jB+SR6zqm XX68o8I4/oDb3Rm1u7qkFIOn9AYlEPezk7xcemGJOHFdMHK6VVEBncF7gT55vWhE9OHw gVc7taSckQEuhQuxLOXXTlLgmLwaMW+RuALfWPjrzCkMbiXl08kC8kNygo+9i8/S6RHU K91w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I20LU6g3; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e26si12039502edr.556.2021.03.01.12.09.51; Mon, 01 Mar 2021 12:09:51 -0800 (PST) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I20LU6g3; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242957AbhCAUIy (ORCPT + 13 others); Mon, 1 Mar 2021 15:08:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:33554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237563AbhCAUAP (ORCPT ); Mon, 1 Mar 2021 15:00:15 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3206864EC9; Mon, 1 Mar 2021 17:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614621406; bh=bmVaea+emYjkZm52DEUbyT/Kp0Nrv+3QUeahUHLXD9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I20LU6g3iQQideDwSm+pC7VIxCLVxlh1N4xRwv6hvUQhIrK5/BHJPL6ObDD65FAWR OzwE7IkQFiCaqQpaxRNZRaFiNstYdw+pd2krrbYn/t8i5kdid6nU2hY/MZ0MnKljhc Df8nwFDCSDz2DpQiIjpSEEtR8v7phhDAIj2TFBDM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Poirier , Mike Leach , Sai Prakash Ranjan , Tingwei Zhang , Suzuki K Poulose , Sasha Levin Subject: [PATCH 5.11 505/775] coresight: etm4x: Skip accessing TRCPDCR in save/restore Date: Mon, 1 Mar 2021 17:11:13 +0100 Message-Id: <20210301161226.470165874@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161201.679371205@linuxfoundation.org> References: <20210301161201.679371205@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Suzuki K Poulose [ Upstream commit df81b43802f43c0954a55e5d513e8750a1ab4d31 ] 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. Link: https://lore.kernel.org/r/20210110224850.1880240-3-suzuki.poulose@arm.com Fixes: 02510a5aa78d ("coresight: etm4x: Add support to skip trace unit power up") Cc: Mathieu Poirier Cc: Mike Leach Cc: Sai Prakash Ranjan Cc: Tingwei Zhang Tested-by: Sai Prakash Ranjan Reviewed-by: Sai Prakash Ranjan Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier Link: https://lore.kernel.org/r/20210201181351.1475223-5-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) -- 2.27.0 diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index b20b6ff17cf65..200fa1c8aa0be 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -1355,7 +1355,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)) { @@ -1373,9 +1374,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; @@ -1469,7 +1470,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;