Skip to contentSkip to conversation

hw/arm/virt: Initialize NICs configured in PCI bus

PATCH In review Ashok Kumar 4 participants 7 messages Jan 6, 2016 – Jan 11, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/arm/virt: Initialize NICs configured in PCI bus

virtio model is used for default case.

---
 hw/arm/virt.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
hw/arm/virt.c +14 -0
index acc1fcb..fd52b76 100644
@@ -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,
Signature · 1 line
2.1.0
#1 lore raw
Quoted 3 lines · Ashok Kumar

virtio model is used for default case.

Could you explain why you think this needs to be done? Virtio networking works OK for me...

I guess from the patch that this is adding support for the legacy '-net' way of configuring networking, but do we need that if we never supported it in the first place? (If virt is the only PCI machine which doesn't support -net syntax that would probably be a strong argument for supporting it.)

thanks
-- PMM

#2 lore raw

On Wed, Jan 06, 2016 at 06:10:15PM +0000, Peter Maydell wrote:
Hi,

Quoted 6 lines · Ashok Kumar
Quoted 3 lines

virtio model is used for default case.

Could you explain why you think this needs to be done?

Yes, for -net. Honestly, I didn't know this is obsolete and the only syntax I knew for networking.

Quoted 1 line

Virtio networking works OK for me...

I tried the new syntax now and it is working fine.

Quoted 7 lines

I guess from the patch that this is adding support for the legacy '-net' way of configuring networking, but do we need that if we never supported it in the first place? (If virt is the only PCI machine which doesn't support -net syntax that would probably be a strong argument for supporting it.)

Fine with me. But there are some documentation for e.g [1] which says "-net" is still supported.

[1] http://www.linux-kvm.org/page/Networking#Compatibility

Thanks,
Ashok

Quoted 4 lines

thanks
-- PMM

#4 lore raw
In reply to a message not in the archive
Quoted 11 lines · Ashok Kumar
Quoted 6 lines · Peter Maydell

I guess from the patch that this is adding support for the legacy '-net' way of configuring networking, but do we need that if we never supported it in the first place? (If virt is the only PCI machine which doesn't support -net syntax that would probably be a strong argument for supporting it.)

Fine with me. But there are some documentation for e.g [1] which says "-net" is still supported.

[1] http://www.linux-kvm.org/page/Networking#Compatibility

I've cc'd the networking maintainer and some other people who might have an opinion. Basically the question is "should we support the legacy -net syntax for new board models which didn't exist back when -net was the only option and have never supported -net" ?

The argument for "don't support it" is that -net is legacy and if there aren't any legacy command lines to support then we should avoid extending the scope of legacy behaviour.

The argument for "do support it" is consistency -- we don't document that -net is only for certain boards, and users will expect that network config options that work on some machines (including x86 PC and many of the ARM embedded board models) will also work on the ARM virt board.

I think my current inclination is to say that virt should support -net, because I would prefer to avoid having yet another speedbump in the path of people trying to move to using KVM-on-ARM based on their previous experience with KVM-on-x86.

thanks
-- PMM

#5 lore raw
Quoted 5 lines · Peter Maydell

I think my current inclination is to say that virt should support -net, because I would prefer to avoid having yet another speedbump in the path of people trying to move to using KVM-on-ARM based on their previous experience with KVM-on-x86.

I agree.

Paolo

#6 lore raw
Quoted 10 lines · Paolo Bonzini
Quoted 5 lines · Peter Maydell

I think my current inclination is to say that virt should support -net, because I would prefer to avoid having yet another speedbump in the path of people trying to move to using KVM-on-ARM based on their previous experience with KVM-on-x86.

I agree.

Paolo

+1

#7 lore raw
Quoted 11 lines · Jason Wang
Quoted 7 lines · Paolo Bonzini
Quoted 5 lines · Peter Maydell

I think my current inclination is to say that virt should support -net, because I would prefer to avoid having yet another speedbump in the path of people trying to move to using KVM-on-ARM based on their previous experience with KVM-on-x86.

Quoted 3 lines
Quoted 1 line

I agree.

+1

OK, we seem to have a consensus. I'm going to apply this patch to target-arm.next, with an expanded commit message:

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.

thanks
-- PMM