Re: [PATCH 02/11] driver core: Set DMA ownership during driver bind/unbind

2021-11-15 Thread Jason Gunthorpe via iommu
On Mon, Nov 15, 2021 at 06:35:37PM +, Robin Murphy wrote: > On 2021-11-15 15:56, Jason Gunthorpe via iommu wrote: > > On Mon, Nov 15, 2021 at 03:37:18PM +, Robin Murphy wrote: > > > > > IOMMUs, and possibly even fewer of them support VFIO, so I'm in full > > > agreement with Greg and

Re: [PATCH 02/11] driver core: Set DMA ownership during driver bind/unbind

2021-11-15 Thread Robin Murphy
On 2021-11-15 15:56, Jason Gunthorpe via iommu wrote: On Mon, Nov 15, 2021 at 03:37:18PM +, Robin Murphy wrote: IOMMUs, and possibly even fewer of them support VFIO, so I'm in full agreement with Greg and Christoph that this absolutely warrants being scoped per-bus. I mean, we literally

Re: [PATCH 02/11] driver core: Set DMA ownership during driver bind/unbind

2021-11-15 Thread Christoph Hellwig
On Mon, Nov 15, 2021 at 11:56:13AM -0400, Jason Gunthorpe wrote: > drivers/base/platform.c:.dma_configure = platform_dma_configure, > drivers/bus/fsl-mc/fsl-mc-bus.c:.dma_configure = > fsl_mc_dma_configure, > drivers/pci/pci-driver.c: .dma_configure = pci_dma_configure, >

Re: [PATCH 02/11] driver core: Set DMA ownership during driver bind/unbind

2021-11-15 Thread Jason Gunthorpe via iommu
On Mon, Nov 15, 2021 at 03:37:18PM +, Robin Murphy wrote: > IOMMUs, and possibly even fewer of them support VFIO, so I'm in full > agreement with Greg and Christoph that this absolutely warrants being scoped > per-bus. I mean, we literally already have infrastructure to prevent drivers >

Re: [PATCH 02/11] driver core: Set DMA ownership during driver bind/unbind

2021-11-15 Thread Robin Murphy
On 2021-11-15 13:24, Jason Gunthorpe via iommu wrote: 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

Re: [PATCH 02/11] driver core: Set DMA ownership during driver bind/unbind

2021-11-15 Thread Jason Gunthorpe via iommu
On Mon, Nov 15, 2021 at 07:59:10AM +0100, Greg Kroah-Hartman 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 =

Re: [PATCH 02/11] driver core: Set DMA ownership during driver bind/unbind

2021-11-15 Thread Jason Gunthorpe via iommu
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

Re: [PATCH 02/11] driver core: Set DMA ownership during driver bind/unbind

2021-11-15 Thread Christoph Hellwig
On Mon, Nov 15, 2021 at 07:59:10AM +0100, Greg Kroah-Hartman wrote: > This feels wrong to be doing it in the driver core, why doesn't the bus > that cares about this handle it instead? > > You just caused all drivers in the kernel today to set and release this > ownership, as none set this flag.

Re: [PATCH 02/11] driver core: Set DMA ownership during driver bind/unbind

2021-11-15 Thread Christoph Hellwig
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 =

Re: [PATCH 02/11] driver core: Set DMA ownership during driver bind/unbind

2021-11-14 Thread Greg Kroah-Hartman
On Mon, Nov 15, 2021 at 10:05:43AM +0800, Lu Baolu wrote: > This extends really_probe() to allow checking for dma ownership conflict > during the driver binding process. By default, the DMA_OWNER_KERNEL is > claimed for the bound driver before calling its .probe() callback. If this > operation