From patchwork Wed Jan 27 18:46:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 371575 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp532620jam; Wed, 27 Jan 2021 10:47:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLYdbuxGtNlxEKRnGlfGNFV+PAMWyhta3cM9Dq7hXpVB2hjhLEIHKx5giysAF50PSmUqf2 X-Received: by 2002:a17:906:af15:: with SMTP id lx21mr7704301ejb.6.1611773256262; Wed, 27 Jan 2021 10:47:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611773256; cv=none; d=google.com; s=arc-20160816; b=jlkUZ2xSI030AkkInpASHoKqjqODKl/LjtfHJ2sQtX2nF88GKYBdCprzO/1bfQE4S7 4ppim4PWuzfhrX/bidhTldJp+DZrPa1fzZawriYf2IMqJ0aSpcpIafvAJEGE3a2kaHL9 vg19Dse+4yDTcXKrBvEvhfAcG6eB20UNhnR5yQVaAqVnRLbWTt7LcU67qqezr20Vtrg2 huZVBeUui44wunsEK5X3P+HzI8iR4uA1bQtkGuSEG7Sb/HWalWlLc1fPxGuQo4BUa08U 1lSubFzz2D3Hg6FW42g1v9kpJKNV+VmLuSR47l7jQIuLjhMpuG2pmr0HzJGODRsosGAG iO7w== 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 :message-id:date:subject:cc:to:from; bh=OrEtKfGpJ+0qpdbSeekCwf+IUKeTYklfrSPReHcw2qI=; b=OP99vS45kvUFKohmofZaU1Fiwf2AJ3SSHJEws0yBpTOy7dG/RvRbl5848qQAigHUhr IaH4sRIIDwRnQjpVFIuI3J9rvN1qMvcQRLdtAbsKmum9rhMup345c6GliWal4PWi1ZqN ft3vcC4FGhsE5qUGb1hF+ppbp/AwTntMmcNVdaucWQXNpedqEQOZDL7EeHcLpV3vGfT5 37k19yz+eN5+ARAOgvQ/oN2qptk+AW6hA6Vbg48F1RYd7ZMtFnDLh8xHHcf5l4lPLlmp fgxalWSdcvsP83mJAMZxLtF2faTj0j3NtevQQ0DDM0nJCELmzMeC9maXuC10uq5O0oEQ DTOA== ARC-Authentication-Results: i=1; mx.google.com; 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=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 p24si1148281ejy.672.2021.01.27.10.47.35; Wed, 27 Jan 2021 10:47:36 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234876AbhA0Sr3 (ORCPT + 13 others); Wed, 27 Jan 2021 13:47:29 -0500 Received: from foss.arm.com ([217.140.110.172]:60380 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233791AbhA0SrO (ORCPT ); Wed, 27 Jan 2021 13:47:14 -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 56C021042; Wed, 27 Jan 2021 10:46:28 -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 1E45B3F68F; Wed, 27 Jan 2021 10:46:27 -0800 (PST) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, coresight@lists.linaro.org, anshuman.khandual@arm.com, Suzuki K Poulose , stable@vger.kernel.org, Mathieu Poirier , Mike Leach , Leo Yan Subject: [PATCH v3] coresight: etm4x: Handle accesses to TRCSTALLCTLR Date: Wed, 27 Jan 2021 18:46:17 +0000 Message-Id: <20210127184617.3684379-1-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org TRCSTALLCTLR register is only implemented if TRCIDR3.STALLCTL == 0b1 Make sure the driver touches the register only it is implemented. Cc: stable@vger.kernel.org Cc: Mathieu Poirier Cc: Mike Leach Cc: Leo Yan Signed-off-by: Suzuki K Poulose --- Changes since v2: - Ignore STALLCTL for sysfs mode --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 9 ++++++--- drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) -- 2.24.1 diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index 473ab7480a36..5017d33ba4f5 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -306,7 +306,8 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) etm4x_relaxed_write32(csa, 0x0, TRCAUXCTLR); etm4x_relaxed_write32(csa, config->eventctrl0, TRCEVENTCTL0R); etm4x_relaxed_write32(csa, config->eventctrl1, TRCEVENTCTL1R); - etm4x_relaxed_write32(csa, config->stall_ctrl, TRCSTALLCTLR); + if (drvdata->stallctl) + etm4x_relaxed_write32(csa, config->stall_ctrl, TRCSTALLCTLR); etm4x_relaxed_write32(csa, config->ts_ctrl, TRCTSCTLR); etm4x_relaxed_write32(csa, config->syncfreq, TRCSYNCPR); etm4x_relaxed_write32(csa, config->ccctlr, TRCCCCTLR); @@ -1463,7 +1464,8 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) state->trcauxctlr = etm4x_read32(csa, TRCAUXCTLR); state->trceventctl0r = etm4x_read32(csa, TRCEVENTCTL0R); state->trceventctl1r = etm4x_read32(csa, TRCEVENTCTL1R); - state->trcstallctlr = etm4x_read32(csa, TRCSTALLCTLR); + if (drvdata->stallctl) + state->trcstallctlr = etm4x_read32(csa, TRCSTALLCTLR); state->trctsctlr = etm4x_read32(csa, TRCTSCTLR); state->trcsyncpr = etm4x_read32(csa, TRCSYNCPR); state->trcccctlr = etm4x_read32(csa, TRCCCCTLR); @@ -1575,7 +1577,8 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata) etm4x_relaxed_write32(csa, state->trcauxctlr, TRCAUXCTLR); etm4x_relaxed_write32(csa, state->trceventctl0r, TRCEVENTCTL0R); etm4x_relaxed_write32(csa, state->trceventctl1r, TRCEVENTCTL1R); - etm4x_relaxed_write32(csa, state->trcstallctlr, TRCSTALLCTLR); + if (drvdata->stallctl) + etm4x_relaxed_write32(csa, state->trcstallctlr, TRCSTALLCTLR); etm4x_relaxed_write32(csa, state->trctsctlr, TRCTSCTLR); etm4x_relaxed_write32(csa, state->trcsyncpr, TRCSYNCPR); etm4x_relaxed_write32(csa, state->trcccctlr, TRCCCCTLR); diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c index b646d53a3133..0995a10790f4 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -389,7 +389,7 @@ static ssize_t mode_store(struct device *dev, config->eventctrl1 &= ~BIT(12); /* bit[8], Instruction stall bit */ - if (config->mode & ETM_MODE_ISTALL_EN) + if ((config->mode & ETM_MODE_ISTALL_EN) && (drvdata->stallctl == true)) config->stall_ctrl |= BIT(8); else config->stall_ctrl &= ~BIT(8);