Lines Matching full:regions
144 vdev->regions = kcalloc(cnt, sizeof(struct vfio_platform_region), in vfio_platform_regions_init()
146 if (!vdev->regions) in vfio_platform_regions_init()
153 vdev->regions[i].addr = res->start; in vfio_platform_regions_init()
154 vdev->regions[i].size = resource_size(res); in vfio_platform_regions_init()
155 vdev->regions[i].flags = 0; in vfio_platform_regions_init()
159 vdev->regions[i].type = VFIO_PLATFORM_REGION_TYPE_MMIO; in vfio_platform_regions_init()
160 vdev->regions[i].flags |= VFIO_REGION_INFO_FLAG_READ; in vfio_platform_regions_init()
162 vdev->regions[i].flags |= in vfio_platform_regions_init()
166 * Only regions addressed with PAGE granularity may be in vfio_platform_regions_init()
169 if (!(vdev->regions[i].addr & ~PAGE_MASK) && in vfio_platform_regions_init()
170 !(vdev->regions[i].size & ~PAGE_MASK)) in vfio_platform_regions_init()
171 vdev->regions[i].flags |= in vfio_platform_regions_init()
176 vdev->regions[i].type = VFIO_PLATFORM_REGION_TYPE_PIO; in vfio_platform_regions_init()
187 kfree(vdev->regions); in vfio_platform_regions_init()
196 iounmap(vdev->regions[i].ioaddr); in vfio_platform_regions_cleanup()
199 kfree(vdev->regions); in vfio_platform_regions_cleanup()
319 info.size = vdev->regions[info.index].size; in vfio_platform_ioctl()
320 info.flags = vdev->regions[info.index].flags; in vfio_platform_ioctl()
456 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_READ)) in vfio_platform_read()
459 if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_MMIO) in vfio_platform_read()
460 return vfio_platform_read_mmio(&vdev->regions[index], in vfio_platform_read()
462 else if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_PIO) in vfio_platform_read()
539 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE)) in vfio_platform_write()
542 if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_MMIO) in vfio_platform_write()
543 return vfio_platform_write_mmio(&vdev->regions[index], in vfio_platform_write()
545 else if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_PIO) in vfio_platform_write()
591 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_MMAP)) in vfio_platform_mmap()
594 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_READ) in vfio_platform_mmap()
598 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE) in vfio_platform_mmap()
604 if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_MMIO) in vfio_platform_mmap()
605 return vfio_platform_mmap_mmio(vdev->regions[index], vma); in vfio_platform_mmap()
607 else if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_PIO) in vfio_platform_mmap()