From patchwork Tue May 13 11:29:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 30032 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 3223320369 for ; Tue, 13 May 2014 11:31:24 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id uy17sf803767igb.11 for ; Tue, 13 May 2014 04:31:23 -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=G2ZyRNVuJZ7JTCTJXCnRV8S3xOSewMjqYqkCN1ltqS4=; b=eD/IQeeayafkxHVlL1cW3pgGMf0wGMq+cf2FgW0z8Pihi9sgaP1x6TGM2rdlTcyE7e UuGSAiP1FGxjh3WWobM5uJlhk/9HypraVTyk9LFe+5B2BOLLsi7bUbYj+0am2ZLof4jd eSVCbRK9TNtT1QB5yWId/Shi1cly+dFCobmR+MYCaero9nHSms7pUSIdPvE5sa1sxOq5 Pr/XmZdCoegzh4ri7QdBjfHLheAgFyOC6FkUHF93miX1mF4Jou8NpK1Fq6wKat8hxVbA axKxzftbg3SqMxsulN6OLipnspagGLaHjGX6DvXm54LtNh8umVFX2C+qvpaTRatVRz7/ GpTQ== X-Gm-Message-State: ALoCoQn7J+iTSP4Hg0p881M/w0KYWr8/llEtzIT/oQtW9sEujjKnefkD2TRkBD+vxoxUDVEBTLAq X-Received: by 10.43.103.136 with SMTP id di8mr14635532icc.14.1399980683753; Tue, 13 May 2014 04:31:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.138 with SMTP id 10ls1296735qgx.9.gmail; Tue, 13 May 2014 04:31:23 -0700 (PDT) X-Received: by 10.52.125.147 with SMTP id mq19mr12534743vdb.2.1399980683226; Tue, 13 May 2014 04:31:23 -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 mp4si2590829vcb.112.2014.05.13.04.31.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 04:31:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id la4so232921vcb.13 for ; Tue, 13 May 2014 04:31:23 -0700 (PDT) X-Received: by 10.221.58.144 with SMTP id wk16mr28787613vcb.23.1399980683131; Tue, 13 May 2014 04:31:23 -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 ib8csp143369vcb; Tue, 13 May 2014 04:31:22 -0700 (PDT) X-Received: by 10.221.66.131 with SMTP id xq3mr6701vcb.43.1399980682587; Tue, 13 May 2014 04:31:22 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id at8si2596388vec.37.2014.05.13.04.31.22 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 13 May 2014 04:31:22 -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 1WkAtx-0007sd-Pj; Tue, 13 May 2014 11:29:41 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WkAtw-0007s3-3C for xen-devel@lists.xen.org; Tue, 13 May 2014 11:29:40 +0000 Received: from [193.109.254.147:58305] by server-8.bemta-14.messagelabs.com id DF/DE-01877-32202735; Tue, 13 May 2014 11:29:39 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1399980577!4477012!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 8883 invoked from network); 13 May 2014 11:29:38 -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; 13 May 2014 11:29:38 -0000 X-IronPort-AV: E=Sophos; i="4.97,1043,1389744000"; d="scan'208"; a="130584571" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 13 May 2014 11:29:38 +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; Tue, 13 May 2014 07:29:36 -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 1WkAtr-0004XZ-Gy; Tue, 13 May 2014 12:29:36 +0100 Received: by localhost.localdomain (sSMTP sendmail emulation); Tue, 13 May 2014 12:29:35 +0100 From: Ian Campbell To: Date: Tue, 13 May 2014 12:29:26 +0100 Message-ID: <1399980574-12515-2-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1399980488.21867.19.camel@kazak.uk.xensource.com> References: <1399980488.21867.19.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 v4 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.182 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..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