From patchwork Tue Apr 8 14:19:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 27982 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AA95120447 for ; Tue, 8 Apr 2014 14:21:05 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id j7sf2636206qaq.10 for ; Tue, 08 Apr 2014 07:21:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=uVyTP3CK80VpqcNTH4zPj71hvcZG4Lonk6SYle3uSg8=; b=iMUqeyYfKPUOoeQX3wAyYjnWNERLwbdkXnpsU8O6qZhmwH0+ysDmQkYQ5CzlmRfFkU Pu1XGbKmm08BVieyh5VBqmR7bmKei34iFy9o9WWVjIdr3h+XElwqFfs9q68eEPcSxqaR tY0ak8yv/9HjUqno7vrn/jzjbrg8j8YgOLKUgcGyjKwMN63mAL8nUbsZUeorUbGfp6ax mASbFfB622Cdiu+/CnzZ2VdUtZ8eqllCB3cU+bH1K0Ru4c7yKSkymFdOhYUZFqrZgNhG spQcuKfLqbOd/y+AUMuEQep3wzJUX+2xRB1EBkGMYflJNa53b8kiHbNqfG3QJ/eZUhp+ V7QA== X-Gm-Message-State: ALoCoQl3Ia14qqmR92BIzkV/nZpfWPMLiqbip3HUruZv6akJi93JmJA5pD2TzJi83NkuPmBKjo4Z X-Received: by 10.224.6.198 with SMTP id a6mr1923520qaa.6.1396966865460; Tue, 08 Apr 2014 07:21:05 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.21 with SMTP id t21ls232981qge.1.gmail; Tue, 08 Apr 2014 07:21:05 -0700 (PDT) X-Received: by 10.58.1.5 with SMTP id 5mr3594852vei.8.1396966865333; Tue, 08 Apr 2014 07:21:05 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id kj3si418945vdb.87.2014.04.08.07.21.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Apr 2014 07:21:05 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 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.175; Received: by mail-vc0-f175.google.com with SMTP id lh14so800459vcb.20 for ; Tue, 08 Apr 2014 07:21:05 -0700 (PDT) X-Received: by 10.58.186.71 with SMTP id fi7mr410189vec.32.1396966865246; Tue, 08 Apr 2014 07:21:05 -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.220.12.8 with SMTP id v8csp249710vcv; Tue, 8 Apr 2014 07:21:05 -0700 (PDT) X-Received: by 10.52.126.107 with SMTP id mx11mr244640vdb.41.1396966864917; Tue, 08 Apr 2014 07:21:04 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id ww7si415329vec.156.2014.04.08.07.21.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 08 Apr 2014 07:21:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WXWs2-0004yk-OQ; Tue, 08 Apr 2014 14:19:26 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WXWs2-0004yG-2c for xen-devel@lists.xen.org; Tue, 08 Apr 2014 14:19:26 +0000 Received: from [85.158.139.211:51872] by server-11.bemta-5.messagelabs.com id A6/A6-30804-D6504435; Tue, 08 Apr 2014 14:19:25 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-11.tower-206.messagelabs.com!1396966762!4412070!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8179 invoked from network); 8 Apr 2014 14:19:24 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-11.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 8 Apr 2014 14:19:24 -0000 X-IronPort-AV: E=Sophos;i="4.97,818,1389744000"; d="scan'208";a="117888859" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 08 Apr 2014 14:19:22 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.2.342.4; Tue, 8 Apr 2014 10:19:21 -0400 Received: from marilith-n13-p0.uk.xensource.com ([10.80.229.115] helo=marilith-n13.uk.xensource.com.) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1WXWrx-0005Fw-43; Tue, 08 Apr 2014 14:19:21 +0000 From: Ian Campbell To: Date: Tue, 8 Apr 2014 15:19:17 +0100 Message-ID: <1396966760-7752-1-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1396966739.22845.233.camel@kazak.uk.xensource.com> References: <1396966739.22845.233.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH 1/4] tools: arm: report an error if the guest RAM is too large X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org 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.220.175 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Due to the layout of the guest physical address space we cannot support more than 768M of RAM before overrunning the area set aside for the grant table. Due to the presence of the magic pages at the end of the RAM region guests are actually limited to 767M. Catch this case during domain build and fail gracefully instead of obscurely later on. Signed-off-by: Ian Campbell --- This is the only patch in this series which I consider to be suitable for backporting to Xen 4.4 --- tools/libxc/xc_dom_arm.c | 8 ++++++++ xen/include/public/arch-arm.h | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index 3330f12..c085b4a 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -262,6 +262,14 @@ int arch_setup_meminit(struct xc_dom_image *dom) const uint64_t modsize = dtb_size + ramdisk_size; const uint64_t ram128mb = rambase + (128<<20); + if ( ramend - 1 > GUEST_RAM_END - NR_MAGIC_PAGES*XC_PAGE_SIZE ) + { + DOMPRINTF("%s: ram size is too large for guest address space: " + "%"PRIx64" > %"PRIx64, + __FUNCTION__, ramend, GUEST_RAM_END); + return -1; + } + rc = set_mode(dom->xch, dom->guest_domid, dom->guest_type); if ( rc ) return rc; diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index 7496556..dc11040 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -369,7 +369,8 @@ typedef uint64_t xen_callback_t; #define GUEST_GICC_BASE 0x2c002000ULL #define GUEST_GICC_SIZE 0x100ULL -#define GUEST_RAM_BASE 0x80000000ULL +#define GUEST_RAM_BASE 0x80000000ULL /* 768M at 2GB*/ +#define GUEST_RAM_END 0xafffffffULL #define GUEST_GNTTAB_BASE 0xb0000000ULL #define GUEST_GNTTAB_SIZE 0x00020000ULL