summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/exynos/exynos_drm_iommu.c
AgeCommit message (Collapse)Author
2018-12-04drm/exynos/iommu: merge IOMMU and DMA codeAndrzej Hajda
As DMA code is the only user of IOMMU code both files can be merged. It allows to remove stub functions, after slight adjustment of exynos_drm_register_dma. Since IOMMU functions are used locally they can be marked static. Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-12-04drm/exynos/iommu: replace preprocessor conditionals with C conditionalsAndrzej Hajda
Using C conditionals is preferred solution - it provides better code coverage, makes code more clear. Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-12-04drm/exynos/iommu: move IOMMU specific stuff into exynos_drm_iommu.cAndrzej Hajda
Since __exynos_iommu* functions are used only in exynos_drm_iommu.c we can move them there. Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2016-07-13drm/exynos: iommu: move ARM specific code to exynos_drm_iommu.hMarek Szyprowski
This patch moves all ARM 32bit DMA-mapping/IOMMU dependant code from exynos_drm_iommu.c to .h, to let it compile conditionally and prepare for adding support for other architectures/IOMMU glue code (like ARM 64bit with IOMMU-DMA glue). Later, when ARM 32bit and 64bit will be unified, this code can be removed. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2016-07-13drm/exynos: iommu: remove unused entries from exynos_drm_private strcutureMarek Szyprowski
This patch removes unused entries from exynos_drm_private strcuture. da_start/da_space_size were only used in drm_create_iommu_mapping() function and never set to other value than the defaults. Instead use default values directly in arm_iommu_create_mapping() call. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2016-07-13drm/exynos: iommu: add a check if all sub-devices have iommu controllerMarek Szyprowski
This patch adds a check if all devices belonging to Exynos DRM have the same dma_map_ops set. This is required to enable operation with IOMMU enabled. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2016-07-13drm/exynos: iommu: move dma_params configuration code to separate functionsMarek Szyprowski
Move code for managing DMA max segment size parameter to separate functions. This patch also replaces devm_kzalloc() with kzalloc() and adds proper kfree call. devm_kzalloc() cannot be used for dma_params structure, because it will be freed on driver remove not on device release. This means in case of Exynos DRM being compiled as module and loaded 2 times, a user-after-free issue will happen. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2016-03-01drm/exynos: use real device for DMA-mapping operationsMarek Szyprowski
This patch changes device pointer provided to all calls to DMA-mapping subsystem from the virtual exynos-drm 'device' to the real device pointer of one of the CRTC devices (decon, fimd or mixer). This way no more hacks will be needed to configure proper DMA-mapping address space on the common virtual exynos-drm device. This change also removes the need for some hacks in IOMMU related code. It also finally solves the problem of Exynos DRM driver not working on ARM64 architecture, which provides noop-based DMA-mapping operations for virtual platform devices. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2016-03-01drm/exynos: remove incorrect ccflags from MakefileAndrzej Hajda
Include directories are provided by core already, adding them in driver is redundand and causes warnings in case of out-of-tree build. v2: - fixed include in exynos_drm_iommu.c - typo in commit message Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2015-10-26drm/exynos: fix to detach device of iommuJoonyoung Shim
The arm_iommu_detach_device() is a function to detach device of iommu attached by arm_iommu_attach_device(). The exynos-drm uses arm_iommu_attach_device() so it should use arm_iommu_detach_device() to detach device of iommu, not iommu_detach_device(). The drm_release_iommu_mapping() is a function to release mapping of iommu created by arm_iommu_create_mapping(). It is called by exynos_drm_unload() so shouldn't be called by drm_iommu_detach_device(). Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2015-08-16drm/exynos: remove drm_iommu_attach_device_if_possibleJoonyoung Shim
Already drm_iommu_attach_device checks whether support iommu internally. It should clear channels always regardless iommu support. We didn't know because we can detect the problem when iommu is enabled, so we don't have to use drm_iommu_attach_device_if_possible and then we can remove drm_iommu_attach_device_if_possible and clear_channels function pointer. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2015-08-16drm/exynos: remove unnecessary checking to support iommuJoonyoung Shim
Already drm_iommu_attach_device and drm_iommu_detach_device check whether support iommu internally, so we don't have to call is_drm_iommu_supported before call them. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2015-06-22drm/exynos: add drm_iommu_attach_device_if_possible()Hyungwon Hwang
Every CRTC drivers in Exynos DRM implements the code which checks whether IOMMU is supported or not, and if supported enable it. Making new helper for it generalize each CRTC drivers. Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2015-06-20drm/exynos: iommu: improve a check for non-iommu dma_opsMarek Szyprowski
DRM Exynos driver is relying on dma-mapping internal structures when used with IOMMU enabled. This patch partially hides dma-mapping internal things by using proper get_dma_ops/set_dma_ops calls. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2015-06-20drm/exynos: iommu: detach from default dma-mapping domain on initMarek Szyprowski
This patch adds code, which detach sub-device nodes from default iommu domain if such has been configured. This lets Exynos DRM driver to properly attach sub-devices to its own, common for all sub-devices domain. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2014-02-28arm: dma-mapping: remove order parameter from arm_iommu_create_mapping()Marek Szyprowski
The 'order' parameter for IOMMU-aware dma-mapping implementation was introduced mainly as a hack to reduce size of the bitmap used for tracking IO virtual address space. Since now it is possible to dynamically resize the bitmap, this hack is not needed and can be removed without any impact on the client devices. This way the parameters for arm_iommu_create_mapping() becomes much easier to understand. 'size' parameter now means the maximum supported IO address space size. The code will allocate (resize) bitmap in chunks, ensuring that a single chunk is not larger than a single memory page to avoid unreliable allocations of size larger than PAGE_SIZE in atomic context. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
2013-09-05drm/exynos: Add NULL pointer checkSachin Kamat
devm_kzalloc can fail. Hence check the pointer to avoid NULL pointer dereferencing. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-01-04drm/exynos: change file license to GPLInki Dae
This patch changes file license to GPL Most of exynos files had been copied from some random file and not updated correctly. So this patch corrects the file license. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-12-13drm/exynos/iommu: fix return value check in drm_create_iommu_mapping()Wei Yongjun
In case of error, function arm_iommu_create_mapping() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2012-11-29drm/exynos: add iommu support for exynos drm frameworkInki Dae
Changelog v4: - fix condition to drm_iommu_detach_device funtion. Changelog v3: - add dma_parms->max_segment_size setting of drm_device->dev. - use devm_kzalloc instead of kzalloc. Changelog v2: - fix iommu attach condition. . check archdata.dma_ops of drm device instead of subdrv device's one. - code clean to exynos_drm_iommu.c file. . remove '#ifdef CONFIG_ARM_DMA_USE_IOMMU' from exynos_drm_iommu.c and add it to driver/gpu/drm/exynos/Kconfig. Changelog v1: This patch adds iommu support for exynos drm framework with dma mapping api. In this patch, we used dma mapping api to allocate physical memory and maps it with iommu table and removed some existing codes and added new some codes for iommu support. GEM allocation requires one device object to use dma mapping api so this patch uses one iommu mapping for all sub drivers. In other words, all sub drivers have same iommu mapping. Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>