From patchwork Thu Sep 11 16:45:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 388327 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id ADDB714011D for ; Fri, 12 Sep 2014 02:46:40 +1000 (EST) Received: from localhost ([::1]:40067 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS7W1-0001HL-M7 for incoming@patchwork.ozlabs.org; Thu, 11 Sep 2014 12:46:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS7V2-00087A-8V for qemu-devel@nongnu.org; Thu, 11 Sep 2014 12:45:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XS7Uv-0004CN-MV for qemu-devel@nongnu.org; Thu, 11 Sep 2014 12:45:36 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:33311) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS7Uv-0004C9-CH for qemu-devel@nongnu.org; Thu, 11 Sep 2014 12:45:29 -0400 Received: by mail-wi0-f173.google.com with SMTP id em10so1296331wid.12 for ; Thu, 11 Sep 2014 09:45:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Nd7iNxNDEtD3/+4qimjP8zP4M70SaZ8Td1OZWwrFDnc=; b=ltw+0tbsVQY78GT2oRT5s+mZVirR8dlIqqKLhZjIcL0jgRMtOx23C0W4Ov+f4dAaX+ MEKBdcxijMcje/+seXSi89VDDtDPz2qdPZdY8S7XwWa4napV7EgRU7ElAepeZiKBGgef Ivk0bs7adCmyNGkJ5UDfXW4MChQYN6nFpzjieLxUB49ZHeycMnlJxGTL4rA5PRQjHvMg sSuBYkX9cI9SnrdBuFSAREzf7pthuL7fkLmMPR3xH1HhLiF9DLCmGODbj1WndltSfBtY WxYLA5anp1mRw95pXQ/4MP1b7AmCFqCx3GDX8FmgK8Vqd7SnX60++VghibqbEGAT7H/E OWHA== X-Gm-Message-State: ALoCoQmzOuJyy4qmHdQ+LtHfH/w22eUOdK4NGvonSiHCUiVnrqPUi9l5E0KXMUTAVvVpk2aLjo8d X-Received: by 10.180.90.6 with SMTP id bs6mr8709735wib.47.1410453923829; Thu, 11 Sep 2014 09:45:23 -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 ll20sm2078442wic.14.2014.09.11.09.45.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Sep 2014 09:45:22 -0700 (PDT) From: Ard Biesheuvel To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Thu, 11 Sep 2014 18:45:14 +0200 Message-Id: <1410453915-9344-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1410453915-9344-1-git-send-email-ard.biesheuvel@linaro.org> References: <1410453915-9344-1-git-send-email-ard.biesheuvel@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.212.173 Cc: christoffer.dall@linaro.org, Ard Biesheuvel Subject: [Qemu-devel] [PATCH v3 3/4] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 RAM where it can be picked up by a bootloader. Signed-off-by: Ard Biesheuvel --- hw/arm/boot.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 2083aeb95d80..1bed02db6fdd 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -490,6 +490,16 @@ 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 RAM for a bootloader to pick up. + */ + if (load_dtb(info->loader_start, info, 0) < 0) { + 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. */