• R
    lib: scatterlist: add sg splitting function · f8bcbe62
    Robert Jarzmik 提交于
    Sometimes a scatter-gather has to be split into several chunks, or sub
    scatter lists. This happens for example if a scatter list will be
    handled by multiple DMA channels, each one filling a part of it.
    
    A concrete example comes with the media V4L2 API, where the scatter list
    is allocated from userspace to hold an image, regardless of the
    knowledge of how many DMAs will fill it :
     - in a simple RGB565 case, one DMA will pump data from the camera ISP
       to memory
     - in the trickier YUV422 case, 3 DMAs will pump data from the camera
       ISP pipes, one for pipe Y, one for pipe U and one for pipe V
    
    For these cases, it is necessary to split the original scatter list into
    multiple scatter lists, which is the purpose of this patch.
    
    The guarantees that are required for this patch are :
     - the intersection of spans of any couple of resulting scatter lists is
       empty.
     - the union of spans of all resulting scatter lists is a subrange of
       the span of the original scatter list.
     - streaming DMA API operations (mapping, unmapping) should not happen
       both on both the resulting and the original scatter list. It's either
       the first or the later ones.
     - the caller is reponsible to call kfree() on the resulting
       scatterlists.
    Signed-off-by: NRobert Jarzmik <robert.jarzmik@free.fr>
    Signed-off-by: NJens Axboe <axboe@fb.com>
    f8bcbe62
Makefile 6.4 KB