diff mbox

[1/1] drm: exynos: fix for mapping contigous dma buffers

Message ID 1351945304-15084-2-git-send-email-rahul.sharma@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rahul Sharma Nov. 3, 2012, 12:21 p.m. UTC
This patch fixes the problem of mapping contigous dma buffers. Currently page
struct is calculated from the buf->dma_addr which is not the physical address.
It is replaced by buf->pages which points to the page struct of the first page
of contigous memory chunk. This gives the correct page frame number for
mapping.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_gem.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Comments

Inki Dae Nov. 5, 2012, 2:20 p.m. UTC | #1
2012. 11. 3. ?? 9:21 Rahul Sharma <rahul.sharma@samsung.com> ??:

> This patch fixes the problem of mapping contigous dma buffers. Currently page
> struct is calculated from the buf->dma_addr which is not the physical address.
> It is replaced by buf->pages which points to the page struct of the first page
> of contigous memory chunk. This gives the correct page frame number for
> mapping.
> 
> Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
> ---
> drivers/gpu/drm/exynos/exynos_drm_gem.c |    8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> index c557ac7..50d73f1 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> @@ -120,8 +120,12 @@ static int exynos_drm_gem_map_buf(struct drm_gem_object *obj,
>        }
> 
>        pfn = __phys_to_pfn(sg_phys(sgl)) + page_offset;
> -    } else
> -        pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset;
> +    } else {
> +        if (!buf->pages)
> +            return -EINTR;
> +
> +        pfn = page_to_pfn(buf->pages[0]) + page_offset;
> +    }

Is there any reason you are sending patches respectively? It's better to combine them.

Thanks,
Inki Dae

> 
>    return vm_insert_mixed(vma, f_vaddr, pfn);
> }
> -- 
> 1.7.0.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index c557ac7..50d73f1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -120,8 +120,12 @@  static int exynos_drm_gem_map_buf(struct drm_gem_object *obj,
 		}
 
 		pfn = __phys_to_pfn(sg_phys(sgl)) + page_offset;
-	} else
-		pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset;
+	} else {
+		if (!buf->pages)
+			return -EINTR;
+
+		pfn = page_to_pfn(buf->pages[0]) + page_offset;
+	}
 
 	return vm_insert_mixed(vma, f_vaddr, pfn);
 }