Re: [PATCH] iommu/dart: Fix apple_dart_device_group for PCI groups

From: Joerg Roedel
Date: Fri Feb 03 2023 - 04:56:28 EST


On Sat, Jan 28, 2023 at 12:35:32PM +0100, Sven Peter wrote:
> pci_device_group() can return an already existing IOMMU group if the PCI
> device's pagetables have to be shared with another one due to bus
> toplogy, isolation features and/or DMA alias quirks.
> apple_dart_device_group() however assumes that the group has just been
> created and overwrites its iommudata which will eventually lead to
> apple_dart_release_group leaving stale entries in sid2group.
> Fix that by merging the iommudata if the returned group already exists.
>
> Fixes: f0b636804c7c ("iommu/dart: Clear sid2group entry when a group is freed")
> Signed-off-by: Sven Peter <sven@xxxxxxxxxxxxx>
> ---
> drivers/iommu/apple-dart.c | 51 ++++++++++++++++++++++++++++++++------
> 1 file changed, 44 insertions(+), 7 deletions(-)

Applied, thanks.