virtio-pci: fix level interrupts
PATCH v2 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 v1:
- rebase to master
hw/virtio/virtio-pci.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/virtio/virtio-pci.c +5 -0
@@ -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 (d);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
Quoted 20 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.
Signed-off-by Michael S. Tsirkin <[email protected]>Tested-by Alexander Graf <[email protected]>---
Changes from v1:
- rebase to masterhw/virtio/virtio-pci.c | 5 +++++ 1 file changed, 5 insertions(+)hw/virtio/virtio-pci.c +0
-0
hw/virtio/virtio-pci.c static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign, · line 747
Quoted 4 lines
hw/virtio/virtio-pci.c +1
-0@@ -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 (d);
I think there is a mistake here. VIRTIO_DEVICE_GET_CLASS(proxy->vdev) should be used.
Quoted 14 lines
hw/virtio/virtio-pci.c +4
-0VirtQueue *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 ; }
Quoted 16 lines · KONRAD Frédéric
Quoted 15 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.
Signed-off-by Michael S. Tsirkin <[email protected]>Tested-by Alexander Graf <[email protected]>---
Changes from v1:
- rebase to masterhw/virtio/virtio-pci.c | 5 +++++ 1 file changed, 5 insertions(+)
Quoted 12 lines
hw/virtio/virtio-pci.c static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign, · line 747
Quoted 9 lines
hw/virtio/virtio-pci.c +1
-0@@ -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 (d);I think there is a mistake here.
VIRTIO_DEVICE_GET_CLASS(proxy->vdev)should be used.
Hmm yes. I just realized I forgot vhostforce=on in my test script, so wasn't testing it at all actually :( Once I force it, it crashes happily.
So self-NAK, sorry about the noise.
Quoted 11 lines
Quoted 11 lines
hw/virtio/virtio-pci.c +4
-0VirtQueue *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 ; }