Skip to contentSkip to conversation

drm: virtio: reinstate drm_virtio_set_busid()

PATCH In review Laszlo Ersek 3 participants 7 messages Oct 3, 2016 – Oct 18, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Gustavo Padovan <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Joachim Frieben <[email protected]>
Fixes a325725633c26aa66ab940f762a6b0778edf76c0

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1366842

---
 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(+)
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +10 -0
index 7f0e93f87a55..88a39165edd5 100644
@@ -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;
drivers/gpu/drm/virtio/virtgpu_drv.c +1 -0
index c13f70cfc461..5820b7020ae5 100644
@@ -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,
drivers/gpu/drm/virtio/virtgpu_drv.h +1 -0
index b18ef3111f0c..acf556a35cb2 100644
@@ -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 {
Signature · 1 line
2.9.2
maintainer
#1 lore raw
Quoted 18 lines · Laszlo Ersek

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".

Quoted 3 lines

Reinstate drm_virtio_set_busid() with judicious use of

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

Thanks guys, I've pushed this into drm-next.

Dave.

#2 lore raw
In reply to Laszlo Ersek

Greg,

Quoted 33 lines · Laszlo Ersek

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 <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Gustavo Padovan <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Joachim Frieben <[email protected]>
Fixes a325725633c26aa66ab940f762a6b0778edf76c0
Quoted 8 lines

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1366842

---
 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(+)

Is there any particular reason this patch hasn't been cherry-picked to linux-4.8.y? (I checked v4.8.2.)

According to "Option 1" in "Documentation/stable_kernel_rules.txt", I think it should have been.

Anyway, it is commit c2cbc38b9715bd8318062e600668fc30e5a3fbfa upstream; please consider including it in v4.8.3.

(Daniel: my offer to test any further reworkings for this still stands; just please send me patches that I can apply cleanly with git-am.)

Thanks!
Laszlo

Quoted 46 lines
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +10 -0
index 7f0e93f87a55..88a39165edd5 100644
@@ -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;
drivers/gpu/drm/virtio/virtgpu_drv.c +1 -0
index c13f70cfc461..5820b7020ae5 100644
@@ -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,
drivers/gpu/drm/virtio/virtgpu_drv.h +1 -0
index b18ef3111f0c..acf556a35cb2 100644
@@ -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 {
#3 lore raw
Quoted 45 lines · Laszlo Ersek

Greg,

Quoted 33 lines · Laszlo Ersek

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 <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Gustavo Padovan <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Joachim Frieben <[email protected]>
Fixes a325725633c26aa66ab940f762a6b0778edf76c0
Quoted 8 lines

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1366842

---
 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(+)
Quoted 2 lines

Is there any particular reason this patch hasn't been cherry-picked to linux-4.8.y? (I checked v4.8.2.)

Yes, it just showed up in 4.9-rc1 3 days ago, give me a chance to catch up! I have 210 patches right now that are in this same status, you are in good company.

Don't worry, it will eventually make it in, patience please...

greg k-h

#4 lore raw
Quoted 46 lines · Greg Kroah-Hartman
Quoted 45 lines · Laszlo Ersek

Greg,

Quoted 41 lines · Laszlo Ersek

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 <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Gustavo Padovan <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Joachim Frieben <[email protected]>
Fixes a325725633c26aa66ab940f762a6b0778edf76c0

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1366842

---
 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(+)
Quoted 5 lines
Quoted 2 lines

Is there any particular reason this patch hasn't been cherry-picked to linux-4.8.y? (I checked v4.8.2.)

Yes, it just showed up in 4.9-rc1 3 days ago, give me a chance to catch up! I have 210 patches right now that are in this same status,

My apologies; I didn't realize the volume.

(
BTW I tried to fetch stable-queue this morning, and just now as well -- for some reason that git command seems consistently stuck for me. It produces some low network traffic, but makes no progress:

Quoted 3 lines

Looking up git.kernel.org ... done.
Connecting to git.kernel.org (port 9418) ... 199.204.44.194 done. <stuck here>

Should I report this elsewhere and/or capture packets with tcpdump? )

Quoted 2 lines

you are
in good company.

Always :)

Thanks!
Laszlo

Quoted 4 lines

Don't worry, it will eventually make it in, patience please...

greg k-h

#5 lore raw
Quoted 60 lines · Laszlo Ersek
Quoted 46 lines · Greg Kroah-Hartman
Quoted 45 lines · Laszlo Ersek

Greg,

Quoted 41 lines · Laszlo Ersek

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 <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Gustavo Padovan <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Joachim Frieben <[email protected]>
Fixes a325725633c26aa66ab940f762a6b0778edf76c0

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1366842

---
 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(+)
Quoted 5 lines
Quoted 2 lines

Is there any particular reason this patch hasn't been cherry-picked to linux-4.8.y? (I checked v4.8.2.)

Yes, it just showed up in 4.9-rc1 3 days ago, give me a chance to catch up! I have 210 patches right now that are in this same status,

My apologies; I didn't realize the volume.

(
BTW I tried to fetch stable-queue this morning, and just now as well -- for some reason that git command seems consistently stuck for me. It produces some low network traffic, but makes no progress:

Quoted 5 lines
Quoted 3 lines

Looking up git.kernel.org ... done.
Connecting to git.kernel.org (port 9418) ... 199.204.44.194 done. <stuck here>

Should I report this elsewhere and/or capture packets with tcpdump?

Can you clone any other git.kernel.org tree?

Works ok for me here...

thanks,

greg k-h

#6 lore raw
Quoted 65 lines · Greg Kroah-Hartman
Quoted 64 lines · Laszlo Ersek
Quoted 46 lines · Greg Kroah-Hartman
Quoted 45 lines · Laszlo Ersek

Greg,

Quoted 41 lines · Laszlo Ersek

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 <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Gustavo Padovan <[email protected]>
Cc Hans de Goede <[email protected]>
Cc Joachim Frieben <[email protected]>
Fixes a325725633c26aa66ab940f762a6b0778edf76c0

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1366842

---
 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(+)
Quoted 5 lines
Quoted 2 lines

Is there any particular reason this patch hasn't been cherry-picked to linux-4.8.y? (I checked v4.8.2.)

Yes, it just showed up in 4.9-rc1 3 days ago, give me a chance to catch up! I have 210 patches right now that are in this same status,

My apologies; I didn't realize the volume.

(
BTW I tried to fetch stable-queue this morning, and just now as well -- for some reason that git command seems consistently stuck for me. It produces some low network traffic, but makes no progress:

Quoted 3 lines

Looking up git.kernel.org ... done.
Connecting to git.kernel.org (port 9418) ... 199.204.44.194 done. <stuck here>

Quoted 5 lines
Quoted 1 line

Should I report this elsewhere and/or capture packets with tcpdump?

Can you clone any other git.kernel.org tree?

Works ok for me here...

Ultimately it succeeded from here as well, but it took 24 minutes and 42 seconds. The actual transfer speed was acceptable (2.95 MiB/s) and the transfer was short:

Looking up git.kernel.org ... done.
Connecting to git.kernel.org (port 9418) ... 198.145.20.140 done. <looooong wait>
remote: Counting objects: 32528, done.
remote: Compressing objects: 100% (15835/15835), done.
remote: Total 32528 (delta 16858), reused 31765 (delta 16547) Receiving objects: 100% (32528/32528), 17.21 MiB | 2.95 MiB/s, done. Resolving deltas: 100% (16858/16858), done.

Quoted 1 line

From git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue

64bb1fafb84e..4e6b3d9223d7 master -> stable-queue/master

I'm used to some navel gazing while the remote counts objects (also used to brand new clones), but this time the delay occurred before that. It could be related to my last pull from stable-queue (64bb1fafb84e) having likely happened in April 2014... I guess "git fetch --verbose" could have given me more info in that initial phase. (Using git version 2.9.2 at the moment.)

All the other remotes I regularly or occasionally pull from (Linus's, kvm, stable, drm...) answer very quickly.

Sorry about the false alarm.

Thanks!
Laszlo