From patchwork Mon Apr 28 13:02:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 29238 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 57CE0202FE for ; Mon, 28 Apr 2014 13:04:22 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id m5sf5605361qaj.7 for ; Mon, 28 Apr 2014 06:04:22 -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=GlJWPQIyihsNVY1/GUJ2in5xLKnVHd3sBU/0ZP7uhOo=; b=Ew5F5M2CPx1adEs0U88HT2aM74fKgaQxwAiiCRsx0Hy56qTe00X5VwY6w2wLGjCBK/ Qn6DeBXONJ6bUws+fdbHgIM8OgQ02GKbFIlXvjseHwRVo+YhpEgw9U9hu0V9kKuvqQ+j CyA7WL2HP56RIWMg2UX9d6+cDHSGURXjxbYpsIy3r45TgMqOSssujDCgCSVflUD94H7v SoImHeFHkzZbFmlLojUSXGl05veM1IrnWH7yyVzXqhS2+6TPq4wnbuDfRpvMZE3i3ja2 6trKoaBr+ghV7DUcRvsf8lm2MiYfDyjaTDPnaUfPWtzdCRBEzf4dumUuaenbJmz2jcFY 9t3A== X-Gm-Message-State: ALoCoQlHBQ74tdpryWezmVxl2OIeHv2vZqOzmbEzhNSdXcxfaRTt1Xno60dJN5K4vhiddhX8NiI1 X-Received: by 10.58.245.132 with SMTP id xo4mr12037501vec.11.1398690262130; Mon, 28 Apr 2014 06:04:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.112 with SMTP id n103ls2606823qga.86.gmail; Mon, 28 Apr 2014 06:04:22 -0700 (PDT) X-Received: by 10.220.250.203 with SMTP id mp11mr23556818vcb.2.1398690262002; Mon, 28 Apr 2014 06:04:22 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id tv3si3594136vdc.72.2014.04.28.06.04.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Apr 2014 06:04:21 -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.171; Received: by mail-vc0-f171.google.com with SMTP id lg15so8263008vcb.30 for ; Mon, 28 Apr 2014 06:04:21 -0700 (PDT) X-Received: by 10.58.134.101 with SMTP id pj5mr269056veb.38.1398690261897; Mon, 28 Apr 2014 06:04:21 -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 ib8csp115730vcb; Mon, 28 Apr 2014 06:04:20 -0700 (PDT) X-Received: by 10.220.190.197 with SMTP id dj5mr23652953vcb.19.1398690260612; Mon, 28 Apr 2014 06:04:20 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id sn5si3590686vdc.191.2014.04.28.06.04.20 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 28 Apr 2014 06:04:20 -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-0001tW-UW; 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 1WelCt-0001rp-Ai for xen-devel@lists.xen.org; Mon, 28 Apr 2014 13:02:51 +0000 Received: from [85.158.143.35:58011] by server-1.bemta-4.messagelabs.com id E3/AB-09853-A715E535; Mon, 28 Apr 2014 13:02:50 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1398690167!1480237!3 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 20918 invoked from network); 28 Apr 2014 13:02:49 -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:49 -0000 X-IronPort-AV: E=Sophos;i="4.97,944,1389744000"; d="scan'208";a="124330234" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 28 Apr 2014 13:02:17 +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; 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 1WelCI-0001VY-Mn; Mon, 28 Apr 2014 14:02:15 +0100 Received: by localhost.localdomain (sSMTP sendmail emulation); Mon, 28 Apr 2014 14:02:14 +0100 From: Ian Campbell To: Date: Mon, 28 Apr 2014 14:02:07 +0100 Message-ID: <1398690132-5651-3-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: 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 v3 3/8] tools: arm: move magic pfns out of guest RAM region 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: Because toolstacks (at least libxl) only allow RAM to be specified in 1M increments these two pages were effectively costing 1M of guest RAM space. Since these pages don't actually need to live in RAM just move them out. With this a guest can now use the full 768M of the address space reserved for RAM. (ok, not that impressive, but it simplifies things later) Signed-off-by: Ian Campbell Acked-by: Julien Grall Acked-by: Ian Jackson --- v3: make the size of the region explicit. v2: remove spurious w/s change tools: arm: make the size of the magic page region explicit Signed-off-by: Ian Campbell --- tools/libxc/xc_dom_arm.c | 14 ++++++++------ xen/include/public/arch-arm.h | 3 +++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index 46dfc36..74917c3 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -58,12 +58,15 @@ static int setup_pgtables_arm(struct xc_dom_image *dom) static int alloc_magic_pages(struct xc_dom_image *dom) { int rc, i; + const xen_pfn_t base = GUEST_MAGIC_BASE >> XC_PAGE_SHIFT; xen_pfn_t p2m[NR_MAGIC_PAGES]; + XC_BUILD_BUG_ON(NR_MAGIC_PAGES > GUEST_MAGIC_SIZE >> XC_PAGE_SHIFT); + DOMPRINTF_CALLED(dom->xch); for (i = 0; i < NR_MAGIC_PAGES; i++) - p2m[i] = dom->rambase_pfn + dom->total_pages + i; + p2m[i] = base + i; rc = xc_domain_populate_physmap_exact( dom->xch, dom->guest_domid, NR_MAGIC_PAGES, @@ -71,8 +74,8 @@ static int alloc_magic_pages(struct xc_dom_image *dom) if ( rc < 0 ) return rc; - dom->console_pfn = dom->rambase_pfn + dom->total_pages + CONSOLE_PFN_OFFSET; - dom->xenstore_pfn = dom->rambase_pfn + dom->total_pages + XENSTORE_PFN_OFFSET; + dom->console_pfn = base + CONSOLE_PFN_OFFSET; + dom->xenstore_pfn = base + XENSTORE_PFN_OFFSET; xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn); xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn); @@ -272,12 +275,11 @@ int arch_setup_meminit(struct xc_dom_image *dom) return -1; } - if ( ramsize > GUEST_RAM_SIZE - NR_MAGIC_PAGES*XC_PAGE_SIZE ) + if ( ramsize > GUEST_RAM_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); + __FUNCTION__, ramsize, GUEST_RAM_SIZE); return -1; } diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index dd53c94..6630f36 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -375,6 +375,9 @@ typedef uint64_t xen_callback_t; #define GUEST_GNTTAB_BASE 0xb0000000ULL #define GUEST_GNTTAB_SIZE 0x00020000ULL +#define GUEST_MAGIC_BASE 0xc0000000ULL +#define GUEST_MAGIC_SIZE 0x01000000ULL + /* Interrupts */ #define GUEST_TIMER_VIRT_PPI 27 #define GUEST_TIMER_PHYS_S_PPI 29