All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] device_tree.c: Terminate the empty reservemap in create_device_tree()
@ 2013-09-10 13:51 Peter Maydell
  2013-09-10 16:47 ` Alexander Graf
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2013-09-10 13:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite, Alexander Graf, patches

Device trees created with create_device_tree() may not have any
entries in their reservemap, because the FDT API requires that the
reservemap is completed before any FDT nodes are added, and
create_device_tree() itself creates a node.  However we were not
calling fdt_finish_reservemap(), which meant that there was no
terminator in the reservemap list and whatever happened to be at the
start of the FDT data section would end up being interpreted as
reservemap entries.  Avoid this by calling fdt_finish_reservemap()
to add the terminator.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
On ARM this manifested as a DTB with
/memreserve/    0x0000000100000000 0x0000000200000009;
and my mach-virt test kernel wasn't booting as a result.

 device_tree.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/device_tree.c b/device_tree.c
index ffec99a..391da8c 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -41,6 +41,10 @@ void *create_device_tree(int *sizep)
     if (ret < 0) {
         goto fail;
     }
+    ret = fdt_finish_reservemap(fdt);
+    if (ret < 0) {
+        goto fail;
+    }
     ret = fdt_begin_node(fdt, "");
     if (ret < 0) {
         goto fail;
-- 
1.7.9.5

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

* Re: [Qemu-devel] [PATCH] device_tree.c: Terminate the empty reservemap in create_device_tree()
  2013-09-10 13:51 [Qemu-devel] [PATCH] device_tree.c: Terminate the empty reservemap in create_device_tree() Peter Maydell
@ 2013-09-10 16:47 ` Alexander Graf
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Graf @ 2013-09-10 16:47 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Peter Crosthwaite, qemu-devel, patches


On 10.09.2013, at 08:51, Peter Maydell wrote:

> Device trees created with create_device_tree() may not have any
> entries in their reservemap, because the FDT API requires that the
> reservemap is completed before any FDT nodes are added, and
> create_device_tree() itself creates a node.  However we were not
> calling fdt_finish_reservemap(), which meant that there was no
> terminator in the reservemap list and whatever happened to be at the
> start of the FDT data section would end up being interpreted as
> reservemap entries.  Avoid this by calling fdt_finish_reservemap()
> to add the terminator.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Acked-by: Alexander Graf <agraf@suse.de>

Peter C, will you take this into your tree?


Alex

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

end of thread, other threads:[~2013-09-10 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-10 13:51 [Qemu-devel] [PATCH] device_tree.c: Terminate the empty reservemap in create_device_tree() Peter Maydell
2013-09-10 16:47 ` Alexander Graf

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.