Skip to contentSkip to conversation

of: Fix cpu node iterator to not ignore disabled cpu nodes

PATCH In review Rob Herring 3 participants 4 messages Oct 31, 2018 – Nov 1, 2018 Device tree

lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

PATCH 1/1 of: Fix cpu node iterator to not ignore disabled cpu nodes

In most cases, nodes with 'status = "disabled";' are treated as if the node is not present though it is a common bug to forget to check that. However, cpu nodes are different in that "disabled" simply means offline and the OS can bring the CPU core online. Commit f1f207e43b8a ("of: Add cpu node iterator for_each_of_cpu_node()") followed the common behavior of ignoring disabled cpu nodes. This breaks some powerpc systems (at least NXP P50XX/e5500). Fix this by dropping the status check.

Fixes 651d44f9679c ("of: use for_each_of_cpu_node iterator")
Fixes f1f207e43b8a ("of: Add cpu node iterator for_each_of_cpu_node()")
Cc Christian Zigotzky <[email protected]>
Cc Frank Rowand <[email protected]>
---
 drivers/of/base.c | 2 --
 1 file changed, 2 deletions(-)
drivers/of/base.c +0 -2
index cc62da278663..e47c5ce6cd58 100644
@@ -776,8 +776,6 @@ struct device_node *of_get_next_cpu_node(struct device_node *prev)
 		if (!(of_node_name_eq(next, "cpu") ||
 		      (next->type && !of_node_cmp(next->type, "cpu"))))
 			continue;
-		if (!__of_device_is_available(next))
-			continue;
 		if (of_node_get(next))
 			break;
 	}
Signature · 1 line
2.19.1
#1 lore raw

Thank you. I will test this patch tomorrow.

— Christian

Sent from my iPhone

Quoted 36 lines · Rob Herring

In most cases, nodes with 'status = "disabled";' are treated as if the node is not present though it is a common bug to forget to check that. However, cpu nodes are different in that "disabled" simply means offline and the OS can bring the CPU core online. Commit f1f207e43b8a ("of: Add cpu node iterator for_each_of_cpu_node()") followed the common behavior of ignoring disabled cpu nodes. This breaks some powerpc systems (at least NXP P50XX/e5500). Fix this by dropping the status check.

Fixes 651d44f9679c ("of: use for_each_of_cpu_node iterator")
Fixes f1f207e43b8a ("of: Add cpu node iterator for_each_of_cpu_node()")
Cc Christian Zigotzky <[email protected]>
Cc Frank Rowand <[email protected]>

---
drivers/of/base.c | 2 --

1 file changed, 2 deletions(-)
drivers/of/base.c +0 -2
index cc62da278663..e47c5ce6cd58 100644
@@ -776,8 +776,6 @@ struct device_node *of_get_next_cpu_node(struct device_node *prev)
       if (!(of_node_name_eq(next, "cpu") ||
             (next->type && !of_node_cmp(next->type, "cpu"))))
           continue;
-        if (!__of_device_is_available(next))
-            continue;
       if (of_node_get(next))
           break;
   }
Signature · 1 line
2.19.1
Tested-by on v1 1/1
#2 lore raw
In reply to Rob Herring
Quoted 14 lines · Rob Herring

In most cases, nodes with 'status = "disabled";' are treated as if the node is not present though it is a common bug to forget to check that. However, cpu nodes are different in that "disabled" simply means offline and the OS can bring the CPU core online. Commit f1f207e43b8a ("of: Add cpu node iterator for_each_of_cpu_node()") followed the common behavior of ignoring disabled cpu nodes. This breaks some powerpc systems (at least NXP P50XX/e5500). Fix this by dropping the status check.

Fixes 651d44f9679c ("of: use for_each_of_cpu_node iterator")
Fixes f1f207e43b8a ("of: Add cpu node iterator for_each_of_cpu_node()")
Cc Christian Zigotzky <[email protected]>
Cc Frank Rowand <[email protected]>
Quoted 3 lines
---
 drivers/of/base.c | 2 --
 1 file changed, 2 deletions(-)

This fixes my machine, thanks.

It was actually originally reported to me by Christian, so also:

cheers

Quoted 15 lines
drivers/of/base.c +0 -2
index cc62da278663..e47c5ce6cd58 100644
@@ -776,8 +776,6 @@ struct device_node *of_get_next_cpu_node(struct device_node *prev)
 		if (!(of_node_name_eq(next, "cpu") ||
 		      (next->type && !of_node_cmp(next->type, "cpu"))))
 			continue;
-		if (!__of_device_is_available(next))
-			continue;
 		if (of_node_get(next))
 			break;
 	}
Signature · 1 line
2.19.1
#3 lore raw
Quoted 30 lines · Michael Ellerman
Quoted 14 lines · Rob Herring

In most cases, nodes with 'status = "disabled";' are treated as if the node is not present though it is a common bug to forget to check that. However, cpu nodes are different in that "disabled" simply means offline and the OS can bring the CPU core online. Commit f1f207e43b8a ("of: Add cpu node iterator for_each_of_cpu_node()") followed the common behavior of ignoring disabled cpu nodes. This breaks some powerpc systems (at least NXP P50XX/e5500). Fix this by dropping the status check.

Fixes 651d44f9679c ("of: use for_each_of_cpu_node iterator")
Fixes f1f207e43b8a ("of: Add cpu node iterator for_each_of_cpu_node()")
Cc Christian Zigotzky <[email protected]>
Cc Frank Rowand <[email protected]>
Quoted 3 lines
---
  drivers/of/base.c | 2 --
  1 file changed, 2 deletions(-)

This fixes my machine, thanks.

It was actually originally reported to me by Christian, so also:

cheers

Quoted 15 lines
Quoted 15 lines
drivers/of/base.c +0 -2
index cc62da278663..e47c5ce6cd58 100644
@@ -776,8 +776,6 @@ struct device_node *of_get_next_cpu_node(struct device_node *prev)
  		if (!(of_node_name_eq(next, "cpu") ||
  		      (next->type && !of_node_cmp(next->type, "cpu"))))
  			continue;
-		if (!__of_device_is_available(next))
-			continue;
  		if (of_node_get(next))
  			break;
  	}
Signature · 1 line
2.19.1

Hi All,

Many thanks for your help! This patch fixes my P5020 board (dual core) and my virtual QEMU ppce500 machine (quad core).

Have a nice day!

Cheers,
Christian