Lines Matching refs:df

447 	struct vfio_device_file *df;  in vfio_allocate_device_file()  local
449 df = kzalloc(sizeof(*df), GFP_KERNEL_ACCOUNT); in vfio_allocate_device_file()
450 if (!df) in vfio_allocate_device_file()
453 df->device = device; in vfio_allocate_device_file()
454 spin_lock_init(&df->kvm_ref_lock); in vfio_allocate_device_file()
456 return df; in vfio_allocate_device_file()
459 static int vfio_df_device_first_open(struct vfio_device_file *df) in vfio_df_device_first_open() argument
461 struct vfio_device *device = df->device; in vfio_df_device_first_open()
462 struct iommufd_ctx *iommufd = df->iommufd; in vfio_df_device_first_open()
471 ret = vfio_df_iommufd_bind(df); in vfio_df_device_first_open()
486 vfio_df_iommufd_unbind(df); in vfio_df_device_first_open()
494 static void vfio_df_device_last_close(struct vfio_device_file *df) in vfio_df_device_last_close() argument
496 struct vfio_device *device = df->device; in vfio_df_device_last_close()
497 struct iommufd_ctx *iommufd = df->iommufd; in vfio_df_device_last_close()
504 vfio_df_iommufd_unbind(df); in vfio_df_device_last_close()
510 int vfio_df_open(struct vfio_device_file *df) in vfio_df_open() argument
512 struct vfio_device *device = df->device; in vfio_df_open()
521 if (device->open_count != 0 && !df->group) in vfio_df_open()
526 ret = vfio_df_device_first_open(df); in vfio_df_open()
534 void vfio_df_close(struct vfio_device_file *df) in vfio_df_close() argument
536 struct vfio_device *device = df->device; in vfio_df_close()
542 vfio_df_device_last_close(df); in vfio_df_close()
584 struct vfio_device_file *df = filep->private_data; in vfio_device_fops_release() local
585 struct vfio_device *device = df->device; in vfio_device_fops_release()
587 if (df->group) in vfio_device_fops_release()
588 vfio_df_group_close(df); in vfio_device_fops_release()
590 vfio_df_unbind_iommufd(df); in vfio_device_fops_release()
594 kfree(df); in vfio_device_fops_release()
1207 struct vfio_device_file *df = filep->private_data; in vfio_device_fops_unl_ioctl() local
1208 struct vfio_device *device = df->device; in vfio_device_fops_unl_ioctl()
1213 return vfio_df_ioctl_bind_iommufd(df, uptr); in vfio_device_fops_unl_ioctl()
1216 if (!smp_load_acquire(&df->access_granted)) in vfio_device_fops_unl_ioctl()
1224 if (IS_ENABLED(CONFIG_VFIO_DEVICE_CDEV) && !df->group) { in vfio_device_fops_unl_ioctl()
1227 ret = vfio_df_ioctl_attach_pt(df, uptr); in vfio_device_fops_unl_ioctl()
1231 ret = vfio_df_ioctl_detach_pt(df, uptr); in vfio_device_fops_unl_ioctl()
1256 struct vfio_device_file *df = filep->private_data; in vfio_device_fops_read() local
1257 struct vfio_device *device = df->device; in vfio_device_fops_read()
1260 if (!smp_load_acquire(&df->access_granted)) in vfio_device_fops_read()
1273 struct vfio_device_file *df = filep->private_data; in vfio_device_fops_write() local
1274 struct vfio_device *device = df->device; in vfio_device_fops_write()
1277 if (!smp_load_acquire(&df->access_granted)) in vfio_device_fops_write()
1288 struct vfio_device_file *df = filep->private_data; in vfio_device_fops_mmap() local
1289 struct vfio_device *device = df->device; in vfio_device_fops_mmap()
1292 if (!smp_load_acquire(&df->access_granted)) in vfio_device_fops_mmap()
1314 struct vfio_device_file *df = file->private_data; in vfio_device_from_file() local
1318 return df->device; in vfio_device_from_file()
1361 struct vfio_device_file *df = file->private_data; in vfio_device_file_set_kvm() local
1368 spin_lock(&df->kvm_ref_lock); in vfio_device_file_set_kvm()
1369 df->kvm = kvm; in vfio_device_file_set_kvm()
1370 spin_unlock(&df->kvm_ref_lock); in vfio_device_file_set_kvm()