Lines Matching full:vdev
13 struct vfio_cdx_device *vdev = in vfio_cdx_open_device() local
14 container_of(core_vdev, struct vfio_cdx_device, vdev); in vfio_cdx_open_device()
19 vdev->regions = kcalloc(count, sizeof(struct vfio_cdx_region), in vfio_cdx_open_device()
21 if (!vdev->regions) in vfio_cdx_open_device()
27 vdev->regions[i].addr = res->start; in vfio_cdx_open_device()
28 vdev->regions[i].size = resource_size(res); in vfio_cdx_open_device()
29 vdev->regions[i].type = res->flags; in vfio_cdx_open_device()
34 if (!(vdev->regions[i].addr & ~PAGE_MASK) && in vfio_cdx_open_device()
35 !(vdev->regions[i].size & ~PAGE_MASK)) in vfio_cdx_open_device()
36 vdev->regions[i].flags |= in vfio_cdx_open_device()
38 vdev->regions[i].flags |= VFIO_REGION_INFO_FLAG_READ; in vfio_cdx_open_device()
40 vdev->regions[i].flags |= VFIO_REGION_INFO_FLAG_WRITE; in vfio_cdx_open_device()
44 kfree(vdev->regions); in vfio_cdx_open_device()
45 vdev->regions = NULL; in vfio_cdx_open_device()
50 vdev->flags &= ~BME_SUPPORT; in vfio_cdx_open_device()
52 vdev->flags |= BME_SUPPORT; in vfio_cdx_open_device()
59 struct vfio_cdx_device *vdev = in vfio_cdx_close_device() local
60 container_of(core_vdev, struct vfio_cdx_device, vdev); in vfio_cdx_close_device()
62 kfree(vdev->regions); in vfio_cdx_close_device()
64 vfio_cdx_irqs_cleanup(vdev); in vfio_cdx_close_device()
72 struct vfio_cdx_device *vdev = in vfio_cdx_bm_ctrl() local
73 container_of(core_vdev, struct vfio_cdx_device, vdev); in vfio_cdx_bm_ctrl()
78 if (!(vdev->flags & BME_SUPPORT)) in vfio_cdx_bm_ctrl()
110 static int vfio_cdx_ioctl_get_info(struct vfio_cdx_device *vdev, in vfio_cdx_ioctl_get_info() argument
114 struct cdx_device *cdx_dev = to_cdx_device(vdev->vdev.dev); in vfio_cdx_ioctl_get_info()
132 static int vfio_cdx_ioctl_get_region_info(struct vfio_cdx_device *vdev, in vfio_cdx_ioctl_get_region_info() argument
136 struct cdx_device *cdx_dev = to_cdx_device(vdev->vdev.dev); in vfio_cdx_ioctl_get_region_info()
150 info.size = vdev->regions[info.index].size; in vfio_cdx_ioctl_get_region_info()
151 info.flags = vdev->regions[info.index].flags; in vfio_cdx_ioctl_get_region_info()
156 static int vfio_cdx_ioctl_get_irq_info(struct vfio_cdx_device *vdev, in vfio_cdx_ioctl_get_irq_info() argument
160 struct cdx_device *cdx_dev = to_cdx_device(vdev->vdev.dev); in vfio_cdx_ioctl_get_irq_info()
181 static int vfio_cdx_ioctl_set_irqs(struct vfio_cdx_device *vdev, in vfio_cdx_ioctl_set_irqs() argument
185 struct cdx_device *cdx_dev = to_cdx_device(vdev->vdev.dev); in vfio_cdx_ioctl_set_irqs()
205 ret = vfio_cdx_set_irqs_ioctl(vdev, hdr.flags, hdr.index, in vfio_cdx_ioctl_set_irqs()
215 struct vfio_cdx_device *vdev = in vfio_cdx_ioctl() local
216 container_of(core_vdev, struct vfio_cdx_device, vdev); in vfio_cdx_ioctl()
221 return vfio_cdx_ioctl_get_info(vdev, uarg); in vfio_cdx_ioctl()
223 return vfio_cdx_ioctl_get_region_info(vdev, uarg); in vfio_cdx_ioctl()
225 return vfio_cdx_ioctl_get_irq_info(vdev, uarg); in vfio_cdx_ioctl()
227 return vfio_cdx_ioctl_set_irqs(vdev, uarg); in vfio_cdx_ioctl()
258 struct vfio_cdx_device *vdev = in vfio_cdx_mmap() local
259 container_of(core_vdev, struct vfio_cdx_device, vdev); in vfio_cdx_mmap()
268 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_MMAP)) in vfio_cdx_mmap()
271 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_READ) && in vfio_cdx_mmap()
275 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE) && in vfio_cdx_mmap()
279 return vfio_cdx_mmap_mmio(vdev->regions[index], vma); in vfio_cdx_mmap()
296 struct vfio_cdx_device *vdev; in vfio_cdx_probe() local
300 vdev = vfio_alloc_device(vfio_cdx_device, vdev, dev, in vfio_cdx_probe()
302 if (IS_ERR(vdev)) in vfio_cdx_probe()
303 return PTR_ERR(vdev); in vfio_cdx_probe()
305 ret = vfio_register_group_dev(&vdev->vdev); in vfio_cdx_probe()
309 dev_set_drvdata(dev, vdev); in vfio_cdx_probe()
313 vfio_put_device(&vdev->vdev); in vfio_cdx_probe()
320 struct vfio_cdx_device *vdev = dev_get_drvdata(dev); in vfio_cdx_remove() local
322 vfio_unregister_group_dev(&vdev->vdev); in vfio_cdx_remove()
323 vfio_put_device(&vdev->vdev); in vfio_cdx_remove()