diff mbox series

[V2,2/3] skiboot: Update IMC code to use dt_find_by_name_substr for checking dt nodes

Message ID 20230118054452.27242-2-atrajeev@linux.vnet.ibm.com
State Superseded
Headers show
Series [V2,1/3] core/device: Add function to return child node using name at substring "@" | expand

Commit Message

Athira Rajeev Jan. 18, 2023, 5:44 a.m. UTC
The nest IMC (In Memory Collection) Performance Monitoring
Unit(PMU) node names are saved in nest_pmus[] array in the
"hw/imc.c" IMC code. Not all the IMC PMUs listed in the device
tree may be available. Nest IMC PMU names along with their
bit values is represented in imc availability vector.
The nest_pmus[] array is used to remove the unavailable nodes
by checking this vector.

To check node availability, code was using "dt_find_by_substr".
But since the node names have format like: "name@offset",
dt_find_by_name doesn't return the expected result. Fix this
by using dt_find_by_name_substr. Also, update the char array
to use correct node names with suffix "@"

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
Changelog:
v1 -> v2:
- Addressed review comment from Dan to update
  the utility funtion to search and compare
  upto "@". Renamed it as dt_find_by_name_substr.
  Hence used existing nest_pmus char array to
  update node names with "@" suffix

 hw/imc.c | 104 +++++++++++++++++++++++++++----------------------------
 1 file changed, 52 insertions(+), 52 deletions(-)
diff mbox series

Patch

diff --git a/hw/imc.c b/hw/imc.c
index 97e0809f..805e6cc1 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -50,57 +50,57 @@  static unsigned int *htm_scom_index;
  * nest_pmus[] is an array containing all the possible nest IMC PMU node names.
  */
 static char const *nest_pmus[] = {
-	"powerbus0",
-	"mcs0",
-	"mcs1",
-	"mcs2",
-	"mcs3",
-	"mcs4",
-	"mcs5",
-	"mcs6",
-	"mcs7",
-	"mba0",
-	"mba1",
-	"mba2",
-	"mba3",
-	"mba4",
-	"mba5",
-	"mba6",
-	"mba7",
-	"cen0",
-	"cen1",
-	"cen2",
-	"cen3",
-	"cen4",
-	"cen5",
-	"cen6",
-	"cen7",
-	"xlink0",
-	"xlink1",
-	"xlink2",
-	"mcd0",
-	"mcd1",
-	"phb0",
-	"phb1",
-	"phb2",
-	"phb3",
-	"phb4",
-	"phb5",
-	"nx",
-	"capp0",
-	"capp1",
-	"vas",
-	"int",
-	"alink0",
-	"alink1",
-	"alink2",
-	"alink3",
-	"nvlink0",
-	"nvlink1",
-	"nvlink2",
-	"nvlink3",
-	"nvlink4",
-	"nvlink5",
+	"powerbus0@",
+	"mcs0@",
+	"mcs1@",
+	"mcs2@",
+	"mcs3@",
+	"mcs4@",
+	"mcs5@",
+	"mcs6@",
+	"mcs7@",
+	"mba0@",
+	"mba1@",
+	"mba2@",
+	"mba3@",
+	"mba4@",
+	"mba5@",
+	"mba6@",
+	"mba7@",
+	"centaur0@",
+	"centaur1@",
+	"centaur2@",
+	"centaur3@",
+	"centaur4@",
+	"centaur5@",
+	"centaur6@",
+	"centaur7@",
+	"xlink0@",
+	"xlink1@",
+	"xlink2@",
+	"mcd0@",
+	"mcd1@",
+	"phb0@",
+	"phb1@",
+	"phb2@",
+	"phb3@",
+	"phb4@",
+	"phb5@",
+	"nx@",
+	"capp0@",
+	"capp1@",
+	"vas@",
+	"int@",
+	"alink0@",
+	"alink1@",
+	"alink2@",
+	"alink3@",
+	"nvlink0@",
+	"nvlink1@",
+	"nvlink2@",
+	"nvlink3@",
+	"nvlink4@",
+	"nvlink5@",
 	/* reserved bits : 51 - 63 */
 };
 
@@ -412,7 +412,7 @@  static void disable_unavailable_units(struct dt_node *dev)
 	for (i = 0; i < ARRAY_SIZE(nest_pmus); i++) {
 		if (!(PPC_BITMASK(i, i) & avl_vec)) {
 			/* Check if the device node exists */
-			target = dt_find_by_name(dev, nest_pmus[i]);
+			target = dt_find_by_name_substr(dev, nest_pmus[i]);
 			if (!target)
 				continue;
 			/* Remove the device node */