From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504815355831811.6846004085152; Thu, 7 Sep 2017 13:15:55 -0700 (PDT) Received: from localhost ([::1]:42105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3DN-0005Ir-Nm for importer@patchew.org; Thu, 07 Sep 2017 16:15:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3BP-000400-Bd for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:13:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3BK-00021b-K3 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:13:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58588) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3BK-00020q-C1 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:13:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6AA3D356D7; Thu, 7 Sep 2017 20:13:45 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 387AD69733; Thu, 7 Sep 2017 20:13:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6AA3D356D7 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:15 +0200 Message-Id: <20170907201335.13956-2-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 07 Sep 2017 20:13:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 01/21] exec, dump, i386, ppc, s390x: don't include exec/cpu-all.h explicitly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" All but a handful of files include exec/cpu-all.h via cpu.h only. As these files already include cpu.h, let's just drop the additional include. Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand --- dump.c | 1 - exec.c | 1 - target/i386/arch_dump.c | 1 - target/i386/arch_memory_mapping.c | 1 - target/i386/svm_helper.c | 1 - target/ppc/arch_dump.c | 1 - target/s390x/arch_dump.c | 1 - 7 files changed, 7 deletions(-) diff --git a/dump.c b/dump.c index a79773d0f7..2ef6a678e8 100644 --- a/dump.c +++ b/dump.c @@ -15,7 +15,6 @@ #include "qemu/cutils.h" #include "elf.h" #include "cpu.h" -#include "exec/cpu-all.h" #include "exec/hwaddr.h" #include "monitor/monitor.h" #include "sysemu/kvm.h" diff --git a/exec.c b/exec.c index d20c34ca83..a25a4c6018 100644 --- a/exec.c +++ b/exec.c @@ -56,7 +56,6 @@ #endif =20 #endif -#include "exec/cpu-all.h" #include "qemu/rcu_queue.h" #include "qemu/main-loop.h" #include "translate-all.h" diff --git a/target/i386/arch_dump.c b/target/i386/arch_dump.c index e682904052..35b55fc200 100644 --- a/target/i386/arch_dump.c +++ b/target/i386/arch_dump.c @@ -13,7 +13,6 @@ =20 #include "qemu/osdep.h" #include "cpu.h" -#include "exec/cpu-all.h" #include "sysemu/dump.h" #include "elf.h" #include "sysemu/memory_mapping.h" diff --git a/target/i386/arch_memory_mapping.c b/target/i386/arch_memory_ma= pping.c index 647cff2829..271cb5e41b 100644 --- a/target/i386/arch_memory_mapping.c +++ b/target/i386/arch_memory_mapping.c @@ -13,7 +13,6 @@ =20 #include "qemu/osdep.h" #include "cpu.h" -#include "exec/cpu-all.h" #include "sysemu/memory_mapping.h" =20 /* PAE Paging or IA-32e Paging */ diff --git a/target/i386/svm_helper.c b/target/i386/svm_helper.c index 59e8b5091c..f479239875 100644 --- a/target/i386/svm_helper.c +++ b/target/i386/svm_helper.c @@ -19,7 +19,6 @@ =20 #include "qemu/osdep.h" #include "cpu.h" -#include "exec/cpu-all.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" #include "exec/cpu_ldst.h" diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c index 8e9397aa58..beb7268e57 100644 --- a/target/ppc/arch_dump.c +++ b/target/ppc/arch_dump.c @@ -15,7 +15,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "elf.h" -#include "exec/cpu-all.h" #include "sysemu/dump.h" #include "sysemu/kvm.h" =20 diff --git a/target/s390x/arch_dump.c b/target/s390x/arch_dump.c index 9b0bf92698..6f61ff95af 100644 --- a/target/s390x/arch_dump.c +++ b/target/s390x/arch_dump.c @@ -15,7 +15,6 @@ #include "cpu.h" #include "internal.h" #include "elf.h" -#include "exec/cpu-all.h" #include "sysemu/dump.h" =20 =20 --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504815520699308.7417270945002; Thu, 7 Sep 2017 13:18:40 -0700 (PDT) Received: from localhost ([::1]:42114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3G3-0007v4-K3 for importer@patchew.org; Thu, 07 Sep 2017 16:18:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3BR-000406-P6 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:13:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3BN-000236-2k for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:13:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41852) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3BM-00022e-TA for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:13:49 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E287781DF6; Thu, 7 Sep 2017 20:13:47 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5BDC68D81; Thu, 7 Sep 2017 20:13:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E287781DF6 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:16 +0200 Message-Id: <20170907201335.13956-3-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 07 Sep 2017 20:13:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 02/21] cpu: drop old comments describing members X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These comments are obviously stale. Acked-by: Cornelia Huck Signed-off-by: David Hildenbrand --- include/qom/cpu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 995a7beeb5..0dc767a753 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -388,10 +388,10 @@ struct CPUState { DECLARE_BITMAP(trace_dstate, CPU_TRACE_DSTATE_MAX_EVENTS); =20 /* TODO Move common fields from CPUArchState here. */ - int cpu_index; /* used by alpha TCG */ - uint32_t halted; /* used by alpha, cris, ppc TCG */ + int cpu_index; + uint32_t halted; uint32_t can_do_io; - int32_t exception_index; /* used by m68k TCG */ + int32_t exception_index; =20 /* shared by kvm, hax and hvf */ bool vcpu_dirty; --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504815365415649.4750186104088; Thu, 7 Sep 2017 13:16:05 -0700 (PDT) Received: from localhost ([::1]:42106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3DY-0005Q8-1V for importer@patchew.org; Thu, 07 Sep 2017 16:16:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3BV-00041Z-8x for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3BP-00024k-N0 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:13:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60286) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3BP-00024K-Eo for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:13:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F7EC83F45; Thu, 7 Sep 2017 20:13:50 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 430C958842; Thu, 7 Sep 2017 20:13:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8F7EC83F45 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:17 +0200 Message-Id: <20170907201335.13956-4-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 07 Sep 2017 20:13:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 03/21] s390x: get rid of s390-virtio.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It is a leftover from the days where we had still the !ccw virtio machine. As this one is long gone, let's move everything to s390-virtio-ccw.c. Suggested-by: Cornelia Huck Reviewed-by: Thomas Huth Acked-by: Christian Borntraeger Signed-off-by: David Hildenbrand --- hw/s390x/Makefile.objs | 1 - hw/s390x/s390-virtio-ccw.c | 157 +++++++++++++++++++++++++++++++++++++++++= +++- hw/s390x/s390-virtio.c | 37 ----------- hw/s390x/s390-virtio.h | 15 ----- 4 files changed, 156 insertions(+), 54 deletions(-) diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs index 7ee19d3abc..dc704b57d6 100644 --- a/hw/s390x/Makefile.objs +++ b/hw/s390x/Makefile.objs @@ -1,4 +1,3 @@ -obj-y +=3D s390-virtio.o obj-y +=3D s390-virtio-hcall.o obj-y +=3D sclp.o obj-y +=3D event-facility.o diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index dd504dd5ae..4c3a3e177b 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -2,6 +2,7 @@ * virtio ccw machine * * Copyright 2012 IBM Corp. + * Copyright (c) 2009 Alexander Graf * Author(s): Cornelia Huck * * This work is licensed under the terms of the GNU GPL, version 2 or (at @@ -31,6 +32,46 @@ #include "hw/s390x/css-bridge.h" #include "migration/register.h" #include "cpu_models.h" +#include "qapi/qmp/qerror.h" +#include "hw/nmi.h" + +static S390CPU **cpu_states; + +S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) +{ + if (cpu_addr >=3D max_cpus) { + return NULL; + } + + /* Fast lookup via CPU ID */ + return cpu_states[cpu_addr]; +} + +static void s390_init_cpus(MachineState *machine) +{ + int i; + gchar *name; + + if (machine->cpu_model =3D=3D NULL) { + machine->cpu_model =3D s390_default_cpu_model_name(); + } + + cpu_states =3D g_new0(S390CPU *, max_cpus); + + for (i =3D 0; i < max_cpus; i++) { + name =3D g_strdup_printf("cpu[%i]", i); + object_property_add_link(OBJECT(machine), name, TYPE_S390_CPU, + (Object **) &cpu_states[i], + object_property_allow_set_link, + OBJ_PROP_LINK_UNREF_ON_RELEASE, + &error_abort); + g_free(name); + } + + for (i =3D 0; i < smp_cpus; i++) { + s390x_new_cpu(machine->cpu_model, i, &error_fatal); + } +} =20 static const char *const reset_dev_types[] =3D { TYPE_VIRTUAL_CSS_BRIDGE, @@ -94,7 +135,7 @@ static void virtio_ccw_register_hcalls(void) virtio_ccw_hcall_early_printk); } =20 -void s390_memory_init(ram_addr_t mem_size) +static void s390_memory_init(ram_addr_t mem_size) { MemoryRegion *sysmem =3D get_system_memory(); MemoryRegion *ram =3D g_new(MemoryRegion, 1); @@ -109,11 +150,103 @@ void s390_memory_init(ram_addr_t mem_size) s390_stattrib_init(); } =20 +#define S390_TOD_CLOCK_VALUE_MISSING 0x00 +#define S390_TOD_CLOCK_VALUE_PRESENT 0x01 + +static void gtod_save(QEMUFile *f, void *opaque) +{ + uint64_t tod_low; + uint8_t tod_high; + int r; + + r =3D s390_get_clock(&tod_high, &tod_low); + if (r) { + fprintf(stderr, "WARNING: Unable to get guest clock for migration.= " + "Error code %d. Guest clock will not be migrated " + "which could cause the guest to hang.\n", r); + qemu_put_byte(f, S390_TOD_CLOCK_VALUE_MISSING); + return; + } + + qemu_put_byte(f, S390_TOD_CLOCK_VALUE_PRESENT); + qemu_put_byte(f, tod_high); + qemu_put_be64(f, tod_low); +} + +static int gtod_load(QEMUFile *f, void *opaque, int version_id) +{ + uint64_t tod_low; + uint8_t tod_high; + int r; + + if (qemu_get_byte(f) =3D=3D S390_TOD_CLOCK_VALUE_MISSING) { + fprintf(stderr, "WARNING: Guest clock was not migrated. This could= " + "cause the guest to hang.\n"); + return 0; + } + + tod_high =3D qemu_get_byte(f); + tod_low =3D qemu_get_be64(f); + + r =3D s390_set_clock(&tod_high, &tod_low); + if (r) { + fprintf(stderr, "WARNING: Unable to set guest clock value. " + "s390_get_clock returned error %d. This could caus= e " + "the guest to hang.\n", r); + } + + return 0; +} + static SaveVMHandlers savevm_gtod =3D { .save_state =3D gtod_save, .load_state =3D gtod_load, }; =20 +static void s390_init_ipl_dev(const char *kernel_filename, + const char *kernel_cmdline, + const char *initrd_filename, const char *fir= mware, + const char *netboot_fw, bool enforce_bios) +{ + Object *new =3D object_new(TYPE_S390_IPL); + DeviceState *dev =3D DEVICE(new); + + if (kernel_filename) { + qdev_prop_set_string(dev, "kernel", kernel_filename); + } + if (initrd_filename) { + qdev_prop_set_string(dev, "initrd", initrd_filename); + } + qdev_prop_set_string(dev, "cmdline", kernel_cmdline); + qdev_prop_set_string(dev, "firmware", firmware); + qdev_prop_set_string(dev, "netboot_fw", netboot_fw); + qdev_prop_set_bit(dev, "enforce_bios", enforce_bios); + object_property_add_child(qdev_get_machine(), TYPE_S390_IPL, + new, NULL); + object_unref(new); + qdev_init_nofail(dev); +} + +static void s390_create_virtio_net(BusState *bus, const char *name) +{ + int i; + + for (i =3D 0; i < nb_nics; i++) { + NICInfo *nd =3D &nd_table[i]; + DeviceState *dev; + + if (!nd->model) { + nd->model =3D g_strdup("virtio"); + } + + qemu_check_nic_model(nd, "virtio"); + + dev =3D qdev_create(bus, name); + qdev_set_nic_properties(dev, nd); + qdev_init_nofail(dev); + } +} + static void ccw_init(MachineState *machine) { int ret; @@ -177,6 +310,19 @@ static void s390_cpu_plug(HotplugHandler *hotplug_dev, g_free(name); } =20 +static void s390_machine_reset(void) +{ + S390CPU *ipl_cpu =3D S390_CPU(qemu_get_cpu(0)); + + s390_cmma_reset(); + qemu_devices_reset(); + s390_crypto_reset(); + + /* all cpus are stopped - configure and start the ipl cpu only */ + s390_ipl_prepare_cpu(ipl_cpu); + s390_cpu_set_state(CPU_STATE_OPERATING, ipl_cpu); +} + static void s390_machine_device_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { @@ -201,6 +347,15 @@ static void s390_hot_add_cpu(const int64_t id, Error *= *errp) s390x_new_cpu(machine->cpu_model, id, errp); } =20 +static void s390_nmi(NMIState *n, int cpu_index, Error **errp) +{ + CPUState *cs =3D qemu_get_cpu(cpu_index); + + if (s390_cpu_restart(S390_CPU(cs))) { + error_setg(errp, QERR_UNSUPPORTED); + } +} + static void ccw_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c index da3f49e80e..9316be1cfc 100644 --- a/hw/s390x/s390-virtio.c +++ b/hw/s390x/s390-virtio.c @@ -48,17 +48,6 @@ #define S390_TOD_CLOCK_VALUE_MISSING 0x00 #define S390_TOD_CLOCK_VALUE_PRESENT 0x01 =20 -static S390CPU **cpu_states; - -S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) -{ - if (cpu_addr >=3D max_cpus) { - return NULL; - } - - /* Fast lookup via CPU ID */ - return cpu_states[cpu_addr]; -} =20 void s390_init_ipl_dev(const char *kernel_filename, const char *kernel_cmdline, @@ -86,32 +75,6 @@ void s390_init_ipl_dev(const char *kernel_filename, qdev_init_nofail(dev); } =20 -void s390_init_cpus(MachineState *machine) -{ - int i; - gchar *name; - - if (machine->cpu_model =3D=3D NULL) { - machine->cpu_model =3D s390_default_cpu_model_name(); - } - - cpu_states =3D g_new0(S390CPU *, max_cpus); - - for (i =3D 0; i < max_cpus; i++) { - name =3D g_strdup_printf("cpu[%i]", i); - object_property_add_link(OBJECT(machine), name, TYPE_S390_CPU, - (Object **) &cpu_states[i], - object_property_allow_set_link, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); - g_free(name); - } - - for (i =3D 0; i < smp_cpus; i++) { - s390x_new_cpu(machine->cpu_model, i, &error_fatal); - } -} - =20 void s390_create_virtio_net(BusState *bus, const char *name) { diff --git a/hw/s390x/s390-virtio.h b/hw/s390x/s390-virtio.h index ca97fd6814..d984cd4115 100644 --- a/hw/s390x/s390-virtio.h +++ b/hw/s390x/s390-virtio.h @@ -12,24 +12,9 @@ #ifndef HW_S390_VIRTIO_H #define HW_S390_VIRTIO_H =20 -#include "hw/nmi.h" #include "standard-headers/asm-s390/kvm_virtio.h" #include "standard-headers/asm-s390/virtio-ccw.h" =20 typedef int (*s390_virtio_fn)(const uint64_t *args); void s390_register_virtio_hypercall(uint64_t code, s390_virtio_fn fn); - -void s390_init_cpus(MachineState *machine); -void s390_init_ipl_dev(const char *kernel_filename, - const char *kernel_cmdline, - const char *initrd_filename, - const char *firmware, - const char *netboot_fw, - bool enforce_bios); -void s390_create_virtio_net(BusState *bus, const char *name); -void s390_nmi(NMIState *n, int cpu_index, Error **errp); -void s390_machine_reset(void); -void s390_memory_init(ram_addr_t mem_size); -void gtod_save(QEMUFile *f, void *opaque); -int gtod_load(QEMUFile *f, void *opaque, int version_id); #endif --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504815519074546.0053906069127; Thu, 7 Sep 2017 13:18:39 -0700 (PDT) Received: from localhost ([::1]:42113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3G2-0007o4-2N for importer@patchew.org; Thu, 07 Sep 2017 16:18:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3BW-000430-Uy for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3BS-00026g-7Z for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:13:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60386) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3BS-000263-0L for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:13:54 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1A20A7E42B; Thu, 7 Sep 2017 20:13:53 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id E25EB58842; Thu, 7 Sep 2017 20:13:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1A20A7E42B Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:18 +0200 Message-Id: <20170907201335.13956-5-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 07 Sep 2017 20:13:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 04/21] s390x: rename s390-virtio.h to s390-virtio-hcall.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The only interface left, so let's properly rename it. Reviewed-by: Thomas Huth Acked-by: Christian Borntraeger Signed-off-by: David Hildenbrand --- hw/s390x/s390-virtio-ccw.c | 2 +- hw/s390x/s390-virtio-hcall.c | 2 +- hw/s390x/{s390-virtio.h =3D> s390-virtio-hcall.h} | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) rename hw/s390x/{s390-virtio.h =3D> s390-virtio-hcall.h} (77%) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 4c3a3e177b..f67b4b5d58 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -16,7 +16,7 @@ #include "cpu.h" #include "hw/boards.h" #include "exec/address-spaces.h" -#include "s390-virtio.h" +#include "hw/s390x/s390-virtio-hcall.h" #include "hw/s390x/sclp.h" #include "hw/s390x/s390_flic.h" #include "hw/s390x/ioinst.h" diff --git a/hw/s390x/s390-virtio-hcall.c b/hw/s390x/s390-virtio-hcall.c index 23d67d6170..ec7cf8beb3 100644 --- a/hw/s390x/s390-virtio-hcall.c +++ b/hw/s390x/s390-virtio-hcall.c @@ -11,7 +11,7 @@ =20 #include "qemu/osdep.h" #include "cpu.h" -#include "hw/s390x/s390-virtio.h" +#include "hw/s390x/s390-virtio-hcall.h" =20 #define MAX_DIAG_SUBCODES 255 =20 diff --git a/hw/s390x/s390-virtio.h b/hw/s390x/s390-virtio-hcall.h similarity index 77% rename from hw/s390x/s390-virtio.h rename to hw/s390x/s390-virtio-hcall.h index d984cd4115..59fcba3a06 100644 --- a/hw/s390x/s390-virtio.h +++ b/hw/s390x/s390-virtio-hcall.h @@ -1,5 +1,5 @@ /* - * Virtio interfaces for s390 + * Support for virtio hypercalls on s390x * * Copyright 2012 IBM Corp. * Author(s): Cornelia Huck @@ -9,12 +9,12 @@ * directory. */ =20 -#ifndef HW_S390_VIRTIO_H -#define HW_S390_VIRTIO_H +#ifndef HW_S390_VIRTIO_HCALL_H +#define HW_S390_VIRTIO_HCALL_H =20 #include "standard-headers/asm-s390/kvm_virtio.h" #include "standard-headers/asm-s390/virtio-ccw.h" =20 typedef int (*s390_virtio_fn)(const uint64_t *args); void s390_register_virtio_hypercall(uint64_t code, s390_virtio_fn fn); -#endif +#endif /* HW_S390_VIRTIO_HCALL_H */ --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150481536809260.76989130988318; Thu, 7 Sep 2017 13:16:08 -0700 (PDT) Received: from localhost ([::1]:42107 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Db-0005Tf-4S for importer@patchew.org; Thu, 07 Sep 2017 16:16:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3BZ-00044V-6M for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3BU-00028E-KU for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3BU-00027p-Dv for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:13:56 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 876A6356DB; Thu, 7 Sep 2017 20:13:55 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F18E17117; Thu, 7 Sep 2017 20:13:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 876A6356DB Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:19 +0200 Message-Id: <20170907201335.13956-6-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 07 Sep 2017 20:13:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 05/21] target/s390x: move typedef of S390CPU to its definition X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Let's move it to the place where struct S390CPU is defined. Suggested-by: Thomas Huth Tested-by: Thomas Huth Signed-off-by: David Hildenbrand --- target/s390x/cpu-qom.h | 2 -- target/s390x/cpu.h | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/target/s390x/cpu-qom.h b/target/s390x/cpu-qom.h index 4e936e7788..c8fbf8ae03 100644 --- a/target/s390x/cpu-qom.h +++ b/target/s390x/cpu-qom.h @@ -61,6 +61,4 @@ typedef struct S390CPUClass { void (*initial_cpu_reset)(CPUState *cpu); } S390CPUClass; =20 -typedef struct S390CPU S390CPU; - #endif diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 0bd97a5670..a7426ef6e2 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -187,7 +187,7 @@ static inline CPU_DoubleU *get_freg(CPUS390XState *cs, = int nr) * * An S/390 CPU. */ -struct S390CPU { +typedef struct S390CPU { /*< private >*/ CPUState parent_obj; /*< public >*/ @@ -198,7 +198,7 @@ struct S390CPU { /* needed for live migration */ void *irqstate; uint32_t irqstate_saved_size; -}; +} S390CPU; =20 static inline S390CPU *s390_env_get_cpu(CPUS390XState *env) { --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15048157507213.8598038007221476; Thu, 7 Sep 2017 13:22:30 -0700 (PDT) Received: from localhost ([::1]:42132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Jl-0002nT-Lx for importer@patchew.org; Thu, 07 Sep 2017 16:22:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Bb-00044b-Sh for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3BX-0002Ag-4Q for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38824) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3BW-0002AI-UH for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:13:59 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0BC46C049D7F; Thu, 7 Sep 2017 20:13:58 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD55417117; Thu, 7 Sep 2017 20:13:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0BC46C049D7F Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:20 +0200 Message-Id: <20170907201335.13956-7-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 07 Sep 2017 20:13:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 06/21] s390x: move s390_virtio_hypercall() to s390-virtio-hcall.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Implemented in hw/s390x/s390-virtio-hcall.c, so let's move it to the right header file. Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand --- hw/s390x/s390-virtio-hcall.h | 1 + target/s390x/cpu.h | 1 - target/s390x/kvm.c | 1 + target/s390x/misc_helper.c | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/s390x/s390-virtio-hcall.h b/hw/s390x/s390-virtio-hcall.h index 59fcba3a06..cbc270eef3 100644 --- a/hw/s390x/s390-virtio-hcall.h +++ b/hw/s390x/s390-virtio-hcall.h @@ -17,4 +17,5 @@ =20 typedef int (*s390_virtio_fn)(const uint64_t *args); void s390_register_virtio_hypercall(uint64_t code, s390_virtio_fn fn); +int s390_virtio_hypercall(CPUS390XState *env); #endif /* HW_S390_VIRTIO_HCALL_H */ diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index a7426ef6e2..2343f2f1f7 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -723,6 +723,5 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uin= t8_t ar, void *hostbuf, S390CPU *s390_cpu_addr2state(uint16_t cpu_addr); extern void subsystem_reset(void); int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code); -int s390_virtio_hypercall(CPUS390XState *env); =20 #endif diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index d07763ff2c..ed59896423 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -48,6 +48,7 @@ #include "hw/s390x/ebcdic.h" #include "exec/memattrs.h" #include "hw/s390x/s390-virtio-ccw.h" +#include "hw/s390x/s390-virtio-hcall.h" =20 #ifndef DEBUG_KVM #define DEBUG_KVM 0 diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 50cc046ca2..b142db71c6 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -34,6 +34,7 @@ #include "sysemu/cpus.h" #include "sysemu/sysemu.h" #include "hw/s390x/ebcdic.h" +#include "hw/s390x/s390-virtio-hcall.h" #endif =20 /* #define DEBUG_HELPER */ --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504815685843188.16069224883358; Thu, 7 Sep 2017 13:21:25 -0700 (PDT) Received: from localhost ([::1]:42128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Ii-0001mO-1U for importer@patchew.org; Thu, 07 Sep 2017 16:21:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Bg-000488-UH for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3Bc-0002Da-53 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43004) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3Bb-0002D7-Vk for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:04 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 028555F7A9; Thu, 7 Sep 2017 20:14:03 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6915568D48; Thu, 7 Sep 2017 20:13:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 028555F7A9 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:21 +0200 Message-Id: <20170907201335.13956-8-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 07 Sep 2017 20:14:03 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 07/21] s390x: move subsystem_reset() to s390-virtio-ccw.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Implemented in s390-virtio-ccw.c, so move it to the right header. We can also drop the extern. Fix up one include. Signed-off-by: David Hildenbrand Acked-by: Christian Borntraeger Reviewed-by: Thomas Huth --- include/hw/s390x/s390-virtio-ccw.h | 2 ++ target/s390x/cpu.h | 1 - target/s390x/diag.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-vir= tio-ccw.h index 41a9d2862b..a9a90c2022 100644 --- a/include/hw/s390x/s390-virtio-ccw.h +++ b/include/hw/s390x/s390-virtio-ccw.h @@ -56,4 +56,6 @@ bool gs_allowed(void); */ bool css_migration_enabled(void); =20 +void subsystem_reset(void); + #endif diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 2343f2f1f7..3aa2e46aac 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -721,7 +721,6 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uin= t8_t ar, void *hostbuf, =20 /* outside of target/s390x/ */ S390CPU *s390_cpu_addr2state(uint16_t cpu_addr); -extern void subsystem_reset(void); int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code); =20 #endif diff --git a/target/s390x/diag.c b/target/s390x/diag.c index e6b5e6de37..82a623948d 100644 --- a/target/s390x/diag.c +++ b/target/s390x/diag.c @@ -20,6 +20,7 @@ #include "hw/watchdog/wdt_diag288.h" #include "sysemu/cpus.h" #include "hw/s390x/ipl.h" +#include "hw/s390x/s390-virtio-ccw.h" =20 static int modified_clear_reset(S390CPU *cpu) { --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504815905046612.3089421214856; Thu, 7 Sep 2017 13:25:05 -0700 (PDT) Received: from localhost ([::1]:42143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3MG-0005FK-3h for importer@patchew.org; Thu, 07 Sep 2017 16:25:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Bj-0004Ap-Hf for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3Be-0002En-TC for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42454) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3Be-0002EQ-Mq for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:06 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C72BF81DFA; Thu, 7 Sep 2017 20:14:05 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 566CE5C88F; Thu, 7 Sep 2017 20:14:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C72BF81DFA Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:22 +0200 Message-Id: <20170907201335.13956-9-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 07 Sep 2017 20:14:05 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 08/21] s390x: move sclp_service_call() to sclp.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Implemented in sclp.c, so let's move it to the right include file. Fix up one include. Do a forward declaration of CPUS390XState to fix the two sclp consoles complaining. Signed-off-by: David Hildenbrand --- include/hw/s390x/sclp.h | 2 ++ target/s390x/cpu.h | 1 - target/s390x/misc_helper.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h index a72d096081..4b86a8a293 100644 --- a/include/hw/s390x/sclp.h +++ b/include/hw/s390x/sclp.h @@ -242,5 +242,7 @@ sclpMemoryHotplugDev *init_sclp_memory_hotplug_dev(void= ); sclpMemoryHotplugDev *get_sclp_memory_hotplug_dev(void); void sclp_service_interrupt(uint32_t sccb); void raise_irq_cpu_hotplug(void); +typedef struct CPUS390XState CPUS390XState; +int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code); =20 #endif diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 3aa2e46aac..032d1de2e8 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -721,6 +721,5 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uin= t8_t ar, void *hostbuf, =20 /* outside of target/s390x/ */ S390CPU *s390_cpu_addr2state(uint16_t cpu_addr); -int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code); =20 #endif diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index b142db71c6..8b07535b02 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -35,6 +35,7 @@ #include "sysemu/sysemu.h" #include "hw/s390x/ebcdic.h" #include "hw/s390x/s390-virtio-hcall.h" +#include "hw/s390x/sclp.h" #endif =20 /* #define DEBUG_HELPER */ --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504815535008248.7525305376795; Thu, 7 Sep 2017 13:18:55 -0700 (PDT) Received: from localhost ([::1]:42115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3GH-00084G-Ug for importer@patchew.org; Thu, 07 Sep 2017 16:18:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Bm-0004Dw-Qe for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3Bi-0002GD-6L for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60896) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3Bi-0002FX-0Z for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:10 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A8F0F83F45; Thu, 7 Sep 2017 20:14:08 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C7485C88F; Thu, 7 Sep 2017 20:14:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A8F0F83F45 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:23 +0200 Message-Id: <20170907201335.13956-10-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 07 Sep 2017 20:14:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 09/21] target/s390x: use trigger_pgm_exception() in s390_cpu_handle_mmu_fault() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This looks cleaner. linux-user will not use the ilen field, so setting it doesn't do any harm. Reviewed-by: Thomas Huth Signed-off-by: David Hildenbrand --- target/s390x/excp_helper.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 361f970db3..14d3160e92 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -59,8 +59,7 @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr address, { S390CPU *cpu =3D S390_CPU(cs); =20 - cs->exception_index =3D EXCP_PGM; - cpu->env.int_pgm_code =3D PGM_ADDRESSING; + trigger_pgm_exception(&cpu->env, PGM_ADDRESSING, ILEN_AUTO); /* On real machines this value is dropped into LowMem. Since this is userland, simply put this someplace that cpu_loop can find it. = */ cpu->env.__excp_addr =3D address; --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504815697599465.6500474904433; Thu, 7 Sep 2017 13:21:37 -0700 (PDT) Received: from localhost ([::1]:42130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Iu-0001zK-Hz for importer@patchew.org; Thu, 07 Sep 2017 16:21:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Bo-0004G4-OZ for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3Bk-0002Gu-5O for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59438) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3Bj-0002GY-Vc for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:12 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 19D96356C0; Thu, 7 Sep 2017 20:14:11 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04B8758842; Thu, 7 Sep 2017 20:14:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 19D96356C0 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:24 +0200 Message-Id: <20170907201335.13956-11-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 07 Sep 2017 20:14:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 10/21] target/s390x: use program_interrupt() in per_check_exception() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Clean it up by reusing program_interrupt(). Add a concern regarding ilen. Signed-off-by: David Hildenbrand --- target/s390x/misc_helper.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 8b07535b02..f3624d75eb 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -447,14 +447,17 @@ void HELPER(chsc)(CPUS390XState *env, uint64_t inst) #ifndef CONFIG_USER_ONLY void HELPER(per_check_exception)(CPUS390XState *env) { - CPUState *cs =3D CPU(s390_env_get_cpu(env)); + uint32_t ilen; =20 if (env->per_perc_atmid) { - env->int_pgm_code =3D PGM_PER; - env->int_pgm_ilen =3D get_ilen(cpu_ldub_code(env, env->per_address= )); - - cs->exception_index =3D EXCP_PGM; - cpu_loop_exit(cs); + /* + * FIXME: ILEN_AUTO is most probably the right thing to use. ilen + * always has to match the instruction referenced in the PSW. E.g. + * if a PER interrupt is triggered via EXECUTE, we have to use ilen + * of EXECUTE, while per_address contains the target of EXECUTE. + */ + ilen =3D get_ilen(cpu_ldub_code(env, env->per_address)); + program_interrupt(env, PGM_PER, ilen); } } =20 --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150481553803344.08199337903227; Thu, 7 Sep 2017 13:18:58 -0700 (PDT) Received: from localhost ([::1]:42116 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3GK-00087G-UX for importer@patchew.org; Thu, 07 Sep 2017 16:18:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Br-0004Ie-B8 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3Bm-0002Hw-P5 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52732) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3Bm-0002HU-Il for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:14 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 976E5883CD; Thu, 7 Sep 2017 20:14:13 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DCDE5C88F; Thu, 7 Sep 2017 20:14:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 976E5883CD Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:25 +0200 Message-Id: <20170907201335.13956-12-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 07 Sep 2017 20:14:13 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 11/21] s390x: allow only 1 CPU with TCG X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Specifying more than 1 CPU (e.g. -smp 5) leads to SIGP errors (the guest tries to bring these CPUs up but fails), because we don't support multiple CPUs on s390x under TCG. Let's bail out if more than 1 is specified, so we don't raise people's hope. Make it a define, so we can easily bump it up later. Tested-by: Matthew Rosato Signed-off-by: David Hildenbrand --- hw/s390x/s390-virtio-ccw.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index f67b4b5d58..f1198b2745 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -23,6 +23,7 @@ #include "hw/s390x/css.h" #include "virtio-ccw.h" #include "qemu/config-file.h" +#include "qemu/error-report.h" #include "s390-pci-bus.h" #include "hw/s390x/storage-keys.h" #include "hw/s390x/storage-attributes.h" @@ -47,6 +48,8 @@ S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) return cpu_states[cpu_addr]; } =20 +/* #define S390_TCG_SMP_SUPPORT */ + static void s390_init_cpus(MachineState *machine) { int i; @@ -55,6 +58,13 @@ static void s390_init_cpus(MachineState *machine) if (machine->cpu_model =3D=3D NULL) { machine->cpu_model =3D s390_default_cpu_model_name(); } +#ifndef S390_TCG_SMP_SUPPORT + if (tcg_enabled() && max_cpus > 1) { + error_report("Number of SMP CPUs requested (%d) exceeds max CPUs " + "supported by TCG (1) on s390x", max_cpus); + exit(1); + } +#endif =20 cpu_states =3D g_new0(S390CPU *, max_cpus); =20 --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504816046404454.279183043868; Thu, 7 Sep 2017 13:27:26 -0700 (PDT) Received: from localhost ([::1]:42158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3OX-0007W6-5o for importer@patchew.org; Thu, 07 Sep 2017 16:27:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Bu-0004LO-4O for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3Bp-0002JQ-Ao for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37298) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3Bp-0002J1-4d for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:17 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A9004E4F3; Thu, 7 Sep 2017 20:14:16 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED72B17117; Thu, 7 Sep 2017 20:14:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3A9004E4F3 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:26 +0200 Message-Id: <20170907201335.13956-13-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 07 Sep 2017 20:14:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 12/21] target/s390x: set cpu->id for linux user when realizing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" scc->next_cpu_id is updated when realizing. Setting it just before that point looks cleaner. Reviewed-by: Matthew Rosato Signed-off-by: David Hildenbrand --- target/s390x/cpu.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 74b3e4fd0d..5f9315fb16 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -194,7 +194,11 @@ static void s390_cpu_realizefn(DeviceState *dev, Error= **errp) ", max allowed: %d", cpu->id, max_cpus - 1); goto out; } +#else + /* implicitly set for linux-user only */ + cpu->id =3D scc->next_cpu_id; #endif + if (cpu_exists(cpu->id)) { error_setg(&err, "Unable to add CPU: %" PRIi64 ", it already exists", cpu->id); @@ -306,13 +310,6 @@ static void s390_cpu_initfn(Object *obj) inited =3D true; s390x_translate_init(); } - -#if defined(CONFIG_USER_ONLY) - { - S390CPUClass *scc =3D S390_CPU_GET_CLASS(obj); - cpu->id =3D scc->next_cpu_id; - } -#endif } =20 static void s390_cpu_finalize(Object *obj) --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504815856351146.41772705707683; Thu, 7 Sep 2017 13:24:16 -0700 (PDT) Received: from localhost ([::1]:42141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3LT-0004W0-9H for importer@patchew.org; Thu, 07 Sep 2017 16:24:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3C0-0004PK-53 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3Bu-0002M8-Kr for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52986) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3Bu-0002LY-Co for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:22 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 845BF883C5; Thu, 7 Sep 2017 20:14:21 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D96568D7F; Thu, 7 Sep 2017 20:14:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 845BF883C5 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:27 +0200 Message-Id: <20170907201335.13956-14-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 07 Sep 2017 20:14:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 13/21] target/s390x: use "core-id" for cpu number/address/id handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Some time ago we discussed that using "id" as property name is not the right thing to do, as it is a reserved property for other devices and will not work with device_add. Switch to the term "core-id" instead, and use it as an equivalent to "CPU address" mentioned in the PoP. There is no such thing as cpu number, so rename env.cpu_num to env.core_id. We use "core-id" as this is the common term to use for device_add later on (x86 and ppc). We can get rid of cpu->id now. Keep cpu_index and env->core_id in sync. cpu_index was already implicitly used by e.g. cpu_exists(), so keeping both in sync seems to be the right thing to do. cpu_index will now no longer automatically get set via cpu_exec_realizefn(). For now, we were lucky that both implicitly stayed in sync. Our new cpu property "core-id" can be a static property. Range checks can be avoided by using the correct type and the "setting after realized" check is done implicitly. device_add will later need the reserved "id" property. Hotplugging a CPU on s390x will then be: "device_add host-s390-cpu,id=3Dcpu2,core-id=3D2". Reviewed-by: Matthew Rosato Signed-off-by: David Hildenbrand --- hw/s390x/s390-virtio-ccw.c | 2 +- target/s390x/cpu.c | 71 +++++++++++++-----------------------------= ---- target/s390x/cpu.h | 5 ++-- target/s390x/cpu_models.c | 2 +- target/s390x/excp_helper.c | 2 +- target/s390x/helper.c | 4 +-- target/s390x/misc_helper.c | 4 +-- target/s390x/translate.c | 5 +--- 8 files changed, 29 insertions(+), 66 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index f1198b2745..2086eb6ca6 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -314,7 +314,7 @@ static void s390_cpu_plug(HotplugHandler *hotplug_dev, S390CPU *cpu =3D S390_CPU(dev); CPUState *cs =3D CPU(dev); =20 - name =3D g_strdup_printf("cpu[%i]", cpu->env.cpu_num); + name =3D g_strdup_printf("cpu[%i]", cpu->env.core_id); object_property_set_link(OBJECT(hotplug_dev), OBJECT(cs), name, errp); g_free(name); diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 5f9315fb16..a2570bbc6b 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -36,6 +36,7 @@ #include "trace.h" #include "qapi/visitor.h" #include "exec/exec-all.h" +#include "hw/qdev-properties.h" #ifndef CONFIG_USER_ONLY #include "hw/hw.h" #include "sysemu/arch_init.h" @@ -189,28 +190,30 @@ static void s390_cpu_realizefn(DeviceState *dev, Erro= r **errp) } =20 #if !defined(CONFIG_USER_ONLY) - if (cpu->id >=3D max_cpus) { - error_setg(&err, "Unable to add CPU: %" PRIi64 - ", max allowed: %d", cpu->id, max_cpus - 1); + if (cpu->env.core_id >=3D max_cpus) { + error_setg(&err, "Unable to add CPU: %" PRIu32 ", max allowed: %d", + cpu->env.core_id, max_cpus - 1); goto out; } #else /* implicitly set for linux-user only */ - cpu->id =3D scc->next_cpu_id; + cpu->env.core_id =3D scc->next_cpu_id; #endif =20 - if (cpu_exists(cpu->id)) { - error_setg(&err, "Unable to add CPU: %" PRIi64 - ", it already exists", cpu->id); + if (cpu_exists(cpu->env.core_id)) { + error_setg(&err, "Unable to add CPU: %" PRIu32 ", it already exist= s", + cpu->env.core_id); goto out; } - if (cpu->id !=3D scc->next_cpu_id) { - error_setg(&err, "Unable to add CPU: %" PRIi64 - ", The next available id is %" PRIi64, cpu->id, + if (cpu->env.core_id !=3D scc->next_cpu_id) { + error_setg(&err, "Unable to add CPU: %" PRIu32 + ", the next available nr is %" PRIi64, cpu->env.core_id, scc->next_cpu_id); goto out; } =20 + /* sync cs->cpu_index and env->core_id. The latter is needed for TCG. = */ + cs->cpu_index =3D env->core_id; cpu_exec_realizefn(cs, &err); if (err !=3D NULL) { goto out; @@ -220,7 +223,6 @@ static void s390_cpu_realizefn(DeviceState *dev, Error = **errp) #if !defined(CONFIG_USER_ONLY) qemu_register_reset(s390_cpu_machine_reset_cb, cpu); #endif - env->cpu_num =3D cpu->id; s390_cpu_gdb_init(cs); qemu_init_vcpu(cs); #if !defined(CONFIG_USER_ONLY) @@ -241,45 +243,6 @@ out: error_propagate(errp, err); } =20 -static void s390x_cpu_get_id(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - S390CPU *cpu =3D S390_CPU(obj); - int64_t value =3D cpu->id; - - visit_type_int(v, name, &value, errp); -} - -static void s390x_cpu_set_id(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - S390CPU *cpu =3D S390_CPU(obj); - DeviceState *dev =3D DEVICE(obj); - const int64_t min =3D 0; - const int64_t max =3D UINT32_MAX; - Error *err =3D NULL; - int64_t value; - - if (dev->realized) { - error_setg(errp, "Attempt to set property '%s' on '%s' after " - "it was realized", name, object_get_typename(obj)); - return; - } - - visit_type_int(v, name, &value, &err); - if (err) { - error_propagate(errp, err); - return; - } - if (value < min || value > max) { - error_setg(errp, "Property %s.%s doesn't take value %" PRId64 - " (minimum: %" PRId64 ", maximum: %" PRId64 ")" , - object_get_typename(obj), name, value, min, max); - return; - } - cpu->id =3D value; -} - static void s390_cpu_initfn(Object *obj) { CPUState *cs =3D CPU(obj); @@ -293,8 +256,6 @@ static void s390_cpu_initfn(Object *obj) cs->env_ptr =3D env; cs->halted =3D 1; cs->exception_index =3D EXCP_HLT; - object_property_add(OBJECT(cpu), "id", "int64_t", s390x_cpu_get_id, - s390x_cpu_set_id, NULL, NULL, NULL); s390_cpu_model_register_props(obj); #if !defined(CONFIG_USER_ONLY) qemu_get_timedate(&tm, 0); @@ -491,6 +452,11 @@ static gchar *s390_gdb_arch_name(CPUState *cs) return g_strdup("s390:64-bit"); } =20 +static Property s390x_cpu_properties[] =3D { + DEFINE_PROP_UINT32("core-id", S390CPU, env.core_id, 0), + DEFINE_PROP_END_OF_LIST() +}; + static void s390_cpu_class_init(ObjectClass *oc, void *data) { S390CPUClass *scc =3D S390_CPU_CLASS(oc); @@ -500,6 +466,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *= data) scc->next_cpu_id =3D 0; scc->parent_realize =3D dc->realize; dc->realize =3D s390_cpu_realizefn; + dc->props =3D s390x_cpu_properties; =20 scc->parent_reset =3D cc->reset; #if !defined(CONFIG_USER_ONLY) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 032d1de2e8..ad88cbf368 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -149,7 +149,7 @@ typedef struct CPUS390XState { =20 CPU_COMMON =20 - uint32_t cpu_num; + uint32_t core_id; /* PoP "CPU address", same as cpu_index */ uint64_t cpuid; =20 uint64_t tod_offset; @@ -193,7 +193,6 @@ typedef struct S390CPU { /*< public >*/ =20 CPUS390XState env; - int64_t id; S390CPUModel *model; /* needed for live migration */ void *irqstate; @@ -689,7 +688,7 @@ const char *s390_default_cpu_model_name(void); =20 /* helper.c */ #define cpu_init(cpu_model) cpu_generic_init(TYPE_S390_CPU, cpu_model) -S390CPU *s390x_new_cpu(const char *cpu_model, int64_t id, Error **errp); +S390CPU *s390x_new_cpu(const char *cpu_model, uint32_t core_id, Error **er= rp); /* you can call this signal handler from your SIGBUS and SIGSEGV signal handlers to inform the virtual CPU of exceptions. non zero is returned if the signal was handled by the virtual CPU. */ diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 18cbf91d9c..8e20e7637b 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -915,7 +915,7 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) cpu->env.cpuid =3D s390_cpuid_from_cpu_model(cpu->model); if (tcg_enabled()) { /* basic mode, write the cpu address into the first 4 bit of the I= D */ - cpu->env.cpuid =3D deposit64(cpu->env.cpuid, 54, 4, cpu->env.cpu_n= um); + cpu->env.cpuid =3D deposit64(cpu->env.cpuid, 54, 4, cpu->env.core_= id); } } =20 diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 14d3160e92..470cf8f5bc 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -250,7 +250,7 @@ static void do_ext_interrupt(CPUS390XState *env) lowcore->ext_params2 =3D cpu_to_be64(q->param64); lowcore->external_old_psw.mask =3D cpu_to_be64(get_psw_mask(env)); lowcore->external_old_psw.addr =3D cpu_to_be64(env->psw.addr); - lowcore->cpu_addr =3D cpu_to_be16(env->cpu_num | VIRTIO_SUBCODE_64); + lowcore->cpu_addr =3D cpu_to_be16(env->core_id | VIRTIO_SUBCODE_64); mask =3D be64_to_cpu(lowcore->external_new_psw.mask); addr =3D be64_to_cpu(lowcore->external_new_psw.addr); =20 diff --git a/target/s390x/helper.c b/target/s390x/helper.c index ba29504476..dfb24ef5b2 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -104,7 +104,7 @@ S390CPU *cpu_s390x_create(const char *cpu_model, Error = **errp) return S390_CPU(CPU(object_new(typename))); } =20 -S390CPU *s390x_new_cpu(const char *cpu_model, int64_t id, Error **errp) +S390CPU *s390x_new_cpu(const char *cpu_model, uint32_t core_id, Error **er= rp) { S390CPU *cpu; Error *err =3D NULL; @@ -114,7 +114,7 @@ S390CPU *s390x_new_cpu(const char *cpu_model, int64_t i= d, Error **errp) goto out; } =20 - object_property_set_int(OBJECT(cpu), id, "id", &err); + object_property_set_int(OBJECT(cpu), core_id, "core-id", &err); if (err !=3D NULL) { goto out; } diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index f3624d75eb..293fc8428a 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -232,7 +232,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, /* XXX make different for different CPUs? */ ebcdic_put(sysib.sequence, "QEMUQEMUQEMUQEMU", 16); ebcdic_put(sysib.plant, "QEMU", 4); - stw_p(&sysib.cpu_addr, env->cpu_num); + stw_p(&sysib.cpu_addr, env->core_id); cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); } else if ((sel1 =3D=3D 2) && (sel2 =3D=3D 2)) { /* Basic Machine CPUs */ @@ -260,7 +260,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, /* XXX make different for different CPUs? */ ebcdic_put(sysib.sequence, "QEMUQEMUQEMUQEMU", 16); ebcdic_put(sysib.plant, "QEMU", 4); - stw_p(&sysib.cpu_addr, env->cpu_num); + stw_p(&sysib.cpu_addr, env->core_id); stw_p(&sysib.cpu_id, 0); cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); } else if ((sel1 =3D=3D 2) && (sel2 =3D=3D 2)) { diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 909b12818d..5abd34fb34 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3823,10 +3823,7 @@ static ExitStatus op_ssm(DisasContext *s, DisasOps *= o) static ExitStatus op_stap(DisasContext *s, DisasOps *o) { check_privileged(s); - /* ??? Surely cpu address !=3D cpu number. In any case the previous - version of this stored more than the required half-word, so it - is unlikely this has ever been tested. */ - tcg_gen_ld32u_i64(o->out, cpu_env, offsetof(CPUS390XState, cpu_num)); + tcg_gen_ld32u_i64(o->out, cpu_env, offsetof(CPUS390XState, core_id)); return NO_EXIT; } =20 --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504815843700787.8394389409178; Thu, 7 Sep 2017 13:24:03 -0700 (PDT) Received: from localhost ([::1]:42139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3LG-0004JA-Hc for importer@patchew.org; Thu, 07 Sep 2017 16:24:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3C1-0004RB-VN for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3Bx-0002N9-5r for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36574) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3Bw-0002Ms-Vg for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:25 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0F0E18047E; Thu, 7 Sep 2017 20:14:24 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8A6168D48; Thu, 7 Sep 2017 20:14:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0F0E18047E Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:28 +0200 Message-Id: <20170907201335.13956-15-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 07 Sep 2017 20:14:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 14/21] target/s390x: rename next_cpu_id to next_core_id X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Adapt to the new term "core_id". While at it, fix the type and drop the initialization to 0 (which is superfluous). Reviewed-by: Matthew Rosato Signed-off-by: David Hildenbrand --- target/s390x/cpu-qom.h | 2 +- target/s390x/cpu.c | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/target/s390x/cpu-qom.h b/target/s390x/cpu-qom.h index c8fbf8ae03..21ea15e642 100644 --- a/target/s390x/cpu-qom.h +++ b/target/s390x/cpu-qom.h @@ -52,7 +52,7 @@ typedef struct S390CPUClass { bool is_migration_safe; const char *desc; =20 - int64_t next_cpu_id; + uint32_t next_core_id; =20 DeviceRealize parent_realize; void (*parent_reset)(CPUState *cpu); diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index a2570bbc6b..105ff13034 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -197,7 +197,7 @@ static void s390_cpu_realizefn(DeviceState *dev, Error = **errp) } #else /* implicitly set for linux-user only */ - cpu->env.core_id =3D scc->next_cpu_id; + cpu->env.core_id =3D scc->next_core_id; #endif =20 if (cpu_exists(cpu->env.core_id)) { @@ -205,10 +205,10 @@ static void s390_cpu_realizefn(DeviceState *dev, Erro= r **errp) cpu->env.core_id); goto out; } - if (cpu->env.core_id !=3D scc->next_cpu_id) { + if (cpu->env.core_id !=3D scc->next_core_id) { error_setg(&err, "Unable to add CPU: %" PRIu32 - ", the next available nr is %" PRIi64, cpu->env.core_id, - scc->next_cpu_id); + ", the next available id is %" PRIu32, cpu->env.core_id, + scc->next_core_id); goto out; } =20 @@ -218,7 +218,7 @@ static void s390_cpu_realizefn(DeviceState *dev, Error = **errp) if (err !=3D NULL) { goto out; } - scc->next_cpu_id++; + scc->next_core_id++; =20 #if !defined(CONFIG_USER_ONLY) qemu_register_reset(s390_cpu_machine_reset_cb, cpu); @@ -463,7 +463,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *= data) CPUClass *cc =3D CPU_CLASS(scc); DeviceClass *dc =3D DEVICE_CLASS(oc); =20 - scc->next_cpu_id =3D 0; scc->parent_realize =3D dc->realize; dc->realize =3D s390_cpu_realizefn; dc->props =3D s390x_cpu_properties; --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504815995109806.7210571720198; Thu, 7 Sep 2017 13:26:35 -0700 (PDT) Received: from localhost ([::1]:42155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Nh-0006dv-Ab for importer@patchew.org; Thu, 07 Sep 2017 16:26:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3C4-0004Th-Jg for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3Bz-0002OM-MT for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3686) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3Bz-0002Nz-E0 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:27 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C8E8356EA; Thu, 7 Sep 2017 20:14:26 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 653FE68D48; Thu, 7 Sep 2017 20:14:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8C8E8356EA Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:29 +0200 Message-Id: <20170907201335.13956-16-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 07 Sep 2017 20:14:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 15/21] s390x: print CPU definitions in sorted order X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Other architectures provide nicely sorted lists, let's do it similarly on s390x. While at it, clean up the code we have to touch either way. Signed-off-by: David Hildenbrand --- target/s390x/cpu_models.c | 56 ++++++++++++++++++++++++++++++++++---------= ---- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 8e20e7637b..c295e641e6 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -270,16 +270,11 @@ const S390CPUDef *s390_find_cpu_def(uint16_t type, ui= nt8_t gen, uint8_t ec_ga, return last_compatible; } =20 -struct S390PrintCpuListInfo { - FILE *f; - fprintf_function print; -}; - -static void print_cpu_model_list(ObjectClass *klass, void *opaque) +static void s390_print_cpu_model_list_entry(gpointer data, gpointer user_d= ata) { - struct S390PrintCpuListInfo *info =3D opaque; - S390CPUClass *scc =3D S390_CPU_CLASS(klass); - char *name =3D g_strdup(object_class_get_name(klass)); + CPUListState *s =3D user_data; + const S390CPUClass *scc =3D S390_CPU_CLASS((ObjectClass *)data); + char *name =3D g_strdup(object_class_get_name((ObjectClass *)data)); const char *details =3D ""; =20 if (scc->is_static) { @@ -290,21 +285,52 @@ static void print_cpu_model_list(ObjectClass *klass, = void *opaque) =20 /* strip off the -s390-cpu */ g_strrstr(name, "-" TYPE_S390_CPU)[0] =3D 0; - (*info->print)(info->f, "s390 %-15s %-35s %s\n", name, scc->desc, - details); + (*s->cpu_fprintf)(s->file, "s390 %-15s %-35s %s\n", name, scc->desc, + details); g_free(name); } =20 +static gint s390_cpu_list_compare(gconstpointer a, gconstpointer b) +{ + const S390CPUClass *cc_a =3D S390_CPU_CLASS((ObjectClass *)a); + const S390CPUClass *cc_b =3D S390_CPU_CLASS((ObjectClass *)b); + const char *name_a =3D object_class_get_name((ObjectClass *)a); + const char *name_b =3D object_class_get_name((ObjectClass *)b); + + /* move qemu and host to the top of the list, qemu first, host second = */ + if (name_a[0] =3D=3D 'q') { + return -1; + } else if (name_b[0] =3D=3D 'q') { + return 1; + } else if (name_a[0] =3D=3D 'h') { + return -1; + } else if (name_b[0] =3D=3D 'h') { + return 1; + } + + /* keep the same order we have in our table (sorted by release date) */ + if (cc_a->cpu_def !=3D cc_b->cpu_def) { + return cc_a->cpu_def - cc_b->cpu_def; + } + + /* exact same definition - list base model first */ + return cc_a->is_static ? -1 : 1; +} + void s390_cpu_list(FILE *f, fprintf_function print) { - struct S390PrintCpuListInfo info =3D { - .f =3D f, - .print =3D print, + CPUListState s =3D { + .file =3D f, + .cpu_fprintf =3D print, }; S390FeatGroup group; S390Feat feat; + GSList *list; =20 - object_class_foreach(print_cpu_model_list, TYPE_S390_CPU, false, &info= ); + list =3D object_class_get_list(TYPE_S390_CPU, false); + list =3D g_slist_sort(list, s390_cpu_list_compare); + g_slist_foreach(list, s390_print_cpu_model_list_entry, &s); + g_slist_free(list); =20 (*print)(f, "\nRecognized feature flags:\n"); for (feat =3D 0; feat < S390_FEAT_MAX; feat++) { --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504816107675829.3735983518146; Thu, 7 Sep 2017 13:28:27 -0700 (PDT) Received: from localhost ([::1]:42164 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3PW-0008Ro-JF for importer@patchew.org; Thu, 07 Sep 2017 16:28:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3C6-0004Vp-Pd for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3C2-0002PY-3B for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60172) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3C1-0002PB-TS for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:30 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0470C356F2; Thu, 7 Sep 2017 20:14:29 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1C2917117; Thu, 7 Sep 2017 20:14:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0470C356F2 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:30 +0200 Message-Id: <20170907201335.13956-17-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 07 Sep 2017 20:14:29 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 16/21] s390x: allow cpu hotplug via device_add X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" E.g. the following now works: device_add host-s390-cpu,id=3Dcpu1,core-id=3D1 The system will perform the same checks as when using cpu_add: - If the core_id is already in use - If the next sequential core_id isn't used - If core-id >=3D max_cpu is specified In addition, mixed CPU models are checked. E.g. if starting with -cpu host and trying to hotplug "qemu-s390-cpu": "Mixed CPU models are not supported on s390x." Reviewed-by: Matthew Rosato Signed-off-by: David Hildenbrand --- target/s390x/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 105ff13034..be20c2fb0f 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -466,6 +466,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *= data) scc->parent_realize =3D dc->realize; dc->realize =3D s390_cpu_realizefn; dc->props =3D s390x_cpu_properties; + dc->user_creatable =3D true; =20 scc->parent_reset =3D cc->reset; #if !defined(CONFIG_USER_ONLY) --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504816159767383.0858715514312; Thu, 7 Sep 2017 13:29:19 -0700 (PDT) Received: from localhost ([::1]:42166 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3QM-0000fT-Rn for importer@patchew.org; Thu, 07 Sep 2017 16:29:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3CB-0004aP-74 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3C6-0002RA-Hx for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56968) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3C6-0002Qp-Bo for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:34 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 746AAC0587D6; Thu, 7 Sep 2017 20:14:33 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B9F25C88F; Thu, 7 Sep 2017 20:14:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 746AAC0587D6 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:31 +0200 Message-Id: <20170907201335.13956-18-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 07 Sep 2017 20:14:33 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 17/21] s390x: CPU hot unplug via device_del cannot work for now X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" device_del on a CPU will currently do nothing. Let's emmit an error telling that this is will currently not work (there is no architecture support on s390x). Error message copied from ppc. (qemu) device_del cpu1 device_del cpu1 CPU hot unplug not supported on this machine Reviewed-by: Matthew Rosato Signed-off-by: David Hildenbrand --- hw/s390x/s390-virtio-ccw.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 2086eb6ca6..120f82e339 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -341,6 +341,15 @@ static void s390_machine_device_plug(HotplugHandler *h= otplug_dev, } } =20 +static void s390_machine_device_unplug_request(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **e= rrp) +{ + if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { + error_setg(errp, "CPU hot unplug not supported on this machine"); + return; + } +} + static HotplugHandler *s390_get_hotplug_handler(MachineState *machine, DeviceState *dev) { @@ -390,6 +399,7 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) mc->max_cpus =3D 248; mc->get_hotplug_handler =3D s390_get_hotplug_handler; hc->plug =3D s390_machine_device_plug; + hc->unplug_request =3D s390_machine_device_unplug_request; nc->nmi_monitor_handler =3D s390_nmi; } =20 --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504816239523425.3169181802614; Thu, 7 Sep 2017 13:30:39 -0700 (PDT) Received: from localhost ([::1]:42175 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Re-0001lI-9o for importer@patchew.org; Thu, 07 Sep 2017 16:30:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3CI-0004fx-AX for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3CD-0002UL-6F for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44232) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3CC-0002Tg-Tz for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:41 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0F9765F7B2; Thu, 7 Sep 2017 20:14:40 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id C870C5C88F; Thu, 7 Sep 2017 20:14:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0F9765F7B2 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:32 +0200 Message-Id: <20170907201335.13956-19-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 07 Sep 2017 20:14:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 18/21] s390x: implement query-hotpluggable-cpus X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" CPU hotplug is only possible on a per core basis on s390x. As we now have ms->possible_cpus, we can get rid of the global variable cpu_states. While rewriting s390_cpu_addr2state() completely to be based on possible_cpus, move it to cpu.c, as it is independent of the virtio-ccw machine. Signed-off-by: David Hildenbrand --- hw/s390x/s390-virtio-ccw.c | 87 +++++++++++++++++++++++++++++-------------= ---- qapi-schema.json | 16 +++++++++ target/s390x/cpu.c | 17 +++++++++ target/s390x/cpu.h | 5 +-- 4 files changed, 89 insertions(+), 36 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 120f82e339..0e10a4c73a 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -36,24 +36,12 @@ #include "qapi/qmp/qerror.h" #include "hw/nmi.h" =20 -static S390CPU **cpu_states; - -S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) -{ - if (cpu_addr >=3D max_cpus) { - return NULL; - } - - /* Fast lookup via CPU ID */ - return cpu_states[cpu_addr]; -} - /* #define S390_TCG_SMP_SUPPORT */ =20 static void s390_init_cpus(MachineState *machine) { + MachineClass *mc =3D MACHINE_GET_CLASS(machine); int i; - gchar *name; =20 if (machine->cpu_model =3D=3D NULL) { machine->cpu_model =3D s390_default_cpu_model_name(); @@ -66,17 +54,8 @@ static void s390_init_cpus(MachineState *machine) } #endif =20 - cpu_states =3D g_new0(S390CPU *, max_cpus); - - for (i =3D 0; i < max_cpus; i++) { - name =3D g_strdup_printf("cpu[%i]", i); - object_property_add_link(OBJECT(machine), name, TYPE_S390_CPU, - (Object **) &cpu_states[i], - object_property_allow_set_link, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); - g_free(name); - } + /* initialize possible_cpus */ + mc->possible_cpu_arch_ids(machine); =20 for (i =3D 0; i < smp_cpus; i++) { s390x_new_cpu(machine->cpu_model, i, &error_fatal); @@ -307,17 +286,14 @@ static void ccw_init(MachineState *machine) register_savevm_live(NULL, "todclock", 0, 1, &savevm_gtod, NULL); } =20 -static void s390_cpu_plug(HotplugHandler *hotplug_dev, - DeviceState *dev, Error **errp) +static void s390_cpu_plug(HotplugHandler *hotplug_dev, DeviceState *dev, + Error **errp) { - gchar *name; + MachineState *ms =3D MACHINE(hotplug_dev); S390CPU *cpu =3D S390_CPU(dev); - CPUState *cs =3D CPU(dev); =20 - name =3D g_strdup_printf("cpu[%i]", cpu->env.core_id); - object_property_set_link(OBJECT(hotplug_dev), OBJECT(cs), name, - errp); - g_free(name); + g_assert(!ms->possible_cpus->cpus[cpu->env.core_id].cpu); + ms->possible_cpus->cpus[cpu->env.core_id].cpu =3D OBJECT(dev); } =20 static void s390_machine_reset(void) @@ -350,6 +326,50 @@ static void s390_machine_device_unplug_request(Hotplug= Handler *hotplug_dev, } } =20 +static CPUArchId *s390_find_cpu_slot(MachineState *ms, uint32_t core_id, + int *idx) +{ + if (core_id >=3D ms->possible_cpus->len) { + return NULL; + } + /* core_id corresponds to the index */ + if (idx) { + *idx =3D core_id; + } + return &ms->possible_cpus->cpus[core_id]; +} + +static CpuInstanceProperties s390_cpu_index_to_props(MachineState *machine, + unsigned cpu_index) +{ + CPUArchId *slot =3D s390_find_cpu_slot(machine, cpu_index, NULL); + + assert(slot); + return slot->props; +} + +static const CPUArchIdList *s390_possible_cpu_arch_ids(MachineState *ms) +{ + int i; + + if (ms->possible_cpus) { + g_assert(ms->possible_cpus && ms->possible_cpus->len =3D=3D max_cp= us); + return ms->possible_cpus; + } + + ms->possible_cpus =3D g_malloc0(sizeof(CPUArchIdList) + + sizeof(CPUArchId) * max_cpus); + ms->possible_cpus->len =3D max_cpus; + for (i =3D 0; i < ms->possible_cpus->len; i++) { + ms->possible_cpus->cpus[i].vcpus_count =3D 1; + ms->possible_cpus->cpus[i].arch_id =3D i; + ms->possible_cpus->cpus[i].props.has_core_id =3D true; + ms->possible_cpus->cpus[i].props.core_id =3D i; + } + + return ms->possible_cpus; +} + static HotplugHandler *s390_get_hotplug_handler(MachineState *machine, DeviceState *dev) { @@ -397,7 +417,10 @@ static void ccw_machine_class_init(ObjectClass *oc, vo= id *data) mc->no_sdcard =3D 1; mc->use_sclp =3D 1; mc->max_cpus =3D 248; + mc->has_hotpluggable_cpus =3D true; mc->get_hotplug_handler =3D s390_get_hotplug_handler; + mc->cpu_index_to_instance_props =3D s390_cpu_index_to_props; + mc->possible_cpu_arch_ids =3D s390_possible_cpu_arch_ids; hc->plug =3D s390_machine_device_plug; hc->unplug_request =3D s390_machine_device_unplug_request; nc->nmi_monitor_handler =3D s390_nmi; diff --git a/qapi-schema.json b/qapi-schema.json index f3af2cb851..79e9f85404 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3121,6 +3121,22 @@ # } # ]} # +# For s390x-virtio-ccw machine type started with -smp 1,maxcpus=3D2 -cpu q= emu +# (Since: 2.11): +# +# -> { "execute": "query-hotpluggable-cpus" } +# <- {"return": [ +# { +# "type": "qemu-s390-cpu", "vcpus-count": 1, +# "props": { "core-id": 1 } +# }, +# { +# "qom-path": "/machine/unattached/device[0]", +# "type": "qemu-s390-cpu", "vcpus-count": 1, +# "props": { "core-id": 0 } +# } +# ]} +# ## { 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'] } =20 diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index be20c2fb0f..ad9dcdaaf1 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -38,6 +38,7 @@ #include "exec/exec-all.h" #include "hw/qdev-properties.h" #ifndef CONFIG_USER_ONLY +#include "hw/boards.h" #include "hw/hw.h" #include "sysemu/arch_init.h" #include "sysemu/sysemu.h" @@ -445,6 +446,22 @@ void s390_enable_css_support(S390CPU *cpu) kvm_s390_enable_css_support(cpu); } } + +S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) +{ + static MachineState *ms; + + if (!ms) { + ms =3D MACHINE(qdev_get_machine()); + g_assert(ms->possible_cpus); + } + + /* CPU address corresponds to the core_id and the index */ + if (cpu_addr >=3D ms->possible_cpus->len) { + return NULL; + } + return S390_CPU(ms->possible_cpus->cpus[cpu_addr].cpu); +} #endif =20 static gchar *s390_gdb_arch_name(CPUState *cs) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index ad88cbf368..5707268e43 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -670,6 +670,7 @@ int s390_cpu_restart(S390CPU *cpu); void s390_enable_css_support(S390CPU *cpu); int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id, int vq, bool assign); +S390CPU *s390_cpu_addr2state(uint16_t cpu_addr); #ifndef CONFIG_USER_ONLY unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu); #else @@ -717,8 +718,4 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uin= t8_t ar, void *hostbuf, #define s390_cpu_virt_mem_check_write(cpu, laddr, ar, len) \ s390_cpu_virt_mem_rw(cpu, laddr, ar, NULL, len, true) =20 - -/* outside of target/s390x/ */ -S390CPU *s390_cpu_addr2state(uint16_t cpu_addr); - #endif --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504816281119404.1603815142869; Thu, 7 Sep 2017 13:31:21 -0700 (PDT) Received: from localhost ([::1]:42181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3SK-0002Lk-1c for importer@patchew.org; Thu, 07 Sep 2017 16:31:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3CK-0004i4-Qc for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3CF-0002WY-Mm for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59888) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3CF-0002Vx-Dr for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:43 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C1E537EEF; Thu, 7 Sep 2017 20:14:42 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6461558842; Thu, 7 Sep 2017 20:14:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7C1E537EEF Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:33 +0200 Message-Id: <20170907201335.13956-20-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 07 Sep 2017 20:14:42 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 19/21] s390x: get rid of cpu_s390x_create() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now that there is only one user of cpu_s390x_create() left, make cpu creation look like on x86. - Perform the model/properties split and checks in s390_init_cpus() - Parse features only once without having to remember if already parsed - Pass only the typename to s390x_new_cpu() - Use the typename of an existing CPU for hotplug via cpu-add Signed-off-by: David Hildenbrand --- hw/s390x/s390-virtio-ccw.c | 29 +++++++++++++++++++++++++++-- target/s390x/cpu.h | 2 +- target/s390x/helper.c | 45 ++----------------------------------------= --- target/s390x/internal.h | 1 - 4 files changed, 30 insertions(+), 47 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 0e10a4c73a..10f6933fbd 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -41,6 +41,10 @@ static void s390_init_cpus(MachineState *machine) { MachineClass *mc =3D MACHINE_GET_CLASS(machine); + const char *typename; + gchar **model_pieces; + ObjectClass *oc; + CPUClass *cc; int i; =20 if (machine->cpu_model =3D=3D NULL) { @@ -57,8 +61,25 @@ static void s390_init_cpus(MachineState *machine) /* initialize possible_cpus */ mc->possible_cpu_arch_ids(machine); =20 + model_pieces =3D g_strsplit(machine->cpu_model, ",", 2); + if (!model_pieces[0]) { + error_report("Invalid/empty CPU model name"); + exit(1); + } + + oc =3D cpu_class_by_name(TYPE_S390_CPU, model_pieces[0]); + if (!oc) { + error_report("Unable to find CPU definition: %s", model_pieces[0]); + exit(1); + } + typename =3D object_class_get_name(oc); + cc =3D CPU_CLASS(oc); + /* after parsing, properties will be applied to all *typename* instanc= es */ + cc->parse_features(typename, model_pieces[1], &error_fatal); + g_strfreev(model_pieces); + for (i =3D 0; i < smp_cpus; i++) { - s390x_new_cpu(machine->cpu_model, i, &error_fatal); + s390x_new_cpu(typename, i, &error_fatal); } } =20 @@ -382,8 +403,12 @@ static HotplugHandler *s390_get_hotplug_handler(Machin= eState *machine, static void s390_hot_add_cpu(const int64_t id, Error **errp) { MachineState *machine =3D MACHINE(qdev_get_machine()); + ObjectClass *oc; + + g_assert(machine->possible_cpus->cpus[0].cpu); + oc =3D OBJECT_CLASS(CPU_GET_CLASS(machine->possible_cpus->cpus[0].cpu)= ); =20 - s390x_new_cpu(machine->cpu_model, id, errp); + s390x_new_cpu(object_class_get_name(oc), id, errp); } =20 static void s390_nmi(NMIState *n, int cpu_index, Error **errp) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 5707268e43..a197869b0e 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -689,7 +689,7 @@ const char *s390_default_cpu_model_name(void); =20 /* helper.c */ #define cpu_init(cpu_model) cpu_generic_init(TYPE_S390_CPU, cpu_model) -S390CPU *s390x_new_cpu(const char *cpu_model, uint32_t core_id, Error **er= rp); +S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id, Error **err= p); /* you can call this signal handler from your SIGBUS and SIGSEGV signal handlers to inform the virtual CPU of exceptions. non zero is returned if the signal was handled by the virtual CPU. */ diff --git a/target/s390x/helper.c b/target/s390x/helper.c index dfb24ef5b2..97adbcc86d 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -68,52 +68,11 @@ void s390x_cpu_timer(void *opaque) } #endif =20 -S390CPU *cpu_s390x_create(const char *cpu_model, Error **errp) +S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id, Error **err= p) { - static bool features_parsed; - char *name, *features; - const char *typename; - ObjectClass *oc; - CPUClass *cc; - - name =3D g_strdup(cpu_model); - features =3D strchr(name, ','); - if (features) { - features[0] =3D 0; - features++; - } - - oc =3D cpu_class_by_name(TYPE_S390_CPU, name); - if (!oc) { - error_setg(errp, "Unknown CPU definition \'%s\'", name); - g_free(name); - return NULL; - } - typename =3D object_class_get_name(oc); - - if (!features_parsed) { - features_parsed =3D true; - cc =3D CPU_CLASS(oc); - cc->parse_features(typename, features, errp); - } - g_free(name); - - if (*errp) { - return NULL; - } - return S390_CPU(CPU(object_new(typename))); -} - -S390CPU *s390x_new_cpu(const char *cpu_model, uint32_t core_id, Error **er= rp) -{ - S390CPU *cpu; + S390CPU *cpu =3D S390_CPU(object_new(typename)); Error *err =3D NULL; =20 - cpu =3D cpu_s390x_create(cpu_model, &err); - if (err !=3D NULL) { - goto out; - } - object_property_set_int(OBJECT(cpu), core_id, "core-id", &err); if (err !=3D NULL) { goto out; diff --git a/target/s390x/internal.h b/target/s390x/internal.h index b4d3583b24..bc8f83129a 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -337,7 +337,6 @@ uint64_t get_psw_mask(CPUS390XState *env); void s390_cpu_recompute_watchpoints(CPUState *cs); void s390x_tod_timer(void *opaque); void s390x_cpu_timer(void *opaque); -S390CPU *cpu_s390x_create(const char *cpu_model, Error **errp); void do_restart_interrupt(CPUS390XState *env); #ifndef CONFIG_USER_ONLY LowCore *cpu_map_lowcore(CPUS390XState *env); --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504816006776839.8890175074879; Thu, 7 Sep 2017 13:26:46 -0700 (PDT) Received: from localhost ([::1]:42156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3Ns-0006pO-Ny for importer@patchew.org; Thu, 07 Sep 2017 16:26:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3CN-0004kC-11 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3CI-0002Y6-6u for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53862) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3CH-0002Xm-Ue for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EB388883B4; Thu, 7 Sep 2017 20:14:44 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id D25BF68D48; Thu, 7 Sep 2017 20:14:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EB388883B4 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:34 +0200 Message-Id: <20170907201335.13956-21-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 07 Sep 2017 20:14:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 20/21] s390x: generate sclp cpu information from possible_cpus X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This is the first step to allow hot plugging of CPUs in a non-sequential order. If a cpu is available ("plugged") can directly be decided by looking at the cpu state pointer. This makes sure, that really only cpus attached to the machine are reported. Signed-off-by: David Hildenbrand --- hw/s390x/sclp.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index fd097262c7..30aefbfd15 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -34,16 +34,21 @@ static inline SCLPDevice *get_sclp_device(void) return sclp; } =20 -static void prepare_cpu_entries(SCLPDevice *sclp, CPUEntry *entry, int cou= nt) +static void prepare_cpu_entries(SCLPDevice *sclp, CPUEntry *entry, int *co= unt) { + MachineState *ms =3D MACHINE(qdev_get_machine()); uint8_t features[SCCB_CPU_FEATURE_LEN] =3D { 0 }; int i; =20 s390_get_feat_block(S390_FEAT_TYPE_SCLP_CPU, features); - for (i =3D 0; i < count; i++) { - entry[i].address =3D i; - entry[i].type =3D 0; - memcpy(entry[i].features, features, sizeof(entry[i].features)); + for (i =3D 0, *count =3D 0; i < ms->possible_cpus->len; i++) { + if (!ms->possible_cpus->cpus[i].cpu) { + continue; + } + entry[*count].address =3D ms->possible_cpus->cpus[i].arch_id; + entry[*count].type =3D 0; + memcpy(entry[*count].features, features, sizeof(features)); + (*count)++; } } =20 @@ -53,17 +58,13 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) ReadInfo *read_info =3D (ReadInfo *) sccb; MachineState *machine =3D MACHINE(qdev_get_machine()); sclpMemoryHotplugDev *mhd =3D get_sclp_memory_hotplug_dev(); - CPUState *cpu; - int cpu_count =3D 0; + int cpu_count; int rnsize, rnmax; int slots =3D MIN(machine->ram_slots, s390_get_memslot_count()); IplParameterBlock *ipib =3D s390_ipl_get_iplb(); =20 - CPU_FOREACH(cpu) { - cpu_count++; - } - /* CPU information */ + prepare_cpu_entries(sclp, read_info->entries, &cpu_count); read_info->entries_cpu =3D cpu_to_be16(cpu_count); read_info->offset_cpu =3D cpu_to_be16(offsetof(ReadInfo, entries)); read_info->highest_cpu =3D cpu_to_be16(max_cpus); @@ -76,8 +77,6 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) s390_get_feat_block(S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT, read_info->conf_char_ext); =20 - prepare_cpu_entries(sclp, read_info->entries, cpu_count); - read_info->facilities =3D cpu_to_be64(SCLP_HAS_CPU_INFO | SCLP_HAS_IOA_RECONFIG); =20 @@ -333,13 +332,9 @@ static void unassign_storage(SCLPDevice *sclp, SCCB *s= ccb) static void sclp_read_cpu_info(SCLPDevice *sclp, SCCB *sccb) { ReadCpuInfo *cpu_info =3D (ReadCpuInfo *) sccb; - CPUState *cpu; - int cpu_count =3D 0; - - CPU_FOREACH(cpu) { - cpu_count++; - } + int cpu_count; =20 + prepare_cpu_entries(sclp, cpu_info->entries, &cpu_count); cpu_info->nr_configured =3D cpu_to_be16(cpu_count); cpu_info->offset_configured =3D cpu_to_be16(offsetof(ReadCpuInfo, entr= ies)); cpu_info->nr_standby =3D cpu_to_be16(0); @@ -348,7 +343,6 @@ static void sclp_read_cpu_info(SCLPDevice *sclp, SCCB *= sccb) cpu_info->offset_standby =3D cpu_to_be16(cpu_info->offset_configured + cpu_info->nr_configured*sizeof(CPUEntry)); =20 - prepare_cpu_entries(sclp, cpu_info->entries, cpu_count); =20 sccb->h.response_code =3D cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION); } --=20 2.13.5 From nobody Sat Apr 27 14:20:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504816386978822.1999373094211; Thu, 7 Sep 2017 13:33:06 -0700 (PDT) Received: from localhost ([::1]:42186 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3U1-0003mb-Ss for importer@patchew.org; Thu, 07 Sep 2017 16:33:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq3CP-0004mQ-5j for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq3CK-0002Ze-F3 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59984) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq3CK-0002ZK-9U for qemu-devel@nongnu.org; Thu, 07 Sep 2017 16:14:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F88C37EEF; Thu, 7 Sep 2017 20:14:47 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BA7B17117; Thu, 7 Sep 2017 20:14:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5F88C37EEF Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=david@redhat.com From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 7 Sep 2017 22:13:35 +0200 Message-Id: <20170907201335.13956-22-david@redhat.com> In-Reply-To: <20170907201335.13956-1-david@redhat.com> References: <20170907201335.13956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 07 Sep 2017 20:14:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 21/21] s390x: allow CPU hotplug in random core-id order X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , thuth@redhat.com, Eduardo Habkost , david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" SCLP correctly indicates the core-id aka. CPU address for each available CPU. As the core-id corresponds to cpu_index, also a newly created kvm vcpu gets assigned this core-id as vcpu id. So SIGP in the kernel works correctly (it uses the vcpu id to lookup the correct CPU). So there should be nothing hindering us from hotplugging CPUs in random core-id order. This now makes sure that the output from "query-hotpluggable-cpus" is completely true. Until now, a specific order is implicit. Performance vice, hotplugging CPUs in non-sequential order might not be the best thing to do, as VCPU lookup inside KVM might be a little slower. But that doesn't hinder us from supporting it. next_core_id is now used by linux user only. Signed-off-by: David Hildenbrand --- target/s390x/cpu.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index ad9dcdaaf1..5701a41112 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -199,6 +199,7 @@ static void s390_cpu_realizefn(DeviceState *dev, Error = **errp) #else /* implicitly set for linux-user only */ cpu->env.core_id =3D scc->next_core_id; + scc->next_core_id++; #endif =20 if (cpu_exists(cpu->env.core_id)) { @@ -206,12 +207,6 @@ static void s390_cpu_realizefn(DeviceState *dev, Error= **errp) cpu->env.core_id); goto out; } - if (cpu->env.core_id !=3D scc->next_core_id) { - error_setg(&err, "Unable to add CPU: %" PRIu32 - ", the next available id is %" PRIu32, cpu->env.core_id, - scc->next_core_id); - goto out; - } =20 /* sync cs->cpu_index and env->core_id. The latter is needed for TCG. = */ cs->cpu_index =3D env->core_id; @@ -219,7 +214,6 @@ static void s390_cpu_realizefn(DeviceState *dev, Error = **errp) if (err !=3D NULL) { goto out; } - scc->next_core_id++; =20 #if !defined(CONFIG_USER_ONLY) qemu_register_reset(s390_cpu_machine_reset_cb, cpu); --=20 2.13.5