From patchwork Tue Oct 22 10:49:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 21208 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 6BE2A20BB3 for ; Tue, 22 Oct 2013 10:49:35 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j1sf10291231oag.6 for ; Tue, 22 Oct 2013 03:49:35 -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=G8kKSwSY5Ls6uE9JIRCd/X6Lx6Mi+n+bRsUP1xjvl9QgLFfVjXKB/RyOSinNv0pclq 9kpDxAkHak8Y3R+7SwGX4dnulB+tvn1gENg1lMwCbvc48iXxRxubQtQGB9fQvJFGp2Mu TBJpvy4wVB6YNIoK17ytO/6YQDkb5ZwQnNIeDWfV9+wmXeLegkB89RMaQgKXvETZ1Kkr 3n2NEqUuSIlih+P9FIi7R2JC3JLzfXhrduN4m5G84PAwydNGydtTjAkBFYGRFwg7veKo dUUt23Jm5BfmE2EXr4S5pJ1jer/aiM73Qt9jrbGdg6o2/1PAFV/DqtfhJOVtiLHUgEbv IlCA== X-Received: by 10.182.246.39 with SMTP id xt7mr4390753obc.40.1382438975523; Tue, 22 Oct 2013 03:49:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.109.102 with SMTP id hr6ls49013qeb.13.gmail; Tue, 22 Oct 2013 03:49:35 -0700 (PDT) X-Received: by 10.58.11.73 with SMTP id o9mr13944753veb.8.1382438975390; Tue, 22 Oct 2013 03:49:35 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id zw10si5617505vdb.70.2013.10.22.03.49.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Oct 2013 03:49:35 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 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.182; Received: by mail-vc0-f182.google.com with SMTP id im17so1396804vcb.27 for ; Tue, 22 Oct 2013 03:49:35 -0700 (PDT) X-Gm-Message-State: ALoCoQnImAvB4hPIu0gpcBdF9TiFKhp2umavmtTuUn936p01yV6yuCJM1FGvvHdA8FIHFTDnfG8x X-Received: by 10.52.164.102 with SMTP id yp6mr12680019vdb.14.1382438975242; Tue, 22 Oct 2013 03:49:35 -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 u4csp220552vcz; Tue, 22 Oct 2013 03:49:34 -0700 (PDT) X-Received: by 10.180.101.197 with SMTP id fi5mr14013374wib.46.1382438973636; Tue, 22 Oct 2013 03:49:33 -0700 (PDT) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) by mx.google.com with ESMTPS id ej19si996605wic.53.2013.10.22.03.49.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Oct 2013 03:49:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.179 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.212.179; Received: by mail-wi0-f179.google.com with SMTP id hm4so5435081wib.0 for ; Tue, 22 Oct 2013 03:49:33 -0700 (PDT) X-Received: by 10.194.109.68 with SMTP id hq4mr18056802wjb.12.1382438972970; Tue, 22 Oct 2013 03:49:32 -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 dq11sm5139806wid.3.2013.10.22.03.49.32 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Tue, 22 Oct 2013 03:49:32 -0700 (PDT) From: Julien Grall To: julien.grall@gmail.com Cc: patches@linaro.org, Julien Grall Subject: [PATCH] xen/arm: Allocate memory for dom0 from the bottom with the 1:1 Workaround Date: Tue, 22 Oct 2013 11:49:29 +0100 Message-Id: <1382438969-3625-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.182 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 --- 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");