From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Vinod Koul <vinod.koul@intel.com>,
linux-kernel@vger.kernel.org,
"'Jassi Brar'" <jassisinghbrar@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
Magnus Damm <magnus.damm@gmail.com>,
Paul Mundt <lethal@linux-sh.org>
Subject: Re: [PATCH/RFC] dmaengine: add a slave parameter to __dma_request_channel()
Date: Wed, 7 Mar 2012 16:44:12 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.64.1203071602330.19595@axis700.grange> (raw)
In-Reply-To: <20120307142634.GA18787@n2100.arm.linux.org.uk>
On Wed, 7 Mar 2012, Russell King - ARM Linux wrote:
> On Wed, Mar 07, 2012 at 02:49:25PM +0100, Guennadi Liakhovetski wrote:
> > On Wed, 7 Mar 2012, Russell King - ARM Linux wrote:
> > > What
> > > would be useful is to have a helper function along these lines:
> > >
> > > struct dma_chan *dma_request_channel_config(mask, fn, data, config)
> > > {
> > > struct dma_chan *c = dma_request_channel(mask, fn, data);
> > >
> > > if (c) {
> > > if (dmaengine_slave_config(c, config)) {
> > > dma_release_channel(c);
> > > c = NULL;
> > > }
> > > }
> > > return c;
> > > }
> >
> > Hm, yeah... That seems like an over-complication to me: to "just" allocae
> > a channel you cann dma_request_channel(), which scans your devices and
> > channels on them, calls your filter, calls the DMA controller driver's
> > allocation method, only to eventually call dmaengine_slave_config() and
> > see it fail, after which you release the channel and start anew...
>
> The point is _not_ that this uses dmaengine_slave_config() to find a
> channel at all. As I already said, there's nothing in dma_slave_config
> which _could_ be used to decide whether a channel is suitable or not.
I completely agree, that's why I wrote in my previous mail:
> > > However, I don't see anything in struct dma_slave_config which could be
> > > used to select an appropriate channel.
> >
> > That's also my problem with it, and the reason, why I suggested, that it
> > has to be embedded in a hardware-specific channel configuration type.
So, the question remains: which way should we go? If we don't come up with
a generic solution, I'd be inclined to just do something as silly as
arch/arm/mach-shmobile/board-*.c
static const struct device *group1_dma_dev[] = {
&dma0.device,
&dma1.device,
};
static const struct device *group2_dma_dev[] = {
&dma2.device,
&dma3.device,
};
static struct my_platform_data = {
.dma_dev_list = group1_dma_dev,
.dma_dev_list_num = ARRAY_SIZE(group1_dma_dev),
};
drivers/.../sh_*.c
static bool filter(struct dma_chan *chan, void *arg)
{
struct device *dev = chan->dev->device.parent;
struct my_platform_data *pdata = arg;
for (i = 0; i < pdata->dma_dev_list_num; i++)
if (pdata->dma_dev_list[i] == dev)
return true;
return false;
}
even though I find it silly to have to do this on every platform and in
every driver.
Thanks
Guennadi
> So to try to filter on the slave configuration is a pure red herring.
> None of the DMA controllers I have access to (whether they be working
> or not) could make any kind of decision about whether a particular
> channel is suitable for the peripheral by looking at the dma_slave_config
> structure - it's very much the case that the decision would be that
> 'any channel will do', which in reality it won't because there's other
> information required to make the decision about which virtual channel
> should be used. Specifically, the request signal information.
>
> Even more specifically, the request signal information may not be _just_
> the request signal on the DMA controller but also incorporate an
> external MUX like on the Realview boards (which pl08x handles itself.)
>
> I do not see any milage in trying to select a channel based on "I want
> a DMA engine to access register X, width Y, burst size Z." As far as
> I can see, the common situation is that there's nothing in that set of
> information which would be useful to chose a specific channel on a
> DMA engine.
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
next prev parent reply other threads:[~2012-03-07 15:44 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-01 15:26 [PATCH/RFC] dmaengine: add a slave parameter to __dma_request_channel() Guennadi Liakhovetski
2012-03-02 13:21 ` Guennadi Liakhovetski
2012-03-06 8:30 ` Vinod Koul
2012-03-06 8:53 ` Guennadi Liakhovetski
2012-03-06 12:08 ` Vinod Koul
2012-03-06 13:03 ` Guennadi Liakhovetski
2012-03-07 6:28 ` Vinod Koul
2012-03-07 9:18 ` Guennadi Liakhovetski
2012-03-07 9:30 ` Russell King - ARM Linux
2012-03-07 9:55 ` Linus Walleij
2012-03-07 10:02 ` Guennadi Liakhovetski
2012-03-07 10:31 ` Russell King - ARM Linux
2012-03-07 12:30 ` Guennadi Liakhovetski
2012-03-07 12:45 ` Guennadi Liakhovetski
2012-03-07 12:46 ` Russell King - ARM Linux
2012-03-07 13:49 ` Guennadi Liakhovetski
2012-03-07 14:26 ` Russell King - ARM Linux
2012-03-07 15:44 ` Guennadi Liakhovetski [this message]
2012-03-07 16:27 ` Russell King - ARM Linux
2012-03-07 18:21 ` Guennadi Liakhovetski
2012-03-08 6:30 ` Vinod Koul
2012-03-08 10:16 ` Guennadi Liakhovetski
2012-03-08 10:55 ` Vinod Koul
2012-03-08 11:22 ` Guennadi Liakhovetski
2012-03-08 11:34 ` Vinod Koul
2012-03-08 12:58 ` Vinod Koul
2012-03-08 13:18 ` Guennadi Liakhovetski
2012-03-09 9:21 ` Vinod Koul
2012-03-09 9:24 ` Guennadi Liakhovetski
2012-03-09 9:39 ` Vinod Koul
2012-03-09 12:20 ` Guennadi Liakhovetski
2012-03-09 14:07 ` Russell King - ARM Linux
2012-03-09 14:15 ` Guennadi Liakhovetski
2012-03-12 2:47 ` Vinod Koul
2012-03-12 19:47 ` Linus Walleij
2012-03-16 9:36 ` Guennadi Liakhovetski
2012-03-16 10:16 ` Linus Walleij
2012-03-16 10:31 ` Russell King - ARM Linux
2012-03-16 11:09 ` Guennadi Liakhovetski
2012-03-16 14:11 ` Linus Walleij
2012-03-16 14:28 ` Guennadi Liakhovetski
2012-03-30 5:44 ` Linus Walleij
2012-03-30 6:40 ` Guennadi Liakhovetski
2012-03-30 10:38 ` Russell King - ARM Linux
2012-04-03 20:36 ` Linus Walleij
2012-04-03 20:44 ` Linus Walleij
2012-04-12 21:33 ` Guennadi Liakhovetski
2012-04-12 23:48 ` Russell King - ARM Linux
2012-03-30 10:29 ` Russell King - ARM Linux
2012-03-30 10:40 ` Guennadi Liakhovetski
2012-03-30 10:43 ` Russell King - ARM Linux
2012-03-19 11:58 ` Vinod Koul
2012-03-30 10:25 ` Russell King - ARM Linux
2012-03-19 11:39 ` Vinod Koul
2012-03-19 11:37 ` Vinod Koul
2012-03-19 11:47 ` Guennadi Liakhovetski
2012-03-19 13:34 ` Vinod Koul
2012-03-19 13:38 ` Guennadi Liakhovetski
2012-03-19 14:00 ` Vinod Koul
2012-03-19 14:09 ` Guennadi Liakhovetski
2012-03-19 14:22 ` Vinod Koul
2012-03-19 14:45 ` Guennadi Liakhovetski
2012-03-19 16:20 ` Vinod Koul
2012-03-19 16:32 ` Guennadi Liakhovetski
2012-03-20 7:11 ` Vinod Koul
2012-03-08 11:46 ` Linus Walleij
2012-03-08 12:36 ` Guennadi Liakhovetski
2012-03-07 16:31 ` Linus Walleij
2012-03-07 16:20 ` Linus Walleij
2012-03-07 9:46 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.1203071602330.19595@axis700.grange \
--to=g.liakhovetski@gmx.de \
--cc=jassisinghbrar@gmail.com \
--cc=lethal@linux-sh.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=magnus.damm@gmail.com \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).