Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: yvahknez.7f7d2ff0@hashmail.org
To: linux-arm-kernel@lists.infradead.org
Subject: usb zero copy dma handling
Date: Sat, 27 Jul 2019 15:57:59 +0200	[thread overview]
Message-ID: <20190727135759.GA19217@priv-mua.localdomain> (raw)

[-- Attachment #1: Type: text/plain, Size: 858 bytes --]

Hello linux-arm.

this is a followup to that thread from 2018-11:
https://www.spinics.net/lists/arm-kernel/msg685598.html

the issue was discussed in more detail than i can claim
to fully understand back then, but no fix ever merged.
but i would really like to use rtl_433 on a raspi without
having to build a custom-patched kernel first.

the attached patch is my stripdown/cleanup of a devel-diff
provided to me by the original reporter Steve Markgraf.
credits to him for the good parts, blame to me for the bad parts.

this does not cover the additional case of "PIO-based usb controllers"
mainly because i dont understand what that means (or how to handle it)
and if its broken right now (as the thread indicates) it might
as well stay broken until someone who understands cares enough.

could you please get this on track for merging?

regards,
  x23



[-- Attachment #2: arm-usb-dma.diff --]
[-- Type: text/plain, Size: 678 bytes --]

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index ffccd40ea67d..0fedf4a97f65 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -240,9 +240,14 @@ static int usbdev_mmap(struct file *file, struct vm_area_struct *vma)
 	usbm->vma_use_count = 1;
 	INIT_LIST_HEAD(&usbm->memlist);
 
+#ifdef CONFIG_X86
 	if (remap_pfn_range(vma, vma->vm_start,
 			virt_to_phys(usbm->mem) >> PAGE_SHIFT,
 			size, vma->vm_page_prot) < 0) {
+#else /* !CONFIG_X86 */
+	if (dma_mmap_coherent(ps->dev->bus->sysdev, 
+			vma, mem, dma_handle, size) < 0) {
+#endif /* !CONFIG_X86 */
 		dec_usb_memory_use_count(usbm, &usbm->vma_use_count);
 		return -EAGAIN;
 	}

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2019-07-27 13:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-27 13:57 yvahknez.7f7d2ff0 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-08-08  8:46 usb zero copy dma handling yvahkhfo.1df7f8c2
2019-08-08  8:58 ` Greg KH
2019-08-08  9:46   ` Robin Murphy
2019-08-08 10:07     ` Greg KH
2019-08-08 10:43       ` Robin Murphy
2019-08-08 13:05       ` Greg KH
2019-08-08  9:59   ` Russell King - ARM Linux admin
2019-08-08 10:02     ` Oliver Neukum
2019-08-08 16:10 ` Christoph Hellwig
2019-08-08 16:12   ` Christoph Hellwig
2019-08-08 16:57   ` Russell King - ARM Linux admin

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=20190727135759.GA19217@priv-mua.localdomain \
    --to=yvahknez.7f7d2ff0@hashmail.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox