Re: [PATCH v3 2/2] PCI: imx6: Add IOMMU and ITS MSI support for i.MX95
From: Manivannan Sadhasivam
Date: Sun Nov 03 2024 - 01:23:28 EST
On Sat, Nov 02, 2024 at 01:26:46PM -0400, Frank Li wrote:
[...]
> > > +
> > > + target = NULL;
> > > + err_i = of_map_id(dev->of_node, rid, "iommu-map", "iommu-map-mask", &target, &sid_i);
> > > + target = NULL;
> >
> > What is the point in passing 'target' here?
>
> See https://lore.kernel.org/imx/b479cad6-e0c5-48fb-bb8f-a70f7582cfd5@xxxxxxx/
> Marc Zyngier's comments:
>
> "Perhaps it is reasonable to assume that i.MX95 will never have SMMU/ITS
> mappings for low-numbered devices on bus 0, but in general this isn't
> very robust, and either way it's certainly not all that clear at first
> glance what assmuption is actually being made here. If it's significant
> whether a mapping actually exists or not for the given ID then you
> should really use the "target" argument of of_map_id() to determine that."
>
> See v4 https://lore.kernel.org/imx/20241101-imx95_lut-v4-2-0fdf9a2fe754@xxxxxxx/
>
Okay, thanks! I was confused by the fact that you never used 'target' in this
version. But v4 clears it up.
- Mani
> + target = NULL;
> + err_m = of_map_id(dev->of_node, rid, "msi-map", "msi-map-mask", &target, &sid_m);
> +
> + /*
> + * Return failure if msi-map exist and no entry for rid because dwc common
> + * driver will skip setting up built-in MSI controller if msi-map existed.
> + *
> + * err_m target
> + * 0 NULL Return failure, function not work.
> + * !0 NULL msi-map not exist, use built-in MSI.
> + * 0 !NULL Find one entry.
> + * !0 !NULL Invalidate case.
> + */
>
>
> >
> > > + err_m = of_map_id(dev->of_node, rid, "msi-map", "msi-map-mask", &target, &sid_m);
> > > +
> > > +
> > > + /*
> > > + * msi-map iommu-map
> > > + * Y Y ITS + SMMU, require the same sid
> > > + * Y N ITS
> > > + * N Y DWC MSI Ctrl + SMMU
> > > + * N N DWC MSI Ctrl
> > > + */
> > > + if (!err_i && !err_m)
> > > + if ((sid_i & IMX95_SID_MASK) != (sid_m & IMX95_SID_MASK)) {
> > > + dev_err(dev, "its and iommu stream id miss match, please check dts file\n");
> >
> > "iommu-map and msi-map entries mismatch!"
> >
> > - Mani
> >
> > --
> > மணிவண்ணன் சதாசிவம்
--
மணிவண்ணன் சதாசிவம்