From patchwork Fri Jun 30 15:54: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: 106727 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2507459qge; Fri, 30 Jun 2017 08:57:05 -0700 (PDT) X-Received: by 10.36.225.198 with SMTP id n189mr7932690ith.93.1498838225084; Fri, 30 Jun 2017 08:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498838225; cv=none; d=google.com; s=arc-20160816; b=NGxffH4EJzj1C7HBIes4q21pyEcO84Aj4ymPrK5kRXZcurrMAL5SQJOHYQcEY/lVo7 XaCXn8IxjpAQYTBhqF8r43nuN6nmd6cLw91k5eYf2Frj/7Vn80s19LhPdepDOHkD0S0P 7fzWnLt43PVi+vVZWBCN/jmIQM2U8u+zM8IbJQsMJaEndHIOEDsstlSCtT+R1GDfePPh /i8sN+dIJkIDNOaDtACKxKOvyI3N5mCV/RnajW4DpMaNulkf/6iaw4VnvlxRkPVGeWxO z+CZ3qGl1uAlEDzhneRoTnQhdFnqwZV42cZc1LVS4PfP5gZcJc5ri6uFV/YwASnHIjAf 9Qgw== 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=HMdBXsMFkpQ/pgoViJnEj1gO7GOGRlo1GqUHSMgs2As=; b=AZXA3TjHqZdtY5rhTeO1rIJIy2WeWbWS5q2dGx0DmqnbcYHxx63PKbLCHt6vPAax8V jHPs5vAlTgQblWMBWYd99S4eOinsTiYcrkbO/x+4jpe87CYsBru9sfj2vjSUSfJkPftJ qIRIO8IUM/tTZQHslZfEU+kQDSGsVVXhvoP3KvgH7ZK/jrBtqOEFMO7stSaPXwnCIgbE mty2HHoRhvSW0KQqVksoxG/KLezWE68bFsb40jAKc1wsOFH9vAX6pR5+0ZrUUlqxTfwj bnTYTmNAa9c3WlljD2q7DiQ+khdTNYc8WBFbFWfgA8emuBGGN7BrRG3UEN2vXwEHdadl nUEg== 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 c24si4266001itd.141.2017.06.30.08.57.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 08:57:05 -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 1dQyFp-0000Rh-Bq; Fri, 30 Jun 2017 15:54:45 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQyFo-0000Pk-2o for xen-devel@lists.xen.org; Fri, 30 Jun 2017 15:54:44 +0000 Received: from [85.158.143.35] by server-11.bemta-6.messagelabs.com id DD/38-03612-34476595; Fri, 30 Jun 2017 15:54:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRWlGSWpSXmKPExsVysyfVTdepJCz SYOM5S4slHxezODB6HN39mymAMYo1My8pvyKBNWPf39mMBZe4Kl5vvMbSwPiUo4uRi0NIYBOj xIIfx5ghnNOMEi2npzB1MXJysAloStz5/AnMFhGQlrj2+TIjiM0s4CDx5uM9FhBbWCBC4vOxv 2A2i4CqxKR/f8BqeAUsJY623gGzJQTkJXa1XWQFsTkFrCSO/3sANlMIqOb1rKssExi5FzAyrG LUKE4tKkst0jUy10sqykzPKMlNzMzRNTQw08tNLS5OTE/NSUwq1kvOz93ECPQwAxDsYFy8NvA QoyQHk5Io78proZFCfEn5KZUZicUZ8UWlOanFhxhlODiUJHgVi8MihQSLUtNTK9Iyc4ChBpOW 4OBREuGVDQJK8xYXJOYWZ6ZDpE4xGnNsWL3+CxPHqwn/vzEJseTl56VKifO+KgIqFQApzSjNg xsEi4FLjLJSwryMQKcJ8RSkFuVmlqDKv2IU52BUEuZlA7mHJzOvBG7fK6BTmIBOEZ4RAnJKSS JCSqqB0XnrDOEnYfryi4/EX2pP5Nz5Q9pDRllcv6577tESm3Re5QrPy3tSXXf/WHRq+r9bYet D7gh2p52NfnywwEyvsaRDcLPDfjmp0+HLQ4/KWt8629Wy33vfxdX/HluKrZRkvFS7WkdSYGfb X/MY1iDh6lDJ3LsT0y/f+H/bp8DvZvRk6yybneoTlViKMxINtZiLihMBvEnROnwCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1498838082!67649181!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 48691 invoked from network); 30 Jun 2017 15:54:42 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-21.messagelabs.com with SMTP; 30 Jun 2017 15:54:42 -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 3CF5C80D; Fri, 30 Jun 2017 08:54:42 -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 9C90F3F41F; Fri, 30 Jun 2017 08:54:41 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 30 Jun 2017 16:54:21 +0100 Message-Id: <20170630155431.23824-7-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: Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v3 06/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" 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;