diff options
author | Jon Medhurst <tixy@linaro.org> | 2013-06-17 10:15:08 +0100 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2013-06-17 10:22:09 +0100 |
commit | 53fcd9cf1019242216c14d11cbb33ad4a4dddc32 (patch) | |
tree | edd79911966d4f2030ecff88b97fe688b5c1cc4e | |
parent | 74376d7bb284085560852fd57f9fbd2bd4b22895 (diff) |
gator: Prevent BUG() when no device-tree cpu nodes present.tracking-gator-llct-20130617.1tracking-gator-llct-20130617.0
When IKS support is enabled in gator but we are running on boards
without a device-tree or where there are no cpu nodes in the
device-tree, then calc_first_cluster_size will call BUG_ON() because
mpidr_cpuids_count == 0.
To work around this, we will instead set a flag to indicate we haven't
managed to create an mpidr table and fallback to the behaviour we would
have if IKS wasn't enabled. This means that IKS support will only
function as expected if there are device-tree nodes for CPUs but we
expect that to always be the case anyway.
Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r-- | drivers/gator/gator_iks.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/gator/gator_iks.c b/drivers/gator/gator_iks.c index 6f45c548205..fa86a37e5d5 100644 --- a/drivers/gator/gator_iks.c +++ b/drivers/gator/gator_iks.c @@ -14,6 +14,7 @@ #include <asm/smp_plat.h> #include <trace/events/power_cpu_migrate.h> +static bool map_cpuids; static int mpidr_cpuids[NR_CPUS]; static int __lcpu_to_pcpu[NR_CPUS]; @@ -40,7 +41,7 @@ static void calc_first_cluster_size(void) ++mpidr_cpuids_count; } - BUG_ON(mpidr_cpuids_count != nr_cpu_ids); + map_cpuids = (mpidr_cpuids_count == nr_cpu_ids); } static int linearize_mpidr(int mpidr) @@ -58,6 +59,10 @@ static int linearize_mpidr(int mpidr) int lcpu_to_pcpu(const int lcpu) { int pcpu; + + if (!map_cpuids) + return lcpu; + BUG_ON(lcpu >= nr_cpu_ids || lcpu < 0); pcpu = __lcpu_to_pcpu[lcpu]; BUG_ON(pcpu >= nr_cpu_ids || pcpu < 0); @@ -67,6 +72,10 @@ int lcpu_to_pcpu(const int lcpu) int pcpu_to_lcpu(const int pcpu) { int lcpu; + + if (!map_cpuids) + return pcpu; + BUG_ON(pcpu >= nr_cpu_ids || pcpu < 0); for (lcpu = 0; lcpu < nr_cpu_ids; ++lcpu) { if (__lcpu_to_pcpu[lcpu] == pcpu) { @@ -114,6 +123,10 @@ GATOR_DEFINE_PROBE(cpu_migrate_current, TP_PROTO(u64 timestamp, u32 cpu_hwid)) static int gator_migrate_start(void) { int retval = 0; + + if (!map_cpuids) + return retval; + if (retval == 0) retval = GATOR_REGISTER_TRACE(cpu_migrate_begin); if (retval == 0) @@ -130,6 +143,9 @@ static int gator_migrate_start(void) static void gator_migrate_stop(void) { + if (!map_cpuids) + return; + GATOR_UNREGISTER_TRACE(cpu_migrate_current); GATOR_UNREGISTER_TRACE(cpu_migrate_finish); GATOR_UNREGISTER_TRACE(cpu_migrate_begin); |