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>
This commit is contained in:
Cédric Le Goater 2019-10-01 10:57:22 +02:00 committed by David Gibson
parent 428115c3a9
commit 627fa61746

View File

@ -1396,6 +1396,14 @@ static bool xive_presenter_match(XiveRouter *xrtr, uint8_t format,
XiveTCTX *tctx = xive_router_get_tctx(xrtr, cs); XiveTCTX *tctx = xive_router_get_tctx(xrtr, cs);
int ring; 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 * HW checks that the CPU is enabled in the Physical Thread
* Enable Register (PTER). * Enable Register (PTER).