Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp914071pxb; Wed, 3 Mar 2021 20:52:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFCrQLNhAmUITmolQFk0an5dfNRgyKz/ZrGhx7LdfGZflmJ/qACo6a0NCmET8QgwKC5qm+ X-Received: by 2002:a17:906:8614:: with SMTP id o20mr2174764ejx.386.1614833558454; Wed, 03 Mar 2021 20:52:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614833558; cv=none; d=google.com; s=arc-20160816; b=x7T9KrHg0NyivhHdCLn+HN9qjM/f/F7U0Cuh9CRbqyEEhJaw8++nK9U6+UELT4xj8S fKqZOnoeqwM0uTKZpX0LjvNCH/O8/nq5s3w5fMzlnVdCTxibaJ6ToBxsPUw4xl2licI+ 4l0v6LRjeQi3Ns/t+GJg4rqSa9y3w8P57EhwGrlib0To+7Ojagzo9BvWZNvOqcj2EuuH SrYrRzFsTRwrpmRIXyVxwzO/tzYhk+QkAPcY0M7DtrgypldXrIJnPuoJDpV3+BLKOZeM WfhZSJb/rLwpskqY7sLa6/zracU9BXNUqlGy37ZPKHX6HXLts4mvqv9rqMPiON1Nn3SA FBFA== 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=aThM+wkeosxq5BrieGIdGqqKjr3e6up0gmTu4nye+2+UU/8SNcI9LnyTuBJ46UuN7R NoUwiH8yADJCOHOja6CqJqPXUVYmYY4lqv6N8UAt5joUuQ2Jpo0r5epqkTwYfij8lsWh 7uTAxyHKm8dh0jdF6U5P7x+xvI70HYbULGiqERfmgnW5U415qSvZ4TfGZyOrwmmhLPex Ld2I7bFlsXO9hShNJOngEyeHrhsv7cP6rG9nl/feqkRAlJJKUMbwsrq0qOUvIDlevWso PRLgdjpgEVoKmzWqozPsA1qjub9NBsacpNbHD+LRkaJkBivHW+dD57QY1ZI9YebMYcAL Eqeg== 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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 f16si2631454edy.392.2021.03.03.20.52.16; Wed, 03 Mar 2021 20:52:38 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dRT65EWF; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241421AbhCBCGu (ORCPT + 99 others); Mon, 1 Mar 2021 21:06:50 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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; -- 2.27.0