From patchwork Tue Jun 13 16:13:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9784265 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 54598602DC for ; Tue, 13 Jun 2017 16:15:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3119627DCD for ; Tue, 13 Jun 2017 16:15:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 261842853A; Tue, 13 Jun 2017 16:15:43 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 92CB027DCD for ; Tue, 13 Jun 2017 16:15:42 +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 1dKoS9-0000Fi-Dd; Tue, 13 Jun 2017 16:14:01 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKoS8-0000Cg-L3 for xen-devel@lists.xen.org; Tue, 13 Jun 2017 16:14:00 +0000 Received: from [85.158.139.211] by server-13.bemta-5.messagelabs.com id 40/55-01709-74F00495; Tue, 13 Jun 2017 16:13:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRWlGSWpSXmKPExsVysyfVTdeF3yH SoP2IrMWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmtH4ZQ1bwQzOiodn7zE2ML5g72Lk4hAS2Mwo sfD1DjYI5zSjRMuaw0AOJwebgKbEnc+fmEBsEQFpiWufLzOCFDELbGOUuL1kFztIQlggWGL2h UeMIDaLgKrEqdfvmUFsXgEriTsX7oHVSAjIS+xqu8gKYnMCxS89bwKrFxKwlGjevZ5pAiP3Ak aGVYwaxalFZalFusYGeklFmekZJbmJmTm6hgamermpxcWJ6ak5iUnFesn5uZsYgT6uZ2Bg3ME 4YZXfIUZJDiYlUd4tV2wihfiS8lMqMxKLM+KLSnNSiw8xynBwKEnw2vM5RAoJFqWmp1akZeYA gw0mLcHBoyTCe58FKM1bXJCYW5yZDpE6xagoJc77hxcoIQCSyCjNg2uDBfglRlkpYV5GBgYGI Z6C1KLczBJU+VeM4hyMSsK8LTxAU3gy80rgpr8CWswEtPg6yM28xSWJCCmpBkazs1d2bTt7+k Foqec1rd9R63Nq0/8dZd2pKG1+tZH910SBIAW/CU3reGq7T/xedC7/wdwVdawRru4KWbUlDnN z1XfNuCH5etkWqdM5Qcd2+mwxMPm8qvL487iKkLfNJ7Ikcy/+Wqz77730pKjuLxNMax6vVZzQ +tilu6ro5TmJWS/eN6x6JtKsxFKckWioxVxUnAgAIoJZpGsCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1497370435!66951713!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 23011 invoked from network); 13 Jun 2017 16:13:56 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-12.tower-206.messagelabs.com with SMTP; 13 Jun 2017 16:13:56 -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 AF47B1596; Tue, 13 Jun 2017 09:13:55 -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 A3FC93F557; Tue, 13 Jun 2017 09:13:54 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 13 Jun 2017 17:13:22 +0100 Message-Id: <20170613161323.25196-24-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: Ross Lagerwall , Julien Grall , sstabellini@kernel.org, punit.agrawal@arm.com Subject: [Xen-devel] [PATCH 23/24] xen/arm: livepatch: 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/livepatch.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/livepatch.c to handle typesafe MFN. Signed-off-by: Julien Grall Cc: Ross Lagerwall Cc: Konrad Rzeszutek Wilk Reviewed-by: Stefano Stabellini --- xen/arch/arm/livepatch.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c index de95e54744..3e53524365 100644 --- a/xen/arch/arm/livepatch.c +++ b/xen/arch/arm/livepatch.c @@ -12,6 +12,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)) + void *vmap_of_xen_text; int arch_livepatch_quiesce(void) @@ -22,7 +26,7 @@ int arch_livepatch_quiesce(void) if ( vmap_of_xen_text ) return -EINVAL; - text_mfn = _mfn(virt_to_mfn(_start)); + text_mfn = virt_to_mfn(_start); text_order = get_order_from_bytes(_end - _start); /*