iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] Adjust the dma-ranges for MTK IOMMU
@ 2023-01-13  6:01 Yong Wu
  2023-01-13  6:01 ` [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property Yong Wu
                   ` (9 more replies)
  0 siblings, 10 replies; 24+ messages in thread
From: Yong Wu @ 2023-01-13  6:01 UTC (permalink / raw)
  To: Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab, Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, AngeloGioacchino Del Regno,
	mingyuan.ma, yf.wang, libo.kang, Yunfei Dong, kyrie wu,
	chengci.xu, youlin.pei, anan.sun

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 doesn't introduce the regression for us in
upstream, currently mt8195 vcodec/jpeg use the parent/child node.
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.

Base on v6.2-rc3.

Yong Wu (10):
  dt-bindings: media: mediatek,vcodec: Remove dma-ranges property
  dt-bindings: media: mediatek,jpeg: Remove dma-ranges property
  iommu/mediatek: Get regionid from larb/port id
  iommu/mediatek: mt8195: Add larb_region_msk
  iommu/mediatek: mt8186: add larb_region_msk
  iommu/mediatek: mt8192: add larb_region_msk
  iommu/mediatek: Add a gap for the iova regions
  arm64: dts: mt8195: Add dma-ranges for the parent "soc" node
  arm64: dts: mt8195: Remove the unnecessary dma-ranges
  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 -
 .../media/mediatek,vcodec-subdev-decoder.yaml |  7 --
 .../bindings/media/mediatek-jpeg-encoder.yaml |  5 -
 arch/arm64/boot/dts/mediatek/mt8186.dtsi      |  1 +
 arch/arm64/boot/dts/mediatek/mt8195.dtsi      |  2 +-
 drivers/iommu/mtk_iommu.c                     | 95 ++++++++++++++-----
 9 files changed, 72 insertions(+), 62 deletions(-)

-- 
2.18.0



^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property
  2023-01-13  6:01 [PATCH 00/10] Adjust the dma-ranges for MTK IOMMU Yong Wu
@ 2023-01-13  6:01 ` Yong Wu
  2023-01-13  8:25   ` Krzysztof Kozlowski
  2023-01-16  9:47   ` AngeloGioacchino Del Regno
  2023-01-13  6:01 ` [PATCH 02/10] dt-bindings: media: mediatek,jpeg: " Yong Wu
                   ` (8 subsequent siblings)
  9 siblings, 2 replies; 24+ messages in thread
From: Yong Wu @ 2023-01-13  6:01 UTC (permalink / raw)
  To: Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab, Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, AngeloGioacchino Del Regno,
	mingyuan.ma, yf.wang, libo.kang, Yunfei Dong, kyrie wu,
	chengci.xu, youlin.pei, anan.sun, Yong Wu, Tiffany Lin,
	Andrew-CT Chen

MediaTek iommu has already controlled the masters' iova ranges by the
master's larb/port id. then the dma-ranges property is unnecessary for
the master's node. the master is vcodec here.

Cc: Tiffany Lin <tiffany.lin@mediatek.com>
Cc: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
Cc: Yunfei Dong <yunfei.dong@mediatek.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
---
 .../devicetree/bindings/media/mediatek,vcodec-decoder.yaml | 5 -----
 .../devicetree/bindings/media/mediatek,vcodec-encoder.yaml | 5 -----
 .../bindings/media/mediatek,vcodec-subdev-decoder.yaml     | 7 -------
 3 files changed, 17 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
index aa55ca65d6ed..fad59b486d5d 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
@@ -56,11 +56,6 @@ properties:
       List of the hardware port in respective IOMMU block for current Socs.
       Refer to bindings/iommu/mediatek,iommu.yaml.
 
-  dma-ranges:
-    maxItems: 1
-    description: |
-      Describes the physical address space of IOMMU maps to memory.
-
   mediatek,vpu:
     $ref: /schemas/types.yaml#/definitions/phandle
     description:
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
index 0f2ea8d9a10c..a2051b31fa29 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
@@ -49,11 +49,6 @@ properties:
       List of the hardware port in respective IOMMU block for current Socs.
       Refer to bindings/iommu/mediatek,iommu.yaml.
 
-  dma-ranges:
-    maxItems: 1
-    description: |
-      Describes the physical address space of IOMMU maps to memory.
-
   mediatek,vpu:
     $ref: /schemas/types.yaml#/definitions/phandle
     description:
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
index c4f20acdc1f8..290594bc91cc 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
@@ -76,11 +76,6 @@ properties:
       The node of system control processor (SCP), using
       the remoteproc & rpmsg framework.
 
-  dma-ranges:
-    maxItems: 1
-    description: |
-      Describes the physical address space of IOMMU maps to memory.
-
   "#address-cells":
     const: 2
 
@@ -203,7 +198,6 @@ required:
   - reg
   - iommus
   - mediatek,scp
-  - dma-ranges
   - ranges
 
 if:
@@ -236,7 +230,6 @@ examples:
             compatible = "mediatek,mt8192-vcodec-dec";
             mediatek,scp = <&scp>;
             iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>;
-            dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
             #address-cells = <2>;
             #size-cells = <2>;
             ranges = <0 0 0 0x16000000 0 0x40000>;
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 02/10] dt-bindings: media: mediatek,jpeg: Remove dma-ranges property
  2023-01-13  6:01 [PATCH 00/10] Adjust the dma-ranges for MTK IOMMU Yong Wu
  2023-01-13  6:01 ` [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property Yong Wu
@ 2023-01-13  6:01 ` Yong Wu
  2023-01-16  9:47   ` AngeloGioacchino Del Regno
  2023-01-13  6:01 ` [PATCH 03/10] iommu/mediatek: Get regionid from larb/port id Yong Wu
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Yong Wu @ 2023-01-13  6:01 UTC (permalink / raw)
  To: Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab, Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, AngeloGioacchino Del Regno,
	mingyuan.ma, yf.wang, libo.kang, Yunfei Dong, kyrie wu,
	chengci.xu, youlin.pei, anan.sun, Yong Wu, Bin Liu, Xia Jiang

Mediatek IOMMU has already controlled the masters' iova ranges by the
master's larb/port id. then the dma-ranges property is unnecessary for
the master's node. the master is jpeg here.

Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Bin Liu <bin.liu@mediatek.com>
Cc: kyrie wu <kyrie.wu@mediatek.corp-partner.google.com>
Cc: Xia Jiang <xia.jiang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
---
 .../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.18.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 03/10] iommu/mediatek: Get regionid from larb/port id
  2023-01-13  6:01 [PATCH 00/10] Adjust the dma-ranges for MTK IOMMU Yong Wu
  2023-01-13  6:01 ` [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property Yong Wu
  2023-01-13  6:01 ` [PATCH 02/10] dt-bindings: media: mediatek,jpeg: " Yong Wu
@ 2023-01-13  6:01 ` Yong Wu
  2023-01-13  6:01 ` [PATCH 04/10] iommu/mediatek: mt8195: Add larb_region_msk Yong Wu
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Yong Wu @ 2023-01-13  6:01 UTC (permalink / raw)
  To: Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab, Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, AngeloGioacchino Del Regno,
	mingyuan.ma, yf.wang, libo.kang, Yunfei Dong, kyrie wu,
	chengci.xu, youlin.pei, anan.sun, Yong Wu

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 "larb_region_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 avoid the users forget/abuse the iova regions.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
---
 drivers/iommu/mtk_iommu.c | 43 +++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 2badd6acfb23..d30020d0a190 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>
@@ -194,6 +193,7 @@ struct mtk_iommu_plat_data {
 	enum mtk_iommu_plat	m4u_plat;
 	u32			flags;
 	u32			inv_sel_reg;
+	const u32		(*larb_region_msk)[32];
 
 	char			*pericfg_comp_str;
 	struct list_head	*hw_list;
@@ -508,30 +508,33 @@ 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, region_id = -1;
 
-	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)
-			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;
+	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->larb_region_msk[i];
+		if (!rgn_larb_msk)
+			continue;
+
+		if  ((rgn_larb_msk[larbid] & portidmsk) == portidmsk) {
+			region_id = i;
+			break;
+		}
 	}
 
-	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);
+	if (region_id >= 0)
+		return region_id;
+	dev_err(dev, "Can NOT find the region for larb(%d-%x).\n",
+		larbid, portidmsk);
 	return -EINVAL;
 }
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 04/10] iommu/mediatek: mt8195: Add larb_region_msk
  2023-01-13  6:01 [PATCH 00/10] Adjust the dma-ranges for MTK IOMMU Yong Wu
                   ` (2 preceding siblings ...)
  2023-01-13  6:01 ` [PATCH 03/10] iommu/mediatek: Get regionid from larb/port id Yong Wu
@ 2023-01-13  6:01 ` Yong Wu
  2023-01-13  6:01 ` [PATCH 05/10] iommu/mediatek: mt8186: add larb_region_msk Yong Wu
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Yong Wu @ 2023-01-13  6:01 UTC (permalink / raw)
  To: Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab, Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, AngeloGioacchino Del Regno,
	mingyuan.ma, yf.wang, libo.kang, Yunfei Dong, kyrie wu,
	chengci.xu, youlin.pei, anan.sun, Yong Wu

Add larb_region_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 <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 d30020d0a190..d8be7584702f 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -1546,6 +1546,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[][32] = {
+	[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 |
@@ -1556,6 +1571,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),
+	.larb_region_msk = mt8195_larb_region_msk,
 	.larbid_remap   = {{2, 0}, {21}, {24}, {7}, {19}, {9, 10, 11},
 			   {13, 17, 15/* 17b */, 25}, {5}},
 };
@@ -1570,6 +1586,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),
+	.larb_region_msk = mt8195_larb_region_msk,
 	.larbid_remap   = {{1}, {3},
 			   {22, MTK_INVALID_LARBID, MTK_INVALID_LARBID, MTK_INVALID_LARBID, 23},
 			   {8}, {20}, {12},
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 05/10] iommu/mediatek: mt8186: add larb_region_msk
  2023-01-13  6:01 [PATCH 00/10] Adjust the dma-ranges for MTK IOMMU Yong Wu
                   ` (3 preceding siblings ...)
  2023-01-13  6:01 ` [PATCH 04/10] iommu/mediatek: mt8195: Add larb_region_msk Yong Wu
@ 2023-01-13  6:01 ` Yong Wu
  2023-01-13  6:01 ` [PATCH 06/10] iommu/mediatek: mt8192: " Yong Wu
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Yong Wu @ 2023-01-13  6:01 UTC (permalink / raw)
  To: Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab, Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, AngeloGioacchino Del Regno,
	mingyuan.ma, yf.wang, libo.kang, Yunfei Dong, kyrie wu,
	chengci.xu, youlin.pei, anan.sun, Yong Wu

Add larb_region_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 <yong.wu@mediatek.com>
---
 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 d8be7584702f..ffd0203f515e 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -1504,6 +1504,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[][32] = {
+	[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 |
@@ -1516,6 +1528,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),
+	.larb_region_msk = mt8186_larb_region_msk,
 };
 
 static const struct mtk_iommu_plat_data mt8192_data = {
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 06/10] iommu/mediatek: mt8192: add larb_region_msk
  2023-01-13  6:01 [PATCH 00/10] Adjust the dma-ranges for MTK IOMMU Yong Wu
                   ` (4 preceding siblings ...)
  2023-01-13  6:01 ` [PATCH 05/10] iommu/mediatek: mt8186: add larb_region_msk Yong Wu
@ 2023-01-13  6:01 ` Yong Wu
  2023-01-13  6:01 ` [PATCH 07/10] iommu/mediatek: Add a gap for the iova regions Yong Wu
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Yong Wu @ 2023-01-13  6:01 UTC (permalink / raw)
  To: Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab, Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, AngeloGioacchino Del Regno,
	mingyuan.ma, yf.wang, libo.kang, Yunfei Dong, kyrie wu,
	chengci.xu, youlin.pei, anan.sun, Yong Wu

Add larb_region_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

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

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index ffd0203f515e..e4b8c07d4dbd 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -1531,6 +1531,17 @@ static const struct mtk_iommu_plat_data mt8186_data_mm = {
 	.larb_region_msk = mt8186_larb_region_msk,
 };
 
+static const unsigned int mt8192_larb_region_msk[][32] = {
+	[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 |
@@ -1540,6 +1551,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),
+	.larb_region_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.18.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 07/10] iommu/mediatek: Add a gap for the iova regions
  2023-01-13  6:01 [PATCH 00/10] Adjust the dma-ranges for MTK IOMMU Yong Wu
                   ` (5 preceding siblings ...)
  2023-01-13  6:01 ` [PATCH 06/10] iommu/mediatek: mt8192: " Yong Wu
@ 2023-01-13  6:01 ` Yong Wu
  2023-01-16  9:46   ` AngeloGioacchino Del Regno
  2023-01-13  6:01 ` [PATCH 08/10] arm64: dts: mt8195: Add dma-ranges for the parent "soc" node Yong Wu
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Yong Wu @ 2023-01-13  6:01 UTC (permalink / raw)
  To: Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab, Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, AngeloGioacchino Del Regno,
	mingyuan.ma, yf.wang, libo.kang, Yunfei Dong, kyrie wu,
	chengci.xu, youlin.pei, anan.sun, Yong Wu

Currenly masters can not indicate its special dma-ranges. Prepare
for vcodec. some vcodec end address is address + size, if our size
is 4G, the end address may be 0x2_0000_0000. and the
register is u32, then it may get zero. thus add a gap(8M) for
all the regions.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
---
 drivers/iommu/mtk_iommu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index e4b8c07d4dbd..dd63d9994133 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -304,15 +304,15 @@ static LIST_HEAD(m4ulist);	/* List all the M4U HWs */
 #define for_each_m4u(data, head)  list_for_each_entry(data, head, list)
 
 static const struct mtk_iommu_iova_region single_domain[] = {
-	{.iova_base = 0,		.size = SZ_4G},
+	{.iova_base = 0,		.size = SZ_4G - SZ_8M},
 };
 
 static const struct mtk_iommu_iova_region mt8192_multi_dom[] = {
-	{ .iova_base = 0x0,		.size = SZ_4G},		/* 0 ~ 4G */
+	{ .iova_base = 0x0,		.size = SZ_4G - SZ_8M},	/* 0 ~ 4G, 8M as a gap. */
 	#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 = SZ_4G - SZ_8M},	/* 4G ~ 8G */
+	{ .iova_base = SZ_4G * 2,	.size = SZ_4G - SZ_8M},	/* 8G ~ 12G */
+	{ .iova_base = SZ_4G * 3,	.size = SZ_4G - SZ_8M},	/* 12G ~ 16G */
 
 	{ .iova_base = 0x240000000ULL,	.size = 0x4000000},	/* CCU0 */
 	{ .iova_base = 0x244000000ULL,	.size = 0x4000000},	/* CCU1 */
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 08/10] arm64: dts: mt8195: Add dma-ranges for the parent "soc" node
  2023-01-13  6:01 [PATCH 00/10] Adjust the dma-ranges for MTK IOMMU Yong Wu
                   ` (6 preceding siblings ...)
  2023-01-13  6:01 ` [PATCH 07/10] iommu/mediatek: Add a gap for the iova regions Yong Wu
@ 2023-01-13  6:01 ` Yong Wu
  2023-01-16  9:47   ` AngeloGioacchino Del Regno
  2023-01-13  6:01 ` [PATCH 09/10] arm64: dts: mt8195: Remove the unnecessary dma-ranges Yong Wu
  2023-01-13  6:01 ` [PATCH 10/10] arm64: dts: mt8186: Add dma-ranges for the parent "soc" node Yong Wu
  9 siblings, 1 reply; 24+ messages in thread
From: Yong Wu @ 2023-01-13  6:01 UTC (permalink / raw)
  To: Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab, Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, AngeloGioacchino Del Regno,
	mingyuan.ma, yf.wang, libo.kang, Yunfei Dong, kyrie wu,
	chengci.xu, youlin.pei, anan.sun, Yong Wu

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 <yong.wu@mediatek.com>
---
 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 5d31536f4c48..175eb7a25307 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi
@@ -299,6 +299,7 @@
 		#size-cells = <2>;
 		compatible = "simple-bus";
 		ranges;
+		dma-ranges = <0x0 0x0 0x0 0x0 0x4 0x0>;
 
 		gic: interrupt-controller@c000000 {
 			compatible = "arm,gic-v3";
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 09/10] arm64: dts: mt8195: Remove the unnecessary dma-ranges
  2023-01-13  6:01 [PATCH 00/10] Adjust the dma-ranges for MTK IOMMU Yong Wu
                   ` (7 preceding siblings ...)
  2023-01-13  6:01 ` [PATCH 08/10] arm64: dts: mt8195: Add dma-ranges for the parent "soc" node Yong Wu
@ 2023-01-13  6:01 ` Yong Wu
  2023-01-16  9:47   ` AngeloGioacchino Del Regno
  2023-01-13  6:01 ` [PATCH 10/10] arm64: dts: mt8186: Add dma-ranges for the parent "soc" node Yong Wu
  9 siblings, 1 reply; 24+ messages in thread
From: Yong Wu @ 2023-01-13  6:01 UTC (permalink / raw)
  To: Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab, Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, AngeloGioacchino Del Regno,
	mingyuan.ma, yf.wang, libo.kang, Yunfei Dong, kyrie wu,
	chengci.xu, youlin.pei, anan.sun, Yong Wu

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

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
---
 arch/arm64/boot/dts/mediatek/mt8195.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi
index 175eb7a25307..8f745442eef8 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi
@@ -2137,7 +2137,6 @@
 			power-domains = <&spm MT8195_POWER_DOMAIN_VENC>;
 			#address-cells = <2>;
 			#size-cells = <2>;
-			dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
 		};
 
 		vencsys_core1: clock-controller@1b000000 {
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 10/10] arm64: dts: mt8186: Add dma-ranges for the parent "soc" node
  2023-01-13  6:01 [PATCH 00/10] Adjust the dma-ranges for MTK IOMMU Yong Wu
                   ` (8 preceding siblings ...)
  2023-01-13  6:01 ` [PATCH 09/10] arm64: dts: mt8195: Remove the unnecessary dma-ranges Yong Wu
@ 2023-01-13  6:01 ` Yong Wu
  2023-01-16  9:47   ` AngeloGioacchino Del Regno
  9 siblings, 1 reply; 24+ messages in thread
From: Yong Wu @ 2023-01-13  6:01 UTC (permalink / raw)
  To: Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab, Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, AngeloGioacchino Del Regno,
	mingyuan.ma, yf.wang, libo.kang, Yunfei Dong, kyrie wu,
	chengci.xu, youlin.pei, anan.sun, Yong Wu

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

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
---
 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 c326aeb33a10..ea90d2d08316 100644
--- a/arch/arm64/boot/dts/mediatek/mt8186.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8186.dtsi
@@ -265,6 +265,7 @@
 		#address-cells = <2>;
 		#size-cells = <2>;
 		compatible = "simple-bus";
+		dma-ranges = <0x0 0x0 0x0 0x0 0x4 0x0>;
 		ranges;
 
 		gic: interrupt-controller@c000000 {
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property
  2023-01-13  6:01 ` [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property Yong Wu
@ 2023-01-13  8:25   ` Krzysztof Kozlowski
  2023-01-16  8:01     ` Yong Wu (吴勇)
  2023-01-16  9:47   ` AngeloGioacchino Del Regno
  1 sibling, 1 reply; 24+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-13  8:25 UTC (permalink / raw)
  To: Yong Wu, Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab,
	Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, AngeloGioacchino Del Regno,
	mingyuan.ma, yf.wang, libo.kang, Yunfei Dong, kyrie wu,
	chengci.xu, youlin.pei, anan.sun, Tiffany Lin, Andrew-CT Chen

On 13/01/2023 07:01, Yong Wu wrote:
> MediaTek iommu has already controlled the masters' iova ranges by the
> master's larb/port id. then the dma-ranges property is unnecessary for

Sentences in English always start with a capital letter, however also
they do not start with "Then". Make it a proper a proper sentence.

> the master's node. the master is vcodec here.

Unnecessary or invalid? Don't you depend now on some feature of driver
added for example recently?

> 
> Cc: Tiffany Lin <tiffany.lin@mediatek.com>
> Cc: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
> Cc: Yunfei Dong <yunfei.dong@mediatek.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>

There is little point in storing output of get_maintainers.pl forever in
the git log. If you need it for some reason, please keep it after ---.

> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> ---
>  .../devicetree/bindings/media/mediatek,vcodec-decoder.yaml | 5 -----
>  .../devicetree/bindings/media/mediatek,vcodec-encoder.yaml | 5 -----
>  .../bindings/media/mediatek,vcodec-subdev-decoder.yaml     | 7 -------
>  3 files changed, 17 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> index aa55ca65d6ed..fad59b486d5d 100644
> --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> @@ -56,11 +56,6 @@ properties:
>        List of the hardware port in respective IOMMU block for current Socs.
>        Refer to bindings/iommu/mediatek,iommu.yaml.
>  
> -  dma-ranges:
> -    maxItems: 1
> -    description: |
> -      Describes the physical address space of IOMMU maps to memory.
> -
>    mediatek,vpu:
>      $ref: /schemas/types.yaml#/definitions/phandle
>      description:
> diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
> index 0f2ea8d9a10c..a2051b31fa29 100644
> --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
> +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
> @@ -49,11 +49,6 @@ properties:
>        List of the hardware port in respective IOMMU block for current Socs.
>        Refer to bindings/iommu/mediatek,iommu.yaml.
>  
> -  dma-ranges:
> -    maxItems: 1
> -    description: |
> -      Describes the physical address space of IOMMU maps to memory.
> -
>    mediatek,vpu:
>      $ref: /schemas/types.yaml#/definitions/phandle
>      description:
> diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
> index c4f20acdc1f8..290594bc91cc 100644
> --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
> +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
> @@ -76,11 +76,6 @@ properties:
>        The node of system control processor (SCP), using
>        the remoteproc & rpmsg framework.
>  
> -  dma-ranges:
> -    maxItems: 1
> -    description: |
> -      Describes the physical address space of IOMMU maps to memory.
> -
>    "#address-cells":
>      const: 2
>  
> @@ -203,7 +198,6 @@ required:
>    - reg
>    - iommus
>    - mediatek,scp
> -  - dma-ranges
>    - ranges
>  
>  if:
> @@ -236,7 +230,6 @@ examples:
>              compatible = "mediatek,mt8192-vcodec-dec";
>              mediatek,scp = <&scp>;
>              iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>;
> -            dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
>              #address-cells = <2>;
>              #size-cells = <2>;
>              ranges = <0 0 0 0x16000000 0 0x40000>;

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property
  2023-01-13  8:25   ` Krzysztof Kozlowski
@ 2023-01-16  8:01     ` Yong Wu (吴勇)
  2023-01-16  8:06       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 24+ messages in thread
From: Yong Wu (吴勇) @ 2023-01-16  8:01 UTC (permalink / raw)
  To: joro, matthias.bgg, krzysztof.kozlowski, mchehab, robh+dt
  Cc: Andrew-CT Chen (陳智迪),
	linux-mediatek, linux-kernel,
	Youlin Pei (裴友林),
	Tiffany Lin (林慧珊),
	linux-media, devicetree, Anan Sun (孙安安),
	Libo Kang (康利波),
	kyrie.wu, robin.murphy, hverkuil,
	Chengci Xu (许承赐),
	Yunfei Dong (董云飞),
	YF Wang (王云飞),
	linux-arm-kernel, krzysztof.kozlowski+dt, iommu,
	Mingyuan Ma (马鸣远),
	angelogioacchino.delregno, will, nfraprado

On Fri, 2023-01-13 at 09:25 +0100, Krzysztof Kozlowski wrote:
> On 13/01/2023 07:01, Yong Wu wrote:
> > MediaTek iommu has already controlled the masters' iova ranges by
> > the
> > master's larb/port id. then the dma-ranges property is unnecessary
> > for

> Sentences in English always start with a capital letter, however also
> they do not start with "Then". Make it a proper a proper sentence.

Sorry for the syntax issues. I think it is "," before "then".

> > the master's node. the master is vcodec here.
> 
> Unnecessary or invalid? 

For mt8195, It is unnecessary. For the other SoC which doesn't use
parent/child node, the property is invalid, however, there is no vcodec
node have this property in this case in the current upstream dts nodes.

> Don't you depend now on some feature of driver
> added for example recently?

No. It doesn't depend on any the other patches. Just depend
on the code changing in this patchset. I just put the dt-binding
at the beginning of this series.

> > 
> > Cc: Tiffany Lin <tiffany.lin@mediatek.com>
> > Cc: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
> > Cc: Yunfei Dong <yunfei.dong@mediatek.com>
> > Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> 
> There is little point in storing output of get_maintainers.pl forever
> in
> the git log. If you need it for some reason, please keep it after -
> --.

I did get the list from get_maintainers.pl. Sorry that I didn't
differentiate.

Mainly I changed the iommu code but changed the media dt-binding.
Just expect the media owners/reviewers to take a look at this.

Thanks.

> > Cc: Matthias Brugger <matthias.bgg@gmail.com>
> > Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> > ---
> >  .../devicetree/bindings/media/mediatek,vcodec-decoder.yaml | 5 -
> > ----
> >  .../devicetree/bindings/media/mediatek,vcodec-encoder.yaml | 5 -
> > ----
> >  .../bindings/media/mediatek,vcodec-subdev-decoder.yaml     | 7 -
> > ------
> >  3 files changed, 17 deletions(-)
> > 
> > diff --git
> > a/Documentation/devicetree/bindings/media/mediatek,vcodec-
> > decoder.yaml
> > b/Documentation/devicetree/bindings/media/mediatek,vcodec-
> > decoder.yaml
> > index aa55ca65d6ed..fad59b486d5d 100644
> > --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-
> > decoder.yaml
> > +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-
> > decoder.yaml
> > @@ -56,11 +56,6 @@ properties:
> >        List of the hardware port in respective IOMMU block for
> > current Socs.
> >        Refer to bindings/iommu/mediatek,iommu.yaml.
> >  
> > -  dma-ranges:
> > -    maxItems: 1
> > -    description: |
> > -      Describes the physical address space of IOMMU maps to
> > memory.
> > -
> >    mediatek,vpu:
> >      $ref: /schemas/types.yaml#/definitions/phandle
> >      description:
> > diff --git
> > a/Documentation/devicetree/bindings/media/mediatek,vcodec-
> > encoder.yaml
> > b/Documentation/devicetree/bindings/media/mediatek,vcodec-
> > encoder.yaml
> > index 0f2ea8d9a10c..a2051b31fa29 100644
> > --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-
> > encoder.yaml
> > +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-
> > encoder.yaml
> > @@ -49,11 +49,6 @@ properties:
> >        List of the hardware port in respective IOMMU block for
> > current Socs.
> >        Refer to bindings/iommu/mediatek,iommu.yaml.
> >  
> > -  dma-ranges:
> > -    maxItems: 1
> > -    description: |
> > -      Describes the physical address space of IOMMU maps to
> > memory.
> > -
> >    mediatek,vpu:
> >      $ref: /schemas/types.yaml#/definitions/phandle
> >      description:
> > diff --git
> > a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-
> > decoder.yaml
> > b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-
> > decoder.yaml
> > index c4f20acdc1f8..290594bc91cc 100644
> > --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-
> > subdev-decoder.yaml
> > +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-
> > subdev-decoder.yaml
> > @@ -76,11 +76,6 @@ properties:
> >        The node of system control processor (SCP), using
> >        the remoteproc & rpmsg framework.
> >  
> > -  dma-ranges:
> > -    maxItems: 1
> > -    description: |
> > -      Describes the physical address space of IOMMU maps to
> > memory.
> > -
> >    "#address-cells":
> >      const: 2
> >  
> > @@ -203,7 +198,6 @@ required:
> >    - reg
> >    - iommus
> >    - mediatek,scp
> > -  - dma-ranges
> >    - ranges
> >  
> >  if:
> > @@ -236,7 +230,6 @@ examples:
> >              compatible = "mediatek,mt8192-vcodec-dec";
> >              mediatek,scp = <&scp>;
> >              iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>;
> > -            dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
> >              #address-cells = <2>;
> >              #size-cells = <2>;
> >              ranges = <0 0 0 0x16000000 0 0x40000>;
> 
> Best regards,
> Krzysztof
> 
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property
  2023-01-16  8:01     ` Yong Wu (吴勇)
@ 2023-01-16  8:06       ` Krzysztof Kozlowski
  2023-01-16  9:16         ` Yong Wu (吴勇)
  0 siblings, 1 reply; 24+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-16  8:06 UTC (permalink / raw)
  To: Yong Wu (吴勇), joro, matthias.bgg, mchehab, robh+dt
  Cc: Andrew-CT Chen (陳智迪),
	linux-mediatek, linux-kernel,
	Youlin Pei (裴友林),
	Tiffany Lin (林慧珊),
	linux-media, devicetree, Anan Sun (孙安安),
	Libo Kang (康利波),
	kyrie.wu, robin.murphy, hverkuil,
	Chengci Xu (许承赐),
	Yunfei Dong (董云飞),
	YF Wang (王云飞),
	linux-arm-kernel, krzysztof.kozlowski+dt, iommu,
	Mingyuan Ma (马鸣远),
	angelogioacchino.delregno, will, nfraprado

On 16/01/2023 09:01, Yong Wu (吴勇) wrote:
> On Fri, 2023-01-13 at 09:25 +0100, Krzysztof Kozlowski wrote:
>> On 13/01/2023 07:01, Yong Wu wrote:
>>> MediaTek iommu has already controlled the masters' iova ranges by
>>> the
>>> master's larb/port id. then the dma-ranges property is unnecessary
>>> for
> 
>> Sentences in English always start with a capital letter, however also
>> they do not start with "Then". Make it a proper a proper sentence.
> 
> Sorry for the syntax issues. I think it is "," before "then".
> 
>>> the master's node. the master is vcodec here.
>>
>> Unnecessary or invalid? 
> 
> For mt8195, It is unnecessary. For the other SoC which doesn't use
> parent/child node, the property is invalid, however, there is no vcodec
> node have this property in this case in the current upstream dts nodes.
> 
>> Don't you depend now on some feature of driver
>> added for example recently?
> 
> No. It doesn't depend on any the other patches. Just depend
> on the code changing in this patchset. I just put the dt-binding
> at the beginning of this series.

So this is an ABI change where you expect no upstream users to be
affected? Why you do not clarify it in commit msg?

> 
>>>
>>> Cc: Tiffany Lin <tiffany.lin@mediatek.com>
>>> Cc: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
>>> Cc: Yunfei Dong <yunfei.dong@mediatek.com>
>>> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
>>> Cc: Rob Herring <robh+dt@kernel.org>
>>> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
>>
>> There is little point in storing output of get_maintainers.pl forever
>> in
>> the git log. If you need it for some reason, please keep it after -
>> --.
> 
> I did get the list from get_maintainers.pl. Sorry that I didn't
> differentiate.

Getting the list from get_maintainers.pl is correct but storing it
forever in git log is really unnecessary. It's not useful. It's just
automated output, reproducible at any given time.

> 


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property
  2023-01-16  8:06       ` Krzysztof Kozlowski
@ 2023-01-16  9:16         ` Yong Wu (吴勇)
  2023-01-17 10:44           ` Krzysztof Kozlowski
  0 siblings, 1 reply; 24+ messages in thread
From: Yong Wu (吴勇) @ 2023-01-16  9:16 UTC (permalink / raw)
  To: krzysztof.kozlowski
  Cc: linux-kernel, linux-mediatek,
	Youlin Pei (裴友林),
	Tiffany Lin (林慧珊),
	robh+dt, linux-media, devicetree,
	Anan Sun (孙安安),
	Libo Kang (康利波),
	kyrie.wu, robin.murphy, hverkuil,
	Chengci Xu (许承赐),
	mchehab, joro, Yunfei Dong (董云飞),
	YF Wang (王云飞),
	nfraprado, linux-arm-kernel, krzysztof.kozlowski+dt, iommu,
	matthias.bgg, Mingyuan Ma (马鸣远),
	Andrew-CT Chen (陳智迪),
	angelogioacchino.delregno, will

On Mon, 2023-01-16 at 09:06 +0100, Krzysztof Kozlowski wrote:
> On 16/01/2023 09:01, Yong Wu (吴勇) wrote:
> > On Fri, 2023-01-13 at 09:25 +0100, Krzysztof Kozlowski wrote:
> > > On 13/01/2023 07:01, Yong Wu wrote:
> > > > MediaTek iommu has already controlled the masters' iova ranges
> > > > by
> > > > the
> > > > master's larb/port id. then the dma-ranges property is
> > > > unnecessary
> > > > for
> > > Sentences in English always start with a capital letter, however
> > > also
> > > they do not start with "Then". Make it a proper a proper
> > > sentence.
> > 
> > Sorry for the syntax issues. I think it is "," before "then".
> > 
> > > > the master's node. the master is vcodec here.
> > > 
> > > Unnecessary or invalid? 
> > 
> > For mt8195, It is unnecessary. For the other SoC which doesn't use
> > parent/child node, the property is invalid, however, there is no
> > vcodec
> > node have this property in this case in the current upstream dts
> > nodes.
> > 
> > > Don't you depend now on some feature of driver
> > > added for example recently?
> > 
> > No. It doesn't depend on any the other patches. Just depend
> > on the code changing in this patchset. I just put the dt-binding
> > at the beginning of this series.
> 
> So this is an ABI change where you expect no upstream users to be
> affected? Why you do not clarify it in commit msg?

Sorry I missed a venc node. In [9/10] of this series, I deleted this
property for mt8195 venc node, this has a little affect. 

VENC would like to locate the IOVA range of 4G-8G. Without this
patchset, It will fallback to 0-4GB. But this is not a fatal issue. It 
also work fine with 0-4GB iova. I will comment this in the commit
message in the next version.

> > > > 
> > > > Cc: Tiffany Lin <tiffany.lin@mediatek.com>
> > > > Cc: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
> > > > Cc: Yunfei Dong <yunfei.dong@mediatek.com>
> > > > Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> > > > Cc: Rob Herring <robh+dt@kernel.org>
> > > > Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> > > 
> > > There is little point in storing output of get_maintainers.pl
> > > forever
> > > in
> > > the git log. If you need it for some reason, please keep it after
> > > -
> > > --.
> > 
> > I did get the list from get_maintainers.pl. Sorry that I didn't
> > differentiate.
> 
> Getting the list from get_maintainers.pl is correct but storing it
> forever in git log is really unnecessary. It's not useful. It's just
> automated output, reproducible at any given time.

This patchset crosses several domains. This patch is about vcodec, the
next one is about jpeg and the later ones are about iommu.
The reviewers may be different, thus I use "Cc:" here. is this OK in
this case? or I should remove this, and put all of them in the cc list
of the mail.

Thanks.

> > 
> 
> Best regards,
> Krzysztof
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 07/10] iommu/mediatek: Add a gap for the iova regions
  2023-01-13  6:01 ` [PATCH 07/10] iommu/mediatek: Add a gap for the iova regions Yong Wu
@ 2023-01-16  9:46   ` AngeloGioacchino Del Regno
  2023-01-17  2:53     ` Yong Wu (吴勇)
  2023-02-14  5:33     ` Yong Wu (吴勇)
  0 siblings, 2 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-16  9:46 UTC (permalink / raw)
  To: Yong Wu, Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab,
	Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, mingyuan.ma, yf.wang,
	libo.kang, Yunfei Dong, kyrie wu, chengci.xu, youlin.pei,
	anan.sun

Il 13/01/23 07:01, Yong Wu ha scritto:
> Currenly masters can not indicate its special dma-ranges. Prepare
> for vcodec. some vcodec end address is address + size, if our size
> is 4G, the end address may be 0x2_0000_0000. and the
> register is u32, then it may get zero. thus add a gap(8M) for
> all the regions.
> 
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>

I definitely agree on the fact that we do *need* this series... but this
particular commit looks like a hack.

I'm not convinced: I have a hunch that this one will sooner or later backfire
on us and break things again... at the same time, I'm not sure how to do this
properly at this point (I didn't do any research, anyway).

Ideas?

Regards,
Angelo


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 08/10] arm64: dts: mt8195: Add dma-ranges for the parent "soc" node
  2023-01-13  6:01 ` [PATCH 08/10] arm64: dts: mt8195: Add dma-ranges for the parent "soc" node Yong Wu
@ 2023-01-16  9:47   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-16  9:47 UTC (permalink / raw)
  To: Yong Wu, Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab,
	Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, mingyuan.ma, yf.wang,
	libo.kang, Yunfei Dong, kyrie wu, chengci.xu, youlin.pei,
	anan.sun

Il 13/01/23 07:01, Yong Wu ha scritto:
> 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 <yong.wu@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 10/10] arm64: dts: mt8186: Add dma-ranges for the parent "soc" node
  2023-01-13  6:01 ` [PATCH 10/10] arm64: dts: mt8186: Add dma-ranges for the parent "soc" node Yong Wu
@ 2023-01-16  9:47   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-16  9:47 UTC (permalink / raw)
  To: Yong Wu, Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab,
	Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, mingyuan.ma, yf.wang,
	libo.kang, Yunfei Dong, kyrie wu, chengci.xu, youlin.pei,
	anan.sun

Il 13/01/23 07:01, Yong Wu ha scritto:
> Prepare for the MM nodes whose dma-ranges(iova range) is 16GB.
> 
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 09/10] arm64: dts: mt8195: Remove the unnecessary dma-ranges
  2023-01-13  6:01 ` [PATCH 09/10] arm64: dts: mt8195: Remove the unnecessary dma-ranges Yong Wu
@ 2023-01-16  9:47   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-16  9:47 UTC (permalink / raw)
  To: Yong Wu, Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab,
	Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, mingyuan.ma, yf.wang,
	libo.kang, Yunfei Dong, kyrie wu, chengci.xu, youlin.pei,
	anan.sun

Il 13/01/23 07:01, Yong Wu ha scritto:
> After we add the dma-ranges in the parent "soc" node,
> this property is unnecessary for the leaf node.
> 
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 02/10] dt-bindings: media: mediatek,jpeg: Remove dma-ranges property
  2023-01-13  6:01 ` [PATCH 02/10] dt-bindings: media: mediatek,jpeg: " Yong Wu
@ 2023-01-16  9:47   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-16  9:47 UTC (permalink / raw)
  To: Yong Wu, Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab,
	Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, mingyuan.ma, yf.wang,
	libo.kang, Yunfei Dong, kyrie wu, chengci.xu, youlin.pei,
	anan.sun, Bin Liu, Xia Jiang

Il 13/01/23 07:01, Yong Wu ha scritto:
> Mediatek IOMMU has already controlled the masters' iova ranges by the
> master's larb/port id. then the dma-ranges property is unnecessary for
> the master's node. the master is jpeg here.
> 
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: Bin Liu <bin.liu@mediatek.com>
> Cc: kyrie wu <kyrie.wu@mediatek.corp-partner.google.com>
> Cc: Xia Jiang <xia.jiang@mediatek.com>
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property
  2023-01-13  6:01 ` [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property Yong Wu
  2023-01-13  8:25   ` Krzysztof Kozlowski
@ 2023-01-16  9:47   ` AngeloGioacchino Del Regno
  1 sibling, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-16  9:47 UTC (permalink / raw)
  To: Yong Wu, Joerg Roedel, Matthias Brugger, Mauro Carvalho Chehab,
	Rob Herring
  Cc: Will Deacon, Robin Murphy, Krzysztof Kozlowski, Hans Verkuil,
	nfraprado, linux-media, devicetree, linux-arm-kernel,
	linux-mediatek, linux-kernel, iommu, mingyuan.ma, yf.wang,
	libo.kang, Yunfei Dong, kyrie wu, chengci.xu, youlin.pei,
	anan.sun, Tiffany Lin, Andrew-CT Chen

Il 13/01/23 07:01, Yong Wu ha scritto:
> MediaTek iommu has already controlled the masters' iova ranges by the
> master's larb/port id. then the dma-ranges property is unnecessary for
> the master's node. the master is vcodec here.
> 
> Cc: Tiffany Lin <tiffany.lin@mediatek.com>
> Cc: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
> Cc: Yunfei Dong <yunfei.dong@mediatek.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 07/10] iommu/mediatek: Add a gap for the iova regions
  2023-01-16  9:46   ` AngeloGioacchino Del Regno
@ 2023-01-17  2:53     ` Yong Wu (吴勇)
  2023-02-14  5:33     ` Yong Wu (吴勇)
  1 sibling, 0 replies; 24+ messages in thread
From: Yong Wu (吴勇) @ 2023-01-17  2:53 UTC (permalink / raw)
  To: joro, matthias.bgg, mchehab, angelogioacchino.delregno, robh+dt
  Cc: linux-mediatek, linux-kernel,
	Youlin Pei (裴友林),
	linux-media, devicetree, Anan Sun (孙安安),
	Libo Kang (康利波),
	kyrie.wu, robin.murphy, hverkuil,
	Chengci Xu (许承赐),
	Yunfei Dong (董云飞),
	YF Wang (王云飞),
	linux-arm-kernel, krzysztof.kozlowski+dt, iommu,
	Mingyuan Ma (马鸣远),
	will, nfraprado

On Mon, 2023-01-16 at 10:46 +0100, AngeloGioacchino Del Regno wrote:
> Il 13/01/23 07:01, Yong Wu ha scritto:
> > Currenly masters can not indicate its special dma-ranges. Prepare
> > for vcodec. some vcodec end address is address + size, if our size
> > is 4G, the end address may be 0x2_0000_0000. and the
> > register is u32, then it may get zero. thus add a gap(8M) for
> > all the regions.
> > 
> > Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> 
> I definitely agree on the fact that we do *need* this series... 

Thanks very much for your review.

> but this particular commit looks like a hack.
> 
> I'm not convinced: I have a hunch that this one will sooner or later
> backfire
> on us and break things again... at the same time, I'm not sure how to
> do this
> properly at this point (I didn't do any research, anyway).

I got a real vcodec issue described in the commit message. As you may
see in the vcodec's dt-binding example[1/10] or the dts node[9/10],
their length is 0xfff00000 that means they use 1M as the gap. Vcodec
use this for a long time. After this patchset, this property is unused,
then I have to take care of this in the iommu, therefore this patch is
required, and I just give a bigger gap(8M) here.

> 
> Ideas?
> 
> Regards,
> Angelo
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property
  2023-01-16  9:16         ` Yong Wu (吴勇)
@ 2023-01-17 10:44           ` Krzysztof Kozlowski
  0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2023-01-17 10:44 UTC (permalink / raw)
  To: Yong Wu (吴勇)
  Cc: linux-kernel, linux-mediatek,
	Youlin Pei (裴友林),
	Tiffany Lin (林慧珊),
	robh+dt, linux-media, devicetree,
	Anan Sun (孙安安),
	Libo Kang (康利波),
	kyrie.wu, robin.murphy, hverkuil,
	Chengci Xu (许承赐),
	mchehab, joro, Yunfei Dong (董云飞),
	YF Wang (王云飞),
	nfraprado, linux-arm-kernel, krzysztof.kozlowski+dt, iommu,
	matthias.bgg, Mingyuan Ma (马鸣远),
	Andrew-CT Chen (陳智迪),
	angelogioacchino.delregno, will

On 16/01/2023 10:16, Yong Wu (吴勇) wrote:
>>>>>
>>>>> Cc: Tiffany Lin <tiffany.lin@mediatek.com>
>>>>> Cc: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
>>>>> Cc: Yunfei Dong <yunfei.dong@mediatek.com>
>>>>> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
>>>>> Cc: Rob Herring <robh+dt@kernel.org>
>>>>> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
>>>>
>>>> There is little point in storing output of get_maintainers.pl
>>>> forever
>>>> in
>>>> the git log. If you need it for some reason, please keep it after
>>>> -
>>>> --.
>>>
>>> I did get the list from get_maintainers.pl. Sorry that I didn't
>>> differentiate.
>>
>> Getting the list from get_maintainers.pl is correct but storing it
>> forever in git log is really unnecessary. It's not useful. It's just
>> automated output, reproducible at any given time.
> 
> This patchset crosses several domains. This patch is about vcodec, the
> next one is about jpeg and the later ones are about iommu.
> The reviewers may be different, thus I use "Cc:" here. is this OK in
> this case? 

I guess we do not talk about the same thing. It does not matter that
reviewers are different. They are all different. Please show me the
direct benefit of storing automated output from a tool in Git log.

> or I should remove this, and put all of them in the cc list
> of the mail.

I gave you the instruction at beginning, some mails ago...

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 07/10] iommu/mediatek: Add a gap for the iova regions
  2023-01-16  9:46   ` AngeloGioacchino Del Regno
  2023-01-17  2:53     ` Yong Wu (吴勇)
@ 2023-02-14  5:33     ` Yong Wu (吴勇)
  1 sibling, 0 replies; 24+ messages in thread
From: Yong Wu (吴勇) @ 2023-02-14  5:33 UTC (permalink / raw)
  To: joro, matthias.bgg, mchehab, angelogioacchino.delregno, robh+dt
  Cc: linux-mediatek, linux-kernel,
	Youlin Pei (裴友林),
	linux-media, devicetree, Anan Sun (孙安安),
	Libo Kang (康利波),
	kyrie.wu, robin.murphy, hverkuil,
	Chengci Xu (许承赐),
	Yunfei Dong (董云飞),
	YF Wang (王云飞),
	linux-arm-kernel, krzysztof.kozlowski+dt, iommu,
	Mingyuan Ma (马鸣远),
	will, nfraprado

On Mon, 2023-01-16 at 10:46 +0100, AngeloGioacchino Del Regno wrote:
> Il 13/01/23 07:01, Yong Wu ha scritto:
> > Currenly masters can not indicate its special dma-ranges. Prepare
> > for vcodec. some vcodec end address is address + size, if our size
> > is 4G, the end address may be 0x2_0000_0000. and the
> > register is u32, then it may get zero. thus add a gap(8M) for
> > all the regions.
> > 
> > Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> 
> I definitely agree on the fact that we do *need* this series... 

Thanks very much for your review.

> but this particular commit looks like a hack.
> 
> I'm not convinced: I have a hunch that this one will sooner or later
> backfire
> on us and break things again... at the same time, I'm not sure how to
> do this
> properly at this point (I didn't do any research, anyway).

I got a real vcodec issue described in the commit message. As you may
see in the vcodec's dt-binding example[1/10] or the dts node[9/10],
their length is 0xfff00000 that means they use 1M as the gap. Vcodec
use this for a long time. After this patchset, this property is unused,
then I have to take care this in the iommu, therefore this patch is
required, and I just give a bigger gap(8M) here.

> 
> Ideas?
> 
> Regards,
> Angelo
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2023-02-14  5:33 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13  6:01 [PATCH 00/10] Adjust the dma-ranges for MTK IOMMU Yong Wu
2023-01-13  6:01 ` [PATCH 01/10] dt-bindings: media: mediatek,vcodec: Remove dma-ranges property Yong Wu
2023-01-13  8:25   ` Krzysztof Kozlowski
2023-01-16  8:01     ` Yong Wu (吴勇)
2023-01-16  8:06       ` Krzysztof Kozlowski
2023-01-16  9:16         ` Yong Wu (吴勇)
2023-01-17 10:44           ` Krzysztof Kozlowski
2023-01-16  9:47   ` AngeloGioacchino Del Regno
2023-01-13  6:01 ` [PATCH 02/10] dt-bindings: media: mediatek,jpeg: " Yong Wu
2023-01-16  9:47   ` AngeloGioacchino Del Regno
2023-01-13  6:01 ` [PATCH 03/10] iommu/mediatek: Get regionid from larb/port id Yong Wu
2023-01-13  6:01 ` [PATCH 04/10] iommu/mediatek: mt8195: Add larb_region_msk Yong Wu
2023-01-13  6:01 ` [PATCH 05/10] iommu/mediatek: mt8186: add larb_region_msk Yong Wu
2023-01-13  6:01 ` [PATCH 06/10] iommu/mediatek: mt8192: " Yong Wu
2023-01-13  6:01 ` [PATCH 07/10] iommu/mediatek: Add a gap for the iova regions Yong Wu
2023-01-16  9:46   ` AngeloGioacchino Del Regno
2023-01-17  2:53     ` Yong Wu (吴勇)
2023-02-14  5:33     ` Yong Wu (吴勇)
2023-01-13  6:01 ` [PATCH 08/10] arm64: dts: mt8195: Add dma-ranges for the parent "soc" node Yong Wu
2023-01-16  9:47   ` AngeloGioacchino Del Regno
2023-01-13  6:01 ` [PATCH 09/10] arm64: dts: mt8195: Remove the unnecessary dma-ranges Yong Wu
2023-01-16  9:47   ` AngeloGioacchino Del Regno
2023-01-13  6:01 ` [PATCH 10/10] arm64: dts: mt8186: Add dma-ranges for the parent "soc" node Yong Wu
2023-01-16  9:47   ` AngeloGioacchino Del Regno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).