mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yong Wu (吴勇)" <Yong.Wu@mediatek.com>
To: "robin.murphy@arm.com" <robin.murphy@arm.com>,
	"joro@8bytes.org" <joro@8bytes.org>,
	"will@kernel.org" <will@kernel.org>,
	"Chengci Xu (许承赐)" <Chengci.Xu@mediatek.com>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"krzysztof.kozlowski+dt@linaro.org"
	<krzysztof.kozlowski+dt@linaro.org>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	Project_Global_Chrome_Upstream_Group 
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"angelogioacchino.delregno@collabora.com" 
	<angelogioacchino.delregno@collabora.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v4 4/4] iommu/mediatek: Add MT8188 IOMMU Support
Date: Mon, 21 Nov 2022 05:17:37 +0000	[thread overview]
Message-ID: <5d902abfcac32e1f51f5c6929a03ba08de0db271.camel@mediatek.com> (raw)
In-Reply-To: <20221018064239.13391-5-chengci.xu@mediatek.com>

On Tue, 2022-10-18 at 14:42 +0800, Chengci.Xu wrote:
> 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@mediatek.com>
> Reviewed-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>
> ---
>  drivers/iommu/mtk_iommu.c | 47
> +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 47 insertions(+)
> 
> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
> index cb62cb89a2f4..3de8bb5d8404 100644
> --- a/drivers/iommu/mtk_iommu.c
> +++ b/drivers/iommu/mtk_iommu.c
> @@ -166,6 +166,7 @@ enum mtk_iommu_plat {
>  	M4U_MT8173,
>  	M4U_MT8183,
>  	M4U_MT8186,
> +	M4U_MT8188,
>  	M4U_MT8192,
>  	M4U_MT8195,
>  };
> @@ -1475,6 +1476,49 @@ 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,
> +	.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),
> +};
> +
> +static const struct mtk_iommu_plat_data mt8188_data_vdo = {
> +	.m4u_plat	= M4U_MT8188,
> +	.flags          = HAS_BCLK | HAS_SUB_COMM_3BITS |
> OUT_ORDER_WR_EN |
> +			  WR_THROT_EN | IOVA_34_EN | SHARE_PGTABLE |
> MTK_IOMMU_TYPE_MM,
> +	.hw_list        = &m4ulist,
> +	.inv_sel_reg    = REG_MMU_INV_SEL_GEN2,
> +	.banks_num      = 1,
> +	.banks_enable   = {true},
> +	.iova_region	= mt8192_multi_dom,
> +	.iova_region_nr	= ARRAY_SIZE(mt8192_multi_dom),
> +	.larbid_remap   = {{2}, {0}, {21}, {0}, {19}, {9, 10,
> +			   11 /* 11a */, 25 /* 11c */},
> +			   {13, 0, 29 /* 16b */, 30 /* 17b */, 0},
> {5}},
> +};
> +
> +static const struct mtk_iommu_plat_data mt8188_data_vpp = {
> +	.m4u_plat	= M4U_MT8188,
> +	.flags          = HAS_BCLK | HAS_SUB_COMM_3BITS |
> OUT_ORDER_WR_EN |
> +			  WR_THROT_EN | IOVA_34_EN | SHARE_PGTABLE |
> MTK_IOMMU_TYPE_MM,
> +	.hw_list        = &m4ulist,
> +	.inv_sel_reg    = REG_MMU_INV_SEL_GEN2,
> +	.banks_num      = 1,
> +	.banks_enable   = {true},
> +	.iova_region	= mt8192_multi_dom,
> +	.iova_region_nr	= ARRAY_SIZE(mt8192_multi_dom),
> +	.larbid_remap   = {{1}, {3}, {23}, {7}, {MTK_INVALID_LARBID},
> +			   {12, 15, 24 /* 11b */}, {14,
> MTK_INVALID_LARBID,
> +			   16 /* 16a */, 17 /* 17a */,
> MTK_INVALID_LARBID,
> +			   27, 28 /* ccu0 */, MTK_INVALID_LARBID}, {4,
> 6}},
> +};
> +

Add PGTABLE_PA_35_EN for them. Then,

Reviewed-by: Yong Wu <yong.wu@mediatek.com>

>  static const struct mtk_iommu_plat_data mt8192_data = {
>  	.m4u_plat       = M4U_MT8192,
>  	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS |
> OUT_ORDER_WR_EN |
> @@ -1543,6 +1587,9 @@ static const struct of_device_id
> mtk_iommu_of_ids[] = {
>  	{ .compatible = "mediatek,mt8173-m4u", .data = &mt8173_data},
>  	{ .compatible = "mediatek,mt8183-m4u", .data = &mt8183_data},
>  	{ .compatible = "mediatek,mt8186-iommu-mm",    .data =
> &mt8186_data_mm}, /* mm: m4u */
> +	{ .compatible = "mediatek,mt8188-iommu-infra", .data =
> &mt8188_data_infra},
> +	{ .compatible = "mediatek,mt8188-iommu-vdo",   .data =
> &mt8188_data_vdo},
> +	{ .compatible = "mediatek,mt8188-iommu-vpp",   .data =
> &mt8188_data_vpp},
>  	{ .compatible = "mediatek,mt8192-m4u", .data = &mt8192_data},
>  	{ .compatible = "mediatek,mt8195-iommu-infra", .data =
> &mt8195_data_infra},
>  	{ .compatible = "mediatek,mt8195-iommu-vdo",   .data =
> &mt8195_data_vdo},

  parent reply	other threads:[~2022-11-21  5:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221018064239.13391-1-chengci.xu@mediatek.com>
     [not found] ` <20221018064239.13391-2-chengci.xu@mediatek.com>
2022-11-21  5:17   ` [PATCH v4 1/4] dt-bindings: mediatek: mt8188: Add binding for MM & INFRA IOMMU Yong Wu (吴勇)
     [not found] ` <20221018064239.13391-5-chengci.xu@mediatek.com>
2022-11-21  5:17   ` Yong Wu (吴勇) [this message]
     [not found] ` <20221018064239.13391-4-chengci.xu@mediatek.com>
2022-11-21  5:17   ` [PATCH v4 3/4] iommu/mediatek: Add enable IOMMU SMC command for INFRA master Yong Wu (吴勇)
     [not found] ` <20221018064239.13391-3-chengci.xu@mediatek.com>
2022-11-21  5:17   ` [PATCH v4 2/4] iommu/mediatek: Adjust mtk_iommu_config flow Yong Wu (吴勇)
2022-11-21  6:37     ` Chengci Xu (许承赐)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5d902abfcac32e1f51f5c6929a03ba08de0db271.camel@mediatek.com \
    --to=yong.wu@mediatek.com \
    --cc=Chengci.Xu@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®