@@ -1557,6 +1557,8 @@ static int vfio_dma_do_map(struct vfio_iommu *iommu,
prot |= IOMMU_WRITE;
if (map->flags & VFIO_DMA_MAP_FLAG_READ)
prot |= IOMMU_READ;
+ if (map->flags & VFIO_DMA_MAP_FLAG_MMIO)
+ prot |= IOMMU_MMIO;
if ((prot && set_vaddr) || (!prot && !set_vaddr))
return -EINVAL;
@@ -2801,7 +2803,7 @@ static int vfio_iommu_type1_map_dma(struct vfio_iommu *iommu,
struct vfio_iommu_type1_dma_map map;
unsigned long minsz;
uint32_t mask = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE |
- VFIO_DMA_MAP_FLAG_VADDR;
+ VFIO_DMA_MAP_FLAG_VADDR | VFIO_DMA_MAP_FLAG_MMIO;
minsz = offsetofend(struct vfio_iommu_type1_dma_map, size);
Refer to commit: 31e6850e0fdb iommu: Add MMIO mapping type (Robin Murphy), IOMMU needs to know the type of mapping to setup IOMMU page table, if the mapping is for device MMIO region, on some platforms, IOMMU page table entry attrs should be different versus regular memory. Signed-off-by: Wencheng Yang <east.moutain.yang@gmail.com> --- drivers/vfio/vfio_iommu_type1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)