diff mbox series

[v3,1/3] uapi/linux/vfio:Add VFIO_DMA_MAP_FLAG_MMIO flag

Message ID 20250121112836.525046-1-east.moutain.yang@gmail.com (mailing list archive)
State New
Headers show
Series [v3,1/3] uapi/linux/vfio:Add VFIO_DMA_MAP_FLAG_MMIO flag | expand

Commit Message

Wencheng Yang Jan. 21, 2025, 11:28 a.m. UTC
The flag will be used by VFIO to map DMA for device MMIO on IOMMU page table.

Signed-off-by: Wencheng Yang <east.moutain.yang@gmail.com>
---
 include/uapi/linux/vfio.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Jason Gunthorpe Jan. 21, 2025, 2:05 p.m. UTC | #1
On Tue, Jan 21, 2025 at 07:28:34PM +0800, Wencheng Yang wrote:
> The flag will be used by VFIO to map DMA for device MMIO on IOMMU page table.

Definitely not, the kernel needs to know and protect the memory type
itself. Userspace cannot be allowed to override things

Jason
diff mbox series

Patch

diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index c8dbf8219c4f..68002c8f1157 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -1560,6 +1560,7 @@  struct vfio_iommu_type1_dma_map {
 #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_VADDR (1 << 2)
+#define VFIO_DMA_MAP_FLAG_MMIO (1 << 3)     /* map of mmio */
 	__u64	vaddr;				/* Process virtual address */
 	__u64	iova;				/* IO virtual address */
 	__u64	size;				/* Size of mapping (bytes) */