From patchwork Fri Apr 25 11:22:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 29057 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 27783203AC for ; Fri, 25 Apr 2014 11:24:44 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id gq1sf21096131obb.10 for ; Fri, 25 Apr 2014 04:24:43 -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=3sbe8Z0NJR2P5wAqaHyGfXcBdfZn5U6tCwwdWykSo9k=; b=ObulC4CIQoTXwv7KbWztNpqB91tAfWiUirlCi7Gm4JCp/clXmvwhbpukXtMmKUo6w1 NPCS9MEZEe+hOWl4Jspz2tSlLuD+jf9731+ay36O4AInCu4s7ZyP4JthDbPtcIctVk2U NCyPD3OPxNAVtx/WRrUpgfWR1vZRvtehso7naUTODG23VFAsl8as7qYz8zrmYviFi2tj fa+jm2xxv6NzLAkkOeALx3X+LY/Gr4GgqTwYGp94utrrz9ETxXI/DkhgvIwiesnXWOWC fFbp4pxzbKsxTpNcqyOLIMJ/GwQYA5YerI6QxZHxcPtE2OTpkD9RJ9Z/SN85IaPDj9ZQ QaAQ== X-Gm-Message-State: ALoCoQnnuSvle/uBSEzfSm+NRqqK0yMQsQbxdt7fUFWM28Nbfpww0NIhKs0a+HJQ/6cFR8Crbpaf X-Received: by 10.43.79.196 with SMTP id zr4mr3885116icb.3.1398425083593; Fri, 25 Apr 2014 04:24:43 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.229 with SMTP id j92ls1553913qgf.89.gmail; Fri, 25 Apr 2014 04:24:43 -0700 (PDT) X-Received: by 10.52.3.129 with SMTP id c1mr685426vdc.37.1398425083406; Fri, 25 Apr 2014 04:24:43 -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 sw4si1621257vdc.102.2014.04.25.04.24.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Apr 2014 04:24:43 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id lf12so2380625vcb.27 for ; Fri, 25 Apr 2014 04:24:43 -0700 (PDT) X-Received: by 10.52.113.1 with SMTP id iu1mr879001vdb.35.1398425083332; Fri, 25 Apr 2014 04:24:43 -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.221.72 with SMTP id ib8csp89814vcb; Fri, 25 Apr 2014 04:24:43 -0700 (PDT) X-Received: by 10.140.36.86 with SMTP id o80mr9865782qgo.25.1398425082831; Fri, 25 Apr 2014 04:24:42 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id u10si3656858qcz.22.2014.04.25.04.24.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 25 Apr 2014 04:24:42 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) 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 1WdeDW-0004NL-NW; Fri, 25 Apr 2014 11:22:54 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WdeDV-0004MF-0R for xen-devel@lists.xen.org; Fri, 25 Apr 2014 11:22:53 +0000 Received: from [193.109.254.147:33825] by server-7.bemta-14.messagelabs.com id F3/48-17726-C854A535; Fri, 25 Apr 2014 11:22:52 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1398424970!873563!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2788 invoked from network); 25 Apr 2014 11:22:51 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-2.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 25 Apr 2014 11:22:51 -0000 X-IronPort-AV: E=Sophos;i="4.97,926,1389744000"; d="scan'208";a="124530963" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 25 Apr 2014 11:22:50 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.123.3; Fri, 25 Apr 2014 07:22:49 -0400 Received: from marilith-n13-p0.uk.xensource.com ([10.80.229.115] helo=localhost.localdomain) by ukmail1.uk.xensource.com with smtp (Exim 4.69) (envelope-from ) id 1WdeDQ-00075v-AV; Fri, 25 Apr 2014 12:22:49 +0100 Received: by localhost.localdomain (sSMTP sendmail emulation); Fri, 25 Apr 2014 12:22:48 +0100 From: Ian Campbell To: Date: Fri, 25 Apr 2014 12:22:41 +0100 Message-ID: <1398424967-9306-2-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1398424945.18537.424.camel@kazak.uk.xensource.com> References: <1398424945.18537.424.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: ian.jackson@eu.citrix.com, julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH v2 2/8] 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: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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 Acked-by: Julien Grall --- This is the only patch in this series which I consider to be suitable for backporting to Xen 4.4 v2: - Use GUEST_RAM_SIZE instead of GUEST_RAM_END - Refactor the ramlimit into one place. --- tools/libxc/xc_dom_arm.c | 9 +++++++++ xen/include/public/arch-arm.h | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index 60ac51a..46dfc36 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -272,6 +272,15 @@ int arch_setup_meminit(struct xc_dom_image *dom) return -1; } + if ( ramsize > GUEST_RAM_SIZE - NR_MAGIC_PAGES*XC_PAGE_SIZE ) + { + DOMPRINTF("%s: ram size is too large for guest address space: " + "%"PRIx64" > %"PRIx64, + __FUNCTION__, ramsize, + GUEST_RAM_SIZE - NR_MAGIC_PAGES*XC_PAGE_SIZE); + 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..dd53c94 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 @ 2GB */ +#define GUEST_RAM_SIZE 0x30000000ULL #define GUEST_GNTTAB_BASE 0xb0000000ULL #define GUEST_GNTTAB_SIZE 0x00020000ULL