linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: yvahkhfo.1df7f8c2@hashmail.org
Cc: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	security@kernel.org
Subject: Re: usb zero copy dma handling
Date: Thu, 8 Aug 2019 09:10:15 -0700	[thread overview]
Message-ID: <20190808161015.GA8470@infradead.org> (raw)
In-Reply-To: <20190808084636.GB15080@priv-mua.localdomain>

On Thu, Aug 08, 2019 at 10:46:36AM +0200, yvahkhfo.1df7f8c2@hashmail.org wrote:
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -238,9 +238,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 */

Doing the dma_mmap_coherent unconditionally is the right thing here.
Gavin who is on Cc has been looking into that.

Note that you'll also need this patch which I'm going to send to Linus
this week before it properly works on x86:

http://git.infradead.org/users/hch/dma-mapping.git/commitdiff/197b3e665b82c6027be5c68a143233df7ce5224f

  parent reply	other threads:[~2019-08-08 16:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=20190808161015.GA8470@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=security@kernel.org \
    --cc=yvahkhfo.1df7f8c2@hashmail.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;
as well as URLs for NNTP newsgroup(s).