From patchwork Fri Sep 9 08:40:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 75850 Delivered-To: patch@linaro.org Received: by 10.140.106.11 with SMTP id d11csp231433qgf; Fri, 9 Sep 2016 01:42:14 -0700 (PDT) X-Received: by 10.157.37.202 with SMTP id q68mr2761488ota.112.1473410534787; Fri, 09 Sep 2016 01:42:14 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id m62si2548171ith.5.2016.09.09.01.42.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Sep 2016 01:42:14 -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 1biHMA-0002BW-Q1; Fri, 09 Sep 2016 08:40:18 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1biHM9-0002Aw-Gv for xen-devel@lists.xen.org; Fri, 09 Sep 2016 08:40:17 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id 57/3A-29579-07572D75; Fri, 09 Sep 2016 08:40:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTbeg9FK 4weQJnBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8aOz5PZCl4KVmzaOoW1gfEebxcjF4eQwCZG iZamg6xdjJxAzmlGidtvhEBsNgFNiTufPzGB2CIC0hLXPl9mBLGZBSIlnsy8wQxiCwt4S5yZc 5odxGYRUJWYcfoDG4jNK+AicXvWZrBeCQE5iZPHJoPN5xRwlVi0YCcLxC4XiVtP37BPYORewM iwilGjOLWoLLVI19BEL6koMz2jJDcxM0fX0MBYLze1uDgxPTUnMalYLzk/dxMj0L8MQLCDccV 2z0OMkhxMSqK8n2UvhQvxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4PUuAcoJFqWmp1akZeYAAw0m LcHBoyTC+6AYKM1bXJCYW5yZDpE6xagoJc7LAtInAJLIKM2Da4MF9yVGWSlhXkagQ4R4ClKLc jNLUOVfMYpzMCoJ82qDTOHJzCuBm/4KaDET0GKhU+dBFpckIqSkGhjzSvY+Md245rXkhq1XtE pVM7jfP2uYveq36/9lqSHZO7evCnm46uTk2TO2WO7oXPS8fJPCgxk3P99PFGPg3h8+TzVkdgX /j809H3Y9MM2/XXj7wg2ePuVTj04xs3ifM/Zp6e5a/+Ra+YrVT0Isvz/+P1XCccbniGOV854v do5z0Aq3F5kRX9ippsRSnJFoqMVcVJwIAGHPIZJpAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1473410415!56584948!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 12955 invoked from network); 9 Sep 2016 08:40:15 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-31.messagelabs.com with SMTP; 9 Sep 2016 08:40:15 -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 4DF58472; Fri, 9 Sep 2016 01:40:15 -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 8F7D43F21A; Fri, 9 Sep 2016 01:40:14 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 9 Sep 2016 09:40:07 +0100 Message-Id: <1473410408-12426-2-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473410408-12426-1-git-send-email-julien.grall@arm.com> References: <1473410408-12426-1-git-send-email-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v3 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" 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. - Use 1U instead of 1 in shift 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 v3: - Replace "1 << xen_order" by "1U << xen_order". 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..bd7d409 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, 1U << 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; }