From patchwork Tue Oct 21 18:10:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 39223 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F173F2039B for ; Tue, 21 Oct 2014 18:15:13 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id a1sf1069366wgh.9 for ; Tue, 21 Oct 2014 11:15:12 -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:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=LrS2/OIMGACTw23CePx/Gf6erV0z0dZ6bhwTFnbxlYE=; b=msdJu1mHtSrt5R4X+eVhKQtp0zxrHA1DXkqhJKhQeIOed2lRei1Wyqv/c+qHPIesYQ gx1fsr7p2HnPRy5Hnx5Rw75tLpFd4QU/SPAtMwxxOWTN3vl3Rh0cIML+87jyw7OhMUl9 uQwMZd0cW9w+l9ZXy3+iqnAzu49/G3AyNTKeasx2lfrzHZsmE4GKgtvPX3IXmBlSyC+W ZgABjIwuEiumb1R6MZD2uHWzjzsr+kHzQh8/uyDk55H9SlKG61ushgtmNGDYyL8YWGWD 5qyTsNdVFqf0ESxDuGg5p5uHmgRzjTf7Mrqghn8stVM55NUmpOs2Kmmn1a9cqe50pRjJ Qidw== X-Gm-Message-State: ALoCoQkb5T8XygDIL35hQRylFJ0cOaZa2HH9jyLIBj+rZHtja2stjezgY8kHvnTn4nO6t2vPgoeY X-Received: by 10.180.19.198 with SMTP id h6mr3831835wie.5.1413915312539; Tue, 21 Oct 2014 11:15:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.39 with SMTP id y7ls92354lag.0.gmail; Tue, 21 Oct 2014 11:15:12 -0700 (PDT) X-Received: by 10.112.189.10 with SMTP id ge10mr36277134lbc.23.1413915312091; Tue, 21 Oct 2014 11:15:12 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id j9si20206444lag.75.2014.10.21.11.15.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 11:15:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id q1so1551757lam.32 for ; Tue, 21 Oct 2014 11:15:11 -0700 (PDT) X-Received: by 10.112.130.41 with SMTP id ob9mr35935071lbb.74.1413915311390; Tue, 21 Oct 2014 11:15:11 -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.112.84.229 with SMTP id c5csp556152lbz; Tue, 21 Oct 2014 11:15:10 -0700 (PDT) X-Received: by 10.224.98.212 with SMTP id r20mr13647670qan.31.1413915307892; Tue, 21 Oct 2014 11:15:07 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id n9si1460140qgd.8.2014.10.21.11.15.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 21 Oct 2014 11:15:07 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) 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 1Xgdvu-00029q-S3; Tue, 21 Oct 2014 18:13:22 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xgdvs-00027H-Ps for xen-devel@lists.xensource.com; Tue, 21 Oct 2014 18:13:21 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id 6B/37-02953-042A6445; Tue, 21 Oct 2014 18:13:20 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-10.tower-206.messagelabs.com!1413915194!5642026!5 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.12.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10508 invoked from network); 21 Oct 2014 18:13:19 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-10.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 21 Oct 2014 18:13:19 -0000 X-IronPort-AV: E=Sophos;i="5.04,763,1406592000"; d="scan'208";a="184785998" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Tue, 21 Oct 2014 14:13:13 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1Xgdvg-0001jK-Ex; Tue, 21 Oct 2014 19:13:08 +0100 From: Stefano Stabellini To: Date: Tue, 21 Oct 2014 19:10:38 +0100 Message-ID: <1413915038-17490-8-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA2 Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, JBeulich@suse.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v10 8/8] Revert "xen: introduce arch_grant_(un)map_page_identity" 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: , 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: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) 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: This reverts commit e25a5f4d8cf3b55718048abdd21c7d0de64ae54c. With the removal of XENFEAT_grant_map_identity, this commit is not needed anymore. Signed-off-by: Stefano Stabellini Reviewed-by: Julien Grall Acked-by: Ian Campbell --- xen/arch/arm/p2m.c | 26 -------------------------- xen/drivers/passthrough/arm/smmu.c | 13 +++++++++++-- xen/include/asm-arm/p2m.h | 4 ---- xen/include/asm-x86/p2m.h | 4 ---- 4 files changed, 11 insertions(+), 36 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 20bcc9e..6b7569a 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -982,32 +982,6 @@ void guest_physmap_remove_page(struct domain *d, pfn_to_paddr(mfn), MATTR_MEM, p2m_invalid); } -int arch_grant_map_page_identity(struct domain *d, unsigned long frame, - bool_t writeable) -{ - p2m_type_t t; - - ASSERT(is_domain_direct_mapped(d)); - - /* This is not an IOMMU mapping but it is not a regular RAM p2m type - * either. We are using IOMMU p2m types here to prevent the pages - * from being used as grants. */ - if ( writeable ) - t = p2m_iommu_map_rw; - else - t = p2m_iommu_map_ro; - - return guest_physmap_add_entry(d, frame, frame, 0, t); -} - -int arch_grant_unmap_page_identity(struct domain *d, unsigned long frame) -{ - ASSERT(is_domain_direct_mapped(d)); - - guest_physmap_remove_page(d, frame, frame, 0); - return 0; -} - int p2m_alloc_table(struct domain *d) { struct p2m_domain *p2m = &d->arch.p2m; diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c index 9a95ac9..42bde75 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -1539,6 +1539,8 @@ static void arm_smmu_iommu_domain_teardown(struct domain *d) static int arm_smmu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn, unsigned int flags) { + p2m_type_t t; + /* Grant mappings can be used for DMA requests. The dev_bus_addr returned by * the hypercall is the MFN (not the IPA). For device protected by * an IOMMU, Xen needs to add a 1:1 mapping in the domain p2m to @@ -1553,7 +1555,12 @@ static int arm_smmu_map_page(struct domain *d, unsigned long gfn, if ( !(flags & (IOMMUF_readable | IOMMUF_writable)) ) return -EINVAL; - return arch_grant_map_page_identity(d, mfn, flags & IOMMUF_writable); + t = (flags & IOMMUF_writable) ? p2m_iommu_map_rw : p2m_iommu_map_ro; + + /* The function guest_physmap_add_entry replaces the current mapping + * if there is already one... + */ + return guest_physmap_add_entry(d, gfn, mfn, 0, t); } static int arm_smmu_unmap_page(struct domain *d, unsigned long gfn) @@ -1564,7 +1571,9 @@ static int arm_smmu_unmap_page(struct domain *d, unsigned long gfn) if ( !is_domain_direct_mapped(d) ) return -EINVAL; - return arch_grant_unmap_page_identity(d, gfn); + guest_physmap_remove_page(d, gfn, gfn, 0); + + return 0; } static const struct iommu_ops arm_smmu_iommu_ops = { diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 10bf111..da36504 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -214,10 +214,6 @@ static inline int get_page_and_type(struct page_info *page, return rc; } -int arch_grant_map_page_identity(struct domain *d, unsigned long frame, - bool_t writeable); -int arch_grant_unmap_page_identity(struct domain *d, unsigned long frame); - /* get host p2m table */ #define p2m_get_hostp2m(d) (&(d)->arch.p2m) diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index 90ddd15..5f7fe71 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -709,10 +709,6 @@ static inline unsigned int p2m_get_iommu_flags(p2m_type_t p2mt) return flags; } -extern int arch_grant_map_page_identity(struct domain *d, unsigned long frame, - bool_t writeable); -extern int arch_grant_unmap_page_identity(struct domain *d, unsigned long frame); - #endif /* _XEN_P2M_H */ /*