From patchwork Mon Mar 1 16:13:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 388704 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp3608713jap; Mon, 1 Mar 2021 10:58:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzS+nwRSZfrnRY0Ouh91qpDMAxCfg9XAW/Y9tYcSrj+pS/ShVpKcpi65DX7exjZYU7AGYf2 X-Received: by 2002:a17:906:f891:: with SMTP id lg17mr17443475ejb.69.1614625136467; Mon, 01 Mar 2021 10:58:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614625136; cv=none; d=google.com; s=arc-20160816; b=g1FlSAgUT5m3X8xwK6sxa2JBYQNfRHm2p3Zylorlx09GcPYfVPtGRvKBPayFkPcDT6 yLJNlKT6+gMSX6kgpyFrIgqnINRntYxWviWRWScHTUVHhPrwHDxEXZRZJUsa1UKJ7bJj FMnGamxuPsJjOfiTTEUOM0vLjKV4ExFz0MX0gm+R+MrqNLl4YlOrAQDwzS1xjJBdYQu3 KSLrlXTdTRtUoeKTb8RH+rP3rpMHP5tCXfMrn8NltICZl7WW4+a9fJWSdXqy4cKLbadf RElpPQI9A7l7AQU0elYAJvDZvHkZdA8wsw1BY4AFO6wx5IjwLvYcfjMpx0Un46Cex4Es /jNw== 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=CvMzqRuZTYIeHYHu8AgSCWcPA8nGdRL572Rg3+ALT0c=; b=pXELNr0CMr8N4R2AS7CDMB5uUSJAsv+Dm1FuV+PgnI/+TmqlR/kjRxo84eru3zzUvf DqES0ZFeQNziYF305zzzJ7p+wbApHBFuRXbF1bsyWnBd8bAIKim22dajQq8zMlQoNUN9 pIhtKem0qibYH68vxWZ6ihXS+z21DnVcS8NTW6aJNj3Uf5Dol2GtAsgAC1P6dRbOuSF1 b8ce5KJ2enEBdN9f0Dg4q5fctgsT8/OCLxdJUFaQzdpB3NSyerjKK/yMn6VEFnta4jBu Q2YVOWPvJ03age09Tmo8lrpE4SlteFMKU9vWMPj6NuK7Ajqnr35JhYlWCasCG+1mKDLX 36wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g71PDteB; 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 z18si11104237ejx.409.2021.03.01.10.58.56; Mon, 01 Mar 2021 10:58:56 -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=g71PDteB; 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 S233690AbhCAS4s (ORCPT + 13 others); Mon, 1 Mar 2021 13:56:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:53758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240631AbhCASsh (ORCPT ); Mon, 1 Mar 2021 13:48:37 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0AF5365279; Mon, 1 Mar 2021 17:30:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614619825; bh=Q1lX0AQ/A87HqSnarxMVKysYgGUzDGZv3tDnwIiRUvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g71PDteB/EY8hH01xM7job7uwF0mWMUUYs8XUchF23XVMs1l8kT94bfsYbaoFRNWX 6wjxv520n8B9vEqMCp+rSgdFQkNcl+rxdQ6Z51O4zE4u0/S69p45knmYI7X85T/jOg 2Uf49Hyn+2n/hfN3wmBw1Z076sHLYHkglnbI1+ZM= 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.10 587/663] coresight: etm4x: Handle accesses to TRCSTALLCTLR Date: Mon, 1 Mar 2021 17:13:55 +0100 Message-Id: <20210301161210.904597069@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@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 @@ -131,7 +131,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); @@ -1187,7 +1188,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); @@ -1297,7 +1299,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);