ppc: Add intc_destroy() handlers to SpaprInterruptController/PnvChip
commit0990ce6a2e900d0bdda7f3ecdc991746f63551fb
authorGreg Kurz <groug@kaod.org>
Thu, 24 Oct 2019 14:27:22 +0000 (24 16:27 +0200)
committerLaurent Vivier <lvivier@redhat.com>
Mon, 18 Nov 2019 10:49:11 +0000 (18 11:49 +0100)
tree38bc8fa17c3a2477949aabb8fc852c45795fe1e7
parent36609b4fa36f0ac934874371874416f7533a5408
ppc: Add intc_destroy() handlers to SpaprInterruptController/PnvChip

SpaprInterruptControllerClass and PnvChipClass have an intc_create() method
that calls the appropriate routine, ie. icp_create() or xive_tctx_create(),
to establish the link between the VCPU and the presenter component of the
interrupt controller during realize.

There aren't any symmetrical call to be called when the VCPU gets unrealized
though. It is assumed that object_unparent() is the only thing to do.

This is questionable because the parenting logic around the CPU and
presenter objects is really an implementation detail of the interrupt
controller. It shouldn't be open-coded in the machine code.

Fix this by adding an intc_destroy() method that undoes what was done in
intc_create(). Also NULLify the presenter pointers to avoid having
stale pointers around. This will allow to reliably check if a vCPU has
a valid presenter.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <157192724208.3146912.7254684777515287626.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
12 files changed:
hw/intc/spapr_xive.c
hw/intc/xics.c
hw/intc/xics_spapr.c
hw/intc/xive.c
hw/ppc/pnv.c
hw/ppc/pnv_core.c
hw/ppc/spapr_cpu_core.c
hw/ppc/spapr_irq.c
include/hw/ppc/pnv.h
include/hw/ppc/spapr_irq.h
include/hw/ppc/xics.h
include/hw/ppc/xive.h