[PATCH v2 3/3] iommu/mediatek: Add MT8188 IOMMU Support

Chengci.Xu chengci.xu at mediatek.com
Thu Sep 8 02:57:19 PDT 2022


On Fri, 2022-09-02 at 11:04 +0200, AngeloGioacchino Del Regno wrote:
> Il 31/08/22 14:55, Chengci.Xu ha scritto:
> > MT8188 has 3 IOMMU, containing 2 MM IOMMUs, one is for vdo, the
> > other
> > is for vpp. and 1 INFRA IOMMU.
> > 
> > Signed-off-by: Chengci.Xu <chengci.xu at mediatek.com>
> > ---
> >   drivers/iommu/mtk_iommu.c | 48
> > +++++++++++++++++++++++++++++++++++++++
> >   1 file changed, 48 insertions(+)
> > 
> > diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
> > index 6fe780783ec8..98c2eae5229e 100644
> > --- a/drivers/iommu/mtk_iommu.c
> > +++ b/drivers/iommu/mtk_iommu.c
> > @@ -164,6 +164,7 @@ enum mtk_iommu_plat {
> >   	M4U_MT8173,
> >   	M4U_MT8183,
> >   	M4U_MT8186,
> > +	M4U_MT8188,
> >   	M4U_MT8192,
> >   	M4U_MT8195,
> >   };
> > @@ -1479,6 +1480,50 @@ static const struct mtk_iommu_plat_data
> > mt8186_data_mm = {
> >   	.iova_region_nr = ARRAY_SIZE(mt8192_multi_dom),
> >   };
> >   
> > +static const struct mtk_iommu_plat_data mt8188_data_infra = {
> > +	.m4u_plat	  = M4U_MT8188,
> > +	.flags            = WR_THROT_EN | DCM_DISABLE | STD_AXI_MODE |
> > PM_CLK_AO |
> > +			    MTK_IOMMU_TYPE_INFRA |
> > IFA_IOMMU_PCIE_SUPPORT |
> > +			    CFG_IFA_MASTER_IN_ATF,
> > +	.pericfg_comp_str = "mediatek,mt8188-pericfg_ao",
> 
> pericfg_comp_str is used only for IOMMU enable from Linux, but MT8188
> enables it
> with a SMC command, so this is unused.
> 
> Please drop it.

Thanks for your review.

Yes. For MT8188, pericfg_comp_str is unused and should be dropped.
But deleting it simply will lead to INFRA IOMMU probe fail because
following code flow.

	line 1236:
		p = data->plat_data->pericfg_comp_str;
		data->pericfg = syscon_regmap_lookup_by_compatible(p);
		if (IS_ERR(data->pericfg)) {
			ret = PTR_ERR(data->pericfg);
			goto out_runtime_disable;
		}

So we will update probe flow(patch 2/3) and then drop it(patch 3/3) in
the next version. 

> 
> > +	.inv_sel_reg      = REG_MMU_INV_SEL_GEN2,
> > +	.banks_num	  = 1,
> > +	.banks_enable     = {true},
> > +	.iova_region      = single_domain,
> > +	.iova_region_nr   = ARRAY_SIZE(single_domain),
> > +};
> > +
> 
> Regards,
> Angelo
> 
> 




More information about the linux-arm-kernel mailing list