1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

lib/kernel/vfio: add function to get size of device memory region

This commit is contained in:
Daniel Krebs 2018-02-13 10:29:16 +01:00 committed by Steffen Vogel
parent 33ba634d87
commit 035c6f8b2a
2 changed files with 11 additions and 0 deletions

View file

@ -104,6 +104,9 @@ void vfio_dump(struct vfio_container *c);
/** Map a device memory region to the application address space (e.g. PCI BARs) */
void * vfio_map_region(struct vfio_device *d, int idx);
/** Get the size of a device memory region */
size_t vfio_region_size(struct vfio_device *d, int idx);
/** Map VM to an IOVA, which is accessible by devices in the container */
int vfio_map_dma(struct vfio_container *c, uint64_t virt, uint64_t phys, size_t len);

View file

@ -574,6 +574,14 @@ void * vfio_map_region(struct vfio_device *d, int idx)
return d->mappings[idx];
}
size_t vfio_region_size(struct vfio_device *d, int idx)
{
assert(d != NULL);
assert((size_t)idx < d->info.num_regions);
return d->regions[idx].size;
}
int vfio_unmap_region(struct vfio_device *d, int idx)
{
int ret;