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

Robin Murphy robin.murphy at arm.com
Fri Mar 24 10:09:20 PDT 2017


On 24/03/17 01:41, yamada.masahiro at socionext.com wrote:
> 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.

Ah, so it's only a visibility issue at my end, then. Great stuff!

(on balance, I'm fine with not being sent the other 52 patches just for
the sake of this one!)

Thanks,
Robin.

> 
> 
> Masahiro
> 




More information about the linux-mtd mailing list