[RESEND PATCH v2 52/53] mtd: nand: denali: use non-managed kmalloc() for DMA buffer

yamada.masahiro at socionext.com yamada.masahiro at socionext.com
Thu Mar 23 18:41:34 PDT 2017


Hi Robin,

> I still think the way the driver actually uses this buffer looks very
> suspect - keeping it permanently mapped for bidirectional (AKA "I don't
> know") streaming DMA across multiple operations doesn't add up. If the
> device might access it at any time (or the driver simply doesn't want to
> have to care) it should be a coherent allocation. Otherwise, it should
> just be mapped/unmapped with the appropriate direction around each
> operation.

This buffer is not permanently mapped for bidirectional any more.

I fixed it in 51/53:
http://patchwork.ozlabs.org/patch/742411/

When possible, the read/write callbacks
directly calls dma_map_single() for the buffer
passed from the core framework.
(either DMA_TO_DEVICE or DMA_FROM_DEVICE)

This will bypass the memcpy() to/from the internal buffer.



This driver internal buffer is still needed for raw read/write.
The Denali IP uses syndrome page layout.
So, the raw accessors must arrange the payload/ECC data layout.

This problem is addressed by 48/53:
http://patchwork.ozlabs.org/patch/742416/


I also examined the possibility for coherent allocation.
Even if I use dma_alloc_coherent, I need another bounce buffer anyway
for the syndrome page shuffling.  So, this way seems less efficient.


Masahiro



More information about the linux-mtd mailing list