diff mbox series

Adds virtio_net as the default netcard for boston board

Message ID 1554096222-29539-2-git-send-email-tjin@wavecomp.com
State New
Headers show
Series Adds virtio_net as the default netcard for boston board | expand

Commit Message

Tommy Jin April 1, 2019, 5:26 a.m. UTC
Boston didn't bring up any netcard by default, this is not so convenient.
As the linux kernel has 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 netcard in qemu.

Signed-off-by: tjin <tjin@wavecomp.com>
---
 hw/mips/boston.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

no-reply@patchew.org April 1, 2019, 9:22 a.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/1554096222-29539-2-git-send-email-tjin@wavecomp.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 1554096222-29539-2-git-send-email-tjin@wavecomp.com
Subject: [Qemu-devel] [PATCH] Adds virtio_net as the default netcard for boston board
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/1554096222-29539-2-git-send-email-tjin@wavecomp.com -> patchew/1554096222-29539-2-git-send-email-tjin@wavecomp.com
Switched to a new branch 'test'
ec8fb94aea Adds virtio_net as the default netcard for boston board

=== OUTPUT BEGIN ===
ERROR: code indent should never use tabs
#35: FILE: hw/mips/boston.c:429:
+^IPCIDevice *eth;$

ERROR: code indent should never use tabs
#37: FILE: hw/mips/boston.c:431:
+^I/*Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET$

WARNING: Block comments use a leading /* on a separate line
#37: FILE: hw/mips/boston.c:431:
+       /*Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET

ERROR: code indent should never use tabs
#38: FILE: hw/mips/boston.c:432:
+^Iof Linux kernel.*/$

WARNING: Block comments use * on subsequent lines
#38: FILE: hw/mips/boston.c:432:
+       /*Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET
+       of Linux kernel.*/

WARNING: Block comments use a trailing */ on a separate line
#38: FILE: hw/mips/boston.c:432:
+       of Linux kernel.*/

ERROR: code indent should never use tabs
#39: FILE: hw/mips/boston.c:433:
+^Ieth = pci_create(bus,$

ERROR: code indent should never use tabs
#40: FILE: hw/mips/boston.c:434:
+^I^I^I^I^I PCI_DEVFN(0, 1), "virtio-net-pci");$

ERROR: code indent should never use tabs
#42: FILE: hw/mips/boston.c:436:
+^Iqdev_set_nic_properties(&eth->qdev, &nd_table[0]);$

ERROR: code indent should never use tabs
#43: FILE: hw/mips/boston.c:437:
+^Iqdev_init_nofail(&eth->qdev);$

ERROR: code indent should never use tabs
#54: FILE: hw/mips/boston.c:564:
+^I/* Network card */$

ERROR: code indent should never use tabs
#55: FILE: hw/mips/boston.c:565:
+^Inetwork_init(&PCI_BRIDGE(&pcie2->root)->sec_bus);$

total: 9 errors, 3 warnings, 36 lines checked

Commit ec8fb94aeabb (Adds virtio_net as the default netcard for boston board) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/1554096222-29539-2-git-send-email-tjin@wavecomp.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
diff mbox series

Patch

diff --git a/hw/mips/boston.c b/hw/mips/boston.c
index e5bab3c..930bb9d 100644
--- a/hw/mips/boston.c
+++ b/hw/mips/boston.c
@@ -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,20 @@  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)
+{
+	PCIDevice *eth;
+
+	/*Please set CONFIG_VIRTIO && CONFIG_VIRTIO_PCI && CONFIG_VIRTIO_NET
+	of Linux kernel.*/
+	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 +560,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)