aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Randhawa <robin.randhawa@arm.com>2015-06-09 15:10:00 +0100
committerVincent Guittot <vincent.guittot@linaro.org>2015-07-31 16:25:26 +0200
commit0fe346689bdfd52b330cf0359167208592b7ebcc (patch)
tree6116b15da5c8ccc051d88afdc5a82519b14db2ea
parentdc347111988fbeb572abe79c32e37f0b69ffdae4 (diff)
WIP: arm64, topology: Updates to use DT bindings for EAS costing data
With the bindings and the associated accessors to extract data from the bindings in place, remove the static hard-coded data from topology.c and use the accesors instead. Change-Id: Id2e68b26a5a7b33ec0b3dba8779bf1a2451c4abe Signed-off-by: Robin Randhawa <robin.randhawa@arm.com>
-rw-r--r--arch/arm64/kernel/topology.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c
index 2c558e7dc7c6..510b7f180d15 100644
--- a/arch/arm64/kernel/topology.c
+++ b/arch/arm64/kernel/topology.c
@@ -19,6 +19,8 @@
#include <linux/nodemask.h>
#include <linux/of.h>
#include <linux/sched.h>
+#include <linux/sched.h>
+#include <linux/sched_energy.h>
#include <asm/cputype.h>
#include <asm/topology.h>
@@ -235,9 +237,29 @@ unsigned long arm_arch_scale_freq_capacity(struct sched_domain *sd, int cpu)
struct cpu_topology cpu_topology[NR_CPUS];
EXPORT_SYMBOL_GPL(cpu_topology);
+/* sd energy functions */
+static inline const struct sched_group_energy *cpu_cluster_energy(int cpu)
+{
+ struct sched_group_energy *sge = sge_array[cpu][SD_LEVEL1];
+
+ if (!sge) {
+ pr_warn("Invalid sched_group_energy for Cluster%d\n", cpu);
+ return NULL;
+ }
+
+ return sge;
+}
+
static inline const struct sched_group_energy *cpu_core_energy(int cpu)
{
- return NULL;
+ struct sched_group_energy *sge = sge_array[cpu][SD_LEVEL0];
+
+ if (!sge) {
+ pr_warn("Invalid sched_group_energy for CPU%d\n", cpu);
+ return NULL;
+ }
+
+ return sge;
}
const struct cpumask *cpu_coregroup_mask(int cpu)
@@ -245,6 +267,20 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
return &cpu_topology[cpu].core_sibling;
}
+static inline int cpu_corepower_flags(void)
+{
+ return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN | \
+ SD_SHARE_CAP_STATES;
+}
+
+static struct sched_domain_topology_level arm64_topology[] = {
+#ifdef CONFIG_SCHED_MC
+ { cpu_coregroup_mask, cpu_corepower_flags, cpu_core_energy, SD_INIT_NAME(MC) },
+#endif
+ { cpu_cpu_mask, 0, cpu_cluster_energy, SD_INIT_NAME(DIE) },
+ { NULL, },
+};
+
static void update_cpu_capacity(unsigned int cpu)
{
unsigned long capacity;
@@ -362,6 +398,10 @@ void __init init_cpu_topology(void)
*/
if (parse_dt_topology())
reset_cpu_topology();
+ else
+ set_sched_topology(arm64_topology);
reset_cpu_capacity();
+
+ init_sched_energy_costs();
}