]> git.ipfire.org Git - thirdparty/qemu.git/commit
spapr: Make spapr_cpu_core_unrealize() idempotent
authorGreg Kurz <groug@kaod.org>
Thu, 15 Oct 2020 21:18:46 +0000 (23:18 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 27 Oct 2020 14:08:53 +0000 (01:08 +1100)
commit9370c28f12ca9336dd893e3b673a334c4938c58f
tree4defcdccdbab8c8920393635b33c804a67e22fd6
parent96598cdb14da4d48c68f178a7b5f8d47f5c638f4
spapr: Make spapr_cpu_core_unrealize() idempotent

spapr_cpu_core_realize() has a rollback path which partially duplicates
the code of spapr_cpu_core_unrealize().

Let's make spapr_cpu_core_unrealize() idempotent and call it instead. This
requires to:
- move the registration and unregistration of the reset handler around
  but it is harmless,
- allocate the array of vCPUs with g_new0() to be able to filter out
  unused slots,
- make sure to only unrealize vCPUs that have been already realized.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <160279672626.1808373.14142129300586424514.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_cpu_core.c