There is a dma_mmap_coherent() API in some architectures. This API
provides a mmap function for memory allocated by dma_alloc_coherent().
Some drivers mmap a dma_addr_t returned by dma_alloc_coherent() as a
physical address. But such drivers do not work correctly when IOMMU
mapper is used.
v3:
- Remove an unnecessary line which sets page protection bits.
v2:
- Rebase on fbdev-next branch of
git://github.com/schandinat/linux-2.6.git.
- Initialize .fb_mmap in both sh_mobile_lcdc_overlay_ops and
sh_mobile_lcdc_ops.
- Add Laurent's clean up patch.
Hideki EIRAKU (3):
ARM: dma-mapping: define ARCH_HAS_DMA_MMAP_COHERENT
media: videobuf2-dma-contig: use dma_mmap_coherent if available
fbdev: sh_mobile_lcdc: use dma_mmap_coherent if available
Laurent Pinchart (1):
ALSA: pcm - Don't define ARCH_HAS_DMA_MMAP_COHERENT privately for ARM
arch/arm/include/asm/dma-mapping.h | 1 +
drivers/media/video/videobuf2-dma-contig.c | 17 +++++++++++++++++
drivers/video/sh_mobile_lcdcfb.c | 28 ++++++++++++++++++++++++++++
sound/core/pcm_native.c | 7 -------
4 files changed, 46 insertions(+), 7 deletions(-)
ARCH_HAS_DMA_MMAP_COHERENT indicates that there is dma_mmap_coherent() API
in this architecture. The name is already defined in PowerPC.
Signed-off-by: Hideki EIRAKU <redacted>
---
arch/arm/include/asm/dma-mapping.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
The ARM architecture now defines ARCH_HAS_DMA_MMAP_COHERENT, there's no
need to define it privately anymore.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
sound/core/pcm_native.c | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)
Previously the vb2_dma_contig_mmap() function was using a dma_addr_t as a
physical address. The two addressses are not necessarily the same.
For example, when using the IOMMU funtion on certain platforms, dma_addr_t
addresses are not directly mappable physical address.
dma_mmap_coherent() maps the address correctly.
It is available on ARM platforms.
Signed-off-by: Hideki EIRAKU <redacted>
---
drivers/media/video/videobuf2-dma-contig.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
fb_mmap() implemented in fbmem.c uses smem_start as the physical
address of the frame buffer. In the sh_mobile_lcdc driver, the
smem_start is a dma_addr_t that is not a physical address when IOMMU is
enabled. dma_mmap_coherent() maps the address correctly. It is
available on ARM platforms.
Signed-off-by: Hideki EIRAKU <redacted>
---
drivers/video/sh_mobile_lcdcfb.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
Hi Eiraku-san,
On Monday 06 August 2012 18:55:24 Hideki EIRAKU wrote:
fb_mmap() implemented in fbmem.c uses smem_start as the physical
address of the frame buffer. In the sh_mobile_lcdc driver, the
smem_start is a dma_addr_t that is not a physical address when IOMMU is
enabled. dma_mmap_coherent() maps the address correctly. It is
available on ARM platforms.
Signed-off-by: Hideki EIRAKU <redacted>
Acked-by: Hideki EIRAKU <redacted>
As this patch doesn't depend on any other patch in your series
(ARCH_HAS_DMA_MMAP_COHERENT will not be defined without 1/4, so this patch
will be a no-op until then), I've applied it to my tree and will push it to
avoid merge conflicts, unless you would prefer to push it yourself.
On Tuesday 07 August 2012 14:01:43 Laurent Pinchart wrote:
Hi Eiraku-san,
On Monday 06 August 2012 18:55:24 Hideki EIRAKU wrote:
quoted
fb_mmap() implemented in fbmem.c uses smem_start as the physical
address of the frame buffer. In the sh_mobile_lcdc driver, the
smem_start is a dma_addr_t that is not a physical address when IOMMU is
enabled. dma_mmap_coherent() maps the address correctly. It is
available on ARM platforms.
Signed-off-by: Hideki EIRAKU <redacted>
Acked-by: Hideki EIRAKU <redacted>
I obviously meant
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
As this patch doesn't depend on any other patch in your series
(ARCH_HAS_DMA_MMAP_COHERENT will not be defined without 1/4, so this patch
will be a no-op until then), I've applied it to my tree and will push it to
avoid merge conflicts, unless you would prefer to push it yourself.
From: Marek Szyprowski <m.szyprowski@samsung.com> Date: 2012-08-07 14:53:49
Hello,
On Monday, August 06, 2012 11:55 AM Hideki EIRAKU wrote:
Previously the vb2_dma_contig_mmap() function was using a dma_addr_t as a
physical address. The two addressses are not necessarily the same.
For example, when using the IOMMU funtion on certain platforms, dma_addr_t
addresses are not directly mappable physical address.
dma_mmap_coherent() maps the address correctly.
It is available on ARM platforms.
Signed-off-by: Hideki EIRAKU <redacted>
I'm sorry for bringing this issue now, once you have already created v3 of your
patches, but similar patch has been already proposed some time ago. It is already
processed together with general videobuf2-dma-contig redesign and dma-buf extensions
by Tomasz Stanislawski.
See post http://thread.gmane.org/gmane.comp.video.dri.devel/70402/focusI461 and
http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/49438
It doesn't use conditional code inside videobuf2 allocator and rely entirely on
dma-mapping subsystem to provide a working dma_mmap_coherent/writecombine/attrs()
function. When it was posted, it relied on the dma-mapping extensions, which now
have been finally merged to v3.6-rc1. Now I wonder if there are any architectures,
which don't use dma_map_ops based dma-mapping framework, which might use
videobuf2-dma-conting module.
Best regards
--
Marek Szyprowski
Samsung Poland R&D Center
From: Marek Szyprowski <m.szyprowski@samsung.com> Date: 2012-08-07 15:22:21
Hi Hideki,
On Monday, August 06, 2012 11:55 AM Hideki EIRAKU wrote:
quoted hunk
ARCH_HAS_DMA_MMAP_COHERENT indicates that there is dma_mmap_coherent() API
in this architecture. The name is already defined in PowerPC.
Signed-off-by: Hideki EIRAKU <redacted>
---
arch/arm/include/asm/dma-mapping.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Hello,
From: Marek Szyprowski <m.szyprowski@samsung.com>
Subject: RE: [PATCH v3 3/4] media: videobuf2-dma-contig: use dma_mmap_coherent if available
Date: Tue, 07 Aug 2012 16:53:25 +0200
I'm sorry for bringing this issue now, once you have already created v3 of your
patches, but similar patch has been already proposed some time ago. It is already
processed together with general videobuf2-dma-contig redesign and dma-buf extensions
by Tomasz Stanislawski.
See post http://thread.gmane.org/gmane.comp.video.dri.devel/70402/focusI461 and
http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/49438
It doesn't use conditional code inside videobuf2 allocator and rely entirely on
dma-mapping subsystem to provide a working dma_mmap_coherent/writecombine/attrs()
function. When it was posted, it relied on the dma-mapping extensions, which now
have been finally merged to v3.6-rc1. Now I wonder if there are any architectures,
which don't use dma_map_ops based dma-mapping framework, which might use
videobuf2-dma-conting module.
Thank you for telling me about videobuf2-dma-contig and v3.6-rc1. The
videobuf2-dma-contig patch I sent is now unnecessary. So I will
remove the patch. I will remove the patch defining
ARCH_HAS_DMA_MMAP_COHERENT too because the v3.6-rc1 kernel has generic
dma_mmap_coherent() API for every architecture.
I will also remove the Laurent's patch I sent because it was related
to ARCH_HAS_DMA_MMAP_COHERENT.
The remaining patch is sh_mobile_lcdc. I will remove ifdefs from the
patch and re-post it as a patch v4.
--
Hideki EIRAKU [off-list ref]
From: Marek Szyprowski <m.szyprowski@samsung.com> Date: 2012-08-16 10:40:19
Hello,
On Thursday, August 16, 2012 12:14 PM Hideki EIRAKU wrote:
From: Marek Szyprowski <m.szyprowski@samsung.com>
Subject: RE: [PATCH v3 3/4] media: videobuf2-dma-contig: use dma_mmap_coherent if available
Date: Tue, 07 Aug 2012 16:53:25 +0200
quoted
I'm sorry for bringing this issue now, once you have already created v3 of your
patches, but similar patch has been already proposed some time ago. It is already
processed together with general videobuf2-dma-contig redesign and dma-buf extensions
by Tomasz Stanislawski.
See post http://thread.gmane.org/gmane.comp.video.dri.devel/70402/focusI461 and
http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/49438
It doesn't use conditional code inside videobuf2 allocator and rely entirely on
dma-mapping subsystem to provide a working dma_mmap_coherent/writecombine/attrs()
function. When it was posted, it relied on the dma-mapping extensions, which now
have been finally merged to v3.6-rc1. Now I wonder if there are any architectures,
which don't use dma_map_ops based dma-mapping framework, which might use
videobuf2-dma-conting module.
Thank you for telling me about videobuf2-dma-contig and v3.6-rc1. The
videobuf2-dma-contig patch I sent is now unnecessary. So I will
remove the patch. I will remove the patch defining
ARCH_HAS_DMA_MMAP_COHERENT too because the v3.6-rc1 kernel has generic
dma_mmap_coherent() API for every architecture.