Lines Matching refs:regions
145 vdev->regions = kcalloc(cnt, sizeof(struct vfio_platform_region), in vfio_platform_regions_init()
147 if (!vdev->regions) in vfio_platform_regions_init()
157 vdev->regions[i].addr = res->start; in vfio_platform_regions_init()
158 vdev->regions[i].size = resource_size(res); in vfio_platform_regions_init()
159 vdev->regions[i].flags = 0; in vfio_platform_regions_init()
163 vdev->regions[i].type = VFIO_PLATFORM_REGION_TYPE_MMIO; in vfio_platform_regions_init()
164 vdev->regions[i].flags |= VFIO_REGION_INFO_FLAG_READ; in vfio_platform_regions_init()
166 vdev->regions[i].flags |= in vfio_platform_regions_init()
173 if (!(vdev->regions[i].addr & ~PAGE_MASK) && in vfio_platform_regions_init()
174 !(vdev->regions[i].size & ~PAGE_MASK)) in vfio_platform_regions_init()
175 vdev->regions[i].flags |= in vfio_platform_regions_init()
180 vdev->regions[i].type = VFIO_PLATFORM_REGION_TYPE_PIO; in vfio_platform_regions_init()
191 kfree(vdev->regions); in vfio_platform_regions_init()
200 iounmap(vdev->regions[i].ioaddr); in vfio_platform_regions_cleanup()
203 kfree(vdev->regions); in vfio_platform_regions_cleanup()
339 info.size = vdev->regions[info.index].size; in vfio_platform_ioctl()
340 info.flags = vdev->regions[info.index].flags; in vfio_platform_ioctl()
469 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_READ)) in vfio_platform_read()
472 if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_MMIO) in vfio_platform_read()
473 return vfio_platform_read_mmio(&vdev->regions[index], in vfio_platform_read()
475 else if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_PIO) in vfio_platform_read()
545 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE)) in vfio_platform_write()
548 if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_MMIO) in vfio_platform_write()
549 return vfio_platform_write_mmio(&vdev->regions[index], in vfio_platform_write()
551 else if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_PIO) in vfio_platform_write()
595 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_MMAP)) in vfio_platform_mmap()
598 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_READ) in vfio_platform_mmap()
602 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE) in vfio_platform_mmap()
608 if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_MMIO) in vfio_platform_mmap()
609 return vfio_platform_mmap_mmio(vdev->regions[index], vma); in vfio_platform_mmap()
611 else if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_PIO) in vfio_platform_mmap()