Lines Matching refs:regions
35 vdev->regions = kcalloc(cnt, sizeof(struct vfio_platform_region), in vfio_platform_regions_init()
37 if (!vdev->regions) in vfio_platform_regions_init()
47 vdev->regions[i].addr = res->start; in vfio_platform_regions_init()
48 vdev->regions[i].size = resource_size(res); in vfio_platform_regions_init()
49 vdev->regions[i].flags = 0; in vfio_platform_regions_init()
53 vdev->regions[i].type = VFIO_PLATFORM_REGION_TYPE_MMIO; in vfio_platform_regions_init()
54 vdev->regions[i].flags |= VFIO_REGION_INFO_FLAG_READ; in vfio_platform_regions_init()
56 vdev->regions[i].flags |= in vfio_platform_regions_init()
63 if (!(vdev->regions[i].addr & ~PAGE_MASK) && in vfio_platform_regions_init()
64 !(vdev->regions[i].size & ~PAGE_MASK)) in vfio_platform_regions_init()
65 vdev->regions[i].flags |= in vfio_platform_regions_init()
70 vdev->regions[i].type = VFIO_PLATFORM_REGION_TYPE_PIO; in vfio_platform_regions_init()
81 kfree(vdev->regions); in vfio_platform_regions_init()
90 iounmap(vdev->regions[i].ioaddr); in vfio_platform_regions_cleanup()
93 kfree(vdev->regions); in vfio_platform_regions_cleanup()
185 info.size = vdev->regions[info.index].size; in vfio_platform_ioctl()
186 info.flags = vdev->regions[info.index].flags; in vfio_platform_ioctl()
329 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_READ)) in vfio_platform_read()
332 if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_MMIO) in vfio_platform_read()
333 return vfio_platform_read_mmio(vdev->regions[index], in vfio_platform_read()
335 else if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_PIO) in vfio_platform_read()
405 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE)) in vfio_platform_write()
408 if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_MMIO) in vfio_platform_write()
409 return vfio_platform_write_mmio(vdev->regions[index], in vfio_platform_write()
411 else if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_PIO) in vfio_platform_write()
455 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_MMAP)) in vfio_platform_mmap()
458 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_READ) in vfio_platform_mmap()
462 if (!(vdev->regions[index].flags & VFIO_REGION_INFO_FLAG_WRITE) in vfio_platform_mmap()
468 if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_MMIO) in vfio_platform_mmap()
469 return vfio_platform_mmap_mmio(vdev->regions[index], vma); in vfio_platform_mmap()
471 else if (vdev->regions[index].type & VFIO_PLATFORM_REGION_TYPE_PIO) in vfio_platform_mmap()