aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-05-24 10:42:42 +0100
committerGitHub <noreply@github.com>2021-05-24 10:42:42 +0100
commitbf3938dec68e1c820063db4f63aa2355c5703e4b (patch)
treeddb63a16a166d52ee8f5506f649faee79ada2240 /include
parent300f87e1b02e979da8cec444249f09ea0ef167a0 (diff)
downloadlibvfio-user-bf3938dec68e1c820063db4f63aa2355c5703e4b.zip
libvfio-user-bf3938dec68e1c820063db4f63aa2355c5703e4b.tar.gz
libvfio-user-bf3938dec68e1c820063db4f63aa2355c5703e4b.tar.bz2
fix region offset handling (#485)
The specification states that the region offset given in the region info should be used as the "offset" when mmap()ing the region from the client side. However, the library instead implemented a fixed offset scheme similar to that of vfio - and no clients actually set up the file like that. Instead, let servers define their own offsets, and pass them through to clients as is. It's up to the server to decide how its backing file or files is organized. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'include')
-rw-r--r--include/libvfio-user.h13
1 files changed, 2 insertions, 11 deletions
diff --git a/include/libvfio-user.h b/include/libvfio-user.h
index 371daaf..6cb817d 100644
--- a/include/libvfio-user.h
+++ b/include/libvfio-user.h
@@ -292,6 +292,7 @@ typedef ssize_t (vfu_region_access_cb_t)(vfu_ctx_t *vfu_ctx, char *buf,
* @fd: file descriptor of the file backing the region if the region is
* mappable; it is the server's responsibility to create a file suitable for
* memory mapping by the client.
+ * @offset: offset of the region within the fd, or zero.
*
* @returns 0 on success, -1 on error, Sets errno.
*/
@@ -299,7 +300,7 @@ int
vfu_setup_region(vfu_ctx_t *vfu_ctx, int region_idx, size_t size,
vfu_region_access_cb_t *region_access, int flags,
struct iovec *mmap_areas, uint32_t nr_mmap_areas,
- int fd);
+ int fd, uint64_t offset);
/*
* Returns the size of the area needed to hold the migration registers at the
@@ -857,16 +858,6 @@ size_t
vfu_pci_find_next_capability(vfu_ctx_t *vfu_ctx, bool extended,
size_t pos, int cap_id);
-/**
- * Returns the memory offset where the specific region starts in device memory.
- *
- * @region: the region to translate
- *
- * @returns the absolute offset
- */
-uint64_t
-vfu_region_to_offset(uint32_t region);
-
#ifdef __cplusplus
}
#endif