Re: [PATCH v9 2/7] iommu/mediatek: Fix two IOMMU share pagetable issue

From: AngeloGioacchino Del Regno
Date: Fri Mar 17 2023 - 05:34:12 EST


Il 17/03/23 09:55, Yong Wu ha scritto:
From: "Chengci.Xu" <chengci.xu@xxxxxxxxxxxx>

Prepare for mt8188 to fix a two IOMMU HWs share pagetable issue.

We have two MM IOMMU HWs in mt8188, one is VPP-IOMMU, another is VDO-IOMMU.
The 2 MM IOMMU HWs share pagetable don't work in this case:
a) VPP-IOMMU probe firstly.
b) VDO-IOMMU probe.
c) The master for VDO-IOMMU probe (means frstdata is vpp-iommu).
d) The master in another domain probe. No matter it is vdo or vpp.
Then it still create a new pagetable in step d). The problem is
"frstdata->bank[0]->m4u_dom" was not initialized. Then when d) enter, it
still create a new one.

In this patch, we create a new variable "share_dom" for this share
pgtable case, it should be helpful for readable. and put all the share
pgtable logic in the mtk_iommu_domain_finalise.

In mt8195, the master of VPP-IOMMU probes before than VDO-IOMMU
from its dtsi node sequence, we don't see this issue in it. Prepare for
mt8188.

Signed-off-by: Chengci.Xu <chengci.xu@xxxxxxxxxxxx>
Signed-off-by: Yong Wu <yong.wu@xxxxxxxxxxxx>

I'm not sure whether this is *not* a fix... if a specific platform wasn't
affected, this may still be a logic mistake... to be cautious, I would
still add a Fixes tag to this one.

Otherwise, I would reword the commit title and remove the "Fix" word, so
that it would look something like...

iommu/mediatek: Prepare for pagetables domain sharing

I'm sorry for noticing that only at v9, but the previous versions had a bit
more stuff to address and couldn't really focus on analyzing this one.

If there's anything I've misunderstood about this patch, please feel free
to explain.

Regards,
Angelo