* [PATCH] powernv: Restore SPRs correctly upon wake up from hypervisor state loss
@ 2016-09-07 5:16 Gautham R. Shenoy
2016-09-08 2:10 ` Shreyas B. Prabhu
2016-09-12 22:09 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Gautham R. Shenoy @ 2016-09-07 5:16 UTC (permalink / raw)
To: linuxppc-dev, linux-kernel
Cc: Gautham R. Shenoy, Vaidyanathan Srinivasan, Michael Neuling,
Michael Ellerman, Shreyas B. Prabhu
From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
pnv_wakeup_tb_loss function currently expects the cr4 to be "eq" if
the CPU is waking up from a complete hypervisor state loss. Hence, it
currently restores the SPR contents only if cr4 is "eq".
However, after the commit bcef83a00dc4 ("powerpc/powernv: Add platform
support for stop instruction"), on ISA_V300 CPUs, the function
pnv_restore_hyp_resource sets cr4 to contain the result of the
comparison between state the CPU has woken up and the first deepest
stop state before calling pnv_wakeup_tb_loss.
Thus if the CPU woke up from a state that is deeper than the first
deepest stop state, cr4 have "gt" set and hence, pnv_wakeup_tb_loss
will fail to restore the SPRs on waking up from such a state.
Fix the code in pnv_wakeup_tb_loss to restore the SPR states when cr4 is
"eq" or "gt".
Fixes: Commit bcef83a00dc4 ("powerpc/powernv: Add platform support for
stop instruction")
Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Cc: Michael Neuling <michael.neuling@au1.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Shreyas B. Prabhu <shreyasbp@gmail.com>
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
arch/powerpc/kernel/idle_book3s.S | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index 2265c63..bd739fe 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -411,7 +411,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
*
* r13 - PACA
* cr3 - gt if waking up with partial/complete hypervisor state loss
- * cr4 - eq if waking up from complete hypervisor state loss.
+ * cr4 - gt or eq if waking up from complete hypervisor state loss.
*/
_GLOBAL(pnv_wakeup_tb_loss)
ld r1,PACAR1(r13)
@@ -453,7 +453,7 @@ lwarx_loop2:
* At this stage
* cr2 - eq if first thread to wakeup in core
* cr3- gt if waking up with partial/complete hypervisor state loss
- * cr4 - eq if waking up from complete hypervisor state loss.
+ * cr4 - gt or eq if waking up from complete hypervisor state loss.
*/
ori r15,r15,PNV_CORE_IDLE_LOCK_BIT
@@ -481,7 +481,7 @@ first_thread_in_subcore:
* If waking up from sleep, subcore state is not lost. Hence
* skip subcore state restore
*/
- bne cr4,subcore_state_restored
+ blt cr4,subcore_state_restored
/* Restore per-subcore state */
ld r4,_SDR1(r1)
@@ -526,7 +526,7 @@ timebase_resync:
* If waking up from sleep, per core state is not lost, skip to
* clear_lock.
*/
- bne cr4,clear_lock
+ blt cr4,clear_lock
/*
* First thread in the core to wake up and its waking up with
@@ -557,7 +557,7 @@ common_exit:
* If waking up from sleep, hypervisor state is not lost. Hence
* skip hypervisor state restore.
*/
- bne cr4,hypervisor_state_restored
+ blt cr4,hypervisor_state_restored
/* Waking up from winkle */
--
1.9.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powernv: Restore SPRs correctly upon wake up from hypervisor state loss
2016-09-07 5:16 [PATCH] powernv: Restore SPRs correctly upon wake up from hypervisor state loss Gautham R. Shenoy
@ 2016-09-08 2:10 ` Shreyas B. Prabhu
2016-09-12 22:09 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Shreyas B. Prabhu @ 2016-09-08 2:10 UTC (permalink / raw)
To: Gautham R. Shenoy
Cc: linuxppc-dev, linux-kernel, Vaidyanathan Srinivasan,
Michael Neuling, Michael Ellerman
Hi Gautham,
Thanks for fixing this.
On Wed, Sep 7, 2016 at 1:16 AM, Gautham R. Shenoy
<ego@linux.vnet.ibm.com> wrote:
> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
>
> pnv_wakeup_tb_loss function currently expects the cr4 to be "eq" if
> the CPU is waking up from a complete hypervisor state loss. Hence, it
> currently restores the SPR contents only if cr4 is "eq".
>
> However, after the commit bcef83a00dc4 ("powerpc/powernv: Add platform
> support for stop instruction"), on ISA_V300 CPUs, the function
> pnv_restore_hyp_resource sets cr4 to contain the result of the
> comparison between state the CPU has woken up and the first deepest
> stop state before calling pnv_wakeup_tb_loss.
>
> Thus if the CPU woke up from a state that is deeper than the first
> deepest stop state, cr4 have "gt" set and hence, pnv_wakeup_tb_loss
> will fail to restore the SPRs on waking up from such a state.
>
> Fix the code in pnv_wakeup_tb_loss to restore the SPR states when cr4 is
> "eq" or "gt".
>
> Fixes: Commit bcef83a00dc4 ("powerpc/powernv: Add platform support for
> stop instruction")
>
> Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
> Cc: Michael Neuling <michael.neuling@au1.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Shreyas B. Prabhu <shreyasbp@gmail.com>
> Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
> ---
Reviewed-by: Shreyas B. Prabhu <shreyasbp@gmail.com>
Thanks,
Shreyas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: powernv: Restore SPRs correctly upon wake up from hypervisor state loss
2016-09-07 5:16 [PATCH] powernv: Restore SPRs correctly upon wake up from hypervisor state loss Gautham R. Shenoy
2016-09-08 2:10 ` Shreyas B. Prabhu
@ 2016-09-12 22:09 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2016-09-12 22:09 UTC (permalink / raw)
To: Gautham R. Shenoy, linuxppc-dev, linux-kernel
Cc: Shreyas B. Prabhu, Gautham R. Shenoy, Michael Neuling
On Wed, 2016-07-09 at 05:16:30 UTC, "Gautham R. Shenoy" wrote:
> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
>
> pnv_wakeup_tb_loss function currently expects the cr4 to be "eq" if
> the CPU is waking up from a complete hypervisor state loss. Hence, it
> currently restores the SPR contents only if cr4 is "eq".
>
> However, after the commit bcef83a00dc4 ("powerpc/powernv: Add platform
> support for stop instruction"), on ISA_V300 CPUs, the function
> pnv_restore_hyp_resource sets cr4 to contain the result of the
> comparison between state the CPU has woken up and the first deepest
> stop state before calling pnv_wakeup_tb_loss.
>
> Thus if the CPU woke up from a state that is deeper than the first
> deepest stop state, cr4 have "gt" set and hence, pnv_wakeup_tb_loss
> will fail to restore the SPRs on waking up from such a state.
>
> Fix the code in pnv_wakeup_tb_loss to restore the SPR states when cr4 is
> "eq" or "gt".
>
> Fixes: Commit bcef83a00dc4 ("powerpc/powernv: Add platform support for stop instruction")
> Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
> Reviewed-by: Shreyas B. Prabhu <shreyasbp@gmail.com>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/bd00a240dc52e28706fbbe3ace
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-12 22:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-07 5:16 [PATCH] powernv: Restore SPRs correctly upon wake up from hypervisor state loss Gautham R. Shenoy
2016-09-08 2:10 ` Shreyas B. Prabhu
2016-09-12 22:09 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).