aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/power
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/power')
-rw-r--r--Documentation/power/interface.txt13
-rw-r--r--Documentation/power/pci.txt4
-rw-r--r--Documentation/power/s2ram.txt56
-rw-r--r--Documentation/power/states.txt2
-rw-r--r--Documentation/power/swsusp-and-swap-files.txt60
-rw-r--r--Documentation/power/swsusp.txt20
-rw-r--r--Documentation/power/userland-swsusp.txt64
7 files changed, 189 insertions, 30 deletions
diff --git a/Documentation/power/interface.txt b/Documentation/power/interface.txt
index a66bec222b16..74311d7e0f3c 100644
--- a/Documentation/power/interface.txt
+++ b/Documentation/power/interface.txt
@@ -30,6 +30,17 @@ testing). The system will support either 'firmware' or 'platform', and
30that is known a priori. But, the user may choose 'shutdown' or 30that is known a priori. But, the user may choose 'shutdown' or
31'reboot' as alternatives. 31'reboot' as alternatives.
32 32
33Additionally, /sys/power/disk can be used to turn on one of the two testing
34modes of the suspend-to-disk mechanism: 'testproc' or 'test'. If the
35suspend-to-disk mechanism is in the 'testproc' mode, writing 'disk' to
36/sys/power/state will cause the kernel to disable nonboot CPUs and freeze
37tasks, wait for 5 seconds, unfreeze tasks and enable nonboot CPUs. If it is
38in the 'test' mode, writing 'disk' to /sys/power/state will cause the kernel
39to disable nonboot CPUs and freeze tasks, shrink memory, suspend devices, wait
40for 5 seconds, resume devices, unfreeze tasks and enable nonboot CPUs. Then,
41we are able to look in the log messages and work out, for example, which code
42is being slow and which device drivers are misbehaving.
43
33Reading from this file will display what the mode is currently set 44Reading from this file will display what the mode is currently set
34to. Writing to this file will accept one of 45to. Writing to this file will accept one of
35 46
@@ -37,6 +48,8 @@ to. Writing to this file will accept one of
37 'platform' 48 'platform'
38 'shutdown' 49 'shutdown'
39 'reboot' 50 'reboot'
51 'testproc'
52 'test'
40 53
41It will only change to 'firmware' or 'platform' if the system supports 54It will only change to 'firmware' or 'platform' if the system supports
42it. 55it.
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt
index 24edf25b3bb7..c750f9f2e76e 100644
--- a/Documentation/power/pci.txt
+++ b/Documentation/power/pci.txt
@@ -153,7 +153,7 @@ Description:
153 events, which is implicit if it doesn't even support it in the first 153 events, which is implicit if it doesn't even support it in the first
154 place). 154 place).
155 155
156 Note that the PMC Register in the device's PM Capabilties has a bitmask 156 Note that the PMC Register in the device's PM Capabilities has a bitmask
157 of the states it supports generating PME# from. D3hot is bit 3 and 157 of the states it supports generating PME# from. D3hot is bit 3 and
158 D3cold is bit 4. So, while a value of 4 as the state may not seem 158 D3cold is bit 4. So, while a value of 4 as the state may not seem
159 semantically correct, it is. 159 semantically correct, it is.
@@ -268,7 +268,7 @@ to wake the system up. (However, it is possible that a device may support
268some non-standard way of generating a wake event on sleep.) 268some non-standard way of generating a wake event on sleep.)
269 269
270Bits 15:11 of the PMC (Power Mgmt Capabilities) Register in a device's 270Bits 15:11 of the PMC (Power Mgmt Capabilities) Register in a device's
271PM Capabilties describe what power states the device supports generating a 271PM Capabilities describe what power states the device supports generating a
272wake event from: 272wake event from:
273 273
274+------------------+ 274+------------------+
diff --git a/Documentation/power/s2ram.txt b/Documentation/power/s2ram.txt
new file mode 100644
index 000000000000..b05f512130ea
--- /dev/null
+++ b/Documentation/power/s2ram.txt
@@ -0,0 +1,56 @@
1 How to get s2ram working
2 ~~~~~~~~~~~~~~~~~~~~~~~~
3 2006 Linus Torvalds
4 2006 Pavel Machek
5
61) Check suspend.sf.net, program s2ram there has long whitelist of
7 "known ok" machines, along with tricks to use on each one.
8
92) If that does not help, try reading tricks.txt and
10 video.txt. Perhaps problem is as simple as broken module, and
11 simple module unload can fix it.
12
133) You can use Linus' TRACE_RESUME infrastructure, described below.
14
15 Using TRACE_RESUME
16 ~~~~~~~~~~~~~~~~~~
17
18I've been working at making the machines I have able to STR, and almost
19always it's a driver that is buggy. Thank God for the suspend/resume
20debugging - the thing that Chuck tried to disable. That's often the _only_
21way to debug these things, and it's actually pretty powerful (but
22time-consuming - having to insert TRACE_RESUME() markers into the device
23driver that doesn't resume and recompile and reboot).
24
25Anyway, the way to debug this for people who are interested (have a
26machine that doesn't boot) is:
27
28 - enable PM_DEBUG, and PM_TRACE
29
30 - use a script like this:
31
32 #!/bin/sh
33 sync
34 echo 1 > /sys/power/pm_trace
35 echo mem > /sys/power/state
36
37 to suspend
38
39 - if it doesn't come back up (which is usually the problem), reboot by
40 holding the power button down, and look at the dmesg output for things
41 like
42
43 Magic number: 4:156:725
44 hash matches drivers/base/power/resume.c:28
45 hash matches device 0000:01:00.0
46
47 which means that the last trace event was just before trying to resume
48 device 0000:01:00.0. Then figure out what driver is controlling that
49 device (lspci and /sys/devices/pci* is your friend), and see if you can
50 fix it, disable it, or trace into its resume function.
51
52For example, the above happens to be the VGA device on my EVO, which I
53used to run with "radeonfb" (it's an ATI Radeon mobility). It turns out
54that "radeonfb" simply cannot resume that device - it tries to set the
55PLL's, and it just _hangs_. Using the regular VGA console and letting X
56resume it instead works fine.
diff --git a/Documentation/power/states.txt b/Documentation/power/states.txt
index 3e5e5d3ff419..0931a330d362 100644
--- a/Documentation/power/states.txt
+++ b/Documentation/power/states.txt
@@ -62,7 +62,7 @@ setup via another operating system for it to use. Despite the
62inconvenience, this method requires minimal work by the kernel, since 62inconvenience, this method requires minimal work by the kernel, since
63the firmware will also handle restoring memory contents on resume. 63the firmware will also handle restoring memory contents on resume.
64 64
65If the kernel is responsible for persistantly saving state, a mechanism 65If the kernel is responsible for persistently saving state, a mechanism
66called 'swsusp' (Swap Suspend) is used to write memory contents to 66called 'swsusp' (Swap Suspend) is used to write memory contents to
67free swap space. swsusp has some restrictive requirements, but should 67free swap space. swsusp has some restrictive requirements, but should
68work in most cases. Some, albeit outdated, documentation can be found 68work in most cases. Some, albeit outdated, documentation can be found
diff --git a/Documentation/power/swsusp-and-swap-files.txt b/Documentation/power/swsusp-and-swap-files.txt
new file mode 100644
index 000000000000..06f911a5f885
--- /dev/null
+++ b/Documentation/power/swsusp-and-swap-files.txt
@@ -0,0 +1,60 @@
1Using swap files with software suspend (swsusp)
2 (C) 2006 Rafael J. Wysocki <rjw@sisk.pl>
3
4The Linux kernel handles swap files almost in the same way as it handles swap
5partitions and there are only two differences between these two types of swap
6areas:
7(1) swap files need not be contiguous,
8(2) the header of a swap file is not in the first block of the partition that
9holds it. From the swsusp's point of view (1) is not a problem, because it is
10already taken care of by the swap-handling code, but (2) has to be taken into
11consideration.
12
13In principle the location of a swap file's header may be determined with the
14help of appropriate filesystem driver. Unfortunately, however, it requires the
15filesystem holding the swap file to be mounted, and if this filesystem is
16journaled, it cannot be mounted during resume from disk. For this reason to
17identify a swap file swsusp uses the name of the partition that holds the file
18and the offset from the beginning of the partition at which the swap file's
19header is located. For convenience, this offset is expressed in <PAGE_SIZE>
20units.
21
22In order to use a swap file with swsusp, you need to:
23
241) Create the swap file and make it active, eg.
25
26# dd if=/dev/zero of=<swap_file_path> bs=1024 count=<swap_file_size_in_k>
27# mkswap <swap_file_path>
28# swapon <swap_file_path>
29
302) Use an application that will bmap the swap file with the help of the
31FIBMAP ioctl and determine the location of the file's swap header, as the
32offset, in <PAGE_SIZE> units, from the beginning of the partition which
33holds the swap file.
34
353) Add the following parameters to the kernel command line:
36
37resume=<swap_file_partition> resume_offset=<swap_file_offset>
38
39where <swap_file_partition> is the partition on which the swap file is located
40and <swap_file_offset> is the offset of the swap header determined by the
41application in 2) (of course, this step may be carried out automatically
42by the same application that determies the swap file's header offset using the
43FIBMAP ioctl)
44
45OR
46
47Use a userland suspend application that will set the partition and offset
48with the help of the SNAPSHOT_SET_SWAP_AREA ioctl described in
49Documentation/power/userland-swsusp.txt (this is the only method to suspend
50to a swap file allowing the resume to be initiated from an initrd or initramfs
51image).
52
53Now, swsusp will use the swap file in the same way in which it would use a swap
54partition. In particular, the swap file has to be active (ie. be present in
55/proc/swaps) so that it can be used for suspending.
56
57Note that if the swap file used for suspending is deleted and recreated,
58the location of its header need not be the same as before. Thus every time
59this happens the value of the "resume_offset=" kernel command line parameter
60has to be updated.
diff --git a/Documentation/power/swsusp.txt b/Documentation/power/swsusp.txt
index 9ea2208b43b5..0761ff6c57ed 100644
--- a/Documentation/power/swsusp.txt
+++ b/Documentation/power/swsusp.txt
@@ -153,7 +153,7 @@ add:
153 153
154If the thread is needed for writing the image to storage, you should 154If the thread is needed for writing the image to storage, you should
155instead set the PF_NOFREEZE process flag when creating the thread (and 155instead set the PF_NOFREEZE process flag when creating the thread (and
156be very carefull). 156be very careful).
157 157
158 158
159Q: What is the difference between "platform", "shutdown" and 159Q: What is the difference between "platform", "shutdown" and
@@ -297,20 +297,12 @@ system is shut down or suspended. Additionally use the encrypted
297suspend image to prevent sensitive data from being stolen after 297suspend image to prevent sensitive data from being stolen after
298resume. 298resume.
299 299
300Q: Why can't we suspend to a swap file? 300Q: Can I suspend to a swap file?
301 301
302A: Because accessing swap file needs the filesystem mounted, and 302A: Generally, yes, you can. However, it requires you to use the "resume=" and
303filesystem might do something wrong (like replaying the journal) 303"resume_offset=" kernel command line parameters, so the resume from a swap file
304during mount. 304cannot be initiated from an initrd or initramfs image. See
305 305swsusp-and-swap-files.txt for details.
306There are few ways to get that fixed:
307
3081) Probably could be solved by modifying every filesystem to support
309some kind of "really read-only!" option. Patches welcome.
310
3112) suspend2 gets around that by storing absolute positions in on-disk
312image (and blocksize), with resume parameter pointing directly to
313suspend header.
314 306
315Q: Is there a maximum system RAM size that is supported by swsusp? 307Q: Is there a maximum system RAM size that is supported by swsusp?
316 308
diff --git a/Documentation/power/userland-swsusp.txt b/Documentation/power/userland-swsusp.txt
index 64755e9285db..000556c932e9 100644
--- a/Documentation/power/userland-swsusp.txt
+++ b/Documentation/power/userland-swsusp.txt
@@ -9,9 +9,8 @@ done it already.
9Now, to use the userland interface for software suspend you need special 9Now, to use the userland interface for software suspend you need special
10utilities that will read/write the system memory snapshot from/to the 10utilities that will read/write the system memory snapshot from/to the
11kernel. Such utilities are available, for example, from 11kernel. Such utilities are available, for example, from
12<http://www.sisk.pl/kernel/utilities/suspend>. You may want to have 12<http://suspend.sourceforge.net>. You may want to have a look at them if you
13a look at them if you are going to develop your own suspend/resume 13are going to develop your own suspend/resume utilities.
14utilities.
15 14
16The interface consists of a character device providing the open(), 15The interface consists of a character device providing the open(),
17release(), read(), and write() operations as well as several ioctl() 16release(), read(), and write() operations as well as several ioctl()
@@ -21,9 +20,9 @@ be read from /sys/class/misc/snapshot/dev.
21 20
22The device can be open either for reading or for writing. If open for 21The device can be open either for reading or for writing. If open for
23reading, it is considered to be in the suspend mode. Otherwise it is 22reading, it is considered to be in the suspend mode. Otherwise it is
24assumed to be in the resume mode. The device cannot be open for reading 23assumed to be in the resume mode. The device cannot be open for simultaneous
25and writing. It is also impossible to have the device open more than once 24reading and writing. It is also impossible to have the device open more than
26at a time. 25once at a time.
27 26
28The ioctl() commands recognized by the device are: 27The ioctl() commands recognized by the device are:
29 28
@@ -69,9 +68,46 @@ SNAPSHOT_FREE_SWAP_PAGES - free all swap pages allocated with
69SNAPSHOT_SET_SWAP_FILE - set the resume partition (the last ioctl() argument 68SNAPSHOT_SET_SWAP_FILE - set the resume partition (the last ioctl() argument
70 should specify the device's major and minor numbers in the old 69 should specify the device's major and minor numbers in the old
71 two-byte format, as returned by the stat() function in the .st_rdev 70 two-byte format, as returned by the stat() function in the .st_rdev
72 member of the stat structure); it is recommended to always use this 71 member of the stat structure)
73 call, because the code to set the resume partition could be removed from 72
74 future kernels 73SNAPSHOT_SET_SWAP_AREA - set the resume partition and the offset (in <PAGE_SIZE>
74 units) from the beginning of the partition at which the swap header is
75 located (the last ioctl() argument should point to a struct
76 resume_swap_area, as defined in kernel/power/power.h, containing the
77 resume device specification, as for the SNAPSHOT_SET_SWAP_FILE ioctl(),
78 and the offset); for swap partitions the offset is always 0, but it is
79 different to zero for swap files (please see
80 Documentation/swsusp-and-swap-files.txt for details).
81 The SNAPSHOT_SET_SWAP_AREA ioctl() is considered as a replacement for
82 SNAPSHOT_SET_SWAP_FILE which is regarded as obsolete. It is
83 recommended to always use this call, because the code to set the resume
84 partition may be removed from future kernels
85
86SNAPSHOT_S2RAM - suspend to RAM; using this call causes the kernel to
87 immediately enter the suspend-to-RAM state, so this call must always
88 be preceded by the SNAPSHOT_FREEZE call and it is also necessary
89 to use the SNAPSHOT_UNFREEZE call after the system wakes up. This call
90 is needed to implement the suspend-to-both mechanism in which the
91 suspend image is first created, as though the system had been suspended
92 to disk, and then the system is suspended to RAM (this makes it possible
93 to resume the system from RAM if there's enough battery power or restore
94 its state on the basis of the saved suspend image otherwise)
95
96SNAPSHOT_PMOPS - enable the usage of the pmops->prepare, pmops->enter and
97 pmops->finish methods (the in-kernel swsusp knows these as the "platform
98 method") which are needed on many machines to (among others) speed up
99 the resume by letting the BIOS skip some steps or to let the system
100 recognise the correct state of the hardware after the resume (in
101 particular on many machines this ensures that unplugged AC
102 adapters get correctly detected and that kacpid does not run wild after
103 the resume). The last ioctl() argument can take one of the three
104 values, defined in kernel/power/power.h:
105 PMOPS_PREPARE - make the kernel carry out the
106 pm_ops->prepare(PM_SUSPEND_DISK) operation
107 PMOPS_ENTER - make the kernel power off the system by calling
108 pm_ops->enter(PM_SUSPEND_DISK)
109 PMOPS_FINISH - make the kernel carry out the
110 pm_ops->finish(PM_SUSPEND_DISK) operation
75 111
76The device's read() operation can be used to transfer the snapshot image from 112The device's read() operation can be used to transfer the snapshot image from
77the kernel. It has the following limitations: 113the kernel. It has the following limitations:
@@ -91,10 +127,12 @@ unfreeze user space processes frozen by SNAPSHOT_UNFREEZE if they are
91still frozen when the device is being closed). 127still frozen when the device is being closed).
92 128
93Currently it is assumed that the userland utilities reading/writing the 129Currently it is assumed that the userland utilities reading/writing the
94snapshot image from/to the kernel will use a swap partition, called the resume 130snapshot image from/to the kernel will use a swap parition, called the resume
95partition, as storage space. However, this is not really required, as they 131partition, or a swap file as storage space (if a swap file is used, the resume
96can use, for example, a special (blank) suspend partition or a file on a partition 132partition is the partition that holds this file). However, this is not really
97that is unmounted before SNAPSHOT_ATOMIC_SNAPSHOT and mounted afterwards. 133required, as they can use, for example, a special (blank) suspend partition or
134a file on a partition that is unmounted before SNAPSHOT_ATOMIC_SNAPSHOT and
135mounted afterwards.
98 136
99These utilities SHOULD NOT make any assumptions regarding the ordering of 137These utilities SHOULD NOT make any assumptions regarding the ordering of
100data within the snapshot image, except for the image header that MAY be 138data within the snapshot image, except for the image header that MAY be