aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libvfio-user.h18
-rw-r--r--lib/dma.h12
2 files changed, 15 insertions, 15 deletions
diff --git a/include/libvfio-user.h b/include/libvfio-user.h
index f91f3c7..5e379df 100644
--- a/include/libvfio-user.h
+++ b/include/libvfio-user.h
@@ -624,9 +624,9 @@ int
vfu_irq_trigger(vfu_ctx_t *vfu_ctx, uint32_t subindex);
/**
- * Takes a guest physical address and returns a list of scatter/gather entries
- * than can be individually mapped in the program's virtual memory. A single
- * linear guest physical address span may need to be split into multiple
+ * Takes a guest physical address range and populates an array of scatter/gather
+ * entries than can be individually mapped in the program's virtual memory. A
+ * single linear guest physical address span may need to be split into multiple
* scatter/gather regions due to limitations of how memory can be mapped.
*
* vfu_setup_device_dma() must have been called prior to using this function.
@@ -650,9 +650,9 @@ vfu_addr_to_sg(vfu_ctx_t *vfu_ctx, vfu_dma_addr_t dma_addr, size_t len,
dma_sg_t *sg, int max_sg, int prot);
/**
- * Maps a list scatter/gather entries from the guest's physical address space
- * to the program's virtual memory. It is the caller's responsibility to remove
- * the mappings by calling vfu_unmap_sg().
+ * Maps scatter/gather entries from the guest's physical address space to the
+ * process's virtual memory. It is the caller's responsibility to remove the
+ * mappings by calling vfu_unmap_sg().
*
* This is only supported when a @dma_unregister callback is provided to
* vfu_setup_device_dma().
@@ -660,7 +660,7 @@ vfu_addr_to_sg(vfu_ctx_t *vfu_ctx, vfu_dma_addr_t dma_addr, size_t len,
* @vfu_ctx: the libvfio-user context
* @sg: array of scatter/gather entries returned by vfu_addr_to_sg. These
* entries must not be modified and the array must not be deallocated
- * until vfu_unmap_sg() has been called for each entry.
+ * until vfu_unmap_sg() has been called.
* @iov: array of iovec structures (defined in <sys/uio.h>) to receive each
* mapping
* @cnt: number of scatter/gather entries to map
@@ -673,8 +673,8 @@ vfu_map_sg(vfu_ctx_t *vfu_ctx, dma_sg_t *sg, struct iovec *iov, int cnt,
int flags);
/**
- * Unmaps a list scatter/gather entries (previously mapped by vfu_map_sg()) from
- * the program's virtual memory.
+ * Unmaps scatter/gather entries (previously mapped by vfu_map_sg()) from
+ * the process's virtual memory.
*
* @vfu_ctx: the libvfio-user context
* @sg: array of scatter/gather entries to unmap
diff --git a/lib/dma.h b/lib/dma.h
index 29809d3..895e14f 100644
--- a/lib/dma.h
+++ b/lib/dma.h
@@ -245,15 +245,15 @@ dma_map_sg(dma_controller_t *dma, dma_sg_t *sg, struct iovec *iov,
return ERROR_INT(EFAULT);
}
- if (sg->writeable) {
+ if (sg[i].writeable) {
if (dma->dirty_pgsize > 0) {
- _dma_mark_dirty(dma, region, sg);
+ _dma_mark_dirty(dma, region, &sg[i]);
}
LIST_INSERT_HEAD(&dma->maps, &sg[i], entry);
}
vfu_log(dma->vfu_ctx, LOG_DEBUG, "map %p-%p",
- sg->dma_addr + sg->offset,
- sg->dma_addr + sg->offset + sg->length);
+ sg[i].dma_addr + sg[i].offset,
+ sg[i].dma_addr + sg[i].offset + sg[i].length);
iov[i].iov_base = region->info.vaddr + sg[i].offset;
iov[i].iov_len = sg[i].length;
region->refcnt++;
@@ -282,8 +282,8 @@ dma_unmap_sg(dma_controller_t *dma, const dma_sg_t *sg,
/* bad region */
continue;
}
- if (sg->writeable) {
- LIST_REMOVE(sg, entry);
+ if (sg[i].writeable) {
+ LIST_REMOVE(&sg[i], entry);
}
vfu_log(dma->vfu_ctx, LOG_DEBUG, "unmap %p-%p",
sg[i].dma_addr + sg[i].offset,