Hello.

Paul Stuart wrote:

You should post this to linux-...@vger,kernel.org and CC Felipe Balbi <[email protected]>, the MUSB maintainer. Kevin doesn't apply USB patches.

cppi_next_tx_segment is not checking for Transmit Buffer Descriptor ownership before modifying parameters.

Transmit Buffer Descriptor ram is shared between the host processor and the DMA. The "Ownership" bit is set by the host processor to give the DMA ownership of the Transmit Buffer Descriptor, and the bit is cleared by the DMA to return ownership to the host processor.

On USB Tx, when the system is heavily loaded, cppi_next_tx_segment can overwrite a Transmit Buffer Descriptor that is still owned by the DMA, causing DMA truncation error to fire, resulting in a channel abort. This proposed fix adds a check for host processor ownership of the bd and does not proceed to program it until the DMA has ended ownership.


Condition rarely occurs, so USB write speed is not negatively impacted.

Tested on DM365

Signed-off-by: Paul Stuart <[email protected]>
*---*

The tearline is ---, without *'s. You don't need it anyway as the patch immediately follows, without diffstat or your remarks.

--- a/drivers/usb/musb/cppi_dma.c       2010-12-06 16:35:37.000000000 -0800
+++ b/drivers/usb/musb/cppi_dma.c       2010-12-06 16:36:15.000000000 -0800
@@ -625,6 +625,9 @@ cppi_next_tx_segment(struct musb *musb,
        * size; for RNDIS there _is_ only that last packet.
        */

   Your patch is whitespace-mangled, i.e. has spaces instead of all tabs.

       for (i = 0; i < n_bds; ) {
+               /* wait for DMA to release ownership of this bd */
+               while(bd->hw_options & CPPI_OWN_SET)cpu_relax();

   cpu_relax() call should be on a line of its own (properly indented with tab).

+
               if (++i < n_bds && bd->next)
                       bd->hw_next = bd->next->dma;
               else

WBR, Sergei
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to