Re: [PATCH V4 4/6] mdev: introduce virtio device and its device ops

From: Jason Wang
Date: Fri Oct 18 2019 - 03:36:02 EST



On 2019/10/18 äå1:53, Alex Williamson wrote:
On Thu, 17 Oct 2019 18:48:34 +0800
Jason Wang<jasowang@xxxxxxxxxx> wrote:

This patch implements basic support for mdev driver that supports
virtio transport for kernel virtio driver.

Signed-off-by: Jason Wang<jasowang@xxxxxxxxxx>
---
drivers/vfio/mdev/mdev_core.c | 12 +++
include/linux/mdev.h | 4 +
include/linux/virtio_mdev.h | 151 ++++++++++++++++++++++++++++++++++
3 files changed, 167 insertions(+)
create mode 100644 include/linux/virtio_mdev.h

diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
index d0f3113c8071..5834f6b7c7a5 100644
--- a/drivers/vfio/mdev/mdev_core.c
+++ b/drivers/vfio/mdev/mdev_core.c
@@ -57,6 +57,18 @@ void mdev_set_vfio_ops(struct mdev_device *mdev,
}
EXPORT_SYMBOL(mdev_set_vfio_ops);
+/* Specify the virtio device ops for the mdev device, this
+ * must be called during create() callback for virtio mdev device.
+ */
+void mdev_set_virtio_ops(struct mdev_device *mdev,
+ const struct virtio_mdev_device_ops *virtio_ops)
+{
+ BUG_ON(mdev->class_id);
Nit, this one is a BUG_ON, but the vfio one is a WARN_ON. Thanks,

Alex


Let me fix in next version.

Thanks