From patchwork Tue Oct 22 10:51:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 21209 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8417F20BB3 for ; Tue, 22 Oct 2013 10:52:07 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j1sf10713547oag.2 for ; Tue, 22 Oct 2013 03:52:06 -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=JgeHgmMh9ZGwzvUiOVEUGaT6DgwU0QVvZ2iltB7BM3I=; b=PoNNGq8dbYyvNZhPXl2C1vjksa1W+tgjuy2GZ9O3NzhufxF6Mg9nNkFH8gGYmuEXhk Tgog0AamT2CZDx6wQAo3iK3MI4mzkZoTxQXamJTEtbm25tngM5N1WEonBB4/4ywXz6jp r0MXILou4pDUHgvdNFx93ldhkm1yFMRrDD9QS27gCFp9TqflaH0RYZxolEefyxQitoiZ 7M9OYhI/x/UBsNfukQsYOaJgrVycm8RqLvilX5Lw6HNTEksLKp7Khk+g5InQOEcPoP14 /GGrnDsvJiMEW8ORKCdDzQf1os+C0XBjphmZhxSy1bB0xy2V/t8Hgcm0pD5yh8ksiO1q 8Znw== X-Received: by 10.182.66.137 with SMTP id f9mr8314696obt.3.1382439126558; Tue, 22 Oct 2013 03:52:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.42 with SMTP id r10ls65510qen.86.gmail; Tue, 22 Oct 2013 03:52:06 -0700 (PDT) X-Received: by 10.52.243.138 with SMTP id wy10mr12381857vdc.2.1382439126442; Tue, 22 Oct 2013 03:52:06 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id w7si5630820vcr.92.2013.10.22.03.52.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Oct 2013 03:52:06 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id lh4so1352303vcb.37 for ; Tue, 22 Oct 2013 03:52:06 -0700 (PDT) X-Gm-Message-State: ALoCoQn8zfZwUCM4Q1WcsD9yMTXk5vDC3RbKGPcezIoajNkzCv4GZJxSRpDpuakdgLU2infJWGD9 X-Received: by 10.58.233.98 with SMTP id tv2mr14096371vec.11.1382439126179; Tue, 22 Oct 2013 03:52:06 -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 u4csp220695vcz; Tue, 22 Oct 2013 03:52:05 -0700 (PDT) X-Received: by 10.180.9.69 with SMTP id x5mr13915002wia.41.1382439125061; Tue, 22 Oct 2013 03:52:05 -0700 (PDT) Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by mx.google.com with ESMTPS id lu5si1013023wic.2.2013.10.22.03.52.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Oct 2013 03:52:05 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.43 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.43; Received: by mail-wg0-f43.google.com with SMTP id b13so7918633wgh.22 for ; Tue, 22 Oct 2013 03:52:04 -0700 (PDT) X-Received: by 10.180.80.105 with SMTP id q9mr6394834wix.18.1382439124014; Tue, 22 Oct 2013 03:52:04 -0700 (PDT) Received: from laptop.eicc.co.uk (ed03490-ge-0-0-0.mgdfwr.lumison.net. [212.20.242.100]) by mx.google.com with ESMTPSA id b7sm5169760wiz.8.2013.10.22.03.51.57 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Tue, 22 Oct 2013 03:52:03 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: ian.campbell@citrix.com, tim@xen.org, patches@linaro.org, stefano.stabellini@eu.citrix.com, Julien Grall Subject: [PATCH] xen/arm: Allocate memory for dom0 from the bottom with the 1:1 Workaround Date: Tue, 22 Oct 2013 11:51:48 +0100 Message-Id: <1382439108-3669-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.178 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 Linux, the option CONFIG_ARM_PATCH_PHYS_VIRT (by default enabled) allows the Kernel to be loaded anywhere (or nearly) by patching the translation pv<->virt at boot time. The current solution in Linux assuming that the delta physical address - virtual address is always negative. A positive delta will destroy all the optimisation to modify only a part of the translation instruction (add/sub). By default, Xen is allocating memory from the top of memory and then goes down. To avoid booting issue with Linux, we must allocate memory from the bottom (ie starting from 0). Signed-off-by: Julien Grall Acked-by: Ian Campbell --- xen/arch/arm/domain_build.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 0698f83..69ea6a0 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -70,12 +70,19 @@ static int set_memory_reg_11(struct domain *d, struct kernel_info *kinfo, int reg_size = dt_cells_to_size(dt_n_addr_cells(np) + dt_n_size_cells(np)); paddr_t start; paddr_t size; - struct page_info *pg; + struct page_info *pg = NULL; unsigned int order = get_order_from_bytes(dom0_mem); int res; paddr_t spfn; + unsigned int bits; + + for ( bits = PAGE_SHIFT + 1; bits < PADDR_BITS; bits++ ) + { + pg = alloc_domheap_pages(d, order, MEMF_bits(bits)); + if ( pg != NULL ) + break; + } - pg = alloc_domheap_pages(d, order, 0); if ( !pg ) panic("Failed to allocate contiguous memory for dom0\n");