All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] image: fdt: handle coalesced reserve region
@ 2019-03-06 13:23 Patrick Delaunay
  2019-03-09  3:54 ` [U-Boot] " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Delaunay @ 2019-03-06 13:23 UTC (permalink / raw)
  To: u-boot

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).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

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 = 0x23c7568

with the patch not more issue...


 common/image-fdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/image-fdt.c b/common/image-fdt.c
index 94089b2..01186ae 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -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 {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] image: fdt: handle coalesced reserve region
  2019-03-06 13:23 [U-Boot] [PATCH] image: fdt: handle coalesced reserve region Patrick Delaunay
@ 2019-03-09  3:54 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2019-03-09  3:54 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 06, 2019 at 02:23:52PM +0100, Patrick Delaunay wrote:

> 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).
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

Applied to u-boot/master, thanks!

-- 
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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-09  3:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 13:23 [U-Boot] [PATCH] image: fdt: handle coalesced reserve region Patrick Delaunay
2019-03-09  3:54 ` [U-Boot] " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.