[openib-general] Re: [PATCH 01/13] [RFC] ipath basic headers

Arjan van de Ven arjan at infradead.org
Sat Dec 17 14:25:23 PST 2005


On Sat, 2005-12-17 at 14:19 -0800, Robert Walsh wrote:
> > > +{
> > > +	void *ssv, *dsv;
> > > +	uint32_t csv;
> > > +	__asm__ __volatile__("cld\n\trep\n\tmovsb":"=&c"(csv), "=&D"(dsv),
> > > +			     "=&S"(ssv)
> > > +			     :"0"(cnt), "1"(dest), "2"(src)
> > > +			     :"memory");
> > > +}
> > 
> > No way we're gonna put assembler code into such a driver.
> 
> Why not?  The chip (and therefore the driver) only works with Opterons.
> It's tied to the HT bus, but PCI or anything like that.

and opterons can already run 2 architectures. And the HT bus is a
generic bus.. with public specs. Others than just AMD use it as well.

also.. what is wrong with memcpy and co ?

> > > +static __inline__ uint32_t ipath_kget_kreg32(const ipath_type stype,
> > > +					     ipath_kreg regno)
> > > +{
> > > +	volatile uint32_t *kreg32;
> > > +
> > > +	if (!devdata[stype].ipath_kregbase)
> > > +		return ~0;
> > > +
> > > +	kreg32 = (volatile uint32_t *)&devdata[stype].ipath_kregbase[regno];
> > 
> > volatile use is probably always wrong. but this whole functions looks like
> > a very odd wrapper anyway?
> 
> The volatile is there so the compiler doesn't optimize away the read.
> This is important, because reads of our hardware have side-effects and
> cannot be optimized out.

then you need to use readl() and family most like; they already take
care of this anyway.





More information about the general mailing list