From nobody Sun Nov 24 21:37:38 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=1720786082; cv=none; d=zohomail.com; s=zohoarc; b=budboWl6aSFU+ne/mVhpB0SFGNrpjuxRdZUxQ7a+6OcjLe4OV2NakQ/bznSfoaiWkL3hdnGeQqiEX2jrIgFs9yBkBQc1B05zfrgVigT6oTnfIHX2yiJU6C3h9HqYjW5ITkdIrKXzDo/hoR5UGdI1r4DEPEr0bl4eNINxoW4wNy0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720786082; 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=nwGrMKj4cs0jZjJ7yD0GR8qpP2HCKrG9RQwqRirqlHE=; b=gClNrGr+yRZe2ooBv8T0cxSyHe87imhCM5CEqqMpBYuMN9bzcKKNbIwdDJh7Sehw2KXmSVCBSZO/+3q7fiN5nDMHV0KPiZDyqJPjIKVi3QPtoZpTOUQSgVFuRjyjOAF4kRpJ8nOmfqn9rkH0KBt0OJOFLaMS500kvfLOQcUH26c= 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 1720786082044554.370191335582; Fri, 12 Jul 2024 05:08:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSF0c-0008Cr-Nd; Fri, 12 Jul 2024 08:04:18 -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 1sSF0T-0007Z1-T5; Fri, 12 Jul 2024 08:04:10 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sSF0P-0005mA-BY; Fri, 12 Jul 2024 08:04:08 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-70b2a0542c2so1832943b3a.3; Fri, 12 Jul 2024 05:04:04 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jul 2024 05:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720785842; x=1721390642; 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=nwGrMKj4cs0jZjJ7yD0GR8qpP2HCKrG9RQwqRirqlHE=; b=msi+3ijayEx3gUCKsqc5UGcaKzRxy1ML/8ZcylUPjg0N02TVXfJySjw/au9TjagDkG /MlwVM5JEWcjmVg6jTmz6rc+yUA06yHfQM+bmwhen2s+dOkorvvb+VbzArhErrkRX2vC l51AEniNPTu7KW9pEPAW7G78pMvb3T7p87RneWcySxKwbA/ZWAZf9h2TeQUxJ1GP3Ywh np9ukT9sjX9ExXUedmhguN8YmgE/fk/lEr0h2rq4q1neEC+86yHRitAPp4V4jErGS5Ne PId+5SvF9KGLGZ0LBabeinjRIUWw9OXmAWnZC5kH+0bzkrj84fNU02eUH7vMIIUzXv5v nVvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720785842; x=1721390642; 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=nwGrMKj4cs0jZjJ7yD0GR8qpP2HCKrG9RQwqRirqlHE=; b=uD8kVHKjiDaiOQhCq/vU9L0dMq5CqZO7aOL4190/MpMM6NcwoM8z3KmWPjubTlfJqX XFiSLQB77Hnf4ZnuoXRhK1moUaJAJOE82PsuzQhYGsc3I5dpCUlfKegx4mDTONopIM6V elTuoz2ie5QXjYkdLNjmsvRwidS2zYGe12kVnxifh6Oww+K0okIOHmjoL9vAoVO08YZv r4Pk4FTGUAsHJSgc38uiXABwelz7Bw1Be8RepcQE+miT1dH9iyNAhb99LtCnLjWEWmLf mblk5FZucSrBvDcSMW7b6/u9kOgZHDbU+t9xCtTpx2AgFUpHtwy4edCH15IHRqmLlnPm FPHg== X-Forwarded-Encrypted: i=1; AJvYcCW8UnlxUBv1UtMMGbfS/ivdo8jKFkxUiKvwtvKnoHD9hyP5Aq/neQ+wk83C8z80OHWW23gW5OvG6d4mZucZNAmAW7q1Wlw= X-Gm-Message-State: AOJu0Yy/vQJIJiyXqi8xlznsh0r3D0dZe71Mf/bp3Fe4xuq2JZFzpBGi zMy4+Gcvjw8UKKijUrXwNOXhLlPCDMXAWH/FO0UlrcibZLlKRQpQh1jKPw== X-Google-Smtp-Source: AGHT+IExA4Vel9ApnDgpubmx+RLGFmxlFbp+chx5PXO+EfaNSBSDMBa1OQQd95Y+UeR1CdJk1AdtVQ== X-Received: by 2002:a05:6a20:9145:b0:1c0:f594:198c with SMTP id adf61e73a8af0-1c29820c067mr15409355637.11.1720785841739; Fri, 12 Jul 2024 05:04:01 -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 09/19] ppc: Add has_smt_siblings property to CPUPPCState Date: Fri, 12 Jul 2024 22:02:36 +1000 Message-ID: <20240712120247.477133-10-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::42f; envelope-from=npiggin@gmail.com; helo=mail-pf1-x42f.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: 1720786083366116600 The decision to branch out to a slower SMT path in instruction emulation will become a bit more complicated with the way that "big-core" topology that will be implemented in subsequent changes. Hide these details from the wider CPU emulation code with a bool has_smt_siblings flag that can be set by machine initialisation. Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Nicholas Piggin --- target/ppc/cpu.h | 3 ++- hw/ppc/pnv_core.c | 3 +++ hw/ppc/spapr_cpu_core.c | 12 +++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 417b284318..321ed2da75 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1248,6 +1248,7 @@ struct CPUArchState { int access_type; =20 /* For SMT processors */ + bool has_smt_siblings; int core_index; =20 #if !defined(CONFIG_USER_ONLY) @@ -1514,7 +1515,7 @@ struct PowerPCCPUClass { =20 static inline bool ppc_cpu_core_single_threaded(CPUState *cs) { - return cs->nr_threads =3D=3D 1; + return !POWERPC_CPU(cs)->env.has_smt_siblings; } =20 static inline bool ppc_cpu_lpar_single_threaded(CPUState *cs) diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c index 7bda29b9c7..8cfa94fbfa 100644 --- a/hw/ppc/pnv_core.c +++ b/hw/ppc/pnv_core.c @@ -288,6 +288,9 @@ static void pnv_core_realize(DeviceState *dev, Error **= errp) cpu =3D POWERPC_CPU(obj); =20 pc->threads[i] =3D POWERPC_CPU(obj); + if (cc->nr_threads > 1) { + cpu->env.has_smt_siblings =3D true; + } =20 snprintf(name, sizeof(name), "thread[%d]", i); object_property_add_child(OBJECT(pc), name, obj); diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 4e13e6993a..2c6eeb41a4 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -351,9 +351,15 @@ static void spapr_cpu_core_realize(DeviceState *dev, E= rror **errp) qemu_register_reset(spapr_cpu_core_reset_handler, sc); sc->threads =3D g_new0(PowerPCCPU *, cc->nr_threads); for (i =3D 0; i < cc->nr_threads; i++) { - sc->threads[i] =3D spapr_create_vcpu(sc, i, errp); - if (!sc->threads[i] || - !spapr_realize_vcpu(sc->threads[i], spapr, sc, i, errp)) { + PowerPCCPU *cpu; + + cpu =3D spapr_create_vcpu(sc, i, errp); + sc->threads[i] =3D cpu; + if (cpu && cc->nr_threads > 1) { + cpu->env.has_smt_siblings =3D true; + } + + if (!cpu || !spapr_realize_vcpu(cpu, spapr, sc, i, errp)) { spapr_cpu_core_unrealize(dev); return; } --=20 2.45.1