summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Evans <matt.evans@arm.com>2014-05-09 18:58:46 -0400
committerMatt Evans <matt.evans@arm.com>2014-05-09 18:58:46 -0400
commit73dc89e54283e46cee17ca2ae41867aac05b95e9 (patch)
treecb42ee162ea9972961fdc7f7e9fb237d2d2a473b
parent636afeaa777f7b67deb4d977bc8d010c5b89faa3 (diff)
downloadgem5-73dc89e54283e46cee17ca2ae41867aac05b95e9.tar.xz
arm: quick hack to allow a greater number of CPUs to a guest OS
This is a quick hack to communicate a greater number of CPUs to a guest OS via the ARM A9 SCU config register. Some OSes (Linux) just look at the bottom field to count CPUs and with a small change can look at bits [3:0] to learn about up to 16 CPUs. Very much unsupported (and contains warning messages as such) but useful for running 8 core sims without hardwiring CPU count in the guest OS.
-rw-r--r--src/dev/arm/a9scu.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/dev/arm/a9scu.cc b/src/dev/arm/a9scu.cc
index efb27daf9..dc012a036 100644
--- a/src/dev/arm/a9scu.cc
+++ b/src/dev/arm/a9scu.cc
@@ -62,7 +62,16 @@ A9SCU::read(PacketPtr pkt)
pkt->set(1); // SCU already enabled
break;
case Config:
- assert(sys->numContexts() <= 4);
+ /* Without making a completely new SCU, we can use the core count field
+ * as 4 bits and inform the OS of up to 16 CPUs. Although the core
+ * count is technically bits [1:0] only, bits [3:2] are SBZ for future
+ * expansion like this.
+ */
+ if (sys->numContexts() > 4) {
+ warn_once("A9SCU with >4 CPUs is unsupported\n");
+ if (sys->numContexts() > 15)
+ fatal("Too many CPUs (%d) for A9SCU!\n", sys->numContexts());
+ }
int smp_bits, core_cnt;
smp_bits = power(2,sys->numContexts()) - 1;
core_cnt = sys->numContexts() - 1;