qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	kvm@vger.kernel.org, qemu-devel@nongnu.org,
	qemu-s390x@nongnu.org
Cc: cohuck@redhat.com, borntraeger@de.ibm.com,
	bjsdjshi@linux.vnet.ibm.com, pasic@linux.vnet.ibm.com,
	pmorel@linux.vnet.ibm.com
Subject: [Qemu-devel] [RFC PATCH 2/3] vfio: ccw: introduce channel path irq
Date: Thu, 11 Jan 2018 04:04:20 +0100	[thread overview]
Message-ID: <20180111030421.31418-3-bjsdjshi@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180111030421.31418-1-bjsdjshi@linux.vnet.ibm.com>

This introduces a new irq for vfio-ccw to provide channel path
related event for userland.

Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
---
 drivers/s390/cio/vfio_ccw_ops.c     | 29 +++++++++++++++++++++--------
 drivers/s390/cio/vfio_ccw_private.h |  2 ++
 include/uapi/linux/vfio.h           |  1 +
 3 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c
index 9528fce2e7d9..972cfc8834fc 100644
--- a/drivers/s390/cio/vfio_ccw_ops.c
+++ b/drivers/s390/cio/vfio_ccw_ops.c
@@ -275,17 +275,20 @@ static int vfio_ccw_mdev_get_region_info(struct vfio_region_info *info,
 
 static int vfio_ccw_mdev_get_irq_info(struct vfio_irq_info *info)
 {
-	if (info->index != VFIO_CCW_IO_IRQ_INDEX)
+	switch (info->index) {
+	case VFIO_CCW_IO_IRQ_INDEX:
+	case VFIO_CCW_CHP_IRQ_INDEX:
+		info->count = 1;
+		info->flags = VFIO_IRQ_INFO_EVENTFD;
+		return 0;
+	default:
 		return -EINVAL;
-
-	info->count = 1;
-	info->flags = VFIO_IRQ_INFO_EVENTFD;
-
-	return 0;
+	}
 }
 
 static int vfio_ccw_mdev_set_irqs(struct mdev_device *mdev,
 				  uint32_t flags,
+				  unsigned index,
 				  void __user *data)
 {
 	struct vfio_ccw_private *private;
@@ -295,7 +298,17 @@ static int vfio_ccw_mdev_set_irqs(struct mdev_device *mdev,
 		return -EINVAL;
 
 	private = dev_get_drvdata(mdev_parent_dev(mdev));
-	ctx = &private->io_trigger;
+
+	switch (index) {
+	case VFIO_CCW_IO_IRQ_INDEX:
+		ctx = &private->io_trigger;
+		break;
+	case VFIO_CCW_CHP_IRQ_INDEX:
+		ctx = &private->chp_trigger;
+		break;
+	default:
+		return -EINVAL;
+	}
 
 	switch (flags & VFIO_IRQ_SET_DATA_TYPE_MASK) {
 	case VFIO_IRQ_SET_DATA_NONE:
@@ -433,7 +446,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev,
 			return ret;
 
 		data = (void __user *)(arg + minsz);
-		return vfio_ccw_mdev_set_irqs(mdev, hdr.flags, data);
+		return vfio_ccw_mdev_set_irqs(mdev, hdr.flags, hdr.index, data);
 	}
 	case VFIO_DEVICE_RESET:
 		return vfio_ccw_mdev_reset(mdev);
diff --git a/drivers/s390/cio/vfio_ccw_private.h b/drivers/s390/cio/vfio_ccw_private.h
index 460c8b90d834..da86f82dd7b9 100644
--- a/drivers/s390/cio/vfio_ccw_private.h
+++ b/drivers/s390/cio/vfio_ccw_private.h
@@ -33,6 +33,7 @@
  * @irb: irb info received from interrupt
  * @scsw: scsw info
  * @io_trigger: eventfd ctx for signaling userspace I/O results
+ * @chp_trigger: eventfd ctx for signaling userspace chp event
  * @io_work: work for deferral process of I/O handling
  */
 struct vfio_ccw_private {
@@ -50,6 +51,7 @@ struct vfio_ccw_private {
 	union scsw		scsw;
 
 	struct eventfd_ctx	*io_trigger;
+	struct eventfd_ctx	*chp_trigger;
 	struct work_struct	io_work;
 } __aligned(8);
 
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index c60244debf71..179a7492d53a 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -463,6 +463,7 @@ enum {
 
 enum {
 	VFIO_CCW_IO_IRQ_INDEX,
+	VFIO_CCW_CHP_IRQ_INDEX,
 	VFIO_CCW_NUM_IRQS
 };
 
-- 
2.13.5

  parent reply	other threads:[~2018-01-11  3:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11  3:04 [Qemu-devel] [RFC PATCH 0/3] vfio: ccw: basic channel path event handling Dong Jia Shi
2018-01-11  3:04 ` [Qemu-devel] [RFC PATCH 1/3] vfio: ccw: introduce schib region Dong Jia Shi
2018-01-11 14:16   ` Cornelia Huck
2018-01-15  6:43     ` Dong Jia Shi
2018-01-15 10:24       ` Cornelia Huck
2018-01-15  9:50   ` Pierre Morel
2018-01-15 12:24     ` Cornelia Huck
2018-01-16  3:03       ` Dong Jia Shi
2018-01-11  3:04 ` Dong Jia Shi [this message]
2018-01-11  3:04 ` [Qemu-devel] [RFC PATCH 3/3] vfio: ccw: handle chp event Dong Jia Shi
2018-01-11 10:54 ` [Qemu-devel] [RFC PATCH 0/3] vfio: ccw: basic channel path event handling Cornelia Huck
2018-01-15  8:57   ` Dong Jia Shi
2018-01-15 10:21     ` Pierre Morel
2018-01-16  3:16       ` Dong Jia Shi
2018-01-16 15:53         ` Cornelia Huck
2018-01-12 18:10 ` Halil Pasic
2018-01-15  8:59   ` Dong Jia Shi
2018-01-16 15:57     ` Halil Pasic
2018-01-23  6:23       ` Dong Jia Shi
2018-01-25 11:12         ` Cornelia Huck
2018-01-25 12:56         ` Halil Pasic
2018-01-30  3:37           ` Dong Jia Shi
2018-01-30  3:44             ` Dong Jia Shi
2018-01-30  5:27           ` Dong Jia Shi

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=20180111030421.31418-3-bjsdjshi@linux.vnet.ibm.com \
    --to=bjsdjshi@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pasic@linux.vnet.ibm.com \
    --cc=pmorel@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@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).