On 2022/7/6 01:08, Robin Murphy wrote:
@@ -202,12 +210,32 @@ int iommu_device_register(struct iommu_device *iommu, spin_lock(&iommu_device_lock); list_add_tail(&iommu->list, &iommu_device_list); spin_unlock(&iommu_device_lock); + + for (int i = 0; i < ARRAY_SIZE(iommu_buses); i++) { + struct bus_type *bus = iommu_buses[i]; + int err; + + if (bus->iommu_ops && bus->iommu_ops != ops) { + err = -EBUSY; + } else { + bus->iommu_ops = ops; + err = bus_iommu_probe(bus); + } + if (err) { + iommu_device_unregister(iommu); + return err; + } + } + return 0; } EXPORT_SYMBOL_GPL(iommu_device_register);
With bus_set_iommu() retired, my understanding is that now we embrace the first-come-first-serve policy for bus->iommu_ops setting. This will lead to problem in different iommu_ops for different bus case. Did I overlook anything? Best regards, baolu