From patchwork Wed Sep 3 12:01:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36602 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DB6462039B for ; Wed, 3 Sep 2014 12:02:13 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id vb8sf44849537obc.4 for ; Wed, 03 Sep 2014 05:02:13 -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: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=4hNJIMLad9ObmDsjLh4hUQbN02xVRSCwsSQAoods3dM=; b=inFN6Mq6b/ZDEkZ5gieOhoihZfDEgFbRs/+aXpHdfVMZGZl8rPiICXcOPZU5ksjTs9 ArYyFP9qUbDQ2sgxsZettHstBjs2qwjtq+ZuRHVGCA6ztSi+dqb9WWf3+UMQPVcXETDJ qsjrPZyF9X28amEMBcXKDaxDhqu+yiKNwJme8qao9Uo3CHslSEeLK/E8jCJa1o+GpK61 5b5SMDE/UlPHb2P0ejvybis0loe+3Ce2fVwJkO5Nd3B7Bjzae76ZfWV7UgwsxppP8kv2 nApkDCY91MKCv2WH+QfXSWQUYKpBNW9A7fBwFMVjT8BT/shaT6NnsjmTFhi8MIyJf7wr 9UOQ== X-Gm-Message-State: ALoCoQnjScWmn14FDQwn1VpTKCpulKBw6uOeTjnF0wHMCboYYoa8kkHiGtDTNdd/jw22bHn1UJKK X-Received: by 10.42.130.70 with SMTP id u6mr24177765ics.2.1409745733495; Wed, 03 Sep 2014 05:02:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.86.9 with SMTP id o9ls2875644qgd.47.gmail; Wed, 03 Sep 2014 05:02:13 -0700 (PDT) X-Received: by 10.220.192.196 with SMTP id dr4mr143392vcb.70.1409745733334; Wed, 03 Sep 2014 05:02:13 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id f2si3516788vcy.28.2014.09.03.05.02.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 05:02:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id im17so8599496vcb.18 for ; Wed, 03 Sep 2014 05:02:13 -0700 (PDT) X-Received: by 10.221.29.5 with SMTP id rw5mr153944vcb.49.1409745733248; Wed, 03 Sep 2014 05:02:13 -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.221.45.67 with SMTP id uj3csp669164vcb; Wed, 3 Sep 2014 05:02:12 -0700 (PDT) X-Received: by 10.224.88.137 with SMTP id a9mr67179228qam.88.1409745732457; Wed, 03 Sep 2014 05:02:12 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o6si9092897qac.7.2014.09.03.05.02.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 05:02:12 -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]:44746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP9GO-0005g6-0N for patch@linaro.org; Wed, 03 Sep 2014 08:02:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP9Fp-0005MV-PV for qemu-devel@nongnu.org; Wed, 03 Sep 2014 08:01:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XP9Fj-0002ey-Te for qemu-devel@nongnu.org; Wed, 03 Sep 2014 08:01:37 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:45632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XP9Fj-0002eh-Ni for qemu-devel@nongnu.org; Wed, 03 Sep 2014 08:01:31 -0400 Received: by mail-we0-f174.google.com with SMTP id u57so8499115wes.33 for ; Wed, 03 Sep 2014 05:01:30 -0700 (PDT) X-Received: by 10.180.77.193 with SMTP id u1mr35101920wiw.45.1409745690073; Wed, 03 Sep 2014 05:01:30 -0700 (PDT) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id js2sm15492144wjc.9.2014.09.03.05.01.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 05:01:29 -0700 (PDT) From: Ard Biesheuvel To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Wed, 3 Sep 2014 14:01:27 +0200 Message-Id: <1409745687-15705-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.174 Cc: Ard Biesheuvel Subject: [Qemu-devel] [PATCH] hw/arm/boot: load device tree to base of DRAM if no -kernel option was passed 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: ard.biesheuvel@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.220.173 as permitted sender) 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 If we are running the 'virt' machine, we may have a device tree blob but no kernel to supply it to if no -kernel option was passed. In that case, copy it to the base of DRAM where it can be picked up by a bootloader executing from NOR flash. Signed-off-by: Ard Biesheuvel --- v2: comment style, call exit(1) on load_dtb() failure hw/arm/boot.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index e32f2f415885..a32ff28d9be1 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -459,6 +459,17 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) /* Load the kernel. */ if (!info->kernel_filename) { + + if (have_dtb(info)) { + /* If we have a device tree blob, but no kernel to supply it to, + * copy it to the base of DRAM for a bootloader executing from + * NOR flash to pick up. + */ + if (load_dtb(info->loader_start, info)) { + exit(1); + } + } + /* If no kernel specified, do nothing; we will start from address 0 * (typically a boot ROM image) in the same way as hardware. */