From patchwork Sat Feb 17 19:22:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 874790 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zkLSD4kySz9ryl for ; Sun, 18 Feb 2018 06:59:07 +1100 (AEDT) Received: from localhost ([::1]:56287 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en8dT-0000zm-Uo for incoming@patchwork.ozlabs.org; Sat, 17 Feb 2018 14:59:03 -0500 Received: from eggs.gnu.org ([208.118.235.92]:48983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en87D-0004pR-F2 for qemu-devel@nongnu.org; Sat, 17 Feb 2018 14:25:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en87B-000828-1u for qemu-devel@nongnu.org; Sat, 17 Feb 2018 14:25:43 -0500 Received: from 9pmail.ess.barracuda.com ([64.235.150.224]:35066) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1en87A-00081I-Sm for qemu-devel@nongnu.org; Sat, 17 Feb 2018 14:25:40 -0500 Received: from MIPSMAIL01.mipstec.com (mailrelay.mips.com [12.201.5.28]) by mx2.ess.sfj.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Sat, 17 Feb 2018 19:25:30 +0000 Received: from pburton-laptop.mipstec.com (10.20.1.18) by mips01.mipstec.com (10.20.43.31) with Microsoft SMTP Server id 14.3.361.1; Sat, 17 Feb 2018 11:20:53 -0800 From: Paul Burton To: Date: Sat, 17 Feb 2018 11:22:15 -0800 Message-ID: <20180217192215.28581-3-paul.burton@mips.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180217192215.28581-1-paul.burton@mips.com> References: <20180217192215.28581-1-paul.burton@mips.com> MIME-Version: 1.0 X-BESS-ID: 1518895530-298553-13206-64174-1 X-BESS-VER: 2018.2-r1802152108 X-BESS-Apparent-Source-IP: 12.201.5.28 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.190133 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 64.235.150.224 Subject: [Qemu-devel] [PATCH 2/2] hw/mips/boston: Enable pch_gbe ethernet controller X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Burton , Yongbok Kim , Aurelien Jarno Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Enable CONFIG_PCH_GBE_PCI in mips64el-softmmu.mak (currently the only default config to enable Boston board support) and create the pch_gbe device when using the Boston board. This provides the board with an ethernet controller matching that found on real Boston boards as part of the Intel EG20T Platform Controller Hub, and allows standard Boston Linux kernels to have network access. This is most easily tested using the downstream linux-mti kernels at the moment, until MIPS support for the Linux pch_gbe driver is upstream. For example, presuming U-Boot's mkimage tool is present in your $PATH, this should be sufficient to boot Linux & see it obtain an IP address using the emulated pch_gbe device: $ git clone git://git.linux-mips.org/pub/scm/linux-mti.git -b eng $ cd linux-mti $ make ARCH=mips 64r6el_defconfig $ make ARCH=mips CROSS_COMPILE=/path/to/compiler/bin/mips-linux-gnu- $ qemu-system-mips64el \ -M boston -cpu I6400 \ -kernel arch/mips/boot/vmlinux.gz.itb \ -serial stdio -append "ip=dhcp" Signed-off-by: Paul Burton Cc: Aurelien Jarno Cc: Yongbok Kim --- default-configs/mips64el-softmmu.mak | 1 + hw/mips/boston.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/default-configs/mips64el-softmmu.mak b/default-configs/mips64el-softmmu.mak index c2ae313f47..85175ea223 100644 --- a/default-configs/mips64el-softmmu.mak +++ b/default-configs/mips64el-softmmu.mak @@ -13,3 +13,4 @@ CONFIG_VT82C686=y CONFIG_MIPS_BOSTON=y CONFIG_FITLOADER=y CONFIG_PCI_XILINX=y +CONFIG_PCH_GBE_PCI=y diff --git a/hw/mips/boston.c b/hw/mips/boston.c index fb23161b33..408977bca1 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -31,6 +31,7 @@ #include "hw/mips/cps.h" #include "hw/mips/cpudevs.h" #include "hw/pci-host/xilinx-pcie.h" +#include "net/net.h" #include "qapi/error.h" #include "qemu/cutils.h" #include "qemu/error-report.h" @@ -430,7 +431,7 @@ static void boston_mach_init(MachineState *machine) MemoryRegion *flash, *ddr, *ddr_low_alias, *lcd, *platreg; MemoryRegion *sys_mem = get_system_memory(); XilinxPCIEHost *pcie2; - PCIDevice *ahci; + PCIDevice *ahci, *eth; DriveInfo *hd[6]; Chardev *chr; int fw_size, fit_err; @@ -529,6 +530,11 @@ static void boston_mach_init(MachineState *machine) ide_drive_get(hd, ahci_get_num_ports(ahci)); ahci_ide_create_devs(ahci, hd); + eth = pci_create(&PCI_BRIDGE(&pcie2->root)->sec_bus, + PCI_DEVFN(0, 1), "pch_gbe"); + qdev_set_nic_properties(ð->qdev, &nd_table[0]); + qdev_init_nofail(ð->qdev); + if (machine->firmware) { fw_size = load_image_targphys(machine->firmware, 0x1fc00000, 4 * M_BYTE);