From patchwork Mon Jun 19 16:57:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 105891 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp942430obh; Mon, 19 Jun 2017 09:59:55 -0700 (PDT) X-Received: by 10.36.68.19 with SMTP id o19mr15294802ita.47.1497891595183; Mon, 19 Jun 2017 09:59:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497891595; cv=none; d=google.com; s=arc-20160816; b=I+c4vqFkENC+gzcjzXYO9nt18SMy96AbNcwjdonhVXsj+K6xp0sK2wwyaPMkdDZFT5 qeovCt9an8LVmySLULEyiERprOFNAyuJeRpAktUXE63g27f56dOliqObU2Bg0wCC1NTZ PFPDDdjDsCjVq8ICXQFxXUij/5P9JwIHBgsfDXDegXic9Cgdz3h0NMkqTAd9X5t+qsxA hUEMrH2r+I89WFh1wBFbakDGNPM6wlK5JO/w6rP70nXzdxy9B8BttpQ1/NhIXgvWMPWx ZOZcXVOihzWqJczP4femPHhfA6VbpIFHcNRvW9LEeVSkI1HflIkiz+DS8YNnJ2dB8wL3 KhUA== 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 :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=jteeSNjz2K9slOl7MOJIoqJsRi4GMLJOLJ3tRLfnMI4=; b=Fjgo+plWbV8/MfQZAMCvjCwiDk1ueZdCghv7tYZAg8kBnTDoBBN21cuc8RbO9JWKAX DeDzmdF+KEwGRK08t425vGLfcC12iSM5Fs0SQh222zh6FOB6vPva8ZZql6i7Hn6Gdtgv 90FrtPAyIOpC2atqz6vYrQZTST/iHwHcWw2ITdgw0JexS2Ff1bx6fUjXf8yWTOJcijb0 ZovWe5RtsUHFVtGrNJuvXQez4Y5gQKKaQ6MnOTKqCwjhbT0DeUtVvOTd1nDyJ4dlCQqw L9Az1p7vAxyGzt/KdlXG8YlJWes1cZ7lYhRYDmIk++qGfxtkexe5Nha0NwTI0d0+sGe3 okjg== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id f192si10185964ioe.7.2017.06.19.09.59.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jun 2017 09:59:55 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dN009-0003jj-9P; Mon, 19 Jun 2017 16:58:09 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dN008-0003ir-3l for xen-devel@lists.xen.org; Mon, 19 Jun 2017 16:58:08 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id D5/BB-03058-F9208495; Mon, 19 Jun 2017 16:58:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXc+k0e kwYp1YhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa0Z722HmghPcFSvm/GRsYOzi7GLk4hAS2MQo cWHjE3YI5zSjRNflvcxdjJwcbAKaEnc+f2ICsUUEpCWufb7MCGIzCzhIvPl4jwXEFhaIlJj8c gdYDYuAqsSiJ5fZQWxeAUuJjy+2s4LYEgLyErvaLoLZnAJWEt/nXwObIwRUc/zJLbYJjNwLGB lWMaoXpxaVpRbpmuglFWWmZ5TkJmbm6BoamOnlphYXJ6an5iQmFesl5+duYgT6lwEIdjB2X/Y /xCjJwaQkyjvrv3ukEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQneTYwekUKCRanpqRVpmTnAQINJ S3DwKInw2gGDTYi3uCAxtzgzHSJ1ilFRSpz3JEifAEgiozQPrg0W3JcYZaWEeRmBDhHiKUgty s0sQZV/xSjOwagkzPsUZApPZl4J3PRXQIuZgBYzn3EBWVySiJCSAsYLe3XamZazSTVm7NstLu +vCDGKTzJOS1Q/0/D5jI63rrnK50zHlJzEk+qF+WYhjjPLbueH7gv8GRknZSZSf++tahbTi0W awhcLWo9/vN3x2Nx/X/6Sksufz+QsPx/KdaX0oNcRhw9n5cSkT3DkRF/IYWG5zO0yoVys96Cn Su7ZNKd8edmjSizFGYmGWsxFxYkAPleCxGkCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1497891486!102926268!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.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 47722 invoked from network); 19 Jun 2017 16:58:07 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-27.messagelabs.com with SMTP; 19 Jun 2017 16:58:07 -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 A630F344; Mon, 19 Jun 2017 09:58:06 -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 0490D3F41F; Mon, 19 Jun 2017 09:58:05 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 19 Jun 2017 17:57:43 +0100 Message-Id: <20170619165753.25049-7-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170619165753.25049-1-julien.grall@arm.com> References: <20170619165753.25049-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 06/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" 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 ) {