From patchwork Sat Dec 14 09:45:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292145 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03E8314E3 for ; Sat, 14 Dec 2019 09:47:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BFDE920724 for ; Sat, 14 Dec 2019 09:47:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="B7ZOScmK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFDE920724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig41Y-0006GH-20 for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:47:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46845) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig3zY-0004Xy-Ab for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig3zX-0004Pz-Ar for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:40 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:34531 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 1ig3zW-0004Nc-T2 for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316738; 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=B7ZOScmK4QdTuZRVvHsYZ/PG2mYIiY7/IXfRPmvouQQeSwbBQhI0ixnON71ahwlKY5hDJB TI5HFTCj2QebqsIlsXZi2WJxfGsciet0xdB6XT87dk84b61rPW8e7wlVTElh78rbnTWoay yGKqTE3qzNLj7XpsasGa3/QXAwL1E04= 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-432-njYkWks1NhKysm8to5VQTA-1; Sat, 14 Dec 2019 04:45:36 -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 2BBD61800D63; Sat, 14 Dec 2019 09:45:35 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 73C425C28C; Sat, 14 Dec 2019 09:45:32 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 01/16] vfio-ccw: Fix error message Date: Sat, 14 Dec 2019 10:45:11 +0100 Message-Id: <20191214094526.8698-2-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: njYkWks1NhKysm8to5VQTA-1 X-Mimecast-Spam-Score: 0 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_Mathieu-Da?= =?utf-8?q?ud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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é 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 == EAGAIN) { goto again; } - error_report("vfio-ccw: wirte I/O region failed with errno=%d", errno); + error_report("vfio-ccw: write I/O region failed with errno=%d", errno); ret = -errno; } else { ret = region->ret_code; From patchwork Sat Dec 14 09:45:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292147 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60D2214BD for ; Sat, 14 Dec 2019 09:47:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3316C20724 for ; Sat, 14 Dec 2019 09:47:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Uf2fjZMd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3316C20724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig41j-0006RJ-Op for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:47:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49358) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig3zf-0004bU-MW for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig3zd-0004ld-SI for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:47 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:50887 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 1ig3zd-0004dv-BI for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316743; 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=naCs+RRcG6LuS3J8BIz8inRWeFD5rZn+hdbe+odExp0=; b=Uf2fjZMd6jMKqnBCEaI4HSKJf7VG4dV/hAwknLhyaU7wzuldh7Oi/ZXI5lR+AJjsfzQCr+ Aa+bDSC8T1ctcnMwR2q5wtsrORuDz3FNRpSWJxTmqRTv2xY7o6dzljpz5vrsizZl/X6TqV aGwfxzPKpK54MThQ9H9wxtdUJqiTJ84= 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-139-aNfg4UTaPZaDVAGCZFVn3w-1; Sat, 14 Dec 2019 04:45:41 -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 04AEA1800D63; Sat, 14 Dec 2019 09:45:40 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D9156776FB; Sat, 14 Dec 2019 09:45:36 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 02/16] hw: add compat machines for 5.0 Date: Sat, 14 Dec 2019 10:45:12 +0100 Message-Id: <20191214094526.8698-3-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: aNfg4UTaPZaDVAGCZFVn3w-1 X-Mimecast-Spam-Score: 0 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: qemu-s390x@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org, Eduardo Habkost , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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/i386/pc.c | 3 +++ hw/i386/pc_piix.c | 14 +++++++++++++- hw/i386/pc_q35.c | 13 ++++++++++++- hw/ppc/spapr.c | 13 ++++++++++++- hw/s390x/s390-virtio-ccw.c | 13 ++++++++++++- include/hw/i386/pc.h | 3 +++ 7 files changed, 61 insertions(+), 5 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index bf4b1cbfb868..33dfc8ea62c3 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2147,11 +2147,16 @@ static void machvirt_machine_init(void) } type_init(machvirt_machine_init); +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) { compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len); } -DEFINE_VIRT_MACHINE_AS_LATEST(4, 2) +DEFINE_VIRT_MACHINE(4, 2) static void virt_machine_4_1_options(MachineClass *mc) { 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 @@ struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX}; +GlobalProperty pc_compat_4_2[] = {}; +const size_t pc_compat_4_2_len = G_N_ELEMENTS(pc_compat_4_2); + GlobalProperty pc_compat_4_1[] = {}; const size_t pc_compat_4_1_len = G_N_ELEMENTS(pc_compat_4_1); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 87aced0742ec..ffb30c32ce94 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); } -static void pc_i440fx_4_2_machine_options(MachineClass *m) +static void pc_i440fx_5_0_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_i440fx_machine_options(m); @@ -434,6 +434,18 @@ static void pc_i440fx_4_2_machine_options(MachineClass *m) compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len); } +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 = NULL; + m->is_default = 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); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 2608cd00623c..7398d7baa27d 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 = 288; } -static void pc_q35_4_2_machine_options(MachineClass *m) +static void pc_q35_5_0_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_q35_machine_options(m); @@ -357,6 +357,17 @@ static void pc_q35_4_2_machine_options(MachineClass *m) compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len); } +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 = 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); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 2ca92f214819..3ae7db156303 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4491,15 +4491,26 @@ static const TypeInfo spapr_machine_info = { } \ type_init(spapr_machine_register_##suffix) +/* + * 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) { + spapr_machine_5_0_class_options(mc); compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len); } -DEFINE_SPAPR_MACHINE(4_2, "4.2", true); +DEFINE_SPAPR_MACHINE(4_2, "4.2", false); /* * pseries-4.1 diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index cb5fe4c84d87..01e7e209a5da 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -639,15 +639,26 @@ bool css_migration_enabled(void) } \ type_init(ccw_machine_register_##suffix) +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); } 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); static void ccw_machine_4_1_instance_options(MachineState *machine) { 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, MemoryRegion *rom_memory); void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, const CPUArchIdList *apic_ids, GArray *entry); +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; From patchwork Sat Dec 14 09:45:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292149 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D477414E3 for ; Sat, 14 Dec 2019 09:48:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A809420724 for ; Sat, 14 Dec 2019 09:48:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cukSXaEC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A809420724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig41o-0006Wm-TC for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:48:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51569) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig3zq-0004di-5F for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig3zo-00053z-5Y for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:57 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:31579 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 1ig3zm-0004t7-50 for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316750; 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=cukSXaECzjnGwTdFR+s0jOLTFaJD0cSeu+Fh5P3qeiMSLcDJNYrI/4tRWNuAXuTjRwZSmH j2v+qHuIOkPeNegoz1PdMnze2t0ZnayD/X3c8qeQbkYGJUdVX6WS1G5pauTSnZ4gc66Xqz izy7HuHJEPV1Tblb/ez+92jN8EDuJfU= 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-253-_Fx-JGgUMZ6-41D5_LNC1g-1; Sat, 14 Dec 2019 04:45:45 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 59F5F8017DF; Sat, 14 Dec 2019 09:45:44 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF3335D9C9; Sat, 14 Dec 2019 09:45:41 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 03/16] s390x: Don't do a normal reset on the initial cpu Date: Sat, 14 Dec 2019 10:45:13 +0100 Message-Id: <20191214094526.8698-4-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: _Fx-JGgUMZ6-41D5_LNC1g-1 X-Mimecast-Spam-Score: 0 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, Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 == cs) { + continue; + } run_on_cpu(t, s390_do_cpu_reset, RUN_ON_CPU_NULL); } subsystem_reset(); From patchwork Sat Dec 14 09:45:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292157 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F29414BD for ; Sat, 14 Dec 2019 09:51:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7043920724 for ; Sat, 14 Dec 2019 09:51:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Es3XfLgW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7043920724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig44i-0001wP-CD for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:51:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51913) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig3zr-0004ek-J6 for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig3zo-00055T-SE for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:58 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:56450 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 1ig3zo-0004z3-2T for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316753; 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=Es3XfLgWINhFClJM0OMNP+OByw6QJ1qid/ek4lSHYRVChsMgHL9Qwd1yp+T6Kes0Ttofez QDVruPY77xDlNeVZE03OZ/scQLuUPuUOP0cM219soEnL7TnO2Gs75lruulKNabhA6yIdTy jCYmZo3+Ig0tvFyrekjhWTgLmFWLIzA= 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-383-zrqgrOdGP2KfnOT_1cEaxg-1; Sat, 14 Dec 2019 04:45:49 -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 AE9971800D63; Sat, 14 Dec 2019 09:45:48 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 11C5260BF3; Sat, 14 Dec 2019 09:45:45 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 04/16] s390x: Move reset normal to shared reset handler Date: Sat, 14 Dec 2019 10:45:14 +0100 Message-Id: <20191214094526.8698-5-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: zrqgrOdGP2KfnOT_1cEaxg-1 X-Mimecast-Spam-Score: 0 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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; +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; 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 -/* 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 = S390_CPU(s); S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); CPUS390XState *env = &cpu->env; - env->pfault_token = -1UL; - env->bpbc = false; scc->parent_reset(s); cpu->env.sigp_order = 0; s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); + + switch (type) { + case S390_CPU_RESET_NORMAL: + env->pfault_token = -1UL; + env->bpbc = false; + break; + default: + g_assert_not_reached(); + } } /* S390CPUClass::initial_reset() */ @@ -102,7 +109,7 @@ static void s390_cpu_initial_reset(CPUState *s) S390CPU *cpu = S390_CPU(s); CPUS390XState *env = &cpu->env; - 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 = s390_cpu_load_normal; #endif - scc->cpu_reset = s390_cpu_reset; + scc->reset = s390_cpu_reset; scc->initial_cpu_reset = s390_cpu_initial_reset; cc->reset = s390_cpu_full_reset; cc->class_by_name = 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 = S390_CPU_GET_CLASS(cs); - scc->cpu_reset(cs); + scc->reset(cs, S390_CPU_RESET_NORMAL); } 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_data arg) SigpInfo *si = arg.host_ptr; cpu_synchronize_state(cs); - scc->cpu_reset(cs); + scc->reset(cs, S390_CPU_RESET_NORMAL); cpu_synchronize_post_reset(cs); si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; } From patchwork Sat Dec 14 09:45:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292159 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1936314E3 for ; Sat, 14 Dec 2019 09:52:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9994520700 for ; Sat, 14 Dec 2019 09:52:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Yuem2/Rv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9994520700 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig46M-0004Fj-II for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:52:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51894) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig3zr-0004ej-JD for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig3zo-00055O-R9 for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:58 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:37012 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 1ig3zo-00051z-GG for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316755; 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=Yuem2/RvGJbkue4b2sMaPI+C4BBlXcL8tHqHHwPGNcAlHSw3TC+L9afDzPcbDnJ7lLwAOL BleI32BX1WUV5So8jRWkZQK5rkY6WHnR0StV1Kxbuz+qSmm+sfDJpgid+Jj4dwgjO0ffbZ y77zal7Ah6ckuvUMI9Si/QnEs3Qot+A= 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-429-Mbr1gCFYMJ2PlF6NMf7zEA-1; Sat, 14 Dec 2019 04:45:52 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C4229107ACC7; Sat, 14 Dec 2019 09:45:50 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6575E5D9C9; Sat, 14 Dec 2019 09:45:50 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 05/16] s390x: Move initial reset Date: Sat, 14 Dec 2019 10:45:15 +0100 Message-Id: <20191214094526.8698-6-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: Mbr1gCFYMJ2PlF6NMf7zEA-1 X-Mimecast-Spam-Score: 0 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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; typedef enum cpu_reset_type { S390_CPU_RESET_NORMAL, + S390_CPU_RESET_INITIAL, } cpu_reset_type; /** @@ -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; 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 type) s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); 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 = 1; + + /* architectured initial values for CR 0 and 14 */ + env->cregs[0] = CR0_RESET; + env->cregs[14] = 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 = -1UL; env->bpbc = 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 = S390_CPU(s); - CPUS390XState *env = &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] = CR0_RESET; - env->cregs[14] = CR14_RESET; - - /* architectured initial value for Breaking-Event-Address register */ - env->gbea = 1; - - env->pfault_token = -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()) { + if (kvm_enabled() && type != 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 = s390_cpu_load_normal; #endif scc->reset = s390_cpu_reset; - scc->initial_cpu_reset = s390_cpu_initial_reset; cc->reset = s390_cpu_full_reset; cc->class_by_name = s390_cpu_class_by_name, cc->has_work = 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 = S390_CPU_GET_CLASS(cs); - scc->initial_cpu_reset(cs); + scc->reset(cs, S390_CPU_RESET_INITIAL); } static inline void s390_do_cpu_load_normal(CPUState *cs, run_on_cpu_data arg) 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 = arg.host_ptr; cpu_synchronize_state(cs); - scc->initial_cpu_reset(cs); + scc->reset(cs, S390_CPU_RESET_INITIAL); cpu_synchronize_post_reset(cs); si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; } From patchwork Sat Dec 14 09:45:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292155 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 108A814BD for ; Sat, 14 Dec 2019 09:50:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D759520724 for ; Sat, 14 Dec 2019 09:50:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NHLGGDf0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D759520724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig44e-0001qK-MK for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:50:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52410) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig3zt-0004gX-7j for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig3zr-0005CI-M8 for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:01 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:60803 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 1ig3zq-00058e-IS for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:45:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316757; 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=NHLGGDf0w/LtfFvu0q+ypDHpy9K39LMvAegu8hPm7McPFs6mngRyeK73y2FIv9/5y/+/8o 0ed1IlAY5cjzRSV/HFEBkm0DdRJv1DDKVg8esz9/kl02PY6KbfQbfhp4uk9MEQ/usaLu1t U/puJ3GPDjTvn8OP7Z7pIuY4vKh8cLg= 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-336-DE2GxzKHPY23VjyfP3r7sw-1; Sat, 14 Dec 2019 04:45:53 -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 D72A91800D63; Sat, 14 Dec 2019 09:45:52 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 78DD960BF3; Sat, 14 Dec 2019 09:45:52 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 06/16] s390x: Move clear reset Date: Sat, 14 Dec 2019 10:45:16 +0100 Message-Id: <20191214094526.8698-7-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: DE2GxzKHPY23VjyfP3r7sw-1 X-Mimecast-Spam-Score: 0 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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; /** 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 type) s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); 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] = CR0_RESET; env->cregs[14] = CR14_RESET; +#if defined(CONFIG_USER_ONLY) + /* user mode should always be allowed to use the full FPU */ + env->cregs[0] |= CR0_AFP; + if (s390_has_feat(S390_FEAT_VECTOR)) { + env->cregs[0] |= 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) } } -/* CPUClass:reset() */ -static void s390_cpu_full_reset(CPUState *s) -{ - S390CPU *cpu = S390_CPU(s); - S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); - CPUS390XState *env = &cpu->env; - - scc->parent_reset(s); - cpu->env.sigp_order = 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] = CR0_RESET; - env->cregs[14] = CR14_RESET; - -#if defined(CONFIG_USER_ONLY) - /* user mode should always be allowed to use the full FPU */ - env->cregs[0] |= CR0_AFP; - if (s390_has_feat(S390_FEAT_VECTOR)) { - env->cregs[0] |= CR0_VECTOR; - } -#endif - - /* architectured initial value for Breaking-Event-Address register */ - env->gbea = 1; - - env->pfault_token = -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[] = { DEFINE_PROP_END_OF_LIST() }; +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 = S390_CPU_CLASS(oc); @@ -472,7 +448,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) scc->load_normal = s390_cpu_load_normal; #endif scc->reset = s390_cpu_reset; - cc->reset = s390_cpu_full_reset; + cc->reset = s390_cpu_reset_full; cc->class_by_name = s390_cpu_class_by_name, cc->has_work = s390_cpu_has_work; #ifdef CONFIG_TCG From patchwork Sat Dec 14 09:45:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292165 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7AE8614E3 for ; Sat, 14 Dec 2019 09:54:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D4B220700 for ; Sat, 14 Dec 2019 09:54:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Jl6HzmMd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D4B220700 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig485-00070i-9M for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:54:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53516) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig3zv-0004kV-W8 for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig3zu-0005M6-KO for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:03 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:47412 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 1ig3zu-0005K7-BG for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316761; 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=Jl6HzmMdSfnnE7pq/RC752Fs4JuATrz0/3o0jBEWsam82w8N/QNl4FKPChFV8pIER3pnXs RfTfrAJTWJUa/bX46TWFFFEI8mnCLA57gGdMAkFZJNBfiZGLSQD3jUTA/l8t+eW6TNOXKE NiMGInO9VxFr6Y5OXDbgxuVPd5Ne1Hc= 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-191-NJ36G41AM6OqRjOExXUqbg-1; Sat, 14 Dec 2019 04:45:58 -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 4D7258017DF; Sat, 14 Dec 2019 09:45:57 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 90F2360474; Sat, 14 Dec 2019 09:45:54 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 07/16] s390x: Beautify diag308 handling Date: Sat, 14 Dec 2019 10:45:17 +0100 Message-Id: <20191214094526.8698-8-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: NJ36G41AM6OqRjOExXUqbg-1 X-Mimecast-Spam-Score: 0 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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, uint64_t r3) #define DIAG_308_RC_NO_CONF 0x0102 #define DIAG_308_RC_INVALID 0x0402 +#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 addr, + 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 = env_cpu(env); @@ -65,30 +88,24 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra) return; } - if ((subcode & ~0x0ffffULL) || (subcode > 6)) { + if (subcode & ~0x0ffffULL) { s390_program_interrupt(env, PGM_SPECIFICATION, ra); return; } 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 = 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 = s390_ipl_get_iplb(); From patchwork Sat Dec 14 09:45:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292161 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7BBB614E3 for ; Sat, 14 Dec 2019 09:52:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4E50020700 for ; Sat, 14 Dec 2019 09:52:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AnV0MCwY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E50020700 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig46V-0004Sh-2x for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:52:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55178) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig400-0004qU-5J for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig3zy-0005as-U2 for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:07 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:47188 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 1ig3zy-0005Yy-Ou for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316766; 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=AnV0MCwYX5Oz4F9WtenpAXIqHP+Ku0rS75Izq09IvYCY2AsiXqvaHkShmI74zqGgEaUviG iaDSc+yObgyGmEMSX03fze3zeflSmBVsI3y5DUD+vG72e2Id6fFCzd04GgjKolvt4NCzwe exEqCC3TPmu9nwLOEKoQof9noVkd52Q= 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-154-cAJkG9n5Ooad7a7BY5a0lA-1; Sat, 14 Dec 2019 04:46:02 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A1F1F1800D63; Sat, 14 Dec 2019 09:46:01 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06A505D9C9; Sat, 14 Dec 2019 09:45:58 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 08/16] s390x: kvm: Make kvm_sclp_service_call void Date: Sat, 14 Dec 2019 10:45:18 +0100 Message-Id: <20191214094526.8698-9-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: cAJkG9n5Ooad7a7BY5a0lA-1 X-Mimecast-Spam-Score: 0 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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); } -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 = &cpu->env; uint64_t sccb; uint32_t code; - int r = 0; + int r; sccb = env->regs[ipbh0 & 0xf]; code = env->regs[(ipbh0 & 0xf0) >> 4]; @@ -1173,11 +1173,9 @@ static int kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run, r = 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); } 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 *run, uint8_t ipa1) setcc(cpu, 3); break; case PRIV_B2_SCLP_CALL: - rc = kvm_sclp_service_call(cpu, run, ipbh0); + kvm_sclp_service_call(cpu, run, ipbh0); break; default: rc = -1; From patchwork Sat Dec 14 09:45:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292163 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96D2A14BD for ; Sat, 14 Dec 2019 09:52:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 696B120700 for ; Sat, 14 Dec 2019 09:52:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jBCztNKZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 696B120700 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig46a-0004a5-7Q for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:52:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58664) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig409-00052x-8n for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig407-00063T-Ke for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:16 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:51684 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 1ig407-00060V-DN for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316774; 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=jBCztNKZZsNUkgCXjVpAhdJ9hbV3kJXwaJF/9TPXLMnaxcDv5KWoYm9UBxrC6i3PmP9mIZ Q8/VyTO2FSO6ZkEqvS1WvDvefvGqdToaBDn0Y+gOWBkMT75SA/vjkvJ7B5VmYa7i26gtWZ LYViCLOKMH11IkTrVmSqUBW/7o/Da/U= 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-30-nhxaX_vzOkS_uQ2esEwvdA-1; Sat, 14 Dec 2019 04:46:05 -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 C64AF107ACC4; Sat, 14 Dec 2019 09:46:03 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 668221000325; Sat, 14 Dec 2019 09:46:03 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 09/16] s390x: Fix cpu normal reset ri clearing Date: Sat, 14 Dec 2019 10:45:19 +0100 Message-Id: <20191214094526.8698-10-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: nhxaX_vzOkS_uQ2esEwvdA-1 X-Mimecast-Spam-Score: 0 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org, Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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)); /* 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 &= ~PSW_MASK_RI; + memset(&env->start_normal_reset_fields, 0, + offsetof(CPUS390XState, end_reset_fields) - + offsetof(CPUS390XState, start_normal_reset_fields)); + env->pfault_token = -1UL; env->bpbc = 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; + /* 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; @@ -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 From patchwork Sat Dec 14 09:45:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292167 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AEA314BD for ; Sat, 14 Dec 2019 09:54:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E268D20700 for ; Sat, 14 Dec 2019 09:54:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FBqGh+gu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E268D20700 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig48B-0007C6-JH for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:54:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57868) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig406-0004zw-Vd for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig405-0005wa-Ny for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:14 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:45315 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 1ig405-0005sp-Gf for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316772; 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=FBqGh+guGnHNQn4zO1dtdYMumJUA7RpdnGKuPu1gAZy7Y7ig6RRsBjJHx4YxXqLOWRZmK4 GnKiaCnIWuFEpEiOSQ/caSzeTXAgjoee2NtxOcZvwt7agrT405ABZwSA4o42aEZ17ta6D2 +wtgWAVLcu+3DHrgNKToTpgFz9lfjqk= 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-240-vadwplfWN7OrIK47VM9irw-1; Sat, 14 Dec 2019 04:46:09 -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 632AA1800D63; Sat, 14 Dec 2019 09:46:08 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 801B45C28C; Sat, 14 Dec 2019 09:46:05 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 10/16] s390x/event-facility: Fix realize() error API violations Date: Sat, 14 Dec 2019 10:45:20 +0100 Message-Id: <20191214094526.8698-11-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: vadwplfWN7OrIK47VM9irw-1 X-Mimecast-Spam-Score: 0 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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: static void sclp_events_bus_realize(BusState *bus, Error **errp) { + Error *err = NULL; BusChild *kid; /* TODO: recursive realization has to be done in common code */ QTAILQ_FOREACH(kid, &bus->children, sibling) { DeviceState *dev = kid->child; - 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; } } From patchwork Sat Dec 14 09:45:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292151 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D10EA14BD for ; Sat, 14 Dec 2019 09:49:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A3B0E20724 for ; Sat, 14 Dec 2019 09:49:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UKdvKUeo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A3B0E20724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig431-0007no-CV for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:49:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58006) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig407-00050M-9o for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig406-0005xR-1F for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:15 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:47970 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 1ig405-0005vP-SJ for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316773; 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=UKdvKUeoOSfqAgEtfDDba8Z1hLbrjrtxIEYLO9MS51S9HZSeYNm0Tr58LA+xoSJtOlxjAm 3O4SzG7fptM5t+08JxhC/+fMCA1oZCZHwUlxaNJf9Op0dA7rUB0MD3d8+Ko1zBi7b/WhQ8 8CFvPPOL+K7hkILjEyTniCxxjq3dEfY= 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-419-l85MMfPhPT-I5939l_beLg-1; Sat, 14 Dec 2019 04:46: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 7C60C477; Sat, 14 Dec 2019 09:46:10 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1A9EA5C28C; Sat, 14 Dec 2019 09:46:09 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 11/16] s390x/cpumodel: Fix feature property error API violations Date: Sat, 14 Dec 2019 10:45:21 +0100 Message-Id: <20191214094526.8698-12-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: l85MMfPhPT-I5939l_beLg-1 X-Mimecast-Spam-Score: 0 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 = NULL; S390Feat feat = (S390Feat) opaque; DeviceState *dev = DEVICE(obj); S390CPU *cpu = S390_CPU(obj); @@ -1002,8 +1003,9 @@ static void set_feature(Object *obj, Visitor *v, const char *name, return; } - 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 = NULL; S390FeatGroup group = (S390FeatGroup) opaque; const S390FeatGroupDef *def = s390_feat_group_def(group); DeviceState *dev = DEVICE(obj); @@ -1059,8 +1062,9 @@ static void set_feature_group(Object *obj, Visitor *v, const char *name, return; } - 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) { From patchwork Sat Dec 14 09:45:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292169 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6552B175D for ; Sat, 14 Dec 2019 09:54:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 37ED620700 for ; Sat, 14 Dec 2019 09:54:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SK1C6mBU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37ED620700 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig48H-0007KA-3J for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:54:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59667) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig40B-00056W-SZ for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig40A-0006A2-0L for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:19 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:22400 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 1ig409-00067Z-Me for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316777; 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=SK1C6mBUrcY79XrFj7vP+U7CKTDqjQpOe9R7uTHAFazCL5vk6s1JdtszMx7EakR8z3Ov3l GNY2fYzojYknTULDTJhPwX8bAgwyDOlKnsk0ULao3OUySGu8nY7pWqw6Kor+1MwUV1PX6+ BCc4HjYsaFHYXc3fV2hDbE0odlEL1IA= 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-403-Qw9is9HYNYalBd3cbC-RKg-1; Sat, 14 Dec 2019 04:46: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 961A28017DF; Sat, 14 Dec 2019 09:46:12 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 33C745C28C; Sat, 14 Dec 2019 09:46:12 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 12/16] s390x/cpumodel: Fix realize() error API violations Date: Sat, 14 Dec 2019 10:45:22 +0100 Message-Id: <20191214094526.8698-13-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: Qw9is9HYNYalBd3cbC-RKg-1 X-Mimecast-Spam-Score: 0 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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, static S390CPUModel *get_max_cpu_model(Error **errp) { + Error *err = NULL; static S390CPUModel max_model; static bool cached; @@ -878,22 +879,24 @@ static S390CPUModel *get_max_cpu_model(Error **errp) } 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 = s390_find_cpu_def(QEMU_MAX_CPU_TYPE, QEMU_MAX_CPU_GEN, QEMU_MAX_CPU_EC_GA, NULL); bitmap_copy(max_model.features, qemu_max_cpu_feat, S390_FEAT_MAX); - } - if (!*errp) { - cached = true; - return &max_model; } - return NULL; + if (err) { + error_propagate(errp, err); + return NULL; + } + cached = true; + return &max_model; } static inline void apply_cpu_model(const S390CPUModel *model, Error **errp) { #ifndef CONFIG_USER_ONLY + Error *err = NULL; static S390CPUModel applied_model; static bool applied; @@ -909,20 +912,23 @@ static inline void apply_cpu_model(const S390CPUModel *model, Error **errp) } if (kvm_enabled()) { - kvm_s390_apply_cpu_model(model, errp); + kvm_s390_apply_cpu_model(model, &err); + if (err) { + error_propagate(errp, err); + return; + } } - if (!*errp) { - applied = true; - if (model) { - applied_model = *model; - } + applied = true; + if (model) { + applied_model = *model; } #endif } void s390_realize_cpu_model(CPUState *cs, Error **errp) { + Error *err = NULL; S390CPUClass *xcc = S390_CPU_GET_CLASS(cs); S390CPU *cpu = S390_CPU(cs); const S390CPUModel *max_model; @@ -939,7 +945,7 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) } max_model = 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 = max_model->cpu_ver; 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; } From patchwork Sat Dec 14 09:45:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292173 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7325A138C for ; Sat, 14 Dec 2019 09:56:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4489220700 for ; Sat, 14 Dec 2019 09:56:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iGahlMmt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4489220700 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig4AH-00019q-Ay for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:56:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60533) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig40E-000596-DJ for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig40C-0006I2-IR for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:21 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:55580 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 1ig40C-0006F7-CS for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316779; 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=iGahlMmt4U5Sls1xt89mcoWszpOXtgtGvvCIk2uxng31yyMPAtzL8lZtrctiOzN30W8vBf Aw7QuLaq6IaWKKweVijXS5frs5WVfae4PvhUm5GsUAXUXWutNxz+2pHZDrKyjAIRWQUsTQ ek16MIJdMuCbNqpgDrOzekFndZCJfg8= 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-198-u3EfwV55N3CZCs0TkkbA-g-1; Sat, 14 Dec 2019 04:46:15 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC3181005510; Sat, 14 Dec 2019 09:46:14 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D2995D9CA; Sat, 14 Dec 2019 09:46:14 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 13/16] s390x/cpumodel: Fix query-cpu-model-FOO error API violations Date: Sat, 14 Dec 2019 10:45:23 +0100 Message-Id: <20191214094526.8698-14-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: u3EfwV55N3CZCs0TkkbA-g-1 X-Mimecast-Spam-Score: 0 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 *info, Error **errp) { + Error *err = NULL; const QDict *qdict = NULL; const QDictEntry *e; Visitor *visitor; @@ -513,24 +514,26 @@ static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *info, if (qdict) { visitor = 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 = qdict_first(qdict); e; e = 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 = NULL; CpuModelExpansionInfo *expansion_info = NULL; S390CPUModel s390_model; bool delta_changes = false; /* 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; } @@ -634,18 +639,21 @@ CpuModelCompareInfo *qmp_query_cpu_model_comparison(CpuModelInfo *infoa, CpuModelInfo *infob, Error **errp) { + Error *err = NULL; CpuModelCompareResult feat_result, gen_result; CpuModelCompareInfo *compare_info; S390FeatBitmap missing, added; S390CPUModel modela, modelb; /* 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 = g_new0(CpuModelCompareInfo, 1); @@ -707,6 +715,7 @@ CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *infoa, CpuModelInfo *infob, Error **errp) { + Error *err = NULL; CpuModelBaselineInfo *baseline_info; S390CPUModel modela, modelb, model; uint16_t cpu_type; @@ -714,13 +723,15 @@ CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *infoa, uint8_t max_gen; /* 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; } From patchwork Sat Dec 14 09:45:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292175 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F396175D for ; Sat, 14 Dec 2019 09:57:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 31CC820700 for ; Sat, 14 Dec 2019 09:57:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HshiFcgx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 31CC820700 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig4BR-0002QK-6j for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:57:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33638) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig40I-0005E6-Ud for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig40H-0006Tp-JR for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:26 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46324 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 1ig40F-0006Mc-MZ for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316781; 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=HshiFcgxCl7ugL5/lL93LEGoxiYiD1TSbBH3vHVVem36NLAW1UUtF8K+nXw5jaZX9cEOD9 MflO18ISwcGKAFekC0GJAHho+aNEYb+miHotwszDgp7IzsLH/2UR67jGl2K5oqg7ORwI7X whGGP0+1AZTsKjzr4RrbYizqi5i83Xs= 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-32-5-NJ2EcyPieO_6J_sSoCDw-1; Sat, 14 Dec 2019 04:46:20 -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 1AAF0800D4C; Sat, 14 Dec 2019 09:46:19 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6038D77BF3; Sat, 14 Dec 2019 09:46:16 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 14/16] s390x/cpumodel: Fix query-cpu-definitions error API violations Date: Sat, 14 Dec 2019 10:45:24 +0100 Message-Id: <20191214094526.8698-15-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 5-NJ2EcyPieO_6J_sSoCDw-1 X-Mimecast-Spam-Score: 0 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 = NULL, }; - list_data.model = get_max_cpu_model(errp); - if (*errp) { - error_free(*errp); - *errp = NULL; - } + list_data.model = get_max_cpu_model(NULL); object_class_foreach(create_cpu_model_list, TYPE_S390_CPU, false, &list_data); From patchwork Sat Dec 14 09:45:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292171 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3CA34175D for ; Sat, 14 Dec 2019 09:56:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0460620700 for ; Sat, 14 Dec 2019 09:56:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fQ84fC8g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0460620700 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig4A9-00010C-Vk for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:56:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34175) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig40K-0005ED-3w for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig40I-0006Zk-Ui for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:27 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:20635 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 1ig40I-0006WT-MA for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316786; 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=fQ84fC8gsNVWdGCK8GsdqYF2GyWxQ36DPRuso27hCF64fIjHxN7AFjRxpS32/stkf9+rOI cCYj3wDlRwWD4urDZ6+ByIyCswLQPrNuF75GzyzkunyDg6gAwQq3CLI5Ohw0sqDSOZ+R+z PxICDRJbPg4IIHmcCEI4rHAdevm6F10= 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-286-wIhzxU7fO_anBQhaqVarxQ-1; Sat, 14 Dec 2019 04:46:24 -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 67C3B800D4C; Sat, 14 Dec 2019 09:46:23 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CABA560BF3; Sat, 14 Dec 2019 09:46:20 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 15/16] s390x/tcg: clear local interrupts on reset normal Date: Sat, 14 Dec 2019 10:45:25 +0100 Message-Id: <20191214094526.8698-16-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: wIhzxU7fO_anBQhaqVarxQ-1 X-Mimecast-Spam-Score: 0 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 { uint64_t cregs[16]; /* control registers */ - 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 */ + 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; From patchwork Sat Dec 14 09:45:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 11292177 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBD3E13B6 for ; Sat, 14 Dec 2019 09:58:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E6A020700 for ; Sat, 14 Dec 2019 09:58:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SaaUd37t" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E6A020700 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig4CQ-0003Ri-No for patchwork-qemu-devel@patchwork.kernel.org; Sat, 14 Dec 2019 04:58:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36007) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ig40X-0005Md-J2 for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ig40O-0006os-0f for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:36 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:39880 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 1ig40N-0006mp-FS for qemu-devel@nongnu.org; Sat, 14 Dec 2019 04:46:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576316790; 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=SaaUd37tr6mWXxEh4w7QJFzXgPr+BlIWUTq9feOtUqzacJcF7ypkdyVQzfhpDaT3OkglHS c7JXeBEH9RpnryCItXSmCNX3wSAaGRUIok8jOejm+WBCVT0NYAMf7Evt0n3EQvNcIhrFe/ wg30nlNqljValxP6a8yM/UMECVzOOTs= 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-299-mli9XaguOgyNadWrUdvxHQ-1; Sat, 14 Dec 2019 04:46:29 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C7B3F1800D63; Sat, 14 Dec 2019 09:46:27 +0000 (UTC) Received: from localhost (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1ED5E5D9C9; Sat, 14 Dec 2019 09:46:24 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Subject: [PULL v2 16/16] qga: fence guest-set-time if hwclock not available Date: Sat, 14 Dec 2019 10:45:26 +0100 Message-Id: <20191214094526.8698-17-cohuck@redhat.com> In-Reply-To: <20191214094526.8698-1-cohuck@redhat.com> References: <20191214094526.8698-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: mli9XaguOgyNadWrUdvxHQ-1 X-Mimecast-Spam-Score: 0 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_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cornelia Huck , qemu-devel@nongnu.org, Michael Roth , qemu-s390x@nongnu.org, Laszlo Ersek Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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é Reviewed-by: Michael Roth Message-Id: <20191205115350.18713-1-cohuck@redhat.com> Reviewed-by: Philippe Mathieu-Daudé 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 = NULL; struct timeval tv; + static const char hwclock_path[] = "/sbin/hwclock"; + static int hwclock_available = -1; + + if (hwclock_available < 0) { + hwclock_available = (access(hwclock_path, X_OK) == 0); + } + + if (!hwclock_available) { + error_setg(errp, QERR_UNSUPPORTED); + return; + } /* 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) /* 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) {