Adds virtio_net as the default netcard for boston board
Hi,
This is a patch for Mips Boston board.
Currently, 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
PATCH 1/1 Adds virtio_net as the default netcard for boston board
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.
--- hw/mips/boston.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
hw/mips/boston.c +18 -0
@@ -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 (ð->qdev, &nd_table[0 ]); +qdev_init_nofail (ð->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)
Signature · 1 line
2.7.4
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Message-id: [email protected]
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/[email protected] -> patchew/[email protected]
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(ð->qdev, &nd_table[0]);$
ERROR: code indent should never use tabs
#43: FILE: hw/mips/boston.c:437:
+^Iqdev_init_nofail(ð->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/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]