Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2318260pxu; Sat, 28 Nov 2020 10:00:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZ4S3ZcYNR0T1kmsnhI+FngF4LZBZzGJTJqavUPTNOhQ+VT8R8Brzff4owRSiyFX2tGTdL X-Received: by 2002:a17:906:94ca:: with SMTP id d10mr11607813ejy.62.1606586427226; Sat, 28 Nov 2020 10:00:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606586427; cv=none; d=google.com; s=arc-20160816; b=04OXCdS4vy0p+D+qb18kEAUwNHKay973S9BR6UAC18FZ77gd4FyKYfrg+UlGTxy7FE zIF7cNo7Ef55QdL+ZGX3S/I1s8RvvBAsKSIbVcrispoNWKjbErOOAcjD6TUz+tsUrnkj qyWxFMjbqhJAZGUTSBxjs/SchvmY4db85Ssrc9ptP6YeIZ2PNRGMNqgxa/md9M/CWKaV YUs+Ao35aORjvt8COWgQ2x9iHqiL3+/uWZR+GoCUT5K5UL5a7Q5iP27Uw8weL68bXful 2rjnXnz9vu3yyRoGmbm5GDKdv6x+wQKvGbveGWCMd4AII0AfoNDJSRm0RnfXs8hw8wx1 Z7jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yJTRVdDNQqRXteS6C4CSN6L/mZ0HsZqIw2wpYC2Y4Nk=; b=ar29kSXtJ58avzhNynuyilc68GSrqSEut4TKm24Vx3i9LpQFsfOqso1fT6DKbADI+U uzAnflcXPGJ55CSA4R7hfYU1U7KfE8SqnF5hnfJIZr4j17QO47P+lXr+UtqugZ/dozax cJInvQuRv+mx4OH86mQ3TbbE2cP0m/DI9i0HfJO3c0mp6ffIHRfFFXbcYiWr382VeTGn q7Futqk0Qa8KeXr3AsdXzw7wB9ACwP7ZU7aRdF+TiAeyEIMoYx6HEboTN5AaJUrHeO6p nsnHTz2Yn/qeDnUlT1fAjUvhlj/iORMTZJpdVYpaXS5ua65OmgiQPPux5GdGiKHyXBGZ mIUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WY4TtJ8l; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si5446947edb.210.2020.11.28.09.59.05; Sat, 28 Nov 2020 10:00:27 -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=@linaro.org header.s=google header.b=WY4TtJ8l; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729678AbgK0S5M (ORCPT + 99 others); Fri, 27 Nov 2020 13:57:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728995AbgK0Sz0 (ORCPT ); Fri, 27 Nov 2020 13:55:26 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2644C0613D1 for ; Fri, 27 Nov 2020 10:55:25 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id b10so3898594pfo.4 for ; Fri, 27 Nov 2020 10:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=yJTRVdDNQqRXteS6C4CSN6L/mZ0HsZqIw2wpYC2Y4Nk=; b=WY4TtJ8lwdsb/VO6jjdOniSR5/Yozemb4j+lPih07WiohM/l6zC72nIURAUS39025/ BO/rnTYM/qz4IWFDgt/ZruCjVjchsJJKzpOw+sHaPHU8WypOj4pM+TZMKqzu5QHAo1uU PCnhakcrzmBKDCFLSdL5z+J4lTHKv0sGSX+9Ks+2mNI09+ptD2UFk1kWhStfX8+CzGMZ /vJQ6lVvzkgBVNL8NESvyUIHS7paDa4BY2m7IvcCbn6ApSbfYqMKfn0UMvPKYONAGiSC dnx/YEaeMir2d/EwFEuvi0Khq3sHKlglwhJtDNfTC7QhT5OE2PLFy2w9uMfJ/yByTFHi w8jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=yJTRVdDNQqRXteS6C4CSN6L/mZ0HsZqIw2wpYC2Y4Nk=; b=WMPObdNAqmU3lvADTKzq03yh8awWiW8uvLJHo+CMDk1QAnLE6r557g90V3BVciWN76 eIZxoapKUU232OzkTRb3NBC5dVO5wT/o3kVZDM25t5tPV0JoTtFbbBAYpYi7Tt9FI+Ex JjC6vReuNdvZ1bd/CQOKY0waiYvl3ukd+qga0/rbPwLg0wlFs/jXioytjCyYc6BFshB5 WwS5gnICODxjsE4bDcGGMk22BtlDDT7TMQMOs2Yw0C1DinfPqm48KSlhmlXAb/NC1tLu zBl7ztsKK2p8Ycljb8+jBQyfRopXRYZA1wnjVEUDgy58vt4zwbZCYZjiYSMr8vROiNE4 D0Ng== X-Gm-Message-State: AOAM531hpE2MSsv+jme5ga13ZpOwfPWBFAOKjtdtASX0LNvCu0iEtFRS xmgYp/hHEIzQEo4qheAJDSgw7g== X-Received: by 2002:a62:7905:0:b029:197:f300:5a2a with SMTP id u5-20020a6279050000b0290197f3005a2amr8612452pfc.30.1606503325198; Fri, 27 Nov 2020 10:55:25 -0800 (PST) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id 64sm8363944pfe.0.2020.11.27.10.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Nov 2020 10:55:24 -0800 (PST) Date: Fri, 27 Nov 2020 11:55:22 -0700 From: Mathieu Poirier To: Suzuki K Poulose Cc: linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org, linux-kernel@vger.kernel.org, anshuman.khandual@arm.com, jonathan.zhouwen@huawei.com, coresight@lists.linaro.org, Sai Prakash Ranjan , Tingwei Zhang Subject: Re: [PATCH v4 02/25] coresight: etm4x: Skip accessing TRCPDCR in save/restore Message-ID: <20201127185522.GB1092947@xps15> References: <20201119164547.2982871-1-suzuki.poulose@arm.com> <20201119164547.2982871-3-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201119164547.2982871-3-suzuki.poulose@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 19, 2020 at 04:45:24PM +0000, Suzuki K Poulose wrote: > 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") https://elixir.bootlin.com/linux/v5.10-rc5/source/Documentation/process/submitting-patches.rst#L121 > 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 >