From patchwork Tue Jun 13 16:13:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 105390 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp486395qgd; Tue, 13 Jun 2017 09:15:22 -0700 (PDT) X-Received: by 10.202.3.135 with SMTP id 129mr545749oid.160.1497370522189; Tue, 13 Jun 2017 09:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497370522; cv=none; d=google.com; s=arc-20160816; b=mKNUWU8Nn9OAGiBQxoMxX4Yz5svcT6gcQnVdcjN4fAeRbOmbWAtdwtAw4jtJrF7Pc9 VMbYau1YJpFIVxLNYWn8jK9lFowZ8J6j/7NscNgUuYRuWi8XSGFKiRtlAkmCP8zGyzoR 9DG4v1dJjt7H/evYe89DhOfd5Ru+OjBv1FgNyr7nW9o8+spO324WYZi0xv0RQnIdZKtK 6UTc+IkmQICmp80n5AlWhXCugxJDOTekRME4e+ppztBApN+ff90ixYWaGmSAh19jHibQ NvL3oXoL8cXjVL3+rnBnjXWzKOteqGlfgR29niSwF5CEbpqOgPujY9o7XaqWEfK37iaW rj/w== 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=T5+q49O6bVFz1NH4jcfHTaURIu3baYl9odX/pW63/3k=; b=k3+VS2QpfsggB482Vai3cpoGxqAi2tDi4SPQA1mZSQKF6eokPc4raGT3egYvJ+ty3w gJZl+0NlEk0Akp+4h0Z/3QZmcSwT0sdWVPkKLP5JlK8QKoAaMEwfV5I/H4cuxOg1JvuD x7iaEFEDHHs+6e5roieRHb8TAXSXy+IoJsxZwnDjAGzy1bNZwTkfDzLyzfMEI9UzrdJQ i4v33wnONG1C6GVnmyvQ2WwnfC4qGZD7sL48/xUPMjYmhvn4tq4XRg5Euw2HjV8C/EnB Ym4Oc8ZyKnaQk3Ll9cG2x02nw3E4rMw2ULgIYPuOvq4rR5TyT+6GKoL6ci06S5Tc2ujS Ja/w== 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 102si237901otg.303.2017.06.13.09.15.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jun 2017 09:15:22 -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 1dKoS5-000069-Gf; Tue, 13 Jun 2017 16:13:57 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKoS4-0008UT-3d for xen-devel@lists.xen.org; Tue, 13 Jun 2017 16:13:56 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id A7/2C-03920-34F00495; Tue, 13 Jun 2017 16:13:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTdeZ3yH S4MFlNoslHxezODB6HN39mymAMYo1My8pvyKBNeP8qqesBXc5K85M3MTewNjB0cXIxSEksJlR 4sjkjYxdjJxAzmlGiVN75EFsNgFNiTufPzGB2CIC0hLXPl8Gq2EWiJBoWrAXLC4sECrxYOlal i5GDg4WAVWJn63lIGFeASuJI6cawMolBOQldrVdZAWxOYHil543Qa2ylGjevZ5pAiP3AkaGVY waxalFZalFuoaWeklFmekZJbmJmTm6hgZmermpxcWJ6ak5iUnFesn5uZsYgd5lAIIdjD+WBRx ilORgUhLl3XLFJlKILyk/pTIjsTgjvqg0J7X4EKMMB4eSBO8OXodIIcGi1PTUirTMHGCYwaQl OHiURHjvswCleYsLEnOLM9MhUqcYdTk2rF7/hUmIJS8/L1VKnPcPyAwBkKKM0jy4EbCQv8QoK yXMywh0lBBPQWpRbmYJqvwrRnEORiVh3hYeoCk8mXklcJteAR3BBHTEdZD7eYtLEhFSUg2MK2 Q9XRdJ7Qy53vcxYkKz4H7R134+O6etnrLQpG/dwiNtKQWTIj2mTVbIdvj+et9X0cUTw4KZmSK rVj51cbZLfjXzRfb9mqTbK6YpLznwsbLUMJItNSVy2luTi1/n5Wj88D9WHsv32nHFzgvrmSsl Qy7+8H14N/TDTwb27XJ1S7/2/L7Ze375OiWW4oxEQy3mouJEAIF2f4x0AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-8.tower-27.messagelabs.com!1497370434!97214937!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 64004 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-8.tower-27.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 671C51596; Tue, 13 Jun 2017 09:13:54 -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 A31EC3F557; Tue, 13 Jun 2017 09:13:53 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 13 Jun 2017 17:13:21 +0100 Message-Id: <20170613161323.25196-23-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 22/24] xen/arm: alternative: 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/alternative.c is using typesafe MFN in most of the place. The only caller to virt_to_mfn is using with _mfn(...). To avoid extra _mfn(...), re-define virt_to_mfn within xen/arch/arm/alternative.c to handle typesafe MFN. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/alternative.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c index 4d7e5b6155..a3bcda3117 100644 --- a/xen/arch/arm/alternative.c +++ b/xen/arch/arm/alternative.c @@ -32,6 +32,10 @@ #include #include +/* 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)) + extern const struct alt_instr __alt_instructions[], __alt_instructions_end[]; struct alt_region { @@ -154,7 +158,7 @@ static int __apply_alternatives_multi_stop(void *unused) { int ret; struct alt_region region; - mfn_t xen_mfn = _mfn(virt_to_mfn(_start)); + mfn_t xen_mfn = virt_to_mfn(_start); paddr_t xen_size = _end - _start; unsigned int xen_order = get_order_from_bytes(xen_size); void *xenmap;