[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211115132442.GA2379906@nvidia.com>
Date: Mon, 15 Nov 2021 09:24:42 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: Lu Baolu <baolu.lu@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Joerg Roedel <joro@...tes.org>,
Alex Williamson <alex.williamson@...hat.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Kevin Tian <kevin.tian@...el.com>,
Ashok Raj <ashok.raj@...el.com>,
Chaitanya Kulkarni <kch@...dia.com>, kvm@...r.kernel.org,
rafael@...nel.org, linux-pci@...r.kernel.org,
Cornelia Huck <cohuck@...hat.com>,
linux-kernel@...r.kernel.org, iommu@...ts.linux-foundation.org,
Jacob jun Pan <jacob.jun.pan@...el.com>,
Diana Craciun <diana.craciun@....nxp.com>,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH 02/11] driver core: Set DMA ownership during driver
bind/unbind
On Mon, Nov 15, 2021 at 05:19:02AM -0800, Christoph Hellwig wrote:
> On Mon, Nov 15, 2021 at 10:05:43AM +0800, Lu Baolu wrote:
> > @@ -566,6 +567,12 @@ static int really_probe(struct device *dev, struct device_driver *drv)
> > goto done;
> > }
> >
> > + if (!drv->suppress_auto_claim_dma_owner) {
> > + ret = iommu_device_set_dma_owner(dev, DMA_OWNER_KERNEL, NULL);
> > + if (ret)
> > + return ret;
> > + }
>
> I'd expect this to go into iommu_setup_dma_ops (and its arm and s390
> equivalents), as that is what claims an IOMMU for in-kernel usage
If iommu_device_set_dma_owner(dev_a) fails changes dynamically
depending on what iommu_device_set_dma_owner(dev_b, DMA_OWNER_USER)
have been done.
The whole point here is that doing a
iommu_device_set_dma_owner(dev_b, DMA_OWNER_USER)
needs to revoke kernel usage from a whole bunch of other devices in
the same group.
revoking kernel usage means it needs to ensure that no driver is bound
and prevent future drivers from being bound.
iommu_setup_dma_ops() is something done once early on in boot, not at
every driver probe, so I don't see how it can help??
Jason
Powered by blists - more mailing lists