aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorYi Liu <[email protected]>2023-07-18 03:55:39 -0700
committerAlex Williamson <[email protected]>2023-07-25 10:18:02 -0600
commita80e1de93275fbfba0617e6bbea8522ea5329eb5 (patch)
tree729884b8ae34f86dd4a6038ecb1a4fa9e684a95e /include/linux
parentaf949759bad27934b6f242e8a3b1c394e09fb4a3 (diff)
vfio: Add helper to search vfio_device in a dev_set
There are drivers that need to search vfio_device within a given dev_set. e.g. vfio-pci. So add a helper. vfio_pci_is_device_in_set() now returns -EBUSY in commit a882c16a2b7e ("vfio/pci: Change vfio_pci_try_bus_reset() to use the dev_set") where it was trying to preserve the return of vfio_pci_try_zap_and_vma_lock_cb(). However, it makes more sense to return -ENODEV. Suggested-by: Alex Williamson <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Tested-by: Yanting Jiang <[email protected]> Tested-by: Terrence Xu <[email protected]> Tested-by: Zhenzhong Duan <[email protected]> Signed-off-by: Yi Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/vfio.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 2a45853773a6..ee120d2d530b 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -244,6 +244,9 @@ void vfio_unregister_group_dev(struct vfio_device *device);
int vfio_assign_device_set(struct vfio_device *device, void *set_id);
unsigned int vfio_device_set_open_count(struct vfio_device_set *dev_set);
+struct vfio_device *
+vfio_find_device_in_devset(struct vfio_device_set *dev_set,
+ struct device *dev);
int vfio_mig_get_next_state(struct vfio_device *device,
enum vfio_device_mig_state cur_fsm,