From patchwork Tue May 7 15:14:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 163547 Delivered-To: patch@linaro.org Received: by 2002:ac9:2a84:0:0:0:0:0 with SMTP id p4csp3883338oca; Tue, 7 May 2019 08:16:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqysEAJ8E1Ht38cqIrT+JgawPmHDySpJb7wMOChr9T6UTWaO0CRJ3y9/HPoapPFfeq+Omm8z X-Received: by 2002:a24:760a:: with SMTP id z10mr21725284itb.115.1557242219454; Tue, 07 May 2019 08:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557242219; cv=none; d=google.com; s=arc-20160816; b=x1mrOjX9YaH8cT/A9D23Ve4Ys6/VkcXX4O1YFkFnn61Xluk4mSIm1uOW6lYGohAM+3 s2etZ0IvpUlCW5/Eb4LCAbJO5ApdeJejf5/e3Yado1xpOAUMUfN6adu6Z5vFX4T/YUne pP+1rUYkz2tQ7aUwhnS7iPDcbOvyyAHJWQJvrX/rUoq4hwrfcHzUmDOJEcJxOYz3ey9h t02UkzPUDxH9u+fbISOR0xzZ4RoNsJEsjOoUM7aUrK8TuxSiLnsfxnaGoO9abUv60gt0 YDNWu1nNUFBsGJhUx62qRNkJxfjNVRg9eWSD2W5TybArbAnqchUJloM0p4Y1kKFDf1KB 76kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=V41zxAloM9tfD+wZ0aHgs323ArobYLItLUYUwOfc7Vw=; b=sRTqQAMDm6hNqDlb7iNLMiKluV0VeUC+oiGJ7+e+vBFjPJJMbVMrMixkO9Liz4PQ7C F+dTAwYTQ1O7eRKyX3aIL8xI/KWuDiNwIw0fN9/m8FjHcDukGpI/WB2Oi1K0LJhDxXKd DrEj2OBAUj/9vi2/IzAX2F4B1x0GCKUnN7LnD8dRKXkmycXtSZcQjt1OwNyY+KVfFv1S qeTlIf6tClOW/yv1pEazJQI0nbJ5BOLErbXl1Osw8Qxvq4tFrXULeCRHgdq31yz/siCE QGCCfdxeXj1fI2ZCNapqc1/7xtw5jYAIltfUOmFevtKfpQ4mwLAbk3iifJNCEPAAWGXw pgNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 10si5776345ioz.111.2019.05.07.08.16.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 May 2019 08:16:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hO1oZ-0007Sv-Ta; Tue, 07 May 2019 15:15:31 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hO1oY-0007Rh-KY for xen-devel@lists.xenproject.org; Tue, 07 May 2019 15:15:30 +0000 X-Inumbo-ID: f35238f3-70da-11e9-843c-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id f35238f3-70da-11e9-843c-bc764e045a96; Tue, 07 May 2019 15:15:29 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B86A5168F; Tue, 7 May 2019 08:15:29 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5CFFF3F90E; Tue, 7 May 2019 08:15:28 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 7 May 2019 16:14:54 +0100 Message-Id: <20190507151458.29350-11-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190507151458.29350-1-julien.grall@arm.com> References: <20190507151458.29350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 10/14] xen: Remove mfn_to_gmfn macro X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Andrew Cooper , Julien Grall , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On x86, mfn_to_gmfn can be replaced with mfn_to_gfn. On Arm, there are no more call to mfn_to_gmfn, so the helper can be dropped. At the same time rework a comment in Arm code that does not make sense. Signed-off-by: Julien Grall Acked-by: Jan Beulich Acked-by: Stefano Stabellini --- Changes in v2: - Add Jan's and Stefano's acked-by --- xen/drivers/passthrough/iommu.c | 7 +++---- xen/include/asm-arm/mm.h | 4 +--- xen/include/asm-x86/mm.h | 5 ----- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index dbb64b13bc..054f71b919 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -195,8 +195,8 @@ void __hwdom_init iommu_hwdom_init(struct domain *d) page_list_for_each ( page, &d->page_list ) { - unsigned long mfn = mfn_x(page_to_mfn(page)); - unsigned long dfn = mfn_to_gmfn(d, mfn); + mfn_t mfn = page_to_mfn(page); + dfn_t dfn = _dfn(gfn_x(mfn_to_gfn(d, mfn))); unsigned int mapping = IOMMUF_readable; int ret; @@ -205,8 +205,7 @@ void __hwdom_init iommu_hwdom_init(struct domain *d) == PGT_writable_page) ) mapping |= IOMMUF_writable; - ret = iommu_map(d, _dfn(dfn), _mfn(mfn), 0, mapping, - &flush_flags); + ret = iommu_map(d, dfn, mfn, 0, mapping, &flush_flags); if ( !rc ) rc = ret; diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index a9c8352b94..a9cb98a6c7 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -321,10 +321,8 @@ struct page_info *get_page_from_gva(struct vcpu *v, vaddr_t va, #define SHARED_M2P_ENTRY (~0UL - 1UL) #define SHARED_M2P(_e) ((_e) == SHARED_M2P_ENTRY) -/* Xen always owns P2M on ARM */ +/* We don't have a M2P on Arm */ #define set_gpfn_from_mfn(mfn, pfn) do { (void) (mfn), (void)(pfn); } while (0) -#define mfn_to_gmfn(_d, mfn) (mfn) - /* Arch-specific portion of memory_op hypercall. */ long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg); diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index 6f76f004ab..717378730b 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -506,11 +506,6 @@ extern struct rangeset *mmio_ro_ranges; #define get_gpfn_from_mfn(mfn) (machine_to_phys_mapping[(mfn)]) -#define mfn_to_gmfn(_d, mfn) \ - ( (paging_mode_translate(_d)) \ - ? get_gpfn_from_mfn(mfn) \ - : (mfn) ) - #define compat_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20)) #define compat_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))