RE: [PATCH v3 2/2] vfio/type1: Set IOMMU_MMIO in dma->prot for MMIO-backed addresses
From: Tian, Kevin
Date: Thu Dec 11 2025 - 21:36:56 EST
> From: Wei Wang <wei.w.wang@xxxxxxxxxxx>
> Sent: Thursday, November 13, 2025 11:54 PM
>
> @@ -629,6 +630,8 @@ static long vaddr_get_pfns(struct mm_struct *mm,
> unsigned long vaddr,
> ret = -EFAULT;
> }
> }
> + if (vma->vm_flags & VM_IO)
> + *prot |= IOMMU_MMIO;
move into "if (is_invalid_reserved_pfn(*pfn)) {}". it's pointless to set
it in the error path.
Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
btw another alternative is letting userspace set a map flag explicitly
e.g. introducing a new VFIO_DMA_MAP_FLAG_MMIO flag bit. It's
not considered because your use case requires existing VMMs to
work?