From nobody Mon Feb 9 00:30:50 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1667748871; cv=none; d=zohomail.com; s=zohoarc; b=ebYaDEfaMvFauxSQXyK6lTazy3KpVtj7Ek+eIIz923TqL8ODgiqBW9rtNyQKCtL2jTuGvjO0V+drgA1BExN3Fph6tWz/QURnytKlthJU/71eSgZfys72nb5/EkXJoYI4F9tIMMowbrxthuoQktUGf0KuqNxOa6zo/f+QYqD/MNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667748871; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FSc7kASAompedP/qqWg7JHmuf7auHcR0TUlKhC+u7yw=; b=PJI26lrU4pWO+l9XjjRBGOAzqcmvDcl2zIChyB0V8UVbFzs1po1gL6vF/WNi9pwXmxVTAxivJ/QmWWSLxzt6x3bOELnsvqbUr2lzJn9sH7GQz8AUcZXxpDuslr/Tr/L4WHAurKr6MCY4oEBAg9cxDh4y5Q2d69iaXYDCuZDPwIk= 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 16677488718631016.9071992764527; Sun, 6 Nov 2022 07:34:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1orhdO-0005wM-Rt; Sun, 06 Nov 2022 10:32:30 -0500 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 1orhdL-0005v1-PM for qemu-devel@nongnu.org; Sun, 06 Nov 2022 10:32:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orhdK-0000y4-DB for qemu-devel@nongnu.org; Sun, 06 Nov 2022 10:32:27 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-290-1aHLLA8UOgWtPCvLjN4MMQ-1; Sun, 06 Nov 2022 10:32:23 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2EC0E185A792; Sun, 6 Nov 2022 15:32:23 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2D3640C6EC4; Sun, 6 Nov 2022 15:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667748745; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FSc7kASAompedP/qqWg7JHmuf7auHcR0TUlKhC+u7yw=; b=Q+cbbahzuazwlKX4gWlNnFwkmv4NsNzzZn3N6FBUoaFzZmlv1Hgtya6mHAG8upOg2YfIK2 hU/+vM8mTRDBzcm1nB36XVH1TwAo9VuZrsjSxM/o4e43XsCCEun5iFZ48MEnG5yUqyvrj/ UwHrMHsYyxN/2nfx/WTjPcN1dS9te6g= X-MC-Unique: 1aHLLA8UOgWtPCvLjN4MMQ-1 From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Pierre Morel Subject: [PULL 12/12] s390x/cpu topology: add max_threads machine class attribute Date: Sun, 6 Nov 2022 16:31:56 +0100 Message-Id: <20221106153156.620150-13-thuth@redhat.com> In-Reply-To: <20221106153156.620150-1-thuth@redhat.com> References: <20221106153156.620150-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1667748872279100001 Content-Type: text/plain; charset="utf-8" From: Pierre Morel The S390 CPU topology accepts the smp.threads argument while in reality it does not effectively allow multthreading. Let's keep this behavior for machines older than 7.2 and refuse to use threads in newer machines until multithreading is really exposed to the guest by the machine. Signed-off-by: Pierre Morel Message-Id: <20221103170150.20789-3-pmorel@linux.ibm.com> [thuth: Small fixes to the commit description] Signed-off-by: Thomas Huth --- include/hw/s390x/s390-virtio-ccw.h | 1 + hw/s390x/s390-virtio-ccw.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-vir= tio-ccw.h index 8a0090a071..4f8a39abda 100644 --- a/include/hw/s390x/s390-virtio-ccw.h +++ b/include/hw/s390x/s390-virtio-ccw.h @@ -40,6 +40,7 @@ struct S390CcwMachineClass { bool cpu_model_allowed; bool css_migration_enabled; bool hpage_1m_allowed; + int max_threads; }; =20 /* runtime-instrumentation allowed by the machine */ diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 196773c833..560ddbb6fb 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -85,8 +85,15 @@ out: static void s390_init_cpus(MachineState *machine) { MachineClass *mc =3D MACHINE_GET_CLASS(machine); + S390CcwMachineClass *s390mc =3D S390_CCW_MACHINE_CLASS(mc); int i; =20 + if (machine->smp.threads > s390mc->max_threads) { + error_report("S390 does not support more than %d threads.", + s390mc->max_threads); + exit(1); + } + /* initialize possible_cpus */ mc->possible_cpu_arch_ids(machine); =20 @@ -731,6 +738,7 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) s390mc->cpu_model_allowed =3D true; s390mc->css_migration_enabled =3D true; s390mc->hpage_1m_allowed =3D true; + s390mc->max_threads =3D 1; mc->init =3D ccw_init; mc->reset =3D s390_machine_reset; mc->block_default_type =3D IF_VIRTIO; @@ -859,8 +867,11 @@ static void ccw_machine_7_1_instance_options(MachineSt= ate *machine) =20 static void ccw_machine_7_1_class_options(MachineClass *mc) { + S390CcwMachineClass *s390mc =3D S390_CCW_MACHINE_CLASS(mc); + ccw_machine_7_2_class_options(mc); compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len); + s390mc->max_threads =3D S390_MAX_CPUS; } DEFINE_CCW_MACHINE(7_1, "7.1", false); =20 --=20 2.31.1