[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c453353f-6fe7-df66-91ee-5b6a36e7d84b@huawei.com>
Date: Thu, 29 Jun 2023 10:55:19 +0800
From: Zenghui Yu <yuzenghui@...wei.com>
To: Jason Gunthorpe <jgg@...dia.com>
CC: Lu Baolu <baolu.lu@...ux.intel.com>,
Joerg Roedel <joro@...tes.org>,
Kevin Tian <kevin.tian@...el.com>,
<linux-kernel@...r.kernel.org>, <iommu@...ts.linux.dev>
Subject: Re: [RESEND PATCH v8 04/11] bus: platform, amba, fsl-mc, PCI: Add
device DMA ownership management
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;
Powered by blists - more mailing lists