Lines Matching full:private
21 static int vfio_ccw_mdev_reset(struct vfio_ccw_private *private) in vfio_ccw_mdev_reset() argument
27 vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_CLOSE); in vfio_ccw_mdev_reset()
28 vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_OPEN); in vfio_ccw_mdev_reset()
29 if (private->state == VFIO_CCW_STATE_NOT_OPER) in vfio_ccw_mdev_reset()
37 struct vfio_ccw_private *private = in vfio_ccw_dma_unmap() local
41 if (!cp_iova_pinned(&private->cp, iova, length)) in vfio_ccw_dma_unmap()
44 vfio_ccw_mdev_reset(private); in vfio_ccw_dma_unmap()
49 struct vfio_ccw_private *private = in vfio_ccw_mdev_init_dev() local
52 init_completion(&private->release_comp); in vfio_ccw_mdev_init_dev()
58 struct vfio_ccw_private *private = dev_get_drvdata(mdev->dev.parent); in vfio_ccw_mdev_probe() local
61 if (private->state == VFIO_CCW_STATE_NOT_OPER) in vfio_ccw_mdev_probe()
64 ret = vfio_init_device(&private->vdev, &mdev->dev, &vfio_ccw_dev_ops); in vfio_ccw_mdev_probe()
69 private->sch->schid.cssid, in vfio_ccw_mdev_probe()
70 private->sch->schid.ssid, in vfio_ccw_mdev_probe()
71 private->sch->schid.sch_no); in vfio_ccw_mdev_probe()
73 ret = vfio_register_emulated_iommu_dev(&private->vdev); in vfio_ccw_mdev_probe()
76 dev_set_drvdata(&mdev->dev, private); in vfio_ccw_mdev_probe()
80 vfio_put_device(&private->vdev); in vfio_ccw_mdev_probe()
86 struct vfio_ccw_private *private = in vfio_ccw_mdev_release_dev() local
98 complete(&private->release_comp); in vfio_ccw_mdev_release_dev()
103 struct vfio_ccw_private *private = dev_get_drvdata(mdev->dev.parent); in vfio_ccw_mdev_remove() local
106 private->sch->schid.cssid, in vfio_ccw_mdev_remove()
107 private->sch->schid.ssid, in vfio_ccw_mdev_remove()
108 private->sch->schid.sch_no); in vfio_ccw_mdev_remove()
110 vfio_unregister_group_dev(&private->vdev); in vfio_ccw_mdev_remove()
112 vfio_put_device(&private->vdev); in vfio_ccw_mdev_remove()
118 * private structure so each can be managed in its own life in vfio_ccw_mdev_remove()
121 wait_for_completion(&private->release_comp); in vfio_ccw_mdev_remove()
126 struct vfio_ccw_private *private = in vfio_ccw_mdev_open_device() local
131 if (private->state == VFIO_CCW_STATE_NOT_OPER) in vfio_ccw_mdev_open_device()
134 ret = vfio_ccw_register_async_dev_regions(private); in vfio_ccw_mdev_open_device()
138 ret = vfio_ccw_register_schib_dev_regions(private); in vfio_ccw_mdev_open_device()
142 ret = vfio_ccw_register_crw_dev_regions(private); in vfio_ccw_mdev_open_device()
146 vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_OPEN); in vfio_ccw_mdev_open_device()
147 if (private->state == VFIO_CCW_STATE_NOT_OPER) { in vfio_ccw_mdev_open_device()
155 vfio_ccw_unregister_dev_regions(private); in vfio_ccw_mdev_open_device()
161 struct vfio_ccw_private *private = in vfio_ccw_mdev_close_device() local
164 vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_CLOSE); in vfio_ccw_mdev_close_device()
165 vfio_ccw_unregister_dev_regions(private); in vfio_ccw_mdev_close_device()
168 static ssize_t vfio_ccw_mdev_read_io_region(struct vfio_ccw_private *private, in vfio_ccw_mdev_read_io_region() argument
179 mutex_lock(&private->io_mutex); in vfio_ccw_mdev_read_io_region()
180 region = private->io_region; in vfio_ccw_mdev_read_io_region()
185 mutex_unlock(&private->io_mutex); in vfio_ccw_mdev_read_io_region()
194 struct vfio_ccw_private *private = in vfio_ccw_mdev_read() local
198 if (index >= VFIO_CCW_NUM_REGIONS + private->num_regions) in vfio_ccw_mdev_read()
203 return vfio_ccw_mdev_read_io_region(private, buf, count, ppos); in vfio_ccw_mdev_read()
206 return private->region[index].ops->read(private, buf, count, in vfio_ccw_mdev_read()
213 static ssize_t vfio_ccw_mdev_write_io_region(struct vfio_ccw_private *private, in vfio_ccw_mdev_write_io_region() argument
224 if (!mutex_trylock(&private->io_mutex)) in vfio_ccw_mdev_write_io_region()
227 region = private->io_region; in vfio_ccw_mdev_write_io_region()
233 vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_IO_REQ); in vfio_ccw_mdev_write_io_region()
237 mutex_unlock(&private->io_mutex); in vfio_ccw_mdev_write_io_region()
246 struct vfio_ccw_private *private = in vfio_ccw_mdev_write() local
250 if (index >= VFIO_CCW_NUM_REGIONS + private->num_regions) in vfio_ccw_mdev_write()
255 return vfio_ccw_mdev_write_io_region(private, buf, count, ppos); in vfio_ccw_mdev_write()
258 return private->region[index].ops->write(private, buf, count, in vfio_ccw_mdev_write()
265 static int vfio_ccw_mdev_get_device_info(struct vfio_ccw_private *private, in vfio_ccw_mdev_get_device_info() argument
269 info->num_regions = VFIO_CCW_NUM_REGIONS + private->num_regions; in vfio_ccw_mdev_get_device_info()
275 static int vfio_ccw_mdev_get_region_info(struct vfio_ccw_private *private, in vfio_ccw_mdev_get_region_info() argument
297 VFIO_CCW_NUM_REGIONS + private->num_regions) in vfio_ccw_mdev_get_region_info()
302 private->num_regions); in vfio_ccw_mdev_get_region_info()
307 info->size = private->region[i].size; in vfio_ccw_mdev_get_region_info()
308 info->flags = private->region[i].flags; in vfio_ccw_mdev_get_region_info()
310 cap_type.type = private->region[i].type; in vfio_ccw_mdev_get_region_info()
311 cap_type.subtype = private->region[i].subtype; in vfio_ccw_mdev_get_region_info()
355 static int vfio_ccw_mdev_set_irqs(struct vfio_ccw_private *private, in vfio_ccw_mdev_set_irqs() argument
367 ctx = &private->io_trigger; in vfio_ccw_mdev_set_irqs()
370 ctx = &private->crw_trigger; in vfio_ccw_mdev_set_irqs()
373 ctx = &private->req_trigger; in vfio_ccw_mdev_set_irqs()
429 int vfio_ccw_register_dev_region(struct vfio_ccw_private *private, in vfio_ccw_register_dev_region() argument
436 region = krealloc(private->region, in vfio_ccw_register_dev_region()
437 (private->num_regions + 1) * sizeof(*region), in vfio_ccw_register_dev_region()
442 private->region = region; in vfio_ccw_register_dev_region()
443 private->region[private->num_regions].type = VFIO_REGION_TYPE_CCW; in vfio_ccw_register_dev_region()
444 private->region[private->num_regions].subtype = subtype; in vfio_ccw_register_dev_region()
445 private->region[private->num_regions].ops = ops; in vfio_ccw_register_dev_region()
446 private->region[private->num_regions].size = size; in vfio_ccw_register_dev_region()
447 private->region[private->num_regions].flags = flags; in vfio_ccw_register_dev_region()
448 private->region[private->num_regions].data = data; in vfio_ccw_register_dev_region()
450 private->num_regions++; in vfio_ccw_register_dev_region()
455 void vfio_ccw_unregister_dev_regions(struct vfio_ccw_private *private) in vfio_ccw_unregister_dev_regions() argument
459 for (i = 0; i < private->num_regions; i++) in vfio_ccw_unregister_dev_regions()
460 private->region[i].ops->release(private, &private->region[i]); in vfio_ccw_unregister_dev_regions()
461 private->num_regions = 0; in vfio_ccw_unregister_dev_regions()
462 kfree(private->region); in vfio_ccw_unregister_dev_regions()
463 private->region = NULL; in vfio_ccw_unregister_dev_regions()
470 struct vfio_ccw_private *private = in vfio_ccw_mdev_ioctl() local
488 ret = vfio_ccw_mdev_get_device_info(private, &info); in vfio_ccw_mdev_ioctl()
506 ret = vfio_ccw_mdev_get_region_info(private, &info, arg); in vfio_ccw_mdev_ioctl()
551 return vfio_ccw_mdev_set_irqs(private, hdr.flags, hdr.index, in vfio_ccw_mdev_ioctl()
555 return vfio_ccw_mdev_reset(private); in vfio_ccw_mdev_ioctl()
564 struct vfio_ccw_private *private = in vfio_ccw_mdev_request() local
568 if (private->req_trigger) { in vfio_ccw_mdev_request()
574 eventfd_signal(private->req_trigger, 1); in vfio_ccw_mdev_request()