diff options
Diffstat (limited to 'Documentation')
103 files changed, 6374 insertions, 2314 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index 43827780010..7286ad090db 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX | |||
@@ -21,6 +21,9 @@ Changes | |||
21 | - list of changes that break older software packages. | 21 | - list of changes that break older software packages. |
22 | CodingStyle | 22 | CodingStyle |
23 | - how the boss likes the C code in the kernel to look. | 23 | - how the boss likes the C code in the kernel to look. |
24 | development-process/ | ||
25 | - An extended tutorial on how to work with the kernel development | ||
26 | process. | ||
24 | DMA-API.txt | 27 | DMA-API.txt |
25 | - DMA API, pci_ API & extensions for non-consistent memory machines. | 28 | - DMA API, pci_ API & extensions for non-consistent memory machines. |
26 | DMA-ISA-LPC.txt | 29 | DMA-ISA-LPC.txt |
diff --git a/Documentation/ABI/stable/sysfs-driver-usb-usbtmc b/Documentation/ABI/stable/sysfs-driver-usb-usbtmc new file mode 100644 index 00000000000..9a75fb22187 --- /dev/null +++ b/Documentation/ABI/stable/sysfs-driver-usb-usbtmc | |||
@@ -0,0 +1,62 @@ | |||
1 | What: /sys/bus/usb/drivers/usbtmc/devices/*/interface_capabilities | ||
2 | What: /sys/bus/usb/drivers/usbtmc/devices/*/device_capabilities | ||
3 | Date: August 2008 | ||
4 | Contact: Greg Kroah-Hartman <gregkh@suse.de> | ||
5 | Description: | ||
6 | These files show the various USB TMC capabilities as described | ||
7 | by the device itself. The full description of the bitfields | ||
8 | can be found in the USB TMC documents from the USB-IF entitled | ||
9 | "Universal Serial Bus Test and Measurement Class Specification | ||
10 | (USBTMC) Revision 1.0" section 4.2.1.8. | ||
11 | |||
12 | The files are read only. | ||
13 | |||
14 | |||
15 | What: /sys/bus/usb/drivers/usbtmc/devices/*/usb488_interface_capabilities | ||
16 | What: /sys/bus/usb/drivers/usbtmc/devices/*/usb488_device_capabilities | ||
17 | Date: August 2008 | ||
18 | Contact: Greg Kroah-Hartman <gregkh@suse.de> | ||
19 | Description: | ||
20 | These files show the various USB TMC capabilities as described | ||
21 | by the device itself. The full description of the bitfields | ||
22 | can be found in the USB TMC documents from the USB-IF entitled | ||
23 | "Universal Serial Bus Test and Measurement Class, Subclass | ||
24 | USB488 Specification (USBTMC-USB488) Revision 1.0" section | ||
25 | 4.2.2. | ||
26 | |||
27 | The files are read only. | ||
28 | |||
29 | |||
30 | What: /sys/bus/usb/drivers/usbtmc/devices/*/TermChar | ||
31 | Date: August 2008 | ||
32 | Contact: Greg Kroah-Hartman <gregkh@suse.de> | ||
33 | Description: | ||
34 | This file is the TermChar value to be sent to the USB TMC | ||
35 | device as described by the document, "Universal Serial Bus Test | ||
36 | and Measurement Class Specification | ||
37 | (USBTMC) Revision 1.0" as published by the USB-IF. | ||
38 | |||
39 | Note that the TermCharEnabled file determines if this value is | ||
40 | sent to the device or not. | ||
41 | |||
42 | |||
43 | What: /sys/bus/usb/drivers/usbtmc/devices/*/TermCharEnabled | ||
44 | Date: August 2008 | ||
45 | Contact: Greg Kroah-Hartman <gregkh@suse.de> | ||
46 | Description: | ||
47 | This file determines if the TermChar is to be sent to the | ||
48 | device on every transaction or not. For more details about | ||
49 | this, please see the document, "Universal Serial Bus Test and | ||
50 | Measurement Class Specification (USBTMC) Revision 1.0" as | ||
51 | published by the USB-IF. | ||
52 | |||
53 | |||
54 | What: /sys/bus/usb/drivers/usbtmc/devices/*/auto_abort | ||
55 | Date: August 2008 | ||
56 | Contact: Greg Kroah-Hartman <gregkh@suse.de> | ||
57 | Description: | ||
58 | This file determines if the the transaction of the USB TMC | ||
59 | device is to be automatically aborted if there is any error. | ||
60 | For more details about this, please see the document, | ||
61 | "Universal Serial Bus Test and Measurement Class Specification | ||
62 | (USBTMC) Revision 1.0" as published by the USB-IF. | ||
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb index 11a3c1682ce..df6c8a0159f 100644 --- a/Documentation/ABI/testing/sysfs-bus-usb +++ b/Documentation/ABI/testing/sysfs-bus-usb | |||
@@ -85,3 +85,19 @@ Description: | |||
85 | Users: | 85 | Users: |
86 | PowerTOP <power@bughost.org> | 86 | PowerTOP <power@bughost.org> |
87 | http://www.lesswatts.org/projects/powertop/ | 87 | http://www.lesswatts.org/projects/powertop/ |
88 | |||
89 | What: /sys/bus/usb/device/<busnum>-<devnum>...:<config num>-<interface num>/supports_autosuspend | ||
90 | Date: January 2008 | ||
91 | KernelVersion: 2.6.27 | ||
92 | Contact: Sarah Sharp <sarah.a.sharp@intel.com> | ||
93 | Description: | ||
94 | When read, this file returns 1 if the interface driver | ||
95 | for this interface supports autosuspend. It also | ||
96 | returns 1 if no driver has claimed this interface, as an | ||
97 | unclaimed interface will not stop the device from being | ||
98 | autosuspended if all other interface drivers are idle. | ||
99 | The file returns 0 if autosuspend support has not been | ||
100 | added to the driver. | ||
101 | Users: | ||
102 | USB PM tool | ||
103 | git://git.moblin.org/users/sarah/usb-pm-tool/ | ||
diff --git a/Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg b/Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg new file mode 100644 index 00000000000..cb830df8777 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg | |||
@@ -0,0 +1,43 @@ | |||
1 | Where: /sys/bus/usb/.../powered | ||
2 | Date: August 2008 | ||
3 | Kernel Version: 2.6.26 | ||
4 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | ||
5 | Description: Controls whether the device's display will powered. | ||
6 | A value of 0 is off and a non-zero value is on. | ||
7 | |||
8 | Where: /sys/bus/usb/.../mode_msb | ||
9 | Where: /sys/bus/usb/.../mode_lsb | ||
10 | Date: August 2008 | ||
11 | Kernel Version: 2.6.26 | ||
12 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | ||
13 | Description: Controls the devices display mode. | ||
14 | For a 6 character display the values are | ||
15 | MSB 0x06; LSB 0x3F, and | ||
16 | for an 8 character display the values are | ||
17 | MSB 0x08; LSB 0xFF. | ||
18 | |||
19 | Where: /sys/bus/usb/.../textmode | ||
20 | Date: August 2008 | ||
21 | Kernel Version: 2.6.26 | ||
22 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | ||
23 | Description: Controls the way the device interprets its text buffer. | ||
24 | raw: each character controls its segment manually | ||
25 | hex: each character is between 0-15 | ||
26 | ascii: each character is between '0'-'9' and 'A'-'F'. | ||
27 | |||
28 | Where: /sys/bus/usb/.../text | ||
29 | Date: August 2008 | ||
30 | Kernel Version: 2.6.26 | ||
31 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | ||
32 | Description: The text (or data) for the device to display | ||
33 | |||
34 | Where: /sys/bus/usb/.../decimals | ||
35 | Date: August 2008 | ||
36 | Kernel Version: 2.6.26 | ||
37 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | ||
38 | Description: Controls the decimal places on the device. | ||
39 | To set the nth decimal place, give this field | ||
40 | the value of 10 ** n. Assume this field has | ||
41 | the value k and has 1 or more decimal places set, | ||
42 | to set the mth place (where m is not already set), | ||
43 | change this fields value to k + 10 ** m. \ No newline at end of file | ||
diff --git a/Documentation/ABI/testing/sysfs-class-regulator b/Documentation/ABI/testing/sysfs-class-regulator index 79a4a75b2d2..3731f6f29bc 100644 --- a/Documentation/ABI/testing/sysfs-class-regulator +++ b/Documentation/ABI/testing/sysfs-class-regulator | |||
@@ -1,7 +1,7 @@ | |||
1 | What: /sys/class/regulator/.../state | 1 | What: /sys/class/regulator/.../state |
2 | Date: April 2008 | 2 | Date: April 2008 |
3 | KernelVersion: 2.6.26 | 3 | KernelVersion: 2.6.26 |
4 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 4 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
5 | Description: | 5 | Description: |
6 | Each regulator directory will contain a field called | 6 | Each regulator directory will contain a field called |
7 | state. This holds the regulator output state. | 7 | state. This holds the regulator output state. |
@@ -27,7 +27,7 @@ Description: | |||
27 | What: /sys/class/regulator/.../type | 27 | What: /sys/class/regulator/.../type |
28 | Date: April 2008 | 28 | Date: April 2008 |
29 | KernelVersion: 2.6.26 | 29 | KernelVersion: 2.6.26 |
30 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 30 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
31 | Description: | 31 | Description: |
32 | Each regulator directory will contain a field called | 32 | Each regulator directory will contain a field called |
33 | type. This holds the regulator type. | 33 | type. This holds the regulator type. |
@@ -51,7 +51,7 @@ Description: | |||
51 | What: /sys/class/regulator/.../microvolts | 51 | What: /sys/class/regulator/.../microvolts |
52 | Date: April 2008 | 52 | Date: April 2008 |
53 | KernelVersion: 2.6.26 | 53 | KernelVersion: 2.6.26 |
54 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 54 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
55 | Description: | 55 | Description: |
56 | Each regulator directory will contain a field called | 56 | Each regulator directory will contain a field called |
57 | microvolts. This holds the regulator output voltage setting | 57 | microvolts. This holds the regulator output voltage setting |
@@ -65,7 +65,7 @@ Description: | |||
65 | What: /sys/class/regulator/.../microamps | 65 | What: /sys/class/regulator/.../microamps |
66 | Date: April 2008 | 66 | Date: April 2008 |
67 | KernelVersion: 2.6.26 | 67 | KernelVersion: 2.6.26 |
68 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 68 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
69 | Description: | 69 | Description: |
70 | Each regulator directory will contain a field called | 70 | Each regulator directory will contain a field called |
71 | microamps. This holds the regulator output current limit | 71 | microamps. This holds the regulator output current limit |
@@ -79,7 +79,7 @@ Description: | |||
79 | What: /sys/class/regulator/.../opmode | 79 | What: /sys/class/regulator/.../opmode |
80 | Date: April 2008 | 80 | Date: April 2008 |
81 | KernelVersion: 2.6.26 | 81 | KernelVersion: 2.6.26 |
82 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 82 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
83 | Description: | 83 | Description: |
84 | Each regulator directory will contain a field called | 84 | Each regulator directory will contain a field called |
85 | opmode. This holds the regulator operating mode setting. | 85 | opmode. This holds the regulator operating mode setting. |
@@ -102,7 +102,7 @@ Description: | |||
102 | What: /sys/class/regulator/.../min_microvolts | 102 | What: /sys/class/regulator/.../min_microvolts |
103 | Date: April 2008 | 103 | Date: April 2008 |
104 | KernelVersion: 2.6.26 | 104 | KernelVersion: 2.6.26 |
105 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 105 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
106 | Description: | 106 | Description: |
107 | Each regulator directory will contain a field called | 107 | Each regulator directory will contain a field called |
108 | min_microvolts. This holds the minimum safe working regulator | 108 | min_microvolts. This holds the minimum safe working regulator |
@@ -116,7 +116,7 @@ Description: | |||
116 | What: /sys/class/regulator/.../max_microvolts | 116 | What: /sys/class/regulator/.../max_microvolts |
117 | Date: April 2008 | 117 | Date: April 2008 |
118 | KernelVersion: 2.6.26 | 118 | KernelVersion: 2.6.26 |
119 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 119 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
120 | Description: | 120 | Description: |
121 | Each regulator directory will contain a field called | 121 | Each regulator directory will contain a field called |
122 | max_microvolts. This holds the maximum safe working regulator | 122 | max_microvolts. This holds the maximum safe working regulator |
@@ -130,7 +130,7 @@ Description: | |||
130 | What: /sys/class/regulator/.../min_microamps | 130 | What: /sys/class/regulator/.../min_microamps |
131 | Date: April 2008 | 131 | Date: April 2008 |
132 | KernelVersion: 2.6.26 | 132 | KernelVersion: 2.6.26 |
133 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 133 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
134 | Description: | 134 | Description: |
135 | Each regulator directory will contain a field called | 135 | Each regulator directory will contain a field called |
136 | min_microamps. This holds the minimum safe working regulator | 136 | min_microamps. This holds the minimum safe working regulator |
@@ -145,7 +145,7 @@ Description: | |||
145 | What: /sys/class/regulator/.../max_microamps | 145 | What: /sys/class/regulator/.../max_microamps |
146 | Date: April 2008 | 146 | Date: April 2008 |
147 | KernelVersion: 2.6.26 | 147 | KernelVersion: 2.6.26 |
148 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 148 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
149 | Description: | 149 | Description: |
150 | Each regulator directory will contain a field called | 150 | Each regulator directory will contain a field called |
151 | max_microamps. This holds the maximum safe working regulator | 151 | max_microamps. This holds the maximum safe working regulator |
@@ -157,10 +157,23 @@ Description: | |||
157 | platform code. | 157 | platform code. |
158 | 158 | ||
159 | 159 | ||
160 | What: /sys/class/regulator/.../name | ||
161 | Date: October 2008 | ||
162 | KernelVersion: 2.6.28 | ||
163 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
164 | Description: | ||
165 | Each regulator directory will contain a field called | ||
166 | name. This holds a string identifying the regulator for | ||
167 | display purposes. | ||
168 | |||
169 | NOTE: this will be empty if no suitable name is provided | ||
170 | by platform or regulator drivers. | ||
171 | |||
172 | |||
160 | What: /sys/class/regulator/.../num_users | 173 | What: /sys/class/regulator/.../num_users |
161 | Date: April 2008 | 174 | Date: April 2008 |
162 | KernelVersion: 2.6.26 | 175 | KernelVersion: 2.6.26 |
163 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 176 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
164 | Description: | 177 | Description: |
165 | Each regulator directory will contain a field called | 178 | Each regulator directory will contain a field called |
166 | num_users. This holds the number of consumer devices that | 179 | num_users. This holds the number of consumer devices that |
@@ -170,7 +183,7 @@ Description: | |||
170 | What: /sys/class/regulator/.../requested_microamps | 183 | What: /sys/class/regulator/.../requested_microamps |
171 | Date: April 2008 | 184 | Date: April 2008 |
172 | KernelVersion: 2.6.26 | 185 | KernelVersion: 2.6.26 |
173 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 186 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
174 | Description: | 187 | Description: |
175 | Each regulator directory will contain a field called | 188 | Each regulator directory will contain a field called |
176 | requested_microamps. This holds the total requested load | 189 | requested_microamps. This holds the total requested load |
@@ -181,7 +194,7 @@ Description: | |||
181 | What: /sys/class/regulator/.../parent | 194 | What: /sys/class/regulator/.../parent |
182 | Date: April 2008 | 195 | Date: April 2008 |
183 | KernelVersion: 2.6.26 | 196 | KernelVersion: 2.6.26 |
184 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 197 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
185 | Description: | 198 | Description: |
186 | Some regulator directories will contain a link called parent. | 199 | Some regulator directories will contain a link called parent. |
187 | This points to the parent or supply regulator if one exists. | 200 | This points to the parent or supply regulator if one exists. |
@@ -189,7 +202,7 @@ Description: | |||
189 | What: /sys/class/regulator/.../suspend_mem_microvolts | 202 | What: /sys/class/regulator/.../suspend_mem_microvolts |
190 | Date: May 2008 | 203 | Date: May 2008 |
191 | KernelVersion: 2.6.26 | 204 | KernelVersion: 2.6.26 |
192 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 205 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
193 | Description: | 206 | Description: |
194 | Each regulator directory will contain a field called | 207 | Each regulator directory will contain a field called |
195 | suspend_mem_microvolts. This holds the regulator output | 208 | suspend_mem_microvolts. This holds the regulator output |
@@ -203,7 +216,7 @@ Description: | |||
203 | What: /sys/class/regulator/.../suspend_disk_microvolts | 216 | What: /sys/class/regulator/.../suspend_disk_microvolts |
204 | Date: May 2008 | 217 | Date: May 2008 |
205 | KernelVersion: 2.6.26 | 218 | KernelVersion: 2.6.26 |
206 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 219 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
207 | Description: | 220 | Description: |
208 | Each regulator directory will contain a field called | 221 | Each regulator directory will contain a field called |
209 | suspend_disk_microvolts. This holds the regulator output | 222 | suspend_disk_microvolts. This holds the regulator output |
@@ -217,7 +230,7 @@ Description: | |||
217 | What: /sys/class/regulator/.../suspend_standby_microvolts | 230 | What: /sys/class/regulator/.../suspend_standby_microvolts |
218 | Date: May 2008 | 231 | Date: May 2008 |
219 | KernelVersion: 2.6.26 | 232 | KernelVersion: 2.6.26 |
220 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 233 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
221 | Description: | 234 | Description: |
222 | Each regulator directory will contain a field called | 235 | Each regulator directory will contain a field called |
223 | suspend_standby_microvolts. This holds the regulator output | 236 | suspend_standby_microvolts. This holds the regulator output |
@@ -231,7 +244,7 @@ Description: | |||
231 | What: /sys/class/regulator/.../suspend_mem_mode | 244 | What: /sys/class/regulator/.../suspend_mem_mode |
232 | Date: May 2008 | 245 | Date: May 2008 |
233 | KernelVersion: 2.6.26 | 246 | KernelVersion: 2.6.26 |
234 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 247 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
235 | Description: | 248 | Description: |
236 | Each regulator directory will contain a field called | 249 | Each regulator directory will contain a field called |
237 | suspend_mem_mode. This holds the regulator operating mode | 250 | suspend_mem_mode. This holds the regulator operating mode |
@@ -245,7 +258,7 @@ Description: | |||
245 | What: /sys/class/regulator/.../suspend_disk_mode | 258 | What: /sys/class/regulator/.../suspend_disk_mode |
246 | Date: May 2008 | 259 | Date: May 2008 |
247 | KernelVersion: 2.6.26 | 260 | KernelVersion: 2.6.26 |
248 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 261 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
249 | Description: | 262 | Description: |
250 | Each regulator directory will contain a field called | 263 | Each regulator directory will contain a field called |
251 | suspend_disk_mode. This holds the regulator operating mode | 264 | suspend_disk_mode. This holds the regulator operating mode |
@@ -258,7 +271,7 @@ Description: | |||
258 | What: /sys/class/regulator/.../suspend_standby_mode | 271 | What: /sys/class/regulator/.../suspend_standby_mode |
259 | Date: May 2008 | 272 | Date: May 2008 |
260 | KernelVersion: 2.6.26 | 273 | KernelVersion: 2.6.26 |
261 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 274 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
262 | Description: | 275 | Description: |
263 | Each regulator directory will contain a field called | 276 | Each regulator directory will contain a field called |
264 | suspend_standby_mode. This holds the regulator operating mode | 277 | suspend_standby_mode. This holds the regulator operating mode |
@@ -272,7 +285,7 @@ Description: | |||
272 | What: /sys/class/regulator/.../suspend_mem_state | 285 | What: /sys/class/regulator/.../suspend_mem_state |
273 | Date: May 2008 | 286 | Date: May 2008 |
274 | KernelVersion: 2.6.26 | 287 | KernelVersion: 2.6.26 |
275 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 288 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
276 | Description: | 289 | Description: |
277 | Each regulator directory will contain a field called | 290 | Each regulator directory will contain a field called |
278 | suspend_mem_state. This holds the regulator operating state | 291 | suspend_mem_state. This holds the regulator operating state |
@@ -287,7 +300,7 @@ Description: | |||
287 | What: /sys/class/regulator/.../suspend_disk_state | 300 | What: /sys/class/regulator/.../suspend_disk_state |
288 | Date: May 2008 | 301 | Date: May 2008 |
289 | KernelVersion: 2.6.26 | 302 | KernelVersion: 2.6.26 |
290 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 303 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
291 | Description: | 304 | Description: |
292 | Each regulator directory will contain a field called | 305 | Each regulator directory will contain a field called |
293 | suspend_disk_state. This holds the regulator operating state | 306 | suspend_disk_state. This holds the regulator operating state |
@@ -302,7 +315,7 @@ Description: | |||
302 | What: /sys/class/regulator/.../suspend_standby_state | 315 | What: /sys/class/regulator/.../suspend_standby_state |
303 | Date: May 2008 | 316 | Date: May 2008 |
304 | KernelVersion: 2.6.26 | 317 | KernelVersion: 2.6.26 |
305 | Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 318 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> |
306 | Description: | 319 | Description: |
307 | Each regulator directory will contain a field called | 320 | Each regulator directory will contain a field called |
308 | suspend_standby_state. This holds the regulator operating | 321 | suspend_standby_state. This holds the regulator operating |
diff --git a/Documentation/ABI/testing/sysfs-profiling b/Documentation/ABI/testing/sysfs-profiling new file mode 100644 index 00000000000..b02d8b8c173 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-profiling | |||
@@ -0,0 +1,13 @@ | |||
1 | What: /sys/kernel/profile | ||
2 | Date: September 2008 | ||
3 | Contact: Dave Hansen <dave@linux.vnet.ibm.com> | ||
4 | Description: | ||
5 | /sys/kernel/profile is the runtime equivalent | ||
6 | of the boot-time profile= option. | ||
7 | |||
8 | You can get the same effect running: | ||
9 | |||
10 | echo 2 > /sys/kernel/profile | ||
11 | |||
12 | as you would by issuing profile=2 on the boot | ||
13 | command line. | ||
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 1615350b7b5..fabc06466b9 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
@@ -6,7 +6,7 @@ | |||
6 | # To add a new book the only step required is to add the book to the | 6 | # To add a new book the only step required is to add the book to the |
7 | # list of DOCBOOKS. | 7 | # list of DOCBOOKS. |
8 | 8 | ||
9 | DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \ | 9 | DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml \ |
10 | kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ | 10 | kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ |
11 | procfs-guide.xml writing_usb_driver.xml networking.xml \ | 11 | procfs-guide.xml writing_usb_driver.xml networking.xml \ |
12 | kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \ | 12 | kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \ |
diff --git a/Documentation/DocBook/gadget.tmpl b/Documentation/DocBook/gadget.tmpl index ea3bc9565e6..6ef2f0073e5 100644 --- a/Documentation/DocBook/gadget.tmpl +++ b/Documentation/DocBook/gadget.tmpl | |||
@@ -557,6 +557,9 @@ Near-term plans include converting all of them, except for "gadgetfs". | |||
557 | </para> | 557 | </para> |
558 | 558 | ||
559 | !Edrivers/usb/gadget/f_acm.c | 559 | !Edrivers/usb/gadget/f_acm.c |
560 | !Edrivers/usb/gadget/f_ecm.c | ||
561 | !Edrivers/usb/gadget/f_subset.c | ||
562 | !Edrivers/usb/gadget/f_obex.c | ||
560 | !Edrivers/usb/gadget/f_serial.c | 563 | !Edrivers/usb/gadget/f_serial.c |
561 | 564 | ||
562 | </sect1> | 565 | </sect1> |
diff --git a/Documentation/DocBook/procfs-guide.tmpl b/Documentation/DocBook/procfs-guide.tmpl index 8a5dc6e021f..9eba4b7af73 100644 --- a/Documentation/DocBook/procfs-guide.tmpl +++ b/Documentation/DocBook/procfs-guide.tmpl | |||
@@ -14,17 +14,20 @@ | |||
14 | <othername>(J.A.K.)</othername> | 14 | <othername>(J.A.K.)</othername> |
15 | <surname>Mouw</surname> | 15 | <surname>Mouw</surname> |
16 | <affiliation> | 16 | <affiliation> |
17 | <orgname>Delft University of Technology</orgname> | ||
18 | <orgdiv>Faculty of Information Technology and Systems</orgdiv> | ||
19 | <address> | 17 | <address> |
20 | <email>J.A.K.Mouw@its.tudelft.nl</email> | 18 | <email>mouw@nl.linux.org</email> |
21 | <pob>PO BOX 5031</pob> | ||
22 | <postcode>2600 GA</postcode> | ||
23 | <city>Delft</city> | ||
24 | <country>The Netherlands</country> | ||
25 | </address> | 19 | </address> |
26 | </affiliation> | 20 | </affiliation> |
27 | </author> | 21 | </author> |
22 | <othercredit> | ||
23 | <contrib> | ||
24 | This software and documentation were written while working on the | ||
25 | LART computing board | ||
26 | (<ulink url="http://www.lartmaker.nl/">http://www.lartmaker.nl/</ulink>), | ||
27 | which was sponsored by the Delt University of Technology projects | ||
28 | Mobile Multi-media Communications and Ubiquitous Communications. | ||
29 | </contrib> | ||
30 | </othercredit> | ||
28 | </authorgroup> | 31 | </authorgroup> |
29 | 32 | ||
30 | <revhistory> | 33 | <revhistory> |
@@ -109,18 +112,6 @@ | |||
109 | </para> | 112 | </para> |
110 | 113 | ||
111 | <para> | 114 | <para> |
112 | This documentation was written while working on the LART | ||
113 | computing board (<ulink | ||
114 | url="http://www.lart.tudelft.nl/">http://www.lart.tudelft.nl/</ulink>), | ||
115 | which is sponsored by the Mobile Multi-media Communications | ||
116 | (<ulink | ||
117 | url="http://www.mmc.tudelft.nl/">http://www.mmc.tudelft.nl/</ulink>) | ||
118 | and Ubiquitous Communications (<ulink | ||
119 | url="http://www.ubicom.tudelft.nl/">http://www.ubicom.tudelft.nl/</ulink>) | ||
120 | projects. | ||
121 | </para> | ||
122 | |||
123 | <para> | ||
124 | Erik | 115 | Erik |
125 | </para> | 116 | </para> |
126 | </preface> | 117 | </preface> |
diff --git a/Documentation/DocBook/procfs_example.c b/Documentation/DocBook/procfs_example.c index 2f3de0fb836..8c6396e4bf3 100644 --- a/Documentation/DocBook/procfs_example.c +++ b/Documentation/DocBook/procfs_example.c | |||
@@ -1,28 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * procfs_example.c: an example proc interface | 2 | * procfs_example.c: an example proc interface |
3 | * | 3 | * |
4 | * Copyright (C) 2001, Erik Mouw (J.A.K.Mouw@its.tudelft.nl) | 4 | * Copyright (C) 2001, Erik Mouw (mouw@nl.linux.org) |
5 | * | 5 | * |
6 | * This file accompanies the procfs-guide in the Linux kernel | 6 | * This file accompanies the procfs-guide in the Linux kernel |
7 | * source. Its main use is to demonstrate the concepts and | 7 | * source. Its main use is to demonstrate the concepts and |
8 | * functions described in the guide. | 8 | * functions described in the guide. |
9 | * | 9 | * |
10 | * This software has been developed while working on the LART | 10 | * This software has been developed while working on the LART |
11 | * computing board (http://www.lart.tudelft.nl/), which is | 11 | * computing board (http://www.lartmaker.nl), which was sponsored |
12 | * sponsored by the Mobile Multi-media Communications | 12 | * by the Delt University of Technology projects Mobile Multi-media |
13 | * (http://www.mmc.tudelft.nl/) and Ubiquitous Communications | 13 | * Communications and Ubiquitous Communications. |
14 | * (http://www.ubicom.tudelft.nl/) projects. | ||
15 | * | ||
16 | * The author can be reached at: | ||
17 | * | ||
18 | * Erik Mouw | ||
19 | * Information and Communication Theory Group | ||
20 | * Faculty of Information Technology and Systems | ||
21 | * Delft University of Technology | ||
22 | * P.O. Box 5031 | ||
23 | * 2600 GA Delft | ||
24 | * The Netherlands | ||
25 | * | ||
26 | * | 14 | * |
27 | * This program is free software; you can redistribute | 15 | * This program is free software; you can redistribute |
28 | * it and/or modify it under the terms of the GNU General | 16 | * it and/or modify it under the terms of the GNU General |
diff --git a/Documentation/DocBook/videobook.tmpl b/Documentation/DocBook/videobook.tmpl deleted file mode 100644 index 0bc25949b66..00000000000 --- a/Documentation/DocBook/videobook.tmpl +++ /dev/null | |||
@@ -1,1654 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | ||
3 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> | ||
4 | |||
5 | <book id="V4LGuide"> | ||
6 | <bookinfo> | ||
7 | <title>Video4Linux Programming</title> | ||
8 | |||
9 | <authorgroup> | ||
10 | <author> | ||
11 | <firstname>Alan</firstname> | ||
12 | <surname>Cox</surname> | ||
13 | <affiliation> | ||
14 | <address> | ||
15 | <email>alan@redhat.com</email> | ||
16 | </address> | ||
17 | </affiliation> | ||
18 | </author> | ||
19 | </authorgroup> | ||
20 | |||
21 | <copyright> | ||
22 | <year>2000</year> | ||
23 | <holder>Alan Cox</holder> | ||
24 | </copyright> | ||
25 | |||
26 | <legalnotice> | ||
27 | <para> | ||
28 | This documentation is free software; you can redistribute | ||
29 | it and/or modify it under the terms of the GNU General Public | ||
30 | License as published by the Free Software Foundation; either | ||
31 | version 2 of the License, or (at your option) any later | ||
32 | version. | ||
33 | </para> | ||
34 | |||
35 | <para> | ||
36 | This program is distributed in the hope that it will be | ||
37 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
38 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
39 | See the GNU General Public License for more details. | ||
40 | </para> | ||
41 | |||
42 | <para> | ||
43 | You should have received a copy of the GNU General Public | ||
44 | License along with this program; if not, write to the Free | ||
45 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
46 | MA 02111-1307 USA | ||
47 | </para> | ||
48 | |||
49 | <para> | ||
50 | For more details see the file COPYING in the source | ||
51 | distribution of Linux. | ||
52 | </para> | ||
53 | </legalnotice> | ||
54 | </bookinfo> | ||
55 | |||
56 | <toc></toc> | ||
57 | |||
58 | <chapter id="intro"> | ||
59 | <title>Introduction</title> | ||
60 | <para> | ||
61 | Parts of this document first appeared in Linux Magazine under a | ||
62 | ninety day exclusivity. | ||
63 | </para> | ||
64 | <para> | ||
65 | Video4Linux is intended to provide a common programming interface | ||
66 | for the many TV and capture cards now on the market, as well as | ||
67 | parallel port and USB video cameras. Radio, teletext decoders and | ||
68 | vertical blanking data interfaces are also provided. | ||
69 | </para> | ||
70 | </chapter> | ||
71 | <chapter id="radio"> | ||
72 | <title>Radio Devices</title> | ||
73 | <para> | ||
74 | There are a wide variety of radio interfaces available for PC's, and these | ||
75 | are generally very simple to program. The biggest problem with supporting | ||
76 | such devices is normally extracting documentation from the vendor. | ||
77 | </para> | ||
78 | <para> | ||
79 | The radio interface supports a simple set of control ioctls standardised | ||
80 | across all radio and tv interfaces. It does not support read or write, which | ||
81 | are used for video streams. The reason radio cards do not allow you to read | ||
82 | the audio stream into an application is that without exception they provide | ||
83 | a connection on to a soundcard. Soundcards can be used to read the radio | ||
84 | data just fine. | ||
85 | </para> | ||
86 | <sect1 id="registerradio"> | ||
87 | <title>Registering Radio Devices</title> | ||
88 | <para> | ||
89 | The Video4linux core provides an interface for registering devices. The | ||
90 | first step in writing our radio card driver is to register it. | ||
91 | </para> | ||
92 | <programlisting> | ||
93 | |||
94 | |||
95 | static struct video_device my_radio | ||
96 | { | ||
97 | "My radio", | ||
98 | VID_TYPE_TUNER, | ||
99 | radio_open. | ||
100 | radio_close, | ||
101 | NULL, /* no read */ | ||
102 | NULL, /* no write */ | ||
103 | NULL, /* no poll */ | ||
104 | radio_ioctl, | ||
105 | NULL, /* no special init function */ | ||
106 | NULL /* no private data */ | ||
107 | }; | ||
108 | |||
109 | |||
110 | </programlisting> | ||
111 | <para> | ||
112 | This declares our video4linux device driver interface. The VID_TYPE_ value | ||
113 | defines what kind of an interface we are, and defines basic capabilities. | ||
114 | </para> | ||
115 | <para> | ||
116 | The only defined value relevant for a radio card is VID_TYPE_TUNER which | ||
117 | indicates that the device can be tuned. Clearly our radio is going to have some | ||
118 | way to change channel so it is tuneable. | ||
119 | </para> | ||
120 | <para> | ||
121 | We declare an open and close routine, but we do not need read or write, | ||
122 | which are used to read and write video data to or from the card itself. As | ||
123 | we have no read or write there is no poll function. | ||
124 | </para> | ||
125 | <para> | ||
126 | The private initialise function is run when the device is registered. In | ||
127 | this driver we've already done all the work needed. The final pointer is a | ||
128 | private data pointer that can be used by the device driver to attach and | ||
129 | retrieve private data structures. We set this field "priv" to NULL for | ||
130 | the moment. | ||
131 | </para> | ||
132 | <para> | ||
133 | Having the structure defined is all very well but we now need to register it | ||
134 | with the kernel. | ||
135 | </para> | ||
136 | <programlisting> | ||
137 | |||
138 | |||
139 | static int io = 0x320; | ||
140 | |||
141 | int __init myradio_init(struct video_init *v) | ||
142 | { | ||
143 | if(!request_region(io, MY_IO_SIZE, "myradio")) | ||
144 | { | ||
145 | printk(KERN_ERR | ||
146 | "myradio: port 0x%03X is in use.\n", io); | ||
147 | return -EBUSY; | ||
148 | } | ||
149 | |||
150 | if(video_device_register(&my_radio, VFL_TYPE_RADIO)==-1) { | ||
151 | release_region(io, MY_IO_SIZE); | ||
152 | return -EINVAL; | ||
153 | } | ||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | </programlisting> | ||
158 | <para> | ||
159 | The first stage of the initialisation, as is normally the case, is to check | ||
160 | that the I/O space we are about to fiddle with doesn't belong to some other | ||
161 | driver. If it is we leave well alone. If the user gives the address of the | ||
162 | wrong device then we will spot this. These policies will generally avoid | ||
163 | crashing the machine. | ||
164 | </para> | ||
165 | <para> | ||
166 | Now we ask the Video4Linux layer to register the device for us. We hand it | ||
167 | our carefully designed video_device structure and also tell it which group | ||
168 | of devices we want it registered with. In this case VFL_TYPE_RADIO. | ||
169 | </para> | ||
170 | <para> | ||
171 | The types available are | ||
172 | </para> | ||
173 | <table frame="all" id="Device_Types"><title>Device Types</title> | ||
174 | <tgroup cols="3" align="left"> | ||
175 | <tbody> | ||
176 | <row> | ||
177 | <entry>VFL_TYPE_RADIO</entry><entry>/dev/radio{n}</entry><entry> | ||
178 | |||
179 | Radio devices are assigned in this block. As with all of these | ||
180 | selections the actual number assignment is done by the video layer | ||
181 | accordijng to what is free.</entry> | ||
182 | </row><row> | ||
183 | <entry>VFL_TYPE_GRABBER</entry><entry>/dev/video{n}</entry><entry> | ||
184 | Video capture devices and also -- counter-intuitively for the name -- | ||
185 | hardware video playback devices such as MPEG2 cards.</entry> | ||
186 | </row><row> | ||
187 | <entry>VFL_TYPE_VBI</entry><entry>/dev/vbi{n}</entry><entry> | ||
188 | The VBI devices capture the hidden lines on a television picture | ||
189 | that carry further information like closed caption data, teletext | ||
190 | (primarily in Europe) and now Intercast and the ATVEC internet | ||
191 | television encodings.</entry> | ||
192 | </row><row> | ||
193 | <entry>VFL_TYPE_VTX</entry><entry>/dev/vtx[n}</entry><entry> | ||
194 | VTX is 'Videotext' also known as 'Teletext'. This is a system for | ||
195 | sending numbered, 40x25, mostly textual page images over the hidden | ||
196 | lines. Unlike the /dev/vbi interfaces, this is for 'smart' decoder | ||
197 | chips. (The use of the word smart here has to be taken in context, | ||
198 | the smartest teletext chips are fairly dumb pieces of technology). | ||
199 | </entry> | ||
200 | </row> | ||
201 | </tbody> | ||
202 | </tgroup> | ||
203 | </table> | ||
204 | <para> | ||
205 | We are most definitely a radio. | ||
206 | </para> | ||
207 | <para> | ||
208 | Finally we allocate our I/O space so that nobody treads on us and return 0 | ||
209 | to signify general happiness with the state of the universe. | ||
210 | </para> | ||
211 | </sect1> | ||
212 | <sect1 id="openradio"> | ||
213 | <title>Opening And Closing The Radio</title> | ||
214 | |||
215 | <para> | ||
216 | The functions we declared in our video_device are mostly very simple. | ||
217 | Firstly we can drop in what is basically standard code for open and close. | ||
218 | </para> | ||
219 | <programlisting> | ||
220 | |||
221 | |||
222 | static int users = 0; | ||
223 | |||
224 | static int radio_open(struct video_device *dev, int flags) | ||
225 | { | ||
226 | if(users) | ||
227 | return -EBUSY; | ||
228 | users++; | ||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | </programlisting> | ||
233 | <para> | ||
234 | At open time we need to do nothing but check if someone else is also using | ||
235 | the radio card. If nobody is using it we make a note that we are using it, | ||
236 | then we ensure that nobody unloads our driver on us. | ||
237 | </para> | ||
238 | <programlisting> | ||
239 | |||
240 | |||
241 | static int radio_close(struct video_device *dev) | ||
242 | { | ||
243 | users--; | ||
244 | } | ||
245 | |||
246 | </programlisting> | ||
247 | <para> | ||
248 | At close time we simply need to reduce the user count and allow the module | ||
249 | to become unloadable. | ||
250 | </para> | ||
251 | <para> | ||
252 | If you are sharp you will have noticed neither the open nor the close | ||
253 | routines attempt to reset or change the radio settings. This is intentional. | ||
254 | It allows an application to set up the radio and exit. It avoids a user | ||
255 | having to leave an application running all the time just to listen to the | ||
256 | radio. | ||
257 | </para> | ||
258 | </sect1> | ||
259 | <sect1 id="ioctlradio"> | ||
260 | <title>The Ioctl Interface</title> | ||
261 | <para> | ||
262 | This leaves the ioctl routine, without which the driver will not be | ||
263 | terribly useful to anyone. | ||
264 | </para> | ||
265 | <programlisting> | ||
266 | |||
267 | |||
268 | static int radio_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | ||
269 | { | ||
270 | switch(cmd) | ||
271 | { | ||
272 | case VIDIOCGCAP: | ||
273 | { | ||
274 | struct video_capability v; | ||
275 | v.type = VID_TYPE_TUNER; | ||
276 | v.channels = 1; | ||
277 | v.audios = 1; | ||
278 | v.maxwidth = 0; | ||
279 | v.minwidth = 0; | ||
280 | v.maxheight = 0; | ||
281 | v.minheight = 0; | ||
282 | strcpy(v.name, "My Radio"); | ||
283 | if(copy_to_user(arg, &v, sizeof(v))) | ||
284 | return -EFAULT; | ||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | </programlisting> | ||
289 | <para> | ||
290 | VIDIOCGCAP is the first ioctl all video4linux devices must support. It | ||
291 | allows the applications to find out what sort of a card they have found and | ||
292 | to figure out what they want to do about it. The fields in the structure are | ||
293 | </para> | ||
294 | <table frame="all" id="video_capability_fields"><title>struct video_capability fields</title> | ||
295 | <tgroup cols="2" align="left"> | ||
296 | <tbody> | ||
297 | <row> | ||
298 | <entry>name</entry><entry>The device text name. This is intended for the user.</entry> | ||
299 | </row><row> | ||
300 | <entry>channels</entry><entry>The number of different channels you can tune on | ||
301 | this card. It could even by zero for a card that has | ||
302 | no tuning capability. For our simple FM radio it is 1. | ||
303 | An AM/FM radio would report 2.</entry> | ||
304 | </row><row> | ||
305 | <entry>audios</entry><entry>The number of audio inputs on this device. For our | ||
306 | radio there is only one audio input.</entry> | ||
307 | </row><row> | ||
308 | <entry>minwidth,minheight</entry><entry>The smallest size the card is capable of capturing | ||
309 | images in. We set these to zero. Radios do not | ||
310 | capture pictures</entry> | ||
311 | </row><row> | ||
312 | <entry>maxwidth,maxheight</entry><entry>The largest image size the card is capable of | ||
313 | capturing. For our radio we report 0. | ||
314 | </entry> | ||
315 | </row><row> | ||
316 | <entry>type</entry><entry>This reports the capabilities of the device, and | ||
317 | matches the field we filled in in the struct | ||
318 | video_device when registering.</entry> | ||
319 | </row> | ||
320 | </tbody> | ||
321 | </tgroup> | ||
322 | </table> | ||
323 | <para> | ||
324 | Having filled in the fields, we use copy_to_user to copy the structure into | ||
325 | the users buffer. If the copy fails we return an EFAULT to the application | ||
326 | so that it knows it tried to feed us garbage. | ||
327 | </para> | ||
328 | <para> | ||
329 | The next pair of ioctl operations select which tuner is to be used and let | ||
330 | the application find the tuner properties. We have only a single FM band | ||
331 | tuner in our example device. | ||
332 | </para> | ||
333 | <programlisting> | ||
334 | |||
335 | |||
336 | case VIDIOCGTUNER: | ||
337 | { | ||
338 | struct video_tuner v; | ||
339 | if(copy_from_user(&v, arg, sizeof(v))!=0) | ||
340 | return -EFAULT; | ||
341 | if(v.tuner) | ||
342 | return -EINVAL; | ||
343 | v.rangelow=(87*16000); | ||
344 | v.rangehigh=(108*16000); | ||
345 | v.flags = VIDEO_TUNER_LOW; | ||
346 | v.mode = VIDEO_MODE_AUTO; | ||
347 | v.signal = 0xFFFF; | ||
348 | strcpy(v.name, "FM"); | ||
349 | if(copy_to_user(&v, arg, sizeof(v))!=0) | ||
350 | return -EFAULT; | ||
351 | return 0; | ||
352 | } | ||
353 | |||
354 | </programlisting> | ||
355 | <para> | ||
356 | The VIDIOCGTUNER ioctl allows applications to query a tuner. The application | ||
357 | sets the tuner field to the tuner number it wishes to query. The query does | ||
358 | not change the tuner that is being used, it merely enquires about the tuner | ||
359 | in question. | ||
360 | </para> | ||
361 | <para> | ||
362 | We have exactly one tuner so after copying the user buffer to our temporary | ||
363 | structure we complain if they asked for a tuner other than tuner 0. | ||
364 | </para> | ||
365 | <para> | ||
366 | The video_tuner structure has the following fields | ||
367 | </para> | ||
368 | <table frame="all" id="video_tuner_fields"><title>struct video_tuner fields</title> | ||
369 | <tgroup cols="2" align="left"> | ||
370 | <tbody> | ||
371 | <row> | ||
372 | <entry>int tuner</entry><entry>The number of the tuner in question</entry> | ||
373 | </row><row> | ||
374 | <entry>char name[32]</entry><entry>A text description of this tuner. "FM" will do fine. | ||
375 | This is intended for the application.</entry> | ||
376 | </row><row> | ||
377 | <entry>u32 flags</entry> | ||
378 | <entry>Tuner capability flags</entry> | ||
379 | </row> | ||
380 | <row> | ||
381 | <entry>u16 mode</entry><entry>The current reception mode</entry> | ||
382 | |||
383 | </row><row> | ||
384 | <entry>u16 signal</entry><entry>The signal strength scaled between 0 and 65535. If | ||
385 | a device cannot tell the signal strength it should | ||
386 | report 65535. Many simple cards contain only a | ||
387 | signal/no signal bit. Such cards will report either | ||
388 | 0 or 65535.</entry> | ||
389 | |||
390 | </row><row> | ||
391 | <entry>u32 rangelow, rangehigh</entry><entry> | ||
392 | The range of frequencies supported by the radio | ||
393 | or TV. It is scaled according to the VIDEO_TUNER_LOW | ||
394 | flag.</entry> | ||
395 | |||
396 | </row> | ||
397 | </tbody> | ||
398 | </tgroup> | ||
399 | </table> | ||
400 | |||
401 | <table frame="all" id="video_tuner_flags"><title>struct video_tuner flags</title> | ||
402 | <tgroup cols="2" align="left"> | ||
403 | <tbody> | ||
404 | <row> | ||
405 | <entry>VIDEO_TUNER_PAL</entry><entry>A PAL TV tuner</entry> | ||
406 | </row><row> | ||
407 | <entry>VIDEO_TUNER_NTSC</entry><entry>An NTSC (US) TV tuner</entry> | ||
408 | </row><row> | ||
409 | <entry>VIDEO_TUNER_SECAM</entry><entry>A SECAM (French) TV tuner</entry> | ||
410 | </row><row> | ||
411 | <entry>VIDEO_TUNER_LOW</entry><entry> | ||
412 | The tuner frequency is scaled in 1/16th of a KHz | ||
413 | steps. If not it is in 1/16th of a MHz steps | ||
414 | </entry> | ||
415 | </row><row> | ||
416 | <entry>VIDEO_TUNER_NORM</entry><entry>The tuner can set its format</entry> | ||
417 | </row><row> | ||
418 | <entry>VIDEO_TUNER_STEREO_ON</entry><entry>The tuner is currently receiving a stereo signal</entry> | ||
419 | </row> | ||
420 | </tbody> | ||
421 | </tgroup> | ||
422 | </table> | ||
423 | |||
424 | <table frame="all" id="video_tuner_modes"><title>struct video_tuner modes</title> | ||
425 | <tgroup cols="2" align="left"> | ||
426 | <tbody> | ||
427 | <row> | ||
428 | <entry>VIDEO_MODE_PAL</entry><entry>PAL Format</entry> | ||
429 | </row><row> | ||
430 | <entry>VIDEO_MODE_NTSC</entry><entry>NTSC Format (USA)</entry> | ||
431 | </row><row> | ||
432 | <entry>VIDEO_MODE_SECAM</entry><entry>French Format</entry> | ||
433 | </row><row> | ||
434 | <entry>VIDEO_MODE_AUTO</entry><entry>A device that does not need to do | ||
435 | TV format switching</entry> | ||
436 | </row> | ||
437 | </tbody> | ||
438 | </tgroup> | ||
439 | </table> | ||
440 | <para> | ||
441 | The settings for the radio card are thus fairly simple. We report that we | ||
442 | are a tuner called "FM" for FM radio. In order to get the best tuning | ||
443 | resolution we report VIDEO_TUNER_LOW and select tuning to 1/16th of KHz. Its | ||
444 | unlikely our card can do that resolution but it is a fair bet the card can | ||
445 | do better than 1/16th of a MHz. VIDEO_TUNER_LOW is appropriate to almost all | ||
446 | radio usage. | ||
447 | </para> | ||
448 | <para> | ||
449 | We report that the tuner automatically handles deciding what format it is | ||
450 | receiving - true enough as it only handles FM radio. Our example card is | ||
451 | also incapable of detecting stereo or signal strengths so it reports a | ||
452 | strength of 0xFFFF (maximum) and no stereo detected. | ||
453 | </para> | ||
454 | <para> | ||
455 | To finish off we set the range that can be tuned to be 87-108Mhz, the normal | ||
456 | FM broadcast radio range. It is important to find out what the card is | ||
457 | actually capable of tuning. It is easy enough to simply use the FM broadcast | ||
458 | range. Unfortunately if you do this you will discover the FM broadcast | ||
459 | ranges in the USA, Europe and Japan are all subtly different and some users | ||
460 | cannot receive all the stations they wish. | ||
461 | </para> | ||
462 | <para> | ||
463 | The application also needs to be able to set the tuner it wishes to use. In | ||
464 | our case, with a single tuner this is rather simple to arrange. | ||
465 | </para> | ||
466 | <programlisting> | ||
467 | |||
468 | case VIDIOCSTUNER: | ||
469 | { | ||
470 | struct video_tuner v; | ||
471 | if(copy_from_user(&v, arg, sizeof(v))) | ||
472 | return -EFAULT; | ||
473 | if(v.tuner != 0) | ||
474 | return -EINVAL; | ||
475 | return 0; | ||
476 | } | ||
477 | |||
478 | </programlisting> | ||
479 | <para> | ||
480 | We copy the user supplied structure into kernel memory so we can examine it. | ||
481 | If the user has selected a tuner other than zero we reject the request. If | ||
482 | they wanted tuner 0 then, surprisingly enough, that is the current tuner already. | ||
483 | </para> | ||
484 | <para> | ||
485 | The next two ioctls we need to provide are to get and set the frequency of | ||
486 | the radio. These both use an unsigned long argument which is the frequency. | ||
487 | The scale of the frequency depends on the VIDEO_TUNER_LOW flag as I | ||
488 | mentioned earlier on. Since we have VIDEO_TUNER_LOW set this will be in | ||
489 | 1/16ths of a KHz. | ||
490 | </para> | ||
491 | <programlisting> | ||
492 | |||
493 | static unsigned long current_freq; | ||
494 | |||
495 | |||
496 | |||
497 | case VIDIOCGFREQ: | ||
498 | if(copy_to_user(arg, &current_freq, | ||
499 | sizeof(unsigned long)) | ||
500 | return -EFAULT; | ||
501 | return 0; | ||
502 | |||
503 | </programlisting> | ||
504 | <para> | ||
505 | Querying the frequency in our case is relatively simple. Our radio card is | ||
506 | too dumb to let us query the signal strength so we remember our setting if | ||
507 | we know it. All we have to do is copy it to the user. | ||
508 | </para> | ||
509 | <programlisting> | ||
510 | |||
511 | |||
512 | case VIDIOCSFREQ: | ||
513 | { | ||
514 | u32 freq; | ||
515 | if(copy_from_user(arg, &freq, | ||
516 | sizeof(unsigned long))!=0) | ||
517 | return -EFAULT; | ||
518 | if(hardware_set_freq(freq)<0) | ||
519 | return -EINVAL; | ||
520 | current_freq = freq; | ||
521 | return 0; | ||
522 | } | ||
523 | |||
524 | </programlisting> | ||
525 | <para> | ||
526 | Setting the frequency is a little more complex. We begin by copying the | ||
527 | desired frequency into kernel space. Next we call a hardware specific routine | ||
528 | to set the radio up. This might be as simple as some scaling and a few | ||
529 | writes to an I/O port. For most radio cards it turns out a good deal more | ||
530 | complicated and may involve programming things like a phase locked loop on | ||
531 | the card. This is what documentation is for. | ||
532 | </para> | ||
533 | <para> | ||
534 | The final set of operations we need to provide for our radio are the | ||
535 | volume controls. Not all radio cards can even do volume control. After all | ||
536 | there is a perfectly good volume control on the sound card. We will assume | ||
537 | our radio card has a simple 4 step volume control. | ||
538 | </para> | ||
539 | <para> | ||
540 | There are two ioctls with audio we need to support | ||
541 | </para> | ||
542 | <programlisting> | ||
543 | |||
544 | static int current_volume=0; | ||
545 | |||
546 | case VIDIOCGAUDIO: | ||
547 | { | ||
548 | struct video_audio v; | ||
549 | if(copy_from_user(&v, arg, sizeof(v))) | ||
550 | return -EFAULT; | ||
551 | if(v.audio != 0) | ||
552 | return -EINVAL; | ||
553 | v.volume = 16384*current_volume; | ||
554 | v.step = 16384; | ||
555 | strcpy(v.name, "Radio"); | ||
556 | v.mode = VIDEO_SOUND_MONO; | ||
557 | v.balance = 0; | ||
558 | v.base = 0; | ||
559 | v.treble = 0; | ||
560 | |||
561 | if(copy_to_user(arg. &v, sizeof(v))) | ||
562 | return -EFAULT; | ||
563 | return 0; | ||
564 | } | ||
565 | |||
566 | </programlisting> | ||
567 | <para> | ||
568 | Much like the tuner we start by copying the user structure into kernel | ||
569 | space. Again we check if the user has asked for a valid audio input. We have | ||
570 | only input 0 and we punt if they ask for another input. | ||
571 | </para> | ||
572 | <para> | ||
573 | Then we fill in the video_audio structure. This has the following format | ||
574 | </para> | ||
575 | <table frame="all" id="video_audio_fields"><title>struct video_audio fields</title> | ||
576 | <tgroup cols="2" align="left"> | ||
577 | <tbody> | ||
578 | <row> | ||
579 | <entry>audio</entry><entry>The input the user wishes to query</entry> | ||
580 | </row><row> | ||
581 | <entry>volume</entry><entry>The volume setting on a scale of 0-65535</entry> | ||
582 | </row><row> | ||
583 | <entry>base</entry><entry>The base level on a scale of 0-65535</entry> | ||
584 | </row><row> | ||
585 | <entry>treble</entry><entry>The treble level on a scale of 0-65535</entry> | ||
586 | </row><row> | ||
587 | <entry>flags</entry><entry>The features this audio device supports | ||
588 | </entry> | ||
589 | </row><row> | ||
590 | <entry>name</entry><entry>A text name to display to the user. We picked | ||
591 | "Radio" as it explains things quite nicely.</entry> | ||
592 | </row><row> | ||
593 | <entry>mode</entry><entry>The current reception mode for the audio | ||
594 | |||
595 | We report MONO because our card is too stupid to know if it is in | ||
596 | mono or stereo. | ||
597 | </entry> | ||
598 | </row><row> | ||
599 | <entry>balance</entry><entry>The stereo balance on a scale of 0-65535, 32768 is | ||
600 | middle.</entry> | ||
601 | </row><row> | ||
602 | <entry>step</entry><entry>The step by which the volume control jumps. This is | ||
603 | used to help make it easy for applications to set | ||
604 | slider behaviour.</entry> | ||
605 | </row> | ||
606 | </tbody> | ||
607 | </tgroup> | ||
608 | </table> | ||
609 | |||
610 | <table frame="all" id="video_audio_flags"><title>struct video_audio flags</title> | ||
611 | <tgroup cols="2" align="left"> | ||
612 | <tbody> | ||
613 | <row> | ||
614 | <entry>VIDEO_AUDIO_MUTE</entry><entry>The audio is currently muted. We | ||
615 | could fake this in our driver but we | ||
616 | choose not to bother.</entry> | ||
617 | </row><row> | ||
618 | <entry>VIDEO_AUDIO_MUTABLE</entry><entry>The input has a mute option</entry> | ||
619 | </row><row> | ||
620 | <entry>VIDEO_AUDIO_TREBLE</entry><entry>The input has a treble control</entry> | ||
621 | </row><row> | ||
622 | <entry>VIDEO_AUDIO_BASS</entry><entry>The input has a base control</entry> | ||
623 | </row> | ||
624 | </tbody> | ||
625 | </tgroup> | ||
626 | </table> | ||
627 | |||
628 | <table frame="all" id="video_audio_modes"><title>struct video_audio modes</title> | ||
629 | <tgroup cols="2" align="left"> | ||
630 | <tbody> | ||
631 | <row> | ||
632 | <entry>VIDEO_SOUND_MONO</entry><entry>Mono sound</entry> | ||
633 | </row><row> | ||
634 | <entry>VIDEO_SOUND_STEREO</entry><entry>Stereo sound</entry> | ||
635 | </row><row> | ||
636 | <entry>VIDEO_SOUND_LANG1</entry><entry>Alternative language 1 (TV specific)</entry> | ||
637 | </row><row> | ||
638 | <entry>VIDEO_SOUND_LANG2</entry><entry>Alternative language 2 (TV specific)</entry> | ||
639 | </row> | ||
640 | </tbody> | ||
641 | </tgroup> | ||
642 | </table> | ||
643 | <para> | ||
644 | Having filled in the structure we copy it back to user space. | ||
645 | </para> | ||
646 | <para> | ||
647 | The VIDIOCSAUDIO ioctl allows the user to set the audio parameters in the | ||
648 | video_audio structure. The driver does its best to honour the request. | ||
649 | </para> | ||
650 | <programlisting> | ||
651 | |||
652 | case VIDIOCSAUDIO: | ||
653 | { | ||
654 | struct video_audio v; | ||
655 | if(copy_from_user(&v, arg, sizeof(v))) | ||
656 | return -EFAULT; | ||
657 | if(v.audio) | ||
658 | return -EINVAL; | ||
659 | current_volume = v/16384; | ||
660 | hardware_set_volume(current_volume); | ||
661 | return 0; | ||
662 | } | ||
663 | |||
664 | </programlisting> | ||
665 | <para> | ||
666 | In our case there is very little that the user can set. The volume is | ||
667 | basically the limit. Note that we could pretend to have a mute feature | ||
668 | by rewriting this to | ||
669 | </para> | ||
670 | <programlisting> | ||
671 | |||
672 | case VIDIOCSAUDIO: | ||
673 | { | ||
674 | struct video_audio v; | ||
675 | if(copy_from_user(&v, arg, sizeof(v))) | ||
676 | return -EFAULT; | ||
677 | if(v.audio) | ||
678 | return -EINVAL; | ||
679 | current_volume = v/16384; | ||
680 | if(v.flags&VIDEO_AUDIO_MUTE) | ||
681 | hardware_set_volume(0); | ||
682 | else | ||
683 | hardware_set_volume(current_volume); | ||
684 | current_muted = v.flags & | ||
685 | VIDEO_AUDIO_MUTE; | ||
686 | return 0; | ||
687 | } | ||
688 | |||
689 | </programlisting> | ||
690 | <para> | ||
691 | This with the corresponding changes to the VIDIOCGAUDIO code to report the | ||
692 | state of the mute flag we save and to report the card has a mute function, | ||
693 | will allow applications to use a mute facility with this card. It is | ||
694 | questionable whether this is a good idea however. User applications can already | ||
695 | fake this themselves and kernel space is precious. | ||
696 | </para> | ||
697 | <para> | ||
698 | We now have a working radio ioctl handler. So we just wrap up the function | ||
699 | </para> | ||
700 | <programlisting> | ||
701 | |||
702 | |||
703 | } | ||
704 | return -ENOIOCTLCMD; | ||
705 | } | ||
706 | |||
707 | </programlisting> | ||
708 | <para> | ||
709 | and pass the Video4Linux layer back an error so that it knows we did not | ||
710 | understand the request we got passed. | ||
711 | </para> | ||
712 | </sect1> | ||
713 | <sect1 id="modradio"> | ||
714 | <title>Module Wrapper</title> | ||
715 | <para> | ||
716 | Finally we add in the usual module wrapping and the driver is done. | ||
717 | </para> | ||
718 | <programlisting> | ||
719 | |||
720 | #ifndef MODULE | ||
721 | |||
722 | static int io = 0x300; | ||
723 | |||
724 | #else | ||
725 | |||
726 | static int io = -1; | ||
727 | |||
728 | #endif | ||
729 | |||
730 | MODULE_AUTHOR("Alan Cox"); | ||
731 | MODULE_DESCRIPTION("A driver for an imaginary radio card."); | ||
732 | module_param(io, int, 0444); | ||
733 | MODULE_PARM_DESC(io, "I/O address of the card."); | ||
734 | |||
735 | static int __init init(void) | ||
736 | { | ||
737 | if(io==-1) | ||
738 | { | ||
739 | printk(KERN_ERR | ||
740 | "You must set an I/O address with io=0x???\n"); | ||
741 | return -EINVAL; | ||
742 | } | ||
743 | return myradio_init(NULL); | ||
744 | } | ||
745 | |||
746 | static void __exit cleanup(void) | ||
747 | { | ||
748 | video_unregister_device(&my_radio); | ||
749 | release_region(io, MY_IO_SIZE); | ||
750 | } | ||
751 | |||
752 | module_init(init); | ||
753 | module_exit(cleanup); | ||
754 | |||
755 | </programlisting> | ||
756 | <para> | ||
757 | In this example we set the IO base by default if the driver is compiled into | ||
758 | the kernel: you can still set it using "my_radio.irq" if this file is called <filename>my_radio.c</filename>. For the module we require the | ||
759 | user sets the parameter. We set io to a nonsense port (-1) so that we can | ||
760 | tell if the user supplied an io parameter or not. | ||
761 | </para> | ||
762 | <para> | ||
763 | We use MODULE_ defines to give an author for the card driver and a | ||
764 | description. We also use them to declare that io is an integer and it is the | ||
765 | address of the card, and can be read by anyone from sysfs. | ||
766 | </para> | ||
767 | <para> | ||
768 | The clean-up routine unregisters the video_device we registered, and frees | ||
769 | up the I/O space. Note that the unregister takes the actual video_device | ||
770 | structure as its argument. Unlike the file operations structure which can be | ||
771 | shared by all instances of a device a video_device structure as an actual | ||
772 | instance of the device. If you are registering multiple radio devices you | ||
773 | need to fill in one structure per device (most likely by setting up a | ||
774 | template and copying it to each of the actual device structures). | ||
775 | </para> | ||
776 | </sect1> | ||
777 | </chapter> | ||
778 | <chapter id="Video_Capture_Devices"> | ||
779 | <title>Video Capture Devices</title> | ||
780 | <sect1 id="introvid"> | ||
781 | <title>Video Capture Device Types</title> | ||
782 | <para> | ||
783 | The video capture devices share the same interfaces as radio devices. In | ||
784 | order to explain the video capture interface I will use the example of a | ||
785 | camera that has no tuners or audio input. This keeps the example relatively | ||
786 | clean. To get both combine the two driver examples. | ||
787 | </para> | ||
788 | <para> | ||
789 | Video capture devices divide into four categories. A little technology | ||
790 | backgrounder. Full motion video even at television resolution (which is | ||
791 | actually fairly low) is pretty resource-intensive. You are continually | ||
792 | passing megabytes of data every second from the capture card to the display. | ||
793 | several alternative approaches have emerged because copying this through the | ||
794 | processor and the user program is a particularly bad idea . | ||
795 | </para> | ||
796 | <para> | ||
797 | The first is to add the television image onto the video output directly. | ||
798 | This is also how some 3D cards work. These basic cards can generally drop the | ||
799 | video into any chosen rectangle of the display. Cards like this, which | ||
800 | include most mpeg1 cards that used the feature connector, aren't very | ||
801 | friendly in a windowing environment. They don't understand windows or | ||
802 | clipping. The video window is always on the top of the display. | ||
803 | </para> | ||
804 | <para> | ||
805 | Chroma keying is a technique used by cards to get around this. It is an old | ||
806 | television mixing trick where you mark all the areas you wish to replace | ||
807 | with a single clear colour that isn't used in the image - TV people use an | ||
808 | incredibly bright blue while computing people often use a particularly | ||
809 | virulent purple. Bright blue occurs on the desktop. Anyone with virulent | ||
810 | purple windows has another problem besides their TV overlay. | ||
811 | </para> | ||
812 | <para> | ||
813 | The third approach is to copy the data from the capture card to the video | ||
814 | card, but to do it directly across the PCI bus. This relieves the processor | ||
815 | from doing the work but does require some smartness on the part of the video | ||
816 | capture chip, as well as a suitable video card. Programming this kind of | ||
817 | card and more so debugging it can be extremely tricky. There are some quite | ||
818 | complicated interactions with the display and you may also have to cope with | ||
819 | various chipset bugs that show up when PCI cards start talking to each | ||
820 | other. | ||
821 | </para> | ||
822 | <para> | ||
823 | To keep our example fairly simple we will assume a card that supports | ||
824 | overlaying a flat rectangular image onto the frame buffer output, and which | ||
825 | can also capture stuff into processor memory. | ||
826 | </para> | ||
827 | </sect1> | ||
828 | <sect1 id="regvid"> | ||
829 | <title>Registering Video Capture Devices</title> | ||
830 | <para> | ||
831 | This time we need to add more functions for our camera device. | ||
832 | </para> | ||
833 | <programlisting> | ||
834 | static struct video_device my_camera | ||
835 | { | ||
836 | "My Camera", | ||
837 | VID_TYPE_OVERLAY|VID_TYPE_SCALES|\ | ||
838 | VID_TYPE_CAPTURE|VID_TYPE_CHROMAKEY, | ||
839 | camera_open. | ||
840 | camera_close, | ||
841 | camera_read, /* no read */ | ||
842 | NULL, /* no write */ | ||
843 | camera_poll, /* no poll */ | ||
844 | camera_ioctl, | ||
845 | NULL, /* no special init function */ | ||
846 | NULL /* no private data */ | ||
847 | }; | ||
848 | </programlisting> | ||
849 | <para> | ||
850 | We need a read() function which is used for capturing data from | ||
851 | the card, and we need a poll function so that a driver can wait for the next | ||
852 | frame to be captured. | ||
853 | </para> | ||
854 | <para> | ||
855 | We use the extra video capability flags that did not apply to the | ||
856 | radio interface. The video related flags are | ||
857 | </para> | ||
858 | <table frame="all" id="Capture_Capabilities"><title>Capture Capabilities</title> | ||
859 | <tgroup cols="2" align="left"> | ||
860 | <tbody> | ||
861 | <row> | ||
862 | <entry>VID_TYPE_CAPTURE</entry><entry>We support image capture</entry> | ||
863 | </row><row> | ||
864 | <entry>VID_TYPE_TELETEXT</entry><entry>A teletext capture device (vbi{n])</entry> | ||
865 | </row><row> | ||
866 | <entry>VID_TYPE_OVERLAY</entry><entry>The image can be directly overlaid onto the | ||
867 | frame buffer</entry> | ||
868 | </row><row> | ||
869 | <entry>VID_TYPE_CHROMAKEY</entry><entry>Chromakey can be used to select which parts | ||
870 | of the image to display</entry> | ||
871 | </row><row> | ||
872 | <entry>VID_TYPE_CLIPPING</entry><entry>It is possible to give the board a list of | ||
873 | rectangles to draw around. </entry> | ||
874 | </row><row> | ||
875 | <entry>VID_TYPE_FRAMERAM</entry><entry>The video capture goes into the video memory | ||
876 | and actually changes it. Applications need | ||
877 | to know this so they can clean up after the | ||
878 | card</entry> | ||
879 | </row><row> | ||
880 | <entry>VID_TYPE_SCALES</entry><entry>The image can be scaled to various sizes, | ||
881 | rather than being a single fixed size.</entry> | ||
882 | </row><row> | ||
883 | <entry>VID_TYPE_MONOCHROME</entry><entry>The capture will be monochrome. This isn't a | ||
884 | complete answer to the question since a mono | ||
885 | camera on a colour capture card will still | ||
886 | produce mono output.</entry> | ||
887 | </row><row> | ||
888 | <entry>VID_TYPE_SUBCAPTURE</entry><entry>The card allows only part of its field of | ||
889 | view to be captured. This enables | ||
890 | applications to avoid copying all of a large | ||
891 | image into memory when only some section is | ||
892 | relevant.</entry> | ||
893 | </row> | ||
894 | </tbody> | ||
895 | </tgroup> | ||
896 | </table> | ||
897 | <para> | ||
898 | We set VID_TYPE_CAPTURE so that we are seen as a capture card, | ||
899 | VID_TYPE_CHROMAKEY so the application knows it is time to draw in virulent | ||
900 | purple, and VID_TYPE_SCALES because we can be resized. | ||
901 | </para> | ||
902 | <para> | ||
903 | Our setup is fairly similar. This time we also want an interrupt line | ||
904 | for the 'frame captured' signal. Not all cards have this so some of them | ||
905 | cannot handle poll(). | ||
906 | </para> | ||
907 | <programlisting> | ||
908 | |||
909 | |||
910 | static int io = 0x320; | ||
911 | static int irq = 11; | ||
912 | |||
913 | int __init mycamera_init(struct video_init *v) | ||
914 | { | ||
915 | if(!request_region(io, MY_IO_SIZE, "mycamera")) | ||
916 | { | ||
917 | printk(KERN_ERR | ||
918 | "mycamera: port 0x%03X is in use.\n", io); | ||
919 | return -EBUSY; | ||
920 | } | ||
921 | |||
922 | if(video_device_register(&my_camera, | ||
923 | VFL_TYPE_GRABBER)==-1) { | ||
924 | release_region(io, MY_IO_SIZE); | ||
925 | return -EINVAL; | ||
926 | } | ||
927 | return 0; | ||
928 | } | ||
929 | |||
930 | </programlisting> | ||
931 | <para> | ||
932 | This is little changed from the needs of the radio card. We specify | ||
933 | VFL_TYPE_GRABBER this time as we want to be allocated a /dev/video name. | ||
934 | </para> | ||
935 | </sect1> | ||
936 | <sect1 id="opvid"> | ||
937 | <title>Opening And Closing The Capture Device</title> | ||
938 | <programlisting> | ||
939 | |||
940 | |||
941 | static int users = 0; | ||
942 | |||
943 | static int camera_open(struct video_device *dev, int flags) | ||
944 | { | ||
945 | if(users) | ||
946 | return -EBUSY; | ||
947 | if(request_irq(irq, camera_irq, 0, "camera", dev)<0) | ||
948 | return -EBUSY; | ||
949 | users++; | ||
950 | return 0; | ||
951 | } | ||
952 | |||
953 | |||
954 | static int camera_close(struct video_device *dev) | ||
955 | { | ||
956 | users--; | ||
957 | free_irq(irq, dev); | ||
958 | } | ||
959 | </programlisting> | ||
960 | <para> | ||
961 | The open and close routines are also quite similar. The only real change is | ||
962 | that we now request an interrupt for the camera device interrupt line. If we | ||
963 | cannot get the interrupt we report EBUSY to the application and give up. | ||
964 | </para> | ||
965 | </sect1> | ||
966 | <sect1 id="irqvid"> | ||
967 | <title>Interrupt Handling</title> | ||
968 | <para> | ||
969 | Our example handler is for an ISA bus device. If it was PCI you would be | ||
970 | able to share the interrupt and would have set IRQF_SHARED to indicate a | ||
971 | shared IRQ. We pass the device pointer as the interrupt routine argument. We | ||
972 | don't need to since we only support one card but doing this will make it | ||
973 | easier to upgrade the driver for multiple devices in the future. | ||
974 | </para> | ||
975 | <para> | ||
976 | Our interrupt routine needs to do little if we assume the card can simply | ||
977 | queue one frame to be read after it captures it. | ||
978 | </para> | ||
979 | <programlisting> | ||
980 | |||
981 | |||
982 | static struct wait_queue *capture_wait; | ||
983 | static int capture_ready = 0; | ||
984 | |||
985 | static void camera_irq(int irq, void *dev_id, | ||
986 | struct pt_regs *regs) | ||
987 | { | ||
988 | capture_ready=1; | ||
989 | wake_up_interruptible(&capture_wait); | ||
990 | } | ||
991 | </programlisting> | ||
992 | <para> | ||
993 | The interrupt handler is nice and simple for this card as we are assuming | ||
994 | the card is buffering the frame for us. This means we have little to do but | ||
995 | wake up anybody interested. We also set a capture_ready flag, as we may | ||
996 | capture a frame before an application needs it. In this case we need to know | ||
997 | that a frame is ready. If we had to collect the frame on the interrupt life | ||
998 | would be more complex. | ||
999 | </para> | ||
1000 | <para> | ||
1001 | The two new routines we need to supply are camera_read which returns a | ||
1002 | frame, and camera_poll which waits for a frame to become ready. | ||
1003 | </para> | ||
1004 | <programlisting> | ||
1005 | |||
1006 | |||
1007 | static int camera_poll(struct video_device *dev, | ||
1008 | struct file *file, struct poll_table *wait) | ||
1009 | { | ||
1010 | poll_wait(file, &capture_wait, wait); | ||
1011 | if(capture_read) | ||
1012 | return POLLIN|POLLRDNORM; | ||
1013 | return 0; | ||
1014 | } | ||
1015 | |||
1016 | </programlisting> | ||
1017 | <para> | ||
1018 | Our wait queue for polling is the capture_wait queue. This will cause the | ||
1019 | task to be woken up by our camera_irq routine. We check capture_read to see | ||
1020 | if there is an image present and if so report that it is readable. | ||
1021 | </para> | ||
1022 | </sect1> | ||
1023 | <sect1 id="rdvid"> | ||
1024 | <title>Reading The Video Image</title> | ||
1025 | <programlisting> | ||
1026 | |||
1027 | |||
1028 | static long camera_read(struct video_device *dev, char *buf, | ||
1029 | unsigned long count) | ||
1030 | { | ||
1031 | struct wait_queue wait = { current, NULL }; | ||
1032 | u8 *ptr; | ||
1033 | int len; | ||
1034 | int i; | ||
1035 | |||
1036 | add_wait_queue(&capture_wait, &wait); | ||
1037 | |||
1038 | while(!capture_ready) | ||
1039 | { | ||
1040 | if(file->flags&O_NDELAY) | ||
1041 | { | ||
1042 | remove_wait_queue(&capture_wait, &wait); | ||
1043 | current->state = TASK_RUNNING; | ||
1044 | return -EWOULDBLOCK; | ||
1045 | } | ||
1046 | if(signal_pending(current)) | ||
1047 | { | ||
1048 | remove_wait_queue(&capture_wait, &wait); | ||
1049 | current->state = TASK_RUNNING; | ||
1050 | return -ERESTARTSYS; | ||
1051 | } | ||
1052 | schedule(); | ||
1053 | current->state = TASK_INTERRUPTIBLE; | ||
1054 | } | ||
1055 | remove_wait_queue(&capture_wait, &wait); | ||
1056 | current->state = TASK_RUNNING; | ||
1057 | |||
1058 | </programlisting> | ||
1059 | <para> | ||
1060 | The first thing we have to do is to ensure that the application waits until | ||
1061 | the next frame is ready. The code here is almost identical to the mouse code | ||
1062 | we used earlier in this chapter. It is one of the common building blocks of | ||
1063 | Linux device driver code and probably one which you will find occurs in any | ||
1064 | drivers you write. | ||
1065 | </para> | ||
1066 | <para> | ||
1067 | We wait for a frame to be ready, or for a signal to interrupt our waiting. If a | ||
1068 | signal occurs we need to return from the system call so that the signal can | ||
1069 | be sent to the application itself. We also check to see if the user actually | ||
1070 | wanted to avoid waiting - ie if they are using non-blocking I/O and have other things | ||
1071 | to get on with. | ||
1072 | </para> | ||
1073 | <para> | ||
1074 | Next we copy the data from the card to the user application. This is rarely | ||
1075 | as easy as our example makes out. We will add capture_w, and capture_h here | ||
1076 | to hold the width and height of the captured image. We assume the card only | ||
1077 | supports 24bit RGB for now. | ||
1078 | </para> | ||
1079 | <programlisting> | ||
1080 | |||
1081 | |||
1082 | |||
1083 | capture_ready = 0; | ||
1084 | |||
1085 | ptr=(u8 *)buf; | ||
1086 | len = capture_w * 3 * capture_h; /* 24bit RGB */ | ||
1087 | |||
1088 | if(len>count) | ||
1089 | len=count; /* Doesn't all fit */ | ||
1090 | |||
1091 | for(i=0; i<len; i++) | ||
1092 | { | ||
1093 | put_user(inb(io+IMAGE_DATA), ptr); | ||
1094 | ptr++; | ||
1095 | } | ||
1096 | |||
1097 | hardware_restart_capture(); | ||
1098 | |||
1099 | return i; | ||
1100 | } | ||
1101 | |||
1102 | </programlisting> | ||
1103 | <para> | ||
1104 | For a real hardware device you would try to avoid the loop with put_user(). | ||
1105 | Each call to put_user() has a time overhead checking whether the accesses to user | ||
1106 | space are allowed. It would be better to read a line into a temporary buffer | ||
1107 | then copy this to user space in one go. | ||
1108 | </para> | ||
1109 | <para> | ||
1110 | Having captured the image and put it into user space we can kick the card to | ||
1111 | get the next frame acquired. | ||
1112 | </para> | ||
1113 | </sect1> | ||
1114 | <sect1 id="iocvid"> | ||
1115 | <title>Video Ioctl Handling</title> | ||
1116 | <para> | ||
1117 | As with the radio driver the major control interface is via the ioctl() | ||
1118 | function. Video capture devices support the same tuner calls as a radio | ||
1119 | device and also support additional calls to control how the video functions | ||
1120 | are handled. In this simple example the card has no tuners to avoid making | ||
1121 | the code complex. | ||
1122 | </para> | ||
1123 | <programlisting> | ||
1124 | |||
1125 | |||
1126 | |||
1127 | static int camera_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | ||
1128 | { | ||
1129 | switch(cmd) | ||
1130 | { | ||
1131 | case VIDIOCGCAP: | ||
1132 | { | ||
1133 | struct video_capability v; | ||
1134 | v.type = VID_TYPE_CAPTURE|\ | ||
1135 | VID_TYPE_CHROMAKEY|\ | ||
1136 | VID_TYPE_SCALES|\ | ||
1137 | VID_TYPE_OVERLAY; | ||
1138 | v.channels = 1; | ||
1139 | v.audios = 0; | ||
1140 | v.maxwidth = 640; | ||
1141 | v.minwidth = 16; | ||
1142 | v.maxheight = 480; | ||
1143 | v.minheight = 16; | ||
1144 | strcpy(v.name, "My Camera"); | ||
1145 | if(copy_to_user(arg, &v, sizeof(v))) | ||
1146 | return -EFAULT; | ||
1147 | return 0; | ||
1148 | } | ||
1149 | |||
1150 | |||
1151 | </programlisting> | ||
1152 | <para> | ||
1153 | The first ioctl we must support and which all video capture and radio | ||
1154 | devices are required to support is VIDIOCGCAP. This behaves exactly the same | ||
1155 | as with a radio device. This time, however, we report the extra capabilities | ||
1156 | we outlined earlier on when defining our video_dev structure. | ||
1157 | </para> | ||
1158 | <para> | ||
1159 | We now set the video flags saying that we support overlay, capture, | ||
1160 | scaling and chromakey. We also report size limits - our smallest image is | ||
1161 | 16x16 pixels, our largest is 640x480. | ||
1162 | </para> | ||
1163 | <para> | ||
1164 | To keep things simple we report no audio and no tuning capabilities at all. | ||
1165 | </para> | ||
1166 | <programlisting> | ||
1167 | |||
1168 | case VIDIOCGCHAN: | ||
1169 | { | ||
1170 | struct video_channel v; | ||
1171 | if(copy_from_user(&v, arg, sizeof(v))) | ||
1172 | return -EFAULT; | ||
1173 | if(v.channel != 0) | ||
1174 | return -EINVAL; | ||
1175 | v.flags = 0; | ||
1176 | v.tuners = 0; | ||
1177 | v.type = VIDEO_TYPE_CAMERA; | ||
1178 | v.norm = VIDEO_MODE_AUTO; | ||
1179 | strcpy(v.name, "Camera Input");break; | ||
1180 | if(copy_to_user(&v, arg, sizeof(v))) | ||
1181 | return -EFAULT; | ||
1182 | return 0; | ||
1183 | } | ||
1184 | |||
1185 | |||
1186 | </programlisting> | ||
1187 | <para> | ||
1188 | This follows what is very much the standard way an ioctl handler looks | ||
1189 | in Linux. We copy the data into a kernel space variable and we check that the | ||
1190 | request is valid (in this case that the input is 0). Finally we copy the | ||
1191 | camera info back to the user. | ||
1192 | </para> | ||
1193 | <para> | ||
1194 | The VIDIOCGCHAN ioctl allows a user to ask about video channels (that is | ||
1195 | inputs to the video card). Our example card has a single camera input. The | ||
1196 | fields in the structure are | ||
1197 | </para> | ||
1198 | <table frame="all" id="video_channel_fields"><title>struct video_channel fields</title> | ||
1199 | <tgroup cols="2" align="left"> | ||
1200 | <tbody> | ||
1201 | <row> | ||
1202 | |||
1203 | <entry>channel</entry><entry>The channel number we are selecting</entry> | ||
1204 | </row><row> | ||
1205 | <entry>name</entry><entry>The name for this channel. This is intended | ||
1206 | to describe the port to the user. | ||
1207 | Appropriate names are therefore things like | ||
1208 | "Camera" "SCART input"</entry> | ||
1209 | </row><row> | ||
1210 | <entry>flags</entry><entry>Channel properties</entry> | ||
1211 | </row><row> | ||
1212 | <entry>type</entry><entry>Input type</entry> | ||
1213 | </row><row> | ||
1214 | <entry>norm</entry><entry>The current television encoding being used | ||
1215 | if relevant for this channel. | ||
1216 | </entry> | ||
1217 | </row> | ||
1218 | </tbody> | ||
1219 | </tgroup> | ||
1220 | </table> | ||
1221 | <table frame="all" id="video_channel_flags"><title>struct video_channel flags</title> | ||
1222 | <tgroup cols="2" align="left"> | ||
1223 | <tbody> | ||
1224 | <row> | ||
1225 | <entry>VIDEO_VC_TUNER</entry><entry>Channel has a tuner.</entry> | ||
1226 | </row><row> | ||
1227 | <entry>VIDEO_VC_AUDIO</entry><entry>Channel has audio.</entry> | ||
1228 | </row> | ||
1229 | </tbody> | ||
1230 | </tgroup> | ||
1231 | </table> | ||
1232 | <table frame="all" id="video_channel_types"><title>struct video_channel types</title> | ||
1233 | <tgroup cols="2" align="left"> | ||
1234 | <tbody> | ||
1235 | <row> | ||
1236 | <entry>VIDEO_TYPE_TV</entry><entry>Television input.</entry> | ||
1237 | </row><row> | ||
1238 | <entry>VIDEO_TYPE_CAMERA</entry><entry>Fixed camera input.</entry> | ||
1239 | </row><row> | ||
1240 | <entry>0</entry><entry>Type is unknown.</entry> | ||
1241 | </row> | ||
1242 | </tbody> | ||
1243 | </tgroup> | ||
1244 | </table> | ||
1245 | <table frame="all" id="video_channel_norms"><title>struct video_channel norms</title> | ||
1246 | <tgroup cols="2" align="left"> | ||
1247 | <tbody> | ||
1248 | <row> | ||
1249 | <entry>VIDEO_MODE_PAL</entry><entry>PAL encoded Television</entry> | ||
1250 | </row><row> | ||
1251 | <entry>VIDEO_MODE_NTSC</entry><entry>NTSC (US) encoded Television</entry> | ||
1252 | </row><row> | ||
1253 | <entry>VIDEO_MODE_SECAM</entry><entry>SECAM (French) Television </entry> | ||
1254 | </row><row> | ||
1255 | <entry>VIDEO_MODE_AUTO</entry><entry>Automatic switching, or format does not | ||
1256 | matter</entry> | ||
1257 | </row> | ||
1258 | </tbody> | ||
1259 | </tgroup> | ||
1260 | </table> | ||
1261 | <para> | ||
1262 | The corresponding VIDIOCSCHAN ioctl allows a user to change channel and to | ||
1263 | request the norm is changed - for example to switch between a PAL or an NTSC | ||
1264 | format camera. | ||
1265 | </para> | ||
1266 | <programlisting> | ||
1267 | |||
1268 | |||
1269 | case VIDIOCSCHAN: | ||
1270 | { | ||
1271 | struct video_channel v; | ||
1272 | if(copy_from_user(&v, arg, sizeof(v))) | ||
1273 | return -EFAULT; | ||
1274 | if(v.channel != 0) | ||
1275 | return -EINVAL; | ||
1276 | if(v.norm != VIDEO_MODE_AUTO) | ||
1277 | return -EINVAL; | ||
1278 | return 0; | ||
1279 | } | ||
1280 | |||
1281 | |||
1282 | </programlisting> | ||
1283 | <para> | ||
1284 | The implementation of this call in our driver is remarkably easy. Because we | ||
1285 | are assuming fixed format hardware we need only check that the user has not | ||
1286 | tried to change anything. | ||
1287 | </para> | ||
1288 | <para> | ||
1289 | The user also needs to be able to configure and adjust the picture they are | ||
1290 | seeing. This is much like adjusting a television set. A user application | ||
1291 | also needs to know the palette being used so that it knows how to display | ||
1292 | the image that has been captured. The VIDIOCGPICT and VIDIOCSPICT ioctl | ||
1293 | calls provide this information. | ||
1294 | </para> | ||
1295 | <programlisting> | ||
1296 | |||
1297 | |||
1298 | case VIDIOCGPICT | ||
1299 | { | ||
1300 | struct video_picture v; | ||
1301 | v.brightness = hardware_brightness(); | ||
1302 | v.hue = hardware_hue(); | ||
1303 | v.colour = hardware_saturation(); | ||
1304 | v.contrast = hardware_brightness(); | ||
1305 | /* Not settable */ | ||
1306 | v.whiteness = 32768; | ||
1307 | v.depth = 24; /* 24bit */ | ||
1308 | v.palette = VIDEO_PALETTE_RGB24; | ||
1309 | if(copy_to_user(&v, arg, | ||
1310 | sizeof(v))) | ||
1311 | return -EFAULT; | ||
1312 | return 0; | ||
1313 | } | ||
1314 | |||
1315 | |||
1316 | </programlisting> | ||
1317 | <para> | ||
1318 | The brightness, hue, color, and contrast provide the picture controls that | ||
1319 | are akin to a conventional television. Whiteness provides additional | ||
1320 | control for greyscale images. All of these values are scaled between 0-65535 | ||
1321 | and have 32768 as the mid point setting. The scaling means that applications | ||
1322 | do not have to worry about the capability range of the hardware but can let | ||
1323 | it make a best effort attempt. | ||
1324 | </para> | ||
1325 | <para> | ||
1326 | Our depth is 24, as this is in bits. We will be returning RGB24 format. This | ||
1327 | has one byte of red, then one of green, then one of blue. This then repeats | ||
1328 | for every other pixel in the image. The other common formats the interface | ||
1329 | defines are | ||
1330 | </para> | ||
1331 | <table frame="all" id="Framebuffer_Encodings"><title>Framebuffer Encodings</title> | ||
1332 | <tgroup cols="2" align="left"> | ||
1333 | <tbody> | ||
1334 | <row> | ||
1335 | <entry>GREY</entry><entry>Linear greyscale. This is for simple cameras and the | ||
1336 | like</entry> | ||
1337 | </row><row> | ||
1338 | <entry>RGB565</entry><entry>The top 5 bits hold 32 red levels, the next six bits | ||
1339 | hold green and the low 5 bits hold blue. </entry> | ||
1340 | </row><row> | ||
1341 | <entry>RGB555</entry><entry>The top bit is clear. The red green and blue levels | ||
1342 | each occupy five bits.</entry> | ||
1343 | </row> | ||
1344 | </tbody> | ||
1345 | </tgroup> | ||
1346 | </table> | ||
1347 | <para> | ||
1348 | Additional modes are support for YUV capture formats. These are common for | ||
1349 | TV and video conferencing applications. | ||
1350 | </para> | ||
1351 | <para> | ||
1352 | The VIDIOCSPICT ioctl allows a user to set some of the picture parameters. | ||
1353 | Exactly which ones are supported depends heavily on the card itself. It is | ||
1354 | possible to support many modes and effects in software. In general doing | ||
1355 | this in the kernel is a bad idea. Video capture is a performance-sensitive | ||
1356 | application and the programs can often do better if they aren't being | ||
1357 | 'helped' by an overkeen driver writer. Thus for our device we will report | ||
1358 | RGB24 only and refuse to allow a change. | ||
1359 | </para> | ||
1360 | <programlisting> | ||
1361 | |||
1362 | |||
1363 | case VIDIOCSPICT: | ||
1364 | { | ||
1365 | struct video_picture v; | ||
1366 | if(copy_from_user(&v, arg, sizeof(v))) | ||
1367 | return -EFAULT; | ||
1368 | if(v.depth!=24 || | ||
1369 | v.palette != VIDEO_PALETTE_RGB24) | ||
1370 | return -EINVAL; | ||
1371 | set_hardware_brightness(v.brightness); | ||
1372 | set_hardware_hue(v.hue); | ||
1373 | set_hardware_saturation(v.colour); | ||
1374 | set_hardware_brightness(v.contrast); | ||
1375 | return 0; | ||
1376 | } | ||
1377 | |||
1378 | |||
1379 | </programlisting> | ||
1380 | <para> | ||
1381 | We check the user has not tried to change the palette or the depth. We do | ||
1382 | not want to carry out some of the changes and then return an error. This may | ||
1383 | confuse the application which will be assuming no change occurred. | ||
1384 | </para> | ||
1385 | <para> | ||
1386 | In much the same way as you need to be able to set the picture controls to | ||
1387 | get the right capture images, many cards need to know what they are | ||
1388 | displaying onto when generating overlay output. In some cases getting this | ||
1389 | wrong even makes a nasty mess or may crash the computer. For that reason | ||
1390 | the VIDIOCSBUF ioctl used to set up the frame buffer information may well | ||
1391 | only be usable by root. | ||
1392 | </para> | ||
1393 | <para> | ||
1394 | We will assume our card is one of the old ISA devices with feature connector | ||
1395 | and only supports a couple of standard video modes. Very common for older | ||
1396 | cards although the PCI devices are way smarter than this. | ||
1397 | </para> | ||
1398 | <programlisting> | ||
1399 | |||
1400 | |||
1401 | static struct video_buffer capture_fb; | ||
1402 | |||
1403 | case VIDIOCGFBUF: | ||
1404 | { | ||
1405 | if(copy_to_user(arg, &capture_fb, | ||
1406 | sizeof(capture_fb))) | ||
1407 | return -EFAULT; | ||
1408 | return 0; | ||
1409 | |||
1410 | } | ||
1411 | |||
1412 | |||
1413 | </programlisting> | ||
1414 | <para> | ||
1415 | We keep the frame buffer information in the format the ioctl uses. This | ||
1416 | makes it nice and easy to work with in the ioctl calls. | ||
1417 | </para> | ||
1418 | <programlisting> | ||
1419 | |||
1420 | case VIDIOCSFBUF: | ||
1421 | { | ||
1422 | struct video_buffer v; | ||
1423 | |||
1424 | if(!capable(CAP_SYS_ADMIN)) | ||
1425 | return -EPERM; | ||
1426 | |||
1427 | if(copy_from_user(&v, arg, sizeof(v))) | ||
1428 | return -EFAULT; | ||
1429 | if(v.width!=320 && v.width!=640) | ||
1430 | return -EINVAL; | ||
1431 | if(v.height!=200 && v.height!=240 | ||
1432 | && v.height!=400 | ||
1433 | && v.height !=480) | ||
1434 | return -EINVAL; | ||
1435 | memcpy(&capture_fb, &v, sizeof(v)); | ||
1436 | hardware_set_fb(&v); | ||
1437 | return 0; | ||
1438 | } | ||
1439 | |||
1440 | |||
1441 | |||
1442 | </programlisting> | ||
1443 | <para> | ||
1444 | The capable() function checks a user has the required capability. The Linux | ||
1445 | operating system has a set of about 30 capabilities indicating privileged | ||
1446 | access to services. The default set up gives the superuser (uid 0) all of | ||
1447 | them and nobody else has any. | ||
1448 | </para> | ||
1449 | <para> | ||
1450 | We check that the user has the SYS_ADMIN capability, that is they are | ||
1451 | allowed to operate as the machine administrator. We don't want anyone but | ||
1452 | the administrator making a mess of the display. | ||
1453 | </para> | ||
1454 | <para> | ||
1455 | Next we check for standard PC video modes (320 or 640 wide with either | ||
1456 | EGA or VGA depths). If the mode is not a standard video mode we reject it as | ||
1457 | not supported by our card. If the mode is acceptable we save it so that | ||
1458 | VIDIOCFBUF will give the right answer next time it is called. The | ||
1459 | hardware_set_fb() function is some undescribed card specific function to | ||
1460 | program the card for the desired mode. | ||
1461 | </para> | ||
1462 | <para> | ||
1463 | Before the driver can display an overlay window it needs to know where the | ||
1464 | window should be placed, and also how large it should be. If the card | ||
1465 | supports clipping it needs to know which rectangles to omit from the | ||
1466 | display. The video_window structure is used to describe the way the image | ||
1467 | should be displayed. | ||
1468 | </para> | ||
1469 | <table frame="all" id="video_window_fields"><title>struct video_window fields</title> | ||
1470 | <tgroup cols="2" align="left"> | ||
1471 | <tbody> | ||
1472 | <row> | ||
1473 | <entry>width</entry><entry>The width in pixels of the desired image. The card | ||
1474 | may use a smaller size if this size is not available</entry> | ||
1475 | </row><row> | ||
1476 | <entry>height</entry><entry>The height of the image. The card may use a smaller | ||
1477 | size if this size is not available.</entry> | ||
1478 | </row><row> | ||
1479 | <entry>x</entry><entry> The X position of the top left of the window. This | ||
1480 | is in pixels relative to the left hand edge of the | ||
1481 | picture. Not all cards can display images aligned on | ||
1482 | any pixel boundary. If the position is unsuitable | ||
1483 | the card adjusts the image right and reduces the | ||
1484 | width.</entry> | ||
1485 | </row><row> | ||
1486 | <entry>y</entry><entry> The Y position of the top left of the window. This | ||
1487 | is counted in pixels relative to the top edge of the | ||
1488 | picture. As with the width if the card cannot | ||
1489 | display starting on this line it will adjust the | ||
1490 | values.</entry> | ||
1491 | </row><row> | ||
1492 | <entry>chromakey</entry><entry>The colour (expressed in RGB32 format) for the | ||
1493 | chromakey colour if chroma keying is being used. </entry> | ||
1494 | </row><row> | ||
1495 | <entry>clips</entry><entry>An array of rectangles that must not be drawn | ||
1496 | over.</entry> | ||
1497 | </row><row> | ||
1498 | <entry>clipcount</entry><entry>The number of clips in this array.</entry> | ||
1499 | </row> | ||
1500 | </tbody> | ||
1501 | </tgroup> | ||
1502 | </table> | ||
1503 | <para> | ||
1504 | Each clip is a struct video_clip which has the following fields | ||
1505 | </para> | ||
1506 | <table frame="all" id="video_clip_fields"><title>video_clip fields</title> | ||
1507 | <tgroup cols="2" align="left"> | ||
1508 | <tbody> | ||
1509 | <row> | ||
1510 | <entry>x, y</entry><entry>Co-ordinates relative to the display</entry> | ||
1511 | </row><row> | ||
1512 | <entry>width, height</entry><entry>Width and height in pixels</entry> | ||
1513 | </row><row> | ||
1514 | <entry>next</entry><entry>A spare field for the application to use</entry> | ||
1515 | </row> | ||
1516 | </tbody> | ||
1517 | </tgroup> | ||
1518 | </table> | ||
1519 | <para> | ||
1520 | The driver is required to ensure it always draws in the area requested or a smaller area, and that it never draws in any of the areas that are clipped. | ||
1521 | This may well mean it has to leave alone. small areas the application wished to be | ||
1522 | drawn. | ||
1523 | </para> | ||
1524 | <para> | ||
1525 | Our example card uses chromakey so does not have to address most of the | ||
1526 | clipping. We will add a video_window structure to our global variables to | ||
1527 | remember our parameters, as we did with the frame buffer. | ||
1528 | </para> | ||
1529 | <programlisting> | ||
1530 | |||
1531 | |||
1532 | case VIDIOCGWIN: | ||
1533 | { | ||
1534 | if(copy_to_user(arg, &capture_win, | ||
1535 | sizeof(capture_win))) | ||
1536 | return -EFAULT; | ||
1537 | return 0; | ||
1538 | } | ||
1539 | |||
1540 | |||
1541 | case VIDIOCSWIN: | ||
1542 | { | ||
1543 | struct video_window v; | ||
1544 | if(copy_from_user(&v, arg, sizeof(v))) | ||
1545 | return -EFAULT; | ||
1546 | if(v.width > 640 || v.height > 480) | ||
1547 | return -EINVAL; | ||
1548 | if(v.width < 16 || v.height < 16) | ||
1549 | return -EINVAL; | ||
1550 | hardware_set_key(v.chromakey); | ||
1551 | hardware_set_window(v); | ||
1552 | memcpy(&capture_win, &v, sizeof(v)); | ||
1553 | capture_w = v.width; | ||
1554 | capture_h = v.height; | ||
1555 | return 0; | ||
1556 | } | ||
1557 | |||
1558 | |||
1559 | </programlisting> | ||
1560 | <para> | ||
1561 | Because we are using Chromakey our setup is fairly simple. Mostly we have to | ||
1562 | check the values are sane and load them into the capture card. | ||
1563 | </para> | ||
1564 | <para> | ||
1565 | With all the setup done we can now turn on the actual capture/overlay. This | ||
1566 | is done with the VIDIOCCAPTURE ioctl. This takes a single integer argument | ||
1567 | where 0 is on and 1 is off. | ||
1568 | </para> | ||
1569 | <programlisting> | ||
1570 | |||
1571 | |||
1572 | case VIDIOCCAPTURE: | ||
1573 | { | ||
1574 | int v; | ||
1575 | if(get_user(v, (int *)arg)) | ||
1576 | return -EFAULT; | ||
1577 | if(v==0) | ||
1578 | hardware_capture_off(); | ||
1579 | else | ||
1580 | { | ||
1581 | if(capture_fb.width == 0 | ||
1582 | || capture_w == 0) | ||
1583 | return -EINVAL; | ||
1584 | hardware_capture_on(); | ||
1585 | } | ||
1586 | return 0; | ||
1587 | } | ||
1588 | |||
1589 | |||
1590 | </programlisting> | ||
1591 | <para> | ||
1592 | We grab the flag from user space and either enable or disable according to | ||
1593 | its value. There is one small corner case we have to consider here. Suppose | ||
1594 | that the capture was requested before the video window or the frame buffer | ||
1595 | had been set up. In those cases there will be unconfigured fields in our | ||
1596 | card data, as well as unconfigured hardware settings. We check for this case and | ||
1597 | return an error if the frame buffer or the capture window width is zero. | ||
1598 | </para> | ||
1599 | <programlisting> | ||
1600 | |||
1601 | |||
1602 | default: | ||
1603 | return -ENOIOCTLCMD; | ||
1604 | } | ||
1605 | } | ||
1606 | </programlisting> | ||
1607 | <para> | ||
1608 | |||
1609 | We don't need to support any other ioctls, so if we get this far, it is time | ||
1610 | to tell the video layer that we don't now what the user is talking about. | ||
1611 | </para> | ||
1612 | </sect1> | ||
1613 | <sect1 id="endvid"> | ||
1614 | <title>Other Functionality</title> | ||
1615 | <para> | ||
1616 | The Video4Linux layer supports additional features, including a high | ||
1617 | performance mmap() based capture mode and capturing part of the image. | ||
1618 | These features are out of the scope of the book. You should however have enough | ||
1619 | example code to implement most simple video4linux devices for radio and TV | ||
1620 | cards. | ||
1621 | </para> | ||
1622 | </sect1> | ||
1623 | </chapter> | ||
1624 | <chapter id="bugs"> | ||
1625 | <title>Known Bugs And Assumptions</title> | ||
1626 | <para> | ||
1627 | <variablelist> | ||
1628 | <varlistentry><term>Multiple Opens</term> | ||
1629 | <listitem> | ||
1630 | <para> | ||
1631 | The driver assumes multiple opens should not be allowed. A driver | ||
1632 | can work around this but not cleanly. | ||
1633 | </para> | ||
1634 | </listitem></varlistentry> | ||
1635 | |||
1636 | <varlistentry><term>API Deficiencies</term> | ||
1637 | <listitem> | ||
1638 | <para> | ||
1639 | The existing API poorly reflects compression capable devices. There | ||
1640 | are plans afoot to merge V4L, V4L2 and some other ideas into a | ||
1641 | better interface. | ||
1642 | </para> | ||
1643 | </listitem></varlistentry> | ||
1644 | </variablelist> | ||
1645 | |||
1646 | </para> | ||
1647 | </chapter> | ||
1648 | |||
1649 | <chapter id="pubfunctions"> | ||
1650 | <title>Public Functions Provided</title> | ||
1651 | !Edrivers/media/video/v4l2-dev.c | ||
1652 | </chapter> | ||
1653 | |||
1654 | </book> | ||
diff --git a/Documentation/HOWTO b/Documentation/HOWTO index 48a3955f05f..8495fc97039 100644 --- a/Documentation/HOWTO +++ b/Documentation/HOWTO | |||
@@ -112,7 +112,7 @@ required reading: | |||
112 | 112 | ||
113 | Other excellent descriptions of how to create patches properly are: | 113 | Other excellent descriptions of how to create patches properly are: |
114 | "The Perfect Patch" | 114 | "The Perfect Patch" |
115 | http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt | 115 | http://userweb.kernel.org/~akpm/stuff/tpp.txt |
116 | "Linux kernel patch submission format" | 116 | "Linux kernel patch submission format" |
117 | http://linux.yyz.us/patch-format.html | 117 | http://linux.yyz.us/patch-format.html |
118 | 118 | ||
@@ -620,7 +620,7 @@ all time. It should describe the patch completely, containing: | |||
620 | For more details on what this should all look like, please see the | 620 | For more details on what this should all look like, please see the |
621 | ChangeLog section of the document: | 621 | ChangeLog section of the document: |
622 | "The Perfect Patch" | 622 | "The Perfect Patch" |
623 | http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt | 623 | http://userweb.kernel.org/~akpm/stuff/tpp.txt |
624 | 624 | ||
625 | 625 | ||
626 | 626 | ||
diff --git a/Documentation/SAK.txt b/Documentation/SAK.txt index b9019ca872e..74be14679ed 100644 --- a/Documentation/SAK.txt +++ b/Documentation/SAK.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | Linux 2.4.2 Secure Attention Key (SAK) handling | 1 | Linux 2.4.2 Secure Attention Key (SAK) handling |
2 | 18 March 2001, Andrew Morton <akpm@osdl.org> | 2 | 18 March 2001, Andrew Morton |
3 | 3 | ||
4 | An operating system's Secure Attention Key is a security tool which is | 4 | An operating system's Secure Attention Key is a security tool which is |
5 | provided as protection against trojan password capturing programs. It | 5 | provided as protection against trojan password capturing programs. It |
diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist index 21f0795af20..ac5e0b2f109 100644 --- a/Documentation/SubmitChecklist +++ b/Documentation/SubmitChecklist | |||
@@ -85,3 +85,6 @@ kernel patches. | |||
85 | 23: Tested after it has been merged into the -mm patchset to make sure | 85 | 23: Tested after it has been merged into the -mm patchset to make sure |
86 | that it still works with all of the other queued patches and various | 86 | that it still works with all of the other queued patches and various |
87 | changes in the VM, VFS, and other subsystems. | 87 | changes in the VM, VFS, and other subsystems. |
88 | |||
89 | 24: All memory barriers {e.g., barrier(), rmb(), wmb()} need a comment in the | ||
90 | source code that explains the logic of what they are doing and why. | ||
diff --git a/Documentation/SubmittingDrivers b/Documentation/SubmittingDrivers index 24f2eb40cae..99e72a81fa2 100644 --- a/Documentation/SubmittingDrivers +++ b/Documentation/SubmittingDrivers | |||
@@ -41,7 +41,7 @@ Linux 2.4: | |||
41 | Linux 2.6: | 41 | Linux 2.6: |
42 | The same rules apply as 2.4 except that you should follow linux-kernel | 42 | The same rules apply as 2.4 except that you should follow linux-kernel |
43 | to track changes in API's. The final contact point for Linux 2.6 | 43 | to track changes in API's. The final contact point for Linux 2.6 |
44 | submissions is Andrew Morton <akpm@osdl.org>. | 44 | submissions is Andrew Morton. |
45 | 45 | ||
46 | What Criteria Determine Acceptance | 46 | What Criteria Determine Acceptance |
47 | ---------------------------------- | 47 | ---------------------------------- |
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index f79ad9ff603..f309d3c6221 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches | |||
@@ -77,7 +77,7 @@ Quilt: | |||
77 | http://savannah.nongnu.org/projects/quilt | 77 | http://savannah.nongnu.org/projects/quilt |
78 | 78 | ||
79 | Andrew Morton's patch scripts: | 79 | Andrew Morton's patch scripts: |
80 | http://www.zip.com.au/~akpm/linux/patches/ | 80 | http://userweb.kernel.org/~akpm/stuff/patch-scripts.tar.gz |
81 | Instead of these scripts, quilt is the recommended patch management | 81 | Instead of these scripts, quilt is the recommended patch management |
82 | tool (see above). | 82 | tool (see above). |
83 | 83 | ||
@@ -405,7 +405,7 @@ person it names. This tag documents that potentially interested parties | |||
405 | have been included in the discussion | 405 | have been included in the discussion |
406 | 406 | ||
407 | 407 | ||
408 | 14) Using Test-by: and Reviewed-by: | 408 | 14) Using Tested-by: and Reviewed-by: |
409 | 409 | ||
410 | A Tested-by: tag indicates that the patch has been successfully tested (in | 410 | A Tested-by: tag indicates that the patch has been successfully tested (in |
411 | some environment) by the person named. This tag informs maintainers that | 411 | some environment) by the person named. This tag informs maintainers that |
@@ -653,7 +653,7 @@ SECTION 3 - REFERENCES | |||
653 | ---------------------- | 653 | ---------------------- |
654 | 654 | ||
655 | Andrew Morton, "The perfect patch" (tpp). | 655 | Andrew Morton, "The perfect patch" (tpp). |
656 | <http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt> | 656 | <http://userweb.kernel.org/~akpm/stuff/tpp.txt> |
657 | 657 | ||
658 | Jeff Garzik, "Linux kernel patch submission format". | 658 | Jeff Garzik, "Linux kernel patch submission format". |
659 | <http://linux.yyz.us/patch-format.html> | 659 | <http://linux.yyz.us/patch-format.html> |
@@ -672,4 +672,9 @@ Kernel Documentation/CodingStyle: | |||
672 | 672 | ||
673 | Linus Torvalds's mail on the canonical patch format: | 673 | Linus Torvalds's mail on the canonical patch format: |
674 | <http://lkml.org/lkml/2005/4/7/183> | 674 | <http://lkml.org/lkml/2005/4/7/183> |
675 | |||
676 | Andi Kleen, "On submitting kernel patches" | ||
677 | Some strategies to get difficult or controversal changes in. | ||
678 | http://halobates.de/on-submitting-patches.pdf | ||
679 | |||
675 | -- | 680 | -- |
diff --git a/Documentation/blackfin/kgdb.txt b/Documentation/blackfin/kgdb.txt deleted file mode 100644 index 84f6a484ae9..00000000000 --- a/Documentation/blackfin/kgdb.txt +++ /dev/null | |||
@@ -1,155 +0,0 @@ | |||
1 | A Simple Guide to Configure KGDB | ||
2 | |||
3 | Sonic Zhang <sonic.zhang@analog.com> | ||
4 | Aug. 24th 2006 | ||
5 | |||
6 | |||
7 | This KGDB patch enables the kernel developer to do source level debugging on | ||
8 | the kernel for the Blackfin architecture. The debugging works over either the | ||
9 | ethernet interface or one of the uarts. Both software breakpoints and | ||
10 | hardware breakpoints are supported in this version. | ||
11 | http://docs.blackfin.uclinux.org/doku.php?id=kgdb | ||
12 | |||
13 | |||
14 | 2 known issues: | ||
15 | 1. This bug: | ||
16 | http://blackfin.uclinux.org/tracker/index.php?func=detail&aid=544&group_id=18&atid=145 | ||
17 | The GDB client for Blackfin uClinux causes incorrect values of local | ||
18 | variables to be displayed when the user breaks the running of kernel in GDB. | ||
19 | 2. Because of a hardware bug in Blackfin 533 v1.0.3: | ||
20 | 05000067 - Watchpoints (Hardware Breakpoints) are not supported | ||
21 | Hardware breakpoints cannot be set properly. | ||
22 | |||
23 | |||
24 | Debug over Ethernet: | ||
25 | |||
26 | 1. Compile and install the cross platform version of gdb for blackfin, which | ||
27 | can be found at $(BINROOT)/bfin-elf-gdb. | ||
28 | |||
29 | 2. Apply this patch to the 2.6.x kernel. Select the menuconfig option under | ||
30 | "Kernel hacking" -> "Kernel debugging" -> "KGDB: kernel debug with remote gdb". | ||
31 | With this selected, option "Full Symbolic/Source Debugging support" and | ||
32 | "Compile the kernel with frame pointers" are also selected. | ||
33 | |||
34 | 3. Select option "KGDB: connect over (Ethernet)". Add "kgdboe=@target-IP/,@host-IP/" to | ||
35 | the option "Compiled-in Kernel Boot Parameter" under "Kernel hacking". | ||
36 | |||
37 | 4. Connect minicom to the serial port and boot the kernel image. | ||
38 | |||
39 | 5. Configure the IP "/> ifconfig eth0 target-IP" | ||
40 | |||
41 | 6. Start GDB client "bfin-elf-gdb vmlinux". | ||
42 | |||
43 | 7. Connect to the target "(gdb) target remote udp:target-IP:6443". | ||
44 | |||
45 | 8. Set software breakpoint "(gdb) break sys_open". | ||
46 | |||
47 | 9. Continue "(gdb) c". | ||
48 | |||
49 | 10. Run ls in the target console "/> ls". | ||
50 | |||
51 | 11. Breakpoint hits. "Breakpoint 1: sys_open(..." | ||
52 | |||
53 | 12. Display local variables and function paramters. | ||
54 | (*) This operation gives wrong results, see known issue 1. | ||
55 | |||
56 | 13. Single stepping "(gdb) si". | ||
57 | |||
58 | 14. Remove breakpoint 1. "(gdb) del 1" | ||
59 | |||
60 | 15. Set hardware breakpoint "(gdb) hbreak sys_open". | ||
61 | |||
62 | 16. Continue "(gdb) c". | ||
63 | |||
64 | 17. Run ls in the target console "/> ls". | ||
65 | |||
66 | 18. Hardware breakpoint hits. "Breakpoint 1: sys_open(...". | ||
67 | (*) This hardware breakpoint will not be hit, see known issue 2. | ||
68 | |||
69 | 19. Continue "(gdb) c". | ||
70 | |||
71 | 20. Interrupt the target in GDB "Ctrl+C". | ||
72 | |||
73 | 21. Detach from the target "(gdb) detach". | ||
74 | |||
75 | 22. Exit GDB "(gdb) quit". | ||
76 | |||
77 | |||
78 | Debug over the UART: | ||
79 | |||
80 | 1. Compile and install the cross platform version of gdb for blackfin, which | ||
81 | can be found at $(BINROOT)/bfin-elf-gdb. | ||
82 | |||
83 | 2. Apply this patch to the 2.6.x kernel. Select the menuconfig option under | ||
84 | "Kernel hacking" -> "Kernel debugging" -> "KGDB: kernel debug with remote gdb". | ||
85 | With this selected, option "Full Symbolic/Source Debugging support" and | ||
86 | "Compile the kernel with frame pointers" are also selected. | ||
87 | |||
88 | 3. Select option "KGDB: connect over (UART)". Set "KGDB: UART port number" to be | ||
89 | a different one from the console. Don't forget to change the mode of | ||
90 | blackfin serial driver to PIO. Otherwise kgdb works incorrectly on UART. | ||
91 | |||
92 | 4. If you want connect to kgdb when the kernel boots, enable | ||
93 | "KGDB: Wait for gdb connection early" | ||
94 | |||
95 | 5. Compile kernel. | ||
96 | |||
97 | 6. Connect minicom to the serial port of the console and boot the kernel image. | ||
98 | |||
99 | 7. Start GDB client "bfin-elf-gdb vmlinux". | ||
100 | |||
101 | 8. Set the baud rate in GDB "(gdb) set remotebaud 57600". | ||
102 | |||
103 | 9. Connect to the target on the second serial port "(gdb) target remote /dev/ttyS1". | ||
104 | |||
105 | 10. Set software breakpoint "(gdb) break sys_open". | ||
106 | |||
107 | 11. Continue "(gdb) c". | ||
108 | |||
109 | 12. Run ls in the target console "/> ls". | ||
110 | |||
111 | 13. A breakpoint is hit. "Breakpoint 1: sys_open(..." | ||
112 | |||
113 | 14. All other operations are the same as that in KGDB over Ethernet. | ||
114 | |||
115 | |||
116 | Debug over the same UART as console: | ||
117 | |||
118 | 1. Compile and install the cross platform version of gdb for blackfin, which | ||
119 | can be found at $(BINROOT)/bfin-elf-gdb. | ||
120 | |||
121 | 2. Apply this patch to the 2.6.x kernel. Select the menuconfig option under | ||
122 | "Kernel hacking" -> "Kernel debugging" -> "KGDB: kernel debug with remote gdb". | ||
123 | With this selected, option "Full Symbolic/Source Debugging support" and | ||
124 | "Compile the kernel with frame pointers" are also selected. | ||
125 | |||
126 | 3. Select option "KGDB: connect over UART". Set "KGDB: UART port number" to console. | ||
127 | Don't forget to change the mode of blackfin serial driver to PIO. | ||
128 | Otherwise kgdb works incorrectly on UART. | ||
129 | |||
130 | 4. If you want connect to kgdb when the kernel boots, enable | ||
131 | "KGDB: Wait for gdb connection early" | ||
132 | |||
133 | 5. Connect minicom to the serial port and boot the kernel image. | ||
134 | |||
135 | 6. (Optional) Ask target to wait for gdb connection by entering Ctrl+A. In minicom, you should enter Ctrl+A+A. | ||
136 | |||
137 | 7. Start GDB client "bfin-elf-gdb vmlinux". | ||
138 | |||
139 | 8. Set the baud rate in GDB "(gdb) set remotebaud 57600". | ||
140 | |||
141 | 9. Connect to the target "(gdb) target remote /dev/ttyS0". | ||
142 | |||
143 | 10. Set software breakpoint "(gdb) break sys_open". | ||
144 | |||
145 | 11. Continue "(gdb) c". Then enter Ctrl+C twice to stop GDB connection. | ||
146 | |||
147 | 12. Run ls in the target console "/> ls". Dummy string can be seen on the console. | ||
148 | |||
149 | 13. Then connect the gdb to target again. "(gdb) target remote /dev/ttyS0". | ||
150 | Now you will find a breakpoint is hit. "Breakpoint 1: sys_open(..." | ||
151 | |||
152 | 14. All other operations are the same as that in KGDB over Ethernet. The only | ||
153 | difference is that after continue command in GDB, please stop GDB | ||
154 | connection by 2 "Ctrl+C"s and connect again after breakpoints are hit or | ||
155 | Ctrl+A is entered. | ||
diff --git a/Documentation/block/data-integrity.txt b/Documentation/block/data-integrity.txt index e9dc8d86adc..e8ca040ba2c 100644 --- a/Documentation/block/data-integrity.txt +++ b/Documentation/block/data-integrity.txt | |||
@@ -246,7 +246,7 @@ will require extra work due to the application tag. | |||
246 | retrieve the tag buffer using bio_integrity_get_tag(). | 246 | retrieve the tag buffer using bio_integrity_get_tag(). |
247 | 247 | ||
248 | 248 | ||
249 | 6.3 PASSING EXISTING INTEGRITY METADATA | 249 | 5.3 PASSING EXISTING INTEGRITY METADATA |
250 | 250 | ||
251 | Filesystems that either generate their own integrity metadata or | 251 | Filesystems that either generate their own integrity metadata or |
252 | are capable of transferring IMD from user space can use the | 252 | are capable of transferring IMD from user space can use the |
@@ -283,7 +283,7 @@ will require extra work due to the application tag. | |||
283 | integrity upon completion. | 283 | integrity upon completion. |
284 | 284 | ||
285 | 285 | ||
286 | 6.4 REGISTERING A BLOCK DEVICE AS CAPABLE OF EXCHANGING INTEGRITY | 286 | 5.4 REGISTERING A BLOCK DEVICE AS CAPABLE OF EXCHANGING INTEGRITY |
287 | METADATA | 287 | METADATA |
288 | 288 | ||
289 | To enable integrity exchange on a block device the gendisk must be | 289 | To enable integrity exchange on a block device the gendisk must be |
diff --git a/Documentation/cgroups.txt b/Documentation/cgroups/cgroups.txt index d9014aa0eb6..d9014aa0eb6 100644 --- a/Documentation/cgroups.txt +++ b/Documentation/cgroups/cgroups.txt | |||
diff --git a/Documentation/cgroups/freezer-subsystem.txt b/Documentation/cgroups/freezer-subsystem.txt new file mode 100644 index 00000000000..c50ab58b72e --- /dev/null +++ b/Documentation/cgroups/freezer-subsystem.txt | |||
@@ -0,0 +1,99 @@ | |||
1 | The cgroup freezer is useful to batch job management system which start | ||
2 | and stop sets of tasks in order to schedule the resources of a machine | ||
3 | according to the desires of a system administrator. This sort of program | ||
4 | is often used on HPC clusters to schedule access to the cluster as a | ||
5 | whole. The cgroup freezer uses cgroups to describe the set of tasks to | ||
6 | be started/stopped by the batch job management system. It also provides | ||
7 | a means to start and stop the tasks composing the job. | ||
8 | |||
9 | The cgroup freezer will also be useful for checkpointing running groups | ||
10 | of tasks. The freezer allows the checkpoint code to obtain a consistent | ||
11 | image of the tasks by attempting to force the tasks in a cgroup into a | ||
12 | quiescent state. Once the tasks are quiescent another task can | ||
13 | walk /proc or invoke a kernel interface to gather information about the | ||
14 | quiesced tasks. Checkpointed tasks can be restarted later should a | ||
15 | recoverable error occur. This also allows the checkpointed tasks to be | ||
16 | migrated between nodes in a cluster by copying the gathered information | ||
17 | to another node and restarting the tasks there. | ||
18 | |||
19 | Sequences of SIGSTOP and SIGCONT are not always sufficient for stopping | ||
20 | and resuming tasks in userspace. Both of these signals are observable | ||
21 | from within the tasks we wish to freeze. While SIGSTOP cannot be caught, | ||
22 | blocked, or ignored it can be seen by waiting or ptracing parent tasks. | ||
23 | SIGCONT is especially unsuitable since it can be caught by the task. Any | ||
24 | programs designed to watch for SIGSTOP and SIGCONT could be broken by | ||
25 | attempting to use SIGSTOP and SIGCONT to stop and resume tasks. We can | ||
26 | demonstrate this problem using nested bash shells: | ||
27 | |||
28 | $ echo $$ | ||
29 | 16644 | ||
30 | $ bash | ||
31 | $ echo $$ | ||
32 | 16690 | ||
33 | |||
34 | From a second, unrelated bash shell: | ||
35 | $ kill -SIGSTOP 16690 | ||
36 | $ kill -SIGCONT 16990 | ||
37 | |||
38 | <at this point 16990 exits and causes 16644 to exit too> | ||
39 | |||
40 | This happens because bash can observe both signals and choose how it | ||
41 | responds to them. | ||
42 | |||
43 | Another example of a program which catches and responds to these | ||
44 | signals is gdb. In fact any program designed to use ptrace is likely to | ||
45 | have a problem with this method of stopping and resuming tasks. | ||
46 | |||
47 | In contrast, the cgroup freezer uses the kernel freezer code to | ||
48 | prevent the freeze/unfreeze cycle from becoming visible to the tasks | ||
49 | being frozen. This allows the bash example above and gdb to run as | ||
50 | expected. | ||
51 | |||
52 | The freezer subsystem in the container filesystem defines a file named | ||
53 | freezer.state. Writing "FROZEN" to the state file will freeze all tasks in the | ||
54 | cgroup. Subsequently writing "THAWED" will unfreeze the tasks in the cgroup. | ||
55 | Reading will return the current state. | ||
56 | |||
57 | * Examples of usage : | ||
58 | |||
59 | # mkdir /containers/freezer | ||
60 | # mount -t cgroup -ofreezer freezer /containers | ||
61 | # mkdir /containers/0 | ||
62 | # echo $some_pid > /containers/0/tasks | ||
63 | |||
64 | to get status of the freezer subsystem : | ||
65 | |||
66 | # cat /containers/0/freezer.state | ||
67 | THAWED | ||
68 | |||
69 | to freeze all tasks in the container : | ||
70 | |||
71 | # echo FROZEN > /containers/0/freezer.state | ||
72 | # cat /containers/0/freezer.state | ||
73 | FREEZING | ||
74 | # cat /containers/0/freezer.state | ||
75 | FROZEN | ||
76 | |||
77 | to unfreeze all tasks in the container : | ||
78 | |||
79 | # echo THAWED > /containers/0/freezer.state | ||
80 | # cat /containers/0/freezer.state | ||
81 | THAWED | ||
82 | |||
83 | This is the basic mechanism which should do the right thing for user space task | ||
84 | in a simple scenario. | ||
85 | |||
86 | It's important to note that freezing can be incomplete. In that case we return | ||
87 | EBUSY. This means that some tasks in the cgroup are busy doing something that | ||
88 | prevents us from completely freezing the cgroup at this time. After EBUSY, | ||
89 | the cgroup will remain partially frozen -- reflected by freezer.state reporting | ||
90 | "FREEZING" when read. The state will remain "FREEZING" until one of these | ||
91 | things happens: | ||
92 | |||
93 | 1) Userspace cancels the freezing operation by writing "THAWED" to | ||
94 | the freezer.state file | ||
95 | 2) Userspace retries the freezing operation by writing "FROZEN" to | ||
96 | the freezer.state file (writing "FREEZING" is not legal | ||
97 | and returns EIO) | ||
98 | 3) The tasks that blocked the cgroup from entering the "FROZEN" | ||
99 | state disappear from the cgroup's set of tasks. | ||
diff --git a/Documentation/controllers/memory.txt b/Documentation/controllers/memory.txt index 9b53d582736..1c07547d3f8 100644 --- a/Documentation/controllers/memory.txt +++ b/Documentation/controllers/memory.txt | |||
@@ -112,14 +112,22 @@ the per cgroup LRU. | |||
112 | 112 | ||
113 | 2.2.1 Accounting details | 113 | 2.2.1 Accounting details |
114 | 114 | ||
115 | All mapped pages (RSS) and unmapped user pages (Page Cache) are accounted. | 115 | All mapped anon pages (RSS) and cache pages (Page Cache) are accounted. |
116 | RSS pages are accounted at the time of page_add_*_rmap() unless they've already | 116 | (some pages which never be reclaimable and will not be on global LRU |
117 | been accounted for earlier. A file page will be accounted for as Page Cache; | 117 | are not accounted. we just accounts pages under usual vm management.) |
118 | it's mapped into the page tables of a process, duplicate accounting is carefully | 118 | |
119 | avoided. Page Cache pages are accounted at the time of add_to_page_cache(). | 119 | RSS pages are accounted at page_fault unless they've already been accounted |
120 | The corresponding routines that remove a page from the page tables or removes | 120 | for earlier. A file page will be accounted for as Page Cache when it's |
121 | a page from Page Cache is used to decrement the accounting counters of the | 121 | inserted into inode (radix-tree). While it's mapped into the page tables of |
122 | cgroup. | 122 | processes, duplicate accounting is carefully avoided. |
123 | |||
124 | A RSS page is unaccounted when it's fully unmapped. A PageCache page is | ||
125 | unaccounted when it's removed from radix-tree. | ||
126 | |||
127 | At page migration, accounting information is kept. | ||
128 | |||
129 | Note: we just account pages-on-lru because our purpose is to control amount | ||
130 | of used pages. not-on-lru pages are tend to be out-of-control from vm view. | ||
123 | 131 | ||
124 | 2.3 Shared Page Accounting | 132 | 2.3 Shared Page Accounting |
125 | 133 | ||
diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt index 47e568a9370..5c86c258c79 100644 --- a/Documentation/cpusets.txt +++ b/Documentation/cpusets.txt | |||
@@ -48,7 +48,7 @@ hooks, beyond what is already present, required to manage dynamic | |||
48 | job placement on large systems. | 48 | job placement on large systems. |
49 | 49 | ||
50 | Cpusets use the generic cgroup subsystem described in | 50 | Cpusets use the generic cgroup subsystem described in |
51 | Documentation/cgroup.txt. | 51 | Documentation/cgroups/cgroups.txt. |
52 | 52 | ||
53 | Requests by a task, using the sched_setaffinity(2) system call to | 53 | Requests by a task, using the sched_setaffinity(2) system call to |
54 | include CPUs in its CPU affinity mask, and using the mbind(2) and | 54 | include CPUs in its CPU affinity mask, and using the mbind(2) and |
diff --git a/Documentation/cris/README b/Documentation/cris/README index 795a1dabe6c..d9b086869a6 100644 --- a/Documentation/cris/README +++ b/Documentation/cris/README | |||
@@ -27,7 +27,7 @@ operating system. | |||
27 | The ETRAX 100LX chip | 27 | The ETRAX 100LX chip |
28 | -------------------- | 28 | -------------------- |
29 | 29 | ||
30 | For reference, plase see the press-release: | 30 | For reference, please see the press-release: |
31 | 31 | ||
32 | http://www.axis.com/news/us/001101_etrax.htm | 32 | http://www.axis.com/news/us/001101_etrax.htm |
33 | 33 | ||
diff --git a/Documentation/development-process/1.Intro b/Documentation/development-process/1.Intro new file mode 100644 index 00000000000..8cc2cba2b10 --- /dev/null +++ b/Documentation/development-process/1.Intro | |||
@@ -0,0 +1,274 @@ | |||
1 | 1: A GUIDE TO THE KERNEL DEVELOPMENT PROCESS | ||
2 | |||
3 | The purpose of this document is to help developers (and their managers) | ||
4 | work with the development community with a minimum of frustration. It is | ||
5 | an attempt to document how this community works in a way which is | ||
6 | accessible to those who are not intimately familiar with Linux kernel | ||
7 | development (or, indeed, free software development in general). While | ||
8 | there is some technical material here, this is very much a process-oriented | ||
9 | discussion which does not require a deep knowledge of kernel programming to | ||
10 | understand. | ||
11 | |||
12 | |||
13 | 1.1: EXECUTIVE SUMMARY | ||
14 | |||
15 | The rest of this section covers the scope of the kernel development process | ||
16 | and the kinds of frustrations that developers and their employers can | ||
17 | encounter there. There are a great many reasons why kernel code should be | ||
18 | merged into the official ("mainline") kernel, including automatic | ||
19 | availability to users, community support in many forms, and the ability to | ||
20 | influence the direction of kernel development. Code contributed to the | ||
21 | Linux kernel must be made available under a GPL-compatible license. | ||
22 | |||
23 | Section 2 introduces the development process, the kernel release cycle, and | ||
24 | the mechanics of the merge window. The various phases in the patch | ||
25 | development, review, and merging cycle are covered. There is some | ||
26 | discussion of tools and mailing lists. Developers wanting to get started | ||
27 | with kernel development are encouraged to track down and fix bugs as an | ||
28 | initial exercise. | ||
29 | |||
30 | Section 3 covers early-stage project planning, with an emphasis on | ||
31 | involving the development community as soon as possible. | ||
32 | |||
33 | Section 4 is about the coding process; several pitfalls which have been | ||
34 | encountered by other developers are discussed. Some requirements for | ||
35 | patches are covered, and there is an introduction to some of the tools | ||
36 | which can help to ensure that kernel patches are correct. | ||
37 | |||
38 | Section 5 talks about the process of posting patches for review. To be | ||
39 | taken seriously by the development community, patches must be properly | ||
40 | formatted and described, and they must be sent to the right place. | ||
41 | Following the advice in this section should help to ensure the best | ||
42 | possible reception for your work. | ||
43 | |||
44 | Section 6 covers what happens after posting patches; the job is far from | ||
45 | done at that point. Working with reviewers is a crucial part of the | ||
46 | development process; this section offers a number of tips on how to avoid | ||
47 | problems at this important stage. Developers are cautioned against | ||
48 | assuming that the job is done when a patch is merged into the mainline. | ||
49 | |||
50 | Section 7 introduces a couple of "advanced" topics: managing patches with | ||
51 | git and reviewing patches posted by others. | ||
52 | |||
53 | Section 8 concludes the document with pointers to sources for more | ||
54 | information on kernel development. | ||
55 | |||
56 | |||
57 | 1.2: WHAT THIS DOCUMENT IS ABOUT | ||
58 | |||
59 | The Linux kernel, at over 6 million lines of code and well over 1000 active | ||
60 | contributors, is one of the largest and most active free software projects | ||
61 | in existence. Since its humble beginning in 1991, this kernel has evolved | ||
62 | into a best-of-breed operating system component which runs on pocket-sized | ||
63 | digital music players, desktop PCs, the largest supercomputers in | ||
64 | existence, and all types of systems in between. It is a robust, efficient, | ||
65 | and scalable solution for almost any situation. | ||
66 | |||
67 | With the growth of Linux has come an increase in the number of developers | ||
68 | (and companies) wishing to participate in its development. Hardware | ||
69 | vendors want to ensure that Linux supports their products well, making | ||
70 | those products attractive to Linux users. Embedded systems vendors, who | ||
71 | use Linux as a component in an integrated product, want Linux to be as | ||
72 | capable and well-suited to the task at hand as possible. Distributors and | ||
73 | other software vendors who base their products on Linux have a clear | ||
74 | interest in the capabilities, performance, and reliability of the Linux | ||
75 | kernel. And end users, too, will often wish to change Linux to make it | ||
76 | better suit their needs. | ||
77 | |||
78 | One of the most compelling features of Linux is that it is accessible to | ||
79 | these developers; anybody with the requisite skills can improve Linux and | ||
80 | influence the direction of its development. Proprietary products cannot | ||
81 | offer this kind of openness, which is a characteristic of the free software | ||
82 | process. But, if anything, the kernel is even more open than most other | ||
83 | free software projects. A typical three-month kernel development cycle can | ||
84 | involve over 1000 developers working for more than 100 different companies | ||
85 | (or for no company at all). | ||
86 | |||
87 | Working with the kernel development community is not especially hard. But, | ||
88 | that notwithstanding, many potential contributors have experienced | ||
89 | difficulties when trying to do kernel work. The kernel community has | ||
90 | evolved its own distinct ways of operating which allow it to function | ||
91 | smoothly (and produce a high-quality product) in an environment where | ||
92 | thousands of lines of code are being changed every day. So it is not | ||
93 | surprising that Linux kernel development process differs greatly from | ||
94 | proprietary development methods. | ||
95 | |||
96 | The kernel's development process may come across as strange and | ||
97 | intimidating to new developers, but there are good reasons and solid | ||
98 | experience behind it. A developer who does not understand the kernel | ||
99 | community's ways (or, worse, who tries to flout or circumvent them) will | ||
100 | have a frustrating experience in store. The development community, while | ||
101 | being helpful to those who are trying to learn, has little time for those | ||
102 | who will not listen or who do not care about the development process. | ||
103 | |||
104 | It is hoped that those who read this document will be able to avoid that | ||
105 | frustrating experience. There is a lot of material here, but the effort | ||
106 | involved in reading it will be repaid in short order. The development | ||
107 | community is always in need of developers who will help to make the kernel | ||
108 | better; the following text should help you - or those who work for you - | ||
109 | join our community. | ||
110 | |||
111 | |||
112 | 1.3: CREDITS | ||
113 | |||
114 | This document was written by Jonathan Corbet, corbet@lwn.net. It has been | ||
115 | improved by comments from Johannes Berg, James Berry, Alex Chiang, Roland | ||
116 | Dreier, Randy Dunlap, Jake Edge, Jiri Kosina, Matt Mackall, Arthur Marsh, | ||
117 | Amanda McPherson, Andrew Morton, Andrew Price, Tsugikazu Shibata, and | ||
118 | Jochen Voß. | ||
119 | |||
120 | This work was supported by the Linux Foundation; thanks especially to | ||
121 | Amanda McPherson, who saw the value of this effort and made it all happen. | ||
122 | |||
123 | |||
124 | 1.4: THE IMPORTANCE OF GETTING CODE INTO THE MAINLINE | ||
125 | |||
126 | Some companies and developers occasionally wonder why they should bother | ||
127 | learning how to work with the kernel community and get their code into the | ||
128 | mainline kernel (the "mainline" being the kernel maintained by Linus | ||
129 | Torvalds and used as a base by Linux distributors). In the short term, | ||
130 | contributing code can look like an avoidable expense; it seems easier to | ||
131 | just keep the code separate and support users directly. The truth of the | ||
132 | matter is that keeping code separate ("out of tree") is a false economy. | ||
133 | |||
134 | As a way of illustrating the costs of out-of-tree code, here are a few | ||
135 | relevant aspects of the kernel development process; most of these will be | ||
136 | discussed in greater detail later in this document. Consider: | ||
137 | |||
138 | - Code which has been merged into the mainline kernel is available to all | ||
139 | Linux users. It will automatically be present on all distributions which | ||
140 | enable it. There is no need for driver disks, downloads, or the hassles | ||
141 | of supporting multiple versions of multiple distributions; it all just | ||
142 | works, for the developer and for the user. Incorporation into the | ||
143 | mainline solves a large number of distribution and support problems. | ||
144 | |||
145 | - While kernel developers strive to maintain a stable interface to user | ||
146 | space, the internal kernel API is in constant flux. The lack of a stable | ||
147 | internal interface is a deliberate design decision; it allows fundamental | ||
148 | improvements to be made at any time and results in higher-quality code. | ||
149 | But one result of that policy is that any out-of-tree code requires | ||
150 | constant upkeep if it is to work with new kernels. Maintaining | ||
151 | out-of-tree code requires significant amounts of work just to keep that | ||
152 | code working. | ||
153 | |||
154 | Code which is in the mainline, instead, does not require this work as the | ||
155 | result of a simple rule requiring any developer who makes an API change | ||
156 | to also fix any code that breaks as the result of that change. So code | ||
157 | which has been merged into the mainline has significantly lower | ||
158 | maintenance costs. | ||
159 | |||
160 | - Beyond that, code which is in the kernel will often be improved by other | ||
161 | developers. Surprising results can come from empowering your user | ||
162 | community and customers to improve your product. | ||
163 | |||
164 | - Kernel code is subjected to review, both before and after merging into | ||
165 | the mainline. No matter how strong the original developer's skills are, | ||
166 | this review process invariably finds ways in which the code can be | ||
167 | improved. Often review finds severe bugs and security problems. This is | ||
168 | especially true for code which has been developed in a closed | ||
169 | environment; such code benefits strongly from review by outside | ||
170 | developers. Out-of-tree code is lower-quality code. | ||
171 | |||
172 | - Participation in the development process is your way to influence the | ||
173 | direction of kernel development. Users who complain from the sidelines | ||
174 | are heard, but active developers have a stronger voice - and the ability | ||
175 | to implement changes which make the kernel work better for their needs. | ||
176 | |||
177 | - When code is maintained separately, the possibility that a third party | ||
178 | will contribute a different implementation of a similar feature always | ||
179 | exists. Should that happen, getting your code merged will become much | ||
180 | harder - to the point of impossibility. Then you will be faced with the | ||
181 | unpleasant alternatives of either (1) maintaining a nonstandard feature | ||
182 | out of tree indefinitely, or (2) abandoning your code and migrating your | ||
183 | users over to the in-tree version. | ||
184 | |||
185 | - Contribution of code is the fundamental action which makes the whole | ||
186 | process work. By contributing your code you can add new functionality to | ||
187 | the kernel and provide capabilities and examples which are of use to | ||
188 | other kernel developers. If you have developed code for Linux (or are | ||
189 | thinking about doing so), you clearly have an interest in the continued | ||
190 | success of this platform; contributing code is one of the best ways to | ||
191 | help ensure that success. | ||
192 | |||
193 | All of the reasoning above applies to any out-of-tree kernel code, | ||
194 | including code which is distributed in proprietary, binary-only form. | ||
195 | There are, however, additional factors which should be taken into account | ||
196 | before considering any sort of binary-only kernel code distribution. These | ||
197 | include: | ||
198 | |||
199 | - The legal issues around the distribution of proprietary kernel modules | ||
200 | are cloudy at best; quite a few kernel copyright holders believe that | ||
201 | most binary-only modules are derived products of the kernel and that, as | ||
202 | a result, their distribution is a violation of the GNU General Public | ||
203 | license (about which more will be said below). Your author is not a | ||
204 | lawyer, and nothing in this document can possibly be considered to be | ||
205 | legal advice. The true legal status of closed-source modules can only be | ||
206 | determined by the courts. But the uncertainty which haunts those modules | ||
207 | is there regardless. | ||
208 | |||
209 | - Binary modules greatly increase the difficulty of debugging kernel | ||
210 | problems, to the point that most kernel developers will not even try. So | ||
211 | the distribution of binary-only modules will make it harder for your | ||
212 | users to get support from the community. | ||
213 | |||
214 | - Support is also harder for distributors of binary-only modules, who must | ||
215 | provide a version of the module for every distribution and every kernel | ||
216 | version they wish to support. Dozens of builds of a single module can | ||
217 | be required to provide reasonably comprehensive coverage, and your users | ||
218 | will have to upgrade your module separately every time they upgrade their | ||
219 | kernel. | ||
220 | |||
221 | - Everything that was said above about code review applies doubly to | ||
222 | closed-source code. Since this code is not available at all, it cannot | ||
223 | have been reviewed by the community and will, beyond doubt, have serious | ||
224 | problems. | ||
225 | |||
226 | Makers of embedded systems, in particular, may be tempted to disregard much | ||
227 | of what has been said in this section in the belief that they are shipping | ||
228 | a self-contained product which uses a frozen kernel version and requires no | ||
229 | more development after its release. This argument misses the value of | ||
230 | widespread code review and the value of allowing your users to add | ||
231 | capabilities to your product. But these products, too, have a limited | ||
232 | commercial life, after which a new version must be released. At that | ||
233 | point, vendors whose code is in the mainline and well maintained will be | ||
234 | much better positioned to get the new product ready for market quickly. | ||
235 | |||
236 | |||
237 | 1.5: LICENSING | ||
238 | |||
239 | Code is contributed to the Linux kernel under a number of licenses, but all | ||
240 | code must be compatible with version 2 of the GNU General Public License | ||
241 | (GPLv2), which is the license covering the kernel distribution as a whole. | ||
242 | In practice, that means that all code contributions are covered either by | ||
243 | GPLv2 (with, optionally, language allowing distribution under later | ||
244 | versions of the GPL) or the three-clause BSD license. Any contributions | ||
245 | which are not covered by a compatible license will not be accepted into the | ||
246 | kernel. | ||
247 | |||
248 | Copyright assignments are not required (or requested) for code contributed | ||
249 | to the kernel. All code merged into the mainline kernel retains its | ||
250 | original ownership; as a result, the kernel now has thousands of owners. | ||
251 | |||
252 | One implication of this ownership structure is that any attempt to change | ||
253 | the licensing of the kernel is doomed to almost certain failure. There are | ||
254 | few practical scenarios where the agreement of all copyright holders could | ||
255 | be obtained (or their code removed from the kernel). So, in particular, | ||
256 | there is no prospect of a migration to version 3 of the GPL in the | ||
257 | foreseeable future. | ||
258 | |||
259 | It is imperative that all code contributed to the kernel be legitimately | ||
260 | free software. For that reason, code from anonymous (or pseudonymous) | ||
261 | contributors will not be accepted. All contributors are required to "sign | ||
262 | off" on their code, stating that the code can be distributed with the | ||
263 | kernel under the GPL. Code which has not been licensed as free software by | ||
264 | its owner, or which risks creating copyright-related problems for the | ||
265 | kernel (such as code which derives from reverse-engineering efforts lacking | ||
266 | proper safeguards) cannot be contributed. | ||
267 | |||
268 | Questions about copyright-related issues are common on Linux development | ||
269 | mailing lists. Such questions will normally receive no shortage of | ||
270 | answers, but one should bear in mind that the people answering those | ||
271 | questions are not lawyers and cannot provide legal advice. If you have | ||
272 | legal questions relating to Linux source code, there is no substitute for | ||
273 | talking with a lawyer who understands this field. Relying on answers | ||
274 | obtained on technical mailing lists is a risky affair. | ||
diff --git a/Documentation/development-process/2.Process b/Documentation/development-process/2.Process new file mode 100644 index 00000000000..d750321acd5 --- /dev/null +++ b/Documentation/development-process/2.Process | |||
@@ -0,0 +1,459 @@ | |||
1 | 2: HOW THE DEVELOPMENT PROCESS WORKS | ||
2 | |||
3 | Linux kernel development in the early 1990's was a pretty loose affair, | ||
4 | with relatively small numbers of users and developers involved. With a | ||
5 | user base in the millions and with some 2,000 developers involved over the | ||
6 | course of one year, the kernel has since had to evolve a number of | ||
7 | processes to keep development happening smoothly. A solid understanding of | ||
8 | how the process works is required in order to be an effective part of it. | ||
9 | |||
10 | |||
11 | 2.1: THE BIG PICTURE | ||
12 | |||
13 | The kernel developers use a loosely time-based release process, with a new | ||
14 | major kernel release happening every two or three months. The recent | ||
15 | release history looks like this: | ||
16 | |||
17 | 2.6.26 July 13, 2008 | ||
18 | 2.6.25 April 16, 2008 | ||
19 | 2.6.24 January 24, 2008 | ||
20 | 2.6.23 October 9, 2007 | ||
21 | 2.6.22 July 8, 2007 | ||
22 | 2.6.21 April 25, 2007 | ||
23 | 2.6.20 February 4, 2007 | ||
24 | |||
25 | Every 2.6.x release is a major kernel release with new features, internal | ||
26 | API changes, and more. A typical 2.6 release can contain over 10,000 | ||
27 | changesets with changes to several hundred thousand lines of code. 2.6 is | ||
28 | thus the leading edge of Linux kernel development; the kernel uses a | ||
29 | rolling development model which is continually integrating major changes. | ||
30 | |||
31 | A relatively straightforward discipline is followed with regard to the | ||
32 | merging of patches for each release. At the beginning of each development | ||
33 | cycle, the "merge window" is said to be open. At that time, code which is | ||
34 | deemed to be sufficiently stable (and which is accepted by the development | ||
35 | community) is merged into the mainline kernel. The bulk of changes for a | ||
36 | new development cycle (and all of the major changes) will be merged during | ||
37 | this time, at a rate approaching 1,000 changes ("patches," or "changesets") | ||
38 | per day. | ||
39 | |||
40 | (As an aside, it is worth noting that the changes integrated during the | ||
41 | merge window do not come out of thin air; they have been collected, tested, | ||
42 | and staged ahead of time. How that process works will be described in | ||
43 | detail later on). | ||
44 | |||
45 | The merge window lasts for two weeks. At the end of this time, Linus | ||
46 | Torvalds will declare that the window is closed and release the first of | ||
47 | the "rc" kernels. For the kernel which is destined to be 2.6.26, for | ||
48 | example, the release which happens at the end of the merge window will be | ||
49 | called 2.6.26-rc1. The -rc1 release is the signal that the time to merge | ||
50 | new features has passed, and that the time to stabilize the next kernel has | ||
51 | begun. | ||
52 | |||
53 | Over the next six to ten weeks, only patches which fix problems should be | ||
54 | submitted to the mainline. On occasion a more significant change will be | ||
55 | allowed, but such occasions are rare; developers who try to merge new | ||
56 | features outside of the merge window tend to get an unfriendly reception. | ||
57 | As a general rule, if you miss the merge window for a given feature, the | ||
58 | best thing to do is to wait for the next development cycle. (An occasional | ||
59 | exception is made for drivers for previously-unsupported hardware; if they | ||
60 | touch no in-tree code, they cannot cause regressions and should be safe to | ||
61 | add at any time). | ||
62 | |||
63 | As fixes make their way into the mainline, the patch rate will slow over | ||
64 | time. Linus releases new -rc kernels about once a week; a normal series | ||
65 | will get up to somewhere between -rc6 and -rc9 before the kernel is | ||
66 | considered to be sufficiently stable and the final 2.6.x release is made. | ||
67 | At that point the whole process starts over again. | ||
68 | |||
69 | As an example, here is how the 2.6.25 development cycle went (all dates in | ||
70 | 2008): | ||
71 | |||
72 | January 24 2.6.24 stable release | ||
73 | February 10 2.6.25-rc1, merge window closes | ||
74 | February 15 2.6.25-rc2 | ||
75 | February 24 2.6.25-rc3 | ||
76 | March 4 2.6.25-rc4 | ||
77 | March 9 2.6.25-rc5 | ||
78 | March 16 2.6.25-rc6 | ||
79 | March 25 2.6.25-rc7 | ||
80 | April 1 2.6.25-rc8 | ||
81 | April 11 2.6.25-rc9 | ||
82 | April 16 2.6.25 stable release | ||
83 | |||
84 | How do the developers decide when to close the development cycle and create | ||
85 | the stable release? The most significant metric used is the list of | ||
86 | regressions from previous releases. No bugs are welcome, but those which | ||
87 | break systems which worked in the past are considered to be especially | ||
88 | serious. For this reason, patches which cause regressions are looked upon | ||
89 | unfavorably and are quite likely to be reverted during the stabilization | ||
90 | period. | ||
91 | |||
92 | The developers' goal is to fix all known regressions before the stable | ||
93 | release is made. In the real world, this kind of perfection is hard to | ||
94 | achieve; there are just too many variables in a project of this size. | ||
95 | There comes a point where delaying the final release just makes the problem | ||
96 | worse; the pile of changes waiting for the next merge window will grow | ||
97 | larger, creating even more regressions the next time around. So most 2.6.x | ||
98 | kernels go out with a handful of known regressions though, hopefully, none | ||
99 | of them are serious. | ||
100 | |||
101 | Once a stable release is made, its ongoing maintenance is passed off to the | ||
102 | "stable team," currently comprised of Greg Kroah-Hartman and Chris Wright. | ||
103 | The stable team will release occasional updates to the stable release using | ||
104 | the 2.6.x.y numbering scheme. To be considered for an update release, a | ||
105 | patch must (1) fix a significant bug, and (2) already be merged into the | ||
106 | mainline for the next development kernel. Continuing our 2.6.25 example, | ||
107 | the history (as of this writing) is: | ||
108 | |||
109 | May 1 2.6.25.1 | ||
110 | May 6 2.6.25.2 | ||
111 | May 9 2.6.25.3 | ||
112 | May 15 2.6.25.4 | ||
113 | June 7 2.6.25.5 | ||
114 | June 9 2.6.25.6 | ||
115 | June 16 2.6.25.7 | ||
116 | June 21 2.6.25.8 | ||
117 | June 24 2.6.25.9 | ||
118 | |||
119 | Stable updates for a given kernel are made for approximately six months; | ||
120 | after that, the maintenance of stable releases is solely the responsibility | ||
121 | of the distributors which have shipped that particular kernel. | ||
122 | |||
123 | |||
124 | 2.2: THE LIFECYCLE OF A PATCH | ||
125 | |||
126 | Patches do not go directly from the developer's keyboard into the mainline | ||
127 | kernel. There is, instead, a somewhat involved (if somewhat informal) | ||
128 | process designed to ensure that each patch is reviewed for quality and that | ||
129 | each patch implements a change which is desirable to have in the mainline. | ||
130 | This process can happen quickly for minor fixes, or, in the case of large | ||
131 | and controversial changes, go on for years. Much developer frustration | ||
132 | comes from a lack of understanding of this process or from attempts to | ||
133 | circumvent it. | ||
134 | |||
135 | In the hopes of reducing that frustration, this document will describe how | ||
136 | a patch gets into the kernel. What follows below is an introduction which | ||
137 | describes the process in a somewhat idealized way. A much more detailed | ||
138 | treatment will come in later sections. | ||
139 | |||
140 | The stages that a patch goes through are, generally: | ||
141 | |||
142 | - Design. This is where the real requirements for the patch - and the way | ||
143 | those requirements will be met - are laid out. Design work is often | ||
144 | done without involving the community, but it is better to do this work | ||
145 | in the open if at all possible; it can save a lot of time redesigning | ||
146 | things later. | ||
147 | |||
148 | - Early review. Patches are posted to the relevant mailing list, and | ||
149 | developers on that list reply with any comments they may have. This | ||
150 | process should turn up any major problems with a patch if all goes | ||
151 | well. | ||
152 | |||
153 | - Wider review. When the patch is getting close to ready for mainline | ||
154 | inclusion, it will be accepted by a relevant subsystem maintainer - | ||
155 | though this acceptance is not a guarantee that the patch will make it | ||
156 | all the way to the mainline. The patch will show up in the maintainer's | ||
157 | subsystem tree and into the staging trees (described below). When the | ||
158 | process works, this step leads to more extensive review of the patch and | ||
159 | the discovery of any problems resulting from the integration of this | ||
160 | patch with work being done by others. | ||
161 | |||
162 | - Merging into the mainline. Eventually, a successful patch will be | ||
163 | merged into the mainline repository managed by Linus Torvalds. More | ||
164 | comments and/or problems may surface at this time; it is important that | ||
165 | the developer be responsive to these and fix any issues which arise. | ||
166 | |||
167 | - Stable release. The number of users potentially affected by the patch | ||
168 | is now large, so, once again, new problems may arise. | ||
169 | |||
170 | - Long-term maintenance. While it is certainly possible for a developer | ||
171 | to forget about code after merging it, that sort of behavior tends to | ||
172 | leave a poor impression in the development community. Merging code | ||
173 | eliminates some of the maintenance burden, in that others will fix | ||
174 | problems caused by API changes. But the original developer should | ||
175 | continue to take responsibility for the code if it is to remain useful | ||
176 | in the longer term. | ||
177 | |||
178 | One of the largest mistakes made by kernel developers (or their employers) | ||
179 | is to try to cut the process down to a single "merging into the mainline" | ||
180 | step. This approach invariably leads to frustration for everybody | ||
181 | involved. | ||
182 | |||
183 | |||
184 | 2.3: HOW PATCHES GET INTO THE KERNEL | ||
185 | |||
186 | There is exactly one person who can merge patches into the mainline kernel | ||
187 | repository: Linus Torvalds. But, of the over 12,000 patches which went | ||
188 | into the 2.6.25 kernel, only 250 (around 2%) were directly chosen by Linus | ||
189 | himself. The kernel project has long since grown to a size where no single | ||
190 | developer could possibly inspect and select every patch unassisted. The | ||
191 | way the kernel developers have addressed this growth is through the use of | ||
192 | a lieutenant system built around a chain of trust. | ||
193 | |||
194 | The kernel code base is logically broken down into a set of subsystems: | ||
195 | networking, specific architecture support, memory management, video | ||
196 | devices, etc. Most subsystems have a designated maintainer, a developer | ||
197 | who has overall responsibility for the code within that subsystem. These | ||
198 | subsystem maintainers are the gatekeepers (in a loose way) for the portion | ||
199 | of the kernel they manage; they are the ones who will (usually) accept a | ||
200 | patch for inclusion into the mainline kernel. | ||
201 | |||
202 | Subsystem maintainers each manage their own version of the kernel source | ||
203 | tree, usually (but certainly not always) using the git source management | ||
204 | tool. Tools like git (and related tools like quilt or mercurial) allow | ||
205 | maintainers to track a list of patches, including authorship information | ||
206 | and other metadata. At any given time, the maintainer can identify which | ||
207 | patches in his or her repository are not found in the mainline. | ||
208 | |||
209 | When the merge window opens, top-level maintainers will ask Linus to "pull" | ||
210 | the patches they have selected for merging from their repositories. If | ||
211 | Linus agrees, the stream of patches will flow up into his repository, | ||
212 | becoming part of the mainline kernel. The amount of attention that Linus | ||
213 | pays to specific patches received in a pull operation varies. It is clear | ||
214 | that, sometimes, he looks quite closely. But, as a general rule, Linus | ||
215 | trusts the subsystem maintainers to not send bad patches upstream. | ||
216 | |||
217 | Subsystem maintainers, in turn, can pull patches from other maintainers. | ||
218 | For example, the networking tree is built from patches which accumulated | ||
219 | first in trees dedicated to network device drivers, wireless networking, | ||
220 | etc. This chain of repositories can be arbitrarily long, though it rarely | ||
221 | exceeds two or three links. Since each maintainer in the chain trusts | ||
222 | those managing lower-level trees, this process is known as the "chain of | ||
223 | trust." | ||
224 | |||
225 | Clearly, in a system like this, getting patches into the kernel depends on | ||
226 | finding the right maintainer. Sending patches directly to Linus is not | ||
227 | normally the right way to go. | ||
228 | |||
229 | |||
230 | 2.4: STAGING TREES | ||
231 | |||
232 | The chain of subsystem trees guides the flow of patches into the kernel, | ||
233 | but it also raises an interesting question: what if somebody wants to look | ||
234 | at all of the patches which are being prepared for the next merge window? | ||
235 | Developers will be interested in what other changes are pending to see | ||
236 | whether there are any conflicts to worry about; a patch which changes a | ||
237 | core kernel function prototype, for example, will conflict with any other | ||
238 | patches which use the older form of that function. Reviewers and testers | ||
239 | want access to the changes in their integrated form before all of those | ||
240 | changes land in the mainline kernel. One could pull changes from all of | ||
241 | the interesting subsystem trees, but that would be a big and error-prone | ||
242 | job. | ||
243 | |||
244 | The answer comes in the form of staging trees, where subsystem trees are | ||
245 | collected for testing and review. The older of these trees, maintained by | ||
246 | Andrew Morton, is called "-mm" (for memory management, which is how it got | ||
247 | started). The -mm tree integrates patches from a long list of subsystem | ||
248 | trees; it also has some patches aimed at helping with debugging. | ||
249 | |||
250 | Beyond that, -mm contains a significant collection of patches which have | ||
251 | been selected by Andrew directly. These patches may have been posted on a | ||
252 | mailing list, or they may apply to a part of the kernel for which there is | ||
253 | no designated subsystem tree. As a result, -mm operates as a sort of | ||
254 | subsystem tree of last resort; if there is no other obvious path for a | ||
255 | patch into the mainline, it is likely to end up in -mm. Miscellaneous | ||
256 | patches which accumulate in -mm will eventually either be forwarded on to | ||
257 | an appropriate subsystem tree or be sent directly to Linus. In a typical | ||
258 | development cycle, approximately 10% of the patches going into the mainline | ||
259 | get there via -mm. | ||
260 | |||
261 | The current -mm patch can always be found from the front page of | ||
262 | |||
263 | http://kernel.org/ | ||
264 | |||
265 | Those who want to see the current state of -mm can get the "-mm of the | ||
266 | moment" tree, found at: | ||
267 | |||
268 | http://userweb.kernel.org/~akpm/mmotm/ | ||
269 | |||
270 | Use of the MMOTM tree is likely to be a frustrating experience, though; | ||
271 | there is a definite chance that it will not even compile. | ||
272 | |||
273 | The other staging tree, started more recently, is linux-next, maintained by | ||
274 | Stephen Rothwell. The linux-next tree is, by design, a snapshot of what | ||
275 | the mainline is expected to look like after the next merge window closes. | ||
276 | Linux-next trees are announced on the linux-kernel and linux-next mailing | ||
277 | lists when they are assembled; they can be downloaded from: | ||
278 | |||
279 | http://www.kernel.org/pub/linux/kernel/people/sfr/linux-next/ | ||
280 | |||
281 | Some information about linux-next has been gathered at: | ||
282 | |||
283 | http://linux.f-seidel.de/linux-next/pmwiki/ | ||
284 | |||
285 | How the linux-next tree will fit into the development process is still | ||
286 | changing. As of this writing, the first full development cycle involving | ||
287 | linux-next (2.6.26) is coming to an end; thus far, it has proved to be a | ||
288 | valuable resource for finding and fixing integration problems before the | ||
289 | beginning of the merge window. See http://lwn.net/Articles/287155/ for | ||
290 | more information on how linux-next has worked to set up the 2.6.27 merge | ||
291 | window. | ||
292 | |||
293 | Some developers have begun to suggest that linux-next should be used as the | ||
294 | target for future development as well. The linux-next tree does tend to be | ||
295 | far ahead of the mainline and is more representative of the tree into which | ||
296 | any new work will be merged. The downside to this idea is that the | ||
297 | volatility of linux-next tends to make it a difficult development target. | ||
298 | See http://lwn.net/Articles/289013/ for more information on this topic, and | ||
299 | stay tuned; much is still in flux where linux-next is involved. | ||
300 | |||
301 | |||
302 | 2.5: TOOLS | ||
303 | |||
304 | As can be seen from the above text, the kernel development process depends | ||
305 | heavily on the ability to herd collections of patches in various | ||
306 | directions. The whole thing would not work anywhere near as well as it | ||
307 | does without suitably powerful tools. Tutorials on how to use these tools | ||
308 | are well beyond the scope of this document, but there is space for a few | ||
309 | pointers. | ||
310 | |||
311 | By far the dominant source code management system used by the kernel | ||
312 | community is git. Git is one of a number of distributed version control | ||
313 | systems being developed in the free software community. It is well tuned | ||
314 | for kernel development, in that it performs quite well when dealing with | ||
315 | large repositories and large numbers of patches. It also has a reputation | ||
316 | for being difficult to learn and use, though it has gotten better over | ||
317 | time. Some sort of familiarity with git is almost a requirement for kernel | ||
318 | developers; even if they do not use it for their own work, they'll need git | ||
319 | to keep up with what other developers (and the mainline) are doing. | ||
320 | |||
321 | Git is now packaged by almost all Linux distributions. There is a home | ||
322 | page at | ||
323 | |||
324 | http://git.or.cz/ | ||
325 | |||
326 | That page has pointers to documentation and tutorials. One should be | ||
327 | aware, in particular, of the Kernel Hacker's Guide to git, which has | ||
328 | information specific to kernel development: | ||
329 | |||
330 | http://linux.yyz.us/git-howto.html | ||
331 | |||
332 | Among the kernel developers who do not use git, the most popular choice is | ||
333 | almost certainly Mercurial: | ||
334 | |||
335 | http://www.selenic.com/mercurial/ | ||
336 | |||
337 | Mercurial shares many features with git, but it provides an interface which | ||
338 | many find easier to use. | ||
339 | |||
340 | The other tool worth knowing about is Quilt: | ||
341 | |||
342 | http://savannah.nongnu.org/projects/quilt/ | ||
343 | |||
344 | Quilt is a patch management system, rather than a source code management | ||
345 | system. It does not track history over time; it is, instead, oriented | ||
346 | toward tracking a specific set of changes against an evolving code base. | ||
347 | Some major subsystem maintainers use quilt to manage patches intended to go | ||
348 | upstream. For the management of certain kinds of trees (-mm, for example), | ||
349 | quilt is the best tool for the job. | ||
350 | |||
351 | |||
352 | 2.6: MAILING LISTS | ||
353 | |||
354 | A great deal of Linux kernel development work is done by way of mailing | ||
355 | lists. It is hard to be a fully-functioning member of the community | ||
356 | without joining at least one list somewhere. But Linux mailing lists also | ||
357 | represent a potential hazard to developers, who risk getting buried under a | ||
358 | load of electronic mail, running afoul of the conventions used on the Linux | ||
359 | lists, or both. | ||
360 | |||
361 | Most kernel mailing lists are run on vger.kernel.org; the master list can | ||
362 | be found at: | ||
363 | |||
364 | http://vger.kernel.org/vger-lists.html | ||
365 | |||
366 | There are lists hosted elsewhere, though; a number of them are at | ||
367 | lists.redhat.com. | ||
368 | |||
369 | The core mailing list for kernel development is, of course, linux-kernel. | ||
370 | This list is an intimidating place to be; volume can reach 500 messages per | ||
371 | day, the amount of noise is high, the conversation can be severely | ||
372 | technical, and participants are not always concerned with showing a high | ||
373 | degree of politeness. But there is no other place where the kernel | ||
374 | development community comes together as a whole; developers who avoid this | ||
375 | list will miss important information. | ||
376 | |||
377 | There are a few hints which can help with linux-kernel survival: | ||
378 | |||
379 | - Have the list delivered to a separate folder, rather than your main | ||
380 | mailbox. One must be able to ignore the stream for sustained periods of | ||
381 | time. | ||
382 | |||
383 | - Do not try to follow every conversation - nobody else does. It is | ||
384 | important to filter on both the topic of interest (though note that | ||
385 | long-running conversations can drift away from the original subject | ||
386 | without changing the email subject line) and the people who are | ||
387 | participating. | ||
388 | |||
389 | - Do not feed the trolls. If somebody is trying to stir up an angry | ||
390 | response, ignore them. | ||
391 | |||
392 | - When responding to linux-kernel email (or that on other lists) preserve | ||
393 | the Cc: header for all involved. In the absence of a strong reason (such | ||
394 | as an explicit request), you should never remove recipients. Always make | ||
395 | sure that the person you are responding to is in the Cc: list. This | ||
396 | convention also makes it unnecessary to explicitly ask to be copied on | ||
397 | replies to your postings. | ||
398 | |||
399 | - Search the list archives (and the net as a whole) before asking | ||
400 | questions. Some developers can get impatient with people who clearly | ||
401 | have not done their homework. | ||
402 | |||
403 | - Avoid top-posting (the practice of putting your answer above the quoted | ||
404 | text you are responding to). It makes your response harder to read and | ||
405 | makes a poor impression. | ||
406 | |||
407 | - Ask on the correct mailing list. Linux-kernel may be the general meeting | ||
408 | point, but it is not the best place to find developers from all | ||
409 | subsystems. | ||
410 | |||
411 | The last point - finding the correct mailing list - is a common place for | ||
412 | beginning developers to go wrong. Somebody who asks a networking-related | ||
413 | question on linux-kernel will almost certainly receive a polite suggestion | ||
414 | to ask on the netdev list instead, as that is the list frequented by most | ||
415 | networking developers. Other lists exist for the SCSI, video4linux, IDE, | ||
416 | filesystem, etc. subsystems. The best place to look for mailing lists is | ||
417 | in the MAINTAINERS file packaged with the kernel source. | ||
418 | |||
419 | |||
420 | 2.7: GETTING STARTED WITH KERNEL DEVELOPMENT | ||
421 | |||
422 | Questions about how to get started with the kernel development process are | ||
423 | common - from both individuals and companies. Equally common are missteps | ||
424 | which make the beginning of the relationship harder than it has to be. | ||
425 | |||
426 | Companies often look to hire well-known developers to get a development | ||
427 | group started. This can, in fact, be an effective technique. But it also | ||
428 | tends to be expensive and does not do much to grow the pool of experienced | ||
429 | kernel developers. It is possible to bring in-house developers up to speed | ||
430 | on Linux kernel development, given the investment of a bit of time. Taking | ||
431 | this time can endow an employer with a group of developers who understand | ||
432 | the kernel and the company both, and who can help to train others as well. | ||
433 | Over the medium term, this is often the more profitable approach. | ||
434 | |||
435 | Individual developers are often, understandably, at a loss for a place to | ||
436 | start. Beginning with a large project can be intimidating; one often wants | ||
437 | to test the waters with something smaller first. This is the point where | ||
438 | some developers jump into the creation of patches fixing spelling errors or | ||
439 | minor coding style issues. Unfortunately, such patches create a level of | ||
440 | noise which is distracting for the development community as a whole, so, | ||
441 | increasingly, they are looked down upon. New developers wishing to | ||
442 | introduce themselves to the community will not get the sort of reception | ||
443 | they wish for by these means. | ||
444 | |||
445 | Andrew Morton gives this advice for aspiring kernel developers | ||
446 | |||
447 | The #1 project for all kernel beginners should surely be "make sure | ||
448 | that the kernel runs perfectly at all times on all machines which | ||
449 | you can lay your hands on". Usually the way to do this is to work | ||
450 | with others on getting things fixed up (this can require | ||
451 | persistence!) but that's fine - it's a part of kernel development. | ||
452 | |||
453 | (http://lwn.net/Articles/283982/). | ||
454 | |||
455 | In the absence of obvious problems to fix, developers are advised to look | ||
456 | at the current lists of regressions and open bugs in general. There is | ||
457 | never any shortage of issues in need of fixing; by addressing these issues, | ||
458 | developers will gain experience with the process while, at the same time, | ||
459 | building respect with the rest of the development community. | ||
diff --git a/Documentation/development-process/3.Early-stage b/Documentation/development-process/3.Early-stage new file mode 100644 index 00000000000..307a159a70c --- /dev/null +++ b/Documentation/development-process/3.Early-stage | |||
@@ -0,0 +1,195 @@ | |||
1 | 3: EARLY-STAGE PLANNING | ||
2 | |||
3 | When contemplating a Linux kernel development project, it can be tempting | ||
4 | to jump right in and start coding. As with any significant project, | ||
5 | though, much of the groundwork for success is best laid before the first | ||
6 | line of code is written. Some time spent in early planning and | ||
7 | communication can save far more time later on. | ||
8 | |||
9 | |||
10 | 3.1: SPECIFYING THE PROBLEM | ||
11 | |||
12 | Like any engineering project, a successful kernel enhancement starts with a | ||
13 | clear description of the problem to be solved. In some cases, this step is | ||
14 | easy: when a driver is needed for a specific piece of hardware, for | ||
15 | example. In others, though, it is tempting to confuse the real problem | ||
16 | with the proposed solution, and that can lead to difficulties. | ||
17 | |||
18 | Consider an example: some years ago, developers working with Linux audio | ||
19 | sought a way to run applications without dropouts or other artifacts caused | ||
20 | by excessive latency in the system. The solution they arrived at was a | ||
21 | kernel module intended to hook into the Linux Security Module (LSM) | ||
22 | framework; this module could be configured to give specific applications | ||
23 | access to the realtime scheduler. This module was implemented and sent to | ||
24 | the linux-kernel mailing list, where it immediately ran into problems. | ||
25 | |||
26 | To the audio developers, this security module was sufficient to solve their | ||
27 | immediate problem. To the wider kernel community, though, it was seen as a | ||
28 | misuse of the LSM framework (which is not intended to confer privileges | ||
29 | onto processes which they would not otherwise have) and a risk to system | ||
30 | stability. Their preferred solutions involved realtime scheduling access | ||
31 | via the rlimit mechanism for the short term, and ongoing latency reduction | ||
32 | work in the long term. | ||
33 | |||
34 | The audio community, however, could not see past the particular solution | ||
35 | they had implemented; they were unwilling to accept alternatives. The | ||
36 | resulting disagreement left those developers feeling disillusioned with the | ||
37 | entire kernel development process; one of them went back to an audio list | ||
38 | and posted this: | ||
39 | |||
40 | There are a number of very good Linux kernel developers, but they | ||
41 | tend to get outshouted by a large crowd of arrogant fools. Trying | ||
42 | to communicate user requirements to these people is a waste of | ||
43 | time. They are much too "intelligent" to listen to lesser mortals. | ||
44 | |||
45 | (http://lwn.net/Articles/131776/). | ||
46 | |||
47 | The reality of the situation was different; the kernel developers were far | ||
48 | more concerned about system stability, long-term maintenance, and finding | ||
49 | the right solution to the problem than they were with a specific module. | ||
50 | The moral of the story is to focus on the problem - not a specific solution | ||
51 | - and to discuss it with the development community before investing in the | ||
52 | creation of a body of code. | ||
53 | |||
54 | So, when contemplating a kernel development project, one should obtain | ||
55 | answers to a short set of questions: | ||
56 | |||
57 | - What, exactly, is the problem which needs to be solved? | ||
58 | |||
59 | - Who are the users affected by this problem? Which use cases should the | ||
60 | solution address? | ||
61 | |||
62 | - How does the kernel fall short in addressing that problem now? | ||
63 | |||
64 | Only then does it make sense to start considering possible solutions. | ||
65 | |||
66 | |||
67 | 3.2: EARLY DISCUSSION | ||
68 | |||
69 | When planning a kernel development project, it makes great sense to hold | ||
70 | discussions with the community before launching into implementation. Early | ||
71 | communication can save time and trouble in a number of ways: | ||
72 | |||
73 | - It may well be that the problem is addressed by the kernel in ways which | ||
74 | you have not understood. The Linux kernel is large and has a number of | ||
75 | features and capabilities which are not immediately obvious. Not all | ||
76 | kernel capabilities are documented as well as one might like, and it is | ||
77 | easy to miss things. Your author has seen the posting of a complete | ||
78 | driver which duplicated an existing driver that the new author had been | ||
79 | unaware of. Code which reinvents existing wheels is not only wasteful; | ||
80 | it will also not be accepted into the mainline kernel. | ||
81 | |||
82 | - There may be elements of the proposed solution which will not be | ||
83 | acceptable for mainline merging. It is better to find out about | ||
84 | problems like this before writing the code. | ||
85 | |||
86 | - It's entirely possible that other developers have thought about the | ||
87 | problem; they may have ideas for a better solution, and may be willing | ||
88 | to help in the creation of that solution. | ||
89 | |||
90 | Years of experience with the kernel development community have taught a | ||
91 | clear lesson: kernel code which is designed and developed behind closed | ||
92 | doors invariably has problems which are only revealed when the code is | ||
93 | released into the community. Sometimes these problems are severe, | ||
94 | requiring months or years of effort before the code can be brought up to | ||
95 | the kernel community's standards. Some examples include: | ||
96 | |||
97 | - The Devicescape network stack was designed and implemented for | ||
98 | single-processor systems. It could not be merged into the mainline | ||
99 | until it was made suitable for multiprocessor systems. Retrofitting | ||
100 | locking and such into code is a difficult task; as a result, the merging | ||
101 | of this code (now called mac80211) was delayed for over a year. | ||
102 | |||
103 | - The Reiser4 filesystem included a number of capabilities which, in the | ||
104 | core kernel developers' opinion, should have been implemented in the | ||
105 | virtual filesystem layer instead. It also included features which could | ||
106 | not easily be implemented without exposing the system to user-caused | ||
107 | deadlocks. The late revelation of these problems - and refusal to | ||
108 | address some of them - has caused Reiser4 to stay out of the mainline | ||
109 | kernel. | ||
110 | |||
111 | - The AppArmor security module made use of internal virtual filesystem | ||
112 | data structures in ways which were considered to be unsafe and | ||
113 | unreliable. This code has since been significantly reworked, but | ||
114 | remains outside of the mainline. | ||
115 | |||
116 | In each of these cases, a great deal of pain and extra work could have been | ||
117 | avoided with some early discussion with the kernel developers. | ||
118 | |||
119 | |||
120 | 3.3: WHO DO YOU TALK TO? | ||
121 | |||
122 | When developers decide to take their plans public, the next question will | ||
123 | be: where do we start? The answer is to find the right mailing list(s) and | ||
124 | the right maintainer. For mailing lists, the best approach is to look in | ||
125 | the MAINTAINERS file for a relevant place to post. If there is a suitable | ||
126 | subsystem list, posting there is often preferable to posting on | ||
127 | linux-kernel; you are more likely to reach developers with expertise in the | ||
128 | relevant subsystem and the environment may be more supportive. | ||
129 | |||
130 | Finding maintainers can be a bit harder. Again, the MAINTAINERS file is | ||
131 | the place to start. That file tends to not always be up to date, though, | ||
132 | and not all subsystems are represented there. The person listed in the | ||
133 | MAINTAINERS file may, in fact, not be the person who is actually acting in | ||
134 | that role currently. So, when there is doubt about who to contact, a | ||
135 | useful trick is to use git (and "git log" in particular) to see who is | ||
136 | currently active within the subsystem of interest. Look at who is writing | ||
137 | patches, and who, if anybody, is attaching Signed-off-by lines to those | ||
138 | patches. Those are the people who will be best placed to help with a new | ||
139 | development project. | ||
140 | |||
141 | If all else fails, talking to Andrew Morton can be an effective way to | ||
142 | track down a maintainer for a specific piece of code. | ||
143 | |||
144 | |||
145 | 3.4: WHEN TO POST? | ||
146 | |||
147 | If possible, posting your plans during the early stages can only be | ||
148 | helpful. Describe the problem being solved and any plans that have been | ||
149 | made on how the implementation will be done. Any information you can | ||
150 | provide can help the development community provide useful input on the | ||
151 | project. | ||
152 | |||
153 | One discouraging thing which can happen at this stage is not a hostile | ||
154 | reaction, but, instead, little or no reaction at all. The sad truth of the | ||
155 | matter is (1) kernel developers tend to be busy, (2) there is no shortage | ||
156 | of people with grand plans and little code (or even prospect of code) to | ||
157 | back them up, and (3) nobody is obligated to review or comment on ideas | ||
158 | posted by others. If a request-for-comments posting yields little in the | ||
159 | way of comments, do not assume that it means there is no interest in the | ||
160 | project. Unfortunately, you also cannot assume that there are no problems | ||
161 | with your idea. The best thing to do in this situation is to proceed, | ||
162 | keeping the community informed as you go. | ||
163 | |||
164 | |||
165 | 3.5: GETTING OFFICIAL BUY-IN | ||
166 | |||
167 | If your work is being done in a corporate environment - as most Linux | ||
168 | kernel work is - you must, obviously, have permission from suitably | ||
169 | empowered managers before you can post your company's plans or code to a | ||
170 | public mailing list. The posting of code which has not been cleared for | ||
171 | release under a GPL-compatible license can be especially problematic; the | ||
172 | sooner that a company's management and legal staff can agree on the posting | ||
173 | of a kernel development project, the better off everybody involved will be. | ||
174 | |||
175 | Some readers may be thinking at this point that their kernel work is | ||
176 | intended to support a product which does not yet have an officially | ||
177 | acknowledged existence. Revealing their employer's plans on a public | ||
178 | mailing list may not be a viable option. In cases like this, it is worth | ||
179 | considering whether the secrecy is really necessary; there is often no real | ||
180 | need to keep development plans behind closed doors. | ||
181 | |||
182 | That said, there are also cases where a company legitimately cannot | ||
183 | disclose its plans early in the development process. Companies with | ||
184 | experienced kernel developers may choose to proceed in an open-loop manner | ||
185 | on the assumption that they will be able to avoid serious integration | ||
186 | problems later. For companies without that sort of in-house expertise, the | ||
187 | best option is often to hire an outside developer to review the plans under | ||
188 | a non-disclosure agreement. The Linux Foundation operates an NDA program | ||
189 | designed to help with this sort of situation; more information can be found | ||
190 | at: | ||
191 | |||
192 | http://www.linuxfoundation.org/en/NDA_program | ||
193 | |||
194 | This kind of review is often enough to avoid serious problems later on | ||
195 | without requiring public disclosure of the project. | ||
diff --git a/Documentation/development-process/4.Coding b/Documentation/development-process/4.Coding new file mode 100644 index 00000000000..014aca8f14e --- /dev/null +++ b/Documentation/development-process/4.Coding | |||
@@ -0,0 +1,384 @@ | |||
1 | 4: GETTING THE CODE RIGHT | ||
2 | |||
3 | While there is much to be said for a solid and community-oriented design | ||
4 | process, the proof of any kernel development project is in the resulting | ||
5 | code. It is the code which will be examined by other developers and merged | ||
6 | (or not) into the mainline tree. So it is the quality of this code which | ||
7 | will determine the ultimate success of the project. | ||
8 | |||
9 | This section will examine the coding process. We'll start with a look at a | ||
10 | number of ways in which kernel developers can go wrong. Then the focus | ||
11 | will shift toward doing things right and the tools which can help in that | ||
12 | quest. | ||
13 | |||
14 | |||
15 | 4.1: PITFALLS | ||
16 | |||
17 | * Coding style | ||
18 | |||
19 | The kernel has long had a standard coding style, described in | ||
20 | Documentation/CodingStyle. For much of that time, the policies described | ||
21 | in that file were taken as being, at most, advisory. As a result, there is | ||
22 | a substantial amount of code in the kernel which does not meet the coding | ||
23 | style guidelines. The presence of that code leads to two independent | ||
24 | hazards for kernel developers. | ||
25 | |||
26 | The first of these is to believe that the kernel coding standards do not | ||
27 | matter and are not enforced. The truth of the matter is that adding new | ||
28 | code to the kernel is very difficult if that code is not coded according to | ||
29 | the standard; many developers will request that the code be reformatted | ||
30 | before they will even review it. A code base as large as the kernel | ||
31 | requires some uniformity of code to make it possible for developers to | ||
32 | quickly understand any part of it. So there is no longer room for | ||
33 | strangely-formatted code. | ||
34 | |||
35 | Occasionally, the kernel's coding style will run into conflict with an | ||
36 | employer's mandated style. In such cases, the kernel's style will have to | ||
37 | win before the code can be merged. Putting code into the kernel means | ||
38 | giving up a degree of control in a number of ways - including control over | ||
39 | how the code is formatted. | ||
40 | |||
41 | The other trap is to assume that code which is already in the kernel is | ||
42 | urgently in need of coding style fixes. Developers may start to generate | ||
43 | reformatting patches as a way of gaining familiarity with the process, or | ||
44 | as a way of getting their name into the kernel changelogs - or both. But | ||
45 | pure coding style fixes are seen as noise by the development community; | ||
46 | they tend to get a chilly reception. So this type of patch is best | ||
47 | avoided. It is natural to fix the style of a piece of code while working | ||
48 | on it for other reasons, but coding style changes should not be made for | ||
49 | their own sake. | ||
50 | |||
51 | The coding style document also should not be read as an absolute law which | ||
52 | can never be transgressed. If there is a good reason to go against the | ||
53 | style (a line which becomes far less readable if split to fit within the | ||
54 | 80-column limit, for example), just do it. | ||
55 | |||
56 | |||
57 | * Abstraction layers | ||
58 | |||
59 | Computer Science professors teach students to make extensive use of | ||
60 | abstraction layers in the name of flexibility and information hiding. | ||
61 | Certainly the kernel makes extensive use of abstraction; no project | ||
62 | involving several million lines of code could do otherwise and survive. | ||
63 | But experience has shown that excessive or premature abstraction can be | ||
64 | just as harmful as premature optimization. Abstraction should be used to | ||
65 | the level required and no further. | ||
66 | |||
67 | At a simple level, consider a function which has an argument which is | ||
68 | always passed as zero by all callers. One could retain that argument just | ||
69 | in case somebody eventually needs to use the extra flexibility that it | ||
70 | provides. By that time, though, chances are good that the code which | ||
71 | implements this extra argument has been broken in some subtle way which was | ||
72 | never noticed - because it has never been used. Or, when the need for | ||
73 | extra flexibility arises, it does not do so in a way which matches the | ||
74 | programmer's early expectation. Kernel developers will routinely submit | ||
75 | patches to remove unused arguments; they should, in general, not be added | ||
76 | in the first place. | ||
77 | |||
78 | Abstraction layers which hide access to hardware - often to allow the bulk | ||
79 | of a driver to be used with multiple operating systems - are especially | ||
80 | frowned upon. Such layers obscure the code and may impose a performance | ||
81 | penalty; they do not belong in the Linux kernel. | ||
82 | |||
83 | On the other hand, if you find yourself copying significant amounts of code | ||
84 | from another kernel subsystem, it is time to ask whether it would, in fact, | ||
85 | make sense to pull out some of that code into a separate library or to | ||
86 | implement that functionality at a higher level. There is no value in | ||
87 | replicating the same code throughout the kernel. | ||
88 | |||
89 | |||
90 | * #ifdef and preprocessor use in general | ||
91 | |||
92 | The C preprocessor seems to present a powerful temptation to some C | ||
93 | programmers, who see it as a way to efficiently encode a great deal of | ||
94 | flexibility into a source file. But the preprocessor is not C, and heavy | ||
95 | use of it results in code which is much harder for others to read and | ||
96 | harder for the compiler to check for correctness. Heavy preprocessor use | ||
97 | is almost always a sign of code which needs some cleanup work. | ||
98 | |||
99 | Conditional compilation with #ifdef is, indeed, a powerful feature, and it | ||
100 | is used within the kernel. But there is little desire to see code which is | ||
101 | sprinkled liberally with #ifdef blocks. As a general rule, #ifdef use | ||
102 | should be confined to header files whenever possible. | ||
103 | Conditionally-compiled code can be confined to functions which, if the code | ||
104 | is not to be present, simply become empty. The compiler will then quietly | ||
105 | optimize out the call to the empty function. The result is far cleaner | ||
106 | code which is easier to follow. | ||
107 | |||
108 | C preprocessor macros present a number of hazards, including possible | ||
109 | multiple evaluation of expressions with side effects and no type safety. | ||
110 | If you are tempted to define a macro, consider creating an inline function | ||
111 | instead. The code which results will be the same, but inline functions are | ||
112 | easier to read, do not evaluate their arguments multiple times, and allow | ||
113 | the compiler to perform type checking on the arguments and return value. | ||
114 | |||
115 | |||
116 | * Inline functions | ||
117 | |||
118 | Inline functions present a hazard of their own, though. Programmers can | ||
119 | become enamored of the perceived efficiency inherent in avoiding a function | ||
120 | call and fill a source file with inline functions. Those functions, | ||
121 | however, can actually reduce performance. Since their code is replicated | ||
122 | at each call site, they end up bloating the size of the compiled kernel. | ||
123 | That, in turn, creates pressure on the processor's memory caches, which can | ||
124 | slow execution dramatically. Inline functions, as a rule, should be quite | ||
125 | small and relatively rare. The cost of a function call, after all, is not | ||
126 | that high; the creation of large numbers of inline functions is a classic | ||
127 | example of premature optimization. | ||
128 | |||
129 | In general, kernel programmers ignore cache effects at their peril. The | ||
130 | classic time/space tradeoff taught in beginning data structures classes | ||
131 | often does not apply to contemporary hardware. Space *is* time, in that a | ||
132 | larger program will run slower than one which is more compact. | ||
133 | |||
134 | |||
135 | * Locking | ||
136 | |||
137 | In May, 2006, the "Devicescape" networking stack was, with great | ||
138 | fanfare, released under the GPL and made available for inclusion in the | ||
139 | mainline kernel. This donation was welcome news; support for wireless | ||
140 | networking in Linux was considered substandard at best, and the Devicescape | ||
141 | stack offered the promise of fixing that situation. Yet, this code did not | ||
142 | actually make it into the mainline until June, 2007 (2.6.22). What | ||
143 | happened? | ||
144 | |||
145 | This code showed a number of signs of having been developed behind | ||
146 | corporate doors. But one large problem in particular was that it was not | ||
147 | designed to work on multiprocessor systems. Before this networking stack | ||
148 | (now called mac80211) could be merged, a locking scheme needed to be | ||
149 | retrofitted onto it. | ||
150 | |||
151 | Once upon a time, Linux kernel code could be developed without thinking | ||
152 | about the concurrency issues presented by multiprocessor systems. Now, | ||
153 | however, this document is being written on a dual-core laptop. Even on | ||
154 | single-processor systems, work being done to improve responsiveness will | ||
155 | raise the level of concurrency within the kernel. The days when kernel | ||
156 | code could be written without thinking about locking are long past. | ||
157 | |||
158 | Any resource (data structures, hardware registers, etc.) which could be | ||
159 | accessed concurrently by more than one thread must be protected by a lock. | ||
160 | New code should be written with this requirement in mind; retrofitting | ||
161 | locking after the fact is a rather more difficult task. Kernel developers | ||
162 | should take the time to understand the available locking primitives well | ||
163 | enough to pick the right tool for the job. Code which shows a lack of | ||
164 | attention to concurrency will have a difficult path into the mainline. | ||
165 | |||
166 | |||
167 | * Regressions | ||
168 | |||
169 | One final hazard worth mentioning is this: it can be tempting to make a | ||
170 | change (which may bring big improvements) which causes something to break | ||
171 | for existing users. This kind of change is called a "regression," and | ||
172 | regressions have become most unwelcome in the mainline kernel. With few | ||
173 | exceptions, changes which cause regressions will be backed out if the | ||
174 | regression cannot be fixed in a timely manner. Far better to avoid the | ||
175 | regression in the first place. | ||
176 | |||
177 | It is often argued that a regression can be justified if it causes things | ||
178 | to work for more people than it creates problems for. Why not make a | ||
179 | change if it brings new functionality to ten systems for each one it | ||
180 | breaks? The best answer to this question was expressed by Linus in July, | ||
181 | 2007: | ||
182 | |||
183 | So we don't fix bugs by introducing new problems. That way lies | ||
184 | madness, and nobody ever knows if you actually make any real | ||
185 | progress at all. Is it two steps forwards, one step back, or one | ||
186 | step forward and two steps back? | ||
187 | |||
188 | (http://lwn.net/Articles/243460/). | ||
189 | |||
190 | An especially unwelcome type of regression is any sort of change to the | ||
191 | user-space ABI. Once an interface has been exported to user space, it must | ||
192 | be supported indefinitely. This fact makes the creation of user-space | ||
193 | interfaces particularly challenging: since they cannot be changed in | ||
194 | incompatible ways, they must be done right the first time. For this | ||
195 | reason, a great deal of thought, clear documentation, and wide review for | ||
196 | user-space interfaces is always required. | ||
197 | |||
198 | |||
199 | |||
200 | 4.2: CODE CHECKING TOOLS | ||
201 | |||
202 | For now, at least, the writing of error-free code remains an ideal that few | ||
203 | of us can reach. What we can hope to do, though, is to catch and fix as | ||
204 | many of those errors as possible before our code goes into the mainline | ||
205 | kernel. To that end, the kernel developers have put together an impressive | ||
206 | array of tools which can catch a wide variety of obscure problems in an | ||
207 | automated way. Any problem caught by the computer is a problem which will | ||
208 | not afflict a user later on, so it stands to reason that the automated | ||
209 | tools should be used whenever possible. | ||
210 | |||
211 | The first step is simply to heed the warnings produced by the compiler. | ||
212 | Contemporary versions of gcc can detect (and warn about) a large number of | ||
213 | potential errors. Quite often, these warnings point to real problems. | ||
214 | Code submitted for review should, as a rule, not produce any compiler | ||
215 | warnings. When silencing warnings, take care to understand the real cause | ||
216 | and try to avoid "fixes" which make the warning go away without addressing | ||
217 | its cause. | ||
218 | |||
219 | Note that not all compiler warnings are enabled by default. Build the | ||
220 | kernel with "make EXTRA_CFLAGS=-W" to get the full set. | ||
221 | |||
222 | The kernel provides several configuration options which turn on debugging | ||
223 | features; most of these are found in the "kernel hacking" submenu. Several | ||
224 | of these options should be turned on for any kernel used for development or | ||
225 | testing purposes. In particular, you should turn on: | ||
226 | |||
227 | - ENABLE_WARN_DEPRECATED, ENABLE_MUST_CHECK, and FRAME_WARN to get an | ||
228 | extra set of warnings for problems like the use of deprecated interfaces | ||
229 | or ignoring an important return value from a function. The output | ||
230 | generated by these warnings can be verbose, but one need not worry about | ||
231 | warnings from other parts of the kernel. | ||
232 | |||
233 | - DEBUG_OBJECTS will add code to track the lifetime of various objects | ||
234 | created by the kernel and warn when things are done out of order. If | ||
235 | you are adding a subsystem which creates (and exports) complex objects | ||
236 | of its own, consider adding support for the object debugging | ||
237 | infrastructure. | ||
238 | |||
239 | - DEBUG_SLAB can find a variety of memory allocation and use errors; it | ||
240 | should be used on most development kernels. | ||
241 | |||
242 | - DEBUG_SPINLOCK, DEBUG_SPINLOCK_SLEEP, and DEBUG_MUTEXES will find a | ||
243 | number of common locking errors. | ||
244 | |||
245 | There are quite a few other debugging options, some of which will be | ||
246 | discussed below. Some of them have a significant performance impact and | ||
247 | should not be used all of the time. But some time spent learning the | ||
248 | available options will likely be paid back many times over in short order. | ||
249 | |||
250 | One of the heavier debugging tools is the locking checker, or "lockdep." | ||
251 | This tool will track the acquisition and release of every lock (spinlock or | ||
252 | mutex) in the system, the order in which locks are acquired relative to | ||
253 | each other, the current interrupt environment, and more. It can then | ||
254 | ensure that locks are always acquired in the same order, that the same | ||
255 | interrupt assumptions apply in all situations, and so on. In other words, | ||
256 | lockdep can find a number of scenarios in which the system could, on rare | ||
257 | occasion, deadlock. This kind of problem can be painful (for both | ||
258 | developers and users) in a deployed system; lockdep allows them to be found | ||
259 | in an automated manner ahead of time. Code with any sort of non-trivial | ||
260 | locking should be run with lockdep enabled before being submitted for | ||
261 | inclusion. | ||
262 | |||
263 | As a diligent kernel programmer, you will, beyond doubt, check the return | ||
264 | status of any operation (such as a memory allocation) which can fail. The | ||
265 | fact of the matter, though, is that the resulting failure recovery paths | ||
266 | are, probably, completely untested. Untested code tends to be broken code; | ||
267 | you could be much more confident of your code if all those error-handling | ||
268 | paths had been exercised a few times. | ||
269 | |||
270 | The kernel provides a fault injection framework which can do exactly that, | ||
271 | especially where memory allocations are involved. With fault injection | ||
272 | enabled, a configurable percentage of memory allocations will be made to | ||
273 | fail; these failures can be restricted to a specific range of code. | ||
274 | Running with fault injection enabled allows the programmer to see how the | ||
275 | code responds when things go badly. See | ||
276 | Documentation/fault-injection/fault-injection.text for more information on | ||
277 | how to use this facility. | ||
278 | |||
279 | Other kinds of errors can be found with the "sparse" static analysis tool. | ||
280 | With sparse, the programmer can be warned about confusion between | ||
281 | user-space and kernel-space addresses, mixture of big-endian and | ||
282 | small-endian quantities, the passing of integer values where a set of bit | ||
283 | flags is expected, and so on. Sparse must be installed separately (it can | ||
284 | be found at http://www.kernel.org/pub/software/devel/sparse/ if your | ||
285 | distributor does not package it); it can then be run on the code by adding | ||
286 | "C=1" to your make command. | ||
287 | |||
288 | Other kinds of portability errors are best found by compiling your code for | ||
289 | other architectures. If you do not happen to have an S/390 system or a | ||
290 | Blackfin development board handy, you can still perform the compilation | ||
291 | step. A large set of cross compilers for x86 systems can be found at | ||
292 | |||
293 | http://www.kernel.org/pub/tools/crosstool/ | ||
294 | |||
295 | Some time spent installing and using these compilers will help avoid | ||
296 | embarrassment later. | ||
297 | |||
298 | |||
299 | 4.3: DOCUMENTATION | ||
300 | |||
301 | Documentation has often been more the exception than the rule with kernel | ||
302 | development. Even so, adequate documentation will help to ease the merging | ||
303 | of new code into the kernel, make life easier for other developers, and | ||
304 | will be helpful for your users. In many cases, the addition of | ||
305 | documentation has become essentially mandatory. | ||
306 | |||
307 | The first piece of documentation for any patch is its associated | ||
308 | changelog. Log entries should describe the problem being solved, the form | ||
309 | of the solution, the people who worked on the patch, any relevant | ||
310 | effects on performance, and anything else that might be needed to | ||
311 | understand the patch. | ||
312 | |||
313 | Any code which adds a new user-space interface - including new sysfs or | ||
314 | /proc files - should include documentation of that interface which enables | ||
315 | user-space developers to know what they are working with. See | ||
316 | Documentation/ABI/README for a description of how this documentation should | ||
317 | be formatted and what information needs to be provided. | ||
318 | |||
319 | The file Documentation/kernel-parameters.txt describes all of the kernel's | ||
320 | boot-time parameters. Any patch which adds new parameters should add the | ||
321 | appropriate entries to this file. | ||
322 | |||
323 | Any new configuration options must be accompanied by help text which | ||
324 | clearly explains the options and when the user might want to select them. | ||
325 | |||
326 | Internal API information for many subsystems is documented by way of | ||
327 | specially-formatted comments; these comments can be extracted and formatted | ||
328 | in a number of ways by the "kernel-doc" script. If you are working within | ||
329 | a subsystem which has kerneldoc comments, you should maintain them and add | ||
330 | them, as appropriate, for externally-available functions. Even in areas | ||
331 | which have not been so documented, there is no harm in adding kerneldoc | ||
332 | comments for the future; indeed, this can be a useful activity for | ||
333 | beginning kernel developers. The format of these comments, along with some | ||
334 | information on how to create kerneldoc templates can be found in the file | ||
335 | Documentation/kernel-doc-nano-HOWTO.txt. | ||
336 | |||
337 | Anybody who reads through a significant amount of existing kernel code will | ||
338 | note that, often, comments are most notable by their absence. Once again, | ||
339 | the expectations for new code are higher than they were in the past; | ||
340 | merging uncommented code will be harder. That said, there is little desire | ||
341 | for verbosely-commented code. The code should, itself, be readable, with | ||
342 | comments explaining the more subtle aspects. | ||
343 | |||
344 | Certain things should always be commented. Uses of memory barriers should | ||
345 | be accompanied by a line explaining why the barrier is necessary. The | ||
346 | locking rules for data structures generally need to be explained somewhere. | ||
347 | Major data structures need comprehensive documentation in general. | ||
348 | Non-obvious dependencies between separate bits of code should be pointed | ||
349 | out. Anything which might tempt a code janitor to make an incorrect | ||
350 | "cleanup" needs a comment saying why it is done the way it is. And so on. | ||
351 | |||
352 | |||
353 | 4.4: INTERNAL API CHANGES | ||
354 | |||
355 | The binary interface provided by the kernel to user space cannot be broken | ||
356 | except under the most severe circumstances. The kernel's internal | ||
357 | programming interfaces, instead, are highly fluid and can be changed when | ||
358 | the need arises. If you find yourself having to work around a kernel API, | ||
359 | or simply not using a specific functionality because it does not meet your | ||
360 | needs, that may be a sign that the API needs to change. As a kernel | ||
361 | developer, you are empowered to make such changes. | ||
362 | |||
363 | There are, of course, some catches. API changes can be made, but they need | ||
364 | to be well justified. So any patch making an internal API change should be | ||
365 | accompanied by a description of what the change is and why it is | ||
366 | necessary. This kind of change should also be broken out into a separate | ||
367 | patch, rather than buried within a larger patch. | ||
368 | |||
369 | The other catch is that a developer who changes an internal API is | ||
370 | generally charged with the task of fixing any code within the kernel tree | ||
371 | which is broken by the change. For a widely-used function, this duty can | ||
372 | lead to literally hundreds or thousands of changes - many of which are | ||
373 | likely to conflict with work being done by other developers. Needless to | ||
374 | say, this can be a large job, so it is best to be sure that the | ||
375 | justification is solid. | ||
376 | |||
377 | When making an incompatible API change, one should, whenever possible, | ||
378 | ensure that code which has not been updated is caught by the compiler. | ||
379 | This will help you to be sure that you have found all in-tree uses of that | ||
380 | interface. It will also alert developers of out-of-tree code that there is | ||
381 | a change that they need to respond to. Supporting out-of-tree code is not | ||
382 | something that kernel developers need to be worried about, but we also do | ||
383 | not have to make life harder for out-of-tree developers than it it needs to | ||
384 | be. | ||
diff --git a/Documentation/development-process/5.Posting b/Documentation/development-process/5.Posting new file mode 100644 index 00000000000..dd48132a74d --- /dev/null +++ b/Documentation/development-process/5.Posting | |||
@@ -0,0 +1,278 @@ | |||
1 | 5: POSTING PATCHES | ||
2 | |||
3 | Sooner or later, the time comes when your work is ready to be presented to | ||
4 | the community for review and, eventually, inclusion into the mainline | ||
5 | kernel. Unsurprisingly, the kernel development community has evolved a set | ||
6 | of conventions and procedures which are used in the posting of patches; | ||
7 | following them will make life much easier for everybody involved. This | ||
8 | document will attempt to cover these expectations in reasonable detail; | ||
9 | more information can also be found in the files SubmittingPatches, | ||
10 | SubmittingDrivers, and SubmitChecklist in the kernel documentation | ||
11 | directory. | ||
12 | |||
13 | |||
14 | 5.1: WHEN TO POST | ||
15 | |||
16 | There is a constant temptation to avoid posting patches before they are | ||
17 | completely "ready." For simple patches, that is not a problem. If the | ||
18 | work being done is complex, though, there is a lot to be gained by getting | ||
19 | feedback from the community before the work is complete. So you should | ||
20 | consider posting in-progress work, or even making a git tree available so | ||
21 | that interested developers can catch up with your work at any time. | ||
22 | |||
23 | When posting code which is not yet considered ready for inclusion, it is a | ||
24 | good idea to say so in the posting itself. Also mention any major work | ||
25 | which remains to be done and any known problems. Fewer people will look at | ||
26 | patches which are known to be half-baked, but those who do will come in | ||
27 | with the idea that they can help you drive the work in the right direction. | ||
28 | |||
29 | |||
30 | 5.2: BEFORE CREATING PATCHES | ||
31 | |||
32 | There are a number of things which should be done before you consider | ||
33 | sending patches to the development community. These include: | ||
34 | |||
35 | - Test the code to the extent that you can. Make use of the kernel's | ||
36 | debugging tools, ensure that the kernel will build with all reasonable | ||
37 | combinations of configuration options, use cross-compilers to build for | ||
38 | different architectures, etc. | ||
39 | |||
40 | - Make sure your code is compliant with the kernel coding style | ||
41 | guidelines. | ||
42 | |||
43 | - Does your change have performance implications? If so, you should run | ||
44 | benchmarks showing what the impact (or benefit) of your change is; a | ||
45 | summary of the results should be included with the patch. | ||
46 | |||
47 | - Be sure that you have the right to post the code. If this work was done | ||
48 | for an employer, the employer likely has a right to the work and must be | ||
49 | agreeable with its release under the GPL. | ||
50 | |||
51 | As a general rule, putting in some extra thought before posting code almost | ||
52 | always pays back the effort in short order. | ||
53 | |||
54 | |||
55 | 5.3: PATCH PREPARATION | ||
56 | |||
57 | The preparation of patches for posting can be a surprising amount of work, | ||
58 | but, once again, attempting to save time here is not generally advisable | ||
59 | even in the short term. | ||
60 | |||
61 | Patches must be prepared against a specific version of the kernel. As a | ||
62 | general rule, a patch should be based on the current mainline as found in | ||
63 | Linus's git tree. It may become necessary to make versions against -mm, | ||
64 | linux-next, or a subsystem tree, though, to facilitate wider testing and | ||
65 | review. Depending on the area of your patch and what is going on | ||
66 | elsewhere, basing a patch against these other trees can require a | ||
67 | significant amount of work resolving conflicts and dealing with API | ||
68 | changes. | ||
69 | |||
70 | Only the most simple changes should be formatted as a single patch; | ||
71 | everything else should be made as a logical series of changes. Splitting | ||
72 | up patches is a bit of an art; some developers spend a long time figuring | ||
73 | out how to do it in the way that the community expects. There are a few | ||
74 | rules of thumb, however, which can help considerably: | ||
75 | |||
76 | - The patch series you post will almost certainly not be the series of | ||
77 | changes found in your working revision control system. Instead, the | ||
78 | changes you have made need to be considered in their final form, then | ||
79 | split apart in ways which make sense. The developers are interested in | ||
80 | discrete, self-contained changes, not the path you took to get to those | ||
81 | changes. | ||
82 | |||
83 | - Each logically independent change should be formatted as a separate | ||
84 | patch. These changes can be small ("add a field to this structure") or | ||
85 | large (adding a significant new driver, for example), but they should be | ||
86 | conceptually small and amenable to a one-line description. Each patch | ||
87 | should make a specific change which can be reviewed on its own and | ||
88 | verified to do what it says it does. | ||
89 | |||
90 | - As a way of restating the guideline above: do not mix different types of | ||
91 | changes in the same patch. If a single patch fixes a critical security | ||
92 | bug, rearranges a few structures, and reformats the code, there is a | ||
93 | good chance that it will be passed over and the important fix will be | ||
94 | lost. | ||
95 | |||
96 | - Each patch should yield a kernel which builds and runs properly; if your | ||
97 | patch series is interrupted in the middle, the result should still be a | ||
98 | working kernel. Partial application of a patch series is a common | ||
99 | scenario when the "git bisect" tool is used to find regressions; if the | ||
100 | result is a broken kernel, you will make life harder for developers and | ||
101 | users who are engaging in the noble work of tracking down problems. | ||
102 | |||
103 | - Do not overdo it, though. One developer recently posted a set of edits | ||
104 | to a single file as 500 separate patches - an act which did not make him | ||
105 | the most popular person on the kernel mailing list. A single patch can | ||
106 | be reasonably large as long as it still contains a single *logical* | ||
107 | change. | ||
108 | |||
109 | - It can be tempting to add a whole new infrastructure with a series of | ||
110 | patches, but to leave that infrastructure unused until the final patch | ||
111 | in the series enables the whole thing. This temptation should be | ||
112 | avoided if possible; if that series adds regressions, bisection will | ||
113 | finger the last patch as the one which caused the problem, even though | ||
114 | the real bug is elsewhere. Whenever possible, a patch which adds new | ||
115 | code should make that code active immediately. | ||
116 | |||
117 | Working to create the perfect patch series can be a frustrating process | ||
118 | which takes quite a bit of time and thought after the "real work" has been | ||
119 | done. When done properly, though, it is time well spent. | ||
120 | |||
121 | |||
122 | 5.4: PATCH FORMATTING | ||
123 | |||
124 | So now you have a perfect series of patches for posting, but the work is | ||
125 | not done quite yet. Each patch needs to be formatted into a message which | ||
126 | quickly and clearly communicates its purpose to the rest of the world. To | ||
127 | that end, each patch will be composed of the following: | ||
128 | |||
129 | - An optional "From" line naming the author of the patch. This line is | ||
130 | only necessary if you are passing on somebody else's patch via email, | ||
131 | but it never hurts to add it when in doubt. | ||
132 | |||
133 | - A one-line description of what the patch does. This message should be | ||
134 | enough for a reader who sees it with no other context to figure out the | ||
135 | scope of the patch; it is the line that will show up in the "short form" | ||
136 | changelogs. This message is usually formatted with the relevant | ||
137 | subsystem name first, followed by the purpose of the patch. For | ||
138 | example: | ||
139 | |||
140 | gpio: fix build on CONFIG_GPIO_SYSFS=n | ||
141 | |||
142 | - A blank line followed by a detailed description of the contents of the | ||
143 | patch. This description can be as long as is required; it should say | ||
144 | what the patch does and why it should be applied to the kernel. | ||
145 | |||
146 | - One or more tag lines, with, at a minimum, one Signed-off-by: line from | ||
147 | the author of the patch. Tags will be described in more detail below. | ||
148 | |||
149 | The above three items should, normally, be the text used when committing | ||
150 | the change to a revision control system. They are followed by: | ||
151 | |||
152 | - The patch itself, in the unified ("-u") patch format. Using the "-p" | ||
153 | option to diff will associate function names with changes, making the | ||
154 | resulting patch easier for others to read. | ||
155 | |||
156 | You should avoid including changes to irrelevant files (those generated by | ||
157 | the build process, for example, or editor backup files) in the patch. The | ||
158 | file "dontdiff" in the Documentation directory can help in this regard; | ||
159 | pass it to diff with the "-X" option. | ||
160 | |||
161 | The tags mentioned above are used to describe how various developers have | ||
162 | been associated with the development of this patch. They are described in | ||
163 | detail in the SubmittingPatches document; what follows here is a brief | ||
164 | summary. Each of these lines has the format: | ||
165 | |||
166 | tag: Full Name <email address> optional-other-stuff | ||
167 | |||
168 | The tags in common use are: | ||
169 | |||
170 | - Signed-off-by: this is a developer's certification that he or she has | ||
171 | the right to submit the patch for inclusion into the kernel. It is an | ||
172 | agreement to the Developer's Certificate of Origin, the full text of | ||
173 | which can be found in Documentation/SubmittingPatches. Code without a | ||
174 | proper signoff cannot be merged into the mainline. | ||
175 | |||
176 | - Acked-by: indicates an agreement by another developer (often a | ||
177 | maintainer of the relevant code) that the patch is appropriate for | ||
178 | inclusion into the kernel. | ||
179 | |||
180 | - Tested-by: states that the named person has tested the patch and found | ||
181 | it to work. | ||
182 | |||
183 | - Reviewed-by: the named developer has reviewed the patch for correctness; | ||
184 | see the reviewer's statement in Documentation/SubmittingPatches for more | ||
185 | detail. | ||
186 | |||
187 | - Reported-by: names a user who reported a problem which is fixed by this | ||
188 | patch; this tag is used to give credit to the (often underappreciated) | ||
189 | people who test our code and let us know when things do not work | ||
190 | correctly. | ||
191 | |||
192 | - Cc: the named person received a copy of the patch and had the | ||
193 | opportunity to comment on it. | ||
194 | |||
195 | Be careful in the addition of tags to your patches: only Cc: is appropriate | ||
196 | for addition without the explicit permission of the person named. | ||
197 | |||
198 | |||
199 | 5.5: SENDING THE PATCH | ||
200 | |||
201 | Before you mail your patches, there are a couple of other things you should | ||
202 | take care of: | ||
203 | |||
204 | - Are you sure that your mailer will not corrupt the patches? Patches | ||
205 | which have had gratuitous white-space changes or line wrapping performed | ||
206 | by the mail client will not apply at the other end, and often will not | ||
207 | be examined in any detail. If there is any doubt at all, mail the patch | ||
208 | to yourself and convince yourself that it shows up intact. | ||
209 | |||
210 | Documentation/email-clients.txt has some helpful hints on making | ||
211 | specific mail clients work for sending patches. | ||
212 | |||
213 | - Are you sure your patch is free of silly mistakes? You should always | ||
214 | run patches through scripts/checkpatch.pl and address the complaints it | ||
215 | comes up with. Please bear in mind that checkpatch.pl, while being the | ||
216 | embodiment of a fair amount of thought about what kernel patches should | ||
217 | look like, is not smarter than you. If fixing a checkpatch.pl complaint | ||
218 | would make the code worse, don't do it. | ||
219 | |||
220 | Patches should always be sent as plain text. Please do not send them as | ||
221 | attachments; that makes it much harder for reviewers to quote sections of | ||
222 | the patch in their replies. Instead, just put the patch directly into your | ||
223 | message. | ||
224 | |||
225 | When mailing patches, it is important to send copies to anybody who might | ||
226 | be interested in it. Unlike some other projects, the kernel encourages | ||
227 | people to err on the side of sending too many copies; don't assume that the | ||
228 | relevant people will see your posting on the mailing lists. In particular, | ||
229 | copies should go to: | ||
230 | |||
231 | - The maintainer(s) of the affected subsystem(s). As described earlier, | ||
232 | the MAINTAINERS file is the first place to look for these people. | ||
233 | |||
234 | - Other developers who have been working in the same area - especially | ||
235 | those who might be working there now. Using git to see who else has | ||
236 | modified the files you are working on can be helpful. | ||
237 | |||
238 | - If you are responding to a bug report or a feature request, copy the | ||
239 | original poster as well. | ||
240 | |||
241 | - Send a copy to the relevant mailing list, or, if nothing else applies, | ||
242 | the linux-kernel list. | ||
243 | |||
244 | - If you are fixing a bug, think about whether the fix should go into the | ||
245 | next stable update. If so, stable@kernel.org should get a copy of the | ||
246 | patch. Also add a "Cc: stable@kernel.org" to the tags within the patch | ||
247 | itself; that will cause the stable team to get a notification when your | ||
248 | fix goes into the mainline. | ||
249 | |||
250 | When selecting recipients for a patch, it is good to have an idea of who | ||
251 | you think will eventually accept the patch and get it merged. While it | ||
252 | is possible to send patches directly to Linus Torvalds and have him merge | ||
253 | them, things are not normally done that way. Linus is busy, and there are | ||
254 | subsystem maintainers who watch over specific parts of the kernel. Usually | ||
255 | you will be wanting that maintainer to merge your patches. If there is no | ||
256 | obvious maintainer, Andrew Morton is often the patch target of last resort. | ||
257 | |||
258 | Patches need good subject lines. The canonical format for a patch line is | ||
259 | something like: | ||
260 | |||
261 | [PATCH nn/mm] subsys: one-line description of the patch | ||
262 | |||
263 | where "nn" is the ordinal number of the patch, "mm" is the total number of | ||
264 | patches in the series, and "subsys" is the name of the affected subsystem. | ||
265 | Clearly, nn/mm can be omitted for a single, standalone patch. | ||
266 | |||
267 | If you have a significant series of patches, it is customary to send an | ||
268 | introductory description as part zero. This convention is not universally | ||
269 | followed though; if you use it, remember that information in the | ||
270 | introduction does not make it into the kernel changelogs. So please ensure | ||
271 | that the patches, themselves, have complete changelog information. | ||
272 | |||
273 | In general, the second and following parts of a multi-part patch should be | ||
274 | sent as a reply to the first part so that they all thread together at the | ||
275 | receiving end. Tools like git and quilt have commands to mail out a set of | ||
276 | patches with the proper threading. If you have a long series, though, and | ||
277 | are using git, please provide the --no-chain-reply-to option to avoid | ||
278 | creating exceptionally deep nesting. | ||
diff --git a/Documentation/development-process/6.Followthrough b/Documentation/development-process/6.Followthrough new file mode 100644 index 00000000000..a8fba3d83a8 --- /dev/null +++ b/Documentation/development-process/6.Followthrough | |||
@@ -0,0 +1,202 @@ | |||
1 | 6: FOLLOWTHROUGH | ||
2 | |||
3 | At this point, you have followed the guidelines given so far and, with the | ||
4 | addition of your own engineering skills, have posted a perfect series of | ||
5 | patches. One of the biggest mistakes that even experienced kernel | ||
6 | developers can make is to conclude that their work is now done. In truth, | ||
7 | posting patches indicates a transition into the next stage of the process, | ||
8 | with, possibly, quite a bit of work yet to be done. | ||
9 | |||
10 | It is a rare patch which is so good at its first posting that there is no | ||
11 | room for improvement. The kernel development process recognizes this fact, | ||
12 | and, as a result, is heavily oriented toward the improvement of posted | ||
13 | code. You, as the author of that code, will be expected to work with the | ||
14 | kernel community to ensure that your code is up to the kernel's quality | ||
15 | standards. A failure to participate in this process is quite likely to | ||
16 | prevent the inclusion of your patches into the mainline. | ||
17 | |||
18 | |||
19 | 6.1: WORKING WITH REVIEWERS | ||
20 | |||
21 | A patch of any significance will result in a number of comments from other | ||
22 | developers as they review the code. Working with reviewers can be, for | ||
23 | many developers, the most intimidating part of the kernel development | ||
24 | process. Life can be made much easier, though, if you keep a few things in | ||
25 | mind: | ||
26 | |||
27 | - If you have explained your patch well, reviewers will understand its | ||
28 | value and why you went to the trouble of writing it. But that value | ||
29 | will not keep them from asking a fundamental question: what will it be | ||
30 | like to maintain a kernel with this code in it five or ten years later? | ||
31 | Many of the changes you may be asked to make - from coding style tweaks | ||
32 | to substantial rewrites - come from the understanding that Linux will | ||
33 | still be around and under development a decade from now. | ||
34 | |||
35 | - Code review is hard work, and it is a relatively thankless occupation; | ||
36 | people remember who wrote kernel code, but there is little lasting fame | ||
37 | for those who reviewed it. So reviewers can get grumpy, especially when | ||
38 | they see the same mistakes being made over and over again. If you get a | ||
39 | review which seems angry, insulting, or outright offensive, resist the | ||
40 | impulse to respond in kind. Code review is about the code, not about | ||
41 | the people, and code reviewers are not attacking you personally. | ||
42 | |||
43 | - Similarly, code reviewers are not trying to promote their employers' | ||
44 | agendas at the expense of your own. Kernel developers often expect to | ||
45 | be working on the kernel years from now, but they understand that their | ||
46 | employer could change. They truly are, almost without exception, | ||
47 | working toward the creation of the best kernel they can; they are not | ||
48 | trying to create discomfort for their employers' competitors. | ||
49 | |||
50 | What all of this comes down to is that, when reviewers send you comments, | ||
51 | you need to pay attention to the technical observations that they are | ||
52 | making. Do not let their form of expression or your own pride keep that | ||
53 | from happening. When you get review comments on a patch, take the time to | ||
54 | understand what the reviewer is trying to say. If possible, fix the things | ||
55 | that the reviewer is asking you to fix. And respond back to the reviewer: | ||
56 | thank them, and describe how you will answer their questions. | ||
57 | |||
58 | Note that you do not have to agree with every change suggested by | ||
59 | reviewers. If you believe that the reviewer has misunderstood your code, | ||
60 | explain what is really going on. If you have a technical objection to a | ||
61 | suggested change, describe it and justify your solution to the problem. If | ||
62 | your explanations make sense, the reviewer will accept them. Should your | ||
63 | explanation not prove persuasive, though, especially if others start to | ||
64 | agree with the reviewer, take some time to think things over again. It can | ||
65 | be easy to become blinded by your own solution to a problem to the point | ||
66 | that you don't realize that something is fundamentally wrong or, perhaps, | ||
67 | you're not even solving the right problem. | ||
68 | |||
69 | One fatal mistake is to ignore review comments in the hope that they will | ||
70 | go away. They will not go away. If you repost code without having | ||
71 | responded to the comments you got the time before, you're likely to find | ||
72 | that your patches go nowhere. | ||
73 | |||
74 | Speaking of reposting code: please bear in mind that reviewers are not | ||
75 | going to remember all the details of the code you posted the last time | ||
76 | around. So it is always a good idea to remind reviewers of previously | ||
77 | raised issues and how you dealt with them; the patch changelog is a good | ||
78 | place for this kind of information. Reviewers should not have to search | ||
79 | through list archives to familiarize themselves with what was said last | ||
80 | time; if you help them get a running start, they will be in a better mood | ||
81 | when they revisit your code. | ||
82 | |||
83 | What if you've tried to do everything right and things still aren't going | ||
84 | anywhere? Most technical disagreements can be resolved through discussion, | ||
85 | but there are times when somebody simply has to make a decision. If you | ||
86 | honestly believe that this decision is going against you wrongly, you can | ||
87 | always try appealing to a higher power. As of this writing, that higher | ||
88 | power tends to be Andrew Morton. Andrew has a great deal of respect in the | ||
89 | kernel development community; he can often unjam a situation which seems to | ||
90 | be hopelessly blocked. Appealing to Andrew should not be done lightly, | ||
91 | though, and not before all other alternatives have been explored. And bear | ||
92 | in mind, of course, that he may not agree with you either. | ||
93 | |||
94 | |||
95 | 6.2: WHAT HAPPENS NEXT | ||
96 | |||
97 | If a patch is considered to be a good thing to add to the kernel, and once | ||
98 | most of the review issues have been resolved, the next step is usually | ||
99 | entry into a subsystem maintainer's tree. How that works varies from one | ||
100 | subsystem to the next; each maintainer has his or her own way of doing | ||
101 | things. In particular, there may be more than one tree - one, perhaps, | ||
102 | dedicated to patches planned for the next merge window, and another for | ||
103 | longer-term work. | ||
104 | |||
105 | For patches applying to areas for which there is no obvious subsystem tree | ||
106 | (memory management patches, for example), the default tree often ends up | ||
107 | being -mm. Patches which affect multiple subsystems can also end up going | ||
108 | through the -mm tree. | ||
109 | |||
110 | Inclusion into a subsystem tree can bring a higher level of visibility to a | ||
111 | patch. Now other developers working with that tree will get the patch by | ||
112 | default. Subsystem trees typically feed into -mm and linux-next as well, | ||
113 | making their contents visible to the development community as a whole. At | ||
114 | this point, there's a good chance that you will get more comments from a | ||
115 | new set of reviewers; these comments need to be answered as in the previous | ||
116 | round. | ||
117 | |||
118 | What may also happen at this point, depending on the nature of your patch, | ||
119 | is that conflicts with work being done by others turn up. In the worst | ||
120 | case, heavy patch conflicts can result in some work being put on the back | ||
121 | burner so that the remaining patches can be worked into shape and merged. | ||
122 | Other times, conflict resolution will involve working with the other | ||
123 | developers and, possibly, moving some patches between trees to ensure that | ||
124 | everything applies cleanly. This work can be a pain, but count your | ||
125 | blessings: before the advent of the linux-next tree, these conflicts often | ||
126 | only turned up during the merge window and had to be addressed in a hurry. | ||
127 | Now they can be resolved at leisure, before the merge window opens. | ||
128 | |||
129 | Some day, if all goes well, you'll log on and see that your patch has been | ||
130 | merged into the mainline kernel. Congratulations! Once the celebration is | ||
131 | complete (and you have added yourself to the MAINTAINERS file), though, it | ||
132 | is worth remembering an important little fact: the job still is not done. | ||
133 | Merging into the mainline brings its own challenges. | ||
134 | |||
135 | To begin with, the visibility of your patch has increased yet again. There | ||
136 | may be a new round of comments from developers who had not been aware of | ||
137 | the patch before. It may be tempting to ignore them, since there is no | ||
138 | longer any question of your code being merged. Resist that temptation, | ||
139 | though; you still need to be responsive to developers who have questions or | ||
140 | suggestions. | ||
141 | |||
142 | More importantly, though: inclusion into the mainline puts your code into | ||
143 | the hands of a much larger group of testers. Even if you have contributed | ||
144 | a driver for hardware which is not yet available, you will be surprised by | ||
145 | how many people will build your code into their kernels. And, of course, | ||
146 | where there are testers, there will be bug reports. | ||
147 | |||
148 | The worst sort of bug reports are regressions. If your patch causes a | ||
149 | regression, you'll find an uncomfortable number of eyes upon you; | ||
150 | regressions need to be fixed as soon as possible. If you are unwilling or | ||
151 | unable to fix the regression (and nobody else does it for you), your patch | ||
152 | will almost certainly be removed during the stabilization period. Beyond | ||
153 | negating all of the work you have done to get your patch into the mainline, | ||
154 | having a patch pulled as the result of a failure to fix a regression could | ||
155 | well make it harder for you to get work merged in the future. | ||
156 | |||
157 | After any regressions have been dealt with, there may be other, ordinary | ||
158 | bugs to deal with. The stabilization period is your best opportunity to | ||
159 | fix these bugs and ensure that your code's debut in a mainline kernel | ||
160 | release is as solid as possible. So, please, answer bug reports, and fix | ||
161 | the problems if at all possible. That's what the stabilization period is | ||
162 | for; you can start creating cool new patches once any problems with the old | ||
163 | ones have been taken care of. | ||
164 | |||
165 | And don't forget that there are other milestones which may also create bug | ||
166 | reports: the next mainline stable release, when prominent distributors pick | ||
167 | up a version of the kernel containing your patch, etc. Continuing to | ||
168 | respond to these reports is a matter of basic pride in your work. If that | ||
169 | is insufficient motivation, though, it's also worth considering that the | ||
170 | development community remembers developers who lose interest in their code | ||
171 | after it's merged. The next time you post a patch, they will be evaluating | ||
172 | it with the assumption that you will not be around to maintain it | ||
173 | afterward. | ||
174 | |||
175 | |||
176 | 6.3: OTHER THINGS THAT CAN HAPPEN | ||
177 | |||
178 | One day, you may open your mail client and see that somebody has mailed you | ||
179 | a patch to your code. That is one of the advantages of having your code | ||
180 | out there in the open, after all. If you agree with the patch, you can | ||
181 | either forward it on to the subsystem maintainer (be sure to include a | ||
182 | proper From: line so that the attribution is correct, and add a signoff of | ||
183 | your own), or send an Acked-by: response back and let the original poster | ||
184 | send it upward. | ||
185 | |||
186 | If you disagree with the patch, send a polite response explaining why. If | ||
187 | possible, tell the author what changes need to be made to make the patch | ||
188 | acceptable to you. There is a certain resistance to merging patches which | ||
189 | are opposed by the author and maintainer of the code, but it only goes so | ||
190 | far. If you are seen as needlessly blocking good work, those patches will | ||
191 | eventually flow around you and get into the mainline anyway. In the Linux | ||
192 | kernel, nobody has absolute veto power over any code. Except maybe Linus. | ||
193 | |||
194 | On very rare occasion, you may see something completely different: another | ||
195 | developer posts a different solution to your problem. At that point, | ||
196 | chances are that one of the two patches will not be merged, and "mine was | ||
197 | here first" is not considered to be a compelling technical argument. If | ||
198 | somebody else's patch displaces yours and gets into the mainline, there is | ||
199 | really only one way to respond: be pleased that your problem got solved and | ||
200 | get on with your work. Having one's work shoved aside in this manner can | ||
201 | be hurtful and discouraging, but the community will remember your reaction | ||
202 | long after they have forgotten whose patch actually got merged. | ||
diff --git a/Documentation/development-process/7.AdvancedTopics b/Documentation/development-process/7.AdvancedTopics new file mode 100644 index 00000000000..a2cf74093aa --- /dev/null +++ b/Documentation/development-process/7.AdvancedTopics | |||
@@ -0,0 +1,173 @@ | |||
1 | 7: ADVANCED TOPICS | ||
2 | |||
3 | At this point, hopefully, you have a handle on how the development process | ||
4 | works. There is still more to learn, however! This section will cover a | ||
5 | number of topics which can be helpful for developers wanting to become a | ||
6 | regular part of the Linux kernel development process. | ||
7 | |||
8 | 7.1: MANAGING PATCHES WITH GIT | ||
9 | |||
10 | The use of distributed version control for the kernel began in early 2002, | ||
11 | when Linus first started playing with the proprietary BitKeeper | ||
12 | application. While BitKeeper was controversial, the approach to software | ||
13 | version management it embodied most certainly was not. Distributed version | ||
14 | control enabled an immediate acceleration of the kernel development | ||
15 | project. In current times, there are several free alternatives to | ||
16 | BitKeeper. For better or for worse, the kernel project has settled on git | ||
17 | as its tool of choice. | ||
18 | |||
19 | Managing patches with git can make life much easier for the developer, | ||
20 | especially as the volume of those patches grows. Git also has its rough | ||
21 | edges and poses certain hazards; it is a young and powerful tool which is | ||
22 | still being civilized by its developers. This document will not attempt to | ||
23 | teach the reader how to use git; that would be sufficient material for a | ||
24 | long document in its own right. Instead, the focus here will be on how git | ||
25 | fits into the kernel development process in particular. Developers who | ||
26 | wish to come up to speed with git will find more information at: | ||
27 | |||
28 | http://git.or.cz/ | ||
29 | |||
30 | http://www.kernel.org/pub/software/scm/git/docs/user-manual.html | ||
31 | |||
32 | and on various tutorials found on the web. | ||
33 | |||
34 | The first order of business is to read the above sites and get a solid | ||
35 | understanding of how git works before trying to use it to make patches | ||
36 | available to others. A git-using developer should be able to obtain a copy | ||
37 | of the mainline repository, explore the revision history, commit changes to | ||
38 | the tree, use branches, etc. An understanding of git's tools for the | ||
39 | rewriting of history (such as rebase) is also useful. Git comes with its | ||
40 | own terminology and concepts; a new user of git should know about refs, | ||
41 | remote branches, the index, fast-forward merges, pushes and pulls, detached | ||
42 | heads, etc. It can all be a little intimidating at the outset, but the | ||
43 | concepts are not that hard to grasp with a bit of study. | ||
44 | |||
45 | Using git to generate patches for submission by email can be a good | ||
46 | exercise while coming up to speed. | ||
47 | |||
48 | When you are ready to start putting up git trees for others to look at, you | ||
49 | will, of course, need a server that can be pulled from. Setting up such a | ||
50 | server with git-daemon is relatively straightforward if you have a system | ||
51 | which is accessible to the Internet. Otherwise, free, public hosting sites | ||
52 | (Github, for example) are starting to appear on the net. Established | ||
53 | developers can get an account on kernel.org, but those are not easy to come | ||
54 | by; see http://kernel.org/faq/ for more information. | ||
55 | |||
56 | The normal git workflow involves the use of a lot of branches. Each line | ||
57 | of development can be separated into a separate "topic branch" and | ||
58 | maintained independently. Branches in git are cheap, there is no reason to | ||
59 | not make free use of them. And, in any case, you should not do your | ||
60 | development in any branch which you intend to ask others to pull from. | ||
61 | Publicly-available branches should be created with care; merge in patches | ||
62 | from development branches when they are in complete form and ready to go - | ||
63 | not before. | ||
64 | |||
65 | Git provides some powerful tools which can allow you to rewrite your | ||
66 | development history. An inconvenient patch (one which breaks bisection, | ||
67 | say, or which has some other sort of obvious bug) can be fixed in place or | ||
68 | made to disappear from the history entirely. A patch series can be | ||
69 | rewritten as if it had been written on top of today's mainline, even though | ||
70 | you have been working on it for months. Changes can be transparently | ||
71 | shifted from one branch to another. And so on. Judicious use of git's | ||
72 | ability to revise history can help in the creation of clean patch sets with | ||
73 | fewer problems. | ||
74 | |||
75 | Excessive use of this capability can lead to other problems, though, beyond | ||
76 | a simple obsession for the creation of the perfect project history. | ||
77 | Rewriting history will rewrite the changes contained in that history, | ||
78 | turning a tested (hopefully) kernel tree into an untested one. But, beyond | ||
79 | that, developers cannot easily collaborate if they do not have a shared | ||
80 | view of the project history; if you rewrite history which other developers | ||
81 | have pulled into their repositories, you will make life much more difficult | ||
82 | for those developers. So a simple rule of thumb applies here: history | ||
83 | which has been exported to others should generally be seen as immutable | ||
84 | thereafter. | ||
85 | |||
86 | So, once you push a set of changes to your publicly-available server, those | ||
87 | changes should not be rewritten. Git will attempt to enforce this rule if | ||
88 | you try to push changes which do not result in a fast-forward merge | ||
89 | (i.e. changes which do not share the same history). It is possible to | ||
90 | override this check, and there may be times when it is necessary to rewrite | ||
91 | an exported tree. Moving changesets between trees to avoid conflicts in | ||
92 | linux-next is one example. But such actions should be rare. This is one | ||
93 | of the reasons why development should be done in private branches (which | ||
94 | can be rewritten if necessary) and only moved into public branches when | ||
95 | it's in a reasonably advanced state. | ||
96 | |||
97 | As the mainline (or other tree upon which a set of changes is based) | ||
98 | advances, it is tempting to merge with that tree to stay on the leading | ||
99 | edge. For a private branch, rebasing can be an easy way to keep up with | ||
100 | another tree, but rebasing is not an option once a tree is exported to the | ||
101 | world. Once that happens, a full merge must be done. Merging occasionally | ||
102 | makes good sense, but overly frequent merges can clutter the history | ||
103 | needlessly. Suggested technique in this case is to merge infrequently, and | ||
104 | generally only at specific release points (such as a mainline -rc | ||
105 | release). If you are nervous about specific changes, you can always | ||
106 | perform test merges in a private branch. The git "rerere" tool can be | ||
107 | useful in such situations; it remembers how merge conflicts were resolved | ||
108 | so that you don't have to do the same work twice. | ||
109 | |||
110 | One of the biggest recurring complaints about tools like git is this: the | ||
111 | mass movement of patches from one repository to another makes it easy to | ||
112 | slip in ill-advised changes which go into the mainline below the review | ||
113 | radar. Kernel developers tend to get unhappy when they see that kind of | ||
114 | thing happening; putting up a git tree with unreviewed or off-topic patches | ||
115 | can affect your ability to get trees pulled in the future. Quoting Linus: | ||
116 | |||
117 | You can send me patches, but for me to pull a git patch from you, I | ||
118 | need to know that you know what you're doing, and I need to be able | ||
119 | to trust things *without* then having to go and check every | ||
120 | individual change by hand. | ||
121 | |||
122 | (http://lwn.net/Articles/224135/). | ||
123 | |||
124 | To avoid this kind of situation, ensure that all patches within a given | ||
125 | branch stick closely to the associated topic; a "driver fixes" branch | ||
126 | should not be making changes to the core memory management code. And, most | ||
127 | importantly, do not use a git tree to bypass the review process. Post an | ||
128 | occasional summary of the tree to the relevant list, and, when the time is | ||
129 | right, request that the tree be included in linux-next. | ||
130 | |||
131 | If and when others start to send patches for inclusion into your tree, | ||
132 | don't forget to review them. Also ensure that you maintain the correct | ||
133 | authorship information; the git "am" tool does its best in this regard, but | ||
134 | you may have to add a "From:" line to the patch if it has been relayed to | ||
135 | you via a third party. | ||
136 | |||
137 | When requesting a pull, be sure to give all the relevant information: where | ||
138 | your tree is, what branch to pull, and what changes will result from the | ||
139 | pull. The git request-pull command can be helpful in this regard; it will | ||
140 | format the request as other developers expect, and will also check to be | ||
141 | sure that you have remembered to push those changes to the public server. | ||
142 | |||
143 | |||
144 | 7.2: REVIEWING PATCHES | ||
145 | |||
146 | Some readers will certainly object to putting this section with "advanced | ||
147 | topics" on the grounds that even beginning kernel developers should be | ||
148 | reviewing patches. It is certainly true that there is no better way to | ||
149 | learn how to program in the kernel environment than by looking at code | ||
150 | posted by others. In addition, reviewers are forever in short supply; by | ||
151 | looking at code you can make a significant contribution to the process as a | ||
152 | whole. | ||
153 | |||
154 | Reviewing code can be an intimidating prospect, especially for a new kernel | ||
155 | developer who may well feel nervous about questioning code - in public - | ||
156 | which has been posted by those with more experience. Even code written by | ||
157 | the most experienced developers can be improved, though. Perhaps the best | ||
158 | piece of advice for reviewers (all reviewers) is this: phrase review | ||
159 | comments as questions rather than criticisms. Asking "how does the lock | ||
160 | get released in this path?" will always work better than stating "the | ||
161 | locking here is wrong." | ||
162 | |||
163 | Different developers will review code from different points of view. Some | ||
164 | are mostly concerned with coding style and whether code lines have trailing | ||
165 | white space. Others will focus primarily on whether the change implemented | ||
166 | by the patch as a whole is a good thing for the kernel or not. Yet others | ||
167 | will check for problematic locking, excessive stack usage, possible | ||
168 | security issues, duplication of code found elsewhere, adequate | ||
169 | documentation, adverse effects on performance, user-space ABI changes, etc. | ||
170 | All types of review, if they lead to better code going into the kernel, are | ||
171 | welcome and worthwhile. | ||
172 | |||
173 | |||
diff --git a/Documentation/development-process/8.Conclusion b/Documentation/development-process/8.Conclusion new file mode 100644 index 00000000000..1990ab4b494 --- /dev/null +++ b/Documentation/development-process/8.Conclusion | |||
@@ -0,0 +1,74 @@ | |||
1 | 8: FOR MORE INFORMATION | ||
2 | |||
3 | There are numerous sources of information on Linux kernel development and | ||
4 | related topics. First among those will always be the Documentation | ||
5 | directory found in the kernel source distribution. The top-level HOWTO | ||
6 | file is an important starting point; SubmittingPatches and | ||
7 | SubmittingDrivers are also something which all kernel developers should | ||
8 | read. Many internal kernel APIs are documented using the kerneldoc | ||
9 | mechanism; "make htmldocs" or "make pdfdocs" can be used to generate those | ||
10 | documents in HTML or PDF format (though the version of TeX shipped by some | ||
11 | distributions runs into internal limits and fails to process the documents | ||
12 | properly). | ||
13 | |||
14 | Various web sites discuss kernel development at all levels of detail. Your | ||
15 | author would like to humbly suggest http://lwn.net/ as a source; | ||
16 | information on many specific kernel topics can be found via the LWN kernel | ||
17 | index at: | ||
18 | |||
19 | http://lwn.net/Kernel/Index/ | ||
20 | |||
21 | Beyond that, a valuable resource for kernel developers is: | ||
22 | |||
23 | http://kernelnewbies.org/ | ||
24 | |||
25 | Information about the linux-next tree gathers at: | ||
26 | |||
27 | http://linux.f-seidel.de/linux-next/pmwiki/ | ||
28 | |||
29 | And, of course, one should not forget http://kernel.org/, the definitive | ||
30 | location for kernel release information. | ||
31 | |||
32 | There are a number of books on kernel development: | ||
33 | |||
34 | Linux Device Drivers, 3rd Edition (Jonathan Corbet, Alessandro | ||
35 | Rubini, and Greg Kroah-Hartman). Online at | ||
36 | http://lwn.net/Kernel/LDD3/. | ||
37 | |||
38 | Linux Kernel Development (Robert Love). | ||
39 | |||
40 | Understanding the Linux Kernel (Daniel Bovet and Marco Cesati). | ||
41 | |||
42 | All of these books suffer from a common fault, though: they tend to be | ||
43 | somewhat obsolete by the time they hit the shelves, and they have been on | ||
44 | the shelves for a while now. Still, there is quite a bit of good | ||
45 | information to be found there. | ||
46 | |||
47 | Documentation for git can be found at: | ||
48 | |||
49 | http://www.kernel.org/pub/software/scm/git/docs/ | ||
50 | |||
51 | http://www.kernel.org/pub/software/scm/git/docs/user-manual.html | ||
52 | |||
53 | |||
54 | 9: CONCLUSION | ||
55 | |||
56 | Congratulations to anybody who has made it through this long-winded | ||
57 | document. Hopefully it has provided a helpful understanding of how the | ||
58 | Linux kernel is developed and how you can participate in that process. | ||
59 | |||
60 | In the end, it's the participation that matters. Any open source software | ||
61 | project is no more than the sum of what its contributors put into it. The | ||
62 | Linux kernel has progressed as quickly and as well as it has because it has | ||
63 | been helped by an impressively large group of developers, all of whom are | ||
64 | working to make it better. The kernel is a premier example of what can be | ||
65 | done when thousands of people work together toward a common goal. | ||
66 | |||
67 | The kernel can always benefit from a larger developer base, though. There | ||
68 | is always more work to do. But, just as importantly, most other | ||
69 | participants in the Linux ecosystem can benefit through contributing to the | ||
70 | kernel. Getting code into the mainline is the key to higher code quality, | ||
71 | lower maintenance and distribution costs, a higher level of influence over | ||
72 | the direction of kernel development, and more. It is a situation where | ||
73 | everybody involved wins. Fire up your editor and come join us; you will be | ||
74 | more than welcome. | ||
diff --git a/Documentation/devices.txt b/Documentation/devices.txt index 05c80645e4e..2be08240ee8 100644 --- a/Documentation/devices.txt +++ b/Documentation/devices.txt | |||
@@ -2571,6 +2571,9 @@ Your cooperation is appreciated. | |||
2571 | 160 = /dev/usb/legousbtower0 1st USB Legotower device | 2571 | 160 = /dev/usb/legousbtower0 1st USB Legotower device |
2572 | ... | 2572 | ... |
2573 | 175 = /dev/usb/legousbtower15 16th USB Legotower device | 2573 | 175 = /dev/usb/legousbtower15 16th USB Legotower device |
2574 | 176 = /dev/usb/usbtmc1 First USB TMC device | ||
2575 | ... | ||
2576 | 192 = /dev/usb/usbtmc16 16th USB TMC device | ||
2574 | 240 = /dev/usb/dabusb0 First daubusb device | 2577 | 240 = /dev/usb/dabusb0 First daubusb device |
2575 | ... | 2578 | ... |
2576 | 243 = /dev/usb/dabusb3 Fourth dabusb device | 2579 | 243 = /dev/usb/dabusb3 Fourth dabusb device |
diff --git a/Documentation/dontdiff b/Documentation/dontdiff index 27809357da5..1e89a51ea49 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff | |||
@@ -2,11 +2,13 @@ | |||
2 | *.aux | 2 | *.aux |
3 | *.bin | 3 | *.bin |
4 | *.cpio | 4 | *.cpio |
5 | *.css | 5 | *.csp |
6 | *.dsp | ||
6 | *.dvi | 7 | *.dvi |
8 | *.elf | ||
7 | *.eps | 9 | *.eps |
8 | *.fw.gen.S | ||
9 | *.fw | 10 | *.fw |
11 | *.gen.S | ||
10 | *.gif | 12 | *.gif |
11 | *.grep | 13 | *.grep |
12 | *.grp | 14 | *.grp |
@@ -30,6 +32,7 @@ | |||
30 | *.s | 32 | *.s |
31 | *.sgml | 33 | *.sgml |
32 | *.so | 34 | *.so |
35 | *.so.dbg | ||
33 | *.symtypes | 36 | *.symtypes |
34 | *.tab.c | 37 | *.tab.c |
35 | *.tab.h | 38 | *.tab.h |
@@ -38,24 +41,17 @@ | |||
38 | *.xml | 41 | *.xml |
39 | *_MODULES | 42 | *_MODULES |
40 | *_vga16.c | 43 | *_vga16.c |
41 | *cscope* | ||
42 | *~ | 44 | *~ |
43 | *.9 | 45 | *.9 |
44 | *.9.gz | 46 | *.9.gz |
45 | .* | 47 | .* |
46 | .cscope | ||
47 | .gitignore | ||
48 | .mailmap | ||
49 | .mm | 48 | .mm |
50 | 53c700_d.h | 49 | 53c700_d.h |
51 | 53c8xx_d.h* | ||
52 | COPYING | ||
53 | CREDITS | ||
54 | CVS | 50 | CVS |
55 | ChangeSet | 51 | ChangeSet |
56 | Image | 52 | Image |
57 | Kerntypes | 53 | Kerntypes |
58 | MODS.txt | 54 | Module.markers |
59 | Module.symvers | 55 | Module.symvers |
60 | PENDING | 56 | PENDING |
61 | SCCS | 57 | SCCS |
@@ -73,7 +69,9 @@ autoconf.h* | |||
73 | bbootsect | 69 | bbootsect |
74 | bin2c | 70 | bin2c |
75 | binkernel.spec | 71 | binkernel.spec |
72 | binoffset | ||
76 | bootsect | 73 | bootsect |
74 | bounds.h | ||
77 | bsetup | 75 | bsetup |
78 | btfixupprep | 76 | btfixupprep |
79 | build | 77 | build |
@@ -89,39 +87,36 @@ config_data.h* | |||
89 | config_data.gz* | 87 | config_data.gz* |
90 | conmakehash | 88 | conmakehash |
91 | consolemap_deftbl.c* | 89 | consolemap_deftbl.c* |
90 | cpustr.h | ||
92 | crc32table.h* | 91 | crc32table.h* |
93 | cscope.* | 92 | cscope.* |
94 | defkeymap.c* | 93 | defkeymap.c |
95 | devlist.h* | 94 | devlist.h* |
96 | docproc | 95 | docproc |
97 | dummy_sym.c* | ||
98 | elf2ecoff | 96 | elf2ecoff |
99 | elfconfig.h* | 97 | elfconfig.h* |
100 | filelist | ||
101 | fixdep | 98 | fixdep |
102 | fore200e_mkfirm | 99 | fore200e_mkfirm |
103 | fore200e_pca_fw.c* | 100 | fore200e_pca_fw.c* |
104 | gconf | 101 | gconf |
105 | gen-devlist | 102 | gen-devlist |
106 | gen-kdb_cmds.c* | ||
107 | gen_crc32table | 103 | gen_crc32table |
108 | gen_init_cpio | 104 | gen_init_cpio |
109 | genksyms | 105 | genksyms |
110 | gentbl | ||
111 | *_gray256.c | 106 | *_gray256.c |
107 | ihex2fw | ||
112 | ikconfig.h* | 108 | ikconfig.h* |
113 | initramfs_data.cpio | 109 | initramfs_data.cpio |
114 | initramfs_data.cpio.gz | 110 | initramfs_data.cpio.gz |
115 | initramfs_list | 111 | initramfs_list |
116 | kallsyms | 112 | kallsyms |
117 | kconfig | 113 | kconfig |
118 | kconfig.tk | 114 | keywords.c |
119 | keywords.c* | ||
120 | ksym.c* | 115 | ksym.c* |
121 | ksym.h* | 116 | ksym.h* |
122 | kxgettext | 117 | kxgettext |
123 | lkc_defs.h | 118 | lkc_defs.h |
124 | lex.c* | 119 | lex.c |
125 | lex.*.c | 120 | lex.*.c |
126 | logo_*.c | 121 | logo_*.c |
127 | logo_*_clut224.c | 122 | logo_*_clut224.c |
@@ -130,7 +125,6 @@ lxdialog | |||
130 | mach-types | 125 | mach-types |
131 | mach-types.h | 126 | mach-types.h |
132 | machtypes.h | 127 | machtypes.h |
133 | make_times_h | ||
134 | map | 128 | map |
135 | maui_boot.h | 129 | maui_boot.h |
136 | mconf | 130 | mconf |
@@ -138,6 +132,7 @@ miboot* | |||
138 | mk_elfconfig | 132 | mk_elfconfig |
139 | mkboot | 133 | mkboot |
140 | mkbugboot | 134 | mkbugboot |
135 | mkcpustr | ||
141 | mkdep | 136 | mkdep |
142 | mkprep | 137 | mkprep |
143 | mktables | 138 | mktables |
@@ -145,11 +140,12 @@ mktree | |||
145 | modpost | 140 | modpost |
146 | modules.order | 141 | modules.order |
147 | modversions.h* | 142 | modversions.h* |
143 | ncscope.* | ||
148 | offset.h | 144 | offset.h |
149 | offsets.h | 145 | offsets.h |
150 | oui.c* | 146 | oui.c* |
151 | parse.c* | 147 | parse.c |
152 | parse.h* | 148 | parse.h |
153 | patches* | 149 | patches* |
154 | pca200e.bin | 150 | pca200e.bin |
155 | pca200e_ecd.bin2 | 151 | pca200e_ecd.bin2 |
@@ -157,7 +153,7 @@ piggy.gz | |||
157 | piggyback | 153 | piggyback |
158 | pnmtologo | 154 | pnmtologo |
159 | ppc_defs.h* | 155 | ppc_defs.h* |
160 | promcon_tbl.c* | 156 | promcon_tbl.c |
161 | pss_boot.h | 157 | pss_boot.h |
162 | qconf | 158 | qconf |
163 | raid6altivec*.c | 159 | raid6altivec*.c |
@@ -168,27 +164,38 @@ series | |||
168 | setup | 164 | setup |
169 | setup.bin | 165 | setup.bin |
170 | setup.elf | 166 | setup.elf |
171 | sim710_d.h* | ||
172 | sImage | 167 | sImage |
173 | sm_tbl* | 168 | sm_tbl* |
174 | split-include | 169 | split-include |
170 | syscalltab.h | ||
175 | tags | 171 | tags |
176 | tftpboot.img | 172 | tftpboot.img |
177 | timeconst.h | 173 | timeconst.h |
178 | times.h* | 174 | times.h* |
179 | tkparse | ||
180 | trix_boot.h | 175 | trix_boot.h |
181 | utsrelease.h* | 176 | utsrelease.h* |
177 | vdso-syms.lds | ||
182 | vdso.lds | 178 | vdso.lds |
179 | vdso32-int80-syms.lds | ||
180 | vdso32-syms.lds | ||
181 | vdso32-syscall-syms.lds | ||
182 | vdso32-sysenter-syms.lds | ||
183 | vdso32.lds | ||
184 | vdso32.so.dbg | ||
185 | vdso64.lds | ||
186 | vdso64.so.dbg | ||
183 | version.h* | 187 | version.h* |
184 | vmlinux | 188 | vmlinux |
185 | vmlinux-* | 189 | vmlinux-* |
186 | vmlinux.aout | 190 | vmlinux.aout |
187 | vmlinux*.lds* | 191 | vmlinux.lds |
188 | vmlinux*.scr | ||
189 | vsyscall.lds | 192 | vsyscall.lds |
193 | vsyscall_32.lds | ||
190 | wanxlfw.inc | 194 | wanxlfw.inc |
191 | uImage | 195 | uImage |
192 | unifdef | 196 | unifdef |
197 | wakeup.bin | ||
198 | wakeup.elf | ||
199 | wakeup.lds | ||
193 | zImage* | 200 | zImage* |
194 | zconf.hash.c | 201 | zconf.hash.c |
diff --git a/Documentation/fb/intelfb.txt b/Documentation/fb/intelfb.txt index 27a3160650a..dd9e944ea62 100644 --- a/Documentation/fb/intelfb.txt +++ b/Documentation/fb/intelfb.txt | |||
@@ -14,6 +14,7 @@ graphics devices. These would include: | |||
14 | Intel 915GM | 14 | Intel 915GM |
15 | Intel 945G | 15 | Intel 945G |
16 | Intel 945GM | 16 | Intel 945GM |
17 | Intel 945GME | ||
17 | Intel 965G | 18 | Intel 965G |
18 | Intel 965GM | 19 | Intel 965GM |
19 | 20 | ||
diff --git a/Documentation/fb/uvesafb.txt b/Documentation/fb/uvesafb.txt index bcfc233a008..7ac3c4078ff 100644 --- a/Documentation/fb/uvesafb.txt +++ b/Documentation/fb/uvesafb.txt | |||
@@ -52,7 +52,7 @@ are either given on the kernel command line or as module parameters, e.g.: | |||
52 | 52 | ||
53 | video=uvesafb:1024x768-32,mtrr:3,ywrap (compiled into the kernel) | 53 | video=uvesafb:1024x768-32,mtrr:3,ywrap (compiled into the kernel) |
54 | 54 | ||
55 | # modprobe uvesafb mode=1024x768-32 mtrr=3 scroll=ywrap (module) | 55 | # modprobe uvesafb mode_option=1024x768-32 mtrr=3 scroll=ywrap (module) |
56 | 56 | ||
57 | Accepted options: | 57 | Accepted options: |
58 | 58 | ||
@@ -105,7 +105,7 @@ vtotal:n | |||
105 | <mode> The mode you want to set, in the standard modedb format. Refer to | 105 | <mode> The mode you want to set, in the standard modedb format. Refer to |
106 | modedb.txt for a detailed description. When uvesafb is compiled as | 106 | modedb.txt for a detailed description. When uvesafb is compiled as |
107 | a module, the mode string should be provided as a value of the | 107 | a module, the mode string should be provided as a value of the |
108 | 'mode' option. | 108 | 'mode_option' option. |
109 | 109 | ||
110 | vbemode:x | 110 | vbemode:x |
111 | Force the use of VBE mode x. The mode will only be set if it's | 111 | Force the use of VBE mode x. The mode will only be set if it's |
diff --git a/Documentation/fb/viafb.modes b/Documentation/fb/viafb.modes new file mode 100644 index 00000000000..02e5b487f00 --- /dev/null +++ b/Documentation/fb/viafb.modes | |||
@@ -0,0 +1,870 @@ | |||
1 | # | ||
2 | # | ||
3 | # These data are based on the CRTC parameters in | ||
4 | # | ||
5 | # VIA Integration Graphics Chip | ||
6 | # (C) 2004 VIA Technologies Inc. | ||
7 | # | ||
8 | |||
9 | # | ||
10 | # 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) | ||
11 | # | ||
12 | # Horizontal Vertical | ||
13 | # Resolution 640 480 | ||
14 | # Scan Frequency 31.469 kHz 59.94 Hz | ||
15 | # Sync Width 3.813 us 0.064 ms | ||
16 | # 12 chars 2 lines | ||
17 | # Front Porch 0.636 us 0.318 ms | ||
18 | # 2 chars 10 lines | ||
19 | # Back Porch 1.907 us 1.048 ms | ||
20 | # 6 chars 33 lines | ||
21 | # Active Time 25.422 us 15.253 ms | ||
22 | # 80 chars 480 lines | ||
23 | # Blank Time 6.356 us 1.430 ms | ||
24 | # 20 chars 45 lines | ||
25 | # Polarity negative negative | ||
26 | # | ||
27 | |||
28 | mode "640x480-60" | ||
29 | # D: 25.175 MHz, H: 31.469 kHz, V: 59.94 Hz | ||
30 | geometry 640 480 640 480 32 | ||
31 | timings 39722 48 16 33 10 96 2 endmode mode "480x640-60" | ||
32 | # D: 24.823 MHz, H: 39.780 kHz, V: 60.00 Hz | ||
33 | geometry 480 640 480 640 32 timings 39722 72 24 19 1 48 3 endmode | ||
34 | # | ||
35 | # 640x480, 75 Hz, Non-Interlaced (31.50 MHz dotclock) | ||
36 | # | ||
37 | # Horizontal Vertical | ||
38 | # Resolution 640 480 | ||
39 | # Scan Frequency 37.500 kHz 75.00 Hz | ||
40 | # Sync Width 2.032 us 0.080 ms | ||
41 | # 8 chars 3 lines | ||
42 | # Front Porch 0.508 us 0.027 ms | ||
43 | # 2 chars 1 lines | ||
44 | # Back Porch 3.810 us 0.427 ms | ||
45 | # 15 chars 16 lines | ||
46 | # Active Time 20.317 us 12.800 ms | ||
47 | # 80 chars 480 lines | ||
48 | # Blank Time 6.349 us 0.533 ms | ||
49 | # 25 chars 20 lines | ||
50 | # Polarity negative negative | ||
51 | # | ||
52 | mode "640x480-75" | ||
53 | # D: 31.50 MHz, H: 37.500 kHz, V: 75.00 Hz | ||
54 | geometry 640 480 640 480 32 timings 31747 120 16 16 1 64 3 endmode | ||
55 | # | ||
56 | # 640x480, 85 Hz, Non-Interlaced (36.000 MHz dotclock) | ||
57 | # | ||
58 | # Horizontal Vertical | ||
59 | # Resolution 640 480 | ||
60 | # Scan Frequency 43.269 kHz 85.00 Hz | ||
61 | # Sync Width 1.556 us 0.069 ms | ||
62 | # 7 chars 3 lines | ||
63 | # Front Porch 1.556 us 0.023 ms | ||
64 | # 7 chars 1 lines | ||
65 | # Back Porch 2.222 us 0.578 ms | ||
66 | # 10 chars 25 lines | ||
67 | # Active Time 17.778 us 11.093 ms | ||
68 | # 80 chars 480 lines | ||
69 | # Blank Time 5.333 us 0.670 ms | ||
70 | # 24 chars 29 lines | ||
71 | # Polarity negative negative | ||
72 | # | ||
73 | mode "640x480-85" | ||
74 | # D: 36.000 MHz, H: 43.269 kHz, V: 85.00 Hz | ||
75 | geometry 640 480 640 480 32 timings 27777 80 56 25 1 56 3 endmode | ||
76 | # | ||
77 | # 640x480, 100 Hz, Non-Interlaced (43.163 MHz dotclock) | ||
78 | # | ||
79 | # Horizontal Vertical | ||
80 | # Resolution 640 480 | ||
81 | # Scan Frequency 50.900 kHz 100.00 Hz | ||
82 | # Sync Width 1.483 us 0.058 ms | ||
83 | # 8 chars 3 lines | ||
84 | # Front Porch 0.927 us 0.019 ms | ||
85 | # 5 chars 1 lines | ||
86 | # Back Porch 2.409 us 0.475 ms | ||
87 | # 13 chars 25 lines | ||
88 | # Active Time 14.827 us 9.430 ms | ||
89 | # 80 chars 480 lines | ||
90 | # Blank Time 4.819 us 0.570 ms | ||
91 | # 26 chars 29 lines | ||
92 | # Polarity positive positive | ||
93 | # | ||
94 | mode "640x480-100" | ||
95 | # D: 43.163 MHz, H: 50.900 kHz, V: 100.00 Hz | ||
96 | geometry 640 480 640 480 32 timings 23168 104 40 25 1 64 3 endmode | ||
97 | # | ||
98 | # 640x480, 120 Hz, Non-Interlaced (52.406 MHz dotclock) | ||
99 | # | ||
100 | # Horizontal Vertical | ||
101 | # Resolution 640 480 | ||
102 | # Scan Frequency 61.800 kHz 120.00 Hz | ||
103 | # Sync Width 1.221 us 0.048 ms | ||
104 | # 8 chars 3 lines | ||
105 | # Front Porch 0.763 us 0.016 ms | ||
106 | # 5 chars 1 lines | ||
107 | # Back Porch 1.984 us 0.496 ms | ||
108 | # 13 chars 31 lines | ||
109 | # Active Time 12.212 us 7.767 ms | ||
110 | # 80 chars 480 lines | ||
111 | # Blank Time 3.969 us 0.566 ms | ||
112 | # 26 chars 35 lines | ||
113 | # Polarity positive positive | ||
114 | # | ||
115 | mode "640x480-120" | ||
116 | # D: 52.406 MHz, H: 61.800 kHz, V: 120.00 Hz | ||
117 | geometry 640 480 640 480 32 timings 19081 104 40 31 1 64 3 endmode | ||
118 | # | ||
119 | # 720x480, 60 Hz, Non-Interlaced (26.880 MHz dotclock) | ||
120 | # | ||
121 | # Horizontal Vertical | ||
122 | # Resolution 720 480 | ||
123 | # Scan Frequency 30.000 kHz 60.241 Hz | ||
124 | # Sync Width 2.679 us 0.099 ms | ||
125 | # 9 chars 3 lines | ||
126 | # Front Porch 0.595 us 0.033 ms | ||
127 | # 2 chars 1 lines | ||
128 | # Back Porch 3.274 us 0.462 ms | ||
129 | # 11 chars 14 lines | ||
130 | # Active Time 26.786 us 16.000 ms | ||
131 | # 90 chars 480 lines | ||
132 | # Blank Time 6.548 us 0.600 ms | ||
133 | # 22 chars 18 lines | ||
134 | # Polarity positive positive | ||
135 | # | ||
136 | mode "720x480-60" | ||
137 | # D: 26.880 MHz, H: 30.000 kHz, V: 60.24 Hz | ||
138 | geometry 720 480 720 480 32 timings 37202 88 16 14 1 72 3 endmode | ||
139 | # | ||
140 | # 800x480, 60 Hz, Non-Interlaced (29.581 MHz dotclock) | ||
141 | # | ||
142 | # Horizontal Vertical | ||
143 | # Resolution 800 480 | ||
144 | # Scan Frequency 29.892 kHz 60.00 Hz | ||
145 | # Sync Width 2.704 us 100.604 us | ||
146 | # 10 chars 3 lines | ||
147 | # Front Porch 0.541 us 33.535 us | ||
148 | # 2 chars 1 lines | ||
149 | # Back Porch 3.245 us 435.949 us | ||
150 | # 12 chars 13 lines | ||
151 | # Active Time 27.044 us 16.097 ms | ||
152 | # 100 chars 480 lines | ||
153 | # Blank Time 6.491 us 0.570 ms | ||
154 | # 24 chars 17 lines | ||
155 | # Polarity positive positive | ||
156 | # | ||
157 | mode "800x480-60" | ||
158 | # D: 29.500 MHz, H: 29.738 kHz, V: 60.00 Hz | ||
159 | geometry 800 480 800 480 32 timings 33805 96 24 10 3 72 7 endmode | ||
160 | # | ||
161 | # 720x576, 60 Hz, Non-Interlaced (32.668 MHz dotclock) | ||
162 | # | ||
163 | # Horizontal Vertical | ||
164 | # Resolution 720 576 | ||
165 | # Scan Frequency 35.820 kHz 60.00 Hz | ||
166 | # Sync Width 2.204 us 0.083 ms | ||
167 | # 9 chars 3 lines | ||
168 | # Front Porch 0.735 us 0.027 ms | ||
169 | # 3 chars 1 lines | ||
170 | # Back Porch 2.939 us 0.459 ms | ||
171 | # 12 chars 17 lines | ||
172 | # Active Time 22.040 us 16.080 ms | ||
173 | # 90 chars 476 lines | ||
174 | # Blank Time 5.877 us 0.586 ms | ||
175 | # 24 chars 21 lines | ||
176 | # Polarity positive positive | ||
177 | # | ||
178 | mode "720x576-60" | ||
179 | # D: 32.668 MHz, H: 35.820 kHz, V: 60.00 Hz | ||
180 | geometry 720 576 720 576 32 timings 30611 96 24 17 1 72 3 endmode | ||
181 | # | ||
182 | # 800x600, 60 Hz, Non-Interlaced (40.00 MHz dotclock) | ||
183 | # | ||
184 | # Horizontal Vertical | ||
185 | # Resolution 800 600 | ||
186 | # Scan Frequency 37.879 kHz 60.32 Hz | ||
187 | # Sync Width 3.200 us 0.106 ms | ||
188 | # 16 chars 4 lines | ||
189 | # Front Porch 1.000 us 0.026 ms | ||
190 | # 5 chars 1 lines | ||
191 | # Back Porch 2.200 us 0.607 ms | ||
192 | # 11 chars 23 lines | ||
193 | # Active Time 20.000 us 15.840 ms | ||
194 | # 100 chars 600 lines | ||
195 | # Blank Time 6.400 us 0.739 ms | ||
196 | # 32 chars 28 lines | ||
197 | # Polarity positive positive | ||
198 | # | ||
199 | mode "800x600-60" | ||
200 | # D: 40.00 MHz, H: 37.879 kHz, V: 60.32 Hz | ||
201 | geometry 800 600 800 600 32 | ||
202 | timings 25000 88 40 23 1 128 4 hsync high vsync high endmode | ||
203 | # | ||
204 | # 800x600, 75 Hz, Non-Interlaced (49.50 MHz dotclock) | ||
205 | # | ||
206 | # Horizontal Vertical | ||
207 | # Resolution 800 600 | ||
208 | # Scan Frequency 46.875 kHz 75.00 Hz | ||
209 | # Sync Width 1.616 us 0.064 ms | ||
210 | # 10 chars 3 lines | ||
211 | # Front Porch 0.323 us 0.021 ms | ||
212 | # 2 chars 1 lines | ||
213 | # Back Porch 3.232 us 0.448 ms | ||
214 | # 20 chars 21 lines | ||
215 | # Active Time 16.162 us 12.800 ms | ||
216 | # 100 chars 600 lines | ||
217 | # Blank Time 5.172 us 0.533 ms | ||
218 | # 32 chars 25 lines | ||
219 | # Polarity positive positive | ||
220 | # | ||
221 | mode "800x600-75" | ||
222 | # D: 49.50 MHz, H: 46.875 kHz, V: 75.00 Hz | ||
223 | geometry 800 600 800 600 32 | ||
224 | timings 20203 160 16 21 1 80 3 hsync high vsync high endmode | ||
225 | # | ||
226 | # 800x600, 85 Hz, Non-Interlaced (56.25 MHz dotclock) | ||
227 | # | ||
228 | # Horizontal Vertical | ||
229 | # Resolution 800 600 | ||
230 | # Scan Frequency 53.674 kHz 85.061 Hz | ||
231 | # Sync Width 1.138 us 0.056 ms | ||
232 | # 8 chars 3 lines | ||
233 | # Front Porch 0.569 us 0.019 ms | ||
234 | # 4 chars 1 lines | ||
235 | # Back Porch 2.702 us 0.503 ms | ||
236 | # 19 chars 27 lines | ||
237 | # Active Time 14.222 us 11.179 ms | ||
238 | # 100 chars 600 lines | ||
239 | # Blank Time 4.409 us 0.578 ms | ||
240 | # 31 chars 31 lines | ||
241 | # Polarity positive positive | ||
242 | # | ||
243 | mode "800x600-85" | ||
244 | # D: 56.25 MHz, H: 53.674 kHz, V: 85.061 Hz | ||
245 | geometry 800 600 800 600 32 | ||
246 | timings 17777 152 32 27 1 64 3 hsync high vsync high endmode | ||
247 | # | ||
248 | # 800x600, 100 Hz, Non-Interlaced (67.50 MHz dotclock) | ||
249 | # | ||
250 | # Horizontal Vertical | ||
251 | # Resolution 800 600 | ||
252 | # Scan Frequency 62.500 kHz 100.00 Hz | ||
253 | # Sync Width 0.948 us 0.064 ms | ||
254 | # 8 chars 4 lines | ||
255 | # Front Porch 0.000 us 0.112 ms | ||
256 | # 0 chars 7 lines | ||
257 | # Back Porch 3.200 us 0.224 ms | ||
258 | # 27 chars 14 lines | ||
259 | # Active Time 11.852 us 9.600 ms | ||
260 | # 100 chars 600 lines | ||
261 | # Blank Time 4.148 us 0.400 ms | ||
262 | # 35 chars 25 lines | ||
263 | # Polarity positive positive | ||
264 | # | ||
265 | mode "800x600-100" | ||
266 | # D: 67.50 MHz, H: 62.500 kHz, V: 100.00 Hz | ||
267 | geometry 800 600 800 600 32 | ||
268 | timings 14667 216 0 14 7 64 4 hsync high vsync high endmode | ||
269 | # | ||
270 | # 800x600, 120 Hz, Non-Interlaced (83.950 MHz dotclock) | ||
271 | # | ||
272 | # Horizontal Vertical | ||
273 | # Resolution 800 600 | ||
274 | # Scan Frequency 77.160 kHz 120.00 Hz | ||
275 | # Sync Width 1.048 us 0.039 ms | ||
276 | # 11 chars 3 lines | ||
277 | # Front Porch 0.667 us 0.013 ms | ||
278 | # 7 chars 1 lines | ||
279 | # Back Porch 1.715 us 0.507 ms | ||
280 | # 18 chars 39 lines | ||
281 | # Active Time 9.529 us 7.776 ms | ||
282 | # 100 chars 600 lines | ||
283 | # Blank Time 3.431 us 0.557 ms | ||
284 | # 36 chars 43 lines | ||
285 | # Polarity positive positive | ||
286 | # | ||
287 | mode "800x600-120" | ||
288 | # D: 83.950 MHz, H: 77.160 kHz, V: 120.00 Hz | ||
289 | geometry 800 600 800 600 32 | ||
290 | timings 11912 144 56 39 1 88 3 hsync high vsync high endmode | ||
291 | # | ||
292 | # 848x480, 60 Hz, Non-Interlaced (31.490 MHz dotclock) | ||
293 | # | ||
294 | # Horizontal Vertical | ||
295 | # Resolution 848 480 | ||
296 | # Scan Frequency 29.820 kHz 60.00 Hz | ||
297 | # Sync Width 2.795 us 0.099 ms | ||
298 | # 11 chars 3 lines | ||
299 | # Front Porch 0.508 us 0.033 ms | ||
300 | # 2 chars 1 lines | ||
301 | # Back Porch 3.303 us 0.429 ms | ||
302 | # 13 chars 13 lines | ||
303 | # Active Time 26.929 us 16.097 ms | ||
304 | # 106 chars 480 lines | ||
305 | # Blank Time 6.605 us 0.570 ms | ||
306 | # 26 chars 17 lines | ||
307 | # Polarity positive positive | ||
308 | # | ||
309 | mode "848x480-60" | ||
310 | # D: 31.500 MHz, H: 29.830 kHz, V: 60.00 Hz | ||
311 | geometry 848 480 848 480 32 | ||
312 | timings 31746 104 24 12 3 80 5 hsync high vsync high endmode | ||
313 | # | ||
314 | # 856x480, 60 Hz, Non-Interlaced (31.728 MHz dotclock) | ||
315 | # | ||
316 | # Horizontal Vertical | ||
317 | # Resolution 856 480 | ||
318 | # Scan Frequency 29.820 kHz 60.00 Hz | ||
319 | # Sync Width 2.774 us 0.099 ms | ||
320 | # 11 chars 3 lines | ||
321 | # Front Porch 0.504 us 0.033 ms | ||
322 | # 2 chars 1 lines | ||
323 | # Back Porch 3.728 us 0.429 ms | ||
324 | # 13 chars 13 lines | ||
325 | # Active Time 26.979 us 16.097 ms | ||
326 | # 107 chars 480 lines | ||
327 | # Blank Time 6.556 us 0.570 ms | ||
328 | # 26 chars 17 lines | ||
329 | # Polarity positive positive | ||
330 | # | ||
331 | mode "856x480-60" | ||
332 | # D: 31.728 MHz, H: 29.820 kHz, V: 60.00 Hz | ||
333 | geometry 856 480 856 480 32 | ||
334 | timings 31518 104 16 13 1 88 3 | ||
335 | hsync high vsync high endmode mode "960x600-60" | ||
336 | # D: 45.250 MHz, H: 37.212 kHz, V: 60.00 Hz | ||
337 | geometry 960 600 960 600 32 timings 22099 128 32 15 3 96 6 endmode | ||
338 | # | ||
339 | # 1000x600, 60 Hz, Non-Interlaced (48.068 MHz dotclock) | ||
340 | # | ||
341 | # Horizontal Vertical | ||
342 | # Resolution 1000 600 | ||
343 | # Scan Frequency 37.320 kHz 60.00 Hz | ||
344 | # Sync Width 2.164 us 0.080 ms | ||
345 | # 13 chars 3 lines | ||
346 | # Front Porch 0.832 us 0.027 ms | ||
347 | # 5 chars 1 lines | ||
348 | # Back Porch 2.996 us 0.483 ms | ||
349 | # 18 chars 18 lines | ||
350 | # Active Time 20.804 us 16.077 ms | ||
351 | # 125 chars 600 lines | ||
352 | # Blank Time 5.991 us 0.589 ms | ||
353 | # 36 chars 22 lines | ||
354 | # Polarity negative positive | ||
355 | # | ||
356 | mode "1000x600-60" | ||
357 | # D: 48.068 MHz, H: 37.320 kHz, V: 60.00 Hz | ||
358 | geometry 1000 600 1000 600 32 | ||
359 | timings 20834 144 40 18 1 104 3 endmode mode "1024x576-60" | ||
360 | # D: 46.996 MHz, H: 35.820 kHz, V: 60.00 Hz | ||
361 | geometry 1024 576 1024 576 32 | ||
362 | timings 21278 144 40 17 1 104 3 endmode mode "1024x600-60" | ||
363 | # D: 48.964 MHz, H: 37.320 kHz, V: 60.00 Hz | ||
364 | geometry 1024 600 1024 600 32 | ||
365 | timings 20461 144 40 18 1 104 3 endmode mode "1088x612-60" | ||
366 | # D: 52.952 MHz, H: 38.040 kHz, V: 60.00 Hz | ||
367 | geometry 1088 612 1088 612 32 timings 18877 152 48 16 3 104 5 endmode | ||
368 | # | ||
369 | # 1024x512, 60 Hz, Non-Interlaced (41.291 MHz dotclock) | ||
370 | # | ||
371 | # Horizontal Vertical | ||
372 | # Resolution 1024 512 | ||
373 | # Scan Frequency 31.860 kHz 60.00 Hz | ||
374 | # Sync Width 2.519 us 0.094 ms | ||
375 | # 13 chars 3 lines | ||
376 | # Front Porch 0.775 us 0.031 ms | ||
377 | # 4 chars 1 lines | ||
378 | # Back Porch 3.294 us 0.465 ms | ||
379 | # 17 chars 15 lines | ||
380 | # Active Time 24.800 us 16.070 ms | ||
381 | # 128 chars 512 lines | ||
382 | # Blank Time 6.587 us 0.596 ms | ||
383 | # 34 chars 19 lines | ||
384 | # Polarity positive positive | ||
385 | # | ||
386 | mode "1024x512-60" | ||
387 | # D: 41.291 MHz, H: 31.860 kHz, V: 60.00 Hz | ||
388 | geometry 1024 512 1024 512 32 | ||
389 | timings 24218 126 32 15 1 104 3 hsync high vsync high endmode | ||
390 | # | ||
391 | # 1024x600, 60 Hz, Non-Interlaced (48.875 MHz dotclock) | ||
392 | # | ||
393 | # Horizontal Vertical | ||
394 | # Resolution 1024 768 | ||
395 | # Scan Frequency 37.252 kHz 60.00 Hz | ||
396 | # Sync Width 2.128 us 80.532us | ||
397 | # 13 chars 3 lines | ||
398 | # Front Porch 0.818 us 26.844 us | ||
399 | # 5 chars 1 lines | ||
400 | # Back Porch 2.946 us 483.192 us | ||
401 | # 18 chars 18 lines | ||
402 | # Active Time 20.951 us 16.697 ms | ||
403 | # 128 chars 622 lines | ||
404 | # Blank Time 5.893 us 0.591 ms | ||
405 | # 36 chars 22 lines | ||
406 | # Polarity negative positive | ||
407 | # | ||
408 | #mode "1024x600-60" | ||
409 | # # D: 48.875 MHz, H: 37.252 kHz, V: 60.00 Hz | ||
410 | # geometry 1024 600 1024 600 32 | ||
411 | # timings 20460 144 40 18 1 104 3 | ||
412 | # endmode | ||
413 | # | ||
414 | # 1024x768, 60 Hz, Non-Interlaced (65.00 MHz dotclock) | ||
415 | # | ||
416 | # Horizontal Vertical | ||
417 | # Resolution 1024 768 | ||
418 | # Scan Frequency 48.363 kHz 60.00 Hz | ||
419 | # Sync Width 2.092 us 0.124 ms | ||
420 | # 17 chars 6 lines | ||
421 | # Front Porch 0.369 us 0.062 ms | ||
422 | # 3 chars 3 lines | ||
423 | # Back Porch 2.462 us 0.601 ms | ||
424 | # 20 chars 29 lines | ||
425 | # Active Time 15.754 us 15.880 ms | ||
426 | # 128 chars 768 lines | ||
427 | # Blank Time 4.923 us 0.786 ms | ||
428 | # 40 chars 38 lines | ||
429 | # Polarity negative negative | ||
430 | # | ||
431 | mode "1024x768-60" | ||
432 | # D: 65.00 MHz, H: 48.363 kHz, V: 60.00 Hz | ||
433 | geometry 1024 768 1024 768 32 timings 15385 160 24 29 3 136 6 endmode | ||
434 | # | ||
435 | # 1024x768, 75 Hz, Non-Interlaced (78.75 MHz dotclock) | ||
436 | # | ||
437 | # Horizontal Vertical | ||
438 | # Resolution 1024 768 | ||
439 | # Scan Frequency 60.023 kHz 75.03 Hz | ||
440 | # Sync Width 1.219 us 0.050 ms | ||
441 | # 12 chars 3 lines | ||
442 | # Front Porch 0.203 us 0.017 ms | ||
443 | # 2 chars 1 lines | ||
444 | # Back Porch 2.235 us 0.466 ms | ||
445 | # 22 chars 28 lines | ||
446 | # Active Time 13.003 us 12.795 ms | ||
447 | # 128 chars 768 lines | ||
448 | # Blank Time 3.657 us 0.533 ms | ||
449 | # 36 chars 32 lines | ||
450 | # Polarity positive positive | ||
451 | # | ||
452 | mode "1024x768-75" | ||
453 | # D: 78.75 MHz, H: 60.023 kHz, V: 75.03 Hz | ||
454 | geometry 1024 768 1024 768 32 | ||
455 | timings 12699 176 16 28 1 96 3 hsync high vsync high endmode | ||
456 | # | ||
457 | # 1024x768, 85 Hz, Non-Interlaced (94.50 MHz dotclock) | ||
458 | # | ||
459 | # Horizontal Vertical | ||
460 | # Resolution 1024 768 | ||
461 | # Scan Frequency 68.677 kHz 85.00 Hz | ||
462 | # Sync Width 1.016 us 0.044 ms | ||
463 | # 12 chars 3 lines | ||
464 | # Front Porch 0.508 us 0.015 ms | ||
465 | # 6 chars 1 lines | ||
466 | # Back Porch 2.201 us 0.524 ms | ||
467 | # 26 chars 36 lines | ||
468 | # Active Time 10.836 us 11.183 ms | ||
469 | # 128 chars 768 lines | ||
470 | # Blank Time 3.725 us 0.582 ms | ||
471 | # 44 chars 40 lines | ||
472 | # Polarity positive positive | ||
473 | # | ||
474 | mode "1024x768-85" | ||
475 | # D: 94.50 MHz, H: 68.677 kHz, V: 85.00 Hz | ||
476 | geometry 1024 768 1024 768 32 | ||
477 | timings 10582 208 48 36 1 96 3 hsync high vsync high endmode | ||
478 | # | ||
479 | # 1024x768, 100 Hz, Non-Interlaced (110.0 MHz dotclock) | ||
480 | # | ||
481 | # Horizontal Vertical | ||
482 | # Resolution 1024 768 | ||
483 | # Scan Frequency 79.023 kHz 99.78 Hz | ||
484 | # Sync Width 0.800 us 0.101 ms | ||
485 | # 11 chars 8 lines | ||
486 | # Front Porch 0.000 us 0.000 ms | ||
487 | # 0 chars 0 lines | ||
488 | # Back Porch 2.545 us 0.202 ms | ||
489 | # 35 chars 16 lines | ||
490 | # Active Time 9.309 us 9.719 ms | ||
491 | # 128 chars 768 lines | ||
492 | # Blank Time 3.345 us 0.304 ms | ||
493 | # 46 chars 24 lines | ||
494 | # Polarity negative negative | ||
495 | # | ||
496 | mode "1024x768-100" | ||
497 | # D: 113.3 MHz, H: 79.023 kHz, V: 99.78 Hz | ||
498 | geometry 1024 768 1024 768 32 | ||
499 | timings 8825 280 0 16 0 88 8 endmode mode "1152x720-60" | ||
500 | # D: 66.750 MHz, H: 44.859 kHz, V: 60.00 Hz | ||
501 | geometry 1152 720 1152 720 32 timings 14981 168 56 19 3 112 6 endmode | ||
502 | # | ||
503 | # 1152x864, 75 Hz, Non-Interlaced (110.0 MHz dotclock) | ||
504 | # | ||
505 | # Horizontal Vertical | ||
506 | # Resolution 1152 864 | ||
507 | # Scan Frequency 75.137 kHz 74.99 Hz | ||
508 | # Sync Width 1.309 us 0.106 ms | ||
509 | # 18 chars 8 lines | ||
510 | # Front Porch 0.245 us 0.599 ms | ||
511 | # 3 chars 45 lines | ||
512 | # Back Porch 1.282 us 1.132 ms | ||
513 | # 18 chars 85 lines | ||
514 | # Active Time 10.473 us 11.499 ms | ||
515 | # 144 chars 864 lines | ||
516 | # Blank Time 2.836 us 1.837 ms | ||
517 | # 39 chars 138 lines | ||
518 | # Polarity positive positive | ||
519 | # | ||
520 | mode "1152x864-75" | ||
521 | # D: 110.0 MHz, H: 75.137 kHz, V: 74.99 Hz | ||
522 | geometry 1152 864 1152 864 32 | ||
523 | timings 9259 144 24 85 45 144 8 | ||
524 | hsync high vsync high endmode mode "1200x720-60" | ||
525 | # D: 70.184 MHz, H: 44.760 kHz, V: 60.00 Hz | ||
526 | geometry 1200 720 1200 720 32 | ||
527 | timings 14253 184 28 22 1 128 3 endmode mode "1280x600-60" | ||
528 | # D: 61.503 MHz, H: 37.320 kHz, V: 60.00 Hz | ||
529 | geometry 1280 600 1280 600 32 | ||
530 | timings 16260 184 28 18 1 128 3 endmode mode "1280x720-50" | ||
531 | # D: 60.466 MHz, H: 37.050 kHz, V: 50.00 Hz | ||
532 | geometry 1280 720 1280 720 32 | ||
533 | timings 16538 176 48 17 1 128 3 endmode mode "1280x768-50" | ||
534 | # D: 65.178 MHz, H: 39.550 kHz, V: 50.00 Hz | ||
535 | geometry 1280 768 1280 768 32 timings 15342 184 28 19 1 128 3 endmode | ||
536 | # | ||
537 | # 1280x768, 60 Hz, Non-Interlaced (80.136 MHz dotclock) | ||
538 | # | ||
539 | # Horizontal Vertical | ||
540 | # Resolution 1280 768 | ||
541 | # Scan Frequency 47.700 kHz 60.00 Hz | ||
542 | # Sync Width 1.697 us 0.063 ms | ||
543 | # 17 chars 3 lines | ||
544 | # Front Porch 0.799 us 0.021 ms | ||
545 | # 8 chars 1 lines | ||
546 | # Back Porch 2.496 us 0.483 ms | ||
547 | # 25 chars 23 lines | ||
548 | # Active Time 15.973 us 16.101 ms | ||
549 | # 160 chars 768 lines | ||
550 | # Blank Time 4.992 us 0.566 ms | ||
551 | # 50 chars 27 lines | ||
552 | # Polarity positive positive | ||
553 | # | ||
554 | mode "1280x768-60" | ||
555 | # D: 80.13 MHz, H: 47.700 kHz, V: 60.00 Hz | ||
556 | geometry 1280 768 1280 768 32 | ||
557 | timings 12480 200 48 23 1 126 3 hsync high vsync high endmode | ||
558 | # | ||
559 | # 1280x800, 60 Hz, Non-Interlaced (83.375 MHz dotclock) | ||
560 | # | ||
561 | # Horizontal Vertical | ||
562 | # Resolution 1280 800 | ||
563 | # Scan Frequency 49.628 kHz 60.00 Hz | ||
564 | # Sync Width 1.631 us 60.450 us | ||
565 | # 17 chars 3 lines | ||
566 | # Front Porch 0.768 us 20.15 us | ||
567 | # 8 chars 1 lines | ||
568 | # Back Porch 2.399 us 0.483 ms | ||
569 | # 25 chars 24 lines | ||
570 | # Active Time 15.352 us 16.120 ms | ||
571 | # 160 chars 800 lines | ||
572 | # Blank Time 4.798 us 0.564 ms | ||
573 | # 50 chars 28 lines | ||
574 | # Polarity negtive positive | ||
575 | # | ||
576 | mode "1280x800-60" | ||
577 | # D: 83.500 MHz, H: 49.702 kHz, V: 60.00 Hz | ||
578 | geometry 1280 800 1280 800 32 timings 11994 200 72 22 3 128 6 endmode | ||
579 | # | ||
580 | # 1280x960, 60 Hz, Non-Interlaced (108.00 MHz dotclock) | ||
581 | # | ||
582 | # Horizontal Vertical | ||
583 | # Resolution 1280 960 | ||
584 | # Scan Frequency 60.000 kHz 60.00 Hz | ||
585 | # Sync Width 1.037 us 0.050 ms | ||
586 | # 14 chars 3 lines | ||
587 | # Front Porch 0.889 us 0.017 ms | ||
588 | # 12 chars 1 lines | ||
589 | # Back Porch 2.889 us 0.600 ms | ||
590 | # 39 chars 36 lines | ||
591 | # Active Time 11.852 us 16.000 ms | ||
592 | # 160 chars 960 lines | ||
593 | # Blank Time 4.815 us 0.667 ms | ||
594 | # 65 chars 40 lines | ||
595 | # Polarity positive positive | ||
596 | # | ||
597 | mode "1280x960-60" | ||
598 | # D: 108.00 MHz, H: 60.000 kHz, V: 60.00 Hz | ||
599 | geometry 1280 960 1280 960 32 | ||
600 | timings 9259 312 96 36 1 112 3 hsync high vsync high endmode | ||
601 | # | ||
602 | # 1280x1024, 60 Hz, Non-Interlaced (108.00 MHz dotclock) | ||
603 | # | ||
604 | # Horizontal Vertical | ||
605 | # Resolution 1280 1024 | ||
606 | # Scan Frequency 63.981 kHz 60.02 Hz | ||
607 | # Sync Width 1.037 us 0.047 ms | ||
608 | # 14 chars 3 lines | ||
609 | # Front Porch 0.444 us 0.015 ms | ||
610 | # 6 chars 1 lines | ||
611 | # Back Porch 2.297 us 0.594 ms | ||
612 | # 31 chars 38 lines | ||
613 | # Active Time 11.852 us 16.005 ms | ||
614 | # 160 chars 1024 lines | ||
615 | # Blank Time 3.778 us 0.656 ms | ||
616 | # 51 chars 42 lines | ||
617 | # Polarity positive positive | ||
618 | # | ||
619 | mode "1280x1024-60" | ||
620 | # D: 108.00 MHz, H: 63.981 kHz, V: 60.02 Hz | ||
621 | geometry 1280 1024 1280 1024 32 | ||
622 | timings 9260 248 48 38 1 112 3 hsync high vsync high endmode | ||
623 | # | ||
624 | # 1280x1024, 75 Hz, Non-Interlaced (135.00 MHz dotclock) | ||
625 | # | ||
626 | # Horizontal Vertical | ||
627 | # Resolution 1280 1024 | ||
628 | # Scan Frequency 79.976 kHz 75.02 Hz | ||
629 | # Sync Width 1.067 us 0.038 ms | ||
630 | # 18 chars 3 lines | ||
631 | # Front Porch 0.119 us 0.012 ms | ||
632 | # 2 chars 1 lines | ||
633 | # Back Porch 1.837 us 0.475 ms | ||
634 | # 31 chars 38 lines | ||
635 | # Active Time 9.481 us 12.804 ms | ||
636 | # 160 chars 1024 lines | ||
637 | # Blank Time 3.022 us 0.525 ms | ||
638 | # 51 chars 42 lines | ||
639 | # Polarity positive positive | ||
640 | # | ||
641 | mode "1280x1024-75" | ||
642 | # D: 135.00 MHz, H: 79.976 kHz, V: 75.02 Hz | ||
643 | geometry 1280 1024 1280 1024 32 | ||
644 | timings 7408 248 16 38 1 144 3 hsync high vsync high endmode | ||
645 | # | ||
646 | # 1280x1024, 85 Hz, Non-Interlaced (157.50 MHz dotclock) | ||
647 | # | ||
648 | # Horizontal Vertical | ||
649 | # Resolution 1280 1024 | ||
650 | # Scan Frequency 91.146 kHz 85.02 Hz | ||
651 | # Sync Width 1.016 us 0.033 ms | ||
652 | # 20 chars 3 lines | ||
653 | # Front Porch 0.406 us 0.011 ms | ||
654 | # 8 chars 1 lines | ||
655 | # Back Porch 1.422 us 0.483 ms | ||
656 | # 28 chars 44 lines | ||
657 | # Active Time 8.127 us 11.235 ms | ||
658 | # 160 chars 1024 lines | ||
659 | # Blank Time 2.844 us 0.527 ms | ||
660 | # 56 chars 48 lines | ||
661 | # Polarity positive positive | ||
662 | # | ||
663 | mode "1280x1024-85" | ||
664 | # D: 157.50 MHz, H: 91.146 kHz, V: 85.02 Hz | ||
665 | geometry 1280 1024 1280 1024 32 | ||
666 | timings 6349 224 64 44 1 160 3 | ||
667 | hsync high vsync high endmode mode "1440x900-60" | ||
668 | # D: 106.500 MHz, H: 55.935 kHz, V: 60.00 Hz | ||
669 | geometry 1440 900 1440 900 32 | ||
670 | timings 9390 232 80 25 3 152 6 | ||
671 | hsync high vsync high endmode mode "1440x900-75" | ||
672 | # D: 136.750 MHz, H: 70.635 kHz, V: 75.00 Hz | ||
673 | geometry 1440 900 1440 900 32 | ||
674 | timings 7315 248 96 33 3 152 6 hsync high vsync high endmode | ||
675 | # | ||
676 | # 1440x1050, 60 Hz, Non-Interlaced (125.10 MHz dotclock) | ||
677 | # | ||
678 | # Horizontal Vertical | ||
679 | # Resolution 1440 1050 | ||
680 | # Scan Frequency 65.220 kHz 60.00 Hz | ||
681 | # Sync Width 1.204 us 0.046 ms | ||
682 | # 19 chars 3 lines | ||
683 | # Front Porch 0.760 us 0.015 ms | ||
684 | # 12 chars 1 lines | ||
685 | # Back Porch 1.964 us 0.495 ms | ||
686 | # 31 chars 33 lines | ||
687 | # Active Time 11.405 us 16.099 ms | ||
688 | # 180 chars 1050 lines | ||
689 | # Blank Time 3.928 us 0.567 ms | ||
690 | # 62 chars 37 lines | ||
691 | # Polarity positive positive | ||
692 | # | ||
693 | mode "1440x1050-60" | ||
694 | # D: 125.10 MHz, H: 65.220 kHz, V: 60.00 Hz | ||
695 | geometry 1440 1050 1440 1050 32 | ||
696 | timings 7993 248 96 33 1 152 3 | ||
697 | hsync high vsync high endmode mode "1600x900-60" | ||
698 | # D: 118.250 MHz, H: 55.990 kHz, V: 60.00 Hz | ||
699 | geometry 1600 900 1600 900 32 | ||
700 | timings 8415 256 88 26 3 168 5 endmode mode "1600x1024-60" | ||
701 | # D: 136.358 MHz, H: 63.600 kHz, V: 60.00 Hz | ||
702 | geometry 1600 1024 1600 1024 32 timings 7315 272 104 32 1 168 3 endmode | ||
703 | # | ||
704 | # 1600x1200, 60 Hz, Non-Interlaced (156.00 MHz dotclock) | ||
705 | # | ||
706 | # Horizontal Vertical | ||
707 | # Resolution 1600 1200 | ||
708 | # Scan Frequency 76.200 kHz 60.00 Hz | ||
709 | # Sync Width 1.026 us 0.105 ms | ||
710 | # 20 chars 8 lines | ||
711 | # Front Porch 0.205 us 0.131 ms | ||
712 | # 4 chars 10 lines | ||
713 | # Back Porch 1.636 us 0.682 ms | ||
714 | # 32 chars 52 lines | ||
715 | # Active Time 10.256 us 15.748 ms | ||
716 | # 200 chars 1200 lines | ||
717 | # Blank Time 2.872 us 0.866 ms | ||
718 | # 56 chars 66 lines | ||
719 | # Polarity negative negative | ||
720 | # | ||
721 | mode "1600x1200-60" | ||
722 | # D: 156.00 MHz, H: 76.200 kHz, V: 60.00 Hz | ||
723 | geometry 1600 1200 1600 1200 32 timings 6172 256 32 52 10 160 8 endmode | ||
724 | # | ||
725 | # 1600x1200, 75 Hz, Non-Interlaced (202.50 MHz dotclock) | ||
726 | # | ||
727 | # Horizontal Vertical | ||
728 | # Resolution 1600 1200 | ||
729 | # Scan Frequency 93.750 kHz 75.00 Hz | ||
730 | # Sync Width 0.948 us 0.032 ms | ||
731 | # 24 chars 3 lines | ||
732 | # Front Porch 0.316 us 0.011 ms | ||
733 | # 8 chars 1 lines | ||
734 | # Back Porch 1.501 us 0.491 ms | ||
735 | # 38 chars 46 lines | ||
736 | # Active Time 7.901 us 12.800 ms | ||
737 | # 200 chars 1200 lines | ||
738 | # Blank Time 2.765 us 0.533 ms | ||
739 | # 70 chars 50 lines | ||
740 | # Polarity positive positive | ||
741 | # | ||
742 | mode "1600x1200-75" | ||
743 | # D: 202.50 MHz, H: 93.750 kHz, V: 75.00 Hz | ||
744 | geometry 1600 1200 1600 1200 32 | ||
745 | timings 4938 304 64 46 1 192 3 | ||
746 | hsync high vsync high endmode mode "1680x1050-60" | ||
747 | # D: 146.250 MHz, H: 65.290 kHz, V: 59.954 Hz | ||
748 | geometry 1680 1050 1680 1050 32 | ||
749 | timings 6814 280 104 30 3 176 6 | ||
750 | hsync high vsync high endmode mode "1680x1050-75" | ||
751 | # D: 187.000 MHz, H: 82.306 kHz, V: 74.892 Hz | ||
752 | geometry 1680 1050 1680 1050 32 | ||
753 | timings 5348 296 120 40 3 176 6 | ||
754 | hsync high vsync high endmode mode "1792x1344-60" | ||
755 | # D: 202.975 MHz, H: 83.460 kHz, V: 60.00 Hz | ||
756 | geometry 1792 1344 1792 1344 32 | ||
757 | timings 4902 320 128 43 1 192 3 | ||
758 | hsync high vsync high endmode mode "1856x1392-60" | ||
759 | # D: 218.571 MHz, H: 86.460 kHz, V: 60.00 Hz | ||
760 | geometry 1856 1392 1856 1392 32 | ||
761 | timings 4577 336 136 45 1 200 3 | ||
762 | hsync high vsync high endmode mode "1920x1200-60" | ||
763 | # D: 193.250 MHz, H: 74.556 kHz, V: 60.00 Hz | ||
764 | geometry 1920 1200 1920 1200 32 | ||
765 | timings 5173 336 136 36 3 200 6 | ||
766 | hsync high vsync high endmode mode "1920x1440-60" | ||
767 | # D: 234.000 MHz, H:90.000 kHz, V: 60.00 Hz | ||
768 | geometry 1920 1440 1920 1440 32 | ||
769 | timings 4274 344 128 56 1 208 3 | ||
770 | hsync high vsync high endmode mode "1920x1440-75" | ||
771 | # D: 297.000 MHz, H:112.500 kHz, V: 75.00 Hz | ||
772 | geometry 1920 1440 1920 1440 32 | ||
773 | timings 3367 352 144 56 1 224 3 | ||
774 | hsync high vsync high endmode mode "2048x1536-60" | ||
775 | # D: 267.250 MHz, H: 95.446 kHz, V: 60.00 Hz | ||
776 | geometry 2048 1536 2048 1536 32 | ||
777 | timings 3742 376 152 49 3 224 4 hsync high vsync high endmode | ||
778 | # | ||
779 | # 1280x720, 60 Hz, Non-Interlaced (74.481 MHz dotclock) | ||
780 | # | ||
781 | # Horizontal Vertical | ||
782 | # Resolution 1280 720 | ||
783 | # Scan Frequency 44.760 kHz 60.00 Hz | ||
784 | # Sync Width 1.826 us 67.024 ms | ||
785 | # 17 chars 3 lines | ||
786 | # Front Porch 0.752 us 22.341 ms | ||
787 | # 7 chars 1 lines | ||
788 | # Back Porch 2.578 us 491.510 ms | ||
789 | # 24 chars 22 lines | ||
790 | # Active Time 17.186 us 16.086 ms | ||
791 | # 160 chars 720 lines | ||
792 | # Blank Time 5.156 us 0.581 ms | ||
793 | # 48 chars 26 lines | ||
794 | # Polarity negative negative | ||
795 | # | ||
796 | mode "1280x720-60" | ||
797 | # D: 74.481 MHz, H: 44.760 kHz, V: 60.00 Hz | ||
798 | geometry 1280 720 1280 720 32 timings 13426 192 64 22 1 136 3 endmode | ||
799 | # | ||
800 | # 1920x1080, 60 Hz, Non-Interlaced (172.798 MHz dotclock) | ||
801 | # | ||
802 | # Horizontal Vertical | ||
803 | # Resolution 1920 1080 | ||
804 | # Scan Frequency 67.080 kHz 60.00 Hz | ||
805 | # Sync Width 1.204 us 44.723 ms | ||
806 | # 26 chars 3 lines | ||
807 | # Front Porch 0.694 us 14.908 ms | ||
808 | # 15 chars 1 lines | ||
809 | # Back Porch 1.898 us 506.857 ms | ||
810 | # 41 chars 34 lines | ||
811 | # Active Time 11.111 us 16.100 ms | ||
812 | # 240 chars 1080 lines | ||
813 | # Blank Time 3.796 us 0.566 ms | ||
814 | # 82 chars 38 lines | ||
815 | # Polarity negative negative | ||
816 | # | ||
817 | mode "1920x1080-60" | ||
818 | # D: 74.481 MHz, H: 67.080 kHz, V: 60.00 Hz | ||
819 | geometry 1920 1080 1920 1080 32 timings 5787 328 120 34 1 208 3 endmode | ||
820 | # | ||
821 | # 1400x1050, 60 Hz, Non-Interlaced (122.61 MHz dotclock) | ||
822 | # | ||
823 | # Horizontal Vertical | ||
824 | # Resolution 1400 1050 | ||
825 | # Scan Frequency 65.218 kHz 59.99 Hz | ||
826 | # Sync Width 1.037 us 0.047 ms | ||
827 | # 19 chars 3 lines | ||
828 | # Front Porch 0.444 us 0.015 ms | ||
829 | # 11 chars 1 lines | ||
830 | # Back Porch 1.185 us 0.188 ms | ||
831 | # 30 chars 33 lines | ||
832 | # Active Time 12.963 us 16.411 ms | ||
833 | # 175 chars 1050 lines | ||
834 | # Blank Time 2.667 us 0.250 ms | ||
835 | # 60 chars 37 lines | ||
836 | # Polarity negative positive | ||
837 | # | ||
838 | mode "1400x1050-60" | ||
839 | # D: 122.750 MHz, H: 65.317 kHz, V: 59.99 Hz | ||
840 | geometry 1400 1050 1408 1050 32 | ||
841 | timings 8214 232 88 32 3 144 4 endmode mode "1400x1050-75" | ||
842 | # D: 156.000 MHz, H: 82.278 kHz, V: 74.867 Hz | ||
843 | geometry 1400 1050 1408 1050 32 timings 6410 248 104 42 3 144 4 endmode | ||
844 | # | ||
845 | # 1366x768, 60 Hz, Non-Interlaced (85.86 MHz dotclock) | ||
846 | # | ||
847 | # Horizontal Vertical | ||
848 | # Resolution 1366 768 | ||
849 | # Scan Frequency 47.700 kHz 60.00 Hz | ||
850 | # Sync Width 1.677 us 0.063 ms | ||
851 | # 18 chars 3 lines | ||
852 | # Front Porch 0.839 us 0.021 ms | ||
853 | # 9 chars 1 lines | ||
854 | # Back Porch 2.516 us 0.482 ms | ||
855 | # 27 chars 23 lines | ||
856 | # Active Time 15.933 us 16.101 ms | ||
857 | # 171 chars 768 lines | ||
858 | # Blank Time 5.031 us 0.566 ms | ||
859 | # 54 chars 27 lines | ||
860 | # Polarity negative positive | ||
861 | # | ||
862 | mode "1360x768-60" | ||
863 | # D: 84.750 MHz, H: 47.720 kHz, V: 60.00 Hz | ||
864 | geometry 1360 768 1360 768 32 | ||
865 | timings 11799 208 72 22 3 136 5 endmode mode "1366x768-60" | ||
866 | # D: 85.86 MHz, H: 47.700 kHz, V: 60.00 Hz | ||
867 | geometry 1366 768 1366 768 32 | ||
868 | timings 11647 216 72 23 1 144 3 endmode mode "1366x768-50" | ||
869 | # D: 69,924 MHz, H: 39.550 kHz, V: 50.00 Hz | ||
870 | geometry 1366 768 1366 768 32 timings 14301 200 56 19 1 144 3 endmode | ||
diff --git a/Documentation/fb/viafb.txt b/Documentation/fb/viafb.txt new file mode 100644 index 00000000000..67dbf442b0b --- /dev/null +++ b/Documentation/fb/viafb.txt | |||
@@ -0,0 +1,214 @@ | |||
1 | |||
2 | VIA Integration Graphic Chip Console Framebuffer Driver | ||
3 | |||
4 | [Platform] | ||
5 | ----------------------- | ||
6 | The console framebuffer driver is for graphics chips of | ||
7 | VIA UniChrome Family(CLE266, PM800 / CN400 / CN300, | ||
8 | P4M800CE / P4M800Pro / CN700 / VN800, | ||
9 | CX700 / VX700, K8M890, P4M890, | ||
10 | CN896 / P4M900, VX800) | ||
11 | |||
12 | [Driver features] | ||
13 | ------------------------ | ||
14 | Device: CRT, LCD, DVI | ||
15 | |||
16 | Support viafb_mode: | ||
17 | CRT: | ||
18 | 640x480(60, 75, 85, 100, 120 Hz), 720x480(60 Hz), | ||
19 | 720x576(60 Hz), 800x600(60, 75, 85, 100, 120 Hz), | ||
20 | 848x480(60 Hz), 856x480(60 Hz), 1024x512(60 Hz), | ||
21 | 1024x768(60, 75, 85, 100 Hz), 1152x864(75 Hz), | ||
22 | 1280x768(60 Hz), 1280x960(60 Hz), 1280x1024(60, 75, 85 Hz), | ||
23 | 1440x1050(60 Hz), 1600x1200(60, 75 Hz), 1280x720(60 Hz), | ||
24 | 1920x1080(60 Hz), 1400x1050(60 Hz), 800x480(60 Hz) | ||
25 | |||
26 | color depth: 8 bpp, 16 bpp, 32 bpp supports. | ||
27 | |||
28 | Support 2D hardware accelerator. | ||
29 | |||
30 | [Using the viafb module] | ||
31 | -- -- -------------------- | ||
32 | Start viafb with default settings: | ||
33 | #modprobe viafb | ||
34 | |||
35 | Start viafb with with user options: | ||
36 | #modprobe viafb viafb_mode=800x600 viafb_bpp=16 viafb_refresh=60 | ||
37 | viafb_active_dev=CRT+DVI viafb_dvi_port=DVP1 | ||
38 | viafb_mode1=1024x768 viafb_bpp=16 viafb_refresh1=60 | ||
39 | viafb_SAMM_ON=1 | ||
40 | |||
41 | viafb_mode: | ||
42 | 640x480 (default) | ||
43 | 720x480 | ||
44 | 800x600 | ||
45 | 1024x768 | ||
46 | ...... | ||
47 | |||
48 | viafb_bpp: | ||
49 | 8, 16, 32 (default:32) | ||
50 | |||
51 | viafb_refresh: | ||
52 | 60, 75, 85, 100, 120 (default:60) | ||
53 | |||
54 | viafb_lcd_dsp_method: | ||
55 | 0 : expansion (default) | ||
56 | 1 : centering | ||
57 | |||
58 | viafb_lcd_mode: | ||
59 | 0 : LCD panel with LSB data format input (default) | ||
60 | 1 : LCD panel with MSB data format input | ||
61 | |||
62 | viafb_lcd_panel_id: | ||
63 | 0 : Resolution: 640x480, Channel: single, Dithering: Enable | ||
64 | 1 : Resolution: 800x600, Channel: single, Dithering: Enable | ||
65 | 2 : Resolution: 1024x768, Channel: single, Dithering: Enable (default) | ||
66 | 3 : Resolution: 1280x768, Channel: single, Dithering: Enable | ||
67 | 4 : Resolution: 1280x1024, Channel: dual, Dithering: Enable | ||
68 | 5 : Resolution: 1400x1050, Channel: dual, Dithering: Enable | ||
69 | 6 : Resolution: 1600x1200, Channel: dual, Dithering: Enable | ||
70 | |||
71 | 8 : Resolution: 800x480, Channel: single, Dithering: Enable | ||
72 | 9 : Resolution: 1024x768, Channel: dual, Dithering: Enable | ||
73 | 10: Resolution: 1024x768, Channel: single, Dithering: Disable | ||
74 | 11: Resolution: 1024x768, Channel: dual, Dithering: Disable | ||
75 | 12: Resolution: 1280x768, Channel: single, Dithering: Disable | ||
76 | 13: Resolution: 1280x1024, Channel: dual, Dithering: Disable | ||
77 | 14: Resolution: 1400x1050, Channel: dual, Dithering: Disable | ||
78 | 15: Resolution: 1600x1200, Channel: dual, Dithering: Disable | ||
79 | 16: Resolution: 1366x768, Channel: single, Dithering: Disable | ||
80 | 17: Resolution: 1024x600, Channel: single, Dithering: Enable | ||
81 | 18: Resolution: 1280x768, Channel: dual, Dithering: Enable | ||
82 | 19: Resolution: 1280x800, Channel: single, Dithering: Enable | ||
83 | |||
84 | viafb_accel: | ||
85 | 0 : No 2D Hardware Acceleration | ||
86 | 1 : 2D Hardware Acceleration (default) | ||
87 | |||
88 | viafb_SAMM_ON: | ||
89 | 0 : viafb_SAMM_ON disable (default) | ||
90 | 1 : viafb_SAMM_ON enable | ||
91 | |||
92 | viafb_mode1: (secondary display device) | ||
93 | 640x480 (default) | ||
94 | 720x480 | ||
95 | 800x600 | ||
96 | 1024x768 | ||
97 | ... ... | ||
98 | |||
99 | viafb_bpp1: (secondary display device) | ||
100 | 8, 16, 32 (default:32) | ||
101 | |||
102 | viafb_refresh1: (secondary display device) | ||
103 | 60, 75, 85, 100, 120 (default:60) | ||
104 | |||
105 | viafb_active_dev: | ||
106 | This option is used to specify active devices.(CRT, DVI, CRT+LCD...) | ||
107 | DVI stands for DVI or HDMI, E.g., If you want to enable HDMI, | ||
108 | set viafb_active_dev=DVI. In SAMM case, the previous of | ||
109 | viafb_active_dev is primary device, and the following is | ||
110 | secondary device. | ||
111 | |||
112 | For example: | ||
113 | To enable one device, such as DVI only, we can use: | ||
114 | modprobe viafb viafb_active_dev=DVI | ||
115 | To enable two devices, such as CRT+DVI: | ||
116 | modprobe viafb viafb_active_dev=CRT+DVI; | ||
117 | |||
118 | For DuoView case, we can use: | ||
119 | modprobe viafb viafb_active_dev=CRT+DVI | ||
120 | OR | ||
121 | modprobe viafb viafb_active_dev=DVI+CRT... | ||
122 | |||
123 | For SAMM case: | ||
124 | If CRT is primary and DVI is secondary, we should use: | ||
125 | modprobe viafb viafb_active_dev=CRT+DVI viafb_SAMM_ON=1... | ||
126 | If DVI is primary and CRT is secondary, we should use: | ||
127 | modprobe viafb viafb_active_dev=DVI+CRT viafb_SAMM_ON=1... | ||
128 | |||
129 | viafb_display_hardware_layout: | ||
130 | This option is used to specify display hardware layout for CX700 chip. | ||
131 | 1 : LCD only | ||
132 | 2 : DVI only | ||
133 | 3 : LCD+DVI (default) | ||
134 | 4 : LCD1+LCD2 (internal + internal) | ||
135 | 16: LCD1+ExternalLCD2 (internal + external) | ||
136 | |||
137 | viafb_second_size: | ||
138 | This option is used to set second device memory size(MB) in SAMM case. | ||
139 | The minimal size is 16. | ||
140 | |||
141 | viafb_platform_epia_dvi: | ||
142 | This option is used to enable DVI on EPIA - M | ||
143 | 0 : No DVI on EPIA - M (default) | ||
144 | 1 : DVI on EPIA - M | ||
145 | |||
146 | viafb_bus_width: | ||
147 | When using 24 - Bit Bus Width Digital Interface, | ||
148 | this option should be set. | ||
149 | 12: 12-Bit LVDS or 12-Bit TMDS (default) | ||
150 | 24: 24-Bit LVDS or 24-Bit TMDS | ||
151 | |||
152 | viafb_device_lcd_dualedge: | ||
153 | When using Dual Edge Panel, this option should be set. | ||
154 | 0 : No Dual Edge Panel (default) | ||
155 | 1 : Dual Edge Panel | ||
156 | |||
157 | viafb_video_dev: | ||
158 | This option is used to specify video output devices(CRT, DVI, LCD) for | ||
159 | duoview case. | ||
160 | For example: | ||
161 | To output video on DVI, we should use: | ||
162 | modprobe viafb viafb_video_dev=DVI... | ||
163 | |||
164 | viafb_lcd_port: | ||
165 | This option is used to specify LCD output port, | ||
166 | available values are "DVP0" "DVP1" "DFP_HIGHLOW" "DFP_HIGH" "DFP_LOW". | ||
167 | for external LCD + external DVI on CX700(External LCD is on DVP0), | ||
168 | we should use: | ||
169 | modprobe viafb viafb_lcd_port=DVP0... | ||
170 | |||
171 | Notes: | ||
172 | 1. CRT may not display properly for DuoView CRT & DVI display at | ||
173 | the "640x480" PAL mode with DVI overscan enabled. | ||
174 | 2. SAMM stands for single adapter multi monitors. It is different from | ||
175 | multi-head since SAMM support multi monitor at driver layers, thus fbcon | ||
176 | layer doesn't even know about it; SAMM's second screen doesn't have a | ||
177 | device node file, thus a user mode application can't access it directly. | ||
178 | When SAMM is enabled, viafb_mode and viafb_mode1, viafb_bpp and | ||
179 | viafb_bpp1, viafb_refresh and viafb_refresh1 can be different. | ||
180 | 3. When console is depending on viafbinfo1, dynamically change resolution | ||
181 | and bpp, need to call VIAFB specified ioctl interface VIAFB_SET_DEVICE | ||
182 | instead of calling common ioctl function FBIOPUT_VSCREENINFO since | ||
183 | viafb doesn't support multi-head well, or it will cause screen crush. | ||
184 | 4. VX800 2D accelerator hasn't been supported in this driver yet. When | ||
185 | using driver on VX800, the driver will disable the acceleration | ||
186 | function as default. | ||
187 | |||
188 | |||
189 | [Configure viafb with "fbset" tool] | ||
190 | ----------------------------------- | ||
191 | "fbset" is an inbox utility of Linux. | ||
192 | 1. Inquire current viafb information, type, | ||
193 | # fbset -i | ||
194 | |||
195 | 2. Set various resolutions and viafb_refresh rates, | ||
196 | # fbset <resolution-vertical_sync> | ||
197 | |||
198 | example, | ||
199 | # fbset "1024x768-75" | ||
200 | or | ||
201 | # fbset -g 1024 768 1024 768 32 | ||
202 | Check the file "/etc/fb.modes" to find display modes available. | ||
203 | |||
204 | 3. Set the color depth, | ||
205 | # fbset -depth <value> | ||
206 | |||
207 | example, | ||
208 | # fbset -depth 16 | ||
209 | |||
210 | [Bootup with viafb]: | ||
211 | -------------------- | ||
212 | Add the following line to your grub.conf: | ||
213 | append = "video=viafb:viafb_mode=1024x768,viafb_bpp=32,viafb_refresh=85" | ||
214 | |||
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index cc8093c15cf..f5f812daf9f 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -287,6 +287,22 @@ Who: Glauber Costa <gcosta@redhat.com> | |||
287 | 287 | ||
288 | --------------------------- | 288 | --------------------------- |
289 | 289 | ||
290 | What: remove HID compat support | ||
291 | When: 2.6.29 | ||
292 | Why: needed only as a temporary solution until distros fix themselves up | ||
293 | Who: Jiri Slaby <jirislaby@gmail.com> | ||
294 | |||
295 | --------------------------- | ||
296 | |||
297 | What: print_fn_descriptor_symbol() | ||
298 | When: October 2009 | ||
299 | Why: The %pF vsprintf format provides the same functionality in a | ||
300 | simpler way. print_fn_descriptor_symbol() is deprecated but | ||
301 | still present to give out-of-tree modules time to change. | ||
302 | Who: Bjorn Helgaas <bjorn.helgaas@hp.com> | ||
303 | |||
304 | --------------------------- | ||
305 | |||
290 | What: /sys/o2cb symlink | 306 | What: /sys/o2cb symlink |
291 | When: January 2010 | 307 | When: January 2010 |
292 | Why: /sys/fs/o2cb is the proper location for this information - /sys/o2cb | 308 | Why: /sys/fs/o2cb is the proper location for this information - /sys/o2cb |
diff --git a/Documentation/filesystems/autofs4-mount-control.txt b/Documentation/filesystems/autofs4-mount-control.txt new file mode 100644 index 00000000000..c6341745df3 --- /dev/null +++ b/Documentation/filesystems/autofs4-mount-control.txt | |||
@@ -0,0 +1,393 @@ | |||
1 | |||
2 | Miscellaneous Device control operations for the autofs4 kernel module | ||
3 | ==================================================================== | ||
4 | |||
5 | The problem | ||
6 | =========== | ||
7 | |||
8 | There is a problem with active restarts in autofs (that is to say | ||
9 | restarting autofs when there are busy mounts). | ||
10 | |||
11 | During normal operation autofs uses a file descriptor opened on the | ||
12 | directory that is being managed in order to be able to issue control | ||
13 | operations. Using a file descriptor gives ioctl operations access to | ||
14 | autofs specific information stored in the super block. The operations | ||
15 | are things such as setting an autofs mount catatonic, setting the | ||
16 | expire timeout and requesting expire checks. As is explained below, | ||
17 | certain types of autofs triggered mounts can end up covering an autofs | ||
18 | mount itself which prevents us being able to use open(2) to obtain a | ||
19 | file descriptor for these operations if we don't already have one open. | ||
20 | |||
21 | Currently autofs uses "umount -l" (lazy umount) to clear active mounts | ||
22 | at restart. While using lazy umount works for most cases, anything that | ||
23 | needs to walk back up the mount tree to construct a path, such as | ||
24 | getcwd(2) and the proc file system /proc/<pid>/cwd, no longer works | ||
25 | because the point from which the path is constructed has been detached | ||
26 | from the mount tree. | ||
27 | |||
28 | The actual problem with autofs is that it can't reconnect to existing | ||
29 | mounts. Immediately one thinks of just adding the ability to remount | ||
30 | autofs file systems would solve it, but alas, that can't work. This is | ||
31 | because autofs direct mounts and the implementation of "on demand mount | ||
32 | and expire" of nested mount trees have the file system mounted directly | ||
33 | on top of the mount trigger directory dentry. | ||
34 | |||
35 | For example, there are two types of automount maps, direct (in the kernel | ||
36 | module source you will see a third type called an offset, which is just | ||
37 | a direct mount in disguise) and indirect. | ||
38 | |||
39 | Here is a master map with direct and indirect map entries: | ||
40 | |||
41 | /- /etc/auto.direct | ||
42 | /test /etc/auto.indirect | ||
43 | |||
44 | and the corresponding map files: | ||
45 | |||
46 | /etc/auto.direct: | ||
47 | |||
48 | /automount/dparse/g6 budgie:/autofs/export1 | ||
49 | /automount/dparse/g1 shark:/autofs/export1 | ||
50 | and so on. | ||
51 | |||
52 | /etc/auto.indirect: | ||
53 | |||
54 | g1 shark:/autofs/export1 | ||
55 | g6 budgie:/autofs/export1 | ||
56 | and so on. | ||
57 | |||
58 | For the above indirect map an autofs file system is mounted on /test and | ||
59 | mounts are triggered for each sub-directory key by the inode lookup | ||
60 | operation. So we see a mount of shark:/autofs/export1 on /test/g1, for | ||
61 | example. | ||
62 | |||
63 | The way that direct mounts are handled is by making an autofs mount on | ||
64 | each full path, such as /automount/dparse/g1, and using it as a mount | ||
65 | trigger. So when we walk on the path we mount shark:/autofs/export1 "on | ||
66 | top of this mount point". Since these are always directories we can | ||
67 | use the follow_link inode operation to trigger the mount. | ||
68 | |||
69 | But, each entry in direct and indirect maps can have offsets (making | ||
70 | them multi-mount map entries). | ||
71 | |||
72 | For example, an indirect mount map entry could also be: | ||
73 | |||
74 | g1 \ | ||
75 | / shark:/autofs/export5/testing/test \ | ||
76 | /s1 shark:/autofs/export/testing/test/s1 \ | ||
77 | /s2 shark:/autofs/export5/testing/test/s2 \ | ||
78 | /s1/ss1 shark:/autofs/export1 \ | ||
79 | /s2/ss2 shark:/autofs/export2 | ||
80 | |||
81 | and a similarly a direct mount map entry could also be: | ||
82 | |||
83 | /automount/dparse/g1 \ | ||
84 | / shark:/autofs/export5/testing/test \ | ||
85 | /s1 shark:/autofs/export/testing/test/s1 \ | ||
86 | /s2 shark:/autofs/export5/testing/test/s2 \ | ||
87 | /s1/ss1 shark:/autofs/export2 \ | ||
88 | /s2/ss2 shark:/autofs/export2 | ||
89 | |||
90 | One of the issues with version 4 of autofs was that, when mounting an | ||
91 | entry with a large number of offsets, possibly with nesting, we needed | ||
92 | to mount and umount all of the offsets as a single unit. Not really a | ||
93 | problem, except for people with a large number of offsets in map entries. | ||
94 | This mechanism is used for the well known "hosts" map and we have seen | ||
95 | cases (in 2.4) where the available number of mounts are exhausted or | ||
96 | where the number of privileged ports available is exhausted. | ||
97 | |||
98 | In version 5 we mount only as we go down the tree of offsets and | ||
99 | similarly for expiring them which resolves the above problem. There is | ||
100 | somewhat more detail to the implementation but it isn't needed for the | ||
101 | sake of the problem explanation. The one important detail is that these | ||
102 | offsets are implemented using the same mechanism as the direct mounts | ||
103 | above and so the mount points can be covered by a mount. | ||
104 | |||
105 | The current autofs implementation uses an ioctl file descriptor opened | ||
106 | on the mount point for control operations. The references held by the | ||
107 | descriptor are accounted for in checks made to determine if a mount is | ||
108 | in use and is also used to access autofs file system information held | ||
109 | in the mount super block. So the use of a file handle needs to be | ||
110 | retained. | ||
111 | |||
112 | |||
113 | The Solution | ||
114 | ============ | ||
115 | |||
116 | To be able to restart autofs leaving existing direct, indirect and | ||
117 | offset mounts in place we need to be able to obtain a file handle | ||
118 | for these potentially covered autofs mount points. Rather than just | ||
119 | implement an isolated operation it was decided to re-implement the | ||
120 | existing ioctl interface and add new operations to provide this | ||
121 | functionality. | ||
122 | |||
123 | In addition, to be able to reconstruct a mount tree that has busy mounts, | ||
124 | the uid and gid of the last user that triggered the mount needs to be | ||
125 | available because these can be used as macro substitution variables in | ||
126 | autofs maps. They are recorded at mount request time and an operation | ||
127 | has been added to retrieve them. | ||
128 | |||
129 | Since we're re-implementing the control interface, a couple of other | ||
130 | problems with the existing interface have been addressed. First, when | ||
131 | a mount or expire operation completes a status is returned to the | ||
132 | kernel by either a "send ready" or a "send fail" operation. The | ||
133 | "send fail" operation of the ioctl interface could only ever send | ||
134 | ENOENT so the re-implementation allows user space to send an actual | ||
135 | status. Another expensive operation in user space, for those using | ||
136 | very large maps, is discovering if a mount is present. Usually this | ||
137 | involves scanning /proc/mounts and since it needs to be done quite | ||
138 | often it can introduce significant overhead when there are many entries | ||
139 | in the mount table. An operation to lookup the mount status of a mount | ||
140 | point dentry (covered or not) has also been added. | ||
141 | |||
142 | Current kernel development policy recommends avoiding the use of the | ||
143 | ioctl mechanism in favor of systems such as Netlink. An implementation | ||
144 | using this system was attempted to evaluate its suitability and it was | ||
145 | found to be inadequate, in this case. The Generic Netlink system was | ||
146 | used for this as raw Netlink would lead to a significant increase in | ||
147 | complexity. There's no question that the Generic Netlink system is an | ||
148 | elegant solution for common case ioctl functions but it's not a complete | ||
149 | replacement probably because it's primary purpose in life is to be a | ||
150 | message bus implementation rather than specifically an ioctl replacement. | ||
151 | While it would be possible to work around this there is one concern | ||
152 | that lead to the decision to not use it. This is that the autofs | ||
153 | expire in the daemon has become far to complex because umount | ||
154 | candidates are enumerated, almost for no other reason than to "count" | ||
155 | the number of times to call the expire ioctl. This involves scanning | ||
156 | the mount table which has proved to be a big overhead for users with | ||
157 | large maps. The best way to improve this is try and get back to the | ||
158 | way the expire was done long ago. That is, when an expire request is | ||
159 | issued for a mount (file handle) we should continually call back to | ||
160 | the daemon until we can't umount any more mounts, then return the | ||
161 | appropriate status to the daemon. At the moment we just expire one | ||
162 | mount at a time. A Generic Netlink implementation would exclude this | ||
163 | possibility for future development due to the requirements of the | ||
164 | message bus architecture. | ||
165 | |||
166 | |||
167 | autofs4 Miscellaneous Device mount control interface | ||
168 | ==================================================== | ||
169 | |||
170 | The control interface is opening a device node, typically /dev/autofs. | ||
171 | |||
172 | All the ioctls use a common structure to pass the needed parameter | ||
173 | information and return operation results: | ||
174 | |||
175 | struct autofs_dev_ioctl { | ||
176 | __u32 ver_major; | ||
177 | __u32 ver_minor; | ||
178 | __u32 size; /* total size of data passed in | ||
179 | * including this struct */ | ||
180 | __s32 ioctlfd; /* automount command fd */ | ||
181 | |||
182 | __u32 arg1; /* Command parameters */ | ||
183 | __u32 arg2; | ||
184 | |||
185 | char path[0]; | ||
186 | }; | ||
187 | |||
188 | The ioctlfd field is a mount point file descriptor of an autofs mount | ||
189 | point. It is returned by the open call and is used by all calls except | ||
190 | the check for whether a given path is a mount point, where it may | ||
191 | optionally be used to check a specific mount corresponding to a given | ||
192 | mount point file descriptor, and when requesting the uid and gid of the | ||
193 | last successful mount on a directory within the autofs file system. | ||
194 | |||
195 | The fields arg1 and arg2 are used to communicate parameters and results of | ||
196 | calls made as described below. | ||
197 | |||
198 | The path field is used to pass a path where it is needed and the size field | ||
199 | is used account for the increased structure length when translating the | ||
200 | structure sent from user space. | ||
201 | |||
202 | This structure can be initialized before setting specific fields by using | ||
203 | the void function call init_autofs_dev_ioctl(struct autofs_dev_ioctl *). | ||
204 | |||
205 | All of the ioctls perform a copy of this structure from user space to | ||
206 | kernel space and return -EINVAL if the size parameter is smaller than | ||
207 | the structure size itself, -ENOMEM if the kernel memory allocation fails | ||
208 | or -EFAULT if the copy itself fails. Other checks include a version check | ||
209 | of the compiled in user space version against the module version and a | ||
210 | mismatch results in a -EINVAL return. If the size field is greater than | ||
211 | the structure size then a path is assumed to be present and is checked to | ||
212 | ensure it begins with a "/" and is NULL terminated, otherwise -EINVAL is | ||
213 | returned. Following these checks, for all ioctl commands except | ||
214 | AUTOFS_DEV_IOCTL_VERSION_CMD, AUTOFS_DEV_IOCTL_OPENMOUNT_CMD and | ||
215 | AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD the ioctlfd is validated and if it is | ||
216 | not a valid descriptor or doesn't correspond to an autofs mount point | ||
217 | an error of -EBADF, -ENOTTY or -EINVAL (not an autofs descriptor) is | ||
218 | returned. | ||
219 | |||
220 | |||
221 | The ioctls | ||
222 | ========== | ||
223 | |||
224 | An example of an implementation which uses this interface can be seen | ||
225 | in autofs version 5.0.4 and later in file lib/dev-ioctl-lib.c of the | ||
226 | distribution tar available for download from kernel.org in directory | ||
227 | /pub/linux/daemons/autofs/v5. | ||
228 | |||
229 | The device node ioctl operations implemented by this interface are: | ||
230 | |||
231 | |||
232 | AUTOFS_DEV_IOCTL_VERSION | ||
233 | ------------------------ | ||
234 | |||
235 | Get the major and minor version of the autofs4 device ioctl kernel module | ||
236 | implementation. It requires an initialized struct autofs_dev_ioctl as an | ||
237 | input parameter and sets the version information in the passed in structure. | ||
238 | It returns 0 on success or the error -EINVAL if a version mismatch is | ||
239 | detected. | ||
240 | |||
241 | |||
242 | AUTOFS_DEV_IOCTL_PROTOVER_CMD and AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD | ||
243 | ------------------------------------------------------------------ | ||
244 | |||
245 | Get the major and minor version of the autofs4 protocol version understood | ||
246 | by loaded module. This call requires an initialized struct autofs_dev_ioctl | ||
247 | with the ioctlfd field set to a valid autofs mount point descriptor | ||
248 | and sets the requested version number in structure field arg1. These | ||
249 | commands return 0 on success or one of the negative error codes if | ||
250 | validation fails. | ||
251 | |||
252 | |||
253 | AUTOFS_DEV_IOCTL_OPENMOUNT and AUTOFS_DEV_IOCTL_CLOSEMOUNT | ||
254 | ---------------------------------------------------------- | ||
255 | |||
256 | Obtain and release a file descriptor for an autofs managed mount point | ||
257 | path. The open call requires an initialized struct autofs_dev_ioctl with | ||
258 | the the path field set and the size field adjusted appropriately as well | ||
259 | as the arg1 field set to the device number of the autofs mount. The | ||
260 | device number can be obtained from the mount options shown in | ||
261 | /proc/mounts. The close call requires an initialized struct | ||
262 | autofs_dev_ioct with the ioctlfd field set to the descriptor obtained | ||
263 | from the open call. The release of the file descriptor can also be done | ||
264 | with close(2) so any open descriptors will also be closed at process exit. | ||
265 | The close call is included in the implemented operations largely for | ||
266 | completeness and to provide for a consistent user space implementation. | ||
267 | |||
268 | |||
269 | AUTOFS_DEV_IOCTL_READY_CMD and AUTOFS_DEV_IOCTL_FAIL_CMD | ||
270 | -------------------------------------------------------- | ||
271 | |||
272 | Return mount and expire result status from user space to the kernel. | ||
273 | Both of these calls require an initialized struct autofs_dev_ioctl | ||
274 | with the ioctlfd field set to the descriptor obtained from the open | ||
275 | call and the arg1 field set to the wait queue token number, received | ||
276 | by user space in the foregoing mount or expire request. The arg2 field | ||
277 | is set to the status to be returned. For the ready call this is always | ||
278 | 0 and for the fail call it is set to the errno of the operation. | ||
279 | |||
280 | |||
281 | AUTOFS_DEV_IOCTL_SETPIPEFD_CMD | ||
282 | ------------------------------ | ||
283 | |||
284 | Set the pipe file descriptor used for kernel communication to the daemon. | ||
285 | Normally this is set at mount time using an option but when reconnecting | ||
286 | to a existing mount we need to use this to tell the autofs mount about | ||
287 | the new kernel pipe descriptor. In order to protect mounts against | ||
288 | incorrectly setting the pipe descriptor we also require that the autofs | ||
289 | mount be catatonic (see next call). | ||
290 | |||
291 | The call requires an initialized struct autofs_dev_ioctl with the | ||
292 | ioctlfd field set to the descriptor obtained from the open call and | ||
293 | the arg1 field set to descriptor of the pipe. On success the call | ||
294 | also sets the process group id used to identify the controlling process | ||
295 | (eg. the owning automount(8) daemon) to the process group of the caller. | ||
296 | |||
297 | |||
298 | AUTOFS_DEV_IOCTL_CATATONIC_CMD | ||
299 | ------------------------------ | ||
300 | |||
301 | Make the autofs mount point catatonic. The autofs mount will no longer | ||
302 | issue mount requests, the kernel communication pipe descriptor is released | ||
303 | and any remaining waits in the queue released. | ||
304 | |||
305 | The call requires an initialized struct autofs_dev_ioctl with the | ||
306 | ioctlfd field set to the descriptor obtained from the open call. | ||
307 | |||
308 | |||
309 | AUTOFS_DEV_IOCTL_TIMEOUT_CMD | ||
310 | ---------------------------- | ||
311 | |||
312 | Set the expire timeout for mounts withing an autofs mount point. | ||
313 | |||
314 | The call requires an initialized struct autofs_dev_ioctl with the | ||
315 | ioctlfd field set to the descriptor obtained from the open call. | ||
316 | |||
317 | |||
318 | AUTOFS_DEV_IOCTL_REQUESTER_CMD | ||
319 | ------------------------------ | ||
320 | |||
321 | Return the uid and gid of the last process to successfully trigger a the | ||
322 | mount on the given path dentry. | ||
323 | |||
324 | The call requires an initialized struct autofs_dev_ioctl with the path | ||
325 | field set to the mount point in question and the size field adjusted | ||
326 | appropriately as well as the arg1 field set to the device number of the | ||
327 | containing autofs mount. Upon return the struct field arg1 contains the | ||
328 | uid and arg2 the gid. | ||
329 | |||
330 | When reconstructing an autofs mount tree with active mounts we need to | ||
331 | re-connect to mounts that may have used the original process uid and | ||
332 | gid (or string variations of them) for mount lookups within the map entry. | ||
333 | This call provides the ability to obtain this uid and gid so they may be | ||
334 | used by user space for the mount map lookups. | ||
335 | |||
336 | |||
337 | AUTOFS_DEV_IOCTL_EXPIRE_CMD | ||
338 | --------------------------- | ||
339 | |||
340 | Issue an expire request to the kernel for an autofs mount. Typically | ||
341 | this ioctl is called until no further expire candidates are found. | ||
342 | |||
343 | The call requires an initialized struct autofs_dev_ioctl with the | ||
344 | ioctlfd field set to the descriptor obtained from the open call. In | ||
345 | addition an immediate expire, independent of the mount timeout, can be | ||
346 | requested by setting the arg1 field to 1. If no expire candidates can | ||
347 | be found the ioctl returns -1 with errno set to EAGAIN. | ||
348 | |||
349 | This call causes the kernel module to check the mount corresponding | ||
350 | to the given ioctlfd for mounts that can be expired, issues an expire | ||
351 | request back to the daemon and waits for completion. | ||
352 | |||
353 | AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD | ||
354 | ------------------------------ | ||
355 | |||
356 | Checks if an autofs mount point is in use. | ||
357 | |||
358 | The call requires an initialized struct autofs_dev_ioctl with the | ||
359 | ioctlfd field set to the descriptor obtained from the open call and | ||
360 | it returns the result in the arg1 field, 1 for busy and 0 otherwise. | ||
361 | |||
362 | |||
363 | AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD | ||
364 | --------------------------------- | ||
365 | |||
366 | Check if the given path is a mountpoint. | ||
367 | |||
368 | The call requires an initialized struct autofs_dev_ioctl. There are two | ||
369 | possible variations. Both use the path field set to the path of the mount | ||
370 | point to check and the size field adjusted appropriately. One uses the | ||
371 | ioctlfd field to identify a specific mount point to check while the other | ||
372 | variation uses the path and optionaly arg1 set to an autofs mount type. | ||
373 | The call returns 1 if this is a mount point and sets arg1 to the device | ||
374 | number of the mount and field arg2 to the relevant super block magic | ||
375 | number (described below) or 0 if it isn't a mountpoint. In both cases | ||
376 | the the device number (as returned by new_encode_dev()) is returned | ||
377 | in field arg1. | ||
378 | |||
379 | If supplied with a file descriptor we're looking for a specific mount, | ||
380 | not necessarily at the top of the mounted stack. In this case the path | ||
381 | the descriptor corresponds to is considered a mountpoint if it is itself | ||
382 | a mountpoint or contains a mount, such as a multi-mount without a root | ||
383 | mount. In this case we return 1 if the descriptor corresponds to a mount | ||
384 | point and and also returns the super magic of the covering mount if there | ||
385 | is one or 0 if it isn't a mountpoint. | ||
386 | |||
387 | If a path is supplied (and the ioctlfd field is set to -1) then the path | ||
388 | is looked up and is checked to see if it is the root of a mount. If a | ||
389 | type is also given we are looking for a particular autofs mount and if | ||
390 | a match isn't found a fail is returned. If the the located path is the | ||
391 | root of a mount 1 is returned along with the super magic of the mount | ||
392 | or 0 otherwise. | ||
393 | |||
diff --git a/Documentation/filesystems/ext3.txt b/Documentation/filesystems/ext3.txt index b45f3c1b8b4..9dd2a3bb2ac 100644 --- a/Documentation/filesystems/ext3.txt +++ b/Documentation/filesystems/ext3.txt | |||
@@ -96,6 +96,11 @@ errors=remount-ro(*) Remount the filesystem read-only on an error. | |||
96 | errors=continue Keep going on a filesystem error. | 96 | errors=continue Keep going on a filesystem error. |
97 | errors=panic Panic and halt the machine if an error occurs. | 97 | errors=panic Panic and halt the machine if an error occurs. |
98 | 98 | ||
99 | data_err=ignore(*) Just print an error message if an error occurs | ||
100 | in a file data buffer in ordered mode. | ||
101 | data_err=abort Abort the journal if an error occurs in a file | ||
102 | data buffer in ordered mode. | ||
103 | |||
99 | grpid Give objects the same group ID as their creator. | 104 | grpid Give objects the same group ID as their creator. |
100 | bsdgroups | 105 | bsdgroups |
101 | 106 | ||
@@ -193,6 +198,5 @@ kernel source: <file:fs/ext3/> | |||
193 | programs: http://e2fsprogs.sourceforge.net/ | 198 | programs: http://e2fsprogs.sourceforge.net/ |
194 | http://ext2resize.sourceforge.net | 199 | http://ext2resize.sourceforge.net |
195 | 200 | ||
196 | useful links: http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html | 201 | useful links: http://www-106.ibm.com/developerworks/linux/library/l-fs7/ |
197 | http://www-106.ibm.com/developerworks/linux/library/l-fs7/ | ||
198 | http://www-106.ibm.com/developerworks/linux/library/l-fs8/ | 202 | http://www-106.ibm.com/developerworks/linux/library/l-fs8/ |
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt index eb154ef36c2..174eaff7ded 100644 --- a/Documentation/filesystems/ext4.txt +++ b/Documentation/filesystems/ext4.txt | |||
@@ -2,19 +2,24 @@ | |||
2 | Ext4 Filesystem | 2 | Ext4 Filesystem |
3 | =============== | 3 | =============== |
4 | 4 | ||
5 | This is a development version of the ext4 filesystem, an advanced level | 5 | Ext4 is an an advanced level of the ext3 filesystem which incorporates |
6 | of the ext3 filesystem which incorporates scalability and reliability | 6 | scalability and reliability enhancements for supporting large filesystems |
7 | enhancements for supporting large filesystems (64 bit) in keeping with | 7 | (64 bit) in keeping with increasing disk capacities and state-of-the-art |
8 | increasing disk capacities and state-of-the-art feature requirements. | 8 | feature requirements. |
9 | 9 | ||
10 | Mailing list: linux-ext4@vger.kernel.org | 10 | Mailing list: linux-ext4@vger.kernel.org |
11 | Web site: http://ext4.wiki.kernel.org | ||
11 | 12 | ||
12 | 13 | ||
13 | 1. Quick usage instructions: | 14 | 1. Quick usage instructions: |
14 | =========================== | 15 | =========================== |
15 | 16 | ||
17 | Note: More extensive information for getting started with ext4 can be | ||
18 | found at the ext4 wiki site at the URL: | ||
19 | http://ext4.wiki.kernel.org/index.php/Ext4_Howto | ||
20 | |||
16 | - Compile and install the latest version of e2fsprogs (as of this | 21 | - Compile and install the latest version of e2fsprogs (as of this |
17 | writing version 1.41) from: | 22 | writing version 1.41.3) from: |
18 | 23 | ||
19 | http://sourceforge.net/project/showfiles.php?group_id=2406 | 24 | http://sourceforge.net/project/showfiles.php?group_id=2406 |
20 | 25 | ||
@@ -36,11 +41,9 @@ Mailing list: linux-ext4@vger.kernel.org | |||
36 | 41 | ||
37 | # mke2fs -t ext4 /dev/hda1 | 42 | # mke2fs -t ext4 /dev/hda1 |
38 | 43 | ||
39 | Or configure an existing ext3 filesystem to support extents and set | 44 | Or to configure an existing ext3 filesystem to support extents: |
40 | the test_fs flag to indicate that it's ok for an in-development | ||
41 | filesystem to touch this filesystem: | ||
42 | 45 | ||
43 | # tune2fs -O extents -E test_fs /dev/hda1 | 46 | # tune2fs -O extents /dev/hda1 |
44 | 47 | ||
45 | If the filesystem was created with 128 byte inodes, it can be | 48 | If the filesystem was created with 128 byte inodes, it can be |
46 | converted to use 256 byte for greater efficiency via: | 49 | converted to use 256 byte for greater efficiency via: |
@@ -104,8 +107,8 @@ exist yet so I'm not sure they're in the near-term roadmap. | |||
104 | The big performance win will come with mballoc, delalloc and flex_bg | 107 | The big performance win will come with mballoc, delalloc and flex_bg |
105 | grouping of bitmaps and inode tables. Some test results available here: | 108 | grouping of bitmaps and inode tables. Some test results available here: |
106 | 109 | ||
107 | - http://www.bullopensource.org/ext4/20080530/ffsb-write-2.6.26-rc2.html | 110 | - http://www.bullopensource.org/ext4/20080818-ffsb/ffsb-write-2.6.27-rc1.html |
108 | - http://www.bullopensource.org/ext4/20080530/ffsb-readwrite-2.6.26-rc2.html | 111 | - http://www.bullopensource.org/ext4/20080818-ffsb/ffsb-readwrite-2.6.27-rc1.html |
109 | 112 | ||
110 | 3. Options | 113 | 3. Options |
111 | ========== | 114 | ========== |
@@ -214,9 +217,6 @@ noreservation | |||
214 | bsddf (*) Make 'df' act like BSD. | 217 | bsddf (*) Make 'df' act like BSD. |
215 | minixdf Make 'df' act like Minix. | 218 | minixdf Make 'df' act like Minix. |
216 | 219 | ||
217 | check=none Don't do extra checking of bitmaps on mount. | ||
218 | nocheck | ||
219 | |||
220 | debug Extra debugging information is sent to syslog. | 220 | debug Extra debugging information is sent to syslog. |
221 | 221 | ||
222 | errors=remount-ro(*) Remount the filesystem read-only on an error. | 222 | errors=remount-ro(*) Remount the filesystem read-only on an error. |
@@ -253,8 +253,6 @@ nobh (a) cache disk block mapping information | |||
253 | "nobh" option tries to avoid associating buffer | 253 | "nobh" option tries to avoid associating buffer |
254 | heads (supported only for "writeback" mode). | 254 | heads (supported only for "writeback" mode). |
255 | 255 | ||
256 | mballoc (*) Use the multiple block allocator for block allocation | ||
257 | nomballoc disabled multiple block allocator for block allocation. | ||
258 | stripe=n Number of filesystem blocks that mballoc will try | 256 | stripe=n Number of filesystem blocks that mballoc will try |
259 | to use for allocation size and alignment. For RAID5/6 | 257 | to use for allocation size and alignment. For RAID5/6 |
260 | systems this should be the number of data | 258 | systems this should be the number of data |
diff --git a/Documentation/filesystems/nfsroot.txt b/Documentation/filesystems/nfsroot.txt index 31b32917234..68baddf3c3e 100644 --- a/Documentation/filesystems/nfsroot.txt +++ b/Documentation/filesystems/nfsroot.txt | |||
@@ -169,7 +169,7 @@ They depend on various facilities being available: | |||
169 | 3.1) Booting from a floppy using syslinux | 169 | 3.1) Booting from a floppy using syslinux |
170 | 170 | ||
171 | When building kernels, an easy way to create a boot floppy that uses | 171 | When building kernels, an easy way to create a boot floppy that uses |
172 | syslinux is to use the zdisk or bzdisk make targets which use | 172 | syslinux is to use the zdisk or bzdisk make targets which use zimage |
173 | and bzimage images respectively. Both targets accept the | 173 | and bzimage images respectively. Both targets accept the |
174 | FDARGS parameter which can be used to set the kernel command line. | 174 | FDARGS parameter which can be used to set the kernel command line. |
175 | 175 | ||
diff --git a/Documentation/filesystems/ocfs2.txt b/Documentation/filesystems/ocfs2.txt index c318a8bbb1e..4340cc82579 100644 --- a/Documentation/filesystems/ocfs2.txt +++ b/Documentation/filesystems/ocfs2.txt | |||
@@ -76,3 +76,9 @@ localalloc=8(*) Allows custom localalloc size in MB. If the value is too | |||
76 | large, the fs will silently revert it to the default. | 76 | large, the fs will silently revert it to the default. |
77 | Localalloc is not enabled for local mounts. | 77 | Localalloc is not enabled for local mounts. |
78 | localflocks This disables cluster aware flock. | 78 | localflocks This disables cluster aware flock. |
79 | inode64 Indicates that Ocfs2 is allowed to create inodes at | ||
80 | any location in the filesystem, including those which | ||
81 | will result in inode numbers occupying more than 32 | ||
82 | bits of significance. | ||
83 | user_xattr (*) Enables Extended User Attributes. | ||
84 | nouser_xattr Disables Extended User Attributes. | ||
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index d831d24d2a6..bcceb99b81d 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -1321,6 +1321,18 @@ debugging information is displayed on console. | |||
1321 | NMI switch that most IA32 servers have fires unknown NMI up, for example. | 1321 | NMI switch that most IA32 servers have fires unknown NMI up, for example. |
1322 | If a system hangs up, try pressing the NMI switch. | 1322 | If a system hangs up, try pressing the NMI switch. |
1323 | 1323 | ||
1324 | panic_on_unrecovered_nmi | ||
1325 | ------------------------ | ||
1326 | |||
1327 | The default Linux behaviour on an NMI of either memory or unknown is to continue | ||
1328 | operation. For many environments such as scientific computing it is preferable | ||
1329 | that the box is taken out and the error dealt with than an uncorrected | ||
1330 | parity/ECC error get propogated. | ||
1331 | |||
1332 | A small number of systems do generate NMI's for bizarre random reasons such as | ||
1333 | power management so the default is off. That sysctl works like the existing | ||
1334 | panic controls already in that directory. | ||
1335 | |||
1324 | nmi_watchdog | 1336 | nmi_watchdog |
1325 | ------------ | 1337 | ------------ |
1326 | 1338 | ||
@@ -1331,13 +1343,6 @@ determine whether or not they are still functioning properly. | |||
1331 | Because the NMI watchdog shares registers with oprofile, by disabling the NMI | 1343 | Because the NMI watchdog shares registers with oprofile, by disabling the NMI |
1332 | watchdog, oprofile may have more registers to utilize. | 1344 | watchdog, oprofile may have more registers to utilize. |
1333 | 1345 | ||
1334 | maps_protect | ||
1335 | ------------ | ||
1336 | |||
1337 | Enables/Disables the protection of the per-process proc entries "maps" and | ||
1338 | "smaps". When enabled, the contents of these files are visible only to | ||
1339 | readers that are allowed to ptrace() the given process. | ||
1340 | |||
1341 | msgmni | 1346 | msgmni |
1342 | ------ | 1347 | ------ |
1343 | 1348 | ||
@@ -1379,15 +1384,18 @@ causes the kernel to prefer to reclaim dentries and inodes. | |||
1379 | dirty_background_ratio | 1384 | dirty_background_ratio |
1380 | ---------------------- | 1385 | ---------------------- |
1381 | 1386 | ||
1382 | Contains, as a percentage of total system memory, the number of pages at which | 1387 | Contains, as a percentage of the dirtyable system memory (free pages + mapped |
1383 | the pdflush background writeback daemon will start writing out dirty data. | 1388 | pages + file cache, not including locked pages and HugePages), the number of |
1389 | pages at which the pdflush background writeback daemon will start writing out | ||
1390 | dirty data. | ||
1384 | 1391 | ||
1385 | dirty_ratio | 1392 | dirty_ratio |
1386 | ----------------- | 1393 | ----------------- |
1387 | 1394 | ||
1388 | Contains, as a percentage of total system memory, the number of pages at which | 1395 | Contains, as a percentage of the dirtyable system memory (free pages + mapped |
1389 | a process which is generating disk writes will itself start writing out dirty | 1396 | pages + file cache, not including locked pages and HugePages), the number of |
1390 | data. | 1397 | pages at which a process which is generating disk writes will itself start |
1398 | writing out dirty data. | ||
1391 | 1399 | ||
1392 | dirty_writeback_centisecs | 1400 | dirty_writeback_centisecs |
1393 | ------------------------- | 1401 | ------------------------- |
@@ -2407,24 +2415,29 @@ will be dumped when the <pid> process is dumped. coredump_filter is a bitmask | |||
2407 | of memory types. If a bit of the bitmask is set, memory segments of the | 2415 | of memory types. If a bit of the bitmask is set, memory segments of the |
2408 | corresponding memory type are dumped, otherwise they are not dumped. | 2416 | corresponding memory type are dumped, otherwise they are not dumped. |
2409 | 2417 | ||
2410 | The following 4 memory types are supported: | 2418 | The following 7 memory types are supported: |
2411 | - (bit 0) anonymous private memory | 2419 | - (bit 0) anonymous private memory |
2412 | - (bit 1) anonymous shared memory | 2420 | - (bit 1) anonymous shared memory |
2413 | - (bit 2) file-backed private memory | 2421 | - (bit 2) file-backed private memory |
2414 | - (bit 3) file-backed shared memory | 2422 | - (bit 3) file-backed shared memory |
2415 | - (bit 4) ELF header pages in file-backed private memory areas (it is | 2423 | - (bit 4) ELF header pages in file-backed private memory areas (it is |
2416 | effective only if the bit 2 is cleared) | 2424 | effective only if the bit 2 is cleared) |
2425 | - (bit 5) hugetlb private memory | ||
2426 | - (bit 6) hugetlb shared memory | ||
2417 | 2427 | ||
2418 | Note that MMIO pages such as frame buffer are never dumped and vDSO pages | 2428 | Note that MMIO pages such as frame buffer are never dumped and vDSO pages |
2419 | are always dumped regardless of the bitmask status. | 2429 | are always dumped regardless of the bitmask status. |
2420 | 2430 | ||
2421 | Default value of coredump_filter is 0x3; this means all anonymous memory | 2431 | Note bit 0-4 doesn't effect any hugetlb memory. hugetlb memory are only |
2422 | segments are dumped. | 2432 | effected by bit 5-6. |
2433 | |||
2434 | Default value of coredump_filter is 0x23; this means all anonymous memory | ||
2435 | segments and hugetlb private memory are dumped. | ||
2423 | 2436 | ||
2424 | If you don't want to dump all shared memory segments attached to pid 1234, | 2437 | If you don't want to dump all shared memory segments attached to pid 1234, |
2425 | write 1 to the process's proc file. | 2438 | write 0x21 to the process's proc file. |
2426 | 2439 | ||
2427 | $ echo 0x1 > /proc/1234/coredump_filter | 2440 | $ echo 0x21 > /proc/1234/coredump_filter |
2428 | 2441 | ||
2429 | When a new process is created, the process inherits the bitmask status from its | 2442 | When a new process is created, the process inherits the bitmask status from its |
2430 | parent. It is useful to set up coredump_filter before the program runs. | 2443 | parent. It is useful to set up coredump_filter before the program runs. |
diff --git a/Documentation/filesystems/ramfs-rootfs-initramfs.txt b/Documentation/filesystems/ramfs-rootfs-initramfs.txt index 7be232b44ee..62fe9b1e089 100644 --- a/Documentation/filesystems/ramfs-rootfs-initramfs.txt +++ b/Documentation/filesystems/ramfs-rootfs-initramfs.txt | |||
@@ -263,7 +263,7 @@ User Mode Linux, like so: | |||
263 | sleep(999999999); | 263 | sleep(999999999); |
264 | } | 264 | } |
265 | EOF | 265 | EOF |
266 | gcc -static hello2.c -o init | 266 | gcc -static hello.c -o init |
267 | echo init | cpio -o -H newc | gzip > test.cpio.gz | 267 | echo init | cpio -o -H newc | gzip > test.cpio.gz |
268 | # Testing external initramfs using the initrd loading mechanism. | 268 | # Testing external initramfs using the initrd loading mechanism. |
269 | qemu -kernel /boot/vmlinuz -initrd test.cpio.gz /dev/zero | 269 | qemu -kernel /boot/vmlinuz -initrd test.cpio.gz /dev/zero |
diff --git a/Documentation/filesystems/ubifs.txt b/Documentation/filesystems/ubifs.txt index 6a0d70a22f0..dd84ea3c10d 100644 --- a/Documentation/filesystems/ubifs.txt +++ b/Documentation/filesystems/ubifs.txt | |||
@@ -86,6 +86,15 @@ norm_unmount (*) commit on unmount; the journal is committed | |||
86 | fast_unmount do not commit on unmount; this option makes | 86 | fast_unmount do not commit on unmount; this option makes |
87 | unmount faster, but the next mount slower | 87 | unmount faster, but the next mount slower |
88 | because of the need to replay the journal. | 88 | because of the need to replay the journal. |
89 | bulk_read read more in one go to take advantage of flash | ||
90 | media that read faster sequentially | ||
91 | no_bulk_read (*) do not bulk-read | ||
92 | no_chk_data_crc skip checking of CRCs on data nodes in order to | ||
93 | improve read performance. Use this option only | ||
94 | if the flash media is highly reliable. The effect | ||
95 | of this option is that corruption of the contents | ||
96 | of a file can go unnoticed. | ||
97 | chk_data_crc (*) do not skip checking CRCs on data nodes | ||
89 | 98 | ||
90 | 99 | ||
91 | Quick usage instructions | 100 | Quick usage instructions |
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt index 18022e249c5..b1b98870124 100644 --- a/Documentation/gpio.txt +++ b/Documentation/gpio.txt | |||
@@ -240,6 +240,10 @@ signal, or (b) something wrongly believes it's safe to remove drivers | |||
240 | needed to manage a signal that's in active use. That is, requesting a | 240 | needed to manage a signal that's in active use. That is, requesting a |
241 | GPIO can serve as a kind of lock. | 241 | GPIO can serve as a kind of lock. |
242 | 242 | ||
243 | Some platforms may also use knowledge about what GPIOs are active for | ||
244 | power management, such as by powering down unused chip sectors and, more | ||
245 | easily, gating off unused clocks. | ||
246 | |||
243 | These two calls are optional because not not all current Linux platforms | 247 | These two calls are optional because not not all current Linux platforms |
244 | offer such functionality in their GPIO support; a valid implementation | 248 | offer such functionality in their GPIO support; a valid implementation |
245 | could return success for all gpio_request() calls. Unlike the other calls, | 249 | could return success for all gpio_request() calls. Unlike the other calls, |
@@ -264,7 +268,7 @@ map between them using calls like: | |||
264 | /* map GPIO numbers to IRQ numbers */ | 268 | /* map GPIO numbers to IRQ numbers */ |
265 | int gpio_to_irq(unsigned gpio); | 269 | int gpio_to_irq(unsigned gpio); |
266 | 270 | ||
267 | /* map IRQ numbers to GPIO numbers */ | 271 | /* map IRQ numbers to GPIO numbers (avoid using this) */ |
268 | int irq_to_gpio(unsigned irq); | 272 | int irq_to_gpio(unsigned irq); |
269 | 273 | ||
270 | Those return either the corresponding number in the other namespace, or | 274 | Those return either the corresponding number in the other namespace, or |
@@ -284,7 +288,8 @@ system wakeup capabilities. | |||
284 | 288 | ||
285 | Non-error values returned from irq_to_gpio() would most commonly be used | 289 | Non-error values returned from irq_to_gpio() would most commonly be used |
286 | with gpio_get_value(), for example to initialize or update driver state | 290 | with gpio_get_value(), for example to initialize or update driver state |
287 | when the IRQ is edge-triggered. | 291 | when the IRQ is edge-triggered. Note that some platforms don't support |
292 | this reverse mapping, so you should avoid using it. | ||
288 | 293 | ||
289 | 294 | ||
290 | Emulating Open Drain Signals | 295 | Emulating Open Drain Signals |
diff --git a/Documentation/hwmon/adt7470 b/Documentation/hwmon/adt7470 new file mode 100644 index 00000000000..75d13ca147c --- /dev/null +++ b/Documentation/hwmon/adt7470 | |||
@@ -0,0 +1,76 @@ | |||
1 | Kernel driver adt7470 | ||
2 | ===================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Analog Devices ADT7470 | ||
6 | Prefix: 'adt7470' | ||
7 | Addresses scanned: I2C 0x2C, 0x2E, 0x2F | ||
8 | Datasheet: Publicly available at the Analog Devices website | ||
9 | |||
10 | Author: Darrick J. Wong | ||
11 | |||
12 | Description | ||
13 | ----------- | ||
14 | |||
15 | This driver implements support for the Analog Devices ADT7470 chip. There may | ||
16 | be other chips that implement this interface. | ||
17 | |||
18 | The ADT7470 uses the 2-wire interface compatible with the SMBus 2.0 | ||
19 | specification. Using an analog to digital converter it measures up to ten (10) | ||
20 | external temperatures. It has four (4) 16-bit counters for measuring fan speed. | ||
21 | There are four (4) PWM outputs that can be used to control fan speed. | ||
22 | |||
23 | A sophisticated control system for the PWM outputs is designed into the ADT7470 | ||
24 | that allows fan speed to be adjusted automatically based on any of the ten | ||
25 | temperature sensors. Each PWM output is individually adjustable and | ||
26 | programmable. Once configured, the ADT7470 will adjust the PWM outputs in | ||
27 | response to the measured temperatures with further host intervention. This | ||
28 | feature can also be disabled for manual control of the PWM's. | ||
29 | |||
30 | Each of the measured inputs (temperature, fan speed) has corresponding high/low | ||
31 | limit values. The ADT7470 will signal an ALARM if any measured value exceeds | ||
32 | either limit. | ||
33 | |||
34 | The ADT7470 DOES NOT sample all inputs continuously. A single pin on the | ||
35 | ADT7470 is connected to a multitude of thermal diodes, but the chip must be | ||
36 | instructed explicitly to read the multitude of diodes. If you want to use | ||
37 | automatic fan control mode, you must manually read any of the temperature | ||
38 | sensors or the fan control algorithm will not run. The chip WILL NOT DO THIS | ||
39 | AUTOMATICALLY; this must be done from userspace. This may be a bug in the chip | ||
40 | design, given that many other AD chips take care of this. The driver will not | ||
41 | read the registers more often than once every 5 seconds. Further, | ||
42 | configuration data is only read once per minute. | ||
43 | |||
44 | Special Features | ||
45 | ---------------- | ||
46 | |||
47 | The ADT7470 has a 8-bit ADC and is capable of measuring temperatures with 1 | ||
48 | degC resolution. | ||
49 | |||
50 | The Analog Devices datasheet is very detailed and describes a procedure for | ||
51 | determining an optimal configuration for the automatic PWM control. | ||
52 | |||
53 | Configuration Notes | ||
54 | ------------------- | ||
55 | |||
56 | Besides standard interfaces driver adds the following: | ||
57 | |||
58 | * PWM Control | ||
59 | |||
60 | * pwm#_auto_point1_pwm and pwm#_auto_point1_temp and | ||
61 | * pwm#_auto_point2_pwm and pwm#_auto_point2_temp - | ||
62 | |||
63 | point1: Set the pwm speed at a lower temperature bound. | ||
64 | point2: Set the pwm speed at a higher temperature bound. | ||
65 | |||
66 | The ADT7470 will scale the pwm between the lower and higher pwm speed when | ||
67 | the temperature is between the two temperature boundaries. PWM values range | ||
68 | from 0 (off) to 255 (full speed). Fan speed will be set to maximum when the | ||
69 | temperature sensor associated with the PWM control exceeds | ||
70 | pwm#_auto_point2_temp. | ||
71 | |||
72 | Notes | ||
73 | ----- | ||
74 | |||
75 | As stated above, the temperature inputs must be read periodically from | ||
76 | userspace in order for the automatic pwm algorithm to run. | ||
diff --git a/Documentation/hwmon/it87 b/Documentation/hwmon/it87 index 3496b7020e7..042c0415140 100644 --- a/Documentation/hwmon/it87 +++ b/Documentation/hwmon/it87 | |||
@@ -136,10 +136,10 @@ once-only alarms. | |||
136 | The IT87xx only updates its values each 1.5 seconds; reading it more often | 136 | The IT87xx only updates its values each 1.5 seconds; reading it more often |
137 | will do no harm, but will return 'old' values. | 137 | will do no harm, but will return 'old' values. |
138 | 138 | ||
139 | To change sensor N to a thermistor, 'echo 2 > tempN_type' where N is 1, 2, | 139 | To change sensor N to a thermistor, 'echo 4 > tempN_type' where N is 1, 2, |
140 | or 3. To change sensor N to a thermal diode, 'echo 3 > tempN_type'. | 140 | or 3. To change sensor N to a thermal diode, 'echo 3 > tempN_type'. |
141 | Give 0 for unused sensor. Any other value is invalid. To configure this at | 141 | Give 0 for unused sensor. Any other value is invalid. To configure this at |
142 | startup, consult lm_sensors's /etc/sensors.conf. (2 = thermistor; | 142 | startup, consult lm_sensors's /etc/sensors.conf. (4 = thermistor; |
143 | 3 = thermal diode) | 143 | 3 = thermal diode) |
144 | 144 | ||
145 | 145 | ||
diff --git a/Documentation/hwmon/lm85 b/Documentation/hwmon/lm85 index 6d41db7f17f..40062074129 100644 --- a/Documentation/hwmon/lm85 +++ b/Documentation/hwmon/lm85 | |||
@@ -163,16 +163,6 @@ configured individually according to the following options. | |||
163 | * pwm#_auto_pwm_min - this specifies the PWM value for temp#_auto_temp_off | 163 | * pwm#_auto_pwm_min - this specifies the PWM value for temp#_auto_temp_off |
164 | temperature. (PWM value from 0 to 255) | 164 | temperature. (PWM value from 0 to 255) |
165 | 165 | ||
166 | * pwm#_auto_pwm_freq - select base frequency of PWM output. You can select | ||
167 | in range of 10.0 to 94.0 Hz in .1 Hz units. | ||
168 | (Values 100 to 940). | ||
169 | |||
170 | The pwm#_auto_pwm_freq can be set to one of the following 8 values. Setting the | ||
171 | frequency to a value not on this list, will result in the next higher frequency | ||
172 | being selected. The actual device frequency may vary slightly from this | ||
173 | specification as designed by the manufacturer. Consult the datasheet for more | ||
174 | details. (PWM Frequency values: 100, 150, 230, 300, 380, 470, 620, 940) | ||
175 | |||
176 | * pwm#_auto_pwm_minctl - this flags selects for temp#_auto_temp_off temperature | 166 | * pwm#_auto_pwm_minctl - this flags selects for temp#_auto_temp_off temperature |
177 | the bahaviour of fans. Write 1 to let fans spinning at | 167 | the bahaviour of fans. Write 1 to let fans spinning at |
178 | pwm#_auto_pwm_min or write 0 to let them off. | 168 | pwm#_auto_pwm_min or write 0 to let them off. |
diff --git a/Documentation/hwmon/lm87 b/Documentation/hwmon/lm87 index ec27aa1b94c..6b47b67fd96 100644 --- a/Documentation/hwmon/lm87 +++ b/Documentation/hwmon/lm87 | |||
@@ -65,11 +65,10 @@ The LM87 has four pins which can serve one of two possible functions, | |||
65 | depending on the hardware configuration. | 65 | depending on the hardware configuration. |
66 | 66 | ||
67 | Some functions share pins, so not all functions are available at the same | 67 | Some functions share pins, so not all functions are available at the same |
68 | time. Which are depends on the hardware setup. This driver assumes that | 68 | time. Which are depends on the hardware setup. This driver normally |
69 | the BIOS configured the chip correctly. In that respect, it differs from | 69 | assumes that firmware configured the chip correctly. Where this is not |
70 | the original driver (from lm_sensors for Linux 2.4), which would force the | 70 | the case, platform code must set the I2C client's platform_data to point |
71 | LM87 to an arbitrary, compile-time chosen mode, regardless of the actual | 71 | to a u8 value to be written to the channel register. |
72 | chipset wiring. | ||
73 | 72 | ||
74 | For reference, here is the list of exclusive functions: | 73 | For reference, here is the list of exclusive functions: |
75 | - in0+in5 (default) or temp3 | 74 | - in0+in5 (default) or temp3 |
diff --git a/Documentation/hwmon/lm90 b/Documentation/hwmon/lm90 index aa4a0ec2008..e0d5206d1de 100644 --- a/Documentation/hwmon/lm90 +++ b/Documentation/hwmon/lm90 | |||
@@ -11,7 +11,7 @@ Supported chips: | |||
11 | Prefix: 'lm99' | 11 | Prefix: 'lm99' |
12 | Addresses scanned: I2C 0x4c and 0x4d | 12 | Addresses scanned: I2C 0x4c and 0x4d |
13 | Datasheet: Publicly available at the National Semiconductor website | 13 | Datasheet: Publicly available at the National Semiconductor website |
14 | http://www.national.com/pf/LM/LM89.html | 14 | http://www.national.com/mpf/LM/LM89.html |
15 | * National Semiconductor LM99 | 15 | * National Semiconductor LM99 |
16 | Prefix: 'lm99' | 16 | Prefix: 'lm99' |
17 | Addresses scanned: I2C 0x4c and 0x4d | 17 | Addresses scanned: I2C 0x4c and 0x4d |
@@ -21,18 +21,32 @@ Supported chips: | |||
21 | Prefix: 'lm86' | 21 | Prefix: 'lm86' |
22 | Addresses scanned: I2C 0x4c | 22 | Addresses scanned: I2C 0x4c |
23 | Datasheet: Publicly available at the National Semiconductor website | 23 | Datasheet: Publicly available at the National Semiconductor website |
24 | http://www.national.com/pf/LM/LM86.html | 24 | http://www.national.com/mpf/LM/LM86.html |
25 | * Analog Devices ADM1032 | 25 | * Analog Devices ADM1032 |
26 | Prefix: 'adm1032' | 26 | Prefix: 'adm1032' |
27 | Addresses scanned: I2C 0x4c and 0x4d | 27 | Addresses scanned: I2C 0x4c and 0x4d |
28 | Datasheet: Publicly available at the Analog Devices website | 28 | Datasheet: Publicly available at the ON Semiconductor website |
29 | http://www.analog.com/en/prod/0,2877,ADM1032,00.html | 29 | http://www.onsemi.com/PowerSolutions/product.do?id=ADM1032 |
30 | * Analog Devices ADT7461 | 30 | * Analog Devices ADT7461 |
31 | Prefix: 'adt7461' | 31 | Prefix: 'adt7461' |
32 | Addresses scanned: I2C 0x4c and 0x4d | 32 | Addresses scanned: I2C 0x4c and 0x4d |
33 | Datasheet: Publicly available at the Analog Devices website | 33 | Datasheet: Publicly available at the ON Semiconductor website |
34 | http://www.analog.com/en/prod/0,2877,ADT7461,00.html | 34 | http://www.onsemi.com/PowerSolutions/product.do?id=ADT7461 |
35 | Note: Only if in ADM1032 compatibility mode | 35 | * Maxim MAX6646 |
36 | Prefix: 'max6646' | ||
37 | Addresses scanned: I2C 0x4d | ||
38 | Datasheet: Publicly available at the Maxim website | ||
39 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3497 | ||
40 | * Maxim MAX6647 | ||
41 | Prefix: 'max6646' | ||
42 | Addresses scanned: I2C 0x4e | ||
43 | Datasheet: Publicly available at the Maxim website | ||
44 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3497 | ||
45 | * Maxim MAX6649 | ||
46 | Prefix: 'max6646' | ||
47 | Addresses scanned: I2C 0x4c | ||
48 | Datasheet: Publicly available at the Maxim website | ||
49 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3497 | ||
36 | * Maxim MAX6657 | 50 | * Maxim MAX6657 |
37 | Prefix: 'max6657' | 51 | Prefix: 'max6657' |
38 | Addresses scanned: I2C 0x4c | 52 | Addresses scanned: I2C 0x4c |
@@ -70,25 +84,21 @@ Description | |||
70 | 84 | ||
71 | The LM90 is a digital temperature sensor. It senses its own temperature as | 85 | The LM90 is a digital temperature sensor. It senses its own temperature as |
72 | well as the temperature of up to one external diode. It is compatible | 86 | well as the temperature of up to one external diode. It is compatible |
73 | with many other devices such as the LM86, the LM89, the LM99, the ADM1032, | 87 | with many other devices, many of which are supported by this driver. |
74 | the MAX6657, MAX6658, MAX6659, MAX6680 and the MAX6681 all of which are | ||
75 | supported by this driver. | ||
76 | 88 | ||
77 | Note that there is no easy way to differentiate between the MAX6657, | 89 | Note that there is no easy way to differentiate between the MAX6657, |
78 | MAX6658 and MAX6659 variants. The extra address and features of the | 90 | MAX6658 and MAX6659 variants. The extra address and features of the |
79 | MAX6659 are not supported by this driver. The MAX6680 and MAX6681 only | 91 | MAX6659 are not supported by this driver. The MAX6680 and MAX6681 only |
80 | differ in their pinout, therefore they obviously can't (and don't need to) | 92 | differ in their pinout, therefore they obviously can't (and don't need to) |
81 | be distinguished. Additionally, the ADT7461 is supported if found in | 93 | be distinguished. |
82 | ADM1032 compatibility mode. | ||
83 | 94 | ||
84 | The specificity of this family of chipsets over the ADM1021/LM84 | 95 | The specificity of this family of chipsets over the ADM1021/LM84 |
85 | family is that it features critical limits with hysteresis, and an | 96 | family is that it features critical limits with hysteresis, and an |
86 | increased resolution of the remote temperature measurement. | 97 | increased resolution of the remote temperature measurement. |
87 | 98 | ||
88 | The different chipsets of the family are not strictly identical, although | 99 | The different chipsets of the family are not strictly identical, although |
89 | very similar. This driver doesn't handle any specific feature for now, | 100 | very similar. For reference, here comes a non-exhaustive list of specific |
90 | with the exception of SMBus PEC. For reference, here comes a non-exhaustive | 101 | features: |
91 | list of specific features: | ||
92 | 102 | ||
93 | LM90: | 103 | LM90: |
94 | * Filter and alert configuration register at 0xBF. | 104 | * Filter and alert configuration register at 0xBF. |
@@ -114,9 +124,11 @@ ADT7461: | |||
114 | * Lower resolution for remote temperature | 124 | * Lower resolution for remote temperature |
115 | 125 | ||
116 | MAX6657 and MAX6658: | 126 | MAX6657 and MAX6658: |
127 | * Better local resolution | ||
117 | * Remote sensor type selection | 128 | * Remote sensor type selection |
118 | 129 | ||
119 | MAX6659: | 130 | MAX6659: |
131 | * Better local resolution | ||
120 | * Selectable address | 132 | * Selectable address |
121 | * Second critical temperature limit | 133 | * Second critical temperature limit |
122 | * Remote sensor type selection | 134 | * Remote sensor type selection |
@@ -127,7 +139,8 @@ MAX6680 and MAX6681: | |||
127 | 139 | ||
128 | All temperature values are given in degrees Celsius. Resolution | 140 | All temperature values are given in degrees Celsius. Resolution |
129 | is 1.0 degree for the local temperature, 0.125 degree for the remote | 141 | is 1.0 degree for the local temperature, 0.125 degree for the remote |
130 | temperature. | 142 | temperature, except for the MAX6657, MAX6658 and MAX6659 which have a |
143 | resolution of 0.125 degree for both temperatures. | ||
131 | 144 | ||
132 | Each sensor has its own high and low limits, plus a critical limit. | 145 | Each sensor has its own high and low limits, plus a critical limit. |
133 | Additionally, there is a relative hysteresis value common to both critical | 146 | Additionally, there is a relative hysteresis value common to both critical |
diff --git a/Documentation/hwmon/pc87360 b/Documentation/hwmon/pc87360 index 89a8fcfa78d..cbac32b59c8 100644 --- a/Documentation/hwmon/pc87360 +++ b/Documentation/hwmon/pc87360 | |||
@@ -5,12 +5,7 @@ Supported chips: | |||
5 | * National Semiconductor PC87360, PC87363, PC87364, PC87365 and PC87366 | 5 | * National Semiconductor PC87360, PC87363, PC87364, PC87365 and PC87366 |
6 | Prefixes: 'pc87360', 'pc87363', 'pc87364', 'pc87365', 'pc87366' | 6 | Prefixes: 'pc87360', 'pc87363', 'pc87364', 'pc87365', 'pc87366' |
7 | Addresses scanned: none, address read from Super I/O config space | 7 | Addresses scanned: none, address read from Super I/O config space |
8 | Datasheets: | 8 | Datasheets: No longer available |
9 | http://www.national.com/pf/PC/PC87360.html | ||
10 | http://www.national.com/pf/PC/PC87363.html | ||
11 | http://www.national.com/pf/PC/PC87364.html | ||
12 | http://www.national.com/pf/PC/PC87365.html | ||
13 | http://www.national.com/pf/PC/PC87366.html | ||
14 | 9 | ||
15 | Authors: Jean Delvare <khali@linux-fr.org> | 10 | Authors: Jean Delvare <khali@linux-fr.org> |
16 | 11 | ||
diff --git a/Documentation/hwmon/pc87427 b/Documentation/hwmon/pc87427 index 9a0708f9f49..d1ebbe510f3 100644 --- a/Documentation/hwmon/pc87427 +++ b/Documentation/hwmon/pc87427 | |||
@@ -5,7 +5,7 @@ Supported chips: | |||
5 | * National Semiconductor PC87427 | 5 | * National Semiconductor PC87427 |
6 | Prefix: 'pc87427' | 6 | Prefix: 'pc87427' |
7 | Addresses scanned: none, address read from Super I/O config space | 7 | Addresses scanned: none, address read from Super I/O config space |
8 | Datasheet: http://www.winbond.com.tw/E-WINBONDHTM/partner/apc_007.html | 8 | Datasheet: No longer available |
9 | 9 | ||
10 | Author: Jean Delvare <khali@linux-fr.org> | 10 | Author: Jean Delvare <khali@linux-fr.org> |
11 | 11 | ||
diff --git a/Documentation/hwmon/w83781d b/Documentation/hwmon/w83781d index 6f800a0283e..c91e0b63ea1 100644 --- a/Documentation/hwmon/w83781d +++ b/Documentation/hwmon/w83781d | |||
@@ -353,7 +353,7 @@ in6=255 | |||
353 | 353 | ||
354 | # PWM | 354 | # PWM |
355 | 355 | ||
356 | Additional info about PWM on the AS99127F (may apply to other Asus | 356 | * Additional info about PWM on the AS99127F (may apply to other Asus |
357 | chips as well) by Jean Delvare as of 2004-04-09: | 357 | chips as well) by Jean Delvare as of 2004-04-09: |
358 | 358 | ||
359 | AS99127F revision 2 seems to have two PWM registers at 0x59 and 0x5A, | 359 | AS99127F revision 2 seems to have two PWM registers at 0x59 and 0x5A, |
@@ -396,7 +396,7 @@ Please contact us if you can figure out how it is supposed to work. As | |||
396 | long as we don't know more, the w83781d driver doesn't handle PWM on | 396 | long as we don't know more, the w83781d driver doesn't handle PWM on |
397 | AS99127F chips at all. | 397 | AS99127F chips at all. |
398 | 398 | ||
399 | Additional info about PWM on the AS99127F rev.1 by Hector Martin: | 399 | * Additional info about PWM on the AS99127F rev.1 by Hector Martin: |
400 | 400 | ||
401 | I've been fiddling around with the (in)famous 0x59 register and | 401 | I've been fiddling around with the (in)famous 0x59 register and |
402 | found out the following values do work as a form of coarse pwm: | 402 | found out the following values do work as a form of coarse pwm: |
@@ -418,3 +418,36 @@ change. | |||
418 | My mobo is an ASUS A7V266-E. This behavior is similar to what I got | 418 | My mobo is an ASUS A7V266-E. This behavior is similar to what I got |
419 | with speedfan under Windows, where 0-15% would be off, 15-2x% (can't | 419 | with speedfan under Windows, where 0-15% would be off, 15-2x% (can't |
420 | remember the exact value) would be 70% and higher would be full on. | 420 | remember the exact value) would be 70% and higher would be full on. |
421 | |||
422 | * Additional info about PWM on the AS99127F rev.1 from lm-sensors | ||
423 | ticket #2350: | ||
424 | |||
425 | I conducted some experiment on Asus P3B-F motherboard with AS99127F | ||
426 | (Ver. 1). | ||
427 | |||
428 | I confirm that 0x59 register control the CPU_Fan Header on this | ||
429 | motherboard, and 0x5a register control PWR_Fan. | ||
430 | |||
431 | In order to reduce the dependency of specific fan, the measurement is | ||
432 | conducted with a digital scope without fan connected. I found out that | ||
433 | P3B-F actually output variable DC voltage on fan header center pin, | ||
434 | looks like PWM is filtered on this motherboard. | ||
435 | |||
436 | Here are some of measurements: | ||
437 | |||
438 | 0x80 20 mV | ||
439 | 0x81 20 mV | ||
440 | 0x82 232 mV | ||
441 | 0x83 1.2 V | ||
442 | 0x84 2.31 V | ||
443 | 0x85 3.44 V | ||
444 | 0x86 4.62 V | ||
445 | 0x87 5.81 V | ||
446 | 0x88 7.01 V | ||
447 | 9x89 8.22 V | ||
448 | 0x8a 9.42 V | ||
449 | 0x8b 10.6 V | ||
450 | 0x8c 11.9 V | ||
451 | 0x8d 12.4 V | ||
452 | 0x8e 12.4 V | ||
453 | 0x8f 12.4 V | ||
diff --git a/Documentation/hwmon/w83791d b/Documentation/hwmon/w83791d index a67d3b7a709..5663e491655 100644 --- a/Documentation/hwmon/w83791d +++ b/Documentation/hwmon/w83791d | |||
@@ -58,29 +58,35 @@ internal state that allows no clean access (Bank with ID register is not | |||
58 | currently selected). If you know the address of the chip, use a 'force' | 58 | currently selected). If you know the address of the chip, use a 'force' |
59 | parameter; this will put it into a more well-behaved state first. | 59 | parameter; this will put it into a more well-behaved state first. |
60 | 60 | ||
61 | The driver implements three temperature sensors, five fan rotation speed | 61 | The driver implements three temperature sensors, ten voltage sensors, |
62 | sensors, and ten voltage sensors. | 62 | five fan rotation speed sensors and manual PWM control of each fan. |
63 | 63 | ||
64 | Temperatures are measured in degrees Celsius and measurement resolution is 1 | 64 | Temperatures are measured in degrees Celsius and measurement resolution is 1 |
65 | degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when | 65 | degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when |
66 | the temperature gets higher than the Overtemperature Shutdown value; it stays | 66 | the temperature gets higher than the Overtemperature Shutdown value; it stays |
67 | on until the temperature falls below the Hysteresis value. | 67 | on until the temperature falls below the Hysteresis value. |
68 | 68 | ||
69 | Voltage sensors (also known as IN sensors) report their values in millivolts. | ||
70 | An alarm is triggered if the voltage has crossed a programmable minimum | ||
71 | or maximum limit. | ||
72 | |||
69 | Fan rotation speeds are reported in RPM (rotations per minute). An alarm is | 73 | Fan rotation speeds are reported in RPM (rotations per minute). An alarm is |
70 | triggered if the rotation speed has dropped below a programmable limit. Fan | 74 | triggered if the rotation speed has dropped below a programmable limit. Fan |
71 | readings can be divided by a programmable divider (1, 2, 4, 8, 16, | 75 | readings can be divided by a programmable divider (1, 2, 4, 8, 16, |
72 | 32, 64 or 128 for all fans) to give the readings more range or accuracy. | 76 | 32, 64 or 128 for all fans) to give the readings more range or accuracy. |
73 | 77 | ||
74 | Voltage sensors (also known as IN sensors) report their values in millivolts. | 78 | Each fan controlled is controlled by PWM. The PWM duty cycle can be read and |
75 | An alarm is triggered if the voltage has crossed a programmable minimum | 79 | set for each fan separately. Valid values range from 0 (stop) to 255 (full). |
76 | or maximum limit. | 80 | PWM 1-3 support Thermal Cruise mode, in which the PWMs are automatically |
81 | regulated to keep respectively temp 1-3 at a certain target temperature. | ||
82 | See below for the description of the sysfs-interface. | ||
77 | 83 | ||
78 | The w83791d has a global bit used to enable beeping from the speaker when an | 84 | The w83791d has a global bit used to enable beeping from the speaker when an |
79 | alarm is triggered as well as a bitmask to enable or disable the beep for | 85 | alarm is triggered as well as a bitmask to enable or disable the beep for |
80 | specific alarms. You need both the global beep enable bit and the | 86 | specific alarms. You need both the global beep enable bit and the |
81 | corresponding beep bit to be on for a triggered alarm to sound a beep. | 87 | corresponding beep bit to be on for a triggered alarm to sound a beep. |
82 | 88 | ||
83 | The sysfs interface to the gloabal enable is via the sysfs beep_enable file. | 89 | The sysfs interface to the global enable is via the sysfs beep_enable file. |
84 | This file is used for both legacy and new code. | 90 | This file is used for both legacy and new code. |
85 | 91 | ||
86 | The sysfs interface to the beep bitmask has migrated from the original legacy | 92 | The sysfs interface to the beep bitmask has migrated from the original legacy |
@@ -105,6 +111,27 @@ going forward. | |||
105 | The driver reads the hardware chip values at most once every three seconds. | 111 | The driver reads the hardware chip values at most once every three seconds. |
106 | User mode code requesting values more often will receive cached values. | 112 | User mode code requesting values more often will receive cached values. |
107 | 113 | ||
114 | /sys files | ||
115 | ---------- | ||
116 | The sysfs-interface is documented in the 'sysfs-interface' file. Only | ||
117 | chip-specific options are documented here. | ||
118 | |||
119 | pwm[1-3]_enable - this file controls mode of fan/temperature control for | ||
120 | fan 1-3. Fan/PWM 4-5 only support manual mode. | ||
121 | * 1 Manual mode | ||
122 | * 2 Thermal Cruise mode | ||
123 | * 3 Fan Speed Cruise mode (no further support) | ||
124 | |||
125 | temp[1-3]_target - defines the target temperature for Thermal Cruise mode. | ||
126 | Unit: millidegree Celsius | ||
127 | RW | ||
128 | |||
129 | temp[1-3]_tolerance - temperature tolerance for Thermal Cruise mode. | ||
130 | Specifies an interval around the target temperature | ||
131 | in which the fan speed is not changed. | ||
132 | Unit: millidegree Celsius | ||
133 | RW | ||
134 | |||
108 | Alarms bitmap vs. beep_mask bitmask | 135 | Alarms bitmap vs. beep_mask bitmask |
109 | ------------------------------------ | 136 | ------------------------------------ |
110 | For legacy code using the alarms and beep_mask files: | 137 | For legacy code using the alarms and beep_mask files: |
@@ -132,7 +159,3 @@ tart2 : alarms: 0x020000 beep_mask: 0x080000 <== mismatch | |||
132 | tart3 : alarms: 0x040000 beep_mask: 0x100000 <== mismatch | 159 | tart3 : alarms: 0x040000 beep_mask: 0x100000 <== mismatch |
133 | case_open : alarms: 0x001000 beep_mask: 0x001000 | 160 | case_open : alarms: 0x001000 beep_mask: 0x001000 |
134 | global_enable: alarms: -------- beep_mask: 0x800000 (modified via beep_enable) | 161 | global_enable: alarms: -------- beep_mask: 0x800000 (modified via beep_enable) |
135 | |||
136 | W83791D TODO: | ||
137 | --------------- | ||
138 | Provide a patch for smart-fan control (still need appropriate motherboard/fans) | ||
diff --git a/Documentation/i2c/busses/i2c-viapro b/Documentation/i2c/busses/i2c-viapro index 1405fb69984..22efedf60c8 100644 --- a/Documentation/i2c/busses/i2c-viapro +++ b/Documentation/i2c/busses/i2c-viapro | |||
@@ -16,6 +16,9 @@ Supported adapters: | |||
16 | * VIA Technologies, Inc. CX700 | 16 | * VIA Technologies, Inc. CX700 |
17 | Datasheet: available on request and under NDA from VIA | 17 | Datasheet: available on request and under NDA from VIA |
18 | 18 | ||
19 | * VIA Technologies, Inc. VX800/VX820 | ||
20 | Datasheet: available on http://linux.via.com.tw | ||
21 | |||
19 | Authors: | 22 | Authors: |
20 | Kyösti Mälkki <kmalkki@cc.hut.fi>, | 23 | Kyösti Mälkki <kmalkki@cc.hut.fi>, |
21 | Mark D. Studebaker <mdsxyz123@yahoo.com>, | 24 | Mark D. Studebaker <mdsxyz123@yahoo.com>, |
@@ -49,6 +52,7 @@ Your lspci -n listing must show one of these : | |||
49 | device 1106:3372 (VT8237S) | 52 | device 1106:3372 (VT8237S) |
50 | device 1106:3287 (VT8251) | 53 | device 1106:3287 (VT8251) |
51 | device 1106:8324 (CX700) | 54 | device 1106:8324 (CX700) |
55 | device 1106:8353 (VX800/VX820) | ||
52 | 56 | ||
53 | If none of these show up, you should look in the BIOS for settings like | 57 | If none of these show up, you should look in the BIOS for settings like |
54 | enable ACPI / SMBus or even USB. | 58 | enable ACPI / SMBus or even USB. |
@@ -57,5 +61,5 @@ Except for the oldest chips (VT82C596A/B, VT82C686A and most probably | |||
57 | VT8231), this driver supports I2C block transactions. Such transactions | 61 | VT8231), this driver supports I2C block transactions. Such transactions |
58 | are mainly useful to read from and write to EEPROMs. | 62 | are mainly useful to read from and write to EEPROMs. |
59 | 63 | ||
60 | The CX700 additionally appears to support SMBus PEC, although this driver | 64 | The CX700/VX800/VX820 additionally appears to support SMBus PEC, although |
61 | doesn't implement it yet. | 65 | this driver doesn't implement it yet. |
diff --git a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface index 9dd79123ddd..3e742ba2553 100644 --- a/Documentation/i2c/dev-interface +++ b/Documentation/i2c/dev-interface | |||
@@ -4,6 +4,10 @@ the /dev interface. You need to load module i2c-dev for this. | |||
4 | 4 | ||
5 | Each registered i2c adapter gets a number, counting from 0. You can | 5 | Each registered i2c adapter gets a number, counting from 0. You can |
6 | examine /sys/class/i2c-dev/ to see what number corresponds to which adapter. | 6 | examine /sys/class/i2c-dev/ to see what number corresponds to which adapter. |
7 | Alternatively, you can run "i2cdetect -l" to obtain a formated list of all | ||
8 | i2c adapters present on your system at a given time. i2cdetect is part of | ||
9 | the i2c-tools package. | ||
10 | |||
7 | I2C device files are character device files with major device number 89 | 11 | I2C device files are character device files with major device number 89 |
8 | and a minor device number corresponding to the number assigned as | 12 | and a minor device number corresponding to the number assigned as |
9 | explained above. They should be called "i2c-%d" (i2c-0, i2c-1, ..., | 13 | explained above. They should be called "i2c-%d" (i2c-0, i2c-1, ..., |
@@ -17,30 +21,34 @@ So let's say you want to access an i2c adapter from a C program. The | |||
17 | first thing to do is "#include <linux/i2c-dev.h>". Please note that | 21 | first thing to do is "#include <linux/i2c-dev.h>". Please note that |
18 | there are two files named "i2c-dev.h" out there, one is distributed | 22 | there are two files named "i2c-dev.h" out there, one is distributed |
19 | with the Linux kernel and is meant to be included from kernel | 23 | with the Linux kernel and is meant to be included from kernel |
20 | driver code, the other one is distributed with lm_sensors and is | 24 | driver code, the other one is distributed with i2c-tools and is |
21 | meant to be included from user-space programs. You obviously want | 25 | meant to be included from user-space programs. You obviously want |
22 | the second one here. | 26 | the second one here. |
23 | 27 | ||
24 | Now, you have to decide which adapter you want to access. You should | 28 | Now, you have to decide which adapter you want to access. You should |
25 | inspect /sys/class/i2c-dev/ to decide this. Adapter numbers are assigned | 29 | inspect /sys/class/i2c-dev/ or run "i2cdetect -l" to decide this. |
26 | somewhat dynamically, so you can not even assume /dev/i2c-0 is the | 30 | Adapter numbers are assigned somewhat dynamically, so you can not |
27 | first adapter. | 31 | assume much about them. They can even change from one boot to the next. |
28 | 32 | ||
29 | Next thing, open the device file, as follows: | 33 | Next thing, open the device file, as follows: |
34 | |||
30 | int file; | 35 | int file; |
31 | int adapter_nr = 2; /* probably dynamically determined */ | 36 | int adapter_nr = 2; /* probably dynamically determined */ |
32 | char filename[20]; | 37 | char filename[20]; |
33 | 38 | ||
34 | sprintf(filename,"/dev/i2c-%d",adapter_nr); | 39 | snprintf(filename, 19, "/dev/i2c-%d", adapter_nr); |
35 | if ((file = open(filename,O_RDWR)) < 0) { | 40 | file = open(filename, O_RDWR); |
41 | if (file < 0) { | ||
36 | /* ERROR HANDLING; you can check errno to see what went wrong */ | 42 | /* ERROR HANDLING; you can check errno to see what went wrong */ |
37 | exit(1); | 43 | exit(1); |
38 | } | 44 | } |
39 | 45 | ||
40 | When you have opened the device, you must specify with what device | 46 | When you have opened the device, you must specify with what device |
41 | address you want to communicate: | 47 | address you want to communicate: |
48 | |||
42 | int addr = 0x40; /* The I2C address */ | 49 | int addr = 0x40; /* The I2C address */ |
43 | if (ioctl(file,I2C_SLAVE,addr) < 0) { | 50 | |
51 | if (ioctl(file, I2C_SLAVE, addr) < 0) { | ||
44 | /* ERROR HANDLING; you can check errno to see what went wrong */ | 52 | /* ERROR HANDLING; you can check errno to see what went wrong */ |
45 | exit(1); | 53 | exit(1); |
46 | } | 54 | } |
@@ -48,31 +56,41 @@ address you want to communicate: | |||
48 | Well, you are all set up now. You can now use SMBus commands or plain | 56 | Well, you are all set up now. You can now use SMBus commands or plain |
49 | I2C to communicate with your device. SMBus commands are preferred if | 57 | I2C to communicate with your device. SMBus commands are preferred if |
50 | the device supports them. Both are illustrated below. | 58 | the device supports them. Both are illustrated below. |
59 | |||
51 | __u8 register = 0x10; /* Device register to access */ | 60 | __u8 register = 0x10; /* Device register to access */ |
52 | __s32 res; | 61 | __s32 res; |
53 | char buf[10]; | 62 | char buf[10]; |
63 | |||
54 | /* Using SMBus commands */ | 64 | /* Using SMBus commands */ |
55 | res = i2c_smbus_read_word_data(file,register); | 65 | res = i2c_smbus_read_word_data(file, register); |
56 | if (res < 0) { | 66 | if (res < 0) { |
57 | /* ERROR HANDLING: i2c transaction failed */ | 67 | /* ERROR HANDLING: i2c transaction failed */ |
58 | } else { | 68 | } else { |
59 | /* res contains the read word */ | 69 | /* res contains the read word */ |
60 | } | 70 | } |
71 | |||
61 | /* Using I2C Write, equivalent of | 72 | /* Using I2C Write, equivalent of |
62 | i2c_smbus_write_word_data(file,register,0x6543) */ | 73 | i2c_smbus_write_word_data(file, register, 0x6543) */ |
63 | buf[0] = register; | 74 | buf[0] = register; |
64 | buf[1] = 0x43; | 75 | buf[1] = 0x43; |
65 | buf[2] = 0x65; | 76 | buf[2] = 0x65; |
66 | if ( write(file,buf,3) != 3) { | 77 | if (write(file, buf, 3) ! =3) { |
67 | /* ERROR HANDLING: i2c transaction failed */ | 78 | /* ERROR HANDLING: i2c transaction failed */ |
68 | } | 79 | } |
80 | |||
69 | /* Using I2C Read, equivalent of i2c_smbus_read_byte(file) */ | 81 | /* Using I2C Read, equivalent of i2c_smbus_read_byte(file) */ |
70 | if (read(file,buf,1) != 1) { | 82 | if (read(file, buf, 1) != 1) { |
71 | /* ERROR HANDLING: i2c transaction failed */ | 83 | /* ERROR HANDLING: i2c transaction failed */ |
72 | } else { | 84 | } else { |
73 | /* buf[0] contains the read byte */ | 85 | /* buf[0] contains the read byte */ |
74 | } | 86 | } |
75 | 87 | ||
88 | Note that only a subset of the I2C and SMBus protocols can be achieved by | ||
89 | the means of read() and write() calls. In particular, so-called combined | ||
90 | transactions (mixing read and write messages in the same transaction) | ||
91 | aren't supported. For this reason, this interface is almost never used by | ||
92 | user-space programs. | ||
93 | |||
76 | IMPORTANT: because of the use of inline functions, you *have* to use | 94 | IMPORTANT: because of the use of inline functions, you *have* to use |
77 | '-O' or some variation when you compile your program! | 95 | '-O' or some variation when you compile your program! |
78 | 96 | ||
@@ -80,31 +98,29 @@ IMPORTANT: because of the use of inline functions, you *have* to use | |||
80 | Full interface description | 98 | Full interface description |
81 | ========================== | 99 | ========================== |
82 | 100 | ||
83 | The following IOCTLs are defined and fully supported | 101 | The following IOCTLs are defined: |
84 | (see also i2c-dev.h): | ||
85 | 102 | ||
86 | ioctl(file,I2C_SLAVE,long addr) | 103 | ioctl(file, I2C_SLAVE, long addr) |
87 | Change slave address. The address is passed in the 7 lower bits of the | 104 | Change slave address. The address is passed in the 7 lower bits of the |
88 | argument (except for 10 bit addresses, passed in the 10 lower bits in this | 105 | argument (except for 10 bit addresses, passed in the 10 lower bits in this |
89 | case). | 106 | case). |
90 | 107 | ||
91 | ioctl(file,I2C_TENBIT,long select) | 108 | ioctl(file, I2C_TENBIT, long select) |
92 | Selects ten bit addresses if select not equals 0, selects normal 7 bit | 109 | Selects ten bit addresses if select not equals 0, selects normal 7 bit |
93 | addresses if select equals 0. Default 0. This request is only valid | 110 | addresses if select equals 0. Default 0. This request is only valid |
94 | if the adapter has I2C_FUNC_10BIT_ADDR. | 111 | if the adapter has I2C_FUNC_10BIT_ADDR. |
95 | 112 | ||
96 | ioctl(file,I2C_PEC,long select) | 113 | ioctl(file, I2C_PEC, long select) |
97 | Selects SMBus PEC (packet error checking) generation and verification | 114 | Selects SMBus PEC (packet error checking) generation and verification |
98 | if select not equals 0, disables if select equals 0. Default 0. | 115 | if select not equals 0, disables if select equals 0. Default 0. |
99 | Used only for SMBus transactions. This request only has an effect if the | 116 | Used only for SMBus transactions. This request only has an effect if the |
100 | the adapter has I2C_FUNC_SMBUS_PEC; it is still safe if not, it just | 117 | the adapter has I2C_FUNC_SMBUS_PEC; it is still safe if not, it just |
101 | doesn't have any effect. | 118 | doesn't have any effect. |
102 | 119 | ||
103 | ioctl(file,I2C_FUNCS,unsigned long *funcs) | 120 | ioctl(file, I2C_FUNCS, unsigned long *funcs) |
104 | Gets the adapter functionality and puts it in *funcs. | 121 | Gets the adapter functionality and puts it in *funcs. |
105 | 122 | ||
106 | ioctl(file,I2C_RDWR,struct i2c_rdwr_ioctl_data *msgset) | 123 | ioctl(file, I2C_RDWR, struct i2c_rdwr_ioctl_data *msgset) |
107 | |||
108 | Do combined read/write transaction without stop in between. | 124 | Do combined read/write transaction without stop in between. |
109 | Only valid if the adapter has I2C_FUNC_I2C. The argument is | 125 | Only valid if the adapter has I2C_FUNC_I2C. The argument is |
110 | a pointer to a | 126 | a pointer to a |
@@ -120,10 +136,9 @@ ioctl(file,I2C_RDWR,struct i2c_rdwr_ioctl_data *msgset) | |||
120 | The slave address and whether to use ten bit address mode has to be | 136 | The slave address and whether to use ten bit address mode has to be |
121 | set in each message, overriding the values set with the above ioctl's. | 137 | set in each message, overriding the values set with the above ioctl's. |
122 | 138 | ||
123 | 139 | ioctl(file, I2C_SMBUS, struct i2c_smbus_ioctl_data *args) | |
124 | Other values are NOT supported at this moment, except for I2C_SMBUS, | 140 | Not meant to be called directly; instead, use the access functions |
125 | which you should never directly call; instead, use the access functions | 141 | below. |
126 | below. | ||
127 | 142 | ||
128 | You can do plain i2c transactions by using read(2) and write(2) calls. | 143 | You can do plain i2c transactions by using read(2) and write(2) calls. |
129 | You do not need to pass the address byte; instead, set it through | 144 | You do not need to pass the address byte; instead, set it through |
@@ -148,7 +163,52 @@ what happened. The 'write' transactions return 0 on success; the | |||
148 | returns the number of values read. The block buffers need not be longer | 163 | returns the number of values read. The block buffers need not be longer |
149 | than 32 bytes. | 164 | than 32 bytes. |
150 | 165 | ||
151 | The above functions are all macros, that resolve to calls to the | 166 | The above functions are all inline functions, that resolve to calls to |
152 | i2c_smbus_access function, that on its turn calls a specific ioctl | 167 | the i2c_smbus_access function, that on its turn calls a specific ioctl |
153 | with the data in a specific format. Read the source code if you | 168 | with the data in a specific format. Read the source code if you |
154 | want to know what happens behind the screens. | 169 | want to know what happens behind the screens. |
170 | |||
171 | |||
172 | Implementation details | ||
173 | ====================== | ||
174 | |||
175 | For the interested, here's the code flow which happens inside the kernel | ||
176 | when you use the /dev interface to I2C: | ||
177 | |||
178 | 1* Your program opens /dev/i2c-N and calls ioctl() on it, as described in | ||
179 | section "C example" above. | ||
180 | |||
181 | 2* These open() and ioctl() calls are handled by the i2c-dev kernel | ||
182 | driver: see i2c-dev.c:i2cdev_open() and i2c-dev.c:i2cdev_ioctl(), | ||
183 | respectively. You can think of i2c-dev as a generic I2C chip driver | ||
184 | that can be programmed from user-space. | ||
185 | |||
186 | 3* Some ioctl() calls are for administrative tasks and are handled by | ||
187 | i2c-dev directly. Examples include I2C_SLAVE (set the address of the | ||
188 | device you want to access) and I2C_PEC (enable or disable SMBus error | ||
189 | checking on future transactions.) | ||
190 | |||
191 | 4* Other ioctl() calls are converted to in-kernel function calls by | ||
192 | i2c-dev. Examples include I2C_FUNCS, which queries the I2C adapter | ||
193 | functionality using i2c.h:i2c_get_functionality(), and I2C_SMBUS, which | ||
194 | performs an SMBus transaction using i2c-core.c:i2c_smbus_xfer(). | ||
195 | |||
196 | The i2c-dev driver is responsible for checking all the parameters that | ||
197 | come from user-space for validity. After this point, there is no | ||
198 | difference between these calls that came from user-space through i2c-dev | ||
199 | and calls that would have been performed by kernel I2C chip drivers | ||
200 | directly. This means that I2C bus drivers don't need to implement | ||
201 | anything special to support access from user-space. | ||
202 | |||
203 | 5* These i2c-core.c/i2c.h functions are wrappers to the actual | ||
204 | implementation of your I2C bus driver. Each adapter must declare | ||
205 | callback functions implementing these standard calls. | ||
206 | i2c.h:i2c_get_functionality() calls i2c_adapter.algo->functionality(), | ||
207 | while i2c-core.c:i2c_smbus_xfer() calls either | ||
208 | adapter.algo->smbus_xfer() if it is implemented, or if not, | ||
209 | i2c-core.c:i2c_smbus_xfer_emulated() which in turn calls | ||
210 | i2c_adapter.algo->master_xfer(). | ||
211 | |||
212 | After your I2C bus driver has processed these requests, execution runs | ||
213 | up the call chain, with almost no processing done, except by i2c-dev to | ||
214 | package the returned data, if any, in suitable format for the ioctl. | ||
diff --git a/Documentation/i2c/smbus-protocol b/Documentation/i2c/smbus-protocol index 24bfb65da17..9df47441f0e 100644 --- a/Documentation/i2c/smbus-protocol +++ b/Documentation/i2c/smbus-protocol | |||
@@ -109,8 +109,8 @@ specified through the Comm byte. | |||
109 | S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P | 109 | S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P |
110 | 110 | ||
111 | 111 | ||
112 | SMBus Process Call | 112 | SMBus Process Call: i2c_smbus_process_call() |
113 | ================== | 113 | ============================================= |
114 | 114 | ||
115 | This command selects a device register (through the Comm byte), sends | 115 | This command selects a device register (through the Comm byte), sends |
116 | 16 bits of data to it, and reads 16 bits of data in return. | 116 | 16 bits of data to it, and reads 16 bits of data in return. |
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index 6b61b3a2e90..d73ee117a8c 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients | |||
@@ -606,6 +606,8 @@ SMBus communication | |||
606 | extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); | 606 | extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); |
607 | extern s32 i2c_smbus_write_word_data(struct i2c_client * client, | 607 | extern s32 i2c_smbus_write_word_data(struct i2c_client * client, |
608 | u8 command, u16 value); | 608 | u8 command, u16 value); |
609 | extern s32 i2c_smbus_process_call(struct i2c_client *client, | ||
610 | u8 command, u16 value); | ||
609 | extern s32 i2c_smbus_read_block_data(struct i2c_client * client, | 611 | extern s32 i2c_smbus_read_block_data(struct i2c_client * client, |
610 | u8 command, u8 *values); | 612 | u8 command, u8 *values); |
611 | extern s32 i2c_smbus_write_block_data(struct i2c_client * client, | 613 | extern s32 i2c_smbus_write_block_data(struct i2c_client * client, |
@@ -621,8 +623,6 @@ These ones were removed from i2c-core because they had no users, but could | |||
621 | be added back later if needed: | 623 | be added back later if needed: |
622 | 624 | ||
623 | extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value); | 625 | extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value); |
624 | extern s32 i2c_smbus_process_call(struct i2c_client * client, | ||
625 | u8 command, u16 value); | ||
626 | extern s32 i2c_smbus_block_process_call(struct i2c_client *client, | 626 | extern s32 i2c_smbus_block_process_call(struct i2c_client *client, |
627 | u8 command, u8 length, | 627 | u8 command, u8 length, |
628 | u8 *values) | 628 | u8 *values) |
diff --git a/Documentation/ia64/kvm.txt b/Documentation/ia64/kvm.txt index 914d07f4926..84f7cb3d5be 100644 --- a/Documentation/ia64/kvm.txt +++ b/Documentation/ia64/kvm.txt | |||
@@ -1,7 +1,8 @@ | |||
1 | Currently, kvm module in EXPERIMENTAL stage on IA64. This means that | 1 | Currently, kvm module is in EXPERIMENTAL stage on IA64. This means that |
2 | interfaces are not stable enough to use. So, plase had better don't run | 2 | interfaces are not stable enough to use. So, please don't run critical |
3 | critical applications in virtual machine. We will try our best to make it | 3 | applications in virtual machine. |
4 | strong in future versions! | 4 | We will try our best to improve it in future versions! |
5 | |||
5 | Guide: How to boot up guests on kvm/ia64 | 6 | Guide: How to boot up guests on kvm/ia64 |
6 | 7 | ||
7 | This guide is to describe how to enable kvm support for IA-64 systems. | 8 | This guide is to describe how to enable kvm support for IA-64 systems. |
diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt index 1c6b545635a..b880ce5dbd3 100644 --- a/Documentation/ioctl-number.txt +++ b/Documentation/ioctl-number.txt | |||
@@ -92,6 +92,7 @@ Code Seq# Include File Comments | |||
92 | 'J' 00-1F drivers/scsi/gdth_ioctl.h | 92 | 'J' 00-1F drivers/scsi/gdth_ioctl.h |
93 | 'K' all linux/kd.h | 93 | 'K' all linux/kd.h |
94 | 'L' 00-1F linux/loop.h | 94 | 'L' 00-1F linux/loop.h |
95 | 'L' 20-2F driver/usb/misc/vstusb.h | ||
95 | 'L' E0-FF linux/ppdd.h encrypted disk device driver | 96 | 'L' E0-FF linux/ppdd.h encrypted disk device driver |
96 | <http://linux01.gwdg.de/~alatham/ppdd.html> | 97 | <http://linux01.gwdg.de/~alatham/ppdd.html> |
97 | 'M' all linux/soundcard.h | 98 | 'M' all linux/soundcard.h |
@@ -110,6 +111,8 @@ Code Seq# Include File Comments | |||
110 | 'W' 00-1F linux/wanrouter.h conflict! | 111 | 'W' 00-1F linux/wanrouter.h conflict! |
111 | 'X' all linux/xfs_fs.h | 112 | 'X' all linux/xfs_fs.h |
112 | 'Y' all linux/cyclades.h | 113 | 'Y' all linux/cyclades.h |
114 | '[' 00-07 linux/usb/usbtmc.h USB Test and Measurement Devices | ||
115 | <mailto:gregkh@suse.de> | ||
113 | 'a' all ATM on linux | 116 | 'a' all ATM on linux |
114 | <http://lrcwww.epfl.ch/linux-atm/magic.html> | 117 | <http://lrcwww.epfl.ch/linux-atm/magic.html> |
115 | 'b' 00-FF bit3 vme host bridge | 118 | 'b' 00-FF bit3 vme host bridge |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 2443f5bb436..0f1544f6740 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -690,7 +690,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
690 | See Documentation/block/as-iosched.txt and | 690 | See Documentation/block/as-iosched.txt and |
691 | Documentation/block/deadline-iosched.txt for details. | 691 | Documentation/block/deadline-iosched.txt for details. |
692 | 692 | ||
693 | elfcorehdr= [X86-32, X86_64] | 693 | elfcorehdr= [IA64,PPC,SH,X86-32,X86_64] |
694 | Specifies physical address of start of kernel core | 694 | Specifies physical address of start of kernel core |
695 | image elf header. Generally kexec loader will | 695 | image elf header. Generally kexec loader will |
696 | pass this option to capture kernel. | 696 | pass this option to capture kernel. |
@@ -796,6 +796,9 @@ and is between 256 and 4096 characters. It is defined in the file | |||
796 | Defaults to the default architecture's huge page size | 796 | Defaults to the default architecture's huge page size |
797 | if not specified. | 797 | if not specified. |
798 | 798 | ||
799 | hlt [BUGS=ARM,SH] | ||
800 | |||
801 | i8042.debug [HW] Toggle i8042 debug mode | ||
799 | i8042.direct [HW] Put keyboard port into non-translated mode | 802 | i8042.direct [HW] Put keyboard port into non-translated mode |
800 | i8042.dumbkbd [HW] Pretend that controller can only read data from | 803 | i8042.dumbkbd [HW] Pretend that controller can only read data from |
801 | keyboard and cannot control its state | 804 | keyboard and cannot control its state |
@@ -1210,6 +1213,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1210 | mem=nopentium [BUGS=X86-32] Disable usage of 4MB pages for kernel | 1213 | mem=nopentium [BUGS=X86-32] Disable usage of 4MB pages for kernel |
1211 | memory. | 1214 | memory. |
1212 | 1215 | ||
1216 | memchunk=nn[KMG] | ||
1217 | [KNL,SH] Allow user to override the default size for | ||
1218 | per-device physically contiguous DMA buffers. | ||
1219 | |||
1213 | memmap=exactmap [KNL,X86-32,X86_64] Enable setting of an exact | 1220 | memmap=exactmap [KNL,X86-32,X86_64] Enable setting of an exact |
1214 | E820 memory map, as specified by the user. | 1221 | E820 memory map, as specified by the user. |
1215 | Such memmap=exactmap lines can be constructed based on | 1222 | Such memmap=exactmap lines can be constructed based on |
@@ -1392,6 +1399,8 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1392 | 1399 | ||
1393 | nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects. | 1400 | nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects. |
1394 | 1401 | ||
1402 | nodsp [SH] Disable hardware DSP at boot time. | ||
1403 | |||
1395 | noefi [X86-32,X86-64] Disable EFI runtime services support. | 1404 | noefi [X86-32,X86-64] Disable EFI runtime services support. |
1396 | 1405 | ||
1397 | noexec [IA-64] | 1406 | noexec [IA-64] |
@@ -1408,13 +1417,15 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1408 | noexec32=off: disable non-executable mappings | 1417 | noexec32=off: disable non-executable mappings |
1409 | read implies executable mappings | 1418 | read implies executable mappings |
1410 | 1419 | ||
1420 | nofpu [SH] Disable hardware FPU at boot time. | ||
1421 | |||
1411 | nofxsr [BUGS=X86-32] Disables x86 floating point extended | 1422 | nofxsr [BUGS=X86-32] Disables x86 floating point extended |
1412 | register save and restore. The kernel will only save | 1423 | register save and restore. The kernel will only save |
1413 | legacy floating-point registers on task switch. | 1424 | legacy floating-point registers on task switch. |
1414 | 1425 | ||
1415 | noclflush [BUGS=X86] Don't use the CLFLUSH instruction | 1426 | noclflush [BUGS=X86] Don't use the CLFLUSH instruction |
1416 | 1427 | ||
1417 | nohlt [BUGS=ARM] | 1428 | nohlt [BUGS=ARM,SH] |
1418 | 1429 | ||
1419 | no-hlt [BUGS=X86-32] Tells the kernel that the hlt | 1430 | no-hlt [BUGS=X86-32] Tells the kernel that the hlt |
1420 | instruction doesn't work correctly and not to | 1431 | instruction doesn't work correctly and not to |
@@ -1713,6 +1724,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1713 | autoconfiguration. | 1724 | autoconfiguration. |
1714 | Ranges are in pairs (memory base and size). | 1725 | Ranges are in pairs (memory base and size). |
1715 | 1726 | ||
1727 | dynamic_printk | ||
1728 | Enables pr_debug()/dev_dbg() calls if | ||
1729 | CONFIG_DYNAMIC_PRINTK_DEBUG has been enabled. These can also | ||
1730 | be switched on/off via <debugfs>/dynamic_printk/modules | ||
1731 | |||
1716 | print-fatal-signals= | 1732 | print-fatal-signals= |
1717 | [KNL] debug: print fatal signals | 1733 | [KNL] debug: print fatal signals |
1718 | print-fatal-signals=1: print segfault info to | 1734 | print-fatal-signals=1: print segfault info to |
@@ -2247,6 +2263,25 @@ and is between 256 and 4096 characters. It is defined in the file | |||
2247 | autosuspended. Devices for which the delay is set | 2263 | autosuspended. Devices for which the delay is set |
2248 | to a negative value won't be autosuspended at all. | 2264 | to a negative value won't be autosuspended at all. |
2249 | 2265 | ||
2266 | usbcore.usbfs_snoop= | ||
2267 | [USB] Set to log all usbfs traffic (default 0 = off). | ||
2268 | |||
2269 | usbcore.blinkenlights= | ||
2270 | [USB] Set to cycle leds on hubs (default 0 = off). | ||
2271 | |||
2272 | usbcore.old_scheme_first= | ||
2273 | [USB] Start with the old device initialization | ||
2274 | scheme (default 0 = off). | ||
2275 | |||
2276 | usbcore.use_both_schemes= | ||
2277 | [USB] Try the other device initialization scheme | ||
2278 | if the first one fails (default 1 = enabled). | ||
2279 | |||
2280 | usbcore.initial_descriptor_timeout= | ||
2281 | [USB] Specifies timeout for the initial 64-byte | ||
2282 | USB_REQ_GET_DESCRIPTOR request in milliseconds | ||
2283 | (default 5000 = 5.0 seconds). | ||
2284 | |||
2250 | usbhid.mousepoll= | 2285 | usbhid.mousepoll= |
2251 | [USBHID] The interval which mice are to be polled at. | 2286 | [USBHID] The interval which mice are to be polled at. |
2252 | 2287 | ||
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt index 51a8021ee53..f5d2aad65a6 100644 --- a/Documentation/kobject.txt +++ b/Documentation/kobject.txt | |||
@@ -118,6 +118,10 @@ the name of the kobject, call kobject_rename(): | |||
118 | 118 | ||
119 | int kobject_rename(struct kobject *kobj, const char *new_name); | 119 | int kobject_rename(struct kobject *kobj, const char *new_name); |
120 | 120 | ||
121 | Note kobject_rename does perform any locking or have a solid notion of | ||
122 | what names are valid so the provide must provide their own sanity checking | ||
123 | and serialization. | ||
124 | |||
121 | There is a function called kobject_set_name() but that is legacy cruft and | 125 | There is a function called kobject_set_name() but that is legacy cruft and |
122 | is being removed. If your code needs to call this function, it is | 126 | is being removed. If your code needs to call this function, it is |
123 | incorrect and needs to be fixed. | 127 | incorrect and needs to be fixed. |
diff --git a/Documentation/laptops/disk-shock-protection.txt b/Documentation/laptops/disk-shock-protection.txt new file mode 100644 index 00000000000..0e6ba266383 --- /dev/null +++ b/Documentation/laptops/disk-shock-protection.txt | |||
@@ -0,0 +1,149 @@ | |||
1 | Hard disk shock protection | ||
2 | ========================== | ||
3 | |||
4 | Author: Elias Oltmanns <eo@nebensachen.de> | ||
5 | Last modified: 2008-10-03 | ||
6 | |||
7 | |||
8 | 0. Contents | ||
9 | ----------- | ||
10 | |||
11 | 1. Intro | ||
12 | 2. The interface | ||
13 | 3. References | ||
14 | 4. CREDITS | ||
15 | |||
16 | |||
17 | 1. Intro | ||
18 | -------- | ||
19 | |||
20 | ATA/ATAPI-7 specifies the IDLE IMMEDIATE command with unload feature. | ||
21 | Issuing this command should cause the drive to switch to idle mode and | ||
22 | unload disk heads. This feature is being used in modern laptops in | ||
23 | conjunction with accelerometers and appropriate software to implement | ||
24 | a shock protection facility. The idea is to stop all I/O operations on | ||
25 | the internal hard drive and park its heads on the ramp when critical | ||
26 | situations are anticipated. The desire to have such a feature | ||
27 | available on GNU/Linux systems has been the original motivation to | ||
28 | implement a generic disk head parking interface in the Linux kernel. | ||
29 | Please note, however, that other components have to be set up on your | ||
30 | system in order to get disk shock protection working (see | ||
31 | section 3. References below for pointers to more information about | ||
32 | that). | ||
33 | |||
34 | |||
35 | 2. The interface | ||
36 | ---------------- | ||
37 | |||
38 | For each ATA device, the kernel exports the file | ||
39 | block/*/device/unload_heads in sysfs (here assumed to be mounted under | ||
40 | /sys). Access to /sys/block/*/device/unload_heads is denied with | ||
41 | -EOPNOTSUPP if the device does not support the unload feature. | ||
42 | Otherwise, writing an integer value to this file will take the heads | ||
43 | of the respective drive off the platter and block all I/O operations | ||
44 | for the specified number of milliseconds. When the timeout expires and | ||
45 | no further disk head park request has been issued in the meantime, | ||
46 | normal operation will be resumed. The maximal value accepted for a | ||
47 | timeout is 30000 milliseconds. Exceeding this limit will return | ||
48 | -EOVERFLOW, but heads will be parked anyway and the timeout will be | ||
49 | set to 30 seconds. However, you can always change a timeout to any | ||
50 | value between 0 and 30000 by issuing a subsequent head park request | ||
51 | before the timeout of the previous one has expired. In particular, the | ||
52 | total timeout can exceed 30 seconds and, more importantly, you can | ||
53 | cancel a previously set timeout and resume normal operation | ||
54 | immediately by specifying a timeout of 0. Values below -2 are rejected | ||
55 | with -EINVAL (see below for the special meaning of -1 and -2). If the | ||
56 | timeout specified for a recent head park request has not yet expired, | ||
57 | reading from /sys/block/*/device/unload_heads will report the number | ||
58 | of milliseconds remaining until normal operation will be resumed; | ||
59 | otherwise, reading the unload_heads attribute will return 0. | ||
60 | |||
61 | For example, do the following in order to park the heads of drive | ||
62 | /dev/sda and stop all I/O operations for five seconds: | ||
63 | |||
64 | # echo 5000 > /sys/block/sda/device/unload_heads | ||
65 | |||
66 | A simple | ||
67 | |||
68 | # cat /sys/block/sda/device/unload_heads | ||
69 | |||
70 | will show you how many milliseconds are left before normal operation | ||
71 | will be resumed. | ||
72 | |||
73 | A word of caution: The fact that the interface operates on a basis of | ||
74 | milliseconds may raise expectations that cannot be satisfied in | ||
75 | reality. In fact, the ATA specs clearly state that the time for an | ||
76 | unload operation to complete is vendor specific. The hint in ATA-7 | ||
77 | that this will typically be within 500 milliseconds apparently has | ||
78 | been dropped in ATA-8. | ||
79 | |||
80 | There is a technical detail of this implementation that may cause some | ||
81 | confusion and should be discussed here. When a head park request has | ||
82 | been issued to a device successfully, all I/O operations on the | ||
83 | controller port this device is attached to will be deferred. That is | ||
84 | to say, any other device that may be connected to the same port will | ||
85 | be affected too. The only exception is that a subsequent head unload | ||
86 | request to that other device will be executed immediately. Further | ||
87 | operations on that port will be deferred until the timeout specified | ||
88 | for either device on the port has expired. As far as PATA (old style | ||
89 | IDE) configurations are concerned, there can only be two devices | ||
90 | attached to any single port. In SATA world we have port multipliers | ||
91 | which means that a user-issued head parking request to one device may | ||
92 | actually result in stopping I/O to a whole bunch of devices. However, | ||
93 | since this feature is supposed to be used on laptops and does not seem | ||
94 | to be very useful in any other environment, there will be mostly one | ||
95 | device per port. Even if the CD/DVD writer happens to be connected to | ||
96 | the same port as the hard drive, it generally *should* recover just | ||
97 | fine from the occasional buffer under-run incurred by a head park | ||
98 | request to the HD. Actually, when you are using an ide driver rather | ||
99 | than its libata counterpart (i.e. your disk is called /dev/hda | ||
100 | instead of /dev/sda), then parking the heads of one drive (drive X) | ||
101 | will generally not affect the mode of operation of another drive | ||
102 | (drive Y) on the same port as described above. It is only when a port | ||
103 | reset is required to recover from an exception on drive Y that further | ||
104 | I/O operations on that drive (and the reset itself) will be delayed | ||
105 | until drive X is no longer in the parked state. | ||
106 | |||
107 | Finally, there are some hard drives that only comply with an earlier | ||
108 | version of the ATA standard than ATA-7, but do support the unload | ||
109 | feature nonetheless. Unfortunately, there is no safe way Linux can | ||
110 | detect these devices, so you won't be able to write to the | ||
111 | unload_heads attribute. If you know that your device really does | ||
112 | support the unload feature (for instance, because the vendor of your | ||
113 | laptop or the hard drive itself told you so), then you can tell the | ||
114 | kernel to enable the usage of this feature for that drive by writing | ||
115 | the special value -1 to the unload_heads attribute: | ||
116 | |||
117 | # echo -1 > /sys/block/sda/device/unload_heads | ||
118 | |||
119 | will enable the feature for /dev/sda, and giving -2 instead of -1 will | ||
120 | disable it again. | ||
121 | |||
122 | |||
123 | 3. References | ||
124 | ------------- | ||
125 | |||
126 | There are several laptops from different vendors featuring shock | ||
127 | protection capabilities. As manufacturers have refused to support open | ||
128 | source development of the required software components so far, Linux | ||
129 | support for shock protection varies considerably between different | ||
130 | hardware implementations. Ideally, this section should contain a list | ||
131 | of pointers at different projects aiming at an implementation of shock | ||
132 | protection on different systems. Unfortunately, I only know of a | ||
133 | single project which, although still considered experimental, is fit | ||
134 | for use. Please feel free to add projects that have been the victims | ||
135 | of my ignorance. | ||
136 | |||
137 | - http://www.thinkwiki.org/wiki/HDAPS | ||
138 | See this page for information about Linux support of the hard disk | ||
139 | active protection system as implemented in IBM/Lenovo Thinkpads. | ||
140 | |||
141 | |||
142 | 4. CREDITS | ||
143 | ---------- | ||
144 | |||
145 | This implementation of disk head parking has been inspired by a patch | ||
146 | originally published by Jon Escombe <lists@dresco.co.uk>. My efforts | ||
147 | to develop an implementation of this feature that is fit to be merged | ||
148 | into mainline have been aided by various kernel developers, in | ||
149 | particular by Tejun Heo and Bartlomiej Zolnierkiewicz. | ||
diff --git a/Documentation/mtd/nand_ecc.txt b/Documentation/mtd/nand_ecc.txt new file mode 100644 index 00000000000..bdf93b7f0f2 --- /dev/null +++ b/Documentation/mtd/nand_ecc.txt | |||
@@ -0,0 +1,714 @@ | |||
1 | Introduction | ||
2 | ============ | ||
3 | |||
4 | Having looked at the linux mtd/nand driver and more specific at nand_ecc.c | ||
5 | I felt there was room for optimisation. I bashed the code for a few hours | ||
6 | performing tricks like table lookup removing superfluous code etc. | ||
7 | After that the speed was increased by 35-40%. | ||
8 | Still I was not too happy as I felt there was additional room for improvement. | ||
9 | |||
10 | Bad! I was hooked. | ||
11 | I decided to annotate my steps in this file. Perhaps it is useful to someone | ||
12 | or someone learns something from it. | ||
13 | |||
14 | |||
15 | The problem | ||
16 | =========== | ||
17 | |||
18 | NAND flash (at least SLC one) typically has sectors of 256 bytes. | ||
19 | However NAND flash is not extremely reliable so some error detection | ||
20 | (and sometimes correction) is needed. | ||
21 | |||
22 | This is done by means of a Hamming code. I'll try to explain it in | ||
23 | laymans terms (and apologies to all the pro's in the field in case I do | ||
24 | not use the right terminology, my coding theory class was almost 30 | ||
25 | years ago, and I must admit it was not one of my favourites). | ||
26 | |||
27 | As I said before the ecc calculation is performed on sectors of 256 | ||
28 | bytes. This is done by calculating several parity bits over the rows and | ||
29 | columns. The parity used is even parity which means that the parity bit = 1 | ||
30 | if the data over which the parity is calculated is 1 and the parity bit = 0 | ||
31 | if the data over which the parity is calculated is 0. So the total | ||
32 | number of bits over the data over which the parity is calculated + the | ||
33 | parity bit is even. (see wikipedia if you can't follow this). | ||
34 | Parity is often calculated by means of an exclusive or operation, | ||
35 | sometimes also referred to as xor. In C the operator for xor is ^ | ||
36 | |||
37 | Back to ecc. | ||
38 | Let's give a small figure: | ||
39 | |||
40 | byte 0: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp0 rp2 rp4 ... rp14 | ||
41 | byte 1: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp1 rp2 rp4 ... rp14 | ||
42 | byte 2: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp0 rp3 rp4 ... rp14 | ||
43 | byte 3: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp1 rp3 rp4 ... rp14 | ||
44 | byte 4: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp0 rp2 rp5 ... rp14 | ||
45 | .... | ||
46 | byte 254: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp0 rp3 rp5 ... rp15 | ||
47 | byte 255: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp1 rp3 rp5 ... rp15 | ||
48 | cp1 cp0 cp1 cp0 cp1 cp0 cp1 cp0 | ||
49 | cp3 cp3 cp2 cp2 cp3 cp3 cp2 cp2 | ||
50 | cp5 cp5 cp5 cp5 cp4 cp4 cp4 cp4 | ||
51 | |||
52 | This figure represents a sector of 256 bytes. | ||
53 | cp is my abbreviaton for column parity, rp for row parity. | ||
54 | |||
55 | Let's start to explain column parity. | ||
56 | cp0 is the parity that belongs to all bit0, bit2, bit4, bit6. | ||
57 | so the sum of all bit0, bit2, bit4 and bit6 values + cp0 itself is even. | ||
58 | Similarly cp1 is the sum of all bit1, bit3, bit5 and bit7. | ||
59 | cp2 is the parity over bit0, bit1, bit4 and bit5 | ||
60 | cp3 is the parity over bit2, bit3, bit6 and bit7. | ||
61 | cp4 is the parity over bit0, bit1, bit2 and bit3. | ||
62 | cp5 is the parity over bit4, bit5, bit6 and bit7. | ||
63 | Note that each of cp0 .. cp5 is exactly one bit. | ||
64 | |||
65 | Row parity actually works almost the same. | ||
66 | rp0 is the parity of all even bytes (0, 2, 4, 6, ... 252, 254) | ||
67 | rp1 is the parity of all odd bytes (1, 3, 5, 7, ..., 253, 255) | ||
68 | rp2 is the parity of all bytes 0, 1, 4, 5, 8, 9, ... | ||
69 | (so handle two bytes, then skip 2 bytes). | ||
70 | rp3 is covers the half rp2 does not cover (bytes 2, 3, 6, 7, 10, 11, ...) | ||
71 | for rp4 the rule is cover 4 bytes, skip 4 bytes, cover 4 bytes, skip 4 etc. | ||
72 | so rp4 calculates parity over bytes 0, 1, 2, 3, 8, 9, 10, 11, 16, ...) | ||
73 | and rp5 covers the other half, so bytes 4, 5, 6, 7, 12, 13, 14, 15, 20, .. | ||
74 | The story now becomes quite boring. I guess you get the idea. | ||
75 | rp6 covers 8 bytes then skips 8 etc | ||
76 | rp7 skips 8 bytes then covers 8 etc | ||
77 | rp8 covers 16 bytes then skips 16 etc | ||
78 | rp9 skips 16 bytes then covers 16 etc | ||
79 | rp10 covers 32 bytes then skips 32 etc | ||
80 | rp11 skips 32 bytes then covers 32 etc | ||
81 | rp12 covers 64 bytes then skips 64 etc | ||
82 | rp13 skips 64 bytes then covers 64 etc | ||
83 | rp14 covers 128 bytes then skips 128 | ||
84 | rp15 skips 128 bytes then covers 128 | ||
85 | |||
86 | In the end the parity bits are grouped together in three bytes as | ||
87 | follows: | ||
88 | ECC Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 | ||
89 | ECC 0 rp07 rp06 rp05 rp04 rp03 rp02 rp01 rp00 | ||
90 | ECC 1 rp15 rp14 rp13 rp12 rp11 rp10 rp09 rp08 | ||
91 | ECC 2 cp5 cp4 cp3 cp2 cp1 cp0 1 1 | ||
92 | |||
93 | I detected after writing this that ST application note AN1823 | ||
94 | (http://www.st.com/stonline/books/pdf/docs/10123.pdf) gives a much | ||
95 | nicer picture.(but they use line parity as term where I use row parity) | ||
96 | Oh well, I'm graphically challenged, so suffer with me for a moment :-) | ||
97 | And I could not reuse the ST picture anyway for copyright reasons. | ||
98 | |||
99 | |||
100 | Attempt 0 | ||
101 | ========= | ||
102 | |||
103 | Implementing the parity calculation is pretty simple. | ||
104 | In C pseudocode: | ||
105 | for (i = 0; i < 256; i++) | ||
106 | { | ||
107 | if (i & 0x01) | ||
108 | rp1 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp1; | ||
109 | else | ||
110 | rp0 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp1; | ||
111 | if (i & 0x02) | ||
112 | rp3 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp3; | ||
113 | else | ||
114 | rp2 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp2; | ||
115 | if (i & 0x04) | ||
116 | rp5 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp5; | ||
117 | else | ||
118 | rp4 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp4; | ||
119 | if (i & 0x08) | ||
120 | rp7 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp7; | ||
121 | else | ||
122 | rp6 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp6; | ||
123 | if (i & 0x10) | ||
124 | rp9 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp9; | ||
125 | else | ||
126 | rp8 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp8; | ||
127 | if (i & 0x20) | ||
128 | rp11 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp11; | ||
129 | else | ||
130 | rp10 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp10; | ||
131 | if (i & 0x40) | ||
132 | rp13 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp13; | ||
133 | else | ||
134 | rp12 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp12; | ||
135 | if (i & 0x80) | ||
136 | rp15 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp15; | ||
137 | else | ||
138 | rp14 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp14; | ||
139 | cp0 = bit6 ^ bit4 ^ bit2 ^ bit0 ^ cp0; | ||
140 | cp1 = bit7 ^ bit5 ^ bit3 ^ bit1 ^ cp1; | ||
141 | cp2 = bit5 ^ bit4 ^ bit1 ^ bit0 ^ cp2; | ||
142 | cp3 = bit7 ^ bit6 ^ bit3 ^ bit2 ^ cp3 | ||
143 | cp4 = bit3 ^ bit2 ^ bit1 ^ bit0 ^ cp4 | ||
144 | cp5 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ cp5 | ||
145 | } | ||
146 | |||
147 | |||
148 | Analysis 0 | ||
149 | ========== | ||
150 | |||
151 | C does have bitwise operators but not really operators to do the above | ||
152 | efficiently (and most hardware has no such instructions either). | ||
153 | Therefore without implementing this it was clear that the code above was | ||
154 | not going to bring me a Nobel prize :-) | ||
155 | |||
156 | Fortunately the exclusive or operation is commutative, so we can combine | ||
157 | the values in any order. So instead of calculating all the bits | ||
158 | individually, let us try to rearrange things. | ||
159 | For the column parity this is easy. We can just xor the bytes and in the | ||
160 | end filter out the relevant bits. This is pretty nice as it will bring | ||
161 | all cp calculation out of the if loop. | ||
162 | |||
163 | Similarly we can first xor the bytes for the various rows. | ||
164 | This leads to: | ||
165 | |||
166 | |||
167 | Attempt 1 | ||
168 | ========= | ||
169 | |||
170 | const char parity[256] = { | ||
171 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
172 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
173 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
174 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
175 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
176 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
177 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
178 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
179 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
180 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
181 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
182 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
183 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
184 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
185 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
186 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 | ||
187 | }; | ||
188 | |||
189 | void ecc1(const unsigned char *buf, unsigned char *code) | ||
190 | { | ||
191 | int i; | ||
192 | const unsigned char *bp = buf; | ||
193 | unsigned char cur; | ||
194 | unsigned char rp0, rp1, rp2, rp3, rp4, rp5, rp6, rp7; | ||
195 | unsigned char rp8, rp9, rp10, rp11, rp12, rp13, rp14, rp15; | ||
196 | unsigned char par; | ||
197 | |||
198 | par = 0; | ||
199 | rp0 = 0; rp1 = 0; rp2 = 0; rp3 = 0; | ||
200 | rp4 = 0; rp5 = 0; rp6 = 0; rp7 = 0; | ||
201 | rp8 = 0; rp9 = 0; rp10 = 0; rp11 = 0; | ||
202 | rp12 = 0; rp13 = 0; rp14 = 0; rp15 = 0; | ||
203 | |||
204 | for (i = 0; i < 256; i++) | ||
205 | { | ||
206 | cur = *bp++; | ||
207 | par ^= cur; | ||
208 | if (i & 0x01) rp1 ^= cur; else rp0 ^= cur; | ||
209 | if (i & 0x02) rp3 ^= cur; else rp2 ^= cur; | ||
210 | if (i & 0x04) rp5 ^= cur; else rp4 ^= cur; | ||
211 | if (i & 0x08) rp7 ^= cur; else rp6 ^= cur; | ||
212 | if (i & 0x10) rp9 ^= cur; else rp8 ^= cur; | ||
213 | if (i & 0x20) rp11 ^= cur; else rp10 ^= cur; | ||
214 | if (i & 0x40) rp13 ^= cur; else rp12 ^= cur; | ||
215 | if (i & 0x80) rp15 ^= cur; else rp14 ^= cur; | ||
216 | } | ||
217 | code[0] = | ||
218 | (parity[rp7] << 7) | | ||
219 | (parity[rp6] << 6) | | ||
220 | (parity[rp5] << 5) | | ||
221 | (parity[rp4] << 4) | | ||
222 | (parity[rp3] << 3) | | ||
223 | (parity[rp2] << 2) | | ||
224 | (parity[rp1] << 1) | | ||
225 | (parity[rp0]); | ||
226 | code[1] = | ||
227 | (parity[rp15] << 7) | | ||
228 | (parity[rp14] << 6) | | ||
229 | (parity[rp13] << 5) | | ||
230 | (parity[rp12] << 4) | | ||
231 | (parity[rp11] << 3) | | ||
232 | (parity[rp10] << 2) | | ||
233 | (parity[rp9] << 1) | | ||
234 | (parity[rp8]); | ||
235 | code[2] = | ||
236 | (parity[par & 0xf0] << 7) | | ||
237 | (parity[par & 0x0f] << 6) | | ||
238 | (parity[par & 0xcc] << 5) | | ||
239 | (parity[par & 0x33] << 4) | | ||
240 | (parity[par & 0xaa] << 3) | | ||
241 | (parity[par & 0x55] << 2); | ||
242 | code[0] = ~code[0]; | ||
243 | code[1] = ~code[1]; | ||
244 | code[2] = ~code[2]; | ||
245 | } | ||
246 | |||
247 | Still pretty straightforward. The last three invert statements are there to | ||
248 | give a checksum of 0xff 0xff 0xff for an empty flash. In an empty flash | ||
249 | all data is 0xff, so the checksum then matches. | ||
250 | |||
251 | I also introduced the parity lookup. I expected this to be the fastest | ||
252 | way to calculate the parity, but I will investigate alternatives later | ||
253 | on. | ||
254 | |||
255 | |||
256 | Analysis 1 | ||
257 | ========== | ||
258 | |||
259 | The code works, but is not terribly efficient. On my system it took | ||
260 | almost 4 times as much time as the linux driver code. But hey, if it was | ||
261 | *that* easy this would have been done long before. | ||
262 | No pain. no gain. | ||
263 | |||
264 | Fortunately there is plenty of room for improvement. | ||
265 | |||
266 | In step 1 we moved from bit-wise calculation to byte-wise calculation. | ||
267 | However in C we can also use the unsigned long data type and virtually | ||
268 | every modern microprocessor supports 32 bit operations, so why not try | ||
269 | to write our code in such a way that we process data in 32 bit chunks. | ||
270 | |||
271 | Of course this means some modification as the row parity is byte by | ||
272 | byte. A quick analysis: | ||
273 | for the column parity we use the par variable. When extending to 32 bits | ||
274 | we can in the end easily calculate p0 and p1 from it. | ||
275 | (because par now consists of 4 bytes, contributing to rp1, rp0, rp1, rp0 | ||
276 | respectively) | ||
277 | also rp2 and rp3 can be easily retrieved from par as rp3 covers the | ||
278 | first two bytes and rp2 the last two bytes. | ||
279 | |||
280 | Note that of course now the loop is executed only 64 times (256/4). | ||
281 | And note that care must taken wrt byte ordering. The way bytes are | ||
282 | ordered in a long is machine dependent, and might affect us. | ||
283 | Anyway, if there is an issue: this code is developed on x86 (to be | ||
284 | precise: a DELL PC with a D920 Intel CPU) | ||
285 | |||
286 | And of course the performance might depend on alignment, but I expect | ||
287 | that the I/O buffers in the nand driver are aligned properly (and | ||
288 | otherwise that should be fixed to get maximum performance). | ||
289 | |||
290 | Let's give it a try... | ||
291 | |||
292 | |||
293 | Attempt 2 | ||
294 | ========= | ||
295 | |||
296 | extern const char parity[256]; | ||
297 | |||
298 | void ecc2(const unsigned char *buf, unsigned char *code) | ||
299 | { | ||
300 | int i; | ||
301 | const unsigned long *bp = (unsigned long *)buf; | ||
302 | unsigned long cur; | ||
303 | unsigned long rp0, rp1, rp2, rp3, rp4, rp5, rp6, rp7; | ||
304 | unsigned long rp8, rp9, rp10, rp11, rp12, rp13, rp14, rp15; | ||
305 | unsigned long par; | ||
306 | |||
307 | par = 0; | ||
308 | rp0 = 0; rp1 = 0; rp2 = 0; rp3 = 0; | ||
309 | rp4 = 0; rp5 = 0; rp6 = 0; rp7 = 0; | ||
310 | rp8 = 0; rp9 = 0; rp10 = 0; rp11 = 0; | ||
311 | rp12 = 0; rp13 = 0; rp14 = 0; rp15 = 0; | ||
312 | |||
313 | for (i = 0; i < 64; i++) | ||
314 | { | ||
315 | cur = *bp++; | ||
316 | par ^= cur; | ||
317 | if (i & 0x01) rp5 ^= cur; else rp4 ^= cur; | ||
318 | if (i & 0x02) rp7 ^= cur; else rp6 ^= cur; | ||
319 | if (i & 0x04) rp9 ^= cur; else rp8 ^= cur; | ||
320 | if (i & 0x08) rp11 ^= cur; else rp10 ^= cur; | ||
321 | if (i & 0x10) rp13 ^= cur; else rp12 ^= cur; | ||
322 | if (i & 0x20) rp15 ^= cur; else rp14 ^= cur; | ||
323 | } | ||
324 | /* | ||
325 | we need to adapt the code generation for the fact that rp vars are now | ||
326 | long; also the column parity calculation needs to be changed. | ||
327 | we'll bring rp4 to 15 back to single byte entities by shifting and | ||
328 | xoring | ||
329 | */ | ||
330 | rp4 ^= (rp4 >> 16); rp4 ^= (rp4 >> 8); rp4 &= 0xff; | ||
331 | rp5 ^= (rp5 >> 16); rp5 ^= (rp5 >> 8); rp5 &= 0xff; | ||
332 | rp6 ^= (rp6 >> 16); rp6 ^= (rp6 >> 8); rp6 &= 0xff; | ||
333 | rp7 ^= (rp7 >> 16); rp7 ^= (rp7 >> 8); rp7 &= 0xff; | ||
334 | rp8 ^= (rp8 >> 16); rp8 ^= (rp8 >> 8); rp8 &= 0xff; | ||
335 | rp9 ^= (rp9 >> 16); rp9 ^= (rp9 >> 8); rp9 &= 0xff; | ||
336 | rp10 ^= (rp10 >> 16); rp10 ^= (rp10 >> 8); rp10 &= 0xff; | ||
337 | rp11 ^= (rp11 >> 16); rp11 ^= (rp11 >> 8); rp11 &= 0xff; | ||
338 | rp12 ^= (rp12 >> 16); rp12 ^= (rp12 >> 8); rp12 &= 0xff; | ||
339 | rp13 ^= (rp13 >> 16); rp13 ^= (rp13 >> 8); rp13 &= 0xff; | ||
340 | rp14 ^= (rp14 >> 16); rp14 ^= (rp14 >> 8); rp14 &= 0xff; | ||
341 | rp15 ^= (rp15 >> 16); rp15 ^= (rp15 >> 8); rp15 &= 0xff; | ||
342 | rp3 = (par >> 16); rp3 ^= (rp3 >> 8); rp3 &= 0xff; | ||
343 | rp2 = par & 0xffff; rp2 ^= (rp2 >> 8); rp2 &= 0xff; | ||
344 | par ^= (par >> 16); | ||
345 | rp1 = (par >> 8); rp1 &= 0xff; | ||
346 | rp0 = (par & 0xff); | ||
347 | par ^= (par >> 8); par &= 0xff; | ||
348 | |||
349 | code[0] = | ||
350 | (parity[rp7] << 7) | | ||
351 | (parity[rp6] << 6) | | ||
352 | (parity[rp5] << 5) | | ||
353 | (parity[rp4] << 4) | | ||
354 | (parity[rp3] << 3) | | ||
355 | (parity[rp2] << 2) | | ||
356 | (parity[rp1] << 1) | | ||
357 | (parity[rp0]); | ||
358 | code[1] = | ||
359 | (parity[rp15] << 7) | | ||
360 | (parity[rp14] << 6) | | ||
361 | (parity[rp13] << 5) | | ||
362 | (parity[rp12] << 4) | | ||
363 | (parity[rp11] << 3) | | ||
364 | (parity[rp10] << 2) | | ||
365 | (parity[rp9] << 1) | | ||
366 | (parity[rp8]); | ||
367 | code[2] = | ||
368 | (parity[par & 0xf0] << 7) | | ||
369 | (parity[par & 0x0f] << 6) | | ||
370 | (parity[par & 0xcc] << 5) | | ||
371 | (parity[par & 0x33] << 4) | | ||
372 | (parity[par & 0xaa] << 3) | | ||
373 | (parity[par & 0x55] << 2); | ||
374 | code[0] = ~code[0]; | ||
375 | code[1] = ~code[1]; | ||
376 | code[2] = ~code[2]; | ||
377 | } | ||
378 | |||
379 | The parity array is not shown any more. Note also that for these | ||
380 | examples I kinda deviated from my regular programming style by allowing | ||
381 | multiple statements on a line, not using { } in then and else blocks | ||
382 | with only a single statement and by using operators like ^= | ||
383 | |||
384 | |||
385 | Analysis 2 | ||
386 | ========== | ||
387 | |||
388 | The code (of course) works, and hurray: we are a little bit faster than | ||
389 | the linux driver code (about 15%). But wait, don't cheer too quickly. | ||
390 | THere is more to be gained. | ||
391 | If we look at e.g. rp14 and rp15 we see that we either xor our data with | ||
392 | rp14 or with rp15. However we also have par which goes over all data. | ||
393 | This means there is no need to calculate rp14 as it can be calculated from | ||
394 | rp15 through rp14 = par ^ rp15; | ||
395 | (or if desired we can avoid calculating rp15 and calculate it from | ||
396 | rp14). That is why some places refer to inverse parity. | ||
397 | Of course the same thing holds for rp4/5, rp6/7, rp8/9, rp10/11 and rp12/13. | ||
398 | Effectively this means we can eliminate the else clause from the if | ||
399 | statements. Also we can optimise the calculation in the end a little bit | ||
400 | by going from long to byte first. Actually we can even avoid the table | ||
401 | lookups | ||
402 | |||
403 | Attempt 3 | ||
404 | ========= | ||
405 | |||
406 | Odd replaced: | ||
407 | if (i & 0x01) rp5 ^= cur; else rp4 ^= cur; | ||
408 | if (i & 0x02) rp7 ^= cur; else rp6 ^= cur; | ||
409 | if (i & 0x04) rp9 ^= cur; else rp8 ^= cur; | ||
410 | if (i & 0x08) rp11 ^= cur; else rp10 ^= cur; | ||
411 | if (i & 0x10) rp13 ^= cur; else rp12 ^= cur; | ||
412 | if (i & 0x20) rp15 ^= cur; else rp14 ^= cur; | ||
413 | with | ||
414 | if (i & 0x01) rp5 ^= cur; | ||
415 | if (i & 0x02) rp7 ^= cur; | ||
416 | if (i & 0x04) rp9 ^= cur; | ||
417 | if (i & 0x08) rp11 ^= cur; | ||
418 | if (i & 0x10) rp13 ^= cur; | ||
419 | if (i & 0x20) rp15 ^= cur; | ||
420 | |||
421 | and outside the loop added: | ||
422 | rp4 = par ^ rp5; | ||
423 | rp6 = par ^ rp7; | ||
424 | rp8 = par ^ rp9; | ||
425 | rp10 = par ^ rp11; | ||
426 | rp12 = par ^ rp13; | ||
427 | rp14 = par ^ rp15; | ||
428 | |||
429 | And after that the code takes about 30% more time, although the number of | ||
430 | statements is reduced. This is also reflected in the assembly code. | ||
431 | |||
432 | |||
433 | Analysis 3 | ||
434 | ========== | ||
435 | |||
436 | Very weird. Guess it has to do with caching or instruction parallellism | ||
437 | or so. I also tried on an eeePC (Celeron, clocked at 900 Mhz). Interesting | ||
438 | observation was that this one is only 30% slower (according to time) | ||
439 | executing the code as my 3Ghz D920 processor. | ||
440 | |||
441 | Well, it was expected not to be easy so maybe instead move to a | ||
442 | different track: let's move back to the code from attempt2 and do some | ||
443 | loop unrolling. This will eliminate a few if statements. I'll try | ||
444 | different amounts of unrolling to see what works best. | ||
445 | |||
446 | |||
447 | Attempt 4 | ||
448 | ========= | ||
449 | |||
450 | Unrolled the loop 1, 2, 3 and 4 times. | ||
451 | For 4 the code starts with: | ||
452 | |||
453 | for (i = 0; i < 4; i++) | ||
454 | { | ||
455 | cur = *bp++; | ||
456 | par ^= cur; | ||
457 | rp4 ^= cur; | ||
458 | rp6 ^= cur; | ||
459 | rp8 ^= cur; | ||
460 | rp10 ^= cur; | ||
461 | if (i & 0x1) rp13 ^= cur; else rp12 ^= cur; | ||
462 | if (i & 0x2) rp15 ^= cur; else rp14 ^= cur; | ||
463 | cur = *bp++; | ||
464 | par ^= cur; | ||
465 | rp5 ^= cur; | ||
466 | rp6 ^= cur; | ||
467 | ... | ||
468 | |||
469 | |||
470 | Analysis 4 | ||
471 | ========== | ||
472 | |||
473 | Unrolling once gains about 15% | ||
474 | Unrolling twice keeps the gain at about 15% | ||
475 | Unrolling three times gives a gain of 30% compared to attempt 2. | ||
476 | Unrolling four times gives a marginal improvement compared to unrolling | ||
477 | three times. | ||
478 | |||
479 | I decided to proceed with a four time unrolled loop anyway. It was my gut | ||
480 | feeling that in the next steps I would obtain additional gain from it. | ||
481 | |||
482 | The next step was triggered by the fact that par contains the xor of all | ||
483 | bytes and rp4 and rp5 each contain the xor of half of the bytes. | ||
484 | So in effect par = rp4 ^ rp5. But as xor is commutative we can also say | ||
485 | that rp5 = par ^ rp4. So no need to keep both rp4 and rp5 around. We can | ||
486 | eliminate rp5 (or rp4, but I already foresaw another optimisation). | ||
487 | The same holds for rp6/7, rp8/9, rp10/11 rp12/13 and rp14/15. | ||
488 | |||
489 | |||
490 | Attempt 5 | ||
491 | ========= | ||
492 | |||
493 | Effectively so all odd digit rp assignments in the loop were removed. | ||
494 | This included the else clause of the if statements. | ||
495 | Of course after the loop we need to correct things by adding code like: | ||
496 | rp5 = par ^ rp4; | ||
497 | Also the initial assignments (rp5 = 0; etc) could be removed. | ||
498 | Along the line I also removed the initialisation of rp0/1/2/3. | ||
499 | |||
500 | |||
501 | Analysis 5 | ||
502 | ========== | ||
503 | |||
504 | Measurements showed this was a good move. The run-time roughly halved | ||
505 | compared with attempt 4 with 4 times unrolled, and we only require 1/3rd | ||
506 | of the processor time compared to the current code in the linux kernel. | ||
507 | |||
508 | However, still I thought there was more. I didn't like all the if | ||
509 | statements. Why not keep a running parity and only keep the last if | ||
510 | statement. Time for yet another version! | ||
511 | |||
512 | |||
513 | Attempt 6 | ||
514 | ========= | ||
515 | |||
516 | THe code within the for loop was changed to: | ||
517 | |||
518 | for (i = 0; i < 4; i++) | ||
519 | { | ||
520 | cur = *bp++; tmppar = cur; rp4 ^= cur; | ||
521 | cur = *bp++; tmppar ^= cur; rp6 ^= tmppar; | ||
522 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
523 | cur = *bp++; tmppar ^= cur; rp8 ^= tmppar; | ||
524 | |||
525 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; | ||
526 | cur = *bp++; tmppar ^= cur; rp6 ^= cur; | ||
527 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
528 | cur = *bp++; tmppar ^= cur; rp10 ^= tmppar; | ||
529 | |||
530 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; rp8 ^= cur; | ||
531 | cur = *bp++; tmppar ^= cur; rp6 ^= cur; rp8 ^= cur; | ||
532 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp8 ^= cur; | ||
533 | cur = *bp++; tmppar ^= cur; rp8 ^= cur; | ||
534 | |||
535 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; | ||
536 | cur = *bp++; tmppar ^= cur; rp6 ^= cur; | ||
537 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
538 | cur = *bp++; tmppar ^= cur; | ||
539 | |||
540 | par ^= tmppar; | ||
541 | if ((i & 0x1) == 0) rp12 ^= tmppar; | ||
542 | if ((i & 0x2) == 0) rp14 ^= tmppar; | ||
543 | } | ||
544 | |||
545 | As you can see tmppar is used to accumulate the parity within a for | ||
546 | iteration. In the last 3 statements is is added to par and, if needed, | ||
547 | to rp12 and rp14. | ||
548 | |||
549 | While making the changes I also found that I could exploit that tmppar | ||
550 | contains the running parity for this iteration. So instead of having: | ||
551 | rp4 ^= cur; rp6 = cur; | ||
552 | I removed the rp6 = cur; statement and did rp6 ^= tmppar; on next | ||
553 | statement. A similar change was done for rp8 and rp10 | ||
554 | |||
555 | |||
556 | Analysis 6 | ||
557 | ========== | ||
558 | |||
559 | Measuring this code again showed big gain. When executing the original | ||
560 | linux code 1 million times, this took about 1 second on my system. | ||
561 | (using time to measure the performance). After this iteration I was back | ||
562 | to 0.075 sec. Actually I had to decide to start measuring over 10 | ||
563 | million interations in order not to loose too much accuracy. This one | ||
564 | definitely seemed to be the jackpot! | ||
565 | |||
566 | There is a little bit more room for improvement though. There are three | ||
567 | places with statements: | ||
568 | rp4 ^= cur; rp6 ^= cur; | ||
569 | It seems more efficient to also maintain a variable rp4_6 in the while | ||
570 | loop; This eliminates 3 statements per loop. Of course after the loop we | ||
571 | need to correct by adding: | ||
572 | rp4 ^= rp4_6; | ||
573 | rp6 ^= rp4_6 | ||
574 | Furthermore there are 4 sequential assingments to rp8. This can be | ||
575 | encoded slightly more efficient by saving tmppar before those 4 lines | ||
576 | and later do rp8 = rp8 ^ tmppar ^ notrp8; | ||
577 | (where notrp8 is the value of rp8 before those 4 lines). | ||
578 | Again a use of the commutative property of xor. | ||
579 | Time for a new test! | ||
580 | |||
581 | |||
582 | Attempt 7 | ||
583 | ========= | ||
584 | |||
585 | The new code now looks like: | ||
586 | |||
587 | for (i = 0; i < 4; i++) | ||
588 | { | ||
589 | cur = *bp++; tmppar = cur; rp4 ^= cur; | ||
590 | cur = *bp++; tmppar ^= cur; rp6 ^= tmppar; | ||
591 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
592 | cur = *bp++; tmppar ^= cur; rp8 ^= tmppar; | ||
593 | |||
594 | cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; | ||
595 | cur = *bp++; tmppar ^= cur; rp6 ^= cur; | ||
596 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
597 | cur = *bp++; tmppar ^= cur; rp10 ^= tmppar; | ||
598 | |||
599 | notrp8 = tmppar; | ||
600 | cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; | ||
601 | cur = *bp++; tmppar ^= cur; rp6 ^= cur; | ||
602 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
603 | cur = *bp++; tmppar ^= cur; | ||
604 | rp8 = rp8 ^ tmppar ^ notrp8; | ||
605 | |||
606 | cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; | ||
607 | cur = *bp++; tmppar ^= cur; rp6 ^= cur; | ||
608 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
609 | cur = *bp++; tmppar ^= cur; | ||
610 | |||
611 | par ^= tmppar; | ||
612 | if ((i & 0x1) == 0) rp12 ^= tmppar; | ||
613 | if ((i & 0x2) == 0) rp14 ^= tmppar; | ||
614 | } | ||
615 | rp4 ^= rp4_6; | ||
616 | rp6 ^= rp4_6; | ||
617 | |||
618 | |||
619 | Not a big change, but every penny counts :-) | ||
620 | |||
621 | |||
622 | Analysis 7 | ||
623 | ========== | ||
624 | |||
625 | Acutally this made things worse. Not very much, but I don't want to move | ||
626 | into the wrong direction. Maybe something to investigate later. Could | ||
627 | have to do with caching again. | ||
628 | |||
629 | Guess that is what there is to win within the loop. Maybe unrolling one | ||
630 | more time will help. I'll keep the optimisations from 7 for now. | ||
631 | |||
632 | |||
633 | Attempt 8 | ||
634 | ========= | ||
635 | |||
636 | Unrolled the loop one more time. | ||
637 | |||
638 | |||
639 | Analysis 8 | ||
640 | ========== | ||
641 | |||
642 | This makes things worse. Let's stick with attempt 6 and continue from there. | ||
643 | Although it seems that the code within the loop cannot be optimised | ||
644 | further there is still room to optimize the generation of the ecc codes. | ||
645 | We can simply calcualate the total parity. If this is 0 then rp4 = rp5 | ||
646 | etc. If the parity is 1, then rp4 = !rp5; | ||
647 | But if rp4 = rp5 we do not need rp5 etc. We can just write the even bits | ||
648 | in the result byte and then do something like | ||
649 | code[0] |= (code[0] << 1); | ||
650 | Lets test this. | ||
651 | |||
652 | |||
653 | Attempt 9 | ||
654 | ========= | ||
655 | |||
656 | Changed the code but again this slightly degrades performance. Tried all | ||
657 | kind of other things, like having dedicated parity arrays to avoid the | ||
658 | shift after parity[rp7] << 7; No gain. | ||
659 | Change the lookup using the parity array by using shift operators (e.g. | ||
660 | replace parity[rp7] << 7 with: | ||
661 | rp7 ^= (rp7 << 4); | ||
662 | rp7 ^= (rp7 << 2); | ||
663 | rp7 ^= (rp7 << 1); | ||
664 | rp7 &= 0x80; | ||
665 | No gain. | ||
666 | |||
667 | The only marginal change was inverting the parity bits, so we can remove | ||
668 | the last three invert statements. | ||
669 | |||
670 | Ah well, pity this does not deliver more. Then again 10 million | ||
671 | iterations using the linux driver code takes between 13 and 13.5 | ||
672 | seconds, whereas my code now takes about 0.73 seconds for those 10 | ||
673 | million iterations. So basically I've improved the performance by a | ||
674 | factor 18 on my system. Not that bad. Of course on different hardware | ||
675 | you will get different results. No warranties! | ||
676 | |||
677 | But of course there is no such thing as a free lunch. The codesize almost | ||
678 | tripled (from 562 bytes to 1434 bytes). Then again, it is not that much. | ||
679 | |||
680 | |||
681 | Correcting errors | ||
682 | ================= | ||
683 | |||
684 | For correcting errors I again used the ST application note as a starter, | ||
685 | but I also peeked at the existing code. | ||
686 | The algorithm itself is pretty straightforward. Just xor the given and | ||
687 | the calculated ecc. If all bytes are 0 there is no problem. If 11 bits | ||
688 | are 1 we have one correctable bit error. If there is 1 bit 1, we have an | ||
689 | error in the given ecc code. | ||
690 | It proved to be fastest to do some table lookups. Performance gain | ||
691 | introduced by this is about a factor 2 on my system when a repair had to | ||
692 | be done, and 1% or so if no repair had to be done. | ||
693 | Code size increased from 330 bytes to 686 bytes for this function. | ||
694 | (gcc 4.2, -O3) | ||
695 | |||
696 | |||
697 | Conclusion | ||
698 | ========== | ||
699 | |||
700 | The gain when calculating the ecc is tremendous. Om my development hardware | ||
701 | a speedup of a factor of 18 for ecc calculation was achieved. On a test on an | ||
702 | embedded system with a MIPS core a factor 7 was obtained. | ||
703 | On a test with a Linksys NSLU2 (ARMv5TE processor) the speedup was a factor | ||
704 | 5 (big endian mode, gcc 4.1.2, -O3) | ||
705 | For correction not much gain could be obtained (as bitflips are rare). Then | ||
706 | again there are also much less cycles spent there. | ||
707 | |||
708 | It seems there is not much more gain possible in this, at least when | ||
709 | programmed in C. Of course it might be possible to squeeze something more | ||
710 | out of it with an assembler program, but due to pipeline behaviour etc | ||
711 | this is very tricky (at least for intel hw). | ||
712 | |||
713 | Author: Frans Meulenbroeks | ||
714 | Copyright (C) 2008 Koninklijke Philips Electronics NV. | ||
diff --git a/Documentation/networking/cs89x0.txt b/Documentation/networking/cs89x0.txt index 6387d3decf8..c725d33b316 100644 --- a/Documentation/networking/cs89x0.txt +++ b/Documentation/networking/cs89x0.txt | |||
@@ -3,7 +3,7 @@ NOTE | |||
3 | ---- | 3 | ---- |
4 | 4 | ||
5 | This document was contributed by Cirrus Logic for kernel 2.2.5. This version | 5 | This document was contributed by Cirrus Logic for kernel 2.2.5. This version |
6 | has been updated for 2.3.48 by Andrew Morton <andrewm@uow.edu.au> | 6 | has been updated for 2.3.48 by Andrew Morton. |
7 | 7 | ||
8 | Cirrus make a copy of this driver available at their website, as | 8 | Cirrus make a copy of this driver available at their website, as |
9 | described below. In general, you should use the driver version which | 9 | described below. In general, you should use the driver version which |
@@ -690,7 +690,7 @@ latest drivers and technical publications. | |||
690 | 6.4 Current maintainer | 690 | 6.4 Current maintainer |
691 | 691 | ||
692 | In February 2000 the maintenance of this driver was assumed by Andrew | 692 | In February 2000 the maintenance of this driver was assumed by Andrew |
693 | Morton <akpm@zip.com.au> | 693 | Morton. |
694 | 694 | ||
695 | 6.5 Kernel module parameters | 695 | 6.5 Kernel module parameters |
696 | 696 | ||
diff --git a/Documentation/networking/phonet.txt b/Documentation/networking/phonet.txt index 0e6e592f4f5..6a07e45d4a9 100644 --- a/Documentation/networking/phonet.txt +++ b/Documentation/networking/phonet.txt | |||
@@ -146,8 +146,8 @@ WARNING: | |||
146 | When polling a connected pipe socket for writability, there is an | 146 | When polling a connected pipe socket for writability, there is an |
147 | intrinsic race condition whereby writability might be lost between the | 147 | intrinsic race condition whereby writability might be lost between the |
148 | polling and the writing system calls. In this case, the socket will | 148 | polling and the writing system calls. In this case, the socket will |
149 | block until write because possible again, unless non-blocking mode | 149 | block until write becomes possible again, unless non-blocking mode |
150 | becomes enabled. | 150 | is enabled. |
151 | 151 | ||
152 | 152 | ||
153 | The pipe protocol provides two socket options at the SOL_PNPIPE level: | 153 | The pipe protocol provides two socket options at the SOL_PNPIPE level: |
diff --git a/Documentation/networking/vortex.txt b/Documentation/networking/vortex.txt index 6356d3faed3..bd70976b816 100644 --- a/Documentation/networking/vortex.txt +++ b/Documentation/networking/vortex.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | Documentation/networking/vortex.txt | 1 | Documentation/networking/vortex.txt |
2 | Andrew Morton <andrewm@uow.edu.au> | 2 | Andrew Morton |
3 | 30 April 2000 | 3 | 30 April 2000 |
4 | 4 | ||
5 | 5 | ||
@@ -11,7 +11,7 @@ The driver was written by Donald Becker <becker@scyld.com> | |||
11 | Don is no longer the prime maintainer of this version of the driver. | 11 | Don is no longer the prime maintainer of this version of the driver. |
12 | Please report problems to one or more of: | 12 | Please report problems to one or more of: |
13 | 13 | ||
14 | Andrew Morton <akpm@osdl.org> | 14 | Andrew Morton |
15 | Netdev mailing list <netdev@vger.kernel.org> | 15 | Netdev mailing list <netdev@vger.kernel.org> |
16 | Linux kernel mailing list <linux-kernel@vger.kernel.org> | 16 | Linux kernel mailing list <linux-kernel@vger.kernel.org> |
17 | 17 | ||
@@ -305,11 +305,6 @@ Donald's wake-on-LAN page: | |||
305 | 305 | ||
306 | ftp://ftp.3com.com/pub/nic/3c90x/3c90xx2.exe | 306 | ftp://ftp.3com.com/pub/nic/3c90x/3c90xx2.exe |
307 | 307 | ||
308 | Driver updates and a detailed changelog for the modifications which | ||
309 | were made for the 2.3/2,4 series kernel is available at | ||
310 | |||
311 | http://www.zip.com.au/~akpm/linux/#3c59x-bc | ||
312 | |||
313 | 308 | ||
314 | Autonegotiation notes | 309 | Autonegotiation notes |
315 | --------------------- | 310 | --------------------- |
diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt index 96f155e6875..059934363ca 100644 --- a/Documentation/pcmcia/driver-changes.txt +++ b/Documentation/pcmcia/driver-changes.txt | |||
@@ -1,5 +1,11 @@ | |||
1 | This file details changes in 2.6 which affect PCMCIA card driver authors: | 1 | This file details changes in 2.6 which affect PCMCIA card driver authors: |
2 | 2 | ||
3 | * New configuration loop helper (as of 2.6.28) | ||
4 | By calling pcmcia_loop_config(), a driver can iterate over all available | ||
5 | configuration options. During a driver's probe() phase, one doesn't need | ||
6 | to use pcmcia_get_{first,next}_tuple, pcmcia_get_tuple_data and | ||
7 | pcmcia_parse_tuple directly in most if not all cases. | ||
8 | |||
3 | * New release helper (as of 2.6.17) | 9 | * New release helper (as of 2.6.17) |
4 | Instead of calling pcmcia_release_{configuration,io,irq,win}, all that's | 10 | Instead of calling pcmcia_release_{configuration,io,irq,win}, all that's |
5 | necessary now is calling pcmcia_disable_device. As there is no valid | 11 | necessary now is calling pcmcia_disable_device. As there is no valid |
diff --git a/Documentation/power/regulator/machine.txt b/Documentation/power/regulator/machine.txt index c9a35665cf7..ce3487d99ab 100644 --- a/Documentation/power/regulator/machine.txt +++ b/Documentation/power/regulator/machine.txt | |||
@@ -2,17 +2,8 @@ Regulator Machine Driver Interface | |||
2 | =================================== | 2 | =================================== |
3 | 3 | ||
4 | The regulator machine driver interface is intended for board/machine specific | 4 | The regulator machine driver interface is intended for board/machine specific |
5 | initialisation code to configure the regulator subsystem. Typical things that | 5 | initialisation code to configure the regulator subsystem. |
6 | machine drivers would do are :- | ||
7 | 6 | ||
8 | 1. Regulator -> Device mapping. | ||
9 | 2. Regulator supply configuration. | ||
10 | 3. Power Domain constraint setting. | ||
11 | |||
12 | |||
13 | |||
14 | 1. Regulator -> device mapping | ||
15 | ============================== | ||
16 | Consider the following machine :- | 7 | Consider the following machine :- |
17 | 8 | ||
18 | Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V] | 9 | Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V] |
@@ -21,81 +12,82 @@ Consider the following machine :- | |||
21 | 12 | ||
22 | The drivers for consumers A & B must be mapped to the correct regulator in | 13 | The drivers for consumers A & B must be mapped to the correct regulator in |
23 | order to control their power supply. This mapping can be achieved in machine | 14 | order to control their power supply. This mapping can be achieved in machine |
24 | initialisation code by calling :- | 15 | initialisation code by creating a struct regulator_consumer_supply for |
16 | each regulator. | ||
17 | |||
18 | struct regulator_consumer_supply { | ||
19 | struct device *dev; /* consumer */ | ||
20 | const char *supply; /* consumer supply - e.g. "vcc" */ | ||
21 | }; | ||
25 | 22 | ||
26 | int regulator_set_device_supply(const char *regulator, struct device *dev, | 23 | e.g. for the machine above |
27 | const char *supply); | ||
28 | 24 | ||
29 | and is shown with the following code :- | 25 | static struct regulator_consumer_supply regulator1_consumers[] = { |
26 | { | ||
27 | .dev = &platform_consumerB_device.dev, | ||
28 | .supply = "Vcc", | ||
29 | },}; | ||
30 | 30 | ||
31 | regulator_set_device_supply("Regulator-1", devB, "Vcc"); | 31 | static struct regulator_consumer_supply regulator2_consumers[] = { |
32 | regulator_set_device_supply("Regulator-2", devA, "Vcc"); | 32 | { |
33 | .dev = &platform_consumerA_device.dev, | ||
34 | .supply = "Vcc", | ||
35 | },}; | ||
33 | 36 | ||
34 | This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2 | 37 | This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2 |
35 | to the 'Vcc' supply for Consumer A. | 38 | to the 'Vcc' supply for Consumer A. |
36 | 39 | ||
37 | 40 | Constraints can now be registered by defining a struct regulator_init_data | |
38 | 2. Regulator supply configuration. | 41 | for each regulator power domain. This structure also maps the consumers |
39 | ================================== | 42 | to their supply regulator :- |
40 | Consider the following machine (again) :- | 43 | |
41 | 44 | static struct regulator_init_data regulator1_data = { | |
42 | Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V] | 45 | .constraints = { |
43 | | | 46 | .min_uV = 3300000, |
44 | +-> [Consumer B @ 3.3V] | 47 | .max_uV = 3300000, |
48 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
49 | }, | ||
50 | .num_consumer_supplies = ARRAY_SIZE(regulator1_consumers), | ||
51 | .consumer_supplies = regulator1_consumers, | ||
52 | }; | ||
45 | 53 | ||
46 | Regulator-1 supplies power to Regulator-2. This relationship must be registered | 54 | Regulator-1 supplies power to Regulator-2. This relationship must be registered |
47 | with the core so that Regulator-1 is also enabled when Consumer A enables it's | 55 | with the core so that Regulator-1 is also enabled when Consumer A enables it's |
48 | supply (Regulator-2). | 56 | supply (Regulator-2). The supply regulator is set by the supply_regulator_dev |
49 | 57 | field below:- | |
50 | This relationship can be register with the core via :- | 58 | |
51 | 59 | static struct regulator_init_data regulator2_data = { | |
52 | int regulator_set_supply(const char *regulator, const char *regulator_supply); | 60 | .supply_regulator_dev = &platform_regulator1_device.dev, |
53 | 61 | .constraints = { | |
54 | In this example we would use the following code :- | 62 | .min_uV = 1800000, |
55 | 63 | .max_uV = 2000000, | |
56 | regulator_set_supply("Regulator-2", "Regulator-1"); | 64 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
57 | 65 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | |
58 | Relationships can be queried by calling :- | 66 | }, |
59 | 67 | .num_consumer_supplies = ARRAY_SIZE(regulator2_consumers), | |
60 | const char *regulator_get_supply(const char *regulator); | 68 | .consumer_supplies = regulator2_consumers, |
61 | |||
62 | |||
63 | 3. Power Domain constraint setting. | ||
64 | =================================== | ||
65 | Each power domain within a system has physical constraints on voltage and | ||
66 | current. This must be defined in software so that the power domain is always | ||
67 | operated within specifications. | ||
68 | |||
69 | Consider the following machine (again) :- | ||
70 | |||
71 | Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V] | ||
72 | | | ||
73 | +-> [Consumer B @ 3.3V] | ||
74 | |||
75 | This gives us two regulators and two power domains: | ||
76 | |||
77 | Domain 1: Regulator-2, Consumer B. | ||
78 | Domain 2: Consumer A. | ||
79 | |||
80 | Constraints can be registered by calling :- | ||
81 | |||
82 | int regulator_set_platform_constraints(const char *regulator, | ||
83 | struct regulation_constraints *constraints); | ||
84 | |||
85 | The example is defined as follows :- | ||
86 | |||
87 | struct regulation_constraints domain_1 = { | ||
88 | .min_uV = 3300000, | ||
89 | .max_uV = 3300000, | ||
90 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
91 | }; | 69 | }; |
92 | 70 | ||
93 | struct regulation_constraints domain_2 = { | 71 | Finally the regulator devices must be registered in the usual manner. |
94 | .min_uV = 1800000, | 72 | |
95 | .max_uV = 2000000, | 73 | static struct platform_device regulator_devices[] = { |
96 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | 74 | { |
97 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | 75 | .name = "regulator", |
76 | .id = DCDC_1, | ||
77 | .dev = { | ||
78 | .platform_data = ®ulator1_data, | ||
79 | }, | ||
80 | }, | ||
81 | { | ||
82 | .name = "regulator", | ||
83 | .id = DCDC_2, | ||
84 | .dev = { | ||
85 | .platform_data = ®ulator2_data, | ||
86 | }, | ||
87 | }, | ||
98 | }; | 88 | }; |
89 | /* register regulator 1 device */ | ||
90 | platform_device_register(&wm8350_regulator_devices[0]); | ||
99 | 91 | ||
100 | regulator_set_platform_constraints("Regulator-1", &domain_1); | 92 | /* register regulator 2 device */ |
101 | regulator_set_platform_constraints("Regulator-2", &domain_2); | 93 | platform_device_register(&wm8350_regulator_devices[1]); |
diff --git a/Documentation/power/regulator/regulator.txt b/Documentation/power/regulator/regulator.txt index a6905014359..4200accb9bb 100644 --- a/Documentation/power/regulator/regulator.txt +++ b/Documentation/power/regulator/regulator.txt | |||
@@ -10,11 +10,11 @@ Registration | |||
10 | 10 | ||
11 | Drivers can register a regulator by calling :- | 11 | Drivers can register a regulator by calling :- |
12 | 12 | ||
13 | struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | 13 | struct regulator_dev *regulator_register(struct device *dev, |
14 | void *reg_data); | 14 | struct regulator_desc *regulator_desc); |
15 | 15 | ||
16 | This will register the regulators capabilities and operations the regulator | 16 | This will register the regulators capabilities and operations to the regulator |
17 | core. The core does not touch reg_data (private to regulator driver). | 17 | core. |
18 | 18 | ||
19 | Regulators can be unregistered by calling :- | 19 | Regulators can be unregistered by calling :- |
20 | 20 | ||
diff --git a/Documentation/power/s2ram.txt b/Documentation/power/s2ram.txt index b05f512130e..2ebdc6091ce 100644 --- a/Documentation/power/s2ram.txt +++ b/Documentation/power/s2ram.txt | |||
@@ -54,3 +54,21 @@ used to run with "radeonfb" (it's an ATI Radeon mobility). It turns out | |||
54 | that "radeonfb" simply cannot resume that device - it tries to set the | 54 | that "radeonfb" simply cannot resume that device - it tries to set the |
55 | PLL's, and it just _hangs_. Using the regular VGA console and letting X | 55 | PLL's, and it just _hangs_. Using the regular VGA console and letting X |
56 | resume it instead works fine. | 56 | resume it instead works fine. |
57 | |||
58 | NOTE | ||
59 | ==== | ||
60 | pm_trace uses the system's Real Time Clock (RTC) to save the magic number. | ||
61 | Reason for this is that the RTC is the only reliably available piece of | ||
62 | hardware during resume operations where a value can be set that will | ||
63 | survive a reboot. | ||
64 | |||
65 | Consequence is that after a resume (even if it is successful) your system | ||
66 | clock will have a value corresponding to the magic mumber instead of the | ||
67 | correct date/time! It is therefore advisable to use a program like ntp-date | ||
68 | or rdate to reset the correct date/time from an external time source when | ||
69 | using this trace option. | ||
70 | |||
71 | As the clock keeps ticking it is also essential that the reboot is done | ||
72 | quickly after the resume failure. The trace option does not use the seconds | ||
73 | or the low order bits of the minutes of the RTC, but a too long delay will | ||
74 | corrupt the magic value. | ||
diff --git a/Documentation/powerpc/00-INDEX b/Documentation/powerpc/00-INDEX index 29d839ce732..e3960b8c868 100644 --- a/Documentation/powerpc/00-INDEX +++ b/Documentation/powerpc/00-INDEX | |||
@@ -18,10 +18,6 @@ mpc52xx.txt | |||
18 | - Linux 2.6.x on MPC52xx family | 18 | - Linux 2.6.x on MPC52xx family |
19 | mpc52xx-device-tree-bindings.txt | 19 | mpc52xx-device-tree-bindings.txt |
20 | - MPC5200 Device Tree Bindings | 20 | - MPC5200 Device Tree Bindings |
21 | ppc_htab.txt | ||
22 | - info about the Linux/PPC /proc/ppc_htab entry | ||
23 | smp.txt | ||
24 | - use and state info about Linux/PPC on MP machines | ||
25 | sound.txt | 21 | sound.txt |
26 | - info on sound support under Linux/PPC | 22 | - info on sound support under Linux/PPC |
27 | zImage_layout.txt | 23 | zImage_layout.txt |
diff --git a/Documentation/powerpc/dts-bindings/fsl/83xx-512x-pci.txt b/Documentation/powerpc/dts-bindings/fsl/83xx-512x-pci.txt new file mode 100644 index 00000000000..35a46536240 --- /dev/null +++ b/Documentation/powerpc/dts-bindings/fsl/83xx-512x-pci.txt | |||
@@ -0,0 +1,40 @@ | |||
1 | * Freescale 83xx and 512x PCI bridges | ||
2 | |||
3 | Freescale 83xx and 512x SOCs include the same pci bridge core. | ||
4 | |||
5 | 83xx/512x specific notes: | ||
6 | - reg: should contain two address length tuples | ||
7 | The first is for the internal pci bridge registers | ||
8 | The second is for the pci config space access registers | ||
9 | |||
10 | Example (MPC8313ERDB) | ||
11 | pci0: pci@e0008500 { | ||
12 | cell-index = <1>; | ||
13 | interrupt-map-mask = <0xf800 0x0 0x0 0x7>; | ||
14 | interrupt-map = < | ||
15 | /* IDSEL 0x0E -mini PCI */ | ||
16 | 0x7000 0x0 0x0 0x1 &ipic 18 0x8 | ||
17 | 0x7000 0x0 0x0 0x2 &ipic 18 0x8 | ||
18 | 0x7000 0x0 0x0 0x3 &ipic 18 0x8 | ||
19 | 0x7000 0x0 0x0 0x4 &ipic 18 0x8 | ||
20 | |||
21 | /* IDSEL 0x0F - PCI slot */ | ||
22 | 0x7800 0x0 0x0 0x1 &ipic 17 0x8 | ||
23 | 0x7800 0x0 0x0 0x2 &ipic 18 0x8 | ||
24 | 0x7800 0x0 0x0 0x3 &ipic 17 0x8 | ||
25 | 0x7800 0x0 0x0 0x4 &ipic 18 0x8>; | ||
26 | interrupt-parent = <&ipic>; | ||
27 | interrupts = <66 0x8>; | ||
28 | bus-range = <0x0 0x0>; | ||
29 | ranges = <0x02000000 0x0 0x90000000 0x90000000 0x0 0x10000000 | ||
30 | 0x42000000 0x0 0x80000000 0x80000000 0x0 0x10000000 | ||
31 | 0x01000000 0x0 0x00000000 0xe2000000 0x0 0x00100000>; | ||
32 | clock-frequency = <66666666>; | ||
33 | #interrupt-cells = <1>; | ||
34 | #size-cells = <2>; | ||
35 | #address-cells = <3>; | ||
36 | reg = <0xe0008500 0x100 /* internal registers */ | ||
37 | 0xe0008300 0x8>; /* config space access registers */ | ||
38 | compatible = "fsl,mpc8349-pci"; | ||
39 | device_type = "pci"; | ||
40 | }; | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt b/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt new file mode 100644 index 00000000000..d015dcec401 --- /dev/null +++ b/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt | |||
@@ -0,0 +1,40 @@ | |||
1 | GPIO controllers on MPC8xxx SoCs | ||
2 | |||
3 | This is for the non-QE/CPM/GUTs GPIO controllers as found on | ||
4 | 8349, 8572, 8610 and compatible. | ||
5 | |||
6 | Every GPIO controller node must have #gpio-cells property defined, | ||
7 | this information will be used to translate gpio-specifiers. | ||
8 | |||
9 | Required properties: | ||
10 | - compatible : "fsl,<CHIP>-gpio" followed by "fsl,mpc8349-gpio" for | ||
11 | 83xx, "fsl,mpc8572-gpio" for 85xx and "fsl,mpc8610-gpio" for 86xx. | ||
12 | - #gpio-cells : Should be two. The first cell is the pin number and the | ||
13 | second cell is used to specify optional parameters (currently unused). | ||
14 | - interrupts : Interrupt mapping for GPIO IRQ (currently unused). | ||
15 | - interrupt-parent : Phandle for the interrupt controller that | ||
16 | services interrupts for this device. | ||
17 | - gpio-controller : Marks the port as GPIO controller. | ||
18 | |||
19 | Example of gpio-controller nodes for a MPC8347 SoC: | ||
20 | |||
21 | gpio1: gpio-controller@c00 { | ||
22 | #gpio-cells = <2>; | ||
23 | compatible = "fsl,mpc8347-gpio", "fsl,mpc8349-gpio"; | ||
24 | reg = <0xc00 0x100>; | ||
25 | interrupts = <74 0x8>; | ||
26 | interrupt-parent = <&ipic>; | ||
27 | gpio-controller; | ||
28 | }; | ||
29 | |||
30 | gpio2: gpio-controller@d00 { | ||
31 | #gpio-cells = <2>; | ||
32 | compatible = "fsl,mpc8347-gpio", "fsl,mpc8349-gpio"; | ||
33 | reg = <0xd00 0x100>; | ||
34 | interrupts = <75 0x8>; | ||
35 | interrupt-parent = <&ipic>; | ||
36 | gpio-controller; | ||
37 | }; | ||
38 | |||
39 | See booting-without-of.txt for details of how to specify GPIO | ||
40 | information for devices. | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/dma.txt b/Documentation/powerpc/dts-bindings/fsl/dma.txt index 86826df00e6..cc453110fc4 100644 --- a/Documentation/powerpc/dts-bindings/fsl/dma.txt +++ b/Documentation/powerpc/dts-bindings/fsl/dma.txt | |||
@@ -20,7 +20,7 @@ Required properties: | |||
20 | - compatible : compatible list, contains 2 entries, first is | 20 | - compatible : compatible list, contains 2 entries, first is |
21 | "fsl,CHIP-dma-channel", where CHIP is the processor | 21 | "fsl,CHIP-dma-channel", where CHIP is the processor |
22 | (mpc8349, mpc8350, etc.) and the second is | 22 | (mpc8349, mpc8350, etc.) and the second is |
23 | "fsl,elo-dma-channel" | 23 | "fsl,elo-dma-channel". However, see note below. |
24 | - reg : <registers mapping for channel> | 24 | - reg : <registers mapping for channel> |
25 | - cell-index : dma channel index starts at 0. | 25 | - cell-index : dma channel index starts at 0. |
26 | 26 | ||
@@ -82,7 +82,7 @@ Required properties: | |||
82 | - compatible : compatible list, contains 2 entries, first is | 82 | - compatible : compatible list, contains 2 entries, first is |
83 | "fsl,CHIP-dma-channel", where CHIP is the processor | 83 | "fsl,CHIP-dma-channel", where CHIP is the processor |
84 | (mpc8540, mpc8560, etc.) and the second is | 84 | (mpc8540, mpc8560, etc.) and the second is |
85 | "fsl,eloplus-dma-channel" | 85 | "fsl,eloplus-dma-channel". However, see note below. |
86 | - cell-index : dma channel index starts at 0. | 86 | - cell-index : dma channel index starts at 0. |
87 | - reg : <registers mapping for channel> | 87 | - reg : <registers mapping for channel> |
88 | - interrupts : <interrupt mapping for DMA channel IRQ> | 88 | - interrupts : <interrupt mapping for DMA channel IRQ> |
@@ -125,3 +125,12 @@ Example: | |||
125 | interrupts = <17 2>; | 125 | interrupts = <17 2>; |
126 | }; | 126 | }; |
127 | }; | 127 | }; |
128 | |||
129 | Note on DMA channel compatible properties: The compatible property must say | ||
130 | "fsl,elo-dma-channel" or "fsl,eloplus-dma-channel" to be used by the Elo DMA | ||
131 | driver (fsldma). Any DMA channel used by fsldma cannot be used by another | ||
132 | DMA driver, such as the SSI sound drivers for the MPC8610. Therefore, any DMA | ||
133 | channel that should be used for another driver should not use | ||
134 | "fsl,elo-dma-channel" or "fsl,eloplus-dma-channel". For the SSI drivers, for | ||
135 | example, the compatible property should be "fsl,ssi-dma-channel". See ssi.txt | ||
136 | for more information. | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/ssi.txt b/Documentation/powerpc/dts-bindings/fsl/ssi.txt index d100555d488..a2d963998a6 100644 --- a/Documentation/powerpc/dts-bindings/fsl/ssi.txt +++ b/Documentation/powerpc/dts-bindings/fsl/ssi.txt | |||
@@ -24,6 +24,12 @@ Required properties: | |||
24 | "rj-master" - r.j., SSI is clock master | 24 | "rj-master" - r.j., SSI is clock master |
25 | "ac97-slave" - AC97 mode, SSI is clock slave | 25 | "ac97-slave" - AC97 mode, SSI is clock slave |
26 | "ac97-master" - AC97 mode, SSI is clock master | 26 | "ac97-master" - AC97 mode, SSI is clock master |
27 | - fsl,playback-dma: phandle to a node for the DMA channel to use for | ||
28 | playback of audio. This is typically dictated by SOC | ||
29 | design. See the notes below. | ||
30 | - fsl,capture-dma: phandle to a node for the DMA channel to use for | ||
31 | capture (recording) of audio. This is typically dictated | ||
32 | by SOC design. See the notes below. | ||
27 | 33 | ||
28 | Optional properties: | 34 | Optional properties: |
29 | - codec-handle : phandle to a 'codec' node that defines an audio | 35 | - codec-handle : phandle to a 'codec' node that defines an audio |
@@ -36,3 +42,20 @@ Child 'codec' node required properties: | |||
36 | Child 'codec' node optional properties: | 42 | Child 'codec' node optional properties: |
37 | - clock-frequency : The frequency of the input clock, which typically | 43 | - clock-frequency : The frequency of the input clock, which typically |
38 | comes from an on-board dedicated oscillator. | 44 | comes from an on-board dedicated oscillator. |
45 | |||
46 | Notes on fsl,playback-dma and fsl,capture-dma: | ||
47 | |||
48 | On SOCs that have an SSI, specific DMA channels are hard-wired for playback | ||
49 | and capture. On the MPC8610, for example, SSI1 must use DMA channel 0 for | ||
50 | playback and DMA channel 1 for capture. SSI2 must use DMA channel 2 for | ||
51 | playback and DMA channel 3 for capture. The developer can choose which | ||
52 | DMA controller to use, but the channels themselves are hard-wired. The | ||
53 | purpose of these two properties is to represent this hardware design. | ||
54 | |||
55 | The device tree nodes for the DMA channels that are referenced by | ||
56 | "fsl,playback-dma" and "fsl,capture-dma" must be marked as compatible with | ||
57 | "fsl,ssi-dma-channel". The SOC-specific compatible string (e.g. | ||
58 | "fsl,mpc8610-dma-channel") can remain. If these nodes are left as | ||
59 | "fsl,elo-dma-channel" or "fsl,eloplus-dma-channel", then the generic Elo DMA | ||
60 | drivers (fsldma) will attempt to use them, and it will conflict with the | ||
61 | sound drivers. | ||
diff --git a/Documentation/powerpc/ppc_htab.txt b/Documentation/powerpc/ppc_htab.txt deleted file mode 100644 index 8b8c7df29fa..00000000000 --- a/Documentation/powerpc/ppc_htab.txt +++ /dev/null | |||
@@ -1,118 +0,0 @@ | |||
1 | Information about /proc/ppc_htab | ||
2 | ===================================================================== | ||
3 | |||
4 | This document and the related code was written by me (Cort Dougan), please | ||
5 | email me (cort@fsmlabs.com) if you have questions, comments or corrections. | ||
6 | |||
7 | Last Change: 2.16.98 | ||
8 | |||
9 | This entry in the proc directory is readable by all users but only | ||
10 | writable by root. | ||
11 | |||
12 | The ppc_htab interface is a user level way of accessing the | ||
13 | performance monitoring registers as well as providing information | ||
14 | about the PTE hash table. | ||
15 | |||
16 | 1. Reading | ||
17 | |||
18 | Reading this file will give you information about the memory management | ||
19 | hash table that serves as an extended tlb for page translation on the | ||
20 | powerpc. It will also give you information about performance measurement | ||
21 | specific to the cpu that you are using. | ||
22 | |||
23 | Explanation of the 604 Performance Monitoring Fields: | ||
24 | MMCR0 - the current value of the MMCR0 register | ||
25 | PMC1 | ||
26 | PMC2 - the value of the performance counters and a | ||
27 | description of what events they are counting | ||
28 | which are based on MMCR0 bit settings. | ||
29 | Explanation of the PTE Hash Table fields: | ||
30 | |||
31 | Size - hash table size in Kb. | ||
32 | Buckets - number of buckets in the table. | ||
33 | Address - the virtual kernel address of the hash table base. | ||
34 | Entries - the number of ptes that can be stored in the hash table. | ||
35 | User/Kernel - how many pte's are in use by the kernel or user at that time. | ||
36 | Overflows - How many of the entries are in their secondary hash location. | ||
37 | Percent full - ratio of free pte entries to in use entries. | ||
38 | Reloads - Count of how many hash table misses have occurred | ||
39 | that were fixed with a reload from the linux tables. | ||
40 | Should always be 0 on 603 based machines. | ||
41 | Non-error Misses - Count of how many hash table misses have occurred | ||
42 | that were completed with the creation of a pte in the linux | ||
43 | tables with a call to do_page_fault(). | ||
44 | Error Misses - Number of misses due to errors such as bad address | ||
45 | and permission violations. This includes kernel access of | ||
46 | bad user addresses that are fixed up by the trap handler. | ||
47 | |||
48 | Note that calculation of the data displayed from /proc/ppc_htab takes | ||
49 | a long time and spends a great deal of time in the kernel. It would | ||
50 | be quite hard on performance to read this file constantly. In time | ||
51 | there may be a counter in the kernel that allows successive reads from | ||
52 | this file only after a given amount of time has passed to reduce the | ||
53 | possibility of a user slowing the system by reading this file. | ||
54 | |||
55 | 2. Writing | ||
56 | |||
57 | Writing to the ppc_htab allows you to change the characteristics of | ||
58 | the powerpc PTE hash table and setup performance monitoring. | ||
59 | |||
60 | Resizing the PTE hash table is not enabled right now due to many | ||
61 | complications with moving the hash table, rehashing the entries | ||
62 | and many many SMP issues that would have to be dealt with. | ||
63 | |||
64 | Write options to ppc_htab: | ||
65 | |||
66 | - To set the size of the hash table to 64Kb: | ||
67 | |||
68 | echo 'size 64' > /proc/ppc_htab | ||
69 | |||
70 | The size must be a multiple of 64 and must be greater than or equal to | ||
71 | 64. | ||
72 | |||
73 | - To turn off performance monitoring: | ||
74 | |||
75 | echo 'off' > /proc/ppc_htab | ||
76 | |||
77 | - To reset the counters without changing what they're counting: | ||
78 | |||
79 | echo 'reset' > /proc/ppc_htab | ||
80 | |||
81 | Note that counting will continue after the reset if it is enabled. | ||
82 | |||
83 | - To count only events in user mode or only in kernel mode: | ||
84 | |||
85 | echo 'user' > /proc/ppc_htab | ||
86 | ...or... | ||
87 | echo 'kernel' > /proc/ppc_htab | ||
88 | |||
89 | Note that these two options are exclusive of one another and the | ||
90 | lack of either of these options counts user and kernel. | ||
91 | Using 'reset' and 'off' reset these flags. | ||
92 | |||
93 | - The 604 has 2 performance counters which can each count events from | ||
94 | a specific set of events. These sets are disjoint so it is not | ||
95 | possible to count _any_ combination of 2 events. One event can | ||
96 | be counted by PMC1 and one by PMC2. | ||
97 | |||
98 | To start counting a particular event use: | ||
99 | |||
100 | echo 'event' > /proc/ppc_htab | ||
101 | |||
102 | and choose from these events: | ||
103 | |||
104 | PMC1 | ||
105 | ---- | ||
106 | 'ic miss' - instruction cache misses | ||
107 | 'dtlb' - data tlb misses (not hash table misses) | ||
108 | |||
109 | PMC2 | ||
110 | ---- | ||
111 | 'dc miss' - data cache misses | ||
112 | 'itlb' - instruction tlb misses (not hash table misses) | ||
113 | 'load miss time' - cycles to complete a load miss | ||
114 | |||
115 | 3. Bugs | ||
116 | |||
117 | The PMC1 and PMC2 counters can overflow and give no indication of that | ||
118 | in /proc/ppc_htab. | ||
diff --git a/Documentation/powerpc/smp.txt b/Documentation/powerpc/smp.txt deleted file mode 100644 index 5b581b849ff..00000000000 --- a/Documentation/powerpc/smp.txt +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | Information about Linux/PPC SMP mode | ||
2 | ===================================================================== | ||
3 | |||
4 | This document and the related code was written by me | ||
5 | (Cort Dougan, cort@fsmlabs.com) please email me if you have questions, | ||
6 | comments or corrections. | ||
7 | |||
8 | Last Change: 3.31.99 | ||
9 | |||
10 | If you want to help by writing code or testing different hardware please | ||
11 | email me! | ||
12 | |||
13 | 1. State of Supported Hardware | ||
14 | |||
15 | PowerSurge Architecture - tested on UMAX s900, Apple 9600 | ||
16 | The second processor on this machine boots up just fine and | ||
17 | enters its idle loop. Hopefully a completely working SMP kernel | ||
18 | on this machine will be done shortly. | ||
19 | |||
20 | The code makes the assumption of only two processors. The changes | ||
21 | necessary to work with any number would not be overly difficult but | ||
22 | I don't have any machines with >2 processors so it's not high on my | ||
23 | list of priorities. If anyone else would like do to the work email | ||
24 | me and I can point out the places that need changed. If you have >2 | ||
25 | processors and don't want to add support yourself let me know and I | ||
26 | can take a look into it. | ||
27 | |||
28 | BeBox | ||
29 | BeBox support hasn't been added to the 2.1.X kernels from 2.0.X | ||
30 | but work is being done and SMP support for BeBox is in the works. | ||
31 | |||
32 | CHRP | ||
33 | CHRP SMP works and is fairly solid. It's been tested on the IBM F50 | ||
34 | with 4 processors for quite some time now. | ||
diff --git a/Documentation/scsi/ChangeLog.megaraid b/Documentation/scsi/ChangeLog.megaraid index 37796fe45bd..eaa4801f2ce 100644 --- a/Documentation/scsi/ChangeLog.megaraid +++ b/Documentation/scsi/ChangeLog.megaraid | |||
@@ -409,7 +409,7 @@ i. Function reordering so that inline functions are defined before they | |||
409 | megaraid_mbox_prepare_pthru, megaraid_mbox_prepare_epthru, | 409 | megaraid_mbox_prepare_pthru, megaraid_mbox_prepare_epthru, |
410 | megaraid_busywait_mbox | 410 | megaraid_busywait_mbox |
411 | 411 | ||
412 | - Andrew Morton <akpm@osdl.org>, 08.19.2004 | 412 | - Andrew Morton, 08.19.2004 |
413 | linux-scsi mailing list | 413 | linux-scsi mailing list |
414 | 414 | ||
415 | "Something else to clean up after inclusion: every instance of an | 415 | "Something else to clean up after inclusion: every instance of an |
@@ -471,13 +471,13 @@ vi. Add support for 64-bit applications. Current drivers assume only | |||
471 | vii. Move the function declarations for the management module from | 471 | vii. Move the function declarations for the management module from |
472 | megaraid_mm.h to megaraid_mm.c | 472 | megaraid_mm.h to megaraid_mm.c |
473 | 473 | ||
474 | - Andrew Morton <akpm@osdl.org>, 08.19.2004 | 474 | - Andrew Morton, 08.19.2004 |
475 | linux-scsi mailing list | 475 | linux-scsi mailing list |
476 | 476 | ||
477 | viii. Change default values for MEGARAID_NEWGEN, MEGARAID_MM, and | 477 | viii. Change default values for MEGARAID_NEWGEN, MEGARAID_MM, and |
478 | MEGARAID_MAILBOX to 'n' in Kconfig.megaraid | 478 | MEGARAID_MAILBOX to 'n' in Kconfig.megaraid |
479 | 479 | ||
480 | - Andrew Morton <akpm@osdl.org>, 08.19.2004 | 480 | - Andrew Morton, 08.19.2004 |
481 | linux-scsi mailing list | 481 | linux-scsi mailing list |
482 | 482 | ||
483 | ix. replace udelay with msleep | 483 | ix. replace udelay with msleep |
diff --git a/Documentation/spi/pxa2xx b/Documentation/spi/pxa2xx index bbe8dee681a..6bb916d57c9 100644 --- a/Documentation/spi/pxa2xx +++ b/Documentation/spi/pxa2xx | |||
@@ -96,7 +96,7 @@ Each slave device attached to the PXA must provide slave specific configuration | |||
96 | information via the structure "pxa2xx_spi_chip" found in | 96 | information via the structure "pxa2xx_spi_chip" found in |
97 | "arch/arm/mach-pxa/include/mach/pxa2xx_spi.h". The pxa2xx_spi master controller driver | 97 | "arch/arm/mach-pxa/include/mach/pxa2xx_spi.h". The pxa2xx_spi master controller driver |
98 | will uses the configuration whenever the driver communicates with the slave | 98 | will uses the configuration whenever the driver communicates with the slave |
99 | device. | 99 | device. All fields are optional. |
100 | 100 | ||
101 | struct pxa2xx_spi_chip { | 101 | struct pxa2xx_spi_chip { |
102 | u8 tx_threshold; | 102 | u8 tx_threshold; |
@@ -112,14 +112,17 @@ used to configure the SSP hardware fifo. These fields are critical to the | |||
112 | performance of pxa2xx_spi driver and misconfiguration will result in rx | 112 | performance of pxa2xx_spi driver and misconfiguration will result in rx |
113 | fifo overruns (especially in PIO mode transfers). Good default values are | 113 | fifo overruns (especially in PIO mode transfers). Good default values are |
114 | 114 | ||
115 | .tx_threshold = 12, | 115 | .tx_threshold = 8, |
116 | .rx_threshold = 4, | 116 | .rx_threshold = 8, |
117 | |||
118 | The range is 1 to 16 where zero indicates "use default". | ||
117 | 119 | ||
118 | The "pxa2xx_spi_chip.dma_burst_size" field is used to configure PXA2xx DMA | 120 | The "pxa2xx_spi_chip.dma_burst_size" field is used to configure PXA2xx DMA |
119 | engine and is related the "spi_device.bits_per_word" field. Read and understand | 121 | engine and is related the "spi_device.bits_per_word" field. Read and understand |
120 | the PXA2xx "Developer Manual" sections on the DMA controller and SSP Controllers | 122 | the PXA2xx "Developer Manual" sections on the DMA controller and SSP Controllers |
121 | to determine the correct value. An SSP configured for byte-wide transfers would | 123 | to determine the correct value. An SSP configured for byte-wide transfers would |
122 | use a value of 8. | 124 | use a value of 8. The driver will determine a reasonable default if |
125 | dma_burst_size == 0. | ||
123 | 126 | ||
124 | The "pxa2xx_spi_chip.timeout" fields is used to efficiently handle | 127 | The "pxa2xx_spi_chip.timeout" fields is used to efficiently handle |
125 | trailing bytes in the SSP receiver fifo. The correct value for this field is | 128 | trailing bytes in the SSP receiver fifo. The correct value for this field is |
@@ -137,7 +140,13 @@ function for asserting/deasserting a slave device chip select. If the field is | |||
137 | NULL, the pxa2xx_spi master controller driver assumes that the SSP port is | 140 | NULL, the pxa2xx_spi master controller driver assumes that the SSP port is |
138 | configured to use SSPFRM instead. | 141 | configured to use SSPFRM instead. |
139 | 142 | ||
140 | NSSP SALVE SAMPLE | 143 | NOTE: the SPI driver cannot control the chip select if SSPFRM is used, so the |
144 | chipselect is dropped after each spi_transfer. Most devices need chip select | ||
145 | asserted around the complete message. Use SSPFRM as a GPIO (through cs_control) | ||
146 | to accomodate these chips. | ||
147 | |||
148 | |||
149 | NSSP SLAVE SAMPLE | ||
141 | ----------------- | 150 | ----------------- |
142 | The pxa2xx_spi_chip structure is passed to the pxa2xx_spi driver in the | 151 | The pxa2xx_spi_chip structure is passed to the pxa2xx_spi driver in the |
143 | "spi_board_info.controller_data" field. Below is a sample configuration using | 152 | "spi_board_info.controller_data" field. Below is a sample configuration using |
@@ -206,18 +215,21 @@ static void __init streetracer_init(void) | |||
206 | 215 | ||
207 | DMA and PIO I/O Support | 216 | DMA and PIO I/O Support |
208 | ----------------------- | 217 | ----------------------- |
209 | The pxa2xx_spi driver support both DMA and interrupt driven PIO message | 218 | The pxa2xx_spi driver supports both DMA and interrupt driven PIO message |
210 | transfers. The driver defaults to PIO mode and DMA transfers must enabled by | 219 | transfers. The driver defaults to PIO mode and DMA transfers must be enabled |
211 | setting the "enable_dma" flag in the "pxa2xx_spi_master" structure and | 220 | by setting the "enable_dma" flag in the "pxa2xx_spi_master" structure. The DMA |
212 | ensuring that the "pxa2xx_spi_chip.dma_burst_size" field is non-zero. The DMA | 221 | mode supports both coherent and stream based DMA mappings. |
213 | mode support both coherent and stream based DMA mappings. | ||
214 | 222 | ||
215 | The following logic is used to determine the type of I/O to be used on | 223 | The following logic is used to determine the type of I/O to be used on |
216 | a per "spi_transfer" basis: | 224 | a per "spi_transfer" basis: |
217 | 225 | ||
218 | if !enable_dma or dma_burst_size == 0 then | 226 | if !enable_dma then |
219 | always use PIO transfers | 227 | always use PIO transfers |
220 | 228 | ||
229 | if spi_message.len > 8191 then | ||
230 | print "rate limited" warning | ||
231 | use PIO transfers | ||
232 | |||
221 | if spi_message.is_dma_mapped and rx_dma_buf != 0 and tx_dma_buf != 0 then | 233 | if spi_message.is_dma_mapped and rx_dma_buf != 0 and tx_dma_buf != 0 then |
222 | use coherent DMA mode | 234 | use coherent DMA mode |
223 | 235 | ||
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt index e1ff0d920a5..bde799e0659 100644 --- a/Documentation/sysctl/kernel.txt +++ b/Documentation/sysctl/kernel.txt | |||
@@ -369,4 +369,5 @@ can be ORed together: | |||
369 | 2 - A module was force loaded by insmod -f. | 369 | 2 - A module was force loaded by insmod -f. |
370 | Set by modutils >= 2.4.9 and module-init-tools. | 370 | Set by modutils >= 2.4.9 and module-init-tools. |
371 | 4 - Unsafe SMP processors: SMP with CPUs not designed for SMP. | 371 | 4 - Unsafe SMP processors: SMP with CPUs not designed for SMP. |
372 | 64 - A module from drivers/staging was loaded. | ||
372 | 373 | ||
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt index 5ce0952aa06..10a0263ebb3 100644 --- a/Documentation/sysrq.txt +++ b/Documentation/sysrq.txt | |||
@@ -95,7 +95,9 @@ On all - write a character to /proc/sysrq-trigger. e.g.: | |||
95 | 95 | ||
96 | 'p' - Will dump the current registers and flags to your console. | 96 | 'p' - Will dump the current registers and flags to your console. |
97 | 97 | ||
98 | 'q' - Will dump a list of all running timers. | 98 | 'q' - Will dump per CPU lists of all armed hrtimers (but NOT regular |
99 | timer_list timers) and detailed information about all | ||
100 | clockevent devices. | ||
99 | 101 | ||
100 | 'r' - Turns off keyboard raw mode and sets it to XLATE. | 102 | 'r' - Turns off keyboard raw mode and sets it to XLATE. |
101 | 103 | ||
diff --git a/Documentation/usb/anchors.txt b/Documentation/usb/anchors.txt index 5e6b64c20d2..6f24f566955 100644 --- a/Documentation/usb/anchors.txt +++ b/Documentation/usb/anchors.txt | |||
@@ -52,6 +52,11 @@ Therefore no guarantee is made that the URBs have been unlinked when | |||
52 | the call returns. They may be unlinked later but will be unlinked in | 52 | the call returns. They may be unlinked later but will be unlinked in |
53 | finite time. | 53 | finite time. |
54 | 54 | ||
55 | usb_scuttle_anchored_urbs() | ||
56 | --------------------------- | ||
57 | |||
58 | All URBs of an anchor are unanchored en masse. | ||
59 | |||
55 | usb_wait_anchor_empty_timeout() | 60 | usb_wait_anchor_empty_timeout() |
56 | ------------------------------- | 61 | ------------------------------- |
57 | 62 | ||
@@ -59,4 +64,16 @@ This function waits for all URBs associated with an anchor to finish | |||
59 | or a timeout, whichever comes first. Its return value will tell you | 64 | or a timeout, whichever comes first. Its return value will tell you |
60 | whether the timeout was reached. | 65 | whether the timeout was reached. |
61 | 66 | ||
67 | usb_anchor_empty() | ||
68 | ------------------ | ||
69 | |||
70 | Returns true if no URBs are associated with an anchor. Locking | ||
71 | is the caller's responsibility. | ||
72 | |||
73 | usb_get_from_anchor() | ||
74 | --------------------- | ||
62 | 75 | ||
76 | Returns the oldest anchored URB of an anchor. The URB is unanchored | ||
77 | and returned with a reference. As you may mix URBs to several | ||
78 | destinations in one anchor you have no guarantee the chronologically | ||
79 | first submitted URB is returned. \ No newline at end of file | ||
diff --git a/Documentation/usb/misc_usbsevseg.txt b/Documentation/usb/misc_usbsevseg.txt new file mode 100644 index 00000000000..0f6be4f9930 --- /dev/null +++ b/Documentation/usb/misc_usbsevseg.txt | |||
@@ -0,0 +1,46 @@ | |||
1 | USB 7-Segment Numeric Display | ||
2 | Manufactured by Delcom Engineering | ||
3 | |||
4 | Device Information | ||
5 | ------------------ | ||
6 | USB VENDOR_ID 0x0fc5 | ||
7 | USB PRODUCT_ID 0x1227 | ||
8 | Both the 6 character and 8 character displays have PRODUCT_ID, | ||
9 | and according to Delcom Engineering no queryable information | ||
10 | can be obtained from the device to tell them apart. | ||
11 | |||
12 | Device Modes | ||
13 | ------------ | ||
14 | By default, the driver assumes the display is only 6 characters | ||
15 | The mode for 6 characters is: | ||
16 | MSB 0x06; LSB 0x3f | ||
17 | For the 8 character display: | ||
18 | MSB 0x08; LSB 0xff | ||
19 | The device can accept "text" either in raw, hex, or ascii textmode. | ||
20 | raw controls each segment manually, | ||
21 | hex expects a value between 0-15 per character, | ||
22 | ascii expects a value between '0'-'9' and 'A'-'F'. | ||
23 | The default is ascii. | ||
24 | |||
25 | Device Operation | ||
26 | ---------------- | ||
27 | 1. Turn on the device: | ||
28 | echo 1 > /sys/bus/usb/.../powered | ||
29 | 2. Set the device's mode: | ||
30 | echo $mode_msb > /sys/bus/usb/.../mode_msb | ||
31 | echo $mode_lsb > /sys/bus/usb/.../mode_lsb | ||
32 | 3. Set the textmode: | ||
33 | echo $textmode > /sys/bus/usb/.../textmode | ||
34 | 4. set the text (for example): | ||
35 | echo "123ABC" > /sys/bus/usb/.../text (ascii) | ||
36 | echo "A1B2" > /sys/bus/usb/.../text (ascii) | ||
37 | echo -ne "\x01\x02\x03" > /sys/bus/usb/.../text (hex) | ||
38 | 5. Set the decimal places. | ||
39 | The device has either 6 or 8 decimal points. | ||
40 | to set the nth decimal place calculate 10 ** n | ||
41 | and echo it in to /sys/bus/usb/.../decimals | ||
42 | To set multiple decimals points sum up each power. | ||
43 | For example, to set the 0th and 3rd decimal place | ||
44 | echo 1001 > /sys/bus/usb/.../decimals | ||
45 | |||
46 | |||
diff --git a/Documentation/usb/power-management.txt b/Documentation/usb/power-management.txt index 9d31140e3f5..e48ea1d5101 100644 --- a/Documentation/usb/power-management.txt +++ b/Documentation/usb/power-management.txt | |||
@@ -350,12 +350,12 @@ without holding the mutex. | |||
350 | 350 | ||
351 | There also are a couple of utility routines drivers can use: | 351 | There also are a couple of utility routines drivers can use: |
352 | 352 | ||
353 | usb_autopm_enable() sets pm_usage_cnt to 1 and then calls | 353 | usb_autopm_enable() sets pm_usage_cnt to 0 and then calls |
354 | usb_autopm_set_interface(), which will attempt an autoresume. | ||
355 | |||
356 | usb_autopm_disable() sets pm_usage_cnt to 0 and then calls | ||
357 | usb_autopm_set_interface(), which will attempt an autosuspend. | 354 | usb_autopm_set_interface(), which will attempt an autosuspend. |
358 | 355 | ||
356 | usb_autopm_disable() sets pm_usage_cnt to 1 and then calls | ||
357 | usb_autopm_set_interface(), which will attempt an autoresume. | ||
358 | |||
359 | The conventional usage pattern is that a driver calls | 359 | The conventional usage pattern is that a driver calls |
360 | usb_autopm_get_interface() in its open routine and | 360 | usb_autopm_get_interface() in its open routine and |
361 | usb_autopm_put_interface() in its close or release routine. But | 361 | usb_autopm_put_interface() in its close or release routine. But |
diff --git a/Documentation/video4linux/CARDLIST.au0828 b/Documentation/video4linux/CARDLIST.au0828 index aa05e5bb22f..d5cb4ea287b 100644 --- a/Documentation/video4linux/CARDLIST.au0828 +++ b/Documentation/video4linux/CARDLIST.au0828 | |||
@@ -1,5 +1,5 @@ | |||
1 | 0 -> Unknown board (au0828) | 1 | 0 -> Unknown board (au0828) |
2 | 1 -> Hauppauge HVR950Q (au0828) [2040:7200,2040:7210,2040:7217,2040:721b,2040:721f,2040:7280,0fd9:0008] | 2 | 1 -> Hauppauge HVR950Q (au0828) [2040:7200,2040:7210,2040:7217,2040:721b,2040:721e,2040:721f,2040:7280,0fd9:0008] |
3 | 2 -> Hauppauge HVR850 (au0828) [2040:7240] | 3 | 2 -> Hauppauge HVR850 (au0828) [2040:7240] |
4 | 3 -> DViCO FusionHDTV USB (au0828) [0fe9:d620] | 4 | 3 -> DViCO FusionHDTV USB (au0828) [0fe9:d620] |
5 | 4 -> Hauppauge HVR950Q rev xxF8 (au0828) [2040:7201,2040:7211,2040:7281] | 5 | 4 -> Hauppauge HVR950Q rev xxF8 (au0828) [2040:7201,2040:7211,2040:7281] |
diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv index f32efb6fb12..60ba6683603 100644 --- a/Documentation/video4linux/CARDLIST.bttv +++ b/Documentation/video4linux/CARDLIST.bttv | |||
@@ -150,3 +150,4 @@ | |||
150 | 149 -> Typhoon TV-Tuner PCI (50684) | 150 | 149 -> Typhoon TV-Tuner PCI (50684) |
151 | 150 -> Geovision GV-600 [008a:763c] | 151 | 150 -> Geovision GV-600 [008a:763c] |
152 | 151 -> Kozumi KTV-01C | 152 | 151 -> Kozumi KTV-01C |
153 | 152 -> Encore ENL TV-FM-2 [1000:1801] | ||
diff --git a/Documentation/video4linux/CARDLIST.cx23885 b/Documentation/video4linux/CARDLIST.cx23885 index f0e613ba55b..64823ccacd6 100644 --- a/Documentation/video4linux/CARDLIST.cx23885 +++ b/Documentation/video4linux/CARDLIST.cx23885 | |||
@@ -9,3 +9,5 @@ | |||
9 | 8 -> Hauppauge WinTV-HVR1700 [0070:8101] | 9 | 8 -> Hauppauge WinTV-HVR1700 [0070:8101] |
10 | 9 -> Hauppauge WinTV-HVR1400 [0070:8010] | 10 | 9 -> Hauppauge WinTV-HVR1400 [0070:8010] |
11 | 10 -> DViCO FusionHDTV7 Dual Express [18ac:d618] | 11 | 10 -> DViCO FusionHDTV7 Dual Express [18ac:d618] |
12 | 11 -> DViCO FusionHDTV DVB-T Dual Express [18ac:db78] | ||
13 | 12 -> Leadtek Winfast PxDVR3200 H [107d:6681] | ||
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 7cf5685d364..a5227e308f4 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 | |||
@@ -66,3 +66,11 @@ | |||
66 | 65 -> DViCO FusionHDTV 7 Gold [18ac:d610] | 66 | 65 -> DViCO FusionHDTV 7 Gold [18ac:d610] |
67 | 66 -> Prolink Pixelview MPEG 8000GT [1554:4935] | 67 | 66 -> Prolink Pixelview MPEG 8000GT [1554:4935] |
68 | 67 -> Kworld PlusTV HD PCI 120 (ATSC 120) [17de:08c1] | 68 | 67 -> Kworld PlusTV HD PCI 120 (ATSC 120) [17de:08c1] |
69 | 68 -> Hauppauge WinTV-HVR4000 DVB-S/S2/T/Hybrid [0070:6900,0070:6904,0070:6902] | ||
70 | 69 -> Hauppauge WinTV-HVR4000(Lite) DVB-S/S2 [0070:6905,0070:6906] | ||
71 | 70 -> TeVii S460 DVB-S/S2 [d460:9022] | ||
72 | 71 -> Omicom SS4 DVB-S/S2 PCI [A044:2011] | ||
73 | 72 -> TBS 8920 DVB-S/S2 [8920:8888] | ||
74 | 73 -> TeVii S420 DVB-S [d420:9022] | ||
75 | 74 -> Prolink Pixelview Global Extreme [1554:4976] | ||
76 | 75 -> PROF 7300 DVB-S/S2 [B033:3033] | ||
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index 53449cb99b1..187cc48d092 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx | |||
@@ -1,5 +1,5 @@ | |||
1 | 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] | 1 | 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] |
2 | 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883] | 2 | 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2820,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883] |
3 | 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] | 3 | 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] |
4 | 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] | 4 | 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] |
5 | 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201] | 5 | 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201] |
@@ -12,7 +12,7 @@ | |||
12 | 11 -> Terratec Hybrid XS (em2880) [0ccd:0042] | 12 | 11 -> Terratec Hybrid XS (em2880) [0ccd:0042] |
13 | 12 -> Kworld PVR TV 2800 RF (em2820/em2840) | 13 | 12 -> Kworld PVR TV 2800 RF (em2820/em2840) |
14 | 13 -> Terratec Prodigy XS (em2880) [0ccd:0047] | 14 | 13 -> Terratec Prodigy XS (em2880) [0ccd:0047] |
15 | 14 -> Pixelview Prolink PlayTV USB 2.0 (em2820/em2840) | 15 | 14 -> Pixelview Prolink PlayTV USB 2.0 (em2820/em2840) [eb1a:2821] |
16 | 15 -> V-Gear PocketTV (em2800) | 16 | 15 -> V-Gear PocketTV (em2800) |
17 | 16 -> Hauppauge WinTV HVR 950 (em2883) [2040:6513,2040:6517,2040:651b,2040:651f] | 17 | 16 -> Hauppauge WinTV HVR 950 (em2883) [2040:6513,2040:6517,2040:651b,2040:651f] |
18 | 17 -> Pinnacle PCTV HD Pro Stick (em2880) [2304:0227] | 18 | 17 -> Pinnacle PCTV HD Pro Stick (em2880) [2304:0227] |
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 39868af9cf9..dc67eef38ff 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 | |||
@@ -76,7 +76,7 @@ | |||
76 | 75 -> AVerMedia AVerTVHD MCE A180 [1461:1044] | 76 | 75 -> AVerMedia AVerTVHD MCE A180 [1461:1044] |
77 | 76 -> SKNet MonsterTV Mobile [1131:4ee9] | 77 | 76 -> SKNet MonsterTV Mobile [1131:4ee9] |
78 | 77 -> Pinnacle PCTV 40i/50i/110i (saa7133) [11bd:002e] | 78 | 77 -> Pinnacle PCTV 40i/50i/110i (saa7133) [11bd:002e] |
79 | 78 -> ASUSTeK P7131 Dual [1043:4862,1043:4857] | 79 | 78 -> ASUSTeK P7131 Dual [1043:4862] |
80 | 79 -> Sedna/MuchTV PC TV Cardbus TV/Radio (ITO25 Rev:2B) | 80 | 79 -> Sedna/MuchTV PC TV Cardbus TV/Radio (ITO25 Rev:2B) |
81 | 80 -> ASUS Digimatrix TV [1043:0210] | 81 | 80 -> ASUS Digimatrix TV [1043:0210] |
82 | 81 -> Philips Tiger reference design [1131:2018] | 82 | 81 -> Philips Tiger reference design [1131:2018] |
@@ -145,3 +145,9 @@ | |||
145 | 144 -> Beholder BeholdTV M6 Extra [5ace:6193] | 145 | 144 -> Beholder BeholdTV M6 Extra [5ace:6193] |
146 | 145 -> AVerMedia MiniPCI DVB-T Hybrid M103 [1461:f636] | 146 | 145 -> AVerMedia MiniPCI DVB-T Hybrid M103 [1461:f636] |
147 | 146 -> ASUSTeK P7131 Analog | 147 | 146 -> ASUSTeK P7131 Analog |
148 | 147 -> Asus Tiger 3in1 [1043:4878] | ||
149 | 148 -> Encore ENLTV-FM v5.3 [1a7f:2008] | ||
150 | 149 -> Avermedia PCI pure analog (M135A) [1461:f11d] | ||
151 | 150 -> Zogis Real Angel 220 | ||
152 | 151 -> ADS Tech Instant HDTV [1421:0380] | ||
153 | 152 -> Asus Tiger Rev:1.00 [1043:4857] | ||
diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index 0e2394695bb..691d2f37dc5 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner | |||
@@ -74,3 +74,5 @@ tuner=72 - Thomson FE6600 | |||
74 | tuner=73 - Samsung TCPG 6121P30A | 74 | tuner=73 - Samsung TCPG 6121P30A |
75 | tuner=75 - Philips TEA5761 FM Radio | 75 | tuner=75 - Philips TEA5761 FM Radio |
76 | tuner=76 - Xceive 5000 tuner | 76 | tuner=76 - Xceive 5000 tuner |
77 | tuner=77 - TCL tuner MF02GIP-5N-E | ||
78 | tuner=78 - Philips FMD1216MEX MK3 Hybrid Tuner | ||
diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index 9a3e4d797fa..004818fab04 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt | |||
@@ -7,6 +7,7 @@ The modules are: | |||
7 | xxxx vend:prod | 7 | xxxx vend:prod |
8 | ---- | 8 | ---- |
9 | spca501 0000:0000 MystFromOri Unknow Camera | 9 | spca501 0000:0000 MystFromOri Unknow Camera |
10 | m5602 0402:5602 ALi Video Camera Controller | ||
10 | spca501 040a:0002 Kodak DVC-325 | 11 | spca501 040a:0002 Kodak DVC-325 |
11 | spca500 040a:0300 Kodak EZ200 | 12 | spca500 040a:0300 Kodak EZ200 |
12 | zc3xx 041e:041e Creative WebCam Live! | 13 | zc3xx 041e:041e Creative WebCam Live! |
@@ -42,6 +43,7 @@ zc3xx 0458:7007 Genius VideoCam V2 | |||
42 | zc3xx 0458:700c Genius VideoCam V3 | 43 | zc3xx 0458:700c Genius VideoCam V3 |
43 | zc3xx 0458:700f Genius VideoCam Web V2 | 44 | zc3xx 0458:700f Genius VideoCam Web V2 |
44 | sonixj 0458:7025 Genius Eye 311Q | 45 | sonixj 0458:7025 Genius Eye 311Q |
46 | sonixj 0458:702e Genius Slim 310 NB | ||
45 | sonixj 045e:00f5 MicroSoft VX3000 | 47 | sonixj 045e:00f5 MicroSoft VX3000 |
46 | sonixj 045e:00f7 MicroSoft VX1000 | 48 | sonixj 045e:00f7 MicroSoft VX1000 |
47 | ov519 045e:028c Micro$oft xbox cam | 49 | ov519 045e:028c Micro$oft xbox cam |
@@ -81,7 +83,7 @@ spca561 046d:092b Labtec Webcam Plus | |||
81 | spca561 046d:092c Logitech QC chat Elch2 | 83 | spca561 046d:092c Logitech QC chat Elch2 |
82 | spca561 046d:092d Logitech QC Elch2 | 84 | spca561 046d:092d Logitech QC Elch2 |
83 | spca561 046d:092e Logitech QC Elch2 | 85 | spca561 046d:092e Logitech QC Elch2 |
84 | spca561 046d:092f Logitech QC Elch2 | 86 | spca561 046d:092f Logitech QuickCam Express Plus |
85 | sunplus 046d:0960 Logitech ClickSmart 420 | 87 | sunplus 046d:0960 Logitech ClickSmart 420 |
86 | sunplus 0471:0322 Philips DMVC1300K | 88 | sunplus 0471:0322 Philips DMVC1300K |
87 | zc3xx 0471:0325 Philips SPC 200 NC | 89 | zc3xx 0471:0325 Philips SPC 200 NC |
@@ -96,6 +98,29 @@ sunplus 04a5:3003 Benq DC 1300 | |||
96 | sunplus 04a5:3008 Benq DC 1500 | 98 | sunplus 04a5:3008 Benq DC 1500 |
97 | sunplus 04a5:300a Benq DC 3410 | 99 | sunplus 04a5:300a Benq DC 3410 |
98 | spca500 04a5:300c Benq DC 1016 | 100 | spca500 04a5:300c Benq DC 1016 |
101 | finepix 04cb:0104 Fujifilm FinePix 4800 | ||
102 | finepix 04cb:0109 Fujifilm FinePix A202 | ||
103 | finepix 04cb:010b Fujifilm FinePix A203 | ||
104 | finepix 04cb:010f Fujifilm FinePix A204 | ||
105 | finepix 04cb:0111 Fujifilm FinePix A205 | ||
106 | finepix 04cb:0113 Fujifilm FinePix A210 | ||
107 | finepix 04cb:0115 Fujifilm FinePix A303 | ||
108 | finepix 04cb:0117 Fujifilm FinePix A310 | ||
109 | finepix 04cb:0119 Fujifilm FinePix F401 | ||
110 | finepix 04cb:011b Fujifilm FinePix F402 | ||
111 | finepix 04cb:011d Fujifilm FinePix F410 | ||
112 | finepix 04cb:0121 Fujifilm FinePix F601 | ||
113 | finepix 04cb:0123 Fujifilm FinePix F700 | ||
114 | finepix 04cb:0125 Fujifilm FinePix M603 | ||
115 | finepix 04cb:0127 Fujifilm FinePix S300 | ||
116 | finepix 04cb:0129 Fujifilm FinePix S304 | ||
117 | finepix 04cb:012b Fujifilm FinePix S500 | ||
118 | finepix 04cb:012d Fujifilm FinePix S602 | ||
119 | finepix 04cb:012f Fujifilm FinePix S700 | ||
120 | finepix 04cb:0131 Fujifilm FinePix unknown model | ||
121 | finepix 04cb:013b Fujifilm FinePix unknown model | ||
122 | finepix 04cb:013d Fujifilm FinePix unknown model | ||
123 | finepix 04cb:013f Fujifilm FinePix F420 | ||
99 | sunplus 04f1:1001 JVC GC A50 | 124 | sunplus 04f1:1001 JVC GC A50 |
100 | spca561 04fc:0561 Flexcam 100 | 125 | spca561 04fc:0561 Flexcam 100 |
101 | sunplus 04fc:500c Sunplus CA500C | 126 | sunplus 04fc:500c Sunplus CA500C |
@@ -181,6 +206,7 @@ pac207 093a:2468 PAC207 | |||
181 | pac207 093a:2470 Genius GF112 | 206 | pac207 093a:2470 Genius GF112 |
182 | pac207 093a:2471 Genius VideoCam ge111 | 207 | pac207 093a:2471 Genius VideoCam ge111 |
183 | pac207 093a:2472 Genius VideoCam ge110 | 208 | pac207 093a:2472 Genius VideoCam ge110 |
209 | pac207 093a:2476 Genius e-Messenger 112 | ||
184 | pac7311 093a:2600 PAC7311 Typhoon | 210 | pac7311 093a:2600 PAC7311 Typhoon |
185 | pac7311 093a:2601 Philips SPC 610 NC | 211 | pac7311 093a:2601 Philips SPC 610 NC |
186 | pac7311 093a:2603 PAC7312 | 212 | pac7311 093a:2603 PAC7312 |
diff --git a/Documentation/video4linux/m5602.txt b/Documentation/video4linux/m5602.txt new file mode 100644 index 00000000000..4450ab13f37 --- /dev/null +++ b/Documentation/video4linux/m5602.txt | |||
@@ -0,0 +1,12 @@ | |||
1 | This document describes the ALi m5602 bridge connected | ||
2 | to the following supported sensors: | ||
3 | OmniVision OV9650, | ||
4 | Samsung s5k83a, | ||
5 | Samsung s5k4aa, | ||
6 | Micron mt9m111, | ||
7 | Pixel plus PO1030 | ||
8 | |||
9 | This driver mimics the windows drivers, which have a braindead implementation sending bayer-encoded frames at VGA resolution. | ||
10 | In a perfect world we should be able to reprogram the m5602 and the connected sensor in hardware instead, supporting a range of resolutions and pixelformats | ||
11 | |||
12 | Anyway, have fun and please report any bugs to m560x-driver-devel@lists.sourceforge.net | ||
diff --git a/Documentation/video4linux/soc-camera.txt b/Documentation/video4linux/soc-camera.txt new file mode 100644 index 00000000000..178ef3c5e57 --- /dev/null +++ b/Documentation/video4linux/soc-camera.txt | |||
@@ -0,0 +1,120 @@ | |||
1 | Soc-Camera Subsystem | ||
2 | ==================== | ||
3 | |||
4 | Terminology | ||
5 | ----------- | ||
6 | |||
7 | The following terms are used in this document: | ||
8 | - camera / camera device / camera sensor - a video-camera sensor chip, capable | ||
9 | of connecting to a variety of systems and interfaces, typically uses i2c for | ||
10 | control and configuration, and a parallel or a serial bus for data. | ||
11 | - camera host - an interface, to which a camera is connected. Typically a | ||
12 | specialised interface, present on many SoCs, e.g., PXA27x and PXA3xx, SuperH, | ||
13 | AVR32, i.MX27, i.MX31. | ||
14 | - camera host bus - a connection between a camera host and a camera. Can be | ||
15 | parallel or serial, consists of data and control lines, e.g., clock, vertical | ||
16 | and horizontal synchronization signals. | ||
17 | |||
18 | Purpose of the soc-camera subsystem | ||
19 | ----------------------------------- | ||
20 | |||
21 | The soc-camera subsystem provides a unified API between camera host drivers and | ||
22 | camera sensor drivers. It implements a V4L2 interface to the user, currently | ||
23 | only the mmap method is supported. | ||
24 | |||
25 | This subsystem has been written to connect drivers for System-on-Chip (SoC) | ||
26 | video capture interfaces with drivers for CMOS camera sensor chips to enable | ||
27 | the reuse of sensor drivers with various hosts. The subsystem has been designed | ||
28 | to support multiple camera host interfaces and multiple cameras per interface, | ||
29 | although most applications have only one camera sensor. | ||
30 | |||
31 | Existing drivers | ||
32 | ---------------- | ||
33 | |||
34 | As of 2.6.27-rc4 there are two host drivers in the mainline: pxa_camera.c for | ||
35 | PXA27x SoCs and sh_mobile_ceu_camera.c for SuperH SoCs, and four sensor drivers: | ||
36 | mt9m001.c, mt9m111.c, mt9v022.c and a generic soc_camera_platform.c driver. This | ||
37 | list is not supposed to be updated, look for more examples in your tree. | ||
38 | |||
39 | Camera host API | ||
40 | --------------- | ||
41 | |||
42 | A host camera driver is registered using the | ||
43 | |||
44 | soc_camera_host_register(struct soc_camera_host *); | ||
45 | |||
46 | function. The host object can be initialized as follows: | ||
47 | |||
48 | static struct soc_camera_host pxa_soc_camera_host = { | ||
49 | .drv_name = PXA_CAM_DRV_NAME, | ||
50 | .ops = &pxa_soc_camera_host_ops, | ||
51 | }; | ||
52 | |||
53 | All camera host methods are passed in a struct soc_camera_host_ops: | ||
54 | |||
55 | static struct soc_camera_host_ops pxa_soc_camera_host_ops = { | ||
56 | .owner = THIS_MODULE, | ||
57 | .add = pxa_camera_add_device, | ||
58 | .remove = pxa_camera_remove_device, | ||
59 | .suspend = pxa_camera_suspend, | ||
60 | .resume = pxa_camera_resume, | ||
61 | .set_fmt_cap = pxa_camera_set_fmt_cap, | ||
62 | .try_fmt_cap = pxa_camera_try_fmt_cap, | ||
63 | .init_videobuf = pxa_camera_init_videobuf, | ||
64 | .reqbufs = pxa_camera_reqbufs, | ||
65 | .poll = pxa_camera_poll, | ||
66 | .querycap = pxa_camera_querycap, | ||
67 | .try_bus_param = pxa_camera_try_bus_param, | ||
68 | .set_bus_param = pxa_camera_set_bus_param, | ||
69 | }; | ||
70 | |||
71 | .add and .remove methods are called when a sensor is attached to or detached | ||
72 | from the host, apart from performing host-internal tasks they shall also call | ||
73 | sensor driver's .init and .release methods respectively. .suspend and .resume | ||
74 | methods implement host's power-management functionality and its their | ||
75 | responsibility to call respective sensor's methods. .try_bus_param and | ||
76 | .set_bus_param are used to negotiate physical connection parameters between the | ||
77 | host and the sensor. .init_videobuf is called by soc-camera core when a | ||
78 | video-device is opened, further video-buffer management is implemented completely | ||
79 | by the specific camera host driver. The rest of the methods are called from | ||
80 | respective V4L2 operations. | ||
81 | |||
82 | Camera API | ||
83 | ---------- | ||
84 | |||
85 | Sensor drivers can use struct soc_camera_link, typically provided by the | ||
86 | platform, and used to specify to which camera host bus the sensor is connected, | ||
87 | and arbitrarily provide platform .power and .reset methods for the camera. | ||
88 | soc_camera_device_register() and soc_camera_device_unregister() functions are | ||
89 | used to add a sensor driver to or remove one from the system. The registration | ||
90 | function takes a pointer to struct soc_camera_device as the only parameter. | ||
91 | This struct can be initialized as follows: | ||
92 | |||
93 | /* link to driver operations */ | ||
94 | icd->ops = &mt9m001_ops; | ||
95 | /* link to the underlying physical (e.g., i2c) device */ | ||
96 | icd->control = &client->dev; | ||
97 | /* window geometry */ | ||
98 | icd->x_min = 20; | ||
99 | icd->y_min = 12; | ||
100 | icd->x_current = 20; | ||
101 | icd->y_current = 12; | ||
102 | icd->width_min = 48; | ||
103 | icd->width_max = 1280; | ||
104 | icd->height_min = 32; | ||
105 | icd->height_max = 1024; | ||
106 | icd->y_skip_top = 1; | ||
107 | /* camera bus ID, typically obtained from platform data */ | ||
108 | icd->iface = icl->bus_id; | ||
109 | |||
110 | struct soc_camera_ops provides .probe and .remove methods, which are called by | ||
111 | the soc-camera core, when a camera is matched against or removed from a camera | ||
112 | host bus, .init, .release, .suspend, and .resume are called from the camera host | ||
113 | driver as discussed above. Other members of this struct provide respective V4L2 | ||
114 | functionality. | ||
115 | |||
116 | struct soc_camera_device also links to an array of struct soc_camera_data_format, | ||
117 | listing pixel formats, supported by the camera. | ||
118 | |||
119 | -- | ||
120 | Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
diff --git a/Documentation/vm/unevictable-lru.txt b/Documentation/vm/unevictable-lru.txt new file mode 100644 index 00000000000..125eed560e5 --- /dev/null +++ b/Documentation/vm/unevictable-lru.txt | |||
@@ -0,0 +1,615 @@ | |||
1 | |||
2 | This document describes the Linux memory management "Unevictable LRU" | ||
3 | infrastructure and the use of this infrastructure to manage several types | ||
4 | of "unevictable" pages. The document attempts to provide the overall | ||
5 | rationale behind this mechanism and the rationale for some of the design | ||
6 | decisions that drove the implementation. The latter design rationale is | ||
7 | discussed in the context of an implementation description. Admittedly, one | ||
8 | can obtain the implementation details--the "what does it do?"--by reading the | ||
9 | code. One hopes that the descriptions below add value by provide the answer | ||
10 | to "why does it do that?". | ||
11 | |||
12 | Unevictable LRU Infrastructure: | ||
13 | |||
14 | The Unevictable LRU adds an additional LRU list to track unevictable pages | ||
15 | and to hide these pages from vmscan. This mechanism is based on a patch by | ||
16 | Larry Woodman of Red Hat to address several scalability problems with page | ||
17 | reclaim in Linux. The problems have been observed at customer sites on large | ||
18 | memory x86_64 systems. For example, a non-numal x86_64 platform with 128GB | ||
19 | of main memory will have over 32 million 4k pages in a single zone. When a | ||
20 | large fraction of these pages are not evictable for any reason [see below], | ||
21 | vmscan will spend a lot of time scanning the LRU lists looking for the small | ||
22 | fraction of pages that are evictable. This can result in a situation where | ||
23 | all cpus are spending 100% of their time in vmscan for hours or days on end, | ||
24 | with the system completely unresponsive. | ||
25 | |||
26 | The Unevictable LRU infrastructure addresses the following classes of | ||
27 | unevictable pages: | ||
28 | |||
29 | + page owned by ramfs | ||
30 | + page mapped into SHM_LOCKed shared memory regions | ||
31 | + page mapped into VM_LOCKED [mlock()ed] vmas | ||
32 | |||
33 | The infrastructure might be able to handle other conditions that make pages | ||
34 | unevictable, either by definition or by circumstance, in the future. | ||
35 | |||
36 | |||
37 | The Unevictable LRU List | ||
38 | |||
39 | The Unevictable LRU infrastructure consists of an additional, per-zone, LRU list | ||
40 | called the "unevictable" list and an associated page flag, PG_unevictable, to | ||
41 | indicate that the page is being managed on the unevictable list. The | ||
42 | PG_unevictable flag is analogous to, and mutually exclusive with, the PG_active | ||
43 | flag in that it indicates on which LRU list a page resides when PG_lru is set. | ||
44 | The unevictable LRU list is source configurable based on the UNEVICTABLE_LRU | ||
45 | Kconfig option. | ||
46 | |||
47 | The Unevictable LRU infrastructure maintains unevictable pages on an additional | ||
48 | LRU list for a few reasons: | ||
49 | |||
50 | 1) We get to "treat unevictable pages just like we treat other pages in the | ||
51 | system, which means we get to use the same code to manipulate them, the | ||
52 | same code to isolate them (for migrate, etc.), the same code to keep track | ||
53 | of the statistics, etc..." [Rik van Riel] | ||
54 | |||
55 | 2) We want to be able to migrate unevictable pages between nodes--for memory | ||
56 | defragmentation, workload management and memory hotplug. The linux kernel | ||
57 | can only migrate pages that it can successfully isolate from the lru lists. | ||
58 | If we were to maintain pages elsewise than on an lru-like list, where they | ||
59 | can be found by isolate_lru_page(), we would prevent their migration, unless | ||
60 | we reworked migration code to find the unevictable pages. | ||
61 | |||
62 | |||
63 | The unevictable LRU list does not differentiate between file backed and swap | ||
64 | backed [anon] pages. This differentiation is only important while the pages | ||
65 | are, in fact, evictable. | ||
66 | |||
67 | The unevictable LRU list benefits from the "arrayification" of the per-zone | ||
68 | LRU lists and statistics originally proposed and posted by Christoph Lameter. | ||
69 | |||
70 | The unevictable list does not use the lru pagevec mechanism. Rather, | ||
71 | unevictable pages are placed directly on the page's zone's unevictable | ||
72 | list under the zone lru_lock. The reason for this is to prevent stranding | ||
73 | of pages on the unevictable list when one task has the page isolated from the | ||
74 | lru and other tasks are changing the "evictability" state of the page. | ||
75 | |||
76 | |||
77 | Unevictable LRU and Memory Controller Interaction | ||
78 | |||
79 | The memory controller data structure automatically gets a per zone unevictable | ||
80 | lru list as a result of the "arrayification" of the per-zone LRU lists. The | ||
81 | memory controller tracks the movement of pages to and from the unevictable list. | ||
82 | When a memory control group comes under memory pressure, the controller will | ||
83 | not attempt to reclaim pages on the unevictable list. This has a couple of | ||
84 | effects. Because the pages are "hidden" from reclaim on the unevictable list, | ||
85 | the reclaim process can be more efficient, dealing only with pages that have | ||
86 | a chance of being reclaimed. On the other hand, if too many of the pages | ||
87 | charged to the control group are unevictable, the evictable portion of the | ||
88 | working set of the tasks in the control group may not fit into the available | ||
89 | memory. This can cause the control group to thrash or to oom-kill tasks. | ||
90 | |||
91 | |||
92 | Unevictable LRU: Detecting Unevictable Pages | ||
93 | |||
94 | The function page_evictable(page, vma) in vmscan.c determines whether a | ||
95 | page is evictable or not. For ramfs pages and pages in SHM_LOCKed regions, | ||
96 | page_evictable() tests a new address space flag, AS_UNEVICTABLE, in the page's | ||
97 | address space using a wrapper function. Wrapper functions are used to set, | ||
98 | clear and test the flag to reduce the requirement for #ifdef's throughout the | ||
99 | source code. AS_UNEVICTABLE is set on ramfs inode/mapping when it is created. | ||
100 | This flag remains for the life of the inode. | ||
101 | |||
102 | For shared memory regions, AS_UNEVICTABLE is set when an application | ||
103 | successfully SHM_LOCKs the region and is removed when the region is | ||
104 | SHM_UNLOCKed. Note that shmctl(SHM_LOCK, ...) does not populate the page | ||
105 | tables for the region as does, for example, mlock(). So, we make no special | ||
106 | effort to push any pages in the SHM_LOCKed region to the unevictable list. | ||
107 | Vmscan will do this when/if it encounters the pages during reclaim. On | ||
108 | SHM_UNLOCK, shmctl() scans the pages in the region and "rescues" them from the | ||
109 | unevictable list if no other condition keeps them unevictable. If a SHM_LOCKed | ||
110 | region is destroyed, the pages are also "rescued" from the unevictable list in | ||
111 | the process of freeing them. | ||
112 | |||
113 | page_evictable() detects mlock()ed pages by testing an additional page flag, | ||
114 | PG_mlocked via the PageMlocked() wrapper. If the page is NOT mlocked, and a | ||
115 | non-NULL vma is supplied, page_evictable() will check whether the vma is | ||
116 | VM_LOCKED via is_mlocked_vma(). is_mlocked_vma() will SetPageMlocked() and | ||
117 | update the appropriate statistics if the vma is VM_LOCKED. This method allows | ||
118 | efficient "culling" of pages in the fault path that are being faulted in to | ||
119 | VM_LOCKED vmas. | ||
120 | |||
121 | |||
122 | Unevictable Pages and Vmscan [shrink_*_list()] | ||
123 | |||
124 | If unevictable pages are culled in the fault path, or moved to the unevictable | ||
125 | list at mlock() or mmap() time, vmscan will never encounter the pages until | ||
126 | they have become evictable again, for example, via munlock() and have been | ||
127 | "rescued" from the unevictable list. However, there may be situations where we | ||
128 | decide, for the sake of expediency, to leave a unevictable page on one of the | ||
129 | regular active/inactive LRU lists for vmscan to deal with. Vmscan checks for | ||
130 | such pages in all of the shrink_{active|inactive|page}_list() functions and | ||
131 | will "cull" such pages that it encounters--that is, it diverts those pages to | ||
132 | the unevictable list for the zone being scanned. | ||
133 | |||
134 | There may be situations where a page is mapped into a VM_LOCKED vma, but the | ||
135 | page is not marked as PageMlocked. Such pages will make it all the way to | ||
136 | shrink_page_list() where they will be detected when vmscan walks the reverse | ||
137 | map in try_to_unmap(). If try_to_unmap() returns SWAP_MLOCK, shrink_page_list() | ||
138 | will cull the page at that point. | ||
139 | |||
140 | Note that for anonymous pages, shrink_page_list() attempts to add the page to | ||
141 | the swap cache before it tries to unmap the page. To avoid this unnecessary | ||
142 | consumption of swap space, shrink_page_list() calls try_to_munlock() to check | ||
143 | whether any VM_LOCKED vmas map the page without attempting to unmap the page. | ||
144 | If try_to_munlock() returns SWAP_MLOCK, shrink_page_list() will cull the page | ||
145 | without consuming swap space. try_to_munlock() will be described below. | ||
146 | |||
147 | To "cull" an unevictable page, vmscan simply puts the page back on the lru | ||
148 | list using putback_lru_page()--the inverse operation to isolate_lru_page()-- | ||
149 | after dropping the page lock. Because the condition which makes the page | ||
150 | unevictable may change once the page is unlocked, putback_lru_page() will | ||
151 | recheck the unevictable state of a page that it places on the unevictable lru | ||
152 | list. If the page has become unevictable, putback_lru_page() removes it from | ||
153 | the list and retries, including the page_unevictable() test. Because such a | ||
154 | race is a rare event and movement of pages onto the unevictable list should be | ||
155 | rare, these extra evictabilty checks should not occur in the majority of calls | ||
156 | to putback_lru_page(). | ||
157 | |||
158 | |||
159 | Mlocked Page: Prior Work | ||
160 | |||
161 | The "Unevictable Mlocked Pages" infrastructure is based on work originally | ||
162 | posted by Nick Piggin in an RFC patch entitled "mm: mlocked pages off LRU". | ||
163 | Nick posted his patch as an alternative to a patch posted by Christoph | ||
164 | Lameter to achieve the same objective--hiding mlocked pages from vmscan. | ||
165 | In Nick's patch, he used one of the struct page lru list link fields as a count | ||
166 | of VM_LOCKED vmas that map the page. This use of the link field for a count | ||
167 | prevented the management of the pages on an LRU list. Thus, mlocked pages were | ||
168 | not migratable as isolate_lru_page() could not find them and the lru list link | ||
169 | field was not available to the migration subsystem. Nick resolved this by | ||
170 | putting mlocked pages back on the lru list before attempting to isolate them, | ||
171 | thus abandoning the count of VM_LOCKED vmas. When Nick's patch was integrated | ||
172 | with the Unevictable LRU work, the count was replaced by walking the reverse | ||
173 | map to determine whether any VM_LOCKED vmas mapped the page. More on this | ||
174 | below. | ||
175 | |||
176 | |||
177 | Mlocked Pages: Basic Management | ||
178 | |||
179 | Mlocked pages--pages mapped into a VM_LOCKED vma--represent one class of | ||
180 | unevictable pages. When such a page has been "noticed" by the memory | ||
181 | management subsystem, the page is marked with the PG_mlocked [PageMlocked()] | ||
182 | flag. A PageMlocked() page will be placed on the unevictable LRU list when | ||
183 | it is added to the LRU. Pages can be "noticed" by memory management in | ||
184 | several places: | ||
185 | |||
186 | 1) in the mlock()/mlockall() system call handlers. | ||
187 | 2) in the mmap() system call handler when mmap()ing a region with the | ||
188 | MAP_LOCKED flag, or mmap()ing a region in a task that has called | ||
189 | mlockall() with the MCL_FUTURE flag. Both of these conditions result | ||
190 | in the VM_LOCKED flag being set for the vma. | ||
191 | 3) in the fault path, if mlocked pages are "culled" in the fault path, | ||
192 | and when a VM_LOCKED stack segment is expanded. | ||
193 | 4) as mentioned above, in vmscan:shrink_page_list() with attempting to | ||
194 | reclaim a page in a VM_LOCKED vma--via try_to_unmap() or try_to_munlock(). | ||
195 | |||
196 | Mlocked pages become unlocked and rescued from the unevictable list when: | ||
197 | |||
198 | 1) mapped in a range unlocked via the munlock()/munlockall() system calls. | ||
199 | 2) munmapped() out of the last VM_LOCKED vma that maps the page, including | ||
200 | unmapping at task exit. | ||
201 | 3) when the page is truncated from the last VM_LOCKED vma of an mmap()ed file. | ||
202 | 4) before a page is COWed in a VM_LOCKED vma. | ||
203 | |||
204 | |||
205 | Mlocked Pages: mlock()/mlockall() System Call Handling | ||
206 | |||
207 | Both [do_]mlock() and [do_]mlockall() system call handlers call mlock_fixup() | ||
208 | for each vma in the range specified by the call. In the case of mlockall(), | ||
209 | this is the entire active address space of the task. Note that mlock_fixup() | ||
210 | is used for both mlock()ing and munlock()ing a range of memory. A call to | ||
211 | mlock() an already VM_LOCKED vma, or to munlock() a vma that is not VM_LOCKED | ||
212 | is treated as a no-op--mlock_fixup() simply returns. | ||
213 | |||
214 | If the vma passes some filtering described in "Mlocked Pages: Filtering Vmas" | ||
215 | below, mlock_fixup() will attempt to merge the vma with its neighbors or split | ||
216 | off a subset of the vma if the range does not cover the entire vma. Once the | ||
217 | vma has been merged or split or neither, mlock_fixup() will call | ||
218 | __mlock_vma_pages_range() to fault in the pages via get_user_pages() and | ||
219 | to mark the pages as mlocked via mlock_vma_page(). | ||
220 | |||
221 | Note that the vma being mlocked might be mapped with PROT_NONE. In this case, | ||
222 | get_user_pages() will be unable to fault in the pages. That's OK. If pages | ||
223 | do end up getting faulted into this VM_LOCKED vma, we'll handle them in the | ||
224 | fault path or in vmscan. | ||
225 | |||
226 | Also note that a page returned by get_user_pages() could be truncated or | ||
227 | migrated out from under us, while we're trying to mlock it. To detect | ||
228 | this, __mlock_vma_pages_range() tests the page_mapping after acquiring | ||
229 | the page lock. If the page is still associated with its mapping, we'll | ||
230 | go ahead and call mlock_vma_page(). If the mapping is gone, we just | ||
231 | unlock the page and move on. Worse case, this results in page mapped | ||
232 | in a VM_LOCKED vma remaining on a normal LRU list without being | ||
233 | PageMlocked(). Again, vmscan will detect and cull such pages. | ||
234 | |||
235 | mlock_vma_page(), called with the page locked [N.B., not "mlocked"], will | ||
236 | TestSetPageMlocked() for each page returned by get_user_pages(). We use | ||
237 | TestSetPageMlocked() because the page might already be mlocked by another | ||
238 | task/vma and we don't want to do extra work. We especially do not want to | ||
239 | count an mlocked page more than once in the statistics. If the page was | ||
240 | already mlocked, mlock_vma_page() is done. | ||
241 | |||
242 | If the page was NOT already mlocked, mlock_vma_page() attempts to isolate the | ||
243 | page from the LRU, as it is likely on the appropriate active or inactive list | ||
244 | at that time. If the isolate_lru_page() succeeds, mlock_vma_page() will | ||
245 | putback the page--putback_lru_page()--which will notice that the page is now | ||
246 | mlocked and divert the page to the zone's unevictable LRU list. If | ||
247 | mlock_vma_page() is unable to isolate the page from the LRU, vmscan will handle | ||
248 | it later if/when it attempts to reclaim the page. | ||
249 | |||
250 | |||
251 | Mlocked Pages: Filtering Special Vmas | ||
252 | |||
253 | mlock_fixup() filters several classes of "special" vmas: | ||
254 | |||
255 | 1) vmas with VM_IO|VM_PFNMAP set are skipped entirely. The pages behind | ||
256 | these mappings are inherently pinned, so we don't need to mark them as | ||
257 | mlocked. In any case, most of the pages have no struct page in which to | ||
258 | so mark the page. Because of this, get_user_pages() will fail for these | ||
259 | vmas, so there is no sense in attempting to visit them. | ||
260 | |||
261 | 2) vmas mapping hugetlbfs page are already effectively pinned into memory. | ||
262 | We don't need nor want to mlock() these pages. However, to preserve the | ||
263 | prior behavior of mlock()--before the unevictable/mlock changes--mlock_fixup() | ||
264 | will call make_pages_present() in the hugetlbfs vma range to allocate the | ||
265 | huge pages and populate the ptes. | ||
266 | |||
267 | 3) vmas with VM_DONTEXPAND|VM_RESERVED are generally user space mappings of | ||
268 | kernel pages, such as the vdso page, relay channel pages, etc. These pages | ||
269 | are inherently unevictable and are not managed on the LRU lists. | ||
270 | mlock_fixup() treats these vmas the same as hugetlbfs vmas. It calls | ||
271 | make_pages_present() to populate the ptes. | ||
272 | |||
273 | Note that for all of these special vmas, mlock_fixup() does not set the | ||
274 | VM_LOCKED flag. Therefore, we won't have to deal with them later during | ||
275 | munlock() or munmap()--for example, at task exit. Neither does mlock_fixup() | ||
276 | account these vmas against the task's "locked_vm". | ||
277 | |||
278 | Mlocked Pages: Downgrading the Mmap Semaphore. | ||
279 | |||
280 | mlock_fixup() must be called with the mmap semaphore held for write, because | ||
281 | it may have to merge or split vmas. However, mlocking a large region of | ||
282 | memory can take a long time--especially if vmscan must reclaim pages to | ||
283 | satisfy the regions requirements. Faulting in a large region with the mmap | ||
284 | semaphore held for write can hold off other faults on the address space, in | ||
285 | the case of a multi-threaded task. It can also hold off scans of the task's | ||
286 | address space via /proc. While testing under heavy load, it was observed that | ||
287 | the ps(1) command could be held off for many minutes while a large segment was | ||
288 | mlock()ed down. | ||
289 | |||
290 | To address this issue, and to make the system more responsive during mlock()ing | ||
291 | of large segments, mlock_fixup() downgrades the mmap semaphore to read mode | ||
292 | during the call to __mlock_vma_pages_range(). This works fine. However, the | ||
293 | callers of mlock_fixup() expect the semaphore to be returned in write mode. | ||
294 | So, mlock_fixup() "upgrades" the semphore to write mode. Linux does not | ||
295 | support an atomic upgrade_sem() call, so mlock_fixup() must drop the semaphore | ||
296 | and reacquire it in write mode. In a multi-threaded task, it is possible for | ||
297 | the task memory map to change while the semaphore is dropped. Therefore, | ||
298 | mlock_fixup() looks up the vma at the range start address after reacquiring | ||
299 | the semaphore in write mode and verifies that it still covers the original | ||
300 | range. If not, mlock_fixup() returns an error [-EAGAIN]. All callers of | ||
301 | mlock_fixup() have been changed to deal with this new error condition. | ||
302 | |||
303 | Note: when munlocking a region, all of the pages should already be resident-- | ||
304 | unless we have racing threads mlocking() and munlocking() regions. So, | ||
305 | unlocking should not have to wait for page allocations nor faults of any kind. | ||
306 | Therefore mlock_fixup() does not downgrade the semaphore for munlock(). | ||
307 | |||
308 | |||
309 | Mlocked Pages: munlock()/munlockall() System Call Handling | ||
310 | |||
311 | The munlock() and munlockall() system calls are handled by the same functions-- | ||
312 | do_mlock[all]()--as the mlock() and mlockall() system calls with the unlock | ||
313 | vs lock operation indicated by an argument. So, these system calls are also | ||
314 | handled by mlock_fixup(). Again, if called for an already munlock()ed vma, | ||
315 | mlock_fixup() simply returns. Because of the vma filtering discussed above, | ||
316 | VM_LOCKED will not be set in any "special" vmas. So, these vmas will be | ||
317 | ignored for munlock. | ||
318 | |||
319 | If the vma is VM_LOCKED, mlock_fixup() again attempts to merge or split off | ||
320 | the specified range. The range is then munlocked via the function | ||
321 | __mlock_vma_pages_range()--the same function used to mlock a vma range-- | ||
322 | passing a flag to indicate that munlock() is being performed. | ||
323 | |||
324 | Because the vma access protections could have been changed to PROT_NONE after | ||
325 | faulting in and mlocking some pages, get_user_pages() was unreliable for visiting | ||
326 | these pages for munlocking. Because we don't want to leave pages mlocked(), | ||
327 | get_user_pages() was enhanced to accept a flag to ignore the permissions when | ||
328 | fetching the pages--all of which should be resident as a result of previous | ||
329 | mlock()ing. | ||
330 | |||
331 | For munlock(), __mlock_vma_pages_range() unlocks individual pages by calling | ||
332 | munlock_vma_page(). munlock_vma_page() unconditionally clears the PG_mlocked | ||
333 | flag using TestClearPageMlocked(). As with mlock_vma_page(), munlock_vma_page() | ||
334 | use the Test*PageMlocked() function to handle the case where the page might | ||
335 | have already been unlocked by another task. If the page was mlocked, | ||
336 | munlock_vma_page() updates that zone statistics for the number of mlocked | ||
337 | pages. Note, however, that at this point we haven't checked whether the page | ||
338 | is mapped by other VM_LOCKED vmas. | ||
339 | |||
340 | We can't call try_to_munlock(), the function that walks the reverse map to check | ||
341 | for other VM_LOCKED vmas, without first isolating the page from the LRU. | ||
342 | try_to_munlock() is a variant of try_to_unmap() and thus requires that the page | ||
343 | not be on an lru list. [More on these below.] However, the call to | ||
344 | isolate_lru_page() could fail, in which case we couldn't try_to_munlock(). | ||
345 | So, we go ahead and clear PG_mlocked up front, as this might be the only chance | ||
346 | we have. If we can successfully isolate the page, we go ahead and | ||
347 | try_to_munlock(), which will restore the PG_mlocked flag and update the zone | ||
348 | page statistics if it finds another vma holding the page mlocked. If we fail | ||
349 | to isolate the page, we'll have left a potentially mlocked page on the LRU. | ||
350 | This is fine, because we'll catch it later when/if vmscan tries to reclaim the | ||
351 | page. This should be relatively rare. | ||
352 | |||
353 | Mlocked Pages: Migrating Them... | ||
354 | |||
355 | A page that is being migrated has been isolated from the lru lists and is | ||
356 | held locked across unmapping of the page, updating the page's mapping | ||
357 | [address_space] entry and copying the contents and state, until the | ||
358 | page table entry has been replaced with an entry that refers to the new | ||
359 | page. Linux supports migration of mlocked pages and other unevictable | ||
360 | pages. This involves simply moving the PageMlocked and PageUnevictable states | ||
361 | from the old page to the new page. | ||
362 | |||
363 | Note that page migration can race with mlocking or munlocking of the same | ||
364 | page. This has been discussed from the mlock/munlock perspective in the | ||
365 | respective sections above. Both processes [migration, m[un]locking], hold | ||
366 | the page locked. This provides the first level of synchronization. Page | ||
367 | migration zeros out the page_mapping of the old page before unlocking it, | ||
368 | so m[un]lock can skip these pages by testing the page mapping under page | ||
369 | lock. | ||
370 | |||
371 | When completing page migration, we place the new and old pages back onto the | ||
372 | lru after dropping the page lock. The "unneeded" page--old page on success, | ||
373 | new page on failure--will be freed when the reference count held by the | ||
374 | migration process is released. To ensure that we don't strand pages on the | ||
375 | unevictable list because of a race between munlock and migration, page | ||
376 | migration uses the putback_lru_page() function to add migrated pages back to | ||
377 | the lru. | ||
378 | |||
379 | |||
380 | Mlocked Pages: mmap(MAP_LOCKED) System Call Handling | ||
381 | |||
382 | In addition the the mlock()/mlockall() system calls, an application can request | ||
383 | that a region of memory be mlocked using the MAP_LOCKED flag with the mmap() | ||
384 | call. Furthermore, any mmap() call or brk() call that expands the heap by a | ||
385 | task that has previously called mlockall() with the MCL_FUTURE flag will result | ||
386 | in the newly mapped memory being mlocked. Before the unevictable/mlock changes, | ||
387 | the kernel simply called make_pages_present() to allocate pages and populate | ||
388 | the page table. | ||
389 | |||
390 | To mlock a range of memory under the unevictable/mlock infrastructure, the | ||
391 | mmap() handler and task address space expansion functions call | ||
392 | mlock_vma_pages_range() specifying the vma and the address range to mlock. | ||
393 | mlock_vma_pages_range() filters vmas like mlock_fixup(), as described above in | ||
394 | "Mlocked Pages: Filtering Vmas". It will clear the VM_LOCKED flag, which will | ||
395 | have already been set by the caller, in filtered vmas. Thus these vma's need | ||
396 | not be visited for munlock when the region is unmapped. | ||
397 | |||
398 | For "normal" vmas, mlock_vma_pages_range() calls __mlock_vma_pages_range() to | ||
399 | fault/allocate the pages and mlock them. Again, like mlock_fixup(), | ||
400 | mlock_vma_pages_range() downgrades the mmap semaphore to read mode before | ||
401 | attempting to fault/allocate and mlock the pages; and "upgrades" the semaphore | ||
402 | back to write mode before returning. | ||
403 | |||
404 | The callers of mlock_vma_pages_range() will have already added the memory | ||
405 | range to be mlocked to the task's "locked_vm". To account for filtered vmas, | ||
406 | mlock_vma_pages_range() returns the number of pages NOT mlocked. All of the | ||
407 | callers then subtract a non-negative return value from the task's locked_vm. | ||
408 | A negative return value represent an error--for example, from get_user_pages() | ||
409 | attempting to fault in a vma with PROT_NONE access. In this case, we leave | ||
410 | the memory range accounted as locked_vm, as the protections could be changed | ||
411 | later and pages allocated into that region. | ||
412 | |||
413 | |||
414 | Mlocked Pages: munmap()/exit()/exec() System Call Handling | ||
415 | |||
416 | When unmapping an mlocked region of memory, whether by an explicit call to | ||
417 | munmap() or via an internal unmap from exit() or exec() processing, we must | ||
418 | munlock the pages if we're removing the last VM_LOCKED vma that maps the pages. | ||
419 | Before the unevictable/mlock changes, mlocking did not mark the pages in any way, | ||
420 | so unmapping them required no processing. | ||
421 | |||
422 | To munlock a range of memory under the unevictable/mlock infrastructure, the | ||
423 | munmap() hander and task address space tear down function call | ||
424 | munlock_vma_pages_all(). The name reflects the observation that one always | ||
425 | specifies the entire vma range when munlock()ing during unmap of a region. | ||
426 | Because of the vma filtering when mlocking() regions, only "normal" vmas that | ||
427 | actually contain mlocked pages will be passed to munlock_vma_pages_all(). | ||
428 | |||
429 | munlock_vma_pages_all() clears the VM_LOCKED vma flag and, like mlock_fixup() | ||
430 | for the munlock case, calls __munlock_vma_pages_range() to walk the page table | ||
431 | for the vma's memory range and munlock_vma_page() each resident page mapped by | ||
432 | the vma. This effectively munlocks the page, only if this is the last | ||
433 | VM_LOCKED vma that maps the page. | ||
434 | |||
435 | |||
436 | Mlocked Page: try_to_unmap() | ||
437 | |||
438 | [Note: the code changes represented by this section are really quite small | ||
439 | compared to the text to describe what happening and why, and to discuss the | ||
440 | implications.] | ||
441 | |||
442 | Pages can, of course, be mapped into multiple vmas. Some of these vmas may | ||
443 | have VM_LOCKED flag set. It is possible for a page mapped into one or more | ||
444 | VM_LOCKED vmas not to have the PG_mlocked flag set and therefore reside on one | ||
445 | of the active or inactive LRU lists. This could happen if, for example, a | ||
446 | task in the process of munlock()ing the page could not isolate the page from | ||
447 | the LRU. As a result, vmscan/shrink_page_list() might encounter such a page | ||
448 | as described in "Unevictable Pages and Vmscan [shrink_*_list()]". To | ||
449 | handle this situation, try_to_unmap() has been enhanced to check for VM_LOCKED | ||
450 | vmas while it is walking a page's reverse map. | ||
451 | |||
452 | try_to_unmap() is always called, by either vmscan for reclaim or for page | ||
453 | migration, with the argument page locked and isolated from the LRU. BUG_ON() | ||
454 | assertions enforce this requirement. Separate functions handle anonymous and | ||
455 | mapped file pages, as these types of pages have different reverse map | ||
456 | mechanisms. | ||
457 | |||
458 | try_to_unmap_anon() | ||
459 | |||
460 | To unmap anonymous pages, each vma in the list anchored in the anon_vma must be | ||
461 | visited--at least until a VM_LOCKED vma is encountered. If the page is being | ||
462 | unmapped for migration, VM_LOCKED vmas do not stop the process because mlocked | ||
463 | pages are migratable. However, for reclaim, if the page is mapped into a | ||
464 | VM_LOCKED vma, the scan stops. try_to_unmap() attempts to acquire the mmap | ||
465 | semphore of the mm_struct to which the vma belongs in read mode. If this is | ||
466 | successful, try_to_unmap() will mlock the page via mlock_vma_page()--we | ||
467 | wouldn't have gotten to try_to_unmap() if the page were already mlocked--and | ||
468 | will return SWAP_MLOCK, indicating that the page is unevictable. If the | ||
469 | mmap semaphore cannot be acquired, we are not sure whether the page is really | ||
470 | unevictable or not. In this case, try_to_unmap() will return SWAP_AGAIN. | ||
471 | |||
472 | try_to_unmap_file() -- linear mappings | ||
473 | |||
474 | Unmapping of a mapped file page works the same, except that the scan visits | ||
475 | all vmas that maps the page's index/page offset in the page's mapping's | ||
476 | reverse map priority search tree. It must also visit each vma in the page's | ||
477 | mapping's non-linear list, if the list is non-empty. As for anonymous pages, | ||
478 | on encountering a VM_LOCKED vma for a mapped file page, try_to_unmap() will | ||
479 | attempt to acquire the associated mm_struct's mmap semaphore to mlock the page, | ||
480 | returning SWAP_MLOCK if this is successful, and SWAP_AGAIN, if not. | ||
481 | |||
482 | try_to_unmap_file() -- non-linear mappings | ||
483 | |||
484 | If a page's mapping contains a non-empty non-linear mapping vma list, then | ||
485 | try_to_un{map|lock}() must also visit each vma in that list to determine | ||
486 | whether the page is mapped in a VM_LOCKED vma. Again, the scan must visit | ||
487 | all vmas in the non-linear list to ensure that the pages is not/should not be | ||
488 | mlocked. If a VM_LOCKED vma is found in the list, the scan could terminate. | ||
489 | However, there is no easy way to determine whether the page is actually mapped | ||
490 | in a given vma--either for unmapping or testing whether the VM_LOCKED vma | ||
491 | actually pins the page. | ||
492 | |||
493 | So, try_to_unmap_file() handles non-linear mappings by scanning a certain | ||
494 | number of pages--a "cluster"--in each non-linear vma associated with the page's | ||
495 | mapping, for each file mapped page that vmscan tries to unmap. If this happens | ||
496 | to unmap the page we're trying to unmap, try_to_unmap() will notice this on | ||
497 | return--(page_mapcount(page) == 0)--and return SWAP_SUCCESS. Otherwise, it | ||
498 | will return SWAP_AGAIN, causing vmscan to recirculate this page. We take | ||
499 | advantage of the cluster scan in try_to_unmap_cluster() as follows: | ||
500 | |||
501 | For each non-linear vma, try_to_unmap_cluster() attempts to acquire the mmap | ||
502 | semaphore of the associated mm_struct for read without blocking. If this | ||
503 | attempt is successful and the vma is VM_LOCKED, try_to_unmap_cluster() will | ||
504 | retain the mmap semaphore for the scan; otherwise it drops it here. Then, | ||
505 | for each page in the cluster, if we're holding the mmap semaphore for a locked | ||
506 | vma, try_to_unmap_cluster() calls mlock_vma_page() to mlock the page. This | ||
507 | call is a no-op if the page is already locked, but will mlock any pages in | ||
508 | the non-linear mapping that happen to be unlocked. If one of the pages so | ||
509 | mlocked is the page passed in to try_to_unmap(), try_to_unmap_cluster() will | ||
510 | return SWAP_MLOCK, rather than the default SWAP_AGAIN. This will allow vmscan | ||
511 | to cull the page, rather than recirculating it on the inactive list. Again, | ||
512 | if try_to_unmap_cluster() cannot acquire the vma's mmap sem, it returns | ||
513 | SWAP_AGAIN, indicating that the page is mapped by a VM_LOCKED vma, but | ||
514 | couldn't be mlocked. | ||
515 | |||
516 | |||
517 | Mlocked pages: try_to_munlock() Reverse Map Scan | ||
518 | |||
519 | TODO/FIXME: a better name might be page_mlocked()--analogous to the | ||
520 | page_referenced() reverse map walker--especially if we continue to call this | ||
521 | from shrink_page_list(). See related TODO/FIXME below. | ||
522 | |||
523 | When munlock_vma_page()--see "Mlocked Pages: munlock()/munlockall() System | ||
524 | Call Handling" above--tries to munlock a page, or when shrink_page_list() | ||
525 | encounters an anonymous page that is not yet in the swap cache, they need to | ||
526 | determine whether or not the page is mapped by any VM_LOCKED vma, without | ||
527 | actually attempting to unmap all ptes from the page. For this purpose, the | ||
528 | unevictable/mlock infrastructure introduced a variant of try_to_unmap() called | ||
529 | try_to_munlock(). | ||
530 | |||
531 | try_to_munlock() calls the same functions as try_to_unmap() for anonymous and | ||
532 | mapped file pages with an additional argument specifing unlock versus unmap | ||
533 | processing. Again, these functions walk the respective reverse maps looking | ||
534 | for VM_LOCKED vmas. When such a vma is found for anonymous pages and file | ||
535 | pages mapped in linear VMAs, as in the try_to_unmap() case, the functions | ||
536 | attempt to acquire the associated mmap semphore, mlock the page via | ||
537 | mlock_vma_page() and return SWAP_MLOCK. This effectively undoes the | ||
538 | pre-clearing of the page's PG_mlocked done by munlock_vma_page() and informs | ||
539 | shrink_page_list() that the anonymous page should be culled rather than added | ||
540 | to the swap cache in preparation for a try_to_unmap() that will almost | ||
541 | certainly fail. | ||
542 | |||
543 | If try_to_unmap() is unable to acquire a VM_LOCKED vma's associated mmap | ||
544 | semaphore, it will return SWAP_AGAIN. This will allow shrink_page_list() | ||
545 | to recycle the page on the inactive list and hope that it has better luck | ||
546 | with the page next time. | ||
547 | |||
548 | For file pages mapped into non-linear vmas, the try_to_munlock() logic works | ||
549 | slightly differently. On encountering a VM_LOCKED non-linear vma that might | ||
550 | map the page, try_to_munlock() returns SWAP_AGAIN without actually mlocking | ||
551 | the page. munlock_vma_page() will just leave the page unlocked and let | ||
552 | vmscan deal with it--the usual fallback position. | ||
553 | |||
554 | Note that try_to_munlock()'s reverse map walk must visit every vma in a pages' | ||
555 | reverse map to determine that a page is NOT mapped into any VM_LOCKED vma. | ||
556 | However, the scan can terminate when it encounters a VM_LOCKED vma and can | ||
557 | successfully acquire the vma's mmap semphore for read and mlock the page. | ||
558 | Although try_to_munlock() can be called many [very many!] times when | ||
559 | munlock()ing a large region or tearing down a large address space that has been | ||
560 | mlocked via mlockall(), overall this is a fairly rare event. In addition, | ||
561 | although shrink_page_list() calls try_to_munlock() for every anonymous page that | ||
562 | it handles that is not yet in the swap cache, on average anonymous pages will | ||
563 | have very short reverse map lists. | ||
564 | |||
565 | Mlocked Page: Page Reclaim in shrink_*_list() | ||
566 | |||
567 | shrink_active_list() culls any obviously unevictable pages--i.e., | ||
568 | !page_evictable(page, NULL)--diverting these to the unevictable lru | ||
569 | list. However, shrink_active_list() only sees unevictable pages that | ||
570 | made it onto the active/inactive lru lists. Note that these pages do not | ||
571 | have PageUnevictable set--otherwise, they would be on the unevictable list and | ||
572 | shrink_active_list would never see them. | ||
573 | |||
574 | Some examples of these unevictable pages on the LRU lists are: | ||
575 | |||
576 | 1) ramfs pages that have been placed on the lru lists when first allocated. | ||
577 | |||
578 | 2) SHM_LOCKed shared memory pages. shmctl(SHM_LOCK) does not attempt to | ||
579 | allocate or fault in the pages in the shared memory region. This happens | ||
580 | when an application accesses the page the first time after SHM_LOCKing | ||
581 | the segment. | ||
582 | |||
583 | 3) Mlocked pages that could not be isolated from the lru and moved to the | ||
584 | unevictable list in mlock_vma_page(). | ||
585 | |||
586 | 3) Pages mapped into multiple VM_LOCKED vmas, but try_to_munlock() couldn't | ||
587 | acquire the vma's mmap semaphore to test the flags and set PageMlocked. | ||
588 | munlock_vma_page() was forced to let the page back on to the normal | ||
589 | LRU list for vmscan to handle. | ||
590 | |||
591 | shrink_inactive_list() also culls any unevictable pages that it finds | ||
592 | on the inactive lists, again diverting them to the appropriate zone's unevictable | ||
593 | lru list. shrink_inactive_list() should only see SHM_LOCKed pages that became | ||
594 | SHM_LOCKed after shrink_active_list() had moved them to the inactive list, or | ||
595 | pages mapped into VM_LOCKED vmas that munlock_vma_page() couldn't isolate from | ||
596 | the lru to recheck via try_to_munlock(). shrink_inactive_list() won't notice | ||
597 | the latter, but will pass on to shrink_page_list(). | ||
598 | |||
599 | shrink_page_list() again culls obviously unevictable pages that it could | ||
600 | encounter for similar reason to shrink_inactive_list(). As already discussed, | ||
601 | shrink_page_list() proactively looks for anonymous pages that should have | ||
602 | PG_mlocked set but don't--these would not be detected by page_evictable()--to | ||
603 | avoid adding them to the swap cache unnecessarily. File pages mapped into | ||
604 | VM_LOCKED vmas but without PG_mlocked set will make it all the way to | ||
605 | try_to_unmap(). shrink_page_list() will divert them to the unevictable list when | ||
606 | try_to_unmap() returns SWAP_MLOCK, as discussed above. | ||
607 | |||
608 | TODO/FIXME: If we can enhance the swap cache to reliably remove entries | ||
609 | with page_count(page) > 2, as long as all ptes are mapped to the page and | ||
610 | not the swap entry, we can probably remove the call to try_to_munlock() in | ||
611 | shrink_page_list() and just remove the page from the swap cache when | ||
612 | try_to_unmap() returns SWAP_MLOCK. Currently, remove_exclusive_swap_page() | ||
613 | doesn't seem to allow that. | ||
614 | |||
615 | |||
diff --git a/Documentation/w1/00-INDEX b/Documentation/w1/00-INDEX index 5270cf4cb10..cb49802745d 100644 --- a/Documentation/w1/00-INDEX +++ b/Documentation/w1/00-INDEX | |||
@@ -1,5 +1,7 @@ | |||
1 | 00-INDEX | 1 | 00-INDEX |
2 | - This file | 2 | - This file |
3 | slaves/ | ||
4 | - Drivers that provide support for specific family codes. | ||
3 | masters/ | 5 | masters/ |
4 | - Individual chips providing 1-wire busses. | 6 | - Individual chips providing 1-wire busses. |
5 | w1.generic | 7 | w1.generic |
diff --git a/Documentation/w1/masters/ds2490 b/Documentation/w1/masters/ds2490 index 239f9ae0184..28176def3d6 100644 --- a/Documentation/w1/masters/ds2490 +++ b/Documentation/w1/masters/ds2490 | |||
@@ -16,3 +16,55 @@ which allows to build USB <-> W1 bridges. | |||
16 | DS9490(R) is a USB <-> W1 bus master device | 16 | DS9490(R) is a USB <-> W1 bus master device |
17 | which has 0x81 family ID integrated chip and DS2490 | 17 | which has 0x81 family ID integrated chip and DS2490 |
18 | low-level operational chip. | 18 | low-level operational chip. |
19 | |||
20 | Notes and limitations. | ||
21 | - The weak pullup current is a minimum of 0.9mA and maximum of 6.0mA. | ||
22 | - The 5V strong pullup is supported with a minimum of 5.9mA and a | ||
23 | maximum of 30.4 mA. (From DS2490.pdf) | ||
24 | - While the ds2490 supports a hardware search the code doesn't take | ||
25 | advantage of it (in tested case it only returned first device). | ||
26 | - The hardware will detect when devices are attached to the bus on the | ||
27 | next bus (reset?) operation, however only a message is printed as | ||
28 | the core w1 code doesn't make use of the information. Connecting | ||
29 | one device tends to give multiple new device notifications. | ||
30 | - The number of USB bus transactions could be reduced if w1_reset_send | ||
31 | was added to the API. The name is just a suggestion. It would take | ||
32 | a write buffer and a read buffer (along with sizes) as arguments. | ||
33 | The ds2490 block I/O command supports reset, write buffer, read | ||
34 | buffer, and strong pullup all in one command, instead of the current | ||
35 | 1 reset bus, 2 write the match rom command and slave rom id, 3 block | ||
36 | write and read data. The write buffer needs to have the match rom | ||
37 | command and slave rom id prepended to the front of the requested | ||
38 | write buffer, both of which are known to the driver. | ||
39 | - The hardware supports normal, flexible, and overdrive bus | ||
40 | communication speeds, but only the normal is supported. | ||
41 | - The registered w1_bus_master functions don't define error | ||
42 | conditions. If a bus search is in progress and the ds2490 is | ||
43 | removed it can produce a good amount of error output before the bus | ||
44 | search finishes. | ||
45 | - The hardware supports detecting some error conditions, such as | ||
46 | short, alarming presence on reset, and no presence on reset, but the | ||
47 | driver doesn't query those values. | ||
48 | - The ds2490 specification doesn't cover short bulk in reads in | ||
49 | detail, but my observation is if fewer bytes are requested than are | ||
50 | available, the bulk read will return an error and the hardware will | ||
51 | clear the entire bulk in buffer. It would be possible to read the | ||
52 | maximum buffer size to not run into this error condition, only extra | ||
53 | bytes in the buffer is a logic error in the driver. The code should | ||
54 | should match reads and writes as well as data sizes. Reads and | ||
55 | writes are serialized and the status verifies that the chip is idle | ||
56 | (and data is available) before the read is executed, so it should | ||
57 | not happen. | ||
58 | - Running x86_64 2.6.24 UHCI under qemu 0.9.0 under x86_64 2.6.22-rc6 | ||
59 | with a OHCI controller, ds2490 running in the guest would operate | ||
60 | normally the first time the module was loaded after qemu attached | ||
61 | the ds2490 hardware, but if the module was unloaded, then reloaded | ||
62 | most of the time one of the bulk out or in, and usually the bulk in | ||
63 | would fail. qemu sets a 50ms timeout and the bulk in would timeout | ||
64 | even when the status shows data available. A bulk out write would | ||
65 | show a successful completion, but the ds2490 status register would | ||
66 | show 0 bytes written. Detaching qemu from the ds2490 hardware and | ||
67 | reattaching would clear the problem. usbmon output in the guest and | ||
68 | host did not explain the problem. My guess is a bug in either qemu | ||
69 | or the host OS and more likely the host OS. | ||
70 | -- 03-06-2008 David Fries <David@Fries.net> | ||
diff --git a/Documentation/w1/slaves/00-INDEX b/Documentation/w1/slaves/00-INDEX new file mode 100644 index 00000000000..f8101d6b07b --- /dev/null +++ b/Documentation/w1/slaves/00-INDEX | |||
@@ -0,0 +1,4 @@ | |||
1 | 00-INDEX | ||
2 | - This file | ||
3 | w1_therm | ||
4 | - The Maxim/Dallas Semiconductor ds18*20 temperature sensor. | ||
diff --git a/Documentation/w1/slaves/w1_therm b/Documentation/w1/slaves/w1_therm new file mode 100644 index 00000000000..0403aaaba87 --- /dev/null +++ b/Documentation/w1/slaves/w1_therm | |||
@@ -0,0 +1,41 @@ | |||
1 | Kernel driver w1_therm | ||
2 | ==================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Maxim ds18*20 based temperature sensors. | ||
6 | |||
7 | Author: Evgeniy Polyakov <johnpol@2ka.mipt.ru> | ||
8 | |||
9 | |||
10 | Description | ||
11 | ----------- | ||
12 | |||
13 | w1_therm provides basic temperature conversion for ds18*20 devices. | ||
14 | supported family codes: | ||
15 | W1_THERM_DS18S20 0x10 | ||
16 | W1_THERM_DS1822 0x22 | ||
17 | W1_THERM_DS18B20 0x28 | ||
18 | |||
19 | Support is provided through the sysfs w1_slave file. Each open and | ||
20 | read sequence will initiate a temperature conversion then provide two | ||
21 | lines of ASCII output. The first line contains the nine hex bytes | ||
22 | read along with a calculated crc value and YES or NO if it matched. | ||
23 | If the crc matched the returned values are retained. The second line | ||
24 | displays the retained values along with a temperature in millidegrees | ||
25 | Centigrade after t=. | ||
26 | |||
27 | Parasite powered devices are limited to one slave performing a | ||
28 | temperature conversion at a time. If none of the devices are parasite | ||
29 | powered it would be possible to convert all the devices at the same | ||
30 | time and then go back to read individual sensors. That isn't | ||
31 | currently supported. The driver also doesn't support reduced | ||
32 | precision (which would also reduce the conversion time). | ||
33 | |||
34 | The module parameter strong_pullup can be set to 0 to disable the | ||
35 | strong pullup or 1 to enable. If enabled the 5V strong pullup will be | ||
36 | enabled when the conversion is taking place provided the master driver | ||
37 | must support the strong pullup (or it falls back to a pullup | ||
38 | resistor). The DS18b20 temperature sensor specification lists a | ||
39 | maximum current draw of 1.5mA and that a 5k pullup resistor is not | ||
40 | sufficient. The strong pullup is designed to provide the additional | ||
41 | current required. | ||
diff --git a/Documentation/w1/w1.generic b/Documentation/w1/w1.generic index 4c6509dd478..e3333eec432 100644 --- a/Documentation/w1/w1.generic +++ b/Documentation/w1/w1.generic | |||
@@ -79,10 +79,13 @@ w1 master sysfs interface | |||
79 | <xx-xxxxxxxxxxxxx> - a directory for a found device. The format is family-serial | 79 | <xx-xxxxxxxxxxxxx> - a directory for a found device. The format is family-serial |
80 | bus - (standard) symlink to the w1 bus | 80 | bus - (standard) symlink to the w1 bus |
81 | driver - (standard) symlink to the w1 driver | 81 | driver - (standard) symlink to the w1 driver |
82 | w1_master_add - Manually register a slave device | ||
82 | w1_master_attempts - the number of times a search was attempted | 83 | w1_master_attempts - the number of times a search was attempted |
83 | w1_master_max_slave_count | 84 | w1_master_max_slave_count |
84 | - the maximum slaves that may be attached to a master | 85 | - the maximum slaves that may be attached to a master |
85 | w1_master_name - the name of the device (w1_bus_masterX) | 86 | w1_master_name - the name of the device (w1_bus_masterX) |
87 | w1_master_pullup - 5V strong pullup 0 enabled, 1 disabled | ||
88 | w1_master_remove - Manually remove a slave device | ||
86 | w1_master_search - the number of searches left to do, -1=continual (default) | 89 | w1_master_search - the number of searches left to do, -1=continual (default) |
87 | w1_master_slave_count | 90 | w1_master_slave_count |
88 | - the number of slaves found | 91 | - the number of slaves found |
@@ -90,7 +93,13 @@ w1_master_slaves - the names of the slaves, one per line | |||
90 | w1_master_timeout - the delay in seconds between searches | 93 | w1_master_timeout - the delay in seconds between searches |
91 | 94 | ||
92 | If you have a w1 bus that never changes (you don't add or remove devices), | 95 | If you have a w1 bus that never changes (you don't add or remove devices), |
93 | you can set w1_master_search to a positive value to disable searches. | 96 | you can set the module parameter search_count to a small positive number |
97 | for an initially small number of bus searches. Alternatively it could be | ||
98 | set to zero, then manually add the slave device serial numbers by | ||
99 | w1_master_add device file. The w1_master_add and w1_master_remove files | ||
100 | generally only make sense when searching is disabled, as a search will | ||
101 | redetect manually removed devices that are present and timeout manually | ||
102 | added devices that aren't on the bus. | ||
94 | 103 | ||
95 | 104 | ||
96 | w1 slave sysfs interface | 105 | w1 slave sysfs interface |