[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220624184609.GX4147@nvidia.com>
Date: Fri, 24 Jun 2022 15:46:09 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Robin Murphy <robin.murphy@....com>
Cc: Nicolin Chen <nicolinc@...dia.com>,
"Tian, Kevin" <kevin.tian@...el.com>,
"joro@...tes.org" <joro@...tes.org>,
"will@...nel.org" <will@...nel.org>,
"marcan@...can.st" <marcan@...can.st>,
"sven@...npeter.dev" <sven@...npeter.dev>,
"robdclark@...il.com" <robdclark@...il.com>,
"baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"orsonzhai@...il.com" <orsonzhai@...il.com>,
"baolin.wang7@...il.com" <baolin.wang7@...il.com>,
"zhang.lyra@...il.com" <zhang.lyra@...il.com>,
"jean-philippe@...aro.org" <jean-philippe@...aro.org>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
"suravee.suthikulpanit@....com" <suravee.suthikulpanit@....com>,
"alyssa@...enzweig.io" <alyssa@...enzweig.io>,
"dwmw2@...radead.org" <dwmw2@...radead.org>,
"yong.wu@...iatek.com" <yong.wu@...iatek.com>,
"mjrosato@...ux.ibm.com" <mjrosato@...ux.ibm.com>,
"gerald.schaefer@...ux.ibm.com" <gerald.schaefer@...ux.ibm.com>,
"thierry.reding@...il.com" <thierry.reding@...il.com>,
"vdumpa@...dia.com" <vdumpa@...dia.com>,
"jonathanh@...dia.com" <jonathanh@...dia.com>,
"cohuck@...hat.com" <cohuck@...hat.com>,
"thunder.leizhen@...wei.com" <thunder.leizhen@...wei.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"christophe.jaillet@...adoo.fr" <christophe.jaillet@...adoo.fr>,
"john.garry@...wei.com" <john.garry@...wei.com>,
"chenxiang66@...ilicon.com" <chenxiang66@...ilicon.com>,
"saiprakash.ranjan@...eaurora.org" <saiprakash.ranjan@...eaurora.org>,
"isaacm@...eaurora.org" <isaacm@...eaurora.org>,
"yangyingliang@...wei.com" <yangyingliang@...wei.com>,
"jordan@...micpenguin.net" <jordan@...micpenguin.net>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-arm-msm@...r.kernel.org" <linux-arm-msm@...r.kernel.org>,
"linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
"linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>,
"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>,
"virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
Subject: Re: [PATCH v2 3/5] vfio/iommu_type1: Remove the domain->ops
comparison
On Fri, Jun 24, 2022 at 07:31:47PM +0100, Robin Murphy wrote:
> > > Oh, physical platforms with mixed IOMMUs definitely exist already. The main
> > > point is that while bus_set_iommu still exists, the core code effectively
> > > *does* prevent multiple drivers from registering - even in emulated cases
> > > like the example above, virtio-iommu and VT-d would both try to
> > > bus_set_iommu(&pci_bus_type), and one of them will lose. The aspect which
> > > might warrant clarification is that there's no combination of supported
> > > drivers which claim non-overlapping buses *and* could appear in the same
> > > system - even if you tried to contrive something by emulating, say, VT-d
> > > (PCI) alongside rockchip-iommu (platform), you could still only describe one
> > > or the other due to ACPI vs. Devicetree.
> >
> > Right, and that is still something we need to protect against with
> > this ops check. VFIO is not checking that the bus's are the same
> > before attempting to re-use a domain.
> >
> > So it is actually functional and does protect against systems with
> > multiple iommu drivers on different busses.
>
> But as above, which systems *are* those?
IDK it seems wrong that the system today will allow different buses to
have different IOMMU drivers and not provide a trivial protection
check.
> FWIW my iommu/bus dev branch has got as far as the final bus ops removal and
> allowing multiple driver registrations, and before it allows that, it does
> now have the common attach check that I sketched out in the previous
> discussion of this.
If you want to put the check in your series that seems fine too, as
long as we get it in the end.
> It's probably also noteworthy that domain->ops is no longer the same
> domain->ops that this code was written to check, and may now be different
> between domains from the same driver.
Yes, the vfio check is not good anymore.
Jason
Powered by blists - more mailing lists