Commit a1e0fea58746d26fea95c94fde1449b684651fd1
Committed by
Anthony Liguori
1 parent
8ad12514
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>
Showing
2 changed files
with
28 additions
and
3 deletions
hw/pc.c
... | ... | @@ -1533,6 +1533,10 @@ static QEMUMachine pc_machine_v0_10 = { |
1533 | 1533 | .driver = "virtio-console-pci", |
1534 | 1534 | .property = "class", |
1535 | 1535 | .value = stringify(PCI_CLASS_DISPLAY_OTHER), |
1536 | + },{ | |
1537 | + .driver = "virtio-net-pci", | |
1538 | + .property = "vectors", | |
1539 | + .value = stringify(0), | |
1536 | 1540 | }, |
1537 | 1541 | { /* end of list */ } |
1538 | 1542 | }, | ... | ... |
hw/virtio-pci.c
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | #include "pci.h" |
20 | 20 | //#include "sysemu.h" |
21 | 21 | #include "msix.h" |
22 | +#include "net.h" | |
22 | 23 | |
23 | 24 | /* from Linux's linux/virtio_pci.h */ |
24 | 25 | |
... | ... | @@ -87,6 +88,7 @@ typedef struct { |
87 | 88 | VirtIODevice *vdev; |
88 | 89 | uint32_t addr; |
89 | 90 | uint32_t class_code; |
91 | + uint32_t nvectors; | |
90 | 92 | } VirtIOPCIProxy; |
91 | 93 | |
92 | 94 | /* virtio device */ |
... | ... | @@ -486,11 +488,21 @@ static void virtio_net_init_pci(PCIDevice *pci_dev) |
486 | 488 | VirtIODevice *vdev; |
487 | 489 | |
488 | 490 | vdev = virtio_net_init(&pci_dev->qdev); |
491 | + | |
492 | + /* set nvectors from property, unless the user specified something | |
493 | + * via -net nic,model=virtio,vectors=n command line option */ | |
494 | + if (pci_dev->qdev.nd->nvectors == NIC_NVECTORS_UNSPECIFIED) | |
495 | + if (proxy->nvectors != NIC_NVECTORS_UNSPECIFIED) | |
496 | + vdev->nvectors = proxy->nvectors; | |
497 | + | |
489 | 498 | virtio_init_pci(proxy, vdev, |
490 | 499 | PCI_VENDOR_ID_REDHAT_QUMRANET, |
491 | 500 | PCI_DEVICE_ID_VIRTIO_NET, |
492 | 501 | PCI_CLASS_NETWORK_ETHERNET, |
493 | 502 | 0x00); |
503 | + | |
504 | + /* make the actual value visible */ | |
505 | + proxy->nvectors = vdev->nvectors; | |
494 | 506 | } |
495 | 507 | |
496 | 508 | static void virtio_balloon_init_pci(PCIDevice *pci_dev) |
... | ... | @@ -520,9 +532,18 @@ static PCIDeviceInfo virtio_info[] = { |
520 | 532 | {/* end of list */} |
521 | 533 | }, |
522 | 534 | },{ |
523 | - .qdev.name = "virtio-net-pci", | |
524 | - .qdev.size = sizeof(VirtIOPCIProxy), | |
525 | - .init = virtio_net_init_pci, | |
535 | + .qdev.name = "virtio-net-pci", | |
536 | + .qdev.size = sizeof(VirtIOPCIProxy), | |
537 | + .init = virtio_net_init_pci, | |
538 | + .qdev.props = (Property[]) { | |
539 | + { | |
540 | + .name = "vectors", | |
541 | + .info = &qdev_prop_uint32, | |
542 | + .offset = offsetof(VirtIOPCIProxy, nvectors), | |
543 | + .defval = (uint32_t[]) { NIC_NVECTORS_UNSPECIFIED }, | |
544 | + }, | |
545 | + {/* end of list */} | |
546 | + }, | |
526 | 547 | },{ |
527 | 548 | .qdev.name = "virtio-console-pci", |
528 | 549 | .qdev.size = sizeof(VirtIOPCIProxy), | ... | ... |