Commit ec486735 authored by Gautham R. Shenoy's avatar Gautham R. Shenoy Committed by Michael Ellerman
Browse files

powerpc/powernv/idle: Decouple Timebase restore & Per-core SPRs restore

On POWER8, in case of
   -  nap: both timebase and hypervisor state is retained.
   -  fast-sleep: timebase is lost. But the hypervisor state is retained.
   -  winkle: timebase and hypervisor state is lost.

Hence, the current code for handling exit from a idle state assumes
that if the timebase value is retained, then so is the hypervisor
state. Thus, the current code doesn't restore per-core hypervisor
state in such cases.

But that is no longer the case on POWER9 where we do have stop states
in which timebase value is retained, but the hypervisor state is
lost. So we have to ensure that the per-core hypervisor state gets
restored in such cases.

Fix this by ensuring that even in the case when timebase is retained,
we explicitly check if we are waking up from a deep stop that loses
per-core hypervisor state (indicated by cr4 being eq or gt), and if
this is the case, we restore the per-core hypervisor state.
Signed-off-by: default avatarGautham R. Shenoy <>
Signed-off-by: default avatarMichael Ellerman <>
parent 5f221c3c
......@@ -731,13 +731,14 @@ timebase_resync:
* Use cr3 which indicates that we are waking up with atleast partial
* hypervisor state loss to determine if TIMEBASE RESYNC is needed.
ble cr3,clear_lock
ble cr3,.Ltb_resynced
/* Time base re-sync */
bl opal_resync_timebase;
* If waking up from sleep, per core state is not lost, skip to
* clear_lock.
* If waking up from sleep (POWER8), per core state
* is not lost, skip to clear_lock.
blt cr4,clear_lock
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment