mdev based hardware virtio offloading support
Subsystems (16)
v2 cover mdev based hardware virtio offloading support
Hi all:
There are hardware that can do virtio datapath offloading while having its own control path. This path tries to implement a mdev based unified API to support using kernel virtio driver to drive those devices. This is done by introducing a new mdev transport for virtio (virtio_mdev) and register itself as a new kind of mdev driver. Then it provides a unified way for kernel virtio driver to talk with mdev device implementation.
Though the series only contain kernel driver support, the goal is to make the transport generic enough to support userspace drivers. This means vhost-mdev[1] could be built on top as well by resuing the transport.
A sample driver is also implemented which simulate a virito-net loopback ethernet device on top of vringh + workqueue. This could be used as a reference implementation for real hardware driver.
Consider mdev framework only support VFIO device and driver right now, this series also extend it to support other types. This is done through introducing class id to the device and pairing it with id_talbe claimed by the driver. On top, this seris also decouple device specific parents ops out of the common ones.
Pktgen test was done with virito-net + mvnet loop back device.
Please review.
Changes from V1:
- rename device id to class id
- add docs for class id and device specific ops (device_ops)
- split device_ops into seperate headers
- drop the mdev_set_dma_ops()
- use device_ops to implement the transport API, then it's not a part of UAPI any more
- use GFP_ATOMIC in mvnet sample device and other tweaks
- set_vring_base/get_vring_base support for mvnet device
Jason Wang (6):
mdev: class id support
mdev: introduce device specific ops
mdev: introduce virtio device and its device ops
virtio: introudce a mdev based transport
vringh: fix copy direction of vringh_iov_push_kern()
docs: Sample driver to demonstrate how to implement virtio-mdev
framework
.../driver-api/vfio-mediated-device.rst | 11 +- drivers/gpu/drm/i915/gvt/kvmgt.c | 17 +- drivers/s390/cio/vfio_ccw_ops.c | 17 +- drivers/s390/crypto/vfio_ap_ops.c | 14 +- drivers/vfio/mdev/Kconfig | 7 + drivers/vfio/mdev/Makefile | 1 + drivers/vfio/mdev/mdev_core.c | 21 +- drivers/vfio/mdev/mdev_driver.c | 14 + drivers/vfio/mdev/mdev_private.h | 1 + drivers/vfio/mdev/vfio_mdev.c | 37 +- drivers/vfio/mdev/virtio_mdev.c | 418 +++++++++++ drivers/vhost/vringh.c | 8 +- include/linux/mdev.h | 46 +- include/linux/mod_devicetable.h | 8 + include/linux/vfio_mdev.h | 50 ++ include/linux/virtio_mdev.h | 141 ++++ samples/Kconfig | 7 + samples/vfio-mdev/Makefile | 1 + samples/vfio-mdev/mbochs.c | 19 +- samples/vfio-mdev/mdpy.c | 19 +- samples/vfio-mdev/mtty.c | 17 +- samples/vfio-mdev/mvnet.c | 688 ++++++++++++++++++ 22 files changed, 1473 insertions(+), 89 deletions(-) create mode 100644 drivers/vfio/mdev/virtio_mdev.c create mode 100644 include/linux/vfio_mdev.h create mode 100644 include/linux/virtio_mdev.h create mode 100644 samples/vfio-mdev/mvnet.c
Signature · 1 line
2.19.1
RFC PATCH v2 1/6 mdev: class id support
Mdev bus only support vfio driver right now, so it doesn't implement match method. But in the future, we may add drivers other than vfio, one example is virtio-mdev[1] driver. This means we need to add device class id support in bus match method to pair the mdev device and mdev driver correctly.
So this patch add id_table to mdev_driver and id for mdev parent, and implement the match method for mdev bus.
--- Documentation/driver-api/vfio-mediated-device.rst | 7 +++++-- drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +- drivers/s390/cio/vfio_ccw_ops.c | 2 +- drivers/s390/crypto/vfio_ap_ops.c | 3 ++- drivers/vfio/mdev/mdev_core.c | 14 ++++++++++++-- drivers/vfio/mdev/mdev_driver.c | 14 ++++++++++++++ drivers/vfio/mdev/mdev_private.h | 1 + drivers/vfio/mdev/vfio_mdev.c | 6 ++++++ include/linux/mdev.h | 6 +++++- include/linux/mod_devicetable.h | 8 ++++++++ samples/vfio-mdev/mbochs.c | 2 +- samples/vfio-mdev/mdpy.c | 2 +- samples/vfio-mdev/mtty.c | 2 +- 13 files changed, 58 insertions(+), 11 deletions(-)
Documentation/driver-api/vfio-mediated-device.rst +5 -2
@@ -102,12 +102,14 @@ structure to represent a mediated device's driver:: * @probe: called when new device created * @remove: called when device removed * @driver: device driver structure + * @id_table: the ids serviced by this driver. */ struct mdev_driver { const char *name; int (*probe) (struct device *dev); void (*remove) (struct device *dev); struct device_driver driver; + const struct mdev_class_id *id_table; }; A mediated bus driver for mdev should use this structure in the function calls
@@ -116,7 +118,7 @@ to register and unregister itself with the core driver: * Register:: extern int mdev_register_driver(struct mdev_driver *drv, - struct module *owner); + struct module *owner); * Unregister::
@@ -163,7 +165,8 @@ A driver should use the mdev_parent_ops structure in the function call to register itself with the mdev core driver:: extern int mdev_register_device(struct device *dev, - const struct mdev_parent_ops *ops); + const struct mdev_parent_ops *ops, + u8 class_id); However, the mdev_parent_ops structure is not required in the function call that a driver should use to unregister itself with the mdev core driver::
drivers/gpu/drm/i915/gvt/kvmgt.c +1 -1
@@ -1625,7 +1625,7 @@ static int kvmgt_host_init(struct device *dev, void *gvt, const void *ops)return -EFAULT ; intel_vgpu_ops.supported_type_groups = kvm_vgpu_type_groups; -return mdev_register_device (dev, &intel_vgpu_ops); +return mdev_register_vfio_device (dev, &intel_vgpu_ops); }static void kvmgt_host_exit (struct device *dev)
drivers/s390/cio/vfio_ccw_ops.c +1 -1
@@ -578,7 +578,7 @@ static const struct mdev_parent_ops vfio_ccw_mdev_ops = {int vfio_ccw_mdev_reg (struct subchannel *sch) { -return mdev_register_device (&sch->dev, &vfio_ccw_mdev_ops); +return mdev_register_vfio_device (&sch->dev, &vfio_ccw_mdev_ops); }void vfio_ccw_mdev_unreg (struct subchannel *sch)
drivers/s390/crypto/vfio_ap_ops.c +2 -1
@@ -1295,7 +1295,8 @@ int vfio_ap_mdev_register(void) {atomic_set (&matrix_dev->available_instances,MAX_ZDEV_ENTRIES_EXT ); -return mdev_register_device (&matrix_dev->device, &vfio_ap_matrix_ops); +return mdev_register_vfio_device (&matrix_dev->device, + &vfio_ap_matrix_ops); }void vfio_ap_mdev_unregister (void )
drivers/vfio/mdev/mdev_core.c +12 -2
@@ -135,11 +135,14 @@ static int mdev_device_remove_cb(struct device *dev, void *data)* mdev_register_device : Register a device * @dev: device structure representing parent device. * @ops: Parent device operation structure to be registered. +* @id: device id. * * Add device to list of registered parent devices. * Returns a negative value on error, otherwise 0. */ -int mdev_register_device (struct device *dev,const struct mdev_parent_ops *ops) +int mdev_register_device (struct device *dev, +const struct mdev_parent_ops *ops, +u8 class_id) {int ret;struct mdev_parent *parent;
@@ -175,6 +178,7 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops) parent->dev = dev; parent->ops = ops; + parent->class_id = class_id;if (!mdev_bus_compat_class) { mdev_bus_compat_class =class_compat_register ("mdev_bus" );
@@ -208,7 +212,13 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)put_device (dev);return ret; } -EXPORT_SYMBOL (mdev_register_device); + +int mdev_register_vfio_device (struct device *dev, +const struct mdev_parent_ops *ops) +{ +return mdev_register_device (dev, ops,MDEV_ID_VFIO ); +} +EXPORT_SYMBOL (mdev_register_vfio_device);/* * mdev_unregister_device : Unregister a parent device
drivers/vfio/mdev/mdev_driver.c +14 -0
@@ -69,8 +69,22 @@ static int mdev_remove(struct device *dev)return 0 ; } +static int mdev_match (struct device *dev,struct device_driver *drv) +{ +unsigned int i; +struct mdev_device *mdev =to_mdev_device (dev); +struct mdev_driver *mdrv =to_mdev_driver (drv); +const struct mdev_class_id *ids = mdrv->id_table; + +for (i =0 ; ids[i].id; i++) +if (ids[i].id == mdev->parent->class_id) +return 1 ; +return 0 ; +} +struct bus_type mdev_bus_type = { .name ="mdev" , + .match = mdev_match, .probe = mdev_probe, .remove = mdev_remove, };
drivers/vfio/mdev/mdev_private.h +1 -0
@@ -22,6 +22,7 @@ struct mdev_parent {struct list_head type_list;/* Synchronize device creation/removal with parent unregistration */ struct rw_semaphore unreg_sem; +u8 class_id; };struct mdev_device {
drivers/vfio/mdev/vfio_mdev.c +6 -0
@@ -120,10 +120,16 @@ static void vfio_mdev_remove(struct device *dev)vfio_del_group_dev (dev); } +static struct mdev_class_id id_table[] = { + {MDEV_ID_VFIO }, + {0 }, +}; +static struct mdev_driver vfio_mdev_driver = { .name ="vfio_mdev" , .probe = vfio_mdev_probe, .remove = vfio_mdev_remove, + .id_table = id_table, };static int __init vfio_mdev_init (void )
include/linux/mdev.h +5 -1
@@ -118,6 +118,7 @@ struct mdev_type_attribute mdev_type_attr_##_name = \* @probe: called when new device created * @remove: called when device removed * @driver: device driver structure +* @id_table: the ids serviced by this driver. * **/ struct mdev_driver {
@@ -125,6 +126,7 @@ struct mdev_driver {int (*probe)(struct device *dev);void (*remove)(struct device *dev);struct device_driver driver; +const struct mdev_class_id *id_table; };#define to_mdev_driver (drv) container_of(drv, struct mdev_driver, driver)
@@ -135,7 +137,7 @@ const guid_t *mdev_uuid(struct mdev_device *mdev);extern struct bus_type mdev_bus_type; -int mdev_register_device (struct device *dev,const struct mdev_parent_ops *ops); +int mdev_register_vfio_device (struct device *dev,const struct mdev_parent_ops *ops);void mdev_unregister_device (struct device *dev);int mdev_register_driver (struct mdev_driver *drv,struct module *owner);
@@ -145,4 +147,6 @@ struct device *mdev_parent_dev(struct mdev_device *mdev);struct device *mdev_dev (struct mdev_device *mdev);struct mdev_device *mdev_from_dev (struct device *dev); +#define MDEV_ID_VFIO 1/* VFIO device */ +#endif /* MDEV_H */
include/linux/mod_devicetable.h +8 -0
@@ -821,4 +821,12 @@ struct wmi_device_id { const void *context; }; +/** +* struct mdev_class_id - MDEV device class identifier +* @id: Used to identify a specific class of device, e.g vfio-mdev device. +*/ +struct mdev_class_id { +__u8 id; +}; +#endif /* LINUX_MOD_DEVICETABLE_H */
samples/vfio-mdev/mbochs.c +1 -1
@@ -1468,7 +1468,7 @@ static int __init mbochs_dev_init(void)if (ret) goto failed2; - ret =mdev_register_device (&mbochs_dev, &mdev_fops); + ret =mdev_register_vfio_device (&mbochs_dev, &mdev_fops);if (ret) goto failed3;
samples/vfio-mdev/mdpy.c +1 -1
@@ -775,7 +775,7 @@ static int __init mdpy_dev_init(void)if (ret) goto failed2; - ret =mdev_register_device (&mdpy_dev, &mdev_fops); + ret =mdev_register_vfio_device (&mdpy_dev, &mdev_fops);if (ret) goto failed3;
samples/vfio-mdev/mtty.c +1 -1
@@ -1468,7 +1468,7 @@ static int __init mtty_dev_init(void)if (ret) goto failed2; - ret =mdev_register_device (&mtty_dev.dev, &mdev_fops); + ret =mdev_register_vfio_device (&mtty_dev.dev, &mdev_fops);if (ret) goto failed3;
Signature · 1 line
2.19.1
RFC PATCH v2 1/6 mdev: class id support
In reply to Jason WangMdev bus only support vfio driver right now, so it doesn't implement match method. But in the future, we may add drivers other than vfio, one example is virtio-mdev[1] driver. This means we need to add device class id support in bus match method to pair the mdev device and mdev driver correctly.
So this patch add id_table to mdev_driver and id for mdev parent, and implement the match method for mdev bus.
--- Documentation/driver-api/vfio-mediated-device.rst | 7 +++++-- drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +- drivers/s390/cio/vfio_ccw_ops.c | 2 +- drivers/s390/crypto/vfio_ap_ops.c | 3 ++- drivers/vfio/mdev/mdev_core.c | 14 ++++++++++++-- drivers/vfio/mdev/mdev_driver.c | 14 ++++++++++++++ drivers/vfio/mdev/mdev_private.h | 1 + drivers/vfio/mdev/vfio_mdev.c | 6 ++++++ include/linux/mdev.h | 6 +++++- include/linux/mod_devicetable.h | 8 ++++++++ samples/vfio-mdev/mbochs.c | 2 +- samples/vfio-mdev/mdpy.c | 2 +- samples/vfio-mdev/mtty.c | 2 +- 13 files changed, 58 insertions(+), 11 deletions(-)
Documentation/driver-api/vfio-mediated-device.rst +5 -2
@@ -102,12 +102,14 @@ structure to represent a mediated device's driver:: * @probe: called when new device created * @remove: called when device removed * @driver: device driver structure + * @id_table: the ids serviced by this driver. */ struct mdev_driver { const char *name; int (*probe) (struct device *dev); void (*remove) (struct device *dev); struct device_driver driver; + const struct mdev_class_id *id_table; }; A mediated bus driver for mdev should use this structure in the function calls
@@ -116,7 +118,7 @@ to register and unregister itself with the core driver: * Register:: extern int mdev_register_driver(struct mdev_driver *drv, - struct module *owner); + struct module *owner); * Unregister::
@@ -163,7 +165,8 @@ A driver should use the mdev_parent_ops structure in the function call to register itself with the mdev core driver:: extern int mdev_register_device(struct device *dev, - const struct mdev_parent_ops *ops); + const struct mdev_parent_ops *ops, + u8 class_id); However, the mdev_parent_ops structure is not required in the function call that a driver should use to unregister itself with the mdev core driver::
drivers/gpu/drm/i915/gvt/kvmgt.c +1 -1
@@ -1625,7 +1625,7 @@ static int kvmgt_host_init(struct device *dev, void *gvt, const void *ops)return -EFAULT ; intel_vgpu_ops.supported_type_groups = kvm_vgpu_type_groups; -return mdev_register_device (dev, &intel_vgpu_ops); +return mdev_register_vfio_device (dev, &intel_vgpu_ops); }static void kvmgt_host_exit (struct device *dev)
drivers/s390/cio/vfio_ccw_ops.c +1 -1
@@ -578,7 +578,7 @@ static const struct mdev_parent_ops vfio_ccw_mdev_ops = {int vfio_ccw_mdev_reg (struct subchannel *sch) { -return mdev_register_device (&sch->dev, &vfio_ccw_mdev_ops); +return mdev_register_vfio_device (&sch->dev, &vfio_ccw_mdev_ops); }void vfio_ccw_mdev_unreg (struct subchannel *sch)
drivers/s390/crypto/vfio_ap_ops.c +2 -1
@@ -1295,7 +1295,8 @@ int vfio_ap_mdev_register(void) {atomic_set (&matrix_dev->available_instances,MAX_ZDEV_ENTRIES_EXT ); -return mdev_register_device (&matrix_dev->device, &vfio_ap_matrix_ops); +return mdev_register_vfio_device (&matrix_dev->device, + &vfio_ap_matrix_ops); }void vfio_ap_mdev_unregister (void )
drivers/vfio/mdev/mdev_core.c +12 -2
@@ -135,11 +135,14 @@ static int mdev_device_remove_cb(struct device *dev, void *data)* mdev_register_device : Register a device * @dev: device structure representing parent device. * @ops: Parent device operation structure to be registered. +* @id: device id. * * Add device to list of registered parent devices. * Returns a negative value on error, otherwise 0. */ -int mdev_register_device (struct device *dev,const struct mdev_parent_ops *ops) +int mdev_register_device (struct device *dev, +const struct mdev_parent_ops *ops, +u8 class_id) {int ret;struct mdev_parent *parent;
@@ -175,6 +178,7 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops) parent->dev = dev; parent->ops = ops; + parent->class_id = class_id;if (!mdev_bus_compat_class) { mdev_bus_compat_class =class_compat_register ("mdev_bus" );
@@ -208,7 +212,13 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)put_device (dev);return ret; } -EXPORT_SYMBOL (mdev_register_device); + +int mdev_register_vfio_device (struct device *dev, +const struct mdev_parent_ops *ops) +{ +return mdev_register_device (dev, ops,MDEV_ID_VFIO ); +} +EXPORT_SYMBOL (mdev_register_vfio_device);/* * mdev_unregister_device : Unregister a parent device
drivers/vfio/mdev/mdev_driver.c +14 -0
@@ -69,8 +69,22 @@ static int mdev_remove(struct device *dev)return 0 ; } +static int mdev_match (struct device *dev,struct device_driver *drv) +{ +unsigned int i; +struct mdev_device *mdev =to_mdev_device (dev); +struct mdev_driver *mdrv =to_mdev_driver (drv); +const struct mdev_class_id *ids = mdrv->id_table; + +for (i =0 ; ids[i].id; i++) +if (ids[i].id == mdev->parent->class_id) +return 1 ; +return 0 ; +} +struct bus_type mdev_bus_type = { .name ="mdev" , + .match = mdev_match, .probe = mdev_probe, .remove = mdev_remove, };
drivers/vfio/mdev/mdev_private.h +1 -0
@@ -22,6 +22,7 @@ struct mdev_parent {struct list_head type_list;/* Synchronize device creation/removal with parent unregistration */ struct rw_semaphore unreg_sem; +u8 class_id; };struct mdev_device {
drivers/vfio/mdev/vfio_mdev.c +6 -0
@@ -120,10 +120,16 @@ static void vfio_mdev_remove(struct device *dev)vfio_del_group_dev (dev); } +static struct mdev_class_id id_table[] = { + {MDEV_ID_VFIO }, + {0 }, +}; +static struct mdev_driver vfio_mdev_driver = { .name ="vfio_mdev" , .probe = vfio_mdev_probe, .remove = vfio_mdev_remove, + .id_table = id_table, };static int __init vfio_mdev_init (void )
include/linux/mdev.h +5 -1
@@ -118,6 +118,7 @@ struct mdev_type_attribute mdev_type_attr_##_name = \* @probe: called when new device created * @remove: called when device removed * @driver: device driver structure +* @id_table: the ids serviced by this driver. * **/ struct mdev_driver {
@@ -125,6 +126,7 @@ struct mdev_driver {int (*probe)(struct device *dev);void (*remove)(struct device *dev);struct device_driver driver; +const struct mdev_class_id *id_table; };#define to_mdev_driver (drv) container_of(drv, struct mdev_driver, driver)
@@ -135,7 +137,7 @@ const guid_t *mdev_uuid(struct mdev_device *mdev);extern struct bus_type mdev_bus_type; -int mdev_register_device (struct device *dev,const struct mdev_parent_ops *ops); +int mdev_register_vfio_device (struct device *dev,const struct mdev_parent_ops *ops);void mdev_unregister_device (struct device *dev);int mdev_register_driver (struct mdev_driver *drv,struct module *owner);
@@ -145,4 +147,6 @@ struct device *mdev_parent_dev(struct mdev_device *mdev);struct device *mdev_dev (struct mdev_device *mdev);struct mdev_device *mdev_from_dev (struct device *dev); +#define MDEV_ID_VFIO 1/* VFIO device */ +#endif /* MDEV_H */
include/linux/mod_devicetable.h +8 -0
@@ -821,4 +821,12 @@ struct wmi_device_id { const void *context; }; +/** +* struct mdev_class_id - MDEV device class identifier +* @id: Used to identify a specific class of device, e.g vfio-mdev device. +*/ +struct mdev_class_id { +__u8 id; +}; +#endif /* LINUX_MOD_DEVICETABLE_H */
samples/vfio-mdev/mbochs.c +1 -1
@@ -1468,7 +1468,7 @@ static int __init mbochs_dev_init(void)if (ret) goto failed2; - ret =mdev_register_device (&mbochs_dev, &mdev_fops); + ret =mdev_register_vfio_device (&mbochs_dev, &mdev_fops);if (ret) goto failed3;
samples/vfio-mdev/mdpy.c +1 -1
@@ -775,7 +775,7 @@ static int __init mdpy_dev_init(void)if (ret) goto failed2; - ret =mdev_register_device (&mdpy_dev, &mdev_fops); + ret =mdev_register_vfio_device (&mdpy_dev, &mdev_fops);if (ret) goto failed3;
samples/vfio-mdev/mtty.c +1 -1
@@ -1468,7 +1468,7 @@ static int __init mtty_dev_init(void)if (ret) goto failed2; - ret =mdev_register_device (&mtty_dev.dev, &mdev_fops); + ret =mdev_register_vfio_device (&mtty_dev.dev, &mdev_fops);if (ret) goto failed3;
Signature · 1 line
2.19.1
RFC PATCH v2 2/6 mdev: introduce device specific ops
In reply to Jason WangCurrently, except for the crate and remove. The rest fields of mdev_parent_ops is just designed for vfio-mdev driver and may not help for kernel mdev driver. So follow the device id support by previous patch, this patch introduces device specific ops which points to device specific ops (e.g vfio ops). This allows the future drivers like virtio-mdev to implement its own device specific ops.
--- .../driver-api/vfio-mediated-device.rst | 4 +- drivers/gpu/drm/i915/gvt/kvmgt.c | 15 +++--- drivers/s390/cio/vfio_ccw_ops.c | 15 ++++-- drivers/s390/crypto/vfio_ap_ops.c | 11 ++-- drivers/vfio/mdev/vfio_mdev.c | 31 +++++++----- include/linux/mdev.h | 39 ++------------- include/linux/vfio_mdev.h | 50 +++++++++++++++++++ samples/vfio-mdev/mbochs.c | 17 ++++--- samples/vfio-mdev/mdpy.c | 17 ++++--- samples/vfio-mdev/mtty.c | 15 ++++-- 10 files changed, 136 insertions(+), 78 deletions(-) create mode 100644 include/linux/vfio_mdev.h
Documentation/driver-api/vfio-mediated-device.rst +3 -1
@@ -152,7 +152,9 @@ callbacks per mdev parent device, per mdev type, or any other categorization. Vendor drivers are expected to be fully asynchronous in this respect or provide their own internal resource protection.) -The callbacks in the mdev_parent_ops structure are as follows: +The device specific callbacks are referred through device_ops pointer +in mdev_parent_ops. For vfio-mdev device, its callbacks in device_ops +are as follows: * open: open callback of mediated device * close: close callback of mediated device
drivers/gpu/drm/i915/gvt/kvmgt.c +9 -6
@@ -42,6 +42,7 @@#include <linux/kvm_host.h> #include <linux/vfio.h> #include <linux/mdev.h> +#include <linux/vfio_mdev.h> #include <linux/debugfs.h> #include <linux/nospec.h>
@@ -1600,20 +1601,22 @@ static const struct attribute_group *intel_vgpu_groups[] = { NULL, }; -static struct mdev_parent_ops intel_vgpu_ops = { - .mdev_attr_groups = intel_vgpu_groups, - .create = intel_vgpu_create, - .remove = intel_vgpu_remove, - +static struct vfio_mdev_parent_ops intel_vfio_vgpu_ops = { .open = intel_vgpu_open, .release = intel_vgpu_release, - .read = intel_vgpu_read, .write = intel_vgpu_write, .mmap = intel_vgpu_mmap, .ioctl = intel_vgpu_ioctl, }; +static struct mdev_parent_ops intel_vgpu_ops = { + .mdev_attr_groups = intel_vgpu_groups, + .create = intel_vgpu_create, + .remove = intel_vgpu_remove, + .device_ops = &intel_vfio_vgpu_ops, +}; +static int kvmgt_host_init (struct device *dev,void *gvt,const void *ops) {struct attribute **kvm_type_attrs;
drivers/s390/cio/vfio_ccw_ops.c +10 -5
@@ -12,6 +12,7 @@#include <linux/vfio.h> #include <linux/mdev.h> +#include <linux/vfio_mdev.h> #include <linux/nospec.h> #include <linux/slab.h>
@@ -564,11 +565,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev, } } -static const struct mdev_parent_ops vfio_ccw_mdev_ops = { - .owner =THIS_MODULE , - .supported_type_groups = mdev_type_groups, - .create = vfio_ccw_mdev_create, - .remove = vfio_ccw_mdev_remove, +static const struct vfio_mdev_parent_ops vfio_mdev_ops = { .open = vfio_ccw_mdev_open, .release = vfio_ccw_mdev_release, .read = vfio_ccw_mdev_read,
@@ -576,6 +573,14 @@ static const struct mdev_parent_ops vfio_ccw_mdev_ops = { .ioctl = vfio_ccw_mdev_ioctl, }; +static const struct mdev_parent_ops vfio_ccw_mdev_ops = { + .owner =THIS_MODULE , + .supported_type_groups = mdev_type_groups, + .create = vfio_ccw_mdev_create, + .remove = vfio_ccw_mdev_remove, + .device_ops = &vfio_mdev_ops, +}; +int vfio_ccw_mdev_reg (struct subchannel *sch) {return mdev_register_vfio_device (&sch->dev, &vfio_ccw_mdev_ops);
drivers/s390/crypto/vfio_ap_ops.c +8 -3
@@ -16,6 +16,7 @@#include <linux/bitops.h> #include <linux/kvm_host.h> #include <linux/module.h> +#include <linux/vfio_mdev.h> #include <asm/kvm.h> #include <asm/zcrypt.h>
@@ -1280,15 +1281,19 @@ static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev,return ret; } +static const struct vfio_mdev_parent_ops vfio_mdev_ops = { + .open = vfio_ap_mdev_open, + .release = vfio_ap_mdev_release, + .ioctl = vfio_ap_mdev_ioctl, +}; +static const struct mdev_parent_ops vfio_ap_matrix_ops = { .owner =THIS_MODULE , .supported_type_groups = vfio_ap_mdev_type_groups, .mdev_attr_groups = vfio_ap_mdev_attr_groups, .create = vfio_ap_mdev_create, .remove = vfio_ap_mdev_remove, - .open = vfio_ap_mdev_open, - .release = vfio_ap_mdev_release, - .ioctl = vfio_ap_mdev_ioctl, + .device_ops = &vfio_mdev_ops, };int vfio_ap_mdev_register (void )
drivers/vfio/mdev/vfio_mdev.c +19 -12
@@ -14,6 +14,7 @@#include <linux/slab.h> #include <linux/vfio.h> #include <linux/mdev.h> +#include <linux/vfio_mdev.h> #include "mdev_private.h"
@@ -25,15 +26,16 @@ static int vfio_mdev_open(void *device_data) {struct mdev_device *mdev = device_data;struct mdev_parent *parent = mdev->parent; +const struct vfio_mdev_parent_ops *ops = parent->ops->device_ops;int ret; -if (unlikely (!parent->ops->open)) +if (unlikely (!ops->open))return -EINVAL ;if (!try_module_get (THIS_MODULE ))return -ENODEV ; - ret = parent->ops->open (mdev); + ret = ops->open (mdev);if (ret)module_put (THIS_MODULE );
@@ -44,9 +46,10 @@ static void vfio_mdev_release(void *device_data) {struct mdev_device *mdev = device_data;struct mdev_parent *parent = mdev->parent; +const struct vfio_mdev_parent_ops *ops = parent->ops->device_ops; -if (likely (parent->ops->release)) - parent->ops->release (mdev); +if (likely (ops->release)) + ops->release (mdev);module_put (THIS_MODULE ); }
@@ -56,11 +59,12 @@ static long vfio_mdev_unlocked_ioctl(void *device_data, {struct mdev_device *mdev = device_data;struct mdev_parent *parent = mdev->parent; +const struct vfio_mdev_parent_ops *ops = parent->ops->device_ops; -if (unlikely (!parent->ops->ioctl)) +if (unlikely (!ops->ioctl))return -EINVAL ; -return parent->ops->ioctl (mdev, cmd, arg); +return ops->ioctl (mdev, cmd, arg); } static ssize_t vfio_mdev_read(void *device_data, char __user *buf,
@@ -68,11 +72,12 @@ static ssize_t vfio_mdev_read(void *device_data, char __user *buf, {struct mdev_device *mdev = device_data;struct mdev_parent *parent = mdev->parent; +const struct vfio_mdev_parent_ops *ops = parent->ops->device_ops; -if (unlikely (!parent->ops->read)) +if (unlikely (!ops->read))return -EINVAL ; -return parent->ops->read (mdev, buf, count, ppos); +return ops->read (mdev, buf, count, ppos); } static ssize_t vfio_mdev_write(void *device_data, const char __user *buf,
@@ -80,22 +85,24 @@ static ssize_t vfio_mdev_write(void *device_data, const char __user *buf, {struct mdev_device *mdev = device_data;struct mdev_parent *parent = mdev->parent; +const struct vfio_mdev_parent_ops *ops = parent->ops->device_ops; -if (unlikely (!parent->ops->write)) +if (unlikely (!ops->write))return -EINVAL ; -return parent->ops->write (mdev, buf, count, ppos); +return ops->write (mdev, buf, count, ppos); }static int vfio_mdev_mmap (void *device_data,struct vm_area_struct *vma) {struct mdev_device *mdev = device_data;struct mdev_parent *parent = mdev->parent; +const struct vfio_mdev_parent_ops *ops = parent->ops->device_ops; -if (unlikely (!parent->ops->mmap)) +if (unlikely (!ops->mmap))return -EINVAL ; -return parent->ops->mmap (mdev, vma); +return ops->mmap (mdev, vma); }static const struct vfio_device_ops vfio_mdev_dev_ops = {
include/linux/mdev.h +5 -34
@@ -48,30 +48,8 @@ struct device *mdev_get_iommu_device(struct device *dev);* @mdev: mdev_device device structure which is being * destroyed * Returns integer: success (0) or error (< 0) -* @open: Open mediated device. -* @mdev: mediated device. -* Returns integer: success (0) or error (< 0) -* @release: release mediated device -* @mdev: mediated device. -* @read: Read emulation callback -* @mdev: mediated device structure -* @buf: read buffer -* @count: number of bytes to read -* @ppos: address. -* Retuns number on bytes read on success or error. -* @write: Write emulation callback -* @mdev: mediated device structure -* @buf: write buffer -* @count: number of bytes to be written -* @ppos: address. -* Retuns number on bytes written on success or error. -* @ioctl: IOCTL callback -* @mdev: mediated device structure -* @cmd: ioctl command -* @arg: arguments to ioctl -* @mmap: mmap callback -* @mdev: mediated device structure -* @vma: vma structure +* @device_ops: Device specific emulation callback. +* * Parent device that support mediated device should be registered with mdev * module with mdev_parent_ops structure. **/
@@ -83,15 +61,7 @@ struct mdev_parent_ops {int (*create)(struct kobject *kobj,struct mdev_device *mdev);int (*remove)(struct mdev_device *mdev); -int (*open)(struct mdev_device *mdev); -void (*release)(struct mdev_device *mdev); -ssize_t (*read)(struct mdev_device *mdev,char __user *buf, -size_t count,loff_t *ppos); -ssize_t (*write)(struct mdev_device *mdev,const char __user *buf, -size_t count,loff_t *ppos); -long (*ioctl)(struct mdev_device *mdev,unsigned int cmd, -unsigned long arg); -int (*mmap)(struct mdev_device *mdev,struct vm_area_struct *vma); +const void *device_ops; };/* interface for exporting mdev supported type attributes */
@@ -137,7 +107,8 @@ const guid_t *mdev_uuid(struct mdev_device *mdev);extern struct bus_type mdev_bus_type; -int mdev_register_vfio_device (struct device *dev,const struct mdev_parent_ops *ops); +int mdev_register_vfio_device (struct device *dev, +const struct mdev_parent_ops *ops);void mdev_unregister_device (struct device *dev);int mdev_register_driver (struct mdev_driver *drv,struct module *owner);
include/linux/vfio_mdev.h new file +50 -0
50 lines not on this page · raw message
samples/vfio-mdev/mbochs.c +11 -6
@@ -30,6 +30,7 @@#include <linux/iommu.h> #include <linux/sysfs.h> #include <linux/mdev.h> +#include <linux/vfio_mdev.h> #include <linux/pci.h> #include <linux/dma-buf.h> #include <linux/highmem.h>
@@ -1418,12 +1419,7 @@ static struct attribute_group *mdev_type_groups[] = { NULL, }; -static const struct mdev_parent_ops mdev_fops = { - .owner =THIS_MODULE , - .mdev_attr_groups = mdev_dev_groups, - .supported_type_groups = mdev_type_groups, - .create = mbochs_create, - .remove = mbochs_remove, +static const struct vfio_mdev_parent_ops vfio_mdev_ops = { .open = mbochs_open, .release = mbochs_close, .read = mbochs_read,
@@ -1432,6 +1428,15 @@ static const struct mdev_parent_ops mdev_fops = { .mmap = mbochs_mmap, }; +static const struct mdev_parent_ops mdev_fops = { + .owner =THIS_MODULE , + .mdev_attr_groups = mdev_dev_groups, + .supported_type_groups = mdev_type_groups, + .create = mbochs_create, + .remove = mbochs_remove, + .device_ops = &vfio_mdev_ops, +}; +static const struct file_operations vd_fops = { .owner =THIS_MODULE , };
samples/vfio-mdev/mdpy.c +11 -6
@@ -26,6 +26,7 @@#include <linux/iommu.h> #include <linux/sysfs.h> #include <linux/mdev.h> +#include <linux/vfio_mdev.h> #include <linux/pci.h> #include <drm/drm_fourcc.h> #include "mdpy-defs.h"
@@ -725,12 +726,7 @@ static struct attribute_group *mdev_type_groups[] = { NULL, }; -static const struct mdev_parent_ops mdev_fops = { - .owner =THIS_MODULE , - .mdev_attr_groups = mdev_dev_groups, - .supported_type_groups = mdev_type_groups, - .create = mdpy_create, - .remove = mdpy_remove, +static const struct vfio_mdev_parent_ops vfio_mdev_ops = { .open = mdpy_open, .release = mdpy_close, .read = mdpy_read,
@@ -739,6 +735,15 @@ static const struct mdev_parent_ops mdev_fops = { .mmap = mdpy_mmap, }; +static const struct mdev_parent_ops mdev_fops = { + .owner =THIS_MODULE , + .mdev_attr_groups = mdev_dev_groups, + .supported_type_groups = mdev_type_groups, + .create = mdpy_create, + .remove = mdpy_remove, + .device_ops = &vfio_mdev_ops, +}; +static const struct file_operations vd_fops = { .owner =THIS_MODULE , };
samples/vfio-mdev/mtty.c +10 -5
@@ -27,6 +27,7 @@#include <linux/ctype.h> #include <linux/file.h> #include <linux/mdev.h> +#include <linux/vfio_mdev.h> #include <linux/pci.h> #include <linux/serial.h> #include <uapi/linux/serial_reg.h>
@@ -1410,6 +1411,14 @@ static struct attribute_group *mdev_type_groups[] = { NULL, }; +static const struct vfio_mdev_parent_ops vfio_mdev_ops = { + .open = mtty_open, + .release = mtty_close, + .read = mtty_read, + .write = mtty_write, + .ioctl = mtty_ioctl, +}; +static const struct mdev_parent_ops mdev_fops = { .owner =THIS_MODULE , .dev_attr_groups = mtty_dev_groups,
@@ -1417,11 +1426,7 @@ static const struct mdev_parent_ops mdev_fops = { .supported_type_groups = mdev_type_groups, .create = mtty_create, .remove = mtty_remove, - .open = mtty_open, - .release = mtty_close, - .read = mtty_read, - .write = mtty_write, - .ioctl = mtty_ioctl, + .device_ops = &vfio_mdev_ops, };static void mtty_device_release (struct device *dev)
Signature · 1 line
2.19.1
RFC PATCH v2 2/6 mdev: introduce device specific ops
In reply to Jason WangCurrently, except for the crate and remove. The rest fields of mdev_parent_ops is just designed for vfio-mdev driver and may not help for kernel mdev driver. So follow the device id support by previous patch, this patch introduces device specific ops which points to device specific ops (e.g vfio ops). This allows the future drivers like virtio-mdev to implement its own device specific ops.
--- .../driver-api/vfio-mediated-device.rst | 4 +- drivers/gpu/drm/i915/gvt/kvmgt.c | 15 +++--- drivers/s390/cio/vfio_ccw_ops.c | 15 ++++-- drivers/s390/crypto/vfio_ap_ops.c | 11 ++-- drivers/vfio/mdev/vfio_mdev.c | 31 +++++++----- include/linux/mdev.h | 39 ++------------- include/linux/vfio_mdev.h | 50 +++++++++++++++++++ samples/vfio-mdev/mbochs.c | 17 ++++--- samples/vfio-mdev/mdpy.c | 17 ++++--- samples/vfio-mdev/mtty.c | 15 ++++-- 10 files changed, 136 insertions(+), 78 deletions(-) create mode 100644 include/linux/vfio_mdev.h
Documentation/driver-api/vfio-mediated-device.rst +3 -1
@@ -152,7 +152,9 @@ callbacks per mdev parent device, per mdev type, or any other categorization. Vendor drivers are expected to be fully asynchronous in this respect or provide their own internal resource protection.) -The callbacks in the mdev_parent_ops structure are as follows: +The device specific callbacks are referred through device_ops pointer +in mdev_parent_ops. For vfio-mdev device, its callbacks in device_ops +are as follows: * open: open callback of mediated device * close: close callback of mediated device
drivers/gpu/drm/i915/gvt/kvmgt.c +9 -6
@@ -42,6 +42,7 @@#include <linux/kvm_host.h> #include <linux/vfio.h> #include <linux/mdev.h> +#include <linux/vfio_mdev.h> #include <linux/debugfs.h> #include <linux/nospec.h>
@@ -1600,20 +1601,22 @@ static const struct attribute_group *intel_vgpu_groups[] = { NULL, }; -static struct mdev_parent_ops intel_vgpu_ops = { - .mdev_attr_groups = intel_vgpu_groups, - .create = intel_vgpu_create, - .remove = intel_vgpu_remove, - +static struct vfio_mdev_parent_ops intel_vfio_vgpu_ops = { .open = intel_vgpu_open, .release = intel_vgpu_release, - .read = intel_vgpu_read, .write = intel_vgpu_write, .mmap = intel_vgpu_mmap, .ioctl = intel_vgpu_ioctl, }; +static struct mdev_parent_ops intel_vgpu_ops = { + .mdev_attr_groups = intel_vgpu_groups, + .create = intel_vgpu_create, + .remove = intel_vgpu_remove, + .device_ops = &intel_vfio_vgpu_ops, +}; +static int kvmgt_host_init (struct device *dev,void *gvt,const void *ops) {struct attribute **kvm_type_attrs;
drivers/s390/cio/vfio_ccw_ops.c +10 -5
@@ -12,6 +12,7 @@#include <linux/vfio.h> #include <linux/mdev.h> +#include <linux/vfio_mdev.h> #include <linux/nospec.h> #include <linux/slab.h>
@@ -564,11 +565,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev, } } -static const struct mdev_parent_ops vfio_ccw_mdev_ops = { - .owner =THIS_MODULE , - .supported_type_groups = mdev_type_groups, - .create = vfio_ccw_mdev_create, - .remove = vfio_ccw_mdev_remove, +static const struct vfio_mdev_parent_ops vfio_mdev_ops = { .open = vfio_ccw_mdev_open, .release = vfio_ccw_mdev_release, .read = vfio_ccw_mdev_read,
@@ -576,6 +573,14 @@ static const struct mdev_parent_ops vfio_ccw_mdev_ops = { .ioctl = vfio_ccw_mdev_ioctl, }; +static const struct mdev_parent_ops vfio_ccw_mdev_ops = { + .owner =THIS_MODULE , + .supported_type_groups = mdev_type_groups, + .create = vfio_ccw_mdev_create, + .remove = vfio_ccw_mdev_remove, + .device_ops = &vfio_mdev_ops, +}; +int vfio_ccw_mdev_reg (struct subchannel *sch) {return mdev_register_vfio_device (&sch->dev, &vfio_ccw_mdev_ops);
drivers/s390/crypto/vfio_ap_ops.c +8 -3
@@ -16,6 +16,7 @@#include <linux/bitops.h> #include <linux/kvm_host.h> #include <linux/module.h> +#include <linux/vfio_mdev.h> #include <asm/kvm.h> #include <asm/zcrypt.h>
@@ -1280,15 +1281,19 @@ static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev,return ret; } +static const struct vfio_mdev_parent_ops vfio_mdev_ops = { + .open = vfio_ap_mdev_open, + .release = vfio_ap_mdev_release, + .ioctl = vfio_ap_mdev_ioctl, +}; +static const struct mdev_parent_ops vfio_ap_matrix_ops = { .owner =THIS_MODULE , .supported_type_groups = vfio_ap_mdev_type_groups, .mdev_attr_groups = vfio_ap_mdev_attr_groups, .create = vfio_ap_mdev_create, .remove = vfio_ap_mdev_remove, - .open = vfio_ap_mdev_open, - .release = vfio_ap_mdev_release, - .ioctl = vfio_ap_mdev_ioctl, + .device_ops = &vfio_mdev_ops, };int vfio_ap_mdev_register (void )
drivers/vfio/mdev/vfio_mdev.c +19 -12
@@ -14,6 +14,7 @@#include <linux/slab.h> #include <linux/vfio.h> #include <linux/mdev.h> +#include <linux/vfio_mdev.h> #include "mdev_private.h"
@@ -25,15 +26,16 @@ static int vfio_mdev_open(void *device_data) {struct mdev_device *mdev = device_data;struct mdev_parent *parent = mdev->parent; +const struct vfio_mdev_parent_ops *ops = parent->ops->device_ops;int ret; -if (unlikely (!parent->ops->open)) +if (unlikely (!ops->open))return -EINVAL ;if (!try_module_get (THIS_MODULE ))return -ENODEV ; - ret = parent->ops->open (mdev); + ret = ops->open (mdev);if (ret)module_put (THIS_MODULE );
@@ -44,9 +46,10 @@ static void vfio_mdev_release(void *device_data) {struct mdev_device *mdev = device_data;struct mdev_parent *parent = mdev->parent; +const struct vfio_mdev_parent_ops *ops = parent->ops->device_ops; -if (likely (parent->ops->release)) - parent->ops->release (mdev); +if (likely (ops->release)) + ops->release (mdev);module_put (THIS_MODULE ); }
@@ -56,11 +59,12 @@ static long vfio_mdev_unlocked_ioctl(void *device_data, {struct mdev_device *mdev = device_data;struct mdev_parent *parent = mdev->parent; +const struct vfio_mdev_parent_ops *ops = parent->ops->device_ops; -if (unlikely (!parent->ops->ioctl)) +if (unlikely (!ops->ioctl))return -EINVAL ; -return parent->ops->ioctl (mdev, cmd, arg); +return ops->ioctl (mdev, cmd, arg); } static ssize_t vfio_mdev_read(void *device_data, char __user *buf,
@@ -68,11 +72,12 @@ static ssize_t vfio_mdev_read(void *device_data, char __user *buf, {struct mdev_device *mdev = device_data;struct mdev_parent *parent = mdev->parent; +const struct vfio_mdev_parent_ops *ops = parent->ops->device_ops; -if (unlikely (!parent->ops->read)) +if (unlikely (!ops->read))return -EINVAL ; -return parent->ops->read (mdev, buf, count, ppos); +return ops->read (mdev, buf, count, ppos); } static ssize_t vfio_mdev_write(void *device_data, const char __user *buf,
@@ -80,22 +85,24 @@ static ssize_t vfio_mdev_write(void *device_data, const char __user *buf, {struct mdev_device *mdev = device_data;struct mdev_parent *parent = mdev->parent; +const struct vfio_mdev_parent_ops *ops = parent->ops->device_ops; -if (unlikely (!parent->ops->write)) +if (unlikely (!ops->write))return -EINVAL ; -return parent->ops->write (mdev, buf, count, ppos); +return ops->write (mdev, buf, count, ppos); }static int vfio_mdev_mmap (void *device_data,struct vm_area_struct *vma) {struct mdev_device *mdev = device_data;struct mdev_parent *parent = mdev->parent; +const struct vfio_mdev_parent_ops *ops = parent->ops->device_ops; -if (unlikely (!parent->ops->mmap)) +if (unlikely (!ops->mmap))return -EINVAL ; -return parent->ops->mmap (mdev, vma); +return ops->mmap (mdev, vma); }static const struct vfio_device_ops vfio_mdev_dev_ops = {
include/linux/mdev.h +5 -34
@@ -48,30 +48,8 @@ struct device *mdev_get_iommu_device(struct device *dev);* @mdev: mdev_device device structure which is being * destroyed * Returns integer: success (0) or error (< 0) -* @open: Open mediated device. -* @mdev: mediated device. -* Returns integer: success (0) or error (< 0) -* @release: release mediated device -* @mdev: mediated device. -* @read: Read emulation callback -* @mdev: mediated device structure -* @buf: read buffer -* @count: number of bytes to read -* @ppos: address. -* Retuns number on bytes read on success or error. -* @write: Write emulation callback -* @mdev: mediated device structure -* @buf: write buffer -* @count: number of bytes to be written -* @ppos: address. -* Retuns number on bytes written on success or error. -* @ioctl: IOCTL callback -* @mdev: mediated device structure -* @cmd: ioctl command -* @arg: arguments to ioctl -* @mmap: mmap callback -* @mdev: mediated device structure -* @vma: vma structure +* @device_ops: Device specific emulation callback. +* * Parent device that support mediated device should be registered with mdev * module with mdev_parent_ops structure. **/
@@ -83,15 +61,7 @@ struct mdev_parent_ops {int (*create)(struct kobject *kobj,struct mdev_device *mdev);int (*remove)(struct mdev_device *mdev); -int (*open)(struct mdev_device *mdev); -void (*release)(struct mdev_device *mdev); -ssize_t (*read)(struct mdev_device *mdev,char __user *buf, -size_t count,loff_t *ppos); -ssize_t (*write)(struct mdev_device *mdev,const char __user *buf, -size_t count,loff_t *ppos); -long (*ioctl)(struct mdev_device *mdev,unsigned int cmd, -unsigned long arg); -int (*mmap)(struct mdev_device *mdev,struct vm_area_struct *vma); +const void *device_ops; };/* interface for exporting mdev supported type attributes */
@@ -137,7 +107,8 @@ const guid_t *mdev_uuid(struct mdev_device *mdev);extern struct bus_type mdev_bus_type; -int mdev_register_vfio_device (struct device *dev,const struct mdev_parent_ops *ops); +int mdev_register_vfio_device (struct device *dev, +const struct mdev_parent_ops *ops);void mdev_unregister_device (struct device *dev);int mdev_register_driver (struct mdev_driver *drv,struct module *owner);
include/linux/vfio_mdev.h new file +50 -0
50 lines not on this page · raw message
samples/vfio-mdev/mbochs.c +11 -6
@@ -30,6 +30,7 @@#include <linux/iommu.h> #include <linux/sysfs.h> #include <linux/mdev.h> +#include <linux/vfio_mdev.h> #include <linux/pci.h> #include <linux/dma-buf.h> #include <linux/highmem.h>
@@ -1418,12 +1419,7 @@ static struct attribute_group *mdev_type_groups[] = { NULL, }; -static const struct mdev_parent_ops mdev_fops = { - .owner =THIS_MODULE , - .mdev_attr_groups = mdev_dev_groups, - .supported_type_groups = mdev_type_groups, - .create = mbochs_create, - .remove = mbochs_remove, +static const struct vfio_mdev_parent_ops vfio_mdev_ops = { .open = mbochs_open, .release = mbochs_close, .read = mbochs_read,
@@ -1432,6 +1428,15 @@ static const struct mdev_parent_ops mdev_fops = { .mmap = mbochs_mmap, }; +static const struct mdev_parent_ops mdev_fops = { + .owner =THIS_MODULE , + .mdev_attr_groups = mdev_dev_groups, + .supported_type_groups = mdev_type_groups, + .create = mbochs_create, + .remove = mbochs_remove, + .device_ops = &vfio_mdev_ops, +}; +static const struct file_operations vd_fops = { .owner =THIS_MODULE , };
samples/vfio-mdev/mdpy.c +11 -6
@@ -26,6 +26,7 @@#include <linux/iommu.h> #include <linux/sysfs.h> #include <linux/mdev.h> +#include <linux/vfio_mdev.h> #include <linux/pci.h> #include <drm/drm_fourcc.h> #include "mdpy-defs.h"
@@ -725,12 +726,7 @@ static struct attribute_group *mdev_type_groups[] = { NULL, }; -static const struct mdev_parent_ops mdev_fops = { - .owner =THIS_MODULE , - .mdev_attr_groups = mdev_dev_groups, - .supported_type_groups = mdev_type_groups, - .create = mdpy_create, - .remove = mdpy_remove, +static const struct vfio_mdev_parent_ops vfio_mdev_ops = { .open = mdpy_open, .release = mdpy_close, .read = mdpy_read,
@@ -739,6 +735,15 @@ static const struct mdev_parent_ops mdev_fops = { .mmap = mdpy_mmap, }; +static const struct mdev_parent_ops mdev_fops = { + .owner =THIS_MODULE , + .mdev_attr_groups = mdev_dev_groups, + .supported_type_groups = mdev_type_groups, + .create = mdpy_create, + .remove = mdpy_remove, + .device_ops = &vfio_mdev_ops, +}; +static const struct file_operations vd_fops = { .owner =THIS_MODULE , };
samples/vfio-mdev/mtty.c +10 -5
@@ -27,6 +27,7 @@#include <linux/ctype.h> #include <linux/file.h> #include <linux/mdev.h> +#include <linux/vfio_mdev.h> #include <linux/pci.h> #include <linux/serial.h> #include <uapi/linux/serial_reg.h>
@@ -1410,6 +1411,14 @@ static struct attribute_group *mdev_type_groups[] = { NULL, }; +static const struct vfio_mdev_parent_ops vfio_mdev_ops = { + .open = mtty_open, + .release = mtty_close, + .read = mtty_read, + .write = mtty_write, + .ioctl = mtty_ioctl, +}; +static const struct mdev_parent_ops mdev_fops = { .owner =THIS_MODULE , .dev_attr_groups = mtty_dev_groups,
@@ -1417,11 +1426,7 @@ static const struct mdev_parent_ops mdev_fops = { .supported_type_groups = mdev_type_groups, .create = mtty_create, .remove = mtty_remove, - .open = mtty_open, - .release = mtty_close, - .read = mtty_read, - .write = mtty_write, - .ioctl = mtty_ioctl, + .device_ops = &vfio_mdev_ops, };static void mtty_device_release (struct device *dev)
Signature · 1 line
2.19.1
RFC PATCH v2 3/6 mdev: introduce virtio device and its device ops
In reply to Jason WangThis patch implements basic support for mdev driver that support virtio transport for kernel driver.
--- drivers/vfio/mdev/mdev_core.c | 7 ++ include/linux/mdev.h | 3 + include/linux/virtio_mdev.h | 141 ++++++++++++++++++++++++++++++++++ 3 files changed, 151 insertions(+) create mode 100644 include/linux/virtio_mdev.h
drivers/vfio/mdev/mdev_core.c +7 -0
@@ -220,6 +220,13 @@ int mdev_register_vfio_device(struct device *dev, }EXPORT_SYMBOL (mdev_register_vfio_device); +int mdev_register_virtio_device (struct device *dev, +const struct mdev_parent_ops *ops) +{ +return mdev_register_device (dev, ops,MDEV_ID_VIRTIO ); +} +EXPORT_SYMBOL (mdev_register_virtio_device); +/* * mdev_unregister_device : Unregister a parent device * @dev: device structure representing parent device.
include/linux/mdev.h +3 -0
@@ -109,6 +109,8 @@ extern struct bus_type mdev_bus_type;int mdev_register_vfio_device (struct device *dev,const struct mdev_parent_ops *ops); +int mdev_register_virtio_device (struct device *dev, +const struct mdev_parent_ops *ops);void mdev_unregister_device (struct device *dev);int mdev_register_driver (struct mdev_driver *drv,struct module *owner);
@@ -119,5 +121,6 @@ struct device *mdev_dev(struct mdev_device *mdev);struct mdev_device *mdev_from_dev (struct device *dev);#define MDEV_ID_VFIO 1/* VFIO device */ +#define MDEV_ID_VIRTIO 2/* Virtio Device */ #endif /* MDEV_H */
include/linux/virtio_mdev.h new file +141 -0
141 lines not on this page · raw message
Signature · 1 line
2.19.1
RFC PATCH v2 3/6 mdev: introduce virtio device and its device ops
In reply to Jason WangThis patch implements basic support for mdev driver that support virtio transport for kernel driver.
--- drivers/vfio/mdev/mdev_core.c | 7 ++ include/linux/mdev.h | 3 + include/linux/virtio_mdev.h | 141 ++++++++++++++++++++++++++++++++++ 3 files changed, 151 insertions(+) create mode 100644 include/linux/virtio_mdev.h
drivers/vfio/mdev/mdev_core.c +7 -0
@@ -220,6 +220,13 @@ int mdev_register_vfio_device(struct device *dev, }EXPORT_SYMBOL (mdev_register_vfio_device); +int mdev_register_virtio_device (struct device *dev, +const struct mdev_parent_ops *ops) +{ +return mdev_register_device (dev, ops,MDEV_ID_VIRTIO ); +} +EXPORT_SYMBOL (mdev_register_virtio_device); +/* * mdev_unregister_device : Unregister a parent device * @dev: device structure representing parent device.
include/linux/mdev.h +3 -0
@@ -109,6 +109,8 @@ extern struct bus_type mdev_bus_type;int mdev_register_vfio_device (struct device *dev,const struct mdev_parent_ops *ops); +int mdev_register_virtio_device (struct device *dev, +const struct mdev_parent_ops *ops);void mdev_unregister_device (struct device *dev);int mdev_register_driver (struct mdev_driver *drv,struct module *owner);
@@ -119,5 +121,6 @@ struct device *mdev_dev(struct mdev_device *mdev);struct mdev_device *mdev_from_dev (struct device *dev);#define MDEV_ID_VFIO 1/* VFIO device */ +#define MDEV_ID_VIRTIO 2/* Virtio Device */ #endif /* MDEV_H */
include/linux/virtio_mdev.h new file +141 -0
141 lines not on this page · raw message
Signature · 1 line
2.19.1
RFC PATCH v2 4/6 virtio: introudce a mdev based transport
In reply to Jason WangThis path introduces a new mdev transport for virtio. This is used to use kernel virtio driver to drive the mediated device that is capable of populating virtqueue directly.
A new virtio-mdev driver will be registered to the mdev bus, when a new virtio-mdev device is probed, it will register the device with mdev based config ops. This means, unlike the exist hardware transport, this is a software transport between mdev driver and mdev device. The transport was implemented through device specific ops which is a part of mdev_parent_ops now.
--- drivers/vfio/mdev/Kconfig | 7 + drivers/vfio/mdev/Makefile | 1 + drivers/vfio/mdev/virtio_mdev.c | 418 ++++++++++++++++++++++++++++++++ 3 files changed, 426 insertions(+) create mode 100644 drivers/vfio/mdev/virtio_mdev.c
drivers/vfio/mdev/Kconfig +7 -0
@@ -16,3 +16,10 @@ config VFIO_MDEV_DEVICE default n help VFIO based driver for Mediated devices. + +config VIRTIO_MDEV_DEVICE + tristate "VIRTIO driver for Mediated devices" + depends on VFIO_MDEV && VIRTIO + default n + help + VIRTIO based driver for Mediated devices.
drivers/vfio/mdev/Makefile +1 -0
@@ -4,3 +4,4 @@ mdev-y := mdev_core.o mdev_sysfs.o mdev_driver.o obj-$(CONFIG_VFIO_MDEV) += mdev.o obj-$(CONFIG_VFIO_MDEV_DEVICE) += vfio_mdev.o +obj-$(CONFIG_VIRTIO_MDEV_DEVICE) += virtio_mdev.o
drivers/vfio/mdev/virtio_mdev.c new file +418 -0
418 lines not on this page · raw message
Signature · 1 line
2.19.1
RFC PATCH v2 4/6 virtio: introudce a mdev based transport
In reply to Jason WangThis path introduces a new mdev transport for virtio. This is used to use kernel virtio driver to drive the mediated device that is capable of populating virtqueue directly.
A new virtio-mdev driver will be registered to the mdev bus, when a new virtio-mdev device is probed, it will register the device with mdev based config ops. This means, unlike the exist hardware transport, this is a software transport between mdev driver and mdev device. The transport was implemented through device specific ops which is a part of mdev_parent_ops now.
--- drivers/vfio/mdev/Kconfig | 7 + drivers/vfio/mdev/Makefile | 1 + drivers/vfio/mdev/virtio_mdev.c | 418 ++++++++++++++++++++++++++++++++ 3 files changed, 426 insertions(+) create mode 100644 drivers/vfio/mdev/virtio_mdev.c
drivers/vfio/mdev/Kconfig +7 -0
@@ -16,3 +16,10 @@ config VFIO_MDEV_DEVICE default n help VFIO based driver for Mediated devices. + +config VIRTIO_MDEV_DEVICE + tristate "VIRTIO driver for Mediated devices" + depends on VFIO_MDEV && VIRTIO + default n + help + VIRTIO based driver for Mediated devices.
drivers/vfio/mdev/Makefile +1 -0
@@ -4,3 +4,4 @@ mdev-y := mdev_core.o mdev_sysfs.o mdev_driver.o obj-$(CONFIG_VFIO_MDEV) += mdev.o obj-$(CONFIG_VFIO_MDEV_DEVICE) += vfio_mdev.o +obj-$(CONFIG_VIRTIO_MDEV_DEVICE) += virtio_mdev.o
drivers/vfio/mdev/virtio_mdev.c new file +418 -0
418 lines not on this page · raw message
Signature · 1 line
2.19.1
RFC PATCH v2 5/6 vringh: fix copy direction of vringh_iov_push_kern()
In reply to Jason WangWe want to copy from iov to buf, so the direction was wrong.
--- drivers/vhost/vringh.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/vhost/vringh.c +7 -1
@@ -852,6 +852,12 @@ static inline int xfer_kern(void *src, void *dst, size_t len)return 0 ; } +static inline int kern_xfer (void *dst,void *src,size_t len) +{ +memcpy (dst, src, len); +return 0 ; +} +/** * vringh_init_kern - initialize a vringh for a kernelspace vring. * @vrh: the vringh to initialize.
@@ -958,7 +964,7 @@ EXPORT_SYMBOL(vringh_iov_pull_kern);ssize_t vringh_iov_push_kern (struct vringh_kiov *wiov,const void *src,size_t len) { -return vringh_iov_xfer (wiov, (void *)src, len, xfer_kern); +return vringh_iov_xfer (wiov, (void *)src, len, kern_xfer); }EXPORT_SYMBOL (vringh_iov_push_kern);
Signature · 1 line
2.19.1
RFC PATCH v2 5/6 vringh: fix copy direction of vringh_iov_push_kern()
In reply to Jason WangWe want to copy from iov to buf, so the direction was wrong.
--- drivers/vhost/vringh.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/vhost/vringh.c +7 -1
@@ -852,6 +852,12 @@ static inline int xfer_kern(void *src, void *dst, size_t len)return 0 ; } +static inline int kern_xfer (void *dst,void *src,size_t len) +{ +memcpy (dst, src, len); +return 0 ; +} +/** * vringh_init_kern - initialize a vringh for a kernelspace vring. * @vrh: the vringh to initialize.
@@ -958,7 +964,7 @@ EXPORT_SYMBOL(vringh_iov_pull_kern);ssize_t vringh_iov_push_kern (struct vringh_kiov *wiov,const void *src,size_t len) { -return vringh_iov_xfer (wiov, (void *)src, len, xfer_kern); +return vringh_iov_xfer (wiov, (void *)src, len, kern_xfer); }EXPORT_SYMBOL (vringh_iov_push_kern);
Signature · 1 line
2.19.1
RFC PATCH v2 6/6 docs: Sample driver to demonstrate how to implement virtio-mdev framework
In reply to Jason WangThis sample driver creates mdev device that simulate virtio net device over virtio mdev transport. The device is implemented through vringh and workqueue. A device specific dma ops is to make sure HVA is used directly as the IOVA. This should be sufficient for kernel virtio driver to work.
No more work for userspace VFIO based vhost-mdev driver to work. E.g through notifier, it will be addressed in the future.
--- samples/Kconfig | 7 + samples/vfio-mdev/Makefile | 1 + samples/vfio-mdev/mvnet.c | 688 +++++++++++++++++++++++++++++++++++++ 3 files changed, 696 insertions(+) create mode 100644 samples/vfio-mdev/mvnet.c
samples/Kconfig +7 -0
@@ -131,6 +131,13 @@ config SAMPLE_VFIO_MDEV_MDPY mediated device. It is a simple framebuffer and supports the region display interface (VFIO_GFX_PLANE_TYPE_REGION). +config SAMPLE_VIRTIO_MDEV_NET + tristate "Build virtio mdev net example mediated device sample code -- loadable modules only" + depends on VIRTIO_MDEV_DEVICE && VHOST_RING && m + help + Build a networking sample device for use as a virtio + mediated device. + config SAMPLE_VFIO_MDEV_MDPY_FB tristate "Build VFIO mdpy example guest fbdev driver -- loadable module only" depends on FB && m
samples/vfio-mdev/Makefile +1 -0
@@ -3,3 +3,4 @@ obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o obj-$(CONFIG_SAMPLE_VFIO_MDEV_MDPY) += mdpy.o obj-$(CONFIG_SAMPLE_VFIO_MDEV_MDPY_FB) += mdpy-fb.o obj-$(CONFIG_SAMPLE_VFIO_MDEV_MBOCHS) += mbochs.o +obj-$(CONFIG_SAMPLE_VIRTIO_MDEV_NET) += mvnet.o
samples/vfio-mdev/mvnet.c new file +688 -0
688 lines not on this page · raw message
Signature · 1 line
2.19.1
RFC PATCH v2 6/6 docs: Sample driver to demonstrate how to implement virtio-mdev framework
In reply to Jason WangThis sample driver creates mdev device that simulate virtio net device over virtio mdev transport. The device is implemented through vringh and workqueue. A device specific dma ops is to make sure HVA is used directly as the IOVA. This should be sufficient for kernel virtio driver to work.
No more work for userspace VFIO based vhost-mdev driver to work. E.g through notifier, it will be addressed in the future.
--- samples/Kconfig | 7 + samples/vfio-mdev/Makefile | 1 + samples/vfio-mdev/mvnet.c | 688 +++++++++++++++++++++++++++++++++++++ 3 files changed, 696 insertions(+) create mode 100644 samples/vfio-mdev/mvnet.c
samples/Kconfig +7 -0
@@ -131,6 +131,13 @@ config SAMPLE_VFIO_MDEV_MDPY mediated device. It is a simple framebuffer and supports the region display interface (VFIO_GFX_PLANE_TYPE_REGION). +config SAMPLE_VIRTIO_MDEV_NET + tristate "Build virtio mdev net example mediated device sample code -- loadable modules only" + depends on VIRTIO_MDEV_DEVICE && VHOST_RING && m + help + Build a networking sample device for use as a virtio + mediated device. + config SAMPLE_VFIO_MDEV_MDPY_FB tristate "Build VFIO mdpy example guest fbdev driver -- loadable module only" depends on FB && m
samples/vfio-mdev/Makefile +1 -0
@@ -3,3 +3,4 @@ obj-$(CONFIG_SAMPLE_VFIO_MDEV_MTTY) += mtty.o obj-$(CONFIG_SAMPLE_VFIO_MDEV_MDPY) += mdpy.o obj-$(CONFIG_SAMPLE_VFIO_MDEV_MDPY_FB) += mdpy-fb.o obj-$(CONFIG_SAMPLE_VFIO_MDEV_MBOCHS) += mbochs.o +obj-$(CONFIG_SAMPLE_VIRTIO_MDEV_NET) += mvnet.o
samples/vfio-mdev/mvnet.c new file +688 -0
688 lines not on this page · raw message
Signature · 1 line
2.19.1
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for mdev based hardware virtio offloading support
In reply to Jason Wang== Series Details ==
== Series Details ==
Series: mdev based hardware virtio offloading support
URL : https://patchwork.freedesktop.org/series/66989/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 32afcef2acff mdev: class id support 8efae9b60a78 mdev: introduce device specific ops -:309: ERROR:CODE_INDENT: code indent should use tabs where possible #309: FILE: include/linux/mdev.h:111: + const struct mdev_parent_ops *ops);$
-:309: WARNING:LEADING_SPACE: please, no spaces at the start of a line #309: FILE: include/linux/mdev.h:111:
+ const struct mdev_parent_ops *ops);$
-:314: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #314:
new file mode 100644
total: 1 errors, 2 warnings, 0 checks, 410 lines checked7bbada3ad14d mdev: introduce virtio device and its device ops
-:50: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #50:
new file mode 100644
-:55: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #55: FILE: include/linux/virtio_mdev.h:1:
+/*
-:70: WARNING:FUNCTION_ARGUMENTS: function definition argument 'void *' should also have an identifier name #70: FILE: include/linux/virtio_mdev.h:16:
+ irqreturn_t (*callback)(void *);
-:175: ERROR:CODE_INDENT: code indent should use tabs where possible #175: FILE: include/linux/virtio_mdev.h:121:
+ /* Device ops */$
-:186: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #186: FILE: include/linux/virtio_mdev.h:132:
+ void (*get_config)(struct mdev_device *mdev, unsigned offset,
-:187: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #187: FILE: include/linux/virtio_mdev.h:133:
+ void *buf, unsigned len);
-:188: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #188: FILE: include/linux/virtio_mdev.h:134:
+ void (*set_config)(struct mdev_device *mdev, unsigned offset,
-:189: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #189: FILE: include/linux/virtio_mdev.h:135:
+ const void *buf, unsigned len);
total: 1 errors, 7 warnings, 0 checks, 168 lines checked61e824bf250a virtio: introudce a mdev based transport
-:44: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #44:
new file mode 100644
-:84: CHECK:UNCOMMENTED_DEFINITION: spinlock_t definition without comment #84: FILE: drivers/vfio/mdev/virtio_mdev.c:36:
+ spinlock_t lock;
-:111: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #111: FILE: drivers/vfio/mdev/virtio_mdev.c:63:
+static void virtio_mdev_get(struct virtio_device *vdev, unsigned offset,
-:112: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #112: FILE: drivers/vfio/mdev/virtio_mdev.c:64:
+ void *buf, unsigned len)
-:120: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #120: FILE: drivers/vfio/mdev/virtio_mdev.c:72:
+static void virtio_mdev_set(struct virtio_device *vdev, unsigned offset,
-:121: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #121: FILE: drivers/vfio/mdev/virtio_mdev.c:73:
+ const void *buf, unsigned len)
-:189: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #189: FILE: drivers/vfio/mdev/virtio_mdev.c:141:
+virtio_mdev_setup_vq(struct virtio_device *vdev, unsigned index,
-:268: CHECK:BRACES: Blank lines aren't necessary before a close brace '}' #268: FILE: drivers/vfio/mdev/virtio_mdev.c:220:
+
+}
-:294: WARNING:RETURN_VOID: void function return statements are not generally useful #294: FILE: drivers/vfio/mdev/virtio_mdev.c:246:
+ return;
+}
-:296: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #296: FILE: drivers/vfio/mdev/virtio_mdev.c:248:
+static int virtio_mdev_find_vqs(struct virtio_device *vdev, unsigned nvqs,
-:308: WARNING:LINE_SPACING: Missing a blank line after declarations #308: FILE: drivers/vfio/mdev/virtio_mdev.c:260:
+ int i, err, queue_idx = 0;
+ vm_dev->vqs = kmalloc_array(queue_idx, sizeof(*vm_dev->vqs),
-:429: CHECK:BRACES: Blank lines aren't necessary before a close brace '}' #429: FILE: drivers/vfio/mdev/virtio_mdev.c:381:
+
+}
total: 0 errors, 9 warnings, 3 checks, 432 lines checked17f868b5d9a4 vringh: fix copy direction of vringh_iov_push_kern()822c68b1ca18 docs: Sample driver to demonstrate how to implement virtio-mdev framework -:26: WARNING:CONFIG_DESCRIPTION: please write a paragraph that describes the config symbol fully #26: FILE: samples/Kconfig:134:
+config SAMPLE_VIRTIO_MDEV_NET
-:46: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #46:
new file mode 100644
-:118: WARNING:FUNCTION_ARGUMENTS: function definition argument 'void *' should also have an identifier name #118: FILE: samples/vfio-mdev/mvnet.c:68:
+ irqreturn_t (*cb)(void *);
-:127: ERROR:CODE_INDENT: code indent should use tabs where possible #127: FILE: samples/vfio-mdev/mvnet.c:77:
+^I (1ULL << VIRTIO_F_VERSION_1) |$
-:128: WARNING:SPACING: space prohibited before semicolon #128: FILE: samples/vfio-mdev/mvnet.c:78:
+ (1ULL << VIRTIO_F_IOMMU_PLATFORM) ;
-:134: CHECK:UNCOMMENTED_DEFINITION: spinlock_t definition without comment #134: FILE: samples/vfio-mdev/mvnet.c:84:
+ spinlock_t lock;
-:147: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #147: FILE: samples/vfio-mdev/mvnet.c:97:
+static void mvnet_queue_ready(struct mvnet_state *mvnet, unsigned idx)
-:167: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #167: FILE: samples/vfio-mdev/mvnet.c:117:
+ vringh_init_kern(&vq->vring, mvnet_features, MVNET_QUEUE_MAX,
+ false, 0, 0, 0);
-:232: WARNING:BLOCK_COMMENT_STYLE: Block comments use * on subsequent lines #232: FILE: samples/vfio-mdev/mvnet.c:182:
+ /* Make sure used is visible before rasing the
+ interrupt */
-:232: WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #232: FILE: samples/vfio-mdev/mvnet.c:182:
+ interrupt */
-:265: WARNING:SPACING: space prohibited before semicolon #265: FILE: samples/vfio-mdev/mvnet.c:215:
+ return ;
-:266: WARNING:RETURN_VOID: void function return statements are not generally useful #266: FILE: samples/vfio-mdev/mvnet.c:216:
+ return ;
+}
-:274: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!addr" #274: FILE: samples/vfio-mdev/mvnet.c:224:
+ if (addr == NULL)
-:277: CHECK:SPACING: No space is necessary after a cast #277: FILE: samples/vfio-mdev/mvnet.c:227:
+ *dma_addr = (dma_addr_t) addr;
-:305: CHECK:ALLOC_SIZEOF_STRUCT: Prefer kzalloc(sizeof(*mvnet)...) over kzalloc(sizeof(struct mvnet_state)...) #305: FILE: samples/vfio-mdev/mvnet.c:255:
+ mvnet = kzalloc(sizeof(struct mvnet_state), GFP_KERNEL);
-:306: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!mvnet" #306: FILE: samples/vfio-mdev/mvnet.c:256:
+ if (mvnet == NULL)
-:360: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #360: FILE: samples/vfio-mdev/mvnet.c:310:
+sample_mvnet_dev_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
-:608: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #608: FILE: samples/vfio-mdev/mvnet.c:558:
+static void mvnet_get_config(struct mdev_device *mdev, unsigned offset,
-:609: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #609: FILE: samples/vfio-mdev/mvnet.c:559:
+ void *buf, unsigned len)
-:617: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #617: FILE: samples/vfio-mdev/mvnet.c:567:
+static void mvnet_set_config(struct mdev_device *mdev, unsigned offset,
-:618: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #618: FILE: samples/vfio-mdev/mvnet.c:568:
+ const void *buf, unsigned len)
total: 1 errors, 13 warnings, 7 checks, 705 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for mdev based hardware virtio offloading support
In reply to Jason Wang== Series Details ==
== Series Details ==
Series: mdev based hardware virtio offloading support
URL : https://patchwork.freedesktop.org/series/66989/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_6928 -> Patchwork_14470
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/
Known issues
------------
Here are the changes found in Patchwork_14470 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_mmap_gtt@basic-short:
- fi-icl-u3: [PASS][1] -> [DMESG-WARN][2] ([fdo#107724]) +1 similar issue
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/fi-icl-u3/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/fi-icl-u3/igt@[email protected]
* igt@i915_selftest@live_gem_contexts:
- fi-skl-guc: [PASS][3] -> [INCOMPLETE][4] ([fdo#111700])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/fi-skl-guc/igt@i915_selftest@live_gem_contexts.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/fi-skl-guc/igt@i915_selftest@live_gem_contexts.html
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [PASS][5] -> [FAIL][6] ([fdo#111407])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/fi-kbl-7500u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/fi-kbl-7500u/igt@[email protected]
#### Possible fixes ####
* igt@gem_ctx_switch@legacy-render:
- fi-icl-u2: [INCOMPLETE][7] ([fdo#107713] / [fdo#111381]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/fi-icl-u2/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/fi-icl-u2/igt@[email protected]
* igt@i915_module_load@reload:
- fi-blb-e6850: [INCOMPLETE][9] ([fdo#107718]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/fi-blb-e6850/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/fi-blb-e6850/igt@[email protected]
* igt@kms_addfb_basic@addfb25-x-tiled:
- fi-icl-u3: [DMESG-WARN][11] ([fdo#107724]) -> [PASS][12] +1 similar issue
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/fi-icl-u3/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/fi-icl-u3/igt@[email protected]
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#111381]: https://bugs.freedesktop.org/show_bug.cgi?id=111381
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
[fdo#111700]: https://bugs.freedesktop.org/show_bug.cgi?id=111700
Participating hosts (54 -> 48)
------------------------------
Additional (1): fi-hsw-4770r
Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_6928 -> Patchwork_14470
CI-20190529: 20190529
CI_DRM_6928: 74bb5b031ca11c7036f7be21f42a73a057fc8da8 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5194: 531d3d02d5e7a2a84d61b92b28fa01b822afc399 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14470: 822c68b1ca1845b6e2a38ae71547e9d9b4a5fadb @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
822c68b1ca18 docs: Sample driver to demonstrate how to implement virtio-mdev framework 17f868b5d9a4 vringh: fix copy direction of vringh_iov_push_kern() 61e824bf250a virtio: introudce a mdev based transport7bbada3ad14d mdev: introduce virtio device and its device ops 8efae9b60a78 mdev: introduce device specific ops32afcef2acff mdev: class id support
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for mdev based hardware virtio offloading support
In reply to Jason Wang== Series Details ==
== Series Details ==
Series: mdev based hardware virtio offloading support
URL : https://patchwork.freedesktop.org/series/66989/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_6928_full -> Patchwork_14470_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Known issues
------------
Here are the changes found in Patchwork_14470_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_ctx_isolation@rcs0-s3:
- shard-apl: [PASS][1] -> [DMESG-WARN][2] ([fdo#108566]) +6 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-apl7/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-apl1/igt@[email protected]
* igt@gem_ctx_shared@exec-single-timeline-bsd:
- shard-iclb: [PASS][3] -> [SKIP][4] ([fdo#110841])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb6/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb2/igt@[email protected]
* igt@gem_exec_schedule@pi-ringfull-bsd:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#111325]) +3 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb8/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb4/igt@[email protected]
* igt@gem_exec_schedule@preempt-queue-bsd1:
- shard-iclb: [PASS][7] -> [SKIP][8] ([fdo#109276]) +16 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb4/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb5/igt@[email protected]
* igt@kms_cursor_crc@pipe-b-cursor-128x42-sliding:
- shard-skl: [PASS][9] -> [FAIL][10] ([fdo#103232])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-skl5/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-skl1/igt@[email protected]
* igt@kms_cursor_crc@pipe-b-cursor-64x21-offscreen:
- shard-apl: [PASS][11] -> [INCOMPLETE][12] ([fdo#103927]) +1 similar issue
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-apl1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-apl7/igt@[email protected]
* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
- shard-hsw: [PASS][13] -> [FAIL][14] ([fdo#105767])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-hsw5/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-hsw6/igt@[email protected]
* igt@kms_cursor_legacy@cursorb-vs-flipa-atomic-transitions:
- shard-hsw: [PASS][15] -> [SKIP][16] ([fdo#109271])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-hsw4/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-hsw6/igt@[email protected]
* igt@kms_flip@flip-vs-suspend:
- shard-skl: [PASS][17] -> [INCOMPLETE][18] ([fdo#109507])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-skl3/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-skl7/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: [PASS][19] -> [FAIL][20] ([fdo#103167]) +7 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb6/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb1/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-min:
- shard-skl: [PASS][21] -> [FAIL][22] ([fdo#108145])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-skl5/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-skl1/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: [PASS][23] -> [FAIL][24] ([fdo#108145] / [fdo#110403])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-skl5/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-skl1/igt@[email protected]
* igt@kms_psr@psr2_sprite_plane_move:
- shard-iclb: [PASS][25] -> [SKIP][26] ([fdo#109441]) +3 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb2/igt@kms_psr@psr2_sprite_plane_move.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb3/igt@kms_psr@psr2_sprite_plane_move.html
* igt@kms_setmode@basic:
- shard-kbl: [PASS][27] -> [FAIL][28] ([fdo#99912])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-kbl7/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-kbl1/igt@[email protected]
#### Possible fixes ####
* igt@gem_exec_balancer@smoke:
- shard-iclb: [SKIP][29] ([fdo#110854]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb5/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb1/igt@[email protected]
* igt@gem_exec_schedule@fifo-bsd2:
- shard-iclb: [SKIP][31] ([fdo#109276]) -> [PASS][32] +4 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb6/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb2/igt@[email protected]
* igt@gem_exec_schedule@preemptive-hang-bsd:
- shard-iclb: [SKIP][33] ([fdo#111325]) -> [PASS][34] +4 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb1/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb6/igt@[email protected]
* {igt@gem_mmap_gtt@close-race}:
- shard-apl: [INCOMPLETE][35] ([fdo#103927]) -> [PASS][36] +1 similar issue
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-apl3/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-apl7/igt@[email protected]
* igt@gem_softpin@noreloc-s3:
- shard-apl: [DMESG-WARN][37] ([fdo#108566]) -> [PASS][38] +2 similar issues
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-apl6/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-apl7/igt@[email protected]
* igt@gem_tiled_swapping@non-threaded:
- shard-glk: [DMESG-WARN][39] ([fdo#108686]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-glk4/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-glk4/igt@[email protected]
* igt@kms_cursor_crc@pipe-c-cursor-suspend:
- shard-skl: [INCOMPLETE][41] ([fdo#110741]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-skl6/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-skl8/igt@[email protected]
* igt@kms_flip@flip-vs-dpms-interruptible:
- shard-iclb: [INCOMPLETE][43] ([fdo#107713]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb1/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb6/igt@[email protected]
* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-snb: [DMESG-WARN][45] ([fdo#102365]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-snb4/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-snb4/igt@[email protected]
* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-pwrite:
- shard-iclb: [FAIL][47] ([fdo#103167]) -> [PASS][48] +2 similar issues
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb1/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-pwrite.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-pwrite.html
* igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl: [FAIL][49] ([fdo#108145]) -> [PASS][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-skl1/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-skl4/igt@[email protected]
* igt@kms_plane_cursor@pipe-a-primary-size-128:
- shard-kbl: [DMESG-WARN][51] ([fdo#103558] / [fdo#105602]) -> [PASS][52] +37 similar issues
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-kbl6/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-kbl2/igt@[email protected]
* igt@kms_psr@psr2_sprite_mmap_cpu:
- shard-iclb: [SKIP][53] ([fdo#109441]) -> [PASS][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb1/igt@kms_psr@psr2_sprite_mmap_cpu.html
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb2/igt@kms_psr@psr2_sprite_mmap_cpu.html
* igt@perf@blocking:
- shard-skl: [FAIL][55] ([fdo#110728]) -> [PASS][56] +1 similar issue
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-skl7/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-skl6/igt@[email protected]
#### Warnings ####
* igt@gem_mocs_settings@mocs-isolation-bsd2:
- shard-iclb: [FAIL][57] ([fdo#111330]) -> [SKIP][58] ([fdo#109276]) +1 similar issue
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb4/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb5/igt@[email protected]
* igt@gem_mocs_settings@mocs-reset-bsd2:
- shard-iclb: [SKIP][59] ([fdo#109276]) -> [FAIL][60] ([fdo#111330]) +1 similar issue
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-iclb5/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-iclb1/igt@[email protected]
* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-d:
- shard-kbl: [SKIP][61] ([fdo#105602] / [fdo#109271] / [fdo#109278]) -> [SKIP][62] ([fdo#109271] / [fdo#109278]) +3 similar issues
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-kbl6/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-kbl2/igt@[email protected]
* igt@kms_panel_fitting@legacy:
- shard-kbl: [SKIP][63] ([fdo#105602] / [fdo#109271]) -> [SKIP][64] ([fdo#109271]) +30 similar issues
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-kbl6/igt@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-kbl2/igt@[email protected]
* igt@kms_vblank@pipe-a-ts-continuation-suspend:
- shard-apl: [INCOMPLETE][65] ([fdo#103927]) -> [DMESG-WARN][66] ([fdo#108566])
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6928/shard-apl4/igt@[email protected]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/shard-apl3/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#102365]: https://bugs.freedesktop.org/show_bug.cgi?id=102365
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109507]: https://bugs.freedesktop.org/show_bug.cgi?id=109507
[fdo#110403]: https://bugs.freedesktop.org/show_bug.cgi?id=110403
[fdo#110728]: https://bugs.freedesktop.org/show_bug.cgi?id=110728
[fdo#110741]: https://bugs.freedesktop.org/show_bug.cgi?id=110741
[fdo#110841]: https://bugs.freedesktop.org/show_bug.cgi?id=110841
[fdo#110854]: https://bugs.freedesktop.org/show_bug.cgi?id=110854
[fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
[fdo#111330]: https://bugs.freedesktop.org/show_bug.cgi?id=111330
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
Participating hosts (9 -> 9)
------------------------------
No changes in participating hosts
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_6928 -> Patchwork_14470
CI-20190529: 20190529
CI_DRM_6928: 74bb5b031ca11c7036f7be21f42a73a057fc8da8 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5194: 531d3d02d5e7a2a84d61b92b28fa01b822afc399 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14470: 822c68b1ca1845b6e2a38ae71547e9d9b4a5fadb @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14470/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 25 lines · Jason Wang
Hi all:
There are hardware that can do virtio datapath offloading while having its own control path. This path tries to implement a mdev based unified API to support using kernel virtio driver to drive those devices. This is done by introducing a new mdev transport for virtio (
virtio_mdev) and register itself as a new kind of mdev driver. Then it provides a unified way for kernel virtio driver to talk with mdev device implementation.Though the series only contain kernel driver support, the goal is to make the transport generic enough to support userspace drivers. This means vhost-mdev[1] could be built on top as well by resuing the transport.
A sample driver is also implemented which simulate a virito-net loopback ethernet device on top of vringh + workqueue. This could be used as a reference implementation for real hardware driver.
Consider mdev framework only support VFIO device and driver right now, this series also extend it to support other types. This is done through introducing class id to the device and pairing it with
id_talbeclaimed by the driver. On top, this seris also decouple device specific parents ops out of the common ones.
Quoted 3 lines
Pktgen test was done with virito-net + mvnet loop back device.
Please review.
CC Parav.
Thanks
Quoted 44 lines
Changes from V1:
- rename device id to class id
- add docs for class id and device specific ops (device_ops)
- splitdevice_opsinto seperate headers
- drop themdev_set_dma_ops()
- usedevice_opsto implement the transport API, then it's not a part of UAPI any more
- useGFP_ATOMICin mvnet sample device and other tweaks
- set_vring_base/get_vring_base support for mvnet deviceJason Wang (6):
mdev: class id support
mdev: introduce device specific ops
mdev: introduce virtio device and its device ops
virtio: introudce a mdev based transport
vringh: fix copy direction ofvringh_iov_push_kern()
docs: Sample driver to demonstrate how to implement virtio-mdev
framework.../driver-api/vfio-mediated-device.rst | 11 +- drivers/gpu/drm/i915/gvt/kvmgt.c | 17 +- drivers/s390/cio/vfio_ccw_ops.c | 17 +- drivers/s390/crypto/vfio_ap_ops.c | 14 +- drivers/vfio/mdev/Kconfig | 7 + drivers/vfio/mdev/Makefile | 1 + drivers/vfio/mdev/mdev_core.c | 21 +- drivers/vfio/mdev/mdev_driver.c | 14 + drivers/vfio/mdev/mdev_private.h | 1 + drivers/vfio/mdev/vfio_mdev.c | 37 +- drivers/vfio/mdev/virtio_mdev.c | 418 +++++++++++ drivers/vhost/vringh.c | 8 +- include/linux/mdev.h | 46 +- include/linux/mod_devicetable.h | 8 + include/linux/vfio_mdev.h | 50 ++ include/linux/virtio_mdev.h | 141 ++++ samples/Kconfig | 7 + samples/vfio-mdev/Makefile | 1 + samples/vfio-mdev/mbochs.c | 19 +- samples/vfio-mdev/mdpy.c | 19 +- samples/vfio-mdev/mtty.c | 17 +- samples/vfio-mdev/mvnet.c | 688 ++++++++++++++++++ 22 files changed, 1473 insertions(+), 89 deletions(-)
Quoted 5 lines
create mode 100644
drivers/vfio/mdev/virtio_mdev.ccreate mode 100644include/linux/vfio_mdev.hcreate mode 100644include/linux/virtio_mdev.hcreate mode 100644samples/vfio-mdev/mvnet.c
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 25 lines · Jason Wang
Hi all:
There are hardware that can do virtio datapath offloading while having its own control path. This path tries to implement a mdev based unified API to support using kernel virtio driver to drive those devices. This is done by introducing a new mdev transport for virtio (
virtio_mdev) and register itself as a new kind of mdev driver. Then it provides a unified way for kernel virtio driver to talk with mdev device implementation.Though the series only contain kernel driver support, the goal is to make the transport generic enough to support userspace drivers. This means vhost-mdev[1] could be built on top as well by resuing the transport.
A sample driver is also implemented which simulate a virito-net loopback ethernet device on top of vringh + workqueue. This could be used as a reference implementation for real hardware driver.
Consider mdev framework only support VFIO device and driver right now, this series also extend it to support other types. This is done through introducing class id to the device and pairing it with
id_talbeclaimed by the driver. On top, this seris also decouple device specific parents ops out of the common ones.
Quoted 3 lines
Pktgen test was done with virito-net + mvnet loop back device.
Please review.
CC Parav.
Thanks
Quoted 44 lines
Changes from V1:
- rename device id to class id
- add docs for class id and device specific ops (device_ops)
- splitdevice_opsinto seperate headers
- drop themdev_set_dma_ops()
- usedevice_opsto implement the transport API, then it's not a part of UAPI any more
- useGFP_ATOMICin mvnet sample device and other tweaks
- set_vring_base/get_vring_base support for mvnet deviceJason Wang (6):
mdev: class id support
mdev: introduce device specific ops
mdev: introduce virtio device and its device ops
virtio: introudce a mdev based transport
vringh: fix copy direction ofvringh_iov_push_kern()
docs: Sample driver to demonstrate how to implement virtio-mdev
framework.../driver-api/vfio-mediated-device.rst | 11 +- drivers/gpu/drm/i915/gvt/kvmgt.c | 17 +- drivers/s390/cio/vfio_ccw_ops.c | 17 +- drivers/s390/crypto/vfio_ap_ops.c | 14 +- drivers/vfio/mdev/Kconfig | 7 + drivers/vfio/mdev/Makefile | 1 + drivers/vfio/mdev/mdev_core.c | 21 +- drivers/vfio/mdev/mdev_driver.c | 14 + drivers/vfio/mdev/mdev_private.h | 1 + drivers/vfio/mdev/vfio_mdev.c | 37 +- drivers/vfio/mdev/virtio_mdev.c | 418 +++++++++++ drivers/vhost/vringh.c | 8 +- include/linux/mdev.h | 46 +- include/linux/mod_devicetable.h | 8 + include/linux/vfio_mdev.h | 50 ++ include/linux/virtio_mdev.h | 141 ++++ samples/Kconfig | 7 + samples/vfio-mdev/Makefile | 1 + samples/vfio-mdev/mbochs.c | 19 +- samples/vfio-mdev/mdpy.c | 19 +- samples/vfio-mdev/mtty.c | 17 +- samples/vfio-mdev/mvnet.c | 688 ++++++++++++++++++ 22 files changed, 1473 insertions(+), 89 deletions(-)
Quoted 5 lines
create mode 100644
drivers/vfio/mdev/virtio_mdev.ccreate mode 100644include/linux/vfio_mdev.hcreate mode 100644include/linux/virtio_mdev.hcreate mode 100644samples/vfio-mdev/mvnet.c
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 9 lines · Jason Wang
Hi all:
There are hardware that can do virtio datapath offloading while having its own control path. This path tries to implement a mdev based unified API to support using kernel virtio driver to drive those devices. This is done by introducing a new mdev transport for virtio (
virtio_mdev) and register itself as a new kind of mdev driver. Then it provides a unified way for kernel virtio driver to talk with mdev device implementation.
This is actually simple enough that I'm inclined to just put this into linux-next.
This mixes virtio and vfio so the code can thinkably be merged through either tree.
Alex, any strong opinions on any of this?
Quoted 58 lines
Though the series only contain kernel driver support, the goal is to make the transport generic enough to support userspace drivers. This means vhost-mdev[1] could be built on top as well by resuing the transport.
A sample driver is also implemented which simulate a virito-net loopback ethernet device on top of vringh + workqueue. This could be used as a reference implementation for real hardware driver.
Consider mdev framework only support VFIO device and driver right now, this series also extend it to support other types. This is done through introducing class id to the device and pairing it with
id_talbeclaimed by the driver. On top, this seris also decouple device specific parents ops out of the common ones.Pktgen test was done with virito-net + mvnet loop back device.
Please review.
Changes from V1:
- rename device id to class id
- add docs for class id and device specific ops (device_ops)
- splitdevice_opsinto seperate headers
- drop themdev_set_dma_ops()
- usedevice_opsto implement the transport API, then it's not a part of UAPI any more
- useGFP_ATOMICin mvnet sample device and other tweaks
- set_vring_base/get_vring_base support for mvnet deviceJason Wang (6):
mdev: class id support
mdev: introduce device specific ops
mdev: introduce virtio device and its device ops
virtio: introudce a mdev based transport
vringh: fix copy direction ofvringh_iov_push_kern()
docs: Sample driver to demonstrate how to implement virtio-mdev
framework.../driver-api/vfio-mediated-device.rst | 11 +- drivers/gpu/drm/i915/gvt/kvmgt.c | 17 +- drivers/s390/cio/vfio_ccw_ops.c | 17 +- drivers/s390/crypto/vfio_ap_ops.c | 14 +- drivers/vfio/mdev/Kconfig | 7 + drivers/vfio/mdev/Makefile | 1 + drivers/vfio/mdev/mdev_core.c | 21 +- drivers/vfio/mdev/mdev_driver.c | 14 + drivers/vfio/mdev/mdev_private.h | 1 + drivers/vfio/mdev/vfio_mdev.c | 37 +- drivers/vfio/mdev/virtio_mdev.c | 418 +++++++++++ drivers/vhost/vringh.c | 8 +- include/linux/mdev.h | 46 +- include/linux/mod_devicetable.h | 8 + include/linux/vfio_mdev.h | 50 ++ include/linux/virtio_mdev.h | 141 ++++ samples/Kconfig | 7 + samples/vfio-mdev/Makefile | 1 + samples/vfio-mdev/mbochs.c | 19 +-
Quoted 11 lines
samples/vfio-mdev/mdpy.c | 19 +- samples/vfio-mdev/mtty.c | 17 +- samples/vfio-mdev/mvnet.c | 688 ++++++++++++++++++ 22 files changed, 1473 insertions(+), 89 deletions(-) create mode 100644 drivers/vfio/mdev/virtio_mdev.c create mode 100644 include/linux/vfio_mdev.h create mode 100644 include/linux/virtio_mdev.h create mode 100644 samples/vfio-mdev/mvnet.cSignature · 1 line
2.19.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Michael S. Tsirkin
maintainerQuoted 9 lines · Jason Wang
Hi all:
There are hardware that can do virtio datapath offloading while having its own control path. This path tries to implement a mdev based unified API to support using kernel virtio driver to drive those devices. This is done by introducing a new mdev transport for virtio (
virtio_mdev) and register itself as a new kind of mdev driver. Then it provides a unified way for kernel virtio driver to talk with mdev device implementation.
This is actually simple enough that I'm inclined to just put this into linux-next.
This mixes virtio and vfio so the code can thinkably be merged through either tree.
Alex, any strong opinions on any of this?
Quoted 69 lines
Though the series only contain kernel driver support, the goal is to make the transport generic enough to support userspace drivers. This means vhost-mdev[1] could be built on top as well by resuing the transport.
A sample driver is also implemented which simulate a virito-net loopback ethernet device on top of vringh + workqueue. This could be used as a reference implementation for real hardware driver.
Consider mdev framework only support VFIO device and driver right now, this series also extend it to support other types. This is done through introducing class id to the device and pairing it with
id_talbeclaimed by the driver. On top, this seris also decouple device specific parents ops out of the common ones.Pktgen test was done with virito-net + mvnet loop back device.
Please review.
Changes from V1:
- rename device id to class id
- add docs for class id and device specific ops (device_ops)
- splitdevice_opsinto seperate headers
- drop themdev_set_dma_ops()
- usedevice_opsto implement the transport API, then it's not a part of UAPI any more
- useGFP_ATOMICin mvnet sample device and other tweaks
- set_vring_base/get_vring_base support for mvnet deviceJason Wang (6):
mdev: class id support
mdev: introduce device specific ops
mdev: introduce virtio device and its device ops
virtio: introudce a mdev based transport
vringh: fix copy direction ofvringh_iov_push_kern()
docs: Sample driver to demonstrate how to implement virtio-mdev
framework.../driver-api/vfio-mediated-device.rst | 11 +- drivers/gpu/drm/i915/gvt/kvmgt.c | 17 +- drivers/s390/cio/vfio_ccw_ops.c | 17 +- drivers/s390/crypto/vfio_ap_ops.c | 14 +- drivers/vfio/mdev/Kconfig | 7 + drivers/vfio/mdev/Makefile | 1 + drivers/vfio/mdev/mdev_core.c | 21 +- drivers/vfio/mdev/mdev_driver.c | 14 + drivers/vfio/mdev/mdev_private.h | 1 + drivers/vfio/mdev/vfio_mdev.c | 37 +- drivers/vfio/mdev/virtio_mdev.c | 418 +++++++++++ drivers/vhost/vringh.c | 8 +- include/linux/mdev.h | 46 +- include/linux/mod_devicetable.h | 8 + include/linux/vfio_mdev.h | 50 ++ include/linux/virtio_mdev.h | 141 ++++ samples/Kconfig | 7 + samples/vfio-mdev/Makefile | 1 + samples/vfio-mdev/mbochs.c | 19 +- samples/vfio-mdev/mdpy.c | 19 +- samples/vfio-mdev/mtty.c | 17 +- samples/vfio-mdev/mvnet.c | 688 ++++++++++++++++++ 22 files changed, 1473 insertions(+), 89 deletions(-) create mode 100644 drivers/vfio/mdev/virtio_mdev.c create mode 100644 include/linux/vfio_mdev.h create mode 100644 include/linux/virtio_mdev.h create mode 100644 samples/vfio-mdev/mvnet.cSignature · 1 line
2.19.1