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: 128354 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp686128ljc; Wed, 14 Feb 2018 06:47:32 -0800 (PST) X-Google-Smtp-Source: AH8x2260zcBlghYPlohHz6AWDFs0I1hEC7JtlDNUzVSGC6RP53U3H5bilEjtLlzaZPufTCnoAprS X-Received: by 2002:a17:902:8a89:: with SMTP id p9-v6mr4642744plo.397.1518619652657; Wed, 14 Feb 2018 06:47:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518619652; cv=none; d=google.com; s=arc-20160816; b=LzYKXKy6x+hT8ZIGwZhQBW+AqUziMTTjmkPlmfu9foia1E55s1V5lqw4NncLyBQfNY f37rtBp9SA04VcqVxKbv0BBErZ834hO0uQHagM9Ri4TyXUz4bumtTVoqOn+qUD88EhoS P5hLnl3nsLd6EcpvYPcoL1RqUiS7UD1d65mKYChNT1ZbMa31vs26CylxBfVFO0HPrVJ2 gcyvcVA4tPfjt1roW5PDc+4BkuqNkhnb/Z19rOoUhmUNXc60NvyV2dZy/VV0zoRLIPcP fcEGlHpHuVZE89/27DeZBWzpTUHTqLEogTOZAunD+O0N9q1+z/fzZSE8bnxUHIWeRQka xMWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=6GsUZzD4b92p30xF7vactajfdGzwze35pVfcUrpKsGs=; b=SG4uQP4YwbKg0y5eytEONO9MF1S8WYta43N5/bTQDzDJKowgqdjiuniDmJM72jXHiK G6PoEU3JavdRy2H2W06J+gUwtZhTkXOfxcE/onZEoKdwuuPPUaUDhxPqy3RdTpF0oQ6x ogEap5pGbGdecBFhvzoIyVIkQpuQazPpg6FQoiVOra4Z4IK2OP1FxdED2kosgb+S2VXy hkFNCLw1I0euHmbFd2V65XL68T/XrANcQBeZYmchWs0YwayMVo0Txp6l2OKyfgbC0fs2 hDgoFqwuegtsgZwnssq5smr32B5M2j/bJPX3nkgcY2G+4/z7YFtZM0pbFSaYp7UrsdRs NoCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fOhHpND3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13si1268543pfk.177.2018.02.14.06.47.32; Wed, 14 Feb 2018 06:47:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fOhHpND3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030965AbeBNOr0 (ORCPT + 28 others); Wed, 14 Feb 2018 09:47:26 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34357 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031079AbeBNOrN (ORCPT ); Wed, 14 Feb 2018 09:47:13 -0500 Received: by mail-wm0-f66.google.com with SMTP id j21so18106506wmh.1 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=suCou02dXQik3U8gZd1zz0xkIluqDI+UksNN2dHYSC142qd8/s8EHSJ1HxKeOVPIng zkmwbM2Wx4JHyXlAmTNPUXElTiA+bmtnFce8VbBmanOnmSYE2CHrDijvgNw2oaKK9PG+ r1LK32MMvKxEETcTNPGmXw7mK5W/EPjhIlvywe3rerafrzZYiABlXTnDmZ/1ZFEPmJ85 REUvLKRgj61j8xmt+hlktGchzvla2HJnt95H47kjX+0JgZfYOinXdUqWi6OaTI8zdMoF 71Kj5xp+fNGn0XK/AN+oDof52ar/1YXGVgI76YuDOlc14G0ROZ7cIOYvoyEj4SDAdxQI 5UMA== X-Gm-Message-State: APf1xPCOB3fjMTImko6mGwhEhBwAWsiEMlj//95+Tu9B5ftnvtwba2O5 r3oOB9f4ZmkzdbxnqAsfSZf9ww== 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.15.1 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; }