2023-04-11 09:35:10

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 00/14] Adjust the dma-ranges for MTK IOMMU

After commit f1ad5338a4d5 ("of: Fix "dma-ranges" handling for bus
controllers"), the dma-ranges is not allowed for dts leaf node.
but we still would like to separate the different masters into
different iova regions. Thus we adjust the internal flow, separate
the 16GB iova range by the master HW larbid/portid and add the
dma-ranges property in the parent "soc" node. This also could avoid
the users forget/abuse the iova regions.

The commit f1ad5338a4d5 did affect the mt8195 venc, But it is not
a fatal issue, it could also work well at 0-4GB iova. thus I don't
add "Fixes:" tag.

In this series, I add functions for mt8192/mt8195/mt8186, mt8188 will
be in its special patchset. and the previous mt8173/mt8183...support
0-4GB only, no need this function.

Change note:
v7: Remove the change about mediatek,vcodec-subdev-decoder.yaml since
this was merged at:
https://lore.kernel.org/all/[email protected]/

v6: https://lore.kernel.org/linux-mediatek/[email protected]/
Add three patches for set dma-mask for iommu master devices.

v5: Nothing change. Just rebase on v6.3-rc1.

v4: https://lore.kernel.org/linux-mediatek/[email protected]/
Improve the comment in the code from AngeloGioacchino.

v3: https://lore.kernel.org/linux-mediatek/[email protected]/
Add a new patch only for comment more in the code.

v2: https://lore.kernel.org/linux-mediatek/[email protected]/
a) Base on next-20230206 since mt8195 jpeg node is applied which affect
this patch.
b) Reword the commit message [1/10][2/10] to explain effect.

v1: https://lore.kernel.org/linux-mediatek/[email protected]/
Base on v6.2-rc3.

Yong Wu (14):
dt-bindings: media: mediatek,vcodec: Remove dma-ranges property
dt-bindings: media: mediatek,jpeg: Remove dma-ranges property
iommu/mediatek: Improve comment for the current region/bank
iommu/mediatek: Get regionid from larb/port id
iommu/mediatek: mt8192: Add iova_region_larb_msk
iommu/mediatek: mt8195: Add iova_region_larb_msk
iommu/mediatek: mt8186: Add iova_region_larb_msk
iommu/mediatek: Add a gap for the iova regions
iommu/mediatek: Set dma_mask for the master devices
media: mtk-jpegdec: Remove the setting for dma_mask
media: mediatek: vcodec: Remove the setting for dma_mask
arm64: dts: mt8195: Remove the unnecessary dma-ranges
arm64: dts: mt8195: Add dma-ranges for the parent "soc" node
arm64: dts: mt8186: Add dma-ranges for the parent "soc" node

.../media/mediatek,mt8195-jpegdec.yaml | 7 -
.../media/mediatek,mt8195-jpegenc.yaml | 7 -
.../media/mediatek,vcodec-decoder.yaml | 5 -
.../media/mediatek,vcodec-encoder.yaml | 5 -
.../bindings/media/mediatek-jpeg-encoder.yaml | 5 -
arch/arm64/boot/dts/mediatek/mt8186.dtsi | 1 +
arch/arm64/boot/dts/mediatek/mt8195.dtsi | 4 +-
drivers/iommu/mtk_iommu.c | 145 ++++++++++++++----
.../platform/mediatek/jpeg/mtk_jpeg_core.c | 3 -
.../mediatek/vcodec/mtk_vcodec_dec_drv.c | 8 -
.../mediatek/vcodec/mtk_vcodec_enc_drv.c | 3 -
11 files changed, 117 insertions(+), 76 deletions(-)

--
2.18.0



2023-04-11 09:35:17

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 04/14] iommu/mediatek: Get regionid from larb/port id

After commit f1ad5338a4d5 ("of: Fix "dma-ranges" handling for bus
controllers"), the dma-ranges is not allowed for dts leaf node.
but we still would like to separate to different masters
into different iova regions.

Thus we have to separate it by the HW larbid and portid. For example,
larb1/2 are in region2 and larb3 is in region3. The problem is that
some ports inside a larb are in region4 while some ports inside this
larb are in region5. Therefore I define a "iova_region_larb_msk" to help
record the information for each a port. Take a example for a larb:
[1] = ~0: means all ports in this larb are in region1;
[2] = BIT(3) | BIT(4): means port3/4 in this larb are region2;
[3] = ~(BIT(3) | BIT(4)): means all the other ports except port3/4
in this larb are region3.

This method also avoids the users forget/abuse the iova regions.

Signed-off-by: Yong Wu <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
drivers/iommu/mtk_iommu.c | 45 ++++++++++++++++++++++-----------------
1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index aa4bdcb65ea7..bc936709fbe6 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -8,7 +8,6 @@
#include <linux/clk.h>
#include <linux/component.h>
#include <linux/device.h>
-#include <linux/dma-direct.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/io.h>
@@ -212,6 +211,15 @@ struct mtk_iommu_plat_data {
struct {
unsigned int iova_region_nr;
const struct mtk_iommu_iova_region *iova_region;
+ /*
+ * Indicate the correspondance between larbs, ports and regions.
+ *
+ * The index is the same as iova_region and larb port numbers are
+ * described as bit positions.
+ * For example, storing BIT(0) at index 2,1 means "larb 1, port0 is in region 2".
+ * [2] = { [1] = BIT(0) }
+ */
+ const u32 (*iova_region_larb_msk)[MTK_LARB_NR_MAX];
};

/*
@@ -529,30 +537,29 @@ static unsigned int mtk_iommu_get_bank_id(struct device *dev,
static int mtk_iommu_get_iova_region_id(struct device *dev,
const struct mtk_iommu_plat_data *plat_data)
{
- const struct mtk_iommu_iova_region *rgn = plat_data->iova_region;
- const struct bus_dma_region *dma_rgn = dev->dma_range_map;
- int i, candidate = -1;
- dma_addr_t dma_end;
+ struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
+ unsigned int portidmsk = 0, larbid;
+ const u32 *rgn_larb_msk;
+ int i;

- if (!dma_rgn || plat_data->iova_region_nr == 1)
+ if (plat_data->iova_region_nr == 1)
return 0;

- dma_end = dma_rgn->dma_start + dma_rgn->size - 1;
- for (i = 0; i < plat_data->iova_region_nr; i++, rgn++) {
- /* Best fit. */
- if (dma_rgn->dma_start == rgn->iova_base &&
- dma_end == rgn->iova_base + rgn->size - 1)
+ larbid = MTK_M4U_TO_LARB(fwspec->ids[0]);
+ for (i = 0; i < fwspec->num_ids; i++)
+ portidmsk |= BIT(MTK_M4U_TO_PORT(fwspec->ids[i]));
+
+ for (i = 0; i < plat_data->iova_region_nr; i++) {
+ rgn_larb_msk = plat_data->iova_region_larb_msk[i];
+ if (!rgn_larb_msk)
+ continue;
+
+ if ((rgn_larb_msk[larbid] & portidmsk) == portidmsk)
return i;
- /* ok if it is inside this region. */
- if (dma_rgn->dma_start >= rgn->iova_base &&
- dma_end < rgn->iova_base + rgn->size)
- candidate = i;
}

- if (candidate >= 0)
- return candidate;
- dev_err(dev, "Can NOT find the iommu domain id(%pad 0x%llx).\n",
- &dma_rgn->dma_start, dma_rgn->size);
+ dev_err(dev, "Can NOT find the region for larb(%d-%x).\n",
+ larbid, portidmsk);
return -EINVAL;
}

--
2.25.1

2023-04-11 09:35:27

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 02/14] dt-bindings: media: mediatek,jpeg: Remove dma-ranges property

After commit f1ad5338a4d5 ("of: Fix "dma-ranges" handling for bus
controllers"), the dma-ranges of the leaf node doesn't work. Remove
it for jpeg here.

Currently there is only mt8195 jpeg node has this property in upstream,
and it already uses parent-child node, this property did work. But instead,
MediaTek iommu will control the masters' iova ranges by the master's
larb/port id internally, then this property is unnecessary.

Cc: Mauro Carvalho Chehab <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: Bin Liu <[email protected]>
Cc: kyrie wu <[email protected]>
Cc: Xia Jiang <[email protected]>
Signed-off-by: Yong Wu <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
Acked-by: Rob Herring <[email protected]>
Reviewed-by: Hans Verkuil <[email protected]>
---
.../devicetree/bindings/media/mediatek,mt8195-jpegdec.yaml | 7 -------
.../devicetree/bindings/media/mediatek,mt8195-jpegenc.yaml | 7 -------
.../devicetree/bindings/media/mediatek-jpeg-encoder.yaml | 5 -----
3 files changed, 19 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegdec.yaml b/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegdec.yaml
index 71595c013dbb..e5448c60e3eb 100644
--- a/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegdec.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegdec.yaml
@@ -26,11 +26,6 @@ properties:
Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml for details.
Ports are according to the HW.

- dma-ranges:
- maxItems: 1
- description: |
- Describes the physical address space of IOMMU maps to memory.
-
"#address-cells":
const: 2

@@ -89,7 +84,6 @@ required:
- compatible
- power-domains
- iommus
- - dma-ranges
- ranges

additionalProperties: false
@@ -115,7 +109,6 @@ examples:
<&iommu_vpp M4U_PORT_L19_JPGDEC_BSDMA1>,
<&iommu_vpp M4U_PORT_L19_JPGDEC_BUFF_OFFSET1>,
<&iommu_vpp M4U_PORT_L19_JPGDEC_BUFF_OFFSET0>;
- dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
#address-cells = <2>;
#size-cells = <2>;
ranges;
diff --git a/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegenc.yaml b/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegenc.yaml
index 95990539f7c0..596186497b68 100644
--- a/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegenc.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,mt8195-jpegenc.yaml
@@ -26,11 +26,6 @@ properties:
Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml for details.
Ports are according to the HW.

- dma-ranges:
- maxItems: 1
- description: |
- Describes the physical address space of IOMMU maps to memory.
-
"#address-cells":
const: 2

@@ -89,7 +84,6 @@ required:
- compatible
- power-domains
- iommus
- - dma-ranges
- ranges

additionalProperties: false
@@ -113,7 +107,6 @@ examples:
<&iommu_vpp M4U_PORT_L20_JPGENC_C_RDMA>,
<&iommu_vpp M4U_PORT_L20_JPGENC_Q_TABLE>,
<&iommu_vpp M4U_PORT_L20_JPGENC_BSDMA>;
- dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
#address-cells = <2>;
#size-cells = <2>;
ranges;
diff --git a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
index c8412e8ab353..37800e1908cc 100644
--- a/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml
@@ -44,11 +44,6 @@ properties:
Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml for details.
Ports are according to the HW.

- dma-ranges:
- maxItems: 1
- description: |
- Describes the physical address space of IOMMU maps to memory.
-
required:
- compatible
- reg
--
2.25.1

2023-04-11 09:35:29

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 05/14] iommu/mediatek: mt8192: Add iova_region_larb_msk

Add iova_region_larb_msk for mt8192. We separate the 16GB iova regions
by each device's larbid/portid.
Note: larb3/6/8/10/12/15 connect nothing in this SoC.
Refer to the comment in include/dt-bindings/memory/mt8192-larb-port.h

Define a new macro MT8192_MULTI_REGION_NR_MAX to indicate
the index of mt8xxx_larb_region_msk and
"struct mtk_iommu_iova_region mt8192_multi_dom"
are the same.

Signed-off-by: Yong Wu <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
drivers/iommu/mtk_iommu.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index bc936709fbe6..672059f9e0b7 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -336,7 +336,12 @@ static const struct mtk_iommu_iova_region single_domain[] = {
{.iova_base = 0, .size = SZ_4G},
};

-static const struct mtk_iommu_iova_region mt8192_multi_dom[] = {
+#define MT8192_MULTI_REGION_NR_MAX 6
+
+#define MT8192_MULTI_REGION_NR (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT) ? \
+ MT8192_MULTI_REGION_NR_MAX : 1)
+
+static const struct mtk_iommu_iova_region mt8192_multi_dom[MT8192_MULTI_REGION_NR] = {
{ .iova_base = 0x0, .size = SZ_4G}, /* 0 ~ 4G */
#if IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT)
{ .iova_base = SZ_4G, .size = SZ_4G}, /* 4G ~ 8G */
@@ -1534,6 +1539,17 @@ static const struct mtk_iommu_plat_data mt8186_data_mm = {
.iova_region_nr = ARRAY_SIZE(mt8192_multi_dom),
};

+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 |
@@ -1543,6 +1559,7 @@ static const struct mtk_iommu_plat_data mt8192_data = {
.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}},
};
--
2.25.1

2023-04-11 09:35:30

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 03/14] iommu/mediatek: Improve comment for the current region/bank

No functional change. Just add more comment about the current region/bank
in the code.

Signed-off-by: Yong Wu <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
drivers/iommu/mtk_iommu.c | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index d5a4955910ff..aa4bdcb65ea7 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -197,12 +197,33 @@ struct mtk_iommu_plat_data {

char *pericfg_comp_str;
struct list_head *hw_list;
- unsigned int iova_region_nr;
- const struct mtk_iommu_iova_region *iova_region;

- u8 banks_num;
- bool banks_enable[MTK_IOMMU_BANK_MAX];
- unsigned int banks_portmsk[MTK_IOMMU_BANK_MAX];
+ /*
+ * The IOMMU HW may support 16GB iova. In order to balance the IOVA ranges,
+ * different masters will be put in different iova ranges, for example vcodec
+ * is in 4G-8G and cam is in 8G-12G. Meanwhile, some masters may have the
+ * special IOVA range requirement, like CCU can only support the address
+ * 0x40000000-0x44000000.
+ * Here list the iova ranges this SoC supports and which larbs/ports are in
+ * which region.
+ *
+ * 16GB iova all use one pgtable, but each a region is a iommu group.
+ */
+ struct {
+ unsigned int iova_region_nr;
+ const struct mtk_iommu_iova_region *iova_region;
+ };
+
+ /*
+ * The IOMMU HW may have 5 banks. Each bank has a independent pgtable.
+ * Here list how many banks this SoC supports/enables and which ports are in which bank.
+ */
+ struct {
+ u8 banks_num;
+ bool banks_enable[MTK_IOMMU_BANK_MAX];
+ unsigned int banks_portmsk[MTK_IOMMU_BANK_MAX];
+ };
+
unsigned char larbid_remap[MTK_LARB_COM_MAX][MTK_LARB_SUBCOM_MAX];
};

--
2.25.1

2023-04-11 09:35:31

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 06/14] iommu/mediatek: mt8195: Add iova_region_larb_msk

Add iova_region_larb_msk for mt8195. We separate the 16GB iova regions
by each device's larbid/portid.
Refer to include/dt-bindings/memory/mt8195-memory-port.h

Signed-off-by: Yong Wu <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
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 672059f9e0b7..bb3734378934 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -1579,6 +1579,21 @@ static const struct mtk_iommu_plat_data mt8195_data_infra = {
.iova_region_nr = ARRAY_SIZE(single_domain),
};

+static const unsigned int mt8195_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = {
+ [0] = {~0, ~0, ~0, ~0}, /* Region0: all ports for larb0/1/2/3 */
+ [1] = {0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, ~0, ~0, ~0, ~0, ~0, /* Region1: larb19/20/21/22/23/24 */
+ ~0},
+ [2] = {0, 0, 0, 0, ~0, ~0, ~0, ~0, /* Region2: the other larbs. */
+ ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0,
+ ~0, ~0, 0, 0, 0, 0, 0, 0,
+ 0, ~0, ~0, ~0, ~0},
+ [3] = {0},
+ [4] = {[18] = BIT(0) | BIT(1)}, /* Only larb18 port0/1 */
+ [5] = {[18] = BIT(2) | BIT(3)}, /* Only larb18 port2/3 */
+};
+
static const struct mtk_iommu_plat_data mt8195_data_vdo = {
.m4u_plat = M4U_MT8195,
.flags = HAS_BCLK | HAS_SUB_COMM_2BITS | OUT_ORDER_WR_EN |
@@ -1589,6 +1604,7 @@ static const struct mtk_iommu_plat_data mt8195_data_vdo = {
.banks_enable = {true},
.iova_region = mt8192_multi_dom,
.iova_region_nr = ARRAY_SIZE(mt8192_multi_dom),
+ .iova_region_larb_msk = mt8195_larb_region_msk,
.larbid_remap = {{2, 0}, {21}, {24}, {7}, {19}, {9, 10, 11},
{13, 17, 15/* 17b */, 25}, {5}},
};
@@ -1603,6 +1619,7 @@ static const struct mtk_iommu_plat_data mt8195_data_vpp = {
.banks_enable = {true},
.iova_region = mt8192_multi_dom,
.iova_region_nr = ARRAY_SIZE(mt8192_multi_dom),
+ .iova_region_larb_msk = mt8195_larb_region_msk,
.larbid_remap = {{1}, {3},
{22, MTK_INVALID_LARBID, MTK_INVALID_LARBID, MTK_INVALID_LARBID, 23},
{8}, {20}, {12},
--
2.25.1

2023-04-11 09:35:37

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 07/14] iommu/mediatek: mt8186: Add iova_region_larb_msk

Add iova_region_larb_msk for mt8186. We separate the 16GB iova regions
by each device's larbid/portid.
Note: larb5/6/10/12/14/15/18 connect nothing in this SoC.
Refer to include/dt-bindings/memory/mt8186-memory-port.h

Signed-off-by: Yong Wu <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
drivers/iommu/mtk_iommu.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index bb3734378934..2c2a64c1712a 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -1525,6 +1525,18 @@ static const struct mtk_iommu_plat_data mt8183_data = {
.larbid_remap = {{0}, {4}, {5}, {6}, {7}, {2}, {3}, {1}},
};

+static const unsigned int mt8186_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = {
+ [0] = {~0, ~0, ~0}, /* Region0: all ports for larb0/1/2 */
+ [1] = {0, 0, 0, 0, ~0, 0, 0, ~0}, /* Region1: larb4/7 */
+ [2] = {0, 0, 0, 0, 0, 0, 0, 0, /* Region2: larb8/9/11/13/16/17/19/20 */
+ ~0, ~0, 0, ~0, 0, ~(u32)(BIT(9) | BIT(10)), 0, 0,
+ /* larb13: the other ports except port9/10 */
+ ~0, ~0, 0, ~0, ~0},
+ [3] = {0},
+ [4] = {[13] = BIT(9) | BIT(10)}, /* larb13 port9/10 */
+ [5] = {[14] = ~0}, /* larb14 */
+};
+
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 |
@@ -1537,6 +1549,7 @@ static const struct mtk_iommu_plat_data mt8186_data_mm = {
.banks_enable = {true},
.iova_region = mt8192_multi_dom,
.iova_region_nr = ARRAY_SIZE(mt8192_multi_dom),
+ .iova_region_larb_msk = mt8186_larb_region_msk,
};

static const unsigned int mt8192_larb_region_msk[MT8192_MULTI_REGION_NR_MAX][MTK_LARB_NR_MAX] = {
--
2.25.1

2023-04-11 09:35:46

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 09/14] iommu/mediatek: Set dma_mask for the master devices

MediaTek iommu arranges dma ranges for all the masters, this patch is to
help them set dma mask. This is to avoid each master setting their own
mask, but also to avoid a real issue, such as JPEG uses
"mediatek,mtk-jpgenc" for 2701/8183/8186/8188, then JPEG could ignore its
different dma_mask in different SoC to achieve common code.

Signed-off-by: Yong Wu <[email protected]>
---
drivers/iommu/mtk_iommu.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 0e104bb27010..f58b970dccf2 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -738,6 +738,14 @@ static int mtk_iommu_attach_device(struct iommu_domain *domain,
}
mutex_unlock(&data->mutex);

+ if (region_id > 0) {
+ ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(34));
+ if (ret) {
+ dev_err(m4udev, "Failed to set dma_mask for %s(%d).\n", dev_name(dev), ret);
+ return ret;
+ }
+ }
+
return mtk_iommu_config(data, dev, true, region_id);

err_unlock:
--
2.25.1

2023-04-11 09:36:13

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 11/14] media: mediatek: vcodec: Remove the setting for dma_mask

In order to simplify the masters to set their respective dma masks, MTK
IOMMU helps to centralize the processing. Because all the dma ranges is
set in IOMMU, IOMMU knows well the dma mask requirements of masters. After
this patch, the masters(codec here) code does not need care
dma-ranges/dma_mask related information.

Cc: Tiffany Lin <[email protected]>
Cc: Andrew-CT Chen <[email protected]>
Cc: Yunfei Dong <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: irui wang <[email protected]>
Signed-off-by: Yong Wu <[email protected]>
---
.../media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 8 --------
.../media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c | 3 ---
2 files changed, 11 deletions(-)

diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
index 174a6eec2f54..11583405cf61 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
@@ -321,14 +321,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
}
}

- if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL)) {
- ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
- if (ret) {
- mtk_v4l2_err("Failed to set mask");
- goto err_core_workq;
- }
- }
-
for (i = 0; i < MTK_VDEC_HW_MAX; i++)
mutex_init(&dev->dec_mutex[i]);
mutex_init(&dev->dev_mutex);
diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
index 9095186d5495..50e5571608cd 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
@@ -344,9 +344,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
goto err_event_workq;
}

- if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
-
ret = video_register_device(vfd_enc, VFL_TYPE_VIDEO, -1);
if (ret) {
mtk_v4l2_err("Failed to register video device");
--
2.25.1

2023-04-11 09:36:33

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 08/14] iommu/mediatek: Add a gap for the iova regions

As the removed property in the vcodec dt-binding, the property is:
dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;

The length is 0xfff0_0000 rather than 0x1_0000_0000, this means it
requires 1M as a gap. This is because the end address for some vcodec
HW is (address + size). If the size is 4G, the end address may be
0x2_0000_0000, and the width for vcodec register only is 32, then the
HW may get the ZERO address.

Currently the consumer's dma-ranges property doesn't work, IOMMU
has to consider this case. Add a bigger gap(8M) for all the regions
to avoid it.

Signed-off-by: Yong Wu <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
drivers/iommu/mtk_iommu.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 2c2a64c1712a..0e104bb27010 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -332,8 +332,10 @@ static LIST_HEAD(m4ulist); /* List all the M4U HWs */

#define for_each_m4u(data, head) list_for_each_entry(data, head, list)

+#define MTK_IOMMU_IOVA_SZ_4G (SZ_4G - SZ_8M) /* 8M as gap */
+
static const struct mtk_iommu_iova_region single_domain[] = {
- {.iova_base = 0, .size = SZ_4G},
+ {.iova_base = 0, .size = MTK_IOMMU_IOVA_SZ_4G},
};

#define MT8192_MULTI_REGION_NR_MAX 6
@@ -342,11 +344,11 @@ static const struct mtk_iommu_iova_region single_domain[] = {
MT8192_MULTI_REGION_NR_MAX : 1)

static const struct mtk_iommu_iova_region mt8192_multi_dom[MT8192_MULTI_REGION_NR] = {
- { .iova_base = 0x0, .size = SZ_4G}, /* 0 ~ 4G */
+ { .iova_base = 0x0, .size = MTK_IOMMU_IOVA_SZ_4G}, /* 0 ~ 4G, */
#if IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT)
- { .iova_base = SZ_4G, .size = SZ_4G}, /* 4G ~ 8G */
- { .iova_base = SZ_4G * 2, .size = SZ_4G}, /* 8G ~ 12G */
- { .iova_base = SZ_4G * 3, .size = SZ_4G}, /* 12G ~ 16G */
+ { .iova_base = SZ_4G, .size = MTK_IOMMU_IOVA_SZ_4G}, /* 4G ~ 8G */
+ { .iova_base = SZ_4G * 2, .size = MTK_IOMMU_IOVA_SZ_4G}, /* 8G ~ 12G */
+ { .iova_base = SZ_4G * 3, .size = MTK_IOMMU_IOVA_SZ_4G}, /* 12G ~ 16G */

{ .iova_base = 0x240000000ULL, .size = 0x4000000}, /* CCU0 */
{ .iova_base = 0x244000000ULL, .size = 0x4000000}, /* CCU1 */
--
2.25.1

2023-04-11 09:36:33

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 12/14] arm64: dts: mt8195: Remove the unnecessary dma-ranges

After we add the dma-ranges in the parent "soc" node,
this property is unnecessary for the leaf node.

Signed-off-by: Yong Wu <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
arch/arm64/boot/dts/mediatek/mt8195.dtsi | 3 ---
1 file changed, 3 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi
index 8f1264d5290b..89f469ba9f6c 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi
@@ -2299,7 +2299,6 @@ venc: video-codec@1a020000 {
power-domains = <&spm MT8195_POWER_DOMAIN_VENC>;
#address-cells = <2>;
#size-cells = <2>;
- dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
};

jpgdec-master {
@@ -2311,7 +2310,6 @@ jpgdec-master {
<&iommu_vdo M4U_PORT_L19_JPGDEC_BSDMA1>,
<&iommu_vdo M4U_PORT_L19_JPGDEC_BUFF_OFFSET1>,
<&iommu_vdo M4U_PORT_L19_JPGDEC_BUFF_OFFSET0>;
- dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
#address-cells = <2>;
#size-cells = <2>;
ranges;
@@ -2383,7 +2381,6 @@ jpgenc-master {
<&iommu_vpp M4U_PORT_L20_JPGENC_C_RDMA>,
<&iommu_vpp M4U_PORT_L20_JPGENC_Q_TABLE>,
<&iommu_vpp M4U_PORT_L20_JPGENC_BSDMA>;
- dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
#address-cells = <2>;
#size-cells = <2>;
ranges;
--
2.25.1

2023-04-11 09:36:36

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 14/14] arm64: dts: mt8186: Add dma-ranges for the parent "soc" node

Prepare for the MM nodes whose dma-ranges(iova range) is 16GB.

Signed-off-by: Yong Wu <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
arch/arm64/boot/dts/mediatek/mt8186.dtsi | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8186.dtsi b/arch/arm64/boot/dts/mediatek/mt8186.dtsi
index a0d3e1f731bd..251eace411c0 100644
--- a/arch/arm64/boot/dts/mediatek/mt8186.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8186.dtsi
@@ -324,6 +324,7 @@ soc {
#address-cells = <2>;
#size-cells = <2>;
compatible = "simple-bus";
+ dma-ranges = <0x0 0x0 0x0 0x0 0x4 0x0>;
ranges;

gic: interrupt-controller@c000000 {
--
2.25.1

2023-04-11 09:36:44

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 13/14] arm64: dts: mt8195: Add dma-ranges for the parent "soc" node

After commit f1ad5338a4d5 ("of: Fix "dma-ranges" handling for bus
controllers"), the dma-ranges property is not allowed for
the leaf node. But our iommu/dma-ranges is 16GB, we still expect
separate the 16GB dma-range like:
a) display is in 0 - 4GB;
b) vcodec is in 4GB - 8GB;
c) camera is in 8GB - 12GB.
We can not expect all the masters add a parent node for them,
especial for the existed drivers/nodes.
Thus, we add whole the 16GB dma-ranges in the parent "soc" node.

Signed-off-by: Yong Wu <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
---
arch/arm64/boot/dts/mediatek/mt8195.dtsi | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi
index 89f469ba9f6c..7d87cbabc9f1 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi
@@ -364,6 +364,7 @@ soc {
#size-cells = <2>;
compatible = "simple-bus";
ranges;
+ dma-ranges = <0x0 0x0 0x0 0x0 0x4 0x0>;

gic: interrupt-controller@c000000 {
compatible = "arm,gic-v3";
--
2.25.1

2023-04-11 09:36:57

by Yong Wu (吴勇)

[permalink] [raw]
Subject: [PATCH v7 10/14] media: mtk-jpegdec: Remove the setting for dma_mask

In order to simplify the masters to set their respective dma masks, MTK
IOMMU helps to centralize the processing. Because all the dma ranges is
set in IOMMU, IOMMU knows well the dma mask requirements of masters. After
this patch, the masters code does not need care
dma-ranges/dma_mask related information.

Cc: Bin Liu <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: kyrie wu <[email protected]>
Signed-off-by: Yong Wu <[email protected]>
---
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
index 969516a940ba..9b96d2436311 100644
--- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
@@ -1757,9 +1757,6 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
jpeg->vdev->device_caps = V4L2_CAP_STREAMING |
V4L2_CAP_VIDEO_M2M_MPLANE;

- if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
- dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
-
ret = video_register_device(jpeg->vdev, VFL_TYPE_VIDEO, -1);
if (ret) {
v4l2_err(&jpeg->v4l2_dev, "Failed to register video device\n");
--
2.25.1

Subject: Re: [PATCH v7 10/14] media: mtk-jpegdec: Remove the setting for dma_mask

Il 11/04/23 11:31, Yong Wu ha scritto:
> In order to simplify the masters to set their respective dma masks, MTK
> IOMMU helps to centralize the processing. Because all the dma ranges is
> set in IOMMU, IOMMU knows well the dma mask requirements of masters. After
> this patch, the masters code does not need care
> dma-ranges/dma_mask related information.
>
> Cc: Bin Liu <[email protected]>
> Cc: Mauro Carvalho Chehab <[email protected]>
> Cc: kyrie wu <[email protected]>
> Signed-off-by: Yong Wu <[email protected]>

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


Subject: Re: [PATCH v7 11/14] media: mediatek: vcodec: Remove the setting for dma_mask

Il 11/04/23 11:31, Yong Wu ha scritto:
> In order to simplify the masters to set their respective dma masks, MTK
> IOMMU helps to centralize the processing. Because all the dma ranges is
> set in IOMMU, IOMMU knows well the dma mask requirements of masters. After
> this patch, the masters(codec here) code does not need care
> dma-ranges/dma_mask related information.
>
> Cc: Tiffany Lin <[email protected]>
> Cc: Andrew-CT Chen <[email protected]>
> Cc: Yunfei Dong <[email protected]>
> Cc: Mauro Carvalho Chehab <[email protected]>
> Cc: irui wang <[email protected]>
> Signed-off-by: Yong Wu <[email protected]>

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


Subject: Re: [PATCH v7 09/14] iommu/mediatek: Set dma_mask for the master devices

Il 11/04/23 11:31, Yong Wu ha scritto:
> MediaTek iommu arranges dma ranges for all the masters, this patch is to
> help them set dma mask. This is to avoid each master setting their own
> mask, but also to avoid a real issue, such as JPEG uses
> "mediatek,mtk-jpgenc" for 2701/8183/8186/8188, then JPEG could ignore its
> different dma_mask in different SoC to achieve common code.
>
> Signed-off-by: Yong Wu <[email protected]>

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

2023-04-12 14:36:10

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH v7 10/14] media: mtk-jpegdec: Remove the setting for dma_mask

On 11/04/2023 11:31, Yong Wu wrote:
> In order to simplify the masters to set their respective dma masks, MTK
> IOMMU helps to centralize the processing. Because all the dma ranges is
> set in IOMMU, IOMMU knows well the dma mask requirements of masters. After
> this patch, the masters code does not need care
> dma-ranges/dma_mask related information.
>
> Cc: Bin Liu <[email protected]>
> Cc: Mauro Carvalho Chehab <[email protected]>
> Cc: kyrie wu <[email protected]>
> Signed-off-by: Yong Wu <[email protected]>

Acked-by: Hans Verkuil <[email protected]>

Regards,

Hans

> ---
> drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> index 969516a940ba..9b96d2436311 100644
> --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> @@ -1757,9 +1757,6 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
> jpeg->vdev->device_caps = V4L2_CAP_STREAMING |
> V4L2_CAP_VIDEO_M2M_MPLANE;
>
> - if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
> - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
> -
> ret = video_register_device(jpeg->vdev, VFL_TYPE_VIDEO, -1);
> if (ret) {
> v4l2_err(&jpeg->v4l2_dev, "Failed to register video device\n");

2023-04-12 14:36:28

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH v7 11/14] media: mediatek: vcodec: Remove the setting for dma_mask

On 11/04/2023 11:31, Yong Wu wrote:
> In order to simplify the masters to set their respective dma masks, MTK
> IOMMU helps to centralize the processing. Because all the dma ranges is
> set in IOMMU, IOMMU knows well the dma mask requirements of masters. After
> this patch, the masters(codec here) code does not need care
> dma-ranges/dma_mask related information.
>
> Cc: Tiffany Lin <[email protected]>
> Cc: Andrew-CT Chen <[email protected]>
> Cc: Yunfei Dong <[email protected]>
> Cc: Mauro Carvalho Chehab <[email protected]>
> Cc: irui wang <[email protected]>
> Signed-off-by: Yong Wu <[email protected]>

Acked-by: Hans Verkuil <[email protected]>

Regards,

Hans

> ---
> .../media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 8 --------
> .../media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c | 3 ---
> 2 files changed, 11 deletions(-)
>
> diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
> index 174a6eec2f54..11583405cf61 100644
> --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
> +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
> @@ -321,14 +321,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
> }
> }
>
> - if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL)) {
> - ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
> - if (ret) {
> - mtk_v4l2_err("Failed to set mask");
> - goto err_core_workq;
> - }
> - }
> -
> for (i = 0; i < MTK_VDEC_HW_MAX; i++)
> mutex_init(&dev->dec_mutex[i]);
> mutex_init(&dev->dev_mutex);
> diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
> index 9095186d5495..50e5571608cd 100644
> --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
> +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
> @@ -344,9 +344,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
> goto err_event_workq;
> }
>
> - if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
> - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
> -
> ret = video_register_device(vfd_enc, VFL_TYPE_VIDEO, -1);
> if (ret) {
> mtk_v4l2_err("Failed to register video device");

2023-04-12 14:37:35

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH v7 00/14] Adjust the dma-ranges for MTK IOMMU

On 11/04/2023 11:31, Yong Wu wrote:
> After commit f1ad5338a4d5 ("of: Fix "dma-ranges" handling for bus
> controllers"), the dma-ranges is not allowed for dts leaf node.
> but we still would like to separate the different masters into
> different iova regions. Thus we adjust the internal flow, separate
> the 16GB iova range by the master HW larbid/portid and add the
> dma-ranges property in the parent "soc" node. This also could avoid
> the users forget/abuse the iova regions.
>
> The commit f1ad5338a4d5 did affect the mt8195 venc, But it is not
> a fatal issue, it could also work well at 0-4GB iova. thus I don't
> add "Fixes:" tag.
>
> In this series, I add functions for mt8192/mt8195/mt8186, mt8188 will
> be in its special patchset. and the previous mt8173/mt8183...support
> 0-4GB only, no need this function.

I've Acked patches 10 and 11 as well. I assume this series will be merged
through the iommu subsystem? If not, and I need to take the media patches,
then please let me know!

Regards,

Hans

>
> Change note:
> v7: Remove the change about mediatek,vcodec-subdev-decoder.yaml since
> this was merged at:
> https://lore.kernel.org/all/[email protected]/
>
> v6: https://lore.kernel.org/linux-mediatek/[email protected]/
> Add three patches for set dma-mask for iommu master devices.
>
> v5: Nothing change. Just rebase on v6.3-rc1.
>
> v4: https://lore.kernel.org/linux-mediatek/[email protected]/
> Improve the comment in the code from AngeloGioacchino.
>
> v3: https://lore.kernel.org/linux-mediatek/[email protected]/
> Add a new patch only for comment more in the code.
>
> v2: https://lore.kernel.org/linux-mediatek/[email protected]/
> a) Base on next-20230206 since mt8195 jpeg node is applied which affect
> this patch.
> b) Reword the commit message [1/10][2/10] to explain effect.
>
> v1: https://lore.kernel.org/linux-mediatek/[email protected]/
> Base on v6.2-rc3.
>
> Yong Wu (14):
> dt-bindings: media: mediatek,vcodec: Remove dma-ranges property
> dt-bindings: media: mediatek,jpeg: Remove dma-ranges property
> iommu/mediatek: Improve comment for the current region/bank
> iommu/mediatek: Get regionid from larb/port id
> iommu/mediatek: mt8192: Add iova_region_larb_msk
> iommu/mediatek: mt8195: Add iova_region_larb_msk
> iommu/mediatek: mt8186: Add iova_region_larb_msk
> iommu/mediatek: Add a gap for the iova regions
> iommu/mediatek: Set dma_mask for the master devices
> media: mtk-jpegdec: Remove the setting for dma_mask
> media: mediatek: vcodec: Remove the setting for dma_mask
> arm64: dts: mt8195: Remove the unnecessary dma-ranges
> arm64: dts: mt8195: Add dma-ranges for the parent "soc" node
> arm64: dts: mt8186: Add dma-ranges for the parent "soc" node
>
> .../media/mediatek,mt8195-jpegdec.yaml | 7 -
> .../media/mediatek,mt8195-jpegenc.yaml | 7 -
> .../media/mediatek,vcodec-decoder.yaml | 5 -
> .../media/mediatek,vcodec-encoder.yaml | 5 -
> .../bindings/media/mediatek-jpeg-encoder.yaml | 5 -
> arch/arm64/boot/dts/mediatek/mt8186.dtsi | 1 +
> arch/arm64/boot/dts/mediatek/mt8195.dtsi | 4 +-
> drivers/iommu/mtk_iommu.c | 145 ++++++++++++++----
> .../platform/mediatek/jpeg/mtk_jpeg_core.c | 3 -
> .../mediatek/vcodec/mtk_vcodec_dec_drv.c | 8 -
> .../mediatek/vcodec/mtk_vcodec_enc_drv.c | 3 -
> 11 files changed, 117 insertions(+), 76 deletions(-)
>

2023-04-13 10:08:42

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH v7 00/14] Adjust the dma-ranges for MTK IOMMU

On Tue, Apr 11, 2023 at 05:31:30PM +0800, Yong Wu wrote:
> Yong Wu (14):
> dt-bindings: media: mediatek,vcodec: Remove dma-ranges property
> dt-bindings: media: mediatek,jpeg: Remove dma-ranges property
> iommu/mediatek: Improve comment for the current region/bank
> iommu/mediatek: Get regionid from larb/port id
> iommu/mediatek: mt8192: Add iova_region_larb_msk
> iommu/mediatek: mt8195: Add iova_region_larb_msk
> iommu/mediatek: mt8186: Add iova_region_larb_msk
> iommu/mediatek: Add a gap for the iova regions
> iommu/mediatek: Set dma_mask for the master devices
> media: mtk-jpegdec: Remove the setting for dma_mask
> media: mediatek: vcodec: Remove the setting for dma_mask
> arm64: dts: mt8195: Remove the unnecessary dma-ranges
> arm64: dts: mt8195: Add dma-ranges for the parent "soc" node
> arm64: dts: mt8186: Add dma-ranges for the parent "soc" node

Applied, thanks.