Re: [PATCH V6 3/6] mdev: introduce device specific ops

From: Jason Wang
Date: Sun Nov 03 2019 - 21:52:33 EST



On 2019/11/2 äå4:11, Parav Pandit wrote:

-----Original Message-----
From: Jason Wang <jasowang@xxxxxxxxxx>
Sent: Wednesday, October 30, 2019 1:45 AM
To: kvm@xxxxxxxxxxxxxxx; linux-s390@xxxxxxxxxxxxxxx; linux-
kernel@xxxxxxxxxxxxxxx; dri-devel@xxxxxxxxxxxxxxxxxxxxx; intel-
gfx@xxxxxxxxxxxxxxxxxxxxx; intel-gvt-dev@xxxxxxxxxxxxxxxxxxxxx;
kwankhede@xxxxxxxxxx; alex.williamson@xxxxxxxxxx; mst@xxxxxxxxxx;
tiwei.bie@xxxxxxxxx
Cc: virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx;
cohuck@xxxxxxxxxx; maxime.coquelin@xxxxxxxxxx;
cunming.liang@xxxxxxxxx; zhihong.wang@xxxxxxxxx;
rob.miller@xxxxxxxxxxxx; xiao.w.wang@xxxxxxxxx;
haotian.wang@xxxxxxxxxx; zhenyuw@xxxxxxxxxxxxxxx; zhi.a.wang@xxxxxxxxx;
jani.nikula@xxxxxxxxxxxxxxx; joonas.lahtinen@xxxxxxxxxxxxxxx;
rodrigo.vivi@xxxxxxxxx; airlied@xxxxxxxx; daniel@xxxxxxxx;
farman@xxxxxxxxxxxxx; pasic@xxxxxxxxxxxxx; sebott@xxxxxxxxxxxxx;
oberpar@xxxxxxxxxxxxx; heiko.carstens@xxxxxxxxxx; gor@xxxxxxxxxxxxx;
borntraeger@xxxxxxxxxx; akrowiak@xxxxxxxxxxxxx; freude@xxxxxxxxxxxxx;
lingshan.zhu@xxxxxxxxx; Ido Shamay <idos@xxxxxxxxxxxx>;
eperezma@xxxxxxxxxx; lulu@xxxxxxxxxx; Parav Pandit
<parav@xxxxxxxxxxxx>; christophe.de.dinechin@xxxxxxxxx;
kevin.tian@xxxxxxxxx; stefanha@xxxxxxxxxx; Jason Wang
<jasowang@xxxxxxxxxx>
Subject: [PATCH V6 3/6] mdev: introduce device specific ops

Currently, except for the create and remove, the rest of mdev_parent_ops is
designed for vfio-mdev driver only and may not help for kernel mdev driver.
With the help of class id, this patch introduces device specific callbacks inside
mdev_device structure. This allows different set of callback to be used by vfio-
mdev and virtio-mdev.

Signed-off-by: Jason Wang <jasowang@xxxxxxxxxx>
---
[ ..]

diff --git a/include/linux/vfio_mdev_ops.h b/include/linux/vfio_mdev_ops.h
new file mode 100644 index 000000000000..3907c5371c2b
--- /dev/null
+++ b/include/linux/vfio_mdev_ops.h
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * VFIO Mediated device definition
+ */
+
+#ifndef VFIO_MDEV_H
+#define VFIO_MDEV_H
+
I should have noticed this before. :-(
APIs exposed are by the mdev module and named with mdev_ prefix.
And file name is _ops.h,

We should name this file as mdev_vfio_ops.h

And #define should be MDEV_VFIO_OPS_H

+#include <linux/mdev.h>
+
+/**
+ * struct vfio_mdev_device_ops - Structure to be registered for each
s/vfio_mdev_device_ops/mdev_vfio_device_ops/

Similarly for virtio in future patches.


Will fix in V7.


static void mtty_device_release(struct device *dev)
--
2.19.1
With above small nit changes to rename the fields and file,

Reviewed-by: Parav Pandit <parav@xxxxxxxxxxxx>


Appreciate that, thanks.