[Skiboot] [PATCH] external/mambo: Handle greater than 16 CPUs

Michael Neuling mikey at neuling.org
Fri Feb 4 18:01:08 AEDT 2022


In OF mambo pads zeros in the CPU node names. So if you have more than
16 CPUs, the first core will be at /cpus/PowerPC at 00. Currently we
always look for /cpus/PowerPC at 0.

Fix by zero padding based on the max CPU count. This also converts to
hex since that's what's actually needed.

This fix should handle any topology. I've tested upto 128 threads (16
cores * 8 threads) but past that the mambo I have starts throwing
internal errors.

Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 external/mambo/skiboot.tcl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl
index ebabeb737c97..33a892d976b4 100644
--- a/external/mambo/skiboot.tcl
+++ b/external/mambo/skiboot.tcl
@@ -466,8 +466,11 @@ add_feature_node $np "inst-l1d-flush-ori30,30,0" $mconf(inst_l1d_flush_ori30)
 
 # Init CPUs
 set pir 0
+set pirmax [expr $mconf(cpus) * $mconf(threads)]
+set pirbits [expr int(ceil(log($pirmax) / log (16)))]
 for { set c 0 } { $c < $mconf(cpus) } { incr c } {
-    set cpu_node [mysim of find_device "/cpus/PowerPC@$pir"]
+    set p [format "%0${pirbits}x" $pir]
+    set cpu_node [mysim of find_device "/cpus/PowerPC@$p"]
     mysim of addprop $cpu_node int "ibm,pir" $pir
     set reg  [list 0x0000001c00000028 0xffffffffffffffff]
     mysim of addprop $cpu_node array64 "ibm,processor-segment-sizes" reg
-- 
2.34.1



More information about the Skiboot mailing list