[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/arm64: head.S: Fix wrong enable_boot_cpu_mm() code movement


  • To: Henry Wang <Henry.Wang@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Thu, 21 Sep 2023 15:00:45 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GxTwrY1bZAbU8ix862Q1RZqDK0+sWRQeS8HcUcmxc2E=; b=Dzc74dcymLZqscoKFm3QopzFjg//4G0LIXZMy1Trw7YtPCG564Py6hOq7j0OrVujot7hGhqP/pC+Yb7vDyWf+wWlmRpVFuXPNfNhzrmOmI3ha+fjP5+jpgBAYipkGT+eOh0aDzP+sr3N+ZvKh4pZmVKpJGvESCNdcNbXpq570sLBy5Q0rHlxGLpwL51XfhimCqLkn3Rr+IEQl8grIZsqtnb48x3CzWvkxZWaqzgGlnKpjmSopF5eDl7+PplPQl7zPtQSfwQYQeKPYNXKEnWEYgp30hj2Oy0P55qHL6B9lSwXNfeLIe2gsxlbVKR9vhZD4rk8w3EzyYL6LiAmvgmkGw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YiIjO9ZCUbPQXDnteIuGkk3EBvj7Y0lHNYNiBmZRSurqYBRdzU8+QChvimqckHOrLDbVtEff1PMYJc5J4lasSZfDPIme1rIgWZNOXTmvtEgk+7zMDzeaYElk6ipQ3f6jVOb4reciSn2IKEM+qJzOqxZk/YyNaza78Uy3mKunaePf4xwWwxbf1n+JBWQN30DkS8BaQt6Yz1iCz2QQk1lQ8hNnlZj72/yjLSPm89AuMJxKVTUu36vcpU0pjtZdYXaa2FZ8dHlhcN2en/yRTOBlfwrVDHhv+oIQjYNBvbW/gVDGK1XVr12qqTXikysBQMUDqZBM+XKCdmni/zBbk0FRCA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Chen <wei.chen@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>
  • Delivery-date: Thu, 21 Sep 2023 14:01:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 16/09/2023 05:06, Henry Wang wrote:
CAUTION: This message has originated from an External Source. Please use proper 
judgment and caution when opening attachments, clicking links, or responding to 
this email.


Some addressed comments on enable_boot_cpu_mm() were reintroduced
back during the code movement from arm64/head.S to arm64/mmu/head.S.
We should drop the unreachable code, move the 'mov lr, x5' closer to
'b remove_identity_mapping' so it is clearer that it will return,
and update the in-code comment accordingly.

Fixes: 6734327d76be ("xen/arm64: Split and move MMU-specific head.S to 
mmu/head.S")
Reported-by: Julien Grall <jgrall@xxxxxxxxxx>
Signed-off-by: Henry Wang <Henry.Wang@xxxxxxx>
Reviewed-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
---
  xen/arch/arm/arm64/mmu/head.S | 11 +++--------
  1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/arm64/mmu/head.S b/xen/arch/arm/arm64/mmu/head.S
index a5271e3880..88075ef083 100644
--- a/xen/arch/arm/arm64/mmu/head.S
+++ b/xen/arch/arm/arm64/mmu/head.S
@@ -329,7 +329,6 @@ ENTRY(enable_boot_cpu_mm)
          load_paddr x0, boot_pgtable

          bl    enable_mmu
-        mov   lr, x5

          /*
           * The MMU is turned on and we are in the 1:1 mapping. Switch
@@ -338,19 +337,15 @@ ENTRY(enable_boot_cpu_mm)
          ldr   x0, =1f
          br    x0
  1:
+        mov   lr, x5
          /*
           * The 1:1 map may clash with other parts of the Xen virtual memory
           * layout. As it is not used anymore, remove it completely to
           * avoid having to worry about replacing existing mapping
-         * afterwards. Function will return to primary_switched.
+         * afterwards. Function will return to the virtual address requested
+         * by the caller.
           */
          b     remove_identity_mapping
-
-        /*
-         * Below is supposed to be unreachable code, as "ret" in
-         * remove_identity_mapping will use the return address in LR in 
advance.
-         */
-        b     fail
  ENDPROC(enable_boot_cpu_mm)

  /*
--
2.25.1





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.