From patchwork Thu Nov 3 17:01:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 13030698 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 802ADC43219 for ; Thu, 3 Nov 2022 17:03:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231386AbiKCRC6 (ORCPT ); Thu, 3 Nov 2022 13:02:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232059AbiKCRCh (ORCPT ); Thu, 3 Nov 2022 13:02:37 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 424BA140E0 for ; Thu, 3 Nov 2022 10:02:36 -0700 (PDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A3FdM21028576; Thu, 3 Nov 2022 17:01:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=zfygsbACEzEVl/O0/PDU0SNvcKoNHrKyDtKfcler3s4=; b=d9DiRZ+agIOTqigbvoYzkDH7QpB7Dl3X1ha0QSOno0uG/T/JkTMd/ToMi+7rTnIyQkmN h4g2pI/ySjWa9rfobS53mW7+9H8Z7Mm2uD7ewUyBD9RrScAzGimQWsQDd/LiUdBTqQNz joB2IGQFxfH7nc4sPpYb7ZVmtQ4zrIzvTl6Uf46KlHzWm04qWe5rHb8JHL+ZCP0qfUoA x/+LWCCF9Mo6JPdeDreGuob5D4J7qBeyfCgFpn9Svi4x/Sz0BIc/Tt0A/bgWRtAq4LPj rY94iE00/MlH6zfSffm1MUGEdz7dT0sMfXBAB45kuh3svC4WGqVikj2An15WB0q9nbA6 QQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kmemwqpy2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Nov 2022 17:01:57 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2A3GmluT002364; Thu, 3 Nov 2022 17:01:56 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kmemwqpx2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Nov 2022 17:01:56 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2A3H1s1R020712; Thu, 3 Nov 2022 17:01:54 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma06fra.de.ibm.com with ESMTP id 3kguejeuhh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Nov 2022 17:01:54 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2A3GuICP49873324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Nov 2022 16:56:18 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3DBD45204E; Thu, 3 Nov 2022 17:01:51 +0000 (GMT) Received: from li-c6ac47cc-293c-11b2-a85c-d421c8e4747b.ibm.com (unknown [9.152.222.245]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id A70F952050; Thu, 3 Nov 2022 17:01:50 +0000 (GMT) From: Pierre Morel To: qemu-s390x@nongnu.org Cc: qemu-devel@nongnu.org, borntraeger@de.ibm.com, pasic@linux.ibm.com, richard.henderson@linaro.org, david@redhat.com, thuth@redhat.com, cohuck@redhat.com, mst@redhat.com, pbonzini@redhat.com, kvm@vger.kernel.org, ehabkost@redhat.com, marcel.apfelbaum@gmail.com, eblake@redhat.com, armbru@redhat.com, seiden@linux.ibm.com, nrb@linux.ibm.com, scgl@linux.ibm.com, frankja@linux.ibm.com, berrange@redhat.com, clg@kaod.org Subject: [PATCH v11 00/11] s390x: CPU Topology Date: Thu, 3 Nov 2022 18:01:39 +0100 Message-Id: <20221103170150.20789-1-pmorel@linux.ibm.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: -6IJvBYCphr0yUXo_hd0oM4SxLEXYWBx X-Proofpoint-GUID: 2T6Ot3VZh0xvXWGOG519wYNiO974-Uf3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-03_04,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 impostorscore=0 adultscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 spamscore=0 lowpriorityscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211030110 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi, The implementation of the CPU Topology in QEMU has been drastically modified since the last patch series and the number of LOCs has been greatly reduced. 0) Two new patches in front of the series: - A preliminary patch to move the machine properties to the class_init routine - The max thread machine class attribute patch. Both patches could be taken upstream separatly from each other and from the rest of the series. 1) Unnecessary objects have been removed, only a single S390Topology object is created to support migration and reset. 2) The introduction of drawers and books is deferred to a later version. 3) A new machine property, topology, is added for new machines for test purpose and migration to/from a host without facility 11 from/to a host with the facility 11. Also a documentation has been added to the series. To use the QEMU patches, you will need Linux V6-rc1 or newer, or use the following Linux mainline patches: f5ecfee94493 2022-07-20 KVM: s390: resetting the Topology-Change-Report 24fe0195bc19 2022-07-20 KVM: s390: guest support for topology function 0130337ec45b 2022-07-20 KVM: s390: Cleanup ipte lock access and SIIF fac.. Currently this code is for KVM only, I have no idea if it is interesting to provide a TCG patch. If ever it will be done in another series. To have a better understanding of the S390x CPU Topology and its implementation in QEMU you can have a look at the documentation in the last patch of this series. The admin will want to match the host and the guest topology, taking into account that the guest does not recognize multithreading. Consequently, two vCPU assigned to threads of the same real CPU should preferably be assigned to the same socket of the guest machine. Regards, Pierre Pierre Morel (11): s390x: Register TYPE_S390_CCW_MACHINE properties as class properties s390x/cpu topology: add max_threads machine class attribute s390x/cpu topology: core_id sets s390x CPU topology s390x/cpu topology: reporting the CPU topology to the guest s390x/cpu_topology: resetting the Topology-Change-Report s390x/cpu_topology: CPU topology migration target/s390x: interception of PTF instruction s390x/cpu topology: add topology_capable QEMU capability s390x/cpu topology: add topology machine property s390x/cpu_topology: activating CPU topology docs/s390x: document s390x cpu topology docs/system/s390x/cpu-topology.rst | 80 ++++++++ include/hw/boards.h | 3 + include/hw/s390x/cpu-topology.h | 45 +++++ include/hw/s390x/s390-virtio-ccw.h | 10 + target/s390x/cpu.h | 81 ++++++++ target/s390x/kvm/kvm_s390x.h | 1 + hw/core/machine.c | 3 + hw/s390x/cpu-topology.c | 286 +++++++++++++++++++++++++++++ hw/s390x/s390-virtio-ccw.c | 192 +++++++++++++------ target/s390x/cpu-sysemu.c | 21 +++ target/s390x/cpu_topology.c | 100 ++++++++++ target/s390x/kvm/kvm.c | 50 ++++- util/qemu-config.c | 4 + hw/s390x/meson.build | 1 + qemu-options.hx | 6 +- target/s390x/meson.build | 1 + 16 files changed, 827 insertions(+), 57 deletions(-) create mode 100644 docs/system/s390x/cpu-topology.rst create mode 100644 include/hw/s390x/cpu-topology.h create mode 100644 hw/s390x/cpu-topology.c create mode 100644 target/s390x/cpu_topology.c