From patchwork Mon Jun 3 16:03:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 165668 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4660695ili; Mon, 3 Jun 2019 09:05:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxs86mCyZ0gVR9kjMrb6IBiNQyH3BhU39E/njwoccezjqNc3nCVNnSDe/a0ncEqryPTRoH0 X-Received: by 2002:a5d:9c91:: with SMTP id p17mr2509391iop.231.1559577936744; Mon, 03 Jun 2019 09:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577936; cv=none; d=google.com; s=arc-20160816; b=PAPqwW8vdbySYH4/wK4hscMSDqrNrJ3PdNjxWX36cU+KkNX5LvOc2dJ15DhJSS07mo ApYpaYrp/otHSM6gOCjvWEVp5b2QrU9rxrdYy5dkGB4XJeuo/Mb6bhgdnQCwaNlnjsj3 RkcaCmZe/dg4aXCjMzt1Vi40eQ5c+mcjvOs4lr14qHNR9b0+sytJa29xC4Kv8SX7vzdh dFgEf4b36RJlpobTAXZNoAJc4XBilScbFnXhhaowrP+8HEbl9vCujivR/jDLOrWTJyj/ v1LOQ5KSojy0eUpEvd31bUw+37Kp5NdBqoamP6B3NQZUdPf9yOlGwkV8y/xjzm/BJvuy GUbg== 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=W8dVUen859rvTnW85eLoUyZ3y5qV9X78UsQLAtY/K0g=; b=i5452ZolQompaF5SYdb4v/FpXrmPUuQzZpgmi2SBf1efmfWU4etoiQZOsz+np5xzC3 bx6EtTP5eOh4OUM4DkGVq7UAXF8/UQ72i9i1MXUbgJCxbp8ellwNT5Joy4/9z17yaL29 USVDdNiLSgYwku0Oa32MKjIPbLb7+Ro2qVl0tzDMaKuz0xN3TtszMkh08mbyvQjp2gu8 QGd56iSpUteyubkbQv9ULNIX+3N8uDW7QVQDKdrrgyte1AfeoDwwFDzekKDVvlcdyuU6 VyJu/HhwlQmbPSM3SojE/CdnAXljmTY1qHzJffH/2CVWDE4cGVB9p0XYWvVRvrwtHofg CDwg== 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 n21si9323062iob.119.2019.06.03.09.05.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jun 2019 09:05:36 -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 1hXpRa-00024D-HX; Mon, 03 Jun 2019 16:04:18 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hXpRY-00022Q-TZ for xen-devel@lists.xenproject.org; Mon, 03 Jun 2019 16:04:16 +0000 X-Inumbo-ID: 3c5c76b6-8619-11e9-beeb-03b514b6ce83 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 3c5c76b6-8619-11e9-beeb-03b514b6ce83; Mon, 03 Jun 2019 16:04:15 +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 74798A78; Mon, 3 Jun 2019 09:04:15 -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 1DDA33F246; Mon, 3 Jun 2019 09:04:13 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 3 Jun 2019 17:03:44 +0100 Message-Id: <20190603160350.29806-9-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190603160350.29806-1-julien.grall@arm.com> References: <20190603160350.29806-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v3 08/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 43174176c2..ad4309fde5 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 e420d88137..bf90916077 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))