All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/virtio: populate .set_busid callback
@ 2016-10-03 16:43 Emil Velikov
  2016-10-03 17:08 ` Laszlo Ersek
  0 siblings, 1 reply; 5+ messages in thread
From: Emil Velikov @ 2016-10-03 16:43 UTC (permalink / raw)
  To: dri-devel; +Cc: emil.l.velikov, Daniel Vetter, Laszlo Ersek, stable

Earlier commit was removing all the users of drm_platform_set_busid and
removed the virtio hunk (which uses the PCI version of the function) by
mistake.

This in itself resulted in user space receiving an incorrect value for
the busid, which in the case below lead to the failure to detect
the (correct) device and ultimately the X server failing to start.

Fixes: a325725633c ("drm: Lobotomize set_busid nonsense for !pci
drivers")
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: stable@vger.kernel.org
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1366842
Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
Since I'm not 100% sure if we can get into .set_busid() as pci_dev is
NULL (for the virtio-vga 'vs' virgio-gpu-pci case) I've left the local
wrapper.

Note: patch is against mainline (refs/tags/v4.8) but should apply for
drm-next/others.
---
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 10 ++++++++++
 drivers/gpu/drm/virtio/virtgpu_drv.c     |  1 +
 drivers/gpu/drm/virtio/virtgpu_drv.h     |  1 +
 3 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c
index 7f0e93f87..88a3916 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c
@@ -27,6 +27,16 @@
 
 #include "virtgpu_drv.h"
 
+int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master)
+{
+	struct pci_dev *pdev = dev->pdev;
+
+	if (pdev) {
+		return drm_pci_set_busid(dev, master);
+	}
+	return 0;
+}
+
 static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev)
 {
 	struct apertures_struct *ap;
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
index c13f70c..5820b702 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -117,6 +117,7 @@ static const struct file_operations virtio_gpu_driver_fops = {
 
 static struct drm_driver driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER | DRIVER_ATOMIC,
+	.set_busid = drm_virtio_set_busid,
 	.load = virtio_gpu_driver_load,
 	.unload = virtio_gpu_driver_unload,
 	.open = virtio_gpu_driver_open,
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index b18ef31..acf556a 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -49,6 +49,7 @@
 #define DRIVER_PATCHLEVEL 1
 
 /* virtgpu_drm_bus.c */
+int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master);
 int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev);
 
 struct virtio_gpu_object {
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-10-03 17:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-03 16:43 [PATCH] drm/virtio: populate .set_busid callback Emil Velikov
2016-10-03 17:08 ` Laszlo Ersek
2016-10-03 17:28   ` Emil Velikov
2016-10-03 17:38     ` Laszlo Ersek
2016-10-03 17:35   ` Laszlo Ersek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.