From patchwork Tue May 13 11:29:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 30036 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f71.google.com (mail-qg0-f71.google.com [209.85.192.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AE7A920369 for ; Tue, 13 May 2014 11:31:56 +0000 (UTC) Received: by mail-qg0-f71.google.com with SMTP id a108sf387025qge.6 for ; Tue, 13 May 2014 04:31:56 -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=g6LbtE8BF7BYW5aiulWqIZ/WefkOfCA3CWN7ciC9H/w=; b=gO4ym6Ax5BompjlW61C5B9Ni3Fp5A+o5Jz3MfQ85ASzFuFAjfguyRxXSs4PvMUuuQV KfwxoGcbESNCNu5vdn1K5S9CnBY9N8aS5/Garq+bT4X5rfsmJHf6iS0KIoCHWwFW6uFR 20ALK+fiWODHVlFqcx/rP5UCX/oU/OuNEO0Hvt4OX6OLA/Rr4Qe2zPymYZu69lqp3SY7 4O9VxxYn1ryklm7QHIgxxYaHYtZCvcf2xg6Pm8KCvkiTcDojV0WPUUNUNHIyQYid3aqT x2o2zrpeHmm1Uauj6jV71CZmALdUe3w7QFAa70k0nOOAEfW1ETazz/dqeivDuTmzP0RU q2Fw== X-Gm-Message-State: ALoCoQmNLLvuKST2ehXf87CXy0OaEWnn9m0DuIT006COFdP0WSn7o4LBu7Qg+z1+bsjXmTcr79Kv X-Received: by 10.58.94.232 with SMTP id df8mr16458378veb.23.1399980716466; Tue, 13 May 2014 04:31:56 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.180 with SMTP id w49ls1819357qge.3.gmail; Tue, 13 May 2014 04:31:56 -0700 (PDT) X-Received: by 10.220.191.134 with SMTP id dm6mr28966005vcb.16.1399980716346; Tue, 13 May 2014 04:31:56 -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 tb2si2582605vdc.201.2014.05.13.04.31.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 04:31:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.181 as permitted sender) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id pa12so235330veb.12 for ; Tue, 13 May 2014 04:31:56 -0700 (PDT) X-Received: by 10.58.143.13 with SMTP id sa13mr78018veb.44.1399980716152; Tue, 13 May 2014 04:31:56 -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 ib8csp143427vcb; Tue, 13 May 2014 04:31:55 -0700 (PDT) X-Received: by 10.50.118.69 with SMTP id kk5mr53925429igb.10.1399980715249; Tue, 13 May 2014 04:31:55 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id nw2si2666543icc.201.2014.05.13.04.31.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 13 May 2014 04:31:55 -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 1WkAty-0007tE-BR; Tue, 13 May 2014 11:29:42 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WkAtw-0007s9-IL for xen-devel@lists.xen.org; Tue, 13 May 2014 11:29:40 +0000 Received: from [85.158.139.211:57781] by server-16.bemta-5.messagelabs.com id AA/B2-19700-32202735; Tue, 13 May 2014 11:29:39 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-6.tower-206.messagelabs.com!1399980576!3948538!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 28075 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-6.tower-206.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="130584577" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 13 May 2014 11:29:40 +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:37 -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 1WkAts-0004Xc-IS; Tue, 13 May 2014 12:29:37 +0100 Received: by localhost.localdomain (sSMTP sendmail emulation); Tue, 13 May 2014 12:29:36 +0100 From: Ian Campbell To: Date: Tue, 13 May 2014 12:29:27 +0100 Message-ID: <1399980574-12515-3-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: 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 v4 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.128.181 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 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