Skip to contentSkip to conversation

virtio-pci: bugfix

PATCH In review Michael S. Tsirkin 4 participants 4 messages May 6, 2013 – May 9, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-pci: bugfix

mask notifiers are never called without msix, so devices with backend masking like vhost don't work. Call mask notifiers explicitly at startup/cleanup to make it work.

---
 hw/virtio/virtio-pci.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/virtio/virtio-pci.c +4 -0
index 8bba0f3..d0fcc6c 100644
@@ -758,6 +758,10 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
         event_notifier_cleanup(notifier);
     }
 
+    if (!msix_enabled(&proxy->pci_dev) && proxy->vdev->guest_notifier_mask) {
+        proxy->vdev->guest_notifier_mask(proxy->vdev, n, !assign);
+    }
+
     return 0;
 }
 
Signature · 1 line
MST
#1 lore raw
Quoted 7 lines · Michael S. Tsirkin

mask notifiers are never called without msix, so devices with backend masking like vhost don't work. Call mask notifiers explicitly at startup/cleanup to make it work.

/home/aliguori/git/qemu/hw/virtio/virtio-pci.c: In function ‘virtio_pci_set_guest_notifier’:
/home/aliguori/git/qemu/hw/virtio/virtio-pci.c:761:54: error: ‘VirtIODevice’ has no member named ‘guest_notifier_mask’ /home/aliguori/git/qemu/hw/virtio/virtio-pci.c:762:20: error: ‘VirtIODevice’ has no member named ‘guest_notifier_mask’
CC hw/virtio/dataplane/hostmem.o
make: *** [hw/virtio/virtio-pci.o] Error 1

Regards,

Anthony Liguori

Quoted 22 lines
---
 hw/virtio/virtio-pci.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/virtio/virtio-pci.c +4 -0
index 8bba0f3..d0fcc6c 100644
@@ -758,6 +758,10 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
         event_notifier_cleanup(notifier);
     }
 
+    if (!msix_enabled(&proxy->pci_dev) && proxy->vdev->guest_notifier_mask) {
+        proxy->vdev->guest_notifier_mask(proxy->vdev, n, !assign);
+    }
+
     return 0;
 }
 
Signature · 1 line
MST
#2 lore raw
Quoted 38 lines · Anthony Liguori
Quoted 7 lines · Michael S. Tsirkin

mask notifiers are never called without msix, so devices with backend masking like vhost don't work. Call mask notifiers explicitly at startup/cleanup to make it work.

/home/aliguori/git/qemu/hw/virtio/virtio-pci.c: In function ‘virtio_pci_set_guest_notifier’:
/home/aliguori/git/qemu/hw/virtio/virtio-pci.c:761:54: error: ‘VirtIODevice’ has no member named ‘guest_notifier_mask’ /home/aliguori/git/qemu/hw/virtio/virtio-pci.c:762:20: error: ‘VirtIODevice’ has no member named ‘guest_notifier_mask’
CC hw/virtio/dataplane/hostmem.o
make: *** [hw/virtio/virtio-pci.o] Error 1

Regards,

Anthony Liguori

Quoted 19 lines
---
  hw/virtio/virtio-pci.c | 4 ++++
  1 file changed, 4 insertions(+)
hw/virtio/virtio-pci.c +4 -0
index 8bba0f3..d0fcc6c 100644
@@ -758,6 +758,10 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
          event_notifier_cleanup(notifier);
      }
 
+    if (!msix_enabled(&proxy->pci_dev) && proxy->vdev->guest_notifier_mask) {
+        proxy->vdev->guest_notifier_mask(proxy->vdev, n, !assign);
+    }
+
      return 0;
  }
 
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
MST

You need to use, VirtioDeviceClass to use guest_notifier_mask:

    VirtIODevice *vdev = proxy->vdev;
    VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);

then:

    if (!msix_enabled(&proxy->pci_dev) && k->guest_notifier_mask) {
        k->guest_notifier_mask(vdev, n, !assign);
    }

Fred

#3 lore raw
In reply to Michael S. Tsirkin
Quoted 11 lines · Michael S. Tsirkin

mask notifiers are never called without msix, so devices with backend masking like vhost don't work. Call mask notifiers explicitly at startup/cleanup to make it work.

---
 hw/virtio/virtio-pci.c | 4 ++++
 1 file changed, 4 insertions(+)

Please choose a descriptive commit message, not just "bugfix".

Stefan