Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp584971pxb; Wed, 27 Jan 2021 15:54:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJwpH89Db43QhM94YGOyiF2k5UJgaMOgLa3ciJPHkQb1gBIG1dXea85hJWqkBzAlISjcDVu5 X-Received: by 2002:a05:6402:151:: with SMTP id s17mr10667979edu.107.1611791641380; Wed, 27 Jan 2021 15:54:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611791641; cv=none; d=google.com; s=arc-20160816; b=n7dKSEibI5bwtKV5u58Nj0nCgLDOEtZx7gOtptC3r3s5Y2y9//GZItts/jVlnOx5MK Ilr17UPEmdWXdROwtWSLWsXzbS58Pn4FZZvkl5phxnN5HEJSG5pP6s7VcPUmCaBrg045 IO+QdkFY0Cnn/TT/p6kWgLyiWNtJz2dD1dbL8ZqJ0H1LQCLCIU9C8e2dbzaOqg06y4g/ /ckG6tKJLI8rTdAsZt6iAdfgaLpi9+3Uw/OHz8EQWaJP0vVj5+oAVvywremvLLSBlBHs ESQ9fWbHZLl4Ic6rxhM6+McQYLQ8XxLZ6hB5o5pljRTuHh0wx7Gz4b0uhJlOnGHa1g77 iIDg== 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=n6qpfNhmWBqkeJN91OhBb7YTYJJXiu6U3+arPvH9B/0=; b=wx7erYhmztS0t/ULUpKKMf1OzdYSJHvivdGpU8ajUMynwUFd+Nc2MyAR3m4IG0iTaD QqoHTXJNsXOV60r2aWGpYpyDNwtsBTlisfO/0iqxPjMWlmC/fDxVe0nJqMAFfAZ0BLvz VCxCydeDKkkLId3W0VKoXFJgKQ8po80MaozapSO46T6u4uEFVe8SCqar3N9UPIJ6m1D8 J7QzjA7qxuagVFh526TrGYldmDETJdwgFwtfpXQOvzI96o1/LfHGXtfV6dGwRxoMpsHI IBGvtzAqrXKLBMAsAchIIrIRvYRftWEL2V9OZ4HoB14Eg2GapkoviVdgQmmXNgybHqdj chPg== 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 a15si1475375ejv.583.2021.01.27.15.53.37; Wed, 27 Jan 2021 15:54:01 -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 S237488AbhA0ME1 (ORCPT + 99 others); Wed, 27 Jan 2021 07:04:27 -0500 Received: from foss.arm.com ([217.140.110.172]:42336 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237445AbhA0MBi (ORCPT ); Wed, 27 Jan 2021 07:01:38 -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 2891B1042; Wed, 27 Jan 2021 04:00:51 -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 0B5B43F68F; Wed, 27 Jan 2021 04:00:49 -0800 (PST) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: coresight@lists.linaro.org, linux-kernel@vger.kernel.org, Suzuki K Poulose , stable@vger.kernel.org, Mathieu Poirier , Leo Yan , Mike Leach Subject: [PATCH v2] coresight: etm4x: Handle accesses to TRCSTALLCTLR Date: Wed, 27 Jan 2021 12:00:32 +0000 Message-Id: <20210127120032.3611851-1-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20210126145614.3607093-1-suzuki.poulose@arm.com> References: <20210126145614.3607093-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 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: Leo Yan Cc: Mike Leach Signed-off-by: Suzuki K Poulose --- Changes since v1: - No change to the patch, fixed the stable email address and added usual reviewers. --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 9 ++++++--- drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index b40e3c2bf818..814b49dae0c7 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -367,7 +367,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); @@ -1545,7 +1546,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); @@ -1657,7 +1659,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 1c490bcef3ad..cd9249fbf913 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -296,6 +296,9 @@ static ssize_t mode_store(struct device *dev, if (kstrtoul(buf, 16, &val)) return -EINVAL; + if ((val & ETM_MODE_ISTALL_EN) && !drvdata->stallctl) + return -EINVAL; + spin_lock(&drvdata->spinlock); config->mode = val & ETMv4_MODE_ALL; -- 2.24.1