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

Robin Murphy robin.murphy at arm.com
Fri May 25 13:33:27 UTC 2018

On 30/04/18 18:59, Sinan Kaya wrote:
> 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)

Cheers Sinan.

Alex, Christian, David; is the AMD GPU tree the right target for these 
patches, or is there a wider audience I should consider resending them 
to? (before I forget about them again...)


More information about the dri-devel mailing list