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

Re: [XEN v1 3/4] xen/arm32: Split and move MMU-specific head.S to mmu/head.S


  • To: Julien Grall <julien@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Wed, 18 Oct 2023 19:30:14 +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=XuyeoLfyduaMwZa3Ewy35abtmHmC0a7soRbcPyvRyYY=; b=avdsUPFZlxARu381phnkBANLjjf2n8ZfpEeTgygy+L46S8AMz97nXyK9inUAdYFdbghO8kIxYmWa73G2hsNz8mlYjbpCdY45yvjXuSo6loxzLkIX6tPoZs3IDFkPg2CVVsrCk+n8/OZyOJ5YkHVcB6VyQ2Ie00616LcQqrKr/BSgRNo+70zRqUYtZXDjmoju9sLyB06MrXr+WHc56kI/Wjamv3SXCA7TGTBwbeU1z8ABB1uMgV54TYG53msPRFLaoVSwEW2roXOpj+Lb7HECyhp3iqaMM82J6FQB/mhpwc+Rlh1Kg7MxPmv1kdfYcL29FRDs124Qa5HE4sCFhr9Vlw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k6keN5RmxynHmykJZxirbpQRgEcTQkFZhCB0Nrh+EezCcVhqfWXk0v732iTTNKRLkLWYrnck18pe9lxRmknIsmZCe6f6UAMhKr8/k+jaI3tyUYRNmYwFmR97TAFc+iTi6t4f9sSXUgCJeLeM8tbaTSksR4BuXshWeKF74l42N+A/pTtDYWtwqPLD7Cj6vQMV0b8tqLN8Dp3Idwiu8Hv3ps/D8BUb5LBhj+QI/iUWEwxs/LUn+WTo4p2ZiZg+0FvRUn+z+xaFFFuA1IH+59lVkNe1haMQsCDoGgYR9jdxc9k4kCXS/zvcgyA8N7sxMjGrfJTWVFQVwFfqm3ZnrzLr5g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: sstabellini@xxxxxxxxxx, stefano.stabellini@xxxxxxx, Volodymyr_Babchuk@xxxxxxxx, bertrand.marquis@xxxxxxx, wei.chen@xxxxxxx, penny.zheng@xxxxxxx, henry.wang@xxxxxxx
  • Delivery-date: Wed, 18 Oct 2023 18:30:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 16/10/2023 19:45, Julien Grall wrote:
Hi,
Hi Julien,

On 11/09/2023 14:59, Ayan Kumar Halder wrote:
This is based on
"[PATCH v6 03/13] xen/arm64: Split and move MMU-specific head.S to mmu/head.S"

https://www.mail-archive.com/xen-devel@xxxxxxxxxxxxxxxxxxxx/msg151920.html

Same remark as patch #1. Please provide a proper commit message.

[...]

diff --git a/xen/arch/arm/include/asm/arm32/macros.h b/xen/arch/arm/include/asm/arm32/macros.h
index a4e20aa520..64fbe4876a 100644
--- a/xen/arch/arm/include/asm/arm32/macros.h
+++ b/xen/arch/arm/include/asm/arm32/macros.h
@@ -1,8 +1,70 @@
  #ifndef __ASM_ARM_ARM32_MACROS_H
  #define __ASM_ARM_ARM32_MACROS_H
  +/* Offset between the early boot xen mapping and the runtime xen mapping */ +#define XEN_TEMPORARY_OFFSET      (TEMPORARY_XEN_VIRT_START - XEN_VIRT_START)
+
      .macro ret
          mov     pc, lr
      .endm
  +/*
+ * Move an immediate constant into a 32-bit register using movw/movt
+ * instructions.
+ */
+.macro mov_w reg, word
+        movw  \reg, #:lower16:\word
+        movt  \reg, #:upper16:\word
+.endm
+
+/*
+ * Pseudo-op for PC relative adr <reg>, <symbol> where <symbol> is
+ * within the range +/- 4GB of the PC.
+ *
+ * @dst: destination register
+ * @sym: name of the symbol
+ */
+.macro adr_l, dst, sym
+        mov_w \dst, \sym - .Lpc\@
+        .set  .Lpc\@, .+ 8          /* PC bias */
+        add   \dst, \dst, pc
+.endm
+
+.macro load_paddr rb, sym
+        mov_w \rb, \sym
+        add   \rb, \rb, r10
+.endm

I see that we are still using load_paddr in arm64/head.S. But I don't think it makes entirely sense as r10 (x20) would always be 0 for the MPU.

In fact all the use in arm{32, 64}/head.S after this patch could be easily replaced with adr_l because they are called when the MMU is off so the return address will be a physical address.

So can you add a prequisite patch for arm32 to replace the remaining some of the load_paddr? With that, load_paddr can be moved in mmu/head.S.
Sure, I am doing this. I will send you a patch in next few days.

I will take care of the arm64 part.

I see you have already sent the patch. :)

- Ayan


Cheers,




 


Rackspace

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