From patchwork Mon Feb 1 18:13:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 12059681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2885EC433DB for ; Mon, 1 Feb 2021 18:20:30 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 78B0F64E50 for ; Mon, 1 Feb 2021 18:20:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 78B0F64E50 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lqCqB8TT60a7SYYaaZJlkP0vm9pBP7rtJgJPSP1SxIQ=; b=hpfo/hxVLto00eOFrykbFPUXi 3/f4ub0iPpz2KjabV3jrEv9wTC2GVo9OKFLb18puGuRDhwZOujdmyfpRY8yd9q170mxvb0Us5Ad/B 1S6qUS/eaj8QM5BHXc4NluvMfvT2NcipuuwwaRVJeNNiWCaTAMCzoYWTEffuiNgKxcG/HLCLzWmN/ NcJ2lmtI2IlR02C67/33ihdPeyzIP1KbGidOMqI3sR2zBSBJdjNHli7OFktj3yU8UeiHWNfuxfyzj SGLHu0yOOVLMuEMBIbP7nuBg8LmQtFfW8YsK4ous3MBYrD3b62YOGNt5RTdNrtCQxp92Ha+XDcFUT tPMGB4W9A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6dm2-00055V-AX; Mon, 01 Feb 2021 18:18:06 +0000 Received: from casper.infradead.org ([90.155.50.34]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6dia-0003DK-6C for linux-arm-kernel@merlin.infradead.org; Mon, 01 Feb 2021 18:14:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=nr70diwKm9rfL7MM7qHNXTK5sP1+kROD5tDezAlipcU=; b=KSwUW0kvTIAi5E0KAP4+vDO7+1 aeYings3hk/qox3xoGDV9jJyDiQLxSapqCioH+THMf944htmTwdGJkhG3bD2dM8KJXVqioK+o3zEA c2w0cEeFl21cBECoVWNXDf4F7d+cPf1H+RsfYt2bwSUx4CKvSmKCGZSX2YUasc5Y+G0Oj8MjtO64t ZUZLgOkF7kHWhD4J7TIgC7sIHaghcA/5y1DSaKjaqxidIyXvh/Ad0UGK2obLdYuDuuVYhgHZsOooU DKiV2GuqbDGvgW3GxVw/3+EGLeVv1vLJQGNYL384oKsYjTuw+zaMGEAnwT5i8PdWEKz9lNJKlcTNP 6FLbxoXQ==; Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by casper.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1l6diW-00E8E0-PA for linux-arm-kernel@lists.infradead.org; Mon, 01 Feb 2021 18:14:29 +0000 Received: by mail-pg1-x52f.google.com with SMTP id t25so12643177pga.2 for ; Mon, 01 Feb 2021 10:14:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nr70diwKm9rfL7MM7qHNXTK5sP1+kROD5tDezAlipcU=; b=MweWa4R7QAtD77x3C6hFfsPVEwdDdzzg2MD23DvRQbnCZqpsh1VWYPKZhhTEiXxk7d o3GSAr6sxoiE+hut5dWYJka3Fqcjrgebg2NkGx7paQu7MLA+ryo5Dxl+PJ1krr6axQmJ BVZ/3nXL7XJwpEY6c4fXt4AaERVP+PgpPh+/+5J1ysGDhkVmFz0vDV5f4Y+elbyeXk0c yTGofEMPyb6S94+d4oeJVf+HV64D2vYiOTYNBXcIYNIkv2Lc0OA2oI5QnUGqMFGXg8qH AWZMHBO2wMIbdtNPorCO175mb+9kwcJsgUH+pv3UFv5soO7tL6PDOwEmIMAYDqlvmPeI bFAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nr70diwKm9rfL7MM7qHNXTK5sP1+kROD5tDezAlipcU=; b=QwYdeXQR63DpN+0qP69D8vKD8/Tic3lXlVPBHQyEErKNA7+epbgygdYkIFofSFL3/E i3q9L6Eh44A/yuFpAn87nmCBjU0VGXxhh9RV4MZi00fc9udY7TsXe1/iWiItyFqra6rC EXca2XCjaOxoTlKLIMUvbLdYpSNO+4/TVlkp0pJgv84pksgCmAcXoJvXn6O88HI1+s8m AW43i2mX7Hij7xilLbWuyYb0xXJghIWPtTlg9pNUus3N4Y1yvZiJzWP7ruFY1nPhRQ02 p4OPC56iprHOaf9DADpy7adEXxjUBySz3XTgjxC53gd01STIVqt2NqvHOMpje2VO2F5s JwaA== X-Gm-Message-State: AOAM5308Ud2FSmzD9mjDQJBQNQS9zcf1QP8wM+a/dcDE393yld9RBYPG ElY7hjkCMTwUxS3ezAuDSoeRAqF4WTyg3w== X-Google-Smtp-Source: ABdhPJwzdaVIdOZgQQgRIn5605WsBCr6WfU13mva0Y8/Hs+/Czbt+LpbG0ndGzNOxhoJR65jJJNgIQ== X-Received: by 2002:a62:4e10:0:b029:1c9:9015:dc5b with SMTP id c16-20020a624e100000b02901c99015dc5bmr17643686pfb.30.1612203266668; Mon, 01 Feb 2021 10:14:26 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id e12sm75784pjj.23.2021.02.01.10.14.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 10:14:26 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 31/31] coresight: etm4x: Handle accesses to TRCSTALLCTLR Date: Mon, 1 Feb 2021 11:13:51 -0700 Message-Id: <20210201181351.1475223-32-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210201181351.1475223-1-mathieu.poirier@linaro.org> References: <20210201181351.1475223-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210201_181429_147379_4FB10CE2 X-CRM114-Status: GOOD ( 13.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Suzuki K Poulose 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 Link: https://lore.kernel.org/r/20210127184617.3684379-1-suzuki.poulose@arm.com Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 9 ++++++--- drivers/hwtracing/coresight/coresight-etm4x-sysfs.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) 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);