2009-06-24 16:31:56     dma_alloc_coherent returns null

Document created by Aaronwu Employee on Aug 15, 2013
Version 1Show Document
  • View in full screen mode

2009-06-24 16:31:56     dma_alloc_coherent returns null

Izhar Eyal (ISRAEL)

Message: 76273   

 

Hello,

 

We are trying to allocate 16M uncached memory.

 

We have changed the #define DMA_UNCACHED_1M to (16*1024*1024) for the testing

 

When we try calling dma_alloc_coherent(), any size above 3.99MB fails by returning null.

 

 

 

Do you have any suggestions?

 

Should we use the bootargs mem=32M max_mem=64M$#

 

?

 

thanks.

QuoteReplyEditDelete

 

 

2009-06-24 16:39:26     Re: dma_alloc_coherent returns null

Mike Frysinger (UNITED STATES)

Message: 76274   

 

changing the value of CONFIG_DMA_UNCACHED_1M will make no difference at all.  you need to change the DMA_UNCACHED_REGION define.

QuoteReplyEditDelete

 

 

2009-06-24 16:57:33     Re: dma_alloc_coherent returns null

Izhar Eyal (ISRAEL)

Message: 76275   

 

Hi Mike,

 

sorry I was not clear enough before, in bfin_global.h we changed the original:

 

#if defined(CONFIG_DMA_UNCACHED_2M)

# define DMA_UNCACHED_REGION (2 * 1024 * 1024)

#elif defined(CONFIG_DMA_UNCACHED_1M)

# define DMA_UNCACHED_REGION (1024 * 1024)

#else

# define DMA_UNCACHED_REGION (0)

#endif

 

 

to

 

#if defined(CONFIG_DMA_UNCACHED_2M)

# define DMA_UNCACHED_REGION (2 * 1024 * 1024)

#elif defined(CONFIG_DMA_UNCACHED_1M)

# define DMA_UNCACHED_REGION (16* 1024 * 1024)

#else

# define DMA_UNCACHED_REGION (0)

#endif

 

And we are using the make menuconfig option of 1M !

 

what else could be causing the problem please?

 

thanks

QuoteReplyEditDelete

 

 

2009-06-24 17:01:28     Re: dma_alloc_coherent returns null

Mike Frysinger (UNITED STATES)

Message: 76276   

 

you didnt say what version of software you're using.  older versions probably use those defines in more places which means grep the tree for usage.

QuoteReplyEditDelete

 

 

2009-06-24 17:03:16     Re: dma_alloc_coherent returns null

Robin Getz (UNITED STATES)

Message: 76277   

 

Izhar:

 

What does the kernel print out during boot?

 

-Robin

QuoteReplyEditDelete

 

 

2009-06-24 17:05:06     Re: dma_alloc_coherent returns null

Robin Getz (UNITED STATES)

Message: 76278   

 

Also - my understanding of things is that the uncached dma region is still used by the kernel's memory pool - so it could become fragemented - and not a single 16Meg page could be avalible.

 

Try:

 

https://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:memory_allocation#silly_nommu_memory_tricks

 

-Robin

QuoteReplyEditDelete

 

 

2009-07-13 09:26:26     Re: dma_alloc_coherent returns null

Izhar Eyal (ISRAEL)

Message: 77129   

 

We've ran into new related issues.

 

We are now using the bootargs mem=32M max_mem=64M, and we can see the kernel memory is 32MB and board memory is 64M. we are not using the UNCACHED_1M definition, we simply do DMA read/write from the unmanaged upper 32MB area.

 

We have used the __attribute__ option to define an L1 memory region, then inside an ioctrl we are doing a DMA from SDRAM to this region. then we are accessing the L1 memory from userspace and doing processing on that data.

 

Unfortunatly, we get an "External Memory Addressing Error" and the application crushes.

 

Why is this happening?

QuoteReplyEditDelete

 

 

2009-07-13 09:52:37     Re: dma_alloc_coherent returns null

Robin Getz (UNITED STATES)

Message: 77132   

 

Izhar:

 

Posting the same issue twice is just likely to get you dumped to the bottom of the list. Please don't do it in the future.

 

-Robin

Attachments

    Outcomes