diff options
author | Jon Medhurst <tixy@linaro.org> | 2013-10-10 16:48:56 +0100 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2013-10-11 12:43:21 +0100 |
commit | d369859ea66a29a79162f622a3816c4eb9024940 (patch) | |
tree | 1042c4c9f4b0e075267712fd2ee97a400c868840 /drivers/gator/gator_iks.c | |
parent | aaf37a3203b5ad30714cde34f4a6b40c3195eebf (diff) |
gator: Version 5.16
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Diffstat (limited to 'drivers/gator/gator_iks.c')
-rw-r--r-- | drivers/gator/gator_iks.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/drivers/gator/gator_iks.c b/drivers/gator/gator_iks.c index 932be26bfcf..24233d77558 100644 --- a/drivers/gator/gator_iks.c +++ b/drivers/gator/gator_iks.c @@ -14,18 +14,36 @@ #include <asm/smp_plat.h> #include <trace/events/power_cpu_migrate.h> +static bool map_cpuids; static int mpidr_cpuids[NR_CPUS]; +static const struct gator_cpu * mpidr_cpus[NR_CPUS]; static int __lcpu_to_pcpu[NR_CPUS]; +static const struct gator_cpu *gator_find_cpu_by_dt_name(const char *const name) +{ + int i; + + for (i = 0; gator_cpus[i].cpuid != 0; ++i) { + const struct gator_cpu *const gator_cpu = &gator_cpus[i]; + if (gator_cpu->dt_name != NULL && strcmp(gator_cpu->dt_name, name) == 0) { + return gator_cpu; + } + } + + return NULL; +} + static void calc_first_cluster_size(void) { int len; const u32 *val; + const char *compatible; struct device_node *cn = NULL; int mpidr_cpuids_count = 0; // Zero is a valid cpuid, so initialize the array to 0xff's memset(&mpidr_cpuids, 0xff, sizeof(mpidr_cpuids)); + memset(&mpidr_cpus, 0, sizeof(mpidr_cpus)); while ((cn = of_find_node_by_type(cn, "cpu"))) { BUG_ON(mpidr_cpuids_count >= NR_CPUS); @@ -35,12 +53,18 @@ static void calc_first_cluster_size(void) pr_err("%s missing reg property\n", cn->full_name); continue; } + compatible = of_get_property(cn, "compatible", NULL); + if (compatible == NULL) { + pr_err("%s missing compatible property\n", cn->full_name); + continue; + } mpidr_cpuids[mpidr_cpuids_count] = be32_to_cpup(val); + mpidr_cpus[mpidr_cpuids_count] = gator_find_cpu_by_dt_name(compatible); ++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 +82,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 +95,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) { @@ -111,9 +143,24 @@ GATOR_DEFINE_PROBE(cpu_migrate_current, TP_PROTO(u64 timestamp, u32 cpu_hwid)) gator_update_cpu_mapping(cpu_hwid); } +static void gator_send_iks_core_names(void) +{ + int cpu; + // Send the cpu names + for (cpu = 0; cpu < nr_cpu_ids; ++cpu) { + if (mpidr_cpus[cpu] != NULL) { + gator_send_core_name(cpu, mpidr_cpus[cpu]->cpuid, mpidr_cpus[cpu]); + } + } +} + 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 +177,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); @@ -138,6 +188,7 @@ static void gator_migrate_stop(void) #else #define calc_first_cluster_size() +#define gator_send_iks_core_names() #define gator_migrate_start() 0 #define gator_migrate_stop() |