[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251107010349.GD1708009@nvidia.com>
Date: Thu, 6 Nov 2025 21:03:49 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Wei Wang <wei.w.wang@...mail.com>
Cc: alex@...zbot.org, suravee.suthikulpanit@....com,
thomas.lendacky@....com, joro@...tes.org, kevin.tian@...el.com,
linux-kernel@...r.kernel.org, iommu@...ts.linux.dev
Subject: Re: [PATCH v2 2/2] vfio/type1: Set IOMMU_MMIO in dma->prot for
MMIO-backed addresses
On Mon, Nov 03, 2025 at 10:00:34PM +0800, Wei Wang wrote:
> Before requesting the IOMMU driver to map an IOVA to a physical address,
> set the IOMMU_MMIO flag in dma->prot when the physical address corresponds
> to MMIO. This allows the IOMMU driver to handle MMIO mappings specially.
> For example, on AMD CPUs with SME enabled, the AMD IOMMU driver avoids
> setting the C-bit if iommu_map() is called with IOMMU_MMIO set in prot.
> This prevents issues with PCIe P2P communication, since current PCIe
> switches and devices do not interpret the C-bit correctly.
>
> Signed-off-by: Wei Wang <wei.w.wang@...mail.com>
> ---
> drivers/vfio/vfio_iommu_type1.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
This may be the best you can do with vfio type1, but just because the
VMA is special doesn't necessarily mean it is MMIO, nor does it mean
it is decrypted memory.
I think to really make this work fully properly going forward people
are going to have to use iommufd's dmabuf.
Jason
Powered by blists - more mailing lists