Re: [PATCH 5/6] iommu/vt-d: Cleanup after delegating DMA domain to generic iommu

2019-06-10 Thread Lu Baolu
Hi, On 6/11/19 3:25 AM, Sai Praneeth Prakhya wrote: On Mon, 2019-06-10 at 11:45 -0700, Mehta, Sohil wrote: On Sun, 2019-06-09 at 10:38 +0800, Lu Baolu wrote: static int __init si_domain_init(int hw) @@ -3306,14 +3252,13 @@ static int __init init_dmars(void) if

Re: [PATCH] dma-remap: Avoid de-referencing NULL atomic_pool

2019-06-10 Thread Christoph Hellwig
Looks good to me. When did this start to show up? Do we need to push it to Linus this cycle and cc stable?

Re: Device specific pass through in host systems - discuss user interface

2019-06-10 Thread Raj, Ashok
On Mon, Jun 10, 2019 at 09:38:11PM -0700, Sai Praneeth Prakhya wrote: > Hi All, > > + Sohil and Rob Clark (as there are dropped from CC'list) > > > > > Most iommu vendor drivers have switched from per-device to per-group > > > > domain (a.k.a. default domain). So per-group pass-through mode

RE: Device specific pass through in host systems - discuss user interface

2019-06-10 Thread Prakhya, Sai Praneeth
Hi All, + Sohil and Rob Clark (as there are dropped from CC'list) > > > Most iommu vendor drivers have switched from per-device to per-group > > > domain (a.k.a. default domain). So per-group pass-through mode makes > more sense? > > > > > > By the way, can we extend this to "per-group default

Re: "iommu/vt-d: Delegate DMA domain to generic iommu" series breaks megaraid_sas

2019-06-10 Thread Lu Baolu
Ah, good catch! The device failed to be attached by a DMA domain. Can you please try the attached fix patch? [ 101.885468] pci :06:00.0: DMAR: Device is ineligible for IOMMU domain attach due to platform RMRR requirement. Contact your platform vendor. [ 101.900801] pci :06:00.0:

[PATCH] dma-remap: Avoid de-referencing NULL atomic_pool

2019-06-10 Thread Florian Fainelli
With architectures allowing the kernel to be placed almost arbitrarily in memory (e.g.: ARM64), it is possible to have the kernel resides at physical addresses above 4GB, resulting in neither the default CMA area, nor the atomic pool from successfully allocating. This does not prevent specific

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-06-10 Thread Jacob Pan
On Mon, 10 Jun 2019 13:45:02 +0100 Jean-Philippe Brucker wrote: > On 07/06/2019 18:43, Jacob Pan wrote: > >>> So it seems we agree on the following: > >>> - iommu_unregister_device_fault_handler() will never fail > >>> - iommu driver cleans up all pending faults when handler is > >>>

Re: [PATCH 5/6] iommu/vt-d: Cleanup after delegating DMA domain to generic iommu

2019-06-10 Thread Sai Praneeth Prakhya
On Mon, 2019-06-10 at 11:45 -0700, Mehta, Sohil wrote: > On Sun, 2019-06-09 at 10:38 +0800, Lu Baolu wrote: > > static int __init si_domain_init(int hw) > > @@ -3306,14 +3252,13 @@ static int __init init_dmars(void) > > if (pasid_supported(iommu)) > >

[PATCH 7/8] iommu/arm-smmu-v3: Improve add_device() error handling

2019-06-10 Thread Jean-Philippe Brucker
Let add_device() clean up behind itself. The iommu_bus_init() function does call remove_device() on error, but other sites (e.g. of_iommu) do not. Don't free level-2 stream tables because we'd have to track if we allocated each of them or if they are used by other endpoints. It's not worth the

[PATCH 8/8] iommu/arm-smmu-v3: Add support for PCI PASID

2019-06-10 Thread Jean-Philippe Brucker
Enable PASID for PCI devices that support it. Since the SSID tables are allocated by arm_smmu_attach_dev(), PASID has to be enabled early enough. arm_smmu_dev_feature_enable() would be too late, since by that time the main DMA domain has already been attached. Do it in add_device() instead.

[PATCH 6/8] iommu/arm-smmu-v3: Support auxiliary domains

2019-06-10 Thread Jean-Philippe Brucker
In commit a3a195929d40 ("iommu: Add APIs for multiple domains per device"), the IOMMU API gained the concept of auxiliary domains (AUXD), which allows to control the PASID-tagged address spaces of a device. With AUXD the PASID address space are not shared with the CPU, but are instead modified

[PATCH 3/8] iommu/arm-smmu-v3: Support platform SSID

2019-06-10 Thread Jean-Philippe Brucker
For platform devices that support SubstreamID (SSID), firmware provides the number of supported SSID bits. Restrict it to what the SMMU supports and cache it into master->ssid_bits. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 11 +++ drivers/iommu/of_iommu.c

[PATCH 2/8] dt-bindings: document PASID property for IOMMU masters

2019-06-10 Thread Jean-Philippe Brucker
On Arm systems, some platform devices behind an SMMU may support the PASID feature, which offers multiple address space. Let the firmware tell us when a device supports PASID. Reviewed-by: Rob Herring Signed-off-by: Jean-Philippe Brucker --- Previous discussion on this patch last year:

[PATCH 5/8] iommu/arm-smmu-v3: Add second level of context descriptor table

2019-06-10 Thread Jean-Philippe Brucker
The SMMU can support up to 20 bits of SSID. Add a second level of page tables to accommodate this. Devices that support more than 1024 SSIDs now have a table of 1024 L1 entries (8kB), pointing to tables of 1024 context descriptors (64kB), allocated on demand. Signed-off-by: Jean-Philippe Brucker

[PATCH 1/8] iommu: Add I/O ASID allocator

2019-06-10 Thread Jean-Philippe Brucker
Some devices might support multiple DMA address spaces, in particular those that have the PCI PASID feature. PASID (Process Address Space ID) allows to share process address spaces with devices (SVA), partition a device into VM-assignable entities (VFIO mdev) or simply provide multiple DMA address

[PATCH 4/8] iommu/arm-smmu-v3: Add support for Substream IDs

2019-06-10 Thread Jean-Philippe Brucker
At the moment, the SMMUv3 driver implements only one stage-1 or stage-2 page directory per device. However SMMUv3 allows more than one address space for some devices, by providing multiple stage-1 page directories. In addition to the Stream ID (SID), that identifies a device, we can now have

[PATCH 0/8] iommu: Add auxiliary domain and PASID support to Arm SMMUv3

2019-06-10 Thread Jean-Philippe Brucker
Add substreams and PCI PASID support to the SMMUv3 driver. At the moment the driver supports a single address space per device. PASID enables multiple address spaces per device, up to a million in theory (1 << 20). Two kernel features will make use of PASIDs, auxiliary domains (AUXD) and Shared

Re: How to resolve an issue in swiotlb environment?

2019-06-10 Thread Alan Stern
On Mon, 10 Jun 2019, Christoph Hellwig wrote: > Hi Yoshihiro, > > sorry for not taking care of this earlier, today is a public holiday > here and thus I'm not working much over the long weekend. > > On Mon, Jun 10, 2019 at 11:13:07AM +, Yoshihiro Shimoda wrote: > > I have another way to

Re: [PATCH 5/6] iommu/vt-d: Cleanup after delegating DMA domain to generic iommu

2019-06-10 Thread Mehta, Sohil
On Sun, 2019-06-09 at 10:38 +0800, Lu Baolu wrote: >  static int __init si_domain_init(int hw) > @@ -3306,14 +3252,13 @@ static int __init init_dmars(void) > if (pasid_supported(iommu)) > intel_svm_init(iommu); >  #endif > -   } >   > -   /* > -  

Re: [PATCH v4 0/9] iommu: Bounce page for untrusted devices

2019-06-10 Thread Konrad Rzeszutek Wilk
On Mon, Jun 03, 2019 at 09:16:11AM +0800, Lu Baolu wrote: > The Thunderbolt vulnerabilities are public and have a nice > name as Thunderclap [1] [3] nowadays. This patch series aims > to mitigate those concerns. .. Forgot to ask but should the patches also include the CVE number? Or at least the

Re: [PATCH v4 7/9] iommu/vt-d: Add trace events for domain map/unmap

2019-06-10 Thread Konrad Rzeszutek Wilk
On Mon, Jun 03, 2019 at 09:16:18AM +0800, Lu Baolu wrote: > This adds trace support for the Intel IOMMU driver. It > also declares some events which could be used to trace > the events when an IOVA is being mapped or unmapped in > a domain. Is that even needed considering SWIOTLB also has tracing

Re: [PATCH v4 6/9] iommu/vt-d: Check whether device requires bounce buffer

2019-06-10 Thread Konrad Rzeszutek Wilk
On Mon, Jun 03, 2019 at 09:16:17AM +0800, Lu Baolu wrote: > This adds a helper to check whether a device needs to > use bounce buffer. It also provides a boot time option > to disable the bounce buffer. Users can use this to > prevent the iommu driver from using the bounce buffer > for performance

Re: [PATCH v4 4/9] iommu: Add bounce page APIs

2019-06-10 Thread Konrad Rzeszutek Wilk
On Mon, Jun 03, 2019 at 09:16:15AM +0800, Lu Baolu wrote: > IOMMU hardware always use paging for DMA remapping. The > minimum mapped window is a page size. The device drivers > may map buffers not filling whole IOMMU window. It allows > device to access to possibly unrelated memory and various >

Re: [PATCH v4 5/9] iommu/vt-d: Don't switch off swiotlb if use direct dma

2019-06-10 Thread Konrad Rzeszutek Wilk
On Mon, Jun 03, 2019 at 09:16:16AM +0800, Lu Baolu wrote: > The direct dma implementation depends on swiotlb. Hence, don't > switch of swiotlb since direct dma interfaces are used in this s/of/off/ > driver. But I think you really want to leave the code as is but change the #ifdef to check for

Re: [PATCH v4 3/9] swiotlb: Zero out bounce buffer for untrusted device

2019-06-10 Thread Konrad Rzeszutek Wilk
On Mon, Jun 03, 2019 at 09:16:14AM +0800, Lu Baolu wrote: > This is necessary to avoid exposing valid kernel data to any > milicious device. malicious > > Suggested-by: Christoph Hellwig > Signed-off-by: Lu Baolu > --- > kernel/dma/swiotlb.c | 6 ++ > 1 file changed, 6 insertions(+) >

Re: [PATCH v4 0/9] iommu: Bounce page for untrusted devices

2019-06-10 Thread Konrad Rzeszutek Wilk
On Mon, Jun 03, 2019 at 09:16:11AM +0800, Lu Baolu wrote: > The Thunderbolt vulnerabilities are public and have a nice > name as Thunderclap [1] [3] nowadays. This patch series aims > to mitigate those concerns. > > An external PCI device is a PCI peripheral device connected > to the system

Re: "iommu/vt-d: Delegate DMA domain to generic iommu" series breaks megaraid_sas

2019-06-10 Thread Qian Cai
On Mon, 2019-06-10 at 09:44 -0400, Qian Cai wrote: > On Sun, 2019-06-09 at 10:43 +0800, Lu Baolu wrote: > > Hi Qian, > > > > I just posted some fix patches. I cc'ed them in your email inbox as > > well. Can you please check whether they happen to fix your issue? > > If not, do you mind posting

Re: Device specific pass through in host systems - discuss user interface

2019-06-10 Thread Raj, Ashok
Hi Sai On Sun, Jun 09, 2019 at 10:41:10PM -0700, Sai Praneeth Prakhya wrote: > > > I am working on an IOMMU driver feature that allows a user to specify > > > if the DMA from a device should be translated by IOMMU or not. > > > Presently, we support only all devices or none mode i.e. if user > >

Re: "iommu/vt-d: Delegate DMA domain to generic iommu" series breaks megaraid_sas

2019-06-10 Thread Qian Cai
On Sun, 2019-06-09 at 10:43 +0800, Lu Baolu wrote: > Hi Qian, > > I just posted some fix patches. I cc'ed them in your email inbox as > well. Can you please check whether they happen to fix your issue? > If not, do you mind posting more debug messages? Unfortunately, it does not work. Here is

Re: [PATCH v6 0/6] Allwinner H6 Mali GPU support

2019-06-10 Thread Tomeu Vizoso
On Wed, 29 May 2019 at 19:38, Robin Murphy wrote: > > On 29/05/2019 16:09, Tomeu Vizoso wrote: > > On Tue, 21 May 2019 at 18:11, Clément Péron wrote: > >> > > [snip] > >> [ 345.204813] panfrost 180.gpu: mmu irq status=1 > >> [ 345.209617] panfrost 180.gpu: Unhandled Page fault in AS0

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

2019-06-10 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/arm/boot/dts/mt2701.dtsi | 1 - arch/arm/boot/dts/mt7623.dtsi | 1 - 2 files changed, 2 deletions(-) diff --git

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

2019-06-10 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 | 15 --- 1 file changed, 15 deletions(-) diff --git

[PATCH v2 10/12] iommu/mediatek: Use builtin_platform_driver

2019-06-10 Thread Yong Wu
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. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c| 31

[PATCH v2 09/12] memory: mtk-smi: Get rid of mtk_smi_larb_get/put

2019-06-10 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 --- drivers/memory/mtk-smi.c | 14

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

2019-06-10 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 ---

[PATCH v2 07/12] media: mtk-vcodec: Get rid of mtk_smi_larb_get/put

2019-06-10 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 Signed-off-by: Yong Wu Reviewed-by: Evan Green ---

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

2019-06-10 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 Signed-off-by: Yong Wu Reviewed-by: Evan Green ---

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

2019-06-10 Thread Yong Wu
MediaTek IOMMU has already added device_link between the consumer and smi-larb device. If the jpg device call the pm_runtime_get_sync, the smi-larb's pm_runtime_get_sync also be called automatically. CC: Rick Chang Signed-off-by: Yong Wu Reviewed-by: Evan Green ---

[PATCH v2 04/12] memory: mtk-smi: Add device-link between smi-larb and smi-common

2019-06-10 Thread Yong Wu
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_sync (smi-common-dev) will be called automatically. CC:

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

2019-06-10 Thread Yong Wu
MediaTek IOMMU don't have its power-domain. all the consumer connect with smi-larb, then connect with smi-common. M4U | smi-common | - | |... | | larb1 larb2 | | vdec venc When the consumer works, it should

[PATCH v2 02/12] iommu/mediatek: Add probe_defer for smi-larb

2019-06-10 Thread Yong Wu
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 after the smi driver. When there is no this patch, if some

[PATCH v2 00/12] Clean up "mediatek,larb" after adding device_link

2019-06-10 Thread Yong Wu
MediaTek IOMMU block diagram always like below: M4U | smi-common | - | | ... | | larb1 larb2 | | vdec venc All the consumer connect with smi-larb, then connect with smi-common. MediaTek IOMMU don't have its

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

2019-06-10 Thread Yong Wu
After adding device_link between the consumer with the smi-larbs, if the consumer call its owner pm_runtime_get(_sync), the pm_runtime_get(_sync) of smi-larb and smi-common will be called automatically. Thus, the consumer don't need the property. And IOMMU also know which larb this consumer

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-06-10 Thread Jean-Philippe Brucker
On 07/06/2019 18:43, Jacob Pan wrote: >>> So it seems we agree on the following: >>> - iommu_unregister_device_fault_handler() will never fail >>> - iommu driver cleans up all pending faults when handler is >>> unregistered >>> - assume device driver or guest not sending more page response >>>

Re: How to resolve an issue in swiotlb environment?

2019-06-10 Thread Christoph Hellwig
Hi Yoshihiro, sorry for not taking care of this earlier, today is a public holiday here and thus I'm not working much over the long weekend. On Mon, Jun 10, 2019 at 11:13:07AM +, Yoshihiro Shimoda wrote: > I have another way to avoid the issue. But it doesn't seem that a good way >

[PATCH v7 06/21] iommu/io-pgtable-arm-v7s: Extend MediaTek 4GB Mode

2019-06-10 Thread Yong Wu
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 from 0x1__ to 0x1__, the bit32 is always

[PATCH v7 07/21] iommu/mediatek: Add bclk can be supported optionally

2019-06-10 Thread Yong Wu
In some SoCs, M4U doesn't have its "bclk", it will use the EMI clock instead which has always been enabled when entering kernel. Currently mt2712 and mt8173 have this bclk while mt8183 doesn't. This also is a preparing patch for mt8183. Signed-off-by: Yong Wu Reviewed-by: Evan Green ---

[PATCH v7 03/21] memory: mtk-smi: Use a general config_port interface

2019-06-10 Thread Yong Wu
The config_port of mt2712 and mt8183 are the same. Use a general config_port interface instead. In addition, in mt2712, larb8 and larb9 are the bdpsys larbs which are not the normal larb, their register space are different from the normal one. thus, we can not call the general config_port. In

[PATCH v7 00/21] MT8183 IOMMU SUPPORT

2019-06-10 Thread Yong Wu
This patchset mainly adds support 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: EMI |

[PATCH v7 18/21] iommu/mediatek: Fix VLD_PA_RNG register backup when suspend

2019-06-10 Thread Yong Wu
The register VLD_PA_RNG(0x118) was forgot to backup while adding 4GB mode support for mt2712. this patch add it. Fixes: 30e2fccf9512 ("iommu/mediatek: Enlarge the validate PA range for 4GB mode") Signed-off-by: Yong Wu Reviewed-by: Evan Green --- drivers/iommu/mtk_iommu.c | 2 ++

[PATCH v7 19/21] iommu/mediatek: Rename enable_4GB to dram_is_4gb

2019-06-10 Thread Yong Wu
This patch only rename the variable name from enable_4GB to dram_is_4gb for readable. Signed-off-by: Yong Wu Reviewed-by: Evan Green --- drivers/iommu/mtk_iommu.c | 10 +- drivers/iommu/mtk_iommu.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git

[PATCH v7 20/21] iommu/mediatek: Fix iova_to_phys PA start for 4GB mode

2019-06-10 Thread Yong Wu
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_ ... 0x1__0x1__ (No change) Thus,

[PATCH v7 21/21] iommu/mediatek: Switch to SPDX license identifier

2019-06-10 Thread Yong Wu
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 --- drivers/iommu/mtk_iommu.c | 10 +- drivers/iommu/mtk_iommu.h | 10 +-

[PATCH v7 16/21] memory: mtk-smi: Add bus_sel for mt8183

2019-06-10 Thread Yong Wu
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 to enter mmu1 while the others still keep enter mmu0. In

[PATCH v7 14/21] iommu/mediatek: Add mmu1 support

2019-06-10 Thread Yong Wu
Normally the M4U HW connect EMI with smi. the diagram is like below: EMI | M4U | smi-common | - ||| |... larb0 larb1 larb2 larb3 Actually there are 2 mmu cells

[PATCH v7 17/21] memory: mtk-smi: Get rid of need_larbid

2019-06-10 Thread Yong Wu
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, the "mediatek,larb-id" only be needed for mt2712 which have 2

[PATCH v7 15/21] memory: mtk-smi: Invoke pm runtime_callback to enable clocks

2019-06-10 Thread Yong Wu
This patch only move the clk_prepare_enable and config_port into the runtime suspend/resume callback. It doesn't change the code content and sequence. This is a preparing patch for adjusting SMI_BUS_SEL for mt8183. (SMI_BUS_SEL need to be restored after smi-common resume every time.) Also it

[PATCH v7 13/21] iommu/mediatek: Add mt8183 IOMMU support

2019-06-10 Thread Yong Wu
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 HW like mt8173 while mt2712 has two. 2) mt8183 don't have

[PATCH v7 10/21] iommu/mediatek: Move reset_axi into plat_data

2019-06-10 Thread Yong Wu
In mt8173 and mt8183, 0x48 is REG_MMU_STANDARD_AXI_MODE while it is REG_MMU_CTRL in the other SoCs, and the bits meaning is completely different with the REG_MMU_STANDARD_AXI_MODE. This patch moves this property to plat_data, it's also a preparing patch for mt8183. Signed-off-by: Yong Wu

[PATCH v7 11/21] iommu/mediatek: Move vld_pa_rng into plat_data

2019-06-10 Thread Yong Wu
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 --- drivers/iommu/mtk_iommu.c | 3 ++- drivers/iommu/mtk_iommu.h | 1 + 2 files changed, 3 insertions(+), 1

[PATCH v7 12/21] memory: mtk-smi: Add gals support

2019-06-10 Thread Yong Wu
In some SoCs like mt8183, SMI add GALS(Global Async Local Sync) module which can help synchronize for the modules in different clock frequency. It can be seen as a "asynchronous fifo". This is a example diagram: M4U | -- || gals0-rx

[PATCH v7 09/21] iommu/mediatek: Refine protect memory definition

2019-06-10 Thread Yong Wu
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 complex MACRO and use a common if-else instead.

[PATCH v7 08/21] iommu/mediatek: Add larb-id remapped support

2019-06-10 Thread Yong Wu
The larb-id may be remapped in the smi-common, this means the larb-id reported in the mtk_iommu_isr isn't the real larb-id, Take mt8183 as a example: M4U | - | SMI common |

[PATCH v7 05/21] iommu/io-pgtable-arm-v7s: Add paddr_to_iopte and iopte_to_paddr helpers

2019-06-10 Thread Yong Wu
Add two helper functions: paddr_to_iopte and iopte_to_paddr. Signed-off-by: Yong Wu Reviewed-by: Robin Murphy Reviewed-by: Evan Green --- drivers/iommu/io-pgtable-arm-v7s.c | 45 -- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git

[PATCH v7 04/21] memory: mtk-smi: Use a struct for the platform data for smi-common

2019-06-10 Thread Yong Wu
Use a struct as the platform special data instead of the enumeration. Also there is a minor change that moving the position of "enum mtk_smi_gen" definition, this is because we expect define "struct mtk_smi_common_plat" before it is referred. This is a preparing patch for mt8183. Signed-off-by:

[PATCH v7 02/21] iommu/mediatek: Use a struct as the platform data

2019-06-10 Thread Yong Wu
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 Reviewed-by: Evan Green --- drivers/iommu/mtk_iommu.c | 24 drivers/iommu/mtk_iommu.h |

[PATCH v7 01/21] dt-bindings: mediatek: Add binding for mt8183 IOMMU and SMI

2019-06-10 Thread Yong Wu
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: EMI |

RE: How to resolve an issue in swiotlb environment?

2019-06-10 Thread Yoshihiro Shimoda
Hi Christoph, Alan, (add linux-usb ML on CC.) > From: Yoshihiro Shimoda, Sent: Friday, June 7, 2019 9:00 PM > > Hi Christoph, > > I think we should continue to discuss on this email thread instead of the > fixed DMA-API.txt patch [1] > > [1] > https://marc.info/?t=15598941221=1=2 > > >

Re: [PATCH v4 01/14] dt-bindings: Add binding for MT2712 MIPI-CSI2

2019-06-10 Thread Tomasz Figa
On Mon, Jun 10, 2019 at 4:51 PM CK Hu wrote: > > Hi, Tomasz: > > On Mon, 2019-06-10 at 12:32 +0900, Tomasz Figa wrote: > > Hi CK, Stu, > > > > On Mon, Jun 10, 2019 at 11:34 AM CK Hu wrote: > > > > > > Hi, Stu: > > > > > > "mediatek,mt2712-mipicsi" and "mediatek,mt2712-mipicsi-common" have many >

Re: [PATCH v4 01/14] dt-bindings: Add binding for MT2712 MIPI-CSI2

2019-06-10 Thread CK Hu
Hi, Tomasz: On Mon, 2019-06-10 at 12:32 +0900, Tomasz Figa wrote: > Hi CK, Stu, > > On Mon, Jun 10, 2019 at 11:34 AM CK Hu wrote: > > > > Hi, Stu: > > > > "mediatek,mt2712-mipicsi" and "mediatek,mt2712-mipicsi-common" have many > > common part with "mediatek,mt8183-seninf", and I've a

RE: How to resolve an issue in swiotlb environment?

2019-06-10 Thread Biju Das
Hi All, Any update on the below issue. I am seeing similar issue on RZ/G2M board with Linux version 5.2.0-rc3. root@hihope-rz-g2m:~# [ 35.414177] usb 2-1: new SuperSpeed Gen 1 USB device number 2 using xhci-hcd [ 35.449402] usb-storage 2-1:1.0: USB Mass Storage device detected [