All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] cpufreq: powernv: Adding fast_switch for schedutil
@ 2016-11-07  7:39 Akshay Adiga
  2016-11-07  7:39 ` [PATCH v2 2/2] cpufreq: powernv: Use PMCR to verify global and local pstate Akshay Adiga
  2016-11-07  9:12 ` [PATCH v2 1/2] cpufreq: powernv: Adding fast_switch for schedutil Viresh Kumar
  0 siblings, 2 replies; 5+ messages in thread
From: Akshay Adiga @ 2016-11-07  7:39 UTC (permalink / raw)
  To: rjw, ego, shilpa.bhat, viresh.kumar, linux-pm, linux-kernel,
	linuxppc-dev
  Cc: Akshay Adiga

Adding fast_switch which does light weight operation to set the desired
pstate. Both global and local pstates are set to the same desired pstate.

Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
---
Changes from v1 :
- Removed unnecessary check for index out of bound.

 drivers/cpufreq/powernv-cpufreq.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
index d3ffde8..4a4380d 100644
--- a/drivers/cpufreq/powernv-cpufreq.c
+++ b/drivers/cpufreq/powernv-cpufreq.c
@@ -752,9 +752,12 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	spin_lock_init(&gpstates->gpstate_lock);
 	ret = cpufreq_table_validate_and_show(policy, powernv_freqs);
 
-	if (ret < 0)
+	if (ret < 0) {
 		kfree(policy->driver_data);
+		return ret;
+	}
 
+	policy->fast_switch_possible = true;
 	return ret;
 }
 
@@ -897,6 +900,20 @@ static void powernv_cpufreq_stop_cpu(struct cpufreq_policy *policy)
 	del_timer_sync(&gpstates->timer);
 }
 
+static unsigned int powernv_fast_switch(struct cpufreq_policy *policy,
+					unsigned int target_freq)
+{
+	int index;
+	struct powernv_smp_call_data freq_data;
+
+	index = cpufreq_table_find_index_dl(policy, target_freq);
+	freq_data.pstate_id = powernv_freqs[index].driver_data;
+	freq_data.gpstate_id = powernv_freqs[index].driver_data;
+	set_pstate(&freq_data);
+
+	return powernv_freqs[index].frequency;
+}
+
 static struct cpufreq_driver powernv_cpufreq_driver = {
 	.name		= "powernv-cpufreq",
 	.flags		= CPUFREQ_CONST_LOOPS,
@@ -904,6 +921,7 @@ static struct cpufreq_driver powernv_cpufreq_driver = {
 	.exit		= powernv_cpufreq_cpu_exit,
 	.verify		= cpufreq_generic_frequency_table_verify,
 	.target_index	= powernv_cpufreq_target_index,
+	.fast_switch	= powernv_fast_switch,
 	.get		= powernv_cpufreq_get,
 	.stop_cpu	= powernv_cpufreq_stop_cpu,
 	.attr		= powernv_cpu_freq_attr,
-- 
2.5.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-08 13:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-07  7:39 [PATCH v2 1/2] cpufreq: powernv: Adding fast_switch for schedutil Akshay Adiga
2016-11-07  7:39 ` [PATCH v2 2/2] cpufreq: powernv: Use PMCR to verify global and local pstate Akshay Adiga
2016-11-08  3:40   ` Gautham R Shenoy
2016-11-08 13:58     ` Akshay Adiga
2016-11-07  9:12 ` [PATCH v2 1/2] cpufreq: powernv: Adding fast_switch for schedutil Viresh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.