Re: [PATCH v2 4/9] powerpc/powernv: Make power7_powersave_common more generic

2016-05-19 Thread Gautham R Shenoy
On Wed, May 18, 2016 at 12:21:17PM +0530, Shreyas B Prabhu wrote:
> With this patch, r5 which is the third parameter to
> power_powersave_common contains the return address that needs to be
> written to SRR0. So here I'm keeping r5 unaltered and using r7 for the MSR.

Ok.

Reviewed-by: Gautham R. Shenoy 

> 
> Thanks,
> Shreyas

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2 4/9] powerpc/powernv: Make power7_powersave_common more generic

2016-05-18 Thread Shreyas B Prabhu


On 05/18/2016 12:07 PM, Gautham R Shenoy wrote:
> Hi Shreyas,
> 
> On Tue, May 03, 2016 at 01:54:33PM +0530, Shreyas B. Prabhu wrote:
>> power7_powersave_common does common steps needed before entering idle
>> state and eventually changes MSR to MSR_IDLE and does rfid to
>> power7_enter_nap_mode.
>>
>> Make it more generic by passing the rfid address as a function parameter.
>> Also make function name more generic.
> 
> [..snip..]
> 
>>
>>  _GLOBAL(power7_winkle)
>> -li  r3,3
>> +li  r3,PNV_THREAD_WINKLE
> 
> This particular change above can go as an independent patch.

Okay.
> 
>>
>>  _GLOBAL(power7_wakeup_tb_loss)
>> diff --git a/arch/powerpc/kernel/idle_power_common.S 
>> b/arch/powerpc/kernel/idle_power_common.S
>> index 05954ae..ff7a541 100644
>> --- a/arch/powerpc/kernel/idle_power_common.S
>> +++ b/arch/powerpc/kernel/idle_power_common.S
>> @@ -21,8 +21,10 @@
>>   * To check IRQ_HAPPENED in r4
>>   *  0 - don't check
>>   *  1 - check
>> + *
>> + * Address to 'rfid' to in r5
>>   */
>> -_GLOBAL(power7_powersave_common)
>> +_GLOBAL(power_powersave_common)
>>  /* Use r3 to pass state nap/sleep/winkle */
>>  /* NAP is a state loss, we create a regs frame on the
>>   * stack, fill it up with the state we care about and
>> @@ -79,13 +81,12 @@ _GLOBAL(power7_powersave_common)
>>   * because as soon as we do that, another thread can switch
>>   * the MMU context to the guest.
>>   */
>> -LOAD_REG_IMMEDIATE(r5, MSR_IDLE)
>> +LOAD_REG_IMMEDIATE(r7, MSR_IDLE)
>>  li  r6, MSR_RI
>>  andcr6, r9, r6
>> -LOAD_REG_ADDR(r7, power7_enter_nap_mode)
>>  mtmsrd  r6, 1   /* clear RI before setting SRR0/1 */
>> -mtspr   SPRN_SRR0, r7
>> -mtspr   SPRN_SRR1, r5
>> +mtspr   SPRN_SRR0, r5
>> +mtspr   SPRN_SRR1, r7
>>  rfid
>>  /* No return */
> 
> Any particular reason why you swapped the roles of r5 and r7 ?
> 

With this patch, r5 which is the third parameter to
power_powersave_common contains the return address that needs to be
written to SRR0. So here I'm keeping r5 unaltered and using r7 for the MSR.

Thanks,
Shreyas

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2 4/9] powerpc/powernv: Make power7_powersave_common more generic

2016-05-18 Thread Gautham R Shenoy
Hi Shreyas,

On Tue, May 03, 2016 at 01:54:33PM +0530, Shreyas B. Prabhu wrote:
> power7_powersave_common does common steps needed before entering idle
> state and eventually changes MSR to MSR_IDLE and does rfid to
> power7_enter_nap_mode.
> 
> Make it more generic by passing the rfid address as a function parameter.
> Also make function name more generic.

[..snip..]

> 
>  _GLOBAL(power7_winkle)
> - li  r3,3
> + li  r3,PNV_THREAD_WINKLE

This particular change above can go as an independent patch.

> 
>  _GLOBAL(power7_wakeup_tb_loss)
> diff --git a/arch/powerpc/kernel/idle_power_common.S 
> b/arch/powerpc/kernel/idle_power_common.S
> index 05954ae..ff7a541 100644
> --- a/arch/powerpc/kernel/idle_power_common.S
> +++ b/arch/powerpc/kernel/idle_power_common.S
> @@ -21,8 +21,10 @@
>   * To check IRQ_HAPPENED in r4
>   *   0 - don't check
>   *   1 - check
> + *
> + * Address to 'rfid' to in r5
>   */
> -_GLOBAL(power7_powersave_common)
> +_GLOBAL(power_powersave_common)
>   /* Use r3 to pass state nap/sleep/winkle */
>   /* NAP is a state loss, we create a regs frame on the
>* stack, fill it up with the state we care about and
> @@ -79,13 +81,12 @@ _GLOBAL(power7_powersave_common)
>* because as soon as we do that, another thread can switch
>* the MMU context to the guest.
>*/
> - LOAD_REG_IMMEDIATE(r5, MSR_IDLE)
> + LOAD_REG_IMMEDIATE(r7, MSR_IDLE)
>   li  r6, MSR_RI
>   andcr6, r9, r6
> - LOAD_REG_ADDR(r7, power7_enter_nap_mode)
>   mtmsrd  r6, 1   /* clear RI before setting SRR0/1 */
> - mtspr   SPRN_SRR0, r7
> - mtspr   SPRN_SRR1, r5
> + mtspr   SPRN_SRR0, r5
> + mtspr   SPRN_SRR1, r7
>   rfid
>   /* No return */

Any particular reason why you swapped the roles of r5 and r7 ?

--
Thanks and Regards
gautham.

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH v2 4/9] powerpc/powernv: Make power7_powersave_common more generic

2016-05-03 Thread Shreyas B. Prabhu
power7_powersave_common does common steps needed before entering idle
state and eventually changes MSR to MSR_IDLE and does rfid to
power7_enter_nap_mode.

Make it more generic by passing the rfid address as a function parameter.
Also make function name more generic.

Signed-off-by: Shreyas B. Prabhu 
---
 arch/powerpc/kernel/idle_power7.S   | 11 +++
 arch/powerpc/kernel/idle_power_common.S | 11 ++-
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/idle_power7.S 
b/arch/powerpc/kernel/idle_power7.S
index 594e1c5..1ea71d4 100644
--- a/arch/powerpc/kernel/idle_power7.S
+++ b/arch/powerpc/kernel/idle_power7.S
@@ -169,19 +169,22 @@ _GLOBAL(power7_idle)
 _GLOBAL(power7_nap)
mr  r4,r3
li  r3,PNV_THREAD_NAP
-   b   power7_powersave_common
+   LOAD_REG_ADDR(r5, power7_enter_nap_mode)
+   b   power_powersave_common
/* No return */
 
 _GLOBAL(power7_sleep)
li  r3,PNV_THREAD_SLEEP
li  r4,1
-   b   power7_powersave_common
+   LOAD_REG_ADDR(r5, power7_enter_nap_mode)
+   b   power_powersave_common
/* No return */
 
 _GLOBAL(power7_winkle)
-   li  r3,3
+   li  r3,PNV_THREAD_WINKLE
li  r4,1
-   b   power7_powersave_common
+   LOAD_REG_ADDR(r5, power7_enter_nap_mode)
+   b   power_powersave_common
/* No return */
 
 _GLOBAL(power7_wakeup_tb_loss)
diff --git a/arch/powerpc/kernel/idle_power_common.S 
b/arch/powerpc/kernel/idle_power_common.S
index 05954ae..ff7a541 100644
--- a/arch/powerpc/kernel/idle_power_common.S
+++ b/arch/powerpc/kernel/idle_power_common.S
@@ -21,8 +21,10 @@
  * To check IRQ_HAPPENED in r4
  * 0 - don't check
  * 1 - check
+ *
+ * Address to 'rfid' to in r5
  */
-_GLOBAL(power7_powersave_common)
+_GLOBAL(power_powersave_common)
/* Use r3 to pass state nap/sleep/winkle */
/* NAP is a state loss, we create a regs frame on the
 * stack, fill it up with the state we care about and
@@ -79,13 +81,12 @@ _GLOBAL(power7_powersave_common)
 * because as soon as we do that, another thread can switch
 * the MMU context to the guest.
 */
-   LOAD_REG_IMMEDIATE(r5, MSR_IDLE)
+   LOAD_REG_IMMEDIATE(r7, MSR_IDLE)
li  r6, MSR_RI
andcr6, r9, r6
-   LOAD_REG_ADDR(r7, power7_enter_nap_mode)
mtmsrd  r6, 1   /* clear RI before setting SRR0/1 */
-   mtspr   SPRN_SRR0, r7
-   mtspr   SPRN_SRR1, r5
+   mtspr   SPRN_SRR0, r5
+   mtspr   SPRN_SRR1, r7
rfid
/* No return */
 
-- 
2.4.11

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev