xen/arm: bootfdt: Always sort memory banks
authorOleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Mon, 5 Jul 2021 17:48:51 +0000 (20:48 +0300)
committerJulien Grall <jgrall@amazon.com>
Tue, 6 Jul 2021 08:55:53 +0000 (09:55 +0100)
commit4473f3601098a2c3cf5ab89d5a29504772985e3a
treeb9d985106b8df6469591a6313a4088492a9bf111
parent09e2cd69956fe529bfc3d53dae477b44eff217d1
xen/arm: bootfdt: Always sort memory banks

At the moment, Xen on Arm64 expects the memory banks to be ordered.
Unfortunately, there may be a case when updated by firmware
device tree contains unordered banks. This means Xen will panic
when setting xenheap mappings for the subsequent bank with start
address being less than xenheap_mfn_start (start address of
the first bank).

As there is no clear requirement regarding ordering in the device
tree, update code to be able to deal with by sorting memory
banks. There is only one heap region on Arm32, so the sorting
is fine to be done in the common code.

Suggested-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/arch/arm/bootfdt.c