Subject: Re: [PATCH 1/2] powerpc: add BookS wait opcode macro

From: Nicholas Piggin <[email-masked]>
Date: Wed, 20 Jul 2022 19:54:54 +1000

Excerpts from Segher Boessenkool's message of July 13, 2022 2:29 am:
> Hi!
> 
> On Mon, Jul 11, 2022 at 01:11:27PM +1000, Nicholas Piggin wrote:
>> The wait instruction has a different encoding between BookE and BookS.
>> Add the BookS variant.
> 
>>  #define PPC_RAW_WAIT(w)			(0x7c00007c | __PPC_WC(w))
>> +#define PPC_RAW_WAIT_BOOKS(w, p)	(0x7c00003c | __PPC_WC(w) | __PPC_PL(p))
> 
> The embedded extensions are no longer part of the PowerPC architecture,
> so wouldn't it be a better way forward to rename the existing one,
> instead?  A bit more work now, but less in the future :-)

And I actually misremembered this too, was off digging and asking
about it, but the change isn't strictly BookE vs BookS, but rather
the wait opcode was changed in ISA v3.0, which is a bit of an
unfortunate landmine.

It seems apparently POWER8 implemented a non-architected instruction
'waitasec' that uses this opcode, then I suppose it was decided to
continue with that opcode in v3.0 when BookE was dropped, for reasons.
Maybe it was more widely used?

In any case, I will rename it. Precedent is divided. We have
PPC_RAW_TLBIEL_v205 for older tlbiel, and PPC_ISA_3_0_INVALIDATE_ERAT
for a new ERAT invalidation instruction. I guess making the older
instruction the exceptional case ends up being better in the long
term.

Thanks,
Nick