The flag is mandatory for the ARM SMMU, add it.
When VFIO will be able to tell about the IOMMU being used, we will add
it only if necessary.

Signed-off-by: Alvise Rigo <a.r...@virtualopensystems.com>
---
 hw/vfio/common.c           | 3 +++
 linux-headers/linux/vfio.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 9d1f723..f4c1fec 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -107,6 +107,9 @@ static int vfio_dma_map(VFIOContainer *container, hwaddr 
iova,
         map.flags |= VFIO_DMA_MAP_FLAG_WRITE;
     }
 
+    /* add exec flag */
+    map.flags |= VFIO_DMA_MAP_FLAG_WRITE;
+
     /*
      * Try the mapping, if it fails with EBUSY, unmap the region and try
      * again.  This shouldn't be necessary, but we sometimes see it in
diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h
index 17c58e0..e0b404e 100644
--- a/linux-headers/linux/vfio.h
+++ b/linux-headers/linux/vfio.h
@@ -392,6 +392,7 @@ struct vfio_iommu_type1_dma_map {
        __u32   flags;
 #define VFIO_DMA_MAP_FLAG_READ (1 << 0)                /* readable from device 
*/
 #define VFIO_DMA_MAP_FLAG_WRITE (1 << 1)       /* writable from device */
+#define VFIO_DMA_MAP_FLAG_EXEC (1 << 2)        /* executable from device */
        __u64   vaddr;                          /* Process virtual address */
        __u64   iova;                           /* IO virtual address */
        __u64   size;                           /* Size of mapping (bytes) */
-- 
1.8.3.2


Reply via email to