[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250121112836.525046-2-east.moutain.yang@gmail.com>
Date: Tue, 21 Jan 2025 19:28:35 +0800
From: Wencheng Yang <east.moutain.yang@...il.com>
To: east.moutain.yang@...il.com,
alex.williamson@...hat.com,
jgg@...pe.ca
Cc: iommu@...ts.linux.dev,
joro@...tes.org,
kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
robin.murphy@....com,
suravee.suthikulpanit@....com,
will@...nel.org
Subject: [PATCH v3 2/3] vfio/vfio_iommu_type1:convert VFIO_DMA_MAP_FLAG_MMIO to IOMMU_MMIO flag
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@...il.com>
---
drivers/vfio/vfio_iommu_type1.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 50ebc9593c9d..08be1ef8514b 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -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);
--
2.43.0
Powered by blists - more mailing lists