From patchwork Wed Feb 14 14:44:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10219173 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 DC417601C2 for ; Wed, 14 Feb 2018 14:48:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDA3B28ED0 for ; Wed, 14 Feb 2018 14:48:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C14B328FDF; Wed, 14 Feb 2018 14:48:02 +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 621E628ED0 for ; Wed, 14 Feb 2018 14:48:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030943AbeBNOrY (ORCPT ); Wed, 14 Feb 2018 09:47:24 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33607 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031083AbeBNOrN (ORCPT ); Wed, 14 Feb 2018 09:47:13 -0500 Received: by mail-wm0-f66.google.com with SMTP id x4so18079654wmc.0 for ; Wed, 14 Feb 2018 06:47:13 -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=6GsUZzD4b92p30xF7vactajfdGzwze35pVfcUrpKsGs=; b=fOhHpND3b1uLSZgz/Dc1oyTYLRqK0uczG621YriwbhOYiwXhX2BZ+Xrz1a68pdNqCM 420XQVyBrTz76xQkzZPf7Q7xDxlyTwhhdpzg+LEL6TnYjUPsKCAeOji8yZIrEAbjHtmu xGgf4YXi8p9vUcK9JquS8hooy9QwrSqWmbP2I= 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=6GsUZzD4b92p30xF7vactajfdGzwze35pVfcUrpKsGs=; b=mDSX0PCNw+LNI56bGMbftb7vlSSTy706C2SebV+9yMWjCL2U7j3nBldDvoafy9jkqb 908eWw2mt/POHDntLyEvPd27HVLVNdW7S53y0v4mK9+5HE91E6zbei/H9oge6OI9CCzu QCHTgtbsLPNOJ1F1EymGVxd+HDENIYT/nTnM5SFEWilZLGfBLQG/jzQs7Nn9oDatUlC5 zLtC9rUN2r2CLKui8qN0AoGFqk5+t5bOwLlLdCE/BAoHY4xjU648EISdMGZ6fBw+nQFI L8Ae2qJ+/pAY19IU7fDsdcspNtYu4xZizz3NAZ/NUqI9n0HPJcR5yzjbcuGyw0avK+FD GywA== X-Gm-Message-State: APf1xPCzBCKbpTvaYWnR88OYwbbNoFCd6l6cd+LKT+4t7olypE6ulAJh omnKqHaHE2q8sXCh6U9/AuUVIw== X-Google-Smtp-Source: AH8x224HNQL1ELZqipy8mvXcyykq8GCuZFkm9ALVyoWyKniDKs3uZgLSmQ/pdoh107prYTI3ox+Hsg== X-Received: by 10.28.148.214 with SMTP id w205mr4367780wmd.67.1518619632667; Wed, 14 Feb 2018 06:47:12 -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 u20sm7675965wrg.13.2018.02.14.06.47.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Feb 2018 06:47:12 -0800 (PST) From: srinivas.kandagatla@linaro.org To: vinod.koul@intel.com, andy.gross@linaro.org, dmaengine@vger.kernel.org Cc: robh+dt@kernel.org, mark.rutland@arm.com, david.brown@linaro.org, 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 Subject: [PATCH v2 4/5] dmaengine: qcom: bam_dma: do not write to global regs in remote mode Date: Wed, 14 Feb 2018 14:44:58 +0000 Message-Id: <20180214144459.29813-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180214144459.29813-1-srinivas.kandagatla@linaro.org> References: <20180214144459.29813-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 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index 146b5d03256f..88ec515ad125 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -935,12 +935,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; + 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)); + writel_relaxed(maxburst, + bam_addr(bdev, 0, BAM_DESC_CNT_TRSHLD)); + } bchan->reconfigure = 0; }