Lines Matching refs:vdev

59 	struct virtio_device vdev;  member
73 #define to_vopvdev(vd) container_of(vd, struct _vop_vdev, vdev)
78 static inline struct device *_vop_dev(struct _vop_vdev *vdev) in _vop_dev() argument
80 return vdev->vdev.dev.parent; in _vop_dev()
116 static u64 vop_get_features(struct virtio_device *vdev) in vop_get_features() argument
120 struct mic_device_desc __iomem *desc = to_vopvdev(vdev)->desc; in vop_get_features()
124 bits = min_t(unsigned, feature_len, sizeof(vdev->features)) * 8; in vop_get_features()
132 static int vop_finalize_features(struct virtio_device *vdev) in vop_finalize_features() argument
135 struct mic_device_desc __iomem *desc = to_vopvdev(vdev)->desc; in vop_finalize_features()
142 vring_transport_features(vdev); in vop_finalize_features()
146 sizeof(vdev->features)) * 8; in vop_finalize_features()
148 if (__virtio_test_bit(vdev, i)) in vop_finalize_features()
158 static void vop_get(struct virtio_device *vdev, unsigned int offset, in vop_get() argument
161 struct mic_device_desc __iomem *desc = to_vopvdev(vdev)->desc; in vop_get()
168 static void vop_set(struct virtio_device *vdev, unsigned int offset, in vop_set() argument
171 struct mic_device_desc __iomem *desc = to_vopvdev(vdev)->desc; in vop_set()
183 static u8 vop_get_status(struct virtio_device *vdev) in vop_get_status() argument
185 return ioread8(&to_vopvdev(vdev)->desc->status); in vop_get_status()
190 struct _vop_vdev *vdev = to_vopvdev(dev); in vop_set_status() local
191 struct vop_device *vpdev = vdev->vpdev; in vop_set_status()
195 iowrite8(status, &vdev->desc->status); in vop_set_status()
196 vpdev->hw_ops->send_intr(vpdev, vdev->c2h_vdev_db); in vop_set_status()
202 struct _vop_vdev *vdev = to_vopvdev(dev); in vop_reset_inform_host() local
203 struct mic_device_ctrl __iomem *dc = vdev->dc; in vop_reset_inform_host()
204 struct vop_device *vpdev = vdev->vpdev; in vop_reset_inform_host()
209 vpdev->hw_ops->send_intr(vpdev, vdev->c2h_vdev_db); in vop_reset_inform_host()
218 dev_dbg(_vop_dev(vdev), "%s: retry: %d\n", __func__, retry); in vop_reset_inform_host()
221 iowrite8(0, &vdev->desc->status); in vop_reset_inform_host()
226 struct _vop_vdev *vdev = to_vopvdev(dev); in vop_reset() local
228 dev_dbg(_vop_dev(vdev), "%s: virtio id %d\n", in vop_reset()
232 complete_all(&vdev->reset_done); in vop_reset()
240 struct _vop_vdev *vdev = vq->priv; in vop_notify() local
241 struct vop_device *vpdev = vdev->vpdev; in vop_notify()
243 vpdev->hw_ops->send_intr(vpdev, vdev->c2h_vdev_db); in vop_notify()
249 struct _vop_vdev *vdev = to_vopvdev(vq->vdev); in vop_del_vq() local
251 struct vop_device *vpdev = vdev->vpdev; in vop_del_vq()
253 dma_unmap_single(&vpdev->dev, vdev->used[n], in vop_del_vq()
254 vdev->used_size[n], DMA_BIDIRECTIONAL); in vop_del_vq()
255 free_pages((unsigned long)vr->used, get_order(vdev->used_size[n])); in vop_del_vq()
257 vpdev->hw_ops->iounmap(vpdev, vdev->vr[n]); in vop_del_vq()
258 vdev->vr[n] = NULL; in vop_del_vq()
263 struct _vop_vdev *vdev = to_vopvdev(dev); in vop_del_vqs() local
267 dev_dbg(_vop_dev(vdev), "%s\n", __func__); in vop_del_vqs()
283 struct _vop_vdev *vdev = to_vopvdev(dev); in vop_find_vq() local
284 struct vop_device *vpdev = vdev->vpdev; in vop_find_vq()
293 u8 type = ioread8(&vdev->desc->type); in vop_find_vq()
295 if (index >= ioread8(&vdev->desc->num_vq)) in vop_find_vq()
302 vqconfig = _vop_vq_config(vdev->desc) + index; in vop_find_vq()
310 vdev->vr[index] = va; in vop_find_vq()
332 vdev->used_size[index] = PAGE_ALIGN(sizeof(__u16) * 3 + in vop_find_vq()
336 get_order(vdev->used_size[index])); in vop_find_vq()
339 dev_err(_vop_dev(vdev), "%s %d err %d\n", in vop_find_vq()
343 vdev->used[index] = dma_map_single(&vpdev->dev, used, in vop_find_vq()
344 vdev->used_size[index], in vop_find_vq()
346 if (dma_mapping_error(&vpdev->dev, vdev->used[index])) { in vop_find_vq()
348 dev_err(_vop_dev(vdev), "%s %d err %d\n", in vop_find_vq()
352 writeq(vdev->used[index], &vqconfig->used_address); in vop_find_vq()
363 vq->priv = vdev; in vop_find_vq()
367 get_order(vdev->used_size[index])); in vop_find_vq()
371 vpdev->hw_ops->iounmap(vpdev, vdev->vr[index]); in vop_find_vq()
381 struct _vop_vdev *vdev = to_vopvdev(dev); in vop_find_vqs() local
382 struct vop_device *vpdev = vdev->vpdev; in vop_find_vqs()
383 struct mic_device_ctrl __iomem *dc = vdev->dc; in vop_find_vqs()
387 if (nvqs > ioread8(&vdev->desc->num_vq)) in vop_find_vqs()
391 dev_dbg(_vop_dev(vdev), "%s: %d: %s\n", in vop_find_vqs()
406 vpdev->hw_ops->send_intr(vpdev, vdev->c2h_vdev_db); in vop_find_vqs()
413 dev_dbg(_vop_dev(vdev), "%s: retry: %d\n", __func__, retry); in vop_find_vqs()
442 struct _vop_vdev *vdev = data; in vop_virtio_intr_handler() local
443 struct vop_device *vpdev = vdev->vpdev; in vop_virtio_intr_handler()
446 vpdev->hw_ops->ack_interrupt(vpdev, vdev->h2c_vdev_db); in vop_virtio_intr_handler()
447 list_for_each_entry(vq, &vdev->vdev.vqs, list) in vop_virtio_intr_handler()
455 struct virtio_device *vdev = in vop_virtio_release_dev() local
458 container_of(vdev, struct _vop_vdev, vdev); in vop_virtio_release_dev()
471 struct _vop_vdev *vdev, *reg_dev = NULL; in _vop_add_device() local
475 vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); in _vop_add_device()
476 if (!vdev) in _vop_add_device()
479 vdev->vpdev = vpdev; in _vop_add_device()
480 vdev->vdev.dev.parent = &vpdev->dev; in _vop_add_device()
481 vdev->vdev.dev.release = vop_virtio_release_dev; in _vop_add_device()
482 vdev->vdev.id.device = type; in _vop_add_device()
483 vdev->vdev.config = &vop_vq_config_ops; in _vop_add_device()
484 vdev->desc = d; in _vop_add_device()
485 vdev->dc = (void __iomem *)d + _vop_aligned_desc_size(d); in _vop_add_device()
486 vdev->dnode = dnode; in _vop_add_device()
487 vdev->vdev.priv = (void *)(u64)dnode; in _vop_add_device()
488 init_completion(&vdev->reset_done); in _vop_add_device()
490 vdev->h2c_vdev_db = vpdev->hw_ops->next_db(vpdev); in _vop_add_device()
491 vdev->virtio_cookie = vpdev->hw_ops->request_irq(vpdev, in _vop_add_device()
493 vdev, vdev->h2c_vdev_db); in _vop_add_device()
494 if (IS_ERR(vdev->virtio_cookie)) { in _vop_add_device()
495 ret = PTR_ERR(vdev->virtio_cookie); in _vop_add_device()
498 iowrite8((u8)vdev->h2c_vdev_db, &vdev->dc->h2c_vdev_db); in _vop_add_device()
499 vdev->c2h_vdev_db = ioread8(&vdev->dc->c2h_vdev_db); in _vop_add_device()
501 ret = register_virtio_device(&vdev->vdev); in _vop_add_device()
502 reg_dev = vdev; in _vop_add_device()
504 dev_err(_vop_dev(vdev), in _vop_add_device()
509 writeq((u64)vdev, &vdev->dc->vdev); in _vop_add_device()
510 dev_dbg(_vop_dev(vdev), "%s: registered vop device %u type %u vdev %p\n", in _vop_add_device()
511 __func__, offset, type, vdev); in _vop_add_device()
516 vpdev->hw_ops->free_irq(vpdev, vdev->virtio_cookie, vdev); in _vop_add_device()
519 put_device(&vdev->vdev.dev); in _vop_add_device()
521 kfree(vdev); in _vop_add_device()
531 struct _vop_vdev *vdev = to_vopvdev(_dev); in vop_match_desc() local
533 return vdev->desc == (void __iomem *)data; in vop_match_desc()
542 struct _vop_vdev *vdev = (struct _vop_vdev *)readq(&dc->vdev); in _vop_handle_config_change() local
548 virtio_config_changed(&vdev->vdev); in _vop_handle_config_change()
561 struct _vop_vdev *vdev = (struct _vop_vdev *)readq(&dc->vdev); in _vop_remove_device() local
569 ioread8(&dc->config_change), ioread8(&d->type), vdev); in _vop_remove_device()
571 reinit_completion(&vdev->reset_done); in _vop_remove_device()
572 unregister_virtio_device(&vdev->vdev); in _vop_remove_device()
573 vpdev->hw_ops->free_irq(vpdev, vdev->virtio_cookie, vdev); in _vop_remove_device()
576 wait_for_completion(&vdev->reset_done); in _vop_remove_device()
577 put_device(&vdev->vdev.dev); in _vop_remove_device()