+#if defined(__powerpc64__) || defined(CONFIG_PPC_64BITSUPPORT) +#ifdef CONFIG_PPC_64BITSUPPORT
Phew - too much ifdef for my taste. How about the idea I mentioned in the mail before to just make is_ppc64 return always 0 on ppc32 hosts without compat config option? Then you could also protect the slbia and slbmte and whatever ppc64 specific pieces with #ifdefs but not care about the rest :). Would hopefully make this code a lot more readable!
Yeah. Factor out most stuff so you have a single #ifdef for them :-)
- asm volatile("isync" ::: "memory");
And this would be awesome to get as inline function too! :)
Too bad that won't work. It will not work as written either -- the asm can still be moved around relative to some stuff.
Put the isync in the same asm that it is syncing for.
Oh, btw, slbia does not invalidate all SLBs (it doesn't invalidate #0). It probably doesn't matter here, since you write #0 soon enough, and you cannot have an exception happen before that. Also, the slbia does invalidate the ERATs. But you might want to check this, and/or add a comment.
Segher