[PowerPC64] Fix xive order calculation in qemu TCG

When emulating a single thread system for testing reasons, mp_maxid can
be 0. This trips up our math for calculating the order.

Account for this to fix xive attachment when emulating a single-thread
core on qemu powernv (a configuration that doesn't exist in the real world.)

Sponsored by:	Tag1 Consulting, Inc.
This commit is contained in:
Brandon Bergren 2020-09-08 23:48:49 +00:00
parent 67a659d282
commit 6957645145
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365487

View File

@ -341,7 +341,11 @@ xive_attach(device_t dev)
mtx_init(&sc->sc_mtx, "XIVE", NULL, MTX_DEF);
order = fls(mp_maxid + (mp_maxid - 1)) - 1;
/* Workaround for qemu single-thread powernv */
if (mp_maxid == 0)
order = 1;
else
order = fls(mp_maxid + (mp_maxid - 1)) - 1;
do {
vp_block = opal_call(OPAL_XIVE_ALLOCATE_VP_BLOCK, order);