[PATCH 07/29] ARM: dma-mapping: arm_iommu_attach_device: automatically set max_seg_size

2014-08-05 Thread Marek Szyprowski
If device has no max_seg_size set, we assume that there is no limit and force it to DMA_BIT_MASK(32) to always use contiguous mappings in DMA address space. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- arch/arm/mm/dma-mapping.c | 16 1 file changed, 16

[PATCH 00/29] Exynos SYSMMU (IOMMU) integration with DT and DMA-mapping subsystem

2014-08-05 Thread Marek Szyprowski
Hello Everyone, A lot of things has happened in the area of improving Exynos IOMMU driver and discussion about generic IOMMU bindings, which finally motivated me to get back to IOMMU related tasks. Just to remind, here are those 2 important threads: 1. [PATCH v13 00/19] iommu/exynos: Fixes and

[PATCH 08/29] ARM: dma-mapping: add helpers for managing default per-device dma mappings

2014-08-05 Thread Marek Szyprowski
This patch adds 2 helpers: arm_iommu_create_default_mapping and arm_iommu_release_default_mapping for managing default iommu-based dma-mapping address space, created for exlusive use only by the given device. Those helpers are convenient for setting up iommu-based dma-mapping for most typical

[PATCH 02/29] ARM: Exynos: bind power domains earlier, on device creation

2014-08-05 Thread Marek Szyprowski
This patches change initialization time of power domain driver from client device driver bind to device creation. This lets other core drivers to register power domain notifiers before client driver is bound. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com ---

[PATCH 11/29] DRM: exynos: add DRIVER_HAS_OWN_IOMMU_MANAGER flag to all sub-drivers

2014-08-05 Thread Marek Szyprowski
Exynos DRM drivers do their own management of IO address space of all controlled devices, so set DRIVER_HAS_OWN_IOMMU_MANAGER flag to instruct IOMMU subsystem not to create any defaults for them. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com ---

[PATCH 09/29] ARM: dma-mapping: provide stubs if no ARM_DMA_USE_IOMMU has been selected

2014-08-05 Thread Marek Szyprowski
This patch provides stubs returing errors for all iommu related arm dma-mapping functions, which are used when CONFIG_ARM_DMA_USE_IOMMU is not set. This let drivers to use common code for iommu and non-iommu cases without additional ifdefs. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com

[PATCH 18/29] iommu: exynos: remove unused functions

2014-08-05 Thread Marek Szyprowski
This patch removes two unneeded functions, which are not a part of generic IOMMU API and were never used by any other driver. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/iommu/exynos-iommu.c | 31 --- 1 file changed, 31 deletions(-) diff

[PATCH 14/29] devicetree: Update Exynos SYSMMU device tree bindings

2014-08-05 Thread Marek Szyprowski
This patch describes how generic iommu bindings are implemented by Exynos SYSMMU driver. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- .../devicetree/bindings/iommu/samsung,sysmmu.txt | 93 +++--- 1 file changed, 84 insertions(+), 9 deletions(-) diff --git

[PATCH 05/29] drivers: convert suppress_bind_attrs parameter into flags

2014-08-05 Thread Marek Szyprowski
This patch extends struct device_driver with a flags member and converts existing suppress_bind_attrs bool field to a flag. This way new flags can be easily added in the future without changing the structure itself. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com ---

[PATCH 20/29] iommu: exynos: refactor function parameters to simplify code

2014-08-05 Thread Marek Szyprowski
This patch simplifies the code by: - refactoring function parameters from struct device pointer to direct pointer to struct sysmmu drvdata - moving list_head enteries from struct exynos_iommu_owner directly to struct sysmmu_drvdata Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com ---

[PATCH 13/29] temporary: media: s5p-mfc: remove DT hacks initialization custom memory init code

2014-08-05 Thread Marek Szyprowski
This patch removes custom initialization of reserved memory regions from s5p-mfc driver. Driver will use main device pointer for all memory allocations. This patch is temporary, do not merge it yet. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com ---

[PATCH 12/29] DRM: Exynos: fix window clear code

2014-08-05 Thread Marek Szyprowski
To correctly disable hardware window during driver init, both enable bits (WINCONx_ENWIN in WINCON and SHADOWCON_CHx_ENABLE in SHADOWCON) must be cleared, otherwise hardware fails to re-enable such window later. While touching this function, also temporarily disable ctx-suspended flag to let

[PATCH 04/29] drivers: base: add notifier for failed driver bind

2014-08-05 Thread Marek Szyprowski
This patch adds support for getting a notify for failed device driver bind, so all the items done in BUS_NOTIFY_BIND_DRIVER event can be cleaned if the driver fails to bind. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/base/dd.c | 10 +++---

[PATCH 10/29] drivers: add DRIVER_HAS_OWN_IOMMU_MANAGER flag

2014-08-05 Thread Marek Szyprowski
This patch adds a new flags for device drivers. This flag instructs kernel that the device driver does it own management of IOMMU assisted IO address space translations, so no default dma-mapping structures should be initialized. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com ---

[PATCH 03/29] clk: exynos: add missing smmu_g2d clock and update comments

2014-08-05 Thread Marek Szyprowski
This patch adds missing smmu_g2d clock implementation and updates comment about Exynos4 clocks from 278-282 range. Those clocks are available on all Exynos4 SoC series, so the misleading comment has been removed. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com ---

[PATCH 17/29] iommu: exynos: don't read version register on every tlb operation

2014-08-05 Thread Marek Szyprowski
This patch removes reading of REG_MMU_VERSION register on every tlb operation and caches SYSMMU version in driver's internal data. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/iommu/exynos-iommu.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff

[PATCH 25/29] iommu: exynos: add support for runtime_pm

2014-08-05 Thread Marek Szyprowski
This patch enables support for runtime pm for SYSMMU controllers. State of each controller is saved before master's device power domain is turned off and restored after it has been turned on. exynos_iommu_attach_device() function might be called anytime, even when power domain for master's device

[PATCH 16/29] iommu: exynos: make driver multiarch friendly

2014-08-05 Thread Marek Szyprowski
Initialize all structures and register to iommu subsystem only on Exynos compatible platforms. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/iommu/exynos-iommu.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/iommu/exynos-iommu.c

[PATCH 19/29] iommu: exynos: remove useless spinlock

2014-08-05 Thread Marek Szyprowski
This patch removes useless spinlocks and other unused members from struct exynos_iommu_owner. There is no point is protecting this structure by spinlock because content of this structure doesn't change and other structures have their own spinlocks. Signed-off-by: Marek Szyprowski

[PATCH 15/29] ARM: DTS: Exynos4: add System MMU nodes

2014-08-05 Thread Marek Szyprowski
This patch adds System MMU nodes that are specific to Exynos4210/4x12 series. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- arch/arm/boot/dts/exynos4.dtsi| 118 ++ arch/arm/boot/dts/exynos4210.dtsi | 23

[PATCH 23/29] iommu: exynos: init iommu controllers from device tree

2014-08-05 Thread Marek Szyprowski
This patch adds code to initialize and assign SYSMMU controllers to their master devices defined in device tree. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/iommu/exynos-iommu.c | 152 +-- 1 file changed, 145 insertions(+), 7

[PATCH 27/29] iommu: exynos: document internal structures

2014-08-05 Thread Marek Szyprowski
Add a few words of comment to all internal structures used by the driver. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/iommu/exynos-iommu.c | 59 1 file changed, 38 insertions(+), 21 deletions(-) diff --git

[PATCH 21/29] iommu: exynos: remove unused functions, part 2

2014-08-05 Thread Marek Szyprowski
After refactoring functions to use pointer to struct sysmmu_drvdata directly, some functions became useless and thus never used, so remove them completely. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/iommu/exynos-iommu.c | 43 ---

[PATCH 26/29] iommu: exynos: rename variables to reflect their purpose

2014-08-05 Thread Marek Szyprowski
This patch renames some variables to make the code easier to understand. 'domain' is replaced by 'iommu_domain' (more generic entity) and really meaning less 'priv' by 'domain' to reflect its purpose. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/iommu/exynos-iommu.c | 191

[PATCH 24/29] iommu: exynos: create default iommu-based dma-mapping for master devices

2014-08-05 Thread Marek Szyprowski
This patch adds code to create default per-device iommu-based dma-mapping instance for all master devices, whose driver didn't set DRIVER_HAS_OWN_IOMMU_MANAGER flag. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/iommu/exynos-iommu.c | 49

[PATCH 28/29] iommu: exynos: remove excessive includes and sort others alphabetically

2014-08-05 Thread Marek Szyprowski
Removed following unused includes: linux/mm.h, linux/errno.h, linux/memblock.h and linux/export.h. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com --- drivers/iommu/exynos-iommu.c | 18 +++--- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git

[PATCH 22/29] iommu: exynos: add support for binding more than one sysmmu to master device

2014-08-05 Thread Marek Szyprowski
This patch adds support for assigning more than one SYSMMU controller to the master device. This has been achieved simply by chaning the struct device pointer in struct exynos_iommu_owner into the list of struct sysmmu_drvdata of all controllers assigned to the given master device. Signed-off-by:

[PATCH 29/29] temporary: media: s5p-mfc: add support for IOMMU

2014-08-05 Thread Marek Szyprowski
This patch is an example how to use more than one IOMMU controller in a device driver for hardware blocks, which have more then one dma master (memory interface with iommu controller). This patch is temporary, do not merge it yet. Signed-off-by: Marek Szyprowski m.szyprow...@samsung.com ---

[PATCH] iommu/vt-d: Defer domain removal if device is assigned to a driver

2014-08-05 Thread Joerg Roedel
Hi, On Mon, Aug 04, 2014 at 01:42:05PM +0200, Borislav Petkov wrote: It is always questionable when people remove BUG_ONs because relaxing assertions sound like a temporary fix more often than not. Sounds to me that the original commit which deals with BUS_NOTIFY_DEL_DEVICE needs to try again

Re: [PATCH v4 1/1] iommu-api: Add map_sg/unmap_sg functions

2014-08-05 Thread Konrad Rzeszutek Wilk
On Thu, Jul 31, 2014 at 05:54:44PM -0700, Olav Haugan wrote: Mapping and unmapping are more often than not in the critical path. map_sg and unmap_sg allows IOMMU driver implementations to optimize the process of mapping and unmapping buffers into the IOMMU page tables. Instead of mapping a