Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1478278

Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev

From Roger Quadros <rogerq@ti.com>
Newsgroups linux.kernel
Subject Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev
Date 2016-09-07 15:10 +0200
Message-ID <seKM2-9T-21@gated-at.bofh.it> (permalink)
References <scXDH-B6-9@gated-at.bofh.it> <scZ2Q-1kr-61@gated-at.bofh.it> <seFjj-51s-13@gated-at.bofh.it> <seGp3-5Kk-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 07/09/16 11:29, Arnd Bergmann wrote:
> On Wednesday, September 7, 2016 10:17:31 AM CEST Roger Quadros wrote:
>>>
>>> Speaking of that flag, I suppose we need the same logic to know where
>>> to look for USB devices attached to a dwc3 host when we need to describe
>>> them in DT. By default we look for child device nodes under the
>>> node of the HCD device node, but that would be wrong here too.
>>
>> I didn't get this part. Information about USB devices attached to a USB host
>> is never provided in DT because they are always dynamically created via
>> usb_new_device(), whether they are hard-wired on the board or hot-plugged.
>>
>> These USB devices inherit their DMA masks in the usb_alloc_dev() routine
>> whereas each interface within the USB device inherits its DMA mask in
>> usb_set_configuration().
> 
> We had talked about adding support for this for at least six years (probably
> much more), but Peter Chen finally added it this year in commit 69bec72598
> ("USB: core: let USB device know device node").

OK. Thanks for this pointer.
> 
> The main use for it is to let you specify a MAC address for on-board
> ethernet devices that lack an EPROM, but any other information can be
> added that way too.
> 
>> There is a bug  in the USB core because of which the ISB device and interfaces
>> do not inherit dma_pfn_offset correctly for which I've sent a patch
>> https://lkml.org/lkml/2016/8/17/275
> 
> I'm a bit skeptical about this. Clearly if we set the dma_mask, we should
> also set the dma_pfn_offset, but what exactly is this used for in USB
> devices?

Consider the mass storage device case.
USB storage driver creates a scsi host for the mass storage interface in
drivers/usb/storage/usb.c
The scsi host parent device is nothing but the the USB interface device.

Now, __scsi_init_queue() calls scsi_calculate_bounce_limit() to find out
and set the block layer bounce limit.

scsi_calculate_bounce_limit() uses dma_max_pfn(host_dev) to get the bounce_limit.

host_dev is nothing but the device representing the mass storage interface.

If that device doesn't have the right dma_pfn_offset, then dma_max_pfn()
is messed up and the bounce buffer limit is wrong.

> 
> As I understand it, the dma_mask/dma_pfn_offset etc is used for the DMA
> mapping interface, but that can't really be used on USB devices, which
> I assume use usb_alloc_coherent() and the URB interfaces for passing data
> between a USB driver and the HCD. My knowledge of USB device drivers
> is a bit lacking, so it's possible I'm misunderstanding things here.
> 

cheers,
-roger

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Leo Li <pku.leo@gmail.com> - 2016-09-02 00:20 +0200
  Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-02 12:50 +0200
    Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Russell King - ARM Linux <linux@armlinux.org.uk> - 2016-09-02 13:00 +0200
      Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-02 13:20 +0200
        Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-02 16:20 +0200
        Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Alan Stern <stern@rowland.harvard.edu> - 2016-09-02 16:30 +0200
          Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-02 18:00 +0200
            Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Roger Quadros <rogerq@ti.com> - 2016-09-07 09:20 +0200
              Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-07 10:30 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Roger Quadros <rogerq@ti.com> - 2016-09-07 15:10 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-07 16:40 +0200
        Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Grygorii Strashko <grygorii.strashko@ti.com> - 2016-09-02 18:30 +0200
    Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-02 13:00 +0200
      Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Robin Murphy <robin.murphy@arm.com> - 2016-09-02 14:00 +0200
        Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-02 15:00 +0200
        Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-02 15:20 +0200
    Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Leo Li <pku.leo@gmail.com> - 2016-09-03 00:20 +0200
      Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-05 17:50 +0200
        Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Peter Chen <hzpeterchen@gmail.com> - 2016-09-06 08:40 +0200
          Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-06 08:50 +0200
            Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-06 12:50 +0200
              Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-06 13:00 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-06 15:30 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-07 09:00 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Peter Chen <hzpeterchen@gmail.com> - 2016-09-07 09:50 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-07 11:00 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Peter Chen <hzpeterchen@gmail.com> - 2016-09-07 11:30 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Russell King - ARM Linux <linux@armlinux.org.uk> - 2016-09-07 11:40 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-07 12:20 +0200
          Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-06 12:40 +0200
            Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Peter Chen <hzpeterchen@gmail.com> - 2016-09-07 08:40 +0200
              Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-07 10:50 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Peter Chen <hzpeterchen@gmail.com> - 2016-09-07 12:00 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Robin Murphy <robin.murphy@arm.com> - 2016-09-07 12:40 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-07 12:50 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-07 12:30 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-07 17:30 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Alan Stern <stern@rowland.harvard.edu> - 2016-09-07 18:10 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-07 21:50 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Peter Chen <hzpeterchen@gmail.com> - 2016-09-08 03:20 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-08 10:10 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-08 10:10 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-08 10:30 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-08 10:40 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-08 10:50 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-08 11:50 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-08 12:20 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-08 13:10 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-08 13:20 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-08 13:30 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-08 13:50 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Felipe Balbi <balbi@kernel.org> - 2016-09-08 14:00 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-08 14:50 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Grygorii Strashko <grygorii.strashko@ti.com> - 2016-09-08 14:10 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-08 14:20 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Peter Chen <hzpeterchen@gmail.com> - 2016-09-08 14:30 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent dev Arnd Bergmann <arnd@arndb.de> - 2016-09-08 15:00 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Peter Chen <hzpeterchen@gmail.com> - 2016-09-09 03:40 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Grygorii Strashko <grygorii.strashko@ti.com> - 2016-09-08 15:10 +0200
                Re: [PATCH] usb: dwc3: host: inherit dma configuration from parent  dev Peter Chen <hzpeterchen@gmail.com> - 2016-09-09 04:00 +0200

csiph-web