Commit a1e0fea5 authored by Gerd Hoffmann's avatar Gerd Hoffmann Committed by Anthony Liguori

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: default avatarGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent 8ad12514
......@@ -1533,6 +1533,10 @@ static QEMUMachine pc_machine_v0_10 = {
.driver = "virtio-console-pci",
.property = "class",
.value = stringify(PCI_CLASS_DISPLAY_OTHER),
},{
.driver = "virtio-net-pci",
.property = "vectors",
.value = stringify(0),
},
{ /* end of list */ }
},
......
......@@ -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),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment