From nobody Sat Nov 1 07:50:15 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526312768013428.27736502619916; Mon, 14 May 2018 08:46:08 -0700 (PDT) Received: from localhost ([::1]:43986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIFfr-0000OT-9K for importer@patchew.org; Mon, 14 May 2018 11:46:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIFbN-0000JO-Le for qemu-devel@nongnu.org; Mon, 14 May 2018 11:41:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIFbM-0007XP-NW for qemu-devel@nongnu.org; Mon, 14 May 2018 11:41:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53930 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fIFbM-0007X6-JA; Mon, 14 May 2018 11:41:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D54AEC01A; Mon, 14 May 2018 15:41:28 +0000 (UTC) Received: from localhost (ovpn-117-57.ams2.redhat.com [10.36.117.57]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C718711166F0; Mon, 14 May 2018 15:41:27 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Date: Mon, 14 May 2018 17:41:12 +0200 Message-Id: <20180514154114.2558-5-cohuck@redhat.com> In-Reply-To: <20180514154114.2558-1-cohuck@redhat.com> References: <20180514154114.2558-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 14 May 2018 15:41:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 14 May 2018 15:41:28 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 4/6] s390x/ccw: make sure all ccw devices are properly reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , qemu-stable@nongnu.org, Cornelia Huck , Alexander Graf , qemu-devel@nongnu.org, Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Thomas reported that the subchannel for a 3270 device that ended up in a broken state (status pending even though not enabled) did not get out of that state even after a reboot (which involves a subsytem reset). The reason for this is that the 3270 device did not define a reset handler. Let's fix this by introducing a base reset handler (set up for all ccw devices) that resets the subchannel and have virtio-ccw call its virtio-specific reset procedure in addition to that. CC: qemu-stable@nongnu.org Reported-by: Thomas Huth Suggested-by: Christian Borntraeger Reviewed-by: Thomas Huth Tested-by: Thomas Huth Acked-by: Christian Borntraeger Reviewed-by: Halil Pasic Signed-off-by: Cornelia Huck --- hw/s390x/ccw-device.c | 8 ++++++++ hw/s390x/virtio-ccw.c | 9 ++++++--- hw/s390x/virtio-ccw.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c index f9bfa154d6..7cd73df4aa 100644 --- a/hw/s390x/ccw-device.c +++ b/hw/s390x/ccw-device.c @@ -40,6 +40,13 @@ static Property ccw_device_properties[] =3D { DEFINE_PROP_END_OF_LIST(), }; =20 +static void ccw_device_reset(DeviceState *d) +{ + CcwDevice *ccw_dev =3D CCW_DEVICE(d); + + css_reset_sch(ccw_dev->sch); +} + static void ccw_device_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -48,6 +55,7 @@ static void ccw_device_class_init(ObjectClass *klass, voi= d *data) k->realize =3D ccw_device_realize; k->refill_ids =3D ccw_device_refill_ids; dc->props =3D ccw_device_properties; + dc->reset =3D ccw_device_reset; } =20 const VMStateDescription vmstate_ccw_dev =3D { diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 40a33302a7..22df33b509 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1058,10 +1058,12 @@ static void virtio_ccw_reset(DeviceState *d) { VirtioCcwDevice *dev =3D VIRTIO_CCW_DEVICE(d); VirtIODevice *vdev =3D virtio_bus_get_device(&dev->bus); - CcwDevice *ccw_dev =3D CCW_DEVICE(d); + VirtIOCCWDeviceClass *vdc =3D VIRTIO_CCW_DEVICE_GET_CLASS(dev); =20 virtio_ccw_reset_virtio(dev, vdev); - css_reset_sch(ccw_dev->sch); + if (vdc->parent_reset) { + vdc->parent_reset(d); + } } =20 static void virtio_ccw_vmstate_change(DeviceState *d, bool running) @@ -1715,12 +1717,13 @@ static void virtio_ccw_device_class_init(ObjectClas= s *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); CCWDeviceClass *k =3D CCW_DEVICE_CLASS(dc); + VirtIOCCWDeviceClass *vdc =3D VIRTIO_CCW_DEVICE_CLASS(klass); =20 k->unplug =3D virtio_ccw_busdev_unplug; dc->realize =3D virtio_ccw_busdev_realize; dc->unrealize =3D virtio_ccw_busdev_unrealize; dc->bus_type =3D TYPE_VIRTUAL_CSS_BUS; - dc->reset =3D virtio_ccw_reset; + device_class_set_parent_reset(dc, virtio_ccw_reset, &vdc->parent_reset= ); } =20 static const TypeInfo virtio_ccw_device_info =3D { diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h index 2fc513001e..3453aa1f98 100644 --- a/hw/s390x/virtio-ccw.h +++ b/hw/s390x/virtio-ccw.h @@ -77,6 +77,7 @@ typedef struct VirtIOCCWDeviceClass { CCWDeviceClass parent_class; void (*realize)(VirtioCcwDevice *dev, Error **errp); void (*unrealize)(VirtioCcwDevice *dev, Error **errp); + void (*parent_reset)(DeviceState *dev); } VirtIOCCWDeviceClass; =20 /* Performance improves when virtqueue kick processing is decoupled from t= he --=20 2.14.3