From patchwork Wed Feb 26 02:37:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kim-phillips X-Patchwork-Id: 25338 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 619CE20143 for ; Wed, 26 Feb 2014 02:39:25 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id w5sf533902qac.8 for ; Tue, 25 Feb 2014 18:39:24 -0800 (PST) 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=ytTgjIwUQbKSrA9Fe0JRw2TSKDVY7sdNEULSfzlQZqA=; b=dKOp3wUMcHc1eTndt7di39zq1aQ/EatclEnZSqdSEu3nNSbd7005/cVsVwllI2bXjo nIprJAt6zD/xlWrBQGGmX7RQAXvVrNFLnVVR1BV4FUcqH57yKCbDDyS8h6/cuAf9Nv4r hPDY51tc5NvmBfQyEbic5Nf0v1eIcB8BrRketPWB2YQ7F+8WpgFrN9PZUlpI49vg6vXA 0ZNsrF3e+rZzK9Gl9fSgmqdWnxINhkAtly7UKh2P0dmMWST0nEoLgf7KDdRe8NXcr6Bv xctZ7czwPslmPus6UbdOK7v++lZRh4szoH/GigNGf69ZgrCpY4XRPGzD3+J98DR9hcth x7eA== X-Gm-Message-State: ALoCoQnEjoD8e/13ZZcRv5B1RH+qiFtuCJHL3QM/3gaJPUluU7jO3hzROzBNqGH3HHlLgGE6Swe7 X-Received: by 10.52.187.41 with SMTP id fp9mr1864197vdc.5.1393382364895; Tue, 25 Feb 2014 18:39:24 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.115 with SMTP id b106ls44862qgd.97.gmail; Tue, 25 Feb 2014 18:39:24 -0800 (PST) X-Received: by 10.58.188.78 with SMTP id fy14mr3886392vec.23.1393382364704; Tue, 25 Feb 2014 18:39:24 -0800 (PST) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id eb8si7324130vdb.8.2014.02.25.18.39.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 18:39:24 -0800 (PST) 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 c14so1538466vea.28 for ; Tue, 25 Feb 2014 18:39:24 -0800 (PST) X-Received: by 10.58.123.70 with SMTP id ly6mr3824283veb.26.1393382364618; Tue, 25 Feb 2014 18:39:24 -0800 (PST) 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.174.196 with SMTP id u4csp183935vcz; Tue, 25 Feb 2014 18:39:24 -0800 (PST) X-Received: by 10.140.90.80 with SMTP id w74mr4457063qgd.96.1393382364209; Tue, 25 Feb 2014 18:39:24 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id y1si5886793qce.57.2014.02.25.18.39.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 25 Feb 2014 18:39:24 -0800 (PST) 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]:37900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIUP5-0008Lv-SI for patch@linaro.org; Tue, 25 Feb 2014 21:39:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIUOQ-0007jJ-4x for qemu-devel@nongnu.org; Tue, 25 Feb 2014 21:38:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WIUOK-0001Iq-9n for qemu-devel@nongnu.org; Tue, 25 Feb 2014 21:38:42 -0500 Received: from mail-oa0-f49.google.com ([209.85.219.49]:56669) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIUOK-0001Ij-5v for qemu-devel@nongnu.org; Tue, 25 Feb 2014 21:38:36 -0500 Received: by mail-oa0-f49.google.com with SMTP id i4so204468oah.36 for ; Tue, 25 Feb 2014 18:38:35 -0800 (PST) X-Received: by 10.182.24.69 with SMTP id s5mr489851obf.35.1393382315546; Tue, 25 Feb 2014 18:38:35 -0800 (PST) Received: from ntel.linksys (cpe-70-112-130-68.austin.res.rr.com. [70.112.130.68]) by mx.google.com with ESMTPSA id kn10sm145842968oeb.0.2014.02.25.18.38.33 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 18:38:34 -0800 (PST) From: Kim Phillips To: qemu-devel@nongnu.org Date: Tue, 25 Feb 2014 20:37:51 -0600 Message-Id: <1393382272-29021-2-git-send-email-kim.phillips@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1393382272-29021-1-git-send-email-kim.phillips@linaro.org> References: <1393382272-29021-1-git-send-email-kim.phillips@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.219.49 Cc: Peter Maydell , kim.phillips@freescale.com, eric.auger@linaro.org, kim.phillips@linaro.org, agraf@suse.de, stuart.yoder@freescale.com, alex.williamson@redhat.com, Antonios Motakis , kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org Subject: [Qemu-devel] [RFC 1/2] hw/arm/virt: add a Calxeda 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: kim.phillips@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 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 517f2fe..75edf33 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; @@ -419,6 +440,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