3cb24827 | 05-Aug-2021 |
Jason Gunthorpe <jgg@nvidia.com> |
vfio/mbochs: Fix close when multiple device FDs are open
mbochs_close() iterates over global device state and frees it. Currently this is done every time a device FD is closed, but if multiple devic
vfio/mbochs: Fix close when multiple device FDs are open
mbochs_close() iterates over global device state and frees it. Currently this is done every time a device FD is closed, but if multiple device FDs are open this could corrupt other still active FDs.
Change this to use close_device() so it only runs on the last close.
Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/11-v4-9ea22c5e6afb+1adf-vfio_reflck_jgg@nvidia.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
show more ...
|
17a1e4fa | 05-Aug-2021 |
Jason Gunthorpe <jgg@nvidia.com> |
vfio/samples: Delete useless open/close
The core code no longer requires these ops to be defined, so delete these empty functions and leave the op as NULL. mtty's functions only log a pointless mess
vfio/samples: Delete useless open/close
The core code no longer requires these ops to be defined, so delete these empty functions and leave the op as NULL. mtty's functions only log a pointless message, delete that entirely.
Signed-off-by: Yishai Hadas <yishaih@nvidia.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/5-v4-9ea22c5e6afb+1adf-vfio_reflck_jgg@nvidia.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
show more ...
|
de5494af | 05-Aug-2021 |
Jason Gunthorpe <jgg@nvidia.com> |
vfio/mbochs: Fix missing error unwind of mbochs_used_mbytes
Convert mbochs to use an atomic scheme for this like mtty was changed into. The atomic fixes various race conditions with probing. Add the
vfio/mbochs: Fix missing error unwind of mbochs_used_mbytes
Convert mbochs to use an atomic scheme for this like mtty was changed into. The atomic fixes various race conditions with probing. Add the missing error unwind. Also add the missing kfree of mdev_state->pages.
Fixes: 681c1615f891 ("vfio/mbochs: Convert to use vfio_register_group_dev()") Reported-by: Cornelia Huck <cohuck@redhat.com> Co-developed-by: Alex Williamson <alex.williamson@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Link: https://lore.kernel.org/r/2-v4-9ea22c5e6afb+1adf-vfio_reflck_jgg@nvidia.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
show more ...
|
97d0a687 | 25-Jun-2021 |
Alex Williamson <alex.williamson@redhat.com> |
vfio/mtty: Enforce available_instances
The sample mtty mdev driver doesn't actually enforce the number of device instances it claims are available. Implement this properly.
Link: https://lore.kern
vfio/mtty: Enforce available_instances
The sample mtty mdev driver doesn't actually enforce the number of device instances it claims are available. Implement this properly.
Link: https://lore.kernel.org/r/162465624894.3338367.12935940647049917981.stgit@omen Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed by: Kirti Wankhede <kwankhede@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
show more ...
|
0dd1b7fc | 25-Jun-2021 |
Jason Gunthorpe <jgg@nvidia.com> |
vfio/mtty: Delete mdev_devices_list
Dan points out that an error case left things on this list. It is also missing locking in available_instances_show().
Further study shows the list isn't needed a
vfio/mtty: Delete mdev_devices_list
Dan points out that an error case left things on this list. It is also missing locking in available_instances_show().
Further study shows the list isn't needed at all, just store the total ports in use in an atomic and delete the whole thing.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: 09177ac91921 ("vfio/mtty: Convert to use vfio_register_group_dev()") Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/0-v1-0bc56b362ca7+62-mtty_used_ports_jgg@nvidia.com Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
show more ...
|
681c1615 | 17-Jun-2021 |
Jason Gunthorpe <jgg@nvidia.com> |
vfio/mbochs: Convert to use vfio_register_group_dev()
This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and th
vfio/mbochs: Convert to use vfio_register_group_dev()
This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and the wonky dead code with a simple container_of().
Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20210617142218.1877096-11-hch@lst.de Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
show more ...
|
437e4136 | 17-Jun-2021 |
Jason Gunthorpe <jgg@nvidia.com> |
vfio/mdpy: Convert to use vfio_register_group_dev()
This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and the
vfio/mdpy: Convert to use vfio_register_group_dev()
This is straightforward conversion, the mdev_state is actually serving as the vfio_device and we can replace all the mdev_get_drvdata()'s and the wonky dead code with a simple container_of().
Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20210617142218.1877096-10-hch@lst.de Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
show more ...
|
9169cff1 | 06-Apr-2021 |
Jason Gunthorpe <jgg@nvidia.com> |
vfio/mdev: Correct the function signatures for the mdev_type_attributes
The driver core standard is to pass in the properly typed object, the properly typed attribute and the buffer data. It stems f
vfio/mdev: Correct the function signatures for the mdev_type_attributes
The driver core standard is to pass in the properly typed object, the properly typed attribute and the buffer data. It stems from the root kobject method:
ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr,..)
Each subclass of kobject should provide their own function with the same signature but more specific types, eg struct device uses:
ssize_t (*show)(struct device *dev, struct device_attribute *attr,..)
In this case the existing signature is:
ssize_t (*show)(struct kobject *kobj, struct device *dev,..)
Where kobj is a 'struct mdev_type *' and dev is 'mdev_type->parent->dev'.
Change the mdev_type related sysfs attribute functions to:
ssize_t (*show)(struct mdev_type *mtype, struct mdev_type_attribute *attr,..)
In order to restore type safety and match the driver core standard
There are no current users of 'attr', but if it is ever needed it would be hard to add in retroactively, so do it now.
Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Message-Id: <18-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
show more ...
|
c2ef2f50 | 06-Apr-2021 |
Jason Gunthorpe <jgg@nvidia.com> |
vfio/mdev: Remove kobj from mdev_parent_ops->create()
The kobj here is a type-erased version of mdev_type, which is already stored in the struct mdev_device being passed in. It was only ever used to
vfio/mdev: Remove kobj from mdev_parent_ops->create()
The kobj here is a type-erased version of mdev_type, which is already stored in the struct mdev_device being passed in. It was only ever used to compute the type_group_id, which is now extracted directly from the mdev.
Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Message-Id: <17-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
show more ...
|
3d3a360e | 06-Apr-2021 |
Jason Gunthorpe <jgg@nvidia.com> |
vfio/mbochs: Use mdev_get_type_group_id()
The mbochs_types array is parallel to the supported_type_groups array, so the type_group_id indexes both. Instead of doing string searching just directly in
vfio/mbochs: Use mdev_get_type_group_id()
The mbochs_types array is parallel to the supported_type_groups array, so the type_group_id indexes both. Instead of doing string searching just directly index with type_group_id in all places.
Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Message-Id: <14-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
show more ...
|
adc9d1f6 | 06-Apr-2021 |
Jason Gunthorpe <jgg@nvidia.com> |
vfio/mdpy: Use mdev_get_type_group_id()
The mdpy_types array is parallel to the supported_type_groups array, so the type_group_id indexes both. Instead of doing string searching just directly index
vfio/mdpy: Use mdev_get_type_group_id()
The mdpy_types array is parallel to the supported_type_groups array, so the type_group_id indexes both. Instead of doing string searching just directly index with type_group_id in all places.
Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Message-Id: <13-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
show more ...
|