From nobody Sun Nov 24 20:38:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1720785856; cv=none; d=zohomail.com; s=zohoarc; b=Puqi2tq2J9xmzOlYubCC6LoHlxEsbkrruvqM4sMP06hM5QZpJC36iSUo2qXhoS5aAA45c76dH02Mi73JZcKu5C1KCMKLA5RtCs2M7M5biqlzLWw8iekKwTIWRdPgeTJQhryk0/vAN0of+GsU2BE8GHSbqtjpU95yyC43FK3Vet4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720785856; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7AyDGj3ZDezl1UlUVAm1qZ38iB6LaQ9Gbtb/xnqxjfY=; b=l/mvcFdpzi+mEneB9Se+SZE1HP8IsEwqpEQveKRUpXJf5rTaJ0JEba5yOGQk5NLiAgIePeC14MtCFGaCqwY2gOKZ0fyD7F5I5v26eI5I/gx5X+m+oCfgOoDJeIL/WSyVuvU6JKBykgflucW8IRwWwp4fbYym3+ew+OUrugPQIt8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1720785856597454.25960939302286; Fri, 12 Jul 2024 05:04:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSF0G-0006V5-47; Fri, 12 Jul 2024 08:03:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sSEzh-0004gQ-7L; Fri, 12 Jul 2024 08:03:29 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sSEzf-0005Zr-9d; Fri, 12 Jul 2024 08:03:20 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-70b703eda27so334304b3a.3; Fri, 12 Jul 2024 05:03:18 -0700 (PDT) Received: from wheely.local0.net ([203.220.44.216]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b438c0a1csm7308967b3a.63.2024.07.12.05.03.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jul 2024 05:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720785797; x=1721390597; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7AyDGj3ZDezl1UlUVAm1qZ38iB6LaQ9Gbtb/xnqxjfY=; b=nNiBz7sQZ09eO3Y8RWn/e7qOJ+j8bFXxRq4JDw3as1hz4Qc7j+CeII9otVz9izknpv A1cG1E/uvSG13xGRxx15ieXUv3HhG/nvM7SWIGw8ROLf/vdRrNX9UHpwm6n71AZdtkOY B3RRONP9za3aVVxluHSm95wMFxWhnwjSf+0oEqKW+q/tjpiK05yCCKWQd4wR9kQooZ4A dVoviluDaGPy5C50YrQ25vYn+OljtGP3nIzt7sqJVSjVi21JKErVi3rnZLl5bdZkfNHU un5fXzzhAADNAIcUDqUAx/UyI+X94VFJjO6dP1jcy0H+HWPx9cR1Ajz+erv10hk3K6fp BCig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720785797; x=1721390597; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7AyDGj3ZDezl1UlUVAm1qZ38iB6LaQ9Gbtb/xnqxjfY=; b=KOaYSTPNdWmNHRwtf5BecPjOCw9975mG45P+5JT9c/SCOU3F3PngheFL/GXwlQJU8j L8iHasypXCpKQZseCahVxB/dfMFCJbM3mYFpHNKfwC4qfOG3XX2F9XAXruqizyi3kogH uLvYZ+XlVCa+X18xvLlQ/ctRpXqO8M7r0mK8rqg7Bcqs8UvfoDOtECUXcA+t13NrVniP eWzLQtV/nQou/d4Pt57wBXyDULii8d4gUACvDnh+fp2YTM5gumo94AtxeuHUWAyqdD8X iv68pi+rtdV55OBzbmZwBiK04WFlKQkHOCg/tBfZDPgfwJFLzgs1oZC4LX1Ssa3WSc+H rc3A== X-Forwarded-Encrypted: i=1; AJvYcCUtydlhrlwaff4zST2e2XCZx/gNaAcxmpJWjjAQPcfJo+jOthYGacr7Ot2zFBwNRccH+q+JqElcIhCRPW12fxbDJmGgUuA= X-Gm-Message-State: AOJu0YzFlPGoiPQj8W9QKOeCMjNxgBow/8+RHQvuvS259pvfIx1qiFR6 voDsqQpF5U38qduFb18LeFUYeVmckFlqePDqy5HVojkd4mnBbgS0UxnTCQ== X-Google-Smtp-Source: AGHT+IGZrPUFOKKc6wttAOrLtWfTaPuLwbqZC+9f+1OSLdaIdSe8kWLK9GYge6NeVJXJboS957na8Q== X-Received: by 2002:a05:6a21:6d9e:b0:1c0:e629:3926 with SMTP id adf61e73a8af0-1c298221bf3mr13184752637.16.1720785796762; Fri, 12 Jul 2024 05:03:16 -0700 (PDT) From: Nicholas Piggin To: qemu-ppc@nongnu.org Cc: Nicholas Piggin , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Barrat?= , Harsh Prateek Bora , qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PATCH v2 05/19] ppc/pnv: use class attribute to limit SMT threads for different machines Date: Fri, 12 Jul 2024 22:02:32 +1000 Message-ID: <20240712120247.477133-6-npiggin@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240712120247.477133-1-npiggin@gmail.com> References: <20240712120247.477133-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=npiggin@gmail.com; helo=mail-pf1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1720785858150116600 Use a class attribute to specify the number of SMT threads per core permitted for different machines, 8 for powernv8 and 4 for powernv9/10. Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Harsh Prateek Bora Signed-off-by: Nicholas Piggin --- include/hw/ppc/pnv.h | 1 + hw/ppc/pnv.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 476b136146..1993dededf 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -76,6 +76,7 @@ struct PnvMachineClass { /*< public >*/ const char *compat; int compat_size; + int max_smt_threads; =20 void (*dt_power_mgt)(PnvMachineState *pnv, void *fdt); void (*i2c_init)(PnvMachineState *pnv); diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 7878fed43c..fde51ca946 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -899,6 +899,7 @@ static void pnv_init(MachineState *machine) PnvMachineState *pnv =3D PNV_MACHINE(machine); MachineClass *mc =3D MACHINE_GET_CLASS(machine); PnvMachineClass *pmc =3D PNV_MACHINE_GET_CLASS(machine); + int max_smt_threads =3D pmc->max_smt_threads; char *fw_filename; long fw_size; uint64_t chip_ram_start =3D 0; @@ -997,17 +998,19 @@ static void pnv_init(MachineState *machine) pnv->num_chips =3D machine->smp.max_cpus / (machine->smp.cores * machine->smp.threads= ); =20 - if (machine->smp.threads > 8) { - error_report("Cannot support more than 8 threads/core " - "on a powernv machine"); + if (machine->smp.threads > max_smt_threads) { + error_report("Cannot support more than %d threads/core " + "on %s machine", max_smt_threads, mc->desc); exit(1); } + if (!is_power_of_2(machine->smp.threads)) { error_report("Cannot support %d threads/core on a powernv" "machine because it must be a power of 2", machine->smp.threads); exit(1); } + /* * TODO: should we decide on how many chips we can create based * on #cores and Venice vs. Murano vs. Naples chip type etc..., @@ -2490,6 +2493,7 @@ static void pnv_machine_power8_class_init(ObjectClass= *oc, void *data) =20 pmc->compat =3D compat; pmc->compat_size =3D sizeof(compat); + pmc->max_smt_threads =3D 8; =20 machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB); } @@ -2514,6 +2518,7 @@ static void pnv_machine_power9_class_init(ObjectClass= *oc, void *data) =20 pmc->compat =3D compat; pmc->compat_size =3D sizeof(compat); + pmc->max_smt_threads =3D 4; pmc->dt_power_mgt =3D pnv_dt_power_mgt; =20 machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB); @@ -2538,6 +2543,7 @@ static void pnv_machine_p10_common_class_init(ObjectC= lass *oc, void *data) =20 pmc->compat =3D compat; pmc->compat_size =3D sizeof(compat); + pmc->max_smt_threads =3D 4; pmc->dt_power_mgt =3D pnv_dt_power_mgt; =20 xfc->match_nvt =3D pnv10_xive_match_nvt; --=20 2.45.1