From patchwork Wed Sep 7 12:50:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9319217 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 AC2396077F for ; Wed, 7 Sep 2016 12:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F5C628411 for ; Wed, 7 Sep 2016 12:54:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93CFE286F9; Wed, 7 Sep 2016 12:54:58 +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 1B18428411 for ; Wed, 7 Sep 2016 12:54:57 +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 1bhcJb-0007Nd-7s; Wed, 07 Sep 2016 12:50:55 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhcJZ-0007Ms-IT for xen-devel@lists.xen.org; Wed, 07 Sep 2016 12:50:53 +0000 Received: from [193.109.254.147] by server-3.bemta-6.messagelabs.com id 50/E5-04595-C2D00D75; Wed, 07 Sep 2016 12:50:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTVeH90K 4wcUvihZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8aMxiPMBT8EKn6sm8rewDiJt4uRk0NIYBOj xLYu7i5GLiD7NKPE1hOtTCAJNgFNiTufP4HZIgLSEtc+X2YEsZkF2hglts/yBrGFBbwlJi65x wxiswioSnzc/p+ti5GDg1fAWeLg+1SQsISAnMTJY5NZQWxOAReJ3z83sUHsdZZ4v2oW0wRG7g WMDKsYNYpTi8pSi3SNzPSSijLTM0pyEzNzdA0NzPRyU4uLE9NTcxKTivWS83M3MQK9ywAEOxj PLAg8xCjJwaQkyruN9UK4EF9SfkplRmJxRnxRaU5q8SFGGQ4OJQnePdxAOcGi1PTUirTMHGCY waQlOHiURHgPgKR5iwsSc4sz0yFSpxgVpcR5T4EkBEASGaV5cG2w0L7EKCslzMsIdIgQT0FqU W5mCar8K0ZxDkYlYV5xHqApPJl5JXDTXwEtZgJaLHTqPMjikkSElFQDI4tAL+8zbk6XFYKal9 Rv/uddkDi3df0M026tMC5DZVZGbolpa2/K9/TeYRJkmHkm0Hu+z3Txp38URG9oe5zZtTVwgsu h0ICEi6fn3l7MVDJT0+SO4XGVP4tcLr/+yMr2atoh5YKQY7V5Qezsc86xNmzv/usayif+5YTb kpNLhec3zl9atT/hoxJLcUaioRZzUXEiAObcRgtoAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-15.tower-27.messagelabs.com!1473252652!5145256!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 34798 invoked from network); 7 Sep 2016 12:50:52 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-15.tower-27.messagelabs.com with SMTP; 7 Sep 2016 12:50:52 -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 9D14D433; Wed, 7 Sep 2016 05:50:51 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.218.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 92C903F211; Wed, 7 Sep 2016 05:50:50 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 7 Sep 2016 13:50:43 +0100 Message-Id: <1473252644-4078-2-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473252644-4078-1-git-send-email-julien.grall@arm.com> References: <1473252644-4078-1-git-send-email-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org, steve.capper@arm.com, wei.chen@linaro.org Subject: [Xen-devel] [PATCH v2 1/2] xen/arm: alternative: Clean-up __apply_alternatives 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 This patch contains only renaming and comment update. There are no functional changes: - Don't mix _start and _stext, they both point to the same address but the former makes more sense (we are mapping the Xen binary, not only the text section). - s/text_mfn/xen_mfn/ and s/text_order/xen_order/ to make clear that we map the Xen binary. - Mention about inittext as alternative may patch this section. Signed-off-by: Konrad Rzeszutek Wilk Signed-off-by: Julien Grall --- Konrad, I added your signed-off by because I squashed your patch [1] in it. Let me know if there is any issue for that. [1] https://lists.xen.org/archives/html/xen-devel/2016-08/msg02890.html Changes in v2: - Patch added --- xen/arch/arm/alternative.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c index 8ee5a11..0ca97b9 100644 --- a/xen/arch/arm/alternative.c +++ b/xen/arch/arm/alternative.c @@ -99,21 +99,21 @@ static int __apply_alternatives(const struct alt_region *region) const struct alt_instr *alt; const u32 *origptr, *replptr; u32 *writeptr, *writemap; - mfn_t text_mfn = _mfn(virt_to_mfn(_stext)); - unsigned int text_order = get_order_from_bytes(_end - _start); + mfn_t xen_mfn = _mfn(virt_to_mfn(_start)); + unsigned int xen_order = get_order_from_bytes(_end - _start); printk(XENLOG_INFO "alternatives: Patching kernel code\n"); /* - * The text section is read-only. So re-map Xen to be able to patch - * the code. + * The text and inittext section are read-only. So re-map Xen to be + * able to patch the code. */ - writemap = __vmap(&text_mfn, 1 << text_order, 1, 1, PAGE_HYPERVISOR, + writemap = __vmap(&xen_mfn, 1 << xen_order, 1, 1, PAGE_HYPERVISOR, VMAP_DEFAULT); if ( !writemap ) { printk(XENLOG_ERR "alternatives: Unable to map the text section (size %u)\n", - 1 << text_order); + 1 << xen_order); return -ENOMEM; }