From patchwork Thu Feb 15 12:25:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10221063 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 D0E7A6055C for ; Thu, 15 Feb 2018 12:27:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE77427CEA for ; Thu, 15 Feb 2018 12:27:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B01B927CEE; Thu, 15 Feb 2018 12:27:42 +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 31B7227528 for ; Thu, 15 Feb 2018 12:27:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031469AbeBOM12 (ORCPT ); Thu, 15 Feb 2018 07:27:28 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35827 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031472AbeBOM1W (ORCPT ); Thu, 15 Feb 2018 07:27:22 -0500 Received: by mail-wr0-f194.google.com with SMTP id l43so3177390wrc.2 for ; Thu, 15 Feb 2018 04:27:21 -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=RSa3LU5wUBWKC8vAfFrBH1aVnlFF86oIsBtMOFIVLZw=; b=D4UJVLMHo36uQkREUXWg5shcnT3pNCptXgQcW0vwJFd/T1oRkT6YFHzaU/YCv3KPzu X6bR4fBogmy27NebYFej0zFFE4pveiu3xDQpWLrfgyIcVAxirD0wCvQI9h+jc+BMok7V 1MQVxyhfS0JU4S6JtOvwA9SG6mYdy6nlrC8E4= 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=RSa3LU5wUBWKC8vAfFrBH1aVnlFF86oIsBtMOFIVLZw=; b=f+ltc+i3P97Q27wzV38Q1d509vP3nYdSlVk6xIyrR+qPHnfcw7jOXilLHjIraa7YJH yXBbvlC1uF9wPi3qO4e29JVDcp+TmfoxIYQGT3EC3XQvWthjqxeGwSDIqvDGCcc1fcdm +wkSWfX1v2nETJR4drxCwHplzbwVDOU+QD0MoSJz47H2AjFo+avrlsje1HF7kemOcx5q hu5pveKR6WFdRN2bLG0ooy/egpJKYGikDrBIYWeHeY9JOGcm1rPgV90p/875kYZl5fFy AnOp71J85uESlPBQuxYUM282Kfu/YYV6igavoKXQsTt5A8Mb2UbqEn93HWhe8bAX4TCl nAWQ== X-Gm-Message-State: APf1xPDxYDOycoCXNscZh3GZxYd/Sncsa6IpaHSXcX47/xnPtOECV1yD NMy7KVT3lsU6pXEThEJub5QIFw== X-Google-Smtp-Source: AH8x225pCmok8Wk/i6odGKK22UDKsmsscB/Jwu+N4+l7qzdsboZhurfFcPEcAeBt4iw/ghTNE0yD3Q== X-Received: by 10.223.172.75 with SMTP id v69mr2354462wrc.269.1518697640840; Thu, 15 Feb 2018 04:27:20 -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 s9sm15632778wra.4.2018.02.15.04.27.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Feb 2018 04:27:20 -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-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-soc@vger.kernel.org, yanhe@quicinc.com, ramkri@qti.qualcomm.com, sdharia@quicinc.com, Srinivas Kandagatla Subject: [PATCH v3 4/5] dmaengine: qcom: bam_dma: do not write to global regs in remote mode Date: Thu, 15 Feb 2018 12:25:10 +0000 Message-Id: <20180215122511.13517-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180215122511.13517-1-srinivas.kandagatla@linaro.org> References: <20180215122511.13517-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 139e9f5e47a9..6919f501b9f3 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; }