Loading Documentation/devicetree/bindings/arm/cpus.txt +14 −0 Original line number Diff line number Diff line Loading @@ -210,6 +210,20 @@ nodes to be present and contain the properties described below. property identifying a 64-bit zero-initialised memory location. - efficiency Usage: optional. Value type: <u32> Definition: # Specifies the CPU efficiency. The CPU efficiency is a unit less number and it is intended to show relative performance of CPUs when normalized for clock frequency (instructions per cycle performance). The efficiency of a CPU can vary across SoCs depending on the cache size, bus interconnect frequencies etc. This value overrides the default efficiency value defined for the corresponding CPU architecture. - qcom,saw Usage: required for systems that have an "enable-method" property value of "qcom,kpss-acc-v1" or Loading arch/arm/kernel/topology.c +28 −6 Original line number Diff line number Diff line Loading @@ -190,6 +190,13 @@ static int __init parse_cluster(struct device_node *cluster, int depth) return 0; } static DEFINE_PER_CPU(unsigned long, cpu_efficiency) = SCHED_CAPACITY_SCALE; unsigned long arch_get_cpu_efficiency(int cpu) { return per_cpu(cpu_efficiency, cpu); } #ifdef CONFIG_OF struct cpu_efficiency { const char *compatible; Loading Loading @@ -266,6 +273,7 @@ static int __init parse_dt_topology(void) for_each_possible_cpu(cpu) { const u32 *rate; int len; u32 efficiency; /* too early to use cpu->of_node */ cn = of_get_cpu_node(cpu, NULL); Loading @@ -274,13 +282,27 @@ static int __init parse_dt_topology(void) continue; } for (cpu_eff = table_efficiency; cpu_eff->compatible; cpu_eff++) if (of_device_is_compatible(cn, cpu_eff->compatible)) /* * The CPU efficiency value passed from the device tree * overrides the value defined in the table_efficiency[] */ if (of_property_read_u32(cn, "efficiency", &efficiency) < 0) { for (cpu_eff = table_efficiency; cpu_eff->compatible; cpu_eff++) if (of_device_is_compatible(cn, cpu_eff->compatible)) break; if (cpu_eff->compatible == NULL) continue; efficiency = cpu_eff->efficiency; } per_cpu(cpu_efficiency, cpu) = efficiency; rate = of_get_property(cn, "clock-frequency", &len); if (!rate || len != 4) { pr_err("%s missing clock-frequency property\n", Loading @@ -288,7 +310,7 @@ static int __init parse_dt_topology(void) continue; } capacity = ((be32_to_cpup(rate)) >> 20) * cpu_eff->efficiency; capacity = ((be32_to_cpup(rate)) >> 20) * efficiency; /* Save min capacity of the system */ if (capacity < min_capacity) Loading arch/arm64/kernel/topology.c +22 −8 Original line number Diff line number Diff line Loading @@ -280,6 +280,7 @@ static void __init parse_dt_cpu_power(void) for_each_possible_cpu(cpu) { const u32 *rate; int len; u32 efficiency; /* Too early to use cpu->of_node */ cn = of_get_cpu_node(cpu, NULL); Loading @@ -288,16 +289,29 @@ static void __init parse_dt_cpu_power(void) continue; } for (cpu_eff = table_efficiency; cpu_eff->compatible; cpu_eff++) if (of_device_is_compatible(cn, cpu_eff->compatible)) /* * The CPU efficiency value passed from the device tree * overrides the value defined in the table_efficiency[] */ if (of_property_read_u32(cn, "efficiency", &efficiency) < 0) { for (cpu_eff = table_efficiency; cpu_eff->compatible; cpu_eff++) if (of_device_is_compatible(cn, cpu_eff->compatible)) break; if (cpu_eff->compatible == NULL) { pr_warn("%s: Unknown CPU type\n", cn->full_name); pr_warn("%s: Unknown CPU type\n", cn->full_name); continue; } per_cpu(cpu_efficiency, cpu) = cpu_eff->efficiency; efficiency = cpu_eff->efficiency; } per_cpu(cpu_efficiency, cpu) = efficiency; rate = of_get_property(cn, "clock-frequency", &len); if (!rate || len != 4) { Loading @@ -306,7 +320,7 @@ static void __init parse_dt_cpu_power(void) continue; } capacity = ((be32_to_cpup(rate)) >> 20) * cpu_eff->efficiency; capacity = ((be32_to_cpup(rate)) >> 20) * efficiency; /* Save min capacity of the system */ if (capacity < min_capacity) Loading Loading
Documentation/devicetree/bindings/arm/cpus.txt +14 −0 Original line number Diff line number Diff line Loading @@ -210,6 +210,20 @@ nodes to be present and contain the properties described below. property identifying a 64-bit zero-initialised memory location. - efficiency Usage: optional. Value type: <u32> Definition: # Specifies the CPU efficiency. The CPU efficiency is a unit less number and it is intended to show relative performance of CPUs when normalized for clock frequency (instructions per cycle performance). The efficiency of a CPU can vary across SoCs depending on the cache size, bus interconnect frequencies etc. This value overrides the default efficiency value defined for the corresponding CPU architecture. - qcom,saw Usage: required for systems that have an "enable-method" property value of "qcom,kpss-acc-v1" or Loading
arch/arm/kernel/topology.c +28 −6 Original line number Diff line number Diff line Loading @@ -190,6 +190,13 @@ static int __init parse_cluster(struct device_node *cluster, int depth) return 0; } static DEFINE_PER_CPU(unsigned long, cpu_efficiency) = SCHED_CAPACITY_SCALE; unsigned long arch_get_cpu_efficiency(int cpu) { return per_cpu(cpu_efficiency, cpu); } #ifdef CONFIG_OF struct cpu_efficiency { const char *compatible; Loading Loading @@ -266,6 +273,7 @@ static int __init parse_dt_topology(void) for_each_possible_cpu(cpu) { const u32 *rate; int len; u32 efficiency; /* too early to use cpu->of_node */ cn = of_get_cpu_node(cpu, NULL); Loading @@ -274,13 +282,27 @@ static int __init parse_dt_topology(void) continue; } for (cpu_eff = table_efficiency; cpu_eff->compatible; cpu_eff++) if (of_device_is_compatible(cn, cpu_eff->compatible)) /* * The CPU efficiency value passed from the device tree * overrides the value defined in the table_efficiency[] */ if (of_property_read_u32(cn, "efficiency", &efficiency) < 0) { for (cpu_eff = table_efficiency; cpu_eff->compatible; cpu_eff++) if (of_device_is_compatible(cn, cpu_eff->compatible)) break; if (cpu_eff->compatible == NULL) continue; efficiency = cpu_eff->efficiency; } per_cpu(cpu_efficiency, cpu) = efficiency; rate = of_get_property(cn, "clock-frequency", &len); if (!rate || len != 4) { pr_err("%s missing clock-frequency property\n", Loading @@ -288,7 +310,7 @@ static int __init parse_dt_topology(void) continue; } capacity = ((be32_to_cpup(rate)) >> 20) * cpu_eff->efficiency; capacity = ((be32_to_cpup(rate)) >> 20) * efficiency; /* Save min capacity of the system */ if (capacity < min_capacity) Loading
arch/arm64/kernel/topology.c +22 −8 Original line number Diff line number Diff line Loading @@ -280,6 +280,7 @@ static void __init parse_dt_cpu_power(void) for_each_possible_cpu(cpu) { const u32 *rate; int len; u32 efficiency; /* Too early to use cpu->of_node */ cn = of_get_cpu_node(cpu, NULL); Loading @@ -288,16 +289,29 @@ static void __init parse_dt_cpu_power(void) continue; } for (cpu_eff = table_efficiency; cpu_eff->compatible; cpu_eff++) if (of_device_is_compatible(cn, cpu_eff->compatible)) /* * The CPU efficiency value passed from the device tree * overrides the value defined in the table_efficiency[] */ if (of_property_read_u32(cn, "efficiency", &efficiency) < 0) { for (cpu_eff = table_efficiency; cpu_eff->compatible; cpu_eff++) if (of_device_is_compatible(cn, cpu_eff->compatible)) break; if (cpu_eff->compatible == NULL) { pr_warn("%s: Unknown CPU type\n", cn->full_name); pr_warn("%s: Unknown CPU type\n", cn->full_name); continue; } per_cpu(cpu_efficiency, cpu) = cpu_eff->efficiency; efficiency = cpu_eff->efficiency; } per_cpu(cpu_efficiency, cpu) = efficiency; rate = of_get_property(cn, "clock-frequency", &len); if (!rate || len != 4) { Loading @@ -306,7 +320,7 @@ static void __init parse_dt_cpu_power(void) continue; } capacity = ((be32_to_cpup(rate)) >> 20) * cpu_eff->efficiency; capacity = ((be32_to_cpup(rate)) >> 20) * efficiency; /* Save min capacity of the system */ if (capacity < min_capacity) Loading