mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 0/6] fix dma memory allocations, add dma_alloc/dma_free
@ 2012-06-20 11:57 Marc Kleine-Budde
  2012-06-20 11:57 ` [PATCH v2 1/6] ARM mmu: don't use CONFIG_MMU to disable mmu code, there are static inline versions Marc Kleine-Budde
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-06-20 11:57 UTC (permalink / raw)
  To: sha; +Cc: barebox

on ARM using dfu mode we've seen problems with dma memory allocations.
Some drivers use dma_inv_range on allocated buffers, which corrupts memory
around the buffer, it it's not aligned to cache lines. This series
introduces: dma_alloc() and dma_free() that allocate memory aligned to
cache lines. This is 64 bytes on ARM (just to be sure) and
DCACHE_LINE_SIZE on nios2. All other arch do a transparent xmalloc.

Feel free to add the appropriate alignment for your architecture to
"include/asm/dma.h". If you do so add a

    #define dma_alloc dma_alloc
    #define dma_free dma_free

to your "asm/dma.h" so that the generic funtion won't be used.

changes since v1:
- align size to cache line size, too (tnx Sascha)
- provide a generic "include/dma.h" which implements generic fallbacks
  using ifndef dma_{alloc,free} magic.
- add includes to arm and nions implementations

regards, Marc


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2012-06-20 11:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-20 11:57 [PATCH v2 0/6] fix dma memory allocations, add dma_alloc/dma_free Marc Kleine-Budde
2012-06-20 11:57 ` [PATCH v2 1/6] ARM mmu: don't use CONFIG_MMU to disable mmu code, there are static inline versions Marc Kleine-Budde
2012-06-20 11:57 ` [PATCH v2 2/6] blackfin, mips, openrisc, ppc, sandbox, x86: add generic dma_alloc, dma_free inlines Marc Kleine-Budde
2012-06-20 11:57 ` [PATCH v2 3/6] nios: add dma_alloc, asm/dma.h Marc Kleine-Budde
2012-06-20 11:57 ` [PATCH v2 4/6] ARM mmu: add dma_alloc Marc Kleine-Budde
2012-06-20 11:57 ` [PATCH v2 5/6] USB gadget fsl: request cacheline aligned buffer Marc Kleine-Budde
2012-06-20 11:57 ` [PATCH v2 6/6] USB gadget: Fix dma memory allocations Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox