virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
To: mst@redhat.com, virtualization@lists.linux-foundation.org
Cc: borntraeger@de.ibm.com
Subject: [PATCH v3 RFC 4/4] virtio_ccw: set surprize_removal in virtio_device if a device was lost
Date: Wed, 27 Nov 2013 11:32:40 +0100	[thread overview]
Message-ID: <1385548360-31943-5-git-send-email-graalfs@linux.vnet.ibm.com> (raw)
In-Reply-To: <1385548360-31943-1-git-send-email-graalfs@linux.vnet.ibm.com>

Code is added to the notify handler to set the 'surprize_removal' flag
in virtio_device in case a CIO_GONE notification occurs. The remove
callback of the backend driver must check this flag in order to perform
special processing for a lost device.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
---
 drivers/s390/kvm/virtio_ccw.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index 35b9aaa..8f6c74a 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -27,6 +27,7 @@
 #include <linux/module.h>
 #include <linux/io.h>
 #include <linux/kvm_para.h>
+#include <linux/notifier.h>
 #include <asm/setup.h>
 #include <asm/irq.h>
 #include <asm/cio.h>
@@ -1064,8 +1065,19 @@ out_free:
 
 static int virtio_ccw_cio_notify(struct ccw_device *cdev, int event)
 {
-	/* TODO: Check whether we need special handling here. */
-	return 0;
+	int rc;
+	struct virtio_ccw_device *vcdev = dev_get_drvdata(&cdev->dev);
+
+	switch (event) {
+	case CIO_GONE:
+		vcdev->vdev.surprize_removal = true;
+		rc = NOTIFY_DONE;
+		break;
+	default:
+		rc = NOTIFY_DONE;
+		break;
+	}
+	return rc;
 }
 
 static struct ccw_device_id virtio_ids[] = {
-- 
1.8.3.1

  parent reply	other threads:[~2013-11-27 10:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 10:32 [PATCH v3 RFC 0/4] virtio: add 'surprize_removal' to virtio_device Heinz Graalfs
2013-11-27 10:32 ` [PATCH v3 RFC 1/4] virtio: add surprize_removal " Heinz Graalfs
2013-11-27 10:32 ` [PATCH v3 RFC 2/4] virtio_blk: avoid further request queueing on device loss Heinz Graalfs
2013-12-04  4:04   ` Rusty Russell
2013-11-27 10:32 ` [PATCH v3 RFC 3/4] virtio_blk: avoid calling blk_cleanup_queue() " Heinz Graalfs
2013-11-27 10:47   ` Michael S. Tsirkin
2013-11-27 11:37     ` Heinz Graalfs
2013-11-27 12:28       ` Michael S. Tsirkin
2013-11-27 12:49       ` Michael S. Tsirkin
2013-11-27 14:15         ` Heinz Graalfs
2013-11-27 14:37           ` Michael S. Tsirkin
2013-11-27 10:32 ` Heinz Graalfs [this message]
2013-11-27 10:49   ` [PATCH v3 RFC 4/4] virtio_ccw: set surprize_removal in virtio_device if a device was lost Michael S. Tsirkin

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=1385548360-31943-5-git-send-email-graalfs@linux.vnet.ibm.com \
    --to=graalfs@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.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).