aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 17:35:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 17:35:40 -0400
commitf991fae5c6d42dfc5029150b05a78cf3f6c18cc9 (patch)
treed140deb437bde0631778b4984eeb72c1f4ee0c1d /include
parentd4141531f63a29bb2a980092b6f2828c385e6edd (diff)
parent2c843bd92ec276ecb68504b3b5ffa7066183f032 (diff)
Merge tag 'pm+acpi-3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI updates from Rafael Wysocki: "This time the total number of ACPI commits is slightly greater than the number of cpufreq commits, but Viresh Kumar (who works on cpufreq) remains the most active patch submitter. To me, the most significant change is the addition of offline/online device operations to the driver core (with the Greg's blessing) and the related modifications of the ACPI core hotplug code. Next are the freezer updates from Colin Cross that should make the freezing of tasks a bit less heavy weight. We also have a couple of regression fixes, a number of fixes for issues that have not been identified as regressions, two new drivers and a bunch of cleanups all over. Highlights: - Hotplug changes to support graceful hot-removal failures. It sometimes is necessary to fail device hot-removal operations gracefully if they cannot be carried out completely. For example, if memory from a memory module being hot-removed has been allocated for the kernel's own use and cannot be moved elsewhere, it's desirable to fail the hot-removal operation in a graceful way rather than to crash the kernel, but currenty a success or a kernel crash are the only possible outcomes of an attempted memory hot-removal. Needless to say, that is not a very attractive alternative and it had to be addressed. However, in order to make it work for memory, I first had to make it work for CPUs and for this purpose I needed to modify the ACPI processor driver. It's been split into two parts, a resident one handling the low-level initialization/cleanup and a modular one playing the actual driver's role (but it binds to the CPU system device objects rather than to the ACPI device objects representing processors). That's been sort of like a live brain surgery on a patient who's riding a bike. So this is a little scary, but since we found and fixed a couple of regressions it caused to happen during the early linux-next testing (a month ago), nobody has complained. As a bonus we remove some duplicated ACPI hotplug code, because the ACPI-based CPU hotplug is now going to use the common ACPI hotplug code. - Lighter weight freezing of tasks. These changes from Colin Cross and Mandeep Singh Baines are targeted at making the freezing of tasks a bit less heavy weight operation. They reduce the number of tasks woken up every time during the freezing, by using the observation that the freezer simply doesn't need to wake up some of them and wait for them all to call refrigerator(). The time needed for the freezer to decide to report a failure is reduced too. Also reintroduced is the check causing a lockdep warining to trigger when try_to_freeze() is called with locks held (which is generally unsafe and shouldn't happen). - cpufreq updates First off, a commit from Srivatsa S Bhat fixes a resume regression introduced during the 3.10 cycle causing some cpufreq sysfs attributes to return wrong values to user space after resume. The fix is kind of fresh, but also it's pretty obvious once Srivatsa has identified the root cause. Second, we have a new freqdomain_cpus sysfs attribute for the acpi-cpufreq driver to provide information previously available via related_cpus. From Lan Tianyu. Finally, we fix a number of issues, mostly related to the CPUFREQ_POSTCHANGE notifier and cpufreq Kconfig options and clean up some code. The majority of changes from Viresh Kumar with bits from Jacob Shin, Heiko Stübner, Xiaoguang Chen, Ezequiel Garcia, Arnd Bergmann, and Tang Yuantian. - ACPICA update A usual bunch of updates from the ACPICA upstream. During the 3.4 cycle we introduced support for ACPI 5 extended sleep registers, but they are only supposed to be used if the HW-reduced mode bit is set in the FADT flags and the code attempted to use them without checking that bit. That caused suspend/resume regressions to happen on some systems. Fix from Lv Zheng causes those registers to be used only if the HW-reduced mode bit is set. Apart from this some other ACPICA bugs are fixed and code cleanups are made by Bob Moore, Tomasz Nowicki, Lv Zheng, Chao Guan, and Zhang Rui. - cpuidle updates New driver for Xilinx Zynq processors is added by Michal Simek. Multidriver support simplification, addition of some missing kerneldoc comments and Kconfig-related fixes come from Daniel Lezcano. - ACPI power management updates Changes to make suspend/resume work correctly in Xen guests from Konrad Rzeszutek Wilk, sparse warning fix from Fengguang Wu and cleanups and fixes of the ACPI device power state selection routine. - ACPI documentation updates Some previously missing pieces of ACPI documentation are added by Lv Zheng and Aaron Lu (hopefully, that will help people to uderstand how the ACPI subsystem works) and one outdated doc is updated by Hanjun Guo. - Assorted ACPI updates We finally nailed down the IA-64 issue that was the reason for reverting commit 9f29ab11ddbf ("ACPI / scan: do not match drivers against objects having scan handlers"), so we can fix it and move the ACPI scan handler check added to the ACPI video driver back to the core. A mechanism for adding CMOS RTC address space handlers is introduced by Lan Tianyu to allow some EC-related breakage to be fixed on some systems. A spec-compliant implementation of acpi_os_get_timer() is added by Mika Westerberg. The evaluation of _STA is added to do_acpi_find_child() to avoid situations in which a pointer to a disabled device object is returned instead of an enabled one with the same _ADR value. From Jeff Wu. Intel BayTrail PCH (Platform Controller Hub) support is added to the ACPI driver for Intel Low-Power Subsystems (LPSS) and that driver is modified to work around a couple of known BIOS issues. Changes from Mika Westerberg and Heikki Krogerus. The EC driver is fixed by Vasiliy Kulikov to use get_user() and put_user() instead of dereferencing user space pointers blindly. Code cleanups are made by Bjorn Helgaas, Nicholas Mazzuca and Toshi Kani. - Assorted power management updates The "runtime idle" helper routine is changed to take the return values of the callbacks executed by it into account and to call rpm_suspend() if they return 0, which allows us to reduce the overall code bloat a bit (by dropping some code that's not necessary any more after that modification). The runtime PM documentation is updated by Alan Stern (to reflect the "runtime idle" behavior change). New trace points for PM QoS are added by Sahara (<keun-o.park@windriver.com>). PM QoS documentation is updated by Lan Tianyu. Code cleanups are made and minor issues are addressed by Bernie Thompson, Bjorn Helgaas, Julius Werner, and Shuah Khan. - devfreq updates New driver for the Exynos5-bus device from Abhilash Kesavan. Minor cleanups, fixes and MAINTAINERS update from MyungJoo Ham, Abhilash Kesavan, Paul Bolle, Rajagopal Venkat, and Wei Yongjun. - OMAP power management updates Adaptive Voltage Scaling (AVS) SmartReflex voltage control driver updates from Andrii Tseglytskyi and Nishanth Menon." * tag 'pm+acpi-3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (162 commits) cpufreq: Fix cpufreq regression after suspend/resume ACPI / PM: Fix possible NULL pointer deref in acpi_pm_device_sleep_state() PM / Sleep: Warn about system time after resume with pm_trace cpufreq: don't leave stale policy pointer in cdbs->cur_policy acpi-cpufreq: Add new sysfs attribute freqdomain_cpus cpufreq: make sure frequency transitions are serialized ACPI: implement acpi_os_get_timer() according the spec ACPI / EC: Add HP Folio 13 to ec_dmi_table in order to skip DSDT scan ACPI: Add CMOS RTC Operation Region handler support ACPI / processor: Drop unused variable from processor_perflib.c cpufreq: tegra: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: s3c64xx: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: omap: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: imx6q: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: exynos: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: dbx500: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: davinci: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: arm-big-little: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: powernow-k8: call CPUFREQ_POSTCHANGE notfier in error cases cpufreq: pcc: call CPUFREQ_POSTCHANGE notfier in error cases ...
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h4
-rw-r--r--include/acpi/acoutput.h8
-rw-r--r--include/acpi/acpi_bus.h29
-rw-r--r--include/acpi/acpixf.h3
-rw-r--r--include/acpi/processor.h5
-rw-r--r--include/linux/acpi.h3
-rw-r--r--include/linux/cpufreq.h54
-rw-r--r--include/linux/cpuidle.h6
-rw-r--r--include/linux/debug_locks.h4
-rw-r--r--include/linux/devfreq.h2
-rw-r--r--include/linux/device.h22
-rw-r--r--include/linux/freezer.h171
-rw-r--r--include/linux/memory_hotplug.h14
-rw-r--r--include/linux/pm_runtime.h2
-rw-r--r--include/linux/power/smartreflex.h10
-rw-r--r--include/linux/suspend.h1
-rw-r--r--include/trace/events/power.h173
-rw-r--r--include/xen/acpi.h16
18 files changed, 422 insertions, 105 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 14ceff788c40..1c16f821434f 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -219,8 +219,8 @@
219 * 219 *
220 *****************************************************************************/ 220 *****************************************************************************/
221 221
222#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ 222#define ACPI_DEBUGGER_MAX_ARGS ACPI_METHOD_NUM_ARGS + 4 /* Max command line arguments */
223#define ACPI_DB_LINE_BUFFER_SIZE 512 223#define ACPI_DB_LINE_BUFFER_SIZE 512
224 224
225#define ACPI_DEBUGGER_COMMAND_PROMPT '-' 225#define ACPI_DEBUGGER_COMMAND_PROMPT '-'
226#define ACPI_DEBUGGER_EXECUTE_PROMPT '%' 226#define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 4f52ea795c7a..4607b027a657 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -428,27 +428,21 @@
428 * This is the non-debug case -- make everything go away, 428 * This is the non-debug case -- make everything go away,
429 * leaving no executable debug code! 429 * leaving no executable debug code!
430 */ 430 */
431#define ACPI_FUNCTION_NAME(a)
432#define ACPI_DEBUG_PRINT(pl) 431#define ACPI_DEBUG_PRINT(pl)
433#define ACPI_DEBUG_PRINT_RAW(pl) 432#define ACPI_DEBUG_PRINT_RAW(pl)
434#define ACPI_DEBUG_EXEC(a) 433#define ACPI_DEBUG_EXEC(a)
435#define ACPI_DEBUG_ONLY_MEMBERS(a) 434#define ACPI_DEBUG_ONLY_MEMBERS(a)
435#define ACPI_FUNCTION_NAME(a)
436#define ACPI_FUNCTION_TRACE(a) 436#define ACPI_FUNCTION_TRACE(a)
437#define ACPI_FUNCTION_TRACE_PTR(a, b) 437#define ACPI_FUNCTION_TRACE_PTR(a, b)
438#define ACPI_FUNCTION_TRACE_U32(a, b) 438#define ACPI_FUNCTION_TRACE_U32(a, b)
439#define ACPI_FUNCTION_TRACE_STR(a, b) 439#define ACPI_FUNCTION_TRACE_STR(a, b)
440#define ACPI_FUNCTION_EXIT
441#define ACPI_FUNCTION_STATUS_EXIT(s)
442#define ACPI_FUNCTION_VALUE_EXIT(s)
443#define ACPI_FUNCTION_ENTRY() 440#define ACPI_FUNCTION_ENTRY()
444#define ACPI_DUMP_STACK_ENTRY(a) 441#define ACPI_DUMP_STACK_ENTRY(a)
445#define ACPI_DUMP_OPERANDS(a, b, c) 442#define ACPI_DUMP_OPERANDS(a, b, c)
446#define ACPI_DUMP_ENTRY(a, b) 443#define ACPI_DUMP_ENTRY(a, b)
447#define ACPI_DUMP_TABLES(a, b)
448#define ACPI_DUMP_PATHNAME(a, b, c, d) 444#define ACPI_DUMP_PATHNAME(a, b, c, d)
449#define ACPI_DUMP_BUFFER(a, b) 445#define ACPI_DUMP_BUFFER(a, b)
450#define ACPI_DEBUG_PRINT(pl)
451#define ACPI_DEBUG_PRINT_RAW(pl)
452#define ACPI_IS_DEBUG_ENABLED(level, component) 0 446#define ACPI_IS_DEBUG_ENABLED(level, component) 0
453 447
454/* Return macros must have a return statement at the minimum */ 448/* Return macros must have a return statement at the minimum */
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index c13c919ab99e..ca081ace2a1d 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -63,13 +63,6 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld
63#define ACPI_BUS_FILE_ROOT "acpi" 63#define ACPI_BUS_FILE_ROOT "acpi"
64extern struct proc_dir_entry *acpi_root_dir; 64extern struct proc_dir_entry *acpi_root_dir;
65 65
66enum acpi_bus_removal_type {
67 ACPI_BUS_REMOVAL_NORMAL = 0,
68 ACPI_BUS_REMOVAL_EJECT,
69 ACPI_BUS_REMOVAL_SUPRISE,
70 ACPI_BUS_REMOVAL_TYPE_COUNT
71};
72
73enum acpi_bus_device_type { 66enum acpi_bus_device_type {
74 ACPI_BUS_TYPE_DEVICE = 0, 67 ACPI_BUS_TYPE_DEVICE = 0,
75 ACPI_BUS_TYPE_POWER, 68 ACPI_BUS_TYPE_POWER,
@@ -163,12 +156,10 @@ struct acpi_device_flags {
163 u32 dynamic_status:1; 156 u32 dynamic_status:1;
164 u32 removable:1; 157 u32 removable:1;
165 u32 ejectable:1; 158 u32 ejectable:1;
166 u32 suprise_removal_ok:1;
167 u32 power_manageable:1; 159 u32 power_manageable:1;
168 u32 performance_manageable:1;
169 u32 eject_pending:1; 160 u32 eject_pending:1;
170 u32 match_driver:1; 161 u32 match_driver:1;
171 u32 reserved:24; 162 u32 reserved:26;
172}; 163};
173 164
174/* File System */ 165/* File System */
@@ -286,6 +277,7 @@ struct acpi_device_physical_node {
286 u8 node_id; 277 u8 node_id;
287 struct list_head node; 278 struct list_head node;
288 struct device *dev; 279 struct device *dev;
280 bool put_online:1;
289}; 281};
290 282
291/* set maximum of physical nodes to 32 for expansibility */ 283/* set maximum of physical nodes to 32 for expansibility */
@@ -310,7 +302,6 @@ struct acpi_device {
310 struct acpi_driver *driver; 302 struct acpi_driver *driver;
311 void *driver_data; 303 void *driver_data;
312 struct device dev; 304 struct device dev;
313 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */
314 u8 physical_node_count; 305 u8 physical_node_count;
315 struct list_head physical_node_list; 306 struct list_head physical_node_list;
316 struct mutex physical_node_lock; 307 struct mutex physical_node_lock;
@@ -468,8 +459,6 @@ acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
468 acpi_notify_handler handler, void *context); 459 acpi_notify_handler handler, void *context);
469acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, 460acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
470 acpi_notify_handler handler); 461 acpi_notify_handler handler);
471int acpi_device_power_state(struct device *dev, struct acpi_device *adev,
472 u32 target_state, int d_max_in, int *d_min_p);
473int acpi_pm_device_sleep_state(struct device *, int *, int); 462int acpi_pm_device_sleep_state(struct device *, int *, int);
474void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev); 463void acpi_dev_pm_add_dependent(acpi_handle handle, struct device *depdev);
475void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev); 464void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev);
@@ -485,23 +474,13 @@ static inline acpi_status acpi_remove_pm_notifier(struct acpi_device *adev,
485{ 474{
486 return AE_SUPPORT; 475 return AE_SUPPORT;
487} 476}
488static inline int __acpi_device_power_state(int m, int *p) 477static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
489{ 478{
490 if (p) 479 if (p)
491 *p = ACPI_STATE_D0; 480 *p = ACPI_STATE_D0;
481
492 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0; 482 return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3) ? m : ACPI_STATE_D0;
493} 483}
494static inline int acpi_device_power_state(struct device *dev,
495 struct acpi_device *adev,
496 u32 target_state, int d_max_in,
497 int *d_min_p)
498{
499 return __acpi_device_power_state(d_max_in, d_min_p);
500}
501static inline int acpi_pm_device_sleep_state(struct device *d, int *p, int m)
502{
503 return __acpi_device_power_state(m, p);
504}
505static inline void acpi_dev_pm_add_dependent(acpi_handle handle, 484static inline void acpi_dev_pm_add_dependent(acpi_handle handle,
506 struct device *depdev) {} 485 struct device *depdev) {}
507static inline void acpi_dev_pm_remove_dependent(acpi_handle handle, 486static inline void acpi_dev_pm_remove_dependent(acpi_handle handle,
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 454881e6450a..1b09300810e6 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -46,7 +46,7 @@
46 46
47/* Current ACPICA subsystem version in YYYYMMDD format */ 47/* Current ACPICA subsystem version in YYYYMMDD format */
48 48
49#define ACPI_CA_VERSION 0x20130328 49#define ACPI_CA_VERSION 0x20130517
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
@@ -80,6 +80,7 @@ extern bool acpi_gbl_enable_aml_debug_object;
80extern u8 acpi_gbl_copy_dsdt_locally; 80extern u8 acpi_gbl_copy_dsdt_locally;
81extern u8 acpi_gbl_truncate_io_addresses; 81extern u8 acpi_gbl_truncate_io_addresses;
82extern u8 acpi_gbl_disable_auto_repair; 82extern u8 acpi_gbl_disable_auto_repair;
83extern u8 acpi_gbl_disable_ssdt_table_load;
83 84
84/* 85/*
85 * Hardware-reduced prototypes. All interfaces that use these macros will 86 * Hardware-reduced prototypes. All interfaces that use these macros will
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index ea69367fdd3b..66096d06925e 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -6,6 +6,10 @@
6#include <linux/thermal.h> 6#include <linux/thermal.h>
7#include <asm/acpi.h> 7#include <asm/acpi.h>
8 8
9#define ACPI_PROCESSOR_CLASS "processor"
10#define ACPI_PROCESSOR_DEVICE_NAME "Processor"
11#define ACPI_PROCESSOR_DEVICE_HID "ACPI0007"
12
9#define ACPI_PROCESSOR_BUSY_METRIC 10 13#define ACPI_PROCESSOR_BUSY_METRIC 10
10 14
11#define ACPI_PROCESSOR_MAX_POWER 8 15#define ACPI_PROCESSOR_MAX_POWER 8
@@ -207,6 +211,7 @@ struct acpi_processor {
207 struct acpi_processor_throttling throttling; 211 struct acpi_processor_throttling throttling;
208 struct acpi_processor_limit limit; 212 struct acpi_processor_limit limit;
209 struct thermal_cooling_device *cdev; 213 struct thermal_cooling_device *cdev;
214 struct device *dev; /* Processor device. */
210}; 215};
211 216
212struct acpi_processor_errata { 217struct acpi_processor_errata {
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 17b5b5967641..353ba256f368 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -352,8 +352,7 @@ extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
352 352
353/* Enable _OST when all relevant hotplug operations are enabled */ 353/* Enable _OST when all relevant hotplug operations are enabled */
354#if defined(CONFIG_ACPI_HOTPLUG_CPU) && \ 354#if defined(CONFIG_ACPI_HOTPLUG_CPU) && \
355 (defined(CONFIG_ACPI_HOTPLUG_MEMORY) || \ 355 defined(CONFIG_ACPI_HOTPLUG_MEMORY) && \
356 defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) && \
357 defined(CONFIG_ACPI_CONTAINER) 356 defined(CONFIG_ACPI_CONTAINER)
358#define ACPI_HOTPLUG_OST 357#define ACPI_HOTPLUG_OST
359#endif 358#endif
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 037d36ae63e5..4d7390bc1727 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * linux/include/linux/cpufreq.h 2 * linux/include/linux/cpufreq.h
3 * 3 *
4 * Copyright (C) 2001 Russell King 4 * Copyright (C) 2001 Russell King
5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> 5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -26,7 +26,6 @@
26/* Print length for names. Extra 1 space for accomodating '\n' in prints */ 26/* Print length for names. Extra 1 space for accomodating '\n' in prints */
27#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1) 27#define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1)
28 28
29
30/********************************************************************* 29/*********************************************************************
31 * CPUFREQ NOTIFIER INTERFACE * 30 * CPUFREQ NOTIFIER INTERFACE *
32 *********************************************************************/ 31 *********************************************************************/
@@ -71,6 +70,10 @@ struct cpufreq_governor;
71 70
72/* /sys/devices/system/cpu/cpufreq: entry point for global variables */ 71/* /sys/devices/system/cpu/cpufreq: entry point for global variables */
73extern struct kobject *cpufreq_global_kobject; 72extern struct kobject *cpufreq_global_kobject;
73int cpufreq_get_global_kobject(void);
74void cpufreq_put_global_kobject(void);
75int cpufreq_sysfs_create_file(const struct attribute *attr);
76void cpufreq_sysfs_remove_file(const struct attribute *attr);
74 77
75#define CPUFREQ_ETERNAL (-1) 78#define CPUFREQ_ETERNAL (-1)
76struct cpufreq_cpuinfo { 79struct cpufreq_cpuinfo {
@@ -107,6 +110,7 @@ struct cpufreq_policy {
107 unsigned int policy; /* see above */ 110 unsigned int policy; /* see above */
108 struct cpufreq_governor *governor; /* see below */ 111 struct cpufreq_governor *governor; /* see below */
109 void *governor_data; 112 void *governor_data;
113 bool governor_enabled; /* governor start/stop flag */
110 114
111 struct work_struct update; /* if update_policy() needs to be 115 struct work_struct update; /* if update_policy() needs to be
112 * called, but you're in IRQ context */ 116 * called, but you're in IRQ context */
@@ -115,6 +119,7 @@ struct cpufreq_policy {
115 119
116 struct kobject kobj; 120 struct kobject kobj;
117 struct completion kobj_unregister; 121 struct completion kobj_unregister;
122 bool transition_ongoing; /* Tracks transition status */
118}; 123};
119 124
120#define CPUFREQ_ADJUST (0) 125#define CPUFREQ_ADJUST (0)
@@ -148,17 +153,18 @@ struct cpufreq_freqs {
148 u8 flags; /* flags of cpufreq_driver, see below. */ 153 u8 flags; /* flags of cpufreq_driver, see below. */
149}; 154};
150 155
151
152/** 156/**
153 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch safe) 157 * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch
158 * safe)
154 * @old: old value 159 * @old: old value
155 * @div: divisor 160 * @div: divisor
156 * @mult: multiplier 161 * @mult: multiplier
157 * 162 *
158 * 163 *
159 * new = old * mult / div 164 * new = old * mult / div
160 */ 165 */
161static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mult) 166static inline unsigned long cpufreq_scale(unsigned long old, u_int div,
167 u_int mult)
162{ 168{
163#if BITS_PER_LONG == 32 169#if BITS_PER_LONG == 32
164 170
@@ -211,14 +217,12 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
211 unsigned int target_freq, 217 unsigned int target_freq,
212 unsigned int relation); 218 unsigned int relation);
213 219
214
215extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy, 220extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy,
216 unsigned int cpu); 221 unsigned int cpu);
217 222
218int cpufreq_register_governor(struct cpufreq_governor *governor); 223int cpufreq_register_governor(struct cpufreq_governor *governor);
219void cpufreq_unregister_governor(struct cpufreq_governor *governor); 224void cpufreq_unregister_governor(struct cpufreq_governor *governor);
220 225
221
222/********************************************************************* 226/*********************************************************************
223 * CPUFREQ DRIVER INTERFACE * 227 * CPUFREQ DRIVER INTERFACE *
224 *********************************************************************/ 228 *********************************************************************/
@@ -229,7 +233,7 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor);
229struct freq_attr; 233struct freq_attr;
230 234
231struct cpufreq_driver { 235struct cpufreq_driver {
232 struct module *owner; 236 struct module *owner;
233 char name[CPUFREQ_NAME_LEN]; 237 char name[CPUFREQ_NAME_LEN];
234 u8 flags; 238 u8 flags;
235 /* 239 /*
@@ -277,11 +281,11 @@ struct cpufreq_driver {
277int cpufreq_register_driver(struct cpufreq_driver *driver_data); 281int cpufreq_register_driver(struct cpufreq_driver *driver_data);
278int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 282int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
279 283
280
281void cpufreq_notify_transition(struct cpufreq_policy *policy, 284void cpufreq_notify_transition(struct cpufreq_policy *policy,
282 struct cpufreq_freqs *freqs, unsigned int state); 285 struct cpufreq_freqs *freqs, unsigned int state);
283 286
284static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max) 287static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
288 unsigned int min, unsigned int max)
285{ 289{
286 if (policy->min < min) 290 if (policy->min < min)
287 policy->min = min; 291 policy->min = min;
@@ -337,12 +341,16 @@ const char *cpufreq_get_current_driver(void);
337/********************************************************************* 341/*********************************************************************
338 * CPUFREQ 2.6. INTERFACE * 342 * CPUFREQ 2.6. INTERFACE *
339 *********************************************************************/ 343 *********************************************************************/
344u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
340int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); 345int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
341int cpufreq_update_policy(unsigned int cpu); 346int cpufreq_update_policy(unsigned int cpu);
342bool have_governor_per_policy(void); 347bool have_governor_per_policy(void);
348struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
343 349
344#ifdef CONFIG_CPU_FREQ 350#ifdef CONFIG_CPU_FREQ
345/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ 351/*
352 * query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it
353 */
346unsigned int cpufreq_get(unsigned int cpu); 354unsigned int cpufreq_get(unsigned int cpu);
347#else 355#else
348static inline unsigned int cpufreq_get(unsigned int cpu) 356static inline unsigned int cpufreq_get(unsigned int cpu)
@@ -351,7 +359,9 @@ static inline unsigned int cpufreq_get(unsigned int cpu)
351} 359}
352#endif 360#endif
353 361
354/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ 362/*
363 * query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it
364 */
355#ifdef CONFIG_CPU_FREQ 365#ifdef CONFIG_CPU_FREQ
356unsigned int cpufreq_quick_get(unsigned int cpu); 366unsigned int cpufreq_quick_get(unsigned int cpu);
357unsigned int cpufreq_quick_get_max(unsigned int cpu); 367unsigned int cpufreq_quick_get_max(unsigned int cpu);
@@ -366,16 +376,14 @@ static inline unsigned int cpufreq_quick_get_max(unsigned int cpu)
366} 376}
367#endif 377#endif
368 378
369
370/********************************************************************* 379/*********************************************************************
371 * CPUFREQ DEFAULT GOVERNOR * 380 * CPUFREQ DEFAULT GOVERNOR *
372 *********************************************************************/ 381 *********************************************************************/
373 382
374
375/* 383/*
376 Performance governor is fallback governor if any other gov failed to 384 * Performance governor is fallback governor if any other gov failed to auto
377 auto load due latency restrictions 385 * load due latency restrictions
378*/ 386 */
379#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE 387#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE
380extern struct cpufreq_governor cpufreq_gov_performance; 388extern struct cpufreq_governor cpufreq_gov_performance;
381#endif 389#endif
@@ -395,7 +403,6 @@ extern struct cpufreq_governor cpufreq_gov_conservative;
395#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative) 403#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative)
396#endif 404#endif
397 405
398
399/********************************************************************* 406/*********************************************************************
400 * FREQUENCY TABLE HELPERS * 407 * FREQUENCY TABLE HELPERS *
401 *********************************************************************/ 408 *********************************************************************/
@@ -404,7 +411,7 @@ extern struct cpufreq_governor cpufreq_gov_conservative;
404#define CPUFREQ_TABLE_END ~1 411#define CPUFREQ_TABLE_END ~1
405 412
406struct cpufreq_frequency_table { 413struct cpufreq_frequency_table {
407 unsigned int index; /* any */ 414 unsigned int driver_data; /* driver specific data, not used by core */
408 unsigned int frequency; /* kHz - doesn't need to be in ascending 415 unsigned int frequency; /* kHz - doesn't need to be in ascending
409 * order */ 416 * order */
410}; 417};
@@ -432,4 +439,7 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
432void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy); 439void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
433 440
434void cpufreq_frequency_table_put_attr(unsigned int cpu); 441void cpufreq_frequency_table_put_attr(unsigned int cpu);
442
443ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf);
444
435#endif /* _LINUX_CPUFREQ_H */ 445#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 8f0406230a0a..0bc4b74668e9 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -111,6 +111,9 @@ struct cpuidle_driver {
111 struct cpuidle_state states[CPUIDLE_STATE_MAX]; 111 struct cpuidle_state states[CPUIDLE_STATE_MAX];
112 int state_count; 112 int state_count;
113 int safe_state_index; 113 int safe_state_index;
114
115 /* the driver handles the cpus in cpumask */
116 struct cpumask *cpumask;
114}; 117};
115 118
116#ifdef CONFIG_CPU_IDLE 119#ifdef CONFIG_CPU_IDLE
@@ -135,9 +138,6 @@ extern void cpuidle_disable_device(struct cpuidle_device *dev);
135extern int cpuidle_play_dead(void); 138extern int cpuidle_play_dead(void);
136 139
137extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); 140extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
138extern int cpuidle_register_cpu_driver(struct cpuidle_driver *drv, int cpu);
139extern void cpuidle_unregister_cpu_driver(struct cpuidle_driver *drv, int cpu);
140
141#else 141#else
142static inline void disable_cpuidle(void) { } 142static inline void disable_cpuidle(void) { }
143static inline int cpuidle_idle_call(void) { return -ENODEV; } 143static inline int cpuidle_idle_call(void) { return -ENODEV; }
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 21ca773f77bf..822c1354f3a6 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -51,7 +51,7 @@ struct task_struct;
51extern void debug_show_all_locks(void); 51extern void debug_show_all_locks(void);
52extern void debug_show_held_locks(struct task_struct *task); 52extern void debug_show_held_locks(struct task_struct *task);
53extern void debug_check_no_locks_freed(const void *from, unsigned long len); 53extern void debug_check_no_locks_freed(const void *from, unsigned long len);
54extern void debug_check_no_locks_held(struct task_struct *task); 54extern void debug_check_no_locks_held(void);
55#else 55#else
56static inline void debug_show_all_locks(void) 56static inline void debug_show_all_locks(void)
57{ 57{
@@ -67,7 +67,7 @@ debug_check_no_locks_freed(const void *from, unsigned long len)
67} 67}
68 68
69static inline void 69static inline void
70debug_check_no_locks_held(struct task_struct *task) 70debug_check_no_locks_held(void)
71{ 71{
72} 72}
73#endif 73#endif
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index fe8c4476f7e4..5f1ab92107e6 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -181,6 +181,8 @@ extern struct devfreq *devfreq_add_device(struct device *dev,
181 const char *governor_name, 181 const char *governor_name,
182 void *data); 182 void *data);
183extern int devfreq_remove_device(struct devfreq *devfreq); 183extern int devfreq_remove_device(struct devfreq *devfreq);
184
185/* Supposed to be called by PM_SLEEP/PM_RUNTIME callbacks */
184extern int devfreq_suspend_device(struct devfreq *devfreq); 186extern int devfreq_suspend_device(struct devfreq *devfreq);
185extern int devfreq_resume_device(struct devfreq *devfreq); 187extern int devfreq_resume_device(struct devfreq *devfreq);
186 188
diff --git a/include/linux/device.h b/include/linux/device.h
index 9d4835a8f8b8..bcf8c0d4cd98 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -71,6 +71,10 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
71 * the specific driver's probe to initial the matched device. 71 * the specific driver's probe to initial the matched device.
72 * @remove: Called when a device removed from this bus. 72 * @remove: Called when a device removed from this bus.
73 * @shutdown: Called at shut-down time to quiesce the device. 73 * @shutdown: Called at shut-down time to quiesce the device.
74 *
75 * @online: Called to put the device back online (after offlining it).
76 * @offline: Called to put the device offline for hot-removal. May fail.
77 *
74 * @suspend: Called when a device on this bus wants to go to sleep mode. 78 * @suspend: Called when a device on this bus wants to go to sleep mode.
75 * @resume: Called to bring a device on this bus out of sleep mode. 79 * @resume: Called to bring a device on this bus out of sleep mode.
76 * @pm: Power management operations of this bus, callback the specific 80 * @pm: Power management operations of this bus, callback the specific
@@ -105,6 +109,9 @@ struct bus_type {
105 int (*remove)(struct device *dev); 109 int (*remove)(struct device *dev);
106 void (*shutdown)(struct device *dev); 110 void (*shutdown)(struct device *dev);
107 111
112 int (*online)(struct device *dev);
113 int (*offline)(struct device *dev);
114
108 int (*suspend)(struct device *dev, pm_message_t state); 115 int (*suspend)(struct device *dev, pm_message_t state);
109 int (*resume)(struct device *dev); 116 int (*resume)(struct device *dev);
110 117
@@ -652,6 +659,9 @@ struct acpi_dev_node {
652 * device (i.e. the bus driver that discovered the device). 659 * device (i.e. the bus driver that discovered the device).
653 * @iommu_group: IOMMU group the device belongs to. 660 * @iommu_group: IOMMU group the device belongs to.
654 * 661 *
662 * @offline_disabled: If set, the device is permanently online.
663 * @offline: Set after successful invocation of bus type's .offline().
664 *
655 * At the lowest level, every device in a Linux system is represented by an 665 * At the lowest level, every device in a Linux system is represented by an
656 * instance of struct device. The device structure contains the information 666 * instance of struct device. The device structure contains the information
657 * that the device model core needs to model the system. Most subsystems, 667 * that the device model core needs to model the system. Most subsystems,
@@ -723,6 +733,9 @@ struct device {
723 733
724 void (*release)(struct device *dev); 734 void (*release)(struct device *dev);
725 struct iommu_group *iommu_group; 735 struct iommu_group *iommu_group;
736
737 bool offline_disabled:1;
738 bool offline:1;
726}; 739};
727 740
728static inline struct device *kobj_to_dev(struct kobject *kobj) 741static inline struct device *kobj_to_dev(struct kobject *kobj)
@@ -859,6 +872,15 @@ extern const char *device_get_devnode(struct device *dev,
859extern void *dev_get_drvdata(const struct device *dev); 872extern void *dev_get_drvdata(const struct device *dev);
860extern int dev_set_drvdata(struct device *dev, void *data); 873extern int dev_set_drvdata(struct device *dev, void *data);
861 874
875static inline bool device_supports_offline(struct device *dev)
876{
877 return dev->bus && dev->bus->offline && dev->bus->online;
878}
879
880extern void lock_device_hotplug(void);
881extern void unlock_device_hotplug(void);
882extern int device_offline(struct device *dev);
883extern int device_online(struct device *dev);
862/* 884/*
863 * Root device objects for grouping under /sys/devices 885 * Root device objects for grouping under /sys/devices
864 */ 886 */
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index e70df40d84f6..7fd81b8c4897 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -3,6 +3,7 @@
3#ifndef FREEZER_H_INCLUDED 3#ifndef FREEZER_H_INCLUDED
4#define FREEZER_H_INCLUDED 4#define FREEZER_H_INCLUDED
5 5
6#include <linux/debug_locks.h>
6#include <linux/sched.h> 7#include <linux/sched.h>
7#include <linux/wait.h> 8#include <linux/wait.h>
8#include <linux/atomic.h> 9#include <linux/atomic.h>
@@ -46,7 +47,11 @@ extern int freeze_kernel_threads(void);
46extern void thaw_processes(void); 47extern void thaw_processes(void);
47extern void thaw_kernel_threads(void); 48extern void thaw_kernel_threads(void);
48 49
49static inline bool try_to_freeze(void) 50/*
51 * DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION
52 * If try_to_freeze causes a lockdep warning it means the caller may deadlock
53 */
54static inline bool try_to_freeze_unsafe(void)
50{ 55{
51 might_sleep(); 56 might_sleep();
52 if (likely(!freezing(current))) 57 if (likely(!freezing(current)))
@@ -54,6 +59,13 @@ static inline bool try_to_freeze(void)
54 return __refrigerator(false); 59 return __refrigerator(false);
55} 60}
56 61
62static inline bool try_to_freeze(void)
63{
64 if (!(current->flags & PF_NOFREEZE))
65 debug_check_no_locks_held();
66 return try_to_freeze_unsafe();
67}
68
57extern bool freeze_task(struct task_struct *p); 69extern bool freeze_task(struct task_struct *p);
58extern bool set_freezable(void); 70extern bool set_freezable(void);
59 71
@@ -115,6 +127,14 @@ static inline void freezer_count(void)
115 try_to_freeze(); 127 try_to_freeze();
116} 128}
117 129
130/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
131static inline void freezer_count_unsafe(void)
132{
133 current->flags &= ~PF_FREEZER_SKIP;
134 smp_mb();
135 try_to_freeze_unsafe();
136}
137
118/** 138/**
119 * freezer_should_skip - whether to skip a task when determining frozen 139 * freezer_should_skip - whether to skip a task when determining frozen
120 * state is reached 140 * state is reached
@@ -139,28 +159,86 @@ static inline bool freezer_should_skip(struct task_struct *p)
139} 159}
140 160
141/* 161/*
142 * These macros are intended to be used whenever you want allow a sleeping 162 * These functions are intended to be used whenever you want allow a sleeping
143 * task to be frozen. Note that neither return any clear indication of 163 * task to be frozen. Note that neither return any clear indication of
144 * whether a freeze event happened while in this function. 164 * whether a freeze event happened while in this function.
145 */ 165 */
146 166
147/* Like schedule(), but should not block the freezer. */ 167/* Like schedule(), but should not block the freezer. */
148#define freezable_schedule() \ 168static inline void freezable_schedule(void)
149({ \ 169{
150 freezer_do_not_count(); \ 170 freezer_do_not_count();
151 schedule(); \ 171 schedule();
152 freezer_count(); \ 172 freezer_count();
153}) 173}
174
175/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
176static inline void freezable_schedule_unsafe(void)
177{
178 freezer_do_not_count();
179 schedule();
180 freezer_count_unsafe();
181}
182
183/*
184 * Like freezable_schedule_timeout(), but should not block the freezer. Do not
185 * call this with locks held.
186 */
187static inline long freezable_schedule_timeout(long timeout)
188{
189 long __retval;
190 freezer_do_not_count();
191 __retval = schedule_timeout(timeout);
192 freezer_count();
193 return __retval;
194}
195
196/*
197 * Like schedule_timeout_interruptible(), but should not block the freezer. Do not
198 * call this with locks held.
199 */
200static inline long freezable_schedule_timeout_interruptible(long timeout)
201{
202 long __retval;
203 freezer_do_not_count();
204 __retval = schedule_timeout_interruptible(timeout);
205 freezer_count();
206 return __retval;
207}
154 208
155/* Like schedule_timeout_killable(), but should not block the freezer. */ 209/* Like schedule_timeout_killable(), but should not block the freezer. */
156#define freezable_schedule_timeout_killable(timeout) \ 210static inline long freezable_schedule_timeout_killable(long timeout)
157({ \ 211{
158 long __retval; \ 212 long __retval;
159 freezer_do_not_count(); \ 213 freezer_do_not_count();
160 __retval = schedule_timeout_killable(timeout); \ 214 __retval = schedule_timeout_killable(timeout);
161 freezer_count(); \ 215 freezer_count();
162 __retval; \ 216 return __retval;
163}) 217}
218
219/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
220static inline long freezable_schedule_timeout_killable_unsafe(long timeout)
221{
222 long __retval;
223 freezer_do_not_count();
224 __retval = schedule_timeout_killable(timeout);
225 freezer_count_unsafe();
226 return __retval;
227}
228
229/*
230 * Like schedule_hrtimeout_range(), but should not block the freezer. Do not
231 * call this with locks held.
232 */
233static inline int freezable_schedule_hrtimeout_range(ktime_t *expires,
234 unsigned long delta, const enum hrtimer_mode mode)
235{
236 int __retval;
237 freezer_do_not_count();
238 __retval = schedule_hrtimeout_range(expires, delta, mode);
239 freezer_count();
240 return __retval;
241}
164 242
165/* 243/*
166 * Freezer-friendly wrappers around wait_event_interruptible(), 244 * Freezer-friendly wrappers around wait_event_interruptible(),
@@ -177,33 +255,45 @@ static inline bool freezer_should_skip(struct task_struct *p)
177 __retval; \ 255 __retval; \
178}) 256})
179 257
258/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
259#define wait_event_freezekillable_unsafe(wq, condition) \
260({ \
261 int __retval; \
262 freezer_do_not_count(); \
263 __retval = wait_event_killable(wq, (condition)); \
264 freezer_count_unsafe(); \
265 __retval; \
266})
267
180#define wait_event_freezable(wq, condition) \ 268#define wait_event_freezable(wq, condition) \
181({ \ 269({ \
182 int __retval; \ 270 int __retval; \
183 for (;;) { \ 271 freezer_do_not_count(); \
184 __retval = wait_event_interruptible(wq, \ 272 __retval = wait_event_interruptible(wq, (condition)); \
185 (condition) || freezing(current)); \ 273 freezer_count(); \
186 if (__retval || (condition)) \
187 break; \
188 try_to_freeze(); \
189 } \
190 __retval; \ 274 __retval; \
191}) 275})
192 276
193#define wait_event_freezable_timeout(wq, condition, timeout) \ 277#define wait_event_freezable_timeout(wq, condition, timeout) \
194({ \ 278({ \
195 long __retval = timeout; \ 279 long __retval = timeout; \
196 for (;;) { \ 280 freezer_do_not_count(); \
197 __retval = wait_event_interruptible_timeout(wq, \ 281 __retval = wait_event_interruptible_timeout(wq, (condition), \
198 (condition) || freezing(current), \ 282 __retval); \
199 __retval); \ 283 freezer_count(); \
200 if (__retval <= 0 || (condition)) \
201 break; \
202 try_to_freeze(); \
203 } \
204 __retval; \ 284 __retval; \
205}) 285})
206 286
287#define wait_event_freezable_exclusive(wq, condition) \
288({ \
289 int __retval; \
290 freezer_do_not_count(); \
291 __retval = wait_event_interruptible_exclusive(wq, condition); \
292 freezer_count(); \
293 __retval; \
294})
295
296
207#else /* !CONFIG_FREEZER */ 297#else /* !CONFIG_FREEZER */
208static inline bool frozen(struct task_struct *p) { return false; } 298static inline bool frozen(struct task_struct *p) { return false; }
209static inline bool freezing(struct task_struct *p) { return false; } 299static inline bool freezing(struct task_struct *p) { return false; }
@@ -225,18 +315,37 @@ static inline void set_freezable(void) {}
225 315
226#define freezable_schedule() schedule() 316#define freezable_schedule() schedule()
227 317
318#define freezable_schedule_unsafe() schedule()
319
320#define freezable_schedule_timeout(timeout) schedule_timeout(timeout)
321
322#define freezable_schedule_timeout_interruptible(timeout) \
323 schedule_timeout_interruptible(timeout)
324
228#define freezable_schedule_timeout_killable(timeout) \ 325#define freezable_schedule_timeout_killable(timeout) \
229 schedule_timeout_killable(timeout) 326 schedule_timeout_killable(timeout)
230 327
328#define freezable_schedule_timeout_killable_unsafe(timeout) \
329 schedule_timeout_killable(timeout)
330
331#define freezable_schedule_hrtimeout_range(expires, delta, mode) \
332 schedule_hrtimeout_range(expires, delta, mode)
333
231#define wait_event_freezable(wq, condition) \ 334#define wait_event_freezable(wq, condition) \
232 wait_event_interruptible(wq, condition) 335 wait_event_interruptible(wq, condition)
233 336
234#define wait_event_freezable_timeout(wq, condition, timeout) \ 337#define wait_event_freezable_timeout(wq, condition, timeout) \
235 wait_event_interruptible_timeout(wq, condition, timeout) 338 wait_event_interruptible_timeout(wq, condition, timeout)
236 339
340#define wait_event_freezable_exclusive(wq, condition) \
341 wait_event_interruptible_exclusive(wq, condition)
342
237#define wait_event_freezekillable(wq, condition) \ 343#define wait_event_freezekillable(wq, condition) \
238 wait_event_killable(wq, condition) 344 wait_event_killable(wq, condition)
239 345
346#define wait_event_freezekillable_unsafe(wq, condition) \
347 wait_event_killable(wq, condition)
348
240#endif /* !CONFIG_FREEZER */ 349#endif /* !CONFIG_FREEZER */
241 350
242#endif /* FREEZER_H_INCLUDED */ 351#endif /* FREEZER_H_INCLUDED */
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 3e622c610925..dd38e62b84d2 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -234,6 +234,8 @@ static inline void unlock_memory_hotplug(void) {}
234 234
235extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages); 235extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
236extern void try_offline_node(int nid); 236extern void try_offline_node(int nid);
237extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
238extern void remove_memory(int nid, u64 start, u64 size);
237 239
238#else 240#else
239static inline int is_mem_section_removable(unsigned long pfn, 241static inline int is_mem_section_removable(unsigned long pfn,
@@ -243,15 +245,23 @@ static inline int is_mem_section_removable(unsigned long pfn,
243} 245}
244 246
245static inline void try_offline_node(int nid) {} 247static inline void try_offline_node(int nid) {}
248
249static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
250{
251 return -EINVAL;
252}
253
254static inline void remove_memory(int nid, u64 start, u64 size) {}
246#endif /* CONFIG_MEMORY_HOTREMOVE */ 255#endif /* CONFIG_MEMORY_HOTREMOVE */
247 256
257extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
258 void *arg, int (*func)(struct memory_block *, void *));
248extern int mem_online_node(int nid); 259extern int mem_online_node(int nid);
249extern int add_memory(int nid, u64 start, u64 size); 260extern int add_memory(int nid, u64 start, u64 size);
250extern int arch_add_memory(int nid, u64 start, u64 size); 261extern int arch_add_memory(int nid, u64 start, u64 size);
251extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 262extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
252extern int offline_memory_block(struct memory_block *mem);
253extern bool is_memblock_offlined(struct memory_block *mem); 263extern bool is_memblock_offlined(struct memory_block *mem);
254extern int remove_memory(int nid, u64 start, u64 size); 264extern void remove_memory(int nid, u64 start, u64 size);
255extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, 265extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
256 int nr_pages); 266 int nr_pages);
257extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms); 267extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms);
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 7d7e09efff9b..6fa7cea25da9 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -37,7 +37,6 @@ extern void pm_runtime_enable(struct device *dev);
37extern void __pm_runtime_disable(struct device *dev, bool check_resume); 37extern void __pm_runtime_disable(struct device *dev, bool check_resume);
38extern void pm_runtime_allow(struct device *dev); 38extern void pm_runtime_allow(struct device *dev);
39extern void pm_runtime_forbid(struct device *dev); 39extern void pm_runtime_forbid(struct device *dev);
40extern int pm_generic_runtime_idle(struct device *dev);
41extern int pm_generic_runtime_suspend(struct device *dev); 40extern int pm_generic_runtime_suspend(struct device *dev);
42extern int pm_generic_runtime_resume(struct device *dev); 41extern int pm_generic_runtime_resume(struct device *dev);
43extern void pm_runtime_no_callbacks(struct device *dev); 42extern void pm_runtime_no_callbacks(struct device *dev);
@@ -143,7 +142,6 @@ static inline bool pm_runtime_active(struct device *dev) { return true; }
143static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } 142static inline bool pm_runtime_status_suspended(struct device *dev) { return false; }
144static inline bool pm_runtime_enabled(struct device *dev) { return false; } 143static inline bool pm_runtime_enabled(struct device *dev) { return false; }
145 144
146static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
147static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 145static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
148static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 146static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
149static inline void pm_runtime_no_callbacks(struct device *dev) {} 147static inline void pm_runtime_no_callbacks(struct device *dev) {}
diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h
index c0f44c2b006d..d8b187c3925d 100644
--- a/include/linux/power/smartreflex.h
+++ b/include/linux/power/smartreflex.h
@@ -299,11 +299,11 @@ void omap_sr_disable_reset_volt(struct voltagedomain *voltdm);
299void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data); 299void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data);
300 300
301/* Smartreflex driver hooks to be called from Smartreflex class driver */ 301/* Smartreflex driver hooks to be called from Smartreflex class driver */
302int sr_enable(struct voltagedomain *voltdm, unsigned long volt); 302int sr_enable(struct omap_sr *sr, unsigned long volt);
303void sr_disable(struct voltagedomain *voltdm); 303void sr_disable(struct omap_sr *sr);
304int sr_configure_errgen(struct voltagedomain *voltdm); 304int sr_configure_errgen(struct omap_sr *sr);
305int sr_disable_errgen(struct voltagedomain *voltdm); 305int sr_disable_errgen(struct omap_sr *sr);
306int sr_configure_minmax(struct voltagedomain *voltdm); 306int sr_configure_minmax(struct omap_sr *sr);
307 307
308/* API to register the smartreflex class driver with the smartreflex driver */ 308/* API to register the smartreflex class driver with the smartreflex driver */
309int sr_register_class(struct omap_sr_class_data *class_data); 309int sr_register_class(struct omap_sr_class_data *class_data);
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index d4e3f16d5e89..f73cabf59012 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -363,6 +363,7 @@ extern bool pm_wakeup_pending(void);
363extern bool pm_get_wakeup_count(unsigned int *count, bool block); 363extern bool pm_get_wakeup_count(unsigned int *count, bool block);
364extern bool pm_save_wakeup_count(unsigned int count); 364extern bool pm_save_wakeup_count(unsigned int count);
365extern void pm_wakep_autosleep_enabled(bool set); 365extern void pm_wakep_autosleep_enabled(bool set);
366extern void pm_print_active_wakeup_sources(void);
366 367
367static inline void lock_system_sleep(void) 368static inline void lock_system_sleep(void)
368{ 369{
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 427acab5d69a..8e42410bd159 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -5,6 +5,7 @@
5#define _TRACE_POWER_H 5#define _TRACE_POWER_H
6 6
7#include <linux/ktime.h> 7#include <linux/ktime.h>
8#include <linux/pm_qos.h>
8#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
9 10
10DECLARE_EVENT_CLASS(cpu, 11DECLARE_EVENT_CLASS(cpu,
@@ -177,6 +178,178 @@ DEFINE_EVENT(power_domain, power_domain_target,
177 178
178 TP_ARGS(name, state, cpu_id) 179 TP_ARGS(name, state, cpu_id)
179); 180);
181
182/*
183 * The pm qos events are used for pm qos update
184 */
185DECLARE_EVENT_CLASS(pm_qos_request,
186
187 TP_PROTO(int pm_qos_class, s32 value),
188
189 TP_ARGS(pm_qos_class, value),
190
191 TP_STRUCT__entry(
192 __field( int, pm_qos_class )
193 __field( s32, value )
194 ),
195
196 TP_fast_assign(
197 __entry->pm_qos_class = pm_qos_class;
198 __entry->value = value;
199 ),
200
201 TP_printk("pm_qos_class=%s value=%d",
202 __print_symbolic(__entry->pm_qos_class,
203 { PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
204 { PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
205 { PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
206 __entry->value)
207);
208
209DEFINE_EVENT(pm_qos_request, pm_qos_add_request,
210
211 TP_PROTO(int pm_qos_class, s32 value),
212
213 TP_ARGS(pm_qos_class, value)
214);
215
216DEFINE_EVENT(pm_qos_request, pm_qos_update_request,
217
218 TP_PROTO(int pm_qos_class, s32 value),
219
220 TP_ARGS(pm_qos_class, value)
221);
222
223DEFINE_EVENT(pm_qos_request, pm_qos_remove_request,
224
225 TP_PROTO(int pm_qos_class, s32 value),
226
227 TP_ARGS(pm_qos_class, value)
228);
229
230TRACE_EVENT(pm_qos_update_request_timeout,
231
232 TP_PROTO(int pm_qos_class, s32 value, unsigned long timeout_us),
233
234 TP_ARGS(pm_qos_class, value, timeout_us),
235
236 TP_STRUCT__entry(
237 __field( int, pm_qos_class )
238 __field( s32, value )
239 __field( unsigned long, timeout_us )
240 ),
241
242 TP_fast_assign(
243 __entry->pm_qos_class = pm_qos_class;
244 __entry->value = value;
245 __entry->timeout_us = timeout_us;
246 ),
247
248 TP_printk("pm_qos_class=%s value=%d, timeout_us=%ld",
249 __print_symbolic(__entry->pm_qos_class,
250 { PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
251 { PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
252 { PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
253 __entry->value, __entry->timeout_us)
254);
255
256DECLARE_EVENT_CLASS(pm_qos_update,
257
258 TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
259
260 TP_ARGS(action, prev_value, curr_value),
261
262 TP_STRUCT__entry(
263 __field( enum pm_qos_req_action, action )
264 __field( int, prev_value )
265 __field( int, curr_value )
266 ),
267
268 TP_fast_assign(
269 __entry->action = action;
270 __entry->prev_value = prev_value;
271 __entry->curr_value = curr_value;
272 ),
273
274 TP_printk("action=%s prev_value=%d curr_value=%d",
275 __print_symbolic(__entry->action,
276 { PM_QOS_ADD_REQ, "ADD_REQ" },
277 { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
278 { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
279 __entry->prev_value, __entry->curr_value)
280);
281
282DEFINE_EVENT(pm_qos_update, pm_qos_update_target,
283
284 TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
285
286 TP_ARGS(action, prev_value, curr_value)
287);
288
289DEFINE_EVENT_PRINT(pm_qos_update, pm_qos_update_flags,
290
291 TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
292
293 TP_ARGS(action, prev_value, curr_value),
294
295 TP_printk("action=%s prev_value=0x%x curr_value=0x%x",
296 __print_symbolic(__entry->action,
297 { PM_QOS_ADD_REQ, "ADD_REQ" },
298 { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
299 { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
300 __entry->prev_value, __entry->curr_value)
301);
302
303DECLARE_EVENT_CLASS(dev_pm_qos_request,
304
305 TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
306 s32 new_value),
307
308 TP_ARGS(name, type, new_value),
309
310 TP_STRUCT__entry(
311 __string( name, name )
312 __field( enum dev_pm_qos_req_type, type )
313 __field( s32, new_value )
314 ),
315
316 TP_fast_assign(
317 __assign_str(name, name);
318 __entry->type = type;
319 __entry->new_value = new_value;
320 ),
321
322 TP_printk("device=%s type=%s new_value=%d",
323 __get_str(name),
324 __print_symbolic(__entry->type,
325 { DEV_PM_QOS_LATENCY, "DEV_PM_QOS_LATENCY" },
326 { DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS" }),
327 __entry->new_value)
328);
329
330DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_add_request,
331
332 TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
333 s32 new_value),
334
335 TP_ARGS(name, type, new_value)
336);
337
338DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_update_request,
339
340 TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
341 s32 new_value),
342
343 TP_ARGS(name, type, new_value)
344);
345
346DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_remove_request,
347
348 TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
349 s32 new_value),
350
351 TP_ARGS(name, type, new_value)
352);
180#endif /* _TRACE_POWER_H */ 353#endif /* _TRACE_POWER_H */
181 354
182/* This part must be outside protection */ 355/* This part must be outside protection */
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d09b770..46aa3d1c1654 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -78,11 +78,25 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
78int xen_acpi_notify_hypervisor_state(u8 sleep_state, 78int xen_acpi_notify_hypervisor_state(u8 sleep_state,
79 u32 pm1a_cnt, u32 pm1b_cnd); 79 u32 pm1a_cnt, u32 pm1b_cnd);
80 80
81static inline int xen_acpi_suspend_lowlevel(void)
82{
83 /*
84 * Xen will save and restore CPU context, so
85 * we can skip that and just go straight to
86 * the suspend.
87 */
88 acpi_enter_sleep_state(ACPI_STATE_S3);
89 return 0;
90}
91
81static inline void xen_acpi_sleep_register(void) 92static inline void xen_acpi_sleep_register(void)
82{ 93{
83 if (xen_initial_domain()) 94 if (xen_initial_domain()) {
84 acpi_os_set_prepare_sleep( 95 acpi_os_set_prepare_sleep(
85 &xen_acpi_notify_hypervisor_state); 96 &xen_acpi_notify_hypervisor_state);
97
98 acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
99 }
86} 100}
87#else 101#else
88static inline void xen_acpi_sleep_register(void) 102static inline void xen_acpi_sleep_register(void)