aboutsummaryrefslogtreecommitdiff
path: root/lib/dma.c
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2020-12-17 15:52:18 +0000
committerGitHub <noreply@github.com>2020-12-17 15:52:18 +0000
commita764a3d66eb5a04dea769be15d88ef0ac4e5a5ea (patch)
treee78b28a2ec436ff9550bcaea765683311bcb7989 /lib/dma.c
parentff70ca1a9f97feae62e326eca39624c13aa8117f (diff)
downloadlibvfio-user-a764a3d66eb5a04dea769be15d88ef0ac4e5a5ea.zip
libvfio-user-a764a3d66eb5a04dea769be15d88ef0ac4e5a5ea.tar.gz
libvfio-user-a764a3d66eb5a04dea769be15d88ef0ac4e5a5ea.tar.bz2
add mappable bit in DMA segment (#215)
remove duplicate code for initializing DMA segment, mark DMA segment whether it's mappable, plus basic unit test for dma_addr_to_sg Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib/dma.c')
-rw-r--r--lib/dma.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/dma.c b/lib/dma.c
index 0bb623c..69b3fe5 100644
--- a/lib/dma.c
+++ b/lib/dma.c
@@ -375,13 +375,7 @@ _dma_addr_sg_split(const dma_controller_t *dma,
size_t region_len = MIN(region_end - dma_addr, len);
if (cnt < max_sg) {
- sg[cnt].dma_addr = region->dma_addr;
- sg[cnt].region = idx;
- sg[cnt].offset = dma_addr - region->dma_addr;
- sg[cnt].length = region_len;
- if (_dma_should_mark_dirty(dma, prot)) {
- _dma_mark_dirty(dma, region, sg);
- }
+ dma_init_sg(dma, sg, dma_addr, region_len, prot, idx);
}
cnt++;