[PATCH v3 1/3] drm/prime: Iterate SG DMA addresses separately

Sinan Kaya okaya at codeaurora.org
Mon Apr 30 17:59:01 UTC 2018


On 4/30/2018 9:54 AM, Robin Murphy wrote:
> For dma_map_sg(), DMA API implementations are free to merge consecutive
> segments into a single DMA mapping if conditions are suitable, thus the
> resulting DMA addresses which drm_prime_sg_to_page_addr_arrays()
> iterates over may be packed into fewer entries than sgt->nents implies.
> 
> The current implementation does not account for this, meaning that its
> callers either have to reject the 0 < count < nents case or risk getting
> bogus DMA addresses beyond the first segment. Fortunately this is quite
> easy to handle without having to rejig structures to also store the
> mapped count, since the total DMA length should still be equal to the
> total buffer length. All we need is a second scatterlist cursor to
> iterate through the DMA addresses independently of the page addresses.
> 
> Reviewed-by: Christian König <christian.koenig at amd.com>
> Signed-off-by: Robin Murphy <robin.murphy at arm.com>
> ---

Much better 

Tested-by: Sinan Kaya <okaya at codeauora.org>

for the first two patches. (1/3 and 2/3)

-- 
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.


More information about the amd-gfx mailing list