qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/ppc: cpu_init: Clean up stop state on cpu reset
@ 2022-06-14  8:29 Frederic Barrat
  2022-06-14 12:44 ` Fabiano Rosas
  2022-06-15  5:23 ` Cédric Le Goater
  0 siblings, 2 replies; 5+ messages in thread
From: Frederic Barrat @ 2022-06-14  8:29 UTC (permalink / raw)
  To: clg, danielhb413, qemu-ppc, qemu-devel

The 'resume_as_sreset' attribute of a cpu can be set when a thread is
entering a stop state on ppc books. It causes the thread to be
re-routed to vector 0x100 when woken up by an exception. So it must be
cleaned on reset or a thread might be re-routed unexpectedly after a
reset, when it was not in a stop state and/or when the appropriate
exception handler isn't set up yet.

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
---

I didn't find an appropriate commit to add a "Fixes:". It originates
when adding support for power management states but the code looked
quite different in 2016 and it's not clear whether we were supporting
reset then.

target/ppc/cpu_init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index 0f891afa04..c16cb8dbe7 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -7186,6 +7186,9 @@ static void ppc_cpu_reset(DeviceState *dev)
         }
         pmu_update_summaries(env);
     }
+
+    /* clean any pending stop state */
+    env->resume_as_sreset = 0;
 #endif
     hreg_compute_hflags(env);
     env->reserve_addr = (target_ulong)-1ULL;
-- 
2.35.3



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-15  9:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-14  8:29 [PATCH] target/ppc: cpu_init: Clean up stop state on cpu reset Frederic Barrat
2022-06-14 12:44 ` Fabiano Rosas
2022-06-15  5:23 ` Cédric Le Goater
2022-06-15  7:17   ` Frederic Barrat
2022-06-15  9:40     ` Cédric Le Goater

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).