public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH v3] dmaengine: sh: Add Support SuperH DMA Engine driver
Date: Tue, 31 Mar 2009 16:01:33 +0000	[thread overview]
Message-ID: <49D23E5D.2020209@intel.com> (raw)
In-Reply-To: <49C9D558.7030002@renesas.com>

Paul Mundt wrote:
> On Wed, Mar 25, 2009 at 03:55:20PM +0900, Nobuhiro Iwamatsu wrote:
>> This supported all DMA channels, and it was tested in SH7722,
>> SH7780 and SH7763.
>> This can not use with SH DMA API.
>>
>> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
>> Reviewed-by: Matt Fleming <matt@console-pimps.org>
> 
> I don't know why you dropped Dan from the CC, but you need his Acked-by
> or Reviewed-by before this can be merged.

Thanks Paul.

This version still has the problem of up leveling the descriptor lock to 
  spin_lock_irqsave from spin_lock_bh.  This poses a problem for 
completion callback support where callbacks assume that interrupts are 
enabled, like a timer callback.  I have also spotted a new problem below:

> 
>> ---
>>
>>  V3: Reflect Maciej's comments.
>>
>>  arch/sh/drivers/dma/Kconfig  |   12 +-
>>  arch/sh/drivers/dma/Makefile |    3 +-
>>  arch/sh/include/asm/dma-sh.h |   13 +
>>  drivers/dma/Kconfig          |    8 +
>>  drivers/dma/Makefile         |    2 +
>>  drivers/dma/shdma.c          |  756 ++++++++++++++++++++++++++++++++++++++++++
>>  drivers/dma/shdma.h          |   64 ++++
>>  7 files changed, 853 insertions(+), 5 deletions(-)
>>  create mode 100644 drivers/dma/shdma.c
>>  create mode 100644 drivers/dma/shdma.h
[..]
>> +static struct sh_desc *sh_dmae_alloc_descriptor(struct sh_dmae_chan *sh_chan)
>> +{
>> +     struct sh_desc *desc_sw;
>> +     desc_sw = kzalloc(sizeof(struct sh_desc), GFP_KERNEL);
>> +     if (desc_sw) {
>> +             dma_async_tx_descriptor_init(&desc_sw->async_tx,
>> +                                             &sh_chan->common);
>> +             desc_sw->async_tx.tx_submit = sh_dmae_tx_submit;
>> +             INIT_LIST_HEAD(&desc_sw->async_tx.tx_list);
>> +     }
>> +
>> +     return desc_sw;
>> +}
>> +
>> +static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
>> +{
>> +     return 1;
>> +}

The point of this routine is to preallocate descriptors because...

>> +
>> +/*
>> + * sh_dma_free_chan_resources - Free all resources of the channel.
>> + */
[..]
>> +
>> +static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy(
>> +     struct dma_chan *chan, dma_addr_t dma_dest, dma_addr_t dma_src,
>> +     size_t len, unsigned long flags)
>> +{
>> +     struct sh_dmae_chan *sh_chan;
>> +     struct sh_desc *first = NULL, *prev = NULL, *new;
>> +     size_t copy_size;
>> +     int cnt = 0;
>> +     LIST_HEAD(link_chain);
>> +
>> +     if (!chan)
>> +             return NULL;
>> +
>> +     if (!len)
>> +             return NULL;
>> +
>> +     sh_chan = to_sh_chan(chan);
>> +
>> +     do {
>> +             /* Allocate the link descriptor from DMA pool */
>> +             new = sh_dmae_alloc_descriptor(sh_chan);

...we may not be able to do a GFP_KERNEL allocation here.

>> +             if (!new) {
>> +                     dev_err(sh_chan->dev,
>> +                                     "No free memory for link descriptor\n");
>> +                     return NULL;
>> +             }

--
Dan

  parent reply	other threads:[~2009-03-31 16:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-25  6:55 [PATCH v3] dmaengine: sh: Add Support SuperH DMA Engine driver Nobuhiro Iwamatsu
2009-03-30 22:55 ` Paul Mundt
2009-03-31 12:05 ` Sosnowski, Maciej
2009-03-31 16:01 ` Dan Williams [this message]
2009-04-02  9:14 ` Nobuhiro Iwamatsu
2009-04-02  9:16 ` Nobuhiro Iwamatsu

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=49D23E5D.2020209@intel.com \
    --to=dan.j.williams@intel.com \
    --cc=linux-sh@vger.kernel.org \
    /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