Lines Matching refs:regions
76 vdev->regions = kcalloc(cnt, sizeof(struct vfio_platform_region), in vfio_platform_regions_init()
78 if (!vdev->regions) in vfio_platform_regions_init()
88 vdev->regions[i].addr = res->start; in vfio_platform_regions_init()
89 vdev->regions[i].size = resource_size(res); in vfio_platform_regions_init()
90 vdev->regions[i].flags = 0; in vfio_platform_regions_init()
94 vdev->regions[i].type = VFIO_PLATFORM_REGION_TYPE_MMIO; in vfio_platform_regions_init()
95 vdev->regions[i].flags |= VFIO_REGION_INFO_FLAG_READ; in vfio_platform_regions_init()
97 vdev->regions[i].flags |= in vfio_platform_regions_init()
104 if (!(vdev->regions[i].addr & ~PAGE_MASK) && in vfio_platform_regions_init()
105 !(vdev->regions[i].size & ~PAGE_MASK)) in vfio_platform_regions_init()
106 vdev->regions[i].flags |= in vfio_platform_regions_init()
111 vdev->regions[i].type = VFIO_PLATFORM_REGION_TYPE_PIO; in vfio_platform_regions_init()
122 kfree(vdev->regions); in vfio_platform_regions_init()
131 iounmap(vdev->regions[i].ioaddr); in vfio_platform_regions_cleanup()
134 kfree(vdev->regions); in vfio_platform_regions_cleanup()
241 info.size = vdev->regions[info.index].size; in vfio_platform_ioctl()
242 info.flags = vdev->regions[info.index].flags; in vfio_platform_ioctl()
389 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_READ)) in vfio_platform_read()
392 if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_MMIO) in vfio_platform_read()
393 return vfio_platform_read_mmio(&vdev->regions[index], in vfio_platform_read()
395 else if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_PIO) in vfio_platform_read()
465 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE)) in vfio_platform_write()
468 if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_MMIO) in vfio_platform_write()
469 return vfio_platform_write_mmio(&vdev->regions[index], in vfio_platform_write()
471 else if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_PIO) in vfio_platform_write()
515 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_MMAP)) in vfio_platform_mmap()
518 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_READ) in vfio_platform_mmap()
522 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE) in vfio_platform_mmap()
528 if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_MMIO) in vfio_platform_mmap()
529 return vfio_platform_mmap_mmio(vdev->regions[index], vma); in vfio_platform_mmap()
531 else if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_PIO) in vfio_platform_mmap()