Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 411c04e5 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge changes Icf6bf600,I7f0fc3be,Idda1a5f8,I51af46e0 into msm-4.14

* changes:
  sched: Use efficiency values from device tree
  ANDROID: Move energy model init call into arch_topology driver
  ANDROID: Streamline sched_domain_energy_f functions
  ANDROID: Separate cpu_scale and energy model setup
parents 651d4e6f 298ae469
Loading
Loading
Loading
Loading
+5 −48
Original line number Diff line number Diff line
@@ -31,41 +31,16 @@
#include <asm/cputype.h>
#include <asm/topology.h>

/* sd energy functions */
static inline
const struct sched_group_energy * const cpu_core_energy(int cpu)
{
	struct sched_group_energy *sge = sge_array[cpu][SD_LEVEL0];
	unsigned long capacity;
	int max_cap_idx;

	if (sched_is_energy_aware() && !sge) {
		pr_warn("Invalid sched_group_energy for CPU%d\n", cpu);
		return NULL;
	}

	max_cap_idx = sge->nr_cap_states - 1;
	capacity = sge->cap_states[max_cap_idx].cap;

	printk_deferred("cpu=%d set cpu scale %lu from energy model\n",
			cpu, capacity);

	topology_set_cpu_scale(cpu, capacity);

	return sge;
	return sge_array[cpu][SD_LEVEL0];
}

static inline
const struct sched_group_energy * const cpu_cluster_energy(int cpu)
{
	struct sched_group_energy *sge = sge_array[cpu][SD_LEVEL1];

	if (sched_is_energy_aware() && !sge) {
		pr_warn("Invalid sched_group_energy for Cluster%d\n", cpu);
		return NULL;
	}

	return sge;
	return sge_array[cpu][SD_LEVEL1];
}

/*
@@ -207,26 +182,10 @@ static void __init parse_dt_topology(void)
 */
static void update_cpu_capacity(unsigned int cpu)
{
	const struct sched_group_energy *sge;
	unsigned long capacity;

	sge = cpu_core_energy(cpu);

	if (sge) {
		int max_cap_idx;

		max_cap_idx = sge->nr_cap_states - 1;
		capacity = sge->cap_states[max_cap_idx].cap;

		printk_deferred("cpu=%d set cpu scale %lu from energy model\n",
				cpu, capacity);
	} else {
	if (!cpu_capacity(cpu) || cap_from_dt)
		return;
		capacity = cpu_capacity(cpu) / middle_capacity;
	}

	topology_set_cpu_scale(cpu, capacity);
	topology_set_cpu_scale(cpu, cpu_capacity(cpu) / middle_capacity);

	pr_info("CPU%u: update cpu_capacity %lu\n",
		cpu, topology_get_cpu_scale(NULL, cpu));
@@ -390,6 +349,4 @@ void __init init_cpu_topology(void)

	/* Set scheduler topology descriptor */
	set_sched_topology(arm_topology);

	init_sched_energy_costs();
}
+3 −36
Original line number Diff line number Diff line
@@ -188,8 +188,6 @@ static int __init parse_dt_topology(void)
	if (!map)
		goto out;

	init_sched_energy_costs();

	ret = parse_cluster(map, 0);
	if (ret != 0)
		goto out_map;
@@ -308,50 +306,19 @@ static int cpu_flags(void)
static inline
const struct sched_group_energy * const cpu_core_energy(int cpu)
{
	struct sched_group_energy *sge = sge_array[cpu][SD_LEVEL0];
	unsigned long capacity;
	int max_cap_idx;

	if (sched_is_energy_aware() && !sge) {
		pr_warn("Invalid sched_group_energy for CPU%d\n", cpu);
		return NULL;
	}

	max_cap_idx = sge->nr_cap_states - 1;
	capacity = sge->cap_states[max_cap_idx].cap;

	printk_deferred("cpu=%d set cpu scale %lu from energy model\n",
			cpu, capacity);

	topology_set_cpu_scale(cpu, capacity);

	return sge;
	return sge_array[cpu][SD_LEVEL0];
}

static inline
const struct sched_group_energy * const cpu_cluster_energy(int cpu)
{
	struct sched_group_energy *sge = sge_array[cpu][SD_LEVEL1];

	if (sched_is_energy_aware() && !sge) {
		pr_warn("Invalid sched_group_energy for Cluster%d\n", cpu);
		return NULL;
	}

	return sge;
	return sge_array[cpu][SD_LEVEL1];
}

static inline
const struct sched_group_energy * const cpu_system_energy(int cpu)
{
	struct sched_group_energy *sge = sge_array[cpu][SD_LEVEL2];

	if (sched_is_energy_aware() && !sge) {
		pr_warn("Invalid sched_group_energy for System%d\n", cpu);
		return NULL;
	}

	return sge;
	return sge_array[cpu][SD_LEVEL2];
}

static void update_cpu_capacity(unsigned int cpu)
+5 −11
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <linux/sched_energy.h>

DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE;
DEFINE_PER_CPU(unsigned long, efficiency) = SCHED_CAPACITY_SCALE;

void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
			 unsigned long max_freq)
@@ -73,10 +74,6 @@ static ssize_t cpu_capacity_store(struct device *dev,
	if (!count)
		return 0;

	/* don't allow changes if sched-group-energy is installed */
	if(sched_energy_installed(this_cpu))
		return -EINVAL;

	ret = kstrtoul(buf, 0, &new_capacity);
	if (ret)
		return ret;
@@ -357,20 +354,16 @@ void topology_normalize_cpu_scale(void)
bool __init topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu)
{
	static bool cap_parsing_failed;
	int ret = 0;
	int ret;
	u32 cpu_capacity;

	if (cap_parsing_failed)
		return false;

	/* override capacity-dmips-mhz if we have sched-energy-costs */
	if (of_find_property(cpu_node, "sched-energy-costs", NULL))
		cpu_capacity = topology_get_cpu_scale(NULL, cpu);
	else
	ret = of_property_read_u32(cpu_node, "capacity-dmips-mhz",
				   &cpu_capacity);

	if (!ret) {
		per_cpu(efficiency, cpu) = cpu_capacity;
		if (!raw_capacity) {
			raw_capacity = kcalloc(num_possible_cpus(),
					       sizeof(*raw_capacity),
@@ -431,6 +424,7 @@ init_cpu_capacity_callback(struct notifier_block *nb,

	if (cpumask_empty(cpus_to_visit)) {
		topology_normalize_cpu_scale();
		init_sched_energy_costs();
		if (topology_detect_flags())
			schedule_work(&update_topology_flags_work);
		free_raw_capacity();
+7 −0
Original line number Diff line number Diff line
@@ -29,6 +29,13 @@ unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu)

void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity);

DECLARE_PER_CPU(unsigned long, efficiency);
static inline
unsigned long topology_get_cpu_efficiency(int cpu)
{
	return per_cpu(efficiency, cpu);
}

DECLARE_PER_CPU(unsigned long, freq_scale);

static inline
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ extern struct sched_group_energy *sge_array[NR_CPUS][NR_SD_LEVELS];

#ifdef CONFIG_GENERIC_ARCH_TOPOLOGY
void init_sched_energy_costs(void);
int sched_energy_installed(int cpu);
#else
void init_sched_energy_costs(void) {}
#endif
Loading