All of lore.kernel.org
 help / color / mirror / Atom feed
* DMA
@ 2011-01-24 23:04       ` mahdi hamzeh
  2011-01-25  7:15           ` DMA Paul Mundt
  0 siblings, 1 reply; 5+ messages in thread
From: mahdi hamzeh @ 2011-01-24 23:04 UTC (permalink / raw)
  To: linux-sh

Hi,
I am working on a research project for which I should be able to
transfer data from memory to memory using DMA. I am working on a x86
machine but I want my code to be architecture independent as much as
possible. Please accept my apology if my question is too basic to be
asked from this mailing list. Here is my problem:
I used "struct dma_chan" to define a channel structure but when I use
"dma_request_channel" function to get a DMA channel, with all
different possible masks including DMA_MEMCPY, DMA_PRIVATE,....
anything, the function returns always NULL. This function is defined
in "dmaengine.h". I also tried a low level function to see dma channel
availability and "request_dma" function defined in "dma.h" works
perfect.
Any comment, help, document, program, reference anything that helps me
to create a simple DMA transaction would really be appreciated.
PS: There is a test program called dmatest.c is provided in the linux
kernel files. I tried to get it compiled but I could not since the
functions and structures used in this file has been changed in the
kernel header files.

Thanks
--
---Mahdi Hamzeh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DMA
  2011-01-24 23:04       ` DMA mahdi hamzeh
@ 2011-01-25  7:15           ` Paul Mundt
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Mundt @ 2011-01-25  7:15 UTC (permalink / raw)
  To: mahdi hamzeh; +Cc: linux-sh, Dan Williams, linux-kernel

On Mon, Jan 24, 2011 at 04:04:57PM -0700, mahdi hamzeh wrote:
> I am working on a research project for which I should be able to
> transfer data from memory to memory using DMA. I am working on a x86
> machine but I want my code to be architecture independent as much as
> possible. Please?accept?my?apology?if my question is too basic to be
> asked from this mailing list. Here is my problem:
> I?used "struct dma_chan" to define a channel structure but when I use
> "dma_request_channel" function to get a DMA channel, with all
> different possible masks including?DMA_MEMCPY,?DMA_PRIVATE,....
> anything, the function returns always NULL. This function is defined
> in "dmaengine.h".?I also tried a low level function to see dma channel
> availability?and "request_dma" function defined in "dma.h" works
> perfect.
> Any comment, help, document, program, reference anything that helps me
> to create a simple DMA transaction would really be appreciated.
> PS: There is a test program called dmatest.c is provided in the linux
> kernel files. I tried to get it compiled but I could not since the
> functions and structures used in this file has been changed in the
> kernel header files.
> 
I'm not sure how you selected the sh list as the best forum for this
inquiry (I assume it's because Guennadi has been doing a lot of dmaengine
driver work recently), but this is really something that's better suited
for l-k directly, with Dan CC'ed (as I've done here).

If you're looking for preliminary getting started information, then your
best bet is Documentation/crypto/async-tx-api.txt, as referenced in the
top-level MAINTAINERS.

The dmatest driver of course also provides you with some examples of how
to plug in to the API. In any event, I'm able to compile dmatest without
any difficulty, so I'm not sure what bitrot you are seeing, perhaps it's
something related to the driver you are using? You'll have to provide the
relevant bits from your .config or the errors you're seeing before anyone
will be able to point you in the right direction here.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DMA
@ 2011-01-25  7:15           ` Paul Mundt
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Mundt @ 2011-01-25  7:15 UTC (permalink / raw)
  To: mahdi hamzeh; +Cc: linux-sh, Dan Williams, linux-kernel

On Mon, Jan 24, 2011 at 04:04:57PM -0700, mahdi hamzeh wrote:
> I am working on a research project for which I should be able to
> transfer data from memory to memory using DMA. I am working on a x86
> machine but I want my code to be architecture independent as much as
> possible. Please?accept?my?apology?if my question is too basic to be
> asked from this mailing list. Here is my problem:
> I?used "struct dma_chan" to define a channel structure but when I use
> "dma_request_channel" function to get a DMA channel, with all
> different possible masks including?DMA_MEMCPY,?DMA_PRIVATE,....
> anything, the function returns always NULL. This function is defined
> in "dmaengine.h".?I also tried a low level function to see dma channel
> availability?and "request_dma" function defined in "dma.h" works
> perfect.
> Any comment, help, document, program, reference anything that helps me
> to create a simple DMA transaction would really be appreciated.
> PS: There is a test program called dmatest.c is provided in the linux
> kernel files. I tried to get it compiled but I could not since the
> functions and structures used in this file has been changed in the
> kernel header files.
> 
I'm not sure how you selected the sh list as the best forum for this
inquiry (I assume it's because Guennadi has been doing a lot of dmaengine
driver work recently), but this is really something that's better suited
for l-k directly, with Dan CC'ed (as I've done here).

If you're looking for preliminary getting started information, then your
best bet is Documentation/crypto/async-tx-api.txt, as referenced in the
top-level MAINTAINERS.

The dmatest driver of course also provides you with some examples of how
to plug in to the API. In any event, I'm able to compile dmatest without
any difficulty, so I'm not sure what bitrot you are seeing, perhaps it's
something related to the driver you are using? You'll have to provide the
relevant bits from your .config or the errors you're seeing before anyone
will be able to point you in the right direction here.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DMA
  2011-01-25  7:15           ` DMA Paul Mundt
  (?)
@ 2011-02-04 21:01           ` mahdi hamzeh
  2011-02-05 17:41             ` DMA Dan Williams
  -1 siblings, 1 reply; 5+ messages in thread
From: mahdi hamzeh @ 2011-02-04 21:01 UTC (permalink / raw)
  To: Paul Mundt; +Cc: Dan Williams, linux-kernel

Paul,

Thanks for your help. You were right. There was a version mismatch
between my header files and I got it fixed. I could compile all
related dma modules including async modules. However, I cannot use dma
engine because I receive following error when I run my code,
"__dma_request_channel: fail ((null))". Even I tried
Documentation/crypto/async-tx-api.txt but it turns out that when I
issue a transaction such that "async_memcpy" and I wait for
transaction to be completed by "wait_for_completion", it is never
completed. Is this problem related to my machine or my code?

Here is my code:

struct async_submit_ctl submit;
struct completion cmp;
init_completion(&cmp);
init_async_submit(&submit, flag, NULL, NULL, &cmp,  addr_conv);
desc=async_memcpy(dest, src, 0, 0, 10,  &submit);
async_tx_issue_pending_all();
wait_for_completion(&cmp);

My other code:

dma_cap_mask_t myMask;
dma_cap_zero(myMask);
dma_cap_set(DMA_PRIVATE, myMask); //I tried different combination of
flags like DMA_MEMCPY ,....
myDMAChannel = dma_request_channel(myMask, NULL, filter_param);

myDMAChannel is always NULL.


Thanks

On Tue, Jan 25, 2011 at 12:15 AM, Paul Mundt <lethal@linux-sh.org> wrote:
> On Mon, Jan 24, 2011 at 04:04:57PM -0700, mahdi hamzeh wrote:
>> I am working on a research project for which I should be able to
>> transfer data from memory to memory using DMA. I am working on a x86
>> machine but I want my code to be architecture independent as much as
>> possible. Please?accept?my?apology?if my question is too basic to be
>> asked from this mailing list. Here is my problem:
>> I?used "struct dma_chan" to define a channel structure but when I use
>> "dma_request_channel" function to get a DMA channel, with all
>> different possible masks including?DMA_MEMCPY,?DMA_PRIVATE,....
>> anything, the function returns always NULL. This function is defined
>> in "dmaengine.h".?I also tried a low level function to see dma channel
>> availability?and "request_dma" function defined in "dma.h" works
>> perfect.
>> Any comment, help, document, program, reference anything that helps me
>> to create a simple DMA transaction would really be appreciated.
>> PS: There is a test program called dmatest.c is provided in the linux
>> kernel files. I tried to get it compiled but I could not since the
>> functions and structures used in this file has been changed in the
>> kernel header files.
>>
> I'm not sure how you selected the sh list as the best forum for this
> inquiry (I assume it's because Guennadi has been doing a lot of dmaengine
> driver work recently), but this is really something that's better suited
> for l-k directly, with Dan CC'ed (as I've done here).
>
> If you're looking for preliminary getting started information, then your
> best bet is Documentation/crypto/async-tx-api.txt, as referenced in the
> top-level MAINTAINERS.
>
> The dmatest driver of course also provides you with some examples of how
> to plug in to the API. In any event, I'm able to compile dmatest without
> any difficulty, so I'm not sure what bitrot you are seeing, perhaps it's
> something related to the driver you are using? You'll have to provide the
> relevant bits from your .config or the errors you're seeing before anyone
> will be able to point you in the right direction here.
>



-- 
---Mahdi Hamzeh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DMA
  2011-02-04 21:01           ` DMA mahdi hamzeh
@ 2011-02-05 17:41             ` Dan Williams
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Williams @ 2011-02-05 17:41 UTC (permalink / raw)
  To: mahdi hamzeh; +Cc: Paul Mundt, linux-kernel

On 02/04/2011 01:01 PM, mahdi hamzeh wrote:
> Paul,
>
> Thanks for your help. You were right. There was a version mismatch
> between my header files and I got it fixed. I could compile all
> related dma modules including async modules. However, I cannot use dma
> engine because I receive following error when I run my code,
> "__dma_request_channel: fail ((null))". Even I tried
> Documentation/crypto/async-tx-api.txt but it turns out that when I
> issue a transaction such that "async_memcpy" and I wait for
> transaction to be completed by "wait_for_completion", it is never
> completed. Is this problem related to my machine or my code?
>
> Here is my code:
>
> struct async_submit_ctl submit;
> struct completion cmp;
> init_completion(&cmp);
> init_async_submit(&submit, flag, NULL, NULL,&cmp,  addr_conv);
                                          ^^^^
Hmm... what's wrong with this parameter? ;-)

> dma_cap_mask_t myMask;
> dma_cap_zero(myMask);
> dma_cap_set(DMA_PRIVATE, myMask); //I tried different combination of
> flags like DMA_MEMCPY ,....
> myDMAChannel = dma_request_channel(myMask, NULL, filter_param);
>
> myDMAChannel is always NULL.

This is a bit more subtle.  Depending on the driver and the kernel 
configuration all channels may already be consumed for "public" usage 
(NET_DMA and/or ASYNC_TX_DMA).

One way to sanity check your system is to turn off CONFIG_NET_DMA and 
CONFIG_ASYNC_TX_DMA and turn on CONFIG_DMATEST, load dmatest.ko and it 
should give a clue about whether dma is operational on your platform.

--
Dan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-05 17:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AANLkTimW-PT801BUL8QQkhVpezX_VNw-1qLNRpeeoQFU@mail.gmail.com>
     [not found] ` <AANLkTinQWLOOSMS_8LcFkSmRT2K_CbQ+v2pH7FiNxqGo@mail.gmail.com>
     [not found]   ` <AANLkTimC=6TA8eF6jFYzm_3RzXkQo9BwCMexdjfPKtEC@mail.gmail.com>
     [not found]     ` <AANLkTinFJ54dCJPLANOmwejrBrb=vw0m-BLtq9a7ys5s@mail.gmail.com>
2011-01-24 23:04       ` DMA mahdi hamzeh
2011-01-25  7:15         ` DMA Paul Mundt
2011-01-25  7:15           ` DMA Paul Mundt
2011-02-04 21:01           ` DMA mahdi hamzeh
2011-02-05 17:41             ` DMA Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.