From patchwork Mon Mar 1 16:14:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 388743 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp3671793jap; Mon, 1 Mar 2021 12:31:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwB3RfW1Yb8vYzpZsyHnLXTDnoqBDYDVbcFRHrouD5bG9TpUwiIMBjb2TMmfCXkXwNJHjN3 X-Received: by 2002:a17:906:780b:: with SMTP id u11mr17612474ejm.492.1614630672009; Mon, 01 Mar 2021 12:31:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614630672; cv=none; d=google.com; s=arc-20160816; b=XmX2zfL6yuiJCsQEPi2qZ4F50Rxy8vms/42pzwIkQ2zNMybYgKKQzPQm05nLi8snD2 Yn418T5VaYfNpXGld4wDdb26sHaHMT1mQfv1daGEUj2JVjYyBnfEJ0DHIGDN5EDAgzTs OQEOK6JQKPXuLcUrsR2+dDf4MFdXpGTFwA3K6wIKlUqunitZ2m4bSZDNEK6Zn5yBTykN gvdWVcfGuNKIeGy3KO5bGWzuJsFwQ5RBNpVUhjeqLSf77xzS1Kb7p2zNf4hqhWL7Iwgh tWVRPZWrzSJL4TaV61NY2bc8Dbb+GtxzF81ytDx4h8dgEpDe6tgFnpwYV5u5Hvc7puD4 A6yA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uoTGLo+LZu4adhTPVw+Kag+5+oeIJii5iGzwL9hEvDk=; b=ZtiEMiR8ZV4qBomIvydwOc6DeRfpm1iCweUibBLfnxw8c/aIfsUJFJ8d3XOxAzBdh4 5zhJ/4FZ/6q7O0TxAdumDmGdWmKNTB6lTAGsoakA4iP2zpybRQY1WT3R2actsH+x2E9/ r+xtMkq7gy/QLztuEcgjNRC8DJ0Zk65wEFaQRZRy7uAHQlyP1Xhcm5gCo1RhuiLyd7kD YiaGATimIbGAJYZIeMPXu/yhBK6iQ18VcfwotyElDwzqv7qSgJINGOvwShouFfzpRNBT vGuSHWSqG2kT+O5AqDG034UYDl0J4njuNlkOcz9du0oQGgQRXOw3F5x6WF49bI840qmo Xv3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=shMN2wp2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u27si8921163ejj.726.2021.03.01.12.31.11; Mon, 01 Mar 2021 12:31:11 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=shMN2wp2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243286AbhCAU3i (ORCPT + 13 others); Mon, 1 Mar 2021 15:29:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:47730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243293AbhCAUXq (ORCPT ); Mon, 1 Mar 2021 15:23:46 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5CB8964FCB; Mon, 1 Mar 2021 18:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614621941; bh=m0wFwVBzOUZ25UHk07LKHbqk1qyz/ehYGBm4mmuF7WE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=shMN2wp2cKufEe0Rtihr55mmheCTuFrGkN+slVNRMq9WArJcPDd++up8KzoFK9Fcp MdBdgKnktjxT4I5FtYnVYkc0RvmHjJnbErt87xAKtRvzAO8fu/TUUMjZ5uvnL3nNMd q3hGkTnaYyicCZ+KBQyU4pydJ6pRlxavcrvaBDes= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Poirier , Mike Leach , Leo Yan , Suzuki K Poulose Subject: [PATCH 5.11 692/775] coresight: etm4x: Handle accesses to TRCSTALLCTLR Date: Mon, 1 Mar 2021 17:14:20 +0100 Message-Id: <20210301161235.582333672@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161201.679371205@linuxfoundation.org> References: <20210301161201.679371205@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Suzuki K Poulose commit f72896063396b0cb205cbf0fd76ec6ab3ca11c8a upstream. TRCSTALLCTLR register is only implemented if TRCIDR3.STALLCTL == 0b1 Make sure the driver touches the register only it is implemented. Link: https://lore.kernel.org/r/20210127184617.3684379-1-suzuki.poulose@arm.com Cc: stable@vger.kernel.org Cc: Mathieu Poirier Cc: Mike Leach Cc: Leo Yan Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier Link: https://lore.kernel.org/r/20210201181351.1475223-32-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 9 ++++++--- drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -226,7 +226,8 @@ static int etm4_enable_hw(struct etmv4_d writel_relaxed(0x0, drvdata->base + TRCAUXCTLR); writel_relaxed(config->eventctrl0, drvdata->base + TRCEVENTCTL0R); writel_relaxed(config->eventctrl1, drvdata->base + TRCEVENTCTL1R); - writel_relaxed(config->stall_ctrl, drvdata->base + TRCSTALLCTLR); + if (drvdata->stallctl) + writel_relaxed(config->stall_ctrl, drvdata->base + TRCSTALLCTLR); writel_relaxed(config->ts_ctrl, drvdata->base + TRCTSCTLR); writel_relaxed(config->syncfreq, drvdata->base + TRCSYNCPR); writel_relaxed(config->ccctlr, drvdata->base + TRCCCCTLR); @@ -1288,7 +1289,8 @@ static int etm4_cpu_save(struct etmv4_dr state->trcauxctlr = readl(drvdata->base + TRCAUXCTLR); state->trceventctl0r = readl(drvdata->base + TRCEVENTCTL0R); state->trceventctl1r = readl(drvdata->base + TRCEVENTCTL1R); - state->trcstallctlr = readl(drvdata->base + TRCSTALLCTLR); + if (drvdata->stallctl) + state->trcstallctlr = readl(drvdata->base + TRCSTALLCTLR); state->trctsctlr = readl(drvdata->base + TRCTSCTLR); state->trcsyncpr = readl(drvdata->base + TRCSYNCPR); state->trcccctlr = readl(drvdata->base + TRCCCCTLR); @@ -1398,7 +1400,8 @@ static void etm4_cpu_restore(struct etmv writel_relaxed(state->trcauxctlr, drvdata->base + TRCAUXCTLR); writel_relaxed(state->trceventctl0r, drvdata->base + TRCEVENTCTL0R); writel_relaxed(state->trceventctl1r, drvdata->base + TRCEVENTCTL1R); - writel_relaxed(state->trcstallctlr, drvdata->base + TRCSTALLCTLR); + if (drvdata->stallctl) + writel_relaxed(state->trcstallctlr, drvdata->base + TRCSTALLCTLR); writel_relaxed(state->trctsctlr, drvdata->base + TRCTSCTLR); writel_relaxed(state->trcsyncpr, drvdata->base + TRCSYNCPR); writel_relaxed(state->trcccctlr, drvdata->base + TRCCCCTLR); --- 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 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);