From patchwork Thu May 22 09:46:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 30581 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f200.google.com (mail-ig0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A0DB620671 for ; Thu, 22 May 2014 09:48:29 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id uy17sf9107002igb.3 for ; Thu, 22 May 2014 02:48:29 -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=quQ8BmYnXA6dJ7x3ecv6nRZpaJpZfWvAbWxI/4eUfP0=; b=VIsuBi+klOjrO9Tp07V0gQltNBvDPjOsBjZr7mJ9C4E6CpvWfU8CwkaQMErlw54a5e VHy9gkO1HXQ/Ia217Ass9J39nv5evqGMkX8rh7JmfL5truYgg6DnpiEn8U0BpV5QdjRS yakVymIjMroVr/g1G/2xrKVO7eAIlLX8f+xCP1T7Bgaak0JiyM6tYbvdyIYKChSioB13 r3Trikyde1YqmmA8nXg6pRAcId1f9c0R3UMv5ZCXnh8t2eeyjg7hUnq2FI0oZAyfwGTj oQwfmj5qRxSNyoBS96QWeeVLMtGU+P6XlddtCDtYtFjY6ePC/BbbjFizwwnlds1b1jJS 0U9g== X-Gm-Message-State: ALoCoQksEBvuhz+oTGa/WRVV2RerX3sbdXi2w1LEoTuaydBbEmUaa5wTIFOy4Iu3PgFmhic1m6ZQ X-Received: by 10.182.153.167 with SMTP id vh7mr9900319obb.5.1400752109207; Thu, 22 May 2014 02:48:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.44 with SMTP id a41ls1188327qge.72.gmail; Thu, 22 May 2014 02:48:29 -0700 (PDT) X-Received: by 10.220.92.193 with SMTP id s1mr14860815vcm.34.1400752109116; Thu, 22 May 2014 02:48:29 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id f2si2826445vds.107.2014.05.22.02.48.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 May 2014 02:48:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id ij19so4143347vcb.28 for ; Thu, 22 May 2014 02:48:29 -0700 (PDT) X-Received: by 10.52.227.105 with SMTP id rz9mr133552vdc.51.1400752109040; Thu, 22 May 2014 02:48:29 -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 ib8csp183722vcb; Thu, 22 May 2014 02:48:28 -0700 (PDT) X-Received: by 10.58.98.232 with SMTP id el8mr165496veb.42.1400752108557; Thu, 22 May 2014 02:48:28 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id qy9si4534536vcb.69.2014.05.22.02.48.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 May 2014 02:48:28 -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 1WnPai-0005Gh-No; Thu, 22 May 2014 09:47:12 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WnPah-0005Ev-70 for xen-devel@lists.xen.org; Thu, 22 May 2014 09:47:11 +0000 Received: from [85.158.137.68:6815] by server-8.bemta-3.messagelabs.com id D7/52-21547-E97CD735; Thu, 22 May 2014 09:47:10 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1400752027!1741654!2 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.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3406 invoked from network); 22 May 2014 09:47:09 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-9.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 22 May 2014 09:47:09 -0000 X-IronPort-AV: E=Sophos;i="4.98,886,1392163200"; d="scan'208";a="133839203" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 22 May 2014 09:46:47 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.3.181.6; Thu, 22 May 2014 05:46:47 -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 1WnPaI-0000m5-1a; Thu, 22 May 2014 10:46:47 +0100 Received: by localhost.localdomain (sSMTP sendmail emulation); Thu, 22 May 2014 10:46:46 +0100 From: Ian Campbell To: , , , Date: Thu, 22 May 2014 10:46:37 +0100 Message-ID: <1400752004-9731-2-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1400751582.11409.46.camel@kazak.uk.xensource.com> References: <1400751582.11409.46.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Campbell , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH v5 2/9] 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) 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 Acked-by: Ian Jackson --- 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..d5831a2 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" > %llx", + __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