xref: /linux/kernel/power/Kconfig (revision 85cdaca6970028bf6f544c355c90035586836ddf)
1# SPDX-License-Identifier: GPL-2.0-only
2config SUSPEND
3	bool "Suspend to RAM and standby"
4	depends on ARCH_SUSPEND_POSSIBLE
5	default y
6	help
7	  Allow the system to enter sleep states in which main memory is
8	  powered and thus its contents are preserved, such as the
9	  suspend-to-RAM state (e.g. the ACPI S3 state).
10
11config SUSPEND_FREEZER
12	bool "Enable freezer for suspend to RAM/standby" \
13		if ARCH_WANTS_FREEZER_CONTROL || BROKEN
14	depends on SUSPEND
15	default y
16	help
17	  This allows you to turn off the freezer for suspend. If this is
18	  done, no tasks are frozen for suspend to RAM/standby.
19
20	  Turning OFF this setting is NOT recommended! If in doubt, say Y.
21
22config SUSPEND_SKIP_SYNC
23	bool "Skip kernel's sys_sync() on suspend to RAM/standby"
24	depends on SUSPEND
25	depends on EXPERT
26	help
27	  Skip the kernel sys_sync() before freezing user processes.
28	  Some systems prefer not to pay this cost on every invocation
29	  of suspend, or they are content with invoking sync() from
30	  user-space before invoking suspend.  There's a run-time switch
31	  at '/sys/power/sync_on_suspend' to configure this behaviour.
32	  This setting changes the default for the run-tim switch. Say Y
33	  to change the default to disable the kernel sys_sync().
34
35config HIBERNATE_CALLBACKS
36	bool
37
38config HIBERNATION
39	bool "Hibernation (aka 'suspend to disk')"
40	depends on SWAP && ARCH_HIBERNATION_POSSIBLE
41	select HIBERNATE_CALLBACKS
42	select CRC32
43	select CRYPTO
44	select CRYPTO_LZO
45	select CRYPTO_LZ4
46	help
47	  Enable the suspend to disk (STD) functionality, which is usually
48	  called "hibernation" in user interfaces.  STD checkpoints the
49	  system and powers it off; and restores that checkpoint on reboot.
50
51	  You can suspend your machine with 'echo disk > /sys/power/state'
52	  after placing resume=/dev/swappartition on the kernel command line
53	  in your bootloader's configuration file.
54
55	  Alternatively, you can use the additional userland tools available
56	  from <http://suspend.sf.net>.
57
58	  In principle it does not require ACPI or APM, although for example
59	  ACPI will be used for the final steps when it is available.  One
60	  of the reasons to use software suspend is that the firmware hooks
61	  for suspend states like suspend-to-RAM (STR) often don't work very
62	  well with Linux.
63
64	  It creates an image which is saved in your active swap. Upon the next
65	  boot, pass the 'resume=/dev/swappartition' argument to the kernel to
66	  have it detect the saved image, restore memory state from it, and
67	  continue to run as before. If you do not want the previous state to
68	  be reloaded, then use the 'noresume' kernel command line argument.
69	  Note, however, that fsck will be run on your filesystems and you will
70	  need to run mkswap against the swap partition used for the suspend.
71
72	  It also works with swap files to a limited extent (for details see
73	  <file:Documentation/power/swsusp-and-swap-files.rst>).
74
75	  Right now you may boot without resuming and resume later but in the
76	  meantime you cannot use the swap partition(s)/file(s) involved in
77	  suspending.  Also in this case you must not use the filesystems
78	  that were mounted before the suspend.  In particular, you MUST NOT
79	  MOUNT any journaled filesystems mounted before the suspend or they
80	  will get corrupted in a nasty way.
81
82	  For more information take a look at <file:Documentation/power/swsusp.rst>.
83
84config HIBERNATION_SNAPSHOT_DEV
85	bool "Userspace snapshot device"
86	depends on HIBERNATION
87	default y
88	help
89	  Device used by the uswsusp tools.
90
91	  Say N if no snapshotting from userspace is needed, this also
92	  reduces the attack surface of the kernel.
93
94	  If in doubt, say Y.
95
96choice
97	prompt "Default compressor"
98	default HIBERNATION_COMP_LZO
99	depends on HIBERNATION
100
101config HIBERNATION_COMP_LZO
102	bool "lzo"
103	depends on CRYPTO_LZO
104
105config HIBERNATION_COMP_LZ4
106	bool "lz4"
107	depends on CRYPTO_LZ4
108
109endchoice
110
111config HIBERNATION_DEF_COMP
112	string
113	default "lzo" if HIBERNATION_COMP_LZO
114	default "lz4" if HIBERNATION_COMP_LZ4
115	help
116	  Default compressor to be used for hibernation.
117
118config PM_STD_PARTITION
119	string "Default resume partition"
120	depends on HIBERNATION
121	default ""
122	help
123	  The default resume partition is the partition that the suspend-
124	  to-disk implementation will look for a suspended disk image.
125
126	  The partition specified here will be different for almost every user.
127	  It should be a valid swap partition (at least for now) that is turned
128	  on before suspending.
129
130	  The partition specified can be overridden by specifying:
131
132		resume=/dev/<other device>
133
134	  which will set the resume partition to the device specified.
135
136	  Note there is currently not a way to specify which device to save the
137	  suspended image to. It will simply pick the first available swap
138	  device.
139
140config PM_SLEEP
141	def_bool y
142	depends on SUSPEND || HIBERNATE_CALLBACKS
143	select PM
144
145config PM_SLEEP_SMP
146	def_bool y
147	depends on SMP
148	depends on ARCH_SUSPEND_POSSIBLE || ARCH_HIBERNATION_POSSIBLE
149	depends on PM_SLEEP
150	select HOTPLUG_CPU
151
152config PM_SLEEP_SMP_NONZERO_CPU
153	def_bool y
154	depends on PM_SLEEP_SMP
155	depends on ARCH_SUSPEND_NONZERO_CPU
156	help
157	If an arch can suspend (for suspend, hibernate, kexec, etc) on a
158	non-zero numbered CPU, it may define ARCH_SUSPEND_NONZERO_CPU. This
159	will allow nohz_full mask to include CPU0.
160
161config PM_AUTOSLEEP
162	bool "Opportunistic sleep"
163	depends on PM_SLEEP
164	help
165	Allow the kernel to trigger a system transition into a global sleep
166	state automatically whenever there are no active wakeup sources.
167
168config PM_USERSPACE_AUTOSLEEP
169	bool "Userspace opportunistic sleep"
170	depends on PM_SLEEP
171	help
172	Notify kernel of aggressive userspace autosleep power management policy.
173
174	This option changes the behavior of various sleep-sensitive code to deal
175	with frequent userspace-initiated transitions into a global sleep state.
176
177	Saying Y here, disables code paths that most users really should keep
178	enabled. In particular, only enable this if it is very common to be
179	asleep/awake for very short periods of time (<= 2 seconds).
180
181	Only platforms, such as Android, that implement opportunistic sleep from
182	a userspace power manager service should enable this option; and not
183	other machines. Therefore, you should say N here, unless you are
184	extremely certain that this is what you want. The option otherwise has
185	bad, undesirable effects, and should not be enabled just for fun.
186
187
188config PM_WAKELOCKS
189	bool "User space wakeup sources interface"
190	depends on PM_SLEEP
191	help
192	Allow user space to create, activate and deactivate wakeup source
193	objects with the help of a sysfs-based interface.
194
195config PM_WAKELOCKS_LIMIT
196	int "Maximum number of user space wakeup sources (0 = no limit)"
197	range 0 100000
198	default 100
199	depends on PM_WAKELOCKS
200
201config PM_WAKELOCKS_GC
202	bool "Garbage collector for user space wakeup sources"
203	depends on PM_WAKELOCKS
204	default y
205
206config PM_QOS_CPU_SYSTEM_WAKEUP
207	bool "User space interface for CPU system wakeup QoS"
208	depends on CPU_IDLE
209	help
210	  Enable this to allow user space via the cpu_wakeup_latency file to
211	  specify a CPU system wakeup latency limit.
212
213	  This may be particularly useful for platforms supporting multiple low
214	  power states for CPUs during system-wide suspend and s2idle in
215	  particular.
216
217config PM
218	bool "Device power management core functionality"
219	help
220	  Enable functionality allowing I/O devices to be put into energy-saving
221	  (low power) states, for example after a specified period of inactivity
222	  (autosuspended), and woken up in response to a hardware-generated
223	  wake-up event or a driver's request.
224
225	  Hardware support is generally required for this functionality to work
226	  and the bus type drivers of the buses the devices are on are
227	  responsible for the actual handling of device suspend requests and
228	  wake-up events.
229
230config PM_DEBUG
231	bool "Power Management Debug Support"
232	depends on PM
233	help
234	This option enables various debugging support in the Power Management
235	code. This is helpful when debugging and reporting PM bugs, like
236	suspend support.
237
238config PM_ADVANCED_DEBUG
239	bool "Extra PM attributes in sysfs for low-level debugging/testing"
240	depends on PM_DEBUG
241	help
242	Add extra sysfs attributes allowing one to access some Power Management
243	fields of device objects from user space.  If you are not a kernel
244	developer interested in debugging/testing Power Management, say "no".
245
246config PM_TEST_SUSPEND
247	bool "Test suspend/resume and wakealarm during bootup"
248	depends on SUSPEND && PM_DEBUG && RTC_CLASS=y
249	help
250	This option will let you suspend your machine during bootup, and
251	make it wake up a few seconds later using an RTC wakeup alarm.
252	Enable this with a kernel parameter like "test_suspend=mem".
253
254	You probably want to have your system's RTC driver statically
255	linked, ensuring that it's available when this test runs.
256
257config PM_SLEEP_DEBUG
258	def_bool y
259	depends on PM_DEBUG && PM_SLEEP
260
261config DPM_WATCHDOG
262	bool "Device suspend/resume watchdog"
263	depends on PM_DEBUG && PSTORE && EXPERT
264	help
265	  Sets up a watchdog timer to capture drivers that are
266	  locked up attempting to suspend/resume a device.
267	  A detected lockup causes system panic with message
268	  captured in pstore device for inspection in subsequent
269	  boot session.
270
271config DPM_WATCHDOG_ENABLED
272	bool "Enable DPM watchdog by default"
273	depends on DPM_WATCHDOG
274	default y
275	help
276	  If you say Y here, the DPM watchdog will be enabled by default.
277	  If you say N, it will be compiled in but disabled.  It can be
278	  enabled at boot time via the "pm.dpm_watchdog_enabled" kernel
279	  parameter or at runtime via sysfs.
280
281config DPM_WATCHDOG_TIMEOUT
282	int "Watchdog timeout to panic in seconds"
283	range 1 120
284	default 120
285	depends on DPM_WATCHDOG
286
287config DPM_WATCHDOG_WARNING_TIMEOUT
288	int "Watchdog timeout to warn in seconds"
289	range 1 DPM_WATCHDOG_TIMEOUT
290	default DPM_WATCHDOG_TIMEOUT
291	depends on DPM_WATCHDOG
292	help
293	  If the DPM watchdog warning timeout and main timeout are
294	  different then a non-fatal warning (with a stack trace of
295	  the stuck suspend routine) will be printed when the warning
296	  timeout expires. If the suspend routine gets un-stuck
297	  before the main timeout expires then no other action is
298	  taken. If the routine continues to be stuck and the main
299	  timeout expires then an emergency-level message and stack
300	  trace will be printed and the system will panic.
301
302	  If the warning timeout is equal to the main timeout (the
303	  default) then the warning will never happen and the system
304	  will jump straight to panic when the main timeout expires.
305
306config PM_TRACE
307	bool
308	help
309	  This enables code to save the last PM event point across
310	  reboot. The architecture needs to support this, x86 for
311	  example does by saving things in the RTC, see below.
312
313	  The architecture specific code must provide the extern
314	  functions from <linux/resume-trace.h> as well as the
315	  <asm/resume-trace.h> header with a TRACE_RESUME() macro.
316
317	  The way the information is presented is architecture-
318	  dependent, x86 will print the information during a
319	  late_initcall.
320
321config PM_TRACE_RTC
322	bool "Suspend/resume event tracing"
323	depends on PM_SLEEP_DEBUG
324	depends on X86
325	select PM_TRACE
326	help
327	This enables some cheesy code to save the last PM event point in the
328	RTC across reboots, so that you can debug a machine that just hangs
329	during suspend (or more commonly, during resume).
330
331	To use this debugging feature you should attempt to suspend the
332	machine, reboot it and then run
333
334		dmesg -s 1000000 | grep 'hash matches'
335
336	CAUTION: this option will cause your machine's real-time clock to be
337	set to an invalid time after a resume.
338
339config APM_EMULATION
340	tristate "Advanced Power Management Emulation"
341	depends on SYS_SUPPORTS_APM_EMULATION
342	help
343	  APM is a BIOS specification for saving power using several different
344	  techniques. This is mostly useful for battery powered laptops with
345	  APM compliant BIOSes. If you say Y here, the system time will be
346	  reset after a RESUME operation, the /proc/apm device will provide
347	  battery status information, and user-space programs will receive
348	  notification of APM "events" (e.g. battery status change).
349
350	  In order to use APM, you will need supporting software. For location
351	  and more information, read <file:Documentation/power/apm-acpi.rst>
352	  and the Battery Powered Linux mini-HOWTO, available from
353	  <http://www.tldp.org/docs.html#howto>.
354
355	  This driver does not spin down disk drives (see the hdparm(8)
356	  manpage ("man 8 hdparm") for that), and it doesn't turn off
357	  VESA-compliant "green" monitors.
358
359	  Generally, if you don't have a battery in your machine, there isn't
360	  much point in using this driver and you should say N. If you get
361	  random kernel OOPSes or reboots that don't seem to be related to
362	  anything, try disabling/enabling this option (or disabling/enabling
363	  APM in your BIOS).
364
365config PM_CLK
366	def_bool y
367	depends on PM && HAVE_CLK
368
369config PM_GENERIC_DOMAINS
370	bool
371	depends on PM
372
373config WQ_POWER_EFFICIENT_DEFAULT
374	bool "Enable workqueue power-efficient mode by default"
375	depends on PM
376	help
377	  Per-cpu workqueues are generally preferred because they show
378	  better performance thanks to cache locality; unfortunately,
379	  per-cpu workqueues tend to be more power hungry than unbound
380	  workqueues.
381
382	  Enabling workqueue.power_efficient kernel parameter makes the
383	  per-cpu workqueues which were observed to contribute
384	  significantly to power consumption unbound, leading to measurably
385	  lower power usage at the cost of small performance overhead.
386
387	  This config option determines whether workqueue.power_efficient
388	  is enabled by default.
389
390	  If in doubt, say N.
391
392config PM_GENERIC_DOMAINS_SLEEP
393	def_bool y
394	depends on PM_SLEEP && PM_GENERIC_DOMAINS
395
396config PM_GENERIC_DOMAINS_OF
397	def_bool y
398	depends on PM_GENERIC_DOMAINS && OF
399
400config CPU_PM
401	bool
402
403config ENERGY_MODEL
404	bool "Energy Model for devices with DVFS (CPUs, GPUs, etc)"
405	depends on CPU_FREQ || PM_DEVFREQ
406	help
407	  Several subsystems (thermal and/or the task scheduler for example)
408	  can leverage information about the energy consumed by devices to
409	  make smarter decisions. This config option enables the framework
410	  from which subsystems can access the energy models.
411
412	  The exact usage of the energy model is subsystem-dependent.
413
414	  If in doubt, say N.
415