From patchwork Mon Jun 19 16:57:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9796847 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 7D4FD600C5 for ; Mon, 19 Jun 2017 17:00:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 658EB27F8F for ; Mon, 19 Jun 2017 17:00:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A5B027F92; Mon, 19 Jun 2017 17:00:30 +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 099262833C for ; Mon, 19 Jun 2017 17:00:30 +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 1dN00A-0003lN-H8; Mon, 19 Jun 2017 16:58:10 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dN009-0003jg-Od for xen-devel@lists.xen.org; Mon, 19 Jun 2017 16:58:09 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id D4/AE-01985-0A208495; Mon, 19 Jun 2017 16:58:08 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTXcBk0e kQcNdMYslHxezODB6HN39mymAMYo1My8pvyKBNWPf39mMBZe4Kl5vvMbSwPiUo4uRi0NIYDOj xPTTf9kgnNOMEsv2LmXvYuTkYBPQlLjz+RMTiC0iIC1x7fNlRhCbWcBB4s3HeywgtrBAhMTU/ 9vB4iwCqhKzvl4Ci/MKWErM7f8PFpcQkJfY1XaRFcTmFLCS+D7/GlhcCKjm+JNbbBMYuRcwMq xi1ChOLSpLLdI1NNFLKspMzyjJTczM0TU0MNbLTS0uTkxPzUlMKtZLzs/dxAj0MAMQ7GBcsd3 zEKMkB5OSKO+s/+6RQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4rzB4RAoJFqWmp1akZeYAQw0m LcHBoyTCW/MbqJW3uCAxtzgzHSJ1ilGXY8Pq9V+YhFjy8vNSpcR5FRiBZgiAFGWU5sGNgIX9J UZZKWFeRqCjhHgKUotyM0tQ5V8xinMwKgnzPgWZwpOZVwK36RXQEUxARzCfcQE5oiQRISXVwO h1MeJfR7mqFYvfd0/j33JLTznU3/a+4ry+Xf3hBLH+UP6mlhktH7fEt7183HlMxfT5R9vvf39 PnDHdjp3h52YxDTkO5wnGeZOWFTfK2PQ+2Gh89nXcq+zV644t7zALO5tWJcWjp6ziMJWndd35 as7TPq+en/jXUHCSadOSDZaHE5o7Q/8uU1ZiKc5INNRiLipOBABe5pPVdgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-6.tower-31.messagelabs.com!1497891487!67805838!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 38890 invoked from network); 19 Jun 2017 16:58:08 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-6.tower-31.messagelabs.com with SMTP; 19 Jun 2017 16:58:08 -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 9833415AD; Mon, 19 Jun 2017 09:58:07 -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 E8F7E3F41F; Mon, 19 Jun 2017 09:58:06 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 19 Jun 2017 17:57:44 +0100 Message-Id: <20170619165753.25049-8-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 07/16] 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" X-Virus-Scanned: ClamAV using ClamSMTP 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 Stabelllini --- Changes in v2: - Add Stefano's reviewed-by --- 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;