From patchwork Fri Feb 4 07:01:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 1588309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=neuling.org header.i=@neuling.org header.a=rsa-sha256 header.s=201811 header.b=CLSeKV5C; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JqmfY6sQ3z9s0B for ; Fri, 4 Feb 2022 18:01:25 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JqmfX3JZrz3bT6 for ; Fri, 4 Feb 2022 18:01:24 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=neuling.org header.i=@neuling.org header.a=rsa-sha256 header.s=201811 header.b=CLSeKV5C; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=neuling.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=mikey@neuling.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=neuling.org header.i=@neuling.org header.a=rsa-sha256 header.s=201811 header.b=CLSeKV5C; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4JqmfV2Rlnz2xtb for ; Fri, 4 Feb 2022 18:01:21 +1100 (AEDT) Received: from neuling.org (localhost [127.0.0.1]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4JqmfQ4RXtz4xcd; Fri, 4 Feb 2022 18:01:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neuling.org; s=201811; t=1643958078; bh=p+n8SGEh2fxPJyG3X6CkJ+RCkdZM/bOJuR45YBjjV7k=; h=From:To:Cc:Subject:Date:From; b=CLSeKV5CmSTyLy2uJNMjQr07P/KiHukUAnbuNjXdP6/z2Q1D0STnRD7qb12jw17Q6 d99WPOjbzh2quwb/rky2bLSD1uudZ0k4IMspGcT1qKMhrnNyrLE2AFZQ3I8le3GJEs pHPqqZekPYj0lnTzZV6ej4AN8Ccn2IVZjCUvdCaK/YhAahAgRroNYtS4t2TpvIiR9Q bbjfJ1LvZ2udRA2SDQx2Gz17TW9kNhxpahlWWR05KxVvIl8q4VQZWXn/VR3guPkPm8 2xjSHg8CwTEjm6nt6G2TkfVCxw8T6tNl1cJR6jj3Rc5bTcaYMUCU4mMEI/jsrI+Ock kMPMBbB6SnV+Q== Received: by neuling.org (Postfix, from userid 1000) id 74D8D2C05AD; Fri, 4 Feb 2022 18:01:18 +1100 (AEDT) From: Michael Neuling To: clg@kaod.org Date: Fri, 4 Feb 2022 18:01:08 +1100 Message-Id: <20220204070108.2563717-1-mikey@neuling.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [Skiboot] [PATCH] external/mambo: Handle greater than 16 CPUs X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, grimm@linux.ibm.com, Reza Arbab , mikey@neuling.org Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- 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