Re: [PATCH 2/2] iommu/arm-smmu: Allow client devices to select direct mapping

2020-04-13 Thread Evan Green
On Wed, Jan 22, 2020 at 3:48 AM Sai Prakash Ranjan wrote: > > From: Jordan Crouse > > Some client devices want to directly map the IOMMU themselves instead > of using the DMA domain. Allow those devices to opt in to direct > mapping by way of a list of compatible strings. > > Signed-off-by: Jorda

Re: [PATCH 02/13] driver core: Remove the link if there is no driver with AUTO flag

2019-03-12 Thread Evan Green
On Tue, Mar 12, 2019 at 7:21 AM Matthias Brugger wrote: > > > > On 05/03/2019 20:03, Evan Green wrote: > > On Wed, Feb 27, 2019 at 6:33 AM Yong Wu wrote: > >> > >> On Mon, 2019-02-25 at 15:53 -0800, Evan Green wrote: > >>>

Re: [PATCH 02/13] driver core: Remove the link if there is no driver with AUTO flag

2019-03-05 Thread Evan Green
On Wed, Feb 27, 2019 at 6:33 AM Yong Wu wrote: > > On Mon, 2019-02-25 at 15:53 -0800, Evan Green wrote: > > On Mon, Dec 31, 2018 at 8:52 PM Yong Wu wrote: > > > > > > DL_FLAG_AUTOREMOVE_CONSUMER/SUPPLIER means "Remove the link > > > automatically on

Re: [PATCH 05/13] memory: mtk-smi: Add device-link between smi-larb and smi-common

2019-03-05 Thread Evan Green
On Wed, Feb 27, 2019 at 6:33 AM Yong Wu wrote: > > On Mon, 2019-02-25 at 15:54 -0800, Evan Green wrote: > > On Mon, Dec 31, 2018 at 8:52 PM Yong Wu wrote: > > > > > > Normally, If the smi-larb HW need work, we should enable the smi-common > > > HW power a

Re: [PATCH 11/13] iommu/mediatek: Use builtin_platform_driver

2019-03-05 Thread Evan Green
On Wed, Feb 27, 2019 at 6:33 AM Yong Wu wrote: > > On Mon, 2019-02-25 at 15:56 -0800, Evan Green wrote: > > On Mon, Dec 31, 2018 at 8:53 PM Yong Wu wrote: > > > > > > MediaTek IOMMU should wait for smi larb which need wait for the > > > power domain(mtk-sc

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

2019-03-05 Thread Evan Green
On Wed, Feb 27, 2019 at 6:34 AM Yong Wu wrote: > > On Mon, 2019-02-25 at 15:54 -0800, Evan Green wrote: > > On Mon, Dec 31, 2018 at 8:52 PM Yong Wu wrote: > > > > > > The iommu consumer should use device_link to connect with the > > > smi-larb(supplier).

Re: [PATCH 08/13] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put

2019-02-25 Thread Evan Green
ffany Lin > Signed-off-by: Yong Wu Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

2019-02-25 Thread Evan Green
On Mon, Dec 31, 2018 at 8:53 PM Yong Wu wrote: > > 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 ___

Re: [PATCH 10/13] memory: mtk-smi: Get rid of mtk_smi_larb_get/put

2019-02-25 Thread Evan Green
seems fine as-is to me. Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

2019-02-25 Thread Evan Green
Hu > CC: Philipp Zabel > Signed-off-by: Yong Wu Nice cleanup. Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

2019-02-25 Thread Evan Green
u Tsai > Signed-off-by: Yong Wu Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

2019-02-25 Thread Evan Green
On Mon, Dec 31, 2018 at 8:53 PM Yong Wu wrote: > > 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 ___

Re: [PATCH 02/13] driver core: Remove the link if there is no driver with AUTO flag

2019-02-25 Thread Evan Green
On Mon, Dec 31, 2018 at 8:52 PM Yong Wu wrote: > > DL_FLAG_AUTOREMOVE_CONSUMER/SUPPLIER means "Remove the link > automatically on consumer/supplier driver unbind", that means we should > remove whole the device_link when there is no this driver no matter what > the ref_count of the link is. > > CC

Re: [PATCH 11/13] iommu/mediatek: Use builtin_platform_driver

2019-02-25 Thread Evan Green
On Mon, Dec 31, 2018 at 8:53 PM Yong Wu wrote: > > MediaTek IOMMU should wait for smi larb which need wait for the > power domain(mtk-scpsys.c) and the multimedia ccf who both are > module init. Thus, subsys_initcall for MediaTek IOMMU is not helpful. > Switch to builtin_platform_driver. > > Meanw

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

2019-02-25 Thread Evan Green
On Mon, Dec 31, 2018 at 8:52 PM Yong Wu wrote: > > MediaTek IOMMU don't have its power-domain. all the consumer connect > with smi-larb, then connect with smi-common. > > M4U > | > smi-common > | > - > | |... > | | > larb1 lar

Re: [PATCH 05/13] memory: mtk-smi: Add device-link between smi-larb and smi-common

2019-02-25 Thread Evan Green
On Mon, Dec 31, 2018 at 8:52 PM Yong Wu wrote: > > Normally, If the smi-larb HW need work, we should enable the smi-common > HW power and clock firstly. > This patch adds device-link between the smi-larb dev and the smi-common > dev. then If pm_runtime_get_sync(smi-larb-dev), the pm_runtime_get_sy

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

2019-02-25 Thread Evan Green
> Signed-off-by: Yong Wu Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

2019-02-25 Thread Evan Green
don't need the property. > > And IOMMU also know which larb this consumer connects with from > iommu id in the "iommus=" property. > > Signed-off-by: Yong Wu Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-fou

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

2019-02-25 Thread Evan Green
On Mon, Dec 31, 2018 at 8:52 PM Yong Wu wrote: > > The iommu consumer should use device_link to connect with the > smi-larb(supplier). then the smi-larb should run before the iommu > consumer. Here we delay the iommu driver until the smi driver is > ready, then all the iommu consumer always is aft

Re: [PATCH v6 21/22] iommu/mediatek: Fix iova_to_phys PA start for 4GB mode

2019-02-19 Thread Evan Green
On Sun, Feb 17, 2019 at 1:09 AM Yong Wu wrote: > > In the 4GB mode, the physical address is remapped, > > Here is the detailed remap relationship. > CPU PA ->HW PA > 0x4000_ 0x1_4000_ (Add bit32) > 0x8000_ 0x1_8000_ ... > 0xc000_ 0x1_c000_

Re: [PATCH v6 17/22] memory: mtk-smi: Get rid of need_larbid

2019-02-19 Thread Evan Green
t;struct mtk_smi_iommu" could also > be deleted. > > CC: Matthias Brugger > Signed-off-by: Yong Wu Thanks for the cleanup. Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v6 20/22] iommu/mediatek: Rename enable_4GB to dram_is_4gb

2019-02-19 Thread Evan Green
On Sun, Feb 17, 2019 at 1:09 AM Yong Wu wrote: > > This patch only rename the variable name from enable_4GB to > dram_is_4gb for readable. > > Signed-off-by: Yong Wu Nice, this is clearer. Reviewed-by: Evan Green ___ iommu mai

Re: [PATCH v6 16/22] memory: mtk-smi: Add bus_sel for mt8183

2019-02-19 Thread Evan Green
> > And, the base of smi-common is completely different with smi_ao_base > of gen1, thus I add new variable for that. > > CC: Matthias Brugger > Signed-off-by: Yong Wu Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v6 06/22] iommu/io-pgtable-arm-v7s: Extend MediaTek 4GB Mode

2019-02-19 Thread Evan Green
Reviewed-by: Robin Murphy > --- > Comparing the previous version, I add MTK_4GB quirk always since mtk_iommu > has already controlled the PA itself. Helped from Evan. Thanks for all the explanation on this one. I think I understand it now, and it looks good to me. Reviewed-by

Re: [PATCH v6 10/22] iommu/mediatek: Move reset_axi into plat_data

2019-02-19 Thread Evan Green
_data, it's also a preparing > patch for mt8183. > > Signed-off-by: Yong Wu > Reviewed-by: Nicolas Boichat Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v6 13/22] iommu/mediatek: Add mt8183 IOMMU support

2019-02-19 Thread Evan Green
83 need reset_axi like mt8173. > 7) the larb-id in smi-common is remapped. M4U should add its larbid_remap. > > Signed-off-by: Yong Wu Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v6 09/22] iommu/mediatek: Refine protect memory definition

2019-02-19 Thread Evan Green
atch delete the complex MACRO and use a common if-else > instead. > > Signed-off-by: Yong Wu Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v6 11/22] iommu/mediatek: Move vld_pa_rng into plat_data

2019-02-19 Thread Evan Green
On Sun, Feb 17, 2019 at 1:08 AM Yong Wu wrote: > > Both mt8173 and mt8183 don't have this vld_pa_rng(valid physical address > range) register while mt2712 have. Move it into the plat_data. > > Signed-off-by: Yong Wu Reviewed-by: Evan Green _

Re: [PATCH v6 01/22] dt-bindings: mediatek: Add binding for mt8183 IOMMU and SMI

2019-02-19 Thread Evan Green
uot;gals" clock for smi-larb. > > From the diagram above, IPU0/IPU1(Image Processor Unit) and CCU(Camera > Control Unit) is connected with smi-common directly, we can take them > as "larb2", "larb3" and "larb7", and their register spaces are > different with the normal larb. > > Signed-off-by: Yong Wu Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v6 06/20] iommu/io-pgtable-arm-v7s: Extend MediaTek 4GB Mode

2019-02-05 Thread Evan Green
On Fri, Feb 1, 2019 at 1:42 AM Yong Wu wrote: > > On Thu, 2019-01-31 at 11:23 -0800, Evan Green wrote: > > On Wed, Jan 30, 2019 at 10:59 PM Yong Wu wrote: > > > > > > On Wed, 2019-01-30 at 10:28 -0800, Evan Green wrote: > > > > On M

Re: [PATCH v6 06/20] iommu/io-pgtable-arm-v7s: Extend MediaTek 4GB Mode

2019-01-31 Thread Evan Green
On Wed, Jan 30, 2019 at 10:59 PM Yong Wu wrote: > > On Wed, 2019-01-30 at 10:28 -0800, Evan Green wrote: > > On Mon, Dec 31, 2018 at 7:57 PM Yong Wu wrote: > > > > > > MediaTek extend the arm v7s descriptor to support the dram over 4GB. > > > > > >

Re: [PATCH v5 17/20] memory: mtk-smi: Get rid of need_larbid

2019-01-31 Thread Evan Green
On Wed, Jan 30, 2019 at 7:22 PM Yong Wu wrote: > > On Wed, 2019-01-30 at 11:11 -0800, Evan Green wrote: > > On Mon, Dec 31, 2018 at 7:59 PM Yong Wu wrote: > > > > > > The "mediatek,larb-id" has already been parsed in MTK IOMMU driver. > > > I

Re: [PATCH v5 11/20] iommu/mediatek: Move vld_pa_rng into plat_data

2019-01-31 Thread Evan Green
On Wed, Jan 30, 2019 at 7:20 PM Yong Wu wrote: > > On Wed, 2019-01-30 at 10:30 -0800, Evan Green wrote: > > On Mon, Dec 31, 2018 at 7:58 PM Yong Wu wrote: > > > > > > Both mt8173 and mt8183 don't have this vld_pa_rng(valid physical address > > > ran

Re: [PATCH v5 20/20] iommu/mediatek: Switch to SPDX license identifier

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 8:00 PM Yong Wu wrote: > > Switch to SPDX license identifier for MediaTek iommu/smi and their > header files. > > Signed-off-by: Yong Wu > Reviewed-by: Rob Herring Reviewed-by: Evan Green ___ iommu

Re: [PATCH v5 17/20] memory: mtk-smi: Get rid of need_larbid

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 7:59 PM Yong Wu wrote: > > The "mediatek,larb-id" has already been parsed in MTK IOMMU driver. > It's no need to parse it again in SMI driver. Only clean some codes. > This patch is fit for all the current mt2701, mt2712, mt7623, mt8173 > and mt8183. > > After this patch, t

Re: [PATCH v5 18/20] iommu/mediatek: Fix VLD_PA_RANGE register backup when suspend

2019-01-30 Thread Evan Green
d-off-by: Yong Wu Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v5 19/20] iommu/mediatek: Add shutdown callback

2019-01-30 Thread Evan Green
unds unpleasant. Hopefully the reboot flow still continues properly even in that case, since this shutdown code may not run during some rougher resets. Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linu

Re: [PATCH v5 16/20] memory: mtk-smi: Add bus_sel for mt8183

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 7:59 PM Yong Wu wrote: > > There are 2 mmu cells in a M4U HW. we could adjust some larbs entering > mmu0 or mmu1 to balance the bandwidth via the smi-common register > SMI_BUS_SEL(0x220)(Each larb occupy 2 bits). > > In mt8183, For better performance, we switch larb1/2/5/7

Re: [PATCH v5 15/20] memory: mtk-smi: Invoke pm runtime_callback to enable clocks

2019-01-30 Thread Evan Green
the order is still: 1) mtk_smi_clk_enable(common) 2) mtk_smi_clk_enable(larb) 3) larb_gen->config_port() And teardown still happens in the opposite order, except for config_port, which they seem not to do in suspend. So, looks good to me. Reviewed-by: Evan Gre

Re: [PATCH v5 14/20] iommu/mediatek: Add mmu1 support

2019-01-30 Thread Evan Green
ine F_INT_TLB_MISS_FAULT BIT(4) > -#define F_INT_MISS_TRANSACTION_FIFO_FAULT BIT(5) > -#define F_INT_PRETETCH_TRANSATION_FIFO_FAULT BIT(6) > +#define REG_MMU_INT_MAIN_CONTROL 0x124 /* mmu0 | mmu1 */ The comment being on that line is kind of

Re: [PATCH v5 10/20] iommu/mediatek: Move reset_axi into plat_data

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 7:58 PM Yong Wu wrote: > > In mt8173 and mt8183, 0x48 is REG_MMU_STANDARD_AXI_MODE while > it is extended to REG_MMU_CTRL which contains _STANDARD_AXI_MODE in > the other SoCs. I move this property to plat_data since both mt8173 > and mt8183 use this property. > > It is a p

Re: [PATCH v5 11/20] iommu/mediatek: Move vld_pa_rng into plat_data

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 7:58 PM Yong Wu wrote: > > Both mt8173 and mt8183 don't have this vld_pa_rng(valid physical address > range) register while mt2712 have. Move it into the plat_data. > > Signed-off-by: Yong Wu > --- > drivers/iommu/mtk_iommu.c | 3 ++- > drivers/iommu/mtk_iommu.h | 1 + >

Re: [PATCH v5 08/20] iommu/mediatek: Add larb-id remapped support

2019-01-30 Thread Evan Green
rue, > + .larbid_remap = {0, 1, 2, 3, 4, 5}, /* Linear mapping. */ I briefly considered bikeshedding about how to define these arrays in a way that might save memory for linear-map devices, but then decided this is fine. Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v5 13/20] iommu/mediatek: Add mt8183 IOMMU support

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 7:59 PM Yong Wu wrote: > > The M4U IP blocks in mt8183 is MediaTek's generation2 M4U which use > the ARM Short-descriptor like mt8173, and most of the HW registers > are the same. > > Here list main differences between mt8183 and mt8173/mt2712: > 1) mt8183 has only one M4U

Re: [PATCH v6 06/20] iommu/io-pgtable-arm-v7s: Extend MediaTek 4GB Mode

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 7:57 PM Yong Wu wrote: > > MediaTek extend the arm v7s descriptor to support the dram over 4GB. > > In the mt2712 and mt8173, it's called "4GB mode", the physical address > is from 0x4000_ to 0x1_3fff_, but from EMI point of view, it > is remapped to high address fr

Re: [PATCH v5 07/20] iommu/mediatek: Add bclk can be supported optionally

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 7:57 PM Yong Wu wrote: > > In some SoCs, M4U doesn't have its "bclk", it will use the EMI > clock instead which has always been enabled when entering kernel. > > This also is a preparing patch for mt8183. > > Signed-off-b

Re: [PATCH v5 04/20] memory: mtk-smi: Use a struct for the platform data for smi-common

2019-01-30 Thread Evan Green
mtk_smi_common_plat" before it is referred. > > This is a preparing patch for mt8183. > > Signed-off-by: Yong Wu > Reviewed-by: Matthias Brugger Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v5 09/20] iommu/mediatek: Refine protect memory definition

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 7:58 PM Yong Wu wrote: > > The protect memory setting is a little different in the different SoCs. > In the register REG_MMU_CTRL_REG(0x110), the TF_PROT(translation fault > protect) shift bit is normally 4 while it shift 5 bits only in the > mt8173. This patch delete the c

Re: [PATCH v5 12/20] memory: mtk-smi: Add gals support

2019-01-30 Thread Evan Green
; clock for smi-larb. > > This patch adds gals clock supporting in the SMI. Note that some larbs > may still don't have the "gals" clock like larb1 and larb4 above. > > This is also a preparing patch for mt8183 which has GALS. >

Re: [PATCH v5 05/20] iommu/io-pgtable-arm-v7s: Add paddr_to_iopte and iopte_to_paddr helpers

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 7:57 PM Yong Wu wrote: > > Add two helper functions: paddr_to_iopte and iopte_to_paddr. > > Signed-off-by: Yong Wu > Reviewed-by: Robin Murphy Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux

Re: [PATCH v5 02/20] iommu/mediatek: Use a struct as the platform data

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 7:56 PM Yong Wu wrote: > > Use a struct as the platform special data instead of the enumeration. > This is a prepare patch for adding mt8183 iommu support. > > Signed-off-by: Yong Wu > Reviewed-by: Matthias Brugger Revie

Re: [PATCH v5 03/20] memory: mtk-smi: Use a general config_port interface

2019-01-30 Thread Evan Green
. > > This is also a preparing patch for adding mt8183 SMI support. > > Signed-off-by: Yong Wu > Reviewed-by: Matthias Brugger Reviewed-by: Evan Green ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v5 01/20] dt-bindings: mediatek: Add binding for mt8183 IOMMU and SMI

2019-01-30 Thread Evan Green
On Mon, Dec 31, 2018 at 7:56 PM Yong Wu wrote: > > This patch adds decriptions for mt8183 IOMMU and SMI. > > mt8183 has only one M4U like mt8173 and is also MTK IOMMU gen2 which > uses ARM Short-Descriptor translation table format. > > The mt8183 M4U-SMI HW diagram is as below: > >