Skip to contentSkip to conversation

ARM: kernel: respect device tree status of cpu nodes

PATCH In review Jürg Billeter 4 participants 4 messages Feb 24, 2014 – Mar 6, 2014 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: kernel: respect device tree status of cpu nodes

Skip 'disabled' cpu nodes when building the cpu logical map. This avoids booting cpus that have been disabled in the device tree.

---
 arch/arm/kernel/devtree.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/kernel/devtree.c +4 -0
index 739c3df..9aed299 100644
@@ -95,6 +95,10 @@ void __init arm_dt_init_cpu_maps(void)
 		if (of_node_cmp(cpu->type, "cpu"))
 			continue;
 
+		/* Check if CPU is enabled */
+		if (!of_device_is_available(cpu))
+			continue;
+
 		pr_debug(" * %s...\n", cpu->full_name);
 		/*
 		 * A device tree containing CPU nodes with missing "reg"
Signature · 1 line
1.9.0
#1 lore raw

+Lorenzo

Quoted 14 lines · J?rg Billeter

Skip 'disabled' cpu nodes when building the cpu logical map. This avoids booting cpus that have been disabled in the device tree.

---
 arch/arm/kernel/devtree.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/kernel/devtree.c +0 -0
index 739c3df..9aed299 100644

arch/arm/kernel/devtree.c void __init arm_dt_init_cpu_maps(void) · line 104

Quoted 10 lines
arch/arm/kernel/devtree.c +4 -0
@@ -95,6 +95,10 @@ void __init arm_dt_init_cpu_maps(void)
 		if (of_node_cmp(cpu->type, "cpu"))
 			continue;
 
+		/* Check if CPU is enabled */
+		if (!of_device_is_available(cpu))
+			continue;
+
 		pr_debug(" * %s...\n", cpu->full_name);
 		/*
 		 * A device tree containing CPU nodes with missing "reg"

This doesn't follow the ePAPR spec. According to ePAPR status="disabled" in a cpu node means "the cpu is in a quiescent state" and one can enable it by using the "enable-method". At the least, we should document this in bindings/arm/cpus.txt if we can all agree that we want this definition of disabled.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#2 lore raw
Quoted 20 lines · Stephen Boyd

+Lorenzo

Quoted 17 lines · Jürg Billeter

Skip 'disabled' cpu nodes when building the cpu logical map. This avoids booting cpus that have been disabled in the device tree.

---
  arch/arm/kernel/devtree.c | 4 ++++
  1 file changed, 4 insertions(+)
arch/arm/kernel/devtree.c +0 -0
index 739c3df..9aed299 100644
@@ -95,6 +95,10 @@ void __init arm_dt_init_cpu_maps(void)
  		if (of_node_cmp(cpu->type, "cpu"))
  			continue;
 
Quoted 13 lines

arch/arm/kernel/devtree.c void __init arm_dt_init_cpu_maps(void) · line 104

Quoted 7 lines
arch/arm/kernel/devtree.c +4 -0
+		/* Check if CPU is enabled */
+		if (!of_device_is_available(cpu))
+			continue;
+
  		pr_debug(" * %s...\n", cpu->full_name);
  		/*
  		 * A device tree containing CPU nodes with missing "reg"

This doesn't follow the ePAPR spec. According to ePAPR status="disabled" in a cpu node means "the cpu is in a quiescent state" and one can enable it by using the "enable-method". At the least, we should document this in bindings/arm/cpus.txt if we can all agree that we want this definition of disabled.

My view was that disabled should be the same as for the device case as it makes sense that way.

We have a position where we want to use the .dtsi files but not all cpus are available to the Linux. If we cannot use disabled then we need some other method to say this cpu node is not available, so please do not try and bring it online (saves boot time waiting for CPU nodes that cannot online)

Signature · 6 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

[CC'in BenH and Grant to check how this is handled in powerPC]

Quoted 35 lines · Ben Dooks
Quoted 20 lines · Stephen Boyd

+Lorenzo

Quoted 17 lines · Jürg Billeter

Skip 'disabled' cpu nodes when building the cpu logical map. This avoids booting cpus that have been disabled in the device tree.

---
  arch/arm/kernel/devtree.c | 4 ++++
  1 file changed, 4 insertions(+)
arch/arm/kernel/devtree.c +0 -0
index 739c3df..9aed299 100644
@@ -95,6 +95,10 @@ void __init arm_dt_init_cpu_maps(void)
  		if (of_node_cmp(cpu->type, "cpu"))
  			continue;
 
Quoted 13 lines

arch/arm/kernel/devtree.c void __init arm_dt_init_cpu_maps(void) · line 104

Quoted 7 lines
arch/arm/kernel/devtree.c +4 -0
+		/* Check if CPU is enabled */
+		if (!of_device_is_available(cpu))
+			continue;
+
  		pr_debug(" * %s...\n", cpu->full_name);
  		/*
  		 * A device tree containing CPU nodes with missing "reg"

This doesn't follow the ePAPR spec. According to ePAPR status="disabled" in a cpu node means "the cpu is in a quiescent state" and one can enable it by using the "enable-method". At the least, we should document this in bindings/arm/cpus.txt if we can all agree that we want this definition of disabled.

Quoted 2 lines

My view was that disabled should be the same as for the device case as it makes sense that way.

Ok, it has been brought up before.

ePAPR v1.1, 2.3.4 "status"

"disabled" - Indicates that the device is not presently operational, but
it might become operational in the future (for example, something is not plugged in, or switched off). Refer to the device binding for details on what disabled means for a given device.

So "disabled" for devices does not read that different to me to what Stephen mentioned for a CPU.

After all you just want the CPU node to be ignored, and that's not a CPU status, it is a DT trick to use one .dtsi for multiple boot scenarios.

I wonder how the status property has been used on powerPC.

By grepping the sources, it is checked in arch/powerpc/kernel/prom_init.c and that's just to check CPU that are already in status =="okay", so they can be put in a holding loop (I guess).

It should be fine to deviate from the ePAPR and consider using:

status = "disabled"

for your aim (it has been ignored so far on all ARM platforms I am aware of, so this should not break the kernel).

We need to update cpus.txt accordingly and override it for ARM.

Quoted 5 lines

We have a position where we want to use the .dtsi files but not all cpus are available to the Linux. If we cannot use disabled then we need some other method to say this cpu node is not available, so please do not try and bring it online (saves boot time waiting for CPU nodes that cannot online)

Understood, see above.

Lorenzo