Skip to contentSkip to conversation

virtio-pci: fix level interrupts

PATCH Applied Michael S. Tsirkin 2 participants 3 messages May 7, 2013 – May 13, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 virtio-pci: fix level interrupts

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.

---

changes from v2:
fix bug spotted by Konrad
changes from v1:
rebased to master

I'm guessing this missed 1.5. Added for-1.5 just in case - probably should go into 1.5.1.

 hw/virtio/virtio-pci.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/virtio/virtio-pci.c +5 -0
index d8708c1..195ee04 100644
@@ -744,6 +744,7 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
                                          bool with_irqfd)
 {
     VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
+    VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(proxy->vdev);
     VirtQueue *vq = virtio_get_queue(proxy->vdev, n);
     EventNotifier *notifier = virtio_queue_get_guest_notifier(vq);
 
@@ -758,6 +759,10 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
         event_notifier_cleanup(notifier);
     }
 
+    if (!msix_enabled(&proxy->pci_dev) && vdc->guest_notifier_mask) {
+        vdc->guest_notifier_mask(proxy->vdev, n, !assign);
+    }
+
     return 0;
 }
 
Signature · 1 line
MST
#1 lore raw
Quoted 9 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.

---

Quoted 7 lines

changes from v2:
fix bug spotted by Konrad
changes from v1:
rebased to master

I'm guessing this missed 1.5. Added for-1.5 just in case - probably should go into 1.5.1.

Not sure I made this clear.
If we can put it in 1.5 great, if not it must go into stable branch.

Quoted 28 lines
 hw/virtio/virtio-pci.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/virtio/virtio-pci.c +5 -0
index d8708c1..195ee04 100644
@@ -744,6 +744,7 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
                                          bool with_irqfd)
 {
     VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
+    VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(proxy->vdev);
     VirtQueue *vq = virtio_get_queue(proxy->vdev, n);
     EventNotifier *notifier = virtio_queue_get_guest_notifier(vq);
 
@@ -758,6 +759,10 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
         event_notifier_cleanup(notifier);
     }
 
+    if (!msix_enabled(&proxy->pci_dev) && vdc->guest_notifier_mask) {
+        vdc->guest_notifier_mask(proxy->vdev, n, !assign);
+    }
+
     return 0;
 }
 
Signature · 1 line
MST
#2 lore raw
In reply to Michael S. Tsirkin
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.

Applied, thanks. There was no notification email because I applied it by hand because the subject is not well formed.

Regards,

Anthony Liguori

Quoted 38 lines

---

changes from v2:
fix bug spotted by Konrad
changes from v1:
rebased to master

I'm guessing this missed 1.5. Added for-1.5 just in case - probably should go into 1.5.1.

 hw/virtio/virtio-pci.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/virtio/virtio-pci.c +5 -0
index d8708c1..195ee04 100644
@@ -744,6 +744,7 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
                                          bool with_irqfd)
 {
     VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
+    VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(proxy->vdev);
     VirtQueue *vq = virtio_get_queue(proxy->vdev, n);
     EventNotifier *notifier = virtio_queue_get_guest_notifier(vq);
 
@@ -758,6 +759,10 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign,
         event_notifier_cleanup(notifier);
     }
 
+    if (!msix_enabled(&proxy->pci_dev) && vdc->guest_notifier_mask) {
+        vdc->guest_notifier_mask(proxy->vdev, n, !assign);
+    }
+
     return 0;
 }
 
Signature · 1 line
MST