From patchwork Mon Feb 1 18:13:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 12059641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58BECC433E0 for ; Mon, 1 Feb 2021 18:15: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 003C164EA0 for ; Mon, 1 Feb 2021 18:15:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 003C164EA0 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+linux-arm-kernel=archiver.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=9GHU8IpB360HkoNuN8C4A4YUiJushfpGJ2JHlH2Xfj8=; b=XLs24rWzJEwaePD5IEr+MDSBf of7CJLG+njpJ93NCZWtoMmub/tiJcWIPBLTVAuNnWtFYZJKTF5EX0AjG6b2Wma34ziEnu1G8qIZXo FZaOc9W1bRR8qdHFfy1zFN63M/M1piim3nErCcfzykttsfl3bQHlMfRGS4346gj8hat6boGKg9479 7I9a3RU/8wmN7RFwNJo1Y0Ua+DjtCobWk1B6bPFWz8D69E7FY4DDr6nZlPMX9bDD2mwb7z0cu/pBc Xq9y0DZuytBGTuujIdbfZ2YL00K/UTWo1t8qQ07Z9N998A2LjpsiHrW/u3lyY1PTXAtM4pO/hmt5b kF6f4fJUQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6diK-00035x-Ne; Mon, 01 Feb 2021 18:14:16 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6di3-0002vs-B3 for linux-arm-kernel@lists.infradead.org; Mon, 01 Feb 2021 18:14:03 +0000 Received: by mail-pl1-x632.google.com with SMTP id b17so10463157plz.6 for ; Mon, 01 Feb 2021 10:13:58 -0800 (PST) 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=O41rJTlMZTVcMIElK5KqNnqfKtFcYHMw/qm7GjAEOtc=; b=SicjLH2B3f1NYan3zMCEi76cHb9l2J3UEvYZ9aVjRskpwK1cLtxtylONvSM+kUdSgr tbafOxWVBf5DdwXdQFI4nDmU4peqLTunvKCeEaU6LOv4dasiv+NzY56WnXBVUv+IKp0T 4Q3uaNYQN+vfEJFYN9Tdp95GqZrZ3pG5tUaXB6pJNYwxr/hNqzlHWNYyUAYe1QRqAXpf LdiW8Fw+DSmIDHIqdo0qNi6IzRTHOfObJ6wx5+52Qsi3BpTkvQj9N29BOVVqv7mmEI4w lj44xGnxqRKOifns++V8Nop0HvCZPl1i+NP5QUcUccF2EgCXKgXVT8FyMtCzZJdDw1wi xZzQ== 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=O41rJTlMZTVcMIElK5KqNnqfKtFcYHMw/qm7GjAEOtc=; b=tSMWK6KRv+Yhi/F66DEfYLgBgd4Jzten1aC5dSTx1v/Qn1Z7OfCjDQrkbxehCDia2J TpQKffgh3ue5Po9+ZFM4cQ9EnbR/HzCYIxT7lvQm0cXzO1BAsVt4KJtGZSFuTeNd4upT mtaW3aCcmTeD5FwWS3VLvYN1MXOhW9KwYqx2dwHy1FY9sjXhfsutIjwKtzWpCxbqXyZT nBw9anIwcFeGPLc3uQc4lKMeGSX1R69Jb9gCVi6kMpSOlqYp1oKaiW5u7HjkiAaqx2S3 B/1+OGG140i2I6bstsY/H8yylghMdeljoiULf/JlsFVdKtTK+HcK4pfpaQwyIWGlskqH gPTQ== X-Gm-Message-State: AOAM530lNS6kmvxiBm732AvGbvbU93zz17eYwEqC/q8I6tFMIhQV1nHC 6gLYutyUTfGwkANDj6gpfyWlK1ev7shSNQ== X-Google-Smtp-Source: ABdhPJwvsIXJgpAx3CYkvtgGeS+y+LHSVT2dOhln0HvqlMpx4ib1syz0J/T0PMim1vZZ1xcsQuLZCA== X-Received: by 2002:a17:902:bd0a:b029:e0:612:ad38 with SMTP id p10-20020a170902bd0ab02900e00612ad38mr19262845pls.30.1612203237104; Mon, 01 Feb 2021 10:13:57 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id e12sm75784pjj.23.2021.02.01.10.13.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 10:13:56 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 04/31] coresight: etm4x: Skip accessing TRCPDCR in save/restore Date: Mon, 1 Feb 2021 11:13:24 -0700 Message-Id: <20210201181351.1475223-5-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210201181351.1475223-1-mathieu.poirier@linaro.org> References: <20210201181351.1475223-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-20210201_131359_645883_C7763901 X-CRM114-Status: GOOD ( 14.31 ) 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+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Suzuki K Poulose 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: 02510a5aa78d ("coresight: etm4x: Add support to skip trace unit power up") Cc: Mathieu Poirier Cc: Mike Leach Cc: Sai Prakash Ranjan Cc: Tingwei Zhang Reviewed-by: Sai Prakash Ranjan Tested-by: Sai Prakash Ranjan Signed-off-by: Suzuki K Poulose Link: https://lore.kernel.org/r/20210110224850.1880240-3-suzuki.poulose@arm.com Signed-off-by: Mathieu Poirier --- 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 4b615e9f3d76..0924c376e35a 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -1373,7 +1373,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)) { @@ -1391,9 +1392,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; @@ -1488,7 +1489,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;