RE: [PATCH 08/11] iommu: Always destroy the iommu_group during iommu_release_device()

Tian, Kevin
2023-04-26T09:43:14Z

> From: Jason Gunthorpe <jgg@nvidia.com>
> Sent: Thursday, April 20, 2023 12:12 AM
>
> Have release fully clean up the iommu related parts of the struct device,
> no matter what state they are in.
>
> POWER creates iommu_groups without drivers attached, and the next patch
> removes the open-coding of this same cleanup from POWER.
>
> Split the logic so that the three things owned by the iommu core are
> always cleaned up:
> - Any attached iommu_group
> - Any allocated dev->iommu, eg for fwsepc
> - Any attached driver via a struct group_device
>
> This fixes a bug where a fwspec created without an iommu_group being
> probed would not be freed.
>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>