Subject: Re: [PATCH 2/14] nes: device structures and defines

From: Michael Buesch <[email-masked]>
Date: Wed, 8 Aug 2007 18:43:36 +0200

On Wednesday 08 August 2007 18:33:24 Jeff Garzik wrote:
> Michael Buesch wrote:
> > On Wednesday 08 August 2007 18:18:31 Roland Dreier wrote:
> >>  > But there are indeed a few cases that look wrong.
> >>
> >> yes...
> >>
> >>  > arch/x86_64/kernel/pci-calgary.c:       writel(cpu_to_be32(val), target);
> >>
> >> eg this almost certainly wants to be
> >>
> >> 	writel(swab32(val), target);
> >>
> >> or something equivalent like
> >>
> >> 	__raw_writel(cpu_to_be32(val), target);
> >> 	/* plus some suffficent memory ordering */
> >>
> >>  - R.
> >>
> >>
> > 
> > certainly, yes.
> > Most likely the __raw_writel variant is portable, but I am not
> > sure. Anybody sure?
> 
> Yes, it's portable.  You must however be aware of the guarantees that 
> writel() provides and __raw_writel() does not:  no barriers or flushes, 
> no endian conversions, no ordering constraints, ...  Probably a few more 
> details I'm forgetting too :)

writel doesn't guarantee flushing either.
readl does.
The barrier/ordering issue however might be a critical thing,
when using __raw_XXX. So one must always mmiowb() after such a write.

-- 
Greetings Michael.