[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240826071641.2691374-5-manojvishy@google.com>
Date: Mon, 26 Aug 2024 07:16:41 +0000
From: Manoj Vishwanathan <manojvishy@...gle.com>
To: Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
Joerg Roedel <joro@...tes.org>, Alex Williamson <alex.williamson@...hat.com>,
linux-arm-kernel@...ts.infradead.org
Cc: kvm@...r.kernel.org, iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
David Dillow <dillow@...gle.com>, Manoj Vishwanathan <manojvishy@...gle.com>
Subject: [PATCH v1 4/4] vfio/type1: Add support for VFIO_DMA_MAP_FLAG_SYS_CACHE
Introducing the VFIO_DMA_MAP_FLAG_SYS_CACHE flag to control
whether mapped DMA regions are cached in the system cache.
Signed-off-by: Manoj Vishwanathan <manojvishy@...gle.com>
---
drivers/vfio/vfio_iommu_type1.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 0960699e7554..c84bb6c8b12f 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -1562,7 +1562,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_SYS_CACHE)
+ prot |= IOMMU_SYS_CACHE;
if ((prot && set_vaddr) || (!prot && !set_vaddr))
return -EINVAL;
@@ -2815,7 +2816,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_SYS_CACHE | VFIO_DMA_MAP_FLAG_VADDR;
minsz = offsetofend(struct vfio_iommu_type1_dma_map, size);
--
2.46.0.295.g3b9ea8a38a-goog
Powered by blists - more mailing lists