Skip to contentSkip to conversation

MT8186 IOMMU SUPPORT

PATCH Superseded Yong Wu 4 participants 10 messages Jan 25, 2022 – Feb 18, 2022

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Yong Wu

author maintainer
#0 lore raw

cover MT8186 IOMMU SUPPORT

This patchset adds mt8186 iommu support.

Base on v5.16-rc1 and mt8195 iommu v4[1].

[1] https://lore.kernel.org/linux-mediatek/[email protected]/

Yong Wu (2):
dt-bindings: mediatek: mt8186: Add binding for MM iommu iommu/mediatek: Add mt8186 iommu support

 .../bindings/iommu/mediatek,iommu.yaml        |   4 +
 drivers/iommu/mtk_iommu.c                     |  17 ++
 .../dt-bindings/memory/mt8186-memory-port.h   | 217 ++++++++++++++++++
 3 files changed, 238 insertions(+)
 create mode 100644 include/dt-bindings/memory/mt8186-memory-port.h
Signature · 7 lines
2.18.0


_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
author maintainer
#1 lore raw

PATCH 1/2 dt-bindings: mediatek: mt8186: Add binding for MM iommu

Add mt8186 iommu binding. "-mm" means the iommu is for Multimedia.

---
 .../bindings/iommu/mediatek,iommu.yaml        |   4 +
 .../dt-bindings/memory/mt8186-memory-port.h   | 217 ++++++++++++++++++
 2 files changed, 221 insertions(+)
 create mode 100644 include/dt-bindings/memory/mt8186-memory-port.h
Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml +4 -0
index c528a299afa9..6cc886eb55af 100644
@@ -76,6 +76,7 @@ properties:
           - mediatek,mt8167-m4u  # generation two
           - mediatek,mt8173-m4u  # generation two
           - mediatek,mt8183-m4u  # generation two
+          - mediatek,mt8186-iommu-mm # generation two
           - mediatek,mt8192-m4u  # generation two
           - mediatek,mt8195-iommu-vdo        # generation two
           - mediatek,mt8195-iommu-vpp        # generation two
@@ -120,6 +121,7 @@ properties:
       dt-binding/memory/mt8167-larb-port.h for mt8167,
       dt-binding/memory/mt8173-larb-port.h for mt8173,
       dt-binding/memory/mt8183-larb-port.h for mt8183,
+      dt-binding/memory/mt8186-memory-port.h for mt8186,
       dt-binding/memory/mt8192-larb-port.h for mt8192.
       dt-binding/memory/mt8195-memory-port.h for mt8195.
 
@@ -141,6 +143,7 @@ allOf:
               - mediatek,mt2701-m4u
               - mediatek,mt2712-m4u
               - mediatek,mt8173-m4u
+              - mediatek,mt8186-iommu-mm
               - mediatek,mt8192-m4u
               - mediatek,mt8195-iommu-vdo
               - mediatek,mt8195-iommu-vpp
@@ -153,6 +156,7 @@ allOf:
       properties:
         compatible:
           enum:
+            - mediatek,mt8186-iommu-mm
             - mediatek,mt8192-m4u
             - mediatek,mt8195-iommu-vdo
             - mediatek,mt8195-iommu-vpp
include/dt-bindings/memory/mt8186-memory-port.h new file +217 -0

217 lines not on this page · raw message

Signature · 6 lines
2.18.0

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] dt-bindings: mediatek: mt8186: Add binding for MM iommu

Quoted 9 lines · Yong Wu

Add mt8186 iommu binding. "-mm" means the iommu is for Multimedia.

---
 .../bindings/iommu/mediatek,iommu.yaml        |   4 +
 .../dt-bindings/memory/mt8186-memory-port.h   | 217 ++++++++++++++++++
 2 files changed, 221 insertions(+)
 create mode 100644 include/dt-bindings/memory/mt8186-memory-port.h

Best regards,
Krzysztof
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

maintainer Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] dt-bindings: mediatek: mt8186: Add binding for MM iommu

In reply to Yong Wu
Quoted 9 lines · Yong Wu

Add mt8186 iommu binding. "-mm" means the iommu is for Multimedia.

---
 .../bindings/iommu/mediatek,iommu.yaml        |   4 +
 .../dt-bindings/memory/mt8186-memory-port.h   | 217 ++++++++++++++++++
 2 files changed, 221 insertions(+)
 create mode 100644 include/dt-bindings/memory/mt8186-memory-port.h

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

author maintainer
#4 lore raw

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

In reply to Yong Wu

Add mt8186 iommu supports.

---
 drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/iommu/mtk_iommu.c +17 -0
index be36e73e4bcc..a3124f48f9e1 100644
@@ -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},
Signature · 6 lines
2.18.0

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#5 lore raw

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

Il 25/01/22 10:32, Yong Wu ha scritto:

Quoted 43 lines

Add mt8186 iommu supports.

---
  drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++
  1 file changed, 17 insertions(+)
drivers/iommu/mtk_iommu.c +16 -0
index be36e73e4bcc..a3124f48f9e1 100644
@@ -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 |

drivers/iommu/mtk_iommu.c static const struct of_device_id mtk_iommu_of_ids[] = { · line 1489

Quoted 4 lines
drivers/iommu/mtk_iommu.c +1 -0
@@ -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

drivers/iommu/mtk_iommu.c static const struct of_device_id mtk_iommu_of_ids[] = { · line 1492

Quoted 4 lines
drivers/iommu/mtk_iommu.c +0 -0
  	{ .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},

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

author maintainer
#6 lore raw

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

Quoted 8 lines · AngeloGioacchino Del Regno

Il 25/01/22 10:32, Yong Wu ha scritto:

Quoted 7 lines

Add mt8186 iommu supports.

---
  drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++
  1 file changed, 17 insertions(+)

[snip]

Quoted 14 lines

drivers/iommu/mtk_iommu.c static const struct of_device_id · line 1491

Quoted 11 lines

static const struct mtk_iommu_plat_data mt8192_data = {
.m4u_plat = M4U_MT8192,
.flags = HAS_BCLK | HAS_SUB_COMM_2BITS |
OUT_ORDER_WR_EN |

drivers/iommu/mtk_iommu.c +1 -0
@@ -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!

Quoted 2 lines

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".

Quoted 14 lines

Thanks,
Angelo

Quoted 5 lines
drivers/iommu/mtk_iommu.c +0 -0
  	{ .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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#7 lore raw

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

Il 28/01/22 10:39, Yong Wu ha scritto:

Quoted 26 lines · AngeloGioacchino Del Regno
Quoted 8 lines

Il 25/01/22 10:32, Yong Wu ha scritto:

Quoted 7 lines

Add mt8186 iommu supports.

---
   drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++
   1 file changed, 17 insertions(+)

[snip]

Quoted 14 lines

drivers/iommu/mtk_iommu.c static const struct of_device_id · line 1491

Quoted 11 lines
   static const struct mtk_iommu_plat_data mt8192_data = {
   	.m4u_plat       = M4U_MT8192,
   	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS |

OUT_ORDER_WR_EN |

drivers/iommu/mtk_iommu.c +1 -0
@@ -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!

Quoted 9 lines
Quoted 2 lines

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!

Quoted 10 lines
Quoted 10 lines

Thanks,
Angelo

Quoted 5 lines
drivers/iommu/mtk_iommu.c +0 -0
   	{ .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},

Quoted 5 lines
Quoted 4 lines

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

author maintainer
#8 lore raw

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

Quoted 43 lines · AngeloGioacchino Del Regno

Il 28/01/22 10:39, Yong Wu ha scritto:

Quoted 33 lines
Quoted 8 lines · AngeloGioacchino Del Regno

Il 25/01/22 10:32, Yong Wu ha scritto:

Quoted 7 lines

Add mt8186 iommu supports.

---
   drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++
   1 file changed, 17 insertions(+)

[snip]

Quoted 17 lines
Quoted 13 lines
   static const struct mtk_iommu_plat_data mt8192_data = {
   	.m4u_plat       = M4U_MT8192,
   	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS |

OUT_ORDER_WR_EN |

(quoted diff) +0 -0
@@ -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},

(quoted diff) +1 -0
+	{ .compatible = "mediatek,mt8186-iommu-mm", .data =
Quoted 1 line

&mt8186_data_mm},

Hello!

Quoted 2 lines

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

Quoted 8 lines

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".

Quoted 4 lines

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.

Quoted 19 lines

Thank you!

Quoted 15 lines
Quoted 15 lines

Thanks,
Angelo

Quoted 6 lines
   	{ .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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

#9 lore raw

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

Il 18/02/22 04:32, Yong Wu ha scritto:

Quoted 49 lines · AngeloGioacchino Del Regno
Quoted 43 lines

Il 28/01/22 10:39, Yong Wu ha scritto:

Quoted 33 lines
Quoted 8 lines · AngeloGioacchino Del Regno

Il 25/01/22 10:32, Yong Wu ha scritto:

Quoted 7 lines

Add mt8186 iommu supports.

---
    drivers/iommu/mtk_iommu.c | 17 +++++++++++++++++
    1 file changed, 17 insertions(+)

[snip]

Quoted 17 lines
Quoted 13 lines
    static const struct mtk_iommu_plat_data mt8192_data = {
    	.m4u_plat       = M4U_MT8192,
    	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS |

OUT_ORDER_WR_EN |

(quoted diff) +0 -0
@@ -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},

(quoted diff) +1 -0
+	{ .compatible = "mediatek,mt8186-iommu-mm", .data =
Quoted 1 line

&mt8186_data_mm},

Hello!

Quoted 2 lines

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

Quoted 8 lines

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".

Quoted 4 lines

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.

Quoted 8 lines

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

Quoted 20 lines
Quoted 19 lines

Thank you!

Quoted 15 lines
Quoted 15 lines

Thanks,
Angelo

Quoted 6 lines
    	{ .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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek