[PATCH v2] powerpc xmon: use `dcbf` inplace of `dcbi` instruction for 64bit Book3S
Christophe Leroy
christophe.leroy at c-s.fr
Sat Mar 28 06:40:10 AEDT 2020
Le 27/03/2020 à 19:19, Segher Boessenkool a écrit :
> On Fri, Mar 27, 2020 at 04:12:13PM +0100, Christophe Leroy wrote:
>> Maybe you could also change invalidate_dcache_range():
>>
>> for (i = 0; i < size >> shift; i++, addr += bytes) {
>> if (IS_ENABLED(CONFIG_PPC_BOOK3S_64))
>> dcbf(addr);
>> else
>> dcbi(addr);
>> }
>
> But please note that flushing is pretty much the opposite from
> invalidating (a flush (dcbf) makes sure that what is in the cache now
> ends up in memory, while an invalidate (dcbi) makes sure it will *not*
> end up in memory). (Both will remove the addressed cache line from the
> data caches).
>
> So you cannot blindly replace them; in all cases you need to look and
> see if it does what you need here.
>
> (dcbi is much harder to use correctly -- it can race very easily -- so
> in practice you will be fine most of the time; but be careful around
> startup code and the like).
>
At the time being, invalidate_dcache_range() is used in only one place,
and that's a place for PPC32 only. So I was just suggesting that just in
case. Maybe there is no point in bothering with that at the time being.
Christophe
More information about the Linuxppc-dev
mailing list