From patchwork Thu Oct 17 16:48:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 21101 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D5BC7246F1 for ; Thu, 17 Oct 2013 16:48:53 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id hu19sf709426vcb.1 for ; Thu, 17 Oct 2013 09:48:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=vIHlBJK8U40UUzfo/26D2qOuy7ZfaGC/l9kqpWgbvLA=; b=CP5Vhp4RdjBa/VkbXRWrVjGlxtH5PAnTfbSPuzzZgsD2t8PCMKMrLbyr2mB1k5nMit 767KoSwPR9PfaBQ4sGztUyfnSB+24f+OEVRDhJ2h1DkjzL1LTirR0r+tZlCSS+AddcQF n3ylmhc8Nj0vif7u9EGiiUU2ZQ3Xf/LFanfxaXX/PxLSQ+vaKrF8q2zHUPEPsbXGZXIL McKERCe8Pw39WIoVpEukwQR8t0nVRZyNFGYv0MVZoozbRolcc/1iWUU4mkJYeUi/G+H/ SDKDDqiQNnl8KFp8eAukAvzGFB704zXkn5GT+GEn1Wo23K8jHF25gqGKTU2Afov3g/jD s67Q== X-Received: by 10.58.189.163 with SMTP id gj3mr3296727vec.7.1382028533680; Thu, 17 Oct 2013 09:48:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.35.111 with SMTP id g15ls976972qej.21.gmail; Thu, 17 Oct 2013 09:48:53 -0700 (PDT) X-Received: by 10.52.228.137 with SMTP id si9mr1286176vdc.29.1382028533565; Thu, 17 Oct 2013 09:48:53 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id us10si26517652vcb.134.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Oct 2013 09:48:53 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id ia6so1275890vcb.6 for ; Thu, 17 Oct 2013 09:48:53 -0700 (PDT) X-Gm-Message-State: ALoCoQkg40P3tb1ZNWBxOsDCto//BTtEiq5hqYQq4dy52zi1Bv4s70vFYPqQY+TPZczx8ZoZxCEv X-Received: by 10.220.184.70 with SMTP id cj6mr1667040vcb.23.1382028533442; Thu, 17 Oct 2013 09:48:53 -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.174.196 with SMTP id u4csp134446vcz; Thu, 17 Oct 2013 09:48:52 -0700 (PDT) X-Received: by 10.152.2.74 with SMTP id 10mr2839742las.36.1382028529513; Thu, 17 Oct 2013 09:48:49 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id oz4si3887129lbb.151.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 17 Oct 2013 09:48:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VWqkg-0000Tv-57; Thu, 17 Oct 2013 17:48:46 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, patches@linaro.org, Alexander Graf , "Mian M. Hamayun" Subject: [PATCH v8 0/3] hw/arm: Add 'virt' platform Date: Thu, 17 Oct 2013 17:48:43 +0100 Message-Id: <1382028526-1826-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.175 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 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: , This patch series adds a 'virt' platform which uses the kernel's mach-virt (fully device-tree driven) support to create a simple minimalist platform intended for use for KVM VM guests. v6->v7 change is just flipping the order we put the virtio nodes into the device tree, to match vexpress and ppc precedent. Since that's a pretty minor change I plan to put this into a pullreq to go into 1.7 soonish (read: probably this weekend). Yell now if you disagree. Sample command line: qemu-system-arm -machine type=virt -display none \ -kernel zImage \ -append 'root=/dev/vda rw console=ttyAMA0 rootwait' -cpu cortex-a15 \ -device virtio-blk-device,drive=foo \ -drive if=none,file=arm-wheezy.img,id=foo \ -m 2048 -serial stdio Note that there is no earlyprintk via the PL011 because there's no defined device tree binding for "hey, here is your earlyprintk UART". *** NOTE *** to get the PL011 to work you'll need to tweak the kernel a bit: Otherwise the kernel doesn't ever add the clock to its list, and then it refuses to probe for the PL011. (I'm told this isn't really the right fix, though, and ideally the call should be done in some generic location rather than in every machine's init function.) The alternative would be for the kernel to be fixed to follow its own device tree binding documentation and not require clocks/clock-names properties on the pl011 node. Changes from John Rigby's v3->my v4: * renamed user-facing machine to just "virt" * removed the A9 support (it can't work since the A9 has no generic timers) * added virtio-mmio transports instead of random set of 'soc' devices * instead of updating io_base as we step through adding devices, define a memory map with an array (similar to vexpress) * folded in some minor fixes from John's aarch64-support patch * rather than explicitly doing endian-swapping on FDT cells, use fdt APIs that let us just pass in host-endian values and let the fdt layer take care of the swapping * miscellaneous minor code cleanups and style fixes Changes v4->v5: * removed outdated TODO remarks from commit messages Changes v5->v6: * adjusted the memory map as per Anup's review comments (actually made the changes this time!) Changes v6->v7: * added a PL011 UART, at Alex's suggestion (and the accompanying fake clock dtb node that this requires) * added an irqmap[] in parallel with the memmap[] so that our assignment of devices to irq lines is neatly in one place * the removal of arm_pic allows us to get rid of an irritating array sized to the number of CPUs * included the "terminate dtb reservemap" patch since it's a dependency to get the kernel to boot Changes v7->v8: * iterate through virtio-mmio nodes the opposite way round so that they appear in the device tree lowest-address-first; this matches PPC behaviour and the vexpress code John Rigby (1): hw/arm/boot: Allow boards to provide an fdt blob Peter Maydell (2): device_tree.c: Terminate the empty reservemap in create_device_tree() hw/arm: Add 'virt' platform device_tree.c | 4 + hw/arm/Makefile.objs | 2 +- hw/arm/boot.c | 32 ++-- hw/arm/virt.c | 418 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/hw/arm/arm.h | 7 + 5 files changed, 450 insertions(+), 13 deletions(-) create mode 100644 hw/arm/virt.c diff --git a/arch/arm/mach-virt/virt.c b/arch/arm/mach-virt/virt.c index b184e57..2b6aceb 100644 --- a/arch/arm/mach-virt/virt.c +++ b/arch/arm/mach-virt/virt.c @@ -21,11 +21,13 @@ #include #include #include +#include #include static void __init virt_init(void) { + of_clk_init(NULL); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); }