diff mbox series

[v1,1/2] xen/arm: Add macro XEN_VM_MAPPING

Message ID 20230831110107.2747633-2-leo.yan@linaro.org (mailing list archive)
State Superseded
Headers show
Series xen/arm: Enlarge identity map space | expand

Commit Message

Leo Yan Aug. 31, 2023, 11:01 a.m. UTC
Xen maps the virtual memory space starting from L0 slot 4, so it's open
coded for macros with the offset '4'.

For more readable, add a new macro XEN_VM_MAPPING which defines the
start slot for Xen virtual memory mapping, and all virtual memory
regions are defined based on it.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 xen/arch/arm/include/asm/config.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Bertrand Marquis Sept. 4, 2023, 1:56 p.m. UTC | #1
Hi Leo,

> On 31 Aug 2023, at 13:01, Leo Yan <leo.yan@linaro.org> wrote:
> 
> Xen maps the virtual memory space starting from L0 slot 4, so it's open
> coded for macros with the offset '4'.
> 
> For more readable, add a new macro XEN_VM_MAPPING which defines the
> start slot for Xen virtual memory mapping, and all virtual memory
> regions are defined based on it.
> 
> Signed-off-by: Leo Yan <leo.yan@linaro.org>

As said on patch 2, please check current staging code as it does not work
like this anymore.

Cheers
Bertrand

> ---
> xen/arch/arm/include/asm/config.h | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
> index 83cbf6b0cb..21f4e68a40 100644
> --- a/xen/arch/arm/include/asm/config.h
> +++ b/xen/arch/arm/include/asm/config.h
> @@ -117,11 +117,14 @@
> #define XEN_VIRT_START          _AT(vaddr_t, MB(2))
> #else
> 
> +#define IDENTITY_MAPPING_AREA_NR_L0 4
> +#define XEN_VM_MAPPING SLOT0(IDENTITY_MAPPING_AREA_NR_L0)
> +
> #define SLOT0_ENTRY_BITS  39
> #define SLOT0(slot) (_AT(vaddr_t,slot) << SLOT0_ENTRY_BITS)
> #define SLOT0_ENTRY_SIZE  SLOT0(1)
> 
> -#define XEN_VIRT_START          (SLOT0(4) + _AT(vaddr_t, MB(2)))
> +#define XEN_VIRT_START          (XEN_VM_MAPPING + _AT(vaddr_t, MB(2)))
> #endif
> 
> /*
> @@ -184,12 +187,10 @@
> 
> #else /* ARM_64 */
> 
> -#define IDENTITY_MAPPING_AREA_NR_L0  4
> -
> -#define VMAP_VIRT_START  (SLOT0(4) + GB(1))
> +#define VMAP_VIRT_START  (XEN_VM_MAPPING + GB(1))
> #define VMAP_VIRT_SIZE   GB(1)
> 
> -#define FRAMETABLE_VIRT_START  (SLOT0(4) + GB(32))
> +#define FRAMETABLE_VIRT_START  (XEN_VM_MAPPING + GB(32))
> #define FRAMETABLE_SIZE        GB(32)
> #define FRAMETABLE_NR          (FRAMETABLE_SIZE / sizeof(*frame_table))
> 
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
index 83cbf6b0cb..21f4e68a40 100644
--- a/xen/arch/arm/include/asm/config.h
+++ b/xen/arch/arm/include/asm/config.h
@@ -117,11 +117,14 @@ 
 #define XEN_VIRT_START          _AT(vaddr_t, MB(2))
 #else
 
+#define IDENTITY_MAPPING_AREA_NR_L0	4
+#define XEN_VM_MAPPING			SLOT0(IDENTITY_MAPPING_AREA_NR_L0)
+
 #define SLOT0_ENTRY_BITS  39
 #define SLOT0(slot) (_AT(vaddr_t,slot) << SLOT0_ENTRY_BITS)
 #define SLOT0_ENTRY_SIZE  SLOT0(1)
 
-#define XEN_VIRT_START          (SLOT0(4) + _AT(vaddr_t, MB(2)))
+#define XEN_VIRT_START          (XEN_VM_MAPPING + _AT(vaddr_t, MB(2)))
 #endif
 
 /*
@@ -184,12 +187,10 @@ 
 
 #else /* ARM_64 */
 
-#define IDENTITY_MAPPING_AREA_NR_L0  4
-
-#define VMAP_VIRT_START  (SLOT0(4) + GB(1))
+#define VMAP_VIRT_START  (XEN_VM_MAPPING + GB(1))
 #define VMAP_VIRT_SIZE   GB(1)
 
-#define FRAMETABLE_VIRT_START  (SLOT0(4) + GB(32))
+#define FRAMETABLE_VIRT_START  (XEN_VM_MAPPING + GB(32))
 #define FRAMETABLE_SIZE        GB(32)
 #define FRAMETABLE_NR          (FRAMETABLE_SIZE / sizeof(*frame_table))