From patchwork Tue Jun 13 16:13: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: 105383 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp486309qgd; Tue, 13 Jun 2017 09:15:11 -0700 (PDT) X-Received: by 10.36.185.13 with SMTP id w13mr826645ite.95.1497370511303; Tue, 13 Jun 2017 09:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497370511; cv=none; d=google.com; s=arc-20160816; b=yUpnbYA4ckA2inUOr1GJMnBR4dhDfXATDvDjwqFMwkgUxYUR9zaZK7yQ0/sLre9T9Y WTH00DNn+76Z4GrxakKQrki7PP2SK2eVIVddeLfoBEEeBBkAPhXI3w5AnkZIXoa3SQa0 gPFzb+f8+thks1CIW+ailDGG5zpm7gbf1lM/YGBpkXo/ewEdwEfjPGFsCUAscltUwgDa zBwIriKxB+/LLT3FzyfOGnuEWRxr8TXOUQqVdnV3eCOIASnawYoGt7YG2gcOv9vh60e9 dWLKTW33Is+jLgvFoDBNliOTJAI9du+eQZy5tMfRhnVyxf6a6+W1ny9HduJ1f5uXtUyn A8cA== 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=N678OtxVSegXytiBKnuBCO7VtJ/MgJX6YDUmAKbWdFY=; b=oQnqJncI63qrhGydsyP8On8/74rSz2Nc7nX3JYrrXt+wBdkLJz20Sy/RtBi5eISGK0 5wni5Mkuxkm9kKmtYh7tSVBlc17ly6gpY1zFDkKgn3SuHFFeydfgH9eMmY79zfIyHeMF 8YEqqyRMBeCAA1pg/VVGZuBCQYP5aD8C+fOnOkQRMfrPnRNDU8pJ+lRGx9WP/O++Rir6 t1ViLMap5Y3FcSv4RTgjNRfsEdCL6fSjCi+RBAicVPu1dGL5k4SsZIpgz+JxmDppn6bF EXm4iEre7J0M40VKPO5UuC8vBg9E+Iq7Nypl92gtVh8+I9Sla8Jm8rQzrvg+tFY6ZBll KgWg== 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 m66si482244ioo.162.2017.06.13.09.15.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jun 2017 09:15:11 -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 1dKoS7-0000B5-P4; Tue, 13 Jun 2017 16:13:59 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKoS6-00007D-CK for xen-devel@lists.xen.org; Tue, 13 Jun 2017 16:13:58 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 8A/8D-02181-54F00495; Tue, 13 Jun 2017 16:13:57 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrCLMWRWlGSWpSXmKPExsVysyfVTdeJ3yH S4OY8boslHxezODB6HN39mymAMYo1My8pvyKBNWPDq0/MBVe4KpZtrGhgXMfRxcjFISSwmVFi w9W3rF2MnEDOaUaJN5cSQGw2AU2JO58/MYHYIgLSEtc+X2YEsZkFIiSaFuwFiwsLhEkcnT2bB cRmEVCVeHN0NlsXIwcHr4CVxNajmiBhCQF5iV1tF8HGcwKFLz1vYoRYZSnRvHs90wRG7gWMDK sYNYpTi8pSi3SNzPSSijLTM0pyEzNzdA0NTPVyU4uLE9NTcxKTivWS83M3MQJ9W8/AwLiD8fZ kv0OMkhxMSqK8W67YRArxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4N3B6xApJFiUmp5akZaZAwwy mLQEB4+SCO99FqA0b3FBYm5xZjpE6hSjopQ4bzNInwBIIqM0D64NFtiXGGWlhHkZGRgYhHgKU otyM0tQ5V8xinMwKgnztvAATeHJzCuBm/4KaDET0OLrIDfzFpckIqSkGhg7JurqS/i8DpBk2B J7b8OU6e9fffkjsUDgX9Tr0wZ5tWxzv0b6m0bVfJzwVKPyFoPfh/Lwsr2ex0qaDG+91vrMaKd r4bfmx4WU8Cs7QhbnxC5MiSxZqjLnGLvTlgOqnwwTrhnx+EgpBWblHwrR5Jhq+y1eqVtyjWRF 4qb19bu/tzctfTEly0uJpTgj0VCLuag4EQA+NK/aZwIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-9.tower-206.messagelabs.com!1497370433!103337134!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 64116 invoked from network); 13 Jun 2017 16:13:54 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-9.tower-206.messagelabs.com with SMTP; 13 Jun 2017 16:13:54 -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 6625715A2; Tue, 13 Jun 2017 09:13:53 -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 A219D3F557; Tue, 13 Jun 2017 09:13:52 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 13 Jun 2017 17:13:20 +0100 Message-Id: <20170613161323.25196-22-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170613161323.25196-1-julien.grall@arm.com> References: <20170613161323.25196-1-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, punit.agrawal@arm.com Subject: [Xen-devel] [PATCH 21/24] 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 --- 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 ) {