[PATCH v5] drm: Use USB controller's DMA mask when importing dmabufs

Thomas Zimmermann tzimmermann at suse.de
Mon Mar 1 08:12:06 UTC 2021


Hi

Am 26.02.21 um 21:33 schrieb Pavel Machek:
> Hi!
> 
> 
>>> +	struct device *dmadev;
>>> +	struct drm_gem_object *obj;
>>> +
>>> +	if (!dev_is_usb(dev->dev))
>>> +		return ERR_PTR(-ENODEV);
>>> +
>>> +	dmadev = usb_intf_get_dma_device(to_usb_interface(dev->dev));
>>> +	if (drm_WARN_ONCE(dev, !dmadev, "buffer sharing not supported"))
>>> +		return ERR_PTR(-ENODEV);
>>> +
>>> +	obj = drm_gem_prime_import_dev(dev, dma_buf, dmadev);
>>> +
>>> +	put_device(dmadev);
>>
>> Just realized there's another can of worms here because dma_buf_attach
>> does not refcount the struct device. But the dma_buf can easily outlive
>> the underlying device, at least right now.
>>
>> We should probably require that devices get rid of all their mappings in
>> their hotunplug code.
>>
>> Ofc now that we pick some random other device struct this gets kinda
>> worse.
>>
>> Anyway, also just another pre-existing condition that we should worry
>> about here. It's all still a very bad hack.
> 
> This is actually regression fix if I understand this correctly. Bug
> means udl is unusable, so that's kind of bad.
> 
> Should we revert the original commit causing this while this get
> sorted out?

Better not. It's not easily revert-able, so other code might break in 
the process.

I'd rather wait a bit for this to get ready, or meanwhile cherry-pick 
the current patch.

Best regards
Thomas

> 
> Best regards,
> 								Pavel
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20210301/f8f513b1/attachment.sig>


More information about the dri-devel mailing list