xen/arm: Enlarge identity map space
cover xen/arm: Enlarge identity map space
The latest Xen fails to boot on ADLink AVA platform. Alexey Klimov root caused the issue is related with the commit 1c78d76b67 ("xen/arm64: mm:
Introduce helpers to prepare/enable/disable").
This is because on ADLink AVA platform, it loads Xen hypervisor to the address above 2TB and hence causes Xen panic:
(XEN) MODULE[0]: 00000807f6df0000 - 00000807f6f3e000 Xen (XEN) MODULE[1]: 00000807f8054000 - 00000807f8056000 Device Tree (XEN) MODULE[2]: 00000000fa834000 - 00000000fc5de1d5 Ramdisk (XEN) MODULE[3]: 00000000fc5df000 - 00000000ffb3f810 Kernel
To fix this issue, this series is to enlarge identity map space to 127 TiB and tested on ADLink AVA platform.
Note, we tested on two ADLind AVA platforms, one machine has this issue and another machine cannot reproduce the panic. It's likely they have different firmware versions so one machine loads Xen hypervisor into the high memory address and caused booting failure.
Leo Yan (2):
xen/arm: Add macro XEN_VM_MAPPING
xen/arm: Enlarge identity map space to 127TiB
xen/arch/arm/include/asm/config.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
Signature · 1 line
2.39.2
PATCH 1/2 xen/arm: Add macro XEN_VM_MAPPING
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.
--- xen/arch/arm/include/asm/config.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
xen/arch/arm/include/asm/config.h +6 -5
@@ -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))
Signature · 1 line
2.39.2
Re: [PATCH v1 1/2] xen/arm: Add macro XEN_VM_MAPPING
Hi Leo,
Quoted 10 lines · Leo Yan
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_MAPPINGwhich defines the start slot for Xen virtual memory mapping, and all virtual memory regions are defined based on it.Signed-off-by Leo Yan <[email protected]>
As said on patch 2, please check current staging code as it does not work like this anymore.
Cheers
Bertrand
Quoted 42 lines
---
xen/arch/arm/include/asm/config.h| 11 ++++++-----1 file changed, 6 insertions(+), 5 deletions(-)xen/arch/arm/include/asm/config.h +6
-5@@ -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))Signature · 1 line
2.39.2
PATCH 2/2 xen/arm: Enlarge identity map space to 127TiB
In reply to Leo YanOn some platforms, the memory regions could be:
(XEN) MODULE[0]: 00000807f6df0000 - 00000807f6f3e000 Xen (XEN) MODULE[1]: 00000807f8054000 - 00000807f8056000 Device Tree (XEN) MODULE[2]: 00000000fa834000 - 00000000fc5de1d5 Ramdisk (XEN) MODULE[3]: 00000000fc5df000 - 00000000ffb3f810 Kernel
In this case, the Xen binary is loaded above 2TB, so Xen fails to boot up due to the out of the identity map space.
This patch enlarges identity map space to 127TiB, which can support the memory space [0x0 .. 0x00007eff_ffff_ffff], thus it has flexibility for support different platforms.
--- xen/arch/arm/include/asm/config.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
xen/arch/arm/include/asm/config.h +3 -6
@@ -87,11 +87,11 @@* 2G - 4G Domheap: on-demand-mapped * * ARM64 layout: -* 0x0000000000000000 - 0x000001ffffffffff (2TB, L0 slots [0..3]) +* 0x0000000000000000 - 0x00007effffffffff (127TB, L0 slots [0..253]) * * Reserved to identity map Xen * -* 0x0000020000000000 - 0x0000027fffffffff (512GB, L0 slot [4]) +* 0x000007f000000000 - 0x00007fffffffffff (1TB, L0 slot [254..255]) * (Relative offsets) * 0 - 2M Unmapped * 2M - 10M Xen text, data, bss
@@ -103,9 +103,6 @@* * 32G - 64G Frametable: 56 bytes per page for 2TB of RAM * -* 0x0000028000000000 - 0x00007fffffffffff (125TB, L0 slots [5..255]) -* Unused -* * 0x0000800000000000 - 0x000084ffffffffff (5TB, L0 slots [256..265]) * 1:1 mapping of RAM *
@@ -117,7 +114,7 @@#define XEN_VIRT_START _AT(vaddr_t, MB(2))#else -#define IDENTITY_MAPPING_AREA_NR_L0 4 +#define IDENTITY_MAPPING_AREA_NR_L0 254#define XEN_VM_MAPPING SLOT0(IDENTITY_MAPPING_AREA_NR_L0)#define SLOT0_ENTRY_BITS 39
Signature · 1 line
2.39.2
Re: [PATCH v1 2/2] xen/arm: Enlarge identity map space to 127TiB
Quoted 11 lines · Leo Yan
On some platforms, the memory regions could be:
(XEN) MODULE[0]:
00000807f6df0000-00000807f6f3e000Xen (XEN) MODULE[1]:00000807f8054000-00000807f8056000Device Tree (XEN) MODULE[2]:00000000fa834000-00000000fc5de1d5Ramdisk (XEN) MODULE[3]:00000000fc5df000-00000000ffb3f810KernelIn this case, the Xen binary is loaded above 2TB, so Xen fails to boot up due to the out of the identity map space.
Quoted 7 lines
This patch enlarges identity map space to 127TiB, which can support the memory space [
0x0.. 0x00007eff_ffff_ffff], thus it has flexibility for support different platforms.Fixes 1c78d76b67 ("xen/arm64: mm: Introduce helpers to prepare/enable/disable")Reported-by Alexey Klimov <[email protected]>Signed-off-by Leo Yan <[email protected]>
Feel free to use:
I confirm that I can boot Xen with these two patches and start a guest VM.
Thanks,
Alexey
Re: [PATCH v1 2/2] xen/arm: Enlarge identity map space to 127TiB
In reply to Leo YanHi Leo,
Quoted 12 lines · Leo Yan
On some platforms, the memory regions could be:
(XEN) MODULE[0]:
00000807f6df0000-00000807f6f3e000Xen (XEN) MODULE[1]:00000807f8054000-00000807f8056000Device Tree (XEN) MODULE[2]:00000000fa834000-00000000fc5de1d5Ramdisk (XEN) MODULE[3]:00000000fc5df000-00000000ffb3f810KernelIn this case, the Xen binary is loaded above 2TB, so Xen fails to boot up due to the out of the identity map space.
Quoted 7 lines
This patch enlarges identity map space to 127TiB, which can support the memory space [
0x0.. 0x00007eff_ffff_ffff], thus it has flexibility for support different platforms.Fixes 1c78d76b67 ("xen/arm64: mm: Introduce helpers to prepare/enable/disable")Reported-by Alexey Klimov <[email protected]>Signed-off-by Leo Yan <[email protected]>
This is not based on the current status of staging where this part of the code was modified.
Currently Xen virtual address is at 2TB and the extension you are making will potentially make it possible to load Xen at 2TB which will clash for the identity mapping handling in Xen.
Please rebase on the latest staging and check there how you can do as this patch if rebased on staging right now with rightfully end in a compilation error.
Cheers
Bertrand
Quoted 44 lines
---
xen/arch/arm/include/asm/config.h| 9 +++------1 file changed, 3 insertions(+), 6 deletions(-)xen/arch/arm/include/asm/config.h +3
-6@@ -87,11 +87,11 @@* 2G - 4G Domheap: on-demand-mapped * * ARM64 layout: -* 0x0000000000000000 - 0x000001ffffffffff (2TB, L0 slots [0..3]) +* 0x0000000000000000 - 0x00007effffffffff (127TB, L0 slots [0..253]) * * Reserved to identity map Xen * -* 0x0000020000000000 - 0x0000027fffffffff (512GB, L0 slot [4]) +* 0x000007f000000000 - 0x00007fffffffffff (1TB, L0 slot [254..255]) * (Relative offsets) * 0 - 2M Unmapped * 2M - 10M Xen text, data, bss @@ -103,9 +103,6 @@* * 32G - 64G Frametable: 56 bytes per page for 2TB of RAM * -* 0x0000028000000000 - 0x00007fffffffffff (125TB, L0 slots [5..255]) -* Unused -* * 0x0000800000000000 - 0x000084ffffffffff (5TB, L0 slots [256..265]) * 1:1 mapping of RAM * @@ -117,7 +114,7 @@#define XEN_VIRT_START _AT(vaddr_t, MB(2))#else -#define IDENTITY_MAPPING_AREA_NR_L0 4 +#define IDENTITY_MAPPING_AREA_NR_L0 254#define XEN_VM_MAPPING SLOT0(IDENTITY_MAPPING_AREA_NR_L0)#define SLOT0_ENTRY_BITS 39Signature · 1 line
2.39.2
Re: [PATCH v1 2/2] xen/arm: Enlarge identity map space to 127TiB
Hi Bertrand,
Quoted 22 lines · Bertrand Marquis
Hi Leo,
Quoted 12 lines · Leo Yan
On some platforms, the memory regions could be:
(XEN) MODULE[0]:
00000807f6df0000-00000807f6f3e000Xen (XEN) MODULE[1]:00000807f8054000-00000807f8056000Device Tree (XEN) MODULE[2]:00000000fa834000-00000000fc5de1d5Ramdisk (XEN) MODULE[3]:00000000fc5df000-00000000ffb3f810KernelIn this case, the Xen binary is loaded above 2TB, so Xen fails to boot up due to the out of the identity map space.
Quoted 7 lines
This patch enlarges identity map space to 127TiB, which can support the memory space [
0x0.. 0x00007eff_ffff_ffff], thus it has flexibility for support different platforms.Fixes 1c78d76b67 ("xen/arm64: mm: Introduce helpers to prepare/enable/disable")Reported-by Alexey Klimov <[email protected]>Signed-off-by Leo Yan <[email protected]>
Quoted 6 lines
This is not based on the current status of staging where this part of the code was modified.
Currently Xen virtual address is at 2TB and the extension you are making will potentially make it possible to load Xen at 2TB which will clash for the identity mapping handling in Xen.
I will check the stage code if this patch will introduce any clash with the identity mapping handling.
Quoted 3 lines
Please rebase on the latest staging and check there how you can do as this patch if rebased on staging right now with rightfully end in a compilation error.
Sure, I will rebase on the latest staging branch.
Thank you for suggestions.
Leo