Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2301068imu; Thu, 29 Nov 2018 02:50:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/WfsJ1JE/dwbrxb1wIeaCk6YHIK53ynLelZprCTMdv1Z6LTRElVPjJBFI+KMHqUhPzFUzYD X-Received: by 2002:a62:4b4d:: with SMTP id y74mr894779pfa.186.1543488648343; Thu, 29 Nov 2018 02:50:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543488648; cv=none; d=google.com; s=arc-20160816; b=gDXck7UDjTCA46LYnrGc/e5XmlHfgvLYd6P92eXm1X7OnlGUFICtyh1vV4l2dIT7Wf nb3WqWi23grAssW7A81gLu6jSCpgxH5ss2vOQWaSKKAbnQQbe04/86d2Q0sgT+ph2pKc X8LQCHDQ355G8sDm6UTMd/HTkB4z0fGNTYcsqF9JN/cHZNqW21hGSaekx2lU6RocJBJo +c28TPlpfBRLcd0dBh0ywzLKBYypbrt3bzQT0QSdh4lQmY7VNha6s7hYvSCQSQDG3216 fxtCPRuBwtpn0MOf6EmrqaAQxKV3fttgRy12vOoYcmGlYF6RC7cybdU6JmwQwlyVagpn fgRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=hOvLmjOEBG3BX8ZbVDct5aYGifa/sCGyz8gan+juxlg=; b=PxOwVVfUxM0R2JOYXznz4mNpvrF9IxFYyCssTYHkCwYp6cZTKeVZX5zu/kaztriRSd Vb1gvGIxUuL2Qba3+dcWr9eliI95F8za1zYL196nIJE4oo5zLhtXBdFQCOy7XJYROkpy +LigVmXAtFLZxVYBdwNaienoYBf/sKjBTs3JoGyyHykk+wgvq/4Uz8qXSHpxm4OvvN/r cLLLjz4lYzr6BFK78XYqAT64xGXwyln271xpotJvAy5sCPt4DWeibmsaoEEjg5oNHWav GZfrRXFYOsP1efmDV5eImp8TBCW2Li1eRn3ljx/iAYQpTO7uJcNYegYZ7N3DuOiRAuBO n2GQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m1si1426075pgi.218.2018.11.29.02.50.33; Thu, 29 Nov 2018 02:50:48 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728072AbeK2Vyt (ORCPT + 99 others); Thu, 29 Nov 2018 16:54:49 -0500 Received: from mga17.intel.com ([192.55.52.151]:5769 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726926AbeK2Vys (ORCPT ); Thu, 29 Nov 2018 16:54:48 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Nov 2018 02:49:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,294,1539673200"; d="scan'208";a="95704925" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.130]) ([10.237.72.130]) by orsmga006.jf.intel.com with ESMTP; 29 Nov 2018 02:49:49 -0800 Subject: Re: [PATCH v2 1/3] mmc: sdhci: add support for using external DMA devices To: Chunyan Zhang Cc: Chunyan Zhang , Ulf Hansson , linux-mmc@vger.kernel.org, Linux Kernel Mailing List , Arnd Bergmann , Mark Brown , kishon@ti.com, nsekhar@ti.com References: <1542007566-9449-1-git-send-email-zhang.chunyan@linaro.org> <1542007566-9449-2-git-send-email-zhang.chunyan@linaro.org> <84836600-c705-9ac3-297e-bb67a611daca@intel.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Thu, 29 Nov 2018 12:48:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/11/18 11:59 AM, Chunyan Zhang wrote: > Hi Adrian, > > On Thu, 29 Nov 2018 at 15:36, Adrian Hunter wrote: >> >> On 29/11/18 8:22 AM, Chunyan Zhang wrote: >>> On Tue, 20 Nov 2018 at 21:41, Adrian Hunter wrote: >>>> >>>> On 12/11/18 9:26 AM, Chunyan Zhang wrote: >>>>> Some standard SD host controllers can support both external dma >>>>> controllers as well as ADMA/SDMA in which the SD host controller >>>>> acts as DMA master. TI's omap controller is the case as an example. >>>>> >>>>> Currently the generic SDHCI code supports ADMA/SDMA integrated in >>>>> the host controller but does not have any support for external DMA >>>>> controllers implemented using dmaengine, meaning that custom code is >>>>> needed for any systems that use an external DMA controller with SDHCI. >>>> >>>> I still think you probably need to reset the DMA if there are transfer >>>> errors - perhaps you could comment on that. Also there are some comments below. >>> >>> With regard to "transfer error", do you mean if >>> sdhci_external_dma_setup() failed? >> >> No, I mean any error interrupt that can leave the DMA uncompleted. For >> SDHCI, resetting the data circuit cleans that up, but presumably something >> is needed for external DMA? > > Yes, it should need a dmaengine_terminate_all(). > > How about adding that at here (I will wrap it up of course): > https://elixir.bootlin.com/linux/v4.19.5/source/drivers/mmc/host/sdhci.c#L2553 Yes except we really need to reverse if (host->flags & SDHCI_REQ_USE_DMA) { } if (sdhci_needs_reset(host, mrq)) { } so that we do not unmap before killing the dma Perhaps you could send that as a separate patch. > Is there somewhere else I'm missing? Testing ;-)