14
14
#include <linux/completion.h>
15
15
#include <linux/kobject.h>
16
16
#include <linux/notifier.h>
17
+ #include <linux/of.h>
18
+ #include <linux/of_device.h>
17
19
#include <linux/pm_opp.h>
18
20
#include <linux/pm_qos.h>
19
21
#include <linux/spinlock.h>
@@ -1003,6 +1005,55 @@ static inline int cpufreq_table_count_valid_entries(const struct cpufreq_policy
1003
1005
1004
1006
return count ;
1005
1007
}
1008
+
1009
+ static inline int parse_perf_domain (int cpu , const char * list_name ,
1010
+ const char * cell_name )
1011
+ {
1012
+ struct device_node * cpu_np ;
1013
+ struct of_phandle_args args ;
1014
+ int ret ;
1015
+
1016
+ cpu_np = of_cpu_device_node_get (cpu );
1017
+ if (!cpu_np )
1018
+ return - ENODEV ;
1019
+
1020
+ ret = of_parse_phandle_with_args (cpu_np , list_name , cell_name , 0 ,
1021
+ & args );
1022
+ if (ret < 0 )
1023
+ return ret ;
1024
+
1025
+ of_node_put (cpu_np );
1026
+
1027
+ return args .args [0 ];
1028
+ }
1029
+
1030
+ static inline int of_perf_domain_get_sharing_cpumask (int pcpu , const char * list_name ,
1031
+ const char * cell_name , struct cpumask * cpumask )
1032
+ {
1033
+ int target_idx ;
1034
+ int cpu , ret ;
1035
+
1036
+ ret = parse_perf_domain (pcpu , list_name , cell_name );
1037
+ if (ret < 0 )
1038
+ return ret ;
1039
+
1040
+ target_idx = ret ;
1041
+ cpumask_set_cpu (pcpu , cpumask );
1042
+
1043
+ for_each_possible_cpu (cpu ) {
1044
+ if (cpu == pcpu )
1045
+ continue ;
1046
+
1047
+ ret = parse_perf_domain (pcpu , list_name , cell_name );
1048
+ if (ret < 0 )
1049
+ continue ;
1050
+
1051
+ if (target_idx == ret )
1052
+ cpumask_set_cpu (cpu , cpumask );
1053
+ }
1054
+
1055
+ return target_idx ;
1056
+ }
1006
1057
#else
1007
1058
static inline int cpufreq_boost_trigger_state (int state )
1008
1059
{
@@ -1022,6 +1073,12 @@ static inline bool policy_has_boost_freq(struct cpufreq_policy *policy)
1022
1073
{
1023
1074
return false;
1024
1075
}
1076
+
1077
+ static inline int of_perf_domain_get_sharing_cpumask (int pcpu , const char * list_name ,
1078
+ const char * cell_name , struct cpumask * cpumask )
1079
+ {
1080
+ return - EOPNOTSUPP ;
1081
+ }
1025
1082
#endif
1026
1083
1027
1084
#if defined(CONFIG_ENERGY_MODEL ) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL )
@@ -1043,7 +1100,6 @@ void arch_set_freq_scale(const struct cpumask *cpus,
1043
1100
{
1044
1101
}
1045
1102
#endif
1046
-
1047
1103
/* the following are really really optional */
1048
1104
extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs ;
1049
1105
extern struct freq_attr cpufreq_freq_attr_scaling_boost_freqs ;
0 commit comments