Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp1878764pxb; Sun, 10 Jan 2021 14:51:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJy2gI84EFezOE8vO+I142yKvY0Gb3i6um0isvguu2xHrnLlkJLzg5Ic8VX5GXptKC1Cmdlj X-Received: by 2002:a17:907:b09:: with SMTP id h9mr9140152ejl.155.1610319110197; Sun, 10 Jan 2021 14:51:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610319110; cv=none; d=google.com; s=arc-20160816; b=i11H2fHJ9GSW8oaDtjnDerF0V+ZZf1HSqPXr5n3aJS2uTVpfLjqXp3EjfNnEHKeIvl uGIwgz8KojoLDSfXR2XhlmgHP9e566JiGhKWSK+uaXSrmseL71G1jdH9iRPAmqXvx+yk 0l+5SXYpzOicY5i69TWM7usKX1brK6Z9c3vb54y3Gp2YkhUilfyYQewV+VuuU8HGjFC1 xDxD5QLqxWe1Tb8Sv95Qozyp7+6pByKeblFf9T3ibsuMCWd9B3DGtNHkGGW1VSTbxySE x1jFkMOXuqNXNBQ52z1n40BWGJqafV2xZyW2gIr4C7g4Ve/lQa2sGZ4xa0jOpehGZRuv NnfA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=oDf3CtLc0FfJ0z8B9LD2MjVYHNwL/lg1GVic5irO+YM=; b=WRvLjDqEvtzM9IW2MBs9K/GMe1c9R65uZCEsNOyabponcFWoIRTH5VnaSJrNFEobIs W+9BP3BGYfVH8tkXb/yUxHKaeeJavkQLQbFLRh92fGA+2WVVB76Ki6iRjGC/JO2XKhIE T+kyxEbdyJp5MrhS1nyKmmkiF3zadFMo955jLtGvLIr2oiQUUHl3VBqoJfNVz+1gR0Ym b3up2xhVAIyTOlsUUsytAujGPV/RMAGullzAODCE1if4NOSlLcBJQYfxEYOWy5u1sF1V TwpAx+J768HHFhV9QjtIeiMTBISzqH3M5Bk1rz4W6Pl4ZJjFHd3ODoISzZ5lR1wx4UX1 sXYA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rv19si5965132ejb.262.2021.01.10.14.51.26; Sun, 10 Jan 2021 14:51:50 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727151AbhAJWt4 (ORCPT + 99 others); Sun, 10 Jan 2021 17:49:56 -0500 Received: from foss.arm.com ([217.140.110.172]:38804 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726608AbhAJWtv (ORCPT ); Sun, 10 Jan 2021 17:49:51 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A245311B3; Sun, 10 Jan 2021 14:49:05 -0800 (PST) Received: from ewhatever.cambridge.arm.com (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1E1D13F719; Sun, 10 Jan 2021 14:49:04 -0800 (PST) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: coresight@lists.linaro.org, mathieu.poirier@linaro.org, anshuman.khandual@arm.com, mike.leach@linaro.org, leo.yan@linaro.org, linux-kernel@vger.kernel.org, jonathan.zhouwen@huawei.com, catalin.marinas@arm.com, Suzuki K Poulose , Sai Prakash Ranjan , Tingwei Zhang Subject: [PATCH v7 02/28] coresight: etm4x: Skip accessing TRCPDCR in save/restore Date: Sun, 10 Jan 2021 22:48:24 +0000 Message-Id: <20210110224850.1880240-3-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20210110224850.1880240-1-suzuki.poulose@arm.com> References: <20210110224850.1880240-1-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: 02510a5aa78df45 ("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 --- 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 76526679b998..cce65fc0c9aa 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; -- 2.24.1