summaryrefslogtreecommitdiffstats
path: root/hw/arm
diff options
context:
space:
mode:
authorAshok Kumar <ashoks@broadcom.com>2016-01-11 15:52:18 +0000
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:28:23 -0600
commit12ccf0f49c7cee40079406db71bc18a26e4e9014 (patch)
tree328e0152a348a68f62e3556fb8932ea0ee7dcc9d /hw/arm
parentd04c41f9f389afb2450ec1789bc4b3c324b8ea01 (diff)
downloadhqemu-12ccf0f49c7cee40079406db71bc18a26e4e9014.zip
hqemu-12ccf0f49c7cee40079406db71bc18a26e4e9014.tar.gz
hw/arm/virt: Support legacy -nic command line syntax
Support the legacy -nic syntax for creating PCI network devices as well as the new-style -device options. This makes life easier for people moving from x86 KVM virtualization to ARM KVM virtualization and expecting their network configuration options to work the same way for both setups. We use "virtio" as the default NIC model if the user doesn't specify one. Signed-off-by: Ashok Kumar <ashoks@broadcom.com> Message-id: 1452091659-17698-1-git-send-email-ashoks@broadcom.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> [PMM: expanded and clarified commit message] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm')
-rw-r--r--hw/arm/virt.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index acc1fcb..fd52b76 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -808,6 +808,7 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic,
DeviceState *dev;
char *nodename;
int i;
+ PCIHostState *pci;
dev = qdev_create(NULL, TYPE_GPEX_HOST);
qdev_init_nofail(dev);
@@ -847,6 +848,19 @@ static void create_pcie(const VirtBoardInfo *vbi, qemu_irq *pic,
sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, pic[irq + i]);
}
+ pci = PCI_HOST_BRIDGE(dev);
+ if (pci->bus) {
+ for (i = 0; i < nb_nics; i++) {
+ NICInfo *nd = &nd_table[i];
+
+ if (!nd->model) {
+ nd->model = g_strdup("virtio");
+ }
+
+ pci_nic_init_nofail(nd, pci->bus, nd->model, NULL);
+ }
+ }
+
nodename = g_strdup_printf("/pcie@%" PRIx64, base);
qemu_fdt_add_subnode(vbi->fdt, nodename);
qemu_fdt_setprop_string(vbi->fdt, nodename,
OpenPOWER on IntegriCloud