[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH v3 04/12] cpufreq: make turbo settings to be configurable
This settings is not needed for some architectures. So make it to be configurable and use it for x86 architecture. Signed-off-by: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@xxxxxxxxxxxxxxx> --- xen/Rules.mk | 1 + xen/arch/x86/Rules.mk | 1 + xen/drivers/cpufreq/utility.c | 11 ++++++++++- xen/drivers/pm/stat.c | 6 ++++++ xen/include/xen/cpufreq.h | 6 ++++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index b7caab6..5953152 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -56,6 +56,7 @@ CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS CFLAGS-$(lock_profile) += -DLOCK_PROFILE CFLAGS-$(HAS_ACPI) += -DHAS_ACPI CFLAGS-$(HAS_PM) += -DHAS_PM +CFLAGS-$(HAS_CPU_TURBO) += -DHAS_CPU_TURBO CFLAGS-$(HAS_GDBSX) += -DHAS_GDBSX CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH CFLAGS-$(HAS_DEVICE_TREE) += -DHAS_DEVICE_TREE diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk index 9e9fbf1..cfe4f90 100644 --- a/xen/arch/x86/Rules.mk +++ b/xen/arch/x86/Rules.mk @@ -4,6 +4,7 @@ HAS_IOPORTS := y HAS_ACPI := y HAS_PM := y +HAS_CPU_TURBO := y HAS_VGA := y HAS_VIDEO := y HAS_CPUFREQ := y diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c index 3cb0b3e..e92cf17 100644 --- a/xen/drivers/cpufreq/utility.c +++ b/xen/drivers/cpufreq/utility.c @@ -209,7 +209,9 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, { unsigned int min_freq = ~0; unsigned int max_freq = 0; +#ifdef HAS_CPU_TURBO unsigned int second_max_freq = 0; +#endif unsigned int i; for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { @@ -221,6 +223,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, if (freq > max_freq) max_freq = freq; } +#ifdef HAS_CPU_TURBO for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { unsigned int freq = table[i].frequency; if (freq == CPUFREQ_ENTRY_INVALID || freq == max_freq) @@ -234,9 +237,13 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, printk("max_freq: %u second_max_freq: %u\n", max_freq, second_max_freq); + policy->cpuinfo.second_max_freq = second_max_freq; +#else + if (cpufreq_verbose) + printk("max_freq: %u\n", max_freq); +#endif policy->min = policy->cpuinfo.min_freq = min_freq; policy->max = policy->cpuinfo.max_freq = max_freq; - policy->cpuinfo.second_max_freq = second_max_freq; if (policy->min == ~0) return -EINVAL; @@ -390,6 +397,7 @@ int cpufreq_driver_getavg(unsigned int cpu, unsigned int flag) return policy->cur; } +#ifdef HAS_CPU_TURBO int cpufreq_update_turbo(int cpuid, int new_state) { struct cpufreq_policy *policy; @@ -430,6 +438,7 @@ int cpufreq_get_turbo_status(int cpuid) policy = per_cpu(cpufreq_cpu_policy, cpuid); return policy && policy->turbo == CPUFREQ_TURBO_ENABLED; } +#endif /* HAS_CPU_TURBO */ /********************************************************************* * POLICY * diff --git a/xen/drivers/pm/stat.c b/xen/drivers/pm/stat.c index 3486148..3154051 100644 --- a/xen/drivers/pm/stat.c +++ b/xen/drivers/pm/stat.c @@ -292,7 +292,11 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op) &op->u.get_para.u.ondemand.sampling_rate, &op->u.get_para.u.ondemand.up_threshold); } +#ifdef HAS_CPU_TURBO op->u.get_para.turbo_enabled = cpufreq_get_turbo_status(op->cpuid); +#else + op->u.get_para.turbo_enabled = 0; +#endif return ret; } @@ -475,6 +479,7 @@ int do_pm_op(struct xen_sysctl_pm_op *op) break; } +#ifdef HAS_CPU_TURBO case XEN_SYSCTL_pm_op_enable_turbo: { ret = cpufreq_update_turbo(op->cpuid, CPUFREQ_TURBO_ENABLED); @@ -486,6 +491,7 @@ int do_pm_op(struct xen_sysctl_pm_op *op) ret = cpufreq_update_turbo(op->cpuid, CPUFREQ_TURBO_DISABLED); break; } +#endif /* HAS_CPU_TURBO */ default: printk("not defined sub-hypercall @ do_pm_op\n"); diff --git a/xen/include/xen/cpufreq.h b/xen/include/xen/cpufreq.h index 82dc4dc..d7b6c34 100644 --- a/xen/include/xen/cpufreq.h +++ b/xen/include/xen/cpufreq.h @@ -39,7 +39,9 @@ extern struct acpi_cpufreq_data *cpufreq_drv_data[NR_CPUS]; struct cpufreq_cpuinfo { unsigned int max_freq; +#ifdef HAS_CPU_TURBO unsigned int second_max_freq; /* P1 if Turbo Mode is on */ +#endif unsigned int min_freq; unsigned int transition_latency; /* in 10^(-9) s = nanoseconds */ }; @@ -59,10 +61,12 @@ struct cpufreq_policy { bool_t resume; /* flag for cpufreq 1st run * S3 wakeup, hotplug cpu, etc */ +#ifdef HAS_CPU_TURBO s8 turbo; /* tristate flag: 0 for unsupported * -1 for disable, 1 for enabled * See CPUFREQ_TURBO_* below for defines */ bool_t aperf_mperf; /* CPU has APERF/MPERF MSRs */ +#endif }; DECLARE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_policy); @@ -127,8 +131,10 @@ extern int cpufreq_driver_getavg(unsigned int cpu, unsigned int flag); #define CPUFREQ_TURBO_UNSUPPORTED 0 #define CPUFREQ_TURBO_ENABLED 1 +#ifdef HAS_CPU_TURBO extern int cpufreq_update_turbo(int cpuid, int new_state); extern int cpufreq_get_turbo_status(int cpuid); +#endif static __inline__ int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |