linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* What is the reel purpose of in_beXX() and out_beXX() fonctions ?
@ 2014-10-27 12:52 leroy christophe
  2014-10-27 15:05 ` David Laight
  2014-10-27 16:45 ` Scott Wood
  0 siblings, 2 replies; 4+ messages in thread
From: leroy christophe @ 2014-10-27 12:52 UTC (permalink / raw)
  To: LinuxPPC-dev, Scott Wood, Benjamin Herrenschmidt

Many drivers use in_be16(), in_be32(), out_be16(), out_be32(), etc .... 
to access to registrers in IO mapped memory.

What is the real purpose of those functions, and are they really needed ?

ioremap() maps the related areas as GUARDED, which means that accesses 
can't be speculative. So what is the benefit of using in_beXX() and 
out_beXX() over simple memory accesses in the area ?

Christophe

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: What is the reel purpose of in_beXX() and out_beXX() fonctions ?
  2014-10-27 12:52 What is the reel purpose of in_beXX() and out_beXX() fonctions ? leroy christophe
@ 2014-10-27 15:05 ` David Laight
  2014-10-27 21:11   ` Benjamin Herrenschmidt
  2014-10-27 16:45 ` Scott Wood
  1 sibling, 1 reply; 4+ messages in thread
From: David Laight @ 2014-10-27 15:05 UTC (permalink / raw)
  To: 'leroy christophe',
	LinuxPPC-dev, Scott Wood, Benjamin Herrenschmidt

RnJvbTogbGVyb3kgY2hyaXN0b3BoZQ0KPiBNYW55IGRyaXZlcnMgdXNlIGluX2JlMTYoKSwgaW5f
YmUzMigpLCBvdXRfYmUxNigpLCBvdXRfYmUzMigpLCBldGMgLi4uLg0KPiB0byBhY2Nlc3MgdG8g
cmVnaXN0cmVycyBpbiBJTyBtYXBwZWQgbWVtb3J5Lg0KPiANCj4gV2hhdCBpcyB0aGUgcmVhbCBw
dXJwb3NlIG9mIHRob3NlIGZ1bmN0aW9ucywgYW5kIGFyZSB0aGV5IHJlYWxseSBuZWVkZWQgPw0K
PiANCj4gaW9yZW1hcCgpIG1hcHMgdGhlIHJlbGF0ZWQgYXJlYXMgYXMgR1VBUkRFRCwgd2hpY2gg
bWVhbnMgdGhhdCBhY2Nlc3Nlcw0KPiBjYW4ndCBiZSBzcGVjdWxhdGl2ZS4gU28gd2hhdCBpcyB0
aGUgYmVuZWZpdCBvZiB1c2luZyBpbl9iZVhYKCkgYW5kDQo+IG91dF9iZVhYKCkgb3ZlciBzaW1w
bGUgbWVtb3J5IGFjY2Vzc2VzIGluIHRoZSBhcmVhID8NCg0KU29tZSBhcmNoaXRlY3R1cmVzIG1p
Z2h0IG5lZWQgdG8gdXNlIHNwZWNpZmljIGluc3RydWN0aW9uIHRvIGFjY2Vzcw0KaW8gc3BhY2Ug
KGVnIHNwYXJjIG1pZ2h0IG5lZWQgdG8gc3VwcGx5IGEgc3BlY2lmaWMgJ2FkZHJlc3MgbW9kaWZp
ZXInKS4NCg0KU3BlY2lhbCBpbnN0cnVjdGlvbnMgbWlnaHQgYmUgbmVlZGVkIHRvIHBlcmZvcm0g
YSAnYmlnIGVuZGlhbicgYWNjZXNzLg0KDQpVbmZvcnR1bmF0ZWx5IHRoZSBmdW5jdGlvbnMgc29t
ZXRpbWVzIGNvbnRhaW4gYWRkaXRpb25hbCAob2Z0ZW4gdW5uZWVkZWQpDQpzZXF1ZW5jaW5nIGlu
c3RydWN0aW9ucyAtIHRoZSBkcml2ZXIgbWF5IGJlIGFibGUgdG8gcGVyZm9ybSBtdWx0aXBsZQ0K
b3BlcmF0aW9ucyBiZXR3ZWVuIHRoZSBzZXF1ZW5jaW5nIGluc3RydWN0aW9ucy4NCg0KCURhdmlk
DQoNCg==

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What is the reel purpose of in_beXX() and out_beXX() fonctions ?
  2014-10-27 12:52 What is the reel purpose of in_beXX() and out_beXX() fonctions ? leroy christophe
  2014-10-27 15:05 ` David Laight
@ 2014-10-27 16:45 ` Scott Wood
  1 sibling, 0 replies; 4+ messages in thread
From: Scott Wood @ 2014-10-27 16:45 UTC (permalink / raw)
  To: leroy christophe; +Cc: LinuxPPC-dev

On Mon, 2014-10-27 at 13:52 +0100, leroy christophe wrote:
> Many drivers use in_be16(), in_be32(), out_be16(), out_be32(), etc .... 
> to access to registrers in IO mapped memory.
> 
> What is the real purpose of those functions, and are they really needed ?
> 
> ioremap() maps the related areas as GUARDED, which means that accesses 
> can't be speculative. So what is the benefit of using in_beXX() and 
> out_beXX() over simple memory accesses in the area ?

Speculative accesses aren't the only issue -- there's also hardware
reordering (some implementations may not do this on guarded regions, but
I don't think it's architecturally guaranteed), and of course you need
to make sure the compiler doesn't do anything funny.

-Scott

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What is the reel purpose of in_beXX() and out_beXX() fonctions ?
  2014-10-27 15:05 ` David Laight
@ 2014-10-27 21:11   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2014-10-27 21:11 UTC (permalink / raw)
  To: David Laight; +Cc: Scott Wood, LinuxPPC-dev

On Mon, 2014-10-27 at 15:05 +0000, David Laight wrote:
> 
> Unfortunately the functions sometimes contain additional (often
> unneeded) 
> sequencing instructions - the driver may be able to perform multiple 
> operations between the sequencing instructions.

That's in part why some folks are working on proper relaxed accessors
(see Will Deacon's stuff)

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-27 21:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-27 12:52 What is the reel purpose of in_beXX() and out_beXX() fonctions ? leroy christophe
2014-10-27 15:05 ` David Laight
2014-10-27 21:11   ` Benjamin Herrenschmidt
2014-10-27 16:45 ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).