RE: DMA versus PIO

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

 



> Felipe:
> 
> There's a comment in message.c:usb_sg_init() about some systems needing
> to revert to PIO when DMA is temporarily unavailable.  Does this refer
> to the musb drivers?  Or if not, do you know which drivers it does
> refer to?
> 
> This is something we have to be careful about.  The CPU generally isn't
> allowed to access buffers while they are mapped for DMA.  If the
> controller driver needs to use PIO instead of DMA, then it will have to
> unmap the buffers first.
> 

Alan,

Yes, MUSB is one such driver that could potentially revert to PIO
when DMA is unavailable.

One of the DMA engines used with MUSB has 8 DMA channels. If all of
them are in use, then some transfers are carried out using PIO.


Also, if the DMA programming call returns an error, then the transfer
is attempted using PIO.

For a long time, the DMA code never had any error returns added, but
the backup PIO path was still present in the code. A short while ago,
I introduced a patch to workaround a hardware bug - this patch
would make the DMA programming call return failure, and force the
trasnsfer to be carried out using PIO. (This patch is now in mainline)

After this patch was merged into internal codebases, someone recently
pointed out that this approach is not correct, and I cannot mix and
match DMA and PIO accesses the way we're doing it in the driver.


I'm afraid I don't understand the DMA APIs very well and their usage
in the MUSB driver. I still need to study them.

Thanks for pointing this out.

- Anand

> I have been working on map_urb_for_dma() and unmap_urb_for_dma(), and
> it seems like a good idea to EXPORT the unmap routine so that HCDs
> could call it when they need to revert to PIO.  And of course, we will
> also need to add changes for drivers that have to use PIO for control
> transfers but can use DMA for other transfer types.
> 
> 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