From patchwork Fri Apr 25 11:22:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 29058 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 45486203AC for ; Fri, 25 Apr 2014 11:24:46 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j17sf20914863oag.6 for ; Fri, 25 Apr 2014 04:24:45 -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=JaimhhtoXw+8+VyVQbLhkHAznZOCYymMYLCWBVoRLDg=; b=maRi4Fmh5A4Ge54nqIRjaVaQRouAKaYocEmtPztY2bqlF2hGTrydgnCSLF9nfL2F6K myj0ctYX+YddOaUJF6e+xr4G7vu2/rlB/k36UOm+8dM9JDDcpZqdQgvlxY+LKdPBP6bs Q/xsTQe9++w9QYL3keCXeIolIg+4rW+vWQp5znoDztb/vGWHF0WE7h84y/GaUWmAn5Bi taEUldrPae45y1ApPOup1zu8lGvvlasXRiNUWA00ksGfFlXQnfbbwnh+0zpSss9JKChs ZtLYlKI1VW0yUnemGzSJkEzbnME9J12CJ7XOGIgBcVSoahbk4gQBLQBZTMRi1e565yFL r42w== X-Gm-Message-State: ALoCoQkTSCsNIQds3Gvp5W75szgH220+/5PFbvqpcU01g6+old853qDvOjZ2ncKzCYEKwgjpTqf1 X-Received: by 10.42.185.1 with SMTP id cm1mr3908846icb.10.1398425085769; Fri, 25 Apr 2014 04:24:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.81 with SMTP id r75ls1539474qga.71.gmail; Fri, 25 Apr 2014 04:24:45 -0700 (PDT) X-Received: by 10.52.191.100 with SMTP id gx4mr5325617vdc.4.1398425085644; Fri, 25 Apr 2014 04:24:45 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id sh5si1620325vdc.104.2014.04.25.04.24.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Apr 2014 04:24:45 -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.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so4403934veb.40 for ; Fri, 25 Apr 2014 04:24:45 -0700 (PDT) X-Received: by 10.52.249.105 with SMTP id yt9mr897173vdc.34.1398425085569; Fri, 25 Apr 2014 04:24:45 -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 ib8csp89818vcb; Fri, 25 Apr 2014 04:24:45 -0700 (PDT) X-Received: by 10.220.249.6 with SMTP id mi6mr95971vcb.33.1398425085270; Fri, 25 Apr 2014 04:24:45 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id xv15si1621998veb.152.2014.04.25.04.24.44 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 25 Apr 2014 04:24:45 -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 1WdeDX-0004OS-Ow; Fri, 25 Apr 2014 11:22:55 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WdeDV-0004N0-Tx for xen-devel@lists.xen.org; Fri, 25 Apr 2014 11:22:54 +0000 Received: from [193.109.254.147:41538] by server-15.bemta-14.messagelabs.com id E7/D2-15813-D854A535; Fri, 25 Apr 2014 11:22:53 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1398424970!873563!2 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 3332 invoked from network); 25 Apr 2014 11:22:52 -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:52 -0000 X-IronPort-AV: E=Sophos;i="4.97,926,1389744000"; d="scan'208";a="124530966" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 25 Apr 2014 11:22:51 +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.123.3; Fri, 25 Apr 2014 07:22:50 -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 1WdeDR-00075y-Bu; Fri, 25 Apr 2014 12:22:50 +0100 Received: by localhost.localdomain (sSMTP sendmail emulation); Fri, 25 Apr 2014 12:22:49 +0100 From: Ian Campbell To: Date: Fri, 25 Apr 2014 12:22:42 +0100 Message-ID: <1398424967-9306-3-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: 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 v2 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 --- v2: remove spurious w/s change --- tools/libxc/xc_dom_arm.c | 12 ++++++------ xen/include/public/arch-arm.h | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index 46dfc36..5760bb1 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -58,12 +58,13 @@ 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 >> PAGE_SHIFT; xen_pfn_t p2m[NR_MAGIC_PAGES]; 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 +72,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 +273,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..a94d16b 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -375,6 +375,8 @@ typedef uint64_t xen_callback_t; #define GUEST_GNTTAB_BASE 0xb0000000ULL #define GUEST_GNTTAB_SIZE 0x00020000ULL +#define GUEST_MAGIC_BASE 0xc0000000ULL + /* Interrupts */ #define GUEST_TIMER_VIRT_PPI 27 #define GUEST_TIMER_PHYS_S_PPI 29