[U-Boot] [PATCH] arm: Kirkwood: Add memory barriers to kwgbe_send/recv

Wolfgang Denk wd at denx.de
Sun Jul 5 01:52:36 CEST 2009


Dear Simon Kagstrom,

In message <20090702084702.3e4ecae4 at marrow.netinsight.se> you wrote:
> On Wed, 1 Jul 2009 09:57:10 -0700
> Prafulla Wadaskar <prafulla at marvell.com> wrote:
> > > kwgbe_send/recv both have loops waiting for the hardware to 
> > > set  a bit.
> > > GCC 4.3.3 cleverly optimizes this to ... a while(1); loop.
> > Struct used is defined as volatile here.
> > Is this not sufficient?
> 
> Right, but that was only for recv - send isn't volatile. I'll send a
> new patch with the required changes. The question is which :-):
> 
> 1. Make structure volatile in send as well
> 
> 2. Use readl() where needed
> 
> 3. Keep the memory barrier approach (and maybe add a mb() macro to arm
>    as well)
> 
> I'm happy to get suggestions!

There is a pretty clear policy in U-Boot now: please always use
accessor functions.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The shortest unit of time in the multiverse is the News York  Second,
defined  as  the  period  of  time between the traffic lights turning
green and the cab behind you honking.
                                - Terry Pratchett, _Lords and Ladies_


More information about the U-Boot mailing list