On Wed, May 15, 2024 at 4:15 PM Stephen Boyd sboyd@kernel.org wrote:
Quoting Rob Herring (2024-05-15 06:06:09)
On Tue, May 14, 2024 at 4:29 PM Stephen Boyd sboyd@kernel.org wrote:
powerpc doesn't mark the root node with OF_POPULATED_BUS. If I set that in of_platform_default_populate_init() then the overlays can be applied.
---8<---- diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 389d4ea6bfc1..fa7b439e9402 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -565,6 +565,10 @@ static int __init of_platform_default_populate_init(void) of_platform_device_create(node, buf, NULL); }
node = of_find_node_by_path("/");
if (node)
of_node_set_flag(node, OF_POPULATED_BUS);
I think you want to do this in of_platform_bus_probe() instead to mirror of_platform_populate(). These are supposed to be the same except that 'populate' only creates devices for nodes with compatible while 'probe' will create devices for all child nodes. Looks like we are missing some devlink stuff too. There may have been some issue for PPC with it.
Got it. So this patch?
---8<--- diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 389d4ea6bfc1..acecefcfdba7 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -421,6 +421,7 @@ int of_platform_bus_probe(struct device_node *root, if (of_match_node(matches, root)) { rc = of_platform_bus_create(root, matches, NULL, parent, false); } else for_each_child_of_node(root, child) {
of_node_set_flag(root, OF_POPULATED_BUS);
No, the same spot as of_platform_populate has it. I guess this would be the same, but no reason to do this in the for_each_child_of_node loop...
if (!of_match_node(matches, child)) continue; rc = of_platform_bus_create(child, matches, NULL, parent, false);
This doesn't work though. I see that prom_init() is called, which constructs a DTB and flattens it to be unflattened by unflatten_device_tree(). The powerpc machine type used by qemu is PLATFORM_PSERIES_LPAR. It looks like it never calls of_platform_bus_probe() from the pseries platform code.
Huh. Maybe pseries doesn't have any platform devices?
Ideally, we'd still do it in of_platform_default_populate_init(), but if you look at the history, you'll see that broke some PPC boards (damn initcall ordering).
What about skipping the OF_POPULATED_BUS check, or skipping the check when the parent is the root node? This is the if condition that's giving the headache.
I don't think we should just remove it, but a root node check seems fine.
Rob