All of lore.kernel.org
 help / color / mirror / Atom feed
From: steve@steve-m.de (Steve Markgraf)
To: linux-arm-kernel@lists.infradead.org
Subject: usbfs zerocopy broken on ARM/ARM64
Date: Fri, 9 Nov 2018 21:58:12 +0100	[thread overview]
Message-ID: <465978ed-6b26-d1cf-fb14-0cb7d5defcba@steve-m.de> (raw)
In-Reply-To: <20181107123111.GU30658@n2100.armlinux.org.uk>

On 07.11.18 13:31, Russell King - ARM Linux wrote:
>> From what I read so far I got the impression that the 'proper' way would
>> be to use dma_mmap_coherent() with dma_addr instead of
>> remap_pfn_range(), however, I did not get it to work. Can anyone help
>> out?
> 
> That is correct.  Please show what you tried.  Thanks.

Thanks for the clarification. I now debugged it further and it turned
out I was using the wrong device pointer. Now it is working for both ARM
and x86 with:

> dma_mmap_coherent(ps->dev->bus->sysdev, vma, mem, dma_handle, size);

However, on x86 I get warnings in the Kernel log:

> x86/PAT: rtl_test:4018 map pfn RAM range req uncached-minus for
> [mem >0x34bc0000-0x34bfffff], got write-back

Another user of dma_mmap_coherent(), sound/core/pcm_native.c, only uses
it for arch != x86 for that reason:

> #ifndef CONFIG_X86 /* for avoiding warnings arch/x86/mm/pat.c */

Since the original code is working fine on x86, probably that would be
the way to go for the usbfs code as well.
And as the previous posters pointed out, hcd_buffer_alloc() can use
kmalloc() for PIO-based USB controllers, but in this case sets the
dma_handle to ~0, so we could check for this and only use
dma_mmap_coherent() if that's not the case.

If that's correct, I'll prepare a patch.

Regards,
Steve

      reply	other threads:[~2018-11-09 20:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 22:32 usbfs zerocopy broken on ARM/ARM64 Steve Markgraf
2018-11-07 11:35 ` Mark Rutland
2018-11-07 12:23   ` Robin Murphy
2018-11-07 12:31 ` Russell King - ARM Linux
2018-11-09 20:58   ` Steve Markgraf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=465978ed-6b26-d1cf-fb14-0cb7d5defcba@steve-m.de \
    --to=steve@steve-m.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.