From patchwork Wed Apr 9 15:33:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 28103 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ED7BE202DD for ; Wed, 9 Apr 2014 15:56:34 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id fp1sf7557841pdb.0 for ; Wed, 09 Apr 2014 08:56:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=O2VS01L0QxjvzlEkqrperBwQucaz8VSpA1eC4L8+XCc=; b=Rfnjl4NiRg0tKJ/KxpjXrBlZMmQyahlgpya6uO2xAntlPrRpu7LpyU4GLkASwM8kBi +5wjuZ7I6r+LMvxSoSHrngTpVQInhRfiPVDLPu+7E03b99q2Fomr2ZZ2X+mSXsolSuAM y3HRhmQhCHzD15OWOuuf5YwQ3gp6hfQtoA4yZ1rJwW4oeN5FDCy2oYAcZ4rw/C0MpvJe BLX7vN0Pmds/Kw8q26v5x7ewgswwcBcRoLpLa95ofuqTismiTJg50auQlfdbGbtHQNLl syUxxqOsBM+bwwmXAc2oawt77DHkH2SlArEmC7QHNPsGdrTcX1fNrz8Ju1IiIWzAD4rM 3ESQ== X-Gm-Message-State: ALoCoQkhJ4SyWi5CUQp6KcEl/l2hTVXcnMJkI14XZTkQLXYAORYrAfsSmMJd1jjASj3WgJpC3LHc X-Received: by 10.68.201.7 with SMTP id jw7mr5321418pbc.8.1397058994020; Wed, 09 Apr 2014 08:56:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.85 with SMTP id a79ls707847qge.72.gmail; Wed, 09 Apr 2014 08:56:33 -0700 (PDT) X-Received: by 10.52.6.162 with SMTP id c2mr7972240vda.6.1397058993850; Wed, 09 Apr 2014 08:56:33 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id x18si205639vcs.85.2014.04.09.08.56.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Apr 2014 08:56:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id pa12so2271406veb.14 for ; Wed, 09 Apr 2014 08:56:33 -0700 (PDT) X-Received: by 10.52.119.178 with SMTP id kv18mr1007851vdb.39.1397058993779; Wed, 09 Apr 2014 08:56:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp341245vcv; Wed, 9 Apr 2014 08:56:33 -0700 (PDT) X-Received: by 10.229.89.65 with SMTP id d1mr13762714qcm.14.1397058993441; Wed, 09 Apr 2014 08:56:33 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s6si599093qaj.85.2014.04.09.08.56.33 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 09 Apr 2014 08:56:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:46755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXuXW-0002PV-6v for patch@linaro.org; Wed, 09 Apr 2014 11:35:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXuVx-00009M-NQ for qemu-devel@nongnu.org; Wed, 09 Apr 2014 11:34:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXuVo-0000FN-EF for qemu-devel@nongnu.org; Wed, 09 Apr 2014 11:34:13 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:33948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXuVo-0000En-8U for qemu-devel@nongnu.org; Wed, 09 Apr 2014 11:34:04 -0400 Received: by mail-wg0-f45.google.com with SMTP id l18so2627903wgh.28 for ; Wed, 09 Apr 2014 08:34:02 -0700 (PDT) X-Received: by 10.194.110.100 with SMTP id hz4mr10332396wjb.50.1397057642697; Wed, 09 Apr 2014 08:34:02 -0700 (PDT) Received: from midway01-04-00.lavalab ([88.98.47.97]) by mx.google.com with ESMTPSA id ga10sm2170061wjb.23.2014.04.09.08.34.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Apr 2014 08:34:02 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, christoffer.dall@linaro.org, qemu-devel@nongnu.org Date: Wed, 9 Apr 2014 16:33:04 +0100 Message-Id: <1397057589-11779-2-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1397057589-11779-1-git-send-email-eric.auger@linaro.org> References: <1397057589-11779-1-git-send-email-eric.auger@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.45 Cc: peter.maydell@linaro.org, kim.phillips@freescale.com, Kim Phillips , agraf@suse.de, stuart.yoder@freescale.com, alex.williamson@redhat.com, christophe.barnichon@st.com, a.motakis@virtualopensystems.com, kvmarm@lists.cs.columbia.edu Subject: [Qemu-devel] [RFC v2 1/6] hw/arm/virt: add a xgmac device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Kim Phillips This is a hack and only serves as an example of what needs to be done to make the next RFC - add vfio-platform support - work for development purposes on a Calxeda Midway system. We don't want mach-virt to always create this ethernet device - DO NOT APPLY, etc. Initial attempts to convince QEMU to create a memory mapped device on the command line (e.g., -device vfio-platform,name=fff51000.ethernet) would fail with "Parameter 'driver' expects pluggable device type". Any guidance as to how to overcome this apparent design limitation is welcome. RAM is reduced from 30 to 1GiB such as to not overlap the xgmac device's physical address. Not sure if the 30GiB RAM (or whatever the user sets it to with -m) could be set up above 0x1_0000_0000, but there is probably extra work needed to resolve this type of conflict. note: vfio-platform interrupt support development may want interrupt property data filled; here it's omitted for the time being. Not-signed-off-by: Kim Phillips --- hw/arm/virt.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 2bbc931..5d43cf0 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -65,6 +65,7 @@ enum { VIRT_GIC_CPU, VIRT_UART, VIRT_MMIO, + VIRT_ETHERNET, }; typedef struct MemMapEntry { @@ -106,7 +107,8 @@ static const MemMapEntry a15memmap[] = { [VIRT_MMIO] = { 0xa000000, 0x200 }, /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */ /* 0x10000000 .. 0x40000000 reserved for PCI */ - [VIRT_MEM] = { 0x40000000, 30ULL * 1024 * 1024 * 1024 }, + [VIRT_MEM] = { 0x40000000, 1ULL * 1024 * 1024 * 1024 }, + [VIRT_ETHERNET] = { 0xfff51000, 0x1000 }, }; static const int a15irqmap[] = { @@ -291,6 +293,25 @@ static void create_uart(const VirtBoardInfo *vbi, qemu_irq *pic) g_free(nodename); } +static void create_ethernet(const VirtBoardInfo *vbi, qemu_irq *pic) +{ + char *nodename; + hwaddr base = vbi->memmap[VIRT_ETHERNET].base; + hwaddr size = vbi->memmap[VIRT_ETHERNET].size; + const char compat[] = "calxeda,hb-xgmac"; + + sysbus_create_simple("vfio-platform", base, NULL); + + nodename = g_strdup_printf("/ethernet@%" PRIx64, base); + qemu_fdt_add_subnode(vbi->fdt, nodename); + + /* Note that we can't use setprop_string because of the embedded NUL */ + qemu_fdt_setprop(vbi->fdt, nodename, "compatible", compat, sizeof(compat)); + qemu_fdt_setprop_sized_cells(vbi->fdt, nodename, "reg", 2, base, 2, size); + + g_free(nodename); +} + static void create_virtio_devices(const VirtBoardInfo *vbi, qemu_irq *pic) { int i; @@ -425,6 +446,7 @@ static void machvirt_init(QEMUMachineInitArgs *args) } create_uart(vbi, pic); + create_ethernet(vbi, pic); /* Create mmio transports, so the user can create virtio backends * (which will be automatically plugged in to the transports). If