Lines Matching full:device

12 void vfio_init_device_cdev(struct vfio_device *device)  in vfio_init_device_cdev()  argument
14 device->device.devt = MKDEV(MAJOR(device_devt), device->index); in vfio_init_device_cdev()
15 cdev_init(&device->cdev, &vfio_device_fops); in vfio_init_device_cdev()
16 device->cdev.owner = THIS_MODULE; in vfio_init_device_cdev()
20 * device access via the fd opened by this function is blocked until
25 struct vfio_device *device = container_of(inode->i_cdev, in vfio_device_fops_cdev_open() local
31 if (!vfio_device_try_get_registration(device)) in vfio_device_fops_cdev_open()
34 df = vfio_allocate_device_file(device); in vfio_device_fops_cdev_open()
43 * Use the pseudo fs inode on the device to link all mmaps in vfio_device_fops_cdev_open()
45 * associated to this device using unmap_mapping_range(). in vfio_device_fops_cdev_open()
47 filep->f_mapping = device->inode->i_mapping; in vfio_device_fops_cdev_open()
52 vfio_device_put_registration(device); in vfio_device_fops_cdev_open()
59 vfio_device_get_kvm_safe(df->device, df->kvm); in vfio_df_get_kvm_safe()
66 struct vfio_device *device = df->device; in vfio_df_ioctl_bind_iommufd() local
85 ret = vfio_device_block_group(device); in vfio_df_ioctl_bind_iommufd()
89 mutex_lock(&device->dev_set->lock); in vfio_df_ioctl_bind_iommufd()
90 /* one device cannot be bound twice */ in vfio_df_ioctl_bind_iommufd()
104 * Before the device open, get the KVM pointer currently in vfio_df_ioctl_bind_iommufd()
105 * associated with the device file (if there is) and obtain in vfio_df_ioctl_bind_iommufd()
106 * a reference. This reference is held until device closed. in vfio_df_ioctl_bind_iommufd()
107 * Save the pointer in the device for use by drivers. in vfio_df_ioctl_bind_iommufd()
120 device->cdev_opened = true; in vfio_df_ioctl_bind_iommufd()
126 mutex_unlock(&device->dev_set->lock); in vfio_df_ioctl_bind_iommufd()
132 vfio_device_put_kvm(device); in vfio_df_ioctl_bind_iommufd()
136 mutex_unlock(&device->dev_set->lock); in vfio_df_ioctl_bind_iommufd()
137 vfio_device_unblock_group(device); in vfio_df_ioctl_bind_iommufd()
143 struct vfio_device *device = df->device; in vfio_df_unbind_iommufd() local
153 mutex_lock(&device->dev_set->lock); in vfio_df_unbind_iommufd()
155 vfio_device_put_kvm(device); in vfio_df_unbind_iommufd()
157 device->cdev_opened = false; in vfio_df_unbind_iommufd()
158 mutex_unlock(&device->dev_set->lock); in vfio_df_unbind_iommufd()
159 vfio_device_unblock_group(device); in vfio_df_unbind_iommufd()
165 struct vfio_device *device = df->device; in vfio_df_ioctl_attach_pt() local
178 mutex_lock(&device->dev_set->lock); in vfio_df_ioctl_attach_pt()
179 ret = device->ops->attach_ioas(device, &attach.pt_id); in vfio_df_ioctl_attach_pt()
187 mutex_unlock(&device->dev_set->lock); in vfio_df_ioctl_attach_pt()
192 device->ops->detach_ioas(device); in vfio_df_ioctl_attach_pt()
194 mutex_unlock(&device->dev_set->lock); in vfio_df_ioctl_attach_pt()
201 struct vfio_device *device = df->device; in vfio_df_ioctl_detach_pt() local
213 mutex_lock(&device->dev_set->lock); in vfio_df_ioctl_detach_pt()
214 device->ops->detach_ioas(device); in vfio_df_ioctl_detach_pt()
215 mutex_unlock(&device->dev_set->lock); in vfio_df_ioctl_detach_pt()
220 static char *vfio_device_devnode(const struct device *dev, umode_t *mode) in vfio_device_devnode()