[PATCH 2/2] iommu/mediatek: Add mt8186 iommu support

Yong Wu posted 2 patches 2 years, 9 months ago
There is a newer version of this series
[PATCH 2/2] iommu/mediatek: Add mt8186 iommu support
Posted by Yong Wu 2 years, 9 months ago
Add mt8186 iommu supports.

Signed-off-by: Anan Sun <anan.sun@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
---
 drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index be36e73e4bcc..a3124f48f9e1 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -160,6 +160,7 @@ enum mtk_iommu_plat {
 	M4U_MT8167,
 	M4U_MT8173,
 	M4U_MT8183,
+	M4U_MT8186,
 	M4U_MT8192,
 	M4U_MT8195,
 };
@@ -1401,6 +1402,21 @@ static const struct mtk_iommu_plat_data mt8183_data = {
 	.larbid_remap = {{0}, {4}, {5}, {6}, {7}, {2}, {3}, {1}},
 };
 
+static const struct mtk_iommu_plat_data mt8186_data_mm = {
+	.m4u_plat       = M4U_MT8186,
+	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN |
+			  WR_THROT_EN | IOVA_34_EN | NOT_STD_AXI_MODE |
+			  MTK_IOMMU_TYPE_MM,
+	.larbid_remap   = {{0}, {1, MTK_INVALID_LARBID, 8}, {4}, {7}, {2}, {9, 11, 19, 20},
+			   {MTK_INVALID_LARBID, 14, 16},
+			   {MTK_INVALID_LARBID, 13, MTK_INVALID_LARBID, 17}},
+	.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),
+};
+
 static const struct mtk_iommu_plat_data mt8192_data = {
 	.m4u_plat       = M4U_MT8192,
 	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN |
@@ -1470,6 +1486,7 @@ static const struct of_device_id mtk_iommu_of_ids[] = {
 	{ .compatible = "mediatek,mt8167-m4u", .data = &mt8167_data},
 	{ .compatible = "mediatek,mt8173-m4u", .data = &mt8173_data},
 	{ .compatible = "mediatek,mt8183-m4u", .data = &mt8183_data},
+	{ .compatible = "mediatek,mt8186-iommu-mm", .data = &mt8186_data_mm},
 	{ .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},
-- 
2.18.0

Re: [PATCH 2/2] iommu/mediatek: Add mt8186 iommu support
Posted by AngeloGioacchino Del Regno 2 years, 9 months ago
Il 25/01/22 10:32, Yong Wu ha scritto:
> Add mt8186 iommu supports.
> 
> Signed-off-by: Anan Sun <anan.sun@mediatek.com>
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> ---
>   drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
> index be36e73e4bcc..a3124f48f9e1 100644
> --- a/drivers/iommu/mtk_iommu.c
> +++ b/drivers/iommu/mtk_iommu.c
> @@ -160,6 +160,7 @@ enum mtk_iommu_plat {
>   	M4U_MT8167,
>   	M4U_MT8173,
>   	M4U_MT8183,
> +	M4U_MT8186,
>   	M4U_MT8192,
>   	M4U_MT8195,
>   };
> @@ -1401,6 +1402,21 @@ static const struct mtk_iommu_plat_data mt8183_data = {
>   	.larbid_remap = {{0}, {4}, {5}, {6}, {7}, {2}, {3}, {1}},
>   };
>   
> +static const struct mtk_iommu_plat_data mt8186_data_mm = {
> +	.m4u_plat       = M4U_MT8186,
> +	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN |
> +			  WR_THROT_EN | IOVA_34_EN | NOT_STD_AXI_MODE |
> +			  MTK_IOMMU_TYPE_MM,
> +	.larbid_remap   = {{0}, {1, MTK_INVALID_LARBID, 8}, {4}, {7}, {2}, {9, 11, 19, 20},
> +			   {MTK_INVALID_LARBID, 14, 16},
> +			   {MTK_INVALID_LARBID, 13, MTK_INVALID_LARBID, 17}},
> +	.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),
> +};
> +
>   static const struct mtk_iommu_plat_data mt8192_data = {
>   	.m4u_plat       = M4U_MT8192,
>   	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN |
> @@ -1470,6 +1486,7 @@ static const struct of_device_id mtk_iommu_of_ids[] = {
>   	{ .compatible = "mediatek,mt8167-m4u", .data = &mt8167_data},
>   	{ .compatible = "mediatek,mt8173-m4u", .data = &mt8173_data},
>   	{ .compatible = "mediatek,mt8183-m4u", .data = &mt8183_data},
> +	{ .compatible = "mediatek,mt8186-iommu-mm", .data = &mt8186_data_mm},

Hello!

Is there any particular reason why this compatible is not "mediatek,mt8186-m4u"?

Thanks,
Angelo

>   	{ .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},
> 

Re: [PATCH 2/2] iommu/mediatek: Add mt8186 iommu support
Posted by Yong Wu 2 years, 9 months ago
On Thu, 2022-01-27 at 12:28 +0100, AngeloGioacchino Del Regno wrote:
> Il 25/01/22 10:32, Yong Wu ha scritto:
> > Add mt8186 iommu supports.
> > 
> > Signed-off-by: Anan Sun <anan.sun@mediatek.com>
> > Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> > ---
> >   drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++
> >   1 file changed, 17 insertions(+)

[snip]

> >   static const struct mtk_iommu_plat_data mt8192_data = {
> >   	.m4u_plat       = M4U_MT8192,
> >   	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS |
> > OUT_ORDER_WR_EN |
> > @@ -1470,6 +1486,7 @@ static const struct of_device_id
> > mtk_iommu_of_ids[] = {
> >   	{ .compatible = "mediatek,mt8167-m4u", .data = &mt8167_data},
> >   	{ .compatible = "mediatek,mt8173-m4u", .data = &mt8173_data},
> >   	{ .compatible = "mediatek,mt8183-m4u", .data = &mt8183_data},
> > +	{ .compatible = "mediatek,mt8186-iommu-mm", .data =
> > &mt8186_data_mm},
> 
> Hello!
> 
> Is there any particular reason why this compatible is not
> "mediatek,mt8186-m4u"?

There is no special reason. In the previous SoC, We only support MM
IOMMU, it was called by "m4u". In the lastest SoC, We have the other
types IOMMU, like for INFRA masters and APU, thus they are called "mm
iommu", "infra iommu" and "apu iommu". Of course, "m4u" means "mm
iommu".

> 
> Thanks,
> Angelo
> 
> >   	{ .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},
> 
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek

Re: [PATCH 2/2] iommu/mediatek: Add mt8186 iommu support
Posted by AngeloGioacchino Del Regno 2 years, 9 months ago
Il 28/01/22 10:39, Yong Wu ha scritto:
> On Thu, 2022-01-27 at 12:28 +0100, AngeloGioacchino Del Regno wrote:
>> Il 25/01/22 10:32, Yong Wu ha scritto:
>>> Add mt8186 iommu supports.
>>>
>>> Signed-off-by: Anan Sun <anan.sun@mediatek.com>
>>> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
>>> ---
>>>    drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++
>>>    1 file changed, 17 insertions(+)
> 
> [snip]
> 
>>>    static const struct mtk_iommu_plat_data mt8192_data = {
>>>    	.m4u_plat       = M4U_MT8192,
>>>    	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS |
>>> OUT_ORDER_WR_EN |
>>> @@ -1470,6 +1486,7 @@ static const struct of_device_id
>>> mtk_iommu_of_ids[] = {
>>>    	{ .compatible = "mediatek,mt8167-m4u", .data = &mt8167_data},
>>>    	{ .compatible = "mediatek,mt8173-m4u", .data = &mt8173_data},
>>>    	{ .compatible = "mediatek,mt8183-m4u", .data = &mt8183_data},
>>> +	{ .compatible = "mediatek,mt8186-iommu-mm", .data =
>>> &mt8186_data_mm},
>>
>> Hello!
>>
>> Is there any particular reason why this compatible is not
>> "mediatek,mt8186-m4u"?
> 
> There is no special reason. In the previous SoC, We only support MM
> IOMMU, it was called by "m4u". In the lastest SoC, We have the other
> types IOMMU, like for INFRA masters and APU, thus they are called "mm
> iommu", "infra iommu" and "apu iommu". Of course, "m4u" means "mm
> iommu".
> 

I suggest, at this point, to change it to "mediatek,mt8186-m4u" for naming
consistency with the other bindings and to avoid any kind of confusion.

Thank you!

>>
>> Thanks,
>> Angelo
>>
>>>    	{ .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},
>>
>> _______________________________________________
>> Linux-mediatek mailing list
>> Linux-mediatek@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-mediatek
> 

Re: [PATCH 2/2] iommu/mediatek: Add mt8186 iommu support
Posted by Yong Wu 2 years, 8 months ago
On Mon, 2022-01-31 at 10:25 +0100, AngeloGioacchino Del Regno wrote:
> Il 28/01/22 10:39, Yong Wu ha scritto:
> > On Thu, 2022-01-27 at 12:28 +0100, AngeloGioacchino Del Regno
> > wrote:
> > > Il 25/01/22 10:32, Yong Wu ha scritto:
> > > > Add mt8186 iommu supports.
> > > > 
> > > > Signed-off-by: Anan Sun <anan.sun@mediatek.com>
> > > > Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> > > > ---
> > > >    drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++
> > > >    1 file changed, 17 insertions(+)
> > 
> > [snip]
> > 
> > > >    static const struct mtk_iommu_plat_data mt8192_data = {
> > > >    	.m4u_plat       = M4U_MT8192,
> > > >    	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS |
> > > > OUT_ORDER_WR_EN |
> > > > @@ -1470,6 +1486,7 @@ static const struct of_device_id
> > > > mtk_iommu_of_ids[] = {
> > > >    	{ .compatible = "mediatek,mt8167-m4u", .data =
> > > > &mt8167_data},
> > > >    	{ .compatible = "mediatek,mt8173-m4u", .data =
> > > > &mt8173_data},
> > > >    	{ .compatible = "mediatek,mt8183-m4u", .data =
> > > > &mt8183_data},
> > > > +	{ .compatible = "mediatek,mt8186-iommu-mm", .data =
> > > > &mt8186_data_mm},
> > > 
> > > Hello!
> > > 
> > > Is there any particular reason why this compatible is not
> > > "mediatek,mt8186-m4u"?
> > 
> > There is no special reason. In the previous SoC, We only support MM
> > IOMMU, it was called by "m4u". In the lastest SoC, We have the
> > other
> > types IOMMU, like for INFRA masters and APU, thus they are called
> > "mm
> > iommu", "infra iommu" and "apu iommu". Of course, "m4u" means "mm
> > iommu".
> > 
> 
> I suggest, at this point, to change it to "mediatek,mt8186-m4u" for
> naming
> consistency with the other bindings and to avoid any kind of
> confusion.

Understand. But we don't call it "m4u" anymore. I'd not like to use a
outdated name. For readable, I could add a comment like this:

{ .compatible = "mediatek,mt8186-iommu-mm", xx}, /* iommu-mm: m4u */

Is this ok for you?
Thanks.

> Thank you!
> 
> > > 
> > > Thanks,
> > > Angelo
> > > 
> > > >    	{ .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},
> > > 
> > > _______________________________________________
> > > Linux-mediatek mailing list
> > > Linux-mediatek@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
> 
> 

Re: [PATCH 2/2] iommu/mediatek: Add mt8186 iommu support
Posted by AngeloGioacchino Del Regno 2 years, 8 months ago
Il 18/02/22 04:32, Yong Wu ha scritto:
> On Mon, 2022-01-31 at 10:25 +0100, AngeloGioacchino Del Regno wrote:
>> Il 28/01/22 10:39, Yong Wu ha scritto:
>>> On Thu, 2022-01-27 at 12:28 +0100, AngeloGioacchino Del Regno
>>> wrote:
>>>> Il 25/01/22 10:32, Yong Wu ha scritto:
>>>>> Add mt8186 iommu supports.
>>>>>
>>>>> Signed-off-by: Anan Sun <anan.sun@mediatek.com>
>>>>> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
>>>>> ---
>>>>>     drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++
>>>>>     1 file changed, 17 insertions(+)
>>>
>>> [snip]
>>>
>>>>>     static const struct mtk_iommu_plat_data mt8192_data = {
>>>>>     	.m4u_plat       = M4U_MT8192,
>>>>>     	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS |
>>>>> OUT_ORDER_WR_EN |
>>>>> @@ -1470,6 +1486,7 @@ static const struct of_device_id
>>>>> mtk_iommu_of_ids[] = {
>>>>>     	{ .compatible = "mediatek,mt8167-m4u", .data =
>>>>> &mt8167_data},
>>>>>     	{ .compatible = "mediatek,mt8173-m4u", .data =
>>>>> &mt8173_data},
>>>>>     	{ .compatible = "mediatek,mt8183-m4u", .data =
>>>>> &mt8183_data},
>>>>> +	{ .compatible = "mediatek,mt8186-iommu-mm", .data =
>>>>> &mt8186_data_mm},
>>>>
>>>> Hello!
>>>>
>>>> Is there any particular reason why this compatible is not
>>>> "mediatek,mt8186-m4u"?
>>>
>>> There is no special reason. In the previous SoC, We only support MM
>>> IOMMU, it was called by "m4u". In the lastest SoC, We have the
>>> other
>>> types IOMMU, like for INFRA masters and APU, thus they are called
>>> "mm
>>> iommu", "infra iommu" and "apu iommu". Of course, "m4u" means "mm
>>> iommu".
>>>
>>
>> I suggest, at this point, to change it to "mediatek,mt8186-m4u" for
>> naming
>> consistency with the other bindings and to avoid any kind of
>> confusion.
> 
> Understand. But we don't call it "m4u" anymore. I'd not like to use a
> outdated name. For readable, I could add a comment like this:
> 
> { .compatible = "mediatek,mt8186-iommu-mm", xx}, /* iommu-mm: m4u */
> 
> Is this ok for you?
> Thanks.
> 

Ok, go on with that.

Cheers,
Angelo

>> Thank you!
>>
>>>>
>>>> Thanks,
>>>> Angelo
>>>>
>>>>>     	{ .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},
>>>>
>>>> _______________________________________________
>>>> Linux-mediatek mailing list
>>>> Linux-mediatek@lists.infradead.org
>>>> http://lists.infradead.org/mailman/listinfo/linux-mediatek
>>
>>
>