From patchwork Thu May 22 09:46:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 30580 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 31E0220671 for ; Thu, 22 May 2014 09:48:28 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id rd3sf10073358pab.3 for ; Thu, 22 May 2014 02:48:27 -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=Iicd4/B398CKjY8X0/ZLLr/aDo3D6axwmIUSZ5oSqXU=; b=L5FldC29G748bNGvk7lv4UArEoby3ib6s/YH+zbaTlIF+Il8n2JZ+WgN/MtPlZZaAN 7SfAi5B1oyJGk9wPwqeE31ycynQ8/aOgWqAaaP/hafUNUonfhp8QfHsVlkorC7/w1bHQ ZgscgMMxpxfH8TZgSxV6fhISpF/Kt3R0CJ87ODzg7h1tVe1Yrhqb30RXofi8gC3PYCUH 8srW1buzKrW/Ih1/W7hvlavPejLvrzDZxIJtl0Nlu65IvOTHwA3VSXuwyqFWXZL6wVtg dnOCvNzyGsx9BAE6ptpkMOoGKYhojt8ST1zRPP7FaJTOqMsPT2Q6We7cno+wClEsKnkc XA6g== X-Gm-Message-State: ALoCoQk1MnQexlFTZfzMrqvv4e4uZWMlM5m6N6l5/DlUGe6/qIfsaHpHY6zdEincsFpKcNsWPCP2 X-Received: by 10.66.149.67 with SMTP id ty3mr22121166pab.27.1400752107384; Thu, 22 May 2014 02:48:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.72 with SMTP id k66ls1037090qgd.96.gmail; Thu, 22 May 2014 02:48:27 -0700 (PDT) X-Received: by 10.221.27.8 with SMTP id ro8mr14975279vcb.30.1400752107271; Thu, 22 May 2014 02:48:27 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id pd4si2246230vec.35.2014.05.22.02.48.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 May 2014 02:48:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id id10so722512vcb.35 for ; Thu, 22 May 2014 02:48:27 -0700 (PDT) X-Received: by 10.52.153.229 with SMTP id vj5mr12531658vdb.34.1400752107188; Thu, 22 May 2014 02:48:27 -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 ib8csp183713vcb; Thu, 22 May 2014 02:48:26 -0700 (PDT) X-Received: by 10.224.165.148 with SMTP id i20mr75643775qay.41.1400752106509; Thu, 22 May 2014 02:48:26 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id t6si4634353qag.120.2014.05.22.02.48.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 May 2014 02:48:26 -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 1WnPag-0005F2-Uj; Thu, 22 May 2014 09:47:10 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WnPaf-0005EX-F8 for xen-devel@lists.xen.org; Thu, 22 May 2014 09:47:09 +0000 Received: from [85.158.137.68:41415] by server-13.bemta-3.messagelabs.com id C7/9C-18692-C97CD735; Thu, 22 May 2014 09:47:08 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1400752026!5465608!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 30497 invoked from network); 22 May 2014 09:47:07 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-5.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 22 May 2014 09:47:07 -0000 X-IronPort-AV: E=Sophos;i="4.98,886,1392163200"; d="scan'208";a="134487229" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 22 May 2014 09:46:49 +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:48 -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 1WnPaJ-0000m9-39; Thu, 22 May 2014 10:46:48 +0100 Received: by localhost.localdomain (sSMTP sendmail emulation); Thu, 22 May 2014 10:46:47 +0100 From: Ian Campbell To: , , , Date: Thu, 22 May 2014 10:46:38 +0100 Message-ID: <1400752004-9731-3-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: MIA1 Cc: Ian Campbell , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH v5 3/9] 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 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: 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 d5831a2..81d5fc7 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" > %llx", - __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