[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eb0da085-5672-4a6e-b2d7-df628542cfdf@linux.dev>
Date: Sat, 26 Oct 2024 13:55:18 +0800
From: Sui Jingfeng <sui.jingfeng@...ux.dev>
To: Lucas Stach <l.stach@...gutronix.de>,
Russell King <linux+etnaviv@...linux.org.uk>,
Christian Gmeiner <christian.gmeiner@...il.com>
Cc: David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
etnaviv@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] drm/etnaviv: Map and unmap the GPU VA range with
respect to its user size
Hi,
On 2024/10/7 18:17, Lucas Stach wrote:
>>
>> @@ -104,21 +108,7 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
>> static void etnaviv_iommu_unmap(struct etnaviv_iommu_context *context, u32 iova,
>> struct sg_table *sgt, unsigned len)
>> {
>> - struct scatterlist *sg;
>> - unsigned int da = iova;
>> - int i;
>> -
>> - for_each_sgtable_dma_sg(sgt, sg, i) {
>> - size_t bytes = sg_dma_len(sg) + sg->offset;
Why the length of a single SG segment is `sg_dma_len(sg) + sg->offset` here?
>> - etnaviv_context_unmap(context, da, bytes);
>> -
>> - VERB("unmap[%d]: %08x(%zx)", i, iova, bytes);
>> -
>> - BUG_ON(!PAGE_ALIGNED(bytes));
>> -
>> - da += bytes;
>> - }
>> + etnaviv_context_unmap(context, iova, len);
> This drops some sanity checks, but I have only ever seen them fire when
> we had other kernel memory corruption issues, so I'm fine with the
> simplification you did here.
Isn't that 'sg_dma_len(sg)' itself is the length of its backing memory ?
> Regards,
> Lucas
--
Best regards,
Sui
Powered by blists - more mailing lists