[PATCH v3 03/15] iommu: Always register bus notifiers
Tian, Kevin
kevin.tian at intel.com
Wed Jul 6 23:31:31 PDT 2022
> From: Robin Murphy <robin.murphy at arm.com>
> Sent: Wednesday, July 6, 2022 1:08 AM
>
> The number of bus types that the IOMMU subsystem deals with is small and
> manageable, so pull that list into core code as a first step towards
> cleaning up all the boilerplate bus-awareness from drivers. Calling
> iommu_probe_device() before bus->iommu_ops is set will simply return
> -ENODEV and not break the notifier call chain, so there should be no
> harm in proactively registering all our bus notifiers at init time.
>
Suppose we miss a check on iommu ops in iommu_release_device():
if (!dev->iommu) <<<<<<<
return;
iommu_device_unlink(dev->iommu->iommu_dev, dev);
ops = dev_iommu_ops(dev);
ops->release_device(dev);
following the rationale in patch01 a device could be removed when
it's associated with a known but not registered instance.
More information about the linux-arm-kernel
mailing list