cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
614 Views
Registered: ‎05-30-2018

Xen with reserved-memory node (PetaLinux 2019.1)

Under some circumstances, when including a reserved-memory node in the device tree, Xen will fail to boot with the following error:

(XEN) *** Serial input to DOM0 (type 'CTRL-a' three times to switch input)
(XEN) Data Abort Trap. Syndrome=0x6
(XEN) Walking Hypervisor VA 0x801bf4038 on CPU0 via TTBR 0x000000007fd1c000
(XEN) Data Abort Trap. Syndrome=0x5
(XEN) Walking Hypervisor VA 0x80007fd1c000 on CPU0 via TTBR 0x000000007fd1c000
(XEN) Data Abort Trap. Syndrome=0x5
(XEN) Walking Hypervisor VA 0x80007fd1c800 on CPU0 via TTBR 0x000000007fd1c000
(XEN) Data Abort Trap. Syndrome=0x5
(XEN) Walking Hypervisor VA 0x80007fd1c800 on CPU0 via TTBR 0x000000007fd1c000
(XEN) Data Abort Trap. Syndrome=0x5
(XEN) Walking Hypervisor VA 0x80007fd1c800 on CPU0 via TTBR 0x000000007fd1c000
...
(XEN) Assertion 'diff < STACK_SIZE' failed at traps.c:2016
(XEN) ----[ Xen-4.11.1 arm64 debug=y Tainted: C ]----
...
(XEN) Xen call trace:
(XEN) [<00000000002596e8>] traps.c#enter_hypervisor_head+0x78/0x94 (PC)
(XEN) [<000000000025bbb0>] do_trap_hyp_sync+0x24/0x140 (LR)


The device tree will have a reserved-memory node when OpenAMP is enabled, for example. See the Xilinx OpenAMP wiki page for an example of a reserved-memory node. https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/118358017/OpenAMP+2019.1

The reserved-memory node works for telling linux to keep its hands off of the shared memory region, but we also have to tell Xen to not to map the a53 <-> r5 shared memory region.

The issue seems to be related to the following commits included in the Xilinx 2019.1 branch of Xen:
292c367697 xen/arm: use p2m_mmio_direct_c to map reserved-memory
4cbd9ef4f1 xen/arm: map reserved-memory regions as normal memory in dom0

As a workaround for the Xen boot failure, we can carve out a hole in the "memory" node matching the "reserved-memory" node such that they don't overlap.
Here is an example memory layout for a Zynq UltraScale+ board with 2GB RAM with a hole carved out matching the reserved-memory node.
0x00000000 - 0x3ecfffff: 1005MiB: DDR
0x3ed00000 - 0x3fcfffff: 16MiB: reserved for a53 <-> r5 shared memory
0x3fd00000 - 0x7fffffff: 1027MiB: DDR

To carve out a hole in the memory node, add the following to openamp.dtsi or system-user.dtsi:
/ {
    /delete-node/ memory;

    memory {
        #address-cells = <2>;
        #size-cells = <2>;
        device_type = "memory";
        reg = <0x0 0x0 0x0 0x3ed00000
              0x0 0x3fd00000 0x0 0x40300000>;
    };
};

It may also be necessary to tell U-Boot not to change the memory node before passing control to Xen.
  Launch "petalinux-config -c u-boot"
    -> Boot images
      -> unselect "Enable arch_fixup_memory_banks() call"
  Or append the line "# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set" to project-spec/meta-user/recipes-bsp/u-boot/files/bsp.cfg.

After rebuilding the project, this should allow Xen 2019.1 to boot again with the reserved-memory node intact.

0 Replies