Re: [PATCH] usb: devio: fix mmap() on non-coherent DMA architectures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



usbfs mmap() looks like it was introduced for 4.6 in commit
f7d34b445abc, so it should probably be backported to 4.9 and onwards.
This issue has been present since the introduction of the feature.

One sidenote: this patch will cause the following warning on x86 due
to dmap_mmap_coherent() trying to map normal memory in as uncached:

x86/PAT: ... map pfn RAM range req uncached-minus for [mem
0x77b000000-0x77b210fff], got write-back

This warning is harmless, as x86 is DMA coherent and the memory gets
correctly mapped in as write-back. I will submit a patch to the DMA
mapping team to eliminate this warning.

Best,
Gavin

On Fri, Aug 2, 2019 at 5:14 AM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, Aug 01, 2019 at 03:04:36PM -0700, gavinli@xxxxxxxxxxxxxx wrote:
> > From: Gavin Li <git@xxxxxxxxxxxxxx>
> >
> > On architectures that are not (or are optionally) DMA coherent,
> > dma_alloc_coherent() returns an address into the vmalloc space,
> > and calling virt_to_phys() on this address returns an unusable
> > physical address.
> >
> > This patch replaces the raw remap_pfn_range() call with a call to
> > dmap_mmap_coherent(), which takes care of the differences between
> > coherent and non-coherent code paths.
> >
> > Tested on an arm64 rk3399 board.
> >
> > Signed-off-by: Gavin Li <git@xxxxxxxxxxxxxx>
> > ---
> >  drivers/usb/core/devio.c | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
>
> Should this be backported to the stable kernel trees to fix the issue on
> those platforms?  If so, how far back?  What commit caused this problem
> to occur?
>
> thanks,
>
> greg k-h



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux