Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: virtio: reinstate drm_virtio_set_busid()

Before commit a325725633c2 ("drm: Lobotomize set_busid nonsense for !pci
drivers"), several DRM drivers for platform devices used to expose an
explicit "drm_driver.set_busid" callback, invariably backed by
drm_platform_set_busid().

Commit a325725633c2 removed drm_platform_set_busid(), along with the
referring .set_busid field initializations. This was justified because
interchangeable functionality had been implemented in drm_dev_alloc() /
drm_dev_init(), which DRM_IOCTL_SET_VERSION would rely on going forward.

However, commit a325725633c2 also removed drm_virtio_set_busid(), for
which the same consolidation was not appropriate: this .set_busid callback
had been implemented with drm_pci_set_busid(), and not
drm_platform_set_busid(). The error regressed Xorg/xserver on QEMU's
"virtio-vga" card; the drmGetBusid() function from libdrm would no longer
return stable PCI identifiers like "pci:0000:00:02.0", but rather unstable
platform ones like "virtio0".

Reinstate drm_virtio_set_busid() with judicious use of

git checkout -p a325725633c2^ -- drivers/gpu/drm/virtio

Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Joachim Frieben <jfrieben@hotmail.com>
Cc: stable@vger.kernel.org # v4.8
Reported-by: Joachim Frieben <jfrieben@hotmail.com>
Fixes: a325725633c26aa66ab940f762a6b0778edf76c0
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1366842
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Laszlo Ersek and committed by
Dave Airlie
c2cbc38b 2adb29b1

+12
+10
drivers/gpu/drm/virtio/virtgpu_drm_bus.c
··· 28 28 29 29 #include "virtgpu_drv.h" 30 30 31 + int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master) 32 + { 33 + struct pci_dev *pdev = dev->pdev; 34 + 35 + if (pdev) { 36 + return drm_pci_set_busid(dev, master); 37 + } 38 + return 0; 39 + } 40 + 31 41 static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev) 32 42 { 33 43 struct apertures_struct *ap;
+1
drivers/gpu/drm/virtio/virtgpu_drv.c
··· 117 117 118 118 static struct drm_driver driver = { 119 119 .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER | DRIVER_ATOMIC, 120 + .set_busid = drm_virtio_set_busid, 120 121 .load = virtio_gpu_driver_load, 121 122 .unload = virtio_gpu_driver_unload, 122 123 .open = virtio_gpu_driver_open,
+1
drivers/gpu/drm/virtio/virtgpu_drv.h
··· 49 49 #define DRIVER_PATCHLEVEL 1 50 50 51 51 /* virtgpu_drm_bus.c */ 52 + int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master); 52 53 int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev); 53 54 54 55 struct virtio_gpu_object {