From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576254061; cv=none; d=zohomail.com; s=zohoarc; b=iwCR6Quw8K7RfGDmzARCxSq6VRNruK6DiS/G+x/sYBcI6pS9Vh8aHlnD4QzP/GmCx1UcBdLnk/rjRc/FG08zq4xOWg4A8ktBeWjuFcajYFFK7kH+oXyMxu7EFWko6GmBdaQSzMEMaBnUJ3+ZK6Twjd4gYV/61PscvYQ0tHkVJmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576254061; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HUapvLhtCW9yCcoxtOXVvyvcUvyz8RqxZFiSUUVE8Pk=; b=EZFVe0bzwQplJFk8sxki4oubngp/svjYuI8tbcQYxCI4x8GojhXvhfL9OZbIsBwUpPNQpbQpHy1tEMC+WrvllaM41ySBTP82yMa32ljC4YgapSW8bkspbfhgI3e+MmGjfCv6NrBnh4KWef/IDIePmELedAkEBYzLxGgkZ6TAZvs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576254061601844.5442258718946; Fri, 13 Dec 2019 08:21:01 -0800 (PST) Received: from localhost ([::1]:50960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnga-0001qM-BN for importer@patchew.org; Fri, 13 Dec 2019 11:21:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34874) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifneq-0008Nq-Ik for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnem-0000s4-UA for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:10 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:27260 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnel-0000o6-0t for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:07 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-364-PU46llMnMd-7rzggfX1j7w-1; Fri, 13 Dec 2019 11:19:04 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6C6E800EC0; Fri, 13 Dec 2019 16:19:02 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DEF310013D9; Fri, 13 Dec 2019 16:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HUapvLhtCW9yCcoxtOXVvyvcUvyz8RqxZFiSUUVE8Pk=; b=QPTdr397sPg3KMHhU5wcon4BzWSvUJ0S/G9m1Kux+Qz57QDQ8yZLZlcG0Okr7tPcZ6hWLV Wweooyv0x66FEd9QQkE9qvxuDXCsTlGojVaIvvSSqYGEzzZ3DKnbIoix68CALFTSTCTHgW JUiw3Q43zl35ENKCYcLFCcsnqjLKvFk= From: Cornelia Huck To: Peter Maydell Subject: [PULL 01/16] vfio-ccw: Fix error message Date: Fri, 13 Dec 2019 17:18:36 +0100 Message-Id: <20191213161851.24687-2-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: PU46llMnMd-7rzggfX1j7w-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Farman , Boris Fiuczynski , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Boris Fiuczynski Signed-off-by: Boris Fiuczynski Reviewed-by: Eric Farman Message-Id: <20191128143015.5231-1-fiuczy@linux.ibm.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Cornelia Huck --- hw/vfio/ccw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index 6863f6c69fd9..3b5520ae75a1 100644 --- a/hw/vfio/ccw.c +++ b/hw/vfio/ccw.c @@ -102,7 +102,7 @@ again: if (errno =3D=3D EAGAIN) { goto again; } - error_report("vfio-ccw: wirte I/O region failed with errno=3D%d", = errno); + error_report("vfio-ccw: write I/O region failed with errno=3D%d", = errno); ret =3D -errno; } else { ret =3D region->ret_code; --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576254244; cv=none; d=zohomail.com; s=zohoarc; b=CjGMb/NlNBFj3igXA47O9hiP7G0mFTs5QPWG2xidWfS1qyte0r31C+IFOlRh82+e/4cUYZtocjtcmDP6lB6S9xP3XdSaJogcHYNjEE7xZXIPegAGqITQivJaaFG5J6d6YI+3/C/O3J0enTMRCE1IrapVybPCjEMNiWlWCQMzQdg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576254244; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4BQ0cxHRn9CDvVFRXRPqBu9DFIeRE/0YzeZyOkJ9evs=; b=JuPnAIhKihtYiRI9NV8VJTh5EhsFqUTtIjtNLIR/Vt+xavLuTp3kBdWIrdQjCSsAKvphfGne8ffIhjNSK2HsFBE6401uom5iV2l3VhlOXlVPbKCIgXP5Xnd4Yt5K3yWpNNfPckJYIFQl8AFTmQxGrr3jRLzZLW2H+qjNYr36K8o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157625424496240.0717971530496; Fri, 13 Dec 2019 08:24:04 -0800 (PST) Received: from localhost ([::1]:51006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnjX-0005R1-Di for importer@patchew.org; Fri, 13 Dec 2019 11:24:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35105) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnes-0008Ok-9C for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifneq-0000wl-Hk for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:14 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:53579 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnem-0000rX-Tr for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:09 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-100-0e4KZQfJMKumuCYUh9xNEg-1; Fri, 13 Dec 2019 11:19:06 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 657B6800053; Fri, 13 Dec 2019 16:19:05 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E45D10013D9; Fri, 13 Dec 2019 16:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4BQ0cxHRn9CDvVFRXRPqBu9DFIeRE/0YzeZyOkJ9evs=; b=VEAQ4WgucCGSioHE+Ypi5PvdfNoEKSpsWVaYwOIGemJVTX/H9MLmLP51JTZLCBD4f3AR31 3Jgj5zbQYAuihOiWPs9MZ290wkvg16EX1O/kpD0IC39MFkvw/Y2VvIKz0JdcXBgLybenNO NWU7Ya0EdU6tuOcQIc0W5dmxI93akLw= From: Cornelia Huck To: Peter Maydell Subject: [PULL 02/16] hw: add compat machines for 5.0 Date: Fri, 13 Dec 2019 17:18:37 +0100 Message-Id: <20191213161851.24687-3-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: 0e4KZQfJMKumuCYUh9xNEg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org, Eduardo Habkost , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add 5.0 machine types for arm/i440fx/q35/s390x/spapr. For i440fx and q35, unversioned cpu models are still translated to -v1; I'll leave changing this (if desired) to the respective maintainers. Signed-off-by: Cornelia Huck Message-Id: <20191112104811.30323-1-cohuck@redhat.com> Acked-by: David Gibson Reviewed-by: Eduardo Habkost --- hw/arm/virt.c | 7 ++++++- hw/core/machine.c | 3 +++ hw/i386/pc.c | 3 +++ hw/i386/pc_piix.c | 14 +++++++++++++- hw/i386/pc_q35.c | 13 ++++++++++++- hw/ppc/spapr.c | 15 +++++++++++++-- hw/s390x/s390-virtio-ccw.c | 14 +++++++++++++- include/hw/boards.h | 3 +++ include/hw/i386/pc.h | 3 +++ 9 files changed, 69 insertions(+), 6 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index d4bedc260712..02f654b63278 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2147,10 +2147,15 @@ static void machvirt_machine_init(void) } type_init(machvirt_machine_init); =20 +static void virt_machine_5_0_options(MachineClass *mc) +{ +} +DEFINE_VIRT_MACHINE_AS_LATEST(5, 0) + static void virt_machine_4_2_options(MachineClass *mc) { } -DEFINE_VIRT_MACHINE_AS_LATEST(4, 2) +DEFINE_VIRT_MACHINE(4, 2) =20 static void virt_machine_4_1_options(MachineClass *mc) { diff --git a/hw/core/machine.c b/hw/core/machine.c index 1689ad3bf8af..21fe2d974817 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -27,6 +27,9 @@ #include "hw/pci/pci.h" #include "hw/mem/nvdimm.h" =20 +GlobalProperty hw_compat_4_2[] =3D {}; +const size_t hw_compat_4_2_len =3D G_N_ELEMENTS(hw_compat_4_2); + GlobalProperty hw_compat_4_1[] =3D { { "virtio-pci", "x-pcie-flr-init", "off" }, }; diff --git a/hw/i386/pc.c b/hw/i386/pc.c index ac08e6360437..58867f987d88 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -103,6 +103,9 @@ =20 struct hpet_fw_config hpet_cfg =3D {.count =3D UINT8_MAX}; =20 +GlobalProperty pc_compat_4_2[] =3D {}; +const size_t pc_compat_4_2_len =3D G_N_ELEMENTS(pc_compat_4_2); + GlobalProperty pc_compat_4_1[] =3D {}; const size_t pc_compat_4_1_len =3D G_N_ELEMENTS(pc_compat_4_1); =20 diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1bd70d1abbc4..846e70bc55ec 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -424,7 +424,7 @@ static void pc_i440fx_machine_options(MachineClass *m) machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE); } =20 -static void pc_i440fx_4_2_machine_options(MachineClass *m) +static void pc_i440fx_5_0_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_i440fx_machine_options(m); @@ -433,6 +433,18 @@ static void pc_i440fx_4_2_machine_options(MachineClass= *m) pcmc->default_cpu_version =3D 1; } =20 +DEFINE_I440FX_MACHINE(v5_0, "pc-i440fx-5.0", NULL, + pc_i440fx_5_0_machine_options); + +static void pc_i440fx_4_2_machine_options(MachineClass *m) +{ + pc_i440fx_5_0_machine_options(m); + m->alias =3D NULL; + m->is_default =3D 0; + compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len); + compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len); +} + DEFINE_I440FX_MACHINE(v4_2, "pc-i440fx-4.2", NULL, pc_i440fx_4_2_machine_options); =20 diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 385e5cffb167..ddd485d608c0 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -348,7 +348,7 @@ static void pc_q35_machine_options(MachineClass *m) m->max_cpus =3D 288; } =20 -static void pc_q35_4_2_machine_options(MachineClass *m) +static void pc_q35_5_0_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_q35_machine_options(m); @@ -356,6 +356,17 @@ static void pc_q35_4_2_machine_options(MachineClass *m) pcmc->default_cpu_version =3D 1; } =20 +DEFINE_Q35_MACHINE(v5_0, "pc-q35-5.0", NULL, + pc_q35_5_0_machine_options); + +static void pc_q35_4_2_machine_options(MachineClass *m) +{ + pc_q35_5_0_machine_options(m); + m->alias =3D NULL; + compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len); + compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len); +} + DEFINE_Q35_MACHINE(v4_2, "pc-q35-4.2", NULL, pc_q35_4_2_machine_options); =20 diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index e076f6023c73..3ae7db156303 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4491,15 +4491,26 @@ static const TypeInfo spapr_machine_info =3D { } \ type_init(spapr_machine_register_##suffix) =20 +/* + * pseries-5.0 + */ +static void spapr_machine_5_0_class_options(MachineClass *mc) +{ + /* Defaults for the latest behaviour inherited from the base class */ +} + +DEFINE_SPAPR_MACHINE(5_0, "5.0", true); + /* * pseries-4.2 */ static void spapr_machine_4_2_class_options(MachineClass *mc) { - /* Defaults for the latest behaviour inherited from the base class */ + spapr_machine_5_0_class_options(mc); + compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len); } =20 -DEFINE_SPAPR_MACHINE(4_2, "4.2", true); +DEFINE_SPAPR_MACHINE(4_2, "4.2", false); =20 /* * pseries-4.1 diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index d3edeef0ad92..01e7e209a5da 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -639,14 +639,26 @@ bool css_migration_enabled(void) } = \ type_init(ccw_machine_register_##suffix) =20 +static void ccw_machine_5_0_instance_options(MachineState *machine) +{ +} + +static void ccw_machine_5_0_class_options(MachineClass *mc) +{ +} +DEFINE_CCW_MACHINE(5_0, "5.0", true); + static void ccw_machine_4_2_instance_options(MachineState *machine) { + ccw_machine_5_0_instance_options(machine); } =20 static void ccw_machine_4_2_class_options(MachineClass *mc) { + ccw_machine_5_0_class_options(mc); + compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len); } -DEFINE_CCW_MACHINE(4_2, "4.2", true); +DEFINE_CCW_MACHINE(4_2, "4.2", false); =20 static void ccw_machine_4_1_instance_options(MachineState *machine) { diff --git a/include/hw/boards.h b/include/hw/boards.h index de45087f34cb..24cbeecbaecc 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -329,6 +329,9 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) =20 +extern GlobalProperty hw_compat_4_2[]; +extern const size_t hw_compat_4_2_len; + extern GlobalProperty hw_compat_4_1[]; extern const size_t hw_compat_4_1_len; =20 diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 1f86eba3f998..61a998de4665 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -237,6 +237,9 @@ void pc_system_firmware_init(PCMachineState *pcms, Memo= ryRegion *rom_memory); void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, const CPUArchIdList *apic_ids, GArray *entry); =20 +extern GlobalProperty pc_compat_4_2[]; +extern const size_t pc_compat_4_2_len; + extern GlobalProperty pc_compat_4_1[]; extern const size_t pc_compat_4_1_len; =20 --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576254858; cv=none; d=zohomail.com; s=zohoarc; b=g7DDKa1RgCnn47Br8jO1kDAZEasHWXSyiMlp4n5WzgkmvYOWLYKqQZP0bhtpgQji2hAllnAnv41dU5Xpw0u4tA5hwMSpldn1SSZQigzS5vs+nnzw4BsmRmRraBnQ7D15DUkb1b5Q5E/8x0WGygdJqsZfrRa8BDRSRONjwirJtV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576254858; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8fD1jPf77hf5QwSCn7UJYPVPQ62que2NUPDBIS4Y2CY=; b=gsj5qBsWEGJoSRGNmq/5W3lYHGX94BrEGmUgeAwc5uy52NMpB53rpy4upnJ2ZKnRPpFIYMSr4uxeM2mhcrcZ++o5crAl9PzY4QRQpHDezs5oyWLCBbgbilrCtydhGiSTAuwLBc1X9N8IlvGi1u3EywLdO47xDFQuW9F+cROn4fY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576254858904230.73324812773808; Fri, 13 Dec 2019 08:34:18 -0800 (PST) Received: from localhost ([::1]:51154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifntR-0001Xe-4I for importer@patchew.org; Fri, 13 Dec 2019 11:34:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35532) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifneu-0008Rn-Ec for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnet-00012a-Ak for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:16 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:42552 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnet-00010g-5B for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:15 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-82-397jilY5NrSiBO4eQdnubQ-1; Fri, 13 Dec 2019 11:19:11 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4DB87800D4E; Fri, 13 Dec 2019 16:19:10 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1A52D5C553; Fri, 13 Dec 2019 16:19:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8fD1jPf77hf5QwSCn7UJYPVPQ62que2NUPDBIS4Y2CY=; b=JWTZsbqoHTM0slTlMpVElwZs6CYHV0LrT1VS7LBeDMUQL8h0ZQZ1zrbCOHIU7hdQL3ifXX cBRSjNI9KrN0t8KMkyb1F04pH4cZF9QlzZfIPNw7oqw7vx6MtTFe7EBsZbB/z7bWD2LTuz jx6NMMQBahy593xdPMkC+TmBXSeW0LE= From: Cornelia Huck To: Peter Maydell Subject: [PULL 03/16] s390x: Don't do a normal reset on the initial cpu Date: Fri, 13 Dec 2019 17:18:38 +0100 Message-Id: <20191213161851.24687-4-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: 397jilY5NrSiBO4eQdnubQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cornelia Huck , qemu-s390x@nongnu.org, David Hildenbrand , qemu-devel@nongnu.org, Janosch Frank Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Janosch Frank The initiating cpu needs to be reset with an initial reset. While doing a normal reset followed by a initial reset is not wrong per se, the Ultravisor will only allow the correct reset to be performed. Signed-off-by: Janosch Frank Reviewed-by: David Hildenbrand Reviewed-by: Cornelia Huck Message-Id: <20191127175046.4911-2-frankja@linux.ibm.com> Signed-off-by: Cornelia Huck --- hw/s390x/s390-virtio-ccw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 01e7e209a5da..e0e28139a263 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -348,6 +348,9 @@ static void s390_machine_reset(MachineState *machine) break; case S390_RESET_LOAD_NORMAL: CPU_FOREACH(t) { + if (t =3D=3D cs) { + continue; + } run_on_cpu(t, s390_do_cpu_reset, RUN_ON_CPU_NULL); } subsystem_reset(); --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576254242; cv=none; d=zohomail.com; s=zohoarc; b=VakrSdEzwudcdeDtroaM4CvSVwLITK6xK6rrhHJnsHahO3jR2V3oFGSlK1ERcfde+DeRb6hBv7rw6YsowxQR3lv4qM5SL5Nd+LE0kLOqiV1v1tmrKQA+ZboCA2JjPqoa28CwKNIX1qln8W+hJczQFqRFfGNPcLiOFq/N/Y2kY5o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576254242; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XjihPKr7LPtpeVUyD1Ywx5iZuUUmd9Xf4ZGxJ7BU3l4=; b=YnZvR9Zqyc79SYOUFzF9t6CZRsPwlE/DDVe1U7huBbaLuqua/JD0ntGoGKOo4pspmsVzacsf0D2UTpj4bxgL31H380sF1XZefREBegi+fcWcCFvAOhBkcCnBGc4XV4+swIMILHShYai+HoLQDlkt9S6lxTWnQ+f8WHqnllPj8cU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157625424248086.50395521524649; Fri, 13 Dec 2019 08:24:02 -0800 (PST) Received: from localhost ([::1]:51004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnjU-0005Nz-Rg for importer@patchew.org; Fri, 13 Dec 2019 11:24:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35658) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnev-0008Sc-0v for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnet-00013N-LH for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:16 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:27125 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnet-00012I-H3 for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:15 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-EYLts699MfyuIx5gU5koYA-1; Fri, 13 Dec 2019 11:19:13 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6598E800EB4; Fri, 13 Dec 2019 16:19:12 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06F465C553; Fri, 13 Dec 2019 16:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253955; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XjihPKr7LPtpeVUyD1Ywx5iZuUUmd9Xf4ZGxJ7BU3l4=; b=AuDyePU+g5tXDyfr60qFHlzMVB3UINIj0LxBkRzl5PxT15YJ4cmsQ461iIFbh4s2KSBBZK LPTW0eH62jLqsGJb/QF7GdjKy4T3FpF4JJPNXJjjuRQgefWwgCGT7u3wwDOM5lHD4R3TgE FfnbTcu4BBLzYkF0JtYatEBXCNCWn3I= From: Cornelia Huck To: Peter Maydell Subject: [PULL 04/16] s390x: Move reset normal to shared reset handler Date: Fri, 13 Dec 2019 17:18:39 +0100 Message-Id: <20191213161851.24687-5-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: EYLts699MfyuIx5gU5koYA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Janosch Frank Let's start moving the cpu reset functions into a single function with a switch/case, so we can later use fallthroughs and share more code between resets. This patch introduces the reset function by renaming cpu_reset(). Signed-off-by: Janosch Frank Reviewed-by: David Hildenbrand Message-Id: <20191127175046.4911-3-frankja@linux.ibm.com> Reviewed-by: Thomas Huth Signed-off-by: Cornelia Huck --- target/s390x/cpu-qom.h | 6 +++++- target/s390x/cpu.c | 19 +++++++++++++------ target/s390x/cpu.h | 2 +- target/s390x/sigp.c | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/target/s390x/cpu-qom.h b/target/s390x/cpu-qom.h index b809ec8418e0..f3b71bac67c9 100644 --- a/target/s390x/cpu-qom.h +++ b/target/s390x/cpu-qom.h @@ -34,6 +34,10 @@ typedef struct S390CPUModel S390CPUModel; typedef struct S390CPUDef S390CPUDef; =20 +typedef enum cpu_reset_type { + S390_CPU_RESET_NORMAL, +} cpu_reset_type; + /** * S390CPUClass: * @parent_realize: The parent class' realize handler. @@ -57,7 +61,7 @@ typedef struct S390CPUClass { DeviceRealize parent_realize; void (*parent_reset)(CPUState *cpu); void (*load_normal)(CPUState *cpu); - void (*cpu_reset)(CPUState *cpu); + void (*reset)(CPUState *cpu, cpu_reset_type type); void (*initial_cpu_reset)(CPUState *cpu); } S390CPUClass; =20 diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 3abe7e80fd0a..67d6fbfa4401 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -82,18 +82,25 @@ static void s390_cpu_load_normal(CPUState *s) } #endif =20 -/* S390CPUClass::cpu_reset() */ -static void s390_cpu_reset(CPUState *s) +/* S390CPUClass::reset() */ +static void s390_cpu_reset(CPUState *s, cpu_reset_type type) { S390CPU *cpu =3D S390_CPU(s); S390CPUClass *scc =3D S390_CPU_GET_CLASS(cpu); CPUS390XState *env =3D &cpu->env; =20 - env->pfault_token =3D -1UL; - env->bpbc =3D false; scc->parent_reset(s); cpu->env.sigp_order =3D 0; s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); + + switch (type) { + case S390_CPU_RESET_NORMAL: + env->pfault_token =3D -1UL; + env->bpbc =3D false; + break; + default: + g_assert_not_reached(); + } } =20 /* S390CPUClass::initial_reset() */ @@ -102,7 +109,7 @@ static void s390_cpu_initial_reset(CPUState *s) S390CPU *cpu =3D S390_CPU(s); CPUS390XState *env =3D &cpu->env; =20 - s390_cpu_reset(s); + s390_cpu_reset(s, S390_CPU_RESET_NORMAL); /* initial reset does not clear everything! */ memset(&env->start_initial_reset_fields, 0, offsetof(CPUS390XState, end_reset_fields) - @@ -473,7 +480,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *= data) #if !defined(CONFIG_USER_ONLY) scc->load_normal =3D s390_cpu_load_normal; #endif - scc->cpu_reset =3D s390_cpu_reset; + scc->reset =3D s390_cpu_reset; scc->initial_cpu_reset =3D s390_cpu_initial_reset; cc->reset =3D s390_cpu_full_reset; cc->class_by_name =3D s390_cpu_class_by_name, diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 17460ed7b381..18123dfd5bd1 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -741,7 +741,7 @@ static inline void s390_do_cpu_reset(CPUState *cs, run_= on_cpu_data arg) { S390CPUClass *scc =3D S390_CPU_GET_CLASS(cs); =20 - scc->cpu_reset(cs); + scc->reset(cs, S390_CPU_RESET_NORMAL); } =20 static inline void s390_do_cpu_initial_reset(CPUState *cs, run_on_cpu_data= arg) diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c index 2ce22d4dc18b..850139b9cd54 100644 --- a/target/s390x/sigp.c +++ b/target/s390x/sigp.c @@ -266,7 +266,7 @@ static void sigp_cpu_reset(CPUState *cs, run_on_cpu_dat= a arg) SigpInfo *si =3D arg.host_ptr; =20 cpu_synchronize_state(cs); - scc->cpu_reset(cs); + scc->reset(cs, S390_CPU_RESET_NORMAL); cpu_synchronize_post_reset(cs); si->cc =3D SIGP_CC_ORDER_CODE_ACCEPTED; } --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576254434; cv=none; d=zohomail.com; s=zohoarc; b=LR6NFsSUF/6TA8IOSBAGlVVchatabcAG6asuwCkKiLAY2QY87XGYZFMCA2txb4wM6MN7Ae4ylbb5ErX78slOrLbhzkLNthQVhSNd0gsPbQJL+MKqJ6Vr70JLRjlsw0GRkwySFDi2mg5mGnnyfGOhURxidnVGR4q4pq3gAnP8nWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576254434; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9RyiNGZBK+I1IuNyF19r9i05wMa4bRY1ZaqLueSYmug=; b=QWcB5qRpI1kamhIB6Vuo1BvB6vswNPHkPz8ca6XFGGLKBdwXPf2TSh5yZJGIiB2g5nxA3BXmvkh5gMTXn07qabndNx8qg597eh9kfcjO7YsVtAgICGw0MCoIZc28/p4fOA/qaQwvOK/jq6L/+g/x16/yly6Tb4X4cD7AVK84Avk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576254434859442.46528258230626; Fri, 13 Dec 2019 08:27:14 -0800 (PST) Received: from localhost ([::1]:51054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnma-0000sA-4Z for importer@patchew.org; Fri, 13 Dec 2019 11:27:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36961) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnf1-0000By-TO for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnf0-0001GK-A6 for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:23 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:39574 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnf0-0001FO-3y for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:22 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-310-UaX0mvpWMkmmNoGhZOZUZw-1; Fri, 13 Dec 2019 11:19:18 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1690A801E77; Fri, 13 Dec 2019 16:19:17 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1AA3319C70; Fri, 13 Dec 2019 16:19:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9RyiNGZBK+I1IuNyF19r9i05wMa4bRY1ZaqLueSYmug=; b=aUAAx3Wp3kDXNn6i29vNAAovvvnJ8yqDuVcmm/FTPyXhgDeP/9vxAFNokLHNNGzU9P2mei yD2VmqZzqa168M3GahAzKtw+8oeNDtvCAMKcx9ltiJZabWeURZUvS+0tg23Aho7/eKwHIg V3HXQtCRlZ7NSKUPIIkrn20FWv/Ndb4= From: Cornelia Huck To: Peter Maydell Subject: [PULL 05/16] s390x: Move initial reset Date: Fri, 13 Dec 2019 17:18:40 +0100 Message-Id: <20191213161851.24687-6-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: UaX0mvpWMkmmNoGhZOZUZw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Janosch Frank Let's move the intial reset into the reset handler and cleanup afterwards. Signed-off-by: Janosch Frank Reviewed-by: David Hildenbrand Message-Id: <20191128083723.11937-1-frankja@linux.ibm.com> Reviewed-by: Thomas Huth Signed-off-by: Cornelia Huck --- target/s390x/cpu-qom.h | 2 +- target/s390x/cpu.c | 46 +++++++++++++++++------------------------- target/s390x/cpu.h | 2 +- target/s390x/sigp.c | 2 +- 4 files changed, 21 insertions(+), 31 deletions(-) diff --git a/target/s390x/cpu-qom.h b/target/s390x/cpu-qom.h index f3b71bac67c9..6f0a12042ed4 100644 --- a/target/s390x/cpu-qom.h +++ b/target/s390x/cpu-qom.h @@ -36,6 +36,7 @@ typedef struct S390CPUDef S390CPUDef; =20 typedef enum cpu_reset_type { S390_CPU_RESET_NORMAL, + S390_CPU_RESET_INITIAL, } cpu_reset_type; =20 /** @@ -62,7 +63,6 @@ typedef struct S390CPUClass { void (*parent_reset)(CPUState *cpu); void (*load_normal)(CPUState *cpu); void (*reset)(CPUState *cpu, cpu_reset_type type); - void (*initial_cpu_reset)(CPUState *cpu); } S390CPUClass; =20 typedef struct S390CPU S390CPU; diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 67d6fbfa4401..ca62fe768569 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -94,6 +94,23 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type t= ype) s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); =20 switch (type) { + case S390_CPU_RESET_INITIAL: + /* initial reset does not clear everything! */ + memset(&env->start_initial_reset_fields, 0, + offsetof(CPUS390XState, end_reset_fields) - + offsetof(CPUS390XState, start_initial_reset_fields)); + + /* architectured initial value for Breaking-Event-Address register= */ + env->gbea =3D 1; + + /* architectured initial values for CR 0 and 14 */ + env->cregs[0] =3D CR0_RESET; + env->cregs[14] =3D CR14_RESET; + + /* tininess for underflow is detected before rounding */ + set_float_detect_tininess(float_tininess_before_rounding, + &env->fpu_status); + /* fall through */ case S390_CPU_RESET_NORMAL: env->pfault_token =3D -1UL; env->bpbc =3D false; @@ -101,35 +118,9 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type= type) default: g_assert_not_reached(); } -} - -/* S390CPUClass::initial_reset() */ -static void s390_cpu_initial_reset(CPUState *s) -{ - S390CPU *cpu =3D S390_CPU(s); - CPUS390XState *env =3D &cpu->env; - - s390_cpu_reset(s, S390_CPU_RESET_NORMAL); - /* initial reset does not clear everything! */ - memset(&env->start_initial_reset_fields, 0, - offsetof(CPUS390XState, end_reset_fields) - - offsetof(CPUS390XState, start_initial_reset_fields)); - - /* architectured initial values for CR 0 and 14 */ - env->cregs[0] =3D CR0_RESET; - env->cregs[14] =3D CR14_RESET; - - /* architectured initial value for Breaking-Event-Address register */ - env->gbea =3D 1; - - env->pfault_token =3D -1UL; - - /* tininess for underflow is detected before rounding */ - set_float_detect_tininess(float_tininess_before_rounding, - &env->fpu_status); =20 /* Reset state inside the kernel that we cannot access yet from QEMU. = */ - if (kvm_enabled()) { + if (kvm_enabled() && type !=3D S390_CPU_RESET_NORMAL) { kvm_s390_reset_vcpu(cpu); } } @@ -481,7 +472,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *= data) scc->load_normal =3D s390_cpu_load_normal; #endif scc->reset =3D s390_cpu_reset; - scc->initial_cpu_reset =3D s390_cpu_initial_reset; cc->reset =3D s390_cpu_full_reset; cc->class_by_name =3D s390_cpu_class_by_name, cc->has_work =3D s390_cpu_has_work; diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 18123dfd5bd1..d2af13b345cc 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -748,7 +748,7 @@ static inline void s390_do_cpu_initial_reset(CPUState *= cs, run_on_cpu_data arg) { S390CPUClass *scc =3D S390_CPU_GET_CLASS(cs); =20 - scc->initial_cpu_reset(cs); + scc->reset(cs, S390_CPU_RESET_INITIAL); } =20 static inline void s390_do_cpu_load_normal(CPUState *cs, run_on_cpu_data a= rg) diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c index 850139b9cd54..727875bb4ab9 100644 --- a/target/s390x/sigp.c +++ b/target/s390x/sigp.c @@ -254,7 +254,7 @@ static void sigp_initial_cpu_reset(CPUState *cs, run_on= _cpu_data arg) SigpInfo *si =3D arg.host_ptr; =20 cpu_synchronize_state(cs); - scc->initial_cpu_reset(cs); + scc->reset(cs, S390_CPU_RESET_INITIAL); cpu_synchronize_post_reset(cs); si->cc =3D SIGP_CC_ORDER_CODE_ACCEPTED; } --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576254558; cv=none; d=zohomail.com; s=zohoarc; b=CqLVYg1vE/ChQBvq5RRd7Zn2u+VdLyc+RG58bYCLPae4dCOkKqxt9SIgznt7a8Lr9lZ7+3Zca9z9dwNTlJO0e/hZ28H0efdwnlI44lBgfotNUIKw4HIRXpxYim5gn0ktF3OSnRD0s/Pc9PBr2e7rfSv/dwMcluuw+SMY152WjI8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576254558; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3nzSX4Eik3KjtGJOW7//s0suSjmGjAvzRFJ0ah76MqM=; b=FCQVfYSoSuT9L2+oPjuASu1HO4PzTOSLgKzuB8lMd8M2jEHP3mVfiijxLhV0F+JPfUcOzoVXvH2g6YSGdn/ZMmT0VajEosMrZ2fDDnuD43hWu76MT0AGtRqlOzPeQ9d6O4Eql5+obsgtnICE5s4l3cQKSTj7CbmsHmpr55OdNWE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157625455838069.60598237545264; Fri, 13 Dec 2019 08:29:18 -0800 (PST) Received: from localhost ([::1]:51072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnoa-0003oS-72 for importer@patchew.org; Fri, 13 Dec 2019 11:29:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37568) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnf4-0000GV-RI for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnf3-0001Me-Hp for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:26 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:30780 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnf3-0001Lg-DU for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:25 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-87-ct8vcmzbM5W5MIWSrMcgvg-1; Fri, 13 Dec 2019 11:19:23 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6BCD1852E29; Fri, 13 Dec 2019 16:19:21 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C206660BF3; Fri, 13 Dec 2019 16:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3nzSX4Eik3KjtGJOW7//s0suSjmGjAvzRFJ0ah76MqM=; b=HRYq+6vXIP2YoqHq5zEDzGlxExQ8rBSrV36IEuchnGyrOCQSDkBg0TYqFxU9w7kPTuNRNO 7tg2mUj0EdFNm+xpLsuarZAoMYD7779ttD8HtuZ0ptFq3046jxYOTJSvGmlCen5EfgYWNE ufC/ORWqiKMGBda5kYBRgjKNkaRTq8c= From: Cornelia Huck To: Peter Maydell Subject: [PULL 06/16] s390x: Move clear reset Date: Fri, 13 Dec 2019 17:18:41 +0100 Message-Id: <20191213161851.24687-7-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: ct8vcmzbM5W5MIWSrMcgvg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Janosch Frank Let's also move the clear reset function into the reset handler. Signed-off-by: Janosch Frank Message-Id: <20191127175046.4911-5-frankja@linux.ibm.com> Reviewed-by: David Hildenbrand Reviewed-by: Thomas Huth Signed-off-by: Cornelia Huck --- target/s390x/cpu-qom.h | 1 + target/s390x/cpu.c | 58 +++++++++++++----------------------------- 2 files changed, 18 insertions(+), 41 deletions(-) diff --git a/target/s390x/cpu-qom.h b/target/s390x/cpu-qom.h index 6f0a12042ed4..dbe5346ec901 100644 --- a/target/s390x/cpu-qom.h +++ b/target/s390x/cpu-qom.h @@ -37,6 +37,7 @@ typedef struct S390CPUDef S390CPUDef; typedef enum cpu_reset_type { S390_CPU_RESET_NORMAL, S390_CPU_RESET_INITIAL, + S390_CPU_RESET_CLEAR, } cpu_reset_type; =20 /** diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index ca62fe768569..bd39cb54b7aa 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -94,6 +94,9 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type ty= pe) s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); =20 switch (type) { + case S390_CPU_RESET_CLEAR: + memset(env, 0, offsetof(CPUS390XState, start_initial_reset_fields)= ); + /* fall through */ case S390_CPU_RESET_INITIAL: /* initial reset does not clear everything! */ memset(&env->start_initial_reset_fields, 0, @@ -107,6 +110,14 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type= type) env->cregs[0] =3D CR0_RESET; env->cregs[14] =3D CR14_RESET; =20 +#if defined(CONFIG_USER_ONLY) + /* user mode should always be allowed to use the full FPU */ + env->cregs[0] |=3D CR0_AFP; + if (s390_has_feat(S390_FEAT_VECTOR)) { + env->cregs[0] |=3D CR0_VECTOR; + } +#endif + /* tininess for underflow is detected before rounding */ set_float_detect_tininess(float_tininess_before_rounding, &env->fpu_status); @@ -125,46 +136,6 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type= type) } } =20 -/* CPUClass:reset() */ -static void s390_cpu_full_reset(CPUState *s) -{ - S390CPU *cpu =3D S390_CPU(s); - S390CPUClass *scc =3D S390_CPU_GET_CLASS(cpu); - CPUS390XState *env =3D &cpu->env; - - scc->parent_reset(s); - cpu->env.sigp_order =3D 0; - s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); - - memset(env, 0, offsetof(CPUS390XState, end_reset_fields)); - - /* architectured initial values for CR 0 and 14 */ - env->cregs[0] =3D CR0_RESET; - env->cregs[14] =3D CR14_RESET; - -#if defined(CONFIG_USER_ONLY) - /* user mode should always be allowed to use the full FPU */ - env->cregs[0] |=3D CR0_AFP; - if (s390_has_feat(S390_FEAT_VECTOR)) { - env->cregs[0] |=3D CR0_VECTOR; - } -#endif - - /* architectured initial value for Breaking-Event-Address register */ - env->gbea =3D 1; - - env->pfault_token =3D -1UL; - - /* tininess for underflow is detected before rounding */ - set_float_detect_tininess(float_tininess_before_rounding, - &env->fpu_status); - - /* Reset state inside the kernel that we cannot access yet from QEMU. = */ - if (kvm_enabled()) { - kvm_s390_reset_vcpu(cpu); - } -} - #if !defined(CONFIG_USER_ONLY) static void s390_cpu_machine_reset_cb(void *opaque) { @@ -456,6 +427,11 @@ static Property s390x_cpu_properties[] =3D { DEFINE_PROP_END_OF_LIST() }; =20 +static void s390_cpu_reset_full(CPUState *s) +{ + return s390_cpu_reset(s, S390_CPU_RESET_CLEAR); +} + static void s390_cpu_class_init(ObjectClass *oc, void *data) { S390CPUClass *scc =3D S390_CPU_CLASS(oc); @@ -472,7 +448,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *= data) scc->load_normal =3D s390_cpu_load_normal; #endif scc->reset =3D s390_cpu_reset; - cc->reset =3D s390_cpu_full_reset; + cc->reset =3D s390_cpu_reset_full; cc->class_by_name =3D s390_cpu_class_by_name, cc->has_work =3D s390_cpu_has_work; #ifdef CONFIG_TCG --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576254596; cv=none; d=zohomail.com; s=zohoarc; b=D/dxQ5XMaF6W1772gdxBeE95dgU/nPNJngtjstz9bd9omG5NVdfLLziPnPq+rJwsnLBj5o69/j81zKwe0eXOsSHZgPcd6fRyyxRrHrozHBzjo8kKfmGG636C021VSMkhUCgH+Yeyk78NS4UixHTpt8uo0XX/O0lnrXBGs6oUj2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576254596; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Sl200vKoDtXZiCTG+5unevgyZVrBojkXBzppV1yXaVA=; b=njKMZy6EcdqPn6jO2wgbHiK2t/jVAZtzDQKqao26uSnHAQPg/0EJIoxKno/G3wnGO3tmVosSyhY2K+PBNt5bwaAX3PIFelwTPwJ1DqBI9V5kAT95aVOpptH6MDcyZ1hqDjETxR2JM3FY60MLrwFK3fLXY7FYB60ON+yD7O2N0Sw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576254596395242.64413228211174; Fri, 13 Dec 2019 08:29:56 -0800 (PST) Received: from localhost ([::1]:51080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnpC-00057k-U6 for importer@patchew.org; Fri, 13 Dec 2019 11:29:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38774) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnfB-0000RX-70 for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnf9-0001aZ-UW for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:33 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:60083 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnf9-0001Y8-LL for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:31 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-318-uffglKv3NCyR9VsUy6ZNxQ-1; Fri, 13 Dec 2019 11:19:27 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 29D4DDBA8; Fri, 13 Dec 2019 16:19:26 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FEDC601B6; Fri, 13 Dec 2019 16:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sl200vKoDtXZiCTG+5unevgyZVrBojkXBzppV1yXaVA=; b=VADxBDWhUulrFABfTvUKvgHwWoOQBakEX8Ev40q2HL0rvVLLR/vW4MyaPhdWPZkIJmI7Vo BZFsgkGwwnxUdYR8xRSchMrKJYr/TGUIvoLiwPl6cP+skXPF11BxFKNOafKNN3n+Yq21wa q9cW46NhBxeM7UTl22fH+a8bdgAivIw= From: Cornelia Huck To: Peter Maydell Subject: [PULL 07/16] s390x: Beautify diag308 handling Date: Fri, 13 Dec 2019 17:18:42 +0100 Message-Id: <20191213161851.24687-8-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: uffglKv3NCyR9VsUy6ZNxQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Janosch Frank Let's improve readability by: * Using constants for the subcodes * Moving parameter checking into a function * Removing subcode > 6 check as the default case catches that Signed-off-by: Janosch Frank Reviewed-by: Cornelia Huck Reviewed-by: Thomas Huth Reviewed-by: David Hildenbrand Message-Id: <20191127175046.4911-6-frankja@linux.ibm.com> Signed-off-by: Cornelia Huck --- target/s390x/diag.c | 54 +++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/target/s390x/diag.c b/target/s390x/diag.c index 53c2f81f2a1a..b5aec06d6bef 100644 --- a/target/s390x/diag.c +++ b/target/s390x/diag.c @@ -53,6 +53,29 @@ int handle_diag_288(CPUS390XState *env, uint64_t r1, uin= t64_t r3) #define DIAG_308_RC_NO_CONF 0x0102 #define DIAG_308_RC_INVALID 0x0402 =20 +#define DIAG308_RESET_MOD_CLR 0 +#define DIAG308_RESET_LOAD_NORM 1 +#define DIAG308_LOAD_CLEAR 3 +#define DIAG308_LOAD_NORMAL_DUMP 4 +#define DIAG308_SET 5 +#define DIAG308_STORE 6 + +static int diag308_parm_check(CPUS390XState *env, uint64_t r1, uint64_t ad= dr, + uintptr_t ra, bool write) +{ + if ((r1 & 1) || (addr & ~TARGET_PAGE_MASK)) { + s390_program_interrupt(env, PGM_SPECIFICATION, ra); + return -1; + } + if (!address_space_access_valid(&address_space_memory, addr, + sizeof(IplParameterBlock), write, + MEMTXATTRS_UNSPECIFIED)) { + s390_program_interrupt(env, PGM_ADDRESSING, ra); + return -1; + } + return 0; +} + void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr= _t ra) { CPUState *cs =3D env_cpu(env); @@ -65,30 +88,24 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, u= int64_t r3, uintptr_t ra) return; } =20 - if ((subcode & ~0x0ffffULL) || (subcode > 6)) { + if (subcode & ~0x0ffffULL) { s390_program_interrupt(env, PGM_SPECIFICATION, ra); return; } =20 switch (subcode) { - case 0: + case DIAG308_RESET_MOD_CLR: s390_ipl_reset_request(cs, S390_RESET_MODIFIED_CLEAR); break; - case 1: + case DIAG308_RESET_LOAD_NORM: s390_ipl_reset_request(cs, S390_RESET_LOAD_NORMAL); break; - case 3: + case DIAG308_LOAD_CLEAR: + /* Well we still lack the clearing bit... */ s390_ipl_reset_request(cs, S390_RESET_REIPL); break; - case 5: - if ((r1 & 1) || (addr & 0x0fffULL)) { - s390_program_interrupt(env, PGM_SPECIFICATION, ra); - return; - } - if (!address_space_access_valid(&address_space_memory, addr, - sizeof(IplParameterBlock), false, - MEMTXATTRS_UNSPECIFIED)) { - s390_program_interrupt(env, PGM_ADDRESSING, ra); + case DIAG308_SET: + if (diag308_parm_check(env, r1, addr, ra, false)) { return; } iplb =3D g_new0(IplParameterBlock, 1); @@ -110,15 +127,8 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, = uint64_t r3, uintptr_t ra) out: g_free(iplb); return; - case 6: - if ((r1 & 1) || (addr & 0x0fffULL)) { - s390_program_interrupt(env, PGM_SPECIFICATION, ra); - return; - } - if (!address_space_access_valid(&address_space_memory, addr, - sizeof(IplParameterBlock), true, - MEMTXATTRS_UNSPECIFIED)) { - s390_program_interrupt(env, PGM_ADDRESSING, ra); + case DIAG308_STORE: + if (diag308_parm_check(env, r1, addr, ra, true)) { return; } iplb =3D s390_ipl_get_iplb(); --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576255268; cv=none; d=zohomail.com; s=zohoarc; b=Pz1fh2CMVxcfJjwZ7ewRo7OGgU+1NCIoq5O3ftr/0zuuYtYpQRRTezpz/JwIgp02KwHWe/GfKU8vpxGaFRrYwlnT1f9ellMctblsfeM1jziqkcMSvM95s+yCiKrMuJv10sYuZyDA4TechaGck5Daqrx81yjPBxcMh9sRstSk7q0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576255268; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8LjIPDCpWRkfw5wVp11KGA8s6SR+qMeIEMfDWf9vzM4=; b=QTCg7uwewPvHJP0SDUe7ZD0INFKD3aArkG6J/syiGIRyDZHfH8DiH1d6V/GymjnQeIwUbhtgotR8uP7wt417kQu5A4WT3hCCGoKiy2IYjwGAaoj+/3ljvgJHPrfQ8sjuA/o14x4JUd0/9DeZVa8ddusYbvAlm+/CdEO+7D2GTcc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576255268427893.0054367161059; Fri, 13 Dec 2019 08:41:08 -0800 (PST) Received: from localhost ([::1]:51256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifo03-0001fv-2C for importer@patchew.org; Fri, 13 Dec 2019 11:41:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39344) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnfE-0000WC-2G for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnfC-0001hO-T5 for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:35 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:26020 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnfC-0001gi-P5 for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:34 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-187-JQysbnDTOtGb0N6BNXfyeQ-1; Fri, 13 Dec 2019 11:19:31 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 995C58024F9; Fri, 13 Dec 2019 16:19:30 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D28E5100164D; Fri, 13 Dec 2019 16:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253974; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8LjIPDCpWRkfw5wVp11KGA8s6SR+qMeIEMfDWf9vzM4=; b=XsXn88rGbGj0Zee98sLU+/PNjoNn5sfIqmFtYa54AZJecKhV4TLManbqiDuxBVau1qX3nh L4bxhNzTDIBaclIe4GSbeCmA/SdAdVRYWG67FGPnVbhUl+ssMyh6GqB7DW0LcpkDAUIdk0 NyZe0HJB9a7tMkqjec+THj5STnq4CA0= From: Cornelia Huck To: Peter Maydell Subject: [PULL 08/16] s390x: kvm: Make kvm_sclp_service_call void Date: Fri, 13 Dec 2019 17:18:43 +0100 Message-Id: <20191213161851.24687-9-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: JQysbnDTOtGb0N6BNXfyeQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Janosch Frank It defaults to returning 0 anyway and that return value is not necessary, as 0 is also the default rc that the caller would return. While doing that we can simplify the logic a bit and return early if we inject a PGM exception. Signed-off-by: Janosch Frank Reviewed-by: Thomas Huth Message-Id: <20191129091713.4582-1-frankja@linux.ibm.com> Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- target/s390x/kvm.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 0c9d14b4b115..ad6e38c8761b 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1159,13 +1159,13 @@ void kvm_s390_access_exception(S390CPU *cpu, uint16= _t code, uint64_t te_code) kvm_s390_vcpu_interrupt(cpu, &irq); } =20 -static int kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run, +static void kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run, uint16_t ipbh0) { CPUS390XState *env =3D &cpu->env; uint64_t sccb; uint32_t code; - int r =3D 0; + int r; =20 sccb =3D env->regs[ipbh0 & 0xf]; code =3D env->regs[(ipbh0 & 0xf0) >> 4]; @@ -1173,11 +1173,9 @@ static int kvm_sclp_service_call(S390CPU *cpu, struc= t kvm_run *run, r =3D sclp_service_call(env, sccb, code); if (r < 0) { kvm_s390_program_interrupt(cpu, -r); - } else { - setcc(cpu, r); + return; } - - return 0; + setcc(cpu, r); } =20 static int handle_b2(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) @@ -1240,7 +1238,7 @@ static int handle_b2(S390CPU *cpu, struct kvm_run *ru= n, uint8_t ipa1) setcc(cpu, 3); break; case PRIV_B2_SCLP_CALL: - rc =3D kvm_sclp_service_call(cpu, run, ipbh0); + kvm_sclp_service_call(cpu, run, ipbh0); break; default: rc =3D -1; --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576254756; cv=none; d=zohomail.com; s=zohoarc; b=XNeIj4tvUeIUT2OfDcU9533KBhxVVeiRPGjL5iZClyKcE8FpBD4r3C5wzky1AtuEjOqrNl9JkVzJ9RQfpgrRYxZCJ1+0dV350BgAdmJ3KUHh1A/ZGzvY6aEN5CdTVrm4cc46j2ifisX4PwR+zUJRBibGkfvk3pk7HBHE3ThmpM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576254756; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dDg+807iArEhZjenX1sVcxomXSGnTRm3h/+PwfZNwvs=; b=fxfx4i7FqnyPsq9lndQxXRU+wAheNCRojynlNTq9KLDAOf9TcmrsgdBvOlD8/LxP7u5XqbqhONm+nyi4japAyF726iPaCo0ttdTT82nvEYb6xuyEVNT+JwphmftD32E3ynm7AOQiWlJisFzRuaC2wLLSH1kNr0w0gBDDauFhzjE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576254756814861.805001078002; Fri, 13 Dec 2019 08:32:36 -0800 (PST) Received: from localhost ([::1]:51128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnrm-0008HP-OQ for importer@patchew.org; Fri, 13 Dec 2019 11:32:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40064) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnfH-0000bs-Na for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnfG-0001pH-Ak for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:39 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:52033 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnfG-0001nn-5r for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:38 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-325-ukCo8MLUObqTV-W3J6NHlQ-1; Fri, 13 Dec 2019 11:19:34 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B0220801E78; Fri, 13 Dec 2019 16:19:32 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4FB2810013D9; Fri, 13 Dec 2019 16:19:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253977; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dDg+807iArEhZjenX1sVcxomXSGnTRm3h/+PwfZNwvs=; b=Gj2W4usFRrgxLBACX4dgIZEGkSQUenrLaq/wS+4jBpU51JU15BoAH9M4M8/N4dH0N4UMl0 gOtAJ297u7+qNSJp6edzQ5wCxrhW6ntz2u+4lRkifvOCwINcL+aP7wpB0UUsbKCh6cZf/H qd+pXc/gRS6RF3dq8BJaT75/op6lEjg= From: Cornelia Huck To: Peter Maydell Subject: [PULL 09/16] s390x: Fix cpu normal reset ri clearing Date: Fri, 13 Dec 2019 17:18:44 +0100 Message-Id: <20191213161851.24687-10-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: ukCo8MLUObqTV-W3J6NHlQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org, Janosch Frank Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Janosch Frank As it turns out we need to clear the ri controls and PSW enablement bit to be architecture compliant. Signed-off-by: Janosch Frank Reviewed-by: Christian Borntraeger Message-Id: <20191203132813.2734-4-frankja@linux.ibm.com> Signed-off-by: Cornelia Huck --- target/s390x/cpu.c | 7 ++++++- target/s390x/cpu.h | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index bd39cb54b7aa..99ea09085a30 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -100,7 +100,7 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type = type) case S390_CPU_RESET_INITIAL: /* initial reset does not clear everything! */ memset(&env->start_initial_reset_fields, 0, - offsetof(CPUS390XState, end_reset_fields) - + offsetof(CPUS390XState, start_normal_reset_fields) - offsetof(CPUS390XState, start_initial_reset_fields)); =20 /* architectured initial value for Breaking-Event-Address register= */ @@ -123,6 +123,11 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type= type) &env->fpu_status); /* fall through */ case S390_CPU_RESET_NORMAL: + env->psw.mask &=3D ~PSW_MASK_RI; + memset(&env->start_normal_reset_fields, 0, + offsetof(CPUS390XState, end_reset_fields) - + offsetof(CPUS390XState, start_normal_reset_fields)); + env->pfault_token =3D -1UL; env->bpbc =3D false; break; diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index d2af13b345cc..7e1c18d59696 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -58,7 +58,6 @@ struct CPUS390XState { */ uint64_t vregs[32][2] QEMU_ALIGNED(16); /* vector registers */ uint32_t aregs[16]; /* access registers */ - uint8_t riccb[64]; /* runtime instrumentation control */ uint64_t gscb[4]; /* guarded storage control */ uint64_t etoken; /* etoken */ uint64_t etoken_extension; /* etoken extension */ @@ -114,6 +113,10 @@ struct CPUS390XState { uint64_t gbea; uint64_t pp; =20 + /* Fields up to this point are not cleared by normal CPU reset */ + struct {} start_normal_reset_fields; + uint8_t riccb[64]; /* runtime instrumentation control */ + /* Fields up to this point are cleared by a CPU reset */ struct {} end_reset_fields; =20 @@ -252,6 +255,7 @@ extern const VMStateDescription vmstate_s390_cpu; #undef PSW_SHIFT_ASC #undef PSW_MASK_CC #undef PSW_MASK_PM +#undef PSW_MASK_RI #undef PSW_SHIFT_MASK_PM #undef PSW_MASK_64 #undef PSW_MASK_32 @@ -273,6 +277,7 @@ extern const VMStateDescription vmstate_s390_cpu; #define PSW_MASK_CC 0x0000300000000000ULL #define PSW_MASK_PM 0x00000F0000000000ULL #define PSW_SHIFT_MASK_PM 40 +#define PSW_MASK_RI 0x0000008000000000ULL #define PSW_MASK_64 0x0000000100000000ULL #define PSW_MASK_32 0x0000000080000000ULL #define PSW_MASK_ESA_ADDR 0x000000007fffffffULL --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576254799; cv=none; d=zohomail.com; s=zohoarc; b=gqOxD7EAO0OWLCdJmgD/tqJrrL0HCuOoWgP3mdK7bBkAocPALgJrkAh68AFtEEx7/djvDb728nriX/C9v6JWzLsnUaVrR+xSOM7JWdsdGl0axEkCbBjP9eASs24apHJHPRRqUjoXq5wCFtxfol4JbGH1K0CFFRTNVnajF8NrS4A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576254799; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kQR2sdSqZ9cEX9aPchrW/IDdW8VYKLN4r4CJI+RiiHM=; b=Vlthcty4Jfdy+kiuMjcLPPgH4XTiA9vs0pGlYnsJhHaE85ptXhCWM+l79qfi2QgAKQALUBOhfvuLJqXXDHgL4MapgxRmcKiUXpjEvmybJdg8G3621ak/GYrYHqw9vSh69PLA7ptfBqwvPCJkjOQHBQrUYFeJ/bCLCaLWNmdZ6PE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576254799570284.00039116345863; Fri, 13 Dec 2019 08:33:19 -0800 (PST) Received: from localhost ([::1]:51146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnsU-0000dm-8w for importer@patchew.org; Fri, 13 Dec 2019 11:33:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40134) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnfH-0000cO-W0 for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnfG-0001qJ-RK for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:39 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:23366 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnfG-0001pB-Nl for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:38 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-69-JCZmTUviOqyEaf0LmEUlqw-1; Fri, 13 Dec 2019 11:19:36 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C63918014C1; Fri, 13 Dec 2019 16:19:34 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68315601B6; Fri, 13 Dec 2019 16:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253978; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kQR2sdSqZ9cEX9aPchrW/IDdW8VYKLN4r4CJI+RiiHM=; b=PNLwoK0gdSsUMrEikHz2m+lBW9ZTKo0mK76BCm3X4PXRPgzEGillokRrF00r4u+m4m8Ucc RUki7l4ypncIx0IO1ARSTq9cH6ElzelNo998+/7dRfweFM1zZCuyjpbt26RMA5lLoEkoek 2sA2BjWJyel8CfUVgxz93TCWdjONYvc= From: Cornelia Huck To: Peter Maydell Subject: [PULL 10/16] s390x/event-facility: Fix realize() error API violations Date: Fri, 13 Dec 2019 17:18:45 +0100 Message-Id: <20191213161851.24687-11-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: JCZmTUviOqyEaf0LmEUlqw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cornelia Huck , qemu-s390x@nongnu.org, David Hildenbrand , qemu-devel@nongnu.org, Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Markus Armbruster sclp_events_bus_realize() dereferences @errp when object_property_set_bool() fails. That's wrong; see the big comment in error.h. Introduced in commit f6102c329c "s390/sclp: rework sclp event facility initialization + device realization". No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand Message-Id: <20191204093625.14836-12-armbru@redhat.com> Signed-off-by: Cornelia Huck --- hw/s390x/event-facility.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 66205697ae75..cdcf9154c49e 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -339,14 +339,16 @@ out: =20 static void sclp_events_bus_realize(BusState *bus, Error **errp) { + Error *err =3D NULL; BusChild *kid; =20 /* TODO: recursive realization has to be done in common code */ QTAILQ_FOREACH(kid, &bus->children, sibling) { DeviceState *dev =3D kid->child; =20 - object_property_set_bool(OBJECT(dev), true, "realized", errp); - if (*errp) { + object_property_set_bool(OBJECT(dev), true, "realized", &err); + if (errp) { + error_propagate(errp, err); return; } } --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576255373; cv=none; d=zohomail.com; s=zohoarc; b=T4N172DSkoBdKbtPkISbU0GqAR74+XtqVz22wpSQOLQ4WbK0pAYsRVQkF7XEKyok4iDArvacQLObfGRzosw9V6w6Lu8zMqWOmWwIXIQnavIH6iIC6Klkh+TEw0CCoaY/BM8qXHGRf5f6oOnwmrdRTBpVQEiEBfEqVVKsQiz90Z0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576255373; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uw8RzRlPrWToSzICCddlif8igLPYf+K8CwNrzt2Ukug=; b=Yl4juEt36roU8d2ht4Zlib0HV0OdhpK9UbcOcyvfM1Z5HLR7Wbo4dmVSgrJuC6mzGNOdzi/LZUl+iVYhfJORCdXx44OEJnnF7+Cl+/Pe4efUz0rg3LXZNsHo7ROpUyjhAyV+AX2Stjvpbve0flLbSaUyifix3kPHoYpKhzp6PJI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576255373803143.46324639422699; Fri, 13 Dec 2019 08:42:53 -0800 (PST) Received: from localhost ([::1]:51282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifo1j-0004IG-Ql for importer@patchew.org; Fri, 13 Dec 2019 11:42:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41253) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnfN-0000lG-LC for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnfM-00022g-HP for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:45 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:52630 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnfM-00021k-DJ for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:44 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-2lovRvkRMeGBz613K5DIVA-1; Fri, 13 Dec 2019 11:19:40 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 436B3102C8C2; Fri, 13 Dec 2019 16:19:39 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E0D319C70; Fri, 13 Dec 2019 16:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253984; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uw8RzRlPrWToSzICCddlif8igLPYf+K8CwNrzt2Ukug=; b=bhlYHGbnDoEiQCcsMxDv+Znp57j05m7RNku3ufgZjjQf/QxTS/iDfrYpc+tZDYyDP9na3x AFaOT22oj21sh/IGb92f7pG9krx+X8L8PNMs9PDb5pCTdi57woi/MH3G/mZ2WWIt2zj2FQ enGRhGyjkqAy4Q2+5ElwkECyEdpPDSg= From: Cornelia Huck To: Peter Maydell Subject: [PULL 11/16] s390x/cpumodel: Fix feature property error API violations Date: Fri, 13 Dec 2019 17:18:46 +0100 Message-Id: <20191213161851.24687-12-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: 2lovRvkRMeGBz613K5DIVA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cornelia Huck , qemu-s390x@nongnu.org, David Hildenbrand , qemu-devel@nongnu.org, Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Markus Armbruster s390x-cpu property setters set_feature() and set_feature_group() dereference @errp when the visitor fails. That's wrong; see the big comment in error.h. Introduced in commit 0754f60429 "s390x/cpumodel: expose features and feature groups as properties". No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand Message-Id: <20191204093625.14836-13-armbru@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/cpu_models.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 7e92fb2e156d..6a29fd3ab113 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -987,6 +987,7 @@ static void get_feature(Object *obj, Visitor *v, const = char *name, static void set_feature(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { + Error *err =3D NULL; S390Feat feat =3D (S390Feat) opaque; DeviceState *dev =3D DEVICE(obj); S390CPU *cpu =3D S390_CPU(obj); @@ -1002,8 +1003,9 @@ static void set_feature(Object *obj, Visitor *v, cons= t char *name, return; } =20 - visit_type_bool(v, name, &value, errp); - if (*errp) { + visit_type_bool(v, name, &value, &err); + if (err) { + error_propagate(errp, err); return; } if (value) { @@ -1043,6 +1045,7 @@ static void get_feature_group(Object *obj, Visitor *v= , const char *name, static void set_feature_group(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { + Error *err =3D NULL; S390FeatGroup group =3D (S390FeatGroup) opaque; const S390FeatGroupDef *def =3D s390_feat_group_def(group); DeviceState *dev =3D DEVICE(obj); @@ -1059,8 +1062,9 @@ static void set_feature_group(Object *obj, Visitor *v= , const char *name, return; } =20 - visit_type_bool(v, name, &value, errp); - if (*errp) { + visit_type_bool(v, name, &value, &err); + if (err) { + error_propagate(errp, err); return; } if (value) { --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576255482; cv=none; d=zohomail.com; s=zohoarc; b=Qab99nCw7Q6VcSD8XvlvFh42OVBKZW1a2iWEDbz7Xz96PwXqFW+U8JhhaCr/qgZIZBocq+57rjH/oN9rGYyXGTZagyQKwqbfwKtGDBj8f4uzAFVXau8THOZLSEpwzWQcYw25yhQa3aClzZKDbsJexV/XMu7m5RqbSo4nAUO3I6A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576255482; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XW33OjbNZfIzOzwZ5W3uHfwF9YmS9RFQ9HoMdM6KrBs=; b=kT/CltTenFLvazBylvdxmS0xJ+4JUTSwMvKuimWP63TMBj1IJIkZZZqBpdlgou5i728ke8lKRCrcTSHUUyO2+iLHrbnLnVsAY27fefnA+dheXY0X3KlqFsA7QvzS5K4pIS4RckxKkjD1O4cGbcyKmJKafggQoCmA6M2dZNgaO+8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576255482839816.2607920220353; Fri, 13 Dec 2019 08:44:42 -0800 (PST) Received: from localhost ([::1]:51306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifo3V-0006FE-EC for importer@patchew.org; Fri, 13 Dec 2019 11:44:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41753) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnfQ-0000ow-4B for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnfO-00027W-R8 for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:48 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:38967 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnfO-00026S-MU for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:46 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-434-uvdHpbiUOwCr2z9JwiZJDw-1; Fri, 13 Dec 2019 11:19:42 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6989618557E5; Fri, 13 Dec 2019 16:19:41 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F258919C70; Fri, 13 Dec 2019 16:19:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XW33OjbNZfIzOzwZ5W3uHfwF9YmS9RFQ9HoMdM6KrBs=; b=Ve0oNWM8tZdKoA5HKlMaNBYDhRdUlp+VVb7SaY+Nr/WEQEsKOMotXQKER66a9EYNE5fEoM saT0n0O14vGdyQvd2k0Lej27NRxAgvcDAid/QqszAhnIiuQgS75mu6vA8NzFZarhGxQyYA 3HdX1FM1KhGH3rZNw6Z7/mupOQ+iigk= From: Cornelia Huck To: Peter Maydell Subject: [PULL 12/16] s390x/cpumodel: Fix realize() error API violations Date: Fri, 13 Dec 2019 17:18:47 +0100 Message-Id: <20191213161851.24687-13-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: uvdHpbiUOwCr2z9JwiZJDw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cornelia Huck , qemu-s390x@nongnu.org, David Hildenbrand , qemu-devel@nongnu.org, Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Markus Armbruster get_max_cpu_model() dereferences @errp when kvm_s390_get_host_cpu_model() fails, apply_cpu_model() dereferences it when kvm_s390_apply_cpu_model() fails, and s390_realize_cpu_model() dereferences it when get_max_cpu_model() or check_compatibility() fail. That's wrong; see the big comment in error.h. All three introduced in commit 80560137cf "s390x/cpumodel: check and apply the CPU model". No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand Message-Id: <20191204093625.14836-14-armbru@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/cpu_models.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 6a29fd3ab113..c702e34a26b9 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -870,6 +870,7 @@ static void check_compatibility(const S390CPUModel *max= _model, =20 static S390CPUModel *get_max_cpu_model(Error **errp) { + Error *err =3D NULL; static S390CPUModel max_model; static bool cached; =20 @@ -878,22 +879,24 @@ static S390CPUModel *get_max_cpu_model(Error **errp) } =20 if (kvm_enabled()) { - kvm_s390_get_host_cpu_model(&max_model, errp); + kvm_s390_get_host_cpu_model(&max_model, &err); } else { max_model.def =3D s390_find_cpu_def(QEMU_MAX_CPU_TYPE, QEMU_MAX_CP= U_GEN, QEMU_MAX_CPU_EC_GA, NULL); bitmap_copy(max_model.features, qemu_max_cpu_feat, S390_FEAT_MAX); - } - if (!*errp) { - cached =3D true; - return &max_model; } - return NULL; + if (err) { + error_propagate(errp, err); + return NULL; + } + cached =3D true; + return &max_model; } =20 static inline void apply_cpu_model(const S390CPUModel *model, Error **errp) { #ifndef CONFIG_USER_ONLY + Error *err =3D NULL; static S390CPUModel applied_model; static bool applied; =20 @@ -909,20 +912,23 @@ static inline void apply_cpu_model(const S390CPUModel= *model, Error **errp) } =20 if (kvm_enabled()) { - kvm_s390_apply_cpu_model(model, errp); + kvm_s390_apply_cpu_model(model, &err); + if (err) { + error_propagate(errp, err); + return; + } } =20 - if (!*errp) { - applied =3D true; - if (model) { - applied_model =3D *model; - } + applied =3D true; + if (model) { + applied_model =3D *model; } #endif } =20 void s390_realize_cpu_model(CPUState *cs, Error **errp) { + Error *err =3D NULL; S390CPUClass *xcc =3D S390_CPU_GET_CLASS(cs); S390CPU *cpu =3D S390_CPU(cs); const S390CPUModel *max_model; @@ -939,7 +945,7 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) } =20 max_model =3D get_max_cpu_model(errp); - if (*errp) { + if (!max_model) { error_prepend(errp, "CPU models are not available: "); return; } @@ -951,8 +957,9 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) cpu->model->cpu_ver =3D max_model->cpu_ver; =20 check_consistency(cpu->model); - check_compatibility(max_model, cpu->model, errp); - if (*errp) { + check_compatibility(max_model, cpu->model, &err); + if (err) { + error_propagate(errp, err); return; } =20 --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576255120; cv=none; d=zohomail.com; s=zohoarc; b=aFpC1MGURwsiIqfXa8Trzw0LP3Ps0KIT9fAC3mEeBQQAJpA7Xa76qjGETazbWo3QItzGiRqbFRcXPvPSi6OGQDcnfG1yKy1lGFKGJIUTzAALeqE9J6et8lfr5Bzyp97TTcLBF2tO2HTsnHrCV7DzNvrJoub3R6eDEbiK+u6/mVg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576255120; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0n4kzHV7ijQhtr1OsgzkClrsjQtDJq/jf3/dxh+9j8I=; b=TrE6RII4sEMAbASiA8qtZ/ufB897k7BUWrEROKliRAH59KejQO59T31yz4GGB0OMX+2ru+SF1vxrNbmdNxdLLnpVo2pzq4BRP9/eUGP3qvr/IfH3Rce5UALyaaJ/qhFV/aizJCnVb7fERHY2vRJgf/eScQpcTv0/95TQGKE7SYk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15762551209321014.6528071336821; Fri, 13 Dec 2019 08:38:40 -0800 (PST) Received: from localhost ([::1]:51218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnxf-0006cW-CP for importer@patchew.org; Fri, 13 Dec 2019 11:38:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42224) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnfS-0000sf-FG for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnfR-0002CC-7p for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:50 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:34281 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnfR-0002B1-2g for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:49 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-146-Wdf2M40RPCOisdBVTM-BAQ-1; Fri, 13 Dec 2019 11:19:46 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CDC38593DB; Fri, 13 Dec 2019 16:19:45 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 198481CB; Fri, 13 Dec 2019 16:19:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253988; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0n4kzHV7ijQhtr1OsgzkClrsjQtDJq/jf3/dxh+9j8I=; b=VjDavv3efQcbSS+ObFSu2rbQqz3Oimd/ZZhFd/3qDU7W1Fglr9eRkzv3DPNccZG8HaBGGK 2X7XtLj+GEMgOWk2oZ0l1MJ6HF//CBDG98bu9lwaHW80SHBMRO/QnL5xOdbdEyedYKK3t1 fcinP0I1PQu3aAGWChYaASuEYnTAU2Q= From: Cornelia Huck To: Peter Maydell Subject: [PULL 13/16] s390x/cpumodel: Fix query-cpu-model-FOO error API violations Date: Fri, 13 Dec 2019 17:18:48 +0100 Message-Id: <20191213161851.24687-14-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: Wdf2M40RPCOisdBVTM-BAQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cornelia Huck , qemu-s390x@nongnu.org, David Hildenbrand , qemu-devel@nongnu.org, Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Markus Armbruster cpu_model_from_info() is a helper for qmp_query_cpu_model_expansion(), qmp_query_cpu_model_comparison(), qmp_query_cpu_model_baseline(). It dereferences @errp when the visitor or the QOM setter fails. That's wrong; see the big comment in error.h. Introduced in commit 137974cea3 's390x/cpumodel: implement QMP interface "query-cpu-model-expansion"'. Its three callers have the same issue. Introduced in commit 4e82ef0502 's390x/cpumodel: implement QMP interface "query-cpu-model-comparison"' and commit f1a47d08ef 's390x/cpumodel: implement QMP interface "query-cpu-model-baseline"'. No caller actually passes null. Fix anyway: splice in a local Error *err, and error_propagate(). Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand Message-Id: <20191204093625.14836-15-armbru@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/cpu_models.c | 43 ++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index c702e34a26b9..3ed301b5e509 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -477,6 +477,7 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error = **errp) static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *i= nfo, Error **errp) { + Error *err =3D NULL; const QDict *qdict =3D NULL; const QDictEntry *e; Visitor *visitor; @@ -513,24 +514,26 @@ static void cpu_model_from_info(S390CPUModel *model, = const CpuModelInfo *info, =20 if (qdict) { visitor =3D qobject_input_visitor_new(info->props); - visit_start_struct(visitor, NULL, NULL, 0, errp); - if (*errp) { + visit_start_struct(visitor, NULL, NULL, 0, &err); + if (err) { + error_propagate(errp, err); visit_free(visitor); object_unref(obj); return; } for (e =3D qdict_first(qdict); e; e =3D qdict_next(qdict, e)) { - object_property_set(obj, visitor, e->key, errp); - if (*errp) { + object_property_set(obj, visitor, e->key, &err); + if (err) { break; } } - if (!*errp) { + if (!err) { visit_check_struct(visitor, errp); } visit_end_struct(visitor, NULL); visit_free(visitor); - if (*errp) { + if (err) { + error_propagate(errp, err); object_unref(obj); return; } @@ -595,13 +598,15 @@ CpuModelExpansionInfo *qmp_query_cpu_model_expansion(= CpuModelExpansionType type, CpuModelInfo *model, Error **errp) { + Error *err =3D NULL; CpuModelExpansionInfo *expansion_info =3D NULL; S390CPUModel s390_model; bool delta_changes =3D false; =20 /* convert it to our internal representation */ - cpu_model_from_info(&s390_model, model, errp); - if (*errp) { + cpu_model_from_info(&s390_model, model, &err); + if (err) { + error_propagate(errp, err); return NULL; } =20 @@ -634,18 +639,21 @@ CpuModelCompareInfo *qmp_query_cpu_model_comparison(C= puModelInfo *infoa, CpuModelInfo *infob, Error **errp) { + Error *err =3D NULL; CpuModelCompareResult feat_result, gen_result; CpuModelCompareInfo *compare_info; S390FeatBitmap missing, added; S390CPUModel modela, modelb; =20 /* convert both models to our internal representation */ - cpu_model_from_info(&modela, infoa, errp); - if (*errp) { + cpu_model_from_info(&modela, infoa, &err); + if (err) { + error_propagate(errp, err); return NULL; } - cpu_model_from_info(&modelb, infob, errp); - if (*errp) { + cpu_model_from_info(&modelb, infob, &err); + if (err) { + error_propagate(errp, err); return NULL; } compare_info =3D g_new0(CpuModelCompareInfo, 1); @@ -707,6 +715,7 @@ CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuM= odelInfo *infoa, CpuModelInfo *infob, Error **errp) { + Error *err =3D NULL; CpuModelBaselineInfo *baseline_info; S390CPUModel modela, modelb, model; uint16_t cpu_type; @@ -714,13 +723,15 @@ CpuModelBaselineInfo *qmp_query_cpu_model_baseline(Cp= uModelInfo *infoa, uint8_t max_gen; =20 /* convert both models to our internal representation */ - cpu_model_from_info(&modela, infoa, errp); - if (*errp) { + cpu_model_from_info(&modela, infoa, &err); + if (err) { + error_propagate(errp, err); return NULL; } =20 - cpu_model_from_info(&modelb, infob, errp); - if (*errp) { + cpu_model_from_info(&modelb, infob, &err); + if (err) { + error_propagate(errp, err); return NULL; } =20 --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576255267; cv=none; d=zohomail.com; s=zohoarc; b=OMHiHJHp/bbzdc+dIhImioZeyogE7EJJXeGoUoEwlEUY9BWUytcE/iZv3PBocEpNb7JFtjh7AlMiBoyGHQ6ScnT0j6tQiQy/mEI9PCRLV748nVUaiDab1z4v1Vlaoxrg6gvUy2pxRIy2QP23s2WN8iy4WV6e+WZkPnQSB+cVl50= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576255267; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NUXGDBlQgXoYfeFlI09A6bJOwoS+zELlXbUsMOsd9hg=; b=Bmv4DjyV4ekCCzlU7n+NGkmj2zRsdZvo/BiuIIdcUZ+xxCVBxoYUKAcqdqwcNduqGC6jWguMXPGSIYieNCLk290vvdAwwyvcuzBPVTCTYlcxUFoF+Cpp+yxm8JKM4O0H7+mZKsdc2HMlqjZEYdR2v9qC0W3TXVv/Y7WMvRAq/Ho= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576255267052909.3820057762533; Fri, 13 Dec 2019 08:41:07 -0800 (PST) Received: from localhost ([::1]:51254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifo01-0001eX-Io for importer@patchew.org; Fri, 13 Dec 2019 11:41:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42921) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnfW-0000x4-8I for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnfV-0002KW-8h for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:54 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:37443 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnfV-0002JR-4K for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:19:53 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-312-ZJPq1ky7PXyi8f5Mt83kOA-1; Fri, 13 Dec 2019 11:19:51 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A20F1856A67; Fri, 13 Dec 2019 16:19:50 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8386C10013D9; Fri, 13 Dec 2019 16:19:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NUXGDBlQgXoYfeFlI09A6bJOwoS+zELlXbUsMOsd9hg=; b=PSBzwFGYNdC9ED3GYd1704PkmV2AsisO9BotvWuLTWpN9H7wC9HI9r9slYJZpk+nBERZzz x2PmH6p8GH5oSDAZ6r5vNx+zeS8AMd9G8pPG2/0WWPyKF4gqaZ1GGkyGanCe59ltcTFeEY MLEfca31n+1+2apx5MgxvjlB12fsEJQ= From: Cornelia Huck To: Peter Maydell Subject: [PULL 14/16] s390x/cpumodel: Fix query-cpu-definitions error API violations Date: Fri, 13 Dec 2019 17:18:49 +0100 Message-Id: <20191213161851.24687-15-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: ZJPq1ky7PXyi8f5Mt83kOA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cornelia Huck , qemu-s390x@nongnu.org, David Hildenbrand , qemu-devel@nongnu.org, Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Markus Armbruster qmp_query_cpu_definitions() passes @errp to get_max_cpu_model(), then frees any error it gets back. This effectively ignores errors. Dereferencing @errp is wrong; see the big comment in error.h. Passing @errp is also wrong, because it works only as long as @errp is neither @error_fatal nor @error_abort. Introduced in commit 38cba1f4d8 "s390x: return unavailable features via query-cpu-definitions". No caller actually passes such @errp values. Fix anyway: simply pass NULL to get_max_cpu_model(). Cc: David Hildenbrand Cc: Cornelia Huck Signed-off-by: Markus Armbruster Reviewed-by: David Hildenbrand Message-Id: <20191204093625.14836-16-armbru@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/cpu_models.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 3ed301b5e509..547bab8ac392 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -462,11 +462,7 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error= **errp) .list =3D NULL, }; =20 - list_data.model =3D get_max_cpu_model(errp); - if (*errp) { - error_free(*errp); - *errp =3D NULL; - } + list_data.model =3D get_max_cpu_model(NULL); =20 object_class_foreach(create_cpu_model_list, TYPE_S390_CPU, false, &list_data); --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576254456; cv=none; d=zohomail.com; s=zohoarc; b=IH0ES/py5tSkw7wdW39DQIj84mOYgy0719hOe2fcoNZt8vGzw3oKXb+tyoYXoCeadjF5ZO/psvsDX85WzL+CFCq3/MsvjF9s9qC5vK0Wcj8OAYaWUuWUhwSStcwg9As4Fp50JQ0AzsWfFIQQaP83iDPXjxmHNQUqIAmmY9s1uDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576254456; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6R+tH7lHFJCm0FH/ixXdJNaTFOW/B3rF19L4hUlBtlU=; b=WNIoum80A18Un8ZcEb+YkXPoqrTyEGfWQLCnJGxRJAWZ3QPEShk4K7r4f1iHMPHTUJP03kZrUelyzbZPDuNMEmI8RJFKAxxe1vI+nuVnwvxPo34IY+tZHZupqZY8GRL7xkNPTbiVDO9nvj+nwph0Baew34Bp/LbDTxM05WOX+3g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576254456130624.964389248044; Fri, 13 Dec 2019 08:27:36 -0800 (PST) Received: from localhost ([::1]:51057 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnmw-0001F1-F1 for importer@patchew.org; Fri, 13 Dec 2019 11:27:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44378) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnfd-000184-Ok for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:20:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnfc-0002Yp-Nf for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:20:01 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:60735 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnfc-0002WT-JD for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:20:00 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-Aw8PrsvTP1GPqC3AQwjaOA-1; Fri, 13 Dec 2019 11:19:55 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F31A801E72; Fri, 13 Dec 2019 16:19:54 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CD3E601B6; Fri, 13 Dec 2019 16:19:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576253999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6R+tH7lHFJCm0FH/ixXdJNaTFOW/B3rF19L4hUlBtlU=; b=CYcgsjEA4vlIMzYCwQ0YcFpXmShm2oIjBSWTEU6l+9312a3+Eh9jq9RmJVf++8OhwhKGAJ oY53zmg1VikzoJ1lqbVVU2F8qhaay1ZCEhMN5zuO1cJjvDjPU3gEOQjh3ewC9EwAQVrLZN Si5326loJL/nDIDg54QFtJKJJDIjooo= From: Cornelia Huck To: Peter Maydell Subject: [PULL 15/16] s390x/tcg: clear local interrupts on reset normal Date: Fri, 13 Dec 2019 17:18:50 +0100 Message-Id: <20191213161851.24687-16-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Aw8PrsvTP1GPqC3AQwjaOA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We neglected to clean up pending interrupts and emergency signals; fix that. Message-Id: <20191206135404.16051-1-cohuck@redhat.com> Signed-off-by: Cornelia Huck Reviewed-by: David Hildenbrand --- target/s390x/cpu.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 7e1c18d59696..aa829e954cbf 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -98,10 +98,6 @@ struct CPUS390XState { =20 uint64_t cregs[16]; /* control registers */ =20 - int pending_int; - uint16_t external_call_addr; - DECLARE_BITMAP(emergency_signals, S390_MAX_CPUS); - uint64_t ckc; uint64_t cputm; uint32_t todpr; @@ -117,6 +113,10 @@ struct CPUS390XState { struct {} start_normal_reset_fields; uint8_t riccb[64]; /* runtime instrumentation control */ =20 + int pending_int; + uint16_t external_call_addr; + DECLARE_BITMAP(emergency_signals, S390_MAX_CPUS); + /* Fields up to this point are cleared by a CPU reset */ struct {} end_reset_fields; =20 --=20 2.21.0 From nobody Sun May 5 22:41:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576254617; cv=none; d=zohomail.com; s=zohoarc; b=gHpO6No95jbhc8qt81ou/dewwRsJkMqCazOgpPD61PnHSscOBFMgmzkJIJm9QdxJ5BiiX+lgwiPukG4Aied9Oegh+Y04JCz9hPME8Igleu4jmYEWfrq27EGBQehJ09H0oVh5R0Dhs9W0Vw5kClenbTmHcjZVU4q+A1+Xi5PXm5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576254617; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nbZyf1ZW8K5V3e1TBoi/wLdXPiQC4RLxVjDdCL55/kI=; b=ZBZBnSnGvI91gtnk2uMZiKiAq7Il16HLwkmrgQ/WBcp/DtW3hYuKnjf+6nDvAWFKK3zCRhPwlUcxNspdHYTRwSea/x3Nylg4zoGaXvqB7Dk505oexo1SqJv9emgBdCwAC3IrSmE/HQjqZDD3/b0laAF4zZ7ZTPspxMzjuYCrivM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576254617434613.8116967879729; Fri, 13 Dec 2019 08:30:17 -0800 (PST) Received: from localhost ([::1]:51082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnpX-0005VD-HD for importer@patchew.org; Fri, 13 Dec 2019 11:30:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44736) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifnff-0001Af-Jn for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:20:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifnfe-0002bl-8Q for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:20:03 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:37732 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ifnfe-0002ar-3W for qemu-devel@nongnu.org; Fri, 13 Dec 2019 11:20:02 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-203-1jw-cJVkO1qrYUf-CqvhkQ-1; Fri, 13 Dec 2019 11:20:00 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2739F107ACCA; Fri, 13 Dec 2019 16:19:59 +0000 (UTC) Received: from localhost (ovpn-116-226.ams2.redhat.com [10.36.116.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4EA5160BF3; Fri, 13 Dec 2019 16:19:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576254001; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nbZyf1ZW8K5V3e1TBoi/wLdXPiQC4RLxVjDdCL55/kI=; b=dnCEtIdAxwt7Of4I8L/W6HyIwVDhTYeYWfwy1fhLVY/lejoECbzJIde9m1ZRhB8tgtMO7d TvM0t/OuL77EIm0xXlJ0/qxKs5AXSKL6lebYeSsuOmnBZznd02hfofH9tsYnPqtFtfqLEx BV5jbxGvfrXx1qcuwnfISBtmChNTzAw= From: Cornelia Huck To: Peter Maydell Subject: [PULL 16/16] qga: fence guest-set-time if hwclock not available Date: Fri, 13 Dec 2019 17:18:51 +0100 Message-Id: <20191213161851.24687-17-cohuck@redhat.com> In-Reply-To: <20191213161851.24687-1-cohuck@redhat.com> References: <20191213161851.24687-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 1jw-cJVkO1qrYUf-CqvhkQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cornelia Huck , qemu-devel@nongnu.org, Michael Roth , qemu-s390x@nongnu.org, Laszlo Ersek Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The Posix implementation of guest-set-time invokes hwclock to set/retrieve the time to/from the hardware clock. If hwclock is not available, the user is currently informed that "hwclock failed to set hardware clock to system time", which is quite misleading. This may happen e.g. on s390x, which has a different timekeeping concept anyway. Let's check for the availability of the hwclock command and return QERR_UNSUPPORTED for guest-set-time if it is not available. Reviewed-by: Laszlo Ersek Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michael Roth Message-Id: <20191205115350.18713-1-cohuck@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Cornelia Huck --- qga/commands-posix.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 1c1a165daed8..0be301a4ea77 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -156,6 +156,17 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns= , Error **errp) pid_t pid; Error *local_err =3D NULL; struct timeval tv; + static const char hwclock_path[] =3D "/sbin/hwclock"; + static int hwclock_available =3D -1; + + if (hwclock_available < 0) { + hwclock_available =3D (access(hwclock_path, X_OK) =3D=3D 0); + } + + if (!hwclock_available) { + error_setg(errp, QERR_UNSUPPORTED); + return; + } =20 /* If user has passed a time, validate and set it. */ if (has_time) { @@ -195,7 +206,7 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns,= Error **errp) =20 /* Use '/sbin/hwclock -w' to set RTC from the system time, * or '/sbin/hwclock -s' to set the system time from RTC. */ - execle("/sbin/hwclock", "hwclock", has_time ? "-w" : "-s", + execle(hwclock_path, "hwclock", has_time ? "-w" : "-s", NULL, environ); _exit(EXIT_FAILURE); } else if (pid < 0) { --=20 2.21.0