diff mbox series

external/mambo: Handle greater than 16 CPUs

Message ID 20220204070108.2563717-1-mikey@neuling.org
State Accepted
Headers show
Series external/mambo: Handle greater than 16 CPUs | expand

Checks

Context Check Description
snowpatch_ozlabs/github-Docker_builds_and_checks fail check_build (centos8) failed at step Create Docker image.

Commit Message

Michael Neuling Feb. 4, 2022, 7:01 a.m. UTC
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@00. Currently we
always look for /cpus/PowerPC@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@neuling.org>
---
 external/mambo/skiboot.tcl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Cédric Le Goater Feb. 4, 2022, 12:22 p.m. UTC | #1
On 2/4/22 08:01, Michael Neuling wrote:
> 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@00. Currently we
> always look for /cpus/PowerPC@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@neuling.org>

Applied to master.

Thanks,

C.
diff mbox series

Patch

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