diff options
Diffstat (limited to 'Documentation')
184 files changed, 7906 insertions, 1646 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index 06b982affe76..dd10b51b4e65 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX | |||
@@ -250,6 +250,8 @@ numastat.txt | |||
250 | - info on how to read Numa policy hit/miss statistics in sysfs. | 250 | - info on how to read Numa policy hit/miss statistics in sysfs. |
251 | oops-tracing.txt | 251 | oops-tracing.txt |
252 | - how to decode those nasty internal kernel error dump messages. | 252 | - how to decode those nasty internal kernel error dump messages. |
253 | padata.txt | ||
254 | - An introduction to the "padata" parallel execution API | ||
253 | parisc/ | 255 | parisc/ |
254 | - directory with info on using Linux on PA-RISC architecture. | 256 | - directory with info on using Linux on PA-RISC architecture. |
255 | parport.txt | 257 | parport.txt |
diff --git a/Documentation/ABI/obsolete/sysfs-bus-usb b/Documentation/ABI/obsolete/sysfs-bus-usb new file mode 100644 index 000000000000..bd096d33fbc7 --- /dev/null +++ b/Documentation/ABI/obsolete/sysfs-bus-usb | |||
@@ -0,0 +1,31 @@ | |||
1 | What: /sys/bus/usb/devices/.../power/level | ||
2 | Date: March 2007 | ||
3 | KernelVersion: 2.6.21 | ||
4 | Contact: Alan Stern <stern@rowland.harvard.edu> | ||
5 | Description: | ||
6 | Each USB device directory will contain a file named | ||
7 | power/level. This file holds a power-level setting for | ||
8 | the device, either "on" or "auto". | ||
9 | |||
10 | "on" means that the device is not allowed to autosuspend, | ||
11 | although normal suspends for system sleep will still | ||
12 | be honored. "auto" means the device will autosuspend | ||
13 | and autoresume in the usual manner, according to the | ||
14 | capabilities of its driver. | ||
15 | |||
16 | During normal use, devices should be left in the "auto" | ||
17 | level. The "on" level is meant for administrative uses. | ||
18 | If you want to suspend a device immediately but leave it | ||
19 | free to wake up in response to I/O requests, you should | ||
20 | write "0" to power/autosuspend. | ||
21 | |||
22 | Device not capable of proper suspend and resume should be | ||
23 | left in the "on" level. Although the USB spec requires | ||
24 | devices to support suspend/resume, many of them do not. | ||
25 | In fact so many don't that by default, the USB core | ||
26 | initializes all non-hub devices in the "on" level. Some | ||
27 | drivers may change this setting when they are bound. | ||
28 | |||
29 | This file is deprecated and will be removed after 2010. | ||
30 | Use the power/control file instead; it does exactly the | ||
31 | same thing. | ||
diff --git a/Documentation/ABI/obsolete/sysfs-class-rfkill b/Documentation/ABI/obsolete/sysfs-class-rfkill new file mode 100644 index 000000000000..4201d5b05515 --- /dev/null +++ b/Documentation/ABI/obsolete/sysfs-class-rfkill | |||
@@ -0,0 +1,29 @@ | |||
1 | rfkill - radio frequency (RF) connector kill switch support | ||
2 | |||
3 | For details to this subsystem look at Documentation/rfkill.txt. | ||
4 | |||
5 | What: /sys/class/rfkill/rfkill[0-9]+/state | ||
6 | Date: 09-Jul-2007 | ||
7 | KernelVersion v2.6.22 | ||
8 | Contact: linux-wireless@vger.kernel.org | ||
9 | Description: Current state of the transmitter. | ||
10 | This file is deprecated and sheduled to be removed in 2014, | ||
11 | because its not possible to express the 'soft and hard block' | ||
12 | state of the rfkill driver. | ||
13 | Values: A numeric value. | ||
14 | 0: RFKILL_STATE_SOFT_BLOCKED | ||
15 | transmitter is turned off by software | ||
16 | 1: RFKILL_STATE_UNBLOCKED | ||
17 | transmitter is (potentially) active | ||
18 | 2: RFKILL_STATE_HARD_BLOCKED | ||
19 | transmitter is forced off by something outside of | ||
20 | the driver's control. | ||
21 | |||
22 | What: /sys/class/rfkill/rfkill[0-9]+/claim | ||
23 | Date: 09-Jul-2007 | ||
24 | KernelVersion v2.6.22 | ||
25 | Contact: linux-wireless@vger.kernel.org | ||
26 | Description: This file is deprecated because there no longer is a way to | ||
27 | claim just control over a single rfkill instance. | ||
28 | This file is scheduled to be removed in 2012. | ||
29 | Values: 0: Kernel handles events | ||
diff --git a/Documentation/ABI/stable/sysfs-class-rfkill b/Documentation/ABI/stable/sysfs-class-rfkill new file mode 100644 index 000000000000..097f522c33bb --- /dev/null +++ b/Documentation/ABI/stable/sysfs-class-rfkill | |||
@@ -0,0 +1,67 @@ | |||
1 | rfkill - radio frequency (RF) connector kill switch support | ||
2 | |||
3 | For details to this subsystem look at Documentation/rfkill.txt. | ||
4 | |||
5 | For the deprecated /sys/class/rfkill/*/state and | ||
6 | /sys/class/rfkill/*/claim knobs of this interface look in | ||
7 | Documentation/ABI/obsolete/sysfs-class-rfkill. | ||
8 | |||
9 | What: /sys/class/rfkill | ||
10 | Date: 09-Jul-2007 | ||
11 | KernelVersion: v2.6.22 | ||
12 | Contact: linux-wireless@vger.kernel.org, | ||
13 | Description: The rfkill class subsystem folder. | ||
14 | Each registered rfkill driver is represented by an rfkillX | ||
15 | subfolder (X being an integer > 0). | ||
16 | |||
17 | |||
18 | What: /sys/class/rfkill/rfkill[0-9]+/name | ||
19 | Date: 09-Jul-2007 | ||
20 | KernelVersion v2.6.22 | ||
21 | Contact: linux-wireless@vger.kernel.org | ||
22 | Description: Name assigned by driver to this key (interface or driver name). | ||
23 | Values: arbitrary string. | ||
24 | |||
25 | |||
26 | What: /sys/class/rfkill/rfkill[0-9]+/type | ||
27 | Date: 09-Jul-2007 | ||
28 | KernelVersion v2.6.22 | ||
29 | Contact: linux-wireless@vger.kernel.org | ||
30 | Description: Driver type string ("wlan", "bluetooth", etc). | ||
31 | Values: See include/linux/rfkill.h. | ||
32 | |||
33 | |||
34 | What: /sys/class/rfkill/rfkill[0-9]+/persistent | ||
35 | Date: 09-Jul-2007 | ||
36 | KernelVersion v2.6.22 | ||
37 | Contact: linux-wireless@vger.kernel.org | ||
38 | Description: Whether the soft blocked state is initialised from non-volatile | ||
39 | storage at startup. | ||
40 | Values: A numeric value. | ||
41 | 0: false | ||
42 | 1: true | ||
43 | |||
44 | |||
45 | What: /sys/class/rfkill/rfkill[0-9]+/hard | ||
46 | Date: 12-March-2010 | ||
47 | KernelVersion v2.6.34 | ||
48 | Contact: linux-wireless@vger.kernel.org | ||
49 | Description: Current hardblock state. This file is read only. | ||
50 | Values: A numeric value. | ||
51 | 0: inactive | ||
52 | The transmitter is (potentially) active. | ||
53 | 1: active | ||
54 | The transmitter is forced off by something outside of | ||
55 | the driver's control. | ||
56 | |||
57 | |||
58 | What: /sys/class/rfkill/rfkill[0-9]+/soft | ||
59 | Date: 12-March-2010 | ||
60 | KernelVersion v2.6.34 | ||
61 | Contact: linux-wireless@vger.kernel.org | ||
62 | Description: Current softblock state. This file is read and write. | ||
63 | Values: A numeric value. | ||
64 | 0: inactive | ||
65 | The transmitter is (potentially) active. | ||
66 | 1: active | ||
67 | The transmitter is turned off by software. | ||
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci index 25be3250f7d6..428676cfa61e 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci +++ b/Documentation/ABI/testing/sysfs-bus-pci | |||
@@ -133,6 +133,46 @@ Description: | |||
133 | The symbolic link points to the PCI device sysfs entry of the | 133 | The symbolic link points to the PCI device sysfs entry of the |
134 | Physical Function this device associates with. | 134 | Physical Function this device associates with. |
135 | 135 | ||
136 | |||
137 | What: /sys/bus/pci/slots/... | ||
138 | Date: April 2005 (possibly older) | ||
139 | KernelVersion: 2.6.12 (possibly older) | ||
140 | Contact: linux-pci@vger.kernel.org | ||
141 | Description: | ||
142 | When the appropriate driver is loaded, it will create a | ||
143 | directory per claimed physical PCI slot in | ||
144 | /sys/bus/pci/slots/. The names of these directories are | ||
145 | specific to the driver, which in turn, are specific to the | ||
146 | platform, but in general, should match the label on the | ||
147 | machine's physical chassis. | ||
148 | |||
149 | The drivers that can create slot directories include the | ||
150 | PCI hotplug drivers, and as of 2.6.27, the pci_slot driver. | ||
151 | |||
152 | The slot directories contain, at a minimum, a file named | ||
153 | 'address' which contains the PCI bus:device:function tuple. | ||
154 | Other files may appear as well, but are specific to the | ||
155 | driver. | ||
156 | |||
157 | What: /sys/bus/pci/slots/.../function[0-7] | ||
158 | Date: March 2010 | ||
159 | KernelVersion: 2.6.35 | ||
160 | Contact: linux-pci@vger.kernel.org | ||
161 | Description: | ||
162 | If PCI slot directories (as described above) are created, | ||
163 | and the physical slot is actually populated with a device, | ||
164 | symbolic links in the slot directory pointing to the | ||
165 | device's PCI functions are created as well. | ||
166 | |||
167 | What: /sys/bus/pci/devices/.../slot | ||
168 | Date: March 2010 | ||
169 | KernelVersion: 2.6.35 | ||
170 | Contact: linux-pci@vger.kernel.org | ||
171 | Description: | ||
172 | If PCI slot directories (as described above) are created, | ||
173 | a symbolic link pointing to the slot directory will be | ||
174 | created as well. | ||
175 | |||
136 | What: /sys/bus/pci/slots/.../module | 176 | What: /sys/bus/pci/slots/.../module |
137 | Date: June 2009 | 177 | Date: June 2009 |
138 | Contact: linux-pci@vger.kernel.org | 178 | Contact: linux-pci@vger.kernel.org |
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb index bcebb9eaedce..294aa864a60a 100644 --- a/Documentation/ABI/testing/sysfs-bus-usb +++ b/Documentation/ABI/testing/sysfs-bus-usb | |||
@@ -14,34 +14,6 @@ Description: | |||
14 | The autosuspend delay for newly-created devices is set to | 14 | The autosuspend delay for newly-created devices is set to |
15 | the value of the usbcore.autosuspend module parameter. | 15 | the value of the usbcore.autosuspend module parameter. |
16 | 16 | ||
17 | What: /sys/bus/usb/devices/.../power/level | ||
18 | Date: March 2007 | ||
19 | KernelVersion: 2.6.21 | ||
20 | Contact: Alan Stern <stern@rowland.harvard.edu> | ||
21 | Description: | ||
22 | Each USB device directory will contain a file named | ||
23 | power/level. This file holds a power-level setting for | ||
24 | the device, either "on" or "auto". | ||
25 | |||
26 | "on" means that the device is not allowed to autosuspend, | ||
27 | although normal suspends for system sleep will still | ||
28 | be honored. "auto" means the device will autosuspend | ||
29 | and autoresume in the usual manner, according to the | ||
30 | capabilities of its driver. | ||
31 | |||
32 | During normal use, devices should be left in the "auto" | ||
33 | level. The "on" level is meant for administrative uses. | ||
34 | If you want to suspend a device immediately but leave it | ||
35 | free to wake up in response to I/O requests, you should | ||
36 | write "0" to power/autosuspend. | ||
37 | |||
38 | Device not capable of proper suspend and resume should be | ||
39 | left in the "on" level. Although the USB spec requires | ||
40 | devices to support suspend/resume, many of them do not. | ||
41 | In fact so many don't that by default, the USB core | ||
42 | initializes all non-hub devices in the "on" level. Some | ||
43 | drivers may change this setting when they are bound. | ||
44 | |||
45 | What: /sys/bus/usb/devices/.../power/persist | 17 | What: /sys/bus/usb/devices/.../power/persist |
46 | Date: May 2007 | 18 | Date: May 2007 |
47 | KernelVersion: 2.6.23 | 19 | KernelVersion: 2.6.23 |
diff --git a/Documentation/ABI/testing/sysfs-class-power b/Documentation/ABI/testing/sysfs-class-power new file mode 100644 index 000000000000..78c7baca3587 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-power | |||
@@ -0,0 +1,20 @@ | |||
1 | What: /sys/class/power/ds2760-battery.*/charge_now | ||
2 | Date: May 2010 | ||
3 | KernelVersion: 2.6.35 | ||
4 | Contact: Daniel Mack <daniel@caiaq.de> | ||
5 | Description: | ||
6 | This file is writeable and can be used to set the current | ||
7 | coloumb counter value inside the battery monitor chip. This | ||
8 | is needed for unavoidable corrections of aging batteries. | ||
9 | A userspace daemon can monitor the battery charging logic | ||
10 | and once the counter drops out of considerable bounds, take | ||
11 | appropriate action. | ||
12 | |||
13 | What: /sys/class/power/ds2760-battery.*/charge_full | ||
14 | Date: May 2010 | ||
15 | KernelVersion: 2.6.35 | ||
16 | Contact: Daniel Mack <daniel@caiaq.de> | ||
17 | Description: | ||
18 | This file is writeable and can be used to set the assumed | ||
19 | battery 'full level'. As batteries age, this value has to be | ||
20 | amended over time. | ||
diff --git a/Documentation/ABI/testing/sysfs-devices-memory b/Documentation/ABI/testing/sysfs-devices-memory index bf1627b02a03..aba7d989208c 100644 --- a/Documentation/ABI/testing/sysfs-devices-memory +++ b/Documentation/ABI/testing/sysfs-devices-memory | |||
@@ -43,7 +43,7 @@ Date: September 2008 | |||
43 | Contact: Badari Pulavarty <pbadari@us.ibm.com> | 43 | Contact: Badari Pulavarty <pbadari@us.ibm.com> |
44 | Description: | 44 | Description: |
45 | The file /sys/devices/system/memory/memoryX/state | 45 | The file /sys/devices/system/memory/memoryX/state |
46 | is read-write. When read, it's contents show the | 46 | is read-write. When read, its contents show the |
47 | online/offline state of the memory section. When written, | 47 | online/offline state of the memory section. When written, |
48 | root can toggle the the online/offline state of a removable | 48 | root can toggle the the online/offline state of a removable |
49 | memory section (see removable file description above) | 49 | memory section (see removable file description above) |
diff --git a/Documentation/ABI/testing/sysfs-devices-platform-_UDC_-gadget b/Documentation/ABI/testing/sysfs-devices-platform-_UDC_-gadget new file mode 100644 index 000000000000..34034027b13c --- /dev/null +++ b/Documentation/ABI/testing/sysfs-devices-platform-_UDC_-gadget | |||
@@ -0,0 +1,9 @@ | |||
1 | What: /sys/devices/platform/_UDC_/gadget/suspended | ||
2 | Date: April 2010 | ||
3 | Contact: Fabien Chouteau <fabien.chouteau@barco.com> | ||
4 | Description: | ||
5 | Show the suspend state of an USB composite gadget. | ||
6 | 1 -> suspended | ||
7 | 0 -> resumed | ||
8 | |||
9 | (_UDC_ is the name of the USB Device Controller driver) | ||
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-picolcd b/Documentation/ABI/testing/sysfs-driver-hid-picolcd new file mode 100644 index 000000000000..08579e7e1e89 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-driver-hid-picolcd | |||
@@ -0,0 +1,43 @@ | |||
1 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/operation_mode | ||
2 | Date: March 2010 | ||
3 | Contact: Bruno Prémont <bonbons@linux-vserver.org> | ||
4 | Description: Make it possible to switch the PicoLCD device between LCD | ||
5 | (firmware) and bootloader (flasher) operation modes. | ||
6 | |||
7 | Reading: returns list of available modes, the active mode being | ||
8 | enclosed in brackets ('[' and ']') | ||
9 | |||
10 | Writing: causes operation mode switch. Permitted values are | ||
11 | the non-active mode names listed when read. | ||
12 | |||
13 | Note: when switching mode the current PicoLCD HID device gets | ||
14 | disconnected and reconnects after above delay (see attribute | ||
15 | operation_mode_delay for its value). | ||
16 | |||
17 | |||
18 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/operation_mode_delay | ||
19 | Date: April 2010 | ||
20 | Contact: Bruno Prémont <bonbons@linux-vserver.org> | ||
21 | Description: Delay PicoLCD waits before restarting in new mode when | ||
22 | operation_mode has changed. | ||
23 | |||
24 | Reading/Writing: It is expressed in ms and permitted range is | ||
25 | 0..30000ms. | ||
26 | |||
27 | |||
28 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/fb_update_rate | ||
29 | Date: March 2010 | ||
30 | Contact: Bruno Prémont <bonbons@linux-vserver.org> | ||
31 | Description: Make it possible to adjust defio refresh rate. | ||
32 | |||
33 | Reading: returns list of available refresh rates (expressed in Hz), | ||
34 | the active refresh rate being enclosed in brackets ('[' and ']') | ||
35 | |||
36 | Writing: accepts new refresh rate expressed in integer Hz | ||
37 | within permitted rates. | ||
38 | |||
39 | Note: As device can barely do 2 complete refreshes a second | ||
40 | it only makes sense to adjust this value if only one or two | ||
41 | tiles get changed and it's not appropriate to expect the application | ||
42 | to flush it's tiny changes explicitely at higher than default rate. | ||
43 | |||
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-prodikeys b/Documentation/ABI/testing/sysfs-driver-hid-prodikeys new file mode 100644 index 000000000000..05d988c29a83 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-driver-hid-prodikeys | |||
@@ -0,0 +1,29 @@ | |||
1 | What: /sys/bus/hid/drivers/prodikeys/.../channel | ||
2 | Date: April 2010 | ||
3 | KernelVersion: 2.6.34 | ||
4 | Contact: Don Prince <dhprince.devel@yahoo.co.uk> | ||
5 | Description: | ||
6 | Allows control (via software) the midi channel to which | ||
7 | that the pc-midi keyboard will output.midi data. | ||
8 | Range: 0..15 | ||
9 | Type: Read/write | ||
10 | What: /sys/bus/hid/drivers/prodikeys/.../sustain | ||
11 | Date: April 2010 | ||
12 | KernelVersion: 2.6.34 | ||
13 | Contact: Don Prince <dhprince.devel@yahoo.co.uk> | ||
14 | Description: | ||
15 | Allows control (via software) the sustain duration of a | ||
16 | note held by the pc-midi driver. | ||
17 | 0 means sustain mode is disabled. | ||
18 | Range: 0..5000 (milliseconds) | ||
19 | Type: Read/write | ||
20 | What: /sys/bus/hid/drivers/prodikeys/.../octave | ||
21 | Date: April 2010 | ||
22 | KernelVersion: 2.6.34 | ||
23 | Contact: Don Prince <dhprince.devel@yahoo.co.uk> | ||
24 | Description: | ||
25 | Controls the octave shift modifier in the pc-midi driver. | ||
26 | The octave can be shifted via software up/down 2 octaves. | ||
27 | 0 means the no ocatve shift. | ||
28 | Range: -2..2 (minus 2 to plus 2) | ||
29 | Type: Read/Write | ||
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-roccat-kone b/Documentation/ABI/testing/sysfs-driver-hid-roccat-kone new file mode 100644 index 000000000000..88340a23ce91 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-driver-hid-roccat-kone | |||
@@ -0,0 +1,111 @@ | |||
1 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/actual_dpi | ||
2 | Date: March 2010 | ||
3 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | ||
4 | Description: It is possible to switch the dpi setting of the mouse with the | ||
5 | press of a button. | ||
6 | When read, this file returns the raw number of the actual dpi | ||
7 | setting reported by the mouse. This number has to be further | ||
8 | processed to receive the real dpi value. | ||
9 | |||
10 | VALUE DPI | ||
11 | 1 800 | ||
12 | 2 1200 | ||
13 | 3 1600 | ||
14 | 4 2000 | ||
15 | 5 2400 | ||
16 | 6 3200 | ||
17 | |||
18 | This file is readonly. | ||
19 | |||
20 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/actual_profile | ||
21 | Date: March 2010 | ||
22 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | ||
23 | Description: When read, this file returns the number of the actual profile. | ||
24 | This file is readonly. | ||
25 | |||
26 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/firmware_version | ||
27 | Date: March 2010 | ||
28 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | ||
29 | Description: When read, this file returns the raw integer version number of the | ||
30 | firmware reported by the mouse. Using the integer value eases | ||
31 | further usage in other programs. To receive the real version | ||
32 | number the decimal point has to be shifted 2 positions to the | ||
33 | left. E.g. a returned value of 138 means 1.38 | ||
34 | This file is readonly. | ||
35 | |||
36 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/kone_driver_version | ||
37 | Date: March 2010 | ||
38 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | ||
39 | Description: When read, this file returns the driver version. | ||
40 | The format of the string is "v<major>.<minor>.<patchlevel>". | ||
41 | This attribute is used by the userland tools to find the sysfs- | ||
42 | paths of installed kone-mice and determine the capabilites of | ||
43 | the driver. Versions of this driver for old kernels replace | ||
44 | usbhid instead of generic-usb. The way to scan for this file | ||
45 | has been chosen to provide a consistent way for all supported | ||
46 | kernel versions. | ||
47 | This file is readonly. | ||
48 | |||
49 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/profile[1-5] | ||
50 | Date: March 2010 | ||
51 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | ||
52 | Description: The mouse can store 5 profiles which can be switched by the | ||
53 | press of a button. A profile holds informations like button | ||
54 | mappings, sensitivity, the colors of the 5 leds and light | ||
55 | effects. | ||
56 | When read, these files return the respective profile. The | ||
57 | returned data is 975 bytes in size. | ||
58 | When written, this file lets one write the respective profile | ||
59 | data back to the mouse. The data has to be 975 bytes long. | ||
60 | The mouse will reject invalid data, whereas the profile number | ||
61 | stored in the profile doesn't need to fit the number of the | ||
62 | store. | ||
63 | |||
64 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/settings | ||
65 | Date: March 2010 | ||
66 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | ||
67 | Description: When read, this file returns the settings stored in the mouse. | ||
68 | The size of the data is 36 bytes and holds information like the | ||
69 | startup_profile, tcu state and calibration_data. | ||
70 | When written, this file lets write settings back to the mouse. | ||
71 | The data has to be 36 bytes long. The mouse will reject invalid | ||
72 | data. | ||
73 | |||
74 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/startup_profile | ||
75 | Date: March 2010 | ||
76 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | ||
77 | Description: The integer value of this attribute ranges from 1 to 5. | ||
78 | When read, this attribute returns the number of the profile | ||
79 | that's active when the mouse is powered on. | ||
80 | When written, this file sets the number of the startup profile | ||
81 | and the mouse activates this profile immediately. | ||
82 | |||
83 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/tcu | ||
84 | Date: March 2010 | ||
85 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | ||
86 | Description: The mouse has a "Tracking Control Unit" which lets the user | ||
87 | calibrate the laser power to fit the mousepad surface. | ||
88 | When read, this file returns the current state of the TCU, | ||
89 | where 0 means off and 1 means on. | ||
90 | Writing 0 in this file will switch the TCU off. | ||
91 | Writing 1 in this file will start the calibration which takes | ||
92 | around 6 seconds to complete and activates the TCU. | ||
93 | |||
94 | What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/weight | ||
95 | Date: March 2010 | ||
96 | Contact: Stefan Achatz <erazor_de@users.sourceforge.net> | ||
97 | Description: The mouse can be equipped with one of four supplied weights | ||
98 | ranging from 5 to 20 grams which are recognized by the mouse | ||
99 | and its value can be read out. When read, this file returns the | ||
100 | raw value returned by the mouse which eases further processing | ||
101 | in other software. | ||
102 | The values map to the weights as follows: | ||
103 | |||
104 | VALUE WEIGHT | ||
105 | 0 none | ||
106 | 1 5g | ||
107 | 2 10g | ||
108 | 3 15g | ||
109 | 4 20g | ||
110 | |||
111 | This file is readonly. | ||
diff --git a/Documentation/ABI/testing/sysfs-wacom b/Documentation/ABI/testing/sysfs-wacom new file mode 100644 index 000000000000..1517976e25c4 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-wacom | |||
@@ -0,0 +1,10 @@ | |||
1 | What: /sys/class/hidraw/hidraw*/device/speed | ||
2 | Date: April 2010 | ||
3 | Kernel Version: 2.6.35 | ||
4 | Contact: linux-bluetooth@vger.kernel.org | ||
5 | Description: | ||
6 | The /sys/class/hidraw/hidraw*/device/speed file controls | ||
7 | reporting speed of wacom bluetooth tablet. Reading from | ||
8 | this file returns 1 if tablet reports in high speed mode | ||
9 | or 0 otherwise. Writing to this file one of these values | ||
10 | switches reporting speed. | ||
diff --git a/Documentation/Changes b/Documentation/Changes index f08b313cd235..eca9f6e6fbe6 100644 --- a/Documentation/Changes +++ b/Documentation/Changes | |||
@@ -49,7 +49,7 @@ o oprofile 0.9 # oprofiled --version | |||
49 | o udev 081 # udevinfo -V | 49 | o udev 081 # udevinfo -V |
50 | o grub 0.93 # grub --version | 50 | o grub 0.93 # grub --version |
51 | o mcelog 0.6 | 51 | o mcelog 0.6 |
52 | o iptables 1.4.1 # iptables -V | 52 | o iptables 1.4.2 # iptables -V |
53 | 53 | ||
54 | 54 | ||
55 | Kernel compilation | 55 | Kernel compilation |
diff --git a/Documentation/DMA-API-HOWTO.txt b/Documentation/DMA-API-HOWTO.txt index 52618ab069ad..2e435adfbd6b 100644 --- a/Documentation/DMA-API-HOWTO.txt +++ b/Documentation/DMA-API-HOWTO.txt | |||
@@ -742,7 +742,7 @@ failure can be determined by: | |||
742 | 742 | ||
743 | Closing | 743 | Closing |
744 | 744 | ||
745 | This document, and the API itself, would not be in it's current | 745 | This document, and the API itself, would not be in its current |
746 | form without the feedback and suggestions from numerous individuals. | 746 | form without the feedback and suggestions from numerous individuals. |
747 | We would like to specifically mention, in no particular order, the | 747 | We would like to specifically mention, in no particular order, the |
748 | following people: | 748 | following people: |
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 325cfd1d6d99..c7e5dc7e8cb3 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
@@ -14,7 +14,7 @@ DOCBOOKS := z8530book.xml mcabook.xml device-drivers.xml \ | |||
14 | genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \ | 14 | genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \ |
15 | mac80211.xml debugobjects.xml sh.xml regulator.xml \ | 15 | mac80211.xml debugobjects.xml sh.xml regulator.xml \ |
16 | alsa-driver-api.xml writing-an-alsa-driver.xml \ | 16 | alsa-driver-api.xml writing-an-alsa-driver.xml \ |
17 | tracepoint.xml media.xml | 17 | tracepoint.xml media.xml drm.xml |
18 | 18 | ||
19 | ### | 19 | ### |
20 | # The build process is as follows (targets): | 20 | # The build process is as follows (targets): |
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl new file mode 100644 index 000000000000..7583dc7cf64d --- /dev/null +++ b/Documentation/DocBook/drm.tmpl | |||
@@ -0,0 +1,839 @@ | |||
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="drmDevelopersGuide"> | ||
6 | <bookinfo> | ||
7 | <title>Linux DRM Developer's Guide</title> | ||
8 | |||
9 | <copyright> | ||
10 | <year>2008-2009</year> | ||
11 | <holder> | ||
12 | Intel Corporation (Jesse Barnes <jesse.barnes@intel.com>) | ||
13 | </holder> | ||
14 | </copyright> | ||
15 | |||
16 | <legalnotice> | ||
17 | <para> | ||
18 | The contents of this file may be used under the terms of the GNU | ||
19 | General Public License version 2 (the "GPL") as distributed in | ||
20 | the kernel source COPYING file. | ||
21 | </para> | ||
22 | </legalnotice> | ||
23 | </bookinfo> | ||
24 | |||
25 | <toc></toc> | ||
26 | |||
27 | <!-- Introduction --> | ||
28 | |||
29 | <chapter id="drmIntroduction"> | ||
30 | <title>Introduction</title> | ||
31 | <para> | ||
32 | The Linux DRM layer contains code intended to support the needs | ||
33 | of complex graphics devices, usually containing programmable | ||
34 | pipelines well suited to 3D graphics acceleration. Graphics | ||
35 | drivers in the kernel can make use of DRM functions to make | ||
36 | tasks like memory management, interrupt handling and DMA easier, | ||
37 | and provide a uniform interface to applications. | ||
38 | </para> | ||
39 | <para> | ||
40 | A note on versions: this guide covers features found in the DRM | ||
41 | tree, including the TTM memory manager, output configuration and | ||
42 | mode setting, and the new vblank internals, in addition to all | ||
43 | the regular features found in current kernels. | ||
44 | </para> | ||
45 | <para> | ||
46 | [Insert diagram of typical DRM stack here] | ||
47 | </para> | ||
48 | </chapter> | ||
49 | |||
50 | <!-- Internals --> | ||
51 | |||
52 | <chapter id="drmInternals"> | ||
53 | <title>DRM Internals</title> | ||
54 | <para> | ||
55 | This chapter documents DRM internals relevant to driver authors | ||
56 | and developers working to add support for the latest features to | ||
57 | existing drivers. | ||
58 | </para> | ||
59 | <para> | ||
60 | First, we'll go over some typical driver initialization | ||
61 | requirements, like setting up command buffers, creating an | ||
62 | initial output configuration, and initializing core services. | ||
63 | Subsequent sections will cover core internals in more detail, | ||
64 | providing implementation notes and examples. | ||
65 | </para> | ||
66 | <para> | ||
67 | The DRM layer provides several services to graphics drivers, | ||
68 | many of them driven by the application interfaces it provides | ||
69 | through libdrm, the library that wraps most of the DRM ioctls. | ||
70 | These include vblank event handling, memory | ||
71 | management, output management, framebuffer management, command | ||
72 | submission & fencing, suspend/resume support, and DMA | ||
73 | services. | ||
74 | </para> | ||
75 | <para> | ||
76 | The core of every DRM driver is struct drm_device. Drivers | ||
77 | will typically statically initialize a drm_device structure, | ||
78 | then pass it to drm_init() at load time. | ||
79 | </para> | ||
80 | |||
81 | <!-- Internals: driver init --> | ||
82 | |||
83 | <sect1> | ||
84 | <title>Driver initialization</title> | ||
85 | <para> | ||
86 | Before calling the DRM initialization routines, the driver must | ||
87 | first create and fill out a struct drm_device structure. | ||
88 | </para> | ||
89 | <programlisting> | ||
90 | static struct drm_driver driver = { | ||
91 | /* don't use mtrr's here, the Xserver or user space app should | ||
92 | * deal with them for intel hardware. | ||
93 | */ | ||
94 | .driver_features = | ||
95 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | | ||
96 | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_MODESET, | ||
97 | .load = i915_driver_load, | ||
98 | .unload = i915_driver_unload, | ||
99 | .firstopen = i915_driver_firstopen, | ||
100 | .lastclose = i915_driver_lastclose, | ||
101 | .preclose = i915_driver_preclose, | ||
102 | .save = i915_save, | ||
103 | .restore = i915_restore, | ||
104 | .device_is_agp = i915_driver_device_is_agp, | ||
105 | .get_vblank_counter = i915_get_vblank_counter, | ||
106 | .enable_vblank = i915_enable_vblank, | ||
107 | .disable_vblank = i915_disable_vblank, | ||
108 | .irq_preinstall = i915_driver_irq_preinstall, | ||
109 | .irq_postinstall = i915_driver_irq_postinstall, | ||
110 | .irq_uninstall = i915_driver_irq_uninstall, | ||
111 | .irq_handler = i915_driver_irq_handler, | ||
112 | .reclaim_buffers = drm_core_reclaim_buffers, | ||
113 | .get_map_ofs = drm_core_get_map_ofs, | ||
114 | .get_reg_ofs = drm_core_get_reg_ofs, | ||
115 | .fb_probe = intelfb_probe, | ||
116 | .fb_remove = intelfb_remove, | ||
117 | .fb_resize = intelfb_resize, | ||
118 | .master_create = i915_master_create, | ||
119 | .master_destroy = i915_master_destroy, | ||
120 | #if defined(CONFIG_DEBUG_FS) | ||
121 | .debugfs_init = i915_debugfs_init, | ||
122 | .debugfs_cleanup = i915_debugfs_cleanup, | ||
123 | #endif | ||
124 | .gem_init_object = i915_gem_init_object, | ||
125 | .gem_free_object = i915_gem_free_object, | ||
126 | .gem_vm_ops = &i915_gem_vm_ops, | ||
127 | .ioctls = i915_ioctls, | ||
128 | .fops = { | ||
129 | .owner = THIS_MODULE, | ||
130 | .open = drm_open, | ||
131 | .release = drm_release, | ||
132 | .ioctl = drm_ioctl, | ||
133 | .mmap = drm_mmap, | ||
134 | .poll = drm_poll, | ||
135 | .fasync = drm_fasync, | ||
136 | #ifdef CONFIG_COMPAT | ||
137 | .compat_ioctl = i915_compat_ioctl, | ||
138 | #endif | ||
139 | }, | ||
140 | .pci_driver = { | ||
141 | .name = DRIVER_NAME, | ||
142 | .id_table = pciidlist, | ||
143 | .probe = probe, | ||
144 | .remove = __devexit_p(drm_cleanup_pci), | ||
145 | }, | ||
146 | .name = DRIVER_NAME, | ||
147 | .desc = DRIVER_DESC, | ||
148 | .date = DRIVER_DATE, | ||
149 | .major = DRIVER_MAJOR, | ||
150 | .minor = DRIVER_MINOR, | ||
151 | .patchlevel = DRIVER_PATCHLEVEL, | ||
152 | }; | ||
153 | </programlisting> | ||
154 | <para> | ||
155 | In the example above, taken from the i915 DRM driver, the driver | ||
156 | sets several flags indicating what core features it supports. | ||
157 | We'll go over the individual callbacks in later sections. Since | ||
158 | flags indicate which features your driver supports to the DRM | ||
159 | core, you need to set most of them prior to calling drm_init(). Some, | ||
160 | like DRIVER_MODESET can be set later based on user supplied parameters, | ||
161 | but that's the exception rather than the rule. | ||
162 | </para> | ||
163 | <variablelist> | ||
164 | <title>Driver flags</title> | ||
165 | <varlistentry> | ||
166 | <term>DRIVER_USE_AGP</term> | ||
167 | <listitem><para> | ||
168 | Driver uses AGP interface | ||
169 | </para></listitem> | ||
170 | </varlistentry> | ||
171 | <varlistentry> | ||
172 | <term>DRIVER_REQUIRE_AGP</term> | ||
173 | <listitem><para> | ||
174 | Driver needs AGP interface to function. | ||
175 | </para></listitem> | ||
176 | </varlistentry> | ||
177 | <varlistentry> | ||
178 | <term>DRIVER_USE_MTRR</term> | ||
179 | <listitem> | ||
180 | <para> | ||
181 | Driver uses MTRR interface for mapping memory. Deprecated. | ||
182 | </para> | ||
183 | </listitem> | ||
184 | </varlistentry> | ||
185 | <varlistentry> | ||
186 | <term>DRIVER_PCI_DMA</term> | ||
187 | <listitem><para> | ||
188 | Driver is capable of PCI DMA. Deprecated. | ||
189 | </para></listitem> | ||
190 | </varlistentry> | ||
191 | <varlistentry> | ||
192 | <term>DRIVER_SG</term> | ||
193 | <listitem><para> | ||
194 | Driver can perform scatter/gather DMA. Deprecated. | ||
195 | </para></listitem> | ||
196 | </varlistentry> | ||
197 | <varlistentry> | ||
198 | <term>DRIVER_HAVE_DMA</term> | ||
199 | <listitem><para>Driver supports DMA. Deprecated.</para></listitem> | ||
200 | </varlistentry> | ||
201 | <varlistentry> | ||
202 | <term>DRIVER_HAVE_IRQ</term><term>DRIVER_IRQ_SHARED</term> | ||
203 | <listitem> | ||
204 | <para> | ||
205 | DRIVER_HAVE_IRQ indicates whether the driver has a IRQ | ||
206 | handler, DRIVER_IRQ_SHARED indicates whether the device & | ||
207 | handler support shared IRQs (note that this is required of | ||
208 | PCI drivers). | ||
209 | </para> | ||
210 | </listitem> | ||
211 | </varlistentry> | ||
212 | <varlistentry> | ||
213 | <term>DRIVER_DMA_QUEUE</term> | ||
214 | <listitem> | ||
215 | <para> | ||
216 | If the driver queues DMA requests and completes them | ||
217 | asynchronously, this flag should be set. Deprecated. | ||
218 | </para> | ||
219 | </listitem> | ||
220 | </varlistentry> | ||
221 | <varlistentry> | ||
222 | <term>DRIVER_FB_DMA</term> | ||
223 | <listitem> | ||
224 | <para> | ||
225 | Driver supports DMA to/from the framebuffer. Deprecated. | ||
226 | </para> | ||
227 | </listitem> | ||
228 | </varlistentry> | ||
229 | <varlistentry> | ||
230 | <term>DRIVER_MODESET</term> | ||
231 | <listitem> | ||
232 | <para> | ||
233 | Driver supports mode setting interfaces. | ||
234 | </para> | ||
235 | </listitem> | ||
236 | </varlistentry> | ||
237 | </variablelist> | ||
238 | <para> | ||
239 | In this specific case, the driver requires AGP and supports | ||
240 | IRQs. DMA, as we'll see, is handled by device specific ioctls | ||
241 | in this case. It also supports the kernel mode setting APIs, though | ||
242 | unlike in the actual i915 driver source, this example unconditionally | ||
243 | exports KMS capability. | ||
244 | </para> | ||
245 | </sect1> | ||
246 | |||
247 | <!-- Internals: driver load --> | ||
248 | |||
249 | <sect1> | ||
250 | <title>Driver load</title> | ||
251 | <para> | ||
252 | In the previous section, we saw what a typical drm_driver | ||
253 | structure might look like. One of the more important fields in | ||
254 | the structure is the hook for the load function. | ||
255 | </para> | ||
256 | <programlisting> | ||
257 | static struct drm_driver driver = { | ||
258 | ... | ||
259 | .load = i915_driver_load, | ||
260 | ... | ||
261 | }; | ||
262 | </programlisting> | ||
263 | <para> | ||
264 | The load function has many responsibilities: allocating a driver | ||
265 | private structure, specifying supported performance counters, | ||
266 | configuring the device (e.g. mapping registers & command | ||
267 | buffers), initializing the memory manager, and setting up the | ||
268 | initial output configuration. | ||
269 | </para> | ||
270 | <para> | ||
271 | Note that the tasks performed at driver load time must not | ||
272 | conflict with DRM client requirements. For instance, if user | ||
273 | level mode setting drivers are in use, it would be problematic | ||
274 | to perform output discovery & configuration at load time. | ||
275 | Likewise, if pre-memory management aware user level drivers are | ||
276 | in use, memory management and command buffer setup may need to | ||
277 | be omitted. These requirements are driver specific, and care | ||
278 | needs to be taken to keep both old and new applications and | ||
279 | libraries working. The i915 driver supports the "modeset" | ||
280 | module parameter to control whether advanced features are | ||
281 | enabled at load time or in legacy fashion. If compatibility is | ||
282 | a concern (e.g. with drivers converted over to the new interfaces | ||
283 | from the old ones), care must be taken to prevent incompatible | ||
284 | device initialization and control with the currently active | ||
285 | userspace drivers. | ||
286 | </para> | ||
287 | |||
288 | <sect2> | ||
289 | <title>Driver private & performance counters</title> | ||
290 | <para> | ||
291 | The driver private hangs off the main drm_device structure and | ||
292 | can be used for tracking various device specific bits of | ||
293 | information, like register offsets, command buffer status, | ||
294 | register state for suspend/resume, etc. At load time, a | ||
295 | driver can simply allocate one and set drm_device.dev_priv | ||
296 | appropriately; at unload the driver can free it and set | ||
297 | drm_device.dev_priv to NULL. | ||
298 | </para> | ||
299 | <para> | ||
300 | The DRM supports several counters which can be used for rough | ||
301 | performance characterization. Note that the DRM stat counter | ||
302 | system is not often used by applications, and supporting | ||
303 | additional counters is completely optional. | ||
304 | </para> | ||
305 | <para> | ||
306 | These interfaces are deprecated and should not be used. If performance | ||
307 | monitoring is desired, the developer should investigate and | ||
308 | potentially enhance the kernel perf and tracing infrastructure to export | ||
309 | GPU related performance information to performance monitoring | ||
310 | tools and applications. | ||
311 | </para> | ||
312 | </sect2> | ||
313 | |||
314 | <sect2> | ||
315 | <title>Configuring the device</title> | ||
316 | <para> | ||
317 | Obviously, device configuration will be device specific. | ||
318 | However, there are several common operations: finding a | ||
319 | device's PCI resources, mapping them, and potentially setting | ||
320 | up an IRQ handler. | ||
321 | </para> | ||
322 | <para> | ||
323 | Finding & mapping resources is fairly straightforward. The | ||
324 | DRM wrapper functions, drm_get_resource_start() and | ||
325 | drm_get_resource_len() can be used to find BARs on the given | ||
326 | drm_device struct. Once those values have been retrieved, the | ||
327 | driver load function can call drm_addmap() to create a new | ||
328 | mapping for the BAR in question. Note you'll probably want a | ||
329 | drm_local_map_t in your driver private structure to track any | ||
330 | mappings you create. | ||
331 | <!-- !Fdrivers/gpu/drm/drm_bufs.c drm_get_resource_* --> | ||
332 | <!-- !Finclude/drm/drmP.h drm_local_map_t --> | ||
333 | </para> | ||
334 | <para> | ||
335 | if compatibility with other operating systems isn't a concern | ||
336 | (DRM drivers can run under various BSD variants and OpenSolaris), | ||
337 | native Linux calls can be used for the above, e.g. pci_resource_* | ||
338 | and iomap*/iounmap. See the Linux device driver book for more | ||
339 | info. | ||
340 | </para> | ||
341 | <para> | ||
342 | Once you have a register map, you can use the DRM_READn() and | ||
343 | DRM_WRITEn() macros to access the registers on your device, or | ||
344 | use driver specific versions to offset into your MMIO space | ||
345 | relative to a driver specific base pointer (see I915_READ for | ||
346 | example). | ||
347 | </para> | ||
348 | <para> | ||
349 | If your device supports interrupt generation, you may want to | ||
350 | setup an interrupt handler at driver load time as well. This | ||
351 | is done using the drm_irq_install() function. If your device | ||
352 | supports vertical blank interrupts, it should call | ||
353 | drm_vblank_init() to initialize the core vblank handling code before | ||
354 | enabling interrupts on your device. This ensures the vblank related | ||
355 | structures are allocated and allows the core to handle vblank events. | ||
356 | </para> | ||
357 | <!--!Fdrivers/char/drm/drm_irq.c drm_irq_install--> | ||
358 | <para> | ||
359 | Once your interrupt handler is registered (it'll use your | ||
360 | drm_driver.irq_handler as the actual interrupt handling | ||
361 | function), you can safely enable interrupts on your device, | ||
362 | assuming any other state your interrupt handler uses is also | ||
363 | initialized. | ||
364 | </para> | ||
365 | <para> | ||
366 | Another task that may be necessary during configuration is | ||
367 | mapping the video BIOS. On many devices, the VBIOS describes | ||
368 | device configuration, LCD panel timings (if any), and contains | ||
369 | flags indicating device state. Mapping the BIOS can be done | ||
370 | using the pci_map_rom() call, a convenience function that | ||
371 | takes care of mapping the actual ROM, whether it has been | ||
372 | shadowed into memory (typically at address 0xc0000) or exists | ||
373 | on the PCI device in the ROM BAR. Note that once you've | ||
374 | mapped the ROM and extracted any necessary information, be | ||
375 | sure to unmap it; on many devices the ROM address decoder is | ||
376 | shared with other BARs, so leaving it mapped can cause | ||
377 | undesired behavior like hangs or memory corruption. | ||
378 | <!--!Fdrivers/pci/rom.c pci_map_rom--> | ||
379 | </para> | ||
380 | </sect2> | ||
381 | |||
382 | <sect2> | ||
383 | <title>Memory manager initialization</title> | ||
384 | <para> | ||
385 | In order to allocate command buffers, cursor memory, scanout | ||
386 | buffers, etc., as well as support the latest features provided | ||
387 | by packages like Mesa and the X.Org X server, your driver | ||
388 | should support a memory manager. | ||
389 | </para> | ||
390 | <para> | ||
391 | If your driver supports memory management (it should!), you'll | ||
392 | need to set that up at load time as well. How you intialize | ||
393 | it depends on which memory manager you're using, TTM or GEM. | ||
394 | </para> | ||
395 | <sect3> | ||
396 | <title>TTM initialization</title> | ||
397 | <para> | ||
398 | TTM (for Translation Table Manager) manages video memory and | ||
399 | aperture space for graphics devices. TTM supports both UMA devices | ||
400 | and devices with dedicated video RAM (VRAM), i.e. most discrete | ||
401 | graphics devices. If your device has dedicated RAM, supporting | ||
402 | TTM is desireable. TTM also integrates tightly with your | ||
403 | driver specific buffer execution function. See the radeon | ||
404 | driver for examples. | ||
405 | </para> | ||
406 | <para> | ||
407 | The core TTM structure is the ttm_bo_driver struct. It contains | ||
408 | several fields with function pointers for initializing the TTM, | ||
409 | allocating and freeing memory, waiting for command completion | ||
410 | and fence synchronization, and memory migration. See the | ||
411 | radeon_ttm.c file for an example of usage. | ||
412 | </para> | ||
413 | <para> | ||
414 | The ttm_global_reference structure is made up of several fields: | ||
415 | </para> | ||
416 | <programlisting> | ||
417 | struct ttm_global_reference { | ||
418 | enum ttm_global_types global_type; | ||
419 | size_t size; | ||
420 | void *object; | ||
421 | int (*init) (struct ttm_global_reference *); | ||
422 | void (*release) (struct ttm_global_reference *); | ||
423 | }; | ||
424 | </programlisting> | ||
425 | <para> | ||
426 | There should be one global reference structure for your memory | ||
427 | manager as a whole, and there will be others for each object | ||
428 | created by the memory manager at runtime. Your global TTM should | ||
429 | have a type of TTM_GLOBAL_TTM_MEM. The size field for the global | ||
430 | object should be sizeof(struct ttm_mem_global), and the init and | ||
431 | release hooks should point at your driver specific init and | ||
432 | release routines, which will probably eventually call | ||
433 | ttm_mem_global_init and ttm_mem_global_release respectively. | ||
434 | </para> | ||
435 | <para> | ||
436 | Once your global TTM accounting structure is set up and initialized | ||
437 | (done by calling ttm_global_item_ref on the global object you | ||
438 | just created), you'll need to create a buffer object TTM to | ||
439 | provide a pool for buffer object allocation by clients and the | ||
440 | kernel itself. The type of this object should be TTM_GLOBAL_TTM_BO, | ||
441 | and its size should be sizeof(struct ttm_bo_global). Again, | ||
442 | driver specific init and release functions can be provided, | ||
443 | likely eventually calling ttm_bo_global_init and | ||
444 | ttm_bo_global_release, respectively. Also like the previous | ||
445 | object, ttm_global_item_ref is used to create an initial reference | ||
446 | count for the TTM, which will call your initalization function. | ||
447 | </para> | ||
448 | </sect3> | ||
449 | <sect3> | ||
450 | <title>GEM initialization</title> | ||
451 | <para> | ||
452 | GEM is an alternative to TTM, designed specifically for UMA | ||
453 | devices. It has simpler initialization and execution requirements | ||
454 | than TTM, but has no VRAM management capability. Core GEM | ||
455 | initialization is comprised of a basic drm_mm_init call to create | ||
456 | a GTT DRM MM object, which provides an address space pool for | ||
457 | object allocation. In a KMS configuration, the driver will | ||
458 | need to allocate and initialize a command ring buffer following | ||
459 | basic GEM initialization. Most UMA devices have a so-called | ||
460 | "stolen" memory region, which provides space for the initial | ||
461 | framebuffer and large, contiguous memory regions required by the | ||
462 | device. This space is not typically managed by GEM, and must | ||
463 | be initialized separately into its own DRM MM object. | ||
464 | </para> | ||
465 | <para> | ||
466 | Initialization will be driver specific, and will depend on | ||
467 | the architecture of the device. In the case of Intel | ||
468 | integrated graphics chips like 965GM, GEM initialization can | ||
469 | be done by calling the internal GEM init function, | ||
470 | i915_gem_do_init(). Since the 965GM is a UMA device | ||
471 | (i.e. it doesn't have dedicated VRAM), GEM will manage | ||
472 | making regular RAM available for GPU operations. Memory set | ||
473 | aside by the BIOS (called "stolen" memory by the i915 | ||
474 | driver) will be managed by the DRM memrange allocator; the | ||
475 | rest of the aperture will be managed by GEM. | ||
476 | <programlisting> | ||
477 | /* Basic memrange allocator for stolen space (aka vram) */ | ||
478 | drm_memrange_init(&dev_priv->vram, 0, prealloc_size); | ||
479 | /* Let GEM Manage from end of prealloc space to end of aperture */ | ||
480 | i915_gem_do_init(dev, prealloc_size, agp_size); | ||
481 | </programlisting> | ||
482 | <!--!Edrivers/char/drm/drm_memrange.c--> | ||
483 | </para> | ||
484 | <para> | ||
485 | Once the memory manager has been set up, we can allocate the | ||
486 | command buffer. In the i915 case, this is also done with a | ||
487 | GEM function, i915_gem_init_ringbuffer(). | ||
488 | </para> | ||
489 | </sect3> | ||
490 | </sect2> | ||
491 | |||
492 | <sect2> | ||
493 | <title>Output configuration</title> | ||
494 | <para> | ||
495 | The final initialization task is output configuration. This involves | ||
496 | finding and initializing the CRTCs, encoders and connectors | ||
497 | for your device, creating an initial configuration and | ||
498 | registering a framebuffer console driver. | ||
499 | </para> | ||
500 | <sect3> | ||
501 | <title>Output discovery and initialization</title> | ||
502 | <para> | ||
503 | Several core functions exist to create CRTCs, encoders and | ||
504 | connectors, namely drm_crtc_init(), drm_connector_init() and | ||
505 | drm_encoder_init(), along with several "helper" functions to | ||
506 | perform common tasks. | ||
507 | </para> | ||
508 | <para> | ||
509 | Connectors should be registered with sysfs once they've been | ||
510 | detected and initialized, using the | ||
511 | drm_sysfs_connector_add() function. Likewise, when they're | ||
512 | removed from the system, they should be destroyed with | ||
513 | drm_sysfs_connector_remove(). | ||
514 | </para> | ||
515 | <programlisting> | ||
516 | <![CDATA[ | ||
517 | void intel_crt_init(struct drm_device *dev) | ||
518 | { | ||
519 | struct drm_connector *connector; | ||
520 | struct intel_output *intel_output; | ||
521 | |||
522 | intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL); | ||
523 | if (!intel_output) | ||
524 | return; | ||
525 | |||
526 | connector = &intel_output->base; | ||
527 | drm_connector_init(dev, &intel_output->base, | ||
528 | &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); | ||
529 | |||
530 | drm_encoder_init(dev, &intel_output->enc, &intel_crt_enc_funcs, | ||
531 | DRM_MODE_ENCODER_DAC); | ||
532 | |||
533 | drm_mode_connector_attach_encoder(&intel_output->base, | ||
534 | &intel_output->enc); | ||
535 | |||
536 | /* Set up the DDC bus. */ | ||
537 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOA, "CRTDDC_A"); | ||
538 | if (!intel_output->ddc_bus) { | ||
539 | dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " | ||
540 | "failed.\n"); | ||
541 | return; | ||
542 | } | ||
543 | |||
544 | intel_output->type = INTEL_OUTPUT_ANALOG; | ||
545 | connector->interlace_allowed = 0; | ||
546 | connector->doublescan_allowed = 0; | ||
547 | |||
548 | drm_encoder_helper_add(&intel_output->enc, &intel_crt_helper_funcs); | ||
549 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); | ||
550 | |||
551 | drm_sysfs_connector_add(connector); | ||
552 | } | ||
553 | ]]> | ||
554 | </programlisting> | ||
555 | <para> | ||
556 | In the example above (again, taken from the i915 driver), a | ||
557 | CRT connector and encoder combination is created. A device | ||
558 | specific i2c bus is also created, for fetching EDID data and | ||
559 | performing monitor detection. Once the process is complete, | ||
560 | the new connector is regsitered with sysfs, to make its | ||
561 | properties available to applications. | ||
562 | </para> | ||
563 | <sect4> | ||
564 | <title>Helper functions and core functions</title> | ||
565 | <para> | ||
566 | Since many PC-class graphics devices have similar display output | ||
567 | designs, the DRM provides a set of helper functions to make | ||
568 | output management easier. The core helper routines handle | ||
569 | encoder re-routing and disabling of unused functions following | ||
570 | mode set. Using the helpers is optional, but recommended for | ||
571 | devices with PC-style architectures (i.e. a set of display planes | ||
572 | for feeding pixels to encoders which are in turn routed to | ||
573 | connectors). Devices with more complex requirements needing | ||
574 | finer grained management can opt to use the core callbacks | ||
575 | directly. | ||
576 | </para> | ||
577 | <para> | ||
578 | [Insert typical diagram here.] [Insert OMAP style config here.] | ||
579 | </para> | ||
580 | </sect4> | ||
581 | <para> | ||
582 | For each encoder, CRTC and connector, several functions must | ||
583 | be provided, depending on the object type. Encoder objects | ||
584 | need should provide a DPMS (basically on/off) function, mode fixup | ||
585 | (for converting requested modes into native hardware timings), | ||
586 | and prepare, set and commit functions for use by the core DRM | ||
587 | helper functions. Connector helpers need to provide mode fetch and | ||
588 | validity functions as well as an encoder matching function for | ||
589 | returing an ideal encoder for a given connector. The core | ||
590 | connector functions include a DPMS callback, (deprecated) | ||
591 | save/restore routines, detection, mode probing, property handling, | ||
592 | and cleanup functions. | ||
593 | </para> | ||
594 | <!--!Edrivers/char/drm/drm_crtc.h--> | ||
595 | <!--!Edrivers/char/drm/drm_crtc.c--> | ||
596 | <!--!Edrivers/char/drm/drm_crtc_helper.c--> | ||
597 | </sect3> | ||
598 | </sect2> | ||
599 | </sect1> | ||
600 | |||
601 | <!-- Internals: vblank handling --> | ||
602 | |||
603 | <sect1> | ||
604 | <title>VBlank event handling</title> | ||
605 | <para> | ||
606 | The DRM core exposes two vertical blank related ioctls: | ||
607 | DRM_IOCTL_WAIT_VBLANK and DRM_IOCTL_MODESET_CTL. | ||
608 | <!--!Edrivers/char/drm/drm_irq.c--> | ||
609 | </para> | ||
610 | <para> | ||
611 | DRM_IOCTL_WAIT_VBLANK takes a struct drm_wait_vblank structure | ||
612 | as its argument, and is used to block or request a signal when a | ||
613 | specified vblank event occurs. | ||
614 | </para> | ||
615 | <para> | ||
616 | DRM_IOCTL_MODESET_CTL should be called by application level | ||
617 | drivers before and after mode setting, since on many devices the | ||
618 | vertical blank counter will be reset at that time. Internally, | ||
619 | the DRM snapshots the last vblank count when the ioctl is called | ||
620 | with the _DRM_PRE_MODESET command so that the counter won't go | ||
621 | backwards (which is dealt with when _DRM_POST_MODESET is used). | ||
622 | </para> | ||
623 | <para> | ||
624 | To support the functions above, the DRM core provides several | ||
625 | helper functions for tracking vertical blank counters, and | ||
626 | requires drivers to provide several callbacks: | ||
627 | get_vblank_counter(), enable_vblank() and disable_vblank(). The | ||
628 | core uses get_vblank_counter() to keep the counter accurate | ||
629 | across interrupt disable periods. It should return the current | ||
630 | vertical blank event count, which is often tracked in a device | ||
631 | register. The enable and disable vblank callbacks should enable | ||
632 | and disable vertical blank interrupts, respectively. In the | ||
633 | absence of DRM clients waiting on vblank events, the core DRM | ||
634 | code will use the disable_vblank() function to disable | ||
635 | interrupts, which saves power. They'll be re-enabled again when | ||
636 | a client calls the vblank wait ioctl above. | ||
637 | </para> | ||
638 | <para> | ||
639 | Devices that don't provide a count register can simply use an | ||
640 | internal atomic counter incremented on every vertical blank | ||
641 | interrupt, and can make their enable and disable vblank | ||
642 | functions into no-ops. | ||
643 | </para> | ||
644 | </sect1> | ||
645 | |||
646 | <sect1> | ||
647 | <title>Memory management</title> | ||
648 | <para> | ||
649 | The memory manager lies at the heart of many DRM operations, and | ||
650 | is also required to support advanced client features like OpenGL | ||
651 | pbuffers. The DRM currently contains two memory managers, TTM | ||
652 | and GEM. | ||
653 | </para> | ||
654 | |||
655 | <sect2> | ||
656 | <title>The Translation Table Manager (TTM)</title> | ||
657 | <para> | ||
658 | TTM was developed by Tungsten Graphics, primarily by Thomas | ||
659 | Hellström, and is intended to be a flexible, high performance | ||
660 | graphics memory manager. | ||
661 | </para> | ||
662 | <para> | ||
663 | Drivers wishing to support TTM must fill out a drm_bo_driver | ||
664 | structure. | ||
665 | </para> | ||
666 | <para> | ||
667 | TTM design background and information belongs here. | ||
668 | </para> | ||
669 | </sect2> | ||
670 | |||
671 | <sect2> | ||
672 | <title>The Graphics Execution Manager (GEM)</title> | ||
673 | <para> | ||
674 | GEM is an Intel project, authored by Eric Anholt and Keith | ||
675 | Packard. It provides simpler interfaces than TTM, and is well | ||
676 | suited for UMA devices. | ||
677 | </para> | ||
678 | <para> | ||
679 | GEM-enabled drivers must provide gem_init_object() and | ||
680 | gem_free_object() callbacks to support the core memory | ||
681 | allocation routines. They should also provide several driver | ||
682 | specific ioctls to support command execution, pinning, buffer | ||
683 | read & write, mapping, and domain ownership transfers. | ||
684 | </para> | ||
685 | <para> | ||
686 | On a fundamental level, GEM involves several operations: memory | ||
687 | allocation and freeing, command execution, and aperture management | ||
688 | at command execution time. Buffer object allocation is relatively | ||
689 | straightforward and largely provided by Linux's shmem layer, which | ||
690 | provides memory to back each object. When mapped into the GTT | ||
691 | or used in a command buffer, the backing pages for an object are | ||
692 | flushed to memory and marked write combined so as to be coherent | ||
693 | with the GPU. Likewise, when the GPU finishes rendering to an object, | ||
694 | if the CPU accesses it, it must be made coherent with the CPU's view | ||
695 | of memory, usually involving GPU cache flushing of various kinds. | ||
696 | This core CPU<->GPU coherency management is provided by the GEM | ||
697 | set domain function, which evaluates an object's current domain and | ||
698 | performs any necessary flushing or synchronization to put the object | ||
699 | into the desired coherency domain (note that the object may be busy, | ||
700 | i.e. an active render target; in that case the set domain function | ||
701 | will block the client and wait for rendering to complete before | ||
702 | performing any necessary flushing operations). | ||
703 | </para> | ||
704 | <para> | ||
705 | Perhaps the most important GEM function is providing a command | ||
706 | execution interface to clients. Client programs construct command | ||
707 | buffers containing references to previously allocated memory objects | ||
708 | and submit them to GEM. At that point, GEM will take care to bind | ||
709 | all the objects into the GTT, execute the buffer, and provide | ||
710 | necessary synchronization between clients accessing the same buffers. | ||
711 | This often involves evicting some objects from the GTT and re-binding | ||
712 | others (a fairly expensive operation), and providing relocation | ||
713 | support which hides fixed GTT offsets from clients. Clients must | ||
714 | take care not to submit command buffers that reference more objects | ||
715 | than can fit in the GTT or GEM will reject them and no rendering | ||
716 | will occur. Similarly, if several objects in the buffer require | ||
717 | fence registers to be allocated for correct rendering (e.g. 2D blits | ||
718 | on pre-965 chips), care must be taken not to require more fence | ||
719 | registers than are available to the client. Such resource management | ||
720 | should be abstracted from the client in libdrm. | ||
721 | </para> | ||
722 | </sect2> | ||
723 | |||
724 | </sect1> | ||
725 | |||
726 | <!-- Output management --> | ||
727 | <sect1> | ||
728 | <title>Output management</title> | ||
729 | <para> | ||
730 | At the core of the DRM output management code is a set of | ||
731 | structures representing CRTCs, encoders and connectors. | ||
732 | </para> | ||
733 | <para> | ||
734 | A CRTC is an abstraction representing a part of the chip that | ||
735 | contains a pointer to a scanout buffer. Therefore, the number | ||
736 | of CRTCs available determines how many independent scanout | ||
737 | buffers can be active at any given time. The CRTC structure | ||
738 | contains several fields to support this: a pointer to some video | ||
739 | memory, a display mode, and an (x, y) offset into the video | ||
740 | memory to support panning or configurations where one piece of | ||
741 | video memory spans multiple CRTCs. | ||
742 | </para> | ||
743 | <para> | ||
744 | An encoder takes pixel data from a CRTC and converts it to a | ||
745 | format suitable for any attached connectors. On some devices, | ||
746 | it may be possible to have a CRTC send data to more than one | ||
747 | encoder. In that case, both encoders would receive data from | ||
748 | the same scanout buffer, resulting in a "cloned" display | ||
749 | configuration across the connectors attached to each encoder. | ||
750 | </para> | ||
751 | <para> | ||
752 | A connector is the final destination for pixel data on a device, | ||
753 | and usually connects directly to an external display device like | ||
754 | a monitor or laptop panel. A connector can only be attached to | ||
755 | one encoder at a time. The connector is also the structure | ||
756 | where information about the attached display is kept, so it | ||
757 | contains fields for display data, EDID data, DPMS & | ||
758 | connection status, and information about modes supported on the | ||
759 | attached displays. | ||
760 | </para> | ||
761 | <!--!Edrivers/char/drm/drm_crtc.c--> | ||
762 | </sect1> | ||
763 | |||
764 | <sect1> | ||
765 | <title>Framebuffer management</title> | ||
766 | <para> | ||
767 | In order to set a mode on a given CRTC, encoder and connector | ||
768 | configuration, clients need to provide a framebuffer object which | ||
769 | will provide a source of pixels for the CRTC to deliver to the encoder(s) | ||
770 | and ultimately the connector(s) in the configuration. A framebuffer | ||
771 | is fundamentally a driver specific memory object, made into an opaque | ||
772 | handle by the DRM addfb function. Once an fb has been created this | ||
773 | way it can be passed to the KMS mode setting routines for use in | ||
774 | a configuration. | ||
775 | </para> | ||
776 | </sect1> | ||
777 | |||
778 | <sect1> | ||
779 | <title>Command submission & fencing</title> | ||
780 | <para> | ||
781 | This should cover a few device specific command submission | ||
782 | implementations. | ||
783 | </para> | ||
784 | </sect1> | ||
785 | |||
786 | <sect1> | ||
787 | <title>Suspend/resume</title> | ||
788 | <para> | ||
789 | The DRM core provides some suspend/resume code, but drivers | ||
790 | wanting full suspend/resume support should provide save() and | ||
791 | restore() functions. These will be called at suspend, | ||
792 | hibernate, or resume time, and should perform any state save or | ||
793 | restore required by your device across suspend or hibernate | ||
794 | states. | ||
795 | </para> | ||
796 | </sect1> | ||
797 | |||
798 | <sect1> | ||
799 | <title>DMA services</title> | ||
800 | <para> | ||
801 | This should cover how DMA mapping etc. is supported by the core. | ||
802 | These functions are deprecated and should not be used. | ||
803 | </para> | ||
804 | </sect1> | ||
805 | </chapter> | ||
806 | |||
807 | <!-- External interfaces --> | ||
808 | |||
809 | <chapter id="drmExternals"> | ||
810 | <title>Userland interfaces</title> | ||
811 | <para> | ||
812 | The DRM core exports several interfaces to applications, | ||
813 | generally intended to be used through corresponding libdrm | ||
814 | wrapper functions. In addition, drivers export device specific | ||
815 | interfaces for use by userspace drivers & device aware | ||
816 | applications through ioctls and sysfs files. | ||
817 | </para> | ||
818 | <para> | ||
819 | External interfaces include: memory mapping, context management, | ||
820 | DMA operations, AGP management, vblank control, fence | ||
821 | management, memory management, and output management. | ||
822 | </para> | ||
823 | <para> | ||
824 | Cover generic ioctls and sysfs layout here. Only need high | ||
825 | level info, since man pages will cover the rest. | ||
826 | </para> | ||
827 | </chapter> | ||
828 | |||
829 | <!-- API reference --> | ||
830 | |||
831 | <appendix id="drmDriverApi"> | ||
832 | <title>DRM Driver API</title> | ||
833 | <para> | ||
834 | Include auto-generated API reference here (need to reference it | ||
835 | from paragraphs above too). | ||
836 | </para> | ||
837 | </appendix> | ||
838 | |||
839 | </book> | ||
diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl index 5cff41a5fa7c..55f12ac37acd 100644 --- a/Documentation/DocBook/kgdb.tmpl +++ b/Documentation/DocBook/kgdb.tmpl | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | <book id="kgdbOnLinux"> | 5 | <book id="kgdbOnLinux"> |
6 | <bookinfo> | 6 | <bookinfo> |
7 | <title>Using kgdb and the kgdb Internals</title> | 7 | <title>Using kgdb, kdb and the kernel debugger internals</title> |
8 | 8 | ||
9 | <authorgroup> | 9 | <authorgroup> |
10 | <author> | 10 | <author> |
@@ -17,33 +17,8 @@ | |||
17 | </affiliation> | 17 | </affiliation> |
18 | </author> | 18 | </author> |
19 | </authorgroup> | 19 | </authorgroup> |
20 | |||
21 | <authorgroup> | ||
22 | <author> | ||
23 | <firstname>Tom</firstname> | ||
24 | <surname>Rini</surname> | ||
25 | <affiliation> | ||
26 | <address> | ||
27 | <email>trini@kernel.crashing.org</email> | ||
28 | </address> | ||
29 | </affiliation> | ||
30 | </author> | ||
31 | </authorgroup> | ||
32 | |||
33 | <authorgroup> | ||
34 | <author> | ||
35 | <firstname>Amit S.</firstname> | ||
36 | <surname>Kale</surname> | ||
37 | <affiliation> | ||
38 | <address> | ||
39 | <email>amitkale@linsyssoft.com</email> | ||
40 | </address> | ||
41 | </affiliation> | ||
42 | </author> | ||
43 | </authorgroup> | ||
44 | |||
45 | <copyright> | 20 | <copyright> |
46 | <year>2008</year> | 21 | <year>2008,2010</year> |
47 | <holder>Wind River Systems, Inc.</holder> | 22 | <holder>Wind River Systems, Inc.</holder> |
48 | </copyright> | 23 | </copyright> |
49 | <copyright> | 24 | <copyright> |
@@ -69,41 +44,76 @@ | |||
69 | <chapter id="Introduction"> | 44 | <chapter id="Introduction"> |
70 | <title>Introduction</title> | 45 | <title>Introduction</title> |
71 | <para> | 46 | <para> |
72 | kgdb is a source level debugger for linux kernel. It is used along | 47 | The kernel has two different debugger front ends (kdb and kgdb) |
73 | with gdb to debug a linux kernel. The expectation is that gdb can | 48 | which interface to the debug core. It is possible to use either |
74 | be used to "break in" to the kernel to inspect memory, variables | 49 | of the debugger front ends and dynamically transition between them |
75 | and look through call stack information similar to what an | 50 | if you configure the kernel properly at compile and runtime. |
76 | application developer would use gdb for. It is possible to place | 51 | </para> |
77 | breakpoints in kernel code and perform some limited execution | 52 | <para> |
78 | stepping. | 53 | Kdb is simplistic shell-style interface which you can use on a |
54 | system console with a keyboard or serial console. You can use it | ||
55 | to inspect memory, registers, process lists, dmesg, and even set | ||
56 | breakpoints to stop in a certain location. Kdb is not a source | ||
57 | level debugger, although you can set breakpoints and execute some | ||
58 | basic kernel run control. Kdb is mainly aimed at doing some | ||
59 | analysis to aid in development or diagnosing kernel problems. You | ||
60 | can access some symbols by name in kernel built-ins or in kernel | ||
61 | modules if the code was built | ||
62 | with <symbol>CONFIG_KALLSYMS</symbol>. | ||
63 | </para> | ||
64 | <para> | ||
65 | Kgdb is intended to be used as a source level debugger for the | ||
66 | Linux kernel. It is used along with gdb to debug a Linux kernel. | ||
67 | The expectation is that gdb can be used to "break in" to the | ||
68 | kernel to inspect memory, variables and look through call stack | ||
69 | information similar to the way an application developer would use | ||
70 | gdb to debug an application. It is possible to place breakpoints | ||
71 | in kernel code and perform some limited execution stepping. | ||
79 | </para> | 72 | </para> |
80 | <para> | 73 | <para> |
81 | Two machines are required for using kgdb. One of these machines is a | 74 | Two machines are required for using kgdb. One of these machines is |
82 | development machine and the other is a test machine. The kernel | 75 | a development machine and the other is the target machine. The |
83 | to be debugged runs on the test machine. The development machine | 76 | kernel to be debugged runs on the target machine. The development |
84 | runs an instance of gdb against the vmlinux file which contains | 77 | machine runs an instance of gdb against the vmlinux file which |
85 | the symbols (not boot image such as bzImage, zImage, uImage...). | 78 | contains the symbols (not boot image such as bzImage, zImage, |
86 | In gdb the developer specifies the connection parameters and | 79 | uImage...). In gdb the developer specifies the connection |
87 | connects to kgdb. The type of connection a developer makes with | 80 | parameters and connects to kgdb. The type of connection a |
88 | gdb depends on the availability of kgdb I/O modules compiled as | 81 | developer makes with gdb depends on the availability of kgdb I/O |
89 | builtin's or kernel modules in the test machine's kernel. | 82 | modules compiled as built-ins or loadable kernel modules in the test |
83 | machine's kernel. | ||
90 | </para> | 84 | </para> |
91 | </chapter> | 85 | </chapter> |
92 | <chapter id="CompilingAKernel"> | 86 | <chapter id="CompilingAKernel"> |
93 | <title>Compiling a kernel</title> | 87 | <title>Compiling a kernel</title> |
88 | <para> | ||
89 | <itemizedlist> | ||
90 | <listitem><para>In order to enable compilation of kdb, you must first enable kgdb.</para></listitem> | ||
91 | <listitem><para>The kgdb test compile options are described in the kgdb test suite chapter.</para></listitem> | ||
92 | </itemizedlist> | ||
93 | </para> | ||
94 | <sect1 id="CompileKGDB"> | ||
95 | <title>Kernel config options for kgdb</title> | ||
94 | <para> | 96 | <para> |
95 | To enable <symbol>CONFIG_KGDB</symbol> you should first turn on | 97 | To enable <symbol>CONFIG_KGDB</symbol> you should first turn on |
96 | "Prompt for development and/or incomplete code/drivers" | 98 | "Prompt for development and/or incomplete code/drivers" |
97 | (CONFIG_EXPERIMENTAL) in "General setup", then under the | 99 | (CONFIG_EXPERIMENTAL) in "General setup", then under the |
98 | "Kernel debugging" select "KGDB: kernel debugging with remote gdb". | 100 | "Kernel debugging" select "KGDB: kernel debugger". |
101 | </para> | ||
102 | <para> | ||
103 | While it is not a hard requirement that you have symbols in your | ||
104 | vmlinux file, gdb tends not to be very useful without the symbolic | ||
105 | data, so you will want to turn | ||
106 | on <symbol>CONFIG_DEBUG_INFO</symbol> which is called "Compile the | ||
107 | kernel with debug info" in the config menu. | ||
99 | </para> | 108 | </para> |
100 | <para> | 109 | <para> |
101 | It is advised, but not required that you turn on the | 110 | It is advised, but not required that you turn on the |
102 | CONFIG_FRAME_POINTER kernel option. This option inserts code to | 111 | <symbol>CONFIG_FRAME_POINTER</symbol> kernel option which is called "Compile the |
103 | into the compiled executable which saves the frame information in | 112 | kernel with frame pointers" in the config menu. This option |
104 | registers or on the stack at different points which will allow a | 113 | inserts code to into the compiled executable which saves the frame |
105 | debugger such as gdb to more accurately construct stack back traces | 114 | information in registers or on the stack at different points which |
106 | while debugging the kernel. | 115 | allows a debugger such as gdb to more accurately construct |
116 | stack back traces while debugging the kernel. | ||
107 | </para> | 117 | </para> |
108 | <para> | 118 | <para> |
109 | If the architecture that you are using supports the kernel option | 119 | If the architecture that you are using supports the kernel option |
@@ -116,38 +126,160 @@ | |||
116 | this option. | 126 | this option. |
117 | </para> | 127 | </para> |
118 | <para> | 128 | <para> |
119 | Next you should choose one of more I/O drivers to interconnect debugging | 129 | Next you should choose one of more I/O drivers to interconnect |
120 | host and debugged target. Early boot debugging requires a KGDB | 130 | debugging host and debugged target. Early boot debugging requires |
121 | I/O driver that supports early debugging and the driver must be | 131 | a KGDB I/O driver that supports early debugging and the driver |
122 | built into the kernel directly. Kgdb I/O driver configuration | 132 | must be built into the kernel directly. Kgdb I/O driver |
123 | takes place via kernel or module parameters, see following | 133 | configuration takes place via kernel or module parameters which |
124 | chapter. | 134 | you can learn more about in the in the section that describes the |
135 | parameter "kgdboc". | ||
125 | </para> | 136 | </para> |
126 | <para> | 137 | <para>Here is an example set of .config symbols to enable or |
127 | The kgdb test compile options are described in the kgdb test suite chapter. | 138 | disable for kgdb: |
139 | <itemizedlist> | ||
140 | <listitem><para># CONFIG_DEBUG_RODATA is not set</para></listitem> | ||
141 | <listitem><para>CONFIG_FRAME_POINTER=y</para></listitem> | ||
142 | <listitem><para>CONFIG_KGDB=y</para></listitem> | ||
143 | <listitem><para>CONFIG_KGDB_SERIAL_CONSOLE=y</para></listitem> | ||
144 | </itemizedlist> | ||
128 | </para> | 145 | </para> |
129 | 146 | </sect1> | |
147 | <sect1 id="CompileKDB"> | ||
148 | <title>Kernel config options for kdb</title> | ||
149 | <para>Kdb is quite a bit more complex than the simple gdbstub | ||
150 | sitting on top of the kernel's debug core. Kdb must implement a | ||
151 | shell, and also adds some helper functions in other parts of the | ||
152 | kernel, responsible for printing out interesting data such as what | ||
153 | you would see if you ran "lsmod", or "ps". In order to build kdb | ||
154 | into the kernel you follow the same steps as you would for kgdb. | ||
155 | </para> | ||
156 | <para>The main config option for kdb | ||
157 | is <symbol>CONFIG_KGDB_KDB</symbol> which is called "KGDB_KDB: | ||
158 | include kdb frontend for kgdb" in the config menu. In theory you | ||
159 | would have already also selected an I/O driver such as the | ||
160 | CONFIG_KGDB_SERIAL_CONSOLE interface if you plan on using kdb on a | ||
161 | serial port, when you were configuring kgdb. | ||
162 | </para> | ||
163 | <para>If you want to use a PS/2-style keyboard with kdb, you would | ||
164 | select CONFIG_KDB_KEYBOARD which is called "KGDB_KDB: keyboard as | ||
165 | input device" in the config menu. The CONFIG_KDB_KEYBOARD option | ||
166 | is not used for anything in the gdb interface to kgdb. The | ||
167 | CONFIG_KDB_KEYBOARD option only works with kdb. | ||
168 | </para> | ||
169 | <para>Here is an example set of .config symbols to enable/disable kdb: | ||
170 | <itemizedlist> | ||
171 | <listitem><para># CONFIG_DEBUG_RODATA is not set</para></listitem> | ||
172 | <listitem><para>CONFIG_FRAME_POINTER=y</para></listitem> | ||
173 | <listitem><para>CONFIG_KGDB=y</para></listitem> | ||
174 | <listitem><para>CONFIG_KGDB_SERIAL_CONSOLE=y</para></listitem> | ||
175 | <listitem><para>CONFIG_KGDB_KDB=y</para></listitem> | ||
176 | <listitem><para>CONFIG_KDB_KEYBOARD=y</para></listitem> | ||
177 | </itemizedlist> | ||
178 | </para> | ||
179 | </sect1> | ||
130 | </chapter> | 180 | </chapter> |
131 | <chapter id="EnableKGDB"> | 181 | <chapter id="kgdbKernelArgs"> |
132 | <title>Enable kgdb for debugging</title> | 182 | <title>Kernel Debugger Boot Arguments</title> |
133 | <para> | 183 | <para>This section describes the various runtime kernel |
134 | In order to use kgdb you must activate it by passing configuration | 184 | parameters that affect the configuration of the kernel debugger. |
135 | information to one of the kgdb I/O drivers. If you do not pass any | 185 | The following chapter covers using kdb and kgdb as well as |
136 | configuration information kgdb will not do anything at all. Kgdb | 186 | provides some examples of the configuration parameters.</para> |
137 | will only actively hook up to the kernel trap hooks if a kgdb I/O | 187 | <sect1 id="kgdboc"> |
138 | driver is loaded and configured. If you unconfigure a kgdb I/O | 188 | <title>Kernel parameter: kgdboc</title> |
139 | driver, kgdb will unregister all the kernel hook points. | 189 | <para>The kgdboc driver was originally an abbreviation meant to |
190 | stand for "kgdb over console". Today it is the primary mechanism | ||
191 | to configure how to communicate from gdb to kgdb as well as the | ||
192 | devices you want to use to interact with the kdb shell. | ||
193 | </para> | ||
194 | <para>For kgdb/gdb, kgdboc is designed to work with a single serial | ||
195 | port. It is intended to cover the circumstance where you want to | ||
196 | use a serial console as your primary console as well as using it to | ||
197 | perform kernel debugging. It is also possible to use kgdb on a | ||
198 | serial port which is not designated as a system console. Kgdboc | ||
199 | may be configured as a kernel built-in or a kernel loadable module. | ||
200 | You can only make use of <constant>kgdbwait</constant> and early | ||
201 | debugging if you build kgdboc into the kernel as a built-in. | ||
140 | </para> | 202 | </para> |
203 | <sect2 id="kgdbocArgs"> | ||
204 | <title>kgdboc arguments</title> | ||
205 | <para>Usage: <constant>kgdboc=[kbd][[,]serial_device][,baud]</constant></para> | ||
206 | <sect3 id="kgdbocArgs1"> | ||
207 | <title>Using loadable module or built-in</title> | ||
141 | <para> | 208 | <para> |
142 | All drivers can be reconfigured at run time, if | 209 | <orderedlist> |
143 | <symbol>CONFIG_SYSFS</symbol> and <symbol>CONFIG_MODULES</symbol> | 210 | <listitem><para>As a kernel built-in:</para> |
144 | are enabled, by echo'ing a new config string to | 211 | <para>Use the kernel boot argument: <constant>kgdboc=<tty-device>,[baud]</constant></para></listitem> |
145 | <constant>/sys/module/<driver>/parameter/<option></constant>. | 212 | <listitem> |
146 | The driver can be unconfigured by passing an empty string. You cannot | 213 | <para>As a kernel loadable module:</para> |
147 | change the configuration while the debugger is attached. Make sure | 214 | <para>Use the command: <constant>modprobe kgdboc kgdboc=<tty-device>,[baud]</constant></para> |
148 | to detach the debugger with the <constant>detach</constant> command | 215 | <para>Here are two examples of how you might formate the kgdboc |
149 | prior to trying unconfigure a kgdb I/O driver. | 216 | string. The first is for an x86 target using the first serial port. |
217 | The second example is for the ARM Versatile AB using the second | ||
218 | serial port. | ||
219 | <orderedlist> | ||
220 | <listitem><para><constant>kgdboc=ttyS0,115200</constant></para></listitem> | ||
221 | <listitem><para><constant>kgdboc=ttyAMA1,115200</constant></para></listitem> | ||
222 | </orderedlist> | ||
150 | </para> | 223 | </para> |
224 | </listitem> | ||
225 | </orderedlist></para> | ||
226 | </sect3> | ||
227 | <sect3 id="kgdbocArgs2"> | ||
228 | <title>Configure kgdboc at runtime with sysfs</title> | ||
229 | <para>At run time you can enable or disable kgdboc by echoing a | ||
230 | parameters into the sysfs. Here are two examples:</para> | ||
231 | <orderedlist> | ||
232 | <listitem><para>Enable kgdboc on ttyS0</para> | ||
233 | <para><constant>echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem> | ||
234 | <listitem><para>Disable kgdboc</para> | ||
235 | <para><constant>echo "" > /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem> | ||
236 | </orderedlist> | ||
237 | <para>NOTE: You do not need to specify the baud if you are | ||
238 | configuring the console on tty which is already configured or | ||
239 | open.</para> | ||
240 | </sect3> | ||
241 | <sect3 id="kgdbocArgs3"> | ||
242 | <title>More examples</title> | ||
243 | <para>You can configure kgdboc to use the keyboard, and or a serial device | ||
244 | depending on if you are using kdb and or kgdb, in one of the | ||
245 | following scenarios. | ||
246 | <orderedlist> | ||
247 | <listitem><para>kdb and kgdb over only a serial port</para> | ||
248 | <para><constant>kgdboc=<serial_device>[,baud]</constant></para> | ||
249 | <para>Example: <constant>kgdboc=ttyS0,115200</constant></para> | ||
250 | </listitem> | ||
251 | <listitem><para>kdb and kgdb with keyboard and a serial port</para> | ||
252 | <para><constant>kgdboc=kbd,<serial_device>[,baud]</constant></para> | ||
253 | <para>Example: <constant>kgdboc=kbd,ttyS0,115200</constant></para> | ||
254 | </listitem> | ||
255 | <listitem><para>kdb with a keyboard</para> | ||
256 | <para><constant>kgdboc=kbd</constant></para> | ||
257 | </listitem> | ||
258 | </orderedlist> | ||
259 | </para> | ||
260 | </sect3> | ||
261 | <para>NOTE: Kgdboc does not support interrupting the target via the | ||
262 | gdb remote protocol. You must manually send a sysrq-g unless you | ||
263 | have a proxy that splits console output to a terminal program. | ||
264 | A console proxy has a separate TCP port for the debugger and a separate | ||
265 | TCP port for the "human" console. The proxy can take care of sending | ||
266 | the sysrq-g for you. | ||
267 | </para> | ||
268 | <para>When using kgdboc with no debugger proxy, you can end up | ||
269 | connecting the debugger at one of two entry points. If an | ||
270 | exception occurs after you have loaded kgdboc, a message should | ||
271 | print on the console stating it is waiting for the debugger. In | ||
272 | this case you disconnect your terminal program and then connect the | ||
273 | debugger in its place. If you want to interrupt the target system | ||
274 | and forcibly enter a debug session you have to issue a Sysrq | ||
275 | sequence and then type the letter <constant>g</constant>. Then | ||
276 | you disconnect the terminal session and connect gdb. Your options | ||
277 | if you don't like this are to hack gdb to send the sysrq-g for you | ||
278 | as well as on the initial connect, or to use a debugger proxy that | ||
279 | allows an unmodified gdb to do the debugging. | ||
280 | </para> | ||
281 | </sect2> | ||
282 | </sect1> | ||
151 | <sect1 id="kgdbwait"> | 283 | <sect1 id="kgdbwait"> |
152 | <title>Kernel parameter: kgdbwait</title> | 284 | <title>Kernel parameter: kgdbwait</title> |
153 | <para> | 285 | <para> |
@@ -162,103 +294,204 @@ | |||
162 | </para> | 294 | </para> |
163 | <para> | 295 | <para> |
164 | The kernel will stop and wait as early as the I/O driver and | 296 | The kernel will stop and wait as early as the I/O driver and |
165 | architecture will allow when you use this option. If you build the | 297 | architecture allows when you use this option. If you build the |
166 | kgdb I/O driver as a kernel module kgdbwait will not do anything. | 298 | kgdb I/O driver as a loadable kernel module kgdbwait will not do |
299 | anything. | ||
167 | </para> | 300 | </para> |
168 | </sect1> | 301 | </sect1> |
169 | <sect1 id="kgdboc"> | 302 | <sect1 id="kgdbcon"> |
170 | <title>Kernel parameter: kgdboc</title> | 303 | <title>Kernel parameter: kgdbcon</title> |
171 | <para> | 304 | <para> The kgdbcon feature allows you to see printk() messages |
172 | The kgdboc driver was originally an abbreviation meant to stand for | 305 | inside gdb while gdb is connected to the kernel. Kdb does not make |
173 | "kgdb over console". Kgdboc is designed to work with a single | 306 | use of the kgdbcon feature. |
174 | serial port. It was meant to cover the circumstance | 307 | </para> |
175 | where you wanted to use a serial console as your primary console as | 308 | <para>Kgdb supports using the gdb serial protocol to send console |
176 | well as using it to perform kernel debugging. Of course you can | 309 | messages to the debugger when the debugger is connected and running. |
177 | also use kgdboc without assigning a console to the same port. | 310 | There are two ways to activate this feature. |
311 | <orderedlist> | ||
312 | <listitem><para>Activate with the kernel command line option:</para> | ||
313 | <para><constant>kgdbcon</constant></para> | ||
314 | </listitem> | ||
315 | <listitem><para>Use sysfs before configuring an I/O driver</para> | ||
316 | <para> | ||
317 | <constant>echo 1 > /sys/module/kgdb/parameters/kgdb_use_con</constant> | ||
318 | </para> | ||
319 | <para> | ||
320 | NOTE: If you do this after you configure the kgdb I/O driver, the | ||
321 | setting will not take effect until the next point the I/O is | ||
322 | reconfigured. | ||
323 | </para> | ||
324 | </listitem> | ||
325 | </orderedlist> | ||
326 | <para>IMPORTANT NOTE: You cannot use kgdboc + kgdbcon on a tty that is an | ||
327 | active system console. An example incorrect usage is <constant>console=ttyS0,115200 kgdboc=ttyS0 kgdbcon</constant> | ||
328 | </para> | ||
329 | <para>It is possible to use this option with kgdboc on a tty that is not a system console. | ||
330 | </para> | ||
178 | </para> | 331 | </para> |
179 | <sect2 id="UsingKgdboc"> | 332 | </sect1> |
180 | <title>Using kgdboc</title> | 333 | </chapter> |
181 | <para> | 334 | <chapter id="usingKDB"> |
182 | You can configure kgdboc via sysfs or a module or kernel boot line | 335 | <title>Using kdb</title> |
183 | parameter depending on if you build with CONFIG_KGDBOC as a module | ||
184 | or built-in. | ||
185 | <orderedlist> | ||
186 | <listitem><para>From the module load or build-in</para> | ||
187 | <para><constant>kgdboc=<tty-device>,[baud]</constant></para> | ||
188 | <para> | 336 | <para> |
189 | The example here would be if your console port was typically ttyS0, you would use something like <constant>kgdboc=ttyS0,115200</constant> or on the ARM Versatile AB you would likely use <constant>kgdboc=ttyAMA0,115200</constant> | 337 | </para> |
338 | <sect1 id="quickKDBserial"> | ||
339 | <title>Quick start for kdb on a serial port</title> | ||
340 | <para>This is a quick example of how to use kdb.</para> | ||
341 | <para><orderedlist> | ||
342 | <listitem><para>Boot kernel with arguments: | ||
343 | <itemizedlist> | ||
344 | <listitem><para><constant>console=ttyS0,115200 kgdboc=ttyS0,115200</constant></para></listitem> | ||
345 | </itemizedlist></para> | ||
346 | <para>OR</para> | ||
347 | <para>Configure kgdboc after the kernel booted; assuming you are using a serial port console: | ||
348 | <itemizedlist> | ||
349 | <listitem><para><constant>echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem> | ||
350 | </itemizedlist> | ||
190 | </para> | 351 | </para> |
191 | </listitem> | 352 | </listitem> |
192 | <listitem><para>From sysfs</para> | 353 | <listitem><para>Enter the kernel debugger manually or by waiting for an oops or fault. There are several ways you can enter the kernel debugger manually; all involve using the sysrq-g, which means you must have enabled CONFIG_MAGIC_SYSRQ=y in your kernel config.</para> |
193 | <para><constant>echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc</constant></para> | 354 | <itemizedlist> |
355 | <listitem><para>When logged in as root or with a super user session you can run:</para> | ||
356 | <para><constant>echo g > /proc/sysrq-trigger</constant></para></listitem> | ||
357 | <listitem><para>Example using minicom 2.2</para> | ||
358 | <para>Press: <constant>Control-a</constant></para> | ||
359 | <para>Press: <constant>f</constant></para> | ||
360 | <para>Press: <constant>g</constant></para> | ||
194 | </listitem> | 361 | </listitem> |
195 | </orderedlist> | 362 | <listitem><para>When you have telneted to a terminal server that supports sending a remote break</para> |
196 | </para> | 363 | <para>Press: <constant>Control-]</constant></para> |
197 | <para> | 364 | <para>Type in:<constant>send break</constant></para> |
198 | NOTE: Kgdboc does not support interrupting the target via the | 365 | <para>Press: <constant>Enter</constant></para> |
199 | gdb remote protocol. You must manually send a sysrq-g unless you | 366 | <para>Press: <constant>g</constant></para> |
200 | have a proxy that splits console output to a terminal problem and | 367 | </listitem> |
201 | has a separate port for the debugger to connect to that sends the | 368 | </itemizedlist> |
202 | sysrq-g for you. | 369 | </listitem> |
370 | <listitem><para>From the kdb prompt you can run the "help" command to see a complete list of the commands that are available.</para> | ||
371 | <para>Some useful commands in kdb include: | ||
372 | <itemizedlist> | ||
373 | <listitem><para>lsmod -- Shows where kernel modules are loaded</para></listitem> | ||
374 | <listitem><para>ps -- Displays only the active processes</para></listitem> | ||
375 | <listitem><para>ps A -- Shows all the processes</para></listitem> | ||
376 | <listitem><para>summary -- Shows kernel version info and memory usage</para></listitem> | ||
377 | <listitem><para>bt -- Get a backtrace of the current process using dump_stack()</para></listitem> | ||
378 | <listitem><para>dmesg -- View the kernel syslog buffer</para></listitem> | ||
379 | <listitem><para>go -- Continue the system</para></listitem> | ||
380 | </itemizedlist> | ||
203 | </para> | 381 | </para> |
204 | <para>When using kgdboc with no debugger proxy, you can end up | 382 | </listitem> |
205 | connecting the debugger for one of two entry points. If an | 383 | <listitem> |
206 | exception occurs after you have loaded kgdboc a message should print | 384 | <para>When you are done using kdb you need to consider rebooting the |
207 | on the console stating it is waiting for the debugger. In case you | 385 | system or using the "go" command to resuming normal kernel |
208 | disconnect your terminal program and then connect the debugger in | 386 | execution. If you have paused the kernel for a lengthy period of |
209 | its place. If you want to interrupt the target system and forcibly | 387 | time, applications that rely on timely networking or anything to do |
210 | enter a debug session you have to issue a Sysrq sequence and then | 388 | with real wall clock time could be adversely affected, so you |
211 | type the letter <constant>g</constant>. Then you disconnect the | 389 | should take this into consideration when using the kernel |
212 | terminal session and connect gdb. Your options if you don't like | 390 | debugger.</para> |
213 | this are to hack gdb to send the sysrq-g for you as well as on the | 391 | </listitem> |
214 | initial connect, or to use a debugger proxy that allows an | 392 | </orderedlist></para> |
215 | unmodified gdb to do the debugging. | 393 | </sect1> |
394 | <sect1 id="quickKDBkeyboard"> | ||
395 | <title>Quick start for kdb using a keyboard connected console</title> | ||
396 | <para>This is a quick example of how to use kdb with a keyboard.</para> | ||
397 | <para><orderedlist> | ||
398 | <listitem><para>Boot kernel with arguments: | ||
399 | <itemizedlist> | ||
400 | <listitem><para><constant>kgdboc=kbd</constant></para></listitem> | ||
401 | </itemizedlist></para> | ||
402 | <para>OR</para> | ||
403 | <para>Configure kgdboc after the kernel booted: | ||
404 | <itemizedlist> | ||
405 | <listitem><para><constant>echo kbd > /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem> | ||
406 | </itemizedlist> | ||
216 | </para> | 407 | </para> |
217 | </sect2> | 408 | </listitem> |
409 | <listitem><para>Enter the kernel debugger manually or by waiting for an oops or fault. There are several ways you can enter the kernel debugger manually; all involve using the sysrq-g, which means you must have enabled CONFIG_MAGIC_SYSRQ=y in your kernel config.</para> | ||
410 | <itemizedlist> | ||
411 | <listitem><para>When logged in as root or with a super user session you can run:</para> | ||
412 | <para><constant>echo g > /proc/sysrq-trigger</constant></para></listitem> | ||
413 | <listitem><para>Example using a laptop keyboard</para> | ||
414 | <para>Press and hold down: <constant>Alt</constant></para> | ||
415 | <para>Press and hold down: <constant>Fn</constant></para> | ||
416 | <para>Press and release the key with the label: <constant>SysRq</constant></para> | ||
417 | <para>Release: <constant>Fn</constant></para> | ||
418 | <para>Press and release: <constant>g</constant></para> | ||
419 | <para>Release: <constant>Alt</constant></para> | ||
420 | </listitem> | ||
421 | <listitem><para>Example using a PS/2 101-key keyboard</para> | ||
422 | <para>Press and hold down: <constant>Alt</constant></para> | ||
423 | <para>Press and release the key with the label: <constant>SysRq</constant></para> | ||
424 | <para>Press and release: <constant>g</constant></para> | ||
425 | <para>Release: <constant>Alt</constant></para> | ||
426 | </listitem> | ||
427 | </itemizedlist> | ||
428 | </listitem> | ||
429 | <listitem> | ||
430 | <para>Now type in a kdb command such as "help", "dmesg", "bt" or "go" to continue kernel execution.</para> | ||
431 | </listitem> | ||
432 | </orderedlist></para> | ||
218 | </sect1> | 433 | </sect1> |
219 | <sect1 id="kgdbcon"> | 434 | </chapter> |
220 | <title>Kernel parameter: kgdbcon</title> | 435 | <chapter id="EnableKGDB"> |
221 | <para> | 436 | <title>Using kgdb / gdb</title> |
222 | Kgdb supports using the gdb serial protocol to send console messages | 437 | <para>In order to use kgdb you must activate it by passing |
223 | to the debugger when the debugger is connected and running. There | 438 | configuration information to one of the kgdb I/O drivers. If you |
224 | are two ways to activate this feature. | 439 | do not pass any configuration information kgdb will not do anything |
440 | at all. Kgdb will only actively hook up to the kernel trap hooks | ||
441 | if a kgdb I/O driver is loaded and configured. If you unconfigure | ||
442 | a kgdb I/O driver, kgdb will unregister all the kernel hook points. | ||
443 | </para> | ||
444 | <para> All kgdb I/O drivers can be reconfigured at run time, if | ||
445 | <symbol>CONFIG_SYSFS</symbol> and <symbol>CONFIG_MODULES</symbol> | ||
446 | are enabled, by echo'ing a new config string to | ||
447 | <constant>/sys/module/<driver>/parameter/<option></constant>. | ||
448 | The driver can be unconfigured by passing an empty string. You cannot | ||
449 | change the configuration while the debugger is attached. Make sure | ||
450 | to detach the debugger with the <constant>detach</constant> command | ||
451 | prior to trying to unconfigure a kgdb I/O driver. | ||
452 | </para> | ||
453 | <sect1 id="ConnectingGDB"> | ||
454 | <title>Connecting with gdb to a serial port</title> | ||
225 | <orderedlist> | 455 | <orderedlist> |
226 | <listitem><para>Activate with the kernel command line option:</para> | 456 | <listitem><para>Configure kgdboc</para> |
227 | <para><constant>kgdbcon</constant></para> | 457 | <para>Boot kernel with arguments: |
458 | <itemizedlist> | ||
459 | <listitem><para><constant>kgdboc=ttyS0,115200</constant></para></listitem> | ||
460 | </itemizedlist></para> | ||
461 | <para>OR</para> | ||
462 | <para>Configure kgdboc after the kernel booted: | ||
463 | <itemizedlist> | ||
464 | <listitem><para><constant>echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem> | ||
465 | </itemizedlist></para> | ||
228 | </listitem> | 466 | </listitem> |
229 | <listitem><para>Use sysfs before configuring an io driver</para> | 467 | <listitem> |
230 | <para> | 468 | <para>Stop kernel execution (break into the debugger)</para> |
231 | <constant>echo 1 > /sys/module/kgdb/parameters/kgdb_use_con</constant> | 469 | <para>In order to connect to gdb via kgdboc, the kernel must |
232 | </para> | 470 | first be stopped. There are several ways to stop the kernel which |
233 | <para> | 471 | include using kgdbwait as a boot argument, via a sysrq-g, or running |
234 | NOTE: If you do this after you configure the kgdb I/O driver, the | 472 | the kernel until it takes an exception where it waits for the |
235 | setting will not take effect until the next point the I/O is | 473 | debugger to attach. |
236 | reconfigured. | 474 | <itemizedlist> |
237 | </para> | 475 | <listitem><para>When logged in as root or with a super user session you can run:</para> |
476 | <para><constant>echo g > /proc/sysrq-trigger</constant></para></listitem> | ||
477 | <listitem><para>Example using minicom 2.2</para> | ||
478 | <para>Press: <constant>Control-a</constant></para> | ||
479 | <para>Press: <constant>f</constant></para> | ||
480 | <para>Press: <constant>g</constant></para> | ||
238 | </listitem> | 481 | </listitem> |
239 | </orderedlist> | 482 | <listitem><para>When you have telneted to a terminal server that supports sending a remote break</para> |
240 | </para> | 483 | <para>Press: <constant>Control-]</constant></para> |
241 | <para> | 484 | <para>Type in:<constant>send break</constant></para> |
242 | IMPORTANT NOTE: Using this option with kgdb over the console | 485 | <para>Press: <constant>Enter</constant></para> |
243 | (kgdboc) is not supported. | 486 | <para>Press: <constant>g</constant></para> |
487 | </listitem> | ||
488 | </itemizedlist> | ||
244 | </para> | 489 | </para> |
245 | </sect1> | 490 | </listitem> |
246 | </chapter> | 491 | <listitem> |
247 | <chapter id="ConnectingGDB"> | 492 | <para>Connect from from gdb</para> |
248 | <title>Connecting gdb</title> | ||
249 | <para> | ||
250 | If you are using kgdboc, you need to have used kgdbwait as a boot | ||
251 | argument, issued a sysrq-g, or the system you are going to debug | ||
252 | has already taken an exception and is waiting for the debugger to | ||
253 | attach before you can connect gdb. | ||
254 | </para> | ||
255 | <para> | ||
256 | If you are not using different kgdb I/O driver other than kgdboc, | ||
257 | you should be able to connect and the target will automatically | ||
258 | respond. | ||
259 | </para> | ||
260 | <para> | 493 | <para> |
261 | Example (using a serial port): | 494 | Example (using a directly connected port): |
262 | </para> | 495 | </para> |
263 | <programlisting> | 496 | <programlisting> |
264 | % gdb ./vmlinux | 497 | % gdb ./vmlinux |
@@ -266,7 +499,7 @@ | |||
266 | (gdb) target remote /dev/ttyS0 | 499 | (gdb) target remote /dev/ttyS0 |
267 | </programlisting> | 500 | </programlisting> |
268 | <para> | 501 | <para> |
269 | Example (kgdb to a terminal server on tcp port 2012): | 502 | Example (kgdb to a terminal server on TCP port 2012): |
270 | </para> | 503 | </para> |
271 | <programlisting> | 504 | <programlisting> |
272 | % gdb ./vmlinux | 505 | % gdb ./vmlinux |
@@ -283,6 +516,83 @@ | |||
283 | communications. You do this prior to issuing the <constant>target | 516 | communications. You do this prior to issuing the <constant>target |
284 | remote</constant> command by typing in: <constant>set debug remote 1</constant> | 517 | remote</constant> command by typing in: <constant>set debug remote 1</constant> |
285 | </para> | 518 | </para> |
519 | </listitem> | ||
520 | </orderedlist> | ||
521 | <para>Remember if you continue in gdb, and need to "break in" again, | ||
522 | you need to issue an other sysrq-g. It is easy to create a simple | ||
523 | entry point by putting a breakpoint at <constant>sys_sync</constant> | ||
524 | and then you can run "sync" from a shell or script to break into the | ||
525 | debugger.</para> | ||
526 | </sect1> | ||
527 | </chapter> | ||
528 | <chapter id="switchKdbKgdb"> | ||
529 | <title>kgdb and kdb interoperability</title> | ||
530 | <para>It is possible to transition between kdb and kgdb dynamically. | ||
531 | The debug core will remember which you used the last time and | ||
532 | automatically start in the same mode.</para> | ||
533 | <sect1> | ||
534 | <title>Switching between kdb and kgdb</title> | ||
535 | <sect2> | ||
536 | <title>Switching from kgdb to kdb</title> | ||
537 | <para> | ||
538 | There are two ways to switch from kgdb to kdb: you can use gdb to | ||
539 | issue a maintenance packet, or you can blindly type the command $3#33. | ||
540 | Whenever kernel debugger stops in kgdb mode it will print the | ||
541 | message <constant>KGDB or $3#33 for KDB</constant>. It is important | ||
542 | to note that you have to type the sequence correctly in one pass. | ||
543 | You cannot type a backspace or delete because kgdb will interpret | ||
544 | that as part of the debug stream. | ||
545 | <orderedlist> | ||
546 | <listitem><para>Change from kgdb to kdb by blindly typing:</para> | ||
547 | <para><constant>$3#33</constant></para></listitem> | ||
548 | <listitem><para>Change from kgdb to kdb with gdb</para> | ||
549 | <para><constant>maintenance packet 3</constant></para> | ||
550 | <para>NOTE: Now you must kill gdb. Typically you press control-z and | ||
551 | issue the command: kill -9 %</para></listitem> | ||
552 | </orderedlist> | ||
553 | </para> | ||
554 | </sect2> | ||
555 | <sect2> | ||
556 | <title>Change from kdb to kgdb</title> | ||
557 | <para>There are two ways you can change from kdb to kgdb. You can | ||
558 | manually enter kgdb mode by issuing the kgdb command from the kdb | ||
559 | shell prompt, or you can connect gdb while the kdb shell prompt is | ||
560 | active. The kdb shell looks for the typical first commands that gdb | ||
561 | would issue with the gdb remote protocol and if it sees one of those | ||
562 | commands it automatically changes into kgdb mode.</para> | ||
563 | <orderedlist> | ||
564 | <listitem><para>From kdb issue the command:</para> | ||
565 | <para><constant>kgdb</constant></para> | ||
566 | <para>Now disconnect your terminal program and connect gdb in its place</para></listitem> | ||
567 | <listitem><para>At the kdb prompt, disconnect the terminal program and connect gdb in its place.</para></listitem> | ||
568 | </orderedlist> | ||
569 | </sect2> | ||
570 | </sect1> | ||
571 | <sect1> | ||
572 | <title>Running kdb commands from gdb</title> | ||
573 | <para>It is possible to run a limited set of kdb commands from gdb, | ||
574 | using the gdb monitor command. You don't want to execute any of the | ||
575 | run control or breakpoint operations, because it can disrupt the | ||
576 | state of the kernel debugger. You should be using gdb for | ||
577 | breakpoints and run control operations if you have gdb connected. | ||
578 | The more useful commands to run are things like lsmod, dmesg, ps or | ||
579 | possibly some of the memory information commands. To see all the kdb | ||
580 | commands you can run <constant>monitor help</constant>.</para> | ||
581 | <para>Example: | ||
582 | <informalexample><programlisting> | ||
583 | (gdb) monitor ps | ||
584 | 1 idle process (state I) and | ||
585 | 27 sleeping system daemon (state M) processes suppressed, | ||
586 | use 'ps A' to see all. | ||
587 | Task Addr Pid Parent [*] cpu State Thread Command | ||
588 | |||
589 | 0xc78291d0 1 0 0 0 S 0xc7829404 init | ||
590 | 0xc7954150 942 1 0 0 S 0xc7954384 dropbear | ||
591 | 0xc78789c0 944 1 0 0 S 0xc7878bf4 sh | ||
592 | (gdb) | ||
593 | </programlisting></informalexample> | ||
594 | </para> | ||
595 | </sect1> | ||
286 | </chapter> | 596 | </chapter> |
287 | <chapter id="KGDBTestSuite"> | 597 | <chapter id="KGDBTestSuite"> |
288 | <title>kgdb Test Suite</title> | 598 | <title>kgdb Test Suite</title> |
@@ -309,34 +619,36 @@ | |||
309 | </para> | 619 | </para> |
310 | </chapter> | 620 | </chapter> |
311 | <chapter id="CommonBackEndReq"> | 621 | <chapter id="CommonBackEndReq"> |
312 | <title>KGDB Internals</title> | 622 | <title>Kernel Debugger Internals</title> |
313 | <sect1 id="kgdbArchitecture"> | 623 | <sect1 id="kgdbArchitecture"> |
314 | <title>Architecture Specifics</title> | 624 | <title>Architecture Specifics</title> |
315 | <para> | 625 | <para> |
316 | Kgdb is organized into three basic components: | 626 | The kernel debugger is organized into a number of components: |
317 | <orderedlist> | 627 | <orderedlist> |
318 | <listitem><para>kgdb core</para> | 628 | <listitem><para>The debug core</para> |
319 | <para> | 629 | <para> |
320 | The kgdb core is found in kernel/kgdb.c. It contains: | 630 | The debug core is found in kernel/debugger/debug_core.c. It contains: |
321 | <itemizedlist> | 631 | <itemizedlist> |
322 | <listitem><para>All the logic to implement the gdb serial protocol</para></listitem> | 632 | <listitem><para>A generic OS exception handler which includes |
323 | <listitem><para>A generic OS exception handler which includes sync'ing the processors into a stopped state on an multi cpu system.</para></listitem> | 633 | sync'ing the processors into a stopped state on an multi-CPU |
634 | system.</para></listitem> | ||
324 | <listitem><para>The API to talk to the kgdb I/O drivers</para></listitem> | 635 | <listitem><para>The API to talk to the kgdb I/O drivers</para></listitem> |
325 | <listitem><para>The API to make calls to the arch specific kgdb implementation</para></listitem> | 636 | <listitem><para>The API to make calls to the arch-specific kgdb implementation</para></listitem> |
326 | <listitem><para>The logic to perform safe memory reads and writes to memory while using the debugger</para></listitem> | 637 | <listitem><para>The logic to perform safe memory reads and writes to memory while using the debugger</para></listitem> |
327 | <listitem><para>A full implementation for software breakpoints unless overridden by the arch</para></listitem> | 638 | <listitem><para>A full implementation for software breakpoints unless overridden by the arch</para></listitem> |
639 | <listitem><para>The API to invoke either the kdb or kgdb frontend to the debug core.</para></listitem> | ||
328 | </itemizedlist> | 640 | </itemizedlist> |
329 | </para> | 641 | </para> |
330 | </listitem> | 642 | </listitem> |
331 | <listitem><para>kgdb arch specific implementation</para> | 643 | <listitem><para>kgdb arch-specific implementation</para> |
332 | <para> | 644 | <para> |
333 | This implementation is generally found in arch/*/kernel/kgdb.c. | 645 | This implementation is generally found in arch/*/kernel/kgdb.c. |
334 | As an example, arch/x86/kernel/kgdb.c contains the specifics to | 646 | As an example, arch/x86/kernel/kgdb.c contains the specifics to |
335 | implement HW breakpoint as well as the initialization to | 647 | implement HW breakpoint as well as the initialization to |
336 | dynamically register and unregister for the trap handlers on | 648 | dynamically register and unregister for the trap handlers on |
337 | this architecture. The arch specific portion implements: | 649 | this architecture. The arch-specific portion implements: |
338 | <itemizedlist> | 650 | <itemizedlist> |
339 | <listitem><para>contains an arch specific trap catcher which | 651 | <listitem><para>contains an arch-specific trap catcher which |
340 | invokes kgdb_handle_exception() to start kgdb about doing its | 652 | invokes kgdb_handle_exception() to start kgdb about doing its |
341 | work</para></listitem> | 653 | work</para></listitem> |
342 | <listitem><para>translation to and from gdb specific packet format to pt_regs</para></listitem> | 654 | <listitem><para>translation to and from gdb specific packet format to pt_regs</para></listitem> |
@@ -347,11 +659,35 @@ | |||
347 | </itemizedlist> | 659 | </itemizedlist> |
348 | </para> | 660 | </para> |
349 | </listitem> | 661 | </listitem> |
662 | <listitem><para>gdbstub frontend (aka kgdb)</para> | ||
663 | <para>The gdbstub is located in kernel/debug/gdbstub.c. It contains:</para> | ||
664 | <itemizedlist> | ||
665 | <listitem><para>All the logic to implement the gdb serial protocol</para></listitem> | ||
666 | </itemizedlist> | ||
667 | </listitem> | ||
668 | <listitem><para>kdb frontend</para> | ||
669 | <para>The kdb debugger shell is broken down into a number of | ||
670 | components. The kdb core is located in kernel/debug/kdb. There | ||
671 | are a number of helper functions in some of the other kernel | ||
672 | components to make it possible for kdb to examine and report | ||
673 | information about the kernel without taking locks that could | ||
674 | cause a kernel deadlock. The kdb core contains implements the following functionality.</para> | ||
675 | <itemizedlist> | ||
676 | <listitem><para>A simple shell</para></listitem> | ||
677 | <listitem><para>The kdb core command set</para></listitem> | ||
678 | <listitem><para>A registration API to register additional kdb shell commands.</para> | ||
679 | <para>A good example of a self-contained kdb module is the "ftdump" command for dumping the ftrace buffer. See: kernel/trace/trace_kdb.c</para></listitem> | ||
680 | <listitem><para>The implementation for kdb_printf() which | ||
681 | emits messages directly to I/O drivers, bypassing the kernel | ||
682 | log.</para></listitem> | ||
683 | <listitem><para>SW / HW breakpoint management for the kdb shell</para></listitem> | ||
684 | </itemizedlist> | ||
685 | </listitem> | ||
350 | <listitem><para>kgdb I/O driver</para> | 686 | <listitem><para>kgdb I/O driver</para> |
351 | <para> | 687 | <para> |
352 | Each kgdb I/O driver has to provide an implemenation for the following: | 688 | Each kgdb I/O driver has to provide an implementation for the following: |
353 | <itemizedlist> | 689 | <itemizedlist> |
354 | <listitem><para>configuration via builtin or module</para></listitem> | 690 | <listitem><para>configuration via built-in or module</para></listitem> |
355 | <listitem><para>dynamic configuration and kgdb hook registration calls</para></listitem> | 691 | <listitem><para>dynamic configuration and kgdb hook registration calls</para></listitem> |
356 | <listitem><para>read and write character interface</para></listitem> | 692 | <listitem><para>read and write character interface</para></listitem> |
357 | <listitem><para>A cleanup handler for unconfiguring from the kgdb core</para></listitem> | 693 | <listitem><para>A cleanup handler for unconfiguring from the kgdb core</para></listitem> |
@@ -416,15 +752,15 @@ | |||
416 | underlying low level to the hardware driver having "polling hooks" | 752 | underlying low level to the hardware driver having "polling hooks" |
417 | which the to which the tty driver is attached. In the initial | 753 | which the to which the tty driver is attached. In the initial |
418 | implementation of kgdboc it the serial_core was changed to expose a | 754 | implementation of kgdboc it the serial_core was changed to expose a |
419 | low level uart hook for doing polled mode reading and writing of a | 755 | low level UART hook for doing polled mode reading and writing of a |
420 | single character while in an atomic context. When kgdb makes an I/O | 756 | single character while in an atomic context. When kgdb makes an I/O |
421 | request to the debugger, kgdboc invokes a call back in the serial | 757 | request to the debugger, kgdboc invokes a call back in the serial |
422 | core which in turn uses the call back in the uart driver. It is | 758 | core which in turn uses the call back in the UART driver. It is |
423 | certainly possible to extend kgdboc to work with non-uart based | 759 | certainly possible to extend kgdboc to work with non-UART based |
424 | consoles in the future. | 760 | consoles in the future. |
425 | </para> | 761 | </para> |
426 | <para> | 762 | <para> |
427 | When using kgdboc with a uart, the uart driver must implement two callbacks in the <constant>struct uart_ops</constant>. Example from drivers/8250.c:<programlisting> | 763 | When using kgdboc with a UART, the UART driver must implement two callbacks in the <constant>struct uart_ops</constant>. Example from drivers/8250.c:<programlisting> |
428 | #ifdef CONFIG_CONSOLE_POLL | 764 | #ifdef CONFIG_CONSOLE_POLL |
429 | .poll_get_char = serial8250_get_poll_char, | 765 | .poll_get_char = serial8250_get_poll_char, |
430 | .poll_put_char = serial8250_put_poll_char, | 766 | .poll_put_char = serial8250_put_poll_char, |
@@ -434,7 +770,7 @@ | |||
434 | <constant>#ifdef CONFIG_CONSOLE_POLL</constant>, as shown above. | 770 | <constant>#ifdef CONFIG_CONSOLE_POLL</constant>, as shown above. |
435 | Keep in mind that polling hooks have to be implemented in such a way | 771 | Keep in mind that polling hooks have to be implemented in such a way |
436 | that they can be called from an atomic context and have to restore | 772 | that they can be called from an atomic context and have to restore |
437 | the state of the uart chip on return such that the system can return | 773 | the state of the UART chip on return such that the system can return |
438 | to normal when the debugger detaches. You need to be very careful | 774 | to normal when the debugger detaches. You need to be very careful |
439 | with any kind of lock you consider, because failing here is most | 775 | with any kind of lock you consider, because failing here is most |
440 | going to mean pressing the reset button. | 776 | going to mean pressing the reset button. |
@@ -453,6 +789,10 @@ | |||
453 | <itemizedlist> | 789 | <itemizedlist> |
454 | <listitem><para>Jason Wessel<email>jason.wessel@windriver.com</email></para></listitem> | 790 | <listitem><para>Jason Wessel<email>jason.wessel@windriver.com</email></para></listitem> |
455 | </itemizedlist> | 791 | </itemizedlist> |
792 | In Jan 2010 this document was updated to include kdb. | ||
793 | <itemizedlist> | ||
794 | <listitem><para>Jason Wessel<email>jason.wessel@windriver.com</email></para></listitem> | ||
795 | </itemizedlist> | ||
456 | </para> | 796 | </para> |
457 | </chapter> | 797 | </chapter> |
458 | </book> | 798 | </book> |
diff --git a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl index ba9975771503..8c5411cfeaf0 100644 --- a/Documentation/DocBook/libata.tmpl +++ b/Documentation/DocBook/libata.tmpl | |||
@@ -81,16 +81,14 @@ void (*port_disable) (struct ata_port *); | |||
81 | </programlisting> | 81 | </programlisting> |
82 | 82 | ||
83 | <para> | 83 | <para> |
84 | Called from ata_bus_probe() and ata_bus_reset() error paths, | 84 | Called from ata_bus_probe() error path, as well as when |
85 | as well as when unregistering from the SCSI module (rmmod, hot | 85 | unregistering from the SCSI module (rmmod, hot unplug). |
86 | unplug). | ||
87 | This function should do whatever needs to be done to take the | 86 | This function should do whatever needs to be done to take the |
88 | port out of use. In most cases, ata_port_disable() can be used | 87 | port out of use. In most cases, ata_port_disable() can be used |
89 | as this hook. | 88 | as this hook. |
90 | </para> | 89 | </para> |
91 | <para> | 90 | <para> |
92 | Called from ata_bus_probe() on a failed probe. | 91 | Called from ata_bus_probe() on a failed probe. |
93 | Called from ata_bus_reset() on a failed bus reset. | ||
94 | Called from ata_scsi_release(). | 92 | Called from ata_scsi_release(). |
95 | </para> | 93 | </para> |
96 | 94 | ||
@@ -107,10 +105,6 @@ void (*dev_config) (struct ata_port *, struct ata_device *); | |||
107 | issue of SET FEATURES - XFER MODE, and prior to operation. | 105 | issue of SET FEATURES - XFER MODE, and prior to operation. |
108 | </para> | 106 | </para> |
109 | <para> | 107 | <para> |
110 | Called by ata_device_add() after ata_dev_identify() determines | ||
111 | a device is present. | ||
112 | </para> | ||
113 | <para> | ||
114 | This entry may be specified as NULL in ata_port_operations. | 108 | This entry may be specified as NULL in ata_port_operations. |
115 | </para> | 109 | </para> |
116 | 110 | ||
@@ -154,8 +148,8 @@ unsigned int (*mode_filter) (struct ata_port *, struct ata_device *, unsigned in | |||
154 | 148 | ||
155 | <sect2><title>Taskfile read/write</title> | 149 | <sect2><title>Taskfile read/write</title> |
156 | <programlisting> | 150 | <programlisting> |
157 | void (*tf_load) (struct ata_port *ap, struct ata_taskfile *tf); | 151 | void (*sff_tf_load) (struct ata_port *ap, struct ata_taskfile *tf); |
158 | void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); | 152 | void (*sff_tf_read) (struct ata_port *ap, struct ata_taskfile *tf); |
159 | </programlisting> | 153 | </programlisting> |
160 | 154 | ||
161 | <para> | 155 | <para> |
@@ -164,36 +158,35 @@ void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); | |||
164 | hardware registers / DMA buffers, to obtain the current set of | 158 | hardware registers / DMA buffers, to obtain the current set of |
165 | taskfile register values. | 159 | taskfile register values. |
166 | Most drivers for taskfile-based hardware (PIO or MMIO) use | 160 | Most drivers for taskfile-based hardware (PIO or MMIO) use |
167 | ata_tf_load() and ata_tf_read() for these hooks. | 161 | ata_sff_tf_load() and ata_sff_tf_read() for these hooks. |
168 | </para> | 162 | </para> |
169 | 163 | ||
170 | </sect2> | 164 | </sect2> |
171 | 165 | ||
172 | <sect2><title>PIO data read/write</title> | 166 | <sect2><title>PIO data read/write</title> |
173 | <programlisting> | 167 | <programlisting> |
174 | void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int); | 168 | void (*sff_data_xfer) (struct ata_device *, unsigned char *, unsigned int, int); |
175 | </programlisting> | 169 | </programlisting> |
176 | 170 | ||
177 | <para> | 171 | <para> |
178 | All bmdma-style drivers must implement this hook. This is the low-level | 172 | All bmdma-style drivers must implement this hook. This is the low-level |
179 | operation that actually copies the data bytes during a PIO data | 173 | operation that actually copies the data bytes during a PIO data |
180 | transfer. | 174 | transfer. |
181 | Typically the driver | 175 | Typically the driver will choose one of ata_sff_data_xfer_noirq(), |
182 | will choose one of ata_pio_data_xfer_noirq(), ata_pio_data_xfer(), or | 176 | ata_sff_data_xfer(), or ata_sff_data_xfer32(). |
183 | ata_mmio_data_xfer(). | ||
184 | </para> | 177 | </para> |
185 | 178 | ||
186 | </sect2> | 179 | </sect2> |
187 | 180 | ||
188 | <sect2><title>ATA command execute</title> | 181 | <sect2><title>ATA command execute</title> |
189 | <programlisting> | 182 | <programlisting> |
190 | void (*exec_command)(struct ata_port *ap, struct ata_taskfile *tf); | 183 | void (*sff_exec_command)(struct ata_port *ap, struct ata_taskfile *tf); |
191 | </programlisting> | 184 | </programlisting> |
192 | 185 | ||
193 | <para> | 186 | <para> |
194 | causes an ATA command, previously loaded with | 187 | causes an ATA command, previously loaded with |
195 | ->tf_load(), to be initiated in hardware. | 188 | ->tf_load(), to be initiated in hardware. |
196 | Most drivers for taskfile-based hardware use ata_exec_command() | 189 | Most drivers for taskfile-based hardware use ata_sff_exec_command() |
197 | for this hook. | 190 | for this hook. |
198 | </para> | 191 | </para> |
199 | 192 | ||
@@ -218,8 +211,8 @@ command. | |||
218 | 211 | ||
219 | <sect2><title>Read specific ATA shadow registers</title> | 212 | <sect2><title>Read specific ATA shadow registers</title> |
220 | <programlisting> | 213 | <programlisting> |
221 | u8 (*check_status)(struct ata_port *ap); | 214 | u8 (*sff_check_status)(struct ata_port *ap); |
222 | u8 (*check_altstatus)(struct ata_port *ap); | 215 | u8 (*sff_check_altstatus)(struct ata_port *ap); |
223 | </programlisting> | 216 | </programlisting> |
224 | 217 | ||
225 | <para> | 218 | <para> |
@@ -227,20 +220,26 @@ u8 (*check_altstatus)(struct ata_port *ap); | |||
227 | hardware. On some hardware, reading the Status register has | 220 | hardware. On some hardware, reading the Status register has |
228 | the side effect of clearing the interrupt condition. | 221 | the side effect of clearing the interrupt condition. |
229 | Most drivers for taskfile-based hardware use | 222 | Most drivers for taskfile-based hardware use |
230 | ata_check_status() for this hook. | 223 | ata_sff_check_status() for this hook. |
231 | </para> | 224 | </para> |
225 | |||
226 | </sect2> | ||
227 | |||
228 | <sect2><title>Write specific ATA shadow register</title> | ||
229 | <programlisting> | ||
230 | void (*sff_set_devctl)(struct ata_port *ap, u8 ctl); | ||
231 | </programlisting> | ||
232 | |||
232 | <para> | 233 | <para> |
233 | Note that because this is called from ata_device_add(), at | 234 | Write the device control ATA shadow register to the hardware. |
234 | least a dummy function that clears device interrupts must be | 235 | Most drivers don't need to define this. |
235 | provided for all drivers, even if the controller doesn't | ||
236 | actually have a taskfile status register. | ||
237 | </para> | 236 | </para> |
238 | 237 | ||
239 | </sect2> | 238 | </sect2> |
240 | 239 | ||
241 | <sect2><title>Select ATA device on bus</title> | 240 | <sect2><title>Select ATA device on bus</title> |
242 | <programlisting> | 241 | <programlisting> |
243 | void (*dev_select)(struct ata_port *ap, unsigned int device); | 242 | void (*sff_dev_select)(struct ata_port *ap, unsigned int device); |
244 | </programlisting> | 243 | </programlisting> |
245 | 244 | ||
246 | <para> | 245 | <para> |
@@ -251,9 +250,7 @@ void (*dev_select)(struct ata_port *ap, unsigned int device); | |||
251 | </para> | 250 | </para> |
252 | <para> | 251 | <para> |
253 | Most drivers for taskfile-based hardware use | 252 | Most drivers for taskfile-based hardware use |
254 | ata_std_dev_select() for this hook. Controllers which do not | 253 | ata_sff_dev_select() for this hook. |
255 | support second drives on a port (such as SATA contollers) will | ||
256 | use ata_noop_dev_select(). | ||
257 | </para> | 254 | </para> |
258 | 255 | ||
259 | </sect2> | 256 | </sect2> |
@@ -441,13 +438,13 @@ void (*irq_clear) (struct ata_port *); | |||
441 | to struct ata_host_set. | 438 | to struct ata_host_set. |
442 | </para> | 439 | </para> |
443 | <para> | 440 | <para> |
444 | Most legacy IDE drivers use ata_interrupt() for the | 441 | Most legacy IDE drivers use ata_sff_interrupt() for the |
445 | irq_handler hook, which scans all ports in the host_set, | 442 | irq_handler hook, which scans all ports in the host_set, |
446 | determines which queued command was active (if any), and calls | 443 | determines which queued command was active (if any), and calls |
447 | ata_host_intr(ap,qc). | 444 | ata_sff_host_intr(ap,qc). |
448 | </para> | 445 | </para> |
449 | <para> | 446 | <para> |
450 | Most legacy IDE drivers use ata_bmdma_irq_clear() for the | 447 | Most legacy IDE drivers use ata_sff_irq_clear() for the |
451 | irq_clear() hook, which simply clears the interrupt and error | 448 | irq_clear() hook, which simply clears the interrupt and error |
452 | flags in the DMA status register. | 449 | flags in the DMA status register. |
453 | </para> | 450 | </para> |
@@ -490,16 +487,12 @@ void (*host_stop) (struct ata_host_set *host_set); | |||
490 | allocates space for a legacy IDE PRD table and returns. | 487 | allocates space for a legacy IDE PRD table and returns. |
491 | </para> | 488 | </para> |
492 | <para> | 489 | <para> |
493 | ->port_stop() is called after ->host_stop(). It's sole function | 490 | ->port_stop() is called after ->host_stop(). Its sole function |
494 | is to release DMA/memory resources, now that they are no longer | 491 | is to release DMA/memory resources, now that they are no longer |
495 | actively being used. Many drivers also free driver-private | 492 | actively being used. Many drivers also free driver-private |
496 | data from port at this time. | 493 | data from port at this time. |
497 | </para> | 494 | </para> |
498 | <para> | 495 | <para> |
499 | Many drivers use ata_port_stop() as this hook, which frees the | ||
500 | PRD table. | ||
501 | </para> | ||
502 | <para> | ||
503 | ->host_stop() is called after all ->port_stop() calls | 496 | ->host_stop() is called after all ->port_stop() calls |
504 | have completed. The hook must finalize hardware shutdown, release DMA | 497 | have completed. The hook must finalize hardware shutdown, release DMA |
505 | and other resources, etc. | 498 | and other resources, etc. |
diff --git a/Documentation/DocBook/media-entities.tmpl b/Documentation/DocBook/media-entities.tmpl index c725cb852c54..5d4d40f429a5 100644 --- a/Documentation/DocBook/media-entities.tmpl +++ b/Documentation/DocBook/media-entities.tmpl | |||
@@ -17,6 +17,7 @@ | |||
17 | <!ENTITY VIDIOC-DBG-G-REGISTER "<link linkend='vidioc-dbg-g-register'><constant>VIDIOC_DBG_G_REGISTER</constant></link>"> | 17 | <!ENTITY VIDIOC-DBG-G-REGISTER "<link linkend='vidioc-dbg-g-register'><constant>VIDIOC_DBG_G_REGISTER</constant></link>"> |
18 | <!ENTITY VIDIOC-DBG-S-REGISTER "<link linkend='vidioc-dbg-g-register'><constant>VIDIOC_DBG_S_REGISTER</constant></link>"> | 18 | <!ENTITY VIDIOC-DBG-S-REGISTER "<link linkend='vidioc-dbg-g-register'><constant>VIDIOC_DBG_S_REGISTER</constant></link>"> |
19 | <!ENTITY VIDIOC-DQBUF "<link linkend='vidioc-qbuf'><constant>VIDIOC_DQBUF</constant></link>"> | 19 | <!ENTITY VIDIOC-DQBUF "<link linkend='vidioc-qbuf'><constant>VIDIOC_DQBUF</constant></link>"> |
20 | <!ENTITY VIDIOC-DQEVENT "<link linkend='vidioc-dqevent'><constant>VIDIOC_DQEVENT</constant></link>"> | ||
20 | <!ENTITY VIDIOC-ENCODER-CMD "<link linkend='vidioc-encoder-cmd'><constant>VIDIOC_ENCODER_CMD</constant></link>"> | 21 | <!ENTITY VIDIOC-ENCODER-CMD "<link linkend='vidioc-encoder-cmd'><constant>VIDIOC_ENCODER_CMD</constant></link>"> |
21 | <!ENTITY VIDIOC-ENUMAUDIO "<link linkend='vidioc-enumaudio'><constant>VIDIOC_ENUMAUDIO</constant></link>"> | 22 | <!ENTITY VIDIOC-ENUMAUDIO "<link linkend='vidioc-enumaudio'><constant>VIDIOC_ENUMAUDIO</constant></link>"> |
22 | <!ENTITY VIDIOC-ENUMAUDOUT "<link linkend='vidioc-enumaudioout'><constant>VIDIOC_ENUMAUDOUT</constant></link>"> | 23 | <!ENTITY VIDIOC-ENUMAUDOUT "<link linkend='vidioc-enumaudioout'><constant>VIDIOC_ENUMAUDOUT</constant></link>"> |
@@ -60,6 +61,7 @@ | |||
60 | <!ENTITY VIDIOC-REQBUFS "<link linkend='vidioc-reqbufs'><constant>VIDIOC_REQBUFS</constant></link>"> | 61 | <!ENTITY VIDIOC-REQBUFS "<link linkend='vidioc-reqbufs'><constant>VIDIOC_REQBUFS</constant></link>"> |
61 | <!ENTITY VIDIOC-STREAMOFF "<link linkend='vidioc-streamon'><constant>VIDIOC_STREAMOFF</constant></link>"> | 62 | <!ENTITY VIDIOC-STREAMOFF "<link linkend='vidioc-streamon'><constant>VIDIOC_STREAMOFF</constant></link>"> |
62 | <!ENTITY VIDIOC-STREAMON "<link linkend='vidioc-streamon'><constant>VIDIOC_STREAMON</constant></link>"> | 63 | <!ENTITY VIDIOC-STREAMON "<link linkend='vidioc-streamon'><constant>VIDIOC_STREAMON</constant></link>"> |
64 | <!ENTITY VIDIOC-SUBSCRIBE-EVENT "<link linkend='vidioc-subscribe-event'><constant>VIDIOC_SUBSCRIBE_EVENT</constant></link>"> | ||
63 | <!ENTITY VIDIOC-S-AUDIO "<link linkend='vidioc-g-audio'><constant>VIDIOC_S_AUDIO</constant></link>"> | 65 | <!ENTITY VIDIOC-S-AUDIO "<link linkend='vidioc-g-audio'><constant>VIDIOC_S_AUDIO</constant></link>"> |
64 | <!ENTITY VIDIOC-S-AUDOUT "<link linkend='vidioc-g-audioout'><constant>VIDIOC_S_AUDOUT</constant></link>"> | 66 | <!ENTITY VIDIOC-S-AUDOUT "<link linkend='vidioc-g-audioout'><constant>VIDIOC_S_AUDOUT</constant></link>"> |
65 | <!ENTITY VIDIOC-S-CROP "<link linkend='vidioc-g-crop'><constant>VIDIOC_S_CROP</constant></link>"> | 67 | <!ENTITY VIDIOC-S-CROP "<link linkend='vidioc-g-crop'><constant>VIDIOC_S_CROP</constant></link>"> |
@@ -83,6 +85,7 @@ | |||
83 | <!ENTITY VIDIOC-TRY-ENCODER-CMD "<link linkend='vidioc-encoder-cmd'><constant>VIDIOC_TRY_ENCODER_CMD</constant></link>"> | 85 | <!ENTITY VIDIOC-TRY-ENCODER-CMD "<link linkend='vidioc-encoder-cmd'><constant>VIDIOC_TRY_ENCODER_CMD</constant></link>"> |
84 | <!ENTITY VIDIOC-TRY-EXT-CTRLS "<link linkend='vidioc-g-ext-ctrls'><constant>VIDIOC_TRY_EXT_CTRLS</constant></link>"> | 86 | <!ENTITY VIDIOC-TRY-EXT-CTRLS "<link linkend='vidioc-g-ext-ctrls'><constant>VIDIOC_TRY_EXT_CTRLS</constant></link>"> |
85 | <!ENTITY VIDIOC-TRY-FMT "<link linkend='vidioc-g-fmt'><constant>VIDIOC_TRY_FMT</constant></link>"> | 87 | <!ENTITY VIDIOC-TRY-FMT "<link linkend='vidioc-g-fmt'><constant>VIDIOC_TRY_FMT</constant></link>"> |
88 | <!ENTITY VIDIOC-UNSUBSCRIBE-EVENT "<link linkend='vidioc-subscribe-event'><constant>VIDIOC_UNSUBSCRIBE_EVENT</constant></link>"> | ||
86 | 89 | ||
87 | <!-- Types --> | 90 | <!-- Types --> |
88 | <!ENTITY v4l2-std-id "<link linkend='v4l2-std-id'>v4l2_std_id</link>"> | 91 | <!ENTITY v4l2-std-id "<link linkend='v4l2-std-id'>v4l2_std_id</link>"> |
@@ -141,6 +144,9 @@ | |||
141 | <!ENTITY v4l2-enc-idx "struct <link linkend='v4l2-enc-idx'>v4l2_enc_idx</link>"> | 144 | <!ENTITY v4l2-enc-idx "struct <link linkend='v4l2-enc-idx'>v4l2_enc_idx</link>"> |
142 | <!ENTITY v4l2-enc-idx-entry "struct <link linkend='v4l2-enc-idx-entry'>v4l2_enc_idx_entry</link>"> | 145 | <!ENTITY v4l2-enc-idx-entry "struct <link linkend='v4l2-enc-idx-entry'>v4l2_enc_idx_entry</link>"> |
143 | <!ENTITY v4l2-encoder-cmd "struct <link linkend='v4l2-encoder-cmd'>v4l2_encoder_cmd</link>"> | 146 | <!ENTITY v4l2-encoder-cmd "struct <link linkend='v4l2-encoder-cmd'>v4l2_encoder_cmd</link>"> |
147 | <!ENTITY v4l2-event "struct <link linkend='v4l2-event'>v4l2_event</link>"> | ||
148 | <!ENTITY v4l2-event-subscription "struct <link linkend='v4l2-event-subscription'>v4l2_event_subscription</link>"> | ||
149 | <!ENTITY v4l2-event-vsync "struct <link linkend='v4l2-event-vsync'>v4l2_event_vsync</link>"> | ||
144 | <!ENTITY v4l2-ext-control "struct <link linkend='v4l2-ext-control'>v4l2_ext_control</link>"> | 150 | <!ENTITY v4l2-ext-control "struct <link linkend='v4l2-ext-control'>v4l2_ext_control</link>"> |
145 | <!ENTITY v4l2-ext-controls "struct <link linkend='v4l2-ext-controls'>v4l2_ext_controls</link>"> | 151 | <!ENTITY v4l2-ext-controls "struct <link linkend='v4l2-ext-controls'>v4l2_ext_controls</link>"> |
146 | <!ENTITY v4l2-fmtdesc "struct <link linkend='v4l2-fmtdesc'>v4l2_fmtdesc</link>"> | 152 | <!ENTITY v4l2-fmtdesc "struct <link linkend='v4l2-fmtdesc'>v4l2_fmtdesc</link>"> |
@@ -200,6 +206,7 @@ | |||
200 | <!ENTITY sub-controls SYSTEM "v4l/controls.xml"> | 206 | <!ENTITY sub-controls SYSTEM "v4l/controls.xml"> |
201 | <!ENTITY sub-dev-capture SYSTEM "v4l/dev-capture.xml"> | 207 | <!ENTITY sub-dev-capture SYSTEM "v4l/dev-capture.xml"> |
202 | <!ENTITY sub-dev-codec SYSTEM "v4l/dev-codec.xml"> | 208 | <!ENTITY sub-dev-codec SYSTEM "v4l/dev-codec.xml"> |
209 | <!ENTITY sub-dev-event SYSTEM "v4l/dev-event.xml"> | ||
203 | <!ENTITY sub-dev-effect SYSTEM "v4l/dev-effect.xml"> | 210 | <!ENTITY sub-dev-effect SYSTEM "v4l/dev-effect.xml"> |
204 | <!ENTITY sub-dev-osd SYSTEM "v4l/dev-osd.xml"> | 211 | <!ENTITY sub-dev-osd SYSTEM "v4l/dev-osd.xml"> |
205 | <!ENTITY sub-dev-output SYSTEM "v4l/dev-output.xml"> | 212 | <!ENTITY sub-dev-output SYSTEM "v4l/dev-output.xml"> |
@@ -292,6 +299,8 @@ | |||
292 | <!ENTITY sub-v4l2grab-c SYSTEM "v4l/v4l2grab.c.xml"> | 299 | <!ENTITY sub-v4l2grab-c SYSTEM "v4l/v4l2grab.c.xml"> |
293 | <!ENTITY sub-videodev2-h SYSTEM "v4l/videodev2.h.xml"> | 300 | <!ENTITY sub-videodev2-h SYSTEM "v4l/videodev2.h.xml"> |
294 | <!ENTITY sub-v4l2 SYSTEM "v4l/v4l2.xml"> | 301 | <!ENTITY sub-v4l2 SYSTEM "v4l/v4l2.xml"> |
302 | <!ENTITY sub-dqevent SYSTEM "v4l/vidioc-dqevent.xml"> | ||
303 | <!ENTITY sub-subscribe-event SYSTEM "v4l/vidioc-subscribe-event.xml"> | ||
295 | <!ENTITY sub-intro SYSTEM "dvb/intro.xml"> | 304 | <!ENTITY sub-intro SYSTEM "dvb/intro.xml"> |
296 | <!ENTITY sub-frontend SYSTEM "dvb/frontend.xml"> | 305 | <!ENTITY sub-frontend SYSTEM "dvb/frontend.xml"> |
297 | <!ENTITY sub-dvbproperty SYSTEM "dvb/dvbproperty.xml"> | 306 | <!ENTITY sub-dvbproperty SYSTEM "dvb/dvbproperty.xml"> |
@@ -381,3 +390,5 @@ | |||
381 | <!ENTITY reqbufs SYSTEM "v4l/vidioc-reqbufs.xml"> | 390 | <!ENTITY reqbufs SYSTEM "v4l/vidioc-reqbufs.xml"> |
382 | <!ENTITY s-hw-freq-seek SYSTEM "v4l/vidioc-s-hw-freq-seek.xml"> | 391 | <!ENTITY s-hw-freq-seek SYSTEM "v4l/vidioc-s-hw-freq-seek.xml"> |
383 | <!ENTITY streamon SYSTEM "v4l/vidioc-streamon.xml"> | 392 | <!ENTITY streamon SYSTEM "v4l/vidioc-streamon.xml"> |
393 | <!ENTITY dqevent SYSTEM "v4l/vidioc-dqevent.xml"> | ||
394 | <!ENTITY subscribe_event SYSTEM "v4l/vidioc-subscribe-event.xml"> | ||
diff --git a/Documentation/DocBook/mtdnand.tmpl b/Documentation/DocBook/mtdnand.tmpl index 133cd6c3f3c1..020ac80d4682 100644 --- a/Documentation/DocBook/mtdnand.tmpl +++ b/Documentation/DocBook/mtdnand.tmpl | |||
@@ -269,7 +269,7 @@ static void board_hwcontrol(struct mtd_info *mtd, int cmd) | |||
269 | information about the device. | 269 | information about the device. |
270 | </para> | 270 | </para> |
271 | <programlisting> | 271 | <programlisting> |
272 | int __init board_init (void) | 272 | static int __init board_init (void) |
273 | { | 273 | { |
274 | struct nand_chip *this; | 274 | struct nand_chip *this; |
275 | int err = 0; | 275 | int err = 0; |
diff --git a/Documentation/DocBook/sh.tmpl b/Documentation/DocBook/sh.tmpl index 0c3dc4c69dd1..d858d92cf6d9 100644 --- a/Documentation/DocBook/sh.tmpl +++ b/Documentation/DocBook/sh.tmpl | |||
@@ -19,13 +19,17 @@ | |||
19 | </authorgroup> | 19 | </authorgroup> |
20 | 20 | ||
21 | <copyright> | 21 | <copyright> |
22 | <year>2008</year> | 22 | <year>2008-2010</year> |
23 | <holder>Paul Mundt</holder> | 23 | <holder>Paul Mundt</holder> |
24 | </copyright> | 24 | </copyright> |
25 | <copyright> | 25 | <copyright> |
26 | <year>2008</year> | 26 | <year>2008-2010</year> |
27 | <holder>Renesas Technology Corp.</holder> | 27 | <holder>Renesas Technology Corp.</holder> |
28 | </copyright> | 28 | </copyright> |
29 | <copyright> | ||
30 | <year>2010</year> | ||
31 | <holder>Renesas Electronics Corp.</holder> | ||
32 | </copyright> | ||
29 | 33 | ||
30 | <legalnotice> | 34 | <legalnotice> |
31 | <para> | 35 | <para> |
@@ -77,7 +81,7 @@ | |||
77 | </chapter> | 81 | </chapter> |
78 | <chapter id="clk"> | 82 | <chapter id="clk"> |
79 | <title>Clock Framework Extensions</title> | 83 | <title>Clock Framework Extensions</title> |
80 | !Iarch/sh/include/asm/clock.h | 84 | !Iinclude/linux/sh_clk.h |
81 | </chapter> | 85 | </chapter> |
82 | <chapter id="mach"> | 86 | <chapter id="mach"> |
83 | <title>Machine Specific Interfaces</title> | 87 | <title>Machine Specific Interfaces</title> |
diff --git a/Documentation/DocBook/tracepoint.tmpl b/Documentation/DocBook/tracepoint.tmpl index 8bca1d5cec09..e8473eae2a20 100644 --- a/Documentation/DocBook/tracepoint.tmpl +++ b/Documentation/DocBook/tracepoint.tmpl | |||
@@ -16,6 +16,15 @@ | |||
16 | </address> | 16 | </address> |
17 | </affiliation> | 17 | </affiliation> |
18 | </author> | 18 | </author> |
19 | <author> | ||
20 | <firstname>William</firstname> | ||
21 | <surname>Cohen</surname> | ||
22 | <affiliation> | ||
23 | <address> | ||
24 | <email>wcohen@redhat.com</email> | ||
25 | </address> | ||
26 | </affiliation> | ||
27 | </author> | ||
19 | </authorgroup> | 28 | </authorgroup> |
20 | 29 | ||
21 | <legalnotice> | 30 | <legalnotice> |
@@ -91,4 +100,8 @@ | |||
91 | !Iinclude/trace/events/signal.h | 100 | !Iinclude/trace/events/signal.h |
92 | </chapter> | 101 | </chapter> |
93 | 102 | ||
103 | <chapter id="block"> | ||
104 | <title>Block IO</title> | ||
105 | !Iinclude/trace/events/block.h | ||
106 | </chapter> | ||
94 | </book> | 107 | </book> |
diff --git a/Documentation/DocBook/v4l/compat.xml b/Documentation/DocBook/v4l/compat.xml index b9dbdf9e6d29..b42b935913cd 100644 --- a/Documentation/DocBook/v4l/compat.xml +++ b/Documentation/DocBook/v4l/compat.xml | |||
@@ -2332,15 +2332,26 @@ more information.</para> | |||
2332 | </listitem> | 2332 | </listitem> |
2333 | </orderedlist> | 2333 | </orderedlist> |
2334 | </section> | 2334 | </section> |
2335 | </section> | 2335 | <section> |
2336 | <title>V4L2 in Linux 2.6.34</title> | ||
2337 | <orderedlist> | ||
2338 | <listitem> | ||
2339 | <para>Added | ||
2340 | <constant>V4L2_CID_IRIS_ABSOLUTE</constant> and | ||
2341 | <constant>V4L2_CID_IRIS_RELATIVE</constant> controls to the | ||
2342 | <link linkend="camera-controls">Camera controls class</link>. | ||
2343 | </para> | ||
2344 | </listitem> | ||
2345 | </orderedlist> | ||
2346 | </section> | ||
2336 | 2347 | ||
2337 | <section id="other"> | 2348 | <section id="other"> |
2338 | <title>Relation of V4L2 to other Linux multimedia APIs</title> | 2349 | <title>Relation of V4L2 to other Linux multimedia APIs</title> |
2339 | 2350 | ||
2340 | <section id="xvideo"> | 2351 | <section id="xvideo"> |
2341 | <title>X Video Extension</title> | 2352 | <title>X Video Extension</title> |
2342 | 2353 | ||
2343 | <para>The X Video Extension (abbreviated XVideo or just Xv) is | 2354 | <para>The X Video Extension (abbreviated XVideo or just Xv) is |
2344 | an extension of the X Window system, implemented for example by the | 2355 | an extension of the X Window system, implemented for example by the |
2345 | XFree86 project. Its scope is similar to V4L2, an API to video capture | 2356 | XFree86 project. Its scope is similar to V4L2, an API to video capture |
2346 | and output devices for X clients. Xv allows applications to display | 2357 | and output devices for X clients. Xv allows applications to display |
@@ -2351,7 +2362,7 @@ capture or output still images in XPixmaps<footnote> | |||
2351 | extension available across many operating systems and | 2362 | extension available across many operating systems and |
2352 | architectures.</para> | 2363 | architectures.</para> |
2353 | 2364 | ||
2354 | <para>Because the driver is embedded into the X server Xv has a | 2365 | <para>Because the driver is embedded into the X server Xv has a |
2355 | number of advantages over the V4L2 <link linkend="overlay">video | 2366 | number of advantages over the V4L2 <link linkend="overlay">video |
2356 | overlay interface</link>. The driver can easily determine the overlay | 2367 | overlay interface</link>. The driver can easily determine the overlay |
2357 | target, &ie; visible graphics memory or off-screen buffers for a | 2368 | target, &ie; visible graphics memory or off-screen buffers for a |
@@ -2360,16 +2371,16 @@ overlay, scaling or color-keying, or the clipping functions of the | |||
2360 | video capture hardware, always in sync with drawing operations or | 2371 | video capture hardware, always in sync with drawing operations or |
2361 | windows moving or changing their stacking order.</para> | 2372 | windows moving or changing their stacking order.</para> |
2362 | 2373 | ||
2363 | <para>To combine the advantages of Xv and V4L a special Xv | 2374 | <para>To combine the advantages of Xv and V4L a special Xv |
2364 | driver exists in XFree86 and XOrg, just programming any overlay capable | 2375 | driver exists in XFree86 and XOrg, just programming any overlay capable |
2365 | Video4Linux device it finds. To enable it | 2376 | Video4Linux device it finds. To enable it |
2366 | <filename>/etc/X11/XF86Config</filename> must contain these lines:</para> | 2377 | <filename>/etc/X11/XF86Config</filename> must contain these lines:</para> |
2367 | <para><screen> | 2378 | <para><screen> |
2368 | Section "Module" | 2379 | Section "Module" |
2369 | Load "v4l" | 2380 | Load "v4l" |
2370 | EndSection</screen></para> | 2381 | EndSection</screen></para> |
2371 | 2382 | ||
2372 | <para>As of XFree86 4.2 this driver still supports only V4L | 2383 | <para>As of XFree86 4.2 this driver still supports only V4L |
2373 | ioctls, however it should work just fine with all V4L2 devices through | 2384 | ioctls, however it should work just fine with all V4L2 devices through |
2374 | the V4L2 backward-compatibility layer. Since V4L2 permits multiple | 2385 | the V4L2 backward-compatibility layer. Since V4L2 permits multiple |
2375 | opens it is possible (if supported by the V4L2 driver) to capture | 2386 | opens it is possible (if supported by the V4L2 driver) to capture |
@@ -2377,83 +2388,84 @@ video while an X client requested video overlay. Restrictions of | |||
2377 | simultaneous capturing and overlay are discussed in <xref | 2388 | simultaneous capturing and overlay are discussed in <xref |
2378 | linkend="overlay" /> apply.</para> | 2389 | linkend="overlay" /> apply.</para> |
2379 | 2390 | ||
2380 | <para>Only marginally related to V4L2, XFree86 extended Xv to | 2391 | <para>Only marginally related to V4L2, XFree86 extended Xv to |
2381 | support hardware YUV to RGB conversion and scaling for faster video | 2392 | support hardware YUV to RGB conversion and scaling for faster video |
2382 | playback, and added an interface to MPEG-2 decoding hardware. This API | 2393 | playback, and added an interface to MPEG-2 decoding hardware. This API |
2383 | is useful to display images captured with V4L2 devices.</para> | 2394 | is useful to display images captured with V4L2 devices.</para> |
2384 | </section> | 2395 | </section> |
2385 | 2396 | ||
2386 | <section> | 2397 | <section> |
2387 | <title>Digital Video</title> | 2398 | <title>Digital Video</title> |
2388 | 2399 | ||
2389 | <para>V4L2 does not support digital terrestrial, cable or | 2400 | <para>V4L2 does not support digital terrestrial, cable or |
2390 | satellite broadcast. A separate project aiming at digital receivers | 2401 | satellite broadcast. A separate project aiming at digital receivers |
2391 | exists. You can find its homepage at <ulink | 2402 | exists. You can find its homepage at <ulink |
2392 | url="http://linuxtv.org">http://linuxtv.org</ulink>. The Linux DVB API | 2403 | url="http://linuxtv.org">http://linuxtv.org</ulink>. The Linux DVB API |
2393 | has no connection to the V4L2 API except that drivers for hybrid | 2404 | has no connection to the V4L2 API except that drivers for hybrid |
2394 | hardware may support both.</para> | 2405 | hardware may support both.</para> |
2395 | </section> | 2406 | </section> |
2396 | 2407 | ||
2397 | <section> | 2408 | <section> |
2398 | <title>Audio Interfaces</title> | 2409 | <title>Audio Interfaces</title> |
2399 | 2410 | ||
2400 | <para>[to do - OSS/ALSA]</para> | 2411 | <para>[to do - OSS/ALSA]</para> |
2412 | </section> | ||
2401 | </section> | 2413 | </section> |
2402 | </section> | ||
2403 | 2414 | ||
2404 | <section id="experimental"> | 2415 | <section id="experimental"> |
2405 | <title>Experimental API Elements</title> | 2416 | <title>Experimental API Elements</title> |
2406 | 2417 | ||
2407 | <para>The following V4L2 API elements are currently experimental | 2418 | <para>The following V4L2 API elements are currently experimental |
2408 | and may change in the future.</para> | 2419 | and may change in the future.</para> |
2409 | 2420 | ||
2410 | <itemizedlist> | 2421 | <itemizedlist> |
2411 | <listitem> | 2422 | <listitem> |
2412 | <para>Video Output Overlay (OSD) Interface, <xref | 2423 | <para>Video Output Overlay (OSD) Interface, <xref |
2413 | linkend="osd" />.</para> | 2424 | linkend="osd" />.</para> |
2414 | </listitem> | 2425 | </listitem> |
2415 | <listitem> | 2426 | <listitem> |
2416 | <para><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY</constant>, | 2427 | <para><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY</constant>, |
2417 | &v4l2-buf-type;, <xref linkend="v4l2-buf-type" />.</para> | 2428 | &v4l2-buf-type;, <xref linkend="v4l2-buf-type" />.</para> |
2418 | </listitem> | 2429 | </listitem> |
2419 | <listitem> | 2430 | <listitem> |
2420 | <para><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant>, | 2431 | <para><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant>, |
2421 | &VIDIOC-QUERYCAP; ioctl, <xref linkend="device-capabilities" />.</para> | 2432 | &VIDIOC-QUERYCAP; ioctl, <xref linkend="device-capabilities" />.</para> |
2422 | </listitem> | 2433 | </listitem> |
2423 | <listitem> | 2434 | <listitem> |
2424 | <para>&VIDIOC-ENUM-FRAMESIZES; and | 2435 | <para>&VIDIOC-ENUM-FRAMESIZES; and |
2425 | &VIDIOC-ENUM-FRAMEINTERVALS; ioctls.</para> | 2436 | &VIDIOC-ENUM-FRAMEINTERVALS; ioctls.</para> |
2426 | </listitem> | 2437 | </listitem> |
2427 | <listitem> | 2438 | <listitem> |
2428 | <para>&VIDIOC-G-ENC-INDEX; ioctl.</para> | 2439 | <para>&VIDIOC-G-ENC-INDEX; ioctl.</para> |
2429 | </listitem> | 2440 | </listitem> |
2430 | <listitem> | 2441 | <listitem> |
2431 | <para>&VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD; | 2442 | <para>&VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD; |
2432 | ioctls.</para> | 2443 | ioctls.</para> |
2433 | </listitem> | 2444 | </listitem> |
2434 | <listitem> | 2445 | <listitem> |
2435 | <para>&VIDIOC-DBG-G-REGISTER; and &VIDIOC-DBG-S-REGISTER; | 2446 | <para>&VIDIOC-DBG-G-REGISTER; and &VIDIOC-DBG-S-REGISTER; |
2436 | ioctls.</para> | 2447 | ioctls.</para> |
2437 | </listitem> | 2448 | </listitem> |
2438 | <listitem> | 2449 | <listitem> |
2439 | <para>&VIDIOC-DBG-G-CHIP-IDENT; ioctl.</para> | 2450 | <para>&VIDIOC-DBG-G-CHIP-IDENT; ioctl.</para> |
2440 | </listitem> | 2451 | </listitem> |
2441 | </itemizedlist> | 2452 | </itemizedlist> |
2442 | </section> | 2453 | </section> |
2443 | 2454 | ||
2444 | <section id="obsolete"> | 2455 | <section id="obsolete"> |
2445 | <title>Obsolete API Elements</title> | 2456 | <title>Obsolete API Elements</title> |
2446 | 2457 | ||
2447 | <para>The following V4L2 API elements were superseded by new | 2458 | <para>The following V4L2 API elements were superseded by new |
2448 | interfaces and should not be implemented in new drivers.</para> | 2459 | interfaces and should not be implemented in new drivers.</para> |
2449 | 2460 | ||
2450 | <itemizedlist> | 2461 | <itemizedlist> |
2451 | <listitem> | 2462 | <listitem> |
2452 | <para><constant>VIDIOC_G_MPEGCOMP</constant> and | 2463 | <para><constant>VIDIOC_G_MPEGCOMP</constant> and |
2453 | <constant>VIDIOC_S_MPEGCOMP</constant> ioctls. Use Extended Controls, | 2464 | <constant>VIDIOC_S_MPEGCOMP</constant> ioctls. Use Extended Controls, |
2454 | <xref linkend="extended-controls" />.</para> | 2465 | <xref linkend="extended-controls" />.</para> |
2455 | </listitem> | 2466 | </listitem> |
2456 | </itemizedlist> | 2467 | </itemizedlist> |
2468 | </section> | ||
2457 | </section> | 2469 | </section> |
2458 | 2470 | ||
2459 | <!-- | 2471 | <!-- |
diff --git a/Documentation/DocBook/v4l/controls.xml b/Documentation/DocBook/v4l/controls.xml index f46450610412..8408caaee276 100644 --- a/Documentation/DocBook/v4l/controls.xml +++ b/Documentation/DocBook/v4l/controls.xml | |||
@@ -267,6 +267,12 @@ minimum value disables backlight compensation.</entry> | |||
267 | <entry>Chroma automatic gain control.</entry> | 267 | <entry>Chroma automatic gain control.</entry> |
268 | </row> | 268 | </row> |
269 | <row> | 269 | <row> |
270 | <entry><constant>V4L2_CID_CHROMA_GAIN</constant></entry> | ||
271 | <entry>integer</entry> | ||
272 | <entry>Adjusts the Chroma gain control (for use when chroma AGC | ||
273 | is disabled).</entry> | ||
274 | </row> | ||
275 | <row> | ||
270 | <entry><constant>V4L2_CID_COLOR_KILLER</constant></entry> | 276 | <entry><constant>V4L2_CID_COLOR_KILLER</constant></entry> |
271 | <entry>boolean</entry> | 277 | <entry>boolean</entry> |
272 | <entry>Enable the color killer (&ie; force a black & white image in case of a weak video signal).</entry> | 278 | <entry>Enable the color killer (&ie; force a black & white image in case of a weak video signal).</entry> |
@@ -277,8 +283,15 @@ minimum value disables backlight compensation.</entry> | |||
277 | <entry>Selects a color effect. Possible values for | 283 | <entry>Selects a color effect. Possible values for |
278 | <constant>enum v4l2_colorfx</constant> are: | 284 | <constant>enum v4l2_colorfx</constant> are: |
279 | <constant>V4L2_COLORFX_NONE</constant> (0), | 285 | <constant>V4L2_COLORFX_NONE</constant> (0), |
280 | <constant>V4L2_COLORFX_BW</constant> (1) and | 286 | <constant>V4L2_COLORFX_BW</constant> (1), |
281 | <constant>V4L2_COLORFX_SEPIA</constant> (2).</entry> | 287 | <constant>V4L2_COLORFX_SEPIA</constant> (2), |
288 | <constant>V4L2_COLORFX_NEGATIVE</constant> (3), | ||
289 | <constant>V4L2_COLORFX_EMBOSS</constant> (4), | ||
290 | <constant>V4L2_COLORFX_SKETCH</constant> (5), | ||
291 | <constant>V4L2_COLORFX_SKY_BLUE</constant> (6), | ||
292 | <constant>V4L2_COLORFX_GRASS_GREEN</constant> (7), | ||
293 | <constant>V4L2_COLORFX_SKIN_WHITEN</constant> (8) and | ||
294 | <constant>V4L2_COLORFX_VIVID</constant> (9).</entry> | ||
282 | </row> | 295 | </row> |
283 | <row> | 296 | <row> |
284 | <entry><constant>V4L2_CID_ROTATE</constant></entry> | 297 | <entry><constant>V4L2_CID_ROTATE</constant></entry> |
@@ -1825,6 +1838,25 @@ wide-angle direction. The zoom speed unit is driver-specific.</entry> | |||
1825 | <row><entry></entry></row> | 1838 | <row><entry></entry></row> |
1826 | 1839 | ||
1827 | <row> | 1840 | <row> |
1841 | <entry spanname="id"><constant>V4L2_CID_IRIS_ABSOLUTE</constant> </entry> | ||
1842 | <entry>integer</entry> | ||
1843 | </row><row><entry spanname="descr">This control sets the | ||
1844 | camera's aperture to the specified value. The unit is undefined. | ||
1845 | Larger values open the iris wider, smaller values close it.</entry> | ||
1846 | </row> | ||
1847 | <row><entry></entry></row> | ||
1848 | |||
1849 | <row> | ||
1850 | <entry spanname="id"><constant>V4L2_CID_IRIS_RELATIVE</constant> </entry> | ||
1851 | <entry>integer</entry> | ||
1852 | </row><row><entry spanname="descr">This control modifies the | ||
1853 | camera's aperture by the specified amount. The unit is undefined. | ||
1854 | Positive values open the iris one step further, negative values close | ||
1855 | it one step further. This is a write-only control.</entry> | ||
1856 | </row> | ||
1857 | <row><entry></entry></row> | ||
1858 | |||
1859 | <row> | ||
1828 | <entry spanname="id"><constant>V4L2_CID_PRIVACY</constant> </entry> | 1860 | <entry spanname="id"><constant>V4L2_CID_PRIVACY</constant> </entry> |
1829 | <entry>boolean</entry> | 1861 | <entry>boolean</entry> |
1830 | </row><row><entry spanname="descr">Prevent video from being acquired | 1862 | </row><row><entry spanname="descr">Prevent video from being acquired |
diff --git a/Documentation/DocBook/v4l/dev-event.xml b/Documentation/DocBook/v4l/dev-event.xml new file mode 100644 index 000000000000..be5a98fb4fab --- /dev/null +++ b/Documentation/DocBook/v4l/dev-event.xml | |||
@@ -0,0 +1,31 @@ | |||
1 | <title>Event Interface</title> | ||
2 | |||
3 | <para>The V4L2 event interface provides means for user to get | ||
4 | immediately notified on certain conditions taking place on a device. | ||
5 | This might include start of frame or loss of signal events, for | ||
6 | example. | ||
7 | </para> | ||
8 | |||
9 | <para>To receive events, the events the user is interested in first must | ||
10 | be subscribed using the &VIDIOC-SUBSCRIBE-EVENT; ioctl. Once an event is | ||
11 | subscribed, the events of subscribed types are dequeueable using the | ||
12 | &VIDIOC-DQEVENT; ioctl. Events may be unsubscribed using | ||
13 | VIDIOC_UNSUBSCRIBE_EVENT ioctl. The special event type V4L2_EVENT_ALL may | ||
14 | be used to unsubscribe all the events the driver supports.</para> | ||
15 | |||
16 | <para>The event subscriptions and event queues are specific to file | ||
17 | handles. Subscribing an event on one file handle does not affect | ||
18 | other file handles. | ||
19 | </para> | ||
20 | |||
21 | <para>The information on dequeueable events is obtained by using select or | ||
22 | poll system calls on video devices. The V4L2 events use POLLPRI events on | ||
23 | poll system call and exceptions on select system call. </para> | ||
24 | |||
25 | <!-- | ||
26 | Local Variables: | ||
27 | mode: sgml | ||
28 | sgml-parent-document: "v4l2.sgml" | ||
29 | indent-tabs-mode: nil | ||
30 | End: | ||
31 | --> | ||
diff --git a/Documentation/DocBook/v4l/io.xml b/Documentation/DocBook/v4l/io.xml index e870330cbf77..d424886beda0 100644 --- a/Documentation/DocBook/v4l/io.xml +++ b/Documentation/DocBook/v4l/io.xml | |||
@@ -702,6 +702,16 @@ They can be both cleared however, then the buffer is in "dequeued" | |||
702 | state, in the application domain to say so.</entry> | 702 | state, in the application domain to say so.</entry> |
703 | </row> | 703 | </row> |
704 | <row> | 704 | <row> |
705 | <entry><constant>V4L2_BUF_FLAG_ERROR</constant></entry> | ||
706 | <entry>0x0040</entry> | ||
707 | <entry>When this flag is set, the buffer has been dequeued | ||
708 | successfully, although the data might have been corrupted. | ||
709 | This is recoverable, streaming may continue as normal and | ||
710 | the buffer may be reused normally. | ||
711 | Drivers set this flag when the <constant>VIDIOC_DQBUF</constant> | ||
712 | ioctl is called.</entry> | ||
713 | </row> | ||
714 | <row> | ||
705 | <entry><constant>V4L2_BUF_FLAG_KEYFRAME</constant></entry> | 715 | <entry><constant>V4L2_BUF_FLAG_KEYFRAME</constant></entry> |
706 | <entry>0x0008</entry> | 716 | <entry>0x0008</entry> |
707 | <entry>Drivers set or clear this flag when calling the | 717 | <entry>Drivers set or clear this flag when calling the |
@@ -918,8 +928,8 @@ order</emphasis>.</para> | |||
918 | 928 | ||
919 | <para>When the driver provides or accepts images field by field | 929 | <para>When the driver provides or accepts images field by field |
920 | rather than interleaved, it is also important applications understand | 930 | rather than interleaved, it is also important applications understand |
921 | how the fields combine to frames. We distinguish between top and | 931 | how the fields combine to frames. We distinguish between top (aka odd) and |
922 | bottom fields, the <emphasis>spatial order</emphasis>: The first line | 932 | bottom (aka even) fields, the <emphasis>spatial order</emphasis>: The first line |
923 | of the top field is the first line of an interlaced frame, the first | 933 | of the top field is the first line of an interlaced frame, the first |
924 | line of the bottom field is the second line of that frame.</para> | 934 | line of the bottom field is the second line of that frame.</para> |
925 | 935 | ||
@@ -972,12 +982,12 @@ between <constant>V4L2_FIELD_TOP</constant> and | |||
972 | <row> | 982 | <row> |
973 | <entry><constant>V4L2_FIELD_TOP</constant></entry> | 983 | <entry><constant>V4L2_FIELD_TOP</constant></entry> |
974 | <entry>2</entry> | 984 | <entry>2</entry> |
975 | <entry>Images consist of the top field only.</entry> | 985 | <entry>Images consist of the top (aka odd) field only.</entry> |
976 | </row> | 986 | </row> |
977 | <row> | 987 | <row> |
978 | <entry><constant>V4L2_FIELD_BOTTOM</constant></entry> | 988 | <entry><constant>V4L2_FIELD_BOTTOM</constant></entry> |
979 | <entry>3</entry> | 989 | <entry>3</entry> |
980 | <entry>Images consist of the bottom field only. | 990 | <entry>Images consist of the bottom (aka even) field only. |
981 | Applications may wish to prevent a device from capturing interlaced | 991 | Applications may wish to prevent a device from capturing interlaced |
982 | images because they will have "comb" or "feathering" artefacts around | 992 | images because they will have "comb" or "feathering" artefacts around |
983 | moving objects.</entry> | 993 | moving objects.</entry> |
diff --git a/Documentation/DocBook/v4l/pixfmt.xml b/Documentation/DocBook/v4l/pixfmt.xml index 885968d6a2fc..c4ad0a8e42dc 100644 --- a/Documentation/DocBook/v4l/pixfmt.xml +++ b/Documentation/DocBook/v4l/pixfmt.xml | |||
@@ -792,6 +792,18 @@ http://www.thedirks.org/winnov/</ulink></para></entry> | |||
792 | <entry>'YYUV'</entry> | 792 | <entry>'YYUV'</entry> |
793 | <entry>unknown</entry> | 793 | <entry>unknown</entry> |
794 | </row> | 794 | </row> |
795 | <row id="V4L2-PIX-FMT-Y4"> | ||
796 | <entry><constant>V4L2_PIX_FMT_Y4</constant></entry> | ||
797 | <entry>'Y04 '</entry> | ||
798 | <entry>Old 4-bit greyscale format. Only the least significant 4 bits of each byte are used, | ||
799 | the other bits are set to 0.</entry> | ||
800 | </row> | ||
801 | <row id="V4L2-PIX-FMT-Y6"> | ||
802 | <entry><constant>V4L2_PIX_FMT_Y6</constant></entry> | ||
803 | <entry>'Y06 '</entry> | ||
804 | <entry>Old 6-bit greyscale format. Only the least significant 6 bits of each byte are used, | ||
805 | the other bits are set to 0.</entry> | ||
806 | </row> | ||
795 | </tbody> | 807 | </tbody> |
796 | </tgroup> | 808 | </tgroup> |
797 | </table> | 809 | </table> |
diff --git a/Documentation/DocBook/v4l/v4l2.xml b/Documentation/DocBook/v4l/v4l2.xml index 060105af49e5..9737243377a3 100644 --- a/Documentation/DocBook/v4l/v4l2.xml +++ b/Documentation/DocBook/v4l/v4l2.xml | |||
@@ -401,6 +401,7 @@ and discussions on the V4L mailing list.</revremark> | |||
401 | <section id="ttx"> &sub-dev-teletext; </section> | 401 | <section id="ttx"> &sub-dev-teletext; </section> |
402 | <section id="radio"> &sub-dev-radio; </section> | 402 | <section id="radio"> &sub-dev-radio; </section> |
403 | <section id="rds"> &sub-dev-rds; </section> | 403 | <section id="rds"> &sub-dev-rds; </section> |
404 | <section id="event"> &sub-dev-event; </section> | ||
404 | </chapter> | 405 | </chapter> |
405 | 406 | ||
406 | <chapter id="driver"> | 407 | <chapter id="driver"> |
@@ -426,6 +427,7 @@ and discussions on the V4L mailing list.</revremark> | |||
426 | &sub-cropcap; | 427 | &sub-cropcap; |
427 | &sub-dbg-g-chip-ident; | 428 | &sub-dbg-g-chip-ident; |
428 | &sub-dbg-g-register; | 429 | &sub-dbg-g-register; |
430 | &sub-dqevent; | ||
429 | &sub-encoder-cmd; | 431 | &sub-encoder-cmd; |
430 | &sub-enumaudio; | 432 | &sub-enumaudio; |
431 | &sub-enumaudioout; | 433 | &sub-enumaudioout; |
@@ -467,6 +469,7 @@ and discussions on the V4L mailing list.</revremark> | |||
467 | &sub-reqbufs; | 469 | &sub-reqbufs; |
468 | &sub-s-hw-freq-seek; | 470 | &sub-s-hw-freq-seek; |
469 | &sub-streamon; | 471 | &sub-streamon; |
472 | &sub-subscribe-event; | ||
470 | <!-- End of ioctls. --> | 473 | <!-- End of ioctls. --> |
471 | &sub-mmap; | 474 | &sub-mmap; |
472 | &sub-munmap; | 475 | &sub-munmap; |
diff --git a/Documentation/DocBook/v4l/videodev2.h.xml b/Documentation/DocBook/v4l/videodev2.h.xml index 068325940658..865b06d9e679 100644 --- a/Documentation/DocBook/v4l/videodev2.h.xml +++ b/Documentation/DocBook/v4l/videodev2.h.xml | |||
@@ -1018,6 +1018,13 @@ enum <link linkend="v4l2-colorfx">v4l2_colorfx</link> { | |||
1018 | V4L2_COLORFX_NONE = 0, | 1018 | V4L2_COLORFX_NONE = 0, |
1019 | V4L2_COLORFX_BW = 1, | 1019 | V4L2_COLORFX_BW = 1, |
1020 | V4L2_COLORFX_SEPIA = 2, | 1020 | V4L2_COLORFX_SEPIA = 2, |
1021 | V4L2_COLORFX_NEGATIVE = 3, | ||
1022 | V4L2_COLORFX_EMBOSS = 4, | ||
1023 | V4L2_COLORFX_SKETCH = 5, | ||
1024 | V4L2_COLORFX_SKY_BLUE = 6, | ||
1025 | V4L2_COLORFX_GRASS_GREEN = 7, | ||
1026 | V4L2_COLORFX_SKIN_WHITEN = 8, | ||
1027 | V4L2_COLORFX_VIVID = 9. | ||
1021 | }; | 1028 | }; |
1022 | #define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) | 1029 | #define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) |
1023 | #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) | 1030 | #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) |
@@ -1271,6 +1278,9 @@ enum <link linkend="v4l2-exposure-auto-type">v4l2_exposure_auto_type</link> { | |||
1271 | 1278 | ||
1272 | #define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) | 1279 | #define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) |
1273 | 1280 | ||
1281 | #define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17) | ||
1282 | #define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) | ||
1283 | |||
1274 | /* FM Modulator class control IDs */ | 1284 | /* FM Modulator class control IDs */ |
1275 | #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) | 1285 | #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) |
1276 | #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) | 1286 | #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) |
diff --git a/Documentation/DocBook/v4l/vidioc-dqevent.xml b/Documentation/DocBook/v4l/vidioc-dqevent.xml new file mode 100644 index 000000000000..4e0a7cc30812 --- /dev/null +++ b/Documentation/DocBook/v4l/vidioc-dqevent.xml | |||
@@ -0,0 +1,131 @@ | |||
1 | <refentry id="vidioc-dqevent"> | ||
2 | <refmeta> | ||
3 | <refentrytitle>ioctl VIDIOC_DQEVENT</refentrytitle> | ||
4 | &manvol; | ||
5 | </refmeta> | ||
6 | |||
7 | <refnamediv> | ||
8 | <refname>VIDIOC_DQEVENT</refname> | ||
9 | <refpurpose>Dequeue event</refpurpose> | ||
10 | </refnamediv> | ||
11 | |||
12 | <refsynopsisdiv> | ||
13 | <funcsynopsis> | ||
14 | <funcprototype> | ||
15 | <funcdef>int <function>ioctl</function></funcdef> | ||
16 | <paramdef>int <parameter>fd</parameter></paramdef> | ||
17 | <paramdef>int <parameter>request</parameter></paramdef> | ||
18 | <paramdef>struct v4l2_event | ||
19 | *<parameter>argp</parameter></paramdef> | ||
20 | </funcprototype> | ||
21 | </funcsynopsis> | ||
22 | </refsynopsisdiv> | ||
23 | |||
24 | <refsect1> | ||
25 | <title>Arguments</title> | ||
26 | |||
27 | <variablelist> | ||
28 | <varlistentry> | ||
29 | <term><parameter>fd</parameter></term> | ||
30 | <listitem> | ||
31 | <para>&fd;</para> | ||
32 | </listitem> | ||
33 | </varlistentry> | ||
34 | <varlistentry> | ||
35 | <term><parameter>request</parameter></term> | ||
36 | <listitem> | ||
37 | <para>VIDIOC_DQEVENT</para> | ||
38 | </listitem> | ||
39 | </varlistentry> | ||
40 | <varlistentry> | ||
41 | <term><parameter>argp</parameter></term> | ||
42 | <listitem> | ||
43 | <para></para> | ||
44 | </listitem> | ||
45 | </varlistentry> | ||
46 | </variablelist> | ||
47 | </refsect1> | ||
48 | |||
49 | <refsect1> | ||
50 | <title>Description</title> | ||
51 | |||
52 | <para>Dequeue an event from a video device. No input is required | ||
53 | for this ioctl. All the fields of the &v4l2-event; structure are | ||
54 | filled by the driver. The file handle will also receive exceptions | ||
55 | which the application may get by e.g. using the select system | ||
56 | call.</para> | ||
57 | |||
58 | <table frame="none" pgwide="1" id="v4l2-event"> | ||
59 | <title>struct <structname>v4l2_event</structname></title> | ||
60 | <tgroup cols="4"> | ||
61 | &cs-str; | ||
62 | <tbody valign="top"> | ||
63 | <row> | ||
64 | <entry>__u32</entry> | ||
65 | <entry><structfield>type</structfield></entry> | ||
66 | <entry></entry> | ||
67 | <entry>Type of the event.</entry> | ||
68 | </row> | ||
69 | <row> | ||
70 | <entry>union</entry> | ||
71 | <entry><structfield>u</structfield></entry> | ||
72 | <entry></entry> | ||
73 | <entry></entry> | ||
74 | </row> | ||
75 | <row> | ||
76 | <entry></entry> | ||
77 | <entry>&v4l2-event-vsync;</entry> | ||
78 | <entry><structfield>vsync</structfield></entry> | ||
79 | <entry>Event data for event V4L2_EVENT_VSYNC. | ||
80 | </entry> | ||
81 | </row> | ||
82 | <row> | ||
83 | <entry></entry> | ||
84 | <entry>__u8</entry> | ||
85 | <entry><structfield>data</structfield>[64]</entry> | ||
86 | <entry>Event data. Defined by the event type. The union | ||
87 | should be used to define easily accessible type for | ||
88 | events.</entry> | ||
89 | </row> | ||
90 | <row> | ||
91 | <entry>__u32</entry> | ||
92 | <entry><structfield>pending</structfield></entry> | ||
93 | <entry></entry> | ||
94 | <entry>Number of pending events excluding this one.</entry> | ||
95 | </row> | ||
96 | <row> | ||
97 | <entry>__u32</entry> | ||
98 | <entry><structfield>sequence</structfield></entry> | ||
99 | <entry></entry> | ||
100 | <entry>Event sequence number. The sequence number is | ||
101 | incremented for every subscribed event that takes place. | ||
102 | If sequence numbers are not contiguous it means that | ||
103 | events have been lost. | ||
104 | </entry> | ||
105 | </row> | ||
106 | <row> | ||
107 | <entry>struct timespec</entry> | ||
108 | <entry><structfield>timestamp</structfield></entry> | ||
109 | <entry></entry> | ||
110 | <entry>Event timestamp.</entry> | ||
111 | </row> | ||
112 | <row> | ||
113 | <entry>__u32</entry> | ||
114 | <entry><structfield>reserved</structfield>[9]</entry> | ||
115 | <entry></entry> | ||
116 | <entry>Reserved for future extensions. Drivers must set | ||
117 | the array to zero.</entry> | ||
118 | </row> | ||
119 | </tbody> | ||
120 | </tgroup> | ||
121 | </table> | ||
122 | |||
123 | </refsect1> | ||
124 | </refentry> | ||
125 | <!-- | ||
126 | Local Variables: | ||
127 | mode: sgml | ||
128 | sgml-parent-document: "v4l2.sgml" | ||
129 | indent-tabs-mode: nil | ||
130 | End: | ||
131 | --> | ||
diff --git a/Documentation/DocBook/v4l/vidioc-enuminput.xml b/Documentation/DocBook/v4l/vidioc-enuminput.xml index 71b868e2fb8f..476fe1d2bba0 100644 --- a/Documentation/DocBook/v4l/vidioc-enuminput.xml +++ b/Documentation/DocBook/v4l/vidioc-enuminput.xml | |||
@@ -283,7 +283,7 @@ input/output interface to linux-media@vger.kernel.org on 19 Oct 2009. | |||
283 | <entry>This input supports setting DV presets by using VIDIOC_S_DV_PRESET.</entry> | 283 | <entry>This input supports setting DV presets by using VIDIOC_S_DV_PRESET.</entry> |
284 | </row> | 284 | </row> |
285 | <row> | 285 | <row> |
286 | <entry><constant>V4L2_OUT_CAP_CUSTOM_TIMINGS</constant></entry> | 286 | <entry><constant>V4L2_IN_CAP_CUSTOM_TIMINGS</constant></entry> |
287 | <entry>0x00000002</entry> | 287 | <entry>0x00000002</entry> |
288 | <entry>This input supports setting custom video timings by using VIDIOC_S_DV_TIMINGS.</entry> | 288 | <entry>This input supports setting custom video timings by using VIDIOC_S_DV_TIMINGS.</entry> |
289 | </row> | 289 | </row> |
diff --git a/Documentation/DocBook/v4l/vidioc-qbuf.xml b/Documentation/DocBook/v4l/vidioc-qbuf.xml index b843bd7b3897..ab691ebf3b93 100644 --- a/Documentation/DocBook/v4l/vidioc-qbuf.xml +++ b/Documentation/DocBook/v4l/vidioc-qbuf.xml | |||
@@ -111,7 +111,11 @@ from the driver's outgoing queue. They just set the | |||
111 | and <structfield>reserved</structfield> | 111 | and <structfield>reserved</structfield> |
112 | fields of a &v4l2-buffer; as above, when <constant>VIDIOC_DQBUF</constant> | 112 | fields of a &v4l2-buffer; as above, when <constant>VIDIOC_DQBUF</constant> |
113 | is called with a pointer to this structure the driver fills the | 113 | is called with a pointer to this structure the driver fills the |
114 | remaining fields or returns an error code.</para> | 114 | remaining fields or returns an error code. The driver may also set |
115 | <constant>V4L2_BUF_FLAG_ERROR</constant> in the <structfield>flags</structfield> | ||
116 | field. It indicates a non-critical (recoverable) streaming error. In such case | ||
117 | the application may continue as normal, but should be aware that data in the | ||
118 | dequeued buffer might be corrupted.</para> | ||
115 | 119 | ||
116 | <para>By default <constant>VIDIOC_DQBUF</constant> blocks when no | 120 | <para>By default <constant>VIDIOC_DQBUF</constant> blocks when no |
117 | buffer is in the outgoing queue. When the | 121 | buffer is in the outgoing queue. When the |
@@ -158,7 +162,13 @@ enqueue a user pointer buffer.</para> | |||
158 | <para><constant>VIDIOC_DQBUF</constant> failed due to an | 162 | <para><constant>VIDIOC_DQBUF</constant> failed due to an |
159 | internal error. Can also indicate temporary problems like signal | 163 | internal error. Can also indicate temporary problems like signal |
160 | loss. Note the driver might dequeue an (empty) buffer despite | 164 | loss. Note the driver might dequeue an (empty) buffer despite |
161 | returning an error, or even stop capturing.</para> | 165 | returning an error, or even stop capturing. Reusing such buffer may be unsafe |
166 | though and its details (e.g. <structfield>index</structfield>) may not be | ||
167 | returned either. It is recommended that drivers indicate recoverable errors | ||
168 | by setting the <constant>V4L2_BUF_FLAG_ERROR</constant> and returning 0 instead. | ||
169 | In that case the application should be able to safely reuse the buffer and | ||
170 | continue streaming. | ||
171 | </para> | ||
162 | </listitem> | 172 | </listitem> |
163 | </varlistentry> | 173 | </varlistentry> |
164 | </variablelist> | 174 | </variablelist> |
diff --git a/Documentation/DocBook/v4l/vidioc-queryctrl.xml b/Documentation/DocBook/v4l/vidioc-queryctrl.xml index 4876ff1a1a04..8e0e055ac934 100644 --- a/Documentation/DocBook/v4l/vidioc-queryctrl.xml +++ b/Documentation/DocBook/v4l/vidioc-queryctrl.xml | |||
@@ -325,7 +325,7 @@ should be part of the control documentation.</entry> | |||
325 | <entry>n/a</entry> | 325 | <entry>n/a</entry> |
326 | <entry>This is not a control. When | 326 | <entry>This is not a control. When |
327 | <constant>VIDIOC_QUERYCTRL</constant> is called with a control ID | 327 | <constant>VIDIOC_QUERYCTRL</constant> is called with a control ID |
328 | equal to a control class code (see <xref linkend="ctrl-class" />), the | 328 | equal to a control class code (see <xref linkend="ctrl-class" />) + 1, the |
329 | ioctl returns the name of the control class and this control type. | 329 | ioctl returns the name of the control class and this control type. |
330 | Older drivers which do not support this feature return an | 330 | Older drivers which do not support this feature return an |
331 | &EINVAL;.</entry> | 331 | &EINVAL;.</entry> |
diff --git a/Documentation/DocBook/v4l/vidioc-reqbufs.xml b/Documentation/DocBook/v4l/vidioc-reqbufs.xml index 1c0816372074..69800ae23348 100644 --- a/Documentation/DocBook/v4l/vidioc-reqbufs.xml +++ b/Documentation/DocBook/v4l/vidioc-reqbufs.xml | |||
@@ -61,7 +61,7 @@ fields of the <structname>v4l2_requestbuffers</structname> structure. | |||
61 | They set the <structfield>type</structfield> field to the respective | 61 | They set the <structfield>type</structfield> field to the respective |
62 | stream or buffer type, the <structfield>count</structfield> field to | 62 | stream or buffer type, the <structfield>count</structfield> field to |
63 | the desired number of buffers, <structfield>memory</structfield> | 63 | the desired number of buffers, <structfield>memory</structfield> |
64 | must be set to the requested I/O method and the reserved array | 64 | must be set to the requested I/O method and the <structfield>reserved</structfield> array |
65 | must be zeroed. When the ioctl | 65 | must be zeroed. When the ioctl |
66 | is called with a pointer to this structure the driver will attempt to allocate | 66 | is called with a pointer to this structure the driver will attempt to allocate |
67 | the requested number of buffers and it stores the actual number | 67 | the requested number of buffers and it stores the actual number |
diff --git a/Documentation/DocBook/v4l/vidioc-subscribe-event.xml b/Documentation/DocBook/v4l/vidioc-subscribe-event.xml new file mode 100644 index 000000000000..8b501791aa68 --- /dev/null +++ b/Documentation/DocBook/v4l/vidioc-subscribe-event.xml | |||
@@ -0,0 +1,133 @@ | |||
1 | <refentry id="vidioc-subscribe-event"> | ||
2 | <refmeta> | ||
3 | <refentrytitle>ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</refentrytitle> | ||
4 | &manvol; | ||
5 | </refmeta> | ||
6 | |||
7 | <refnamediv> | ||
8 | <refname>VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</refname> | ||
9 | <refpurpose>Subscribe or unsubscribe event</refpurpose> | ||
10 | </refnamediv> | ||
11 | |||
12 | <refsynopsisdiv> | ||
13 | <funcsynopsis> | ||
14 | <funcprototype> | ||
15 | <funcdef>int <function>ioctl</function></funcdef> | ||
16 | <paramdef>int <parameter>fd</parameter></paramdef> | ||
17 | <paramdef>int <parameter>request</parameter></paramdef> | ||
18 | <paramdef>struct v4l2_event_subscription | ||
19 | *<parameter>argp</parameter></paramdef> | ||
20 | </funcprototype> | ||
21 | </funcsynopsis> | ||
22 | </refsynopsisdiv> | ||
23 | |||
24 | <refsect1> | ||
25 | <title>Arguments</title> | ||
26 | |||
27 | <variablelist> | ||
28 | <varlistentry> | ||
29 | <term><parameter>fd</parameter></term> | ||
30 | <listitem> | ||
31 | <para>&fd;</para> | ||
32 | </listitem> | ||
33 | </varlistentry> | ||
34 | <varlistentry> | ||
35 | <term><parameter>request</parameter></term> | ||
36 | <listitem> | ||
37 | <para>VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</para> | ||
38 | </listitem> | ||
39 | </varlistentry> | ||
40 | <varlistentry> | ||
41 | <term><parameter>argp</parameter></term> | ||
42 | <listitem> | ||
43 | <para></para> | ||
44 | </listitem> | ||
45 | </varlistentry> | ||
46 | </variablelist> | ||
47 | </refsect1> | ||
48 | |||
49 | <refsect1> | ||
50 | <title>Description</title> | ||
51 | |||
52 | <para>Subscribe or unsubscribe V4L2 event. Subscribed events are | ||
53 | dequeued by using the &VIDIOC-DQEVENT; ioctl.</para> | ||
54 | |||
55 | <table frame="none" pgwide="1" id="v4l2-event-subscription"> | ||
56 | <title>struct <structname>v4l2_event_subscription</structname></title> | ||
57 | <tgroup cols="3"> | ||
58 | &cs-str; | ||
59 | <tbody valign="top"> | ||
60 | <row> | ||
61 | <entry>__u32</entry> | ||
62 | <entry><structfield>type</structfield></entry> | ||
63 | <entry>Type of the event.</entry> | ||
64 | </row> | ||
65 | <row> | ||
66 | <entry>__u32</entry> | ||
67 | <entry><structfield>reserved</structfield>[7]</entry> | ||
68 | <entry>Reserved for future extensions. Drivers and applications | ||
69 | must set the array to zero.</entry> | ||
70 | </row> | ||
71 | </tbody> | ||
72 | </tgroup> | ||
73 | </table> | ||
74 | |||
75 | <table frame="none" pgwide="1" id="event-type"> | ||
76 | <title>Event Types</title> | ||
77 | <tgroup cols="3"> | ||
78 | &cs-def; | ||
79 | <tbody valign="top"> | ||
80 | <row> | ||
81 | <entry><constant>V4L2_EVENT_ALL</constant></entry> | ||
82 | <entry>0</entry> | ||
83 | <entry>All events. V4L2_EVENT_ALL is valid only for | ||
84 | VIDIOC_UNSUBSCRIBE_EVENT for unsubscribing all events at once. | ||
85 | </entry> | ||
86 | </row> | ||
87 | <row> | ||
88 | <entry><constant>V4L2_EVENT_VSYNC</constant></entry> | ||
89 | <entry>1</entry> | ||
90 | <entry>This event is triggered on the vertical sync. | ||
91 | This event has &v4l2-event-vsync; associated with it. | ||
92 | </entry> | ||
93 | </row> | ||
94 | <row> | ||
95 | <entry><constant>V4L2_EVENT_EOS</constant></entry> | ||
96 | <entry>2</entry> | ||
97 | <entry>This event is triggered when the end of a stream is reached. | ||
98 | This is typically used with MPEG decoders to report to the application | ||
99 | when the last of the MPEG stream has been decoded. | ||
100 | </entry> | ||
101 | </row> | ||
102 | <row> | ||
103 | <entry><constant>V4L2_EVENT_PRIVATE_START</constant></entry> | ||
104 | <entry>0x08000000</entry> | ||
105 | <entry>Base event number for driver-private events.</entry> | ||
106 | </row> | ||
107 | </tbody> | ||
108 | </tgroup> | ||
109 | </table> | ||
110 | |||
111 | <table frame="none" pgwide="1" id="v4l2-event-vsync"> | ||
112 | <title>struct <structname>v4l2_event_vsync</structname></title> | ||
113 | <tgroup cols="3"> | ||
114 | &cs-str; | ||
115 | <tbody valign="top"> | ||
116 | <row> | ||
117 | <entry>__u8</entry> | ||
118 | <entry><structfield>field</structfield></entry> | ||
119 | <entry>The upcoming field. See &v4l2-field;.</entry> | ||
120 | </row> | ||
121 | </tbody> | ||
122 | </tgroup> | ||
123 | </table> | ||
124 | |||
125 | </refsect1> | ||
126 | </refentry> | ||
127 | <!-- | ||
128 | Local Variables: | ||
129 | mode: sgml | ||
130 | sgml-parent-document: "v4l2.sgml" | ||
131 | indent-tabs-mode: nil | ||
132 | End: | ||
133 | --> | ||
diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl index 0d0f7b4d4b1a..0ba149de2608 100644 --- a/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -5518,34 +5518,41 @@ struct _snd_pcm_runtime { | |||
5518 | ]]> | 5518 | ]]> |
5519 | </programlisting> | 5519 | </programlisting> |
5520 | </informalexample> | 5520 | </informalexample> |
5521 | |||
5522 | For the raw data, <structfield>size</structfield> field must be | ||
5523 | set properly. This specifies the maximum size of the proc file access. | ||
5521 | </para> | 5524 | </para> |
5522 | 5525 | ||
5523 | <para> | 5526 | <para> |
5524 | The callback is much more complicated than the text-file | 5527 | The read/write callbacks of raw mode are more direct than the text mode. |
5525 | version. You need to use a low-level I/O functions such as | 5528 | You need to use a low-level I/O functions such as |
5526 | <function>copy_from/to_user()</function> to transfer the | 5529 | <function>copy_from/to_user()</function> to transfer the |
5527 | data. | 5530 | data. |
5528 | 5531 | ||
5529 | <informalexample> | 5532 | <informalexample> |
5530 | <programlisting> | 5533 | <programlisting> |
5531 | <![CDATA[ | 5534 | <![CDATA[ |
5532 | static long my_file_io_read(struct snd_info_entry *entry, | 5535 | static ssize_t my_file_io_read(struct snd_info_entry *entry, |
5533 | void *file_private_data, | 5536 | void *file_private_data, |
5534 | struct file *file, | 5537 | struct file *file, |
5535 | char *buf, | 5538 | char *buf, |
5536 | unsigned long count, | 5539 | size_t count, |
5537 | unsigned long pos) | 5540 | loff_t pos) |
5538 | { | 5541 | { |
5539 | long size = count; | 5542 | if (copy_to_user(buf, local_data + pos, count)) |
5540 | if (pos + size > local_max_size) | ||
5541 | size = local_max_size - pos; | ||
5542 | if (copy_to_user(buf, local_data + pos, size)) | ||
5543 | return -EFAULT; | 5543 | return -EFAULT; |
5544 | return size; | 5544 | return count; |
5545 | } | 5545 | } |
5546 | ]]> | 5546 | ]]> |
5547 | </programlisting> | 5547 | </programlisting> |
5548 | </informalexample> | 5548 | </informalexample> |
5549 | |||
5550 | If the size of the info entry has been set up properly, | ||
5551 | <structfield>count</structfield> and <structfield>pos</structfield> are | ||
5552 | guaranteed to fit within 0 and the given size. | ||
5553 | You don't have to check the range in the callbacks unless any | ||
5554 | other condition is required. | ||
5555 | |||
5549 | </para> | 5556 | </para> |
5550 | 5557 | ||
5551 | </chapter> | 5558 | </chapter> |
diff --git a/Documentation/DocBook/writing_usb_driver.tmpl b/Documentation/DocBook/writing_usb_driver.tmpl index eeff19ca831b..bd97a13fa5ae 100644 --- a/Documentation/DocBook/writing_usb_driver.tmpl +++ b/Documentation/DocBook/writing_usb_driver.tmpl | |||
@@ -342,7 +342,7 @@ static inline void skel_delete (struct usb_skel *dev) | |||
342 | { | 342 | { |
343 | kfree (dev->bulk_in_buffer); | 343 | kfree (dev->bulk_in_buffer); |
344 | if (dev->bulk_out_buffer != NULL) | 344 | if (dev->bulk_out_buffer != NULL) |
345 | usb_buffer_free (dev->udev, dev->bulk_out_size, | 345 | usb_free_coherent (dev->udev, dev->bulk_out_size, |
346 | dev->bulk_out_buffer, | 346 | dev->bulk_out_buffer, |
347 | dev->write_urb->transfer_dma); | 347 | dev->write_urb->transfer_dma); |
348 | usb_free_urb (dev->write_urb); | 348 | usb_free_urb (dev->write_urb); |
diff --git a/Documentation/HOWTO b/Documentation/HOWTO index f5395af88a41..40ada93b820a 100644 --- a/Documentation/HOWTO +++ b/Documentation/HOWTO | |||
@@ -234,7 +234,7 @@ process is as follows: | |||
234 | Linus, usually the patches that have already been included in the | 234 | Linus, usually the patches that have already been included in the |
235 | -next kernel for a few weeks. The preferred way to submit big changes | 235 | -next kernel for a few weeks. The preferred way to submit big changes |
236 | is using git (the kernel's source management tool, more information | 236 | is using git (the kernel's source management tool, more information |
237 | can be found at http://git.or.cz/) but plain patches are also just | 237 | can be found at http://git-scm.com/) but plain patches are also just |
238 | fine. | 238 | fine. |
239 | - After two weeks a -rc1 kernel is released it is now possible to push | 239 | - After two weeks a -rc1 kernel is released it is now possible to push |
240 | only patches that do not include new features that could affect the | 240 | only patches that do not include new features that could affect the |
diff --git a/Documentation/PCI/pci-error-recovery.txt b/Documentation/PCI/pci-error-recovery.txt index e83f2ea76415..898ded24510d 100644 --- a/Documentation/PCI/pci-error-recovery.txt +++ b/Documentation/PCI/pci-error-recovery.txt | |||
@@ -216,7 +216,7 @@ The driver should return one of the following result codes: | |||
216 | 216 | ||
217 | - PCI_ERS_RESULT_NEED_RESET | 217 | - PCI_ERS_RESULT_NEED_RESET |
218 | Driver returns this if it thinks the device is not | 218 | Driver returns this if it thinks the device is not |
219 | recoverable in it's current state and it needs a slot | 219 | recoverable in its current state and it needs a slot |
220 | reset to proceed. | 220 | reset to proceed. |
221 | 221 | ||
222 | - PCI_ERS_RESULT_DISCONNECT | 222 | - PCI_ERS_RESULT_DISCONNECT |
@@ -241,7 +241,7 @@ in working condition. | |||
241 | 241 | ||
242 | The driver is not supposed to restart normal driver I/O operations | 242 | The driver is not supposed to restart normal driver I/O operations |
243 | at this point. It should limit itself to "probing" the device to | 243 | at this point. It should limit itself to "probing" the device to |
244 | check it's recoverability status. If all is right, then the platform | 244 | check its recoverability status. If all is right, then the platform |
245 | will call resume() once all drivers have ack'd link_reset(). | 245 | will call resume() once all drivers have ack'd link_reset(). |
246 | 246 | ||
247 | Result codes: | 247 | Result codes: |
diff --git a/Documentation/PCI/pcieaer-howto.txt b/Documentation/PCI/pcieaer-howto.txt index be21001ab144..26d3d945c3c2 100644 --- a/Documentation/PCI/pcieaer-howto.txt +++ b/Documentation/PCI/pcieaer-howto.txt | |||
@@ -13,7 +13,7 @@ Reporting (AER) driver and provides information on how to use it, as | |||
13 | well as how to enable the drivers of endpoint devices to conform with | 13 | well as how to enable the drivers of endpoint devices to conform with |
14 | PCI Express AER driver. | 14 | PCI Express AER driver. |
15 | 15 | ||
16 | 1.2 Copyright © Intel Corporation 2006. | 16 | 1.2 Copyright (C) Intel Corporation 2006. |
17 | 17 | ||
18 | 1.3 What is the PCI Express AER Driver? | 18 | 1.3 What is the PCI Express AER Driver? |
19 | 19 | ||
@@ -71,15 +71,11 @@ console. If it's a correctable error, it is outputed as a warning. | |||
71 | Otherwise, it is printed as an error. So users could choose different | 71 | Otherwise, it is printed as an error. So users could choose different |
72 | log level to filter out correctable error messages. | 72 | log level to filter out correctable error messages. |
73 | 73 | ||
74 | Below shows an example. | 74 | Below shows an example: |
75 | +------ PCI-Express Device Error -----+ | 75 | 0000:50:00.0: PCIe Bus Error: severity=Uncorrected (Fatal), type=Transaction Layer, id=0500(Requester ID) |
76 | Error Severity : Uncorrected (Fatal) | 76 | 0000:50:00.0: device [8086:0329] error status/mask=00100000/00000000 |
77 | PCIE Bus Error type : Transaction Layer | 77 | 0000:50:00.0: [20] Unsupported Request (First) |
78 | Unsupported Request : First | 78 | 0000:50:00.0: TLP Header: 04000001 00200a03 05010000 00050100 |
79 | Requester ID : 0500 | ||
80 | VendorID=8086h, DeviceID=0329h, Bus=05h, Device=00h, Function=00h | ||
81 | TLB Header: | ||
82 | 04000001 00200a03 05010000 00050100 | ||
83 | 79 | ||
84 | In the example, 'Requester ID' means the ID of the device who sends | 80 | In the example, 'Requester ID' means the ID of the device who sends |
85 | the error message to root port. Pls. refer to pci express specs for | 81 | the error message to root port. Pls. refer to pci express specs for |
@@ -112,7 +108,7 @@ but the PCI Express link itself is fully functional. Fatal errors, on | |||
112 | the other hand, cause the link to be unreliable. | 108 | the other hand, cause the link to be unreliable. |
113 | 109 | ||
114 | When AER is enabled, a PCI Express device will automatically send an | 110 | When AER is enabled, a PCI Express device will automatically send an |
115 | error message to the PCIE root port above it when the device captures | 111 | error message to the PCIe root port above it when the device captures |
116 | an error. The Root Port, upon receiving an error reporting message, | 112 | an error. The Root Port, upon receiving an error reporting message, |
117 | internally processes and logs the error message in its PCI Express | 113 | internally processes and logs the error message in its PCI Express |
118 | capability structure. Error information being logged includes storing | 114 | capability structure. Error information being logged includes storing |
@@ -198,8 +194,9 @@ to reset link, AER port service driver is required to provide the | |||
198 | function to reset link. Firstly, kernel looks for if the upstream | 194 | function to reset link. Firstly, kernel looks for if the upstream |
199 | component has an aer driver. If it has, kernel uses the reset_link | 195 | component has an aer driver. If it has, kernel uses the reset_link |
200 | callback of the aer driver. If the upstream component has no aer driver | 196 | callback of the aer driver. If the upstream component has no aer driver |
201 | and the port is downstream port, we will use the aer driver of the | 197 | and the port is downstream port, we will perform a hot reset as the |
202 | root port who reports the AER error. As for upstream ports, | 198 | default by setting the Secondary Bus Reset bit of the Bridge Control |
199 | register associated with the downstream port. As for upstream ports, | ||
203 | they should provide their own aer service drivers with reset_link | 200 | they should provide their own aer service drivers with reset_link |
204 | function. If error_detected returns PCI_ERS_RESULT_CAN_RECOVER and | 201 | function. If error_detected returns PCI_ERS_RESULT_CAN_RECOVER and |
205 | reset_link returns PCI_ERS_RESULT_RECOVERED, the error handling goes | 202 | reset_link returns PCI_ERS_RESULT_RECOVERED, the error handling goes |
@@ -253,11 +250,11 @@ cleanup uncorrectable status register. Pls. refer to section 3.3. | |||
253 | 250 | ||
254 | 4. Software error injection | 251 | 4. Software error injection |
255 | 252 | ||
256 | Debugging PCIE AER error recovery code is quite difficult because it | 253 | Debugging PCIe AER error recovery code is quite difficult because it |
257 | is hard to trigger real hardware errors. Software based error | 254 | is hard to trigger real hardware errors. Software based error |
258 | injection can be used to fake various kinds of PCIE errors. | 255 | injection can be used to fake various kinds of PCIe errors. |
259 | 256 | ||
260 | First you should enable PCIE AER software error injection in kernel | 257 | First you should enable PCIe AER software error injection in kernel |
261 | configuration, that is, following item should be in your .config. | 258 | configuration, that is, following item should be in your .config. |
262 | 259 | ||
263 | CONFIG_PCIEAER_INJECT=y or CONFIG_PCIEAER_INJECT=m | 260 | CONFIG_PCIEAER_INJECT=y or CONFIG_PCIEAER_INJECT=m |
diff --git a/Documentation/RCU/NMI-RCU.txt b/Documentation/RCU/NMI-RCU.txt index a6d32e65d222..a8536cb88091 100644 --- a/Documentation/RCU/NMI-RCU.txt +++ b/Documentation/RCU/NMI-RCU.txt | |||
@@ -34,7 +34,7 @@ NMI handler. | |||
34 | cpu = smp_processor_id(); | 34 | cpu = smp_processor_id(); |
35 | ++nmi_count(cpu); | 35 | ++nmi_count(cpu); |
36 | 36 | ||
37 | if (!rcu_dereference(nmi_callback)(regs, cpu)) | 37 | if (!rcu_dereference_sched(nmi_callback)(regs, cpu)) |
38 | default_do_nmi(regs); | 38 | default_do_nmi(regs); |
39 | 39 | ||
40 | nmi_exit(); | 40 | nmi_exit(); |
@@ -47,12 +47,13 @@ function pointer. If this handler returns zero, do_nmi() invokes the | |||
47 | default_do_nmi() function to handle a machine-specific NMI. Finally, | 47 | default_do_nmi() function to handle a machine-specific NMI. Finally, |
48 | preemption is restored. | 48 | preemption is restored. |
49 | 49 | ||
50 | Strictly speaking, rcu_dereference() is not needed, since this code runs | 50 | In theory, rcu_dereference_sched() is not needed, since this code runs |
51 | only on i386, which does not need rcu_dereference() anyway. However, | 51 | only on i386, which in theory does not need rcu_dereference_sched() |
52 | it is a good documentation aid, particularly for anyone attempting to | 52 | anyway. However, in practice it is a good documentation aid, particularly |
53 | do something similar on Alpha. | 53 | for anyone attempting to do something similar on Alpha or on systems |
54 | with aggressive optimizing compilers. | ||
54 | 55 | ||
55 | Quick Quiz: Why might the rcu_dereference() be necessary on Alpha, | 56 | Quick Quiz: Why might the rcu_dereference_sched() be necessary on Alpha, |
56 | given that the code referenced by the pointer is read-only? | 57 | given that the code referenced by the pointer is read-only? |
57 | 58 | ||
58 | 59 | ||
@@ -99,17 +100,21 @@ invoke irq_enter() and irq_exit() on NMI entry and exit, respectively. | |||
99 | 100 | ||
100 | Answer to Quick Quiz | 101 | Answer to Quick Quiz |
101 | 102 | ||
102 | Why might the rcu_dereference() be necessary on Alpha, given | 103 | Why might the rcu_dereference_sched() be necessary on Alpha, given |
103 | that the code referenced by the pointer is read-only? | 104 | that the code referenced by the pointer is read-only? |
104 | 105 | ||
105 | Answer: The caller to set_nmi_callback() might well have | 106 | Answer: The caller to set_nmi_callback() might well have |
106 | initialized some data that is to be used by the | 107 | initialized some data that is to be used by the new NMI |
107 | new NMI handler. In this case, the rcu_dereference() | 108 | handler. In this case, the rcu_dereference_sched() would |
108 | would be needed, because otherwise a CPU that received | 109 | be needed, because otherwise a CPU that received an NMI |
109 | an NMI just after the new handler was set might see | 110 | just after the new handler was set might see the pointer |
110 | the pointer to the new NMI handler, but the old | 111 | to the new NMI handler, but the old pre-initialized |
111 | pre-initialized version of the handler's data. | 112 | version of the handler's data. |
112 | 113 | ||
113 | More important, the rcu_dereference() makes it clear | 114 | This same sad story can happen on other CPUs when using |
114 | to someone reading the code that the pointer is being | 115 | a compiler with aggressive pointer-value speculation |
115 | protected by RCU. | 116 | optimizations. |
117 | |||
118 | More important, the rcu_dereference_sched() makes it | ||
119 | clear to someone reading the code that the pointer is | ||
120 | being protected by RCU-sched. | ||
diff --git a/Documentation/RCU/checklist.txt b/Documentation/RCU/checklist.txt index cbc180f90194..790d1a812376 100644 --- a/Documentation/RCU/checklist.txt +++ b/Documentation/RCU/checklist.txt | |||
@@ -260,7 +260,8 @@ over a rather long period of time, but improvements are always welcome! | |||
260 | The reason that it is permissible to use RCU list-traversal | 260 | The reason that it is permissible to use RCU list-traversal |
261 | primitives when the update-side lock is held is that doing so | 261 | primitives when the update-side lock is held is that doing so |
262 | can be quite helpful in reducing code bloat when common code is | 262 | can be quite helpful in reducing code bloat when common code is |
263 | shared between readers and updaters. | 263 | shared between readers and updaters. Additional primitives |
264 | are provided for this case, as discussed in lockdep.txt. | ||
264 | 265 | ||
265 | 10. Conversely, if you are in an RCU read-side critical section, | 266 | 10. Conversely, if you are in an RCU read-side critical section, |
266 | and you don't hold the appropriate update-side lock, you -must- | 267 | and you don't hold the appropriate update-side lock, you -must- |
@@ -344,8 +345,8 @@ over a rather long period of time, but improvements are always welcome! | |||
344 | requiring SRCU's read-side deadlock immunity or low read-side | 345 | requiring SRCU's read-side deadlock immunity or low read-side |
345 | realtime latency. | 346 | realtime latency. |
346 | 347 | ||
347 | Note that, rcu_assign_pointer() and rcu_dereference() relate to | 348 | Note that, rcu_assign_pointer() relates to SRCU just as they do |
348 | SRCU just as they do to other forms of RCU. | 349 | to other forms of RCU. |
349 | 350 | ||
350 | 15. The whole point of call_rcu(), synchronize_rcu(), and friends | 351 | 15. The whole point of call_rcu(), synchronize_rcu(), and friends |
351 | is to wait until all pre-existing readers have finished before | 352 | is to wait until all pre-existing readers have finished before |
diff --git a/Documentation/RCU/lockdep.txt b/Documentation/RCU/lockdep.txt index fe24b58627bd..d7a49b2f6994 100644 --- a/Documentation/RCU/lockdep.txt +++ b/Documentation/RCU/lockdep.txt | |||
@@ -32,9 +32,20 @@ checking of rcu_dereference() primitives: | |||
32 | srcu_dereference(p, sp): | 32 | srcu_dereference(p, sp): |
33 | Check for SRCU read-side critical section. | 33 | Check for SRCU read-side critical section. |
34 | rcu_dereference_check(p, c): | 34 | rcu_dereference_check(p, c): |
35 | Use explicit check expression "c". | 35 | Use explicit check expression "c". This is useful in |
36 | code that is invoked by both readers and updaters. | ||
36 | rcu_dereference_raw(p) | 37 | rcu_dereference_raw(p) |
37 | Don't check. (Use sparingly, if at all.) | 38 | Don't check. (Use sparingly, if at all.) |
39 | rcu_dereference_protected(p, c): | ||
40 | Use explicit check expression "c", and omit all barriers | ||
41 | and compiler constraints. This is useful when the data | ||
42 | structure cannot change, for example, in code that is | ||
43 | invoked only by updaters. | ||
44 | rcu_access_pointer(p): | ||
45 | Return the value of the pointer and omit all barriers, | ||
46 | but retain the compiler constraints that prevent duplicating | ||
47 | or coalescsing. This is useful when when testing the | ||
48 | value of the pointer itself, for example, against NULL. | ||
38 | 49 | ||
39 | The rcu_dereference_check() check expression can be any boolean | 50 | The rcu_dereference_check() check expression can be any boolean |
40 | expression, but would normally include one of the rcu_read_lock_held() | 51 | expression, but would normally include one of the rcu_read_lock_held() |
@@ -59,7 +70,20 @@ In case (1), the pointer is picked up in an RCU-safe manner for vanilla | |||
59 | RCU read-side critical sections, in case (2) the ->file_lock prevents | 70 | RCU read-side critical sections, in case (2) the ->file_lock prevents |
60 | any change from taking place, and finally, in case (3) the current task | 71 | any change from taking place, and finally, in case (3) the current task |
61 | is the only task accessing the file_struct, again preventing any change | 72 | is the only task accessing the file_struct, again preventing any change |
62 | from taking place. | 73 | from taking place. If the above statement was invoked only from updater |
74 | code, it could instead be written as follows: | ||
75 | |||
76 | file = rcu_dereference_protected(fdt->fd[fd], | ||
77 | lockdep_is_held(&files->file_lock) || | ||
78 | atomic_read(&files->count) == 1); | ||
79 | |||
80 | This would verify cases #2 and #3 above, and furthermore lockdep would | ||
81 | complain if this was used in an RCU read-side critical section unless one | ||
82 | of these two cases held. Because rcu_dereference_protected() omits all | ||
83 | barriers and compiler constraints, it generates better code than do the | ||
84 | other flavors of rcu_dereference(). On the other hand, it is illegal | ||
85 | to use rcu_dereference_protected() if either the RCU-protected pointer | ||
86 | or the RCU-protected data that it points to can change concurrently. | ||
63 | 87 | ||
64 | There are currently only "universal" versions of the rcu_assign_pointer() | 88 | There are currently only "universal" versions of the rcu_assign_pointer() |
65 | and RCU list-/tree-traversal primitives, which do not (yet) check for | 89 | and RCU list-/tree-traversal primitives, which do not (yet) check for |
diff --git a/Documentation/RCU/stallwarn.txt b/Documentation/RCU/stallwarn.txt index 1423d2570d78..44c6dcc93d6d 100644 --- a/Documentation/RCU/stallwarn.txt +++ b/Documentation/RCU/stallwarn.txt | |||
@@ -3,35 +3,79 @@ Using RCU's CPU Stall Detector | |||
3 | The CONFIG_RCU_CPU_STALL_DETECTOR kernel config parameter enables | 3 | The CONFIG_RCU_CPU_STALL_DETECTOR kernel config parameter enables |
4 | RCU's CPU stall detector, which detects conditions that unduly delay | 4 | RCU's CPU stall detector, which detects conditions that unduly delay |
5 | RCU grace periods. The stall detector's idea of what constitutes | 5 | RCU grace periods. The stall detector's idea of what constitutes |
6 | "unduly delayed" is controlled by a pair of C preprocessor macros: | 6 | "unduly delayed" is controlled by a set of C preprocessor macros: |
7 | 7 | ||
8 | RCU_SECONDS_TILL_STALL_CHECK | 8 | RCU_SECONDS_TILL_STALL_CHECK |
9 | 9 | ||
10 | This macro defines the period of time that RCU will wait from | 10 | This macro defines the period of time that RCU will wait from |
11 | the beginning of a grace period until it issues an RCU CPU | 11 | the beginning of a grace period until it issues an RCU CPU |
12 | stall warning. It is normally ten seconds. | 12 | stall warning. This time period is normally ten seconds. |
13 | 13 | ||
14 | RCU_SECONDS_TILL_STALL_RECHECK | 14 | RCU_SECONDS_TILL_STALL_RECHECK |
15 | 15 | ||
16 | This macro defines the period of time that RCU will wait after | 16 | This macro defines the period of time that RCU will wait after |
17 | issuing a stall warning until it issues another stall warning. | 17 | issuing a stall warning until it issues another stall warning |
18 | It is normally set to thirty seconds. | 18 | for the same stall. This time period is normally set to thirty |
19 | seconds. | ||
19 | 20 | ||
20 | RCU_STALL_RAT_DELAY | 21 | RCU_STALL_RAT_DELAY |
21 | 22 | ||
22 | The CPU stall detector tries to make the offending CPU rat on itself, | 23 | The CPU stall detector tries to make the offending CPU print its |
23 | as this often gives better-quality stack traces. However, if | 24 | own warnings, as this often gives better-quality stack traces. |
24 | the offending CPU does not detect its own stall in the number | 25 | However, if the offending CPU does not detect its own stall in |
25 | of jiffies specified by RCU_STALL_RAT_DELAY, then other CPUs will | 26 | the number of jiffies specified by RCU_STALL_RAT_DELAY, then |
26 | complain. This is normally set to two jiffies. | 27 | some other CPU will complain. This delay is normally set to |
28 | two jiffies. | ||
27 | 29 | ||
28 | The following problems can result in an RCU CPU stall warning: | 30 | When a CPU detects that it is stalling, it will print a message similar |
31 | to the following: | ||
32 | |||
33 | INFO: rcu_sched_state detected stall on CPU 5 (t=2500 jiffies) | ||
34 | |||
35 | This message indicates that CPU 5 detected that it was causing a stall, | ||
36 | and that the stall was affecting RCU-sched. This message will normally be | ||
37 | followed by a stack dump of the offending CPU. On TREE_RCU kernel builds, | ||
38 | RCU and RCU-sched are implemented by the same underlying mechanism, | ||
39 | while on TREE_PREEMPT_RCU kernel builds, RCU is instead implemented | ||
40 | by rcu_preempt_state. | ||
41 | |||
42 | On the other hand, if the offending CPU fails to print out a stall-warning | ||
43 | message quickly enough, some other CPU will print a message similar to | ||
44 | the following: | ||
45 | |||
46 | INFO: rcu_bh_state detected stalls on CPUs/tasks: { 3 5 } (detected by 2, 2502 jiffies) | ||
47 | |||
48 | This message indicates that CPU 2 detected that CPUs 3 and 5 were both | ||
49 | causing stalls, and that the stall was affecting RCU-bh. This message | ||
50 | will normally be followed by stack dumps for each CPU. Please note that | ||
51 | TREE_PREEMPT_RCU builds can be stalled by tasks as well as by CPUs, | ||
52 | and that the tasks will be indicated by PID, for example, "P3421". | ||
53 | It is even possible for a rcu_preempt_state stall to be caused by both | ||
54 | CPUs -and- tasks, in which case the offending CPUs and tasks will all | ||
55 | be called out in the list. | ||
56 | |||
57 | Finally, if the grace period ends just as the stall warning starts | ||
58 | printing, there will be a spurious stall-warning message: | ||
59 | |||
60 | INFO: rcu_bh_state detected stalls on CPUs/tasks: { } (detected by 4, 2502 jiffies) | ||
61 | |||
62 | This is rare, but does happen from time to time in real life. | ||
63 | |||
64 | So your kernel printed an RCU CPU stall warning. The next question is | ||
65 | "What caused it?" The following problems can result in RCU CPU stall | ||
66 | warnings: | ||
29 | 67 | ||
30 | o A CPU looping in an RCU read-side critical section. | 68 | o A CPU looping in an RCU read-side critical section. |
31 | 69 | ||
32 | o A CPU looping with interrupts disabled. | 70 | o A CPU looping with interrupts disabled. This condition can |
71 | result in RCU-sched and RCU-bh stalls. | ||
33 | 72 | ||
34 | o A CPU looping with preemption disabled. | 73 | o A CPU looping with preemption disabled. This condition can |
74 | result in RCU-sched stalls and, if ksoftirqd is in use, RCU-bh | ||
75 | stalls. | ||
76 | |||
77 | o A CPU looping with bottom halves disabled. This condition can | ||
78 | result in RCU-sched and RCU-bh stalls. | ||
35 | 79 | ||
36 | o For !CONFIG_PREEMPT kernels, a CPU looping anywhere in the kernel | 80 | o For !CONFIG_PREEMPT kernels, a CPU looping anywhere in the kernel |
37 | without invoking schedule(). | 81 | without invoking schedule(). |
@@ -39,20 +83,24 @@ o For !CONFIG_PREEMPT kernels, a CPU looping anywhere in the kernel | |||
39 | o A bug in the RCU implementation. | 83 | o A bug in the RCU implementation. |
40 | 84 | ||
41 | o A hardware failure. This is quite unlikely, but has occurred | 85 | o A hardware failure. This is quite unlikely, but has occurred |
42 | at least once in a former life. A CPU failed in a running system, | 86 | at least once in real life. A CPU failed in a running system, |
43 | becoming unresponsive, but not causing an immediate crash. | 87 | becoming unresponsive, but not causing an immediate crash. |
44 | This resulted in a series of RCU CPU stall warnings, eventually | 88 | This resulted in a series of RCU CPU stall warnings, eventually |
45 | leading the realization that the CPU had failed. | 89 | leading the realization that the CPU had failed. |
46 | 90 | ||
47 | The RCU, RCU-sched, and RCU-bh implementations have CPU stall warning. | 91 | The RCU, RCU-sched, and RCU-bh implementations have CPU stall |
48 | SRCU does not do so directly, but its calls to synchronize_sched() will | 92 | warning. SRCU does not have its own CPU stall warnings, but its |
49 | result in RCU-sched detecting any CPU stalls that might be occurring. | 93 | calls to synchronize_sched() will result in RCU-sched detecting |
50 | 94 | RCU-sched-related CPU stalls. Please note that RCU only detects | |
51 | To diagnose the cause of the stall, inspect the stack traces. The offending | 95 | CPU stalls when there is a grace period in progress. No grace period, |
52 | function will usually be near the top of the stack. If you have a series | 96 | no CPU stall warnings. |
53 | of stall warnings from a single extended stall, comparing the stack traces | 97 | |
54 | can often help determine where the stall is occurring, which will usually | 98 | To diagnose the cause of the stall, inspect the stack traces. |
55 | be in the function nearest the top of the stack that stays the same from | 99 | The offending function will usually be near the top of the stack. |
56 | trace to trace. | 100 | If you have a series of stall warnings from a single extended stall, |
101 | comparing the stack traces can often help determine where the stall | ||
102 | is occurring, which will usually be in the function nearest the top of | ||
103 | that portion of the stack which remains the same from trace to trace. | ||
104 | If you can reliably trigger the stall, ftrace can be quite helpful. | ||
57 | 105 | ||
58 | RCU bugs can often be debugged with the help of CONFIG_RCU_TRACE. | 106 | RCU bugs can often be debugged with the help of CONFIG_RCU_TRACE. |
diff --git a/Documentation/RCU/torture.txt b/Documentation/RCU/torture.txt index 0e50bc2aa1e2..5d9016795fd8 100644 --- a/Documentation/RCU/torture.txt +++ b/Documentation/RCU/torture.txt | |||
@@ -182,16 +182,6 @@ Similarly, sched_expedited RCU provides the following: | |||
182 | sched_expedited-torture: Reader Pipe: 12660320201 95875 0 0 0 0 0 0 0 0 0 | 182 | sched_expedited-torture: Reader Pipe: 12660320201 95875 0 0 0 0 0 0 0 0 0 |
183 | sched_expedited-torture: Reader Batch: 12660424885 0 0 0 0 0 0 0 0 0 0 | 183 | sched_expedited-torture: Reader Batch: 12660424885 0 0 0 0 0 0 0 0 0 0 |
184 | sched_expedited-torture: Free-Block Circulation: 1090795 1090795 1090794 1090793 1090792 1090791 1090790 1090789 1090788 1090787 0 | 184 | sched_expedited-torture: Free-Block Circulation: 1090795 1090795 1090794 1090793 1090792 1090791 1090790 1090789 1090788 1090787 0 |
185 | state: -1 / 0:0 3:0 4:0 | ||
186 | |||
187 | As before, the first four lines are similar to those for RCU. | ||
188 | The last line shows the task-migration state. The first number is | ||
189 | -1 if synchronize_sched_expedited() is idle, -2 if in the process of | ||
190 | posting wakeups to the migration kthreads, and N when waiting on CPU N. | ||
191 | Each of the colon-separated fields following the "/" is a CPU:state pair. | ||
192 | Valid states are "0" for idle, "1" for waiting for quiescent state, | ||
193 | "2" for passed through quiescent state, and "3" when a race with a | ||
194 | CPU-hotplug event forces use of the synchronize_sched() primitive. | ||
195 | 185 | ||
196 | 186 | ||
197 | USAGE | 187 | USAGE |
diff --git a/Documentation/RCU/trace.txt b/Documentation/RCU/trace.txt index 8608fd85e921..efd8cc95c06b 100644 --- a/Documentation/RCU/trace.txt +++ b/Documentation/RCU/trace.txt | |||
@@ -256,23 +256,23 @@ o Each element of the form "1/1 0:127 ^0" represents one struct | |||
256 | The output of "cat rcu/rcu_pending" looks as follows: | 256 | The output of "cat rcu/rcu_pending" looks as follows: |
257 | 257 | ||
258 | rcu_sched: | 258 | rcu_sched: |
259 | 0 np=255892 qsp=53936 cbr=0 cng=14417 gpc=10033 gps=24320 nf=6445 nn=146741 | 259 | 0 np=255892 qsp=53936 rpq=85 cbr=0 cng=14417 gpc=10033 gps=24320 nf=6445 nn=146741 |
260 | 1 np=261224 qsp=54638 cbr=0 cng=25723 gpc=16310 gps=2849 nf=5912 nn=155792 | 260 | 1 np=261224 qsp=54638 rpq=33 cbr=0 cng=25723 gpc=16310 gps=2849 nf=5912 nn=155792 |
261 | 2 np=237496 qsp=49664 cbr=0 cng=2762 gpc=45478 gps=1762 nf=1201 nn=136629 | 261 | 2 np=237496 qsp=49664 rpq=23 cbr=0 cng=2762 gpc=45478 gps=1762 nf=1201 nn=136629 |
262 | 3 np=236249 qsp=48766 cbr=0 cng=286 gpc=48049 gps=1218 nf=207 nn=137723 | 262 | 3 np=236249 qsp=48766 rpq=98 cbr=0 cng=286 gpc=48049 gps=1218 nf=207 nn=137723 |
263 | 4 np=221310 qsp=46850 cbr=0 cng=26 gpc=43161 gps=4634 nf=3529 nn=123110 | 263 | 4 np=221310 qsp=46850 rpq=7 cbr=0 cng=26 gpc=43161 gps=4634 nf=3529 nn=123110 |
264 | 5 np=237332 qsp=48449 cbr=0 cng=54 gpc=47920 gps=3252 nf=201 nn=137456 | 264 | 5 np=237332 qsp=48449 rpq=9 cbr=0 cng=54 gpc=47920 gps=3252 nf=201 nn=137456 |
265 | 6 np=219995 qsp=46718 cbr=0 cng=50 gpc=42098 gps=6093 nf=4202 nn=120834 | 265 | 6 np=219995 qsp=46718 rpq=12 cbr=0 cng=50 gpc=42098 gps=6093 nf=4202 nn=120834 |
266 | 7 np=249893 qsp=49390 cbr=0 cng=72 gpc=38400 gps=17102 nf=41 nn=144888 | 266 | 7 np=249893 qsp=49390 rpq=42 cbr=0 cng=72 gpc=38400 gps=17102 nf=41 nn=144888 |
267 | rcu_bh: | 267 | rcu_bh: |
268 | 0 np=146741 qsp=1419 cbr=0 cng=6 gpc=0 gps=0 nf=2 nn=145314 | 268 | 0 np=146741 qsp=1419 rpq=6 cbr=0 cng=6 gpc=0 gps=0 nf=2 nn=145314 |
269 | 1 np=155792 qsp=12597 cbr=0 cng=0 gpc=4 gps=8 nf=3 nn=143180 | 269 | 1 np=155792 qsp=12597 rpq=3 cbr=0 cng=0 gpc=4 gps=8 nf=3 nn=143180 |
270 | 2 np=136629 qsp=18680 cbr=0 cng=0 gpc=7 gps=6 nf=0 nn=117936 | 270 | 2 np=136629 qsp=18680 rpq=1 cbr=0 cng=0 gpc=7 gps=6 nf=0 nn=117936 |
271 | 3 np=137723 qsp=2843 cbr=0 cng=0 gpc=10 gps=7 nf=0 nn=134863 | 271 | 3 np=137723 qsp=2843 rpq=0 cbr=0 cng=0 gpc=10 gps=7 nf=0 nn=134863 |
272 | 4 np=123110 qsp=12433 cbr=0 cng=0 gpc=4 gps=2 nf=0 nn=110671 | 272 | 4 np=123110 qsp=12433 rpq=0 cbr=0 cng=0 gpc=4 gps=2 nf=0 nn=110671 |
273 | 5 np=137456 qsp=4210 cbr=0 cng=0 gpc=6 gps=5 nf=0 nn=133235 | 273 | 5 np=137456 qsp=4210 rpq=1 cbr=0 cng=0 gpc=6 gps=5 nf=0 nn=133235 |
274 | 6 np=120834 qsp=9902 cbr=0 cng=0 gpc=6 gps=3 nf=2 nn=110921 | 274 | 6 np=120834 qsp=9902 rpq=2 cbr=0 cng=0 gpc=6 gps=3 nf=2 nn=110921 |
275 | 7 np=144888 qsp=26336 cbr=0 cng=0 gpc=8 gps=2 nf=0 nn=118542 | 275 | 7 np=144888 qsp=26336 rpq=0 cbr=0 cng=0 gpc=8 gps=2 nf=0 nn=118542 |
276 | 276 | ||
277 | As always, this is once again split into "rcu_sched" and "rcu_bh" | 277 | As always, this is once again split into "rcu_sched" and "rcu_bh" |
278 | portions, with CONFIG_TREE_PREEMPT_RCU kernels having an additional | 278 | portions, with CONFIG_TREE_PREEMPT_RCU kernels having an additional |
@@ -284,6 +284,9 @@ o "np" is the number of times that __rcu_pending() has been invoked | |||
284 | o "qsp" is the number of times that the RCU was waiting for a | 284 | o "qsp" is the number of times that the RCU was waiting for a |
285 | quiescent state from this CPU. | 285 | quiescent state from this CPU. |
286 | 286 | ||
287 | o "rpq" is the number of times that the CPU had passed through | ||
288 | a quiescent state, but not yet reported it to RCU. | ||
289 | |||
287 | o "cbr" is the number of times that this CPU had RCU callbacks | 290 | o "cbr" is the number of times that this CPU had RCU callbacks |
288 | that had passed through a grace period, and were thus ready | 291 | that had passed through a grace period, and were thus ready |
289 | to be invoked. | 292 | to be invoked. |
diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt index 1dc00ee97163..cfaac34c4557 100644 --- a/Documentation/RCU/whatisRCU.txt +++ b/Documentation/RCU/whatisRCU.txt | |||
@@ -840,6 +840,12 @@ SRCU: Initialization/cleanup | |||
840 | init_srcu_struct | 840 | init_srcu_struct |
841 | cleanup_srcu_struct | 841 | cleanup_srcu_struct |
842 | 842 | ||
843 | All: lockdep-checked RCU-protected pointer access | ||
844 | |||
845 | rcu_dereference_check | ||
846 | rcu_dereference_protected | ||
847 | rcu_access_pointer | ||
848 | |||
843 | See the comment headers in the source code (or the docbook generated | 849 | See the comment headers in the source code (or the docbook generated |
844 | from them) for more information. | 850 | from them) for more information. |
845 | 851 | ||
diff --git a/Documentation/Smack.txt b/Documentation/Smack.txt index 34614b4c708e..e9dab41c0fe0 100644 --- a/Documentation/Smack.txt +++ b/Documentation/Smack.txt | |||
@@ -73,7 +73,7 @@ NOTE: Smack labels are limited to 23 characters. The attr command | |||
73 | If you don't do anything special all users will get the floor ("_") | 73 | If you don't do anything special all users will get the floor ("_") |
74 | label when they log in. If you do want to log in via the hacked ssh | 74 | label when they log in. If you do want to log in via the hacked ssh |
75 | at other labels use the attr command to set the smack value on the | 75 | at other labels use the attr command to set the smack value on the |
76 | home directory and it's contents. | 76 | home directory and its contents. |
77 | 77 | ||
78 | You can add access rules in /etc/smack/accesses. They take the form: | 78 | You can add access rules in /etc/smack/accesses. They take the form: |
79 | 79 | ||
diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist index 8916ca48bc95..da0382daa395 100644 --- a/Documentation/SubmitChecklist +++ b/Documentation/SubmitChecklist | |||
@@ -18,6 +18,8 @@ kernel patches. | |||
18 | 18 | ||
19 | 2b: Passes allnoconfig, allmodconfig | 19 | 2b: Passes allnoconfig, allmodconfig |
20 | 20 | ||
21 | 2c: Builds successfully when using O=builddir | ||
22 | |||
21 | 3: Builds on multiple CPU architectures by using local cross-compile tools | 23 | 3: Builds on multiple CPU architectures by using local cross-compile tools |
22 | or some other build farm. | 24 | or some other build farm. |
23 | 25 | ||
@@ -95,3 +97,13 @@ kernel patches. | |||
95 | 97 | ||
96 | 25: If any ioctl's are added by the patch, then also update | 98 | 25: If any ioctl's are added by the patch, then also update |
97 | Documentation/ioctl/ioctl-number.txt. | 99 | Documentation/ioctl/ioctl-number.txt. |
100 | |||
101 | 26: If your modified source code depends on or uses any of the kernel | ||
102 | APIs or features that are related to the following kconfig symbols, | ||
103 | then test multiple builds with the related kconfig symbols disabled | ||
104 | and/or =m (if that option is available) [not all of these at the | ||
105 | same time, just various/random combinations of them]: | ||
106 | |||
107 | CONFIG_SMP, CONFIG_SYSFS, CONFIG_PROC_FS, CONFIG_INPUT, CONFIG_PCI, | ||
108 | CONFIG_BLOCK, CONFIG_PM, CONFIG_HOTPLUG, CONFIG_MAGIC_SYSRQ, | ||
109 | CONFIG_NET, CONFIG_INET=n (but latter with CONFIG_NET=y) | ||
diff --git a/Documentation/arm/00-INDEX b/Documentation/arm/00-INDEX index 82e418d648d0..7f5fc3ba9c91 100644 --- a/Documentation/arm/00-INDEX +++ b/Documentation/arm/00-INDEX | |||
@@ -20,6 +20,8 @@ Samsung-S3C24XX | |||
20 | - S3C24XX ARM Linux Overview | 20 | - S3C24XX ARM Linux Overview |
21 | Sharp-LH | 21 | Sharp-LH |
22 | - Linux on Sharp LH79524 and LH7A40X System On a Chip (SOC) | 22 | - Linux on Sharp LH79524 and LH7A40X System On a Chip (SOC) |
23 | SPEAr | ||
24 | - ST SPEAr platform Linux Overview | ||
23 | VFP/ | 25 | VFP/ |
24 | - Release notes for Linux Kernel Vector Floating Point support code | 26 | - Release notes for Linux Kernel Vector Floating Point support code |
25 | empeg/ | 27 | empeg/ |
diff --git a/Documentation/arm/SA1100/ADSBitsy b/Documentation/arm/SA1100/ADSBitsy index 7197a9e958ee..f9f62e8c0719 100644 --- a/Documentation/arm/SA1100/ADSBitsy +++ b/Documentation/arm/SA1100/ADSBitsy | |||
@@ -32,7 +32,7 @@ Notes: | |||
32 | 32 | ||
33 | - The flash on board is divided into 3 partitions. | 33 | - The flash on board is divided into 3 partitions. |
34 | You should be careful to use flash on board. | 34 | You should be careful to use flash on board. |
35 | It's partition is different from GraphicsClient Plus and GraphicsMaster | 35 | Its partition is different from GraphicsClient Plus and GraphicsMaster |
36 | 36 | ||
37 | - 16bpp mode requires a different cable than what ships with the board. | 37 | - 16bpp mode requires a different cable than what ships with the board. |
38 | Contact ADS or look through the manual to wire your own. Currently, | 38 | Contact ADS or look through the manual to wire your own. Currently, |
diff --git a/Documentation/arm/SPEAr/overview.txt b/Documentation/arm/SPEAr/overview.txt new file mode 100644 index 000000000000..253a35c6f782 --- /dev/null +++ b/Documentation/arm/SPEAr/overview.txt | |||
@@ -0,0 +1,60 @@ | |||
1 | SPEAr ARM Linux Overview | ||
2 | ========================== | ||
3 | |||
4 | Introduction | ||
5 | ------------ | ||
6 | |||
7 | SPEAr (Structured Processor Enhanced Architecture). | ||
8 | weblink : http://www.st.com/spear | ||
9 | |||
10 | The ST Microelectronics SPEAr range of ARM9/CortexA9 System-on-Chip CPUs are | ||
11 | supported by the 'spear' platform of ARM Linux. Currently SPEAr300, | ||
12 | SPEAr310, SPEAr320 and SPEAr600 SOCs are supported. Support for the SPEAr13XX | ||
13 | series is in progress. | ||
14 | |||
15 | Hierarchy in SPEAr is as follows: | ||
16 | |||
17 | SPEAr (Platform) | ||
18 | - SPEAr3XX (3XX SOC series, based on ARM9) | ||
19 | - SPEAr300 (SOC) | ||
20 | - SPEAr300_EVB (Evaluation Board) | ||
21 | - SPEAr310 (SOC) | ||
22 | - SPEAr310_EVB (Evaluation Board) | ||
23 | - SPEAr320 (SOC) | ||
24 | - SPEAr320_EVB (Evaluation Board) | ||
25 | - SPEAr6XX (6XX SOC series, based on ARM9) | ||
26 | - SPEAr600 (SOC) | ||
27 | - SPEAr600_EVB (Evaluation Board) | ||
28 | - SPEAr13XX (13XX SOC series, based on ARM CORTEXA9) | ||
29 | - SPEAr1300 (SOC) | ||
30 | |||
31 | Configuration | ||
32 | ------------- | ||
33 | |||
34 | A generic configuration is provided for each machine, and can be used as the | ||
35 | default by | ||
36 | make spear600_defconfig | ||
37 | make spear300_defconfig | ||
38 | make spear310_defconfig | ||
39 | make spear320_defconfig | ||
40 | |||
41 | Layout | ||
42 | ------ | ||
43 | |||
44 | The common files for multiple machine families (SPEAr3XX, SPEAr6XX and | ||
45 | SPEAr13XX) are located in the platform code contained in arch/arm/plat-spear | ||
46 | with headers in plat/. | ||
47 | |||
48 | Each machine series have a directory with name arch/arm/mach-spear followed by | ||
49 | series name. Like mach-spear3xx, mach-spear6xx and mach-spear13xx. | ||
50 | |||
51 | Common file for machines of spear3xx family is mach-spear3xx/spear3xx.c and for | ||
52 | spear6xx is mach-spear6xx/spear6xx.c. mach-spear* also contain soc/machine | ||
53 | specific files, like spear300.c, spear310.c, spear320.c and spear600.c. | ||
54 | mach-spear* also contains board specific files for each machine type. | ||
55 | |||
56 | |||
57 | Document Author | ||
58 | --------------- | ||
59 | |||
60 | Viresh Kumar, (c) 2010 ST Microelectronics | ||
diff --git a/Documentation/arm/Sharp-LH/ADC-LH7-Touchscreen b/Documentation/arm/Sharp-LH/ADC-LH7-Touchscreen index 1e6a23fdf2fc..dc460f055647 100644 --- a/Documentation/arm/Sharp-LH/ADC-LH7-Touchscreen +++ b/Documentation/arm/Sharp-LH/ADC-LH7-Touchscreen | |||
@@ -7,7 +7,7 @@ The driver only implements a four-wire touch panel protocol. | |||
7 | 7 | ||
8 | The touchscreen driver is maintenance free except for the pen-down or | 8 | The touchscreen driver is maintenance free except for the pen-down or |
9 | touch threshold. Some resistive displays and board combinations may | 9 | touch threshold. Some resistive displays and board combinations may |
10 | require tuning of this threshold. The driver exposes some of it's | 10 | require tuning of this threshold. The driver exposes some of its |
11 | internal state in the sys filesystem. If the kernel is configured | 11 | internal state in the sys filesystem. If the kernel is configured |
12 | with it, CONFIG_SYSFS, and sysfs is mounted at /sys, there will be a | 12 | with it, CONFIG_SYSFS, and sysfs is mounted at /sys, there will be a |
13 | directory | 13 | directory |
diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt index 396bec3b74ed..ac4d47187122 100644 --- a/Documentation/atomic_ops.txt +++ b/Documentation/atomic_ops.txt | |||
@@ -320,7 +320,7 @@ counter decrement would not become globally visible until the | |||
320 | obj->active update does. | 320 | obj->active update does. |
321 | 321 | ||
322 | As a historical note, 32-bit Sparc used to only allow usage of | 322 | As a historical note, 32-bit Sparc used to only allow usage of |
323 | 24-bits of it's atomic_t type. This was because it used 8 bits | 323 | 24-bits of its atomic_t type. This was because it used 8 bits |
324 | as a spinlock for SMP safety. Sparc32 lacked a "compare and swap" | 324 | as a spinlock for SMP safety. Sparc32 lacked a "compare and swap" |
325 | type instruction. However, 32-bit Sparc has since been moved over | 325 | type instruction. However, 32-bit Sparc has since been moved over |
326 | to a "hash table of spinlocks" scheme, that allows the full 32-bit | 326 | to a "hash table of spinlocks" scheme, that allows the full 32-bit |
diff --git a/Documentation/blackfin/bfin-gpio-notes.txt b/Documentation/blackfin/bfin-gpio-notes.txt index 9898c7ded7d3..f731c1e56475 100644 --- a/Documentation/blackfin/bfin-gpio-notes.txt +++ b/Documentation/blackfin/bfin-gpio-notes.txt | |||
@@ -43,7 +43,7 @@ | |||
43 | void bfin_gpio_irq_free(unsigned gpio); | 43 | void bfin_gpio_irq_free(unsigned gpio); |
44 | 44 | ||
45 | The request functions will record the function state for a certain pin, | 45 | The request functions will record the function state for a certain pin, |
46 | the free functions will clear it's function state. | 46 | the free functions will clear its function state. |
47 | Once a pin is requested, it can't be requested again before it is freed by | 47 | Once a pin is requested, it can't be requested again before it is freed by |
48 | previous caller, otherwise kernel will dump stacks, and the request | 48 | previous caller, otherwise kernel will dump stacks, and the request |
49 | function fail. | 49 | function fail. |
diff --git a/Documentation/block/biodoc.txt b/Documentation/block/biodoc.txt index 6fab97ea7e6b..508b5b2b0289 100644 --- a/Documentation/block/biodoc.txt +++ b/Documentation/block/biodoc.txt | |||
@@ -1162,8 +1162,8 @@ where a driver received a request ala this before: | |||
1162 | 1162 | ||
1163 | As mentioned, there is no virtual mapping of a bio. For DMA, this is | 1163 | As mentioned, there is no virtual mapping of a bio. For DMA, this is |
1164 | not a problem as the driver probably never will need a virtual mapping. | 1164 | not a problem as the driver probably never will need a virtual mapping. |
1165 | Instead it needs a bus mapping (pci_map_page for a single segment or | 1165 | Instead it needs a bus mapping (dma_map_page for a single segment or |
1166 | use blk_rq_map_sg for scatter gather) to be able to ship it to the driver. For | 1166 | use dma_map_sg for scatter gather) to be able to ship it to the driver. For |
1167 | PIO drivers (or drivers that need to revert to PIO transfer once in a | 1167 | PIO drivers (or drivers that need to revert to PIO transfer once in a |
1168 | while (IDE for example)), where the CPU is doing the actual data | 1168 | while (IDE for example)), where the CPU is doing the actual data |
1169 | transfer a virtual mapping is needed. If the driver supports highmem I/O, | 1169 | transfer a virtual mapping is needed. If the driver supports highmem I/O, |
diff --git a/Documentation/cachetlb.txt b/Documentation/cachetlb.txt index 2b5f823abd03..9164ae3b83bc 100644 --- a/Documentation/cachetlb.txt +++ b/Documentation/cachetlb.txt | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | This document describes the cache/tlb flushing interfaces called | 6 | This document describes the cache/tlb flushing interfaces called |
7 | by the Linux VM subsystem. It enumerates over each interface, | 7 | by the Linux VM subsystem. It enumerates over each interface, |
8 | describes it's intended purpose, and what side effect is expected | 8 | describes its intended purpose, and what side effect is expected |
9 | after the interface is invoked. | 9 | after the interface is invoked. |
10 | 10 | ||
11 | The side effects described below are stated for a uniprocessor | 11 | The side effects described below are stated for a uniprocessor |
@@ -231,7 +231,7 @@ require a whole different set of interfaces to handle properly. | |||
231 | The biggest problem is that of virtual aliasing in the data cache | 231 | The biggest problem is that of virtual aliasing in the data cache |
232 | of a processor. | 232 | of a processor. |
233 | 233 | ||
234 | Is your port susceptible to virtual aliasing in it's D-cache? | 234 | Is your port susceptible to virtual aliasing in its D-cache? |
235 | Well, if your D-cache is virtually indexed, is larger in size than | 235 | Well, if your D-cache is virtually indexed, is larger in size than |
236 | PAGE_SIZE, and does not prevent multiple cache lines for the same | 236 | PAGE_SIZE, and does not prevent multiple cache lines for the same |
237 | physical address from existing at once, you have this problem. | 237 | physical address from existing at once, you have this problem. |
@@ -249,7 +249,7 @@ one way to solve this (in particular SPARC_FLAG_MMAPSHARED). | |||
249 | Next, you have to solve the D-cache aliasing issue for all | 249 | Next, you have to solve the D-cache aliasing issue for all |
250 | other cases. Please keep in mind that fact that, for a given page | 250 | other cases. Please keep in mind that fact that, for a given page |
251 | mapped into some user address space, there is always at least one more | 251 | mapped into some user address space, there is always at least one more |
252 | mapping, that of the kernel in it's linear mapping starting at | 252 | mapping, that of the kernel in its linear mapping starting at |
253 | PAGE_OFFSET. So immediately, once the first user maps a given | 253 | PAGE_OFFSET. So immediately, once the first user maps a given |
254 | physical page into its address space, by implication the D-cache | 254 | physical page into its address space, by implication the D-cache |
255 | aliasing problem has the potential to exist since the kernel already | 255 | aliasing problem has the potential to exist since the kernel already |
diff --git a/Documentation/cgroups/blkio-controller.txt b/Documentation/cgroups/blkio-controller.txt index 630879cd9a42..48e0b21b0059 100644 --- a/Documentation/cgroups/blkio-controller.txt +++ b/Documentation/cgroups/blkio-controller.txt | |||
@@ -17,6 +17,9 @@ HOWTO | |||
17 | You can do a very simple testing of running two dd threads in two different | 17 | You can do a very simple testing of running two dd threads in two different |
18 | cgroups. Here is what you can do. | 18 | cgroups. Here is what you can do. |
19 | 19 | ||
20 | - Enable Block IO controller | ||
21 | CONFIG_BLK_CGROUP=y | ||
22 | |||
20 | - Enable group scheduling in CFQ | 23 | - Enable group scheduling in CFQ |
21 | CONFIG_CFQ_GROUP_IOSCHED=y | 24 | CONFIG_CFQ_GROUP_IOSCHED=y |
22 | 25 | ||
@@ -54,32 +57,52 @@ cgroups. Here is what you can do. | |||
54 | 57 | ||
55 | Various user visible config options | 58 | Various user visible config options |
56 | =================================== | 59 | =================================== |
57 | CONFIG_CFQ_GROUP_IOSCHED | ||
58 | - Enables group scheduling in CFQ. Currently only 1 level of group | ||
59 | creation is allowed. | ||
60 | |||
61 | CONFIG_DEBUG_CFQ_IOSCHED | ||
62 | - Enables some debugging messages in blktrace. Also creates extra | ||
63 | cgroup file blkio.dequeue. | ||
64 | |||
65 | Config options selected automatically | ||
66 | ===================================== | ||
67 | These config options are not user visible and are selected/deselected | ||
68 | automatically based on IO scheduler configuration. | ||
69 | |||
70 | CONFIG_BLK_CGROUP | 60 | CONFIG_BLK_CGROUP |
71 | - Block IO controller. Selected by CONFIG_CFQ_GROUP_IOSCHED. | 61 | - Block IO controller. |
72 | 62 | ||
73 | CONFIG_DEBUG_BLK_CGROUP | 63 | CONFIG_DEBUG_BLK_CGROUP |
74 | - Debug help. Selected by CONFIG_DEBUG_CFQ_IOSCHED. | 64 | - Debug help. Right now some additional stats file show up in cgroup |
65 | if this option is enabled. | ||
66 | |||
67 | CONFIG_CFQ_GROUP_IOSCHED | ||
68 | - Enables group scheduling in CFQ. Currently only 1 level of group | ||
69 | creation is allowed. | ||
75 | 70 | ||
76 | Details of cgroup files | 71 | Details of cgroup files |
77 | ======================= | 72 | ======================= |
78 | - blkio.weight | 73 | - blkio.weight |
79 | - Specifies per cgroup weight. | 74 | - Specifies per cgroup weight. This is default weight of the group |
80 | 75 | on all the devices until and unless overridden by per device rule. | |
76 | (See blkio.weight_device). | ||
81 | Currently allowed range of weights is from 100 to 1000. | 77 | Currently allowed range of weights is from 100 to 1000. |
82 | 78 | ||
79 | - blkio.weight_device | ||
80 | - One can specify per cgroup per device rules using this interface. | ||
81 | These rules override the default value of group weight as specified | ||
82 | by blkio.weight. | ||
83 | |||
84 | Following is the format. | ||
85 | |||
86 | #echo dev_maj:dev_minor weight > /path/to/cgroup/blkio.weight_device | ||
87 | Configure weight=300 on /dev/sdb (8:16) in this cgroup | ||
88 | # echo 8:16 300 > blkio.weight_device | ||
89 | # cat blkio.weight_device | ||
90 | dev weight | ||
91 | 8:16 300 | ||
92 | |||
93 | Configure weight=500 on /dev/sda (8:0) in this cgroup | ||
94 | # echo 8:0 500 > blkio.weight_device | ||
95 | # cat blkio.weight_device | ||
96 | dev weight | ||
97 | 8:0 500 | ||
98 | 8:16 300 | ||
99 | |||
100 | Remove specific weight for /dev/sda in this cgroup | ||
101 | # echo 8:0 0 > blkio.weight_device | ||
102 | # cat blkio.weight_device | ||
103 | dev weight | ||
104 | 8:16 300 | ||
105 | |||
83 | - blkio.time | 106 | - blkio.time |
84 | - disk time allocated to cgroup per device in milliseconds. First | 107 | - disk time allocated to cgroup per device in milliseconds. First |
85 | two fields specify the major and minor number of the device and | 108 | two fields specify the major and minor number of the device and |
@@ -92,13 +115,105 @@ Details of cgroup files | |||
92 | third field specifies the number of sectors transferred by the | 115 | third field specifies the number of sectors transferred by the |
93 | group to/from the device. | 116 | group to/from the device. |
94 | 117 | ||
118 | - blkio.io_service_bytes | ||
119 | - Number of bytes transferred to/from the disk by the group. These | ||
120 | are further divided by the type of operation - read or write, sync | ||
121 | or async. First two fields specify the major and minor number of the | ||
122 | device, third field specifies the operation type and the fourth field | ||
123 | specifies the number of bytes. | ||
124 | |||
125 | - blkio.io_serviced | ||
126 | - Number of IOs completed to/from the disk by the group. These | ||
127 | are further divided by the type of operation - read or write, sync | ||
128 | or async. First two fields specify the major and minor number of the | ||
129 | device, third field specifies the operation type and the fourth field | ||
130 | specifies the number of IOs. | ||
131 | |||
132 | - blkio.io_service_time | ||
133 | - Total amount of time between request dispatch and request completion | ||
134 | for the IOs done by this cgroup. This is in nanoseconds to make it | ||
135 | meaningful for flash devices too. For devices with queue depth of 1, | ||
136 | this time represents the actual service time. When queue_depth > 1, | ||
137 | that is no longer true as requests may be served out of order. This | ||
138 | may cause the service time for a given IO to include the service time | ||
139 | of multiple IOs when served out of order which may result in total | ||
140 | io_service_time > actual time elapsed. This time is further divided by | ||
141 | the type of operation - read or write, sync or async. First two fields | ||
142 | specify the major and minor number of the device, third field | ||
143 | specifies the operation type and the fourth field specifies the | ||
144 | io_service_time in ns. | ||
145 | |||
146 | - blkio.io_wait_time | ||
147 | - Total amount of time the IOs for this cgroup spent waiting in the | ||
148 | scheduler queues for service. This can be greater than the total time | ||
149 | elapsed since it is cumulative io_wait_time for all IOs. It is not a | ||
150 | measure of total time the cgroup spent waiting but rather a measure of | ||
151 | the wait_time for its individual IOs. For devices with queue_depth > 1 | ||
152 | this metric does not include the time spent waiting for service once | ||
153 | the IO is dispatched to the device but till it actually gets serviced | ||
154 | (there might be a time lag here due to re-ordering of requests by the | ||
155 | device). This is in nanoseconds to make it meaningful for flash | ||
156 | devices too. This time is further divided by the type of operation - | ||
157 | read or write, sync or async. First two fields specify the major and | ||
158 | minor number of the device, third field specifies the operation type | ||
159 | and the fourth field specifies the io_wait_time in ns. | ||
160 | |||
161 | - blkio.io_merged | ||
162 | - Total number of bios/requests merged into requests belonging to this | ||
163 | cgroup. This is further divided by the type of operation - read or | ||
164 | write, sync or async. | ||
165 | |||
166 | - blkio.io_queued | ||
167 | - Total number of requests queued up at any given instant for this | ||
168 | cgroup. This is further divided by the type of operation - read or | ||
169 | write, sync or async. | ||
170 | |||
171 | - blkio.avg_queue_size | ||
172 | - Debugging aid only enabled if CONFIG_DEBUG_BLK_CGROUP=y. | ||
173 | The average queue size for this cgroup over the entire time of this | ||
174 | cgroup's existence. Queue size samples are taken each time one of the | ||
175 | queues of this cgroup gets a timeslice. | ||
176 | |||
177 | - blkio.group_wait_time | ||
178 | - Debugging aid only enabled if CONFIG_DEBUG_BLK_CGROUP=y. | ||
179 | This is the amount of time the cgroup had to wait since it became busy | ||
180 | (i.e., went from 0 to 1 request queued) to get a timeslice for one of | ||
181 | its queues. This is different from the io_wait_time which is the | ||
182 | cumulative total of the amount of time spent by each IO in that cgroup | ||
183 | waiting in the scheduler queue. This is in nanoseconds. If this is | ||
184 | read when the cgroup is in a waiting (for timeslice) state, the stat | ||
185 | will only report the group_wait_time accumulated till the last time it | ||
186 | got a timeslice and will not include the current delta. | ||
187 | |||
188 | - blkio.empty_time | ||
189 | - Debugging aid only enabled if CONFIG_DEBUG_BLK_CGROUP=y. | ||
190 | This is the amount of time a cgroup spends without any pending | ||
191 | requests when not being served, i.e., it does not include any time | ||
192 | spent idling for one of the queues of the cgroup. This is in | ||
193 | nanoseconds. If this is read when the cgroup is in an empty state, | ||
194 | the stat will only report the empty_time accumulated till the last | ||
195 | time it had a pending request and will not include the current delta. | ||
196 | |||
197 | - blkio.idle_time | ||
198 | - Debugging aid only enabled if CONFIG_DEBUG_BLK_CGROUP=y. | ||
199 | This is the amount of time spent by the IO scheduler idling for a | ||
200 | given cgroup in anticipation of a better request than the exising ones | ||
201 | from other queues/cgroups. This is in nanoseconds. If this is read | ||
202 | when the cgroup is in an idling state, the stat will only report the | ||
203 | idle_time accumulated till the last idle period and will not include | ||
204 | the current delta. | ||
205 | |||
95 | - blkio.dequeue | 206 | - blkio.dequeue |
96 | - Debugging aid only enabled if CONFIG_DEBUG_CFQ_IOSCHED=y. This | 207 | - Debugging aid only enabled if CONFIG_DEBUG_BLK_CGROUP=y. This |
97 | gives the statistics about how many a times a group was dequeued | 208 | gives the statistics about how many a times a group was dequeued |
98 | from service tree of the device. First two fields specify the major | 209 | from service tree of the device. First two fields specify the major |
99 | and minor number of the device and third field specifies the number | 210 | and minor number of the device and third field specifies the number |
100 | of times a group was dequeued from a particular device. | 211 | of times a group was dequeued from a particular device. |
101 | 212 | ||
213 | - blkio.reset_stats | ||
214 | - Writing an int to this file will result in resetting all the stats | ||
215 | for that cgroup. | ||
216 | |||
102 | CFQ sysfs tunable | 217 | CFQ sysfs tunable |
103 | ================= | 218 | ================= |
104 | /sys/block/<disk>/queue/iosched/group_isolation | 219 | /sys/block/<disk>/queue/iosched/group_isolation |
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt index fd588ff0e296..57444c2609fc 100644 --- a/Documentation/cgroups/cgroups.txt +++ b/Documentation/cgroups/cgroups.txt | |||
@@ -235,8 +235,7 @@ containing the following files describing that cgroup: | |||
235 | - cgroup.procs: list of tgids in the cgroup. This list is not | 235 | - cgroup.procs: list of tgids in the cgroup. This list is not |
236 | guaranteed to be sorted or free of duplicate tgids, and userspace | 236 | guaranteed to be sorted or free of duplicate tgids, and userspace |
237 | should sort/uniquify the list if this property is required. | 237 | should sort/uniquify the list if this property is required. |
238 | Writing a tgid into this file moves all threads with that tgid into | 238 | This is a read-only file, for now. |
239 | this cgroup. | ||
240 | - notify_on_release flag: run the release agent on exit? | 239 | - notify_on_release flag: run the release agent on exit? |
241 | - release_agent: the path to use for release notifications (this file | 240 | - release_agent: the path to use for release notifications (this file |
242 | exists in the top cgroup only) | 241 | exists in the top cgroup only) |
@@ -573,7 +572,7 @@ void cancel_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, | |||
573 | 572 | ||
574 | Called when a task attach operation has failed after can_attach() has succeeded. | 573 | Called when a task attach operation has failed after can_attach() has succeeded. |
575 | A subsystem whose can_attach() has some side-effects should provide this | 574 | A subsystem whose can_attach() has some side-effects should provide this |
576 | function, so that the subsytem can implement a rollback. If not, not necessary. | 575 | function, so that the subsystem can implement a rollback. If not, not necessary. |
577 | This will be called only about subsystems whose can_attach() operation have | 576 | This will be called only about subsystems whose can_attach() operation have |
578 | succeeded. | 577 | succeeded. |
579 | 578 | ||
diff --git a/Documentation/cgroups/cpusets.txt b/Documentation/cgroups/cpusets.txt index 4160df82b3f5..51682ab2dd1a 100644 --- a/Documentation/cgroups/cpusets.txt +++ b/Documentation/cgroups/cpusets.txt | |||
@@ -42,7 +42,7 @@ Nodes to a set of tasks. In this document "Memory Node" refers to | |||
42 | an on-line node that contains memory. | 42 | an on-line node that contains memory. |
43 | 43 | ||
44 | Cpusets constrain the CPU and Memory placement of tasks to only | 44 | Cpusets constrain the CPU and Memory placement of tasks to only |
45 | the resources within a tasks current cpuset. They form a nested | 45 | the resources within a task's current cpuset. They form a nested |
46 | hierarchy visible in a virtual file system. These are the essential | 46 | hierarchy visible in a virtual file system. These are the essential |
47 | hooks, beyond what is already present, required to manage dynamic | 47 | hooks, beyond what is already present, required to manage dynamic |
48 | job placement on large systems. | 48 | job placement on large systems. |
@@ -53,11 +53,11 @@ Documentation/cgroups/cgroups.txt. | |||
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 |
55 | set_mempolicy(2) system calls to include Memory Nodes in its memory | 55 | set_mempolicy(2) system calls to include Memory Nodes in its memory |
56 | policy, are both filtered through that tasks cpuset, filtering out any | 56 | policy, are both filtered through that task's cpuset, filtering out any |
57 | CPUs or Memory Nodes not in that cpuset. The scheduler will not | 57 | CPUs or Memory Nodes not in that cpuset. The scheduler will not |
58 | schedule a task on a CPU that is not allowed in its cpus_allowed | 58 | schedule a task on a CPU that is not allowed in its cpus_allowed |
59 | vector, and the kernel page allocator will not allocate a page on a | 59 | vector, and the kernel page allocator will not allocate a page on a |
60 | node that is not allowed in the requesting tasks mems_allowed vector. | 60 | node that is not allowed in the requesting task's mems_allowed vector. |
61 | 61 | ||
62 | User level code may create and destroy cpusets by name in the cgroup | 62 | User level code may create and destroy cpusets by name in the cgroup |
63 | virtual file system, manage the attributes and permissions of these | 63 | virtual file system, manage the attributes and permissions of these |
@@ -121,9 +121,9 @@ Cpusets extends these two mechanisms as follows: | |||
121 | - Each task in the system is attached to a cpuset, via a pointer | 121 | - Each task in the system is attached to a cpuset, via a pointer |
122 | in the task structure to a reference counted cgroup structure. | 122 | in the task structure to a reference counted cgroup structure. |
123 | - Calls to sched_setaffinity are filtered to just those CPUs | 123 | - Calls to sched_setaffinity are filtered to just those CPUs |
124 | allowed in that tasks cpuset. | 124 | allowed in that task's cpuset. |
125 | - Calls to mbind and set_mempolicy are filtered to just | 125 | - Calls to mbind and set_mempolicy are filtered to just |
126 | those Memory Nodes allowed in that tasks cpuset. | 126 | those Memory Nodes allowed in that task's cpuset. |
127 | - The root cpuset contains all the systems CPUs and Memory | 127 | - The root cpuset contains all the systems CPUs and Memory |
128 | Nodes. | 128 | Nodes. |
129 | - For any cpuset, one can define child cpusets containing a subset | 129 | - For any cpuset, one can define child cpusets containing a subset |
@@ -141,11 +141,11 @@ into the rest of the kernel, none in performance critical paths: | |||
141 | - in init/main.c, to initialize the root cpuset at system boot. | 141 | - in init/main.c, to initialize the root cpuset at system boot. |
142 | - in fork and exit, to attach and detach a task from its cpuset. | 142 | - in fork and exit, to attach and detach a task from its cpuset. |
143 | - in sched_setaffinity, to mask the requested CPUs by what's | 143 | - in sched_setaffinity, to mask the requested CPUs by what's |
144 | allowed in that tasks cpuset. | 144 | allowed in that task's cpuset. |
145 | - in sched.c migrate_live_tasks(), to keep migrating tasks within | 145 | - in sched.c migrate_live_tasks(), to keep migrating tasks within |
146 | the CPUs allowed by their cpuset, if possible. | 146 | the CPUs allowed by their cpuset, if possible. |
147 | - in the mbind and set_mempolicy system calls, to mask the requested | 147 | - in the mbind and set_mempolicy system calls, to mask the requested |
148 | Memory Nodes by what's allowed in that tasks cpuset. | 148 | Memory Nodes by what's allowed in that task's cpuset. |
149 | - in page_alloc.c, to restrict memory to allowed nodes. | 149 | - in page_alloc.c, to restrict memory to allowed nodes. |
150 | - in vmscan.c, to restrict page recovery to the current cpuset. | 150 | - in vmscan.c, to restrict page recovery to the current cpuset. |
151 | 151 | ||
@@ -155,7 +155,7 @@ new system calls are added for cpusets - all support for querying and | |||
155 | modifying cpusets is via this cpuset file system. | 155 | modifying cpusets is via this cpuset file system. |
156 | 156 | ||
157 | The /proc/<pid>/status file for each task has four added lines, | 157 | The /proc/<pid>/status file for each task has four added lines, |
158 | displaying the tasks cpus_allowed (on which CPUs it may be scheduled) | 158 | displaying the task's cpus_allowed (on which CPUs it may be scheduled) |
159 | and mems_allowed (on which Memory Nodes it may obtain memory), | 159 | and mems_allowed (on which Memory Nodes it may obtain memory), |
160 | in the two formats seen in the following example: | 160 | in the two formats seen in the following example: |
161 | 161 | ||
@@ -323,17 +323,17 @@ stack segment pages of a task. | |||
323 | 323 | ||
324 | By default, both kinds of memory spreading are off, and memory | 324 | By default, both kinds of memory spreading are off, and memory |
325 | pages are allocated on the node local to where the task is running, | 325 | pages are allocated on the node local to where the task is running, |
326 | except perhaps as modified by the tasks NUMA mempolicy or cpuset | 326 | except perhaps as modified by the task's NUMA mempolicy or cpuset |
327 | configuration, so long as sufficient free memory pages are available. | 327 | configuration, so long as sufficient free memory pages are available. |
328 | 328 | ||
329 | When new cpusets are created, they inherit the memory spread settings | 329 | When new cpusets are created, they inherit the memory spread settings |
330 | of their parent. | 330 | of their parent. |
331 | 331 | ||
332 | Setting memory spreading causes allocations for the affected page | 332 | Setting memory spreading causes allocations for the affected page |
333 | or slab caches to ignore the tasks NUMA mempolicy and be spread | 333 | or slab caches to ignore the task's NUMA mempolicy and be spread |
334 | instead. Tasks using mbind() or set_mempolicy() calls to set NUMA | 334 | instead. Tasks using mbind() or set_mempolicy() calls to set NUMA |
335 | mempolicies will not notice any change in these calls as a result of | 335 | mempolicies will not notice any change in these calls as a result of |
336 | their containing tasks memory spread settings. If memory spreading | 336 | their containing task's memory spread settings. If memory spreading |
337 | is turned off, then the currently specified NUMA mempolicy once again | 337 | is turned off, then the currently specified NUMA mempolicy once again |
338 | applies to memory page allocations. | 338 | applies to memory page allocations. |
339 | 339 | ||
@@ -357,7 +357,7 @@ pages from the node returned by cpuset_mem_spread_node(). | |||
357 | 357 | ||
358 | The cpuset_mem_spread_node() routine is also simple. It uses the | 358 | The cpuset_mem_spread_node() routine is also simple. It uses the |
359 | value of a per-task rotor cpuset_mem_spread_rotor to select the next | 359 | value of a per-task rotor cpuset_mem_spread_rotor to select the next |
360 | node in the current tasks mems_allowed to prefer for the allocation. | 360 | node in the current task's mems_allowed to prefer for the allocation. |
361 | 361 | ||
362 | This memory placement policy is also known (in other contexts) as | 362 | This memory placement policy is also known (in other contexts) as |
363 | round-robin or interleave. | 363 | round-robin or interleave. |
@@ -594,7 +594,7 @@ is attached, is subtle. | |||
594 | If a cpuset has its Memory Nodes modified, then for each task attached | 594 | If a cpuset has its Memory Nodes modified, then for each task attached |
595 | to that cpuset, the next time that the kernel attempts to allocate | 595 | to that cpuset, the next time that the kernel attempts to allocate |
596 | a page of memory for that task, the kernel will notice the change | 596 | a page of memory for that task, the kernel will notice the change |
597 | in the tasks cpuset, and update its per-task memory placement to | 597 | in the task's cpuset, and update its per-task memory placement to |
598 | remain within the new cpusets memory placement. If the task was using | 598 | remain within the new cpusets memory placement. If the task was using |
599 | mempolicy MPOL_BIND, and the nodes to which it was bound overlap with | 599 | mempolicy MPOL_BIND, and the nodes to which it was bound overlap with |
600 | its new cpuset, then the task will continue to use whatever subset | 600 | its new cpuset, then the task will continue to use whatever subset |
@@ -603,13 +603,13 @@ was using MPOL_BIND and now none of its MPOL_BIND nodes are allowed | |||
603 | in the new cpuset, then the task will be essentially treated as if it | 603 | in the new cpuset, then the task will be essentially treated as if it |
604 | was MPOL_BIND bound to the new cpuset (even though its NUMA placement, | 604 | was MPOL_BIND bound to the new cpuset (even though its NUMA placement, |
605 | as queried by get_mempolicy(), doesn't change). If a task is moved | 605 | as queried by get_mempolicy(), doesn't change). If a task is moved |
606 | from one cpuset to another, then the kernel will adjust the tasks | 606 | from one cpuset to another, then the kernel will adjust the task's |
607 | memory placement, as above, the next time that the kernel attempts | 607 | memory placement, as above, the next time that the kernel attempts |
608 | to allocate a page of memory for that task. | 608 | to allocate a page of memory for that task. |
609 | 609 | ||
610 | If a cpuset has its 'cpuset.cpus' modified, then each task in that cpuset | 610 | If a cpuset has its 'cpuset.cpus' modified, then each task in that cpuset |
611 | will have its allowed CPU placement changed immediately. Similarly, | 611 | will have its allowed CPU placement changed immediately. Similarly, |
612 | if a tasks pid is written to another cpusets 'cpuset.tasks' file, then its | 612 | if a task's pid is written to another cpusets 'cpuset.tasks' file, then its |
613 | allowed CPU placement is changed immediately. If such a task had been | 613 | allowed CPU placement is changed immediately. If such a task had been |
614 | bound to some subset of its cpuset using the sched_setaffinity() call, | 614 | bound to some subset of its cpuset using the sched_setaffinity() call, |
615 | the task will be allowed to run on any CPU allowed in its new cpuset, | 615 | the task will be allowed to run on any CPU allowed in its new cpuset, |
@@ -626,16 +626,16 @@ cpusets memory placement policy 'cpuset.mems' subsequently changes. | |||
626 | If the cpuset flag file 'cpuset.memory_migrate' is set true, then when | 626 | If the cpuset flag file 'cpuset.memory_migrate' is set true, then when |
627 | tasks are attached to that cpuset, any pages that task had | 627 | tasks are attached to that cpuset, any pages that task had |
628 | allocated to it on nodes in its previous cpuset are migrated | 628 | allocated to it on nodes in its previous cpuset are migrated |
629 | to the tasks new cpuset. The relative placement of the page within | 629 | to the task's new cpuset. The relative placement of the page within |
630 | the cpuset is preserved during these migration operations if possible. | 630 | the cpuset is preserved during these migration operations if possible. |
631 | For example if the page was on the second valid node of the prior cpuset | 631 | For example if the page was on the second valid node of the prior cpuset |
632 | then the page will be placed on the second valid node of the new cpuset. | 632 | then the page will be placed on the second valid node of the new cpuset. |
633 | 633 | ||
634 | Also if 'cpuset.memory_migrate' is set true, then if that cpusets | 634 | Also if 'cpuset.memory_migrate' is set true, then if that cpuset's |
635 | 'cpuset.mems' file is modified, pages allocated to tasks in that | 635 | 'cpuset.mems' file is modified, pages allocated to tasks in that |
636 | cpuset, that were on nodes in the previous setting of 'cpuset.mems', | 636 | cpuset, that were on nodes in the previous setting of 'cpuset.mems', |
637 | will be moved to nodes in the new setting of 'mems.' | 637 | will be moved to nodes in the new setting of 'mems.' |
638 | Pages that were not in the tasks prior cpuset, or in the cpusets | 638 | Pages that were not in the task's prior cpuset, or in the cpuset's |
639 | prior 'cpuset.mems' setting, will not be moved. | 639 | prior 'cpuset.mems' setting, will not be moved. |
640 | 640 | ||
641 | There is an exception to the above. If hotplug functionality is used | 641 | There is an exception to the above. If hotplug functionality is used |
@@ -655,7 +655,7 @@ There is a second exception to the above. GFP_ATOMIC requests are | |||
655 | kernel internal allocations that must be satisfied, immediately. | 655 | kernel internal allocations that must be satisfied, immediately. |
656 | The kernel may drop some request, in rare cases even panic, if a | 656 | The kernel may drop some request, in rare cases even panic, if a |
657 | GFP_ATOMIC alloc fails. If the request cannot be satisfied within | 657 | GFP_ATOMIC alloc fails. If the request cannot be satisfied within |
658 | the current tasks cpuset, then we relax the cpuset, and look for | 658 | the current task's cpuset, then we relax the cpuset, and look for |
659 | memory anywhere we can find it. It's better to violate the cpuset | 659 | memory anywhere we can find it. It's better to violate the cpuset |
660 | than stress the kernel. | 660 | than stress the kernel. |
661 | 661 | ||
diff --git a/Documentation/cgroups/memcg_test.txt b/Documentation/cgroups/memcg_test.txt index f7f68b2ac199..b7eececfb195 100644 --- a/Documentation/cgroups/memcg_test.txt +++ b/Documentation/cgroups/memcg_test.txt | |||
@@ -244,7 +244,7 @@ Under below explanation, we assume CONFIG_MEM_RES_CTRL_SWAP=y. | |||
244 | we have to check if OLDPAGE/NEWPAGE is a valid page after commit(). | 244 | we have to check if OLDPAGE/NEWPAGE is a valid page after commit(). |
245 | 245 | ||
246 | 8. LRU | 246 | 8. LRU |
247 | Each memcg has its own private LRU. Now, it's handling is under global | 247 | Each memcg has its own private LRU. Now, its handling is under global |
248 | VM's control (means that it's handled under global zone->lru_lock). | 248 | VM's control (means that it's handled under global zone->lru_lock). |
249 | Almost all routines around memcg's LRU is called by global LRU's | 249 | Almost all routines around memcg's LRU is called by global LRU's |
250 | list management functions under zone->lru_lock(). | 250 | list management functions under zone->lru_lock(). |
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index 3a6aecd078ba..6cab1f29da4c 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt | |||
@@ -263,7 +263,7 @@ some of the pages cached in the cgroup (page cache pages). | |||
263 | 263 | ||
264 | 4.2 Task migration | 264 | 4.2 Task migration |
265 | 265 | ||
266 | When a task migrates from one cgroup to another, it's charge is not | 266 | When a task migrates from one cgroup to another, its charge is not |
267 | carried forward by default. The pages allocated from the original cgroup still | 267 | carried forward by default. The pages allocated from the original cgroup still |
268 | remain charged to it, the charge is dropped when the page is freed or | 268 | remain charged to it, the charge is dropped when the page is freed or |
269 | reclaimed. | 269 | reclaimed. |
diff --git a/Documentation/connector/cn_test.c b/Documentation/connector/cn_test.c index b07add3467f1..7764594778d4 100644 --- a/Documentation/connector/cn_test.c +++ b/Documentation/connector/cn_test.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
27 | #include <linux/skbuff.h> | 27 | #include <linux/skbuff.h> |
28 | #include <linux/slab.h> | ||
28 | #include <linux/timer.h> | 29 | #include <linux/timer.h> |
29 | 30 | ||
30 | #include <linux/connector.h> | 31 | #include <linux/connector.h> |
diff --git a/Documentation/connector/connector.txt b/Documentation/connector/connector.txt index 78c9466a9aa8..e5c5f5e6ab70 100644 --- a/Documentation/connector/connector.txt +++ b/Documentation/connector/connector.txt | |||
@@ -88,7 +88,7 @@ int cn_netlink_send(struct cn_msg *msg, u32 __groups, int gfp_mask); | |||
88 | int gfp_mask - GFP mask. | 88 | int gfp_mask - GFP mask. |
89 | 89 | ||
90 | Note: When registering new callback user, connector core assigns | 90 | Note: When registering new callback user, connector core assigns |
91 | netlink group to the user which is equal to it's id.idx. | 91 | netlink group to the user which is equal to its id.idx. |
92 | 92 | ||
93 | /*****************************************/ | 93 | /*****************************************/ |
94 | Protocol description. | 94 | Protocol description. |
diff --git a/Documentation/credentials.txt b/Documentation/credentials.txt index df03169782ea..a2db35287003 100644 --- a/Documentation/credentials.txt +++ b/Documentation/credentials.txt | |||
@@ -408,9 +408,6 @@ This should be used inside the RCU read lock, as in the following example: | |||
408 | ... | 408 | ... |
409 | } | 409 | } |
410 | 410 | ||
411 | A function need not get RCU read lock to use __task_cred() if it is holding a | ||
412 | spinlock at the time as this implicitly holds the RCU read lock. | ||
413 | |||
414 | Should it be necessary to hold another task's credentials for a long period of | 411 | Should it be necessary to hold another task's credentials for a long period of |
415 | time, and possibly to sleep whilst doing so, then the caller should get a | 412 | time, and possibly to sleep whilst doing so, then the caller should get a |
416 | reference on them using: | 413 | reference on them using: |
@@ -426,17 +423,16 @@ credentials, hiding the RCU magic from the caller: | |||
426 | uid_t task_uid(task) Task's real UID | 423 | uid_t task_uid(task) Task's real UID |
427 | uid_t task_euid(task) Task's effective UID | 424 | uid_t task_euid(task) Task's effective UID |
428 | 425 | ||
429 | If the caller is holding a spinlock or the RCU read lock at the time anyway, | 426 | If the caller is holding the RCU read lock at the time anyway, then: |
430 | then: | ||
431 | 427 | ||
432 | __task_cred(task)->uid | 428 | __task_cred(task)->uid |
433 | __task_cred(task)->euid | 429 | __task_cred(task)->euid |
434 | 430 | ||
435 | should be used instead. Similarly, if multiple aspects of a task's credentials | 431 | should be used instead. Similarly, if multiple aspects of a task's credentials |
436 | need to be accessed, RCU read lock or a spinlock should be used, __task_cred() | 432 | need to be accessed, RCU read lock should be used, __task_cred() called, the |
437 | called, the result stored in a temporary pointer and then the credential | 433 | result stored in a temporary pointer and then the credential aspects called |
438 | aspects called from that before dropping the lock. This prevents the | 434 | from that before dropping the lock. This prevents the potentially expensive |
439 | potentially expensive RCU magic from being invoked multiple times. | 435 | RCU magic from being invoked multiple times. |
440 | 436 | ||
441 | Should some other single aspect of another task's credentials need to be | 437 | Should some other single aspect of another task's credentials need to be |
442 | accessed, then this can be used: | 438 | accessed, then this can be used: |
diff --git a/Documentation/development-process/2.Process b/Documentation/development-process/2.Process index d750321acd5a..97726eba6102 100644 --- a/Documentation/development-process/2.Process +++ b/Documentation/development-process/2.Process | |||
@@ -151,7 +151,7 @@ The stages that a patch goes through are, generally: | |||
151 | well. | 151 | well. |
152 | 152 | ||
153 | - Wider review. When the patch is getting close to ready for mainline | 153 | - Wider review. When the patch is getting close to ready for mainline |
154 | inclusion, it will be accepted by a relevant subsystem maintainer - | 154 | inclusion, it should be accepted by a relevant subsystem maintainer - |
155 | though this acceptance is not a guarantee that the patch will make it | 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 | 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 | 157 | subsystem tree and into the staging trees (described below). When the |
@@ -159,6 +159,15 @@ The stages that a patch goes through are, generally: | |||
159 | the discovery of any problems resulting from the integration of this | 159 | the discovery of any problems resulting from the integration of this |
160 | patch with work being done by others. | 160 | patch with work being done by others. |
161 | 161 | ||
162 | - Please note that most maintainers also have day jobs, so merging | ||
163 | your patch may not be their highest priority. If your patch is | ||
164 | getting feedback about changes that are needed, you should either | ||
165 | make those changes or justify why they should not be made. If your | ||
166 | patch has no review complaints but is not being merged by its | ||
167 | appropriate subsystem or driver maintainer, you should be persistent | ||
168 | in updating the patch to the current kernel so that it applies cleanly | ||
169 | and keep sending it for review and merging. | ||
170 | |||
162 | - Merging into the mainline. Eventually, a successful patch will be | 171 | - Merging into the mainline. Eventually, a successful patch will be |
163 | merged into the mainline repository managed by Linus Torvalds. More | 172 | merged into the mainline repository managed by Linus Torvalds. More |
164 | comments and/or problems may surface at this time; it is important that | 173 | comments and/or problems may surface at this time; it is important that |
@@ -258,12 +267,8 @@ 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 | 267 | development cycle, approximately 10% of the patches going into the mainline |
259 | get there via -mm. | 268 | get there via -mm. |
260 | 269 | ||
261 | The current -mm patch can always be found from the front page of | 270 | The current -mm patch is available in the "mmotm" (-mm of the moment) |
262 | 271 | directory at: | |
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 | 272 | ||
268 | http://userweb.kernel.org/~akpm/mmotm/ | 273 | http://userweb.kernel.org/~akpm/mmotm/ |
269 | 274 | ||
@@ -298,6 +303,12 @@ 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 | 303 | 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. | 304 | stay tuned; much is still in flux where linux-next is involved. |
300 | 305 | ||
306 | Besides the mmotm and linux-next trees, the kernel source tree now contains | ||
307 | the drivers/staging/ directory and many sub-directories for drivers or | ||
308 | filesystems that are on their way to being added to the kernel tree | ||
309 | proper, but they remain in drivers/staging/ while they still need more | ||
310 | work. | ||
311 | |||
301 | 312 | ||
302 | 2.5: TOOLS | 313 | 2.5: TOOLS |
303 | 314 | ||
@@ -319,9 +330,9 @@ 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. | 330 | to keep up with what other developers (and the mainline) are doing. |
320 | 331 | ||
321 | Git is now packaged by almost all Linux distributions. There is a home | 332 | Git is now packaged by almost all Linux distributions. There is a home |
322 | page at | 333 | page at: |
323 | 334 | ||
324 | http://git.or.cz/ | 335 | http://git-scm.com/ |
325 | 336 | ||
326 | That page has pointers to documentation and tutorials. One should be | 337 | 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 | 338 | aware, in particular, of the Kernel Hacker's Guide to git, which has |
diff --git a/Documentation/development-process/7.AdvancedTopics b/Documentation/development-process/7.AdvancedTopics index a2cf74093aa1..837179447e17 100644 --- a/Documentation/development-process/7.AdvancedTopics +++ b/Documentation/development-process/7.AdvancedTopics | |||
@@ -25,7 +25,7 @@ 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 | 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: | 26 | wish to come up to speed with git will find more information at: |
27 | 27 | ||
28 | http://git.or.cz/ | 28 | http://git-scm.com/ |
29 | 29 | ||
30 | http://www.kernel.org/pub/software/scm/git/docs/user-manual.html | 30 | http://www.kernel.org/pub/software/scm/git/docs/user-manual.html |
31 | 31 | ||
diff --git a/Documentation/dvb/ci.txt b/Documentation/dvb/ci.txt index 2ecd834585e6..4a0c2b56e690 100644 --- a/Documentation/dvb/ci.txt +++ b/Documentation/dvb/ci.txt | |||
@@ -41,7 +41,7 @@ This application requires the following to function properly as of now. | |||
41 | 41 | ||
42 | * Cards that fall in this category | 42 | * Cards that fall in this category |
43 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 43 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
44 | At present the cards that fall in this category are the Twinhan and it's | 44 | At present the cards that fall in this category are the Twinhan and its |
45 | clones, these cards are available as VVMER, Tomato, Hercules, Orange and | 45 | clones, these cards are available as VVMER, Tomato, Hercules, Orange and |
46 | so on. | 46 | so on. |
47 | 47 | ||
diff --git a/Documentation/dvb/contributors.txt b/Documentation/dvb/contributors.txt index 4865addebe1c..47c30098dab6 100644 --- a/Documentation/dvb/contributors.txt +++ b/Documentation/dvb/contributors.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | Thanks go to the following people for patches and contributions: | 1 | Thanks go to the following people for patches and contributions: |
2 | 2 | ||
3 | Michael Hunold <m.hunold@gmx.de> | 3 | Michael Hunold <m.hunold@gmx.de> |
4 | for the initial saa7146 driver and it's recent overhaul | 4 | for the initial saa7146 driver and its recent overhaul |
5 | 5 | ||
6 | Christian Theiss | 6 | Christian Theiss |
7 | for his work on the initial Linux DVB driver | 7 | for his work on the initial Linux DVB driver |
diff --git a/Documentation/fb/imacfb.txt b/Documentation/fb/efifb.txt index 316ec9bb7deb..a59916c29b33 100644 --- a/Documentation/fb/imacfb.txt +++ b/Documentation/fb/efifb.txt | |||
@@ -1,9 +1,9 @@ | |||
1 | 1 | ||
2 | What is imacfb? | 2 | What is efifb? |
3 | =============== | 3 | =============== |
4 | 4 | ||
5 | This is a generic EFI platform driver for Intel based Apple computers. | 5 | This is a generic EFI platform driver for Intel based Apple computers. |
6 | Imacfb is only for EFI booted Intel Macs. | 6 | efifb is only for EFI booted Intel Macs. |
7 | 7 | ||
8 | Supported Hardware | 8 | Supported Hardware |
9 | ================== | 9 | ================== |
@@ -16,16 +16,16 @@ MacMini | |||
16 | How to use it? | 16 | How to use it? |
17 | ============== | 17 | ============== |
18 | 18 | ||
19 | Imacfb does not have any kind of autodetection of your machine. | 19 | efifb does not have any kind of autodetection of your machine. |
20 | You have to add the following kernel parameters in your elilo.conf: | 20 | You have to add the following kernel parameters in your elilo.conf: |
21 | Macbook : | 21 | Macbook : |
22 | video=imacfb:macbook | 22 | video=efifb:macbook |
23 | MacMini : | 23 | MacMini : |
24 | video=imacfb:mini | 24 | video=efifb:mini |
25 | Macbook Pro 15", iMac 17" : | 25 | Macbook Pro 15", iMac 17" : |
26 | video=imacfb:i17 | 26 | video=efifb:i17 |
27 | Macbook Pro 17", iMac 20" : | 27 | Macbook Pro 17", iMac 20" : |
28 | video=imacfb:i20 | 28 | video=efifb:i20 |
29 | 29 | ||
30 | -- | 30 | -- |
31 | Edgar Hucek <gimli@dark-green.com> | 31 | Edgar Hucek <gimli@dark-green.com> |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index ed511af0f79a..a86152ae2f6f 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -241,16 +241,6 @@ Who: Thomas Gleixner <tglx@linutronix.de> | |||
241 | 241 | ||
242 | --------------------------- | 242 | --------------------------- |
243 | 243 | ||
244 | What (Why): | ||
245 | - xt_recent: the old ipt_recent proc dir | ||
246 | (superseded by /proc/net/xt_recent) | ||
247 | |||
248 | When: January 2009 or Linux 2.7.0, whichever comes first | ||
249 | Why: Superseded by newer revisions or modules | ||
250 | Who: Jan Engelhardt <jengelh@computergmbh.de> | ||
251 | |||
252 | --------------------------- | ||
253 | |||
254 | What: GPIO autorequest on gpio_direction_{input,output}() in gpiolib | 244 | What: GPIO autorequest on gpio_direction_{input,output}() in gpiolib |
255 | When: February 2010 | 245 | When: February 2010 |
256 | Why: All callers should use explicit gpio_request()/gpio_free(). | 246 | Why: All callers should use explicit gpio_request()/gpio_free(). |
@@ -520,26 +510,21 @@ Who: Hans de Goede <hdegoede@redhat.com> | |||
520 | 510 | ||
521 | ---------------------------- | 511 | ---------------------------- |
522 | 512 | ||
523 | What: corgikbd, spitzkbd, tosakbd driver | 513 | What: sysfs-class-rfkill state file |
524 | When: 2.6.35 | 514 | When: Feb 2014 |
525 | Files: drivers/input/keyboard/{corgi,spitz,tosa}kbd.c | 515 | Files: net/rfkill/core.c |
526 | Why: We now have a generic GPIO based matrix keyboard driver that | 516 | Why: Documented as obsolete since Feb 2010. This file is limited to 3 |
527 | are fully capable of handling all the keys on these devices. | 517 | states while the rfkill drivers can have 4 states. |
528 | The original drivers manipulate the GPIO registers directly | 518 | Who: anybody or Florian Mickler <florian@mickler.org> |
529 | and so are difficult to maintain. | ||
530 | Who: Eric Miao <eric.y.miao@gmail.com> | ||
531 | 519 | ||
532 | ---------------------------- | 520 | ---------------------------- |
533 | 521 | ||
534 | What: corgi_ssp and corgi_ts driver | 522 | What: sysfs-class-rfkill claim file |
535 | When: 2.6.35 | 523 | When: Feb 2012 |
536 | Files: arch/arm/mach-pxa/corgi_ssp.c, drivers/input/touchscreen/corgi_ts.c | 524 | Files: net/rfkill/core.c |
537 | Why: The corgi touchscreen is now deprecated in favour of the generic | 525 | Why: It is not possible to claim an rfkill driver since 2007. This is |
538 | ads7846.c driver. The noise reduction technique used in corgi_ts.c, | 526 | Documented as obsolete since Feb 2010. |
539 | that's to wait till vsync before ADC sampling, is also integrated into | 527 | Who: anybody or Florian Mickler <florian@mickler.org> |
540 | ads7846 driver now. Provided that the original driver is not generic | ||
541 | and is difficult to maintain, it will be removed later. | ||
542 | Who: Eric Miao <eric.y.miao@gmail.com> | ||
543 | 528 | ||
544 | ---------------------------- | 529 | ---------------------------- |
545 | 530 | ||
@@ -564,6 +549,16 @@ Who: Avi Kivity <avi@redhat.com> | |||
564 | 549 | ||
565 | ---------------------------- | 550 | ---------------------------- |
566 | 551 | ||
552 | What: xtime, wall_to_monotonic | ||
553 | When: 2.6.36+ | ||
554 | Files: kernel/time/timekeeping.c include/linux/time.h | ||
555 | Why: Cleaning up timekeeping internal values. Please use | ||
556 | existing timekeeping accessor functions to access | ||
557 | the equivalent functionality. | ||
558 | Who: John Stultz <johnstul@us.ibm.com> | ||
559 | |||
560 | ---------------------------- | ||
561 | |||
567 | What: KVM kernel-allocated memory slots | 562 | What: KVM kernel-allocated memory slots |
568 | When: July 2010 | 563 | When: July 2010 |
569 | Why: Since 2.6.25, kvm supports user-allocated memory slots, which are | 564 | Why: Since 2.6.25, kvm supports user-allocated memory slots, which are |
@@ -589,3 +584,65 @@ Why: Useful in 2003, implementation is a hack. | |||
589 | Generally invoked by accident today. | 584 | Generally invoked by accident today. |
590 | Seen as doing more harm than good. | 585 | Seen as doing more harm than good. |
591 | Who: Len Brown <len.brown@intel.com> | 586 | Who: Len Brown <len.brown@intel.com> |
587 | |||
588 | ---------------------------- | ||
589 | |||
590 | What: iwlwifi 50XX module parameters | ||
591 | When: 2.6.40 | ||
592 | Why: The "..50" modules parameters were used to configure 5000 series and | ||
593 | up devices; different set of module parameters also available for 4965 | ||
594 | with same functionalities. Consolidate both set into single place | ||
595 | in drivers/net/wireless/iwlwifi/iwl-agn.c | ||
596 | |||
597 | Who: Wey-Yi Guy <wey-yi.w.guy@intel.com> | ||
598 | |||
599 | ---------------------------- | ||
600 | |||
601 | What: iwl4965 alias support | ||
602 | When: 2.6.40 | ||
603 | Why: Internal alias support has been present in module-init-tools for some | ||
604 | time, the MODULE_ALIAS("iwl4965") boilerplate aliases can be removed | ||
605 | with no impact. | ||
606 | |||
607 | Who: Wey-Yi Guy <wey-yi.w.guy@intel.com> | ||
608 | |||
609 | --------------------------- | ||
610 | |||
611 | What: xt_NOTRACK | ||
612 | Files: net/netfilter/xt_NOTRACK.c | ||
613 | When: April 2011 | ||
614 | Why: Superseded by xt_CT | ||
615 | Who: Netfilter developer team <netfilter-devel@vger.kernel.org> | ||
616 | |||
617 | --------------------------- | ||
618 | |||
619 | What: video4linux /dev/vtx teletext API support | ||
620 | When: 2.6.35 | ||
621 | Files: drivers/media/video/saa5246a.c drivers/media/video/saa5249.c | ||
622 | include/linux/videotext.h | ||
623 | Why: The vtx device nodes have been superseded by vbi device nodes | ||
624 | for many years. No applications exist that use the vtx support. | ||
625 | Of the two i2c drivers that actually support this API the saa5249 | ||
626 | has been impossible to use for a year now and no known hardware | ||
627 | that supports this device exists. The saa5246a is theoretically | ||
628 | supported by the old mxb boards, but it never actually worked. | ||
629 | |||
630 | In summary: there is no hardware that can use this API and there | ||
631 | are no applications actually implementing this API. | ||
632 | |||
633 | The vtx support still reserves minors 192-223 and we would really | ||
634 | like to reuse those for upcoming new functionality. In the unlikely | ||
635 | event that new hardware appears that wants to use the functionality | ||
636 | provided by the vtx API, then that functionality should be build | ||
637 | around the sliced VBI API instead. | ||
638 | Who: Hans Verkuil <hverkuil@xs4all.nl> | ||
639 | |||
640 | ---------------------------- | ||
641 | |||
642 | What: IRQF_DISABLED | ||
643 | When: 2.6.36 | ||
644 | Why: The flag is a NOOP as we run interrupt handlers with interrupts disabled | ||
645 | Who: Thomas Gleixner <tglx@linutronix.de> | ||
646 | |||
647 | ---------------------------- | ||
648 | |||
diff --git a/Documentation/filesystems/00-INDEX b/Documentation/filesystems/00-INDEX index 3bae418c6ad3..4303614b5add 100644 --- a/Documentation/filesystems/00-INDEX +++ b/Documentation/filesystems/00-INDEX | |||
@@ -16,6 +16,8 @@ befs.txt | |||
16 | - information about the BeOS filesystem for Linux. | 16 | - information about the BeOS filesystem for Linux. |
17 | bfs.txt | 17 | bfs.txt |
18 | - info for the SCO UnixWare Boot Filesystem (BFS). | 18 | - info for the SCO UnixWare Boot Filesystem (BFS). |
19 | ceph.txt | ||
20 | - info for the Ceph Distributed File System | ||
19 | cifs.txt | 21 | cifs.txt |
20 | - description of the CIFS filesystem. | 22 | - description of the CIFS filesystem. |
21 | coda.txt | 23 | coda.txt |
diff --git a/Documentation/filesystems/9p.txt b/Documentation/filesystems/9p.txt index 57e0b80a5274..c0236e753bc8 100644 --- a/Documentation/filesystems/9p.txt +++ b/Documentation/filesystems/9p.txt | |||
@@ -37,6 +37,15 @@ For Plan 9 From User Space applications (http://swtch.com/plan9) | |||
37 | 37 | ||
38 | mount -t 9p `namespace`/acme /mnt/9 -o trans=unix,uname=$USER | 38 | mount -t 9p `namespace`/acme /mnt/9 -o trans=unix,uname=$USER |
39 | 39 | ||
40 | For server running on QEMU host with virtio transport: | ||
41 | |||
42 | mount -t 9p -o trans=virtio <mount_tag> /mnt/9 | ||
43 | |||
44 | where mount_tag is the tag associated by the server to each of the exported | ||
45 | mount points. Each 9P export is seen by the client as a virtio device with an | ||
46 | associated "mount_tag" property. Available mount tags can be | ||
47 | seen by reading /sys/bus/virtio/drivers/9pnet_virtio/virtio<n>/mount_tag files. | ||
48 | |||
40 | OPTIONS | 49 | OPTIONS |
41 | ======= | 50 | ======= |
42 | 51 | ||
@@ -47,7 +56,7 @@ OPTIONS | |||
47 | fd - used passed file descriptors for connection | 56 | fd - used passed file descriptors for connection |
48 | (see rfdno and wfdno) | 57 | (see rfdno and wfdno) |
49 | virtio - connect to the next virtio channel available | 58 | virtio - connect to the next virtio channel available |
50 | (from lguest or KVM with trans_virtio module) | 59 | (from QEMU with trans_virtio module) |
51 | rdma - connect to a specified RDMA channel | 60 | rdma - connect to a specified RDMA channel |
52 | 61 | ||
53 | uname=name user name to attempt mount as on the remote server. The | 62 | uname=name user name to attempt mount as on the remote server. The |
@@ -85,7 +94,12 @@ OPTIONS | |||
85 | 94 | ||
86 | port=n port to connect to on the remote server | 95 | port=n port to connect to on the remote server |
87 | 96 | ||
88 | noextend force legacy mode (no 9p2000.u semantics) | 97 | noextend force legacy mode (no 9p2000.u or 9p2000.L semantics) |
98 | |||
99 | version=name Select 9P protocol version. Valid options are: | ||
100 | 9p2000 - Legacy mode (same as noextend) | ||
101 | 9p2000.u - Use 9P2000.u protocol | ||
102 | 9p2000.L - Use 9P2000.L protocol | ||
89 | 103 | ||
90 | dfltuid attempt to mount as a particular uid | 104 | dfltuid attempt to mount as a particular uid |
91 | 105 | ||
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 06bbbed71206..af1608070cd5 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -178,7 +178,7 @@ prototypes: | |||
178 | locking rules: | 178 | locking rules: |
179 | All except set_page_dirty may block | 179 | All except set_page_dirty may block |
180 | 180 | ||
181 | BKL PageLocked(page) i_sem | 181 | BKL PageLocked(page) i_mutex |
182 | writepage: no yes, unlocks (see below) | 182 | writepage: no yes, unlocks (see below) |
183 | readpage: no yes, unlocks | 183 | readpage: no yes, unlocks |
184 | sync_page: no maybe | 184 | sync_page: no maybe |
@@ -429,7 +429,7 @@ check_flags: no | |||
429 | implementations. If your fs is not using generic_file_llseek, you | 429 | implementations. If your fs is not using generic_file_llseek, you |
430 | need to acquire and release the appropriate locks in your ->llseek(). | 430 | need to acquire and release the appropriate locks in your ->llseek(). |
431 | For many filesystems, it is probably safe to acquire the inode | 431 | For many filesystems, it is probably safe to acquire the inode |
432 | semaphore. Note some filesystems (i.e. remote ones) provide no | 432 | mutex. Note some filesystems (i.e. remote ones) provide no |
433 | protection for i_size so you will need to use the BKL. | 433 | protection for i_size so you will need to use the BKL. |
434 | 434 | ||
435 | Note: ext2_release() was *the* source of contention on fs-intensive | 435 | Note: ext2_release() was *the* source of contention on fs-intensive |
diff --git a/Documentation/filesystems/autofs4-mount-control.txt b/Documentation/filesystems/autofs4-mount-control.txt index 8f78ded4b648..51986bf08a4d 100644 --- a/Documentation/filesystems/autofs4-mount-control.txt +++ b/Documentation/filesystems/autofs4-mount-control.txt | |||
@@ -146,7 +146,7 @@ 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 | 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 | 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 | 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 | 149 | replacement probably because its primary purpose in life is to be a |
150 | message bus implementation rather than specifically an ioctl replacement. | 150 | message bus implementation rather than specifically an ioctl replacement. |
151 | While it would be possible to work around this there is one concern | 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 | 152 | that lead to the decision to not use it. This is that the autofs |
diff --git a/Documentation/filesystems/ceph.txt b/Documentation/filesystems/ceph.txt index 6e03917316bd..763d8ebbbebd 100644 --- a/Documentation/filesystems/ceph.txt +++ b/Documentation/filesystems/ceph.txt | |||
@@ -8,7 +8,7 @@ Basic features include: | |||
8 | 8 | ||
9 | * POSIX semantics | 9 | * POSIX semantics |
10 | * Seamless scaling from 1 to many thousands of nodes | 10 | * Seamless scaling from 1 to many thousands of nodes |
11 | * High availability and reliability. No single points of failure. | 11 | * High availability and reliability. No single point of failure. |
12 | * N-way replication of data across storage nodes | 12 | * N-way replication of data across storage nodes |
13 | * Fast recovery from node failures | 13 | * Fast recovery from node failures |
14 | * Automatic rebalancing of data on node addition/removal | 14 | * Automatic rebalancing of data on node addition/removal |
@@ -90,11 +90,11 @@ Mount Options | |||
90 | Specify the IP and/or port the client should bind to locally. | 90 | Specify the IP and/or port the client should bind to locally. |
91 | There is normally not much reason to do this. If the IP is not | 91 | There is normally not much reason to do this. If the IP is not |
92 | specified, the client's IP address is determined by looking at the | 92 | specified, the client's IP address is determined by looking at the |
93 | address it's connection to the monitor originates from. | 93 | address its connection to the monitor originates from. |
94 | 94 | ||
95 | wsize=X | 95 | wsize=X |
96 | Specify the maximum write size in bytes. By default there is no | 96 | Specify the maximum write size in bytes. By default there is no |
97 | maximu. Ceph will normally size writes based on the file stripe | 97 | maximum. Ceph will normally size writes based on the file stripe |
98 | size. | 98 | size. |
99 | 99 | ||
100 | rsize=X | 100 | rsize=X |
@@ -115,7 +115,7 @@ Mount Options | |||
115 | number of entries in that directory. | 115 | number of entries in that directory. |
116 | 116 | ||
117 | nocrc | 117 | nocrc |
118 | Disable CRC32C calculation for data writes. If set, the OSD | 118 | Disable CRC32C calculation for data writes. If set, the storage node |
119 | must rely on TCP's error correction to detect data corruption | 119 | must rely on TCP's error correction to detect data corruption |
120 | in the data payload. | 120 | in the data payload. |
121 | 121 | ||
@@ -133,7 +133,8 @@ For more information on Ceph, see the home page at | |||
133 | http://ceph.newdream.net/ | 133 | http://ceph.newdream.net/ |
134 | 134 | ||
135 | The Linux kernel client source tree is available at | 135 | The Linux kernel client source tree is available at |
136 | git://ceph.newdream.net/linux-ceph-client.git | 136 | git://ceph.newdream.net/git/ceph-client.git |
137 | git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git | ||
137 | 138 | ||
138 | and the source for the full system is at | 139 | and the source for the full system is at |
139 | git://ceph.newdream.net/ceph.git | 140 | git://ceph.newdream.net/git/ceph.git |
diff --git a/Documentation/filesystems/dlmfs.txt b/Documentation/filesystems/dlmfs.txt index c50bbb2d52b4..1b528b2ad809 100644 --- a/Documentation/filesystems/dlmfs.txt +++ b/Documentation/filesystems/dlmfs.txt | |||
@@ -47,7 +47,7 @@ You'll want to start heartbeating on a volume which all the nodes in | |||
47 | your lockspace can access. The easiest way to do this is via | 47 | your lockspace can access. The easiest way to do this is via |
48 | ocfs2_hb_ctl (distributed with ocfs2-tools). Right now it requires | 48 | ocfs2_hb_ctl (distributed with ocfs2-tools). Right now it requires |
49 | that an OCFS2 file system be in place so that it can automatically | 49 | that an OCFS2 file system be in place so that it can automatically |
50 | find it's heartbeat area, though it will eventually support heartbeat | 50 | find its heartbeat area, though it will eventually support heartbeat |
51 | against raw disks. | 51 | against raw disks. |
52 | 52 | ||
53 | Please see the ocfs2_hb_ctl and mkfs.ocfs2 manual pages distributed | 53 | Please see the ocfs2_hb_ctl and mkfs.ocfs2 manual pages distributed |
diff --git a/Documentation/filesystems/ext3.txt b/Documentation/filesystems/ext3.txt index 867c5b50cb42..272f80d5f966 100644 --- a/Documentation/filesystems/ext3.txt +++ b/Documentation/filesystems/ext3.txt | |||
@@ -59,8 +59,19 @@ commit=nrsec (*) Ext3 can be told to sync all its data and metadata | |||
59 | Setting it to very large values will improve | 59 | Setting it to very large values will improve |
60 | performance. | 60 | performance. |
61 | 61 | ||
62 | barrier=1 This enables/disables barriers. barrier=0 disables | 62 | barrier=<0(*)|1> This enables/disables the use of write barriers in |
63 | it, barrier=1 enables it. | 63 | barrier the jbd code. barrier=0 disables, barrier=1 enables. |
64 | nobarrier (*) This also requires an IO stack which can support | ||
65 | barriers, and if jbd gets an error on a barrier | ||
66 | write, it will disable again with a warning. | ||
67 | Write barriers enforce proper on-disk ordering | ||
68 | of journal commits, making volatile disk write caches | ||
69 | safe to use, at some performance penalty. If | ||
70 | your disks are battery-backed in one way or another, | ||
71 | disabling barriers may safely improve performance. | ||
72 | The mount options "barrier" and "nobarrier" can | ||
73 | also be used to enable or disable barriers, for | ||
74 | consistency with other ext3 mount options. | ||
64 | 75 | ||
65 | orlov (*) This enables the new Orlov block allocator. It is | 76 | orlov (*) This enables the new Orlov block allocator. It is |
66 | enabled by default. | 77 | enabled by default. |
diff --git a/Documentation/filesystems/fiemap.txt b/Documentation/filesystems/fiemap.txt index 606233cd4618..1b805a0efbb0 100644 --- a/Documentation/filesystems/fiemap.txt +++ b/Documentation/filesystems/fiemap.txt | |||
@@ -38,7 +38,7 @@ flags, it will return EBADR and the contents of fm_flags will contain | |||
38 | the set of flags which caused the error. If the kernel is compatible | 38 | the set of flags which caused the error. If the kernel is compatible |
39 | with all flags passed, the contents of fm_flags will be unmodified. | 39 | with all flags passed, the contents of fm_flags will be unmodified. |
40 | It is up to userspace to determine whether rejection of a particular | 40 | It is up to userspace to determine whether rejection of a particular |
41 | flag is fatal to it's operation. This scheme is intended to allow the | 41 | flag is fatal to its operation. This scheme is intended to allow the |
42 | fiemap interface to grow in the future but without losing | 42 | fiemap interface to grow in the future but without losing |
43 | compatibility with old software. | 43 | compatibility with old software. |
44 | 44 | ||
@@ -56,7 +56,7 @@ If this flag is set, the kernel will sync the file before mapping extents. | |||
56 | 56 | ||
57 | * FIEMAP_FLAG_XATTR | 57 | * FIEMAP_FLAG_XATTR |
58 | If this flag is set, the extents returned will describe the inodes | 58 | If this flag is set, the extents returned will describe the inodes |
59 | extended attribute lookup tree, instead of it's data tree. | 59 | extended attribute lookup tree, instead of its data tree. |
60 | 60 | ||
61 | 61 | ||
62 | Extent Mapping | 62 | Extent Mapping |
@@ -89,7 +89,7 @@ struct fiemap_extent { | |||
89 | }; | 89 | }; |
90 | 90 | ||
91 | All offsets and lengths are in bytes and mirror those on disk. It is valid | 91 | All offsets and lengths are in bytes and mirror those on disk. It is valid |
92 | for an extents logical offset to start before the request or it's logical | 92 | for an extents logical offset to start before the request or its logical |
93 | length to extend past the request. Unless FIEMAP_EXTENT_NOT_ALIGNED is | 93 | length to extend past the request. Unless FIEMAP_EXTENT_NOT_ALIGNED is |
94 | returned, fe_logical, fe_physical, and fe_length will be aligned to the | 94 | returned, fe_logical, fe_physical, and fe_length will be aligned to the |
95 | block size of the file system. With the exception of extents flagged as | 95 | block size of the file system. With the exception of extents flagged as |
@@ -125,7 +125,7 @@ been allocated for the file yet. | |||
125 | 125 | ||
126 | * FIEMAP_EXTENT_DELALLOC | 126 | * FIEMAP_EXTENT_DELALLOC |
127 | - This will also set FIEMAP_EXTENT_UNKNOWN. | 127 | - This will also set FIEMAP_EXTENT_UNKNOWN. |
128 | Delayed allocation - while there is data for this extent, it's | 128 | Delayed allocation - while there is data for this extent, its |
129 | physical location has not been allocated yet. | 129 | physical location has not been allocated yet. |
130 | 130 | ||
131 | * FIEMAP_EXTENT_ENCODED | 131 | * FIEMAP_EXTENT_ENCODED |
@@ -159,7 +159,7 @@ Data is located within a meta data block. | |||
159 | Data is packed into a block with data from other files. | 159 | Data is packed into a block with data from other files. |
160 | 160 | ||
161 | * FIEMAP_EXTENT_UNWRITTEN | 161 | * FIEMAP_EXTENT_UNWRITTEN |
162 | Unwritten extent - the extent is allocated but it's data has not been | 162 | Unwritten extent - the extent is allocated but its data has not been |
163 | initialized. This indicates the extent's data will be all zero if read | 163 | initialized. This indicates the extent's data will be all zero if read |
164 | through the filesystem but the contents are undefined if read directly from | 164 | through the filesystem but the contents are undefined if read directly from |
165 | the device. | 165 | the device. |
@@ -176,7 +176,7 @@ VFS -> File System Implementation | |||
176 | 176 | ||
177 | File systems wishing to support fiemap must implement a ->fiemap callback on | 177 | File systems wishing to support fiemap must implement a ->fiemap callback on |
178 | their inode_operations structure. The fs ->fiemap call is responsible for | 178 | their inode_operations structure. The fs ->fiemap call is responsible for |
179 | defining it's set of supported fiemap flags, and calling a helper function on | 179 | defining its set of supported fiemap flags, and calling a helper function on |
180 | each discovered extent: | 180 | each discovered extent: |
181 | 181 | ||
182 | struct inode_operations { | 182 | struct inode_operations { |
diff --git a/Documentation/filesystems/fuse.txt b/Documentation/filesystems/fuse.txt index 397a41adb4c3..13af4a49e7db 100644 --- a/Documentation/filesystems/fuse.txt +++ b/Documentation/filesystems/fuse.txt | |||
@@ -91,7 +91,7 @@ Mount options | |||
91 | 'default_permissions' | 91 | 'default_permissions' |
92 | 92 | ||
93 | By default FUSE doesn't check file access permissions, the | 93 | By default FUSE doesn't check file access permissions, the |
94 | filesystem is free to implement it's access policy or leave it to | 94 | filesystem is free to implement its access policy or leave it to |
95 | the underlying file access mechanism (e.g. in case of network | 95 | the underlying file access mechanism (e.g. in case of network |
96 | filesystems). This option enables permission checking, restricting | 96 | filesystems). This option enables permission checking, restricting |
97 | access based on file mode. It is usually useful together with the | 97 | access based on file mode. It is usually useful together with the |
@@ -171,7 +171,7 @@ or may honor them by sending a reply to the _original_ request, with | |||
171 | the error set to EINTR. | 171 | the error set to EINTR. |
172 | 172 | ||
173 | It is also possible that there's a race between processing the | 173 | It is also possible that there's a race between processing the |
174 | original request and it's INTERRUPT request. There are two possibilities: | 174 | original request and its INTERRUPT request. There are two possibilities: |
175 | 175 | ||
176 | 1) The INTERRUPT request is processed before the original request is | 176 | 1) The INTERRUPT request is processed before the original request is |
177 | processed | 177 | processed |
diff --git a/Documentation/filesystems/gfs2.txt b/Documentation/filesystems/gfs2.txt index 5e3ab8f3beff..0b59c0200912 100644 --- a/Documentation/filesystems/gfs2.txt +++ b/Documentation/filesystems/gfs2.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | Global File System | 1 | Global File System |
2 | ------------------ | 2 | ------------------ |
3 | 3 | ||
4 | http://sources.redhat.com/cluster/ | 4 | http://sources.redhat.com/cluster/wiki/ |
5 | 5 | ||
6 | GFS is a cluster file system. It allows a cluster of computers to | 6 | GFS is a cluster file system. It allows a cluster of computers to |
7 | simultaneously use a block device that is shared between them (with FC, | 7 | simultaneously use a block device that is shared between them (with FC, |
@@ -36,11 +36,11 @@ GFS2 is not on-disk compatible with previous versions of GFS, but it | |||
36 | is pretty close. | 36 | is pretty close. |
37 | 37 | ||
38 | The following man pages can be found at the URL above: | 38 | The following man pages can be found at the URL above: |
39 | fsck.gfs2 to repair a filesystem | 39 | fsck.gfs2 to repair a filesystem |
40 | gfs2_grow to expand a filesystem online | 40 | gfs2_grow to expand a filesystem online |
41 | gfs2_jadd to add journals to a filesystem online | 41 | gfs2_jadd to add journals to a filesystem online |
42 | gfs2_tool to manipulate, examine and tune a filesystem | 42 | gfs2_tool to manipulate, examine and tune a filesystem |
43 | gfs2_quota to examine and change quota values in a filesystem | 43 | gfs2_quota to examine and change quota values in a filesystem |
44 | gfs2_convert to convert a gfs filesystem to gfs2 in-place | 44 | gfs2_convert to convert a gfs filesystem to gfs2 in-place |
45 | mount.gfs2 to help mount(8) mount a filesystem | 45 | mount.gfs2 to help mount(8) mount a filesystem |
46 | mkfs.gfs2 to make a filesystem | 46 | mkfs.gfs2 to make a filesystem |
diff --git a/Documentation/filesystems/hpfs.txt b/Documentation/filesystems/hpfs.txt index fa45c3baed98..74630bd504fb 100644 --- a/Documentation/filesystems/hpfs.txt +++ b/Documentation/filesystems/hpfs.txt | |||
@@ -103,7 +103,7 @@ to analyze or change OS2SYS.INI. | |||
103 | Codepages | 103 | Codepages |
104 | 104 | ||
105 | HPFS can contain several uppercasing tables for several codepages and each | 105 | HPFS can contain several uppercasing tables for several codepages and each |
106 | file has a pointer to codepage it's name is in. However OS/2 was created in | 106 | file has a pointer to codepage its name is in. However OS/2 was created in |
107 | America where people don't care much about codepages and so multiple codepages | 107 | America where people don't care much about codepages and so multiple codepages |
108 | support is quite buggy. I have Czech OS/2 working in codepage 852 on my disk. | 108 | support is quite buggy. I have Czech OS/2 working in codepage 852 on my disk. |
109 | Once I booted English OS/2 working in cp 850 and I created a file on my 852 | 109 | Once I booted English OS/2 working in cp 850 and I created a file on my 852 |
diff --git a/Documentation/filesystems/logfs.txt b/Documentation/filesystems/logfs.txt index e64c94ba401a..bca42c22a143 100644 --- a/Documentation/filesystems/logfs.txt +++ b/Documentation/filesystems/logfs.txt | |||
@@ -59,7 +59,7 @@ Levels | |||
59 | ------ | 59 | ------ |
60 | 60 | ||
61 | Garbage collection (GC) may fail if all data is written | 61 | Garbage collection (GC) may fail if all data is written |
62 | indiscriminately. One requirement of GC is that data is seperated | 62 | indiscriminately. One requirement of GC is that data is separated |
63 | roughly according to the distance between the tree root and the data. | 63 | roughly according to the distance between the tree root and the data. |
64 | Effectively that means all file data is on level 0, indirect blocks | 64 | Effectively that means all file data is on level 0, indirect blocks |
65 | are on levels 1, 2, 3 4 or 5 for 1x, 2x, 3x, 4x or 5x indirect blocks, | 65 | are on levels 1, 2, 3 4 or 5 for 1x, 2x, 3x, 4x or 5x indirect blocks, |
@@ -67,7 +67,7 @@ respectively. Inode file data is on level 6 for the inodes and 7-11 | |||
67 | for indirect blocks. | 67 | for indirect blocks. |
68 | 68 | ||
69 | Each segment contains objects of a single level only. As a result, | 69 | Each segment contains objects of a single level only. As a result, |
70 | each level requires its own seperate segment to be open for writing. | 70 | each level requires its own separate segment to be open for writing. |
71 | 71 | ||
72 | Inode File | 72 | Inode File |
73 | ---------- | 73 | ---------- |
@@ -106,9 +106,9 @@ Vim | |||
106 | --- | 106 | --- |
107 | 107 | ||
108 | By cleverly predicting the life time of data, it is possible to | 108 | By cleverly predicting the life time of data, it is possible to |
109 | seperate long-living data from short-living data and thereby reduce | 109 | separate long-living data from short-living data and thereby reduce |
110 | the GC overhead later. Each type of distinc life expectency (vim) can | 110 | the GC overhead later. Each type of distinc life expectency (vim) can |
111 | have a seperate segment open for writing. Each (level, vim) tupel can | 111 | have a separate segment open for writing. Each (level, vim) tupel can |
112 | be open just once. If an open segment with unknown vim is encountered | 112 | be open just once. If an open segment with unknown vim is encountered |
113 | at mount time, it is closed and ignored henceforth. | 113 | at mount time, it is closed and ignored henceforth. |
114 | 114 | ||
diff --git a/Documentation/filesystems/nfs/nfs41-server.txt b/Documentation/filesystems/nfs/nfs41-server.txt index 6a53a84afc72..04884914a1c8 100644 --- a/Documentation/filesystems/nfs/nfs41-server.txt +++ b/Documentation/filesystems/nfs/nfs41-server.txt | |||
@@ -137,7 +137,7 @@ NS*| OPENATTR | OPT | | Section 18.17 | | |||
137 | | READ | REQ | | Section 18.22 | | 137 | | READ | REQ | | Section 18.22 | |
138 | | READDIR | REQ | | Section 18.23 | | 138 | | READDIR | REQ | | Section 18.23 | |
139 | | READLINK | OPT | | Section 18.24 | | 139 | | READLINK | OPT | | Section 18.24 | |
140 | NS | RECLAIM_COMPLETE | REQ | | Section 18.51 | | 140 | | RECLAIM_COMPLETE | REQ | | Section 18.51 | |
141 | | RELEASE_LOCKOWNER | MNI | | N/A | | 141 | | RELEASE_LOCKOWNER | MNI | | N/A | |
142 | | REMOVE | REQ | | Section 18.25 | | 142 | | REMOVE | REQ | | Section 18.25 | |
143 | | RENAME | REQ | | Section 18.26 | | 143 | | RENAME | REQ | | Section 18.26 | |
diff --git a/Documentation/filesystems/nfs/rpc-cache.txt b/Documentation/filesystems/nfs/rpc-cache.txt index 8a382bea6808..ebcaaee21616 100644 --- a/Documentation/filesystems/nfs/rpc-cache.txt +++ b/Documentation/filesystems/nfs/rpc-cache.txt | |||
@@ -185,7 +185,7 @@ failed lookup meant a definite 'no'. | |||
185 | request/response format | 185 | request/response format |
186 | ----------------------- | 186 | ----------------------- |
187 | 187 | ||
188 | While each cache is free to use it's own format for requests | 188 | While each cache is free to use its own format for requests |
189 | and responses over channel, the following is recommended as | 189 | and responses over channel, the following is recommended as |
190 | appropriate and support routines are available to help: | 190 | appropriate and support routines are available to help: |
191 | Each request or response record should be printable ASCII | 191 | Each request or response record should be printable ASCII |
diff --git a/Documentation/filesystems/nilfs2.txt b/Documentation/filesystems/nilfs2.txt index cf6d0d85ca82..d3e7673995eb 100644 --- a/Documentation/filesystems/nilfs2.txt +++ b/Documentation/filesystems/nilfs2.txt | |||
@@ -50,8 +50,8 @@ NILFS2 supports the following mount options: | |||
50 | (*) == default | 50 | (*) == default |
51 | 51 | ||
52 | nobarrier Disables barriers. | 52 | nobarrier Disables barriers. |
53 | errors=continue(*) Keep going on a filesystem error. | 53 | errors=continue Keep going on a filesystem error. |
54 | errors=remount-ro Remount the filesystem read-only on an error. | 54 | errors=remount-ro(*) Remount the filesystem read-only on an error. |
55 | errors=panic Panic and halt the machine if an error occurs. | 55 | errors=panic Panic and halt the machine if an error occurs. |
56 | cp=n Specify the checkpoint-number of the snapshot to be | 56 | cp=n Specify the checkpoint-number of the snapshot to be |
57 | mounted. Checkpoints and snapshots are listed by lscp | 57 | mounted. Checkpoints and snapshots are listed by lscp |
diff --git a/Documentation/filesystems/ocfs2.txt b/Documentation/filesystems/ocfs2.txt index c58b9f5ba002..1f7ae144f6d8 100644 --- a/Documentation/filesystems/ocfs2.txt +++ b/Documentation/filesystems/ocfs2.txt | |||
@@ -80,3 +80,10 @@ user_xattr (*) Enables Extended User Attributes. | |||
80 | nouser_xattr Disables Extended User Attributes. | 80 | nouser_xattr Disables Extended User Attributes. |
81 | acl Enables POSIX Access Control Lists support. | 81 | acl Enables POSIX Access Control Lists support. |
82 | noacl (*) Disables POSIX Access Control Lists support. | 82 | noacl (*) Disables POSIX Access Control Lists support. |
83 | resv_level=2 (*) Set how agressive allocation reservations will be. | ||
84 | Valid values are between 0 (reservations off) to 8 | ||
85 | (maximum space for reservations). | ||
86 | dir_resv_level= (*) By default, directory reservations will scale with file | ||
87 | reservations - users should rarely need to change this | ||
88 | value. If allocation reservations are turned off, this | ||
89 | option will have no effect. | ||
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index a4f30faa4f1f..9fb6cbe70bde 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -305,7 +305,7 @@ Table 1-4: Contents of the stat files (as of 2.6.30-rc7) | |||
305 | cgtime guest time of the task children in jiffies | 305 | cgtime guest time of the task children in jiffies |
306 | .............................................................................. | 306 | .............................................................................. |
307 | 307 | ||
308 | The /proc/PID/map file containing the currently mapped memory regions and | 308 | The /proc/PID/maps file containing the currently mapped memory regions and |
309 | their access permissions. | 309 | their access permissions. |
310 | 310 | ||
311 | The format is: | 311 | The format is: |
@@ -316,7 +316,7 @@ address perms offset dev inode pathname | |||
316 | 08049000-0804a000 rw-p 00001000 03:00 8312 /opt/test | 316 | 08049000-0804a000 rw-p 00001000 03:00 8312 /opt/test |
317 | 0804a000-0806b000 rw-p 00000000 00:00 0 [heap] | 317 | 0804a000-0806b000 rw-p 00000000 00:00 0 [heap] |
318 | a7cb1000-a7cb2000 ---p 00000000 00:00 0 | 318 | a7cb1000-a7cb2000 ---p 00000000 00:00 0 |
319 | a7cb2000-a7eb2000 rw-p 00000000 00:00 0 [threadstack:001ff4b4] | 319 | a7cb2000-a7eb2000 rw-p 00000000 00:00 0 |
320 | a7eb2000-a7eb3000 ---p 00000000 00:00 0 | 320 | a7eb2000-a7eb3000 ---p 00000000 00:00 0 |
321 | a7eb3000-a7ed5000 rw-p 00000000 00:00 0 | 321 | a7eb3000-a7ed5000 rw-p 00000000 00:00 0 |
322 | a7ed5000-a8008000 r-xp 00000000 03:00 4222 /lib/libc.so.6 | 322 | a7ed5000-a8008000 r-xp 00000000 03:00 4222 /lib/libc.so.6 |
@@ -352,7 +352,6 @@ is not associated with a file: | |||
352 | [stack] = the stack of the main process | 352 | [stack] = the stack of the main process |
353 | [vdso] = the "virtual dynamic shared object", | 353 | [vdso] = the "virtual dynamic shared object", |
354 | the kernel system call handler | 354 | the kernel system call handler |
355 | [threadstack:xxxxxxxx] = the stack of the thread, xxxxxxxx is the stack size | ||
356 | 355 | ||
357 | or if empty, the mapping is anonymous. | 356 | or if empty, the mapping is anonymous. |
358 | 357 | ||
@@ -566,6 +565,10 @@ The default_smp_affinity mask applies to all non-active IRQs, which are the | |||
566 | IRQs which have not yet been allocated/activated, and hence which lack a | 565 | IRQs which have not yet been allocated/activated, and hence which lack a |
567 | /proc/irq/[0-9]* directory. | 566 | /proc/irq/[0-9]* directory. |
568 | 567 | ||
568 | The node file on an SMP system shows the node to which the device using the IRQ | ||
569 | reports itself as being attached. This hardware locality information does not | ||
570 | include information about any possible driver locality preference. | ||
571 | |||
569 | prof_cpu_mask specifies which CPUs are to be profiled by the system wide | 572 | prof_cpu_mask specifies which CPUs are to be profiled by the system wide |
570 | profiler. Default value is ffffffff (all cpus). | 573 | profiler. Default value is ffffffff (all cpus). |
571 | 574 | ||
@@ -965,7 +968,7 @@ your system and how much traffic was routed over those devices: | |||
965 | ...] 1375103 17405 0 0 0 0 0 0 | 968 | ...] 1375103 17405 0 0 0 0 0 0 |
966 | ...] 1703981 5535 0 0 0 3 0 0 | 969 | ...] 1703981 5535 0 0 0 3 0 0 |
967 | 970 | ||
968 | In addition, each Channel Bond interface has it's own directory. For | 971 | In addition, each Channel Bond interface has its own directory. For |
969 | example, the bond0 device will have a directory called /proc/net/bond0/. | 972 | example, the bond0 device will have a directory called /proc/net/bond0/. |
970 | It will contain information that is specific to that bond, such as the | 973 | It will contain information that is specific to that bond, such as the |
971 | current slaves of the bond, the link status of the slaves, and how | 974 | current slaves of the bond, the link status of the slaves, and how |
@@ -1362,7 +1365,7 @@ been accounted as having caused 1MB of write. | |||
1362 | In other words: The number of bytes which this process caused to not happen, | 1365 | In other words: The number of bytes which this process caused to not happen, |
1363 | by truncating pagecache. A task can cause "negative" IO too. If this task | 1366 | by truncating pagecache. A task can cause "negative" IO too. If this task |
1364 | truncates some dirty pagecache, some IO which another task has been accounted | 1367 | truncates some dirty pagecache, some IO which another task has been accounted |
1365 | for (in it's write_bytes) will not be happening. We _could_ just subtract that | 1368 | for (in its write_bytes) will not be happening. We _could_ just subtract that |
1366 | from the truncating task's write_bytes, but there is information loss in doing | 1369 | from the truncating task's write_bytes, but there is information loss in doing |
1367 | that. | 1370 | that. |
1368 | 1371 | ||
diff --git a/Documentation/filesystems/smbfs.txt b/Documentation/filesystems/smbfs.txt index f673ef0de0f7..194fb0decd2c 100644 --- a/Documentation/filesystems/smbfs.txt +++ b/Documentation/filesystems/smbfs.txt | |||
@@ -3,6 +3,6 @@ protocol used by Windows for Workgroups, Windows 95 and Windows NT. | |||
3 | Smbfs was inspired by Samba, the program written by Andrew Tridgell | 3 | Smbfs was inspired by Samba, the program written by Andrew Tridgell |
4 | that turns any Unix host into a file server for DOS or Windows clients. | 4 | that turns any Unix host into a file server for DOS or Windows clients. |
5 | 5 | ||
6 | Smbfs is a SMB client, but uses parts of samba for it's operation. For | 6 | Smbfs is a SMB client, but uses parts of samba for its operation. For |
7 | more info on samba, including documentation, please go to | 7 | more info on samba, including documentation, please go to |
8 | http://www.samba.org/ and then on to your nearest mirror. | 8 | http://www.samba.org/ and then on to your nearest mirror. |
diff --git a/Documentation/filesystems/sysfs-tagging.txt b/Documentation/filesystems/sysfs-tagging.txt new file mode 100644 index 000000000000..caaaf1266d8f --- /dev/null +++ b/Documentation/filesystems/sysfs-tagging.txt | |||
@@ -0,0 +1,42 @@ | |||
1 | Sysfs tagging | ||
2 | ------------- | ||
3 | |||
4 | (Taken almost verbatim from Eric Biederman's netns tagging patch | ||
5 | commit msg) | ||
6 | |||
7 | The problem. Network devices show up in sysfs and with the network | ||
8 | namespace active multiple devices with the same name can show up in | ||
9 | the same directory, ouch! | ||
10 | |||
11 | To avoid that problem and allow existing applications in network | ||
12 | namespaces to see the same interface that is currently presented in | ||
13 | sysfs, sysfs now has tagging directory support. | ||
14 | |||
15 | By using the network namespace pointers as tags to separate out the | ||
16 | the sysfs directory entries we ensure that we don't have conflicts | ||
17 | in the directories and applications only see a limited set of | ||
18 | the network devices. | ||
19 | |||
20 | Each sysfs directory entry may be tagged with zero or one | ||
21 | namespaces. A sysfs_dirent is augmented with a void *s_ns. If a | ||
22 | directory entry is tagged, then sysfs_dirent->s_flags will have a | ||
23 | flag between KOBJ_NS_TYPE_NONE and KOBJ_NS_TYPES, and s_ns will | ||
24 | point to the namespace to which it belongs. | ||
25 | |||
26 | Each sysfs superblock's sysfs_super_info contains an array void | ||
27 | *ns[KOBJ_NS_TYPES]. When a a task in a tagging namespace | ||
28 | kobj_nstype first mounts sysfs, a new superblock is created. It | ||
29 | will be differentiated from other sysfs mounts by having its | ||
30 | s_fs_info->ns[kobj_nstype] set to the new namespace. Note that | ||
31 | through bind mounting and mounts propagation, a task can easily view | ||
32 | the contents of other namespaces' sysfs mounts. Therefore, when a | ||
33 | namespace exits, it will call kobj_ns_exit() to invalidate any | ||
34 | sysfs_dirent->s_ns pointers pointing to it. | ||
35 | |||
36 | Users of this interface: | ||
37 | - define a type in the kobj_ns_type enumeration. | ||
38 | - call kobj_ns_type_register() with its kobj_ns_type_operations which has | ||
39 | - current_ns() which returns current's namespace | ||
40 | - netlink_ns() which returns a socket's namespace | ||
41 | - initial_ns() which returns the initial namesapce | ||
42 | - call kobj_ns_exit() when an individual tag is no longer valid | ||
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index 3de2f32edd90..b66858538df5 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -72,7 +72,7 @@ structure (this is the kernel-side implementation of file | |||
72 | descriptors). The freshly allocated file structure is initialized with | 72 | descriptors). The freshly allocated file structure is initialized with |
73 | a pointer to the dentry and a set of file operation member functions. | 73 | a pointer to the dentry and a set of file operation member functions. |
74 | These are taken from the inode data. The open() file method is then | 74 | These are taken from the inode data. The open() file method is then |
75 | called so the specific filesystem implementation can do it's work. You | 75 | called so the specific filesystem implementation can do its work. You |
76 | can see that this is another switch performed by the VFS. The file | 76 | can see that this is another switch performed by the VFS. The file |
77 | structure is placed into the file descriptor table for the process. | 77 | structure is placed into the file descriptor table for the process. |
78 | 78 | ||
diff --git a/Documentation/hwmon/lm85 b/Documentation/hwmon/lm85 index a13680871bc7..a76aefeeb68a 100644 --- a/Documentation/hwmon/lm85 +++ b/Documentation/hwmon/lm85 | |||
@@ -157,7 +157,7 @@ temperature configuration points: | |||
157 | 157 | ||
158 | There are three PWM outputs. The LM85 datasheet suggests that the | 158 | There are three PWM outputs. The LM85 datasheet suggests that the |
159 | pwm3 output control both fan3 and fan4. Each PWM can be individually | 159 | pwm3 output control both fan3 and fan4. Each PWM can be individually |
160 | configured and assigned to a zone for it's control value. Each PWM can be | 160 | configured and assigned to a zone for its control value. Each PWM can be |
161 | configured individually according to the following options. | 161 | configured individually according to the following options. |
162 | 162 | ||
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 |
diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801 index e1bb5b261693..e307914a3eda 100644 --- a/Documentation/i2c/busses/i2c-i801 +++ b/Documentation/i2c/busses/i2c-i801 | |||
@@ -27,7 +27,13 @@ Authors: | |||
27 | Module Parameters | 27 | Module Parameters |
28 | ----------------- | 28 | ----------------- |
29 | 29 | ||
30 | None. | 30 | * disable_features (bit vector) |
31 | Disable selected features normally supported by the device. This makes it | ||
32 | possible to work around possible driver or hardware bugs if the feature in | ||
33 | question doesn't work as intended for whatever reason. Bit values: | ||
34 | 1 disable SMBus PEC | ||
35 | 2 disable the block buffer | ||
36 | 8 disable the I2C block read functionality | ||
31 | 37 | ||
32 | 38 | ||
33 | Description | 39 | Description |
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index 3219ee0dbfef..5ebf5af1d716 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients | |||
@@ -74,6 +74,11 @@ structure at all. You should use this to keep device-specific data. | |||
74 | /* retrieve the value */ | 74 | /* retrieve the value */ |
75 | void *i2c_get_clientdata(const struct i2c_client *client); | 75 | void *i2c_get_clientdata(const struct i2c_client *client); |
76 | 76 | ||
77 | Note that starting with kernel 2.6.34, you don't have to set the `data' field | ||
78 | to NULL in remove() or if probe() failed anymore. The i2c-core does this | ||
79 | automatically on these occasions. Those are also the only times the core will | ||
80 | touch this field. | ||
81 | |||
77 | 82 | ||
78 | Accessing the client | 83 | Accessing the client |
79 | ==================== | 84 | ==================== |
diff --git a/Documentation/input/elantech.txt b/Documentation/input/elantech.txt index a10c3b6ba7c4..56941ae1f5db 100644 --- a/Documentation/input/elantech.txt +++ b/Documentation/input/elantech.txt | |||
@@ -333,14 +333,14 @@ byte 0: | |||
333 | byte 1: | 333 | byte 1: |
334 | 334 | ||
335 | bit 7 6 5 4 3 2 1 0 | 335 | bit 7 6 5 4 3 2 1 0 |
336 | x15 x14 x13 x12 x11 x10 x9 x8 | 336 | . . . . . x10 x9 x8 |
337 | 337 | ||
338 | byte 2: | 338 | byte 2: |
339 | 339 | ||
340 | bit 7 6 5 4 3 2 1 0 | 340 | bit 7 6 5 4 3 2 1 0 |
341 | x7 x6 x5 x4 x4 x2 x1 x0 | 341 | x7 x6 x5 x4 x4 x2 x1 x0 |
342 | 342 | ||
343 | x15..x0 = absolute x value (horizontal) | 343 | x10..x0 = absolute x value (horizontal) |
344 | 344 | ||
345 | byte 3: | 345 | byte 3: |
346 | 346 | ||
@@ -350,14 +350,14 @@ byte 3: | |||
350 | byte 4: | 350 | byte 4: |
351 | 351 | ||
352 | bit 7 6 5 4 3 2 1 0 | 352 | bit 7 6 5 4 3 2 1 0 |
353 | y15 y14 y13 y12 y11 y10 y8 y8 | 353 | . . . . . . y9 y8 |
354 | 354 | ||
355 | byte 5: | 355 | byte 5: |
356 | 356 | ||
357 | bit 7 6 5 4 3 2 1 0 | 357 | bit 7 6 5 4 3 2 1 0 |
358 | y7 y6 y5 y4 y3 y2 y1 y0 | 358 | y7 y6 y5 y4 y3 y2 y1 y0 |
359 | 359 | ||
360 | y15..y0 = absolute y value (vertical) | 360 | y9..y0 = absolute y value (vertical) |
361 | 361 | ||
362 | 362 | ||
363 | 4.2.2 Two finger touch | 363 | 4.2.2 Two finger touch |
diff --git a/Documentation/input/joystick.txt b/Documentation/input/joystick.txt index 154d767b2acb..8007b7ca87bf 100644 --- a/Documentation/input/joystick.txt +++ b/Documentation/input/joystick.txt | |||
@@ -402,7 +402,7 @@ for the port of the SoundFusion is supported by the cs461x.c module. | |||
402 | ~~~~~~~~~~~~~~~~~~~~~~~~ | 402 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
403 | The Live! has a special PCI gameport, which, although it doesn't provide | 403 | The Live! has a special PCI gameport, which, although it doesn't provide |
404 | any "Enhanced" stuff like 4DWave and friends, is quite a bit faster than | 404 | any "Enhanced" stuff like 4DWave and friends, is quite a bit faster than |
405 | it's ISA counterparts. It also requires special support, hence the | 405 | its ISA counterparts. It also requires special support, hence the |
406 | emu10k1-gp.c module for it instead of the normal ns558.c one. | 406 | emu10k1-gp.c module for it instead of the normal ns558.c one. |
407 | 407 | ||
408 | 3.15 SoundBlaster 64 and 128 - ES1370 and ES1371, ESS Solo1 and S3 SonicVibes | 408 | 3.15 SoundBlaster 64 and 128 - ES1370 and ES1371, ESS Solo1 and S3 SonicVibes |
diff --git a/Documentation/input/multi-touch-protocol.txt b/Documentation/input/multi-touch-protocol.txt index 8490480ce432..c0fc1c75fd88 100644 --- a/Documentation/input/multi-touch-protocol.txt +++ b/Documentation/input/multi-touch-protocol.txt | |||
@@ -68,6 +68,22 @@ like: | |||
68 | SYN_MT_REPORT | 68 | SYN_MT_REPORT |
69 | SYN_REPORT | 69 | SYN_REPORT |
70 | 70 | ||
71 | Here is the sequence after lifting one of the fingers: | ||
72 | |||
73 | ABS_MT_POSITION_X | ||
74 | ABS_MT_POSITION_Y | ||
75 | SYN_MT_REPORT | ||
76 | SYN_REPORT | ||
77 | |||
78 | And here is the sequence after lifting the remaining finger: | ||
79 | |||
80 | SYN_MT_REPORT | ||
81 | SYN_REPORT | ||
82 | |||
83 | If the driver reports one of BTN_TOUCH or ABS_PRESSURE in addition to the | ||
84 | ABS_MT events, the last SYN_MT_REPORT event may be omitted. Otherwise, the | ||
85 | last SYN_REPORT will be dropped by the input core, resulting in no | ||
86 | zero-finger event reaching userland. | ||
71 | 87 | ||
72 | Event Semantics | 88 | Event Semantics |
73 | --------------- | 89 | --------------- |
@@ -217,11 +233,6 @@ where examples can be found. | |||
217 | difference between the contact position and the approaching tool position | 233 | difference between the contact position and the approaching tool position |
218 | could be used to derive tilt. | 234 | could be used to derive tilt. |
219 | [2] The list can of course be extended. | 235 | [2] The list can of course be extended. |
220 | [3] The multi-touch X driver is currently in the prototyping stage. At the | 236 | [3] Multitouch X driver project: http://bitmath.org/code/multitouch/. |
221 | time of writing (April 2009), the MT protocol is not yet merged, and the | ||
222 | prototype implements finger matching, basic mouse support and two-finger | ||
223 | scrolling. The project aims at improving the quality of current multi-touch | ||
224 | functionality available in the Synaptics X driver, and in addition | ||
225 | implement more advanced gestures. | ||
226 | [4] See the section on event computation. | 237 | [4] See the section on event computation. |
227 | [5] See the section on finger tracking. | 238 | [5] See the section on finger tracking. |
diff --git a/Documentation/intel_txt.txt b/Documentation/intel_txt.txt index f40a1f030019..5dc59b04a71f 100644 --- a/Documentation/intel_txt.txt +++ b/Documentation/intel_txt.txt | |||
@@ -126,7 +126,7 @@ o Tboot then applies an (optional) user-defined launch policy to | |||
126 | o Tboot adjusts the e820 table provided by the bootloader to reserve | 126 | o Tboot adjusts the e820 table provided by the bootloader to reserve |
127 | its own location in memory as well as to reserve certain other | 127 | its own location in memory as well as to reserve certain other |
128 | TXT-related regions. | 128 | TXT-related regions. |
129 | o As part of it's launch, tboot DMA protects all of RAM (using the | 129 | o As part of its launch, tboot DMA protects all of RAM (using the |
130 | VT-d PMRs). Thus, the kernel must be booted with 'intel_iommu=on' | 130 | VT-d PMRs). Thus, the kernel must be booted with 'intel_iommu=on' |
131 | in order to remove this blanket protection and use VT-d's | 131 | in order to remove this blanket protection and use VT-d's |
132 | page-level protection. | 132 | page-level protection. |
@@ -161,13 +161,15 @@ o In order to put a system into any of the sleep states after a TXT | |||
161 | has been restored, it will restore the TPM PCRs and then | 161 | has been restored, it will restore the TPM PCRs and then |
162 | transfer control back to the kernel's S3 resume vector. | 162 | transfer control back to the kernel's S3 resume vector. |
163 | In order to preserve system integrity across S3, the kernel | 163 | In order to preserve system integrity across S3, the kernel |
164 | provides tboot with a set of memory ranges (kernel | 164 | provides tboot with a set of memory ranges (RAM and RESERVED_KERN |
165 | code/data/bss, S3 resume code, and AP trampoline) that tboot | 165 | in the e820 table, but not any memory that BIOS might alter over |
166 | will calculate a MAC (message authentication code) over and then | 166 | the S3 transition) that tboot will calculate a MAC (message |
167 | seal with the TPM. On resume and once the measured environment | 167 | authentication code) over and then seal with the TPM. On resume |
168 | has been re-established, tboot will re-calculate the MAC and | 168 | and once the measured environment has been re-established, tboot |
169 | verify it against the sealed value. Tboot's policy determines | 169 | will re-calculate the MAC and verify it against the sealed value. |
170 | what happens if the verification fails. | 170 | Tboot's policy determines what happens if the verification fails. |
171 | Note that the c/s 194 of tboot which has the new MAC code supports | ||
172 | this. | ||
171 | 173 | ||
172 | That's pretty much it for TXT support. | 174 | That's pretty much it for TXT support. |
173 | 175 | ||
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt index c412c245848f..b472e4e0ba67 100644 --- a/Documentation/kbuild/kconfig-language.txt +++ b/Documentation/kbuild/kconfig-language.txt | |||
@@ -181,7 +181,7 @@ Expressions are listed in decreasing order of precedence. | |||
181 | (7) Returns the result of max(/expr/, /expr/). | 181 | (7) Returns the result of max(/expr/, /expr/). |
182 | 182 | ||
183 | An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2 | 183 | An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2 |
184 | respectively for calculations). A menu entry becomes visible when it's | 184 | respectively for calculations). A menu entry becomes visible when its |
185 | expression evaluates to 'm' or 'y'. | 185 | expression evaluates to 'm' or 'y'. |
186 | 186 | ||
187 | There are two types of symbols: constant and non-constant symbols. | 187 | There are two types of symbols: constant and non-constant symbols. |
diff --git a/Documentation/kbuild/kconfig.txt b/Documentation/kbuild/kconfig.txt index 49efae703979..b2cb16ebcb16 100644 --- a/Documentation/kbuild/kconfig.txt +++ b/Documentation/kbuild/kconfig.txt | |||
@@ -96,7 +96,7 @@ Environment variables for 'silentoldconfig' | |||
96 | KCONFIG_NOSILENTUPDATE | 96 | KCONFIG_NOSILENTUPDATE |
97 | -------------------------------------------------- | 97 | -------------------------------------------------- |
98 | If this variable has a non-blank value, it prevents silent kernel | 98 | If this variable has a non-blank value, it prevents silent kernel |
99 | config udpates (requires explicit updates). | 99 | config updates (requires explicit updates). |
100 | 100 | ||
101 | KCONFIG_AUTOCONFIG | 101 | KCONFIG_AUTOCONFIG |
102 | -------------------------------------------------- | 102 | -------------------------------------------------- |
diff --git a/Documentation/kernel-docs.txt b/Documentation/kernel-docs.txt index 28cdc2af2131..ec8d31ee12e0 100644 --- a/Documentation/kernel-docs.txt +++ b/Documentation/kernel-docs.txt | |||
@@ -116,7 +116,7 @@ | |||
116 | Author: Ingo Molnar, Gadi Oxman and Miguel de Icaza. | 116 | Author: Ingo Molnar, Gadi Oxman and Miguel de Icaza. |
117 | URL: http://www.linuxjournal.com/article.php?sid=2391 | 117 | URL: http://www.linuxjournal.com/article.php?sid=2391 |
118 | Keywords: RAID, MD driver. | 118 | Keywords: RAID, MD driver. |
119 | Description: Linux Journal Kernel Korner article. Here is it's | 119 | Description: Linux Journal Kernel Korner article. Here is its |
120 | abstract: "A description of the implementation of the RAID-1, | 120 | abstract: "A description of the implementation of the RAID-1, |
121 | RAID-4 and RAID-5 personalities of the MD device driver in the | 121 | RAID-4 and RAID-5 personalities of the MD device driver in the |
122 | Linux kernel, providing users with high performance and reliable, | 122 | Linux kernel, providing users with high performance and reliable, |
@@ -127,7 +127,7 @@ | |||
127 | URL: http://www.linuxjournal.com/article.php?sid=1219 | 127 | URL: http://www.linuxjournal.com/article.php?sid=1219 |
128 | Keywords: device driver, module, loading/unloading modules, | 128 | Keywords: device driver, module, loading/unloading modules, |
129 | allocating resources. | 129 | allocating resources. |
130 | Description: Linux Journal Kernel Korner article. Here is it's | 130 | Description: Linux Journal Kernel Korner article. Here is its |
131 | abstract: "This is the first of a series of four articles | 131 | abstract: "This is the first of a series of four articles |
132 | co-authored by Alessandro Rubini and Georg Zezchwitz which present | 132 | co-authored by Alessandro Rubini and Georg Zezchwitz which present |
133 | a practical approach to writing Linux device drivers as kernel | 133 | a practical approach to writing Linux device drivers as kernel |
@@ -141,7 +141,7 @@ | |||
141 | Keywords: character driver, init_module, clean_up module, | 141 | Keywords: character driver, init_module, clean_up module, |
142 | autodetection, mayor number, minor number, file operations, | 142 | autodetection, mayor number, minor number, file operations, |
143 | open(), close(). | 143 | open(), close(). |
144 | Description: Linux Journal Kernel Korner article. Here is it's | 144 | Description: Linux Journal Kernel Korner article. Here is its |
145 | abstract: "This article, the second of four, introduces part of | 145 | abstract: "This article, the second of four, introduces part of |
146 | the actual code to create custom module implementing a character | 146 | the actual code to create custom module implementing a character |
147 | device driver. It describes the code for module initialization and | 147 | device driver. It describes the code for module initialization and |
@@ -152,7 +152,7 @@ | |||
152 | URL: http://www.linuxjournal.com/article.php?sid=1221 | 152 | URL: http://www.linuxjournal.com/article.php?sid=1221 |
153 | Keywords: read(), write(), select(), ioctl(), blocking/non | 153 | Keywords: read(), write(), select(), ioctl(), blocking/non |
154 | blocking mode, interrupt handler. | 154 | blocking mode, interrupt handler. |
155 | Description: Linux Journal Kernel Korner article. Here is it's | 155 | Description: Linux Journal Kernel Korner article. Here is its |
156 | abstract: "This article, the third of four on writing character | 156 | abstract: "This article, the third of four on writing character |
157 | device drivers, introduces concepts of reading, writing, and using | 157 | device drivers, introduces concepts of reading, writing, and using |
158 | ioctl-calls". | 158 | ioctl-calls". |
@@ -161,7 +161,7 @@ | |||
161 | Author: Alessandro Rubini and Georg v. Zezschwitz. | 161 | Author: Alessandro Rubini and Georg v. Zezschwitz. |
162 | URL: http://www.linuxjournal.com/article.php?sid=1222 | 162 | URL: http://www.linuxjournal.com/article.php?sid=1222 |
163 | Keywords: interrupts, irqs, DMA, bottom halves, task queues. | 163 | Keywords: interrupts, irqs, DMA, bottom halves, task queues. |
164 | Description: Linux Journal Kernel Korner article. Here is it's | 164 | Description: Linux Journal Kernel Korner article. Here is its |
165 | abstract: "This is the fourth in a series of articles about | 165 | abstract: "This is the fourth in a series of articles about |
166 | writing character device drivers as loadable kernel modules. This | 166 | writing character device drivers as loadable kernel modules. This |
167 | month, we further investigate the field of interrupt handling. | 167 | month, we further investigate the field of interrupt handling. |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index e4cbca58536c..f5fce483930c 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -58,6 +58,7 @@ parameter is applicable: | |||
58 | ISAPNP ISA PnP code is enabled. | 58 | ISAPNP ISA PnP code is enabled. |
59 | ISDN Appropriate ISDN support is enabled. | 59 | ISDN Appropriate ISDN support is enabled. |
60 | JOY Appropriate joystick support is enabled. | 60 | JOY Appropriate joystick support is enabled. |
61 | KGDB Kernel debugger support is enabled. | ||
61 | KVM Kernel Virtual Machine support is enabled. | 62 | KVM Kernel Virtual Machine support is enabled. |
62 | LIBATA Libata driver is enabled | 63 | LIBATA Libata driver is enabled |
63 | LP Printer support is enabled. | 64 | LP Printer support is enabled. |
@@ -99,6 +100,7 @@ parameter is applicable: | |||
99 | SWSUSP Software suspend (hibernation) is enabled. | 100 | SWSUSP Software suspend (hibernation) is enabled. |
100 | SUSPEND System suspend states are enabled. | 101 | SUSPEND System suspend states are enabled. |
101 | FTRACE Function tracing enabled. | 102 | FTRACE Function tracing enabled. |
103 | TPM TPM drivers are enabled. | ||
102 | TS Appropriate touchscreen support is enabled. | 104 | TS Appropriate touchscreen support is enabled. |
103 | UMS USB Mass Storage support is enabled. | 105 | UMS USB Mass Storage support is enabled. |
104 | USB USB support is enabled. | 106 | USB USB support is enabled. |
@@ -151,6 +153,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
151 | strict -- Be less tolerant of platforms that are not | 153 | strict -- Be less tolerant of platforms that are not |
152 | strictly ACPI specification compliant. | 154 | strictly ACPI specification compliant. |
153 | rsdt -- prefer RSDT over (default) XSDT | 155 | rsdt -- prefer RSDT over (default) XSDT |
156 | copy_dsdt -- copy DSDT to memory | ||
154 | 157 | ||
155 | See also Documentation/power/pm.txt, pci=noacpi | 158 | See also Documentation/power/pm.txt, pci=noacpi |
156 | 159 | ||
@@ -320,15 +323,12 @@ and is between 256 and 4096 characters. It is defined in the file | |||
320 | amd_iommu= [HW,X86-84] | 323 | amd_iommu= [HW,X86-84] |
321 | Pass parameters to the AMD IOMMU driver in the system. | 324 | Pass parameters to the AMD IOMMU driver in the system. |
322 | Possible values are: | 325 | Possible values are: |
323 | isolate - enable device isolation (each device, as far | ||
324 | as possible, will get its own protection | ||
325 | domain) [default] | ||
326 | share - put every device behind one IOMMU into the | ||
327 | same protection domain | ||
328 | fullflush - enable flushing of IO/TLB entries when | 326 | fullflush - enable flushing of IO/TLB entries when |
329 | they are unmapped. Otherwise they are | 327 | they are unmapped. Otherwise they are |
330 | flushed before they will be reused, which | 328 | flushed before they will be reused, which |
331 | is a lot of faster | 329 | is a lot of faster |
330 | off - do not initialize any AMD IOMMU found in | ||
331 | the system | ||
332 | 332 | ||
333 | amijoy.map= [HW,JOY] Amiga joystick support | 333 | amijoy.map= [HW,JOY] Amiga joystick support |
334 | Map of devices attached to JOY0DAT and JOY1DAT | 334 | Map of devices attached to JOY0DAT and JOY1DAT |
@@ -713,6 +713,12 @@ and is between 256 and 4096 characters. It is defined in the file | |||
713 | The VGA output is eventually overwritten by the real | 713 | The VGA output is eventually overwritten by the real |
714 | console. | 714 | console. |
715 | 715 | ||
716 | ekgdboc= [X86,KGDB] Allow early kernel console debugging | ||
717 | ekgdboc=kbd | ||
718 | |||
719 | This is desgined to be used in conjunction with | ||
720 | the boot argument: earlyprintk=vga | ||
721 | |||
716 | eata= [HW,SCSI] | 722 | eata= [HW,SCSI] |
717 | 723 | ||
718 | edd= [EDD] | 724 | edd= [EDD] |
@@ -789,8 +795,12 @@ and is between 256 and 4096 characters. It is defined in the file | |||
789 | as early as possible in order to facilitate early | 795 | as early as possible in order to facilitate early |
790 | boot debugging. | 796 | boot debugging. |
791 | 797 | ||
792 | ftrace_dump_on_oops | 798 | ftrace_dump_on_oops[=orig_cpu] |
793 | [FTRACE] will dump the trace buffers on oops. | 799 | [FTRACE] will dump the trace buffers on oops. |
800 | If no parameter is passed, ftrace will dump | ||
801 | buffers of all CPUs, but if you pass orig_cpu, it will | ||
802 | dump only the buffer of the CPU that triggered the | ||
803 | oops. | ||
794 | 804 | ||
795 | ftrace_filter=[function-list] | 805 | ftrace_filter=[function-list] |
796 | [FTRACE] Limit the functions traced by the function | 806 | [FTRACE] Limit the functions traced by the function |
@@ -1117,10 +1127,26 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1117 | use the HighMem zone if it exists, and the Normal | 1127 | use the HighMem zone if it exists, and the Normal |
1118 | zone if it does not. | 1128 | zone if it does not. |
1119 | 1129 | ||
1120 | kgdboc= [HW] kgdb over consoles. | 1130 | kgdbdbgp= [KGDB,HW] kgdb over EHCI usb debug port. |
1121 | Requires a tty driver that supports console polling. | 1131 | Format: <Controller#>[,poll interval] |
1122 | (only serial supported for now) | 1132 | The controller # is the number of the ehci usb debug |
1123 | Format: <serial_device>[,baud] | 1133 | port as it is probed via PCI. The poll interval is |
1134 | optional and is the number seconds in between | ||
1135 | each poll cycle to the debug port in case you need | ||
1136 | the functionality for interrupting the kernel with | ||
1137 | gdb or control-c on the dbgp connection. When | ||
1138 | not using this parameter you use sysrq-g to break into | ||
1139 | the kernel debugger. | ||
1140 | |||
1141 | kgdboc= [KGDB,HW] kgdb over consoles. | ||
1142 | Requires a tty driver that supports console polling, | ||
1143 | or a supported polling keyboard driver (non-usb). | ||
1144 | Serial only format: <serial_device>[,baud] | ||
1145 | keyboard only format: kbd | ||
1146 | keyboard and serial format: kbd,<serial_device>[,baud] | ||
1147 | |||
1148 | kgdbwait [KGDB] Stop kernel execution and enter the | ||
1149 | kernel debugger at the earliest opportunity. | ||
1124 | 1150 | ||
1125 | kmac= [MIPS] korina ethernet MAC address. | 1151 | kmac= [MIPS] korina ethernet MAC address. |
1126 | Configure the RouterBoard 532 series on-chip | 1152 | Configure the RouterBoard 532 series on-chip |
@@ -1199,7 +1225,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1199 | 1225 | ||
1200 | libata.force= [LIBATA] Force configurations. The format is comma | 1226 | libata.force= [LIBATA] Force configurations. The format is comma |
1201 | separated list of "[ID:]VAL" where ID is | 1227 | separated list of "[ID:]VAL" where ID is |
1202 | PORT[:DEVICE]. PORT and DEVICE are decimal numbers | 1228 | PORT[.DEVICE]. PORT and DEVICE are decimal numbers |
1203 | matching port, link or device. Basically, it matches | 1229 | matching port, link or device. Basically, it matches |
1204 | the ATA ID string printed on console by libata. If | 1230 | the ATA ID string printed on console by libata. If |
1205 | the whole ID part is omitted, the last PORT and DEVICE | 1231 | the whole ID part is omitted, the last PORT and DEVICE |
@@ -2615,6 +2641,15 @@ and is between 256 and 4096 characters. It is defined in the file | |||
2615 | 2641 | ||
2616 | tp720= [HW,PS2] | 2642 | tp720= [HW,PS2] |
2617 | 2643 | ||
2644 | tpm_suspend_pcr=[HW,TPM] | ||
2645 | Format: integer pcr id | ||
2646 | Specify that at suspend time, the tpm driver | ||
2647 | should extend the specified pcr with zeros, | ||
2648 | as a workaround for some chips which fail to | ||
2649 | flush the last written pcr on TPM_SaveState. | ||
2650 | This will guarantee that all the other pcrs | ||
2651 | are saved. | ||
2652 | |||
2618 | trace_buf_size=nn[KMG] | 2653 | trace_buf_size=nn[KMG] |
2619 | [FTRACE] will set tracing buffer size. | 2654 | [FTRACE] will set tracing buffer size. |
2620 | 2655 | ||
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt index 2f9115c0ae62..6653017680dd 100644 --- a/Documentation/kprobes.txt +++ b/Documentation/kprobes.txt | |||
@@ -165,8 +165,8 @@ the user entry_handler invocation is also skipped. | |||
165 | 165 | ||
166 | 1.4 How Does Jump Optimization Work? | 166 | 1.4 How Does Jump Optimization Work? |
167 | 167 | ||
168 | If you configured your kernel with CONFIG_OPTPROBES=y (currently | 168 | If your kernel is built with CONFIG_OPTPROBES=y (currently this flag |
169 | this option is supported on x86/x86-64, non-preemptive kernel) and | 169 | is automatically set 'y' on x86/x86-64, non-preemptive kernel) and |
170 | the "debug.kprobes_optimization" kernel parameter is set to 1 (see | 170 | the "debug.kprobes_optimization" kernel parameter is set to 1 (see |
171 | sysctl(8)), Kprobes tries to reduce probe-hit overhead by using a jump | 171 | sysctl(8)), Kprobes tries to reduce probe-hit overhead by using a jump |
172 | instruction instead of a breakpoint instruction at each probepoint. | 172 | instruction instead of a breakpoint instruction at each probepoint. |
@@ -271,8 +271,6 @@ tweak the kernel's execution path, you need to suppress optimization, | |||
271 | using one of the following techniques: | 271 | using one of the following techniques: |
272 | - Specify an empty function for the kprobe's post_handler or break_handler. | 272 | - Specify an empty function for the kprobe's post_handler or break_handler. |
273 | or | 273 | or |
274 | - Config CONFIG_OPTPROBES=n. | ||
275 | or | ||
276 | - Execute 'sysctl -w debug.kprobes_optimization=n' | 274 | - Execute 'sysctl -w debug.kprobes_optimization=n' |
277 | 275 | ||
278 | 2. Architectures Supported | 276 | 2. Architectures Supported |
@@ -307,10 +305,6 @@ it useful to "Compile the kernel with debug info" (CONFIG_DEBUG_INFO), | |||
307 | so you can use "objdump -d -l vmlinux" to see the source-to-object | 305 | so you can use "objdump -d -l vmlinux" to see the source-to-object |
308 | code mapping. | 306 | code mapping. |
309 | 307 | ||
310 | If you want to reduce probing overhead, set "Kprobes jump optimization | ||
311 | support" (CONFIG_OPTPROBES) to "y". You can find this option under the | ||
312 | "Kprobes" line. | ||
313 | |||
314 | 4. API Reference | 308 | 4. API Reference |
315 | 309 | ||
316 | The Kprobes API includes a "register" function and an "unregister" | 310 | The Kprobes API includes a "register" function and an "unregister" |
@@ -332,7 +326,7 @@ occurs during execution of kp->pre_handler or kp->post_handler, | |||
332 | or during single-stepping of the probed instruction, Kprobes calls | 326 | or during single-stepping of the probed instruction, Kprobes calls |
333 | kp->fault_handler. Any or all handlers can be NULL. If kp->flags | 327 | kp->fault_handler. Any or all handlers can be NULL. If kp->flags |
334 | is set KPROBE_FLAG_DISABLED, that kp will be registered but disabled, | 328 | is set KPROBE_FLAG_DISABLED, that kp will be registered but disabled, |
335 | so, it's handlers aren't hit until calling enable_kprobe(kp). | 329 | so, its handlers aren't hit until calling enable_kprobe(kp). |
336 | 330 | ||
337 | NOTE: | 331 | NOTE: |
338 | 1. With the introduction of the "symbol_name" field to struct kprobe, | 332 | 1. With the introduction of the "symbol_name" field to struct kprobe, |
diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt index c6416a398163..a237518e51b9 100644 --- a/Documentation/kvm/api.txt +++ b/Documentation/kvm/api.txt | |||
@@ -656,6 +656,7 @@ struct kvm_clock_data { | |||
656 | 4.29 KVM_GET_VCPU_EVENTS | 656 | 4.29 KVM_GET_VCPU_EVENTS |
657 | 657 | ||
658 | Capability: KVM_CAP_VCPU_EVENTS | 658 | Capability: KVM_CAP_VCPU_EVENTS |
659 | Extended by: KVM_CAP_INTR_SHADOW | ||
659 | Architectures: x86 | 660 | Architectures: x86 |
660 | Type: vm ioctl | 661 | Type: vm ioctl |
661 | Parameters: struct kvm_vcpu_event (out) | 662 | Parameters: struct kvm_vcpu_event (out) |
@@ -676,7 +677,7 @@ struct kvm_vcpu_events { | |||
676 | __u8 injected; | 677 | __u8 injected; |
677 | __u8 nr; | 678 | __u8 nr; |
678 | __u8 soft; | 679 | __u8 soft; |
679 | __u8 pad; | 680 | __u8 shadow; |
680 | } interrupt; | 681 | } interrupt; |
681 | struct { | 682 | struct { |
682 | __u8 injected; | 683 | __u8 injected; |
@@ -688,9 +689,13 @@ struct kvm_vcpu_events { | |||
688 | __u32 flags; | 689 | __u32 flags; |
689 | }; | 690 | }; |
690 | 691 | ||
692 | KVM_VCPUEVENT_VALID_SHADOW may be set in the flags field to signal that | ||
693 | interrupt.shadow contains a valid state. Otherwise, this field is undefined. | ||
694 | |||
691 | 4.30 KVM_SET_VCPU_EVENTS | 695 | 4.30 KVM_SET_VCPU_EVENTS |
692 | 696 | ||
693 | Capability: KVM_CAP_VCPU_EVENTS | 697 | Capability: KVM_CAP_VCPU_EVENTS |
698 | Extended by: KVM_CAP_INTR_SHADOW | ||
694 | Architectures: x86 | 699 | Architectures: x86 |
695 | Type: vm ioctl | 700 | Type: vm ioctl |
696 | Parameters: struct kvm_vcpu_event (in) | 701 | Parameters: struct kvm_vcpu_event (in) |
@@ -709,6 +714,183 @@ current in-kernel state. The bits are: | |||
709 | KVM_VCPUEVENT_VALID_NMI_PENDING - transfer nmi.pending to the kernel | 714 | KVM_VCPUEVENT_VALID_NMI_PENDING - transfer nmi.pending to the kernel |
710 | KVM_VCPUEVENT_VALID_SIPI_VECTOR - transfer sipi_vector | 715 | KVM_VCPUEVENT_VALID_SIPI_VECTOR - transfer sipi_vector |
711 | 716 | ||
717 | If KVM_CAP_INTR_SHADOW is available, KVM_VCPUEVENT_VALID_SHADOW can be set in | ||
718 | the flags field to signal that interrupt.shadow contains a valid state and | ||
719 | shall be written into the VCPU. | ||
720 | |||
721 | 4.32 KVM_GET_DEBUGREGS | ||
722 | |||
723 | Capability: KVM_CAP_DEBUGREGS | ||
724 | Architectures: x86 | ||
725 | Type: vm ioctl | ||
726 | Parameters: struct kvm_debugregs (out) | ||
727 | Returns: 0 on success, -1 on error | ||
728 | |||
729 | Reads debug registers from the vcpu. | ||
730 | |||
731 | struct kvm_debugregs { | ||
732 | __u64 db[4]; | ||
733 | __u64 dr6; | ||
734 | __u64 dr7; | ||
735 | __u64 flags; | ||
736 | __u64 reserved[9]; | ||
737 | }; | ||
738 | |||
739 | 4.33 KVM_SET_DEBUGREGS | ||
740 | |||
741 | Capability: KVM_CAP_DEBUGREGS | ||
742 | Architectures: x86 | ||
743 | Type: vm ioctl | ||
744 | Parameters: struct kvm_debugregs (in) | ||
745 | Returns: 0 on success, -1 on error | ||
746 | |||
747 | Writes debug registers into the vcpu. | ||
748 | |||
749 | See KVM_GET_DEBUGREGS for the data structure. The flags field is unused | ||
750 | yet and must be cleared on entry. | ||
751 | |||
752 | 4.34 KVM_SET_USER_MEMORY_REGION | ||
753 | |||
754 | Capability: KVM_CAP_USER_MEM | ||
755 | Architectures: all | ||
756 | Type: vm ioctl | ||
757 | Parameters: struct kvm_userspace_memory_region (in) | ||
758 | Returns: 0 on success, -1 on error | ||
759 | |||
760 | struct kvm_userspace_memory_region { | ||
761 | __u32 slot; | ||
762 | __u32 flags; | ||
763 | __u64 guest_phys_addr; | ||
764 | __u64 memory_size; /* bytes */ | ||
765 | __u64 userspace_addr; /* start of the userspace allocated memory */ | ||
766 | }; | ||
767 | |||
768 | /* for kvm_memory_region::flags */ | ||
769 | #define KVM_MEM_LOG_DIRTY_PAGES 1UL | ||
770 | |||
771 | This ioctl allows the user to create or modify a guest physical memory | ||
772 | slot. When changing an existing slot, it may be moved in the guest | ||
773 | physical memory space, or its flags may be modified. It may not be | ||
774 | resized. Slots may not overlap in guest physical address space. | ||
775 | |||
776 | Memory for the region is taken starting at the address denoted by the | ||
777 | field userspace_addr, which must point at user addressable memory for | ||
778 | the entire memory slot size. Any object may back this memory, including | ||
779 | anonymous memory, ordinary files, and hugetlbfs. | ||
780 | |||
781 | It is recommended that the lower 21 bits of guest_phys_addr and userspace_addr | ||
782 | be identical. This allows large pages in the guest to be backed by large | ||
783 | pages in the host. | ||
784 | |||
785 | The flags field supports just one flag, KVM_MEM_LOG_DIRTY_PAGES, which | ||
786 | instructs kvm to keep track of writes to memory within the slot. See | ||
787 | the KVM_GET_DIRTY_LOG ioctl. | ||
788 | |||
789 | When the KVM_CAP_SYNC_MMU capability, changes in the backing of the memory | ||
790 | region are automatically reflected into the guest. For example, an mmap() | ||
791 | that affects the region will be made visible immediately. Another example | ||
792 | is madvise(MADV_DROP). | ||
793 | |||
794 | It is recommended to use this API instead of the KVM_SET_MEMORY_REGION ioctl. | ||
795 | The KVM_SET_MEMORY_REGION does not allow fine grained control over memory | ||
796 | allocation and is deprecated. | ||
797 | |||
798 | 4.35 KVM_SET_TSS_ADDR | ||
799 | |||
800 | Capability: KVM_CAP_SET_TSS_ADDR | ||
801 | Architectures: x86 | ||
802 | Type: vm ioctl | ||
803 | Parameters: unsigned long tss_address (in) | ||
804 | Returns: 0 on success, -1 on error | ||
805 | |||
806 | This ioctl defines the physical address of a three-page region in the guest | ||
807 | physical address space. The region must be within the first 4GB of the | ||
808 | guest physical address space and must not conflict with any memory slot | ||
809 | or any mmio address. The guest may malfunction if it accesses this memory | ||
810 | region. | ||
811 | |||
812 | This ioctl is required on Intel-based hosts. This is needed on Intel hardware | ||
813 | because of a quirk in the virtualization implementation (see the internals | ||
814 | documentation when it pops into existence). | ||
815 | |||
816 | 4.36 KVM_ENABLE_CAP | ||
817 | |||
818 | Capability: KVM_CAP_ENABLE_CAP | ||
819 | Architectures: ppc | ||
820 | Type: vcpu ioctl | ||
821 | Parameters: struct kvm_enable_cap (in) | ||
822 | Returns: 0 on success; -1 on error | ||
823 | |||
824 | +Not all extensions are enabled by default. Using this ioctl the application | ||
825 | can enable an extension, making it available to the guest. | ||
826 | |||
827 | On systems that do not support this ioctl, it always fails. On systems that | ||
828 | do support it, it only works for extensions that are supported for enablement. | ||
829 | |||
830 | To check if a capability can be enabled, the KVM_CHECK_EXTENSION ioctl should | ||
831 | be used. | ||
832 | |||
833 | struct kvm_enable_cap { | ||
834 | /* in */ | ||
835 | __u32 cap; | ||
836 | |||
837 | The capability that is supposed to get enabled. | ||
838 | |||
839 | __u32 flags; | ||
840 | |||
841 | A bitfield indicating future enhancements. Has to be 0 for now. | ||
842 | |||
843 | __u64 args[4]; | ||
844 | |||
845 | Arguments for enabling a feature. If a feature needs initial values to | ||
846 | function properly, this is the place to put them. | ||
847 | |||
848 | __u8 pad[64]; | ||
849 | }; | ||
850 | |||
851 | 4.37 KVM_GET_MP_STATE | ||
852 | |||
853 | Capability: KVM_CAP_MP_STATE | ||
854 | Architectures: x86, ia64 | ||
855 | Type: vcpu ioctl | ||
856 | Parameters: struct kvm_mp_state (out) | ||
857 | Returns: 0 on success; -1 on error | ||
858 | |||
859 | struct kvm_mp_state { | ||
860 | __u32 mp_state; | ||
861 | }; | ||
862 | |||
863 | Returns the vcpu's current "multiprocessing state" (though also valid on | ||
864 | uniprocessor guests). | ||
865 | |||
866 | Possible values are: | ||
867 | |||
868 | - KVM_MP_STATE_RUNNABLE: the vcpu is currently running | ||
869 | - KVM_MP_STATE_UNINITIALIZED: the vcpu is an application processor (AP) | ||
870 | which has not yet received an INIT signal | ||
871 | - KVM_MP_STATE_INIT_RECEIVED: the vcpu has received an INIT signal, and is | ||
872 | now ready for a SIPI | ||
873 | - KVM_MP_STATE_HALTED: the vcpu has executed a HLT instruction and | ||
874 | is waiting for an interrupt | ||
875 | - KVM_MP_STATE_SIPI_RECEIVED: the vcpu has just received a SIPI (vector | ||
876 | accesible via KVM_GET_VCPU_EVENTS) | ||
877 | |||
878 | This ioctl is only useful after KVM_CREATE_IRQCHIP. Without an in-kernel | ||
879 | irqchip, the multiprocessing state must be maintained by userspace. | ||
880 | |||
881 | 4.38 KVM_SET_MP_STATE | ||
882 | |||
883 | Capability: KVM_CAP_MP_STATE | ||
884 | Architectures: x86, ia64 | ||
885 | Type: vcpu ioctl | ||
886 | Parameters: struct kvm_mp_state (in) | ||
887 | Returns: 0 on success; -1 on error | ||
888 | |||
889 | Sets the vcpu's current "multiprocessing state"; see KVM_GET_MP_STATE for | ||
890 | arguments. | ||
891 | |||
892 | This ioctl is only useful after KVM_CREATE_IRQCHIP. Without an in-kernel | ||
893 | irqchip, the multiprocessing state must be maintained by userspace. | ||
712 | 894 | ||
713 | 5. The kvm_run structure | 895 | 5. The kvm_run structure |
714 | 896 | ||
@@ -820,6 +1002,13 @@ executed a memory-mapped I/O instruction which could not be satisfied | |||
820 | by kvm. The 'data' member contains the written data if 'is_write' is | 1002 | by kvm. The 'data' member contains the written data if 'is_write' is |
821 | true, and should be filled by application code otherwise. | 1003 | true, and should be filled by application code otherwise. |
822 | 1004 | ||
1005 | NOTE: For KVM_EXIT_IO, KVM_EXIT_MMIO and KVM_EXIT_OSI, the corresponding | ||
1006 | operations are complete (and guest state is consistent) only after userspace | ||
1007 | has re-entered the kernel with KVM_RUN. The kernel side will first finish | ||
1008 | incomplete operations and then check for pending signals. Userspace | ||
1009 | can re-enter the guest with an unmasked signal pending to complete | ||
1010 | pending operations. | ||
1011 | |||
823 | /* KVM_EXIT_HYPERCALL */ | 1012 | /* KVM_EXIT_HYPERCALL */ |
824 | struct { | 1013 | struct { |
825 | __u64 nr; | 1014 | __u64 nr; |
@@ -829,7 +1018,9 @@ true, and should be filled by application code otherwise. | |||
829 | __u32 pad; | 1018 | __u32 pad; |
830 | } hypercall; | 1019 | } hypercall; |
831 | 1020 | ||
832 | Unused. | 1021 | Unused. This was once used for 'hypercall to userspace'. To implement |
1022 | such functionality, use KVM_EXIT_IO (x86) or KVM_EXIT_MMIO (all except s390). | ||
1023 | Note KVM_EXIT_IO is significantly faster than KVM_EXIT_MMIO. | ||
833 | 1024 | ||
834 | /* KVM_EXIT_TPR_ACCESS */ | 1025 | /* KVM_EXIT_TPR_ACCESS */ |
835 | struct { | 1026 | struct { |
@@ -870,6 +1061,19 @@ s390 specific. | |||
870 | 1061 | ||
871 | powerpc specific. | 1062 | powerpc specific. |
872 | 1063 | ||
1064 | /* KVM_EXIT_OSI */ | ||
1065 | struct { | ||
1066 | __u64 gprs[32]; | ||
1067 | } osi; | ||
1068 | |||
1069 | MOL uses a special hypercall interface it calls 'OSI'. To enable it, we catch | ||
1070 | hypercalls and exit with this exit struct that contains all the guest gprs. | ||
1071 | |||
1072 | If exit_reason is KVM_EXIT_OSI, then the vcpu has triggered such a hypercall. | ||
1073 | Userspace can now handle the hypercall and when it's done modify the gprs as | ||
1074 | necessary. Upon guest entry all guest GPRs will then be replaced by the values | ||
1075 | in this struct. | ||
1076 | |||
873 | /* Fix the size of the union. */ | 1077 | /* Fix the size of the union. */ |
874 | char padding[256]; | 1078 | char padding[256]; |
875 | }; | 1079 | }; |
diff --git a/Documentation/kvm/cpuid.txt b/Documentation/kvm/cpuid.txt new file mode 100644 index 000000000000..14a12ea92b7f --- /dev/null +++ b/Documentation/kvm/cpuid.txt | |||
@@ -0,0 +1,42 @@ | |||
1 | KVM CPUID bits | ||
2 | Glauber Costa <glommer@redhat.com>, Red Hat Inc, 2010 | ||
3 | ===================================================== | ||
4 | |||
5 | A guest running on a kvm host, can check some of its features using | ||
6 | cpuid. This is not always guaranteed to work, since userspace can | ||
7 | mask-out some, or even all KVM-related cpuid features before launching | ||
8 | a guest. | ||
9 | |||
10 | KVM cpuid functions are: | ||
11 | |||
12 | function: KVM_CPUID_SIGNATURE (0x40000000) | ||
13 | returns : eax = 0, | ||
14 | ebx = 0x4b4d564b, | ||
15 | ecx = 0x564b4d56, | ||
16 | edx = 0x4d. | ||
17 | Note that this value in ebx, ecx and edx corresponds to the string "KVMKVMKVM". | ||
18 | This function queries the presence of KVM cpuid leafs. | ||
19 | |||
20 | |||
21 | function: define KVM_CPUID_FEATURES (0x40000001) | ||
22 | returns : ebx, ecx, edx = 0 | ||
23 | eax = and OR'ed group of (1 << flag), where each flags is: | ||
24 | |||
25 | |||
26 | flag || value || meaning | ||
27 | ============================================================================= | ||
28 | KVM_FEATURE_CLOCKSOURCE || 0 || kvmclock available at msrs | ||
29 | || || 0x11 and 0x12. | ||
30 | ------------------------------------------------------------------------------ | ||
31 | KVM_FEATURE_NOP_IO_DELAY || 1 || not necessary to perform delays | ||
32 | || || on PIO operations. | ||
33 | ------------------------------------------------------------------------------ | ||
34 | KVM_FEATURE_MMU_OP || 2 || deprecated. | ||
35 | ------------------------------------------------------------------------------ | ||
36 | KVM_FEATURE_CLOCKSOURCE2 || 3 || kvmclock available at msrs | ||
37 | || || 0x4b564d00 and 0x4b564d01 | ||
38 | ------------------------------------------------------------------------------ | ||
39 | KVM_FEATURE_CLOCKSOURCE_STABLE_BIT || 24 || host will warn if no guest-side | ||
40 | || || per-cpu warps are expected in | ||
41 | || || kvmclock. | ||
42 | ------------------------------------------------------------------------------ | ||
diff --git a/Documentation/kvm/mmu.txt b/Documentation/kvm/mmu.txt new file mode 100644 index 000000000000..aaed6ab9d7ab --- /dev/null +++ b/Documentation/kvm/mmu.txt | |||
@@ -0,0 +1,304 @@ | |||
1 | The x86 kvm shadow mmu | ||
2 | ====================== | ||
3 | |||
4 | The mmu (in arch/x86/kvm, files mmu.[ch] and paging_tmpl.h) is responsible | ||
5 | for presenting a standard x86 mmu to the guest, while translating guest | ||
6 | physical addresses to host physical addresses. | ||
7 | |||
8 | The mmu code attempts to satisfy the following requirements: | ||
9 | |||
10 | - correctness: the guest should not be able to determine that it is running | ||
11 | on an emulated mmu except for timing (we attempt to comply | ||
12 | with the specification, not emulate the characteristics of | ||
13 | a particular implementation such as tlb size) | ||
14 | - security: the guest must not be able to touch host memory not assigned | ||
15 | to it | ||
16 | - performance: minimize the performance penalty imposed by the mmu | ||
17 | - scaling: need to scale to large memory and large vcpu guests | ||
18 | - hardware: support the full range of x86 virtualization hardware | ||
19 | - integration: Linux memory management code must be in control of guest memory | ||
20 | so that swapping, page migration, page merging, transparent | ||
21 | hugepages, and similar features work without change | ||
22 | - dirty tracking: report writes to guest memory to enable live migration | ||
23 | and framebuffer-based displays | ||
24 | - footprint: keep the amount of pinned kernel memory low (most memory | ||
25 | should be shrinkable) | ||
26 | - reliablity: avoid multipage or GFP_ATOMIC allocations | ||
27 | |||
28 | Acronyms | ||
29 | ======== | ||
30 | |||
31 | pfn host page frame number | ||
32 | hpa host physical address | ||
33 | hva host virtual address | ||
34 | gfn guest frame number | ||
35 | gpa guest physical address | ||
36 | gva guest virtual address | ||
37 | ngpa nested guest physical address | ||
38 | ngva nested guest virtual address | ||
39 | pte page table entry (used also to refer generically to paging structure | ||
40 | entries) | ||
41 | gpte guest pte (referring to gfns) | ||
42 | spte shadow pte (referring to pfns) | ||
43 | tdp two dimensional paging (vendor neutral term for NPT and EPT) | ||
44 | |||
45 | Virtual and real hardware supported | ||
46 | =================================== | ||
47 | |||
48 | The mmu supports first-generation mmu hardware, which allows an atomic switch | ||
49 | of the current paging mode and cr3 during guest entry, as well as | ||
50 | two-dimensional paging (AMD's NPT and Intel's EPT). The emulated hardware | ||
51 | it exposes is the traditional 2/3/4 level x86 mmu, with support for global | ||
52 | pages, pae, pse, pse36, cr0.wp, and 1GB pages. Work is in progress to support | ||
53 | exposing NPT capable hardware on NPT capable hosts. | ||
54 | |||
55 | Translation | ||
56 | =========== | ||
57 | |||
58 | The primary job of the mmu is to program the processor's mmu to translate | ||
59 | addresses for the guest. Different translations are required at different | ||
60 | times: | ||
61 | |||
62 | - when guest paging is disabled, we translate guest physical addresses to | ||
63 | host physical addresses (gpa->hpa) | ||
64 | - when guest paging is enabled, we translate guest virtual addresses, to | ||
65 | guest physical addresses, to host physical addresses (gva->gpa->hpa) | ||
66 | - when the guest launches a guest of its own, we translate nested guest | ||
67 | virtual addresses, to nested guest physical addresses, to guest physical | ||
68 | addresses, to host physical addresses (ngva->ngpa->gpa->hpa) | ||
69 | |||
70 | The primary challenge is to encode between 1 and 3 translations into hardware | ||
71 | that support only 1 (traditional) and 2 (tdp) translations. When the | ||
72 | number of required translations matches the hardware, the mmu operates in | ||
73 | direct mode; otherwise it operates in shadow mode (see below). | ||
74 | |||
75 | Memory | ||
76 | ====== | ||
77 | |||
78 | Guest memory (gpa) is part of the user address space of the process that is | ||
79 | using kvm. Userspace defines the translation between guest addresses and user | ||
80 | addresses (gpa->hva); note that two gpas may alias to the same gva, but not | ||
81 | vice versa. | ||
82 | |||
83 | These gvas may be backed using any method available to the host: anonymous | ||
84 | memory, file backed memory, and device memory. Memory might be paged by the | ||
85 | host at any time. | ||
86 | |||
87 | Events | ||
88 | ====== | ||
89 | |||
90 | The mmu is driven by events, some from the guest, some from the host. | ||
91 | |||
92 | Guest generated events: | ||
93 | - writes to control registers (especially cr3) | ||
94 | - invlpg/invlpga instruction execution | ||
95 | - access to missing or protected translations | ||
96 | |||
97 | Host generated events: | ||
98 | - changes in the gpa->hpa translation (either through gpa->hva changes or | ||
99 | through hva->hpa changes) | ||
100 | - memory pressure (the shrinker) | ||
101 | |||
102 | Shadow pages | ||
103 | ============ | ||
104 | |||
105 | The principal data structure is the shadow page, 'struct kvm_mmu_page'. A | ||
106 | shadow page contains 512 sptes, which can be either leaf or nonleaf sptes. A | ||
107 | shadow page may contain a mix of leaf and nonleaf sptes. | ||
108 | |||
109 | A nonleaf spte allows the hardware mmu to reach the leaf pages and | ||
110 | is not related to a translation directly. It points to other shadow pages. | ||
111 | |||
112 | A leaf spte corresponds to either one or two translations encoded into | ||
113 | one paging structure entry. These are always the lowest level of the | ||
114 | translation stack, with optional higher level translations left to NPT/EPT. | ||
115 | Leaf ptes point at guest pages. | ||
116 | |||
117 | The following table shows translations encoded by leaf ptes, with higher-level | ||
118 | translations in parentheses: | ||
119 | |||
120 | Non-nested guests: | ||
121 | nonpaging: gpa->hpa | ||
122 | paging: gva->gpa->hpa | ||
123 | paging, tdp: (gva->)gpa->hpa | ||
124 | Nested guests: | ||
125 | non-tdp: ngva->gpa->hpa (*) | ||
126 | tdp: (ngva->)ngpa->gpa->hpa | ||
127 | |||
128 | (*) the guest hypervisor will encode the ngva->gpa translation into its page | ||
129 | tables if npt is not present | ||
130 | |||
131 | Shadow pages contain the following information: | ||
132 | role.level: | ||
133 | The level in the shadow paging hierarchy that this shadow page belongs to. | ||
134 | 1=4k sptes, 2=2M sptes, 3=1G sptes, etc. | ||
135 | role.direct: | ||
136 | If set, leaf sptes reachable from this page are for a linear range. | ||
137 | Examples include real mode translation, large guest pages backed by small | ||
138 | host pages, and gpa->hpa translations when NPT or EPT is active. | ||
139 | The linear range starts at (gfn << PAGE_SHIFT) and its size is determined | ||
140 | by role.level (2MB for first level, 1GB for second level, 0.5TB for third | ||
141 | level, 256TB for fourth level) | ||
142 | If clear, this page corresponds to a guest page table denoted by the gfn | ||
143 | field. | ||
144 | role.quadrant: | ||
145 | When role.cr4_pae=0, the guest uses 32-bit gptes while the host uses 64-bit | ||
146 | sptes. That means a guest page table contains more ptes than the host, | ||
147 | so multiple shadow pages are needed to shadow one guest page. | ||
148 | For first-level shadow pages, role.quadrant can be 0 or 1 and denotes the | ||
149 | first or second 512-gpte block in the guest page table. For second-level | ||
150 | page tables, each 32-bit gpte is converted to two 64-bit sptes | ||
151 | (since each first-level guest page is shadowed by two first-level | ||
152 | shadow pages) so role.quadrant takes values in the range 0..3. Each | ||
153 | quadrant maps 1GB virtual address space. | ||
154 | role.access: | ||
155 | Inherited guest access permissions in the form uwx. Note execute | ||
156 | permission is positive, not negative. | ||
157 | role.invalid: | ||
158 | The page is invalid and should not be used. It is a root page that is | ||
159 | currently pinned (by a cpu hardware register pointing to it); once it is | ||
160 | unpinned it will be destroyed. | ||
161 | role.cr4_pae: | ||
162 | Contains the value of cr4.pae for which the page is valid (e.g. whether | ||
163 | 32-bit or 64-bit gptes are in use). | ||
164 | role.cr4_nxe: | ||
165 | Contains the value of efer.nxe for which the page is valid. | ||
166 | role.cr0_wp: | ||
167 | Contains the value of cr0.wp for which the page is valid. | ||
168 | gfn: | ||
169 | Either the guest page table containing the translations shadowed by this | ||
170 | page, or the base page frame for linear translations. See role.direct. | ||
171 | spt: | ||
172 | A pageful of 64-bit sptes containing the translations for this page. | ||
173 | Accessed by both kvm and hardware. | ||
174 | The page pointed to by spt will have its page->private pointing back | ||
175 | at the shadow page structure. | ||
176 | sptes in spt point either at guest pages, or at lower-level shadow pages. | ||
177 | Specifically, if sp1 and sp2 are shadow pages, then sp1->spt[n] may point | ||
178 | at __pa(sp2->spt). sp2 will point back at sp1 through parent_pte. | ||
179 | The spt array forms a DAG structure with the shadow page as a node, and | ||
180 | guest pages as leaves. | ||
181 | gfns: | ||
182 | An array of 512 guest frame numbers, one for each present pte. Used to | ||
183 | perform a reverse map from a pte to a gfn. | ||
184 | slot_bitmap: | ||
185 | A bitmap containing one bit per memory slot. If the page contains a pte | ||
186 | mapping a page from memory slot n, then bit n of slot_bitmap will be set | ||
187 | (if a page is aliased among several slots, then it is not guaranteed that | ||
188 | all slots will be marked). | ||
189 | Used during dirty logging to avoid scanning a shadow page if none if its | ||
190 | pages need tracking. | ||
191 | root_count: | ||
192 | A counter keeping track of how many hardware registers (guest cr3 or | ||
193 | pdptrs) are now pointing at the page. While this counter is nonzero, the | ||
194 | page cannot be destroyed. See role.invalid. | ||
195 | multimapped: | ||
196 | Whether there exist multiple sptes pointing at this page. | ||
197 | parent_pte/parent_ptes: | ||
198 | If multimapped is zero, parent_pte points at the single spte that points at | ||
199 | this page's spt. Otherwise, parent_ptes points at a data structure | ||
200 | with a list of parent_ptes. | ||
201 | unsync: | ||
202 | If true, then the translations in this page may not match the guest's | ||
203 | translation. This is equivalent to the state of the tlb when a pte is | ||
204 | changed but before the tlb entry is flushed. Accordingly, unsync ptes | ||
205 | are synchronized when the guest executes invlpg or flushes its tlb by | ||
206 | other means. Valid for leaf pages. | ||
207 | unsync_children: | ||
208 | How many sptes in the page point at pages that are unsync (or have | ||
209 | unsynchronized children). | ||
210 | unsync_child_bitmap: | ||
211 | A bitmap indicating which sptes in spt point (directly or indirectly) at | ||
212 | pages that may be unsynchronized. Used to quickly locate all unsychronized | ||
213 | pages reachable from a given page. | ||
214 | |||
215 | Reverse map | ||
216 | =========== | ||
217 | |||
218 | The mmu maintains a reverse mapping whereby all ptes mapping a page can be | ||
219 | reached given its gfn. This is used, for example, when swapping out a page. | ||
220 | |||
221 | Synchronized and unsynchronized pages | ||
222 | ===================================== | ||
223 | |||
224 | The guest uses two events to synchronize its tlb and page tables: tlb flushes | ||
225 | and page invalidations (invlpg). | ||
226 | |||
227 | A tlb flush means that we need to synchronize all sptes reachable from the | ||
228 | guest's cr3. This is expensive, so we keep all guest page tables write | ||
229 | protected, and synchronize sptes to gptes when a gpte is written. | ||
230 | |||
231 | A special case is when a guest page table is reachable from the current | ||
232 | guest cr3. In this case, the guest is obliged to issue an invlpg instruction | ||
233 | before using the translation. We take advantage of that by removing write | ||
234 | protection from the guest page, and allowing the guest to modify it freely. | ||
235 | We synchronize modified gptes when the guest invokes invlpg. This reduces | ||
236 | the amount of emulation we have to do when the guest modifies multiple gptes, | ||
237 | or when the a guest page is no longer used as a page table and is used for | ||
238 | random guest data. | ||
239 | |||
240 | As a side effect we have to resynchronize all reachable unsynchronized shadow | ||
241 | pages on a tlb flush. | ||
242 | |||
243 | |||
244 | Reaction to events | ||
245 | ================== | ||
246 | |||
247 | - guest page fault (or npt page fault, or ept violation) | ||
248 | |||
249 | This is the most complicated event. The cause of a page fault can be: | ||
250 | |||
251 | - a true guest fault (the guest translation won't allow the access) (*) | ||
252 | - access to a missing translation | ||
253 | - access to a protected translation | ||
254 | - when logging dirty pages, memory is write protected | ||
255 | - synchronized shadow pages are write protected (*) | ||
256 | - access to untranslatable memory (mmio) | ||
257 | |||
258 | (*) not applicable in direct mode | ||
259 | |||
260 | Handling a page fault is performed as follows: | ||
261 | |||
262 | - if needed, walk the guest page tables to determine the guest translation | ||
263 | (gva->gpa or ngpa->gpa) | ||
264 | - if permissions are insufficient, reflect the fault back to the guest | ||
265 | - determine the host page | ||
266 | - if this is an mmio request, there is no host page; call the emulator | ||
267 | to emulate the instruction instead | ||
268 | - walk the shadow page table to find the spte for the translation, | ||
269 | instantiating missing intermediate page tables as necessary | ||
270 | - try to unsynchronize the page | ||
271 | - if successful, we can let the guest continue and modify the gpte | ||
272 | - emulate the instruction | ||
273 | - if failed, unshadow the page and let the guest continue | ||
274 | - update any translations that were modified by the instruction | ||
275 | |||
276 | invlpg handling: | ||
277 | |||
278 | - walk the shadow page hierarchy and drop affected translations | ||
279 | - try to reinstantiate the indicated translation in the hope that the | ||
280 | guest will use it in the near future | ||
281 | |||
282 | Guest control register updates: | ||
283 | |||
284 | - mov to cr3 | ||
285 | - look up new shadow roots | ||
286 | - synchronize newly reachable shadow pages | ||
287 | |||
288 | - mov to cr0/cr4/efer | ||
289 | - set up mmu context for new paging mode | ||
290 | - look up new shadow roots | ||
291 | - synchronize newly reachable shadow pages | ||
292 | |||
293 | Host translation updates: | ||
294 | |||
295 | - mmu notifier called with updated hva | ||
296 | - look up affected sptes through reverse map | ||
297 | - drop (or update) translations | ||
298 | |||
299 | Further reading | ||
300 | =============== | ||
301 | |||
302 | - NPT presentation from KVM Forum 2008 | ||
303 | http://www.linux-kvm.org/wiki/images/c/c8/KvmForum2008%24kdf2008_21.pdf | ||
304 | |||
diff --git a/Documentation/laptops/laptop-mode.txt b/Documentation/laptops/laptop-mode.txt index 2c3c35093023..0bf25eebce94 100644 --- a/Documentation/laptops/laptop-mode.txt +++ b/Documentation/laptops/laptop-mode.txt | |||
@@ -207,7 +207,7 @@ Tips & Tricks | |||
207 | * Drew Scott Daniels observed: "I don't know why, but when I decrease the number | 207 | * Drew Scott Daniels observed: "I don't know why, but when I decrease the number |
208 | of colours that my display uses it consumes less battery power. I've seen | 208 | of colours that my display uses it consumes less battery power. I've seen |
209 | this on powerbooks too. I hope that this is a piece of information that | 209 | this on powerbooks too. I hope that this is a piece of information that |
210 | might be useful to the Laptop Mode patch or it's users." | 210 | might be useful to the Laptop Mode patch or its users." |
211 | 211 | ||
212 | * In syslog.conf, you can prefix entries with a dash ``-'' to omit syncing the | 212 | * In syslog.conf, you can prefix entries with a dash ``-'' to omit syncing the |
213 | file after every logging. When you're using laptop-mode and your disk doesn't | 213 | file after every logging. When you're using laptop-mode and your disk doesn't |
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt index 39c0a09d0105..fc15538d8b46 100644 --- a/Documentation/laptops/thinkpad-acpi.txt +++ b/Documentation/laptops/thinkpad-acpi.txt | |||
@@ -292,13 +292,13 @@ sysfs notes: | |||
292 | 292 | ||
293 | Warning: when in NVRAM mode, the volume up/down/mute | 293 | Warning: when in NVRAM mode, the volume up/down/mute |
294 | keys are synthesized according to changes in the mixer, | 294 | keys are synthesized according to changes in the mixer, |
295 | so you have to use volume up or volume down to unmute, | 295 | which uses a single volume up or volume down hotkey |
296 | as per the ThinkPad volume mixer user interface. When | 296 | press to unmute, as per the ThinkPad volume mixer user |
297 | in ACPI event mode, volume up/down/mute are reported as | 297 | interface. When in ACPI event mode, volume up/down/mute |
298 | separate events, but this behaviour may be corrected in | 298 | events are reported by the firmware and can behave |
299 | future releases of this driver, in which case the | 299 | differently (and that behaviour changes with firmware |
300 | ThinkPad volume mixer user interface semantics will be | 300 | version -- not just with firmware models -- as well as |
301 | enforced. | 301 | OSI(Linux) state). |
302 | 302 | ||
303 | hotkey_poll_freq: | 303 | hotkey_poll_freq: |
304 | frequency in Hz for hot key polling. It must be between | 304 | frequency in Hz for hot key polling. It must be between |
@@ -309,7 +309,7 @@ sysfs notes: | |||
309 | will cause hot key presses that require NVRAM polling | 309 | will cause hot key presses that require NVRAM polling |
310 | to never be reported. | 310 | to never be reported. |
311 | 311 | ||
312 | Setting hotkey_poll_freq too low will cause repeated | 312 | Setting hotkey_poll_freq too low may cause repeated |
313 | pressings of the same hot key to be misreported as a | 313 | pressings of the same hot key to be misreported as a |
314 | single key press, or to not even be detected at all. | 314 | single key press, or to not even be detected at all. |
315 | The recommended polling frequency is 10Hz. | 315 | The recommended polling frequency is 10Hz. |
@@ -397,6 +397,7 @@ ACPI Scan | |||
397 | event code Key Notes | 397 | event code Key Notes |
398 | 398 | ||
399 | 0x1001 0x00 FN+F1 - | 399 | 0x1001 0x00 FN+F1 - |
400 | |||
400 | 0x1002 0x01 FN+F2 IBM: battery (rare) | 401 | 0x1002 0x01 FN+F2 IBM: battery (rare) |
401 | Lenovo: Screen lock | 402 | Lenovo: Screen lock |
402 | 403 | ||
@@ -404,7 +405,8 @@ event code Key Notes | |||
404 | this hot key, even with hot keys | 405 | this hot key, even with hot keys |
405 | disabled or with Fn+F3 masked | 406 | disabled or with Fn+F3 masked |
406 | off | 407 | off |
407 | IBM: screen lock | 408 | IBM: screen lock, often turns |
409 | off the ThinkLight as side-effect | ||
408 | Lenovo: battery | 410 | Lenovo: battery |
409 | 411 | ||
410 | 0x1004 0x03 FN+F4 Sleep button (ACPI sleep button | 412 | 0x1004 0x03 FN+F4 Sleep button (ACPI sleep button |
@@ -433,7 +435,8 @@ event code Key Notes | |||
433 | Do you feel lucky today? | 435 | Do you feel lucky today? |
434 | 436 | ||
435 | 0x1008 0x07 FN+F8 IBM: toggle screen expand | 437 | 0x1008 0x07 FN+F8 IBM: toggle screen expand |
436 | Lenovo: configure UltraNav | 438 | Lenovo: configure UltraNav, |
439 | or toggle screen expand | ||
437 | 440 | ||
438 | 0x1009 0x08 FN+F9 - | 441 | 0x1009 0x08 FN+F9 - |
439 | .. .. .. | 442 | .. .. .. |
@@ -444,7 +447,7 @@ event code Key Notes | |||
444 | either through the ACPI event, | 447 | either through the ACPI event, |
445 | or through a hotkey event. | 448 | or through a hotkey event. |
446 | The firmware may refuse to | 449 | The firmware may refuse to |
447 | generate further FN+F4 key | 450 | generate further FN+F12 key |
448 | press events until a S3 or S4 | 451 | press events until a S3 or S4 |
449 | ACPI sleep cycle is performed, | 452 | ACPI sleep cycle is performed, |
450 | or some time passes. | 453 | or some time passes. |
@@ -512,15 +515,19 @@ events for switches: | |||
512 | SW_RFKILL_ALL T60 and later hardware rfkill rocker switch | 515 | SW_RFKILL_ALL T60 and later hardware rfkill rocker switch |
513 | SW_TABLET_MODE Tablet ThinkPads HKEY events 0x5009 and 0x500A | 516 | SW_TABLET_MODE Tablet ThinkPads HKEY events 0x5009 and 0x500A |
514 | 517 | ||
515 | Non hot-key ACPI HKEY event map: | 518 | Non hotkey ACPI HKEY event map: |
519 | ------------------------------- | ||
520 | |||
521 | Events that are not propagated by the driver, except for legacy | ||
522 | compatibility purposes when hotkey_report_mode is set to 1: | ||
523 | |||
516 | 0x5001 Lid closed | 524 | 0x5001 Lid closed |
517 | 0x5002 Lid opened | 525 | 0x5002 Lid opened |
518 | 0x5009 Tablet swivel: switched to tablet mode | 526 | 0x5009 Tablet swivel: switched to tablet mode |
519 | 0x500A Tablet swivel: switched to normal mode | 527 | 0x500A Tablet swivel: switched to normal mode |
520 | 0x7000 Radio Switch may have changed state | 528 | 0x7000 Radio Switch may have changed state |
521 | 529 | ||
522 | The above events are not propagated by the driver, except for legacy | 530 | Events that are never propagated by the driver: |
523 | compatibility purposes when hotkey_report_mode is set to 1. | ||
524 | 531 | ||
525 | 0x2304 System is waking up from suspend to undock | 532 | 0x2304 System is waking up from suspend to undock |
526 | 0x2305 System is waking up from suspend to eject bay | 533 | 0x2305 System is waking up from suspend to eject bay |
@@ -528,14 +535,39 @@ compatibility purposes when hotkey_report_mode is set to 1. | |||
528 | 0x2405 System is waking up from hibernation to eject bay | 535 | 0x2405 System is waking up from hibernation to eject bay |
529 | 0x5010 Brightness level changed/control event | 536 | 0x5010 Brightness level changed/control event |
530 | 537 | ||
531 | The above events are never propagated by the driver. | 538 | Events that are propagated by the driver to userspace: |
532 | 539 | ||
540 | 0x2313 ALARM: System is waking up from suspend because | ||
541 | the battery is nearly empty | ||
542 | 0x2413 ALARM: System is waking up from hibernation because | ||
543 | the battery is nearly empty | ||
533 | 0x3003 Bay ejection (see 0x2x05) complete, can sleep again | 544 | 0x3003 Bay ejection (see 0x2x05) complete, can sleep again |
545 | 0x3006 Bay hotplug request (hint to power up SATA link when | ||
546 | the optical drive tray is ejected) | ||
534 | 0x4003 Undocked (see 0x2x04), can sleep again | 547 | 0x4003 Undocked (see 0x2x04), can sleep again |
535 | 0x500B Tablet pen inserted into its storage bay | 548 | 0x500B Tablet pen inserted into its storage bay |
536 | 0x500C Tablet pen removed from its storage bay | 549 | 0x500C Tablet pen removed from its storage bay |
537 | 550 | 0x6011 ALARM: battery is too hot | |
538 | The above events are propagated by the driver. | 551 | 0x6012 ALARM: battery is extremely hot |
552 | 0x6021 ALARM: a sensor is too hot | ||
553 | 0x6022 ALARM: a sensor is extremely hot | ||
554 | 0x6030 System thermal table changed | ||
555 | |||
556 | Battery nearly empty alarms are a last resort attempt to get the | ||
557 | operating system to hibernate or shutdown cleanly (0x2313), or shutdown | ||
558 | cleanly (0x2413) before power is lost. They must be acted upon, as the | ||
559 | wake up caused by the firmware will have negated most safety nets... | ||
560 | |||
561 | When any of the "too hot" alarms happen, according to Lenovo the user | ||
562 | should suspend or hibernate the laptop (and in the case of battery | ||
563 | alarms, unplug the AC adapter) to let it cool down. These alarms do | ||
564 | signal that something is wrong, they should never happen on normal | ||
565 | operating conditions. | ||
566 | |||
567 | The "extremely hot" alarms are emergencies. According to Lenovo, the | ||
568 | operating system is to force either an immediate suspend or hibernate | ||
569 | cycle, or a system shutdown. Obviously, something is very wrong if this | ||
570 | happens. | ||
539 | 571 | ||
540 | Compatibility notes: | 572 | Compatibility notes: |
541 | 573 | ||
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index 3119f5db75bd..e9ce3c554514 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
@@ -263,7 +263,7 @@ static u8 *get_feature_bits(struct device *dev) | |||
263 | * Launcher virtual with an offset. | 263 | * Launcher virtual with an offset. |
264 | * | 264 | * |
265 | * This can be tough to get your head around, but usually it just means that we | 265 | * This can be tough to get your head around, but usually it just means that we |
266 | * use these trivial conversion functions when the Guest gives us it's | 266 | * use these trivial conversion functions when the Guest gives us its |
267 | * "physical" addresses: | 267 | * "physical" addresses: |
268 | */ | 268 | */ |
269 | static void *from_guest_phys(unsigned long addr) | 269 | static void *from_guest_phys(unsigned long addr) |
diff --git a/Documentation/md.txt b/Documentation/md.txt index 188f4768f1d5..e4e893ef3e01 100644 --- a/Documentation/md.txt +++ b/Documentation/md.txt | |||
@@ -136,7 +136,7 @@ raid_disks != 0. | |||
136 | 136 | ||
137 | Then uninitialized devices can be added with ADD_NEW_DISK. The | 137 | Then uninitialized devices can be added with ADD_NEW_DISK. The |
138 | structure passed to ADD_NEW_DISK must specify the state of the device | 138 | structure passed to ADD_NEW_DISK must specify the state of the device |
139 | and it's role in the array. | 139 | and its role in the array. |
140 | 140 | ||
141 | Once started with RUN_ARRAY, uninitialized spares can be added with | 141 | Once started with RUN_ARRAY, uninitialized spares can be added with |
142 | HOT_ADD_DISK. | 142 | HOT_ADD_DISK. |
diff --git a/Documentation/netlabel/lsm_interface.txt b/Documentation/netlabel/lsm_interface.txt index 98dd9f7430f2..638c74f7de7f 100644 --- a/Documentation/netlabel/lsm_interface.txt +++ b/Documentation/netlabel/lsm_interface.txt | |||
@@ -38,7 +38,7 @@ Depending on the exact configuration, translation between the network packet | |||
38 | label and the internal LSM security identifier can be time consuming. The | 38 | label and the internal LSM security identifier can be time consuming. The |
39 | NetLabel label mapping cache is a caching mechanism which can be used to | 39 | NetLabel label mapping cache is a caching mechanism which can be used to |
40 | sidestep much of this overhead once a mapping has been established. Once the | 40 | sidestep much of this overhead once a mapping has been established. Once the |
41 | LSM has received a packet, used NetLabel to decode it's security attributes, | 41 | LSM has received a packet, used NetLabel to decode its security attributes, |
42 | and translated the security attributes into a LSM internal identifier the LSM | 42 | and translated the security attributes into a LSM internal identifier the LSM |
43 | can use the NetLabel caching functions to associate the LSM internal | 43 | can use the NetLabel caching functions to associate the LSM internal |
44 | identifier with the network packet's label. This means that in the future | 44 | identifier with the network packet's label. This means that in the future |
diff --git a/Documentation/networking/caif/Linux-CAIF.txt b/Documentation/networking/caif/Linux-CAIF.txt new file mode 100644 index 000000000000..7fe7a9a33a4f --- /dev/null +++ b/Documentation/networking/caif/Linux-CAIF.txt | |||
@@ -0,0 +1,212 @@ | |||
1 | Linux CAIF | ||
2 | =========== | ||
3 | copyright (C) ST-Ericsson AB 2010 | ||
4 | Author: Sjur Brendeland/ sjur.brandeland@stericsson.com | ||
5 | License terms: GNU General Public License (GPL) version 2 | ||
6 | |||
7 | |||
8 | Introduction | ||
9 | ------------ | ||
10 | CAIF is a MUX protocol used by ST-Ericsson cellular modems for | ||
11 | communication between Modem and host. The host processes can open virtual AT | ||
12 | channels, initiate GPRS Data connections, Video channels and Utility Channels. | ||
13 | The Utility Channels are general purpose pipes between modem and host. | ||
14 | |||
15 | ST-Ericsson modems support a number of transports between modem | ||
16 | and host. Currently, UART and Loopback are available for Linux. | ||
17 | |||
18 | |||
19 | Architecture: | ||
20 | ------------ | ||
21 | The implementation of CAIF is divided into: | ||
22 | * CAIF Socket Layer, Kernel API, and Net Device. | ||
23 | * CAIF Core Protocol Implementation | ||
24 | * CAIF Link Layer, implemented as NET devices. | ||
25 | |||
26 | |||
27 | RTNL | ||
28 | ! | ||
29 | ! +------+ +------+ +------+ | ||
30 | ! +------+! +------+! +------+! | ||
31 | ! ! Sock !! !Kernel!! ! Net !! | ||
32 | ! ! API !+ ! API !+ ! Dev !+ <- CAIF Client APIs | ||
33 | ! +------+ +------! +------+ | ||
34 | ! ! ! ! | ||
35 | ! +----------!----------+ | ||
36 | ! +------+ <- CAIF Protocol Implementation | ||
37 | +-------> ! CAIF ! | ||
38 | ! Core ! | ||
39 | +------+ | ||
40 | +--------!--------+ | ||
41 | ! ! | ||
42 | +------+ +-----+ | ||
43 | ! ! ! TTY ! <- Link Layer (Net Devices) | ||
44 | +------+ +-----+ | ||
45 | |||
46 | |||
47 | Using the Kernel API | ||
48 | ---------------------- | ||
49 | The Kernel API is used for accessing CAIF channels from the | ||
50 | kernel. | ||
51 | The user of the API has to implement two callbacks for receive | ||
52 | and control. | ||
53 | The receive callback gives a CAIF packet as a SKB. The control | ||
54 | callback will | ||
55 | notify of channel initialization complete, and flow-on/flow- | ||
56 | off. | ||
57 | |||
58 | |||
59 | struct caif_device caif_dev = { | ||
60 | .caif_config = { | ||
61 | .name = "MYDEV" | ||
62 | .type = CAIF_CHTY_AT | ||
63 | } | ||
64 | .receive_cb = my_receive, | ||
65 | .control_cb = my_control, | ||
66 | }; | ||
67 | caif_add_device(&caif_dev); | ||
68 | caif_transmit(&caif_dev, skb); | ||
69 | |||
70 | See the caif_kernel.h for details about the CAIF kernel API. | ||
71 | |||
72 | |||
73 | I M P L E M E N T A T I O N | ||
74 | =========================== | ||
75 | =========================== | ||
76 | |||
77 | CAIF Core Protocol Layer | ||
78 | ========================================= | ||
79 | |||
80 | CAIF Core layer implements the CAIF protocol as defined by ST-Ericsson. | ||
81 | It implements the CAIF protocol stack in a layered approach, where | ||
82 | each layer described in the specification is implemented as a separate layer. | ||
83 | The architecture is inspired by the design patterns "Protocol Layer" and | ||
84 | "Protocol Packet". | ||
85 | |||
86 | == CAIF structure == | ||
87 | The Core CAIF implementation contains: | ||
88 | - Simple implementation of CAIF. | ||
89 | - Layered architecture (a la Streams), each layer in the CAIF | ||
90 | specification is implemented in a separate c-file. | ||
91 | - Clients must implement PHY layer to access physical HW | ||
92 | with receive and transmit functions. | ||
93 | - Clients must call configuration function to add PHY layer. | ||
94 | - Clients must implement CAIF layer to consume/produce | ||
95 | CAIF payload with receive and transmit functions. | ||
96 | - Clients must call configuration function to add and connect the | ||
97 | Client layer. | ||
98 | - When receiving / transmitting CAIF Packets (cfpkt), ownership is passed | ||
99 | to the called function (except for framing layers' receive functions | ||
100 | or if a transmit function returns an error, in which case the caller | ||
101 | must free the packet). | ||
102 | |||
103 | Layered Architecture | ||
104 | -------------------- | ||
105 | The CAIF protocol can be divided into two parts: Support functions and Protocol | ||
106 | Implementation. The support functions include: | ||
107 | |||
108 | - CFPKT CAIF Packet. Implementation of CAIF Protocol Packet. The | ||
109 | CAIF Packet has functions for creating, destroying and adding content | ||
110 | and for adding/extracting header and trailers to protocol packets. | ||
111 | |||
112 | - CFLST CAIF list implementation. | ||
113 | |||
114 | - CFGLUE CAIF Glue. Contains OS Specifics, such as memory | ||
115 | allocation, endianness, etc. | ||
116 | |||
117 | The CAIF Protocol implementation contains: | ||
118 | |||
119 | - CFCNFG CAIF Configuration layer. Configures the CAIF Protocol | ||
120 | Stack and provides a Client interface for adding Link-Layer and | ||
121 | Driver interfaces on top of the CAIF Stack. | ||
122 | |||
123 | - CFCTRL CAIF Control layer. Encodes and Decodes control messages | ||
124 | such as enumeration and channel setup. Also matches request and | ||
125 | response messages. | ||
126 | |||
127 | - CFSERVL General CAIF Service Layer functionality; handles flow | ||
128 | control and remote shutdown requests. | ||
129 | |||
130 | - CFVEI CAIF VEI layer. Handles CAIF AT Channels on VEI (Virtual | ||
131 | External Interface). This layer encodes/decodes VEI frames. | ||
132 | |||
133 | - CFDGML CAIF Datagram layer. Handles CAIF Datagram layer (IP | ||
134 | traffic), encodes/decodes Datagram frames. | ||
135 | |||
136 | - CFMUX CAIF Mux layer. Handles multiplexing between multiple | ||
137 | physical bearers and multiple channels such as VEI, Datagram, etc. | ||
138 | The MUX keeps track of the existing CAIF Channels and | ||
139 | Physical Instances and selects the apropriate instance based | ||
140 | on Channel-Id and Physical-ID. | ||
141 | |||
142 | - CFFRML CAIF Framing layer. Handles Framing i.e. Frame length | ||
143 | and frame checksum. | ||
144 | |||
145 | - CFSERL CAIF Serial layer. Handles concatenation/split of frames | ||
146 | into CAIF Frames with correct length. | ||
147 | |||
148 | |||
149 | |||
150 | +---------+ | ||
151 | | Config | | ||
152 | | CFCNFG | | ||
153 | +---------+ | ||
154 | ! | ||
155 | +---------+ +---------+ +---------+ | ||
156 | | AT | | Control | | Datagram| | ||
157 | | CFVEIL | | CFCTRL | | CFDGML | | ||
158 | +---------+ +---------+ +---------+ | ||
159 | \_____________!______________/ | ||
160 | ! | ||
161 | +---------+ | ||
162 | | MUX | | ||
163 | | | | ||
164 | +---------+ | ||
165 | _____!_____ | ||
166 | / \ | ||
167 | +---------+ +---------+ | ||
168 | | CFFRML | | CFFRML | | ||
169 | | Framing | | Framing | | ||
170 | +---------+ +---------+ | ||
171 | ! ! | ||
172 | +---------+ +---------+ | ||
173 | | | | Serial | | ||
174 | | | | CFSERL | | ||
175 | +---------+ +---------+ | ||
176 | |||
177 | |||
178 | In this layered approach the following "rules" apply. | ||
179 | - All layers embed the same structure "struct cflayer" | ||
180 | - A layer does not depend on any other layer's private data. | ||
181 | - Layers are stacked by setting the pointers | ||
182 | layer->up , layer->dn | ||
183 | - In order to send data upwards, each layer should do | ||
184 | layer->up->receive(layer->up, packet); | ||
185 | - In order to send data downwards, each layer should do | ||
186 | layer->dn->transmit(layer->dn, packet); | ||
187 | |||
188 | |||
189 | Linux Driver Implementation | ||
190 | =========================== | ||
191 | |||
192 | Linux GPRS Net Device and CAIF socket are implemented on top of the | ||
193 | CAIF Core protocol. The Net device and CAIF socket have an instance of | ||
194 | 'struct cflayer', just like the CAIF Core protocol stack. | ||
195 | Net device and Socket implement the 'receive()' function defined by | ||
196 | 'struct cflayer', just like the rest of the CAIF stack. In this way, transmit and | ||
197 | receive of packets is handled as by the rest of the layers: the 'dn->transmit()' | ||
198 | function is called in order to transmit data. | ||
199 | |||
200 | The layer on top of the CAIF Core implementation is | ||
201 | sometimes referred to as the "Client layer". | ||
202 | |||
203 | |||
204 | Configuration of Link Layer | ||
205 | --------------------------- | ||
206 | The Link Layer is implemented as Linux net devices (struct net_device). | ||
207 | Payload handling and registration is done using standard Linux mechanisms. | ||
208 | |||
209 | The CAIF Protocol relies on a loss-less link layer without implementing | ||
210 | retransmission. This implies that packet drops must not happen. | ||
211 | Therefore a flow-control mechanism is implemented where the physical | ||
212 | interface can initiate flow stop for all CAIF Channels. | ||
diff --git a/Documentation/networking/caif/README b/Documentation/networking/caif/README new file mode 100644 index 000000000000..757ccfaa1385 --- /dev/null +++ b/Documentation/networking/caif/README | |||
@@ -0,0 +1,109 @@ | |||
1 | Copyright (C) ST-Ericsson AB 2010 | ||
2 | Author: Sjur Brendeland/ sjur.brandeland@stericsson.com | ||
3 | License terms: GNU General Public License (GPL) version 2 | ||
4 | --------------------------------------------------------- | ||
5 | |||
6 | === Start === | ||
7 | If you have compiled CAIF for modules do: | ||
8 | |||
9 | $modprobe crc_ccitt | ||
10 | $modprobe caif | ||
11 | $modprobe caif_socket | ||
12 | $modprobe chnl_net | ||
13 | |||
14 | |||
15 | === Preparing the setup with a STE modem === | ||
16 | |||
17 | If you are working on integration of CAIF you should make sure | ||
18 | that the kernel is built with module support. | ||
19 | |||
20 | There are some things that need to be tweaked to get the host TTY correctly | ||
21 | set up to talk to the modem. | ||
22 | Since the CAIF stack is running in the kernel and we want to use the existing | ||
23 | TTY, we are installing our physical serial driver as a line discipline above | ||
24 | the TTY device. | ||
25 | |||
26 | To achieve this we need to install the N_CAIF ldisc from user space. | ||
27 | The benefit is that we can hook up to any TTY. | ||
28 | |||
29 | The use of Start-of-frame-extension (STX) must also be set as | ||
30 | module parameter "ser_use_stx". | ||
31 | |||
32 | Normally Frame Checksum is always used on UART, but this is also provided as a | ||
33 | module parameter "ser_use_fcs". | ||
34 | |||
35 | $ modprobe caif_serial ser_ttyname=/dev/ttyS0 ser_use_stx=yes | ||
36 | $ ifconfig caif_ttyS0 up | ||
37 | |||
38 | PLEASE NOTE: There is a limitation in Android shell. | ||
39 | It only accepts one argument to insmod/modprobe! | ||
40 | |||
41 | === Trouble shooting === | ||
42 | |||
43 | There are debugfs parameters provided for serial communication. | ||
44 | /sys/kernel/debug/caif_serial/<tty-name>/ | ||
45 | |||
46 | * ser_state: Prints the bit-mask status where | ||
47 | - 0x02 means SENDING, this is a transient state. | ||
48 | - 0x10 means FLOW_OFF_SENT, i.e. the previous frame has not been sent | ||
49 | and is blocking further send operation. Flow OFF has been propagated | ||
50 | to all CAIF Channels using this TTY. | ||
51 | |||
52 | * tty_status: Prints the bit-mask tty status information | ||
53 | - 0x01 - tty->warned is on. | ||
54 | - 0x02 - tty->low_latency is on. | ||
55 | - 0x04 - tty->packed is on. | ||
56 | - 0x08 - tty->flow_stopped is on. | ||
57 | - 0x10 - tty->hw_stopped is on. | ||
58 | - 0x20 - tty->stopped is on. | ||
59 | |||
60 | * last_tx_msg: Binary blob Prints the last transmitted frame. | ||
61 | This can be printed with | ||
62 | $od --format=x1 /sys/kernel/debug/caif_serial/<tty>/last_rx_msg. | ||
63 | The first two tx messages sent look like this. Note: The initial | ||
64 | byte 02 is start of frame extension (STX) used for re-syncing | ||
65 | upon errors. | ||
66 | |||
67 | - Enumeration: | ||
68 | 0000000 02 05 00 00 03 01 d2 02 | ||
69 | | | | | | | | ||
70 | STX(1) | | | | | ||
71 | Length(2)| | | | ||
72 | Control Channel(1) | ||
73 | Command:Enumeration(1) | ||
74 | Link-ID(1) | ||
75 | Checksum(2) | ||
76 | - Channel Setup: | ||
77 | 0000000 02 07 00 00 00 21 a1 00 48 df | ||
78 | | | | | | | | | | ||
79 | STX(1) | | | | | | | ||
80 | Length(2)| | | | | | ||
81 | Control Channel(1) | ||
82 | Command:Channel Setup(1) | ||
83 | Channel Type(1) | ||
84 | Priority and Link-ID(1) | ||
85 | Endpoint(1) | ||
86 | Checksum(2) | ||
87 | |||
88 | * last_rx_msg: Prints the last transmitted frame. | ||
89 | The RX messages for LinkSetup look almost identical but they have the | ||
90 | bit 0x20 set in the command bit, and Channel Setup has added one byte | ||
91 | before Checksum containing Channel ID. | ||
92 | NOTE: Several CAIF Messages might be concatenated. The maximum debug | ||
93 | buffer size is 128 bytes. | ||
94 | |||
95 | == Error Scenarios: | ||
96 | - last_tx_msg contains channel setup message and last_rx_msg is empty -> | ||
97 | The host seems to be able to send over the UART, at least the CAIF ldisc get | ||
98 | notified that sending is completed. | ||
99 | |||
100 | - last_tx_msg contains enumeration message and last_rx_msg is empty -> | ||
101 | The host is not able to send the message from UART, the tty has not been | ||
102 | able to complete the transmit operation. | ||
103 | |||
104 | - if /sys/kernel/debug/caif_serial/<tty>/tty_status is non-zero there | ||
105 | might be problems transmitting over UART. | ||
106 | E.g. host and modem wiring is not correct you will typically see | ||
107 | tty_status = 0x10 (hw_stopped) and ser_state = 0x10 (FLOW_OFF_SENT). | ||
108 | You will probably see the enumeration message in last_tx_message | ||
109 | and empty last_rx_message. | ||
diff --git a/Documentation/networking/ifenslave.c b/Documentation/networking/ifenslave.c index 1b96ccda3836..2bac9618c345 100644 --- a/Documentation/networking/ifenslave.c +++ b/Documentation/networking/ifenslave.c | |||
@@ -756,7 +756,7 @@ static int enslave(char *master_ifname, char *slave_ifname) | |||
756 | */ | 756 | */ |
757 | if (abi_ver < 1) { | 757 | if (abi_ver < 1) { |
758 | /* For old ABI, the master needs to be | 758 | /* For old ABI, the master needs to be |
759 | * down before setting it's hwaddr | 759 | * down before setting its hwaddr |
760 | */ | 760 | */ |
761 | res = set_if_down(master_ifname, master_flags.ifr_flags); | 761 | res = set_if_down(master_ifname, master_flags.ifr_flags); |
762 | if (res) { | 762 | if (res) { |
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index 8b72c88ba213..d0536b5a4e01 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
@@ -588,6 +588,37 @@ ip_local_port_range - 2 INTEGERS | |||
588 | (i.e. by default) range 1024-4999 is enough to issue up to | 588 | (i.e. by default) range 1024-4999 is enough to issue up to |
589 | 2000 connections per second to systems supporting timestamps. | 589 | 2000 connections per second to systems supporting timestamps. |
590 | 590 | ||
591 | ip_local_reserved_ports - list of comma separated ranges | ||
592 | Specify the ports which are reserved for known third-party | ||
593 | applications. These ports will not be used by automatic port | ||
594 | assignments (e.g. when calling connect() or bind() with port | ||
595 | number 0). Explicit port allocation behavior is unchanged. | ||
596 | |||
597 | The format used for both input and output is a comma separated | ||
598 | list of ranges (e.g. "1,2-4,10-10" for ports 1, 2, 3, 4 and | ||
599 | 10). Writing to the file will clear all previously reserved | ||
600 | ports and update the current list with the one given in the | ||
601 | input. | ||
602 | |||
603 | Note that ip_local_port_range and ip_local_reserved_ports | ||
604 | settings are independent and both are considered by the kernel | ||
605 | when determining which ports are available for automatic port | ||
606 | assignments. | ||
607 | |||
608 | You can reserve ports which are not in the current | ||
609 | ip_local_port_range, e.g.: | ||
610 | |||
611 | $ cat /proc/sys/net/ipv4/ip_local_port_range | ||
612 | 32000 61000 | ||
613 | $ cat /proc/sys/net/ipv4/ip_local_reserved_ports | ||
614 | 8080,9148 | ||
615 | |||
616 | although this is redundant. However such a setting is useful | ||
617 | if later the port range is changed to a value that will | ||
618 | include the reserved ports. | ||
619 | |||
620 | Default: Empty | ||
621 | |||
591 | ip_nonlocal_bind - BOOLEAN | 622 | ip_nonlocal_bind - BOOLEAN |
592 | If set, allows processes to bind() to non-local IP addresses, | 623 | If set, allows processes to bind() to non-local IP addresses, |
593 | which can be quite useful - but may break some applications. | 624 | which can be quite useful - but may break some applications. |
diff --git a/Documentation/networking/l2tp.txt b/Documentation/networking/l2tp.txt index 63214b280e00..e7bf3979facb 100644 --- a/Documentation/networking/l2tp.txt +++ b/Documentation/networking/l2tp.txt | |||
@@ -1,44 +1,95 @@ | |||
1 | This brief document describes how to use the kernel's PPPoL2TP driver | 1 | This document describes how to use the kernel's L2TP drivers to |
2 | to provide L2TP functionality. L2TP is a protocol that tunnels one or | 2 | provide L2TP functionality. L2TP is a protocol that tunnels one or |
3 | more PPP sessions over a UDP tunnel. It is commonly used for VPNs | 3 | more sessions over an IP tunnel. It is commonly used for VPNs |
4 | (L2TP/IPSec) and by ISPs to tunnel subscriber PPP sessions over an IP | 4 | (L2TP/IPSec) and by ISPs to tunnel subscriber PPP sessions over an IP |
5 | network infrastructure. | 5 | network infrastructure. With L2TPv3, it is also useful as a Layer-2 |
6 | tunneling infrastructure. | ||
7 | |||
8 | Features | ||
9 | ======== | ||
10 | |||
11 | L2TPv2 (PPP over L2TP (UDP tunnels)). | ||
12 | L2TPv3 ethernet pseudowires. | ||
13 | L2TPv3 PPP pseudowires. | ||
14 | L2TPv3 IP encapsulation. | ||
15 | Netlink sockets for L2TPv3 configuration management. | ||
16 | |||
17 | History | ||
18 | ======= | ||
19 | |||
20 | The original pppol2tp driver was introduced in 2.6.23 and provided | ||
21 | L2TPv2 functionality (rfc2661). L2TPv2 is used to tunnel one or more PPP | ||
22 | sessions over a UDP tunnel. | ||
23 | |||
24 | L2TPv3 (rfc3931) changes the protocol to allow different frame types | ||
25 | to be passed over an L2TP tunnel by moving the PPP-specific parts of | ||
26 | the protocol out of the core L2TP packet headers. Each frame type is | ||
27 | known as a pseudowire type. Ethernet, PPP, HDLC, Frame Relay and ATM | ||
28 | pseudowires for L2TP are defined in separate RFC standards. Another | ||
29 | change for L2TPv3 is that it can be carried directly over IP with no | ||
30 | UDP header (UDP is optional). It is also possible to create static | ||
31 | unmanaged L2TPv3 tunnels manually without a control protocol | ||
32 | (userspace daemon) to manage them. | ||
33 | |||
34 | To support L2TPv3, the original pppol2tp driver was split up to | ||
35 | separate the L2TP and PPP functionality. Existing L2TPv2 userspace | ||
36 | apps should be unaffected as the original pppol2tp sockets API is | ||
37 | retained. L2TPv3, however, uses netlink to manage L2TPv3 tunnels and | ||
38 | sessions. | ||
6 | 39 | ||
7 | Design | 40 | Design |
8 | ====== | 41 | ====== |
9 | 42 | ||
10 | The PPPoL2TP driver, drivers/net/pppol2tp.c, provides a mechanism by | 43 | The L2TP protocol separates control and data frames. The L2TP kernel |
11 | which PPP frames carried through an L2TP session are passed through | 44 | drivers handle only L2TP data frames; control frames are always |
12 | the kernel's PPP subsystem. The standard PPP daemon, pppd, handles all | 45 | handled by userspace. L2TP control frames carry messages between L2TP |
13 | PPP interaction with the peer. PPP network interfaces are created for | 46 | clients/servers and are used to setup / teardown tunnels and |
14 | each local PPP endpoint. | 47 | sessions. An L2TP client or server is implemented in userspace. |
15 | 48 | ||
16 | The L2TP protocol http://www.faqs.org/rfcs/rfc2661.html defines L2TP | 49 | Each L2TP tunnel is implemented using a UDP or L2TPIP socket; L2TPIP |
17 | control and data frames. L2TP control frames carry messages between | 50 | provides L2TPv3 IP encapsulation (no UDP) and is implemented using a |
18 | L2TP clients/servers and are used to setup / teardown tunnels and | 51 | new l2tpip socket family. The tunnel socket is typically created by |
19 | sessions. An L2TP client or server is implemented in userspace and | 52 | userspace, though for unmanaged L2TPv3 tunnels, the socket can also be |
20 | will use a regular UDP socket per tunnel. L2TP data frames carry PPP | 53 | created by the kernel. Each L2TP session (pseudowire) gets a network |
21 | frames, which may be PPP control or PPP data. The kernel's PPP | 54 | interface instance. In the case of PPP, these interfaces are created |
55 | indirectly by pppd using a pppol2tp socket. In the case of ethernet, | ||
56 | the netdevice is created upon a netlink request to create an L2TPv3 | ||
57 | ethernet pseudowire. | ||
58 | |||
59 | For PPP, the PPPoL2TP driver, net/l2tp/l2tp_ppp.c, provides a | ||
60 | mechanism by which PPP frames carried through an L2TP session are | ||
61 | passed through the kernel's PPP subsystem. The standard PPP daemon, | ||
62 | pppd, handles all PPP interaction with the peer. PPP network | ||
63 | interfaces are created for each local PPP endpoint. The kernel's PPP | ||
22 | subsystem arranges for PPP control frames to be delivered to pppd, | 64 | subsystem arranges for PPP control frames to be delivered to pppd, |
23 | while data frames are forwarded as usual. | 65 | while data frames are forwarded as usual. |
24 | 66 | ||
67 | For ethernet, the L2TPETH driver, net/l2tp/l2tp_eth.c, implements a | ||
68 | netdevice driver, managing virtual ethernet devices, one per | ||
69 | pseudowire. These interfaces can be managed using standard Linux tools | ||
70 | such as "ip" and "ifconfig". If only IP frames are passed over the | ||
71 | tunnel, the interface can be given an IP addresses of itself and its | ||
72 | peer. If non-IP frames are to be passed over the tunnel, the interface | ||
73 | can be added to a bridge using brctl. All L2TP datapath protocol | ||
74 | functions are handled by the L2TP core driver. | ||
75 | |||
25 | Each tunnel and session within a tunnel is assigned a unique tunnel_id | 76 | Each tunnel and session within a tunnel is assigned a unique tunnel_id |
26 | and session_id. These ids are carried in the L2TP header of every | 77 | and session_id. These ids are carried in the L2TP header of every |
27 | control and data packet. The pppol2tp driver uses them to lookup | 78 | control and data packet. (Actually, in L2TPv3, the tunnel_id isn't |
28 | internal tunnel and/or session contexts. Zero tunnel / session ids are | 79 | present in data frames - it is inferred from the IP connection on |
29 | treated specially - zero ids are never assigned to tunnels or sessions | 80 | which the packet was received.) The L2TP driver uses the ids to lookup |
30 | in the network. In the driver, the tunnel context keeps a pointer to | 81 | internal tunnel and/or session contexts to determine how to handle the |
31 | the tunnel UDP socket. The session context keeps a pointer to the | 82 | packet. Zero tunnel / session ids are treated specially - zero ids are |
32 | PPPoL2TP socket, as well as other data that lets the driver interface | 83 | never assigned to tunnels or sessions in the network. In the driver, |
33 | to the kernel PPP subsystem. | 84 | the tunnel context keeps a reference to the tunnel UDP or L2TPIP |
34 | 85 | socket. The session context holds data that lets the driver interface | |
35 | Note that the pppol2tp kernel driver handles only L2TP data frames; | 86 | to the kernel's network frame type subsystems, i.e. PPP, ethernet. |
36 | L2TP control frames are simply passed up to userspace in the UDP | 87 | |
37 | tunnel socket. The kernel handles all datapath aspects of the | 88 | Userspace Programming |
38 | protocol, including data packet resequencing (if enabled). | 89 | ===================== |
39 | 90 | ||
40 | There are a number of requirements on the userspace L2TP daemon in | 91 | For L2TPv2, there are a number of requirements on the userspace L2TP |
41 | order to use the pppol2tp driver. | 92 | daemon in order to use the pppol2tp driver. |
42 | 93 | ||
43 | 1. Use a UDP socket per tunnel. | 94 | 1. Use a UDP socket per tunnel. |
44 | 95 | ||
@@ -86,6 +137,35 @@ In addition to the standard PPP ioctls, a PPPIOCGL2TPSTATS is provided | |||
86 | to retrieve tunnel and session statistics from the kernel using the | 137 | to retrieve tunnel and session statistics from the kernel using the |
87 | PPPoX socket of the appropriate tunnel or session. | 138 | PPPoX socket of the appropriate tunnel or session. |
88 | 139 | ||
140 | For L2TPv3, userspace must use the netlink API defined in | ||
141 | include/linux/l2tp.h to manage tunnel and session contexts. The | ||
142 | general procedure to create a new L2TP tunnel with one session is:- | ||
143 | |||
144 | 1. Open a GENL socket using L2TP_GENL_NAME for configuring the kernel | ||
145 | using netlink. | ||
146 | |||
147 | 2. Create a UDP or L2TPIP socket for the tunnel. | ||
148 | |||
149 | 3. Create a new L2TP tunnel using a L2TP_CMD_TUNNEL_CREATE | ||
150 | request. Set attributes according to desired tunnel parameters, | ||
151 | referencing the UDP or L2TPIP socket created in the previous step. | ||
152 | |||
153 | 4. Create a new L2TP session in the tunnel using a | ||
154 | L2TP_CMD_SESSION_CREATE request. | ||
155 | |||
156 | The tunnel and all of its sessions are closed when the tunnel socket | ||
157 | is closed. The netlink API may also be used to delete sessions and | ||
158 | tunnels. Configuration and status info may be set or read using netlink. | ||
159 | |||
160 | The L2TP driver also supports static (unmanaged) L2TPv3 tunnels. These | ||
161 | are where there is no L2TP control message exchange with the peer to | ||
162 | setup the tunnel; the tunnel is configured manually at each end of the | ||
163 | tunnel. There is no need for an L2TP userspace application in this | ||
164 | case -- the tunnel socket is created by the kernel and configured | ||
165 | using parameters sent in the L2TP_CMD_TUNNEL_CREATE netlink | ||
166 | request. The "ip" utility of iproute2 has commands for managing static | ||
167 | L2TPv3 tunnels; do "ip l2tp help" for more information. | ||
168 | |||
89 | Debugging | 169 | Debugging |
90 | ========= | 170 | ========= |
91 | 171 | ||
@@ -102,6 +182,69 @@ PPPOL2TP_MSG_CONTROL userspace - kernel interface | |||
102 | PPPOL2TP_MSG_SEQ sequence numbers handling | 182 | PPPOL2TP_MSG_SEQ sequence numbers handling |
103 | PPPOL2TP_MSG_DATA data packets | 183 | PPPOL2TP_MSG_DATA data packets |
104 | 184 | ||
185 | If enabled, files under a l2tp debugfs directory can be used to dump | ||
186 | kernel state about L2TP tunnels and sessions. To access it, the | ||
187 | debugfs filesystem must first be mounted. | ||
188 | |||
189 | # mount -t debugfs debugfs /debug | ||
190 | |||
191 | Files under the l2tp directory can then be accessed. | ||
192 | |||
193 | # cat /debug/l2tp/tunnels | ||
194 | |||
195 | The debugfs files should not be used by applications to obtain L2TP | ||
196 | state information because the file format is subject to change. It is | ||
197 | implemented to provide extra debug information to help diagnose | ||
198 | problems.) Users should use the netlink API. | ||
199 | |||
200 | /proc/net/pppol2tp is also provided for backwards compaibility with | ||
201 | the original pppol2tp driver. It lists information about L2TPv2 | ||
202 | tunnels and sessions only. Its use is discouraged. | ||
203 | |||
204 | Unmanaged L2TPv3 Tunnels | ||
205 | ======================== | ||
206 | |||
207 | Some commercial L2TP products support unmanaged L2TPv3 ethernet | ||
208 | tunnels, where there is no L2TP control protocol; tunnels are | ||
209 | configured at each side manually. New commands are available in | ||
210 | iproute2's ip utility to support this. | ||
211 | |||
212 | To create an L2TPv3 ethernet pseudowire between local host 192.168.1.1 | ||
213 | and peer 192.168.1.2, using IP addresses 10.5.1.1 and 10.5.1.2 for the | ||
214 | tunnel endpoints:- | ||
215 | |||
216 | # modprobe l2tp_eth | ||
217 | # modprobe l2tp_netlink | ||
218 | |||
219 | # ip l2tp add tunnel tunnel_id 1 peer_tunnel_id 1 udp_sport 5000 \ | ||
220 | udp_dport 5000 encap udp local 192.168.1.1 remote 192.168.1.2 | ||
221 | # ip l2tp add session tunnel_id 1 session_id 1 peer_session_id 1 | ||
222 | # ifconfig -a | ||
223 | # ip addr add 10.5.1.2/32 peer 10.5.1.1/32 dev l2tpeth0 | ||
224 | # ifconfig l2tpeth0 up | ||
225 | |||
226 | Choose IP addresses to be the address of a local IP interface and that | ||
227 | of the remote system. The IP addresses of the l2tpeth0 interface can be | ||
228 | anything suitable. | ||
229 | |||
230 | Repeat the above at the peer, with ports, tunnel/session ids and IP | ||
231 | addresses reversed. The tunnel and session IDs can be any non-zero | ||
232 | 32-bit number, but the values must be reversed at the peer. | ||
233 | |||
234 | Host 1 Host2 | ||
235 | udp_sport=5000 udp_sport=5001 | ||
236 | udp_dport=5001 udp_dport=5000 | ||
237 | tunnel_id=42 tunnel_id=45 | ||
238 | peer_tunnel_id=45 peer_tunnel_id=42 | ||
239 | session_id=128 session_id=5196755 | ||
240 | peer_session_id=5196755 peer_session_id=128 | ||
241 | |||
242 | When done at both ends of the tunnel, it should be possible to send | ||
243 | data over the network. e.g. | ||
244 | |||
245 | # ping 10.5.1.1 | ||
246 | |||
247 | |||
105 | Sample Userspace Code | 248 | Sample Userspace Code |
106 | ===================== | 249 | ===================== |
107 | 250 | ||
@@ -158,12 +301,48 @@ Sample Userspace Code | |||
158 | } | 301 | } |
159 | return 0; | 302 | return 0; |
160 | 303 | ||
304 | Internal Implementation | ||
305 | ======================= | ||
306 | |||
307 | The driver keeps a struct l2tp_tunnel context per L2TP tunnel and a | ||
308 | struct l2tp_session context for each session. The l2tp_tunnel is | ||
309 | always associated with a UDP or L2TP/IP socket and keeps a list of | ||
310 | sessions in the tunnel. The l2tp_session context keeps kernel state | ||
311 | about the session. It has private data which is used for data specific | ||
312 | to the session type. With L2TPv2, the session always carried PPP | ||
313 | traffic. With L2TPv3, the session can also carry ethernet frames | ||
314 | (ethernet pseudowire) or other data types such as ATM, HDLC or Frame | ||
315 | Relay. | ||
316 | |||
317 | When a tunnel is first opened, the reference count on the socket is | ||
318 | increased using sock_hold(). This ensures that the kernel socket | ||
319 | cannot be removed while L2TP's data structures reference it. | ||
320 | |||
321 | Some L2TP sessions also have a socket (PPP pseudowires) while others | ||
322 | do not (ethernet pseudowires). We can't use the socket reference count | ||
323 | as the reference count for session contexts. The L2TP implementation | ||
324 | therefore has its own internal reference counts on the session | ||
325 | contexts. | ||
326 | |||
327 | To Do | ||
328 | ===== | ||
329 | |||
330 | Add L2TP tunnel switching support. This would route tunneled traffic | ||
331 | from one L2TP tunnel into another. Specified in | ||
332 | http://tools.ietf.org/html/draft-ietf-l2tpext-tunnel-switching-08 | ||
333 | |||
334 | Add L2TPv3 VLAN pseudowire support. | ||
335 | |||
336 | Add L2TPv3 IP pseudowire support. | ||
337 | |||
338 | Add L2TPv3 ATM pseudowire support. | ||
339 | |||
161 | Miscellaneous | 340 | Miscellaneous |
162 | ============ | 341 | ============= |
163 | 342 | ||
164 | The PPPoL2TP driver was developed as part of the OpenL2TP project by | 343 | The L2TP drivers were developed as part of the OpenL2TP project by |
165 | Katalix Systems Ltd. OpenL2TP is a full-featured L2TP client / server, | 344 | Katalix Systems Ltd. OpenL2TP is a full-featured L2TP client / server, |
166 | designed from the ground up to have the L2TP datapath in the | 345 | designed from the ground up to have the L2TP datapath in the |
167 | kernel. The project also implemented the pppol2tp plugin for pppd | 346 | kernel. The project also implemented the pppol2tp plugin for pppd |
168 | which allows pppd to use the kernel driver. Details can be found at | 347 | which allows pppd to use the kernel driver. Details can be found at |
169 | http://openl2tp.sourceforge.net. | 348 | http://www.openl2tp.org. |
diff --git a/Documentation/networking/packet_mmap.txt b/Documentation/networking/packet_mmap.txt index 09ab0d290326..98f71a5cef00 100644 --- a/Documentation/networking/packet_mmap.txt +++ b/Documentation/networking/packet_mmap.txt | |||
@@ -100,7 +100,7 @@ by the kernel. | |||
100 | The destruction of the socket and all associated resources | 100 | The destruction of the socket and all associated resources |
101 | is done by a simple call to close(fd). | 101 | is done by a simple call to close(fd). |
102 | 102 | ||
103 | Next I will describe PACKET_MMAP settings and it's constraints, | 103 | Next I will describe PACKET_MMAP settings and its constraints, |
104 | also the mapping of the circular buffer in the user process and | 104 | also the mapping of the circular buffer in the user process and |
105 | the use of this buffer. | 105 | the use of this buffer. |
106 | 106 | ||
@@ -432,7 +432,7 @@ TP_STATUS_LOSING : indicates there were packet drops from last time | |||
432 | the PACKET_STATISTICS option. | 432 | the PACKET_STATISTICS option. |
433 | 433 | ||
434 | TP_STATUS_CSUMNOTREADY: currently it's used for outgoing IP packets which | 434 | TP_STATUS_CSUMNOTREADY: currently it's used for outgoing IP packets which |
435 | it's checksum will be done in hardware. So while | 435 | its checksum will be done in hardware. So while |
436 | reading the packet we should not try to check the | 436 | reading the packet we should not try to check the |
437 | checksum. | 437 | checksum. |
438 | 438 | ||
diff --git a/Documentation/networking/stmmac.txt b/Documentation/networking/stmmac.txt new file mode 100644 index 000000000000..7ee770b5ef5f --- /dev/null +++ b/Documentation/networking/stmmac.txt | |||
@@ -0,0 +1,143 @@ | |||
1 | STMicroelectronics 10/100/1000 Synopsys Ethernet driver | ||
2 | |||
3 | Copyright (C) 2007-2010 STMicroelectronics Ltd | ||
4 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
5 | |||
6 | This is the driver for the MAC 10/100/1000 on-chip Ethernet controllers | ||
7 | (Synopsys IP blocks); it has been fully tested on STLinux platforms. | ||
8 | |||
9 | Currently this network device driver is for all STM embedded MAC/GMAC | ||
10 | (7xxx SoCs). | ||
11 | |||
12 | DWC Ether MAC 10/100/1000 Universal version 3.41a and DWC Ether MAC 10/100 | ||
13 | Universal version 4.0 have been used for developing the first code | ||
14 | implementation. | ||
15 | |||
16 | Please, for more information also visit: www.stlinux.com | ||
17 | |||
18 | 1) Kernel Configuration | ||
19 | The kernel configuration option is STMMAC_ETH: | ||
20 | Device Drivers ---> Network device support ---> Ethernet (1000 Mbit) ---> | ||
21 | STMicroelectronics 10/100/1000 Ethernet driver (STMMAC_ETH) | ||
22 | |||
23 | 2) Driver parameters list: | ||
24 | debug: message level (0: no output, 16: all); | ||
25 | phyaddr: to manually provide the physical address to the PHY device; | ||
26 | dma_rxsize: DMA rx ring size; | ||
27 | dma_txsize: DMA tx ring size; | ||
28 | buf_sz: DMA buffer size; | ||
29 | tc: control the HW FIFO threshold; | ||
30 | tx_coe: Enable/Disable Tx Checksum Offload engine; | ||
31 | watchdog: transmit timeout (in milliseconds); | ||
32 | flow_ctrl: Flow control ability [on/off]; | ||
33 | pause: Flow Control Pause Time; | ||
34 | tmrate: timer period (only if timer optimisation is configured). | ||
35 | |||
36 | 3) Command line options | ||
37 | Driver parameters can be also passed in command line by using: | ||
38 | stmmaceth=dma_rxsize:128,dma_txsize:512 | ||
39 | |||
40 | 4) Driver information and notes | ||
41 | |||
42 | 4.1) Transmit process | ||
43 | The xmit method is invoked when the kernel needs to transmit a packet; it sets | ||
44 | the descriptors in the ring and informs the DMA engine that there is a packet | ||
45 | ready to be transmitted. | ||
46 | Once the controller has finished transmitting the packet, an interrupt is | ||
47 | triggered; So the driver will be able to release the socket buffers. | ||
48 | By default, the driver sets the NETIF_F_SG bit in the features field of the | ||
49 | net_device structure enabling the scatter/gather feature. | ||
50 | |||
51 | 4.2) Receive process | ||
52 | When one or more packets are received, an interrupt happens. The interrupts | ||
53 | are not queued so the driver has to scan all the descriptors in the ring during | ||
54 | the receive process. | ||
55 | This is based on NAPI so the interrupt handler signals only if there is work to be | ||
56 | done, and it exits. | ||
57 | Then the poll method will be scheduled at some future point. | ||
58 | The incoming packets are stored, by the DMA, in a list of pre-allocated socket | ||
59 | buffers in order to avoid the memcpy (Zero-copy). | ||
60 | |||
61 | 4.3) Timer-Driver Interrupt | ||
62 | Instead of having the device that asynchronously notifies the frame receptions, the | ||
63 | driver configures a timer to generate an interrupt at regular intervals. | ||
64 | Based on the granularity of the timer, the frames that are received by the device | ||
65 | will experience different levels of latency. Some NICs have dedicated timer | ||
66 | device to perform this task. STMMAC can use either the RTC device or the TMU | ||
67 | channel 2 on STLinux platforms. | ||
68 | The timers frequency can be passed to the driver as parameter; when change it, | ||
69 | take care of both hardware capability and network stability/performance impact. | ||
70 | Several performance tests on STM platforms showed this optimisation allows to spare | ||
71 | the CPU while having the maximum throughput. | ||
72 | |||
73 | 4.4) WOL | ||
74 | Wake up on Lan feature through Magic Frame is only supported for the GMAC | ||
75 | core. | ||
76 | |||
77 | 4.5) DMA descriptors | ||
78 | Driver handles both normal and enhanced descriptors. The latter has been only | ||
79 | tested on DWC Ether MAC 10/100/1000 Universal version 3.41a. | ||
80 | |||
81 | 4.6) Ethtool support | ||
82 | Ethtool is supported. Driver statistics and internal errors can be taken using: | ||
83 | ethtool -S ethX command. It is possible to dump registers etc. | ||
84 | |||
85 | 4.7) Jumbo and Segmentation Offloading | ||
86 | Jumbo frames are supported and tested for the GMAC. | ||
87 | The GSO has been also added but it's performed in software. | ||
88 | LRO is not supported. | ||
89 | |||
90 | 4.8) Physical | ||
91 | The driver is compatible with PAL to work with PHY and GPHY devices. | ||
92 | |||
93 | 4.9) Platform information | ||
94 | Several information came from the platform; please refer to the | ||
95 | driver's Header file in include/linux directory. | ||
96 | |||
97 | struct plat_stmmacenet_data { | ||
98 | int bus_id; | ||
99 | int pbl; | ||
100 | int has_gmac; | ||
101 | void (*fix_mac_speed)(void *priv, unsigned int speed); | ||
102 | void (*bus_setup)(unsigned long ioaddr); | ||
103 | #ifdef CONFIG_STM_DRIVERS | ||
104 | struct stm_pad_config *pad_config; | ||
105 | #endif | ||
106 | void *bsp_priv; | ||
107 | }; | ||
108 | |||
109 | Where: | ||
110 | - pbl (Programmable Burst Length) is maximum number of | ||
111 | beats to be transferred in one DMA transaction. | ||
112 | GMAC also enables the 4xPBL by default. | ||
113 | - fix_mac_speed and bus_setup are used to configure internal target | ||
114 | registers (on STM platforms); | ||
115 | - has_gmac: GMAC core is on board (get it at run-time in the next step); | ||
116 | - bus_id: bus identifier. | ||
117 | |||
118 | struct plat_stmmacphy_data { | ||
119 | int bus_id; | ||
120 | int phy_addr; | ||
121 | unsigned int phy_mask; | ||
122 | int interface; | ||
123 | int (*phy_reset)(void *priv); | ||
124 | void *priv; | ||
125 | }; | ||
126 | |||
127 | Where: | ||
128 | - bus_id: bus identifier; | ||
129 | - phy_addr: physical address used for the attached phy device; | ||
130 | set it to -1 to get it at run-time; | ||
131 | - interface: physical MII interface mode; | ||
132 | - phy_reset: hook to reset HW function. | ||
133 | |||
134 | TODO: | ||
135 | - Continue to make the driver more generic and suitable for other Synopsys | ||
136 | Ethernet controllers used on other architectures (i.e. ARM). | ||
137 | - 10G controllers are not supported. | ||
138 | - MAC uses Normal descriptors and GMAC uses enhanced ones. | ||
139 | This is a limit that should be reviewed. MAC could want to | ||
140 | use the enhanced structure. | ||
141 | - Checksumming: Rx/Tx csum is done in HW in case of GMAC only. | ||
142 | - Review the timer optimisation code to use an embedded device that seems to be | ||
143 | available in new chip generations. | ||
diff --git a/Documentation/networking/timestamping.txt b/Documentation/networking/timestamping.txt index 0e58b4539176..e8c8f4f06c67 100644 --- a/Documentation/networking/timestamping.txt +++ b/Documentation/networking/timestamping.txt | |||
@@ -41,11 +41,12 @@ SOF_TIMESTAMPING_SOFTWARE: return system time stamp generated in | |||
41 | SOF_TIMESTAMPING_TX/RX determine how time stamps are generated. | 41 | SOF_TIMESTAMPING_TX/RX determine how time stamps are generated. |
42 | SOF_TIMESTAMPING_RAW/SYS determine how they are reported in the | 42 | SOF_TIMESTAMPING_RAW/SYS determine how they are reported in the |
43 | following control message: | 43 | following control message: |
44 | struct scm_timestamping { | 44 | |
45 | struct timespec systime; | 45 | struct scm_timestamping { |
46 | struct timespec hwtimetrans; | 46 | struct timespec systime; |
47 | struct timespec hwtimeraw; | 47 | struct timespec hwtimetrans; |
48 | }; | 48 | struct timespec hwtimeraw; |
49 | }; | ||
49 | 50 | ||
50 | recvmsg() can be used to get this control message for regular incoming | 51 | recvmsg() can be used to get this control message for regular incoming |
51 | packets. For send time stamps the outgoing packet is looped back to | 52 | packets. For send time stamps the outgoing packet is looped back to |
@@ -87,12 +88,13 @@ by the network device and will be empty without that support. | |||
87 | SIOCSHWTSTAMP: | 88 | SIOCSHWTSTAMP: |
88 | 89 | ||
89 | Hardware time stamping must also be initialized for each device driver | 90 | Hardware time stamping must also be initialized for each device driver |
90 | that is expected to do hardware time stamping. The parameter is: | 91 | that is expected to do hardware time stamping. The parameter is defined in |
92 | /include/linux/net_tstamp.h as: | ||
91 | 93 | ||
92 | struct hwtstamp_config { | 94 | struct hwtstamp_config { |
93 | int flags; /* no flags defined right now, must be zero */ | 95 | int flags; /* no flags defined right now, must be zero */ |
94 | int tx_type; /* HWTSTAMP_TX_* */ | 96 | int tx_type; /* HWTSTAMP_TX_* */ |
95 | int rx_filter; /* HWTSTAMP_FILTER_* */ | 97 | int rx_filter; /* HWTSTAMP_FILTER_* */ |
96 | }; | 98 | }; |
97 | 99 | ||
98 | Desired behavior is passed into the kernel and to a specific device by | 100 | Desired behavior is passed into the kernel and to a specific device by |
@@ -139,42 +141,56 @@ enum { | |||
139 | /* time stamp any incoming packet */ | 141 | /* time stamp any incoming packet */ |
140 | HWTSTAMP_FILTER_ALL, | 142 | HWTSTAMP_FILTER_ALL, |
141 | 143 | ||
142 | /* return value: time stamp all packets requested plus some others */ | 144 | /* return value: time stamp all packets requested plus some others */ |
143 | HWTSTAMP_FILTER_SOME, | 145 | HWTSTAMP_FILTER_SOME, |
144 | 146 | ||
145 | /* PTP v1, UDP, any kind of event packet */ | 147 | /* PTP v1, UDP, any kind of event packet */ |
146 | HWTSTAMP_FILTER_PTP_V1_L4_EVENT, | 148 | HWTSTAMP_FILTER_PTP_V1_L4_EVENT, |
147 | 149 | ||
148 | ... | 150 | /* for the complete list of values, please check |
151 | * the include file /include/linux/net_tstamp.h | ||
152 | */ | ||
149 | }; | 153 | }; |
150 | 154 | ||
151 | 155 | ||
152 | DEVICE IMPLEMENTATION | 156 | DEVICE IMPLEMENTATION |
153 | 157 | ||
154 | A driver which supports hardware time stamping must support the | 158 | A driver which supports hardware time stamping must support the |
155 | SIOCSHWTSTAMP ioctl. Time stamps for received packets must be stored | 159 | SIOCSHWTSTAMP ioctl and update the supplied struct hwtstamp_config with |
156 | in the skb with skb_hwtstamp_set(). | 160 | the actual values as described in the section on SIOCSHWTSTAMP. |
161 | |||
162 | Time stamps for received packets must be stored in the skb. To get a pointer | ||
163 | to the shared time stamp structure of the skb call skb_hwtstamps(). Then | ||
164 | set the time stamps in the structure: | ||
165 | |||
166 | struct skb_shared_hwtstamps { | ||
167 | /* hardware time stamp transformed into duration | ||
168 | * since arbitrary point in time | ||
169 | */ | ||
170 | ktime_t hwtstamp; | ||
171 | ktime_t syststamp; /* hwtstamp transformed to system time base */ | ||
172 | }; | ||
157 | 173 | ||
158 | Time stamps for outgoing packets are to be generated as follows: | 174 | Time stamps for outgoing packets are to be generated as follows: |
159 | - In hard_start_xmit(), check if skb_hwtstamp_check_tx_hardware() | 175 | - In hard_start_xmit(), check if skb_tx(skb)->hardware is set no-zero. |
160 | returns non-zero. If yes, then the driver is expected | 176 | If yes, then the driver is expected to do hardware time stamping. |
161 | to do hardware time stamping. | ||
162 | - If this is possible for the skb and requested, then declare | 177 | - If this is possible for the skb and requested, then declare |
163 | that the driver is doing the time stamping by calling | 178 | that the driver is doing the time stamping by setting the field |
164 | skb_hwtstamp_tx_in_progress(). A driver not supporting | 179 | skb_tx(skb)->in_progress non-zero. You might want to keep a pointer |
165 | hardware time stamping doesn't do that. A driver must never | 180 | to the associated skb for the next step and not free the skb. A driver |
166 | touch sk_buff::tstamp! It is used to store how time stamping | 181 | not supporting hardware time stamping doesn't do that. A driver must |
167 | for an outgoing packets is to be done. | 182 | never touch sk_buff::tstamp! It is used to store software generated |
183 | time stamps by the network subsystem. | ||
168 | - As soon as the driver has sent the packet and/or obtained a | 184 | - As soon as the driver has sent the packet and/or obtained a |
169 | hardware time stamp for it, it passes the time stamp back by | 185 | hardware time stamp for it, it passes the time stamp back by |
170 | calling skb_hwtstamp_tx() with the original skb, the raw | 186 | calling skb_hwtstamp_tx() with the original skb, the raw |
171 | hardware time stamp and a handle to the device (necessary | 187 | hardware time stamp. skb_hwtstamp_tx() clones the original skb and |
172 | to convert the hardware time stamp to system time). If obtaining | 188 | adds the timestamps, therefore the original skb has to be freed now. |
173 | the hardware time stamp somehow fails, then the driver should | 189 | If obtaining the hardware time stamp somehow fails, then the driver |
174 | not fall back to software time stamping. The rationale is that | 190 | should not fall back to software time stamping. The rationale is that |
175 | this would occur at a later time in the processing pipeline | 191 | this would occur at a later time in the processing pipeline than other |
176 | than other software time stamping and therefore could lead | 192 | software time stamping and therefore could lead to unexpected deltas |
177 | to unexpected deltas between time stamps. | 193 | between time stamps. |
178 | - If the driver did not call skb_hwtstamp_tx_in_progress(), then | 194 | - If the driver did not call set skb_tx(skb)->in_progress, then |
179 | dev_hard_start_xmit() checks whether software time stamping | 195 | dev_hard_start_xmit() checks whether software time stamping |
180 | is wanted as fallback and potentially generates the time stamp. | 196 | is wanted as fallback and potentially generates the time stamp. |
diff --git a/Documentation/networking/x25-iface.txt b/Documentation/networking/x25-iface.txt index 975cc87ebdd1..78f662ee0622 100644 --- a/Documentation/networking/x25-iface.txt +++ b/Documentation/networking/x25-iface.txt | |||
@@ -20,23 +20,23 @@ the rest of the skbuff, if any more information does exist. | |||
20 | Packet Layer to Device Driver | 20 | Packet Layer to Device Driver |
21 | ----------------------------- | 21 | ----------------------------- |
22 | 22 | ||
23 | First Byte = 0x00 | 23 | First Byte = 0x00 (X25_IFACE_DATA) |
24 | 24 | ||
25 | This indicates that the rest of the skbuff contains data to be transmitted | 25 | This indicates that the rest of the skbuff contains data to be transmitted |
26 | over the LAPB link. The LAPB link should already exist before any data is | 26 | over the LAPB link. The LAPB link should already exist before any data is |
27 | passed down. | 27 | passed down. |
28 | 28 | ||
29 | First Byte = 0x01 | 29 | First Byte = 0x01 (X25_IFACE_CONNECT) |
30 | 30 | ||
31 | Establish the LAPB link. If the link is already established then the connect | 31 | Establish the LAPB link. If the link is already established then the connect |
32 | confirmation message should be returned as soon as possible. | 32 | confirmation message should be returned as soon as possible. |
33 | 33 | ||
34 | First Byte = 0x02 | 34 | First Byte = 0x02 (X25_IFACE_DISCONNECT) |
35 | 35 | ||
36 | Terminate the LAPB link. If it is already disconnected then the disconnect | 36 | Terminate the LAPB link. If it is already disconnected then the disconnect |
37 | confirmation message should be returned as soon as possible. | 37 | confirmation message should be returned as soon as possible. |
38 | 38 | ||
39 | First Byte = 0x03 | 39 | First Byte = 0x03 (X25_IFACE_PARAMS) |
40 | 40 | ||
41 | LAPB parameters. To be defined. | 41 | LAPB parameters. To be defined. |
42 | 42 | ||
@@ -44,22 +44,22 @@ LAPB parameters. To be defined. | |||
44 | Device Driver to Packet Layer | 44 | Device Driver to Packet Layer |
45 | ----------------------------- | 45 | ----------------------------- |
46 | 46 | ||
47 | First Byte = 0x00 | 47 | First Byte = 0x00 (X25_IFACE_DATA) |
48 | 48 | ||
49 | This indicates that the rest of the skbuff contains data that has been | 49 | This indicates that the rest of the skbuff contains data that has been |
50 | received over the LAPB link. | 50 | received over the LAPB link. |
51 | 51 | ||
52 | First Byte = 0x01 | 52 | First Byte = 0x01 (X25_IFACE_CONNECT) |
53 | 53 | ||
54 | LAPB link has been established. The same message is used for both a LAPB | 54 | LAPB link has been established. The same message is used for both a LAPB |
55 | link connect_confirmation and a connect_indication. | 55 | link connect_confirmation and a connect_indication. |
56 | 56 | ||
57 | First Byte = 0x02 | 57 | First Byte = 0x02 (X25_IFACE_DISCONNECT) |
58 | 58 | ||
59 | LAPB link has been terminated. This same message is used for both a LAPB | 59 | LAPB link has been terminated. This same message is used for both a LAPB |
60 | link disconnect_confirmation and a disconnect_indication. | 60 | link disconnect_confirmation and a disconnect_indication. |
61 | 61 | ||
62 | First Byte = 0x03 | 62 | First Byte = 0x03 (X25_IFACE_PARAMS) |
63 | 63 | ||
64 | LAPB parameters. To be defined. | 64 | LAPB parameters. To be defined. |
65 | 65 | ||
diff --git a/Documentation/oops-tracing.txt b/Documentation/oops-tracing.txt index c10c022b911c..6fe9001b9263 100644 --- a/Documentation/oops-tracing.txt +++ b/Documentation/oops-tracing.txt | |||
@@ -256,9 +256,13 @@ characters, each representing a particular tainted value. | |||
256 | 9: 'A' if the ACPI table has been overridden. | 256 | 9: 'A' if the ACPI table has been overridden. |
257 | 257 | ||
258 | 10: 'W' if a warning has previously been issued by the kernel. | 258 | 10: 'W' if a warning has previously been issued by the kernel. |
259 | (Though some warnings may set more specific taint flags.) | ||
259 | 260 | ||
260 | 11: 'C' if a staging driver has been loaded. | 261 | 11: 'C' if a staging driver has been loaded. |
261 | 262 | ||
263 | 12: 'I' if the kernel is working around a severe bug in the platform | ||
264 | firmware (BIOS or similar). | ||
265 | |||
262 | The primary reason for the 'Tainted: ' string is to tell kernel | 266 | The primary reason for the 'Tainted: ' string is to tell kernel |
263 | debuggers if this is a clean kernel or if anything unusual has | 267 | debuggers if this is a clean kernel or if anything unusual has |
264 | occurred. Tainting is permanent: even if an offending module is | 268 | occurred. Tainting is permanent: even if an offending module is |
diff --git a/Documentation/padata.txt b/Documentation/padata.txt new file mode 100644 index 000000000000..269d7d0d8335 --- /dev/null +++ b/Documentation/padata.txt | |||
@@ -0,0 +1,107 @@ | |||
1 | The padata parallel execution mechanism | ||
2 | Last updated for 2.6.34 | ||
3 | |||
4 | Padata is a mechanism by which the kernel can farm work out to be done in | ||
5 | parallel on multiple CPUs while retaining the ordering of tasks. It was | ||
6 | developed for use with the IPsec code, which needs to be able to perform | ||
7 | encryption and decryption on large numbers of packets without reordering | ||
8 | those packets. The crypto developers made a point of writing padata in a | ||
9 | sufficiently general fashion that it could be put to other uses as well. | ||
10 | |||
11 | The first step in using padata is to set up a padata_instance structure for | ||
12 | overall control of how tasks are to be run: | ||
13 | |||
14 | #include <linux/padata.h> | ||
15 | |||
16 | struct padata_instance *padata_alloc(const struct cpumask *cpumask, | ||
17 | struct workqueue_struct *wq); | ||
18 | |||
19 | The cpumask describes which processors will be used to execute work | ||
20 | submitted to this instance. The workqueue wq is where the work will | ||
21 | actually be done; it should be a multithreaded queue, naturally. | ||
22 | |||
23 | There are functions for enabling and disabling the instance: | ||
24 | |||
25 | void padata_start(struct padata_instance *pinst); | ||
26 | void padata_stop(struct padata_instance *pinst); | ||
27 | |||
28 | These functions literally do nothing beyond setting or clearing the | ||
29 | "padata_start() was called" flag; if that flag is not set, other functions | ||
30 | will refuse to work. | ||
31 | |||
32 | The list of CPUs to be used can be adjusted with these functions: | ||
33 | |||
34 | int padata_set_cpumask(struct padata_instance *pinst, | ||
35 | cpumask_var_t cpumask); | ||
36 | int padata_add_cpu(struct padata_instance *pinst, int cpu); | ||
37 | int padata_remove_cpu(struct padata_instance *pinst, int cpu); | ||
38 | |||
39 | Changing the CPU mask has the look of an expensive operation, though, so it | ||
40 | probably should not be done with great frequency. | ||
41 | |||
42 | Actually submitting work to the padata instance requires the creation of a | ||
43 | padata_priv structure: | ||
44 | |||
45 | struct padata_priv { | ||
46 | /* Other stuff here... */ | ||
47 | void (*parallel)(struct padata_priv *padata); | ||
48 | void (*serial)(struct padata_priv *padata); | ||
49 | }; | ||
50 | |||
51 | This structure will almost certainly be embedded within some larger | ||
52 | structure specific to the work to be done. Most its fields are private to | ||
53 | padata, but the structure should be zeroed at initialization time, and the | ||
54 | parallel() and serial() functions should be provided. Those functions will | ||
55 | be called in the process of getting the work done as we will see | ||
56 | momentarily. | ||
57 | |||
58 | The submission of work is done with: | ||
59 | |||
60 | int padata_do_parallel(struct padata_instance *pinst, | ||
61 | struct padata_priv *padata, int cb_cpu); | ||
62 | |||
63 | The pinst and padata structures must be set up as described above; cb_cpu | ||
64 | specifies which CPU will be used for the final callback when the work is | ||
65 | done; it must be in the current instance's CPU mask. The return value from | ||
66 | padata_do_parallel() is a little strange; zero is an error return | ||
67 | indicating that the caller forgot the padata_start() formalities. -EBUSY | ||
68 | means that somebody, somewhere else is messing with the instance's CPU | ||
69 | mask, while -EINVAL is a complaint about cb_cpu not being in that CPU mask. | ||
70 | If all goes well, this function will return -EINPROGRESS, indicating that | ||
71 | the work is in progress. | ||
72 | |||
73 | Each task submitted to padata_do_parallel() will, in turn, be passed to | ||
74 | exactly one call to the above-mentioned parallel() function, on one CPU, so | ||
75 | true parallelism is achieved by submitting multiple tasks. Despite the | ||
76 | fact that the workqueue is used to make these calls, parallel() is run with | ||
77 | software interrupts disabled and thus cannot sleep. The parallel() | ||
78 | function gets the padata_priv structure pointer as its lone parameter; | ||
79 | information about the actual work to be done is probably obtained by using | ||
80 | container_of() to find the enclosing structure. | ||
81 | |||
82 | Note that parallel() has no return value; the padata subsystem assumes that | ||
83 | parallel() will take responsibility for the task from this point. The work | ||
84 | need not be completed during this call, but, if parallel() leaves work | ||
85 | outstanding, it should be prepared to be called again with a new job before | ||
86 | the previous one completes. When a task does complete, parallel() (or | ||
87 | whatever function actually finishes the job) should inform padata of the | ||
88 | fact with a call to: | ||
89 | |||
90 | void padata_do_serial(struct padata_priv *padata); | ||
91 | |||
92 | At some point in the future, padata_do_serial() will trigger a call to the | ||
93 | serial() function in the padata_priv structure. That call will happen on | ||
94 | the CPU requested in the initial call to padata_do_parallel(); it, too, is | ||
95 | done through the workqueue, but with local software interrupts disabled. | ||
96 | Note that this call may be deferred for a while since the padata code takes | ||
97 | pains to ensure that tasks are completed in the order in which they were | ||
98 | submitted. | ||
99 | |||
100 | The one remaining function in the padata API should be called to clean up | ||
101 | when a padata instance is no longer needed: | ||
102 | |||
103 | void padata_free(struct padata_instance *pinst); | ||
104 | |||
105 | This function will busy-wait while any remaining tasks are completed, so it | ||
106 | might be best not to call it while there is work outstanding. Shutting | ||
107 | down the workqueue, if necessary, should be done separately. | ||
diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt index 446f43b309df..61bc4e943116 100644 --- a/Documentation/pcmcia/driver-changes.txt +++ b/Documentation/pcmcia/driver-changes.txt | |||
@@ -1,4 +1,17 @@ | |||
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 | * No dev_node_t (as of 2.6.35) | ||
3 | There is no more need to fill out a "dev_node_t" structure. | ||
4 | |||
5 | * New IRQ request rules (as of 2.6.35) | ||
6 | Instead of the old pcmcia_request_irq() interface, drivers may now | ||
7 | choose between: | ||
8 | - calling request_irq/free_irq directly. Use the IRQ from *p_dev->irq. | ||
9 | - use pcmcia_request_irq(p_dev, handler_t); the PCMCIA core will | ||
10 | clean up automatically on calls to pcmcia_disable_device() or | ||
11 | device ejection. | ||
12 | - drivers still not capable of IRQF_SHARED (or not telling us so) may | ||
13 | use the deprecated pcmcia_request_exclusive_irq() for the time | ||
14 | being; they might receive a shared IRQ nonetheless. | ||
2 | 15 | ||
3 | * no cs_error / CS_CHECK / CONFIG_PCMCIA_DEBUG (as of 2.6.33) | 16 | * no cs_error / CS_CHECK / CONFIG_PCMCIA_DEBUG (as of 2.6.33) |
4 | Instead of the cs_error() callback or the CS_CHECK() macro, please use | 17 | Instead of the cs_error() callback or the CS_CHECK() macro, please use |
diff --git a/Documentation/power/devices.txt b/Documentation/power/devices.txt index c9abbd86bc18..57080cd74575 100644 --- a/Documentation/power/devices.txt +++ b/Documentation/power/devices.txt | |||
@@ -1,7 +1,13 @@ | |||
1 | Device Power Management | ||
2 | |||
3 | Copyright (c) 2010 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. | ||
4 | Copyright (c) 2010 Alan Stern <stern@rowland.harvard.edu> | ||
5 | |||
6 | |||
1 | Most of the code in Linux is device drivers, so most of the Linux power | 7 | Most of the code in Linux is device drivers, so most of the Linux power |
2 | management code is also driver-specific. Most drivers will do very little; | 8 | management (PM) code is also driver-specific. Most drivers will do very |
3 | others, especially for platforms with small batteries (like cell phones), | 9 | little; others, especially for platforms with small batteries (like cell |
4 | will do a lot. | 10 | phones), will do a lot. |
5 | 11 | ||
6 | This writeup gives an overview of how drivers interact with system-wide | 12 | This writeup gives an overview of how drivers interact with system-wide |
7 | power management goals, emphasizing the models and interfaces that are | 13 | power management goals, emphasizing the models and interfaces that are |
@@ -15,9 +21,10 @@ Drivers will use one or both of these models to put devices into low-power | |||
15 | states: | 21 | states: |
16 | 22 | ||
17 | System Sleep model: | 23 | System Sleep model: |
18 | Drivers can enter low power states as part of entering system-wide | 24 | Drivers can enter low-power states as part of entering system-wide |
19 | low-power states like "suspend-to-ram", or (mostly for systems with | 25 | low-power states like "suspend" (also known as "suspend-to-RAM"), or |
20 | disks) "hibernate" (suspend-to-disk). | 26 | (mostly for systems with disks) "hibernation" (also known as |
27 | "suspend-to-disk"). | ||
21 | 28 | ||
22 | This is something that device, bus, and class drivers collaborate on | 29 | This is something that device, bus, and class drivers collaborate on |
23 | by implementing various role-specific suspend and resume methods to | 30 | by implementing various role-specific suspend and resume methods to |
@@ -25,33 +32,41 @@ states: | |||
25 | them without loss of data. | 32 | them without loss of data. |
26 | 33 | ||
27 | Some drivers can manage hardware wakeup events, which make the system | 34 | Some drivers can manage hardware wakeup events, which make the system |
28 | leave that low-power state. This feature may be disabled using the | 35 | leave the low-power state. This feature may be enabled or disabled |
29 | relevant /sys/devices/.../power/wakeup file; enabling it may cost some | 36 | using the relevant /sys/devices/.../power/wakeup file (for Ethernet |
30 | power usage, but let the whole system enter low power states more often. | 37 | drivers the ioctl interface used by ethtool may also be used for this |
38 | purpose); enabling it may cost some power usage, but let the whole | ||
39 | system enter low-power states more often. | ||
31 | 40 | ||
32 | Runtime Power Management model: | 41 | Runtime Power Management model: |
33 | Drivers may also enter low power states while the system is running, | 42 | Devices may also be put into low-power states while the system is |
34 | independently of other power management activity. Upstream drivers | 43 | running, independently of other power management activity in principle. |
35 | will normally not know (or care) if the device is in some low power | 44 | However, devices are not generally independent of each other (for |
36 | state when issuing requests; the driver will auto-resume anything | 45 | example, a parent device cannot be suspended unless all of its child |
37 | that's needed when it gets a request. | 46 | devices have been suspended). Moreover, depending on the bus type the |
38 | 47 | device is on, it may be necessary to carry out some bus-specific | |
39 | This doesn't have, or need much infrastructure; it's just something you | 48 | operations on the device for this purpose. Devices put into low power |
40 | should do when writing your drivers. For example, clk_disable() unused | 49 | states at run time may require special handling during system-wide power |
41 | clocks as part of minimizing power drain for currently-unused hardware. | 50 | transitions (suspend or hibernation). |
42 | Of course, sometimes clusters of drivers will collaborate with each | 51 | |
43 | other, which could involve task-specific power management. | 52 | For these reasons not only the device driver itself, but also the |
44 | 53 | appropriate subsystem (bus type, device type or device class) driver and | |
45 | There's not a lot to be said about those low power states except that they | 54 | the PM core are involved in runtime power management. As in the system |
46 | are very system-specific, and often device-specific. Also, that if enough | 55 | sleep power management case, they need to collaborate by implementing |
47 | drivers put themselves into low power states (at "runtime"), the effect may be | 56 | various role-specific suspend and resume methods, so that the hardware |
48 | the same as entering some system-wide low-power state (system sleep) ... and | 57 | is cleanly powered down and reactivated without data or service loss. |
49 | that synergies exist, so that several drivers using runtime pm might put the | 58 | |
50 | system into a state where even deeper power saving options are available. | 59 | There's not a lot to be said about those low-power states except that they are |
51 | 60 | very system-specific, and often device-specific. Also, that if enough devices | |
52 | Most suspended devices will have quiesced all I/O: no more DMA or irqs, no | 61 | have been put into low-power states (at runtime), the effect may be very similar |
53 | more data read or written, and requests from upstream drivers are no longer | 62 | to entering some system-wide low-power state (system sleep) ... and that |
54 | accepted. A given bus or platform may have different requirements though. | 63 | synergies exist, so that several drivers using runtime PM might put the system |
64 | into a state where even deeper power saving options are available. | ||
65 | |||
66 | Most suspended devices will have quiesced all I/O: no more DMA or IRQs (except | ||
67 | for wakeup events), no more data read or written, and requests from upstream | ||
68 | drivers are no longer accepted. A given bus or platform may have different | ||
69 | requirements though. | ||
55 | 70 | ||
56 | Examples of hardware wakeup events include an alarm from a real time clock, | 71 | Examples of hardware wakeup events include an alarm from a real time clock, |
57 | network wake-on-LAN packets, keyboard or mouse activity, and media insertion | 72 | network wake-on-LAN packets, keyboard or mouse activity, and media insertion |
@@ -60,129 +75,152 @@ or removal (for PCMCIA, MMC/SD, USB, and so on). | |||
60 | 75 | ||
61 | Interfaces for Entering System Sleep States | 76 | Interfaces for Entering System Sleep States |
62 | =========================================== | 77 | =========================================== |
63 | Most of the programming interfaces a device driver needs to know about | 78 | There are programming interfaces provided for subsystems (bus type, device type, |
64 | relate to that first model: entering a system-wide low power state, | 79 | device class) and device drivers to allow them to participate in the power |
65 | rather than just minimizing power consumption by one device. | 80 | management of devices they are concerned with. These interfaces cover both |
66 | 81 | system sleep and runtime power management. | |
67 | 82 | ||
68 | Bus Driver Methods | 83 | |
69 | ------------------ | 84 | Device Power Management Operations |
70 | The core methods to suspend and resume devices reside in struct bus_type. | 85 | ---------------------------------- |
71 | These are mostly of interest to people writing infrastructure for busses | 86 | Device power management operations, at the subsystem level as well as at the |
72 | like PCI or USB, or because they define the primitives that device drivers | 87 | device driver level, are implemented by defining and populating objects of type |
73 | may need to apply in domain-specific ways to their devices: | 88 | struct dev_pm_ops: |
74 | 89 | ||
75 | struct bus_type { | 90 | struct dev_pm_ops { |
76 | ... | 91 | int (*prepare)(struct device *dev); |
77 | int (*suspend)(struct device *dev, pm_message_t state); | 92 | void (*complete)(struct device *dev); |
78 | int (*resume)(struct device *dev); | 93 | int (*suspend)(struct device *dev); |
94 | int (*resume)(struct device *dev); | ||
95 | int (*freeze)(struct device *dev); | ||
96 | int (*thaw)(struct device *dev); | ||
97 | int (*poweroff)(struct device *dev); | ||
98 | int (*restore)(struct device *dev); | ||
99 | int (*suspend_noirq)(struct device *dev); | ||
100 | int (*resume_noirq)(struct device *dev); | ||
101 | int (*freeze_noirq)(struct device *dev); | ||
102 | int (*thaw_noirq)(struct device *dev); | ||
103 | int (*poweroff_noirq)(struct device *dev); | ||
104 | int (*restore_noirq)(struct device *dev); | ||
105 | int (*runtime_suspend)(struct device *dev); | ||
106 | int (*runtime_resume)(struct device *dev); | ||
107 | int (*runtime_idle)(struct device *dev); | ||
79 | }; | 108 | }; |
80 | 109 | ||
81 | Bus drivers implement those methods as appropriate for the hardware and | 110 | This structure is defined in include/linux/pm.h and the methods included in it |
82 | the drivers using it; PCI works differently from USB, and so on. Not many | 111 | are also described in that file. Their roles will be explained in what follows. |
83 | people write bus drivers; most driver code is a "device driver" that | 112 | For now, it should be sufficient to remember that the last three methods are |
84 | builds on top of bus-specific framework code. | 113 | specific to runtime power management while the remaining ones are used during |
114 | system-wide power transitions. | ||
85 | 115 | ||
86 | For more information on these driver calls, see the description later; | 116 | There also is a deprecated "old" or "legacy" interface for power management |
87 | they are called in phases for every device, respecting the parent-child | 117 | operations available at least for some subsystems. This approach does not use |
88 | sequencing in the driver model tree. Note that as this is being written, | 118 | struct dev_pm_ops objects and it is suitable only for implementing system sleep |
89 | only the suspend() and resume() are widely available; not many bus drivers | 119 | power management methods. Therefore it is not described in this document, so |
90 | leverage all of those phases, or pass them down to lower driver levels. | 120 | please refer directly to the source code for more information about it. |
91 | 121 | ||
92 | 122 | ||
93 | /sys/devices/.../power/wakeup files | 123 | Subsystem-Level Methods |
94 | ----------------------------------- | 124 | ----------------------- |
95 | All devices in the driver model have two flags to control handling of | 125 | The core methods to suspend and resume devices reside in struct dev_pm_ops |
96 | wakeup events, which are hardware signals that can force the device and/or | 126 | pointed to by the pm member of struct bus_type, struct device_type and |
97 | system out of a low power state. These are initialized by bus or device | 127 | struct class. They are mostly of interest to the people writing infrastructure |
98 | driver code using device_init_wakeup(dev,can_wakeup). | 128 | for buses, like PCI or USB, or device type and device class drivers. |
99 | 129 | ||
100 | The "can_wakeup" flag just records whether the device (and its driver) can | 130 | Bus drivers implement these methods as appropriate for the hardware and the |
101 | physically support wakeup events. When that flag is clear, the sysfs | 131 | drivers using it; PCI works differently from USB, and so on. Not many people |
102 | "wakeup" file is empty, and device_may_wakeup() returns false. | 132 | write subsystem-level drivers; most driver code is a "device driver" that builds |
133 | on top of bus-specific framework code. | ||
103 | 134 | ||
104 | For devices that can issue wakeup events, a separate flag controls whether | 135 | For more information on these driver calls, see the description later; |
105 | that device should try to use its wakeup mechanism. The initial value of | 136 | they are called in phases for every device, respecting the parent-child |
106 | device_may_wakeup() will be true, so that the device's "wakeup" file holds | 137 | sequencing in the driver model tree. |
107 | the value "enabled". Userspace can change that to "disabled" so that | ||
108 | device_may_wakeup() returns false; or change it back to "enabled" (so that | ||
109 | it returns true again). | ||
110 | 138 | ||
111 | 139 | ||
112 | EXAMPLE: PCI Device Driver Methods | 140 | /sys/devices/.../power/wakeup files |
113 | ----------------------------------- | 141 | ----------------------------------- |
114 | PCI framework software calls these methods when the PCI device driver bound | 142 | All devices in the driver model have two flags to control handling of wakeup |
115 | to a device device has provided them: | 143 | events (hardware signals that can force the device and/or system out of a low |
116 | 144 | power state). These flags are initialized by bus or device driver code using | |
117 | struct pci_driver { | 145 | device_set_wakeup_capable() and device_set_wakeup_enable(), defined in |
118 | ... | 146 | include/linux/pm_wakeup.h. |
119 | int (*suspend)(struct pci_device *pdev, pm_message_t state); | ||
120 | int (*suspend_late)(struct pci_device *pdev, pm_message_t state); | ||
121 | 147 | ||
122 | int (*resume_early)(struct pci_device *pdev); | 148 | The "can_wakeup" flag just records whether the device (and its driver) can |
123 | int (*resume)(struct pci_device *pdev); | 149 | physically support wakeup events. The device_set_wakeup_capable() routine |
124 | }; | 150 | affects this flag. The "should_wakeup" flag controls whether the device should |
125 | 151 | try to use its wakeup mechanism. device_set_wakeup_enable() affects this flag; | |
126 | Drivers will implement those methods, and call PCI-specific procedures | 152 | for the most part drivers should not change its value. The initial value of |
127 | like pci_set_power_state(), pci_enable_wake(), pci_save_state(), and | 153 | should_wakeup is supposed to be false for the majority of devices; the major |
128 | pci_restore_state() to manage PCI-specific mechanisms. (PCI config space | 154 | exceptions are power buttons, keyboards, and Ethernet adapters whose WoL |
129 | could be saved during driver probe, if it weren't for the fact that some | 155 | (wake-on-LAN) feature has been set up with ethtool. |
130 | systems rely on userspace tweaking using setpci.) Devices are suspended | 156 | |
131 | before their bridges enter low power states, and likewise bridges resume | 157 | Whether or not a device is capable of issuing wakeup events is a hardware |
132 | before their devices. | 158 | matter, and the kernel is responsible for keeping track of it. By contrast, |
133 | 159 | whether or not a wakeup-capable device should issue wakeup events is a policy | |
134 | 160 | decision, and it is managed by user space through a sysfs attribute: the | |
135 | Upper Layers of Driver Stacks | 161 | power/wakeup file. User space can write the strings "enabled" or "disabled" to |
136 | ----------------------------- | 162 | set or clear the should_wakeup flag, respectively. Reads from the file will |
137 | Device drivers generally have at least two interfaces, and the methods | 163 | return the corresponding string if can_wakeup is true, but if can_wakeup is |
138 | sketched above are the ones which apply to the lower level (nearer PCI, USB, | 164 | false then reads will return an empty string, to indicate that the device |
139 | or other bus hardware). The network and block layers are examples of upper | 165 | doesn't support wakeup events. (But even though the file appears empty, writes |
140 | level interfaces, as is a character device talking to userspace. | 166 | will still affect the should_wakeup flag.) |
141 | 167 | ||
142 | Power management requests normally need to flow through those upper levels, | 168 | The device_may_wakeup() routine returns true only if both flags are set. |
143 | which often use domain-oriented requests like "blank that screen". In | 169 | Drivers should check this routine when putting devices in a low-power state |
144 | some cases those upper levels will have power management intelligence that | 170 | during a system sleep transition, to see whether or not to enable the devices' |
145 | relates to end-user activity, or other devices that work in cooperation. | 171 | wakeup mechanisms. However for runtime power management, wakeup events should |
146 | 172 | be enabled whenever the device and driver both support them, regardless of the | |
147 | When those interfaces are structured using class interfaces, there is a | 173 | should_wakeup flag. |
148 | standard way to have the upper layer stop issuing requests to a given | 174 | |
149 | class device (and restart later): | 175 | |
150 | 176 | /sys/devices/.../power/control files | |
151 | struct class { | 177 | ------------------------------------ |
152 | ... | 178 | Each device in the driver model has a flag to control whether it is subject to |
153 | int (*suspend)(struct device *dev, pm_message_t state); | 179 | runtime power management. This flag, called runtime_auto, is initialized by the |
154 | int (*resume)(struct device *dev); | 180 | bus type (or generally subsystem) code using pm_runtime_allow() or |
155 | }; | 181 | pm_runtime_forbid(); the default is to allow runtime power management. |
156 | 182 | ||
157 | Those calls are issued in specific phases of the process by which the | 183 | The setting can be adjusted by user space by writing either "on" or "auto" to |
158 | system enters a low power "suspend" state, or resumes from it. | 184 | the device's power/control sysfs file. Writing "auto" calls pm_runtime_allow(), |
159 | 185 | setting the flag and allowing the device to be runtime power-managed by its | |
160 | 186 | driver. Writing "on" calls pm_runtime_forbid(), clearing the flag, returning | |
161 | Calling Drivers to Enter System Sleep States | 187 | the device to full power if it was in a low-power state, and preventing the |
162 | ============================================ | 188 | device from being runtime power-managed. User space can check the current value |
163 | When the system enters a low power state, each device's driver is asked | 189 | of the runtime_auto flag by reading the file. |
164 | to suspend the device by putting it into state compatible with the target | 190 | |
191 | The device's runtime_auto flag has no effect on the handling of system-wide | ||
192 | power transitions. In particular, the device can (and in the majority of cases | ||
193 | should and will) be put into a low-power state during a system-wide transition | ||
194 | to a sleep state even though its runtime_auto flag is clear. | ||
195 | |||
196 | For more information about the runtime power management framework, refer to | ||
197 | Documentation/power/runtime_pm.txt. | ||
198 | |||
199 | |||
200 | Calling Drivers to Enter and Leave System Sleep States | ||
201 | ====================================================== | ||
202 | When the system goes into a sleep state, each device's driver is asked to | ||
203 | suspend the device by putting it into a state compatible with the target | ||
165 | system state. That's usually some version of "off", but the details are | 204 | system state. That's usually some version of "off", but the details are |
166 | system-specific. Also, wakeup-enabled devices will usually stay partly | 205 | system-specific. Also, wakeup-enabled devices will usually stay partly |
167 | functional in order to wake the system. | 206 | functional in order to wake the system. |
168 | 207 | ||
169 | When the system leaves that low power state, the device's driver is asked | 208 | When the system leaves that low-power state, the device's driver is asked to |
170 | to resume it. The suspend and resume operations always go together, and | 209 | resume it by returning it to full power. The suspend and resume operations |
171 | both are multi-phase operations. | 210 | always go together, and both are multi-phase operations. |
172 | 211 | ||
173 | For simple drivers, suspend might quiesce the device using the class code | 212 | For simple drivers, suspend might quiesce the device using class code |
174 | and then turn its hardware as "off" as possible with late_suspend. The | 213 | and then turn its hardware as "off" as possible during suspend_noirq. The |
175 | matching resume calls would then completely reinitialize the hardware | 214 | matching resume calls would then completely reinitialize the hardware |
176 | before reactivating its class I/O queues. | 215 | before reactivating its class I/O queues. |
177 | 216 | ||
178 | More power-aware drivers drivers will use more than one device low power | 217 | More power-aware drivers might prepare the devices for triggering system wakeup |
179 | state, either at runtime or during system sleep states, and might trigger | 218 | events. |
180 | system wakeup events. | ||
181 | 219 | ||
182 | 220 | ||
183 | Call Sequence Guarantees | 221 | Call Sequence Guarantees |
184 | ------------------------ | 222 | ------------------------ |
185 | To ensure that bridges and similar links needed to talk to a device are | 223 | To ensure that bridges and similar links needing to talk to a device are |
186 | available when the device is suspended or resumed, the device tree is | 224 | available when the device is suspended or resumed, the device tree is |
187 | walked in a bottom-up order to suspend devices. A top-down order is | 225 | walked in a bottom-up order to suspend devices. A top-down order is |
188 | used to resume those devices. | 226 | used to resume those devices. |
@@ -194,67 +232,310 @@ its parent; and can't be removed or suspended after that parent. | |||
194 | The policy is that the device tree should match hardware bus topology. | 232 | The policy is that the device tree should match hardware bus topology. |
195 | (Or at least the control bus, for devices which use multiple busses.) | 233 | (Or at least the control bus, for devices which use multiple busses.) |
196 | In particular, this means that a device registration may fail if the parent of | 234 | In particular, this means that a device registration may fail if the parent of |
197 | the device is suspending (ie. has been chosen by the PM core as the next | 235 | the device is suspending (i.e. has been chosen by the PM core as the next |
198 | device to suspend) or has already suspended, as well as after all of the other | 236 | device to suspend) or has already suspended, as well as after all of the other |
199 | devices have been suspended. Device drivers must be prepared to cope with such | 237 | devices have been suspended. Device drivers must be prepared to cope with such |
200 | situations. | 238 | situations. |
201 | 239 | ||
202 | 240 | ||
203 | Suspending Devices | 241 | System Power Management Phases |
204 | ------------------ | 242 | ------------------------------ |
205 | Suspending a given device is done in several phases. Suspending the | 243 | Suspending or resuming the system is done in several phases. Different phases |
206 | system always includes every phase, executing calls for every device | 244 | are used for standby or memory sleep states ("suspend-to-RAM") and the |
207 | before the next phase begins. Not all busses or classes support all | 245 | hibernation state ("suspend-to-disk"). Each phase involves executing callbacks |
208 | these callbacks; and not all drivers use all the callbacks. | 246 | for every device before the next phase begins. Not all busses or classes |
247 | support all these callbacks and not all drivers use all the callbacks. The | ||
248 | various phases always run after tasks have been frozen and before they are | ||
249 | unfrozen. Furthermore, the *_noirq phases run at a time when IRQ handlers have | ||
250 | been disabled (except for those marked with the IRQ_WAKEUP flag). | ||
209 | 251 | ||
210 | The phases are seen by driver notifications issued in this order: | 252 | Most phases use bus, type, and class callbacks (that is, methods defined in |
253 | dev->bus->pm, dev->type->pm, and dev->class->pm). The prepare and complete | ||
254 | phases are exceptions; they use only bus callbacks. When multiple callbacks | ||
255 | are used in a phase, they are invoked in the order: <class, type, bus> during | ||
256 | power-down transitions and in the opposite order during power-up transitions. | ||
257 | For example, during the suspend phase the PM core invokes | ||
211 | 258 | ||
212 | 1 class.suspend(dev, message) is called after tasks are frozen, for | 259 | dev->class->pm.suspend(dev); |
213 | devices associated with a class that has such a method. This | 260 | dev->type->pm.suspend(dev); |
214 | method may sleep. | 261 | dev->bus->pm.suspend(dev); |
215 | 262 | ||
216 | Since I/O activity usually comes from such higher layers, this is | 263 | before moving on to the next device, whereas during the resume phase the core |
217 | a good place to quiesce all drivers of a given type (and keep such | 264 | invokes |
218 | code out of those drivers). | ||
219 | 265 | ||
220 | 2 bus.suspend(dev, message) is called next. This method may sleep, | 266 | dev->bus->pm.resume(dev); |
221 | and is often morphed into a device driver call with bus-specific | 267 | dev->type->pm.resume(dev); |
222 | parameters and/or rules. | 268 | dev->class->pm.resume(dev); |
223 | 269 | ||
224 | This call should handle parts of device suspend logic that require | 270 | These callbacks may in turn invoke device- or driver-specific methods stored in |
225 | sleeping. It probably does work to quiesce the device which hasn't | 271 | dev->driver->pm, but they don't have to. |
226 | been abstracted into class.suspend(). | ||
227 | 272 | ||
228 | The pm_message_t parameter is currently used to refine those semantics | ||
229 | (described later). | ||
230 | 273 | ||
231 | At the end of those phases, drivers should normally have stopped all I/O | 274 | Entering System Suspend |
232 | transactions (DMA, IRQs), saved enough state that they can re-initialize | 275 | ----------------------- |
233 | or restore previous state (as needed by the hardware), and placed the | 276 | When the system goes into the standby or memory sleep state, the phases are: |
234 | device into a low-power state. On many platforms they will also use | 277 | |
235 | clk_disable() to gate off one or more clock sources; sometimes they will | 278 | prepare, suspend, suspend_noirq. |
236 | also switch off power supplies, or reduce voltages. Drivers which have | 279 | |
237 | runtime PM support may already have performed some or all of the steps | 280 | 1. The prepare phase is meant to prevent races by preventing new devices |
238 | needed to prepare for the upcoming system sleep state. | 281 | from being registered; the PM core would never know that all the |
282 | children of a device had been suspended if new children could be | ||
283 | registered at will. (By contrast, devices may be unregistered at any | ||
284 | time.) Unlike the other suspend-related phases, during the prepare | ||
285 | phase the device tree is traversed top-down. | ||
286 | |||
287 | The prepare phase uses only a bus callback. After the callback method | ||
288 | returns, no new children may be registered below the device. The method | ||
289 | may also prepare the device or driver in some way for the upcoming | ||
290 | system power transition, but it should not put the device into a | ||
291 | low-power state. | ||
292 | |||
293 | 2. The suspend methods should quiesce the device to stop it from performing | ||
294 | I/O. They also may save the device registers and put it into the | ||
295 | appropriate low-power state, depending on the bus type the device is on, | ||
296 | and they may enable wakeup events. | ||
297 | |||
298 | 3. The suspend_noirq phase occurs after IRQ handlers have been disabled, | ||
299 | which means that the driver's interrupt handler will not be called while | ||
300 | the callback method is running. The methods should save the values of | ||
301 | the device's registers that weren't saved previously and finally put the | ||
302 | device into the appropriate low-power state. | ||
303 | |||
304 | The majority of subsystems and device drivers need not implement this | ||
305 | callback. However, bus types allowing devices to share interrupt | ||
306 | vectors, like PCI, generally need it; otherwise a driver might encounter | ||
307 | an error during the suspend phase by fielding a shared interrupt | ||
308 | generated by some other device after its own device had been set to low | ||
309 | power. | ||
310 | |||
311 | At the end of these phases, drivers should have stopped all I/O transactions | ||
312 | (DMA, IRQs), saved enough state that they can re-initialize or restore previous | ||
313 | state (as needed by the hardware), and placed the device into a low-power state. | ||
314 | On many platforms they will gate off one or more clock sources; sometimes they | ||
315 | will also switch off power supplies or reduce voltages. (Drivers supporting | ||
316 | runtime PM may already have performed some or all of these steps.) | ||
317 | |||
318 | If device_may_wakeup(dev) returns true, the device should be prepared for | ||
319 | generating hardware wakeup signals to trigger a system wakeup event when the | ||
320 | system is in the sleep state. For example, enable_irq_wake() might identify | ||
321 | GPIO signals hooked up to a switch or other external hardware, and | ||
322 | pci_enable_wake() does something similar for the PCI PME signal. | ||
323 | |||
324 | If any of these callbacks returns an error, the system won't enter the desired | ||
325 | low-power state. Instead the PM core will unwind its actions by resuming all | ||
326 | the devices that were suspended. | ||
327 | |||
328 | |||
329 | Leaving System Suspend | ||
330 | ---------------------- | ||
331 | When resuming from standby or memory sleep, the phases are: | ||
332 | |||
333 | resume_noirq, resume, complete. | ||
334 | |||
335 | 1. The resume_noirq callback methods should perform any actions needed | ||
336 | before the driver's interrupt handlers are invoked. This generally | ||
337 | means undoing the actions of the suspend_noirq phase. If the bus type | ||
338 | permits devices to share interrupt vectors, like PCI, the method should | ||
339 | bring the device and its driver into a state in which the driver can | ||
340 | recognize if the device is the source of incoming interrupts, if any, | ||
341 | and handle them correctly. | ||
342 | |||
343 | For example, the PCI bus type's ->pm.resume_noirq() puts the device into | ||
344 | the full-power state (D0 in the PCI terminology) and restores the | ||
345 | standard configuration registers of the device. Then it calls the | ||
346 | device driver's ->pm.resume_noirq() method to perform device-specific | ||
347 | actions. | ||
348 | |||
349 | 2. The resume methods should bring the the device back to its operating | ||
350 | state, so that it can perform normal I/O. This generally involves | ||
351 | undoing the actions of the suspend phase. | ||
352 | |||
353 | 3. The complete phase uses only a bus callback. The method should undo the | ||
354 | actions of the prepare phase. Note, however, that new children may be | ||
355 | registered below the device as soon as the resume callbacks occur; it's | ||
356 | not necessary to wait until the complete phase. | ||
357 | |||
358 | At the end of these phases, drivers should be as functional as they were before | ||
359 | suspending: I/O can be performed using DMA and IRQs, and the relevant clocks are | ||
360 | gated on. Even if the device was in a low-power state before the system sleep | ||
361 | because of runtime power management, afterwards it should be back in its | ||
362 | full-power state. There are multiple reasons why it's best to do this; they are | ||
363 | discussed in more detail in Documentation/power/runtime_pm.txt. | ||
239 | 364 | ||
240 | When any driver sees that its device_can_wakeup(dev), it should make sure | 365 | However, the details here may again be platform-specific. For example, |
241 | to use the relevant hardware signals to trigger a system wakeup event. | 366 | some systems support multiple "run" states, and the mode in effect at |
242 | For example, enable_irq_wake() might identify GPIO signals hooked up to | 367 | the end of resume might not be the one which preceded suspension. |
243 | a switch or other external hardware, and pci_enable_wake() does something | 368 | That means availability of certain clocks or power supplies changed, |
244 | similar for PCI's PME# signal. | 369 | which could easily affect how a driver works. |
370 | |||
371 | Drivers need to be able to handle hardware which has been reset since the | ||
372 | suspend methods were called, for example by complete reinitialization. | ||
373 | This may be the hardest part, and the one most protected by NDA'd documents | ||
374 | and chip errata. It's simplest if the hardware state hasn't changed since | ||
375 | the suspend was carried out, but that can't be guaranteed (in fact, it ususally | ||
376 | is not the case). | ||
377 | |||
378 | Drivers must also be prepared to notice that the device has been removed | ||
379 | while the system was powered down, whenever that's physically possible. | ||
380 | PCMCIA, MMC, USB, Firewire, SCSI, and even IDE are common examples of busses | ||
381 | where common Linux platforms will see such removal. Details of how drivers | ||
382 | will notice and handle such removals are currently bus-specific, and often | ||
383 | involve a separate thread. | ||
384 | |||
385 | These callbacks may return an error value, but the PM core will ignore such | ||
386 | errors since there's nothing it can do about them other than printing them in | ||
387 | the system log. | ||
388 | |||
389 | |||
390 | Entering Hibernation | ||
391 | -------------------- | ||
392 | Hibernating the system is more complicated than putting it into the standby or | ||
393 | memory sleep state, because it involves creating and saving a system image. | ||
394 | Therefore there are more phases for hibernation, with a different set of | ||
395 | callbacks. These phases always run after tasks have been frozen and memory has | ||
396 | been freed. | ||
397 | |||
398 | The general procedure for hibernation is to quiesce all devices (freeze), create | ||
399 | an image of the system memory while everything is stable, reactivate all | ||
400 | devices (thaw), write the image to permanent storage, and finally shut down the | ||
401 | system (poweroff). The phases used to accomplish this are: | ||
402 | |||
403 | prepare, freeze, freeze_noirq, thaw_noirq, thaw, complete, | ||
404 | prepare, poweroff, poweroff_noirq | ||
405 | |||
406 | 1. The prepare phase is discussed in the "Entering System Suspend" section | ||
407 | above. | ||
408 | |||
409 | 2. The freeze methods should quiesce the device so that it doesn't generate | ||
410 | IRQs or DMA, and they may need to save the values of device registers. | ||
411 | However the device does not have to be put in a low-power state, and to | ||
412 | save time it's best not to do so. Also, the device should not be | ||
413 | prepared to generate wakeup events. | ||
414 | |||
415 | 3. The freeze_noirq phase is analogous to the suspend_noirq phase discussed | ||
416 | above, except again that the device should not be put in a low-power | ||
417 | state and should not be allowed to generate wakeup events. | ||
418 | |||
419 | At this point the system image is created. All devices should be inactive and | ||
420 | the contents of memory should remain undisturbed while this happens, so that the | ||
421 | image forms an atomic snapshot of the system state. | ||
422 | |||
423 | 4. The thaw_noirq phase is analogous to the resume_noirq phase discussed | ||
424 | above. The main difference is that its methods can assume the device is | ||
425 | in the same state as at the end of the freeze_noirq phase. | ||
426 | |||
427 | 5. The thaw phase is analogous to the resume phase discussed above. Its | ||
428 | methods should bring the device back to an operating state, so that it | ||
429 | can be used for saving the image if necessary. | ||
430 | |||
431 | 6. The complete phase is discussed in the "Leaving System Suspend" section | ||
432 | above. | ||
433 | |||
434 | At this point the system image is saved, and the devices then need to be | ||
435 | prepared for the upcoming system shutdown. This is much like suspending them | ||
436 | before putting the system into the standby or memory sleep state, and the phases | ||
437 | are similar. | ||
438 | |||
439 | 7. The prepare phase is discussed above. | ||
440 | |||
441 | 8. The poweroff phase is analogous to the suspend phase. | ||
442 | |||
443 | 9. The poweroff_noirq phase is analogous to the suspend_noirq phase. | ||
444 | |||
445 | The poweroff and poweroff_noirq callbacks should do essentially the same things | ||
446 | as the suspend and suspend_noirq callbacks. The only notable difference is that | ||
447 | they need not store the device register values, because the registers should | ||
448 | already have been stored during the freeze or freeze_noirq phases. | ||
449 | |||
450 | |||
451 | Leaving Hibernation | ||
452 | ------------------- | ||
453 | Resuming from hibernation is, again, more complicated than resuming from a sleep | ||
454 | state in which the contents of main memory are preserved, because it requires | ||
455 | a system image to be loaded into memory and the pre-hibernation memory contents | ||
456 | to be restored before control can be passed back to the image kernel. | ||
457 | |||
458 | Although in principle, the image might be loaded into memory and the | ||
459 | pre-hibernation memory contents restored by the boot loader, in practice this | ||
460 | can't be done because boot loaders aren't smart enough and there is no | ||
461 | established protocol for passing the necessary information. So instead, the | ||
462 | boot loader loads a fresh instance of the kernel, called the boot kernel, into | ||
463 | memory and passes control to it in the usual way. Then the boot kernel reads | ||
464 | the system image, restores the pre-hibernation memory contents, and passes | ||
465 | control to the image kernel. Thus two different kernels are involved in | ||
466 | resuming from hibernation. In fact, the boot kernel may be completely different | ||
467 | from the image kernel: a different configuration and even a different version. | ||
468 | This has important consequences for device drivers and their subsystems. | ||
469 | |||
470 | To be able to load the system image into memory, the boot kernel needs to | ||
471 | include at least a subset of device drivers allowing it to access the storage | ||
472 | medium containing the image, although it doesn't need to include all of the | ||
473 | drivers present in the image kernel. After the image has been loaded, the | ||
474 | devices managed by the boot kernel need to be prepared for passing control back | ||
475 | to the image kernel. This is very similar to the initial steps involved in | ||
476 | creating a system image, and it is accomplished in the same way, using prepare, | ||
477 | freeze, and freeze_noirq phases. However the devices affected by these phases | ||
478 | are only those having drivers in the boot kernel; other devices will still be in | ||
479 | whatever state the boot loader left them. | ||
480 | |||
481 | Should the restoration of the pre-hibernation memory contents fail, the boot | ||
482 | kernel would go through the "thawing" procedure described above, using the | ||
483 | thaw_noirq, thaw, and complete phases, and then continue running normally. This | ||
484 | happens only rarely. Most often the pre-hibernation memory contents are | ||
485 | restored successfully and control is passed to the image kernel, which then | ||
486 | becomes responsible for bringing the system back to the working state. | ||
487 | |||
488 | To achieve this, the image kernel must restore the devices' pre-hibernation | ||
489 | functionality. The operation is much like waking up from the memory sleep | ||
490 | state, although it involves different phases: | ||
491 | |||
492 | restore_noirq, restore, complete | ||
493 | |||
494 | 1. The restore_noirq phase is analogous to the resume_noirq phase. | ||
495 | |||
496 | 2. The restore phase is analogous to the resume phase. | ||
497 | |||
498 | 3. The complete phase is discussed above. | ||
499 | |||
500 | The main difference from resume[_noirq] is that restore[_noirq] must assume the | ||
501 | device has been accessed and reconfigured by the boot loader or the boot kernel. | ||
502 | Consequently the state of the device may be different from the state remembered | ||
503 | from the freeze and freeze_noirq phases. The device may even need to be reset | ||
504 | and completely re-initialized. In many cases this difference doesn't matter, so | ||
505 | the resume[_noirq] and restore[_norq] method pointers can be set to the same | ||
506 | routines. Nevertheless, different callback pointers are used in case there is a | ||
507 | situation where it actually matters. | ||
245 | 508 | ||
246 | If a driver (or bus, or class) fails it suspend method, the system won't | ||
247 | enter the desired low power state; it will resume all the devices it's | ||
248 | suspended so far. | ||
249 | 509 | ||
250 | Note that drivers may need to perform different actions based on the target | 510 | System Devices |
251 | system lowpower/sleep state. At this writing, there are only platform | 511 | -------------- |
252 | specific APIs through which drivers could determine those target states. | 512 | System devices (sysdevs) follow a slightly different API, which can be found in |
513 | |||
514 | include/linux/sysdev.h | ||
515 | drivers/base/sys.c | ||
516 | |||
517 | System devices will be suspended with interrupts disabled, and after all other | ||
518 | devices have been suspended. On resume, they will be resumed before any other | ||
519 | devices, and also with interrupts disabled. These things occur in special | ||
520 | "sysdev_driver" phases, which affect only system devices. | ||
521 | |||
522 | Thus, after the suspend_noirq (or freeze_noirq or poweroff_noirq) phase, when | ||
523 | the non-boot CPUs are all offline and IRQs are disabled on the remaining online | ||
524 | CPU, then a sysdev_driver.suspend phase is carried out, and the system enters a | ||
525 | sleep state (or a system image is created). During resume (or after the image | ||
526 | has been created or loaded) a sysdev_driver.resume phase is carried out, IRQs | ||
527 | are enabled on the only online CPU, the non-boot CPUs are enabled, and the | ||
528 | resume_noirq (or thaw_noirq or restore_noirq) phase begins. | ||
529 | |||
530 | Code to actually enter and exit the system-wide low power state sometimes | ||
531 | involves hardware details that are only known to the boot firmware, and | ||
532 | may leave a CPU running software (from SRAM or flash memory) that monitors | ||
533 | the system and manages its wakeup sequence. | ||
253 | 534 | ||
254 | 535 | ||
255 | Device Low Power (suspend) States | 536 | Device Low Power (suspend) States |
256 | --------------------------------- | 537 | --------------------------------- |
257 | Device low-power states aren't very standard. One device might only handle | 538 | Device low-power states aren't standard. One device might only handle |
258 | "on" and "off, while another might support a dozen different versions of | 539 | "on" and "off, while another might support a dozen different versions of |
259 | "on" (how many engines are active?), plus a state that gets back to "on" | 540 | "on" (how many engines are active?), plus a state that gets back to "on" |
260 | faster than from a full "off". | 541 | faster than from a full "off". |
@@ -265,7 +546,7 @@ PCI device may not perform DMA or issue IRQs, and any wakeup events it | |||
265 | issues would be issued through the PME# bus signal. Plus, there are | 546 | issues would be issued through the PME# bus signal. Plus, there are |
266 | several PCI-standard device states, some of which are optional. | 547 | several PCI-standard device states, some of which are optional. |
267 | 548 | ||
268 | In contrast, integrated system-on-chip processors often use irqs as the | 549 | In contrast, integrated system-on-chip processors often use IRQs as the |
269 | wakeup event sources (so drivers would call enable_irq_wake) and might | 550 | wakeup event sources (so drivers would call enable_irq_wake) and might |
270 | be able to treat DMA completion as a wakeup event (sometimes DMA can stay | 551 | be able to treat DMA completion as a wakeup event (sometimes DMA can stay |
271 | active too, it'd only be the CPU and some peripherals that sleep). | 552 | active too, it'd only be the CPU and some peripherals that sleep). |
@@ -284,120 +565,17 @@ ways; the aforementioned LCD might be active in one product's "standby", | |||
284 | but a different product using the same SOC might work differently. | 565 | but a different product using the same SOC might work differently. |
285 | 566 | ||
286 | 567 | ||
287 | Meaning of pm_message_t.event | 568 | Power Management Notifiers |
288 | ----------------------------- | 569 | -------------------------- |
289 | Parameters to suspend calls include the device affected and a message of | 570 | There are some operations that cannot be carried out by the power management |
290 | type pm_message_t, which has one field: the event. If driver does not | 571 | callbacks discussed above, because the callbacks occur too late or too early. |
291 | recognize the event code, suspend calls may abort the request and return | 572 | To handle these cases, subsystems and device drivers may register power |
292 | a negative errno. However, most drivers will be fine if they implement | 573 | management notifiers that are called before tasks are frozen and after they have |
293 | PM_EVENT_SUSPEND semantics for all messages. | 574 | been thawed. Generally speaking, the PM notifiers are suitable for performing |
575 | actions that either require user space to be available, or at least won't | ||
576 | interfere with user space. | ||
294 | 577 | ||
295 | The event codes are used to refine the goal of suspending the device, and | 578 | For details refer to Documentation/power/notifiers.txt. |
296 | mostly matter when creating or resuming system memory image snapshots, as | ||
297 | used with suspend-to-disk: | ||
298 | |||
299 | PM_EVENT_SUSPEND -- quiesce the driver and put hardware into a low-power | ||
300 | state. When used with system sleep states like "suspend-to-RAM" or | ||
301 | "standby", the upcoming resume() call will often be able to rely on | ||
302 | state kept in hardware, or issue system wakeup events. | ||
303 | |||
304 | PM_EVENT_HIBERNATE -- Put hardware into a low-power state and enable wakeup | ||
305 | events as appropriate. It is only used with hibernation | ||
306 | (suspend-to-disk) and few devices are able to wake up the system from | ||
307 | this state; most are completely powered off. | ||
308 | |||
309 | PM_EVENT_FREEZE -- quiesce the driver, but don't necessarily change into | ||
310 | any low power mode. A system snapshot is about to be taken, often | ||
311 | followed by a call to the driver's resume() method. Neither wakeup | ||
312 | events nor DMA are allowed. | ||
313 | |||
314 | PM_EVENT_PRETHAW -- quiesce the driver, knowing that the upcoming resume() | ||
315 | will restore a suspend-to-disk snapshot from a different kernel image. | ||
316 | Drivers that are smart enough to look at their hardware state during | ||
317 | resume() processing need that state to be correct ... a PRETHAW could | ||
318 | be used to invalidate that state (by resetting the device), like a | ||
319 | shutdown() invocation would before a kexec() or system halt. Other | ||
320 | drivers might handle this the same way as PM_EVENT_FREEZE. Neither | ||
321 | wakeup events nor DMA are allowed. | ||
322 | |||
323 | To enter "standby" (ACPI S1) or "Suspend to RAM" (STR, ACPI S3) states, or | ||
324 | the similarly named APM states, only PM_EVENT_SUSPEND is used; the other event | ||
325 | codes are used for hibernation ("Suspend to Disk", STD, ACPI S4). | ||
326 | |||
327 | There's also PM_EVENT_ON, a value which never appears as a suspend event | ||
328 | but is sometimes used to record the "not suspended" device state. | ||
329 | |||
330 | |||
331 | Resuming Devices | ||
332 | ---------------- | ||
333 | Resuming is done in multiple phases, much like suspending, with all | ||
334 | devices processing each phase's calls before the next phase begins. | ||
335 | |||
336 | The phases are seen by driver notifications issued in this order: | ||
337 | |||
338 | 1 bus.resume(dev) reverses the effects of bus.suspend(). This may | ||
339 | be morphed into a device driver call with bus-specific parameters; | ||
340 | implementations may sleep. | ||
341 | |||
342 | 2 class.resume(dev) is called for devices associated with a class | ||
343 | that has such a method. Implementations may sleep. | ||
344 | |||
345 | This reverses the effects of class.suspend(), and would usually | ||
346 | reactivate the device's I/O queue. | ||
347 | |||
348 | At the end of those phases, drivers should normally be as functional as | ||
349 | they were before suspending: I/O can be performed using DMA and IRQs, and | ||
350 | the relevant clocks are gated on. The device need not be "fully on"; it | ||
351 | might be in a runtime lowpower/suspend state that acts as if it were. | ||
352 | |||
353 | However, the details here may again be platform-specific. For example, | ||
354 | some systems support multiple "run" states, and the mode in effect at | ||
355 | the end of resume() might not be the one which preceded suspension. | ||
356 | That means availability of certain clocks or power supplies changed, | ||
357 | which could easily affect how a driver works. | ||
358 | |||
359 | |||
360 | Drivers need to be able to handle hardware which has been reset since the | ||
361 | suspend methods were called, for example by complete reinitialization. | ||
362 | This may be the hardest part, and the one most protected by NDA'd documents | ||
363 | and chip errata. It's simplest if the hardware state hasn't changed since | ||
364 | the suspend() was called, but that can't always be guaranteed. | ||
365 | |||
366 | Drivers must also be prepared to notice that the device has been removed | ||
367 | while the system was powered off, whenever that's physically possible. | ||
368 | PCMCIA, MMC, USB, Firewire, SCSI, and even IDE are common examples of busses | ||
369 | where common Linux platforms will see such removal. Details of how drivers | ||
370 | will notice and handle such removals are currently bus-specific, and often | ||
371 | involve a separate thread. | ||
372 | |||
373 | |||
374 | Note that the bus-specific runtime PM wakeup mechanism can exist, and might | ||
375 | be defined to share some of the same driver code as for system wakeup. For | ||
376 | example, a bus-specific device driver's resume() method might be used there, | ||
377 | so it wouldn't only be called from bus.resume() during system-wide wakeup. | ||
378 | See bus-specific information about how runtime wakeup events are handled. | ||
379 | |||
380 | |||
381 | System Devices | ||
382 | -------------- | ||
383 | System devices follow a slightly different API, which can be found in | ||
384 | |||
385 | include/linux/sysdev.h | ||
386 | drivers/base/sys.c | ||
387 | |||
388 | System devices will only be suspended with interrupts disabled, and after | ||
389 | all other devices have been suspended. On resume, they will be resumed | ||
390 | before any other devices, and also with interrupts disabled. | ||
391 | |||
392 | That is, IRQs are disabled, the suspend_late() phase begins, then the | ||
393 | sysdev_driver.suspend() phase, and the system enters a sleep state. Then | ||
394 | the sysdev_driver.resume() phase begins, followed by the resume_early() | ||
395 | phase, after which IRQs are enabled. | ||
396 | |||
397 | Code to actually enter and exit the system-wide low power state sometimes | ||
398 | involves hardware details that are only known to the boot firmware, and | ||
399 | may leave a CPU running software (from SRAM or flash memory) that monitors | ||
400 | the system and manages its wakeup sequence. | ||
401 | 579 | ||
402 | 580 | ||
403 | Runtime Power Management | 581 | Runtime Power Management |
@@ -407,82 +585,23 @@ running. This feature is useful for devices that are not being used, and | |||
407 | can offer significant power savings on a running system. These devices | 585 | can offer significant power savings on a running system. These devices |
408 | often support a range of runtime power states, which might use names such | 586 | often support a range of runtime power states, which might use names such |
409 | as "off", "sleep", "idle", "active", and so on. Those states will in some | 587 | as "off", "sleep", "idle", "active", and so on. Those states will in some |
410 | cases (like PCI) be partially constrained by a bus the device uses, and will | 588 | cases (like PCI) be partially constrained by the bus the device uses, and will |
411 | usually include hardware states that are also used in system sleep states. | 589 | usually include hardware states that are also used in system sleep states. |
412 | 590 | ||
413 | However, note that if a driver puts a device into a runtime low power state | 591 | A system-wide power transition can be started while some devices are in low |
414 | and the system then goes into a system-wide sleep state, it normally ought | 592 | power states due to runtime power management. The system sleep PM callbacks |
415 | to resume into that runtime low power state rather than "full on". Such | 593 | should recognize such situations and react to them appropriately, but the |
416 | distinctions would be part of the driver-internal state machine for that | 594 | necessary actions are subsystem-specific. |
417 | hardware; the whole point of runtime power management is to be sure that | 595 | |
418 | drivers are decoupled in that way from the state machine governing phases | 596 | In some cases the decision may be made at the subsystem level while in other |
419 | of the system-wide power/sleep state transitions. | 597 | cases the device driver may be left to decide. In some cases it may be |
420 | 598 | desirable to leave a suspended device in that state during a system-wide power | |
421 | 599 | transition, but in other cases the device must be put back into the full-power | |
422 | Power Saving Techniques | 600 | state temporarily, for example so that its system wakeup capability can be |
423 | ----------------------- | 601 | disabled. This all depends on the hardware and the design of the subsystem and |
424 | Normally runtime power management is handled by the drivers without specific | 602 | device driver in question. |
425 | userspace or kernel intervention, by device-aware use of techniques like: | 603 | |
426 | 604 | During system-wide resume from a sleep state it's best to put devices into the | |
427 | Using information provided by other system layers | 605 | full-power state, as explained in Documentation/power/runtime_pm.txt. Refer to |
428 | - stay deeply "off" except between open() and close() | 606 | that document for more information regarding this particular issue as well as |
429 | - if transceiver/PHY indicates "nobody connected", stay "off" | 607 | for information on the device runtime power management framework in general. |
430 | - application protocols may include power commands or hints | ||
431 | |||
432 | Using fewer CPU cycles | ||
433 | - using DMA instead of PIO | ||
434 | - removing timers, or making them lower frequency | ||
435 | - shortening "hot" code paths | ||
436 | - eliminating cache misses | ||
437 | - (sometimes) offloading work to device firmware | ||
438 | |||
439 | Reducing other resource costs | ||
440 | - gating off unused clocks in software (or hardware) | ||
441 | - switching off unused power supplies | ||
442 | - eliminating (or delaying/merging) IRQs | ||
443 | - tuning DMA to use word and/or burst modes | ||
444 | |||
445 | Using device-specific low power states | ||
446 | - using lower voltages | ||
447 | - avoiding needless DMA transfers | ||
448 | |||
449 | Read your hardware documentation carefully to see the opportunities that | ||
450 | may be available. If you can, measure the actual power usage and check | ||
451 | it against the budget established for your project. | ||
452 | |||
453 | |||
454 | Examples: USB hosts, system timer, system CPU | ||
455 | ---------------------------------------------- | ||
456 | USB host controllers make interesting, if complex, examples. In many cases | ||
457 | these have no work to do: no USB devices are connected, or all of them are | ||
458 | in the USB "suspend" state. Linux host controller drivers can then disable | ||
459 | periodic DMA transfers that would otherwise be a constant power drain on the | ||
460 | memory subsystem, and enter a suspend state. In power-aware controllers, | ||
461 | entering that suspend state may disable the clock used with USB signaling, | ||
462 | saving a certain amount of power. | ||
463 | |||
464 | The controller will be woken from that state (with an IRQ) by changes to the | ||
465 | signal state on the data lines of a given port, for example by an existing | ||
466 | peripheral requesting "remote wakeup" or by plugging a new peripheral. The | ||
467 | same wakeup mechanism usually works from "standby" sleep states, and on some | ||
468 | systems also from "suspend to RAM" (or even "suspend to disk") states. | ||
469 | (Except that ACPI may be involved instead of normal IRQs, on some hardware.) | ||
470 | |||
471 | System devices like timers and CPUs may have special roles in the platform | ||
472 | power management scheme. For example, system timers using a "dynamic tick" | ||
473 | approach don't just save CPU cycles (by eliminating needless timer IRQs), | ||
474 | but they may also open the door to using lower power CPU "idle" states that | ||
475 | cost more than a jiffie to enter and exit. On x86 systems these are states | ||
476 | like "C3"; note that periodic DMA transfers from a USB host controller will | ||
477 | also prevent entry to a C3 state, much like a periodic timer IRQ. | ||
478 | |||
479 | That kind of runtime mechanism interaction is common. "System On Chip" (SOC) | ||
480 | processors often have low power idle modes that can't be entered unless | ||
481 | certain medium-speed clocks (often 12 or 48 MHz) are gated off. When the | ||
482 | drivers gate those clocks effectively, then the system idle task may be able | ||
483 | to use the lower power idle modes and thereby increase battery life. | ||
484 | |||
485 | If the CPU can have a "cpufreq" driver, there also may be opportunities | ||
486 | to shift to lower voltage settings and reduce the power cost of executing | ||
487 | a given number of instructions. (Without voltage adjustment, it's rare | ||
488 | for cpufreq to save much power; the cost-per-instruction must go down.) | ||
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt index dd8fe43888d3..62328d76b55b 100644 --- a/Documentation/power/pci.txt +++ b/Documentation/power/pci.txt | |||
@@ -1,299 +1,1025 @@ | |||
1 | |||
2 | PCI Power Management | 1 | PCI Power Management |
3 | ~~~~~~~~~~~~~~~~~~~~ | ||
4 | 2 | ||
5 | An overview of the concepts and the related functions in the Linux kernel | 3 | Copyright (c) 2010 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. |
4 | |||
5 | An overview of concepts and the Linux kernel's interfaces related to PCI power | ||
6 | management. Based on previous work by Patrick Mochel <mochel@transmeta.com> | ||
7 | (and others). | ||
6 | 8 | ||
7 | Patrick Mochel <mochel@transmeta.com> | 9 | This document only covers the aspects of power management specific to PCI |
8 | (and others) | 10 | devices. For general description of the kernel's interfaces related to device |
11 | power management refer to Documentation/power/devices.txt and | ||
12 | Documentation/power/runtime_pm.txt. | ||
9 | 13 | ||
10 | --------------------------------------------------------------------------- | 14 | --------------------------------------------------------------------------- |
11 | 15 | ||
12 | 1. Overview | 16 | 1. Hardware and Platform Support for PCI Power Management |
13 | 2. How the PCI Subsystem Does Power Management | 17 | 2. PCI Subsystem and Device Power Management |
14 | 3. PCI Utility Functions | 18 | 3. PCI Device Drivers and Power Management |
15 | 4. PCI Device Drivers | 19 | 4. Resources |
16 | 5. Resources | 20 | |
17 | 21 | ||
18 | 1. Overview | 22 | 1. Hardware and Platform Support for PCI Power Management |
19 | ~~~~~~~~~~~ | 23 | ========================================================= |
20 | 24 | ||
21 | The PCI Power Management Specification was introduced between the PCI 2.1 and | 25 | 1.1. Native and Platform-Based Power Management |
22 | PCI 2.2 Specifications. It a standard interface for controlling various | 26 | ----------------------------------------------- |
23 | power management operations. | 27 | In general, power management is a feature allowing one to save energy by putting |
24 | 28 | devices into states in which they draw less power (low-power states) at the | |
25 | Implementation of the PCI PM Spec is optional, as are several sub-components of | 29 | price of reduced functionality or performance. |
26 | it. If a device supports the PCI PM Spec, the device will have an 8 byte | 30 | |
27 | capability field in its PCI configuration space. This field is used to describe | 31 | Usually, a device is put into a low-power state when it is underutilized or |
28 | and control the standard PCI power management features. | 32 | completely inactive. However, when it is necessary to use the device once |
29 | 33 | again, it has to be put back into the "fully functional" state (full-power | |
30 | The PCI PM spec defines 4 operating states for devices (D0 - D3) and for buses | 34 | state). This may happen when there are some data for the device to handle or |
31 | (B0 - B3). The higher the number, the less power the device consumes. However, | 35 | as a result of an external event requiring the device to be active, which may |
32 | the higher the number, the longer the latency is for the device to return to | 36 | be signaled by the device itself. |
33 | an operational state (D0). | 37 | |
34 | 38 | PCI devices may be put into low-power states in two ways, by using the device | |
35 | There are actually two D3 states. When someone talks about D3, they usually | 39 | capabilities introduced by the PCI Bus Power Management Interface Specification, |
36 | mean D3hot, which corresponds to an ACPI D2 state (power is reduced, the | 40 | or with the help of platform firmware, such as an ACPI BIOS. In the first |
37 | device may lose some context). But they may also mean D3cold, which is an | 41 | approach, that is referred to as the native PCI power management (native PCI PM) |
38 | ACPI D3 state (power is fully off, all state was discarded); or both. | 42 | in what follows, the device power state is changed as a result of writing a |
39 | 43 | specific value into one of its standard configuration registers. The second | |
40 | Bus power management is not covered in this version of this document. | 44 | approach requires the platform firmware to provide special methods that may be |
41 | 45 | used by the kernel to change the device's power state. | |
42 | Note that all PCI devices support D0 and D3cold by default, regardless of | 46 | |
43 | whether or not they implement any of the PCI PM spec. | 47 | Devices supporting the native PCI PM usually can generate wakeup signals called |
44 | 48 | Power Management Events (PMEs) to let the kernel know about external events | |
45 | The possible state transitions that a device can undergo are: | 49 | requiring the device to be active. After receiving a PME the kernel is supposed |
46 | 50 | to put the device that sent it into the full-power state. However, the PCI Bus | |
47 | +---------------------------+ | 51 | Power Management Interface Specification doesn't define any standard method of |
48 | | Current State | New State | | 52 | delivering the PME from the device to the CPU and the operating system kernel. |
49 | +---------------------------+ | 53 | It is assumed that the platform firmware will perform this task and therefore, |
50 | | D0 | D1, D2, D3| | 54 | even though a PCI device is set up to generate PMEs, it also may be necessary to |
51 | +---------------------------+ | 55 | prepare the platform firmware for notifying the CPU of the PMEs coming from the |
52 | | D1 | D2, D3 | | 56 | device (e.g. by generating interrupts). |
53 | +---------------------------+ | 57 | |
54 | | D2 | D3 | | 58 | In turn, if the methods provided by the platform firmware are used for changing |
55 | +---------------------------+ | 59 | the power state of a device, usually the platform also provides a method for |
56 | | D1, D2, D3 | D0 | | 60 | preparing the device to generate wakeup signals. In that case, however, it |
57 | +---------------------------+ | 61 | often also is necessary to prepare the device for generating PMEs using the |
58 | 62 | native PCI PM mechanism, because the method provided by the platform depends on | |
59 | Note that when the system is entering a global suspend state, all devices will | 63 | that. |
60 | be placed into D3 and when resuming, all devices will be placed into D0. | 64 | |
61 | However, when the system is running, other state transitions are possible. | 65 | Thus in many situations both the native and the platform-based power management |
62 | 66 | mechanisms have to be used simultaneously to obtain the desired result. | |
63 | 2. How The PCI Subsystem Handles Power Management | 67 | |
64 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 68 | 1.2. Native PCI Power Management |
65 | 69 | -------------------------------- | |
66 | The PCI suspend/resume functionality is accessed indirectly via the Power | 70 | The PCI Bus Power Management Interface Specification (PCI PM Spec) was |
67 | Management subsystem. At boot, the PCI driver registers a power management | 71 | introduced between the PCI 2.1 and PCI 2.2 Specifications. It defined a |
68 | callback with that layer. Upon entering a suspend state, the PM layer iterates | 72 | standard interface for performing various operations related to power |
69 | through all of its registered callbacks. This currently takes place only during | 73 | management. |
70 | APM state transitions. | 74 | |
71 | 75 | The implementation of the PCI PM Spec is optional for conventional PCI devices, | |
72 | Upon going to sleep, the PCI subsystem walks its device tree twice. Both times, | 76 | but it is mandatory for PCI Express devices. If a device supports the PCI PM |
73 | it does a depth first walk of the device tree. The first walk saves each of the | 77 | Spec, it has an 8 byte power management capability field in its PCI |
74 | device's state and checks for devices that will prevent the system from entering | 78 | configuration space. This field is used to describe and control the standard |
75 | a global power state. The next walk then places the devices in a low power | 79 | features related to the native PCI power management. |
80 | |||
81 | The PCI PM Spec defines 4 operating states for devices (D0-D3) and for buses | ||
82 | (B0-B3). The higher the number, the less power is drawn by the device or bus | ||
83 | in that state. However, the higher the number, the longer the latency for | ||
84 | the device or bus to return to the full-power state (D0 or B0, respectively). | ||
85 | |||
86 | There are two variants of the D3 state defined by the specification. The first | ||
87 | one is D3hot, referred to as the software accessible D3, because devices can be | ||
88 | programmed to go into it. The second one, D3cold, is the state that PCI devices | ||
89 | are in when the supply voltage (Vcc) is removed from them. It is not possible | ||
90 | to program a PCI device to go into D3cold, although there may be a programmable | ||
91 | interface for putting the bus the device is on into a state in which Vcc is | ||
92 | removed from all devices on the bus. | ||
93 | |||
94 | PCI bus power management, however, is not supported by the Linux kernel at the | ||
95 | time of this writing and therefore it is not covered by this document. | ||
96 | |||
97 | Note that every PCI device can be in the full-power state (D0) or in D3cold, | ||
98 | regardless of whether or not it implements the PCI PM Spec. In addition to | ||
99 | that, if the PCI PM Spec is implemented by the device, it must support D3hot | ||
100 | as well as D0. The support for the D1 and D2 power states is optional. | ||
101 | |||
102 | PCI devices supporting the PCI PM Spec can be programmed to go to any of the | ||
103 | supported low-power states (except for D3cold). While in D1-D3hot the | ||
104 | standard configuration registers of the device must be accessible to software | ||
105 | (i.e. the device is required to respond to PCI configuration accesses), although | ||
106 | its I/O and memory spaces are then disabled. This allows the device to be | ||
107 | programmatically put into D0. Thus the kernel can switch the device back and | ||
108 | forth between D0 and the supported low-power states (except for D3cold) and the | ||
109 | possible power state transitions the device can undergo are the following: | ||
110 | |||
111 | +----------------------------+ | ||
112 | | Current State | New State | | ||
113 | +----------------------------+ | ||
114 | | D0 | D1, D2, D3 | | ||
115 | +----------------------------+ | ||
116 | | D1 | D2, D3 | | ||
117 | +----------------------------+ | ||
118 | | D2 | D3 | | ||
119 | +----------------------------+ | ||
120 | | D1, D2, D3 | D0 | | ||
121 | +----------------------------+ | ||
122 | |||
123 | The transition from D3cold to D0 occurs when the supply voltage is provided to | ||
124 | the device (i.e. power is restored). In that case the device returns to D0 with | ||
125 | a full power-on reset sequence and the power-on defaults are restored to the | ||
126 | device by hardware just as at initial power up. | ||
127 | |||
128 | PCI devices supporting the PCI PM Spec can be programmed to generate PMEs | ||
129 | while in a low-power state (D1-D3), but they are not required to be capable | ||
130 | of generating PMEs from all supported low-power states. In particular, the | ||
131 | capability of generating PMEs from D3cold is optional and depends on the | ||
132 | presence of additional voltage (3.3Vaux) allowing the device to remain | ||
133 | sufficiently active to generate a wakeup signal. | ||
134 | |||
135 | 1.3. ACPI Device Power Management | ||
136 | --------------------------------- | ||
137 | The platform firmware support for the power management of PCI devices is | ||
138 | system-specific. However, if the system in question is compliant with the | ||
139 | Advanced Configuration and Power Interface (ACPI) Specification, like the | ||
140 | majority of x86-based systems, it is supposed to implement device power | ||
141 | management interfaces defined by the ACPI standard. | ||
142 | |||
143 | For this purpose the ACPI BIOS provides special functions called "control | ||
144 | methods" that may be executed by the kernel to perform specific tasks, such as | ||
145 | putting a device into a low-power state. These control methods are encoded | ||
146 | using special byte-code language called the ACPI Machine Language (AML) and | ||
147 | stored in the machine's BIOS. The kernel loads them from the BIOS and executes | ||
148 | them as needed using an AML interpreter that translates the AML byte code into | ||
149 | computations and memory or I/O space accesses. This way, in theory, a BIOS | ||
150 | writer can provide the kernel with a means to perform actions depending | ||
151 | on the system design in a system-specific fashion. | ||
152 | |||
153 | ACPI control methods may be divided into global control methods, that are not | ||
154 | associated with any particular devices, and device control methods, that have | ||
155 | to be defined separately for each device supposed to be handled with the help of | ||
156 | the platform. This means, in particular, that ACPI device control methods can | ||
157 | only be used to handle devices that the BIOS writer knew about in advance. The | ||
158 | ACPI methods used for device power management fall into that category. | ||
159 | |||
160 | The ACPI specification assumes that devices can be in one of four power states | ||
161 | labeled as D0, D1, D2, and D3 that roughly correspond to the native PCI PM | ||
162 | D0-D3 states (although the difference between D3hot and D3cold is not taken | ||
163 | into account by ACPI). Moreover, for each power state of a device there is a | ||
164 | set of power resources that have to be enabled for the device to be put into | ||
165 | that state. These power resources are controlled (i.e. enabled or disabled) | ||
166 | with the help of their own control methods, _ON and _OFF, that have to be | ||
167 | defined individually for each of them. | ||
168 | |||
169 | To put a device into the ACPI power state Dx (where x is a number between 0 and | ||
170 | 3 inclusive) the kernel is supposed to (1) enable the power resources required | ||
171 | by the device in this state using their _ON control methods and (2) execute the | ||
172 | _PSx control method defined for the device. In addition to that, if the device | ||
173 | is going to be put into a low-power state (D1-D3) and is supposed to generate | ||
174 | wakeup signals from that state, the _DSW (or _PSW, replaced with _DSW by ACPI | ||
175 | 3.0) control method defined for it has to be executed before _PSx. Power | ||
176 | resources that are not required by the device in the target power state and are | ||
177 | not required any more by any other device should be disabled (by executing their | ||
178 | _OFF control methods). If the current power state of the device is D3, it can | ||
179 | only be put into D0 this way. | ||
180 | |||
181 | However, quite often the power states of devices are changed during a | ||
182 | system-wide transition into a sleep state or back into the working state. ACPI | ||
183 | defines four system sleep states, S1, S2, S3, and S4, and denotes the system | ||
184 | working state as S0. In general, the target system sleep (or working) state | ||
185 | determines the highest power (lowest number) state the device can be put | ||
186 | into and the kernel is supposed to obtain this information by executing the | ||
187 | device's _SxD control method (where x is a number between 0 and 4 inclusive). | ||
188 | If the device is required to wake up the system from the target sleep state, the | ||
189 | lowest power (highest number) state it can be put into is also determined by the | ||
190 | target state of the system. The kernel is then supposed to use the device's | ||
191 | _SxW control method to obtain the number of that state. It also is supposed to | ||
192 | use the device's _PRW control method to learn which power resources need to be | ||
193 | enabled for the device to be able to generate wakeup signals. | ||
194 | |||
195 | 1.4. Wakeup Signaling | ||
196 | --------------------- | ||
197 | Wakeup signals generated by PCI devices, either as native PCI PMEs, or as | ||
198 | a result of the execution of the _DSW (or _PSW) ACPI control method before | ||
199 | putting the device into a low-power state, have to be caught and handled as | ||
200 | appropriate. If they are sent while the system is in the working state | ||
201 | (ACPI S0), they should be translated into interrupts so that the kernel can | ||
202 | put the devices generating them into the full-power state and take care of the | ||
203 | events that triggered them. In turn, if they are sent while the system is | ||
204 | sleeping, they should cause the system's core logic to trigger wakeup. | ||
205 | |||
206 | On ACPI-based systems wakeup signals sent by conventional PCI devices are | ||
207 | converted into ACPI General-Purpose Events (GPEs) which are hardware signals | ||
208 | from the system core logic generated in response to various events that need to | ||
209 | be acted upon. Every GPE is associated with one or more sources of potentially | ||
210 | interesting events. In particular, a GPE may be associated with a PCI device | ||
211 | capable of signaling wakeup. The information on the connections between GPEs | ||
212 | and event sources is recorded in the system's ACPI BIOS from where it can be | ||
213 | read by the kernel. | ||
214 | |||
215 | If a PCI device known to the system's ACPI BIOS signals wakeup, the GPE | ||
216 | associated with it (if there is one) is triggered. The GPEs associated with PCI | ||
217 | bridges may also be triggered in response to a wakeup signal from one of the | ||
218 | devices below the bridge (this also is the case for root bridges) and, for | ||
219 | example, native PCI PMEs from devices unknown to the system's ACPI BIOS may be | ||
220 | handled this way. | ||
221 | |||
222 | A GPE may be triggered when the system is sleeping (i.e. when it is in one of | ||
223 | the ACPI S1-S4 states), in which case system wakeup is started by its core logic | ||
224 | (the device that was the source of the signal causing the system wakeup to occur | ||
225 | may be identified later). The GPEs used in such situations are referred to as | ||
226 | wakeup GPEs. | ||
227 | |||
228 | Usually, however, GPEs are also triggered when the system is in the working | ||
229 | state (ACPI S0) and in that case the system's core logic generates a System | ||
230 | Control Interrupt (SCI) to notify the kernel of the event. Then, the SCI | ||
231 | handler identifies the GPE that caused the interrupt to be generated which, | ||
232 | in turn, allows the kernel to identify the source of the event (that may be | ||
233 | a PCI device signaling wakeup). The GPEs used for notifying the kernel of | ||
234 | events occurring while the system is in the working state are referred to as | ||
235 | runtime GPEs. | ||
236 | |||
237 | Unfortunately, there is no standard way of handling wakeup signals sent by | ||
238 | conventional PCI devices on systems that are not ACPI-based, but there is one | ||
239 | for PCI Express devices. Namely, the PCI Express Base Specification introduced | ||
240 | a native mechanism for converting native PCI PMEs into interrupts generated by | ||
241 | root ports. For conventional PCI devices native PMEs are out-of-band, so they | ||
242 | are routed separately and they need not pass through bridges (in principle they | ||
243 | may be routed directly to the system's core logic), but for PCI Express devices | ||
244 | they are in-band messages that have to pass through the PCI Express hierarchy, | ||
245 | including the root port on the path from the device to the Root Complex. Thus | ||
246 | it was possible to introduce a mechanism by which a root port generates an | ||
247 | interrupt whenever it receives a PME message from one of the devices below it. | ||
248 | The PCI Express Requester ID of the device that sent the PME message is then | ||
249 | recorded in one of the root port's configuration registers from where it may be | ||
250 | read by the interrupt handler allowing the device to be identified. [PME | ||
251 | messages sent by PCI Express endpoints integrated with the Root Complex don't | ||
252 | pass through root ports, but instead they cause a Root Complex Event Collector | ||
253 | (if there is one) to generate interrupts.] | ||
254 | |||
255 | In principle the native PCI Express PME signaling may also be used on ACPI-based | ||
256 | systems along with the GPEs, but to use it the kernel has to ask the system's | ||
257 | ACPI BIOS to release control of root port configuration registers. The ACPI | ||
258 | BIOS, however, is not required to allow the kernel to control these registers | ||
259 | and if it doesn't do that, the kernel must not modify their contents. Of course | ||
260 | the native PCI Express PME signaling cannot be used by the kernel in that case. | ||
261 | |||
262 | |||
263 | 2. PCI Subsystem and Device Power Management | ||
264 | ============================================ | ||
265 | |||
266 | 2.1. Device Power Management Callbacks | ||
267 | -------------------------------------- | ||
268 | The PCI Subsystem participates in the power management of PCI devices in a | ||
269 | number of ways. First of all, it provides an intermediate code layer between | ||
270 | the device power management core (PM core) and PCI device drivers. | ||
271 | Specifically, the pm field of the PCI subsystem's struct bus_type object, | ||
272 | pci_bus_type, points to a struct dev_pm_ops object, pci_dev_pm_ops, containing | ||
273 | pointers to several device power management callbacks: | ||
274 | |||
275 | const struct dev_pm_ops pci_dev_pm_ops = { | ||
276 | .prepare = pci_pm_prepare, | ||
277 | .complete = pci_pm_complete, | ||
278 | .suspend = pci_pm_suspend, | ||
279 | .resume = pci_pm_resume, | ||
280 | .freeze = pci_pm_freeze, | ||
281 | .thaw = pci_pm_thaw, | ||
282 | .poweroff = pci_pm_poweroff, | ||
283 | .restore = pci_pm_restore, | ||
284 | .suspend_noirq = pci_pm_suspend_noirq, | ||
285 | .resume_noirq = pci_pm_resume_noirq, | ||
286 | .freeze_noirq = pci_pm_freeze_noirq, | ||
287 | .thaw_noirq = pci_pm_thaw_noirq, | ||
288 | .poweroff_noirq = pci_pm_poweroff_noirq, | ||
289 | .restore_noirq = pci_pm_restore_noirq, | ||
290 | .runtime_suspend = pci_pm_runtime_suspend, | ||
291 | .runtime_resume = pci_pm_runtime_resume, | ||
292 | .runtime_idle = pci_pm_runtime_idle, | ||
293 | }; | ||
294 | |||
295 | These callbacks are executed by the PM core in various situations related to | ||
296 | device power management and they, in turn, execute power management callbacks | ||
297 | provided by PCI device drivers. They also perform power management operations | ||
298 | involving some standard configuration registers of PCI devices that device | ||
299 | drivers need not know or care about. | ||
300 | |||
301 | The structure representing a PCI device, struct pci_dev, contains several fields | ||
302 | that these callbacks operate on: | ||
303 | |||
304 | struct pci_dev { | ||
305 | ... | ||
306 | pci_power_t current_state; /* Current operating state. */ | ||
307 | int pm_cap; /* PM capability offset in the | ||
308 | configuration space */ | ||
309 | unsigned int pme_support:5; /* Bitmask of states from which PME# | ||
310 | can be generated */ | ||
311 | unsigned int pme_interrupt:1;/* Is native PCIe PME signaling used? */ | ||
312 | unsigned int d1_support:1; /* Low power state D1 is supported */ | ||
313 | unsigned int d2_support:1; /* Low power state D2 is supported */ | ||
314 | unsigned int no_d1d2:1; /* D1 and D2 are forbidden */ | ||
315 | unsigned int wakeup_prepared:1; /* Device prepared for wake up */ | ||
316 | unsigned int d3_delay; /* D3->D0 transition time in ms */ | ||
317 | ... | ||
318 | }; | ||
319 | |||
320 | They also indirectly use some fields of the struct device that is embedded in | ||
321 | struct pci_dev. | ||
322 | |||
323 | 2.2. Device Initialization | ||
324 | -------------------------- | ||
325 | The PCI subsystem's first task related to device power management is to | ||
326 | prepare the device for power management and initialize the fields of struct | ||
327 | pci_dev used for this purpose. This happens in two functions defined in | ||
328 | drivers/pci/pci.c, pci_pm_init() and platform_pci_wakeup_init(). | ||
329 | |||
330 | The first of these functions checks if the device supports native PCI PM | ||
331 | and if that's the case the offset of its power management capability structure | ||
332 | in the configuration space is stored in the pm_cap field of the device's struct | ||
333 | pci_dev object. Next, the function checks which PCI low-power states are | ||
334 | supported by the device and from which low-power states the device can generate | ||
335 | native PCI PMEs. The power management fields of the device's struct pci_dev and | ||
336 | the struct device embedded in it are updated accordingly and the generation of | ||
337 | PMEs by the device is disabled. | ||
338 | |||
339 | The second function checks if the device can be prepared to signal wakeup with | ||
340 | the help of the platform firmware, such as the ACPI BIOS. If that is the case, | ||
341 | the function updates the wakeup fields in struct device embedded in the | ||
342 | device's struct pci_dev and uses the firmware-provided method to prevent the | ||
343 | device from signaling wakeup. | ||
344 | |||
345 | At this point the device is ready for power management. For driverless devices, | ||
346 | however, this functionality is limited to a few basic operations carried out | ||
347 | during system-wide transitions to a sleep state and back to the working state. | ||
348 | |||
349 | 2.3. Runtime Device Power Management | ||
350 | ------------------------------------ | ||
351 | The PCI subsystem plays a vital role in the runtime power management of PCI | ||
352 | devices. For this purpose it uses the general runtime power management | ||
353 | (runtime PM) framework described in Documentation/power/runtime_pm.txt. | ||
354 | Namely, it provides subsystem-level callbacks: | ||
355 | |||
356 | pci_pm_runtime_suspend() | ||
357 | pci_pm_runtime_resume() | ||
358 | pci_pm_runtime_idle() | ||
359 | |||
360 | that are executed by the core runtime PM routines. It also implements the | ||
361 | entire mechanics necessary for handling runtime wakeup signals from PCI devices | ||
362 | in low-power states, which at the time of this writing works for both the native | ||
363 | PCI Express PME signaling and the ACPI GPE-based wakeup signaling described in | ||
364 | Section 1. | ||
365 | |||
366 | First, a PCI device is put into a low-power state, or suspended, with the help | ||
367 | of pm_schedule_suspend() or pm_runtime_suspend() which for PCI devices call | ||
368 | pci_pm_runtime_suspend() to do the actual job. For this to work, the device's | ||
369 | driver has to provide a pm->runtime_suspend() callback (see below), which is | ||
370 | run by pci_pm_runtime_suspend() as the first action. If the driver's callback | ||
371 | returns successfully, the device's standard configuration registers are saved, | ||
372 | the device is prepared to generate wakeup signals and, finally, it is put into | ||
373 | the target low-power state. | ||
374 | |||
375 | The low-power state to put the device into is the lowest-power (highest number) | ||
376 | state from which it can signal wakeup. The exact method of signaling wakeup is | ||
377 | system-dependent and is determined by the PCI subsystem on the basis of the | ||
378 | reported capabilities of the device and the platform firmware. To prepare the | ||
379 | device for signaling wakeup and put it into the selected low-power state, the | ||
380 | PCI subsystem can use the platform firmware as well as the device's native PCI | ||
381 | PM capabilities, if supported. | ||
382 | |||
383 | It is expected that the device driver's pm->runtime_suspend() callback will | ||
384 | not attempt to prepare the device for signaling wakeup or to put it into a | ||
385 | low-power state. The driver ought to leave these tasks to the PCI subsystem | ||
386 | that has all of the information necessary to perform them. | ||
387 | |||
388 | A suspended device is brought back into the "active" state, or resumed, | ||
389 | with the help of pm_request_resume() or pm_runtime_resume() which both call | ||
390 | pci_pm_runtime_resume() for PCI devices. Again, this only works if the device's | ||
391 | driver provides a pm->runtime_resume() callback (see below). However, before | ||
392 | the driver's callback is executed, pci_pm_runtime_resume() brings the device | ||
393 | back into the full-power state, prevents it from signaling wakeup while in that | ||
394 | state and restores its standard configuration registers. Thus the driver's | ||
395 | callback need not worry about the PCI-specific aspects of the device resume. | ||
396 | |||
397 | Note that generally pci_pm_runtime_resume() may be called in two different | ||
398 | situations. First, it may be called at the request of the device's driver, for | ||
399 | example if there are some data for it to process. Second, it may be called | ||
400 | as a result of a wakeup signal from the device itself (this sometimes is | ||
401 | referred to as "remote wakeup"). Of course, for this purpose the wakeup signal | ||
402 | is handled in one of the ways described in Section 1 and finally converted into | ||
403 | a notification for the PCI subsystem after the source device has been | ||
404 | identified. | ||
405 | |||
406 | The pci_pm_runtime_idle() function, called for PCI devices by pm_runtime_idle() | ||
407 | and pm_request_idle(), executes the device driver's pm->runtime_idle() | ||
408 | callback, if defined, and if that callback doesn't return error code (or is not | ||
409 | present at all), suspends the device with the help of pm_runtime_suspend(). | ||
410 | Sometimes pci_pm_runtime_idle() is called automatically by the PM core (for | ||
411 | example, it is called right after the device has just been resumed), in which | ||
412 | cases it is expected to suspend the device if that makes sense. Usually, | ||
413 | however, the PCI subsystem doesn't really know if the device really can be | ||
414 | suspended, so it lets the device's driver decide by running its | ||
415 | pm->runtime_idle() callback. | ||
416 | |||
417 | 2.4. System-Wide Power Transitions | ||
418 | ---------------------------------- | ||
419 | There are a few different types of system-wide power transitions, described in | ||
420 | Documentation/power/devices.txt. Each of them requires devices to be handled | ||
421 | in a specific way and the PM core executes subsystem-level power management | ||
422 | callbacks for this purpose. They are executed in phases such that each phase | ||
423 | involves executing the same subsystem-level callback for every device belonging | ||
424 | to the given subsystem before the next phase begins. These phases always run | ||
425 | after tasks have been frozen. | ||
426 | |||
427 | 2.4.1. System Suspend | ||
428 | |||
429 | When the system is going into a sleep state in which the contents of memory will | ||
430 | be preserved, such as one of the ACPI sleep states S1-S3, the phases are: | ||
431 | |||
432 | prepare, suspend, suspend_noirq. | ||
433 | |||
434 | The following PCI bus type's callbacks, respectively, are used in these phases: | ||
435 | |||
436 | pci_pm_prepare() | ||
437 | pci_pm_suspend() | ||
438 | pci_pm_suspend_noirq() | ||
439 | |||
440 | The pci_pm_prepare() routine first puts the device into the "fully functional" | ||
441 | state with the help of pm_runtime_resume(). Then, it executes the device | ||
442 | driver's pm->prepare() callback if defined (i.e. if the driver's struct | ||
443 | dev_pm_ops object is present and the prepare pointer in that object is valid). | ||
444 | |||
445 | The pci_pm_suspend() routine first checks if the device's driver implements | ||
446 | legacy PCI suspend routines (see Section 3), in which case the driver's legacy | ||
447 | suspend callback is executed, if present, and its result is returned. Next, if | ||
448 | the device's driver doesn't provide a struct dev_pm_ops object (containing | ||
449 | pointers to the driver's callbacks), pci_pm_default_suspend() is called, which | ||
450 | simply turns off the device's bus master capability and runs | ||
451 | pcibios_disable_device() to disable it, unless the device is a bridge (PCI | ||
452 | bridges are ignored by this routine). Next, the device driver's pm->suspend() | ||
453 | callback is executed, if defined, and its result is returned if it fails. | ||
454 | Finally, pci_fixup_device() is called to apply hardware suspend quirks related | ||
455 | to the device if necessary. | ||
456 | |||
457 | Note that the suspend phase is carried out asynchronously for PCI devices, so | ||
458 | the pci_pm_suspend() callback may be executed in parallel for any pair of PCI | ||
459 | devices that don't depend on each other in a known way (i.e. none of the paths | ||
460 | in the device tree from the root bridge to a leaf device contains both of them). | ||
461 | |||
462 | The pci_pm_suspend_noirq() routine is executed after suspend_device_irqs() has | ||
463 | been called, which means that the device driver's interrupt handler won't be | ||
464 | invoked while this routine is running. It first checks if the device's driver | ||
465 | implements legacy PCI suspends routines (Section 3), in which case the legacy | ||
466 | late suspend routine is called and its result is returned (the standard | ||
467 | configuration registers of the device are saved if the driver's callback hasn't | ||
468 | done that). Second, if the device driver's struct dev_pm_ops object is not | ||
469 | present, the device's standard configuration registers are saved and the routine | ||
470 | returns success. Otherwise the device driver's pm->suspend_noirq() callback is | ||
471 | executed, if present, and its result is returned if it fails. Next, if the | ||
472 | device's standard configuration registers haven't been saved yet (one of the | ||
473 | device driver's callbacks executed before might do that), pci_pm_suspend_noirq() | ||
474 | saves them, prepares the device to signal wakeup (if necessary) and puts it into | ||
475 | a low-power state. | ||
476 | |||
477 | The low-power state to put the device into is the lowest-power (highest number) | ||
478 | state from which it can signal wakeup while the system is in the target sleep | ||
479 | state. Just like in the runtime PM case described above, the mechanism of | ||
480 | signaling wakeup is system-dependent and determined by the PCI subsystem, which | ||
481 | is also responsible for preparing the device to signal wakeup from the system's | ||
482 | target sleep state as appropriate. | ||
483 | |||
484 | PCI device drivers (that don't implement legacy power management callbacks) are | ||
485 | generally not expected to prepare devices for signaling wakeup or to put them | ||
486 | into low-power states. However, if one of the driver's suspend callbacks | ||
487 | (pm->suspend() or pm->suspend_noirq()) saves the device's standard configuration | ||
488 | registers, pci_pm_suspend_noirq() will assume that the device has been prepared | ||
489 | to signal wakeup and put into a low-power state by the driver (the driver is | ||
490 | then assumed to have used the helper functions provided by the PCI subsystem for | ||
491 | this purpose). PCI device drivers are not encouraged to do that, but in some | ||
492 | rare cases doing that in the driver may be the optimum approach. | ||
493 | |||
494 | 2.4.2. System Resume | ||
495 | |||
496 | When the system is undergoing a transition from a sleep state in which the | ||
497 | contents of memory have been preserved, such as one of the ACPI sleep states | ||
498 | S1-S3, into the working state (ACPI S0), the phases are: | ||
499 | |||
500 | resume_noirq, resume, complete. | ||
501 | |||
502 | The following PCI bus type's callbacks, respectively, are executed in these | ||
503 | phases: | ||
504 | |||
505 | pci_pm_resume_noirq() | ||
506 | pci_pm_resume() | ||
507 | pci_pm_complete() | ||
508 | |||
509 | The pci_pm_resume_noirq() routine first puts the device into the full-power | ||
510 | state, restores its standard configuration registers and applies early resume | ||
511 | hardware quirks related to the device, if necessary. This is done | ||
512 | unconditionally, regardless of whether or not the device's driver implements | ||
513 | legacy PCI power management callbacks (this way all PCI devices are in the | ||
514 | full-power state and their standard configuration registers have been restored | ||
515 | when their interrupt handlers are invoked for the first time during resume, | ||
516 | which allows the kernel to avoid problems with the handling of shared interrupts | ||
517 | by drivers whose devices are still suspended). If legacy PCI power management | ||
518 | callbacks (see Section 3) are implemented by the device's driver, the legacy | ||
519 | early resume callback is executed and its result is returned. Otherwise, the | ||
520 | device driver's pm->resume_noirq() callback is executed, if defined, and its | ||
521 | result is returned. | ||
522 | |||
523 | The pci_pm_resume() routine first checks if the device's standard configuration | ||
524 | registers have been restored and restores them if that's not the case (this | ||
525 | only is necessary in the error path during a failing suspend). Next, resume | ||
526 | hardware quirks related to the device are applied, if necessary, and if the | ||
527 | device's driver implements legacy PCI power management callbacks (see | ||
528 | Section 3), the driver's legacy resume callback is executed and its result is | ||
529 | returned. Otherwise, the device's wakeup signaling mechanisms are blocked and | ||
530 | its driver's pm->resume() callback is executed, if defined (the callback's | ||
531 | result is then returned). | ||
532 | |||
533 | The resume phase is carried out asynchronously for PCI devices, like the | ||
534 | suspend phase described above, which means that if two PCI devices don't depend | ||
535 | on each other in a known way, the pci_pm_resume() routine may be executed for | ||
536 | the both of them in parallel. | ||
537 | |||
538 | The pci_pm_complete() routine only executes the device driver's pm->complete() | ||
539 | callback, if defined. | ||
540 | |||
541 | 2.4.3. System Hibernation | ||
542 | |||
543 | System hibernation is more complicated than system suspend, because it requires | ||
544 | a system image to be created and written into a persistent storage medium. The | ||
545 | image is created atomically and all devices are quiesced, or frozen, before that | ||
546 | happens. | ||
547 | |||
548 | The freezing of devices is carried out after enough memory has been freed (at | ||
549 | the time of this writing the image creation requires at least 50% of system RAM | ||
550 | to be free) in the following three phases: | ||
551 | |||
552 | prepare, freeze, freeze_noirq | ||
553 | |||
554 | that correspond to the PCI bus type's callbacks: | ||
555 | |||
556 | pci_pm_prepare() | ||
557 | pci_pm_freeze() | ||
558 | pci_pm_freeze_noirq() | ||
559 | |||
560 | This means that the prepare phase is exactly the same as for system suspend. | ||
561 | The other two phases, however, are different. | ||
562 | |||
563 | The pci_pm_freeze() routine is quite similar to pci_pm_suspend(), but it runs | ||
564 | the device driver's pm->freeze() callback, if defined, instead of pm->suspend(), | ||
565 | and it doesn't apply the suspend-related hardware quirks. It is executed | ||
566 | asynchronously for different PCI devices that don't depend on each other in a | ||
567 | known way. | ||
568 | |||
569 | The pci_pm_freeze_noirq() routine, in turn, is similar to | ||
570 | pci_pm_suspend_noirq(), but it calls the device driver's pm->freeze_noirq() | ||
571 | routine instead of pm->suspend_noirq(). It also doesn't attempt to prepare the | ||
572 | device for signaling wakeup and put it into a low-power state. Still, it saves | ||
573 | the device's standard configuration registers if they haven't been saved by one | ||
574 | of the driver's callbacks. | ||
575 | |||
576 | Once the image has been created, it has to be saved. However, at this point all | ||
577 | devices are frozen and they cannot handle I/O, while their ability to handle | ||
578 | I/O is obviously necessary for the image saving. Thus they have to be brought | ||
579 | back to the fully functional state and this is done in the following phases: | ||
580 | |||
581 | thaw_noirq, thaw, complete | ||
582 | |||
583 | using the following PCI bus type's callbacks: | ||
584 | |||
585 | pci_pm_thaw_noirq() | ||
586 | pci_pm_thaw() | ||
587 | pci_pm_complete() | ||
588 | |||
589 | respectively. | ||
590 | |||
591 | The first of them, pci_pm_thaw_noirq(), is analogous to pci_pm_resume_noirq(), | ||
592 | but it doesn't put the device into the full power state and doesn't attempt to | ||
593 | restore its standard configuration registers. It also executes the device | ||
594 | driver's pm->thaw_noirq() callback, if defined, instead of pm->resume_noirq(). | ||
595 | |||
596 | The pci_pm_thaw() routine is similar to pci_pm_resume(), but it runs the device | ||
597 | driver's pm->thaw() callback instead of pm->resume(). It is executed | ||
598 | asynchronously for different PCI devices that don't depend on each other in a | ||
599 | known way. | ||
600 | |||
601 | The complete phase it the same as for system resume. | ||
602 | |||
603 | After saving the image, devices need to be powered down before the system can | ||
604 | enter the target sleep state (ACPI S4 for ACPI-based systems). This is done in | ||
605 | three phases: | ||
606 | |||
607 | prepare, poweroff, poweroff_noirq | ||
608 | |||
609 | where the prepare phase is exactly the same as for system suspend. The other | ||
610 | two phases are analogous to the suspend and suspend_noirq phases, respectively. | ||
611 | The PCI subsystem-level callbacks they correspond to | ||
612 | |||
613 | pci_pm_poweroff() | ||
614 | pci_pm_poweroff_noirq() | ||
615 | |||
616 | work in analogy with pci_pm_suspend() and pci_pm_poweroff_noirq(), respectively, | ||
617 | although they don't attempt to save the device's standard configuration | ||
618 | registers. | ||
619 | |||
620 | 2.4.4. System Restore | ||
621 | |||
622 | System restore requires a hibernation image to be loaded into memory and the | ||
623 | pre-hibernation memory contents to be restored before the pre-hibernation system | ||
624 | activity can be resumed. | ||
625 | |||
626 | As described in Documentation/power/devices.txt, the hibernation image is loaded | ||
627 | into memory by a fresh instance of the kernel, called the boot kernel, which in | ||
628 | turn is loaded and run by a boot loader in the usual way. After the boot kernel | ||
629 | has loaded the image, it needs to replace its own code and data with the code | ||
630 | and data of the "hibernated" kernel stored within the image, called the image | ||
631 | kernel. For this purpose all devices are frozen just like before creating | ||
632 | the image during hibernation, in the | ||
633 | |||
634 | prepare, freeze, freeze_noirq | ||
635 | |||
636 | phases described above. However, the devices affected by these phases are only | ||
637 | those having drivers in the boot kernel; other devices will still be in whatever | ||
638 | state the boot loader left them. | ||
639 | |||
640 | Should the restoration of the pre-hibernation memory contents fail, the boot | ||
641 | kernel would go through the "thawing" procedure described above, using the | ||
642 | thaw_noirq, thaw, and complete phases (that will only affect the devices having | ||
643 | drivers in the boot kernel), and then continue running normally. | ||
644 | |||
645 | If the pre-hibernation memory contents are restored successfully, which is the | ||
646 | usual situation, control is passed to the image kernel, which then becomes | ||
647 | responsible for bringing the system back to the working state. To achieve this, | ||
648 | it must restore the devices' pre-hibernation functionality, which is done much | ||
649 | like waking up from the memory sleep state, although it involves different | ||
650 | phases: | ||
651 | |||
652 | restore_noirq, restore, complete | ||
653 | |||
654 | The first two of these are analogous to the resume_noirq and resume phases | ||
655 | described above, respectively, and correspond to the following PCI subsystem | ||
656 | callbacks: | ||
657 | |||
658 | pci_pm_restore_noirq() | ||
659 | pci_pm_restore() | ||
660 | |||
661 | These callbacks work in analogy with pci_pm_resume_noirq() and pci_pm_resume(), | ||
662 | respectively, but they execute the device driver's pm->restore_noirq() and | ||
663 | pm->restore() callbacks, if available. | ||
664 | |||
665 | The complete phase is carried out in exactly the same way as during system | ||
666 | resume. | ||
667 | |||
668 | |||
669 | 3. PCI Device Drivers and Power Management | ||
670 | ========================================== | ||
671 | |||
672 | 3.1. Power Management Callbacks | ||
673 | ------------------------------- | ||
674 | PCI device drivers participate in power management by providing callbacks to be | ||
675 | executed by the PCI subsystem's power management routines described above and by | ||
676 | controlling the runtime power management of their devices. | ||
677 | |||
678 | At the time of this writing there are two ways to define power management | ||
679 | callbacks for a PCI device driver, the recommended one, based on using a | ||
680 | dev_pm_ops structure described in Documentation/power/devices.txt, and the | ||
681 | "legacy" one, in which the .suspend(), .suspend_late(), .resume_early(), and | ||
682 | .resume() callbacks from struct pci_driver are used. The legacy approach, | ||
683 | however, doesn't allow one to define runtime power management callbacks and is | ||
684 | not really suitable for any new drivers. Therefore it is not covered by this | ||
685 | document (refer to the source code to learn more about it). | ||
686 | |||
687 | It is recommended that all PCI device drivers define a struct dev_pm_ops object | ||
688 | containing pointers to power management (PM) callbacks that will be executed by | ||
689 | the PCI subsystem's PM routines in various circumstances. A pointer to the | ||
690 | driver's struct dev_pm_ops object has to be assigned to the driver.pm field in | ||
691 | its struct pci_driver object. Once that has happened, the "legacy" PM callbacks | ||
692 | in struct pci_driver are ignored (even if they are not NULL). | ||
693 | |||
694 | The PM callbacks in struct dev_pm_ops are not mandatory and if they are not | ||
695 | defined (i.e. the respective fields of struct dev_pm_ops are unset) the PCI | ||
696 | subsystem will handle the device in a simplified default manner. If they are | ||
697 | defined, though, they are expected to behave as described in the following | ||
698 | subsections. | ||
699 | |||
700 | 3.1.1. prepare() | ||
701 | |||
702 | The prepare() callback is executed during system suspend, during hibernation | ||
703 | (when a hibernation image is about to be created), during power-off after | ||
704 | saving a hibernation image and during system restore, when a hibernation image | ||
705 | has just been loaded into memory. | ||
706 | |||
707 | This callback is only necessary if the driver's device has children that in | ||
708 | general may be registered at any time. In that case the role of the prepare() | ||
709 | callback is to prevent new children of the device from being registered until | ||
710 | one of the resume_noirq(), thaw_noirq(), or restore_noirq() callbacks is run. | ||
711 | |||
712 | In addition to that the prepare() callback may carry out some operations | ||
713 | preparing the device to be suspended, although it should not allocate memory | ||
714 | (if additional memory is required to suspend the device, it has to be | ||
715 | preallocated earlier, for example in a suspend/hibernate notifier as described | ||
716 | in Documentation/power/notifiers.txt). | ||
717 | |||
718 | 3.1.2. suspend() | ||
719 | |||
720 | The suspend() callback is only executed during system suspend, after prepare() | ||
721 | callbacks have been executed for all devices in the system. | ||
722 | |||
723 | This callback is expected to quiesce the device and prepare it to be put into a | ||
724 | low-power state by the PCI subsystem. It is not required (in fact it even is | ||
725 | not recommended) that a PCI driver's suspend() callback save the standard | ||
726 | configuration registers of the device, prepare it for waking up the system, or | ||
727 | put it into a low-power state. All of these operations can very well be taken | ||
728 | care of by the PCI subsystem, without the driver's participation. | ||
729 | |||
730 | However, in some rare case it is convenient to carry out these operations in | ||
731 | a PCI driver. Then, pci_save_state(), pci_prepare_to_sleep(), and | ||
732 | pci_set_power_state() should be used to save the device's standard configuration | ||
733 | registers, to prepare it for system wakeup (if necessary), and to put it into a | ||
734 | low-power state, respectively. Moreover, if the driver calls pci_save_state(), | ||
735 | the PCI subsystem will not execute either pci_prepare_to_sleep(), or | ||
736 | pci_set_power_state() for its device, so the driver is then responsible for | ||
737 | handling the device as appropriate. | ||
738 | |||
739 | While the suspend() callback is being executed, the driver's interrupt handler | ||
740 | can be invoked to handle an interrupt from the device, so all suspend-related | ||
741 | operations relying on the driver's ability to handle interrupts should be | ||
742 | carried out in this callback. | ||
743 | |||
744 | 3.1.3. suspend_noirq() | ||
745 | |||
746 | The suspend_noirq() callback is only executed during system suspend, after | ||
747 | suspend() callbacks have been executed for all devices in the system and | ||
748 | after device interrupts have been disabled by the PM core. | ||
749 | |||
750 | The difference between suspend_noirq() and suspend() is that the driver's | ||
751 | interrupt handler will not be invoked while suspend_noirq() is running. Thus | ||
752 | suspend_noirq() can carry out operations that would cause race conditions to | ||
753 | arise if they were performed in suspend(). | ||
754 | |||
755 | 3.1.4. freeze() | ||
756 | |||
757 | The freeze() callback is hibernation-specific and is executed in two situations, | ||
758 | during hibernation, after prepare() callbacks have been executed for all devices | ||
759 | in preparation for the creation of a system image, and during restore, | ||
760 | after a system image has been loaded into memory from persistent storage and the | ||
761 | prepare() callbacks have been executed for all devices. | ||
762 | |||
763 | The role of this callback is analogous to the role of the suspend() callback | ||
764 | described above. In fact, they only need to be different in the rare cases when | ||
765 | the driver takes the responsibility for putting the device into a low-power | ||
76 | state. | 766 | state. |
77 | 767 | ||
78 | The first walk allows a graceful recovery in the event of a failure, since none | 768 | In that cases the freeze() callback should not prepare the device system wakeup |
79 | of the devices have actually been powered down. | 769 | or put it into a low-power state. Still, either it or freeze_noirq() should |
80 | 770 | save the device's standard configuration registers using pci_save_state(). | |
81 | In both walks, in particular the second, all children of a bridge are touched | ||
82 | before the actual bridge itself. This allows the bridge to retain power while | ||
83 | its children are being accessed. | ||
84 | |||
85 | Upon resuming from sleep, just the opposite must be true: all bridges must be | ||
86 | powered on and restored before their children are powered on. This is easily | ||
87 | accomplished with a breadth-first walk of the PCI device tree. | ||
88 | |||
89 | |||
90 | 3. PCI Utility Functions | ||
91 | ~~~~~~~~~~~~~~~~~~~~~~~~ | ||
92 | |||
93 | These are helper functions designed to be called by individual device drivers. | ||
94 | Assuming that a device behaves as advertised, these should be applicable in most | ||
95 | cases. However, results may vary. | ||
96 | |||
97 | Note that these functions are never implicitly called for the driver. The driver | ||
98 | is always responsible for deciding when and if to call these. | ||
99 | |||
100 | |||
101 | pci_save_state | ||
102 | -------------- | ||
103 | |||
104 | Usage: | ||
105 | pci_save_state(struct pci_dev *dev); | ||
106 | |||
107 | Description: | ||
108 | Save first 64 bytes of PCI config space, along with any additional | ||
109 | PCI-Express or PCI-X information. | ||
110 | |||
111 | |||
112 | pci_restore_state | ||
113 | ----------------- | ||
114 | |||
115 | Usage: | ||
116 | pci_restore_state(struct pci_dev *dev); | ||
117 | |||
118 | Description: | ||
119 | Restore previously saved config space. | ||
120 | |||
121 | |||
122 | pci_set_power_state | ||
123 | ------------------- | ||
124 | |||
125 | Usage: | ||
126 | pci_set_power_state(struct pci_dev *dev, pci_power_t state); | ||
127 | |||
128 | Description: | ||
129 | Transition device to low power state using PCI PM Capabilities | ||
130 | registers. | ||
131 | |||
132 | Will fail under one of the following conditions: | ||
133 | - If state is less than current state, but not D0 (illegal transition) | ||
134 | - Device doesn't support PM Capabilities | ||
135 | - Device does not support requested state | ||
136 | |||
137 | |||
138 | pci_enable_wake | ||
139 | --------------- | ||
140 | |||
141 | Usage: | ||
142 | pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); | ||
143 | |||
144 | Description: | ||
145 | Enable device to generate PME# during low power state using PCI PM | ||
146 | Capabilities. | ||
147 | |||
148 | Checks whether if device supports generating PME# from requested state | ||
149 | and fail if it does not, unless enable == 0 (request is to disable wake | ||
150 | events, which is implicit if it doesn't even support it in the first | ||
151 | place). | ||
152 | |||
153 | Note that the PMC Register in the device's PM Capabilities has a bitmask | ||
154 | of the states it supports generating PME# from. D3hot is bit 3 and | ||
155 | D3cold is bit 4. So, while a value of 4 as the state may not seem | ||
156 | semantically correct, it is. | ||
157 | |||
158 | |||
159 | 4. PCI Device Drivers | ||
160 | ~~~~~~~~~~~~~~~~~~~~~ | ||
161 | |||
162 | These functions are intended for use by individual drivers, and are defined in | ||
163 | struct pci_driver: | ||
164 | |||
165 | int (*suspend) (struct pci_dev *dev, pm_message_t state); | ||
166 | int (*resume) (struct pci_dev *dev); | ||
167 | |||
168 | |||
169 | suspend | ||
170 | ------- | ||
171 | |||
172 | Usage: | ||
173 | |||
174 | if (dev->driver && dev->driver->suspend) | ||
175 | dev->driver->suspend(dev,state); | ||
176 | |||
177 | A driver uses this function to actually transition the device into a low power | ||
178 | state. This should include disabling I/O, IRQs, and bus-mastering, as well as | ||
179 | physically transitioning the device to a lower power state; it may also include | ||
180 | calls to pci_enable_wake(). | ||
181 | |||
182 | Bus mastering may be disabled by doing: | ||
183 | |||
184 | pci_disable_device(dev); | ||
185 | |||
186 | For devices that support the PCI PM Spec, this may be used to set the device's | ||
187 | power state to match the suspend() parameter: | ||
188 | |||
189 | pci_set_power_state(dev,state); | ||
190 | |||
191 | The driver is also responsible for disabling any other device-specific features | ||
192 | (e.g blanking screen, turning off on-card memory, etc). | ||
193 | |||
194 | The driver should be sure to track the current state of the device, as it may | ||
195 | obviate the need for some operations. | ||
196 | |||
197 | The driver should update the current_state field in its pci_dev structure in | ||
198 | this function, except for PM-capable devices when pci_set_power_state is used. | ||
199 | |||
200 | resume | ||
201 | ------ | ||
202 | |||
203 | Usage: | ||
204 | |||
205 | if (dev->driver && dev->driver->resume) | ||
206 | dev->driver->resume(dev) | ||
207 | 771 | ||
208 | The resume callback may be called from any power state, and is always meant to | 772 | 3.1.5. freeze_noirq() |
209 | transition the device to the D0 state. | ||
210 | 773 | ||
211 | The driver is responsible for reenabling any features of the device that had | 774 | The freeze_noirq() callback is hibernation-specific. It is executed during |
212 | been disabled during previous suspend calls, such as IRQs and bus mastering, | 775 | hibernation, after prepare() and freeze() callbacks have been executed for all |
213 | as well as calling pci_restore_state(). | 776 | devices in preparation for the creation of a system image, and during restore, |
777 | after a system image has been loaded into memory and after prepare() and | ||
778 | freeze() callbacks have been executed for all devices. It is always executed | ||
779 | after device interrupts have been disabled by the PM core. | ||
214 | 780 | ||
215 | If the device is currently in D3, it may need to be reinitialized in resume(). | 781 | The role of this callback is analogous to the role of the suspend_noirq() |
782 | callback described above and it very rarely is necessary to define | ||
783 | freeze_noirq(). | ||
216 | 784 | ||
217 | * Some types of devices, like bus controllers, will preserve context in D3hot | 785 | The difference between freeze_noirq() and freeze() is analogous to the |
218 | (using Vcc power). Their drivers will often want to avoid re-initializing | 786 | difference between suspend_noirq() and suspend(). |
219 | them after re-entering D0 (perhaps to avoid resetting downstream devices). | ||
220 | 787 | ||
221 | * Other kinds of devices in D3hot will discard device context as part of a | 788 | 3.1.6. poweroff() |
222 | soft reset when re-entering the D0 state. | ||
223 | |||
224 | * Devices resuming from D3cold always go through a power-on reset. Some | ||
225 | device context can also be preserved using Vaux power. | ||
226 | 789 | ||
227 | * Some systems hide D3cold resume paths from drivers. For example, on PCs | 790 | The poweroff() callback is hibernation-specific. It is executed when the system |
228 | the resume path for suspend-to-disk often runs BIOS powerup code, which | 791 | is about to be powered off after saving a hibernation image to a persistent |
229 | will sometimes re-initialize the device. | 792 | storage. prepare() callbacks are executed for all devices before poweroff() is |
793 | called. | ||
230 | 794 | ||
231 | To handle resets during D3 to D0 transitions, it may be convenient to share | 795 | The role of this callback is analogous to the role of the suspend() and freeze() |
232 | device initialization code between probe() and resume(). Device parameters | 796 | callbacks described above, although it does not need to save the contents of |
233 | can also be saved before the driver suspends into D3, avoiding re-probe. | 797 | the device's registers. In particular, if the driver wants to put the device |
798 | into a low-power state itself instead of allowing the PCI subsystem to do that, | ||
799 | the poweroff() callback should use pci_prepare_to_sleep() and | ||
800 | pci_set_power_state() to prepare the device for system wakeup and to put it | ||
801 | into a low-power state, respectively, but it need not save the device's standard | ||
802 | configuration registers. | ||
234 | 803 | ||
235 | If the device supports the PCI PM Spec, it can use this to physically transition | 804 | 3.1.7. poweroff_noirq() |
236 | the device to D0: | ||
237 | 805 | ||
238 | pci_set_power_state(dev,0); | 806 | The poweroff_noirq() callback is hibernation-specific. It is executed after |
807 | poweroff() callbacks have been executed for all devices in the system. | ||
239 | 808 | ||
240 | Note that if the entire system is transitioning out of a global sleep state, all | 809 | The role of this callback is analogous to the role of the suspend_noirq() and |
241 | devices will be placed in the D0 state, so this is not necessary. However, in | 810 | freeze_noirq() callbacks described above, but it does not need to save the |
242 | the event that the device is placed in the D3 state during normal operation, | 811 | contents of the device's registers. |
243 | this call is necessary. It is impossible to determine which of the two events is | ||
244 | taking place in the driver, so it is always a good idea to make that call. | ||
245 | 812 | ||
246 | The driver should take note of the state that it is resuming from in order to | 813 | The difference between poweroff_noirq() and poweroff() is analogous to the |
247 | ensure correct (and speedy) operation. | 814 | difference between suspend_noirq() and suspend(). |
248 | 815 | ||
249 | The driver should update the current_state field in its pci_dev structure in | 816 | 3.1.8. resume_noirq() |
250 | this function, except for PM-capable devices when pci_set_power_state is used. | ||
251 | 817 | ||
818 | The resume_noirq() callback is only executed during system resume, after the | ||
819 | PM core has enabled the non-boot CPUs. The driver's interrupt handler will not | ||
820 | be invoked while resume_noirq() is running, so this callback can carry out | ||
821 | operations that might race with the interrupt handler. | ||
252 | 822 | ||
823 | Since the PCI subsystem unconditionally puts all devices into the full power | ||
824 | state in the resume_noirq phase of system resume and restores their standard | ||
825 | configuration registers, resume_noirq() is usually not necessary. In general | ||
826 | it should only be used for performing operations that would lead to race | ||
827 | conditions if carried out by resume(). | ||
253 | 828 | ||
254 | A reference implementation | 829 | 3.1.9. resume() |
255 | ------------------------- | ||
256 | .suspend() | ||
257 | { | ||
258 | /* driver specific operations */ | ||
259 | 830 | ||
260 | /* Disable IRQ */ | 831 | The resume() callback is only executed during system resume, after |
261 | free_irq(); | 832 | resume_noirq() callbacks have been executed for all devices in the system and |
262 | /* If using MSI */ | 833 | device interrupts have been enabled by the PM core. |
263 | pci_disable_msi(); | ||
264 | 834 | ||
265 | pci_save_state(); | 835 | This callback is responsible for restoring the pre-suspend configuration of the |
266 | pci_enable_wake(); | 836 | device and bringing it back to the fully functional state. The device should be |
267 | /* Disable IO/bus master/irq router */ | 837 | able to process I/O in a usual way after resume() has returned. |
268 | pci_disable_device(); | ||
269 | pci_set_power_state(pci_choose_state()); | ||
270 | } | ||
271 | 838 | ||
272 | .resume() | 839 | 3.1.10. thaw_noirq() |
273 | { | ||
274 | pci_set_power_state(PCI_D0); | ||
275 | pci_restore_state(); | ||
276 | /* device's irq possibly is changed, driver should take care */ | ||
277 | pci_enable_device(); | ||
278 | pci_set_master(); | ||
279 | 840 | ||
280 | /* if using MSI, device's vector possibly is changed */ | 841 | The thaw_noirq() callback is hibernation-specific. It is executed after a |
281 | pci_enable_msi(); | 842 | system image has been created and the non-boot CPUs have been enabled by the PM |
843 | core, in the thaw_noirq phase of hibernation. It also may be executed if the | ||
844 | loading of a hibernation image fails during system restore (it is then executed | ||
845 | after enabling the non-boot CPUs). The driver's interrupt handler will not be | ||
846 | invoked while thaw_noirq() is running. | ||
282 | 847 | ||
283 | request_irq(); | 848 | The role of this callback is analogous to the role of resume_noirq(). The |
284 | /* driver specific operations; */ | 849 | difference between these two callbacks is that thaw_noirq() is executed after |
285 | } | 850 | freeze() and freeze_noirq(), so in general it does not need to modify the |
851 | contents of the device's registers. | ||
286 | 852 | ||
287 | This is a typical implementation. Drivers can slightly change the order | 853 | 3.1.11. thaw() |
288 | of the operations in the implementation, ignore some operations or add | ||
289 | more driver specific operations in it, but drivers should do something like | ||
290 | this on the whole. | ||
291 | 854 | ||
292 | 5. Resources | 855 | The thaw() callback is hibernation-specific. It is executed after thaw_noirq() |
293 | ~~~~~~~~~~~~ | 856 | callbacks have been executed for all devices in the system and after device |
857 | interrupts have been enabled by the PM core. | ||
294 | 858 | ||
295 | PCI Local Bus Specification | 859 | This callback is responsible for restoring the pre-freeze configuration of |
296 | PCI Bus Power Management Interface Specification | 860 | the device, so that it will work in a usual way after thaw() has returned. |
297 | 861 | ||
298 | http://www.pcisig.com | 862 | 3.1.12. restore_noirq() |
299 | 863 | ||
864 | The restore_noirq() callback is hibernation-specific. It is executed in the | ||
865 | restore_noirq phase of hibernation, when the boot kernel has passed control to | ||
866 | the image kernel and the non-boot CPUs have been enabled by the image kernel's | ||
867 | PM core. | ||
868 | |||
869 | This callback is analogous to resume_noirq() with the exception that it cannot | ||
870 | make any assumption on the previous state of the device, even if the BIOS (or | ||
871 | generally the platform firmware) is known to preserve that state over a | ||
872 | suspend-resume cycle. | ||
873 | |||
874 | For the vast majority of PCI device drivers there is no difference between | ||
875 | resume_noirq() and restore_noirq(). | ||
876 | |||
877 | 3.1.13. restore() | ||
878 | |||
879 | The restore() callback is hibernation-specific. It is executed after | ||
880 | restore_noirq() callbacks have been executed for all devices in the system and | ||
881 | after the PM core has enabled device drivers' interrupt handlers to be invoked. | ||
882 | |||
883 | This callback is analogous to resume(), just like restore_noirq() is analogous | ||
884 | to resume_noirq(). Consequently, the difference between restore_noirq() and | ||
885 | restore() is analogous to the difference between resume_noirq() and resume(). | ||
886 | |||
887 | For the vast majority of PCI device drivers there is no difference between | ||
888 | resume() and restore(). | ||
889 | |||
890 | 3.1.14. complete() | ||
891 | |||
892 | The complete() callback is executed in the following situations: | ||
893 | - during system resume, after resume() callbacks have been executed for all | ||
894 | devices, | ||
895 | - during hibernation, before saving the system image, after thaw() callbacks | ||
896 | have been executed for all devices, | ||
897 | - during system restore, when the system is going back to its pre-hibernation | ||
898 | state, after restore() callbacks have been executed for all devices. | ||
899 | It also may be executed if the loading of a hibernation image into memory fails | ||
900 | (in that case it is run after thaw() callbacks have been executed for all | ||
901 | devices that have drivers in the boot kernel). | ||
902 | |||
903 | This callback is entirely optional, although it may be necessary if the | ||
904 | prepare() callback performs operations that need to be reversed. | ||
905 | |||
906 | 3.1.15. runtime_suspend() | ||
907 | |||
908 | The runtime_suspend() callback is specific to device runtime power management | ||
909 | (runtime PM). It is executed by the PM core's runtime PM framework when the | ||
910 | device is about to be suspended (i.e. quiesced and put into a low-power state) | ||
911 | at run time. | ||
912 | |||
913 | This callback is responsible for freezing the device and preparing it to be | ||
914 | put into a low-power state, but it must allow the PCI subsystem to perform all | ||
915 | of the PCI-specific actions necessary for suspending the device. | ||
916 | |||
917 | 3.1.16. runtime_resume() | ||
918 | |||
919 | The runtime_resume() callback is specific to device runtime PM. It is executed | ||
920 | by the PM core's runtime PM framework when the device is about to be resumed | ||
921 | (i.e. put into the full-power state and programmed to process I/O normally) at | ||
922 | run time. | ||
923 | |||
924 | This callback is responsible for restoring the normal functionality of the | ||
925 | device after it has been put into the full-power state by the PCI subsystem. | ||
926 | The device is expected to be able to process I/O in the usual way after | ||
927 | runtime_resume() has returned. | ||
928 | |||
929 | 3.1.17. runtime_idle() | ||
930 | |||
931 | The runtime_idle() callback is specific to device runtime PM. It is executed | ||
932 | by the PM core's runtime PM framework whenever it may be desirable to suspend | ||
933 | the device according to the PM core's information. In particular, it is | ||
934 | automatically executed right after runtime_resume() has returned in case the | ||
935 | resume of the device has happened as a result of a spurious event. | ||
936 | |||
937 | This callback is optional, but if it is not implemented or if it returns 0, the | ||
938 | PCI subsystem will call pm_runtime_suspend() for the device, which in turn will | ||
939 | cause the driver's runtime_suspend() callback to be executed. | ||
940 | |||
941 | 3.1.18. Pointing Multiple Callback Pointers to One Routine | ||
942 | |||
943 | Although in principle each of the callbacks described in the previous | ||
944 | subsections can be defined as a separate function, it often is convenient to | ||
945 | point two or more members of struct dev_pm_ops to the same routine. There are | ||
946 | a few convenience macros that can be used for this purpose. | ||
947 | |||
948 | The SIMPLE_DEV_PM_OPS macro declares a struct dev_pm_ops object with one | ||
949 | suspend routine pointed to by the .suspend(), .freeze(), and .poweroff() | ||
950 | members and one resume routine pointed to by the .resume(), .thaw(), and | ||
951 | .restore() members. The other function pointers in this struct dev_pm_ops are | ||
952 | unset. | ||
953 | |||
954 | The UNIVERSAL_DEV_PM_OPS macro is similar to SIMPLE_DEV_PM_OPS, but it | ||
955 | additionally sets the .runtime_resume() pointer to the same value as | ||
956 | .resume() (and .thaw(), and .restore()) and the .runtime_suspend() pointer to | ||
957 | the same value as .suspend() (and .freeze() and .poweroff()). | ||
958 | |||
959 | The SET_SYSTEM_SLEEP_PM_OPS can be used inside of a declaration of struct | ||
960 | dev_pm_ops to indicate that one suspend routine is to be pointed to by the | ||
961 | .suspend(), .freeze(), and .poweroff() members and one resume routine is to | ||
962 | be pointed to by the .resume(), .thaw(), and .restore() members. | ||
963 | |||
964 | 3.2. Device Runtime Power Management | ||
965 | ------------------------------------ | ||
966 | In addition to providing device power management callbacks PCI device drivers | ||
967 | are responsible for controlling the runtime power management (runtime PM) of | ||
968 | their devices. | ||
969 | |||
970 | The PCI device runtime PM is optional, but it is recommended that PCI device | ||
971 | drivers implement it at least in the cases where there is a reliable way of | ||
972 | verifying that the device is not used (like when the network cable is detached | ||
973 | from an Ethernet adapter or there are no devices attached to a USB controller). | ||
974 | |||
975 | To support the PCI runtime PM the driver first needs to implement the | ||
976 | runtime_suspend() and runtime_resume() callbacks. It also may need to implement | ||
977 | the runtime_idle() callback to prevent the device from being suspended again | ||
978 | every time right after the runtime_resume() callback has returned | ||
979 | (alternatively, the runtime_suspend() callback will have to check if the | ||
980 | device should really be suspended and return -EAGAIN if that is not the case). | ||
981 | |||
982 | The runtime PM of PCI devices is disabled by default. It is also blocked by | ||
983 | pci_pm_init() that runs the pm_runtime_forbid() helper function. If a PCI | ||
984 | driver implements the runtime PM callbacks and intends to use the runtime PM | ||
985 | framework provided by the PM core and the PCI subsystem, it should enable this | ||
986 | feature by executing the pm_runtime_enable() helper function. However, the | ||
987 | driver should not call the pm_runtime_allow() helper function unblocking | ||
988 | the runtime PM of the device. Instead, it should allow user space or some | ||
989 | platform-specific code to do that (user space can do it via sysfs), although | ||
990 | once it has called pm_runtime_enable(), it must be prepared to handle the | ||
991 | runtime PM of the device correctly as soon as pm_runtime_allow() is called | ||
992 | (which may happen at any time). [It also is possible that user space causes | ||
993 | pm_runtime_allow() to be called via sysfs before the driver is loaded, so in | ||
994 | fact the driver has to be prepared to handle the runtime PM of the device as | ||
995 | soon as it calls pm_runtime_enable().] | ||
996 | |||
997 | The runtime PM framework works by processing requests to suspend or resume | ||
998 | devices, or to check if they are idle (in which cases it is reasonable to | ||
999 | subsequently request that they be suspended). These requests are represented | ||
1000 | by work items put into the power management workqueue, pm_wq. Although there | ||
1001 | are a few situations in which power management requests are automatically | ||
1002 | queued by the PM core (for example, after processing a request to resume a | ||
1003 | device the PM core automatically queues a request to check if the device is | ||
1004 | idle), device drivers are generally responsible for queuing power management | ||
1005 | requests for their devices. For this purpose they should use the runtime PM | ||
1006 | helper functions provided by the PM core, discussed in | ||
1007 | Documentation/power/runtime_pm.txt. | ||
1008 | |||
1009 | Devices can also be suspended and resumed synchronously, without placing a | ||
1010 | request into pm_wq. In the majority of cases this also is done by their | ||
1011 | drivers that use helper functions provided by the PM core for this purpose. | ||
1012 | |||
1013 | For more information on the runtime PM of devices refer to | ||
1014 | Documentation/power/runtime_pm.txt. | ||
1015 | |||
1016 | |||
1017 | 4. Resources | ||
1018 | ============ | ||
1019 | |||
1020 | PCI Local Bus Specification, Rev. 3.0 | ||
1021 | PCI Bus Power Management Interface Specification, Rev. 1.2 | ||
1022 | Advanced Configuration and Power Interface (ACPI) Specification, Rev. 3.0b | ||
1023 | PCI Express Base Specification, Rev. 2.0 | ||
1024 | Documentation/power/devices.txt | ||
1025 | Documentation/power/runtime_pm.txt | ||
diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt index c40866e8b957..bfed898a03fc 100644 --- a/Documentation/power/pm_qos_interface.txt +++ b/Documentation/power/pm_qos_interface.txt | |||
@@ -18,44 +18,46 @@ and pm_qos_params.h. This is done because having the available parameters | |||
18 | being runtime configurable or changeable from a driver was seen as too easy to | 18 | being runtime configurable or changeable from a driver was seen as too easy to |
19 | abuse. | 19 | abuse. |
20 | 20 | ||
21 | For each parameter a list of performance requirements is maintained along with | 21 | For each parameter a list of performance requests is maintained along with |
22 | an aggregated target value. The aggregated target value is updated with | 22 | an aggregated target value. The aggregated target value is updated with |
23 | changes to the requirement list or elements of the list. Typically the | 23 | changes to the request list or elements of the list. Typically the |
24 | aggregated target value is simply the max or min of the requirement values held | 24 | aggregated target value is simply the max or min of the request values held |
25 | in the parameter list elements. | 25 | in the parameter list elements. |
26 | 26 | ||
27 | From kernel mode the use of this interface is simple: | 27 | From kernel mode the use of this interface is simple: |
28 | pm_qos_add_requirement(param_id, name, target_value): | ||
29 | Will insert a named element in the list for that identified PM_QOS parameter | ||
30 | with the target value. Upon change to this list the new target is recomputed | ||
31 | and any registered notifiers are called only if the target value is now | ||
32 | different. | ||
33 | 28 | ||
34 | pm_qos_update_requirement(param_id, name, new_target_value): | 29 | handle = pm_qos_add_request(param_class, target_value): |
35 | Will search the list identified by the param_id for the named list element and | 30 | Will insert an element into the list for that identified PM_QOS class with the |
36 | then update its target value, calling the notification tree if the aggregated | 31 | target value. Upon change to this list the new target is recomputed and any |
37 | target is changed. with that name is already registered. | 32 | registered notifiers are called only if the target value is now different. |
33 | Clients of pm_qos need to save the returned handle. | ||
38 | 34 | ||
39 | pm_qos_remove_requirement(param_id, name): | 35 | void pm_qos_update_request(handle, new_target_value): |
40 | Will search the identified list for the named element and remove it, after | 36 | Will update the list element pointed to by the handle with the new target value |
41 | removal it will update the aggregate target and call the notification tree if | 37 | and recompute the new aggregated target, calling the notification tree if the |
42 | the target was changed as a result of removing the named requirement. | 38 | target is changed. |
39 | |||
40 | void pm_qos_remove_request(handle): | ||
41 | Will remove the element. After removal it will update the aggregate target and | ||
42 | call the notification tree if the target was changed as a result of removing | ||
43 | the request. | ||
43 | 44 | ||
44 | 45 | ||
45 | From user mode: | 46 | From user mode: |
46 | Only processes can register a pm_qos requirement. To provide for automatic | 47 | Only processes can register a pm_qos request. To provide for automatic |
47 | cleanup for process the interface requires the process to register its | 48 | cleanup of a process, the interface requires the process to register its |
48 | parameter requirements in the following way: | 49 | parameter requests in the following way: |
49 | 50 | ||
50 | To register the default pm_qos target for the specific parameter, the process | 51 | To register the default pm_qos target for the specific parameter, the process |
51 | must open one of /dev/[cpu_dma_latency, network_latency, network_throughput] | 52 | must open one of /dev/[cpu_dma_latency, network_latency, network_throughput] |
52 | 53 | ||
53 | As long as the device node is held open that process has a registered | 54 | As long as the device node is held open that process has a registered |
54 | requirement on the parameter. The name of the requirement is "process_<PID>" | 55 | request on the parameter. |
55 | derived from the current->pid from within the open system call. | ||
56 | 56 | ||
57 | To change the requested target value the process needs to write a s32 value to | 57 | To change the requested target value the process needs to write an s32 value to |
58 | the open device node. This translates to a pm_qos_update_requirement call. | 58 | the open device node. Alternatively the user mode program could write a hex |
59 | string for the value using 10 char long format e.g. "0x12345678". This | ||
60 | translates to a pm_qos_update_request call. | ||
59 | 61 | ||
60 | To remove the user mode request for a target value simply close the device | 62 | To remove the user mode request for a target value simply close the device |
61 | node. | 63 | node. |
diff --git a/Documentation/power/regulator/consumer.txt b/Documentation/power/regulator/consumer.txt index cdebb5145c25..55c4175d8099 100644 --- a/Documentation/power/regulator/consumer.txt +++ b/Documentation/power/regulator/consumer.txt | |||
@@ -8,11 +8,11 @@ Please see overview.txt for a description of the terms used in this text. | |||
8 | 1. Consumer Regulator Access (static & dynamic drivers) | 8 | 1. Consumer Regulator Access (static & dynamic drivers) |
9 | ======================================================= | 9 | ======================================================= |
10 | 10 | ||
11 | A consumer driver can get access to it's supply regulator by calling :- | 11 | A consumer driver can get access to its supply regulator by calling :- |
12 | 12 | ||
13 | regulator = regulator_get(dev, "Vcc"); | 13 | regulator = regulator_get(dev, "Vcc"); |
14 | 14 | ||
15 | The consumer passes in it's struct device pointer and power supply ID. The core | 15 | The consumer passes in its struct device pointer and power supply ID. The core |
16 | then finds the correct regulator by consulting a machine specific lookup table. | 16 | then finds the correct regulator by consulting a machine specific lookup table. |
17 | If the lookup is successful then this call will return a pointer to the struct | 17 | If the lookup is successful then this call will return a pointer to the struct |
18 | regulator that supplies this consumer. | 18 | regulator that supplies this consumer. |
@@ -34,7 +34,7 @@ usually be called in your device drivers probe() and remove() respectively. | |||
34 | 2. Regulator Output Enable & Disable (static & dynamic drivers) | 34 | 2. Regulator Output Enable & Disable (static & dynamic drivers) |
35 | ==================================================================== | 35 | ==================================================================== |
36 | 36 | ||
37 | A consumer can enable it's power supply by calling:- | 37 | A consumer can enable its power supply by calling:- |
38 | 38 | ||
39 | int regulator_enable(regulator); | 39 | int regulator_enable(regulator); |
40 | 40 | ||
@@ -49,7 +49,7 @@ int regulator_is_enabled(regulator); | |||
49 | This will return > zero when the regulator is enabled. | 49 | This will return > zero when the regulator is enabled. |
50 | 50 | ||
51 | 51 | ||
52 | A consumer can disable it's supply when no longer needed by calling :- | 52 | A consumer can disable its supply when no longer needed by calling :- |
53 | 53 | ||
54 | int regulator_disable(regulator); | 54 | int regulator_disable(regulator); |
55 | 55 | ||
@@ -140,7 +140,7 @@ by calling :- | |||
140 | int regulator_set_optimum_mode(struct regulator *regulator, int load_uA); | 140 | int regulator_set_optimum_mode(struct regulator *regulator, int load_uA); |
141 | 141 | ||
142 | This will cause the core to recalculate the total load on the regulator (based | 142 | This will cause the core to recalculate the total load on the regulator (based |
143 | on all it's consumers) and change operating mode (if necessary and permitted) | 143 | on all its consumers) and change operating mode (if necessary and permitted) |
144 | to best match the current operating load. | 144 | to best match the current operating load. |
145 | 145 | ||
146 | The load_uA value can be determined from the consumers datasheet. e.g.most | 146 | The load_uA value can be determined from the consumers datasheet. e.g.most |
diff --git a/Documentation/power/regulator/machine.txt b/Documentation/power/regulator/machine.txt index 63728fed620b..bdec39b9bd75 100644 --- a/Documentation/power/regulator/machine.txt +++ b/Documentation/power/regulator/machine.txt | |||
@@ -52,7 +52,7 @@ static struct regulator_init_data regulator1_data = { | |||
52 | }; | 52 | }; |
53 | 53 | ||
54 | 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 |
55 | 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 its |
56 | supply (Regulator-2). The supply regulator is set by the supply_regulator_dev | 56 | supply (Regulator-2). The supply regulator is set by the supply_regulator_dev |
57 | field below:- | 57 | field below:- |
58 | 58 | ||
diff --git a/Documentation/power/regulator/overview.txt b/Documentation/power/regulator/overview.txt index ffd185bb6054..9363e056188a 100644 --- a/Documentation/power/regulator/overview.txt +++ b/Documentation/power/regulator/overview.txt | |||
@@ -35,16 +35,16 @@ Some terms used in this document:- | |||
35 | o Consumer - Electronic device that is supplied power by a regulator. | 35 | o Consumer - Electronic device that is supplied power by a regulator. |
36 | Consumers can be classified into two types:- | 36 | Consumers can be classified into two types:- |
37 | 37 | ||
38 | Static: consumer does not change it's supply voltage or | 38 | Static: consumer does not change its supply voltage or |
39 | current limit. It only needs to enable or disable it's | 39 | current limit. It only needs to enable or disable it's |
40 | power supply. It's supply voltage is set by the hardware, | 40 | power supply. Its supply voltage is set by the hardware, |
41 | bootloader, firmware or kernel board initialisation code. | 41 | bootloader, firmware or kernel board initialisation code. |
42 | 42 | ||
43 | Dynamic: consumer needs to change it's supply voltage or | 43 | Dynamic: consumer needs to change it's supply voltage or |
44 | current limit to meet operation demands. | 44 | current limit to meet operation demands. |
45 | 45 | ||
46 | 46 | ||
47 | o Power Domain - Electronic circuit that is supplied it's input power by the | 47 | o Power Domain - Electronic circuit that is supplied its input power by the |
48 | output power of a regulator, switch or by another power | 48 | output power of a regulator, switch or by another power |
49 | domain. | 49 | domain. |
50 | 50 | ||
diff --git a/Documentation/power/userland-swsusp.txt b/Documentation/power/userland-swsusp.txt index b967cd9137d6..81680f9f5909 100644 --- a/Documentation/power/userland-swsusp.txt +++ b/Documentation/power/userland-swsusp.txt | |||
@@ -24,6 +24,10 @@ assumed to be in the resume mode. The device cannot be open for simultaneous | |||
24 | reading and writing. It is also impossible to have the device open more than | 24 | reading and writing. It is also impossible to have the device open more than |
25 | once at a time. | 25 | once at a time. |
26 | 26 | ||
27 | Even opening the device has side effects. Data structures are | ||
28 | allocated, and PM_HIBERNATION_PREPARE / PM_RESTORE_PREPARE chains are | ||
29 | called. | ||
30 | |||
27 | The ioctl() commands recognized by the device are: | 31 | The ioctl() commands recognized by the device are: |
28 | 32 | ||
29 | SNAPSHOT_FREEZE - freeze user space processes (the current process is | 33 | SNAPSHOT_FREEZE - freeze user space processes (the current process is |
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index 79f533f38c61..46d22105aa07 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt | |||
@@ -1289,7 +1289,7 @@ link between a device node and its interrupt parent in | |||
1289 | the interrupt tree. The value of interrupt-parent is the | 1289 | the interrupt tree. The value of interrupt-parent is the |
1290 | phandle of the parent node. | 1290 | phandle of the parent node. |
1291 | 1291 | ||
1292 | If the interrupt-parent property is not defined for a node, it's | 1292 | If the interrupt-parent property is not defined for a node, its |
1293 | interrupt parent is assumed to be an ancestor in the node's | 1293 | interrupt parent is assumed to be an ancestor in the node's |
1294 | _device tree_ hierarchy. | 1294 | _device tree_ hierarchy. |
1295 | 1295 | ||
diff --git a/Documentation/powerpc/dts-bindings/4xx/reboot.txt b/Documentation/powerpc/dts-bindings/4xx/reboot.txt new file mode 100644 index 000000000000..d7217260589c --- /dev/null +++ b/Documentation/powerpc/dts-bindings/4xx/reboot.txt | |||
@@ -0,0 +1,18 @@ | |||
1 | Reboot property to control system reboot on PPC4xx systems: | ||
2 | |||
3 | By setting "reset_type" to one of the following values, the default | ||
4 | software reset mechanism may be overidden. Here the possible values of | ||
5 | "reset_type": | ||
6 | |||
7 | 1 - PPC4xx core reset | ||
8 | 2 - PPC4xx chip reset | ||
9 | 3 - PPC4xx system reset (default) | ||
10 | |||
11 | Example: | ||
12 | |||
13 | cpu@0 { | ||
14 | device_type = "cpu"; | ||
15 | model = "PowerPC,440SPe"; | ||
16 | ... | ||
17 | reset-type = <2>; /* Use chip-reset */ | ||
18 | }; | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt b/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt index d015dcec4011..b0019eb5330e 100644 --- a/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt +++ b/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt | |||
@@ -11,7 +11,7 @@ Required properties: | |||
11 | 83xx, "fsl,mpc8572-gpio" for 85xx and "fsl,mpc8610-gpio" for 86xx. | 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 | 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). | 13 | second cell is used to specify optional parameters (currently unused). |
14 | - interrupts : Interrupt mapping for GPIO IRQ (currently unused). | 14 | - interrupts : Interrupt mapping for GPIO IRQ. |
15 | - interrupt-parent : Phandle for the interrupt controller that | 15 | - interrupt-parent : Phandle for the interrupt controller that |
16 | services interrupts for this device. | 16 | services interrupts for this device. |
17 | - gpio-controller : Marks the port as GPIO controller. | 17 | - gpio-controller : Marks the port as GPIO controller. |
@@ -38,3 +38,23 @@ Example of gpio-controller nodes for a MPC8347 SoC: | |||
38 | 38 | ||
39 | See booting-without-of.txt for details of how to specify GPIO | 39 | See booting-without-of.txt for details of how to specify GPIO |
40 | information for devices. | 40 | information for devices. |
41 | |||
42 | To use GPIO pins as interrupt sources for peripherals, specify the | ||
43 | GPIO controller as the interrupt parent and define GPIO number + | ||
44 | trigger mode using the interrupts property, which is defined like | ||
45 | this: | ||
46 | |||
47 | interrupts = <number trigger>, where: | ||
48 | - number: GPIO pin (0..31) | ||
49 | - trigger: trigger mode: | ||
50 | 2 = trigger on falling edge | ||
51 | 3 = trigger on both edges | ||
52 | |||
53 | Example of device using this is: | ||
54 | |||
55 | funkyfpga@0 { | ||
56 | compatible = "funky-fpga"; | ||
57 | ... | ||
58 | interrupts = <4 3>; | ||
59 | interrupt-parent = <&gpio1>; | ||
60 | }; | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt index 6e37be1eeb2d..4f8930263dd9 100644 --- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt +++ b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt | |||
@@ -21,6 +21,15 @@ Required properties: | |||
21 | - fsl,qe-num-snums: define how many serial number(SNUM) the QE can use for the | 21 | - fsl,qe-num-snums: define how many serial number(SNUM) the QE can use for the |
22 | threads. | 22 | threads. |
23 | 23 | ||
24 | Optional properties: | ||
25 | - fsl,firmware-phandle: | ||
26 | Usage: required only if there is no fsl,qe-firmware child node | ||
27 | Value type: <phandle> | ||
28 | Definition: Points to a firmware node (see "QE Firmware Node" below) | ||
29 | that contains the firmware that should be uploaded for this QE. | ||
30 | The compatible property for the firmware node should say, | ||
31 | "fsl,qe-firmware". | ||
32 | |||
24 | Recommended properties | 33 | Recommended properties |
25 | - brg-frequency : the internal clock source frequency for baud-rate | 34 | - brg-frequency : the internal clock source frequency for baud-rate |
26 | generators in Hz. | 35 | generators in Hz. |
@@ -59,3 +68,48 @@ Example: | |||
59 | reg = <0 c000>; | 68 | reg = <0 c000>; |
60 | }; | 69 | }; |
61 | }; | 70 | }; |
71 | |||
72 | * QE Firmware Node | ||
73 | |||
74 | This node defines a firmware binary that is embedded in the device tree, for | ||
75 | the purpose of passing the firmware from bootloader to the kernel, or from | ||
76 | the hypervisor to the guest. | ||
77 | |||
78 | The firmware node itself contains the firmware binary contents, a compatible | ||
79 | property, and any firmware-specific properties. The node should be placed | ||
80 | inside a QE node that needs it. Doing so eliminates the need for a | ||
81 | fsl,firmware-phandle property. Other QE nodes that need the same firmware | ||
82 | should define an fsl,firmware-phandle property that points to the firmware node | ||
83 | in the first QE node. | ||
84 | |||
85 | The fsl,firmware property can be specified in the DTS (possibly using incbin) | ||
86 | or can be inserted by the boot loader at boot time. | ||
87 | |||
88 | Required properties: | ||
89 | - compatible | ||
90 | Usage: required | ||
91 | Value type: <string> | ||
92 | Definition: A standard property. Specify a string that indicates what | ||
93 | kind of firmware it is. For QE, this should be "fsl,qe-firmware". | ||
94 | |||
95 | - fsl,firmware | ||
96 | Usage: required | ||
97 | Value type: <prop-encoded-array>, encoded as an array of bytes | ||
98 | Definition: A standard property. This property contains the firmware | ||
99 | binary "blob". | ||
100 | |||
101 | Example: | ||
102 | qe1@e0080000 { | ||
103 | compatible = "fsl,qe"; | ||
104 | qe_firmware:qe-firmware { | ||
105 | compatible = "fsl,qe-firmware"; | ||
106 | fsl,firmware = [0x70 0xcd 0x00 0x00 0x01 0x46 0x45 ...]; | ||
107 | }; | ||
108 | ... | ||
109 | }; | ||
110 | |||
111 | qe2@e0090000 { | ||
112 | compatible = "fsl,qe"; | ||
113 | fsl,firmware-phandle = <&qe_firmware>; | ||
114 | ... | ||
115 | }; | ||
diff --git a/Documentation/powerpc/dts-bindings/xilinx.txt b/Documentation/powerpc/dts-bindings/xilinx.txt index ea68046bb9cb..299d0923537b 100644 --- a/Documentation/powerpc/dts-bindings/xilinx.txt +++ b/Documentation/powerpc/dts-bindings/xilinx.txt | |||
@@ -11,7 +11,7 @@ | |||
11 | control how the core is synthesized. Historically, the EDK tool would | 11 | control how the core is synthesized. Historically, the EDK tool would |
12 | extract the device parameters relevant to device drivers and copy them | 12 | extract the device parameters relevant to device drivers and copy them |
13 | into an 'xparameters.h' in the form of #define symbols. This tells the | 13 | into an 'xparameters.h' in the form of #define symbols. This tells the |
14 | device drivers how the IP cores are configured, but it requres the kernel | 14 | device drivers how the IP cores are configured, but it requires the kernel |
15 | to be recompiled every time the FPGA bitstream is resynthesized. | 15 | to be recompiled every time the FPGA bitstream is resynthesized. |
16 | 16 | ||
17 | The new approach is to export the parameters into the device tree and | 17 | The new approach is to export the parameters into the device tree and |
diff --git a/Documentation/powerpc/phyp-assisted-dump.txt b/Documentation/powerpc/phyp-assisted-dump.txt index c4682b982a2e..ad340205d96a 100644 --- a/Documentation/powerpc/phyp-assisted-dump.txt +++ b/Documentation/powerpc/phyp-assisted-dump.txt | |||
@@ -19,7 +19,7 @@ dump offers several strong, practical advantages: | |||
19 | immediately available to the system for normal use. | 19 | immediately available to the system for normal use. |
20 | -- After the dump is completed, no further reboots are | 20 | -- After the dump is completed, no further reboots are |
21 | required; the system will be fully usable, and running | 21 | required; the system will be fully usable, and running |
22 | in it's normal, production mode on it normal kernel. | 22 | in its normal, production mode on its normal kernel. |
23 | 23 | ||
24 | The above can only be accomplished by coordination with, | 24 | The above can only be accomplished by coordination with, |
25 | and assistance from the hypervisor. The procedure is | 25 | and assistance from the hypervisor. The procedure is |
diff --git a/Documentation/rbtree.txt b/Documentation/rbtree.txt index aae8355d3166..221f38be98f4 100644 --- a/Documentation/rbtree.txt +++ b/Documentation/rbtree.txt | |||
@@ -190,3 +190,61 @@ Example: | |||
190 | for (node = rb_first(&mytree); node; node = rb_next(node)) | 190 | for (node = rb_first(&mytree); node; node = rb_next(node)) |
191 | printk("key=%s\n", rb_entry(node, struct mytype, node)->keystring); | 191 | printk("key=%s\n", rb_entry(node, struct mytype, node)->keystring); |
192 | 192 | ||
193 | Support for Augmented rbtrees | ||
194 | ----------------------------- | ||
195 | |||
196 | Augmented rbtree is an rbtree with "some" additional data stored in each node. | ||
197 | This data can be used to augment some new functionality to rbtree. | ||
198 | Augmented rbtree is an optional feature built on top of basic rbtree | ||
199 | infrastructure. rbtree user who wants this feature will have an augment | ||
200 | callback function in rb_root initialized. | ||
201 | |||
202 | This callback function will be called from rbtree core routines whenever | ||
203 | a node has a change in one or both of its children. It is the responsibility | ||
204 | of the callback function to recalculate the additional data that is in the | ||
205 | rb node using new children information. Note that if this new additional | ||
206 | data affects the parent node's additional data, then callback function has | ||
207 | to handle it and do the recursive updates. | ||
208 | |||
209 | |||
210 | Interval tree is an example of augmented rb tree. Reference - | ||
211 | "Introduction to Algorithms" by Cormen, Leiserson, Rivest and Stein. | ||
212 | More details about interval trees: | ||
213 | |||
214 | Classical rbtree has a single key and it cannot be directly used to store | ||
215 | interval ranges like [lo:hi] and do a quick lookup for any overlap with a new | ||
216 | lo:hi or to find whether there is an exact match for a new lo:hi. | ||
217 | |||
218 | However, rbtree can be augmented to store such interval ranges in a structured | ||
219 | way making it possible to do efficient lookup and exact match. | ||
220 | |||
221 | This "extra information" stored in each node is the maximum hi | ||
222 | (max_hi) value among all the nodes that are its descendents. This | ||
223 | information can be maintained at each node just be looking at the node | ||
224 | and its immediate children. And this will be used in O(log n) lookup | ||
225 | for lowest match (lowest start address among all possible matches) | ||
226 | with something like: | ||
227 | |||
228 | find_lowest_match(lo, hi, node) | ||
229 | { | ||
230 | lowest_match = NULL; | ||
231 | while (node) { | ||
232 | if (max_hi(node->left) > lo) { | ||
233 | // Lowest overlap if any must be on left side | ||
234 | node = node->left; | ||
235 | } else if (overlap(lo, hi, node)) { | ||
236 | lowest_match = node; | ||
237 | break; | ||
238 | } else if (lo > node->lo) { | ||
239 | // Lowest overlap if any must be on right side | ||
240 | node = node->right; | ||
241 | } else { | ||
242 | break; | ||
243 | } | ||
244 | } | ||
245 | return lowest_match; | ||
246 | } | ||
247 | |||
248 | Finding exact match will be to first find lowest match and then to follow | ||
249 | successor nodes looking for exact match, until the start of a node is beyond | ||
250 | the hi value we are looking for. | ||
diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt index b4860509c319..83668e5dd17f 100644 --- a/Documentation/rfkill.txt +++ b/Documentation/rfkill.txt | |||
@@ -99,37 +99,15 @@ system. Also, it is possible to switch all rfkill drivers (or all drivers of | |||
99 | a specified type) into a state which also updates the default state for | 99 | a specified type) into a state which also updates the default state for |
100 | hotplugged devices. | 100 | hotplugged devices. |
101 | 101 | ||
102 | After an application opens /dev/rfkill, it can read the current state of | 102 | After an application opens /dev/rfkill, it can read the current state of all |
103 | all devices, and afterwards can poll the descriptor for hotplug or state | 103 | devices. Changes can be either obtained by either polling the descriptor for |
104 | change events. | 104 | hotplug or state change events or by listening for uevents emitted by the |
105 | 105 | rfkill core framework. | |
106 | Applications must ignore operations (the "op" field) they do not handle, | 106 | |
107 | this allows the API to be extended in the future. | 107 | Additionally, each rfkill device is registered in sysfs and emits uevents. |
108 | 108 | ||
109 | Additionally, each rfkill device is registered in sysfs and there has the | 109 | rfkill devices issue uevents (with an action of "change"), with the following |
110 | following attributes: | 110 | environment variables set: |
111 | |||
112 | name: Name assigned by driver to this key (interface or driver name). | ||
113 | type: Driver type string ("wlan", "bluetooth", etc). | ||
114 | persistent: Whether the soft blocked state is initialised from | ||
115 | non-volatile storage at startup. | ||
116 | state: Current state of the transmitter | ||
117 | 0: RFKILL_STATE_SOFT_BLOCKED | ||
118 | transmitter is turned off by software | ||
119 | 1: RFKILL_STATE_UNBLOCKED | ||
120 | transmitter is (potentially) active | ||
121 | 2: RFKILL_STATE_HARD_BLOCKED | ||
122 | transmitter is forced off by something outside of | ||
123 | the driver's control. | ||
124 | This file is deprecated because it can only properly show | ||
125 | three of the four possible states, soft-and-hard-blocked is | ||
126 | missing. | ||
127 | claim: 0: Kernel handles events | ||
128 | This file is deprecated because there no longer is a way to | ||
129 | claim just control over a single rfkill instance. | ||
130 | |||
131 | rfkill devices also issue uevents (with an action of "change"), with the | ||
132 | following environment variables set: | ||
133 | 111 | ||
134 | RFKILL_NAME | 112 | RFKILL_NAME |
135 | RFKILL_STATE | 113 | RFKILL_STATE |
@@ -137,3 +115,7 @@ RFKILL_TYPE | |||
137 | 115 | ||
138 | The contents of these variables corresponds to the "name", "state" and | 116 | The contents of these variables corresponds to the "name", "state" and |
139 | "type" sysfs files explained above. | 117 | "type" sysfs files explained above. |
118 | |||
119 | |||
120 | For further details consult Documentation/ABI/stable/dev-rfkill and | ||
121 | Documentation/ABI/stable/sysfs-class-rfkill. | ||
diff --git a/Documentation/rt-mutex-design.txt b/Documentation/rt-mutex-design.txt index 4b736d24da7a..8df0b782c4d7 100644 --- a/Documentation/rt-mutex-design.txt +++ b/Documentation/rt-mutex-design.txt | |||
@@ -657,7 +657,7 @@ here. | |||
657 | 657 | ||
658 | The waiter structure has a "task" field that points to the task that is blocked | 658 | The waiter structure has a "task" field that points to the task that is blocked |
659 | on the mutex. This field can be NULL the first time it goes through the loop | 659 | on the mutex. This field can be NULL the first time it goes through the loop |
660 | or if the task is a pending owner and had it's mutex stolen. If the "task" | 660 | or if the task is a pending owner and had its mutex stolen. If the "task" |
661 | field is NULL then we need to set up the accounting for it. | 661 | field is NULL then we need to set up the accounting for it. |
662 | 662 | ||
663 | Task blocks on mutex | 663 | Task blocks on mutex |
diff --git a/Documentation/scheduler/sched-design-CFS.txt b/Documentation/scheduler/sched-design-CFS.txt index 6f33593e59e2..8239ebbcddce 100644 --- a/Documentation/scheduler/sched-design-CFS.txt +++ b/Documentation/scheduler/sched-design-CFS.txt | |||
@@ -211,7 +211,7 @@ provide fair CPU time to each such task group. For example, it may be | |||
211 | desirable to first provide fair CPU time to each user on the system and then to | 211 | desirable to first provide fair CPU time to each user on the system and then to |
212 | each task belonging to a user. | 212 | each task belonging to a user. |
213 | 213 | ||
214 | CONFIG_GROUP_SCHED strives to achieve exactly that. It lets tasks to be | 214 | CONFIG_CGROUP_SCHED strives to achieve exactly that. It lets tasks to be |
215 | grouped and divides CPU time fairly among such groups. | 215 | grouped and divides CPU time fairly among such groups. |
216 | 216 | ||
217 | CONFIG_RT_GROUP_SCHED permits to group real-time (i.e., SCHED_FIFO and | 217 | CONFIG_RT_GROUP_SCHED permits to group real-time (i.e., SCHED_FIFO and |
@@ -220,38 +220,11 @@ SCHED_RR) tasks. | |||
220 | CONFIG_FAIR_GROUP_SCHED permits to group CFS (i.e., SCHED_NORMAL and | 220 | CONFIG_FAIR_GROUP_SCHED permits to group CFS (i.e., SCHED_NORMAL and |
221 | SCHED_BATCH) tasks. | 221 | SCHED_BATCH) tasks. |
222 | 222 | ||
223 | At present, there are two (mutually exclusive) mechanisms to group tasks for | 223 | These options need CONFIG_CGROUPS to be defined, and let the administrator |
224 | CPU bandwidth control purposes: | ||
225 | |||
226 | - Based on user id (CONFIG_USER_SCHED) | ||
227 | |||
228 | With this option, tasks are grouped according to their user id. | ||
229 | |||
230 | - Based on "cgroup" pseudo filesystem (CONFIG_CGROUP_SCHED) | ||
231 | |||
232 | This options needs CONFIG_CGROUPS to be defined, and lets the administrator | ||
233 | create arbitrary groups of tasks, using the "cgroup" pseudo filesystem. See | 224 | create arbitrary groups of tasks, using the "cgroup" pseudo filesystem. See |
234 | Documentation/cgroups/cgroups.txt for more information about this filesystem. | 225 | Documentation/cgroups/cgroups.txt for more information about this filesystem. |
235 | 226 | ||
236 | Only one of these options to group tasks can be chosen and not both. | 227 | When CONFIG_FAIR_GROUP_SCHED is defined, a "cpu.shares" file is created for each |
237 | |||
238 | When CONFIG_USER_SCHED is defined, a directory is created in sysfs for each new | ||
239 | user and a "cpu_share" file is added in that directory. | ||
240 | |||
241 | # cd /sys/kernel/uids | ||
242 | # cat 512/cpu_share # Display user 512's CPU share | ||
243 | 1024 | ||
244 | # echo 2048 > 512/cpu_share # Modify user 512's CPU share | ||
245 | # cat 512/cpu_share # Display user 512's CPU share | ||
246 | 2048 | ||
247 | # | ||
248 | |||
249 | CPU bandwidth between two users is divided in the ratio of their CPU shares. | ||
250 | For example: if you would like user "root" to get twice the bandwidth of user | ||
251 | "guest," then set the cpu_share for both the users such that "root"'s cpu_share | ||
252 | is twice "guest"'s cpu_share. | ||
253 | |||
254 | When CONFIG_CGROUP_SCHED is defined, a "cpu.shares" file is created for each | ||
255 | group created using the pseudo filesystem. See example steps below to create | 228 | group created using the pseudo filesystem. See example steps below to create |
256 | task groups and modify their CPU share using the "cgroups" pseudo filesystem. | 229 | task groups and modify their CPU share using the "cgroups" pseudo filesystem. |
257 | 230 | ||
@@ -273,24 +246,3 @@ task groups and modify their CPU share using the "cgroups" pseudo filesystem. | |||
273 | 246 | ||
274 | # #Launch gmplayer (or your favourite movie player) | 247 | # #Launch gmplayer (or your favourite movie player) |
275 | # echo <movie_player_pid> > multimedia/tasks | 248 | # echo <movie_player_pid> > multimedia/tasks |
276 | |||
277 | 8. Implementation note: user namespaces | ||
278 | |||
279 | User namespaces are intended to be hierarchical. But they are currently | ||
280 | only partially implemented. Each of those has ramifications for CFS. | ||
281 | |||
282 | First, since user namespaces are hierarchical, the /sys/kernel/uids | ||
283 | presentation is inadequate. Eventually we will likely want to use sysfs | ||
284 | tagging to provide private views of /sys/kernel/uids within each user | ||
285 | namespace. | ||
286 | |||
287 | Second, the hierarchical nature is intended to support completely | ||
288 | unprivileged use of user namespaces. So if using user groups, then | ||
289 | we want the users in a user namespace to be children of the user | ||
290 | who created it. | ||
291 | |||
292 | That is currently unimplemented. So instead, every user in a new | ||
293 | user namespace will receive 1024 shares just like any user in the | ||
294 | initial user namespace. Note that at the moment creation of a new | ||
295 | user namespace requires each of CAP_SYS_ADMIN, CAP_SETUID, and | ||
296 | CAP_SETGID. | ||
diff --git a/Documentation/scheduler/sched-rt-group.txt b/Documentation/scheduler/sched-rt-group.txt index 86eabe6c3419..605b0d40329d 100644 --- a/Documentation/scheduler/sched-rt-group.txt +++ b/Documentation/scheduler/sched-rt-group.txt | |||
@@ -126,23 +126,12 @@ priority! | |||
126 | 2.3 Basis for grouping tasks | 126 | 2.3 Basis for grouping tasks |
127 | ---------------------------- | 127 | ---------------------------- |
128 | 128 | ||
129 | There are two compile-time settings for allocating CPU bandwidth. These are | 129 | Enabling CONFIG_RT_GROUP_SCHED lets you explicitly allocate real |
130 | configured using the "Basis for grouping tasks" multiple choice menu under | 130 | CPU bandwidth to task groups. |
131 | General setup > Group CPU Scheduler: | ||
132 | |||
133 | a. CONFIG_USER_SCHED (aka "Basis for grouping tasks" = "user id") | ||
134 | |||
135 | This lets you use the virtual files under | ||
136 | "/sys/kernel/uids/<uid>/cpu_rt_runtime_us" to control he CPU time reserved for | ||
137 | each user . | ||
138 | |||
139 | The other option is: | ||
140 | |||
141 | .o CONFIG_CGROUP_SCHED (aka "Basis for grouping tasks" = "Control groups") | ||
142 | 131 | ||
143 | This uses the /cgroup virtual file system and | 132 | This uses the /cgroup virtual file system and |
144 | "/cgroup/<cgroup>/cpu.rt_runtime_us" to control the CPU time reserved for each | 133 | "/cgroup/<cgroup>/cpu.rt_runtime_us" to control the CPU time reserved for each |
145 | control group instead. | 134 | control group. |
146 | 135 | ||
147 | For more information on working with control groups, you should read | 136 | For more information on working with control groups, you should read |
148 | Documentation/cgroups/cgroups.txt as well. | 137 | Documentation/cgroups/cgroups.txt as well. |
@@ -161,8 +150,7 @@ For now, this can be simplified to just the following (but see Future plans): | |||
161 | =============== | 150 | =============== |
162 | 151 | ||
163 | There is work in progress to make the scheduling period for each group | 152 | There is work in progress to make the scheduling period for each group |
164 | ("/sys/kernel/uids/<uid>/cpu_rt_period_us" or | 153 | ("/cgroup/<cgroup>/cpu.rt_period_us") configurable as well. |
165 | "/cgroup/<cgroup>/cpu.rt_period_us" respectively) configurable as well. | ||
166 | 154 | ||
167 | The constraint on the period is that a subgroup must have a smaller or | 155 | The constraint on the period is that a subgroup must have a smaller or |
168 | equal period to its parent. But realistically its not very useful _yet_ | 156 | equal period to its parent. But realistically its not very useful _yet_ |
diff --git a/Documentation/scsi/ChangeLog.lpfc b/Documentation/scsi/ChangeLog.lpfc index 2ffc1148eb95..e759e92e286d 100644 --- a/Documentation/scsi/ChangeLog.lpfc +++ b/Documentation/scsi/ChangeLog.lpfc | |||
@@ -707,7 +707,7 @@ Changes from 20040920 to 20041018 | |||
707 | * Integrate patches from Christoph Hellwig: two new helpers common | 707 | * Integrate patches from Christoph Hellwig: two new helpers common |
708 | to lpfc_sli_resume_iocb and lpfc_sli_issue_iocb - singificant | 708 | to lpfc_sli_resume_iocb and lpfc_sli_issue_iocb - singificant |
709 | cleanup of those two functions - the unused SLI_IOCB_USE_TXQ is | 709 | cleanup of those two functions - the unused SLI_IOCB_USE_TXQ is |
710 | gone - lpfc_sli_issue_iocb_wait loses it's flags argument | 710 | gone - lpfc_sli_issue_iocb_wait loses its flags argument |
711 | totally. | 711 | totally. |
712 | * Fix in lpfc_sli.c: we can not store a 5 bit value in a 4-bit | 712 | * Fix in lpfc_sli.c: we can not store a 5 bit value in a 4-bit |
713 | field. | 713 | field. |
@@ -1028,7 +1028,7 @@ Changes from 20040614 to 20040709 | |||
1028 | * Remove the need for buf_tmo. | 1028 | * Remove the need for buf_tmo. |
1029 | * Changed ULP_BDE64 to struct ulp_bde64. | 1029 | * Changed ULP_BDE64 to struct ulp_bde64. |
1030 | * Changed ULP_BDE to struct ulp_bde. | 1030 | * Changed ULP_BDE to struct ulp_bde. |
1031 | * Cleanup lpfc_os_return_scsi_cmd() and it's call path. | 1031 | * Cleanup lpfc_os_return_scsi_cmd() and its call path. |
1032 | * Removed lpfc_no_device_delay. | 1032 | * Removed lpfc_no_device_delay. |
1033 | * Consolidating lpfc_hba_put_event() into lpfc_put_event(). | 1033 | * Consolidating lpfc_hba_put_event() into lpfc_put_event(). |
1034 | * Removed following attributes and their functionality: | 1034 | * Removed following attributes and their functionality: |
diff --git a/Documentation/scsi/FlashPoint.txt b/Documentation/scsi/FlashPoint.txt index d5acaa300a46..1540a92f6d2b 100644 --- a/Documentation/scsi/FlashPoint.txt +++ b/Documentation/scsi/FlashPoint.txt | |||
@@ -71,7 +71,7 @@ peters@mylex.com | |||
71 | 71 | ||
72 | Ever since its introduction last October, the BusLogic FlashPoint LT has | 72 | Ever since its introduction last October, the BusLogic FlashPoint LT has |
73 | been problematic for members of the Linux community, in that no Linux | 73 | been problematic for members of the Linux community, in that no Linux |
74 | drivers have been available for this new Ultra SCSI product. Despite it's | 74 | drivers have been available for this new Ultra SCSI product. Despite its |
75 | officially being positioned as a desktop workstation product, and not being | 75 | officially being positioned as a desktop workstation product, and not being |
76 | particularly well suited for a high performance multitasking operating | 76 | particularly well suited for a high performance multitasking operating |
77 | system like Linux, the FlashPoint LT has been touted by computer system | 77 | system like Linux, the FlashPoint LT has been touted by computer system |
diff --git a/Documentation/scsi/dtc3x80.txt b/Documentation/scsi/dtc3x80.txt index e8ae6230ab3e..1d7af9f9a8ed 100644 --- a/Documentation/scsi/dtc3x80.txt +++ b/Documentation/scsi/dtc3x80.txt | |||
@@ -12,7 +12,7 @@ The 3180 does not. Otherwise, they are identical. | |||
12 | The DTC3x80 does not support DMA but it does have Pseudo-DMA which is | 12 | The DTC3x80 does not support DMA but it does have Pseudo-DMA which is |
13 | supported by the driver. | 13 | supported by the driver. |
14 | 14 | ||
15 | It's DTC406 scsi chip is supposedly compatible with the NCR 53C400. | 15 | Its DTC406 scsi chip is supposedly compatible with the NCR 53C400. |
16 | It is memory mapped, uses an IRQ, but no dma or io-port. There is | 16 | It is memory mapped, uses an IRQ, but no dma or io-port. There is |
17 | internal DMA, between SCSI bus and an on-chip 128-byte buffer. Double | 17 | internal DMA, between SCSI bus and an on-chip 128-byte buffer. Double |
18 | buffering is done automagically by the chip. Data is transferred | 18 | buffering is done automagically by the chip. Data is transferred |
diff --git a/Documentation/scsi/ncr53c8xx.txt b/Documentation/scsi/ncr53c8xx.txt index 08e2b4d04aab..cda5f8fa2c66 100644 --- a/Documentation/scsi/ncr53c8xx.txt +++ b/Documentation/scsi/ncr53c8xx.txt | |||
@@ -1479,7 +1479,7 @@ Wide16 SCSI. | |||
1479 | Enabling serial NVRAM support enables detection of the serial NVRAM included | 1479 | Enabling serial NVRAM support enables detection of the serial NVRAM included |
1480 | on Symbios and some Symbios compatible host adaptors, and Tekram boards. The | 1480 | on Symbios and some Symbios compatible host adaptors, and Tekram boards. The |
1481 | serial NVRAM is used by Symbios and Tekram to hold set up parameters for the | 1481 | serial NVRAM is used by Symbios and Tekram to hold set up parameters for the |
1482 | host adaptor and it's attached drives. | 1482 | host adaptor and its attached drives. |
1483 | 1483 | ||
1484 | The Symbios NVRAM also holds data on the boot order of host adaptors in a | 1484 | The Symbios NVRAM also holds data on the boot order of host adaptors in a |
1485 | system with more than one host adaptor. This enables the order of scanning | 1485 | system with more than one host adaptor. This enables the order of scanning |
diff --git a/Documentation/scsi/osst.txt b/Documentation/scsi/osst.txt index f536907e241d..2b21890bc983 100644 --- a/Documentation/scsi/osst.txt +++ b/Documentation/scsi/osst.txt | |||
@@ -40,7 +40,7 @@ behavior looks very much the same as st to the userspace applications. | |||
40 | 40 | ||
41 | History | 41 | History |
42 | ------- | 42 | ------- |
43 | In the first place, osst shared it's identity very much with st. That meant | 43 | In the first place, osst shared its identity very much with st. That meant |
44 | that it used the same kernel structures and the same device node as st. | 44 | that it used the same kernel structures and the same device node as st. |
45 | So you could only have either of them being present in the kernel. This has | 45 | So you could only have either of them being present in the kernel. This has |
46 | been fixed by registering an own device, now. | 46 | been fixed by registering an own device, now. |
diff --git a/Documentation/scsi/scsi_fc_transport.txt b/Documentation/scsi/scsi_fc_transport.txt index aec6549ab097..e00192de4d1c 100644 --- a/Documentation/scsi/scsi_fc_transport.txt +++ b/Documentation/scsi/scsi_fc_transport.txt | |||
@@ -70,7 +70,7 @@ Overview: | |||
70 | up to an administrative entity controlling the vport. For example, | 70 | up to an administrative entity controlling the vport. For example, |
71 | if vports are to be associated with virtual machines, a XEN mgmt | 71 | if vports are to be associated with virtual machines, a XEN mgmt |
72 | utility would be responsible for creating wwpn/wwnn's for the vport, | 72 | utility would be responsible for creating wwpn/wwnn's for the vport, |
73 | using it's own naming authority and OUI. (Note: it already does this | 73 | using its own naming authority and OUI. (Note: it already does this |
74 | for virtual MAC addresses). | 74 | for virtual MAC addresses). |
75 | 75 | ||
76 | 76 | ||
@@ -81,7 +81,7 @@ Device Trees and Vport Objects: | |||
81 | with rports and scsi target objects underneath it. Currently the FC | 81 | with rports and scsi target objects underneath it. Currently the FC |
82 | transport creates the vport object and places it under the scsi_host | 82 | transport creates the vport object and places it under the scsi_host |
83 | object corresponding to the physical adapter. The LLDD will allocate | 83 | object corresponding to the physical adapter. The LLDD will allocate |
84 | a new scsi_host for the vport and link it's object under the vport. | 84 | a new scsi_host for the vport and link its object under the vport. |
85 | The remainder of the tree under the vports scsi_host is the same | 85 | The remainder of the tree under the vports scsi_host is the same |
86 | as the non-NPIV case. The transport is written currently to easily | 86 | as the non-NPIV case. The transport is written currently to easily |
87 | allow the parent of the vport to be something other than the scsi_host. | 87 | allow the parent of the vport to be something other than the scsi_host. |
diff --git a/Documentation/scsi/sym53c8xx_2.txt b/Documentation/scsi/sym53c8xx_2.txt index eb9a7b905b64..6f63b7989679 100644 --- a/Documentation/scsi/sym53c8xx_2.txt +++ b/Documentation/scsi/sym53c8xx_2.txt | |||
@@ -687,7 +687,7 @@ maintain the driver code. | |||
687 | Enabling serial NVRAM support enables detection of the serial NVRAM included | 687 | Enabling serial NVRAM support enables detection of the serial NVRAM included |
688 | on Symbios and some Symbios compatible host adaptors, and Tekram boards. The | 688 | on Symbios and some Symbios compatible host adaptors, and Tekram boards. The |
689 | serial NVRAM is used by Symbios and Tekram to hold set up parameters for the | 689 | serial NVRAM is used by Symbios and Tekram to hold set up parameters for the |
690 | host adaptor and it's attached drives. | 690 | host adaptor and its attached drives. |
691 | 691 | ||
692 | The Symbios NVRAM also holds data on the boot order of host adaptors in a | 692 | The Symbios NVRAM also holds data on the boot order of host adaptors in a |
693 | system with more than one host adaptor. This information is no longer used | 693 | system with more than one host adaptor. This information is no longer used |
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index bfcbbf88c44d..2075bbb8b3e2 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -227,6 +227,16 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
227 | 227 | ||
228 | The power-management is supported. | 228 | The power-management is supported. |
229 | 229 | ||
230 | Module snd-asihpi | ||
231 | ----------------- | ||
232 | |||
233 | Module for AudioScience ASI soundcards | ||
234 | |||
235 | enable_hpi_hwdep - enable HPI hwdep for AudioScience soundcard | ||
236 | |||
237 | This module supports multiple cards. | ||
238 | The driver requires the firmware loader support on kernel. | ||
239 | |||
230 | Module snd-atiixp | 240 | Module snd-atiixp |
231 | ----------------- | 241 | ----------------- |
232 | 242 | ||
@@ -622,28 +632,23 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
622 | 632 | ||
623 | The power-management is supported. | 633 | The power-management is supported. |
624 | 634 | ||
625 | Module snd-es968 | ||
626 | ---------------- | ||
627 | |||
628 | Module for sound cards based on ESS ES968 chip (PnP only). | ||
629 | |||
630 | This module supports multiple cards, PnP and autoprobe. | ||
631 | |||
632 | The power-management is supported. | ||
633 | |||
634 | Module snd-es1688 | 635 | Module snd-es1688 |
635 | ----------------- | 636 | ----------------- |
636 | 637 | ||
637 | Module for ESS AudioDrive ES-1688 and ES-688 sound cards. | 638 | Module for ESS AudioDrive ES-1688 and ES-688 sound cards. |
638 | 639 | ||
639 | port - port # for ES-1688 chip (0x220,0x240,0x260) | 640 | isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) |
640 | fm_port - port # for OPL3 (option; share the same port as default) | ||
641 | mpu_port - port # for MPU-401 port (0x300,0x310,0x320,0x330), -1 = disable (default) | 641 | mpu_port - port # for MPU-401 port (0x300,0x310,0x320,0x330), -1 = disable (default) |
642 | irq - IRQ # for ES-1688 chip (5,7,9,10) | ||
643 | mpu_irq - IRQ # for MPU-401 port (5,7,9,10) | 642 | mpu_irq - IRQ # for MPU-401 port (5,7,9,10) |
643 | fm_port - port # for OPL3 (option; share the same port as default) | ||
644 | |||
645 | with isapnp=0, the following additional options are available: | ||
646 | port - port # for ES-1688 chip (0x220,0x240,0x260) | ||
647 | irq - IRQ # for ES-1688 chip (5,7,9,10) | ||
644 | dma8 - DMA # for ES-1688 chip (0,1,3) | 648 | dma8 - DMA # for ES-1688 chip (0,1,3) |
645 | 649 | ||
646 | This module supports multiple cards and autoprobe (without MPU-401 port). | 650 | This module supports multiple cards and autoprobe (without MPU-401 port) |
651 | and PnP with the ES968 chip. | ||
647 | 652 | ||
648 | Module snd-es18xx | 653 | Module snd-es18xx |
649 | ----------------- | 654 | ----------------- |
diff --git a/Documentation/sound/alsa/HD-Audio.txt b/Documentation/sound/alsa/HD-Audio.txt index f4dd3bf99d12..bdafdbd32561 100644 --- a/Documentation/sound/alsa/HD-Audio.txt +++ b/Documentation/sound/alsa/HD-Audio.txt | |||
@@ -119,10 +119,18 @@ the codec slots 0 and 1 no matter what the hardware reports. | |||
119 | 119 | ||
120 | Interrupt Handling | 120 | Interrupt Handling |
121 | ~~~~~~~~~~~~~~~~~~ | 121 | ~~~~~~~~~~~~~~~~~~ |
122 | In rare but some cases, the interrupt isn't properly handled as | 122 | HD-audio driver uses MSI as default (if available) since 2.6.33 |
123 | default. You would notice this by the DMA transfer error reported by | 123 | kernel as MSI works better on some machines, and in general, it's |
124 | ALSA PCM core, for example. Using MSI might help in such a case. | 124 | better for performance. However, Nvidia controllers showed bad |
125 | Pass `enable_msi=1` option for enabling MSI. | 125 | regressions with MSI (especially in a combination with AMD chipset), |
126 | thus we disabled MSI for them. | ||
127 | |||
128 | There seem also still other devices that don't work with MSI. If you | ||
129 | see a regression wrt the sound quality (stuttering, etc) or a lock-up | ||
130 | in the recent kernel, try to pass `enable_msi=0` option to disable | ||
131 | MSI. If it works, you can add the known bad device to the blacklist | ||
132 | defined in hda_intel.c. In such a case, please report and give the | ||
133 | patch back to the upstream developer. | ||
126 | 134 | ||
127 | 135 | ||
128 | HD-AUDIO CODEC | 136 | HD-AUDIO CODEC |
@@ -196,7 +204,6 @@ generic parser regardless of the codec. Usually the codec-specific | |||
196 | parser is much better than the generic parser (as now). Thus this | 204 | parser is much better than the generic parser (as now). Thus this |
197 | option is more about the debugging purpose. | 205 | option is more about the debugging purpose. |
198 | 206 | ||
199 | |||
200 | Speaker and Headphone Output | 207 | Speaker and Headphone Output |
201 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 208 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
202 | One of the most frequent (and obvious) bugs with HD-audio is the | 209 | One of the most frequent (and obvious) bugs with HD-audio is the |
@@ -592,6 +599,9 @@ probing, the proc file is available, so you can get the raw codec | |||
592 | information before modified by the driver. Of course, the driver | 599 | information before modified by the driver. Of course, the driver |
593 | isn't usable with `probe_only=1`. But you can continue the | 600 | isn't usable with `probe_only=1`. But you can continue the |
594 | configuration via hwdep sysfs file if hda-reconfig option is enabled. | 601 | configuration via hwdep sysfs file if hda-reconfig option is enabled. |
602 | Using `probe_only` mask 2 skips the reset of HDA codecs (use | ||
603 | `probe_only=3` as module option). The hwdep interface can be used | ||
604 | to determine the BIOS codec initialization. | ||
595 | 605 | ||
596 | 606 | ||
597 | hda-verb | 607 | hda-verb |
diff --git a/Documentation/sound/alsa/soc/dapm.txt b/Documentation/sound/alsa/soc/dapm.txt index 9ac842be9b4f..05bf5a0eee41 100644 --- a/Documentation/sound/alsa/soc/dapm.txt +++ b/Documentation/sound/alsa/soc/dapm.txt | |||
@@ -188,8 +188,8 @@ The WM8731 output mixer has 3 inputs (sources) | |||
188 | 3. Mic Sidetone Input | 188 | 3. Mic Sidetone Input |
189 | 189 | ||
190 | Each input in this example has a kcontrol associated with it (defined in example | 190 | Each input in this example has a kcontrol associated with it (defined in example |
191 | above) and is connected to the output mixer via it's kcontrol name. We can now | 191 | above) and is connected to the output mixer via its kcontrol name. We can now |
192 | connect the destination widget (wrt audio signal) with it's source widgets. | 192 | connect the destination widget (wrt audio signal) with its source widgets. |
193 | 193 | ||
194 | /* output mixer */ | 194 | /* output mixer */ |
195 | {"Output Mixer", "Line Bypass Switch", "Line Input"}, | 195 | {"Output Mixer", "Line Bypass Switch", "Line Input"}, |
diff --git a/Documentation/sound/alsa/soc/machine.txt b/Documentation/sound/alsa/soc/machine.txt index bab7711ce963..2524c75557df 100644 --- a/Documentation/sound/alsa/soc/machine.txt +++ b/Documentation/sound/alsa/soc/machine.txt | |||
@@ -67,7 +67,7 @@ static struct snd_soc_dai_link corgi_dai = { | |||
67 | .ops = &corgi_ops, | 67 | .ops = &corgi_ops, |
68 | }; | 68 | }; |
69 | 69 | ||
70 | struct snd_soc_card then sets up the machine with it's DAIs. e.g. | 70 | struct snd_soc_card then sets up the machine with its DAIs. e.g. |
71 | 71 | ||
72 | /* corgi audio machine driver */ | 72 | /* corgi audio machine driver */ |
73 | static struct snd_soc_card snd_soc_corgi = { | 73 | static struct snd_soc_card snd_soc_corgi = { |
diff --git a/Documentation/sound/alsa/soc/overview.txt b/Documentation/sound/alsa/soc/overview.txt index 1e4c6d3655f2..138ac88c1461 100644 --- a/Documentation/sound/alsa/soc/overview.txt +++ b/Documentation/sound/alsa/soc/overview.txt | |||
@@ -33,7 +33,7 @@ features :- | |||
33 | and machines. | 33 | and machines. |
34 | 34 | ||
35 | * Easy I2S/PCM audio interface setup between codec and SoC. Each SoC | 35 | * Easy I2S/PCM audio interface setup between codec and SoC. Each SoC |
36 | interface and codec registers it's audio interface capabilities with the | 36 | interface and codec registers its audio interface capabilities with the |
37 | core and are subsequently matched and configured when the application | 37 | core and are subsequently matched and configured when the application |
38 | hardware parameters are known. | 38 | hardware parameters are known. |
39 | 39 | ||
diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt index 34c76a55bc04..9b659c79a547 100644 --- a/Documentation/sparse.txt +++ b/Documentation/sparse.txt | |||
@@ -54,12 +54,12 @@ Getting sparse | |||
54 | ~~~~~~~~~~~~~~ | 54 | ~~~~~~~~~~~~~~ |
55 | 55 | ||
56 | You can get latest released versions from the Sparse homepage at | 56 | You can get latest released versions from the Sparse homepage at |
57 | http://www.kernel.org/pub/linux/kernel/people/josh/sparse/ | 57 | https://sparse.wiki.kernel.org/index.php/Main_Page |
58 | 58 | ||
59 | Alternatively, you can get snapshots of the latest development version | 59 | Alternatively, you can get snapshots of the latest development version |
60 | of sparse using git to clone.. | 60 | of sparse using git to clone.. |
61 | 61 | ||
62 | git://git.kernel.org/pub/scm/linux/kernel/git/josh/sparse.git | 62 | git://git.kernel.org/pub/scm/devel/sparse/sparse.git |
63 | 63 | ||
64 | DaveJ has hourly generated tarballs of the git tree available at.. | 64 | DaveJ has hourly generated tarballs of the git tree available at.. |
65 | 65 | ||
diff --git a/Documentation/spi/spidev_test.c b/Documentation/spi/spidev_test.c index 10abd3773e49..16feda901469 100644 --- a/Documentation/spi/spidev_test.c +++ b/Documentation/spi/spidev_test.c | |||
@@ -58,7 +58,7 @@ static void transfer(int fd) | |||
58 | }; | 58 | }; |
59 | 59 | ||
60 | ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr); | 60 | ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr); |
61 | if (ret == 1) | 61 | if (ret < 1) |
62 | pabort("can't send spi message"); | 62 | pabort("can't send spi message"); |
63 | 63 | ||
64 | for (ret = 0; ret < ARRAY_SIZE(tx); ret++) { | 64 | for (ret = 0; ret < ARRAY_SIZE(tx); ret++) { |
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt index 5effa5bd993b..e213f45cf9d7 100644 --- a/Documentation/stable_kernel_rules.txt +++ b/Documentation/stable_kernel_rules.txt | |||
@@ -18,16 +18,15 @@ Rules on what kind of patches are accepted, and which ones are not, into the | |||
18 | - It cannot contain any "trivial" fixes in it (spelling changes, | 18 | - It cannot contain any "trivial" fixes in it (spelling changes, |
19 | whitespace cleanups, etc). | 19 | whitespace cleanups, etc). |
20 | - It must follow the Documentation/SubmittingPatches rules. | 20 | - It must follow the Documentation/SubmittingPatches rules. |
21 | - It or an equivalent fix must already exist in Linus' tree. Quote the | 21 | - It or an equivalent fix must already exist in Linus' tree (upstream). |
22 | respective commit ID in Linus' tree in your patch submission to -stable. | ||
23 | 22 | ||
24 | 23 | ||
25 | Procedure for submitting patches to the -stable tree: | 24 | Procedure for submitting patches to the -stable tree: |
26 | 25 | ||
27 | - Send the patch, after verifying that it follows the above rules, to | 26 | - Send the patch, after verifying that it follows the above rules, to |
28 | stable@kernel.org. | 27 | stable@kernel.org. You must note the upstream commit ID in the changelog |
29 | - To have the patch automatically included in the stable tree, add the | 28 | of your submission. |
30 | the tag | 29 | - To have the patch automatically included in the stable tree, add the tag |
31 | Cc: stable@kernel.org | 30 | Cc: stable@kernel.org |
32 | in the sign-off area. Once the patch is merged it will be applied to | 31 | in the sign-off area. Once the patch is merged it will be applied to |
33 | the stable tree without anything else needing to be done by the author | 32 | the stable tree without anything else needing to be done by the author |
diff --git a/Documentation/sysctl/net.txt b/Documentation/sysctl/net.txt index df38ef046f8d..cbd05ffc606b 100644 --- a/Documentation/sysctl/net.txt +++ b/Documentation/sysctl/net.txt | |||
@@ -84,6 +84,16 @@ netdev_max_backlog | |||
84 | Maximum number of packets, queued on the INPUT side, when the interface | 84 | Maximum number of packets, queued on the INPUT side, when the interface |
85 | receives packets faster than kernel can process them. | 85 | receives packets faster than kernel can process them. |
86 | 86 | ||
87 | netdev_tstamp_prequeue | ||
88 | ---------------------- | ||
89 | |||
90 | If set to 0, RX packet timestamps can be sampled after RPS processing, when | ||
91 | the target CPU processes packets. It might give some delay on timestamps, but | ||
92 | permit to distribute the load on several cpus. | ||
93 | |||
94 | If set to 1 (default), timestamps are sampled as soon as possible, before | ||
95 | queueing. | ||
96 | |||
87 | optmem_max | 97 | optmem_max |
88 | ---------- | 98 | ---------- |
89 | 99 | ||
diff --git a/Documentation/sysfs-rules.txt b/Documentation/sysfs-rules.txt index 5d8bc2cd250c..c1a1fd636bf9 100644 --- a/Documentation/sysfs-rules.txt +++ b/Documentation/sysfs-rules.txt | |||
@@ -125,7 +125,7 @@ versions of the sysfs interface. | |||
125 | - Block | 125 | - Block |
126 | The converted block subsystem at /sys/class/block or | 126 | The converted block subsystem at /sys/class/block or |
127 | /sys/subsystem/block will contain the links for disks and partitions | 127 | /sys/subsystem/block will contain the links for disks and partitions |
128 | at the same level, never in a hierarchy. Assuming the block subsytem to | 128 | at the same level, never in a hierarchy. Assuming the block subsystem to |
129 | contain only disks and not partition devices in the same flat list is | 129 | contain only disks and not partition devices in the same flat list is |
130 | a bug in the application. | 130 | a bug in the application. |
131 | 131 | ||
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt index d56a01775423..5c17196c8fe9 100644 --- a/Documentation/sysrq.txt +++ b/Documentation/sysrq.txt | |||
@@ -177,13 +177,13 @@ virtual console (ALT+Fn) and then back again should also help. | |||
177 | 177 | ||
178 | * I hit SysRq, but nothing seems to happen, what's wrong? | 178 | * I hit SysRq, but nothing seems to happen, what's wrong? |
179 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 179 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
180 | There are some keyboards that send different scancodes for SysRq than the | 180 | There are some keyboards that produce a different keycode for SysRq than the |
181 | pre-defined 0x54. So if SysRq doesn't work out of the box for a certain | 181 | pre-defined value of 99 (see KEY_SYSRQ in include/linux/input.h), or which |
182 | keyboard, run 'showkey -s' to find out the proper scancode sequence. Then | 182 | don't have a SysRq key at all. In these cases, run 'showkey -s' to find an |
183 | use 'setkeycodes <sequence> 84' to define this sequence to the usual SysRq | 183 | appropriate scancode sequence, and use 'setkeycodes <sequence> 99' to map |
184 | code (84 is decimal for 0x54). It's probably best to put this command in a | 184 | this sequence to the usual SysRq code (e.g., 'setkeycodes e05b 99'). It's |
185 | boot script. Oh, and by the way, you exit 'showkey' by not typing anything | 185 | probably best to put this command in a boot script. Oh, and by the way, you |
186 | for ten seconds. | 186 | exit 'showkey' by not typing anything for ten seconds. |
187 | 187 | ||
188 | * I want to add SysRQ key events to a module, how does it work? | 188 | * I want to add SysRQ key events to a module, how does it work? |
189 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 189 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
diff --git a/Documentation/timers/hpet_example.c b/Documentation/timers/hpet_example.c index f9ce2d9fdfd5..4bfafb7bc4c5 100644 --- a/Documentation/timers/hpet_example.c +++ b/Documentation/timers/hpet_example.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <sys/types.h> | 10 | #include <sys/types.h> |
11 | #include <sys/wait.h> | 11 | #include <sys/wait.h> |
12 | #include <signal.h> | 12 | #include <signal.h> |
13 | #include <fcntl.h> | ||
14 | #include <errno.h> | 13 | #include <errno.h> |
15 | #include <sys/time.h> | 14 | #include <sys/time.h> |
16 | #include <linux/hpet.h> | 15 | #include <linux/hpet.h> |
@@ -24,7 +23,6 @@ extern void hpet_read(int, const char **); | |||
24 | 23 | ||
25 | #include <sys/poll.h> | 24 | #include <sys/poll.h> |
26 | #include <sys/ioctl.h> | 25 | #include <sys/ioctl.h> |
27 | #include <signal.h> | ||
28 | 26 | ||
29 | struct hpet_command { | 27 | struct hpet_command { |
30 | char *command; | 28 | char *command; |
diff --git a/Documentation/trace/events.txt b/Documentation/trace/events.txt index 02ac6ed38b2d..09bd8e902989 100644 --- a/Documentation/trace/events.txt +++ b/Documentation/trace/events.txt | |||
@@ -90,7 +90,8 @@ In order to facilitate early boot debugging, use boot option: | |||
90 | 90 | ||
91 | trace_event=[event-list] | 91 | trace_event=[event-list] |
92 | 92 | ||
93 | The format of this boot option is the same as described in section 2.1. | 93 | event-list is a comma separated list of events. See section 2.1 for event |
94 | format. | ||
94 | 95 | ||
95 | 3. Defining an event-enabled tracepoint | 96 | 3. Defining an event-enabled tracepoint |
96 | ======================================= | 97 | ======================================= |
@@ -238,7 +239,7 @@ subsystem's filter file. | |||
238 | 239 | ||
239 | For convenience, filters for every event in a subsystem can be set or | 240 | For convenience, filters for every event in a subsystem can be set or |
240 | cleared as a group by writing a filter expression into the filter file | 241 | cleared as a group by writing a filter expression into the filter file |
241 | at the root of the subsytem. Note however, that if a filter for any | 242 | at the root of the subsystem. Note however, that if a filter for any |
242 | event within the subsystem lacks a field specified in the subsystem | 243 | event within the subsystem lacks a field specified in the subsystem |
243 | filter, or if the filter can't be applied for any other reason, the | 244 | filter, or if the filter can't be applied for any other reason, the |
244 | filter for that event will retain its previous setting. This can | 245 | filter for that event will retain its previous setting. This can |
@@ -250,7 +251,7 @@ fields can be guaranteed to propagate successfully to all events. | |||
250 | Here are a few subsystem filter examples that also illustrate the | 251 | Here are a few subsystem filter examples that also illustrate the |
251 | above points: | 252 | above points: |
252 | 253 | ||
253 | Clear the filters on all events in the sched subsytem: | 254 | Clear the filters on all events in the sched subsystem: |
254 | 255 | ||
255 | # cd /sys/kernel/debug/tracing/events/sched | 256 | # cd /sys/kernel/debug/tracing/events/sched |
256 | # echo 0 > filter | 257 | # echo 0 > filter |
@@ -260,7 +261,7 @@ none | |||
260 | none | 261 | none |
261 | 262 | ||
262 | Set a filter using only common fields for all events in the sched | 263 | Set a filter using only common fields for all events in the sched |
263 | subsytem (all events end up with the same filter): | 264 | subsystem (all events end up with the same filter): |
264 | 265 | ||
265 | # cd /sys/kernel/debug/tracing/events/sched | 266 | # cd /sys/kernel/debug/tracing/events/sched |
266 | # echo common_pid == 0 > filter | 267 | # echo common_pid == 0 > filter |
@@ -270,7 +271,7 @@ common_pid == 0 | |||
270 | common_pid == 0 | 271 | common_pid == 0 |
271 | 272 | ||
272 | Attempt to set a filter using a non-common field for all events in the | 273 | Attempt to set a filter using a non-common field for all events in the |
273 | sched subsytem (all events but those that have a prev_pid field retain | 274 | sched subsystem (all events but those that have a prev_pid field retain |
274 | their old filters): | 275 | their old filters): |
275 | 276 | ||
276 | # cd /sys/kernel/debug/tracing/events/sched | 277 | # cd /sys/kernel/debug/tracing/events/sched |
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt index 03485bfbd797..557c1edeccaf 100644 --- a/Documentation/trace/ftrace.txt +++ b/Documentation/trace/ftrace.txt | |||
@@ -155,6 +155,9 @@ of ftrace. Here is a list of some of the key files: | |||
155 | to be traced. Echoing names of functions into this file | 155 | to be traced. Echoing names of functions into this file |
156 | will limit the trace to only those functions. | 156 | will limit the trace to only those functions. |
157 | 157 | ||
158 | This interface also allows for commands to be used. See the | ||
159 | "Filter commands" section for more details. | ||
160 | |||
158 | set_ftrace_notrace: | 161 | set_ftrace_notrace: |
159 | 162 | ||
160 | This has an effect opposite to that of | 163 | This has an effect opposite to that of |
@@ -1337,12 +1340,14 @@ ftrace_dump_on_oops must be set. To set ftrace_dump_on_oops, one | |||
1337 | can either use the sysctl function or set it via the proc system | 1340 | can either use the sysctl function or set it via the proc system |
1338 | interface. | 1341 | interface. |
1339 | 1342 | ||
1340 | sysctl kernel.ftrace_dump_on_oops=1 | 1343 | sysctl kernel.ftrace_dump_on_oops=n |
1341 | 1344 | ||
1342 | or | 1345 | or |
1343 | 1346 | ||
1344 | echo 1 > /proc/sys/kernel/ftrace_dump_on_oops | 1347 | echo n > /proc/sys/kernel/ftrace_dump_on_oops |
1345 | 1348 | ||
1349 | If n = 1, ftrace will dump buffers of all CPUs, if n = 2 ftrace will | ||
1350 | only dump the buffer of the CPU that triggered the oops. | ||
1346 | 1351 | ||
1347 | Here's an example of such a dump after a null pointer | 1352 | Here's an example of such a dump after a null pointer |
1348 | dereference in a kernel module: | 1353 | dereference in a kernel module: |
@@ -1822,6 +1827,47 @@ this special filter via: | |||
1822 | echo > set_graph_function | 1827 | echo > set_graph_function |
1823 | 1828 | ||
1824 | 1829 | ||
1830 | Filter commands | ||
1831 | --------------- | ||
1832 | |||
1833 | A few commands are supported by the set_ftrace_filter interface. | ||
1834 | Trace commands have the following format: | ||
1835 | |||
1836 | <function>:<command>:<parameter> | ||
1837 | |||
1838 | The following commands are supported: | ||
1839 | |||
1840 | - mod | ||
1841 | This command enables function filtering per module. The | ||
1842 | parameter defines the module. For example, if only the write* | ||
1843 | functions in the ext3 module are desired, run: | ||
1844 | |||
1845 | echo 'write*:mod:ext3' > set_ftrace_filter | ||
1846 | |||
1847 | This command interacts with the filter in the same way as | ||
1848 | filtering based on function names. Thus, adding more functions | ||
1849 | in a different module is accomplished by appending (>>) to the | ||
1850 | filter file. Remove specific module functions by prepending | ||
1851 | '!': | ||
1852 | |||
1853 | echo '!writeback*:mod:ext3' >> set_ftrace_filter | ||
1854 | |||
1855 | - traceon/traceoff | ||
1856 | These commands turn tracing on and off when the specified | ||
1857 | functions are hit. The parameter determines how many times the | ||
1858 | tracing system is turned on and off. If unspecified, there is | ||
1859 | no limit. For example, to disable tracing when a schedule bug | ||
1860 | is hit the first 5 times, run: | ||
1861 | |||
1862 | echo '__schedule_bug:traceoff:5' > set_ftrace_filter | ||
1863 | |||
1864 | These commands are cumulative whether or not they are appended | ||
1865 | to set_ftrace_filter. To remove a command, prepend it by '!' | ||
1866 | and drop the parameter: | ||
1867 | |||
1868 | echo '!__schedule_bug:traceoff' > set_ftrace_filter | ||
1869 | |||
1870 | |||
1825 | trace_pipe | 1871 | trace_pipe |
1826 | ---------- | 1872 | ---------- |
1827 | 1873 | ||
diff --git a/Documentation/trace/kprobetrace.txt b/Documentation/trace/kprobetrace.txt index a9100b28eb84..ec94748ae65b 100644 --- a/Documentation/trace/kprobetrace.txt +++ b/Documentation/trace/kprobetrace.txt | |||
@@ -40,7 +40,9 @@ Synopsis of kprobe_events | |||
40 | $stack : Fetch stack address. | 40 | $stack : Fetch stack address. |
41 | $retval : Fetch return value.(*) | 41 | $retval : Fetch return value.(*) |
42 | +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(**) | 42 | +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(**) |
43 | NAME=FETCHARG: Set NAME as the argument name of FETCHARG. | 43 | NAME=FETCHARG : Set NAME as the argument name of FETCHARG. |
44 | FETCHARG:TYPE : Set TYPE as the type of FETCHARG. Currently, basic types | ||
45 | (u8/u16/u32/u64/s8/s16/s32/s64) are supported. | ||
44 | 46 | ||
45 | (*) only for return probe. | 47 | (*) only for return probe. |
46 | (**) this is useful for fetching a field of data structures. | 48 | (**) this is useful for fetching a field of data structures. |
diff --git a/Documentation/usb/WUSB-Design-overview.txt b/Documentation/usb/WUSB-Design-overview.txt index c480e9c32dbd..4c5e37939344 100644 --- a/Documentation/usb/WUSB-Design-overview.txt +++ b/Documentation/usb/WUSB-Design-overview.txt | |||
@@ -381,7 +381,7 @@ descriptor that gives us the status of the transfer, its identification | |||
381 | we issue another URB to read into the destination buffer the chunk of | 381 | we issue another URB to read into the destination buffer the chunk of |
382 | data coming out of the remote endpoint. Done, wait for the next guy. The | 382 | data coming out of the remote endpoint. Done, wait for the next guy. The |
383 | callbacks for the URBs issued from here are the ones that will declare | 383 | callbacks for the URBs issued from here are the ones that will declare |
384 | the xfer complete at some point and call it's callback. | 384 | the xfer complete at some point and call its callback. |
385 | 385 | ||
386 | Seems simple, but the implementation is not trivial. | 386 | Seems simple, but the implementation is not trivial. |
387 | 387 | ||
diff --git a/Documentation/usb/bulk-streams.txt b/Documentation/usb/bulk-streams.txt new file mode 100644 index 000000000000..ffc02021863e --- /dev/null +++ b/Documentation/usb/bulk-streams.txt | |||
@@ -0,0 +1,78 @@ | |||
1 | Background | ||
2 | ========== | ||
3 | |||
4 | Bulk endpoint streams were added in the USB 3.0 specification. Streams allow a | ||
5 | device driver to overload a bulk endpoint so that multiple transfers can be | ||
6 | queued at once. | ||
7 | |||
8 | Streams are defined in sections 4.4.6.4 and 8.12.1.4 of the Universal Serial Bus | ||
9 | 3.0 specification at http://www.usb.org/developers/docs/ The USB Attached SCSI | ||
10 | Protocol, which uses streams to queue multiple SCSI commands, can be found on | ||
11 | the T10 website (http://t10.org/). | ||
12 | |||
13 | |||
14 | Device-side implications | ||
15 | ======================== | ||
16 | |||
17 | Once a buffer has been queued to a stream ring, the device is notified (through | ||
18 | an out-of-band mechanism on another endpoint) that data is ready for that stream | ||
19 | ID. The device then tells the host which "stream" it wants to start. The host | ||
20 | can also initiate a transfer on a stream without the device asking, but the | ||
21 | device can refuse that transfer. Devices can switch between streams at any | ||
22 | time. | ||
23 | |||
24 | |||
25 | Driver implications | ||
26 | =================== | ||
27 | |||
28 | int usb_alloc_streams(struct usb_interface *interface, | ||
29 | struct usb_host_endpoint **eps, unsigned int num_eps, | ||
30 | unsigned int num_streams, gfp_t mem_flags); | ||
31 | |||
32 | Device drivers will call this API to request that the host controller driver | ||
33 | allocate memory so the driver can use up to num_streams stream IDs. They must | ||
34 | pass an array of usb_host_endpoints that need to be setup with similar stream | ||
35 | IDs. This is to ensure that a UASP driver will be able to use the same stream | ||
36 | ID for the bulk IN and OUT endpoints used in a Bi-directional command sequence. | ||
37 | |||
38 | The return value is an error condition (if one of the endpoints doesn't support | ||
39 | streams, or the xHCI driver ran out of memory), or the number of streams the | ||
40 | host controller allocated for this endpoint. The xHCI host controller hardware | ||
41 | declares how many stream IDs it can support, and each bulk endpoint on a | ||
42 | SuperSpeed device will say how many stream IDs it can handle. Therefore, | ||
43 | drivers should be able to deal with being allocated less stream IDs than they | ||
44 | requested. | ||
45 | |||
46 | Do NOT call this function if you have URBs enqueued for any of the endpoints | ||
47 | passed in as arguments. Do not call this function to request less than two | ||
48 | streams. | ||
49 | |||
50 | Drivers will only be allowed to call this API once for the same endpoint | ||
51 | without calling usb_free_streams(). This is a simplification for the xHCI host | ||
52 | controller driver, and may change in the future. | ||
53 | |||
54 | |||
55 | Picking new Stream IDs to use | ||
56 | ============================ | ||
57 | |||
58 | Stream ID 0 is reserved, and should not be used to communicate with devices. If | ||
59 | usb_alloc_streams() returns with a value of N, you may use streams 1 though N. | ||
60 | To queue an URB for a specific stream, set the urb->stream_id value. If the | ||
61 | endpoint does not support streams, an error will be returned. | ||
62 | |||
63 | Note that new API to choose the next stream ID will have to be added if the xHCI | ||
64 | driver supports secondary stream IDs. | ||
65 | |||
66 | |||
67 | Clean up | ||
68 | ======== | ||
69 | |||
70 | If a driver wishes to stop using streams to communicate with the device, it | ||
71 | should call | ||
72 | |||
73 | void usb_free_streams(struct usb_interface *interface, | ||
74 | struct usb_host_endpoint **eps, unsigned int num_eps, | ||
75 | gfp_t mem_flags); | ||
76 | |||
77 | All stream IDs will be deallocated when the driver releases the interface, to | ||
78 | ensure that drivers that don't support streams will be able to use the endpoint. | ||
diff --git a/Documentation/usb/dma.txt b/Documentation/usb/dma.txt index cfdcd16e3abf..84ef865237db 100644 --- a/Documentation/usb/dma.txt +++ b/Documentation/usb/dma.txt | |||
@@ -16,11 +16,11 @@ OR: they can now be DMA-aware. | |||
16 | manage dma mappings for existing dma-ready buffers (see below). | 16 | manage dma mappings for existing dma-ready buffers (see below). |
17 | 17 | ||
18 | - URBs have an additional "transfer_dma" field, as well as a transfer_flags | 18 | - URBs have an additional "transfer_dma" field, as well as a transfer_flags |
19 | bit saying if it's valid. (Control requests also have "setup_dma" and a | 19 | bit saying if it's valid. (Control requests also have "setup_dma", but |
20 | corresponding transfer_flags bit.) | 20 | drivers must not use it.) |
21 | 21 | ||
22 | - "usbcore" will map those DMA addresses, if a DMA-aware driver didn't do | 22 | - "usbcore" will map this DMA address, if a DMA-aware driver didn't do |
23 | it first and set URB_NO_TRANSFER_DMA_MAP or URB_NO_SETUP_DMA_MAP. HCDs | 23 | it first and set URB_NO_TRANSFER_DMA_MAP. HCDs |
24 | don't manage dma mappings for URBs. | 24 | don't manage dma mappings for URBs. |
25 | 25 | ||
26 | - There's a new "generic DMA API", parts of which are usable by USB device | 26 | - There's a new "generic DMA API", parts of which are usable by USB device |
@@ -43,22 +43,16 @@ and effects like cache-trashing can impose subtle penalties. | |||
43 | kind of addresses to store in urb->transfer_buffer and urb->transfer_dma. | 43 | kind of addresses to store in urb->transfer_buffer and urb->transfer_dma. |
44 | You'd also set URB_NO_TRANSFER_DMA_MAP in urb->transfer_flags: | 44 | You'd also set URB_NO_TRANSFER_DMA_MAP in urb->transfer_flags: |
45 | 45 | ||
46 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, | 46 | void *usb_alloc_coherent (struct usb_device *dev, size_t size, |
47 | int mem_flags, dma_addr_t *dma); | 47 | int mem_flags, dma_addr_t *dma); |
48 | 48 | ||
49 | void usb_buffer_free (struct usb_device *dev, size_t size, | 49 | void usb_free_coherent (struct usb_device *dev, size_t size, |
50 | void *addr, dma_addr_t dma); | 50 | void *addr, dma_addr_t dma); |
51 | 51 | ||
52 | Most drivers should *NOT* be using these primitives; they don't need | 52 | Most drivers should *NOT* be using these primitives; they don't need |
53 | to use this type of memory ("dma-coherent"), and memory returned from | 53 | to use this type of memory ("dma-coherent"), and memory returned from |
54 | kmalloc() will work just fine. | 54 | kmalloc() will work just fine. |
55 | 55 | ||
56 | For control transfers you can use the buffer primitives or not for each | ||
57 | of the transfer buffer and setup buffer independently. Set the flag bits | ||
58 | URB_NO_TRANSFER_DMA_MAP and URB_NO_SETUP_DMA_MAP to indicate which | ||
59 | buffers you have prepared. For non-control transfers URB_NO_SETUP_DMA_MAP | ||
60 | is ignored. | ||
61 | |||
62 | The memory buffer returned is "dma-coherent"; sometimes you might need to | 56 | The memory buffer returned is "dma-coherent"; sometimes you might need to |
63 | force a consistent memory access ordering by using memory barriers. It's | 57 | force a consistent memory access ordering by using memory barriers. It's |
64 | not using a streaming DMA mapping, so it's good for small transfers on | 58 | not using a streaming DMA mapping, so it's good for small transfers on |
@@ -130,8 +124,8 @@ of Documentation/PCI/PCI-DMA-mapping.txt, titled "What memory is DMA-able?") | |||
130 | void usb_buffer_unmap (struct urb *urb); | 124 | void usb_buffer_unmap (struct urb *urb); |
131 | 125 | ||
132 | The calls manage urb->transfer_dma for you, and set URB_NO_TRANSFER_DMA_MAP | 126 | The calls manage urb->transfer_dma for you, and set URB_NO_TRANSFER_DMA_MAP |
133 | so that usbcore won't map or unmap the buffer. The same goes for | 127 | so that usbcore won't map or unmap the buffer. They cannot be used for |
134 | urb->setup_dma and URB_NO_SETUP_DMA_MAP for control requests. | 128 | setup_packet buffers in control requests. |
135 | 129 | ||
136 | Note that several of those interfaces are currently commented out, since | 130 | Note that several of those interfaces are currently commented out, since |
137 | they don't have current users. See the source code. Other than the dmasync | 131 | they don't have current users. See the source code. Other than the dmasync |
diff --git a/Documentation/usb/gadget_hid.txt b/Documentation/usb/gadget_hid.txt new file mode 100644 index 000000000000..f4a51f567427 --- /dev/null +++ b/Documentation/usb/gadget_hid.txt | |||
@@ -0,0 +1,445 @@ | |||
1 | |||
2 | Linux USB HID gadget driver | ||
3 | |||
4 | Introduction | ||
5 | |||
6 | The HID Gadget driver provides emulation of USB Human Interface | ||
7 | Devices (HID). The basic HID handling is done in the kernel, | ||
8 | and HID reports can be sent/received through I/O on the | ||
9 | /dev/hidgX character devices. | ||
10 | |||
11 | For more details about HID, see the developer page on | ||
12 | http://www.usb.org/developers/hidpage/ | ||
13 | |||
14 | Configuration | ||
15 | |||
16 | g_hid is a platform driver, so to use it you need to add | ||
17 | struct platform_device(s) to your platform code defining the | ||
18 | HID function descriptors you want to use - E.G. something | ||
19 | like: | ||
20 | |||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/usb/g_hid.h> | ||
23 | |||
24 | /* hid descriptor for a keyboard */ | ||
25 | static struct hidg_func_descriptor my_hid_data = { | ||
26 | .subclass = 0, /* No subclass */ | ||
27 | .protocol = 1, /* Keyboard */ | ||
28 | .report_length = 8, | ||
29 | .report_desc_length = 63, | ||
30 | .report_desc = { | ||
31 | 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */ | ||
32 | 0x09, 0x06, /* USAGE (Keyboard) */ | ||
33 | 0xa1, 0x01, /* COLLECTION (Application) */ | ||
34 | 0x05, 0x07, /* USAGE_PAGE (Keyboard) */ | ||
35 | 0x19, 0xe0, /* USAGE_MINIMUM (Keyboard LeftControl) */ | ||
36 | 0x29, 0xe7, /* USAGE_MAXIMUM (Keyboard Right GUI) */ | ||
37 | 0x15, 0x00, /* LOGICAL_MINIMUM (0) */ | ||
38 | 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */ | ||
39 | 0x75, 0x01, /* REPORT_SIZE (1) */ | ||
40 | 0x95, 0x08, /* REPORT_COUNT (8) */ | ||
41 | 0x81, 0x02, /* INPUT (Data,Var,Abs) */ | ||
42 | 0x95, 0x01, /* REPORT_COUNT (1) */ | ||
43 | 0x75, 0x08, /* REPORT_SIZE (8) */ | ||
44 | 0x81, 0x03, /* INPUT (Cnst,Var,Abs) */ | ||
45 | 0x95, 0x05, /* REPORT_COUNT (5) */ | ||
46 | 0x75, 0x01, /* REPORT_SIZE (1) */ | ||
47 | 0x05, 0x08, /* USAGE_PAGE (LEDs) */ | ||
48 | 0x19, 0x01, /* USAGE_MINIMUM (Num Lock) */ | ||
49 | 0x29, 0x05, /* USAGE_MAXIMUM (Kana) */ | ||
50 | 0x91, 0x02, /* OUTPUT (Data,Var,Abs) */ | ||
51 | 0x95, 0x01, /* REPORT_COUNT (1) */ | ||
52 | 0x75, 0x03, /* REPORT_SIZE (3) */ | ||
53 | 0x91, 0x03, /* OUTPUT (Cnst,Var,Abs) */ | ||
54 | 0x95, 0x06, /* REPORT_COUNT (6) */ | ||
55 | 0x75, 0x08, /* REPORT_SIZE (8) */ | ||
56 | 0x15, 0x00, /* LOGICAL_MINIMUM (0) */ | ||
57 | 0x25, 0x65, /* LOGICAL_MAXIMUM (101) */ | ||
58 | 0x05, 0x07, /* USAGE_PAGE (Keyboard) */ | ||
59 | 0x19, 0x00, /* USAGE_MINIMUM (Reserved) */ | ||
60 | 0x29, 0x65, /* USAGE_MAXIMUM (Keyboard Application) */ | ||
61 | 0x81, 0x00, /* INPUT (Data,Ary,Abs) */ | ||
62 | 0xc0 /* END_COLLECTION */ | ||
63 | } | ||
64 | }; | ||
65 | |||
66 | static struct platform_device my_hid = { | ||
67 | .name = "hidg", | ||
68 | .id = 0, | ||
69 | .num_resources = 0, | ||
70 | .resource = 0, | ||
71 | .dev.platform_data = &my_hid_data, | ||
72 | }; | ||
73 | |||
74 | You can add as many HID functions as you want, only limited by | ||
75 | the amount of interrupt endpoints your gadget driver supports. | ||
76 | |||
77 | Send and receive HID reports | ||
78 | |||
79 | HID reports can be sent/received using read/write on the | ||
80 | /dev/hidgX character devices. See below for an example program | ||
81 | to do this. | ||
82 | |||
83 | hid_gadget_test is a small interactive program to test the HID | ||
84 | gadget driver. To use, point it at a hidg device and set the | ||
85 | device type (keyboard / mouse / joystick) - E.G.: | ||
86 | |||
87 | # hid_gadget_test /dev/hidg0 keyboard | ||
88 | |||
89 | You are now in the prompt of hid_gadget_test. You can type any | ||
90 | combination of options and values. Available options and | ||
91 | values are listed at program start. In keyboard mode you can | ||
92 | send up to six values. | ||
93 | |||
94 | For example type: g i s t r --left-shift | ||
95 | |||
96 | Hit return and the corresponding report will be sent by the | ||
97 | HID gadget. | ||
98 | |||
99 | Another interesting example is the caps lock test. Type | ||
100 | -–caps-lock and hit return. A report is then sent by the | ||
101 | gadget and you should receive the host answer, corresponding | ||
102 | to the caps lock LED status. | ||
103 | |||
104 | --caps-lock | ||
105 | recv report:2 | ||
106 | |||
107 | With this command: | ||
108 | |||
109 | # hid_gadget_test /dev/hidg1 mouse | ||
110 | |||
111 | You can test the mouse emulation. Values are two signed numbers. | ||
112 | |||
113 | |||
114 | Sample code | ||
115 | |||
116 | /* hid_gadget_test */ | ||
117 | |||
118 | #include <pthread.h> | ||
119 | #include <string.h> | ||
120 | #include <stdio.h> | ||
121 | #include <ctype.h> | ||
122 | #include <fcntl.h> | ||
123 | #include <errno.h> | ||
124 | #include <stdio.h> | ||
125 | #include <stdlib.h> | ||
126 | #include <unistd.h> | ||
127 | |||
128 | #define BUF_LEN 512 | ||
129 | |||
130 | struct options { | ||
131 | const char *opt; | ||
132 | unsigned char val; | ||
133 | }; | ||
134 | |||
135 | static struct options kmod[] = { | ||
136 | {.opt = "--left-ctrl", .val = 0x01}, | ||
137 | {.opt = "--right-ctrl", .val = 0x10}, | ||
138 | {.opt = "--left-shift", .val = 0x02}, | ||
139 | {.opt = "--right-shift", .val = 0x20}, | ||
140 | {.opt = "--left-alt", .val = 0x04}, | ||
141 | {.opt = "--right-alt", .val = 0x40}, | ||
142 | {.opt = "--left-meta", .val = 0x08}, | ||
143 | {.opt = "--right-meta", .val = 0x80}, | ||
144 | {.opt = NULL} | ||
145 | }; | ||
146 | |||
147 | static struct options kval[] = { | ||
148 | {.opt = "--return", .val = 0x28}, | ||
149 | {.opt = "--esc", .val = 0x29}, | ||
150 | {.opt = "--bckspc", .val = 0x2a}, | ||
151 | {.opt = "--tab", .val = 0x2b}, | ||
152 | {.opt = "--spacebar", .val = 0x2c}, | ||
153 | {.opt = "--caps-lock", .val = 0x39}, | ||
154 | {.opt = "--f1", .val = 0x3a}, | ||
155 | {.opt = "--f2", .val = 0x3b}, | ||
156 | {.opt = "--f3", .val = 0x3c}, | ||
157 | {.opt = "--f4", .val = 0x3d}, | ||
158 | {.opt = "--f5", .val = 0x3e}, | ||
159 | {.opt = "--f6", .val = 0x3f}, | ||
160 | {.opt = "--f7", .val = 0x40}, | ||
161 | {.opt = "--f8", .val = 0x41}, | ||
162 | {.opt = "--f9", .val = 0x42}, | ||
163 | {.opt = "--f10", .val = 0x43}, | ||
164 | {.opt = "--f11", .val = 0x44}, | ||
165 | {.opt = "--f12", .val = 0x45}, | ||
166 | {.opt = "--insert", .val = 0x49}, | ||
167 | {.opt = "--home", .val = 0x4a}, | ||
168 | {.opt = "--pageup", .val = 0x4b}, | ||
169 | {.opt = "--del", .val = 0x4c}, | ||
170 | {.opt = "--end", .val = 0x4d}, | ||
171 | {.opt = "--pagedown", .val = 0x4e}, | ||
172 | {.opt = "--right", .val = 0x4f}, | ||
173 | {.opt = "--left", .val = 0x50}, | ||
174 | {.opt = "--down", .val = 0x51}, | ||
175 | {.opt = "--kp-enter", .val = 0x58}, | ||
176 | {.opt = "--up", .val = 0x52}, | ||
177 | {.opt = "--num-lock", .val = 0x53}, | ||
178 | {.opt = NULL} | ||
179 | }; | ||
180 | |||
181 | int keyboard_fill_report(char report[8], char buf[BUF_LEN], int *hold) | ||
182 | { | ||
183 | char *tok = strtok(buf, " "); | ||
184 | int key = 0; | ||
185 | int i = 0; | ||
186 | |||
187 | for (; tok != NULL; tok = strtok(NULL, " ")) { | ||
188 | |||
189 | if (strcmp(tok, "--quit") == 0) | ||
190 | return -1; | ||
191 | |||
192 | if (strcmp(tok, "--hold") == 0) { | ||
193 | *hold = 1; | ||
194 | continue; | ||
195 | } | ||
196 | |||
197 | if (key < 6) { | ||
198 | for (i = 0; kval[i].opt != NULL; i++) | ||
199 | if (strcmp(tok, kval[i].opt) == 0) { | ||
200 | report[2 + key++] = kval[i].val; | ||
201 | break; | ||
202 | } | ||
203 | if (kval[i].opt != NULL) | ||
204 | continue; | ||
205 | } | ||
206 | |||
207 | if (key < 6) | ||
208 | if (islower(tok[0])) { | ||
209 | report[2 + key++] = (tok[0] - ('a' - 0x04)); | ||
210 | continue; | ||
211 | } | ||
212 | |||
213 | for (i = 0; kmod[i].opt != NULL; i++) | ||
214 | if (strcmp(tok, kmod[i].opt) == 0) { | ||
215 | report[0] = report[0] | kmod[i].val; | ||
216 | break; | ||
217 | } | ||
218 | if (kmod[i].opt != NULL) | ||
219 | continue; | ||
220 | |||
221 | if (key < 6) | ||
222 | fprintf(stderr, "unknown option: %s\n", tok); | ||
223 | } | ||
224 | return 8; | ||
225 | } | ||
226 | |||
227 | static struct options mmod[] = { | ||
228 | {.opt = "--b1", .val = 0x01}, | ||
229 | {.opt = "--b2", .val = 0x02}, | ||
230 | {.opt = "--b3", .val = 0x04}, | ||
231 | {.opt = NULL} | ||
232 | }; | ||
233 | |||
234 | int mouse_fill_report(char report[8], char buf[BUF_LEN], int *hold) | ||
235 | { | ||
236 | char *tok = strtok(buf, " "); | ||
237 | int mvt = 0; | ||
238 | int i = 0; | ||
239 | for (; tok != NULL; tok = strtok(NULL, " ")) { | ||
240 | |||
241 | if (strcmp(tok, "--quit") == 0) | ||
242 | return -1; | ||
243 | |||
244 | if (strcmp(tok, "--hold") == 0) { | ||
245 | *hold = 1; | ||
246 | continue; | ||
247 | } | ||
248 | |||
249 | for (i = 0; mmod[i].opt != NULL; i++) | ||
250 | if (strcmp(tok, mmod[i].opt) == 0) { | ||
251 | report[0] = report[0] | mmod[i].val; | ||
252 | break; | ||
253 | } | ||
254 | if (mmod[i].opt != NULL) | ||
255 | continue; | ||
256 | |||
257 | if (!(tok[0] == '-' && tok[1] == '-') && mvt < 2) { | ||
258 | errno = 0; | ||
259 | report[1 + mvt++] = (char)strtol(tok, NULL, 0); | ||
260 | if (errno != 0) { | ||
261 | fprintf(stderr, "Bad value:'%s'\n", tok); | ||
262 | report[1 + mvt--] = 0; | ||
263 | } | ||
264 | continue; | ||
265 | } | ||
266 | |||
267 | fprintf(stderr, "unknown option: %s\n", tok); | ||
268 | } | ||
269 | return 3; | ||
270 | } | ||
271 | |||
272 | static struct options jmod[] = { | ||
273 | {.opt = "--b1", .val = 0x10}, | ||
274 | {.opt = "--b2", .val = 0x20}, | ||
275 | {.opt = "--b3", .val = 0x40}, | ||
276 | {.opt = "--b4", .val = 0x80}, | ||
277 | {.opt = "--hat1", .val = 0x00}, | ||
278 | {.opt = "--hat2", .val = 0x01}, | ||
279 | {.opt = "--hat3", .val = 0x02}, | ||
280 | {.opt = "--hat4", .val = 0x03}, | ||
281 | {.opt = "--hatneutral", .val = 0x04}, | ||
282 | {.opt = NULL} | ||
283 | }; | ||
284 | |||
285 | int joystick_fill_report(char report[8], char buf[BUF_LEN], int *hold) | ||
286 | { | ||
287 | char *tok = strtok(buf, " "); | ||
288 | int mvt = 0; | ||
289 | int i = 0; | ||
290 | |||
291 | *hold = 1; | ||
292 | |||
293 | /* set default hat position: neutral */ | ||
294 | report[3] = 0x04; | ||
295 | |||
296 | for (; tok != NULL; tok = strtok(NULL, " ")) { | ||
297 | |||
298 | if (strcmp(tok, "--quit") == 0) | ||
299 | return -1; | ||
300 | |||
301 | for (i = 0; jmod[i].opt != NULL; i++) | ||
302 | if (strcmp(tok, jmod[i].opt) == 0) { | ||
303 | report[3] = (report[3] & 0xF0) | jmod[i].val; | ||
304 | break; | ||
305 | } | ||
306 | if (jmod[i].opt != NULL) | ||
307 | continue; | ||
308 | |||
309 | if (!(tok[0] == '-' && tok[1] == '-') && mvt < 3) { | ||
310 | errno = 0; | ||
311 | report[mvt++] = (char)strtol(tok, NULL, 0); | ||
312 | if (errno != 0) { | ||
313 | fprintf(stderr, "Bad value:'%s'\n", tok); | ||
314 | report[mvt--] = 0; | ||
315 | } | ||
316 | continue; | ||
317 | } | ||
318 | |||
319 | fprintf(stderr, "unknown option: %s\n", tok); | ||
320 | } | ||
321 | return 4; | ||
322 | } | ||
323 | |||
324 | void print_options(char c) | ||
325 | { | ||
326 | int i = 0; | ||
327 | |||
328 | if (c == 'k') { | ||
329 | printf(" keyboard options:\n" | ||
330 | " --hold\n"); | ||
331 | for (i = 0; kmod[i].opt != NULL; i++) | ||
332 | printf("\t\t%s\n", kmod[i].opt); | ||
333 | printf("\n keyboard values:\n" | ||
334 | " [a-z] or\n"); | ||
335 | for (i = 0; kval[i].opt != NULL; i++) | ||
336 | printf("\t\t%-8s%s", kval[i].opt, i % 2 ? "\n" : ""); | ||
337 | printf("\n"); | ||
338 | } else if (c == 'm') { | ||
339 | printf(" mouse options:\n" | ||
340 | " --hold\n"); | ||
341 | for (i = 0; mmod[i].opt != NULL; i++) | ||
342 | printf("\t\t%s\n", mmod[i].opt); | ||
343 | printf("\n mouse values:\n" | ||
344 | " Two signed numbers\n" | ||
345 | "--quit to close\n"); | ||
346 | } else { | ||
347 | printf(" joystick options:\n"); | ||
348 | for (i = 0; jmod[i].opt != NULL; i++) | ||
349 | printf("\t\t%s\n", jmod[i].opt); | ||
350 | printf("\n joystick values:\n" | ||
351 | " three signed numbers\n" | ||
352 | "--quit to close\n"); | ||
353 | } | ||
354 | } | ||
355 | |||
356 | int main(int argc, const char *argv[]) | ||
357 | { | ||
358 | const char *filename = NULL; | ||
359 | int fd = 0; | ||
360 | char buf[BUF_LEN]; | ||
361 | int cmd_len; | ||
362 | char report[8]; | ||
363 | int to_send = 8; | ||
364 | int hold = 0; | ||
365 | fd_set rfds; | ||
366 | int retval, i; | ||
367 | |||
368 | if (argc < 3) { | ||
369 | fprintf(stderr, "Usage: %s devname mouse|keyboard|joystick\n", | ||
370 | argv[0]); | ||
371 | return 1; | ||
372 | } | ||
373 | |||
374 | if (argv[2][0] != 'k' && argv[2][0] != 'm' && argv[2][0] != 'j') | ||
375 | return 2; | ||
376 | |||
377 | filename = argv[1]; | ||
378 | |||
379 | if ((fd = open(filename, O_RDWR, 0666)) == -1) { | ||
380 | perror(filename); | ||
381 | return 3; | ||
382 | } | ||
383 | |||
384 | print_options(argv[2][0]); | ||
385 | |||
386 | while (42) { | ||
387 | |||
388 | FD_ZERO(&rfds); | ||
389 | FD_SET(STDIN_FILENO, &rfds); | ||
390 | FD_SET(fd, &rfds); | ||
391 | |||
392 | retval = select(fd + 1, &rfds, NULL, NULL, NULL); | ||
393 | if (retval == -1 && errno == EINTR) | ||
394 | continue; | ||
395 | if (retval < 0) { | ||
396 | perror("select()"); | ||
397 | return 4; | ||
398 | } | ||
399 | |||
400 | if (FD_ISSET(fd, &rfds)) { | ||
401 | cmd_len = read(fd, buf, BUF_LEN - 1); | ||
402 | printf("recv report:"); | ||
403 | for (i = 0; i < cmd_len; i++) | ||
404 | printf(" %02x", buf[i]); | ||
405 | printf("\n"); | ||
406 | } | ||
407 | |||
408 | if (FD_ISSET(STDIN_FILENO, &rfds)) { | ||
409 | memset(report, 0x0, sizeof(report)); | ||
410 | cmd_len = read(STDIN_FILENO, buf, BUF_LEN - 1); | ||
411 | |||
412 | if (cmd_len == 0) | ||
413 | break; | ||
414 | |||
415 | buf[cmd_len - 1] = '\0'; | ||
416 | hold = 0; | ||
417 | |||
418 | memset(report, 0x0, sizeof(report)); | ||
419 | if (argv[2][0] == 'k') | ||
420 | to_send = keyboard_fill_report(report, buf, &hold); | ||
421 | else if (argv[2][0] == 'm') | ||
422 | to_send = mouse_fill_report(report, buf, &hold); | ||
423 | else | ||
424 | to_send = joystick_fill_report(report, buf, &hold); | ||
425 | |||
426 | if (to_send == -1) | ||
427 | break; | ||
428 | |||
429 | if (write(fd, report, to_send) != to_send) { | ||
430 | perror(filename); | ||
431 | return 5; | ||
432 | } | ||
433 | if (!hold) { | ||
434 | memset(report, 0x0, sizeof(report)); | ||
435 | if (write(fd, report, to_send) != to_send) { | ||
436 | perror(filename); | ||
437 | return 6; | ||
438 | } | ||
439 | } | ||
440 | } | ||
441 | } | ||
442 | |||
443 | close(fd); | ||
444 | return 0; | ||
445 | } | ||
diff --git a/Documentation/usb/power-management.txt b/Documentation/usb/power-management.txt index 2790ad48cfc2..b29d8e56cf28 100644 --- a/Documentation/usb/power-management.txt +++ b/Documentation/usb/power-management.txt | |||
@@ -107,7 +107,9 @@ allowed to issue dynamic suspends. | |||
107 | The user interface for controlling dynamic PM is located in the power/ | 107 | The user interface for controlling dynamic PM is located in the power/ |
108 | subdirectory of each USB device's sysfs directory, that is, in | 108 | subdirectory of each USB device's sysfs directory, that is, in |
109 | /sys/bus/usb/devices/.../power/ where "..." is the device's ID. The | 109 | /sys/bus/usb/devices/.../power/ where "..." is the device's ID. The |
110 | relevant attribute files are: wakeup, level, and autosuspend. | 110 | relevant attribute files are: wakeup, control, and autosuspend. |
111 | (There may also be a file named "level"; this file was deprecated | ||
112 | as of the 2.6.35 kernel and replaced by the "control" file.) | ||
111 | 113 | ||
112 | power/wakeup | 114 | power/wakeup |
113 | 115 | ||
@@ -120,7 +122,7 @@ relevant attribute files are: wakeup, level, and autosuspend. | |||
120 | while the device is suspended, the change won't take | 122 | while the device is suspended, the change won't take |
121 | effect until the following suspend.) | 123 | effect until the following suspend.) |
122 | 124 | ||
123 | power/level | 125 | power/control |
124 | 126 | ||
125 | This file contains one of two words: "on" or "auto". | 127 | This file contains one of two words: "on" or "auto". |
126 | You can write those words to the file to change the | 128 | You can write those words to the file to change the |
@@ -148,14 +150,15 @@ relevant attribute files are: wakeup, level, and autosuspend. | |||
148 | never to autosuspend. You can write a number to the | 150 | never to autosuspend. You can write a number to the |
149 | file to change the autosuspend idle-delay time. | 151 | file to change the autosuspend idle-delay time. |
150 | 152 | ||
151 | Writing "-1" to power/autosuspend and writing "on" to power/level do | 153 | Writing "-1" to power/autosuspend and writing "on" to power/control do |
152 | essentially the same thing -- they both prevent the device from being | 154 | essentially the same thing -- they both prevent the device from being |
153 | autosuspended. Yes, this is a redundancy in the API. | 155 | autosuspended. Yes, this is a redundancy in the API. |
154 | 156 | ||
155 | (In 2.6.21 writing "0" to power/autosuspend would prevent the device | 157 | (In 2.6.21 writing "0" to power/autosuspend would prevent the device |
156 | from being autosuspended; the behavior was changed in 2.6.22. The | 158 | from being autosuspended; the behavior was changed in 2.6.22. The |
157 | power/autosuspend attribute did not exist prior to 2.6.21, and the | 159 | power/autosuspend attribute did not exist prior to 2.6.21, and the |
158 | power/level attribute did not exist prior to 2.6.22.) | 160 | power/level attribute did not exist prior to 2.6.22. power/control |
161 | was added in 2.6.34.) | ||
159 | 162 | ||
160 | 163 | ||
161 | Changing the default idle-delay time | 164 | Changing the default idle-delay time |
@@ -212,7 +215,7 @@ among printers and scanners, but plenty of other types of device have | |||
212 | the same deficiency. | 215 | the same deficiency. |
213 | 216 | ||
214 | For this reason, by default the kernel disables autosuspend (the | 217 | For this reason, by default the kernel disables autosuspend (the |
215 | power/level attribute is initialized to "on") for all devices other | 218 | power/control attribute is initialized to "on") for all devices other |
216 | than hubs. Hubs, at least, appear to be reasonably well-behaved in | 219 | than hubs. Hubs, at least, appear to be reasonably well-behaved in |
217 | this regard. | 220 | this regard. |
218 | 221 | ||
@@ -373,7 +376,7 @@ usb_autopm_put_interface() in its close or release routine. But other | |||
373 | patterns are possible. | 376 | patterns are possible. |
374 | 377 | ||
375 | The autosuspend attempts mentioned above will often fail for one | 378 | The autosuspend attempts mentioned above will often fail for one |
376 | reason or another. For example, the power/level attribute might be | 379 | reason or another. For example, the power/control attribute might be |
377 | set to "on", or another interface in the same device might not be | 380 | set to "on", or another interface in the same device might not be |
378 | idle. This is perfectly normal. If the reason for failure was that | 381 | idle. This is perfectly normal. If the reason for failure was that |
379 | the device hasn't been idle for long enough, a timer is scheduled to | 382 | the device hasn't been idle for long enough, a timer is scheduled to |
@@ -394,12 +397,12 @@ Drivers can enable autosuspend for their devices by calling | |||
394 | 397 | ||
395 | in their probe() routine, if they know that the device is capable of | 398 | in their probe() routine, if they know that the device is capable of |
396 | suspending and resuming correctly. This is exactly equivalent to | 399 | suspending and resuming correctly. This is exactly equivalent to |
397 | writing "auto" to the device's power/level attribute. Likewise, | 400 | writing "auto" to the device's power/control attribute. Likewise, |
398 | drivers can disable autosuspend by calling | 401 | drivers can disable autosuspend by calling |
399 | 402 | ||
400 | usb_disable_autosuspend(struct usb_device *udev); | 403 | usb_disable_autosuspend(struct usb_device *udev); |
401 | 404 | ||
402 | This is exactly the same as writing "on" to the power/level attribute. | 405 | This is exactly the same as writing "on" to the power/control attribute. |
403 | 406 | ||
404 | Sometimes a driver needs to make sure that remote wakeup is enabled | 407 | Sometimes a driver needs to make sure that remote wakeup is enabled |
405 | during autosuspend. For example, there's not much point | 408 | during autosuspend. For example, there's not much point |
diff --git a/Documentation/usb/usb-serial.txt b/Documentation/usb/usb-serial.txt index ff2c1ff57ba2..f4d214510259 100644 --- a/Documentation/usb/usb-serial.txt +++ b/Documentation/usb/usb-serial.txt | |||
@@ -194,6 +194,10 @@ FTDI Single Port Serial Driver | |||
194 | 194 | ||
195 | This is a single port DB-25 serial adapter. | 195 | This is a single port DB-25 serial adapter. |
196 | 196 | ||
197 | Devices supported include: | ||
198 | -TripNav TN-200 USB GPS | ||
199 | -Navis Engineering Bureau CH-4711 USB GPS | ||
200 | |||
197 | For any questions or problems with this driver, please contact Bill Ryder. | 201 | For any questions or problems with this driver, please contact Bill Ryder. |
198 | 202 | ||
199 | 203 | ||
@@ -216,7 +220,7 @@ Cypress M8 CY4601 Family Serial Driver | |||
216 | 220 | ||
217 | Devices supported: | 221 | Devices supported: |
218 | 222 | ||
219 | -DeLorme's USB Earthmate (SiRF Star II lp arch) | 223 | -DeLorme's USB Earthmate GPS (SiRF Star II lp arch) |
220 | -Cypress HID->COM RS232 adapter | 224 | -Cypress HID->COM RS232 adapter |
221 | 225 | ||
222 | Note: Cypress Semiconductor claims no affiliation with the | 226 | Note: Cypress Semiconductor claims no affiliation with the |
@@ -392,9 +396,10 @@ REINER SCT cyberJack pinpad/e-com USB chipcard reader | |||
392 | Prolific PL2303 Driver | 396 | Prolific PL2303 Driver |
393 | 397 | ||
394 | This driver supports any device that has the PL2303 chip from Prolific | 398 | This driver supports any device that has the PL2303 chip from Prolific |
395 | in it. This includes a number of single port USB to serial | 399 | in it. This includes a number of single port USB to serial converters, |
396 | converters and USB GPS devices. Devices from Aten (the UC-232) and | 400 | more than 70% of USB GPS devices (in 2010), and some USB UPSes. Devices |
397 | IO-Data work with this driver, as does the DCU-11 mobile-phone cable. | 401 | from Aten (the UC-232) and IO-Data work with this driver, as does |
402 | the DCU-11 mobile-phone cable. | ||
398 | 403 | ||
399 | For any questions or problems with this driver, please contact Greg | 404 | For any questions or problems with this driver, please contact Greg |
400 | Kroah-Hartman at greg@kroah.com | 405 | Kroah-Hartman at greg@kroah.com |
@@ -435,6 +440,22 @@ Winchiphead CH341 Driver | |||
435 | For any questions or problems with this driver, please contact | 440 | For any questions or problems with this driver, please contact |
436 | frank@kingswood-consulting.co.uk. | 441 | frank@kingswood-consulting.co.uk. |
437 | 442 | ||
443 | Moschip MCS7720, MCS7715 driver | ||
444 | |||
445 | These chips are present in devices sold by various manufacturers, such as Syba | ||
446 | and Cables Unlimited. There may be others. The 7720 provides two serial | ||
447 | ports, and the 7715 provides one serial and one standard PC parallel port. | ||
448 | Support for the 7715's parallel port is enabled by a separate option, which | ||
449 | will not appear unless parallel port support is first enabled at the top-level | ||
450 | of the Device Drivers config menu. Currently only compatibility mode is | ||
451 | supported on the parallel port (no ECP/EPP). | ||
452 | |||
453 | TODO: | ||
454 | - Implement ECP/EPP modes for the parallel port. | ||
455 | - Baud rates higher than 115200 are currently broken. | ||
456 | - Devices with a single serial port based on the Moschip MCS7703 may work | ||
457 | with this driver with a simple addition to the usb_device_id table. I | ||
458 | don't have one of these devices, so I can't say for sure. | ||
438 | 459 | ||
439 | Generic Serial driver | 460 | Generic Serial driver |
440 | 461 | ||
diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv index f11c583295e9..4739d5684305 100644 --- a/Documentation/video4linux/CARDLIST.bttv +++ b/Documentation/video4linux/CARDLIST.bttv | |||
@@ -100,7 +100,7 @@ | |||
100 | 99 -> AD-TVK503 | 100 | 99 -> AD-TVK503 |
101 | 100 -> Hercules Smart TV Stereo | 101 | 100 -> Hercules Smart TV Stereo |
102 | 101 -> Pace TV & Radio Card | 102 | 101 -> Pace TV & Radio Card |
103 | 102 -> IVC-200 [0000:a155,0001:a155,0002:a155,0003:a155,0100:a155,0101:a155,0102:a155,0103:a155] | 103 | 102 -> IVC-200 [0000:a155,0001:a155,0002:a155,0003:a155,0100:a155,0101:a155,0102:a155,0103:a155,0800:a155,0801:a155,0802:a155,0803:a155] |
104 | 103 -> Grand X-Guard / Trust 814PCI [0304:0102] | 104 | 103 -> Grand X-Guard / Trust 814PCI [0304:0102] |
105 | 104 -> Nebula Electronics DigiTV [0071:0101] | 105 | 104 -> Nebula Electronics DigiTV [0071:0101] |
106 | 105 -> ProVideo PV143 [aa00:1430,aa00:1431,aa00:1432,aa00:1433,aa03:1433] | 106 | 105 -> ProVideo PV143 [aa00:1430,aa00:1431,aa00:1432,aa00:1433,aa03:1433] |
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 7ec3c4e4b60f..f2510541373b 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 | |||
@@ -82,3 +82,4 @@ | |||
82 | 81 -> Leadtek WinFast DTV1800 Hybrid [107d:6654] | 82 | 81 -> Leadtek WinFast DTV1800 Hybrid [107d:6654] |
83 | 82 -> WinFast DTV2000 H rev. J [107d:6f2b] | 83 | 82 -> WinFast DTV2000 H rev. J [107d:6f2b] |
84 | 83 -> Prof 7301 DVB-S/S2 [b034:3034] | 84 | 83 -> Prof 7301 DVB-S/S2 [b034:3034] |
85 | 84 -> Samsung SMT 7020 DVB-S [18ac:dc00,18ac:dccd] | ||
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index 0c166ff003a0..3a623aaeae5f 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:2710,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2862,eb1a:2870,eb1a:2881,eb1a:2883,eb1a:2868] | 2 | 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2710,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2862,eb1a:2863,eb1a:2870,eb1a:2881,eb1a:2883,eb1a:2868] |
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] |
@@ -27,6 +27,7 @@ | |||
27 | 26 -> Hercules Smart TV USB 2.0 (em2820/em2840) | 27 | 26 -> Hercules Smart TV USB 2.0 (em2820/em2840) |
28 | 27 -> Pinnacle PCTV USB 2 (Philips FM1216ME) (em2820/em2840) | 28 | 27 -> Pinnacle PCTV USB 2 (Philips FM1216ME) (em2820/em2840) |
29 | 28 -> Leadtek Winfast USB II Deluxe (em2820/em2840) | 29 | 28 -> Leadtek Winfast USB II Deluxe (em2820/em2840) |
30 | 29 -> EM2860/TVP5150 Reference Design (em2860) | ||
30 | 30 -> Videology 20K14XUSB USB2.0 (em2820/em2840) | 31 | 30 -> Videology 20K14XUSB USB2.0 (em2820/em2840) |
31 | 31 -> Usbgear VD204v9 (em2821) | 32 | 31 -> Usbgear VD204v9 (em2821) |
32 | 32 -> Supercomp USB 2.0 TV (em2821) | 33 | 32 -> Supercomp USB 2.0 TV (em2821) |
@@ -70,3 +71,4 @@ | |||
70 | 72 -> Gadmei UTV330+ (em2861) | 71 | 72 -> Gadmei UTV330+ (em2861) |
71 | 73 -> Reddo DVB-C USB TV Box (em2870) | 72 | 73 -> Reddo DVB-C USB TV Box (em2870) |
72 | 74 -> Actionmaster/LinXcel/Digitus VC211A (em2800) | 73 | 74 -> Actionmaster/LinXcel/Digitus VC211A (em2800) |
74 | 75 -> Dikom DK300 (em2882) | ||
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index b4a767060ed7..070f2576707e 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 | |||
@@ -175,3 +175,6 @@ | |||
175 | 174 -> Asus Europa Hybrid OEM [1043:4847] | 175 | 174 -> Asus Europa Hybrid OEM [1043:4847] |
176 | 175 -> Leadtek Winfast DTV1000S [107d:6655] | 176 | 175 -> Leadtek Winfast DTV1000S [107d:6655] |
177 | 176 -> Beholder BeholdTV 505 RDS [0000:5051] | 177 | 176 -> Beholder BeholdTV 505 RDS [0000:5051] |
178 | 177 -> Hawell HW-404M7 | ||
179 | 179 -> Beholder BeholdTV H7 [5ace:7190] | ||
180 | 180 -> Beholder BeholdTV A7 [5ace:7090] | ||
diff --git a/Documentation/video4linux/extract_xc3028.pl b/Documentation/video4linux/extract_xc3028.pl index 2cb816047fc1..47877deae6d7 100644 --- a/Documentation/video4linux/extract_xc3028.pl +++ b/Documentation/video4linux/extract_xc3028.pl | |||
@@ -5,12 +5,18 @@ | |||
5 | # | 5 | # |
6 | # In order to use, you need to: | 6 | # In order to use, you need to: |
7 | # 1) Download the windows driver with something like: | 7 | # 1) Download the windows driver with something like: |
8 | # Version 2.4 | ||
9 | # wget http://www.twinhan.com/files/AW/BDA T/20080303_V1.0.6.7.zip | ||
10 | # or wget http://www.stefanringel.de/pub/20080303_V1.0.6.7.zip | ||
11 | # Version 2.7 | ||
8 | # wget http://www.steventoth.net/linux/xc5000/HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip | 12 | # wget http://www.steventoth.net/linux/xc5000/HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip |
9 | # 2) Extract the file hcw85bda.sys from the zip into the current dir: | 13 | # 2) Extract the files from the zip into the current dir: |
14 | # unzip -j 20080303_V1.0.6.7.zip 20080303_v1.0.6.7/UDXTTM6000.sys | ||
10 | # unzip -j HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip Driver85/hcw85bda.sys | 15 | # unzip -j HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip Driver85/hcw85bda.sys |
11 | # 3) run the script: | 16 | # 3) run the script: |
12 | # ./extract_xc3028.pl | 17 | # ./extract_xc3028.pl |
13 | # 4) copy the generated file: | 18 | # 4) copy the generated files: |
19 | # cp xc3028-v24.fw /lib/firmware | ||
14 | # cp xc3028-v27.fw /lib/firmware | 20 | # cp xc3028-v27.fw /lib/firmware |
15 | 21 | ||
16 | #use strict; | 22 | #use strict; |
@@ -135,7 +141,7 @@ sub write_hunk_fix_endian($$) | |||
135 | } | 141 | } |
136 | } | 142 | } |
137 | 143 | ||
138 | sub main_firmware($$$$) | 144 | sub main_firmware_24($$$$) |
139 | { | 145 | { |
140 | my $out; | 146 | my $out; |
141 | my $j=0; | 147 | my $j=0; |
@@ -146,8 +152,774 @@ sub main_firmware($$$$) | |||
146 | 152 | ||
147 | for ($j = length($name); $j <32; $j++) { | 153 | for ($j = length($name); $j <32; $j++) { |
148 | $name = $name.chr(0); | 154 | $name = $name.chr(0); |
155 | } | ||
156 | |||
157 | open OUTFILE, ">$outfile"; | ||
158 | syswrite(OUTFILE, $name); | ||
159 | write_le16($version); | ||
160 | write_le16($nr_desc); | ||
161 | |||
162 | # | ||
163 | # Firmware 0, type: BASE FW F8MHZ (0x00000003), id: (0000000000000000), size: 6635 | ||
164 | # | ||
165 | |||
166 | write_le32(0x00000003); # Type | ||
167 | write_le64(0x00000000, 0x00000000); # ID | ||
168 | write_le32(6635); # Size | ||
169 | write_hunk_fix_endian(257752, 6635); | ||
170 | |||
171 | # | ||
172 | # Firmware 1, type: BASE FW F8MHZ MTS (0x00000007), id: (0000000000000000), size: 6635 | ||
173 | # | ||
174 | |||
175 | write_le32(0x00000007); # Type | ||
176 | write_le64(0x00000000, 0x00000000); # ID | ||
177 | write_le32(6635); # Size | ||
178 | write_hunk_fix_endian(264392, 6635); | ||
179 | |||
180 | # | ||
181 | # Firmware 2, type: BASE FW FM (0x00000401), id: (0000000000000000), size: 6525 | ||
182 | # | ||
183 | |||
184 | write_le32(0x00000401); # Type | ||
185 | write_le64(0x00000000, 0x00000000); # ID | ||
186 | write_le32(6525); # Size | ||
187 | write_hunk_fix_endian(271040, 6525); | ||
188 | |||
189 | # | ||
190 | # Firmware 3, type: BASE FW FM INPUT1 (0x00000c01), id: (0000000000000000), size: 6539 | ||
191 | # | ||
192 | |||
193 | write_le32(0x00000c01); # Type | ||
194 | write_le64(0x00000000, 0x00000000); # ID | ||
195 | write_le32(6539); # Size | ||
196 | write_hunk_fix_endian(277568, 6539); | ||
197 | |||
198 | # | ||
199 | # Firmware 4, type: BASE FW (0x00000001), id: (0000000000000000), size: 6633 | ||
200 | # | ||
201 | |||
202 | write_le32(0x00000001); # Type | ||
203 | write_le64(0x00000000, 0x00000000); # ID | ||
204 | write_le32(6633); # Size | ||
205 | write_hunk_fix_endian(284120, 6633); | ||
206 | |||
207 | # | ||
208 | # Firmware 5, type: BASE FW MTS (0x00000005), id: (0000000000000000), size: 6617 | ||
209 | # | ||
210 | |||
211 | write_le32(0x00000005); # Type | ||
212 | write_le64(0x00000000, 0x00000000); # ID | ||
213 | write_le32(6617); # Size | ||
214 | write_hunk_fix_endian(290760, 6617); | ||
215 | |||
216 | # | ||
217 | # Firmware 6, type: STD FW (0x00000000), id: PAL/BG A2/A (0000000100000007), size: 161 | ||
218 | # | ||
219 | |||
220 | write_le32(0x00000000); # Type | ||
221 | write_le64(0x00000001, 0x00000007); # ID | ||
222 | write_le32(161); # Size | ||
223 | write_hunk_fix_endian(297384, 161); | ||
224 | |||
225 | # | ||
226 | # Firmware 7, type: STD FW MTS (0x00000004), id: PAL/BG A2/A (0000000100000007), size: 169 | ||
227 | # | ||
228 | |||
229 | write_le32(0x00000004); # Type | ||
230 | write_le64(0x00000001, 0x00000007); # ID | ||
231 | write_le32(169); # Size | ||
232 | write_hunk_fix_endian(297552, 169); | ||
233 | |||
234 | # | ||
235 | # Firmware 8, type: STD FW (0x00000000), id: PAL/BG A2/B (0000000200000007), size: 161 | ||
236 | # | ||
237 | |||
238 | write_le32(0x00000000); # Type | ||
239 | write_le64(0x00000002, 0x00000007); # ID | ||
240 | write_le32(161); # Size | ||
241 | write_hunk_fix_endian(297728, 161); | ||
242 | |||
243 | # | ||
244 | # Firmware 9, type: STD FW MTS (0x00000004), id: PAL/BG A2/B (0000000200000007), size: 169 | ||
245 | # | ||
246 | |||
247 | write_le32(0x00000004); # Type | ||
248 | write_le64(0x00000002, 0x00000007); # ID | ||
249 | write_le32(169); # Size | ||
250 | write_hunk_fix_endian(297896, 169); | ||
251 | |||
252 | # | ||
253 | # Firmware 10, type: STD FW (0x00000000), id: PAL/BG NICAM/A (0000000400000007), size: 161 | ||
254 | # | ||
255 | |||
256 | write_le32(0x00000000); # Type | ||
257 | write_le64(0x00000004, 0x00000007); # ID | ||
258 | write_le32(161); # Size | ||
259 | write_hunk_fix_endian(298072, 161); | ||
260 | |||
261 | # | ||
262 | # Firmware 11, type: STD FW MTS (0x00000004), id: PAL/BG NICAM/A (0000000400000007), size: 169 | ||
263 | # | ||
264 | |||
265 | write_le32(0x00000004); # Type | ||
266 | write_le64(0x00000004, 0x00000007); # ID | ||
267 | write_le32(169); # Size | ||
268 | write_hunk_fix_endian(298240, 169); | ||
269 | |||
270 | # | ||
271 | # Firmware 12, type: STD FW (0x00000000), id: PAL/BG NICAM/B (0000000800000007), size: 161 | ||
272 | # | ||
273 | |||
274 | write_le32(0x00000000); # Type | ||
275 | write_le64(0x00000008, 0x00000007); # ID | ||
276 | write_le32(161); # Size | ||
277 | write_hunk_fix_endian(298416, 161); | ||
278 | |||
279 | # | ||
280 | # Firmware 13, type: STD FW MTS (0x00000004), id: PAL/BG NICAM/B (0000000800000007), size: 169 | ||
281 | # | ||
282 | |||
283 | write_le32(0x00000004); # Type | ||
284 | write_le64(0x00000008, 0x00000007); # ID | ||
285 | write_le32(169); # Size | ||
286 | write_hunk_fix_endian(298584, 169); | ||
287 | |||
288 | # | ||
289 | # Firmware 14, type: STD FW (0x00000000), id: PAL/DK A2 (00000003000000e0), size: 161 | ||
290 | # | ||
291 | |||
292 | write_le32(0x00000000); # Type | ||
293 | write_le64(0x00000003, 0x000000e0); # ID | ||
294 | write_le32(161); # Size | ||
295 | write_hunk_fix_endian(298760, 161); | ||
296 | |||
297 | # | ||
298 | # Firmware 15, type: STD FW MTS (0x00000004), id: PAL/DK A2 (00000003000000e0), size: 169 | ||
299 | # | ||
300 | |||
301 | write_le32(0x00000004); # Type | ||
302 | write_le64(0x00000003, 0x000000e0); # ID | ||
303 | write_le32(169); # Size | ||
304 | write_hunk_fix_endian(298928, 169); | ||
305 | |||
306 | # | ||
307 | # Firmware 16, type: STD FW (0x00000000), id: PAL/DK NICAM (0000000c000000e0), size: 161 | ||
308 | # | ||
309 | |||
310 | write_le32(0x00000000); # Type | ||
311 | write_le64(0x0000000c, 0x000000e0); # ID | ||
312 | write_le32(161); # Size | ||
313 | write_hunk_fix_endian(299104, 161); | ||
314 | |||
315 | # | ||
316 | # Firmware 17, type: STD FW MTS (0x00000004), id: PAL/DK NICAM (0000000c000000e0), size: 169 | ||
317 | # | ||
318 | |||
319 | write_le32(0x00000004); # Type | ||
320 | write_le64(0x0000000c, 0x000000e0); # ID | ||
321 | write_le32(169); # Size | ||
322 | write_hunk_fix_endian(299272, 169); | ||
323 | |||
324 | # | ||
325 | # Firmware 18, type: STD FW (0x00000000), id: SECAM/K1 (0000000000200000), size: 161 | ||
326 | # | ||
327 | |||
328 | write_le32(0x00000000); # Type | ||
329 | write_le64(0x00000000, 0x00200000); # ID | ||
330 | write_le32(161); # Size | ||
331 | write_hunk_fix_endian(299448, 161); | ||
332 | |||
333 | # | ||
334 | # Firmware 19, type: STD FW MTS (0x00000004), id: SECAM/K1 (0000000000200000), size: 169 | ||
335 | # | ||
336 | |||
337 | write_le32(0x00000004); # Type | ||
338 | write_le64(0x00000000, 0x00200000); # ID | ||
339 | write_le32(169); # Size | ||
340 | write_hunk_fix_endian(299616, 169); | ||
341 | |||
342 | # | ||
343 | # Firmware 20, type: STD FW (0x00000000), id: SECAM/K3 (0000000004000000), size: 161 | ||
344 | # | ||
345 | |||
346 | write_le32(0x00000000); # Type | ||
347 | write_le64(0x00000000, 0x04000000); # ID | ||
348 | write_le32(161); # Size | ||
349 | write_hunk_fix_endian(299792, 161); | ||
350 | |||
351 | # | ||
352 | # Firmware 21, type: STD FW MTS (0x00000004), id: SECAM/K3 (0000000004000000), size: 169 | ||
353 | # | ||
354 | |||
355 | write_le32(0x00000004); # Type | ||
356 | write_le64(0x00000000, 0x04000000); # ID | ||
357 | write_le32(169); # Size | ||
358 | write_hunk_fix_endian(299960, 169); | ||
359 | |||
360 | # | ||
361 | # Firmware 22, type: STD FW D2633 DTV6 ATSC (0x00010030), id: (0000000000000000), size: 149 | ||
362 | # | ||
363 | |||
364 | write_le32(0x00010030); # Type | ||
365 | write_le64(0x00000000, 0x00000000); # ID | ||
366 | write_le32(149); # Size | ||
367 | write_hunk_fix_endian(300136, 149); | ||
368 | |||
369 | # | ||
370 | # Firmware 23, type: STD FW D2620 DTV6 QAM (0x00000068), id: (0000000000000000), size: 149 | ||
371 | # | ||
372 | |||
373 | write_le32(0x00000068); # Type | ||
374 | write_le64(0x00000000, 0x00000000); # ID | ||
375 | write_le32(149); # Size | ||
376 | write_hunk_fix_endian(300296, 149); | ||
377 | |||
378 | # | ||
379 | # Firmware 24, type: STD FW D2633 DTV6 QAM (0x00000070), id: (0000000000000000), size: 149 | ||
380 | # | ||
381 | |||
382 | write_le32(0x00000070); # Type | ||
383 | write_le64(0x00000000, 0x00000000); # ID | ||
384 | write_le32(149); # Size | ||
385 | write_hunk_fix_endian(300448, 149); | ||
386 | |||
387 | # | ||
388 | # Firmware 25, type: STD FW D2620 DTV7 (0x00000088), id: (0000000000000000), size: 149 | ||
389 | # | ||
390 | |||
391 | write_le32(0x00000088); # Type | ||
392 | write_le64(0x00000000, 0x00000000); # ID | ||
393 | write_le32(149); # Size | ||
394 | write_hunk_fix_endian(300608, 149); | ||
395 | |||
396 | # | ||
397 | # Firmware 26, type: STD FW D2633 DTV7 (0x00000090), id: (0000000000000000), size: 149 | ||
398 | # | ||
399 | |||
400 | write_le32(0x00000090); # Type | ||
401 | write_le64(0x00000000, 0x00000000); # ID | ||
402 | write_le32(149); # Size | ||
403 | write_hunk_fix_endian(300760, 149); | ||
404 | |||
405 | # | ||
406 | # Firmware 27, type: STD FW D2620 DTV78 (0x00000108), id: (0000000000000000), size: 149 | ||
407 | # | ||
408 | |||
409 | write_le32(0x00000108); # Type | ||
410 | write_le64(0x00000000, 0x00000000); # ID | ||
411 | write_le32(149); # Size | ||
412 | write_hunk_fix_endian(300920, 149); | ||
413 | |||
414 | # | ||
415 | # Firmware 28, type: STD FW D2633 DTV78 (0x00000110), id: (0000000000000000), size: 149 | ||
416 | # | ||
417 | |||
418 | write_le32(0x00000110); # Type | ||
419 | write_le64(0x00000000, 0x00000000); # ID | ||
420 | write_le32(149); # Size | ||
421 | write_hunk_fix_endian(301072, 149); | ||
422 | |||
423 | # | ||
424 | # Firmware 29, type: STD FW D2620 DTV8 (0x00000208), id: (0000000000000000), size: 149 | ||
425 | # | ||
426 | |||
427 | write_le32(0x00000208); # Type | ||
428 | write_le64(0x00000000, 0x00000000); # ID | ||
429 | write_le32(149); # Size | ||
430 | write_hunk_fix_endian(301232, 149); | ||
431 | |||
432 | # | ||
433 | # Firmware 30, type: STD FW D2633 DTV8 (0x00000210), id: (0000000000000000), size: 149 | ||
434 | # | ||
435 | |||
436 | write_le32(0x00000210); # Type | ||
437 | write_le64(0x00000000, 0x00000000); # ID | ||
438 | write_le32(149); # Size | ||
439 | write_hunk_fix_endian(301384, 149); | ||
440 | |||
441 | # | ||
442 | # Firmware 31, type: STD FW FM (0x00000400), id: (0000000000000000), size: 135 | ||
443 | # | ||
444 | |||
445 | write_le32(0x00000400); # Type | ||
446 | write_le64(0x00000000, 0x00000000); # ID | ||
447 | write_le32(135); # Size | ||
448 | write_hunk_fix_endian(301554, 135); | ||
449 | |||
450 | # | ||
451 | # Firmware 32, type: STD FW (0x00000000), id: PAL/I (0000000000000010), size: 161 | ||
452 | # | ||
453 | |||
454 | write_le32(0x00000000); # Type | ||
455 | write_le64(0x00000000, 0x00000010); # ID | ||
456 | write_le32(161); # Size | ||
457 | write_hunk_fix_endian(301688, 161); | ||
458 | |||
459 | # | ||
460 | # Firmware 33, type: STD FW MTS (0x00000004), id: PAL/I (0000000000000010), size: 169 | ||
461 | # | ||
462 | |||
463 | write_le32(0x00000004); # Type | ||
464 | write_le64(0x00000000, 0x00000010); # ID | ||
465 | write_le32(169); # Size | ||
466 | write_hunk_fix_endian(301856, 169); | ||
467 | |||
468 | # | ||
469 | # Firmware 34, type: STD FW (0x00000000), id: SECAM/L AM (0000001000400000), size: 169 | ||
470 | # | ||
471 | |||
472 | # | ||
473 | # Firmware 35, type: STD FW (0x00000000), id: SECAM/L NICAM (0000000c00400000), size: 161 | ||
474 | # | ||
475 | |||
476 | write_le32(0x00000000); # Type | ||
477 | write_le64(0x0000000c, 0x00400000); # ID | ||
478 | write_le32(161); # Size | ||
479 | write_hunk_fix_endian(302032, 161); | ||
480 | |||
481 | # | ||
482 | # Firmware 36, type: STD FW (0x00000000), id: SECAM/Lc (0000000000800000), size: 161 | ||
483 | # | ||
484 | |||
485 | write_le32(0x00000000); # Type | ||
486 | write_le64(0x00000000, 0x00800000); # ID | ||
487 | write_le32(161); # Size | ||
488 | write_hunk_fix_endian(302200, 161); | ||
489 | |||
490 | # | ||
491 | # Firmware 37, type: STD FW (0x00000000), id: NTSC/M Kr (0000000000008000), size: 161 | ||
492 | # | ||
493 | |||
494 | write_le32(0x00000000); # Type | ||
495 | write_le64(0x00000000, 0x00008000); # ID | ||
496 | write_le32(161); # Size | ||
497 | write_hunk_fix_endian(302368, 161); | ||
498 | |||
499 | # | ||
500 | # Firmware 38, type: STD FW LCD (0x00001000), id: NTSC/M Kr (0000000000008000), size: 161 | ||
501 | # | ||
502 | |||
503 | write_le32(0x00001000); # Type | ||
504 | write_le64(0x00000000, 0x00008000); # ID | ||
505 | write_le32(161); # Size | ||
506 | write_hunk_fix_endian(302536, 161); | ||
507 | |||
508 | # | ||
509 | # Firmware 39, type: STD FW LCD NOGD (0x00003000), id: NTSC/M Kr (0000000000008000), size: 161 | ||
510 | # | ||
511 | |||
512 | write_le32(0x00003000); # Type | ||
513 | write_le64(0x00000000, 0x00008000); # ID | ||
514 | write_le32(161); # Size | ||
515 | write_hunk_fix_endian(302704, 161); | ||
516 | |||
517 | # | ||
518 | # Firmware 40, type: STD FW MTS (0x00000004), id: NTSC/M Kr (0000000000008000), size: 169 | ||
519 | # | ||
520 | |||
521 | write_le32(0x00000004); # Type | ||
522 | write_le64(0x00000000, 0x00008000); # ID | ||
523 | write_le32(169); # Size | ||
524 | write_hunk_fix_endian(302872, 169); | ||
525 | |||
526 | # | ||
527 | # Firmware 41, type: STD FW (0x00000000), id: NTSC PAL/M PAL/N (000000000000b700), size: 161 | ||
528 | # | ||
529 | |||
530 | write_le32(0x00000000); # Type | ||
531 | write_le64(0x00000000, 0x0000b700); # ID | ||
532 | write_le32(161); # Size | ||
533 | write_hunk_fix_endian(303048, 161); | ||
534 | |||
535 | # | ||
536 | # Firmware 42, type: STD FW LCD (0x00001000), id: NTSC PAL/M PAL/N (000000000000b700), size: 161 | ||
537 | # | ||
538 | |||
539 | write_le32(0x00001000); # Type | ||
540 | write_le64(0x00000000, 0x0000b700); # ID | ||
541 | write_le32(161); # Size | ||
542 | write_hunk_fix_endian(303216, 161); | ||
543 | |||
544 | # | ||
545 | # Firmware 43, type: STD FW LCD NOGD (0x00003000), id: NTSC PAL/M PAL/N (000000000000b700), size: 161 | ||
546 | # | ||
547 | |||
548 | write_le32(0x00003000); # Type | ||
549 | write_le64(0x00000000, 0x0000b700); # ID | ||
550 | write_le32(161); # Size | ||
551 | write_hunk_fix_endian(303384, 161); | ||
552 | |||
553 | # | ||
554 | # Firmware 44, type: STD FW (0x00000000), id: NTSC/M Jp (0000000000002000), size: 161 | ||
555 | # | ||
556 | |||
557 | write_le32(0x00000000); # Type | ||
558 | write_le64(0x00000000, 0x00002000); # ID | ||
559 | write_le32(161); # Size | ||
560 | write_hunk_fix_endian(303552, 161); | ||
561 | |||
562 | # | ||
563 | # Firmware 45, type: STD FW MTS (0x00000004), id: NTSC PAL/M PAL/N (000000000000b700), size: 169 | ||
564 | # | ||
565 | |||
566 | write_le32(0x00000004); # Type | ||
567 | write_le64(0x00000000, 0x0000b700); # ID | ||
568 | write_le32(169); # Size | ||
569 | write_hunk_fix_endian(303720, 169); | ||
570 | |||
571 | # | ||
572 | # Firmware 46, type: STD FW MTS LCD (0x00001004), id: NTSC PAL/M PAL/N (000000000000b700), size: 169 | ||
573 | # | ||
574 | |||
575 | write_le32(0x00001004); # Type | ||
576 | write_le64(0x00000000, 0x0000b700); # ID | ||
577 | write_le32(169); # Size | ||
578 | write_hunk_fix_endian(303896, 169); | ||
579 | |||
580 | # | ||
581 | # Firmware 47, type: STD FW MTS LCD NOGD (0x00003004), id: NTSC PAL/M PAL/N (000000000000b700), size: 169 | ||
582 | # | ||
583 | |||
584 | write_le32(0x00003004); # Type | ||
585 | write_le64(0x00000000, 0x0000b700); # ID | ||
586 | write_le32(169); # Size | ||
587 | write_hunk_fix_endian(304072, 169); | ||
588 | |||
589 | # | ||
590 | # Firmware 48, type: SCODE FW HAS IF (0x60000000), IF = 3.28 MHz id: (0000000000000000), size: 192 | ||
591 | # | ||
592 | |||
593 | write_le32(0x60000000); # Type | ||
594 | write_le64(0x00000000, 0x00000000); # ID | ||
595 | write_le16(3280); # IF | ||
596 | write_le32(192); # Size | ||
597 | write_hunk(309048, 192); | ||
598 | |||
599 | # | ||
600 | # Firmware 49, type: SCODE FW HAS IF (0x60000000), IF = 3.30 MHz id: (0000000000000000), size: 192 | ||
601 | # | ||
602 | |||
603 | # write_le32(0x60000000); # Type | ||
604 | # write_le64(0x00000000, 0x00000000); # ID | ||
605 | # write_le16(3300); # IF | ||
606 | # write_le32(192); # Size | ||
607 | # write_hunk(304440, 192); | ||
608 | |||
609 | # | ||
610 | # Firmware 50, type: SCODE FW HAS IF (0x60000000), IF = 3.44 MHz id: (0000000000000000), size: 192 | ||
611 | # | ||
612 | |||
613 | write_le32(0x60000000); # Type | ||
614 | write_le64(0x00000000, 0x00000000); # ID | ||
615 | write_le16(3440); # IF | ||
616 | write_le32(192); # Size | ||
617 | write_hunk(309432, 192); | ||
618 | |||
619 | # | ||
620 | # Firmware 51, type: SCODE FW HAS IF (0x60000000), IF = 3.46 MHz id: (0000000000000000), size: 192 | ||
621 | # | ||
622 | |||
623 | write_le32(0x60000000); # Type | ||
624 | write_le64(0x00000000, 0x00000000); # ID | ||
625 | write_le16(3460); # IF | ||
626 | write_le32(192); # Size | ||
627 | write_hunk(309624, 192); | ||
628 | |||
629 | # | ||
630 | # Firmware 52, type: SCODE FW DTV6 ATSC OREN36 HAS IF (0x60210020), IF = 3.80 MHz id: (0000000000000000), size: 192 | ||
631 | # | ||
632 | |||
633 | write_le32(0x60210020); # Type | ||
634 | write_le64(0x00000000, 0x00000000); # ID | ||
635 | write_le16(3800); # IF | ||
636 | write_le32(192); # Size | ||
637 | write_hunk(306936, 192); | ||
638 | |||
639 | # | ||
640 | # Firmware 53, type: SCODE FW HAS IF (0x60000000), IF = 4.00 MHz id: (0000000000000000), size: 192 | ||
641 | # | ||
642 | |||
643 | write_le32(0x60000000); # Type | ||
644 | write_le64(0x00000000, 0x00000000); # ID | ||
645 | write_le16(4000); # IF | ||
646 | write_le32(192); # Size | ||
647 | write_hunk(309240, 192); | ||
648 | |||
649 | # | ||
650 | # Firmware 54, type: SCODE FW DTV6 ATSC TOYOTA388 HAS IF (0x60410020), IF = 4.08 MHz id: (0000000000000000), size: 192 | ||
651 | # | ||
652 | |||
653 | write_le32(0x60410020); # Type | ||
654 | write_le64(0x00000000, 0x00000000); # ID | ||
655 | write_le16(4080); # IF | ||
656 | write_le32(192); # Size | ||
657 | write_hunk(307128, 192); | ||
658 | |||
659 | # | ||
660 | # Firmware 55, type: SCODE FW HAS IF (0x60000000), IF = 4.20 MHz id: (0000000000000000), size: 192 | ||
661 | # | ||
662 | |||
663 | write_le32(0x60000000); # Type | ||
664 | write_le64(0x00000000, 0x00000000); # ID | ||
665 | write_le16(4200); # IF | ||
666 | write_le32(192); # Size | ||
667 | write_hunk(308856, 192); | ||
668 | |||
669 | # | ||
670 | # Firmware 56, type: SCODE FW MONO HAS IF (0x60008000), IF = 4.32 MHz id: NTSC/M Kr (0000000000008000), size: 192 | ||
671 | # | ||
672 | |||
673 | write_le32(0x60008000); # Type | ||
674 | write_le64(0x00000000, 0x00008000); # ID | ||
675 | write_le16(4320); # IF | ||
676 | write_le32(192); # Size | ||
677 | write_hunk(305208, 192); | ||
678 | |||
679 | # | ||
680 | # Firmware 57, type: SCODE FW HAS IF (0x60000000), IF = 4.45 MHz id: (0000000000000000), size: 192 | ||
681 | # | ||
682 | |||
683 | write_le32(0x60000000); # Type | ||
684 | write_le64(0x00000000, 0x00000000); # ID | ||
685 | write_le16(4450); # IF | ||
686 | write_le32(192); # Size | ||
687 | write_hunk(309816, 192); | ||
688 | |||
689 | # | ||
690 | # Firmware 58, type: SCODE FW MTS LCD NOGD MONO IF HAS IF (0x6002b004), IF = 4.50 MHz id: NTSC PAL/M PAL/N (000000000000b700), size: 192 | ||
691 | # | ||
692 | |||
693 | write_le32(0x6002b004); # Type | ||
694 | write_le64(0x00000000, 0x0000b700); # ID | ||
695 | write_le16(4500); # IF | ||
696 | write_le32(192); # Size | ||
697 | write_hunk(304824, 192); | ||
698 | |||
699 | # | ||
700 | # Firmware 59, type: SCODE FW LCD NOGD IF HAS IF (0x60023000), IF = 4.60 MHz id: NTSC/M Kr (0000000000008000), size: 192 | ||
701 | # | ||
702 | |||
703 | write_le32(0x60023000); # Type | ||
704 | write_le64(0x00000000, 0x00008000); # ID | ||
705 | write_le16(4600); # IF | ||
706 | write_le32(192); # Size | ||
707 | write_hunk(305016, 192); | ||
708 | |||
709 | # | ||
710 | # Firmware 60, type: SCODE FW DTV6 QAM DTV7 DTV78 DTV8 ZARLINK456 HAS IF (0x620003e0), IF = 4.76 MHz id: (0000000000000000), size: 192 | ||
711 | # | ||
712 | |||
713 | write_le32(0x620003e0); # Type | ||
714 | write_le64(0x00000000, 0x00000000); # ID | ||
715 | write_le16(4760); # IF | ||
716 | write_le32(192); # Size | ||
717 | write_hunk(304440, 192); | ||
718 | |||
719 | # | ||
720 | # Firmware 61, type: SCODE FW HAS IF (0x60000000), IF = 4.94 MHz id: (0000000000000000), size: 192 | ||
721 | # | ||
722 | |||
723 | write_le32(0x60000000); # Type | ||
724 | write_le64(0x00000000, 0x00000000); # ID | ||
725 | write_le16(4940); # IF | ||
726 | write_le32(192); # Size | ||
727 | write_hunk(308664, 192); | ||
728 | |||
729 | # | ||
730 | # Firmware 62, type: SCODE FW HAS IF (0x60000000), IF = 5.26 MHz id: (0000000000000000), size: 192 | ||
731 | # | ||
732 | |||
733 | write_le32(0x60000000); # Type | ||
734 | write_le64(0x00000000, 0x00000000); # ID | ||
735 | write_le16(5260); # IF | ||
736 | write_le32(192); # Size | ||
737 | write_hunk(307704, 192); | ||
738 | |||
739 | # | ||
740 | # Firmware 63, type: SCODE FW MONO HAS IF (0x60008000), IF = 5.32 MHz id: PAL/BG A2 NICAM (0000000f00000007), size: 192 | ||
741 | # | ||
742 | |||
743 | write_le32(0x60008000); # Type | ||
744 | write_le64(0x0000000f, 0x00000007); # ID | ||
745 | write_le16(5320); # IF | ||
746 | write_le32(192); # Size | ||
747 | write_hunk(307896, 192); | ||
748 | |||
749 | # | ||
750 | # Firmware 64, type: SCODE FW DTV7 DTV78 DTV8 DIBCOM52 CHINA HAS IF (0x65000380), IF = 5.40 MHz id: (0000000000000000), size: 192 | ||
751 | # | ||
752 | |||
753 | write_le32(0x65000380); # Type | ||
754 | write_le64(0x00000000, 0x00000000); # ID | ||
755 | write_le16(5400); # IF | ||
756 | write_le32(192); # Size | ||
757 | write_hunk(304248, 192); | ||
758 | |||
759 | # | ||
760 | # Firmware 65, type: SCODE FW DTV6 ATSC OREN538 HAS IF (0x60110020), IF = 5.58 MHz id: (0000000000000000), size: 192 | ||
761 | # | ||
762 | |||
763 | write_le32(0x60110020); # Type | ||
764 | write_le64(0x00000000, 0x00000000); # ID | ||
765 | write_le16(5580); # IF | ||
766 | write_le32(192); # Size | ||
767 | write_hunk(306744, 192); | ||
768 | |||
769 | # | ||
770 | # Firmware 66, type: SCODE FW HAS IF (0x60000000), IF = 5.64 MHz id: PAL/BG A2 (0000000300000007), size: 192 | ||
771 | # | ||
772 | |||
773 | write_le32(0x60000000); # Type | ||
774 | write_le64(0x00000003, 0x00000007); # ID | ||
775 | write_le16(5640); # IF | ||
776 | write_le32(192); # Size | ||
777 | write_hunk(305592, 192); | ||
778 | |||
779 | # | ||
780 | # Firmware 67, type: SCODE FW HAS IF (0x60000000), IF = 5.74 MHz id: PAL/BG NICAM (0000000c00000007), size: 192 | ||
781 | # | ||
782 | |||
783 | write_le32(0x60000000); # Type | ||
784 | write_le64(0x0000000c, 0x00000007); # ID | ||
785 | write_le16(5740); # IF | ||
786 | write_le32(192); # Size | ||
787 | write_hunk(305784, 192); | ||
788 | |||
789 | # | ||
790 | # Firmware 68, type: SCODE FW HAS IF (0x60000000), IF = 5.90 MHz id: (0000000000000000), size: 192 | ||
791 | # | ||
792 | |||
793 | write_le32(0x60000000); # Type | ||
794 | write_le64(0x00000000, 0x00000000); # ID | ||
795 | write_le16(5900); # IF | ||
796 | write_le32(192); # Size | ||
797 | write_hunk(307512, 192); | ||
798 | |||
799 | # | ||
800 | # Firmware 69, type: SCODE FW MONO HAS IF (0x60008000), IF = 6.00 MHz id: PAL/DK PAL/I SECAM/K3 SECAM/L SECAM/Lc NICAM (0000000c04c000f0), size: 192 | ||
801 | # | ||
802 | |||
803 | write_le32(0x60008000); # Type | ||
804 | write_le64(0x0000000c, 0x04c000f0); # ID | ||
805 | write_le16(6000); # IF | ||
806 | write_le32(192); # Size | ||
807 | write_hunk(305576, 192); | ||
808 | |||
809 | # | ||
810 | # Firmware 70, type: SCODE FW DTV6 QAM ATSC LG60 F6MHZ HAS IF (0x68050060), IF = 6.20 MHz id: (0000000000000000), size: 192 | ||
811 | # | ||
812 | |||
813 | write_le32(0x68050060); # Type | ||
814 | write_le64(0x00000000, 0x00000000); # ID | ||
815 | write_le16(6200); # IF | ||
816 | write_le32(192); # Size | ||
817 | write_hunk(306552, 192); | ||
818 | |||
819 | # | ||
820 | # Firmware 71, type: SCODE FW HAS IF (0x60000000), IF = 6.24 MHz id: PAL/I (0000000000000010), size: 192 | ||
821 | # | ||
822 | |||
823 | write_le32(0x60000000); # Type | ||
824 | write_le64(0x00000000, 0x00000010); # ID | ||
825 | write_le16(6240); # IF | ||
826 | write_le32(192); # Size | ||
827 | write_hunk(305400, 192); | ||
828 | |||
829 | # | ||
830 | # Firmware 72, type: SCODE FW MONO HAS IF (0x60008000), IF = 6.32 MHz id: SECAM/K1 (0000000000200000), size: 192 | ||
831 | # | ||
832 | |||
833 | write_le32(0x60008000); # Type | ||
834 | write_le64(0x00000000, 0x00200000); # ID | ||
835 | write_le16(6320); # IF | ||
836 | write_le32(192); # Size | ||
837 | write_hunk(308472, 192); | ||
838 | |||
839 | # | ||
840 | # Firmware 73, type: SCODE FW HAS IF (0x60000000), IF = 6.34 MHz id: SECAM/K1 (0000000000200000), size: 192 | ||
841 | # | ||
842 | |||
843 | write_le32(0x60000000); # Type | ||
844 | write_le64(0x00000000, 0x00200000); # ID | ||
845 | write_le16(6340); # IF | ||
846 | write_le32(192); # Size | ||
847 | write_hunk(306360, 192); | ||
848 | |||
849 | # | ||
850 | # Firmware 74, type: SCODE FW MONO HAS IF (0x60008000), IF = 6.50 MHz id: PAL/DK SECAM/K3 SECAM/L NICAM (0000000c044000e0), size: 192 | ||
851 | # | ||
852 | |||
853 | write_le32(0x60008000); # Type | ||
854 | write_le64(0x0000000c, 0x044000e0); # ID | ||
855 | write_le16(6500); # IF | ||
856 | write_le32(192); # Size | ||
857 | write_hunk(308280, 192); | ||
858 | |||
859 | # | ||
860 | # Firmware 75, type: SCODE FW DTV6 ATSC ATI638 HAS IF (0x60090020), IF = 6.58 MHz id: (0000000000000000), size: 192 | ||
861 | # | ||
862 | |||
863 | write_le32(0x60090020); # Type | ||
864 | write_le64(0x00000000, 0x00000000); # ID | ||
865 | write_le16(6580); # IF | ||
866 | write_le32(192); # Size | ||
867 | write_hunk(304632, 192); | ||
868 | |||
869 | # | ||
870 | # Firmware 76, type: SCODE FW HAS IF (0x60000000), IF = 6.60 MHz id: PAL/DK A2 (00000003000000e0), size: 192 | ||
871 | # | ||
872 | |||
873 | write_le32(0x60000000); # Type | ||
874 | write_le64(0x00000003, 0x000000e0); # ID | ||
875 | write_le16(6600); # IF | ||
876 | write_le32(192); # Size | ||
877 | write_hunk(306168, 192); | ||
878 | |||
879 | # | ||
880 | # Firmware 77, type: SCODE FW MONO HAS IF (0x60008000), IF = 6.68 MHz id: PAL/DK A2 (00000003000000e0), size: 192 | ||
881 | # | ||
882 | |||
883 | write_le32(0x60008000); # Type | ||
884 | write_le64(0x00000003, 0x000000e0); # ID | ||
885 | write_le16(6680); # IF | ||
886 | write_le32(192); # Size | ||
887 | write_hunk(308088, 192); | ||
888 | |||
889 | # | ||
890 | # Firmware 78, type: SCODE FW DTV6 ATSC TOYOTA794 HAS IF (0x60810020), IF = 8.14 MHz id: (0000000000000000), size: 192 | ||
891 | # | ||
892 | |||
893 | write_le32(0x60810020); # Type | ||
894 | write_le64(0x00000000, 0x00000000); # ID | ||
895 | write_le16(8140); # IF | ||
896 | write_le32(192); # Size | ||
897 | write_hunk(307320, 192); | ||
898 | |||
899 | # | ||
900 | # Firmware 79, type: SCODE FW HAS IF (0x60000000), IF = 8.20 MHz id: (0000000000000000), size: 192 | ||
901 | # | ||
902 | |||
903 | # write_le32(0x60000000); # Type | ||
904 | # write_le64(0x00000000, 0x00000000); # ID | ||
905 | # write_le16(8200); # IF | ||
906 | # write_le32(192); # Size | ||
907 | # write_hunk(308088, 192); | ||
149 | } | 908 | } |
150 | 909 | ||
910 | sub main_firmware_27($$$$) | ||
911 | { | ||
912 | my $out; | ||
913 | my $j=0; | ||
914 | my $outfile = shift; | ||
915 | my $name = shift; | ||
916 | my $version = shift; | ||
917 | my $nr_desc = shift; | ||
918 | |||
919 | for ($j = length($name); $j <32; $j++) { | ||
920 | $name = $name.chr(0); | ||
921 | } | ||
922 | |||
151 | open OUTFILE, ">$outfile"; | 923 | open OUTFILE, ">$outfile"; |
152 | syswrite(OUTFILE, $name); | 924 | syswrite(OUTFILE, $name); |
153 | write_le16($version); | 925 | write_le16($version); |
@@ -906,20 +1678,39 @@ sub main_firmware($$$$) | |||
906 | write_hunk(812856, 192); | 1678 | write_hunk(812856, 192); |
907 | } | 1679 | } |
908 | 1680 | ||
1681 | |||
909 | sub extract_firmware { | 1682 | sub extract_firmware { |
910 | my $sourcefile = "hcw85bda.sys"; | 1683 | my $sourcefile_24 = "UDXTTM6000.sys"; |
911 | my $hash = "0e44dbf63bb0169d57446aec21881ff2"; | 1684 | my $hash_24 = "cb9deb5508a5e150af2880f5b0066d78"; |
912 | my $outfile = "xc3028-v27.fw"; | 1685 | my $outfile_24 = "xc3028-v24.fw"; |
913 | my $name = "xc2028 firmware"; | 1686 | my $name_24 = "xc2028 firmware"; |
914 | my $version = 519; | 1687 | my $version_24 = 516; |
915 | my $nr_desc = 80; | 1688 | my $nr_desc_24 = 77; |
1689 | my $out; | ||
1690 | |||
1691 | my $sourcefile_27 = "hcw85bda.sys"; | ||
1692 | my $hash_27 = "0e44dbf63bb0169d57446aec21881ff2"; | ||
1693 | my $outfile_27 = "xc3028-v27.fw"; | ||
1694 | my $name_27 = "xc2028 firmware"; | ||
1695 | my $version_27 = 519; | ||
1696 | my $nr_desc_27 = 80; | ||
916 | my $out; | 1697 | my $out; |
917 | 1698 | ||
918 | verify($sourcefile, $hash); | 1699 | if (-e $sourcefile_24) { |
1700 | verify($sourcefile_24, $hash_24); | ||
1701 | |||
1702 | open INFILE, "<$sourcefile_24"; | ||
1703 | main_firmware_24($outfile_24, $name_24, $version_24, $nr_desc_24); | ||
1704 | close INFILE; | ||
1705 | } | ||
919 | 1706 | ||
920 | open INFILE, "<$sourcefile"; | 1707 | if (-e $sourcefile_27) { |
921 | main_firmware($outfile, $name, $version, $nr_desc); | 1708 | verify($sourcefile_27, $hash_27); |
922 | close INFILE; | 1709 | |
1710 | open INFILE, "<$sourcefile_27"; | ||
1711 | main_firmware_27($outfile_27, $name_27, $version_27, $nr_desc_27); | ||
1712 | close INFILE; | ||
1713 | } | ||
923 | } | 1714 | } |
924 | 1715 | ||
925 | extract_firmware; | 1716 | extract_firmware; |
diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index 181b9e6fd984..8f3f5d33327c 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt | |||
@@ -50,6 +50,8 @@ zc3xx 0458:700f Genius VideoCam Web V2 | |||
50 | sonixj 0458:7025 Genius Eye 311Q | 50 | sonixj 0458:7025 Genius Eye 311Q |
51 | sn9c20x 0458:7029 Genius Look 320s | 51 | sn9c20x 0458:7029 Genius Look 320s |
52 | sonixj 0458:702e Genius Slim 310 NB | 52 | sonixj 0458:702e Genius Slim 310 NB |
53 | sn9c20x 0458:704a Genius Slim 1320 | ||
54 | sn9c20x 0458:704c Genius i-Look 1321 | ||
53 | sn9c20x 045e:00f4 LifeCam VX-6000 (SN9C20x + OV9650) | 55 | sn9c20x 045e:00f4 LifeCam VX-6000 (SN9C20x + OV9650) |
54 | sonixj 045e:00f5 MicroSoft VX3000 | 56 | sonixj 045e:00f5 MicroSoft VX3000 |
55 | sonixj 045e:00f7 MicroSoft VX1000 | 57 | sonixj 045e:00f7 MicroSoft VX1000 |
@@ -305,12 +307,14 @@ sonixj 0c45:6138 Sn9c120 Mo4000 | |||
305 | sonixj 0c45:613a Microdia Sonix PC Camera | 307 | sonixj 0c45:613a Microdia Sonix PC Camera |
306 | sonixj 0c45:613b Surfer SN-206 | 308 | sonixj 0c45:613b Surfer SN-206 |
307 | sonixj 0c45:613c Sonix Pccam168 | 309 | sonixj 0c45:613c Sonix Pccam168 |
310 | sonixj 0c45:6142 Hama PC-Webcam AC-150 | ||
308 | sonixj 0c45:6143 Sonix Pccam168 | 311 | sonixj 0c45:6143 Sonix Pccam168 |
309 | sonixj 0c45:6148 Digitus DA-70811/ZSMC USB PC Camera ZS211/Microdia | 312 | sonixj 0c45:6148 Digitus DA-70811/ZSMC USB PC Camera ZS211/Microdia |
310 | sonixj 0c45:614a Frontech E-Ccam (JIL-2225) | 313 | sonixj 0c45:614a Frontech E-Ccam (JIL-2225) |
311 | sn9c20x 0c45:6240 PC Camera (SN9C201 + MT9M001) | 314 | sn9c20x 0c45:6240 PC Camera (SN9C201 + MT9M001) |
312 | sn9c20x 0c45:6242 PC Camera (SN9C201 + MT9M111) | 315 | sn9c20x 0c45:6242 PC Camera (SN9C201 + MT9M111) |
313 | sn9c20x 0c45:6248 PC Camera (SN9C201 + OV9655) | 316 | sn9c20x 0c45:6248 PC Camera (SN9C201 + OV9655) |
317 | sn9c20x 0c45:624c PC Camera (SN9C201 + MT9M112) | ||
314 | sn9c20x 0c45:624e PC Camera (SN9C201 + SOI968) | 318 | sn9c20x 0c45:624e PC Camera (SN9C201 + SOI968) |
315 | sn9c20x 0c45:624f PC Camera (SN9C201 + OV9650) | 319 | sn9c20x 0c45:624f PC Camera (SN9C201 + OV9650) |
316 | sn9c20x 0c45:6251 PC Camera (SN9C201 + OV9650) | 320 | sn9c20x 0c45:6251 PC Camera (SN9C201 + OV9650) |
@@ -323,6 +327,7 @@ sn9c20x 0c45:627f PC Camera (SN9C201 + OV9650) | |||
323 | sn9c20x 0c45:6280 PC Camera (SN9C202 + MT9M001) | 327 | sn9c20x 0c45:6280 PC Camera (SN9C202 + MT9M001) |
324 | sn9c20x 0c45:6282 PC Camera (SN9C202 + MT9M111) | 328 | sn9c20x 0c45:6282 PC Camera (SN9C202 + MT9M111) |
325 | sn9c20x 0c45:6288 PC Camera (SN9C202 + OV9655) | 329 | sn9c20x 0c45:6288 PC Camera (SN9C202 + OV9655) |
330 | sn9c20x 0c45:628c PC Camera (SN9C201 + MT9M112) | ||
326 | sn9c20x 0c45:628e PC Camera (SN9C202 + SOI968) | 331 | sn9c20x 0c45:628e PC Camera (SN9C202 + SOI968) |
327 | sn9c20x 0c45:628f PC Camera (SN9C202 + OV9650) | 332 | sn9c20x 0c45:628f PC Camera (SN9C202 + OV9650) |
328 | sn9c20x 0c45:62a0 PC Camera (SN9C202 + OV7670) | 333 | sn9c20x 0c45:62a0 PC Camera (SN9C202 + OV7670) |
diff --git a/Documentation/video4linux/sh_mobile_ceu_camera.txt b/Documentation/video4linux/sh_mobile_ceu_camera.txt index 2ae16349a78d..cb47e723af74 100644 --- a/Documentation/video4linux/sh_mobile_ceu_camera.txt +++ b/Documentation/video4linux/sh_mobile_ceu_camera.txt | |||
@@ -17,18 +17,18 @@ Generic scaling / cropping scheme | |||
17 | -2-- -\ | 17 | -2-- -\ |
18 | | --\ | 18 | | --\ |
19 | | --\ | 19 | | --\ |
20 | +-5-- -\ -- -3-- | 20 | +-5-- . -- -3-- -\ |
21 | | ---\ | 21 | | `... -\ |
22 | | --- -4-- -\ | 22 | | `... -4-- . - -7.. |
23 | | -\ | 23 | | `. |
24 | | - -6-- | 24 | | `. .6-- |
25 | | | 25 | | |
26 | | - -6'- | 26 | | . .6'- |
27 | | -/ | 27 | | .´ |
28 | | --- -4'- -/ | 28 | | ... -4'- .´ |
29 | | ---/ | 29 | | ...´ - -7'. |
30 | +-5'- -/ | 30 | +-5'- .´ -/ |
31 | | -- -3'- | 31 | | -- -3'- -/ |
32 | | --/ | 32 | | --/ |
33 | | --/ | 33 | | --/ |
34 | -2'- -/ | 34 | -2'- -/ |
@@ -36,7 +36,11 @@ Generic scaling / cropping scheme | |||
36 | | | 36 | | |
37 | -1'- | 37 | -1'- |
38 | 38 | ||
39 | Produced by user requests: | 39 | In the above chart minuses and slashes represent "real" data amounts, points and |
40 | accents represent "useful" data, basically, CEU scaled amd cropped output, | ||
41 | mapped back onto the client's source plane. | ||
42 | |||
43 | Such a configuration can be produced by user requests: | ||
40 | 44 | ||
41 | S_CROP(left / top = (5) - (1), width / height = (5') - (5)) | 45 | S_CROP(left / top = (5) - (1), width / height = (5') - (5)) |
42 | S_FMT(width / height = (6') - (6)) | 46 | S_FMT(width / height = (6') - (6)) |
@@ -106,52 +110,30 @@ window: | |||
106 | S_CROP | 110 | S_CROP |
107 | ------ | 111 | ------ |
108 | 112 | ||
109 | If old scale applied to new crop is invalid produce nearest new scale possible | 113 | The API at http://v4l2spec.bytesex.org/spec/x1904.htm says: |
110 | |||
111 | 1. Calculate current combined scales. | ||
112 | |||
113 | scale_comb = (((4') - (4)) / ((6') - (6))) * (((2') - (2)) / ((3') - (3))) | ||
114 | |||
115 | 2. Apply iterative sensor S_CROP for new input window. | ||
116 | |||
117 | 3. If old combined scales applied to new crop produce an impossible user window, | ||
118 | adjust scales to produce nearest possible window. | ||
119 | |||
120 | width_u_out = ((5') - (5)) / scale_comb | ||
121 | 114 | ||
122 | if (width_u_out > max) | 115 | "...specification does not define an origin or units. However by convention |
123 | scale_comb = ((5') - (5)) / max; | 116 | drivers should horizontally count unscaled samples relative to 0H." |
124 | else if (width_u_out < min) | ||
125 | scale_comb = ((5') - (5)) / min; | ||
126 | 117 | ||
127 | 4. Issue G_CROP to retrieve actual input window. | 118 | We choose to follow the advise and interpret cropping units as client input |
119 | pixels. | ||
128 | 120 | ||
129 | 5. Using actual input window and calculated combined scales calculate sensor | 121 | Cropping is performed in the following 6 steps: |
130 | target output window. | ||
131 | |||
132 | width_s_out = ((3') - (3)) = ((2') - (2)) / scale_comb | ||
133 | |||
134 | 6. Apply iterative S_FMT for new sensor target output window. | ||
135 | |||
136 | 7. Issue G_FMT to retrieve the actual sensor output window. | ||
137 | |||
138 | 8. Calculate sensor scales. | ||
139 | |||
140 | scale_s = ((3') - (3)) / ((2') - (2)) | ||
141 | 122 | ||
142 | 9. Calculate sensor output subwindow to be cropped on CEU by applying sensor | 123 | 1. Request exactly user rectangle from the sensor. |
143 | scales to the requested window. | ||
144 | 124 | ||
145 | width_ceu = ((5') - (5)) / scale_s | 125 | 2. If smaller - iterate until a larger one is obtained. Result: sensor cropped |
126 | to 2 : 2', target crop 5 : 5', current output format 6' - 6. | ||
146 | 127 | ||
147 | 10. Use CEU cropping for above calculated window. | 128 | 3. In the previous step the sensor has tried to preserve its output frame as |
129 | good as possible, but it could have changed. Retrieve it again. | ||
148 | 130 | ||
149 | 11. Calculate CEU scales from sensor scales from results of (10) and user window | 131 | 4. Sensor scaled to 3 : 3'. Sensor's scale is (2' - 2) / (3' - 3). Calculate |
150 | from (3) | 132 | intermediate window: 4' - 4 = (5' - 5) * (3' - 3) / (2' - 2) |
151 | 133 | ||
152 | scale_ceu = calc_scale(((5') - (5)), &width_u_out) | 134 | 5. Calculate and apply host scale = (6' - 6) / (4' - 4) |
153 | 135 | ||
154 | 12. Apply CEU scales. | 136 | 6. Calculate and apply host crop: 6 - 7 = (5 - 2) * (6' - 6) / (5' - 5) |
155 | 137 | ||
156 | -- | 138 | -- |
157 | Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 139 | Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de> |
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index 5155700c206b..e831aaca66f8 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt | |||
@@ -545,12 +545,11 @@ unregister them: | |||
545 | This will remove the device nodes from sysfs (causing udev to remove them | 545 | This will remove the device nodes from sysfs (causing udev to remove them |
546 | from /dev). | 546 | from /dev). |
547 | 547 | ||
548 | After video_unregister_device() returns no new opens can be done. | 548 | After video_unregister_device() returns no new opens can be done. However, |
549 | 549 | in the case of USB devices some application might still have one of these | |
550 | However, in the case of USB devices some application might still have one | 550 | device nodes open. So after the unregister all file operations will return |
551 | of these device nodes open. You should block all new accesses to read, | 551 | an error as well, except for the ioctl and unlocked_ioctl file operations: |
552 | write, poll, etc. except possibly for certain ioctl operations like | 552 | those will still be passed on since some buffer ioctls may still be needed. |
553 | queueing buffers. | ||
554 | 553 | ||
555 | When the last user of the video device node exits, then the vdev->release() | 554 | When the last user of the video device node exits, then the vdev->release() |
556 | callback is called and you can do the final cleanup there. | 555 | callback is called and you can do the final cleanup there. |
@@ -609,3 +608,135 @@ scatter/gather method (videobuf-dma-sg), DMA with linear access | |||
609 | 608 | ||
610 | Please see Documentation/video4linux/videobuf for more information on how | 609 | Please see Documentation/video4linux/videobuf for more information on how |
611 | to use the videobuf layer. | 610 | to use the videobuf layer. |
611 | |||
612 | struct v4l2_fh | ||
613 | -------------- | ||
614 | |||
615 | struct v4l2_fh provides a way to easily keep file handle specific data | ||
616 | that is used by the V4L2 framework. Using v4l2_fh is optional for | ||
617 | drivers. | ||
618 | |||
619 | The users of v4l2_fh (in the V4L2 framework, not the driver) know | ||
620 | whether a driver uses v4l2_fh as its file->private_data pointer by | ||
621 | testing the V4L2_FL_USES_V4L2_FH bit in video_device->flags. | ||
622 | |||
623 | Useful functions: | ||
624 | |||
625 | - v4l2_fh_init() | ||
626 | |||
627 | Initialise the file handle. This *MUST* be performed in the driver's | ||
628 | v4l2_file_operations->open() handler. | ||
629 | |||
630 | - v4l2_fh_add() | ||
631 | |||
632 | Add a v4l2_fh to video_device file handle list. May be called after | ||
633 | initialising the file handle. | ||
634 | |||
635 | - v4l2_fh_del() | ||
636 | |||
637 | Unassociate the file handle from video_device(). The file handle | ||
638 | exit function may now be called. | ||
639 | |||
640 | - v4l2_fh_exit() | ||
641 | |||
642 | Uninitialise the file handle. After uninitialisation the v4l2_fh | ||
643 | memory can be freed. | ||
644 | |||
645 | struct v4l2_fh is allocated as a part of the driver's own file handle | ||
646 | structure and is set to file->private_data in the driver's open | ||
647 | function by the driver. Drivers can extract their own file handle | ||
648 | structure by using the container_of macro. Example: | ||
649 | |||
650 | struct my_fh { | ||
651 | int blah; | ||
652 | struct v4l2_fh fh; | ||
653 | }; | ||
654 | |||
655 | ... | ||
656 | |||
657 | int my_open(struct file *file) | ||
658 | { | ||
659 | struct my_fh *my_fh; | ||
660 | struct video_device *vfd; | ||
661 | int ret; | ||
662 | |||
663 | ... | ||
664 | |||
665 | ret = v4l2_fh_init(&my_fh->fh, vfd); | ||
666 | if (ret) | ||
667 | return ret; | ||
668 | |||
669 | v4l2_fh_add(&my_fh->fh); | ||
670 | |||
671 | file->private_data = &my_fh->fh; | ||
672 | |||
673 | ... | ||
674 | } | ||
675 | |||
676 | int my_release(struct file *file) | ||
677 | { | ||
678 | struct v4l2_fh *fh = file->private_data; | ||
679 | struct my_fh *my_fh = container_of(fh, struct my_fh, fh); | ||
680 | |||
681 | ... | ||
682 | } | ||
683 | |||
684 | V4L2 events | ||
685 | ----------- | ||
686 | |||
687 | The V4L2 events provide a generic way to pass events to user space. | ||
688 | The driver must use v4l2_fh to be able to support V4L2 events. | ||
689 | |||
690 | Useful functions: | ||
691 | |||
692 | - v4l2_event_alloc() | ||
693 | |||
694 | To use events, the driver must allocate events for the file handle. By | ||
695 | calling the function more than once, the driver may assure that at least n | ||
696 | events in total have been allocated. The function may not be called in | ||
697 | atomic context. | ||
698 | |||
699 | - v4l2_event_queue() | ||
700 | |||
701 | Queue events to video device. The driver's only responsibility is to fill | ||
702 | in the type and the data fields. The other fields will be filled in by | ||
703 | V4L2. | ||
704 | |||
705 | - v4l2_event_subscribe() | ||
706 | |||
707 | The video_device->ioctl_ops->vidioc_subscribe_event must check the driver | ||
708 | is able to produce events with specified event id. Then it calls | ||
709 | v4l2_event_subscribe() to subscribe the event. | ||
710 | |||
711 | - v4l2_event_unsubscribe() | ||
712 | |||
713 | vidioc_unsubscribe_event in struct v4l2_ioctl_ops. A driver may use | ||
714 | v4l2_event_unsubscribe() directly unless it wants to be involved in | ||
715 | unsubscription process. | ||
716 | |||
717 | The special type V4L2_EVENT_ALL may be used to unsubscribe all events. The | ||
718 | drivers may want to handle this in a special way. | ||
719 | |||
720 | - v4l2_event_pending() | ||
721 | |||
722 | Returns the number of pending events. Useful when implementing poll. | ||
723 | |||
724 | Drivers do not initialise events directly. The events are initialised | ||
725 | through v4l2_fh_init() if video_device->ioctl_ops->vidioc_subscribe_event is | ||
726 | non-NULL. This *MUST* be performed in the driver's | ||
727 | v4l2_file_operations->open() handler. | ||
728 | |||
729 | Events are delivered to user space through the poll system call. The driver | ||
730 | can use v4l2_fh->events->wait wait_queue_head_t as the argument for | ||
731 | poll_wait(). | ||
732 | |||
733 | There are standard and private events. New standard events must use the | ||
734 | smallest available event type. The drivers must allocate their events from | ||
735 | their own class starting from class base. Class base is | ||
736 | V4L2_EVENT_PRIVATE_START + n * 1000 where n is the lowest available number. | ||
737 | The first event type in the class is reserved for future use, so the first | ||
738 | available event type is 'class base + 1'. | ||
739 | |||
740 | An example on how the V4L2 events may be used can be found in the OMAP | ||
741 | 3 ISP driver available at <URL:http://gitorious.org/omap3camera> as of | ||
742 | writing this. | ||
diff --git a/Documentation/vm/map_hugetlb.c b/Documentation/vm/map_hugetlb.c index 9969c7d9f985..eda1a6d3578a 100644 --- a/Documentation/vm/map_hugetlb.c +++ b/Documentation/vm/map_hugetlb.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #define PROTECTION (PROT_READ | PROT_WRITE) | 19 | #define PROTECTION (PROT_READ | PROT_WRITE) |
20 | 20 | ||
21 | #ifndef MAP_HUGETLB | 21 | #ifndef MAP_HUGETLB |
22 | #define MAP_HUGETLB 0x40 | 22 | #define MAP_HUGETLB 0x40000 /* arch specific */ |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | /* Only ia64 requires this */ | 25 | /* Only ia64 requires this */ |
diff --git a/Documentation/vm/numa_memory_policy.txt b/Documentation/vm/numa_memory_policy.txt index be45dbb9d7f2..6690fc34ef6d 100644 --- a/Documentation/vm/numa_memory_policy.txt +++ b/Documentation/vm/numa_memory_policy.txt | |||
@@ -45,7 +45,7 @@ most general to most specific: | |||
45 | to establish the task policy for a child task exec()'d from an | 45 | to establish the task policy for a child task exec()'d from an |
46 | executable image that has no awareness of memory policy. See the | 46 | executable image that has no awareness of memory policy. See the |
47 | MEMORY POLICY APIS section, below, for an overview of the system call | 47 | MEMORY POLICY APIS section, below, for an overview of the system call |
48 | that a task may use to set/change it's task/process policy. | 48 | that a task may use to set/change its task/process policy. |
49 | 49 | ||
50 | In a multi-threaded task, task policies apply only to the thread | 50 | In a multi-threaded task, task policies apply only to the thread |
51 | [Linux kernel task] that installs the policy and any threads | 51 | [Linux kernel task] that installs the policy and any threads |
@@ -301,7 +301,7 @@ decrement this reference count, respectively. mpol_put() will only free | |||
301 | the structure back to the mempolicy kmem cache when the reference count | 301 | the structure back to the mempolicy kmem cache when the reference count |
302 | goes to zero. | 302 | goes to zero. |
303 | 303 | ||
304 | When a new memory policy is allocated, it's reference count is initialized | 304 | When a new memory policy is allocated, its reference count is initialized |
305 | to '1', representing the reference held by the task that is installing the | 305 | to '1', representing the reference held by the task that is installing the |
306 | new policy. When a pointer to a memory policy structure is stored in another | 306 | new policy. When a pointer to a memory policy structure is stored in another |
307 | structure, another reference is added, as the task's reference will be dropped | 307 | structure, another reference is added, as the task's reference will be dropped |
diff --git a/Documentation/w1/w1.generic b/Documentation/w1/w1.generic index e3333eec4320..212f4ac31c01 100644 --- a/Documentation/w1/w1.generic +++ b/Documentation/w1/w1.generic | |||
@@ -25,7 +25,7 @@ When a w1 master driver registers with the w1 subsystem, the following occurs: | |||
25 | - sysfs entries for that w1 master are created | 25 | - sysfs entries for that w1 master are created |
26 | - the w1 bus is periodically searched for new slave devices | 26 | - the w1 bus is periodically searched for new slave devices |
27 | 27 | ||
28 | When a device is found on the bus, w1 core checks if driver for it's family is | 28 | When a device is found on the bus, w1 core checks if driver for its family is |
29 | loaded. If so, the family driver is attached to the slave. | 29 | loaded. If so, the family driver is attached to the slave. |
30 | If there is no driver for the family, default one is assigned, which allows to perform | 30 | If there is no driver for the family, default one is assigned, which allows to perform |
31 | almost any kind of operations. Each logical operation is a transaction | 31 | almost any kind of operations. Each logical operation is a transaction |
diff --git a/Documentation/watchdog/src/watchdog-simple.c b/Documentation/watchdog/src/watchdog-simple.c index 4cf72f3fa8e9..ba45803a2216 100644 --- a/Documentation/watchdog/src/watchdog-simple.c +++ b/Documentation/watchdog/src/watchdog-simple.c | |||
@@ -17,9 +17,6 @@ int main(void) | |||
17 | ret = -1; | 17 | ret = -1; |
18 | break; | 18 | break; |
19 | } | 19 | } |
20 | ret = fsync(fd); | ||
21 | if (ret) | ||
22 | break; | ||
23 | sleep(10); | 20 | sleep(10); |
24 | } | 21 | } |
25 | close(fd); | 22 | close(fd); |
diff --git a/Documentation/watchdog/src/watchdog-test.c b/Documentation/watchdog/src/watchdog-test.c index a750532ffcf8..63fdc34ceb98 100644 --- a/Documentation/watchdog/src/watchdog-test.c +++ b/Documentation/watchdog/src/watchdog-test.c | |||
@@ -31,6 +31,8 @@ static void keep_alive(void) | |||
31 | */ | 31 | */ |
32 | int main(int argc, char *argv[]) | 32 | int main(int argc, char *argv[]) |
33 | { | 33 | { |
34 | int flags; | ||
35 | |||
34 | fd = open("/dev/watchdog", O_WRONLY); | 36 | fd = open("/dev/watchdog", O_WRONLY); |
35 | 37 | ||
36 | if (fd == -1) { | 38 | if (fd == -1) { |
@@ -41,12 +43,14 @@ int main(int argc, char *argv[]) | |||
41 | 43 | ||
42 | if (argc > 1) { | 44 | if (argc > 1) { |
43 | if (!strncasecmp(argv[1], "-d", 2)) { | 45 | if (!strncasecmp(argv[1], "-d", 2)) { |
44 | ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD); | 46 | flags = WDIOS_DISABLECARD; |
47 | ioctl(fd, WDIOC_SETOPTIONS, &flags); | ||
45 | fprintf(stderr, "Watchdog card disabled.\n"); | 48 | fprintf(stderr, "Watchdog card disabled.\n"); |
46 | fflush(stderr); | 49 | fflush(stderr); |
47 | exit(0); | 50 | exit(0); |
48 | } else if (!strncasecmp(argv[1], "-e", 2)) { | 51 | } else if (!strncasecmp(argv[1], "-e", 2)) { |
49 | ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD); | 52 | flags = WDIOS_ENABLECARD; |
53 | ioctl(fd, WDIOC_SETOPTIONS, &flags); | ||
50 | fprintf(stderr, "Watchdog card enabled.\n"); | 54 | fprintf(stderr, "Watchdog card enabled.\n"); |
51 | fflush(stderr); | 55 | fflush(stderr); |
52 | exit(0); | 56 | exit(0); |
diff --git a/Documentation/watchdog/watchdog-api.txt b/Documentation/watchdog/watchdog-api.txt index 4cc4ba9d7150..eb7132ed8bbc 100644 --- a/Documentation/watchdog/watchdog-api.txt +++ b/Documentation/watchdog/watchdog-api.txt | |||
@@ -222,11 +222,10 @@ returned value is the temperature in degrees fahrenheit. | |||
222 | ioctl(fd, WDIOC_GETTEMP, &temperature); | 222 | ioctl(fd, WDIOC_GETTEMP, &temperature); |
223 | 223 | ||
224 | Finally the SETOPTIONS ioctl can be used to control some aspects of | 224 | Finally the SETOPTIONS ioctl can be used to control some aspects of |
225 | the cards operation; right now the pcwd driver is the only one | 225 | the cards operation. |
226 | supporting this ioctl. | ||
227 | 226 | ||
228 | int options = 0; | 227 | int options = 0; |
229 | ioctl(fd, WDIOC_SETOPTIONS, options); | 228 | ioctl(fd, WDIOC_SETOPTIONS, &options); |
230 | 229 | ||
231 | The following options are available: | 230 | The following options are available: |
232 | 231 | ||