Thread (12 messages) 12 messages, 5 authors, 2016-04-04

[PATCH 2/4] scatterlist: add sg_alloc_table_from_buf() helper

From: Boris Brezillon <hidden>
Date: 2016-03-31 14:46:14
Also in: linux-crypto, linux-iommu, linux-media, linux-mm, linux-spi, lkml

Hi Russell,

On Thu, 31 Mar 2016 15:14:13 +0100
Russell King - ARM Linux [off-list ref] wrote:
On Thu, Mar 31, 2016 at 02:29:42PM +0200, Boris Brezillon wrote:
quoted
sg_alloc_table_from_buf() provides an easy solution to create an sg_table
from a virtual address pointer. This function takes care of dealing with
vmallocated buffers, buffer alignment, or DMA engine limitations (maximum
DMA transfer size).
Please note that the DMA API does not take account of coherency of memory
regions other than non-high/lowmem - there are specific extensions to
deal with this.
Ok, you said 'non-high/lowmem', this means vmalloced and kmapped buffers
already fall in this case, right?

Could you tell me more about those specific extensions?
What this means is that having an API that takes any virtual address
pointer, converts it to a scatterlist which is then DMA mapped, is
unsafe.
Which means some implementations already get this wrong (see
spi_map_buf(), and I'm pretty sure it's not the only one).
It'll be okay for PIPT and non-aliasing VIPT cache architectures, but
for other cache architectures this will hide this problem and make
review harder.
Ok, you lost me. I'll have to do my homework and try to understand what
this means :).

Thanks for your valuable inputs.

Best Regards,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help