Lines Matching refs: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()
176 &private->nb); in vfio_ccw_mdev_open()
182 struct vfio_ccw_private *private = in vfio_ccw_mdev_release() local
186 if ((private->state != VFIO_CCW_STATE_NOT_OPER) && in vfio_ccw_mdev_release()
187 (private->state != VFIO_CCW_STATE_STANDBY)) { in vfio_ccw_mdev_release()
189 private->state = VFIO_CCW_STATE_STANDBY; in vfio_ccw_mdev_release()
193 cp_free(&private->cp); in vfio_ccw_mdev_release()
195 &private->nb); in vfio_ccw_mdev_release()
197 for (i = 0; i < private->num_regions; i++) in vfio_ccw_mdev_release()
198 private->region[i].ops->release(private, &private->region[i]); in vfio_ccw_mdev_release()
200 private->num_regions = 0; in vfio_ccw_mdev_release()
201 kfree(private->region); in vfio_ccw_mdev_release()
202 private->region = NULL; in vfio_ccw_mdev_release()
205 static ssize_t vfio_ccw_mdev_read_io_region(struct vfio_ccw_private *private, in vfio_ccw_mdev_read_io_region() argument
216 mutex_lock(&private->io_mutex); in vfio_ccw_mdev_read_io_region()
217 region = private->io_region; in vfio_ccw_mdev_read_io_region()
222 mutex_unlock(&private->io_mutex); in vfio_ccw_mdev_read_io_region()
232 struct vfio_ccw_private *private; in vfio_ccw_mdev_read() local
234 private = dev_get_drvdata(mdev_parent_dev(mdev)); in vfio_ccw_mdev_read()
236 if (index >= VFIO_CCW_NUM_REGIONS + private->num_regions) in vfio_ccw_mdev_read()
241 return vfio_ccw_mdev_read_io_region(private, buf, count, ppos); in vfio_ccw_mdev_read()
244 return private->region[index].ops->read(private, buf, count, in vfio_ccw_mdev_read()
251 static ssize_t vfio_ccw_mdev_write_io_region(struct vfio_ccw_private *private, in vfio_ccw_mdev_write_io_region() argument
262 if (!mutex_trylock(&private->io_mutex)) in vfio_ccw_mdev_write_io_region()
265 region = private->io_region; in vfio_ccw_mdev_write_io_region()
271 vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_IO_REQ); in vfio_ccw_mdev_write_io_region()
273 private->state = VFIO_CCW_STATE_IDLE; in vfio_ccw_mdev_write_io_region()
277 mutex_unlock(&private->io_mutex); in vfio_ccw_mdev_write_io_region()
287 struct vfio_ccw_private *private; in vfio_ccw_mdev_write() local
289 private = dev_get_drvdata(mdev_parent_dev(mdev)); in vfio_ccw_mdev_write()
291 if (index >= VFIO_CCW_NUM_REGIONS + private->num_regions) in vfio_ccw_mdev_write()
296 return vfio_ccw_mdev_write_io_region(private, buf, count, ppos); in vfio_ccw_mdev_write()
299 return private->region[index].ops->write(private, buf, count, in vfio_ccw_mdev_write()
309 struct vfio_ccw_private *private; in vfio_ccw_mdev_get_device_info() local
311 private = dev_get_drvdata(mdev_parent_dev(mdev)); in vfio_ccw_mdev_get_device_info()
313 info->num_regions = VFIO_CCW_NUM_REGIONS + private->num_regions; in vfio_ccw_mdev_get_device_info()
323 struct vfio_ccw_private *private; in vfio_ccw_mdev_get_region_info() local
326 private = dev_get_drvdata(mdev_parent_dev(mdev)); in vfio_ccw_mdev_get_region_info()
343 VFIO_CCW_NUM_REGIONS + private->num_regions) in vfio_ccw_mdev_get_region_info()
348 private->num_regions); in vfio_ccw_mdev_get_region_info()
353 info->size = private->region[i].size; in vfio_ccw_mdev_get_region_info()
354 info->flags = private->region[i].flags; in vfio_ccw_mdev_get_region_info()
356 cap_type.type = private->region[i].type; in vfio_ccw_mdev_get_region_info()
357 cap_type.subtype = private->region[i].subtype; in vfio_ccw_mdev_get_region_info()
400 struct vfio_ccw_private *private; in vfio_ccw_mdev_set_irqs() local
406 private = dev_get_drvdata(mdev_parent_dev(mdev)); in vfio_ccw_mdev_set_irqs()
407 ctx = &private->io_trigger; in vfio_ccw_mdev_set_irqs()
459 int vfio_ccw_register_dev_region(struct vfio_ccw_private *private, in vfio_ccw_register_dev_region() argument
466 region = krealloc(private->region, in vfio_ccw_register_dev_region()
467 (private->num_regions + 1) * sizeof(*region), in vfio_ccw_register_dev_region()
472 private->region = region; in vfio_ccw_register_dev_region()
473 private->region[private->num_regions].type = VFIO_REGION_TYPE_CCW; in vfio_ccw_register_dev_region()
474 private->region[private->num_regions].subtype = subtype; in vfio_ccw_register_dev_region()
475 private->region[private->num_regions].ops = ops; in vfio_ccw_register_dev_region()
476 private->region[private->num_regions].size = size; in vfio_ccw_register_dev_region()
477 private->region[private->num_regions].flags = flags; in vfio_ccw_register_dev_region()
478 private->region[private->num_regions].data = data; in vfio_ccw_register_dev_region()
480 private->num_regions++; in vfio_ccw_register_dev_region()