Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Sep 2020 23:48:50 +0000 (UTC)
From:      Brandon Bergren <bdragon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r365487 - head/sys/powerpc/powernv
Message-ID:  <202009082348.088Nmo7r077523@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009082348.088Nmo7r077523>