From patchwork Wed Nov 20 09:48:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 21650 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0A6DC23FDC for ; Wed, 20 Nov 2013 09:48:31 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id g12sf23756127oah.9 for ; Wed, 20 Nov 2013 01:48:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:subject:from:to:cc:date :in-reply-to:references:organization:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=4wB5tzdSwdV40dxp6eCoVjC9+XPV7UzZU16zsf2Dth0=; b=Em1viiFem5wYLqsNvrW6Fq2ufZiNbQBd7q6p+dIaORUruzSZ5ognioJdEorHzJ14uf Bwsr/aiY75dZs+/JQYmJGshx5v/YTLGje5XpuisoLMsIRyxquEiVxJea49nr4fmzXwK2 mvxHS668s4RxO+WO2Q3OuLIqYlH6xmj5MpNnEb9tnT+WYwIQ8kJqN0V3Bi8SX+1DLLCb Ap5rfs9LYz0s599rnLMX9WZaDbKSonCGS4vGmVz6lmZBOniRwLL+oV2NARlvrxAiq9Z1 LzGrsn5b2Ep/e8oEnhMp46bmhzWtO6DcSIvEDwHgAFIwpfWiB4z3n3UFUkhVn5luKu+x y0LQ== X-Gm-Message-State: ALoCoQlFhVWhGM2K3jtkRUXWNIo686dM8vEUsapyeJSjCXOPrwP5ECzyGgUWkuTASqt0QK1wtZHB X-Received: by 10.42.112.138 with SMTP id y10mr271366icp.28.1384940911242; Wed, 20 Nov 2013 01:48:31 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.130.195 with SMTP id og3ls2259qeb.62.gmail; Wed, 20 Nov 2013 01:48:31 -0800 (PST) X-Received: by 10.220.191.10 with SMTP id dk10mr411870vcb.29.1384940911144; Wed, 20 Nov 2013 01:48:31 -0800 (PST) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by mx.google.com with ESMTPS id il5si9235121vdb.75.2013.11.20.01.48.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Nov 2013 01:48:31 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.45; Received: by mail-vb0-f45.google.com with SMTP id p14so74232vbm.32 for ; Wed, 20 Nov 2013 01:48:31 -0800 (PST) X-Received: by 10.221.40.10 with SMTP id to10mr6300510vcb.22.1384940911051; Wed, 20 Nov 2013 01:48:31 -0800 (PST) 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 u4csp341537vcz; Wed, 20 Nov 2013 01:48:30 -0800 (PST) X-Received: by 10.236.223.168 with SMTP id v38mr511188yhp.86.1384940910240; Wed, 20 Nov 2013 01:48:30 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com. [66.165.176.89]) by mx.google.com with ESMTPS id a9si4400555yhm.37.2013.11.20.01.48.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 20 Nov 2013 01:48:30 -0800 (PST) Received-SPF: pass (google.com: domain of Ian.Campbell@citrix.com designates 66.165.176.89 as permitted sender) client-ip=66.165.176.89; X-IronPort-AV: E=Sophos;i="4.93,736,1378857600"; d="scan'208";a="76299920" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 20 Nov 2013 09:48:29 +0000 Received: from [10.80.2.80] (10.80.2.80) by FTLPEX01CL01.citrite.net (10.13.107.78) with Microsoft SMTP Server id 14.2.342.4; Wed, 20 Nov 2013 04:48:29 -0500 Message-ID: <1384940907.28441.11.camel@kazak.uk.xensource.com> Subject: Re: [PATCH] libxc/arm: align to page size the base address of the device tree From: Ian Campbell To: Julien Grall CC: , , , , Date: Wed, 20 Nov 2013 09:48:27 +0000 In-Reply-To: <1384887144-7229-1-git-send-email-julien.grall@linaro.org> References: <1384887144-7229-1-git-send-email-julien.grall@linaro.org> Organization: Citrix Systems, Inc. X-Mailer: Evolution 3.4.4-3 MIME-Version: 1.0 X-Originating-IP: [10.80.2.80] X-DLP: MIA2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.45 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: , On Tue, 2013-11-19 at 18:52 +0000, Julien Grall wrote: > xc_dom_alloc_segment requires start address to be page align. I wonder why I didn't see this? It seems very unlikely that my dtb would be exactly page sized, yet it works... Ah, I have >128M of RAM in my guest so the base would be 128M. Well spotted. I think it would be slightly preferable to round dtbsize up to a page. e.g. the following. What do you think? 8>------------------ >From 079a2815d86567de1cbb541541d08a0b9ac3d18d Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 20 Nov 2013 09:45:32 +0000 Subject: [PATCH] libxl: arm: ensure DTB is page aligned xc_dom_alloc_segment requires this. Since rambase and ramend are both page aligned, rounding up the DTB is sufficient. Reported-by: Julien Grall Signed-off-by: Ian Campbell Acked-by: Julien Grall --- tools/libxc/xc_dom_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index ffe575b..a40e04d 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -282,7 +282,7 @@ int arch_setup_meminit(struct xc_dom_image *dom) { const uint64_t rambase = dom->rambase_pfn << XC_PAGE_SHIFT; const uint64_t ramend = rambase + ( dom->total_pages << XC_PAGE_SHIFT ); - const uint64_t dtbsize = ( dom->devicetree_size + 3 ) & ~0x3; + const uint64_t dtbsize = ROUNDUP(dom->devicetree_size, XC_PAGE_SHIFT); /* Place at 128MB if there is sufficient RAM */ if ( ramend >= rambase + 128*1024*1024 + dtbsize )