devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: srinivas.kandagatla@linaro.org
To: Vinod Koul <vinod.koul@intel.com>,
	Andy Gross <andy.gross@linaro.org>,
	dmaengine@vger.kernel.org
Cc: Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	David Brown <david.brown@linaro.org>,
	Dan Williams <dan.j.williams@intel.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org,
	yanhe@quicinc.com, ramkri@qti.qualcomm.com, sdharia@quicinc.com,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH 3/4] dmaengine: qcom: bam_dma: do not write to global regs in remote mode
Date: Tue, 16 Jan 2018 19:02:35 +0000	[thread overview]
Message-ID: <20180116190236.14558-4-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20180116190236.14558-1-srinivas.kandagatla@linaro.org>

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

BAM_DESC_CNT_TRSHLD register is global register, which can only be written
when BAM is in master mode, So check the mode of operation before writing it.

Without this check SOC's xPU would catch such access and crash the system.
First noticed on DB820c while testing SLIMBus BAM.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/dma/qcom/bam_dma.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index 523bd178047a..bbbb755d7549 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -905,12 +905,15 @@ static void bam_apply_new_config(struct bam_chan *bchan,
 	struct bam_device *bdev = bchan->bdev;
 	u32 maxburst;
 
-	if (dir == DMA_DEV_TO_MEM)
-		maxburst = bchan->slave.src_maxburst;
-	else
-		maxburst = bchan->slave.dst_maxburst;
-
-	writel_relaxed(maxburst, bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
+	if (!bdev->controlled_remotely) {
+		if (dir == DMA_DEV_TO_MEM)
+			maxburst = bchan->slave.src_maxburst;
+		else
+			maxburst = bchan->slave.dst_maxburst;
+
+		writel_relaxed(maxburst,
+			       bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD));
+	}
 
 	bchan->reconfigure = 0;
 }
-- 
2.15.1

  parent reply	other threads:[~2018-01-16 19:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 19:02 [PATCH 0/4] dmaengine: qcom: bam_dma: fixes for remotely controlled bam srinivas.kandagatla
2018-01-16 19:02 ` [PATCH 1/4] dmaengine: qcom: bam_dma: make bam clk optional srinivas.kandagatla
2018-01-16 19:38   ` Sagar Dharia
2018-01-17  9:46     ` Srinivas Kandagatla
2018-01-19  5:52   ` Vinod Koul
2018-01-22  9:55     ` Srinivas Kandagatla
     [not found]       ` <8dfa8ba1-6e98-a8e4-614c-592861cef571-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-01-23  9:19         ` Vinod Koul
2018-01-23  9:20           ` Srinivas Kandagatla
2018-01-16 19:02 ` srinivas.kandagatla [this message]
2018-01-16 19:02 ` [PATCH 4/4] dmaengine: qcom: bam_dma: Add num-ees dt binding for remotely controlled srinivas.kandagatla
     [not found]   ` <20180116190236.14558-5-srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-01-29 16:21     ` Rob Herring
2018-01-30  9:18       ` Srinivas Kandagatla
     [not found] ` <20180116190236.14558-1-srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-01-16 19:02   ` [PATCH 2/4] dmaengine: qcom: bam_dma: add num-channels " srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A
2018-01-19  5:55     ` Vinod Koul
2018-01-22  9:55       ` Srinivas Kandagatla
     [not found]     ` <20180116190236.14558-3-srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-01-29 16:19       ` Rob Herring
2018-01-17 10:18   ` [PATCH 0/4] dmaengine: qcom: bam_dma: fixes for remotely controlled bam Vinod Koul
2018-01-17 10:55     ` Srinivas Kandagatla
2018-01-17 15:59       ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180116190236.14558-4-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=andy.gross@linaro.org \
    --cc=dan.j.williams@intel.com \
    --cc=david.brown@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=ramkri@qti.qualcomm.com \
    --cc=robh+dt@kernel.org \
    --cc=sdharia@quicinc.com \
    --cc=vinod.koul@intel.com \
    --cc=yanhe@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).