mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Koul, Vinod" <vinod.koul@intel.com>
To: Jaswinder Singh <jaswinder.singh@linaro.org>
Cc: "Williams, Dan J" <dan.j.williams@intel.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-kernel@vger.kernel.org, rmk+kernel@arm.linux.org.uk,
	linus.walleij@stericsson.com, per.friden@stericsson.com,
	wei.zhang@freescale.com, ebony.zhu@freescale.com,
	iws@ovro.caltech.edu, s.hauer@pengutronix.de,
	maciej.sosnowski@intel.com, saeed@marvell.com,
	shawn.guo@freescale.com, yur@emcraft.com, agust@denx.de,
	iwamatsu.nobuhiro@renesas.com, per.forlin@stericsson.com,
	jonas.aberg@stericsson.com, anemo@mba.ocn.ne.jp
Subject: Re: [PATCHv2] DMAEngine: Let dmac drivers to set chan_id
Date: Wed, 27 Jul 2011 14:32:26 +0530	[thread overview]
Message-ID: <1311757347.1536.103.camel@vkoul-udesk3> (raw)
In-Reply-To: <CAJe_ZhfaPfobs5P+q+t-kRSK4fAvm-v_brYgqmco8fwOOBeT8A@mail.gmail.com>

On Wed, 2011-07-27 at 12:47 +0530, Jaswinder Singh wrote:
> On 27 July 2011 09:51, Koul, Vinod <vinod.koul@intel.com> wrote:
> > On Tue, 2011-07-26 at 23:42 +0530, Jaswinder Singh wrote:
> >> On 26 July 2011 20:59, Williams, Dan J <dan.j.williams@intel.com> wrote:
> >> > On Tue, Jul 26, 2011 at 7:30 AM, Jaswinder Singh
> >> > <jaswinder.singh@linaro.org> wrote:
> >> >> On 26 July 2011 01:38, Williams, Dan J <dan.j.williams@intel.com> wrote:
> >> >>> Correct, it is meant that chan_id is only a sysfs property.  Any
> >> >>> driver usage that is assuming chan_id is anything more than a
> >> >>> guaranteed unique number within a given dma_device's list of channels
> >> >>> is probably inferring too much.
> >> >>
> >> >> So you mean dmac/client drivers are wrong if they make use of chan_id.
> >> >> They shouldn't count upon it's value - which is set by DMA API for a completely
> >> >> independent purpose, i.e, creating contiguous sysfs entries.
> >> >
> >> > They can count on it being unique, and maybe the fact that it is in
> >> > the same order as dma_device.channels.
> >> The latter implies the former. And it is already the dmac driver that
> >> decides the
> >> rank of a channel in the list.
> >>
> >> >
> >> >>
> >> >> Since "chan_id is only a sysfs property" and the fact that it is used
> >> >> only _once_
> >> >> by the DMA API
> >> >>
> >> >> In drivers/dma/dmaengine.c
> >> >>
> >> >>      chan->chan_id = chancnt++;
> >> >>      dev_set_name(&chan->dev->device, "dma%dchan%d",
> >> >>                             device->dev_id, chan->chan_id);
> >> >>
> >> >>
> >> >> Can't we do away with chan_id altogether ? by having
> >> >>
> >> >>      dev_set_name(&chan->dev->device, "dma%dchan%d",
> >> >>                             device->dev_id, chancnt++);
> >> >>
> >> >> I mean why make every instance of dma_chan bigger by 4bytes ?
> >> >>
> >> >> So why shouldn't we remove chan_id completely from the DMA API ?
> >> >
> >> > Good point...  Let's remove chan_id from the core and push it into the
> >> > drivers that need it.
> >> >
> >> If you agree, I would preserve the chan_id in 'struct dma_chan' but remove
> >> any assignment to it in dmaengine.c  and let the dmac drivers use it freely.
> >> That would:-
> >> a) Let dmac drivers decide what numbers they want to show up in sysfs.
> >> b) chan_id is easily reachable by client drivers, so it is better this way.
> >> c) It would mean lesser and simpler changes to extant users of it.
> > But this can cause conflict between two controllers who think they are
> > assigning unique numbers.
> Could you please clarify, which two controllers ?
You can have two different DMACs in same system. At least I have two
from current intel_mid_dma which are used. Both give their channel id
starting from 0, 1....
Further as we integrate video, audio, spi, emmc dmacs possibility of
having multiple dmacs will increase in a system
> 
> > IMO sysfs representation needs to be with
> > dmaengine only. How do we guarantee uniqueness b/w two controllers?
> Again, how is chan_id currently unique between two controllers ?
> 
> Btw, do you not want to keep chan_id in dma_chan or do you not want to change
> anything at all ?
> 
> >
> > Also I am not sure about the approach: The whole point is to make filter
> > function select based on some channel number "x", but you should filter
> > channels based on controller you want and capability of a channel. If
> > caps is not enough to filter we should add more flags but asking that I
> > need channel 'y' doesn't sound right to me.
> > This is all coming from that fact that some drivers assume channel 'a'
> > is for this type of transfer and channel 'b' for something else, for a
> > dma controller that really doesn't matter, as all channels have similar
> > capabilities and can do similar things so you should
> > _get_channel_based_on_caps rather than on some numbering.
> >
> > Lastly, why do you need a channel reserved for some type of transfer, is
> > it for assigning h/w interface for dma transfer, if so that can be
> > achieved in different ways as well
> 
> Please look at this patch from POV of utility of chan_id, which isn't much
> currently as explainined.
Sorry I didn't get you. 
As I understand you are trying to simplify the filter function by
assigning unique ids to all channels, but whole point itself is not
quite right, as I said selection should be based on capability and not
channel number "x". 
Can you please help me understand why channel number "x" is important
and strictly needed by some client?

-- 
~Vinod


  reply	other threads:[~2011-07-27  9:45 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20 18:18 [PATCH] DMAEngine: Let dmac drivers " Jassi Brar
2011-07-21  4:01 ` [PATCHv2] DMAEngine: Let dmac drivers to " Jassi Brar
2011-07-22 15:27   ` Linus Walleij
2011-07-22 17:43     ` Jaswinder Singh
2011-07-22 22:23       ` Williams, Dan J
2011-07-23  3:56         ` Jaswinder Singh
2011-07-25 18:55           ` Williams, Dan J
2011-07-25 19:17             ` Jaswinder Singh
2011-07-25 20:08               ` Williams, Dan J
2011-07-26 14:30                 ` Jaswinder Singh
2011-07-26 15:29                   ` Williams, Dan J
2011-07-26 18:12                     ` Jaswinder Singh
2011-07-27  4:21                       ` Koul, Vinod
2011-07-27  7:17                         ` Jaswinder Singh
2011-07-27  9:02                           ` Koul, Vinod [this message]
2011-07-27  9:59                             ` Mika Westerberg
2011-07-27  9:34                               ` Koul, Vinod
2011-07-27 10:36                                 ` Mika Westerberg
2011-07-27 14:50                               ` Jaswinder Singh
2011-07-27 16:36                                 ` Williams, Dan J
2011-07-27 17:14                                   ` Jaswinder Singh
2011-07-27 20:28                                     ` Russell King
2011-07-28 10:44                                       ` Jaswinder Singh
2011-07-28 22:27                                         ` Linus Walleij
2011-07-28 22:43                                           ` Russell King
2011-07-29 12:20                                             ` Linus Walleij
2011-07-29 11:54                                           ` Koul, Vinod
2011-07-28 22:35                                         ` Russell King
2011-07-29 14:11                                           ` Jaswinder Singh
2011-07-27 14:30                             ` Jaswinder Singh
2011-07-27 20:37                               ` Russell King
2011-07-28 10:56                                 ` Jaswinder Singh
2011-07-28 13:44                                   ` Russell King
2011-07-28 17:54                                 ` Jaswinder Singh
2011-07-28 18:14                                   ` Williams, Dan J
2011-07-28 18:25                                     ` Jaswinder Singh
2011-07-28 22:40                                   ` Russell King
2011-07-30 13:09                                     ` Jaswinder Singh
2011-07-30 14:22                                       ` Russell King
2011-07-30 15:00                                         ` Jaswinder Singh

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=1311757347.1536.103.camel@vkoul-udesk3 \
    --to=vinod.koul@intel.com \
    --cc=agust@denx.de \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=dan.j.williams@intel.com \
    --cc=ebony.zhu@freescale.com \
    --cc=iwamatsu.nobuhiro@renesas.com \
    --cc=iws@ovro.caltech.edu \
    --cc=jaswinder.singh@linaro.org \
    --cc=jonas.aberg@stericsson.com \
    --cc=linus.walleij@linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.sosnowski@intel.com \
    --cc=per.forlin@stericsson.com \
    --cc=per.friden@stericsson.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=s.hauer@pengutronix.de \
    --cc=saeed@marvell.com \
    --cc=shawn.guo@freescale.com \
    --cc=wei.zhang@freescale.com \
    --cc=yur@emcraft.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

all inboxes | Powered by JetHome®