powerpc/powernv: Fix restore of SPRs upon wake up from hypervisor state loss

pnv_wakeup_tb_loss() currently expects 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 commit bcef83a00dc4 ("powerpc/powernv: Add platform
support for stop instruction"), on ISA v3.0 CPUs, the function
pnv_restore_hyp_resource() sets cr4 to contain the result of the
comparison between the state the CPU has woken up from and the first
deep stop state before calling pnv_wakeup_tb_loss().

Thus if the CPU woke up from a state that is deeper than the first
deep stop state, cr4 will 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: 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>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by Gautham R. Shenoy and committed by Michael Ellerman bd00a240 f077aaf0

Changed files
+5 -5
arch
powerpc
kernel
+5 -5
arch/powerpc/kernel/idle_book3s.S
··· 411 411 * 412 412 * r13 - PACA 413 413 * cr3 - gt if waking up with partial/complete hypervisor state loss 414 - * cr4 - eq if waking up from complete hypervisor state loss. 414 + * cr4 - gt or eq if waking up from complete hypervisor state loss. 415 415 */ 416 416 _GLOBAL(pnv_wakeup_tb_loss) 417 417 ld r1,PACAR1(r13) ··· 453 453 * At this stage 454 454 * cr2 - eq if first thread to wakeup in core 455 455 * cr3- gt if waking up with partial/complete hypervisor state loss 456 - * cr4 - eq if waking up from complete hypervisor state loss. 456 + * cr4 - gt or eq if waking up from complete hypervisor state loss. 457 457 */ 458 458 459 459 ori r15,r15,PNV_CORE_IDLE_LOCK_BIT ··· 481 481 * If waking up from sleep, subcore state is not lost. Hence 482 482 * skip subcore state restore 483 483 */ 484 - bne cr4,subcore_state_restored 484 + blt cr4,subcore_state_restored 485 485 486 486 /* Restore per-subcore state */ 487 487 ld r4,_SDR1(r1) ··· 526 526 * If waking up from sleep, per core state is not lost, skip to 527 527 * clear_lock. 528 528 */ 529 - bne cr4,clear_lock 529 + blt cr4,clear_lock 530 530 531 531 /* 532 532 * First thread in the core to wake up and its waking up with ··· 557 557 * If waking up from sleep, hypervisor state is not lost. Hence 558 558 * skip hypervisor state restore. 559 559 */ 560 - bne cr4,hypervisor_state_restored 560 + blt cr4,hypervisor_state_restored 561 561 562 562 /* Waking up from winkle */ 563 563