* [PATCH 0/3] Use dma_mmap_coherent to support IOMMU mapper
@ 2012-07-25 6:29 ` Hideki EIRAKU
0 siblings, 0 replies; 18+ messages in thread
From: Hideki EIRAKU @ 2012-07-25 6:29 UTC (permalink / raw)
To: Russell King, Pawel Osciak, Marek Szyprowski, Kyungmin Park,
Mauro Carvalho Chehab, Florian Tobias Schandinat
Cc: linux-arm-kernel, linux-kernel, linux-media, linux-fbdev,
Katsuya MATSUBARA, Hideki EIRAKU
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.
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
arch/arm/include/asm/dma-mapping.h | 1 +
drivers/media/video/videobuf2-dma-contig.c | 18 ++++++++++++++++++
drivers/video/sh_mobile_lcdcfb.c | 14 ++++++++++++++
3 files changed, 33 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/3] Use dma_mmap_coherent to support IOMMU mapper
@ 2012-07-25 6:29 ` Hideki EIRAKU
0 siblings, 0 replies; 18+ messages in thread
From: Hideki EIRAKU @ 2012-07-25 6:29 UTC (permalink / raw)
To: linux-arm-kernel
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.
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
arch/arm/include/asm/dma-mapping.h | 1 +
drivers/media/video/videobuf2-dma-contig.c | 18 ++++++++++++++++++
drivers/video/sh_mobile_lcdcfb.c | 14 ++++++++++++++
3 files changed, 33 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/3] Use dma_mmap_coherent to support IOMMU mapper
@ 2012-07-25 6:29 ` Hideki EIRAKU
0 siblings, 0 replies; 18+ messages in thread
From: Hideki EIRAKU @ 2012-07-25 6:29 UTC (permalink / raw)
To: linux-arm-kernel
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.
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
arch/arm/include/asm/dma-mapping.h | 1 +
drivers/media/video/videobuf2-dma-contig.c | 18 ++++++++++++++++++
drivers/video/sh_mobile_lcdcfb.c | 14 ++++++++++++++
3 files changed, 33 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/3] ARM: dma-mapping: define ARCH_HAS_DMA_MMAP_COHERENT
2012-07-25 6:29 ` Hideki EIRAKU
(?)
@ 2012-07-25 6:29 ` Hideki EIRAKU
-1 siblings, 0 replies; 18+ messages in thread
From: Hideki EIRAKU @ 2012-07-25 6:29 UTC (permalink / raw)
To: Russell King, Pawel Osciak, Marek Szyprowski, Kyungmin Park,
Mauro Carvalho Chehab, Florian Tobias Schandinat
Cc: linux-arm-kernel, linux-kernel, linux-media, linux-fbdev,
Katsuya MATSUBARA, Hideki EIRAKU
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 <hdk@igel.co.jp>
---
arch/arm/include/asm/dma-mapping.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index bbef15d..f41cd30 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -187,6 +187,7 @@ extern int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
struct dma_attrs *attrs);
#define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL)
+#define ARCH_HAS_DMA_MMAP_COHERENT
static inline int dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 1/3] ARM: dma-mapping: define ARCH_HAS_DMA_MMAP_COHERENT
@ 2012-07-25 6:29 ` Hideki EIRAKU
0 siblings, 0 replies; 18+ messages in thread
From: Hideki EIRAKU @ 2012-07-25 6:29 UTC (permalink / raw)
To: linux-arm-kernel
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 <hdk@igel.co.jp>
---
arch/arm/include/asm/dma-mapping.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index bbef15d..f41cd30 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -187,6 +187,7 @@ extern int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
struct dma_attrs *attrs);
#define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL)
+#define ARCH_HAS_DMA_MMAP_COHERENT
static inline int dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 1/3] ARM: dma-mapping: define ARCH_HAS_DMA_MMAP_COHERENT
@ 2012-07-25 6:29 ` Hideki EIRAKU
0 siblings, 0 replies; 18+ messages in thread
From: Hideki EIRAKU @ 2012-07-25 6:29 UTC (permalink / raw)
To: linux-arm-kernel
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 <hdk@igel.co.jp>
---
arch/arm/include/asm/dma-mapping.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index bbef15d..f41cd30 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -187,6 +187,7 @@ extern int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
struct dma_attrs *attrs);
#define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL)
+#define ARCH_HAS_DMA_MMAP_COHERENT
static inline int dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] media: videobuf2-dma-contig: use dma_mmap_coherent if available
2012-07-25 6:29 ` Hideki EIRAKU
(?)
@ 2012-07-25 6:29 ` Hideki EIRAKU
-1 siblings, 0 replies; 18+ messages in thread
From: Hideki EIRAKU @ 2012-07-25 6:29 UTC (permalink / raw)
To: Russell King, Pawel Osciak, Marek Szyprowski, Kyungmin Park,
Mauro Carvalho Chehab, Florian Tobias Schandinat
Cc: linux-arm-kernel, linux-kernel, linux-media, linux-fbdev,
Katsuya MATSUBARA, Hideki EIRAKU
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 <hdk@igel.co.jp>
---
drivers/media/video/videobuf2-dma-contig.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c
index 4b71326..4dc85ab 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -101,14 +101,32 @@ static unsigned int vb2_dma_contig_num_users(void *buf_priv)
static int vb2_dma_contig_mmap(void *buf_priv, struct vm_area_struct *vma)
{
struct vb2_dc_buf *buf = buf_priv;
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+ int ret;
+#endif
if (!buf) {
printk(KERN_ERR "No buffer to map\n");
return -EINVAL;
}
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+ ret = dma_mmap_coherent(buf->conf->dev, vma, buf->vaddr, buf->dma_addr,
+ buf->size);
+ if (ret) {
+ pr_err("Remapping memory failed, error: %d\n", ret);
+ return ret;
+ }
+ vma->vm_flags |= VM_DONTEXPAND | VM_RESERVED;
+ vma->vm_private_data = &buf->handler;
+ vma->vm_ops = &vb2_common_vm_ops;
+ vma->vm_ops->open(vma);
+ return 0;
+#else
return vb2_mmap_pfn_range(vma, buf->dma_addr, buf->size,
&vb2_common_vm_ops, &buf->handler);
+#endif
}
static void *vb2_dma_contig_get_userptr(void *alloc_ctx, unsigned long vaddr,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] media: videobuf2-dma-contig: use dma_mmap_coherent if available
@ 2012-07-25 6:29 ` Hideki EIRAKU
0 siblings, 0 replies; 18+ messages in thread
From: Hideki EIRAKU @ 2012-07-25 6:29 UTC (permalink / raw)
To: linux-arm-kernel
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 <hdk@igel.co.jp>
---
drivers/media/video/videobuf2-dma-contig.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c
index 4b71326..4dc85ab 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -101,14 +101,32 @@ static unsigned int vb2_dma_contig_num_users(void *buf_priv)
static int vb2_dma_contig_mmap(void *buf_priv, struct vm_area_struct *vma)
{
struct vb2_dc_buf *buf = buf_priv;
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+ int ret;
+#endif
if (!buf) {
printk(KERN_ERR "No buffer to map\n");
return -EINVAL;
}
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+ ret = dma_mmap_coherent(buf->conf->dev, vma, buf->vaddr, buf->dma_addr,
+ buf->size);
+ if (ret) {
+ pr_err("Remapping memory failed, error: %d\n", ret);
+ return ret;
+ }
+ vma->vm_flags |= VM_DONTEXPAND | VM_RESERVED;
+ vma->vm_private_data = &buf->handler;
+ vma->vm_ops = &vb2_common_vm_ops;
+ vma->vm_ops->open(vma);
+ return 0;
+#else
return vb2_mmap_pfn_range(vma, buf->dma_addr, buf->size,
&vb2_common_vm_ops, &buf->handler);
+#endif
}
static void *vb2_dma_contig_get_userptr(void *alloc_ctx, unsigned long vaddr,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/3] media: videobuf2-dma-contig: use dma_mmap_coherent if available
@ 2012-07-25 6:29 ` Hideki EIRAKU
0 siblings, 0 replies; 18+ messages in thread
From: Hideki EIRAKU @ 2012-07-25 6:29 UTC (permalink / raw)
To: linux-arm-kernel
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 <hdk@igel.co.jp>
---
drivers/media/video/videobuf2-dma-contig.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c
index 4b71326..4dc85ab 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -101,14 +101,32 @@ static unsigned int vb2_dma_contig_num_users(void *buf_priv)
static int vb2_dma_contig_mmap(void *buf_priv, struct vm_area_struct *vma)
{
struct vb2_dc_buf *buf = buf_priv;
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+ int ret;
+#endif
if (!buf) {
printk(KERN_ERR "No buffer to map\n");
return -EINVAL;
}
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+ ret = dma_mmap_coherent(buf->conf->dev, vma, buf->vaddr, buf->dma_addr,
+ buf->size);
+ if (ret) {
+ pr_err("Remapping memory failed, error: %d\n", ret);
+ return ret;
+ }
+ vma->vm_flags |= VM_DONTEXPAND | VM_RESERVED;
+ vma->vm_private_data = &buf->handler;
+ vma->vm_ops = &vb2_common_vm_ops;
+ vma->vm_ops->open(vma);
+ return 0;
+#else
return vb2_mmap_pfn_range(vma, buf->dma_addr, buf->size,
&vb2_common_vm_ops, &buf->handler);
+#endif
}
static void *vb2_dma_contig_get_userptr(void *alloc_ctx, unsigned long vaddr,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] fbdev: sh_mobile_lcdc: use dma_mmap_coherent if available
2012-07-25 6:29 ` Hideki EIRAKU
(?)
@ 2012-07-25 6:29 ` Hideki EIRAKU
-1 siblings, 0 replies; 18+ messages in thread
From: Hideki EIRAKU @ 2012-07-25 6:29 UTC (permalink / raw)
To: Russell King, Pawel Osciak, Marek Szyprowski, Kyungmin Park,
Mauro Carvalho Chehab, Florian Tobias Schandinat
Cc: linux-arm-kernel, linux-kernel, linux-media, linux-fbdev,
Katsuya MATSUBARA, Hideki EIRAKU
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 <hdk@igel.co.jp>
---
drivers/video/sh_mobile_lcdcfb.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index e672698..65732c4 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -1393,6 +1393,17 @@ static int sh_mobile_lcdc_blank(int blank, struct fb_info *info)
return 0;
}
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+static int
+sh_mobile_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
+{
+ struct sh_mobile_lcdc_chan *ch = info->par;
+
+ return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem,
+ ch->dma_handle, ch->fb_size);
+}
+#endif
+
static struct fb_ops sh_mobile_lcdc_ops = {
.owner = THIS_MODULE,
.fb_setcolreg = sh_mobile_lcdc_setcolreg,
@@ -1408,6 +1419,9 @@ static struct fb_ops sh_mobile_lcdc_ops = {
.fb_release = sh_mobile_release,
.fb_check_var = sh_mobile_check_var,
.fb_set_par = sh_mobile_set_par,
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+ .fb_mmap = sh_mobile_fb_mmap,
+#endif
};
static void
--
1.7.0.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] fbdev: sh_mobile_lcdc: use dma_mmap_coherent if available
@ 2012-07-25 6:29 ` Hideki EIRAKU
0 siblings, 0 replies; 18+ messages in thread
From: Hideki EIRAKU @ 2012-07-25 6:29 UTC (permalink / raw)
To: linux-arm-kernel
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 <hdk@igel.co.jp>
---
drivers/video/sh_mobile_lcdcfb.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index e672698..65732c4 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -1393,6 +1393,17 @@ static int sh_mobile_lcdc_blank(int blank, struct fb_info *info)
return 0;
}
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+static int
+sh_mobile_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
+{
+ struct sh_mobile_lcdc_chan *ch = info->par;
+
+ return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem,
+ ch->dma_handle, ch->fb_size);
+}
+#endif
+
static struct fb_ops sh_mobile_lcdc_ops = {
.owner = THIS_MODULE,
.fb_setcolreg = sh_mobile_lcdc_setcolreg,
@@ -1408,6 +1419,9 @@ static struct fb_ops sh_mobile_lcdc_ops = {
.fb_release = sh_mobile_release,
.fb_check_var = sh_mobile_check_var,
.fb_set_par = sh_mobile_set_par,
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+ .fb_mmap = sh_mobile_fb_mmap,
+#endif
};
static void
--
1.7.0.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/3] fbdev: sh_mobile_lcdc: use dma_mmap_coherent if available
@ 2012-07-25 6:29 ` Hideki EIRAKU
0 siblings, 0 replies; 18+ messages in thread
From: Hideki EIRAKU @ 2012-07-25 6:29 UTC (permalink / raw)
To: linux-arm-kernel
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 <hdk@igel.co.jp>
---
drivers/video/sh_mobile_lcdcfb.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index e672698..65732c4 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -1393,6 +1393,17 @@ static int sh_mobile_lcdc_blank(int blank, struct fb_info *info)
return 0;
}
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+static int
+sh_mobile_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
+{
+ struct sh_mobile_lcdc_chan *ch = info->par;
+
+ return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem,
+ ch->dma_handle, ch->fb_size);
+}
+#endif
+
static struct fb_ops sh_mobile_lcdc_ops = {
.owner = THIS_MODULE,
.fb_setcolreg = sh_mobile_lcdc_setcolreg,
@@ -1408,6 +1419,9 @@ static struct fb_ops sh_mobile_lcdc_ops = {
.fb_release = sh_mobile_release,
.fb_check_var = sh_mobile_check_var,
.fb_set_par = sh_mobile_set_par,
+#ifdef ARCH_HAS_DMA_MMAP_COHERENT
+ .fb_mmap = sh_mobile_fb_mmap,
+#endif
};
static void
--
1.7.0.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] fbdev: sh_mobile_lcdc: use dma_mmap_coherent if available
2012-07-25 6:29 ` Hideki EIRAKU
(?)
@ 2012-07-25 11:10 ` Laurent Pinchart
-1 siblings, 0 replies; 18+ messages in thread
From: Laurent Pinchart @ 2012-07-25 11:10 UTC (permalink / raw)
To: Hideki EIRAKU
Cc: Russell King, Pawel Osciak, Marek Szyprowski, Kyungmin Park,
Mauro Carvalho Chehab, Florian Tobias Schandinat,
linux-arm-kernel, linux-kernel, linux-media, linux-fbdev,
Katsuya MATSUBARA
Hi Eiraku-san,
Thank you for the patch.
On Wednesday 25 July 2012 15:29: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.
This looks good to me, but will need to be rebased on top of the
sh_mobile_lcdc patches currently queued for v3.6. You can find them in the
fbdev-next branch of git://github.com/schandinat/linux-2.6.git.
In particular, these patches add support for overlays exported through
additional fbdev devices. You will need to initialize .fb_mmap in both
sh_mobile_lcdc_overlay_ops and sh_mobile_lcdc_ops.
> Signed-off-by: Hideki EIRAKU <hdk@igel.co.jp>
> ---
> drivers/video/sh_mobile_lcdcfb.c | 14 ++++++++++++++
> 1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/video/sh_mobile_lcdcfb.c
> b/drivers/video/sh_mobile_lcdcfb.c index e672698..65732c4 100644
> --- a/drivers/video/sh_mobile_lcdcfb.c
> +++ b/drivers/video/sh_mobile_lcdcfb.c
> @@ -1393,6 +1393,17 @@ static int sh_mobile_lcdc_blank(int blank, struct
> fb_info *info) return 0;
> }
>
> +#ifdef ARCH_HAS_DMA_MMAP_COHERENT
> +static int
> +sh_mobile_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
> +{
> + struct sh_mobile_lcdc_chan *ch = info->par;
> +
> + return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem,
> + ch->dma_handle, ch->fb_size);
> +}
> +#endif
> +
> static struct fb_ops sh_mobile_lcdc_ops = {
> .owner = THIS_MODULE,
> .fb_setcolreg = sh_mobile_lcdc_setcolreg,
> @@ -1408,6 +1419,9 @@ static struct fb_ops sh_mobile_lcdc_ops = {
> .fb_release = sh_mobile_release,
> .fb_check_var = sh_mobile_check_var,
> .fb_set_par = sh_mobile_set_par,
> +#ifdef ARCH_HAS_DMA_MMAP_COHERENT
> + .fb_mmap = sh_mobile_fb_mmap,
> +#endif
> };
>
> static void
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/3] fbdev: sh_mobile_lcdc: use dma_mmap_coherent if available
@ 2012-07-25 11:10 ` Laurent Pinchart
0 siblings, 0 replies; 18+ messages in thread
From: Laurent Pinchart @ 2012-07-25 11:10 UTC (permalink / raw)
To: linux-arm-kernel
Hi Eiraku-san,
Thank you for the patch.
On Wednesday 25 July 2012 15:29: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.
This looks good to me, but will need to be rebased on top of the
sh_mobile_lcdc patches currently queued for v3.6. You can find them in the
fbdev-next branch of git://github.com/schandinat/linux-2.6.git.
In particular, these patches add support for overlays exported through
additional fbdev devices. You will need to initialize .fb_mmap in both
sh_mobile_lcdc_overlay_ops and sh_mobile_lcdc_ops.
> Signed-off-by: Hideki EIRAKU <hdk@igel.co.jp>
> ---
> drivers/video/sh_mobile_lcdcfb.c | 14 ++++++++++++++
> 1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/video/sh_mobile_lcdcfb.c
> b/drivers/video/sh_mobile_lcdcfb.c index e672698..65732c4 100644
> --- a/drivers/video/sh_mobile_lcdcfb.c
> +++ b/drivers/video/sh_mobile_lcdcfb.c
> @@ -1393,6 +1393,17 @@ static int sh_mobile_lcdc_blank(int blank, struct
> fb_info *info) return 0;
> }
>
> +#ifdef ARCH_HAS_DMA_MMAP_COHERENT
> +static int
> +sh_mobile_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
> +{
> + struct sh_mobile_lcdc_chan *ch = info->par;
> +
> + return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem,
> + ch->dma_handle, ch->fb_size);
> +}
> +#endif
> +
> static struct fb_ops sh_mobile_lcdc_ops = {
> .owner = THIS_MODULE,
> .fb_setcolreg = sh_mobile_lcdc_setcolreg,
> @@ -1408,6 +1419,9 @@ static struct fb_ops sh_mobile_lcdc_ops = {
> .fb_release = sh_mobile_release,
> .fb_check_var = sh_mobile_check_var,
> .fb_set_par = sh_mobile_set_par,
> +#ifdef ARCH_HAS_DMA_MMAP_COHERENT
> + .fb_mmap = sh_mobile_fb_mmap,
> +#endif
> };
>
> static void
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 3/3] fbdev: sh_mobile_lcdc: use dma_mmap_coherent if available
@ 2012-07-25 11:10 ` Laurent Pinchart
0 siblings, 0 replies; 18+ messages in thread
From: Laurent Pinchart @ 2012-07-25 11:10 UTC (permalink / raw)
To: linux-arm-kernel
Hi Eiraku-san,
Thank you for the patch.
On Wednesday 25 July 2012 15:29: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.
This looks good to me, but will need to be rebased on top of the
sh_mobile_lcdc patches currently queued for v3.6. You can find them in the
fbdev-next branch of git://github.com/schandinat/linux-2.6.git.
In particular, these patches add support for overlays exported through
additional fbdev devices. You will need to initialize .fb_mmap in both
sh_mobile_lcdc_overlay_ops and sh_mobile_lcdc_ops.
> Signed-off-by: Hideki EIRAKU <hdk@igel.co.jp>
> ---
> drivers/video/sh_mobile_lcdcfb.c | 14 ++++++++++++++
> 1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/video/sh_mobile_lcdcfb.c
> b/drivers/video/sh_mobile_lcdcfb.c index e672698..65732c4 100644
> --- a/drivers/video/sh_mobile_lcdcfb.c
> +++ b/drivers/video/sh_mobile_lcdcfb.c
> @@ -1393,6 +1393,17 @@ static int sh_mobile_lcdc_blank(int blank, struct
> fb_info *info) return 0;
> }
>
> +#ifdef ARCH_HAS_DMA_MMAP_COHERENT
> +static int
> +sh_mobile_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
> +{
> + struct sh_mobile_lcdc_chan *ch = info->par;
> +
> + return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem,
> + ch->dma_handle, ch->fb_size);
> +}
> +#endif
> +
> static struct fb_ops sh_mobile_lcdc_ops = {
> .owner = THIS_MODULE,
> .fb_setcolreg = sh_mobile_lcdc_setcolreg,
> @@ -1408,6 +1419,9 @@ static struct fb_ops sh_mobile_lcdc_ops = {
> .fb_release = sh_mobile_release,
> .fb_check_var = sh_mobile_check_var,
> .fb_set_par = sh_mobile_set_par,
> +#ifdef ARCH_HAS_DMA_MMAP_COHERENT
> + .fb_mmap = sh_mobile_fb_mmap,
> +#endif
> };
>
> static void
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH] ALSA: pcm - Don't define ARCH_HAS_DMA_MMAP_COHERENT privately for ARM
2012-07-25 6:29 ` Hideki EIRAKU
(?)
@ 2012-07-25 16:01 ` Laurent Pinchart
-1 siblings, 0 replies; 18+ messages in thread
From: Laurent Pinchart @ 2012-07-25 16:01 UTC (permalink / raw)
To: Hideki EIRAKU
Cc: Russell King, Pawel Osciak, Marek Szyprowski, Kyungmin Park,
Mauro Carvalho Chehab, Florian Tobias Schandinat,
linux-arm-kernel, linux-kernel, linux-media, linux-fbdev,
Katsuya MATSUBARA, Jaroslav Kysela, Takashi Iwai
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(-)
Hi Eiraku-san,
Could you please add this cleanup patch to your "Use dma_mmap_coherent to
support IOMMU mapper" series ?
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 53b5ada..84ead60 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3156,13 +3156,6 @@ static const struct vm_operations_struct snd_pcm_vm_ops_data_fault = {
.fault = snd_pcm_mmap_data_fault,
};
-#ifndef ARCH_HAS_DMA_MMAP_COHERENT
-/* This should be defined / handled globally! */
-#ifdef CONFIG_ARM
-#define ARCH_HAS_DMA_MMAP_COHERENT
-#endif
-#endif
-
/*
* mmap the DMA buffer on RAM
*/
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH] ALSA: pcm - Don't define ARCH_HAS_DMA_MMAP_COHERENT privately for ARM
@ 2012-07-25 16:01 ` Laurent Pinchart
0 siblings, 0 replies; 18+ messages in thread
From: Laurent Pinchart @ 2012-07-25 16:01 UTC (permalink / raw)
To: linux-arm-kernel
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(-)
Hi Eiraku-san,
Could you please add this cleanup patch to your "Use dma_mmap_coherent to
support IOMMU mapper" series ?
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 53b5ada..84ead60 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3156,13 +3156,6 @@ static const struct vm_operations_struct snd_pcm_vm_ops_data_fault = {
.fault = snd_pcm_mmap_data_fault,
};
-#ifndef ARCH_HAS_DMA_MMAP_COHERENT
-/* This should be defined / handled globally! */
-#ifdef CONFIG_ARM
-#define ARCH_HAS_DMA_MMAP_COHERENT
-#endif
-#endif
-
/*
* mmap the DMA buffer on RAM
*/
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH] ALSA: pcm - Don't define ARCH_HAS_DMA_MMAP_COHERENT privately for ARM
@ 2012-07-25 16:01 ` Laurent Pinchart
0 siblings, 0 replies; 18+ messages in thread
From: Laurent Pinchart @ 2012-07-25 16:01 UTC (permalink / raw)
To: linux-arm-kernel
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(-)
Hi Eiraku-san,
Could you please add this cleanup patch to your "Use dma_mmap_coherent to
support IOMMU mapper" series ?
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 53b5ada..84ead60 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3156,13 +3156,6 @@ static const struct vm_operations_struct snd_pcm_vm_ops_data_fault = {
.fault = snd_pcm_mmap_data_fault,
};
-#ifndef ARCH_HAS_DMA_MMAP_COHERENT
-/* This should be defined / handled globally! */
-#ifdef CONFIG_ARM
-#define ARCH_HAS_DMA_MMAP_COHERENT
-#endif
-#endif
-
/*
* mmap the DMA buffer on RAM
*/
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 18+ messages in thread
end of thread, other threads:[~2012-07-25 16:01 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-25 6:29 [PATCH 0/3] Use dma_mmap_coherent to support IOMMU mapper Hideki EIRAKU
2012-07-25 6:29 ` Hideki EIRAKU
2012-07-25 6:29 ` Hideki EIRAKU
2012-07-25 6:29 ` [PATCH 1/3] ARM: dma-mapping: define ARCH_HAS_DMA_MMAP_COHERENT Hideki EIRAKU
2012-07-25 6:29 ` Hideki EIRAKU
2012-07-25 6:29 ` Hideki EIRAKU
2012-07-25 6:29 ` [PATCH 2/3] media: videobuf2-dma-contig: use dma_mmap_coherent if available Hideki EIRAKU
2012-07-25 6:29 ` Hideki EIRAKU
2012-07-25 6:29 ` Hideki EIRAKU
2012-07-25 6:29 ` [PATCH 3/3] fbdev: sh_mobile_lcdc: " Hideki EIRAKU
2012-07-25 6:29 ` Hideki EIRAKU
2012-07-25 6:29 ` Hideki EIRAKU
2012-07-25 11:10 ` Laurent Pinchart
2012-07-25 11:10 ` Laurent Pinchart
2012-07-25 11:10 ` Laurent Pinchart
2012-07-25 16:01 ` [PATCH] ALSA: pcm - Don't define ARCH_HAS_DMA_MMAP_COHERENT privately for ARM Laurent Pinchart
2012-07-25 16:01 ` Laurent Pinchart
2012-07-25 16:01 ` Laurent Pinchart
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.