lkml.org 
[lkml]   [2011]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Hit BUG_ON in dma-mapping.c:425 (RFC)
On Thu, Mar 24, 2011 at 04:18:13PM +0800, Nicolas Ferre wrote:
> diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
> --- a/drivers/spi/atmel_spi.c
> +++ b/drivers/spi/atmel_spi.c
> @@ -647,6 +647,22 @@ static void atmel_spi_next_message(struct spi_master *master)
> atmel_spi_next_xfer(master, msg);
> }
>
> +static void *adjust_buffer_location(struct device *dev, void *buf)
> +{
> + if (likely(buf < high_memory)) {
> + return buf;
> + } else {
> + struct page *pg;
> +
> + pg = vmalloc_to_page(buf);
> + if (pg == 0) {
> + dev_err(dev, "failed to vmalloc_to_page\n");
> + return NULL;
> + }
> + return page_address(pg) + ((size_t)buf & ~PAGE_MASK);
> + }
> +}
> +

This really doesn't fix the problem. If the page is read or written via
the vmalloc mapping, you'll have stale data.

DMA to vmalloc areas is dodgy at best.


\
 
 \ /
  Last update: 2011-03-24 09:27    [W:0.112 / U:1.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site