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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxx
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

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux