hw/mips: Use MachineClass->default_nic in the virt machine
PATCH 1/1 hw/mips: Use MachineClass->default_nic in the virt machine
Mark the default NIC via the new MachineClass->default_nic setting so that the machine-defaults code in vl.c can decide whether the default NIC is usable or not (for example when compiling with the "--without-default-devices" configure switch).
Inspired-by Thomas Huth <[email protected]>
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
---
Based-on: <[email protected]>
--- hw/mips/loongson3_virt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/mips/loongson3_virt.c +3 -1
@@ -406,6 +406,7 @@ static inline void loongson3_virt_devices_init(MachineState *machine,PCIBus *pci_bus;DeviceState *dev;MemoryRegion *mmio_reg, *ecam_reg; +MachineClass *mc =MACHINE_GET_CLASS (machine);LoongsonMachineState *s =LOONGSON_MACHINE (machine); dev =qdev_new (TYPE_GPEX_HOST );
@@ -456,7 +457,7 @@ static inline void loongson3_virt_devices_init(MachineState *machine,NICInfo *nd = &nd_table[i];if (!nd->model) { - nd->model =g_strdup ("virtio" ); + nd->model =g_strdup (mc->default_nic); }pci_nic_init_nofail (nd, pci_bus, nd->model,NULL );
@@ -619,6 +620,7 @@ static void loongson3v_machine_class_init(ObjectClass *oc, void *data) mc->default_ram_size =1600 * MiB; mc->kvm_type = mips_kvm_type; mc->minimum_page_bits =14 ; + mc->default_nic ="virtio-net-pci" ; }static const TypeInfo loongson3_machine_types[] = {
Signature · 1 line
2.38.1
Quoted 35 lines · Philippe Mathieu-Daudé
Mark the default NIC via the new
MachineClass->default_nicsetting so that the machine-defaults code invl.ccan decide whether the default NIC is usable or not (for example when compiling with the "--without-default-devices" configure switch).Inspired-by Thomas Huth <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Based-on: <[email protected]>--- hw/mips/loongson3_virt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)hw/mips/loongson3_virt.c +2
-1@@ -406,6 +406,7 @@ static inline void loongson3_virt_devices_init(MachineState *machine,PCIBus *pci_bus;DeviceState *dev;MemoryRegion *mmio_reg, *ecam_reg; +MachineClass *mc =MACHINE_GET_CLASS (machine);LoongsonMachineState *s =LOONGSON_MACHINE (machine); dev =qdev_new (TYPE_GPEX_HOST );@@ -456,7 +457,7 @@ static inline void loongson3_virt_devices_init(MachineState *machine,NICInfo *nd = &nd_table[i];if (!nd->model) { - nd->model =g_strdup ("virtio" ); + nd->model =g_strdup (mc->default_nic); }pci_nic_init_nofail (nd, pci_bus, nd->model,NULL );
hw/mips/loongson3_virt.c static void loongson3v_machine_class_init(ObjectClass *oc, void *data) · line 624
Quoted 5 lines
hw/mips/loongson3_virt.c +1
-0@@ -619,6 +620,7 @@ static void loongson3v_machine_class_init(ObjectClass *oc, void *data) mc->default_ram_size =1600 * MiB; mc->kvm_type = mips_kvm_type; mc->minimum_page_bits =14 ; + mc->default_nic ="virtio-net-pci" ; }
Reviewed-by Thomas Huth <[email protected]>