Re: [PATCH] iommu/dart: Clear sid2group entry when a group is freed
From: Marc Zyngier
Date: Fri Sep 24 2021 - 09:57:33 EST
On Fri, 24 Sep 2021 14:45:02 +0100,
Sven Peter <sven@xxxxxxxxxxxxx> wrote:
>
> sid2groups keeps track of which stream id combinations belong to a
> iommu_group to assign those correctly to devices.
> When a iommu_group is freed a stale pointer will however remain in
> sid2groups. This prevents devices with the same stream id combination
> to ever be attached again (see below).
> Fix that by creating a shadow copy of the stream id configuration
> when a group is allocated for the first time and clear the sid2group
> entry when that group is freed.
>
> # echo 1 >/sys/bus/pci/devices/0000\:03\:00.0/remove
> pci 0000:03:00.0: Removing from iommu group 1
> # echo 1 >/sys/bus/pci/rescan
> [...]
> pci 0000:03:00.0: BAR 0: assigned [mem 0x6a0000000-0x6a000ffff 64bit pref]
> pci 0000:03:00.0: BAR 2: assigned [mem 0x6a0010000-0x6a001ffff 64bit pref]
> pci 0000:03:00.0: BAR 6: assigned [mem 0x6c0100000-0x6c01007ff pref]
> tg3 0000:03:00.0: Failed to add to iommu group 1: -2
> [...]
>
> Fixes: 46d1fb072e76b161 ("iommu/dart: Add DART iommu driver")
> Reported-by: Marc Zyngier <maz@xxxxxxxxxx>
> Signed-off-by: Sven Peter <sven@xxxxxxxxxxxxx>
Thanks for posting this.
Tested-by: Marc Zyngier <maz@xxxxxxxxxx>
M.
--
Without deviation from the norm, progress is not possible.