[RESEND PATCHv5] iommu/mediatek: check 4GB mode by reading infracfg

2020-09-04 Thread Miles Chen
: Christoph Hellwig Cc: Rob Herring Cc: Matthias Brugger Cc: Joerg Roedel Reviewed-by: Matthias Brugger Signed-off-by: Miles Chen --- Change since v4 - remove unnecessary data->enable_4GB = false, since it is kzalloc()ed. Change since v3 - use lore.kernel.org links - move "change since..

Re: [PATCH v5] iommu/mediatek: check 4GB mode by reading infracfg

2020-09-04 Thread Miles Chen
On Fri, 2020-09-04 at 11:42 +0200, Joerg Roedel wrote: > On Mon, Aug 31, 2020 at 06:56:39PM +0800, Miles Chen wrote: > > In previous discussion [1] and [2], we found that it is risky to > > use max_pfn or totalram_pages to tell if 4GB mode is enabled. > > > > Check 4

[PATCH v5] iommu/mediatek: check 4GB mode by reading infracfg

2020-08-31 Thread Miles Chen
: Christoph Hellwig Cc: Rob Herring Cc: Matthias Brugger Signed-off-by: Miles Chen --- Change since v4 - remove unnecessary data->enable_4GB = false, since it is kzalloc()ed. Change since v3 - use lore.kernel.org links - move "change since..." after "---" Change since v2:

Re: [RESEND PATCH v4] iommu/mediatek: check 4GB mode by reading infracfg

2020-08-29 Thread Miles Chen
On Thu, 2020-08-27 at 20:27 +0100, Robin Murphy wrote: > On 2020-08-27 06:31, Yong Wu wrote: > > On Wed, 2020-08-26 at 16:56 +0800, Miles Chen wrote: > >> In previous discussion [1] and [2], we found that it is risky to > >> use max_pfn or totalram_pages to

[RESEND PATCH v4] iommu/mediatek: check 4GB mode by reading infracfg

2020-08-26 Thread Miles Chen
: Christoph Hellwig Cc: Rob Herring Cc: Matthias Brugger Signed-off-by: Miles Chen --- Change since v3 - use lore.kernel.org links - move "change since..." after "---" Change since v2: - determine compatible string by m4u_plat - rebase to next-20200720 - add "---&qu

[PATCH v4] iommu/mediatek: check 4GB mode by reading infracfg

2020-07-22 Thread Miles Chen
: Christoph Hellwig Cc: Rob Herring Cc: Matthias Brugger Signed-off-by: Miles Chen --- Change since v3 - use lore.kernel.org links - move "change since..." after "---" Change since v2: - determine compatible string by m4u_plat - rebase to next-20200720 - add "---&qu

Re: [PATCH v3] iommu/mediatek: check 4GB mode by reading infracfg

2020-07-22 Thread Miles Chen
On Wed, 2020-07-22 at 17:19 +0200, Matthias Brugger wrote: > > On 22/07/2020 16:19, Miles Chen wrote: > > In previous discussion [1] and [2], we found that it is risky to > > use max_pfn or totalram_pages to tell if 4GB mode is enabled. > > > > Check 4GB mode by rea

[PATCH v3] iommu/mediatek: check 4GB mode by reading infracfg

2020-07-22 Thread Miles Chen
e_4GB only when has_4gb_mode [1] https://lkml.org/lkml/2020/6/3/733 [2] https://lkml.org/lkml/2020/6/4/136 [3] https://lkml.org/lkml/2020/7/15/1147 Cc: Mike Rapoport Cc: David Hildenbrand Cc: Yong Wu Cc: Yingjoe Chen Cc: Christoph Hellwig Cc: Rob Herring Cc: Matthias Brugger Signed-off-by:

Re: [PATCH v2] iommu/mediatek: check 4GB mode by reading infracfg

2020-07-22 Thread Miles Chen
On Wed, 2020-07-22 at 15:17 +0800, Miles Chen wrote: > On Tue, 2020-07-21 at 23:19 +0200, Matthias Brugger wrote: > > > > On 21/07/2020 13:24, Yong Wu wrote: > > > On Tue, 2020-07-21 at 11:40 +0200, Matthias Brugger wrote: > > >> > > >> On 21/07/2

Re: [PATCH v2] iommu/mediatek: check 4GB mode by reading infracfg

2020-07-22 Thread Miles Chen
On Tue, 2020-07-21 at 23:19 +0200, Matthias Brugger wrote: > > On 21/07/2020 13:24, Yong Wu wrote: > > On Tue, 2020-07-21 at 11:40 +0200, Matthias Brugger wrote: > >> > >> On 21/07/2020 04:16, Miles Chen wrote: > >>> In previous discussion [1] and [

Re: [PATCH v2] iommu/mediatek: check 4GB mode by reading infracfg

2020-07-22 Thread Miles Chen
On Tue, 2020-07-21 at 11:10 +0200, David Hildenbrand wrote: > On 21.07.20 04:16, Miles Chen wrote: > > In previous discussion [1] and [2], we found that it is risky to > > use max_pfn or totalram_pages to tell if 4GB mode is enabled. > > > > Check 4GB mode by readin

[PATCH v2] iommu/mediatek: check 4GB mode by reading infracfg

2020-07-20 Thread Miles Chen
] https://lkml.org/lkml/2020/7/15/1147 Cc: Mike Rapoport Cc: David Hildenbrand Cc: Yong Wu Cc: Yingjoe Chen Cc: Christoph Hellwig Cc: Yong Wu Cc: Chao Hao Cc: Rob Herring Cc: Matthias Brugger Signed-off-by: Miles Chen --- drivers/iommu/mtk_iommu.c | 26

Re: [PATCH 4/4] iommu/mediatek: check 4GB mode by reading infracfg

2020-07-17 Thread Miles Chen
On Wed, 2020-07-15 at 23:05 +0200, Matthias Brugger wrote: > > On 02/07/2020 11:37, Miles Chen wrote: > > In previous disscusion [1] and [2], we found that it is risky to > > use max_pfn or totalram_pages to tell if 4GB mode is enabled. > > > > Check 4GB mode by rea

Re: [PATCH 1/4] dt-bindings: mediatek: add mediatek,infracfg phandle

2020-07-17 Thread Miles Chen
On Wed, 2020-07-15 at 14:51 -0600, Rob Herring wrote: > On Thu, Jul 02, 2020 at 05:37:17PM +0800, Miles Chen wrote: > > Add a description for mediatek,infracfg. We can check if 4GB mode > > is enable by reading it instead of checking the unexported > > symbol "max_pfn

[PATCH 3/4] arm64: dts: mt8173: add mediatek,infracfg to iommu

2020-07-02 Thread Miles Chen
Add mediatek,infracfg to iommu node. Signed-off-by: Miles Chen --- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi index 70b1ffcab7f0..a6f14f68ef7e 100644 --- a/arch

[PATCH 4/4] iommu/mediatek: check 4GB mode by reading infracfg

2020-07-02 Thread Miles Chen
/136 Cc: Mike Rapoport Cc: David Hildenbrand Cc: Yong Wu Cc: Yingjoe Chen Cc: Christoph Hellwig Signed-off-by: Miles Chen --- drivers/iommu/mtk_iommu.c | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu

[PATCH 2/4] arm64: dts: mt2712: add mediatek,infracfg to iommu

2020-07-02 Thread Miles Chen
Add mediatek,infracfg to iommu node. Signed-off-by: Miles Chen --- arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/mediatek/mt2712e.dtsi b/arch/arm64/boot/dts/mediatek/mt2712e.dtsi index db17d0a4ed57..0749b0f4834c 100644

[PATCH 1/4] dt-bindings: mediatek: add mediatek,infracfg phandle

2020-07-02 Thread Miles Chen
Add a description for mediatek,infracfg. We can check if 4GB mode is enable by reading it instead of checking the unexported symbol "max_pfn". This is a step towards building mtk_iommu as a kernel module. Cc: Yong Wu Signed-off-by: Miles Chen --- Documentation/devicetree/bind

Re: [PATCH] iommu/mediatek: Use totalram_pages to setup enable_4GB

2020-06-04 Thread Miles Chen
On Thu, 2020-06-04 at 10:25 +0200, David Hildenbrand wrote: > On 04.06.20 10:01, Miles Chen wrote: > > To build this driver as a kernel module, we cannot use > > the unexported symbol "max_pfn" to setup enable_4GB. > > > > Use totalram_pages() instead to

[PATCH] iommu/mediatek: Use totalram_pages to setup enable_4GB

2020-06-04 Thread Miles Chen
To build this driver as a kernel module, we cannot use the unexported symbol "max_pfn" to setup enable_4GB. Use totalram_pages() instead to setup enable_4GB. Suggested-by: Mike Rapoport Signed-off-by: Miles Chen Cc: David Hildenbrand Cc: Yong Wu Cc: Chao Hao --- drivers/iommu/m

Re: [PATCH] kernel/dma: export dma_alloc_from_contiguous to modules

2019-07-11 Thread Miles Chen
On Thu, 2019-07-11 at 09:50 +0100, Robin Murphy wrote: > On 11/07/2019 06:33, miles.c...@mediatek.com wrote: > > From: Miles Chen > > > > This change exports dma_alloc_from_contiguous and > > dma_release_from_contiguous to modules. > > > > Currently, we

Re: [PATCH] dma-debug: use virt_addr_valid() to check linear addresses

2017-11-23 Thread Miles Chen
On Thu, 2017-11-23 at 09:58 +0100, Christoph Hellwig wrote: > Can you just resend the original patch with the fixes? > No problem. I'll resend the original patch with this fix. ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [PATCH v4] dma-debug: fix incorrect pfn calculation

2017-11-16 Thread Miles Chen
On Thu, 2017-11-16 at 16:13 -0800, Andrew Morton wrote: > On Fri, 17 Nov 2017 06:56:12 +0800 <miles.c...@mediatek.com> wrote: > > > From: Miles Chen <miles.c...@mediatek.com> > > > > dma-debug reports the following warning: > > > > [name:panic

Re: [PATCH v3] dma-debug: fix incorrect pfn calculation

2017-10-02 Thread Miles Chen
On Sun, 2017-10-01 at 10:04 +0200, Christoph Hellwig wrote: > On Wed, Sep 27, 2017 at 11:23:52AM +0100, Robin Murphy wrote: > > > I found that debug_dma_alloc_coherent() and debug_dma_free_coherent() > > > assume that dma_alloc_coherent() always returns a linear address. > > > However it's

Re: [PATCH] dma-debug: fix incorrect pfn calculation

2017-09-26 Thread Miles Chen
On Tue, 2017-09-26 at 15:53 +0100, Robin Murphy wrote: > On 26/09/17 14:24, miles.c...@mediatek.com wrote: > > From: Miles Chen <miles.c...@mediatek.com> > > > > dma-debug report the following warning: > > > > [name:panic&]WARNING: CPU: 3 PID: 298