From patchwork Mon Jun 2 07:49:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 31251 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 34D8D20AE6 for ; Mon, 2 Jun 2014 07:50:20 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id y20sf25858804ier.11 for ; Mon, 02 Jun 2014 00:50:19 -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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=kI3Y5oXP4gkXUWmj5WjrMfToAzQ5lNkMZYK/YYd/U/U=; b=h5rFzl/176ssp75KrAwIMh04L0TvENf1BWYcjZdUH6wk+ZjNDPagGNApCaFnPYburR pDeHoXWO7SjRkVsV0e6uRlFHIw+2q6qsHHQUyn2RPLHnxvIj6Yf2BAxZ11NBuS8DzdfC irbrf2AoNSd08CB1c0yWo0DwI0W+OBGFXoBvDTO0jxNb+kbnLeIHnAbW6kLkIM1cEIVX 4pf6DD+1CTswFY9cyvNVcjld6oPs7aptOB13z0rAXoUKFhOfui+d/2fWHLxmz6yhxFaY o4m7HRatRJjAieLpnFg2hpz8ISRIwW+Yo6XHlQiePBb2peEon5jMmLjPHvzwUZUMEwDH Mtkg== X-Gm-Message-State: ALoCoQnLsxKhixqteM5QbdDD0OPHIt5h3Mbk9w461Ofotx5Sdwt6cVxEYmKP1ykuMypAdqxdIz18 X-Received: by 10.182.227.131 with SMTP id sa3mr14034788obc.38.1401695419679; Mon, 02 Jun 2014 00:50:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.118 with SMTP id f109ls1847261qge.8.gmail; Mon, 02 Jun 2014 00:50:19 -0700 (PDT) X-Received: by 10.58.245.2 with SMTP id xk2mr28704257vec.9.1401695419535; Mon, 02 Jun 2014 00:50:19 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id z8si1078687vel.21.2014.06.02.00.50.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Jun 2014 00:50:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id db11so4691603veb.8 for ; Mon, 02 Jun 2014 00:50:19 -0700 (PDT) X-Received: by 10.220.92.193 with SMTP id s1mr707117vcm.34.1401695419229; Mon, 02 Jun 2014 00:50:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp78759vcb; Mon, 2 Jun 2014 00:50:18 -0700 (PDT) X-Received: by 10.180.218.4 with SMTP id pc4mr6649729wic.21.1401695418096; Mon, 02 Jun 2014 00:50:18 -0700 (PDT) Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) by mx.google.com with ESMTPS id d16si20053506wiv.38.2014.06.02.00.50.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Jun 2014 00:50:18 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.48 as permitted sender) client-ip=74.125.82.48; Received: by mail-wg0-f48.google.com with SMTP id k14so4686432wgh.7 for ; Mon, 02 Jun 2014 00:50:17 -0700 (PDT) X-Received: by 10.180.93.163 with SMTP id cv3mr19978173wib.3.1401695417687; Mon, 02 Jun 2014 00:50:17 -0700 (PDT) Received: from midway01-04-00.lavalab ([88.98.47.97]) by mx.google.com with ESMTPSA id je7sm30286772wic.14.2014.06.02.00.50.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Jun 2014 00:50:17 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, christoffer.dall@linaro.org, qemu-devel@nongnu.org, kim.phillips@freescale.com, a.rigo@virtualopensystems.com Cc: eric.auger@linaro.org, christophe.barnichon@st.com, kvmarm@lists.cs.columbia.edu, alex.williamson@redhat.com, agraf@suse.de, peter.maydell@linaro.org, stuart.yoder@freescale.com, a.motakis@virtualopensystems.com, patches@linaro.org, Kim Phillips Subject: [RFC v3 01/10] hw/arm/virt: add a xgmac device Date: Mon, 2 Jun 2014 08:49:25 +0100 Message-Id: <1401695374-4287-2-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1401695374-4287-1-git-send-email-eric.auger@linaro.org> References: <1401695374-4287-1-git-send-email-eric.auger@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 ea4f02d..becd76b 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 { @@ -104,7 +105,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[] = { @@ -340,6 +342,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; @@ -454,6 +475,7 @@ static void machvirt_init(QEMUMachineInitArgs *args) create_gic(vbi, pic); 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