[PATCH v2 6/9] vfio/mdev: Add mdev available instance checking to the core
Cornelia Huck
cohuck at redhat.com
Mon Sep 20 18:02:29 UTC 2021
On Thu, Sep 09 2021, Jason Gunthorpe <jgg at nvidia.com> wrote:
> Many of the mdev drivers use a simple counter for keeping track of the
> available instances. Move this code to the core code and store the counter
> in the mdev_type. Implement it using correct locking, fixing mdpy.
>
> Drivers provide a get_available() callback to set the number of available
> instances for their mtypes which is fixed at registration time. The core
> provides a standard sysfs attribute to return the available_instances.
So, according to the documentation, available_instances is
mandatory. This means that drivers either need to provide get_available
or implement their own version of the attribute. I think we want to
update vfio-mediated-device.rst as well?
>
> Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>
> ---
> drivers/s390/cio/vfio_ccw_drv.c | 1 -
> drivers/s390/cio/vfio_ccw_ops.c | 26 ++++++-------------
> drivers/s390/cio/vfio_ccw_private.h | 2 --
> drivers/s390/crypto/vfio_ap_ops.c | 32 ++++++-----------------
> drivers/s390/crypto/vfio_ap_private.h | 2 --
> drivers/vfio/mdev/mdev_core.c | 11 +++++++-
> drivers/vfio/mdev/mdev_private.h | 2 ++
> drivers/vfio/mdev/mdev_sysfs.c | 37 +++++++++++++++++++++++++++
> include/linux/mdev.h | 2 ++
> samples/vfio-mdev/mdpy.c | 22 +++++-----------
> 10 files changed, 73 insertions(+), 64 deletions(-)
Otherwise, looks good.
More information about the dri-devel
mailing list