Lines Matching refs:vdpa
50 struct vdpa_device *vdpa; member
110 if (asid >= v->vdpa->nas) in vhost_vdpa_alloc_as()
137 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_reset_map() local
138 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_reset_map()
141 ops->reset_map(vdpa, asid); in vhost_vdpa_reset_map()
171 const struct vdpa_config_ops *ops = v->vdpa->config; in handle_vq_kick()
173 ops->kick_vq(v->vdpa, vq - v->vqs); in handle_vq_kick()
201 const struct vdpa_config_ops *ops = v->vdpa->config; in vhost_vdpa_setup_vq_irq()
202 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_setup_vq_irq() local
208 irq = ops->get_vq_irq(vdpa, qid); in vhost_vdpa_setup_vq_irq()
231 struct vdpa_device *vdpa = v->vdpa; in _compat_vdpa_reset() local
242 return vdpa_reset(vdpa, flags); in _compat_vdpa_reset()
253 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_bind_mm() local
254 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_bind_mm()
256 if (!vdpa->use_va || !ops->bind_mm) in vhost_vdpa_bind_mm()
259 return ops->bind_mm(vdpa, v->vdev.mm); in vhost_vdpa_bind_mm()
264 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_unbind_mm() local
265 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_unbind_mm()
267 if (!vdpa->use_va || !ops->unbind_mm) in vhost_vdpa_unbind_mm()
270 ops->unbind_mm(vdpa); in vhost_vdpa_unbind_mm()
275 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_get_device_id() local
276 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_get_device_id()
279 device_id = ops->get_device_id(vdpa); in vhost_vdpa_get_device_id()
289 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_get_status() local
290 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_get_status()
293 status = ops->get_status(vdpa); in vhost_vdpa_get_status()
303 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_set_status() local
304 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_set_status()
313 status_old = ops->get_status(vdpa); in vhost_vdpa_set_status()
331 vdpa_set_status(vdpa, status); in vhost_vdpa_set_status()
343 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_config_validate() local
344 size_t size = vdpa->config->get_config_size(vdpa); in vhost_vdpa_config_validate()
358 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_get_config() local
371 vdpa_get_config(vdpa, config.off, buf, config.len); in vhost_vdpa_get_config()
385 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_set_config() local
399 vdpa_set_config(vdpa, config.off, buf, config.len); in vhost_vdpa_set_config()
407 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_can_suspend() local
408 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_can_suspend()
415 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_can_resume() local
416 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_can_resume()
423 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_has_desc_group() local
424 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_has_desc_group()
431 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_get_features() local
432 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_get_features()
435 features = ops->get_device_features(vdpa); in vhost_vdpa_get_features()
445 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_get_backend_features() local
446 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_get_backend_features()
451 return ops->get_backend_features(vdpa); in vhost_vdpa_get_backend_features()
456 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_has_persistent_map() local
457 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_has_persistent_map()
465 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_set_features() local
466 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_set_features()
476 if (ops->get_status(vdpa) & VIRTIO_CONFIG_S_FEATURES_OK) in vhost_vdpa_set_features()
482 if (vdpa_set_features(vdpa, features)) in vhost_vdpa_set_features()
486 actual_features = ops->get_driver_features(vdpa); in vhost_vdpa_set_features()
500 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_get_vring_num() local
501 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_get_vring_num()
504 num = ops->get_vq_num_max(vdpa); in vhost_vdpa_get_vring_num()
544 v->vdpa->config->set_config_cb(v->vdpa, &cb); in vhost_vdpa_set_config_call()
563 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_get_config_size() local
564 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_get_config_size()
567 size = ops->get_config_size(vdpa); in vhost_vdpa_get_config_size()
577 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_get_vqs_count() local
579 if (copy_to_user(argp, &vdpa->nvqs, sizeof(vdpa->nvqs))) in vhost_vdpa_get_vqs_count()
592 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_suspend() local
593 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_suspend()
596 if (!(ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK)) in vhost_vdpa_suspend()
602 ret = ops->suspend(vdpa); in vhost_vdpa_suspend()
615 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_resume() local
616 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_resume()
619 if (!(ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK)) in vhost_vdpa_resume()
625 ret = ops->resume(vdpa); in vhost_vdpa_resume()
635 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_vring_ioctl() local
636 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_vring_ioctl()
658 ops->set_vq_ready(vdpa, idx, s.num); in vhost_vdpa_vring_ioctl()
664 s.num = ops->get_vq_group(vdpa, idx); in vhost_vdpa_vring_ioctl()
665 if (s.num >= vdpa->ngroups) in vhost_vdpa_vring_ioctl()
674 s.num = ops->get_vq_desc_group(vdpa, idx); in vhost_vdpa_vring_ioctl()
675 if (s.num >= vdpa->ngroups) in vhost_vdpa_vring_ioctl()
683 if (s.num >= vdpa->nas) in vhost_vdpa_vring_ioctl()
687 return ops->set_group_asid(vdpa, idx, s.num); in vhost_vdpa_vring_ioctl()
692 s.num = ops->get_vq_size(vdpa, idx); in vhost_vdpa_vring_ioctl()
697 r = ops->get_vq_state(v->vdpa, idx, &vq_state); in vhost_vdpa_vring_ioctl()
712 if (ops->get_status(vdpa) & in vhost_vdpa_vring_ioctl()
726 if ((ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK) && !v->suspended) in vhost_vdpa_vring_ioctl()
729 if (ops->set_vq_address(vdpa, idx, in vhost_vdpa_vring_ioctl()
737 if ((ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK) && !v->suspended) in vhost_vdpa_vring_ioctl()
748 r = ops->set_vq_state(vdpa, idx, &vq_state); in vhost_vdpa_vring_ioctl()
757 if (ops->get_status(vdpa) & in vhost_vdpa_vring_ioctl()
765 ops->set_vq_cb(vdpa, idx, &cb); in vhost_vdpa_vring_ioctl()
769 ops->set_vq_num(vdpa, idx, vq->num); in vhost_vdpa_vring_ioctl()
843 if (copy_to_user(argp, &v->vdpa->ngroups, in vhost_vdpa_unlocked_ioctl()
844 sizeof(v->vdpa->ngroups))) in vhost_vdpa_unlocked_ioctl()
848 if (copy_to_user(argp, &v->vdpa->nas, sizeof(v->vdpa->nas))) in vhost_vdpa_unlocked_ioctl()
911 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_general_unmap() local
912 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_general_unmap()
914 ops->dma_unmap(vdpa, asid, map->start, map->size); in vhost_vdpa_general_unmap()
962 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_iotlb_unmap() local
964 if (vdpa->use_va) in vhost_vdpa_iotlb_unmap()
996 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_map() local
997 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_map()
1007 r = ops->dma_map(vdpa, asid, iova, size, pa, perm, opaque); in vhost_vdpa_map()
1010 r = ops->set_map(vdpa, asid, iotlb); in vhost_vdpa_map()
1021 if (!vdpa->use_va) in vhost_vdpa_map()
1031 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_unmap() local
1032 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_unmap()
1039 ops->set_map(vdpa, asid, iotlb); in vhost_vdpa_unmap()
1224 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_process_iotlb_update() local
1235 if (vdpa->use_va) in vhost_vdpa_process_iotlb_update()
1247 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_process_iotlb_msg() local
1248 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_process_iotlb_msg()
1296 ops->set_map(vdpa, asid, iotlb); in vhost_vdpa_process_iotlb_msg()
1321 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_alloc_domain() local
1322 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_alloc_domain()
1323 struct device *dma_dev = vdpa_get_dma_dev(vdpa); in vhost_vdpa_alloc_domain()
1357 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_free_domain() local
1358 struct device *dma_dev = vdpa_get_dma_dev(vdpa); in vhost_vdpa_free_domain()
1371 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_set_iova_range() local
1372 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_set_iova_range()
1375 *range = ops->get_iova_range(vdpa); in vhost_vdpa_set_iova_range()
1390 for (asid = 0; asid < v->vdpa->nas; asid++) { in vhost_vdpa_cleanup()
1486 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_fault() local
1487 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_fault()
1492 notify = ops->get_vq_notification(vdpa, index); in vhost_vdpa_fault()
1504 struct vdpa_device *vdpa = v->vdpa; in vhost_vdpa_mmap() local
1505 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_mmap()
1524 notify = ops->get_vq_notification(vdpa, index); in vhost_vdpa_mmap()
1558 static int vhost_vdpa_probe(struct vdpa_device *vdpa) in vhost_vdpa_probe() argument
1560 const struct vdpa_config_ops *ops = vdpa->config; in vhost_vdpa_probe()
1569 (vdpa->ngroups > 1 || vdpa->nas > 1)) in vhost_vdpa_probe()
1585 v->vdpa = vdpa; in vhost_vdpa_probe()
1586 v->nvqs = vdpa->nvqs; in vhost_vdpa_probe()
1587 v->virtio_id = ops->get_device_id(vdpa); in vhost_vdpa_probe()
1591 v->dev.parent = &vdpa->dev; in vhost_vdpa_probe()
1612 vdpa_set_drvdata(vdpa, v); in vhost_vdpa_probe()
1624 static void vhost_vdpa_remove(struct vdpa_device *vdpa) in vhost_vdpa_remove() argument
1626 struct vhost_vdpa *v = vdpa_get_drvdata(vdpa); in vhost_vdpa_remove()