From patchwork Tue Jan 16 19:02:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10167977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 18109603B5 for ; Tue, 16 Jan 2018 19:07:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0309C2094F for ; Tue, 16 Jan 2018 19:07:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB87721BED; Tue, 16 Jan 2018 19:07:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71A4C2094F for ; Tue, 16 Jan 2018 19:07:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751652AbeAPTHs (ORCPT ); Tue, 16 Jan 2018 14:07:48 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36560 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751594AbeAPTHC (ORCPT ); Tue, 16 Jan 2018 14:07:02 -0500 Received: by mail-wm0-f67.google.com with SMTP id f3so10839241wmc.1 for ; Tue, 16 Jan 2018 11:07:02 -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; bh=U2Ib53ILHvF3Gp9yf1DUyZeX7jIgnxIeeeYQLRcMK+g=; b=jAKKn+n725E286mq583rUYqXsTbOsgDOTUbgnLMEaExRNKsEPZiAldzV9PMIrDr9HK HgoqGQd27vZpYGsI/XcTmfbAjlYQ0E4zy6tB0HrMZ2YtoNFsbi1R/YiP/qNmqGRovt38 JetSH5DRY6xqD6eO61YqF2hqDAwLjXNi1Uq8Q= 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; bh=U2Ib53ILHvF3Gp9yf1DUyZeX7jIgnxIeeeYQLRcMK+g=; b=lToxn4u6LmHdbVKn5yjmnGp7UmFVNK3VV+Eh0WR5hKADp8qqxO95vg4qq1jvtAce02 YMF1LLf2+xF3537kRYJveMHTD2mhtTUjL+1mKFokv0IaxWp+umYHM3A71ejApz2yoLgc CMyyDr4gnOwo/gX5aJMPffcUS0aPjs0RQxTOgXjubI6Zu0j7LKqxzFcnV0xV0bV/AiDV vYf0NkXg5fbxVr4GK6agCM016H5nnAvz9gtLiCmGqHFiDGzHtGaZp/fbTR5B5aXv0+VD zzGpZDCxDixNxQxZ13gLQh+dbf21S371xOFtajhtSLCoaEKOgR7hQ/Ha6xfkV02asK9u E7qA== X-Gm-Message-State: AKwxytfJ9D0tn8oRxe31jGqUOV7AfS5uUCBC+7o6Ykfj7Z5GvCKtaDD2 /jMzRq/rlQ3hWED1sELTb3wI2Q== X-Google-Smtp-Source: ACJfBou04hu7h4gj3UZ51r02U3gaAkEEafxIjvspBFltNLKCfI28bnlRWfIHxe3QobV7Sb6+OE/GdA== X-Received: by 10.28.169.76 with SMTP id s73mr97512wme.122.1516129621397; Tue, 16 Jan 2018 11:07:01 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id 198sm3257074wmo.21.2018.01.16.11.07.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jan 2018 11:07:00 -0800 (PST) From: srinivas.kandagatla@linaro.org To: Vinod Koul , Andy Gross , dmaengine@vger.kernel.org Cc: Rob Herring , Mark Rutland , David Brown , Dan Williams , 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 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 Message-Id: <20180116190236.14558-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180116190236.14558-1-srinivas.kandagatla@linaro.org> References: <20180116190236.14558-1-srinivas.kandagatla@linaro.org> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Srinivas Kandagatla 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 --- 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; }