summary refs log tree commit diff stats
path: root/accel/tcg/user-exec-stub.c
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2020-10-15 23:18:32 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2020-10-28 01:08:53 +1100
commitf1023d21e81b7bf523ddf2ac91a48117f20ef9d7 (patch)
tree4a9d14e1edec7b33f146cff745fb01419350225f /accel/tcg/user-exec-stub.c
parent90689a32ce2b84580646956c2417343943e5df37 (diff)
downloadfocaccia-qemu-f1023d21e81b7bf523ddf2ac91a48117f20ef9d7.tar.gz
focaccia-qemu-f1023d21e81b7bf523ddf2ac91a48117f20ef9d7.zip
spapr: Unrealize vCPUs with qdev_unrealize()
Since we introduced CPU hot-unplug in sPAPR, we don't unrealize the
vCPU objects explicitly. Instead, we let QOM handle that for us under
object_property_del_all() when the CPU core object is finalized. The
only thing we do is calling cpu_remove_sync() to tear the vCPU thread
down.

This happens to work but it is ugly because:
- we call qdev_realize() but the corresponding qdev_unrealize() is
  buried deep in the QOM code
- we call cpu_remove_sync() to undo qemu_init_vcpu() called by
  ppc_cpu_realize() in target/ppc/translate_init.c.inc
- the CPU init and teardown paths aren't really symmetrical

The latter didn't bite us so far but a future patch that greatly
simplifies the CPU core realize path needs it to avoid a crash
in QOM.

For all these reasons, have ppc_cpu_unrealize() to undo the changes
of ppc_cpu_realize() by calling cpu_remove_sync() at the right place,
and have the sPAPR CPU core code to call qdev_unrealize().

This requires to add a missing stub because translate_init.c.inc is
also compiled for user mode.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <160279671236.1808373.14732005038172874990.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'accel/tcg/user-exec-stub.c')
-rw-r--r--accel/tcg/user-exec-stub.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c
index f6d8c8fb6f..b876f5c1e4 100644
--- a/accel/tcg/user-exec-stub.c
+++ b/accel/tcg/user-exec-stub.c
@@ -9,6 +9,10 @@ void cpu_resume(CPUState *cpu)
 {
 }
 
+void cpu_remove_sync(CPUState *cpu)
+{
+}
+
 void qemu_init_vcpu(CPUState *cpu)
 {
 }