[PATCH ] cell: enable pause(0) in cpu_idle
Milton Miller
miltonm at bga.com
Fri Dec 16 06:48:01 EST 2005
Segher and I were talking on #mklinux about optimsing this.
Below is what we came up with.
On Dec 15, 2005, at 12:30 PM, Milton Miller wrote:
>>
>> BEGIN_FTR_SECTION
>> ·······mr·····r10,r12 /* r12 has SRR1 saved */
>> ·······srwi···r10,r10,16
>> ·······andi.··r10,r10,MSR_WAKEMASK
>> ·······cmpwi··r10,MSR_WAKEEE
>> ·······beq····hardware_interrupt_common
>> ·······cmpwi··r10,MSR_WAKEDEC
>> ·······beq····decrementer_common
>> ·······cmpwi··r10,MSR_WAKEMT
>> ·······bne····system_reset_common
>> ·······EXCEPTION_PROLOG_COMMON(0x100, PACA_EXGEN);
>> ·······b······fast_exception_return
>> END_FTR_SECTION_IFSET(CPU_FTR_PAUSE_ZERO)
>> ·······b······system_reset_common
>>
>> Is there a simpler way to express this?
>
> Original patch:
>>>>> +/* Wake Events */
>>>>> +#define MSR_WAKEMASK 0x0038
>>>>> +#define MSR_WAKERESET 0x0038
>>>>> +#define MSR_WAKESYSERR 0x0030
>>>>> +#define MSR_WAKEEE 0x0020
>>>>> +#define MSR_WAKEMT 0x0028
>>>>> +#define MSR_WAKEDEC 0x0018
>>>>> +#define MSR_WAKETHERM 0x0010
Since we are checking 3 consecitive values,
make these be in the range 0-7
<segher> shift right 19 (decim)
<segher> rlwinm a,b,13,29,31
<miltonm> sub 3 recording, beq, cmp usngined 2, blt beq
<segher> but move the cmp an insn out
lets see if I can get this all right....
BEGIN_FTR_SECTION
b system_reset_common
END_FTR_SECTION_IFCLR(CPU_FTR_PAUSE_ZERO)
#if ((WAKE_MT - WAKE_DEC) != 2) || ((WAKE_EE - WAKE_DEC) != 1)
#error This optimization is broken
#endif
rlwinm r10,r12,32-MSR_WAKE_LG,MSR_WAKE_MASK
subi. r10,r10,WAKE_DEC
cmplwi cr7,r10,WAKE_MT-WAKE_DEC
beq decrementer_common
blt cr7,hardware_interrupt_common
bne cr7,system_reset_common
EXCEPTION_PROLOG_COMMON(0x100, PACA_EXGEN);
b fast_exception_return
More information about the Linuxppc64-dev
mailing list