From patchwork Mon Mar 1 16:11:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 388724 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp3641357jap; Mon, 1 Mar 2021 11:44:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJx45o7WsPkB0wblAkmFFbRSryGIMQG5L15ktRbkIdHLIj13sfyeXU5fh+OF7gTGajb67oQX X-Received: by 2002:a17:906:b004:: with SMTP id v4mr2063373ejy.340.1614627895941; Mon, 01 Mar 2021 11:44:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614627895; cv=none; d=google.com; s=arc-20160816; b=VXxM7D4J+r3PdvWis3tkvPqXcnloMMdLV1p7c8CVyJ3BMzDvOlS+GryFrJf5A0dJK4 YEkSouuLsse15MwC45yng991f65obVlEZddbWemZK0bG8LzgXBQwmt9Nwim56+pY25yG fs9nxs/tA8mMlkB6UQU/NrgK2RNDUiu/RS69QPtQWLfH5K7ixD0gzV73oz0mORk97sAD KvmOBq/2Qq0jPSOdbHQumgWVxyUmfvSG4/j3P8q6K9mzqmsuWnmTmq1PbDekeXZ3PIlx dvt8Ms+K3KkP6PbXfkhCFZdaa0pBlegNqJu6LnEM51XIGpf2qVY+D6QrR9P5bvTGNq8z ZBUQ== 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=rdDdcuH/TZOkS9gFWuEe2tnua+jvfP6vjssg8tdlZbU=; b=cSzkAz+jjCW/1rqFgk6bYDCIw2cR7UCwj4LfNZUIY+zpscd7NZJcw2ZK8NhawZeBZQ EIw5PdYU4F+s8gieDuDeZNPauZOjY8ahKxgPr8jHv90h0NriT17g/ttQ94Lm+aY2JCw0 rAiqqUA2wfE1/XLpZVix/qc39+ybnJvQ8iMiUPARce8wEbMskdmHMykmz61851NDsigM mjrg9UApM1CTbYauoVySIjKE5ipnQHa1+cmA5M8NdZsMR+b7iKB/O1KEQE3QXVTjgJdo eWLYzv4boBiNn5S6MJmrsn0omv0f9Nh3SfjyTsGTRa0FdOJ0Fs7I5MYm+Ercy7s7HOgp KbDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dRT65EWF; 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 a14si8199121ejk.698.2021.03.01.11.44.55; Mon, 01 Mar 2021 11:44:55 -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=dRT65EWF; 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 S241015AbhCATm3 (ORCPT + 13 others); Mon, 1 Mar 2021 14:42:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:50712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242084AbhCATfJ (ORCPT ); Mon, 1 Mar 2021 14:35:09 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 49E8765214; Mon, 1 Mar 2021 17:22:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614619341; bh=PxZaXedl2P6bCaHX0ljUgUVN2TbxqyrvQcDboCvNTKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dRT65EWFcTqT+9emsiIKLyaAvIQfjbjegW6MhV4yDj0DZEhn0rerN2LpkAAHjE37U JLM4k4sfUkOs52rcpeSRAlu0PF8ZPET1abqeYOsvILHww+50FsikhLmkdbeCSTxX/5 1FraVLL4ioM/0qmnZIcc9296YZCBN3nmmQd7qQCc= 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.10 419/663] coresight: etm4x: Skip accessing TRCPDCR in save/restore Date: Mon, 1 Mar 2021 17:11:07 +0100 Message-Id: <20210301161202.606107908@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@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 95b54b0a36252..8b6666e6fddbf 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -1254,7 +1254,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)) { @@ -1272,9 +1273,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; @@ -1368,7 +1369,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;