[PATCH v2 1/2] powerpc: Add helpers for LPCR PECE1 operations

Shreyas B Prabhu shreyas at linux.vnet.ibm.com
Fri Jan 23 14:46:25 AEDT 2015



On Friday 23 January 2015 08:36 AM, Michael Ellerman wrote:
> On Mon, 2015-01-19 at 13:35 +0530, Shreyas B. Prabhu wrote:
>> PECE1 bit in LPCR is used to control whether decrementer can cause exit
>> from powersaving states. PECE1 bit is cleared before entering fastsleep
>> or deeper powersaving state and it is set on waking up. Since both
>> cpuidle and cpu offline operations use these powersaving states, add
>> helper functions to be used in both these places.
> 
> Thanks.
> 
> That isn't really much clearer than the original, so in the end I just merged
> your original fix.
> 
> I'll think if there's a bigger consolidation we can do that makes it clearer.
> 
> cheers
> 
> 
Helper could have been this :

#define   LPCR_CLEAR_PECE1	(mfspr(SPRN_LPCR) & ~(u64)LPCR_PECE1)

This perhaps would make it more clearer, but it will end up using additional mfspr here-

    static int fastsleep_loop(struct cpuidle_device *dev,
    				struct cpuidle_driver *drv,
    				int index)
    {
    	...
    
    	new_lpcr = old_lpcr;
    	/* Do not exit powersave upon decrementer as we've setup the timer
    	 * offload.
    	 */
    	new_lpcr &= ~LPCR_PECE1;
    
    	mtspr(SPRN_LPCR, new_lpcr);



More information about the Linuxppc-dev mailing list