From c704f1b47d6cb4b61b2e120030088c2a7cefcc13 Mon Sep 17 00:00:00 2001 From: Inki Dae Date: Fri, 21 Dec 2012 17:59:20 +0900 Subject: drm/exynos: consider no iommu support to console framebuffer This patch considers no iommu support to kernel space mapping of console framebuffer. Without iommu, we get physical address instead of device address after dma_alloc_attrs function is called. So we should consider the case without iommu when it maps console framebuffer with kernel space. Changelog v2: - calll vunmap function only with iommu support. Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/drm/exynos/exynos_drm_fbdev.c') diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index f433eb7533a9..eae064a3ee30 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -34,6 +34,7 @@ #include "exynos_drm_drv.h" #include "exynos_drm_fb.h" #include "exynos_drm_gem.h" +#include "exynos_drm_iommu.h" #define MAX_CONNECTOR 4 #define PREFERRED_BPP 32 @@ -111,9 +112,18 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, /* map pages with kernel virtual space. */ if (!buffer->kvaddr) { - unsigned int nr_pages = buffer->size >> PAGE_SHIFT; - buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP, + if (is_drm_iommu_supported(dev)) { + unsigned int nr_pages = buffer->size >> PAGE_SHIFT; + + buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP, pgprot_writecombine(PAGE_KERNEL)); + } else { + phys_addr_t dma_addr = buffer->dma_addr; + if (dma_addr) + buffer->kvaddr = phys_to_virt(dma_addr); + else + buffer->kvaddr = (void __iomem *)NULL; + } if (!buffer->kvaddr) { DRM_ERROR("failed to map pages to kernel space.\n"); return -EIO; @@ -128,8 +138,12 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr; fbi->screen_base = buffer->kvaddr + offset; - fbi->fix.smem_start = (unsigned long) + if (is_drm_iommu_supported(dev)) + fbi->fix.smem_start = (unsigned long) (page_to_phys(sg_page(buffer->sgt->sgl)) + offset); + else + fbi->fix.smem_start = (unsigned long)buffer->dma_addr; + fbi->screen_size = size; fbi->fix.smem_len = size; @@ -320,7 +334,7 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev, struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd->exynos_gem_obj; struct drm_framebuffer *fb; - if (exynos_gem_obj->buffer->kvaddr) + if (is_drm_iommu_supported(dev) && exynos_gem_obj->buffer->kvaddr) vunmap(exynos_gem_obj->buffer->kvaddr); /* release drm framebuffer and real buffer */ -- cgit v1.2.1 From d81aecb5e680311e1f3fd71e49e6a4072d2374d2 Mon Sep 17 00:00:00 2001 From: Inki Dae Date: Tue, 18 Dec 2012 02:30:17 +0900 Subject: drm/exynos: change file license to GPL 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 Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'drivers/gpu/drm/exynos/exynos_drm_fbdev.c') diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index eae064a3ee30..71f867340a88 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -6,24 +6,10 @@ * Joonyoung Shim * Seung-Woo Kim * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. */ #include -- cgit v1.2.1