Messages in this thread | | | Subject | Re: [RESEND PATCH v8 04/11] bus: platform, amba, fsl-mc, PCI: Add device DMA ownership management | From | Zenghui Yu <> | Date | Thu, 29 Jun 2023 10:55:19 +0800 |
| |
On 2023/6/28 22:36, Jason Gunthorpe wrote: > On Mon, Jun 26, 2023 at 09:02:40PM +0800, Zenghui Yu wrote: > >> It looks like on device probe, with DEBUG_TEST_DRIVER_REMOVE, >> .dma_configure() will be executed *twice* via the >> really_probe()/re_probe path, and *no* .dma_cleanup() will be executed. >> The resulting dev::iommu_group::owner_cnt is 2, which will confuse the >> later iommu_group_dma_owner_claimed() call from VFIO on guest startup. > > Does this work for you?
It works. Please feel free to add my Tested-by if you send it as a formal patch. Thanks.
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c > index 9c09ca5c4ab68e..7145d9b940b14b 100644 > --- a/drivers/base/dd.c > +++ b/drivers/base/dd.c > @@ -693,6 +693,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) > > device_remove(dev); > driver_sysfs_remove(dev); > + if (dev->bus && dev->bus->dma_cleanup) > + dev->bus->dma_cleanup(dev); > device_unbind_cleanup(dev); > > goto re_probe;
| |