diff options
author | John Levon <john.levon@nutanix.com> | 2021-06-01 15:14:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-01 15:14:46 +0100 |
commit | 9c37a1813b65899ad3b0288a51b0cf1c372ee775 (patch) | |
tree | 3cdf95f941ec40788ff64957542cd74c72c988f1 /lib/private.h | |
parent | 96ec963075e721c939441eaf0b92ea2a24b65668 (diff) | |
download | libvfio-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/private.h')
-rw-r--r-- | lib/private.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/private.h b/lib/private.h index c9a8af7..c7c0627 100644 --- a/lib/private.h +++ b/lib/private.h @@ -35,8 +35,16 @@ #include <errno.h> -#include "pci_caps.h" #include "common.h" +#include "pci_caps.h" + +/* + * The main reason we limit the size of an individual DMA region from the client + * is to limit the size of the dirty bitmaps: this corresponds to 256MB at a 4K + * page size. + */ +#define MAX_DMA_SIZE (8 * ONE_TB) +#define MAX_DMA_REGIONS 16 #define SERVER_MAX_MSG_SIZE 65536 |