From patchwork Wed Oct 8 11:25:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 5053331 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2BF189F30B for ; Wed, 8 Oct 2014 11:25:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 361F4201FA for ; Wed, 8 Oct 2014 11:25:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13C282015E for ; Wed, 8 Oct 2014 11:25:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755767AbaJHLZ2 (ORCPT ); Wed, 8 Oct 2014 07:25:28 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:61269 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755586AbaJHLZZ (ORCPT ); Wed, 8 Oct 2014 07:25:25 -0400 Received: by mail-wg0-f45.google.com with SMTP id m15so11522444wgh.16 for ; Wed, 08 Oct 2014 04:25:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=89bQ75JEs02fO0AOd+7mRGGSGyMIb46biDAC2Rhh3LY=; b=RJKYx5tEkrTam5pZTL/3M8ZVRlZabWuzzpWckZZf5fkSaPzQf4gGmhTbmzL/WNnSsa 7k1q0jmLobJfsO6Mkcll8xgYneGmeJ6JeBtF7Cs0+x/qUt7EjUePgt8fMI8GOz8UOBuh sMG6NhS+YsR5RPuJKOopbzoiFx7MBAn3XzKcVo0lKhGeHEaL9EDE9HEdt5vmqoVUNYUy S37PXSK3Ch0FlaZbHmvQZSDqX4ChSBWdTxyvzavF9gn758ydOg65PeHgv03ITVOvA18h LUZ18ytMp1Cu2rtSjvYbyfUp8p4LOijLL3UJbuF5G4fKn9PY01ZMkR7AV21APf2mxRdn 3Zlw== X-Gm-Message-State: ALoCoQkVqi8+GhtfmztkcdaIaJBK4F5+mTJW6Fzxm5U5f5u7jsxTg40+twDKKyucr0fsPAvNjNts X-Received: by 10.194.110.104 with SMTP id hz8mr11432819wjb.12.1412767523476; Wed, 08 Oct 2014 04:25:23 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-78-149-2-97.as13285.net. [78.149.2.97]) by mx.google.com with ESMTPSA id v9sm24238690wjy.14.2014.10.08.04.25.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Oct 2014 04:25:22 -0700 (PDT) From: Srinivas Kandagatla To: linux-mmc@vger.kernel.org Cc: Chris Ball , Ulf Hansson , Russell King , linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [RFC PATCH 2/2] mmc: mmci: fix mmci_post_request Date: Wed, 8 Oct 2014 12:25:17 +0100 Message-Id: <1412767517-6784-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1412767415-6624-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1412767415-6624-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 If the post request is cancelling the channel and descriptor and which are equal to host->dma_current and host->dma_desc_current respectively, then it makes sense to reset these pointers to NULL, so that the driver does not reference it. Also the host_cookie can be reset to 0 in cases of error, so that the core could reissue the same mmc_request. This patch was tested with 'mmc: core: fix prepared requests while doing bkops' to fix the below issue. mmci-pl18x 12400000.sdcc: error during DMA transfer! Unable to handle kernel paging request at virtual address 40000000 pgd = c0204000 [40000000] *pgd=00000000 Internal error: Oops: 805 [#1] SMP ARM Modules linked in: ipv6 ath6kl_sdio ath6kl_core CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 3.17.0-rc7-linaro-multi-v7 #1 task: c0c9d7e0 ti: c0c92000 task.ti: c0c92000 PC is at v7_dma_inv_range+0x34/0x4c LR is at __dma_page_dev_to_cpu+0x80/0x100 pc : [] lr : [] psr: 400f0193 sp : c0c93e20 ip : c0c9a478 fp : c08ea538 r10: c0c9f548 r9 : 00000002 r8 : e97d9000 r7 : 00000200 r6 : c0c9d504 r5 : c0db0880 r4 : 00000000 r3 : 0000003f r2 : 00000040 r1 : 40000200 r0 : 40000000 Flags: nZcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 10c5787d Table: a9ef406a DAC: 00000015 Process swapper/0 (pid: 0, stack limit = 0xc0c92250) Stack: (0xc0c93e20 to 0xc0c94000) 3e20: c021f058 e9a17178 e9a171bc e99dfd6c 00000001 00000001 e995de10 00000002 3e40: 00000000 c021b574 00000000 c04bc4a4 00000000 e9b49ac0 c0ce6e6c e99dfda4 3e60: 00000088 e9810780 c0d8291c c072ea58 00000000 c072d3fc 00000000 c072f534 3e80: 00000000 e9b49ac0 00000100 c0c9a444 00000088 c072f6b4 c072f5d4 e9d40080 3ea0: e98107dc 00000000 00000000 c0280a60 00000000 7d55bf61 e9810780 e98107dc 3ec0: 00000000 f0002000 c0d460e8 c0d460e8 c0c92000 c0280b60 e9810780 c0ce7190 3ee0: 00000000 c028369c c02835f4 00000088 00000088 c0280278 c0c8ec70 c020f080 3f00: f000200c c0c9a958 c0c93f28 c02088e4 c04bd630 c04bd5bc 200f0013 ffffffff 3f20: c0c93f5c c0212800 00000001 a987c000 c0c93f3c c04bd574 00000000 0000015b 3f40: ea7a0e40 00000000 c0d460e8 c0d460e8 c0c92000 c08ea538 29b12000 c0c93f70 3f60: c04bd630 c04bd5bc 200f0013 ffffffff c04bd574 c071bd24 7d50c9b4 c0719a44 3f80: 7d50c9b4 0000015b c0c9a498 c0c92028 c0c9a498 c0c9a4fc ea7a0e40 c0c8ee38 3fa0: c0d460e8 c0276198 00000000 c0d8291a 00000000 c0c9a400 00000000 c0be0bc4 3fc0: ffffffff ffffffff c0be05f8 00000000 00000000 c0c533d8 c0d82ed4 c0c9a47c 3fe0: c0c533d4 c0c9e870 8020406a 511f06f0 00000000 80208074 00000000 00000000 [] (v7_dma_inv_range) from [] (__dma_page_dev_to_cpu+0x80/0x100) [] (__dma_page_dev_to_cpu) from [] (arm_dma_unmap_sg+0x5c/0x84) [] (arm_dma_unmap_sg) from [] (mmci_dma_unmap.isra.16+0x60/0x74) [] (mmci_dma_unmap.isra.16) from [] (mmci_data_irq+0x1fc/0x29c) [] (mmci_data_irq) from [] (mmci_irq+0xe0/0x114) [] (mmci_irq) from [] (handle_irq_event_percpu+0x78/0x134) [] (handle_irq_event_percpu) from [] (handle_irq_event+0x44/0x64) [] (handle_irq_event) from [] (handle_fasteoi_irq+0xa8/0x1a8) [] (handle_fasteoi_irq) from [] (generic_handle_irq+0x2c/0x3c) [] (generic_handle_irq) from [] (handle_IRQ+0x40/0x90) [] (handle_IRQ) from [] (gic_handle_irq+0x38/0x68) [] (gic_handle_irq) from [] (__irq_svc+0x40/0x54) Exception stack(0xc0c93f28 to 0xc0c93f70) 3f20: 00000001 a987c000 c0c93f3c c04bd574 00000000 0000015b 3f40: ea7a0e40 00000000 c0d460e8 c0d460e8 c0c92000 c08ea538 29b12000 c0c93f70 3f60: c04bd630 c04bd5bc 200f0013 ffffffff [] (__irq_svc) from [] (msm_cpu_pm_enter_sleep+0x48/0x4c) [] (msm_cpu_pm_enter_sleep) from [] (qcom_lpm_enter_spc+0x20/0x2c) [] (qcom_lpm_enter_spc) from [] (cpuidle_enter_state+0x44/0xf0) [] (cpuidle_enter_state) from [] (cpu_startup_entry+0x1f4/0x238) [] (cpu_startup_entry) from [] (start_kernel+0x384/0x390) Code: 1e070f3e e1110003 e1c11003 1e071f3e (ee070f36) ---[ end trace cf6cb3f6432c9834 ]--- Kernel panic - not syncing: Fatal exception in interrup Signed-off-by: Srinivas Kandagatla --- drivers/mmc/host/mmci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 264c947..84f4a91 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -741,8 +741,15 @@ static void mmci_post_request(struct mmc_host *mmc, struct mmc_request *mrq, chan = host->dma_tx_channel; dmaengine_terminate_all(chan); + if (host->dma_desc_current == next->dma_desc) + host->dma_desc_current = NULL; + + if (host->dma_current == next->dma_chan) + host->dma_current = NULL; + next->dma_desc = NULL; next->dma_chan = NULL; + data->host_cookie = 0; } }