qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: peter.maydell@linaro.org
Cc: agraf@suse.de, qemu-stable@nongnu.org, qemu-devel@nongnu.org,
	borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com,
	Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: [Qemu-devel] [PULL v3 for-2.4 01/11] virtio-ccw: complete handling of guest-initiated resets
Date: Thu,  2 Jul 2015 16:10:39 +0200	[thread overview]
Message-ID: <1435846249-20202-2-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1435846249-20202-1-git-send-email-cornelia.huck@de.ibm.com>

For a guest-initiated reset, we need to not only reset the virtio device,
but also reset the VirtioCcwDevice into a clean state. This includes
resetting the indicators, or else a guest will not be able to e.g.
switch from classic interrupts to adapter interrupts.

Split off this routine into a new function virtio_ccw_reset_virtio()
to make the distinction between resetting the virtio-related devices
and the base subchannel device clear.

CC: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 hw/s390x/virtio-ccw.c | 39 ++++++++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 9605bf4..2c81771 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -296,6 +296,25 @@ static int virtio_ccw_set_vqs(SubchDev *sch, uint64_t addr, uint32_t align,
     return 0;
 }
 
+static void virtio_ccw_reset_virtio(VirtioCcwDevice *dev, VirtIODevice *vdev)
+{
+    virtio_ccw_stop_ioeventfd(dev);
+    virtio_reset(vdev);
+    if (dev->indicators) {
+        release_indicator(&dev->routes.adapter, dev->indicators);
+        dev->indicators = NULL;
+    }
+    if (dev->indicators2) {
+        release_indicator(&dev->routes.adapter, dev->indicators2);
+        dev->indicators2 = NULL;
+    }
+    if (dev->summary_indicator) {
+        release_indicator(&dev->routes.adapter, dev->summary_indicator);
+        dev->summary_indicator = NULL;
+    }
+    dev->sch->thinint_active = false;
+}
+
 static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
 {
     int ret;
@@ -359,8 +378,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
         }
         break;
     case CCW_CMD_VDEV_RESET:
-        virtio_ccw_stop_ioeventfd(dev);
-        virtio_reset(vdev);
+        virtio_ccw_reset_virtio(dev, vdev);
         ret = 0;
         break;
     case CCW_CMD_READ_FEAT:
@@ -500,7 +518,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
             }
             if (virtio_set_status(vdev, status) == 0) {
                 if (vdev->status == 0) {
-                    virtio_reset(vdev);
+                    virtio_ccw_reset_virtio(dev, vdev);
                 }
                 if (status & VIRTIO_CONFIG_S_DRIVER_OK) {
                     virtio_ccw_start_ioeventfd(dev);
@@ -1081,21 +1099,8 @@ static void virtio_ccw_reset(DeviceState *d)
     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
     VirtIODevice *vdev = virtio_bus_get_device(&dev->bus);
 
-    virtio_ccw_stop_ioeventfd(dev);
-    virtio_reset(vdev);
+    virtio_ccw_reset_virtio(dev, vdev);
     css_reset_sch(dev->sch);
-    if (dev->indicators) {
-        release_indicator(&dev->routes.adapter, dev->indicators);
-        dev->indicators = NULL;
-    }
-    if (dev->indicators2) {
-        release_indicator(&dev->routes.adapter, dev->indicators2);
-        dev->indicators2 = NULL;
-    }
-    if (dev->summary_indicator) {
-        release_indicator(&dev->routes.adapter, dev->summary_indicator);
-        dev->summary_indicator = NULL;
-    }
 }
 
 static void virtio_ccw_vmstate_change(DeviceState *d, bool running)
-- 
2.4.5

  reply	other threads:[~2015-07-02 14:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-02 14:10 [Qemu-devel] [PULL v3 for-2.4 00/11] s390x patches for 2.4 Cornelia Huck
2015-07-02 14:10 ` Cornelia Huck [this message]
2015-07-02 14:10 ` [Qemu-devel] [PULL v3 for-2.4 02/11] css: mss/mcss-e vs. migration Cornelia Huck
2015-07-02 14:10 ` [Qemu-devel] [PULL v3 for-2.4 03/11] s390-ccw.img: Consume service interrupts Cornelia Huck
2015-07-02 14:10 ` [Qemu-devel] [PULL v3 for-2.4 04/11] s390-ccw.img: update Cornelia Huck
2015-07-02 14:10 ` [Qemu-devel] [PULL v3 for-2.4 05/11] s390x/css: Add a callback for when subchannel gets disabled Cornelia Huck
2015-07-02 14:10 ` [Qemu-devel] [PULL v3 for-2.4 06/11] s390x/virtio-ccw: add virtio set-revision call Cornelia Huck
2015-07-02 14:10 ` [Qemu-devel] [PULL v3 for-2.4 07/11] s390x/virtio-ccw: support virtio-1 set_vq format Cornelia Huck
2015-07-02 14:10 ` [Qemu-devel] [PULL v3 for-2.4 08/11] virtio-ccw: migrate ->revision Cornelia Huck
2015-07-07 11:32   ` Christian Borntraeger
2015-07-07 11:47     ` [Qemu-devel] [PATCH] s390/virtio-ccw: Fix migration Christian Borntraeger
2015-07-07 14:24       ` Cornelia Huck
2015-07-02 14:10 ` [Qemu-devel] [PULL v3 for-2.4 09/11] s390x/ipl: Fix boot if no bootindex was specified Cornelia Huck
2015-07-02 14:10 ` [Qemu-devel] [PULL v3 for-2.4 10/11] s390x/gdb: synchronize cpu state after modifying acrs Cornelia Huck
2015-07-02 14:10 ` [Qemu-devel] [PULL v3 for-2.4 11/11] s390x/migration: Introduce 2.4 machine Cornelia Huck
2015-07-02 15:25 ` [Qemu-devel] [PULL v3 for-2.4 00/11] s390x patches for 2.4 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435846249-20202-2-git-send-email-cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).