Re: [PATCH 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-27 Thread leizhen
On 2015/5/27 0:12, Will Deacon wrote: On Mon, May 25, 2015 at 03:07:17AM +0100, leizhen wrote: On 2015/5/21 19:25, Will Deacon wrote: On Wed, May 13, 2015 at 09:33:19AM +0100, leizhen wrote: If SMMU_IDR1.SIDSIZE = 32 really exist(or too big), we need dynamic choose Lv2 table size(4K,16K,64K).

[PATCH 1/4] iommu/iova: Avoid over-allocating when size-aligned

2015-05-27 Thread Robin Murphy
Currently, allocating a size-aligned IOVA region quietly adjusts the actual allocation size in the process, returning a rounded-up power-of-two-sized allocation. This results in mismatched behaviour in the IOMMU driver if the original size was not a power of two, where the original size is mapped,

[PATCH 2/4] iommu: Implement common IOMMU ops for DMA mapping

2015-05-27 Thread Robin Murphy
Taking inspiration from the existing arch/arm code, break out some generic functions to interface the DMA-API to the IOMMU-API. This will do the bulk of the heavy lifting for IOMMU-backed dma-mapping. Signed-off-by: Robin Murphy robin.mur...@arm.com --- drivers/iommu/Kconfig | 7 +

[PATCH 3/4] arm64: Add IOMMU dma_ops

2015-05-27 Thread Robin Murphy
Taking some inspiration from the arch/arm code, implement the arch-specific side of the DMA mapping ops using the new IOMMU-DMA layer. Whilst proliferating per-device private IOMMU data via dev-archdata is less than ideal, it will do the job for now, especially since we can't easily handle the

Re: [RFC/PATCH 0/9] IOMMU probe deferral support

2015-05-27 Thread Marek Szyprowski
Hello, On 2015-05-15 01:00, Laurent Pinchart wrote: This patch series attempts to implement support for deferring probe of both IOMMU drivers and bus master drivers. The relationship between bus masters and IOMMUs creates a strong ordering during initialization of devices. As in the general

[PATCH 0/4] arm64: IOMMU-backed DMA mapping

2015-05-27 Thread Robin Murphy
Hi all, Here's the cleaned-up and nominally ready-to-go IOMMU DMA mapping series, with (I think) all the outstanding comments[1] addressed. I appreciate I've probably missed the boat for 4.2, but I'm ever the optimist... Major changes since RFC: - Renamed things, shuffled things around, and

[PATCH 4/4] arm64: Hook up IOMMU dma_ops

2015-05-27 Thread Robin Murphy
With iommu_dma_ops in place, hook them up to the configuration code, so IOMMU-fronted devices will get them automatically. Signed-off-by: Robin Murphy robin.mur...@arm.com --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/dma-mapping.h | 11 ++-

Re: [RFC/PATCH 3/9] of: dma: Move range size workaround to of_dma_get_range()

2015-05-27 Thread Will Deacon
On Fri, May 15, 2015 at 12:00:04AM +0100, Laurent Pinchart wrote: Invalid dma-ranges values should be worked around when retrieving the DMA range in of_dma_get_range(), not by all callers of the function. This isn't much of a problem now that we have a single caller, but that situation will

[PATCH v2 1/3] Documentation: dt-bindings: Add device-tree binding for ARM SMMUv3 IOMMU

2015-05-27 Thread Will Deacon
This patch adds device-tree bindings for ARM SMMUv3 IOMMU devices. Cc: Mark Rutland mark.rutl...@arm.com Signed-off-by: Will Deacon will.dea...@arm.com --- .../devicetree/bindings/iommu/arm,smmu-v3.txt | 37 ++ 1 file changed, 37 insertions(+) create mode 100644

[PATCH v2 2/3] iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices

2015-05-27 Thread Will Deacon
Version three of the ARM SMMU architecture introduces significant changes and improvements over previous versions of the specification, necessitating a new driver in the Linux kernel. The main change to the programming interface is that the majority of the configuration data has been moved from

[PATCH v2 0/3] iommu/arm=smmu: Add driver for ARM SMMUv3 devices

2015-05-27 Thread Will Deacon
Hi all, This is version two of the patches I originally posted here: http://www.spinics.net/lists/arm-kernel/msg416881.html Changes since version one include: - Lazy allocation of the level-2 stream table on device-add - Limit stream table size based on SIDSIZE (maximum 21-bit atm) -

[PATCH v2 3/3] drivers/vfio: Allow type-1 IOMMU instantiation on top of an ARM SMMUv3

2015-05-27 Thread Will Deacon
The ARM SMMUv3 driver is compatible with the notion of a type-1 IOMMU in VFIO. This patch allows VFIO_IOMMU_TYPE1 to be selected if ARM_SMMU_V3=y. Signed-off-by: Will Deacon will.dea...@arm.com --- drivers/vfio/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 2/2] iommu/arm-smmu: Make force_stage module param read-only in sysfs

2015-05-27 Thread Will Deacon
Changing force_stage dynamically isn't supported by the driver and it also doesn't make a whole lot of sense to change it once the SMMU is up and running. This patch makes the sysfs entry for the parameter read-only. Signed-off-by: Will Deacon will.dea...@arm.com --- drivers/iommu/arm-smmu.c |

[PATCH 1/2] iommu/arm-smmu: Fix ATS1* register writes

2015-05-27 Thread Will Deacon
From: Robin Murphy robin.mur...@arm.com The ATS1* address translation registers only support being written atomically - in SMMUv2 where they are 64 bits wide, 32-bit writes to the lower half are automatically zero-extended, whilst 32-bit writes to the upper half are ignored. Thus, the current

Re: [RFC/PATCH 1/9] arm: dma-mapping: Don't override dma_ops in arch_setup_dma_ops()

2015-05-27 Thread Will Deacon
On Fri, May 15, 2015 at 12:00:02AM +0100, Laurent Pinchart wrote: The arch_setup_dma_ops() function is in charge of setting dma_ops with a call to set_dma_ops(). set_dma_ops() is also called from - highbank and mvebu bus notifiers - dmabounce (to be replaced with swiotlb) -

Re: Master-aware devices and sideband ID data

2015-05-27 Thread Mark Rutland
On Tue, May 26, 2015 at 11:20:59PM +0100, Chalamarla, Tirumalesh wrote: This is some thing we also like to see in ITS and SMMU drivers. On Mar 24, 2015, at 8:50 AM, Mark Rutland mark.rutl...@arm.com wrote: Hi all, For some devices, identification of particular masters is critical to

Re: [PATCH v2 1/6] dt-bindings: iommu: Add binding for mediatek IOMMU

2015-05-27 Thread Yong Wu
Hi Tomasz, Thanks very much for your suggestion!. please help check my comment. On Mon, 2015-05-25 at 15:31 +0900, Tomasz Figa wrote: Hi, Please see my comments inline. On Fri, May 15, 2015 at 6:43 PM, Yong Wu yong...@mediatek.com wrote: This patch add mediatek iommu dts

Re: [RFC/PATCH 3/9] of: dma: Move range size workaround to of_dma_get_range()

2015-05-27 Thread Rob Herring
On Thu, May 14, 2015 at 6:00 PM, Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com wrote: Invalid dma-ranges values should be worked around when retrieving the DMA range in of_dma_get_range(), not by all callers of the function. This isn't much of a problem now that we have a single

Re: [PATCH v2 5/6] iommu/mediatek: Add mt8173 IOMMU driver

2015-05-27 Thread Yong Wu
Hi Tomasz, Thanks. please help check my comments. The others I will change in next version. On Mon, 2015-05-25 at 17:29 +0900, Tomasz Figa wrote: Hi, Please see my comments inline. On Fri, May 15, 2015 at 6:43 PM, Yong Wu yong...@mediatek.com wrote: [snip] + +struct

[PATCH] iommu/amd: Handle integer overflow in dma_ops_area_alloc

2015-05-27 Thread Joerg Roedel
From: Joerg Roedel jroe...@suse.de Handle this case to make sure boundary_size does not become 0 and trigger a BUG_ON later. Signed-off-by: Joerg Roedel jroe...@suse.de --- drivers/iommu/amd_iommu.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git

Re: [PATCH v2 2/6] dt-bindings: mediatek: Add smi dts binding

2015-05-27 Thread Yong Wu
Hi Tomasz, On Mon, 2015-05-25 at 15:48 +0900, Tomasz Figa wrote: Hi, Please see my comments inline. On Fri, May 15, 2015 at 6:43 PM, Yong Wu yong...@mediatek.com wrote: This patch add smi binding document. Signed-off-by: Yong Wu yong...@mediatek.com ---