diff mbox

[for-1.5] virtio-pci: bugfix

Message ID 20130506150027.GA22689@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin May 6, 2013, 3 p.m. UTC
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 <mst@redhat.com>
Tested-by: Alexander Graf <agraf@suse.de>

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

Comments

Anthony Liguori May 6, 2013, 8:51 p.m. UTC | #1
"Michael S. Tsirkin" <mst@redhat.com> writes:

> 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 <mst@redhat.com>
> Tested-by: Alexander Graf <agraf@suse.de>

/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

>
> ---
>  hw/virtio/virtio-pci.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 8bba0f3..d0fcc6c 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -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;
>  }
>  
> -- 
> MST
fred.konrad@greensocs.com May 7, 2013, 9:28 a.m. UTC | #2
On 06/05/2013 22:51, Anthony Liguori wrote:
> "Michael S. Tsirkin" <mst@redhat.com> writes:
>
>> 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 <mst@redhat.com>
>> Tested-by: Alexander Graf <agraf@suse.de>
> /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
>
>> ---
>>   hw/virtio/virtio-pci.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
>> index 8bba0f3..d0fcc6c 100644
>> --- a/hw/virtio/virtio-pci.c
>> +++ b/hw/virtio/virtio-pci.c
>> @@ -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;
>>   }
>>   
>> -- 
>> 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
Stefan Hajnoczi May 9, 2013, 6:48 a.m. UTC | #3
On Mon, May 06, 2013 at 06:00:27PM +0300, Michael S. Tsirkin wrote:
> 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 <mst@redhat.com>
> Tested-by: Alexander Graf <agraf@suse.de>
> 
> ---
>  hw/virtio/virtio-pci.c | 4 ++++
>  1 file changed, 4 insertions(+)

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

Stefan
diff mbox

Patch

diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 8bba0f3..d0fcc6c 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -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;
 }