From nobody Sun Feb 8 12:37:56 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 1532377873369221.51883310543928; Mon, 23 Jul 2018 13:31:13 -0700 (PDT) Received: from localhost ([::1]:36397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhU8-0004Cn-2U for importer@patchew.org; Mon, 23 Jul 2018 16:31:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhIY-0001fU-0P for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:19:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhIW-0002uc-S5 for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:19:13 -0400 Received: from mail-oi0-x22c.google.com ([2607:f8b0:4003:c06::22c]:44622) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhIW-0002sK-L4; Mon, 23 Jul 2018 16:19:12 -0400 Received: by mail-oi0-x22c.google.com with SMTP id s198-v6so3457170oih.11; Mon, 23 Jul 2018 13:19:12 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id d191-v6sm11783282oig.16.2018.07.23.13.19.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:19:10 -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=5HEaxBnYUa+eZPrZp0pDfk4ZGK07fx16EkXrj/q8N18=; b=BMOoNEdEVce1Zyv/iupeRN1sq3F4U0HPuSovKh7DzW/ROJM7nyWrLdbV4h8sSZ5Scr smL+7iMfx1OQVIUHNiYXBVkAZ2B5ebQ+V6Rs3I0j9L9d0oyc33U5MUvXTBSCSoyF3PzU nPA14fav/bEz1fzPxBy1aXuXWwDZK4/yvVcE3HH7jD0PW3MthncGxdl/SL6OyU70ew1x SLnRoT7v0yz7VcK1b9HBOBenu372joax+NxcH5WSBOk16eVja0sCkKlPcmlIgnP17+t4 ri2qid/Qckncxxn43Eo53m1pmGsqnMI5mzx3OTpUbnCTfd/rX8Q3gMqKRxs92P7AMjdO Bbkg== 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=5HEaxBnYUa+eZPrZp0pDfk4ZGK07fx16EkXrj/q8N18=; b=GBQMm2xeU4B2grXaXkNkZc9WsCez/CvxjIDURv6Fbj54IFeWA5grKPPAdTkg66XIZu gF920VkMRumK9jRrij5iV8Jei/oXwLFtWsKQaj+tVSw0dQslx/dCbOYYvGjHrXsvRZGy 5V4thXbTwz738PD640/1D9vlsQu9l/zG+iSn+BEnt1wPM8ptVDmSC9L0Y+4X7mtmV2Iu zX23BFQHHfCuax05LPl0CUafKvpCmsyG1QpygbIKJZ0TfCp6mAI8dJrVKGI4RwDilI7e nw39NEy8bNTD8wc7UrID5PbwKpKP5dADze+ny5q1XZB/8djfACu4zg8q0VaJOP/8aJqb q5zw== X-Gm-Message-State: AOUpUlHJaJb8AKxcjYC6XEo1fXmNUIrPlujj1GLAZ8HlYiUe5CsEjFFe EGTQZL1uGh5du87jmyPJX16ez/Is9TA= X-Google-Smtp-Source: AAOMgpfRpHNGokPN+mZhjEkw05iSQ1xenUKtHuur4oPNMr9TR9V2tUs7rBW+JdgQy1SVZ9w48F+xJA== X-Received: by 2002:aca:cdc2:: with SMTP id d185-v6mr319085oig.350.1532377151483; Mon, 23 Jul 2018 13:19:11 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:16:31 -0500 Message-Id: <20180723201748.25573-23-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-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::22c Subject: [Qemu-devel] [PATCH 22/99] 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 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.17.1