From patchwork Fri Sep 5 15:15:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36859 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4E9EF202E4 for ; Fri, 5 Sep 2014 15:26:09 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id r5sf35501961qcx.5 for ; Fri, 05 Sep 2014 08:26:09 -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: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=M0QL+Hy3EpJHpsEvNSPVvqHgVX+fpaOq0uipjA9x11Y=; b=h7u5VciZyKQilhlM7Ron5lGhldpIytQOi+AF1TBJpeNTByS5lm9LKj2dZZmIVcoCWb bnsM+ZD02Mpj4Q/bh7ffMp8ll6SzxLPFf4ldgDCy9BEXmCTkfvBj6pEd6mF9THcc1qEP iYgWVVjwYqsSv3NQv0H5UZB6j5ZnZZATPDVUa357OyvLYkhe9uRPnJRb31QnCcQxXJyy dG4fmIi53i5tLeISKqb9ukCMG1ESn5kFDipHnG0bOsaFTyt9IqIxO1kZzfZx2MfWprLA C5+XzoDNqCDCF5Wj1UCrxv1rGFDQlOu26SEjAVYaHk0VzmoK62apxArJnsoizQod/mJW RVQg== X-Gm-Message-State: ALoCoQnXWSqN1Ha2oQcCvWMb0UdcOxs7FqlARqrNCU1dOGC8v/167utYzymEqAwUInhceN1lqNKW X-Received: by 10.52.116.241 with SMTP id jz17mr7173545vdb.9.1409930280170; Fri, 05 Sep 2014 08:18:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.87 with SMTP id l81ls33618qga.51.gmail; Fri, 05 Sep 2014 08:18:00 -0700 (PDT) X-Received: by 10.220.132.207 with SMTP id c15mr11389361vct.12.1409930280042; Fri, 05 Sep 2014 08:18:00 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id tf4si945296vcb.1.2014.09.05.08.18.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 08:18:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so12510850vcb.16 for ; Fri, 05 Sep 2014 08:17:59 -0700 (PDT) X-Received: by 10.220.187.134 with SMTP id cw6mr1606656vcb.71.1409930279948; Fri, 05 Sep 2014 08:17:59 -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 uj3csp97743vcb; Fri, 5 Sep 2014 08:17:59 -0700 (PDT) X-Received: by 10.140.47.80 with SMTP id l74mr18978113qga.24.1409930279222; Fri, 05 Sep 2014 08:17:59 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id c88si1973677qgf.66.2014.09.05.08.17.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 05 Sep 2014 08:17:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Received: from localhost ([::1]:58424 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPvGw-0007E8-Jz for patch@linaro.org; Fri, 05 Sep 2014 11:17:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPvEh-0003mm-97 for qemu-devel@nongnu.org; Fri, 05 Sep 2014 11:15:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPvEa-0002k5-FB for qemu-devel@nongnu.org; Fri, 05 Sep 2014 11:15:39 -0400 Received: from mail-we0-f172.google.com ([74.125.82.172]:43844) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPvEa-0002jn-2F for qemu-devel@nongnu.org; Fri, 05 Sep 2014 11:15:32 -0400 Received: by mail-we0-f172.google.com with SMTP id q59so11968051wes.17 for ; Fri, 05 Sep 2014 08:15:28 -0700 (PDT) X-Received: by 10.180.99.34 with SMTP id en2mr4785908wib.34.1409930127643; Fri, 05 Sep 2014 08:15:27 -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 wx3sm1734308wjc.19.2014.09.05.08.15.26 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 08:15:27 -0700 (PDT) From: Ard Biesheuvel To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 5 Sep 2014 17:15:22 +0200 Message-Id: <1409930126-28449-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409930126-28449-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409930126-28449-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: 74.125.82.172 Cc: fu.wei@linaro.org, christoffer.dall@linaro.org, Ard Biesheuvel Subject: [Qemu-devel] [PATCH 2/6] hw/arm/boot: return size of loaded DTB from load_dtb() 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.171 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 Add a dtb_size output parameter to load_dtb() so that we can find out what its memory footprint is. Signed-off-by: Ard Biesheuvel --- hw/arm/boot.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index e32f2f415885..c103a8fdc941 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -312,7 +312,8 @@ static void set_kernel_args_old(const struct arm_boot_info *info) } } -static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo) +static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, + uint32_t *dtb_size) { void *fdt = NULL; int size, rc; @@ -340,6 +341,9 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo) goto fail; } } + if (dtb_size != NULL) { + *dtb_size = size; + } acells = qemu_fdt_getprop_cell(fdt, "/", "#address-cells"); scells = qemu_fdt_getprop_cell(fdt, "/", "#size-cells"); @@ -569,7 +573,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) */ hwaddr dtb_start = QEMU_ALIGN_UP(info->initrd_start + initrd_size, 4096); - if (load_dtb(dtb_start, info)) { + if (load_dtb(dtb_start, info, NULL)) { exit(1); } fixupcontext[FIXUP_ARGPTR] = dtb_start;