Re: [Qemu-devel] [PATCH v7 4/4] docs: Add Documentation for Mediated devices
Adding Eric. Eric, This is the v7 version of patch. I'll incorporate changes that you suggested here. Kirti. On 8/25/2016 9:23 AM, Kirti Wankhede wrote: > Add file Documentation/vfio-mediated-device.txt that include details of > mediated device framework. > > Signed-off-by: Kirti Wankhede > Signed-off-by: Neo Jia > Change-Id: I137dd646442936090d92008b115908b7b2c7bc5d > Reviewed-on: http://git-master/r/1182512 > Reviewed-by: Automatic_Commit_Validation_User > --- > Documentation/vfio-mediated-device.txt | 203 > + > 1 file changed, 203 insertions(+) > create mode 100644 Documentation/vfio-mediated-device.txt > > diff --git a/Documentation/vfio-mediated-device.txt > b/Documentation/vfio-mediated-device.txt > new file mode 100644 > index ..237d8eb630b7 > --- /dev/null > +++ b/Documentation/vfio-mediated-device.txt > @@ -0,0 +1,203 @@ > +VFIO Mediated devices [1] > +--- > + > +There are more and more use cases/demands to virtualize the DMA devices which > +doesn't have SR_IOV capability built-in. To do this, drivers of different > +devices had to develop their own management interface and set of APIs and > then > +integrate it to user space software. We've identified common requirements and > +unified management interface for such devices to make user space software > +integration easier. > + > +The VFIO driver framework provides unified APIs for direct device access. It > is > +an IOMMU/device agnostic framework for exposing direct device access to > +user space, in a secure, IOMMU protected environment. This framework is > +used for multiple devices like GPUs, network adapters and compute > accelerators. > +With direct device access, virtual machines or user space applications have > +direct access of physical device. This framework is reused for mediated > devices. > + > +Mediated core driver provides a common interface for mediated device > management > +that can be used by drivers of different devices. This module provides a > generic > +interface to create/destroy mediated device, add/remove it to mediated bus > +driver, add/remove device to IOMMU group. It also provides an interface to > +register bus driver, for example, Mediated VFIO mdev driver is designed for > +mediated devices and supports VFIO APIs. Mediated bus driver add/delete > mediated > +device to VFIO Group. > + > +Below is the high Level block diagram, with NVIDIA, Intel and IBM devices > +as example, since these are the devices which are going to actively use > +this module as of now. > + > + +---+ > + | | > + | +---+ | mdev_register_driver() +--+ > + | | | +<+ | > + | | mdev | | | | > + | | bus | +>+ vfio_mdev.ko |<-> VFIO user > + | | driver | | probe()/remove()| |APIs > + | | | | +--+ > + | +---+ | > + | | > + | MDEV CORE| > + | MODULE | > + | mdev.ko | > + | +---+ | mdev_register_device() +--+ > + | | | +<+ | > + | | | | | nvidia.ko |<-> physical > + | | | +>+ |device > + | | | |callbacks+--+ > + | | Physical | | > + | | device | | mdev_register_device() +--+ > + | | interface | |<+ | > + | | | | | i915.ko |<-> physical > + | | | +>+ |device > + | | | |callbacks+--+ > + | | | | > + | | | | mdev_register_device() +--+ > + | | | +<+ | > + | | | | | ccw_device.ko|<-> physical > + | | | +>+ |device > + | | | |callbacks+--+ > + | +---+ | > + +---+ > + > + > +Registration Interfaces > +--- > + > +Mediated core driver provides two types of registration interfaces: > + > +1. Registration interface for mediated bus driver: > +- > + /* > + * struct mdev_driver [2] - Mediated device's driver > + * @name: driver name > + * @probe: called when new device created > + * @remove: called when device removed > + * @driver: device driver structure > + */ > + struct mdev_
[Qemu-devel] [PATCH v7 4/4] docs: Add Documentation for Mediated devices
Add file Documentation/vfio-mediated-device.txt that include details of mediated device framework. Signed-off-by: Kirti Wankhede Signed-off-by: Neo Jia Change-Id: I137dd646442936090d92008b115908b7b2c7bc5d Reviewed-on: http://git-master/r/1182512 Reviewed-by: Automatic_Commit_Validation_User --- Documentation/vfio-mediated-device.txt | 203 + 1 file changed, 203 insertions(+) create mode 100644 Documentation/vfio-mediated-device.txt diff --git a/Documentation/vfio-mediated-device.txt b/Documentation/vfio-mediated-device.txt new file mode 100644 index ..237d8eb630b7 --- /dev/null +++ b/Documentation/vfio-mediated-device.txt @@ -0,0 +1,203 @@ +VFIO Mediated devices [1] +--- + +There are more and more use cases/demands to virtualize the DMA devices which +doesn't have SR_IOV capability built-in. To do this, drivers of different +devices had to develop their own management interface and set of APIs and then +integrate it to user space software. We've identified common requirements and +unified management interface for such devices to make user space software +integration easier. + +The VFIO driver framework provides unified APIs for direct device access. It is +an IOMMU/device agnostic framework for exposing direct device access to +user space, in a secure, IOMMU protected environment. This framework is +used for multiple devices like GPUs, network adapters and compute accelerators. +With direct device access, virtual machines or user space applications have +direct access of physical device. This framework is reused for mediated devices. + +Mediated core driver provides a common interface for mediated device management +that can be used by drivers of different devices. This module provides a generic +interface to create/destroy mediated device, add/remove it to mediated bus +driver, add/remove device to IOMMU group. It also provides an interface to +register bus driver, for example, Mediated VFIO mdev driver is designed for +mediated devices and supports VFIO APIs. Mediated bus driver add/delete mediated +device to VFIO Group. + +Below is the high Level block diagram, with NVIDIA, Intel and IBM devices +as example, since these are the devices which are going to actively use +this module as of now. + + +---+ + | | + | +---+ | mdev_register_driver() +--+ + | | | +<+ | + | | mdev | | | | + | | bus | +>+ vfio_mdev.ko |<-> VFIO user + | | driver | | probe()/remove()| |APIs + | | | | +--+ + | +---+ | + | | + | MDEV CORE| + | MODULE | + | mdev.ko | + | +---+ | mdev_register_device() +--+ + | | | +<+ | + | | | | | nvidia.ko |<-> physical + | | | +>+ |device + | | | |callbacks+--+ + | | Physical | | + | | device | | mdev_register_device() +--+ + | | interface | |<+ | + | | | | | i915.ko |<-> physical + | | | +>+ |device + | | | |callbacks+--+ + | | | | + | | | | mdev_register_device() +--+ + | | | +<+ | + | | | | | ccw_device.ko|<-> physical + | | | +>+ |device + | | | |callbacks+--+ + | +---+ | + +---+ + + +Registration Interfaces +--- + +Mediated core driver provides two types of registration interfaces: + +1. Registration interface for mediated bus driver: +- + /* + * struct mdev_driver [2] - Mediated device's driver + * @name: driver name + * @probe: called when new device created + * @remove: called when device removed + * @driver: device driver structure + */ + struct mdev_driver { +const char *name; +int (*probe) (struct device *dev); +void (*remove) (struct device *dev); +struct device_driverdriver; + }; + +Mediated bus driver for mdev should use this interface to register and +unregister with core driver respectively: + +extern int mdev_register_driver(struct mdev_driver *drv, s