From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Subject: [02/15] ARM: pxa: add dma slave map From: Arnd Bergmann Message-Id: Date: Wed, 4 Apr 2018 12:18:58 +0200 To: Robert Jarzmik Cc: Daniel Mack , Haojian Zhuang , Vinod Koul , Linux ARM , Linux Kernel Mailing List , dmaengine@vger.kernel.org List-ID: T24gVHVlLCBBcHIgMywgMjAxOCBhdCAxMDoxOSBQTSwgUm9iZXJ0IEphcnptaWsgPHJvYmVydC5q YXJ6bWlrQGZyZWUuZnI+IHdyb3RlOgo+IC4uLiBjaG9wIGNob3AgcmVtb3ZpbmcgdW5uZWVkZWQg cmVjaXBpZW50cyAuLi4uCj4KPiBBcm5kIEJlcmdtYW5uIDxhcm5kQGFybmRiLmRlPiB3cml0ZXM6 Cj4KPj4gT2ssIEkgbG9va2VkIGF0IHRoZSBkcml2ZXIgaW4gbW9yZSBkZXRhaWwgbm93IGFuZCBm b3VuZCB0aGUgc2NhcnkgcGFydHMuCj4+IFNvIGl0J3MgdXNpbmcgdGhlIGFzeW5jIERNQSBpbnRl cmZhY2UgdG8gZG8gc3luY2hyb25vdXMgRE1BIGluCj4+IGludGVycnVwdCBjb250ZXh0IGluIG9y ZGVyIHRvIHRyYW5zZmVyIHRoZSByeCBkYXRhIGZhc3RlciB0aGFuIGFuIHJlYWRzbCgpCj4+IHdv dWxkLCBjb3JyZWN0Pwo+IFRoYXQncyBjb3JyZWN0LCBhdCBsZWFzdCBmb3IgdGhlIHNtYzkxeC4K Pgo+PiBJdCBzdGlsbCBmZWVscyBvZGQgdG8gbWUgdGhhdCB0aGVyZSBpcyBhbiBlbnRyeSBpbiB0 aGUgc2xhdmUgbWFwIGZvcgo+PiBhIGRldmljZSB0aGF0IGRvZXMgbm90IGhhdmUgYSByZXF1ZXN0 IGxpbmUuIEhvd2V2ZXIsIGl0IGFsc28gc2VlbXMKPj4gdGhhdCB0aGUgZW50aX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b3NhbCAqLwo+Cj4gICAgVGhpcyBmdW5j dGlvbiB3aWxsIGZpbmQgdGhlIGZpcnN0IGF2YWlsYWJsZSBkbWEgY2hhbm5lbCwgYWxsIHJpZ2h0 LCBidXQKPiAgICBubyBmdW5jdGlvbiB3aWxsIGJlIGNhbGxlZCBpbiBweGFfZG1hIGRyaXZlciwg YW5kIHRoZXJlZm9yZSB0aGUgbGFzdAo+ICAgIHJlcXVlc3RvciBvZiB0aGUgY2hhbm5lbCB3aWxs IGJlIHVzZWQsIHdoaWNoIGlzIGJhZC4KCkNhbid0IHlvdSBqdXN0IHJlc2V0IHRob3NlIGluIHB4 YWRfZnJlZV9jaGFuX3Jlc291cmNlcygpPwoKICAgICAgIEFybmQKLS0tClRvIHVuc3Vic2NyaWJl IGZyb20gdGhpcyBsaXN0OiBzZW5kIHRoZSBsaW5lICJ1bnN1YnNjcmliZSBkbWFlbmdpbmUiIGlu CnRoZSBib2R5IG9mIGEgbWVzc2FnZSB0byBtYWpvcmRvbW9Admdlci5rZXJuZWwub3JnCk1vcmUg bWFqb3Jkb21vIGluZm8gYXQgIGh0dHA6Ly92Z2VyLmtlcm5lbC5vcmcvbWFqb3Jkb21vLWluZm8u aHRtbAo= From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751332AbeDDKTB (ORCPT ); Wed, 4 Apr 2018 06:19:01 -0400 Received: from mail-qt0-f170.google.com ([209.85.216.170]:45420 "EHLO mail-qt0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750762AbeDDKS7 (ORCPT ); Wed, 4 Apr 2018 06:18:59 -0400 X-Google-Smtp-Source: AIpwx48aeLwNXxkXEQ/mp44Lb8pg89Ywy2gUsT3EEVmU9Kd5TQLpH5+xbjWNLDVY+VVXPPfzABFBfMiFS5PcAsPR7jA= MIME-Version: 1.0 In-Reply-To: <87h8os3uwa.fsf@belgarion.home> References: <20180402142656.26815-1-robert.jarzmik@free.fr> <20180402142656.26815-3-robert.jarzmik@free.fr> <87tvss48ti.fsf@belgarion.home> <87h8os3uwa.fsf@belgarion.home> From: Arnd Bergmann Date: Wed, 4 Apr 2018 12:18:58 +0200 X-Google-Sender-Auth: -q4F-n0cowmTZLbpexKXzNW60hI Message-ID: Subject: Re: [PATCH 02/15] ARM: pxa: add dma slave map To: Robert Jarzmik Cc: Daniel Mack , Haojian Zhuang , Vinod Koul , Linux ARM , Linux Kernel Mailing List , dmaengine@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 3, 2018 at 10:19 PM, Robert Jarzmik wrote: > ... chop chop removing unneeded recipients .... > > Arnd Bergmann writes: > >> Ok, I looked at the driver in more detail now and found the scary parts. >> So it's using the async DMA interface to do synchronous DMA in >> interrupt context in order to transfer the rx data faster than an readsl() >> would, correct? > That's correct, at least for the smc91x. > >> It still feels odd to me that there is an entry in the slave map for >> a device that does not have a request line. However, it also seems >> that the entire code in those two drivers that deals with DMA is specific >> to PXA anyway, so maybe it can be done differently: instead of >> calling dma_request_slave_channel_compat() or dma_request_chan() >> with a fake request line, how about calling dma_request_channel() >> with an NULL filter function and data, and have the driver handle >> the empty data case the same way as the rq=-1 case today? > Okay, in this case : > - the channel priority cannot be passed anymore Right, but it could just always use a static priority, right? > - and I don't see how this can work : > dma_request_channel() > __dma_request_channel() > find_candidate() > private_candidate(mask, device, fn, fn_param); > /* Here, fn == NULL and fn_param == NULL as per your proposal */ > > This function will find the first available dma channel, all right, but > no function will be called in pxa_dma driver, and therefore the last > requestor of the channel will be used, which is bad. Can't you just reset those in pxad_free_chan_resources()? Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Wed, 4 Apr 2018 12:18:58 +0200 Subject: [PATCH 02/15] ARM: pxa: add dma slave map In-Reply-To: <87h8os3uwa.fsf@belgarion.home> References: <20180402142656.26815-1-robert.jarzmik@free.fr> <20180402142656.26815-3-robert.jarzmik@free.fr> <87tvss48ti.fsf@belgarion.home> <87h8os3uwa.fsf@belgarion.home> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tue, Apr 3, 2018 at 10:19 PM, Robert Jarzmik wrote: > ... chop chop removing unneeded recipients .... > > Arnd Bergmann writes: > >> Ok, I looked at the driver in more detail now and found the scary parts. >> So it's using the async DMA interface to do synchronous DMA in >> interrupt context in order to transfer the rx data faster than an readsl() >> would, correct? > That's correct, at least for the smc91x. > >> It still feels odd to me that there is an entry in the slave map for >> a device that does not have a request line. However, it also seems >> that the entire code in those two drivers that deals with DMA is specific >> to PXA anyway, so maybe it can be done differently: instead of >> calling dma_request_slave_channel_compat() or dma_request_chan() >> with a fake request line, how about calling dma_request_channel() >> with an NULL filter function and data, and have the driver handle >> the empty data case the same way as the rq=-1 case today? > Okay, in this case : > - the channel priority cannot be passed anymore Right, but it could just always use a static priority, right? > - and I don't see how this can work : > dma_request_channel() > __dma_request_channel() > find_candidate() > private_candidate(mask, device, fn, fn_param); > /* Here, fn == NULL and fn_param == NULL as per your proposal */ > > This function will find the first available dma channel, all right, but > no function will be called in pxa_dma driver, and therefore the last > requestor of the channel will be used, which is bad. Can't you just reset those in pxad_free_chan_resources()? Arnd