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.
This commit is contained in:
Matt Evans 2014-05-09 18:58:46 -04:00
parent 636afeaa77
commit 73dc89e542

View file

@ -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;