]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
spapr/xive: skip partially initialized vCPUs in presenter
authorCédric Le Goater <clg@kaod.org>
Tue, 1 Oct 2019 08:57:22 +0000 (10:57 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Fri, 4 Oct 2019 09:08:21 +0000 (19:08 +1000)
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>
hw/intc/xive.c

index b7417210d81796a17632368d68946d34558926ab..29df06df1136de0022f1c8c4b12da6ff8d4256ab 100644 (file)
@@ -1396,6 +1396,14 @@ static bool xive_presenter_match(XiveRouter *xrtr, uint8_t format,
         XiveTCTX *tctx = xive_router_get_tctx(xrtr, cs);
         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).