aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-pci.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-07-15 13:48:25 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-07-16 17:28:53 -0500
commita1e0fea58746d26fea95c94fde1449b684651fd1 (patch)
tree5e8af3095b20b4aae31e7f9ef158b850221595f1 /hw/virtio-pci.c
parent8ad125147085e508325e940d19b300e6c7a7502b (diff)
qdev/compat: virtio-net-pci 0.10 compatibility.
Add vectors property, allowing to turn off msi by setting vectors=0. Add compat property to pc-0.10 disabling msi. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-pci.c')
-rw-r--r--hw/virtio-pci.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 1afc425a1c..1f922c2835 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -19,6 +19,7 @@
#include "pci.h"
//#include "sysemu.h"
#include "msix.h"
+#include "net.h"
/* from Linux's linux/virtio_pci.h */
@@ -87,6 +88,7 @@ typedef struct {
VirtIODevice *vdev;
uint32_t addr;
uint32_t class_code;
+ uint32_t nvectors;
} VirtIOPCIProxy;
/* virtio device */
@@ -486,11 +488,21 @@ static void virtio_net_init_pci(PCIDevice *pci_dev)
VirtIODevice *vdev;
vdev = virtio_net_init(&pci_dev->qdev);
+
+ /* set nvectors from property, unless the user specified something
+ * via -net nic,model=virtio,vectors=n command line option */
+ if (pci_dev->qdev.nd->nvectors == NIC_NVECTORS_UNSPECIFIED)
+ if (proxy->nvectors != NIC_NVECTORS_UNSPECIFIED)
+ vdev->nvectors = proxy->nvectors;
+
virtio_init_pci(proxy, vdev,
PCI_VENDOR_ID_REDHAT_QUMRANET,
PCI_DEVICE_ID_VIRTIO_NET,
PCI_CLASS_NETWORK_ETHERNET,
0x00);
+
+ /* make the actual value visible */
+ proxy->nvectors = vdev->nvectors;
}
static void virtio_balloon_init_pci(PCIDevice *pci_dev)
@@ -520,9 +532,18 @@ static PCIDeviceInfo virtio_info[] = {
{/* end of list */}
},
},{
- .qdev.name = "virtio-net-pci",
- .qdev.size = sizeof(VirtIOPCIProxy),
- .init = virtio_net_init_pci,
+ .qdev.name = "virtio-net-pci",
+ .qdev.size = sizeof(VirtIOPCIProxy),
+ .init = virtio_net_init_pci,
+ .qdev.props = (Property[]) {
+ {
+ .name = "vectors",
+ .info = &qdev_prop_uint32,
+ .offset = offsetof(VirtIOPCIProxy, nvectors),
+ .defval = (uint32_t[]) { NIC_NVECTORS_UNSPECIFIED },
+ },
+ {/* end of list */}
+ },
},{
.qdev.name = "virtio-console-pci",
.qdev.size = sizeof(VirtIOPCIProxy),