From patchwork Fri Jun 30 15:54: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: 106738 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2507601qge; Fri, 30 Jun 2017 08:57:15 -0700 (PDT) X-Received: by 10.107.19.168 with SMTP id 40mr21891087iot.51.1498838235451; Fri, 30 Jun 2017 08:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498838235; cv=none; d=google.com; s=arc-20160816; b=shtP+NhsGXOpN5Poc0aaPmGfQWNiY5trxIwV8t816RAXkfQ/EtyEIBD25rrSqLX32o 3NRIRY4GOTpdFp7YJfA9akwKGLijVGtjnZy6N35Jwrapi8BdPhSoOIcnVEwjs6OSXsdM DoT7G127w9vyVJFlzCkVvYqseGfeSnwielobNfSg4aGSgcntPn49cN2aeGNJxVbOG1yC QrOCXFxAuKsXqUBXf1j4wcwz0RQdkYdTn59lLGIof2ZowOnpnWM+O0MEqMrNIzFWFwMj BQLkUusMiXhbE5+Uh25AWGNuZx5ArTC6NJQNKTbIBmpkz/Pk9giWZdlXgYoj24Ptvawg T6zw== 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=iCMzM7TaZYeEkVEO5tWgyw0pHo2gSHptP14sZv9oTko=; b=rYNFwbzL/swLKnnFXz5iYk+8y2+0v/nbwGYQ0wf8hS1+fUyfLZSxQjEKgMC8ayfaJc eI/upARQS8EQZG9SSnhvOPGekoFDWPf8LgoR7u0tcIBllXdOoMS4YJLCVvjlHDrZqVNM q9RR7uUexeJJa0AGerDY6v7dsZXLB5Bbc8mTY2PHaz5Y62HZYmO4znYqqHCW07jnIZfx VWAJaHUMlAVsNNzX2OMYJKf3Igp511mcQLkkjZxLMFZiZ9JxYiHXkX7kFT9fq19lqnUM RnXQnKS9mcW5m1vrbX0X4Rua/1Nob6JXwU8vvtSQNpIijl158aB6+5GO1KT/TmD8X0fn KFlg== 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 p73si4292901itg.4.2017.06.30.08.57.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 08:57:15 -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 1dQyFq-0000TR-JB; Fri, 30 Jun 2017 15:54:46 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQyFp-0000RH-9Y for xen-devel@lists.xen.org; Fri, 30 Jun 2017 15:54:45 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id B7/F8-01994-44476595; Fri, 30 Jun 2017 15:54:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTdelJCz S4F6QxZKPi1kcGD2O7v7NFMAYxZqZl5RfkcCa8evMIsaCRu6Ky3MnMTYwTuLsYuTiEBLYzChx /PhFRgjnNKPEg0krgRxODjYBTYk7nz8xgdgiAtIS1z5fBoszC+RKzN29gx3EFhYIk1jweSULi M0ioCpx8ccFNhCbV8BS4tyOhWC2hIC8xK62i6wgNqeAlcTxfw/AZgoB1byedZVlAiP3AkaGVY waxalFZalFuobGeklFmekZJbmJmTm6hgamermpxcWJ6ak5iUnFesn5uZsYgf5lAIIdjP+2eR5 ilORgUhLlXXktNFKILyk/pTIjsTgjvqg0J7X4EKMMB4eSBK9icVikkGBRanpqRVpmDjDQYNIS HDxKIryyQUBp3uKCxNzizHSI1ClGXY5XE/5/YxJiycvPS5US5w0BmSEAUpRRmgc3Ahb0lxhlp YR5GYGOEuIpSC3KzSxBlX/FKM7BqCTM6wwyhSczrwRu0yugI5iAjhCeEQJyREkiQkqqgdFAZA KTvQjvz7oDDvLtVvErNMLjk7OnGHwpWHI7O3NGhiHvi6tvbrKdWs0T+DLvG0uCdLDx/DsOUjd CSgSU3fcpveybf/HTshDd84vXSD9elVyY1bxh+b31ui8DZ3z/uNF5lqmidBGr72ZbrdnSV7TP b9+nKFZheGe3nx1/qnTHj+Y0neC9yUosxRmJhlrMRcWJABrtW7F1AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1498838083!80256930!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.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21753 invoked from network); 30 Jun 2017 15:54:43 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-2.tower-206.messagelabs.com with SMTP; 30 Jun 2017 15:54:43 -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 3A5DE15AD; Fri, 30 Jun 2017 08:54:43 -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 7825D3F41F; Fri, 30 Jun 2017 08:54:42 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 30 Jun 2017 16:54:22 +0100 Message-Id: <20170630155431.23824-8-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170630155431.23824-1-julien.grall@arm.com> References: <20170630155431.23824-1-julien.grall@arm.com> Cc: Ross Lagerwall , Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v3 07/16] 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" 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 Reviewed-by: Stefano Stabellini Acked-by: Konrad Rzeszutek Wilk Acked-by: Ross Lagerwall --- Cc: Ross Lagerwall Changes in v2: - Add Stefano's reviewed-by - Still missing an ack from Konrad and/or Ross. Changes in v3: - Add Konrad's acked-by --- 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); /*