RE: DMA over USB

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

 



On Wed, 2 Jul 2014, David Laight wrote:

> From: Raghavendra
> > Thank you for responding Peter,
> > > Raghavendra wrote:
> > >> I have a query regarding DMA(Direct Memory Access) for the usb devices.
> > > USB devices never do DMA.
> > >
> > >> As far as Linux is concerned, how the DMA action being taking place for
> > >> USB devices.
> > > It doesn't take place.
> > >
> > >> As per my understanding, the USB host controller is taking care of
> > >> the DMA operations.
> > > That's correct. When an URB is submitted by host software the host
> > > controller asks the device for data, and when data arrives from the
> > > device the host controller writes the data into memory using DMA.
> > As I understand, the USB host controllers(on x86) are basically PCI
> > devices and PCI devices are capable of bus mastering, thus performing DMA.
> > But, if we take the case of a non x86 platform (say ARM), the USB host
> > controller may or may not be capable of performing DMA.

That's right.

> > In that case how
> > far the cases are valid if we try to push the data from the USB device
> > through DMA
> > For example, if we take the case of a simple USB mouse
> > driver(usbmouse.c), it uses DMA to obtain the data.

DMA gets used if the host controller supports it.

> > What if this driver
> > is associated with a host controller which doesnt have the support for
> > DMA. What will happen in that scenario?

Then DMA isn't used.  PIO gets used instead.

> It is extremely unlikely that a USB host controller will be unable to
> do DMA - in the sense that it transfers USB data to/from host memory
> buffers.

There are plenty of USB host controllers that can't do DMA.  The 
kernel has to take responsibility for transferring data between the 
controller memory and the host memory, using PIO.

> However the host buffer addresses are not made available to the USB
> target hardware - so it can't select which buffer is used.
> 
> It is just possible that the memory the host controller uses is resident
> on (say) a PCI card. But the normal bandwidth requirements make that
> unlikely.

Host controllers always have data buffers.

> Another exception might be for slow devices (keyboard/mouse) where the
> amount of data is very limited - but that won't be a host.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux