aboutsummaryrefslogtreecommitdiffstats
path: root/xen/drivers/cpufreq
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-12-10 13:27:41 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-12-10 13:27:41 +0000
commit7542c4ff00f26a91840afb3336058e8782399365 (patch)
treeb14eaad4185402e0e6f3070a61a023919054dd4c /xen/drivers/cpufreq
parent630b6713472007f100b40bf100246ca169b23a14 (diff)
downloadxen-7542c4ff00f26a91840afb3336058e8782399365.tar.gz
xen-7542c4ff00f26a91840afb3336058e8782399365.tar.bz2
xen-7542c4ff00f26a91840afb3336058e8782399365.zip
Add user PM control interface
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
Diffstat (limited to 'xen/drivers/cpufreq')
-rw-r--r--xen/drivers/cpufreq/cpufreq.c4
-rw-r--r--xen/drivers/cpufreq/cpufreq_ondemand.c40
2 files changed, 41 insertions, 3 deletions
diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index 185b0343d7..169426e373 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -53,9 +53,9 @@ struct cpufreq_dom {
};
static LIST_HEAD(cpufreq_dom_list_head);
-static LIST_HEAD(cpufreq_governor_list);
+LIST_HEAD(cpufreq_governor_list);
-static struct cpufreq_governor *__find_governor(const char *governor)
+struct cpufreq_governor *__find_governor(const char *governor)
{
struct cpufreq_governor *t;
diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 655edc79e9..a34912cbc0 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -51,12 +51,50 @@ static struct dbs_tuners {
unsigned int up_threshold;
unsigned int powersave_bias;
} dbs_tuners_ins = {
+ .sampling_rate = 0,
.up_threshold = DEF_FREQUENCY_UP_THRESHOLD,
.powersave_bias = 0,
};
static struct timer dbs_timer[NR_CPUS];
+int write_ondemand_sampling_rate(unsigned int sampling_rate)
+{
+ if ( (sampling_rate > MAX_SAMPLING_RATE / MICROSECS(1)) ||
+ (sampling_rate < MIN_SAMPLING_RATE / MICROSECS(1)) )
+ return -EINVAL;
+
+ dbs_tuners_ins.sampling_rate = sampling_rate * MICROSECS(1);
+ return 0;
+}
+
+int write_ondemand_up_threshold(unsigned int up_threshold)
+{
+ if ( (up_threshold > MAX_FREQUENCY_UP_THRESHOLD) ||
+ (up_threshold < MIN_FREQUENCY_UP_THRESHOLD) )
+ return -EINVAL;
+
+ dbs_tuners_ins.up_threshold = up_threshold;
+ return 0;
+}
+
+int get_cpufreq_ondemand_para(uint32_t *sampling_rate_max,
+ uint32_t *sampling_rate_min,
+ uint32_t *sampling_rate,
+ uint32_t *up_threshold)
+{
+ if (!sampling_rate_max || !sampling_rate_min ||
+ !sampling_rate || !up_threshold)
+ return -EINVAL;
+
+ *sampling_rate_max = MAX_SAMPLING_RATE/MICROSECS(1);
+ *sampling_rate_min = MIN_SAMPLING_RATE/MICROSECS(1);
+ *sampling_rate = dbs_tuners_ins.sampling_rate / MICROSECS(1);
+ *up_threshold = dbs_tuners_ins.up_threshold;
+
+ return 0;
+}
+
uint64_t get_cpu_idle_time(unsigned int cpu)
{
uint64_t idle_ns;
@@ -214,7 +252,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event)
* Start the timerschedule work, when this governor
* is used for first time
*/
- if (dbs_enable == 1) {
+ if ((dbs_enable == 1) && !dbs_tuners_ins.sampling_rate) {
def_sampling_rate = policy->cpuinfo.transition_latency *
DEF_SAMPLING_RATE_LATENCY_MULTIPLIER;