Skip to contentSkip to conversation

Adds virtio_net as the default netcard for mips boston board

Qemu-devel In review Tommy Jin 3 participants 12 messages Apr 1, 2019 – Apr 3, 2019

lore
Share & tools
lore

Tommy Jin

author
#0 lore raw

Hi,

This is a patch for Mips Boston board.
Boston didn't bring up any netcard by default, this is not so convenient for users who are verifying network related functionalities on this board. As the linux kernel has already supported virtio_net, now add a virtio netcard for boston, to make virtio work properly, please:
1. set virtio net options in linux kernel, saying CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET
2. specify model=virtio when you start boston in qemu.

Best regards,
Tommy

author
#1 lore raw

PATCH 1/1 Adds virtio_net as the default netcard for mips boston board.

Boston didn't bring up any netcard by default, this is not so convenient for users who are verifying network related functionalities on this board. As the linux kernel has already supported virtio_net, now add a virtio netcard for boston, to make virtio work properly, please:
1. set virtio net options in linux kernel, saying CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET
2. specify model=virtio when you start boston in qemu.

---
 hw/mips/boston.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/mips/boston.c +3 -3
index cac0e22..5d3239e 100644
@@ -428,10 +428,10 @@ static void network_init(PCIBus *bus)
 {
     PCIDevice *eth;
 
-    /*Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET
-        of Linux kernel.*/
+    /* Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET */
+    /* of Linux kernel. */
     eth = pci_create(bus,
-					 PCI_DEVFN(0, 1), "virtio-net-pci");
+                     PCI_DEVFN(0, 1), "virtio-net-pci");
 
     qdev_set_nic_properties(&eth->qdev, &nd_table[0]);
     qdev_init_nofail(&eth->qdev);
Signature · 1 line
2.7.4
#2 lore raw

Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Quoted 16 lines · Tommy Jin

Boston didn't bring up any netcard by default, this is not so convenient for users who are verifying network related functionalities on this board. As the linux kernel has already supported virtio_net, now add a virtio netcard for boston, to make virtio work properly, please:
1. set virtio net options in linux kernel, saying CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET
2. specify model=virtio when you start boston in qemu.

---
 hw/mips/boston.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/mips/boston.c +0 -0
index cac0e22..5d3239e 100644

hw/mips/boston.c static void network_init(PCIBus *bus) · line 432

Quoted 7 lines
hw/mips/boston.c +2 -2
@@ -428,10 +428,10 @@ static void network_init(PCIBus *bus)
 {
     PCIDevice *eth;
 
-    /*Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET
-        of Linux kernel.*/
+    /* Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET */
+    /* of Linux kernel. */

This sort of thing should go in documentation, not as a comment in the code.

hw/mips/boston.c static void network_init(PCIBus *bus) · line 434

Quoted 3 lines
hw/mips/boston.c +1 -1
     eth = pci_create(bus,
-                                        PCI_DEVFN(0, 1), "virtio-net-pci");
+                     PCI_DEVFN(0, 1), "virtio-net-pci");

Am I missing something, or is this patch not actually changing any code? Maybe you made a mistake somehow when creating it?

I'm not sure if we want to create a default network card for this board -- the user (or more usually the management layer like libvirt) can create it on the command line, and if we always create a virtio-net-pci device in the code then the user has no way to say they *don't* want the device.

Also, this board is a model of a real piece of hardware, and the real hardware doesn't have a virtio-net device in it.

hw/mips/boston.c static void network_init(PCIBus *bus)

Quoted 4 lines
hw/mips/boston.c +0 -1
     qdev_set_nic_properties(&eth->qdev, &nd_table[0]);
     qdev_init_nofail(&eth->qdev);
--

thanks
-- PMM

#3 lore raw

Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Quoted 4 lines · Peter Maydell
Quoted 2 lines · Tommy Jin

Boston didn't bring up any netcard by default, this is not so

convenient for users who are verifying network related functionalities on this board.

Quoted 1 line
Quoted 1 line

As the linux kernel has already supported virtio_net, now add a virtio

netcard for boston, to make virtio work properly, please:

Quoted 1 line
Quoted 1 line

1. set virtio net options in linux kernel, saying CONFIG_VIRTIO &&

CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET

Quoted 15 lines
Quoted 15 lines

2. specify model=virtio when you start boston in qemu.

---
 hw/mips/boston.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/mips/boston.c +0 -0
index cac0e22..5d3239e 100644
@@ -428,10 +428,10 @@ static void network_init(PCIBus *bus)
 {
     PCIDevice *eth;
 
Quoted 1 line

hw/mips/boston.c static void network_init(PCIBus *bus) · line 431

Quoted 1 line
hw/mips/boston.c +0 -1
-    /*Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI &&

CONFIG_VIRTIO_NET

Quoted 2 lines

hw/mips/boston.c static void network_init(PCIBus *bus) · line 431

Quoted 2 lines
hw/mips/boston.c +1 -1
-        of Linux kernel.*/
+    /* Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI &&

CONFIG_VIRTIO_NET */

Quoted 7 lines

hw/mips/boston.c static void network_init(PCIBus *bus) · line 432

Quoted 1 line
hw/mips/boston.c +1 -0
+    /* of Linux kernel. */

This sort of thing should go in documentation, not as a comment in the code.

Quoted 2 lines
hw/mips/boston.c +0 -1
     eth = pci_create(bus,
-                                        PCI_DEVFN(0, 1),

"virtio-net-pci");

Quoted 16 lines

hw/mips/boston.c static void network_init(PCIBus *bus) · line 434

Quoted 1 line
hw/mips/boston.c +1 -0
+                     PCI_DEVFN(0, 1), "virtio-net-pci");

Am I missing something, or is this patch not actually changing any code? Maybe you made a mistake somehow when creating it?

I'm not sure if we want to create a default network card for this board -- the user (or more usually the management layer like libvirt) can create it on the command line, and if we always create a virtio-net-pci device in the code then the user has no way to say they *don't* want the device.

Also, this board is a model of a real piece of hardware, and the real hardware doesn't have a virtio-net device in it.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
     qdev_set_nic_properties(&eth->qdev, &nd_table[0]);
     qdev_init_nofail(&eth->qdev);

--

thanks
-- PMM

Just adding Paul Burton, the Boston card emulation maintainer.

Aleksandar

author
#4 lore raw

Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Hi Peter,

Thank you very much for you comments,I sent a wrong patch out by mistake.

If always creating virtio-net-pci device is not a good idea, is it feasible to make virtio-net-pci as an option for boston without using libvirt? we can only create this device when the user specify "model=virtio".

Actually, Botson board can have an Intel GBE network card in it, compared to mips malta, it also has a pcnet network card created in its machine, is it acceptable to create a pch_gbe network card if the user specify like "model=pch_gbe"?

Best regards,

Tommy

________________________________
From: Aleksandar Markovic <[email protected]>
Sent: Tuesday, April 2, 2019 10:25 AM
To: Peter Maydell
Cc: Tommy Jin; [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Quoted 47 lines · On Apr 1, 2019 11:39 AM, "Peter Maydell"…
Quoted 16 lines · On Mon, 1 Apr 2019 at 16:23, Tommy Jin <[email protected]<mailto:tjin@wavecomp.…

Boston didn't bring up any netcard by default, this is not so convenient for users who are verifying network related functionalities on this board. As the linux kernel has already supported virtio_net, now add a virtio netcard for boston, to make virtio work properly, please:
1. set virtio net options in linux kernel, saying CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET
2. specify model=virtio when you start boston in qemu.

---
 hw/mips/boston.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/mips/boston.c +0 -0
index cac0e22..5d3239e 100644

hw/mips/boston.c static void network_init(PCIBus *bus) · line 432

Quoted 7 lines
hw/mips/boston.c +2 -2
@@ -428,10 +428,10 @@ static void network_init(PCIBus *bus)
 {
     PCIDevice *eth;
 
-    /*Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET
-        of Linux kernel.*/
+    /* Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET */
+    /* of Linux kernel. */

This sort of thing should go in documentation, not as a comment in the code.

hw/mips/boston.c static void network_init(PCIBus *bus) · line 434

Quoted 3 lines
hw/mips/boston.c +1 -1
     eth = pci_create(bus,
-                                        PCI_DEVFN(0, 1), "virtio-net-pci");
+                     PCI_DEVFN(0, 1), "virtio-net-pci");

Am I missing something, or is this patch not actually changing any code? Maybe you made a mistake somehow when creating it?

I'm not sure if we want to create a default network card for this board -- the user (or more usually the management layer like libvirt) can create it on the command line, and if we always create a virtio-net-pci device in the code then the user has no way to say they *don't* want the device.

Also, this board is a model of a real piece of hardware, and the real hardware doesn't have a virtio-net device in it.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
     qdev_set_nic_properties(&eth->qdev, &nd_table[0]);
     qdev_init_nofail(&eth->qdev);

--

thanks
-- PMM

Just adding Paul Burton, the Boston card emulation maintainer.

Aleksandar

#5 lore raw

Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Quoted 3 lines · Tommy Jin

If always creating virtio-net-pci device is not a good idea, is it feasible to make virtio-net-pci as an option for boston without using libvirt?

It's always an option, just specify it on the command line.

Quoted 4 lines

Actually, Botson board can have an Intel GBE network card in it, compared to mips malta, it also has a pcnet network card created in its machine, is it acceptable to create a pch_gbe network card if the user specify like "model=pch_gbe"?

Again, optional pluggable cards should just be created without any board code required if the user specifies them on the command line.

In general, the QEMU command line does not aim for "short, do what the user probably wants without them specifying many options". It aims for "be flexible, allow the user to configure what they want". The user-friendly interface is supposed to be the next level up (libvirt, etc). This does mean that command lines can get quite long in some cases. That's unfortunate but I don't think we should be putting workarounds for that in individual board models.

thanks
-- PMM

author
#6 lore raw

Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Hi Peter,

I'm glad to hear these qemu general rules from you. Here you raised two options:

1. Using a tool like libvirt to add a pluggable network card
2. Specify the network card on the command line

For the option2, I think specify the network model in command line is not enough, per my understanding, we still need to create the device using API like pci_create && qdev_set_nic_properties && qdev_init_nofail, otherwise we'll get error prompts like "requested NIC (anonymous, model virtio) was not created (not supported by this machine?)", currently I just add these pieces of code in /hw/mips/boston.c, Do you call these pieces of code board code and what's your suggestion?

You mentioned "optional pluggable cards should just be created without any board code required if the user specifies them on the command line." I don't quite understand what you mean, if I don't want to use option1, how to create pluggable cards without any board code?

Best regards,
Tommy
________________________________
From: Peter Maydell <[email protected]>
Sent: Tuesday, April 2, 2019 10:37 AM
To: Tommy Jin
Cc: Aleksandar Markovic; [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Quoted 3 lines · Tommy Jin

If always creating virtio-net-pci device is not a good idea, is it feasible to make virtio-net-pci as an option for boston without using libvirt?

It's always an option, just specify it on the command line.

Quoted 4 lines

Actually, Botson board can have an Intel GBE network card in it, compared to mips malta, it also has a pcnet network card created in its machine, is it acceptable to create a pch_gbe network card if the user specify like "model=pch_gbe"?

Again, optional pluggable cards should just be created without any board code required if the user specifies them on the command line.

In general, the QEMU command line does not aim for "short, do what the user probably wants without them specifying many options". It aims for "be flexible, allow the user to configure what they want". The user-friendly interface is supposed to be the next level up (libvirt, etc). This does mean that command lines can get quite long in some cases. That's unfortunate but I don't think we should be putting workarounds for that in individual board models.

thanks
-- PMM

From 5ecb77ec9f6f1cfb02b23cdb9a1eb2eca905b12e Mon Sep 17 00:00:00 2001
From: tjin <[email protected]>
Date: Tue, 2 Apr 2019 14:48:25 +0800
Subject: [PATCH] adds a virtio_net netcard for mips boston board

Adds a network card for boston to make it convenient for users who are verifying network related functionalities on this board. As the linux kernel has already supported virtio_net, now add a virtio netcard for boston, to make virtio work properly, please:
1. set virtio net options in linux kernel, saying CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET
2. specify model=virtio when you start boston in qemu.

---
 hw/mips/boston.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
hw/mips/boston.c +21 -0
index e5bab3c..97c1728 100644
@@ -32,6 +32,7 @@
 #include "hw/mips/cps.h"
 #include "hw/mips/cpudevs.h"
 #include "hw/pci-host/xilinx-pcie.h"
+#include "hw/virtio/virtio-pci.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "qemu/log.h"
@@ -422,6 +423,23 @@ xilinx_pcie_init(MemoryRegion *sys_mem, uint32_t bus_nr,
     return XILINX_PCIE_HOST(dev);
 }
 
+/* Plug network card  in pcie slot.*/
+static void network_init(PCIBus *bus)
+{
+    NICInfo *nd = &nd_table[0];
+    PCIDevice *eth;
+
+    /* Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET */
+    /* of Linux kernel. */
+    if (nd->model && strcmp(nd->model, "virtio") == 0) {
+        eth = pci_create(bus,
+                        PCI_DEVFN(0, 1), "virtio-net-pci");
+
+        qdev_set_nic_properties(&eth->qdev, &nd_table[0]);
+        qdev_init_nofail(&eth->qdev);
+    }
+}
+
 static void boston_mach_init(MachineState *machine)
 {
     DeviceState *dev;
@@ -545,6 +563,9 @@ static void boston_mach_init(MachineState *machine)
         error_printf("Please provide either a -kernel or -bios argument\n");
         exit(1);
     }
+
+    /* Network card */
+    network_init(&PCI_BRIDGE(&pcie2->root)->sec_bus);
 }
 
 static void boston_mach_class_init(MachineClass *mc)
Signature · 1 line
2.7.4
#7 lore raw

Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Quoted 7 lines · Tommy Jin

For the option2, I think specify the network model in command line is not enough, per my understanding, we still need to create the device using API like pci_create && qdev_set_nic_properties && qdev_init_nofail, otherwise we'll get error prompts like "requested NIC (anonymous, model virtio) was not created (not supported by this machine?)", currently I just add these pieces of code in /hw/mips/boston.c, Do you call these pieces of code board code and what's your suggestion?

If the boston board has PCI support and it is implemented correctly then you should be able to create a virtio network setup with command line options like
-netdev user,id=mynet -device virtio-net-pci,netdev=mynet

(or any other netdev backend, eg tun/tap).

I don't have a boston image/command line to test that with, but it works for arm boards and should be the same for any pci capable board model.

thanks
-- PMM

author
#8 lore raw

Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Hi Peter,

That command line option doesn't work for boston, although I didn't get any obvious error, no Ethernet card appears either.

Where can I get that arm image/command which can work well for you with " -netdev user,id=mynet -device virtio-net-pci,netdev=mynet" ?

Anyway, if that command line option works for arm, I'm going to investigate the reason.

Best regards,

Tommy

________________________________
From: Peter Maydell <[email protected]>
Sent: Tuesday, April 2, 2019 3:35:19 PM
To: Tommy Jin
Cc: Aleksandar Markovic; [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Quoted 7 lines · Tommy Jin

For the option2, I think specify the network model in command line is not enough, per my understanding, we still need to create the device using API like pci_create && qdev_set_nic_properties && qdev_init_nofail, otherwise we'll get error prompts like "requested NIC (anonymous, model virtio) was not created (not supported by this machine?)", currently I just add these pieces of code in /hw/mips/boston.c, Do you call these pieces of code board code and what's your suggestion?

If the boston board has PCI support and it is implemented correctly then you should be able to create a virtio network setup with command line options like
-netdev user,id=mynet -device virtio-net-pci,netdev=mynet

(or any other netdev backend, eg tun/tap).

I don't have a boston image/command line to test that with, but it works for arm boards and should be the same for any pci capable board model.

thanks
-- PMM

#9 lore raw

Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Quoted 1 line · Tommy Jin

That command line option doesn't work for boston, although I didn't get any obvious error, no Ethernet card appears either.

Does the guest kernel find the PCI device (eg appears in kernel bootup messages, appears in 'lspci' output)? It's worth double-checking that your guest kernel's config has enabled support for PCI, for the PCI controller used by the boston board, for virtio-net, etc.

Quoted 1 line

Where can I get that arm image/command which can work well for you with " -netdev user,id=mynet -device virtio-net-pci,netdev=mynet" ?

https://translatedcode.wordpress.com/2017/07/24/installing-debian-on-qemus-64-bit-arm-virt-board/
has instructions for booting Debian which use that command line.

thanks
-- PMM

#10 lore raw

Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

In reply to Tommy Jin
Quoted 9 lines · Tommy Jin

Hi Peter,

Thank you very much for you comments,I sent a wrong patch out by mistake.

If always creating virtio-net-pci device is not a good idea, is it

feasible to make virtio-net-pci as an option for boston without using libvirt? we can only create this device when the user specify "model=virtio".

Quoted 3 lines

Actually, Botson board can have an Intel GBE network card in it, compared

to mips malta, it also has a pcnet network card created in its machine, is it acceptable to create a pch_gbe network card if the user specify like "model=pch_gbe"?

Quoted 7 lines

Best regards,

Tommy

Hello, Tommy.

Thanks for your efforts in this area. However, your patches will have greater chances of serious considering and accepting if you follow the rules of submitting them to this list. There is a page on contributing called “How to submit a patch“ on QEMU website. Please read it carefully and follow each step.

Welcome to qemu-devel! I wish you continue to contribute to QEMU many improvements.

Aleksandar
________________________________

Quoted 5 lines

From: Aleksandar Markovic <[email protected]>
Sent: Tuesday, April 2, 2019 10:25 AM
To: Peter Maydell
Cc: Tommy Jin; [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard

for mips boston board.

Quoted 8 lines · Peter Maydell
Quoted 4 lines · Tommy Jin
Quoted 2 lines

Boston didn't bring up any netcard by default, this is not so

convenient for users who are verifying network related functionalities on this board.

Quoted 1 line
Quoted 1 line
Quoted 1 line

As the linux kernel has already supported virtio_net, now add a

virtio netcard for boston, to make virtio work properly, please:

Quoted 1 line
Quoted 1 line
Quoted 1 line

1. set virtio net options in linux kernel, saying CONFIG_VIRTIO &&

CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

2. specify model=virtio when you start boston in qemu.

---
 hw/mips/boston.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/mips/boston.c +0 -0
index cac0e22..5d3239e 100644
@@ -428,10 +428,10 @@ static void network_init(PCIBus *bus)
 {
     PCIDevice *eth;
 
Quoted 1 line
Quoted 1 line

hw/mips/boston.c static void network_init(PCIBus *bus) · line 431

Quoted 1 line
hw/mips/boston.c +0 -1
-    /*Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI &&

CONFIG_VIRTIO_NET

Quoted 2 lines
Quoted 2 lines

hw/mips/boston.c static void network_init(PCIBus *bus) · line 431

Quoted 2 lines
hw/mips/boston.c +1 -1
-        of Linux kernel.*/
+    /* Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI &&

CONFIG_VIRTIO_NET */

Quoted 7 lines
Quoted 7 lines

hw/mips/boston.c static void network_init(PCIBus *bus) · line 432

Quoted 1 line
hw/mips/boston.c +1 -0
+    /* of Linux kernel. */

This sort of thing should go in documentation, not as a comment in the code.

Quoted 2 lines
hw/mips/boston.c +0 -1
     eth = pci_create(bus,
-                                        PCI_DEVFN(0, 1),

"virtio-net-pci");

Quoted 27 lines
Quoted 16 lines

hw/mips/boston.c static void network_init(PCIBus *bus) · line 434

Quoted 1 line
hw/mips/boston.c +1 -0
+                     PCI_DEVFN(0, 1), "virtio-net-pci");

Am I missing something, or is this patch not actually changing any code? Maybe you made a mistake somehow when creating it?

I'm not sure if we want to create a default network card for this board -- the user (or more usually the management layer like libvirt) can create it on the command line, and if we always create a virtio-net-pci device in the code then the user has no way to say they *don't* want the device.

Also, this board is a model of a real piece of hardware, and the real hardware doesn't have a virtio-net device in it.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
     qdev_set_nic_properties(&eth->qdev, &nd_table[0]);
     qdev_init_nofail(&eth->qdev);

--

thanks
-- PMM

Just adding Paul Burton, the Boston card emulation maintainer.

Aleksandar

author
#11 lore raw

Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Hi Aleksandar,

I understand, Thank you very much for reminding me.

Regards,

Tommy

________________________________
From: Aleksandar Markovic <[email protected]>
Sent: Tuesday, April 2, 2019 10:43 AM
To: Tommy Jin
Cc: Peter Maydell; [email protected]; Paul Burton
Subject: Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Quoted 11 lines · On Apr 2, 2019 4:29 AM, "Tommy Jin" <[email protected]<mailto:[email protected]…

Hi Peter,

Thank you very much for you comments,I sent a wrong patch out by mistake.

If always creating virtio-net-pci device is not a good idea, is it feasible to make virtio-net-pci as an option for boston without using libvirt? we can only create this device when the user specify "model=virtio".

Quoted 8 lines

Actually, Botson board can have an Intel GBE network card in it, compared to mips malta, it also has a pcnet network card created in its machine, is it acceptable to create a pch_gbe network card if the user specify like "model=pch_gbe"?

Best regards,

Tommy

Hello, Tommy.

Thanks for your efforts in this area. However, your patches will have greater chances of serious considering and accepting if you follow the rules of submitting them to this list. There is a page on contributing called “How to submit a patch“ on QEMU website. Please read it carefully and follow each step.

Welcome to qemu-devel! I wish you continue to contribute to QEMU many improvements.

Aleksandar
________________________________

Quoted 67 lines

From: Aleksandar Markovic <[email protected]<mailto:[email protected]>>
Sent: Tuesday, April 2, 2019 10:25 AM
To: Peter Maydell
Cc: Tommy Jin; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for mips boston board.

Quoted 47 lines · On Apr 1, 2019 11:39 AM, "Peter Maydell"…
Quoted 16 lines · On Mon, 1 Apr 2019 at 16:23, Tommy Jin <[email protected]<mailto:tjin@wavecomp.…

Boston didn't bring up any netcard by default, this is not so convenient for users who are verifying network related functionalities on this board. As the linux kernel has already supported virtio_net, now add a virtio netcard for boston, to make virtio work properly, please:
1. set virtio net options in linux kernel, saying CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET
2. specify model=virtio when you start boston in qemu.

---
 hw/mips/boston.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/mips/boston.c +0 -0
index cac0e22..5d3239e 100644

hw/mips/boston.c static void network_init(PCIBus *bus) · line 432

Quoted 7 lines
hw/mips/boston.c +2 -2
@@ -428,10 +428,10 @@ static void network_init(PCIBus *bus)
 {
     PCIDevice *eth;
 
-    /*Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET
-        of Linux kernel.*/
+    /* Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET */
+    /* of Linux kernel. */

This sort of thing should go in documentation, not as a comment in the code.

hw/mips/boston.c static void network_init(PCIBus *bus) · line 434

Quoted 3 lines
hw/mips/boston.c +1 -1
     eth = pci_create(bus,
-                                        PCI_DEVFN(0, 1), "virtio-net-pci");
+                     PCI_DEVFN(0, 1), "virtio-net-pci");

Am I missing something, or is this patch not actually changing any code? Maybe you made a mistake somehow when creating it?

I'm not sure if we want to create a default network card for this board -- the user (or more usually the management layer like libvirt) can create it on the command line, and if we always create a virtio-net-pci device in the code then the user has no way to say they *don't* want the device.

Also, this board is a model of a real piece of hardware, and the real hardware doesn't have a virtio-net device in it.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
     qdev_set_nic_properties(&eth->qdev, &nd_table[0]);
     qdev_init_nofail(&eth->qdev);

--

thanks
-- PMM

Just adding Paul Burton, the Boston card emulation maintainer.

Aleksandar