Re: [PATCH v5 02/14] driver core: Add dma_cleanup callback in bus_type

From: Lu Baolu
Date: Tue Feb 08 2022 - 00:56:51 EST


Hi Greg,

On 1/4/22 9:04 PM, Greg Kroah-Hartman wrote:
On Tue, Jan 04, 2022 at 08:39:11AM -0400, Jason Gunthorpe wrote:
On Tue, Jan 04, 2022 at 02:08:36AM -0800, Christoph Hellwig wrote:
All these bus callouts still looks horrible and just create tons of
boilerplate code.

Yes, Lu - Greg asked questions then didn't respond to their answers
meaning he accepts them, you should stick with the v4 version.

Trying to catch up on emails from the break, that was way down my list
of things to get back to as it's messy and non-obvious. I'll revisit it
again after 5.17-rc1 is out, this is too late for that merge window
anyway.

In this series we want to add calls into the iommu subsystem during
device driver binding/unbinding, so that the device DMA ownership
conflict (kernel driver vs. user-space) could be detected and avoided
before calling into device driver's .probe().

In this v5 series, we implemented this in the affected buses (amba/
platform/fsl-mc/pci) which are known to support assigning devices to
user space through the vfio framework currently. And more buses are
possible to be affected in the future if they also want to support
device assignment. Christoph commented that this will create boilerplate
code in various bus drivers.

Back to v4 of this series (please refer to below link [1]), we added
this call in the driver core if buses have provided the dma_configure()
callback (please refer to below link [2]).

Which would you prefer, or any other suggestions? We need your guide to
move this series ahead. Please help to suggest.

[1] https://lore.kernel.org/linux-iommu/20211217063708.1740334-1-baolu.lu@xxxxxxxxxxxxxxx/
[2] https://lore.kernel.org/linux-iommu/20211217063708.1740334-3-baolu.lu@xxxxxxxxxxxxxxx/

Best regards,
baolu