From patchwork Mon Feb 18 11:35: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: 158592 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2384340jaa; Mon, 18 Feb 2019 03:37:57 -0800 (PST) X-Google-Smtp-Source: AHgI3IbNT6IiztMKcs7Dn1M5U9TXK8lh/f2JjQSZta9ou+ml4HFzQBCeUPKCdUxlj4MqflOWZrNF X-Received: by 2002:a25:4d02:: with SMTP id a2mr8343480ybb.90.1550489877518; Mon, 18 Feb 2019 03:37:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550489877; cv=none; d=google.com; s=arc-20160816; b=PG0Ob26Z9M/kxihgRmMVOhOfTHD8jzmM0dq4Vsm98TXI7821th+EHAlhh7AJ/DKQTK e/LWfyhn/ovgnD3uuleKUEp4qjFwV0A8DKSIGH1qL18xi8bO0HI+uga0h/UryB9OUODn iUqfk2IXX64S06jV2muLqkEyQU/ETxj9NhftcVGHmZbuyMcKG4Gk2rCdtTKeqVGF5e8H RSIG1u4ohYJDO12JjNId7EADk8Y2eDwEXQSJYptQc56wfVoB1dG7EXSfGHtaukeQGBLB JXZxkKCypiHxs2WivDayWhV1zQvQ8UpK5xHa3kaLR1y2hhuBCIxb2I1D6YyE5voWzEJb Tjeg== 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=xMIIpfnNk68CK+qbhJeZY/buOSpWJUy7X+0haeLc6W0=; b=eFEQ0jZAlCaCMPl12OlHNrDTtqMSWiLukDc0X5ovBrvkgn1gd/5BuJK60HEh4YploR J2LsYKNqG8u0D61d0Iyy1QHQZCCstv9rCT2dzldHHSCiDVsKOCgaEhq259bQo2pl8ZuZ hyKGfk96ZWrIs6bLvbXNgLSTYrAnIymF4cR2kf5NGnc3feHY6ftjfkESveC78JwXITHW ri0eZYLaCpj4wKxugsXC1fHF8q1iybTz47uzsj2mocUfuv/3MH5Ivm2DhJ5V7mUKiZm4 d9knjXkFe9yWIRFBS+S68lx5X8uscvL7Vh6YKpiXPXU/yF/PXNc2GPwKx1sqCRMk5Qeg kpIQ== 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 h8si7165289ywm.62.2019.02.18.03.37.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Feb 2019 03:37:57 -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 1gvhDm-00027f-1V; Mon, 18 Feb 2019 11:36:26 +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 1gvhDk-000269-T9 for xen-devel@lists.xenproject.org; Mon, 18 Feb 2019 11:36:24 +0000 X-Inumbo-ID: 6a8be440-3371-11e9-8664-d3c7feba5192 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 6a8be440-3371-11e9-8664-d3c7feba5192; Mon, 18 Feb 2019 11:36:24 +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 161771688; Mon, 18 Feb 2019 03:36:22 -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 B15C93F73F; Mon, 18 Feb 2019 03:36:10 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 18 Feb 2019 11:35:54 +0000 Message-Id: <20190218113600.9540-4-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 3/9] xen/x86: Use mfn_to_gfn rather than mfn_to_gmfn 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" mfn_to_gfn and mfn_to_gmfn are doing exactly the same except the former is using mfn_t. Furthermore, the naming of the former is more consistent with the current naming scheme (GFN/MFN). So use replace mfn_to_gmfn with mfn_to_gfn in x86 code. No functional changes. Signed-off-by: Julien Grall --- xen/arch/x86/domain.c | 2 +- xen/arch/x86/mm.c | 2 +- xen/arch/x86/pv/emul-priv-op.c | 4 ++-- xen/drivers/passthrough/x86/iommu.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 32dc4253ff..ab1f25f49d 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -714,7 +714,7 @@ int arch_domain_soft_reset(struct domain *d) ASSERT( owner == d ); mfn = page_to_mfn(page); - gfn = mfn_to_gmfn(d, mfn_x(mfn)); + gfn = mfn_to_gfn(d, mfn); /* * gfn == INVALID_GFN indicates that the shared_info page was never mapped diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 7ec5954b03..df6e5bdd31 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -2518,7 +2518,7 @@ int free_page_type(struct page_info *page, unsigned long type, ASSERT(!shadow_mode_refcounts(owner)); - gmfn = mfn_to_gmfn(owner, mfn_x(page_to_mfn(page))); + gmfn = mfn_to_gfn(owner, page_to_mfn(page)); if ( VALID_M2P(gmfn) ) shadow_remove_all_shadows(owner, _mfn(gmfn)); } diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index 942ece2ca0..0da1e29782 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c @@ -711,7 +711,7 @@ static int read_cr(unsigned int reg, unsigned long *val, if ( !is_pv_32bit_domain(currd) ) { mfn = pagetable_get_mfn(curr->arch.guest_table); - *val = xen_pfn_to_cr3(mfn_to_gmfn(currd, mfn_x(mfn))); + *val = xen_pfn_to_cr3(mfn_to_gfn(currd, mfn)); } else { @@ -720,7 +720,7 @@ static int read_cr(unsigned int reg, unsigned long *val, mfn = l4e_get_mfn(*pl4e); unmap_domain_page(pl4e); - *val = compat_pfn_to_cr3(mfn_to_gmfn(currd, mfn_x(mfn))); + *val = compat_pfn_to_cr3(mfn_to_gfn(currd, mfn)); } /* PTs should not be shared */ BUG_ON(page_get_owner(mfn_to_page(mfn)) == dom_cow); diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c index a88ef9b189..2b1915548a 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -59,15 +59,15 @@ int arch_iommu_populate_page_table(struct domain *d) if ( is_hvm_domain(d) || (page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page ) { - unsigned long mfn = mfn_x(page_to_mfn(page)); - unsigned long gfn = mfn_to_gmfn(d, mfn); + mfn_t mfn = page_to_mfn(page); + unsigned long gfn = mfn_to_gfn(d, mfn); unsigned int flush_flags = 0; if ( gfn != gfn_x(INVALID_GFN) ) { ASSERT(!(gfn >> DEFAULT_DOMAIN_ADDRESS_WIDTH)); BUG_ON(SHARED_M2P(gfn)); - rc = iommu_map(d, _dfn(gfn), _mfn(mfn), PAGE_ORDER_4K, + rc = iommu_map(d, _dfn(gfn), mfn, PAGE_ORDER_4K, IOMMUF_readable | IOMMUF_writable, &flush_flags); }