Message ID | 1340360046-23429-1-git-send-email-prabhakar.lad@ti.com (mailing list archive) |
---|---|
State | Awaiting Upstream |
Headers | show |
> from commit a8f3c203e19b702fa5e8e83a9b6fb3c5a6d1cce4 > restore the mapping scheme for uncached buffers, > which was changed in a common scheme for cached and uncached. > This apparently was wrong, and was probably intended only for cached > buffers. the fix fixes the crash observed while mapping uncached > buffers. > > Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com> > Signed-off-by: Hadli, Manjunath <manjunath.hadli@ti.com> Acked-by: Federico Vaga <federico.vaga@gmail.com> I tested the patch on the STA2X11 board.
Hi Hans, On Mon, Jun 25, 2012 at 17:13:39, Hans Verkuil wrote: > On Sat 23 June 2012 11:19:24 Hans Verkuil wrote: > > On Fri June 22 2012 18:53:27 Federico Vaga wrote: > > > In data venerdì 22 giugno 2012 18:45:31, Hans Verkuil ha scritto: > > > > On Fri June 22 2012 17:28:04 Federico Vaga wrote: > > > > > > from commit a8f3c203e19b702fa5e8e83a9b6fb3c5a6d1cce4 > > > > > > restore the mapping scheme for uncached buffers, > > > > > > which was changed in a common scheme for cached and uncached. > > > > > > This apparently was wrong, and was probably intended only for > > > > > > cached > > > > > > buffers. the fix fixes the crash observed while mapping uncached > > > > > > buffers. > > > > > > > > > > > > Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com> > > > > > > Signed-off-by: Hadli, Manjunath <manjunath.hadli@ti.com> > > > > > > > > > > Acked-by: Federico Vaga <federico.vaga@gmail.com> > > > > > > > > > > I tested the patch on the STA2X11 board. > > > > > > > > Was this patch ever posted on linux-media? I didn't see it on the > > > > mailinglist, nor in my personal inbox. > > > > > > > > Perhaps something went wrong? > > > > > > I recived the email as CC and linux-media was the main destination. > > > Davinci list was also added as CC and you can find the patch there: > > > > > > http://www.mail-archive.com/davinci-linux-open- > > > source@linux.davincidsp.com/msg22998.html > > > > > > Something went wrong. > > > > Weird, it never ended up at the linux-media mailinglist (not just me, it's > > not in the linux-media archives either). > > > > Anyway, I'll test this on Monday and if it works fine for me as well I'll Ack it. > > I've tested this patch, and it looks good: > > Acked-by: Hans Verkuil <hans.verkuil@cisco.com> > > Prabhakar: Please post this again with all acks and marked as [PATCH for v3.5] to the > linux-media mailinglist asap. This patch never made it to this list for some reason, > so make sure it gets there this time. > Ok. Thanks for the review. Thx, --Prabhakar Lad > Regards, > > Hans > > > > > Regards, > > > > Hans > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-media" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > >
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c index b6b5cc1..358f4c0 100644 --- a/drivers/media/video/videobuf-dma-contig.c +++ b/drivers/media/video/videobuf-dma-contig.c @@ -359,32 +359,43 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, size = vma->vm_end - vma->vm_start; size = (size < mem->size) ? size : mem->size; - if (!mem->cached) + if (!mem->cached) { vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - - pos = (unsigned long)mem->vaddr; - - while (size > 0) { - page = virt_to_page((void *)pos); - if (NULL == page) { - dev_err(q->dev, "mmap: virt_to_page failed\n"); - __videobuf_dc_free(q->dev, mem); - goto error; - } - retval = vm_insert_page(vma, start, page); + retval = remap_pfn_range(vma, vma->vm_start, + mem->dma_handle >> PAGE_SHIFT, + size, vma->vm_page_prot); if (retval) { - dev_err(q->dev, "mmap: insert failed with error %d\n", - retval); - __videobuf_dc_free(q->dev, mem); + dev_err(q->dev, "mmap: remap failed with error %d. ", + retval); + dma_free_coherent(q->dev, mem->size, + mem->vaddr, mem->dma_handle); goto error; } - start += PAGE_SIZE; - pos += PAGE_SIZE; + } else { + pos = (unsigned long)mem->vaddr; + + while (size > 0) { + page = virt_to_page((void *)pos); + if (NULL == page) { + dev_err(q->dev, "mmap: virt_to_page failed\n"); + __videobuf_dc_free(q->dev, mem); + goto error; + } + retval = vm_insert_page(vma, start, page); + if (retval) { + dev_err(q->dev, "mmap: insert failed with error %d\n", + retval); + __videobuf_dc_free(q->dev, mem); + goto error; + } + start += PAGE_SIZE; + pos += PAGE_SIZE; - if (size > PAGE_SIZE) - size -= PAGE_SIZE; - else - size = 0; + if (size > PAGE_SIZE) + size -= PAGE_SIZE; + else + size = 0; + } } vma->vm_ops = &videobuf_vm_ops;