From patchwork Mon Apr 28 13:02:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 29240 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 6CAFF202FE for ; Mon, 28 Apr 2014 13:04:42 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j17sf40651866oag.6 for ; Mon, 28 Apr 2014 06:04:42 -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=TJCZNWzQQPcnVdLvcFuJAuN4DOx05yXbXSdM2+2L6w0=; b=Ji7jSjCYHsy4A5crwh4sYqa10Yy15EKq4L5fSag71H0lVd/ZcSrkaMz7i8cFgcC0N0 xh9gMexCTVTWR55rqDMO8rWLJK3DsPeTFbVJKespoeg2+dncmE6guxTwiQAZrb9vIZKy P0B62TgRrBoPwI7hE0Dhs6F/MGte9bpfCp0hm25+yyYnjFzXzpGZhJZYwbT7Kpf130NK JqboSFr17FfvdOfo6sFLAT9MfQ4nBFIy78BviHA8jJm4XHShN32kJnqE1PdsgjwBHROW 8mu3BWpjdp4Nh7mVxyTk5bVgVh+DuoB2/usSyB8pmAeb0w85ZH4TGyVlWh1YPqwaISmR wgCw== X-Gm-Message-State: ALoCoQlq2Y2tQ982LlJdjNo1R7adSfYHZq8cZppQcSxrlN1gavjpWYisiHHJtdmUh+FpyOGvdpcM X-Received: by 10.182.97.136 with SMTP id ea8mr13084321obb.3.1398690281961; Mon, 28 Apr 2014 06:04:41 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.43.35 with SMTP id d32ls1634939qga.87.gmail; Mon, 28 Apr 2014 06:04:41 -0700 (PDT) X-Received: by 10.52.0.176 with SMTP id 16mr5603vdf.60.1398690281769; Mon, 28 Apr 2014 06:04:41 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id t4si3596901vcz.166.2014.04.28.06.04.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Apr 2014 06:04:41 -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.128.175; Received: by mail-ve0-f175.google.com with SMTP id oz11so7875183veb.34 for ; Mon, 28 Apr 2014 06:04:41 -0700 (PDT) X-Received: by 10.52.34.4 with SMTP id v4mr432440vdi.42.1398690281691; Mon, 28 Apr 2014 06:04:41 -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 ib8csp115759vcb; Mon, 28 Apr 2014 06:04:41 -0700 (PDT) X-Received: by 10.220.92.193 with SMTP id s1mr516020vcm.34.1398690281074; Mon, 28 Apr 2014 06:04:41 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id l2si3595984vcf.151.2014.04.28.06.04.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 28 Apr 2014 06:04:41 -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 1WelCu-0001sr-Ci; Mon, 28 Apr 2014 13:02:52 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WelCs-0001rQ-8h for xen-devel@lists.xen.org; Mon, 28 Apr 2014 13:02:50 +0000 Received: from [85.158.143.35:62471] by server-3.bemta-4.messagelabs.com id CA/17-13602-9715E535; Mon, 28 Apr 2014 13:02:49 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1398690167!1480237!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 20671 invoked from network); 28 Apr 2014 13:02:48 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-9.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 28 Apr 2014 13:02:48 -0000 X-IronPort-AV: E=Sophos;i="4.97,944,1389744000"; d="scan'208";a="124330217" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 28 Apr 2014 13:02:16 +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.181.6; Mon, 28 Apr 2014 09:02:15 -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 1WelCH-0001VV-LE; Mon, 28 Apr 2014 14:02:14 +0100 Received: by localhost.localdomain (sSMTP sendmail emulation); Mon, 28 Apr 2014 14:02:13 +0100 From: Ian Campbell To: Date: Mon, 28 Apr 2014 14:02:06 +0100 Message-ID: <1398690132-5651-2-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1398690109.29700.82.camel@kazak.uk.xensource.com> References: <1398690109.29700.82.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: ian.jackson@eu.citrix.com, julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH v3 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 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