From patchwork Mon Feb 18 11:36:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 158596 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2384598jaa; Mon, 18 Feb 2019 03:38:16 -0800 (PST) X-Google-Smtp-Source: AHgI3IZsTPT/JI8FG7YBVxRqNQcamOQ2c1ge5K+ABLMGKav8sbml7+m4IpTeaBqm7v5ZtpNei0BN X-Received: by 2002:a81:210b:: with SMTP id h11mr18166006ywh.299.1550489896110; Mon, 18 Feb 2019 03:38:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550489896; cv=none; d=google.com; s=arc-20160816; b=0lUqycRdOanjAP4LS0rwII0U2ssINcSp9bXp0PiERQ2StC0EF/9BUkJNwtwS1FKb2R 9SYpvN9gRGA0WvQDTMXZz/TOh8aHQqEAsQxAAdTQfw0bKxWYT/MnOdPfVeCoKyL2DZjJ 0VPL3EtOhOimEwTEIILFxb4TnWP2z8vmFrO3QSBhC5zW6tlyZrnxboeeEaSnM/kFe9bc MgYnnldGZa/o7SZVnHv54olc9phMviSxbbyURnAo00BB1SJ/GyjcX2BHs9wL4NXjtlL6 CKi4Bl9U2xcKmQng3TGyEo/r8pHWzwjzyedydfRqCZd9qjvPfms7XOj0ghsEKl04LDA5 rbnw== 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=zSn7CG4UT3+WK5R2VQhdLUFGCYiQEntDqQ0tv0L/85c=; b=tN1oa/AgVFwdOFEZOHixqYaIplR0XxHt+o0c0hDLh8oYH29iZ/4Wo974gL0hjDsSWT ZK0mL+hdXxBZxv3juf/zWuvvtXSovxo09u+S22K+l/N5ZzKiCCa5f3EdaTTRgbwii9lE v4gEP5Ta1u1UK68p1U/Qaf0FjU4VWUXgp2gYQKtyPfxU3M7oPDPGp6VBsG4rRty/PGFq EGN93CDfKDSg74IR9NwWLvTN73UaIokjdBI/jcXh57Ozrh2ilxL7L+oK3EIqGADlTfGC 4lPoufFVmn+/65v4H+BLQqoMaUFbBU2NJzYL+PITtvE6doO9lL2yxzuf+ESLPFjGFJZw +Bwg== 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 k8si7443533ybb.470.2019.02.18.03.38.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Feb 2019 03:38:16 -0800 (PST) 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 1gvhDp-0002B8-D0; Mon, 18 Feb 2019 11:36:29 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1gvhDn-00029F-Al for xen-devel@lists.xenproject.org; Mon, 18 Feb 2019 11:36:27 +0000 X-Inumbo-ID: 6cd9716b-3371-11e9-bc90-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 6cd9716b-3371-11e9-bc90-bc764e045a96; Mon, 18 Feb 2019 11:36:26 +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 0B58C1713; Mon, 18 Feb 2019 03:36:26 -0800 (PST) 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 06CC53F720; Mon, 18 Feb 2019 03:36:23 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 18 Feb 2019 11:36:00 +0000 Message-Id: <20190218113600.9540-10-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190218113600.9540-1-julien.grall@arm.com> References: <20190218113600.9540-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH for-next 9/9] 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: sstabellini@kernel.org, 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 --- xen/drivers/passthrough/iommu.c | 6 +++--- xen/include/asm-arm/mm.h | 4 +--- xen/include/asm-x86/mm.h | 5 ----- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 5742cd05b8..04ac46239e 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -193,8 +193,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); + unsigned long dfn = mfn_to_gfn(d, mfn); unsigned int mapping = IOMMUF_readable; int ret; @@ -203,7 +203,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, + ret = iommu_map(d, _dfn(dfn), mfn, 0, mapping, &flush_flags); if ( !rc ) 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 1ca4154382..3324dd7abf 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))