* [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support [not found] <1370502472-7249-1-git-send-email-l.majewski@samsung.com> @ 2013-12-02 12:19 ` Lukasz Majewski 2013-12-02 12:19 ` [PATCH RESEND v10 1/7] cpufreq: Add boost frequency support in core Lukasz Majewski ` (7 more replies) 2013-12-13 16:38 ` [PATCH v11 " Lukasz Majewski 2013-12-20 14:24 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski 2 siblings, 8 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-02 12:19 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc This patch series introduces support for CPU overclocking technique called Boost. It is a follow up of a LAB governor proposal. Boost is a LAB component: http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq Boost unifies hardware based solution (e.g. Intel Nehalem) with software oriented one (like the one done at Exynos). For this reason cpufreq/freq_table code has been reorganized to include common code. Important design decisions: - Boost related code is compiled-in unconditionally to cpufreq core and disabled by default. The cpufreq_driver is responsibile for setting boost_supported flag and providing set_boost callback(if HW support is needed). For software managed boost, special Kconfig flag - CONFIG_CPU_FREQ_BOOST_SW has been defined. It will be selected only when a target platform has thermal framework properly configured. - struct cpufreq_driver has been extended with boost related fields: -- boost_supported - when driver supports boosting -- boost_enabled - boost state -- set_boost - callback to function, which is necessary to enable/disable boost - Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) is visible _only_ when cpufreq driver supports Boost. - No special spin_lock for Boost was created. The one from cpufreq core was reused. - The Boost code doesn't rely on any policy. When boost state is changed, then the policy list is iterated and proper adjustements are done. - To improve safety level, the thermal framework is also extended to disable software boosting, when thermal trip point is reached. After cooling down the boost can be enabled again. This emulates behaviour similar to HW managed boost (like x86) Tested at HW: Exynos 4412 3.13-rc2 Linux Intel Core i7-3770 3.13-rc2 Linux Above patches were posted on top of kernel_pm/bleeding-edge (SHA1: 9483a9f69d5c8f83f1723361bf8340ddfb6475b4) Lukasz Majewski (7): cpufreq: Add boost frequency support in core cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution cpufreq:boost:Kconfig: Provide support for software managed BOOST cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework Documentation:cpufreq:boost: Update BOOST documentation cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Documentation/cpu-freq/boost.txt | 26 +++---- drivers/cpufreq/Kconfig | 4 + drivers/cpufreq/Kconfig.arm | 15 ++++ drivers/cpufreq/acpi-cpufreq.c | 86 +++++++-------------- drivers/cpufreq/cpufreq.c | 118 ++++++++++++++++++++++++++++- drivers/cpufreq/exynos-cpufreq.c | 3 + drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- drivers/cpufreq/freq_table.c | 56 ++++++++++++-- drivers/thermal/samsung/exynos_tmu_data.c | 47 ++++++++++++ include/linux/cpufreq.h | 24 ++++++ 10 files changed, 302 insertions(+), 79 deletions(-) -- 1.7.10.4 ^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH RESEND v10 1/7] cpufreq: Add boost frequency support in core 2013-12-02 12:19 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski @ 2013-12-02 12:19 ` Lukasz Majewski 2013-12-02 12:19 ` [PATCH RESEND v10 2/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution Lukasz Majewski ` (6 subsequent siblings) 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-02 12:19 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc This commit adds boost frequency support in cpufreq core (Hardware & Software). Some SoCs (like Exynos4 - e.g. 4x12) allow setting frequency above its normal operation limits. Such mode shall be only used for a short time. Overclocking (boost) support is essentially provided by platform dependent cpufreq driver. This commit unifies support for SW and HW (Intel) overclocking solutions in the core cpufreq driver. Previously the "boost" sysfs attribute was defined at acpi driver code. By default boost is disabled. One global attribute is available at: /sys/devices/system/cpu/cpufreq/boost. It only shows up when cpufreq driver supports overclocking. Under the hood frequencies dedicated for boosting are marked with a special flag (CPUFREQ_BOOST_FREQ) at driver's frequency table. It is the user's concern to enable/disable overclocking with a proper call to sysfs. The cpufreq_boost_trigger_state() function is defined non static on purpose. It is used later with thermal subsystem to provide automatic enable/disable of the BOOST feature. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> --- Changes for v10: - None Changes for v9: - Add cpufreq_freq_attr_scaling_boost_freqs to *cpufreq_generic_attr table - Introduce CONFIG_CPU_FREQ_BOOST_SW generic config flag to show BOOST frequencies only when cpufreq driver supports boost Changes for v8: - Correction of error message at cpufreq_boost_trigger_state() function - Rewrite the cpufreq_boost_set_sw() function to print error message and break the loop when policy adjustment fails Changes for v7: - Properly change cpufreq_driver->boost_enabled when set_boost() fails (=0 to =!state) - Add likely() around cpufreq_driver - Remove parenthesis around boost.attr Changes for v6: - Remove sysfs boost attribute when subsys_iterface_unregister() fails - Move global boost_enabled variable from cpufreq.c to platform dependent struct cpufreq_driver - pr_err() message is also printed when boost disable fails - Call __cpufreq_governor() to force recalculation of next frequency when boost is triggered. It is needed with i.e. performance class of governors - Change cpufreq_boost_enable_sw() -> cpufreq_boost_set_sw() - Rename .enable_boost function pointer to .set_boost Changes for v5: - Rename cpufreq_boost_trigger_state_sw() to cpufreq_boost_enable_sw() - Extent cpufreq_register_driver() to check if cpufreq driver provided boost_enable callback. If not provided, then use cpufreq_boost_enable_sw() - Use single call to cpufreq_driver->enable_boost() with cpufreq driver provided callback or default SW boost enable routine - Move pr_debug call to store_boost() from cpufreq_boost_trigger_state() - Change the user_policy.max value when SW boost is toggled. It is necessary for proper operation of e.g. thermal subsystem. - Add check if cpufreq_driver pointer is not NULL at cpufreq_boost_supported() routine - Add EXPORT_SYMBOL_GPL for cpufreq_boost_supported() and cpufreq_boost_enabled() - Remove extra check for cpufreq_boost_supported() at cpufreq_freq_table_cpuinfo() - Explanation of show boost logic at show_available_freqs() - Add cpufreq_set_boost_enabled() method to set initial value of boost_enabled global flag Changes for v4: - Remove boost parameter from cpufreq_frequency_table_cpuinfo() function - Introduce cpufreq_boost_supported() method - Use of cpufreq_boost_supported() and cpufreq_boost_enabled() to decide if frequency shall be skipped - Rename set_boost_freq() to enable_boost() - cpufreq_attr_available_freq() moved to freq_table.c - Use policy list to get access to cpufreq policies - Rename global boost flag (cpufreq_boost_enabled -> boost_enabled) - pr_err corrected ( %sable) - Remove sanity check at cpufreq_boost_trigger_state() entrance [to test if boost is supported] - Use either HW (boost_enable) callback or SW managed boost - Introduce new cpufreq_boost_trigger_state_sw() method to handle boost at SW. - Protect boost_enabled manipulation with lock. Changes for v3: - Method for reading boost status - Removal of cpufreq_frequency_table_max() - Extent cpufreq_frequency_table_cpuinfo() to support boost parameter - boost_supported flag added to cpufreq_driver struct - "boost" sysfs attribute control flag removed - One global flag describing state of the boost defined at cpufreq core - Rename cpufreq_driver's low_level_boost field to set_boost_freq() - Usage of cpufreq_sysfs_{remove|add}_file() routines Changes for v2: - Removal of cpufreq_boost structure and move its fields to cpufreq_driver structure - Flag to indicate if global boost attribute is already defined - Extent the pr_{err|debbug} functions to show current function names drivers/cpufreq/cpufreq.c | 118 +++++++++++++++++++++++++++++++++++++++++- drivers/cpufreq/freq_table.c | 56 +++++++++++++++++--- include/linux/cpufreq.h | 24 +++++++++ 3 files changed, 190 insertions(+), 8 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 606224a..a0d1ea0 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -328,6 +328,33 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition); /********************************************************************* * SYSFS INTERFACE * *********************************************************************/ +ssize_t show_boost(struct kobject *kobj, + struct attribute *attr, char *buf) +{ + return sprintf(buf, "%d\n", cpufreq_driver->boost_enabled); +} + +static ssize_t store_boost(struct kobject *kobj, struct attribute *attr, + const char *buf, size_t count) +{ + int ret, enable; + + ret = sscanf(buf, "%d", &enable); + if (ret != 1 || enable < 0 || enable > 1) + return -EINVAL; + + if (cpufreq_boost_trigger_state(enable)) { + pr_err("%s: Cannot %s BOOST!\n", __func__, + enable ? "enable" : "disable"); + return -EINVAL; + } + + pr_debug("%s: cpufreq BOOST %s\n", __func__, + enable ? "enabled" : "disabled"); + + return count; +} +define_one_global_rw(boost); static struct cpufreq_governor *__find_governor(const char *str_governor) { @@ -2149,6 +2176,73 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = { }; /********************************************************************* + * BOOST * + *********************************************************************/ +static int cpufreq_boost_set_sw(int state) +{ + struct cpufreq_frequency_table *freq_table; + struct cpufreq_policy *policy; + int ret = -EINVAL; + + list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { + freq_table = cpufreq_frequency_get_table(policy->cpu); + if (freq_table) { + ret = cpufreq_frequency_table_cpuinfo(policy, + freq_table); + if (ret) { + pr_err("%s: Policy frequency update failed\n", + __func__); + break; + } + policy->user_policy.max = policy->max; + __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS); + } + } + + return ret; +} + +int cpufreq_boost_trigger_state(int state) +{ + unsigned long flags; + int ret = 0; + + if (cpufreq_driver->boost_enabled == state) + return 0; + + write_lock_irqsave(&cpufreq_driver_lock, flags); + cpufreq_driver->boost_enabled = state; + write_unlock_irqrestore(&cpufreq_driver_lock, flags); + + ret = cpufreq_driver->set_boost(state); + if (ret) { + write_lock_irqsave(&cpufreq_driver_lock, flags); + cpufreq_driver->boost_enabled = !state; + write_unlock_irqrestore(&cpufreq_driver_lock, flags); + + pr_err("%s: Cannot %s BOOST\n", __func__, + state ? "enable" : "disable"); + } + + return ret; +} + +int cpufreq_boost_supported(void) +{ + if (likely(cpufreq_driver)) + return cpufreq_driver->boost_supported; + + return 0; +} +EXPORT_SYMBOL_GPL(cpufreq_boost_supported); + +int cpufreq_boost_enabled(void) +{ + return cpufreq_driver->boost_enabled; +} +EXPORT_SYMBOL_GPL(cpufreq_boost_enabled); + +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/ @@ -2188,9 +2282,25 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data; write_unlock_irqrestore(&cpufreq_driver_lock, flags); + if (cpufreq_boost_supported()) { + /* + * Check if driver provides function to enable boost - + * if not, use cpufreq_boost_set_sw as default + */ + if (!cpufreq_driver->set_boost) + cpufreq_driver->set_boost = cpufreq_boost_set_sw; + + ret = cpufreq_sysfs_create_file(&boost.attr); + if (ret) { + pr_err("%s: cannot register global BOOST sysfs file\n", + __func__); + goto err_null_driver; + } + } + ret = subsys_interface_register(&cpufreq_interface); if (ret) - goto err_null_driver; + goto err_boost_unreg; if (!(cpufreq_driver->flags & CPUFREQ_STICKY)) { int i; @@ -2217,6 +2327,9 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) return 0; err_if_unreg: subsys_interface_unregister(&cpufreq_interface); +err_boost_unreg: + if (cpufreq_boost_supported()) + cpufreq_sysfs_remove_file(&boost.attr); err_null_driver: write_lock_irqsave(&cpufreq_driver_lock, flags); cpufreq_driver = NULL; @@ -2243,6 +2356,9 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) pr_debug("unregistering driver %s\n", driver->name); subsys_interface_unregister(&cpufreq_interface); + if (cpufreq_boost_supported()) + cpufreq_sysfs_remove_file(&boost.attr); + unregister_hotcpu_notifier(&cpufreq_cpu_notifier); down_write(&cpufreq_rwsem); diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index 3458d27..776e88a 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c @@ -32,6 +32,10 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, continue; } + if (!cpufreq_boost_enabled() + && table[i].driver_data == CPUFREQ_BOOST_FREQ) + continue; + pr_debug("table entry %u: %u kHz, %u driver_data\n", i, freq, table[i].driver_data); if (freq < min_freq) @@ -182,7 +186,8 @@ static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table); /** * show_available_freqs - show available frequencies for the specified CPU */ -static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) +static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf, + bool show_boost) { unsigned int i = 0; unsigned int cpu = policy->cpu; @@ -197,6 +202,20 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { if (table[i].frequency == CPUFREQ_ENTRY_INVALID) continue; + /* + * show_boost = true and driver_data = BOOST freq + * display BOOST freqs + * + * show_boost = false and driver_data = BOOST freq + * show_boost = true and driver_data != BOOST freq + * continue - do not display anything + * + * show_boost = false and driver_data != BOOST freq + * display NON BOOST freqs + */ + if (show_boost ^ (table[i].driver_data == CPUFREQ_BOOST_FREQ)) + continue; + count += sprintf(&buf[count], "%d ", table[i].frequency); } count += sprintf(&buf[count], "\n"); @@ -205,16 +224,39 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) } -struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { - .attr = { .name = "scaling_available_frequencies", - .mode = 0444, - }, - .show = show_available_freqs, -}; +#define cpufreq_attr_available_freq(_name) \ +struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ +__ATTR_RO(_name##_frequencies) + +/** + * show_scaling_available_frequencies - show available normal frequencies for + * the specified CPU + */ +static ssize_t scaling_available_frequencies_show(struct cpufreq_policy *policy, + char *buf) +{ + return show_available_freqs(policy, buf, false); +} +cpufreq_attr_available_freq(scaling_available); EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs); +/** + * show_available_boost_freqs - show available boost frequencies for + * the specified CPU + */ +static ssize_t scaling_boost_frequencies_show(struct cpufreq_policy *policy, + char *buf) +{ + return show_available_freqs(policy, buf, true); +} +cpufreq_attr_available_freq(scaling_boost); +EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_boost_freqs); + struct freq_attr *cpufreq_generic_attr[] = { &cpufreq_freq_attr_scaling_available_freqs, +#ifdef CONFIG_CPU_FREQ_BOOST_SW + &cpufreq_freq_attr_scaling_boost_freqs, +#endif NULL, }; EXPORT_SYMBOL_GPL(cpufreq_generic_attr); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index ee5fe9d..68f32dc 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -225,6 +225,11 @@ struct cpufreq_driver { int (*suspend) (struct cpufreq_policy *policy); int (*resume) (struct cpufreq_policy *policy); struct freq_attr **attr; + + /* platform specific boost support code */ + bool boost_supported; + bool boost_enabled; + int (*set_boost) (int state); }; /* flags */ @@ -428,6 +433,7 @@ extern struct cpufreq_governor cpufreq_gov_conservative; #define CPUFREQ_ENTRY_INVALID ~0 #define CPUFREQ_TABLE_END ~1 +#define CPUFREQ_BOOST_FREQ ~2 struct cpufreq_frequency_table { unsigned int driver_data; /* driver specific data, not used by core */ @@ -451,6 +457,24 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy); ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf); +#ifdef CONFIG_CPU_FREQ +int cpufreq_boost_trigger_state(int state); +int cpufreq_boost_supported(void); +int cpufreq_boost_enabled(void); +#else +static inline int cpufreq_boost_trigger_state(int state) +{ + return 0; +} +static inline int cpufreq_boost_supported(void) +{ + return 0; +} +static inline int cpufreq_boost_enabled(void) +{ + return 0; +} +#endif /* the following funtion is for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH RESEND v10 2/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution 2013-12-02 12:19 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski 2013-12-02 12:19 ` [PATCH RESEND v10 1/7] cpufreq: Add boost frequency support in core Lukasz Majewski @ 2013-12-02 12:19 ` Lukasz Majewski 2013-12-02 12:19 ` [PATCH RESEND v10 3/7] cpufreq:boost:Kconfig: Provide support for software managed BOOST Lukasz Majewski ` (5 subsequent siblings) 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-02 12:19 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc The Intel's hardware based boost solution driver has been changed to cooperate with common cpufreq boost framework. The global sysfs boost attribute entry code (/sys/devices/system/cpu/cpufreq/boost) has been moved to a core cpufreq code. This attribute is now only visible, when cpufreq driver supports it. The _store_boost() function has been redesigned to be used as set_boost callback. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v10: - None Changes for v9: - None Changes for v8: - None Changes for v7: - Remove superfluous acpi_cpufreq_driver.boost_supported = false at acpi_cpufreq_boost_init() Changes for v6: - Perform acpi_cpufreq_boost_init initialization before cpufreq_driver registration - Compile store_boost() only when CONFIG_X86_ACPI_CPUFREQ_CPB defined - Use boost_enabled flag defined at acpi_cpufreq_driver to store information about boost state - Instead of using cpufreq_set_boost_enabled(), modify the boost_enable in the acpi driver code Changes for v5: - Remove acpi-cpufreq's boost_enabled global flag and reuse one defined at cpufreq core Changes for v4: - add _store_boost to acpi_cpufreq_driver structure Changes for v3: - Bring back boost_enabled as a global flag - Move boost_supported to cpufreq_driver structure Changes for v2: - Replace boost_enabled and boost_supported global flags with proper entries at struct cpufreq_driver. - Removal of struct cpufreq_boost drivers/cpufreq/acpi-cpufreq.c | 86 ++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 57 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index caf41eb..79e5608 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -80,7 +80,6 @@ static struct acpi_processor_performance __percpu *acpi_perf_data; static struct cpufreq_driver acpi_cpufreq_driver; static unsigned int acpi_pstate_strict; -static bool boost_enabled, boost_supported; static struct msr __percpu *msrs; static bool boost_state(unsigned int cpu) @@ -133,49 +132,16 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask) wrmsr_on_cpus(cpumask, msr_addr, msrs); } -static ssize_t _store_boost(const char *buf, size_t count) +static int _store_boost(int val) { - int ret; - unsigned long val = 0; - - if (!boost_supported) - return -EINVAL; - - ret = kstrtoul(buf, 10, &val); - if (ret || (val > 1)) - return -EINVAL; - - if ((val && boost_enabled) || (!val && !boost_enabled)) - return count; - get_online_cpus(); - boost_set_msrs(val, cpu_online_mask); - put_online_cpus(); - - boost_enabled = val; pr_debug("Core Boosting %sabled.\n", val ? "en" : "dis"); - return count; -} - -static ssize_t store_global_boost(struct kobject *kobj, struct attribute *attr, - const char *buf, size_t count) -{ - return _store_boost(buf, count); -} - -static ssize_t show_global_boost(struct kobject *kobj, - struct attribute *attr, char *buf) -{ - return sprintf(buf, "%u\n", boost_enabled); + return 0; } -static struct global_attr global_boost = __ATTR(boost, 0644, - show_global_boost, - store_global_boost); - static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf) { struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu); @@ -186,15 +152,32 @@ static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf) cpufreq_freq_attr_ro(freqdomain_cpus); #ifdef CONFIG_X86_ACPI_CPUFREQ_CPB +static ssize_t store_boost(const char *buf, size_t count) +{ + int ret; + unsigned long val = 0; + + if (!acpi_cpufreq_driver.boost_supported) + return -EINVAL; + + ret = kstrtoul(buf, 10, &val); + if (ret || (val > 1)) + return -EINVAL; + + _store_boost((int) val); + + return count; +} + static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf, size_t count) { - return _store_boost(buf, count); + return store_boost(buf, count); } static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf) { - return sprintf(buf, "%u\n", boost_enabled); + return sprintf(buf, "%u\n", acpi_cpufreq_driver.boost_enabled); } cpufreq_freq_attr_rw(cpb); @@ -554,7 +537,7 @@ static int boost_notify(struct notifier_block *nb, unsigned long action, switch (action) { case CPU_UP_PREPARE: case CPU_UP_PREPARE_FROZEN: - boost_set_msrs(boost_enabled, cpumask); + boost_set_msrs(acpi_cpufreq_driver.boost_enabled, cpumask); break; case CPU_DOWN_PREPARE: @@ -911,6 +894,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = { .resume = acpi_cpufreq_resume, .name = "acpi-cpufreq", .attr = acpi_cpufreq_attr, + .set_boost = _store_boost, }; static void __init acpi_cpufreq_boost_init(void) @@ -921,33 +905,22 @@ static void __init acpi_cpufreq_boost_init(void) if (!msrs) return; - boost_supported = true; - boost_enabled = boost_state(0); - + acpi_cpufreq_driver.boost_supported = true; + acpi_cpufreq_driver.boost_enabled = boost_state(0); get_online_cpus(); /* Force all MSRs to the same value */ - boost_set_msrs(boost_enabled, cpu_online_mask); + boost_set_msrs(acpi_cpufreq_driver.boost_enabled, + cpu_online_mask); register_cpu_notifier(&boost_nb); put_online_cpus(); - } else - global_boost.attr.mode = 0444; - - /* We create the boost file in any case, though for systems without - * hardware support it will be read-only and hardwired to return 0. - */ - if (cpufreq_sysfs_create_file(&(global_boost.attr))) - pr_warn(PFX "could not register global boost sysfs file\n"); - else - pr_debug("registered global boost sysfs file\n"); + } } static void __exit acpi_cpufreq_boost_exit(void) { - cpufreq_sysfs_remove_file(&(global_boost.attr)); - if (msrs) { unregister_cpu_notifier(&boost_nb); @@ -993,12 +966,11 @@ static int __init acpi_cpufreq_init(void) *iter = &cpb; } #endif + acpi_cpufreq_boost_init(); ret = cpufreq_register_driver(&acpi_cpufreq_driver); if (ret) free_acpi_perf_data(); - else - acpi_cpufreq_boost_init(); return ret; } -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH RESEND v10 3/7] cpufreq:boost:Kconfig: Provide support for software managed BOOST 2013-12-02 12:19 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski 2013-12-02 12:19 ` [PATCH RESEND v10 1/7] cpufreq: Add boost frequency support in core Lukasz Majewski 2013-12-02 12:19 ` [PATCH RESEND v10 2/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution Lukasz Majewski @ 2013-12-02 12:19 ` Lukasz Majewski 2013-12-02 12:19 ` [PATCH RESEND v10 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework Lukasz Majewski ` (4 subsequent siblings) 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-02 12:19 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc For safety reasons new flag - CONFIG_CPU_FREQ_BOOST_SW has been added. Only after selecting "EXYNOS Frequency Overclocking - Software" Kconfig option the software managed boost is enabled. It also selects thermal subsystem to be compiled in. Thermal is necessary for disabling boost and cooling down the device when overheating detected. Boost _MUST_NOT_ work without thermal subsystem with properly defined overheating temperatures. This option doesn't affect x86's ACPI hardware managed boost support (i.e. Intel, AMD). In this situation boost management is embedded at hardware. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v10: - None Changes for v9: - None Changes for v8: - None Changes for v7: - Remove superfluous "default n" definition - Generic CPU_FREQ_BOOST_SW depends on THERMAL Changes for v6: - CPU_FREQ_BOOST_SW [1] is now defined as "invisible" bool option. - Platform dependent ARM_EXYNOS_CPU_FREQ_BOOST_SW config option has been added. It depends on ARM_EXYNOS_CPUFREQ options and selects EXYNOS_THERMAL with the main boost config [1]. Changes for v5: - New patch drivers/cpufreq/Kconfig | 4 ++++ drivers/cpufreq/Kconfig.arm | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 38093e2..c8818c1 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig @@ -20,6 +20,10 @@ if CPU_FREQ config CPU_FREQ_GOV_COMMON bool +config CPU_FREQ_BOOST_SW + bool + depends on THERMAL + config CPU_FREQ_STAT tristate "CPU frequency translation statistics" default y diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index ce52ed9..25599d6 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm @@ -64,6 +64,21 @@ config ARM_EXYNOS5440_CPUFREQ If in doubt, say N. +config ARM_EXYNOS_CPU_FREQ_BOOST_SW + bool "EXYNOS Frequency Overclocking - Software" + depends on ARM_EXYNOS_CPUFREQ + select CPU_FREQ_BOOST_SW + select EXYNOS_THERMAL + help + This driver supports software managed overclocking (BOOST). + It allows usage of special frequencies for Samsung Exynos + processors if thermal conditions are appropriate. + + It reguires, for safe operation, thermal framework with properly + defined trip points. + + If in doubt, say N. + config ARM_HIGHBANK_CPUFREQ tristate "Calxeda Highbank-based" depends on ARCH_HIGHBANK -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH RESEND v10 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework 2013-12-02 12:19 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski ` (2 preceding siblings ...) 2013-12-02 12:19 ` [PATCH RESEND v10 3/7] cpufreq:boost:Kconfig: Provide support for software managed BOOST Lukasz Majewski @ 2013-12-02 12:19 ` Lukasz Majewski 2013-12-02 12:19 ` [PATCH RESEND v10 5/7] Documentation:cpufreq:boost: Update BOOST documentation Lukasz Majewski ` (3 subsequent siblings) 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-02 12:19 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc The cpufreq_driver's boost_supported flag is true only when boost support is explicitly enabled. Boost related attributes are exported only under the same condition. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v10: - None Changes for v9: - The exynos_cpufreq_attr[] has been replaced by generic_cpufreq_attr[], therefore the cpufreq_freq_attr_scaling_boost_freqs is now added at freq_table.c file. Changes for v8: - None Changes for v7: - Replace CONFIG_CPU_FREQ_BOOST_SW with CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW - Move boost_supported initialization to struct cpufreq_driver exynos_driver Changes for v6: - Replace exynos_driver.boost_supported = 1 to = true - Protect boost attributes export with CONFIG_CPU_FREQ_BOOST_SW Changes for v5: - None Changes for v4: - None Changes for v3: - Remove low level boost code - Move boost management code to cpufreq core code - Use boost_supported flag to indicate if driver supports over clocking Changes for v2: - Removal of struct cpufreq_boost - Removal of the CONFIG_CPU_FREQ_BOOST flag - low_level_boost with valid address when boost is supported drivers/cpufreq/exynos-cpufreq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index f3c2287..3cd6d2e 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c @@ -226,6 +226,9 @@ static struct cpufreq_driver exynos_driver = { .exit = cpufreq_generic_exit, .name = "exynos_cpufreq", .attr = cpufreq_generic_attr, +#ifdef CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW + .boost_supported = true, +#endif #ifdef CONFIG_PM .suspend = exynos_cpufreq_suspend, .resume = exynos_cpufreq_resume, -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH RESEND v10 5/7] Documentation:cpufreq:boost: Update BOOST documentation 2013-12-02 12:19 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski ` (3 preceding siblings ...) 2013-12-02 12:19 ` [PATCH RESEND v10 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework Lukasz Majewski @ 2013-12-02 12:19 ` Lukasz Majewski 2013-12-02 12:19 ` [PATCH RESEND v10 6/7] cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ Lukasz Majewski ` (2 subsequent siblings) 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-02 12:19 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc Since the support for software and hardware controlled boosting has been added, the corresponding Documentation entry had been updated. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v10: - None Changes for v9: - None Changes for v8: - None Changes for v7: - None Changes for v6: - None Changes for v5: - New patch Documentation/cpu-freq/boost.txt | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Documentation/cpu-freq/boost.txt b/Documentation/cpu-freq/boost.txt index 9b4edfc..dd62e13 100644 --- a/Documentation/cpu-freq/boost.txt +++ b/Documentation/cpu-freq/boost.txt @@ -17,8 +17,8 @@ Introduction Some CPUs support a functionality to raise the operating frequency of some cores in a multi-core package if certain conditions apply, mostly if the whole chip is not fully utilized and below it's intended thermal -budget. This is done without operating system control by a combination -of hardware and firmware. +budget. The decision about boost disable/enable is made either at hardware +(e.g. x86) or software (e.g ARM). On Intel CPUs this is called "Turbo Boost", AMD calls it "Turbo-Core", in technical documentation "Core performance boost". In Linux we use the term "boost" for convenience. @@ -48,24 +48,24 @@ be desirable: User controlled switch ---------------------- -To allow the user to toggle the boosting functionality, the acpi-cpufreq -driver exports a sysfs knob to disable it. There is a file: +To allow the user to toggle the boosting functionality, the cpufreq core +driver exports a sysfs knob to enable or disable it. There is a file: /sys/devices/system/cpu/cpufreq/boost which can either read "0" (boosting disabled) or "1" (boosting enabled). -Reading the file is always supported, even if the processor does not -support boosting. In this case the file will be read-only and always -reads as "0". Explicitly changing the permissions and writing to that -file anyway will return EINVAL. +The file is exported only when cpufreq driver supports boosting. +Explicitly changing the permissions and writing to that file anyway will +return EINVAL. On supported CPUs one can write either a "0" or a "1" into this file. This will either disable the boost functionality on all cores in the -whole system (0) or will allow the hardware to boost at will (1). +whole system (0) or will allow the software or hardware to boost at will +(1). Writing a "1" does not explicitly boost the system, but just allows the -CPU (and the firmware) to boost at their discretion. Some implementations -take external factors like the chip's temperature into account, so -boosting once does not necessarily mean that it will occur every time -even using the exact same software setup. +CPU to boost at their discretion. Some implementations take external +factors like the chip's temperature into account, so boosting once does +not necessarily mean that it will occur every time even using the exact +same software setup. AMD legacy cpb switch -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH RESEND v10 6/7] cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ 2013-12-02 12:19 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski ` (4 preceding siblings ...) 2013-12-02 12:19 ` [PATCH RESEND v10 5/7] Documentation:cpufreq:boost: Update BOOST documentation Lukasz Majewski @ 2013-12-02 12:19 ` Lukasz Majewski 2013-12-02 12:19 ` [PATCH RESEND v10 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Lukasz Majewski 2013-12-04 6:59 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-02 12:19 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc Special driver data flag (CPUFREQ_BOOST_FREQ) has been added to indicate frequency, which can be only enabled for BOOST mode. This frequency shall be used only for limited time, since it might cause target device to overheat. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v10: - None Changes for v9: - None Changes for v8: - None Changes for v7: - None Changes for v6: - New patch drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/exynos4x12-cpufreq.c b/drivers/cpufreq/exynos4x12-cpufreq.c index efad5e6..77ae129 100644 --- a/drivers/cpufreq/exynos4x12-cpufreq.c +++ b/drivers/cpufreq/exynos4x12-cpufreq.c @@ -32,7 +32,7 @@ static unsigned int exynos4x12_volt_table[] = { }; static struct cpufreq_frequency_table exynos4x12_freq_table[] = { - {L0, CPUFREQ_ENTRY_INVALID}, + {CPUFREQ_BOOST_FREQ, 1500 * 1000}, {L1, 1400 * 1000}, {L2, 1300 * 1000}, {L3, 1200 * 1000}, -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH RESEND v10 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) 2013-12-02 12:19 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski ` (5 preceding siblings ...) 2013-12-02 12:19 ` [PATCH RESEND v10 6/7] cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ Lukasz Majewski @ 2013-12-02 12:19 ` Lukasz Majewski 2013-12-04 6:59 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-02 12:19 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc This patch provides auto disable/enable operation for boost. It uses already present thermal infrastructure to provide boost hysteresis. A special set of TMU data has been defined for Exynos4412, which is only considered when BOOST is enabled. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> --- Changes for v10: - Remove boost related code from thermal_core.c - Use already present thermal infrastructure to provide thermal hysteresis - Introduce special set of TMU data for BOOST Changes for v9: - None Changes for v8: - Move cpufreq_boost_* stub functions definition (needed when cpufreq is not compiled in) to cpufreq.h at cpufreq core support commit Changes for v7: - None Changes for v6: - Disable boost only when supported and enabled - Protect boost related thermal_zone_device struct fields with mutex - Evaluate temperature trend during boost enable decision - Create separate methods to handle boost enable/disable (thermal_boost_{enable|disable}) operations - Boost is disabled at any trip point passage (not only the non critical one) - Add stub definitions for cpufreq boost functions used when CONFIG_CPU_FREQ is NOT defined. Changes for v5: - Move boost disable code from cpu_cooling.c to thermal_core.c (to handle_non_critical_trips) - Extent struct thermal_zone_device by adding overheated bool flag - Implement auto enable of boost after device cools down - Introduce boost_polling flag, which indicates if thermal uses it's predefined pool delay or has woken up thermal workqueue only to wait until device cools down. Changes for v4: - New patch drivers/thermal/samsung/exynos_tmu_data.c | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c index 073c292..9346926 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c +++ b/drivers/thermal/samsung/exynos_tmu_data.c @@ -167,13 +167,60 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ TMU_SUPPORT_EMUL_TIME) + +#define EXYNOS4412_TMU_DATA_BOOST \ + .threshold_falling = 10, \ + .trigger_levels[0] = 70, \ + .trigger_levels[1] = 85, \ + .trigger_levels[2] = 103, \ + .trigger_levels[3] = 110, \ + .trigger_enable[0] = true, \ + .trigger_enable[1] = true, \ + .trigger_enable[2] = true, \ + .trigger_enable[3] = true, \ + .trigger_type[0] = THROTTLE_ACTIVE, \ + .trigger_type[1] = THROTTLE_ACTIVE, \ + .trigger_type[2] = THROTTLE_ACTIVE, \ + .trigger_type[3] = SW_TRIP, \ + .max_trigger_level = 4, \ + .gain = 8, \ + .reference_voltage = 16, \ + .noise_cancel_mode = 4, \ + .cal_type = TYPE_ONE_POINT_TRIMMING, \ + .efuse_value = 55, \ + .min_efuse_value = 40, \ + .max_efuse_value = 100, \ + .first_point_trim = 25, \ + .second_point_trim = 85, \ + .default_temp_offset = 50, \ + .freq_tab[0] = { \ + .freq_clip_max = 1400 * 1000, \ + .temp_level = 70, \ + }, \ + .freq_tab[1] = { \ + .freq_clip_max = 800 * 1000, \ + .temp_level = 85, \ + }, \ + .freq_tab[2] = { \ + .freq_clip_max = 200 * 1000, \ + .temp_level = 103, \ + }, \ + .freq_tab_count = 3, \ + .registers = &exynos4412_tmu_registers, \ + .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ + TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ + TMU_SUPPORT_EMUL_TIME) #endif #if defined(CONFIG_SOC_EXYNOS4412) struct exynos_tmu_init_data const exynos4412_default_tmu_data = { .tmu_data = { { +#ifdef CONFIG_CPU_FREQ_BOOST_SW + EXYNOS4412_TMU_DATA_BOOST, +#else EXYNOS4412_TMU_DATA, +#endif .type = SOC_ARCH_EXYNOS4412, .test_mux = EXYNOS4412_MUX_ADDR_VALUE, }, -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support 2013-12-02 12:19 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski ` (6 preceding siblings ...) 2013-12-02 12:19 ` [PATCH RESEND v10 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Lukasz Majewski @ 2013-12-04 6:59 ` Lukasz Majewski 2013-12-04 14:12 ` Eduardo Valentin 7 siblings, 1 reply; 36+ messages in thread From: Lukasz Majewski @ 2013-12-04 6:59 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki Cc: Lukasz Majewski, Zhang Rui, Eduardo Valentin, cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc Hi Rafael, > This patch series introduces support for CPU overclocking technique > called Boost. > > It is a follow up of a LAB governor proposal. Boost is a LAB > component: > http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq > > Boost unifies hardware based solution (e.g. Intel Nehalem) with > software oriented one (like the one done at Exynos). > For this reason cpufreq/freq_table code has been reorganized to > include common code. > > Important design decisions: > - Boost related code is compiled-in unconditionally to cpufreq core > and disabled by default. The cpufreq_driver is responsibile for > setting boost_supported flag and providing set_boost callback(if HW > support is needed). For software managed boost, special Kconfig flag - > CONFIG_CPU_FREQ_BOOST_SW has been defined. It will be selected only > when a target platform has thermal framework properly configured. > > - struct cpufreq_driver has been extended with boost related fields: > -- boost_supported - when driver supports boosting > -- boost_enabled - boost state > -- set_boost - callback to function, which is necessary to > enable/disable boost > > - Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) is > visible _only_ when cpufreq driver supports Boost. > > - No special spin_lock for Boost was created. The one from cpufreq > core was reused. > > - The Boost code doesn't rely on any policy. When boost state is > changed, then the policy list is iterated and proper adjustements are > done. > > - To improve safety level, the thermal framework is also extended to > disable software boosting, when thermal trip point is reached. After > cooling down the boost can be enabled again. This emulates behaviour > similar to HW managed boost (like x86) > > Tested at HW: > Exynos 4412 3.13-rc2 Linux > Intel Core i7-3770 3.13-rc2 Linux > > Above patches were posted on top of kernel_pm/bleeding-edge > (SHA1: 9483a9f69d5c8f83f1723361bf8340ddfb6475b4) > Rafael, could you pull patches from 1 to 6 of this series? Those are related to cpufreq core and has already been accepted by Viresh at a late August this year. This would facilitate my further cpufreq work. And about the last patch - related to thermal. It seems that more discussion NOT related to cpufreq will be ongoing. I would prefer to add it as a separate patch to thermal subtree. > > Lukasz Majewski (7): > cpufreq: Add boost frequency support in core > cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common > boost solution > cpufreq:boost:Kconfig: Provide support for software managed BOOST > cpufreq:exynos:Extend Exynos cpufreq driver to support boost > framework > Documentation:cpufreq:boost: Update BOOST documentation > cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ > thermal:exynos:boost: Automatic enable/disable of BOOST feature (at > Exynos4412) > > Documentation/cpu-freq/boost.txt | 26 +++---- > drivers/cpufreq/Kconfig | 4 + > drivers/cpufreq/Kconfig.arm | 15 ++++ > drivers/cpufreq/acpi-cpufreq.c | 86 > +++++++-------------- drivers/cpufreq/cpufreq.c | > 118 ++++++++++++++++++++++++++++- > drivers/cpufreq/exynos-cpufreq.c | 3 + > drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- > drivers/cpufreq/freq_table.c | 56 ++++++++++++-- > drivers/thermal/samsung/exynos_tmu_data.c | 47 ++++++++++++ > include/linux/cpufreq.h | 24 ++++++ 10 files > changed, 302 insertions(+), 79 deletions(-) > -- -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support 2013-12-04 6:59 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski @ 2013-12-04 14:12 ` Eduardo Valentin 2013-12-09 10:04 ` Lukasz Majewski 0 siblings, 1 reply; 36+ messages in thread From: Eduardo Valentin @ 2013-12-04 14:12 UTC (permalink / raw) To: Lukasz Majewski Cc: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin, cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc [-- Attachment #1: Type: text/plain, Size: 4153 bytes --] On 04-12-2013 02:59, Lukasz Majewski wrote: > Hi Rafael, > >> This patch series introduces support for CPU overclocking technique >> called Boost. >> >> It is a follow up of a LAB governor proposal. Boost is a LAB >> component: >> http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq >> >> Boost unifies hardware based solution (e.g. Intel Nehalem) with >> software oriented one (like the one done at Exynos). >> For this reason cpufreq/freq_table code has been reorganized to >> include common code. >> >> Important design decisions: >> - Boost related code is compiled-in unconditionally to cpufreq core >> and disabled by default. The cpufreq_driver is responsibile for >> setting boost_supported flag and providing set_boost callback(if HW >> support is needed). For software managed boost, special Kconfig flag - >> CONFIG_CPU_FREQ_BOOST_SW has been defined. It will be selected only >> when a target platform has thermal framework properly configured. >> >> - struct cpufreq_driver has been extended with boost related fields: >> -- boost_supported - when driver supports boosting >> -- boost_enabled - boost state >> -- set_boost - callback to function, which is necessary to >> enable/disable boost >> >> - Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) is >> visible _only_ when cpufreq driver supports Boost. >> >> - No special spin_lock for Boost was created. The one from cpufreq >> core was reused. >> >> - The Boost code doesn't rely on any policy. When boost state is >> changed, then the policy list is iterated and proper adjustements are >> done. >> >> - To improve safety level, the thermal framework is also extended to >> disable software boosting, when thermal trip point is reached. After >> cooling down the boost can be enabled again. This emulates behaviour >> similar to HW managed boost (like x86) >> >> Tested at HW: >> Exynos 4412 3.13-rc2 Linux >> Intel Core i7-3770 3.13-rc2 Linux >> >> Above patches were posted on top of kernel_pm/bleeding-edge >> (SHA1: 9483a9f69d5c8f83f1723361bf8340ddfb6475b4) >> > > Rafael, could you pull patches from 1 to 6 of this series? Those are > related to cpufreq core and has already been accepted by Viresh at a > late August this year. > This would facilitate my further cpufreq work. > > And about the last patch - related to thermal. It seems that more > discussion NOT related to cpufreq will be ongoing. > > I would prefer to add it as a separate patch to thermal subtree. I agree with Lukasz here. The part that touches the thermal driver is minimal and the discussion is a simple matter of concept and optimization of data structures. > > > >> >> Lukasz Majewski (7): >> cpufreq: Add boost frequency support in core >> cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common >> boost solution >> cpufreq:boost:Kconfig: Provide support for software managed BOOST >> cpufreq:exynos:Extend Exynos cpufreq driver to support boost >> framework >> Documentation:cpufreq:boost: Update BOOST documentation >> cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ >> thermal:exynos:boost: Automatic enable/disable of BOOST feature (at >> Exynos4412) >> >> Documentation/cpu-freq/boost.txt | 26 +++---- >> drivers/cpufreq/Kconfig | 4 + >> drivers/cpufreq/Kconfig.arm | 15 ++++ >> drivers/cpufreq/acpi-cpufreq.c | 86 >> +++++++-------------- drivers/cpufreq/cpufreq.c | >> 118 ++++++++++++++++++++++++++++- >> drivers/cpufreq/exynos-cpufreq.c | 3 + >> drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- >> drivers/cpufreq/freq_table.c | 56 ++++++++++++-- >> drivers/thermal/samsung/exynos_tmu_data.c | 47 ++++++++++++ >> include/linux/cpufreq.h | 24 ++++++ 10 files >> changed, 302 insertions(+), 79 deletions(-) >> > > > -- You have got to be excited about what you are doing. (L. Lamport) Eduardo Valentin [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 295 bytes --] ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support 2013-12-04 14:12 ` Eduardo Valentin @ 2013-12-09 10:04 ` Lukasz Majewski 0 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-09 10:04 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Eduardo Valentin, Viresh Kumar, Zhang Rui, cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc Hi Rafael, > On 04-12-2013 02:59, Lukasz Majewski wrote: > > Hi Rafael, > > > >> This patch series introduces support for CPU overclocking technique > >> called Boost. > >> > >> It is a follow up of a LAB governor proposal. Boost is a LAB > >> component: > >> http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq > >> > >> Boost unifies hardware based solution (e.g. Intel Nehalem) with > >> software oriented one (like the one done at Exynos). > >> For this reason cpufreq/freq_table code has been reorganized to > >> include common code. > >> > >> Important design decisions: > >> - Boost related code is compiled-in unconditionally to cpufreq core > >> and disabled by default. The cpufreq_driver is responsibile for > >> setting boost_supported flag and providing set_boost callback(if HW > >> support is needed). For software managed boost, special Kconfig > >> flag - CONFIG_CPU_FREQ_BOOST_SW has been defined. It will be > >> selected only when a target platform has thermal framework > >> properly configured. > >> > >> - struct cpufreq_driver has been extended with boost related > >> fields: -- boost_supported - when driver supports boosting > >> -- boost_enabled - boost state > >> -- set_boost - callback to function, which is necessary to > >> enable/disable boost > >> > >> - Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) is > >> visible _only_ when cpufreq driver supports Boost. > >> > >> - No special spin_lock for Boost was created. The one from cpufreq > >> core was reused. > >> > >> - The Boost code doesn't rely on any policy. When boost state is > >> changed, then the policy list is iterated and proper adjustements > >> are done. > >> > >> - To improve safety level, the thermal framework is also extended > >> to disable software boosting, when thermal trip point is reached. > >> After cooling down the boost can be enabled again. This emulates > >> behaviour similar to HW managed boost (like x86) > >> > >> Tested at HW: > >> Exynos 4412 3.13-rc2 Linux > >> Intel Core i7-3770 3.13-rc2 Linux > >> > >> Above patches were posted on top of kernel_pm/bleeding-edge > >> (SHA1: 9483a9f69d5c8f83f1723361bf8340ddfb6475b4) > >> > > > > Rafael, could you pull patches from 1 to 6 of this series? Those are > > related to cpufreq core and has already been accepted by Viresh at a > > late August this year. > > This would facilitate my further cpufreq work. > > > > And about the last patch - related to thermal. It seems that more > > discussion NOT related to cpufreq will be ongoing. > > > > I would prefer to add it as a separate patch to thermal subtree. > > I agree with Lukasz here. The part that touches the thermal driver is > minimal and the discussion is a simple matter of concept and > optimization of data structures. Rafael, what is your opinion here? Shall I prepare another resend (without thermal patch) or would you accept the cpufreq part of this patch set (1 to 6) as is? > > > > > > > > >> > >> Lukasz Majewski (7): > >> cpufreq: Add boost frequency support in core > >> cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with > >> common boost solution > >> cpufreq:boost:Kconfig: Provide support for software managed BOOST > >> cpufreq:exynos:Extend Exynos cpufreq driver to support boost > >> framework > >> Documentation:cpufreq:boost: Update BOOST documentation > >> cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ > >> thermal:exynos:boost: Automatic enable/disable of BOOST feature > >> (at Exynos4412) > >> > >> Documentation/cpu-freq/boost.txt | 26 +++---- > >> drivers/cpufreq/Kconfig | 4 + > >> drivers/cpufreq/Kconfig.arm | 15 ++++ > >> drivers/cpufreq/acpi-cpufreq.c | 86 > >> +++++++-------------- drivers/cpufreq/cpufreq.c | > >> 118 ++++++++++++++++++++++++++++- > >> drivers/cpufreq/exynos-cpufreq.c | 3 + > >> drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- > >> drivers/cpufreq/freq_table.c | 56 ++++++++++++-- > >> drivers/thermal/samsung/exynos_tmu_data.c | 47 ++++++++++++ > >> include/linux/cpufreq.h | 24 ++++++ 10 files > >> changed, 302 insertions(+), 79 deletions(-) > >> > > > > > > > > -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group ^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH v11 0/7] cpufreq:boost: CPU Boost mode support [not found] <1370502472-7249-1-git-send-email-l.majewski@samsung.com> 2013-12-02 12:19 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski @ 2013-12-13 16:38 ` Lukasz Majewski 2013-12-13 16:38 ` [PATCH v11 1/7] cpufreq: Add boost frequency support in core Lukasz Majewski ` (6 more replies) 2013-12-20 14:24 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski 2 siblings, 7 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-13 16:38 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc This patch series introduces support for CPU overclocking technique called Boost. It is a follow up of a LAB governor proposal. Boost is a LAB component: http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq Boost unifies hardware based solution (e.g. Intel Nehalem) with software oriented one (like the one done at Exynos). For this reason cpufreq/freq_table code has been reorganized to include common code. Important design decisions: - Boost related code is compiled-in unconditionally to cpufreq core and disabled by default. The cpufreq_driver is responsibile for setting boost_supported flag and providing set_boost callback(if HW support is needed). For software managed boost, special Kconfig flag - CONFIG_CPU_FREQ_BOOST_SW has been defined. It will be selected only when a target platform has thermal framework properly configured. - struct cpufreq_driver has been extended with boost related fields: -- boost_supported - when driver supports boosting -- boost_enabled - boost state -- set_boost - callback to function, which is necessary to enable/disable boost - Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) is visible _only_ when cpufreq driver supports Boost. - No special spin_lock for Boost was created. The one from cpufreq core was reused. - The Boost code doesn't rely on any policy. When boost state is changed, then the policy list is iterated and proper adjustements are done. - To improve safety level, the thermal framework is also extended to disable software boosting, when thermal trip point is reached. After cooling down the boost can be enabled again. This emulates behaviour similar to HW managed boost (like x86) Tested at HW: Exynos 4412 3.13-rc3 Linux Intel Core i7-3770 3.13-rc3 Linux Above patches were posted on top of kernel_pm/bleeding-edge (SHA1: 2e4bc4515a6143c8c2af037236199eb95f834b40) Lukasz Majewski (7): cpufreq: Add boost frequency support in core cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution cpufreq:boost:Kconfig: Provide support for software managed BOOST cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework Documentation:cpufreq:boost: Update BOOST documentation cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Documentation/cpu-freq/boost.txt | 26 +++---- drivers/cpufreq/Kconfig | 4 + drivers/cpufreq/Kconfig.arm | 15 ++++ drivers/cpufreq/acpi-cpufreq.c | 86 +++++++-------------- drivers/cpufreq/cpufreq.c | 118 ++++++++++++++++++++++++++++- drivers/cpufreq/exynos-cpufreq.c | 3 + drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- drivers/cpufreq/freq_table.c | 56 ++++++++++++-- drivers/thermal/samsung/exynos_tmu_data.c | 12 +-- include/linux/cpufreq.h | 24 ++++++ 10 files changed, 261 insertions(+), 85 deletions(-) -- 1.7.10.4 ^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH v11 1/7] cpufreq: Add boost frequency support in core 2013-12-13 16:38 ` [PATCH v11 " Lukasz Majewski @ 2013-12-13 16:38 ` Lukasz Majewski 2013-12-13 16:38 ` [PATCH v11 2/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution Lukasz Majewski ` (5 subsequent siblings) 6 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-13 16:38 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc This commit adds boost frequency support in cpufreq core (Hardware & Software). Some SoCs (like Exynos4 - e.g. 4x12) allow setting frequency above its normal operation limits. Such mode shall be only used for a short time. Overclocking (boost) support is essentially provided by platform dependent cpufreq driver. This commit unifies support for SW and HW (Intel) overclocking solutions in the core cpufreq driver. Previously the "boost" sysfs attribute was defined at acpi driver code. By default boost is disabled. One global attribute is available at: /sys/devices/system/cpu/cpufreq/boost. It only shows up when cpufreq driver supports overclocking. Under the hood frequencies dedicated for boosting are marked with a special flag (CPUFREQ_BOOST_FREQ) at driver's frequency table. It is the user's concern to enable/disable overclocking with a proper call to sysfs. The cpufreq_boost_trigger_state() function is defined non static on purpose. It is used later with thermal subsystem to provide automatic enable/disable of the BOOST feature. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v11: - None Changes for v10: - None Changes for v9: - Add cpufreq_freq_attr_scaling_boost_freqs to *cpufreq_generic_attr table - Introduce CONFIG_CPU_FREQ_BOOST_SW generic config flag to show BOOST frequencies only when cpufreq driver supports boost Changes for v8: - Correction of error message at cpufreq_boost_trigger_state() function - Rewrite the cpufreq_boost_set_sw() function to print error message and break the loop when policy adjustment fails Changes for v7: - Properly change cpufreq_driver->boost_enabled when set_boost() fails (=0 to =!state) - Add likely() around cpufreq_driver - Remove parenthesis around boost.attr Changes for v6: - Remove sysfs boost attribute when subsys_iterface_unregister() fails - Move global boost_enabled variable from cpufreq.c to platform dependent struct cpufreq_driver - pr_err() message is also printed when boost disable fails - Call __cpufreq_governor() to force recalculation of next frequency when boost is triggered. It is needed with i.e. performance class of governors - Change cpufreq_boost_enable_sw() -> cpufreq_boost_set_sw() - Rename .enable_boost function pointer to .set_boost Changes for v5: - Rename cpufreq_boost_trigger_state_sw() to cpufreq_boost_enable_sw() - Extent cpufreq_register_driver() to check if cpufreq driver provided boost_enable callback. If not provided, then use cpufreq_boost_enable_sw() - Use single call to cpufreq_driver->enable_boost() with cpufreq driver provided callback or default SW boost enable routine - Move pr_debug call to store_boost() from cpufreq_boost_trigger_state() - Change the user_policy.max value when SW boost is toggled. It is necessary for proper operation of e.g. thermal subsystem. - Add check if cpufreq_driver pointer is not NULL at cpufreq_boost_supported() routine - Add EXPORT_SYMBOL_GPL for cpufreq_boost_supported() and cpufreq_boost_enabled() - Remove extra check for cpufreq_boost_supported() at cpufreq_freq_table_cpuinfo() - Explanation of show boost logic at show_available_freqs() - Add cpufreq_set_boost_enabled() method to set initial value of boost_enabled global flag Changes for v4: - Remove boost parameter from cpufreq_frequency_table_cpuinfo() function - Introduce cpufreq_boost_supported() method - Use of cpufreq_boost_supported() and cpufreq_boost_enabled() to decide if frequency shall be skipped - Rename set_boost_freq() to enable_boost() - cpufreq_attr_available_freq() moved to freq_table.c - Use policy list to get access to cpufreq policies - Rename global boost flag (cpufreq_boost_enabled -> boost_enabled) - pr_err corrected ( %sable) - Remove sanity check at cpufreq_boost_trigger_state() entrance [to test if boost is supported] - Use either HW (boost_enable) callback or SW managed boost - Introduce new cpufreq_boost_trigger_state_sw() method to handle boost at SW. - Protect boost_enabled manipulation with lock. Changes for v3: - Method for reading boost status - Removal of cpufreq_frequency_table_max() - Extent cpufreq_frequency_table_cpuinfo() to support boost parameter - boost_supported flag added to cpufreq_driver struct - "boost" sysfs attribute control flag removed - One global flag describing state of the boost defined at cpufreq core - Rename cpufreq_driver's low_level_boost field to set_boost_freq() - Usage of cpufreq_sysfs_{remove|add}_file() routines Changes for v2: - Removal of cpufreq_boost structure and move its fields to cpufreq_driver structure - Flag to indicate if global boost attribute is already defined - Extent the pr_{err|debbug} functions to show current function names drivers/cpufreq/cpufreq.c | 118 +++++++++++++++++++++++++++++++++++++++++- drivers/cpufreq/freq_table.c | 56 +++++++++++++++++--- include/linux/cpufreq.h | 24 +++++++++ 3 files changed, 190 insertions(+), 8 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 02d534d..33774cc 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -324,6 +324,33 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition); /********************************************************************* * SYSFS INTERFACE * *********************************************************************/ +ssize_t show_boost(struct kobject *kobj, + struct attribute *attr, char *buf) +{ + return sprintf(buf, "%d\n", cpufreq_driver->boost_enabled); +} + +static ssize_t store_boost(struct kobject *kobj, struct attribute *attr, + const char *buf, size_t count) +{ + int ret, enable; + + ret = sscanf(buf, "%d", &enable); + if (ret != 1 || enable < 0 || enable > 1) + return -EINVAL; + + if (cpufreq_boost_trigger_state(enable)) { + pr_err("%s: Cannot %s BOOST!\n", __func__, + enable ? "enable" : "disable"); + return -EINVAL; + } + + pr_debug("%s: cpufreq BOOST %s\n", __func__, + enable ? "enabled" : "disabled"); + + return count; +} +define_one_global_rw(boost); static struct cpufreq_governor *__find_governor(const char *str_governor) { @@ -2106,6 +2133,73 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = { }; /********************************************************************* + * BOOST * + *********************************************************************/ +static int cpufreq_boost_set_sw(int state) +{ + struct cpufreq_frequency_table *freq_table; + struct cpufreq_policy *policy; + int ret = -EINVAL; + + list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { + freq_table = cpufreq_frequency_get_table(policy->cpu); + if (freq_table) { + ret = cpufreq_frequency_table_cpuinfo(policy, + freq_table); + if (ret) { + pr_err("%s: Policy frequency update failed\n", + __func__); + break; + } + policy->user_policy.max = policy->max; + __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS); + } + } + + return ret; +} + +int cpufreq_boost_trigger_state(int state) +{ + unsigned long flags; + int ret = 0; + + if (cpufreq_driver->boost_enabled == state) + return 0; + + write_lock_irqsave(&cpufreq_driver_lock, flags); + cpufreq_driver->boost_enabled = state; + write_unlock_irqrestore(&cpufreq_driver_lock, flags); + + ret = cpufreq_driver->set_boost(state); + if (ret) { + write_lock_irqsave(&cpufreq_driver_lock, flags); + cpufreq_driver->boost_enabled = !state; + write_unlock_irqrestore(&cpufreq_driver_lock, flags); + + pr_err("%s: Cannot %s BOOST\n", __func__, + state ? "enable" : "disable"); + } + + return ret; +} + +int cpufreq_boost_supported(void) +{ + if (likely(cpufreq_driver)) + return cpufreq_driver->boost_supported; + + return 0; +} +EXPORT_SYMBOL_GPL(cpufreq_boost_supported); + +int cpufreq_boost_enabled(void) +{ + return cpufreq_driver->boost_enabled; +} +EXPORT_SYMBOL_GPL(cpufreq_boost_enabled); + +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/ @@ -2145,9 +2239,25 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data; write_unlock_irqrestore(&cpufreq_driver_lock, flags); + if (cpufreq_boost_supported()) { + /* + * Check if driver provides function to enable boost - + * if not, use cpufreq_boost_set_sw as default + */ + if (!cpufreq_driver->set_boost) + cpufreq_driver->set_boost = cpufreq_boost_set_sw; + + ret = cpufreq_sysfs_create_file(&boost.attr); + if (ret) { + pr_err("%s: cannot register global BOOST sysfs file\n", + __func__); + goto err_null_driver; + } + } + ret = subsys_interface_register(&cpufreq_interface); if (ret) - goto err_null_driver; + goto err_boost_unreg; if (!(cpufreq_driver->flags & CPUFREQ_STICKY)) { int i; @@ -2174,6 +2284,9 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) return 0; err_if_unreg: subsys_interface_unregister(&cpufreq_interface); +err_boost_unreg: + if (cpufreq_boost_supported()) + cpufreq_sysfs_remove_file(&boost.attr); err_null_driver: write_lock_irqsave(&cpufreq_driver_lock, flags); cpufreq_driver = NULL; @@ -2200,6 +2313,9 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) pr_debug("unregistering driver %s\n", driver->name); subsys_interface_unregister(&cpufreq_interface); + if (cpufreq_boost_supported()) + cpufreq_sysfs_remove_file(&boost.attr); + unregister_hotcpu_notifier(&cpufreq_cpu_notifier); down_write(&cpufreq_rwsem); diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index 3458d27..776e88a 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c @@ -32,6 +32,10 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, continue; } + if (!cpufreq_boost_enabled() + && table[i].driver_data == CPUFREQ_BOOST_FREQ) + continue; + pr_debug("table entry %u: %u kHz, %u driver_data\n", i, freq, table[i].driver_data); if (freq < min_freq) @@ -182,7 +186,8 @@ static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table); /** * show_available_freqs - show available frequencies for the specified CPU */ -static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) +static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf, + bool show_boost) { unsigned int i = 0; unsigned int cpu = policy->cpu; @@ -197,6 +202,20 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { if (table[i].frequency == CPUFREQ_ENTRY_INVALID) continue; + /* + * show_boost = true and driver_data = BOOST freq + * display BOOST freqs + * + * show_boost = false and driver_data = BOOST freq + * show_boost = true and driver_data != BOOST freq + * continue - do not display anything + * + * show_boost = false and driver_data != BOOST freq + * display NON BOOST freqs + */ + if (show_boost ^ (table[i].driver_data == CPUFREQ_BOOST_FREQ)) + continue; + count += sprintf(&buf[count], "%d ", table[i].frequency); } count += sprintf(&buf[count], "\n"); @@ -205,16 +224,39 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) } -struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { - .attr = { .name = "scaling_available_frequencies", - .mode = 0444, - }, - .show = show_available_freqs, -}; +#define cpufreq_attr_available_freq(_name) \ +struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ +__ATTR_RO(_name##_frequencies) + +/** + * show_scaling_available_frequencies - show available normal frequencies for + * the specified CPU + */ +static ssize_t scaling_available_frequencies_show(struct cpufreq_policy *policy, + char *buf) +{ + return show_available_freqs(policy, buf, false); +} +cpufreq_attr_available_freq(scaling_available); EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs); +/** + * show_available_boost_freqs - show available boost frequencies for + * the specified CPU + */ +static ssize_t scaling_boost_frequencies_show(struct cpufreq_policy *policy, + char *buf) +{ + return show_available_freqs(policy, buf, true); +} +cpufreq_attr_available_freq(scaling_boost); +EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_boost_freqs); + struct freq_attr *cpufreq_generic_attr[] = { &cpufreq_freq_attr_scaling_available_freqs, +#ifdef CONFIG_CPU_FREQ_BOOST_SW + &cpufreq_freq_attr_scaling_boost_freqs, +#endif NULL, }; EXPORT_SYMBOL_GPL(cpufreq_generic_attr); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index dc196bb..a0cbb7c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -225,6 +225,11 @@ struct cpufreq_driver { int (*suspend) (struct cpufreq_policy *policy); int (*resume) (struct cpufreq_policy *policy); struct freq_attr **attr; + + /* platform specific boost support code */ + bool boost_supported; + bool boost_enabled; + int (*set_boost) (int state); }; /* flags */ @@ -420,6 +425,7 @@ extern struct cpufreq_governor cpufreq_gov_conservative; #define CPUFREQ_ENTRY_INVALID ~0 #define CPUFREQ_TABLE_END ~1 +#define CPUFREQ_BOOST_FREQ ~2 struct cpufreq_frequency_table { unsigned int driver_data; /* driver specific data, not used by core */ @@ -443,6 +449,24 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy); ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf); +#ifdef CONFIG_CPU_FREQ +int cpufreq_boost_trigger_state(int state); +int cpufreq_boost_supported(void); +int cpufreq_boost_enabled(void); +#else +static inline int cpufreq_boost_trigger_state(int state) +{ + return 0; +} +static inline int cpufreq_boost_supported(void) +{ + return 0; +} +static inline int cpufreq_boost_enabled(void) +{ + return 0; +} +#endif /* the following funtion is for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v11 2/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution 2013-12-13 16:38 ` [PATCH v11 " Lukasz Majewski 2013-12-13 16:38 ` [PATCH v11 1/7] cpufreq: Add boost frequency support in core Lukasz Majewski @ 2013-12-13 16:38 ` Lukasz Majewski 2013-12-13 16:38 ` [PATCH v11 3/7] cpufreq:boost:Kconfig: Provide support for software managed BOOST Lukasz Majewski ` (4 subsequent siblings) 6 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-13 16:38 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc The Intel's hardware based boost solution driver has been changed to cooperate with common cpufreq boost framework. The global sysfs boost attribute entry code (/sys/devices/system/cpu/cpufreq/boost) has been moved to a core cpufreq code. This attribute is now only visible, when cpufreq driver supports it. The _store_boost() function has been redesigned to be used as set_boost callback. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v11: - None Changes for v10: - None Changes for v9: - None Changes for v8: - None Changes for v7: - Remove superfluous acpi_cpufreq_driver.boost_supported = false at acpi_cpufreq_boost_init() Changes for v6: - Perform acpi_cpufreq_boost_init initialization before cpufreq_driver registration - Compile store_boost() only when CONFIG_X86_ACPI_CPUFREQ_CPB defined - Use boost_enabled flag defined at acpi_cpufreq_driver to store information about boost state - Instead of using cpufreq_set_boost_enabled(), modify the boost_enable in the acpi driver code Changes for v5: - Remove acpi-cpufreq's boost_enabled global flag and reuse one defined at cpufreq core Changes for v4: - add _store_boost to acpi_cpufreq_driver structure Changes for v3: - Bring back boost_enabled as a global flag - Move boost_supported to cpufreq_driver structure Changes for v2: - Replace boost_enabled and boost_supported global flags with proper entries at struct cpufreq_driver. - Removal of struct cpufreq_boost drivers/cpufreq/acpi-cpufreq.c | 86 ++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 57 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index caf41eb..79e5608 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -80,7 +80,6 @@ static struct acpi_processor_performance __percpu *acpi_perf_data; static struct cpufreq_driver acpi_cpufreq_driver; static unsigned int acpi_pstate_strict; -static bool boost_enabled, boost_supported; static struct msr __percpu *msrs; static bool boost_state(unsigned int cpu) @@ -133,49 +132,16 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask) wrmsr_on_cpus(cpumask, msr_addr, msrs); } -static ssize_t _store_boost(const char *buf, size_t count) +static int _store_boost(int val) { - int ret; - unsigned long val = 0; - - if (!boost_supported) - return -EINVAL; - - ret = kstrtoul(buf, 10, &val); - if (ret || (val > 1)) - return -EINVAL; - - if ((val && boost_enabled) || (!val && !boost_enabled)) - return count; - get_online_cpus(); - boost_set_msrs(val, cpu_online_mask); - put_online_cpus(); - - boost_enabled = val; pr_debug("Core Boosting %sabled.\n", val ? "en" : "dis"); - return count; -} - -static ssize_t store_global_boost(struct kobject *kobj, struct attribute *attr, - const char *buf, size_t count) -{ - return _store_boost(buf, count); -} - -static ssize_t show_global_boost(struct kobject *kobj, - struct attribute *attr, char *buf) -{ - return sprintf(buf, "%u\n", boost_enabled); + return 0; } -static struct global_attr global_boost = __ATTR(boost, 0644, - show_global_boost, - store_global_boost); - static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf) { struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu); @@ -186,15 +152,32 @@ static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf) cpufreq_freq_attr_ro(freqdomain_cpus); #ifdef CONFIG_X86_ACPI_CPUFREQ_CPB +static ssize_t store_boost(const char *buf, size_t count) +{ + int ret; + unsigned long val = 0; + + if (!acpi_cpufreq_driver.boost_supported) + return -EINVAL; + + ret = kstrtoul(buf, 10, &val); + if (ret || (val > 1)) + return -EINVAL; + + _store_boost((int) val); + + return count; +} + static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf, size_t count) { - return _store_boost(buf, count); + return store_boost(buf, count); } static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf) { - return sprintf(buf, "%u\n", boost_enabled); + return sprintf(buf, "%u\n", acpi_cpufreq_driver.boost_enabled); } cpufreq_freq_attr_rw(cpb); @@ -554,7 +537,7 @@ static int boost_notify(struct notifier_block *nb, unsigned long action, switch (action) { case CPU_UP_PREPARE: case CPU_UP_PREPARE_FROZEN: - boost_set_msrs(boost_enabled, cpumask); + boost_set_msrs(acpi_cpufreq_driver.boost_enabled, cpumask); break; case CPU_DOWN_PREPARE: @@ -911,6 +894,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = { .resume = acpi_cpufreq_resume, .name = "acpi-cpufreq", .attr = acpi_cpufreq_attr, + .set_boost = _store_boost, }; static void __init acpi_cpufreq_boost_init(void) @@ -921,33 +905,22 @@ static void __init acpi_cpufreq_boost_init(void) if (!msrs) return; - boost_supported = true; - boost_enabled = boost_state(0); - + acpi_cpufreq_driver.boost_supported = true; + acpi_cpufreq_driver.boost_enabled = boost_state(0); get_online_cpus(); /* Force all MSRs to the same value */ - boost_set_msrs(boost_enabled, cpu_online_mask); + boost_set_msrs(acpi_cpufreq_driver.boost_enabled, + cpu_online_mask); register_cpu_notifier(&boost_nb); put_online_cpus(); - } else - global_boost.attr.mode = 0444; - - /* We create the boost file in any case, though for systems without - * hardware support it will be read-only and hardwired to return 0. - */ - if (cpufreq_sysfs_create_file(&(global_boost.attr))) - pr_warn(PFX "could not register global boost sysfs file\n"); - else - pr_debug("registered global boost sysfs file\n"); + } } static void __exit acpi_cpufreq_boost_exit(void) { - cpufreq_sysfs_remove_file(&(global_boost.attr)); - if (msrs) { unregister_cpu_notifier(&boost_nb); @@ -993,12 +966,11 @@ static int __init acpi_cpufreq_init(void) *iter = &cpb; } #endif + acpi_cpufreq_boost_init(); ret = cpufreq_register_driver(&acpi_cpufreq_driver); if (ret) free_acpi_perf_data(); - else - acpi_cpufreq_boost_init(); return ret; } -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v11 3/7] cpufreq:boost:Kconfig: Provide support for software managed BOOST 2013-12-13 16:38 ` [PATCH v11 " Lukasz Majewski 2013-12-13 16:38 ` [PATCH v11 1/7] cpufreq: Add boost frequency support in core Lukasz Majewski 2013-12-13 16:38 ` [PATCH v11 2/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution Lukasz Majewski @ 2013-12-13 16:38 ` Lukasz Majewski 2013-12-13 16:38 ` [PATCH v11 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework Lukasz Majewski ` (3 subsequent siblings) 6 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-13 16:38 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc For safety reasons new flag - CONFIG_CPU_FREQ_BOOST_SW has been added. Only after selecting "EXYNOS Frequency Overclocking - Software" Kconfig option the software managed boost is enabled. It also selects thermal subsystem to be compiled in. Thermal is necessary for disabling boost and cooling down the device when overheating detected. Boost _MUST_NOT_ work without thermal subsystem with properly defined overheating temperatures. This option doesn't affect x86's ACPI hardware managed boost support (i.e. Intel, AMD). In this situation boost management is embedded at hardware. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v11: - None Changes for v10: - None Changes for v9: - None Changes for v8: - None Changes for v7: - Remove superfluous "default n" definition - Generic CPU_FREQ_BOOST_SW depends on THERMAL Changes for v6: - CPU_FREQ_BOOST_SW [1] is now defined as "invisible" bool option. - Platform dependent ARM_EXYNOS_CPU_FREQ_BOOST_SW config option has been added. It depends on ARM_EXYNOS_CPUFREQ options and selects EXYNOS_THERMAL with the main boost config [1]. Changes for v5: - New patch drivers/cpufreq/Kconfig | 4 ++++ drivers/cpufreq/Kconfig.arm | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 38093e2..c8818c1 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig @@ -20,6 +20,10 @@ if CPU_FREQ config CPU_FREQ_GOV_COMMON bool +config CPU_FREQ_BOOST_SW + bool + depends on THERMAL + config CPU_FREQ_STAT tristate "CPU frequency translation statistics" default y diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index ce52ed9..25599d6 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm @@ -64,6 +64,21 @@ config ARM_EXYNOS5440_CPUFREQ If in doubt, say N. +config ARM_EXYNOS_CPU_FREQ_BOOST_SW + bool "EXYNOS Frequency Overclocking - Software" + depends on ARM_EXYNOS_CPUFREQ + select CPU_FREQ_BOOST_SW + select EXYNOS_THERMAL + help + This driver supports software managed overclocking (BOOST). + It allows usage of special frequencies for Samsung Exynos + processors if thermal conditions are appropriate. + + It reguires, for safe operation, thermal framework with properly + defined trip points. + + If in doubt, say N. + config ARM_HIGHBANK_CPUFREQ tristate "Calxeda Highbank-based" depends on ARCH_HIGHBANK -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v11 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework 2013-12-13 16:38 ` [PATCH v11 " Lukasz Majewski ` (2 preceding siblings ...) 2013-12-13 16:38 ` [PATCH v11 3/7] cpufreq:boost:Kconfig: Provide support for software managed BOOST Lukasz Majewski @ 2013-12-13 16:38 ` Lukasz Majewski 2013-12-13 16:38 ` [PATCH v11 5/7] Documentation:cpufreq:boost: Update BOOST documentation Lukasz Majewski ` (2 subsequent siblings) 6 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-13 16:38 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc The cpufreq_driver's boost_supported flag is true only when boost support is explicitly enabled. Boost related attributes are exported only under the same condition. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v11: - None Changes for v10: - None Changes for v9: - The exynos_cpufreq_attr[] has been replaced by generic_cpufreq_attr[], therefore the cpufreq_freq_attr_scaling_boost_freqs is now added at freq_table.c file. Changes for v8: - None Changes for v7: - Replace CONFIG_CPU_FREQ_BOOST_SW with CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW - Move boost_supported initialization to struct cpufreq_driver exynos_driver Changes for v6: - Replace exynos_driver.boost_supported = 1 to = true - Protect boost attributes export with CONFIG_CPU_FREQ_BOOST_SW Changes for v5: - None Changes for v4: - None Changes for v3: - Remove low level boost code - Move boost management code to cpufreq core code - Use boost_supported flag to indicate if driver supports over clocking Changes for v2: - Removal of struct cpufreq_boost - Removal of the CONFIG_CPU_FREQ_BOOST flag - low_level_boost with valid address when boost is supported drivers/cpufreq/exynos-cpufreq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index f3c2287..3cd6d2e 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c @@ -226,6 +226,9 @@ static struct cpufreq_driver exynos_driver = { .exit = cpufreq_generic_exit, .name = "exynos_cpufreq", .attr = cpufreq_generic_attr, +#ifdef CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW + .boost_supported = true, +#endif #ifdef CONFIG_PM .suspend = exynos_cpufreq_suspend, .resume = exynos_cpufreq_resume, -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v11 5/7] Documentation:cpufreq:boost: Update BOOST documentation 2013-12-13 16:38 ` [PATCH v11 " Lukasz Majewski ` (3 preceding siblings ...) 2013-12-13 16:38 ` [PATCH v11 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework Lukasz Majewski @ 2013-12-13 16:38 ` Lukasz Majewski 2013-12-13 16:38 ` [PATCH v11 6/7] cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ Lukasz Majewski 2013-12-13 16:38 ` [PATCH v11 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Lukasz Majewski 6 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-13 16:38 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc Since the support for software and hardware controlled boosting has been added, the corresponding Documentation entry had been updated. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v11: - None Changes for v10: - None Changes for v9: - None Changes for v8: - None Changes for v7: - None Changes for v6: - None Changes for v5: - New patch Documentation/cpu-freq/boost.txt | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Documentation/cpu-freq/boost.txt b/Documentation/cpu-freq/boost.txt index 9b4edfc..dd62e13 100644 --- a/Documentation/cpu-freq/boost.txt +++ b/Documentation/cpu-freq/boost.txt @@ -17,8 +17,8 @@ Introduction Some CPUs support a functionality to raise the operating frequency of some cores in a multi-core package if certain conditions apply, mostly if the whole chip is not fully utilized and below it's intended thermal -budget. This is done without operating system control by a combination -of hardware and firmware. +budget. The decision about boost disable/enable is made either at hardware +(e.g. x86) or software (e.g ARM). On Intel CPUs this is called "Turbo Boost", AMD calls it "Turbo-Core", in technical documentation "Core performance boost". In Linux we use the term "boost" for convenience. @@ -48,24 +48,24 @@ be desirable: User controlled switch ---------------------- -To allow the user to toggle the boosting functionality, the acpi-cpufreq -driver exports a sysfs knob to disable it. There is a file: +To allow the user to toggle the boosting functionality, the cpufreq core +driver exports a sysfs knob to enable or disable it. There is a file: /sys/devices/system/cpu/cpufreq/boost which can either read "0" (boosting disabled) or "1" (boosting enabled). -Reading the file is always supported, even if the processor does not -support boosting. In this case the file will be read-only and always -reads as "0". Explicitly changing the permissions and writing to that -file anyway will return EINVAL. +The file is exported only when cpufreq driver supports boosting. +Explicitly changing the permissions and writing to that file anyway will +return EINVAL. On supported CPUs one can write either a "0" or a "1" into this file. This will either disable the boost functionality on all cores in the -whole system (0) or will allow the hardware to boost at will (1). +whole system (0) or will allow the software or hardware to boost at will +(1). Writing a "1" does not explicitly boost the system, but just allows the -CPU (and the firmware) to boost at their discretion. Some implementations -take external factors like the chip's temperature into account, so -boosting once does not necessarily mean that it will occur every time -even using the exact same software setup. +CPU to boost at their discretion. Some implementations take external +factors like the chip's temperature into account, so boosting once does +not necessarily mean that it will occur every time even using the exact +same software setup. AMD legacy cpb switch -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v11 6/7] cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ 2013-12-13 16:38 ` [PATCH v11 " Lukasz Majewski ` (4 preceding siblings ...) 2013-12-13 16:38 ` [PATCH v11 5/7] Documentation:cpufreq:boost: Update BOOST documentation Lukasz Majewski @ 2013-12-13 16:38 ` Lukasz Majewski 2013-12-13 16:38 ` [PATCH v11 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Lukasz Majewski 6 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-13 16:38 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc Special driver data flag (CPUFREQ_BOOST_FREQ) has been added to indicate frequency, which can be only enabled for BOOST mode. This frequency shall be used only for limited time, since it might cause target device to overheat. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v11: - None Changes for v10: - None Changes for v9: - None Changes for v8: - None Changes for v7: - None Changes for v6: - New patch drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/exynos4x12-cpufreq.c b/drivers/cpufreq/exynos4x12-cpufreq.c index efad5e6..77ae129 100644 --- a/drivers/cpufreq/exynos4x12-cpufreq.c +++ b/drivers/cpufreq/exynos4x12-cpufreq.c @@ -32,7 +32,7 @@ static unsigned int exynos4x12_volt_table[] = { }; static struct cpufreq_frequency_table exynos4x12_freq_table[] = { - {L0, CPUFREQ_ENTRY_INVALID}, + {CPUFREQ_BOOST_FREQ, 1500 * 1000}, {L1, 1400 * 1000}, {L2, 1300 * 1000}, {L3, 1200 * 1000}, -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v11 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) 2013-12-13 16:38 ` [PATCH v11 " Lukasz Majewski ` (5 preceding siblings ...) 2013-12-13 16:38 ` [PATCH v11 6/7] cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ Lukasz Majewski @ 2013-12-13 16:38 ` Lukasz Majewski 2013-12-19 14:50 ` Eduardo Valentin 6 siblings, 1 reply; 36+ messages in thread From: Lukasz Majewski @ 2013-12-13 16:38 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc This patch provides auto disable/enable operation for boost. It uses already present thermal infrastructure to provide boost hysteresis. The TMU data has been modified to work properly with or without boost. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> --- Changes for v11: - Use only one thermal data set - Adjust Exynos4412 thermal data to work with or without BOOST Changes for v10: - Remove boost related code from thermal_core.c - Use already present thermal infrastructure to provide thermal hysteresis - Introduce special set of TMU data for BOOST Changes for v9: - None Changes for v8: - Move cpufreq_boost_* stub functions definition (needed when cpufreq is not compiled in) to cpufreq.h at cpufreq core support commit Changes for v7: - None Changes for v6: - Disable boost only when supported and enabled - Protect boost related thermal_zone_device struct fields with mutex - Evaluate temperature trend during boost enable decision - Create separate methods to handle boost enable/disable (thermal_boost_{enable|disable}) operations - Boost is disabled at any trip point passage (not only the non critical one) - Add stub definitions for cpufreq boost functions used when CONFIG_CPU_FREQ is NOT defined. Changes for v5: - Move boost disable code from cpu_cooling.c to thermal_core.c (to handle_non_critical_trips) - Extent struct thermal_zone_device by adding overheated bool flag - Implement auto enable of boost after device cools down - Introduce boost_polling flag, which indicates if thermal uses it's predefined pool delay or has woken up thermal workqueue only to wait until device cools down. Changes for v4: - New patch drivers/thermal/samsung/exynos_tmu_data.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c index 073c292..476b768 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c +++ b/drivers/thermal/samsung/exynos_tmu_data.c @@ -131,8 +131,8 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { #define EXYNOS4412_TMU_DATA \ .threshold_falling = 10, \ - .trigger_levels[0] = 85, \ - .trigger_levels[1] = 103, \ + .trigger_levels[0] = 70, \ + .trigger_levels[1] = 95, \ .trigger_levels[2] = 110, \ .trigger_levels[3] = 120, \ .trigger_enable[0] = true, \ @@ -155,12 +155,12 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { .second_point_trim = 85, \ .default_temp_offset = 50, \ .freq_tab[0] = { \ - .freq_clip_max = 800 * 1000, \ - .temp_level = 85, \ + .freq_clip_max = 1400 * 1000, \ + .temp_level = 70, \ }, \ .freq_tab[1] = { \ - .freq_clip_max = 200 * 1000, \ - .temp_level = 103, \ + .freq_clip_max = 400 * 1000, \ + .temp_level = 95, \ }, \ .freq_tab_count = 2, \ .registers = &exynos4412_tmu_registers, \ -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH v11 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) 2013-12-13 16:38 ` [PATCH v11 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Lukasz Majewski @ 2013-12-19 14:50 ` Eduardo Valentin 0 siblings, 0 replies; 36+ messages in thread From: Eduardo Valentin @ 2013-12-19 14:50 UTC (permalink / raw) To: Lukasz Majewski Cc: Viresh Kumar, Rafael J. Wysocki, Zhang Rui, Eduardo Valentin, cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc [-- Attachment #1: Type: text/plain, Size: 3658 bytes --] On 13-12-2013 12:38, Lukasz Majewski wrote: > This patch provides auto disable/enable operation for boost. It uses already > present thermal infrastructure to provide boost hysteresis. > The TMU data has been modified to work properly with or without boost. > > Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> > Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com> Looks better to me now. You might consider refactoring this driver to be frequency independent, if possible. But that is a different subject other than this patch. > > --- > Changes for v11: > - Use only one thermal data set > - Adjust Exynos4412 thermal data to work with or without BOOST > > Changes for v10: > - Remove boost related code from thermal_core.c > - Use already present thermal infrastructure to provide thermal hysteresis > - Introduce special set of TMU data for BOOST > > Changes for v9: > - None > > Changes for v8: > - Move cpufreq_boost_* stub functions definition (needed when cpufreq > is not compiled in) to cpufreq.h at cpufreq core support commit > > Changes for v7: > - None > > Changes for v6: > - Disable boost only when supported and enabled > - Protect boost related thermal_zone_device struct fields with mutex > - Evaluate temperature trend during boost enable decision > - Create separate methods to handle boost enable/disable > (thermal_boost_{enable|disable}) operations > - Boost is disabled at any trip point passage (not only the non critical one) > - Add stub definitions for cpufreq boost functions used when > CONFIG_CPU_FREQ is NOT defined. > > Changes for v5: > - Move boost disable code from cpu_cooling.c to thermal_core.c > (to handle_non_critical_trips) > - Extent struct thermal_zone_device by adding overheated bool flag > - Implement auto enable of boost after device cools down > - Introduce boost_polling flag, which indicates if thermal uses it's predefined > pool delay or has woken up thermal workqueue only to wait until device > cools down. > > Changes for v4: > - New patch > > drivers/thermal/samsung/exynos_tmu_data.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c > index 073c292..476b768 100644 > --- a/drivers/thermal/samsung/exynos_tmu_data.c > +++ b/drivers/thermal/samsung/exynos_tmu_data.c > @@ -131,8 +131,8 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { > > #define EXYNOS4412_TMU_DATA \ > .threshold_falling = 10, \ > - .trigger_levels[0] = 85, \ > - .trigger_levels[1] = 103, \ > + .trigger_levels[0] = 70, \ > + .trigger_levels[1] = 95, \ > .trigger_levels[2] = 110, \ > .trigger_levels[3] = 120, \ > .trigger_enable[0] = true, \ > @@ -155,12 +155,12 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { > .second_point_trim = 85, \ > .default_temp_offset = 50, \ > .freq_tab[0] = { \ > - .freq_clip_max = 800 * 1000, \ > - .temp_level = 85, \ > + .freq_clip_max = 1400 * 1000, \ > + .temp_level = 70, \ > }, \ > .freq_tab[1] = { \ > - .freq_clip_max = 200 * 1000, \ > - .temp_level = 103, \ > + .freq_clip_max = 400 * 1000, \ > + .temp_level = 95, \ > }, \ > .freq_tab_count = 2, \ > .registers = &exynos4412_tmu_registers, \ > -- You have got to be excited about what you are doing. (L. Lamport) Eduardo Valentin [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 295 bytes --] ^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support [not found] <1370502472-7249-1-git-send-email-l.majewski@samsung.com> 2013-12-02 12:19 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski 2013-12-13 16:38 ` [PATCH v11 " Lukasz Majewski @ 2013-12-20 14:24 ` Lukasz Majewski 2013-12-20 14:24 ` [PATCH v12 1/7] cpufreq: Add boost frequency support in core Lukasz Majewski ` (7 more replies) 2 siblings, 8 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-20 14:24 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, Zhang Rui, linux-samsung-soc This patch series introduces support for CPU overclocking technique called Boost. It is a follow up of a LAB governor proposal. Boost is a LAB component: http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq Boost unifies hardware based solution (e.g. Intel Nehalem) with software oriented one (like the one done at Exynos). For this reason cpufreq/freq_table code has been reorganized to include common code. Important design decisions: - Boost related code is compiled-in unconditionally to cpufreq core and disabled by default. The cpufreq_driver is responsibile for setting boost_supported flag and providing set_boost callback(if HW support is needed). For software managed boost, special Kconfig flag - CONFIG_CPU_FREQ_BOOST_SW has been defined. It will be selected only when a target platform has thermal framework properly configured. - struct cpufreq_driver has been extended with boost related fields: -- boost_supported - when driver supports boosting -- boost_enabled - boost state -- set_boost - callback to function, which is necessary to enable/disable boost - Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) is visible _only_ when cpufreq driver supports Boost. - No special spin_lock for Boost was created. The one from cpufreq core was reused. - The Boost code doesn't rely on any policy. When boost state is changed, then the policy list is iterated and proper adjustements are done. - To improve safety level, the thermal framework is also extended to disable software boosting, when thermal trip point is reached. After cooling down the boost can be enabled again. This emulates behaviour similar to HW managed boost (like x86) Tested at HW: Exynos 4412 3.13-rc4 Linux Intel Core i7-3770 3.13-rc4 Linux Above patches were posted on top of kernel_pm/bleeding-edge (SHA1: bd0f3a5d9dce48a917ce1f1047534d79c725149) Lukasz Majewski (7): cpufreq: Add boost frequency support in core cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution cpufreq:boost:Kconfig: Provide support for software managed BOOST cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework Documentation:cpufreq:boost: Update BOOST documentation cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Documentation/cpu-freq/boost.txt | 26 +++---- drivers/cpufreq/Kconfig | 4 + drivers/cpufreq/Kconfig.arm | 15 ++++ drivers/cpufreq/acpi-cpufreq.c | 86 +++++++-------------- drivers/cpufreq/cpufreq.c | 118 ++++++++++++++++++++++++++++- drivers/cpufreq/exynos-cpufreq.c | 3 + drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- drivers/cpufreq/freq_table.c | 56 ++++++++++++-- drivers/thermal/samsung/exynos_tmu_data.c | 12 +-- include/linux/cpufreq.h | 24 ++++++ 10 files changed, 261 insertions(+), 85 deletions(-) -- 1.7.10.4 ^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH v12 1/7] cpufreq: Add boost frequency support in core 2013-12-20 14:24 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski @ 2013-12-20 14:24 ` Lukasz Majewski 2013-12-20 14:24 ` [PATCH v12 2/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution Lukasz Majewski ` (6 subsequent siblings) 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-20 14:24 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, Zhang Rui, linux-samsung-soc This commit adds boost frequency support in cpufreq core (Hardware & Software). Some SoCs (like Exynos4 - e.g. 4x12) allow setting frequency above its normal operation limits. Such mode shall be only used for a short time. Overclocking (boost) support is essentially provided by platform dependent cpufreq driver. This commit unifies support for SW and HW (Intel) overclocking solutions in the core cpufreq driver. Previously the "boost" sysfs attribute was defined at acpi driver code. By default boost is disabled. One global attribute is available at: /sys/devices/system/cpu/cpufreq/boost. It only shows up when cpufreq driver supports overclocking. Under the hood frequencies dedicated for boosting are marked with a special flag (CPUFREQ_BOOST_FREQ) at driver's frequency table. It is the user's concern to enable/disable overclocking with a proper call to sysfs. The cpufreq_boost_trigger_state() function is defined non static on purpose. It is used later with thermal subsystem to provide automatic enable/disable of the BOOST feature. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v12: - None Changes for v11: - None Changes for v10: - None Changes for v9: - Add cpufreq_freq_attr_scaling_boost_freqs to *cpufreq_generic_attr table - Introduce CONFIG_CPU_FREQ_BOOST_SW generic config flag to show BOOST frequencies only when cpufreq driver supports boost Changes for v8: - Correction of error message at cpufreq_boost_trigger_state() function - Rewrite the cpufreq_boost_set_sw() function to print error message and break the loop when policy adjustment fails Changes for v7: - Properly change cpufreq_driver->boost_enabled when set_boost() fails (=0 to =!state) - Add likely() around cpufreq_driver - Remove parenthesis around boost.attr Changes for v6: - Remove sysfs boost attribute when subsys_iterface_unregister() fails - Move global boost_enabled variable from cpufreq.c to platform dependent struct cpufreq_driver - pr_err() message is also printed when boost disable fails - Call __cpufreq_governor() to force recalculation of next frequency when boost is triggered. It is needed with i.e. performance class of governors - Change cpufreq_boost_enable_sw() -> cpufreq_boost_set_sw() - Rename .enable_boost function pointer to .set_boost Changes for v5: - Rename cpufreq_boost_trigger_state_sw() to cpufreq_boost_enable_sw() - Extent cpufreq_register_driver() to check if cpufreq driver provided boost_enable callback. If not provided, then use cpufreq_boost_enable_sw() - Use single call to cpufreq_driver->enable_boost() with cpufreq driver provided callback or default SW boost enable routine - Move pr_debug call to store_boost() from cpufreq_boost_trigger_state() - Change the user_policy.max value when SW boost is toggled. It is necessary for proper operation of e.g. thermal subsystem. - Add check if cpufreq_driver pointer is not NULL at cpufreq_boost_supported() routine - Add EXPORT_SYMBOL_GPL for cpufreq_boost_supported() and cpufreq_boost_enabled() - Remove extra check for cpufreq_boost_supported() at cpufreq_freq_table_cpuinfo() - Explanation of show boost logic at show_available_freqs() - Add cpufreq_set_boost_enabled() method to set initial value of boost_enabled global flag Changes for v4: - Remove boost parameter from cpufreq_frequency_table_cpuinfo() function - Introduce cpufreq_boost_supported() method - Use of cpufreq_boost_supported() and cpufreq_boost_enabled() to decide if frequency shall be skipped - Rename set_boost_freq() to enable_boost() - cpufreq_attr_available_freq() moved to freq_table.c - Use policy list to get access to cpufreq policies - Rename global boost flag (cpufreq_boost_enabled -> boost_enabled) - pr_err corrected ( %sable) - Remove sanity check at cpufreq_boost_trigger_state() entrance [to test if boost is supported] - Use either HW (boost_enable) callback or SW managed boost - Introduce new cpufreq_boost_trigger_state_sw() method to handle boost at SW. - Protect boost_enabled manipulation with lock. Changes for v3: - Method for reading boost status - Removal of cpufreq_frequency_table_max() - Extent cpufreq_frequency_table_cpuinfo() to support boost parameter - boost_supported flag added to cpufreq_driver struct - "boost" sysfs attribute control flag removed - One global flag describing state of the boost defined at cpufreq core - Rename cpufreq_driver's low_level_boost field to set_boost_freq() - Usage of cpufreq_sysfs_{remove|add}_file() routines Changes for v2: - Removal of cpufreq_boost structure and move its fields to cpufreq_driver structure - Flag to indicate if global boost attribute is already defined - Extent the pr_{err|debbug} functions to show current function names drivers/cpufreq/cpufreq.c | 118 +++++++++++++++++++++++++++++++++++++++++- drivers/cpufreq/freq_table.c | 56 +++++++++++++++++--- include/linux/cpufreq.h | 24 +++++++++ 3 files changed, 190 insertions(+), 8 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 02d534d..33774cc 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -324,6 +324,33 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_transition); /********************************************************************* * SYSFS INTERFACE * *********************************************************************/ +ssize_t show_boost(struct kobject *kobj, + struct attribute *attr, char *buf) +{ + return sprintf(buf, "%d\n", cpufreq_driver->boost_enabled); +} + +static ssize_t store_boost(struct kobject *kobj, struct attribute *attr, + const char *buf, size_t count) +{ + int ret, enable; + + ret = sscanf(buf, "%d", &enable); + if (ret != 1 || enable < 0 || enable > 1) + return -EINVAL; + + if (cpufreq_boost_trigger_state(enable)) { + pr_err("%s: Cannot %s BOOST!\n", __func__, + enable ? "enable" : "disable"); + return -EINVAL; + } + + pr_debug("%s: cpufreq BOOST %s\n", __func__, + enable ? "enabled" : "disabled"); + + return count; +} +define_one_global_rw(boost); static struct cpufreq_governor *__find_governor(const char *str_governor) { @@ -2106,6 +2133,73 @@ static struct notifier_block __refdata cpufreq_cpu_notifier = { }; /********************************************************************* + * BOOST * + *********************************************************************/ +static int cpufreq_boost_set_sw(int state) +{ + struct cpufreq_frequency_table *freq_table; + struct cpufreq_policy *policy; + int ret = -EINVAL; + + list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { + freq_table = cpufreq_frequency_get_table(policy->cpu); + if (freq_table) { + ret = cpufreq_frequency_table_cpuinfo(policy, + freq_table); + if (ret) { + pr_err("%s: Policy frequency update failed\n", + __func__); + break; + } + policy->user_policy.max = policy->max; + __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS); + } + } + + return ret; +} + +int cpufreq_boost_trigger_state(int state) +{ + unsigned long flags; + int ret = 0; + + if (cpufreq_driver->boost_enabled == state) + return 0; + + write_lock_irqsave(&cpufreq_driver_lock, flags); + cpufreq_driver->boost_enabled = state; + write_unlock_irqrestore(&cpufreq_driver_lock, flags); + + ret = cpufreq_driver->set_boost(state); + if (ret) { + write_lock_irqsave(&cpufreq_driver_lock, flags); + cpufreq_driver->boost_enabled = !state; + write_unlock_irqrestore(&cpufreq_driver_lock, flags); + + pr_err("%s: Cannot %s BOOST\n", __func__, + state ? "enable" : "disable"); + } + + return ret; +} + +int cpufreq_boost_supported(void) +{ + if (likely(cpufreq_driver)) + return cpufreq_driver->boost_supported; + + return 0; +} +EXPORT_SYMBOL_GPL(cpufreq_boost_supported); + +int cpufreq_boost_enabled(void) +{ + return cpufreq_driver->boost_enabled; +} +EXPORT_SYMBOL_GPL(cpufreq_boost_enabled); + +/********************************************************************* * REGISTER / UNREGISTER CPUFREQ DRIVER * *********************************************************************/ @@ -2145,9 +2239,25 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) cpufreq_driver = driver_data; write_unlock_irqrestore(&cpufreq_driver_lock, flags); + if (cpufreq_boost_supported()) { + /* + * Check if driver provides function to enable boost - + * if not, use cpufreq_boost_set_sw as default + */ + if (!cpufreq_driver->set_boost) + cpufreq_driver->set_boost = cpufreq_boost_set_sw; + + ret = cpufreq_sysfs_create_file(&boost.attr); + if (ret) { + pr_err("%s: cannot register global BOOST sysfs file\n", + __func__); + goto err_null_driver; + } + } + ret = subsys_interface_register(&cpufreq_interface); if (ret) - goto err_null_driver; + goto err_boost_unreg; if (!(cpufreq_driver->flags & CPUFREQ_STICKY)) { int i; @@ -2174,6 +2284,9 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) return 0; err_if_unreg: subsys_interface_unregister(&cpufreq_interface); +err_boost_unreg: + if (cpufreq_boost_supported()) + cpufreq_sysfs_remove_file(&boost.attr); err_null_driver: write_lock_irqsave(&cpufreq_driver_lock, flags); cpufreq_driver = NULL; @@ -2200,6 +2313,9 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) pr_debug("unregistering driver %s\n", driver->name); subsys_interface_unregister(&cpufreq_interface); + if (cpufreq_boost_supported()) + cpufreq_sysfs_remove_file(&boost.attr); + unregister_hotcpu_notifier(&cpufreq_cpu_notifier); down_write(&cpufreq_rwsem); diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index 3458d27..776e88a 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c @@ -32,6 +32,10 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, continue; } + if (!cpufreq_boost_enabled() + && table[i].driver_data == CPUFREQ_BOOST_FREQ) + continue; + pr_debug("table entry %u: %u kHz, %u driver_data\n", i, freq, table[i].driver_data); if (freq < min_freq) @@ -182,7 +186,8 @@ static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table); /** * show_available_freqs - show available frequencies for the specified CPU */ -static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) +static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf, + bool show_boost) { unsigned int i = 0; unsigned int cpu = policy->cpu; @@ -197,6 +202,20 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { if (table[i].frequency == CPUFREQ_ENTRY_INVALID) continue; + /* + * show_boost = true and driver_data = BOOST freq + * display BOOST freqs + * + * show_boost = false and driver_data = BOOST freq + * show_boost = true and driver_data != BOOST freq + * continue - do not display anything + * + * show_boost = false and driver_data != BOOST freq + * display NON BOOST freqs + */ + if (show_boost ^ (table[i].driver_data == CPUFREQ_BOOST_FREQ)) + continue; + count += sprintf(&buf[count], "%d ", table[i].frequency); } count += sprintf(&buf[count], "\n"); @@ -205,16 +224,39 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) } -struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { - .attr = { .name = "scaling_available_frequencies", - .mode = 0444, - }, - .show = show_available_freqs, -}; +#define cpufreq_attr_available_freq(_name) \ +struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ +__ATTR_RO(_name##_frequencies) + +/** + * show_scaling_available_frequencies - show available normal frequencies for + * the specified CPU + */ +static ssize_t scaling_available_frequencies_show(struct cpufreq_policy *policy, + char *buf) +{ + return show_available_freqs(policy, buf, false); +} +cpufreq_attr_available_freq(scaling_available); EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs); +/** + * show_available_boost_freqs - show available boost frequencies for + * the specified CPU + */ +static ssize_t scaling_boost_frequencies_show(struct cpufreq_policy *policy, + char *buf) +{ + return show_available_freqs(policy, buf, true); +} +cpufreq_attr_available_freq(scaling_boost); +EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_boost_freqs); + struct freq_attr *cpufreq_generic_attr[] = { &cpufreq_freq_attr_scaling_available_freqs, +#ifdef CONFIG_CPU_FREQ_BOOST_SW + &cpufreq_freq_attr_scaling_boost_freqs, +#endif NULL, }; EXPORT_SYMBOL_GPL(cpufreq_generic_attr); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index dc196bb..a0cbb7c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -225,6 +225,11 @@ struct cpufreq_driver { int (*suspend) (struct cpufreq_policy *policy); int (*resume) (struct cpufreq_policy *policy); struct freq_attr **attr; + + /* platform specific boost support code */ + bool boost_supported; + bool boost_enabled; + int (*set_boost) (int state); }; /* flags */ @@ -420,6 +425,7 @@ extern struct cpufreq_governor cpufreq_gov_conservative; #define CPUFREQ_ENTRY_INVALID ~0 #define CPUFREQ_TABLE_END ~1 +#define CPUFREQ_BOOST_FREQ ~2 struct cpufreq_frequency_table { unsigned int driver_data; /* driver specific data, not used by core */ @@ -443,6 +449,24 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy); ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf); +#ifdef CONFIG_CPU_FREQ +int cpufreq_boost_trigger_state(int state); +int cpufreq_boost_supported(void); +int cpufreq_boost_enabled(void); +#else +static inline int cpufreq_boost_trigger_state(int state) +{ + return 0; +} +static inline int cpufreq_boost_supported(void) +{ + return 0; +} +static inline int cpufreq_boost_enabled(void) +{ + return 0; +} +#endif /* the following funtion is for cpufreq core use only */ struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v12 2/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution 2013-12-20 14:24 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski 2013-12-20 14:24 ` [PATCH v12 1/7] cpufreq: Add boost frequency support in core Lukasz Majewski @ 2013-12-20 14:24 ` Lukasz Majewski 2013-12-20 14:24 ` [PATCH v12 3/7] cpufreq:boost:Kconfig: Provide support for software managed BOOST Lukasz Majewski ` (5 subsequent siblings) 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-20 14:24 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, Zhang Rui, linux-samsung-soc The Intel's hardware based boost solution driver has been changed to cooperate with common cpufreq boost framework. The global sysfs boost attribute entry code (/sys/devices/system/cpu/cpufreq/boost) has been moved to a core cpufreq code. This attribute is now only visible, when cpufreq driver supports it. The _store_boost() function has been redesigned to be used as set_boost callback. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v12: - None Changes for v11: - None Changes for v10: - None Changes for v9: - None Changes for v8: - None Changes for v7: - Remove superfluous acpi_cpufreq_driver.boost_supported = false at acpi_cpufreq_boost_init() Changes for v6: - Perform acpi_cpufreq_boost_init initialization before cpufreq_driver registration - Compile store_boost() only when CONFIG_X86_ACPI_CPUFREQ_CPB defined - Use boost_enabled flag defined at acpi_cpufreq_driver to store information about boost state - Instead of using cpufreq_set_boost_enabled(), modify the boost_enable in the acpi driver code Changes for v5: - Remove acpi-cpufreq's boost_enabled global flag and reuse one defined at cpufreq core Changes for v4: - add _store_boost to acpi_cpufreq_driver structure Changes for v3: - Bring back boost_enabled as a global flag - Move boost_supported to cpufreq_driver structure Changes for v2: - Replace boost_enabled and boost_supported global flags with proper entries at struct cpufreq_driver. - Removal of struct cpufreq_boost drivers/cpufreq/acpi-cpufreq.c | 86 ++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 57 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index caf41eb..79e5608 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -80,7 +80,6 @@ static struct acpi_processor_performance __percpu *acpi_perf_data; static struct cpufreq_driver acpi_cpufreq_driver; static unsigned int acpi_pstate_strict; -static bool boost_enabled, boost_supported; static struct msr __percpu *msrs; static bool boost_state(unsigned int cpu) @@ -133,49 +132,16 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask) wrmsr_on_cpus(cpumask, msr_addr, msrs); } -static ssize_t _store_boost(const char *buf, size_t count) +static int _store_boost(int val) { - int ret; - unsigned long val = 0; - - if (!boost_supported) - return -EINVAL; - - ret = kstrtoul(buf, 10, &val); - if (ret || (val > 1)) - return -EINVAL; - - if ((val && boost_enabled) || (!val && !boost_enabled)) - return count; - get_online_cpus(); - boost_set_msrs(val, cpu_online_mask); - put_online_cpus(); - - boost_enabled = val; pr_debug("Core Boosting %sabled.\n", val ? "en" : "dis"); - return count; -} - -static ssize_t store_global_boost(struct kobject *kobj, struct attribute *attr, - const char *buf, size_t count) -{ - return _store_boost(buf, count); -} - -static ssize_t show_global_boost(struct kobject *kobj, - struct attribute *attr, char *buf) -{ - return sprintf(buf, "%u\n", boost_enabled); + return 0; } -static struct global_attr global_boost = __ATTR(boost, 0644, - show_global_boost, - store_global_boost); - static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf) { struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu); @@ -186,15 +152,32 @@ static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf) cpufreq_freq_attr_ro(freqdomain_cpus); #ifdef CONFIG_X86_ACPI_CPUFREQ_CPB +static ssize_t store_boost(const char *buf, size_t count) +{ + int ret; + unsigned long val = 0; + + if (!acpi_cpufreq_driver.boost_supported) + return -EINVAL; + + ret = kstrtoul(buf, 10, &val); + if (ret || (val > 1)) + return -EINVAL; + + _store_boost((int) val); + + return count; +} + static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf, size_t count) { - return _store_boost(buf, count); + return store_boost(buf, count); } static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf) { - return sprintf(buf, "%u\n", boost_enabled); + return sprintf(buf, "%u\n", acpi_cpufreq_driver.boost_enabled); } cpufreq_freq_attr_rw(cpb); @@ -554,7 +537,7 @@ static int boost_notify(struct notifier_block *nb, unsigned long action, switch (action) { case CPU_UP_PREPARE: case CPU_UP_PREPARE_FROZEN: - boost_set_msrs(boost_enabled, cpumask); + boost_set_msrs(acpi_cpufreq_driver.boost_enabled, cpumask); break; case CPU_DOWN_PREPARE: @@ -911,6 +894,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = { .resume = acpi_cpufreq_resume, .name = "acpi-cpufreq", .attr = acpi_cpufreq_attr, + .set_boost = _store_boost, }; static void __init acpi_cpufreq_boost_init(void) @@ -921,33 +905,22 @@ static void __init acpi_cpufreq_boost_init(void) if (!msrs) return; - boost_supported = true; - boost_enabled = boost_state(0); - + acpi_cpufreq_driver.boost_supported = true; + acpi_cpufreq_driver.boost_enabled = boost_state(0); get_online_cpus(); /* Force all MSRs to the same value */ - boost_set_msrs(boost_enabled, cpu_online_mask); + boost_set_msrs(acpi_cpufreq_driver.boost_enabled, + cpu_online_mask); register_cpu_notifier(&boost_nb); put_online_cpus(); - } else - global_boost.attr.mode = 0444; - - /* We create the boost file in any case, though for systems without - * hardware support it will be read-only and hardwired to return 0. - */ - if (cpufreq_sysfs_create_file(&(global_boost.attr))) - pr_warn(PFX "could not register global boost sysfs file\n"); - else - pr_debug("registered global boost sysfs file\n"); + } } static void __exit acpi_cpufreq_boost_exit(void) { - cpufreq_sysfs_remove_file(&(global_boost.attr)); - if (msrs) { unregister_cpu_notifier(&boost_nb); @@ -993,12 +966,11 @@ static int __init acpi_cpufreq_init(void) *iter = &cpb; } #endif + acpi_cpufreq_boost_init(); ret = cpufreq_register_driver(&acpi_cpufreq_driver); if (ret) free_acpi_perf_data(); - else - acpi_cpufreq_boost_init(); return ret; } -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v12 3/7] cpufreq:boost:Kconfig: Provide support for software managed BOOST 2013-12-20 14:24 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski 2013-12-20 14:24 ` [PATCH v12 1/7] cpufreq: Add boost frequency support in core Lukasz Majewski 2013-12-20 14:24 ` [PATCH v12 2/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution Lukasz Majewski @ 2013-12-20 14:24 ` Lukasz Majewski 2013-12-20 14:24 ` [PATCH v12 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework Lukasz Majewski ` (4 subsequent siblings) 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-20 14:24 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, Zhang Rui, linux-samsung-soc For safety reasons new flag - CONFIG_CPU_FREQ_BOOST_SW has been added. Only after selecting "EXYNOS Frequency Overclocking - Software" Kconfig option the software managed boost is enabled. It also selects thermal subsystem to be compiled in. Thermal is necessary for disabling boost and cooling down the device when overheating detected. Boost _MUST_NOT_ work without thermal subsystem with properly defined overheating temperatures. This option doesn't affect x86's ACPI hardware managed boost support (i.e. Intel, AMD). In this situation boost management is embedded in hardware. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v12: - None Changes for v11: - None Changes for v10: - None Changes for v9: - None Changes for v8: - None Changes for v7: - Remove superfluous "default n" definition - Generic CPU_FREQ_BOOST_SW depends on THERMAL Changes for v6: - CPU_FREQ_BOOST_SW [1] is now defined as "invisible" bool option. - Platform dependent ARM_EXYNOS_CPU_FREQ_BOOST_SW config option has been added. It depends on ARM_EXYNOS_CPUFREQ options and selects EXYNOS_THERMAL with the main boost config [1]. Changes for v5: - New patch drivers/cpufreq/Kconfig | 4 ++++ drivers/cpufreq/Kconfig.arm | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 38093e2..c8818c1 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig @@ -20,6 +20,10 @@ if CPU_FREQ config CPU_FREQ_GOV_COMMON bool +config CPU_FREQ_BOOST_SW + bool + depends on THERMAL + config CPU_FREQ_STAT tristate "CPU frequency translation statistics" default y diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index ce52ed9..25599d6 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm @@ -64,6 +64,21 @@ config ARM_EXYNOS5440_CPUFREQ If in doubt, say N. +config ARM_EXYNOS_CPU_FREQ_BOOST_SW + bool "EXYNOS Frequency Overclocking - Software" + depends on ARM_EXYNOS_CPUFREQ + select CPU_FREQ_BOOST_SW + select EXYNOS_THERMAL + help + This driver supports software managed overclocking (BOOST). + It allows usage of special frequencies for Samsung Exynos + processors if thermal conditions are appropriate. + + It reguires, for safe operation, thermal framework with properly + defined trip points. + + If in doubt, say N. + config ARM_HIGHBANK_CPUFREQ tristate "Calxeda Highbank-based" depends on ARCH_HIGHBANK -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v12 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework 2013-12-20 14:24 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski ` (2 preceding siblings ...) 2013-12-20 14:24 ` [PATCH v12 3/7] cpufreq:boost:Kconfig: Provide support for software managed BOOST Lukasz Majewski @ 2013-12-20 14:24 ` Lukasz Majewski 2013-12-20 14:24 ` [PATCH v12 5/7] Documentation:cpufreq:boost: Update BOOST documentation Lukasz Majewski ` (3 subsequent siblings) 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-20 14:24 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, Zhang Rui, linux-samsung-soc The cpufreq_driver's boost_supported flag is true only when boost support is explicitly enabled. Boost related attributes are exported only under the same condition. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v12: - None Changes for v11: - None Changes for v10: - None Changes for v9: - The exynos_cpufreq_attr[] has been replaced by generic_cpufreq_attr[], therefore the cpufreq_freq_attr_scaling_boost_freqs is now added at freq_table.c file. Changes for v8: - None Changes for v7: - Replace CONFIG_CPU_FREQ_BOOST_SW with CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW - Move boost_supported initialization to struct cpufreq_driver exynos_driver Changes for v6: - Replace exynos_driver.boost_supported = 1 to = true - Protect boost attributes export with CONFIG_CPU_FREQ_BOOST_SW Changes for v5: - None Changes for v4: - None Changes for v3: - Remove low level boost code - Move boost management code to cpufreq core code - Use boost_supported flag to indicate if driver supports over clocking Changes for v2: - Removal of struct cpufreq_boost - Removal of the CONFIG_CPU_FREQ_BOOST flag - low_level_boost with valid address when boost is supported drivers/cpufreq/exynos-cpufreq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index f3c2287..3cd6d2e 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c @@ -226,6 +226,9 @@ static struct cpufreq_driver exynos_driver = { .exit = cpufreq_generic_exit, .name = "exynos_cpufreq", .attr = cpufreq_generic_attr, +#ifdef CONFIG_ARM_EXYNOS_CPU_FREQ_BOOST_SW + .boost_supported = true, +#endif #ifdef CONFIG_PM .suspend = exynos_cpufreq_suspend, .resume = exynos_cpufreq_resume, -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v12 5/7] Documentation:cpufreq:boost: Update BOOST documentation 2013-12-20 14:24 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski ` (3 preceding siblings ...) 2013-12-20 14:24 ` [PATCH v12 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework Lukasz Majewski @ 2013-12-20 14:24 ` Lukasz Majewski 2013-12-20 14:24 ` [PATCH v12 6/7] cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ Lukasz Majewski ` (2 subsequent siblings) 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-20 14:24 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, Zhang Rui, linux-samsung-soc Since the support for software and hardware controlled boosting has been added, the corresponding Documentation entry had been updated. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v12: - None Changes for v11: - None Changes for v10: - None Changes for v9: - None Changes for v8: - None Changes for v7: - None Changes for v6: - None Changes for v5: - New patch Documentation/cpu-freq/boost.txt | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Documentation/cpu-freq/boost.txt b/Documentation/cpu-freq/boost.txt index 9b4edfc..dd62e13 100644 --- a/Documentation/cpu-freq/boost.txt +++ b/Documentation/cpu-freq/boost.txt @@ -17,8 +17,8 @@ Introduction Some CPUs support a functionality to raise the operating frequency of some cores in a multi-core package if certain conditions apply, mostly if the whole chip is not fully utilized and below it's intended thermal -budget. This is done without operating system control by a combination -of hardware and firmware. +budget. The decision about boost disable/enable is made either at hardware +(e.g. x86) or software (e.g ARM). On Intel CPUs this is called "Turbo Boost", AMD calls it "Turbo-Core", in technical documentation "Core performance boost". In Linux we use the term "boost" for convenience. @@ -48,24 +48,24 @@ be desirable: User controlled switch ---------------------- -To allow the user to toggle the boosting functionality, the acpi-cpufreq -driver exports a sysfs knob to disable it. There is a file: +To allow the user to toggle the boosting functionality, the cpufreq core +driver exports a sysfs knob to enable or disable it. There is a file: /sys/devices/system/cpu/cpufreq/boost which can either read "0" (boosting disabled) or "1" (boosting enabled). -Reading the file is always supported, even if the processor does not -support boosting. In this case the file will be read-only and always -reads as "0". Explicitly changing the permissions and writing to that -file anyway will return EINVAL. +The file is exported only when cpufreq driver supports boosting. +Explicitly changing the permissions and writing to that file anyway will +return EINVAL. On supported CPUs one can write either a "0" or a "1" into this file. This will either disable the boost functionality on all cores in the -whole system (0) or will allow the hardware to boost at will (1). +whole system (0) or will allow the software or hardware to boost at will +(1). Writing a "1" does not explicitly boost the system, but just allows the -CPU (and the firmware) to boost at their discretion. Some implementations -take external factors like the chip's temperature into account, so -boosting once does not necessarily mean that it will occur every time -even using the exact same software setup. +CPU to boost at their discretion. Some implementations take external +factors like the chip's temperature into account, so boosting once does +not necessarily mean that it will occur every time even using the exact +same software setup. AMD legacy cpb switch -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v12 6/7] cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ 2013-12-20 14:24 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski ` (4 preceding siblings ...) 2013-12-20 14:24 ` [PATCH v12 5/7] Documentation:cpufreq:boost: Update BOOST documentation Lukasz Majewski @ 2013-12-20 14:24 ` Lukasz Majewski 2013-12-20 14:24 ` [PATCH v12 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Lukasz Majewski 2014-01-07 6:58 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski 7 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2013-12-20 14:24 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, Zhang Rui, linux-samsung-soc Special driver data flag (CPUFREQ_BOOST_FREQ) has been added to indicate frequency, which can be only enabled for BOOST mode. This frequency shall be used only for limited time, since it might cause target device to overheat. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- Changes for v12: - None Changes for v11: - None Changes for v10: - None Changes for v9: - None Changes for v8: - None Changes for v7: - None Changes for v6: - New patch drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/exynos4x12-cpufreq.c b/drivers/cpufreq/exynos4x12-cpufreq.c index efad5e6..77ae129 100644 --- a/drivers/cpufreq/exynos4x12-cpufreq.c +++ b/drivers/cpufreq/exynos4x12-cpufreq.c @@ -32,7 +32,7 @@ static unsigned int exynos4x12_volt_table[] = { }; static struct cpufreq_frequency_table exynos4x12_freq_table[] = { - {L0, CPUFREQ_ENTRY_INVALID}, + {CPUFREQ_BOOST_FREQ, 1500 * 1000}, {L1, 1400 * 1000}, {L2, 1300 * 1000}, {L3, 1200 * 1000}, -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v12 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) 2013-12-20 14:24 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski ` (5 preceding siblings ...) 2013-12-20 14:24 ` [PATCH v12 6/7] cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ Lukasz Majewski @ 2013-12-20 14:24 ` Lukasz Majewski 2014-01-10 6:35 ` Zhang Rui 2014-01-07 6:58 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski 7 siblings, 1 reply; 36+ messages in thread From: Lukasz Majewski @ 2013-12-20 14:24 UTC (permalink / raw) To: Viresh Kumar, Rafael J. Wysocki, Eduardo Valentin Cc: cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, Zhang Rui, linux-samsung-soc This patch provides auto disable/enable operation for boost. It uses already present thermal infrastructure to provide BOOST hysteresis. The TMU data has been modified to work properly with or without BOOST. Hence, the two first trip points with corresponding clip frequencies were adjusted. The first one was reduced from 85 to 70 degrees and clip frequency was increased to 1.4 GHz from 800 MHz. This trip point is in fact responsible for providing BOOST hysteresis. When temperature exceeds 70 deg, the maximal non BOOST frequency for Exynos4412 is imposed. Since the first trigger level has been "stolen" for BOOST, the second one needs to be a compromise for the previously used two for non BOOST configuration. The 95 deg with modified clip freq (to 400 MHz) shall provide a good balance between cooling down the overheated device and throughput on an acceptable level. Two last trigger levels were not modified since, they cause platform shutdown on emergency overheat situation. Third trip point passage results in SW managed shut down of the system. If the last trip point is crossed, the PMU HW generates the power off signal. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com> --- Changes for v12: - More verbose patch description to explain new TMU temperature assignment for Exynos4412 Changes for v11: - Use only one thermal data set - Adjust Exynos4412 thermal data to work with or without BOOST Changes for v10: - Remove boost related code from thermal_core.c - Use already present thermal infrastructure to provide thermal hysteresis - Introduce special set of TMU data for BOOST Changes for v9: - None Changes for v8: - Move cpufreq_boost_* stub functions definition (needed when cpufreq is not compiled in) to cpufreq.h at cpufreq core support commit Changes for v7: - None Changes for v6: - Disable boost only when supported and enabled - Protect boost related thermal_zone_device struct fields with mutex - Evaluate temperature trend during boost enable decision - Create separate methods to handle boost enable/disable (thermal_boost_{enable|disable}) operations - Boost is disabled at any trip point passage (not only the non critical one) - Add stub definitions for cpufreq boost functions used when CONFIG_CPU_FREQ is NOT defined. Changes for v5: - Move boost disable code from cpu_cooling.c to thermal_core.c (to handle_non_critical_trips) - Extent struct thermal_zone_device by adding overheated bool flag - Implement auto enable of boost after device cools down - Introduce boost_polling flag, which indicates if thermal uses it's predefined pool delay or has woken up thermal workqueue only to wait until device cools down. Changes for v4: - New patch drivers/thermal/samsung/exynos_tmu_data.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c index 073c292..476b768 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c +++ b/drivers/thermal/samsung/exynos_tmu_data.c @@ -131,8 +131,8 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { #define EXYNOS4412_TMU_DATA \ .threshold_falling = 10, \ - .trigger_levels[0] = 85, \ - .trigger_levels[1] = 103, \ + .trigger_levels[0] = 70, \ + .trigger_levels[1] = 95, \ .trigger_levels[2] = 110, \ .trigger_levels[3] = 120, \ .trigger_enable[0] = true, \ @@ -155,12 +155,12 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { .second_point_trim = 85, \ .default_temp_offset = 50, \ .freq_tab[0] = { \ - .freq_clip_max = 800 * 1000, \ - .temp_level = 85, \ + .freq_clip_max = 1400 * 1000, \ + .temp_level = 70, \ }, \ .freq_tab[1] = { \ - .freq_clip_max = 200 * 1000, \ - .temp_level = 103, \ + .freq_clip_max = 400 * 1000, \ + .temp_level = 95, \ }, \ .freq_tab_count = 2, \ .registers = &exynos4412_tmu_registers, \ -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH v12 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) 2013-12-20 14:24 ` [PATCH v12 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Lukasz Majewski @ 2014-01-10 6:35 ` Zhang Rui 0 siblings, 0 replies; 36+ messages in thread From: Zhang Rui @ 2014-01-10 6:35 UTC (permalink / raw) To: Lukasz Majewski Cc: Viresh Kumar, Rafael J. Wysocki, Eduardo Valentin, cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc On Fri, 2013-12-20 at 15:24 +0100, Lukasz Majewski wrote: > This patch provides auto disable/enable operation for boost. It uses already > present thermal infrastructure to provide BOOST hysteresis. > The TMU data has been modified to work properly with or without BOOST. > Hence, the two first trip points with corresponding clip frequencies were > adjusted. > > The first one was reduced from 85 to 70 degrees and clip frequency was > increased to 1.4 GHz from 800 MHz. This trip point is in fact responsible > for providing BOOST hysteresis. When temperature exceeds 70 deg, the maximal > non BOOST frequency for Exynos4412 is imposed. > > Since the first trigger level has been "stolen" for BOOST, the second one > needs to be a compromise for the previously used two for non BOOST > configuration. The 95 deg with modified clip freq (to 400 MHz) shall provide > a good balance between cooling down the overheated device and throughput on > an acceptable level. > > Two last trigger levels were not modified since, they cause platform shutdown > on emergency overheat situation. > Third trip point passage results in SW managed shut down of the system. > If the last trip point is crossed, the PMU HW generates the power off > signal. > > Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> > Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> > Acked-by: Eduardo Valentin <eduardo.valentin@ti.com> Reviewed-by: Zhang Rui <rui.zhang@intel.com> thanks, rui > > --- > Changes for v12: > - More verbose patch description to explain new TMU temperature assignment > for Exynos4412 > > Changes for v11: > - Use only one thermal data set > - Adjust Exynos4412 thermal data to work with or without BOOST > > Changes for v10: > - Remove boost related code from thermal_core.c > - Use already present thermal infrastructure to provide thermal hysteresis > - Introduce special set of TMU data for BOOST > > Changes for v9: > - None > > Changes for v8: > - Move cpufreq_boost_* stub functions definition (needed when cpufreq > is not compiled in) to cpufreq.h at cpufreq core support commit > > Changes for v7: > - None > > Changes for v6: > - Disable boost only when supported and enabled > - Protect boost related thermal_zone_device struct fields with mutex > - Evaluate temperature trend during boost enable decision > - Create separate methods to handle boost enable/disable > (thermal_boost_{enable|disable}) operations > - Boost is disabled at any trip point passage (not only the non critical one) > - Add stub definitions for cpufreq boost functions used when > CONFIG_CPU_FREQ is NOT defined. > > Changes for v5: > - Move boost disable code from cpu_cooling.c to thermal_core.c > (to handle_non_critical_trips) > - Extent struct thermal_zone_device by adding overheated bool flag > - Implement auto enable of boost after device cools down > - Introduce boost_polling flag, which indicates if thermal uses it's predefined > pool delay or has woken up thermal workqueue only to wait until device > cools down. > > Changes for v4: > - New patch > > drivers/thermal/samsung/exynos_tmu_data.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c > index 073c292..476b768 100644 > --- a/drivers/thermal/samsung/exynos_tmu_data.c > +++ b/drivers/thermal/samsung/exynos_tmu_data.c > @@ -131,8 +131,8 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { > > #define EXYNOS4412_TMU_DATA \ > .threshold_falling = 10, \ > - .trigger_levels[0] = 85, \ > - .trigger_levels[1] = 103, \ > + .trigger_levels[0] = 70, \ > + .trigger_levels[1] = 95, \ > .trigger_levels[2] = 110, \ > .trigger_levels[3] = 120, \ > .trigger_enable[0] = true, \ > @@ -155,12 +155,12 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { > .second_point_trim = 85, \ > .default_temp_offset = 50, \ > .freq_tab[0] = { \ > - .freq_clip_max = 800 * 1000, \ > - .temp_level = 85, \ > + .freq_clip_max = 1400 * 1000, \ > + .temp_level = 70, \ > }, \ > .freq_tab[1] = { \ > - .freq_clip_max = 200 * 1000, \ > - .temp_level = 103, \ > + .freq_clip_max = 400 * 1000, \ > + .temp_level = 95, \ > }, \ > .freq_tab_count = 2, \ > .registers = &exynos4412_tmu_registers, \ ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support 2013-12-20 14:24 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski ` (6 preceding siblings ...) 2013-12-20 14:24 ` [PATCH v12 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Lukasz Majewski @ 2014-01-07 6:58 ` Lukasz Majewski 2014-01-08 0:35 ` Rafael J. Wysocki 7 siblings, 1 reply; 36+ messages in thread From: Lukasz Majewski @ 2014-01-07 6:58 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Lukasz Majewski, Viresh Kumar, Eduardo Valentin, cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, Zhang Rui, linux-samsung-soc, rjw Hi Rafael, > This patch series introduces support for CPU overclocking technique > called Boost. > > It is a follow up of a LAB governor proposal. Boost is a LAB > component: > http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq > > Boost unifies hardware based solution (e.g. Intel Nehalem) with > software oriented one (like the one done at Exynos). > For this reason cpufreq/freq_table code has been reorganized to > include common code. > > Important design decisions: > - Boost related code is compiled-in unconditionally to cpufreq core > and disabled by default. The cpufreq_driver is responsibile for > setting boost_supported flag and providing set_boost callback(if HW > support is needed). For software managed boost, special Kconfig flag - > CONFIG_CPU_FREQ_BOOST_SW has been defined. It will be selected only > when a target platform has thermal framework properly configured. > > - struct cpufreq_driver has been extended with boost related fields: > -- boost_supported - when driver supports boosting > -- boost_enabled - boost state > -- set_boost - callback to function, which is necessary to > enable/disable boost > > - Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) is > visible _only_ when cpufreq driver supports Boost. > > - No special spin_lock for Boost was created. The one from cpufreq > core was reused. > > - The Boost code doesn't rely on any policy. When boost state is > changed, then the policy list is iterated and proper adjustements are > done. > > - To improve safety level, the thermal framework is also extended to > disable software boosting, when thermal trip point is reached. After > cooling down the boost can be enabled again. This emulates behaviour > similar to HW managed boost (like x86) > > Tested at HW: > Exynos 4412 3.13-rc4 Linux > Intel Core i7-3770 3.13-rc4 Linux > > Above patches were posted on top of kernel_pm/bleeding-edge > (SHA1: bd0f3a5d9dce48a917ce1f1047534d79c725149) > > Lukasz Majewski (7): > cpufreq: Add boost frequency support in core > cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common > boost solution > cpufreq:boost:Kconfig: Provide support for software managed BOOST > cpufreq:exynos:Extend Exynos cpufreq driver to support boost > framework > Documentation:cpufreq:boost: Update BOOST documentation > cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ > thermal:exynos:boost: Automatic enable/disable of BOOST feature (at > Exynos4412) > > Documentation/cpu-freq/boost.txt | 26 +++---- > drivers/cpufreq/Kconfig | 4 + > drivers/cpufreq/Kconfig.arm | 15 ++++ > drivers/cpufreq/acpi-cpufreq.c | 86 > +++++++-------------- drivers/cpufreq/cpufreq.c | > 118 ++++++++++++++++++++++++++++- > drivers/cpufreq/exynos-cpufreq.c | 3 + > drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- > drivers/cpufreq/freq_table.c | 56 ++++++++++++-- > drivers/thermal/samsung/exynos_tmu_data.c | 12 +-- > include/linux/cpufreq.h | 24 ++++++ 10 files > changed, 261 insertions(+), 85 deletions(-) > A gentle ping about BOOST patches. Its been already acked by Viresh and Eduardo. It applies on kernel_pm/bleeding_edge SHA1: 4836deb72c5e2a9af0cb2129c1149783a26d99ab Thanks in advance. -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support 2014-01-07 6:58 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski @ 2014-01-08 0:35 ` Rafael J. Wysocki 2014-01-09 7:19 ` Lukasz Majewski 2014-01-10 6:33 ` Zhang Rui 0 siblings, 2 replies; 36+ messages in thread From: Rafael J. Wysocki @ 2014-01-08 0:35 UTC (permalink / raw) To: Lukasz Majewski, Zhang Rui Cc: Viresh Kumar, Eduardo Valentin, cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc, rjw On Tuesday, January 07, 2014 07:58:24 AM Lukasz Majewski wrote: > Hi Rafael, Hi, > > This patch series introduces support for CPU overclocking technique > > called Boost. > > > > It is a follow up of a LAB governor proposal. Boost is a LAB > > component: > > http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq > > > > Boost unifies hardware based solution (e.g. Intel Nehalem) with > > software oriented one (like the one done at Exynos). > > For this reason cpufreq/freq_table code has been reorganized to > > include common code. > > > > Important design decisions: > > - Boost related code is compiled-in unconditionally to cpufreq core > > and disabled by default. The cpufreq_driver is responsibile for > > setting boost_supported flag and providing set_boost callback(if HW > > support is needed). For software managed boost, special Kconfig flag - > > CONFIG_CPU_FREQ_BOOST_SW has been defined. It will be selected only > > when a target platform has thermal framework properly configured. > > > > - struct cpufreq_driver has been extended with boost related fields: > > -- boost_supported - when driver supports boosting > > -- boost_enabled - boost state > > -- set_boost - callback to function, which is necessary to > > enable/disable boost > > > > - Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) is > > visible _only_ when cpufreq driver supports Boost. > > > > - No special spin_lock for Boost was created. The one from cpufreq > > core was reused. > > > > - The Boost code doesn't rely on any policy. When boost state is > > changed, then the policy list is iterated and proper adjustements are > > done. > > > > - To improve safety level, the thermal framework is also extended to > > disable software boosting, when thermal trip point is reached. After > > cooling down the boost can be enabled again. This emulates behaviour > > similar to HW managed boost (like x86) > > > > Tested at HW: > > Exynos 4412 3.13-rc4 Linux > > Intel Core i7-3770 3.13-rc4 Linux > > > > Above patches were posted on top of kernel_pm/bleeding-edge > > (SHA1: bd0f3a5d9dce48a917ce1f1047534d79c725149) > > > > Lukasz Majewski (7): > > cpufreq: Add boost frequency support in core > > cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common > > boost solution > > cpufreq:boost:Kconfig: Provide support for software managed BOOST > > cpufreq:exynos:Extend Exynos cpufreq driver to support boost > > framework > > Documentation:cpufreq:boost: Update BOOST documentation > > cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ > > thermal:exynos:boost: Automatic enable/disable of BOOST feature (at > > Exynos4412) > > > > Documentation/cpu-freq/boost.txt | 26 +++---- > > drivers/cpufreq/Kconfig | 4 + > > drivers/cpufreq/Kconfig.arm | 15 ++++ > > drivers/cpufreq/acpi-cpufreq.c | 86 > > +++++++-------------- drivers/cpufreq/cpufreq.c | > > 118 ++++++++++++++++++++++++++++- > > drivers/cpufreq/exynos-cpufreq.c | 3 + > > drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- > > drivers/cpufreq/freq_table.c | 56 ++++++++++++-- > > drivers/thermal/samsung/exynos_tmu_data.c | 12 +-- > > include/linux/cpufreq.h | 24 ++++++ 10 files > > changed, 261 insertions(+), 85 deletions(-) > > > > A gentle ping about BOOST patches. > > Its been already acked by Viresh and Eduardo. > > It applies on kernel_pm/bleeding_edge SHA1: > 4836deb72c5e2a9af0cb2129c1149783a26d99ab It looks like Rui is still looking into this. Rui, are you fine with this series? Rafael ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support 2014-01-08 0:35 ` Rafael J. Wysocki @ 2014-01-09 7:19 ` Lukasz Majewski 2014-01-10 6:33 ` Zhang Rui 1 sibling, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2014-01-09 7:19 UTC (permalink / raw) To: Rafael J. Wysocki, Zhang Rui, Eduardo Valentin Cc: Viresh Kumar, cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc, rjw Hi Rafael, Zhang, > On Tuesday, January 07, 2014 07:58:24 AM Lukasz Majewski wrote: > > Hi Rafael, > > Hi, > > > > This patch series introduces support for CPU overclocking > > > technique called Boost. > > > > > > It is a follow up of a LAB governor proposal. Boost is a LAB > > > component: > > > http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq > > > > > > Boost unifies hardware based solution (e.g. Intel Nehalem) with > > > software oriented one (like the one done at Exynos). > > > For this reason cpufreq/freq_table code has been reorganized to > > > include common code. > > > > > > Important design decisions: > > > - Boost related code is compiled-in unconditionally to cpufreq > > > core and disabled by default. The cpufreq_driver is responsibile > > > for setting boost_supported flag and providing set_boost > > > callback(if HW support is needed). For software managed boost, > > > special Kconfig flag - CONFIG_CPU_FREQ_BOOST_SW has been defined. > > > It will be selected only when a target platform has thermal > > > framework properly configured. > > > > > > - struct cpufreq_driver has been extended with boost related > > > fields: -- boost_supported - when driver supports boosting > > > -- boost_enabled - boost state > > > -- set_boost - callback to function, which is necessary to > > > enable/disable boost > > > > > > - Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) is > > > visible _only_ when cpufreq driver supports Boost. > > > > > > - No special spin_lock for Boost was created. The one from cpufreq > > > core was reused. > > > > > > - The Boost code doesn't rely on any policy. When boost state is > > > changed, then the policy list is iterated and proper adjustements > > > are done. > > > > > > - To improve safety level, the thermal framework is also extended > > > to disable software boosting, when thermal trip point is reached. > > > After cooling down the boost can be enabled again. This emulates > > > behaviour similar to HW managed boost (like x86) > > > > > > Tested at HW: > > > Exynos 4412 3.13-rc4 Linux > > > Intel Core i7-3770 3.13-rc4 Linux > > > > > > Above patches were posted on top of kernel_pm/bleeding-edge > > > (SHA1: bd0f3a5d9dce48a917ce1f1047534d79c725149) > > > > > > Lukasz Majewski (7): > > > cpufreq: Add boost frequency support in core > > > cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with > > > common boost solution > > > cpufreq:boost:Kconfig: Provide support for software managed > > > BOOST cpufreq:exynos:Extend Exynos cpufreq driver to support boost > > > framework > > > Documentation:cpufreq:boost: Update BOOST documentation > > > cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ > > > thermal:exynos:boost: Automatic enable/disable of BOOST feature > > > (at Exynos4412) > > > > > > Documentation/cpu-freq/boost.txt | 26 +++---- > > > drivers/cpufreq/Kconfig | 4 + > > > drivers/cpufreq/Kconfig.arm | 15 ++++ > > > drivers/cpufreq/acpi-cpufreq.c | 86 > > > +++++++-------------- drivers/cpufreq/cpufreq.c | > > > 118 ++++++++++++++++++++++++++++- > > > drivers/cpufreq/exynos-cpufreq.c | 3 + > > > drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- > > > drivers/cpufreq/freq_table.c | 56 ++++++++++++-- > > > drivers/thermal/samsung/exynos_tmu_data.c | 12 +-- > > > include/linux/cpufreq.h | 24 ++++++ 10 files > > > changed, 261 insertions(+), 85 deletions(-) > > > > > > > A gentle ping about BOOST patches. > > > > Its been already acked by Viresh and Eduardo. > > > > It applies on kernel_pm/bleeding_edge SHA1: > > 4836deb72c5e2a9af0cb2129c1149783a26d99ab > > It looks like Rui is still looking into this. > > Rui, are you fine with this series? I'd really appreciate Ack from Rui on this patch series. However, after Rui's comments on v9, I've completely removed the BOOST code from thermal core. Since the v10, I've only adjusted default data for Exynos SoC. This approach has been finally accepted by Eduardo (who is responsible for this part of the thermal subsystem) on the v12. > > Rafael > -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support 2014-01-08 0:35 ` Rafael J. Wysocki 2014-01-09 7:19 ` Lukasz Majewski @ 2014-01-10 6:33 ` Zhang Rui 2014-01-16 9:40 ` Lukasz Majewski 1 sibling, 1 reply; 36+ messages in thread From: Zhang Rui @ 2014-01-10 6:33 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Lukasz Majewski, Viresh Kumar, Eduardo Valentin, cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc, rjw On Wed, 2014-01-08 at 01:35 +0100, Rafael J. Wysocki wrote: > On Tuesday, January 07, 2014 07:58:24 AM Lukasz Majewski wrote: > > Hi Rafael, > > Hi, > > > > This patch series introduces support for CPU overclocking technique > > > called Boost. > > > > > > It is a follow up of a LAB governor proposal. Boost is a LAB > > > component: > > > http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq > > > > > > Boost unifies hardware based solution (e.g. Intel Nehalem) with > > > software oriented one (like the one done at Exynos). > > > For this reason cpufreq/freq_table code has been reorganized to > > > include common code. > > > > > > Important design decisions: > > > - Boost related code is compiled-in unconditionally to cpufreq core > > > and disabled by default. The cpufreq_driver is responsibile for > > > setting boost_supported flag and providing set_boost callback(if HW > > > support is needed). For software managed boost, special Kconfig flag - > > > CONFIG_CPU_FREQ_BOOST_SW has been defined. It will be selected only > > > when a target platform has thermal framework properly configured. > > > > > > - struct cpufreq_driver has been extended with boost related fields: > > > -- boost_supported - when driver supports boosting > > > -- boost_enabled - boost state > > > -- set_boost - callback to function, which is necessary to > > > enable/disable boost > > > > > > - Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) is > > > visible _only_ when cpufreq driver supports Boost. > > > > > > - No special spin_lock for Boost was created. The one from cpufreq > > > core was reused. > > > > > > - The Boost code doesn't rely on any policy. When boost state is > > > changed, then the policy list is iterated and proper adjustements are > > > done. > > > > > > - To improve safety level, the thermal framework is also extended to > > > disable software boosting, when thermal trip point is reached. After > > > cooling down the boost can be enabled again. This emulates behaviour > > > similar to HW managed boost (like x86) > > > > > > Tested at HW: > > > Exynos 4412 3.13-rc4 Linux > > > Intel Core i7-3770 3.13-rc4 Linux > > > > > > Above patches were posted on top of kernel_pm/bleeding-edge > > > (SHA1: bd0f3a5d9dce48a917ce1f1047534d79c725149) > > > > > > Lukasz Majewski (7): > > > cpufreq: Add boost frequency support in core > > > cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common > > > boost solution > > > cpufreq:boost:Kconfig: Provide support for software managed BOOST > > > cpufreq:exynos:Extend Exynos cpufreq driver to support boost > > > framework > > > Documentation:cpufreq:boost: Update BOOST documentation > > > cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ > > > thermal:exynos:boost: Automatic enable/disable of BOOST feature (at > > > Exynos4412) > > > > > > Documentation/cpu-freq/boost.txt | 26 +++---- > > > drivers/cpufreq/Kconfig | 4 + > > > drivers/cpufreq/Kconfig.arm | 15 ++++ > > > drivers/cpufreq/acpi-cpufreq.c | 86 > > > +++++++-------------- drivers/cpufreq/cpufreq.c | > > > 118 ++++++++++++++++++++++++++++- > > > drivers/cpufreq/exynos-cpufreq.c | 3 + > > > drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- > > > drivers/cpufreq/freq_table.c | 56 ++++++++++++-- > > > drivers/thermal/samsung/exynos_tmu_data.c | 12 +-- > > > include/linux/cpufreq.h | 24 ++++++ 10 files > > > changed, 261 insertions(+), 85 deletions(-) > > > > > > > A gentle ping about BOOST patches. > > > > Its been already acked by Viresh and Eduardo. > > > > It applies on kernel_pm/bleeding_edge SHA1: > > 4836deb72c5e2a9af0cb2129c1149783a26d99ab > > It looks like Rui is still looking into this. > > Rui, are you fine with this series? > Yes, I'm okay with the thermal related parts of this patch set. thanks, rui > Rafael > ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support 2014-01-10 6:33 ` Zhang Rui @ 2014-01-16 9:40 ` Lukasz Majewski 2014-01-16 15:51 ` Rafael J. Wysocki 0 siblings, 1 reply; 36+ messages in thread From: Lukasz Majewski @ 2014-01-16 9:40 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Zhang Rui, Viresh Kumar, Eduardo Valentin, cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc, rjw Hi Rafael, > On Wed, 2014-01-08 at 01:35 +0100, Rafael J. Wysocki wrote: > > On Tuesday, January 07, 2014 07:58:24 AM Lukasz Majewski wrote: > > > Hi Rafael, > > > > Hi, > > > > > > This patch series introduces support for CPU overclocking > > > > technique called Boost. > > > > > > > > It is a follow up of a LAB governor proposal. Boost is a LAB > > > > component: > > > > http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq > > > > > > > > Boost unifies hardware based solution (e.g. Intel Nehalem) with > > > > software oriented one (like the one done at Exynos). > > > > For this reason cpufreq/freq_table code has been reorganized to > > > > include common code. > > > > > > > > Important design decisions: > > > > - Boost related code is compiled-in unconditionally to cpufreq > > > > core and disabled by default. The cpufreq_driver is > > > > responsibile for setting boost_supported flag and providing > > > > set_boost callback(if HW support is needed). For software > > > > managed boost, special Kconfig flag - CONFIG_CPU_FREQ_BOOST_SW > > > > has been defined. It will be selected only when a target > > > > platform has thermal framework properly configured. > > > > > > > > - struct cpufreq_driver has been extended with boost related > > > > fields: -- boost_supported - when driver supports boosting > > > > -- boost_enabled - boost state > > > > -- set_boost - callback to function, which is necessary > > > > to enable/disable boost > > > > > > > > - Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) > > > > is visible _only_ when cpufreq driver supports Boost. > > > > > > > > - No special spin_lock for Boost was created. The one from > > > > cpufreq core was reused. > > > > > > > > - The Boost code doesn't rely on any policy. When boost state is > > > > changed, then the policy list is iterated and proper > > > > adjustements are done. > > > > > > > > - To improve safety level, the thermal framework is also > > > > extended to disable software boosting, when thermal trip point > > > > is reached. After cooling down the boost can be enabled again. > > > > This emulates behaviour similar to HW managed boost (like x86) > > > > > > > > Tested at HW: > > > > Exynos 4412 3.13-rc4 Linux > > > > Intel Core i7-3770 3.13-rc4 Linux > > > > > > > > Above patches were posted on top of kernel_pm/bleeding-edge > > > > (SHA1: bd0f3a5d9dce48a917ce1f1047534d79c725149) > > > > > > > > Lukasz Majewski (7): > > > > cpufreq: Add boost frequency support in core > > > > cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with > > > > common boost solution > > > > cpufreq:boost:Kconfig: Provide support for software managed > > > > BOOST cpufreq:exynos:Extend Exynos cpufreq driver to support > > > > boost framework > > > > Documentation:cpufreq:boost: Update BOOST documentation > > > > cpufreq:exynos4x12: Change L0 driver data to > > > > CPUFREQ_BOOST_FREQ thermal:exynos:boost: Automatic > > > > enable/disable of BOOST feature (at Exynos4412) > > > > > > > > Documentation/cpu-freq/boost.txt | 26 +++---- > > > > drivers/cpufreq/Kconfig | 4 + > > > > drivers/cpufreq/Kconfig.arm | 15 ++++ > > > > drivers/cpufreq/acpi-cpufreq.c | 86 > > > > +++++++-------------- drivers/cpufreq/cpufreq.c > > > > | 118 ++++++++++++++++++++++++++++- > > > > drivers/cpufreq/exynos-cpufreq.c | 3 + > > > > drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- > > > > drivers/cpufreq/freq_table.c | 56 ++++++++++++-- > > > > drivers/thermal/samsung/exynos_tmu_data.c | 12 +-- > > > > include/linux/cpufreq.h | 24 ++++++ 10 files > > > > changed, 261 insertions(+), 85 deletions(-) > > > > > > > > > > A gentle ping about BOOST patches. > > > > > > Its been already acked by Viresh and Eduardo. > > > > > > It applies on kernel_pm/bleeding_edge SHA1: > > > 4836deb72c5e2a9af0cb2129c1149783a26d99ab > > > > It looks like Rui is still looking into this. > > > > Rui, are you fine with this series? > > > Yes, I'm okay with the thermal related parts of this patch set. > Rafael, gentle reminder about BOOST patches ... :-) > thanks, > rui > > Rafael > > > > -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support 2014-01-16 9:40 ` Lukasz Majewski @ 2014-01-16 15:51 ` Rafael J. Wysocki 2014-01-16 15:56 ` Lukasz Majewski 0 siblings, 1 reply; 36+ messages in thread From: Rafael J. Wysocki @ 2014-01-16 15:51 UTC (permalink / raw) To: Lukasz Majewski Cc: Zhang Rui, Viresh Kumar, Eduardo Valentin, cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc On Thursday, January 16, 2014 10:40:08 AM Lukasz Majewski wrote: > Hi Rafael, > > > On Wed, 2014-01-08 at 01:35 +0100, Rafael J. Wysocki wrote: > > > On Tuesday, January 07, 2014 07:58:24 AM Lukasz Majewski wrote: > > > > Hi Rafael, > > > > > > Hi, > > > > > > > > This patch series introduces support for CPU overclocking > > > > > technique called Boost. > > > > > > > > > > It is a follow up of a LAB governor proposal. Boost is a LAB > > > > > component: > > > > > http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq > > > > > > > > > > Boost unifies hardware based solution (e.g. Intel Nehalem) with > > > > > software oriented one (like the one done at Exynos). > > > > > For this reason cpufreq/freq_table code has been reorganized to > > > > > include common code. > > > > > > > > > > Important design decisions: > > > > > - Boost related code is compiled-in unconditionally to cpufreq > > > > > core and disabled by default. The cpufreq_driver is > > > > > responsibile for setting boost_supported flag and providing > > > > > set_boost callback(if HW support is needed). For software > > > > > managed boost, special Kconfig flag - CONFIG_CPU_FREQ_BOOST_SW > > > > > has been defined. It will be selected only when a target > > > > > platform has thermal framework properly configured. > > > > > > > > > > - struct cpufreq_driver has been extended with boost related > > > > > fields: -- boost_supported - when driver supports boosting > > > > > -- boost_enabled - boost state > > > > > -- set_boost - callback to function, which is necessary > > > > > to enable/disable boost > > > > > > > > > > - Boost sysfs attribute (/sys/devices/system/cpu/cpufreq/boost) > > > > > is visible _only_ when cpufreq driver supports Boost. > > > > > > > > > > - No special spin_lock for Boost was created. The one from > > > > > cpufreq core was reused. > > > > > > > > > > - The Boost code doesn't rely on any policy. When boost state is > > > > > changed, then the policy list is iterated and proper > > > > > adjustements are done. > > > > > > > > > > - To improve safety level, the thermal framework is also > > > > > extended to disable software boosting, when thermal trip point > > > > > is reached. After cooling down the boost can be enabled again. > > > > > This emulates behaviour similar to HW managed boost (like x86) > > > > > > > > > > Tested at HW: > > > > > Exynos 4412 3.13-rc4 Linux > > > > > Intel Core i7-3770 3.13-rc4 Linux > > > > > > > > > > Above patches were posted on top of kernel_pm/bleeding-edge > > > > > (SHA1: bd0f3a5d9dce48a917ce1f1047534d79c725149) > > > > > > > > > > Lukasz Majewski (7): > > > > > cpufreq: Add boost frequency support in core > > > > > cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with > > > > > common boost solution > > > > > cpufreq:boost:Kconfig: Provide support for software managed > > > > > BOOST cpufreq:exynos:Extend Exynos cpufreq driver to support > > > > > boost framework > > > > > Documentation:cpufreq:boost: Update BOOST documentation > > > > > cpufreq:exynos4x12: Change L0 driver data to > > > > > CPUFREQ_BOOST_FREQ thermal:exynos:boost: Automatic > > > > > enable/disable of BOOST feature (at Exynos4412) > > > > > > > > > > Documentation/cpu-freq/boost.txt | 26 +++---- > > > > > drivers/cpufreq/Kconfig | 4 + > > > > > drivers/cpufreq/Kconfig.arm | 15 ++++ > > > > > drivers/cpufreq/acpi-cpufreq.c | 86 > > > > > +++++++-------------- drivers/cpufreq/cpufreq.c > > > > > | 118 ++++++++++++++++++++++++++++- > > > > > drivers/cpufreq/exynos-cpufreq.c | 3 + > > > > > drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- > > > > > drivers/cpufreq/freq_table.c | 56 ++++++++++++-- > > > > > drivers/thermal/samsung/exynos_tmu_data.c | 12 +-- > > > > > include/linux/cpufreq.h | 24 ++++++ 10 files > > > > > changed, 261 insertions(+), 85 deletions(-) > > > > > > > > > > > > > A gentle ping about BOOST patches. > > > > > > > > Its been already acked by Viresh and Eduardo. > > > > > > > > It applies on kernel_pm/bleeding_edge SHA1: > > > > 4836deb72c5e2a9af0cb2129c1149783a26d99ab > > > > > > It looks like Rui is still looking into this. > > > > > > Rui, are you fine with this series? > > > > > Yes, I'm okay with the thermal related parts of this patch set. > > > > Rafael, gentle reminder about BOOST patches ... :-) I'm about to take them for 3.14. Thanks! [PS: Please don't use the rjw@sisk.pl address, that domain is gone.] -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. ^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support 2014-01-16 15:51 ` Rafael J. Wysocki @ 2014-01-16 15:56 ` Lukasz Majewski 0 siblings, 0 replies; 36+ messages in thread From: Lukasz Majewski @ 2014-01-16 15:56 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Zhang Rui, Viresh Kumar, Eduardo Valentin, cpufreq@vger.kernel.org, Linux PM list, Jonghwa Lee, Lukasz Majewski, linux-kernel, Bartlomiej Zolnierkiewicz, Myungjoo Ham, durgadoss.r, linux-samsung-soc Hi Rafael, > On Thursday, January 16, 2014 10:40:08 AM Lukasz Majewski wrote: > > Hi Rafael, > > > > > On Wed, 2014-01-08 at 01:35 +0100, Rafael J. Wysocki wrote: > > > > On Tuesday, January 07, 2014 07:58:24 AM Lukasz Majewski wrote: > > > > > Hi Rafael, > > > > > > > > Hi, > > > > > > > > > > This patch series introduces support for CPU overclocking > > > > > > technique called Boost. > > > > > > > > > > > > It is a follow up of a LAB governor proposal. Boost is a LAB > > > > > > component: > > > > > > http://thread.gmane.org/gmane.linux.kernel/1484746/match=cpufreq > > > > > > > > > > > > Boost unifies hardware based solution (e.g. Intel Nehalem) > > > > > > with software oriented one (like the one done at Exynos). > > > > > > For this reason cpufreq/freq_table code has been > > > > > > reorganized to include common code. > > > > > > > > > > > > Important design decisions: > > > > > > - Boost related code is compiled-in unconditionally to > > > > > > cpufreq core and disabled by default. The cpufreq_driver is > > > > > > responsibile for setting boost_supported flag and providing > > > > > > set_boost callback(if HW support is needed). For software > > > > > > managed boost, special Kconfig flag - > > > > > > CONFIG_CPU_FREQ_BOOST_SW has been defined. It will be > > > > > > selected only when a target platform has thermal framework > > > > > > properly configured. > > > > > > > > > > > > - struct cpufreq_driver has been extended with boost related > > > > > > fields: -- boost_supported - when driver supports boosting > > > > > > -- boost_enabled - boost state > > > > > > -- set_boost - callback to function, which is > > > > > > necessary to enable/disable boost > > > > > > > > > > > > - Boost sysfs attribute > > > > > > (/sys/devices/system/cpu/cpufreq/boost) is visible _only_ > > > > > > when cpufreq driver supports Boost. > > > > > > > > > > > > - No special spin_lock for Boost was created. The one from > > > > > > cpufreq core was reused. > > > > > > > > > > > > - The Boost code doesn't rely on any policy. When boost > > > > > > state is changed, then the policy list is iterated and > > > > > > proper adjustements are done. > > > > > > > > > > > > - To improve safety level, the thermal framework is also > > > > > > extended to disable software boosting, when thermal trip > > > > > > point is reached. After cooling down the boost can be > > > > > > enabled again. This emulates behaviour similar to HW > > > > > > managed boost (like x86) > > > > > > > > > > > > Tested at HW: > > > > > > Exynos 4412 3.13-rc4 Linux > > > > > > Intel Core i7-3770 3.13-rc4 Linux > > > > > > > > > > > > Above patches were posted on top of kernel_pm/bleeding-edge > > > > > > (SHA1: bd0f3a5d9dce48a917ce1f1047534d79c725149) > > > > > > > > > > > > Lukasz Majewski (7): > > > > > > cpufreq: Add boost frequency support in core > > > > > > cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work > > > > > > with common boost solution > > > > > > cpufreq:boost:Kconfig: Provide support for software > > > > > > managed BOOST cpufreq:exynos:Extend Exynos cpufreq driver > > > > > > to support boost framework > > > > > > Documentation:cpufreq:boost: Update BOOST documentation > > > > > > cpufreq:exynos4x12: Change L0 driver data to > > > > > > CPUFREQ_BOOST_FREQ thermal:exynos:boost: Automatic > > > > > > enable/disable of BOOST feature (at Exynos4412) > > > > > > > > > > > > Documentation/cpu-freq/boost.txt | 26 +++---- > > > > > > drivers/cpufreq/Kconfig | 4 + > > > > > > drivers/cpufreq/Kconfig.arm | 15 ++++ > > > > > > drivers/cpufreq/acpi-cpufreq.c | 86 > > > > > > +++++++-------------- drivers/cpufreq/cpufreq.c > > > > > > | 118 ++++++++++++++++++++++++++++- > > > > > > drivers/cpufreq/exynos-cpufreq.c | 3 + > > > > > > drivers/cpufreq/exynos4x12-cpufreq.c | 2 +- > > > > > > drivers/cpufreq/freq_table.c | 56 > > > > > > ++++++++++++-- drivers/thermal/samsung/exynos_tmu_data.c > > > > > > | 12 +-- include/linux/cpufreq.h | 24 > > > > > > ++++++ 10 files changed, 261 insertions(+), 85 deletions(-) > > > > > > > > > > > > > > > > A gentle ping about BOOST patches. > > > > > > > > > > Its been already acked by Viresh and Eduardo. > > > > > > > > > > It applies on kernel_pm/bleeding_edge SHA1: > > > > > 4836deb72c5e2a9af0cb2129c1149783a26d99ab > > > > > > > > It looks like Rui is still looking into this. > > > > > > > > Rui, are you fine with this series? > > > > > > > Yes, I'm okay with the thermal related parts of this patch set. > > > > > > > Rafael, gentle reminder about BOOST patches ... :-) > > I'm about to take them for 3.14. > Thanks :-) > Thanks! > > [PS: Please don't use the rjw@sisk.pl address, that domain is gone.] > Ok, I will not use it. -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group ^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2014-01-16 15:56 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1370502472-7249-1-git-send-email-l.majewski@samsung.com>
2013-12-02 12:19 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski
2013-12-02 12:19 ` [PATCH RESEND v10 1/7] cpufreq: Add boost frequency support in core Lukasz Majewski
2013-12-02 12:19 ` [PATCH RESEND v10 2/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution Lukasz Majewski
2013-12-02 12:19 ` [PATCH RESEND v10 3/7] cpufreq:boost:Kconfig: Provide support for software managed BOOST Lukasz Majewski
2013-12-02 12:19 ` [PATCH RESEND v10 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework Lukasz Majewski
2013-12-02 12:19 ` [PATCH RESEND v10 5/7] Documentation:cpufreq:boost: Update BOOST documentation Lukasz Majewski
2013-12-02 12:19 ` [PATCH RESEND v10 6/7] cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ Lukasz Majewski
2013-12-02 12:19 ` [PATCH RESEND v10 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Lukasz Majewski
2013-12-04 6:59 ` [PATCH RESEND v10 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski
2013-12-04 14:12 ` Eduardo Valentin
2013-12-09 10:04 ` Lukasz Majewski
2013-12-13 16:38 ` [PATCH v11 " Lukasz Majewski
2013-12-13 16:38 ` [PATCH v11 1/7] cpufreq: Add boost frequency support in core Lukasz Majewski
2013-12-13 16:38 ` [PATCH v11 2/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution Lukasz Majewski
2013-12-13 16:38 ` [PATCH v11 3/7] cpufreq:boost:Kconfig: Provide support for software managed BOOST Lukasz Majewski
2013-12-13 16:38 ` [PATCH v11 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework Lukasz Majewski
2013-12-13 16:38 ` [PATCH v11 5/7] Documentation:cpufreq:boost: Update BOOST documentation Lukasz Majewski
2013-12-13 16:38 ` [PATCH v11 6/7] cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ Lukasz Majewski
2013-12-13 16:38 ` [PATCH v11 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Lukasz Majewski
2013-12-19 14:50 ` Eduardo Valentin
2013-12-20 14:24 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski
2013-12-20 14:24 ` [PATCH v12 1/7] cpufreq: Add boost frequency support in core Lukasz Majewski
2013-12-20 14:24 ` [PATCH v12 2/7] cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution Lukasz Majewski
2013-12-20 14:24 ` [PATCH v12 3/7] cpufreq:boost:Kconfig: Provide support for software managed BOOST Lukasz Majewski
2013-12-20 14:24 ` [PATCH v12 4/7] cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework Lukasz Majewski
2013-12-20 14:24 ` [PATCH v12 5/7] Documentation:cpufreq:boost: Update BOOST documentation Lukasz Majewski
2013-12-20 14:24 ` [PATCH v12 6/7] cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ Lukasz Majewski
2013-12-20 14:24 ` [PATCH v12 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412) Lukasz Majewski
2014-01-10 6:35 ` Zhang Rui
2014-01-07 6:58 ` [PATCH v12 0/7] cpufreq:boost: CPU Boost mode support Lukasz Majewski
2014-01-08 0:35 ` Rafael J. Wysocki
2014-01-09 7:19 ` Lukasz Majewski
2014-01-10 6:33 ` Zhang Rui
2014-01-16 9:40 ` Lukasz Majewski
2014-01-16 15:51 ` Rafael J. Wysocki
2014-01-16 15:56 ` Lukasz Majewski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).