diff options
author | swapnili <swapnil.ingle@nutanix.com> | 2021-01-21 15:38:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-21 15:38:24 +0100 |
commit | e899af8f842c9ba2d48fb44b507e90187f2fab47 (patch) | |
tree | 3987cf106c923ad52b9605c6486b7868ac3c2cbe /include/libvfio-user.h | |
parent | 4f3ad36fc3956d9c1ca926615301e40134b75d58 (diff) | |
download | libvfio-user-e899af8f842c9ba2d48fb44b507e90187f2fab47.zip libvfio-user-e899af8f842c9ba2d48fb44b507e90187f2fab47.tar.gz libvfio-user-e899af8f842c9ba2d48fb44b507e90187f2fab47.tar.bz2 |
Misc fixes for DMA_MAP region prot (#233)
* Misc fixes for DMA_MAP region prot
1. Validate prot passed in vfu_addr_to_sg()
2. Let user know region prot via vfu_unmap_dma_cb_t
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'include/libvfio-user.h')
-rw-r--r-- | include/libvfio-user.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/libvfio-user.h b/include/libvfio-user.h index d7d54a7..80a45b3 100644 --- a/include/libvfio-user.h +++ b/include/libvfio-user.h @@ -280,9 +280,10 @@ vfu_setup_device_reset_cb(vfu_ctx_t *vfu_ctx, vfu_reset_cb_t *reset); * @vfu_ctx: the libvfio-user context * @iova: iova address * @len: length + * @prot: memory protection used to map region as defined in <sys/mman.h> */ typedef void (vfu_map_dma_cb_t)(vfu_ctx_t *vfu_ctx, - uint64_t iova, uint64_t len); + uint64_t iova, uint64_t len, uint32_t prot); /* * Function that is called when the guest unmaps a DMA region. The device @@ -456,13 +457,14 @@ vfu_irq_message(vfu_ctx_t *vfu_ctx, uint32_t subindex); * @len: size of memory to be mapped * @sg: array that receives the scatter/gather entries to be mapped * @max_sg: maximum number of elements in above array - * @prot: protection as define in <sys/mman.h> + * @prot: protection as defined in <sys/mman.h> * * @returns the number of scatter/gather entries created on success, and on * failure: - * -1: if the GPA address span is invalid, or + * -1: if the GPA address span is invalid (errno=0) or + * protection violation (errno=EACCES) * (-x - 1): if @max_sg is too small, where x is the number of scatter/gather - * entries necessary to complete this request. + * entries necessary to complete this request (errno=0). */ int vfu_addr_to_sg(vfu_ctx_t *vfu_ctx, dma_addr_t dma_addr, uint32_t len, |