From patchwork Mon Dec 9 03:34:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22155 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f71.google.com (mail-vb0-f71.google.com [209.85.212.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9C38823FE0 for ; Mon, 9 Dec 2013 03:34:25 +0000 (UTC) Received: by mail-vb0-f71.google.com with SMTP id p6sf327713vbe.2 for ; Sun, 08 Dec 2013 19:34:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=RGDmRnH+0mtsKx0w7Dr4stiOIjUVN8Oj0q15w6TNBFo=; b=KZSuhUiNJkiQV9MX7JjZ2WnWi1SxZnFGPdaROhvNAFzxzLHjJwn4h/09v5ihsdqLni QWroLJ7TErR0KVMxfi24FWslYz7ciBRtjEEzrQrDxMrLyqEa1h7uddIf9aIzmaJgyvR2 xF4mz2HBNpCU7P5rDkziUG66fvRmXi69IVD2relEYvGqxnFNr9SYUjNvRmAgr88DEPRf JxK1nzuKxEpfVENnu08oWa5yd7DxLihE97FtXSlfwSZHFD13x8hOdSD/d0KHHpfvp0Wn CJdsrxEb1Y+UGaA80mDfmSg30DHxvYRWtWbho5fTE99Lwafnym5gQMWqv1MfXwhC98h+ JbtQ== X-Gm-Message-State: ALoCoQkOE8QxonSDemUUEu3WtL4IQgFNfcsA5FdplCCXTcQ+t34SyUrnF5czpnGM0L0DNl3Br0KS X-Received: by 10.236.27.79 with SMTP id d55mr19534938yha.17.1386560065468; Sun, 08 Dec 2013 19:34:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.41.66 with SMTP id d2ls1967861qel.10.gmail; Sun, 08 Dec 2013 19:34:25 -0800 (PST) X-Received: by 10.220.183.199 with SMTP id ch7mr792888vcb.27.1386560065356; Sun, 08 Dec 2013 19:34:25 -0800 (PST) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id at4si3164454ved.151.2013.12.08.19.34.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 08 Dec 2013 19:34:25 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.173 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.173; Received: by mail-vc0-f173.google.com with SMTP id ia6so2929479vcb.4 for ; Sun, 08 Dec 2013 19:34:25 -0800 (PST) X-Received: by 10.220.86.69 with SMTP id r5mr10293322vcl.9.1386560065278; Sun, 08 Dec 2013 19:34:25 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp75731vcz; Sun, 8 Dec 2013 19:34:24 -0800 (PST) X-Received: by 10.15.23.206 with SMTP id h54mr11084306eeu.17.1386560064465; Sun, 08 Dec 2013 19:34:24 -0800 (PST) Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com [74.125.83.53]) by mx.google.com with ESMTPS id 5si7711760eei.123.2013.12.08.19.34.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 08 Dec 2013 19:34:24 -0800 (PST) Received-SPF: neutral (google.com: 74.125.83.53 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.83.53; Received: by mail-ee0-f53.google.com with SMTP id b57so1279097eek.40 for ; Sun, 08 Dec 2013 19:34:24 -0800 (PST) X-Received: by 10.14.210.200 with SMTP id u48mr25538450eeo.63.1386560063952; Sun, 08 Dec 2013 19:34:23 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id g7sm23681234eet.12.2013.12.08.19.34.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Dec 2013 19:34:23 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: patches@linaro.org, ian.campbell@citrix.com, tim@xen.org, stefano.stabellini@citrix.com, 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> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386560047-17500-1-git-send-email-julien.grall@linaro.org> References: <1386560047-17500-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 */