[SRU][N:linux-bluefield][PATCH v1 1/2] UBUNTU: SAUCE: vfio: Export vfio device get and put registration helpers
Stav Aviram
saviram at nvidia.com
Thu Apr 16 12:14:05 UTC 2026
From: Vivek Kasireddy <vivek.kasireddy at intel.com>
BugLink: https://bugs.launchpad.net/bugs/2148554
These helpers are useful for managing additional references taken
on the device from other associated VFIO modules.
Original-patch-by: Jason Gunthorpe <jgg at nvidia.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy at intel.com>
Reviewed-by: Kevin Tian <kevin.tian at intel.com>
Tested-by: Alex Mastro <amastro at fb.com>
Tested-by: Nicolin Chen <nicolinc at nvidia.com>
Signed-off-by: Leon Romanovsky <leonro at nvidia.com>
Acked-by: Ankit Agrawal <ankita at nvidia.com>
Link: https://lore.kernel.org/r/20251120-dmabuf-vfio-v9-7-d7f71607f371@nvidia.com
Signed-off-by: Alex Williamson <alex at shazbot.org>
---
drivers/vfio/vfio_main.c | 2 ++
include/linux/vfio.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index 981e663571d6..b0bf6ee4def3 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -171,11 +171,13 @@ void vfio_device_put_registration(struct vfio_device *device)
if (refcount_dec_and_test(&device->refcount))
complete(&device->comp);
}
+EXPORT_SYMBOL_GPL(vfio_device_put_registration);
bool vfio_device_try_get_registration(struct vfio_device *device)
{
return refcount_inc_not_zero(&device->refcount);
}
+EXPORT_SYMBOL_GPL(vfio_device_try_get_registration);
/*
* VFIO driver API
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index b6ab948a3904..7e1fe5503af4 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -284,6 +284,8 @@ static inline void vfio_device_get(struct vfio_device *device)
int vfio_register_group_dev(struct vfio_device *device);
int vfio_register_emulated_iommu_dev(struct vfio_device *device);
void vfio_unregister_group_dev(struct vfio_device *device);
+bool vfio_device_try_get_registration(struct vfio_device *device);
+void vfio_device_put_registration(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);
--
2.38.1
More information about the kernel-team
mailing list