diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index 49f75799e090..790eeb009608 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -610,6 +610,16 @@ config QTI_PLH This interface is responsible for handling the communication with RIMPS PLH such as passing tunables, enable and disable. +config MSM_PERFORMANCE_QGKI + bool "Enable QGKI features" + depends on QGKI + help + This option enables full functionality of MSM_PERFORMANCE for + QGKI flavor. This is not defined in GKI builds wherein the driver + offers minimal functionality of changing the min and max frequency + of a given cluster. The user space can request the cpu freq change + by writing cpu#:freq values + config QMP_DEBUGFS_CLIENT bool "Debugfs Client to communicate with AOP using QMP protocol" depends on DEBUG_FS diff --git a/drivers/soc/qcom/msm_performance.c b/drivers/soc/qcom/msm_performance.c index d9c5047f2e4c..57aa185ac6e4 100644 --- a/drivers/soc/qcom/msm_performance.c +++ b/drivers/soc/qcom/msm_performance.c @@ -27,21 +27,20 @@ #include #include -/* - * Sched will provide the data for every 20ms window, - * will collect the data for 15 windows(300ms) and then update - * sysfs nodes with aggregated data - */ #define POLL_INT 25 #define NODE_NAME_MAX_CHARS 16 + #define QUEUE_POOL_SIZE 512 /*2^8 always keep in 2^x */ #define INST_EV 0x08 /* 0th event*/ #define CYC_EV 0x11 /* 1st event*/ #define INIT "Init" #define CPU_CYCLE_THRESHOLD 650000 + +#ifdef CONFIG_MSM_PERFORMANCE_QGKI static DEFINE_PER_CPU(bool, cpu_is_idle); static DEFINE_PER_CPU(bool, cpu_is_hp); static DEFINE_MUTEX(perfevent_lock); +#endif enum event_idx { INST_EVENT, @@ -64,6 +63,11 @@ struct cpu_status { static DEFINE_PER_CPU(struct cpu_status, msm_perf_cpu_stats); static DEFINE_PER_CPU(struct freq_qos_request, qos_req_min); static DEFINE_PER_CPU(struct freq_qos_request, qos_req_max); + +static cpumask_var_t limit_mask_min; +static cpumask_var_t limit_mask_max; + +#ifdef CONFIG_MSM_PERFORMANCE_QGKI static DECLARE_COMPLETION(gfx_evt_arrival); struct gpu_data { @@ -104,12 +108,8 @@ static unsigned int aggr_top_load; static unsigned int top_load[CLUSTER_MAX]; static unsigned int curr_cap[CLUSTER_MAX]; static bool max_cap_cpus[NR_CPUS]; - -static cpumask_var_t limit_mask_min; -static cpumask_var_t limit_mask_max; - static atomic_t game_status_pid; - +#endif static bool ready_for_freq_updates; static int freq_qos_request_init(void) @@ -345,7 +345,7 @@ static const struct kernel_param_ops param_ops_cpu_max_freq = { .get = get_cpu_max_freq, }; module_param_cb(cpu_max_freq, ¶m_ops_cpu_max_freq, NULL, 0644); - +#ifdef CONFIG_MSM_PERFORMANCE_QGKI static struct kobject *events_kobj; static ssize_t show_cpu_hotplug(struct kobject *kobj, @@ -925,6 +925,7 @@ static const struct kernel_param_ops param_ops_game_start_pid = { .get = get_game_start_pid, }; module_param_cb(evnt_gplaf_pid, ¶m_ops_game_start_pid, NULL, 0644); +#endif /* CONFIG_MSM_PERFORMANCE_QGKI */ /*******************************GFX Call************************************/ #ifdef CONFIG_QTI_PLH @@ -1119,12 +1120,12 @@ static const struct kernel_param_ops param_ops_splh_notification = { module_param_cb(splh_notif, ¶m_ops_splh_notification, &splh_notif, 0644); #endif /* CONFIG_QTI_PLH */ - static int __init msm_performance_init(void) { +#ifdef CONFIG_MSM_PERFORMANCE_QGKI unsigned int cpu; int ret; - +#endif if (!alloc_cpumask_var(&limit_mask_min, GFP_KERNEL)) return -ENOMEM; @@ -1132,7 +1133,7 @@ static int __init msm_performance_init(void) free_cpumask_var(limit_mask_min); return -ENOMEM; } - +#ifdef CONFIG_MSM_PERFORMANCE_QGKI get_online_cpus(); for_each_possible_cpu(cpu) { if (!cpumask_test_cpu(cpu, cpu_online_mask)) @@ -1151,6 +1152,8 @@ static int __init msm_performance_init(void) init_pmu_counter(); idle_notifier_register(&msm_perf_event_idle_nb); +#endif return 0; } +MODULE_LICENSE("GPL v2"); late_initcall(msm_performance_init); diff --git a/include/soc/qcom/msm_performance.h b/include/soc/qcom/msm_performance.h index abf70aeda4a7..455d2c2b0af8 100644 --- a/include/soc/qcom/msm_performance.h +++ b/include/soc/qcom/msm_performance.h @@ -17,7 +17,7 @@ enum evt_update_t { MSM_PERF_GFX, }; -#ifdef CONFIG_MSM_PERFORMANCE +#if IS_ENABLED(CONFIG_MSM_PERFORMANCE) && IS_ENABLED(CONFIG_MSM_PERFORMANCE_QGKI) void msm_perf_events_update(enum evt_update_t update_typ, enum gfx_evt_t evt_typ, pid_t pid, uint32_t ctx_id, uint32_t timestamp);