virtio-pci: bugfix
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
@@ -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
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.
Signed-off-by Michael S. Tsirkin <[email protected]>Tested-by Alexander Graf <[email protected]>
/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@@ -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
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.
Signed-off-by Michael S. Tsirkin <[email protected]>Tested-by Alexander Graf <[email protected]>
/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’
CChw/virtio/dataplane/hostmem.o
make: *** [hw/virtio/virtio-pci.o] Error 1Regards,
Anthony Liguori
Quoted 19 lines
--- hw/virtio/virtio-pci.c | 4 ++++ 1 file changed, 4 insertions(+)hw/virtio/virtio-pci.c +4
-0@@ -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
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.
Signed-off-by Michael S. Tsirkin <[email protected]>Tested-by Alexander Graf <[email protected]>--- hw/virtio/virtio-pci.c | 4 ++++ 1 file changed, 4 insertions(+)
Please choose a descriptive commit message, not just "bugfix".
Stefan