From patchwork Fri Dec 21 08:44:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 1902461 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 30D5ADF25A for ; Fri, 21 Dec 2012 08:47:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1E1E5E6133 for ; Fri, 21 Dec 2012 00:47:10 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTP id 6CE85E60C8 for ; Fri, 21 Dec 2012 00:45:15 -0800 (PST) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MFD00ANVHKQXNX0@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 21 Dec 2012 17:44:40 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.46]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id C8.15.12699.87124D05; Fri, 21 Dec 2012 17:44:40 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-45-50d421786d18 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 78.15.12699.77124D05; Fri, 21 Dec 2012 17:44:39 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.51.53]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MFD00079HMFVX90@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 21 Dec 2012 17:44:39 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/exynos: consider no iommu support to console framebuffer Date: Fri, 21 Dec 2012 17:44:39 +0900 Message-id: <1356079479-21478-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.4.1 DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMLMWRmVeSWpSXmKPExsVy+t8zPd0KxSsBBnMWslhc+fqezYHR4373 caYAxigum5TUnMyy1CJ9uwSujBnTfrMWnBesWHSjhbWB8SpfFyMnh4SAicTW9z+ZIWwxiQv3 1rOB2EICyxgllnxygKnpffaEtYuRCyi+iFHi5fQWZoii9UwSv+65g9hsAqoSE1fcB2sWETCV 6Ji0lAXEZhawk9j1oJ8dxBYW8JXondwCZrMA1d9fcBlsDq+Ai8T7tieMEMsUJBbce8sGUSMg 8W3yIaA5HEBxWYlNB5hBbpAQ2MEm8Wv3OxaIekmJgytusExgFFzAyLCKUTS1ILmgOCk910iv ODG3uDQvXS85P3cTIySkpHcwrmqwOMQowMGoxMMbaXE5QIg1say4MvcQowQHs5IIL9NXoBBv SmJlVWpRfnxRaU5q8SFGH6BLJjJLiSbnA8M9ryTe0NjA2NDQ0tDM1NLUAIewkjhvs0dKgJBA emJJanZqakFqEcw4Jg5OqQZGz9z1ud3eybvt1wUJmIqbXyxi+zRzYXbOD7HDe5hy7pfzMcyt +2J+meGsbE65bn2YWmLasRSFb8de8aW3hvdrRTDJtG0+8/vAiuSjD9orjm/mWDF/lbB6/LSX 5RbzLRSaNdau25HzYL/9SocXu1m2Mi1bXXzywd6Gro5L96Vyxe9qHVMpDjujxFKckWioxVxU nAgAEg+XUFYCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRmVeSWpSXmKPExsVy+t9jAd1yxSsBBsuWWVhc+fqezYHR4373 caYAxqgGRpuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wc oLFKCmWJOaVAoYDE4mIlfTtME0JD3HQtYBojdH1DguB6jAzQQMI6xowZ036zFpwXrFh0o4W1 gfEqXxcjJ4eEgIlE77MnrBC2mMSFe+vZuhi5OIQEFjFKvJzewgySEBJYzyTx6547iM0moCox ccV9NhBbRMBUomPSUhYQm1nATmLXg352EFtYwFeid3ILmM0CVH9/wWWwObwCLhLv254wQixT kFhw7y3bBEbuBYwMqxhFUwuSC4qT0nON9IoTc4tL89L1kvNzNzGCQ/aZ9A7GVQ0WhxgFOBiV eHgjLS4HCLEmlhVX5h5ilOBgVhLhZfoKFOJNSaysSi3Kjy8qzUktPsToA7R9IrOUaHI+MJ7y SuINjU3MjCyNzIxNzI2NcQgrifM2e6QECAmkJ5akZqemFqQWwYxj4uCUamBkOJ8+I5LzSWic 03nGAw/dz29L446YEDrD7OkLg/0p9xyeLdpz+VnkaS67siPe0p8DRYOXO5xqlxHpCpPcKr/r 5F6/VZ/eSDbaLjtVNvv4qwuTdy9/qnU2YOXtmZMdfig8t7FTlnyY6jX1htWLHLnrc/QuP7nw zOLBj9S9SptTlN5Oi0pXNTd2VWIpzkg01GIuKk4EAPP8wsqGAgAA X-CFilter-Loop: Reflected Cc: kyungmin.park@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org 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. Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index f433eb7..ae0607f 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;