From nobody Mon Feb 9 23:01:06 2026 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; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529378529204145.05429337232806; Mon, 18 Jun 2018 20:22:09 -0700 (PDT) Received: from localhost ([::1]:38994 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV7Dc-0002lL-DJ for importer@patchew.org; Mon, 18 Jun 2018 23:22:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5jn-0003G6-Vg for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:47:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5jm-0000wI-W0 for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:47:16 -0400 Received: from mail-oi0-x235.google.com ([2607:f8b0:4003:c06::235]:41489) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5jm-0000w2-Qu; Mon, 18 Jun 2018 21:47:14 -0400 Received: by mail-oi0-x235.google.com with SMTP id a141-v6so16696585oii.8; Mon, 18 Jun 2018 18:47:14 -0700 (PDT) Received: from localhost ([2600:1700:70:e488:b0ee:9bda:ee6f:91be]) by smtp.gmail.com with ESMTPSA id f64-v6sm8460031oib.10.2018.06.18.18.47.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:47:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=mFvF8XwxHWYHs0mlXrO+lkEeaM8MHCNJ+iNrOvWliIY=; b=VwMNYbJaUEn6WJDQpELpyl5xYaxpHU+7vq98+7ac1jLeyESSlqt2eLwCjOteJUPdbl CoO4u9/DjKHLPdVkW5UaANGzY/4PtW6d/DYMRFPyT2yl2MElex5tu0LBxXVbR5/sF0c2 PdfIZeZJ/u3eNLdkkFcNYJzZnSxOsQ7Xdw0JgOCAKszk4uP6jFxGyulzN3SeSJlOM0Yw PGnfYWPVmAP9NnM29NWwSplOfoE22/B2dGyTdk4tllVkSad3WOhoo5+V7tT9lxqjE7bB 9JH83sA9aaRWb3PmLaNyLe7k7D+UTCgx7+neeOFHeSYI9kwj+XAbTlB/DVvpX4PhG3Xp 5l4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=mFvF8XwxHWYHs0mlXrO+lkEeaM8MHCNJ+iNrOvWliIY=; b=FT8OS5kdhYjdgojw3wgFigiQBPqCH+GbS7smY8k8pD2YenWlrR9t4QethFViMJirFW UMDtj576fW+nWAclDVVA1V5/sD9XfDNpCnvIWTa8gDq+f9dugWvo7KxEoNSyvi3EfjYa J0h1REoGiTCjgK90TH46aVoYTkbO6YnQZ7HsOmym3CmgXcPaYLifEZO7ZsZ8+dLOZkc8 0mj1NX/BT8LIL5q7BeGyGnuonynr89dBP2EhW3heWaP9/0sbcqSjHVmDGNu2EVKnuSMg 3wtRtKwqZiMBOW6IW6bMb7/qtKekVVLkcBJYq91PipMvaTatzftYmQZuSi9IYoUEoOil HKIA== X-Gm-Message-State: APt69E2M/fQrDCkWu7ayPJwihwOQQrprH3GExs/fhogKSRFN6vIaQv1S RtZkkRYQFX40YsbWBJ3y3Qmxh6ucsZQ= X-Google-Smtp-Source: ADUXVKLIiV2z5PxcnRdLOl+2SsGK5p8PVBn8fsUdB3eSzWkUnQ5fXysuwkJ9nRojkqN1jSwbFqTi4Q== X-Received: by 2002:aca:e7c8:: with SMTP id e191-v6mr8040577oih.202.1529372833560; Mon, 18 Jun 2018 18:47:13 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:42:49 -0500 Message-Id: <20180619014319.28272-84-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::235 Subject: [Qemu-devel] [PATCH 083/113] 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: Cornelia Huck , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Cornelia Huck 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 (cherry picked from commit 838fb84f83c84f00d15b1bede5e080b495644458) Signed-off-by: Michael Roth --- 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 3197ca30be..e9a594ca86 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1057,10 +1057,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) @@ -1714,12 +1716,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.11.0