[PATCH v2 2/5] drm/virtio: Add a helper to map and note the dma addrs and lengths

Dmitry Osipenko dmitry.osipenko at collabora.com
Wed Oct 23 03:45:46 UTC 2024


On 10/22/24 07:51, Kasireddy, Vivek wrote:
> Hi Dmitry,
> 
>>
>> On 8/13/24 06:49, Vivek Kasireddy wrote:
>>> +long virtgpu_dma_buf_import_sgt(struct virtio_gpu_mem_entry **ents,
>>> +				unsigned int *nents,
>>> +				struct virtio_gpu_object *bo,
>>> +				struct dma_buf_attachment *attach)
>>> +{
>>> +	struct scatterlist *sl;
>>> +	struct sg_table *sgt;
>>> +	long i, ret;
>>> +
>>> +	dma_resv_assert_held(attach->dmabuf->resv);
>>> +
>>> +	ret = dma_resv_wait_timeout(attach->dmabuf->resv,
>>> +				    DMA_RESV_USAGE_KERNEL,
>>> +				    false, MAX_SCHEDULE_TIMEOUT);
>>
>> Why this wait is needed?
> The intention was to wait for any pending operations on the backing object
> to finish and let it become idle before mapping and accessing the underlying
> memory. But I suspect this wait may not be necessary given that we would
> have already called dma_buf_pin() at this point, which would have had the
> desired effect?

Looking at the dma_buf_map_attachment() code, I see that it does both of
pinning and waiting for the fence by itself. Hence should be safe to
drop both dma_buf_pin() and dma_resv_wait_timeout(), please test.

BTW, is any DG2 GPU suitable for testing of this patchset? Will I be
able to test it using a regular consumer A750 card?

-- 
Best regards,
Dmitry


More information about the dri-devel mailing list