Lines Matching refs:vfio
40 static struct vfio { struct
50 } vfio; argument
233 mutex_lock(&vfio.iommu_drivers_lock); in vfio_register_iommu_driver()
236 list_for_each_entry(tmp, &vfio.iommu_drivers_list, vfio_next) { in vfio_register_iommu_driver()
238 mutex_unlock(&vfio.iommu_drivers_lock); in vfio_register_iommu_driver()
244 list_add(&driver->vfio_next, &vfio.iommu_drivers_list); in vfio_register_iommu_driver()
246 mutex_unlock(&vfio.iommu_drivers_lock); in vfio_register_iommu_driver()
256 mutex_lock(&vfio.iommu_drivers_lock); in vfio_unregister_iommu_driver()
257 list_for_each_entry(driver, &vfio.iommu_drivers_list, vfio_next) { in vfio_unregister_iommu_driver()
260 mutex_unlock(&vfio.iommu_drivers_lock); in vfio_unregister_iommu_driver()
265 mutex_unlock(&vfio.iommu_drivers_lock); in vfio_unregister_iommu_driver()
274 return idr_alloc(&vfio.group_idr, group, 0, MINORMASK + 1, GFP_KERNEL); in vfio_alloc_group_minor()
279 idr_remove(&vfio.group_idr, minor); in vfio_free_group_minor()
312 mutex_unlock(&vfio.group_lock); in vfio_group_unlock_and_free()
363 mutex_lock(&vfio.group_lock); in vfio_create_group()
366 list_for_each_entry(tmp, &vfio.group_list, vfio_next) { in vfio_create_group()
380 dev = device_create(vfio.class, NULL, in vfio_create_group()
381 MKDEV(MAJOR(vfio.group_devt), minor), in vfio_create_group()
393 list_add(&group->vfio_next, &vfio.group_list); in vfio_create_group()
395 mutex_unlock(&vfio.group_lock); in vfio_create_group()
416 device_destroy(vfio.class, MKDEV(MAJOR(vfio.group_devt), group->minor)); in vfio_group_release()
425 kref_put_mutex(&group->kref, vfio_group_release, &vfio.group_lock); in vfio_group_put()
470 mutex_lock(&vfio.group_lock); in vfio_group_try_get()
471 list_for_each_entry(group, &vfio.group_list, vfio_next) { in vfio_group_try_get()
474 mutex_unlock(&vfio.group_lock); in vfio_group_try_get()
478 mutex_unlock(&vfio.group_lock); in vfio_group_try_get()
488 mutex_lock(&vfio.group_lock); in vfio_group_get_from_iommu()
489 list_for_each_entry(group, &vfio.group_list, vfio_next) { in vfio_group_get_from_iommu()
492 mutex_unlock(&vfio.group_lock); in vfio_group_get_from_iommu()
496 mutex_unlock(&vfio.group_lock); in vfio_group_get_from_iommu()
505 mutex_lock(&vfio.group_lock); in vfio_group_get_from_minor()
506 group = idr_find(&vfio.group_idr, minor); in vfio_group_get_from_minor()
508 mutex_unlock(&vfio.group_lock); in vfio_group_get_from_minor()
512 mutex_unlock(&vfio.group_lock); in vfio_group_get_from_minor()
580 wake_up(&vfio.release_q); in vfio_device_release()
965 add_wait_queue(&vfio.release_q, &wait); in vfio_del_group_dev()
993 remove_wait_queue(&vfio.release_q, &wait); in vfio_del_group_dev()
1040 mutex_lock(&vfio.iommu_drivers_lock); in vfio_ioctl_check_extension()
1041 list_for_each_entry(driver, &vfio.iommu_drivers_list, in vfio_ioctl_check_extension()
1061 mutex_unlock(&vfio.iommu_drivers_lock); in vfio_ioctl_check_extension()
1118 mutex_lock(&vfio.iommu_drivers_lock); in vfio_ioctl_set_iommu()
1119 list_for_each_entry(driver, &vfio.iommu_drivers_list, vfio_next) { in vfio_ioctl_set_iommu()
1165 mutex_unlock(&vfio.iommu_drivers_lock); in vfio_ioctl_set_iommu()
2354 idr_init(&vfio.group_idr); in vfio_init()
2355 mutex_init(&vfio.group_lock); in vfio_init()
2356 mutex_init(&vfio.iommu_drivers_lock); in vfio_init()
2357 INIT_LIST_HEAD(&vfio.group_list); in vfio_init()
2358 INIT_LIST_HEAD(&vfio.iommu_drivers_list); in vfio_init()
2359 init_waitqueue_head(&vfio.release_q); in vfio_init()
2368 vfio.class = class_create(THIS_MODULE, "vfio"); in vfio_init()
2369 if (IS_ERR(vfio.class)) { in vfio_init()
2370 ret = PTR_ERR(vfio.class); in vfio_init()
2374 vfio.class->devnode = vfio_devnode; in vfio_init()
2376 ret = alloc_chrdev_region(&vfio.group_devt, 0, MINORMASK + 1, "vfio"); in vfio_init()
2380 cdev_init(&vfio.group_cdev, &vfio_group_fops); in vfio_init()
2381 ret = cdev_add(&vfio.group_cdev, vfio.group_devt, MINORMASK + 1); in vfio_init()
2393 unregister_chrdev_region(vfio.group_devt, MINORMASK + 1); in vfio_init()
2395 class_destroy(vfio.class); in vfio_init()
2396 vfio.class = NULL; in vfio_init()
2404 WARN_ON(!list_empty(&vfio.group_list)); in vfio_cleanup()
2409 idr_destroy(&vfio.group_idr); in vfio_cleanup()
2410 cdev_del(&vfio.group_cdev); in vfio_cleanup()
2411 unregister_chrdev_region(vfio.group_devt, MINORMASK + 1); in vfio_cleanup()
2412 class_destroy(vfio.class); in vfio_cleanup()
2413 vfio.class = NULL; in vfio_cleanup()