From: Johnlay Park Date: Fri, 8 Jun 2018 14:45:20 +0000 (+0900) Subject: soc: samsung: cpupm: introduce virtual cluster info X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=eb3f5a233c35ce4ead33f304d3dc8463ca3492c3;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git soc: samsung: cpupm: introduce virtual cluster info to abstract the CPU topology Change-Id: I4e13b6a45059743ceab143ba95826a35670b5357 Signed-off-by: Johnlay Park --- diff --git a/drivers/soc/samsung/exynos-cpupm.c b/drivers/soc/samsung/exynos-cpupm.c index 3754df21b463..4c7e34024251 100644 --- a/drivers/soc/samsung/exynos-cpupm.c +++ b/drivers/soc/samsung/exynos-cpupm.c @@ -280,14 +280,17 @@ static void cpu_disable(unsigned int cpu) cal_cpu_disable(cpu); } -static void cluster_enable(unsigned int cluster_id) +static DEFINE_PER_CPU(int, vcluster_id); +static void cluster_enable(unsigned int cpu_id) { + unsigned int cluster_id = per_cpu(vcluster_id, cpu_id);; cal_cluster_enable(cluster_id); big_reset_control(1); } -static void cluster_disable(unsigned int cluster_id) +static void cluster_disable(unsigned int cpu_id) { + unsigned int cluster_id = per_cpu(vcluster_id, cpu_id); big_reset_control(0); cal_cluster_disable(cluster_id); } @@ -301,7 +304,7 @@ static int cpuhp_cpupm_online(unsigned int cpu) cpumask_and(&mask, cpu_coregroup_mask(cpu), cpu_online_mask); if (cpumask_weight(&mask) == 0) - cluster_enable(cpu_topology[cpu].cluster_id); + cluster_enable(cpu); cpu_enable(cpu); @@ -316,7 +319,7 @@ static int cpuhp_cpupm_offline(unsigned int cpu) cpumask_and(&mask, cpu_coregroup_mask(cpu), cpu_online_mask); if (cpumask_weight(&mask) == 0) - cluster_disable(cpu_topology[cpu].cluster_id); + cluster_disable(cpu); return 0; } @@ -599,7 +602,7 @@ static int try_to_enter_power_mode(int cpu, struct power_mode *mode) */ switch (mode->type) { case POWERMODE_TYPE_CLUSTER: - cluster_disable(cpu_topology[cpu].cluster_id); + cluster_disable(cpu); break; case POWERMODE_TYPE_SYSTEM: if (unlikely(exynos_system_idle_enter())) @@ -634,7 +637,7 @@ static void exit_mode(int cpu, struct power_mode *mode, int cancel) switch (mode->type) { case POWERMODE_TYPE_CLUSTER: - cluster_enable(cpu_topology[cpu].cluster_id); + cluster_enable(cpu); break; case POWERMODE_TYPE_SYSTEM: exynos_system_idle_exit(cancel); @@ -869,6 +872,32 @@ static int __init cpu_power_mode_init(void) if (attr_count) cpupm_sysfs_node_init(attr_count); + dn = of_find_node_by_path("/cpupm/vcpu_topology"); + if (dn){ + int i, cluster_cnt = 0; + of_property_read_u32(dn, "vcluster_cnt", &cluster_cnt); + + pr_info("%s:Virtual Cluster Info\n", __func__); + for (i = 0 ; i < cluster_cnt ; i++) { + int cpu; + char name[20]; + struct cpumask sibling; + snprintf(name, sizeof(name), "vcluster%d_sibling", i); + if (!of_property_read_string(dn, name, &buf)) { + cpulist_parse(buf, &sibling); + + pr_info("Cluster%d : ", i); + for_each_cpu(cpu, &sibling) { + per_cpu(vcluster_id, cpu) = i; + pr_info("%d ", cpu); + } + pr_info("\n"); + } + } + }else { + pr_info("No Virtual Cluster Info\n"); + } + return 0; }