[PATCH v5 9/9] dma_buf: heaps: restricted_heap_mtk: Add a new CMA heap

2024-05-15 Thread Yong Wu
release the buffer, then kernel may reuse it. For the "CMA" restricted heap, "struct cma *cma" is a common property, not just for MediaTek, so put it into "struct restricted_heap" instead of our private data. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/Kconfig

[PATCH v5 8/9] dma-buf: heaps: restricted_heap_mtk: Add TEE memory service call

2024-05-15 Thread Yong Wu
ith the ALLOC command above. 3) MTK_TZCMD_SECMEM_RETRIEVE_SG: If the tee buffer is discrete, this command can retrieve the detailed PA list from the TEE with which the kernel will initialize the sg table. Of course, if the tee buffer is contiguous, the PA will be obtained directly from MTK_TZCMD_SECMEM_Z

[PATCH v5 7/9] dma-buf: heaps: restricted_heap: Add MediaTek restricted heap and heap_init

2024-05-15 Thread Yong Wu
the first time. b) Add a priv_data for each heap, like the special data used by MTK (such as "TEE session") can be placed in priv_data. Currently our heap depends on CMA which could only be bool, thus depend on "TEE=y". Signed-off-by: Yong Wu --- drivers/d

[PATCH v5 6/9] dma-buf: heaps: restricted_heap: Add dma_ops

2024-05-15 Thread Yong Wu
check if this is a restricted buffer by sg_dma_is_restricted. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/restricted_heap.c | 102 drivers/dma-buf/heaps/restricted_heap.h | 2 + 2 files changed, 104 insertions(+) diff --git a/drivers/dma-buf/heaps

[PATCH v5 5/9] dma-buf: heaps: restricted_heap: Add private heap ops

2024-05-15 Thread Yong Wu
Add "struct restricted_heap_ops". For the restricted memory, totally there are two steps: a) alloc: Allocate the buffer in kernel; b) restrict_buf: Restrict/Protect/Secure that buffer. The "alloc" is mandatory while "restrict_buf" is optional since it may be part of

[PATCH v5 4/9] dma-buf: heaps: Initialize a restricted heap

2024-05-15 Thread Yong Wu
Initialize a restricted heap. Currently just add a null heap, Prepare for the later patches. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/Kconfig | 9 drivers/dma-buf/heaps/Makefile | 3 +- drivers/dma-buf/heaps/restricted_heap.c | 67

[PATCH v5 3/9] lib/scatterlist: Add sg_dup_table

2024-05-15 Thread Yong Wu
Prepare for the restricted heap to reuse, move it out from system_heap.c. To keep the function name consistent, rename it to sg_dup_table. Cc: Andrew Morton Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/system_heap.c | 27 +-- include/linux/scatterlist.h | 2

[PATCH v5 2/9] scatterlist: Add a flag for the restricted memory

2024-05-15 Thread Yong Wu
Introduce a FLAG for the restricted memory which means the memory is protected by TEE or hypervisor, then it's inaccessiable for kernel. Currently we don't use sg_dma_unmark_restricted, thus this interface has not been added. Signed-off-by: Yong Wu --- include/linux/scatterl

[PATCH v5 1/9] dt-bindings: reserved-memory: Add mediatek, dynamic-restricted-region

2024-05-15 Thread Yong Wu
MTK_TZCMD_SECMEM_ZALLOC and MTK_TZCMD_SECMEM_FREE. Signed-off-by: Yong Wu --- .../mediatek,dynamic-restricted-region.yaml | 43 +++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/reserved-memory/mediatek,dynamic-restricted-region.yaml diff --git a

[PATCH v5 0/9] dma-buf: heaps: Add restricted heap

2024-05-15 Thread Yong Wu
nterface, which tries to make uuid more generic, not working. If there is other way to make UUID more general, please free to tell me. v1: https://lore.kernel.org/linux-mediatek/20230911023038.30649-1-yong...@mediatek.com/ Base on v6.6-rc1. Yong Wu (9): dt-bindings: reser

[PATCH v4 7/7] dma_buf: heaps: restricted_heap_mtk: Add a new CMA heap

2024-01-12 Thread Yong Wu
release the buffer, then kernel may reuse it. For the "CMA" restricted heap, "struct cma *cma" is a common property, not just for MediaTek, so put it into "struct restricted_heap" instead of our private data. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/Kconfig

[PATCH v4 6/7] dma-buf: heaps: restricted_heap_mtk: Add TEE memory service call

2024-01-12 Thread Yong Wu
ecure handle"/"secure address". To make the name more general, We call it "restricted_addr" here. The restricted_addr is a reference to a secure buffer within TEE. We put it in the sg_dma_address, please see the comment in code. Signed-off-by: Yong Wu --- drivers/dma-buf/he

[PATCH v4 5/7] dma-buf: heaps: restricted_heap: Add MediaTek restricted heap and heap_init

2024-01-12 Thread Yong Wu
the first time. b) Add a priv_data for each heap, like the special data used by MTK (such as "TEE session") can be placed in priv_data. Currently our heap depends on CMA which could only be bool, thus depend on "TEE=y". Signed-off-by: Yong Wu --- drivers/d

[PATCH v4 4/7] dma-buf: heaps: restricted_heap: Add dma_ops

2024-01-12 Thread Yong Wu
Add the dma_ops for this restricted heap. For restricted buffer, cache_ops/mmap are not allowed, thus return EPERM for them. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/restricted_heap.c | 103 1 file changed, 103 insertions(+) diff --git a/drivers/dma-buf/heaps

[PATCH v4 3/7] dma-buf: heaps: restricted_heap: Add private heap ops

2024-01-12 Thread Yong Wu
mory_alloc. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/restricted_heap.c | 41 - drivers/dma-buf/heaps/restricted_heap.h | 12 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/drivers/dma-buf/heaps/restricted_heap.c b/drivers/dma-buf/heaps/restric

[PATCH v4 2/7] dma-buf: heaps: Initialize a restricted heap

2024-01-12 Thread Yong Wu
Initialize a restricted heap. Currently just add a null heap, Prepare for the later patches. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/Kconfig | 9 drivers/dma-buf/heaps/Makefile | 3 +- drivers/dma-buf/heaps/restricted_heap.c | 67

[PATCH v4 1/7] dt-bindings: reserved-memory: Add mediatek, dynamic-restricted-region

2024-01-12 Thread Yong Wu
MTK_TZCMD_SECMEM_ZALLOC and MTK_TZCMD_SECMEM_FREE. Signed-off-by: Yong Wu --- .../mediatek,dynamic-restricted-region.yaml | 43 +++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/reserved-memory/mediatek,dynamic-restricted-region.yaml diff --git a

[PATCH v4 0/7] dma-buf: heaps: Add restricted heap

2024-01-12 Thread Yong Wu
face, which tries to make uuid more generic, not working. If there is other way to make UUID more general, please free to tell me. v1: https://lore.kernel.org/linux-mediatek/20230911023038.30649-1-yong...@mediatek.com/ Base on v6.6-rc1. Yong Wu (7): dt-bindings: reserved-memor

[PATCH v3 7/7] dma_buf: heaps: secure_heap_mtk: Add a new CMA heap

2023-12-11 Thread Yong Wu
release the buffer, then kernel may reuse it. For the "CMA" secure heap, "struct cma *cma" is a common property, not just for MediaTek, so put it into "struct secure_heap" instead of our private data. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/Kconfig

[PATCH v3 6/7] dma-buf: heaps: secure_heap_mtk: Add tee memory service call

2023-12-11 Thread Yong Wu
ecure address". The secure_address is a reference to a secure buffer within TEE. We put it in the sg_dma_address, please see the comment in code. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/secure_heap.c | 16 + drivers/dma-buf/heaps/secure_heap.h | 2 + drivers/dma

[PATCH v3 5/7] dma-buf: heaps: secure_heap: Add MediaTek secure heap and heap_init

2023-12-11 Thread Yong Wu
time. b) Add a priv_data for each heap, like the special data used by MTK (such as "TEE session") can be placed in priv_data. Currently our heap depends on CMA which could only be bool, thus depend on "TEE=y". Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/Kconfig

[PATCH v3 4/7] dma-buf: heaps: secure_heap: Add dma_ops

2023-12-11 Thread Yong Wu
Add the dma_ops for this secure heap. For secure buffer, cache_ops/mmap are not allowed, thus return EPERM for them. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/secure_heap.c | 103 1 file changed, 103 insertions(+) diff --git a/drivers/dma-buf/heaps

[PATCH v3 3/7] dma-buf: heaps: secure_heap: Add private heap ops

2023-12-11 Thread Yong Wu
ned-off-by: Yong Wu --- drivers/dma-buf/heaps/secure_heap.c | 39 - drivers/dma-buf/heaps/secure_heap.h | 11 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/drivers/dma-buf/heaps/secure_heap.c b/drivers/dma-buf/heaps/secure_heap.c index e0

[PATCH v3 1/7] dt-bindings: reserved-memory: Add mediatek, dynamic-secure-region

2023-12-11 Thread Yong Wu
MTK_TZCMD_SECMEM_ZALLOC and MTK_TZCMD_SECMEM_FREE. Signed-off-by: Yong Wu --- .../mediatek,dynamic-secure-region.yaml | 43 +++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/reserved-memory/mediatek,dynamic-secure-region.yaml diff --git a

[PATCH v3 2/7] dma-buf: heaps: Initialize a secure heap

2023-12-11 Thread Yong Wu
Initialize a secure heap. Currently just add a null heap, Prepare for the later patches. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/Kconfig | 6 +++ drivers/dma-buf/heaps/Makefile | 1 + drivers/dma-buf/heaps/secure_heap.c | 67 + drivers/dma-buf

[PATCH v3 0/7] dma-buf: heaps: Add secure heap

2023-12-11 Thread Yong Wu
D more general, please free to tell me. v1: https://lore.kernel.org/linux-mediatek/20230911023038.30649-1-yong...@mediatek.com/ Base on v6.6-rc1. Yong Wu (7): dt-bindings: reserved-memory: Add mediatek,dynamic-secure-region dma-buf: heaps: Initialize a secure heap dma-buf: he

[PATCH v2 8/8] dma-buf: heaps: secure_heap: Add normal CMA heap

2023-11-11 Thread Yong Wu
Add a normal CMA heap which use the standard cma allocate. Signed-off-by: Yong Wu --- Hi Vijay and Jaskaran, For this heap, 1) It uses sec_heap_buf_ops currently. I guess we cann't use the cma_heap_buf_ops. since if it is secure buffer, some operations such as mmap should not be allowed.

[PATCH v2 7/8] dma_buf: heaps: secure_heap: Add a new MediaTek CMA heap

2023-11-11 Thread Yong Wu
. Meanwhile, this patch adds a "heap_init" pointer, while allows some heap initialization operations. This case also checks if the CMA range is ready. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/secure_heap.c | 124 +++- 1 file changed, 122 insertions(+), 2 deletion

[PATCH v2 6/8] dt-bindings: reserved-memory: Add secure CMA reserved memory range

2023-11-11 Thread Yong Wu
Add a binding for describing the secure CMA reserved memory range. The memory range also will be defined in the TEE firmware. It means the TEE will be configured with the same address/size that is being set in this DT node. Signed-off-by: Yong Wu --- .../reserved-memory/secure_cma_region.yaml

[PATCH v2 5/8] dma-buf: heaps: secure_heap: Add dma_ops

2023-11-11 Thread Yong Wu
Add the dma_ops for this secure heap. a) For secure buffer, cache_ops/mmap are not allowed, thus return EPERM for them. b) The secure buffer can't be accessed in kernel, thus it doesn't have va/dma_address for it. Use the dma_address property to save the "secure handle". Si

[PATCH v2 4/8] dma-buf: heaps: secure_heap: Add tee memory service call

2023-11-11 Thread Yong Wu
the ops of secure_the_memory. It seems that secure_heap_tee_service_call could be a more general interface, but it could be a new topic. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/secure_heap.c | 97 + 1 file changed, 97 insertions(+) diff --git a/drivers/dma-buf/heaps/sec

[PATCH v2 3/8] dma-buf: heaps: secure_heap: Initialize tee session

2023-11-11 Thread Yong Wu
at it doesn't enter TEE to protect the buffer, there may be other ways to protect the buffer. All the MTK chrome projects use this UUID. The UUID is only used in the kernelspace while userspace never use it. The userspace could allocate the secure memory via the existing dma-buf ioctl. Signed-off-b

[PATCH v2 2/8] dma-buf: heaps: secure_heap: Add private heap ops

2023-11-11 Thread Yong Wu
For the secure memory, there are two steps: a) Allocate buffers in kernel side; b) Secure that buffer. Different heaps may have different buffer allocation methods and different memory protection methods. Here abstract the memory allocation and securing operations. Signed-off-by: Yong Wu

[PATCH v2 1/8] dma-buf: heaps: Initialize a secure heap

2023-11-11 Thread Yong Wu
Initialize a secure heap. Currently just add a null heap, Prepare for the later patches. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/Kconfig | 7 +++ drivers/dma-buf/heaps/Makefile | 1 + drivers/dma-buf/heaps/secure_heap.c | 98 + 3 files changed

[PATCH v2 0/8] dma-buf: heaps: Add secure heap

2023-11-11 Thread Yong Wu
re is other way to make UUID more general, please free to tell me. v1: https://lore.kernel.org/linux-mediatek/20230911023038.30649-1-yong...@mediatek.com/ Base on v6.6-rc1. Yong Wu (8): dma-buf: heaps: Initialize a secure heap dma-buf: heaps: secure_heap: Add private heap ops dma-bu

[PATCH 9/9] dma_buf: heaps: mtk_sec_heap: Add a new CMA heap

2023-09-10 Thread Yong Wu
buffer, then kernel may reuse it. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/Kconfig | 2 +- drivers/dma-buf/heaps/mtk_secure_heap.c | 121 +++- 2 files changed, 119 insertions(+), 4 deletions(-) diff --git a/drivers/dma-buf/heaps/Kconfig b/drivers/dma-buf/heaps

[PATCH 8/9] dt-bindings: reserved-memory: MediaTek: Add reserved memory for SVP

2023-09-10 Thread Yong Wu
This adds the binding for describing a CMA memory for MediaTek SVP(Secure Video Path). Signed-off-by: Yong Wu --- .../mediatek,secure_cma_chunkmem.yaml | 42 +++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/reserved-memory

[PATCH 7/9] dma-buf: heaps: mtk_sec_heap: Add dma_ops

2023-09-10 Thread Yong Wu
ned-off-by: Anan Sun Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/mtk_secure_heap.c | 116 1 file changed, 116 insertions(+) diff --git a/drivers/dma-buf/heaps/mtk_secure_heap.c b/drivers/dma-buf/heaps/mtk_secure_heap.c index 14c2a16a7164..daf6cf2121a1 100644 --- a/d

[PATCH 6/9] dma-buf: heaps: mtk_sec_heap: Add tee service call for buffer allocating/freeing

2023-09-10 Thread Yong Wu
Add TEE service call for secure memory allocating/freeing. Signed-off-by: Anan Sun Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/mtk_secure_heap.c | 69 - 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/drivers/dma-buf/heaps/mtk_secure_heap.c b/drivers

[PATCH 5/9] dma-buf: heaps: mtk_sec_heap: Initialise tee session

2023-09-10 Thread Yong Wu
The TEE probe later than dma-buf heap, and PROBE_DEDER doesn't work here since this is not a platform driver, therefore initialise the TEE context/session while we allocate the first secure buffer. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/mtk_secure_heap.c

[PATCH 4/9] dma-buf: heaps: Initialise MediaTek secure heap

2023-09-10 Thread Yong Wu
Initialise a mtk_svp heap. Currently just add a null heap, Prepare for the later patches. Signed-off-by: Yong Wu --- drivers/dma-buf/heaps/Kconfig | 8 ++ drivers/dma-buf/heaps/Makefile | 1 + drivers/dma-buf/heaps/mtk_secure_heap.c | 99 + 3 files

[PATCH 3/9] dma-heap: Provide accessors so that in-kernel drivers can allocate dmabufs from specific heaps

2023-09-10 Thread Yong Wu
for a pipeline, so it would likely be best for drivers to import and fill DMA-BUFs allocated by userland instead of allocating one themselves, but this is still up for debate. Signed-off-by: John Stultz Signed-off-by: T.J. Mercier Signed-off-by: Yong Wu [Yong: Fix the checkpatch alignment wa

[PATCH 2/9] dma-heap: Add proper kref handling on dma-buf heaps

2023-09-10 Thread Yong Wu
perly free things. Signed-off-by: John Stultz Signed-off-by: T.J. Mercier Signed-off-by: Yong Wu [Yong: Just add comment for "minor" and "refcount"] --- drivers/dma-buf/dma-heap.c | 38 ++ include/linux/dma-heap.h | 6 ++ 2 files cha

[PATCH 1/9] dma-buf: heaps: Deduplicate docs and adopt common format

2023-09-10 Thread Yong Wu
leanup. Remove multiple unused includes. Signed-off-by: T.J. Mercier Signed-off-by: Yong Wu [Yong: Just add a comment for "priv" to mute build warning] --- drivers/dma-buf/dma-heap.c | 29 +++-- include/linux/dma-heap.h | 11 +-- 2 files changed, 12 in

[PATCH 0/9] dma-buf: heaps: Add MediaTek secure heap

2023-09-10 Thread Yong Wu
-heap: Add proper kref handling on dma-buf heaps dma-heap: Provide accessors so that in-kernel drivers can allocate dmabufs from specific heaps T.J. Mercier (1): dma-buf: heaps: Deduplicate docs and adopt common format Yong Wu (6): dma-buf: heaps: Initialise MediaTek secure heap dma-buf:

[RFC PATCH] component: Add common helpers for compare/release functions

2022-01-28 Thread Yong Wu
The component requires the compare/release functions, there are so many copy in current kernel. Just define three common helpers for them. No functional change. Signed-off-by: Yong Wu --- Base on v5.17-rc1 --- .../gpu/drm/arm/display/komeda/komeda_drv.c| 5 - drivers/gpu/drm/arm

Re: [PATCH v9 12/15] media: mtk-vcodec: enc: Remove mtk_vcodec_release_enc_pm

2022-01-17 Thread Yong Wu
On Thu, 2022-01-13 at 17:10 +0100, Matthias Brugger wrote: > Hi Hans, > > On 13/01/2022 11:15, Hans Verkuil wrote: > > On 13/01/2022 11:11, AngeloGioacchino Del Regno wrote: > > > Il 11/01/22 11:57, AngeloGioacchino Del Regno ha scritto: > > > > I

[PATCH v10 13/13] arm64: dts: mediatek: Get rid of mediatek, larb for MM nodes

2022-01-16 Thread Yong Wu
After adding device_link between the IOMMU consumer and smi, the mediatek,larb is unnecessary now. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green Reviewed-by: AngeloGioacchino Del Regno --- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 16 arch/arm64/boot

[PATCH v10 12/13] arm: dts: mediatek: Get rid of mediatek, larb for MM nodes

2022-01-16 Thread Yong Wu
After adding device_link between the IOMMU consumer and smi, the mediatek,larb is unnecessary now. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green Tested-by: Frank Wunderlich # BPI-R2/MT7623 --- arch/arm/boot/dts/mt2701.dtsi | 2 -- arch/arm/boot/dts/mt7623n.dtsi | 5

[PATCH v10 11/13] memory: mtk-smi: Get rid of mtk_smi_larb_get/put

2022-01-16 Thread Yong Wu
After adding device_link between the iommu consumer and smi-larb, the pm_runtime_get(_sync) of smi-larb and smi-common will be called automatically. we can get rid of mtk_smi_larb_get/put. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Krzysztof Kozlowski Acked

[PATCH v10 10/13] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put

2022-01-16 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the vcodec devices call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: Tiffany Lin CC: Irui Wang Signed-off-by: Yong Wu Reviewed-by: Evan Green Ack

[PATCH v10 09/13] drm/mediatek: Get rid of mtk_smi_larb_get/put

2022-01-16 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the drm device calls the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: CK Hu CC: Philipp Zabel Signed-off-by: Yong Wu Reviewed-by: Evan Green Ack

[PATCH v10 08/13] drm/mediatek: Add pm runtime support for ovl and rdma

2022-01-16 Thread Yong Wu
or rdma device. CC: CK Hu Signed-off-by: Yongqiang Niu Signed-off-by: Yong Wu (Yong: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync) Acked-by: Chun-Kuang Hu Tested-by: Frank Wunderlich # BPI-R2/MT7623 Reviewed-by: AngeloGioacchino Del Regno --- drivers/gpu/drm/mediatek/

[PATCH v10 07/13] media: mtk-mdp: Get rid of mtk_smi_larb_get/put

2022-01-16 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the mdp device calls the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: Minghsiu Tsai CC: Houlong Wei Signed-off-by: Yong Wu Reviewed-by: Evan

[PATCH v10 06/13] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put

2022-01-16 Thread Yong Wu
ve it too. CC: Rick Chang CC: Xia Jiang Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Rick Chang Reviewed-by: Dafna Hirschfeld Tested-by: Frank Wunderlich # BPI-R2/MT7623 Acked-by: AngeloGioacchino Del Regno --- .../media/platform/mtk-jpeg/mtk_jpeg_core.c

[PATCH v10 05/13] iommu/mediatek: Add device_link between the consumer and the larb devices

2022-01-16 Thread Yong Wu
//lore.kernel.org/linux-mediatek/1564213888.22908.4.camel@mhfsdcap03/ [2] https://lore.kernel.org/patchwork/patch/1086569/ Suggested-by: Tomasz Figa Signed-off-by: Yong Wu Tested-by: Frank Wunderlich # BPI-R2/MT7623 Acked-by: Joerg Roedel Reviewed-by: AngeloGioacchino Del Regno --- drivers/io

[PATCH v10 04/13] iommu/mediatek: Add probe_defer for smi-larb

2022-01-16 Thread Yong Wu
it is not allowed to EXPORT from https://lore.kernel.org/patchwork/patch/1334670/. Signed-off-by: Yong Wu Tested-by: Frank Wunderlich # BPI-R2/MT7623 Acked-by: Joerg Roedel Reviewed-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c| 4 drivers/iommu/mtk_iommu_v1.c | 4

[PATCH v10 03/13] iommu/mediatek: Return ENODEV if the device is NULL

2022-01-16 Thread Yong Wu
ase. It's a minor fix, no need add fixes tags. Signed-off-by: Yong Wu Acked-by: Joerg Roedel Reviewed-by: AngeloGioacchino Del Regno --- drivers/iommu/mtk_iommu.c| 2 +- drivers/iommu/mtk_iommu_v1.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iom

[PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has

2022-01-16 Thread Yong Wu
return -EINVAL; } ... } Thus, Free the existed fwspec if the master device already has fwspec. This issue is reported at: https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/ Reported-by: Frank Wunderlich Test

[PATCH v10 01/13] dt-binding: mediatek: Get rid of mediatek, larb for multimedia HW

2022-01-16 Thread Yong Wu
sumer connects with from iommu id in the "iommus=" property. Signed-off-by: Yong Wu Reviewed-by: Rob Herring Reviewed-by: Evan Green Acked-by: AngeloGioacchino Del Regno --- .../bindings/display/mediatek/mediatek,disp.txt | 9 - .../bindings/media/mediatek,vcod

[PATCH v10 00/13] Clean up "mediatek,larb"

2022-01-16 Thread Yong Wu
the consumer and smi-larb into iommu_add_device from Robin. 3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan. 4) Remove the shutdown callback in iommu. v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong...@mediatek.com/ Yong Wu (12)

Re: [PATCH v5 25/32] iommu/mtk: Migrate to aggregate driver

2022-01-14 Thread Yong Wu
On Fri, 2022-01-14 at 15:30 -0600, Stephen Boyd wrote: > Quoting Yong Wu (2022-01-14 01:06:31) > > On Wed, 2022-01-12 at 20:25 -0800, Stephen Boyd wrote: > > > > > > > > [2.654526] [ cut here ] > > > > [2.6555

Re: [PATCH v5 25/32] iommu/mtk: Migrate to aggregate driver

2022-01-14 Thread Yong Wu
On Wed, 2022-01-12 at 20:25 -0800, Stephen Boyd wrote: > > > > [2.654526] [ cut here ] > > [2.68] refcount_t: addition on 0; use-after-free. > > > > After this patch, the aggregate_driver flow looks ok. But our > > driver > > still aborts like this: > > > > [

Re: [PATCH v5 25/32] iommu/mtk: Migrate to aggregate driver

2022-01-12 Thread Yong Wu
On Tue, 2022-01-11 at 16:27 -0800, Stephen Boyd wrote: > Quoting Yong Wu (2022-01-11 04:22:23) > > Hi Stephen, > > > > Thanks for helping update here. > > > > On Thu, 2022-01-06 at 13:45 -0800, Stephen Boyd wrote: > > > Use an aggregate driver instead

Re: [PATCH v5 25/32] iommu/mtk: Migrate to aggregate driver

2022-01-11 Thread Yong Wu
he aggregate device. > > Cc: Yong Wu > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Daniel Vetter > Cc: "Rafael J. Wysocki" > Cc: Rob Clark > Cc: Russell King > Cc: Saravana Kannan > Signed-off-by: Stephen Boyd When I test this on mt8195 which have two

[PATCH v9 15/15] arm64: dts: mediatek: Get rid of mediatek, larb for MM nodes

2021-11-12 Thread Yong Wu
After adding device_link between the IOMMU consumer and smi, the mediatek,larb is unnecessary now. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green --- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 16 arch/arm64/boot/dts/mediatek/mt8183.dtsi | 6 -- 2

[PATCH v9 14/15] arm: dts: mediatek: Get rid of mediatek, larb for MM nodes

2021-11-12 Thread Yong Wu
After adding device_link between the IOMMU consumer and smi, the mediatek,larb is unnecessary now. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green Tested-by: Frank Wunderlich # BPI-R2/MT7623 --- arch/arm/boot/dts/mt2701.dtsi | 2 -- arch/arm/boot/dts/mt7623n.dtsi | 5

[PATCH v9 13/15] memory: mtk-smi: Get rid of mtk_smi_larb_get/put

2021-11-12 Thread Yong Wu
After adding device_link between the iommu consumer and smi-larb, the pm_runtime_get(_sync) of smi-larb and smi-common will be called automatically. we can get rid of mtk_smi_larb_get/put. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Krzysztof Kozlowski Acked

[PATCH v9 12/15] media: mtk-vcodec: enc: Remove mtk_vcodec_release_enc_pm

2021-11-12 Thread Yong Wu
After this patchset, mtk_vcodec_release_enc_pm has only one line. then remove that function, use pm_runtime_disable instead. meanwhile, mtk_vcodec_init_enc_pm only operate for the clocks, rename it from the _pm to _clk. No functional change. CC: Tiffany Lin CC: Irui Wang Signed-off-by: Yong

[PATCH v9 11/15] media: mtk-vcodec: dec: Remove mtk_vcodec_release_dec_pm

2021-11-12 Thread Yong Wu
. No functional change. CC: Tiffany Lin CC: Yunfei Dong Signed-off-by: Yong Wu --- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 8 +--- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 9 + drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h | 3 +-- 3 files

[PATCH v9 10/15] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put

2021-11-12 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the vcodec device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: Tiffany Lin CC: Irui Wang Signed-off-by: Yong Wu Reviewed-by: Evan Green Ack

[PATCH v9 09/15] drm/mediatek: Get rid of mtk_smi_larb_get/put

2021-11-12 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the drm device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: CK Hu CC: Philipp Zabel Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by:

[PATCH v9 08/15] drm/mediatek: Add pm runtime support for ovl and rdma

2021-11-12 Thread Yong Wu
or rdma device. CC: CK Hu Signed-off-by: Yongqiang Niu Signed-off-by: Yong Wu (Yong: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync) Acked-by: Chun-Kuang Hu Tested-by: Frank Wunderlich # BPI-R2/MT7623 --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 8 +++- driv

[PATCH v9 07/15] media: mtk-mdp: Get rid of mtk_smi_larb_get/put

2021-11-12 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the mdp device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: Minghsiu Tsai CC: Houlong Wei Signed-off-by: Yong Wu Reviewed-by: Evan Green Rev

[PATCH v9 06/15] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put

2021-11-12 Thread Yong Wu
t too. CC: Rick Chang CC: Xia Jiang Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Rick Chang Reviewed-by: Dafna Hirschfeld Tested-by: Frank Wunderlich # BPI-R2/MT7623 --- .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 45 +-- .../media/platform/mtk

[PATCH v9 05/15] iommu/mediatek: Add device_link between the consumer and the larb devices

2021-11-12 Thread Yong Wu
//lore.kernel.org/linux-mediatek/1564213888.22908.4.camel@mhfsdcap03/ [2] https://lore.kernel.org/patchwork/patch/1086569/ Suggested-by: Tomasz Figa Signed-off-by: Yong Wu Tested-by: Frank Wunderlich # BPI-R2/MT7623 --- drivers/iommu/mtk_iommu.c| 30 ++ drivers/io

[PATCH v9 04/15] iommu/mediatek: Add probe_defer for smi-larb

2021-11-12 Thread Yong Wu
it is not allowed to EXPORT from https://lore.kernel.org/patchwork/patch/1334670/. Signed-off-by: Yong Wu Tested-by: Frank Wunderlich # BPI-R2/MT7623 --- drivers/iommu/mtk_iommu.c| 4 drivers/iommu/mtk_iommu_v1.c | 4 2 files changed, 8 insertions(+) diff --git a/drivers/iommu

[PATCH v9 03/15] iommu/mediatek: Return ENODEV if the device is NULL

2021-11-12 Thread Yong Wu
ase. It's a minor fix, no need add fixes tags. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c| 2 +- drivers/iommu/mtk_iommu_v1.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index d837adfd1da5..8f5

[PATCH v9 02/15] iommu/mediatek-v1: Free the existed fwspec if the master dev already has

2021-11-12 Thread Yong Wu
return -EINVAL; } ... } Thus, Free the existed fwspec if the master device already has fwspec. This issue is reported at: https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/ Reported-by: Frank Wunderlich Tested-b

[PATCH v9 01/15] dt-binding: mediatek: Get rid of mediatek, larb for multimedia HW

2021-11-12 Thread Yong Wu
sumer connects with from iommu id in the "iommus=" property. Signed-off-by: Yong Wu Reviewed-by: Rob Herring Reviewed-by: Evan Green --- .../bindings/display/mediatek/mediatek,disp.txt | 9 - .../devicetree/bindings/media/mediatek-jpeg-decoder.yaml | 9 - .../devi

[PATCH v9 00/15] Clean up "mediatek,larb"

2021-11-12 Thread Yong Wu
Evan. 4) Remove the shutdown callback in iommu. v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1-git-send-email-yong...@mediatek.com/ Yong Wu (14): dt-binding: mediatek: Get rid of mediatek, larb for multimedia HW iommu/mediatek-v1: Free the existed fwspec if the master dev alre

Re: [PATCH v8 04/12] iommu/mediatek: Add device_link between the consumer and the larb devices

2021-10-24 Thread Yong Wu
On Mon, 2021-10-18 at 09:13 +0200, Dafna Hirschfeld wrote: > > On 16.10.21 04:23, Yong Wu wrote: > > On Mon, 2021-10-11 at 14:36 +0200, Dafna Hirschfeld wrote: > > > > > > On 29.09.21 03:37, Yong Wu wrote: > > > > MediaTek IOMMU-SMI diagram is li

Re: [PATCH v8 04/12] iommu/mediatek: Add device_link between the consumer and the larb devices

2021-10-15 Thread Yong Wu
On Mon, 2021-10-11 at 14:36 +0200, Dafna Hirschfeld wrote: > > On 29.09.21 03:37, Yong Wu wrote: > > MediaTek IOMMU-SMI diagram is like below. all the consumer connect > > with > > smi-larb, then connect with smi-common. > > > > M4U

Re: [PATCH v8 09/12] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put

2021-10-06 Thread Yong Wu
On Thu, 2021-09-30 at 12:57 +0200, Dafna Hirschfeld wrote: > > On 30.09.21 05:28, Yong Wu wrote: > > Hi Dafna, > > > > Thanks very much for the review. > > > > On Wed, 2021-09-29 at 14:13 +0200, Dafna Hirschfeld wrote: > > > > > > On 29.

Re: [PATCH v8 03/12] iommu/mediatek: Add probe_defer for smi-larb

2021-09-30 Thread Yong Wu
On Wed, 2021-09-29 at 18:33 +0200, Dafna Hirschfeld wrote: > > On 29.09.21 03:37, Yong Wu wrote: > > Prepare for adding device_link. > > > > The iommu consumer should use device_link to connect with the > > smi-larb(supplier). then the smi-larb should run before t

Re: [PATCH v8 09/12] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put

2021-09-29 Thread Yong Wu
Hi Dafna, Thanks very much for the review. On Wed, 2021-09-29 at 14:13 +0200, Dafna Hirschfeld wrote: > > On 29.09.21 03:37, Yong Wu wrote: > > MediaTek IOMMU has already added the device_link between the > > consumer > > and smi-larb device. If th

[PATCH v8 12/12] arm64: dts: mediatek: Get rid of mediatek, larb for MM nodes

2021-09-28 Thread Yong Wu
After adding device_link between the IOMMU consumer and smi, the mediatek,larb is unnecessary now. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green --- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 16 arch/arm64/boot/dts/mediatek/mt8183.dtsi | 6 -- 2

[PATCH v8 11/12] arm: dts: mediatek: Get rid of mediatek, larb for MM nodes

2021-09-28 Thread Yong Wu
After adding device_link between the IOMMU consumer and smi, the mediatek,larb is unnecessary now. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green Tested-by: Frank Wunderlich # BPI-R2/MT7623 --- arch/arm/boot/dts/mt2701.dtsi | 2 -- arch/arm/boot/dts/mt7623n.dtsi | 5

[PATCH v8 10/12] memory: mtk-smi: Get rid of mtk_smi_larb_get/put

2021-09-28 Thread Yong Wu
After adding device_link between the iommu consumer and smi-larb, the pm_runtime_get(_sync) of smi-larb and smi-common will be called automatically. we can get rid of mtk_smi_larb_get/put. CC: Matthias Brugger Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Krzysztof Kozlowski Acked

[PATCH v8 09/12] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put

2021-09-28 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the vcodec device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: Tiffany Lin CC: Irui Wang Signed-off-by: Yong Wu Reviewed-by: Evan Green Ack

[PATCH v8 08/12] drm/mediatek: Get rid of mtk_smi_larb_get/put

2021-09-28 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the drm device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: CK Hu CC: Philipp Zabel Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by:

[PATCH v8 07/12] drm/mediatek: Add pm runtime support for ovl and rdma

2021-09-28 Thread Yong Wu
or rdma device. CC: CK Hu Signed-off-by: Yongqiang Niu Signed-off-by: Yong Wu (Yong: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync) Acked-by: Chun-Kuang Hu Tested-by: Frank Wunderlich # BPI-R2/MT7623 --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 8 +++- driv

[PATCH v8 06/12] media: mtk-mdp: Get rid of mtk_smi_larb_get/put

2021-09-28 Thread Yong Wu
MediaTek IOMMU has already added the device_link between the consumer and smi-larb device. If the mdp device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: Minghsiu Tsai CC: Houlong Wei Signed-off-by: Yong Wu Reviewed-by: Evan Green Rev

[PATCH v8 05/12] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put

2021-09-28 Thread Yong Wu
t too. CC: Rick Chang CC: Xia Jiang Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Rick Chang Reviewed-by: Dafna Hirschfeld Tested-by: Frank Wunderlich # BPI-R2/MT7623 --- .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 45 +-- .../media/platform/mtk

[PATCH v8 04/12] iommu/mediatek: Add device_link between the consumer and the larb devices

2021-09-28 Thread Yong Wu
ed-by: Tomasz Figa Signed-off-by: Yong Wu Tested-by: Frank Wunderlich # BPI-R2/MT7623 --- drivers/iommu/mtk_iommu.c| 22 ++ drivers/iommu/mtk_iommu_v1.c | 20 +++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu

[PATCH v8 03/12] iommu/mediatek: Add probe_defer for smi-larb

2021-09-28 Thread Yong Wu
it is not allowed to EXPORT from https://lore.kernel.org/patchwork/patch/1334670/. Signed-off-by: Yong Wu Tested-by: Frank Wunderlich # BPI-R2/MT7623 --- drivers/iommu/mtk_iommu.c| 2 +- drivers/iommu/mtk_iommu_v1.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a

[PATCH v8 02/12] iommu/mediatek-v1: Free the existed fwspec if the master dev already has

2021-09-28 Thread Yong Wu
return -EINVAL; } ... } Thus, Free the existed fwspec if the master device already has fwspec. This issue is reported at: https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/ Reported-by: Frank Wunderlich Signed

[PATCH v8 01/12] dt-binding: mediatek: Get rid of mediatek, larb for multimedia HW

2021-09-28 Thread Yong Wu
sumer connects with from iommu id in the "iommus=" property. Signed-off-by: Yong Wu Reviewed-by: Rob Herring Reviewed-by: Evan Green --- .../bindings/display/mediatek/mediatek,disp.txt | 9 - .../devicetree/bindings/media/mediatek-jpeg-decoder.yaml | 9 - .../devi

[PATCH v8 00/12] Clean up "mediatek,larb"

2021-09-28 Thread Yong Wu
5.2-rc1. 2) Move adding device_link between the consumer and smi-larb into iommu_add_device from Robin. 3) add DL_FLAG_AUTOREMOVE_CONSUMER even though the smi is built-in from Evan. 4) Remove the shutdown callback in iommu. v1: https://lore.kernel.org/linux-iommu/1546318276-18993-1

[PATCH v7 05/12] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put

2021-07-29 Thread Yong Wu
t too. CC: Rick Chang CC: Xia Jiang Signed-off-by: Yong Wu Reviewed-by: Evan Green Acked-by: Rick Chang Reviewed-by: Dafna Hirschfeld Tested-by: Dafna Hirschfeld # on mt8173 --- .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 45 +-- .../media/platform/mtk-jpeg/mtk_jpeg_c

  1   2   >