Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2018 16:29:10 +0000 (UTC)
From:      Ruslan Bukin <br@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r337771 - head/sys/mips/malta
Message-ID:  <201808141629.w7EGTA23082488@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: br
Date: Tue Aug 14 16:29:10 2018
New Revision: 337771
URL: https://svnweb.freebsd.org/changeset/base/337771

Log:
  Query MVPConf0.PVPE for number of CPUs.
  
  Rather than hard-coding the number of CPUs to 2, look up the PVPE field
  in MVPConf0, as the valid VPE numbers are from 0 to PVPE inclusive.
  
  Submitted by:	"James Clarke" <jrtc4@cam.ac.uk>
  Reviewed by:	br
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D16644

Modified:
  head/sys/mips/malta/malta_mp.c

Modified: head/sys/mips/malta/malta_mp.c
==============================================================================
--- head/sys/mips/malta/malta_mp.c	Tue Aug 14 16:27:17 2018	(r337770)
+++ head/sys/mips/malta/malta_mp.c	Tue Aug 14 16:29:10 2018	(r337771)
@@ -48,9 +48,10 @@ __FBSDID("$FreeBSD$");
 #include <machine/md_var.h>
 #include <machine/smp.h>
 
-#define	MALTA_MAXCPU	2
 #define	VPECONF0_VPA	(1 << 0)
 #define	MVPCONTROL_VPC	(1 << 1)
+#define	MVPCONF0_PVPE_SHIFT	10
+#define	MVPCONF0_PVPE_MASK	(0xf << MVPCONF0_PVPE_SHIFT)
 #define	TCSTATUS_A	(1 << 13)
 
 unsigned malta_ap_boot = ~0;
@@ -208,10 +209,13 @@ platform_init_ap(int cpuid)
 void
 platform_cpu_mask(cpuset_t *mask)
 {
-	uint32_t i, m;
+	uint32_t i, ncpus, reg;
 
+	reg = mftc0(0, 2);
+	ncpus = ((reg & MVPCONF0_PVPE_MASK) >> MVPCONF0_PVPE_SHIFT) + 1;
+
 	CPU_ZERO(mask);
-	for (i = 0, m = 1 ; i < MALTA_MAXCPU; i++, m <<= 1)
+	for (i = 0; i < ncpus; i++)
 		CPU_SET(i, mask);
 }
 



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