From patchwork Tue Jul 14 00:28:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 6782871 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D81919F2E8 for ; Tue, 14 Jul 2015 00:22:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EE417206BC for ; Tue, 14 Jul 2015 00:22:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0CCFE206B7 for ; Tue, 14 Jul 2015 00:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752024AbbGNAWh (ORCPT ); Mon, 13 Jul 2015 20:22:37 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:33549 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751556AbbGNAWh (ORCPT ); Mon, 13 Jul 2015 20:22:37 -0400 Received: by padck2 with SMTP id ck2so50796330pad.0 for ; Mon, 13 Jul 2015 17:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=2AflTyJmbToRRfSJZL4GPjkxXhzcwgZuKVB9KnwxoMg=; b=VH3ONszrEVDm5816CeUGjhWv7+eIoTOQMPvtLwox2nh+BbYyqy75AqXuP5dxddnoPO jjTkvaBZDFhKtfTGZGg5sd0CvODLQ9MLOQ60ZFk//qxoLx+BAAWzr46SfpD4AvqFSnlW P+ljDafbRp/Ig8FLga73iKgs6zCWhN0Tf9JSIicX5wFgmbFwq7CBpTgm1Fr+Vn6SK5HZ V+Sd13TNnYAyp3BfNhRNvIny+EU8+CR8EaVpZS1EOIKkNHx2enEKXhc6kBBY6YXFYAME QdgSLbMe/VQ65Lgsx9doYaAs29tRs6k64PqK+j19xcs4EICuvaD2g0fq+B0VWM6d0RpH 2TiA== X-Received: by 10.68.68.235 with SMTP id z11mr3840075pbt.126.1436833356857; Mon, 13 Jul 2015 17:22:36 -0700 (PDT) Received: from ip-172-31-29-47.ap-northeast-1.compute.internal (ec2-54-65-106-64.ap-northeast-1.compute.amazonaws.com. [54.65.106.64]) by smtp.gmail.com with ESMTPSA id g10sm20181768pat.35.2015.07.13.17.22.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jul 2015 17:22:35 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: dmaengine@vger.kernel.org, vinod.koul@intel.com Cc: linux-arm-kernel@lists.infradead.org, workgroup.linux@csr.com, Yanchang Li , Barry Song Subject: [PATCH] dmaengine: sirf: fix kernel panic under one race condition Date: Tue, 14 Jul 2015 00:28:25 +0000 Message-Id: <1436833705-6550-1-git-send-email-21cnbao@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Yanchang Li If DMA interrupt comes and is latched by IRQ controller during the execution of dma_terminate_all(), dma_irq routine will be executed after dma terminated, and it will cause kernel panic. We clear DMA interrupts in dma_terminate_all() to avoid this useless interrupt. Signed-off-by: Yanchang Li Signed-off-by: Barry Song --- drivers/dma/sirf-dma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c index 8c5186c..7d5598d 100644 --- a/drivers/dma/sirf-dma.c +++ b/drivers/dma/sirf-dma.c @@ -455,6 +455,7 @@ static int sirfsoc_dma_terminate_all(struct dma_chan *chan) switch (sdma->type) { case SIRFSOC_DMA_VER_A7V1: writel_relaxed(1 << cid, sdma->base + SIRFSOC_DMA_INT_EN_CLR); + writel_relaxed(1 << cid, sdma->base + SIRFSOC_DMA_CH_INT); writel_relaxed((1 << cid) | 1 << (cid + 16), sdma->base + SIRFSOC_DMA_CH_LOOP_CTRL_CLR_ATLAS7); @@ -462,6 +463,8 @@ static int sirfsoc_dma_terminate_all(struct dma_chan *chan) break; case SIRFSOC_DMA_VER_A7V2: writel_relaxed(0, sdma->base + SIRFSOC_DMA_INT_EN_ATLAS7); + writel_relaxed(SIRFSOC_DMA_INT_ALL_ATLAS7, + sdma->base + SIRFSOC_DMA_INT_ATLAS7); writel_relaxed(0, sdma->base + SIRFSOC_DMA_LOOP_CTRL_ATLAS7); writel_relaxed(0, sdma->base + SIRFSOC_DMA_VALID_ATLAS7); break;