Lines Matching full:private
22 struct vfio_ccw_private *private; in vfio_ccw_mdev_reset() local
26 private = dev_get_drvdata(mdev_parent_dev(mdev)); in vfio_ccw_mdev_reset()
27 sch = private->sch; in vfio_ccw_mdev_reset()
42 private->state = VFIO_CCW_STATE_IDLE; in vfio_ccw_mdev_reset()
51 struct vfio_ccw_private *private = in vfio_ccw_mdev_notifier() local
61 if (!cp_iova_pinned(&private->cp, unmap->iova)) in vfio_ccw_mdev_notifier()
64 if (vfio_ccw_mdev_reset(private->mdev)) in vfio_ccw_mdev_notifier()
67 cp_free(&private->cp); in vfio_ccw_mdev_notifier()
90 struct vfio_ccw_private *private = dev_get_drvdata(dev); in available_instances_show() local
92 return sprintf(buf, "%d\n", atomic_read(&private->avail)); in available_instances_show()
115 struct vfio_ccw_private *private = in vfio_ccw_mdev_create() local
118 if (private->state == VFIO_CCW_STATE_NOT_OPER) in vfio_ccw_mdev_create()
121 if (atomic_dec_if_positive(&private->avail) < 0) in vfio_ccw_mdev_create()
124 private->mdev = mdev; in vfio_ccw_mdev_create()
125 private->state = VFIO_CCW_STATE_IDLE; in vfio_ccw_mdev_create()
128 mdev_uuid(mdev), private->sch->schid.cssid, in vfio_ccw_mdev_create()
129 private->sch->schid.ssid, in vfio_ccw_mdev_create()
130 private->sch->schid.sch_no); in vfio_ccw_mdev_create()
137 struct vfio_ccw_private *private = in vfio_ccw_mdev_remove() local
141 mdev_uuid(mdev), private->sch->schid.cssid, in vfio_ccw_mdev_remove()
142 private->sch->schid.ssid, in vfio_ccw_mdev_remove()
143 private->sch->schid.sch_no); in vfio_ccw_mdev_remove()
145 if ((private->state != VFIO_CCW_STATE_NOT_OPER) && in vfio_ccw_mdev_remove()
146 (private->state != VFIO_CCW_STATE_STANDBY)) { in vfio_ccw_mdev_remove()
147 if (!vfio_ccw_sch_quiesce(private->sch)) in vfio_ccw_mdev_remove()
148 private->state = VFIO_CCW_STATE_STANDBY; in vfio_ccw_mdev_remove()
152 cp_free(&private->cp); in vfio_ccw_mdev_remove()
153 private->mdev = NULL; in vfio_ccw_mdev_remove()
154 atomic_inc(&private->avail); in vfio_ccw_mdev_remove()
161 struct vfio_ccw_private *private = in vfio_ccw_mdev_open() local
166 private->nb.notifier_call = vfio_ccw_mdev_notifier; in vfio_ccw_mdev_open()
169 &events, &private->nb); in vfio_ccw_mdev_open()
173 ret = vfio_ccw_register_async_dev_regions(private); in vfio_ccw_mdev_open()
177 ret = vfio_ccw_register_schib_dev_regions(private); in vfio_ccw_mdev_open()
181 ret = vfio_ccw_register_crw_dev_regions(private); in vfio_ccw_mdev_open()
188 vfio_ccw_unregister_dev_regions(private); in vfio_ccw_mdev_open()
190 &private->nb); in vfio_ccw_mdev_open()
196 struct vfio_ccw_private *private = in vfio_ccw_mdev_release() local
199 if ((private->state != VFIO_CCW_STATE_NOT_OPER) && in vfio_ccw_mdev_release()
200 (private->state != VFIO_CCW_STATE_STANDBY)) { in vfio_ccw_mdev_release()
202 private->state = VFIO_CCW_STATE_STANDBY; in vfio_ccw_mdev_release()
206 cp_free(&private->cp); in vfio_ccw_mdev_release()
207 vfio_ccw_unregister_dev_regions(private); in vfio_ccw_mdev_release()
209 &private->nb); in vfio_ccw_mdev_release()
212 static ssize_t vfio_ccw_mdev_read_io_region(struct vfio_ccw_private *private, in vfio_ccw_mdev_read_io_region() argument
223 mutex_lock(&private->io_mutex); in vfio_ccw_mdev_read_io_region()
224 region = private->io_region; in vfio_ccw_mdev_read_io_region()
229 mutex_unlock(&private->io_mutex); in vfio_ccw_mdev_read_io_region()
239 struct vfio_ccw_private *private; in vfio_ccw_mdev_read() local
241 private = dev_get_drvdata(mdev_parent_dev(mdev)); in vfio_ccw_mdev_read()
243 if (index >= VFIO_CCW_NUM_REGIONS + private->num_regions) in vfio_ccw_mdev_read()
248 return vfio_ccw_mdev_read_io_region(private, buf, count, ppos); in vfio_ccw_mdev_read()
251 return private->region[index].ops->read(private, buf, count, in vfio_ccw_mdev_read()
258 static ssize_t vfio_ccw_mdev_write_io_region(struct vfio_ccw_private *private, in vfio_ccw_mdev_write_io_region() argument
269 if (!mutex_trylock(&private->io_mutex)) in vfio_ccw_mdev_write_io_region()
272 region = private->io_region; in vfio_ccw_mdev_write_io_region()
278 vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_IO_REQ); in vfio_ccw_mdev_write_io_region()
280 private->state = VFIO_CCW_STATE_IDLE; in vfio_ccw_mdev_write_io_region()
284 mutex_unlock(&private->io_mutex); in vfio_ccw_mdev_write_io_region()
294 struct vfio_ccw_private *private; in vfio_ccw_mdev_write() local
296 private = dev_get_drvdata(mdev_parent_dev(mdev)); in vfio_ccw_mdev_write()
298 if (index >= VFIO_CCW_NUM_REGIONS + private->num_regions) in vfio_ccw_mdev_write()
303 return vfio_ccw_mdev_write_io_region(private, buf, count, ppos); in vfio_ccw_mdev_write()
306 return private->region[index].ops->write(private, buf, count, in vfio_ccw_mdev_write()
316 struct vfio_ccw_private *private; in vfio_ccw_mdev_get_device_info() local
318 private = dev_get_drvdata(mdev_parent_dev(mdev)); in vfio_ccw_mdev_get_device_info()
320 info->num_regions = VFIO_CCW_NUM_REGIONS + private->num_regions; in vfio_ccw_mdev_get_device_info()
330 struct vfio_ccw_private *private; in vfio_ccw_mdev_get_region_info() local
333 private = dev_get_drvdata(mdev_parent_dev(mdev)); in vfio_ccw_mdev_get_region_info()
350 VFIO_CCW_NUM_REGIONS + private->num_regions) in vfio_ccw_mdev_get_region_info()
355 private->num_regions); in vfio_ccw_mdev_get_region_info()
360 info->size = private->region[i].size; in vfio_ccw_mdev_get_region_info()
361 info->flags = private->region[i].flags; in vfio_ccw_mdev_get_region_info()
363 cap_type.type = private->region[i].type; in vfio_ccw_mdev_get_region_info()
364 cap_type.subtype = private->region[i].subtype; in vfio_ccw_mdev_get_region_info()
412 struct vfio_ccw_private *private; in vfio_ccw_mdev_set_irqs() local
418 private = dev_get_drvdata(mdev_parent_dev(mdev)); in vfio_ccw_mdev_set_irqs()
422 ctx = &private->io_trigger; in vfio_ccw_mdev_set_irqs()
425 ctx = &private->crw_trigger; in vfio_ccw_mdev_set_irqs()
481 int vfio_ccw_register_dev_region(struct vfio_ccw_private *private, in vfio_ccw_register_dev_region() argument
488 region = krealloc(private->region, in vfio_ccw_register_dev_region()
489 (private->num_regions + 1) * sizeof(*region), in vfio_ccw_register_dev_region()
494 private->region = region; in vfio_ccw_register_dev_region()
495 private->region[private->num_regions].type = VFIO_REGION_TYPE_CCW; in vfio_ccw_register_dev_region()
496 private->region[private->num_regions].subtype = subtype; in vfio_ccw_register_dev_region()
497 private->region[private->num_regions].ops = ops; in vfio_ccw_register_dev_region()
498 private->region[private->num_regions].size = size; in vfio_ccw_register_dev_region()
499 private->region[private->num_regions].flags = flags; in vfio_ccw_register_dev_region()
500 private->region[private->num_regions].data = data; in vfio_ccw_register_dev_region()
502 private->num_regions++; in vfio_ccw_register_dev_region()
507 void vfio_ccw_unregister_dev_regions(struct vfio_ccw_private *private) in vfio_ccw_unregister_dev_regions() argument
511 for (i = 0; i < private->num_regions; i++) in vfio_ccw_unregister_dev_regions()
512 private->region[i].ops->release(private, &private->region[i]); in vfio_ccw_unregister_dev_regions()
513 private->num_regions = 0; in vfio_ccw_unregister_dev_regions()
514 kfree(private->region); in vfio_ccw_unregister_dev_regions()
515 private->region = NULL; in vfio_ccw_unregister_dev_regions()