Skip to contentSkip to conversation

MediaTek Dimensity 1200 - Add IOMMU support

PATCH Applied AngeloGioacchino Del Regno 4 participants 10 messages Apr 10, 2025 – May 21, 2025

Subsystems (5)
lore
Share & tools
lore

AngeloGioacchino Del Regno

author maintainer
#0 lore raw

cover MediaTek Dimensity 1200 - Add IOMMU support

In preparation for adding basic support for the OnePlus Nord 2 5G DN2103 smartphone, this series adds support for the IOMMU found in the MediaTek Dimensity 1200 (MT6893) SoC.

AngeloGioacchino Del Regno (2):
dt-bindings: iommu: mediatek: Add binding for MT6893 MM IOMMU iommu/mediatek: Add support for Dimensity 1200 MT6893 MM IOMMU

 .../bindings/iommu/mediatek,iommu.yaml        |   4 +
 drivers/iommu/mtk_iommu.c                     |  37 ++-
 .../memory/mediatek,mt6893-memory-port.h      | 288 ++++++++++++++++++
 3 files changed, 318 insertions(+), 11 deletions(-)
 create mode 100644 include/dt-bindings/memory/mediatek,mt6893-memory-port.h
Signature · 1 line
2.49.0
author maintainer
#1 lore raw

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

Add binding for the MediaTek Dimensity 1200 (MT6893) SoC's MultiMedia (MM) IOMMU.

---
 .../bindings/iommu/mediatek,iommu.yaml        |   4 +
 .../memory/mediatek,mt6893-memory-port.h      | 288 ++++++++++++++++++
 2 files changed, 292 insertions(+)
 create mode 100644 include/dt-bindings/memory/mediatek,mt6893-memory-port.h
Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml +4 -0
index ea6b0f5f24de..75750c64157c 100644
@@ -74,6 +74,7 @@ properties:
           - mediatek,mt2712-m4u  # generation two
           - mediatek,mt6779-m4u  # generation two
           - mediatek,mt6795-m4u  # generation two
+          - mediatek,mt6893-iommu-mm         # generation two
           - mediatek,mt8167-m4u  # generation two
           - mediatek,mt8173-m4u  # generation two
           - mediatek,mt8183-m4u  # generation two
@@ -131,6 +132,7 @@ properties:
       dt-binding/memory/mt2712-larb-port.h for mt2712,
       dt-binding/memory/mt6779-larb-port.h for mt6779,
       dt-binding/memory/mt6795-larb-port.h for mt6795,
+      dt-binding/memory/mediatek,mt6893-memory-port.h for mt6893,
       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,
@@ -157,6 +159,7 @@ allOf:
               - mediatek,mt2701-m4u
               - mediatek,mt2712-m4u
               - mediatek,mt6795-m4u
+              - mediatek,mt6893-iommu-mm
               - mediatek,mt8173-m4u
               - mediatek,mt8186-iommu-mm
               - mediatek,mt8188-iommu-vdo
@@ -173,6 +176,7 @@ allOf:
       properties:
         compatible:
           enum:
+            - mediatek,mt6893-iommu-mm
             - mediatek,mt8186-iommu-mm
             - mediatek,mt8188-iommu-vdo
             - mediatek,mt8188-iommu-vpp
include/dt-bindings/memory/mediatek,mt6893-memory-port.h new file +288 -0

288 lines not on this page · raw message

Signature · 1 line
2.49.0
maintainer Acked-by on v1 1/2
#2 lore raw

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

Quoted 2 lines · AngeloGioacchino Del Regno

Add binding for the MediaTek Dimensity 1200 (MT6893) SoC's MultiMedia (MM) IOMMU.

You can drop 'binding for ' in the subject. No need to say 'binding' twice.

Quoted 7 lines
---
 .../bindings/iommu/mediatek,iommu.yaml        |   4 +
 .../memory/mediatek,mt6893-memory-port.h      | 288 ++++++++++++++++++
 2 files changed, 292 insertions(+)
 create mode 100644 include/dt-bindings/memory/mediatek,mt6893-memory-port.h
author maintainer
#3 lore raw

PATCH 2/2 iommu/mediatek: Add support for Dimensity 1200 MT6893 MM IOMMU

In reply to AngeloGioacchino Del Regno

Add support for the two MM IOMMUs found in the MediaTek Dimensity 1200 (MT6893) SoC, used for display, camera, imgsys and vpu.

Since the MT6893 SoC is almost fully compatible with MT8192, also move the mt8192_larb_region_msk before the newly introduced mt6893 platform data, as the larb regions from mt8192 are fully reused.

Note that the only difference with MT8192 is that MT6893 needs the SHARE_PGTABLE flag.

---
 drivers/iommu/mtk_iommu.c | 37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)
drivers/iommu/mtk_iommu.c +26 -11
index df98d0c65f54..0a54c6521bf5 100644
@@ -1550,6 +1550,31 @@ static const struct mtk_iommu_plat_data mt6795_data = {
 	.larbid_remap = {{0}, {1}, {2}, {3}, {4}}, /* Linear mapping. */
 };
 
+static const unsigned int mt8192_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = {
+	[0] = {~0, ~0},				/* Region0: larb0/1 */
+	[1] = {0, 0, 0, 0, ~0, ~0, 0, ~0},	/* Region1: larb4/5/7 */
+	[2] = {0, 0, ~0, 0, 0, 0, 0, 0,		/* Region2: larb2/9/11/13/14/16/17/18/19/20 */
+	       0, ~0, 0, ~0, 0, ~(u32)(BIT(9) | BIT(10)), ~(u32)(BIT(4) | BIT(5)), 0,
+	       ~0, ~0, ~0, ~0, ~0},
+	[3] = {0},
+	[4] = {[13] = BIT(9) | BIT(10)},	/* larb13 port9/10 */
+	[5] = {[14] = BIT(4) | BIT(5)},		/* larb14 port4/5 */
+};
+
+static const struct mtk_iommu_plat_data mt6893_data = {
+	.m4u_plat     = M4U_MT8192,
+	.flags        = HAS_BCLK | OUT_ORDER_WR_EN | HAS_SUB_COMM_2BITS |
+			WR_THROT_EN | IOVA_34_EN | SHARE_PGTABLE | MTK_IOMMU_TYPE_MM,
+	.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),
+	.iova_region_larb_msk = mt8192_larb_region_msk,
+	.larbid_remap    = {{0}, {1}, {4, 5}, {7}, {2}, {9, 11, 19, 20},
+			    {0, 14, 16}, {0, 13, 18, 17}},
+};
+
 static const struct mtk_iommu_plat_data mt8167_data = {
 	.m4u_plat     = M4U_MT8167,
 	.flags        = RESET_AXI | HAS_LEGACY_IVRP_PADDR | MTK_IOMMU_TYPE_MM,
@@ -1673,17 +1698,6 @@ static const struct mtk_iommu_plat_data mt8188_data_vpp = {
 			   27, 28 /* ccu0 */, MTK_INVALID_LARBID}, {4, 6}},
 };
 
-static const unsigned int mt8192_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = {
-	[0] = {~0, ~0},				/* Region0: larb0/1 */
-	[1] = {0, 0, 0, 0, ~0, ~0, 0, ~0},	/* Region1: larb4/5/7 */
-	[2] = {0, 0, ~0, 0, 0, 0, 0, 0,		/* Region2: larb2/9/11/13/14/16/17/18/19/20 */
-	       0, ~0, 0, ~0, 0, ~(u32)(BIT(9) | BIT(10)), ~(u32)(BIT(4) | BIT(5)), 0,
-	       ~0, ~0, ~0, ~0, ~0},
-	[3] = {0},
-	[4] = {[13] = BIT(9) | BIT(10)},	/* larb13 port9/10 */
-	[5] = {[14] = BIT(4) | BIT(5)},		/* larb14 port4/5 */
-};
-
 static const struct mtk_iommu_plat_data mt8192_data = {
 	.m4u_plat       = M4U_MT8192,
 	.flags          = HAS_BCLK | HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN |
@@ -1777,6 +1791,7 @@ static const struct of_device_id mtk_iommu_of_ids[] = {
 	{ .compatible = "mediatek,mt2712-m4u", .data = &mt2712_data},
 	{ .compatible = "mediatek,mt6779-m4u", .data = &mt6779_data},
 	{ .compatible = "mediatek,mt6795-m4u", .data = &mt6795_data},
+	{ .compatible = "mediatek.mt6893-iommu-mm", .data = &mt6893_data},
 	{ .compatible = "mediatek,mt8167-m4u", .data = &mt8167_data},
 	{ .compatible = "mediatek,mt8173-m4u", .data = &mt8173_data},
 	{ .compatible = "mediatek,mt8183-m4u", .data = &mt8183_data},
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH v1 2/2] iommu/mediatek: Add support for Dimensity 1200 MT6893 MM IOMMU

Quoted 8 lines · AngeloGioacchino Del Regno

Add support for the two MM IOMMUs found in the MediaTek Dimensity 1200 (MT6893) SoC, used for display, camera, imgsys and vpu.

Since the MT6893 SoC is almost fully compatible with MT8192, also move the mt8192_larb_region_msk before the newly introduced mt6893 platform data, as the larb regions from mt8192 are fully reused.

Quoted 5 lines

Note that the only difference with MT8192 is that MT6893 needs the SHARE_PGTABLE flag.

Signed-off-by: AngeloGioacchino Del Regno <
[email protected]>

maintainer
#5 lore raw

Re: [PATCH v1 2/2] iommu/mediatek: Add support for Dimensity 1200 MT6893 MM IOMMU

In reply to AngeloGioacchino Del Regno
Quoted 70 lines · AngeloGioacchino Del Regno

Add support for the two MM IOMMUs found in the MediaTek Dimensity 1200 (MT6893) SoC, used for display, camera, imgsys and vpu.

Since the MT6893 SoC is almost fully compatible with MT8192, also move the mt8192_larb_region_msk before the newly introduced mt6893 platform data, as the larb regions from mt8192 are fully reused.

Note that the only difference with MT8192 is that MT6893 needs the SHARE_PGTABLE flag.

---
 drivers/iommu/mtk_iommu.c | 37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)
drivers/iommu/mtk_iommu.c +25 -11
index df98d0c65f54..0a54c6521bf5 100644
@@ -1550,6 +1550,31 @@ static const struct mtk_iommu_plat_data mt6795_data = {
 	.larbid_remap = {{0}, {1}, {2}, {3}, {4}}, /* Linear mapping. */
 };
 
+static const unsigned int mt8192_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = {
+	[0] = {~0, ~0},				/* Region0: larb0/1 */
+	[1] = {0, 0, 0, 0, ~0, ~0, 0, ~0},	/* Region1: larb4/5/7 */
+	[2] = {0, 0, ~0, 0, 0, 0, 0, 0,		/* Region2: larb2/9/11/13/14/16/17/18/19/20 */
+	       0, ~0, 0, ~0, 0, ~(u32)(BIT(9) | BIT(10)), ~(u32)(BIT(4) | BIT(5)), 0,
+	       ~0, ~0, ~0, ~0, ~0},
+	[3] = {0},
+	[4] = {[13] = BIT(9) | BIT(10)},	/* larb13 port9/10 */
+	[5] = {[14] = BIT(4) | BIT(5)},		/* larb14 port4/5 */
+};
+
+static const struct mtk_iommu_plat_data mt6893_data = {
+	.m4u_plat     = M4U_MT8192,
+	.flags        = HAS_BCLK | OUT_ORDER_WR_EN | HAS_SUB_COMM_2BITS |
+			WR_THROT_EN | IOVA_34_EN | SHARE_PGTABLE | MTK_IOMMU_TYPE_MM,
+	.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),
+	.iova_region_larb_msk = mt8192_larb_region_msk,
+	.larbid_remap    = {{0}, {1}, {4, 5}, {7}, {2}, {9, 11, 19, 20},
+			    {0, 14, 16}, {0, 13, 18, 17}},
+};
+
 static const struct mtk_iommu_plat_data mt8167_data = {
 	.m4u_plat     = M4U_MT8167,
 	.flags        = RESET_AXI | HAS_LEGACY_IVRP_PADDR | MTK_IOMMU_TYPE_MM,
@@ -1673,17 +1698,6 @@ static const struct mtk_iommu_plat_data mt8188_data_vpp = {
 			   27, 28 /* ccu0 */, MTK_INVALID_LARBID}, {4, 6}},
 };
 
-static const unsigned int mt8192_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = {
-	[0] = {~0, ~0},				/* Region0: larb0/1 */
-	[1] = {0, 0, 0, 0, ~0, ~0, 0, ~0},	/* Region1: larb4/5/7 */
-	[2] = {0, 0, ~0, 0, 0, 0, 0, 0,		/* Region2: larb2/9/11/13/14/16/17/18/19/20 */
-	       0, ~0, 0, ~0, 0, ~(u32)(BIT(9) | BIT(10)), ~(u32)(BIT(4) | BIT(5)), 0,
-	       ~0, ~0, ~0, ~0, ~0},
-	[3] = {0},
-	[4] = {[13] = BIT(9) | BIT(10)},	/* larb13 port9/10 */
-	[5] = {[14] = BIT(4) | BIT(5)},		/* larb14 port4/5 */
-};
-
 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 1794

Quoted 4 lines
drivers/iommu/mtk_iommu.c +1 -0
@@ -1777,6 +1791,7 @@ static const struct of_device_id mtk_iommu_of_ids[] = {
 	{ .compatible = "mediatek,mt2712-m4u", .data = &mt2712_data},
 	{ .compatible = "mediatek,mt6779-m4u", .data = &mt6779_data},
 	{ .compatible = "mediatek,mt6795-m4u", .data = &mt6795_data},
+	{ .compatible = "mediatek.mt6893-iommu-mm", .data = &mt6893_data},

Are you going to fix the typo> ^

It is still warning with 'make dt_compatible_check' that it is undocumented.

Rob

maintainer Applied
#6 lore raw
In reply to AngeloGioacchino Del Regno
Quoted 8 lines · AngeloGioacchino Del Regno

In preparation for adding basic support for the OnePlus Nord 2 5G DN2103 smartphone, this series adds support for the IOMMU found in the MediaTek Dimensity 1200 (MT6893) SoC.

AngeloGioacchino Del Regno (2):
dt-bindings: iommu: mediatek: Add binding for MT6893 MM IOMMU iommu/mediatek: Add support for Dimensity 1200 MT6893 MM IOMMU

Quoted 5 lines
 .../bindings/iommu/mediatek,iommu.yaml        |   4 +
 drivers/iommu/mtk_iommu.c                     |  37 ++-
 .../memory/mediatek,mt6893-memory-port.h      | 288 ++++++++++++++++++
 3 files changed, 318 insertions(+), 11 deletions(-)
 create mode 100644 include/dt-bindings/memory/mediatek,mt6893-memory-port.h

Applied, thanks.

maintainer
#7 lore raw
Quoted 9 lines · Joerg Roedel
Quoted 8 lines · AngeloGioacchino Del Regno

In preparation for adding basic support for the OnePlus Nord 2 5G DN2103 smartphone, this series adds support for the IOMMU found in the MediaTek Dimensity 1200 (MT6893) SoC.

AngeloGioacchino Del Regno (2):
dt-bindings: iommu: mediatek: Add binding for MT6893 MM IOMMU iommu/mediatek: Add support for Dimensity 1200 MT6893 MM IOMMU

Quoted 7 lines
Quoted 5 lines
 .../bindings/iommu/mediatek,iommu.yaml        |   4 +
 drivers/iommu/mtk_iommu.c                     |  37 ++-
 .../memory/mediatek,mt6893-memory-port.h      | 288 ++++++++++++++++++
 3 files changed, 318 insertions(+), 11 deletions(-)
 create mode 100644 include/dt-bindings/memory/mediatek,mt6893-memory-port.h

Applied, thanks.

It looks like you missed the binding change for this.

Rob

maintainer
#8 lore raw
Quoted 17 lines · Rob Herring
Quoted 15 lines · Joerg Roedel
Quoted 13 lines · AngeloGioacchino Del Regno

In preparation for adding basic support for the OnePlus Nord 2 5G DN2103 smartphone, this series adds support for the IOMMU found in the MediaTek Dimensity 1200 (MT6893) SoC.

AngeloGioacchino Del Regno (2):
dt-bindings: iommu: mediatek: Add binding for MT6893 MM IOMMU iommu/mediatek: Add support for Dimensity 1200 MT6893 MM IOMMU

 .../bindings/iommu/mediatek,iommu.yaml        |   4 +
 drivers/iommu/mtk_iommu.c                     |  37 ++-
 .../memory/mediatek,mt6893-memory-port.h      | 288 ++++++++++++++++++
 3 files changed, 318 insertions(+), 11 deletions(-)
 create mode 100644 include/dt-bindings/memory/mediatek,mt6893-memory-port.h
Quoted 3 lines
Quoted 1 line

Applied, thanks.

It looks like you missed the binding change for this.

Actually, upon closer look, the driver's compatible string has a typo. The period should be a comma.

Rob

maintainer
#9 lore raw
In reply to Rob Herring

Hi Rob,

Quoted 1 line · Rob Herring

It looks like you missed the binding change for this.

Both patches from this series are in the tree now. Is something from another series needed? In any case, if fixes are needed, please send them on-top of this patch-set.

Regards,

Joerg