Skip to contentSkip to conversation

cpufreq:boost: CPU Boost mode support

PATCH Superseded Lukasz Majewski 12 participants 321 messages Jun 6, 2013 – Jan 16, 2014 Page 3 of 3

Subsystems (12)
lore
Share & tools
lore
#285 lore raw

v10 cover cpufreq:boost: CPU Boost mode support

In reply to Lukasz Majewski

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(-)
Signature · 1 line
1.7.10.4
#286 lore raw

PATCH RESEND v10 1/7 cpufreq: Add boost frequency support in core

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.

---
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(-)
drivers/cpufreq/cpufreq.c +117 -1
index 606224a..a0d1ea0 100644
@@ -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);
drivers/cpufreq/freq_table.c +49 -7

84 lines not on this page · raw message

include/linux/cpufreq.h +24 -0
index ee5fe9d..68f32dc 100644
@@ -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);
 
Signature · 1 line
1.7.10.4
#287 lore raw

PATCH RESEND v10 2/7 cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution

In reply to Lukasz Majewski

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.

---
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(-)
drivers/cpufreq/acpi-cpufreq.c +29 -57
index caf41eb..79e5608 100644
@@ -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;
 }
Signature · 1 line
1.7.10.4
#288 lore raw

PATCH RESEND v10 3/7 cpufreq:boost:Kconfig: Provide support for software managed BOOST

In reply to Lukasz Majewski

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.

---
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(+)
drivers/cpufreq/Kconfig +4 -0
index 38093e2..c8818c1 100644
@@ -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
drivers/cpufreq/Kconfig.arm +15 -0
index ce52ed9..25599d6 100644
@@ -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
Signature · 1 line
1.7.10.4
#289 lore raw

PATCH RESEND v10 4/7 cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework

In reply to Lukasz Majewski

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.

---
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(+)
drivers/cpufreq/exynos-cpufreq.c +3 -0
index f3c2287..3cd6d2e 100644
@@ -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,
Signature · 1 line
1.7.10.4
#290 lore raw

PATCH RESEND v10 5/7 Documentation:cpufreq:boost: Update BOOST documentation

In reply to Lukasz Majewski

Since the support for software and hardware controlled boosting has been added, the corresponding Documentation entry had been updated.

---
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(-)
Documentation/cpu-freq/boost.txt +13 -13
index 9b4edfc..dd62e13 100644
@@ -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
Signature · 1 line
1.7.10.4
#291 lore raw

PATCH RESEND v10 6/7 cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ

In reply to Lukasz Majewski

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.

---
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(-)
drivers/cpufreq/exynos4x12-cpufreq.c +1 -1
index efad5e6..77ae129 100644
@@ -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},
Signature · 1 line
1.7.10.4
#292 lore raw

PATCH RESEND v10 7/7 thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412)

In reply to Lukasz Majewski

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.

---
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(+)
drivers/thermal/samsung/exynos_tmu_data.c +47 -0
index 073c292..9346926 100644
@@ -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,
 		},
Signature · 1 line
1.7.10.4
#293 lore raw
In reply to Lukasz Majewski

Hi Rafael,

Quoted 41 lines

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)

Quoted 7 lines

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.

Quoted 26 lines

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(-)

Signature · 6 lines
-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#294 lore raw
Quoted 56 lines · Lukasz Majewski

Hi Rafael,

Quoted 41 lines

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)

Quoted 7 lines

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.

Quoted 4 lines

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.

Quoted 32 lines
Quoted 29 lines

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(-)

Signature · 3 lines
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin
#295 lore raw

Hi Rafael,

Quoted 58 lines · Lukasz Majewski
Quoted 57 lines

Hi Rafael,

Quoted 42 lines

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)

Quoted 7 lines

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.

Quoted 8 lines
Quoted 4 lines

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?

Quoted 35 lines
Quoted 33 lines
Quoted 30 lines

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(-)

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#296 lore raw

v11 cover cpufreq:boost: CPU Boost mode support

In reply to Lukasz Majewski

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(-)
Signature · 1 line
1.7.10.4
#297 lore raw

PATCH v11 1/7 cpufreq: Add boost frequency support in core

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.

---
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(-)
drivers/cpufreq/cpufreq.c +117 -1
index 02d534d..33774cc 100644
@@ -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);
drivers/cpufreq/freq_table.c +49 -7

84 lines not on this page · raw message

include/linux/cpufreq.h +24 -0
index dc196bb..a0cbb7c 100644
@@ -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);
 
Signature · 1 line
1.7.10.4
#298 lore raw

PATCH v11 2/7 cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution

In reply to Lukasz Majewski

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.

---
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(-)
drivers/cpufreq/acpi-cpufreq.c +29 -57
index caf41eb..79e5608 100644
@@ -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;
 }
Signature · 1 line
1.7.10.4
#299 lore raw

PATCH v11 3/7 cpufreq:boost:Kconfig: Provide support for software managed BOOST

In reply to Lukasz Majewski

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.

---
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(+)
drivers/cpufreq/Kconfig +4 -0
index 38093e2..c8818c1 100644
@@ -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
drivers/cpufreq/Kconfig.arm +15 -0
index ce52ed9..25599d6 100644
@@ -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
Signature · 1 line
1.7.10.4
#300 lore raw

PATCH v11 4/7 cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework

In reply to Lukasz Majewski

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.

---
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(+)
drivers/cpufreq/exynos-cpufreq.c +3 -0
index f3c2287..3cd6d2e 100644
@@ -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,
Signature · 1 line
1.7.10.4
#301 lore raw

PATCH v11 5/7 Documentation:cpufreq:boost: Update BOOST documentation

In reply to Lukasz Majewski

Since the support for software and hardware controlled boosting has been added, the corresponding Documentation entry had been updated.

---
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(-)
Documentation/cpu-freq/boost.txt +13 -13
index 9b4edfc..dd62e13 100644
@@ -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
Signature · 1 line
1.7.10.4
#302 lore raw

PATCH v11 6/7 cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ

In reply to Lukasz Majewski

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.

---
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(-)
drivers/cpufreq/exynos4x12-cpufreq.c +1 -1
index efad5e6..77ae129 100644
@@ -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},
Signature · 1 line
1.7.10.4
#303 lore raw

PATCH v11 7/7 thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412)

In reply to Lukasz Majewski

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.

---
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(-)
drivers/thermal/samsung/exynos_tmu_data.c +6 -6
index 073c292..476b768 100644
@@ -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, \
Signature · 1 line
1.7.10.4
Acked-by on v11 7/7
#304 lore raw

Re: [PATCH v11 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412)

Quoted 6 lines · Lukasz Majewski

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.

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.

Quoted 79 lines

---
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(-)
drivers/thermal/samsung/exynos_tmu_data.c +6 -6
index 073c292..476b768 100644
@@ -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, \
Signature · 3 lines
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin
#305 lore raw

v12 cover cpufreq:boost: CPU Boost mode support

In reply to Lukasz Majewski

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(-)
Signature · 1 line
1.7.10.4
#306 lore raw

PATCH v12 1/7 cpufreq: Add boost frequency support in core

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.

---
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(-)
drivers/cpufreq/cpufreq.c +117 -1
index 02d534d..33774cc 100644
@@ -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);
drivers/cpufreq/freq_table.c +49 -7

84 lines not on this page · raw message

include/linux/cpufreq.h +24 -0
index dc196bb..a0cbb7c 100644
@@ -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);
 
Signature · 1 line
1.7.10.4
#307 lore raw

PATCH v12 2/7 cpufreq:acpi:x86: Adjust the acpi-cpufreq.c code to work with common boost solution

In reply to Lukasz Majewski

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.

---
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(-)
drivers/cpufreq/acpi-cpufreq.c +29 -57
index caf41eb..79e5608 100644
@@ -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;
 }
Signature · 1 line
1.7.10.4
#308 lore raw

PATCH v12 3/7 cpufreq:boost:Kconfig: Provide support for software managed BOOST

In reply to Lukasz Majewski

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.

---
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(+)
drivers/cpufreq/Kconfig +4 -0
index 38093e2..c8818c1 100644
@@ -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
drivers/cpufreq/Kconfig.arm +15 -0
index ce52ed9..25599d6 100644
@@ -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
Signature · 1 line
1.7.10.4
#309 lore raw

PATCH v12 4/7 cpufreq:exynos:Extend Exynos cpufreq driver to support boost framework

In reply to Lukasz Majewski

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.

---
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(+)
drivers/cpufreq/exynos-cpufreq.c +3 -0
index f3c2287..3cd6d2e 100644
@@ -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,
Signature · 1 line
1.7.10.4
#310 lore raw

PATCH v12 5/7 Documentation:cpufreq:boost: Update BOOST documentation

In reply to Lukasz Majewski

Since the support for software and hardware controlled boosting has been added, the corresponding Documentation entry had been updated.

---
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(-)
Documentation/cpu-freq/boost.txt +13 -13
index 9b4edfc..dd62e13 100644
@@ -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
Signature · 1 line
1.7.10.4
#311 lore raw

PATCH v12 6/7 cpufreq:exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ

In reply to Lukasz Majewski

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.

---
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(-)
drivers/cpufreq/exynos4x12-cpufreq.c +1 -1
index efad5e6..77ae129 100644
@@ -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},
Signature · 1 line
1.7.10.4
#312 lore raw

PATCH v12 7/7 thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412)

In reply to Lukasz Majewski

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.

---
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(-)
drivers/thermal/samsung/exynos_tmu_data.c +6 -6
index 073c292..476b768 100644
@@ -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, \
Signature · 1 line
1.7.10.4
reviewer Reviewed-by on v12 7/7
#313 lore raw

Re: [PATCH v12 7/7] thermal:exynos:boost: Automatic enable/disable of BOOST feature (at Exynos4412)

Quoted 23 lines · Lukasz Majewski

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.

Quoted 3 lines

thanks,
rui

Quoted 82 lines

---
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(-)
drivers/thermal/samsung/exynos_tmu_data.c +6 -6
index 073c292..476b768 100644
@@ -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, \
#314 lore raw
In reply to Lukasz Majewski

Hi Rafael,

Quoted 71 lines

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
Quoted 2 lines

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.

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#315 lore raw
Quoted 1 line · Lukasz Majewski

Hi Rafael,

Hi,

Quoted 74 lines
Quoted 71 lines

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
Quoted 2 lines

changed, 261 insertions(+), 85 deletions(-)

Quoted 6 lines

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

#316 lore raw

Hi Rafael, Zhang,

Quoted 82 lines · Lukasz Majewski
Quoted 1 line

Hi Rafael,

Hi,

Quoted 77 lines
Quoted 72 lines

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
Quoted 2 lines

changed, 261 insertions(+), 85 deletions(-)

A gentle ping about BOOST patches.

Quoted 8 lines
Quoted 4 lines

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.

Quoted 3 lines

Rafael

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
reviewer
#317 lore raw
In reply to Rafael J. Wysocki
Quoted 81 lines · Rafael J. Wysocki
Quoted 1 line · Lukasz Majewski

Hi Rafael,

Hi,

Quoted 76 lines
Quoted 71 lines

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
Quoted 2 lines

changed, 261 insertions(+), 85 deletions(-)

A gentle ping about BOOST patches.

Quoted 9 lines
Quoted 4 lines

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

Quoted 2 lines

Rafael

#318 lore raw

Hi Rafael,

Quoted 85 lines · Rafael J. Wysocki
Quoted 84 lines · Lukasz Majewski
Quoted 1 line

Hi Rafael,

Hi,

Quoted 79 lines
Quoted 72 lines

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
Quoted 2 lines

changed, 261 insertions(+), 85 deletions(-)

A gentle ping about BOOST patches.

Its been already acked by Viresh and Eduardo.

Quoted 9 lines
Quoted 7 lines
Quoted 2 lines

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 ... :-)

Quoted 6 lines

thanks,
rui

Quoted 2 lines

Rafael

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#319 lore raw
Quoted 90 lines · Lukasz Majewski

Hi Rafael,

Quoted 88 lines · Rafael J. Wysocki
Quoted 87 lines · Lukasz Majewski
Quoted 1 line

Hi Rafael,

Hi,

Quoted 81 lines
Quoted 72 lines

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
Quoted 2 lines

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

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

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 [email protected] address, that domain is gone.]

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#320 lore raw

Hi Rafael,

Quoted 96 lines · Lukasz Majewski
Quoted 95 lines

Hi Rafael,

Quoted 93 lines · Rafael J. Wysocki
Quoted 92 lines · Lukasz Majewski
Quoted 1 line

Hi Rafael,

Hi,

Quoted 78 lines
Quoted 73 lines

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
Quoted 4 lines

++++++++++++-- drivers/thermal/samsung/exynos_tmu_data.c
| 12 +-- include/linux/cpufreq.h | 24
++++++ 10 files changed, 261 insertions(+), 85 deletions(-)

Quoted 6 lines

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.

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

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 :-)

Quoted 4 lines

Thanks!

[PS: Please don't use the [email protected] address, that domain is gone.]

Ok, I will not use it.

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group