From: Catalin Marinas on
On Tue, 2010-02-02 at 12:08 +0000, Sebastian Andrzej Siewior wrote:
> * Catalin Marinas | 2010-02-02 11:11:35 [+0000]:
>
> >When the HDC driver writes the data to the transfer buffers it pollutes
> >the D-cache (unlike DMA drivers where the device writes the data). If
> >the corresponding pages get mapped into user space, there are no
> >additional cache flushing operations performed and this causes random
> >user space faults on architectures with separate I and D caches
> >(Harvard) or those with aliasing D-cache.
>
> After looking through lib/scatterlist.c it uses
> #include <linux/highmem.h>
>
> and
>
> flush_kernel_dcache_page().
> Wouldn't this do the job here as well?

The documentation implies that this is to be used only with pages
obtained with kmap(), which doesn't seem to be the case here. On some
ARM processors it isn't even implemented (kunmap does the necessary
flushing).

--
Catalin

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Catalin Marinas on
On Tue, 2010-02-02 at 15:41 +0000, Ming Lei wrote:
> 2010/2/2 Catalin Marinas <catalin.marinas(a)arm.com>:
>
> > + if (usb_pipein(urb->pipe) && usb_pipetype(urb->pipe) == PIPE_BULK) {
> > + void *ptr;
> > + for (ptr = urb->transfer_buffer;
> > + ptr < urb->transfer_buffer + urb->transfer_buffer_length;
> > + ptr += PAGE_SIZE)
> > + flush_dcache_page(virt_to_page(ptr));
>
> If the page is mapped into highmem, seems virt_to_page doesn't work well.

You are right but is it possible that we get a highmem virtual address
in this case?

As for a general solution, maybe trying to define something like a pio_*
API would work better.

--
Catalin

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/