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: 124763 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp1116990lje; Tue, 16 Jan 2018 11:07:51 -0800 (PST) X-Google-Smtp-Source: ACJfBou3oh18Sfk6aPQ5faq9uWL/miV4PDQ6QRSDcV9ctCx9TssRf2cfOIx5zRBRZvgw9RWaMM9P X-Received: by 10.99.4.216 with SMTP id 207mr14319712pge.45.1516129670846; Tue, 16 Jan 2018 11:07:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516129670; cv=none; d=google.com; s=arc-20160816; b=yLu+w4dbuAX5T4HZT1blxLTLWE2Z0YfNgoz+sI91pbjebaOZqVa/fUFLWlqKWO164x CfXyqA9cTdh1sReYnCf+CBD0O4uLUAv02mtGBuASwY7DibQcjFEoNjpC9XraeQ17I4TU RQmPCxl5g+4T/rjT50N0WWsJyhYSXV3haARi3JYBVGH6CNX0xVR7pQqxnqrFs4/uQPSz gR/T4Evq/MGhxXz9j3qOEzMntrX6E3EiKTTrDz6pIlpiNc9L73GGdkLX2Zm5vTAj7VMH U2+qef3Q6xAqCdXVMPsDV/eiSANfcTbKEeM2PNNdTpL78JScpLnhbGLZHWxX+0ETxlLG qLIw== 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=U2Ib53ILHvF3Gp9yf1DUyZeX7jIgnxIeeeYQLRcMK+g=; b=QcOH2LTJROcFkTZAPbtfXo+aS+PWeUsIihw54UJ495O8NMESKGXqPeJChyxibwBYTf F+QCQ6aDagbVdb1QOtKGBb0YkyF3yHzVLkr5xoDBoSLTqVd9FQJGEDLuc8BclSuSeWj0 aVG82XgzC9NTsrBIQPxP4SawvAqEy33K7t6d4Hom9eH0u7DLWLYd+bYpv5lVMS7XKlzv JC2NtDJCSoiFAjPJEjXoxY2ardaoHZ3y9DiOsYCrrJtwDHXkvU0gBevFrJggz7YUrdTB 7cJwqJASjsZ+h8JUMT79DZblB1SMANTErNk1cwdI0zcQBO8EDyoQpIXM1KsEZQ6JQkit Wf3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jAKKn+n7; 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 l59si2380971plb.743.2018.01.16.11.07.50; Tue, 16 Jan 2018 11:07:50 -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=jAKKn+n7; 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 S1751918AbeAPTHt (ORCPT + 28 others); Tue, 16 Jan 2018 14:07:49 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:39650 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751590AbeAPTHC (ORCPT ); Tue, 16 Jan 2018 14:07:02 -0500 Received: by mail-wm0-f65.google.com with SMTP id i11so10718605wmf.4 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=YAGIhslwWyTUwSQ+tQYRvd8MC1pvqKoV6rwUFTvZ/f1H6SAtn3AsQXEVoBfKrbLew9 99VN0mBRCnbXVqmf/S+StB7uRHU0PLAfELQiYWOPpFLpDWyru8ITEFIQIiDuRnoyIFcV LylibVZdxE5EkVvAWMVwqxW5Dvqc9gVz4j16TJIRkdoJzDAMuWUTitHp4fCu7ElyQORd CSzMESUl1YJQQr2xXLJeMC+7DIcH6RGOd/HMn7jv0BeSF+uEWzyyNb35M9k1u0FANR5g dPskZPUh0ARMrefM1tL15CMCnPiR5ens8UkpDWfMuDN+cn8dLG3ggyvoix6rhYztVBTe K4DA== X-Gm-Message-State: AKwxytcEm3fIjBDDswb9zpQCqebA5uGVgEMqORgWruBt4fc4sHK/2pV+ 9xmhJSzrlyQ5Y2HBN2PMmT84aQ== 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: 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 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.15.1 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; }