From patchwork Tue Apr 15 21:05:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Huang X-Patchwork-Id: 28433 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F33A12036D for ; Tue, 15 Apr 2014 21:09:53 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id i7sf53760281oag.0 for ; Tue, 15 Apr 2014 14:09:53 -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:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=xlupUVq6ZvbFOcMOjnp6q7NAp2/iwPdF5SqMWpKLxtg=; b=RueYkolWl/nl6eH/62lsj88C3jpzdLqSZv7NTwEdrZC+xEIxjn7u+0vltp3rdeGMim O6uzNf/qLtyiYkiEnjCsRQ9inL5TZpTFQD6JQ1DZjA6RhKnvH+UMKdYd+dD1PZu1YxGM cg7Wug95v79JIVHznEHq6KJF4jW34mM/gDj66QW9RUKK0+ZaKrK1dhPc3mFPmpfJlQ75 r74OmssfROhfI47lXn6YnGvspRxcV8XeRfqUYeDdn7ya27Kpeqki6VVeYpeQCoTzWi3I zDUU30Hdk3ZlEcRWt9Ivk9j1q+iD3ELo0k1LR8gaaHGXHtNSUhtav4i8dJnE14ew+vtM 1SKw== X-Gm-Message-State: ALoCoQm2hXo3D9lBHia0LxnPOrPWexHWeBl+WZsjY374k1VaeO1XgqR2lZ8B1hJoGrTxucDUrW8s X-Received: by 10.182.28.99 with SMTP id a3mr1969365obh.40.1397596193538; Tue, 15 Apr 2014 14:09:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.81 with SMTP id r75ls345530qga.71.gmail; Tue, 15 Apr 2014 14:09:53 -0700 (PDT) X-Received: by 10.220.191.134 with SMTP id dm6mr3136375vcb.16.1397596193393; Tue, 15 Apr 2014 14:09:53 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id z3si3572088vcx.88.2014.04.15.14.09.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Apr 2014 14:09:53 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id ik5so9817921vcb.14 for ; Tue, 15 Apr 2014 14:09:53 -0700 (PDT) X-Received: by 10.52.119.178 with SMTP id kv18mr1884998vdb.39.1397596193312; Tue, 15 Apr 2014 14:09:53 -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 ib8csp262237vcb; Tue, 15 Apr 2014 14:09:53 -0700 (PDT) X-Received: by 10.229.96.199 with SMTP id i7mr6068257qcn.20.1397596192904; Tue, 15 Apr 2014 14:09:52 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id 100si8676402qgf.137.2014.04.15.14.09.52 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 15 Apr 2014 14:09:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) 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 1WaAa8-00054r-Kp; Tue, 15 Apr 2014 21:07:52 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WaAa6-00054W-Op for xen-devel@lists.xen.org; Tue, 15 Apr 2014 21:07:50 +0000 Received: from [85.158.137.68:54542] by server-9.bemta-3.messagelabs.com id 46/38-30063-5AF9D435; Tue, 15 Apr 2014 21:07:49 +0000 X-Env-Sender: w1.huang@samsung.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1397596066!7183643!1 X-Originating-IP: [203.254.224.24] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjAzLjI1NC4yMjQuMjQgPT4gMzY1MDA2\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 1839 invoked from network); 15 Apr 2014 21:07:48 -0000 Received: from mailout1.samsung.com (HELO mailout1.samsung.com) (203.254.224.24) by server-11.tower-31.messagelabs.com with DES-CBC3-SHA encrypted SMTP; 15 Apr 2014 21:07:48 -0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N430026IC0WIY80@mailout1.samsung.com> for xen-devel@lists.xen.org; Wed, 16 Apr 2014 06:07:44 +0900 (KST) X-AuditID: cbfee61b-b7f456d000006dfd-0f-534d9fa03cc3 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 6D.7D.28157.0AF9D435; Wed, 16 Apr 2014 06:07:44 +0900 (KST) Received: from weihp.spa.sarc.sas ([105.140.31.10]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N43002SLC0INC00@mmp2.samsung.com>; Wed, 16 Apr 2014 06:07:44 +0900 (KST) From: Wei Huang To: xen-devel@lists.xen.org Date: Tue, 15 Apr 2014 16:05:07 -0500 Message-id: <1397595918-30419-3-git-send-email-w1.huang@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1397595918-30419-1-git-send-email-w1.huang@samsung.com> References: <1397595918-30419-1-git-send-email-w1.huang@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBLMWRmVeSWpSXmKPExsVy+t9jQd0F832DDa4/MLBY/HgXu8Wb3g4W ixu9t9gspv+5w2bx885FRovX5z4yWyz5uJjFouPfNDYHDo/Xkycwemx/IuJx59oeNo+ju38z efRtWcUYwBrFZZOSmpNZllqkb5fAlXHi5BWmggb+iiWrf7I1MLbzdDFyckgImEjsvbufEcIW k7hwbz1bFyMXh5DAdEaJ/TsXQznNTBJfV7exgFSxCahJnLr4H8wWEZCWuPb5MiNIEbPAHkaJ ht19zF2MHBzCAiESD5brgdSwCKhKTOiayAxi8wq4SPyd2MEGUiIhoCAxZ5INSJhTwFVicsNu sCOEBGIlPnTNYZrAyLuAkWEVo2hqQXJBcVJ6rpFecWJucWleul5yfu4mRnB4PZPewbiqweIQ owAHoxIP78wc32Ah1sSy4srcQ4wSHMxKIrwbWoBCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeQ+2 WgcKCaQnlqRmp6YWpBbBZJk4OKUaGBlfPz5itzrsantrkNaUACkfga8Kp/ZpLFu+cvvmq4tW cP87/ju0KCyLUe+bkDpf1dO6HysEvyYul95ZLTNPo0edx9j+px5rCuvrcon2x7dOb0rN0piu te8Q597j2zP8bU6Lzv3Hq8t+4v657m3+mSzzpoYu1473MrhlVVrltc5AUpX1SnlpkxJLcUai oRZzUXEiAILLhIwrAgAA Cc: w1.huang@samsung.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, julien.grall@linaro.org, jaeyong.yoo@samsung.com, yjhyun.yoo@samsung.com Subject: [Xen-devel] [RFC v2 2/6] xen/arm: implement support for XENMEM_maximum_gpfn hypercall 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: , MIME-Version: 1.0 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: w1.huang@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: From: Jaeyong Yoo This patch implements ddomain_get_maximum_gpfn by using max_mapped_gfn field of P2M struct. A support function to retrieve guest VM pfn range is also added. Signed-off-by: Evgeny Fedotov Signed-off-by: Wei Huang --- xen/arch/arm/mm.c | 21 ++++++++++++++++++++- xen/include/asm-arm/mm.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 362bc8d..473ad04 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -947,7 +947,11 @@ int page_is_ram_type(unsigned long mfn, unsigned long mem_type) unsigned long domain_get_maximum_gpfn(struct domain *d) { - return -ENOSYS; + paddr_t end; + + domain_get_gpfn_range(d, NULL, &end); + + return (unsigned long)end; } void share_xen_page_with_guest(struct page_info *page, @@ -1235,6 +1239,21 @@ int is_iomem_page(unsigned long mfn) return 1; return 0; } + +/* + * Return start and end addresses of guest VM + */ +void domain_get_gpfn_range(struct domain *d, paddr_t *start, paddr_t *end) +{ + struct p2m_domain *p2m = &d->arch.p2m; + + if ( start ) + *start = GUEST_RAM_BASE; + + if ( end ) + *end = GUEST_RAM_BASE + ((paddr_t) p2m->max_mapped_gfn); +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index b8d4e7d..8347524 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -319,6 +319,7 @@ int donate_page( #define domain_set_alloc_bitsize(d) ((void)0) #define domain_clamp_alloc_bitsize(d, b) (b) +void domain_get_gpfn_range(struct domain *d, paddr_t *start, paddr_t *end); unsigned long domain_get_maximum_gpfn(struct domain *d); extern struct domain *dom_xen, *dom_io, *dom_cow;