* [PATCH 0/2] devicetree overlay small fixes
@ 2016-06-26 20:11 Michal Suchanek
[not found] ` <cover.1466971467.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-26 20:11 ` [PATCH 2/2] of: fdt: mark unflattened tree as detached Michal Suchanek
0 siblings, 2 replies; 8+ messages in thread
From: Michal Suchanek @ 2016-06-26 20:11 UTC (permalink / raw)
To: Rob Herring, Frank Rowand, Grant Likely, Pantelis Antoniou,
devicetree, linux-kernel
Cc: Michal Suchanek
Hello,
while testing overlay loading I found some issues with applying the overlay.
I sent these like a year ago already. One was since fixed but two still apply.
Thanks
Michal
Michal Suchanek (2):
of: overlay: add resolver error prints
of: fdt: mark unflattened tree as detached
drivers/of/fdt.c | 12 +++++++++---
drivers/of/resolver.c | 6 ++++++
2 files changed, 15 insertions(+), 3 deletions(-)
--
2.8.1
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <cover.1466971467.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* [PATCH 1/2] of: overlay: add resolver error prints
[not found] ` <cover.1466971467.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-06-26 20:11 ` Michal Suchanek
[not found] ` <38852c55a0da4780b64a8248e16df73a1d54891e.1466971467.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Michal Suchanek @ 2016-06-26 20:11 UTC (permalink / raw)
To: Rob Herring, Frank Rowand, Grant Likely, Pantelis Antoniou,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Michal Suchanek
Applying overlay fails silently in case of an error. Add error prints.
Most notably the lack of symbols in the live tree is not reported.
Signed-off-by: Michal Suchanek <hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/of/resolver.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
index d313d49..5d24a4b 100644
--- a/drivers/of/resolver.c
+++ b/drivers/of/resolver.c
@@ -313,6 +313,11 @@ int of_resolve_phandles(struct device_node *resolve)
phandle phandle, phandle_delta;
int err;
+ if (!resolve)
+ pr_err("%s: null node\n", __func__);
+ if (resolve && !of_node_check_flag(resolve, OF_DETACHED))
+ pr_err("%s: node %s not detached\n", __func__,
+ resolve->full_name);
/* the resolve node must exist, and be detached */
if (!resolve || !of_node_check_flag(resolve, OF_DETACHED))
return -EINVAL;
@@ -369,6 +374,7 @@ int of_resolve_phandles(struct device_node *resolve)
/* we need to fixup, but no root symbols... */
if (!root_sym) {
+ pr_err("%s: no symbols in root of device tree.\n", __func__);
err = -EINVAL;
goto out;
}
--
2.8.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] of: fdt: mark unflattened tree as detached
2016-06-26 20:11 [PATCH 0/2] devicetree overlay small fixes Michal Suchanek
[not found] ` <cover.1466971467.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-06-26 20:11 ` Michal Suchanek
[not found] ` <01da4c372750e6618638a0320e7ea2f656da3ae5.1466971467.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
1 sibling, 1 reply; 8+ messages in thread
From: Michal Suchanek @ 2016-06-26 20:11 UTC (permalink / raw)
To: Rob Herring, Frank Rowand, Grant Likely, Pantelis Antoniou,
devicetree, linux-kernel
Cc: Michal Suchanek
The tree returned from of_fdt_unflatten_tree cannot be attached to the
live tree because it is not marked as detached so mark it as such. The
dt resolver checks the flag and refuses to process the tree otherwise.
Signed-off-by: Michal Suchanek <hramrach@gmail.com>
---
drivers/of/fdt.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 3349d2a..7b075cf 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -384,7 +384,8 @@ static void * unflatten_dt_node(const void *blob,
*/
static void __unflatten_device_tree(const void *blob,
struct device_node **mynodes,
- void * (*dt_alloc)(u64 size, u64 align))
+ void * (*dt_alloc)(u64 size, u64 align),
+ bool detached)
{
unsigned long size;
int start;
@@ -428,6 +429,10 @@ static void __unflatten_device_tree(const void *blob,
if (be32_to_cpup(mem + size) != 0xdeadbeef)
pr_warning("End of tree marker overwritten: %08x\n",
be32_to_cpup(mem + size));
+ if (detached) {
+ of_node_set_flag(*mynodes, OF_DETACHED);
+ pr_debug("unflattened tree is detached\n");
+ }
pr_debug(" <- unflatten_device_tree()\n");
}
@@ -451,7 +456,7 @@ void of_fdt_unflatten_tree(const unsigned long *blob,
struct device_node **mynodes)
{
mutex_lock(&of_fdt_unflatten_mutex);
- __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc);
+ __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc, true);
mutex_unlock(&of_fdt_unflatten_mutex);
}
EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree);
@@ -1119,7 +1124,8 @@ bool __init early_init_dt_scan(void *params)
void __init unflatten_device_tree(void)
{
__unflatten_device_tree(initial_boot_params, &of_root,
- early_init_dt_alloc_memory_arch);
+ early_init_dt_alloc_memory_arch,
+ false);
/* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */
of_alias_scan(early_init_dt_alloc_memory_arch);
--
2.8.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] of: fdt: mark unflattened tree as detached
@ 2015-05-06 22:53 Michal Suchanek
0 siblings, 0 replies; 8+ messages in thread
From: Michal Suchanek @ 2015-05-06 22:53 UTC (permalink / raw)
To: Grant Likely, Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Pantelis Antoniou
The tree returned from of_fdt_unflatten_tree cannot be attached to the
live tree because it is not marked as detached so mark it as such. The
dt resolver checks the flag and refuses to process the tree otherwise.
Signed-off-by: Michal Suchanek <hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/of/fdt.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 0749656..32523e6 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -383,7 +383,8 @@ static void * unflatten_dt_node(const void *blob,
*/
static void __unflatten_device_tree(const void *blob,
struct device_node **mynodes,
- void * (*dt_alloc)(u64 size, u64 align))
+ void * (*dt_alloc)(u64 size, u64 align),
+ bool detached)
{
unsigned long size;
int start;
@@ -427,6 +428,10 @@ static void __unflatten_device_tree(const void *blob,
if (be32_to_cpup(mem + size) != 0xdeadbeef)
pr_warning("End of tree marker overwritten: %08x\n",
be32_to_cpup(mem + size));
+ if (detached) {
+ of_node_set_flag(*mynodes, OF_DETACHED);
+ pr_debug("unflattened tree is detached\n");
+ }
pr_debug(" <- unflatten_device_tree()\n");
}
@@ -447,7 +452,7 @@ static void *kernel_tree_alloc(u64 size, u64 align)
void of_fdt_unflatten_tree(const unsigned long *blob,
struct device_node **mynodes)
{
- __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc);
+ __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc, true);
}
EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree);
@@ -1099,7 +1104,8 @@ bool __init early_init_dt_scan(void *params)
void __init unflatten_device_tree(void)
{
__unflatten_device_tree(initial_boot_params, &of_root,
- early_init_dt_alloc_memory_arch);
+ early_init_dt_alloc_memory_arch,
+ false);
/* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */
of_alias_scan(early_init_dt_alloc_memory_arch);
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-07-22 19:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-26 20:11 [PATCH 0/2] devicetree overlay small fixes Michal Suchanek
[not found] ` <cover.1466971467.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-26 20:11 ` [PATCH 1/2] of: overlay: add resolver error prints Michal Suchanek
[not found] ` <38852c55a0da4780b64a8248e16df73a1d54891e.1466971467.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-07-18 21:47 ` Rob Herring
2016-06-26 20:11 ` [PATCH 2/2] of: fdt: mark unflattened tree as detached Michal Suchanek
[not found] ` <01da4c372750e6618638a0320e7ea2f656da3ae5.1466971467.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-07-18 21:44 ` Rob Herring
[not found] ` <CAL_JsqLiFYbcqj__B+WB7Q4=MCsr0NOwg4BpRqg1GH+=gadsVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-18 22:01 ` [PATCH] " Michal Suchanek
2016-07-22 19:55 ` Rob Herring
-- strict thread matches above, loose matches on Subject: below --
2015-05-06 22:53 Michal Suchanek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).