summary refs log tree commit diff stats
path: root/hw/virtio-pci.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-11-24 13:28:52 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-28 11:36:28 -0600
commitad0c93328dcb7a0ad68a68d0f66ea1949ebaaa2d (patch)
treed63b95103e8003a2aa5592b3d6bf9b8fbd92ff40 /hw/virtio-pci.c
parentae0f940e6b4f5177892dd6a12762282fa9089972 (diff)
downloadfocaccia-qemu-ad0c93328dcb7a0ad68a68d0f66ea1949ebaaa2d.tar.gz
focaccia-qemu-ad0c93328dcb7a0ad68a68d0f66ea1949ebaaa2d.zip
virtio: add and use virtio_set_features
vdev->guest_features is not masking features that are not supported by
the guest.  Fix this by introducing a common wrapper to be used by all
virtio bus implementations.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-pci.c')
-rw-r--r--hw/virtio-pci.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index ca5923c495..64c6a9414f 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -285,14 +285,9 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
     case VIRTIO_PCI_GUEST_FEATURES:
 	/* Guest does not negotiate properly?  We have to assume nothing. */
 	if (val & (1 << VIRTIO_F_BAD_FEATURE)) {
-	    if (vdev->bad_features)
-		val = proxy->host_features & vdev->bad_features(vdev);
-	    else
-		val = 0;
+            val = vdev->bad_features ? vdev->bad_features(vdev) : 0;
 	}
-        if (vdev->set_features)
-            vdev->set_features(vdev, val);
-        vdev->guest_features = val;
+        virtio_set_features(vdev, val);
         break;
     case VIRTIO_PCI_QUEUE_PFN:
         pa = (target_phys_addr_t)val << VIRTIO_PCI_QUEUE_ADDR_SHIFT;