aboutsummaryrefslogtreecommitdiff
path: root/lib/dma.h
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-06-01 15:14:46 +0100
committerGitHub <noreply@github.com>2021-06-01 15:14:46 +0100
commit9c37a1813b65899ad3b0288a51b0cf1c372ee775 (patch)
tree3cdf95f941ec40788ff64957542cd74c72c988f1 /lib/dma.h
parent96ec963075e721c939441eaf0b92ea2a24b65668 (diff)
downloadlibvfio-user-9c37a1813b65899ad3b0288a51b0cf1c372ee775.zip
libvfio-user-9c37a1813b65899ad3b0288a51b0cf1c372ee775.tar.gz
libvfio-user-9c37a1813b65899ad3b0288a51b0cf1c372ee775.tar.bz2
limit max DMA region size (#545)
Since the dirty bitmap in message replies is allocated based upon the maximum size of an individual region, add a limit (somewhat arbitrarily 8TiB, which is a bitmap size of 256MiB). Add a couple of basic tests on the two DMA limits. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib/dma.h')
-rw-r--r--lib/dma.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/dma.h b/lib/dma.h
index 9798de9..082ca46 100644
--- a/lib/dma.h
+++ b/lib/dma.h
@@ -92,6 +92,7 @@ typedef struct {
typedef struct dma_controller {
int max_regions;
+ size_t max_size;
int nregions;
struct vfu_ctx *vfu_ctx;
size_t dirty_pgsize; // Dirty page granularity
@@ -99,7 +100,7 @@ typedef struct dma_controller {
} dma_controller_t;
dma_controller_t *
-dma_controller_create(vfu_ctx_t *vfu_ctx, int max_regions);
+dma_controller_create(vfu_ctx_t *vfu_ctx, size_t max_regions, size_t max_size);
void
dma_controller_remove_all_regions(dma_controller_t *dma,