From patchwork Tue Apr 15 21:05:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Huang X-Patchwork-Id: 28436 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D8AAE2036D for ; Tue, 15 Apr 2014 21:10:01 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id eb12sf53837212oac.3 for ; Tue, 15 Apr 2014 14:10:01 -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=N+iLsL7m4V2slYSNGzuipleiiX7rEl5STT2Y9qqqaCqaY7rTXnbXs4xljwJefyQoDp hfQvRvUnRKIh0LRWJjQqGDyKOBaiF1IXzKmSNZ6eM8STdUGevDniw3sb5PjTWrtHSgA+ LfS4uZes4Yel00A+gqgCxDTVXHYYa9cpT0Z9xtBoaZWfSZF5hpBdvOEyDRFbew7/zKD7 guleYCziE6W10bXtK1BpuibiRaQH5UwtYi/f479topa9tAvVn7NWKjwbMy8s+Iqr5kNO nj/kBY9ftN2I5gqPUw1dEj2fA84Ic7M8Fdw/CPcNHtyh6XkR0AI8vQKDb5weNEERvBMh bMCw== X-Gm-Message-State: ALoCoQnXCkRv6BplN4ipQMcwU59aYR37vfIIXhlKpQc+B23gKKrqZ6mPisSN6/QJukJgVe/0K6Pa X-Received: by 10.43.78.135 with SMTP id zm7mr273872icb.27.1397596201071; Tue, 15 Apr 2014 14:10:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.197 with SMTP id j63ls352833qgf.89.gmail; Tue, 15 Apr 2014 14:10:01 -0700 (PDT) X-Received: by 10.220.250.203 with SMTP id mp11mr3104851vcb.2.1397596200972; Tue, 15 Apr 2014 14:10:00 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id vd8si3618537vdc.16.2014.04.15.14.10.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Apr 2014 14:10:00 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 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.177; Received: by mail-vc0-f177.google.com with SMTP id if17so9603896vcb.22 for ; Tue, 15 Apr 2014 14:10:00 -0700 (PDT) X-Received: by 10.221.29.137 with SMTP id ry9mr3124381vcb.6.1397596200900; Tue, 15 Apr 2014 14:10:00 -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 ib8csp262244vcb; Tue, 15 Apr 2014 14:10:00 -0700 (PDT) X-Received: by 10.220.162.6 with SMTP id t6mr3137368vcx.12.1397596200562; Tue, 15 Apr 2014 14:10:00 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id cx1si2280266vdb.20.2014.04.15.14.09.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 15 Apr 2014 14:10:00 -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 1WaAaQ-0005HD-II; Tue, 15 Apr 2014 21:08:10 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WaAaN-0005D6-5R for xen-devel@lists.xen.org; Tue, 15 Apr 2014 21:08:07 +0000 Received: from [85.158.139.211:46862] by server-17.bemta-5.messagelabs.com id 27/7F-09046-6BF9D435; Tue, 15 Apr 2014 21:08:06 +0000 X-Env-Sender: w1.huang@samsung.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1397596081!7715476!1 X-Originating-IP: [203.254.224.25] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjAzLjI1NC4yMjQuMjUgPT4gMzcxMzg3\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6722 invoked from network); 15 Apr 2014 21:08:04 -0000 Received: from mailout2.samsung.com (HELO mailout2.samsung.com) (203.254.224.25) by server-15.tower-206.messagelabs.com with DES-CBC3-SHA encrypted SMTP; 15 Apr 2014 21:08:04 -0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N430094ZC1DCF00@mailout2.samsung.com> for xen-devel@lists.xen.org; Wed, 16 Apr 2014 06:08:01 +0900 (KST) X-AuditID: cbfee61b-b7f456d000006dfd-aa-534d9fb1b12d Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 8A.9D.28157.1BF9D435; Wed, 16 Apr 2014 06:08:01 +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:08:01 +0900 (KST) From: Wei Huang To: xen-devel@lists.xen.org Date: Tue, 15 Apr 2014 16:05:14 -0500 Message-id: <1397595918-30419-10-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+NgFprOLMWRmVeSWpSXmKPExsVy+t9jQd2N832DDc6ekLRY/HgXu8Wb3g4W ixu9t9gspv+5w2bx885FRovX5z4yWyz5uJjFouPfNDYHDo/Xkycwemx/IuJx59oeNo+ju38z efRtWcUYwBrFZZOSmpNZllqkb5fAlXHi5BWmggb+iiWrf7I1MLbzdDFyckgImEjMOPyQGcIW k7hwbz1bFyMXh5DAdEaJOx3nmCCcZiaJG3ffsYBUsQmoSZy6+B/MFhGQlrj2+TIjSBGzwB5G iYbdfUCjODiEBUIkHizXAzFZBFQlZu0VASnnFXCV2P51HitIWEJAQWLOJBuQMCdQeHLDbkYQ W0ggVuJD1xymCYy8CxgZVjGKphYkFxQnpeca6RUn5haX5qXrJefnbmIEB9cz6R2MqxosDjEK cDAq8fDOzPENFmJNLCuuzD3EKMHBrCTCu6EFKMSbklhZlVqUH19UmpNafIhRmoNFSZz3YKt1 oJBAemJJanZqakFqEUyWiYNTqoGx0MhHfat8cskGTQa31zfiOqZMs5E84MEx/5IfazjLxzl9 Ck0qPgXTF5iLPUv82bQm6z/P1pMb521hd1JbvvvR7P91By4cnBjpP0FHx/jN5ZbtkdvkVWqt QhbqHZ3Etuez+zPxgP6fPAvlOF//+B/qEOo9pzw2/py7wix/UyaLnGaLuF3T5+cpsRRnJBpq MRcVJwIAJCPJ5ioCAAA= 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.177 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;