Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] usb: musb: host: Issue a memory barrier before staring the DMA
Date: Thu, 5 Aug 2010 14:12:12 +0100	[thread overview]
Message-ID: <20100805131212.GC23473@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <001201cb349d$5bb96e60$808918ac@apr.dhcp.ti.com>

On Thu, Aug 05, 2010 at 06:24:31PM +0530, Maulik wrote:
> > > Index: omap4_integration/drivers/usb/musb/musb_host.c
> > > ===================================================================
> > > --- omap4_integration.orig/drivers/usb/musb/musb_host.c
> > > +++ omap4_integration/drivers/usb/musb/musb_host.c
> > > @@ -628,6 +628,11 @@ static bool musb_tx_dma_program(struct d
> > >  	u8			mode;
> > >
> > >  #ifdef	CONFIG_USB_INVENTRA_DMA
> > > +	/*
> > > +	 * Ensure the data reaches to main memory before starting
> > > +	 * DMA transfer
> > > +	 */
> > > +	wmb();
> > 
> >     Are you sure this is only needed for Inventra DMA?
> 
> Yes. This is seen only on SMP system such as OMAP4 which uses Inventra DMA.
> We did not see the issue when SMP is disabled. 

It'll be far safer to actually consider what's going on here, and realise
that it's NOT a SMP issue but a write ordering issue.

What that means is that as OMAP systems progress, and the ordering becomes
weaker, you will see the problem appearing on non-SMP.  So why not fix it
properly now and avoid having to revisit this with yet more patches.

Think about what happens if writes to memory (DMA or otherwise) in the
program become mis-ordered with writes to the device registers - and fix
anything where that ordering matters by adding the necessary barriers.
This will save you having to constantly revisit the driver time and time
again to move the barriers around.

  reply	other threads:[~2010-08-05 13:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-05  9:53 [PATCH] usb: musb: host: Issue a memory barrier before staring the DMA Santosh Shilimkar
2010-08-05 12:40 ` Sergei Shtylyov
2010-08-05 12:54   ` Maulik
2010-08-05 13:12     ` Russell King - ARM Linux [this message]
2010-08-05 13:27       ` Shilimkar, Santosh
2010-08-05 15:03 ` Alan Stern
2010-08-05 15:10   ` Shilimkar, Santosh

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=20100805131212.GC23473@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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