summaryrefslogtreecommitdiff
path: root/hw/intc
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2019-10-01 10:57:22 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2019-10-04 19:08:21 +1000
commit627fa61746f70f7c799f08e9048bb6a482402138 (patch)
treeb7e8d31fafe4b06e40d406d5a2efd3f4c7b85563 /hw/intc
parent428115c3a9d0f64e1b9189986dbba4be0548c4a5 (diff)
downloadqemu-627fa61746f70f7c799f08e9048bb6a482402138.zip
spapr/xive: skip partially initialized vCPUs in presenter
When vCPUs are hotplugged, they are added to the QEMU CPU list before being fully realized. This can crash the XIVE presenter because the 'tctx' pointer is not necessarily initialized when looking for a matching target. These vCPUs are not valid targets for the presenter. Skip them. Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20191001085722.32755-1-clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Greg Kurz <groug@kaod.org>
Diffstat (limited to 'hw/intc')
-rw-r--r--hw/intc/xive.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index b7417210d8..29df06df11 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -1397,6 +1397,14 @@ static bool xive_presenter_match(XiveRouter *xrtr, uint8_t format,
int ring;
/*
+ * Skip partially initialized vCPUs. This can happen when
+ * vCPUs are hotplugged.
+ */
+ if (!tctx) {
+ continue;
+ }
+
+ /*
* HW checks that the CPU is enabled in the Physical Thread
* Enable Register (PTER).
*/