Lines Matching refs:vdev
24 struct vfio_fsl_mc_device *vdev =
25 container_of(core_vdev, struct vfio_fsl_mc_device, vdev);
26 struct fsl_mc_device *mc_dev = vdev->mc_dev;
30 vdev->regions = kcalloc(count, sizeof(struct vfio_fsl_mc_region),
32 if (!vdev->regions)
39 vdev->regions[i].addr = res->start;
40 vdev->regions[i].size = resource_size(res);
41 vdev->regions[i].type = mc_dev->regions[i].flags & IORESOURCE_BITS;
46 if (!no_mmap && !(vdev->regions[i].addr & ~PAGE_MASK) &&
47 !(vdev->regions[i].size & ~PAGE_MASK))
48 vdev->regions[i].flags |=
50 vdev->regions[i].flags |= VFIO_REGION_INFO_FLAG_READ;
52 vdev->regions[i].flags |= VFIO_REGION_INFO_FLAG_WRITE;
58 static void vfio_fsl_mc_regions_cleanup(struct vfio_fsl_mc_device *vdev)
60 struct fsl_mc_device *mc_dev = vdev->mc_dev;
64 iounmap(vdev->regions[i].ioaddr);
65 kfree(vdev->regions);
68 static int vfio_fsl_mc_reset_device(struct vfio_fsl_mc_device *vdev)
70 struct fsl_mc_device *mc_dev = vdev->mc_dev;
73 if (is_fsl_mc_bus_dprc(vdev->mc_dev)) {
99 struct vfio_fsl_mc_device *vdev =
100 container_of(core_vdev, struct vfio_fsl_mc_device, vdev);
101 struct fsl_mc_device *mc_dev = vdev->mc_dev;
106 vfio_fsl_mc_regions_cleanup(vdev);
109 ret = vfio_fsl_mc_reset_device(vdev);
115 vfio_fsl_mc_irqs_cleanup(vdev);
124 struct vfio_fsl_mc_device *vdev =
125 container_of(core_vdev, struct vfio_fsl_mc_device, vdev);
126 struct fsl_mc_device *mc_dev = vdev->mc_dev;
169 info.size = vdev->regions[info.index].size;
170 info.flags = vdev->regions[info.index].flags;
221 mutex_lock(&vdev->igate);
222 ret = vfio_fsl_mc_set_irqs_ioctl(vdev, hdr.flags,
225 mutex_unlock(&vdev->igate);
232 return vfio_fsl_mc_reset_device(vdev);
243 struct vfio_fsl_mc_device *vdev =
244 container_of(core_vdev, struct vfio_fsl_mc_device, vdev);
247 struct fsl_mc_device *mc_dev = vdev->mc_dev;
255 region = &vdev->regions[index];
322 struct vfio_fsl_mc_device *vdev =
323 container_of(core_vdev, struct vfio_fsl_mc_device, vdev);
326 struct fsl_mc_device *mc_dev = vdev->mc_dev;
334 region = &vdev->regions[index];
387 struct vfio_fsl_mc_device *vdev =
388 container_of(core_vdev, struct vfio_fsl_mc_device, vdev);
389 struct fsl_mc_device *mc_dev = vdev->mc_dev;
405 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_MMAP))
408 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_READ)
412 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE)
418 return vfio_fsl_mc_mmap_mmio(vdev->regions[index], vma);
425 struct vfio_fsl_mc_device *vdev = container_of(nb,
432 vdev->mc_dev == mc_cont) {
442 vdev->mc_dev == mc_cont) {
453 static int vfio_fsl_mc_init_device(struct vfio_fsl_mc_device *vdev)
455 struct fsl_mc_device *mc_dev = vdev->mc_dev;
466 vdev->nb.notifier_call = vfio_fsl_mc_bus_notifier;
467 ret = bus_register_notifier(&fsl_mc_bus_type, &vdev->nb);
480 bus_unregister_notifier(&fsl_mc_bus_type, &vdev->nb);
501 static void vfio_fsl_uninit_device(struct vfio_fsl_mc_device *vdev)
503 struct fsl_mc_device *mc_dev = vdev->mc_dev;
509 bus_unregister_notifier(&fsl_mc_bus_type, &vdev->nb);
514 struct vfio_fsl_mc_device *vdev =
515 container_of(core_vdev, struct vfio_fsl_mc_device, vdev);
519 vdev->mc_dev = mc_dev;
520 mutex_init(&vdev->igate);
531 return vfio_fsl_mc_init_device(vdev);
536 struct vfio_fsl_mc_device *vdev;
540 vdev = vfio_alloc_device(vfio_fsl_mc_device, vdev, dev,
542 if (IS_ERR(vdev))
543 return PTR_ERR(vdev);
545 ret = vfio_register_group_dev(&vdev->vdev);
554 dev_set_drvdata(dev, vdev);
558 vfio_unregister_group_dev(&vdev->vdev);
560 vfio_put_device(&vdev->vdev);
566 struct vfio_fsl_mc_device *vdev =
567 container_of(core_vdev, struct vfio_fsl_mc_device, vdev);
569 vfio_fsl_uninit_device(vdev);
570 mutex_destroy(&vdev->igate);
576 struct vfio_fsl_mc_device *vdev = dev_get_drvdata(dev);
578 vfio_unregister_group_dev(&vdev->vdev);
580 vfio_put_device(&vdev->vdev);