From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: [PATCH v2 08/10] xen/arm: Implement xen_rem_foreign_from_p2m Date: Mon, 9 Dec 2013 03:34:05 +0000 Message-ID: <1386560047-17500-9-git-send-email-julien.grall@linaro.org> References: <1386560047-17500-1-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Vprc1-0007Ug-SC for xen-devel@lists.xenproject.org; Mon, 09 Dec 2013 03:34:26 +0000 Received: by mail-ee0-f49.google.com with SMTP id c41so1278463eek.8 for ; Sun, 08 Dec 2013 19:34:24 -0800 (PST) In-Reply-To: <1386560047-17500-1-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com, patches@linaro.org List-Id: xen-devel@lists.xenproject.org Signed-off-by: Julien Grall --- Changes in v2: - Introduce the patch --- xen/arch/arm/mm.c | 16 ++++++++++++++++ xen/include/asm-arm/p2m.h | 6 +----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 960c872..ba51f6e 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -968,6 +968,22 @@ void share_xen_page_with_privileged_guests( share_xen_page_with_guest(page, dom_xen, readonly); } +int xenmem_rem_foreign_from_p2m(struct domain *d, unsigned long gpfn) +{ + unsigned long mfn = gmfn_to_mfn(d, gpfn); + if ( !mfn_valid(mfn) ) + { + gdprintk(XENLOG_WARNING, "Invalid mfn for gpfn:%lx domid:%d\n", + gpfn, d->domain_id); + return -EINVAL; + } + + guest_physmap_remove_page(d, gpfn, mfn, 0); + put_page(mfn_to_page(mfn)); + + return 0; +} + static int xenmem_add_to_physmap_one( struct domain *d, uint16_t space, diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index b0d3aea..cdd80d8 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -152,11 +152,7 @@ static inline int get_page_and_type(struct page_info *page, return rc; } -static inline int xenmem_rem_foreign_from_p2m(struct domain *d, - unsigned long gpfn) -{ - return -ENOSYS; -} +int xenmem_rem_foreign_from_p2m(struct domain *d, unsigned long gpfn); #endif /* _XEN_P2M_H */ -- 1.7.10.4