Re: [PATCH v5 2/2] PCI: imx6: Add IOMMU and ITS MSI support for i.MX95

From: Manivannan Sadhasivam
Date: Tue Nov 19 2024 - 04:17:24 EST


On Wed, Nov 13, 2024 at 01:09:57PM -0500, Frank Li wrote:

[...]

> > > + for (i = 0; i < IMX95_MAX_LUT; i++) {
> > > + regmap_write(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_ACSCTRL, IMX95_PEO_LUT_RWA | i);
> > > + regmap_read(imx_pcie->iomuxc_gpr, IMX95_PE0_LUT_DATA1, &data1);
> > > +
> > > + if (!(data1 & IMX95_PE0_LUT_VLD)) {
> > > + if (free < 0)
> > > + free = i;
> >
> > So you don't increment 'free' once it becomes >=0? Why can't you use the loop
> > iterator 'i' itself instead of 'free'?
>
> It is used to find first free slot. This loop check if there are duplicated
> entry. If no duplicated rid entry, then use first free slot.
>

Ah, so you have combined both in one loop. A comment on top would've been
helpful to understand the logic.

[...]

> > > + if (!err_i)
> > > + return imx_pcie_add_lut(imx_pcie, rid, sid_i);
> > > + else if (!err_m)
> > > + /* Hardware auto add 2 bit controller id ahead of stream ID */
> >
> > What is this comment for? I don't find it relevant here.
>
> The comment for why need mask 2bits before config lut. for example, dts
> set stream id is 0xC4, but lut only need 0x4.
>

Ok. It was not super clear. Could you please reword it as below?

"LUT only needs the lower 6 bits of the SID as it will prepend the 2 bit
controller ID by default."

- Mani

--
மணிவண்ணன் சதாசிவம்