[PATCH 02/13] iommu: Move bus setup to IOMMU device registration

Krishna Reddy vdumpa at nvidia.com
Fri Apr 22 11:37:08 PDT 2022


Good effort to isolate bus config from smmu drivers.
Reviewed-By: Krishna Reddy <vdumpa at nvidia.com>

I have an orthogonal question here.
Can the following code handle the case, where different buses have different type of SMMU instances(like one bus has SMMUv2 and another bus has SMMUv3)?
If it need to handle the above case, can the smmu device bus be matched with specific bus here and ops set only for that bus? 


> +       for (int i = 0; i < ARRAY_SIZE(iommu_buses); i++) {
> +               struct bus_type *bus = iommu_buses[i];
> +               const struct iommu_ops *bus_ops = bus->iommu_ops;
> +               int err;
> +
> +               WARN_ON(bus_ops && bus_ops != ops);
> +               bus->iommu_ops = ops;
> +               err = bus_iommu_probe(bus);
> +               if (err) {
> +                       bus_for_each_dev(bus, NULL, iommu,
> remove_iommu_group);
> +                       bus->iommu_ops = bus_ops;
> +                       return err;
> +               }
> +       }


-KR



More information about the linux-arm-kernel mailing list