From 73dc89e54283e46cee17ca2ae41867aac05b95e9 Mon Sep 17 00:00:00 2001 From: Matt Evans Date: Fri, 9 May 2014 18:58:46 -0400 Subject: [PATCH] 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. --- src/dev/arm/a9scu.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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;