From patchwork Tue Dec 10 14:18:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22220 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1083323908 for ; Tue, 10 Dec 2013 14:18:53 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id r5sf9986235qcx.8 for ; Tue, 10 Dec 2013 06:18:52 -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=R7o0hFDrgA8hzGL55bf7p0mEquu3iPWpQgPbAuiUTZ8=; b=ZJrS33NbUVtlqiuN8YoJopVTcsF2hjxOfM0bVcW4ZToSJRDxyU8tWkNeUKpXTE6nzu oWhwWJEEu7YhEsBYjvOtmA40cRKY0t5JcwYiAGqDNFZGkkMd48ZmCYIia+hN1LgCituX YicBc6tebJvBOFmVYDpGuorCNRY8TVSy0/xWwl7/J/fcxOFHEKRcCTH5W0cG1ZgneTkW rerViS4frvRx6lu8fpbRnpArlUGo/59gnUbEA0AJRH/t48mcVqqeGR0+9uNLdVpHi/Lc lr/TqjxXtSuybWLqqMCV467Nw3ib+35LS+RjBUzC9wa/lIHOBzlY0+N6jqWefgkbdCFV QpJQ== X-Gm-Message-State: ALoCoQm7ABWB/KDo95x6vyGdopt9SYh+MCpWRH21UMPY5q6ONeS4YSxjV6eFjXNdh/wT0scXRtOi X-Received: by 10.224.104.8 with SMTP id m8mr8522815qao.0.1386685132919; Tue, 10 Dec 2013 06:18:52 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.60.228 with SMTP id k4ls2474551qer.93.gmail; Tue, 10 Dec 2013 06:18:52 -0800 (PST) X-Received: by 10.53.13.44 with SMTP id ev12mr11344122vdd.17.1386685132771; Tue, 10 Dec 2013 06:18:52 -0800 (PST) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id hs8si5189866veb.22.2013.12.10.06.18.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 06:18:52 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id lh4so4688602vcb.9 for ; Tue, 10 Dec 2013 06:18:52 -0800 (PST) X-Received: by 10.221.51.206 with SMTP id vj14mr4684360vcb.17.1386685132673; Tue, 10 Dec 2013 06:18:52 -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 u4csp191444vcz; Tue, 10 Dec 2013 06:18:52 -0800 (PST) X-Received: by 10.194.20.230 with SMTP id q6mr41017933wje.49.1386685130222; Tue, 10 Dec 2013 06:18:50 -0800 (PST) Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com [74.125.82.42]) by mx.google.com with ESMTPS id i2si1023936wie.28.2013.12.10.06.18.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 06:18:50 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.42 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.42; Received: by mail-wg0-f42.google.com with SMTP id a1so4720009wgh.5 for ; Tue, 10 Dec 2013 06:18:46 -0800 (PST) X-Received: by 10.194.79.165 with SMTP id k5mr4095639wjx.44.1386685126240; Tue, 10 Dec 2013 06:18:46 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id nb16sm5556779wic.0.2013.12.10.06.18.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Dec 2013 06:18:45 -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 v3 07/10] xen/arm: Implement xen_rem_foreign_from_p2m Date: Tue, 10 Dec 2013 14:18:19 +0000 Message-Id: <1386685102-563-8-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386685102-563-1-git-send-email-julien.grall@linaro.org> References: <1386685102-563-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.178 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 v3: - Move put_page in create_p2m_entries - Move xenmem_rem_foreign_from_p2m in arch/arm/p2m.c Changes in v2: - Introduce the patch --- xen/arch/arm/p2m.c | 19 ++++++++++++++++++- xen/include/asm-arm/p2m.h | 6 +----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 39d8a03..72946c6 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -317,7 +317,14 @@ static int create_p2m_entries(struct domain *d, break; case REMOVE: { - lpae_t pte; + lpae_t pte = third[third_table_offset(addr)]; + unsigned long mfn = maddr >> PAGE_SHIFT; + p2m_type_t t = pte.p2m.type; + + /* TODO: Handle other p2m type */ + if ( mfn_valid(mfn) && p2m_is_foreign(t) ) + put_page(mfn_to_page(mfn)); + memset(&pte, 0x00, sizeof(pte)); write_pte(&third[third_table_offset(addr)], pte); maddr += PAGE_SIZE; @@ -380,6 +387,16 @@ void guest_physmap_remove_page(struct domain *d, pfn_to_paddr(mfn), MATTR_MEM, p2m_invalid); } +int xenmem_rem_foreign_from_p2m(struct domain *d, unsigned long gpfn) +{ + unsigned long mfn = gmfn_to_mfn(d, gpfn); + + ASSERT(mfn_valid(mfn)); + guest_physmap_remove_page(d, gpfn, mfn, 0); + + return 0; +} + int p2m_alloc_table(struct domain *d) { struct p2m_domain *p2m = &d->arch.p2m; diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 52b33ce..3d1696c 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -144,11 +144,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 */