Re: (EXT) Re: [PATCH] of: skip disabled CPU nodes
From: Matthias Schiffer <hidden>
Date: 2020-08-26 13:54:55
Also in:
lkml
On Wed, 2020-08-26 at 08:01 -0500, Frank Rowand wrote:
On 2020-08-26 07:02, Matthias Schiffer wrote:quoted
Allow disabling CPU nodes using status = "disabled". This allows a bootloader to change the number of available CPUs (for example when a common DTS is used for SoC variants with different numbers of cores) without deleting the nodes altogether (which may require additional fixups where the CPU nodes are referenced, e.g. a cooling map). Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.comquoted
--- drivers/of/base.c | 2 ++ 1 file changed, 2 insertions(+)diff --git a/drivers/of/base.c b/drivers/of/base.c index ea44fea99813..d547e9deced1 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c@@ -796,6 +796,8 @@ struct device_node *of_get_next_cpu_node(structdevice_node *prev) of_node_put(node); } for (; next; next = next->sibling) { + if (!__of_device_is_available(next)) + continue; if (!(of_node_name_eq(next, "cpu") || __of_node_is_type(next, "cpu"))) continue;The original implementation of of_get_next_cpu_node() had that check, but status disabled for cpu nodes has different semantics than other nodes, and the check broke some systems. The check was removed by c961cb3be906 "of: Fix cpu node iterator to not ignore disabled cpu nodes". It would be useful to document that difference in the header comment of of_get_next_cpu_node(). -Frank
Hmm, I see. This difference in behaviour is quite unfortunate, as I'm currently looking for a way to *really* disable a CPU core. In arch/arm64/boot/dts/freescale/imx8mn.dtsi (and other variants of the i.MX8M), there are 4 CPU nodes for the full-featured quad-core version. The reduced single- and dual-core versions are currently handled in NXP's U-Boot fork by deleting the additional nodes. Not doing so causes the kernel to hang for a while when trying to online the non-existent cores during boot (at least in linux-imx 5.4 - I have not checked a more recent mainline kernel yet), but the deletion is non-trivial to do without leaving dangling phandle references. Kind regards, Matthias