[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <BN9PR11MB5276E6194ACDC16D1240DD438CAEA@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Fri, 12 Dec 2025 07:26:47 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: Wei Wang <wei.w.wang@...mail.com>, "alex@...zbot.org" <alex@...zbot.org>,
"thomas.lendacky@....com" <thomas.lendacky@....com>, "vasant.hegde@....com"
<vasant.hegde@....com>, "suravee.suthikulpanit@....com"
<suravee.suthikulpanit@....com>, "joro@...tes.org" <joro@...tes.org>,
"aik@....com" <aik@....com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "iommu@...ts.linux.dev"
<iommu@...ts.linux.dev>
Subject: RE: [PATCH v3 2/2] vfio/type1: Set IOMMU_MMIO in dma->prot for
MMIO-backed addresses
> From: Jason Gunthorpe <jgg@...dia.com>
> Sent: Friday, December 12, 2025 3:00 PM
>
> On Fri, Dec 12, 2025 at 02:36:46AM +0000, Tian, Kevin wrote:
> > > From: Wei Wang <wei.w.wang@...mail.com>
> > > 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@...el.com>
> >
> > 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?
>
> I don't think we should do that, userspace shouldn't be able to create
> a mapping inconsistent with the rest of the kernel for security
> reasons.
ah that's a good point!
>
> I think if we ever need a cachable mmio through to the iommu then it
> should be wired through the dmabuf mechanism the same way vfio drivers
> wire the cachability when they make the mmap.
>
> The nvgrace is the only driver that creates a cachable mmap already,
> and it would be more correct to have a cachable IOPTE, but the only HW
> tha driver works with does not care either way so it has been left.
>
> Jason
Powered by blists - more mailing lists