Author: bdragon
Date: Tue Sep  8 23:48:49 2020
New Revision: 365487
URL: https://svnweb.freebsd.org/changeset/base/365487

Log:
  [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.

Modified:
  head/sys/powerpc/powernv/xive.c

Modified: head/sys/powerpc/powernv/xive.c
==============================================================================
--- head/sys/powerpc/powernv/xive.c     Tue Sep  8 23:48:19 2020        
(r365486)
+++ head/sys/powerpc/powernv/xive.c     Tue Sep  8 23:48:49 2020        
(r365487)
@@ -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);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to