image: fdt: handle coalesced reserve region
PATCH 1/1 image: fdt: handle coalesced reserve region
Handle in boot_fdt_reserve_region
any return value > 0 of lmb_reserve() function;
it occurs when coalesced region are found:
adjacent reserved region are merged.
This patch avoid the error trace:
ERROR: reserving fdt memory region failed..
when reserved region are merged (return value = 1).
---
Tested on stm32mp1 board v2019.04-rc2
with reserved memory in device tree:
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
retram: retram at 0x38000000 {
compatible = "shared-dma-pool";
reg = <0x38000000 0x10000>;
no-map;
};
mcuram: mcuram at 0x30000000 {
compatible = "shared-dma-pool";
reg = <0x30000000 0x40000>;
no-map;
};
mcuram2: mcuram2 at 0x10000000 {
compatible = "shared-dma-pool";
reg = <0x10000000 0x40000>;
no-map;
};
vdev0vring0: vdev0vring0 at 10040000 {
compatible = "shared-dma-pool";
reg = <0x10040000 0x2000>;
no-map;
};
vdev0vring1: vdev0vring1 at 10042000 {
compatible = "shared-dma-pool";
reg = <0x10042000 0x2000>;
no-map;
};
vdev0buffer: vdev0buffer at 10044000 {
compatible = "shared-dma-pool";
reg = <0x10044000 0x4000>;
no-map;
};
};we have several adjacent reserved memory (0x10000000...0x10046000)
Without the patch I have the ERROR:
ERROR: reserving fdt memory region failed (addr=10040000 size=2000)
ERROR: reserving fdt memory region failed (addr=10042000 size=2000)
ERROR: reserving fdt memory region failed (addr=10044000 size=2000) lmb_dump_all:
memory.cnt = 0x1
memory.size = 0x0
memory.reg[0x0].base = 0xc0000000
.size = 0x40000000
reserved.cnt = 0x4
reserved.size = 0x0
reserved.reg[0x0].base = 0x10000000
.size = 0x46000
reserved.reg[0x1].base = 0x30000000
.size = 0x40000
reserved.reg[0x2].base = 0x38000000
.size = 0x10000
reserved.reg[0x3].base = 0xfdc38a98
.size = 0x23c7568with the patch not more issue...
common/image-fdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
common/image-fdt.c +2 -2
@@ -71,10 +71,10 @@ static const image_header_t *image_get_fdt(ulong fdt_addr)static void boot_fdt_reserve_region (struct lmb *lmb,uint64_t addr,uint64_t size) { -int ret; +long ret; ret =lmb_reserve (lmb, addr, size); -if (!ret) { +if (ret >=0 ) {debug (" reserving fdt memory region: addr=%llx size=%llx\n" , (unsigned long long )addr, (unsigned long long )size); }else {
Signature · 1 line
2.7.4
Quoted 10 lines · Patrick Delaunay
Handle in
boot_fdt_reserve_region
any return value > 0 oflmb_reserve()function;
it occurs when coalesced region are found:
adjacent reserved region are merged.This patch avoid the error trace:
ERROR: reserving fdt memory region failed..
when reserved region are merged (return value = 1).Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190308/db162266/attachment.sig>