From patchwork Fri Jun 30 15:54:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9819939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D728E602B1 for ; Fri, 30 Jun 2017 15:57:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D73982853B for ; Fri, 30 Jun 2017 15:57:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC0DE286B9; Fri, 30 Jun 2017 15:57:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 807552853B for ; Fri, 30 Jun 2017 15:57:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQyFo-0000Qb-4F; Fri, 30 Jun 2017 15:54:44 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQyFm-0000NS-Ps for xen-devel@lists.xen.org; Fri, 30 Jun 2017 15:54:42 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id 89/92-01736-24476595; Fri, 30 Jun 2017 15:54:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTdepJCz S4PkmLoslHxezODB6HN39mymAMYo1My8pvyKBNaO97TBzwQnuihVzfjI2MHZxdjFycQgJbGaU eH5iKROEc5pR4kbLfyCHk4NNQFPizudPYLaIgLTEtc+XGUFsZgEHiTcf77GA2MICkRKz90PYL AKqEjv23AKzeQUsJT733mAGsSUE5CV2tV1kBbE5Bawkjv97ADZTCKjm9ayrLBMYuRcwMqxi1C hOLSpLLdI1MtBLKspMzyjJTczM0TU0MNXLTS0uTkxPzUlMKtZLzs/dxAj0cD0DA+MOxsbZfoc YJTmYlER5V14LjRTiS8pPqcxILM6ILyrNSS0+xCjDwaEkwatYHBYpJFiUmp5akZaZAww1mLQE B4+SCK9sEFCat7ggMbc4Mx0idYpRl+PVhP/fmIRY8vLzUqXEeUNAZgiAFGWU5sGNgIX9JUZZK WFeRgYGBiGegtSi3MwSVPlXjOIcjErCvM4gU3gy80rgNr0COoIJ6AjhGSEgR5QkIqSkGhiTpp lOc7+lk5qY+NZhsuhC18/lV7TXFUh+EuZ+5MZoFF6onbSFdV+M9MtfU4X8UyOPFLX7CYqrekx 9cF/0rvCOvH3Lir0mJhkubExVKbm1ufZO4atdr2xuV3PfWmGosizPaeJbZ1unI3pnJs1dIB6c YO76yN2qMqD8P5u/1O+Xdh6h97/Mvq/EUpyRaKjFXFScCAB/ilmYdgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-11.tower-206.messagelabs.com!1498838081!81075311!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 52103 invoked from network); 30 Jun 2017 15:54:42 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-11.tower-206.messagelabs.com with SMTP; 30 Jun 2017 15:54:42 -0000 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 621A515B2; Fri, 30 Jun 2017 08:54:41 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C293D3F41F; Fri, 30 Jun 2017 08:54:40 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 30 Jun 2017 16:54:20 +0100 Message-Id: <20170630155431.23824-6-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170630155431.23824-1-julien.grall@arm.com> References: <20170630155431.23824-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v3 05/16] xen/arm: domain_build: Redefine virt_to_mfn to support typesafe X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The file xen/arch/arm/domain_build.c is using typesafe MFN in most of the place. The only caller to virt_to_mfn is using prefixed with _mfn(...). To avoid extra _mfn(...), re-define virt_to_mfn within arch/arm/domain_build.c to handle typesafe MFN. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- xen/arch/arm/domain_build.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index c6776d76fc..1bec4fa23d 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -45,6 +45,10 @@ struct map_range_data p2m_type_t p2mt; }; +/* Override macros from asm/page.h to make them work with mfn_t */ +#undef virt_to_mfn +#define virt_to_mfn(va) _mfn(__virt_to_mfn(va)) + //#define DEBUG_11_ALLOCATION #ifdef DEBUG_11_ALLOCATION # define D11PRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args) @@ -1903,7 +1907,7 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) rc = map_regions_p2mt(d, gaddr_to_gfn(d->arch.efi_acpi_gpa), PFN_UP(d->arch.efi_acpi_len), - _mfn(virt_to_mfn(d->arch.efi_acpi_table)), + virt_to_mfn(d->arch.efi_acpi_table), p2m_mmio_direct_c); if ( rc != 0 ) {