summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJay Monkman <jay.monkman@freescale.com>2013-06-14 11:47:50 -0500
committerJay Monkman <jay.monkman@freescale.com>2013-06-14 11:47:50 -0500
commitf4857b5482c67dcc9757d50cf57cb32728af788b (patch)
tree9b2d7c7c382ee1cdc3160d662a94b7b3deaa67f7 /drivers
parentdf551ae02c600f8bc9244441700f7da7ac62ac88 (diff)
ENGR00267024 mx6q: Stop DMA memory fragmentation
Applied patch from customer to prevent DMA memory fragmentation. Customer reported system crashes due to running out of DMA-able memory while playing videos. Reported in CT42391649. Signed-off-by: Jay Monkman <jay.monkman@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/mxc/output/mxc_vout.c10
-rw-r--r--drivers/media/video/videobuf-dma-contig.c3
-rw-r--r--drivers/mxc/vpu/mxc_vpu.c2
3 files changed, 10 insertions, 5 deletions
diff --git a/drivers/media/video/mxc/output/mxc_vout.c b/drivers/media/video/mxc/output/mxc_vout.c
index 4ea663005812..e0840bf7a1c2 100644
--- a/drivers/media/video/mxc/output/mxc_vout.c
+++ b/drivers/media/video/mxc/output/mxc_vout.c
@@ -2077,9 +2077,13 @@ static int mxc_vout_probe(struct platform_device *pdev)
return -ENOMEM;
dev->dev = &pdev->dev;
- dev->dev->dma_mask = kmalloc(sizeof(*dev->dev->dma_mask), GFP_KERNEL);
- *dev->dev->dma_mask = DMA_BIT_MASK(32);
- dev->dev->coherent_dma_mask = DMA_BIT_MASK(32);
+ if (!dev->dev->dma_mask) {
+ dev->dev->dma_mask = kmalloc(sizeof(*dev->dev->dma_mask),
+ GFP_KERNEL);
+ if (dev->dev->dma_mask)
+ *dev->dev->dma_mask = DMA_BIT_MASK(32);
+ dev->dev->coherent_dma_mask = DMA_BIT_MASK(32);
+ }
ret = v4l2_device_register(dev->dev, &dev->v4l2_dev);
if (ret) {
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c
index af7ff78c9259..2a5623c5a213 100644
--- a/drivers/media/video/videobuf-dma-contig.c
+++ b/drivers/media/video/videobuf-dma-contig.c
@@ -284,7 +284,8 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
mem->size = PAGE_ALIGN(buf->bsize);
mem->vaddr = dma_alloc_coherent(q->dev, mem->size,
- &mem->dma_handle, GFP_DMA);
+ &mem->dma_handle,
+ GFP_DMA | GFP_KERNEL | __GFP_NOFAIL);
if (!mem->vaddr) {
dev_err(q->dev, "dma_alloc_coherent size %ld failed\n",
mem->size);
diff --git a/drivers/mxc/vpu/mxc_vpu.c b/drivers/mxc/vpu/mxc_vpu.c
index 708e8e97112a..07f6d9d1d6d8 100644
--- a/drivers/mxc/vpu/mxc_vpu.c
+++ b/drivers/mxc/vpu/mxc_vpu.c
@@ -126,7 +126,7 @@ static int vpu_alloc_dma_buffer(struct vpu_mem_desc *mem)
mem->cpu_addr = (unsigned long)
dma_alloc_coherent(NULL, PAGE_ALIGN(mem->size),
(dma_addr_t *) (&mem->phy_addr),
- GFP_DMA | GFP_KERNEL);
+ GFP_DMA | GFP_KERNEL | __GFP_NOFAIL);
pr_debug("[ALLOC] mem alloc cpu_addr = 0x%x\n", mem->cpu_addr);
if ((void *)(mem->cpu_addr) == NULL) {
printk(KERN_ERR "Physical memory allocation error!\n");