2012-02-05 11:53:33

by Huang Shijie

[permalink] [raw]
Subject: Re: [PATCH resent v2 1/2] ioport : add DEFINE_RES_DMA_SIZE_NAMED macro

Does any one have any comments about this patch?

thanks.

On Thu, Jan 19, 2012 at 3:53 PM, Huang Shijie <[email protected]> wrote:
> Some DMA resource does have the range more then ones.
>
> Signed-off-by: Huang Shijie <[email protected]>
> ---
>  include/linux/ioport.h |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/ioport.h b/include/linux/ioport.h
> index 9d57a71..9ea5de4 100644
> --- a/include/linux/ioport.h
> +++ b/include/linux/ioport.h
> @@ -134,8 +134,10 @@ struct resource_list {
>  #define DEFINE_RES_IRQ(_irq)                                           \
>        DEFINE_RES_IRQ_NAMED((_irq), NULL)
>
> +#define DEFINE_RES_DMA_SIZE_NAMED(_dma, _size, _name)                  \
> +       DEFINE_RES_NAMED((_dma), (_size), (_name), IORESOURCE_DMA)
>  #define DEFINE_RES_DMA_NAMED(_dma, _name)                              \
> -       DEFINE_RES_NAMED((_dma), 1, (_name), IORESOURCE_DMA)
> +       DEFINE_RES_DMA_SIZE_NAMED((_dma), 1, (_name))
>  #define DEFINE_RES_DMA(_dma)                                           \
>        DEFINE_RES_DMA_NAMED((_dma), NULL)
>
> --
> 1.7.0.4
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


2012-02-05 12:34:39

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH resent v2 1/2] ioport : add DEFINE_RES_DMA_SIZE_NAMED macro

On Sun, Feb 05, 2012 at 07:53:31PM +0800, Huang Shijie wrote:
> Does any one have any comments about this patch?

Yes. Having a flat numberspace for DMAs invites the same problems that
we have with the flat IRQ numberspace when it comes to having multiple
DMA controllers.

With DMA engine drivers, channels are allocated using a match function
and unspecified match data. While a linear numberspace can be used,
that sets itself up for clashing between different DMA controllers
especially if the numberspace overlaps.

What's missing from this patch set is an illustration of how this will
be used.

Another issue here is that having the peripheral drivers know about the
exact match function and what data the DMA engines require ties the
periperal drivers to their respective DMA engine. One of the points of
DMA engine is to separate that knowledge, so that the same peripheral IP
can be re-used with different DMA engines.

To encode knowledge of the DMA engine into the peripheral driver basically
destroys the purpose of having a DMA engine API.

So, I believe that _if_ we are going down the path of using the DMA engine
API for our SoCs, we really don't want to invent a linear DMA numberspace
by putting DMA numbers into resources.

2012-02-05 16:22:16

by Huang Shijie

[permalink] [raw]
Subject: Re: [PATCH resent v2 1/2] ioport : add DEFINE_RES_DMA_SIZE_NAMED macro

On Sun, Feb 5, 2012 at 8:34 PM, Russell King - ARM Linux
<[email protected]> wrote:
> On Sun, Feb 05, 2012 at 07:53:31PM +0800, Huang Shijie wrote:
>> Does any one have any comments about this patch?
>
> Yes.  Having a flat numberspace for DMAs invites the same problems that
> we have with the flat IRQ numberspace when it comes to having multiple
> DMA controllers.
>
> With DMA engine drivers, channels are allocated using a match function
> and unspecified match data.  While a linear numberspace can be used,
> that sets itself up for clashing between different DMA controllers
> especially if the numberspace overlaps.
>
> What's missing from this patch set is an illustration of how this will
> be used.
>
> Another issue here is that having the peripheral drivers know about the
> exact match function and what data the DMA engines require ties the
> periperal drivers to their respective DMA engine.  One of the points of
> DMA engine is to separate that knowledge, so that the same peripheral IP
> can be re-used with different DMA engines.
>
> To encode knowledge of the DMA engine into the peripheral driver basically
> destroys the purpose of having a DMA engine API.
>
> So, I believe that _if_ we are going down the path of using the DMA engine
> API for our SoCs, we really don't want to invent a linear DMA numberspace
> by putting DMA numbers into resources.

ok. thanks.


Huang Shijie