diff options
author | ian <ian@FreeBSD.org> | 2014-03-02 19:46:03 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2014-03-02 19:46:03 +0000 |
commit | 1aa753817ed982a7b689f1ae3f2d4c479f81bc7d (patch) | |
tree | ea896fc983cad8d23b69e230e6eeff10a6461c55 /sys/arm | |
parent | 934db1dbcfd42a2700f1f20bfda1923aa8d5d5a8 (diff) | |
download | FreeBSD-src-1aa753817ed982a7b689f1ae3f2d4c479f81bc7d.zip FreeBSD-src-1aa753817ed982a7b689f1ae3f2d4c479f81bc7d.tar.gz |
Add a tunable to set the number of active cores, and enable SMP by default.
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/conf/IMX6 | 2 | ||||
-rw-r--r-- | sys/arm/freescale/imx/imx6_mp.c | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/sys/arm/conf/IMX6 b/sys/arm/conf/IMX6 index 8d418e5..1e08e1f 100644 --- a/sys/arm/conf/IMX6 +++ b/sys/arm/conf/IMX6 @@ -143,7 +143,7 @@ options ROOTDEVNAME=\"ufs:mmcsd0s2a\" # ARM and SoC-specific options options FDT # Configure using FDT/DTB data. -#options SMP # Enable multiple cores +options SMP # Enable multiple cores options VFP # Enable floating point hardware support options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8) diff --git a/sys/arm/freescale/imx/imx6_mp.c b/sys/arm/freescale/imx/imx6_mp.c index 5b5136b..dfa435b 100644 --- a/sys/arm/freescale/imx/imx6_mp.c +++ b/sys/arm/freescale/imx/imx6_mp.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> +#include <sys/kernel.h> #include <sys/lock.h> #include <sys/mutex.h> #include <sys/smp.h> @@ -72,6 +73,7 @@ void platform_mp_setmaxid(void) { bus_space_handle_t scu; + int hwcpu, ncpu; uint32_t val; /* If we've already set the global vars don't bother to do it again. */ @@ -81,10 +83,16 @@ platform_mp_setmaxid(void) if (bus_space_map(fdtbus_bs_tag, SCU_PHYSBASE, SCU_SIZE, 0, &scu) != 0) panic("Couldn't map the SCU\n"); val = bus_space_read_4(fdtbus_bs_tag, scu, SCU_CONFIG_REG); + hwcpu = (val & SCU_CONFIG_REG_NCPU_MASK) + 1; bus_space_unmap(fdtbus_bs_tag, scu, SCU_SIZE); - mp_maxid = (val & SCU_CONFIG_REG_NCPU_MASK); - mp_ncpus = mp_maxid + 1; + ncpu = hwcpu; + TUNABLE_INT_FETCH("hw.ncpu", &ncpu); + if (ncpu < 1 || ncpu > hwcpu) + ncpu = hwcpu; + + mp_ncpus = ncpu; + mp_maxid = ncpu - 1; } int |