From nobody Tue Nov 4 08:15:52 2025 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 1504115029653507.05197630304974; Wed, 30 Aug 2017 10:43:49 -0700 (PDT) Received: from localhost ([::1]:51882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn71n-0006IH-OE for importer@patchew.org; Wed, 30 Aug 2017 13:43:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6RP-0005Pu-1D for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6RM-0002Fe-MK for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54290) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn6RM-0002FO-GI for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7BE3FC0587F5; Wed, 30 Aug 2017 17:06:07 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42BC29B520; Wed, 30 Aug 2017 17:06:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7BE3FC0587F5 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: Wed, 30 Aug 2017 19:05:51 +0200 Message-Id: <20170830170601.15855-2-david@redhat.com> In-Reply-To: <20170830170601.15855-1-david@redhat.com> References: <20170830170601.15855-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 30 Aug 2017 17:06:07 +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 v1 01/11] exec, dump: don't include exec/exec-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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com, Aurelien Jarno 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 two, namely exec.c and dump.c, include exec/exec-all.h via cpu.h only. as these files already include cpu.h, let's just drop the additional include. Signed-off-by: David Hildenbrand --- dump.c | 1 - exec.c | 1 - 2 files changed, 2 deletions(-) diff --git a/dump.c b/dump.c index d9090a24cc..c00094475c 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..8d8b6a0769 100644 --- a/exec.c +++ b/exec.c @@ -23,7 +23,6 @@ =20 #include "qemu/cutils.h" #include "cpu.h" -#include "exec/exec-all.h" #include "exec/target_page.h" #include "tcg.h" #include "hw/qdev-core.h" --=20 2.13.5 From nobody Tue Nov 4 08:15:52 2025 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 1504115361529467.1461265385201; Wed, 30 Aug 2017 10:49:21 -0700 (PDT) Received: from localhost ([::1]:51912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn778-00035O-RY for importer@patchew.org; Wed, 30 Aug 2017 13:49:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6RP-0005RP-Kq for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6RO-0002GS-W3 for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45998) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn6RO-0002GA-Pp for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:10 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C744B83F43; Wed, 30 Aug 2017 17:06:09 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB91F9B51A; Wed, 30 Aug 2017 17:06:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C744B83F43 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: Wed, 30 Aug 2017 19:05:52 +0200 Message-Id: <20170830170601.15855-3-david@redhat.com> In-Reply-To: <20170830170601.15855-1-david@redhat.com> References: <20170830170601.15855-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 30 Aug 2017 17:06:09 +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 v1 02/11] 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com, Aurelien Jarno 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. Signed-off-by: David Hildenbrand Acked-by: Cornelia Huck --- 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 25eefea7ab..6b4b838e8f 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -378,10 +378,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 Tue Nov 4 08:15:52 2025 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 1504115485658326.23238833363905; Wed, 30 Aug 2017 10:51:25 -0700 (PDT) Received: from localhost ([::1]:51923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn799-0005Ps-IN for importer@patchew.org; Wed, 30 Aug 2017 13:51:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6Rd-0005dC-Pr for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6RZ-0002Jm-PZ for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41654) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn6RZ-0002JT-Gx for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 839E8C047B64; Wed, 30 Aug 2017 17:06:20 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 292869B51A; Wed, 30 Aug 2017 17:06:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 839E8C047B64 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: Wed, 30 Aug 2017 19:05:53 +0200 Message-Id: <20170830170601.15855-4-david@redhat.com> In-Reply-To: <20170830170601.15855-1-david@redhat.com> References: <20170830170601.15855-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 30 Aug 2017 17:06:20 +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 v1 03/11] s390x: store cpu states inside machine state 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com, Aurelien Jarno 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 avoid global variables. While at it, move both functions using it, so we won't have to temporarily add includes (we'll be getting rid of s390-virtio.c soon). Signed-off-by: David Hildenbrand Reviewed-by: Thomas Huth --- hw/s390x/s390-virtio-ccw.c | 39 ++++++++++++++++++++++++++++++++++= ++++ hw/s390x/s390-virtio.c | 38 ----------------------------------= --- hw/s390x/s390-virtio.h | 1 - include/hw/s390x/s390-virtio-ccw.h | 3 +++ 4 files changed, 42 insertions(+), 39 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index dd504dd5ae..ffd56af834 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -32,6 +32,45 @@ #include "migration/register.h" #include "cpu_models.h" =20 +S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) +{ + S390CcwMachineState *ms =3D S390_CCW_MACHINE(qdev_get_machine()); + + if (cpu_addr >=3D max_cpus) { + return NULL; + } + + /* Fast lookup via CPU ID */ + return ms->cpus[cpu_addr]; +} + +static void s390_init_cpus(MachineState *machine) +{ + S390CcwMachineState *ms =3D S390_CCW_MACHINE(machine); + int i; + gchar *name; + + if (machine->cpu_model =3D=3D NULL) { + machine->cpu_model =3D s390_default_cpu_model_name(); + } + + ms->cpus =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 **) &ms->cpus[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); + } +} + static const char *const reset_dev_types[] =3D { TYPE_VIRTUAL_CSS_BRIDGE, "s390-sclp-event-facility", diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c index da3f49e80e..464b5c71f8 100644 --- a/hw/s390x/s390-virtio.c +++ b/hw/s390x/s390-virtio.c @@ -48,18 +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]; -} - void s390_init_ipl_dev(const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, @@ -86,32 +74,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..b6660e3ae9 100644 --- a/hw/s390x/s390-virtio.h +++ b/hw/s390x/s390-virtio.h @@ -19,7 +19,6 @@ typedef int (*s390_virtio_fn)(const uint64_t *args); void s390_register_virtio_hypercall(uint64_t code, s390_virtio_fn fn); =20 -void s390_init_cpus(MachineState *machine); void s390_init_ipl_dev(const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-vir= tio-ccw.h index 41a9d2862b..4bef28ec39 100644 --- a/include/hw/s390x/s390-virtio-ccw.h +++ b/include/hw/s390x/s390-virtio-ccw.h @@ -21,11 +21,14 @@ #define S390_MACHINE_CLASS(klass) \ OBJECT_CLASS_CHECK(S390CcwMachineClass, (klass), TYPE_S390_CCW_MACHINE) =20 +struct S390CPU; + typedef struct S390CcwMachineState { /*< private >*/ MachineState parent_obj; =20 /*< public >*/ + S390CPU **cpus; bool aes_key_wrap; bool dea_key_wrap; uint8_t loadparm[8]; --=20 2.13.5 From nobody Tue Nov 4 08:15:52 2025 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 1504115267483963.9625550734193; Wed, 30 Aug 2017 10:47:47 -0700 (PDT) Received: from localhost ([::1]:51907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn75d-0001zn-Bn for importer@patchew.org; Wed, 30 Aug 2017 13:47:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6Rg-0005fj-D7 for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6Re-0002M2-KD for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14818) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn6Re-0002LQ-AK for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:26 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 362BF883AC; Wed, 30 Aug 2017 17:06:25 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC2659B518; Wed, 30 Aug 2017 17:06:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 362BF883AC 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: Wed, 30 Aug 2017 19:05:54 +0200 Message-Id: <20170830170601.15855-5-david@redhat.com> In-Reply-To: <20170830170601.15855-1-david@redhat.com> References: <20170830170601.15855-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 30 Aug 2017 17:06:25 +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 v1 04/11] 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com, Aurelien Jarno 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. Cornelia Huck Signed-off-by: David Hildenbrand Acked-by: Christian Borntraeger Reviewed-by: Thomas Huth --- hw/s390x/Makefile.objs | 1 - hw/s390x/s390-virtio-ccw.c | 120 ++++++++++++++++++++++++++++++++- hw/s390x/s390-virtio.c | 163 -----------------------------------------= ---- hw/s390x/s390-virtio.h | 14 ---- 4 files changed, 119 insertions(+), 179 deletions(-) delete mode 100644 hw/s390x/s390-virtio.c 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 ffd56af834..41a9e976dc 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,8 @@ #include "hw/s390x/css-bridge.h" #include "migration/register.h" #include "cpu_models.h" +#include "qapi/qmp/qerror.h" +#include "hw/nmi.h" =20 S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) { @@ -133,7 +136,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); @@ -148,11 +151,104 @@ 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; @@ -216,6 +312,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) { @@ -240,6 +349,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 deleted file mode 100644 index 464b5c71f8..0000000000 --- a/hw/s390x/s390-virtio.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * QEMU S390 virtio target - * - * Copyright (c) 2009 Alexander Graf - * Copyright IBM Corp 2012 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * Contributions after 2012-10-29 are licensed under the terms of the - * GNU GPL, version 2 or (at your option) any later version. - * - * You should have received a copy of the GNU (Lesser) General Public - * License along with this library; if not, see . - */ - -#include "qemu/osdep.h" -#include "qapi/error.h" -#include "hw/hw.h" -#include "qapi/qmp/qerror.h" -#include "qemu/error-report.h" -#include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" -#include "sysemu/sysemu.h" -#include "net/net.h" -#include "hw/boards.h" -#include "hw/loader.h" -#include "hw/virtio/virtio.h" -#include "exec/address-spaces.h" -#include "sysemu/qtest.h" - -#include "hw/s390x/sclp.h" -#include "hw/s390x/s390_flic.h" -#include "hw/s390x/s390-virtio.h" -#include "hw/s390x/storage-keys.h" -#include "hw/s390x/ipl.h" -#include "cpu.h" - -#define MAX_BLK_DEVS 10 - -#define S390_TOD_CLOCK_VALUE_MISSING 0x00 -#define S390_TOD_CLOCK_VALUE_PRESENT 0x01 - -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) -{ - 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); -} - - -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); - } -} - -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); -} - -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; -} - -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); - } -} - -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); -} diff --git a/hw/s390x/s390-virtio.h b/hw/s390x/s390-virtio.h index b6660e3ae9..d984cd4115 100644 --- a/hw/s390x/s390-virtio.h +++ b/hw/s390x/s390-virtio.h @@ -12,23 +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_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 Tue Nov 4 08:15:52 2025 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 1504115402659826.2718656794191; Wed, 30 Aug 2017 10:50:02 -0700 (PDT) Received: from localhost ([::1]:51914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn77o-0003dh-R0 for importer@patchew.org; Wed, 30 Aug 2017 13:50:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6Rn-0005kT-6e for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6Rj-0002Rl-8I for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39984) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn6Rj-0002QT-1S for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:31 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E9B9C19C339; Wed, 30 Aug 2017 17:06:29 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A6E980E72; Wed, 30 Aug 2017 17:06:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E9B9C19C339 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: Wed, 30 Aug 2017 19:05:55 +0200 Message-Id: <20170830170601.15855-6-david@redhat.com> In-Reply-To: <20170830170601.15855-1-david@redhat.com> References: <20170830170601.15855-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 30 Aug 2017 17:06:30 +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 v1 05/11] 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com, Aurelien Jarno 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. Signed-off-by: David Hildenbrand Reviewed-by: Thomas Huth --- hw/s390x/s390-virtio-ccw.c | 2 +- hw/s390x/s390-virtio-hcall.c | 2 +- hw/s390x/{s390-virtio.h =3D> s390-virtio-hcall.h} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename hw/s390x/{s390-virtio.h =3D> s390-virtio-hcall.h} (92%) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 41a9e976dc..03c88a524b 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 92% rename from hw/s390x/s390-virtio.h rename to hw/s390x/s390-virtio-hcall.h index d984cd4115..64c5bbd827 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 --=20 2.13.5 From nobody Tue Nov 4 08:15:52 2025 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 1504115611769270.6294906421397; Wed, 30 Aug 2017 10:53:31 -0700 (PDT) Received: from localhost ([::1]:51933 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn7BB-00074o-H0 for importer@patchew.org; Wed, 30 Aug 2017 13:53:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6Rn-0005kV-GK for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6Rl-0002Tb-FT for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46812) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn6Rl-0002Sd-79 for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:33 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48BE07E432; Wed, 30 Aug 2017 17:06:32 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A44480E72; Wed, 30 Aug 2017 17:06:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 48BE07E432 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: Wed, 30 Aug 2017 19:05:56 +0200 Message-Id: <20170830170601.15855-7-david@redhat.com> In-Reply-To: <20170830170601.15855-1-david@redhat.com> References: <20170830170601.15855-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 30 Aug 2017 17:06:32 +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 v1 06/11] target/s390x: cleanup cpu number/address 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com, Aurelien Jarno 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. Switch to the term "addr" instead, which matches the definition in the PoP called "CPU address". There is no such thing as cpu number, so rename env.cpu_num to env.cpu_addr. We can get rid of cpu->id now. Keep cpu->index and env->cpu_addr 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 "addr" can be a static property. Range checks can be avoided by using the correct type and the "setting after realized" check is done implicitly. AFAIK, s390x only supports cpu_add and not device_add for cpus. So we should be able to safely rename that property (no the "id" property could properly be used for device_add, which needs an artificial id for identification purposes). Signed-off-by: David Hildenbrand --- hw/s390x/s390-virtio-ccw.c | 2 +- target/s390x/cpu.c | 69 ++++++++++++------------------------------= ---- 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, 28 insertions(+), 65 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 03c88a524b..7754e3eaf9 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -306,7 +306,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.cpu_addr); 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 7267b60d41..156589e921 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,24 +190,26 @@ 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.cpu_addr >=3D max_cpus) { + error_setg(&err, "Unable to add CPU: %" PRIu32 ", max allowed: %d", + cpu->env.cpu_addr, max_cpus - 1); goto out; } #endif - if (cpu_exists(cpu->id)) { - error_setg(&err, "Unable to add CPU: %" PRIi64 - ", it already exists", cpu->id); + if (cpu_exists(cpu->env.cpu_addr)) { + error_setg(&err, "Unable to add CPU: %" PRIu32 ", it already exist= s", + cpu->env.cpu_addr); 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.cpu_addr !=3D scc->next_cpu_id) { + error_setg(&err, "Unable to add CPU: %" PRIu32 + ", the next available nr is %" PRIi64, cpu->env.cpu_add= r, scc->next_cpu_id); goto out; } =20 + /* sync cs->cpu_index and env->cpu_addr. The latter is needed for TCG.= */ + cs->cpu_index =3D env->cpu_addr; cpu_exec_realizefn(cs, &err); if (err !=3D NULL) { goto out; @@ -216,7 +219,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) @@ -237,45 +239,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); @@ -289,8 +252,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); @@ -487,6 +448,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("addr", S390CPU, env.cpu_addr, 0), + DEFINE_PROP_END_OF_LIST() +}; + static void s390_cpu_class_init(ObjectClass *oc, void *data) { S390CPUClass *scc =3D S390_CPU_CLASS(oc); @@ -496,6 +462,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 4ec338077e..6766dbb579 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 cpu_addr; /* same as cpu->index */ uint64_t cpuid; =20 uint64_t tod_offset; @@ -193,7 +193,6 @@ struct S390CPU { /*< public >*/ =20 CPUS390XState env; - int64_t id; S390CPUModel *model; /* needed for live migration */ void *irqstate; @@ -690,7 +689,7 @@ const char *s390_default_cpu_model_name(void); /* helper.c */ S390CPU *cpu_s390x_init(const char *cpu_model); #define cpu_init(model) CPU(cpu_s390x_init(model)) -S390CPU *s390x_new_cpu(const char *cpu_model, int64_t id, Error **errp); +S390CPU *s390x_new_cpu(const char *cpu_model, uint32_t addr, Error **errp); /* 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..1954c64c86 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.cpu_a= ddr); } } =20 diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 361f970db3..2ac36535f7 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -251,7 +251,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->cpu_addr | 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 3adb9de122..70d1ea8cf6 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 addr, Error **errp) { 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), addr, "addr", &err); if (err !=3D NULL) { goto out; } diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 50cc046ca2..eb7accc0ce 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -230,7 +230,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->cpu_addr); cpu_physical_memory_write(a0, &sysib, sizeof(sysib)); } else if ((sel1 =3D=3D 2) && (sel2 =3D=3D 2)) { /* Basic Machine CPUs */ @@ -258,7 +258,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->cpu_addr); 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 4b0db7b7bd..80455bf8f0 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3822,10 +3822,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, cpu_addr)); return NO_EXIT; } =20 --=20 2.13.5 From nobody Tue Nov 4 08:15:52 2025 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 1504115527375974.3062524651864; Wed, 30 Aug 2017 10:52:07 -0700 (PDT) Received: from localhost ([::1]:51926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn79p-0005yK-Ih for importer@patchew.org; Wed, 30 Aug 2017 13:52:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6Rs-0005p3-IJ for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6Rr-0002V8-MH for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41366) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn6Rr-0002Ut-DT for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:39 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 70518806B1; Wed, 30 Aug 2017 17:06:38 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BB189B518; Wed, 30 Aug 2017 17:06:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 70518806B1 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: Wed, 30 Aug 2017 19:05:57 +0200 Message-Id: <20170830170601.15855-8-david@redhat.com> In-Reply-To: <20170830170601.15855-1-david@redhat.com> References: <20170830170601.15855-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 30 Aug 2017 17:06:38 +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 v1 07/11] target/s390x: rename next_cpu_id to next_cpu_addr 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com, Aurelien Jarno 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 the term address/adddr. While at it, fix the type and drop the initialization to 0 (which is superfluous). Signed-off-by: David Hildenbrand --- target/s390x/cpu-qom.h | 2 +- target/s390x/cpu.c | 9 ++++----- target/s390x/helper.c | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/target/s390x/cpu-qom.h b/target/s390x/cpu-qom.h index 4e936e7788..a3a3ada226 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_cpu_addr; =20 DeviceRealize parent_realize; void (*parent_reset)(CPUState *cpu); diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 156589e921..ffc1ff9a2b 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -201,10 +201,10 @@ static void s390_cpu_realizefn(DeviceState *dev, Erro= r **errp) cpu->env.cpu_addr); goto out; } - if (cpu->env.cpu_addr !=3D scc->next_cpu_id) { + if (cpu->env.cpu_addr !=3D scc->next_cpu_addr) { error_setg(&err, "Unable to add CPU: %" PRIu32 - ", the next available nr is %" PRIi64, cpu->env.cpu_add= r, - scc->next_cpu_id); + ", the next available addr is %" PRIu32, cpu->env.cpu_a= ddr, + scc->next_cpu_addr); goto out; } =20 @@ -214,7 +214,7 @@ static void s390_cpu_realizefn(DeviceState *dev, Error = **errp) if (err !=3D NULL) { goto out; } - scc->next_cpu_id++; + scc->next_cpu_addr++; =20 #if !defined(CONFIG_USER_ONLY) qemu_register_reset(s390_cpu_machine_reset_cb, cpu); @@ -459,7 +459,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; diff --git a/target/s390x/helper.c b/target/s390x/helper.c index 70d1ea8cf6..d8f198cf6f 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -134,9 +134,9 @@ S390CPU *cpu_s390x_init(const char *cpu_model) Error *err =3D NULL; S390CPU *cpu; /* Use to track CPU ID for linux-user only */ - static int64_t next_cpu_id; + static uint32_t next_cpu_addr; =20 - cpu =3D s390x_new_cpu(cpu_model, next_cpu_id++, &err); + cpu =3D s390x_new_cpu(cpu_model, next_cpu_addr++, &err); if (err) { error_report_err(err); } --=20 2.13.5 From nobody Tue Nov 4 08:15:52 2025 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 1504115657851501.5553925269545; Wed, 30 Aug 2017 10:54:17 -0700 (PDT) Received: from localhost ([::1]:51935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn7Bv-0007hq-Qw for importer@patchew.org; Wed, 30 Aug 2017 13:54:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6Rz-0005uJ-Vm for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6Rw-0002W8-0h for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57200) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn6Rv-0002Vu-QS for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:43 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D5D3D20B15; Wed, 30 Aug 2017 17:06:42 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id C50739B51A; Wed, 30 Aug 2017 17:06:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D5D3D20B15 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: Wed, 30 Aug 2017 19:05:58 +0200 Message-Id: <20170830170601.15855-9-david@redhat.com> In-Reply-To: <20170830170601.15855-1-david@redhat.com> References: <20170830170601.15855-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 30 Aug 2017 17:06:43 +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 v1 08/11] 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com, Aurelien Jarno 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 are specified, so we don't raise people's hope. Signed-off-by: David Hildenbrand --- hw/s390x/s390-virtio-ccw.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 7754e3eaf9..eff96808c4 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" @@ -56,6 +57,11 @@ static void s390_init_cpus(MachineState *machine) if (machine->cpu_model =3D=3D NULL) { machine->cpu_model =3D s390_default_cpu_model_name(); } + 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); + } =20 ms->cpus =3D g_new0(S390CPU *, max_cpus); =20 --=20 2.13.5 From nobody Tue Nov 4 08:15:52 2025 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 1504115728682905.8920132084678; Wed, 30 Aug 2017 10:55:28 -0700 (PDT) Received: from localhost ([::1]:51955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn7D4-0000K6-S3 for importer@patchew.org; Wed, 30 Aug 2017 13:55:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6S2-0005xG-Jl for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6S1-0002Zx-QK for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56276) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn6S1-0002YP-Jb for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E619C0587D1; Wed, 30 Aug 2017 17:06:48 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4757B80E72; Wed, 30 Aug 2017 17:06:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9E619C0587D1 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: Wed, 30 Aug 2017 19:05:59 +0200 Message-Id: <20170830170601.15855-10-david@redhat.com> In-Reply-To: <20170830170601.15855-1-david@redhat.com> References: <20170830170601.15855-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 30 Aug 2017 17:06: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 v1 09/11] target/s390x: tcg_s390_program_interrupt() will never return 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com, Aurelien Jarno 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 assert should hold in both scenarios. Signed-off-by: David Hildenbrand --- target/s390x/interrupt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c index 058e219fe5..79bab5e2f3 100644 --- a/target/s390x/interrupt.c +++ b/target/s390x/interrupt.c @@ -32,9 +32,8 @@ static void tcg_s390_program_interrupt(CPUS390XState *env= , uint32_t code, #ifdef CONFIG_TCG trigger_pgm_exception(env, code, ilen); cpu_loop_exit(CPU(s390_env_get_cpu(env))); -#else - g_assert_not_reached(); #endif + g_assert_not_reached(); } =20 void program_interrupt(CPUS390XState *env, uint32_t code, int ilen) --=20 2.13.5 From nobody Tue Nov 4 08:15:52 2025 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 1504114218963756.6958188155565; Wed, 30 Aug 2017 10:30:18 -0700 (PDT) Received: from localhost ([::1]:51789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6oj-0001c9-1o for importer@patchew.org; Wed, 30 Aug 2017 13:30:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6S4-0005zv-Qp for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6S4-0002au-2N for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56346) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn6S3-0002ad-Su for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:52 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8EBCC0587E5; Wed, 30 Aug 2017 17:06:50 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3BF380E72; Wed, 30 Aug 2017 17:06:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E8EBCC0587E5 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: Wed, 30 Aug 2017 19:06:00 +0200 Message-Id: <20170830170601.15855-11-david@redhat.com> In-Reply-To: <20170830170601.15855-1-david@redhat.com> References: <20170830170601.15855-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 30 Aug 2017 17:06:51 +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 v1 10/11] 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com, Aurelien Jarno 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. 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 2ac36535f7..f5f5967833 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 Tue Nov 4 08:15:52 2025 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 1504115826058118.3868129094891; Wed, 30 Aug 2017 10:57:06 -0700 (PDT) Received: from localhost ([::1]:51959 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn7Ee-0001jB-0R for importer@patchew.org; Wed, 30 Aug 2017 13:57:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn6SA-000657-0Q for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn6S6-0002cD-Mi for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17738) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dn6S6-0002bb-GZ for qemu-devel@nongnu.org; Wed, 30 Aug 2017 13:06:54 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 880396F0; Wed, 30 Aug 2017 17:06:53 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68EC580E72; Wed, 30 Aug 2017 17:06:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 880396F0 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: Wed, 30 Aug 2017 19:06:01 +0200 Message-Id: <20170830170601.15855-12-david@redhat.com> In-Reply-To: <20170830170601.15855-1-david@redhat.com> References: <20170830170601.15855-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 30 Aug 2017 17:06: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 v1 11/11] 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, Richard Henderson , Alexander Graf , borntraeger@de.ibm.com, Aurelien Jarno 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" I am not sure if we are handling ilen the right way here. ilen should always match the instruction triggering the exception. This is relevant for per exceptions triggered via EXECUTE instructions. The ilen to be indicated has to match the EXECUTE instruction. Clean it up for now but leave ilen as is, we can fix that later. Signed-off-by: David Hildenbrand --- target/s390x/misc_helper.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index eb7accc0ce..ac9657f23f 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -445,14 +445,11 @@ 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); + ilen =3D get_ilen(cpu_ldub_code(env, env->per_address)); + program_interrupt(env, PGM_PER, ilen); } } =20 --=20 2.13.5