]> xenbits.xensource.com Git - xen.git/commit
xen/device-tree: Allow region overlapping with /memreserve/ ranges
authorLuca Fancellu <luca.fancellu@arm.com>
Thu, 14 Nov 2024 10:28:02 +0000 (10:28 +0000)
committerJulien Grall <jgrall@amazon.com>
Thu, 28 Nov 2024 18:57:21 +0000 (18:57 +0000)
commita14593e3995afc74bf4efe91116e34894e0ea49a
tree4da0adf7bf5c0eb64f1ecfb80eec0aaf67de613c
parent4a06cc7178ad8914dc2a0dc86282662af15041e1
xen/device-tree: Allow region overlapping with /memreserve/ ranges

There are some cases where the device tree exposes a memory range
in both /memreserve/ and reserved-memory node, in this case the
current code will stop Xen to boot since it will find that the
latter range is clashing with the already recorded /memreserve/
ranges.

Furthermore, u-boot lists boot modules ranges, such as ramdisk,
in the /memreserve/ part and even in this case this will prevent
Xen to boot since it will see that the module memory range that
it is going to add in 'add_boot_module' clashes with a /memreserve/
range.

When Xen populate the data structure that tracks the memory ranges,
it also adds a memory type described in 'enum membank_type', so
in order to fix this behavior, allow overlapping with the /memreserve/
ranges in the 'check_reserved_regions_overlap' function when a flag
is set.

In order to implement this solution, there is a distinction between
the 'struct membanks *' handled by meminfo_overlap_check(...) that
needs to be done, because the static shared memory banks doesn't have
a usable bank[].type field and so it can't be accessed, hence now
the 'struct membanks_hdr' have a 'enum region_type type' field in order
to be able to identify static shared memory banks in meminfo_overlap_check(...).

While there, set a type for the memory recorded using meminfo_add_bank()
from efi-boot.h.

Fixes: 53dc37829c31 ("xen/arm: Add DT reserve map regions to bootinfo.reserved_mem")
Reported-by: Shawn Anastasio <sanastasio@raptorengineering.com>
Reported-by: Grygorii Strashko <grygorii_strashko@epam.com>
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Tested-by: Grygorii Strashko <grygorii_strashko@epam.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
xen/arch/arm/efi/efi-boot.h
xen/arch/arm/static-shmem.c
xen/common/device-tree/bootfdt.c
xen/common/device-tree/bootinfo.c
xen/include/xen/bootfdt.h