aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2022-05-27 11:25:53 +0100
committerGitHub <noreply@github.com>2022-05-27 11:25:53 +0100
commit54b7ef99497b2a4aa703a33342b54c76a709b0fe (patch)
tree726c6f38b8eeb23a28cf194afca0f39117aa034a /include
parentc985a9a53656b50063cf2de1b29e40e02b47f415 (diff)
downloadlibvfio-user-54b7ef99497b2a4aa703a33342b54c76a709b0fe.zip
libvfio-user-54b7ef99497b2a4aa703a33342b54c76a709b0fe.tar.gz
libvfio-user-54b7ef99497b2a4aa703a33342b54c76a709b0fe.tar.bz2
re-work SG dirty tracking (#672)
Move SG dirtying to vfu_unmap_sg(): as we don't want to track SGs ourselves, doing this in vfu_map_sg() is no longer the right place. Note that the lack of tracking implies that any SGs must be unmapped before the final stop and copy phase. To avoid the need for this, add vfu_mark_sg_dirty(): this allows a consumer to mark a region as dirty explicitly without needing to unmap it. Currently it's the same as vfu_unmap_sg(), but that's an implementation detail. Note this still marks current maps after a get operation; that will change subsequently. 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, 13 insertions, 0 deletions
diff --git a/include/libvfio-user.h b/include/libvfio-user.h
index 629727f..3fe4b9f 100644
--- a/include/libvfio-user.h
+++ b/include/libvfio-user.h
@@ -803,9 +803,22 @@ vfu_map_sg(vfu_ctx_t *vfu_ctx, dma_sg_t *sg, struct iovec *iov, int cnt,
int flags);
/**
+ * Mark scatter/gather entries (previously mapped by vfu_map_sg()) as dirty
+ * (written to). This is only necessary if vfu_unmap_sg() is not called.
+ *
+ * @vfu_ctx: the libvfio-user context
+ * @sg: array of scatter/gather entries to mark as dirty
+ * @cnt: number of scatter/gather entries to mark as dirty
+ */
+void
+vfu_mark_sg_dirty(vfu_ctx_t *vfu_ctx, dma_sg_t *sg, int cnt);
+
+/**
* Unmaps scatter/gather entries (previously mapped by vfu_map_sg()) from
* the process's virtual memory.
*
+ * This will automatically mark the sg as dirty if needed.
+ *
* @vfu_ctx: the libvfio-user context
* @sg: array of scatter/gather entries to unmap
* @iov: array of iovec structures for each scatter/gather entry