diff options
451 files changed, 7430 insertions, 8100 deletions
@@ -2166,7 +2166,6 @@ D: Initial implementation of VC's, pty's and select() | |||
2166 | 2166 | ||
2167 | N: Pavel Machek | 2167 | N: Pavel Machek |
2168 | E: pavel@ucw.cz | 2168 | E: pavel@ucw.cz |
2169 | E: pavel@suse.cz | ||
2170 | D: Softcursor for vga, hypertech cdrom support, vcsa bugfix, nbd | 2169 | D: Softcursor for vga, hypertech cdrom support, vcsa bugfix, nbd |
2171 | D: sun4/330 port, capabilities for elf, speedup for rm on ext2, USB, | 2170 | D: sun4/330 port, capabilities for elf, speedup for rm on ext2, USB, |
2172 | D: work on suspend-to-ram/disk, killing duplicates from ioctl32 | 2171 | D: work on suspend-to-ram/disk, killing duplicates from ioctl32 |
diff --git a/Documentation/ABI/testing/sysfs-firmware-memmap b/Documentation/ABI/testing/sysfs-firmware-memmap index 0d99ee6ae02e..eca0d65087dc 100644 --- a/Documentation/ABI/testing/sysfs-firmware-memmap +++ b/Documentation/ABI/testing/sysfs-firmware-memmap | |||
@@ -1,6 +1,6 @@ | |||
1 | What: /sys/firmware/memmap/ | 1 | What: /sys/firmware/memmap/ |
2 | Date: June 2008 | 2 | Date: June 2008 |
3 | Contact: Bernhard Walle <bwalle@suse.de> | 3 | Contact: Bernhard Walle <bernhard.walle@gmx.de> |
4 | Description: | 4 | Description: |
5 | On all platforms, the firmware provides a memory map which the | 5 | On all platforms, the firmware provides a memory map which the |
6 | kernel reads. The resources from that memory map are registered | 6 | kernel reads. The resources from that memory map are registered |
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index dc3154e49279..1462ed86d40a 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
@@ -6,7 +6,7 @@ | |||
6 | # To add a new book the only step required is to add the book to the | 6 | # To add a new book the only step required is to add the book to the |
7 | # list of DOCBOOKS. | 7 | # list of DOCBOOKS. |
8 | 8 | ||
9 | DOCBOOKS := z8530book.xml mcabook.xml \ | 9 | DOCBOOKS := z8530book.xml mcabook.xml device-drivers.xml \ |
10 | kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ | 10 | kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ |
11 | procfs-guide.xml writing_usb_driver.xml networking.xml \ | 11 | procfs-guide.xml writing_usb_driver.xml networking.xml \ |
12 | kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \ | 12 | kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \ |
diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl new file mode 100644 index 000000000000..94a20fe8fedf --- /dev/null +++ b/Documentation/DocBook/device-drivers.tmpl | |||
@@ -0,0 +1,418 @@ | |||
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="LinuxDriversAPI"> | ||
6 | <bookinfo> | ||
7 | <title>Linux Device Drivers</title> | ||
8 | |||
9 | <legalnotice> | ||
10 | <para> | ||
11 | This documentation is free software; you can redistribute | ||
12 | it and/or modify it under the terms of the GNU General Public | ||
13 | License as published by the Free Software Foundation; either | ||
14 | version 2 of the License, or (at your option) any later | ||
15 | version. | ||
16 | </para> | ||
17 | |||
18 | <para> | ||
19 | This program is distributed in the hope that it will be | ||
20 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
21 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
22 | See the GNU General Public License for more details. | ||
23 | </para> | ||
24 | |||
25 | <para> | ||
26 | You should have received a copy of the GNU General Public | ||
27 | License along with this program; if not, write to the Free | ||
28 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
29 | MA 02111-1307 USA | ||
30 | </para> | ||
31 | |||
32 | <para> | ||
33 | For more details see the file COPYING in the source | ||
34 | distribution of Linux. | ||
35 | </para> | ||
36 | </legalnotice> | ||
37 | </bookinfo> | ||
38 | |||
39 | <toc></toc> | ||
40 | |||
41 | <chapter id="Basics"> | ||
42 | <title>Driver Basics</title> | ||
43 | <sect1><title>Driver Entry and Exit points</title> | ||
44 | !Iinclude/linux/init.h | ||
45 | </sect1> | ||
46 | |||
47 | <sect1><title>Atomic and pointer manipulation</title> | ||
48 | !Iarch/x86/include/asm/atomic_32.h | ||
49 | !Iarch/x86/include/asm/unaligned.h | ||
50 | </sect1> | ||
51 | |||
52 | <sect1><title>Delaying, scheduling, and timer routines</title> | ||
53 | !Iinclude/linux/sched.h | ||
54 | !Ekernel/sched.c | ||
55 | !Ekernel/timer.c | ||
56 | </sect1> | ||
57 | <sect1><title>High-resolution timers</title> | ||
58 | !Iinclude/linux/ktime.h | ||
59 | !Iinclude/linux/hrtimer.h | ||
60 | !Ekernel/hrtimer.c | ||
61 | </sect1> | ||
62 | <sect1><title>Workqueues and Kevents</title> | ||
63 | !Ekernel/workqueue.c | ||
64 | </sect1> | ||
65 | <sect1><title>Internal Functions</title> | ||
66 | !Ikernel/exit.c | ||
67 | !Ikernel/signal.c | ||
68 | !Iinclude/linux/kthread.h | ||
69 | !Ekernel/kthread.c | ||
70 | </sect1> | ||
71 | |||
72 | <sect1><title>Kernel objects manipulation</title> | ||
73 | <!-- | ||
74 | X!Iinclude/linux/kobject.h | ||
75 | --> | ||
76 | !Elib/kobject.c | ||
77 | </sect1> | ||
78 | |||
79 | <sect1><title>Kernel utility functions</title> | ||
80 | !Iinclude/linux/kernel.h | ||
81 | !Ekernel/printk.c | ||
82 | !Ekernel/panic.c | ||
83 | !Ekernel/sys.c | ||
84 | !Ekernel/rcupdate.c | ||
85 | </sect1> | ||
86 | |||
87 | <sect1><title>Device Resource Management</title> | ||
88 | !Edrivers/base/devres.c | ||
89 | </sect1> | ||
90 | |||
91 | </chapter> | ||
92 | |||
93 | <chapter id="devdrivers"> | ||
94 | <title>Device drivers infrastructure</title> | ||
95 | <sect1><title>Device Drivers Base</title> | ||
96 | <!-- | ||
97 | X!Iinclude/linux/device.h | ||
98 | --> | ||
99 | !Edrivers/base/driver.c | ||
100 | !Edrivers/base/core.c | ||
101 | !Edrivers/base/class.c | ||
102 | !Edrivers/base/firmware_class.c | ||
103 | !Edrivers/base/transport_class.c | ||
104 | <!-- Cannot be included, because | ||
105 | attribute_container_add_class_device_adapter | ||
106 | and attribute_container_classdev_to_container | ||
107 | exceed allowed 44 characters maximum | ||
108 | X!Edrivers/base/attribute_container.c | ||
109 | --> | ||
110 | !Edrivers/base/sys.c | ||
111 | <!-- | ||
112 | X!Edrivers/base/interface.c | ||
113 | --> | ||
114 | !Edrivers/base/platform.c | ||
115 | !Edrivers/base/bus.c | ||
116 | </sect1> | ||
117 | <sect1><title>Device Drivers Power Management</title> | ||
118 | !Edrivers/base/power/main.c | ||
119 | </sect1> | ||
120 | <sect1><title>Device Drivers ACPI Support</title> | ||
121 | <!-- Internal functions only | ||
122 | X!Edrivers/acpi/sleep/main.c | ||
123 | X!Edrivers/acpi/sleep/wakeup.c | ||
124 | X!Edrivers/acpi/motherboard.c | ||
125 | X!Edrivers/acpi/bus.c | ||
126 | --> | ||
127 | !Edrivers/acpi/scan.c | ||
128 | !Idrivers/acpi/scan.c | ||
129 | <!-- No correct structured comments | ||
130 | X!Edrivers/acpi/pci_bind.c | ||
131 | --> | ||
132 | </sect1> | ||
133 | <sect1><title>Device drivers PnP support</title> | ||
134 | !Idrivers/pnp/core.c | ||
135 | <!-- No correct structured comments | ||
136 | X!Edrivers/pnp/system.c | ||
137 | --> | ||
138 | !Edrivers/pnp/card.c | ||
139 | !Idrivers/pnp/driver.c | ||
140 | !Edrivers/pnp/manager.c | ||
141 | !Edrivers/pnp/support.c | ||
142 | </sect1> | ||
143 | <sect1><title>Userspace IO devices</title> | ||
144 | !Edrivers/uio/uio.c | ||
145 | !Iinclude/linux/uio_driver.h | ||
146 | </sect1> | ||
147 | </chapter> | ||
148 | |||
149 | <chapter id="parportdev"> | ||
150 | <title>Parallel Port Devices</title> | ||
151 | !Iinclude/linux/parport.h | ||
152 | !Edrivers/parport/ieee1284.c | ||
153 | !Edrivers/parport/share.c | ||
154 | !Idrivers/parport/daisy.c | ||
155 | </chapter> | ||
156 | |||
157 | <chapter id="message_devices"> | ||
158 | <title>Message-based devices</title> | ||
159 | <sect1><title>Fusion message devices</title> | ||
160 | !Edrivers/message/fusion/mptbase.c | ||
161 | !Idrivers/message/fusion/mptbase.c | ||
162 | !Edrivers/message/fusion/mptscsih.c | ||
163 | !Idrivers/message/fusion/mptscsih.c | ||
164 | !Idrivers/message/fusion/mptctl.c | ||
165 | !Idrivers/message/fusion/mptspi.c | ||
166 | !Idrivers/message/fusion/mptfc.c | ||
167 | !Idrivers/message/fusion/mptlan.c | ||
168 | </sect1> | ||
169 | <sect1><title>I2O message devices</title> | ||
170 | !Iinclude/linux/i2o.h | ||
171 | !Idrivers/message/i2o/core.h | ||
172 | !Edrivers/message/i2o/iop.c | ||
173 | !Idrivers/message/i2o/iop.c | ||
174 | !Idrivers/message/i2o/config-osm.c | ||
175 | !Edrivers/message/i2o/exec-osm.c | ||
176 | !Idrivers/message/i2o/exec-osm.c | ||
177 | !Idrivers/message/i2o/bus-osm.c | ||
178 | !Edrivers/message/i2o/device.c | ||
179 | !Idrivers/message/i2o/device.c | ||
180 | !Idrivers/message/i2o/driver.c | ||
181 | !Idrivers/message/i2o/pci.c | ||
182 | !Idrivers/message/i2o/i2o_block.c | ||
183 | !Idrivers/message/i2o/i2o_scsi.c | ||
184 | !Idrivers/message/i2o/i2o_proc.c | ||
185 | </sect1> | ||
186 | </chapter> | ||
187 | |||
188 | <chapter id="snddev"> | ||
189 | <title>Sound Devices</title> | ||
190 | !Iinclude/sound/core.h | ||
191 | !Esound/sound_core.c | ||
192 | !Iinclude/sound/pcm.h | ||
193 | !Esound/core/pcm.c | ||
194 | !Esound/core/device.c | ||
195 | !Esound/core/info.c | ||
196 | !Esound/core/rawmidi.c | ||
197 | !Esound/core/sound.c | ||
198 | !Esound/core/memory.c | ||
199 | !Esound/core/pcm_memory.c | ||
200 | !Esound/core/init.c | ||
201 | !Esound/core/isadma.c | ||
202 | !Esound/core/control.c | ||
203 | !Esound/core/pcm_lib.c | ||
204 | !Esound/core/hwdep.c | ||
205 | !Esound/core/pcm_native.c | ||
206 | !Esound/core/memalloc.c | ||
207 | <!-- FIXME: Removed for now since no structured comments in source | ||
208 | X!Isound/sound_firmware.c | ||
209 | --> | ||
210 | </chapter> | ||
211 | |||
212 | <chapter id="uart16x50"> | ||
213 | <title>16x50 UART Driver</title> | ||
214 | !Iinclude/linux/serial_core.h | ||
215 | !Edrivers/serial/serial_core.c | ||
216 | !Edrivers/serial/8250.c | ||
217 | </chapter> | ||
218 | |||
219 | <chapter id="fbdev"> | ||
220 | <title>Frame Buffer Library</title> | ||
221 | |||
222 | <para> | ||
223 | The frame buffer drivers depend heavily on four data structures. | ||
224 | These structures are declared in include/linux/fb.h. They are | ||
225 | fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. | ||
226 | The last three can be made available to and from userland. | ||
227 | </para> | ||
228 | |||
229 | <para> | ||
230 | fb_info defines the current state of a particular video card. | ||
231 | Inside fb_info, there exists a fb_ops structure which is a | ||
232 | collection of needed functions to make fbdev and fbcon work. | ||
233 | fb_info is only visible to the kernel. | ||
234 | </para> | ||
235 | |||
236 | <para> | ||
237 | fb_var_screeninfo is used to describe the features of a video card | ||
238 | that are user defined. With fb_var_screeninfo, things such as | ||
239 | depth and the resolution may be defined. | ||
240 | </para> | ||
241 | |||
242 | <para> | ||
243 | The next structure is fb_fix_screeninfo. This defines the | ||
244 | properties of a card that are created when a mode is set and can't | ||
245 | be changed otherwise. A good example of this is the start of the | ||
246 | frame buffer memory. This "locks" the address of the frame buffer | ||
247 | memory, so that it cannot be changed or moved. | ||
248 | </para> | ||
249 | |||
250 | <para> | ||
251 | The last structure is fb_monospecs. In the old API, there was | ||
252 | little importance for fb_monospecs. This allowed for forbidden things | ||
253 | such as setting a mode of 800x600 on a fix frequency monitor. With | ||
254 | the new API, fb_monospecs prevents such things, and if used | ||
255 | correctly, can prevent a monitor from being cooked. fb_monospecs | ||
256 | will not be useful until kernels 2.5.x. | ||
257 | </para> | ||
258 | |||
259 | <sect1><title>Frame Buffer Memory</title> | ||
260 | !Edrivers/video/fbmem.c | ||
261 | </sect1> | ||
262 | <!-- | ||
263 | <sect1><title>Frame Buffer Console</title> | ||
264 | X!Edrivers/video/console/fbcon.c | ||
265 | </sect1> | ||
266 | --> | ||
267 | <sect1><title>Frame Buffer Colormap</title> | ||
268 | !Edrivers/video/fbcmap.c | ||
269 | </sect1> | ||
270 | <!-- FIXME: | ||
271 | drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment | ||
272 | out until somebody adds docs. KAO | ||
273 | <sect1><title>Frame Buffer Generic Functions</title> | ||
274 | X!Idrivers/video/fbgen.c | ||
275 | </sect1> | ||
276 | KAO --> | ||
277 | <sect1><title>Frame Buffer Video Mode Database</title> | ||
278 | !Idrivers/video/modedb.c | ||
279 | !Edrivers/video/modedb.c | ||
280 | </sect1> | ||
281 | <sect1><title>Frame Buffer Macintosh Video Mode Database</title> | ||
282 | !Edrivers/video/macmodes.c | ||
283 | </sect1> | ||
284 | <sect1><title>Frame Buffer Fonts</title> | ||
285 | <para> | ||
286 | Refer to the file drivers/video/console/fonts.c for more information. | ||
287 | </para> | ||
288 | <!-- FIXME: Removed for now since no structured comments in source | ||
289 | X!Idrivers/video/console/fonts.c | ||
290 | --> | ||
291 | </sect1> | ||
292 | </chapter> | ||
293 | |||
294 | <chapter id="input_subsystem"> | ||
295 | <title>Input Subsystem</title> | ||
296 | !Iinclude/linux/input.h | ||
297 | !Edrivers/input/input.c | ||
298 | !Edrivers/input/ff-core.c | ||
299 | !Edrivers/input/ff-memless.c | ||
300 | </chapter> | ||
301 | |||
302 | <chapter id="spi"> | ||
303 | <title>Serial Peripheral Interface (SPI)</title> | ||
304 | <para> | ||
305 | SPI is the "Serial Peripheral Interface", widely used with | ||
306 | embedded systems because it is a simple and efficient | ||
307 | interface: basically a multiplexed shift register. | ||
308 | Its three signal wires hold a clock (SCK, often in the range | ||
309 | of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and | ||
310 | a "Master In, Slave Out" (MISO) data line. | ||
311 | SPI is a full duplex protocol; for each bit shifted out the | ||
312 | MOSI line (one per clock) another is shifted in on the MISO line. | ||
313 | Those bits are assembled into words of various sizes on the | ||
314 | way to and from system memory. | ||
315 | An additional chipselect line is usually active-low (nCS); | ||
316 | four signals are normally used for each peripheral, plus | ||
317 | sometimes an interrupt. | ||
318 | </para> | ||
319 | <para> | ||
320 | The SPI bus facilities listed here provide a generalized | ||
321 | interface to declare SPI busses and devices, manage them | ||
322 | according to the standard Linux driver model, and perform | ||
323 | input/output operations. | ||
324 | At this time, only "master" side interfaces are supported, | ||
325 | where Linux talks to SPI peripherals and does not implement | ||
326 | such a peripheral itself. | ||
327 | (Interfaces to support implementing SPI slaves would | ||
328 | necessarily look different.) | ||
329 | </para> | ||
330 | <para> | ||
331 | The programming interface is structured around two kinds of driver, | ||
332 | and two kinds of device. | ||
333 | A "Controller Driver" abstracts the controller hardware, which may | ||
334 | be as simple as a set of GPIO pins or as complex as a pair of FIFOs | ||
335 | connected to dual DMA engines on the other side of the SPI shift | ||
336 | register (maximizing throughput). Such drivers bridge between | ||
337 | whatever bus they sit on (often the platform bus) and SPI, and | ||
338 | expose the SPI side of their device as a | ||
339 | <structname>struct spi_master</structname>. | ||
340 | SPI devices are children of that master, represented as a | ||
341 | <structname>struct spi_device</structname> and manufactured from | ||
342 | <structname>struct spi_board_info</structname> descriptors which | ||
343 | are usually provided by board-specific initialization code. | ||
344 | A <structname>struct spi_driver</structname> is called a | ||
345 | "Protocol Driver", and is bound to a spi_device using normal | ||
346 | driver model calls. | ||
347 | </para> | ||
348 | <para> | ||
349 | The I/O model is a set of queued messages. Protocol drivers | ||
350 | submit one or more <structname>struct spi_message</structname> | ||
351 | objects, which are processed and completed asynchronously. | ||
352 | (There are synchronous wrappers, however.) Messages are | ||
353 | built from one or more <structname>struct spi_transfer</structname> | ||
354 | objects, each of which wraps a full duplex SPI transfer. | ||
355 | A variety of protocol tweaking options are needed, because | ||
356 | different chips adopt very different policies for how they | ||
357 | use the bits transferred with SPI. | ||
358 | </para> | ||
359 | !Iinclude/linux/spi/spi.h | ||
360 | !Fdrivers/spi/spi.c spi_register_board_info | ||
361 | !Edrivers/spi/spi.c | ||
362 | </chapter> | ||
363 | |||
364 | <chapter id="i2c"> | ||
365 | <title>I<superscript>2</superscript>C and SMBus Subsystem</title> | ||
366 | |||
367 | <para> | ||
368 | I<superscript>2</superscript>C (or without fancy typography, "I2C") | ||
369 | is an acronym for the "Inter-IC" bus, a simple bus protocol which is | ||
370 | widely used where low data rate communications suffice. | ||
371 | Since it's also a licensed trademark, some vendors use another | ||
372 | name (such as "Two-Wire Interface", TWI) for the same bus. | ||
373 | I2C only needs two signals (SCL for clock, SDA for data), conserving | ||
374 | board real estate and minimizing signal quality issues. | ||
375 | Most I2C devices use seven bit addresses, and bus speeds of up | ||
376 | to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet | ||
377 | found wide use. | ||
378 | I2C is a multi-master bus; open drain signaling is used to | ||
379 | arbitrate between masters, as well as to handshake and to | ||
380 | synchronize clocks from slower clients. | ||
381 | </para> | ||
382 | |||
383 | <para> | ||
384 | The Linux I2C programming interfaces support only the master | ||
385 | side of bus interactions, not the slave side. | ||
386 | The programming interface is structured around two kinds of driver, | ||
387 | and two kinds of device. | ||
388 | An I2C "Adapter Driver" abstracts the controller hardware; it binds | ||
389 | to a physical device (perhaps a PCI device or platform_device) and | ||
390 | exposes a <structname>struct i2c_adapter</structname> representing | ||
391 | each I2C bus segment it manages. | ||
392 | On each I2C bus segment will be I2C devices represented by a | ||
393 | <structname>struct i2c_client</structname>. Those devices will | ||
394 | be bound to a <structname>struct i2c_driver</structname>, | ||
395 | which should follow the standard Linux driver model. | ||
396 | (At this writing, a legacy model is more widely used.) | ||
397 | There are functions to perform various I2C protocol operations; at | ||
398 | this writing all such functions are usable only from task context. | ||
399 | </para> | ||
400 | |||
401 | <para> | ||
402 | The System Management Bus (SMBus) is a sibling protocol. Most SMBus | ||
403 | systems are also I2C conformant. The electrical constraints are | ||
404 | tighter for SMBus, and it standardizes particular protocol messages | ||
405 | and idioms. Controllers that support I2C can also support most | ||
406 | SMBus operations, but SMBus controllers don't support all the protocol | ||
407 | options that an I2C controller will. | ||
408 | There are functions to perform various SMBus protocol operations, | ||
409 | either using I2C primitives or by issuing SMBus commands to | ||
410 | i2c_adapter devices which don't support those I2C operations. | ||
411 | </para> | ||
412 | |||
413 | !Iinclude/linux/i2c.h | ||
414 | !Fdrivers/i2c/i2c-boardinfo.c i2c_register_board_info | ||
415 | !Edrivers/i2c/i2c-core.c | ||
416 | </chapter> | ||
417 | |||
418 | </book> | ||
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl index 5818ff75786a..bc962cda6504 100644 --- a/Documentation/DocBook/kernel-api.tmpl +++ b/Documentation/DocBook/kernel-api.tmpl | |||
@@ -38,58 +38,6 @@ | |||
38 | 38 | ||
39 | <toc></toc> | 39 | <toc></toc> |
40 | 40 | ||
41 | <chapter id="Basics"> | ||
42 | <title>Driver Basics</title> | ||
43 | <sect1><title>Driver Entry and Exit points</title> | ||
44 | !Iinclude/linux/init.h | ||
45 | </sect1> | ||
46 | |||
47 | <sect1><title>Atomic and pointer manipulation</title> | ||
48 | !Iarch/x86/include/asm/atomic_32.h | ||
49 | !Iarch/x86/include/asm/unaligned.h | ||
50 | </sect1> | ||
51 | |||
52 | <sect1><title>Delaying, scheduling, and timer routines</title> | ||
53 | !Iinclude/linux/sched.h | ||
54 | !Ekernel/sched.c | ||
55 | !Ekernel/timer.c | ||
56 | </sect1> | ||
57 | <sect1><title>High-resolution timers</title> | ||
58 | !Iinclude/linux/ktime.h | ||
59 | !Iinclude/linux/hrtimer.h | ||
60 | !Ekernel/hrtimer.c | ||
61 | </sect1> | ||
62 | <sect1><title>Workqueues and Kevents</title> | ||
63 | !Ekernel/workqueue.c | ||
64 | </sect1> | ||
65 | <sect1><title>Internal Functions</title> | ||
66 | !Ikernel/exit.c | ||
67 | !Ikernel/signal.c | ||
68 | !Iinclude/linux/kthread.h | ||
69 | !Ekernel/kthread.c | ||
70 | </sect1> | ||
71 | |||
72 | <sect1><title>Kernel objects manipulation</title> | ||
73 | <!-- | ||
74 | X!Iinclude/linux/kobject.h | ||
75 | --> | ||
76 | !Elib/kobject.c | ||
77 | </sect1> | ||
78 | |||
79 | <sect1><title>Kernel utility functions</title> | ||
80 | !Iinclude/linux/kernel.h | ||
81 | !Ekernel/printk.c | ||
82 | !Ekernel/panic.c | ||
83 | !Ekernel/sys.c | ||
84 | !Ekernel/rcupdate.c | ||
85 | </sect1> | ||
86 | |||
87 | <sect1><title>Device Resource Management</title> | ||
88 | !Edrivers/base/devres.c | ||
89 | </sect1> | ||
90 | |||
91 | </chapter> | ||
92 | |||
93 | <chapter id="adt"> | 41 | <chapter id="adt"> |
94 | <title>Data Types</title> | 42 | <title>Data Types</title> |
95 | <sect1><title>Doubly Linked Lists</title> | 43 | <sect1><title>Doubly Linked Lists</title> |
@@ -298,62 +246,6 @@ X!Earch/x86/kernel/mca_32.c | |||
298 | !Ikernel/acct.c | 246 | !Ikernel/acct.c |
299 | </chapter> | 247 | </chapter> |
300 | 248 | ||
301 | <chapter id="devdrivers"> | ||
302 | <title>Device drivers infrastructure</title> | ||
303 | <sect1><title>Device Drivers Base</title> | ||
304 | <!-- | ||
305 | X!Iinclude/linux/device.h | ||
306 | --> | ||
307 | !Edrivers/base/driver.c | ||
308 | !Edrivers/base/core.c | ||
309 | !Edrivers/base/class.c | ||
310 | !Edrivers/base/firmware_class.c | ||
311 | !Edrivers/base/transport_class.c | ||
312 | <!-- Cannot be included, because | ||
313 | attribute_container_add_class_device_adapter | ||
314 | and attribute_container_classdev_to_container | ||
315 | exceed allowed 44 characters maximum | ||
316 | X!Edrivers/base/attribute_container.c | ||
317 | --> | ||
318 | !Edrivers/base/sys.c | ||
319 | <!-- | ||
320 | X!Edrivers/base/interface.c | ||
321 | --> | ||
322 | !Edrivers/base/platform.c | ||
323 | !Edrivers/base/bus.c | ||
324 | </sect1> | ||
325 | <sect1><title>Device Drivers Power Management</title> | ||
326 | !Edrivers/base/power/main.c | ||
327 | </sect1> | ||
328 | <sect1><title>Device Drivers ACPI Support</title> | ||
329 | <!-- Internal functions only | ||
330 | X!Edrivers/acpi/sleep/main.c | ||
331 | X!Edrivers/acpi/sleep/wakeup.c | ||
332 | X!Edrivers/acpi/motherboard.c | ||
333 | X!Edrivers/acpi/bus.c | ||
334 | --> | ||
335 | !Edrivers/acpi/scan.c | ||
336 | !Idrivers/acpi/scan.c | ||
337 | <!-- No correct structured comments | ||
338 | X!Edrivers/acpi/pci_bind.c | ||
339 | --> | ||
340 | </sect1> | ||
341 | <sect1><title>Device drivers PnP support</title> | ||
342 | !Idrivers/pnp/core.c | ||
343 | <!-- No correct structured comments | ||
344 | X!Edrivers/pnp/system.c | ||
345 | --> | ||
346 | !Edrivers/pnp/card.c | ||
347 | !Idrivers/pnp/driver.c | ||
348 | !Edrivers/pnp/manager.c | ||
349 | !Edrivers/pnp/support.c | ||
350 | </sect1> | ||
351 | <sect1><title>Userspace IO devices</title> | ||
352 | !Edrivers/uio/uio.c | ||
353 | !Iinclude/linux/uio_driver.h | ||
354 | </sect1> | ||
355 | </chapter> | ||
356 | |||
357 | <chapter id="blkdev"> | 249 | <chapter id="blkdev"> |
358 | <title>Block Devices</title> | 250 | <title>Block Devices</title> |
359 | !Eblock/blk-core.c | 251 | !Eblock/blk-core.c |
@@ -381,275 +273,6 @@ X!Edrivers/pnp/system.c | |||
381 | !Edrivers/char/misc.c | 273 | !Edrivers/char/misc.c |
382 | </chapter> | 274 | </chapter> |
383 | 275 | ||
384 | <chapter id="parportdev"> | ||
385 | <title>Parallel Port Devices</title> | ||
386 | !Iinclude/linux/parport.h | ||
387 | !Edrivers/parport/ieee1284.c | ||
388 | !Edrivers/parport/share.c | ||
389 | !Idrivers/parport/daisy.c | ||
390 | </chapter> | ||
391 | |||
392 | <chapter id="message_devices"> | ||
393 | <title>Message-based devices</title> | ||
394 | <sect1><title>Fusion message devices</title> | ||
395 | !Edrivers/message/fusion/mptbase.c | ||
396 | !Idrivers/message/fusion/mptbase.c | ||
397 | !Edrivers/message/fusion/mptscsih.c | ||
398 | !Idrivers/message/fusion/mptscsih.c | ||
399 | !Idrivers/message/fusion/mptctl.c | ||
400 | !Idrivers/message/fusion/mptspi.c | ||
401 | !Idrivers/message/fusion/mptfc.c | ||
402 | !Idrivers/message/fusion/mptlan.c | ||
403 | </sect1> | ||
404 | <sect1><title>I2O message devices</title> | ||
405 | !Iinclude/linux/i2o.h | ||
406 | !Idrivers/message/i2o/core.h | ||
407 | !Edrivers/message/i2o/iop.c | ||
408 | !Idrivers/message/i2o/iop.c | ||
409 | !Idrivers/message/i2o/config-osm.c | ||
410 | !Edrivers/message/i2o/exec-osm.c | ||
411 | !Idrivers/message/i2o/exec-osm.c | ||
412 | !Idrivers/message/i2o/bus-osm.c | ||
413 | !Edrivers/message/i2o/device.c | ||
414 | !Idrivers/message/i2o/device.c | ||
415 | !Idrivers/message/i2o/driver.c | ||
416 | !Idrivers/message/i2o/pci.c | ||
417 | !Idrivers/message/i2o/i2o_block.c | ||
418 | !Idrivers/message/i2o/i2o_scsi.c | ||
419 | !Idrivers/message/i2o/i2o_proc.c | ||
420 | </sect1> | ||
421 | </chapter> | ||
422 | |||
423 | <chapter id="snddev"> | ||
424 | <title>Sound Devices</title> | ||
425 | !Iinclude/sound/core.h | ||
426 | !Esound/sound_core.c | ||
427 | !Iinclude/sound/pcm.h | ||
428 | !Esound/core/pcm.c | ||
429 | !Esound/core/device.c | ||
430 | !Esound/core/info.c | ||
431 | !Esound/core/rawmidi.c | ||
432 | !Esound/core/sound.c | ||
433 | !Esound/core/memory.c | ||
434 | !Esound/core/pcm_memory.c | ||
435 | !Esound/core/init.c | ||
436 | !Esound/core/isadma.c | ||
437 | !Esound/core/control.c | ||
438 | !Esound/core/pcm_lib.c | ||
439 | !Esound/core/hwdep.c | ||
440 | !Esound/core/pcm_native.c | ||
441 | !Esound/core/memalloc.c | ||
442 | <!-- FIXME: Removed for now since no structured comments in source | ||
443 | X!Isound/sound_firmware.c | ||
444 | --> | ||
445 | </chapter> | ||
446 | |||
447 | <chapter id="uart16x50"> | ||
448 | <title>16x50 UART Driver</title> | ||
449 | !Iinclude/linux/serial_core.h | ||
450 | !Edrivers/serial/serial_core.c | ||
451 | !Edrivers/serial/8250.c | ||
452 | </chapter> | ||
453 | |||
454 | <chapter id="fbdev"> | ||
455 | <title>Frame Buffer Library</title> | ||
456 | |||
457 | <para> | ||
458 | The frame buffer drivers depend heavily on four data structures. | ||
459 | These structures are declared in include/linux/fb.h. They are | ||
460 | fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. | ||
461 | The last three can be made available to and from userland. | ||
462 | </para> | ||
463 | |||
464 | <para> | ||
465 | fb_info defines the current state of a particular video card. | ||
466 | Inside fb_info, there exists a fb_ops structure which is a | ||
467 | collection of needed functions to make fbdev and fbcon work. | ||
468 | fb_info is only visible to the kernel. | ||
469 | </para> | ||
470 | |||
471 | <para> | ||
472 | fb_var_screeninfo is used to describe the features of a video card | ||
473 | that are user defined. With fb_var_screeninfo, things such as | ||
474 | depth and the resolution may be defined. | ||
475 | </para> | ||
476 | |||
477 | <para> | ||
478 | The next structure is fb_fix_screeninfo. This defines the | ||
479 | properties of a card that are created when a mode is set and can't | ||
480 | be changed otherwise. A good example of this is the start of the | ||
481 | frame buffer memory. This "locks" the address of the frame buffer | ||
482 | memory, so that it cannot be changed or moved. | ||
483 | </para> | ||
484 | |||
485 | <para> | ||
486 | The last structure is fb_monospecs. In the old API, there was | ||
487 | little importance for fb_monospecs. This allowed for forbidden things | ||
488 | such as setting a mode of 800x600 on a fix frequency monitor. With | ||
489 | the new API, fb_monospecs prevents such things, and if used | ||
490 | correctly, can prevent a monitor from being cooked. fb_monospecs | ||
491 | will not be useful until kernels 2.5.x. | ||
492 | </para> | ||
493 | |||
494 | <sect1><title>Frame Buffer Memory</title> | ||
495 | !Edrivers/video/fbmem.c | ||
496 | </sect1> | ||
497 | <!-- | ||
498 | <sect1><title>Frame Buffer Console</title> | ||
499 | X!Edrivers/video/console/fbcon.c | ||
500 | </sect1> | ||
501 | --> | ||
502 | <sect1><title>Frame Buffer Colormap</title> | ||
503 | !Edrivers/video/fbcmap.c | ||
504 | </sect1> | ||
505 | <!-- FIXME: | ||
506 | drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment | ||
507 | out until somebody adds docs. KAO | ||
508 | <sect1><title>Frame Buffer Generic Functions</title> | ||
509 | X!Idrivers/video/fbgen.c | ||
510 | </sect1> | ||
511 | KAO --> | ||
512 | <sect1><title>Frame Buffer Video Mode Database</title> | ||
513 | !Idrivers/video/modedb.c | ||
514 | !Edrivers/video/modedb.c | ||
515 | </sect1> | ||
516 | <sect1><title>Frame Buffer Macintosh Video Mode Database</title> | ||
517 | !Edrivers/video/macmodes.c | ||
518 | </sect1> | ||
519 | <sect1><title>Frame Buffer Fonts</title> | ||
520 | <para> | ||
521 | Refer to the file drivers/video/console/fonts.c for more information. | ||
522 | </para> | ||
523 | <!-- FIXME: Removed for now since no structured comments in source | ||
524 | X!Idrivers/video/console/fonts.c | ||
525 | --> | ||
526 | </sect1> | ||
527 | </chapter> | ||
528 | |||
529 | <chapter id="input_subsystem"> | ||
530 | <title>Input Subsystem</title> | ||
531 | !Iinclude/linux/input.h | ||
532 | !Edrivers/input/input.c | ||
533 | !Edrivers/input/ff-core.c | ||
534 | !Edrivers/input/ff-memless.c | ||
535 | </chapter> | ||
536 | |||
537 | <chapter id="spi"> | ||
538 | <title>Serial Peripheral Interface (SPI)</title> | ||
539 | <para> | ||
540 | SPI is the "Serial Peripheral Interface", widely used with | ||
541 | embedded systems because it is a simple and efficient | ||
542 | interface: basically a multiplexed shift register. | ||
543 | Its three signal wires hold a clock (SCK, often in the range | ||
544 | of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and | ||
545 | a "Master In, Slave Out" (MISO) data line. | ||
546 | SPI is a full duplex protocol; for each bit shifted out the | ||
547 | MOSI line (one per clock) another is shifted in on the MISO line. | ||
548 | Those bits are assembled into words of various sizes on the | ||
549 | way to and from system memory. | ||
550 | An additional chipselect line is usually active-low (nCS); | ||
551 | four signals are normally used for each peripheral, plus | ||
552 | sometimes an interrupt. | ||
553 | </para> | ||
554 | <para> | ||
555 | The SPI bus facilities listed here provide a generalized | ||
556 | interface to declare SPI busses and devices, manage them | ||
557 | according to the standard Linux driver model, and perform | ||
558 | input/output operations. | ||
559 | At this time, only "master" side interfaces are supported, | ||
560 | where Linux talks to SPI peripherals and does not implement | ||
561 | such a peripheral itself. | ||
562 | (Interfaces to support implementing SPI slaves would | ||
563 | necessarily look different.) | ||
564 | </para> | ||
565 | <para> | ||
566 | The programming interface is structured around two kinds of driver, | ||
567 | and two kinds of device. | ||
568 | A "Controller Driver" abstracts the controller hardware, which may | ||
569 | be as simple as a set of GPIO pins or as complex as a pair of FIFOs | ||
570 | connected to dual DMA engines on the other side of the SPI shift | ||
571 | register (maximizing throughput). Such drivers bridge between | ||
572 | whatever bus they sit on (often the platform bus) and SPI, and | ||
573 | expose the SPI side of their device as a | ||
574 | <structname>struct spi_master</structname>. | ||
575 | SPI devices are children of that master, represented as a | ||
576 | <structname>struct spi_device</structname> and manufactured from | ||
577 | <structname>struct spi_board_info</structname> descriptors which | ||
578 | are usually provided by board-specific initialization code. | ||
579 | A <structname>struct spi_driver</structname> is called a | ||
580 | "Protocol Driver", and is bound to a spi_device using normal | ||
581 | driver model calls. | ||
582 | </para> | ||
583 | <para> | ||
584 | The I/O model is a set of queued messages. Protocol drivers | ||
585 | submit one or more <structname>struct spi_message</structname> | ||
586 | objects, which are processed and completed asynchronously. | ||
587 | (There are synchronous wrappers, however.) Messages are | ||
588 | built from one or more <structname>struct spi_transfer</structname> | ||
589 | objects, each of which wraps a full duplex SPI transfer. | ||
590 | A variety of protocol tweaking options are needed, because | ||
591 | different chips adopt very different policies for how they | ||
592 | use the bits transferred with SPI. | ||
593 | </para> | ||
594 | !Iinclude/linux/spi/spi.h | ||
595 | !Fdrivers/spi/spi.c spi_register_board_info | ||
596 | !Edrivers/spi/spi.c | ||
597 | </chapter> | ||
598 | |||
599 | <chapter id="i2c"> | ||
600 | <title>I<superscript>2</superscript>C and SMBus Subsystem</title> | ||
601 | |||
602 | <para> | ||
603 | I<superscript>2</superscript>C (or without fancy typography, "I2C") | ||
604 | is an acronym for the "Inter-IC" bus, a simple bus protocol which is | ||
605 | widely used where low data rate communications suffice. | ||
606 | Since it's also a licensed trademark, some vendors use another | ||
607 | name (such as "Two-Wire Interface", TWI) for the same bus. | ||
608 | I2C only needs two signals (SCL for clock, SDA for data), conserving | ||
609 | board real estate and minimizing signal quality issues. | ||
610 | Most I2C devices use seven bit addresses, and bus speeds of up | ||
611 | to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet | ||
612 | found wide use. | ||
613 | I2C is a multi-master bus; open drain signaling is used to | ||
614 | arbitrate between masters, as well as to handshake and to | ||
615 | synchronize clocks from slower clients. | ||
616 | </para> | ||
617 | |||
618 | <para> | ||
619 | The Linux I2C programming interfaces support only the master | ||
620 | side of bus interactions, not the slave side. | ||
621 | The programming interface is structured around two kinds of driver, | ||
622 | and two kinds of device. | ||
623 | An I2C "Adapter Driver" abstracts the controller hardware; it binds | ||
624 | to a physical device (perhaps a PCI device or platform_device) and | ||
625 | exposes a <structname>struct i2c_adapter</structname> representing | ||
626 | each I2C bus segment it manages. | ||
627 | On each I2C bus segment will be I2C devices represented by a | ||
628 | <structname>struct i2c_client</structname>. Those devices will | ||
629 | be bound to a <structname>struct i2c_driver</structname>, | ||
630 | which should follow the standard Linux driver model. | ||
631 | (At this writing, a legacy model is more widely used.) | ||
632 | There are functions to perform various I2C protocol operations; at | ||
633 | this writing all such functions are usable only from task context. | ||
634 | </para> | ||
635 | |||
636 | <para> | ||
637 | The System Management Bus (SMBus) is a sibling protocol. Most SMBus | ||
638 | systems are also I2C conformant. The electrical constraints are | ||
639 | tighter for SMBus, and it standardizes particular protocol messages | ||
640 | and idioms. Controllers that support I2C can also support most | ||
641 | SMBus operations, but SMBus controllers don't support all the protocol | ||
642 | options that an I2C controller will. | ||
643 | There are functions to perform various SMBus protocol operations, | ||
644 | either using I2C primitives or by issuing SMBus commands to | ||
645 | i2c_adapter devices which don't support those I2C operations. | ||
646 | </para> | ||
647 | |||
648 | !Iinclude/linux/i2c.h | ||
649 | !Fdrivers/i2c/i2c-boardinfo.c i2c_register_board_info | ||
650 | !Edrivers/i2c/i2c-core.c | ||
651 | </chapter> | ||
652 | |||
653 | <chapter id="clk"> | 276 | <chapter id="clk"> |
654 | <title>Clock Framework</title> | 277 | <title>Clock Framework</title> |
655 | 278 | ||
diff --git a/Documentation/PCI/PCIEBUS-HOWTO.txt b/Documentation/PCI/PCIEBUS-HOWTO.txt index 9a07e38631b0..6bd5f372adec 100644 --- a/Documentation/PCI/PCIEBUS-HOWTO.txt +++ b/Documentation/PCI/PCIEBUS-HOWTO.txt | |||
@@ -93,7 +93,7 @@ the PCI Express Port Bus driver from loading a service driver. | |||
93 | 93 | ||
94 | int pcie_port_service_register(struct pcie_port_service_driver *new) | 94 | int pcie_port_service_register(struct pcie_port_service_driver *new) |
95 | 95 | ||
96 | This API replaces the Linux Driver Model's pci_module_init API. A | 96 | This API replaces the Linux Driver Model's pci_register_driver API. A |
97 | service driver should always calls pcie_port_service_register at | 97 | service driver should always calls pcie_port_service_register at |
98 | module init. Note that after service driver being loaded, calls | 98 | module init. Note that after service driver being loaded, calls |
99 | such as pci_enable_device(dev) and pci_set_master(dev) are no longer | 99 | such as pci_enable_device(dev) and pci_set_master(dev) are no longer |
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt index d9e5d6f41b92..93feb8444489 100644 --- a/Documentation/cgroups/cgroups.txt +++ b/Documentation/cgroups/cgroups.txt | |||
@@ -252,10 +252,8 @@ cgroup file system directories. | |||
252 | When a task is moved from one cgroup to another, it gets a new | 252 | When a task is moved from one cgroup to another, it gets a new |
253 | css_set pointer - if there's an already existing css_set with the | 253 | css_set pointer - if there's an already existing css_set with the |
254 | desired collection of cgroups then that group is reused, else a new | 254 | desired collection of cgroups then that group is reused, else a new |
255 | css_set is allocated. Note that the current implementation uses a | 255 | css_set is allocated. The appropriate existing css_set is located by |
256 | linear search to locate an appropriate existing css_set, so isn't | 256 | looking into a hash table. |
257 | very efficient. A future version will use a hash table for better | ||
258 | performance. | ||
259 | 257 | ||
260 | To allow access from a cgroup to the css_sets (and hence tasks) | 258 | To allow access from a cgroup to the css_sets (and hence tasks) |
261 | that comprise it, a set of cg_cgroup_link objects form a lattice; | 259 | that comprise it, a set of cg_cgroup_link objects form a lattice; |
diff --git a/Documentation/cgroups/cpusets.txt b/Documentation/cgroups/cpusets.txt index 5c86c258c791..0611e9528c7c 100644 --- a/Documentation/cgroups/cpusets.txt +++ b/Documentation/cgroups/cpusets.txt | |||
@@ -142,7 +142,7 @@ into the rest of the kernel, none in performance critical paths: | |||
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 tasks cpuset. |
145 | - in sched.c migrate_all_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 tasks cpuset. |
@@ -175,6 +175,10 @@ files describing that cpuset: | |||
175 | - mem_exclusive flag: is memory placement exclusive? | 175 | - mem_exclusive flag: is memory placement exclusive? |
176 | - mem_hardwall flag: is memory allocation hardwalled | 176 | - mem_hardwall flag: is memory allocation hardwalled |
177 | - memory_pressure: measure of how much paging pressure in cpuset | 177 | - memory_pressure: measure of how much paging pressure in cpuset |
178 | - memory_spread_page flag: if set, spread page cache evenly on allowed nodes | ||
179 | - memory_spread_slab flag: if set, spread slab cache evenly on allowed nodes | ||
180 | - sched_load_balance flag: if set, load balance within CPUs on that cpuset | ||
181 | - sched_relax_domain_level: the searching range when migrating tasks | ||
178 | 182 | ||
179 | In addition, the root cpuset only has the following file: | 183 | In addition, the root cpuset only has the following file: |
180 | - memory_pressure_enabled flag: compute memory_pressure? | 184 | - memory_pressure_enabled flag: compute memory_pressure? |
@@ -252,7 +256,7 @@ is causing. | |||
252 | 256 | ||
253 | This is useful both on tightly managed systems running a wide mix of | 257 | This is useful both on tightly managed systems running a wide mix of |
254 | submitted jobs, which may choose to terminate or re-prioritize jobs that | 258 | submitted jobs, which may choose to terminate or re-prioritize jobs that |
255 | are trying to use more memory than allowed on the nodes assigned them, | 259 | are trying to use more memory than allowed on the nodes assigned to them, |
256 | and with tightly coupled, long running, massively parallel scientific | 260 | and with tightly coupled, long running, massively parallel scientific |
257 | computing jobs that will dramatically fail to meet required performance | 261 | computing jobs that will dramatically fail to meet required performance |
258 | goals if they start to use more memory than allowed to them. | 262 | goals if they start to use more memory than allowed to them. |
@@ -378,7 +382,7 @@ as cpusets and sched_setaffinity. | |||
378 | The algorithmic cost of load balancing and its impact on key shared | 382 | The algorithmic cost of load balancing and its impact on key shared |
379 | kernel data structures such as the task list increases more than | 383 | kernel data structures such as the task list increases more than |
380 | linearly with the number of CPUs being balanced. So the scheduler | 384 | linearly with the number of CPUs being balanced. So the scheduler |
381 | has support to partition the systems CPUs into a number of sched | 385 | has support to partition the systems CPUs into a number of sched |
382 | domains such that it only load balances within each sched domain. | 386 | domains such that it only load balances within each sched domain. |
383 | Each sched domain covers some subset of the CPUs in the system; | 387 | Each sched domain covers some subset of the CPUs in the system; |
384 | no two sched domains overlap; some CPUs might not be in any sched | 388 | no two sched domains overlap; some CPUs might not be in any sched |
@@ -485,17 +489,22 @@ of CPUs allowed to a cpuset having 'sched_load_balance' enabled. | |||
485 | The internal kernel cpuset to scheduler interface passes from the | 489 | The internal kernel cpuset to scheduler interface passes from the |
486 | cpuset code to the scheduler code a partition of the load balanced | 490 | cpuset code to the scheduler code a partition of the load balanced |
487 | CPUs in the system. This partition is a set of subsets (represented | 491 | CPUs in the system. This partition is a set of subsets (represented |
488 | as an array of cpumask_t) of CPUs, pairwise disjoint, that cover all | 492 | as an array of struct cpumask) of CPUs, pairwise disjoint, that cover |
489 | the CPUs that must be load balanced. | 493 | all the CPUs that must be load balanced. |
490 | 494 | ||
491 | Whenever the 'sched_load_balance' flag changes, or CPUs come or go | 495 | The cpuset code builds a new such partition and passes it to the |
492 | from a cpuset with this flag enabled, or a cpuset with this flag | 496 | scheduler sched domain setup code, to have the sched domains rebuilt |
493 | enabled is removed, the cpuset code builds a new such partition and | 497 | as necessary, whenever: |
494 | passes it to the scheduler sched domain setup code, to have the sched | 498 | - the 'sched_load_balance' flag of a cpuset with non-empty CPUs changes, |
495 | domains rebuilt as necessary. | 499 | - or CPUs come or go from a cpuset with this flag enabled, |
500 | - or 'sched_relax_domain_level' value of a cpuset with non-empty CPUs | ||
501 | and with this flag enabled changes, | ||
502 | - or a cpuset with non-empty CPUs and with this flag enabled is removed, | ||
503 | - or a cpu is offlined/onlined. | ||
496 | 504 | ||
497 | This partition exactly defines what sched domains the scheduler should | 505 | This partition exactly defines what sched domains the scheduler should |
498 | setup - one sched domain for each element (cpumask_t) in the partition. | 506 | setup - one sched domain for each element (struct cpumask) in the |
507 | partition. | ||
499 | 508 | ||
500 | The scheduler remembers the currently active sched domain partitions. | 509 | The scheduler remembers the currently active sched domain partitions. |
501 | When the scheduler routine partition_sched_domains() is invoked from | 510 | When the scheduler routine partition_sched_domains() is invoked from |
@@ -559,7 +568,7 @@ domain, the largest value among those is used. Be careful, if one | |||
559 | requests 0 and others are -1 then 0 is used. | 568 | requests 0 and others are -1 then 0 is used. |
560 | 569 | ||
561 | Note that modifying this file will have both good and bad effects, | 570 | Note that modifying this file will have both good and bad effects, |
562 | and whether it is acceptable or not will be depend on your situation. | 571 | and whether it is acceptable or not depends on your situation. |
563 | Don't modify this file if you are not sure. | 572 | Don't modify this file if you are not sure. |
564 | 573 | ||
565 | If your situation is: | 574 | If your situation is: |
@@ -600,19 +609,15 @@ to allocate a page of memory for that task. | |||
600 | 609 | ||
601 | If a cpuset has its 'cpus' modified, then each task in that cpuset | 610 | If a cpuset has its 'cpus' modified, then each task in that cpuset |
602 | will have its allowed CPU placement changed immediately. Similarly, | 611 | will have its allowed CPU placement changed immediately. Similarly, |
603 | if a tasks pid is written to a cpusets 'tasks' file, in either its | 612 | if a tasks pid is written to another cpusets 'tasks' file, then its |
604 | current cpuset or another cpuset, then its allowed CPU placement is | 613 | allowed CPU placement is changed immediately. If such a task had been |
605 | changed immediately. If such a task had been bound to some subset | 614 | bound to some subset of its cpuset using the sched_setaffinity() call, |
606 | of its cpuset using the sched_setaffinity() call, the task will be | 615 | the task will be allowed to run on any CPU allowed in its new cpuset, |
607 | allowed to run on any CPU allowed in its new cpuset, negating the | 616 | negating the effect of the prior sched_setaffinity() call. |
608 | affect of the prior sched_setaffinity() call. | ||
609 | 617 | ||
610 | In summary, the memory placement of a task whose cpuset is changed is | 618 | In summary, the memory placement of a task whose cpuset is changed is |
611 | updated by the kernel, on the next allocation of a page for that task, | 619 | updated by the kernel, on the next allocation of a page for that task, |
612 | but the processor placement is not updated, until that tasks pid is | 620 | and the processor placement is updated immediately. |
613 | rewritten to the 'tasks' file of its cpuset. This is done to avoid | ||
614 | impacting the scheduler code in the kernel with a check for changes | ||
615 | in a tasks processor placement. | ||
616 | 621 | ||
617 | Normally, once a page is allocated (given a physical page | 622 | Normally, once a page is allocated (given a physical page |
618 | of main memory) then that page stays on whatever node it | 623 | of main memory) then that page stays on whatever node it |
@@ -681,10 +686,14 @@ and then start a subshell 'sh' in that cpuset: | |||
681 | # The next line should display '/Charlie' | 686 | # The next line should display '/Charlie' |
682 | cat /proc/self/cpuset | 687 | cat /proc/self/cpuset |
683 | 688 | ||
684 | In the future, a C library interface to cpusets will likely be | 689 | There are ways to query or modify cpusets: |
685 | available. For now, the only way to query or modify cpusets is | 690 | - via the cpuset file system directly, using the various cd, mkdir, echo, |
686 | via the cpuset file system, using the various cd, mkdir, echo, cat, | 691 | cat, rmdir commands from the shell, or their equivalent from C. |
687 | rmdir commands from the shell, or their equivalent from C. | 692 | - via the C library libcpuset. |
693 | - via the C library libcgroup. | ||
694 | (http://sourceforge.net/proects/libcg/) | ||
695 | - via the python application cset. | ||
696 | (http://developer.novell.com/wiki/index.php/Cpuset) | ||
688 | 697 | ||
689 | The sched_setaffinity calls can also be done at the shell prompt using | 698 | The sched_setaffinity calls can also be done at the shell prompt using |
690 | SGI's runon or Robert Love's taskset. The mbind and set_mempolicy | 699 | SGI's runon or Robert Love's taskset. The mbind and set_mempolicy |
@@ -756,7 +765,7 @@ mount -t cpuset X /dev/cpuset | |||
756 | 765 | ||
757 | is equivalent to | 766 | is equivalent to |
758 | 767 | ||
759 | mount -t cgroup -ocpuset X /dev/cpuset | 768 | mount -t cgroup -ocpuset,noprefix X /dev/cpuset |
760 | echo "/sbin/cpuset_release_agent" > /dev/cpuset/release_agent | 769 | echo "/sbin/cpuset_release_agent" > /dev/cpuset/release_agent |
761 | 770 | ||
762 | 2.2 Adding/removing cpus | 771 | 2.2 Adding/removing cpus |
diff --git a/Documentation/driver-model/device.txt b/Documentation/driver-model/device.txt index a05ec50f8004..a7cbfff40d07 100644 --- a/Documentation/driver-model/device.txt +++ b/Documentation/driver-model/device.txt | |||
@@ -127,9 +127,11 @@ void unlock_device(struct device * dev); | |||
127 | Attributes | 127 | Attributes |
128 | ~~~~~~~~~~ | 128 | ~~~~~~~~~~ |
129 | struct device_attribute { | 129 | struct device_attribute { |
130 | struct attribute attr; | 130 | struct attribute attr; |
131 | ssize_t (*show)(struct device * dev, char * buf, size_t count, loff_t off); | 131 | ssize_t (*show)(struct device *dev, struct device_attribute *attr, |
132 | ssize_t (*store)(struct device * dev, const char * buf, size_t count, loff_t off); | 132 | char *buf); |
133 | ssize_t (*store)(struct device *dev, struct device_attribute *attr, | ||
134 | const char *buf, size_t count); | ||
133 | }; | 135 | }; |
134 | 136 | ||
135 | Attributes of devices can be exported via drivers using a simple | 137 | Attributes of devices can be exported via drivers using a simple |
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt index 9e9c348275a9..7e81e37c0b1e 100644 --- a/Documentation/filesystems/sysfs.txt +++ b/Documentation/filesystems/sysfs.txt | |||
@@ -2,8 +2,10 @@ | |||
2 | sysfs - _The_ filesystem for exporting kernel objects. | 2 | sysfs - _The_ filesystem for exporting kernel objects. |
3 | 3 | ||
4 | Patrick Mochel <mochel@osdl.org> | 4 | Patrick Mochel <mochel@osdl.org> |
5 | Mike Murphy <mamurph@cs.clemson.edu> | ||
5 | 6 | ||
6 | 10 January 2003 | 7 | Revised: 22 February 2009 |
8 | Original: 10 January 2003 | ||
7 | 9 | ||
8 | 10 | ||
9 | What it is: | 11 | What it is: |
@@ -64,12 +66,13 @@ An attribute definition is simply: | |||
64 | 66 | ||
65 | struct attribute { | 67 | struct attribute { |
66 | char * name; | 68 | char * name; |
69 | struct module *owner; | ||
67 | mode_t mode; | 70 | mode_t mode; |
68 | }; | 71 | }; |
69 | 72 | ||
70 | 73 | ||
71 | int sysfs_create_file(struct kobject * kobj, struct attribute * attr); | 74 | int sysfs_create_file(struct kobject * kobj, const struct attribute * attr); |
72 | void sysfs_remove_file(struct kobject * kobj, struct attribute * attr); | 75 | void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr); |
73 | 76 | ||
74 | 77 | ||
75 | A bare attribute contains no means to read or write the value of the | 78 | A bare attribute contains no means to read or write the value of the |
@@ -80,9 +83,11 @@ a specific object type. | |||
80 | For example, the driver model defines struct device_attribute like: | 83 | For example, the driver model defines struct device_attribute like: |
81 | 84 | ||
82 | struct device_attribute { | 85 | struct device_attribute { |
83 | struct attribute attr; | 86 | struct attribute attr; |
84 | ssize_t (*show)(struct device * dev, char * buf); | 87 | ssize_t (*show)(struct device *dev, struct device_attribute *attr, |
85 | ssize_t (*store)(struct device * dev, const char * buf); | 88 | char *buf); |
89 | ssize_t (*store)(struct device *dev, struct device_attribute *attr, | ||
90 | const char *buf, size_t count); | ||
86 | }; | 91 | }; |
87 | 92 | ||
88 | int device_create_file(struct device *, struct device_attribute *); | 93 | int device_create_file(struct device *, struct device_attribute *); |
@@ -90,12 +95,8 @@ void device_remove_file(struct device *, struct device_attribute *); | |||
90 | 95 | ||
91 | It also defines this helper for defining device attributes: | 96 | It also defines this helper for defining device attributes: |
92 | 97 | ||
93 | #define DEVICE_ATTR(_name, _mode, _show, _store) \ | 98 | #define DEVICE_ATTR(_name, _mode, _show, _store) \ |
94 | struct device_attribute dev_attr_##_name = { \ | 99 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) |
95 | .attr = {.name = __stringify(_name) , .mode = _mode }, \ | ||
96 | .show = _show, \ | ||
97 | .store = _store, \ | ||
98 | }; | ||
99 | 100 | ||
100 | For example, declaring | 101 | For example, declaring |
101 | 102 | ||
@@ -107,9 +108,9 @@ static struct device_attribute dev_attr_foo = { | |||
107 | .attr = { | 108 | .attr = { |
108 | .name = "foo", | 109 | .name = "foo", |
109 | .mode = S_IWUSR | S_IRUGO, | 110 | .mode = S_IWUSR | S_IRUGO, |
111 | .show = show_foo, | ||
112 | .store = store_foo, | ||
110 | }, | 113 | }, |
111 | .show = show_foo, | ||
112 | .store = store_foo, | ||
113 | }; | 114 | }; |
114 | 115 | ||
115 | 116 | ||
@@ -161,10 +162,12 @@ To read or write attributes, show() or store() methods must be | |||
161 | specified when declaring the attribute. The method types should be as | 162 | specified when declaring the attribute. The method types should be as |
162 | simple as those defined for device attributes: | 163 | simple as those defined for device attributes: |
163 | 164 | ||
164 | ssize_t (*show)(struct device * dev, char * buf); | 165 | ssize_t (*show)(struct device * dev, struct device_attribute * attr, |
165 | ssize_t (*store)(struct device * dev, const char * buf); | 166 | char * buf); |
167 | ssize_t (*store)(struct device * dev, struct device_attribute * attr, | ||
168 | const char * buf); | ||
166 | 169 | ||
167 | IOW, they should take only an object and a buffer as parameters. | 170 | IOW, they should take only an object, an attribute, and a buffer as parameters. |
168 | 171 | ||
169 | 172 | ||
170 | sysfs allocates a buffer of size (PAGE_SIZE) and passes it to the | 173 | sysfs allocates a buffer of size (PAGE_SIZE) and passes it to the |
@@ -299,14 +302,16 @@ The following interface layers currently exist in sysfs: | |||
299 | Structure: | 302 | Structure: |
300 | 303 | ||
301 | struct device_attribute { | 304 | struct device_attribute { |
302 | struct attribute attr; | 305 | struct attribute attr; |
303 | ssize_t (*show)(struct device * dev, char * buf); | 306 | ssize_t (*show)(struct device *dev, struct device_attribute *attr, |
304 | ssize_t (*store)(struct device * dev, const char * buf); | 307 | char *buf); |
308 | ssize_t (*store)(struct device *dev, struct device_attribute *attr, | ||
309 | const char *buf, size_t count); | ||
305 | }; | 310 | }; |
306 | 311 | ||
307 | Declaring: | 312 | Declaring: |
308 | 313 | ||
309 | DEVICE_ATTR(_name, _str, _mode, _show, _store); | 314 | DEVICE_ATTR(_name, _mode, _show, _store); |
310 | 315 | ||
311 | Creation/Removal: | 316 | Creation/Removal: |
312 | 317 | ||
@@ -342,7 +347,8 @@ Structure: | |||
342 | struct driver_attribute { | 347 | struct driver_attribute { |
343 | struct attribute attr; | 348 | struct attribute attr; |
344 | ssize_t (*show)(struct device_driver *, char * buf); | 349 | ssize_t (*show)(struct device_driver *, char * buf); |
345 | ssize_t (*store)(struct device_driver *, const char * buf); | 350 | ssize_t (*store)(struct device_driver *, const char * buf, |
351 | size_t count); | ||
346 | }; | 352 | }; |
347 | 353 | ||
348 | Declaring: | 354 | Declaring: |
diff --git a/Documentation/hwmon/hpfall.c b/Documentation/hwmon/hpfall.c new file mode 100644 index 000000000000..bbea1ccfd46a --- /dev/null +++ b/Documentation/hwmon/hpfall.c | |||
@@ -0,0 +1,101 @@ | |||
1 | /* Disk protection for HP machines. | ||
2 | * | ||
3 | * Copyright 2008 Eric Piel | ||
4 | * Copyright 2009 Pavel Machek <pavel@suse.cz> | ||
5 | * | ||
6 | * GPLv2. | ||
7 | */ | ||
8 | |||
9 | #include <stdio.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <unistd.h> | ||
12 | #include <fcntl.h> | ||
13 | #include <sys/stat.h> | ||
14 | #include <sys/types.h> | ||
15 | #include <string.h> | ||
16 | #include <stdint.h> | ||
17 | #include <errno.h> | ||
18 | #include <signal.h> | ||
19 | |||
20 | void write_int(char *path, int i) | ||
21 | { | ||
22 | char buf[1024]; | ||
23 | int fd = open(path, O_RDWR); | ||
24 | if (fd < 0) { | ||
25 | perror("open"); | ||
26 | exit(1); | ||
27 | } | ||
28 | sprintf(buf, "%d", i); | ||
29 | if (write(fd, buf, strlen(buf)) != strlen(buf)) { | ||
30 | perror("write"); | ||
31 | exit(1); | ||
32 | } | ||
33 | close(fd); | ||
34 | } | ||
35 | |||
36 | void set_led(int on) | ||
37 | { | ||
38 | write_int("/sys/class/leds/hp::hddprotect/brightness", on); | ||
39 | } | ||
40 | |||
41 | void protect(int seconds) | ||
42 | { | ||
43 | write_int("/sys/block/sda/device/unload_heads", seconds*1000); | ||
44 | } | ||
45 | |||
46 | int on_ac(void) | ||
47 | { | ||
48 | // /sys/class/power_supply/AC0/online | ||
49 | } | ||
50 | |||
51 | int lid_open(void) | ||
52 | { | ||
53 | // /proc/acpi/button/lid/LID/state | ||
54 | } | ||
55 | |||
56 | void ignore_me(void) | ||
57 | { | ||
58 | protect(0); | ||
59 | set_led(0); | ||
60 | |||
61 | } | ||
62 | |||
63 | int main(int argc, char* argv[]) | ||
64 | { | ||
65 | int fd, ret; | ||
66 | |||
67 | fd = open("/dev/freefall", O_RDONLY); | ||
68 | if (fd < 0) { | ||
69 | perror("open"); | ||
70 | return EXIT_FAILURE; | ||
71 | } | ||
72 | |||
73 | signal(SIGALRM, ignore_me); | ||
74 | |||
75 | for (;;) { | ||
76 | unsigned char count; | ||
77 | |||
78 | ret = read(fd, &count, sizeof(count)); | ||
79 | alarm(0); | ||
80 | if ((ret == -1) && (errno == EINTR)) { | ||
81 | /* Alarm expired, time to unpark the heads */ | ||
82 | continue; | ||
83 | } | ||
84 | |||
85 | if (ret != sizeof(count)) { | ||
86 | perror("read"); | ||
87 | break; | ||
88 | } | ||
89 | |||
90 | protect(21); | ||
91 | set_led(1); | ||
92 | if (1 || on_ac() || lid_open()) { | ||
93 | alarm(2); | ||
94 | } else { | ||
95 | alarm(20); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | close(fd); | ||
100 | return EXIT_SUCCESS; | ||
101 | } | ||
diff --git a/Documentation/hwmon/lis3lv02d b/Documentation/hwmon/lis3lv02d index 0fcfc4a7ccdc..287f8c902656 100644 --- a/Documentation/hwmon/lis3lv02d +++ b/Documentation/hwmon/lis3lv02d | |||
@@ -33,6 +33,14 @@ rate - reports the sampling rate of the accelerometer device in HZ | |||
33 | This driver also provides an absolute input class device, allowing | 33 | This driver also provides an absolute input class device, allowing |
34 | the laptop to act as a pinball machine-esque joystick. | 34 | the laptop to act as a pinball machine-esque joystick. |
35 | 35 | ||
36 | Another feature of the driver is misc device called "freefall" that | ||
37 | acts similar to /dev/rtc and reacts on free-fall interrupts received | ||
38 | from the device. It supports blocking operations, poll/select and | ||
39 | fasync operation modes. You must read 1 bytes from the device. The | ||
40 | result is number of free-fall interrupts since the last successful | ||
41 | read (or 255 if number of interrupts would not fit). | ||
42 | |||
43 | |||
36 | Axes orientation | 44 | Axes orientation |
37 | ---------------- | 45 | ---------------- |
38 | 46 | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index b182626739ea..f6d5d5b9b2b1 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -114,7 +114,7 @@ In addition, the following text indicates that the option: | |||
114 | Parameters denoted with BOOT are actually interpreted by the boot | 114 | Parameters denoted with BOOT are actually interpreted by the boot |
115 | loader, and have no meaning to the kernel directly. | 115 | loader, and have no meaning to the kernel directly. |
116 | Do not modify the syntax of boot loader parameters without extreme | 116 | Do not modify the syntax of boot loader parameters without extreme |
117 | need or coordination with <Documentation/x86/i386/boot.txt>. | 117 | need or coordination with <Documentation/x86/boot.txt>. |
118 | 118 | ||
119 | There are also arch-specific kernel-parameters not documented here. | 119 | There are also arch-specific kernel-parameters not documented here. |
120 | See for example <Documentation/x86/x86_64/boot-options.txt>. | 120 | See for example <Documentation/x86/x86_64/boot-options.txt>. |
@@ -134,7 +134,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
134 | 134 | ||
135 | acpi= [HW,ACPI,X86-64,i386] | 135 | acpi= [HW,ACPI,X86-64,i386] |
136 | Advanced Configuration and Power Interface | 136 | Advanced Configuration and Power Interface |
137 | Format: { force | off | ht | strict | noirq } | 137 | Format: { force | off | ht | strict | noirq | rsdt } |
138 | force -- enable ACPI if default was off | 138 | force -- enable ACPI if default was off |
139 | off -- disable ACPI if default was on | 139 | off -- disable ACPI if default was on |
140 | noirq -- do not use ACPI for IRQ routing | 140 | noirq -- do not use ACPI for IRQ routing |
@@ -2449,7 +2449,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
2449 | See Documentation/fb/modedb.txt. | 2449 | See Documentation/fb/modedb.txt. |
2450 | 2450 | ||
2451 | vga= [BOOT,X86-32] Select a particular video mode | 2451 | vga= [BOOT,X86-32] Select a particular video mode |
2452 | See Documentation/x86/i386/boot.txt and | 2452 | See Documentation/x86/boot.txt and |
2453 | Documentation/svga.txt. | 2453 | Documentation/svga.txt. |
2454 | Use vga=ask for menu. | 2454 | Use vga=ask for menu. |
2455 | This is actually a boot loader parameter; the value is | 2455 | This is actually a boot loader parameter; the value is |
diff --git a/Documentation/tracers/mmiotrace.txt b/Documentation/tracers/mmiotrace.txt index cde23b4a12a1..5731c67abc55 100644 --- a/Documentation/tracers/mmiotrace.txt +++ b/Documentation/tracers/mmiotrace.txt | |||
@@ -78,12 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If | |||
78 | events were lost, the trace is incomplete. You should enlarge the buffers and | 78 | events were lost, the trace is incomplete. You should enlarge the buffers and |
79 | try again. Buffers are enlarged by first seeing how large the current buffers | 79 | try again. Buffers are enlarged by first seeing how large the current buffers |
80 | are: | 80 | are: |
81 | $ cat /debug/tracing/trace_entries | 81 | $ cat /debug/tracing/buffer_size_kb |
82 | gives you a number. Approximately double this number and write it back, for | 82 | gives you a number. Approximately double this number and write it back, for |
83 | instance: | 83 | instance: |
84 | $ echo 0 > /debug/tracing/tracing_enabled | 84 | $ echo 128000 > /debug/tracing/buffer_size_kb |
85 | $ echo 128000 > /debug/tracing/trace_entries | ||
86 | $ echo 1 > /debug/tracing/tracing_enabled | ||
87 | Then start again from the top. | 85 | Then start again from the top. |
88 | 86 | ||
89 | If you are doing a trace for a driver project, e.g. Nouveau, you should also | 87 | If you are doing a trace for a driver project, e.g. Nouveau, you should also |
diff --git a/MAINTAINERS b/MAINTAINERS index db65b4e6d132..59fd2d1d94a7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -692,6 +692,13 @@ M: kernel@wantstofly.org | |||
692 | L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) | 692 | L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) |
693 | S: Maintained | 693 | S: Maintained |
694 | 694 | ||
695 | ARM/NUVOTON W90X900 ARM ARCHITECTURE | ||
696 | P: Wan ZongShun | ||
697 | M: mcuos.com@gmail.com | ||
698 | L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) | ||
699 | W: http://www.mcuos.com | ||
700 | S: Maintained | ||
701 | |||
695 | ARPD SUPPORT | 702 | ARPD SUPPORT |
696 | P: Jonathan Layes | 703 | P: Jonathan Layes |
697 | L: netdev@vger.kernel.org | 704 | L: netdev@vger.kernel.org |
@@ -1905,10 +1912,10 @@ W: http://gigaset307x.sourceforge.net/ | |||
1905 | S: Maintained | 1912 | S: Maintained |
1906 | 1913 | ||
1907 | HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER | 1914 | HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER |
1908 | P: Robert Love | 1915 | P: Frank Seidel |
1909 | M: rlove@rlove.org | 1916 | M: frank@f-seidel.de |
1910 | M: linux-kernel@vger.kernel.org | 1917 | L: lm-sensors@lm-sensors.org |
1911 | W: http://www.kernel.org/pub/linux/kernel/people/rml/hdaps/ | 1918 | W: http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/ |
1912 | S: Maintained | 1919 | S: Maintained |
1913 | 1920 | ||
1914 | GSPCA FINEPIX SUBDRIVER | 1921 | GSPCA FINEPIX SUBDRIVER |
@@ -2001,7 +2008,7 @@ S: Maintained | |||
2001 | 2008 | ||
2002 | HIBERNATION (aka Software Suspend, aka swsusp) | 2009 | HIBERNATION (aka Software Suspend, aka swsusp) |
2003 | P: Pavel Machek | 2010 | P: Pavel Machek |
2004 | M: pavel@suse.cz | 2011 | M: pavel@ucw.cz |
2005 | P: Rafael J. Wysocki | 2012 | P: Rafael J. Wysocki |
2006 | M: rjw@sisk.pl | 2013 | M: rjw@sisk.pl |
2007 | L: linux-pm@lists.linux-foundation.org | 2014 | L: linux-pm@lists.linux-foundation.org |
@@ -3327,8 +3334,8 @@ P: Jeremy Fitzhardinge | |||
3327 | M: jeremy@xensource.com | 3334 | M: jeremy@xensource.com |
3328 | P: Chris Wright | 3335 | P: Chris Wright |
3329 | M: chrisw@sous-sol.org | 3336 | M: chrisw@sous-sol.org |
3330 | P: Zachary Amsden | 3337 | P: Alok Kataria |
3331 | M: zach@vmware.com | 3338 | M: akataria@vmware.com |
3332 | P: Rusty Russell | 3339 | P: Rusty Russell |
3333 | M: rusty@rustcorp.com.au | 3340 | M: rusty@rustcorp.com.au |
3334 | L: virtualization@lists.osdl.org | 3341 | L: virtualization@lists.osdl.org |
@@ -4172,7 +4179,7 @@ SUSPEND TO RAM | |||
4172 | P: Len Brown | 4179 | P: Len Brown |
4173 | M: len.brown@intel.com | 4180 | M: len.brown@intel.com |
4174 | P: Pavel Machek | 4181 | P: Pavel Machek |
4175 | M: pavel@suse.cz | 4182 | M: pavel@ucw.cz |
4176 | P: Rafael J. Wysocki | 4183 | P: Rafael J. Wysocki |
4177 | M: rjw@sisk.pl | 4184 | M: rjw@sisk.pl |
4178 | L: linux-pm@lists.linux-foundation.org | 4185 | L: linux-pm@lists.linux-foundation.org |
@@ -4924,11 +4931,11 @@ L: zd1211-devs@lists.sourceforge.net (subscribers-only) | |||
4924 | S: Maintained | 4931 | S: Maintained |
4925 | 4932 | ||
4926 | ZR36067 VIDEO FOR LINUX DRIVER | 4933 | ZR36067 VIDEO FOR LINUX DRIVER |
4927 | P: Ronald Bultje | ||
4928 | M: rbultje@ronald.bitfreak.net | ||
4929 | L: mjpeg-users@lists.sourceforge.net | 4934 | L: mjpeg-users@lists.sourceforge.net |
4935 | L: linux-media@vger.kernel.org | ||
4930 | W: http://mjpeg.sourceforge.net/driver-zoran/ | 4936 | W: http://mjpeg.sourceforge.net/driver-zoran/ |
4931 | S: Maintained | 4937 | T: Mercurial http://linuxtv.org/hg/v4l-dvb |
4938 | S: Odd Fixes | ||
4932 | 4939 | ||
4933 | ZS DECSTATION Z85C30 SERIAL DRIVER | 4940 | ZS DECSTATION Z85C30 SERIAL DRIVER |
4934 | P: Maciej W. Rozycki | 4941 | P: Maciej W. Rozycki |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 29 | 3 | SUBLEVEL = 29 |
4 | EXTRAVERSION = -rc5 | 4 | EXTRAVERSION = -rc6 |
5 | NAME = Erotic Pickled Herring | 5 | NAME = Erotic Pickled Herring |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
@@ -389,6 +389,7 @@ PHONY += outputmakefile | |||
389 | # output directory. | 389 | # output directory. |
390 | outputmakefile: | 390 | outputmakefile: |
391 | ifneq ($(KBUILD_SRC),) | 391 | ifneq ($(KBUILD_SRC),) |
392 | $(Q)ln -fsn $(srctree) source | ||
392 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ | 393 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ |
393 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) | 394 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) |
394 | endif | 395 | endif |
@@ -947,7 +948,6 @@ ifneq ($(KBUILD_SRC),) | |||
947 | mkdir -p include2; \ | 948 | mkdir -p include2; \ |
948 | ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \ | 949 | ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \ |
949 | fi | 950 | fi |
950 | ln -fsn $(srctree) source | ||
951 | endif | 951 | endif |
952 | 952 | ||
953 | # prepare2 creates a makefile if using a separate output directory | 953 | # prepare2 creates a makefile if using a separate output directory |
@@ -188,7 +188,7 @@ CONFIGURING the kernel: | |||
188 | values to random values. | 188 | values to random values. |
189 | 189 | ||
190 | You can find more information on using the Linux kernel config tools | 190 | You can find more information on using the Linux kernel config tools |
191 | in Documentation/kbuild/make-configs.txt. | 191 | in Documentation/kbuild/kconfig.txt. |
192 | 192 | ||
193 | NOTES on "make config": | 193 | NOTES on "make config": |
194 | - having unnecessary drivers will make the kernel bigger, and can | 194 | - having unnecessary drivers will make the kernel bigger, and can |
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index f238370c907d..8d0097f10208 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c | |||
@@ -93,8 +93,8 @@ common_shutdown_1(void *generic_ptr) | |||
93 | if (cpuid != boot_cpuid) { | 93 | if (cpuid != boot_cpuid) { |
94 | flags |= 0x00040000UL; /* "remain halted" */ | 94 | flags |= 0x00040000UL; /* "remain halted" */ |
95 | *pflags = flags; | 95 | *pflags = flags; |
96 | cpu_clear(cpuid, cpu_present_map); | 96 | set_cpu_present(cpuid, false); |
97 | cpu_clear(cpuid, cpu_possible_map); | 97 | set_cpu_possible(cpuid, false); |
98 | halt(); | 98 | halt(); |
99 | } | 99 | } |
100 | #endif | 100 | #endif |
@@ -120,8 +120,8 @@ common_shutdown_1(void *generic_ptr) | |||
120 | 120 | ||
121 | #ifdef CONFIG_SMP | 121 | #ifdef CONFIG_SMP |
122 | /* Wait for the secondaries to halt. */ | 122 | /* Wait for the secondaries to halt. */ |
123 | cpu_clear(boot_cpuid, cpu_present_map); | 123 | set_cpu_present(boot_cpuid, false); |
124 | cpu_clear(boot_cpuid, cpu_possible_map); | 124 | set_cpu_possible(boot_cpuid, false); |
125 | while (cpus_weight(cpu_present_map)) | 125 | while (cpus_weight(cpu_present_map)) |
126 | barrier(); | 126 | barrier(); |
127 | #endif | 127 | #endif |
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index 00f1dc3dfd5f..b1fe5674c3a1 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c | |||
@@ -120,12 +120,12 @@ void __cpuinit | |||
120 | smp_callin(void) | 120 | smp_callin(void) |
121 | { | 121 | { |
122 | int cpuid = hard_smp_processor_id(); | 122 | int cpuid = hard_smp_processor_id(); |
123 | cpumask_t mask = cpu_online_map; | ||
124 | 123 | ||
125 | if (cpu_test_and_set(cpuid, mask)) { | 124 | if (cpu_online(cpuid)) { |
126 | printk("??, cpu 0x%x already present??\n", cpuid); | 125 | printk("??, cpu 0x%x already present??\n", cpuid); |
127 | BUG(); | 126 | BUG(); |
128 | } | 127 | } |
128 | set_cpu_online(cpuid, true); | ||
129 | 129 | ||
130 | /* Turn on machine checks. */ | 130 | /* Turn on machine checks. */ |
131 | wrmces(7); | 131 | wrmces(7); |
@@ -436,8 +436,8 @@ setup_smp(void) | |||
436 | ((char *)cpubase + i*hwrpb->processor_size); | 436 | ((char *)cpubase + i*hwrpb->processor_size); |
437 | if ((cpu->flags & 0x1cc) == 0x1cc) { | 437 | if ((cpu->flags & 0x1cc) == 0x1cc) { |
438 | smp_num_probed++; | 438 | smp_num_probed++; |
439 | cpu_set(i, cpu_possible_map); | 439 | set_cpu_possible(i, true); |
440 | cpu_set(i, cpu_present_map); | 440 | set_cpu_present(i, true); |
441 | cpu->pal_revision = boot_cpu_palrev; | 441 | cpu->pal_revision = boot_cpu_palrev; |
442 | } | 442 | } |
443 | 443 | ||
@@ -470,8 +470,8 @@ smp_prepare_cpus(unsigned int max_cpus) | |||
470 | 470 | ||
471 | /* Nothing to do on a UP box, or when told not to. */ | 471 | /* Nothing to do on a UP box, or when told not to. */ |
472 | if (smp_num_probed == 1 || max_cpus == 0) { | 472 | if (smp_num_probed == 1 || max_cpus == 0) { |
473 | cpu_possible_map = cpumask_of_cpu(boot_cpuid); | 473 | init_cpu_possible(cpumask_of(boot_cpuid)); |
474 | cpu_present_map = cpumask_of_cpu(boot_cpuid); | 474 | init_cpu_present(cpumask_of(boot_cpuid)); |
475 | printk(KERN_INFO "SMP mode deactivated.\n"); | 475 | printk(KERN_INFO "SMP mode deactivated.\n"); |
476 | return; | 476 | return; |
477 | } | 477 | } |
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260ek_defconfig index e0ee7060f9aa..98e2f3de4bc5 100644 --- a/arch/arm/configs/at91sam9260ek_defconfig +++ b/arch/arm/configs/at91sam9260ek_defconfig | |||
@@ -608,7 +608,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y | |||
608 | # Watchdog Device Drivers | 608 | # Watchdog Device Drivers |
609 | # | 609 | # |
610 | # CONFIG_SOFT_WATCHDOG is not set | 610 | # CONFIG_SOFT_WATCHDOG is not set |
611 | CONFIG_AT91SAM9_WATCHDOG=y | 611 | CONFIG_AT91SAM9X_WATCHDOG=y |
612 | 612 | ||
613 | # | 613 | # |
614 | # USB-based Watchdog Cards | 614 | # USB-based Watchdog Cards |
diff --git a/arch/arm/configs/at91sam9261ek_defconfig b/arch/arm/configs/at91sam9261ek_defconfig index 01d1ef97d8be..149456142392 100644 --- a/arch/arm/configs/at91sam9261ek_defconfig +++ b/arch/arm/configs/at91sam9261ek_defconfig | |||
@@ -700,7 +700,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y | |||
700 | # Watchdog Device Drivers | 700 | # Watchdog Device Drivers |
701 | # | 701 | # |
702 | # CONFIG_SOFT_WATCHDOG is not set | 702 | # CONFIG_SOFT_WATCHDOG is not set |
703 | CONFIG_AT91SAM9_WATCHDOG=y | 703 | CONFIG_AT91SAM9X_WATCHDOG=y |
704 | 704 | ||
705 | # | 705 | # |
706 | # USB-based Watchdog Cards | 706 | # USB-based Watchdog Cards |
diff --git a/arch/arm/configs/at91sam9263ek_defconfig b/arch/arm/configs/at91sam9263ek_defconfig index 036a126725c1..21599f3c6275 100644 --- a/arch/arm/configs/at91sam9263ek_defconfig +++ b/arch/arm/configs/at91sam9263ek_defconfig | |||
@@ -710,7 +710,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y | |||
710 | # Watchdog Device Drivers | 710 | # Watchdog Device Drivers |
711 | # | 711 | # |
712 | # CONFIG_SOFT_WATCHDOG is not set | 712 | # CONFIG_SOFT_WATCHDOG is not set |
713 | CONFIG_AT91SAM9_WATCHDOG=y | 713 | CONFIG_AT91SAM9X_WATCHDOG=y |
714 | 714 | ||
715 | # | 715 | # |
716 | # USB-based Watchdog Cards | 716 | # USB-based Watchdog Cards |
diff --git a/arch/arm/configs/at91sam9rlek_defconfig b/arch/arm/configs/at91sam9rlek_defconfig index 237a2a6a8517..e2df81a3e804 100644 --- a/arch/arm/configs/at91sam9rlek_defconfig +++ b/arch/arm/configs/at91sam9rlek_defconfig | |||
@@ -606,7 +606,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y | |||
606 | # Watchdog Device Drivers | 606 | # Watchdog Device Drivers |
607 | # | 607 | # |
608 | # CONFIG_SOFT_WATCHDOG is not set | 608 | # CONFIG_SOFT_WATCHDOG is not set |
609 | CONFIG_AT91SAM9_WATCHDOG=y | 609 | CONFIG_AT91SAM9X_WATCHDOG=y |
610 | 610 | ||
611 | # | 611 | # |
612 | # Sonics Silicon Backplane | 612 | # Sonics Silicon Backplane |
diff --git a/arch/arm/configs/qil-a9260_defconfig b/arch/arm/configs/qil-a9260_defconfig index cd1d717903ac..9b32d0eb89ba 100644 --- a/arch/arm/configs/qil-a9260_defconfig +++ b/arch/arm/configs/qil-a9260_defconfig | |||
@@ -727,7 +727,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y | |||
727 | # Watchdog Device Drivers | 727 | # Watchdog Device Drivers |
728 | # | 728 | # |
729 | # CONFIG_SOFT_WATCHDOG is not set | 729 | # CONFIG_SOFT_WATCHDOG is not set |
730 | # CONFIG_AT91SAM9_WATCHDOG is not set | 730 | # CONFIG_AT91SAM9X_WATCHDOG is not set |
731 | 731 | ||
732 | # | 732 | # |
733 | # USB-based Watchdog Cards | 733 | # USB-based Watchdog Cards |
diff --git a/arch/arm/kernel/elf.c b/arch/arm/kernel/elf.c index 84849098c8e8..d4a0da1e48f4 100644 --- a/arch/arm/kernel/elf.c +++ b/arch/arm/kernel/elf.c | |||
@@ -74,9 +74,9 @@ EXPORT_SYMBOL(elf_set_personality); | |||
74 | */ | 74 | */ |
75 | int arm_elf_read_implies_exec(const struct elf32_hdr *x, int executable_stack) | 75 | int arm_elf_read_implies_exec(const struct elf32_hdr *x, int executable_stack) |
76 | { | 76 | { |
77 | if (executable_stack != EXSTACK_ENABLE_X) | 77 | if (executable_stack != EXSTACK_DISABLE_X) |
78 | return 1; | 78 | return 1; |
79 | if (cpu_architecture() <= CPU_ARCH_ARMv6) | 79 | if (cpu_architecture() < CPU_ARCH_ARMv6) |
80 | return 1; | 80 | return 1; |
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c index 9eca2209cde6..412aa49ad2fb 100644 --- a/arch/arm/mach-at91/at91cap9_devices.c +++ b/arch/arm/mach-at91/at91cap9_devices.c | |||
@@ -697,7 +697,7 @@ static void __init at91_add_device_rtt(void) | |||
697 | * Watchdog | 697 | * Watchdog |
698 | * -------------------------------------------------------------------- */ | 698 | * -------------------------------------------------------------------- */ |
699 | 699 | ||
700 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | 700 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
701 | static struct platform_device at91cap9_wdt_device = { | 701 | static struct platform_device at91cap9_wdt_device = { |
702 | .name = "at91_wdt", | 702 | .name = "at91_wdt", |
703 | .id = -1, | 703 | .id = -1, |
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index fdde1ea21b07..d74c9ac007e7 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -643,7 +643,7 @@ static void __init at91_add_device_rtt(void) | |||
643 | * Watchdog | 643 | * Watchdog |
644 | * -------------------------------------------------------------------- */ | 644 | * -------------------------------------------------------------------- */ |
645 | 645 | ||
646 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | 646 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
647 | static struct platform_device at91sam9260_wdt_device = { | 647 | static struct platform_device at91sam9260_wdt_device = { |
648 | .name = "at91_wdt", | 648 | .name = "at91_wdt", |
649 | .id = -1, | 649 | .id = -1, |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index 17289756f80f..59fc48311fb0 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -621,7 +621,7 @@ static void __init at91_add_device_rtt(void) | |||
621 | * Watchdog | 621 | * Watchdog |
622 | * -------------------------------------------------------------------- */ | 622 | * -------------------------------------------------------------------- */ |
623 | 623 | ||
624 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | 624 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
625 | static struct platform_device at91sam9261_wdt_device = { | 625 | static struct platform_device at91sam9261_wdt_device = { |
626 | .name = "at91_wdt", | 626 | .name = "at91_wdt", |
627 | .id = -1, | 627 | .id = -1, |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index b753cb879d8e..134af97ff340 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -854,7 +854,7 @@ static void __init at91_add_device_rtt(void) | |||
854 | * Watchdog | 854 | * Watchdog |
855 | * -------------------------------------------------------------------- */ | 855 | * -------------------------------------------------------------------- */ |
856 | 856 | ||
857 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | 857 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
858 | static struct platform_device at91sam9263_wdt_device = { | 858 | static struct platform_device at91sam9263_wdt_device = { |
859 | .name = "at91_wdt", | 859 | .name = "at91_wdt", |
860 | .id = -1, | 860 | .id = -1, |
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index 145324f4ec56..728186515cdf 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -609,7 +609,7 @@ static void __init at91_add_device_rtt(void) | |||
609 | * Watchdog | 609 | * Watchdog |
610 | * -------------------------------------------------------------------- */ | 610 | * -------------------------------------------------------------------- */ |
611 | 611 | ||
612 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | 612 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
613 | static struct platform_device at91sam9rl_wdt_device = { | 613 | static struct platform_device at91sam9rl_wdt_device = { |
614 | .name = "at91_wdt", | 614 | .name = "at91_wdt", |
615 | .id = -1, | 615 | .id = -1, |
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c index 9b0447c3d59b..2f7d4977dce9 100644 --- a/arch/arm/mach-at91/gpio.c +++ b/arch/arm/mach-at91/gpio.c | |||
@@ -490,7 +490,8 @@ postcore_initcall(at91_gpio_debugfs_init); | |||
490 | 490 | ||
491 | /*--------------------------------------------------------------------------*/ | 491 | /*--------------------------------------------------------------------------*/ |
492 | 492 | ||
493 | /* This lock class tells lockdep that GPIO irqs are in a different | 493 | /* |
494 | * This lock class tells lockdep that GPIO irqs are in a different | ||
494 | * category than their parents, so it won't report false recursion. | 495 | * category than their parents, so it won't report false recursion. |
495 | */ | 496 | */ |
496 | static struct lock_class_key gpio_lock_class; | 497 | static struct lock_class_key gpio_lock_class; |
@@ -509,9 +510,6 @@ void __init at91_gpio_irq_setup(void) | |||
509 | unsigned id = this->id; | 510 | unsigned id = this->id; |
510 | unsigned i; | 511 | unsigned i; |
511 | 512 | ||
512 | /* enable PIO controller's clock */ | ||
513 | clk_enable(this->clock); | ||
514 | |||
515 | __raw_writel(~0, this->regbase + PIO_IDR); | 513 | __raw_writel(~0, this->regbase + PIO_IDR); |
516 | 514 | ||
517 | for (i = 0, pin = this->chipbase; i < 32; i++, pin++) { | 515 | for (i = 0, pin = this->chipbase; i < 32; i++, pin++) { |
@@ -556,7 +554,14 @@ void __init at91_gpio_init(struct at91_gpio_bank *data, int nr_banks) | |||
556 | data->chipbase = PIN_BASE + i * 32; | 554 | data->chipbase = PIN_BASE + i * 32; |
557 | data->regbase = data->offset + (void __iomem *)AT91_VA_BASE_SYS; | 555 | data->regbase = data->offset + (void __iomem *)AT91_VA_BASE_SYS; |
558 | 556 | ||
559 | /* AT91SAM9263_ID_PIOCDE groups PIOC, PIOD, PIOE */ | 557 | /* enable PIO controller's clock */ |
558 | clk_enable(data->clock); | ||
559 | |||
560 | /* | ||
561 | * Some processors share peripheral ID between multiple GPIO banks. | ||
562 | * SAM9263 (PIOC, PIOD, PIOE) | ||
563 | * CAP9 (PIOA, PIOB, PIOC, PIOD) | ||
564 | */ | ||
560 | if (last && last->id == data->id) | 565 | if (last && last->id == data->id) |
561 | last->next = data; | 566 | last->next = data; |
562 | } | 567 | } |
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h index fb51f0e0a83f..0b3ae21b4565 100644 --- a/arch/arm/mach-at91/include/mach/board.h +++ b/arch/arm/mach-at91/include/mach/board.h | |||
@@ -93,6 +93,7 @@ struct atmel_nand_data { | |||
93 | u8 enable_pin; /* chip enable */ | 93 | u8 enable_pin; /* chip enable */ |
94 | u8 det_pin; /* card detect */ | 94 | u8 det_pin; /* card detect */ |
95 | u8 rdy_pin; /* ready/busy */ | 95 | u8 rdy_pin; /* ready/busy */ |
96 | u8 rdy_pin_active_low; /* rdy_pin value is inverted */ | ||
96 | u8 ale; /* address line number connected to ALE */ | 97 | u8 ale; /* address line number connected to ALE */ |
97 | u8 cle; /* address line number connected to CLE */ | 98 | u8 cle; /* address line number connected to CLE */ |
98 | u8 bus_width_16; /* buswidth is 16 bit */ | 99 | u8 bus_width_16; /* buswidth is 16 bit */ |
diff --git a/arch/arm/mach-ep93xx/include/mach/gesbc9312.h b/arch/arm/mach-ep93xx/include/mach/gesbc9312.h deleted file mode 100644 index 21fe2b922aa5..000000000000 --- a/arch/arm/mach-ep93xx/include/mach/gesbc9312.h +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ep93xx/include/mach/gesbc9312.h | ||
3 | */ | ||
diff --git a/arch/arm/mach-ep93xx/include/mach/hardware.h b/arch/arm/mach-ep93xx/include/mach/hardware.h index 529807d182bf..2866297310b7 100644 --- a/arch/arm/mach-ep93xx/include/mach/hardware.h +++ b/arch/arm/mach-ep93xx/include/mach/hardware.h | |||
@@ -10,7 +10,6 @@ | |||
10 | 10 | ||
11 | #include "platform.h" | 11 | #include "platform.h" |
12 | 12 | ||
13 | #include "gesbc9312.h" | ||
14 | #include "ts72xx.h" | 13 | #include "ts72xx.h" |
15 | 14 | ||
16 | #endif | 15 | #endif |
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c index efb86b700276..06083b23bb44 100644 --- a/arch/arm/mach-kirkwood/irq.c +++ b/arch/arm/mach-kirkwood/irq.c | |||
@@ -42,7 +42,7 @@ void __init kirkwood_init_irq(void) | |||
42 | writel(0, GPIO_EDGE_CAUSE(32)); | 42 | writel(0, GPIO_EDGE_CAUSE(32)); |
43 | 43 | ||
44 | for (i = IRQ_KIRKWOOD_GPIO_START; i < NR_IRQS; i++) { | 44 | for (i = IRQ_KIRKWOOD_GPIO_START; i < NR_IRQS; i++) { |
45 | set_irq_chip(i, &orion_gpio_irq_level_chip); | 45 | set_irq_chip(i, &orion_gpio_irq_chip); |
46 | set_irq_handler(i, handle_level_irq); | 46 | set_irq_handler(i, handle_level_irq); |
47 | irq_desc[i].status |= IRQ_LEVEL; | 47 | irq_desc[i].status |= IRQ_LEVEL; |
48 | set_irq_flags(i, IRQF_VALID); | 48 | set_irq_flags(i, IRQF_VALID); |
diff --git a/arch/arm/mach-mv78xx0/irq.c b/arch/arm/mach-mv78xx0/irq.c index e273418797b4..30b7e4bcdbc7 100644 --- a/arch/arm/mach-mv78xx0/irq.c +++ b/arch/arm/mach-mv78xx0/irq.c | |||
@@ -40,7 +40,7 @@ void __init mv78xx0_init_irq(void) | |||
40 | writel(0, GPIO_EDGE_CAUSE(0)); | 40 | writel(0, GPIO_EDGE_CAUSE(0)); |
41 | 41 | ||
42 | for (i = IRQ_MV78XX0_GPIO_START; i < NR_IRQS; i++) { | 42 | for (i = IRQ_MV78XX0_GPIO_START; i < NR_IRQS; i++) { |
43 | set_irq_chip(i, &orion_gpio_irq_level_chip); | 43 | set_irq_chip(i, &orion_gpio_irq_chip); |
44 | set_irq_handler(i, handle_level_irq); | 44 | set_irq_handler(i, handle_level_irq); |
45 | irq_desc[i].status |= IRQ_LEVEL; | 45 | irq_desc[i].status |= IRQ_LEVEL; |
46 | set_irq_flags(i, IRQF_VALID); | 46 | set_irq_flags(i, IRQF_VALID); |
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index ad721e0cbf7a..ce4d46a4a838 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -565,7 +565,7 @@ u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val) | |||
565 | * | 565 | * |
566 | * Given a struct clk of a rate-selectable clksel clock, and a clock divisor, | 566 | * Given a struct clk of a rate-selectable clksel clock, and a clock divisor, |
567 | * find the corresponding register field value. The return register value is | 567 | * find the corresponding register field value. The return register value is |
568 | * the value before left-shifting. Returns 0xffffffff on error | 568 | * the value before left-shifting. Returns ~0 on error |
569 | */ | 569 | */ |
570 | u32 omap2_divisor_to_clksel(struct clk *clk, u32 div) | 570 | u32 omap2_divisor_to_clksel(struct clk *clk, u32 div) |
571 | { | 571 | { |
@@ -577,7 +577,7 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div) | |||
577 | 577 | ||
578 | clks = omap2_get_clksel_by_parent(clk, clk->parent); | 578 | clks = omap2_get_clksel_by_parent(clk, clk->parent); |
579 | if (clks == NULL) | 579 | if (clks == NULL) |
580 | return 0; | 580 | return ~0; |
581 | 581 | ||
582 | for (clkr = clks->rates; clkr->div; clkr++) { | 582 | for (clkr = clks->rates; clkr->div; clkr++) { |
583 | if ((clkr->flags & cpu_mask) && (clkr->div == div)) | 583 | if ((clkr->flags & cpu_mask) && (clkr->div == div)) |
@@ -588,7 +588,7 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div) | |||
588 | printk(KERN_ERR "clock: Could not find divisor %d for " | 588 | printk(KERN_ERR "clock: Could not find divisor %d for " |
589 | "clock %s parent %s\n", div, clk->name, | 589 | "clock %s parent %s\n", div, clk->name, |
590 | clk->parent->name); | 590 | clk->parent->name); |
591 | return 0; | 591 | return ~0; |
592 | } | 592 | } |
593 | 593 | ||
594 | return clkr->val; | 594 | return clkr->val; |
@@ -708,7 +708,7 @@ static u32 omap2_clksel_get_src_field(void __iomem **src_addr, | |||
708 | return 0; | 708 | return 0; |
709 | 709 | ||
710 | for (clkr = clks->rates; clkr->div; clkr++) { | 710 | for (clkr = clks->rates; clkr->div; clkr++) { |
711 | if (clkr->flags & (cpu_mask | DEFAULT_RATE)) | 711 | if (clkr->flags & cpu_mask && clkr->flags & DEFAULT_RATE) |
712 | break; /* Found the default rate for this platform */ | 712 | break; /* Found the default rate for this platform */ |
713 | } | 713 | } |
714 | 714 | ||
@@ -746,7 +746,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) | |||
746 | return -EINVAL; | 746 | return -EINVAL; |
747 | 747 | ||
748 | if (clk->usecount > 0) | 748 | if (clk->usecount > 0) |
749 | _omap2_clk_disable(clk); | 749 | omap2_clk_disable(clk); |
750 | 750 | ||
751 | /* Set new source value (previous dividers if any in effect) */ | 751 | /* Set new source value (previous dividers if any in effect) */ |
752 | reg_val = __raw_readl(src_addr) & ~field_mask; | 752 | reg_val = __raw_readl(src_addr) & ~field_mask; |
@@ -759,11 +759,11 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) | |||
759 | wmb(); | 759 | wmb(); |
760 | } | 760 | } |
761 | 761 | ||
762 | if (clk->usecount > 0) | ||
763 | _omap2_clk_enable(clk); | ||
764 | |||
765 | clk->parent = new_parent; | 762 | clk->parent = new_parent; |
766 | 763 | ||
764 | if (clk->usecount > 0) | ||
765 | omap2_clk_enable(clk); | ||
766 | |||
767 | /* CLKSEL clocks follow their parents' rates, divided by a divisor */ | 767 | /* CLKSEL clocks follow their parents' rates, divided by a divisor */ |
768 | clk->rate = new_parent->rate; | 768 | clk->rate = new_parent->rate; |
769 | 769 | ||
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c index 0caae43301e5..e03f7b45cb0d 100644 --- a/arch/arm/mach-orion5x/irq.c +++ b/arch/arm/mach-orion5x/irq.c | |||
@@ -44,7 +44,7 @@ void __init orion5x_init_irq(void) | |||
44 | * User can use set_type() if he wants to use edge types handlers. | 44 | * User can use set_type() if he wants to use edge types handlers. |
45 | */ | 45 | */ |
46 | for (i = IRQ_ORION5X_GPIO_START; i < NR_IRQS; i++) { | 46 | for (i = IRQ_ORION5X_GPIO_START; i < NR_IRQS; i++) { |
47 | set_irq_chip(i, &orion_gpio_irq_level_chip); | 47 | set_irq_chip(i, &orion_gpio_irq_chip); |
48 | set_irq_handler(i, handle_level_irq); | 48 | set_irq_handler(i, handle_level_irq); |
49 | irq_desc[i].status |= IRQ_LEVEL; | 49 | irq_desc[i].status |= IRQ_LEVEL; |
50 | set_irq_flags(i, IRQF_VALID); | 50 | set_irq_flags(i, IRQF_VALID); |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 9b36c5cb5e9f..d4d082c5c2d4 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -693,7 +693,8 @@ static void __init sanity_check_meminfo(void) | |||
693 | * Check whether this memory bank would entirely overlap | 693 | * Check whether this memory bank would entirely overlap |
694 | * the vmalloc area. | 694 | * the vmalloc area. |
695 | */ | 695 | */ |
696 | if (__va(bank->start) >= VMALLOC_MIN) { | 696 | if (__va(bank->start) >= VMALLOC_MIN || |
697 | __va(bank->start) < PAGE_OFFSET) { | ||
697 | printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx " | 698 | printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx " |
698 | "(vmalloc region overlap).\n", | 699 | "(vmalloc region overlap).\n", |
699 | bank->start, bank->start + bank->size - 1); | 700 | bank->start, bank->start + bank->size - 1); |
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c index 967186425ca1..0d12c2164766 100644 --- a/arch/arm/plat-orion/gpio.c +++ b/arch/arm/plat-orion/gpio.c | |||
@@ -265,51 +265,36 @@ EXPORT_SYMBOL(orion_gpio_set_blink); | |||
265 | * polarity LEVEL mask | 265 | * polarity LEVEL mask |
266 | * | 266 | * |
267 | ****************************************************************************/ | 267 | ****************************************************************************/ |
268 | static void gpio_irq_edge_ack(u32 irq) | ||
269 | { | ||
270 | int pin = irq_to_gpio(irq); | ||
271 | |||
272 | writel(~(1 << (pin & 31)), GPIO_EDGE_CAUSE(pin)); | ||
273 | } | ||
274 | |||
275 | static void gpio_irq_edge_mask(u32 irq) | ||
276 | { | ||
277 | int pin = irq_to_gpio(irq); | ||
278 | u32 u; | ||
279 | |||
280 | u = readl(GPIO_EDGE_MASK(pin)); | ||
281 | u &= ~(1 << (pin & 31)); | ||
282 | writel(u, GPIO_EDGE_MASK(pin)); | ||
283 | } | ||
284 | 268 | ||
285 | static void gpio_irq_edge_unmask(u32 irq) | 269 | static void gpio_irq_ack(u32 irq) |
286 | { | 270 | { |
287 | int pin = irq_to_gpio(irq); | 271 | int type = irq_desc[irq].status & IRQ_TYPE_SENSE_MASK; |
288 | u32 u; | 272 | if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) { |
289 | 273 | int pin = irq_to_gpio(irq); | |
290 | u = readl(GPIO_EDGE_MASK(pin)); | 274 | writel(~(1 << (pin & 31)), GPIO_EDGE_CAUSE(pin)); |
291 | u |= 1 << (pin & 31); | 275 | } |
292 | writel(u, GPIO_EDGE_MASK(pin)); | ||
293 | } | 276 | } |
294 | 277 | ||
295 | static void gpio_irq_level_mask(u32 irq) | 278 | static void gpio_irq_mask(u32 irq) |
296 | { | 279 | { |
297 | int pin = irq_to_gpio(irq); | 280 | int pin = irq_to_gpio(irq); |
298 | u32 u; | 281 | int type = irq_desc[irq].status & IRQ_TYPE_SENSE_MASK; |
299 | 282 | u32 reg = (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) ? | |
300 | u = readl(GPIO_LEVEL_MASK(pin)); | 283 | GPIO_EDGE_MASK(pin) : GPIO_LEVEL_MASK(pin); |
284 | u32 u = readl(reg); | ||
301 | u &= ~(1 << (pin & 31)); | 285 | u &= ~(1 << (pin & 31)); |
302 | writel(u, GPIO_LEVEL_MASK(pin)); | 286 | writel(u, reg); |
303 | } | 287 | } |
304 | 288 | ||
305 | static void gpio_irq_level_unmask(u32 irq) | 289 | static void gpio_irq_unmask(u32 irq) |
306 | { | 290 | { |
307 | int pin = irq_to_gpio(irq); | 291 | int pin = irq_to_gpio(irq); |
308 | u32 u; | 292 | int type = irq_desc[irq].status & IRQ_TYPE_SENSE_MASK; |
309 | 293 | u32 reg = (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) ? | |
310 | u = readl(GPIO_LEVEL_MASK(pin)); | 294 | GPIO_EDGE_MASK(pin) : GPIO_LEVEL_MASK(pin); |
295 | u32 u = readl(reg); | ||
311 | u |= 1 << (pin & 31); | 296 | u |= 1 << (pin & 31); |
312 | writel(u, GPIO_LEVEL_MASK(pin)); | 297 | writel(u, reg); |
313 | } | 298 | } |
314 | 299 | ||
315 | static int gpio_irq_set_type(u32 irq, u32 type) | 300 | static int gpio_irq_set_type(u32 irq, u32 type) |
@@ -331,9 +316,9 @@ static int gpio_irq_set_type(u32 irq, u32 type) | |||
331 | * Set edge/level type. | 316 | * Set edge/level type. |
332 | */ | 317 | */ |
333 | if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) { | 318 | if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) { |
334 | desc->chip = &orion_gpio_irq_edge_chip; | 319 | desc->handle_irq = handle_edge_irq; |
335 | } else if (type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { | 320 | } else if (type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { |
336 | desc->chip = &orion_gpio_irq_level_chip; | 321 | desc->handle_irq = handle_level_irq; |
337 | } else { | 322 | } else { |
338 | printk(KERN_ERR "failed to set irq=%d (type=%d)\n", irq, type); | 323 | printk(KERN_ERR "failed to set irq=%d (type=%d)\n", irq, type); |
339 | return -EINVAL; | 324 | return -EINVAL; |
@@ -371,19 +356,11 @@ static int gpio_irq_set_type(u32 irq, u32 type) | |||
371 | return 0; | 356 | return 0; |
372 | } | 357 | } |
373 | 358 | ||
374 | struct irq_chip orion_gpio_irq_edge_chip = { | 359 | struct irq_chip orion_gpio_irq_chip = { |
375 | .name = "orion_gpio_irq_edge", | 360 | .name = "orion_gpio", |
376 | .ack = gpio_irq_edge_ack, | 361 | .ack = gpio_irq_ack, |
377 | .mask = gpio_irq_edge_mask, | 362 | .mask = gpio_irq_mask, |
378 | .unmask = gpio_irq_edge_unmask, | 363 | .unmask = gpio_irq_unmask, |
379 | .set_type = gpio_irq_set_type, | ||
380 | }; | ||
381 | |||
382 | struct irq_chip orion_gpio_irq_level_chip = { | ||
383 | .name = "orion_gpio_irq_level", | ||
384 | .mask = gpio_irq_level_mask, | ||
385 | .mask_ack = gpio_irq_level_mask, | ||
386 | .unmask = gpio_irq_level_unmask, | ||
387 | .set_type = gpio_irq_set_type, | 364 | .set_type = gpio_irq_set_type, |
388 | }; | 365 | }; |
389 | 366 | ||
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h index 54deaf274b52..ec743e82c876 100644 --- a/arch/arm/plat-orion/include/plat/gpio.h +++ b/arch/arm/plat-orion/include/plat/gpio.h | |||
@@ -31,8 +31,7 @@ void orion_gpio_set_blink(unsigned pin, int blink); | |||
31 | /* | 31 | /* |
32 | * GPIO interrupt handling. | 32 | * GPIO interrupt handling. |
33 | */ | 33 | */ |
34 | extern struct irq_chip orion_gpio_irq_edge_chip; | 34 | extern struct irq_chip orion_gpio_irq_chip; |
35 | extern struct irq_chip orion_gpio_irq_level_chip; | ||
36 | void orion_gpio_irq_handler(int irqoff); | 35 | void orion_gpio_irq_handler(int irqoff); |
37 | 36 | ||
38 | 37 | ||
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h index aafaf7a78886..cff8e84f78f2 100644 --- a/arch/avr32/mach-at32ap/include/mach/board.h +++ b/arch/avr32/mach-at32ap/include/mach/board.h | |||
@@ -116,6 +116,7 @@ struct atmel_nand_data { | |||
116 | int enable_pin; /* chip enable */ | 116 | int enable_pin; /* chip enable */ |
117 | int det_pin; /* card detect */ | 117 | int det_pin; /* card detect */ |
118 | int rdy_pin; /* ready/busy */ | 118 | int rdy_pin; /* ready/busy */ |
119 | u8 rdy_pin_active_low; /* rdy_pin value is inverted */ | ||
119 | u8 ale; /* address line number connected to ALE */ | 120 | u8 ale; /* address line number connected to ALE */ |
120 | u8 cle; /* address line number connected to CLE */ | 121 | u8 cle; /* address line number connected to CLE */ |
121 | u8 bus_width_16; /* buswidth is 16 bit */ | 122 | u8 bus_width_16; /* buswidth is 16 bit */ |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 6183aeccecf1..4eb45c012498 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -221,7 +221,11 @@ config IA64_HP_SIM | |||
221 | 221 | ||
222 | config IA64_XEN_GUEST | 222 | config IA64_XEN_GUEST |
223 | bool "Xen guest" | 223 | bool "Xen guest" |
224 | select SWIOTLB | ||
224 | depends on XEN | 225 | depends on XEN |
226 | help | ||
227 | Build a kernel that runs on Xen guest domain. At this moment only | ||
228 | 16KB page size in supported. | ||
225 | 229 | ||
226 | endchoice | 230 | endchoice |
227 | 231 | ||
@@ -479,8 +483,7 @@ config HOLES_IN_ZONE | |||
479 | default y if VIRTUAL_MEM_MAP | 483 | default y if VIRTUAL_MEM_MAP |
480 | 484 | ||
481 | config HAVE_ARCH_EARLY_PFN_TO_NID | 485 | config HAVE_ARCH_EARLY_PFN_TO_NID |
482 | def_bool y | 486 | def_bool NUMA && SPARSEMEM |
483 | depends on NEED_MULTIPLE_NODES | ||
484 | 487 | ||
485 | config HAVE_ARCH_NODEDATA_EXTENSION | 488 | config HAVE_ARCH_NODEDATA_EXTENSION |
486 | def_bool y | 489 | def_bool y |
diff --git a/arch/ia64/configs/xen_domu_defconfig b/arch/ia64/configs/xen_domu_defconfig new file mode 100644 index 000000000000..0bb0714dc19d --- /dev/null +++ b/arch/ia64/configs/xen_domu_defconfig | |||
@@ -0,0 +1,1601 @@ | |||
1 | # | ||
2 | # Automatically generated make config: don't edit | ||
3 | # Linux kernel version: 2.6.29-rc1 | ||
4 | # Fri Jan 16 11:49:59 2009 | ||
5 | # | ||
6 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | ||
7 | |||
8 | # | ||
9 | # General setup | ||
10 | # | ||
11 | CONFIG_EXPERIMENTAL=y | ||
12 | CONFIG_LOCK_KERNEL=y | ||
13 | CONFIG_INIT_ENV_ARG_LIMIT=32 | ||
14 | CONFIG_LOCALVERSION="" | ||
15 | CONFIG_LOCALVERSION_AUTO=y | ||
16 | CONFIG_SWAP=y | ||
17 | CONFIG_SYSVIPC=y | ||
18 | CONFIG_SYSVIPC_SYSCTL=y | ||
19 | CONFIG_POSIX_MQUEUE=y | ||
20 | # CONFIG_BSD_PROCESS_ACCT is not set | ||
21 | # CONFIG_TASKSTATS is not set | ||
22 | # CONFIG_AUDIT is not set | ||
23 | CONFIG_IKCONFIG=y | ||
24 | CONFIG_IKCONFIG_PROC=y | ||
25 | CONFIG_LOG_BUF_SHIFT=20 | ||
26 | CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y | ||
27 | # CONFIG_GROUP_SCHED is not set | ||
28 | |||
29 | # | ||
30 | # Control Group support | ||
31 | # | ||
32 | # CONFIG_CGROUPS is not set | ||
33 | CONFIG_SYSFS_DEPRECATED=y | ||
34 | CONFIG_SYSFS_DEPRECATED_V2=y | ||
35 | # CONFIG_RELAY is not set | ||
36 | CONFIG_NAMESPACES=y | ||
37 | # CONFIG_UTS_NS is not set | ||
38 | # CONFIG_IPC_NS is not set | ||
39 | # CONFIG_USER_NS is not set | ||
40 | # CONFIG_PID_NS is not set | ||
41 | CONFIG_BLK_DEV_INITRD=y | ||
42 | CONFIG_INITRAMFS_SOURCE="" | ||
43 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
44 | CONFIG_SYSCTL=y | ||
45 | # CONFIG_EMBEDDED is not set | ||
46 | CONFIG_SYSCTL_SYSCALL=y | ||
47 | CONFIG_KALLSYMS=y | ||
48 | CONFIG_KALLSYMS_ALL=y | ||
49 | CONFIG_KALLSYMS_STRIP_GENERATED=y | ||
50 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | ||
51 | CONFIG_HOTPLUG=y | ||
52 | CONFIG_PRINTK=y | ||
53 | CONFIG_BUG=y | ||
54 | CONFIG_ELF_CORE=y | ||
55 | CONFIG_COMPAT_BRK=y | ||
56 | CONFIG_BASE_FULL=y | ||
57 | CONFIG_FUTEX=y | ||
58 | CONFIG_ANON_INODES=y | ||
59 | CONFIG_EPOLL=y | ||
60 | CONFIG_SIGNALFD=y | ||
61 | CONFIG_TIMERFD=y | ||
62 | CONFIG_EVENTFD=y | ||
63 | CONFIG_SHMEM=y | ||
64 | CONFIG_AIO=y | ||
65 | CONFIG_VM_EVENT_COUNTERS=y | ||
66 | CONFIG_PCI_QUIRKS=y | ||
67 | CONFIG_SLUB_DEBUG=y | ||
68 | # CONFIG_SLAB is not set | ||
69 | CONFIG_SLUB=y | ||
70 | # CONFIG_SLOB is not set | ||
71 | # CONFIG_PROFILING is not set | ||
72 | CONFIG_HAVE_OPROFILE=y | ||
73 | # CONFIG_KPROBES is not set | ||
74 | CONFIG_HAVE_KPROBES=y | ||
75 | CONFIG_HAVE_KRETPROBES=y | ||
76 | CONFIG_HAVE_ARCH_TRACEHOOK=y | ||
77 | CONFIG_HAVE_DMA_ATTRS=y | ||
78 | CONFIG_USE_GENERIC_SMP_HELPERS=y | ||
79 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | ||
80 | CONFIG_SLABINFO=y | ||
81 | CONFIG_RT_MUTEXES=y | ||
82 | CONFIG_BASE_SMALL=0 | ||
83 | CONFIG_MODULES=y | ||
84 | # CONFIG_MODULE_FORCE_LOAD is not set | ||
85 | CONFIG_MODULE_UNLOAD=y | ||
86 | # CONFIG_MODULE_FORCE_UNLOAD is not set | ||
87 | CONFIG_MODVERSIONS=y | ||
88 | CONFIG_MODULE_SRCVERSION_ALL=y | ||
89 | CONFIG_STOP_MACHINE=y | ||
90 | CONFIG_BLOCK=y | ||
91 | # CONFIG_BLK_DEV_IO_TRACE is not set | ||
92 | # CONFIG_BLK_DEV_BSG is not set | ||
93 | # CONFIG_BLK_DEV_INTEGRITY is not set | ||
94 | |||
95 | # | ||
96 | # IO Schedulers | ||
97 | # | ||
98 | CONFIG_IOSCHED_NOOP=y | ||
99 | CONFIG_IOSCHED_AS=y | ||
100 | CONFIG_IOSCHED_DEADLINE=y | ||
101 | CONFIG_IOSCHED_CFQ=y | ||
102 | CONFIG_DEFAULT_AS=y | ||
103 | # CONFIG_DEFAULT_DEADLINE is not set | ||
104 | # CONFIG_DEFAULT_CFQ is not set | ||
105 | # CONFIG_DEFAULT_NOOP is not set | ||
106 | CONFIG_DEFAULT_IOSCHED="anticipatory" | ||
107 | CONFIG_CLASSIC_RCU=y | ||
108 | # CONFIG_TREE_RCU is not set | ||
109 | # CONFIG_PREEMPT_RCU is not set | ||
110 | # CONFIG_TREE_RCU_TRACE is not set | ||
111 | # CONFIG_PREEMPT_RCU_TRACE is not set | ||
112 | CONFIG_FREEZER=y | ||
113 | |||
114 | # | ||
115 | # Processor type and features | ||
116 | # | ||
117 | CONFIG_IA64=y | ||
118 | CONFIG_64BIT=y | ||
119 | CONFIG_ZONE_DMA=y | ||
120 | CONFIG_QUICKLIST=y | ||
121 | CONFIG_MMU=y | ||
122 | CONFIG_SWIOTLB=y | ||
123 | CONFIG_IOMMU_HELPER=y | ||
124 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | ||
125 | CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y | ||
126 | CONFIG_GENERIC_FIND_NEXT_BIT=y | ||
127 | CONFIG_GENERIC_CALIBRATE_DELAY=y | ||
128 | CONFIG_GENERIC_TIME=y | ||
129 | CONFIG_GENERIC_TIME_VSYSCALL=y | ||
130 | CONFIG_HAVE_SETUP_PER_CPU_AREA=y | ||
131 | CONFIG_DMI=y | ||
132 | CONFIG_EFI=y | ||
133 | CONFIG_GENERIC_IOMAP=y | ||
134 | CONFIG_SCHED_OMIT_FRAME_POINTER=y | ||
135 | CONFIG_AUDIT_ARCH=y | ||
136 | CONFIG_PARAVIRT_GUEST=y | ||
137 | CONFIG_PARAVIRT=y | ||
138 | CONFIG_XEN=y | ||
139 | CONFIG_XEN_XENCOMM=y | ||
140 | CONFIG_NO_IDLE_HZ=y | ||
141 | # CONFIG_IA64_GENERIC is not set | ||
142 | # CONFIG_IA64_DIG is not set | ||
143 | # CONFIG_IA64_DIG_VTD is not set | ||
144 | # CONFIG_IA64_HP_ZX1 is not set | ||
145 | # CONFIG_IA64_HP_ZX1_SWIOTLB is not set | ||
146 | # CONFIG_IA64_SGI_SN2 is not set | ||
147 | # CONFIG_IA64_SGI_UV is not set | ||
148 | # CONFIG_IA64_HP_SIM is not set | ||
149 | CONFIG_IA64_XEN_GUEST=y | ||
150 | # CONFIG_ITANIUM is not set | ||
151 | CONFIG_MCKINLEY=y | ||
152 | # CONFIG_IA64_PAGE_SIZE_4KB is not set | ||
153 | # CONFIG_IA64_PAGE_SIZE_8KB is not set | ||
154 | CONFIG_IA64_PAGE_SIZE_16KB=y | ||
155 | # CONFIG_IA64_PAGE_SIZE_64KB is not set | ||
156 | CONFIG_PGTABLE_3=y | ||
157 | # CONFIG_PGTABLE_4 is not set | ||
158 | CONFIG_HZ=250 | ||
159 | # CONFIG_HZ_100 is not set | ||
160 | CONFIG_HZ_250=y | ||
161 | # CONFIG_HZ_300 is not set | ||
162 | # CONFIG_HZ_1000 is not set | ||
163 | # CONFIG_SCHED_HRTICK is not set | ||
164 | CONFIG_IA64_L1_CACHE_SHIFT=7 | ||
165 | CONFIG_IA64_CYCLONE=y | ||
166 | CONFIG_IOSAPIC=y | ||
167 | CONFIG_FORCE_MAX_ZONEORDER=17 | ||
168 | # CONFIG_VIRT_CPU_ACCOUNTING is not set | ||
169 | CONFIG_SMP=y | ||
170 | CONFIG_NR_CPUS=16 | ||
171 | CONFIG_HOTPLUG_CPU=y | ||
172 | CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y | ||
173 | CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y | ||
174 | # CONFIG_SCHED_SMT is not set | ||
175 | CONFIG_PERMIT_BSP_REMOVE=y | ||
176 | CONFIG_FORCE_CPEI_RETARGET=y | ||
177 | CONFIG_PREEMPT_NONE=y | ||
178 | # CONFIG_PREEMPT_VOLUNTARY is not set | ||
179 | # CONFIG_PREEMPT is not set | ||
180 | CONFIG_SELECT_MEMORY_MODEL=y | ||
181 | CONFIG_FLATMEM_MANUAL=y | ||
182 | # CONFIG_DISCONTIGMEM_MANUAL is not set | ||
183 | # CONFIG_SPARSEMEM_MANUAL is not set | ||
184 | CONFIG_FLATMEM=y | ||
185 | CONFIG_FLAT_NODE_MEM_MAP=y | ||
186 | CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y | ||
187 | CONFIG_PAGEFLAGS_EXTENDED=y | ||
188 | CONFIG_SPLIT_PTLOCK_CPUS=4 | ||
189 | CONFIG_MIGRATION=y | ||
190 | CONFIG_PHYS_ADDR_T_64BIT=y | ||
191 | CONFIG_ZONE_DMA_FLAG=1 | ||
192 | CONFIG_BOUNCE=y | ||
193 | CONFIG_NR_QUICK=1 | ||
194 | CONFIG_VIRT_TO_BUS=y | ||
195 | CONFIG_UNEVICTABLE_LRU=y | ||
196 | CONFIG_ARCH_SELECT_MEMORY_MODEL=y | ||
197 | CONFIG_ARCH_DISCONTIGMEM_ENABLE=y | ||
198 | CONFIG_ARCH_FLATMEM_ENABLE=y | ||
199 | CONFIG_ARCH_SPARSEMEM_ENABLE=y | ||
200 | CONFIG_ARCH_POPULATES_NODE_MAP=y | ||
201 | CONFIG_VIRTUAL_MEM_MAP=y | ||
202 | CONFIG_HOLES_IN_ZONE=y | ||
203 | # CONFIG_IA32_SUPPORT is not set | ||
204 | # CONFIG_COMPAT_FOR_U64_ALIGNMENT is not set | ||
205 | CONFIG_IA64_MCA_RECOVERY=y | ||
206 | CONFIG_PERFMON=y | ||
207 | CONFIG_IA64_PALINFO=y | ||
208 | # CONFIG_IA64_MC_ERR_INJECT is not set | ||
209 | # CONFIG_IA64_ESI is not set | ||
210 | # CONFIG_IA64_HP_AML_NFW is not set | ||
211 | CONFIG_KEXEC=y | ||
212 | # CONFIG_CRASH_DUMP is not set | ||
213 | |||
214 | # | ||
215 | # Firmware Drivers | ||
216 | # | ||
217 | # CONFIG_FIRMWARE_MEMMAP is not set | ||
218 | CONFIG_EFI_VARS=y | ||
219 | CONFIG_EFI_PCDP=y | ||
220 | CONFIG_DMIID=y | ||
221 | CONFIG_BINFMT_ELF=y | ||
222 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
223 | # CONFIG_HAVE_AOUT is not set | ||
224 | CONFIG_BINFMT_MISC=m | ||
225 | |||
226 | # | ||
227 | # Power management and ACPI options | ||
228 | # | ||
229 | CONFIG_PM=y | ||
230 | # CONFIG_PM_DEBUG is not set | ||
231 | CONFIG_PM_SLEEP=y | ||
232 | CONFIG_SUSPEND=y | ||
233 | CONFIG_SUSPEND_FREEZER=y | ||
234 | CONFIG_ACPI=y | ||
235 | CONFIG_ACPI_SLEEP=y | ||
236 | CONFIG_ACPI_PROCFS=y | ||
237 | CONFIG_ACPI_PROCFS_POWER=y | ||
238 | CONFIG_ACPI_SYSFS_POWER=y | ||
239 | CONFIG_ACPI_PROC_EVENT=y | ||
240 | CONFIG_ACPI_BUTTON=m | ||
241 | CONFIG_ACPI_FAN=m | ||
242 | # CONFIG_ACPI_DOCK is not set | ||
243 | CONFIG_ACPI_PROCESSOR=m | ||
244 | CONFIG_ACPI_HOTPLUG_CPU=y | ||
245 | CONFIG_ACPI_THERMAL=m | ||
246 | # CONFIG_ACPI_CUSTOM_DSDT is not set | ||
247 | CONFIG_ACPI_BLACKLIST_YEAR=0 | ||
248 | # CONFIG_ACPI_DEBUG is not set | ||
249 | # CONFIG_ACPI_PCI_SLOT is not set | ||
250 | CONFIG_ACPI_SYSTEM=y | ||
251 | CONFIG_ACPI_CONTAINER=m | ||
252 | |||
253 | # | ||
254 | # CPU Frequency scaling | ||
255 | # | ||
256 | # CONFIG_CPU_FREQ is not set | ||
257 | |||
258 | # | ||
259 | # Bus options (PCI, PCMCIA) | ||
260 | # | ||
261 | CONFIG_PCI=y | ||
262 | CONFIG_PCI_DOMAINS=y | ||
263 | CONFIG_PCI_SYSCALL=y | ||
264 | # CONFIG_PCIEPORTBUS is not set | ||
265 | CONFIG_ARCH_SUPPORTS_MSI=y | ||
266 | # CONFIG_PCI_MSI is not set | ||
267 | CONFIG_PCI_LEGACY=y | ||
268 | # CONFIG_PCI_DEBUG is not set | ||
269 | # CONFIG_PCI_STUB is not set | ||
270 | CONFIG_HOTPLUG_PCI=m | ||
271 | # CONFIG_HOTPLUG_PCI_FAKE is not set | ||
272 | CONFIG_HOTPLUG_PCI_ACPI=m | ||
273 | # CONFIG_HOTPLUG_PCI_ACPI_IBM is not set | ||
274 | # CONFIG_HOTPLUG_PCI_CPCI is not set | ||
275 | # CONFIG_HOTPLUG_PCI_SHPC is not set | ||
276 | # CONFIG_PCCARD is not set | ||
277 | CONFIG_NET=y | ||
278 | |||
279 | # | ||
280 | # Networking options | ||
281 | # | ||
282 | # CONFIG_NET_NS is not set | ||
283 | CONFIG_COMPAT_NET_DEV_OPS=y | ||
284 | CONFIG_PACKET=y | ||
285 | # CONFIG_PACKET_MMAP is not set | ||
286 | CONFIG_UNIX=y | ||
287 | CONFIG_XFRM=y | ||
288 | # CONFIG_XFRM_USER is not set | ||
289 | # CONFIG_XFRM_SUB_POLICY is not set | ||
290 | # CONFIG_XFRM_MIGRATE is not set | ||
291 | # CONFIG_XFRM_STATISTICS is not set | ||
292 | # CONFIG_NET_KEY is not set | ||
293 | CONFIG_INET=y | ||
294 | CONFIG_IP_MULTICAST=y | ||
295 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
296 | CONFIG_IP_FIB_HASH=y | ||
297 | # CONFIG_IP_PNP is not set | ||
298 | # CONFIG_NET_IPIP is not set | ||
299 | # CONFIG_NET_IPGRE is not set | ||
300 | # CONFIG_IP_MROUTE is not set | ||
301 | CONFIG_ARPD=y | ||
302 | CONFIG_SYN_COOKIES=y | ||
303 | # CONFIG_INET_AH is not set | ||
304 | # CONFIG_INET_ESP is not set | ||
305 | # CONFIG_INET_IPCOMP is not set | ||
306 | # CONFIG_INET_XFRM_TUNNEL is not set | ||
307 | # CONFIG_INET_TUNNEL is not set | ||
308 | CONFIG_INET_XFRM_MODE_TRANSPORT=y | ||
309 | CONFIG_INET_XFRM_MODE_TUNNEL=y | ||
310 | CONFIG_INET_XFRM_MODE_BEET=y | ||
311 | # CONFIG_INET_LRO is not set | ||
312 | CONFIG_INET_DIAG=y | ||
313 | CONFIG_INET_TCP_DIAG=y | ||
314 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
315 | CONFIG_TCP_CONG_CUBIC=y | ||
316 | CONFIG_DEFAULT_TCP_CONG="cubic" | ||
317 | # CONFIG_TCP_MD5SIG is not set | ||
318 | # CONFIG_IPV6 is not set | ||
319 | # CONFIG_NETWORK_SECMARK is not set | ||
320 | # CONFIG_NETFILTER is not set | ||
321 | # CONFIG_IP_DCCP is not set | ||
322 | # CONFIG_IP_SCTP is not set | ||
323 | # CONFIG_TIPC is not set | ||
324 | # CONFIG_ATM is not set | ||
325 | # CONFIG_BRIDGE is not set | ||
326 | # CONFIG_NET_DSA is not set | ||
327 | # CONFIG_VLAN_8021Q is not set | ||
328 | # CONFIG_DECNET is not set | ||
329 | # CONFIG_LLC2 is not set | ||
330 | # CONFIG_IPX is not set | ||
331 | # CONFIG_ATALK is not set | ||
332 | # CONFIG_X25 is not set | ||
333 | # CONFIG_LAPB is not set | ||
334 | # CONFIG_ECONET is not set | ||
335 | # CONFIG_WAN_ROUTER is not set | ||
336 | # CONFIG_NET_SCHED is not set | ||
337 | # CONFIG_DCB is not set | ||
338 | |||
339 | # | ||
340 | # Network testing | ||
341 | # | ||
342 | # CONFIG_NET_PKTGEN is not set | ||
343 | # CONFIG_HAMRADIO is not set | ||
344 | # CONFIG_CAN is not set | ||
345 | # CONFIG_IRDA is not set | ||
346 | # CONFIG_BT is not set | ||
347 | # CONFIG_AF_RXRPC is not set | ||
348 | # CONFIG_PHONET is not set | ||
349 | # CONFIG_WIRELESS is not set | ||
350 | # CONFIG_WIMAX is not set | ||
351 | # CONFIG_RFKILL is not set | ||
352 | # CONFIG_NET_9P is not set | ||
353 | |||
354 | # | ||
355 | # Device Drivers | ||
356 | # | ||
357 | |||
358 | # | ||
359 | # Generic Driver Options | ||
360 | # | ||
361 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
362 | CONFIG_STANDALONE=y | ||
363 | CONFIG_PREVENT_FIRMWARE_BUILD=y | ||
364 | CONFIG_FW_LOADER=y | ||
365 | CONFIG_FIRMWARE_IN_KERNEL=y | ||
366 | CONFIG_EXTRA_FIRMWARE="" | ||
367 | # CONFIG_DEBUG_DRIVER is not set | ||
368 | # CONFIG_DEBUG_DEVRES is not set | ||
369 | # CONFIG_SYS_HYPERVISOR is not set | ||
370 | # CONFIG_CONNECTOR is not set | ||
371 | # CONFIG_MTD is not set | ||
372 | # CONFIG_PARPORT is not set | ||
373 | CONFIG_PNP=y | ||
374 | CONFIG_PNP_DEBUG_MESSAGES=y | ||
375 | |||
376 | # | ||
377 | # Protocols | ||
378 | # | ||
379 | CONFIG_PNPACPI=y | ||
380 | CONFIG_BLK_DEV=y | ||
381 | # CONFIG_BLK_CPQ_DA is not set | ||
382 | # CONFIG_BLK_CPQ_CISS_DA is not set | ||
383 | # CONFIG_BLK_DEV_DAC960 is not set | ||
384 | # CONFIG_BLK_DEV_UMEM is not set | ||
385 | # CONFIG_BLK_DEV_COW_COMMON is not set | ||
386 | CONFIG_BLK_DEV_LOOP=m | ||
387 | CONFIG_BLK_DEV_CRYPTOLOOP=m | ||
388 | CONFIG_BLK_DEV_NBD=m | ||
389 | # CONFIG_BLK_DEV_SX8 is not set | ||
390 | # CONFIG_BLK_DEV_UB is not set | ||
391 | CONFIG_BLK_DEV_RAM=y | ||
392 | CONFIG_BLK_DEV_RAM_COUNT=16 | ||
393 | CONFIG_BLK_DEV_RAM_SIZE=4096 | ||
394 | # CONFIG_BLK_DEV_XIP is not set | ||
395 | # CONFIG_CDROM_PKTCDVD is not set | ||
396 | # CONFIG_ATA_OVER_ETH is not set | ||
397 | CONFIG_XEN_BLKDEV_FRONTEND=y | ||
398 | # CONFIG_BLK_DEV_HD is not set | ||
399 | CONFIG_MISC_DEVICES=y | ||
400 | # CONFIG_PHANTOM is not set | ||
401 | # CONFIG_EEPROM_93CX6 is not set | ||
402 | # CONFIG_SGI_IOC4 is not set | ||
403 | # CONFIG_TIFM_CORE is not set | ||
404 | # CONFIG_ICS932S401 is not set | ||
405 | # CONFIG_ENCLOSURE_SERVICES is not set | ||
406 | # CONFIG_HP_ILO is not set | ||
407 | # CONFIG_C2PORT is not set | ||
408 | CONFIG_HAVE_IDE=y | ||
409 | CONFIG_IDE=y | ||
410 | |||
411 | # | ||
412 | # Please see Documentation/ide/ide.txt for help/info on IDE drives | ||
413 | # | ||
414 | CONFIG_IDE_TIMINGS=y | ||
415 | CONFIG_IDE_ATAPI=y | ||
416 | # CONFIG_BLK_DEV_IDE_SATA is not set | ||
417 | CONFIG_IDE_GD=y | ||
418 | CONFIG_IDE_GD_ATA=y | ||
419 | # CONFIG_IDE_GD_ATAPI is not set | ||
420 | CONFIG_BLK_DEV_IDECD=y | ||
421 | CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y | ||
422 | # CONFIG_BLK_DEV_IDETAPE is not set | ||
423 | # CONFIG_BLK_DEV_IDEACPI is not set | ||
424 | # CONFIG_IDE_TASK_IOCTL is not set | ||
425 | CONFIG_IDE_PROC_FS=y | ||
426 | |||
427 | # | ||
428 | # IDE chipset support/bugfixes | ||
429 | # | ||
430 | # CONFIG_IDE_GENERIC is not set | ||
431 | # CONFIG_BLK_DEV_PLATFORM is not set | ||
432 | # CONFIG_BLK_DEV_IDEPNP is not set | ||
433 | CONFIG_BLK_DEV_IDEDMA_SFF=y | ||
434 | |||
435 | # | ||
436 | # PCI IDE chipsets support | ||
437 | # | ||
438 | CONFIG_BLK_DEV_IDEPCI=y | ||
439 | CONFIG_IDEPCI_PCIBUS_ORDER=y | ||
440 | # CONFIG_BLK_DEV_OFFBOARD is not set | ||
441 | CONFIG_BLK_DEV_GENERIC=y | ||
442 | # CONFIG_BLK_DEV_OPTI621 is not set | ||
443 | CONFIG_BLK_DEV_IDEDMA_PCI=y | ||
444 | # CONFIG_BLK_DEV_AEC62XX is not set | ||
445 | # CONFIG_BLK_DEV_ALI15X3 is not set | ||
446 | # CONFIG_BLK_DEV_AMD74XX is not set | ||
447 | CONFIG_BLK_DEV_CMD64X=y | ||
448 | # CONFIG_BLK_DEV_TRIFLEX is not set | ||
449 | # CONFIG_BLK_DEV_CS5520 is not set | ||
450 | # CONFIG_BLK_DEV_CS5530 is not set | ||
451 | # CONFIG_BLK_DEV_HPT366 is not set | ||
452 | # CONFIG_BLK_DEV_JMICRON is not set | ||
453 | # CONFIG_BLK_DEV_SC1200 is not set | ||
454 | CONFIG_BLK_DEV_PIIX=y | ||
455 | # CONFIG_BLK_DEV_IT8172 is not set | ||
456 | # CONFIG_BLK_DEV_IT8213 is not set | ||
457 | # CONFIG_BLK_DEV_IT821X is not set | ||
458 | # CONFIG_BLK_DEV_NS87415 is not set | ||
459 | # CONFIG_BLK_DEV_PDC202XX_OLD is not set | ||
460 | # CONFIG_BLK_DEV_PDC202XX_NEW is not set | ||
461 | # CONFIG_BLK_DEV_SVWKS is not set | ||
462 | # CONFIG_BLK_DEV_SIIMAGE is not set | ||
463 | # CONFIG_BLK_DEV_SLC90E66 is not set | ||
464 | # CONFIG_BLK_DEV_TRM290 is not set | ||
465 | # CONFIG_BLK_DEV_VIA82CXXX is not set | ||
466 | # CONFIG_BLK_DEV_TC86C001 is not set | ||
467 | CONFIG_BLK_DEV_IDEDMA=y | ||
468 | |||
469 | # | ||
470 | # SCSI device support | ||
471 | # | ||
472 | # CONFIG_RAID_ATTRS is not set | ||
473 | CONFIG_SCSI=y | ||
474 | CONFIG_SCSI_DMA=y | ||
475 | # CONFIG_SCSI_TGT is not set | ||
476 | CONFIG_SCSI_NETLINK=y | ||
477 | CONFIG_SCSI_PROC_FS=y | ||
478 | |||
479 | # | ||
480 | # SCSI support type (disk, tape, CD-ROM) | ||
481 | # | ||
482 | CONFIG_BLK_DEV_SD=y | ||
483 | CONFIG_CHR_DEV_ST=m | ||
484 | # CONFIG_CHR_DEV_OSST is not set | ||
485 | CONFIG_BLK_DEV_SR=m | ||
486 | # CONFIG_BLK_DEV_SR_VENDOR is not set | ||
487 | CONFIG_CHR_DEV_SG=m | ||
488 | # CONFIG_CHR_DEV_SCH is not set | ||
489 | |||
490 | # | ||
491 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs | ||
492 | # | ||
493 | # CONFIG_SCSI_MULTI_LUN is not set | ||
494 | # CONFIG_SCSI_CONSTANTS is not set | ||
495 | # CONFIG_SCSI_LOGGING is not set | ||
496 | # CONFIG_SCSI_SCAN_ASYNC is not set | ||
497 | CONFIG_SCSI_WAIT_SCAN=m | ||
498 | |||
499 | # | ||
500 | # SCSI Transports | ||
501 | # | ||
502 | CONFIG_SCSI_SPI_ATTRS=y | ||
503 | CONFIG_SCSI_FC_ATTRS=y | ||
504 | # CONFIG_SCSI_ISCSI_ATTRS is not set | ||
505 | # CONFIG_SCSI_SAS_LIBSAS is not set | ||
506 | # CONFIG_SCSI_SRP_ATTRS is not set | ||
507 | CONFIG_SCSI_LOWLEVEL=y | ||
508 | # CONFIG_ISCSI_TCP is not set | ||
509 | # CONFIG_SCSI_CXGB3_ISCSI is not set | ||
510 | # CONFIG_BLK_DEV_3W_XXXX_RAID is not set | ||
511 | # CONFIG_SCSI_3W_9XXX is not set | ||
512 | # CONFIG_SCSI_ACARD is not set | ||
513 | # CONFIG_SCSI_AACRAID is not set | ||
514 | # CONFIG_SCSI_AIC7XXX is not set | ||
515 | # CONFIG_SCSI_AIC7XXX_OLD is not set | ||
516 | # CONFIG_SCSI_AIC79XX is not set | ||
517 | # CONFIG_SCSI_AIC94XX is not set | ||
518 | # CONFIG_SCSI_DPT_I2O is not set | ||
519 | # CONFIG_SCSI_ADVANSYS is not set | ||
520 | # CONFIG_SCSI_ARCMSR is not set | ||
521 | # CONFIG_MEGARAID_NEWGEN is not set | ||
522 | # CONFIG_MEGARAID_LEGACY is not set | ||
523 | # CONFIG_MEGARAID_SAS is not set | ||
524 | # CONFIG_SCSI_HPTIOP is not set | ||
525 | # CONFIG_LIBFC is not set | ||
526 | # CONFIG_FCOE is not set | ||
527 | # CONFIG_SCSI_DMX3191D is not set | ||
528 | # CONFIG_SCSI_FUTURE_DOMAIN is not set | ||
529 | # CONFIG_SCSI_IPS is not set | ||
530 | # CONFIG_SCSI_INITIO is not set | ||
531 | # CONFIG_SCSI_INIA100 is not set | ||
532 | # CONFIG_SCSI_MVSAS is not set | ||
533 | # CONFIG_SCSI_STEX is not set | ||
534 | CONFIG_SCSI_SYM53C8XX_2=y | ||
535 | CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1 | ||
536 | CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 | ||
537 | CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 | ||
538 | CONFIG_SCSI_SYM53C8XX_MMIO=y | ||
539 | CONFIG_SCSI_QLOGIC_1280=y | ||
540 | # CONFIG_SCSI_QLA_FC is not set | ||
541 | # CONFIG_SCSI_QLA_ISCSI is not set | ||
542 | # CONFIG_SCSI_LPFC is not set | ||
543 | # CONFIG_SCSI_DC395x is not set | ||
544 | # CONFIG_SCSI_DC390T is not set | ||
545 | # CONFIG_SCSI_DEBUG is not set | ||
546 | # CONFIG_SCSI_SRP is not set | ||
547 | # CONFIG_SCSI_DH is not set | ||
548 | # CONFIG_ATA is not set | ||
549 | CONFIG_MD=y | ||
550 | CONFIG_BLK_DEV_MD=m | ||
551 | CONFIG_MD_LINEAR=m | ||
552 | CONFIG_MD_RAID0=m | ||
553 | CONFIG_MD_RAID1=m | ||
554 | # CONFIG_MD_RAID10 is not set | ||
555 | # CONFIG_MD_RAID456 is not set | ||
556 | CONFIG_MD_MULTIPATH=m | ||
557 | # CONFIG_MD_FAULTY is not set | ||
558 | CONFIG_BLK_DEV_DM=m | ||
559 | # CONFIG_DM_DEBUG is not set | ||
560 | CONFIG_DM_CRYPT=m | ||
561 | CONFIG_DM_SNAPSHOT=m | ||
562 | CONFIG_DM_MIRROR=m | ||
563 | CONFIG_DM_ZERO=m | ||
564 | # CONFIG_DM_MULTIPATH is not set | ||
565 | # CONFIG_DM_DELAY is not set | ||
566 | # CONFIG_DM_UEVENT is not set | ||
567 | CONFIG_FUSION=y | ||
568 | CONFIG_FUSION_SPI=y | ||
569 | CONFIG_FUSION_FC=y | ||
570 | # CONFIG_FUSION_SAS is not set | ||
571 | CONFIG_FUSION_MAX_SGE=128 | ||
572 | CONFIG_FUSION_CTL=y | ||
573 | # CONFIG_FUSION_LOGGING is not set | ||
574 | |||
575 | # | ||
576 | # IEEE 1394 (FireWire) support | ||
577 | # | ||
578 | |||
579 | # | ||
580 | # Enable only one of the two stacks, unless you know what you are doing | ||
581 | # | ||
582 | # CONFIG_FIREWIRE is not set | ||
583 | # CONFIG_IEEE1394 is not set | ||
584 | # CONFIG_I2O is not set | ||
585 | CONFIG_NETDEVICES=y | ||
586 | CONFIG_DUMMY=m | ||
587 | # CONFIG_BONDING is not set | ||
588 | # CONFIG_MACVLAN is not set | ||
589 | # CONFIG_EQUALIZER is not set | ||
590 | # CONFIG_TUN is not set | ||
591 | # CONFIG_VETH is not set | ||
592 | # CONFIG_NET_SB1000 is not set | ||
593 | # CONFIG_ARCNET is not set | ||
594 | CONFIG_PHYLIB=y | ||
595 | |||
596 | # | ||
597 | # MII PHY device drivers | ||
598 | # | ||
599 | # CONFIG_MARVELL_PHY is not set | ||
600 | # CONFIG_DAVICOM_PHY is not set | ||
601 | # CONFIG_QSEMI_PHY is not set | ||
602 | # CONFIG_LXT_PHY is not set | ||
603 | # CONFIG_CICADA_PHY is not set | ||
604 | # CONFIG_VITESSE_PHY is not set | ||
605 | # CONFIG_SMSC_PHY is not set | ||
606 | # CONFIG_BROADCOM_PHY is not set | ||
607 | # CONFIG_ICPLUS_PHY is not set | ||
608 | # CONFIG_REALTEK_PHY is not set | ||
609 | # CONFIG_NATIONAL_PHY is not set | ||
610 | # CONFIG_STE10XP is not set | ||
611 | # CONFIG_LSI_ET1011C_PHY is not set | ||
612 | # CONFIG_FIXED_PHY is not set | ||
613 | # CONFIG_MDIO_BITBANG is not set | ||
614 | CONFIG_NET_ETHERNET=y | ||
615 | CONFIG_MII=m | ||
616 | # CONFIG_HAPPYMEAL is not set | ||
617 | # CONFIG_SUNGEM is not set | ||
618 | # CONFIG_CASSINI is not set | ||
619 | # CONFIG_NET_VENDOR_3COM is not set | ||
620 | CONFIG_NET_TULIP=y | ||
621 | # CONFIG_DE2104X is not set | ||
622 | CONFIG_TULIP=m | ||
623 | # CONFIG_TULIP_MWI is not set | ||
624 | # CONFIG_TULIP_MMIO is not set | ||
625 | # CONFIG_TULIP_NAPI is not set | ||
626 | # CONFIG_DE4X5 is not set | ||
627 | # CONFIG_WINBOND_840 is not set | ||
628 | # CONFIG_DM9102 is not set | ||
629 | # CONFIG_ULI526X is not set | ||
630 | # CONFIG_HP100 is not set | ||
631 | # CONFIG_IBM_NEW_EMAC_ZMII is not set | ||
632 | # CONFIG_IBM_NEW_EMAC_RGMII is not set | ||
633 | # CONFIG_IBM_NEW_EMAC_TAH is not set | ||
634 | # CONFIG_IBM_NEW_EMAC_EMAC4 is not set | ||
635 | # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set | ||
636 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set | ||
637 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set | ||
638 | CONFIG_NET_PCI=y | ||
639 | # CONFIG_PCNET32 is not set | ||
640 | # CONFIG_AMD8111_ETH is not set | ||
641 | # CONFIG_ADAPTEC_STARFIRE is not set | ||
642 | # CONFIG_B44 is not set | ||
643 | # CONFIG_FORCEDETH is not set | ||
644 | CONFIG_E100=m | ||
645 | # CONFIG_FEALNX is not set | ||
646 | # CONFIG_NATSEMI is not set | ||
647 | # CONFIG_NE2K_PCI is not set | ||
648 | # CONFIG_8139CP is not set | ||
649 | # CONFIG_8139TOO is not set | ||
650 | # CONFIG_R6040 is not set | ||
651 | # CONFIG_SIS900 is not set | ||
652 | # CONFIG_EPIC100 is not set | ||
653 | # CONFIG_SMSC9420 is not set | ||
654 | # CONFIG_SUNDANCE is not set | ||
655 | # CONFIG_TLAN is not set | ||
656 | # CONFIG_VIA_RHINE is not set | ||
657 | # CONFIG_SC92031 is not set | ||
658 | # CONFIG_ATL2 is not set | ||
659 | CONFIG_NETDEV_1000=y | ||
660 | # CONFIG_ACENIC is not set | ||
661 | # CONFIG_DL2K is not set | ||
662 | CONFIG_E1000=y | ||
663 | # CONFIG_E1000E is not set | ||
664 | # CONFIG_IP1000 is not set | ||
665 | # CONFIG_IGB is not set | ||
666 | # CONFIG_NS83820 is not set | ||
667 | # CONFIG_HAMACHI is not set | ||
668 | # CONFIG_YELLOWFIN is not set | ||
669 | # CONFIG_R8169 is not set | ||
670 | # CONFIG_SIS190 is not set | ||
671 | # CONFIG_SKGE is not set | ||
672 | # CONFIG_SKY2 is not set | ||
673 | # CONFIG_VIA_VELOCITY is not set | ||
674 | CONFIG_TIGON3=y | ||
675 | # CONFIG_BNX2 is not set | ||
676 | # CONFIG_QLA3XXX is not set | ||
677 | # CONFIG_ATL1 is not set | ||
678 | # CONFIG_ATL1E is not set | ||
679 | # CONFIG_JME is not set | ||
680 | CONFIG_NETDEV_10000=y | ||
681 | # CONFIG_CHELSIO_T1 is not set | ||
682 | CONFIG_CHELSIO_T3_DEPENDS=y | ||
683 | # CONFIG_CHELSIO_T3 is not set | ||
684 | # CONFIG_ENIC is not set | ||
685 | # CONFIG_IXGBE is not set | ||
686 | # CONFIG_IXGB is not set | ||
687 | # CONFIG_S2IO is not set | ||
688 | # CONFIG_MYRI10GE is not set | ||
689 | # CONFIG_NETXEN_NIC is not set | ||
690 | # CONFIG_NIU is not set | ||
691 | # CONFIG_MLX4_EN is not set | ||
692 | # CONFIG_MLX4_CORE is not set | ||
693 | # CONFIG_TEHUTI is not set | ||
694 | # CONFIG_BNX2X is not set | ||
695 | # CONFIG_QLGE is not set | ||
696 | # CONFIG_SFC is not set | ||
697 | # CONFIG_TR is not set | ||
698 | |||
699 | # | ||
700 | # Wireless LAN | ||
701 | # | ||
702 | # CONFIG_WLAN_PRE80211 is not set | ||
703 | # CONFIG_WLAN_80211 is not set | ||
704 | # CONFIG_IWLWIFI_LEDS is not set | ||
705 | |||
706 | # | ||
707 | # Enable WiMAX (Networking options) to see the WiMAX drivers | ||
708 | # | ||
709 | |||
710 | # | ||
711 | # USB Network Adapters | ||
712 | # | ||
713 | # CONFIG_USB_CATC is not set | ||
714 | # CONFIG_USB_KAWETH is not set | ||
715 | # CONFIG_USB_PEGASUS is not set | ||
716 | # CONFIG_USB_RTL8150 is not set | ||
717 | # CONFIG_USB_USBNET is not set | ||
718 | # CONFIG_WAN is not set | ||
719 | CONFIG_XEN_NETDEV_FRONTEND=y | ||
720 | # CONFIG_FDDI is not set | ||
721 | # CONFIG_HIPPI is not set | ||
722 | # CONFIG_PPP is not set | ||
723 | # CONFIG_SLIP is not set | ||
724 | # CONFIG_NET_FC is not set | ||
725 | CONFIG_NETCONSOLE=y | ||
726 | # CONFIG_NETCONSOLE_DYNAMIC is not set | ||
727 | CONFIG_NETPOLL=y | ||
728 | # CONFIG_NETPOLL_TRAP is not set | ||
729 | CONFIG_NET_POLL_CONTROLLER=y | ||
730 | # CONFIG_ISDN is not set | ||
731 | # CONFIG_PHONE is not set | ||
732 | |||
733 | # | ||
734 | # Input device support | ||
735 | # | ||
736 | CONFIG_INPUT=y | ||
737 | # CONFIG_INPUT_FF_MEMLESS is not set | ||
738 | # CONFIG_INPUT_POLLDEV is not set | ||
739 | |||
740 | # | ||
741 | # Userland interfaces | ||
742 | # | ||
743 | CONFIG_INPUT_MOUSEDEV=y | ||
744 | CONFIG_INPUT_MOUSEDEV_PSAUX=y | ||
745 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 | ||
746 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 | ||
747 | # CONFIG_INPUT_JOYDEV is not set | ||
748 | # CONFIG_INPUT_EVDEV is not set | ||
749 | # CONFIG_INPUT_EVBUG is not set | ||
750 | |||
751 | # | ||
752 | # Input Device Drivers | ||
753 | # | ||
754 | CONFIG_INPUT_KEYBOARD=y | ||
755 | CONFIG_KEYBOARD_ATKBD=y | ||
756 | # CONFIG_KEYBOARD_SUNKBD is not set | ||
757 | # CONFIG_KEYBOARD_LKKBD is not set | ||
758 | # CONFIG_KEYBOARD_XTKBD is not set | ||
759 | # CONFIG_KEYBOARD_NEWTON is not set | ||
760 | # CONFIG_KEYBOARD_STOWAWAY is not set | ||
761 | CONFIG_INPUT_MOUSE=y | ||
762 | CONFIG_MOUSE_PS2=y | ||
763 | CONFIG_MOUSE_PS2_ALPS=y | ||
764 | CONFIG_MOUSE_PS2_LOGIPS2PP=y | ||
765 | CONFIG_MOUSE_PS2_SYNAPTICS=y | ||
766 | CONFIG_MOUSE_PS2_LIFEBOOK=y | ||
767 | CONFIG_MOUSE_PS2_TRACKPOINT=y | ||
768 | # CONFIG_MOUSE_PS2_ELANTECH is not set | ||
769 | # CONFIG_MOUSE_PS2_TOUCHKIT is not set | ||
770 | # CONFIG_MOUSE_SERIAL is not set | ||
771 | # CONFIG_MOUSE_APPLETOUCH is not set | ||
772 | # CONFIG_MOUSE_BCM5974 is not set | ||
773 | # CONFIG_MOUSE_VSXXXAA is not set | ||
774 | # CONFIG_INPUT_JOYSTICK is not set | ||
775 | # CONFIG_INPUT_TABLET is not set | ||
776 | # CONFIG_INPUT_TOUCHSCREEN is not set | ||
777 | # CONFIG_INPUT_MISC is not set | ||
778 | |||
779 | # | ||
780 | # Hardware I/O ports | ||
781 | # | ||
782 | CONFIG_SERIO=y | ||
783 | CONFIG_SERIO_I8042=y | ||
784 | # CONFIG_SERIO_SERPORT is not set | ||
785 | # CONFIG_SERIO_PCIPS2 is not set | ||
786 | CONFIG_SERIO_LIBPS2=y | ||
787 | # CONFIG_SERIO_RAW is not set | ||
788 | CONFIG_GAMEPORT=m | ||
789 | # CONFIG_GAMEPORT_NS558 is not set | ||
790 | # CONFIG_GAMEPORT_L4 is not set | ||
791 | # CONFIG_GAMEPORT_EMU10K1 is not set | ||
792 | # CONFIG_GAMEPORT_FM801 is not set | ||
793 | |||
794 | # | ||
795 | # Character devices | ||
796 | # | ||
797 | CONFIG_VT=y | ||
798 | CONFIG_CONSOLE_TRANSLATIONS=y | ||
799 | CONFIG_VT_CONSOLE=y | ||
800 | CONFIG_HW_CONSOLE=y | ||
801 | # CONFIG_VT_HW_CONSOLE_BINDING is not set | ||
802 | CONFIG_DEVKMEM=y | ||
803 | CONFIG_SERIAL_NONSTANDARD=y | ||
804 | # CONFIG_COMPUTONE is not set | ||
805 | # CONFIG_ROCKETPORT is not set | ||
806 | # CONFIG_CYCLADES is not set | ||
807 | # CONFIG_DIGIEPCA is not set | ||
808 | # CONFIG_MOXA_INTELLIO is not set | ||
809 | # CONFIG_MOXA_SMARTIO is not set | ||
810 | # CONFIG_ISI is not set | ||
811 | # CONFIG_SYNCLINKMP is not set | ||
812 | # CONFIG_SYNCLINK_GT is not set | ||
813 | # CONFIG_N_HDLC is not set | ||
814 | # CONFIG_RISCOM8 is not set | ||
815 | # CONFIG_SPECIALIX is not set | ||
816 | # CONFIG_SX is not set | ||
817 | # CONFIG_RIO is not set | ||
818 | # CONFIG_STALDRV is not set | ||
819 | # CONFIG_NOZOMI is not set | ||
820 | |||
821 | # | ||
822 | # Serial drivers | ||
823 | # | ||
824 | CONFIG_SERIAL_8250=y | ||
825 | CONFIG_SERIAL_8250_CONSOLE=y | ||
826 | CONFIG_SERIAL_8250_PCI=y | ||
827 | CONFIG_SERIAL_8250_PNP=y | ||
828 | CONFIG_SERIAL_8250_NR_UARTS=6 | ||
829 | CONFIG_SERIAL_8250_RUNTIME_UARTS=4 | ||
830 | CONFIG_SERIAL_8250_EXTENDED=y | ||
831 | CONFIG_SERIAL_8250_SHARE_IRQ=y | ||
832 | # CONFIG_SERIAL_8250_DETECT_IRQ is not set | ||
833 | # CONFIG_SERIAL_8250_RSA is not set | ||
834 | |||
835 | # | ||
836 | # Non-8250 serial port support | ||
837 | # | ||
838 | CONFIG_SERIAL_CORE=y | ||
839 | CONFIG_SERIAL_CORE_CONSOLE=y | ||
840 | # CONFIG_SERIAL_JSM is not set | ||
841 | CONFIG_UNIX98_PTYS=y | ||
842 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set | ||
843 | CONFIG_LEGACY_PTYS=y | ||
844 | CONFIG_LEGACY_PTY_COUNT=256 | ||
845 | CONFIG_HVC_DRIVER=y | ||
846 | CONFIG_HVC_IRQ=y | ||
847 | CONFIG_HVC_XEN=y | ||
848 | # CONFIG_IPMI_HANDLER is not set | ||
849 | # CONFIG_HW_RANDOM is not set | ||
850 | CONFIG_EFI_RTC=y | ||
851 | # CONFIG_R3964 is not set | ||
852 | # CONFIG_APPLICOM is not set | ||
853 | CONFIG_RAW_DRIVER=m | ||
854 | CONFIG_MAX_RAW_DEVS=256 | ||
855 | CONFIG_HPET=y | ||
856 | CONFIG_HPET_MMAP=y | ||
857 | # CONFIG_HANGCHECK_TIMER is not set | ||
858 | # CONFIG_TCG_TPM is not set | ||
859 | CONFIG_DEVPORT=y | ||
860 | CONFIG_I2C=m | ||
861 | CONFIG_I2C_BOARDINFO=y | ||
862 | # CONFIG_I2C_CHARDEV is not set | ||
863 | CONFIG_I2C_HELPER_AUTO=y | ||
864 | CONFIG_I2C_ALGOBIT=m | ||
865 | |||
866 | # | ||
867 | # I2C Hardware Bus support | ||
868 | # | ||
869 | |||
870 | # | ||
871 | # PC SMBus host controller drivers | ||
872 | # | ||
873 | # CONFIG_I2C_ALI1535 is not set | ||
874 | # CONFIG_I2C_ALI1563 is not set | ||
875 | # CONFIG_I2C_ALI15X3 is not set | ||
876 | # CONFIG_I2C_AMD756 is not set | ||
877 | # CONFIG_I2C_AMD8111 is not set | ||
878 | # CONFIG_I2C_I801 is not set | ||
879 | # CONFIG_I2C_ISCH is not set | ||
880 | # CONFIG_I2C_PIIX4 is not set | ||
881 | # CONFIG_I2C_NFORCE2 is not set | ||
882 | # CONFIG_I2C_SIS5595 is not set | ||
883 | # CONFIG_I2C_SIS630 is not set | ||
884 | # CONFIG_I2C_SIS96X is not set | ||
885 | # CONFIG_I2C_VIA is not set | ||
886 | # CONFIG_I2C_VIAPRO is not set | ||
887 | |||
888 | # | ||
889 | # I2C system bus drivers (mostly embedded / system-on-chip) | ||
890 | # | ||
891 | # CONFIG_I2C_OCORES is not set | ||
892 | # CONFIG_I2C_SIMTEC is not set | ||
893 | |||
894 | # | ||
895 | # External I2C/SMBus adapter drivers | ||
896 | # | ||
897 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
898 | # CONFIG_I2C_TAOS_EVM is not set | ||
899 | # CONFIG_I2C_TINY_USB is not set | ||
900 | |||
901 | # | ||
902 | # Graphics adapter I2C/DDC channel drivers | ||
903 | # | ||
904 | # CONFIG_I2C_VOODOO3 is not set | ||
905 | |||
906 | # | ||
907 | # Other I2C/SMBus bus drivers | ||
908 | # | ||
909 | # CONFIG_I2C_PCA_PLATFORM is not set | ||
910 | # CONFIG_I2C_STUB is not set | ||
911 | |||
912 | # | ||
913 | # Miscellaneous I2C Chip support | ||
914 | # | ||
915 | # CONFIG_DS1682 is not set | ||
916 | # CONFIG_AT24 is not set | ||
917 | # CONFIG_SENSORS_EEPROM is not set | ||
918 | # CONFIG_SENSORS_PCF8574 is not set | ||
919 | # CONFIG_PCF8575 is not set | ||
920 | # CONFIG_SENSORS_PCA9539 is not set | ||
921 | # CONFIG_SENSORS_PCF8591 is not set | ||
922 | # CONFIG_SENSORS_MAX6875 is not set | ||
923 | # CONFIG_SENSORS_TSL2550 is not set | ||
924 | # CONFIG_I2C_DEBUG_CORE is not set | ||
925 | # CONFIG_I2C_DEBUG_ALGO is not set | ||
926 | # CONFIG_I2C_DEBUG_BUS is not set | ||
927 | # CONFIG_I2C_DEBUG_CHIP is not set | ||
928 | # CONFIG_SPI is not set | ||
929 | # CONFIG_W1 is not set | ||
930 | CONFIG_POWER_SUPPLY=y | ||
931 | # CONFIG_POWER_SUPPLY_DEBUG is not set | ||
932 | # CONFIG_PDA_POWER is not set | ||
933 | # CONFIG_BATTERY_DS2760 is not set | ||
934 | # CONFIG_BATTERY_BQ27x00 is not set | ||
935 | CONFIG_HWMON=y | ||
936 | # CONFIG_HWMON_VID is not set | ||
937 | # CONFIG_SENSORS_AD7414 is not set | ||
938 | # CONFIG_SENSORS_AD7418 is not set | ||
939 | # CONFIG_SENSORS_ADM1021 is not set | ||
940 | # CONFIG_SENSORS_ADM1025 is not set | ||
941 | # CONFIG_SENSORS_ADM1026 is not set | ||
942 | # CONFIG_SENSORS_ADM1029 is not set | ||
943 | # CONFIG_SENSORS_ADM1031 is not set | ||
944 | # CONFIG_SENSORS_ADM9240 is not set | ||
945 | # CONFIG_SENSORS_ADT7462 is not set | ||
946 | # CONFIG_SENSORS_ADT7470 is not set | ||
947 | # CONFIG_SENSORS_ADT7473 is not set | ||
948 | # CONFIG_SENSORS_ATXP1 is not set | ||
949 | # CONFIG_SENSORS_DS1621 is not set | ||
950 | # CONFIG_SENSORS_I5K_AMB is not set | ||
951 | # CONFIG_SENSORS_F71805F is not set | ||
952 | # CONFIG_SENSORS_F71882FG is not set | ||
953 | # CONFIG_SENSORS_F75375S is not set | ||
954 | # CONFIG_SENSORS_GL518SM is not set | ||
955 | # CONFIG_SENSORS_GL520SM is not set | ||
956 | # CONFIG_SENSORS_IT87 is not set | ||
957 | # CONFIG_SENSORS_LM63 is not set | ||
958 | # CONFIG_SENSORS_LM75 is not set | ||
959 | # CONFIG_SENSORS_LM77 is not set | ||
960 | # CONFIG_SENSORS_LM78 is not set | ||
961 | # CONFIG_SENSORS_LM80 is not set | ||
962 | # CONFIG_SENSORS_LM83 is not set | ||
963 | # CONFIG_SENSORS_LM85 is not set | ||
964 | # CONFIG_SENSORS_LM87 is not set | ||
965 | # CONFIG_SENSORS_LM90 is not set | ||
966 | # CONFIG_SENSORS_LM92 is not set | ||
967 | # CONFIG_SENSORS_LM93 is not set | ||
968 | # CONFIG_SENSORS_LTC4245 is not set | ||
969 | # CONFIG_SENSORS_MAX1619 is not set | ||
970 | # CONFIG_SENSORS_MAX6650 is not set | ||
971 | # CONFIG_SENSORS_PC87360 is not set | ||
972 | # CONFIG_SENSORS_PC87427 is not set | ||
973 | # CONFIG_SENSORS_SIS5595 is not set | ||
974 | # CONFIG_SENSORS_DME1737 is not set | ||
975 | # CONFIG_SENSORS_SMSC47M1 is not set | ||
976 | # CONFIG_SENSORS_SMSC47M192 is not set | ||
977 | # CONFIG_SENSORS_SMSC47B397 is not set | ||
978 | # CONFIG_SENSORS_ADS7828 is not set | ||
979 | # CONFIG_SENSORS_THMC50 is not set | ||
980 | # CONFIG_SENSORS_VIA686A is not set | ||
981 | # CONFIG_SENSORS_VT1211 is not set | ||
982 | # CONFIG_SENSORS_VT8231 is not set | ||
983 | # CONFIG_SENSORS_W83781D is not set | ||
984 | # CONFIG_SENSORS_W83791D is not set | ||
985 | # CONFIG_SENSORS_W83792D is not set | ||
986 | # CONFIG_SENSORS_W83793 is not set | ||
987 | # CONFIG_SENSORS_W83L785TS is not set | ||
988 | # CONFIG_SENSORS_W83L786NG is not set | ||
989 | # CONFIG_SENSORS_W83627HF is not set | ||
990 | # CONFIG_SENSORS_W83627EHF is not set | ||
991 | # CONFIG_SENSORS_LIS3LV02D is not set | ||
992 | # CONFIG_HWMON_DEBUG_CHIP is not set | ||
993 | CONFIG_THERMAL=m | ||
994 | # CONFIG_THERMAL_HWMON is not set | ||
995 | # CONFIG_WATCHDOG is not set | ||
996 | CONFIG_SSB_POSSIBLE=y | ||
997 | |||
998 | # | ||
999 | # Sonics Silicon Backplane | ||
1000 | # | ||
1001 | # CONFIG_SSB is not set | ||
1002 | |||
1003 | # | ||
1004 | # Multifunction device drivers | ||
1005 | # | ||
1006 | # CONFIG_MFD_CORE is not set | ||
1007 | # CONFIG_MFD_SM501 is not set | ||
1008 | # CONFIG_HTC_PASIC3 is not set | ||
1009 | # CONFIG_MFD_TMIO is not set | ||
1010 | # CONFIG_MFD_WM8400 is not set | ||
1011 | # CONFIG_MFD_WM8350_I2C is not set | ||
1012 | # CONFIG_MFD_PCF50633 is not set | ||
1013 | # CONFIG_REGULATOR is not set | ||
1014 | |||
1015 | # | ||
1016 | # Multimedia devices | ||
1017 | # | ||
1018 | |||
1019 | # | ||
1020 | # Multimedia core support | ||
1021 | # | ||
1022 | # CONFIG_VIDEO_DEV is not set | ||
1023 | # CONFIG_DVB_CORE is not set | ||
1024 | # CONFIG_VIDEO_MEDIA is not set | ||
1025 | |||
1026 | # | ||
1027 | # Multimedia drivers | ||
1028 | # | ||
1029 | CONFIG_DAB=y | ||
1030 | # CONFIG_USB_DABUSB is not set | ||
1031 | |||
1032 | # | ||
1033 | # Graphics support | ||
1034 | # | ||
1035 | CONFIG_AGP=m | ||
1036 | CONFIG_DRM=m | ||
1037 | CONFIG_DRM_TDFX=m | ||
1038 | CONFIG_DRM_R128=m | ||
1039 | CONFIG_DRM_RADEON=m | ||
1040 | CONFIG_DRM_MGA=m | ||
1041 | CONFIG_DRM_SIS=m | ||
1042 | # CONFIG_DRM_VIA is not set | ||
1043 | # CONFIG_DRM_SAVAGE is not set | ||
1044 | # CONFIG_VGASTATE is not set | ||
1045 | # CONFIG_VIDEO_OUTPUT_CONTROL is not set | ||
1046 | # CONFIG_FB is not set | ||
1047 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set | ||
1048 | |||
1049 | # | ||
1050 | # Display device support | ||
1051 | # | ||
1052 | # CONFIG_DISPLAY_SUPPORT is not set | ||
1053 | |||
1054 | # | ||
1055 | # Console display driver support | ||
1056 | # | ||
1057 | CONFIG_VGA_CONSOLE=y | ||
1058 | # CONFIG_VGACON_SOFT_SCROLLBACK is not set | ||
1059 | CONFIG_DUMMY_CONSOLE=y | ||
1060 | # CONFIG_SOUND is not set | ||
1061 | CONFIG_HID_SUPPORT=y | ||
1062 | CONFIG_HID=y | ||
1063 | # CONFIG_HID_DEBUG is not set | ||
1064 | # CONFIG_HIDRAW is not set | ||
1065 | |||
1066 | # | ||
1067 | # USB Input Devices | ||
1068 | # | ||
1069 | CONFIG_USB_HID=y | ||
1070 | # CONFIG_HID_PID is not set | ||
1071 | # CONFIG_USB_HIDDEV is not set | ||
1072 | |||
1073 | # | ||
1074 | # Special HID drivers | ||
1075 | # | ||
1076 | CONFIG_HID_COMPAT=y | ||
1077 | CONFIG_HID_A4TECH=y | ||
1078 | CONFIG_HID_APPLE=y | ||
1079 | CONFIG_HID_BELKIN=y | ||
1080 | CONFIG_HID_CHERRY=y | ||
1081 | CONFIG_HID_CHICONY=y | ||
1082 | CONFIG_HID_CYPRESS=y | ||
1083 | CONFIG_HID_EZKEY=y | ||
1084 | CONFIG_HID_GYRATION=y | ||
1085 | CONFIG_HID_LOGITECH=y | ||
1086 | # CONFIG_LOGITECH_FF is not set | ||
1087 | # CONFIG_LOGIRUMBLEPAD2_FF is not set | ||
1088 | CONFIG_HID_MICROSOFT=y | ||
1089 | CONFIG_HID_MONTEREY=y | ||
1090 | CONFIG_HID_NTRIG=y | ||
1091 | CONFIG_HID_PANTHERLORD=y | ||
1092 | # CONFIG_PANTHERLORD_FF is not set | ||
1093 | CONFIG_HID_PETALYNX=y | ||
1094 | CONFIG_HID_SAMSUNG=y | ||
1095 | CONFIG_HID_SONY=y | ||
1096 | CONFIG_HID_SUNPLUS=y | ||
1097 | # CONFIG_GREENASIA_FF is not set | ||
1098 | CONFIG_HID_TOPSEED=y | ||
1099 | # CONFIG_THRUSTMASTER_FF is not set | ||
1100 | # CONFIG_ZEROPLUS_FF is not set | ||
1101 | CONFIG_USB_SUPPORT=y | ||
1102 | CONFIG_USB_ARCH_HAS_HCD=y | ||
1103 | CONFIG_USB_ARCH_HAS_OHCI=y | ||
1104 | CONFIG_USB_ARCH_HAS_EHCI=y | ||
1105 | CONFIG_USB=y | ||
1106 | # CONFIG_USB_DEBUG is not set | ||
1107 | # CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set | ||
1108 | |||
1109 | # | ||
1110 | # Miscellaneous USB options | ||
1111 | # | ||
1112 | CONFIG_USB_DEVICEFS=y | ||
1113 | CONFIG_USB_DEVICE_CLASS=y | ||
1114 | # CONFIG_USB_DYNAMIC_MINORS is not set | ||
1115 | # CONFIG_USB_SUSPEND is not set | ||
1116 | # CONFIG_USB_OTG is not set | ||
1117 | # CONFIG_USB_MON is not set | ||
1118 | # CONFIG_USB_WUSB is not set | ||
1119 | # CONFIG_USB_WUSB_CBAF is not set | ||
1120 | |||
1121 | # | ||
1122 | # USB Host Controller Drivers | ||
1123 | # | ||
1124 | # CONFIG_USB_C67X00_HCD is not set | ||
1125 | CONFIG_USB_EHCI_HCD=m | ||
1126 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set | ||
1127 | # CONFIG_USB_EHCI_TT_NEWSCHED is not set | ||
1128 | # CONFIG_USB_OXU210HP_HCD is not set | ||
1129 | # CONFIG_USB_ISP116X_HCD is not set | ||
1130 | # CONFIG_USB_ISP1760_HCD is not set | ||
1131 | CONFIG_USB_OHCI_HCD=m | ||
1132 | # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set | ||
1133 | # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set | ||
1134 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y | ||
1135 | CONFIG_USB_UHCI_HCD=y | ||
1136 | # CONFIG_USB_SL811_HCD is not set | ||
1137 | # CONFIG_USB_R8A66597_HCD is not set | ||
1138 | # CONFIG_USB_WHCI_HCD is not set | ||
1139 | # CONFIG_USB_HWA_HCD is not set | ||
1140 | |||
1141 | # | ||
1142 | # USB Device Class drivers | ||
1143 | # | ||
1144 | # CONFIG_USB_ACM is not set | ||
1145 | # CONFIG_USB_PRINTER is not set | ||
1146 | # CONFIG_USB_WDM is not set | ||
1147 | # CONFIG_USB_TMC is not set | ||
1148 | |||
1149 | # | ||
1150 | # NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed; | ||
1151 | # | ||
1152 | |||
1153 | # | ||
1154 | # see USB_STORAGE Help for more information | ||
1155 | # | ||
1156 | CONFIG_USB_STORAGE=m | ||
1157 | # CONFIG_USB_STORAGE_DEBUG is not set | ||
1158 | # CONFIG_USB_STORAGE_DATAFAB is not set | ||
1159 | # CONFIG_USB_STORAGE_FREECOM is not set | ||
1160 | # CONFIG_USB_STORAGE_ISD200 is not set | ||
1161 | # CONFIG_USB_STORAGE_USBAT is not set | ||
1162 | # CONFIG_USB_STORAGE_SDDR09 is not set | ||
1163 | # CONFIG_USB_STORAGE_SDDR55 is not set | ||
1164 | # CONFIG_USB_STORAGE_JUMPSHOT is not set | ||
1165 | # CONFIG_USB_STORAGE_ALAUDA is not set | ||
1166 | # CONFIG_USB_STORAGE_ONETOUCH is not set | ||
1167 | # CONFIG_USB_STORAGE_KARMA is not set | ||
1168 | # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set | ||
1169 | # CONFIG_USB_LIBUSUAL is not set | ||
1170 | |||
1171 | # | ||
1172 | # USB Imaging devices | ||
1173 | # | ||
1174 | # CONFIG_USB_MDC800 is not set | ||
1175 | # CONFIG_USB_MICROTEK is not set | ||
1176 | |||
1177 | # | ||
1178 | # USB port drivers | ||
1179 | # | ||
1180 | # CONFIG_USB_SERIAL is not set | ||
1181 | |||
1182 | # | ||
1183 | # USB Miscellaneous drivers | ||
1184 | # | ||
1185 | # CONFIG_USB_EMI62 is not set | ||
1186 | # CONFIG_USB_EMI26 is not set | ||
1187 | # CONFIG_USB_ADUTUX is not set | ||
1188 | # CONFIG_USB_SEVSEG is not set | ||
1189 | # CONFIG_USB_RIO500 is not set | ||
1190 | # CONFIG_USB_LEGOTOWER is not set | ||
1191 | # CONFIG_USB_LCD is not set | ||
1192 | # CONFIG_USB_BERRY_CHARGE is not set | ||
1193 | # CONFIG_USB_LED is not set | ||
1194 | # CONFIG_USB_CYPRESS_CY7C63 is not set | ||
1195 | # CONFIG_USB_CYTHERM is not set | ||
1196 | # CONFIG_USB_PHIDGET is not set | ||
1197 | # CONFIG_USB_IDMOUSE is not set | ||
1198 | # CONFIG_USB_FTDI_ELAN is not set | ||
1199 | # CONFIG_USB_APPLEDISPLAY is not set | ||
1200 | # CONFIG_USB_SISUSBVGA is not set | ||
1201 | # CONFIG_USB_LD is not set | ||
1202 | # CONFIG_USB_TRANCEVIBRATOR is not set | ||
1203 | # CONFIG_USB_IOWARRIOR is not set | ||
1204 | # CONFIG_USB_TEST is not set | ||
1205 | # CONFIG_USB_ISIGHTFW is not set | ||
1206 | # CONFIG_USB_VST is not set | ||
1207 | # CONFIG_USB_GADGET is not set | ||
1208 | |||
1209 | # | ||
1210 | # OTG and related infrastructure | ||
1211 | # | ||
1212 | # CONFIG_UWB is not set | ||
1213 | # CONFIG_MMC is not set | ||
1214 | # CONFIG_MEMSTICK is not set | ||
1215 | # CONFIG_NEW_LEDS is not set | ||
1216 | # CONFIG_ACCESSIBILITY is not set | ||
1217 | # CONFIG_INFINIBAND is not set | ||
1218 | # CONFIG_RTC_CLASS is not set | ||
1219 | # CONFIG_DMADEVICES is not set | ||
1220 | # CONFIG_UIO is not set | ||
1221 | CONFIG_XEN_BALLOON=y | ||
1222 | CONFIG_XEN_SCRUB_PAGES=y | ||
1223 | CONFIG_XENFS=y | ||
1224 | CONFIG_XEN_COMPAT_XENFS=y | ||
1225 | # CONFIG_STAGING is not set | ||
1226 | # CONFIG_MSPEC is not set | ||
1227 | |||
1228 | # | ||
1229 | # File systems | ||
1230 | # | ||
1231 | CONFIG_EXT2_FS=y | ||
1232 | CONFIG_EXT2_FS_XATTR=y | ||
1233 | CONFIG_EXT2_FS_POSIX_ACL=y | ||
1234 | CONFIG_EXT2_FS_SECURITY=y | ||
1235 | # CONFIG_EXT2_FS_XIP is not set | ||
1236 | CONFIG_EXT3_FS=y | ||
1237 | CONFIG_EXT3_FS_XATTR=y | ||
1238 | CONFIG_EXT3_FS_POSIX_ACL=y | ||
1239 | CONFIG_EXT3_FS_SECURITY=y | ||
1240 | # CONFIG_EXT4_FS is not set | ||
1241 | CONFIG_JBD=y | ||
1242 | CONFIG_FS_MBCACHE=y | ||
1243 | CONFIG_REISERFS_FS=y | ||
1244 | # CONFIG_REISERFS_CHECK is not set | ||
1245 | # CONFIG_REISERFS_PROC_INFO is not set | ||
1246 | CONFIG_REISERFS_FS_XATTR=y | ||
1247 | CONFIG_REISERFS_FS_POSIX_ACL=y | ||
1248 | CONFIG_REISERFS_FS_SECURITY=y | ||
1249 | # CONFIG_JFS_FS is not set | ||
1250 | CONFIG_FS_POSIX_ACL=y | ||
1251 | CONFIG_FILE_LOCKING=y | ||
1252 | CONFIG_XFS_FS=y | ||
1253 | # CONFIG_XFS_QUOTA is not set | ||
1254 | # CONFIG_XFS_POSIX_ACL is not set | ||
1255 | # CONFIG_XFS_RT is not set | ||
1256 | # CONFIG_XFS_DEBUG is not set | ||
1257 | # CONFIG_GFS2_FS is not set | ||
1258 | # CONFIG_OCFS2_FS is not set | ||
1259 | # CONFIG_BTRFS_FS is not set | ||
1260 | CONFIG_DNOTIFY=y | ||
1261 | CONFIG_INOTIFY=y | ||
1262 | CONFIG_INOTIFY_USER=y | ||
1263 | # CONFIG_QUOTA is not set | ||
1264 | CONFIG_AUTOFS_FS=y | ||
1265 | CONFIG_AUTOFS4_FS=y | ||
1266 | # CONFIG_FUSE_FS is not set | ||
1267 | |||
1268 | # | ||
1269 | # CD-ROM/DVD Filesystems | ||
1270 | # | ||
1271 | CONFIG_ISO9660_FS=m | ||
1272 | CONFIG_JOLIET=y | ||
1273 | # CONFIG_ZISOFS is not set | ||
1274 | CONFIG_UDF_FS=m | ||
1275 | CONFIG_UDF_NLS=y | ||
1276 | |||
1277 | # | ||
1278 | # DOS/FAT/NT Filesystems | ||
1279 | # | ||
1280 | CONFIG_FAT_FS=y | ||
1281 | # CONFIG_MSDOS_FS is not set | ||
1282 | CONFIG_VFAT_FS=y | ||
1283 | CONFIG_FAT_DEFAULT_CODEPAGE=437 | ||
1284 | CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" | ||
1285 | CONFIG_NTFS_FS=m | ||
1286 | # CONFIG_NTFS_DEBUG is not set | ||
1287 | # CONFIG_NTFS_RW is not set | ||
1288 | |||
1289 | # | ||
1290 | # Pseudo filesystems | ||
1291 | # | ||
1292 | CONFIG_PROC_FS=y | ||
1293 | CONFIG_PROC_KCORE=y | ||
1294 | CONFIG_PROC_SYSCTL=y | ||
1295 | CONFIG_PROC_PAGE_MONITOR=y | ||
1296 | CONFIG_SYSFS=y | ||
1297 | CONFIG_TMPFS=y | ||
1298 | # CONFIG_TMPFS_POSIX_ACL is not set | ||
1299 | CONFIG_HUGETLBFS=y | ||
1300 | CONFIG_HUGETLB_PAGE=y | ||
1301 | # CONFIG_CONFIGFS_FS is not set | ||
1302 | CONFIG_MISC_FILESYSTEMS=y | ||
1303 | # CONFIG_ADFS_FS is not set | ||
1304 | # CONFIG_AFFS_FS is not set | ||
1305 | # CONFIG_HFS_FS is not set | ||
1306 | # CONFIG_HFSPLUS_FS is not set | ||
1307 | # CONFIG_BEFS_FS is not set | ||
1308 | # CONFIG_BFS_FS is not set | ||
1309 | # CONFIG_EFS_FS is not set | ||
1310 | # CONFIG_CRAMFS is not set | ||
1311 | # CONFIG_SQUASHFS is not set | ||
1312 | # CONFIG_VXFS_FS is not set | ||
1313 | # CONFIG_MINIX_FS is not set | ||
1314 | # CONFIG_OMFS_FS is not set | ||
1315 | # CONFIG_HPFS_FS is not set | ||
1316 | # CONFIG_QNX4FS_FS is not set | ||
1317 | # CONFIG_ROMFS_FS is not set | ||
1318 | # CONFIG_SYSV_FS is not set | ||
1319 | # CONFIG_UFS_FS is not set | ||
1320 | CONFIG_NETWORK_FILESYSTEMS=y | ||
1321 | CONFIG_NFS_FS=m | ||
1322 | CONFIG_NFS_V3=y | ||
1323 | # CONFIG_NFS_V3_ACL is not set | ||
1324 | CONFIG_NFS_V4=y | ||
1325 | CONFIG_NFSD=m | ||
1326 | CONFIG_NFSD_V3=y | ||
1327 | # CONFIG_NFSD_V3_ACL is not set | ||
1328 | CONFIG_NFSD_V4=y | ||
1329 | CONFIG_LOCKD=m | ||
1330 | CONFIG_LOCKD_V4=y | ||
1331 | CONFIG_EXPORTFS=m | ||
1332 | CONFIG_NFS_COMMON=y | ||
1333 | CONFIG_SUNRPC=m | ||
1334 | CONFIG_SUNRPC_GSS=m | ||
1335 | # CONFIG_SUNRPC_REGISTER_V4 is not set | ||
1336 | CONFIG_RPCSEC_GSS_KRB5=m | ||
1337 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | ||
1338 | CONFIG_SMB_FS=m | ||
1339 | CONFIG_SMB_NLS_DEFAULT=y | ||
1340 | CONFIG_SMB_NLS_REMOTE="cp437" | ||
1341 | CONFIG_CIFS=m | ||
1342 | # CONFIG_CIFS_STATS is not set | ||
1343 | # CONFIG_CIFS_WEAK_PW_HASH is not set | ||
1344 | # CONFIG_CIFS_XATTR is not set | ||
1345 | # CONFIG_CIFS_DEBUG2 is not set | ||
1346 | # CONFIG_CIFS_EXPERIMENTAL is not set | ||
1347 | # CONFIG_NCP_FS is not set | ||
1348 | # CONFIG_CODA_FS is not set | ||
1349 | # CONFIG_AFS_FS is not set | ||
1350 | |||
1351 | # | ||
1352 | # Partition Types | ||
1353 | # | ||
1354 | CONFIG_PARTITION_ADVANCED=y | ||
1355 | # CONFIG_ACORN_PARTITION is not set | ||
1356 | # CONFIG_OSF_PARTITION is not set | ||
1357 | # CONFIG_AMIGA_PARTITION is not set | ||
1358 | # CONFIG_ATARI_PARTITION is not set | ||
1359 | # CONFIG_MAC_PARTITION is not set | ||
1360 | CONFIG_MSDOS_PARTITION=y | ||
1361 | # CONFIG_BSD_DISKLABEL is not set | ||
1362 | # CONFIG_MINIX_SUBPARTITION is not set | ||
1363 | # CONFIG_SOLARIS_X86_PARTITION is not set | ||
1364 | # CONFIG_UNIXWARE_DISKLABEL is not set | ||
1365 | # CONFIG_LDM_PARTITION is not set | ||
1366 | CONFIG_SGI_PARTITION=y | ||
1367 | # CONFIG_ULTRIX_PARTITION is not set | ||
1368 | # CONFIG_SUN_PARTITION is not set | ||
1369 | # CONFIG_KARMA_PARTITION is not set | ||
1370 | CONFIG_EFI_PARTITION=y | ||
1371 | # CONFIG_SYSV68_PARTITION is not set | ||
1372 | CONFIG_NLS=y | ||
1373 | CONFIG_NLS_DEFAULT="iso8859-1" | ||
1374 | CONFIG_NLS_CODEPAGE_437=y | ||
1375 | CONFIG_NLS_CODEPAGE_737=m | ||
1376 | CONFIG_NLS_CODEPAGE_775=m | ||
1377 | CONFIG_NLS_CODEPAGE_850=m | ||
1378 | CONFIG_NLS_CODEPAGE_852=m | ||
1379 | CONFIG_NLS_CODEPAGE_855=m | ||
1380 | CONFIG_NLS_CODEPAGE_857=m | ||
1381 | CONFIG_NLS_CODEPAGE_860=m | ||
1382 | CONFIG_NLS_CODEPAGE_861=m | ||
1383 | CONFIG_NLS_CODEPAGE_862=m | ||
1384 | CONFIG_NLS_CODEPAGE_863=m | ||
1385 | CONFIG_NLS_CODEPAGE_864=m | ||
1386 | CONFIG_NLS_CODEPAGE_865=m | ||
1387 | CONFIG_NLS_CODEPAGE_866=m | ||
1388 | CONFIG_NLS_CODEPAGE_869=m | ||
1389 | CONFIG_NLS_CODEPAGE_936=m | ||
1390 | CONFIG_NLS_CODEPAGE_950=m | ||
1391 | CONFIG_NLS_CODEPAGE_932=m | ||
1392 | CONFIG_NLS_CODEPAGE_949=m | ||
1393 | CONFIG_NLS_CODEPAGE_874=m | ||
1394 | CONFIG_NLS_ISO8859_8=m | ||
1395 | CONFIG_NLS_CODEPAGE_1250=m | ||
1396 | CONFIG_NLS_CODEPAGE_1251=m | ||
1397 | # CONFIG_NLS_ASCII is not set | ||
1398 | CONFIG_NLS_ISO8859_1=y | ||
1399 | CONFIG_NLS_ISO8859_2=m | ||
1400 | CONFIG_NLS_ISO8859_3=m | ||
1401 | CONFIG_NLS_ISO8859_4=m | ||
1402 | CONFIG_NLS_ISO8859_5=m | ||
1403 | CONFIG_NLS_ISO8859_6=m | ||
1404 | CONFIG_NLS_ISO8859_7=m | ||
1405 | CONFIG_NLS_ISO8859_9=m | ||
1406 | CONFIG_NLS_ISO8859_13=m | ||
1407 | CONFIG_NLS_ISO8859_14=m | ||
1408 | CONFIG_NLS_ISO8859_15=m | ||
1409 | CONFIG_NLS_KOI8_R=m | ||
1410 | CONFIG_NLS_KOI8_U=m | ||
1411 | CONFIG_NLS_UTF8=m | ||
1412 | # CONFIG_DLM is not set | ||
1413 | |||
1414 | # | ||
1415 | # Kernel hacking | ||
1416 | # | ||
1417 | # CONFIG_PRINTK_TIME is not set | ||
1418 | CONFIG_ENABLE_WARN_DEPRECATED=y | ||
1419 | CONFIG_ENABLE_MUST_CHECK=y | ||
1420 | CONFIG_FRAME_WARN=2048 | ||
1421 | CONFIG_MAGIC_SYSRQ=y | ||
1422 | # CONFIG_UNUSED_SYMBOLS is not set | ||
1423 | # CONFIG_DEBUG_FS is not set | ||
1424 | # CONFIG_HEADERS_CHECK is not set | ||
1425 | CONFIG_DEBUG_KERNEL=y | ||
1426 | # CONFIG_DEBUG_SHIRQ is not set | ||
1427 | CONFIG_DETECT_SOFTLOCKUP=y | ||
1428 | # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set | ||
1429 | CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 | ||
1430 | CONFIG_SCHED_DEBUG=y | ||
1431 | # CONFIG_SCHEDSTATS is not set | ||
1432 | # CONFIG_TIMER_STATS is not set | ||
1433 | # CONFIG_DEBUG_OBJECTS is not set | ||
1434 | # CONFIG_SLUB_DEBUG_ON is not set | ||
1435 | # CONFIG_SLUB_STATS is not set | ||
1436 | # CONFIG_DEBUG_RT_MUTEXES is not set | ||
1437 | # CONFIG_RT_MUTEX_TESTER is not set | ||
1438 | # CONFIG_DEBUG_SPINLOCK is not set | ||
1439 | CONFIG_DEBUG_MUTEXES=y | ||
1440 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | ||
1441 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set | ||
1442 | # CONFIG_DEBUG_KOBJECT is not set | ||
1443 | # CONFIG_DEBUG_INFO is not set | ||
1444 | # CONFIG_DEBUG_VM is not set | ||
1445 | # CONFIG_DEBUG_WRITECOUNT is not set | ||
1446 | CONFIG_DEBUG_MEMORY_INIT=y | ||
1447 | # CONFIG_DEBUG_LIST is not set | ||
1448 | # CONFIG_DEBUG_SG is not set | ||
1449 | # CONFIG_DEBUG_NOTIFIERS is not set | ||
1450 | # CONFIG_BOOT_PRINTK_DELAY is not set | ||
1451 | # CONFIG_RCU_TORTURE_TEST is not set | ||
1452 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
1453 | # CONFIG_BACKTRACE_SELF_TEST is not set | ||
1454 | # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set | ||
1455 | # CONFIG_FAULT_INJECTION is not set | ||
1456 | # CONFIG_SYSCTL_SYSCALL_CHECK is not set | ||
1457 | |||
1458 | # | ||
1459 | # Tracers | ||
1460 | # | ||
1461 | # CONFIG_SCHED_TRACER is not set | ||
1462 | # CONFIG_CONTEXT_SWITCH_TRACER is not set | ||
1463 | # CONFIG_BOOT_TRACER is not set | ||
1464 | # CONFIG_TRACE_BRANCH_PROFILING is not set | ||
1465 | # CONFIG_DYNAMIC_PRINTK_DEBUG is not set | ||
1466 | # CONFIG_SAMPLES is not set | ||
1467 | CONFIG_IA64_GRANULE_16MB=y | ||
1468 | # CONFIG_IA64_GRANULE_64MB is not set | ||
1469 | # CONFIG_IA64_PRINT_HAZARDS is not set | ||
1470 | # CONFIG_DISABLE_VHPT is not set | ||
1471 | # CONFIG_IA64_DEBUG_CMPXCHG is not set | ||
1472 | # CONFIG_IA64_DEBUG_IRQ is not set | ||
1473 | |||
1474 | # | ||
1475 | # Security options | ||
1476 | # | ||
1477 | # CONFIG_KEYS is not set | ||
1478 | # CONFIG_SECURITY is not set | ||
1479 | # CONFIG_SECURITYFS is not set | ||
1480 | # CONFIG_SECURITY_FILE_CAPABILITIES is not set | ||
1481 | CONFIG_CRYPTO=y | ||
1482 | |||
1483 | # | ||
1484 | # Crypto core or helper | ||
1485 | # | ||
1486 | # CONFIG_CRYPTO_FIPS is not set | ||
1487 | CONFIG_CRYPTO_ALGAPI=y | ||
1488 | CONFIG_CRYPTO_ALGAPI2=y | ||
1489 | CONFIG_CRYPTO_AEAD2=y | ||
1490 | CONFIG_CRYPTO_BLKCIPHER=m | ||
1491 | CONFIG_CRYPTO_BLKCIPHER2=y | ||
1492 | CONFIG_CRYPTO_HASH=y | ||
1493 | CONFIG_CRYPTO_HASH2=y | ||
1494 | CONFIG_CRYPTO_RNG2=y | ||
1495 | CONFIG_CRYPTO_MANAGER=m | ||
1496 | CONFIG_CRYPTO_MANAGER2=y | ||
1497 | # CONFIG_CRYPTO_GF128MUL is not set | ||
1498 | # CONFIG_CRYPTO_NULL is not set | ||
1499 | # CONFIG_CRYPTO_CRYPTD is not set | ||
1500 | # CONFIG_CRYPTO_AUTHENC is not set | ||
1501 | # CONFIG_CRYPTO_TEST is not set | ||
1502 | |||
1503 | # | ||
1504 | # Authenticated Encryption with Associated Data | ||
1505 | # | ||
1506 | # CONFIG_CRYPTO_CCM is not set | ||
1507 | # CONFIG_CRYPTO_GCM is not set | ||
1508 | # CONFIG_CRYPTO_SEQIV is not set | ||
1509 | |||
1510 | # | ||
1511 | # Block modes | ||
1512 | # | ||
1513 | CONFIG_CRYPTO_CBC=m | ||
1514 | # CONFIG_CRYPTO_CTR is not set | ||
1515 | # CONFIG_CRYPTO_CTS is not set | ||
1516 | CONFIG_CRYPTO_ECB=m | ||
1517 | # CONFIG_CRYPTO_LRW is not set | ||
1518 | CONFIG_CRYPTO_PCBC=m | ||
1519 | # CONFIG_CRYPTO_XTS is not set | ||
1520 | |||
1521 | # | ||
1522 | # Hash modes | ||
1523 | # | ||
1524 | # CONFIG_CRYPTO_HMAC is not set | ||
1525 | # CONFIG_CRYPTO_XCBC is not set | ||
1526 | |||
1527 | # | ||
1528 | # Digest | ||
1529 | # | ||
1530 | # CONFIG_CRYPTO_CRC32C is not set | ||
1531 | # CONFIG_CRYPTO_MD4 is not set | ||
1532 | CONFIG_CRYPTO_MD5=y | ||
1533 | # CONFIG_CRYPTO_MICHAEL_MIC is not set | ||
1534 | # CONFIG_CRYPTO_RMD128 is not set | ||
1535 | # CONFIG_CRYPTO_RMD160 is not set | ||
1536 | # CONFIG_CRYPTO_RMD256 is not set | ||
1537 | # CONFIG_CRYPTO_RMD320 is not set | ||
1538 | # CONFIG_CRYPTO_SHA1 is not set | ||
1539 | # CONFIG_CRYPTO_SHA256 is not set | ||
1540 | # CONFIG_CRYPTO_SHA512 is not set | ||
1541 | # CONFIG_CRYPTO_TGR192 is not set | ||
1542 | # CONFIG_CRYPTO_WP512 is not set | ||
1543 | |||
1544 | # | ||
1545 | # Ciphers | ||
1546 | # | ||
1547 | # CONFIG_CRYPTO_AES is not set | ||
1548 | # CONFIG_CRYPTO_ANUBIS is not set | ||
1549 | # CONFIG_CRYPTO_ARC4 is not set | ||
1550 | # CONFIG_CRYPTO_BLOWFISH is not set | ||
1551 | # CONFIG_CRYPTO_CAMELLIA is not set | ||
1552 | # CONFIG_CRYPTO_CAST5 is not set | ||
1553 | # CONFIG_CRYPTO_CAST6 is not set | ||
1554 | CONFIG_CRYPTO_DES=m | ||
1555 | # CONFIG_CRYPTO_FCRYPT is not set | ||
1556 | # CONFIG_CRYPTO_KHAZAD is not set | ||
1557 | # CONFIG_CRYPTO_SALSA20 is not set | ||
1558 | # CONFIG_CRYPTO_SEED is not set | ||
1559 | # CONFIG_CRYPTO_SERPENT is not set | ||
1560 | # CONFIG_CRYPTO_TEA is not set | ||
1561 | # CONFIG_CRYPTO_TWOFISH is not set | ||
1562 | |||
1563 | # | ||
1564 | # Compression | ||
1565 | # | ||
1566 | # CONFIG_CRYPTO_DEFLATE is not set | ||
1567 | # CONFIG_CRYPTO_LZO is not set | ||
1568 | |||
1569 | # | ||
1570 | # Random Number Generation | ||
1571 | # | ||
1572 | # CONFIG_CRYPTO_ANSI_CPRNG is not set | ||
1573 | CONFIG_CRYPTO_HW=y | ||
1574 | # CONFIG_CRYPTO_DEV_HIFN_795X is not set | ||
1575 | CONFIG_HAVE_KVM=y | ||
1576 | CONFIG_VIRTUALIZATION=y | ||
1577 | # CONFIG_KVM is not set | ||
1578 | # CONFIG_VIRTIO_PCI is not set | ||
1579 | # CONFIG_VIRTIO_BALLOON is not set | ||
1580 | |||
1581 | # | ||
1582 | # Library routines | ||
1583 | # | ||
1584 | CONFIG_BITREVERSE=y | ||
1585 | CONFIG_GENERIC_FIND_LAST_BIT=y | ||
1586 | # CONFIG_CRC_CCITT is not set | ||
1587 | # CONFIG_CRC16 is not set | ||
1588 | # CONFIG_CRC_T10DIF is not set | ||
1589 | CONFIG_CRC_ITU_T=m | ||
1590 | CONFIG_CRC32=y | ||
1591 | # CONFIG_CRC7 is not set | ||
1592 | # CONFIG_LIBCRC32C is not set | ||
1593 | CONFIG_PLIST=y | ||
1594 | CONFIG_HAS_IOMEM=y | ||
1595 | CONFIG_HAS_IOPORT=y | ||
1596 | CONFIG_HAS_DMA=y | ||
1597 | CONFIG_GENERIC_HARDIRQS=y | ||
1598 | CONFIG_GENERIC_IRQ_PROBE=y | ||
1599 | CONFIG_GENERIC_PENDING_IRQ=y | ||
1600 | CONFIG_IRQ_PER_CPU=y | ||
1601 | # CONFIG_IOMMU_API is not set | ||
diff --git a/arch/ia64/include/asm/kvm.h b/arch/ia64/include/asm/kvm.h index 116761ca462d..2b0a38e84705 100644 --- a/arch/ia64/include/asm/kvm.h +++ b/arch/ia64/include/asm/kvm.h | |||
@@ -24,6 +24,10 @@ | |||
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/ioctl.h> | 25 | #include <linux/ioctl.h> |
26 | 26 | ||
27 | /* Select x86 specific features in <linux/kvm.h> */ | ||
28 | #define __KVM_HAVE_IOAPIC | ||
29 | #define __KVM_HAVE_DEVICE_ASSIGNMENT | ||
30 | |||
27 | /* Architectural interrupt line count. */ | 31 | /* Architectural interrupt line count. */ |
28 | #define KVM_NR_INTERRUPTS 256 | 32 | #define KVM_NR_INTERRUPTS 256 |
29 | 33 | ||
diff --git a/arch/ia64/include/asm/mmzone.h b/arch/ia64/include/asm/mmzone.h index 34efe88eb849..f2ca32069b3f 100644 --- a/arch/ia64/include/asm/mmzone.h +++ b/arch/ia64/include/asm/mmzone.h | |||
@@ -31,10 +31,6 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
31 | #endif | 31 | #endif |
32 | } | 32 | } |
33 | 33 | ||
34 | #ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID | ||
35 | extern int early_pfn_to_nid(unsigned long pfn); | ||
36 | #endif | ||
37 | |||
38 | #ifdef CONFIG_IA64_DIG /* DIG systems are small */ | 34 | #ifdef CONFIG_IA64_DIG /* DIG systems are small */ |
39 | # define MAX_PHYSNODE_ID 8 | 35 | # define MAX_PHYSNODE_ID 8 |
40 | # define NR_NODE_MEMBLKS (MAX_NUMNODES * 8) | 36 | # define NR_NODE_MEMBLKS (MAX_NUMNODES * 8) |
diff --git a/arch/ia64/include/asm/sn/bte.h b/arch/ia64/include/asm/sn/bte.h index 5efecf06c9a4..96798d2da7c2 100644 --- a/arch/ia64/include/asm/sn/bte.h +++ b/arch/ia64/include/asm/sn/bte.h | |||
@@ -39,7 +39,7 @@ | |||
39 | /* BTE status register only supports 16 bits for length field */ | 39 | /* BTE status register only supports 16 bits for length field */ |
40 | #define BTE_LEN_BITS (16) | 40 | #define BTE_LEN_BITS (16) |
41 | #define BTE_LEN_MASK ((1 << BTE_LEN_BITS) - 1) | 41 | #define BTE_LEN_MASK ((1 << BTE_LEN_BITS) - 1) |
42 | #define BTE_MAX_XFER ((1 << BTE_LEN_BITS) * L1_CACHE_BYTES) | 42 | #define BTE_MAX_XFER (BTE_LEN_MASK << L1_CACHE_SHIFT) |
43 | 43 | ||
44 | 44 | ||
45 | /* Define hardware */ | 45 | /* Define hardware */ |
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c index 11463994a7d5..52290547c85b 100644 --- a/arch/ia64/kernel/smpboot.c +++ b/arch/ia64/kernel/smpboot.c | |||
@@ -736,14 +736,15 @@ int __cpu_disable(void) | |||
736 | return -EBUSY; | 736 | return -EBUSY; |
737 | } | 737 | } |
738 | 738 | ||
739 | cpu_clear(cpu, cpu_online_map); | ||
740 | |||
739 | if (migrate_platform_irqs(cpu)) { | 741 | if (migrate_platform_irqs(cpu)) { |
740 | cpu_set(cpu, cpu_online_map); | 742 | cpu_set(cpu, cpu_online_map); |
741 | return (-EBUSY); | 743 | return -EBUSY; |
742 | } | 744 | } |
743 | 745 | ||
744 | remove_siblinginfo(cpu); | 746 | remove_siblinginfo(cpu); |
745 | fixup_irqs(); | 747 | fixup_irqs(); |
746 | cpu_clear(cpu, cpu_online_map); | ||
747 | local_flush_tlb_all(); | 748 | local_flush_tlb_all(); |
748 | cpu_clear(cpu, cpu_callin_map); | 749 | cpu_clear(cpu, cpu_callin_map); |
749 | return 0; | 750 | return 0; |
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index 4e586f6110aa..28f982045f29 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -1337,6 +1337,10 @@ static void kvm_release_vm_pages(struct kvm *kvm) | |||
1337 | } | 1337 | } |
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | void kvm_arch_sync_events(struct kvm *kvm) | ||
1341 | { | ||
1342 | } | ||
1343 | |||
1340 | void kvm_arch_destroy_vm(struct kvm *kvm) | 1344 | void kvm_arch_destroy_vm(struct kvm *kvm) |
1341 | { | 1345 | { |
1342 | kvm_iommu_unmap_guest(kvm); | 1346 | kvm_iommu_unmap_guest(kvm); |
diff --git a/arch/ia64/kvm/process.c b/arch/ia64/kvm/process.c index 552d07724207..230eae482f32 100644 --- a/arch/ia64/kvm/process.c +++ b/arch/ia64/kvm/process.c | |||
@@ -455,13 +455,18 @@ fpswa_ret_t vmm_fp_emulate(int fp_fault, void *bundle, unsigned long *ipsr, | |||
455 | if (!vmm_fpswa_interface) | 455 | if (!vmm_fpswa_interface) |
456 | return (fpswa_ret_t) {-1, 0, 0, 0}; | 456 | return (fpswa_ret_t) {-1, 0, 0, 0}; |
457 | 457 | ||
458 | /* | ||
459 | * Just let fpswa driver to use hardware fp registers. | ||
460 | * No fp register is valid in memory. | ||
461 | */ | ||
462 | memset(&fp_state, 0, sizeof(fp_state_t)); | 458 | memset(&fp_state, 0, sizeof(fp_state_t)); |
463 | 459 | ||
464 | /* | 460 | /* |
461 | * compute fp_state. only FP registers f6 - f11 are used by the | ||
462 | * vmm, so set those bits in the mask and set the low volatile | ||
463 | * pointer to point to these registers. | ||
464 | */ | ||
465 | fp_state.bitmask_low64 = 0xfc0; /* bit6..bit11 */ | ||
466 | |||
467 | fp_state.fp_state_low_volatile = (fp_state_low_volatile_t *) ®s->f6; | ||
468 | |||
469 | /* | ||
465 | * unsigned long (*EFI_FPSWA) ( | 470 | * unsigned long (*EFI_FPSWA) ( |
466 | * unsigned long trap_type, | 471 | * unsigned long trap_type, |
467 | * void *Bundle, | 472 | * void *Bundle, |
@@ -545,10 +550,6 @@ void reflect_interruption(u64 ifa, u64 isr, u64 iim, | |||
545 | status = vmm_handle_fpu_swa(0, regs, isr); | 550 | status = vmm_handle_fpu_swa(0, regs, isr); |
546 | if (!status) | 551 | if (!status) |
547 | return ; | 552 | return ; |
548 | else if (-EAGAIN == status) { | ||
549 | vcpu_decrement_iip(vcpu); | ||
550 | return ; | ||
551 | } | ||
552 | break; | 553 | break; |
553 | } | 554 | } |
554 | 555 | ||
diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c index b73bf1838e57..3efea7d0a351 100644 --- a/arch/ia64/mm/numa.c +++ b/arch/ia64/mm/numa.c | |||
@@ -58,7 +58,7 @@ paddr_to_nid(unsigned long paddr) | |||
58 | * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where | 58 | * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where |
59 | * the section resides. | 59 | * the section resides. |
60 | */ | 60 | */ |
61 | int early_pfn_to_nid(unsigned long pfn) | 61 | int __meminit __early_pfn_to_nid(unsigned long pfn) |
62 | { | 62 | { |
63 | int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec; | 63 | int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec; |
64 | 64 | ||
@@ -70,7 +70,7 @@ int early_pfn_to_nid(unsigned long pfn) | |||
70 | return node_memblk[i].nid; | 70 | return node_memblk[i].nid; |
71 | } | 71 | } |
72 | 72 | ||
73 | return 0; | 73 | return -1; |
74 | } | 74 | } |
75 | 75 | ||
76 | #ifdef CONFIG_MEMORY_HOTPLUG | 76 | #ifdef CONFIG_MEMORY_HOTPLUG |
diff --git a/arch/ia64/sn/kernel/bte.c b/arch/ia64/sn/kernel/bte.c index 9456d4034024..c6d6b62db66c 100644 --- a/arch/ia64/sn/kernel/bte.c +++ b/arch/ia64/sn/kernel/bte.c | |||
@@ -97,9 +97,10 @@ bte_result_t bte_copy(u64 src, u64 dest, u64 len, u64 mode, void *notification) | |||
97 | return BTE_SUCCESS; | 97 | return BTE_SUCCESS; |
98 | } | 98 | } |
99 | 99 | ||
100 | BUG_ON((len & L1_CACHE_MASK) || | 100 | BUG_ON(len & L1_CACHE_MASK); |
101 | (src & L1_CACHE_MASK) || (dest & L1_CACHE_MASK)); | 101 | BUG_ON(src & L1_CACHE_MASK); |
102 | BUG_ON(!(len < ((BTE_LEN_MASK + 1) << L1_CACHE_SHIFT))); | 102 | BUG_ON(dest & L1_CACHE_MASK); |
103 | BUG_ON(len > BTE_MAX_XFER); | ||
103 | 104 | ||
104 | /* | 105 | /* |
105 | * Start with interface corresponding to cpu number | 106 | * Start with interface corresponding to cpu number |
diff --git a/arch/ia64/xen/Kconfig b/arch/ia64/xen/Kconfig index f1683a20275b..515e0826803a 100644 --- a/arch/ia64/xen/Kconfig +++ b/arch/ia64/xen/Kconfig | |||
@@ -8,8 +8,7 @@ config XEN | |||
8 | depends on PARAVIRT && MCKINLEY && IA64_PAGE_SIZE_16KB && EXPERIMENTAL | 8 | depends on PARAVIRT && MCKINLEY && IA64_PAGE_SIZE_16KB && EXPERIMENTAL |
9 | select XEN_XENCOMM | 9 | select XEN_XENCOMM |
10 | select NO_IDLE_HZ | 10 | select NO_IDLE_HZ |
11 | 11 | # followings are required to save/restore. | |
12 | # those are required to save/restore. | ||
13 | select ARCH_SUSPEND_POSSIBLE | 12 | select ARCH_SUSPEND_POSSIBLE |
14 | select SUSPEND | 13 | select SUSPEND |
15 | select PM_SLEEP | 14 | select PM_SLEEP |
diff --git a/arch/ia64/xen/xen_pv_ops.c b/arch/ia64/xen/xen_pv_ops.c index 04cd12350455..936cff3c96e0 100644 --- a/arch/ia64/xen/xen_pv_ops.c +++ b/arch/ia64/xen/xen_pv_ops.c | |||
@@ -153,7 +153,7 @@ xen_post_smp_prepare_boot_cpu(void) | |||
153 | xen_setup_vcpu_info_placement(); | 153 | xen_setup_vcpu_info_placement(); |
154 | } | 154 | } |
155 | 155 | ||
156 | static const struct pv_init_ops xen_init_ops __initdata = { | 156 | static const struct pv_init_ops xen_init_ops __initconst = { |
157 | .banner = xen_banner, | 157 | .banner = xen_banner, |
158 | 158 | ||
159 | .reserve_memory = xen_reserve_memory, | 159 | .reserve_memory = xen_reserve_memory, |
@@ -337,7 +337,7 @@ xen_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val) | |||
337 | HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op); | 337 | HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op); |
338 | } | 338 | } |
339 | 339 | ||
340 | static const struct pv_iosapic_ops xen_iosapic_ops __initdata = { | 340 | static const struct pv_iosapic_ops xen_iosapic_ops __initconst = { |
341 | .pcat_compat_init = xen_pcat_compat_init, | 341 | .pcat_compat_init = xen_pcat_compat_init, |
342 | .__get_irq_chip = xen_iosapic_get_irq_chip, | 342 | .__get_irq_chip = xen_iosapic_get_irq_chip, |
343 | 343 | ||
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c index dba4afabb444..39478dd08e67 100644 --- a/arch/m68k/atari/ataints.c +++ b/arch/m68k/atari/ataints.c | |||
@@ -187,8 +187,8 @@ __asm__ (__ALIGN_STR "\n" \ | |||
187 | " jbra ret_from_interrupt\n" \ | 187 | " jbra ret_from_interrupt\n" \ |
188 | : : "i" (&kstat_cpu(0).irqs[n+8]), "i" (&irq_handler[n+8]), \ | 188 | : : "i" (&kstat_cpu(0).irqs[n+8]), "i" (&irq_handler[n+8]), \ |
189 | "n" (PT_OFF_SR), "n" (n), \ | 189 | "n" (PT_OFF_SR), "n" (n), \ |
190 | "i" (n & 8 ? (n & 16 ? &tt_mfp.int_mk_a : &mfp.int_mk_a) \ | 190 | "i" (n & 8 ? (n & 16 ? &tt_mfp.int_mk_a : &st_mfp.int_mk_a) \ |
191 | : (n & 16 ? &tt_mfp.int_mk_b : &mfp.int_mk_b)), \ | 191 | : (n & 16 ? &tt_mfp.int_mk_b : &st_mfp.int_mk_b)), \ |
192 | "m" (preempt_count()), "di" (HARDIRQ_OFFSET) \ | 192 | "m" (preempt_count()), "di" (HARDIRQ_OFFSET) \ |
193 | ); \ | 193 | ); \ |
194 | for (;;); /* fake noreturn */ \ | 194 | for (;;); /* fake noreturn */ \ |
@@ -366,14 +366,14 @@ void __init atari_init_IRQ(void) | |||
366 | /* Initialize the MFP(s) */ | 366 | /* Initialize the MFP(s) */ |
367 | 367 | ||
368 | #ifdef ATARI_USE_SOFTWARE_EOI | 368 | #ifdef ATARI_USE_SOFTWARE_EOI |
369 | mfp.vec_adr = 0x48; /* Software EOI-Mode */ | 369 | st_mfp.vec_adr = 0x48; /* Software EOI-Mode */ |
370 | #else | 370 | #else |
371 | mfp.vec_adr = 0x40; /* Automatic EOI-Mode */ | 371 | st_mfp.vec_adr = 0x40; /* Automatic EOI-Mode */ |
372 | #endif | 372 | #endif |
373 | mfp.int_en_a = 0x00; /* turn off MFP-Ints */ | 373 | st_mfp.int_en_a = 0x00; /* turn off MFP-Ints */ |
374 | mfp.int_en_b = 0x00; | 374 | st_mfp.int_en_b = 0x00; |
375 | mfp.int_mk_a = 0xff; /* no Masking */ | 375 | st_mfp.int_mk_a = 0xff; /* no Masking */ |
376 | mfp.int_mk_b = 0xff; | 376 | st_mfp.int_mk_b = 0xff; |
377 | 377 | ||
378 | if (ATARIHW_PRESENT(TT_MFP)) { | 378 | if (ATARIHW_PRESENT(TT_MFP)) { |
379 | #ifdef ATARI_USE_SOFTWARE_EOI | 379 | #ifdef ATARI_USE_SOFTWARE_EOI |
diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c index a5f33c059979..4add96d13b19 100644 --- a/arch/m68k/atari/atakeyb.c +++ b/arch/m68k/atari/atakeyb.c | |||
@@ -609,10 +609,10 @@ int atari_keyb_init(void) | |||
609 | ACIA_RHTID : 0); | 609 | ACIA_RHTID : 0); |
610 | 610 | ||
611 | /* make sure the interrupt line is up */ | 611 | /* make sure the interrupt line is up */ |
612 | } while ((mfp.par_dt_reg & 0x10) == 0); | 612 | } while ((st_mfp.par_dt_reg & 0x10) == 0); |
613 | 613 | ||
614 | /* enable ACIA Interrupts */ | 614 | /* enable ACIA Interrupts */ |
615 | mfp.active_edge &= ~0x10; | 615 | st_mfp.active_edge &= ~0x10; |
616 | atari_turnon_irq(IRQ_MFP_ACIA); | 616 | atari_turnon_irq(IRQ_MFP_ACIA); |
617 | 617 | ||
618 | ikbd_self_test = 1; | 618 | ikbd_self_test = 1; |
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c index 49c28cdbea5c..ae2d96e5d618 100644 --- a/arch/m68k/atari/config.c +++ b/arch/m68k/atari/config.c | |||
@@ -258,7 +258,7 @@ void __init config_atari(void) | |||
258 | printk("STND_SHIFTER "); | 258 | printk("STND_SHIFTER "); |
259 | } | 259 | } |
260 | } | 260 | } |
261 | if (hwreg_present(&mfp.par_dt_reg)) { | 261 | if (hwreg_present(&st_mfp.par_dt_reg)) { |
262 | ATARIHW_SET(ST_MFP); | 262 | ATARIHW_SET(ST_MFP); |
263 | printk("ST_MFP "); | 263 | printk("ST_MFP "); |
264 | } | 264 | } |
diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c index 702b15ccfab7..28efdc33c1ae 100644 --- a/arch/m68k/atari/debug.c +++ b/arch/m68k/atari/debug.c | |||
@@ -34,9 +34,9 @@ static struct console atari_console_driver = { | |||
34 | 34 | ||
35 | static inline void ata_mfp_out(char c) | 35 | static inline void ata_mfp_out(char c) |
36 | { | 36 | { |
37 | while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */ | 37 | while (!(st_mfp.trn_stat & 0x80)) /* wait for tx buf empty */ |
38 | barrier(); | 38 | barrier(); |
39 | mfp.usart_dta = c; | 39 | st_mfp.usart_dta = c; |
40 | } | 40 | } |
41 | 41 | ||
42 | static void atari_mfp_console_write(struct console *co, const char *str, | 42 | static void atari_mfp_console_write(struct console *co, const char *str, |
@@ -91,7 +91,7 @@ static int ata_par_out(char c) | |||
91 | /* This a some-seconds timeout in case no printer is connected */ | 91 | /* This a some-seconds timeout in case no printer is connected */ |
92 | unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ; | 92 | unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ; |
93 | 93 | ||
94 | while ((mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */ | 94 | while ((st_mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */ |
95 | ; | 95 | ; |
96 | if (!i) | 96 | if (!i) |
97 | return 0; | 97 | return 0; |
@@ -131,9 +131,9 @@ static void atari_par_console_write(struct console *co, const char *str, | |||
131 | #if 0 | 131 | #if 0 |
132 | int atari_mfp_console_wait_key(struct console *co) | 132 | int atari_mfp_console_wait_key(struct console *co) |
133 | { | 133 | { |
134 | while (!(mfp.rcv_stat & 0x80)) /* wait for rx buf filled */ | 134 | while (!(st_mfp.rcv_stat & 0x80)) /* wait for rx buf filled */ |
135 | barrier(); | 135 | barrier(); |
136 | return mfp.usart_dta; | 136 | return st_mfp.usart_dta; |
137 | } | 137 | } |
138 | 138 | ||
139 | int atari_scc_console_wait_key(struct console *co) | 139 | int atari_scc_console_wait_key(struct console *co) |
@@ -175,12 +175,12 @@ static void __init atari_init_mfp_port(int cflag) | |||
175 | baud = B9600; /* use default 9600bps for non-implemented rates */ | 175 | baud = B9600; /* use default 9600bps for non-implemented rates */ |
176 | baud -= B1200; /* baud_table[] starts at 1200bps */ | 176 | baud -= B1200; /* baud_table[] starts at 1200bps */ |
177 | 177 | ||
178 | mfp.trn_stat &= ~0x01; /* disable TX */ | 178 | st_mfp.trn_stat &= ~0x01; /* disable TX */ |
179 | mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */ | 179 | st_mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */ |
180 | mfp.tim_ct_cd &= 0x70; /* stop timer D */ | 180 | st_mfp.tim_ct_cd &= 0x70; /* stop timer D */ |
181 | mfp.tim_dt_d = baud_table[baud]; | 181 | st_mfp.tim_dt_d = baud_table[baud]; |
182 | mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ | 182 | st_mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ |
183 | mfp.trn_stat |= 0x01; /* enable TX */ | 183 | st_mfp.trn_stat |= 0x01; /* enable TX */ |
184 | } | 184 | } |
185 | 185 | ||
186 | #define SCC_WRITE(reg, val) \ | 186 | #define SCC_WRITE(reg, val) \ |
diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c index d076ff8d1b39..a0531f34c617 100644 --- a/arch/m68k/atari/time.c +++ b/arch/m68k/atari/time.c | |||
@@ -27,9 +27,9 @@ void __init | |||
27 | atari_sched_init(irq_handler_t timer_routine) | 27 | atari_sched_init(irq_handler_t timer_routine) |
28 | { | 28 | { |
29 | /* set Timer C data Register */ | 29 | /* set Timer C data Register */ |
30 | mfp.tim_dt_c = INT_TICKS; | 30 | st_mfp.tim_dt_c = INT_TICKS; |
31 | /* start timer C, div = 1:100 */ | 31 | /* start timer C, div = 1:100 */ |
32 | mfp.tim_ct_cd = (mfp.tim_ct_cd & 15) | 0x60; | 32 | st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd & 15) | 0x60; |
33 | /* install interrupt service routine for MFP Timer C */ | 33 | /* install interrupt service routine for MFP Timer C */ |
34 | if (request_irq(IRQ_MFP_TIMC, timer_routine, IRQ_TYPE_SLOW, | 34 | if (request_irq(IRQ_MFP_TIMC, timer_routine, IRQ_TYPE_SLOW, |
35 | "timer", timer_routine)) | 35 | "timer", timer_routine)) |
@@ -46,11 +46,11 @@ unsigned long atari_gettimeoffset (void) | |||
46 | unsigned long ticks, offset = 0; | 46 | unsigned long ticks, offset = 0; |
47 | 47 | ||
48 | /* read MFP timer C current value */ | 48 | /* read MFP timer C current value */ |
49 | ticks = mfp.tim_dt_c; | 49 | ticks = st_mfp.tim_dt_c; |
50 | /* The probability of underflow is less than 2% */ | 50 | /* The probability of underflow is less than 2% */ |
51 | if (ticks > INT_TICKS - INT_TICKS / 50) | 51 | if (ticks > INT_TICKS - INT_TICKS / 50) |
52 | /* Check for pending timer interrupt */ | 52 | /* Check for pending timer interrupt */ |
53 | if (mfp.int_pn_b & (1 << 5)) | 53 | if (st_mfp.int_pn_b & (1 << 5)) |
54 | offset = TICK_SIZE; | 54 | offset = TICK_SIZE; |
55 | 55 | ||
56 | ticks = INT_TICKS - ticks; | 56 | ticks = INT_TICKS - ticks; |
diff --git a/arch/m68k/include/asm/atarihw.h b/arch/m68k/include/asm/atarihw.h index 1412b4ab202f..a714e1aa072a 100644 --- a/arch/m68k/include/asm/atarihw.h +++ b/arch/m68k/include/asm/atarihw.h | |||
@@ -113,7 +113,7 @@ extern struct atari_hw_present atari_hw_present; | |||
113 | * of nops on various machines. Somebody claimed that the tstb takes 600 ns. | 113 | * of nops on various machines. Somebody claimed that the tstb takes 600 ns. |
114 | */ | 114 | */ |
115 | #define MFPDELAY() \ | 115 | #define MFPDELAY() \ |
116 | __asm__ __volatile__ ( "tstb %0" : : "m" (mfp.par_dt_reg) : "cc" ); | 116 | __asm__ __volatile__ ( "tstb %0" : : "m" (st_mfp.par_dt_reg) : "cc" ); |
117 | 117 | ||
118 | /* Do cache push/invalidate for DMA read/write. This function obeys the | 118 | /* Do cache push/invalidate for DMA read/write. This function obeys the |
119 | * snooping on some machines (Medusa) and processors: The Medusa itself can | 119 | * snooping on some machines (Medusa) and processors: The Medusa itself can |
@@ -565,7 +565,7 @@ struct MFP | |||
565 | u_char char_dummy23; | 565 | u_char char_dummy23; |
566 | u_char usart_dta; | 566 | u_char usart_dta; |
567 | }; | 567 | }; |
568 | # define mfp ((*(volatile struct MFP*)MFP_BAS)) | 568 | # define st_mfp ((*(volatile struct MFP*)MFP_BAS)) |
569 | 569 | ||
570 | /* TT's second MFP */ | 570 | /* TT's second MFP */ |
571 | 571 | ||
diff --git a/arch/m68k/include/asm/atariints.h b/arch/m68k/include/asm/atariints.h index 5748e99f4e26..f597892e43a0 100644 --- a/arch/m68k/include/asm/atariints.h +++ b/arch/m68k/include/asm/atariints.h | |||
@@ -113,7 +113,7 @@ static inline int get_mfp_bit( unsigned irq, int type ) | |||
113 | { unsigned char mask, *reg; | 113 | { unsigned char mask, *reg; |
114 | 114 | ||
115 | mask = 1 << (irq & 7); | 115 | mask = 1 << (irq & 7); |
116 | reg = (unsigned char *)&mfp.int_en_a + type*4 + | 116 | reg = (unsigned char *)&st_mfp.int_en_a + type*4 + |
117 | ((irq & 8) >> 2) + (((irq-8) & 16) << 3); | 117 | ((irq & 8) >> 2) + (((irq-8) & 16) << 3); |
118 | return( *reg & mask ); | 118 | return( *reg & mask ); |
119 | } | 119 | } |
@@ -123,7 +123,7 @@ static inline void set_mfp_bit( unsigned irq, int type ) | |||
123 | { unsigned char mask, *reg; | 123 | { unsigned char mask, *reg; |
124 | 124 | ||
125 | mask = 1 << (irq & 7); | 125 | mask = 1 << (irq & 7); |
126 | reg = (unsigned char *)&mfp.int_en_a + type*4 + | 126 | reg = (unsigned char *)&st_mfp.int_en_a + type*4 + |
127 | ((irq & 8) >> 2) + (((irq-8) & 16) << 3); | 127 | ((irq & 8) >> 2) + (((irq-8) & 16) << 3); |
128 | __asm__ __volatile__ ( "orb %0,%1" | 128 | __asm__ __volatile__ ( "orb %0,%1" |
129 | : : "di" (mask), "m" (*reg) : "memory" ); | 129 | : : "di" (mask), "m" (*reg) : "memory" ); |
@@ -134,7 +134,7 @@ static inline void clear_mfp_bit( unsigned irq, int type ) | |||
134 | { unsigned char mask, *reg; | 134 | { unsigned char mask, *reg; |
135 | 135 | ||
136 | mask = ~(1 << (irq & 7)); | 136 | mask = ~(1 << (irq & 7)); |
137 | reg = (unsigned char *)&mfp.int_en_a + type*4 + | 137 | reg = (unsigned char *)&st_mfp.int_en_a + type*4 + |
138 | ((irq & 8) >> 2) + (((irq-8) & 16) << 3); | 138 | ((irq & 8) >> 2) + (((irq-8) & 16) << 3); |
139 | if (type == MFP_PENDING || type == MFP_SERVICE) | 139 | if (type == MFP_PENDING || type == MFP_SERVICE) |
140 | __asm__ __volatile__ ( "moveb %0,%1" | 140 | __asm__ __volatile__ ( "moveb %0,%1" |
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig index 9a9f43358879..41d16822e616 100644 --- a/arch/mn10300/Kconfig +++ b/arch/mn10300/Kconfig | |||
@@ -7,6 +7,7 @@ mainmenu "Linux Kernel Configuration" | |||
7 | 7 | ||
8 | config MN10300 | 8 | config MN10300 |
9 | def_bool y | 9 | def_bool y |
10 | select HAVE_OPROFILE | ||
10 | 11 | ||
11 | config AM33 | 12 | config AM33 |
12 | def_bool y | 13 | def_bool y |
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c index 1a86425fec42..07dbbcda3b2e 100644 --- a/arch/mn10300/unit-asb2305/pci.c +++ b/arch/mn10300/unit-asb2305/pci.c | |||
@@ -173,7 +173,7 @@ static int pci_ampci_write_config_byte(struct pci_bus *bus, unsigned int devfn, | |||
173 | BRIDGEREGB(where) = value; | 173 | BRIDGEREGB(where) = value; |
174 | } else { | 174 | } else { |
175 | if (bus->number == 0 && | 175 | if (bus->number == 0 && |
176 | (devfn == PCI_DEVFN(2, 0) && devfn == PCI_DEVFN(3, 0)) | 176 | (devfn == PCI_DEVFN(2, 0) || devfn == PCI_DEVFN(3, 0)) |
177 | ) | 177 | ) |
178 | __pcidebug("<= %02x", bus, devfn, where, value); | 178 | __pcidebug("<= %02x", bus, devfn, where, value); |
179 | CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); | 179 | CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); |
diff --git a/arch/powerpc/include/asm/pgtable-4k.h b/arch/powerpc/include/asm/pgtable-4k.h index 6b18ba9d2d85..1dbca4e7de67 100644 --- a/arch/powerpc/include/asm/pgtable-4k.h +++ b/arch/powerpc/include/asm/pgtable-4k.h | |||
@@ -60,7 +60,7 @@ | |||
60 | /* It should be preserving the high 48 bits and then specifically */ | 60 | /* It should be preserving the high 48 bits and then specifically */ |
61 | /* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */ | 61 | /* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */ |
62 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \ | 62 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \ |
63 | _PAGE_HPTEFLAGS) | 63 | _PAGE_HPTEFLAGS | _PAGE_SPECIAL) |
64 | 64 | ||
65 | /* Bits to mask out from a PMD to get to the PTE page */ | 65 | /* Bits to mask out from a PMD to get to the PTE page */ |
66 | #define PMD_MASKED_BITS 0 | 66 | #define PMD_MASKED_BITS 0 |
diff --git a/arch/powerpc/include/asm/pgtable-64k.h b/arch/powerpc/include/asm/pgtable-64k.h index 07b0d8f09cb6..7389003349a6 100644 --- a/arch/powerpc/include/asm/pgtable-64k.h +++ b/arch/powerpc/include/asm/pgtable-64k.h | |||
@@ -114,7 +114,7 @@ static inline struct subpage_prot_table *pgd_subpage_prot(pgd_t *pgd) | |||
114 | * pgprot changes | 114 | * pgprot changes |
115 | */ | 115 | */ |
116 | #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ | 116 | #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ |
117 | _PAGE_ACCESSED) | 117 | _PAGE_ACCESSED | _PAGE_SPECIAL) |
118 | 118 | ||
119 | /* Bits to mask out from a PMD to get to the PTE page */ | 119 | /* Bits to mask out from a PMD to get to the PTE page */ |
120 | #define PMD_MASKED_BITS 0x1ff | 120 | #define PMD_MASKED_BITS 0x1ff |
diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h b/arch/powerpc/include/asm/pgtable-ppc32.h index f69a4d977729..820b5f0a35ce 100644 --- a/arch/powerpc/include/asm/pgtable-ppc32.h +++ b/arch/powerpc/include/asm/pgtable-ppc32.h | |||
@@ -429,7 +429,8 @@ extern int icache_44x_need_flush; | |||
429 | #define PMD_PAGE_SIZE(pmd) bad_call_to_PMD_PAGE_SIZE() | 429 | #define PMD_PAGE_SIZE(pmd) bad_call_to_PMD_PAGE_SIZE() |
430 | #endif | 430 | #endif |
431 | 431 | ||
432 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) | 432 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \ |
433 | _PAGE_SPECIAL) | ||
433 | 434 | ||
434 | 435 | ||
435 | #define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \ | 436 | #define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \ |
diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c index 5af4e9b2dbe2..ada06924a423 100644 --- a/arch/powerpc/kernel/align.c +++ b/arch/powerpc/kernel/align.c | |||
@@ -646,11 +646,16 @@ static int emulate_vsx(unsigned char __user *addr, unsigned int reg, | |||
646 | unsigned int areg, struct pt_regs *regs, | 646 | unsigned int areg, struct pt_regs *regs, |
647 | unsigned int flags, unsigned int length) | 647 | unsigned int flags, unsigned int length) |
648 | { | 648 | { |
649 | char *ptr = (char *) ¤t->thread.TS_FPR(reg); | 649 | char *ptr; |
650 | int ret = 0; | 650 | int ret = 0; |
651 | 651 | ||
652 | flush_vsx_to_thread(current); | 652 | flush_vsx_to_thread(current); |
653 | 653 | ||
654 | if (reg < 32) | ||
655 | ptr = (char *) ¤t->thread.TS_FPR(reg); | ||
656 | else | ||
657 | ptr = (char *) ¤t->thread.vr[reg - 32]; | ||
658 | |||
654 | if (flags & ST) | 659 | if (flags & ST) |
655 | ret = __copy_to_user(addr, ptr, length); | 660 | ret = __copy_to_user(addr, ptr, length); |
656 | else { | 661 | else { |
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 2822c8ccfaaf..5f81256287f5 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -125,6 +125,10 @@ static void kvmppc_free_vcpus(struct kvm *kvm) | |||
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | void kvm_arch_sync_events(struct kvm *kvm) | ||
129 | { | ||
130 | } | ||
131 | |||
128 | void kvm_arch_destroy_vm(struct kvm *kvm) | 132 | void kvm_arch_destroy_vm(struct kvm *kvm) |
129 | { | 133 | { |
130 | kvmppc_free_vcpus(kvm); | 134 | kvmppc_free_vcpus(kvm); |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 7393bd76d698..5ac08b8ab654 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/notifier.h> | 19 | #include <linux/notifier.h> |
20 | #include <linux/lmb.h> | 20 | #include <linux/lmb.h> |
21 | #include <linux/of.h> | 21 | #include <linux/of.h> |
22 | #include <linux/pfn.h> | ||
22 | #include <asm/sparsemem.h> | 23 | #include <asm/sparsemem.h> |
23 | #include <asm/prom.h> | 24 | #include <asm/prom.h> |
24 | #include <asm/system.h> | 25 | #include <asm/system.h> |
@@ -882,7 +883,7 @@ static void mark_reserved_regions_for_nid(int nid) | |||
882 | unsigned long physbase = lmb.reserved.region[i].base; | 883 | unsigned long physbase = lmb.reserved.region[i].base; |
883 | unsigned long size = lmb.reserved.region[i].size; | 884 | unsigned long size = lmb.reserved.region[i].size; |
884 | unsigned long start_pfn = physbase >> PAGE_SHIFT; | 885 | unsigned long start_pfn = physbase >> PAGE_SHIFT; |
885 | unsigned long end_pfn = ((physbase + size) >> PAGE_SHIFT); | 886 | unsigned long end_pfn = PFN_UP(physbase + size); |
886 | struct node_active_region node_ar; | 887 | struct node_active_region node_ar; |
887 | unsigned long node_end_pfn = node->node_start_pfn + | 888 | unsigned long node_end_pfn = node->node_start_pfn + |
888 | node->node_spanned_pages; | 889 | node->node_spanned_pages; |
@@ -908,7 +909,7 @@ static void mark_reserved_regions_for_nid(int nid) | |||
908 | */ | 909 | */ |
909 | if (end_pfn > node_ar.end_pfn) | 910 | if (end_pfn > node_ar.end_pfn) |
910 | reserve_size = (node_ar.end_pfn << PAGE_SHIFT) | 911 | reserve_size = (node_ar.end_pfn << PAGE_SHIFT) |
911 | - (start_pfn << PAGE_SHIFT); | 912 | - physbase; |
912 | /* | 913 | /* |
913 | * Only worry about *this* node, others may not | 914 | * Only worry about *this* node, others may not |
914 | * yet have valid NODE_DATA(). | 915 | * yet have valid NODE_DATA(). |
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index 67de6bf3db3d..d281cc0bca71 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c | |||
@@ -328,7 +328,7 @@ static int __init ps3_mm_add_memory(void) | |||
328 | return result; | 328 | return result; |
329 | } | 329 | } |
330 | 330 | ||
331 | core_initcall(ps3_mm_add_memory); | 331 | device_initcall(ps3_mm_add_memory); |
332 | 332 | ||
333 | /*============================================================================*/ | 333 | /*============================================================================*/ |
334 | /* dma routines */ | 334 | /* dma routines */ |
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h index 521726430afa..95b0f7db3c69 100644 --- a/arch/s390/include/asm/cputime.h +++ b/arch/s390/include/asm/cputime.h | |||
@@ -145,7 +145,7 @@ cputime_to_timeval(const cputime_t cputime, struct timeval *value) | |||
145 | value->tv_usec = rp.subreg.even / 4096; | 145 | value->tv_usec = rp.subreg.even / 4096; |
146 | value->tv_sec = rp.subreg.odd; | 146 | value->tv_sec = rp.subreg.odd; |
147 | #else | 147 | #else |
148 | value->tv_usec = cputime % 4096000000ULL; | 148 | value->tv_usec = (cputime % 4096000000ULL) / 4096; |
149 | value->tv_sec = cputime / 4096000000ULL; | 149 | value->tv_sec = cputime / 4096000000ULL; |
150 | #endif | 150 | #endif |
151 | } | 151 | } |
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h index 2bd9faeb3919..e8bd6ac22c99 100644 --- a/arch/s390/include/asm/setup.h +++ b/arch/s390/include/asm/setup.h | |||
@@ -43,6 +43,8 @@ struct mem_chunk { | |||
43 | 43 | ||
44 | extern struct mem_chunk memory_chunk[]; | 44 | extern struct mem_chunk memory_chunk[]; |
45 | extern unsigned long real_memory_size; | 45 | extern unsigned long real_memory_size; |
46 | extern int memory_end_set; | ||
47 | extern unsigned long memory_end; | ||
46 | 48 | ||
47 | void detect_memory_layout(struct mem_chunk chunk[]); | 49 | void detect_memory_layout(struct mem_chunk chunk[]); |
48 | 50 | ||
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index d825f4950e4e..c5cfb6185eac 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -82,7 +82,9 @@ char elf_platform[ELF_PLATFORM_SIZE]; | |||
82 | 82 | ||
83 | struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; | 83 | struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; |
84 | volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */ | 84 | volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */ |
85 | static unsigned long __initdata memory_end; | 85 | |
86 | int __initdata memory_end_set; | ||
87 | unsigned long __initdata memory_end; | ||
86 | 88 | ||
87 | /* | 89 | /* |
88 | * This is set up by the setup-routine at boot-time | 90 | * This is set up by the setup-routine at boot-time |
@@ -281,6 +283,7 @@ void (*pm_power_off)(void) = machine_power_off; | |||
281 | static int __init early_parse_mem(char *p) | 283 | static int __init early_parse_mem(char *p) |
282 | { | 284 | { |
283 | memory_end = memparse(p, &p); | 285 | memory_end = memparse(p, &p); |
286 | memory_end_set = 1; | ||
284 | return 0; | 287 | return 0; |
285 | } | 288 | } |
286 | early_param("mem", early_parse_mem); | 289 | early_param("mem", early_parse_mem); |
@@ -508,8 +511,10 @@ static void __init setup_memory_end(void) | |||
508 | int i; | 511 | int i; |
509 | 512 | ||
510 | #if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE) | 513 | #if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE) |
511 | if (ipl_info.type == IPL_TYPE_FCP_DUMP) | 514 | if (ipl_info.type == IPL_TYPE_FCP_DUMP) { |
512 | memory_end = ZFCPDUMP_HSA_SIZE; | 515 | memory_end = ZFCPDUMP_HSA_SIZE; |
516 | memory_end_set = 1; | ||
517 | } | ||
513 | #endif | 518 | #endif |
514 | memory_size = 0; | 519 | memory_size = 0; |
515 | memory_end &= PAGE_MASK; | 520 | memory_end &= PAGE_MASK; |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index be8497186b96..0d33893e1e89 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -212,6 +212,10 @@ static void kvm_free_vcpus(struct kvm *kvm) | |||
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | void kvm_arch_sync_events(struct kvm *kvm) | ||
216 | { | ||
217 | } | ||
218 | |||
215 | void kvm_arch_destroy_vm(struct kvm *kvm) | 219 | void kvm_arch_destroy_vm(struct kvm *kvm) |
216 | { | 220 | { |
217 | kvm_free_vcpus(kvm); | 221 | kvm_free_vcpus(kvm); |
diff --git a/arch/um/drivers/vde_user.c b/arch/um/drivers/vde_user.c index 56533db25343..c5c43253e6ce 100644 --- a/arch/um/drivers/vde_user.c +++ b/arch/um/drivers/vde_user.c | |||
@@ -78,7 +78,7 @@ void vde_init_libstuff(struct vde_data *vpri, struct vde_init *init) | |||
78 | { | 78 | { |
79 | struct vde_open_args *args; | 79 | struct vde_open_args *args; |
80 | 80 | ||
81 | vpri->args = kmalloc(sizeof(struct vde_open_args), UM_GFP_KERNEL); | 81 | vpri->args = uml_kmalloc(sizeof(struct vde_open_args), UM_GFP_KERNEL); |
82 | if (vpri->args == NULL) { | 82 | if (vpri->args == NULL) { |
83 | printk(UM_KERN_ERR "vde_init_libstuff - vde_open_args " | 83 | printk(UM_KERN_ERR "vde_init_libstuff - vde_open_args " |
84 | "allocation failed"); | 84 | "allocation failed"); |
@@ -91,8 +91,8 @@ void vde_init_libstuff(struct vde_data *vpri, struct vde_init *init) | |||
91 | args->group = init->group; | 91 | args->group = init->group; |
92 | args->mode = init->mode ? init->mode : 0700; | 92 | args->mode = init->mode ? init->mode : 0700; |
93 | 93 | ||
94 | args->port ? printk(UM_KERN_INFO "port %d", args->port) : | 94 | args->port ? printk("port %d", args->port) : |
95 | printk(UM_KERN_INFO "undefined port"); | 95 | printk("undefined port"); |
96 | } | 96 | } |
97 | 97 | ||
98 | int vde_user_read(void *conn, void *buf, int len) | 98 | int vde_user_read(void *conn, void *buf, int len) |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1042d69b267d..5e2919c0ff92 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -235,6 +235,20 @@ config SMP | |||
235 | 235 | ||
236 | If you don't know what to do here, say N. | 236 | If you don't know what to do here, say N. |
237 | 237 | ||
238 | config X86_X2APIC | ||
239 | bool "Support x2apic" | ||
240 | depends on X86_LOCAL_APIC && X86_64 | ||
241 | ---help--- | ||
242 | This enables x2apic support on CPUs that have this feature. | ||
243 | |||
244 | This allows 32-bit apic IDs (so it can support very large systems), | ||
245 | and accesses the local apic via MSRs not via mmio. | ||
246 | |||
247 | ( On certain CPU models you may need to enable INTR_REMAP too, | ||
248 | to get functional x2apic mode. ) | ||
249 | |||
250 | If you don't know what to do here, say N. | ||
251 | |||
238 | config SPARSE_IRQ | 252 | config SPARSE_IRQ |
239 | bool "Support sparse irq numbering" | 253 | bool "Support sparse irq numbering" |
240 | depends on PCI_MSI || HT_IRQ | 254 | depends on PCI_MSI || HT_IRQ |
@@ -271,6 +285,7 @@ config X86_BIGSMP | |||
271 | ---help--- | 285 | ---help--- |
272 | This option is needed for the systems that have more than 8 CPUs | 286 | This option is needed for the systems that have more than 8 CPUs |
273 | 287 | ||
288 | if X86_32 | ||
274 | config X86_EXTENDED_PLATFORM | 289 | config X86_EXTENDED_PLATFORM |
275 | bool "Support for extended (non-PC) x86 platforms" | 290 | bool "Support for extended (non-PC) x86 platforms" |
276 | default y | 291 | default y |
@@ -279,12 +294,36 @@ config X86_EXTENDED_PLATFORM | |||
279 | standard PC platforms. (which covers the vast majority of | 294 | standard PC platforms. (which covers the vast majority of |
280 | systems out there.) | 295 | systems out there.) |
281 | 296 | ||
282 | If you enable this option then you'll be able to select a number | 297 | If you enable this option then you'll be able to select support |
283 | of non-PC x86 platforms. | 298 | for the following (non-PC) 32 bit x86 platforms: |
299 | AMD Elan | ||
300 | NUMAQ (IBM/Sequent) | ||
301 | RDC R-321x SoC | ||
302 | SGI 320/540 (Visual Workstation) | ||
303 | Summit/EXA (IBM x440) | ||
304 | Unisys ES7000 IA32 series | ||
284 | 305 | ||
285 | If you have one of these systems, or if you want to build a | 306 | If you have one of these systems, or if you want to build a |
286 | generic distribution kernel, say Y here - otherwise say N. | 307 | generic distribution kernel, say Y here - otherwise say N. |
308 | endif | ||
287 | 309 | ||
310 | if X86_64 | ||
311 | config X86_EXTENDED_PLATFORM | ||
312 | bool "Support for extended (non-PC) x86 platforms" | ||
313 | default y | ||
314 | ---help--- | ||
315 | If you disable this option then the kernel will only support | ||
316 | standard PC platforms. (which covers the vast majority of | ||
317 | systems out there.) | ||
318 | |||
319 | If you enable this option then you'll be able to select support | ||
320 | for the following (non-PC) 64 bit x86 platforms: | ||
321 | ScaleMP vSMP | ||
322 | SGI Ultraviolet | ||
323 | |||
324 | If you have one of these systems, or if you want to build a | ||
325 | generic distribution kernel, say Y here - otherwise say N. | ||
326 | endif | ||
288 | # This is an alphabetically sorted list of 64 bit extended platforms | 327 | # This is an alphabetically sorted list of 64 bit extended platforms |
289 | # Please maintain the alphabetic order if and when there are additions | 328 | # Please maintain the alphabetic order if and when there are additions |
290 | 329 | ||
@@ -302,6 +341,7 @@ config X86_UV | |||
302 | bool "SGI Ultraviolet" | 341 | bool "SGI Ultraviolet" |
303 | depends on X86_64 | 342 | depends on X86_64 |
304 | depends on X86_EXTENDED_PLATFORM | 343 | depends on X86_EXTENDED_PLATFORM |
344 | select X86_X2APIC | ||
305 | ---help--- | 345 | ---help--- |
306 | This option is needed in order to support SGI Ultraviolet systems. | 346 | This option is needed in order to support SGI Ultraviolet systems. |
307 | If you don't have one of these, you should say N here. | 347 | If you don't have one of these, you should say N here. |
@@ -382,19 +422,6 @@ config X86_ES7000 | |||
382 | Support for Unisys ES7000 systems. Say 'Y' here if this kernel is | 422 | Support for Unisys ES7000 systems. Say 'Y' here if this kernel is |
383 | supposed to run on an IA32-based Unisys ES7000 system. | 423 | supposed to run on an IA32-based Unisys ES7000 system. |
384 | 424 | ||
385 | config X86_VOYAGER | ||
386 | bool "Voyager (NCR)" | ||
387 | depends on SMP && !PCI && BROKEN | ||
388 | depends on X86_32_NON_STANDARD | ||
389 | ---help--- | ||
390 | Voyager is an MCA-based 32-way capable SMP architecture proprietary | ||
391 | to NCR Corp. Machine classes 345x/35xx/4100/51xx are Voyager-based. | ||
392 | |||
393 | *** WARNING *** | ||
394 | |||
395 | If you do not specifically know you have a Voyager based machine, | ||
396 | say N here, otherwise the kernel you build will not be bootable. | ||
397 | |||
398 | config SCHED_OMIT_FRAME_POINTER | 425 | config SCHED_OMIT_FRAME_POINTER |
399 | def_bool y | 426 | def_bool y |
400 | prompt "Single-depth WCHAN output" | 427 | prompt "Single-depth WCHAN output" |
@@ -1828,6 +1855,7 @@ config DMAR_FLOPPY_WA | |||
1828 | config INTR_REMAP | 1855 | config INTR_REMAP |
1829 | bool "Support for Interrupt Remapping (EXPERIMENTAL)" | 1856 | bool "Support for Interrupt Remapping (EXPERIMENTAL)" |
1830 | depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI && EXPERIMENTAL | 1857 | depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI && EXPERIMENTAL |
1858 | select X86_X2APIC | ||
1831 | ---help--- | 1859 | ---help--- |
1832 | Supports Interrupt remapping for IO-APIC and MSI devices. | 1860 | Supports Interrupt remapping for IO-APIC and MSI devices. |
1833 | To use x2apic mode in the CPU's which support x2APIC enhancements or | 1861 | To use x2apic mode in the CPU's which support x2APIC enhancements or |
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index ba4781b93890..fdb45df608b6 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -175,28 +175,8 @@ config IOMMU_LEAK | |||
175 | Add a simple leak tracer to the IOMMU code. This is useful when you | 175 | Add a simple leak tracer to the IOMMU code. This is useful when you |
176 | are debugging a buggy device driver that leaks IOMMU mappings. | 176 | are debugging a buggy device driver that leaks IOMMU mappings. |
177 | 177 | ||
178 | config MMIOTRACE | 178 | config HAVE_MMIOTRACE_SUPPORT |
179 | bool "Memory mapped IO tracing" | 179 | def_bool y |
180 | depends on DEBUG_KERNEL && PCI | ||
181 | select TRACING | ||
182 | help | ||
183 | Mmiotrace traces Memory Mapped I/O access and is meant for | ||
184 | debugging and reverse engineering. It is called from the ioremap | ||
185 | implementation and works via page faults. Tracing is disabled by | ||
186 | default and can be enabled at run-time. | ||
187 | |||
188 | See Documentation/tracers/mmiotrace.txt. | ||
189 | If you are not helping to develop drivers, say N. | ||
190 | |||
191 | config MMIOTRACE_TEST | ||
192 | tristate "Test module for mmiotrace" | ||
193 | depends on MMIOTRACE && m | ||
194 | help | ||
195 | This is a dumb module for testing mmiotrace. It is very dangerous | ||
196 | as it will write garbage to IO memory starting at a given address. | ||
197 | However, it should be safe to use on e.g. unused portion of VRAM. | ||
198 | |||
199 | Say N, unless you absolutely know what you are doing. | ||
200 | 180 | ||
201 | # | 181 | # |
202 | # IO delay types: | 182 | # IO delay types: |
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index cd48c7210016..c70eff69a1fb 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile | |||
@@ -32,7 +32,6 @@ setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o | |||
32 | setup-y += header.o main.o mca.o memory.o pm.o pmjump.o | 32 | setup-y += header.o main.o mca.o memory.o pm.o pmjump.o |
33 | setup-y += printf.o string.o tty.o video.o video-mode.o version.o | 33 | setup-y += printf.o string.o tty.o video.o video-mode.o version.o |
34 | setup-$(CONFIG_X86_APM_BOOT) += apm.o | 34 | setup-$(CONFIG_X86_APM_BOOT) += apm.o |
35 | setup-$(CONFIG_X86_VOYAGER) += voyager.o | ||
36 | 35 | ||
37 | # The link order of the video-*.o modules can matter. In particular, | 36 | # The link order of the video-*.o modules can matter. In particular, |
38 | # video-vga.o *must* be listed first, followed by video-vesa.o. | 37 | # video-vga.o *must* be listed first, followed by video-vesa.o. |
diff --git a/arch/x86/boot/a20.c b/arch/x86/boot/a20.c index fba8e9c6a504..7c19ce8c2442 100644 --- a/arch/x86/boot/a20.c +++ b/arch/x86/boot/a20.c | |||
@@ -126,11 +126,6 @@ static void enable_a20_fast(void) | |||
126 | 126 | ||
127 | int enable_a20(void) | 127 | int enable_a20(void) |
128 | { | 128 | { |
129 | #ifdef CONFIG_X86_VOYAGER | ||
130 | /* On Voyager, a20_test() is unsafe? */ | ||
131 | enable_a20_kbc(); | ||
132 | return 0; | ||
133 | #else | ||
134 | int loops = A20_ENABLE_LOOPS; | 129 | int loops = A20_ENABLE_LOOPS; |
135 | int kbc_err; | 130 | int kbc_err; |
136 | 131 | ||
@@ -164,5 +159,4 @@ int enable_a20(void) | |||
164 | } | 159 | } |
165 | 160 | ||
166 | return -1; | 161 | return -1; |
167 | #endif | ||
168 | } | 162 | } |
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h index cc0ef13fba7a..7b2692e897e5 100644 --- a/arch/x86/boot/boot.h +++ b/arch/x86/boot/boot.h | |||
@@ -302,9 +302,6 @@ void probe_cards(int unsafe); | |||
302 | /* video-vesa.c */ | 302 | /* video-vesa.c */ |
303 | void vesa_store_edid(void); | 303 | void vesa_store_edid(void); |
304 | 304 | ||
305 | /* voyager.c */ | ||
306 | int query_voyager(void); | ||
307 | |||
308 | #endif /* __ASSEMBLY__ */ | 305 | #endif /* __ASSEMBLY__ */ |
309 | 306 | ||
310 | #endif /* BOOT_BOOT_H */ | 307 | #endif /* BOOT_BOOT_H */ |
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S index 9f20d3794060..3a8a866fb2e2 100644 --- a/arch/x86/boot/compressed/head_32.S +++ b/arch/x86/boot/compressed/head_32.S | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #include <linux/linkage.h> | 26 | #include <linux/linkage.h> |
27 | #include <asm/segment.h> | 27 | #include <asm/segment.h> |
28 | #include <asm/page.h> | 28 | #include <asm/page_types.h> |
29 | #include <asm/boot.h> | 29 | #include <asm/boot.h> |
30 | #include <asm/asm-offsets.h> | 30 | #include <asm/asm-offsets.h> |
31 | 31 | ||
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index ba9229ba7f0d..ed4a82948002 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S | |||
@@ -26,8 +26,8 @@ | |||
26 | 26 | ||
27 | #include <linux/linkage.h> | 27 | #include <linux/linkage.h> |
28 | #include <asm/segment.h> | 28 | #include <asm/segment.h> |
29 | #include <asm/pgtable.h> | 29 | #include <asm/pgtable_types.h> |
30 | #include <asm/page.h> | 30 | #include <asm/page_types.h> |
31 | #include <asm/boot.h> | 31 | #include <asm/boot.h> |
32 | #include <asm/msr.h> | 32 | #include <asm/msr.h> |
33 | #include <asm/processor-flags.h> | 33 | #include <asm/processor-flags.h> |
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index b993062e9a5f..7ccff4884a23 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/utsrelease.h> | 19 | #include <linux/utsrelease.h> |
20 | #include <asm/boot.h> | 20 | #include <asm/boot.h> |
21 | #include <asm/e820.h> | 21 | #include <asm/e820.h> |
22 | #include <asm/page.h> | 22 | #include <asm/page_types.h> |
23 | #include <asm/setup.h> | 23 | #include <asm/setup.h> |
24 | #include "boot.h" | 24 | #include "boot.h" |
25 | #include "offsets.h" | 25 | #include "offsets.h" |
diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c index 197421db1af1..58f0415d3ae0 100644 --- a/arch/x86/boot/main.c +++ b/arch/x86/boot/main.c | |||
@@ -149,11 +149,6 @@ void main(void) | |||
149 | /* Query MCA information */ | 149 | /* Query MCA information */ |
150 | query_mca(); | 150 | query_mca(); |
151 | 151 | ||
152 | /* Voyager */ | ||
153 | #ifdef CONFIG_X86_VOYAGER | ||
154 | query_voyager(); | ||
155 | #endif | ||
156 | |||
157 | /* Query Intel SpeedStep (IST) information */ | 152 | /* Query Intel SpeedStep (IST) information */ |
158 | query_ist(); | 153 | query_ist(); |
159 | 154 | ||
diff --git a/arch/x86/boot/voyager.c b/arch/x86/boot/voyager.c deleted file mode 100644 index 433909d61e5c..000000000000 --- a/arch/x86/boot/voyager.c +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* -*- linux-c -*- ------------------------------------------------------- * | ||
2 | * | ||
3 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
4 | * Copyright 2007 rPath, Inc. - All Rights Reserved | ||
5 | * | ||
6 | * This file is part of the Linux kernel, and is made available under | ||
7 | * the terms of the GNU General Public License version 2. | ||
8 | * | ||
9 | * ----------------------------------------------------------------------- */ | ||
10 | |||
11 | /* | ||
12 | * Get the Voyager config information | ||
13 | */ | ||
14 | |||
15 | #include "boot.h" | ||
16 | |||
17 | int query_voyager(void) | ||
18 | { | ||
19 | u8 err; | ||
20 | u16 es, di; | ||
21 | /* Abuse the apm_bios_info area for this */ | ||
22 | u8 *data_ptr = (u8 *)&boot_params.apm_bios_info; | ||
23 | |||
24 | data_ptr[0] = 0xff; /* Flag on config not found(?) */ | ||
25 | |||
26 | asm("pushw %%es ; " | ||
27 | "int $0x15 ; " | ||
28 | "setc %0 ; " | ||
29 | "movw %%es, %1 ; " | ||
30 | "popw %%es" | ||
31 | : "=q" (err), "=r" (es), "=D" (di) | ||
32 | : "a" (0xffc0)); | ||
33 | |||
34 | if (err) | ||
35 | return -1; /* Not Voyager */ | ||
36 | |||
37 | set_fs(es); | ||
38 | copy_from_fs(data_ptr, di, 7); /* Table is 7 bytes apparently */ | ||
39 | return 0; | ||
40 | } | ||
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig index 096dd5359cd9..5c023f6f652c 100644 --- a/arch/x86/configs/i386_defconfig +++ b/arch/x86/configs/i386_defconfig | |||
@@ -197,7 +197,6 @@ CONFIG_SPARSE_IRQ=y | |||
197 | CONFIG_X86_FIND_SMP_CONFIG=y | 197 | CONFIG_X86_FIND_SMP_CONFIG=y |
198 | CONFIG_X86_MPPARSE=y | 198 | CONFIG_X86_MPPARSE=y |
199 | # CONFIG_X86_ELAN is not set | 199 | # CONFIG_X86_ELAN is not set |
200 | # CONFIG_X86_VOYAGER is not set | ||
201 | # CONFIG_X86_GENERICARCH is not set | 200 | # CONFIG_X86_GENERICARCH is not set |
202 | # CONFIG_X86_VSMP is not set | 201 | # CONFIG_X86_VSMP is not set |
203 | # CONFIG_X86_RDC321X is not set | 202 | # CONFIG_X86_RDC321X is not set |
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig index 2efb5d5063ff..4157cc4a2bde 100644 --- a/arch/x86/configs/x86_64_defconfig +++ b/arch/x86/configs/x86_64_defconfig | |||
@@ -199,7 +199,6 @@ CONFIG_SPARSE_IRQ=y | |||
199 | CONFIG_X86_FIND_SMP_CONFIG=y | 199 | CONFIG_X86_FIND_SMP_CONFIG=y |
200 | CONFIG_X86_MPPARSE=y | 200 | CONFIG_X86_MPPARSE=y |
201 | # CONFIG_X86_ELAN is not set | 201 | # CONFIG_X86_ELAN is not set |
202 | # CONFIG_X86_VOYAGER is not set | ||
203 | # CONFIG_X86_GENERICARCH is not set | 202 | # CONFIG_X86_GENERICARCH is not set |
204 | # CONFIG_X86_VSMP is not set | 203 | # CONFIG_X86_VSMP is not set |
205 | CONFIG_SCHED_OMIT_FRAME_POINTER=y | 204 | CONFIG_SCHED_OMIT_FRAME_POINTER=y |
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index dd77ac0cac46..588a7aa937e1 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c | |||
@@ -33,8 +33,6 @@ | |||
33 | #include <asm/sigframe.h> | 33 | #include <asm/sigframe.h> |
34 | #include <asm/sys_ia32.h> | 34 | #include <asm/sys_ia32.h> |
35 | 35 | ||
36 | #define DEBUG_SIG 0 | ||
37 | |||
38 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 36 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
39 | 37 | ||
40 | #define FIX_EFLAGS (X86_EFLAGS_AC | X86_EFLAGS_OF | \ | 38 | #define FIX_EFLAGS (X86_EFLAGS_AC | X86_EFLAGS_OF | \ |
@@ -190,42 +188,47 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr, | |||
190 | /* | 188 | /* |
191 | * Do a signal return; undo the signal stack. | 189 | * Do a signal return; undo the signal stack. |
192 | */ | 190 | */ |
191 | #define loadsegment_gs(v) load_gs_index(v) | ||
192 | #define loadsegment_fs(v) loadsegment(fs, v) | ||
193 | #define loadsegment_ds(v) loadsegment(ds, v) | ||
194 | #define loadsegment_es(v) loadsegment(es, v) | ||
195 | |||
196 | #define get_user_seg(seg) ({ unsigned int v; savesegment(seg, v); v; }) | ||
197 | #define set_user_seg(seg, v) loadsegment_##seg(v) | ||
198 | |||
193 | #define COPY(x) { \ | 199 | #define COPY(x) { \ |
194 | get_user_ex(regs->x, &sc->x); \ | 200 | get_user_ex(regs->x, &sc->x); \ |
195 | } | 201 | } |
196 | 202 | ||
197 | #define COPY_SEG_CPL3(seg) { \ | 203 | #define GET_SEG(seg) ({ \ |
198 | unsigned short tmp; \ | 204 | unsigned short tmp; \ |
199 | get_user_ex(tmp, &sc->seg); \ | 205 | get_user_ex(tmp, &sc->seg); \ |
200 | regs->seg = tmp | 3; \ | 206 | tmp; \ |
201 | } | 207 | }) |
208 | |||
209 | #define COPY_SEG_CPL3(seg) do { \ | ||
210 | regs->seg = GET_SEG(seg) | 3; \ | ||
211 | } while (0) | ||
202 | 212 | ||
203 | #define RELOAD_SEG(seg) { \ | 213 | #define RELOAD_SEG(seg) { \ |
204 | unsigned int cur, pre; \ | 214 | unsigned int pre = GET_SEG(seg); \ |
205 | get_user_ex(pre, &sc->seg); \ | 215 | unsigned int cur = get_user_seg(seg); \ |
206 | savesegment(seg, cur); \ | ||
207 | pre |= 3; \ | 216 | pre |= 3; \ |
208 | if (pre != cur) \ | 217 | if (pre != cur) \ |
209 | loadsegment(seg, pre); \ | 218 | set_user_seg(seg, pre); \ |
210 | } | 219 | } |
211 | 220 | ||
212 | static int ia32_restore_sigcontext(struct pt_regs *regs, | 221 | static int ia32_restore_sigcontext(struct pt_regs *regs, |
213 | struct sigcontext_ia32 __user *sc, | 222 | struct sigcontext_ia32 __user *sc, |
214 | unsigned int *pax) | 223 | unsigned int *pax) |
215 | { | 224 | { |
216 | unsigned int tmpflags, gs, oldgs, err = 0; | 225 | unsigned int tmpflags, err = 0; |
217 | void __user *buf; | 226 | void __user *buf; |
218 | u32 tmp; | 227 | u32 tmp; |
219 | 228 | ||
220 | /* Always make any pending restarted system calls return -EINTR */ | 229 | /* Always make any pending restarted system calls return -EINTR */ |
221 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | 230 | current_thread_info()->restart_block.fn = do_no_restart_syscall; |
222 | 231 | ||
223 | #if DEBUG_SIG | ||
224 | printk(KERN_DEBUG "SIG restore_sigcontext: " | ||
225 | "sc=%p err(%x) eip(%x) cs(%x) flg(%x)\n", | ||
226 | sc, sc->err, sc->ip, sc->cs, sc->flags); | ||
227 | #endif | ||
228 | |||
229 | get_user_try { | 232 | get_user_try { |
230 | /* | 233 | /* |
231 | * Reload fs and gs if they have changed in the signal | 234 | * Reload fs and gs if they have changed in the signal |
@@ -233,12 +236,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, | |||
233 | * the handler, but does not clobber them at least in the | 236 | * the handler, but does not clobber them at least in the |
234 | * normal case. | 237 | * normal case. |
235 | */ | 238 | */ |
236 | get_user_ex(gs, &sc->gs); | 239 | RELOAD_SEG(gs); |
237 | gs |= 3; | ||
238 | savesegment(gs, oldgs); | ||
239 | if (gs != oldgs) | ||
240 | load_gs_index(gs); | ||
241 | |||
242 | RELOAD_SEG(fs); | 240 | RELOAD_SEG(fs); |
243 | RELOAD_SEG(ds); | 241 | RELOAD_SEG(ds); |
244 | RELOAD_SEG(es); | 242 | RELOAD_SEG(es); |
@@ -337,17 +335,13 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, | |||
337 | void __user *fpstate, | 335 | void __user *fpstate, |
338 | struct pt_regs *regs, unsigned int mask) | 336 | struct pt_regs *regs, unsigned int mask) |
339 | { | 337 | { |
340 | int tmp, err = 0; | 338 | int err = 0; |
341 | 339 | ||
342 | put_user_try { | 340 | put_user_try { |
343 | savesegment(gs, tmp); | 341 | put_user_ex(get_user_seg(gs), (unsigned int __user *)&sc->gs); |
344 | put_user_ex(tmp, (unsigned int __user *)&sc->gs); | 342 | put_user_ex(get_user_seg(fs), (unsigned int __user *)&sc->fs); |
345 | savesegment(fs, tmp); | 343 | put_user_ex(get_user_seg(ds), (unsigned int __user *)&sc->ds); |
346 | put_user_ex(tmp, (unsigned int __user *)&sc->fs); | 344 | put_user_ex(get_user_seg(es), (unsigned int __user *)&sc->es); |
347 | savesegment(ds, tmp); | ||
348 | put_user_ex(tmp, (unsigned int __user *)&sc->ds); | ||
349 | savesegment(es, tmp); | ||
350 | put_user_ex(tmp, (unsigned int __user *)&sc->es); | ||
351 | 345 | ||
352 | put_user_ex(regs->di, &sc->di); | 346 | put_user_ex(regs->di, &sc->di); |
353 | put_user_ex(regs->si, &sc->si); | 347 | put_user_ex(regs->si, &sc->si); |
@@ -488,11 +482,6 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
488 | regs->cs = __USER32_CS; | 482 | regs->cs = __USER32_CS; |
489 | regs->ss = __USER32_DS; | 483 | regs->ss = __USER32_DS; |
490 | 484 | ||
491 | #if DEBUG_SIG | ||
492 | printk(KERN_DEBUG "SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\n", | ||
493 | current->comm, current->pid, frame, regs->ip, frame->pretcode); | ||
494 | #endif | ||
495 | |||
496 | return 0; | 485 | return 0; |
497 | } | 486 | } |
498 | 487 | ||
@@ -574,10 +563,5 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
574 | regs->cs = __USER32_CS; | 563 | regs->cs = __USER32_CS; |
575 | regs->ss = __USER32_DS; | 564 | regs->ss = __USER32_DS; |
576 | 565 | ||
577 | #if DEBUG_SIG | ||
578 | printk(KERN_DEBUG "SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\n", | ||
579 | current->comm, current->pid, frame, regs->ip, frame->pretcode); | ||
580 | #endif | ||
581 | |||
582 | return 0; | 566 | return 0; |
583 | } | 567 | } |
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index fba49f66228f..a6208dc74633 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -1,15 +1,18 @@ | |||
1 | #ifndef _ASM_X86_APIC_H | 1 | #ifndef _ASM_X86_APIC_H |
2 | #define _ASM_X86_APIC_H | 2 | #define _ASM_X86_APIC_H |
3 | 3 | ||
4 | #include <linux/pm.h> | 4 | #include <linux/cpumask.h> |
5 | #include <linux/delay.h> | 5 | #include <linux/delay.h> |
6 | #include <linux/pm.h> | ||
6 | 7 | ||
7 | #include <asm/alternative.h> | 8 | #include <asm/alternative.h> |
8 | #include <asm/fixmap.h> | 9 | #include <asm/cpufeature.h> |
9 | #include <asm/apicdef.h> | ||
10 | #include <asm/processor.h> | 10 | #include <asm/processor.h> |
11 | #include <asm/apicdef.h> | ||
12 | #include <asm/atomic.h> | ||
13 | #include <asm/fixmap.h> | ||
14 | #include <asm/mpspec.h> | ||
11 | #include <asm/system.h> | 15 | #include <asm/system.h> |
12 | #include <asm/cpufeature.h> | ||
13 | #include <asm/msr.h> | 16 | #include <asm/msr.h> |
14 | 17 | ||
15 | #define ARCH_APICTIMER_STOPS_ON_C3 1 | 18 | #define ARCH_APICTIMER_STOPS_ON_C3 1 |
@@ -92,6 +95,12 @@ static inline u32 native_apic_mem_read(u32 reg) | |||
92 | return *((volatile u32 *)(APIC_BASE + reg)); | 95 | return *((volatile u32 *)(APIC_BASE + reg)); |
93 | } | 96 | } |
94 | 97 | ||
98 | extern void native_apic_wait_icr_idle(void); | ||
99 | extern u32 native_safe_apic_wait_icr_idle(void); | ||
100 | extern void native_apic_icr_write(u32 low, u32 id); | ||
101 | extern u64 native_apic_icr_read(void); | ||
102 | |||
103 | #ifdef CONFIG_X86_X2APIC | ||
95 | static inline void native_apic_msr_write(u32 reg, u32 v) | 104 | static inline void native_apic_msr_write(u32 reg, u32 v) |
96 | { | 105 | { |
97 | if (reg == APIC_DFR || reg == APIC_ID || reg == APIC_LDR || | 106 | if (reg == APIC_DFR || reg == APIC_ID || reg == APIC_LDR || |
@@ -112,8 +121,32 @@ static inline u32 native_apic_msr_read(u32 reg) | |||
112 | return low; | 121 | return low; |
113 | } | 122 | } |
114 | 123 | ||
115 | #ifndef CONFIG_X86_32 | 124 | static inline void native_x2apic_wait_icr_idle(void) |
116 | extern int x2apic; | 125 | { |
126 | /* no need to wait for icr idle in x2apic */ | ||
127 | return; | ||
128 | } | ||
129 | |||
130 | static inline u32 native_safe_x2apic_wait_icr_idle(void) | ||
131 | { | ||
132 | /* no need to wait for icr idle in x2apic */ | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | static inline void native_x2apic_icr_write(u32 low, u32 id) | ||
137 | { | ||
138 | wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low); | ||
139 | } | ||
140 | |||
141 | static inline u64 native_x2apic_icr_read(void) | ||
142 | { | ||
143 | unsigned long val; | ||
144 | |||
145 | rdmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), val); | ||
146 | return val; | ||
147 | } | ||
148 | |||
149 | extern int x2apic, x2apic_phys; | ||
117 | extern void check_x2apic(void); | 150 | extern void check_x2apic(void); |
118 | extern void enable_x2apic(void); | 151 | extern void enable_x2apic(void); |
119 | extern void enable_IR_x2apic(void); | 152 | extern void enable_IR_x2apic(void); |
@@ -131,53 +164,24 @@ static inline int x2apic_enabled(void) | |||
131 | return 0; | 164 | return 0; |
132 | } | 165 | } |
133 | #else | 166 | #else |
134 | #define x2apic_enabled() 0 | 167 | static inline void check_x2apic(void) |
135 | #endif | ||
136 | |||
137 | struct apic_ops { | ||
138 | u32 (*read)(u32 reg); | ||
139 | void (*write)(u32 reg, u32 v); | ||
140 | u64 (*icr_read)(void); | ||
141 | void (*icr_write)(u32 low, u32 high); | ||
142 | void (*wait_icr_idle)(void); | ||
143 | u32 (*safe_wait_icr_idle)(void); | ||
144 | }; | ||
145 | |||
146 | extern struct apic_ops *apic_ops; | ||
147 | |||
148 | static inline u32 apic_read(u32 reg) | ||
149 | { | 168 | { |
150 | return apic_ops->read(reg); | ||
151 | } | 169 | } |
152 | 170 | static inline void enable_x2apic(void) | |
153 | static inline void apic_write(u32 reg, u32 val) | ||
154 | { | 171 | { |
155 | apic_ops->write(reg, val); | ||
156 | } | 172 | } |
157 | 173 | static inline void enable_IR_x2apic(void) | |
158 | static inline u64 apic_icr_read(void) | ||
159 | { | 174 | { |
160 | return apic_ops->icr_read(); | ||
161 | } | 175 | } |
162 | 176 | static inline int x2apic_enabled(void) | |
163 | static inline void apic_icr_write(u32 low, u32 high) | ||
164 | { | ||
165 | apic_ops->icr_write(low, high); | ||
166 | } | ||
167 | |||
168 | static inline void apic_wait_icr_idle(void) | ||
169 | { | ||
170 | apic_ops->wait_icr_idle(); | ||
171 | } | ||
172 | |||
173 | static inline u32 safe_apic_wait_icr_idle(void) | ||
174 | { | 177 | { |
175 | return apic_ops->safe_wait_icr_idle(); | 178 | return 0; |
176 | } | 179 | } |
180 | #endif | ||
177 | 181 | ||
178 | extern int get_physical_broadcast(void); | 182 | extern int get_physical_broadcast(void); |
179 | 183 | ||
180 | #ifdef CONFIG_X86_64 | 184 | #ifdef CONFIG_X86_X2APIC |
181 | static inline void ack_x2APIC_irq(void) | 185 | static inline void ack_x2APIC_irq(void) |
182 | { | 186 | { |
183 | /* Docs say use 0 for future compatibility */ | 187 | /* Docs say use 0 for future compatibility */ |
@@ -185,18 +189,6 @@ static inline void ack_x2APIC_irq(void) | |||
185 | } | 189 | } |
186 | #endif | 190 | #endif |
187 | 191 | ||
188 | |||
189 | static inline void ack_APIC_irq(void) | ||
190 | { | ||
191 | /* | ||
192 | * ack_APIC_irq() actually gets compiled as a single instruction | ||
193 | * ... yummie. | ||
194 | */ | ||
195 | |||
196 | /* Docs say use 0 for future compatibility */ | ||
197 | apic_write(APIC_EOI, 0); | ||
198 | } | ||
199 | |||
200 | extern int lapic_get_maxlvt(void); | 192 | extern int lapic_get_maxlvt(void); |
201 | extern void clear_local_APIC(void); | 193 | extern void clear_local_APIC(void); |
202 | extern void connect_bsp_APIC(void); | 194 | extern void connect_bsp_APIC(void); |
@@ -244,7 +236,138 @@ static inline void disable_local_APIC(void) { } | |||
244 | #define SET_APIC_ID(x) (apic->set_apic_id(x)) | 236 | #define SET_APIC_ID(x) (apic->set_apic_id(x)) |
245 | #else | 237 | #else |
246 | 238 | ||
247 | #ifdef CONFIG_X86_LOCAL_APIC | 239 | #endif |
240 | |||
241 | /* | ||
242 | * Copyright 2004 James Cleverdon, IBM. | ||
243 | * Subject to the GNU Public License, v.2 | ||
244 | * | ||
245 | * Generic APIC sub-arch data struct. | ||
246 | * | ||
247 | * Hacked for x86-64 by James Cleverdon from i386 architecture code by | ||
248 | * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and | ||
249 | * James Cleverdon. | ||
250 | */ | ||
251 | struct apic { | ||
252 | char *name; | ||
253 | |||
254 | int (*probe)(void); | ||
255 | int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); | ||
256 | int (*apic_id_registered)(void); | ||
257 | |||
258 | u32 irq_delivery_mode; | ||
259 | u32 irq_dest_mode; | ||
260 | |||
261 | const struct cpumask *(*target_cpus)(void); | ||
262 | |||
263 | int disable_esr; | ||
264 | |||
265 | int dest_logical; | ||
266 | unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid); | ||
267 | unsigned long (*check_apicid_present)(int apicid); | ||
268 | |||
269 | void (*vector_allocation_domain)(int cpu, struct cpumask *retmask); | ||
270 | void (*init_apic_ldr)(void); | ||
271 | |||
272 | physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map); | ||
273 | |||
274 | void (*setup_apic_routing)(void); | ||
275 | int (*multi_timer_check)(int apic, int irq); | ||
276 | int (*apicid_to_node)(int logical_apicid); | ||
277 | int (*cpu_to_logical_apicid)(int cpu); | ||
278 | int (*cpu_present_to_apicid)(int mps_cpu); | ||
279 | physid_mask_t (*apicid_to_cpu_present)(int phys_apicid); | ||
280 | void (*setup_portio_remap)(void); | ||
281 | int (*check_phys_apicid_present)(int boot_cpu_physical_apicid); | ||
282 | void (*enable_apic_mode)(void); | ||
283 | int (*phys_pkg_id)(int cpuid_apic, int index_msb); | ||
284 | |||
285 | /* | ||
286 | * When one of the next two hooks returns 1 the apic | ||
287 | * is switched to this. Essentially they are additional | ||
288 | * probe functions: | ||
289 | */ | ||
290 | int (*mps_oem_check)(struct mpc_table *mpc, char *oem, char *productid); | ||
291 | |||
292 | unsigned int (*get_apic_id)(unsigned long x); | ||
293 | unsigned long (*set_apic_id)(unsigned int id); | ||
294 | unsigned long apic_id_mask; | ||
295 | |||
296 | unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask); | ||
297 | unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask, | ||
298 | const struct cpumask *andmask); | ||
299 | |||
300 | /* ipi */ | ||
301 | void (*send_IPI_mask)(const struct cpumask *mask, int vector); | ||
302 | void (*send_IPI_mask_allbutself)(const struct cpumask *mask, | ||
303 | int vector); | ||
304 | void (*send_IPI_allbutself)(int vector); | ||
305 | void (*send_IPI_all)(int vector); | ||
306 | void (*send_IPI_self)(int vector); | ||
307 | |||
308 | /* wakeup_secondary_cpu */ | ||
309 | int (*wakeup_cpu)(int apicid, unsigned long start_eip); | ||
310 | |||
311 | int trampoline_phys_low; | ||
312 | int trampoline_phys_high; | ||
313 | |||
314 | void (*wait_for_init_deassert)(atomic_t *deassert); | ||
315 | void (*smp_callin_clear_local_apic)(void); | ||
316 | void (*inquire_remote_apic)(int apicid); | ||
317 | |||
318 | /* apic ops */ | ||
319 | u32 (*read)(u32 reg); | ||
320 | void (*write)(u32 reg, u32 v); | ||
321 | u64 (*icr_read)(void); | ||
322 | void (*icr_write)(u32 low, u32 high); | ||
323 | void (*wait_icr_idle)(void); | ||
324 | u32 (*safe_wait_icr_idle)(void); | ||
325 | }; | ||
326 | |||
327 | extern struct apic *apic; | ||
328 | |||
329 | static inline u32 apic_read(u32 reg) | ||
330 | { | ||
331 | return apic->read(reg); | ||
332 | } | ||
333 | |||
334 | static inline void apic_write(u32 reg, u32 val) | ||
335 | { | ||
336 | apic->write(reg, val); | ||
337 | } | ||
338 | |||
339 | static inline u64 apic_icr_read(void) | ||
340 | { | ||
341 | return apic->icr_read(); | ||
342 | } | ||
343 | |||
344 | static inline void apic_icr_write(u32 low, u32 high) | ||
345 | { | ||
346 | apic->icr_write(low, high); | ||
347 | } | ||
348 | |||
349 | static inline void apic_wait_icr_idle(void) | ||
350 | { | ||
351 | apic->wait_icr_idle(); | ||
352 | } | ||
353 | |||
354 | static inline u32 safe_apic_wait_icr_idle(void) | ||
355 | { | ||
356 | return apic->safe_wait_icr_idle(); | ||
357 | } | ||
358 | |||
359 | |||
360 | static inline void ack_APIC_irq(void) | ||
361 | { | ||
362 | /* | ||
363 | * ack_APIC_irq() actually gets compiled as a single instruction | ||
364 | * ... yummie. | ||
365 | */ | ||
366 | |||
367 | /* Docs say use 0 for future compatibility */ | ||
368 | apic_write(APIC_EOI, 0); | ||
369 | } | ||
370 | |||
248 | static inline unsigned default_get_apic_id(unsigned long x) | 371 | static inline unsigned default_get_apic_id(unsigned long x) |
249 | { | 372 | { |
250 | unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); | 373 | unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); |
@@ -254,8 +377,171 @@ static inline unsigned default_get_apic_id(unsigned long x) | |||
254 | else | 377 | else |
255 | return (x >> 24) & 0x0F; | 378 | return (x >> 24) & 0x0F; |
256 | } | 379 | } |
380 | |||
381 | /* | ||
382 | * Warm reset vector default position: | ||
383 | */ | ||
384 | #define DEFAULT_TRAMPOLINE_PHYS_LOW 0x467 | ||
385 | #define DEFAULT_TRAMPOLINE_PHYS_HIGH 0x469 | ||
386 | |||
387 | #ifdef CONFIG_X86_32 | ||
388 | extern void es7000_update_apic_to_cluster(void); | ||
389 | #else | ||
390 | extern struct apic apic_flat; | ||
391 | extern struct apic apic_physflat; | ||
392 | extern struct apic apic_x2apic_cluster; | ||
393 | extern struct apic apic_x2apic_phys; | ||
394 | extern int default_acpi_madt_oem_check(char *, char *); | ||
395 | |||
396 | extern void apic_send_IPI_self(int vector); | ||
397 | |||
398 | extern struct apic apic_x2apic_uv_x; | ||
399 | DECLARE_PER_CPU(int, x2apic_extra_bits); | ||
400 | |||
401 | extern int default_cpu_present_to_apicid(int mps_cpu); | ||
402 | extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid); | ||
403 | #endif | ||
404 | |||
405 | static inline void default_wait_for_init_deassert(atomic_t *deassert) | ||
406 | { | ||
407 | while (!atomic_read(deassert)) | ||
408 | cpu_relax(); | ||
409 | return; | ||
410 | } | ||
411 | |||
412 | extern void generic_bigsmp_probe(void); | ||
413 | |||
414 | |||
415 | #ifdef CONFIG_X86_LOCAL_APIC | ||
416 | |||
417 | #include <asm/smp.h> | ||
418 | |||
419 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
420 | |||
421 | static inline const struct cpumask *default_target_cpus(void) | ||
422 | { | ||
423 | #ifdef CONFIG_SMP | ||
424 | return cpu_online_mask; | ||
425 | #else | ||
426 | return cpumask_of(0); | ||
257 | #endif | 427 | #endif |
428 | } | ||
429 | |||
430 | DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); | ||
431 | |||
432 | |||
433 | static inline unsigned int read_apic_id(void) | ||
434 | { | ||
435 | unsigned int reg; | ||
436 | |||
437 | reg = apic_read(APIC_ID); | ||
438 | |||
439 | return apic->get_apic_id(reg); | ||
440 | } | ||
441 | |||
442 | extern void default_setup_apic_routing(void); | ||
443 | |||
444 | #ifdef CONFIG_X86_32 | ||
445 | /* | ||
446 | * Set up the logical destination ID. | ||
447 | * | ||
448 | * Intel recommends to set DFR, LDR and TPR before enabling | ||
449 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
450 | * document number 292116). So here it goes... | ||
451 | */ | ||
452 | extern void default_init_apic_ldr(void); | ||
453 | |||
454 | static inline int default_apic_id_registered(void) | ||
455 | { | ||
456 | return physid_isset(read_apic_id(), phys_cpu_present_map); | ||
457 | } | ||
458 | |||
459 | static inline unsigned int | ||
460 | default_cpu_mask_to_apicid(const struct cpumask *cpumask) | ||
461 | { | ||
462 | return cpumask_bits(cpumask)[0]; | ||
463 | } | ||
464 | |||
465 | static inline unsigned int | ||
466 | default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
467 | const struct cpumask *andmask) | ||
468 | { | ||
469 | unsigned long mask1 = cpumask_bits(cpumask)[0]; | ||
470 | unsigned long mask2 = cpumask_bits(andmask)[0]; | ||
471 | unsigned long mask3 = cpumask_bits(cpu_online_mask)[0]; | ||
472 | |||
473 | return (unsigned int)(mask1 & mask2 & mask3); | ||
474 | } | ||
475 | |||
476 | static inline int default_phys_pkg_id(int cpuid_apic, int index_msb) | ||
477 | { | ||
478 | return cpuid_apic >> index_msb; | ||
479 | } | ||
480 | |||
481 | extern int default_apicid_to_node(int logical_apicid); | ||
482 | |||
483 | #endif | ||
484 | |||
485 | static inline unsigned long default_check_apicid_used(physid_mask_t bitmap, int apicid) | ||
486 | { | ||
487 | return physid_isset(apicid, bitmap); | ||
488 | } | ||
489 | |||
490 | static inline unsigned long default_check_apicid_present(int bit) | ||
491 | { | ||
492 | return physid_isset(bit, phys_cpu_present_map); | ||
493 | } | ||
494 | |||
495 | static inline physid_mask_t default_ioapic_phys_id_map(physid_mask_t phys_map) | ||
496 | { | ||
497 | return phys_map; | ||
498 | } | ||
499 | |||
500 | /* Mapping from cpu number to logical apicid */ | ||
501 | static inline int default_cpu_to_logical_apicid(int cpu) | ||
502 | { | ||
503 | return 1 << cpu; | ||
504 | } | ||
505 | |||
506 | static inline int __default_cpu_present_to_apicid(int mps_cpu) | ||
507 | { | ||
508 | if (mps_cpu < nr_cpu_ids && cpu_present(mps_cpu)) | ||
509 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
510 | else | ||
511 | return BAD_APICID; | ||
512 | } | ||
513 | |||
514 | static inline int | ||
515 | __default_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
516 | { | ||
517 | return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map); | ||
518 | } | ||
519 | |||
520 | #ifdef CONFIG_X86_32 | ||
521 | static inline int default_cpu_present_to_apicid(int mps_cpu) | ||
522 | { | ||
523 | return __default_cpu_present_to_apicid(mps_cpu); | ||
524 | } | ||
525 | |||
526 | static inline int | ||
527 | default_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
528 | { | ||
529 | return __default_check_phys_apicid_present(boot_cpu_physical_apicid); | ||
530 | } | ||
531 | #else | ||
532 | extern int default_cpu_present_to_apicid(int mps_cpu); | ||
533 | extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid); | ||
534 | #endif | ||
535 | |||
536 | static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid) | ||
537 | { | ||
538 | return physid_mask_of_physid(phys_apicid); | ||
539 | } | ||
540 | |||
541 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
258 | 542 | ||
543 | #ifdef CONFIG_X86_32 | ||
544 | extern u8 cpu_2_logical_apicid[NR_CPUS]; | ||
259 | #endif | 545 | #endif |
260 | 546 | ||
261 | #endif /* _ASM_X86_APIC_H */ | 547 | #endif /* _ASM_X86_APIC_H */ |
diff --git a/arch/x86/include/asm/arch_hooks.h b/arch/x86/include/asm/arch_hooks.h deleted file mode 100644 index cbd4957838a6..000000000000 --- a/arch/x86/include/asm/arch_hooks.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | #ifndef _ASM_X86_ARCH_HOOKS_H | ||
2 | #define _ASM_X86_ARCH_HOOKS_H | ||
3 | |||
4 | #include <linux/interrupt.h> | ||
5 | |||
6 | /* | ||
7 | * linux/include/asm/arch_hooks.h | ||
8 | * | ||
9 | * define the architecture specific hooks | ||
10 | */ | ||
11 | |||
12 | /* these aren't arch hooks, they are generic routines | ||
13 | * that can be used by the hooks */ | ||
14 | extern void init_ISA_irqs(void); | ||
15 | extern irqreturn_t timer_interrupt(int irq, void *dev_id); | ||
16 | |||
17 | /* these are the defined hooks */ | ||
18 | extern void intr_init_hook(void); | ||
19 | extern void pre_intr_init_hook(void); | ||
20 | extern void pre_setup_arch_hook(void); | ||
21 | extern void trap_init_hook(void); | ||
22 | extern void pre_time_init_hook(void); | ||
23 | extern void time_init_hook(void); | ||
24 | extern void mca_nmi_hook(void); | ||
25 | |||
26 | #endif /* _ASM_X86_ARCH_HOOKS_H */ | ||
diff --git a/arch/x86/include/asm/genapic.h b/arch/x86/include/asm/genapic.h index 273b99452ae0..4b8b98fa7f25 100644 --- a/arch/x86/include/asm/genapic.h +++ b/arch/x86/include/asm/genapic.h | |||
@@ -1,263 +1 @@ | |||
1 | #ifndef _ASM_X86_GENAPIC_H | #include <asm/apic.h> | |
2 | #define _ASM_X86_GENAPIC_H | ||
3 | |||
4 | #include <linux/cpumask.h> | ||
5 | |||
6 | #include <asm/mpspec.h> | ||
7 | #include <asm/atomic.h> | ||
8 | |||
9 | /* | ||
10 | * Copyright 2004 James Cleverdon, IBM. | ||
11 | * Subject to the GNU Public License, v.2 | ||
12 | * | ||
13 | * Generic APIC sub-arch data struct. | ||
14 | * | ||
15 | * Hacked for x86-64 by James Cleverdon from i386 architecture code by | ||
16 | * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and | ||
17 | * James Cleverdon. | ||
18 | */ | ||
19 | struct genapic { | ||
20 | char *name; | ||
21 | |||
22 | int (*probe)(void); | ||
23 | int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); | ||
24 | int (*apic_id_registered)(void); | ||
25 | |||
26 | u32 irq_delivery_mode; | ||
27 | u32 irq_dest_mode; | ||
28 | |||
29 | const struct cpumask *(*target_cpus)(void); | ||
30 | |||
31 | int disable_esr; | ||
32 | |||
33 | int dest_logical; | ||
34 | unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid); | ||
35 | unsigned long (*check_apicid_present)(int apicid); | ||
36 | |||
37 | void (*vector_allocation_domain)(int cpu, struct cpumask *retmask); | ||
38 | void (*init_apic_ldr)(void); | ||
39 | |||
40 | physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map); | ||
41 | |||
42 | void (*setup_apic_routing)(void); | ||
43 | int (*multi_timer_check)(int apic, int irq); | ||
44 | int (*apicid_to_node)(int logical_apicid); | ||
45 | int (*cpu_to_logical_apicid)(int cpu); | ||
46 | int (*cpu_present_to_apicid)(int mps_cpu); | ||
47 | physid_mask_t (*apicid_to_cpu_present)(int phys_apicid); | ||
48 | void (*setup_portio_remap)(void); | ||
49 | int (*check_phys_apicid_present)(int boot_cpu_physical_apicid); | ||
50 | void (*enable_apic_mode)(void); | ||
51 | int (*phys_pkg_id)(int cpuid_apic, int index_msb); | ||
52 | |||
53 | /* | ||
54 | * When one of the next two hooks returns 1 the genapic | ||
55 | * is switched to this. Essentially they are additional | ||
56 | * probe functions: | ||
57 | */ | ||
58 | int (*mps_oem_check)(struct mpc_table *mpc, char *oem, char *productid); | ||
59 | |||
60 | unsigned int (*get_apic_id)(unsigned long x); | ||
61 | unsigned long (*set_apic_id)(unsigned int id); | ||
62 | unsigned long apic_id_mask; | ||
63 | |||
64 | unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask); | ||
65 | unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask, | ||
66 | const struct cpumask *andmask); | ||
67 | |||
68 | /* ipi */ | ||
69 | void (*send_IPI_mask)(const struct cpumask *mask, int vector); | ||
70 | void (*send_IPI_mask_allbutself)(const struct cpumask *mask, | ||
71 | int vector); | ||
72 | void (*send_IPI_allbutself)(int vector); | ||
73 | void (*send_IPI_all)(int vector); | ||
74 | void (*send_IPI_self)(int vector); | ||
75 | |||
76 | /* wakeup_secondary_cpu */ | ||
77 | int (*wakeup_cpu)(int apicid, unsigned long start_eip); | ||
78 | |||
79 | int trampoline_phys_low; | ||
80 | int trampoline_phys_high; | ||
81 | |||
82 | void (*wait_for_init_deassert)(atomic_t *deassert); | ||
83 | void (*smp_callin_clear_local_apic)(void); | ||
84 | void (*store_NMI_vector)(unsigned short *high, unsigned short *low); | ||
85 | void (*inquire_remote_apic)(int apicid); | ||
86 | }; | ||
87 | |||
88 | extern struct genapic *apic; | ||
89 | |||
90 | /* | ||
91 | * Warm reset vector default position: | ||
92 | */ | ||
93 | #define DEFAULT_TRAMPOLINE_PHYS_LOW 0x467 | ||
94 | #define DEFAULT_TRAMPOLINE_PHYS_HIGH 0x469 | ||
95 | |||
96 | #ifdef CONFIG_X86_32 | ||
97 | extern void es7000_update_genapic_to_cluster(void); | ||
98 | #else | ||
99 | extern struct genapic apic_flat; | ||
100 | extern struct genapic apic_physflat; | ||
101 | extern struct genapic apic_x2apic_cluster; | ||
102 | extern struct genapic apic_x2apic_phys; | ||
103 | extern int default_acpi_madt_oem_check(char *, char *); | ||
104 | |||
105 | extern void apic_send_IPI_self(int vector); | ||
106 | |||
107 | extern struct genapic apic_x2apic_uv_x; | ||
108 | DECLARE_PER_CPU(int, x2apic_extra_bits); | ||
109 | |||
110 | extern void default_setup_apic_routing(void); | ||
111 | |||
112 | extern int default_cpu_present_to_apicid(int mps_cpu); | ||
113 | extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid); | ||
114 | #endif | ||
115 | |||
116 | static inline void default_wait_for_init_deassert(atomic_t *deassert) | ||
117 | { | ||
118 | while (!atomic_read(deassert)) | ||
119 | cpu_relax(); | ||
120 | return; | ||
121 | } | ||
122 | |||
123 | extern void generic_bigsmp_probe(void); | ||
124 | |||
125 | |||
126 | #ifdef CONFIG_X86_LOCAL_APIC | ||
127 | |||
128 | #include <asm/smp.h> | ||
129 | |||
130 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
131 | |||
132 | static inline const struct cpumask *default_target_cpus(void) | ||
133 | { | ||
134 | #ifdef CONFIG_SMP | ||
135 | return cpu_online_mask; | ||
136 | #else | ||
137 | return cpumask_of(0); | ||
138 | #endif | ||
139 | } | ||
140 | |||
141 | DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); | ||
142 | |||
143 | |||
144 | static inline unsigned int read_apic_id(void) | ||
145 | { | ||
146 | unsigned int reg; | ||
147 | |||
148 | reg = apic_read(APIC_ID); | ||
149 | |||
150 | return apic->get_apic_id(reg); | ||
151 | } | ||
152 | |||
153 | #ifdef CONFIG_X86_64 | ||
154 | extern void default_setup_apic_routing(void); | ||
155 | #else | ||
156 | |||
157 | /* | ||
158 | * Set up the logical destination ID. | ||
159 | * | ||
160 | * Intel recommends to set DFR, LDR and TPR before enabling | ||
161 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | ||
162 | * document number 292116). So here it goes... | ||
163 | */ | ||
164 | extern void default_init_apic_ldr(void); | ||
165 | |||
166 | static inline int default_apic_id_registered(void) | ||
167 | { | ||
168 | return physid_isset(read_apic_id(), phys_cpu_present_map); | ||
169 | } | ||
170 | |||
171 | static inline unsigned int | ||
172 | default_cpu_mask_to_apicid(const struct cpumask *cpumask) | ||
173 | { | ||
174 | return cpumask_bits(cpumask)[0]; | ||
175 | } | ||
176 | |||
177 | static inline unsigned int | ||
178 | default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
179 | const struct cpumask *andmask) | ||
180 | { | ||
181 | unsigned long mask1 = cpumask_bits(cpumask)[0]; | ||
182 | unsigned long mask2 = cpumask_bits(andmask)[0]; | ||
183 | unsigned long mask3 = cpumask_bits(cpu_online_mask)[0]; | ||
184 | |||
185 | return (unsigned int)(mask1 & mask2 & mask3); | ||
186 | } | ||
187 | |||
188 | static inline int default_phys_pkg_id(int cpuid_apic, int index_msb) | ||
189 | { | ||
190 | return cpuid_apic >> index_msb; | ||
191 | } | ||
192 | |||
193 | static inline void default_setup_apic_routing(void) | ||
194 | { | ||
195 | #ifdef CONFIG_X86_IO_APIC | ||
196 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | ||
197 | "Flat", nr_ioapics); | ||
198 | #endif | ||
199 | } | ||
200 | |||
201 | extern int default_apicid_to_node(int logical_apicid); | ||
202 | |||
203 | #endif | ||
204 | |||
205 | static inline unsigned long default_check_apicid_used(physid_mask_t bitmap, int apicid) | ||
206 | { | ||
207 | return physid_isset(apicid, bitmap); | ||
208 | } | ||
209 | |||
210 | static inline unsigned long default_check_apicid_present(int bit) | ||
211 | { | ||
212 | return physid_isset(bit, phys_cpu_present_map); | ||
213 | } | ||
214 | |||
215 | static inline physid_mask_t default_ioapic_phys_id_map(physid_mask_t phys_map) | ||
216 | { | ||
217 | return phys_map; | ||
218 | } | ||
219 | |||
220 | /* Mapping from cpu number to logical apicid */ | ||
221 | static inline int default_cpu_to_logical_apicid(int cpu) | ||
222 | { | ||
223 | return 1 << cpu; | ||
224 | } | ||
225 | |||
226 | static inline int __default_cpu_present_to_apicid(int mps_cpu) | ||
227 | { | ||
228 | if (mps_cpu < nr_cpu_ids && cpu_present(mps_cpu)) | ||
229 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | ||
230 | else | ||
231 | return BAD_APICID; | ||
232 | } | ||
233 | |||
234 | static inline int | ||
235 | __default_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
236 | { | ||
237 | return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map); | ||
238 | } | ||
239 | |||
240 | #ifdef CONFIG_X86_32 | ||
241 | static inline int default_cpu_present_to_apicid(int mps_cpu) | ||
242 | { | ||
243 | return __default_cpu_present_to_apicid(mps_cpu); | ||
244 | } | ||
245 | |||
246 | static inline int | ||
247 | default_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
248 | { | ||
249 | return __default_check_phys_apicid_present(boot_cpu_physical_apicid); | ||
250 | } | ||
251 | #else | ||
252 | extern int default_cpu_present_to_apicid(int mps_cpu); | ||
253 | extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid); | ||
254 | #endif | ||
255 | |||
256 | static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid) | ||
257 | { | ||
258 | return physid_mask_of_physid(phys_apicid); | ||
259 | } | ||
260 | |||
261 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
262 | |||
263 | #endif /* _ASM_X86_GENAPIC_64_H */ | ||
diff --git a/arch/x86/include/asm/i8259.h b/arch/x86/include/asm/i8259.h index 58d7091eeb1f..1a99e6c092af 100644 --- a/arch/x86/include/asm/i8259.h +++ b/arch/x86/include/asm/i8259.h | |||
@@ -60,4 +60,8 @@ extern struct irq_chip i8259A_chip; | |||
60 | extern void mask_8259A(void); | 60 | extern void mask_8259A(void); |
61 | extern void unmask_8259A(void); | 61 | extern void unmask_8259A(void); |
62 | 62 | ||
63 | #ifdef CONFIG_X86_32 | ||
64 | extern void init_ISA_irqs(void); | ||
65 | #endif | ||
66 | |||
63 | #endif /* _ASM_X86_I8259_H */ | 67 | #endif /* _ASM_X86_I8259_H */ |
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 4f8e820cf38f..683d0b4c00fc 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h | |||
@@ -124,10 +124,15 @@ static inline void *phys_to_virt(phys_addr_t address) | |||
124 | 124 | ||
125 | /* | 125 | /* |
126 | * ISA I/O bus memory addresses are 1:1 with the physical address. | 126 | * ISA I/O bus memory addresses are 1:1 with the physical address. |
127 | * However, we truncate the address to unsigned int to avoid undesirable | ||
128 | * promitions in legacy drivers. | ||
127 | */ | 129 | */ |
128 | #define isa_virt_to_bus (unsigned long)virt_to_phys | 130 | static inline unsigned int isa_virt_to_bus(volatile void *address) |
129 | #define isa_page_to_bus page_to_phys | 131 | { |
130 | #define isa_bus_to_virt phys_to_virt | 132 | return (unsigned int)virt_to_phys(address); |
133 | } | ||
134 | #define isa_page_to_bus(page) ((unsigned int)page_to_phys(page)) | ||
135 | #define isa_bus_to_virt phys_to_virt | ||
131 | 136 | ||
132 | /* | 137 | /* |
133 | * However PCI ones are not necessarily 1:1 and therefore these interfaces | 138 | * However PCI ones are not necessarily 1:1 and therefore these interfaces |
diff --git a/arch/x86/include/asm/ipi.h b/arch/x86/include/asm/ipi.h index 5f2efc5d9927..0b7228268a63 100644 --- a/arch/x86/include/asm/ipi.h +++ b/arch/x86/include/asm/ipi.h | |||
@@ -123,8 +123,6 @@ extern void default_send_IPI_mask_sequence_phys(const struct cpumask *mask, | |||
123 | int vector); | 123 | int vector); |
124 | extern void default_send_IPI_mask_allbutself_phys(const struct cpumask *mask, | 124 | extern void default_send_IPI_mask_allbutself_phys(const struct cpumask *mask, |
125 | int vector); | 125 | int vector); |
126 | #include <asm/genapic.h> | ||
127 | |||
128 | extern void default_send_IPI_mask_sequence_logical(const struct cpumask *mask, | 126 | extern void default_send_IPI_mask_sequence_logical(const struct cpumask *mask, |
129 | int vector); | 127 | int vector); |
130 | extern void default_send_IPI_mask_allbutself_logical(const struct cpumask *mask, | 128 | extern void default_send_IPI_mask_allbutself_logical(const struct cpumask *mask, |
diff --git a/arch/x86/include/asm/kvm.h b/arch/x86/include/asm/kvm.h index d2e3bf3608af..886c9402ec45 100644 --- a/arch/x86/include/asm/kvm.h +++ b/arch/x86/include/asm/kvm.h | |||
@@ -9,6 +9,13 @@ | |||
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <linux/ioctl.h> | 10 | #include <linux/ioctl.h> |
11 | 11 | ||
12 | /* Select x86 specific features in <linux/kvm.h> */ | ||
13 | #define __KVM_HAVE_PIT | ||
14 | #define __KVM_HAVE_IOAPIC | ||
15 | #define __KVM_HAVE_DEVICE_ASSIGNMENT | ||
16 | #define __KVM_HAVE_MSI | ||
17 | #define __KVM_HAVE_USER_NMI | ||
18 | |||
12 | /* Architectural interrupt line count. */ | 19 | /* Architectural interrupt line count. */ |
13 | #define KVM_NR_INTERRUPTS 256 | 20 | #define KVM_NR_INTERRUPTS 256 |
14 | 21 | ||
diff --git a/arch/x86/include/asm/mach-voyager/do_timer.h b/arch/x86/include/asm/mach-voyager/do_timer.h deleted file mode 100644 index 9e5a459fd15b..000000000000 --- a/arch/x86/include/asm/mach-voyager/do_timer.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* defines for inline arch setup functions */ | ||
2 | #include <linux/clockchips.h> | ||
3 | |||
4 | #include <asm/voyager.h> | ||
5 | #include <asm/i8253.h> | ||
6 | |||
7 | /** | ||
8 | * do_timer_interrupt_hook - hook into timer tick | ||
9 | * | ||
10 | * Call the pit clock event handler. see asm/i8253.h | ||
11 | **/ | ||
12 | static inline void do_timer_interrupt_hook(void) | ||
13 | { | ||
14 | global_clock_event->event_handler(global_clock_event); | ||
15 | voyager_timer_interrupt(); | ||
16 | } | ||
17 | |||
diff --git a/arch/x86/include/asm/mach-voyager/entry_arch.h b/arch/x86/include/asm/mach-voyager/entry_arch.h deleted file mode 100644 index ae52624b5937..000000000000 --- a/arch/x86/include/asm/mach-voyager/entry_arch.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* -*- mode: c; c-basic-offset: 8 -*- */ | ||
2 | |||
3 | /* Copyright (C) 2002 | ||
4 | * | ||
5 | * Author: James.Bottomley@HansenPartnership.com | ||
6 | * | ||
7 | * linux/arch/i386/voyager/entry_arch.h | ||
8 | * | ||
9 | * This file builds the VIC and QIC CPI gates | ||
10 | */ | ||
11 | |||
12 | /* initialise the voyager interrupt gates | ||
13 | * | ||
14 | * This uses the macros in irq.h to set up assembly jump gates. The | ||
15 | * calls are then redirected to the same routine with smp_ prefixed */ | ||
16 | BUILD_INTERRUPT(vic_sys_interrupt, VIC_SYS_INT) | ||
17 | BUILD_INTERRUPT(vic_cmn_interrupt, VIC_CMN_INT) | ||
18 | BUILD_INTERRUPT(vic_cpi_interrupt, VIC_CPI_LEVEL0); | ||
19 | |||
20 | /* do all the QIC interrupts */ | ||
21 | BUILD_INTERRUPT(qic_timer_interrupt, QIC_TIMER_CPI); | ||
22 | BUILD_INTERRUPT(qic_invalidate_interrupt, QIC_INVALIDATE_CPI); | ||
23 | BUILD_INTERRUPT(qic_reschedule_interrupt, QIC_RESCHEDULE_CPI); | ||
24 | BUILD_INTERRUPT(qic_enable_irq_interrupt, QIC_ENABLE_IRQ_CPI); | ||
25 | BUILD_INTERRUPT(qic_call_function_interrupt, QIC_CALL_FUNCTION_CPI); | ||
26 | BUILD_INTERRUPT(qic_call_function_single_interrupt, QIC_CALL_FUNCTION_SINGLE_CPI); | ||
diff --git a/arch/x86/include/asm/mach-voyager/setup_arch.h b/arch/x86/include/asm/mach-voyager/setup_arch.h deleted file mode 100644 index 71729ca05cd7..000000000000 --- a/arch/x86/include/asm/mach-voyager/setup_arch.h +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | #include <asm/voyager.h> | ||
2 | #include <asm/setup.h> | ||
3 | #define VOYAGER_BIOS_INFO ((struct voyager_bios_info *) \ | ||
4 | (&boot_params.apm_bios_info)) | ||
5 | |||
6 | /* Hook to call BIOS initialisation function */ | ||
7 | |||
8 | /* for voyager, pass the voyager BIOS/SUS info area to the detection | ||
9 | * routines */ | ||
10 | |||
11 | #define ARCH_SETUP voyager_detect(VOYAGER_BIOS_INFO); | ||
12 | |||
diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h index 07f1af494ca5..105fb90a0635 100644 --- a/arch/x86/include/asm/mmzone_32.h +++ b/arch/x86/include/asm/mmzone_32.h | |||
@@ -32,8 +32,6 @@ static inline void get_memcfg_numa(void) | |||
32 | get_memcfg_numa_flat(); | 32 | get_memcfg_numa_flat(); |
33 | } | 33 | } |
34 | 34 | ||
35 | extern int early_pfn_to_nid(unsigned long pfn); | ||
36 | |||
37 | extern void resume_map_numa_kva(pgd_t *pgd); | 35 | extern void resume_map_numa_kva(pgd_t *pgd); |
38 | 36 | ||
39 | #else /* !CONFIG_NUMA */ | 37 | #else /* !CONFIG_NUMA */ |
diff --git a/arch/x86/include/asm/mmzone_64.h b/arch/x86/include/asm/mmzone_64.h index a5b3817d4b9e..a29f48c2a322 100644 --- a/arch/x86/include/asm/mmzone_64.h +++ b/arch/x86/include/asm/mmzone_64.h | |||
@@ -40,8 +40,6 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) | |||
40 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ | 40 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ |
41 | NODE_DATA(nid)->node_spanned_pages) | 41 | NODE_DATA(nid)->node_spanned_pages) |
42 | 42 | ||
43 | extern int early_pfn_to_nid(unsigned long pfn); | ||
44 | |||
45 | #ifdef CONFIG_NUMA_EMU | 43 | #ifdef CONFIG_NUMA_EMU |
46 | #define FAKE_NODE_MIN_SIZE (64 * 1024 * 1024) | 44 | #define FAKE_NODE_MIN_SIZE (64 * 1024 * 1024) |
47 | #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) | 45 | #define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) |
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h index 5916c8df09d9..642fc7fc8cdc 100644 --- a/arch/x86/include/asm/mpspec.h +++ b/arch/x86/include/asm/mpspec.h | |||
@@ -167,6 +167,4 @@ extern int generic_mps_oem_check(struct mpc_table *, char *, char *); | |||
167 | 167 | ||
168 | extern int default_acpi_madt_oem_check(char *, char *); | 168 | extern int default_acpi_madt_oem_check(char *, char *); |
169 | 169 | ||
170 | extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); | ||
171 | |||
172 | #endif /* _ASM_X86_MPSPEC_H */ | 170 | #endif /* _ASM_X86_MPSPEC_H */ |
diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h index b5486aaf36ec..f1e4a79a6e41 100644 --- a/arch/x86/include/asm/page_32_types.h +++ b/arch/x86/include/asm/page_32_types.h | |||
@@ -33,12 +33,10 @@ | |||
33 | /* 44=32+12, the limit we can fit into an unsigned long pfn */ | 33 | /* 44=32+12, the limit we can fit into an unsigned long pfn */ |
34 | #define __PHYSICAL_MASK_SHIFT 44 | 34 | #define __PHYSICAL_MASK_SHIFT 44 |
35 | #define __VIRTUAL_MASK_SHIFT 32 | 35 | #define __VIRTUAL_MASK_SHIFT 32 |
36 | #define PAGETABLE_LEVELS 3 | ||
37 | 36 | ||
38 | #else /* !CONFIG_X86_PAE */ | 37 | #else /* !CONFIG_X86_PAE */ |
39 | #define __PHYSICAL_MASK_SHIFT 32 | 38 | #define __PHYSICAL_MASK_SHIFT 32 |
40 | #define __VIRTUAL_MASK_SHIFT 32 | 39 | #define __VIRTUAL_MASK_SHIFT 32 |
41 | #define PAGETABLE_LEVELS 2 | ||
42 | #endif /* CONFIG_X86_PAE */ | 40 | #endif /* CONFIG_X86_PAE */ |
43 | 41 | ||
44 | #ifndef __ASSEMBLY__ | 42 | #ifndef __ASSEMBLY__ |
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h index bc73af3eda9c..d38c91b70248 100644 --- a/arch/x86/include/asm/page_64_types.h +++ b/arch/x86/include/asm/page_64_types.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _ASM_X86_PAGE_64_DEFS_H | 1 | #ifndef _ASM_X86_PAGE_64_DEFS_H |
2 | #define _ASM_X86_PAGE_64_DEFS_H | 2 | #define _ASM_X86_PAGE_64_DEFS_H |
3 | 3 | ||
4 | #define PAGETABLE_LEVELS 4 | ||
5 | |||
6 | #define THREAD_ORDER 1 | 4 | #define THREAD_ORDER 1 |
7 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) | 5 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) |
8 | #define CURRENT_MASK (~(THREAD_SIZE - 1)) | 6 | #define CURRENT_MASK (~(THREAD_SIZE - 1)) |
diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h index 2c52ff767584..2d625da6603c 100644 --- a/arch/x86/include/asm/page_types.h +++ b/arch/x86/include/asm/page_types.h | |||
@@ -16,12 +16,6 @@ | |||
16 | (ie, 32-bit PAE). */ | 16 | (ie, 32-bit PAE). */ |
17 | #define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK) | 17 | #define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK) |
18 | 18 | ||
19 | /* PTE_PFN_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */ | ||
20 | #define PTE_PFN_MASK ((pteval_t)PHYSICAL_PAGE_MASK) | ||
21 | |||
22 | /* PTE_FLAGS_MASK extracts the flags from a (pte|pmd|pud|pgd)val_t */ | ||
23 | #define PTE_FLAGS_MASK (~PTE_PFN_MASK) | ||
24 | |||
25 | #define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT) | 19 | #define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT) |
26 | #define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1)) | 20 | #define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1)) |
27 | 21 | ||
diff --git a/arch/x86/include/asm/pgtable-2level_types.h b/arch/x86/include/asm/pgtable-2level_types.h index 09ae67efcebd..daacc23e3fb9 100644 --- a/arch/x86/include/asm/pgtable-2level_types.h +++ b/arch/x86/include/asm/pgtable-2level_types.h | |||
@@ -17,6 +17,7 @@ typedef union { | |||
17 | #endif /* !__ASSEMBLY__ */ | 17 | #endif /* !__ASSEMBLY__ */ |
18 | 18 | ||
19 | #define SHARED_KERNEL_PMD 0 | 19 | #define SHARED_KERNEL_PMD 0 |
20 | #define PAGETABLE_LEVELS 2 | ||
20 | 21 | ||
21 | /* | 22 | /* |
22 | * traditional i386 two-level paging structure: | 23 | * traditional i386 two-level paging structure: |
@@ -25,6 +26,7 @@ typedef union { | |||
25 | #define PGDIR_SHIFT 22 | 26 | #define PGDIR_SHIFT 22 |
26 | #define PTRS_PER_PGD 1024 | 27 | #define PTRS_PER_PGD 1024 |
27 | 28 | ||
29 | |||
28 | /* | 30 | /* |
29 | * the i386 is two-level, so we don't really have any | 31 | * the i386 is two-level, so we don't really have any |
30 | * PMD directory physically. | 32 | * PMD directory physically. |
diff --git a/arch/x86/include/asm/pgtable-3level_types.h b/arch/x86/include/asm/pgtable-3level_types.h index bcc89625ebe5..1bd5876c8649 100644 --- a/arch/x86/include/asm/pgtable-3level_types.h +++ b/arch/x86/include/asm/pgtable-3level_types.h | |||
@@ -24,6 +24,8 @@ typedef union { | |||
24 | #define SHARED_KERNEL_PMD 1 | 24 | #define SHARED_KERNEL_PMD 1 |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #define PAGETABLE_LEVELS 3 | ||
28 | |||
27 | /* | 29 | /* |
28 | * PGDIR_SHIFT determines what a top-level page table entry can map | 30 | * PGDIR_SHIFT determines what a top-level page table entry can map |
29 | */ | 31 | */ |
diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index 2f59135c6f2a..fbf42b8e0383 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h | |||
@@ -18,6 +18,7 @@ typedef struct { pteval_t pte; } pte_t; | |||
18 | #endif /* !__ASSEMBLY__ */ | 18 | #endif /* !__ASSEMBLY__ */ |
19 | 19 | ||
20 | #define SHARED_KERNEL_PMD 0 | 20 | #define SHARED_KERNEL_PMD 0 |
21 | #define PAGETABLE_LEVELS 4 | ||
21 | 22 | ||
22 | /* | 23 | /* |
23 | * PGDIR_SHIFT determines what a top-level page table entry can map | 24 | * PGDIR_SHIFT determines what a top-level page table entry can map |
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index 9dafe87be2de..4d258ad76a0f 100644 --- a/arch/x86/include/asm/pgtable_types.h +++ b/arch/x86/include/asm/pgtable_types.h | |||
@@ -173,6 +173,12 @@ | |||
173 | 173 | ||
174 | #include <linux/types.h> | 174 | #include <linux/types.h> |
175 | 175 | ||
176 | /* PTE_PFN_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */ | ||
177 | #define PTE_PFN_MASK ((pteval_t)PHYSICAL_PAGE_MASK) | ||
178 | |||
179 | /* PTE_FLAGS_MASK extracts the flags from a (pte|pmd|pud|pgd)val_t */ | ||
180 | #define PTE_FLAGS_MASK (~PTE_PFN_MASK) | ||
181 | |||
176 | typedef struct pgprot { pgprotval_t pgprot; } pgprot_t; | 182 | typedef struct pgprot { pgprotval_t pgprot; } pgprot_t; |
177 | 183 | ||
178 | typedef struct { pgdval_t pgd; } pgd_t; | 184 | typedef struct { pgdval_t pgd; } pgd_t; |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index dabab1a19ddd..c7a98f738210 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -403,7 +403,6 @@ DECLARE_PER_CPU(unsigned long, stack_canary); | |||
403 | #endif | 403 | #endif |
404 | #endif /* X86_64 */ | 404 | #endif /* X86_64 */ |
405 | 405 | ||
406 | extern void print_cpu_info(struct cpuinfo_x86 *); | ||
407 | extern unsigned int xstate_size; | 406 | extern unsigned int xstate_size; |
408 | extern void free_thread_xstate(struct task_struct *); | 407 | extern void free_thread_xstate(struct task_struct *); |
409 | extern struct kmem_cache *task_xstate_cachep; | 408 | extern struct kmem_cache *task_xstate_cachep; |
@@ -862,6 +861,7 @@ static inline void spin_lock_prefetch(const void *x) | |||
862 | * User space process size: 3GB (default). | 861 | * User space process size: 3GB (default). |
863 | */ | 862 | */ |
864 | #define TASK_SIZE PAGE_OFFSET | 863 | #define TASK_SIZE PAGE_OFFSET |
864 | #define TASK_SIZE_MAX TASK_SIZE | ||
865 | #define STACK_TOP TASK_SIZE | 865 | #define STACK_TOP TASK_SIZE |
866 | #define STACK_TOP_MAX STACK_TOP | 866 | #define STACK_TOP_MAX STACK_TOP |
867 | 867 | ||
@@ -921,7 +921,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk); | |||
921 | /* | 921 | /* |
922 | * User space process size. 47bits minus one guard page. | 922 | * User space process size. 47bits minus one guard page. |
923 | */ | 923 | */ |
924 | #define TASK_SIZE64 ((1UL << 47) - PAGE_SIZE) | 924 | #define TASK_SIZE_MAX ((1UL << 47) - PAGE_SIZE) |
925 | 925 | ||
926 | /* This decides where the kernel will search for a free chunk of vm | 926 | /* This decides where the kernel will search for a free chunk of vm |
927 | * space during mmap's. | 927 | * space during mmap's. |
@@ -930,12 +930,12 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk); | |||
930 | 0xc0000000 : 0xFFFFe000) | 930 | 0xc0000000 : 0xFFFFe000) |
931 | 931 | ||
932 | #define TASK_SIZE (test_thread_flag(TIF_IA32) ? \ | 932 | #define TASK_SIZE (test_thread_flag(TIF_IA32) ? \ |
933 | IA32_PAGE_OFFSET : TASK_SIZE64) | 933 | IA32_PAGE_OFFSET : TASK_SIZE_MAX) |
934 | #define TASK_SIZE_OF(child) ((test_tsk_thread_flag(child, TIF_IA32)) ? \ | 934 | #define TASK_SIZE_OF(child) ((test_tsk_thread_flag(child, TIF_IA32)) ? \ |
935 | IA32_PAGE_OFFSET : TASK_SIZE64) | 935 | IA32_PAGE_OFFSET : TASK_SIZE_MAX) |
936 | 936 | ||
937 | #define STACK_TOP TASK_SIZE | 937 | #define STACK_TOP TASK_SIZE |
938 | #define STACK_TOP_MAX TASK_SIZE64 | 938 | #define STACK_TOP_MAX TASK_SIZE_MAX |
939 | 939 | ||
940 | #define INIT_THREAD { \ | 940 | #define INIT_THREAD { \ |
941 | .sp0 = (unsigned long)&init_stack + sizeof(init_stack) \ | 941 | .sp0 = (unsigned long)&init_stack + sizeof(init_stack) \ |
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h index c230189462a2..66801cb72f69 100644 --- a/arch/x86/include/asm/setup.h +++ b/arch/x86/include/asm/setup.h | |||
@@ -13,6 +13,7 @@ | |||
13 | struct mpc_cpu; | 13 | struct mpc_cpu; |
14 | struct mpc_bus; | 14 | struct mpc_bus; |
15 | struct mpc_oemtable; | 15 | struct mpc_oemtable; |
16 | |||
16 | struct x86_quirks { | 17 | struct x86_quirks { |
17 | int (*arch_pre_time_init)(void); | 18 | int (*arch_pre_time_init)(void); |
18 | int (*arch_time_init)(void); | 19 | int (*arch_time_init)(void); |
@@ -30,9 +31,17 @@ struct x86_quirks { | |||
30 | void (*smp_read_mpc_oem)(struct mpc_oemtable *oemtable, | 31 | void (*smp_read_mpc_oem)(struct mpc_oemtable *oemtable, |
31 | unsigned short oemsize); | 32 | unsigned short oemsize); |
32 | int (*setup_ioapic_ids)(void); | 33 | int (*setup_ioapic_ids)(void); |
33 | int (*update_genapic)(void); | 34 | int (*update_apic)(void); |
34 | }; | 35 | }; |
35 | 36 | ||
37 | extern void x86_quirk_pre_intr_init(void); | ||
38 | extern void x86_quirk_intr_init(void); | ||
39 | |||
40 | extern void x86_quirk_trap_init(void); | ||
41 | |||
42 | extern void x86_quirk_pre_time_init(void); | ||
43 | extern void x86_quirk_time_init(void); | ||
44 | |||
36 | #endif /* __ASSEMBLY__ */ | 45 | #endif /* __ASSEMBLY__ */ |
37 | 46 | ||
38 | #ifdef __i386__ | 47 | #ifdef __i386__ |
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h index 258ef730aaa4..7043408f6904 100644 --- a/arch/x86/include/asm/syscalls.h +++ b/arch/x86/include/asm/syscalls.h | |||
@@ -82,7 +82,7 @@ asmlinkage long sys_iopl(unsigned int, struct pt_regs *); | |||
82 | /* kernel/signal_64.c */ | 82 | /* kernel/signal_64.c */ |
83 | asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *, | 83 | asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *, |
84 | struct pt_regs *); | 84 | struct pt_regs *); |
85 | asmlinkage long sys_rt_sigreturn(struct pt_regs *); | 85 | long sys_rt_sigreturn(struct pt_regs *); |
86 | 86 | ||
87 | /* kernel/sys_x86_64.c */ | 87 | /* kernel/sys_x86_64.c */ |
88 | asmlinkage long sys_mmap(unsigned long, unsigned long, unsigned long, | 88 | asmlinkage long sys_mmap(unsigned long, unsigned long, unsigned long, |
diff --git a/arch/x86/include/asm/timer.h b/arch/x86/include/asm/timer.h index 2bb6a835c453..a81195eaa2b3 100644 --- a/arch/x86/include/asm/timer.h +++ b/arch/x86/include/asm/timer.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/init.h> | 3 | #include <linux/init.h> |
4 | #include <linux/pm.h> | 4 | #include <linux/pm.h> |
5 | #include <linux/percpu.h> | 5 | #include <linux/percpu.h> |
6 | #include <linux/interrupt.h> | ||
6 | 7 | ||
7 | #define TICK_SIZE (tick_nsec / 1000) | 8 | #define TICK_SIZE (tick_nsec / 1000) |
8 | 9 | ||
@@ -12,6 +13,7 @@ unsigned long native_calibrate_tsc(void); | |||
12 | #ifdef CONFIG_X86_32 | 13 | #ifdef CONFIG_X86_32 |
13 | extern int timer_ack; | 14 | extern int timer_ack; |
14 | extern int recalibrate_cpu_khz(void); | 15 | extern int recalibrate_cpu_khz(void); |
16 | extern irqreturn_t timer_interrupt(int irq, void *dev_id); | ||
15 | #endif /* CONFIG_X86_32 */ | 17 | #endif /* CONFIG_X86_32 */ |
16 | 18 | ||
17 | extern int no_timer_check; | 19 | extern int no_timer_check; |
diff --git a/arch/x86/include/asm/vic.h b/arch/x86/include/asm/vic.h deleted file mode 100644 index 53100f353612..000000000000 --- a/arch/x86/include/asm/vic.h +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | /* Copyright (C) 1999,2001 | ||
2 | * | ||
3 | * Author: J.E.J.Bottomley@HansenPartnership.com | ||
4 | * | ||
5 | * Standard include definitions for the NCR Voyager Interrupt Controller */ | ||
6 | |||
7 | /* The eight CPI vectors. To activate a CPI, you write a bit mask | ||
8 | * corresponding to the processor set to be interrupted into the | ||
9 | * relevant register. That set of CPUs will then be interrupted with | ||
10 | * the CPI */ | ||
11 | static const int VIC_CPI_Registers[] = | ||
12 | {0xFC00, 0xFC01, 0xFC08, 0xFC09, | ||
13 | 0xFC10, 0xFC11, 0xFC18, 0xFC19 }; | ||
14 | |||
15 | #define VIC_PROC_WHO_AM_I 0xfc29 | ||
16 | # define QUAD_IDENTIFIER 0xC0 | ||
17 | # define EIGHT_SLOT_IDENTIFIER 0xE0 | ||
18 | #define QIC_EXTENDED_PROCESSOR_SELECT 0xFC72 | ||
19 | #define VIC_CPI_BASE_REGISTER 0xFC41 | ||
20 | #define VIC_PROCESSOR_ID 0xFC21 | ||
21 | # define VIC_CPU_MASQUERADE_ENABLE 0x8 | ||
22 | |||
23 | #define VIC_CLAIM_REGISTER_0 0xFC38 | ||
24 | #define VIC_CLAIM_REGISTER_1 0xFC39 | ||
25 | #define VIC_REDIRECT_REGISTER_0 0xFC60 | ||
26 | #define VIC_REDIRECT_REGISTER_1 0xFC61 | ||
27 | #define VIC_PRIORITY_REGISTER 0xFC20 | ||
28 | |||
29 | #define VIC_PRIMARY_MC_BASE 0xFC48 | ||
30 | #define VIC_SECONDARY_MC_BASE 0xFC49 | ||
31 | |||
32 | #define QIC_PROCESSOR_ID 0xFC71 | ||
33 | # define QIC_CPUID_ENABLE 0x08 | ||
34 | |||
35 | #define QIC_VIC_CPI_BASE_REGISTER 0xFC79 | ||
36 | #define QIC_CPI_BASE_REGISTER 0xFC7A | ||
37 | |||
38 | #define QIC_MASK_REGISTER0 0xFC80 | ||
39 | /* NOTE: these are masked high, enabled low */ | ||
40 | # define QIC_PERF_TIMER 0x01 | ||
41 | # define QIC_LPE 0x02 | ||
42 | # define QIC_SYS_INT 0x04 | ||
43 | # define QIC_CMN_INT 0x08 | ||
44 | /* at the moment, just enable CMN_INT, disable SYS_INT */ | ||
45 | # define QIC_DEFAULT_MASK0 (~(QIC_CMN_INT /* | VIC_SYS_INT */)) | ||
46 | #define QIC_MASK_REGISTER1 0xFC81 | ||
47 | # define QIC_BOOT_CPI_MASK 0xFE | ||
48 | /* Enable CPI's 1-6 inclusive */ | ||
49 | # define QIC_CPI_ENABLE 0x81 | ||
50 | |||
51 | #define QIC_INTERRUPT_CLEAR0 0xFC8A | ||
52 | #define QIC_INTERRUPT_CLEAR1 0xFC8B | ||
53 | |||
54 | /* this is where we place the CPI vectors */ | ||
55 | #define VIC_DEFAULT_CPI_BASE 0xC0 | ||
56 | /* this is where we place the QIC CPI vectors */ | ||
57 | #define QIC_DEFAULT_CPI_BASE 0xD0 | ||
58 | |||
59 | #define VIC_BOOT_INTERRUPT_MASK 0xfe | ||
60 | |||
61 | extern void smp_vic_timer_interrupt(void); | ||
diff --git a/arch/x86/include/asm/voyager.h b/arch/x86/include/asm/voyager.h deleted file mode 100644 index c1635d43616f..000000000000 --- a/arch/x86/include/asm/voyager.h +++ /dev/null | |||
@@ -1,571 +0,0 @@ | |||
1 | /* Copyright (C) 1999,2001 | ||
2 | * | ||
3 | * Author: J.E.J.Bottomley@HansenPartnership.com | ||
4 | * | ||
5 | * Standard include definitions for the NCR Voyager system */ | ||
6 | |||
7 | #undef VOYAGER_DEBUG | ||
8 | #undef VOYAGER_CAT_DEBUG | ||
9 | |||
10 | #ifdef VOYAGER_DEBUG | ||
11 | #define VDEBUG(x) printk x | ||
12 | #else | ||
13 | #define VDEBUG(x) | ||
14 | #endif | ||
15 | |||
16 | /* There are three levels of voyager machine: 3,4 and 5. The rule is | ||
17 | * if it's less than 3435 it's a Level 3 except for a 3360 which is | ||
18 | * a level 4. A 3435 or above is a Level 5 */ | ||
19 | #define VOYAGER_LEVEL5_AND_ABOVE 0x3435 | ||
20 | #define VOYAGER_LEVEL4 0x3360 | ||
21 | |||
22 | /* The L4 DINO ASIC */ | ||
23 | #define VOYAGER_DINO 0x43 | ||
24 | |||
25 | /* voyager ports in standard I/O space */ | ||
26 | #define VOYAGER_MC_SETUP 0x96 | ||
27 | |||
28 | |||
29 | #define VOYAGER_CAT_CONFIG_PORT 0x97 | ||
30 | # define VOYAGER_CAT_DESELECT 0xff | ||
31 | #define VOYAGER_SSPB_RELOCATION_PORT 0x98 | ||
32 | |||
33 | /* Valid CAT controller commands */ | ||
34 | /* start instruction register cycle */ | ||
35 | #define VOYAGER_CAT_IRCYC 0x01 | ||
36 | /* start data register cycle */ | ||
37 | #define VOYAGER_CAT_DRCYC 0x02 | ||
38 | /* move to execute state */ | ||
39 | #define VOYAGER_CAT_RUN 0x0F | ||
40 | /* end operation */ | ||
41 | #define VOYAGER_CAT_END 0x80 | ||
42 | /* hold in idle state */ | ||
43 | #define VOYAGER_CAT_HOLD 0x90 | ||
44 | /* single step an "intest" vector */ | ||
45 | #define VOYAGER_CAT_STEP 0xE0 | ||
46 | /* return cat controller to CLEMSON mode */ | ||
47 | #define VOYAGER_CAT_CLEMSON 0xFF | ||
48 | |||
49 | /* the default cat command header */ | ||
50 | #define VOYAGER_CAT_HEADER 0x7F | ||
51 | |||
52 | /* the range of possible CAT module ids in the system */ | ||
53 | #define VOYAGER_MIN_MODULE 0x10 | ||
54 | #define VOYAGER_MAX_MODULE 0x1f | ||
55 | |||
56 | /* The voyager registers per asic */ | ||
57 | #define VOYAGER_ASIC_ID_REG 0x00 | ||
58 | #define VOYAGER_ASIC_TYPE_REG 0x01 | ||
59 | /* the sub address registers can be made auto incrementing on reads */ | ||
60 | #define VOYAGER_AUTO_INC_REG 0x02 | ||
61 | # define VOYAGER_AUTO_INC 0x04 | ||
62 | # define VOYAGER_NO_AUTO_INC 0xfb | ||
63 | #define VOYAGER_SUBADDRDATA 0x03 | ||
64 | #define VOYAGER_SCANPATH 0x05 | ||
65 | # define VOYAGER_CONNECT_ASIC 0x01 | ||
66 | # define VOYAGER_DISCONNECT_ASIC 0xfe | ||
67 | #define VOYAGER_SUBADDRLO 0x06 | ||
68 | #define VOYAGER_SUBADDRHI 0x07 | ||
69 | #define VOYAGER_SUBMODSELECT 0x08 | ||
70 | #define VOYAGER_SUBMODPRESENT 0x09 | ||
71 | |||
72 | #define VOYAGER_SUBADDR_LO 0xff | ||
73 | #define VOYAGER_SUBADDR_HI 0xffff | ||
74 | |||
75 | /* the maximum size of a scan path -- used to form instructions */ | ||
76 | #define VOYAGER_MAX_SCAN_PATH 0x100 | ||
77 | /* the biggest possible register size (in bytes) */ | ||
78 | #define VOYAGER_MAX_REG_SIZE 4 | ||
79 | |||
80 | /* Total number of possible modules (including submodules) */ | ||
81 | #define VOYAGER_MAX_MODULES 16 | ||
82 | /* Largest number of asics per module */ | ||
83 | #define VOYAGER_MAX_ASICS_PER_MODULE 7 | ||
84 | |||
85 | /* the CAT asic of each module is always the first one */ | ||
86 | #define VOYAGER_CAT_ID 0 | ||
87 | #define VOYAGER_PSI 0x1a | ||
88 | |||
89 | /* voyager instruction operations and registers */ | ||
90 | #define VOYAGER_READ_CONFIG 0x1 | ||
91 | #define VOYAGER_WRITE_CONFIG 0x2 | ||
92 | #define VOYAGER_BYPASS 0xff | ||
93 | |||
94 | typedef struct voyager_asic { | ||
95 | __u8 asic_addr; /* ASIC address; Level 4 */ | ||
96 | __u8 asic_type; /* ASIC type */ | ||
97 | __u8 asic_id; /* ASIC id */ | ||
98 | __u8 jtag_id[4]; /* JTAG id */ | ||
99 | __u8 asic_location; /* Location within scan path; start w/ 0 */ | ||
100 | __u8 bit_location; /* Location within bit stream; start w/ 0 */ | ||
101 | __u8 ireg_length; /* Instruction register length */ | ||
102 | __u16 subaddr; /* Amount of sub address space */ | ||
103 | struct voyager_asic *next; /* Next asic in linked list */ | ||
104 | } voyager_asic_t; | ||
105 | |||
106 | typedef struct voyager_module { | ||
107 | __u8 module_addr; /* Module address */ | ||
108 | __u8 scan_path_connected; /* Scan path connected */ | ||
109 | __u16 ee_size; /* Size of the EEPROM */ | ||
110 | __u16 num_asics; /* Number of Asics */ | ||
111 | __u16 inst_bits; /* Instruction bits in the scan path */ | ||
112 | __u16 largest_reg; /* Largest register in the scan path */ | ||
113 | __u16 smallest_reg; /* Smallest register in the scan path */ | ||
114 | voyager_asic_t *asic; /* First ASIC in scan path (CAT_I) */ | ||
115 | struct voyager_module *submodule; /* Submodule pointer */ | ||
116 | struct voyager_module *next; /* Next module in linked list */ | ||
117 | } voyager_module_t; | ||
118 | |||
119 | typedef struct voyager_eeprom_hdr { | ||
120 | __u8 module_id[4]; | ||
121 | __u8 version_id; | ||
122 | __u8 config_id; | ||
123 | __u16 boundry_id; /* boundary scan id */ | ||
124 | __u16 ee_size; /* size of EEPROM */ | ||
125 | __u8 assembly[11]; /* assembly # */ | ||
126 | __u8 assembly_rev; /* assembly rev */ | ||
127 | __u8 tracer[4]; /* tracer number */ | ||
128 | __u16 assembly_cksum; /* asm checksum */ | ||
129 | __u16 power_consump; /* pwr requirements */ | ||
130 | __u16 num_asics; /* number of asics */ | ||
131 | __u16 bist_time; /* min. bist time */ | ||
132 | __u16 err_log_offset; /* error log offset */ | ||
133 | __u16 scan_path_offset;/* scan path offset */ | ||
134 | __u16 cct_offset; | ||
135 | __u16 log_length; /* length of err log */ | ||
136 | __u16 xsum_end; /* offset to end of | ||
137 | checksum */ | ||
138 | __u8 reserved[4]; | ||
139 | __u8 sflag; /* starting sentinal */ | ||
140 | __u8 part_number[13]; /* prom part number */ | ||
141 | __u8 version[10]; /* version number */ | ||
142 | __u8 signature[8]; | ||
143 | __u16 eeprom_chksum; | ||
144 | __u32 data_stamp_offset; | ||
145 | __u8 eflag ; /* ending sentinal */ | ||
146 | } __attribute__((packed)) voyager_eprom_hdr_t; | ||
147 | |||
148 | |||
149 | |||
150 | #define VOYAGER_EPROM_SIZE_OFFSET \ | ||
151 | ((__u16)(&(((voyager_eprom_hdr_t *)0)->ee_size))) | ||
152 | #define VOYAGER_XSUM_END_OFFSET 0x2a | ||
153 | |||
154 | /* the following three definitions are for internal table layouts | ||
155 | * in the module EPROMs. We really only care about the IDs and | ||
156 | * offsets */ | ||
157 | typedef struct voyager_sp_table { | ||
158 | __u8 asic_id; | ||
159 | __u8 bypass_flag; | ||
160 | __u16 asic_data_offset; | ||
161 | __u16 config_data_offset; | ||
162 | } __attribute__((packed)) voyager_sp_table_t; | ||
163 | |||
164 | typedef struct voyager_jtag_table { | ||
165 | __u8 icode[4]; | ||
166 | __u8 runbist[4]; | ||
167 | __u8 intest[4]; | ||
168 | __u8 samp_preld[4]; | ||
169 | __u8 ireg_len; | ||
170 | } __attribute__((packed)) voyager_jtt_t; | ||
171 | |||
172 | typedef struct voyager_asic_data_table { | ||
173 | __u8 jtag_id[4]; | ||
174 | __u16 length_bsr; | ||
175 | __u16 length_bist_reg; | ||
176 | __u32 bist_clk; | ||
177 | __u16 subaddr_bits; | ||
178 | __u16 seed_bits; | ||
179 | __u16 sig_bits; | ||
180 | __u16 jtag_offset; | ||
181 | } __attribute__((packed)) voyager_at_t; | ||
182 | |||
183 | /* Voyager Interrupt Controller (VIC) registers */ | ||
184 | |||
185 | /* Base to add to Cross Processor Interrupts (CPIs) when triggering | ||
186 | * the CPU IRQ line */ | ||
187 | /* register defines for the WCBICs (one per processor) */ | ||
188 | #define VOYAGER_WCBIC0 0x41 /* bus A node P1 processor 0 */ | ||
189 | #define VOYAGER_WCBIC1 0x49 /* bus A node P1 processor 1 */ | ||
190 | #define VOYAGER_WCBIC2 0x51 /* bus A node P2 processor 0 */ | ||
191 | #define VOYAGER_WCBIC3 0x59 /* bus A node P2 processor 1 */ | ||
192 | #define VOYAGER_WCBIC4 0x61 /* bus B node P1 processor 0 */ | ||
193 | #define VOYAGER_WCBIC5 0x69 /* bus B node P1 processor 1 */ | ||
194 | #define VOYAGER_WCBIC6 0x71 /* bus B node P2 processor 0 */ | ||
195 | #define VOYAGER_WCBIC7 0x79 /* bus B node P2 processor 1 */ | ||
196 | |||
197 | |||
198 | /* top of memory registers */ | ||
199 | #define VOYAGER_WCBIC_TOM_L 0x4 | ||
200 | #define VOYAGER_WCBIC_TOM_H 0x5 | ||
201 | |||
202 | /* register defines for Voyager Memory Contol (VMC) | ||
203 | * these are present on L4 machines only */ | ||
204 | #define VOYAGER_VMC1 0x81 | ||
205 | #define VOYAGER_VMC2 0x91 | ||
206 | #define VOYAGER_VMC3 0xa1 | ||
207 | #define VOYAGER_VMC4 0xb1 | ||
208 | |||
209 | /* VMC Ports */ | ||
210 | #define VOYAGER_VMC_MEMORY_SETUP 0x9 | ||
211 | # define VMC_Interleaving 0x01 | ||
212 | # define VMC_4Way 0x02 | ||
213 | # define VMC_EvenCacheLines 0x04 | ||
214 | # define VMC_HighLine 0x08 | ||
215 | # define VMC_Start0_Enable 0x20 | ||
216 | # define VMC_Start1_Enable 0x40 | ||
217 | # define VMC_Vremap 0x80 | ||
218 | #define VOYAGER_VMC_BANK_DENSITY 0xa | ||
219 | # define VMC_BANK_EMPTY 0 | ||
220 | # define VMC_BANK_4MB 1 | ||
221 | # define VMC_BANK_16MB 2 | ||
222 | # define VMC_BANK_64MB 3 | ||
223 | # define VMC_BANK0_MASK 0x03 | ||
224 | # define VMC_BANK1_MASK 0x0C | ||
225 | # define VMC_BANK2_MASK 0x30 | ||
226 | # define VMC_BANK3_MASK 0xC0 | ||
227 | |||
228 | /* Magellan Memory Controller (MMC) defines - present on L5 */ | ||
229 | #define VOYAGER_MMC_ASIC_ID 1 | ||
230 | /* the two memory modules corresponding to memory cards in the system */ | ||
231 | #define VOYAGER_MMC_MEMORY0_MODULE 0x14 | ||
232 | #define VOYAGER_MMC_MEMORY1_MODULE 0x15 | ||
233 | /* the Magellan Memory Address (MMA) defines */ | ||
234 | #define VOYAGER_MMA_ASIC_ID 2 | ||
235 | |||
236 | /* Submodule number for the Quad Baseboard */ | ||
237 | #define VOYAGER_QUAD_BASEBOARD 1 | ||
238 | |||
239 | /* ASIC defines for the Quad Baseboard */ | ||
240 | #define VOYAGER_QUAD_QDATA0 1 | ||
241 | #define VOYAGER_QUAD_QDATA1 2 | ||
242 | #define VOYAGER_QUAD_QABC 3 | ||
243 | |||
244 | /* Useful areas in extended CMOS */ | ||
245 | #define VOYAGER_PROCESSOR_PRESENT_MASK 0x88a | ||
246 | #define VOYAGER_MEMORY_CLICKMAP 0xa23 | ||
247 | #define VOYAGER_DUMP_LOCATION 0xb1a | ||
248 | |||
249 | /* SUS In Control bit - used to tell SUS that we don't need to be | ||
250 | * babysat anymore */ | ||
251 | #define VOYAGER_SUS_IN_CONTROL_PORT 0x3ff | ||
252 | # define VOYAGER_IN_CONTROL_FLAG 0x80 | ||
253 | |||
254 | /* Voyager PSI defines */ | ||
255 | #define VOYAGER_PSI_STATUS_REG 0x08 | ||
256 | # define PSI_DC_FAIL 0x01 | ||
257 | # define PSI_MON 0x02 | ||
258 | # define PSI_FAULT 0x04 | ||
259 | # define PSI_ALARM 0x08 | ||
260 | # define PSI_CURRENT 0x10 | ||
261 | # define PSI_DVM 0x20 | ||
262 | # define PSI_PSCFAULT 0x40 | ||
263 | # define PSI_STAT_CHG 0x80 | ||
264 | |||
265 | #define VOYAGER_PSI_SUPPLY_REG 0x8000 | ||
266 | /* read */ | ||
267 | # define PSI_FAIL_DC 0x01 | ||
268 | # define PSI_FAIL_AC 0x02 | ||
269 | # define PSI_MON_INT 0x04 | ||
270 | # define PSI_SWITCH_OFF 0x08 | ||
271 | # define PSI_HX_OFF 0x10 | ||
272 | # define PSI_SECURITY 0x20 | ||
273 | # define PSI_CMOS_BATT_LOW 0x40 | ||
274 | # define PSI_CMOS_BATT_FAIL 0x80 | ||
275 | /* write */ | ||
276 | # define PSI_CLR_SWITCH_OFF 0x13 | ||
277 | # define PSI_CLR_HX_OFF 0x14 | ||
278 | # define PSI_CLR_CMOS_BATT_FAIL 0x17 | ||
279 | |||
280 | #define VOYAGER_PSI_MASK 0x8001 | ||
281 | # define PSI_MASK_MASK 0x10 | ||
282 | |||
283 | #define VOYAGER_PSI_AC_FAIL_REG 0x8004 | ||
284 | #define AC_FAIL_STAT_CHANGE 0x80 | ||
285 | |||
286 | #define VOYAGER_PSI_GENERAL_REG 0x8007 | ||
287 | /* read */ | ||
288 | # define PSI_SWITCH_ON 0x01 | ||
289 | # define PSI_SWITCH_ENABLED 0x02 | ||
290 | # define PSI_ALARM_ENABLED 0x08 | ||
291 | # define PSI_SECURE_ENABLED 0x10 | ||
292 | # define PSI_COLD_RESET 0x20 | ||
293 | # define PSI_COLD_START 0x80 | ||
294 | /* write */ | ||
295 | # define PSI_POWER_DOWN 0x10 | ||
296 | # define PSI_SWITCH_DISABLE 0x01 | ||
297 | # define PSI_SWITCH_ENABLE 0x11 | ||
298 | # define PSI_CLEAR 0x12 | ||
299 | # define PSI_ALARM_DISABLE 0x03 | ||
300 | # define PSI_ALARM_ENABLE 0x13 | ||
301 | # define PSI_CLEAR_COLD_RESET 0x05 | ||
302 | # define PSI_SET_COLD_RESET 0x15 | ||
303 | # define PSI_CLEAR_COLD_START 0x07 | ||
304 | # define PSI_SET_COLD_START 0x17 | ||
305 | |||
306 | |||
307 | |||
308 | struct voyager_bios_info { | ||
309 | __u8 len; | ||
310 | __u8 major; | ||
311 | __u8 minor; | ||
312 | __u8 debug; | ||
313 | __u8 num_classes; | ||
314 | __u8 class_1; | ||
315 | __u8 class_2; | ||
316 | }; | ||
317 | |||
318 | /* The following structures and definitions are for the Kernel/SUS | ||
319 | * interface these are needed to find out how SUS initialised any Quad | ||
320 | * boards in the system */ | ||
321 | |||
322 | #define NUMBER_OF_MC_BUSSES 2 | ||
323 | #define SLOTS_PER_MC_BUS 8 | ||
324 | #define MAX_CPUS 16 /* 16 way CPU system */ | ||
325 | #define MAX_PROCESSOR_BOARDS 4 /* 4 processor slot system */ | ||
326 | #define MAX_CACHE_LEVELS 4 /* # of cache levels supported */ | ||
327 | #define MAX_SHARED_CPUS 4 /* # of CPUs that can share a LARC */ | ||
328 | #define NUMBER_OF_POS_REGS 8 | ||
329 | |||
330 | typedef struct { | ||
331 | __u8 MC_Slot; | ||
332 | __u8 POS_Values[NUMBER_OF_POS_REGS]; | ||
333 | } __attribute__((packed)) MC_SlotInformation_t; | ||
334 | |||
335 | struct QuadDescription { | ||
336 | __u8 Type; /* for type 0 (DYADIC or MONADIC) all fields | ||
337 | * will be zero except for slot */ | ||
338 | __u8 StructureVersion; | ||
339 | __u32 CPI_BaseAddress; | ||
340 | __u32 LARC_BankSize; | ||
341 | __u32 LocalMemoryStateBits; | ||
342 | __u8 Slot; /* Processor slots 1 - 4 */ | ||
343 | } __attribute__((packed)); | ||
344 | |||
345 | struct ProcBoardInfo { | ||
346 | __u8 Type; | ||
347 | __u8 StructureVersion; | ||
348 | __u8 NumberOfBoards; | ||
349 | struct QuadDescription QuadData[MAX_PROCESSOR_BOARDS]; | ||
350 | } __attribute__((packed)); | ||
351 | |||
352 | struct CacheDescription { | ||
353 | __u8 Level; | ||
354 | __u32 TotalSize; | ||
355 | __u16 LineSize; | ||
356 | __u8 Associativity; | ||
357 | __u8 CacheType; | ||
358 | __u8 WriteType; | ||
359 | __u8 Number_CPUs_SharedBy; | ||
360 | __u8 Shared_CPUs_Hardware_IDs[MAX_SHARED_CPUS]; | ||
361 | |||
362 | } __attribute__((packed)); | ||
363 | |||
364 | struct CPU_Description { | ||
365 | __u8 CPU_HardwareId; | ||
366 | char *FRU_String; | ||
367 | __u8 NumberOfCacheLevels; | ||
368 | struct CacheDescription CacheLevelData[MAX_CACHE_LEVELS]; | ||
369 | } __attribute__((packed)); | ||
370 | |||
371 | struct CPU_Info { | ||
372 | __u8 Type; | ||
373 | __u8 StructureVersion; | ||
374 | __u8 NumberOf_CPUs; | ||
375 | struct CPU_Description CPU_Data[MAX_CPUS]; | ||
376 | } __attribute__((packed)); | ||
377 | |||
378 | |||
379 | /* | ||
380 | * This structure will be used by SUS and the OS. | ||
381 | * The assumption about this structure is that no blank space is | ||
382 | * packed in it by our friend the compiler. | ||
383 | */ | ||
384 | typedef struct { | ||
385 | __u8 Mailbox_SUS; /* Written to by SUS to give | ||
386 | commands/response to the OS */ | ||
387 | __u8 Mailbox_OS; /* Written to by the OS to give | ||
388 | commands/response to SUS */ | ||
389 | __u8 SUS_MailboxVersion; /* Tells the OS which iteration of the | ||
390 | interface SUS supports */ | ||
391 | __u8 OS_MailboxVersion; /* Tells SUS which iteration of the | ||
392 | interface the OS supports */ | ||
393 | __u32 OS_Flags; /* Flags set by the OS as info for | ||
394 | SUS */ | ||
395 | __u32 SUS_Flags; /* Flags set by SUS as info | ||
396 | for the OS */ | ||
397 | __u32 WatchDogPeriod; /* Watchdog period (in seconds) which | ||
398 | the DP uses to see if the OS | ||
399 | is dead */ | ||
400 | __u32 WatchDogCount; /* Updated by the OS on every tic. */ | ||
401 | __u32 MemoryFor_SUS_ErrorLog; /* Flat 32 bit address which tells SUS | ||
402 | where to stuff the SUS error log | ||
403 | on a dump */ | ||
404 | MC_SlotInformation_t MC_SlotInfo[NUMBER_OF_MC_BUSSES*SLOTS_PER_MC_BUS]; | ||
405 | /* Storage for MCA POS data */ | ||
406 | /* All new SECOND_PASS_INTERFACE fields added from this point */ | ||
407 | struct ProcBoardInfo *BoardData; | ||
408 | struct CPU_Info *CPU_Data; | ||
409 | /* All new fields must be added from this point */ | ||
410 | } Voyager_KernelSUS_Mbox_t; | ||
411 | |||
412 | /* structure for finding the right memory address to send a QIC CPI to */ | ||
413 | struct voyager_qic_cpi { | ||
414 | /* Each cache line (32 bytes) can trigger a cpi. The cpi | ||
415 | * read/write may occur anywhere in the cache line---pick the | ||
416 | * middle to be safe */ | ||
417 | struct { | ||
418 | __u32 pad1[3]; | ||
419 | __u32 cpi; | ||
420 | __u32 pad2[4]; | ||
421 | } qic_cpi[8]; | ||
422 | }; | ||
423 | |||
424 | struct voyager_status { | ||
425 | __u32 power_fail:1; | ||
426 | __u32 switch_off:1; | ||
427 | __u32 request_from_kernel:1; | ||
428 | }; | ||
429 | |||
430 | struct voyager_psi_regs { | ||
431 | __u8 cat_id; | ||
432 | __u8 cat_dev; | ||
433 | __u8 cat_control; | ||
434 | __u8 subaddr; | ||
435 | __u8 dummy4; | ||
436 | __u8 checkbit; | ||
437 | __u8 subaddr_low; | ||
438 | __u8 subaddr_high; | ||
439 | __u8 intstatus; | ||
440 | __u8 stat1; | ||
441 | __u8 stat3; | ||
442 | __u8 fault; | ||
443 | __u8 tms; | ||
444 | __u8 gen; | ||
445 | __u8 sysconf; | ||
446 | __u8 dummy15; | ||
447 | }; | ||
448 | |||
449 | struct voyager_psi_subregs { | ||
450 | __u8 supply; | ||
451 | __u8 mask; | ||
452 | __u8 present; | ||
453 | __u8 DCfail; | ||
454 | __u8 ACfail; | ||
455 | __u8 fail; | ||
456 | __u8 UPSfail; | ||
457 | __u8 genstatus; | ||
458 | }; | ||
459 | |||
460 | struct voyager_psi { | ||
461 | struct voyager_psi_regs regs; | ||
462 | struct voyager_psi_subregs subregs; | ||
463 | }; | ||
464 | |||
465 | struct voyager_SUS { | ||
466 | #define VOYAGER_DUMP_BUTTON_NMI 0x1 | ||
467 | #define VOYAGER_SUS_VALID 0x2 | ||
468 | #define VOYAGER_SYSINT_COMPLETE 0x3 | ||
469 | __u8 SUS_mbox; | ||
470 | #define VOYAGER_NO_COMMAND 0x0 | ||
471 | #define VOYAGER_IGNORE_DUMP 0x1 | ||
472 | #define VOYAGER_DO_DUMP 0x2 | ||
473 | #define VOYAGER_SYSINT_HANDSHAKE 0x3 | ||
474 | #define VOYAGER_DO_MEM_DUMP 0x4 | ||
475 | #define VOYAGER_SYSINT_WAS_RECOVERED 0x5 | ||
476 | __u8 kernel_mbox; | ||
477 | #define VOYAGER_MAILBOX_VERSION 0x10 | ||
478 | __u8 SUS_version; | ||
479 | __u8 kernel_version; | ||
480 | #define VOYAGER_OS_HAS_SYSINT 0x1 | ||
481 | #define VOYAGER_OS_IN_PROGRESS 0x2 | ||
482 | #define VOYAGER_UPDATING_WDPERIOD 0x4 | ||
483 | __u32 kernel_flags; | ||
484 | #define VOYAGER_SUS_BOOTING 0x1 | ||
485 | #define VOYAGER_SUS_IN_PROGRESS 0x2 | ||
486 | __u32 SUS_flags; | ||
487 | __u32 watchdog_period; | ||
488 | __u32 watchdog_count; | ||
489 | __u32 SUS_errorlog; | ||
490 | /* lots of system configuration stuff under here */ | ||
491 | }; | ||
492 | |||
493 | /* Variables exported by voyager_smp */ | ||
494 | extern __u32 voyager_extended_vic_processors; | ||
495 | extern __u32 voyager_allowed_boot_processors; | ||
496 | extern __u32 voyager_quad_processors; | ||
497 | extern struct voyager_qic_cpi *voyager_quad_cpi_addr[NR_CPUS]; | ||
498 | extern struct voyager_SUS *voyager_SUS; | ||
499 | |||
500 | /* variables exported always */ | ||
501 | extern struct task_struct *voyager_thread; | ||
502 | extern int voyager_level; | ||
503 | extern struct voyager_status voyager_status; | ||
504 | |||
505 | /* functions exported by the voyager and voyager_smp modules */ | ||
506 | extern int voyager_cat_readb(__u8 module, __u8 asic, int reg); | ||
507 | extern void voyager_cat_init(void); | ||
508 | extern void voyager_detect(struct voyager_bios_info *); | ||
509 | extern void voyager_trap_init(void); | ||
510 | extern void voyager_setup_irqs(void); | ||
511 | extern int voyager_memory_detect(int region, __u32 *addr, __u32 *length); | ||
512 | extern void voyager_smp_intr_init(void); | ||
513 | extern __u8 voyager_extended_cmos_read(__u16 cmos_address); | ||
514 | extern void voyager_smp_dump(void); | ||
515 | extern void voyager_timer_interrupt(void); | ||
516 | extern void smp_local_timer_interrupt(void); | ||
517 | extern void voyager_power_off(void); | ||
518 | extern void smp_voyager_power_off(void *dummy); | ||
519 | extern void voyager_restart(void); | ||
520 | extern void voyager_cat_power_off(void); | ||
521 | extern void voyager_cat_do_common_interrupt(void); | ||
522 | extern void voyager_handle_nmi(void); | ||
523 | extern void voyager_smp_intr_init(void); | ||
524 | /* Commands for the following are */ | ||
525 | #define VOYAGER_PSI_READ 0 | ||
526 | #define VOYAGER_PSI_WRITE 1 | ||
527 | #define VOYAGER_PSI_SUBREAD 2 | ||
528 | #define VOYAGER_PSI_SUBWRITE 3 | ||
529 | extern void voyager_cat_psi(__u8, __u16, __u8 *); | ||
530 | |||
531 | /* These define the CPIs we use in linux */ | ||
532 | #define VIC_CPI_LEVEL0 0 | ||
533 | #define VIC_CPI_LEVEL1 1 | ||
534 | /* now the fake CPIs */ | ||
535 | #define VIC_TIMER_CPI 2 | ||
536 | #define VIC_INVALIDATE_CPI 3 | ||
537 | #define VIC_RESCHEDULE_CPI 4 | ||
538 | #define VIC_ENABLE_IRQ_CPI 5 | ||
539 | #define VIC_CALL_FUNCTION_CPI 6 | ||
540 | #define VIC_CALL_FUNCTION_SINGLE_CPI 7 | ||
541 | |||
542 | /* Now the QIC CPIs: Since we don't need the two initial levels, | ||
543 | * these are 2 less than the VIC CPIs */ | ||
544 | #define QIC_CPI_OFFSET 1 | ||
545 | #define QIC_TIMER_CPI (VIC_TIMER_CPI - QIC_CPI_OFFSET) | ||
546 | #define QIC_INVALIDATE_CPI (VIC_INVALIDATE_CPI - QIC_CPI_OFFSET) | ||
547 | #define QIC_RESCHEDULE_CPI (VIC_RESCHEDULE_CPI - QIC_CPI_OFFSET) | ||
548 | #define QIC_ENABLE_IRQ_CPI (VIC_ENABLE_IRQ_CPI - QIC_CPI_OFFSET) | ||
549 | #define QIC_CALL_FUNCTION_CPI (VIC_CALL_FUNCTION_CPI - QIC_CPI_OFFSET) | ||
550 | #define QIC_CALL_FUNCTION_SINGLE_CPI (VIC_CALL_FUNCTION_SINGLE_CPI - QIC_CPI_OFFSET) | ||
551 | |||
552 | #define VIC_START_FAKE_CPI VIC_TIMER_CPI | ||
553 | #define VIC_END_FAKE_CPI VIC_CALL_FUNCTION_SINGLE_CPI | ||
554 | |||
555 | /* this is the SYS_INT CPI. */ | ||
556 | #define VIC_SYS_INT 8 | ||
557 | #define VIC_CMN_INT 15 | ||
558 | |||
559 | /* This is the boot CPI for alternate processors. It gets overwritten | ||
560 | * by the above once the system has activated all available processors */ | ||
561 | #define VIC_CPU_BOOT_CPI VIC_CPI_LEVEL0 | ||
562 | #define VIC_CPU_BOOT_ERRATA_CPI (VIC_CPI_LEVEL0 + 8) | ||
563 | |||
564 | extern asmlinkage void vic_cpi_interrupt(void); | ||
565 | extern asmlinkage void vic_sys_interrupt(void); | ||
566 | extern asmlinkage void vic_cmn_interrupt(void); | ||
567 | extern asmlinkage void qic_timer_interrupt(void); | ||
568 | extern asmlinkage void qic_invalidate_interrupt(void); | ||
569 | extern asmlinkage void qic_reschedule_interrupt(void); | ||
570 | extern asmlinkage void qic_enable_irq_interrupt(void); | ||
571 | extern asmlinkage void qic_call_function_interrupt(void); | ||
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 24f357e7557a..de5657c039e9 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -30,7 +30,7 @@ obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o | |||
30 | obj-y += time_$(BITS).o ioport.o ldt.o dumpstack.o | 30 | obj-y += time_$(BITS).o ioport.o ldt.o dumpstack.o |
31 | obj-y += setup.o i8259.o irqinit_$(BITS).o | 31 | obj-y += setup.o i8259.o irqinit_$(BITS).o |
32 | obj-$(CONFIG_X86_VISWS) += visws_quirks.o | 32 | obj-$(CONFIG_X86_VISWS) += visws_quirks.o |
33 | obj-$(CONFIG_X86_32) += probe_32.o probe_roms_32.o | 33 | obj-$(CONFIG_X86_32) += probe_roms_32.o |
34 | obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o | 34 | obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o |
35 | obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o | 35 | obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o |
36 | obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o | 36 | obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o |
@@ -58,23 +58,18 @@ obj-$(CONFIG_PCI) += early-quirks.o | |||
58 | apm-y := apm_32.o | 58 | apm-y := apm_32.o |
59 | obj-$(CONFIG_APM) += apm.o | 59 | obj-$(CONFIG_APM) += apm.o |
60 | obj-$(CONFIG_SMP) += smp.o | 60 | obj-$(CONFIG_SMP) += smp.o |
61 | obj-$(CONFIG_SMP) += smpboot.o tsc_sync.o ipi.o | 61 | obj-$(CONFIG_SMP) += smpboot.o tsc_sync.o |
62 | obj-$(CONFIG_SMP) += setup_percpu.o | 62 | obj-$(CONFIG_SMP) += setup_percpu.o |
63 | obj-$(CONFIG_X86_64_SMP) += tsc_sync.o | 63 | obj-$(CONFIG_X86_64_SMP) += tsc_sync.o |
64 | obj-$(CONFIG_X86_TRAMPOLINE) += trampoline_$(BITS).o | 64 | obj-$(CONFIG_X86_TRAMPOLINE) += trampoline_$(BITS).o |
65 | obj-$(CONFIG_X86_MPPARSE) += mpparse.o | 65 | obj-$(CONFIG_X86_MPPARSE) += mpparse.o |
66 | obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o ipi.o | 66 | obj-y += apic/ |
67 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o | ||
68 | obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o | 67 | obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups_32.o |
69 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o | 68 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o |
70 | obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o | 69 | obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o |
71 | obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o | 70 | obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o |
72 | obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o | 71 | obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o |
73 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o | 72 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o |
74 | obj-$(CONFIG_X86_BIGSMP) += bigsmp_32.o | ||
75 | obj-$(CONFIG_X86_NUMAQ) += numaq_32.o | ||
76 | obj-$(CONFIG_X86_ES7000) += es7000_32.o | ||
77 | obj-$(CONFIG_X86_SUMMIT) += summit_32.o | ||
78 | obj-y += vsmp_64.o | 73 | obj-y += vsmp_64.o |
79 | obj-$(CONFIG_KPROBES) += kprobes.o | 74 | obj-$(CONFIG_KPROBES) += kprobes.o |
80 | obj-$(CONFIG_MODULES) += module_$(BITS).o | 75 | obj-$(CONFIG_MODULES) += module_$(BITS).o |
@@ -116,17 +111,13 @@ obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o # NB rename without _64 | |||
116 | ### | 111 | ### |
117 | # 64 bit specific files | 112 | # 64 bit specific files |
118 | ifeq ($(CONFIG_X86_64),y) | 113 | ifeq ($(CONFIG_X86_64),y) |
119 | obj-y += genapic_64.o genapic_flat_64.o | 114 | obj-$(CONFIG_X86_UV) += tlb_uv.o bios_uv.o uv_irq.o uv_sysfs.o |
120 | obj-y += genx2apic_cluster.o | 115 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o |
121 | obj-y += genx2apic_phys.o | 116 | obj-$(CONFIG_AUDIT) += audit_64.o |
122 | obj-$(CONFIG_X86_UV) += genx2apic_uv_x.o tlb_uv.o | 117 | |
123 | obj-$(CONFIG_X86_UV) += bios_uv.o uv_irq.o uv_sysfs.o | 118 | obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o |
124 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o | 119 | obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o |
125 | obj-$(CONFIG_AUDIT) += audit_64.o | 120 | obj-$(CONFIG_AMD_IOMMU) += amd_iommu_init.o amd_iommu.o |
126 | 121 | ||
127 | obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o | 122 | obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o |
128 | obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o | ||
129 | obj-$(CONFIG_AMD_IOMMU) += amd_iommu_init.o amd_iommu.o | ||
130 | |||
131 | obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o | ||
132 | endif | 123 | endif |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 956c1dee6fbe..a18eb7ce2236 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <asm/pgtable.h> | 37 | #include <asm/pgtable.h> |
38 | #include <asm/io_apic.h> | 38 | #include <asm/io_apic.h> |
39 | #include <asm/apic.h> | 39 | #include <asm/apic.h> |
40 | #include <asm/genapic.h> | ||
41 | #include <asm/io.h> | 40 | #include <asm/io.h> |
42 | #include <asm/mpspec.h> | 41 | #include <asm/mpspec.h> |
43 | #include <asm/smp.h> | 42 | #include <asm/smp.h> |
diff --git a/arch/x86/kernel/acpi/realmode/wakeup.S b/arch/x86/kernel/acpi/realmode/wakeup.S index 3355973b12ac..580b4e296010 100644 --- a/arch/x86/kernel/acpi/realmode/wakeup.S +++ b/arch/x86/kernel/acpi/realmode/wakeup.S | |||
@@ -3,8 +3,8 @@ | |||
3 | */ | 3 | */ |
4 | #include <asm/segment.h> | 4 | #include <asm/segment.h> |
5 | #include <asm/msr-index.h> | 5 | #include <asm/msr-index.h> |
6 | #include <asm/page.h> | 6 | #include <asm/page_types.h> |
7 | #include <asm/pgtable.h> | 7 | #include <asm/pgtable_types.h> |
8 | #include <asm/processor-flags.h> | 8 | #include <asm/processor-flags.h> |
9 | 9 | ||
10 | .code16 | 10 | .code16 |
diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S index a12e6a9fb659..8ded418b0593 100644 --- a/arch/x86/kernel/acpi/wakeup_32.S +++ b/arch/x86/kernel/acpi/wakeup_32.S | |||
@@ -1,7 +1,7 @@ | |||
1 | .section .text.page_aligned | 1 | .section .text.page_aligned |
2 | #include <linux/linkage.h> | 2 | #include <linux/linkage.h> |
3 | #include <asm/segment.h> | 3 | #include <asm/segment.h> |
4 | #include <asm/page.h> | 4 | #include <asm/page_types.h> |
5 | 5 | ||
6 | # Copyright 2003, 2008 Pavel Machek <pavel@suse.cz>, distribute under GPLv2 | 6 | # Copyright 2003, 2008 Pavel Machek <pavel@suse.cz>, distribute under GPLv2 |
7 | 7 | ||
diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S index bcc293423a70..8ea5164cbd04 100644 --- a/arch/x86/kernel/acpi/wakeup_64.S +++ b/arch/x86/kernel/acpi/wakeup_64.S | |||
@@ -1,8 +1,8 @@ | |||
1 | .text | 1 | .text |
2 | #include <linux/linkage.h> | 2 | #include <linux/linkage.h> |
3 | #include <asm/segment.h> | 3 | #include <asm/segment.h> |
4 | #include <asm/pgtable.h> | 4 | #include <asm/pgtable_types.h> |
5 | #include <asm/page.h> | 5 | #include <asm/page_types.h> |
6 | #include <asm/msr.h> | 6 | #include <asm/msr.h> |
7 | #include <asm/asm-offsets.h> | 7 | #include <asm/asm-offsets.h> |
8 | 8 | ||
@@ -13,7 +13,6 @@ | |||
13 | * Hooray, we are in Long 64-bit mode (but still running in low memory) | 13 | * Hooray, we are in Long 64-bit mode (but still running in low memory) |
14 | */ | 14 | */ |
15 | ENTRY(wakeup_long64) | 15 | ENTRY(wakeup_long64) |
16 | wakeup_long64: | ||
17 | movq saved_magic, %rax | 16 | movq saved_magic, %rax |
18 | movq $0x123456789abcdef0, %rdx | 17 | movq $0x123456789abcdef0, %rdx |
19 | cmpq %rdx, %rax | 18 | cmpq %rdx, %rax |
@@ -34,16 +33,12 @@ wakeup_long64: | |||
34 | 33 | ||
35 | movq saved_rip, %rax | 34 | movq saved_rip, %rax |
36 | jmp *%rax | 35 | jmp *%rax |
36 | ENDPROC(wakeup_long64) | ||
37 | 37 | ||
38 | bogus_64_magic: | 38 | bogus_64_magic: |
39 | jmp bogus_64_magic | 39 | jmp bogus_64_magic |
40 | 40 | ||
41 | .align 2 | 41 | ENTRY(do_suspend_lowlevel) |
42 | .p2align 4,,15 | ||
43 | .globl do_suspend_lowlevel | ||
44 | .type do_suspend_lowlevel,@function | ||
45 | do_suspend_lowlevel: | ||
46 | .LFB5: | ||
47 | subq $8, %rsp | 42 | subq $8, %rsp |
48 | xorl %eax, %eax | 43 | xorl %eax, %eax |
49 | call save_processor_state | 44 | call save_processor_state |
@@ -67,7 +62,7 @@ do_suspend_lowlevel: | |||
67 | pushfq | 62 | pushfq |
68 | popq pt_regs_flags(%rax) | 63 | popq pt_regs_flags(%rax) |
69 | 64 | ||
70 | movq $.L97, saved_rip(%rip) | 65 | movq $resume_point, saved_rip(%rip) |
71 | 66 | ||
72 | movq %rsp, saved_rsp | 67 | movq %rsp, saved_rsp |
73 | movq %rbp, saved_rbp | 68 | movq %rbp, saved_rbp |
@@ -78,14 +73,12 @@ do_suspend_lowlevel: | |||
78 | addq $8, %rsp | 73 | addq $8, %rsp |
79 | movl $3, %edi | 74 | movl $3, %edi |
80 | xorl %eax, %eax | 75 | xorl %eax, %eax |
81 | jmp acpi_enter_sleep_state | 76 | call acpi_enter_sleep_state |
82 | .L97: | 77 | /* in case something went wrong, restore the machine status and go on */ |
83 | .p2align 4,,7 | 78 | jmp resume_point |
84 | .L99: | ||
85 | .align 4 | ||
86 | movl $24, %eax | ||
87 | movw %ax, %ds | ||
88 | 79 | ||
80 | .align 4 | ||
81 | resume_point: | ||
89 | /* We don't restore %rax, it must be 0 anyway */ | 82 | /* We don't restore %rax, it must be 0 anyway */ |
90 | movq $saved_context, %rax | 83 | movq $saved_context, %rax |
91 | movq saved_context_cr4(%rax), %rbx | 84 | movq saved_context_cr4(%rax), %rbx |
@@ -117,12 +110,9 @@ do_suspend_lowlevel: | |||
117 | xorl %eax, %eax | 110 | xorl %eax, %eax |
118 | addq $8, %rsp | 111 | addq $8, %rsp |
119 | jmp restore_processor_state | 112 | jmp restore_processor_state |
120 | .LFE5: | 113 | ENDPROC(do_suspend_lowlevel) |
121 | .Lfe5: | 114 | |
122 | .size do_suspend_lowlevel, .Lfe5-do_suspend_lowlevel | ||
123 | |||
124 | .data | 115 | .data |
125 | ALIGN | ||
126 | ENTRY(saved_rbp) .quad 0 | 116 | ENTRY(saved_rbp) .quad 0 |
127 | ENTRY(saved_rsi) .quad 0 | 117 | ENTRY(saved_rsi) .quad 0 |
128 | ENTRY(saved_rdi) .quad 0 | 118 | ENTRY(saved_rdi) .quad 0 |
diff --git a/arch/x86/kernel/apic/Makefile b/arch/x86/kernel/apic/Makefile new file mode 100644 index 000000000000..da7b7b9f8bd8 --- /dev/null +++ b/arch/x86/kernel/apic/Makefile | |||
@@ -0,0 +1,19 @@ | |||
1 | # | ||
2 | # Makefile for local APIC drivers and for the IO-APIC code | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_X86_LOCAL_APIC) += apic.o probe_$(BITS).o ipi.o nmi.o | ||
6 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o | ||
7 | obj-$(CONFIG_SMP) += ipi.o | ||
8 | |||
9 | ifeq ($(CONFIG_X86_64),y) | ||
10 | obj-y += apic_flat_64.o | ||
11 | obj-$(CONFIG_X86_X2APIC) += x2apic_cluster.o | ||
12 | obj-$(CONFIG_X86_X2APIC) += x2apic_phys.o | ||
13 | obj-$(CONFIG_X86_UV) += x2apic_uv_x.o | ||
14 | endif | ||
15 | |||
16 | obj-$(CONFIG_X86_BIGSMP) += bigsmp_32.o | ||
17 | obj-$(CONFIG_X86_NUMAQ) += numaq_32.o | ||
18 | obj-$(CONFIG_X86_ES7000) += es7000_32.o | ||
19 | obj-$(CONFIG_X86_SUMMIT) += summit_32.o | ||
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic/apic.c index a894eea9d51a..f9cecdfd05c5 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -34,9 +34,7 @@ | |||
34 | #include <linux/smp.h> | 34 | #include <linux/smp.h> |
35 | #include <linux/mm.h> | 35 | #include <linux/mm.h> |
36 | 36 | ||
37 | #include <asm/arch_hooks.h> | ||
38 | #include <asm/pgalloc.h> | 37 | #include <asm/pgalloc.h> |
39 | #include <asm/genapic.h> | ||
40 | #include <asm/atomic.h> | 38 | #include <asm/atomic.h> |
41 | #include <asm/mpspec.h> | 39 | #include <asm/mpspec.h> |
42 | #include <asm/i8253.h> | 40 | #include <asm/i8253.h> |
@@ -112,11 +110,7 @@ static __init int setup_apicpmtimer(char *s) | |||
112 | __setup("apicpmtimer", setup_apicpmtimer); | 110 | __setup("apicpmtimer", setup_apicpmtimer); |
113 | #endif | 111 | #endif |
114 | 112 | ||
115 | #ifdef CONFIG_X86_64 | 113 | #ifdef CONFIG_X86_X2APIC |
116 | #define HAVE_X2APIC | ||
117 | #endif | ||
118 | |||
119 | #ifdef HAVE_X2APIC | ||
120 | int x2apic; | 114 | int x2apic; |
121 | /* x2apic enabled before OS handover */ | 115 | /* x2apic enabled before OS handover */ |
122 | static int x2apic_preenabled; | 116 | static int x2apic_preenabled; |
@@ -214,18 +208,13 @@ static int modern_apic(void) | |||
214 | return lapic_get_version() >= 0x14; | 208 | return lapic_get_version() >= 0x14; |
215 | } | 209 | } |
216 | 210 | ||
217 | /* | 211 | void native_apic_wait_icr_idle(void) |
218 | * Paravirt kernels also might be using these below ops. So we still | ||
219 | * use generic apic_read()/apic_write(), which might be pointing to different | ||
220 | * ops in PARAVIRT case. | ||
221 | */ | ||
222 | void xapic_wait_icr_idle(void) | ||
223 | { | 212 | { |
224 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) | 213 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) |
225 | cpu_relax(); | 214 | cpu_relax(); |
226 | } | 215 | } |
227 | 216 | ||
228 | u32 safe_xapic_wait_icr_idle(void) | 217 | u32 native_safe_apic_wait_icr_idle(void) |
229 | { | 218 | { |
230 | u32 send_status; | 219 | u32 send_status; |
231 | int timeout; | 220 | int timeout; |
@@ -241,13 +230,13 @@ u32 safe_xapic_wait_icr_idle(void) | |||
241 | return send_status; | 230 | return send_status; |
242 | } | 231 | } |
243 | 232 | ||
244 | void xapic_icr_write(u32 low, u32 id) | 233 | void native_apic_icr_write(u32 low, u32 id) |
245 | { | 234 | { |
246 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(id)); | 235 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(id)); |
247 | apic_write(APIC_ICR, low); | 236 | apic_write(APIC_ICR, low); |
248 | } | 237 | } |
249 | 238 | ||
250 | static u64 xapic_icr_read(void) | 239 | u64 native_apic_icr_read(void) |
251 | { | 240 | { |
252 | u32 icr1, icr2; | 241 | u32 icr1, icr2; |
253 | 242 | ||
@@ -257,54 +246,6 @@ static u64 xapic_icr_read(void) | |||
257 | return icr1 | ((u64)icr2 << 32); | 246 | return icr1 | ((u64)icr2 << 32); |
258 | } | 247 | } |
259 | 248 | ||
260 | static struct apic_ops xapic_ops = { | ||
261 | .read = native_apic_mem_read, | ||
262 | .write = native_apic_mem_write, | ||
263 | .icr_read = xapic_icr_read, | ||
264 | .icr_write = xapic_icr_write, | ||
265 | .wait_icr_idle = xapic_wait_icr_idle, | ||
266 | .safe_wait_icr_idle = safe_xapic_wait_icr_idle, | ||
267 | }; | ||
268 | |||
269 | struct apic_ops __read_mostly *apic_ops = &xapic_ops; | ||
270 | EXPORT_SYMBOL_GPL(apic_ops); | ||
271 | |||
272 | #ifdef HAVE_X2APIC | ||
273 | static void x2apic_wait_icr_idle(void) | ||
274 | { | ||
275 | /* no need to wait for icr idle in x2apic */ | ||
276 | return; | ||
277 | } | ||
278 | |||
279 | static u32 safe_x2apic_wait_icr_idle(void) | ||
280 | { | ||
281 | /* no need to wait for icr idle in x2apic */ | ||
282 | return 0; | ||
283 | } | ||
284 | |||
285 | void x2apic_icr_write(u32 low, u32 id) | ||
286 | { | ||
287 | wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low); | ||
288 | } | ||
289 | |||
290 | static u64 x2apic_icr_read(void) | ||
291 | { | ||
292 | unsigned long val; | ||
293 | |||
294 | rdmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), val); | ||
295 | return val; | ||
296 | } | ||
297 | |||
298 | static struct apic_ops x2apic_ops = { | ||
299 | .read = native_apic_msr_read, | ||
300 | .write = native_apic_msr_write, | ||
301 | .icr_read = x2apic_icr_read, | ||
302 | .icr_write = x2apic_icr_write, | ||
303 | .wait_icr_idle = x2apic_wait_icr_idle, | ||
304 | .safe_wait_icr_idle = safe_x2apic_wait_icr_idle, | ||
305 | }; | ||
306 | #endif | ||
307 | |||
308 | /** | 249 | /** |
309 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 | 250 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 |
310 | */ | 251 | */ |
@@ -895,7 +836,7 @@ void clear_local_APIC(void) | |||
895 | } | 836 | } |
896 | 837 | ||
897 | /* lets not touch this if we didn't frob it */ | 838 | /* lets not touch this if we didn't frob it */ |
898 | #if defined(CONFIG_X86_MCE_P4THERMAL) || defined(X86_MCE_INTEL) | 839 | #if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_MCE_INTEL) |
899 | if (maxlvt >= 5) { | 840 | if (maxlvt >= 5) { |
900 | v = apic_read(APIC_LVTTHMR); | 841 | v = apic_read(APIC_LVTTHMR); |
901 | apic_write(APIC_LVTTHMR, v | APIC_LVT_MASKED); | 842 | apic_write(APIC_LVTTHMR, v | APIC_LVT_MASKED); |
@@ -1320,17 +1261,12 @@ void __cpuinit end_local_APIC_setup(void) | |||
1320 | apic_pm_activate(); | 1261 | apic_pm_activate(); |
1321 | } | 1262 | } |
1322 | 1263 | ||
1323 | #ifdef HAVE_X2APIC | 1264 | #ifdef CONFIG_X86_X2APIC |
1324 | void check_x2apic(void) | 1265 | void check_x2apic(void) |
1325 | { | 1266 | { |
1326 | int msr, msr2; | 1267 | if (x2apic_enabled()) { |
1327 | |||
1328 | rdmsr(MSR_IA32_APICBASE, msr, msr2); | ||
1329 | |||
1330 | if (msr & X2APIC_ENABLE) { | ||
1331 | pr_info("x2apic enabled by BIOS, switching to x2apic ops\n"); | 1268 | pr_info("x2apic enabled by BIOS, switching to x2apic ops\n"); |
1332 | x2apic_preenabled = x2apic = 1; | 1269 | x2apic_preenabled = x2apic = 1; |
1333 | apic_ops = &x2apic_ops; | ||
1334 | } | 1270 | } |
1335 | } | 1271 | } |
1336 | 1272 | ||
@@ -1338,6 +1274,9 @@ void enable_x2apic(void) | |||
1338 | { | 1274 | { |
1339 | int msr, msr2; | 1275 | int msr, msr2; |
1340 | 1276 | ||
1277 | if (!x2apic) | ||
1278 | return; | ||
1279 | |||
1341 | rdmsr(MSR_IA32_APICBASE, msr, msr2); | 1280 | rdmsr(MSR_IA32_APICBASE, msr, msr2); |
1342 | if (!(msr & X2APIC_ENABLE)) { | 1281 | if (!(msr & X2APIC_ENABLE)) { |
1343 | pr_info("Enabling x2apic\n"); | 1282 | pr_info("Enabling x2apic\n"); |
@@ -1401,7 +1340,6 @@ void __init enable_IR_x2apic(void) | |||
1401 | 1340 | ||
1402 | if (!x2apic) { | 1341 | if (!x2apic) { |
1403 | x2apic = 1; | 1342 | x2apic = 1; |
1404 | apic_ops = &x2apic_ops; | ||
1405 | enable_x2apic(); | 1343 | enable_x2apic(); |
1406 | } | 1344 | } |
1407 | 1345 | ||
@@ -1439,7 +1377,7 @@ end: | |||
1439 | 1377 | ||
1440 | return; | 1378 | return; |
1441 | } | 1379 | } |
1442 | #endif /* HAVE_X2APIC */ | 1380 | #endif /* CONFIG_X86_X2APIC */ |
1443 | 1381 | ||
1444 | #ifdef CONFIG_X86_64 | 1382 | #ifdef CONFIG_X86_64 |
1445 | /* | 1383 | /* |
@@ -1570,7 +1508,7 @@ void __init early_init_lapic_mapping(void) | |||
1570 | */ | 1508 | */ |
1571 | void __init init_apic_mappings(void) | 1509 | void __init init_apic_mappings(void) |
1572 | { | 1510 | { |
1573 | #ifdef HAVE_X2APIC | 1511 | #ifdef CONFIG_X86_X2APIC |
1574 | if (x2apic) { | 1512 | if (x2apic) { |
1575 | boot_cpu_physical_apicid = read_apic_id(); | 1513 | boot_cpu_physical_apicid = read_apic_id(); |
1576 | return; | 1514 | return; |
@@ -1634,9 +1572,7 @@ int __init APIC_init_uniprocessor(void) | |||
1634 | } | 1572 | } |
1635 | #endif | 1573 | #endif |
1636 | 1574 | ||
1637 | #ifdef HAVE_X2APIC | ||
1638 | enable_IR_x2apic(); | 1575 | enable_IR_x2apic(); |
1639 | #endif | ||
1640 | #ifdef CONFIG_X86_64 | 1576 | #ifdef CONFIG_X86_64 |
1641 | default_setup_apic_routing(); | 1577 | default_setup_apic_routing(); |
1642 | #endif | 1578 | #endif |
@@ -2021,7 +1957,7 @@ static int lapic_resume(struct sys_device *dev) | |||
2021 | 1957 | ||
2022 | local_irq_save(flags); | 1958 | local_irq_save(flags); |
2023 | 1959 | ||
2024 | #ifdef HAVE_X2APIC | 1960 | #ifdef CONFIG_X86_X2APIC |
2025 | if (x2apic) | 1961 | if (x2apic) |
2026 | enable_x2apic(); | 1962 | enable_x2apic(); |
2027 | else | 1963 | else |
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c index 249d2d3c034c..3b002995e145 100644 --- a/arch/x86/kernel/genapic_flat_64.c +++ b/arch/x86/kernel/apic/apic_flat_64.c | |||
@@ -17,8 +17,8 @@ | |||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/hardirq.h> | 18 | #include <linux/hardirq.h> |
19 | #include <asm/smp.h> | 19 | #include <asm/smp.h> |
20 | #include <asm/apic.h> | ||
20 | #include <asm/ipi.h> | 21 | #include <asm/ipi.h> |
21 | #include <asm/genapic.h> | ||
22 | 22 | ||
23 | #ifdef CONFIG_ACPI | 23 | #ifdef CONFIG_ACPI |
24 | #include <acpi/acpi_bus.h> | 24 | #include <acpi/acpi_bus.h> |
@@ -178,7 +178,7 @@ static int flat_phys_pkg_id(int initial_apic_id, int index_msb) | |||
178 | return hard_smp_processor_id() >> index_msb; | 178 | return hard_smp_processor_id() >> index_msb; |
179 | } | 179 | } |
180 | 180 | ||
181 | struct genapic apic_flat = { | 181 | struct apic apic_flat = { |
182 | .name = "flat", | 182 | .name = "flat", |
183 | .probe = NULL, | 183 | .probe = NULL, |
184 | .acpi_madt_oem_check = flat_acpi_madt_oem_check, | 184 | .acpi_madt_oem_check = flat_acpi_madt_oem_check, |
@@ -227,8 +227,14 @@ struct genapic apic_flat = { | |||
227 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | 227 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, |
228 | .wait_for_init_deassert = NULL, | 228 | .wait_for_init_deassert = NULL, |
229 | .smp_callin_clear_local_apic = NULL, | 229 | .smp_callin_clear_local_apic = NULL, |
230 | .store_NMI_vector = NULL, | ||
231 | .inquire_remote_apic = NULL, | 230 | .inquire_remote_apic = NULL, |
231 | |||
232 | .read = native_apic_mem_read, | ||
233 | .write = native_apic_mem_write, | ||
234 | .icr_read = native_apic_icr_read, | ||
235 | .icr_write = native_apic_icr_write, | ||
236 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
237 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
232 | }; | 238 | }; |
233 | 239 | ||
234 | /* | 240 | /* |
@@ -321,7 +327,7 @@ physflat_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
321 | return BAD_APICID; | 327 | return BAD_APICID; |
322 | } | 328 | } |
323 | 329 | ||
324 | struct genapic apic_physflat = { | 330 | struct apic apic_physflat = { |
325 | 331 | ||
326 | .name = "physical flat", | 332 | .name = "physical flat", |
327 | .probe = NULL, | 333 | .probe = NULL, |
@@ -372,6 +378,12 @@ struct genapic apic_physflat = { | |||
372 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | 378 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, |
373 | .wait_for_init_deassert = NULL, | 379 | .wait_for_init_deassert = NULL, |
374 | .smp_callin_clear_local_apic = NULL, | 380 | .smp_callin_clear_local_apic = NULL, |
375 | .store_NMI_vector = NULL, | ||
376 | .inquire_remote_apic = NULL, | 381 | .inquire_remote_apic = NULL, |
382 | |||
383 | .read = native_apic_mem_read, | ||
384 | .write = native_apic_mem_write, | ||
385 | .icr_read = native_apic_icr_read, | ||
386 | .icr_write = native_apic_icr_write, | ||
387 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
388 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
377 | }; | 389 | }; |
diff --git a/arch/x86/kernel/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c index 47a62f46afdb..0b1093394fdf 100644 --- a/arch/x86/kernel/bigsmp_32.c +++ b/arch/x86/kernel/apic/bigsmp_32.c | |||
@@ -1,28 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | * APIC driver for "bigsmp" XAPIC machines with more than 8 virtual CPUs. | 2 | * APIC driver for "bigsmp" xAPIC machines with more than 8 virtual CPUs. |
3 | * | ||
3 | * Drives the local APIC in "clustered mode". | 4 | * Drives the local APIC in "clustered mode". |
4 | */ | 5 | */ |
5 | #define APIC_DEFINITION 1 | ||
6 | #include <linux/threads.h> | 6 | #include <linux/threads.h> |
7 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
8 | #include <asm/mpspec.h> | ||
9 | #include <asm/genapic.h> | ||
10 | #include <asm/fixmap.h> | ||
11 | #include <asm/apicdef.h> | ||
12 | #include <asm/ipi.h> | ||
13 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 9 | #include <linux/init.h> |
15 | #include <linux/dmi.h> | 10 | #include <linux/dmi.h> |
16 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
17 | 12 | ||
13 | #include <asm/apicdef.h> | ||
14 | #include <asm/fixmap.h> | ||
15 | #include <asm/mpspec.h> | ||
16 | #include <asm/apic.h> | ||
17 | #include <asm/ipi.h> | ||
18 | 18 | ||
19 | static inline unsigned bigsmp_get_apic_id(unsigned long x) | 19 | static inline unsigned bigsmp_get_apic_id(unsigned long x) |
20 | { | 20 | { |
21 | return (x >> 24) & 0xFF; | 21 | return (x >> 24) & 0xFF; |
22 | } | 22 | } |
23 | 23 | ||
24 | #define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu)) | ||
25 | |||
26 | static inline int bigsmp_apic_id_registered(void) | 24 | static inline int bigsmp_apic_id_registered(void) |
27 | { | 25 | { |
28 | return 1; | 26 | return 1; |
@@ -37,8 +35,6 @@ static inline const cpumask_t *bigsmp_target_cpus(void) | |||
37 | #endif | 35 | #endif |
38 | } | 36 | } |
39 | 37 | ||
40 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
41 | |||
42 | static inline unsigned long | 38 | static inline unsigned long |
43 | bigsmp_check_apicid_used(physid_mask_t bitmap, int apicid) | 39 | bigsmp_check_apicid_used(physid_mask_t bitmap, int apicid) |
44 | { | 40 | { |
@@ -53,9 +49,11 @@ static inline unsigned long bigsmp_check_apicid_present(int bit) | |||
53 | static inline unsigned long calculate_ldr(int cpu) | 49 | static inline unsigned long calculate_ldr(int cpu) |
54 | { | 50 | { |
55 | unsigned long val, id; | 51 | unsigned long val, id; |
52 | |||
56 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; | 53 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; |
57 | id = xapic_phys_to_log_apicid(cpu); | 54 | id = per_cpu(x86_bios_cpu_apicid, cpu); |
58 | val |= SET_APIC_LOGICAL_ID(id); | 55 | val |= SET_APIC_LOGICAL_ID(id); |
56 | |||
59 | return val; | 57 | return val; |
60 | } | 58 | } |
61 | 59 | ||
@@ -71,15 +69,16 @@ static inline void bigsmp_init_apic_ldr(void) | |||
71 | unsigned long val; | 69 | unsigned long val; |
72 | int cpu = smp_processor_id(); | 70 | int cpu = smp_processor_id(); |
73 | 71 | ||
74 | apic_write(APIC_DFR, APIC_DFR_VALUE); | 72 | apic_write(APIC_DFR, APIC_DFR_FLAT); |
75 | val = calculate_ldr(cpu); | 73 | val = calculate_ldr(cpu); |
76 | apic_write(APIC_LDR, val); | 74 | apic_write(APIC_LDR, val); |
77 | } | 75 | } |
78 | 76 | ||
79 | static inline void bigsmp_setup_apic_routing(void) | 77 | static inline void bigsmp_setup_apic_routing(void) |
80 | { | 78 | { |
81 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | 79 | printk(KERN_INFO |
82 | "Physflat", nr_ioapics); | 80 | "Enabling APIC mode: Physflat. Using %d I/O APICs\n", |
81 | nr_ioapics); | ||
83 | } | 82 | } |
84 | 83 | ||
85 | static inline int bigsmp_apicid_to_node(int logical_apicid) | 84 | static inline int bigsmp_apicid_to_node(int logical_apicid) |
@@ -100,7 +99,6 @@ static inline physid_mask_t bigsmp_apicid_to_cpu_present(int phys_apicid) | |||
100 | return physid_mask_of_physid(phys_apicid); | 99 | return physid_mask_of_physid(phys_apicid); |
101 | } | 100 | } |
102 | 101 | ||
103 | extern u8 cpu_2_logical_apicid[]; | ||
104 | /* Mapping from cpu number to logical apicid */ | 102 | /* Mapping from cpu number to logical apicid */ |
105 | static inline int bigsmp_cpu_to_logical_apicid(int cpu) | 103 | static inline int bigsmp_cpu_to_logical_apicid(int cpu) |
106 | { | 104 | { |
@@ -176,21 +174,24 @@ static int hp_ht_bigsmp(const struct dmi_system_id *d) | |||
176 | { | 174 | { |
177 | printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); | 175 | printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); |
178 | dmi_bigsmp = 1; | 176 | dmi_bigsmp = 1; |
177 | |||
179 | return 0; | 178 | return 0; |
180 | } | 179 | } |
181 | 180 | ||
182 | 181 | ||
183 | static const struct dmi_system_id bigsmp_dmi_table[] = { | 182 | static const struct dmi_system_id bigsmp_dmi_table[] = { |
184 | { hp_ht_bigsmp, "HP ProLiant DL760 G2", | 183 | { hp_ht_bigsmp, "HP ProLiant DL760 G2", |
185 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | 184 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), |
186 | DMI_MATCH(DMI_BIOS_VERSION, "P44-"),} | 185 | DMI_MATCH(DMI_BIOS_VERSION, "P44-"), |
186 | } | ||
187 | }, | 187 | }, |
188 | 188 | ||
189 | { hp_ht_bigsmp, "HP ProLiant DL740", | 189 | { hp_ht_bigsmp, "HP ProLiant DL740", |
190 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | 190 | { DMI_MATCH(DMI_BIOS_VENDOR, "HP"), |
191 | DMI_MATCH(DMI_BIOS_VERSION, "P47-"),} | 191 | DMI_MATCH(DMI_BIOS_VERSION, "P47-"), |
192 | } | ||
192 | }, | 193 | }, |
193 | { } | 194 | { } /* NULL entry stops DMI scanning */ |
194 | }; | 195 | }; |
195 | 196 | ||
196 | static void bigsmp_vector_allocation_domain(int cpu, cpumask_t *retmask) | 197 | static void bigsmp_vector_allocation_domain(int cpu, cpumask_t *retmask) |
@@ -205,10 +206,11 @@ static int probe_bigsmp(void) | |||
205 | dmi_bigsmp = 1; | 206 | dmi_bigsmp = 1; |
206 | else | 207 | else |
207 | dmi_check_system(bigsmp_dmi_table); | 208 | dmi_check_system(bigsmp_dmi_table); |
209 | |||
208 | return dmi_bigsmp; | 210 | return dmi_bigsmp; |
209 | } | 211 | } |
210 | 212 | ||
211 | struct genapic apic_bigsmp = { | 213 | struct apic apic_bigsmp = { |
212 | 214 | ||
213 | .name = "bigsmp", | 215 | .name = "bigsmp", |
214 | .probe = probe_bigsmp, | 216 | .probe = probe_bigsmp, |
@@ -261,6 +263,12 @@ struct genapic apic_bigsmp = { | |||
261 | .wait_for_init_deassert = default_wait_for_init_deassert, | 263 | .wait_for_init_deassert = default_wait_for_init_deassert, |
262 | 264 | ||
263 | .smp_callin_clear_local_apic = NULL, | 265 | .smp_callin_clear_local_apic = NULL, |
264 | .store_NMI_vector = NULL, | ||
265 | .inquire_remote_apic = default_inquire_remote_apic, | 266 | .inquire_remote_apic = default_inquire_remote_apic, |
267 | |||
268 | .read = native_apic_mem_read, | ||
269 | .write = native_apic_mem_write, | ||
270 | .icr_read = native_apic_icr_read, | ||
271 | .icr_write = native_apic_icr_write, | ||
272 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
273 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
266 | }; | 274 | }; |
diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c index 55515d73d9c2..320f2d2e4e54 100644 --- a/arch/x86/kernel/es7000_32.c +++ b/arch/x86/kernel/apic/es7000_32.c | |||
@@ -1,10 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * Written by: Garry Forsgren, Unisys Corporation | 2 | * Written by: Garry Forsgren, Unisys Corporation |
3 | * Natalie Protasevich, Unisys Corporation | 3 | * Natalie Protasevich, Unisys Corporation |
4 | * | ||
4 | * This file contains the code to configure and interface | 5 | * This file contains the code to configure and interface |
5 | * with Unisys ES7000 series hardware system manager. | 6 | * with Unisys ES7000 series hardware system manager. |
6 | * | 7 | * |
7 | * Copyright (c) 2003 Unisys Corporation. All Rights Reserved. | 8 | * Copyright (c) 2003 Unisys Corporation. |
9 | * Copyright (C) 2009, Red Hat, Inc., Ingo Molnar | ||
10 | * | ||
11 | * All Rights Reserved. | ||
8 | * | 12 | * |
9 | * This program is free software; you can redistribute it and/or modify it | 13 | * This program is free software; you can redistribute it and/or modify it |
10 | * under the terms of version 2 of the GNU General Public License as | 14 | * under the terms of version 2 of the GNU General Public License as |
@@ -23,128 +27,105 @@ | |||
23 | * | 27 | * |
24 | * http://www.unisys.com | 28 | * http://www.unisys.com |
25 | */ | 29 | */ |
26 | 30 | #include <linux/notifier.h> | |
27 | #include <linux/module.h> | 31 | #include <linux/spinlock.h> |
28 | #include <linux/types.h> | 32 | #include <linux/cpumask.h> |
33 | #include <linux/threads.h> | ||
29 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
30 | #include <linux/smp.h> | 35 | #include <linux/module.h> |
36 | #include <linux/reboot.h> | ||
31 | #include <linux/string.h> | 37 | #include <linux/string.h> |
32 | #include <linux/spinlock.h> | 38 | #include <linux/types.h> |
33 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
34 | #include <linux/notifier.h> | ||
35 | #include <linux/reboot.h> | ||
36 | #include <linux/init.h> | ||
37 | #include <linux/acpi.h> | 40 | #include <linux/acpi.h> |
38 | #include <asm/io.h> | 41 | #include <linux/init.h> |
39 | #include <asm/nmi.h> | 42 | #include <linux/nmi.h> |
40 | #include <asm/smp.h> | 43 | #include <linux/smp.h> |
41 | #include <asm/atomic.h> | 44 | #include <linux/io.h> |
45 | |||
42 | #include <asm/apicdef.h> | 46 | #include <asm/apicdef.h> |
43 | #include <asm/genapic.h> | 47 | #include <asm/atomic.h> |
48 | #include <asm/fixmap.h> | ||
49 | #include <asm/mpspec.h> | ||
44 | #include <asm/setup.h> | 50 | #include <asm/setup.h> |
51 | #include <asm/apic.h> | ||
52 | #include <asm/ipi.h> | ||
45 | 53 | ||
46 | /* | 54 | /* |
47 | * ES7000 chipsets | 55 | * ES7000 chipsets |
48 | */ | 56 | */ |
49 | 57 | ||
50 | #define NON_UNISYS 0 | 58 | #define NON_UNISYS 0 |
51 | #define ES7000_CLASSIC 1 | 59 | #define ES7000_CLASSIC 1 |
52 | #define ES7000_ZORRO 2 | 60 | #define ES7000_ZORRO 2 |
53 | 61 | ||
62 | #define MIP_REG 1 | ||
63 | #define MIP_PSAI_REG 4 | ||
54 | 64 | ||
55 | #define MIP_REG 1 | 65 | #define MIP_BUSY 1 |
56 | #define MIP_PSAI_REG 4 | 66 | #define MIP_SPIN 0xf0000 |
67 | #define MIP_VALID 0x0100000000000000ULL | ||
68 | #define MIP_SW_APIC 0x1020b | ||
57 | 69 | ||
58 | #define MIP_BUSY 1 | 70 | #define MIP_PORT(val) ((val >> 32) & 0xffff) |
59 | #define MIP_SPIN 0xf0000 | ||
60 | #define MIP_VALID 0x0100000000000000ULL | ||
61 | #define MIP_PORT(VALUE) ((VALUE >> 32) & 0xffff) | ||
62 | 71 | ||
63 | #define MIP_RD_LO(VALUE) (VALUE & 0xffffffff) | 72 | #define MIP_RD_LO(val) (val & 0xffffffff) |
64 | 73 | ||
65 | struct mip_reg_info { | 74 | struct mip_reg { |
66 | unsigned long long mip_info; | 75 | unsigned long long off_0x00; |
67 | unsigned long long delivery_info; | 76 | unsigned long long off_0x08; |
68 | unsigned long long host_reg; | 77 | unsigned long long off_0x10; |
69 | unsigned long long mip_reg; | 78 | unsigned long long off_0x18; |
79 | unsigned long long off_0x20; | ||
80 | unsigned long long off_0x28; | ||
81 | unsigned long long off_0x30; | ||
82 | unsigned long long off_0x38; | ||
70 | }; | 83 | }; |
71 | 84 | ||
72 | struct part_info { | 85 | struct mip_reg_info { |
73 | unsigned char type; | 86 | unsigned long long mip_info; |
74 | unsigned char length; | 87 | unsigned long long delivery_info; |
75 | unsigned char part_id; | 88 | unsigned long long host_reg; |
76 | unsigned char apic_mode; | 89 | unsigned long long mip_reg; |
77 | unsigned long snum; | ||
78 | char ptype[16]; | ||
79 | char sname[64]; | ||
80 | char pname[64]; | ||
81 | }; | 90 | }; |
82 | 91 | ||
83 | struct psai { | 92 | struct psai { |
84 | unsigned long long entry_type; | 93 | unsigned long long entry_type; |
85 | unsigned long long addr; | 94 | unsigned long long addr; |
86 | unsigned long long bep_addr; | 95 | unsigned long long bep_addr; |
87 | }; | 96 | }; |
88 | 97 | ||
89 | struct es7000_mem_info { | 98 | #ifdef CONFIG_ACPI |
90 | unsigned char type; | ||
91 | unsigned char length; | ||
92 | unsigned char resv[6]; | ||
93 | unsigned long long start; | ||
94 | unsigned long long size; | ||
95 | }; | ||
96 | 99 | ||
97 | struct es7000_oem_table { | 100 | struct es7000_oem_table { |
98 | unsigned long long hdr; | 101 | struct acpi_table_header Header; |
99 | struct mip_reg_info mip; | 102 | u32 OEMTableAddr; |
100 | struct part_info pif; | 103 | u32 OEMTableSize; |
101 | struct es7000_mem_info shm; | ||
102 | struct psai psai; | ||
103 | }; | 104 | }; |
104 | 105 | ||
105 | #ifdef CONFIG_ACPI | 106 | static unsigned long oem_addrX; |
106 | 107 | static unsigned long oem_size; | |
107 | struct oem_table { | ||
108 | struct acpi_table_header Header; | ||
109 | u32 OEMTableAddr; | ||
110 | u32 OEMTableSize; | ||
111 | }; | ||
112 | 108 | ||
113 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | ||
114 | extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr); | ||
115 | #endif | 109 | #endif |
116 | 110 | ||
117 | struct mip_reg { | ||
118 | unsigned long long off_0; | ||
119 | unsigned long long off_8; | ||
120 | unsigned long long off_10; | ||
121 | unsigned long long off_18; | ||
122 | unsigned long long off_20; | ||
123 | unsigned long long off_28; | ||
124 | unsigned long long off_30; | ||
125 | unsigned long long off_38; | ||
126 | }; | ||
127 | |||
128 | #define MIP_SW_APIC 0x1020b | ||
129 | #define MIP_FUNC(VALUE) (VALUE & 0xff) | ||
130 | |||
131 | /* | 111 | /* |
132 | * ES7000 Globals | 112 | * ES7000 Globals |
133 | */ | 113 | */ |
134 | 114 | ||
135 | static volatile unsigned long *psai = NULL; | 115 | static volatile unsigned long *psai; |
136 | static struct mip_reg *mip_reg; | 116 | static struct mip_reg *mip_reg; |
137 | static struct mip_reg *host_reg; | 117 | static struct mip_reg *host_reg; |
138 | static int mip_port; | 118 | static int mip_port; |
139 | static unsigned long mip_addr, host_addr; | 119 | static unsigned long mip_addr; |
120 | static unsigned long host_addr; | ||
140 | 121 | ||
141 | int es7000_plat; | 122 | int es7000_plat; |
142 | 123 | ||
143 | /* | 124 | /* |
144 | * GSI override for ES7000 platforms. | 125 | * GSI override for ES7000 platforms. |
145 | */ | 126 | */ |
146 | 127 | ||
147 | static unsigned int base; | 128 | static unsigned int base; |
148 | 129 | ||
149 | static int | 130 | static int |
150 | es7000_rename_gsi(int ioapic, int gsi) | 131 | es7000_rename_gsi(int ioapic, int gsi) |
@@ -160,6 +141,7 @@ es7000_rename_gsi(int ioapic, int gsi) | |||
160 | 141 | ||
161 | if (!ioapic && (gsi < 16)) | 142 | if (!ioapic && (gsi < 16)) |
162 | gsi += base; | 143 | gsi += base; |
144 | |||
163 | return gsi; | 145 | return gsi; |
164 | } | 146 | } |
165 | 147 | ||
@@ -181,14 +163,14 @@ static int wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip) | |||
181 | return 0; | 163 | return 0; |
182 | } | 164 | } |
183 | 165 | ||
184 | static int __init es7000_update_genapic(void) | 166 | static int __init es7000_update_apic(void) |
185 | { | 167 | { |
186 | apic->wakeup_cpu = wakeup_secondary_cpu_via_mip; | 168 | apic->wakeup_cpu = wakeup_secondary_cpu_via_mip; |
187 | 169 | ||
188 | /* MPENTIUMIII */ | 170 | /* MPENTIUMIII */ |
189 | if (boot_cpu_data.x86 == 6 && | 171 | if (boot_cpu_data.x86 == 6 && |
190 | (boot_cpu_data.x86_model >= 7 || boot_cpu_data.x86_model <= 11)) { | 172 | (boot_cpu_data.x86_model >= 7 || boot_cpu_data.x86_model <= 11)) { |
191 | es7000_update_genapic_to_cluster(); | 173 | es7000_update_apic_to_cluster(); |
192 | apic->wait_for_init_deassert = NULL; | 174 | apic->wait_for_init_deassert = NULL; |
193 | apic->wakeup_cpu = wakeup_secondary_cpu_via_mip; | 175 | apic->wakeup_cpu = wakeup_secondary_cpu_via_mip; |
194 | } | 176 | } |
@@ -196,8 +178,7 @@ static int __init es7000_update_genapic(void) | |||
196 | return 0; | 178 | return 0; |
197 | } | 179 | } |
198 | 180 | ||
199 | void __init | 181 | static void __init setup_unisys(void) |
200 | setup_unisys(void) | ||
201 | { | 182 | { |
202 | /* | 183 | /* |
203 | * Determine the generation of the ES7000 currently running. | 184 | * Determine the generation of the ES7000 currently running. |
@@ -212,22 +193,20 @@ setup_unisys(void) | |||
212 | es7000_plat = ES7000_CLASSIC; | 193 | es7000_plat = ES7000_CLASSIC; |
213 | ioapic_renumber_irq = es7000_rename_gsi; | 194 | ioapic_renumber_irq = es7000_rename_gsi; |
214 | 195 | ||
215 | x86_quirks->update_genapic = es7000_update_genapic; | 196 | x86_quirks->update_apic = es7000_update_apic; |
216 | } | 197 | } |
217 | 198 | ||
218 | /* | 199 | /* |
219 | * Parse the OEM Table | 200 | * Parse the OEM Table: |
220 | */ | 201 | */ |
221 | 202 | static int __init parse_unisys_oem(char *oemptr) | |
222 | int __init | ||
223 | parse_unisys_oem (char *oemptr) | ||
224 | { | 203 | { |
225 | int i; | 204 | int i; |
226 | int success = 0; | 205 | int success = 0; |
227 | unsigned char type, size; | 206 | unsigned char type, size; |
228 | unsigned long val; | 207 | unsigned long val; |
229 | char *tp = NULL; | 208 | char *tp = NULL; |
230 | struct psai *psaip = NULL; | 209 | struct psai *psaip = NULL; |
231 | struct mip_reg_info *mi; | 210 | struct mip_reg_info *mi; |
232 | struct mip_reg *host, *mip; | 211 | struct mip_reg *host, *mip; |
233 | 212 | ||
@@ -235,7 +214,7 @@ parse_unisys_oem (char *oemptr) | |||
235 | 214 | ||
236 | tp += 8; | 215 | tp += 8; |
237 | 216 | ||
238 | for (i=0; i <= 6; i++) { | 217 | for (i = 0; i <= 6; i++) { |
239 | type = *tp++; | 218 | type = *tp++; |
240 | size = *tp++; | 219 | size = *tp++; |
241 | tp -= 2; | 220 | tp -= 2; |
@@ -273,50 +252,96 @@ parse_unisys_oem (char *oemptr) | |||
273 | tp += size; | 252 | tp += size; |
274 | } | 253 | } |
275 | 254 | ||
276 | if (success < 2) { | 255 | if (success < 2) |
277 | es7000_plat = NON_UNISYS; | 256 | es7000_plat = NON_UNISYS; |
278 | } else | 257 | else |
279 | setup_unisys(); | 258 | setup_unisys(); |
259 | |||
280 | return es7000_plat; | 260 | return es7000_plat; |
281 | } | 261 | } |
282 | 262 | ||
283 | #ifdef CONFIG_ACPI | 263 | #ifdef CONFIG_ACPI |
284 | static unsigned long oem_addrX; | 264 | static int __init find_unisys_acpi_oem_table(unsigned long *oem_addr) |
285 | static unsigned long oem_size; | ||
286 | int __init find_unisys_acpi_oem_table(unsigned long *oem_addr) | ||
287 | { | 265 | { |
288 | struct acpi_table_header *header = NULL; | 266 | struct acpi_table_header *header = NULL; |
289 | int i = 0; | 267 | struct es7000_oem_table *table; |
290 | acpi_size tbl_size; | 268 | acpi_size tbl_size; |
269 | acpi_status ret; | ||
270 | int i = 0; | ||
291 | 271 | ||
292 | while (ACPI_SUCCESS(acpi_get_table_with_size("OEM1", i++, &header, &tbl_size))) { | 272 | for (;;) { |
293 | if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) { | 273 | ret = acpi_get_table_with_size("OEM1", i++, &header, &tbl_size); |
294 | struct oem_table *t = (struct oem_table *)header; | 274 | if (!ACPI_SUCCESS(ret)) |
275 | return -1; | ||
295 | 276 | ||
296 | oem_addrX = t->OEMTableAddr; | 277 | if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) |
297 | oem_size = t->OEMTableSize; | 278 | break; |
298 | early_acpi_os_unmap_memory(header, tbl_size); | ||
299 | 279 | ||
300 | *oem_addr = (unsigned long)__acpi_map_table(oem_addrX, | ||
301 | oem_size); | ||
302 | return 0; | ||
303 | } | ||
304 | early_acpi_os_unmap_memory(header, tbl_size); | 280 | early_acpi_os_unmap_memory(header, tbl_size); |
305 | } | 281 | } |
306 | return -1; | 282 | |
283 | table = (void *)header; | ||
284 | |||
285 | oem_addrX = table->OEMTableAddr; | ||
286 | oem_size = table->OEMTableSize; | ||
287 | |||
288 | early_acpi_os_unmap_memory(header, tbl_size); | ||
289 | |||
290 | *oem_addr = (unsigned long)__acpi_map_table(oem_addrX, oem_size); | ||
291 | |||
292 | return 0; | ||
307 | } | 293 | } |
308 | 294 | ||
309 | void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr) | 295 | static void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr) |
310 | { | 296 | { |
311 | if (!oem_addr) | 297 | if (!oem_addr) |
312 | return; | 298 | return; |
313 | 299 | ||
314 | __acpi_unmap_table((char *)oem_addr, oem_size); | 300 | __acpi_unmap_table((char *)oem_addr, oem_size); |
315 | } | 301 | } |
316 | #endif | ||
317 | 302 | ||
318 | static void | 303 | static int es7000_check_dsdt(void) |
319 | es7000_spin(int n) | 304 | { |
305 | struct acpi_table_header header; | ||
306 | |||
307 | if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) && | ||
308 | !strncmp(header.oem_id, "UNISYS", 6)) | ||
309 | return 1; | ||
310 | return 0; | ||
311 | } | ||
312 | |||
313 | /* Hook from generic ACPI tables.c */ | ||
314 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
315 | { | ||
316 | unsigned long oem_addr = 0; | ||
317 | int check_dsdt; | ||
318 | int ret = 0; | ||
319 | |||
320 | /* check dsdt at first to avoid clear fix_map for oem_addr */ | ||
321 | check_dsdt = es7000_check_dsdt(); | ||
322 | |||
323 | if (!find_unisys_acpi_oem_table(&oem_addr)) { | ||
324 | if (check_dsdt) { | ||
325 | ret = parse_unisys_oem((char *)oem_addr); | ||
326 | } else { | ||
327 | setup_unisys(); | ||
328 | ret = 1; | ||
329 | } | ||
330 | /* | ||
331 | * we need to unmap it | ||
332 | */ | ||
333 | unmap_unisys_acpi_oem_table(oem_addr); | ||
334 | } | ||
335 | return ret; | ||
336 | } | ||
337 | #else /* !CONFIG_ACPI: */ | ||
338 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
339 | { | ||
340 | return 0; | ||
341 | } | ||
342 | #endif /* !CONFIG_ACPI */ | ||
343 | |||
344 | static void es7000_spin(int n) | ||
320 | { | 345 | { |
321 | int i = 0; | 346 | int i = 0; |
322 | 347 | ||
@@ -327,16 +352,15 @@ es7000_spin(int n) | |||
327 | static int __init | 352 | static int __init |
328 | es7000_mip_write(struct mip_reg *mip_reg) | 353 | es7000_mip_write(struct mip_reg *mip_reg) |
329 | { | 354 | { |
330 | int status = 0; | 355 | int status = 0; |
331 | int spin; | 356 | int spin; |
332 | 357 | ||
333 | spin = MIP_SPIN; | 358 | spin = MIP_SPIN; |
334 | while (((unsigned long long)host_reg->off_38 & | 359 | while ((host_reg->off_0x38 & MIP_VALID) != 0) { |
335 | (unsigned long long)MIP_VALID) != 0) { | 360 | if (--spin <= 0) { |
336 | if (--spin <= 0) { | 361 | WARN(1, "Timeout waiting for Host Valid Flag\n"); |
337 | printk("es7000_mip_write: Timeout waiting for Host Valid Flag"); | 362 | return -1; |
338 | return -1; | 363 | } |
339 | } | ||
340 | es7000_spin(MIP_SPIN); | 364 | es7000_spin(MIP_SPIN); |
341 | } | 365 | } |
342 | 366 | ||
@@ -345,23 +369,21 @@ es7000_mip_write(struct mip_reg *mip_reg) | |||
345 | 369 | ||
346 | spin = MIP_SPIN; | 370 | spin = MIP_SPIN; |
347 | 371 | ||
348 | while (((unsigned long long)mip_reg->off_38 & | 372 | while ((mip_reg->off_0x38 & MIP_VALID) == 0) { |
349 | (unsigned long long)MIP_VALID) == 0) { | ||
350 | if (--spin <= 0) { | 373 | if (--spin <= 0) { |
351 | printk("es7000_mip_write: Timeout waiting for MIP Valid Flag"); | 374 | WARN(1, "Timeout waiting for MIP Valid Flag\n"); |
352 | return -1; | 375 | return -1; |
353 | } | 376 | } |
354 | es7000_spin(MIP_SPIN); | 377 | es7000_spin(MIP_SPIN); |
355 | } | 378 | } |
356 | 379 | ||
357 | status = ((unsigned long long)mip_reg->off_0 & | 380 | status = (mip_reg->off_0x00 & 0xffff0000000000ULL) >> 48; |
358 | (unsigned long long)0xffff0000000000ULL) >> 48; | 381 | mip_reg->off_0x38 &= ~MIP_VALID; |
359 | mip_reg->off_38 = ((unsigned long long)mip_reg->off_38 & | 382 | |
360 | (unsigned long long)~MIP_VALID); | ||
361 | return status; | 383 | return status; |
362 | } | 384 | } |
363 | 385 | ||
364 | void __init es7000_enable_apic_mode(void) | 386 | static void __init es7000_enable_apic_mode(void) |
365 | { | 387 | { |
366 | struct mip_reg es7000_mip_reg; | 388 | struct mip_reg es7000_mip_reg; |
367 | int mip_status; | 389 | int mip_status; |
@@ -369,53 +391,15 @@ void __init es7000_enable_apic_mode(void) | |||
369 | if (!es7000_plat) | 391 | if (!es7000_plat) |
370 | return; | 392 | return; |
371 | 393 | ||
372 | printk("ES7000: Enabling APIC mode.\n"); | 394 | printk(KERN_INFO "ES7000: Enabling APIC mode.\n"); |
373 | memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); | 395 | memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); |
374 | es7000_mip_reg.off_0 = MIP_SW_APIC; | 396 | es7000_mip_reg.off_0x00 = MIP_SW_APIC; |
375 | es7000_mip_reg.off_38 = MIP_VALID; | 397 | es7000_mip_reg.off_0x38 = MIP_VALID; |
376 | 398 | ||
377 | while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) { | 399 | while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) |
378 | printk("es7000_enable_apic_mode: command failed, status = %x\n", | 400 | WARN(1, "Command failed, status = %x\n", mip_status); |
379 | mip_status); | ||
380 | } | ||
381 | } | 401 | } |
382 | 402 | ||
383 | /* | ||
384 | * APIC driver for the Unisys ES7000 chipset. | ||
385 | */ | ||
386 | #define APIC_DEFINITION 1 | ||
387 | #include <linux/threads.h> | ||
388 | #include <linux/cpumask.h> | ||
389 | #include <asm/mpspec.h> | ||
390 | #include <asm/genapic.h> | ||
391 | #include <asm/fixmap.h> | ||
392 | #include <asm/apicdef.h> | ||
393 | #include <linux/kernel.h> | ||
394 | #include <linux/string.h> | ||
395 | #include <linux/init.h> | ||
396 | #include <linux/acpi.h> | ||
397 | #include <linux/smp.h> | ||
398 | #include <asm/ipi.h> | ||
399 | |||
400 | #define APIC_DFR_VALUE_CLUSTER (APIC_DFR_CLUSTER) | ||
401 | #define INT_DELIVERY_MODE_CLUSTER (dest_LowestPrio) | ||
402 | #define INT_DEST_MODE_CLUSTER (1) /* logical delivery broadcast to all procs */ | ||
403 | |||
404 | #define APIC_DFR_VALUE (APIC_DFR_FLAT) | ||
405 | |||
406 | extern void es7000_enable_apic_mode(void); | ||
407 | extern int apic_version [MAX_APICS]; | ||
408 | extern u8 cpu_2_logical_apicid[]; | ||
409 | extern unsigned int boot_cpu_physical_apicid; | ||
410 | |||
411 | extern int parse_unisys_oem (char *oemptr); | ||
412 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | ||
413 | extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr); | ||
414 | extern void setup_unisys(void); | ||
415 | |||
416 | #define apicid_cluster(apicid) (apicid & 0xF0) | ||
417 | #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu) | ||
418 | |||
419 | static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask) | 403 | static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask) |
420 | { | 404 | { |
421 | /* Careful. Some cpus do not strictly honor the set of cpus | 405 | /* Careful. Some cpus do not strictly honor the set of cpus |
@@ -444,18 +428,6 @@ static unsigned int es7000_get_apic_id(unsigned long x) | |||
444 | return (x >> 24) & 0xFF; | 428 | return (x >> 24) & 0xFF; |
445 | } | 429 | } |
446 | 430 | ||
447 | #ifdef CONFIG_ACPI | ||
448 | static int es7000_check_dsdt(void) | ||
449 | { | ||
450 | struct acpi_table_header header; | ||
451 | |||
452 | if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) && | ||
453 | !strncmp(header.oem_id, "UNISYS", 6)) | ||
454 | return 1; | ||
455 | return 0; | ||
456 | } | ||
457 | #endif | ||
458 | |||
459 | static void es7000_send_IPI_mask(const struct cpumask *mask, int vector) | 431 | static void es7000_send_IPI_mask(const struct cpumask *mask, int vector) |
460 | { | 432 | { |
461 | default_send_IPI_mask_sequence_phys(mask, vector); | 433 | default_send_IPI_mask_sequence_phys(mask, vector); |
@@ -473,7 +445,7 @@ static void es7000_send_IPI_all(int vector) | |||
473 | 445 | ||
474 | static int es7000_apic_id_registered(void) | 446 | static int es7000_apic_id_registered(void) |
475 | { | 447 | { |
476 | return 1; | 448 | return 1; |
477 | } | 449 | } |
478 | 450 | ||
479 | static const cpumask_t *target_cpus_cluster(void) | 451 | static const cpumask_t *target_cpus_cluster(void) |
@@ -498,9 +470,9 @@ static unsigned long es7000_check_apicid_present(int bit) | |||
498 | 470 | ||
499 | static unsigned long calculate_ldr(int cpu) | 471 | static unsigned long calculate_ldr(int cpu) |
500 | { | 472 | { |
501 | unsigned long id = xapic_phys_to_log_apicid(cpu); | 473 | unsigned long id = per_cpu(x86_bios_cpu_apicid, cpu); |
502 | 474 | ||
503 | return (SET_APIC_LOGICAL_ID(id)); | 475 | return SET_APIC_LOGICAL_ID(id); |
504 | } | 476 | } |
505 | 477 | ||
506 | /* | 478 | /* |
@@ -515,7 +487,7 @@ static void es7000_init_apic_ldr_cluster(void) | |||
515 | unsigned long val; | 487 | unsigned long val; |
516 | int cpu = smp_processor_id(); | 488 | int cpu = smp_processor_id(); |
517 | 489 | ||
518 | apic_write(APIC_DFR, APIC_DFR_VALUE_CLUSTER); | 490 | apic_write(APIC_DFR, APIC_DFR_CLUSTER); |
519 | val = calculate_ldr(cpu); | 491 | val = calculate_ldr(cpu); |
520 | apic_write(APIC_LDR, val); | 492 | apic_write(APIC_LDR, val); |
521 | } | 493 | } |
@@ -525,7 +497,7 @@ static void es7000_init_apic_ldr(void) | |||
525 | unsigned long val; | 497 | unsigned long val; |
526 | int cpu = smp_processor_id(); | 498 | int cpu = smp_processor_id(); |
527 | 499 | ||
528 | apic_write(APIC_DFR, APIC_DFR_VALUE); | 500 | apic_write(APIC_DFR, APIC_DFR_FLAT); |
529 | val = calculate_ldr(cpu); | 501 | val = calculate_ldr(cpu); |
530 | apic_write(APIC_LDR, val); | 502 | apic_write(APIC_LDR, val); |
531 | } | 503 | } |
@@ -533,10 +505,12 @@ static void es7000_init_apic_ldr(void) | |||
533 | static void es7000_setup_apic_routing(void) | 505 | static void es7000_setup_apic_routing(void) |
534 | { | 506 | { |
535 | int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id()); | 507 | int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id()); |
536 | printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", | 508 | |
509 | printk(KERN_INFO | ||
510 | "Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n", | ||
537 | (apic_version[apic] == 0x14) ? | 511 | (apic_version[apic] == 0x14) ? |
538 | "Physical Cluster" : "Logical Cluster", | 512 | "Physical Cluster" : "Logical Cluster", |
539 | nr_ioapics, cpus_addr(*es7000_target_cpus())[0]); | 513 | nr_ioapics, cpus_addr(*es7000_target_cpus())[0]); |
540 | } | 514 | } |
541 | 515 | ||
542 | static int es7000_apicid_to_node(int logical_apicid) | 516 | static int es7000_apicid_to_node(int logical_apicid) |
@@ -550,18 +524,19 @@ static int es7000_cpu_present_to_apicid(int mps_cpu) | |||
550 | if (!mps_cpu) | 524 | if (!mps_cpu) |
551 | return boot_cpu_physical_apicid; | 525 | return boot_cpu_physical_apicid; |
552 | else if (mps_cpu < nr_cpu_ids) | 526 | else if (mps_cpu < nr_cpu_ids) |
553 | return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu); | 527 | return per_cpu(x86_bios_cpu_apicid, mps_cpu); |
554 | else | 528 | else |
555 | return BAD_APICID; | 529 | return BAD_APICID; |
556 | } | 530 | } |
557 | 531 | ||
532 | static int cpu_id; | ||
533 | |||
558 | static physid_mask_t es7000_apicid_to_cpu_present(int phys_apicid) | 534 | static physid_mask_t es7000_apicid_to_cpu_present(int phys_apicid) |
559 | { | 535 | { |
560 | static int id = 0; | ||
561 | physid_mask_t mask; | 536 | physid_mask_t mask; |
562 | 537 | ||
563 | mask = physid_mask_of_physid(id); | 538 | mask = physid_mask_of_physid(cpu_id); |
564 | ++id; | 539 | ++cpu_id; |
565 | 540 | ||
566 | return mask; | 541 | return mask; |
567 | } | 542 | } |
@@ -572,7 +547,7 @@ static int es7000_cpu_to_logical_apicid(int cpu) | |||
572 | #ifdef CONFIG_SMP | 547 | #ifdef CONFIG_SMP |
573 | if (cpu >= nr_cpu_ids) | 548 | if (cpu >= nr_cpu_ids) |
574 | return BAD_APICID; | 549 | return BAD_APICID; |
575 | return (int)cpu_2_logical_apicid[cpu]; | 550 | return cpu_2_logical_apicid[cpu]; |
576 | #else | 551 | #else |
577 | return logical_smp_processor_id(); | 552 | return logical_smp_processor_id(); |
578 | #endif | 553 | #endif |
@@ -587,7 +562,7 @@ static physid_mask_t es7000_ioapic_phys_id_map(physid_mask_t phys_map) | |||
587 | static int es7000_check_phys_apicid_present(int cpu_physical_apicid) | 562 | static int es7000_check_phys_apicid_present(int cpu_physical_apicid) |
588 | { | 563 | { |
589 | boot_cpu_physical_apicid = read_apic_id(); | 564 | boot_cpu_physical_apicid = read_apic_id(); |
590 | return (1); | 565 | return 1; |
591 | } | 566 | } |
592 | 567 | ||
593 | static unsigned int | 568 | static unsigned int |
@@ -613,9 +588,8 @@ es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask) | |||
613 | if (cpumask_test_cpu(cpu, cpumask)) { | 588 | if (cpumask_test_cpu(cpu, cpumask)) { |
614 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); | 589 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); |
615 | 590 | ||
616 | if (apicid_cluster(apicid) != | 591 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { |
617 | apicid_cluster(new_apicid)) { | 592 | WARN(1, "Not a valid mask!"); |
618 | printk ("%s: Not a valid mask!\n", __func__); | ||
619 | 593 | ||
620 | return 0xFF; | 594 | return 0xFF; |
621 | } | 595 | } |
@@ -648,9 +622,8 @@ static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
648 | if (cpu_isset(cpu, *cpumask)) { | 622 | if (cpu_isset(cpu, *cpumask)) { |
649 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); | 623 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); |
650 | 624 | ||
651 | if (apicid_cluster(apicid) != | 625 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { |
652 | apicid_cluster(new_apicid)) { | 626 | printk("%s: Not a valid mask!\n", __func__); |
653 | printk ("%s: Not a valid mask!\n", __func__); | ||
654 | 627 | ||
655 | return es7000_cpu_to_logical_apicid(0); | 628 | return es7000_cpu_to_logical_apicid(0); |
656 | } | 629 | } |
@@ -686,11 +659,12 @@ static int es7000_phys_pkg_id(int cpuid_apic, int index_msb) | |||
686 | return cpuid_apic >> index_msb; | 659 | return cpuid_apic >> index_msb; |
687 | } | 660 | } |
688 | 661 | ||
689 | void __init es7000_update_genapic_to_cluster(void) | 662 | void __init es7000_update_apic_to_cluster(void) |
690 | { | 663 | { |
691 | apic->target_cpus = target_cpus_cluster; | 664 | apic->target_cpus = target_cpus_cluster; |
692 | apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER; | 665 | apic->irq_delivery_mode = dest_LowestPrio; |
693 | apic->irq_dest_mode = INT_DEST_MODE_CLUSTER; | 666 | /* logical delivery broadcast to all procs: */ |
667 | apic->irq_dest_mode = 1; | ||
694 | 668 | ||
695 | apic->init_apic_ldr = es7000_init_apic_ldr_cluster; | 669 | apic->init_apic_ldr = es7000_init_apic_ldr_cluster; |
696 | 670 | ||
@@ -716,40 +690,8 @@ es7000_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | |||
716 | return 0; | 690 | return 0; |
717 | } | 691 | } |
718 | 692 | ||
719 | #ifdef CONFIG_ACPI | ||
720 | /* Hook from generic ACPI tables.c */ | ||
721 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
722 | { | ||
723 | unsigned long oem_addr = 0; | ||
724 | int check_dsdt; | ||
725 | int ret = 0; | ||
726 | |||
727 | /* check dsdt at first to avoid clear fix_map for oem_addr */ | ||
728 | check_dsdt = es7000_check_dsdt(); | ||
729 | |||
730 | if (!find_unisys_acpi_oem_table(&oem_addr)) { | ||
731 | if (check_dsdt) | ||
732 | ret = parse_unisys_oem((char *)oem_addr); | ||
733 | else { | ||
734 | setup_unisys(); | ||
735 | ret = 1; | ||
736 | } | ||
737 | /* | ||
738 | * we need to unmap it | ||
739 | */ | ||
740 | unmap_unisys_acpi_oem_table(oem_addr); | ||
741 | } | ||
742 | return ret; | ||
743 | } | ||
744 | #else | ||
745 | static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
746 | { | ||
747 | return 0; | ||
748 | } | ||
749 | #endif | ||
750 | |||
751 | 693 | ||
752 | struct genapic apic_es7000 = { | 694 | struct apic apic_es7000 = { |
753 | 695 | ||
754 | .name = "es7000", | 696 | .name = "es7000", |
755 | .probe = probe_es7000, | 697 | .probe = probe_es7000, |
@@ -804,6 +746,12 @@ struct genapic apic_es7000 = { | |||
804 | 746 | ||
805 | /* Nothing to do for most platforms, since cleared by the INIT cycle: */ | 747 | /* Nothing to do for most platforms, since cleared by the INIT cycle: */ |
806 | .smp_callin_clear_local_apic = NULL, | 748 | .smp_callin_clear_local_apic = NULL, |
807 | .store_NMI_vector = NULL, | ||
808 | .inquire_remote_apic = default_inquire_remote_apic, | 749 | .inquire_remote_apic = default_inquire_remote_apic, |
750 | |||
751 | .read = native_apic_mem_read, | ||
752 | .write = native_apic_mem_write, | ||
753 | .icr_read = native_apic_icr_read, | ||
754 | .icr_write = native_apic_icr_write, | ||
755 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
756 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
809 | }; | 757 | }; |
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/apic/io_apic.c index a89878e08a42..00e6071cefc4 100644 --- a/arch/x86/kernel/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <asm/uv/uv_hub.h> | 62 | #include <asm/uv/uv_hub.h> |
63 | #include <asm/uv/uv_irq.h> | 63 | #include <asm/uv/uv_irq.h> |
64 | 64 | ||
65 | #include <asm/genapic.h> | 65 | #include <asm/apic.h> |
66 | 66 | ||
67 | #define __apicdebuginit(type) static type __init | 67 | #define __apicdebuginit(type) static type __init |
68 | 68 | ||
diff --git a/arch/x86/kernel/ipi.c b/arch/x86/kernel/apic/ipi.c index dbf5445727a9..dbf5445727a9 100644 --- a/arch/x86/kernel/ipi.c +++ b/arch/x86/kernel/apic/ipi.c | |||
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/apic/nmi.c index bdfad80c3cf1..bdfad80c3cf1 100644 --- a/arch/x86/kernel/nmi.c +++ b/arch/x86/kernel/apic/nmi.c | |||
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c index 0cc41a1d2550..d9d6d61eed82 100644 --- a/arch/x86/kernel/numaq_32.c +++ b/arch/x86/kernel/apic/numaq_32.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * Written by: Patricia Gaughen, IBM Corporation | 2 | * Written by: Patricia Gaughen, IBM Corporation |
3 | * | 3 | * |
4 | * Copyright (C) 2002, IBM Corp. | 4 | * Copyright (C) 2002, IBM Corp. |
5 | * Copyright (C) 2009, Red Hat, Inc., Ingo Molnar | ||
5 | * | 6 | * |
6 | * All rights reserved. | 7 | * All rights reserved. |
7 | * | 8 | * |
@@ -22,21 +23,81 @@ | |||
22 | * | 23 | * |
23 | * Send feedback to <gone@us.ibm.com> | 24 | * Send feedback to <gone@us.ibm.com> |
24 | */ | 25 | */ |
25 | |||
26 | #include <linux/nodemask.h> | 26 | #include <linux/nodemask.h> |
27 | #include <linux/topology.h> | ||
27 | #include <linux/bootmem.h> | 28 | #include <linux/bootmem.h> |
29 | #include <linux/threads.h> | ||
30 | #include <linux/cpumask.h> | ||
31 | #include <linux/kernel.h> | ||
28 | #include <linux/mmzone.h> | 32 | #include <linux/mmzone.h> |
29 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <linux/string.h> | ||
35 | #include <linux/init.h> | ||
36 | #include <linux/numa.h> | ||
37 | #include <linux/smp.h> | ||
38 | #include <linux/io.h> | ||
30 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
31 | 40 | ||
32 | #include <asm/processor.h> | 41 | #include <asm/processor.h> |
33 | #include <asm/topology.h> | 42 | #include <asm/fixmap.h> |
34 | #include <asm/genapic.h> | 43 | #include <asm/mpspec.h> |
35 | #include <asm/numaq.h> | 44 | #include <asm/numaq.h> |
36 | #include <asm/setup.h> | 45 | #include <asm/setup.h> |
46 | #include <asm/apic.h> | ||
37 | #include <asm/e820.h> | 47 | #include <asm/e820.h> |
48 | #include <asm/ipi.h> | ||
49 | |||
50 | #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) | ||
51 | |||
52 | int found_numaq; | ||
53 | |||
54 | /* | ||
55 | * Have to match translation table entries to main table entries by counter | ||
56 | * hence the mpc_record variable .... can't see a less disgusting way of | ||
57 | * doing this .... | ||
58 | */ | ||
59 | struct mpc_trans { | ||
60 | unsigned char mpc_type; | ||
61 | unsigned char trans_len; | ||
62 | unsigned char trans_type; | ||
63 | unsigned char trans_quad; | ||
64 | unsigned char trans_global; | ||
65 | unsigned char trans_local; | ||
66 | unsigned short trans_reserved; | ||
67 | }; | ||
68 | |||
69 | /* x86_quirks member */ | ||
70 | static int mpc_record; | ||
71 | |||
72 | static __cpuinitdata struct mpc_trans *translation_table[MAX_MPC_ENTRY]; | ||
73 | |||
74 | int mp_bus_id_to_node[MAX_MP_BUSSES]; | ||
75 | int mp_bus_id_to_local[MAX_MP_BUSSES]; | ||
76 | int quad_local_to_mp_bus_id[NR_CPUS/4][4]; | ||
77 | |||
38 | 78 | ||
39 | #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) | 79 | static inline void numaq_register_node(int node, struct sys_cfg_data *scd) |
80 | { | ||
81 | struct eachquadmem *eq = scd->eq + node; | ||
82 | |||
83 | node_set_online(node); | ||
84 | |||
85 | /* Convert to pages */ | ||
86 | node_start_pfn[node] = | ||
87 | MB_TO_PAGES(eq->hi_shrd_mem_start - eq->priv_mem_size); | ||
88 | |||
89 | node_end_pfn[node] = | ||
90 | MB_TO_PAGES(eq->hi_shrd_mem_start + eq->hi_shrd_mem_size); | ||
91 | |||
92 | e820_register_active_regions(node, node_start_pfn[node], | ||
93 | node_end_pfn[node]); | ||
94 | |||
95 | memory_present(node, node_start_pfn[node], node_end_pfn[node]); | ||
96 | |||
97 | node_remap_size[node] = node_memmap_size_bytes(node, | ||
98 | node_start_pfn[node], | ||
99 | node_end_pfn[node]); | ||
100 | } | ||
40 | 101 | ||
41 | /* | 102 | /* |
42 | * Function: smp_dump_qct() | 103 | * Function: smp_dump_qct() |
@@ -46,34 +107,18 @@ | |||
46 | */ | 107 | */ |
47 | static void __init smp_dump_qct(void) | 108 | static void __init smp_dump_qct(void) |
48 | { | 109 | { |
110 | struct sys_cfg_data *scd; | ||
49 | int node; | 111 | int node; |
50 | struct eachquadmem *eq; | 112 | |
51 | struct sys_cfg_data *scd = | 113 | scd = (void *)__va(SYS_CFG_DATA_PRIV_ADDR); |
52 | (struct sys_cfg_data *)__va(SYS_CFG_DATA_PRIV_ADDR); | ||
53 | 114 | ||
54 | nodes_clear(node_online_map); | 115 | nodes_clear(node_online_map); |
55 | for_each_node(node) { | 116 | for_each_node(node) { |
56 | if (scd->quads_present31_0 & (1 << node)) { | 117 | if (scd->quads_present31_0 & (1 << node)) |
57 | node_set_online(node); | 118 | numaq_register_node(node, scd); |
58 | eq = &scd->eq[node]; | ||
59 | /* Convert to pages */ | ||
60 | node_start_pfn[node] = MB_TO_PAGES( | ||
61 | eq->hi_shrd_mem_start - eq->priv_mem_size); | ||
62 | node_end_pfn[node] = MB_TO_PAGES( | ||
63 | eq->hi_shrd_mem_start + eq->hi_shrd_mem_size); | ||
64 | |||
65 | e820_register_active_regions(node, node_start_pfn[node], | ||
66 | node_end_pfn[node]); | ||
67 | memory_present(node, | ||
68 | node_start_pfn[node], node_end_pfn[node]); | ||
69 | node_remap_size[node] = node_memmap_size_bytes(node, | ||
70 | node_start_pfn[node], | ||
71 | node_end_pfn[node]); | ||
72 | } | ||
73 | } | 119 | } |
74 | } | 120 | } |
75 | 121 | ||
76 | |||
77 | void __cpuinit numaq_tsc_disable(void) | 122 | void __cpuinit numaq_tsc_disable(void) |
78 | { | 123 | { |
79 | if (!found_numaq) | 124 | if (!found_numaq) |
@@ -91,28 +136,6 @@ static int __init numaq_pre_time_init(void) | |||
91 | return 0; | 136 | return 0; |
92 | } | 137 | } |
93 | 138 | ||
94 | int found_numaq; | ||
95 | |||
96 | /* | ||
97 | * Have to match translation table entries to main table entries by counter | ||
98 | * hence the mpc_record variable .... can't see a less disgusting way of | ||
99 | * doing this .... | ||
100 | */ | ||
101 | struct mpc_config_translation { | ||
102 | unsigned char mpc_type; | ||
103 | unsigned char trans_len; | ||
104 | unsigned char trans_type; | ||
105 | unsigned char trans_quad; | ||
106 | unsigned char trans_global; | ||
107 | unsigned char trans_local; | ||
108 | unsigned short trans_reserved; | ||
109 | }; | ||
110 | |||
111 | /* x86_quirks member */ | ||
112 | static int mpc_record; | ||
113 | static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] | ||
114 | __cpuinitdata; | ||
115 | |||
116 | static inline int generate_logical_apicid(int quad, int phys_apicid) | 139 | static inline int generate_logical_apicid(int quad, int phys_apicid) |
117 | { | 140 | { |
118 | return (quad << 4) + (phys_apicid ? phys_apicid << 1 : 1); | 141 | return (quad << 4) + (phys_apicid ? phys_apicid << 1 : 1); |
@@ -124,17 +147,15 @@ static int mpc_apic_id(struct mpc_cpu *m) | |||
124 | int quad = translation_table[mpc_record]->trans_quad; | 147 | int quad = translation_table[mpc_record]->trans_quad; |
125 | int logical_apicid = generate_logical_apicid(quad, m->apicid); | 148 | int logical_apicid = generate_logical_apicid(quad, m->apicid); |
126 | 149 | ||
127 | printk(KERN_DEBUG "Processor #%d %u:%u APIC version %d (quad %d, apic %d)\n", | 150 | printk(KERN_DEBUG |
128 | m->apicid, (m->cpufeature & CPU_FAMILY_MASK) >> 8, | 151 | "Processor #%d %u:%u APIC version %d (quad %d, apic %d)\n", |
129 | (m->cpufeature & CPU_MODEL_MASK) >> 4, | 152 | m->apicid, (m->cpufeature & CPU_FAMILY_MASK) >> 8, |
130 | m->apicver, quad, logical_apicid); | 153 | (m->cpufeature & CPU_MODEL_MASK) >> 4, |
154 | m->apicver, quad, logical_apicid); | ||
155 | |||
131 | return logical_apicid; | 156 | return logical_apicid; |
132 | } | 157 | } |
133 | 158 | ||
134 | int mp_bus_id_to_node[MAX_MP_BUSSES]; | ||
135 | |||
136 | int mp_bus_id_to_local[MAX_MP_BUSSES]; | ||
137 | |||
138 | /* x86_quirks member */ | 159 | /* x86_quirks member */ |
139 | static void mpc_oem_bus_info(struct mpc_bus *m, char *name) | 160 | static void mpc_oem_bus_info(struct mpc_bus *m, char *name) |
140 | { | 161 | { |
@@ -143,11 +164,9 @@ static void mpc_oem_bus_info(struct mpc_bus *m, char *name) | |||
143 | 164 | ||
144 | mp_bus_id_to_node[m->busid] = quad; | 165 | mp_bus_id_to_node[m->busid] = quad; |
145 | mp_bus_id_to_local[m->busid] = local; | 166 | mp_bus_id_to_local[m->busid] = local; |
146 | printk(KERN_INFO "Bus #%d is %s (node %d)\n", | ||
147 | m->busid, name, quad); | ||
148 | } | ||
149 | 167 | ||
150 | int quad_local_to_mp_bus_id [NR_CPUS/4][4]; | 168 | printk(KERN_INFO "Bus #%d is %s (node %d)\n", m->busid, name, quad); |
169 | } | ||
151 | 170 | ||
152 | /* x86_quirks member */ | 171 | /* x86_quirks member */ |
153 | static void mpc_oem_pci_bus(struct mpc_bus *m) | 172 | static void mpc_oem_pci_bus(struct mpc_bus *m) |
@@ -158,17 +177,18 @@ static void mpc_oem_pci_bus(struct mpc_bus *m) | |||
158 | quad_local_to_mp_bus_id[quad][local] = m->busid; | 177 | quad_local_to_mp_bus_id[quad][local] = m->busid; |
159 | } | 178 | } |
160 | 179 | ||
161 | static void __init MP_translation_info(struct mpc_config_translation *m) | 180 | static void __init MP_translation_info(struct mpc_trans *m) |
162 | { | 181 | { |
163 | printk(KERN_INFO | 182 | printk(KERN_INFO |
164 | "Translation: record %d, type %d, quad %d, global %d, local %d\n", | 183 | "Translation: record %d, type %d, quad %d, global %d, local %d\n", |
165 | mpc_record, m->trans_type, m->trans_quad, m->trans_global, | 184 | mpc_record, m->trans_type, m->trans_quad, m->trans_global, |
166 | m->trans_local); | 185 | m->trans_local); |
167 | 186 | ||
168 | if (mpc_record >= MAX_MPC_ENTRY) | 187 | if (mpc_record >= MAX_MPC_ENTRY) |
169 | printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n"); | 188 | printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n"); |
170 | else | 189 | else |
171 | translation_table[mpc_record] = m; /* stash this for later */ | 190 | translation_table[mpc_record] = m; /* stash this for later */ |
191 | |||
172 | if (m->trans_quad < MAX_NUMNODES && !node_online(m->trans_quad)) | 192 | if (m->trans_quad < MAX_NUMNODES && !node_online(m->trans_quad)) |
173 | node_set_online(m->trans_quad); | 193 | node_set_online(m->trans_quad); |
174 | } | 194 | } |
@@ -186,16 +206,16 @@ static int __init mpf_checksum(unsigned char *mp, int len) | |||
186 | /* | 206 | /* |
187 | * Read/parse the MPC oem tables | 207 | * Read/parse the MPC oem tables |
188 | */ | 208 | */ |
189 | 209 | static void __init | |
190 | static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable, | 210 | smp_read_mpc_oem(struct mpc_oemtable *oemtable, unsigned short oemsize) |
191 | unsigned short oemsize) | ||
192 | { | 211 | { |
193 | int count = sizeof(*oemtable); /* the header size */ | 212 | int count = sizeof(*oemtable); /* the header size */ |
194 | unsigned char *oemptr = ((unsigned char *)oemtable) + count; | 213 | unsigned char *oemptr = ((unsigned char *)oemtable) + count; |
195 | 214 | ||
196 | mpc_record = 0; | 215 | mpc_record = 0; |
197 | printk(KERN_INFO "Found an OEM MPC table at %8p - parsing it ... \n", | 216 | printk(KERN_INFO |
198 | oemtable); | 217 | "Found an OEM MPC table at %8p - parsing it ... \n", oemtable); |
218 | |||
199 | if (memcmp(oemtable->signature, MPC_OEM_SIGNATURE, 4)) { | 219 | if (memcmp(oemtable->signature, MPC_OEM_SIGNATURE, 4)) { |
200 | printk(KERN_WARNING | 220 | printk(KERN_WARNING |
201 | "SMP mpc oemtable: bad signature [%c%c%c%c]!\n", | 221 | "SMP mpc oemtable: bad signature [%c%c%c%c]!\n", |
@@ -203,16 +223,18 @@ static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable, | |||
203 | oemtable->signature[2], oemtable->signature[3]); | 223 | oemtable->signature[2], oemtable->signature[3]); |
204 | return; | 224 | return; |
205 | } | 225 | } |
226 | |||
206 | if (mpf_checksum((unsigned char *)oemtable, oemtable->length)) { | 227 | if (mpf_checksum((unsigned char *)oemtable, oemtable->length)) { |
207 | printk(KERN_WARNING "SMP oem mptable: checksum error!\n"); | 228 | printk(KERN_WARNING "SMP oem mptable: checksum error!\n"); |
208 | return; | 229 | return; |
209 | } | 230 | } |
231 | |||
210 | while (count < oemtable->length) { | 232 | while (count < oemtable->length) { |
211 | switch (*oemptr) { | 233 | switch (*oemptr) { |
212 | case MP_TRANSLATION: | 234 | case MP_TRANSLATION: |
213 | { | 235 | { |
214 | struct mpc_config_translation *m = | 236 | struct mpc_trans *m = (void *)oemptr; |
215 | (struct mpc_config_translation *)oemptr; | 237 | |
216 | MP_translation_info(m); | 238 | MP_translation_info(m); |
217 | oemptr += sizeof(*m); | 239 | oemptr += sizeof(*m); |
218 | count += sizeof(*m); | 240 | count += sizeof(*m); |
@@ -220,12 +242,10 @@ static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable, | |||
220 | break; | 242 | break; |
221 | } | 243 | } |
222 | default: | 244 | default: |
223 | { | 245 | printk(KERN_WARNING |
224 | printk(KERN_WARNING | 246 | "Unrecognised OEM table entry type! - %d\n", |
225 | "Unrecognised OEM table entry type! - %d\n", | 247 | (int)*oemptr); |
226 | (int)*oemptr); | 248 | return; |
227 | return; | ||
228 | } | ||
229 | } | 249 | } |
230 | } | 250 | } |
231 | } | 251 | } |
@@ -236,7 +256,7 @@ static int __init numaq_setup_ioapic_ids(void) | |||
236 | return 1; | 256 | return 1; |
237 | } | 257 | } |
238 | 258 | ||
239 | static int __init numaq_update_genapic(void) | 259 | static int __init numaq_update_apic(void) |
240 | { | 260 | { |
241 | apic->wakeup_cpu = wakeup_secondary_cpu_via_nmi; | 261 | apic->wakeup_cpu = wakeup_secondary_cpu_via_nmi; |
242 | 262 | ||
@@ -244,37 +264,30 @@ static int __init numaq_update_genapic(void) | |||
244 | } | 264 | } |
245 | 265 | ||
246 | static struct x86_quirks numaq_x86_quirks __initdata = { | 266 | static struct x86_quirks numaq_x86_quirks __initdata = { |
247 | .arch_pre_time_init = numaq_pre_time_init, | 267 | .arch_pre_time_init = numaq_pre_time_init, |
248 | .arch_time_init = NULL, | 268 | .arch_time_init = NULL, |
249 | .arch_pre_intr_init = NULL, | 269 | .arch_pre_intr_init = NULL, |
250 | .arch_memory_setup = NULL, | 270 | .arch_memory_setup = NULL, |
251 | .arch_intr_init = NULL, | 271 | .arch_intr_init = NULL, |
252 | .arch_trap_init = NULL, | 272 | .arch_trap_init = NULL, |
253 | .mach_get_smp_config = NULL, | 273 | .mach_get_smp_config = NULL, |
254 | .mach_find_smp_config = NULL, | 274 | .mach_find_smp_config = NULL, |
255 | .mpc_record = &mpc_record, | 275 | .mpc_record = &mpc_record, |
256 | .mpc_apic_id = mpc_apic_id, | 276 | .mpc_apic_id = mpc_apic_id, |
257 | .mpc_oem_bus_info = mpc_oem_bus_info, | 277 | .mpc_oem_bus_info = mpc_oem_bus_info, |
258 | .mpc_oem_pci_bus = mpc_oem_pci_bus, | 278 | .mpc_oem_pci_bus = mpc_oem_pci_bus, |
259 | .smp_read_mpc_oem = smp_read_mpc_oem, | 279 | .smp_read_mpc_oem = smp_read_mpc_oem, |
260 | .setup_ioapic_ids = numaq_setup_ioapic_ids, | 280 | .setup_ioapic_ids = numaq_setup_ioapic_ids, |
261 | .update_genapic = numaq_update_genapic, | 281 | .update_apic = numaq_update_apic, |
262 | }; | 282 | }; |
263 | 283 | ||
264 | void numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
265 | { | ||
266 | if (strncmp(oem, "IBM NUMA", 8)) | ||
267 | printk("Warning! Not a NUMA-Q system!\n"); | ||
268 | else | ||
269 | found_numaq = 1; | ||
270 | } | ||
271 | |||
272 | static __init void early_check_numaq(void) | 284 | static __init void early_check_numaq(void) |
273 | { | 285 | { |
274 | /* | 286 | /* |
275 | * Find possible boot-time SMP configuration: | 287 | * Find possible boot-time SMP configuration: |
276 | */ | 288 | */ |
277 | early_find_smp_config(); | 289 | early_find_smp_config(); |
290 | |||
278 | /* | 291 | /* |
279 | * get boot-time SMP configuration: | 292 | * get boot-time SMP configuration: |
280 | */ | 293 | */ |
@@ -291,30 +304,10 @@ int __init get_memcfg_numaq(void) | |||
291 | if (!found_numaq) | 304 | if (!found_numaq) |
292 | return 0; | 305 | return 0; |
293 | smp_dump_qct(); | 306 | smp_dump_qct(); |
307 | |||
294 | return 1; | 308 | return 1; |
295 | } | 309 | } |
296 | 310 | ||
297 | /* | ||
298 | * APIC driver for the IBM NUMAQ chipset. | ||
299 | */ | ||
300 | #define APIC_DEFINITION 1 | ||
301 | #include <linux/threads.h> | ||
302 | #include <linux/cpumask.h> | ||
303 | #include <asm/mpspec.h> | ||
304 | #include <asm/genapic.h> | ||
305 | #include <asm/fixmap.h> | ||
306 | #include <asm/apicdef.h> | ||
307 | #include <asm/ipi.h> | ||
308 | #include <linux/kernel.h> | ||
309 | #include <linux/string.h> | ||
310 | #include <linux/init.h> | ||
311 | #include <linux/numa.h> | ||
312 | #include <linux/smp.h> | ||
313 | #include <asm/numaq.h> | ||
314 | #include <asm/io.h> | ||
315 | #include <linux/mmzone.h> | ||
316 | #include <linux/nodemask.h> | ||
317 | |||
318 | #define NUMAQ_APIC_DFR_VALUE (APIC_DFR_CLUSTER) | 311 | #define NUMAQ_APIC_DFR_VALUE (APIC_DFR_CLUSTER) |
319 | 312 | ||
320 | static inline unsigned int numaq_get_apic_id(unsigned long x) | 313 | static inline unsigned int numaq_get_apic_id(unsigned long x) |
@@ -337,10 +330,8 @@ static inline void numaq_send_IPI_all(int vector) | |||
337 | numaq_send_IPI_mask(cpu_online_mask, vector); | 330 | numaq_send_IPI_mask(cpu_online_mask, vector); |
338 | } | 331 | } |
339 | 332 | ||
340 | extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); | 333 | #define NUMAQ_TRAMPOLINE_PHYS_LOW (0x8) |
341 | 334 | #define NUMAQ_TRAMPOLINE_PHYS_HIGH (0xa) | |
342 | #define NUMAQ_TRAMPOLINE_PHYS_LOW (0x8) | ||
343 | #define NUMAQ_TRAMPOLINE_PHYS_HIGH (0xa) | ||
344 | 335 | ||
345 | /* | 336 | /* |
346 | * Because we use NMIs rather than the INIT-STARTUP sequence to | 337 | * Because we use NMIs rather than the INIT-STARTUP sequence to |
@@ -351,16 +342,6 @@ static inline void numaq_smp_callin_clear_local_apic(void) | |||
351 | clear_local_APIC(); | 342 | clear_local_APIC(); |
352 | } | 343 | } |
353 | 344 | ||
354 | static inline void | ||
355 | numaq_store_NMI_vector(unsigned short *high, unsigned short *low) | ||
356 | { | ||
357 | printk("Storing NMI vector\n"); | ||
358 | *high = | ||
359 | *((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_HIGH)); | ||
360 | *low = | ||
361 | *((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_LOW)); | ||
362 | } | ||
363 | |||
364 | static inline const cpumask_t *numaq_target_cpus(void) | 345 | static inline const cpumask_t *numaq_target_cpus(void) |
365 | { | 346 | { |
366 | return &CPU_MASK_ALL; | 347 | return &CPU_MASK_ALL; |
@@ -377,8 +358,6 @@ static inline unsigned long numaq_check_apicid_present(int bit) | |||
377 | return physid_isset(bit, phys_cpu_present_map); | 358 | return physid_isset(bit, phys_cpu_present_map); |
378 | } | 359 | } |
379 | 360 | ||
380 | #define apicid_cluster(apicid) (apicid & 0xF0) | ||
381 | |||
382 | static inline int numaq_apic_id_registered(void) | 361 | static inline int numaq_apic_id_registered(void) |
383 | { | 362 | { |
384 | return 1; | 363 | return 1; |
@@ -391,8 +370,9 @@ static inline void numaq_init_apic_ldr(void) | |||
391 | 370 | ||
392 | static inline void numaq_setup_apic_routing(void) | 371 | static inline void numaq_setup_apic_routing(void) |
393 | { | 372 | { |
394 | printk("Enabling APIC mode: %s. Using %d I/O APICs\n", | 373 | printk(KERN_INFO |
395 | "NUMA-Q", nr_ioapics); | 374 | "Enabling APIC mode: NUMA-Q. Using %d I/O APICs\n", |
375 | nr_ioapics); | ||
396 | } | 376 | } |
397 | 377 | ||
398 | /* | 378 | /* |
@@ -410,14 +390,11 @@ static inline physid_mask_t numaq_ioapic_phys_id_map(physid_mask_t phys_map) | |||
410 | return physids_promote(0xFUL); | 390 | return physids_promote(0xFUL); |
411 | } | 391 | } |
412 | 392 | ||
413 | /* Mapping from cpu number to logical apicid */ | ||
414 | extern u8 cpu_2_logical_apicid[]; | ||
415 | |||
416 | static inline int numaq_cpu_to_logical_apicid(int cpu) | 393 | static inline int numaq_cpu_to_logical_apicid(int cpu) |
417 | { | 394 | { |
418 | if (cpu >= nr_cpu_ids) | 395 | if (cpu >= nr_cpu_ids) |
419 | return BAD_APICID; | 396 | return BAD_APICID; |
420 | return (int)cpu_2_logical_apicid[cpu]; | 397 | return cpu_2_logical_apicid[cpu]; |
421 | } | 398 | } |
422 | 399 | ||
423 | /* | 400 | /* |
@@ -433,7 +410,7 @@ static inline int numaq_cpu_present_to_apicid(int mps_cpu) | |||
433 | return BAD_APICID; | 410 | return BAD_APICID; |
434 | } | 411 | } |
435 | 412 | ||
436 | static inline int numaq_apicid_to_node(int logical_apicid) | 413 | static inline int numaq_apicid_to_node(int logical_apicid) |
437 | { | 414 | { |
438 | return logical_apicid >> 4; | 415 | return logical_apicid >> 4; |
439 | } | 416 | } |
@@ -475,9 +452,15 @@ static inline int numaq_phys_pkg_id(int cpuid_apic, int index_msb) | |||
475 | { | 452 | { |
476 | return cpuid_apic >> index_msb; | 453 | return cpuid_apic >> index_msb; |
477 | } | 454 | } |
478 | static int __numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | 455 | |
456 | static int | ||
457 | numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | ||
479 | { | 458 | { |
480 | numaq_mps_oem_check(mpc, oem, productid); | 459 | if (strncmp(oem, "IBM NUMA", 8)) |
460 | printk(KERN_ERR "Warning! Not a NUMA-Q system!\n"); | ||
461 | else | ||
462 | found_numaq = 1; | ||
463 | |||
481 | return found_numaq; | 464 | return found_numaq; |
482 | } | 465 | } |
483 | 466 | ||
@@ -507,13 +490,17 @@ static void numaq_setup_portio_remap(void) | |||
507 | if (num_quads <= 1) | 490 | if (num_quads <= 1) |
508 | return; | 491 | return; |
509 | 492 | ||
510 | printk("Remapping cross-quad port I/O for %d quads\n", num_quads); | 493 | printk(KERN_INFO |
494 | "Remapping cross-quad port I/O for %d quads\n", num_quads); | ||
495 | |||
511 | xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD); | 496 | xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD); |
512 | printk("xquad_portio vaddr 0x%08lx, len %08lx\n", | 497 | |
498 | printk(KERN_INFO | ||
499 | "xquad_portio vaddr 0x%08lx, len %08lx\n", | ||
513 | (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD); | 500 | (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD); |
514 | } | 501 | } |
515 | 502 | ||
516 | struct genapic apic_numaq = { | 503 | struct apic apic_numaq = { |
517 | 504 | ||
518 | .name = "NUMAQ", | 505 | .name = "NUMAQ", |
519 | .probe = probe_numaq, | 506 | .probe = probe_numaq, |
@@ -544,7 +531,7 @@ struct genapic apic_numaq = { | |||
544 | .check_phys_apicid_present = numaq_check_phys_apicid_present, | 531 | .check_phys_apicid_present = numaq_check_phys_apicid_present, |
545 | .enable_apic_mode = NULL, | 532 | .enable_apic_mode = NULL, |
546 | .phys_pkg_id = numaq_phys_pkg_id, | 533 | .phys_pkg_id = numaq_phys_pkg_id, |
547 | .mps_oem_check = __numaq_mps_oem_check, | 534 | .mps_oem_check = numaq_mps_oem_check, |
548 | 535 | ||
549 | .get_apic_id = numaq_get_apic_id, | 536 | .get_apic_id = numaq_get_apic_id, |
550 | .set_apic_id = NULL, | 537 | .set_apic_id = NULL, |
@@ -567,6 +554,12 @@ struct genapic apic_numaq = { | |||
567 | .wait_for_init_deassert = NULL, | 554 | .wait_for_init_deassert = NULL, |
568 | 555 | ||
569 | .smp_callin_clear_local_apic = numaq_smp_callin_clear_local_apic, | 556 | .smp_callin_clear_local_apic = numaq_smp_callin_clear_local_apic, |
570 | .store_NMI_vector = numaq_store_NMI_vector, | ||
571 | .inquire_remote_apic = NULL, | 557 | .inquire_remote_apic = NULL, |
558 | |||
559 | .read = native_apic_mem_read, | ||
560 | .write = native_apic_mem_write, | ||
561 | .icr_read = native_apic_icr_read, | ||
562 | .icr_write = native_apic_icr_write, | ||
563 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
564 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
572 | }; | 565 | }; |
diff --git a/arch/x86/kernel/probe_32.c b/arch/x86/kernel/apic/probe_32.c index 22337b75de62..3a730fa574bb 100644 --- a/arch/x86/kernel/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | #include <linux/threads.h> | 9 | #include <linux/threads.h> |
10 | #include <linux/cpumask.h> | 10 | #include <linux/cpumask.h> |
11 | #include <linux/module.h> | ||
11 | #include <linux/string.h> | 12 | #include <linux/string.h> |
12 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
13 | #include <linux/ctype.h> | 14 | #include <linux/ctype.h> |
@@ -16,32 +17,27 @@ | |||
16 | #include <asm/fixmap.h> | 17 | #include <asm/fixmap.h> |
17 | #include <asm/mpspec.h> | 18 | #include <asm/mpspec.h> |
18 | #include <asm/apicdef.h> | 19 | #include <asm/apicdef.h> |
19 | #include <asm/genapic.h> | 20 | #include <asm/apic.h> |
20 | #include <asm/setup.h> | 21 | #include <asm/setup.h> |
21 | 22 | ||
22 | #include <linux/threads.h> | 23 | #include <linux/threads.h> |
23 | #include <linux/cpumask.h> | 24 | #include <linux/cpumask.h> |
24 | #include <asm/mpspec.h> | 25 | #include <asm/mpspec.h> |
25 | #include <asm/genapic.h> | ||
26 | #include <asm/fixmap.h> | 26 | #include <asm/fixmap.h> |
27 | #include <asm/apicdef.h> | 27 | #include <asm/apicdef.h> |
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/smp.h> | 30 | #include <linux/smp.h> |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <asm/genapic.h> | ||
33 | #include <asm/ipi.h> | 32 | #include <asm/ipi.h> |
34 | 33 | ||
35 | #include <linux/smp.h> | 34 | #include <linux/smp.h> |
36 | #include <linux/init.h> | 35 | #include <linux/init.h> |
37 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
38 | #include <asm/acpi.h> | 37 | #include <asm/acpi.h> |
39 | #include <asm/arch_hooks.h> | ||
40 | #include <asm/e820.h> | 38 | #include <asm/e820.h> |
41 | #include <asm/setup.h> | 39 | #include <asm/setup.h> |
42 | 40 | ||
43 | #include <asm/genapic.h> | ||
44 | |||
45 | #ifdef CONFIG_HOTPLUG_CPU | 41 | #ifdef CONFIG_HOTPLUG_CPU |
46 | #define DEFAULT_SEND_IPI (1) | 42 | #define DEFAULT_SEND_IPI (1) |
47 | #else | 43 | #else |
@@ -50,7 +46,31 @@ | |||
50 | 46 | ||
51 | int no_broadcast = DEFAULT_SEND_IPI; | 47 | int no_broadcast = DEFAULT_SEND_IPI; |
52 | 48 | ||
53 | #ifdef CONFIG_X86_LOCAL_APIC | 49 | static __init int no_ipi_broadcast(char *str) |
50 | { | ||
51 | get_option(&str, &no_broadcast); | ||
52 | pr_info("Using %s mode\n", | ||
53 | no_broadcast ? "No IPI Broadcast" : "IPI Broadcast"); | ||
54 | return 1; | ||
55 | } | ||
56 | __setup("no_ipi_broadcast=", no_ipi_broadcast); | ||
57 | |||
58 | static int __init print_ipi_mode(void) | ||
59 | { | ||
60 | pr_info("Using IPI %s mode\n", | ||
61 | no_broadcast ? "No-Shortcut" : "Shortcut"); | ||
62 | return 0; | ||
63 | } | ||
64 | late_initcall(print_ipi_mode); | ||
65 | |||
66 | void default_setup_apic_routing(void) | ||
67 | { | ||
68 | #ifdef CONFIG_X86_IO_APIC | ||
69 | printk(KERN_INFO | ||
70 | "Enabling APIC mode: Flat. Using %d I/O APICs\n", | ||
71 | nr_ioapics); | ||
72 | #endif | ||
73 | } | ||
54 | 74 | ||
55 | static void default_vector_allocation_domain(int cpu, struct cpumask *retmask) | 75 | static void default_vector_allocation_domain(int cpu, struct cpumask *retmask) |
56 | { | 76 | { |
@@ -72,7 +92,7 @@ static int probe_default(void) | |||
72 | return 1; | 92 | return 1; |
73 | } | 93 | } |
74 | 94 | ||
75 | struct genapic apic_default = { | 95 | struct apic apic_default = { |
76 | 96 | ||
77 | .name = "default", | 97 | .name = "default", |
78 | .probe = probe_default, | 98 | .probe = probe_default, |
@@ -125,19 +145,26 @@ struct genapic apic_default = { | |||
125 | .wait_for_init_deassert = default_wait_for_init_deassert, | 145 | .wait_for_init_deassert = default_wait_for_init_deassert, |
126 | 146 | ||
127 | .smp_callin_clear_local_apic = NULL, | 147 | .smp_callin_clear_local_apic = NULL, |
128 | .store_NMI_vector = NULL, | ||
129 | .inquire_remote_apic = default_inquire_remote_apic, | 148 | .inquire_remote_apic = default_inquire_remote_apic, |
149 | |||
150 | .read = native_apic_mem_read, | ||
151 | .write = native_apic_mem_write, | ||
152 | .icr_read = native_apic_icr_read, | ||
153 | .icr_write = native_apic_icr_write, | ||
154 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
155 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
130 | }; | 156 | }; |
131 | 157 | ||
132 | extern struct genapic apic_numaq; | 158 | extern struct apic apic_numaq; |
133 | extern struct genapic apic_summit; | 159 | extern struct apic apic_summit; |
134 | extern struct genapic apic_bigsmp; | 160 | extern struct apic apic_bigsmp; |
135 | extern struct genapic apic_es7000; | 161 | extern struct apic apic_es7000; |
136 | extern struct genapic apic_default; | 162 | extern struct apic apic_default; |
137 | 163 | ||
138 | struct genapic *apic = &apic_default; | 164 | struct apic *apic = &apic_default; |
165 | EXPORT_SYMBOL_GPL(apic); | ||
139 | 166 | ||
140 | static struct genapic *apic_probe[] __initdata = { | 167 | static struct apic *apic_probe[] __initdata = { |
141 | #ifdef CONFIG_X86_NUMAQ | 168 | #ifdef CONFIG_X86_NUMAQ |
142 | &apic_numaq, | 169 | &apic_numaq, |
143 | #endif | 170 | #endif |
@@ -170,8 +197,8 @@ static int __init parse_apic(char *arg) | |||
170 | } | 197 | } |
171 | } | 198 | } |
172 | 199 | ||
173 | if (x86_quirks->update_genapic) | 200 | if (x86_quirks->update_apic) |
174 | x86_quirks->update_genapic(); | 201 | x86_quirks->update_apic(); |
175 | 202 | ||
176 | /* Parsed again by __setup for debug/verbose */ | 203 | /* Parsed again by __setup for debug/verbose */ |
177 | return 0; | 204 | return 0; |
@@ -191,8 +218,8 @@ void __init generic_bigsmp_probe(void) | |||
191 | if (!cmdline_apic && apic == &apic_default) { | 218 | if (!cmdline_apic && apic == &apic_default) { |
192 | if (apic_bigsmp.probe()) { | 219 | if (apic_bigsmp.probe()) { |
193 | apic = &apic_bigsmp; | 220 | apic = &apic_bigsmp; |
194 | if (x86_quirks->update_genapic) | 221 | if (x86_quirks->update_apic) |
195 | x86_quirks->update_genapic(); | 222 | x86_quirks->update_apic(); |
196 | printk(KERN_INFO "Overriding APIC driver with %s\n", | 223 | printk(KERN_INFO "Overriding APIC driver with %s\n", |
197 | apic->name); | 224 | apic->name); |
198 | } | 225 | } |
@@ -214,8 +241,8 @@ void __init generic_apic_probe(void) | |||
214 | if (!apic_probe[i]) | 241 | if (!apic_probe[i]) |
215 | panic("Didn't find an APIC driver"); | 242 | panic("Didn't find an APIC driver"); |
216 | 243 | ||
217 | if (x86_quirks->update_genapic) | 244 | if (x86_quirks->update_apic) |
218 | x86_quirks->update_genapic(); | 245 | x86_quirks->update_apic(); |
219 | } | 246 | } |
220 | printk(KERN_INFO "Using APIC driver %s\n", apic->name); | 247 | printk(KERN_INFO "Using APIC driver %s\n", apic->name); |
221 | } | 248 | } |
@@ -235,8 +262,8 @@ generic_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) | |||
235 | 262 | ||
236 | if (!cmdline_apic) { | 263 | if (!cmdline_apic) { |
237 | apic = apic_probe[i]; | 264 | apic = apic_probe[i]; |
238 | if (x86_quirks->update_genapic) | 265 | if (x86_quirks->update_apic) |
239 | x86_quirks->update_genapic(); | 266 | x86_quirks->update_apic(); |
240 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | 267 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", |
241 | apic->name); | 268 | apic->name); |
242 | } | 269 | } |
@@ -257,8 +284,8 @@ int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | |||
257 | 284 | ||
258 | if (!cmdline_apic) { | 285 | if (!cmdline_apic) { |
259 | apic = apic_probe[i]; | 286 | apic = apic_probe[i]; |
260 | if (x86_quirks->update_genapic) | 287 | if (x86_quirks->update_apic) |
261 | x86_quirks->update_genapic(); | 288 | x86_quirks->update_apic(); |
262 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", | 289 | printk(KERN_INFO "Switched to APIC driver `%s'.\n", |
263 | apic->name); | 290 | apic->name); |
264 | } | 291 | } |
@@ -266,146 +293,3 @@ int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | |||
266 | } | 293 | } |
267 | return 0; | 294 | return 0; |
268 | } | 295 | } |
269 | |||
270 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
271 | |||
272 | /** | ||
273 | * pre_intr_init_hook - initialisation prior to setting up interrupt vectors | ||
274 | * | ||
275 | * Description: | ||
276 | * Perform any necessary interrupt initialisation prior to setting up | ||
277 | * the "ordinary" interrupt call gates. For legacy reasons, the ISA | ||
278 | * interrupts should be initialised here if the machine emulates a PC | ||
279 | * in any way. | ||
280 | **/ | ||
281 | void __init pre_intr_init_hook(void) | ||
282 | { | ||
283 | if (x86_quirks->arch_pre_intr_init) { | ||
284 | if (x86_quirks->arch_pre_intr_init()) | ||
285 | return; | ||
286 | } | ||
287 | init_ISA_irqs(); | ||
288 | } | ||
289 | |||
290 | /** | ||
291 | * intr_init_hook - post gate setup interrupt initialisation | ||
292 | * | ||
293 | * Description: | ||
294 | * Fill in any interrupts that may have been left out by the general | ||
295 | * init_IRQ() routine. interrupts having to do with the machine rather | ||
296 | * than the devices on the I/O bus (like APIC interrupts in intel MP | ||
297 | * systems) are started here. | ||
298 | **/ | ||
299 | void __init intr_init_hook(void) | ||
300 | { | ||
301 | if (x86_quirks->arch_intr_init) { | ||
302 | if (x86_quirks->arch_intr_init()) | ||
303 | return; | ||
304 | } | ||
305 | } | ||
306 | |||
307 | /** | ||
308 | * pre_setup_arch_hook - hook called prior to any setup_arch() execution | ||
309 | * | ||
310 | * Description: | ||
311 | * generally used to activate any machine specific identification | ||
312 | * routines that may be needed before setup_arch() runs. On Voyager | ||
313 | * this is used to get the board revision and type. | ||
314 | **/ | ||
315 | void __init pre_setup_arch_hook(void) | ||
316 | { | ||
317 | } | ||
318 | |||
319 | /** | ||
320 | * trap_init_hook - initialise system specific traps | ||
321 | * | ||
322 | * Description: | ||
323 | * Called as the final act of trap_init(). Used in VISWS to initialise | ||
324 | * the various board specific APIC traps. | ||
325 | **/ | ||
326 | void __init trap_init_hook(void) | ||
327 | { | ||
328 | if (x86_quirks->arch_trap_init) { | ||
329 | if (x86_quirks->arch_trap_init()) | ||
330 | return; | ||
331 | } | ||
332 | } | ||
333 | |||
334 | static struct irqaction irq0 = { | ||
335 | .handler = timer_interrupt, | ||
336 | .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL, | ||
337 | .mask = CPU_MASK_NONE, | ||
338 | .name = "timer" | ||
339 | }; | ||
340 | |||
341 | /** | ||
342 | * pre_time_init_hook - do any specific initialisations before. | ||
343 | * | ||
344 | **/ | ||
345 | void __init pre_time_init_hook(void) | ||
346 | { | ||
347 | if (x86_quirks->arch_pre_time_init) | ||
348 | x86_quirks->arch_pre_time_init(); | ||
349 | } | ||
350 | |||
351 | /** | ||
352 | * time_init_hook - do any specific initialisations for the system timer. | ||
353 | * | ||
354 | * Description: | ||
355 | * Must plug the system timer interrupt source at HZ into the IRQ listed | ||
356 | * in irq_vectors.h:TIMER_IRQ | ||
357 | **/ | ||
358 | void __init time_init_hook(void) | ||
359 | { | ||
360 | if (x86_quirks->arch_time_init) { | ||
361 | /* | ||
362 | * A nonzero return code does not mean failure, it means | ||
363 | * that the architecture quirk does not want any | ||
364 | * generic (timer) setup to be performed after this: | ||
365 | */ | ||
366 | if (x86_quirks->arch_time_init()) | ||
367 | return; | ||
368 | } | ||
369 | |||
370 | irq0.mask = cpumask_of_cpu(0); | ||
371 | setup_irq(0, &irq0); | ||
372 | } | ||
373 | |||
374 | #ifdef CONFIG_MCA | ||
375 | /** | ||
376 | * mca_nmi_hook - hook into MCA specific NMI chain | ||
377 | * | ||
378 | * Description: | ||
379 | * The MCA (Microchannel Architecture) has an NMI chain for NMI sources | ||
380 | * along the MCA bus. Use this to hook into that chain if you will need | ||
381 | * it. | ||
382 | **/ | ||
383 | void mca_nmi_hook(void) | ||
384 | { | ||
385 | /* | ||
386 | * If I recall correctly, there's a whole bunch of other things that | ||
387 | * we can do to check for NMI problems, but that's all I know about | ||
388 | * at the moment. | ||
389 | */ | ||
390 | pr_warning("NMI generated from unknown source!\n"); | ||
391 | } | ||
392 | #endif | ||
393 | |||
394 | static __init int no_ipi_broadcast(char *str) | ||
395 | { | ||
396 | get_option(&str, &no_broadcast); | ||
397 | pr_info("Using %s mode\n", | ||
398 | no_broadcast ? "No IPI Broadcast" : "IPI Broadcast"); | ||
399 | return 1; | ||
400 | } | ||
401 | __setup("no_ipi_broadcast=", no_ipi_broadcast); | ||
402 | |||
403 | static int __init print_ipi_mode(void) | ||
404 | { | ||
405 | pr_info("Using IPI %s mode\n", | ||
406 | no_broadcast ? "No-Shortcut" : "Shortcut"); | ||
407 | return 0; | ||
408 | } | ||
409 | |||
410 | late_initcall(print_ipi_mode); | ||
411 | |||
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/apic/probe_64.c index 820dea5d0ebe..e7c163661c77 100644 --- a/arch/x86/kernel/genapic_64.c +++ b/arch/x86/kernel/apic/probe_64.c | |||
@@ -19,24 +19,27 @@ | |||
19 | #include <linux/dmar.h> | 19 | #include <linux/dmar.h> |
20 | 20 | ||
21 | #include <asm/smp.h> | 21 | #include <asm/smp.h> |
22 | #include <asm/apic.h> | ||
22 | #include <asm/ipi.h> | 23 | #include <asm/ipi.h> |
23 | #include <asm/genapic.h> | ||
24 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
25 | 25 | ||
26 | extern struct genapic apic_flat; | 26 | extern struct apic apic_flat; |
27 | extern struct genapic apic_physflat; | 27 | extern struct apic apic_physflat; |
28 | extern struct genapic apic_x2xpic_uv_x; | 28 | extern struct apic apic_x2xpic_uv_x; |
29 | extern struct genapic apic_x2apic_phys; | 29 | extern struct apic apic_x2apic_phys; |
30 | extern struct genapic apic_x2apic_cluster; | 30 | extern struct apic apic_x2apic_cluster; |
31 | 31 | ||
32 | struct genapic __read_mostly *apic = &apic_flat; | 32 | struct apic __read_mostly *apic = &apic_flat; |
33 | EXPORT_SYMBOL_GPL(apic); | ||
33 | 34 | ||
34 | static struct genapic *apic_probe[] __initdata = { | 35 | static struct apic *apic_probe[] __initdata = { |
35 | #ifdef CONFIG_X86_UV | 36 | #ifdef CONFIG_X86_UV |
36 | &apic_x2apic_uv_x, | 37 | &apic_x2apic_uv_x, |
37 | #endif | 38 | #endif |
39 | #ifdef CONFIG_X86_X2APIC | ||
38 | &apic_x2apic_phys, | 40 | &apic_x2apic_phys, |
39 | &apic_x2apic_cluster, | 41 | &apic_x2apic_cluster, |
42 | #endif | ||
40 | &apic_physflat, | 43 | &apic_physflat, |
41 | NULL, | 44 | NULL, |
42 | }; | 45 | }; |
@@ -46,10 +49,19 @@ static struct genapic *apic_probe[] __initdata = { | |||
46 | */ | 49 | */ |
47 | void __init default_setup_apic_routing(void) | 50 | void __init default_setup_apic_routing(void) |
48 | { | 51 | { |
49 | if (apic == &apic_x2apic_phys || apic == &apic_x2apic_cluster) { | 52 | #ifdef CONFIG_X86_X2APIC |
50 | if (!intr_remapping_enabled) | 53 | if (x2apic && (apic != &apic_x2apic_phys && |
51 | apic = &apic_flat; | 54 | #ifdef CONFIG_X86_UV |
55 | apic != &apic_x2apic_uv_x && | ||
56 | #endif | ||
57 | apic != &apic_x2apic_cluster)) { | ||
58 | if (x2apic_phys) | ||
59 | apic = &apic_x2apic_phys; | ||
60 | else | ||
61 | apic = &apic_x2apic_cluster; | ||
62 | printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); | ||
52 | } | 63 | } |
64 | #endif | ||
53 | 65 | ||
54 | if (apic == &apic_flat) { | 66 | if (apic == &apic_flat) { |
55 | if (max_physical_apicid >= 8) | 67 | if (max_physical_apicid >= 8) |
@@ -57,8 +69,8 @@ void __init default_setup_apic_routing(void) | |||
57 | printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); | 69 | printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); |
58 | } | 70 | } |
59 | 71 | ||
60 | if (x86_quirks->update_genapic) | 72 | if (x86_quirks->update_apic) |
61 | x86_quirks->update_genapic(); | 73 | x86_quirks->update_apic(); |
62 | } | 74 | } |
63 | 75 | ||
64 | /* Same for both flat and physical. */ | 76 | /* Same for both flat and physical. */ |
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/apic/summit_32.c index 1e733eff9b33..cfe7b09015d8 100644 --- a/arch/x86/kernel/summit_32.c +++ b/arch/x86/kernel/apic/summit_32.c | |||
@@ -34,13 +34,11 @@ | |||
34 | /* | 34 | /* |
35 | * APIC driver for the IBM "Summit" chipset. | 35 | * APIC driver for the IBM "Summit" chipset. |
36 | */ | 36 | */ |
37 | #define APIC_DEFINITION 1 | ||
38 | #include <linux/threads.h> | 37 | #include <linux/threads.h> |
39 | #include <linux/cpumask.h> | 38 | #include <linux/cpumask.h> |
40 | #include <asm/mpspec.h> | 39 | #include <asm/mpspec.h> |
41 | #include <asm/apic.h> | 40 | #include <asm/apic.h> |
42 | #include <asm/smp.h> | 41 | #include <asm/smp.h> |
43 | #include <asm/genapic.h> | ||
44 | #include <asm/fixmap.h> | 42 | #include <asm/fixmap.h> |
45 | #include <asm/apicdef.h> | 43 | #include <asm/apicdef.h> |
46 | #include <asm/ipi.h> | 44 | #include <asm/ipi.h> |
@@ -209,16 +207,12 @@ static inline unsigned long summit_check_apicid_present(int bit) | |||
209 | return 1; | 207 | return 1; |
210 | } | 208 | } |
211 | 209 | ||
212 | #define apicid_cluster(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK) | ||
213 | |||
214 | extern u8 cpu_2_logical_apicid[]; | ||
215 | |||
216 | static inline void summit_init_apic_ldr(void) | 210 | static inline void summit_init_apic_ldr(void) |
217 | { | 211 | { |
218 | unsigned long val, id; | 212 | unsigned long val, id; |
219 | int count = 0; | 213 | int count = 0; |
220 | u8 my_id = (u8)hard_smp_processor_id(); | 214 | u8 my_id = (u8)hard_smp_processor_id(); |
221 | u8 my_cluster = (u8)apicid_cluster(my_id); | 215 | u8 my_cluster = APIC_CLUSTER(my_id); |
222 | #ifdef CONFIG_SMP | 216 | #ifdef CONFIG_SMP |
223 | u8 lid; | 217 | u8 lid; |
224 | int i; | 218 | int i; |
@@ -226,7 +220,7 @@ static inline void summit_init_apic_ldr(void) | |||
226 | /* Create logical APIC IDs by counting CPUs already in cluster. */ | 220 | /* Create logical APIC IDs by counting CPUs already in cluster. */ |
227 | for (count = 0, i = nr_cpu_ids; --i >= 0; ) { | 221 | for (count = 0, i = nr_cpu_ids; --i >= 0; ) { |
228 | lid = cpu_2_logical_apicid[i]; | 222 | lid = cpu_2_logical_apicid[i]; |
229 | if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) | 223 | if (lid != BAD_APICID && APIC_CLUSTER(lid) == my_cluster) |
230 | ++count; | 224 | ++count; |
231 | } | 225 | } |
232 | #endif | 226 | #endif |
@@ -266,7 +260,7 @@ static inline int summit_cpu_to_logical_apicid(int cpu) | |||
266 | #ifdef CONFIG_SMP | 260 | #ifdef CONFIG_SMP |
267 | if (cpu >= nr_cpu_ids) | 261 | if (cpu >= nr_cpu_ids) |
268 | return BAD_APICID; | 262 | return BAD_APICID; |
269 | return (int)cpu_2_logical_apicid[cpu]; | 263 | return cpu_2_logical_apicid[cpu]; |
270 | #else | 264 | #else |
271 | return logical_smp_processor_id(); | 265 | return logical_smp_processor_id(); |
272 | #endif | 266 | #endif |
@@ -323,8 +317,7 @@ static inline unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask) | |||
323 | if (cpu_isset(cpu, *cpumask)) { | 317 | if (cpu_isset(cpu, *cpumask)) { |
324 | int new_apicid = summit_cpu_to_logical_apicid(cpu); | 318 | int new_apicid = summit_cpu_to_logical_apicid(cpu); |
325 | 319 | ||
326 | if (apicid_cluster(apicid) != | 320 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { |
327 | apicid_cluster(new_apicid)) { | ||
328 | printk ("%s: Not a valid mask!\n", __func__); | 321 | printk ("%s: Not a valid mask!\n", __func__); |
329 | 322 | ||
330 | return 0xFF; | 323 | return 0xFF; |
@@ -544,7 +537,7 @@ void __init setup_summit(void) | |||
544 | } | 537 | } |
545 | #endif | 538 | #endif |
546 | 539 | ||
547 | struct genapic apic_summit = { | 540 | struct apic apic_summit = { |
548 | 541 | ||
549 | .name = "summit", | 542 | .name = "summit", |
550 | .probe = probe_summit, | 543 | .probe = probe_summit, |
@@ -597,6 +590,12 @@ struct genapic apic_summit = { | |||
597 | .wait_for_init_deassert = default_wait_for_init_deassert, | 590 | .wait_for_init_deassert = default_wait_for_init_deassert, |
598 | 591 | ||
599 | .smp_callin_clear_local_apic = NULL, | 592 | .smp_callin_clear_local_apic = NULL, |
600 | .store_NMI_vector = NULL, | ||
601 | .inquire_remote_apic = default_inquire_remote_apic, | 593 | .inquire_remote_apic = default_inquire_remote_apic, |
594 | |||
595 | .read = native_apic_mem_read, | ||
596 | .write = native_apic_mem_write, | ||
597 | .icr_read = native_apic_icr_read, | ||
598 | .icr_write = native_apic_icr_write, | ||
599 | .wait_icr_idle = native_apic_wait_icr_idle, | ||
600 | .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, | ||
602 | }; | 601 | }; |
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index 7c87156b6411..354b9c45601d 100644 --- a/arch/x86/kernel/genx2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c | |||
@@ -7,17 +7,14 @@ | |||
7 | #include <linux/dmar.h> | 7 | #include <linux/dmar.h> |
8 | 8 | ||
9 | #include <asm/smp.h> | 9 | #include <asm/smp.h> |
10 | #include <asm/apic.h> | ||
10 | #include <asm/ipi.h> | 11 | #include <asm/ipi.h> |
11 | #include <asm/genapic.h> | ||
12 | 12 | ||
13 | DEFINE_PER_CPU(u32, x86_cpu_to_logical_apicid); | 13 | DEFINE_PER_CPU(u32, x86_cpu_to_logical_apicid); |
14 | 14 | ||
15 | static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | 15 | static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
16 | { | 16 | { |
17 | if (cpu_has_x2apic) | 17 | return x2apic_enabled(); |
18 | return 1; | ||
19 | |||
20 | return 0; | ||
21 | } | 18 | } |
22 | 19 | ||
23 | /* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ | 20 | /* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ |
@@ -46,7 +43,7 @@ static void | |||
46 | /* | 43 | /* |
47 | * send the IPI. | 44 | * send the IPI. |
48 | */ | 45 | */ |
49 | x2apic_icr_write(cfg, apicid); | 46 | native_x2apic_icr_write(cfg, apicid); |
50 | } | 47 | } |
51 | 48 | ||
52 | /* | 49 | /* |
@@ -182,7 +179,7 @@ static void init_x2apic_ldr(void) | |||
182 | per_cpu(x86_cpu_to_logical_apicid, cpu) = apic_read(APIC_LDR); | 179 | per_cpu(x86_cpu_to_logical_apicid, cpu) = apic_read(APIC_LDR); |
183 | } | 180 | } |
184 | 181 | ||
185 | struct genapic apic_x2apic_cluster = { | 182 | struct apic apic_x2apic_cluster = { |
186 | 183 | ||
187 | .name = "cluster x2apic", | 184 | .name = "cluster x2apic", |
188 | .probe = NULL, | 185 | .probe = NULL, |
@@ -232,6 +229,12 @@ struct genapic apic_x2apic_cluster = { | |||
232 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | 229 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, |
233 | .wait_for_init_deassert = NULL, | 230 | .wait_for_init_deassert = NULL, |
234 | .smp_callin_clear_local_apic = NULL, | 231 | .smp_callin_clear_local_apic = NULL, |
235 | .store_NMI_vector = NULL, | ||
236 | .inquire_remote_apic = NULL, | 232 | .inquire_remote_apic = NULL, |
233 | |||
234 | .read = native_apic_msr_read, | ||
235 | .write = native_apic_msr_write, | ||
236 | .icr_read = native_x2apic_icr_read, | ||
237 | .icr_write = native_x2apic_icr_write, | ||
238 | .wait_icr_idle = native_x2apic_wait_icr_idle, | ||
239 | .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle, | ||
237 | }; | 240 | }; |
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index 5cbae8aa0408..5bcb174409bc 100644 --- a/arch/x86/kernel/genx2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c | |||
@@ -7,10 +7,10 @@ | |||
7 | #include <linux/dmar.h> | 7 | #include <linux/dmar.h> |
8 | 8 | ||
9 | #include <asm/smp.h> | 9 | #include <asm/smp.h> |
10 | #include <asm/apic.h> | ||
10 | #include <asm/ipi.h> | 11 | #include <asm/ipi.h> |
11 | #include <asm/genapic.h> | ||
12 | 12 | ||
13 | static int x2apic_phys; | 13 | int x2apic_phys; |
14 | 14 | ||
15 | static int set_x2apic_phys_mode(char *arg) | 15 | static int set_x2apic_phys_mode(char *arg) |
16 | { | 16 | { |
@@ -21,10 +21,10 @@ early_param("x2apic_phys", set_x2apic_phys_mode); | |||
21 | 21 | ||
22 | static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | 22 | static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
23 | { | 23 | { |
24 | if (cpu_has_x2apic && x2apic_phys) | 24 | if (x2apic_phys) |
25 | return 1; | 25 | return x2apic_enabled(); |
26 | 26 | else | |
27 | return 0; | 27 | return 0; |
28 | } | 28 | } |
29 | 29 | ||
30 | /* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ | 30 | /* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ |
@@ -50,7 +50,7 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, | |||
50 | /* | 50 | /* |
51 | * send the IPI. | 51 | * send the IPI. |
52 | */ | 52 | */ |
53 | x2apic_icr_write(cfg, apicid); | 53 | native_x2apic_icr_write(cfg, apicid); |
54 | } | 54 | } |
55 | 55 | ||
56 | static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) | 56 | static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector) |
@@ -168,7 +168,7 @@ static void init_x2apic_ldr(void) | |||
168 | { | 168 | { |
169 | } | 169 | } |
170 | 170 | ||
171 | struct genapic apic_x2apic_phys = { | 171 | struct apic apic_x2apic_phys = { |
172 | 172 | ||
173 | .name = "physical x2apic", | 173 | .name = "physical x2apic", |
174 | .probe = NULL, | 174 | .probe = NULL, |
@@ -218,6 +218,12 @@ struct genapic apic_x2apic_phys = { | |||
218 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | 218 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, |
219 | .wait_for_init_deassert = NULL, | 219 | .wait_for_init_deassert = NULL, |
220 | .smp_callin_clear_local_apic = NULL, | 220 | .smp_callin_clear_local_apic = NULL, |
221 | .store_NMI_vector = NULL, | ||
222 | .inquire_remote_apic = NULL, | 221 | .inquire_remote_apic = NULL, |
222 | |||
223 | .read = native_apic_msr_read, | ||
224 | .write = native_apic_msr_write, | ||
225 | .icr_read = native_x2apic_icr_read, | ||
226 | .icr_write = native_x2apic_icr_write, | ||
227 | .wait_icr_idle = native_x2apic_wait_icr_idle, | ||
228 | .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle, | ||
223 | }; | 229 | }; |
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 89b84e004f04..20b4ad07c3a1 100644 --- a/arch/x86/kernel/genx2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -22,8 +22,8 @@ | |||
22 | #include <linux/proc_fs.h> | 22 | #include <linux/proc_fs.h> |
23 | #include <asm/current.h> | 23 | #include <asm/current.h> |
24 | #include <asm/smp.h> | 24 | #include <asm/smp.h> |
25 | #include <asm/apic.h> | ||
25 | #include <asm/ipi.h> | 26 | #include <asm/ipi.h> |
26 | #include <asm/genapic.h> | ||
27 | #include <asm/pgtable.h> | 27 | #include <asm/pgtable.h> |
28 | #include <asm/uv/uv.h> | 28 | #include <asm/uv/uv.h> |
29 | #include <asm/uv/uv_mmrs.h> | 29 | #include <asm/uv/uv_mmrs.h> |
@@ -240,7 +240,7 @@ static void uv_send_IPI_self(int vector) | |||
240 | apic_write(APIC_SELF_IPI, vector); | 240 | apic_write(APIC_SELF_IPI, vector); |
241 | } | 241 | } |
242 | 242 | ||
243 | struct genapic apic_x2apic_uv_x = { | 243 | struct apic apic_x2apic_uv_x = { |
244 | 244 | ||
245 | .name = "UV large system", | 245 | .name = "UV large system", |
246 | .probe = NULL, | 246 | .probe = NULL, |
@@ -290,8 +290,14 @@ struct genapic apic_x2apic_uv_x = { | |||
290 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, | 290 | .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, |
291 | .wait_for_init_deassert = NULL, | 291 | .wait_for_init_deassert = NULL, |
292 | .smp_callin_clear_local_apic = NULL, | 292 | .smp_callin_clear_local_apic = NULL, |
293 | .store_NMI_vector = NULL, | ||
294 | .inquire_remote_apic = NULL, | 293 | .inquire_remote_apic = NULL, |
294 | |||
295 | .read = native_apic_msr_read, | ||
296 | .write = native_apic_msr_write, | ||
297 | .icr_read = native_x2apic_icr_read, | ||
298 | .icr_write = native_x2apic_icr_write, | ||
299 | .wait_icr_idle = native_x2apic_wait_icr_idle, | ||
300 | .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle, | ||
295 | }; | 301 | }; |
296 | 302 | ||
297 | static __cpuinit void set_x2apic_extra_bits(int pnode) | 303 | static __cpuinit void set_x2apic_extra_bits(int pnode) |
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index 37ba5f85b718..10033fe718e0 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
@@ -1192,6 +1192,7 @@ static int suspend(int vetoable) | |||
1192 | device_suspend(PMSG_SUSPEND); | 1192 | device_suspend(PMSG_SUSPEND); |
1193 | local_irq_disable(); | 1193 | local_irq_disable(); |
1194 | device_power_down(PMSG_SUSPEND); | 1194 | device_power_down(PMSG_SUSPEND); |
1195 | sysdev_suspend(PMSG_SUSPEND); | ||
1195 | 1196 | ||
1196 | local_irq_enable(); | 1197 | local_irq_enable(); |
1197 | 1198 | ||
@@ -1208,6 +1209,7 @@ static int suspend(int vetoable) | |||
1208 | if (err != APM_SUCCESS) | 1209 | if (err != APM_SUCCESS) |
1209 | apm_error("suspend", err); | 1210 | apm_error("suspend", err); |
1210 | err = (err == APM_SUCCESS) ? 0 : -EIO; | 1211 | err = (err == APM_SUCCESS) ? 0 : -EIO; |
1212 | sysdev_resume(); | ||
1211 | device_power_up(PMSG_RESUME); | 1213 | device_power_up(PMSG_RESUME); |
1212 | local_irq_enable(); | 1214 | local_irq_enable(); |
1213 | device_resume(PMSG_RESUME); | 1215 | device_resume(PMSG_RESUME); |
@@ -1228,6 +1230,7 @@ static void standby(void) | |||
1228 | 1230 | ||
1229 | local_irq_disable(); | 1231 | local_irq_disable(); |
1230 | device_power_down(PMSG_SUSPEND); | 1232 | device_power_down(PMSG_SUSPEND); |
1233 | sysdev_suspend(PMSG_SUSPEND); | ||
1231 | local_irq_enable(); | 1234 | local_irq_enable(); |
1232 | 1235 | ||
1233 | err = set_system_power_state(APM_STATE_STANDBY); | 1236 | err = set_system_power_state(APM_STATE_STANDBY); |
@@ -1235,6 +1238,7 @@ static void standby(void) | |||
1235 | apm_error("standby", err); | 1238 | apm_error("standby", err); |
1236 | 1239 | ||
1237 | local_irq_disable(); | 1240 | local_irq_disable(); |
1241 | sysdev_resume(); | ||
1238 | device_power_up(PMSG_RESUME); | 1242 | device_power_up(PMSG_RESUME); |
1239 | local_irq_enable(); | 1243 | local_irq_enable(); |
1240 | } | 1244 | } |
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index e48640cfac0c..6882a735d9c0 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <asm/pat.h> | 7 | #include <asm/pat.h> |
8 | #include <asm/processor.h> | 8 | #include <asm/processor.h> |
9 | 9 | ||
10 | #include <asm/genapic.h> | 10 | #include <asm/apic.h> |
11 | 11 | ||
12 | struct cpuid_bit { | 12 | struct cpuid_bit { |
13 | u16 feature; | 13 | u16 feature; |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index ff4d7b9e32e4..25423a5b80ed 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -12,8 +12,6 @@ | |||
12 | # include <asm/cacheflush.h> | 12 | # include <asm/cacheflush.h> |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #include <asm/genapic.h> | ||
16 | |||
17 | #include "cpu.h" | 15 | #include "cpu.h" |
18 | 16 | ||
19 | #ifdef CONFIG_X86_32 | 17 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 4db150ed446d..826d5c876278 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -23,11 +23,9 @@ | |||
23 | #include <asm/smp.h> | 23 | #include <asm/smp.h> |
24 | #include <asm/cpu.h> | 24 | #include <asm/cpu.h> |
25 | #include <asm/cpumask.h> | 25 | #include <asm/cpumask.h> |
26 | #ifdef CONFIG_X86_LOCAL_APIC | ||
27 | #include <asm/mpspec.h> | ||
28 | #include <asm/apic.h> | 26 | #include <asm/apic.h> |
29 | #include <asm/genapic.h> | 27 | |
30 | #include <asm/genapic.h> | 28 | #ifdef CONFIG_X86_LOCAL_APIC |
31 | #include <asm/uv/uv.h> | 29 | #include <asm/uv/uv.h> |
32 | #endif | 30 | #endif |
33 | 31 | ||
@@ -1051,7 +1049,7 @@ void __cpuinit cpu_init(void) | |||
1051 | barrier(); | 1049 | barrier(); |
1052 | 1050 | ||
1053 | check_efer(); | 1051 | check_efer(); |
1054 | if (cpu != 0 && x2apic) | 1052 | if (cpu != 0) |
1055 | enable_x2apic(); | 1053 | enable_x2apic(); |
1056 | 1054 | ||
1057 | /* | 1055 | /* |
diff --git a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c index c2f930d86640..41ab3f064cb1 100644 --- a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c +++ b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c | |||
@@ -204,12 +204,12 @@ static int eps_cpu_init(struct cpufreq_policy *policy) | |||
204 | } | 204 | } |
205 | /* Enable Enhanced PowerSaver */ | 205 | /* Enable Enhanced PowerSaver */ |
206 | rdmsrl(MSR_IA32_MISC_ENABLE, val); | 206 | rdmsrl(MSR_IA32_MISC_ENABLE, val); |
207 | if (!(val & 1 << 16)) { | 207 | if (!(val & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP)) { |
208 | val |= 1 << 16; | 208 | val |= MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP; |
209 | wrmsrl(MSR_IA32_MISC_ENABLE, val); | 209 | wrmsrl(MSR_IA32_MISC_ENABLE, val); |
210 | /* Can be locked at 0 */ | 210 | /* Can be locked at 0 */ |
211 | rdmsrl(MSR_IA32_MISC_ENABLE, val); | 211 | rdmsrl(MSR_IA32_MISC_ENABLE, val); |
212 | if (!(val & 1 << 16)) { | 212 | if (!(val & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP)) { |
213 | printk(KERN_INFO "eps: Can't enable Enhanced PowerSaver\n"); | 213 | printk(KERN_INFO "eps: Can't enable Enhanced PowerSaver\n"); |
214 | return -ENODEV; | 214 | return -ENODEV; |
215 | } | 215 | } |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c index fb039cd345d8..6428aa17b40e 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -1157,8 +1157,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1157 | data->cpu = pol->cpu; | 1157 | data->cpu = pol->cpu; |
1158 | data->currpstate = HW_PSTATE_INVALID; | 1158 | data->currpstate = HW_PSTATE_INVALID; |
1159 | 1159 | ||
1160 | rc = powernow_k8_cpu_init_acpi(data); | 1160 | if (powernow_k8_cpu_init_acpi(data)) { |
1161 | if (rc) { | ||
1162 | /* | 1161 | /* |
1163 | * Use the PSB BIOS structure. This is only availabe on | 1162 | * Use the PSB BIOS structure. This is only availabe on |
1164 | * an UP version, and is deprecated by AMD. | 1163 | * an UP version, and is deprecated by AMD. |
@@ -1176,17 +1175,20 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1176 | "ACPI maintainers and complain to your BIOS " | 1175 | "ACPI maintainers and complain to your BIOS " |
1177 | "vendor.\n"); | 1176 | "vendor.\n"); |
1178 | #endif | 1177 | #endif |
1179 | goto err_out; | 1178 | kfree(data); |
1179 | return -ENODEV; | ||
1180 | } | 1180 | } |
1181 | if (pol->cpu != 0) { | 1181 | if (pol->cpu != 0) { |
1182 | printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for " | 1182 | printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for " |
1183 | "CPU other than CPU0. Complain to your BIOS " | 1183 | "CPU other than CPU0. Complain to your BIOS " |
1184 | "vendor.\n"); | 1184 | "vendor.\n"); |
1185 | goto err_out; | 1185 | kfree(data); |
1186 | return -ENODEV; | ||
1186 | } | 1187 | } |
1187 | rc = find_psb_table(data); | 1188 | rc = find_psb_table(data); |
1188 | if (rc) { | 1189 | if (rc) { |
1189 | goto err_out; | 1190 | kfree(data); |
1191 | return -ENODEV; | ||
1190 | } | 1192 | } |
1191 | /* Take a crude guess here. | 1193 | /* Take a crude guess here. |
1192 | * That guess was in microseconds, so multiply with 1000 */ | 1194 | * That guess was in microseconds, so multiply with 1000 */ |
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c index f08998278a3a..c9f1fdc02830 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c | |||
@@ -390,14 +390,14 @@ static int centrino_cpu_init(struct cpufreq_policy *policy) | |||
390 | enable it if not. */ | 390 | enable it if not. */ |
391 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | 391 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); |
392 | 392 | ||
393 | if (!(l & (1<<16))) { | 393 | if (!(l & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP)) { |
394 | l |= (1<<16); | 394 | l |= MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP; |
395 | dprintk("trying to enable Enhanced SpeedStep (%x)\n", l); | 395 | dprintk("trying to enable Enhanced SpeedStep (%x)\n", l); |
396 | wrmsr(MSR_IA32_MISC_ENABLE, l, h); | 396 | wrmsr(MSR_IA32_MISC_ENABLE, l, h); |
397 | 397 | ||
398 | /* check to see if it stuck */ | 398 | /* check to see if it stuck */ |
399 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | 399 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); |
400 | if (!(l & (1<<16))) { | 400 | if (!(l & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP)) { |
401 | printk(KERN_INFO PFX | 401 | printk(KERN_INFO PFX |
402 | "couldn't enable Enhanced SpeedStep\n"); | 402 | "couldn't enable Enhanced SpeedStep\n"); |
403 | return -ENODEV; | 403 | return -ENODEV; |
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 1f137a87d4bd..25c559ba8d54 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #ifdef CONFIG_X86_LOCAL_APIC | 24 | #ifdef CONFIG_X86_LOCAL_APIC |
25 | #include <asm/mpspec.h> | 25 | #include <asm/mpspec.h> |
26 | #include <asm/apic.h> | 26 | #include <asm/apic.h> |
27 | #include <asm/genapic.h> | ||
28 | #endif | 27 | #endif |
29 | 28 | ||
30 | static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) | 29 | static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) |
@@ -147,10 +146,10 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) | |||
147 | */ | 146 | */ |
148 | if ((c->x86 == 15) && (c->x86_model == 1) && (c->x86_mask == 1)) { | 147 | if ((c->x86 == 15) && (c->x86_model == 1) && (c->x86_mask == 1)) { |
149 | rdmsr(MSR_IA32_MISC_ENABLE, lo, hi); | 148 | rdmsr(MSR_IA32_MISC_ENABLE, lo, hi); |
150 | if ((lo & (1<<9)) == 0) { | 149 | if ((lo & MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE) == 0) { |
151 | printk (KERN_INFO "CPU: C0 stepping P4 Xeon detected.\n"); | 150 | printk (KERN_INFO "CPU: C0 stepping P4 Xeon detected.\n"); |
152 | printk (KERN_INFO "CPU: Disabling hardware prefetching (Errata 037)\n"); | 151 | printk (KERN_INFO "CPU: Disabling hardware prefetching (Errata 037)\n"); |
153 | lo |= (1<<9); /* Disable hw prefetching */ | 152 | lo |= MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE; |
154 | wrmsr (MSR_IA32_MISC_ENABLE, lo, hi); | 153 | wrmsr (MSR_IA32_MISC_ENABLE, lo, hi); |
155 | } | 154 | } |
156 | } | 155 | } |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c index 1c838032fd37..fe79985ce0f2 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_64.c | |||
@@ -295,11 +295,11 @@ void do_machine_check(struct pt_regs * regs, long error_code) | |||
295 | * If we know that the error was in user space, send a | 295 | * If we know that the error was in user space, send a |
296 | * SIGBUS. Otherwise, panic if tolerance is low. | 296 | * SIGBUS. Otherwise, panic if tolerance is low. |
297 | * | 297 | * |
298 | * do_exit() takes an awful lot of locks and has a slight | 298 | * force_sig() takes an awful lot of locks and has a slight |
299 | * risk of deadlocking. | 299 | * risk of deadlocking. |
300 | */ | 300 | */ |
301 | if (user_space) { | 301 | if (user_space) { |
302 | do_exit(SIGBUS); | 302 | force_sig(SIGBUS, current); |
303 | } else if (panic_on_oops || tolerant < 2) { | 303 | } else if (panic_on_oops || tolerant < 2) { |
304 | mce_panic("Uncorrected machine check", | 304 | mce_panic("Uncorrected machine check", |
305 | &panicm, mcestart); | 305 | &panicm, mcestart); |
@@ -490,7 +490,7 @@ static void __cpuinit mce_cpu_quirks(struct cpuinfo_x86 *c) | |||
490 | 490 | ||
491 | } | 491 | } |
492 | 492 | ||
493 | static void __cpuinit mce_cpu_features(struct cpuinfo_x86 *c) | 493 | static void mce_cpu_features(struct cpuinfo_x86 *c) |
494 | { | 494 | { |
495 | switch (c->x86_vendor) { | 495 | switch (c->x86_vendor) { |
496 | case X86_VENDOR_INTEL: | 496 | case X86_VENDOR_INTEL: |
@@ -734,6 +734,7 @@ __setup("mce=", mcheck_enable); | |||
734 | static int mce_resume(struct sys_device *dev) | 734 | static int mce_resume(struct sys_device *dev) |
735 | { | 735 | { |
736 | mce_init(NULL); | 736 | mce_init(NULL); |
737 | mce_cpu_features(¤t_cpu_data); | ||
737 | return 0; | 738 | return 0; |
738 | } | 739 | } |
739 | 740 | ||
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c index 4772e91e8246..9817506dd469 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c | |||
@@ -121,7 +121,7 @@ static long threshold_restart_bank(void *_tr) | |||
121 | } | 121 | } |
122 | 122 | ||
123 | /* cpu init entry point, called from mce.c with preempt off */ | 123 | /* cpu init entry point, called from mce.c with preempt off */ |
124 | void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c) | 124 | void mce_amd_feature_init(struct cpuinfo_x86 *c) |
125 | { | 125 | { |
126 | unsigned int bank, block; | 126 | unsigned int bank, block; |
127 | unsigned int cpu = smp_processor_id(); | 127 | unsigned int cpu = smp_processor_id(); |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c index 5e8c79e748a6..aa5e287c98e0 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c | |||
@@ -31,7 +31,7 @@ asmlinkage void smp_thermal_interrupt(void) | |||
31 | irq_exit(); | 31 | irq_exit(); |
32 | } | 32 | } |
33 | 33 | ||
34 | static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c) | 34 | static void intel_init_thermal(struct cpuinfo_x86 *c) |
35 | { | 35 | { |
36 | u32 l, h; | 36 | u32 l, h; |
37 | int tm2 = 0; | 37 | int tm2 = 0; |
@@ -49,13 +49,13 @@ static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c) | |||
49 | */ | 49 | */ |
50 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | 50 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); |
51 | h = apic_read(APIC_LVTTHMR); | 51 | h = apic_read(APIC_LVTTHMR); |
52 | if ((l & (1 << 3)) && (h & APIC_DM_SMI)) { | 52 | if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) { |
53 | printk(KERN_DEBUG | 53 | printk(KERN_DEBUG |
54 | "CPU%d: Thermal monitoring handled by SMI\n", cpu); | 54 | "CPU%d: Thermal monitoring handled by SMI\n", cpu); |
55 | return; | 55 | return; |
56 | } | 56 | } |
57 | 57 | ||
58 | if (cpu_has(c, X86_FEATURE_TM2) && (l & (1 << 13))) | 58 | if (cpu_has(c, X86_FEATURE_TM2) && (l & MSR_IA32_MISC_ENABLE_TM2)) |
59 | tm2 = 1; | 59 | tm2 = 1; |
60 | 60 | ||
61 | if (h & APIC_VECTOR_MASK) { | 61 | if (h & APIC_VECTOR_MASK) { |
@@ -73,7 +73,7 @@ static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c) | |||
73 | wrmsr(MSR_IA32_THERM_INTERRUPT, l | 0x03, h); | 73 | wrmsr(MSR_IA32_THERM_INTERRUPT, l | 0x03, h); |
74 | 74 | ||
75 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | 75 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); |
76 | wrmsr(MSR_IA32_MISC_ENABLE, l | (1 << 3), h); | 76 | wrmsr(MSR_IA32_MISC_ENABLE, l | MSR_IA32_MISC_ENABLE_TM1, h); |
77 | 77 | ||
78 | l = apic_read(APIC_LVTTHMR); | 78 | l = apic_read(APIC_LVTTHMR); |
79 | apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); | 79 | apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); |
@@ -85,7 +85,7 @@ static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c) | |||
85 | return; | 85 | return; |
86 | } | 86 | } |
87 | 87 | ||
88 | void __cpuinit mce_intel_feature_init(struct cpuinfo_x86 *c) | 88 | void mce_intel_feature_init(struct cpuinfo_x86 *c) |
89 | { | 89 | { |
90 | intel_init_thermal(c); | 90 | intel_init_thermal(c); |
91 | } | 91 | } |
diff --git a/arch/x86/kernel/cpu/mcheck/p4.c b/arch/x86/kernel/cpu/mcheck/p4.c index 9b60fce09f75..f53bdcbaf382 100644 --- a/arch/x86/kernel/cpu/mcheck/p4.c +++ b/arch/x86/kernel/cpu/mcheck/p4.c | |||
@@ -85,7 +85,7 @@ static void intel_init_thermal(struct cpuinfo_x86 *c) | |||
85 | */ | 85 | */ |
86 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | 86 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); |
87 | h = apic_read(APIC_LVTTHMR); | 87 | h = apic_read(APIC_LVTTHMR); |
88 | if ((l & (1<<3)) && (h & APIC_DM_SMI)) { | 88 | if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) { |
89 | printk(KERN_DEBUG "CPU%d: Thermal monitoring handled by SMI\n", | 89 | printk(KERN_DEBUG "CPU%d: Thermal monitoring handled by SMI\n", |
90 | cpu); | 90 | cpu); |
91 | return; /* -EBUSY */ | 91 | return; /* -EBUSY */ |
@@ -111,7 +111,7 @@ static void intel_init_thermal(struct cpuinfo_x86 *c) | |||
111 | vendor_thermal_interrupt = intel_thermal_interrupt; | 111 | vendor_thermal_interrupt = intel_thermal_interrupt; |
112 | 112 | ||
113 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | 113 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); |
114 | wrmsr(MSR_IA32_MISC_ENABLE, l | (1<<3), h); | 114 | wrmsr(MSR_IA32_MISC_ENABLE, l | MSR_IA32_MISC_ENABLE_TM1, h); |
115 | 115 | ||
116 | l = apic_read(APIC_LVTTHMR); | 116 | l = apic_read(APIC_LVTTHMR); |
117 | apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); | 117 | apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); |
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c index 9abd48b22674..f6c70a164e32 100644 --- a/arch/x86/kernel/cpu/perfctr-watchdog.c +++ b/arch/x86/kernel/cpu/perfctr-watchdog.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/nmi.h> | 19 | #include <linux/nmi.h> |
20 | #include <linux/kprobes.h> | 20 | #include <linux/kprobes.h> |
21 | 21 | ||
22 | #include <asm/apic.h> | 22 | #include <asm/genapic.h> |
23 | #include <asm/intel_arch_perfmon.h> | 23 | #include <asm/intel_arch_perfmon.h> |
24 | 24 | ||
25 | struct nmi_watchdog_ctlblk { | 25 | struct nmi_watchdog_ctlblk { |
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index ad7f2a696f4a..ff958248e61d 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c | |||
@@ -28,8 +28,6 @@ | |||
28 | #include <asm/reboot.h> | 28 | #include <asm/reboot.h> |
29 | #include <asm/virtext.h> | 29 | #include <asm/virtext.h> |
30 | 30 | ||
31 | #include <asm/genapic.h> | ||
32 | |||
33 | 31 | ||
34 | #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) | 32 | #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) |
35 | 33 | ||
diff --git a/arch/x86/kernel/efi_stub_32.S b/arch/x86/kernel/efi_stub_32.S index a206b9469296..fbe66e626c09 100644 --- a/arch/x86/kernel/efi_stub_32.S +++ b/arch/x86/kernel/efi_stub_32.S | |||
@@ -6,7 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/linkage.h> | 8 | #include <linux/linkage.h> |
9 | #include <asm/page.h> | 9 | #include <asm/page_types.h> |
10 | 10 | ||
11 | /* | 11 | /* |
12 | * efi_call_phys(void *, ...) is a function with variable parameters. | 12 | * efi_call_phys(void *, ...) is a function with variable parameters. |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index e99206831459..899e8938e79f 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -47,7 +47,7 @@ | |||
47 | #include <asm/errno.h> | 47 | #include <asm/errno.h> |
48 | #include <asm/segment.h> | 48 | #include <asm/segment.h> |
49 | #include <asm/smp.h> | 49 | #include <asm/smp.h> |
50 | #include <asm/page.h> | 50 | #include <asm/page_types.h> |
51 | #include <asm/desc.h> | 51 | #include <asm/desc.h> |
52 | #include <asm/percpu.h> | 52 | #include <asm/percpu.h> |
53 | #include <asm/dwarf2.h> | 53 | #include <asm/dwarf2.h> |
@@ -1359,7 +1359,7 @@ nmi_espfix_stack: | |||
1359 | CFI_ADJUST_CFA_OFFSET 4 | 1359 | CFI_ADJUST_CFA_OFFSET 4 |
1360 | pushl %esp | 1360 | pushl %esp |
1361 | CFI_ADJUST_CFA_OFFSET 4 | 1361 | CFI_ADJUST_CFA_OFFSET 4 |
1362 | addw $4, (%esp) | 1362 | addl $4, (%esp) |
1363 | /* copy the iret frame of 12 bytes */ | 1363 | /* copy the iret frame of 12 bytes */ |
1364 | .rept 3 | 1364 | .rept 3 |
1365 | pushl 16(%esp) | 1365 | pushl 16(%esp) |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 8a6c7c63885f..83d1836b9467 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -48,7 +48,7 @@ | |||
48 | #include <asm/unistd.h> | 48 | #include <asm/unistd.h> |
49 | #include <asm/thread_info.h> | 49 | #include <asm/thread_info.h> |
50 | #include <asm/hw_irq.h> | 50 | #include <asm/hw_irq.h> |
51 | #include <asm/page.h> | 51 | #include <asm/page_types.h> |
52 | #include <asm/irqflags.h> | 52 | #include <asm/irqflags.h> |
53 | #include <asm/paravirt.h> | 53 | #include <asm/paravirt.h> |
54 | #include <asm/ftrace.h> | 54 | #include <asm/ftrace.h> |
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index 2a0aad7718d5..c32ca19d591a 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -11,8 +11,8 @@ | |||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/linkage.h> | 12 | #include <linux/linkage.h> |
13 | #include <asm/segment.h> | 13 | #include <asm/segment.h> |
14 | #include <asm/page.h> | 14 | #include <asm/page_types.h> |
15 | #include <asm/pgtable.h> | 15 | #include <asm/pgtable_types.h> |
16 | #include <asm/desc.h> | 16 | #include <asm/desc.h> |
17 | #include <asm/cache.h> | 17 | #include <asm/cache.h> |
18 | #include <asm/thread_info.h> | 18 | #include <asm/thread_info.h> |
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c index 11d5093eb281..df89102bef80 100644 --- a/arch/x86/kernel/i8259.c +++ b/arch/x86/kernel/i8259.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <asm/pgtable.h> | 22 | #include <asm/pgtable.h> |
23 | #include <asm/desc.h> | 23 | #include <asm/desc.h> |
24 | #include <asm/apic.h> | 24 | #include <asm/apic.h> |
25 | #include <asm/arch_hooks.h> | ||
26 | #include <asm/i8259.h> | 25 | #include <asm/i8259.h> |
27 | 26 | ||
28 | /* | 27 | /* |
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c index 4beb9a13873d..9dc6b2b24275 100644 --- a/arch/x86/kernel/irq_32.c +++ b/arch/x86/kernel/irq_32.c | |||
@@ -212,7 +212,6 @@ bool handle_irq(unsigned irq, struct pt_regs *regs) | |||
212 | } | 212 | } |
213 | 213 | ||
214 | #ifdef CONFIG_HOTPLUG_CPU | 214 | #ifdef CONFIG_HOTPLUG_CPU |
215 | #include <asm/genapic.h> | ||
216 | 215 | ||
217 | /* A cpu has been removed from cpu_online_mask. Reset irq affinities. */ | 216 | /* A cpu has been removed from cpu_online_mask. Reset irq affinities. */ |
218 | void fixup_irqs(void) | 217 | void fixup_irqs(void) |
diff --git a/arch/x86/kernel/irqinit_32.c b/arch/x86/kernel/irqinit_32.c index bf629cadec1a..50b8c3a3006c 100644 --- a/arch/x86/kernel/irqinit_32.c +++ b/arch/x86/kernel/irqinit_32.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <asm/pgtable.h> | 18 | #include <asm/pgtable.h> |
19 | #include <asm/desc.h> | 19 | #include <asm/desc.h> |
20 | #include <asm/apic.h> | 20 | #include <asm/apic.h> |
21 | #include <asm/arch_hooks.h> | 21 | #include <asm/setup.h> |
22 | #include <asm/i8259.h> | 22 | #include <asm/i8259.h> |
23 | #include <asm/traps.h> | 23 | #include <asm/traps.h> |
24 | 24 | ||
@@ -127,8 +127,8 @@ void __init native_init_IRQ(void) | |||
127 | { | 127 | { |
128 | int i; | 128 | int i; |
129 | 129 | ||
130 | /* all the set up before the call gates are initialised */ | 130 | /* Execute any quirks before the call gates are initialised: */ |
131 | pre_intr_init_hook(); | 131 | x86_quirk_pre_intr_init(); |
132 | 132 | ||
133 | /* | 133 | /* |
134 | * Cover the whole vector space, no vector can escape | 134 | * Cover the whole vector space, no vector can escape |
@@ -188,10 +188,11 @@ void __init native_init_IRQ(void) | |||
188 | if (!acpi_ioapic) | 188 | if (!acpi_ioapic) |
189 | setup_irq(2, &irq2); | 189 | setup_irq(2, &irq2); |
190 | 190 | ||
191 | /* setup after call gates are initialised (usually add in | 191 | /* |
192 | * the architecture specific gates) | 192 | * Call quirks after call gates are initialised (usually add in |
193 | * the architecture specific gates): | ||
193 | */ | 194 | */ |
194 | intr_init_hook(); | 195 | x86_quirk_intr_init(); |
195 | 196 | ||
196 | /* | 197 | /* |
197 | * External FPU? Set up irq13 if so, for | 198 | * External FPU? Set up irq13 if so, for |
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c index 5c4f55483849..eedfaebe1063 100644 --- a/arch/x86/kernel/kgdb.c +++ b/arch/x86/kernel/kgdb.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <asm/apicdef.h> | 46 | #include <asm/apicdef.h> |
47 | #include <asm/system.h> | 47 | #include <asm/system.h> |
48 | 48 | ||
49 | #include <asm/genapic.h> | 49 | #include <asm/apic.h> |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * Put the error code here just in case the user cares: | 52 | * Put the error code here just in case the user cares: |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 652fce6d2cce..137f2e8132df 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/clocksource.h> | 19 | #include <linux/clocksource.h> |
20 | #include <linux/kvm_para.h> | 20 | #include <linux/kvm_para.h> |
21 | #include <asm/pvclock.h> | 21 | #include <asm/pvclock.h> |
22 | #include <asm/arch_hooks.h> | ||
23 | #include <asm/msr.h> | 22 | #include <asm/msr.h> |
24 | #include <asm/apic.h> | 23 | #include <asm/apic.h> |
25 | #include <linux/percpu.h> | 24 | #include <linux/percpu.h> |
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c index 37f420018a41..f5fc8c781a62 100644 --- a/arch/x86/kernel/machine_kexec_32.c +++ b/arch/x86/kernel/machine_kexec_32.c | |||
@@ -121,7 +121,7 @@ static void machine_kexec_page_table_set_one( | |||
121 | static void machine_kexec_prepare_page_tables(struct kimage *image) | 121 | static void machine_kexec_prepare_page_tables(struct kimage *image) |
122 | { | 122 | { |
123 | void *control_page; | 123 | void *control_page; |
124 | pmd_t *pmd = 0; | 124 | pmd_t *pmd = NULL; |
125 | 125 | ||
126 | control_page = page_address(image->control_code_page); | 126 | control_page = page_address(image->control_code_page); |
127 | #ifdef CONFIG_X86_PAE | 127 | #ifdef CONFIG_X86_PAE |
diff --git a/arch/x86/kernel/mca_32.c b/arch/x86/kernel/mca_32.c index 2dc183758be3..845d80ce1ef1 100644 --- a/arch/x86/kernel/mca_32.c +++ b/arch/x86/kernel/mca_32.c | |||
@@ -51,7 +51,6 @@ | |||
51 | #include <linux/ioport.h> | 51 | #include <linux/ioport.h> |
52 | #include <asm/uaccess.h> | 52 | #include <asm/uaccess.h> |
53 | #include <linux/init.h> | 53 | #include <linux/init.h> |
54 | #include <asm/arch_hooks.h> | ||
55 | 54 | ||
56 | static unsigned char which_scsi; | 55 | static unsigned char which_scsi; |
57 | 56 | ||
@@ -474,6 +473,4 @@ void __kprobes mca_handle_nmi(void) | |||
474 | * adapter was responsible for the error. | 473 | * adapter was responsible for the error. |
475 | */ | 474 | */ |
476 | bus_for_each_dev(&mca_bus_type, NULL, NULL, mca_handle_nmi_callback); | 475 | bus_for_each_dev(&mca_bus_type, NULL, NULL, mca_handle_nmi_callback); |
477 | 476 | } | |
478 | mca_nmi_hook(); | ||
479 | } /* mca_handle_nmi */ | ||
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 200764453195..37cb1bda1baf 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <asm/setup.h> | 29 | #include <asm/setup.h> |
30 | #include <asm/smp.h> | 30 | #include <asm/smp.h> |
31 | 31 | ||
32 | #include <asm/genapic.h> | 32 | #include <asm/apic.h> |
33 | /* | 33 | /* |
34 | * Checksum an MP configuration block. | 34 | * Checksum an MP configuration block. |
35 | */ | 35 | */ |
@@ -710,13 +710,22 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, | |||
710 | * of physical memory; so that simply reserving | 710 | * of physical memory; so that simply reserving |
711 | * PAGE_SIZE from mpf->physptr yields BUG() | 711 | * PAGE_SIZE from mpf->physptr yields BUG() |
712 | * in reserve_bootmem. | 712 | * in reserve_bootmem. |
713 | * also need to make sure physptr is below than | ||
714 | * max_low_pfn | ||
715 | * we don't need reserve the area above max_low_pfn | ||
713 | */ | 716 | */ |
714 | unsigned long end = max_low_pfn * PAGE_SIZE; | 717 | unsigned long end = max_low_pfn * PAGE_SIZE; |
715 | if (mpf->physptr + size > end) | 718 | |
716 | size = end - mpf->physptr; | 719 | if (mpf->physptr < end) { |
717 | #endif | 720 | if (mpf->physptr + size > end) |
721 | size = end - mpf->physptr; | ||
722 | reserve_bootmem_generic(mpf->physptr, size, | ||
723 | BOOTMEM_DEFAULT); | ||
724 | } | ||
725 | #else | ||
718 | reserve_bootmem_generic(mpf->physptr, size, | 726 | reserve_bootmem_generic(mpf->physptr, size, |
719 | BOOTMEM_DEFAULT); | 727 | BOOTMEM_DEFAULT); |
728 | #endif | ||
720 | } | 729 | } |
721 | 730 | ||
722 | return 1; | 731 | return 1; |
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 6dc4dca255e4..63dd358d8ee1 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <asm/paravirt.h> | 28 | #include <asm/paravirt.h> |
29 | #include <asm/desc.h> | 29 | #include <asm/desc.h> |
30 | #include <asm/setup.h> | 30 | #include <asm/setup.h> |
31 | #include <asm/arch_hooks.h> | ||
32 | #include <asm/pgtable.h> | 31 | #include <asm/pgtable.h> |
33 | #include <asm/time.h> | 32 | #include <asm/time.h> |
34 | #include <asm/pgalloc.h> | 33 | #include <asm/pgalloc.h> |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index fec79ad85dc6..646da41a620a 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -111,9 +111,6 @@ void cpu_idle(void) | |||
111 | check_pgt_cache(); | 111 | check_pgt_cache(); |
112 | rmb(); | 112 | rmb(); |
113 | 113 | ||
114 | if (rcu_pending(cpu)) | ||
115 | rcu_check_callbacks(cpu, 0); | ||
116 | |||
117 | if (cpu_is_offline(cpu)) | 114 | if (cpu_is_offline(cpu)) |
118 | play_dead(); | 115 | play_dead(); |
119 | 116 | ||
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index d2f7cd5b2c83..fb2159a5c817 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -268,7 +268,7 @@ static unsigned long debugreg_addr_limit(struct task_struct *task) | |||
268 | if (test_tsk_thread_flag(task, TIF_IA32)) | 268 | if (test_tsk_thread_flag(task, TIF_IA32)) |
269 | return IA32_PAGE_OFFSET - 3; | 269 | return IA32_PAGE_OFFSET - 3; |
270 | #endif | 270 | #endif |
271 | return TASK_SIZE64 - 7; | 271 | return TASK_SIZE_MAX - 7; |
272 | } | 272 | } |
273 | 273 | ||
274 | #endif /* CONFIG_X86_32 */ | 274 | #endif /* CONFIG_X86_32 */ |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 32e8f0af292c..1cc18d439bbb 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -24,8 +24,6 @@ | |||
24 | # include <asm/iommu.h> | 24 | # include <asm/iommu.h> |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include <asm/genapic.h> | ||
28 | |||
29 | /* | 27 | /* |
30 | * Power off function, if any | 28 | * Power off function, if any |
31 | */ | 29 | */ |
diff --git a/arch/x86/kernel/relocate_kernel_32.S b/arch/x86/kernel/relocate_kernel_32.S index a160f3119725..2064d0aa8d28 100644 --- a/arch/x86/kernel/relocate_kernel_32.S +++ b/arch/x86/kernel/relocate_kernel_32.S | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/linkage.h> | 9 | #include <linux/linkage.h> |
10 | #include <asm/page.h> | 10 | #include <asm/page_types.h> |
11 | #include <asm/kexec.h> | 11 | #include <asm/kexec.h> |
12 | #include <asm/processor-flags.h> | 12 | #include <asm/processor-flags.h> |
13 | 13 | ||
diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S index b0bbdd4829c9..d32cfb27a479 100644 --- a/arch/x86/kernel/relocate_kernel_64.S +++ b/arch/x86/kernel/relocate_kernel_64.S | |||
@@ -7,10 +7,10 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/linkage.h> | 9 | #include <linux/linkage.h> |
10 | #include <asm/page.h> | 10 | #include <asm/page_types.h> |
11 | #include <asm/kexec.h> | 11 | #include <asm/kexec.h> |
12 | #include <asm/processor-flags.h> | 12 | #include <asm/processor-flags.h> |
13 | #include <asm/pgtable.h> | 13 | #include <asm/pgtable_types.h> |
14 | 14 | ||
15 | /* | 15 | /* |
16 | * Must be relocatable PIC code callable as a C function | 16 | * Must be relocatable PIC code callable as a C function |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 8fce6c714514..5b85759e7972 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -74,8 +74,9 @@ | |||
74 | #include <asm/e820.h> | 74 | #include <asm/e820.h> |
75 | #include <asm/mpspec.h> | 75 | #include <asm/mpspec.h> |
76 | #include <asm/setup.h> | 76 | #include <asm/setup.h> |
77 | #include <asm/arch_hooks.h> | ||
78 | #include <asm/efi.h> | 77 | #include <asm/efi.h> |
78 | #include <asm/timer.h> | ||
79 | #include <asm/i8259.h> | ||
79 | #include <asm/sections.h> | 80 | #include <asm/sections.h> |
80 | #include <asm/dmi.h> | 81 | #include <asm/dmi.h> |
81 | #include <asm/io_apic.h> | 82 | #include <asm/io_apic.h> |
@@ -97,7 +98,6 @@ | |||
97 | #include <asm/mmu_context.h> | 98 | #include <asm/mmu_context.h> |
98 | #include <asm/proto.h> | 99 | #include <asm/proto.h> |
99 | 100 | ||
100 | #include <asm/genapic.h> | ||
101 | #include <asm/paravirt.h> | 101 | #include <asm/paravirt.h> |
102 | #include <asm/hypervisor.h> | 102 | #include <asm/hypervisor.h> |
103 | 103 | ||
@@ -600,7 +600,7 @@ static int __init setup_elfcorehdr(char *arg) | |||
600 | early_param("elfcorehdr", setup_elfcorehdr); | 600 | early_param("elfcorehdr", setup_elfcorehdr); |
601 | #endif | 601 | #endif |
602 | 602 | ||
603 | static int __init default_update_genapic(void) | 603 | static int __init default_update_apic(void) |
604 | { | 604 | { |
605 | #ifdef CONFIG_SMP | 605 | #ifdef CONFIG_SMP |
606 | if (!apic->wakeup_cpu) | 606 | if (!apic->wakeup_cpu) |
@@ -611,7 +611,7 @@ static int __init default_update_genapic(void) | |||
611 | } | 611 | } |
612 | 612 | ||
613 | static struct x86_quirks default_x86_quirks __initdata = { | 613 | static struct x86_quirks default_x86_quirks __initdata = { |
614 | .update_genapic = default_update_genapic, | 614 | .update_apic = default_update_apic, |
615 | }; | 615 | }; |
616 | 616 | ||
617 | struct x86_quirks *x86_quirks __initdata = &default_x86_quirks; | 617 | struct x86_quirks *x86_quirks __initdata = &default_x86_quirks; |
@@ -669,7 +669,6 @@ void __init setup_arch(char **cmdline_p) | |||
669 | #ifdef CONFIG_X86_32 | 669 | #ifdef CONFIG_X86_32 |
670 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); | 670 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); |
671 | visws_early_detect(); | 671 | visws_early_detect(); |
672 | pre_setup_arch_hook(); | ||
673 | #else | 672 | #else |
674 | printk(KERN_INFO "Command line: %s\n", boot_command_line); | 673 | printk(KERN_INFO "Command line: %s\n", boot_command_line); |
675 | #endif | 674 | #endif |
@@ -836,8 +835,7 @@ void __init setup_arch(char **cmdline_p) | |||
836 | #else | 835 | #else |
837 | num_physpages = max_pfn; | 836 | num_physpages = max_pfn; |
838 | 837 | ||
839 | if (cpu_has_x2apic) | 838 | check_x2apic(); |
840 | check_x2apic(); | ||
841 | 839 | ||
842 | /* How many end-of-memory variables you have, grandma! */ | 840 | /* How many end-of-memory variables you have, grandma! */ |
843 | /* need this before calling reserve_initrd */ | 841 | /* need this before calling reserve_initrd */ |
@@ -987,4 +985,95 @@ void __init setup_arch(char **cmdline_p) | |||
987 | #endif | 985 | #endif |
988 | } | 986 | } |
989 | 987 | ||
988 | #ifdef CONFIG_X86_32 | ||
989 | |||
990 | /** | ||
991 | * x86_quirk_pre_intr_init - initialisation prior to setting up interrupt vectors | ||
992 | * | ||
993 | * Description: | ||
994 | * Perform any necessary interrupt initialisation prior to setting up | ||
995 | * the "ordinary" interrupt call gates. For legacy reasons, the ISA | ||
996 | * interrupts should be initialised here if the machine emulates a PC | ||
997 | * in any way. | ||
998 | **/ | ||
999 | void __init x86_quirk_pre_intr_init(void) | ||
1000 | { | ||
1001 | if (x86_quirks->arch_pre_intr_init) { | ||
1002 | if (x86_quirks->arch_pre_intr_init()) | ||
1003 | return; | ||
1004 | } | ||
1005 | init_ISA_irqs(); | ||
1006 | } | ||
1007 | |||
1008 | /** | ||
1009 | * x86_quirk_intr_init - post gate setup interrupt initialisation | ||
1010 | * | ||
1011 | * Description: | ||
1012 | * Fill in any interrupts that may have been left out by the general | ||
1013 | * init_IRQ() routine. interrupts having to do with the machine rather | ||
1014 | * than the devices on the I/O bus (like APIC interrupts in intel MP | ||
1015 | * systems) are started here. | ||
1016 | **/ | ||
1017 | void __init x86_quirk_intr_init(void) | ||
1018 | { | ||
1019 | if (x86_quirks->arch_intr_init) { | ||
1020 | if (x86_quirks->arch_intr_init()) | ||
1021 | return; | ||
1022 | } | ||
1023 | } | ||
1024 | |||
1025 | /** | ||
1026 | * x86_quirk_trap_init - initialise system specific traps | ||
1027 | * | ||
1028 | * Description: | ||
1029 | * Called as the final act of trap_init(). Used in VISWS to initialise | ||
1030 | * the various board specific APIC traps. | ||
1031 | **/ | ||
1032 | void __init x86_quirk_trap_init(void) | ||
1033 | { | ||
1034 | if (x86_quirks->arch_trap_init) { | ||
1035 | if (x86_quirks->arch_trap_init()) | ||
1036 | return; | ||
1037 | } | ||
1038 | } | ||
1039 | |||
1040 | static struct irqaction irq0 = { | ||
1041 | .handler = timer_interrupt, | ||
1042 | .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER, | ||
1043 | .mask = CPU_MASK_NONE, | ||
1044 | .name = "timer" | ||
1045 | }; | ||
1046 | |||
1047 | /** | ||
1048 | * x86_quirk_pre_time_init - do any specific initialisations before. | ||
1049 | * | ||
1050 | **/ | ||
1051 | void __init x86_quirk_pre_time_init(void) | ||
1052 | { | ||
1053 | if (x86_quirks->arch_pre_time_init) | ||
1054 | x86_quirks->arch_pre_time_init(); | ||
1055 | } | ||
990 | 1056 | ||
1057 | /** | ||
1058 | * x86_quirk_time_init - do any specific initialisations for the system timer. | ||
1059 | * | ||
1060 | * Description: | ||
1061 | * Must plug the system timer interrupt source at HZ into the IRQ listed | ||
1062 | * in irq_vectors.h:TIMER_IRQ | ||
1063 | **/ | ||
1064 | void __init x86_quirk_time_init(void) | ||
1065 | { | ||
1066 | if (x86_quirks->arch_time_init) { | ||
1067 | /* | ||
1068 | * A nonzero return code does not mean failure, it means | ||
1069 | * that the architecture quirk does not want any | ||
1070 | * generic (timer) setup to be performed after this: | ||
1071 | */ | ||
1072 | if (x86_quirks->arch_time_init()) | ||
1073 | return; | ||
1074 | } | ||
1075 | |||
1076 | irq0.mask = cpumask_of_cpu(0); | ||
1077 | setup_irq(0, &irq0); | ||
1078 | } | ||
1079 | #endif /* CONFIG_X86_32 */ | ||
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index eaaffae31cc0..13f33ea8ccaa 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <asm/tlbflush.h> | 26 | #include <asm/tlbflush.h> |
27 | #include <asm/mmu_context.h> | 27 | #include <asm/mmu_context.h> |
28 | #include <asm/proto.h> | 28 | #include <asm/proto.h> |
29 | #include <asm/genapic.h> | 29 | #include <asm/apic.h> |
30 | /* | 30 | /* |
31 | * Some notes on x86 processor bugs affecting SMP operation: | 31 | * Some notes on x86 processor bugs affecting SMP operation: |
32 | * | 32 | * |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 10834954e301..9ce666387f37 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -60,12 +60,11 @@ | |||
60 | #include <asm/tlbflush.h> | 60 | #include <asm/tlbflush.h> |
61 | #include <asm/mtrr.h> | 61 | #include <asm/mtrr.h> |
62 | #include <asm/vmi.h> | 62 | #include <asm/vmi.h> |
63 | #include <asm/genapic.h> | 63 | #include <asm/apic.h> |
64 | #include <asm/setup.h> | 64 | #include <asm/setup.h> |
65 | #include <asm/uv/uv.h> | 65 | #include <asm/uv/uv.h> |
66 | #include <linux/mc146818rtc.h> | 66 | #include <linux/mc146818rtc.h> |
67 | 67 | ||
68 | #include <asm/genapic.h> | ||
69 | #include <asm/smpboot_hooks.h> | 68 | #include <asm/smpboot_hooks.h> |
70 | 69 | ||
71 | #ifdef CONFIG_X86_32 | 70 | #ifdef CONFIG_X86_32 |
@@ -746,21 +745,21 @@ static void __cpuinit do_fork_idle(struct work_struct *work) | |||
746 | complete(&c_idle->done); | 745 | complete(&c_idle->done); |
747 | } | 746 | } |
748 | 747 | ||
749 | static int __cpuinit do_boot_cpu(int apicid, int cpu) | ||
750 | /* | 748 | /* |
751 | * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad | 749 | * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad |
752 | * (ie clustered apic addressing mode), this is a LOGICAL apic ID. | 750 | * (ie clustered apic addressing mode), this is a LOGICAL apic ID. |
753 | * Returns zero if CPU booted OK, else error code from ->wakeup_cpu. | 751 | * Returns zero if CPU booted OK, else error code from ->wakeup_cpu. |
754 | */ | 752 | */ |
753 | static int __cpuinit do_boot_cpu(int apicid, int cpu) | ||
755 | { | 754 | { |
756 | unsigned long boot_error = 0; | 755 | unsigned long boot_error = 0; |
757 | int timeout; | ||
758 | unsigned long start_ip; | 756 | unsigned long start_ip; |
759 | unsigned short nmi_high = 0, nmi_low = 0; | 757 | int timeout; |
760 | struct create_idle c_idle = { | 758 | struct create_idle c_idle = { |
761 | .cpu = cpu, | 759 | .cpu = cpu, |
762 | .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), | 760 | .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), |
763 | }; | 761 | }; |
762 | |||
764 | INIT_WORK(&c_idle.work, do_fork_idle); | 763 | INIT_WORK(&c_idle.work, do_fork_idle); |
765 | 764 | ||
766 | alternatives_smp_switch(1); | 765 | alternatives_smp_switch(1); |
@@ -825,9 +824,6 @@ do_rest: | |||
825 | 824 | ||
826 | pr_debug("Setting warm reset code and vector.\n"); | 825 | pr_debug("Setting warm reset code and vector.\n"); |
827 | 826 | ||
828 | if (apic->store_NMI_vector) | ||
829 | apic->store_NMI_vector(&nmi_high, &nmi_low); | ||
830 | |||
831 | smpboot_setup_warm_reset_vector(start_ip); | 827 | smpboot_setup_warm_reset_vector(start_ip); |
832 | /* | 828 | /* |
833 | * Be paranoid about clearing APIC errors. | 829 | * Be paranoid about clearing APIC errors. |
@@ -1128,8 +1124,8 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1128 | current_thread_info()->cpu = 0; /* needed? */ | 1124 | current_thread_info()->cpu = 0; /* needed? */ |
1129 | set_cpu_sibling_map(0); | 1125 | set_cpu_sibling_map(0); |
1130 | 1126 | ||
1131 | #ifdef CONFIG_X86_64 | ||
1132 | enable_IR_x2apic(); | 1127 | enable_IR_x2apic(); |
1128 | #ifdef CONFIG_X86_64 | ||
1133 | default_setup_apic_routing(); | 1129 | default_setup_apic_routing(); |
1134 | #endif | 1130 | #endif |
1135 | 1131 | ||
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c index 764c74e871f2..5c5d87f0b2e1 100644 --- a/arch/x86/kernel/time_32.c +++ b/arch/x86/kernel/time_32.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/time.h> | 33 | #include <linux/time.h> |
34 | #include <linux/mca.h> | 34 | #include <linux/mca.h> |
35 | 35 | ||
36 | #include <asm/arch_hooks.h> | 36 | #include <asm/setup.h> |
37 | #include <asm/hpet.h> | 37 | #include <asm/hpet.h> |
38 | #include <asm/time.h> | 38 | #include <asm/time.h> |
39 | #include <asm/timer.h> | 39 | #include <asm/timer.h> |
@@ -118,7 +118,7 @@ void __init hpet_time_init(void) | |||
118 | { | 118 | { |
119 | if (!hpet_enable()) | 119 | if (!hpet_enable()) |
120 | setup_pit_timer(); | 120 | setup_pit_timer(); |
121 | time_init_hook(); | 121 | x86_quirk_time_init(); |
122 | } | 122 | } |
123 | 123 | ||
124 | /* | 124 | /* |
@@ -131,7 +131,7 @@ void __init hpet_time_init(void) | |||
131 | */ | 131 | */ |
132 | void __init time_init(void) | 132 | void __init time_init(void) |
133 | { | 133 | { |
134 | pre_time_init_hook(); | 134 | x86_quirk_pre_time_init(); |
135 | tsc_init(); | 135 | tsc_init(); |
136 | late_time_init = choose_time_init(); | 136 | late_time_init = choose_time_init(); |
137 | } | 137 | } |
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c index e6e695acd725..241ec3923f61 100644 --- a/arch/x86/kernel/time_64.c +++ b/arch/x86/kernel/time_64.c | |||
@@ -115,7 +115,7 @@ unsigned long __init calibrate_cpu(void) | |||
115 | 115 | ||
116 | static struct irqaction irq0 = { | 116 | static struct irqaction irq0 = { |
117 | .handler = timer_interrupt, | 117 | .handler = timer_interrupt, |
118 | .flags = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING, | 118 | .flags = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING | IRQF_TIMER, |
119 | .mask = CPU_MASK_NONE, | 119 | .mask = CPU_MASK_NONE, |
120 | .name = "timer" | 120 | .name = "timer" |
121 | }; | 121 | }; |
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c index f396e61bcb34..f04549afcfe9 100644 --- a/arch/x86/kernel/tlb_uv.c +++ b/arch/x86/kernel/tlb_uv.c | |||
@@ -15,13 +15,11 @@ | |||
15 | #include <asm/uv/uv_mmrs.h> | 15 | #include <asm/uv/uv_mmrs.h> |
16 | #include <asm/uv/uv_hub.h> | 16 | #include <asm/uv/uv_hub.h> |
17 | #include <asm/uv/uv_bau.h> | 17 | #include <asm/uv/uv_bau.h> |
18 | #include <asm/genapic.h> | 18 | #include <asm/apic.h> |
19 | #include <asm/idle.h> | 19 | #include <asm/idle.h> |
20 | #include <asm/tsc.h> | 20 | #include <asm/tsc.h> |
21 | #include <asm/irq_vectors.h> | 21 | #include <asm/irq_vectors.h> |
22 | 22 | ||
23 | #include <asm/genapic.h> | ||
24 | |||
25 | static struct bau_control **uv_bau_table_bases __read_mostly; | 23 | static struct bau_control **uv_bau_table_bases __read_mostly; |
26 | static int uv_bau_retry_limit __read_mostly; | 24 | static int uv_bau_retry_limit __read_mostly; |
27 | 25 | ||
diff --git a/arch/x86/kernel/trampoline_32.S b/arch/x86/kernel/trampoline_32.S index d8ccc3c6552f..66d874e5404c 100644 --- a/arch/x86/kernel/trampoline_32.S +++ b/arch/x86/kernel/trampoline_32.S | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | #include <linux/linkage.h> | 30 | #include <linux/linkage.h> |
31 | #include <asm/segment.h> | 31 | #include <asm/segment.h> |
32 | #include <asm/page.h> | 32 | #include <asm/page_types.h> |
33 | 33 | ||
34 | /* We can free up trampoline after bootup if cpu hotplug is not supported. */ | 34 | /* We can free up trampoline after bootup if cpu hotplug is not supported. */ |
35 | #ifndef CONFIG_HOTPLUG_CPU | 35 | #ifndef CONFIG_HOTPLUG_CPU |
diff --git a/arch/x86/kernel/trampoline_64.S b/arch/x86/kernel/trampoline_64.S index 95a012a4664e..cddfb8d386b9 100644 --- a/arch/x86/kernel/trampoline_64.S +++ b/arch/x86/kernel/trampoline_64.S | |||
@@ -25,8 +25,8 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/linkage.h> | 27 | #include <linux/linkage.h> |
28 | #include <asm/pgtable.h> | 28 | #include <asm/pgtable_types.h> |
29 | #include <asm/page.h> | 29 | #include <asm/page_types.h> |
30 | #include <asm/msr.h> | 30 | #include <asm/msr.h> |
31 | #include <asm/segment.h> | 31 | #include <asm/segment.h> |
32 | #include <asm/processor-flags.h> | 32 | #include <asm/processor-flags.h> |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index acb8c0585ab9..c05430ac1b44 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #include <asm/proto.h> | 61 | #include <asm/proto.h> |
62 | #else | 62 | #else |
63 | #include <asm/processor-flags.h> | 63 | #include <asm/processor-flags.h> |
64 | #include <asm/arch_hooks.h> | 64 | #include <asm/setup.h> |
65 | #include <asm/traps.h> | 65 | #include <asm/traps.h> |
66 | 66 | ||
67 | #include "cpu/mcheck/mce.h" | 67 | #include "cpu/mcheck/mce.h" |
@@ -942,7 +942,7 @@ dotraplinkage void do_iret_error(struct pt_regs *regs, long error_code) | |||
942 | info.si_signo = SIGILL; | 942 | info.si_signo = SIGILL; |
943 | info.si_errno = 0; | 943 | info.si_errno = 0; |
944 | info.si_code = ILL_BADSTK; | 944 | info.si_code = ILL_BADSTK; |
945 | info.si_addr = 0; | 945 | info.si_addr = NULL; |
946 | if (notify_die(DIE_TRAP, "iret exception", | 946 | if (notify_die(DIE_TRAP, "iret exception", |
947 | regs, error_code, 32, SIGILL) == NOTIFY_STOP) | 947 | regs, error_code, 32, SIGILL) == NOTIFY_STOP) |
948 | return; | 948 | return; |
@@ -1026,6 +1026,6 @@ void __init trap_init(void) | |||
1026 | cpu_init(); | 1026 | cpu_init(); |
1027 | 1027 | ||
1028 | #ifdef CONFIG_X86_32 | 1028 | #ifdef CONFIG_X86_32 |
1029 | trap_init_hook(); | 1029 | x86_quirk_trap_init(); |
1030 | #endif | 1030 | #endif |
1031 | } | 1031 | } |
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c index 4fd646e6dd43..191a876e9e87 100644 --- a/arch/x86/kernel/visws_quirks.c +++ b/arch/x86/kernel/visws_quirks.c | |||
@@ -24,18 +24,14 @@ | |||
24 | 24 | ||
25 | #include <asm/visws/cobalt.h> | 25 | #include <asm/visws/cobalt.h> |
26 | #include <asm/visws/piix4.h> | 26 | #include <asm/visws/piix4.h> |
27 | #include <asm/arch_hooks.h> | ||
28 | #include <asm/io_apic.h> | 27 | #include <asm/io_apic.h> |
29 | #include <asm/fixmap.h> | 28 | #include <asm/fixmap.h> |
30 | #include <asm/reboot.h> | 29 | #include <asm/reboot.h> |
31 | #include <asm/setup.h> | 30 | #include <asm/setup.h> |
31 | #include <asm/apic.h> | ||
32 | #include <asm/e820.h> | 32 | #include <asm/e820.h> |
33 | #include <asm/io.h> | 33 | #include <asm/io.h> |
34 | 34 | ||
35 | #include <asm/genapic.h> | ||
36 | |||
37 | #include <asm/genapic.h> | ||
38 | |||
39 | #include <linux/kernel_stat.h> | 35 | #include <linux/kernel_stat.h> |
40 | 36 | ||
41 | #include <asm/i8259.h> | 37 | #include <asm/i8259.h> |
@@ -49,8 +45,6 @@ | |||
49 | 45 | ||
50 | extern int no_broadcast; | 46 | extern int no_broadcast; |
51 | 47 | ||
52 | #include <asm/apic.h> | ||
53 | |||
54 | char visws_board_type = -1; | 48 | char visws_board_type = -1; |
55 | char visws_board_rev = -1; | 49 | char visws_board_rev = -1; |
56 | 50 | ||
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c index f052c84ecbe4..2cc4a90e2cb3 100644 --- a/arch/x86/kernel/vmi_32.c +++ b/arch/x86/kernel/vmi_32.c | |||
@@ -798,8 +798,8 @@ static inline int __init activate_vmi(void) | |||
798 | #endif | 798 | #endif |
799 | 799 | ||
800 | #ifdef CONFIG_X86_LOCAL_APIC | 800 | #ifdef CONFIG_X86_LOCAL_APIC |
801 | para_fill(apic_ops->read, APICRead); | 801 | para_fill(apic->read, APICRead); |
802 | para_fill(apic_ops->write, APICWrite); | 802 | para_fill(apic->write, APICWrite); |
803 | #endif | 803 | #endif |
804 | 804 | ||
805 | /* | 805 | /* |
diff --git a/arch/x86/kernel/vmiclock_32.c b/arch/x86/kernel/vmiclock_32.c index a4791ef412d1..33a788d5879c 100644 --- a/arch/x86/kernel/vmiclock_32.c +++ b/arch/x86/kernel/vmiclock_32.c | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | #include <asm/vmi.h> | 29 | #include <asm/vmi.h> |
30 | #include <asm/vmi_time.h> | 30 | #include <asm/vmi_time.h> |
31 | #include <asm/arch_hooks.h> | ||
32 | #include <asm/apicdef.h> | 31 | #include <asm/apicdef.h> |
33 | #include <asm/apic.h> | 32 | #include <asm/apic.h> |
34 | #include <asm/timer.h> | 33 | #include <asm/timer.h> |
@@ -202,7 +201,7 @@ static irqreturn_t vmi_timer_interrupt(int irq, void *dev_id) | |||
202 | static struct irqaction vmi_clock_action = { | 201 | static struct irqaction vmi_clock_action = { |
203 | .name = "vmi-timer", | 202 | .name = "vmi-timer", |
204 | .handler = vmi_timer_interrupt, | 203 | .handler = vmi_timer_interrupt, |
205 | .flags = IRQF_DISABLED | IRQF_NOBALANCING, | 204 | .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER, |
206 | .mask = CPU_MASK_ALL, | 205 | .mask = CPU_MASK_ALL, |
207 | }; | 206 | }; |
208 | 207 | ||
@@ -283,10 +282,12 @@ void __devinit vmi_time_ap_init(void) | |||
283 | #endif | 282 | #endif |
284 | 283 | ||
285 | /** vmi clocksource */ | 284 | /** vmi clocksource */ |
285 | static struct clocksource clocksource_vmi; | ||
286 | 286 | ||
287 | static cycle_t read_real_cycles(void) | 287 | static cycle_t read_real_cycles(void) |
288 | { | 288 | { |
289 | return vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL); | 289 | cycle_t ret = (cycle_t)vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL); |
290 | return max(ret, clocksource_vmi.cycle_last); | ||
290 | } | 291 | } |
291 | 292 | ||
292 | static struct clocksource clocksource_vmi = { | 293 | static struct clocksource clocksource_vmi = { |
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S index 3eba7f7bac05..0d860963f268 100644 --- a/arch/x86/kernel/vmlinux_32.lds.S +++ b/arch/x86/kernel/vmlinux_32.lds.S | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | #include <asm-generic/vmlinux.lds.h> | 13 | #include <asm-generic/vmlinux.lds.h> |
14 | #include <asm/thread_info.h> | 14 | #include <asm/thread_info.h> |
15 | #include <asm/page.h> | 15 | #include <asm/page_types.h> |
16 | #include <asm/cache.h> | 16 | #include <asm/cache.h> |
17 | #include <asm/boot.h> | 17 | #include <asm/boot.h> |
18 | 18 | ||
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S index 087a7f2c639b..fbfced6f6800 100644 --- a/arch/x86/kernel/vmlinux_64.lds.S +++ b/arch/x86/kernel/vmlinux_64.lds.S | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | #include <asm-generic/vmlinux.lds.h> | 7 | #include <asm-generic/vmlinux.lds.h> |
8 | #include <asm/asm-offsets.h> | 8 | #include <asm/asm-offsets.h> |
9 | #include <asm/page.h> | 9 | #include <asm/page_types.h> |
10 | 10 | ||
11 | #undef i386 /* in case the preprocessor is a 32bit one */ | 11 | #undef i386 /* in case the preprocessor is a 32bit one */ |
12 | 12 | ||
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index e665d1c623ca..72bd275a9b5c 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
@@ -207,7 +207,7 @@ static int __pit_timer_fn(struct kvm_kpit_state *ps) | |||
207 | hrtimer_add_expires_ns(&pt->timer, pt->period); | 207 | hrtimer_add_expires_ns(&pt->timer, pt->period); |
208 | pt->scheduled = hrtimer_get_expires_ns(&pt->timer); | 208 | pt->scheduled = hrtimer_get_expires_ns(&pt->timer); |
209 | if (pt->period) | 209 | if (pt->period) |
210 | ps->channels[0].count_load_time = hrtimer_get_expires(&pt->timer); | 210 | ps->channels[0].count_load_time = ktime_get(); |
211 | 211 | ||
212 | return (pt->period == 0 ? 0 : 1); | 212 | return (pt->period == 0 ? 0 : 1); |
213 | } | 213 | } |
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c index c019b8edcdb7..cf17ed52f6fb 100644 --- a/arch/x86/kvm/irq.c +++ b/arch/x86/kvm/irq.c | |||
@@ -87,13 +87,6 @@ void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu) | |||
87 | } | 87 | } |
88 | EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs); | 88 | EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs); |
89 | 89 | ||
90 | void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec) | ||
91 | { | ||
92 | kvm_apic_timer_intr_post(vcpu, vec); | ||
93 | /* TODO: PIT, RTC etc. */ | ||
94 | } | ||
95 | EXPORT_SYMBOL_GPL(kvm_timer_intr_post); | ||
96 | |||
97 | void __kvm_migrate_timers(struct kvm_vcpu *vcpu) | 90 | void __kvm_migrate_timers(struct kvm_vcpu *vcpu) |
98 | { | 91 | { |
99 | __kvm_migrate_apic_timer(vcpu); | 92 | __kvm_migrate_apic_timer(vcpu); |
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h index 2bf32a03ceec..82579ee538d0 100644 --- a/arch/x86/kvm/irq.h +++ b/arch/x86/kvm/irq.h | |||
@@ -89,7 +89,6 @@ static inline int irqchip_in_kernel(struct kvm *kvm) | |||
89 | 89 | ||
90 | void kvm_pic_reset(struct kvm_kpic_state *s); | 90 | void kvm_pic_reset(struct kvm_kpic_state *s); |
91 | 91 | ||
92 | void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec); | ||
93 | void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); | 92 | void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu); |
94 | void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); | 93 | void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu); |
95 | void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu); | 94 | void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu); |
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index afac68c0815c..f0b67f2cdd69 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -35,6 +35,12 @@ | |||
35 | #include "kvm_cache_regs.h" | 35 | #include "kvm_cache_regs.h" |
36 | #include "irq.h" | 36 | #include "irq.h" |
37 | 37 | ||
38 | #ifndef CONFIG_X86_64 | ||
39 | #define mod_64(x, y) ((x) - (y) * div64_u64(x, y)) | ||
40 | #else | ||
41 | #define mod_64(x, y) ((x) % (y)) | ||
42 | #endif | ||
43 | |||
38 | #define PRId64 "d" | 44 | #define PRId64 "d" |
39 | #define PRIx64 "llx" | 45 | #define PRIx64 "llx" |
40 | #define PRIu64 "u" | 46 | #define PRIu64 "u" |
@@ -511,52 +517,22 @@ static void apic_send_ipi(struct kvm_lapic *apic) | |||
511 | 517 | ||
512 | static u32 apic_get_tmcct(struct kvm_lapic *apic) | 518 | static u32 apic_get_tmcct(struct kvm_lapic *apic) |
513 | { | 519 | { |
514 | u64 counter_passed; | 520 | ktime_t remaining; |
515 | ktime_t passed, now; | 521 | s64 ns; |
516 | u32 tmcct; | 522 | u32 tmcct; |
517 | 523 | ||
518 | ASSERT(apic != NULL); | 524 | ASSERT(apic != NULL); |
519 | 525 | ||
520 | now = apic->timer.dev.base->get_time(); | ||
521 | tmcct = apic_get_reg(apic, APIC_TMICT); | ||
522 | |||
523 | /* if initial count is 0, current count should also be 0 */ | 526 | /* if initial count is 0, current count should also be 0 */ |
524 | if (tmcct == 0) | 527 | if (apic_get_reg(apic, APIC_TMICT) == 0) |
525 | return 0; | 528 | return 0; |
526 | 529 | ||
527 | if (unlikely(ktime_to_ns(now) <= | 530 | remaining = hrtimer_expires_remaining(&apic->timer.dev); |
528 | ktime_to_ns(apic->timer.last_update))) { | 531 | if (ktime_to_ns(remaining) < 0) |
529 | /* Wrap around */ | 532 | remaining = ktime_set(0, 0); |
530 | passed = ktime_add(( { | 533 | |
531 | (ktime_t) { | 534 | ns = mod_64(ktime_to_ns(remaining), apic->timer.period); |
532 | .tv64 = KTIME_MAX - | 535 | tmcct = div64_u64(ns, (APIC_BUS_CYCLE_NS * apic->timer.divide_count)); |
533 | (apic->timer.last_update).tv64}; } | ||
534 | ), now); | ||
535 | apic_debug("time elapsed\n"); | ||
536 | } else | ||
537 | passed = ktime_sub(now, apic->timer.last_update); | ||
538 | |||
539 | counter_passed = div64_u64(ktime_to_ns(passed), | ||
540 | (APIC_BUS_CYCLE_NS * apic->timer.divide_count)); | ||
541 | |||
542 | if (counter_passed > tmcct) { | ||
543 | if (unlikely(!apic_lvtt_period(apic))) { | ||
544 | /* one-shot timers stick at 0 until reset */ | ||
545 | tmcct = 0; | ||
546 | } else { | ||
547 | /* | ||
548 | * periodic timers reset to APIC_TMICT when they | ||
549 | * hit 0. The while loop simulates this happening N | ||
550 | * times. (counter_passed %= tmcct) would also work, | ||
551 | * but might be slower or not work on 32-bit?? | ||
552 | */ | ||
553 | while (counter_passed > tmcct) | ||
554 | counter_passed -= tmcct; | ||
555 | tmcct -= counter_passed; | ||
556 | } | ||
557 | } else { | ||
558 | tmcct -= counter_passed; | ||
559 | } | ||
560 | 536 | ||
561 | return tmcct; | 537 | return tmcct; |
562 | } | 538 | } |
@@ -653,8 +629,6 @@ static void start_apic_timer(struct kvm_lapic *apic) | |||
653 | { | 629 | { |
654 | ktime_t now = apic->timer.dev.base->get_time(); | 630 | ktime_t now = apic->timer.dev.base->get_time(); |
655 | 631 | ||
656 | apic->timer.last_update = now; | ||
657 | |||
658 | apic->timer.period = apic_get_reg(apic, APIC_TMICT) * | 632 | apic->timer.period = apic_get_reg(apic, APIC_TMICT) * |
659 | APIC_BUS_CYCLE_NS * apic->timer.divide_count; | 633 | APIC_BUS_CYCLE_NS * apic->timer.divide_count; |
660 | atomic_set(&apic->timer.pending, 0); | 634 | atomic_set(&apic->timer.pending, 0); |
@@ -1110,16 +1084,6 @@ void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu) | |||
1110 | } | 1084 | } |
1111 | } | 1085 | } |
1112 | 1086 | ||
1113 | void kvm_apic_timer_intr_post(struct kvm_vcpu *vcpu, int vec) | ||
1114 | { | ||
1115 | struct kvm_lapic *apic = vcpu->arch.apic; | ||
1116 | |||
1117 | if (apic && apic_lvt_vector(apic, APIC_LVTT) == vec) | ||
1118 | apic->timer.last_update = ktime_add_ns( | ||
1119 | apic->timer.last_update, | ||
1120 | apic->timer.period); | ||
1121 | } | ||
1122 | |||
1123 | int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu) | 1087 | int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu) |
1124 | { | 1088 | { |
1125 | int vector = kvm_apic_has_interrupt(vcpu); | 1089 | int vector = kvm_apic_has_interrupt(vcpu); |
diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h index 81858881287e..45ab6ee71209 100644 --- a/arch/x86/kvm/lapic.h +++ b/arch/x86/kvm/lapic.h | |||
@@ -12,7 +12,6 @@ struct kvm_lapic { | |||
12 | atomic_t pending; | 12 | atomic_t pending; |
13 | s64 period; /* unit: ns */ | 13 | s64 period; /* unit: ns */ |
14 | u32 divide_count; | 14 | u32 divide_count; |
15 | ktime_t last_update; | ||
16 | struct hrtimer dev; | 15 | struct hrtimer dev; |
17 | } timer; | 16 | } timer; |
18 | struct kvm_vcpu *vcpu; | 17 | struct kvm_vcpu *vcpu; |
@@ -42,7 +41,6 @@ void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data); | |||
42 | void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu); | 41 | void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu); |
43 | int kvm_lapic_enabled(struct kvm_vcpu *vcpu); | 42 | int kvm_lapic_enabled(struct kvm_vcpu *vcpu); |
44 | int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu); | 43 | int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu); |
45 | void kvm_apic_timer_intr_post(struct kvm_vcpu *vcpu, int vec); | ||
46 | 44 | ||
47 | void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr); | 45 | void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr); |
48 | void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu); | 46 | void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu); |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 83f11c7474a1..2d4477c71473 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -1698,8 +1698,13 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte, | |||
1698 | if (largepage) | 1698 | if (largepage) |
1699 | spte |= PT_PAGE_SIZE_MASK; | 1699 | spte |= PT_PAGE_SIZE_MASK; |
1700 | if (mt_mask) { | 1700 | if (mt_mask) { |
1701 | mt_mask = get_memory_type(vcpu, gfn) << | 1701 | if (!kvm_is_mmio_pfn(pfn)) { |
1702 | kvm_x86_ops->get_mt_mask_shift(); | 1702 | mt_mask = get_memory_type(vcpu, gfn) << |
1703 | kvm_x86_ops->get_mt_mask_shift(); | ||
1704 | mt_mask |= VMX_EPT_IGMT_BIT; | ||
1705 | } else | ||
1706 | mt_mask = MTRR_TYPE_UNCACHABLE << | ||
1707 | kvm_x86_ops->get_mt_mask_shift(); | ||
1703 | spte |= mt_mask; | 1708 | spte |= mt_mask; |
1704 | } | 1709 | } |
1705 | 1710 | ||
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 1452851ae258..a9e769e4e251 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -1600,7 +1600,6 @@ static void svm_intr_assist(struct kvm_vcpu *vcpu) | |||
1600 | /* Okay, we can deliver the interrupt: grab it and update PIC state. */ | 1600 | /* Okay, we can deliver the interrupt: grab it and update PIC state. */ |
1601 | intr_vector = kvm_cpu_get_interrupt(vcpu); | 1601 | intr_vector = kvm_cpu_get_interrupt(vcpu); |
1602 | svm_inject_irq(svm, intr_vector); | 1602 | svm_inject_irq(svm, intr_vector); |
1603 | kvm_timer_intr_post(vcpu, intr_vector); | ||
1604 | out: | 1603 | out: |
1605 | update_cr8_intercept(vcpu); | 1604 | update_cr8_intercept(vcpu); |
1606 | } | 1605 | } |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 6259d7467648..7611af576829 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -903,6 +903,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata) | |||
903 | data = vmcs_readl(GUEST_SYSENTER_ESP); | 903 | data = vmcs_readl(GUEST_SYSENTER_ESP); |
904 | break; | 904 | break; |
905 | default: | 905 | default: |
906 | vmx_load_host_state(to_vmx(vcpu)); | ||
906 | msr = find_msr_entry(to_vmx(vcpu), msr_index); | 907 | msr = find_msr_entry(to_vmx(vcpu), msr_index); |
907 | if (msr) { | 908 | if (msr) { |
908 | data = msr->data; | 909 | data = msr->data; |
@@ -3285,7 +3286,6 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu) | |||
3285 | } | 3286 | } |
3286 | if (vcpu->arch.interrupt.pending) { | 3287 | if (vcpu->arch.interrupt.pending) { |
3287 | vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr); | 3288 | vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr); |
3288 | kvm_timer_intr_post(vcpu, vcpu->arch.interrupt.nr); | ||
3289 | if (kvm_cpu_has_interrupt(vcpu)) | 3289 | if (kvm_cpu_has_interrupt(vcpu)) |
3290 | enable_irq_window(vcpu); | 3290 | enable_irq_window(vcpu); |
3291 | } | 3291 | } |
@@ -3687,8 +3687,7 @@ static int __init vmx_init(void) | |||
3687 | if (vm_need_ept()) { | 3687 | if (vm_need_ept()) { |
3688 | bypass_guest_pf = 0; | 3688 | bypass_guest_pf = 0; |
3689 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | | 3689 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | |
3690 | VMX_EPT_WRITABLE_MASK | | 3690 | VMX_EPT_WRITABLE_MASK); |
3691 | VMX_EPT_IGMT_BIT); | ||
3692 | kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull, | 3691 | kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull, |
3693 | VMX_EPT_EXECUTABLE_MASK, | 3692 | VMX_EPT_EXECUTABLE_MASK, |
3694 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); | 3693 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index cc17546a2406..758b7a155ae9 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -967,7 +967,6 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
967 | case KVM_CAP_MMU_SHADOW_CACHE_CONTROL: | 967 | case KVM_CAP_MMU_SHADOW_CACHE_CONTROL: |
968 | case KVM_CAP_SET_TSS_ADDR: | 968 | case KVM_CAP_SET_TSS_ADDR: |
969 | case KVM_CAP_EXT_CPUID: | 969 | case KVM_CAP_EXT_CPUID: |
970 | case KVM_CAP_CLOCKSOURCE: | ||
971 | case KVM_CAP_PIT: | 970 | case KVM_CAP_PIT: |
972 | case KVM_CAP_NOP_IO_DELAY: | 971 | case KVM_CAP_NOP_IO_DELAY: |
973 | case KVM_CAP_MP_STATE: | 972 | case KVM_CAP_MP_STATE: |
@@ -992,6 +991,9 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
992 | case KVM_CAP_IOMMU: | 991 | case KVM_CAP_IOMMU: |
993 | r = iommu_found(); | 992 | r = iommu_found(); |
994 | break; | 993 | break; |
994 | case KVM_CAP_CLOCKSOURCE: | ||
995 | r = boot_cpu_has(X86_FEATURE_CONSTANT_TSC); | ||
996 | break; | ||
995 | default: | 997 | default: |
996 | r = 0; | 998 | r = 0; |
997 | break; | 999 | break; |
@@ -4127,9 +4129,13 @@ static void kvm_free_vcpus(struct kvm *kvm) | |||
4127 | 4129 | ||
4128 | } | 4130 | } |
4129 | 4131 | ||
4130 | void kvm_arch_destroy_vm(struct kvm *kvm) | 4132 | void kvm_arch_sync_events(struct kvm *kvm) |
4131 | { | 4133 | { |
4132 | kvm_free_all_assigned_devices(kvm); | 4134 | kvm_free_all_assigned_devices(kvm); |
4135 | } | ||
4136 | |||
4137 | void kvm_arch_destroy_vm(struct kvm *kvm) | ||
4138 | { | ||
4133 | kvm_iommu_unmap_guest(kvm); | 4139 | kvm_iommu_unmap_guest(kvm); |
4134 | kvm_free_pit(kvm); | 4140 | kvm_free_pit(kvm); |
4135 | kfree(kvm->arch.vpic); | 4141 | kfree(kvm->arch.vpic); |
diff --git a/arch/x86/lguest/Kconfig b/arch/x86/lguest/Kconfig index c70e12b1a637..8dab8f7844d3 100644 --- a/arch/x86/lguest/Kconfig +++ b/arch/x86/lguest/Kconfig | |||
@@ -3,7 +3,6 @@ config LGUEST_GUEST | |||
3 | select PARAVIRT | 3 | select PARAVIRT |
4 | depends on X86_32 | 4 | depends on X86_32 |
5 | depends on !X86_PAE | 5 | depends on !X86_PAE |
6 | depends on !X86_VOYAGER | ||
7 | select VIRTIO | 6 | select VIRTIO |
8 | select VIRTIO_RING | 7 | select VIRTIO_RING |
9 | select VIRTIO_CONSOLE | 8 | select VIRTIO_CONSOLE |
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index da2e314f61b5..f3a5305b8adf 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -828,13 +828,14 @@ static u32 lguest_apic_safe_wait_icr_idle(void) | |||
828 | return 0; | 828 | return 0; |
829 | } | 829 | } |
830 | 830 | ||
831 | static struct apic_ops lguest_basic_apic_ops = { | 831 | static void set_lguest_basic_apic_ops(void) |
832 | .read = lguest_apic_read, | 832 | { |
833 | .write = lguest_apic_write, | 833 | apic->read = lguest_apic_read; |
834 | .icr_read = lguest_apic_icr_read, | 834 | apic->write = lguest_apic_write; |
835 | .icr_write = lguest_apic_icr_write, | 835 | apic->icr_read = lguest_apic_icr_read; |
836 | .wait_icr_idle = lguest_apic_wait_icr_idle, | 836 | apic->icr_write = lguest_apic_icr_write; |
837 | .safe_wait_icr_idle = lguest_apic_safe_wait_icr_idle, | 837 | apic->wait_icr_idle = lguest_apic_wait_icr_idle; |
838 | apic->safe_wait_icr_idle = lguest_apic_safe_wait_icr_idle; | ||
838 | }; | 839 | }; |
839 | #endif | 840 | #endif |
840 | 841 | ||
@@ -1035,7 +1036,7 @@ __init void lguest_init(void) | |||
1035 | 1036 | ||
1036 | #ifdef CONFIG_X86_LOCAL_APIC | 1037 | #ifdef CONFIG_X86_LOCAL_APIC |
1037 | /* apic read/write intercepts */ | 1038 | /* apic read/write intercepts */ |
1038 | apic_ops = &lguest_basic_apic_ops; | 1039 | set_lguest_basic_apic_ops(); |
1039 | #endif | 1040 | #endif |
1040 | 1041 | ||
1041 | /* time operations */ | 1042 | /* time operations */ |
diff --git a/arch/x86/lib/getuser.S b/arch/x86/lib/getuser.S index ad374003742f..51f1504cddd9 100644 --- a/arch/x86/lib/getuser.S +++ b/arch/x86/lib/getuser.S | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #include <linux/linkage.h> | 29 | #include <linux/linkage.h> |
30 | #include <asm/dwarf2.h> | 30 | #include <asm/dwarf2.h> |
31 | #include <asm/page.h> | 31 | #include <asm/page_types.h> |
32 | #include <asm/errno.h> | 32 | #include <asm/errno.h> |
33 | #include <asm/asm-offsets.h> | 33 | #include <asm/asm-offsets.h> |
34 | #include <asm/thread_info.h> | 34 | #include <asm/thread_info.h> |
diff --git a/arch/x86/mach-voyager/Makefile b/arch/x86/mach-voyager/Makefile deleted file mode 100644 index 15c250b371d3..000000000000 --- a/arch/x86/mach-voyager/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the linux kernel. | ||
3 | # | ||
4 | |||
5 | EXTRA_CFLAGS := -Iarch/x86/kernel | ||
6 | obj-y := setup.o voyager_basic.o voyager_thread.o | ||
7 | |||
8 | obj-$(CONFIG_SMP) += voyager_smp.o voyager_cat.o | ||
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c deleted file mode 100644 index 66b7eb57d8e4..000000000000 --- a/arch/x86/mach-voyager/setup.c +++ /dev/null | |||
@@ -1,119 +0,0 @@ | |||
1 | /* | ||
2 | * Machine specific setup for generic | ||
3 | */ | ||
4 | |||
5 | #include <linux/init.h> | ||
6 | #include <linux/interrupt.h> | ||
7 | #include <asm/arch_hooks.h> | ||
8 | #include <asm/voyager.h> | ||
9 | #include <asm/e820.h> | ||
10 | #include <asm/io.h> | ||
11 | #include <asm/setup.h> | ||
12 | #include <asm/cpu.h> | ||
13 | |||
14 | void __init pre_intr_init_hook(void) | ||
15 | { | ||
16 | init_ISA_irqs(); | ||
17 | } | ||
18 | |||
19 | /* | ||
20 | * IRQ2 is cascade interrupt to second interrupt controller | ||
21 | */ | ||
22 | static struct irqaction irq2 = { | ||
23 | .handler = no_action, | ||
24 | .mask = CPU_MASK_NONE, | ||
25 | .name = "cascade", | ||
26 | }; | ||
27 | |||
28 | void __init intr_init_hook(void) | ||
29 | { | ||
30 | #ifdef CONFIG_SMP | ||
31 | voyager_smp_intr_init(); | ||
32 | #endif | ||
33 | |||
34 | setup_irq(2, &irq2); | ||
35 | } | ||
36 | |||
37 | static void voyager_disable_tsc(void) | ||
38 | { | ||
39 | /* Voyagers run their CPUs from independent clocks, so disable | ||
40 | * the TSC code because we can't sync them */ | ||
41 | setup_clear_cpu_cap(X86_FEATURE_TSC); | ||
42 | } | ||
43 | |||
44 | void __init pre_setup_arch_hook(void) | ||
45 | { | ||
46 | voyager_disable_tsc(); | ||
47 | } | ||
48 | |||
49 | void __init pre_time_init_hook(void) | ||
50 | { | ||
51 | voyager_disable_tsc(); | ||
52 | } | ||
53 | |||
54 | void __init trap_init_hook(void) | ||
55 | { | ||
56 | } | ||
57 | |||
58 | static struct irqaction irq0 = { | ||
59 | .handler = timer_interrupt, | ||
60 | .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL, | ||
61 | .mask = CPU_MASK_NONE, | ||
62 | .name = "timer" | ||
63 | }; | ||
64 | |||
65 | void __init time_init_hook(void) | ||
66 | { | ||
67 | irq0.mask = cpumask_of_cpu(safe_smp_processor_id()); | ||
68 | setup_irq(0, &irq0); | ||
69 | } | ||
70 | |||
71 | /* Hook for machine specific memory setup. */ | ||
72 | |||
73 | char *__init machine_specific_memory_setup(void) | ||
74 | { | ||
75 | char *who; | ||
76 | int new_nr; | ||
77 | |||
78 | who = "NOT VOYAGER"; | ||
79 | |||
80 | if (voyager_level == 5) { | ||
81 | __u32 addr, length; | ||
82 | int i; | ||
83 | |||
84 | who = "Voyager-SUS"; | ||
85 | |||
86 | e820.nr_map = 0; | ||
87 | for (i = 0; voyager_memory_detect(i, &addr, &length); i++) { | ||
88 | e820_add_region(addr, length, E820_RAM); | ||
89 | } | ||
90 | return who; | ||
91 | } else if (voyager_level == 4) { | ||
92 | __u32 tom; | ||
93 | __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT) << 8; | ||
94 | /* select the DINO config space */ | ||
95 | outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT); | ||
96 | /* Read DINO top of memory register */ | ||
97 | tom = ((inb(catbase + 0x4) & 0xf0) << 16) | ||
98 | + ((inb(catbase + 0x5) & 0x7f) << 24); | ||
99 | |||
100 | if (inb(catbase) != VOYAGER_DINO) { | ||
101 | printk(KERN_ERR | ||
102 | "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n"); | ||
103 | tom = (boot_params.screen_info.ext_mem_k) << 10; | ||
104 | } | ||
105 | who = "Voyager-TOM"; | ||
106 | e820_add_region(0, 0x9f000, E820_RAM); | ||
107 | /* map from 1M to top of memory */ | ||
108 | e820_add_region(1 * 1024 * 1024, tom - 1 * 1024 * 1024, | ||
109 | E820_RAM); | ||
110 | /* FIXME: Should check the ASICs to see if I need to | ||
111 | * take out the 8M window. Just do it at the moment | ||
112 | * */ | ||
113 | e820_add_region(8 * 1024 * 1024, 8 * 1024 * 1024, | ||
114 | E820_RESERVED); | ||
115 | return who; | ||
116 | } | ||
117 | |||
118 | return default_machine_specific_memory_setup(); | ||
119 | } | ||
diff --git a/arch/x86/mach-voyager/voyager_basic.c b/arch/x86/mach-voyager/voyager_basic.c deleted file mode 100644 index 46d6f8067690..000000000000 --- a/arch/x86/mach-voyager/voyager_basic.c +++ /dev/null | |||
@@ -1,317 +0,0 @@ | |||
1 | /* Copyright (C) 1999,2001 | ||
2 | * | ||
3 | * Author: J.E.J.Bottomley@HansenPartnership.com | ||
4 | * | ||
5 | * This file contains all the voyager specific routines for getting | ||
6 | * initialisation of the architecture to function. For additional | ||
7 | * features see: | ||
8 | * | ||
9 | * voyager_cat.c - Voyager CAT bus interface | ||
10 | * voyager_smp.c - Voyager SMP hal (emulates linux smp.c) | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/sched.h> | ||
16 | #include <linux/ptrace.h> | ||
17 | #include <linux/ioport.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/reboot.h> | ||
22 | #include <linux/sysrq.h> | ||
23 | #include <linux/smp.h> | ||
24 | #include <linux/nodemask.h> | ||
25 | #include <asm/io.h> | ||
26 | #include <asm/voyager.h> | ||
27 | #include <asm/vic.h> | ||
28 | #include <linux/pm.h> | ||
29 | #include <asm/tlbflush.h> | ||
30 | #include <asm/arch_hooks.h> | ||
31 | #include <asm/i8253.h> | ||
32 | |||
33 | /* | ||
34 | * Power off function, if any | ||
35 | */ | ||
36 | void (*pm_power_off) (void); | ||
37 | EXPORT_SYMBOL(pm_power_off); | ||
38 | |||
39 | int voyager_level = 0; | ||
40 | |||
41 | struct voyager_SUS *voyager_SUS = NULL; | ||
42 | |||
43 | #ifdef CONFIG_SMP | ||
44 | static void voyager_dump(int dummy1, struct tty_struct *dummy3) | ||
45 | { | ||
46 | /* get here via a sysrq */ | ||
47 | voyager_smp_dump(); | ||
48 | } | ||
49 | |||
50 | static struct sysrq_key_op sysrq_voyager_dump_op = { | ||
51 | .handler = voyager_dump, | ||
52 | .help_msg = "Voyager", | ||
53 | .action_msg = "Dump Voyager Status", | ||
54 | }; | ||
55 | #endif | ||
56 | |||
57 | void voyager_detect(struct voyager_bios_info *bios) | ||
58 | { | ||
59 | if (bios->len != 0xff) { | ||
60 | int class = (bios->class_1 << 8) | ||
61 | | (bios->class_2 & 0xff); | ||
62 | |||
63 | printk("Voyager System detected.\n" | ||
64 | " Class %x, Revision %d.%d\n", | ||
65 | class, bios->major, bios->minor); | ||
66 | if (class == VOYAGER_LEVEL4) | ||
67 | voyager_level = 4; | ||
68 | else if (class < VOYAGER_LEVEL5_AND_ABOVE) | ||
69 | voyager_level = 3; | ||
70 | else | ||
71 | voyager_level = 5; | ||
72 | printk(" Architecture Level %d\n", voyager_level); | ||
73 | if (voyager_level < 4) | ||
74 | printk | ||
75 | ("\n**WARNING**: Voyager HAL only supports Levels 4 and 5 Architectures at the moment\n\n"); | ||
76 | /* install the power off handler */ | ||
77 | pm_power_off = voyager_power_off; | ||
78 | #ifdef CONFIG_SMP | ||
79 | register_sysrq_key('v', &sysrq_voyager_dump_op); | ||
80 | #endif | ||
81 | } else { | ||
82 | printk("\n\n**WARNING**: No Voyager Subsystem Found\n"); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | void voyager_system_interrupt(int cpl, void *dev_id) | ||
87 | { | ||
88 | printk("Voyager: detected system interrupt\n"); | ||
89 | } | ||
90 | |||
91 | /* Routine to read information from the extended CMOS area */ | ||
92 | __u8 voyager_extended_cmos_read(__u16 addr) | ||
93 | { | ||
94 | outb(addr & 0xff, 0x74); | ||
95 | outb((addr >> 8) & 0xff, 0x75); | ||
96 | return inb(0x76); | ||
97 | } | ||
98 | |||
99 | /* internal definitions for the SUS Click Map of memory */ | ||
100 | |||
101 | #define CLICK_ENTRIES 16 | ||
102 | #define CLICK_SIZE 4096 /* click to byte conversion for Length */ | ||
103 | |||
104 | typedef struct ClickMap { | ||
105 | struct Entry { | ||
106 | __u32 Address; | ||
107 | __u32 Length; | ||
108 | } Entry[CLICK_ENTRIES]; | ||
109 | } ClickMap_t; | ||
110 | |||
111 | /* This routine is pretty much an awful hack to read the bios clickmap by | ||
112 | * mapping it into page 0. There are usually three regions in the map: | ||
113 | * Base Memory | ||
114 | * Extended Memory | ||
115 | * zero length marker for end of map | ||
116 | * | ||
117 | * Returns are 0 for failure and 1 for success on extracting region. | ||
118 | */ | ||
119 | int __init voyager_memory_detect(int region, __u32 * start, __u32 * length) | ||
120 | { | ||
121 | int i; | ||
122 | int retval = 0; | ||
123 | __u8 cmos[4]; | ||
124 | ClickMap_t *map; | ||
125 | unsigned long map_addr; | ||
126 | unsigned long old; | ||
127 | |||
128 | if (region >= CLICK_ENTRIES) { | ||
129 | printk("Voyager: Illegal ClickMap region %d\n", region); | ||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | for (i = 0; i < sizeof(cmos); i++) | ||
134 | cmos[i] = | ||
135 | voyager_extended_cmos_read(VOYAGER_MEMORY_CLICKMAP + i); | ||
136 | |||
137 | map_addr = *(unsigned long *)cmos; | ||
138 | |||
139 | /* steal page 0 for this */ | ||
140 | old = pg0[0]; | ||
141 | pg0[0] = ((map_addr & PAGE_MASK) | _PAGE_RW | _PAGE_PRESENT); | ||
142 | local_flush_tlb(); | ||
143 | /* now clear everything out but page 0 */ | ||
144 | map = (ClickMap_t *) (map_addr & (~PAGE_MASK)); | ||
145 | |||
146 | /* zero length is the end of the clickmap */ | ||
147 | if (map->Entry[region].Length != 0) { | ||
148 | *length = map->Entry[region].Length * CLICK_SIZE; | ||
149 | *start = map->Entry[region].Address; | ||
150 | retval = 1; | ||
151 | } | ||
152 | |||
153 | /* replace the mapping */ | ||
154 | pg0[0] = old; | ||
155 | local_flush_tlb(); | ||
156 | return retval; | ||
157 | } | ||
158 | |||
159 | /* voyager specific handling code for timer interrupts. Used to hand | ||
160 | * off the timer tick to the SMP code, since the VIC doesn't have an | ||
161 | * internal timer (The QIC does, but that's another story). */ | ||
162 | void voyager_timer_interrupt(void) | ||
163 | { | ||
164 | if ((jiffies & 0x3ff) == 0) { | ||
165 | |||
166 | /* There seems to be something flaky in either | ||
167 | * hardware or software that is resetting the timer 0 | ||
168 | * count to something much higher than it should be | ||
169 | * This seems to occur in the boot sequence, just | ||
170 | * before root is mounted. Therefore, every 10 | ||
171 | * seconds or so, we sanity check the timer zero count | ||
172 | * and kick it back to where it should be. | ||
173 | * | ||
174 | * FIXME: This is the most awful hack yet seen. I | ||
175 | * should work out exactly what is interfering with | ||
176 | * the timer count settings early in the boot sequence | ||
177 | * and swiftly introduce it to something sharp and | ||
178 | * pointy. */ | ||
179 | __u16 val; | ||
180 | |||
181 | spin_lock(&i8253_lock); | ||
182 | |||
183 | outb_p(0x00, 0x43); | ||
184 | val = inb_p(0x40); | ||
185 | val |= inb(0x40) << 8; | ||
186 | spin_unlock(&i8253_lock); | ||
187 | |||
188 | if (val > LATCH) { | ||
189 | printk | ||
190 | ("\nVOYAGER: countdown timer value too high (%d), resetting\n\n", | ||
191 | val); | ||
192 | spin_lock(&i8253_lock); | ||
193 | outb(0x34, 0x43); | ||
194 | outb_p(LATCH & 0xff, 0x40); /* LSB */ | ||
195 | outb(LATCH >> 8, 0x40); /* MSB */ | ||
196 | spin_unlock(&i8253_lock); | ||
197 | } | ||
198 | } | ||
199 | #ifdef CONFIG_SMP | ||
200 | smp_vic_timer_interrupt(); | ||
201 | #endif | ||
202 | } | ||
203 | |||
204 | void voyager_power_off(void) | ||
205 | { | ||
206 | printk("VOYAGER Power Off\n"); | ||
207 | |||
208 | if (voyager_level == 5) { | ||
209 | voyager_cat_power_off(); | ||
210 | } else if (voyager_level == 4) { | ||
211 | /* This doesn't apparently work on most L4 machines, | ||
212 | * but the specs say to do this to get automatic power | ||
213 | * off. Unfortunately, if it doesn't power off the | ||
214 | * machine, it ends up doing a cold restart, which | ||
215 | * isn't really intended, so comment out the code */ | ||
216 | #if 0 | ||
217 | int port; | ||
218 | |||
219 | /* enable the voyager Configuration Space */ | ||
220 | outb((inb(VOYAGER_MC_SETUP) & 0xf0) | 0x8, VOYAGER_MC_SETUP); | ||
221 | /* the port for the power off flag is an offset from the | ||
222 | floating base */ | ||
223 | port = (inb(VOYAGER_SSPB_RELOCATION_PORT) << 8) + 0x21; | ||
224 | /* set the power off flag */ | ||
225 | outb(inb(port) | 0x1, port); | ||
226 | #endif | ||
227 | } | ||
228 | /* and wait for it to happen */ | ||
229 | local_irq_disable(); | ||
230 | for (;;) | ||
231 | halt(); | ||
232 | } | ||
233 | |||
234 | /* copied from process.c */ | ||
235 | static inline void kb_wait(void) | ||
236 | { | ||
237 | int i; | ||
238 | |||
239 | for (i = 0; i < 0x10000; i++) | ||
240 | if ((inb_p(0x64) & 0x02) == 0) | ||
241 | break; | ||
242 | } | ||
243 | |||
244 | void machine_shutdown(void) | ||
245 | { | ||
246 | /* Architecture specific shutdown needed before a kexec */ | ||
247 | } | ||
248 | |||
249 | void machine_restart(char *cmd) | ||
250 | { | ||
251 | printk("Voyager Warm Restart\n"); | ||
252 | kb_wait(); | ||
253 | |||
254 | if (voyager_level == 5) { | ||
255 | /* write magic values to the RTC to inform system that | ||
256 | * shutdown is beginning */ | ||
257 | outb(0x8f, 0x70); | ||
258 | outb(0x5, 0x71); | ||
259 | |||
260 | udelay(50); | ||
261 | outb(0xfe, 0x64); /* pull reset low */ | ||
262 | } else if (voyager_level == 4) { | ||
263 | __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT) << 8; | ||
264 | __u8 basebd = inb(VOYAGER_MC_SETUP); | ||
265 | |||
266 | outb(basebd | 0x08, VOYAGER_MC_SETUP); | ||
267 | outb(0x02, catbase + 0x21); | ||
268 | } | ||
269 | local_irq_disable(); | ||
270 | for (;;) | ||
271 | halt(); | ||
272 | } | ||
273 | |||
274 | void machine_emergency_restart(void) | ||
275 | { | ||
276 | /*for now, just hook this to a warm restart */ | ||
277 | machine_restart(NULL); | ||
278 | } | ||
279 | |||
280 | void mca_nmi_hook(void) | ||
281 | { | ||
282 | __u8 dumpval __maybe_unused = inb(0xf823); | ||
283 | __u8 swnmi __maybe_unused = inb(0xf813); | ||
284 | |||
285 | /* FIXME: assume dump switch pressed */ | ||
286 | /* check to see if the dump switch was pressed */ | ||
287 | VDEBUG(("VOYAGER: dumpval = 0x%x, swnmi = 0x%x\n", dumpval, swnmi)); | ||
288 | /* clear swnmi */ | ||
289 | outb(0xff, 0xf813); | ||
290 | /* tell SUS to ignore dump */ | ||
291 | if (voyager_level == 5 && voyager_SUS != NULL) { | ||
292 | if (voyager_SUS->SUS_mbox == VOYAGER_DUMP_BUTTON_NMI) { | ||
293 | voyager_SUS->kernel_mbox = VOYAGER_NO_COMMAND; | ||
294 | voyager_SUS->kernel_flags |= VOYAGER_OS_IN_PROGRESS; | ||
295 | udelay(1000); | ||
296 | voyager_SUS->kernel_mbox = VOYAGER_IGNORE_DUMP; | ||
297 | voyager_SUS->kernel_flags &= ~VOYAGER_OS_IN_PROGRESS; | ||
298 | } | ||
299 | } | ||
300 | printk(KERN_ERR | ||
301 | "VOYAGER: Dump switch pressed, printing CPU%d tracebacks\n", | ||
302 | smp_processor_id()); | ||
303 | show_stack(NULL, NULL); | ||
304 | show_state(); | ||
305 | } | ||
306 | |||
307 | void machine_halt(void) | ||
308 | { | ||
309 | /* treat a halt like a power off */ | ||
310 | machine_power_off(); | ||
311 | } | ||
312 | |||
313 | void machine_power_off(void) | ||
314 | { | ||
315 | if (pm_power_off) | ||
316 | pm_power_off(); | ||
317 | } | ||
diff --git a/arch/x86/mach-voyager/voyager_cat.c b/arch/x86/mach-voyager/voyager_cat.c deleted file mode 100644 index 2ad598c104af..000000000000 --- a/arch/x86/mach-voyager/voyager_cat.c +++ /dev/null | |||
@@ -1,1197 +0,0 @@ | |||
1 | /* -*- mode: c; c-basic-offset: 8 -*- */ | ||
2 | |||
3 | /* Copyright (C) 1999,2001 | ||
4 | * | ||
5 | * Author: J.E.J.Bottomley@HansenPartnership.com | ||
6 | * | ||
7 | * This file contains all the logic for manipulating the CAT bus | ||
8 | * in a level 5 machine. | ||
9 | * | ||
10 | * The CAT bus is a serial configuration and test bus. Its primary | ||
11 | * uses are to probe the initial configuration of the system and to | ||
12 | * diagnose error conditions when a system interrupt occurs. The low | ||
13 | * level interface is fairly primitive, so most of this file consists | ||
14 | * of bit shift manipulations to send and receive packets on the | ||
15 | * serial bus */ | ||
16 | |||
17 | #include <linux/types.h> | ||
18 | #include <linux/completion.h> | ||
19 | #include <linux/sched.h> | ||
20 | #include <asm/voyager.h> | ||
21 | #include <asm/vic.h> | ||
22 | #include <linux/ioport.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/slab.h> | ||
25 | #include <linux/delay.h> | ||
26 | #include <asm/io.h> | ||
27 | |||
28 | #ifdef VOYAGER_CAT_DEBUG | ||
29 | #define CDEBUG(x) printk x | ||
30 | #else | ||
31 | #define CDEBUG(x) | ||
32 | #endif | ||
33 | |||
34 | /* the CAT command port */ | ||
35 | #define CAT_CMD (sspb + 0xe) | ||
36 | /* the CAT data port */ | ||
37 | #define CAT_DATA (sspb + 0xd) | ||
38 | |||
39 | /* the internal cat functions */ | ||
40 | static void cat_pack(__u8 * msg, __u16 start_bit, __u8 * data, __u16 num_bits); | ||
41 | static void cat_unpack(__u8 * msg, __u16 start_bit, __u8 * data, | ||
42 | __u16 num_bits); | ||
43 | static void cat_build_header(__u8 * header, const __u16 len, | ||
44 | const __u16 smallest_reg_bits, | ||
45 | const __u16 longest_reg_bits); | ||
46 | static int cat_sendinst(voyager_module_t * modp, voyager_asic_t * asicp, | ||
47 | __u8 reg, __u8 op); | ||
48 | static int cat_getdata(voyager_module_t * modp, voyager_asic_t * asicp, | ||
49 | __u8 reg, __u8 * value); | ||
50 | static int cat_shiftout(__u8 * data, __u16 data_bytes, __u16 header_bytes, | ||
51 | __u8 pad_bits); | ||
52 | static int cat_write(voyager_module_t * modp, voyager_asic_t * asicp, __u8 reg, | ||
53 | __u8 value); | ||
54 | static int cat_read(voyager_module_t * modp, voyager_asic_t * asicp, __u8 reg, | ||
55 | __u8 * value); | ||
56 | static int cat_subread(voyager_module_t * modp, voyager_asic_t * asicp, | ||
57 | __u16 offset, __u16 len, void *buf); | ||
58 | static int cat_senddata(voyager_module_t * modp, voyager_asic_t * asicp, | ||
59 | __u8 reg, __u8 value); | ||
60 | static int cat_disconnect(voyager_module_t * modp, voyager_asic_t * asicp); | ||
61 | static int cat_connect(voyager_module_t * modp, voyager_asic_t * asicp); | ||
62 | |||
63 | static inline const char *cat_module_name(int module_id) | ||
64 | { | ||
65 | switch (module_id) { | ||
66 | case 0x10: | ||
67 | return "Processor Slot 0"; | ||
68 | case 0x11: | ||
69 | return "Processor Slot 1"; | ||
70 | case 0x12: | ||
71 | return "Processor Slot 2"; | ||
72 | case 0x13: | ||
73 | return "Processor Slot 4"; | ||
74 | case 0x14: | ||
75 | return "Memory Slot 0"; | ||
76 | case 0x15: | ||
77 | return "Memory Slot 1"; | ||
78 | case 0x18: | ||
79 | return "Primary Microchannel"; | ||
80 | case 0x19: | ||
81 | return "Secondary Microchannel"; | ||
82 | case 0x1a: | ||
83 | return "Power Supply Interface"; | ||
84 | case 0x1c: | ||
85 | return "Processor Slot 5"; | ||
86 | case 0x1d: | ||
87 | return "Processor Slot 6"; | ||
88 | case 0x1e: | ||
89 | return "Processor Slot 7"; | ||
90 | case 0x1f: | ||
91 | return "Processor Slot 8"; | ||
92 | default: | ||
93 | return "Unknown Module"; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | static int sspb = 0; /* stores the super port location */ | ||
98 | int voyager_8slot = 0; /* set to true if a 51xx monster */ | ||
99 | |||
100 | voyager_module_t *voyager_cat_list; | ||
101 | |||
102 | /* the I/O port assignments for the VIC and QIC */ | ||
103 | static struct resource vic_res = { | ||
104 | .name = "Voyager Interrupt Controller", | ||
105 | .start = 0xFC00, | ||
106 | .end = 0xFC6F | ||
107 | }; | ||
108 | static struct resource qic_res = { | ||
109 | .name = "Quad Interrupt Controller", | ||
110 | .start = 0xFC70, | ||
111 | .end = 0xFCFF | ||
112 | }; | ||
113 | |||
114 | /* This function is used to pack a data bit stream inside a message. | ||
115 | * It writes num_bits of the data buffer in msg starting at start_bit. | ||
116 | * Note: This function assumes that any unused bit in the data stream | ||
117 | * is set to zero so that the ors will work correctly */ | ||
118 | static void | ||
119 | cat_pack(__u8 * msg, const __u16 start_bit, __u8 * data, const __u16 num_bits) | ||
120 | { | ||
121 | /* compute initial shift needed */ | ||
122 | const __u16 offset = start_bit % BITS_PER_BYTE; | ||
123 | __u16 len = num_bits / BITS_PER_BYTE; | ||
124 | __u16 byte = start_bit / BITS_PER_BYTE; | ||
125 | __u16 residue = (num_bits % BITS_PER_BYTE) + offset; | ||
126 | int i; | ||
127 | |||
128 | /* adjust if we have more than a byte of residue */ | ||
129 | if (residue >= BITS_PER_BYTE) { | ||
130 | residue -= BITS_PER_BYTE; | ||
131 | len++; | ||
132 | } | ||
133 | |||
134 | /* clear out the bits. We assume here that if len==0 then | ||
135 | * residue >= offset. This is always true for the catbus | ||
136 | * operations */ | ||
137 | msg[byte] &= 0xff << (BITS_PER_BYTE - offset); | ||
138 | msg[byte++] |= data[0] >> offset; | ||
139 | if (len == 0) | ||
140 | return; | ||
141 | for (i = 1; i < len; i++) | ||
142 | msg[byte++] = (data[i - 1] << (BITS_PER_BYTE - offset)) | ||
143 | | (data[i] >> offset); | ||
144 | if (residue != 0) { | ||
145 | __u8 mask = 0xff >> residue; | ||
146 | __u8 last_byte = data[i - 1] << (BITS_PER_BYTE - offset) | ||
147 | | (data[i] >> offset); | ||
148 | |||
149 | last_byte &= ~mask; | ||
150 | msg[byte] &= mask; | ||
151 | msg[byte] |= last_byte; | ||
152 | } | ||
153 | return; | ||
154 | } | ||
155 | |||
156 | /* unpack the data again (same arguments as cat_pack()). data buffer | ||
157 | * must be zero populated. | ||
158 | * | ||
159 | * Function: given a message string move to start_bit and copy num_bits into | ||
160 | * data (starting at bit 0 in data). | ||
161 | */ | ||
162 | static void | ||
163 | cat_unpack(__u8 * msg, const __u16 start_bit, __u8 * data, const __u16 num_bits) | ||
164 | { | ||
165 | /* compute initial shift needed */ | ||
166 | const __u16 offset = start_bit % BITS_PER_BYTE; | ||
167 | __u16 len = num_bits / BITS_PER_BYTE; | ||
168 | const __u8 last_bits = num_bits % BITS_PER_BYTE; | ||
169 | __u16 byte = start_bit / BITS_PER_BYTE; | ||
170 | int i; | ||
171 | |||
172 | if (last_bits != 0) | ||
173 | len++; | ||
174 | |||
175 | /* special case: want < 8 bits from msg and we can get it from | ||
176 | * a single byte of the msg */ | ||
177 | if (len == 0 && BITS_PER_BYTE - offset >= num_bits) { | ||
178 | data[0] = msg[byte] << offset; | ||
179 | data[0] &= 0xff >> (BITS_PER_BYTE - num_bits); | ||
180 | return; | ||
181 | } | ||
182 | for (i = 0; i < len; i++) { | ||
183 | /* this annoying if has to be done just in case a read of | ||
184 | * msg one beyond the array causes a panic */ | ||
185 | if (offset != 0) { | ||
186 | data[i] = msg[byte++] << offset; | ||
187 | data[i] |= msg[byte] >> (BITS_PER_BYTE - offset); | ||
188 | } else { | ||
189 | data[i] = msg[byte++]; | ||
190 | } | ||
191 | } | ||
192 | /* do we need to truncate the final byte */ | ||
193 | if (last_bits != 0) { | ||
194 | data[i - 1] &= 0xff << (BITS_PER_BYTE - last_bits); | ||
195 | } | ||
196 | return; | ||
197 | } | ||
198 | |||
199 | static void | ||
200 | cat_build_header(__u8 * header, const __u16 len, const __u16 smallest_reg_bits, | ||
201 | const __u16 longest_reg_bits) | ||
202 | { | ||
203 | int i; | ||
204 | __u16 start_bit = (smallest_reg_bits - 1) % BITS_PER_BYTE; | ||
205 | __u8 *last_byte = &header[len - 1]; | ||
206 | |||
207 | if (start_bit == 0) | ||
208 | start_bit = 1; /* must have at least one bit in the hdr */ | ||
209 | |||
210 | for (i = 0; i < len; i++) | ||
211 | header[i] = 0; | ||
212 | |||
213 | for (i = start_bit; i > 0; i--) | ||
214 | *last_byte = ((*last_byte) << 1) + 1; | ||
215 | |||
216 | } | ||
217 | |||
218 | static int | ||
219 | cat_sendinst(voyager_module_t * modp, voyager_asic_t * asicp, __u8 reg, __u8 op) | ||
220 | { | ||
221 | __u8 parity, inst, inst_buf[4] = { 0 }; | ||
222 | __u8 iseq[VOYAGER_MAX_SCAN_PATH], hseq[VOYAGER_MAX_REG_SIZE]; | ||
223 | __u16 ibytes, hbytes, padbits; | ||
224 | int i; | ||
225 | |||
226 | /* | ||
227 | * Parity is the parity of the register number + 1 (READ_REGISTER | ||
228 | * and WRITE_REGISTER always add '1' to the number of bits == 1) | ||
229 | */ | ||
230 | parity = (__u8) (1 + (reg & 0x01) + | ||
231 | ((__u8) (reg & 0x02) >> 1) + | ||
232 | ((__u8) (reg & 0x04) >> 2) + | ||
233 | ((__u8) (reg & 0x08) >> 3)) % 2; | ||
234 | |||
235 | inst = ((parity << 7) | (reg << 2) | op); | ||
236 | |||
237 | outb(VOYAGER_CAT_IRCYC, CAT_CMD); | ||
238 | if (!modp->scan_path_connected) { | ||
239 | if (asicp->asic_id != VOYAGER_CAT_ID) { | ||
240 | printk | ||
241 | ("**WARNING***: cat_sendinst has disconnected scan path not to CAT asic\n"); | ||
242 | return 1; | ||
243 | } | ||
244 | outb(VOYAGER_CAT_HEADER, CAT_DATA); | ||
245 | outb(inst, CAT_DATA); | ||
246 | if (inb(CAT_DATA) != VOYAGER_CAT_HEADER) { | ||
247 | CDEBUG(("VOYAGER CAT: cat_sendinst failed to get CAT_HEADER\n")); | ||
248 | return 1; | ||
249 | } | ||
250 | return 0; | ||
251 | } | ||
252 | ibytes = modp->inst_bits / BITS_PER_BYTE; | ||
253 | if ((padbits = modp->inst_bits % BITS_PER_BYTE) != 0) { | ||
254 | padbits = BITS_PER_BYTE - padbits; | ||
255 | ibytes++; | ||
256 | } | ||
257 | hbytes = modp->largest_reg / BITS_PER_BYTE; | ||
258 | if (modp->largest_reg % BITS_PER_BYTE) | ||
259 | hbytes++; | ||
260 | CDEBUG(("cat_sendinst: ibytes=%d, hbytes=%d\n", ibytes, hbytes)); | ||
261 | /* initialise the instruction sequence to 0xff */ | ||
262 | for (i = 0; i < ibytes + hbytes; i++) | ||
263 | iseq[i] = 0xff; | ||
264 | cat_build_header(hseq, hbytes, modp->smallest_reg, modp->largest_reg); | ||
265 | cat_pack(iseq, modp->inst_bits, hseq, hbytes * BITS_PER_BYTE); | ||
266 | inst_buf[0] = inst; | ||
267 | inst_buf[1] = 0xFF >> (modp->largest_reg % BITS_PER_BYTE); | ||
268 | cat_pack(iseq, asicp->bit_location, inst_buf, asicp->ireg_length); | ||
269 | #ifdef VOYAGER_CAT_DEBUG | ||
270 | printk("ins = 0x%x, iseq: ", inst); | ||
271 | for (i = 0; i < ibytes + hbytes; i++) | ||
272 | printk("0x%x ", iseq[i]); | ||
273 | printk("\n"); | ||
274 | #endif | ||
275 | if (cat_shiftout(iseq, ibytes, hbytes, padbits)) { | ||
276 | CDEBUG(("VOYAGER CAT: cat_sendinst: cat_shiftout failed\n")); | ||
277 | return 1; | ||
278 | } | ||
279 | CDEBUG(("CAT SHIFTOUT DONE\n")); | ||
280 | return 0; | ||
281 | } | ||
282 | |||
283 | static int | ||
284 | cat_getdata(voyager_module_t * modp, voyager_asic_t * asicp, __u8 reg, | ||
285 | __u8 * value) | ||
286 | { | ||
287 | if (!modp->scan_path_connected) { | ||
288 | if (asicp->asic_id != VOYAGER_CAT_ID) { | ||
289 | CDEBUG(("VOYAGER CAT: ERROR: cat_getdata to CAT asic with scan path connected\n")); | ||
290 | return 1; | ||
291 | } | ||
292 | if (reg > VOYAGER_SUBADDRHI) | ||
293 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
294 | outb(VOYAGER_CAT_DRCYC, CAT_CMD); | ||
295 | outb(VOYAGER_CAT_HEADER, CAT_DATA); | ||
296 | *value = inb(CAT_DATA); | ||
297 | outb(0xAA, CAT_DATA); | ||
298 | if (inb(CAT_DATA) != VOYAGER_CAT_HEADER) { | ||
299 | CDEBUG(("cat_getdata: failed to get VOYAGER_CAT_HEADER\n")); | ||
300 | return 1; | ||
301 | } | ||
302 | return 0; | ||
303 | } else { | ||
304 | __u16 sbits = modp->num_asics - 1 + asicp->ireg_length; | ||
305 | __u16 sbytes = sbits / BITS_PER_BYTE; | ||
306 | __u16 tbytes; | ||
307 | __u8 string[VOYAGER_MAX_SCAN_PATH], | ||
308 | trailer[VOYAGER_MAX_REG_SIZE]; | ||
309 | __u8 padbits; | ||
310 | int i; | ||
311 | |||
312 | outb(VOYAGER_CAT_DRCYC, CAT_CMD); | ||
313 | |||
314 | if ((padbits = sbits % BITS_PER_BYTE) != 0) { | ||
315 | padbits = BITS_PER_BYTE - padbits; | ||
316 | sbytes++; | ||
317 | } | ||
318 | tbytes = asicp->ireg_length / BITS_PER_BYTE; | ||
319 | if (asicp->ireg_length % BITS_PER_BYTE) | ||
320 | tbytes++; | ||
321 | CDEBUG(("cat_getdata: tbytes = %d, sbytes = %d, padbits = %d\n", | ||
322 | tbytes, sbytes, padbits)); | ||
323 | cat_build_header(trailer, tbytes, 1, asicp->ireg_length); | ||
324 | |||
325 | for (i = tbytes - 1; i >= 0; i--) { | ||
326 | outb(trailer[i], CAT_DATA); | ||
327 | string[sbytes + i] = inb(CAT_DATA); | ||
328 | } | ||
329 | |||
330 | for (i = sbytes - 1; i >= 0; i--) { | ||
331 | outb(0xaa, CAT_DATA); | ||
332 | string[i] = inb(CAT_DATA); | ||
333 | } | ||
334 | *value = 0; | ||
335 | cat_unpack(string, | ||
336 | padbits + (tbytes * BITS_PER_BYTE) + | ||
337 | asicp->asic_location, value, asicp->ireg_length); | ||
338 | #ifdef VOYAGER_CAT_DEBUG | ||
339 | printk("value=0x%x, string: ", *value); | ||
340 | for (i = 0; i < tbytes + sbytes; i++) | ||
341 | printk("0x%x ", string[i]); | ||
342 | printk("\n"); | ||
343 | #endif | ||
344 | |||
345 | /* sanity check the rest of the return */ | ||
346 | for (i = 0; i < tbytes; i++) { | ||
347 | __u8 input = 0; | ||
348 | |||
349 | cat_unpack(string, padbits + (i * BITS_PER_BYTE), | ||
350 | &input, BITS_PER_BYTE); | ||
351 | if (trailer[i] != input) { | ||
352 | CDEBUG(("cat_getdata: failed to sanity check rest of ret(%d) 0x%x != 0x%x\n", i, input, trailer[i])); | ||
353 | return 1; | ||
354 | } | ||
355 | } | ||
356 | CDEBUG(("cat_getdata DONE\n")); | ||
357 | return 0; | ||
358 | } | ||
359 | } | ||
360 | |||
361 | static int | ||
362 | cat_shiftout(__u8 * data, __u16 data_bytes, __u16 header_bytes, __u8 pad_bits) | ||
363 | { | ||
364 | int i; | ||
365 | |||
366 | for (i = data_bytes + header_bytes - 1; i >= header_bytes; i--) | ||
367 | outb(data[i], CAT_DATA); | ||
368 | |||
369 | for (i = header_bytes - 1; i >= 0; i--) { | ||
370 | __u8 header = 0; | ||
371 | __u8 input; | ||
372 | |||
373 | outb(data[i], CAT_DATA); | ||
374 | input = inb(CAT_DATA); | ||
375 | CDEBUG(("cat_shiftout: returned 0x%x\n", input)); | ||
376 | cat_unpack(data, ((data_bytes + i) * BITS_PER_BYTE) - pad_bits, | ||
377 | &header, BITS_PER_BYTE); | ||
378 | if (input != header) { | ||
379 | CDEBUG(("VOYAGER CAT: cat_shiftout failed to return header 0x%x != 0x%x\n", input, header)); | ||
380 | return 1; | ||
381 | } | ||
382 | } | ||
383 | return 0; | ||
384 | } | ||
385 | |||
386 | static int | ||
387 | cat_senddata(voyager_module_t * modp, voyager_asic_t * asicp, | ||
388 | __u8 reg, __u8 value) | ||
389 | { | ||
390 | outb(VOYAGER_CAT_DRCYC, CAT_CMD); | ||
391 | if (!modp->scan_path_connected) { | ||
392 | if (asicp->asic_id != VOYAGER_CAT_ID) { | ||
393 | CDEBUG(("VOYAGER CAT: ERROR: scan path disconnected when asic != CAT\n")); | ||
394 | return 1; | ||
395 | } | ||
396 | outb(VOYAGER_CAT_HEADER, CAT_DATA); | ||
397 | outb(value, CAT_DATA); | ||
398 | if (inb(CAT_DATA) != VOYAGER_CAT_HEADER) { | ||
399 | CDEBUG(("cat_senddata: failed to get correct header response to sent data\n")); | ||
400 | return 1; | ||
401 | } | ||
402 | if (reg > VOYAGER_SUBADDRHI) { | ||
403 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
404 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
405 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
406 | } | ||
407 | |||
408 | return 0; | ||
409 | } else { | ||
410 | __u16 hbytes = asicp->ireg_length / BITS_PER_BYTE; | ||
411 | __u16 dbytes = | ||
412 | (modp->num_asics - 1 + asicp->ireg_length) / BITS_PER_BYTE; | ||
413 | __u8 padbits, dseq[VOYAGER_MAX_SCAN_PATH], | ||
414 | hseq[VOYAGER_MAX_REG_SIZE]; | ||
415 | int i; | ||
416 | |||
417 | if ((padbits = (modp->num_asics - 1 | ||
418 | + asicp->ireg_length) % BITS_PER_BYTE) != 0) { | ||
419 | padbits = BITS_PER_BYTE - padbits; | ||
420 | dbytes++; | ||
421 | } | ||
422 | if (asicp->ireg_length % BITS_PER_BYTE) | ||
423 | hbytes++; | ||
424 | |||
425 | cat_build_header(hseq, hbytes, 1, asicp->ireg_length); | ||
426 | |||
427 | for (i = 0; i < dbytes + hbytes; i++) | ||
428 | dseq[i] = 0xff; | ||
429 | CDEBUG(("cat_senddata: dbytes=%d, hbytes=%d, padbits=%d\n", | ||
430 | dbytes, hbytes, padbits)); | ||
431 | cat_pack(dseq, modp->num_asics - 1 + asicp->ireg_length, | ||
432 | hseq, hbytes * BITS_PER_BYTE); | ||
433 | cat_pack(dseq, asicp->asic_location, &value, | ||
434 | asicp->ireg_length); | ||
435 | #ifdef VOYAGER_CAT_DEBUG | ||
436 | printk("dseq "); | ||
437 | for (i = 0; i < hbytes + dbytes; i++) { | ||
438 | printk("0x%x ", dseq[i]); | ||
439 | } | ||
440 | printk("\n"); | ||
441 | #endif | ||
442 | return cat_shiftout(dseq, dbytes, hbytes, padbits); | ||
443 | } | ||
444 | } | ||
445 | |||
446 | static int | ||
447 | cat_write(voyager_module_t * modp, voyager_asic_t * asicp, __u8 reg, __u8 value) | ||
448 | { | ||
449 | if (cat_sendinst(modp, asicp, reg, VOYAGER_WRITE_CONFIG)) | ||
450 | return 1; | ||
451 | return cat_senddata(modp, asicp, reg, value); | ||
452 | } | ||
453 | |||
454 | static int | ||
455 | cat_read(voyager_module_t * modp, voyager_asic_t * asicp, __u8 reg, | ||
456 | __u8 * value) | ||
457 | { | ||
458 | if (cat_sendinst(modp, asicp, reg, VOYAGER_READ_CONFIG)) | ||
459 | return 1; | ||
460 | return cat_getdata(modp, asicp, reg, value); | ||
461 | } | ||
462 | |||
463 | static int | ||
464 | cat_subaddrsetup(voyager_module_t * modp, voyager_asic_t * asicp, __u16 offset, | ||
465 | __u16 len) | ||
466 | { | ||
467 | __u8 val; | ||
468 | |||
469 | if (len > 1) { | ||
470 | /* set auto increment */ | ||
471 | __u8 newval; | ||
472 | |||
473 | if (cat_read(modp, asicp, VOYAGER_AUTO_INC_REG, &val)) { | ||
474 | CDEBUG(("cat_subaddrsetup: read of VOYAGER_AUTO_INC_REG failed\n")); | ||
475 | return 1; | ||
476 | } | ||
477 | CDEBUG(("cat_subaddrsetup: VOYAGER_AUTO_INC_REG = 0x%x\n", | ||
478 | val)); | ||
479 | newval = val | VOYAGER_AUTO_INC; | ||
480 | if (newval != val) { | ||
481 | if (cat_write(modp, asicp, VOYAGER_AUTO_INC_REG, val)) { | ||
482 | CDEBUG(("cat_subaddrsetup: write to VOYAGER_AUTO_INC_REG failed\n")); | ||
483 | return 1; | ||
484 | } | ||
485 | } | ||
486 | } | ||
487 | if (cat_write(modp, asicp, VOYAGER_SUBADDRLO, (__u8) (offset & 0xff))) { | ||
488 | CDEBUG(("cat_subaddrsetup: write to SUBADDRLO failed\n")); | ||
489 | return 1; | ||
490 | } | ||
491 | if (asicp->subaddr > VOYAGER_SUBADDR_LO) { | ||
492 | if (cat_write | ||
493 | (modp, asicp, VOYAGER_SUBADDRHI, (__u8) (offset >> 8))) { | ||
494 | CDEBUG(("cat_subaddrsetup: write to SUBADDRHI failed\n")); | ||
495 | return 1; | ||
496 | } | ||
497 | cat_read(modp, asicp, VOYAGER_SUBADDRHI, &val); | ||
498 | CDEBUG(("cat_subaddrsetup: offset = %d, hi = %d\n", offset, | ||
499 | val)); | ||
500 | } | ||
501 | cat_read(modp, asicp, VOYAGER_SUBADDRLO, &val); | ||
502 | CDEBUG(("cat_subaddrsetup: offset = %d, lo = %d\n", offset, val)); | ||
503 | return 0; | ||
504 | } | ||
505 | |||
506 | static int | ||
507 | cat_subwrite(voyager_module_t * modp, voyager_asic_t * asicp, __u16 offset, | ||
508 | __u16 len, void *buf) | ||
509 | { | ||
510 | int i, retval; | ||
511 | |||
512 | /* FIXME: need special actions for VOYAGER_CAT_ID here */ | ||
513 | if (asicp->asic_id == VOYAGER_CAT_ID) { | ||
514 | CDEBUG(("cat_subwrite: ATTEMPT TO WRITE TO CAT ASIC\n")); | ||
515 | /* FIXME -- This is supposed to be handled better | ||
516 | * There is a problem writing to the cat asic in the | ||
517 | * PSI. The 30us delay seems to work, though */ | ||
518 | udelay(30); | ||
519 | } | ||
520 | |||
521 | if ((retval = cat_subaddrsetup(modp, asicp, offset, len)) != 0) { | ||
522 | printk("cat_subwrite: cat_subaddrsetup FAILED\n"); | ||
523 | return retval; | ||
524 | } | ||
525 | |||
526 | if (cat_sendinst | ||
527 | (modp, asicp, VOYAGER_SUBADDRDATA, VOYAGER_WRITE_CONFIG)) { | ||
528 | printk("cat_subwrite: cat_sendinst FAILED\n"); | ||
529 | return 1; | ||
530 | } | ||
531 | for (i = 0; i < len; i++) { | ||
532 | if (cat_senddata(modp, asicp, 0xFF, ((__u8 *) buf)[i])) { | ||
533 | printk | ||
534 | ("cat_subwrite: cat_sendata element at %d FAILED\n", | ||
535 | i); | ||
536 | return 1; | ||
537 | } | ||
538 | } | ||
539 | return 0; | ||
540 | } | ||
541 | static int | ||
542 | cat_subread(voyager_module_t * modp, voyager_asic_t * asicp, __u16 offset, | ||
543 | __u16 len, void *buf) | ||
544 | { | ||
545 | int i, retval; | ||
546 | |||
547 | if ((retval = cat_subaddrsetup(modp, asicp, offset, len)) != 0) { | ||
548 | CDEBUG(("cat_subread: cat_subaddrsetup FAILED\n")); | ||
549 | return retval; | ||
550 | } | ||
551 | |||
552 | if (cat_sendinst(modp, asicp, VOYAGER_SUBADDRDATA, VOYAGER_READ_CONFIG)) { | ||
553 | CDEBUG(("cat_subread: cat_sendinst failed\n")); | ||
554 | return 1; | ||
555 | } | ||
556 | for (i = 0; i < len; i++) { | ||
557 | if (cat_getdata(modp, asicp, 0xFF, &((__u8 *) buf)[i])) { | ||
558 | CDEBUG(("cat_subread: cat_getdata element %d failed\n", | ||
559 | i)); | ||
560 | return 1; | ||
561 | } | ||
562 | } | ||
563 | return 0; | ||
564 | } | ||
565 | |||
566 | /* buffer for storing EPROM data read in during initialisation */ | ||
567 | static __initdata __u8 eprom_buf[0xFFFF]; | ||
568 | static voyager_module_t *voyager_initial_module; | ||
569 | |||
570 | /* Initialise the cat bus components. We assume this is called by the | ||
571 | * boot cpu *after* all memory initialisation has been done (so we can | ||
572 | * use kmalloc) but before smp initialisation, so we can probe the SMP | ||
573 | * configuration and pick up necessary information. */ | ||
574 | void __init voyager_cat_init(void) | ||
575 | { | ||
576 | voyager_module_t **modpp = &voyager_initial_module; | ||
577 | voyager_asic_t **asicpp; | ||
578 | voyager_asic_t *qabc_asic = NULL; | ||
579 | int i, j; | ||
580 | unsigned long qic_addr = 0; | ||
581 | __u8 qabc_data[0x20]; | ||
582 | __u8 num_submodules, val; | ||
583 | voyager_eprom_hdr_t *eprom_hdr = (voyager_eprom_hdr_t *) & eprom_buf[0]; | ||
584 | |||
585 | __u8 cmos[4]; | ||
586 | unsigned long addr; | ||
587 | |||
588 | /* initiallise the SUS mailbox */ | ||
589 | for (i = 0; i < sizeof(cmos); i++) | ||
590 | cmos[i] = voyager_extended_cmos_read(VOYAGER_DUMP_LOCATION + i); | ||
591 | addr = *(unsigned long *)cmos; | ||
592 | if ((addr & 0xff000000) != 0xff000000) { | ||
593 | printk(KERN_ERR | ||
594 | "Voyager failed to get SUS mailbox (addr = 0x%lx\n", | ||
595 | addr); | ||
596 | } else { | ||
597 | static struct resource res; | ||
598 | |||
599 | res.name = "voyager SUS"; | ||
600 | res.start = addr; | ||
601 | res.end = addr + 0x3ff; | ||
602 | |||
603 | request_resource(&iomem_resource, &res); | ||
604 | voyager_SUS = (struct voyager_SUS *) | ||
605 | ioremap(addr, 0x400); | ||
606 | printk(KERN_NOTICE "Voyager SUS mailbox version 0x%x\n", | ||
607 | voyager_SUS->SUS_version); | ||
608 | voyager_SUS->kernel_version = VOYAGER_MAILBOX_VERSION; | ||
609 | voyager_SUS->kernel_flags = VOYAGER_OS_HAS_SYSINT; | ||
610 | } | ||
611 | |||
612 | /* clear the processor counts */ | ||
613 | voyager_extended_vic_processors = 0; | ||
614 | voyager_quad_processors = 0; | ||
615 | |||
616 | printk("VOYAGER: beginning CAT bus probe\n"); | ||
617 | /* set up the SuperSet Port Block which tells us where the | ||
618 | * CAT communication port is */ | ||
619 | sspb = inb(VOYAGER_SSPB_RELOCATION_PORT) * 0x100; | ||
620 | VDEBUG(("VOYAGER DEBUG: sspb = 0x%x\n", sspb)); | ||
621 | |||
622 | /* now find out if were 8 slot or normal */ | ||
623 | if ((inb(VIC_PROC_WHO_AM_I) & EIGHT_SLOT_IDENTIFIER) | ||
624 | == EIGHT_SLOT_IDENTIFIER) { | ||
625 | voyager_8slot = 1; | ||
626 | printk(KERN_NOTICE | ||
627 | "Voyager: Eight slot 51xx configuration detected\n"); | ||
628 | } | ||
629 | |||
630 | for (i = VOYAGER_MIN_MODULE; i <= VOYAGER_MAX_MODULE; i++) { | ||
631 | __u8 input; | ||
632 | int asic; | ||
633 | __u16 eprom_size; | ||
634 | __u16 sp_offset; | ||
635 | |||
636 | outb(VOYAGER_CAT_DESELECT, VOYAGER_CAT_CONFIG_PORT); | ||
637 | outb(i, VOYAGER_CAT_CONFIG_PORT); | ||
638 | |||
639 | /* check the presence of the module */ | ||
640 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
641 | outb(VOYAGER_CAT_IRCYC, CAT_CMD); | ||
642 | outb(VOYAGER_CAT_HEADER, CAT_DATA); | ||
643 | /* stream series of alternating 1's and 0's to stimulate | ||
644 | * response */ | ||
645 | outb(0xAA, CAT_DATA); | ||
646 | input = inb(CAT_DATA); | ||
647 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
648 | if (input != VOYAGER_CAT_HEADER) { | ||
649 | continue; | ||
650 | } | ||
651 | CDEBUG(("VOYAGER DEBUG: found module id 0x%x, %s\n", i, | ||
652 | cat_module_name(i))); | ||
653 | *modpp = kmalloc(sizeof(voyager_module_t), GFP_KERNEL); /*&voyager_module_storage[cat_count++]; */ | ||
654 | if (*modpp == NULL) { | ||
655 | printk("**WARNING** kmalloc failure in cat_init\n"); | ||
656 | continue; | ||
657 | } | ||
658 | memset(*modpp, 0, sizeof(voyager_module_t)); | ||
659 | /* need temporary asic for cat_subread. It will be | ||
660 | * filled in correctly later */ | ||
661 | (*modpp)->asic = kmalloc(sizeof(voyager_asic_t), GFP_KERNEL); /*&voyager_asic_storage[asic_count]; */ | ||
662 | if ((*modpp)->asic == NULL) { | ||
663 | printk("**WARNING** kmalloc failure in cat_init\n"); | ||
664 | continue; | ||
665 | } | ||
666 | memset((*modpp)->asic, 0, sizeof(voyager_asic_t)); | ||
667 | (*modpp)->asic->asic_id = VOYAGER_CAT_ID; | ||
668 | (*modpp)->asic->subaddr = VOYAGER_SUBADDR_HI; | ||
669 | (*modpp)->module_addr = i; | ||
670 | (*modpp)->scan_path_connected = 0; | ||
671 | if (i == VOYAGER_PSI) { | ||
672 | /* Exception leg for modules with no EEPROM */ | ||
673 | printk("Module \"%s\"\n", cat_module_name(i)); | ||
674 | continue; | ||
675 | } | ||
676 | |||
677 | CDEBUG(("cat_init: Reading eeprom for module 0x%x at offset %d\n", i, VOYAGER_XSUM_END_OFFSET)); | ||
678 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
679 | cat_disconnect(*modpp, (*modpp)->asic); | ||
680 | if (cat_subread(*modpp, (*modpp)->asic, | ||
681 | VOYAGER_XSUM_END_OFFSET, sizeof(eprom_size), | ||
682 | &eprom_size)) { | ||
683 | printk | ||
684 | ("**WARNING**: Voyager couldn't read EPROM size for module 0x%x\n", | ||
685 | i); | ||
686 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
687 | continue; | ||
688 | } | ||
689 | if (eprom_size > sizeof(eprom_buf)) { | ||
690 | printk | ||
691 | ("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n", | ||
692 | i, eprom_size); | ||
693 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
694 | continue; | ||
695 | } | ||
696 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
697 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
698 | CDEBUG(("cat_init: module 0x%x, eeprom_size %d\n", i, | ||
699 | eprom_size)); | ||
700 | if (cat_subread | ||
701 | (*modpp, (*modpp)->asic, 0, eprom_size, eprom_buf)) { | ||
702 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
703 | continue; | ||
704 | } | ||
705 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
706 | printk("Module \"%s\", version 0x%x, tracer 0x%x, asics %d\n", | ||
707 | cat_module_name(i), eprom_hdr->version_id, | ||
708 | *((__u32 *) eprom_hdr->tracer), eprom_hdr->num_asics); | ||
709 | (*modpp)->ee_size = eprom_hdr->ee_size; | ||
710 | (*modpp)->num_asics = eprom_hdr->num_asics; | ||
711 | asicpp = &((*modpp)->asic); | ||
712 | sp_offset = eprom_hdr->scan_path_offset; | ||
713 | /* All we really care about are the Quad cards. We | ||
714 | * identify them because they are in a processor slot | ||
715 | * and have only four asics */ | ||
716 | if ((i < 0x10 || (i >= 0x14 && i < 0x1c) || i > 0x1f)) { | ||
717 | modpp = &((*modpp)->next); | ||
718 | continue; | ||
719 | } | ||
720 | /* Now we know it's in a processor slot, does it have | ||
721 | * a quad baseboard submodule */ | ||
722 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
723 | cat_read(*modpp, (*modpp)->asic, VOYAGER_SUBMODPRESENT, | ||
724 | &num_submodules); | ||
725 | /* lowest two bits, active low */ | ||
726 | num_submodules = ~(0xfc | num_submodules); | ||
727 | CDEBUG(("VOYAGER CAT: %d submodules present\n", | ||
728 | num_submodules)); | ||
729 | if (num_submodules == 0) { | ||
730 | /* fill in the dyadic extended processors */ | ||
731 | __u8 cpu = i & 0x07; | ||
732 | |||
733 | printk("Module \"%s\": Dyadic Processor Card\n", | ||
734 | cat_module_name(i)); | ||
735 | voyager_extended_vic_processors |= (1 << cpu); | ||
736 | cpu += 4; | ||
737 | voyager_extended_vic_processors |= (1 << cpu); | ||
738 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
739 | continue; | ||
740 | } | ||
741 | |||
742 | /* now we want to read the asics on the first submodule, | ||
743 | * which should be the quad base board */ | ||
744 | |||
745 | cat_read(*modpp, (*modpp)->asic, VOYAGER_SUBMODSELECT, &val); | ||
746 | CDEBUG(("cat_init: SUBMODSELECT value = 0x%x\n", val)); | ||
747 | val = (val & 0x7c) | VOYAGER_QUAD_BASEBOARD; | ||
748 | cat_write(*modpp, (*modpp)->asic, VOYAGER_SUBMODSELECT, val); | ||
749 | |||
750 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
751 | |||
752 | CDEBUG(("cat_init: Reading eeprom for module 0x%x at offset %d\n", i, VOYAGER_XSUM_END_OFFSET)); | ||
753 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
754 | cat_disconnect(*modpp, (*modpp)->asic); | ||
755 | if (cat_subread(*modpp, (*modpp)->asic, | ||
756 | VOYAGER_XSUM_END_OFFSET, sizeof(eprom_size), | ||
757 | &eprom_size)) { | ||
758 | printk | ||
759 | ("**WARNING**: Voyager couldn't read EPROM size for module 0x%x\n", | ||
760 | i); | ||
761 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
762 | continue; | ||
763 | } | ||
764 | if (eprom_size > sizeof(eprom_buf)) { | ||
765 | printk | ||
766 | ("**WARNING**: Voyager insufficient size to read EPROM data, module 0x%x. Need %d\n", | ||
767 | i, eprom_size); | ||
768 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
769 | continue; | ||
770 | } | ||
771 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
772 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
773 | CDEBUG(("cat_init: module 0x%x, eeprom_size %d\n", i, | ||
774 | eprom_size)); | ||
775 | if (cat_subread | ||
776 | (*modpp, (*modpp)->asic, 0, eprom_size, eprom_buf)) { | ||
777 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
778 | continue; | ||
779 | } | ||
780 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
781 | /* Now do everything for the QBB submodule 1 */ | ||
782 | (*modpp)->ee_size = eprom_hdr->ee_size; | ||
783 | (*modpp)->num_asics = eprom_hdr->num_asics; | ||
784 | asicpp = &((*modpp)->asic); | ||
785 | sp_offset = eprom_hdr->scan_path_offset; | ||
786 | /* get rid of the dummy CAT asic and read the real one */ | ||
787 | kfree((*modpp)->asic); | ||
788 | for (asic = 0; asic < (*modpp)->num_asics; asic++) { | ||
789 | int j; | ||
790 | voyager_asic_t *asicp = *asicpp = kzalloc(sizeof(voyager_asic_t), GFP_KERNEL); /*&voyager_asic_storage[asic_count++]; */ | ||
791 | voyager_sp_table_t *sp_table; | ||
792 | voyager_at_t *asic_table; | ||
793 | voyager_jtt_t *jtag_table; | ||
794 | |||
795 | if (asicp == NULL) { | ||
796 | printk | ||
797 | ("**WARNING** kmalloc failure in cat_init\n"); | ||
798 | continue; | ||
799 | } | ||
800 | asicpp = &(asicp->next); | ||
801 | asicp->asic_location = asic; | ||
802 | sp_table = | ||
803 | (voyager_sp_table_t *) (eprom_buf + sp_offset); | ||
804 | asicp->asic_id = sp_table->asic_id; | ||
805 | asic_table = | ||
806 | (voyager_at_t *) (eprom_buf + | ||
807 | sp_table->asic_data_offset); | ||
808 | for (j = 0; j < 4; j++) | ||
809 | asicp->jtag_id[j] = asic_table->jtag_id[j]; | ||
810 | jtag_table = | ||
811 | (voyager_jtt_t *) (eprom_buf + | ||
812 | asic_table->jtag_offset); | ||
813 | asicp->ireg_length = jtag_table->ireg_len; | ||
814 | asicp->bit_location = (*modpp)->inst_bits; | ||
815 | (*modpp)->inst_bits += asicp->ireg_length; | ||
816 | if (asicp->ireg_length > (*modpp)->largest_reg) | ||
817 | (*modpp)->largest_reg = asicp->ireg_length; | ||
818 | if (asicp->ireg_length < (*modpp)->smallest_reg || | ||
819 | (*modpp)->smallest_reg == 0) | ||
820 | (*modpp)->smallest_reg = asicp->ireg_length; | ||
821 | CDEBUG(("asic 0x%x, ireg_length=%d, bit_location=%d\n", | ||
822 | asicp->asic_id, asicp->ireg_length, | ||
823 | asicp->bit_location)); | ||
824 | if (asicp->asic_id == VOYAGER_QUAD_QABC) { | ||
825 | CDEBUG(("VOYAGER CAT: QABC ASIC found\n")); | ||
826 | qabc_asic = asicp; | ||
827 | } | ||
828 | sp_offset += sizeof(voyager_sp_table_t); | ||
829 | } | ||
830 | CDEBUG(("Module inst_bits = %d, largest_reg = %d, smallest_reg=%d\n", (*modpp)->inst_bits, (*modpp)->largest_reg, (*modpp)->smallest_reg)); | ||
831 | /* OK, now we have the QUAD ASICs set up, use them. | ||
832 | * we need to: | ||
833 | * | ||
834 | * 1. Find the Memory area for the Quad CPIs. | ||
835 | * 2. Find the Extended VIC processor | ||
836 | * 3. Configure a second extended VIC processor (This | ||
837 | * cannot be done for the 51xx. | ||
838 | * */ | ||
839 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
840 | cat_connect(*modpp, (*modpp)->asic); | ||
841 | CDEBUG(("CAT CONNECTED!!\n")); | ||
842 | cat_subread(*modpp, qabc_asic, 0, sizeof(qabc_data), qabc_data); | ||
843 | qic_addr = qabc_data[5] << 8; | ||
844 | qic_addr = (qic_addr | qabc_data[6]) << 8; | ||
845 | qic_addr = (qic_addr | qabc_data[7]) << 8; | ||
846 | printk | ||
847 | ("Module \"%s\": Quad Processor Card; CPI 0x%lx, SET=0x%x\n", | ||
848 | cat_module_name(i), qic_addr, qabc_data[8]); | ||
849 | #if 0 /* plumbing fails---FIXME */ | ||
850 | if ((qabc_data[8] & 0xf0) == 0) { | ||
851 | /* FIXME: 32 way 8 CPU slot monster cannot be | ||
852 | * plumbed this way---need to check for it */ | ||
853 | |||
854 | printk("Plumbing second Extended Quad Processor\n"); | ||
855 | /* second VIC line hardwired to Quad CPU 1 */ | ||
856 | qabc_data[8] |= 0x20; | ||
857 | cat_subwrite(*modpp, qabc_asic, 8, 1, &qabc_data[8]); | ||
858 | #ifdef VOYAGER_CAT_DEBUG | ||
859 | /* verify plumbing */ | ||
860 | cat_subread(*modpp, qabc_asic, 8, 1, &qabc_data[8]); | ||
861 | if ((qabc_data[8] & 0xf0) == 0) { | ||
862 | CDEBUG(("PLUMBING FAILED: 0x%x\n", | ||
863 | qabc_data[8])); | ||
864 | } | ||
865 | #endif | ||
866 | } | ||
867 | #endif | ||
868 | |||
869 | { | ||
870 | struct resource *res = | ||
871 | kzalloc(sizeof(struct resource), GFP_KERNEL); | ||
872 | res->name = kmalloc(128, GFP_KERNEL); | ||
873 | sprintf((char *)res->name, "Voyager %s Quad CPI", | ||
874 | cat_module_name(i)); | ||
875 | res->start = qic_addr; | ||
876 | res->end = qic_addr + 0x3ff; | ||
877 | request_resource(&iomem_resource, res); | ||
878 | } | ||
879 | |||
880 | qic_addr = (unsigned long)ioremap_cache(qic_addr, 0x400); | ||
881 | |||
882 | for (j = 0; j < 4; j++) { | ||
883 | __u8 cpu; | ||
884 | |||
885 | if (voyager_8slot) { | ||
886 | /* 8 slot has a different mapping, | ||
887 | * each slot has only one vic line, so | ||
888 | * 1 cpu in each slot must be < 8 */ | ||
889 | cpu = (i & 0x07) + j * 8; | ||
890 | } else { | ||
891 | cpu = (i & 0x03) + j * 4; | ||
892 | } | ||
893 | if ((qabc_data[8] & (1 << j))) { | ||
894 | voyager_extended_vic_processors |= (1 << cpu); | ||
895 | } | ||
896 | if (qabc_data[8] & (1 << (j + 4))) { | ||
897 | /* Second SET register plumbed: Quad | ||
898 | * card has two VIC connected CPUs. | ||
899 | * Secondary cannot be booted as a VIC | ||
900 | * CPU */ | ||
901 | voyager_extended_vic_processors |= (1 << cpu); | ||
902 | voyager_allowed_boot_processors &= | ||
903 | (~(1 << cpu)); | ||
904 | } | ||
905 | |||
906 | voyager_quad_processors |= (1 << cpu); | ||
907 | voyager_quad_cpi_addr[cpu] = (struct voyager_qic_cpi *) | ||
908 | (qic_addr + (j << 8)); | ||
909 | CDEBUG(("CPU%d: CPI address 0x%lx\n", cpu, | ||
910 | (unsigned long)voyager_quad_cpi_addr[cpu])); | ||
911 | } | ||
912 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
913 | |||
914 | *asicpp = NULL; | ||
915 | modpp = &((*modpp)->next); | ||
916 | } | ||
917 | *modpp = NULL; | ||
918 | printk | ||
919 | ("CAT Bus Initialisation finished: extended procs 0x%x, quad procs 0x%x, allowed vic boot = 0x%x\n", | ||
920 | voyager_extended_vic_processors, voyager_quad_processors, | ||
921 | voyager_allowed_boot_processors); | ||
922 | request_resource(&ioport_resource, &vic_res); | ||
923 | if (voyager_quad_processors) | ||
924 | request_resource(&ioport_resource, &qic_res); | ||
925 | /* set up the front power switch */ | ||
926 | } | ||
927 | |||
928 | int voyager_cat_readb(__u8 module, __u8 asic, int reg) | ||
929 | { | ||
930 | return 0; | ||
931 | } | ||
932 | |||
933 | static int cat_disconnect(voyager_module_t * modp, voyager_asic_t * asicp) | ||
934 | { | ||
935 | __u8 val; | ||
936 | int err = 0; | ||
937 | |||
938 | if (!modp->scan_path_connected) | ||
939 | return 0; | ||
940 | if (asicp->asic_id != VOYAGER_CAT_ID) { | ||
941 | CDEBUG(("cat_disconnect: ASIC is not CAT\n")); | ||
942 | return 1; | ||
943 | } | ||
944 | err = cat_read(modp, asicp, VOYAGER_SCANPATH, &val); | ||
945 | if (err) { | ||
946 | CDEBUG(("cat_disconnect: failed to read SCANPATH\n")); | ||
947 | return err; | ||
948 | } | ||
949 | val &= VOYAGER_DISCONNECT_ASIC; | ||
950 | err = cat_write(modp, asicp, VOYAGER_SCANPATH, val); | ||
951 | if (err) { | ||
952 | CDEBUG(("cat_disconnect: failed to write SCANPATH\n")); | ||
953 | return err; | ||
954 | } | ||
955 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
956 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
957 | modp->scan_path_connected = 0; | ||
958 | |||
959 | return 0; | ||
960 | } | ||
961 | |||
962 | static int cat_connect(voyager_module_t * modp, voyager_asic_t * asicp) | ||
963 | { | ||
964 | __u8 val; | ||
965 | int err = 0; | ||
966 | |||
967 | if (modp->scan_path_connected) | ||
968 | return 0; | ||
969 | if (asicp->asic_id != VOYAGER_CAT_ID) { | ||
970 | CDEBUG(("cat_connect: ASIC is not CAT\n")); | ||
971 | return 1; | ||
972 | } | ||
973 | |||
974 | err = cat_read(modp, asicp, VOYAGER_SCANPATH, &val); | ||
975 | if (err) { | ||
976 | CDEBUG(("cat_connect: failed to read SCANPATH\n")); | ||
977 | return err; | ||
978 | } | ||
979 | val |= VOYAGER_CONNECT_ASIC; | ||
980 | err = cat_write(modp, asicp, VOYAGER_SCANPATH, val); | ||
981 | if (err) { | ||
982 | CDEBUG(("cat_connect: failed to write SCANPATH\n")); | ||
983 | return err; | ||
984 | } | ||
985 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
986 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
987 | modp->scan_path_connected = 1; | ||
988 | |||
989 | return 0; | ||
990 | } | ||
991 | |||
992 | void voyager_cat_power_off(void) | ||
993 | { | ||
994 | /* Power the machine off by writing to the PSI over the CAT | ||
995 | * bus */ | ||
996 | __u8 data; | ||
997 | voyager_module_t psi = { 0 }; | ||
998 | voyager_asic_t psi_asic = { 0 }; | ||
999 | |||
1000 | psi.asic = &psi_asic; | ||
1001 | psi.asic->asic_id = VOYAGER_CAT_ID; | ||
1002 | psi.asic->subaddr = VOYAGER_SUBADDR_HI; | ||
1003 | psi.module_addr = VOYAGER_PSI; | ||
1004 | psi.scan_path_connected = 0; | ||
1005 | |||
1006 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1007 | /* Connect the PSI to the CAT Bus */ | ||
1008 | outb(VOYAGER_CAT_DESELECT, VOYAGER_CAT_CONFIG_PORT); | ||
1009 | outb(VOYAGER_PSI, VOYAGER_CAT_CONFIG_PORT); | ||
1010 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
1011 | cat_disconnect(&psi, &psi_asic); | ||
1012 | /* Read the status */ | ||
1013 | cat_subread(&psi, &psi_asic, VOYAGER_PSI_GENERAL_REG, 1, &data); | ||
1014 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1015 | CDEBUG(("PSI STATUS 0x%x\n", data)); | ||
1016 | /* These two writes are power off prep and perform */ | ||
1017 | data = PSI_CLEAR; | ||
1018 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
1019 | cat_subwrite(&psi, &psi_asic, VOYAGER_PSI_GENERAL_REG, 1, &data); | ||
1020 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1021 | data = PSI_POWER_DOWN; | ||
1022 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
1023 | cat_subwrite(&psi, &psi_asic, VOYAGER_PSI_GENERAL_REG, 1, &data); | ||
1024 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1025 | } | ||
1026 | |||
1027 | struct voyager_status voyager_status = { 0 }; | ||
1028 | |||
1029 | void voyager_cat_psi(__u8 cmd, __u16 reg, __u8 * data) | ||
1030 | { | ||
1031 | voyager_module_t psi = { 0 }; | ||
1032 | voyager_asic_t psi_asic = { 0 }; | ||
1033 | |||
1034 | psi.asic = &psi_asic; | ||
1035 | psi.asic->asic_id = VOYAGER_CAT_ID; | ||
1036 | psi.asic->subaddr = VOYAGER_SUBADDR_HI; | ||
1037 | psi.module_addr = VOYAGER_PSI; | ||
1038 | psi.scan_path_connected = 0; | ||
1039 | |||
1040 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1041 | /* Connect the PSI to the CAT Bus */ | ||
1042 | outb(VOYAGER_CAT_DESELECT, VOYAGER_CAT_CONFIG_PORT); | ||
1043 | outb(VOYAGER_PSI, VOYAGER_CAT_CONFIG_PORT); | ||
1044 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
1045 | cat_disconnect(&psi, &psi_asic); | ||
1046 | switch (cmd) { | ||
1047 | case VOYAGER_PSI_READ: | ||
1048 | cat_read(&psi, &psi_asic, reg, data); | ||
1049 | break; | ||
1050 | case VOYAGER_PSI_WRITE: | ||
1051 | cat_write(&psi, &psi_asic, reg, *data); | ||
1052 | break; | ||
1053 | case VOYAGER_PSI_SUBREAD: | ||
1054 | cat_subread(&psi, &psi_asic, reg, 1, data); | ||
1055 | break; | ||
1056 | case VOYAGER_PSI_SUBWRITE: | ||
1057 | cat_subwrite(&psi, &psi_asic, reg, 1, data); | ||
1058 | break; | ||
1059 | default: | ||
1060 | printk(KERN_ERR "Voyager PSI, unrecognised command %d\n", cmd); | ||
1061 | break; | ||
1062 | } | ||
1063 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1064 | } | ||
1065 | |||
1066 | void voyager_cat_do_common_interrupt(void) | ||
1067 | { | ||
1068 | /* This is caused either by a memory parity error or something | ||
1069 | * in the PSI */ | ||
1070 | __u8 data; | ||
1071 | voyager_module_t psi = { 0 }; | ||
1072 | voyager_asic_t psi_asic = { 0 }; | ||
1073 | struct voyager_psi psi_reg; | ||
1074 | int i; | ||
1075 | re_read: | ||
1076 | psi.asic = &psi_asic; | ||
1077 | psi.asic->asic_id = VOYAGER_CAT_ID; | ||
1078 | psi.asic->subaddr = VOYAGER_SUBADDR_HI; | ||
1079 | psi.module_addr = VOYAGER_PSI; | ||
1080 | psi.scan_path_connected = 0; | ||
1081 | |||
1082 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1083 | /* Connect the PSI to the CAT Bus */ | ||
1084 | outb(VOYAGER_CAT_DESELECT, VOYAGER_CAT_CONFIG_PORT); | ||
1085 | outb(VOYAGER_PSI, VOYAGER_CAT_CONFIG_PORT); | ||
1086 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
1087 | cat_disconnect(&psi, &psi_asic); | ||
1088 | /* Read the status. NOTE: Need to read *all* the PSI regs here | ||
1089 | * otherwise the cmn int will be reasserted */ | ||
1090 | for (i = 0; i < sizeof(psi_reg.regs); i++) { | ||
1091 | cat_read(&psi, &psi_asic, i, &((__u8 *) & psi_reg.regs)[i]); | ||
1092 | } | ||
1093 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1094 | if ((psi_reg.regs.checkbit & 0x02) == 0) { | ||
1095 | psi_reg.regs.checkbit |= 0x02; | ||
1096 | cat_write(&psi, &psi_asic, 5, psi_reg.regs.checkbit); | ||
1097 | printk("VOYAGER RE-READ PSI\n"); | ||
1098 | goto re_read; | ||
1099 | } | ||
1100 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
1101 | for (i = 0; i < sizeof(psi_reg.subregs); i++) { | ||
1102 | /* This looks strange, but the PSI doesn't do auto increment | ||
1103 | * correctly */ | ||
1104 | cat_subread(&psi, &psi_asic, VOYAGER_PSI_SUPPLY_REG + i, | ||
1105 | 1, &((__u8 *) & psi_reg.subregs)[i]); | ||
1106 | } | ||
1107 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1108 | #ifdef VOYAGER_CAT_DEBUG | ||
1109 | printk("VOYAGER PSI: "); | ||
1110 | for (i = 0; i < sizeof(psi_reg.regs); i++) | ||
1111 | printk("%02x ", ((__u8 *) & psi_reg.regs)[i]); | ||
1112 | printk("\n "); | ||
1113 | for (i = 0; i < sizeof(psi_reg.subregs); i++) | ||
1114 | printk("%02x ", ((__u8 *) & psi_reg.subregs)[i]); | ||
1115 | printk("\n"); | ||
1116 | #endif | ||
1117 | if (psi_reg.regs.intstatus & PSI_MON) { | ||
1118 | /* switch off or power fail */ | ||
1119 | |||
1120 | if (psi_reg.subregs.supply & PSI_SWITCH_OFF) { | ||
1121 | if (voyager_status.switch_off) { | ||
1122 | printk(KERN_ERR | ||
1123 | "Voyager front panel switch turned off again---Immediate power off!\n"); | ||
1124 | voyager_cat_power_off(); | ||
1125 | /* not reached */ | ||
1126 | } else { | ||
1127 | printk(KERN_ERR | ||
1128 | "Voyager front panel switch turned off\n"); | ||
1129 | voyager_status.switch_off = 1; | ||
1130 | voyager_status.request_from_kernel = 1; | ||
1131 | wake_up_process(voyager_thread); | ||
1132 | } | ||
1133 | /* Tell the hardware we're taking care of the | ||
1134 | * shutdown, otherwise it will power the box off | ||
1135 | * within 3 seconds of the switch being pressed and, | ||
1136 | * which is much more important to us, continue to | ||
1137 | * assert the common interrupt */ | ||
1138 | data = PSI_CLR_SWITCH_OFF; | ||
1139 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
1140 | cat_subwrite(&psi, &psi_asic, VOYAGER_PSI_SUPPLY_REG, | ||
1141 | 1, &data); | ||
1142 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1143 | } else { | ||
1144 | |||
1145 | VDEBUG(("Voyager ac fail reg 0x%x\n", | ||
1146 | psi_reg.subregs.ACfail)); | ||
1147 | if ((psi_reg.subregs.ACfail & AC_FAIL_STAT_CHANGE) == 0) { | ||
1148 | /* No further update */ | ||
1149 | return; | ||
1150 | } | ||
1151 | #if 0 | ||
1152 | /* Don't bother trying to find out who failed. | ||
1153 | * FIXME: This probably makes the code incorrect on | ||
1154 | * anything other than a 345x */ | ||
1155 | for (i = 0; i < 5; i++) { | ||
1156 | if (psi_reg.subregs.ACfail & (1 << i)) { | ||
1157 | break; | ||
1158 | } | ||
1159 | } | ||
1160 | printk(KERN_NOTICE "AC FAIL IN SUPPLY %d\n", i); | ||
1161 | #endif | ||
1162 | /* DON'T do this: it shuts down the AC PSI | ||
1163 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
1164 | data = PSI_MASK_MASK | i; | ||
1165 | cat_subwrite(&psi, &psi_asic, VOYAGER_PSI_MASK, | ||
1166 | 1, &data); | ||
1167 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1168 | */ | ||
1169 | printk(KERN_ERR "Voyager AC power failure\n"); | ||
1170 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
1171 | data = PSI_COLD_START; | ||
1172 | cat_subwrite(&psi, &psi_asic, VOYAGER_PSI_GENERAL_REG, | ||
1173 | 1, &data); | ||
1174 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1175 | voyager_status.power_fail = 1; | ||
1176 | voyager_status.request_from_kernel = 1; | ||
1177 | wake_up_process(voyager_thread); | ||
1178 | } | ||
1179 | |||
1180 | } else if (psi_reg.regs.intstatus & PSI_FAULT) { | ||
1181 | /* Major fault! */ | ||
1182 | printk(KERN_ERR | ||
1183 | "Voyager PSI Detected major fault, immediate power off!\n"); | ||
1184 | voyager_cat_power_off(); | ||
1185 | /* not reached */ | ||
1186 | } else if (psi_reg.regs.intstatus & (PSI_DC_FAIL | PSI_ALARM | ||
1187 | | PSI_CURRENT | PSI_DVM | ||
1188 | | PSI_PSCFAULT | PSI_STAT_CHG)) { | ||
1189 | /* other psi fault */ | ||
1190 | |||
1191 | printk(KERN_WARNING "Voyager PSI status 0x%x\n", data); | ||
1192 | /* clear the PSI fault */ | ||
1193 | outb(VOYAGER_CAT_RUN, CAT_CMD); | ||
1194 | cat_write(&psi, &psi_asic, VOYAGER_PSI_STATUS_REG, 0); | ||
1195 | outb(VOYAGER_CAT_END, CAT_CMD); | ||
1196 | } | ||
1197 | } | ||
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c deleted file mode 100644 index 98e3c2bc7563..000000000000 --- a/arch/x86/mach-voyager/voyager_smp.c +++ /dev/null | |||
@@ -1,1805 +0,0 @@ | |||
1 | /* -*- mode: c; c-basic-offset: 8 -*- */ | ||
2 | |||
3 | /* Copyright (C) 1999,2001 | ||
4 | * | ||
5 | * Author: J.E.J.Bottomley@HansenPartnership.com | ||
6 | * | ||
7 | * This file provides all the same external entries as smp.c but uses | ||
8 | * the voyager hal to provide the functionality | ||
9 | */ | ||
10 | #include <linux/cpu.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/mm.h> | ||
13 | #include <linux/kernel_stat.h> | ||
14 | #include <linux/delay.h> | ||
15 | #include <linux/mc146818rtc.h> | ||
16 | #include <linux/cache.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/bootmem.h> | ||
21 | #include <linux/completion.h> | ||
22 | #include <asm/desc.h> | ||
23 | #include <asm/voyager.h> | ||
24 | #include <asm/vic.h> | ||
25 | #include <asm/mtrr.h> | ||
26 | #include <asm/pgalloc.h> | ||
27 | #include <asm/tlbflush.h> | ||
28 | #include <asm/arch_hooks.h> | ||
29 | #include <asm/trampoline.h> | ||
30 | |||
31 | /* TLB state -- visible externally, indexed physically */ | ||
32 | DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) = { &init_mm, 0 }; | ||
33 | |||
34 | /* CPU IRQ affinity -- set to all ones initially */ | ||
35 | static unsigned long cpu_irq_affinity[NR_CPUS] __cacheline_aligned = | ||
36 | {[0 ... NR_CPUS-1] = ~0UL }; | ||
37 | |||
38 | /* per CPU data structure (for /proc/cpuinfo et al), visible externally | ||
39 | * indexed physically */ | ||
40 | DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); | ||
41 | EXPORT_PER_CPU_SYMBOL(cpu_info); | ||
42 | |||
43 | /* physical ID of the CPU used to boot the system */ | ||
44 | unsigned char boot_cpu_id; | ||
45 | |||
46 | /* The memory line addresses for the Quad CPIs */ | ||
47 | struct voyager_qic_cpi *voyager_quad_cpi_addr[NR_CPUS] __cacheline_aligned; | ||
48 | |||
49 | /* The masks for the Extended VIC processors, filled in by cat_init */ | ||
50 | __u32 voyager_extended_vic_processors = 0; | ||
51 | |||
52 | /* Masks for the extended Quad processors which cannot be VIC booted */ | ||
53 | __u32 voyager_allowed_boot_processors = 0; | ||
54 | |||
55 | /* The mask for the Quad Processors (both extended and non-extended) */ | ||
56 | __u32 voyager_quad_processors = 0; | ||
57 | |||
58 | /* Total count of live CPUs, used in process.c to display | ||
59 | * the CPU information and in irq.c for the per CPU irq | ||
60 | * activity count. Finally exported by i386_ksyms.c */ | ||
61 | static int voyager_extended_cpus = 1; | ||
62 | |||
63 | /* Used for the invalidate map that's also checked in the spinlock */ | ||
64 | static volatile unsigned long smp_invalidate_needed; | ||
65 | |||
66 | /* Bitmask of CPUs present in the system - exported by i386_syms.c, used | ||
67 | * by scheduler but indexed physically */ | ||
68 | cpumask_t phys_cpu_present_map = CPU_MASK_NONE; | ||
69 | |||
70 | /* The internal functions */ | ||
71 | static void send_CPI(__u32 cpuset, __u8 cpi); | ||
72 | static void ack_CPI(__u8 cpi); | ||
73 | static int ack_QIC_CPI(__u8 cpi); | ||
74 | static void ack_special_QIC_CPI(__u8 cpi); | ||
75 | static void ack_VIC_CPI(__u8 cpi); | ||
76 | static void send_CPI_allbutself(__u8 cpi); | ||
77 | static void mask_vic_irq(unsigned int irq); | ||
78 | static void unmask_vic_irq(unsigned int irq); | ||
79 | static unsigned int startup_vic_irq(unsigned int irq); | ||
80 | static void enable_local_vic_irq(unsigned int irq); | ||
81 | static void disable_local_vic_irq(unsigned int irq); | ||
82 | static void before_handle_vic_irq(unsigned int irq); | ||
83 | static void after_handle_vic_irq(unsigned int irq); | ||
84 | static void set_vic_irq_affinity(unsigned int irq, const struct cpumask *mask); | ||
85 | static void ack_vic_irq(unsigned int irq); | ||
86 | static void vic_enable_cpi(void); | ||
87 | static void do_boot_cpu(__u8 cpuid); | ||
88 | static void do_quad_bootstrap(void); | ||
89 | static void initialize_secondary(void); | ||
90 | |||
91 | int hard_smp_processor_id(void); | ||
92 | int safe_smp_processor_id(void); | ||
93 | |||
94 | /* Inline functions */ | ||
95 | static inline void send_one_QIC_CPI(__u8 cpu, __u8 cpi) | ||
96 | { | ||
97 | voyager_quad_cpi_addr[cpu]->qic_cpi[cpi].cpi = | ||
98 | (smp_processor_id() << 16) + cpi; | ||
99 | } | ||
100 | |||
101 | static inline void send_QIC_CPI(__u32 cpuset, __u8 cpi) | ||
102 | { | ||
103 | int cpu; | ||
104 | |||
105 | for_each_online_cpu(cpu) { | ||
106 | if (cpuset & (1 << cpu)) { | ||
107 | #ifdef VOYAGER_DEBUG | ||
108 | if (!cpu_online(cpu)) | ||
109 | VDEBUG(("CPU%d sending cpi %d to CPU%d not in " | ||
110 | "cpu_online_map\n", | ||
111 | hard_smp_processor_id(), cpi, cpu)); | ||
112 | #endif | ||
113 | send_one_QIC_CPI(cpu, cpi - QIC_CPI_OFFSET); | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | |||
118 | static inline void wrapper_smp_local_timer_interrupt(void) | ||
119 | { | ||
120 | irq_enter(); | ||
121 | smp_local_timer_interrupt(); | ||
122 | irq_exit(); | ||
123 | } | ||
124 | |||
125 | static inline void send_one_CPI(__u8 cpu, __u8 cpi) | ||
126 | { | ||
127 | if (voyager_quad_processors & (1 << cpu)) | ||
128 | send_one_QIC_CPI(cpu, cpi - QIC_CPI_OFFSET); | ||
129 | else | ||
130 | send_CPI(1 << cpu, cpi); | ||
131 | } | ||
132 | |||
133 | static inline void send_CPI_allbutself(__u8 cpi) | ||
134 | { | ||
135 | __u8 cpu = smp_processor_id(); | ||
136 | __u32 mask = cpus_addr(cpu_online_map)[0] & ~(1 << cpu); | ||
137 | send_CPI(mask, cpi); | ||
138 | } | ||
139 | |||
140 | static inline int is_cpu_quad(void) | ||
141 | { | ||
142 | __u8 cpumask = inb(VIC_PROC_WHO_AM_I); | ||
143 | return ((cpumask & QUAD_IDENTIFIER) == QUAD_IDENTIFIER); | ||
144 | } | ||
145 | |||
146 | static inline int is_cpu_extended(void) | ||
147 | { | ||
148 | __u8 cpu = hard_smp_processor_id(); | ||
149 | |||
150 | return (voyager_extended_vic_processors & (1 << cpu)); | ||
151 | } | ||
152 | |||
153 | static inline int is_cpu_vic_boot(void) | ||
154 | { | ||
155 | __u8 cpu = hard_smp_processor_id(); | ||
156 | |||
157 | return (voyager_extended_vic_processors | ||
158 | & voyager_allowed_boot_processors & (1 << cpu)); | ||
159 | } | ||
160 | |||
161 | static inline void ack_CPI(__u8 cpi) | ||
162 | { | ||
163 | switch (cpi) { | ||
164 | case VIC_CPU_BOOT_CPI: | ||
165 | if (is_cpu_quad() && !is_cpu_vic_boot()) | ||
166 | ack_QIC_CPI(cpi); | ||
167 | else | ||
168 | ack_VIC_CPI(cpi); | ||
169 | break; | ||
170 | case VIC_SYS_INT: | ||
171 | case VIC_CMN_INT: | ||
172 | /* These are slightly strange. Even on the Quad card, | ||
173 | * They are vectored as VIC CPIs */ | ||
174 | if (is_cpu_quad()) | ||
175 | ack_special_QIC_CPI(cpi); | ||
176 | else | ||
177 | ack_VIC_CPI(cpi); | ||
178 | break; | ||
179 | default: | ||
180 | printk("VOYAGER ERROR: CPI%d is in common CPI code\n", cpi); | ||
181 | break; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | /* local variables */ | ||
186 | |||
187 | /* The VIC IRQ descriptors -- these look almost identical to the | ||
188 | * 8259 IRQs except that masks and things must be kept per processor | ||
189 | */ | ||
190 | static struct irq_chip vic_chip = { | ||
191 | .name = "VIC", | ||
192 | .startup = startup_vic_irq, | ||
193 | .mask = mask_vic_irq, | ||
194 | .unmask = unmask_vic_irq, | ||
195 | .set_affinity = set_vic_irq_affinity, | ||
196 | }; | ||
197 | |||
198 | /* used to count up as CPUs are brought on line (starts at 0) */ | ||
199 | static int cpucount = 0; | ||
200 | |||
201 | /* The per cpu profile stuff - used in smp_local_timer_interrupt */ | ||
202 | static DEFINE_PER_CPU(int, prof_multiplier) = 1; | ||
203 | static DEFINE_PER_CPU(int, prof_old_multiplier) = 1; | ||
204 | static DEFINE_PER_CPU(int, prof_counter) = 1; | ||
205 | |||
206 | /* the map used to check if a CPU has booted */ | ||
207 | static __u32 cpu_booted_map; | ||
208 | |||
209 | /* the synchronize flag used to hold all secondary CPUs spinning in | ||
210 | * a tight loop until the boot sequence is ready for them */ | ||
211 | static cpumask_t smp_commenced_mask = CPU_MASK_NONE; | ||
212 | |||
213 | /* This is for the new dynamic CPU boot code */ | ||
214 | |||
215 | /* The per processor IRQ masks (these are usually kept in sync) */ | ||
216 | static __u16 vic_irq_mask[NR_CPUS] __cacheline_aligned; | ||
217 | |||
218 | /* the list of IRQs to be enabled by the VIC_ENABLE_IRQ_CPI */ | ||
219 | static __u16 vic_irq_enable_mask[NR_CPUS] __cacheline_aligned = { 0 }; | ||
220 | |||
221 | /* Lock for enable/disable of VIC interrupts */ | ||
222 | static __cacheline_aligned DEFINE_SPINLOCK(vic_irq_lock); | ||
223 | |||
224 | /* The boot processor is correctly set up in PC mode when it | ||
225 | * comes up, but the secondaries need their master/slave 8259 | ||
226 | * pairs initializing correctly */ | ||
227 | |||
228 | /* Interrupt counters (per cpu) and total - used to try to | ||
229 | * even up the interrupt handling routines */ | ||
230 | static long vic_intr_total = 0; | ||
231 | static long vic_intr_count[NR_CPUS] __cacheline_aligned = { 0 }; | ||
232 | static unsigned long vic_tick[NR_CPUS] __cacheline_aligned = { 0 }; | ||
233 | |||
234 | /* Since we can only use CPI0, we fake all the other CPIs */ | ||
235 | static unsigned long vic_cpi_mailbox[NR_CPUS] __cacheline_aligned; | ||
236 | |||
237 | /* debugging routine to read the isr of the cpu's pic */ | ||
238 | static inline __u16 vic_read_isr(void) | ||
239 | { | ||
240 | __u16 isr; | ||
241 | |||
242 | outb(0x0b, 0xa0); | ||
243 | isr = inb(0xa0) << 8; | ||
244 | outb(0x0b, 0x20); | ||
245 | isr |= inb(0x20); | ||
246 | |||
247 | return isr; | ||
248 | } | ||
249 | |||
250 | static __init void qic_setup(void) | ||
251 | { | ||
252 | if (!is_cpu_quad()) { | ||
253 | /* not a quad, no setup */ | ||
254 | return; | ||
255 | } | ||
256 | outb(QIC_DEFAULT_MASK0, QIC_MASK_REGISTER0); | ||
257 | outb(QIC_CPI_ENABLE, QIC_MASK_REGISTER1); | ||
258 | |||
259 | if (is_cpu_extended()) { | ||
260 | /* the QIC duplicate of the VIC base register */ | ||
261 | outb(VIC_DEFAULT_CPI_BASE, QIC_VIC_CPI_BASE_REGISTER); | ||
262 | outb(QIC_DEFAULT_CPI_BASE, QIC_CPI_BASE_REGISTER); | ||
263 | |||
264 | /* FIXME: should set up the QIC timer and memory parity | ||
265 | * error vectors here */ | ||
266 | } | ||
267 | } | ||
268 | |||
269 | static __init void vic_setup_pic(void) | ||
270 | { | ||
271 | outb(1, VIC_REDIRECT_REGISTER_1); | ||
272 | /* clear the claim registers for dynamic routing */ | ||
273 | outb(0, VIC_CLAIM_REGISTER_0); | ||
274 | outb(0, VIC_CLAIM_REGISTER_1); | ||
275 | |||
276 | outb(0, VIC_PRIORITY_REGISTER); | ||
277 | /* Set the Primary and Secondary Microchannel vector | ||
278 | * bases to be the same as the ordinary interrupts | ||
279 | * | ||
280 | * FIXME: This would be more efficient using separate | ||
281 | * vectors. */ | ||
282 | outb(FIRST_EXTERNAL_VECTOR, VIC_PRIMARY_MC_BASE); | ||
283 | outb(FIRST_EXTERNAL_VECTOR, VIC_SECONDARY_MC_BASE); | ||
284 | /* Now initiallise the master PIC belonging to this CPU by | ||
285 | * sending the four ICWs */ | ||
286 | |||
287 | /* ICW1: level triggered, ICW4 needed */ | ||
288 | outb(0x19, 0x20); | ||
289 | |||
290 | /* ICW2: vector base */ | ||
291 | outb(FIRST_EXTERNAL_VECTOR, 0x21); | ||
292 | |||
293 | /* ICW3: slave at line 2 */ | ||
294 | outb(0x04, 0x21); | ||
295 | |||
296 | /* ICW4: 8086 mode */ | ||
297 | outb(0x01, 0x21); | ||
298 | |||
299 | /* now the same for the slave PIC */ | ||
300 | |||
301 | /* ICW1: level trigger, ICW4 needed */ | ||
302 | outb(0x19, 0xA0); | ||
303 | |||
304 | /* ICW2: slave vector base */ | ||
305 | outb(FIRST_EXTERNAL_VECTOR + 8, 0xA1); | ||
306 | |||
307 | /* ICW3: slave ID */ | ||
308 | outb(0x02, 0xA1); | ||
309 | |||
310 | /* ICW4: 8086 mode */ | ||
311 | outb(0x01, 0xA1); | ||
312 | } | ||
313 | |||
314 | static void do_quad_bootstrap(void) | ||
315 | { | ||
316 | if (is_cpu_quad() && is_cpu_vic_boot()) { | ||
317 | int i; | ||
318 | unsigned long flags; | ||
319 | __u8 cpuid = hard_smp_processor_id(); | ||
320 | |||
321 | local_irq_save(flags); | ||
322 | |||
323 | for (i = 0; i < 4; i++) { | ||
324 | /* FIXME: this would be >>3 &0x7 on the 32 way */ | ||
325 | if (((cpuid >> 2) & 0x03) == i) | ||
326 | /* don't lower our own mask! */ | ||
327 | continue; | ||
328 | |||
329 | /* masquerade as local Quad CPU */ | ||
330 | outb(QIC_CPUID_ENABLE | i, QIC_PROCESSOR_ID); | ||
331 | /* enable the startup CPI */ | ||
332 | outb(QIC_BOOT_CPI_MASK, QIC_MASK_REGISTER1); | ||
333 | /* restore cpu id */ | ||
334 | outb(0, QIC_PROCESSOR_ID); | ||
335 | } | ||
336 | local_irq_restore(flags); | ||
337 | } | ||
338 | } | ||
339 | |||
340 | void prefill_possible_map(void) | ||
341 | { | ||
342 | /* This is empty on voyager because we need a much | ||
343 | * earlier detection which is done in find_smp_config */ | ||
344 | } | ||
345 | |||
346 | /* Set up all the basic stuff: read the SMP config and make all the | ||
347 | * SMP information reflect only the boot cpu. All others will be | ||
348 | * brought on-line later. */ | ||
349 | void __init find_smp_config(void) | ||
350 | { | ||
351 | int i; | ||
352 | |||
353 | boot_cpu_id = hard_smp_processor_id(); | ||
354 | |||
355 | printk("VOYAGER SMP: Boot cpu is %d\n", boot_cpu_id); | ||
356 | |||
357 | /* initialize the CPU structures (moved from smp_boot_cpus) */ | ||
358 | for (i = 0; i < nr_cpu_ids; i++) | ||
359 | cpu_irq_affinity[i] = ~0; | ||
360 | cpu_online_map = cpumask_of_cpu(boot_cpu_id); | ||
361 | |||
362 | /* The boot CPU must be extended */ | ||
363 | voyager_extended_vic_processors = 1 << boot_cpu_id; | ||
364 | /* initially, all of the first 8 CPUs can boot */ | ||
365 | voyager_allowed_boot_processors = 0xff; | ||
366 | /* set up everything for just this CPU, we can alter | ||
367 | * this as we start the other CPUs later */ | ||
368 | /* now get the CPU disposition from the extended CMOS */ | ||
369 | cpus_addr(phys_cpu_present_map)[0] = | ||
370 | voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK); | ||
371 | cpus_addr(phys_cpu_present_map)[0] |= | ||
372 | voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8; | ||
373 | cpus_addr(phys_cpu_present_map)[0] |= | ||
374 | voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + | ||
375 | 2) << 16; | ||
376 | cpus_addr(phys_cpu_present_map)[0] |= | ||
377 | voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + | ||
378 | 3) << 24; | ||
379 | init_cpu_possible(&phys_cpu_present_map); | ||
380 | printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n", | ||
381 | cpus_addr(phys_cpu_present_map)[0]); | ||
382 | /* Here we set up the VIC to enable SMP */ | ||
383 | /* enable the CPIs by writing the base vector to their register */ | ||
384 | outb(VIC_DEFAULT_CPI_BASE, VIC_CPI_BASE_REGISTER); | ||
385 | outb(1, VIC_REDIRECT_REGISTER_1); | ||
386 | /* set the claim registers for static routing --- Boot CPU gets | ||
387 | * all interrupts untill all other CPUs started */ | ||
388 | outb(0xff, VIC_CLAIM_REGISTER_0); | ||
389 | outb(0xff, VIC_CLAIM_REGISTER_1); | ||
390 | /* Set the Primary and Secondary Microchannel vector | ||
391 | * bases to be the same as the ordinary interrupts | ||
392 | * | ||
393 | * FIXME: This would be more efficient using separate | ||
394 | * vectors. */ | ||
395 | outb(FIRST_EXTERNAL_VECTOR, VIC_PRIMARY_MC_BASE); | ||
396 | outb(FIRST_EXTERNAL_VECTOR, VIC_SECONDARY_MC_BASE); | ||
397 | |||
398 | /* Finally tell the firmware that we're driving */ | ||
399 | outb(inb(VOYAGER_SUS_IN_CONTROL_PORT) | VOYAGER_IN_CONTROL_FLAG, | ||
400 | VOYAGER_SUS_IN_CONTROL_PORT); | ||
401 | |||
402 | current_thread_info()->cpu = boot_cpu_id; | ||
403 | percpu_write(cpu_number, boot_cpu_id); | ||
404 | } | ||
405 | |||
406 | /* | ||
407 | * The bootstrap kernel entry code has set these up. Save them | ||
408 | * for a given CPU, id is physical */ | ||
409 | void __init smp_store_cpu_info(int id) | ||
410 | { | ||
411 | struct cpuinfo_x86 *c = &cpu_data(id); | ||
412 | |||
413 | *c = boot_cpu_data; | ||
414 | c->cpu_index = id; | ||
415 | |||
416 | identify_secondary_cpu(c); | ||
417 | } | ||
418 | |||
419 | /* Routine initially called when a non-boot CPU is brought online */ | ||
420 | static void __init start_secondary(void *unused) | ||
421 | { | ||
422 | __u8 cpuid = hard_smp_processor_id(); | ||
423 | |||
424 | cpu_init(); | ||
425 | |||
426 | /* OK, we're in the routine */ | ||
427 | ack_CPI(VIC_CPU_BOOT_CPI); | ||
428 | |||
429 | /* setup the 8259 master slave pair belonging to this CPU --- | ||
430 | * we won't actually receive any until the boot CPU | ||
431 | * relinquishes it's static routing mask */ | ||
432 | vic_setup_pic(); | ||
433 | |||
434 | qic_setup(); | ||
435 | |||
436 | if (is_cpu_quad() && !is_cpu_vic_boot()) { | ||
437 | /* clear the boot CPI */ | ||
438 | __u8 dummy; | ||
439 | |||
440 | dummy = | ||
441 | voyager_quad_cpi_addr[cpuid]->qic_cpi[VIC_CPU_BOOT_CPI].cpi; | ||
442 | printk("read dummy %d\n", dummy); | ||
443 | } | ||
444 | |||
445 | /* lower the mask to receive CPIs */ | ||
446 | vic_enable_cpi(); | ||
447 | |||
448 | VDEBUG(("VOYAGER SMP: CPU%d, stack at about %p\n", cpuid, &cpuid)); | ||
449 | |||
450 | notify_cpu_starting(cpuid); | ||
451 | |||
452 | /* enable interrupts */ | ||
453 | local_irq_enable(); | ||
454 | |||
455 | /* get our bogomips */ | ||
456 | calibrate_delay(); | ||
457 | |||
458 | /* save our processor parameters */ | ||
459 | smp_store_cpu_info(cpuid); | ||
460 | |||
461 | /* if we're a quad, we may need to bootstrap other CPUs */ | ||
462 | do_quad_bootstrap(); | ||
463 | |||
464 | /* FIXME: this is rather a poor hack to prevent the CPU | ||
465 | * activating softirqs while it's supposed to be waiting for | ||
466 | * permission to proceed. Without this, the new per CPU stuff | ||
467 | * in the softirqs will fail */ | ||
468 | local_irq_disable(); | ||
469 | cpu_set(cpuid, cpu_callin_map); | ||
470 | |||
471 | /* signal that we're done */ | ||
472 | cpu_booted_map = 1; | ||
473 | |||
474 | while (!cpu_isset(cpuid, smp_commenced_mask)) | ||
475 | rep_nop(); | ||
476 | local_irq_enable(); | ||
477 | |||
478 | local_flush_tlb(); | ||
479 | |||
480 | cpu_set(cpuid, cpu_online_map); | ||
481 | wmb(); | ||
482 | cpu_idle(); | ||
483 | } | ||
484 | |||
485 | /* Routine to kick start the given CPU and wait for it to report ready | ||
486 | * (or timeout in startup). When this routine returns, the requested | ||
487 | * CPU is either fully running and configured or known to be dead. | ||
488 | * | ||
489 | * We call this routine sequentially 1 CPU at a time, so no need for | ||
490 | * locking */ | ||
491 | |||
492 | static void __init do_boot_cpu(__u8 cpu) | ||
493 | { | ||
494 | struct task_struct *idle; | ||
495 | int timeout; | ||
496 | unsigned long flags; | ||
497 | int quad_boot = (1 << cpu) & voyager_quad_processors | ||
498 | & ~(voyager_extended_vic_processors | ||
499 | & voyager_allowed_boot_processors); | ||
500 | |||
501 | /* This is the format of the CPI IDT gate (in real mode) which | ||
502 | * we're hijacking to boot the CPU */ | ||
503 | union IDTFormat { | ||
504 | struct seg { | ||
505 | __u16 Offset; | ||
506 | __u16 Segment; | ||
507 | } idt; | ||
508 | __u32 val; | ||
509 | } hijack_source; | ||
510 | |||
511 | __u32 *hijack_vector; | ||
512 | __u32 start_phys_address = setup_trampoline(); | ||
513 | |||
514 | /* There's a clever trick to this: The linux trampoline is | ||
515 | * compiled to begin at absolute location zero, so make the | ||
516 | * address zero but have the data segment selector compensate | ||
517 | * for the actual address */ | ||
518 | hijack_source.idt.Offset = start_phys_address & 0x000F; | ||
519 | hijack_source.idt.Segment = (start_phys_address >> 4) & 0xFFFF; | ||
520 | |||
521 | cpucount++; | ||
522 | alternatives_smp_switch(1); | ||
523 | |||
524 | idle = fork_idle(cpu); | ||
525 | if (IS_ERR(idle)) | ||
526 | panic("failed fork for CPU%d", cpu); | ||
527 | idle->thread.ip = (unsigned long)start_secondary; | ||
528 | /* init_tasks (in sched.c) is indexed logically */ | ||
529 | stack_start.sp = (void *)idle->thread.sp; | ||
530 | |||
531 | per_cpu(current_task, cpu) = idle; | ||
532 | early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); | ||
533 | irq_ctx_init(cpu); | ||
534 | |||
535 | /* Note: Don't modify initial ss override */ | ||
536 | VDEBUG(("VOYAGER SMP: Booting CPU%d at 0x%lx[%x:%x], stack %p\n", cpu, | ||
537 | (unsigned long)hijack_source.val, hijack_source.idt.Segment, | ||
538 | hijack_source.idt.Offset, stack_start.sp)); | ||
539 | |||
540 | /* init lowmem identity mapping */ | ||
541 | clone_pgd_range(swapper_pg_dir, swapper_pg_dir + KERNEL_PGD_BOUNDARY, | ||
542 | min_t(unsigned long, KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); | ||
543 | flush_tlb_all(); | ||
544 | |||
545 | if (quad_boot) { | ||
546 | printk("CPU %d: non extended Quad boot\n", cpu); | ||
547 | hijack_vector = | ||
548 | (__u32 *) | ||
549 | phys_to_virt((VIC_CPU_BOOT_CPI + QIC_DEFAULT_CPI_BASE) * 4); | ||
550 | *hijack_vector = hijack_source.val; | ||
551 | } else { | ||
552 | printk("CPU%d: extended VIC boot\n", cpu); | ||
553 | hijack_vector = | ||
554 | (__u32 *) | ||
555 | phys_to_virt((VIC_CPU_BOOT_CPI + VIC_DEFAULT_CPI_BASE) * 4); | ||
556 | *hijack_vector = hijack_source.val; | ||
557 | /* VIC errata, may also receive interrupt at this address */ | ||
558 | hijack_vector = | ||
559 | (__u32 *) | ||
560 | phys_to_virt((VIC_CPU_BOOT_ERRATA_CPI + | ||
561 | VIC_DEFAULT_CPI_BASE) * 4); | ||
562 | *hijack_vector = hijack_source.val; | ||
563 | } | ||
564 | /* All non-boot CPUs start with interrupts fully masked. Need | ||
565 | * to lower the mask of the CPI we're about to send. We do | ||
566 | * this in the VIC by masquerading as the processor we're | ||
567 | * about to boot and lowering its interrupt mask */ | ||
568 | local_irq_save(flags); | ||
569 | if (quad_boot) { | ||
570 | send_one_QIC_CPI(cpu, VIC_CPU_BOOT_CPI); | ||
571 | } else { | ||
572 | outb(VIC_CPU_MASQUERADE_ENABLE | cpu, VIC_PROCESSOR_ID); | ||
573 | /* here we're altering registers belonging to `cpu' */ | ||
574 | |||
575 | outb(VIC_BOOT_INTERRUPT_MASK, 0x21); | ||
576 | /* now go back to our original identity */ | ||
577 | outb(boot_cpu_id, VIC_PROCESSOR_ID); | ||
578 | |||
579 | /* and boot the CPU */ | ||
580 | |||
581 | send_CPI((1 << cpu), VIC_CPU_BOOT_CPI); | ||
582 | } | ||
583 | cpu_booted_map = 0; | ||
584 | local_irq_restore(flags); | ||
585 | |||
586 | /* now wait for it to become ready (or timeout) */ | ||
587 | for (timeout = 0; timeout < 50000; timeout++) { | ||
588 | if (cpu_booted_map) | ||
589 | break; | ||
590 | udelay(100); | ||
591 | } | ||
592 | /* reset the page table */ | ||
593 | zap_low_mappings(); | ||
594 | |||
595 | if (cpu_booted_map) { | ||
596 | VDEBUG(("CPU%d: Booted successfully, back in CPU %d\n", | ||
597 | cpu, smp_processor_id())); | ||
598 | |||
599 | printk("CPU%d: ", cpu); | ||
600 | print_cpu_info(&cpu_data(cpu)); | ||
601 | wmb(); | ||
602 | cpu_set(cpu, cpu_callout_map); | ||
603 | cpu_set(cpu, cpu_present_map); | ||
604 | } else { | ||
605 | printk("CPU%d FAILED TO BOOT: ", cpu); | ||
606 | if (* | ||
607 | ((volatile unsigned char *)phys_to_virt(start_phys_address)) | ||
608 | == 0xA5) | ||
609 | printk("Stuck.\n"); | ||
610 | else | ||
611 | printk("Not responding.\n"); | ||
612 | |||
613 | cpucount--; | ||
614 | } | ||
615 | } | ||
616 | |||
617 | void __init smp_boot_cpus(void) | ||
618 | { | ||
619 | int i; | ||
620 | |||
621 | /* CAT BUS initialisation must be done after the memory */ | ||
622 | /* FIXME: The L4 has a catbus too, it just needs to be | ||
623 | * accessed in a totally different way */ | ||
624 | if (voyager_level == 5) { | ||
625 | voyager_cat_init(); | ||
626 | |||
627 | /* now that the cat has probed the Voyager System Bus, sanity | ||
628 | * check the cpu map */ | ||
629 | if (((voyager_quad_processors | voyager_extended_vic_processors) | ||
630 | & cpus_addr(phys_cpu_present_map)[0]) != | ||
631 | cpus_addr(phys_cpu_present_map)[0]) { | ||
632 | /* should panic */ | ||
633 | printk("\n\n***WARNING*** " | ||
634 | "Sanity check of CPU present map FAILED\n"); | ||
635 | } | ||
636 | } else if (voyager_level == 4) | ||
637 | voyager_extended_vic_processors = | ||
638 | cpus_addr(phys_cpu_present_map)[0]; | ||
639 | |||
640 | /* this sets up the idle task to run on the current cpu */ | ||
641 | voyager_extended_cpus = 1; | ||
642 | /* Remove the global_irq_holder setting, it triggers a BUG() on | ||
643 | * schedule at the moment */ | ||
644 | //global_irq_holder = boot_cpu_id; | ||
645 | |||
646 | /* FIXME: Need to do something about this but currently only works | ||
647 | * on CPUs with a tsc which none of mine have. | ||
648 | smp_tune_scheduling(); | ||
649 | */ | ||
650 | smp_store_cpu_info(boot_cpu_id); | ||
651 | /* setup the jump vector */ | ||
652 | initial_code = (unsigned long)initialize_secondary; | ||
653 | printk("CPU%d: ", boot_cpu_id); | ||
654 | print_cpu_info(&cpu_data(boot_cpu_id)); | ||
655 | |||
656 | if (is_cpu_quad()) { | ||
657 | /* booting on a Quad CPU */ | ||
658 | printk("VOYAGER SMP: Boot CPU is Quad\n"); | ||
659 | qic_setup(); | ||
660 | do_quad_bootstrap(); | ||
661 | } | ||
662 | |||
663 | /* enable our own CPIs */ | ||
664 | vic_enable_cpi(); | ||
665 | |||
666 | cpu_set(boot_cpu_id, cpu_online_map); | ||
667 | cpu_set(boot_cpu_id, cpu_callout_map); | ||
668 | |||
669 | /* loop over all the extended VIC CPUs and boot them. The | ||
670 | * Quad CPUs must be bootstrapped by their extended VIC cpu */ | ||
671 | for (i = 0; i < nr_cpu_ids; i++) { | ||
672 | if (i == boot_cpu_id || !cpu_isset(i, phys_cpu_present_map)) | ||
673 | continue; | ||
674 | do_boot_cpu(i); | ||
675 | /* This udelay seems to be needed for the Quad boots | ||
676 | * don't remove unless you know what you're doing */ | ||
677 | udelay(1000); | ||
678 | } | ||
679 | /* we could compute the total bogomips here, but why bother?, | ||
680 | * Code added from smpboot.c */ | ||
681 | { | ||
682 | unsigned long bogosum = 0; | ||
683 | |||
684 | for_each_online_cpu(i) | ||
685 | bogosum += cpu_data(i).loops_per_jiffy; | ||
686 | printk(KERN_INFO "Total of %d processors activated " | ||
687 | "(%lu.%02lu BogoMIPS).\n", | ||
688 | cpucount + 1, bogosum / (500000 / HZ), | ||
689 | (bogosum / (5000 / HZ)) % 100); | ||
690 | } | ||
691 | voyager_extended_cpus = hweight32(voyager_extended_vic_processors); | ||
692 | printk("VOYAGER: Extended (interrupt handling CPUs): " | ||
693 | "%d, non-extended: %d\n", voyager_extended_cpus, | ||
694 | num_booting_cpus() - voyager_extended_cpus); | ||
695 | /* that's it, switch to symmetric mode */ | ||
696 | outb(0, VIC_PRIORITY_REGISTER); | ||
697 | outb(0, VIC_CLAIM_REGISTER_0); | ||
698 | outb(0, VIC_CLAIM_REGISTER_1); | ||
699 | |||
700 | VDEBUG(("VOYAGER SMP: Booted with %d CPUs\n", num_booting_cpus())); | ||
701 | } | ||
702 | |||
703 | /* Reload the secondary CPUs task structure (this function does not | ||
704 | * return ) */ | ||
705 | static void __init initialize_secondary(void) | ||
706 | { | ||
707 | #if 0 | ||
708 | // AC kernels only | ||
709 | set_current(hard_get_current()); | ||
710 | #endif | ||
711 | |||
712 | /* | ||
713 | * We don't actually need to load the full TSS, | ||
714 | * basically just the stack pointer and the eip. | ||
715 | */ | ||
716 | |||
717 | asm volatile ("movl %0,%%esp\n\t" | ||
718 | "jmp *%1"::"r" (current->thread.sp), | ||
719 | "r"(current->thread.ip)); | ||
720 | } | ||
721 | |||
722 | /* handle a Voyager SYS_INT -- If we don't, the base board will | ||
723 | * panic the system. | ||
724 | * | ||
725 | * System interrupts occur because some problem was detected on the | ||
726 | * various busses. To find out what you have to probe all the | ||
727 | * hardware via the CAT bus. FIXME: At the moment we do nothing. */ | ||
728 | void smp_vic_sys_interrupt(struct pt_regs *regs) | ||
729 | { | ||
730 | ack_CPI(VIC_SYS_INT); | ||
731 | printk("Voyager SYSTEM INTERRUPT\n"); | ||
732 | } | ||
733 | |||
734 | /* Handle a voyager CMN_INT; These interrupts occur either because of | ||
735 | * a system status change or because a single bit memory error | ||
736 | * occurred. FIXME: At the moment, ignore all this. */ | ||
737 | void smp_vic_cmn_interrupt(struct pt_regs *regs) | ||
738 | { | ||
739 | static __u8 in_cmn_int = 0; | ||
740 | static DEFINE_SPINLOCK(cmn_int_lock); | ||
741 | |||
742 | /* common ints are broadcast, so make sure we only do this once */ | ||
743 | _raw_spin_lock(&cmn_int_lock); | ||
744 | if (in_cmn_int) | ||
745 | goto unlock_end; | ||
746 | |||
747 | in_cmn_int++; | ||
748 | _raw_spin_unlock(&cmn_int_lock); | ||
749 | |||
750 | VDEBUG(("Voyager COMMON INTERRUPT\n")); | ||
751 | |||
752 | if (voyager_level == 5) | ||
753 | voyager_cat_do_common_interrupt(); | ||
754 | |||
755 | _raw_spin_lock(&cmn_int_lock); | ||
756 | in_cmn_int = 0; | ||
757 | unlock_end: | ||
758 | _raw_spin_unlock(&cmn_int_lock); | ||
759 | ack_CPI(VIC_CMN_INT); | ||
760 | } | ||
761 | |||
762 | /* | ||
763 | * Reschedule call back. Nothing to do, all the work is done | ||
764 | * automatically when we return from the interrupt. */ | ||
765 | static void smp_reschedule_interrupt(void) | ||
766 | { | ||
767 | /* do nothing */ | ||
768 | } | ||
769 | |||
770 | static struct mm_struct *flush_mm; | ||
771 | static unsigned long flush_va; | ||
772 | static DEFINE_SPINLOCK(tlbstate_lock); | ||
773 | |||
774 | /* | ||
775 | * We cannot call mmdrop() because we are in interrupt context, | ||
776 | * instead update mm->cpu_vm_mask. | ||
777 | * | ||
778 | * We need to reload %cr3 since the page tables may be going | ||
779 | * away from under us.. | ||
780 | */ | ||
781 | static inline void voyager_leave_mm(unsigned long cpu) | ||
782 | { | ||
783 | if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK) | ||
784 | BUG(); | ||
785 | cpu_clear(cpu, per_cpu(cpu_tlbstate, cpu).active_mm->cpu_vm_mask); | ||
786 | load_cr3(swapper_pg_dir); | ||
787 | } | ||
788 | |||
789 | /* | ||
790 | * Invalidate call-back | ||
791 | */ | ||
792 | static void smp_invalidate_interrupt(void) | ||
793 | { | ||
794 | __u8 cpu = smp_processor_id(); | ||
795 | |||
796 | if (!test_bit(cpu, &smp_invalidate_needed)) | ||
797 | return; | ||
798 | /* This will flood messages. Don't uncomment unless you see | ||
799 | * Problems with cross cpu invalidation | ||
800 | VDEBUG(("VOYAGER SMP: CPU%d received INVALIDATE_CPI\n", | ||
801 | smp_processor_id())); | ||
802 | */ | ||
803 | |||
804 | if (flush_mm == per_cpu(cpu_tlbstate, cpu).active_mm) { | ||
805 | if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK) { | ||
806 | if (flush_va == TLB_FLUSH_ALL) | ||
807 | local_flush_tlb(); | ||
808 | else | ||
809 | __flush_tlb_one(flush_va); | ||
810 | } else | ||
811 | voyager_leave_mm(cpu); | ||
812 | } | ||
813 | smp_mb__before_clear_bit(); | ||
814 | clear_bit(cpu, &smp_invalidate_needed); | ||
815 | smp_mb__after_clear_bit(); | ||
816 | } | ||
817 | |||
818 | /* All the new flush operations for 2.4 */ | ||
819 | |||
820 | /* This routine is called with a physical cpu mask */ | ||
821 | static void | ||
822 | voyager_flush_tlb_others(unsigned long cpumask, struct mm_struct *mm, | ||
823 | unsigned long va) | ||
824 | { | ||
825 | int stuck = 50000; | ||
826 | |||
827 | if (!cpumask) | ||
828 | BUG(); | ||
829 | if ((cpumask & cpus_addr(cpu_online_map)[0]) != cpumask) | ||
830 | BUG(); | ||
831 | if (cpumask & (1 << smp_processor_id())) | ||
832 | BUG(); | ||
833 | if (!mm) | ||
834 | BUG(); | ||
835 | |||
836 | spin_lock(&tlbstate_lock); | ||
837 | |||
838 | flush_mm = mm; | ||
839 | flush_va = va; | ||
840 | atomic_set_mask(cpumask, &smp_invalidate_needed); | ||
841 | /* | ||
842 | * We have to send the CPI only to | ||
843 | * CPUs affected. | ||
844 | */ | ||
845 | send_CPI(cpumask, VIC_INVALIDATE_CPI); | ||
846 | |||
847 | while (smp_invalidate_needed) { | ||
848 | mb(); | ||
849 | if (--stuck == 0) { | ||
850 | printk("***WARNING*** Stuck doing invalidate CPI " | ||
851 | "(CPU%d)\n", smp_processor_id()); | ||
852 | break; | ||
853 | } | ||
854 | } | ||
855 | |||
856 | /* Uncomment only to debug invalidation problems | ||
857 | VDEBUG(("VOYAGER SMP: Completed invalidate CPI (CPU%d)\n", cpu)); | ||
858 | */ | ||
859 | |||
860 | flush_mm = NULL; | ||
861 | flush_va = 0; | ||
862 | spin_unlock(&tlbstate_lock); | ||
863 | } | ||
864 | |||
865 | void flush_tlb_current_task(void) | ||
866 | { | ||
867 | struct mm_struct *mm = current->mm; | ||
868 | unsigned long cpu_mask; | ||
869 | |||
870 | preempt_disable(); | ||
871 | |||
872 | cpu_mask = cpus_addr(mm->cpu_vm_mask)[0] & ~(1 << smp_processor_id()); | ||
873 | local_flush_tlb(); | ||
874 | if (cpu_mask) | ||
875 | voyager_flush_tlb_others(cpu_mask, mm, TLB_FLUSH_ALL); | ||
876 | |||
877 | preempt_enable(); | ||
878 | } | ||
879 | |||
880 | void flush_tlb_mm(struct mm_struct *mm) | ||
881 | { | ||
882 | unsigned long cpu_mask; | ||
883 | |||
884 | preempt_disable(); | ||
885 | |||
886 | cpu_mask = cpus_addr(mm->cpu_vm_mask)[0] & ~(1 << smp_processor_id()); | ||
887 | |||
888 | if (current->active_mm == mm) { | ||
889 | if (current->mm) | ||
890 | local_flush_tlb(); | ||
891 | else | ||
892 | voyager_leave_mm(smp_processor_id()); | ||
893 | } | ||
894 | if (cpu_mask) | ||
895 | voyager_flush_tlb_others(cpu_mask, mm, TLB_FLUSH_ALL); | ||
896 | |||
897 | preempt_enable(); | ||
898 | } | ||
899 | |||
900 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long va) | ||
901 | { | ||
902 | struct mm_struct *mm = vma->vm_mm; | ||
903 | unsigned long cpu_mask; | ||
904 | |||
905 | preempt_disable(); | ||
906 | |||
907 | cpu_mask = cpus_addr(mm->cpu_vm_mask)[0] & ~(1 << smp_processor_id()); | ||
908 | if (current->active_mm == mm) { | ||
909 | if (current->mm) | ||
910 | __flush_tlb_one(va); | ||
911 | else | ||
912 | voyager_leave_mm(smp_processor_id()); | ||
913 | } | ||
914 | |||
915 | if (cpu_mask) | ||
916 | voyager_flush_tlb_others(cpu_mask, mm, va); | ||
917 | |||
918 | preempt_enable(); | ||
919 | } | ||
920 | |||
921 | EXPORT_SYMBOL(flush_tlb_page); | ||
922 | |||
923 | /* enable the requested IRQs */ | ||
924 | static void smp_enable_irq_interrupt(void) | ||
925 | { | ||
926 | __u8 irq; | ||
927 | __u8 cpu = get_cpu(); | ||
928 | |||
929 | VDEBUG(("VOYAGER SMP: CPU%d enabling irq mask 0x%x\n", cpu, | ||
930 | vic_irq_enable_mask[cpu])); | ||
931 | |||
932 | spin_lock(&vic_irq_lock); | ||
933 | for (irq = 0; irq < 16; irq++) { | ||
934 | if (vic_irq_enable_mask[cpu] & (1 << irq)) | ||
935 | enable_local_vic_irq(irq); | ||
936 | } | ||
937 | vic_irq_enable_mask[cpu] = 0; | ||
938 | spin_unlock(&vic_irq_lock); | ||
939 | |||
940 | put_cpu_no_resched(); | ||
941 | } | ||
942 | |||
943 | /* | ||
944 | * CPU halt call-back | ||
945 | */ | ||
946 | static void smp_stop_cpu_function(void *dummy) | ||
947 | { | ||
948 | VDEBUG(("VOYAGER SMP: CPU%d is STOPPING\n", smp_processor_id())); | ||
949 | cpu_clear(smp_processor_id(), cpu_online_map); | ||
950 | local_irq_disable(); | ||
951 | for (;;) | ||
952 | halt(); | ||
953 | } | ||
954 | |||
955 | /* execute a thread on a new CPU. The function to be called must be | ||
956 | * previously set up. This is used to schedule a function for | ||
957 | * execution on all CPUs - set up the function then broadcast a | ||
958 | * function_interrupt CPI to come here on each CPU */ | ||
959 | static void smp_call_function_interrupt(void) | ||
960 | { | ||
961 | irq_enter(); | ||
962 | generic_smp_call_function_interrupt(); | ||
963 | __get_cpu_var(irq_stat).irq_call_count++; | ||
964 | irq_exit(); | ||
965 | } | ||
966 | |||
967 | static void smp_call_function_single_interrupt(void) | ||
968 | { | ||
969 | irq_enter(); | ||
970 | generic_smp_call_function_single_interrupt(); | ||
971 | __get_cpu_var(irq_stat).irq_call_count++; | ||
972 | irq_exit(); | ||
973 | } | ||
974 | |||
975 | /* Sorry about the name. In an APIC based system, the APICs | ||
976 | * themselves are programmed to send a timer interrupt. This is used | ||
977 | * by linux to reschedule the processor. Voyager doesn't have this, | ||
978 | * so we use the system clock to interrupt one processor, which in | ||
979 | * turn, broadcasts a timer CPI to all the others --- we receive that | ||
980 | * CPI here. We don't use this actually for counting so losing | ||
981 | * ticks doesn't matter | ||
982 | * | ||
983 | * FIXME: For those CPUs which actually have a local APIC, we could | ||
984 | * try to use it to trigger this interrupt instead of having to | ||
985 | * broadcast the timer tick. Unfortunately, all my pentium DYADs have | ||
986 | * no local APIC, so I can't do this | ||
987 | * | ||
988 | * This function is currently a placeholder and is unused in the code */ | ||
989 | void smp_apic_timer_interrupt(struct pt_regs *regs) | ||
990 | { | ||
991 | struct pt_regs *old_regs = set_irq_regs(regs); | ||
992 | wrapper_smp_local_timer_interrupt(); | ||
993 | set_irq_regs(old_regs); | ||
994 | } | ||
995 | |||
996 | /* All of the QUAD interrupt GATES */ | ||
997 | void smp_qic_timer_interrupt(struct pt_regs *regs) | ||
998 | { | ||
999 | struct pt_regs *old_regs = set_irq_regs(regs); | ||
1000 | ack_QIC_CPI(QIC_TIMER_CPI); | ||
1001 | wrapper_smp_local_timer_interrupt(); | ||
1002 | set_irq_regs(old_regs); | ||
1003 | } | ||
1004 | |||
1005 | void smp_qic_invalidate_interrupt(struct pt_regs *regs) | ||
1006 | { | ||
1007 | ack_QIC_CPI(QIC_INVALIDATE_CPI); | ||
1008 | smp_invalidate_interrupt(); | ||
1009 | } | ||
1010 | |||
1011 | void smp_qic_reschedule_interrupt(struct pt_regs *regs) | ||
1012 | { | ||
1013 | ack_QIC_CPI(QIC_RESCHEDULE_CPI); | ||
1014 | smp_reschedule_interrupt(); | ||
1015 | } | ||
1016 | |||
1017 | void smp_qic_enable_irq_interrupt(struct pt_regs *regs) | ||
1018 | { | ||
1019 | ack_QIC_CPI(QIC_ENABLE_IRQ_CPI); | ||
1020 | smp_enable_irq_interrupt(); | ||
1021 | } | ||
1022 | |||
1023 | void smp_qic_call_function_interrupt(struct pt_regs *regs) | ||
1024 | { | ||
1025 | ack_QIC_CPI(QIC_CALL_FUNCTION_CPI); | ||
1026 | smp_call_function_interrupt(); | ||
1027 | } | ||
1028 | |||
1029 | void smp_qic_call_function_single_interrupt(struct pt_regs *regs) | ||
1030 | { | ||
1031 | ack_QIC_CPI(QIC_CALL_FUNCTION_SINGLE_CPI); | ||
1032 | smp_call_function_single_interrupt(); | ||
1033 | } | ||
1034 | |||
1035 | void smp_vic_cpi_interrupt(struct pt_regs *regs) | ||
1036 | { | ||
1037 | struct pt_regs *old_regs = set_irq_regs(regs); | ||
1038 | __u8 cpu = smp_processor_id(); | ||
1039 | |||
1040 | if (is_cpu_quad()) | ||
1041 | ack_QIC_CPI(VIC_CPI_LEVEL0); | ||
1042 | else | ||
1043 | ack_VIC_CPI(VIC_CPI_LEVEL0); | ||
1044 | |||
1045 | if (test_and_clear_bit(VIC_TIMER_CPI, &vic_cpi_mailbox[cpu])) | ||
1046 | wrapper_smp_local_timer_interrupt(); | ||
1047 | if (test_and_clear_bit(VIC_INVALIDATE_CPI, &vic_cpi_mailbox[cpu])) | ||
1048 | smp_invalidate_interrupt(); | ||
1049 | if (test_and_clear_bit(VIC_RESCHEDULE_CPI, &vic_cpi_mailbox[cpu])) | ||
1050 | smp_reschedule_interrupt(); | ||
1051 | if (test_and_clear_bit(VIC_ENABLE_IRQ_CPI, &vic_cpi_mailbox[cpu])) | ||
1052 | smp_enable_irq_interrupt(); | ||
1053 | if (test_and_clear_bit(VIC_CALL_FUNCTION_CPI, &vic_cpi_mailbox[cpu])) | ||
1054 | smp_call_function_interrupt(); | ||
1055 | if (test_and_clear_bit(VIC_CALL_FUNCTION_SINGLE_CPI, &vic_cpi_mailbox[cpu])) | ||
1056 | smp_call_function_single_interrupt(); | ||
1057 | set_irq_regs(old_regs); | ||
1058 | } | ||
1059 | |||
1060 | static void do_flush_tlb_all(void *info) | ||
1061 | { | ||
1062 | unsigned long cpu = smp_processor_id(); | ||
1063 | |||
1064 | __flush_tlb_all(); | ||
1065 | if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_LAZY) | ||
1066 | voyager_leave_mm(cpu); | ||
1067 | } | ||
1068 | |||
1069 | /* flush the TLB of every active CPU in the system */ | ||
1070 | void flush_tlb_all(void) | ||
1071 | { | ||
1072 | on_each_cpu(do_flush_tlb_all, 0, 1); | ||
1073 | } | ||
1074 | |||
1075 | /* send a reschedule CPI to one CPU by physical CPU number*/ | ||
1076 | static void voyager_smp_send_reschedule(int cpu) | ||
1077 | { | ||
1078 | send_one_CPI(cpu, VIC_RESCHEDULE_CPI); | ||
1079 | } | ||
1080 | |||
1081 | int hard_smp_processor_id(void) | ||
1082 | { | ||
1083 | __u8 i; | ||
1084 | __u8 cpumask = inb(VIC_PROC_WHO_AM_I); | ||
1085 | if ((cpumask & QUAD_IDENTIFIER) == QUAD_IDENTIFIER) | ||
1086 | return cpumask & 0x1F; | ||
1087 | |||
1088 | for (i = 0; i < 8; i++) { | ||
1089 | if (cpumask & (1 << i)) | ||
1090 | return i; | ||
1091 | } | ||
1092 | printk("** WARNING ** Illegal cpuid returned by VIC: %d", cpumask); | ||
1093 | return 0; | ||
1094 | } | ||
1095 | |||
1096 | int safe_smp_processor_id(void) | ||
1097 | { | ||
1098 | return hard_smp_processor_id(); | ||
1099 | } | ||
1100 | |||
1101 | /* broadcast a halt to all other CPUs */ | ||
1102 | static void voyager_smp_send_stop(void) | ||
1103 | { | ||
1104 | smp_call_function(smp_stop_cpu_function, NULL, 1); | ||
1105 | } | ||
1106 | |||
1107 | /* this function is triggered in time.c when a clock tick fires | ||
1108 | * we need to re-broadcast the tick to all CPUs */ | ||
1109 | void smp_vic_timer_interrupt(void) | ||
1110 | { | ||
1111 | send_CPI_allbutself(VIC_TIMER_CPI); | ||
1112 | smp_local_timer_interrupt(); | ||
1113 | } | ||
1114 | |||
1115 | /* local (per CPU) timer interrupt. It does both profiling and | ||
1116 | * process statistics/rescheduling. | ||
1117 | * | ||
1118 | * We do profiling in every local tick, statistics/rescheduling | ||
1119 | * happen only every 'profiling multiplier' ticks. The default | ||
1120 | * multiplier is 1 and it can be changed by writing the new multiplier | ||
1121 | * value into /proc/profile. | ||
1122 | */ | ||
1123 | void smp_local_timer_interrupt(void) | ||
1124 | { | ||
1125 | int cpu = smp_processor_id(); | ||
1126 | long weight; | ||
1127 | |||
1128 | profile_tick(CPU_PROFILING); | ||
1129 | if (--per_cpu(prof_counter, cpu) <= 0) { | ||
1130 | /* | ||
1131 | * The multiplier may have changed since the last time we got | ||
1132 | * to this point as a result of the user writing to | ||
1133 | * /proc/profile. In this case we need to adjust the APIC | ||
1134 | * timer accordingly. | ||
1135 | * | ||
1136 | * Interrupts are already masked off at this point. | ||
1137 | */ | ||
1138 | per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu); | ||
1139 | if (per_cpu(prof_counter, cpu) != | ||
1140 | per_cpu(prof_old_multiplier, cpu)) { | ||
1141 | /* FIXME: need to update the vic timer tick here */ | ||
1142 | per_cpu(prof_old_multiplier, cpu) = | ||
1143 | per_cpu(prof_counter, cpu); | ||
1144 | } | ||
1145 | |||
1146 | update_process_times(user_mode_vm(get_irq_regs())); | ||
1147 | } | ||
1148 | |||
1149 | if (((1 << cpu) & voyager_extended_vic_processors) == 0) | ||
1150 | /* only extended VIC processors participate in | ||
1151 | * interrupt distribution */ | ||
1152 | return; | ||
1153 | |||
1154 | /* | ||
1155 | * We take the 'long' return path, and there every subsystem | ||
1156 | * grabs the appropriate locks (kernel lock/ irq lock). | ||
1157 | * | ||
1158 | * we might want to decouple profiling from the 'long path', | ||
1159 | * and do the profiling totally in assembly. | ||
1160 | * | ||
1161 | * Currently this isn't too much of an issue (performance wise), | ||
1162 | * we can take more than 100K local irqs per second on a 100 MHz P5. | ||
1163 | */ | ||
1164 | |||
1165 | if ((++vic_tick[cpu] & 0x7) != 0) | ||
1166 | return; | ||
1167 | /* get here every 16 ticks (about every 1/6 of a second) */ | ||
1168 | |||
1169 | /* Change our priority to give someone else a chance at getting | ||
1170 | * the IRQ. The algorithm goes like this: | ||
1171 | * | ||
1172 | * In the VIC, the dynamically routed interrupt is always | ||
1173 | * handled by the lowest priority eligible (i.e. receiving | ||
1174 | * interrupts) CPU. If >1 eligible CPUs are equal lowest, the | ||
1175 | * lowest processor number gets it. | ||
1176 | * | ||
1177 | * The priority of a CPU is controlled by a special per-CPU | ||
1178 | * VIC priority register which is 3 bits wide 0 being lowest | ||
1179 | * and 7 highest priority.. | ||
1180 | * | ||
1181 | * Therefore we subtract the average number of interrupts from | ||
1182 | * the number we've fielded. If this number is negative, we | ||
1183 | * lower the activity count and if it is positive, we raise | ||
1184 | * it. | ||
1185 | * | ||
1186 | * I'm afraid this still leads to odd looking interrupt counts: | ||
1187 | * the totals are all roughly equal, but the individual ones | ||
1188 | * look rather skewed. | ||
1189 | * | ||
1190 | * FIXME: This algorithm is total crap when mixed with SMP | ||
1191 | * affinity code since we now try to even up the interrupt | ||
1192 | * counts when an affinity binding is keeping them on a | ||
1193 | * particular CPU*/ | ||
1194 | weight = (vic_intr_count[cpu] * voyager_extended_cpus | ||
1195 | - vic_intr_total) >> 4; | ||
1196 | weight += 4; | ||
1197 | if (weight > 7) | ||
1198 | weight = 7; | ||
1199 | if (weight < 0) | ||
1200 | weight = 0; | ||
1201 | |||
1202 | outb((__u8) weight, VIC_PRIORITY_REGISTER); | ||
1203 | |||
1204 | #ifdef VOYAGER_DEBUG | ||
1205 | if ((vic_tick[cpu] & 0xFFF) == 0) { | ||
1206 | /* print this message roughly every 25 secs */ | ||
1207 | printk("VOYAGER SMP: vic_tick[%d] = %lu, weight = %ld\n", | ||
1208 | cpu, vic_tick[cpu], weight); | ||
1209 | } | ||
1210 | #endif | ||
1211 | } | ||
1212 | |||
1213 | /* setup the profiling timer */ | ||
1214 | int setup_profiling_timer(unsigned int multiplier) | ||
1215 | { | ||
1216 | int i; | ||
1217 | |||
1218 | if ((!multiplier)) | ||
1219 | return -EINVAL; | ||
1220 | |||
1221 | /* | ||
1222 | * Set the new multiplier for each CPU. CPUs don't start using the | ||
1223 | * new values until the next timer interrupt in which they do process | ||
1224 | * accounting. | ||
1225 | */ | ||
1226 | for (i = 0; i < nr_cpu_ids; ++i) | ||
1227 | per_cpu(prof_multiplier, i) = multiplier; | ||
1228 | |||
1229 | return 0; | ||
1230 | } | ||
1231 | |||
1232 | /* This is a bit of a mess, but forced on us by the genirq changes | ||
1233 | * there's no genirq handler that really does what voyager wants | ||
1234 | * so hack it up with the simple IRQ handler */ | ||
1235 | static void handle_vic_irq(unsigned int irq, struct irq_desc *desc) | ||
1236 | { | ||
1237 | before_handle_vic_irq(irq); | ||
1238 | handle_simple_irq(irq, desc); | ||
1239 | after_handle_vic_irq(irq); | ||
1240 | } | ||
1241 | |||
1242 | /* The CPIs are handled in the per cpu 8259s, so they must be | ||
1243 | * enabled to be received: FIX: enabling the CPIs in the early | ||
1244 | * boot sequence interferes with bug checking; enable them later | ||
1245 | * on in smp_init */ | ||
1246 | #define VIC_SET_GATE(cpi, vector) \ | ||
1247 | set_intr_gate((cpi) + VIC_DEFAULT_CPI_BASE, (vector)) | ||
1248 | #define QIC_SET_GATE(cpi, vector) \ | ||
1249 | set_intr_gate((cpi) + QIC_DEFAULT_CPI_BASE, (vector)) | ||
1250 | |||
1251 | void __init voyager_smp_intr_init(void) | ||
1252 | { | ||
1253 | int i; | ||
1254 | |||
1255 | /* initialize the per cpu irq mask to all disabled */ | ||
1256 | for (i = 0; i < nr_cpu_ids; i++) | ||
1257 | vic_irq_mask[i] = 0xFFFF; | ||
1258 | |||
1259 | VIC_SET_GATE(VIC_CPI_LEVEL0, vic_cpi_interrupt); | ||
1260 | |||
1261 | VIC_SET_GATE(VIC_SYS_INT, vic_sys_interrupt); | ||
1262 | VIC_SET_GATE(VIC_CMN_INT, vic_cmn_interrupt); | ||
1263 | |||
1264 | QIC_SET_GATE(QIC_TIMER_CPI, qic_timer_interrupt); | ||
1265 | QIC_SET_GATE(QIC_INVALIDATE_CPI, qic_invalidate_interrupt); | ||
1266 | QIC_SET_GATE(QIC_RESCHEDULE_CPI, qic_reschedule_interrupt); | ||
1267 | QIC_SET_GATE(QIC_ENABLE_IRQ_CPI, qic_enable_irq_interrupt); | ||
1268 | QIC_SET_GATE(QIC_CALL_FUNCTION_CPI, qic_call_function_interrupt); | ||
1269 | |||
1270 | /* now put the VIC descriptor into the first 48 IRQs | ||
1271 | * | ||
1272 | * This is for later: first 16 correspond to PC IRQs; next 16 | ||
1273 | * are Primary MC IRQs and final 16 are Secondary MC IRQs */ | ||
1274 | for (i = 0; i < 48; i++) | ||
1275 | set_irq_chip_and_handler(i, &vic_chip, handle_vic_irq); | ||
1276 | } | ||
1277 | |||
1278 | /* send a CPI at level cpi to a set of cpus in cpuset (set 1 bit per | ||
1279 | * processor to receive CPI */ | ||
1280 | static void send_CPI(__u32 cpuset, __u8 cpi) | ||
1281 | { | ||
1282 | int cpu; | ||
1283 | __u32 quad_cpuset = (cpuset & voyager_quad_processors); | ||
1284 | |||
1285 | if (cpi < VIC_START_FAKE_CPI) { | ||
1286 | /* fake CPI are only used for booting, so send to the | ||
1287 | * extended quads as well---Quads must be VIC booted */ | ||
1288 | outb((__u8) (cpuset), VIC_CPI_Registers[cpi]); | ||
1289 | return; | ||
1290 | } | ||
1291 | if (quad_cpuset) | ||
1292 | send_QIC_CPI(quad_cpuset, cpi); | ||
1293 | cpuset &= ~quad_cpuset; | ||
1294 | cpuset &= 0xff; /* only first 8 CPUs vaild for VIC CPI */ | ||
1295 | if (cpuset == 0) | ||
1296 | return; | ||
1297 | for_each_online_cpu(cpu) { | ||
1298 | if (cpuset & (1 << cpu)) | ||
1299 | set_bit(cpi, &vic_cpi_mailbox[cpu]); | ||
1300 | } | ||
1301 | if (cpuset) | ||
1302 | outb((__u8) cpuset, VIC_CPI_Registers[VIC_CPI_LEVEL0]); | ||
1303 | } | ||
1304 | |||
1305 | /* Acknowledge receipt of CPI in the QIC, clear in QIC hardware and | ||
1306 | * set the cache line to shared by reading it. | ||
1307 | * | ||
1308 | * DON'T make this inline otherwise the cache line read will be | ||
1309 | * optimised away | ||
1310 | * */ | ||
1311 | static int ack_QIC_CPI(__u8 cpi) | ||
1312 | { | ||
1313 | __u8 cpu = hard_smp_processor_id(); | ||
1314 | |||
1315 | cpi &= 7; | ||
1316 | |||
1317 | outb(1 << cpi, QIC_INTERRUPT_CLEAR1); | ||
1318 | return voyager_quad_cpi_addr[cpu]->qic_cpi[cpi].cpi; | ||
1319 | } | ||
1320 | |||
1321 | static void ack_special_QIC_CPI(__u8 cpi) | ||
1322 | { | ||
1323 | switch (cpi) { | ||
1324 | case VIC_CMN_INT: | ||
1325 | outb(QIC_CMN_INT, QIC_INTERRUPT_CLEAR0); | ||
1326 | break; | ||
1327 | case VIC_SYS_INT: | ||
1328 | outb(QIC_SYS_INT, QIC_INTERRUPT_CLEAR0); | ||
1329 | break; | ||
1330 | } | ||
1331 | /* also clear at the VIC, just in case (nop for non-extended proc) */ | ||
1332 | ack_VIC_CPI(cpi); | ||
1333 | } | ||
1334 | |||
1335 | /* Acknowledge receipt of CPI in the VIC (essentially an EOI) */ | ||
1336 | static void ack_VIC_CPI(__u8 cpi) | ||
1337 | { | ||
1338 | #ifdef VOYAGER_DEBUG | ||
1339 | unsigned long flags; | ||
1340 | __u16 isr; | ||
1341 | __u8 cpu = smp_processor_id(); | ||
1342 | |||
1343 | local_irq_save(flags); | ||
1344 | isr = vic_read_isr(); | ||
1345 | if ((isr & (1 << (cpi & 7))) == 0) { | ||
1346 | printk("VOYAGER SMP: CPU%d lost CPI%d\n", cpu, cpi); | ||
1347 | } | ||
1348 | #endif | ||
1349 | /* send specific EOI; the two system interrupts have | ||
1350 | * bit 4 set for a separate vector but behave as the | ||
1351 | * corresponding 3 bit intr */ | ||
1352 | outb_p(0x60 | (cpi & 7), 0x20); | ||
1353 | |||
1354 | #ifdef VOYAGER_DEBUG | ||
1355 | if ((vic_read_isr() & (1 << (cpi & 7))) != 0) { | ||
1356 | printk("VOYAGER SMP: CPU%d still asserting CPI%d\n", cpu, cpi); | ||
1357 | } | ||
1358 | local_irq_restore(flags); | ||
1359 | #endif | ||
1360 | } | ||
1361 | |||
1362 | /* cribbed with thanks from irq.c */ | ||
1363 | #define __byte(x,y) (((unsigned char *)&(y))[x]) | ||
1364 | #define cached_21(cpu) (__byte(0,vic_irq_mask[cpu])) | ||
1365 | #define cached_A1(cpu) (__byte(1,vic_irq_mask[cpu])) | ||
1366 | |||
1367 | static unsigned int startup_vic_irq(unsigned int irq) | ||
1368 | { | ||
1369 | unmask_vic_irq(irq); | ||
1370 | |||
1371 | return 0; | ||
1372 | } | ||
1373 | |||
1374 | /* The enable and disable routines. This is where we run into | ||
1375 | * conflicting architectural philosophy. Fundamentally, the voyager | ||
1376 | * architecture does not expect to have to disable interrupts globally | ||
1377 | * (the IRQ controllers belong to each CPU). The processor masquerade | ||
1378 | * which is used to start the system shouldn't be used in a running OS | ||
1379 | * since it will cause great confusion if two separate CPUs drive to | ||
1380 | * the same IRQ controller (I know, I've tried it). | ||
1381 | * | ||
1382 | * The solution is a variant on the NCR lazy SPL design: | ||
1383 | * | ||
1384 | * 1) To disable an interrupt, do nothing (other than set the | ||
1385 | * IRQ_DISABLED flag). This dares the interrupt actually to arrive. | ||
1386 | * | ||
1387 | * 2) If the interrupt dares to come in, raise the local mask against | ||
1388 | * it (this will result in all the CPU masks being raised | ||
1389 | * eventually). | ||
1390 | * | ||
1391 | * 3) To enable the interrupt, lower the mask on the local CPU and | ||
1392 | * broadcast an Interrupt enable CPI which causes all other CPUs to | ||
1393 | * adjust their masks accordingly. */ | ||
1394 | |||
1395 | static void unmask_vic_irq(unsigned int irq) | ||
1396 | { | ||
1397 | /* linux doesn't to processor-irq affinity, so enable on | ||
1398 | * all CPUs we know about */ | ||
1399 | int cpu = smp_processor_id(), real_cpu; | ||
1400 | __u16 mask = (1 << irq); | ||
1401 | __u32 processorList = 0; | ||
1402 | unsigned long flags; | ||
1403 | |||
1404 | VDEBUG(("VOYAGER: unmask_vic_irq(%d) CPU%d affinity 0x%lx\n", | ||
1405 | irq, cpu, cpu_irq_affinity[cpu])); | ||
1406 | spin_lock_irqsave(&vic_irq_lock, flags); | ||
1407 | for_each_online_cpu(real_cpu) { | ||
1408 | if (!(voyager_extended_vic_processors & (1 << real_cpu))) | ||
1409 | continue; | ||
1410 | if (!(cpu_irq_affinity[real_cpu] & mask)) { | ||
1411 | /* irq has no affinity for this CPU, ignore */ | ||
1412 | continue; | ||
1413 | } | ||
1414 | if (real_cpu == cpu) { | ||
1415 | enable_local_vic_irq(irq); | ||
1416 | } else if (vic_irq_mask[real_cpu] & mask) { | ||
1417 | vic_irq_enable_mask[real_cpu] |= mask; | ||
1418 | processorList |= (1 << real_cpu); | ||
1419 | } | ||
1420 | } | ||
1421 | spin_unlock_irqrestore(&vic_irq_lock, flags); | ||
1422 | if (processorList) | ||
1423 | send_CPI(processorList, VIC_ENABLE_IRQ_CPI); | ||
1424 | } | ||
1425 | |||
1426 | static void mask_vic_irq(unsigned int irq) | ||
1427 | { | ||
1428 | /* lazy disable, do nothing */ | ||
1429 | } | ||
1430 | |||
1431 | static void enable_local_vic_irq(unsigned int irq) | ||
1432 | { | ||
1433 | __u8 cpu = smp_processor_id(); | ||
1434 | __u16 mask = ~(1 << irq); | ||
1435 | __u16 old_mask = vic_irq_mask[cpu]; | ||
1436 | |||
1437 | vic_irq_mask[cpu] &= mask; | ||
1438 | if (vic_irq_mask[cpu] == old_mask) | ||
1439 | return; | ||
1440 | |||
1441 | VDEBUG(("VOYAGER DEBUG: Enabling irq %d in hardware on CPU %d\n", | ||
1442 | irq, cpu)); | ||
1443 | |||
1444 | if (irq & 8) { | ||
1445 | outb_p(cached_A1(cpu), 0xA1); | ||
1446 | (void)inb_p(0xA1); | ||
1447 | } else { | ||
1448 | outb_p(cached_21(cpu), 0x21); | ||
1449 | (void)inb_p(0x21); | ||
1450 | } | ||
1451 | } | ||
1452 | |||
1453 | static void disable_local_vic_irq(unsigned int irq) | ||
1454 | { | ||
1455 | __u8 cpu = smp_processor_id(); | ||
1456 | __u16 mask = (1 << irq); | ||
1457 | __u16 old_mask = vic_irq_mask[cpu]; | ||
1458 | |||
1459 | if (irq == 7) | ||
1460 | return; | ||
1461 | |||
1462 | vic_irq_mask[cpu] |= mask; | ||
1463 | if (old_mask == vic_irq_mask[cpu]) | ||
1464 | return; | ||
1465 | |||
1466 | VDEBUG(("VOYAGER DEBUG: Disabling irq %d in hardware on CPU %d\n", | ||
1467 | irq, cpu)); | ||
1468 | |||
1469 | if (irq & 8) { | ||
1470 | outb_p(cached_A1(cpu), 0xA1); | ||
1471 | (void)inb_p(0xA1); | ||
1472 | } else { | ||
1473 | outb_p(cached_21(cpu), 0x21); | ||
1474 | (void)inb_p(0x21); | ||
1475 | } | ||
1476 | } | ||
1477 | |||
1478 | /* The VIC is level triggered, so the ack can only be issued after the | ||
1479 | * interrupt completes. However, we do Voyager lazy interrupt | ||
1480 | * handling here: It is an extremely expensive operation to mask an | ||
1481 | * interrupt in the vic, so we merely set a flag (IRQ_DISABLED). If | ||
1482 | * this interrupt actually comes in, then we mask and ack here to push | ||
1483 | * the interrupt off to another CPU */ | ||
1484 | static void before_handle_vic_irq(unsigned int irq) | ||
1485 | { | ||
1486 | irq_desc_t *desc = irq_to_desc(irq); | ||
1487 | __u8 cpu = smp_processor_id(); | ||
1488 | |||
1489 | _raw_spin_lock(&vic_irq_lock); | ||
1490 | vic_intr_total++; | ||
1491 | vic_intr_count[cpu]++; | ||
1492 | |||
1493 | if (!(cpu_irq_affinity[cpu] & (1 << irq))) { | ||
1494 | /* The irq is not in our affinity mask, push it off | ||
1495 | * onto another CPU */ | ||
1496 | VDEBUG(("VOYAGER DEBUG: affinity triggered disable of irq %d " | ||
1497 | "on cpu %d\n", irq, cpu)); | ||
1498 | disable_local_vic_irq(irq); | ||
1499 | /* set IRQ_INPROGRESS to prevent the handler in irq.c from | ||
1500 | * actually calling the interrupt routine */ | ||
1501 | desc->status |= IRQ_REPLAY | IRQ_INPROGRESS; | ||
1502 | } else if (desc->status & IRQ_DISABLED) { | ||
1503 | /* Damn, the interrupt actually arrived, do the lazy | ||
1504 | * disable thing. The interrupt routine in irq.c will | ||
1505 | * not handle a IRQ_DISABLED interrupt, so nothing more | ||
1506 | * need be done here */ | ||
1507 | VDEBUG(("VOYAGER DEBUG: lazy disable of irq %d on CPU %d\n", | ||
1508 | irq, cpu)); | ||
1509 | disable_local_vic_irq(irq); | ||
1510 | desc->status |= IRQ_REPLAY; | ||
1511 | } else { | ||
1512 | desc->status &= ~IRQ_REPLAY; | ||
1513 | } | ||
1514 | |||
1515 | _raw_spin_unlock(&vic_irq_lock); | ||
1516 | } | ||
1517 | |||
1518 | /* Finish the VIC interrupt: basically mask */ | ||
1519 | static void after_handle_vic_irq(unsigned int irq) | ||
1520 | { | ||
1521 | irq_desc_t *desc = irq_to_desc(irq); | ||
1522 | |||
1523 | _raw_spin_lock(&vic_irq_lock); | ||
1524 | { | ||
1525 | unsigned int status = desc->status & ~IRQ_INPROGRESS; | ||
1526 | #ifdef VOYAGER_DEBUG | ||
1527 | __u16 isr; | ||
1528 | #endif | ||
1529 | |||
1530 | desc->status = status; | ||
1531 | if ((status & IRQ_DISABLED)) | ||
1532 | disable_local_vic_irq(irq); | ||
1533 | #ifdef VOYAGER_DEBUG | ||
1534 | /* DEBUG: before we ack, check what's in progress */ | ||
1535 | isr = vic_read_isr(); | ||
1536 | if ((isr & (1 << irq) && !(status & IRQ_REPLAY)) == 0) { | ||
1537 | int i; | ||
1538 | __u8 cpu = smp_processor_id(); | ||
1539 | __u8 real_cpu; | ||
1540 | int mask; /* Um... initialize me??? --RR */ | ||
1541 | |||
1542 | printk("VOYAGER SMP: CPU%d lost interrupt %d\n", | ||
1543 | cpu, irq); | ||
1544 | for_each_possible_cpu(real_cpu, mask) { | ||
1545 | |||
1546 | outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu, | ||
1547 | VIC_PROCESSOR_ID); | ||
1548 | isr = vic_read_isr(); | ||
1549 | if (isr & (1 << irq)) { | ||
1550 | printk | ||
1551 | ("VOYAGER SMP: CPU%d ack irq %d\n", | ||
1552 | real_cpu, irq); | ||
1553 | ack_vic_irq(irq); | ||
1554 | } | ||
1555 | outb(cpu, VIC_PROCESSOR_ID); | ||
1556 | } | ||
1557 | } | ||
1558 | #endif /* VOYAGER_DEBUG */ | ||
1559 | /* as soon as we ack, the interrupt is eligible for | ||
1560 | * receipt by another CPU so everything must be in | ||
1561 | * order here */ | ||
1562 | ack_vic_irq(irq); | ||
1563 | if (status & IRQ_REPLAY) { | ||
1564 | /* replay is set if we disable the interrupt | ||
1565 | * in the before_handle_vic_irq() routine, so | ||
1566 | * clear the in progress bit here to allow the | ||
1567 | * next CPU to handle this correctly */ | ||
1568 | desc->status &= ~(IRQ_REPLAY | IRQ_INPROGRESS); | ||
1569 | } | ||
1570 | #ifdef VOYAGER_DEBUG | ||
1571 | isr = vic_read_isr(); | ||
1572 | if ((isr & (1 << irq)) != 0) | ||
1573 | printk("VOYAGER SMP: after_handle_vic_irq() after " | ||
1574 | "ack irq=%d, isr=0x%x\n", irq, isr); | ||
1575 | #endif /* VOYAGER_DEBUG */ | ||
1576 | } | ||
1577 | _raw_spin_unlock(&vic_irq_lock); | ||
1578 | |||
1579 | /* All code after this point is out of the main path - the IRQ | ||
1580 | * may be intercepted by another CPU if reasserted */ | ||
1581 | } | ||
1582 | |||
1583 | /* Linux processor - interrupt affinity manipulations. | ||
1584 | * | ||
1585 | * For each processor, we maintain a 32 bit irq affinity mask. | ||
1586 | * Initially it is set to all 1's so every processor accepts every | ||
1587 | * interrupt. In this call, we change the processor's affinity mask: | ||
1588 | * | ||
1589 | * Change from enable to disable: | ||
1590 | * | ||
1591 | * If the interrupt ever comes in to the processor, we will disable it | ||
1592 | * and ack it to push it off to another CPU, so just accept the mask here. | ||
1593 | * | ||
1594 | * Change from disable to enable: | ||
1595 | * | ||
1596 | * change the mask and then do an interrupt enable CPI to re-enable on | ||
1597 | * the selected processors */ | ||
1598 | |||
1599 | void set_vic_irq_affinity(unsigned int irq, const struct cpumask *mask) | ||
1600 | { | ||
1601 | /* Only extended processors handle interrupts */ | ||
1602 | unsigned long real_mask; | ||
1603 | unsigned long irq_mask = 1 << irq; | ||
1604 | int cpu; | ||
1605 | |||
1606 | real_mask = cpus_addr(*mask)[0] & voyager_extended_vic_processors; | ||
1607 | |||
1608 | if (cpus_addr(*mask)[0] == 0) | ||
1609 | /* can't have no CPUs to accept the interrupt -- extremely | ||
1610 | * bad things will happen */ | ||
1611 | return; | ||
1612 | |||
1613 | if (irq == 0) | ||
1614 | /* can't change the affinity of the timer IRQ. This | ||
1615 | * is due to the constraint in the voyager | ||
1616 | * architecture that the CPI also comes in on and IRQ | ||
1617 | * line and we have chosen IRQ0 for this. If you | ||
1618 | * raise the mask on this interrupt, the processor | ||
1619 | * will no-longer be able to accept VIC CPIs */ | ||
1620 | return; | ||
1621 | |||
1622 | if (irq >= 32) | ||
1623 | /* You can only have 32 interrupts in a voyager system | ||
1624 | * (and 32 only if you have a secondary microchannel | ||
1625 | * bus) */ | ||
1626 | return; | ||
1627 | |||
1628 | for_each_online_cpu(cpu) { | ||
1629 | unsigned long cpu_mask = 1 << cpu; | ||
1630 | |||
1631 | if (cpu_mask & real_mask) { | ||
1632 | /* enable the interrupt for this cpu */ | ||
1633 | cpu_irq_affinity[cpu] |= irq_mask; | ||
1634 | } else { | ||
1635 | /* disable the interrupt for this cpu */ | ||
1636 | cpu_irq_affinity[cpu] &= ~irq_mask; | ||
1637 | } | ||
1638 | } | ||
1639 | /* this is magic, we now have the correct affinity maps, so | ||
1640 | * enable the interrupt. This will send an enable CPI to | ||
1641 | * those CPUs who need to enable it in their local masks, | ||
1642 | * causing them to correct for the new affinity . If the | ||
1643 | * interrupt is currently globally disabled, it will simply be | ||
1644 | * disabled again as it comes in (voyager lazy disable). If | ||
1645 | * the affinity map is tightened to disable the interrupt on a | ||
1646 | * cpu, it will be pushed off when it comes in */ | ||
1647 | unmask_vic_irq(irq); | ||
1648 | } | ||
1649 | |||
1650 | static void ack_vic_irq(unsigned int irq) | ||
1651 | { | ||
1652 | if (irq & 8) { | ||
1653 | outb(0x62, 0x20); /* Specific EOI to cascade */ | ||
1654 | outb(0x60 | (irq & 7), 0xA0); | ||
1655 | } else { | ||
1656 | outb(0x60 | (irq & 7), 0x20); | ||
1657 | } | ||
1658 | } | ||
1659 | |||
1660 | /* enable the CPIs. In the VIC, the CPIs are delivered by the 8259 | ||
1661 | * but are not vectored by it. This means that the 8259 mask must be | ||
1662 | * lowered to receive them */ | ||
1663 | static __init void vic_enable_cpi(void) | ||
1664 | { | ||
1665 | __u8 cpu = smp_processor_id(); | ||
1666 | |||
1667 | /* just take a copy of the current mask (nop for boot cpu) */ | ||
1668 | vic_irq_mask[cpu] = vic_irq_mask[boot_cpu_id]; | ||
1669 | |||
1670 | enable_local_vic_irq(VIC_CPI_LEVEL0); | ||
1671 | enable_local_vic_irq(VIC_CPI_LEVEL1); | ||
1672 | /* for sys int and cmn int */ | ||
1673 | enable_local_vic_irq(7); | ||
1674 | |||
1675 | if (is_cpu_quad()) { | ||
1676 | outb(QIC_DEFAULT_MASK0, QIC_MASK_REGISTER0); | ||
1677 | outb(QIC_CPI_ENABLE, QIC_MASK_REGISTER1); | ||
1678 | VDEBUG(("VOYAGER SMP: QIC ENABLE CPI: CPU%d: MASK 0x%x\n", | ||
1679 | cpu, QIC_CPI_ENABLE)); | ||
1680 | } | ||
1681 | |||
1682 | VDEBUG(("VOYAGER SMP: ENABLE CPI: CPU%d: MASK 0x%x\n", | ||
1683 | cpu, vic_irq_mask[cpu])); | ||
1684 | } | ||
1685 | |||
1686 | void voyager_smp_dump() | ||
1687 | { | ||
1688 | int old_cpu = smp_processor_id(), cpu; | ||
1689 | |||
1690 | /* dump the interrupt masks of each processor */ | ||
1691 | for_each_online_cpu(cpu) { | ||
1692 | __u16 imr, isr, irr; | ||
1693 | unsigned long flags; | ||
1694 | |||
1695 | local_irq_save(flags); | ||
1696 | outb(VIC_CPU_MASQUERADE_ENABLE | cpu, VIC_PROCESSOR_ID); | ||
1697 | imr = (inb(0xa1) << 8) | inb(0x21); | ||
1698 | outb(0x0a, 0xa0); | ||
1699 | irr = inb(0xa0) << 8; | ||
1700 | outb(0x0a, 0x20); | ||
1701 | irr |= inb(0x20); | ||
1702 | outb(0x0b, 0xa0); | ||
1703 | isr = inb(0xa0) << 8; | ||
1704 | outb(0x0b, 0x20); | ||
1705 | isr |= inb(0x20); | ||
1706 | outb(old_cpu, VIC_PROCESSOR_ID); | ||
1707 | local_irq_restore(flags); | ||
1708 | printk("\tCPU%d: mask=0x%x, IMR=0x%x, IRR=0x%x, ISR=0x%x\n", | ||
1709 | cpu, vic_irq_mask[cpu], imr, irr, isr); | ||
1710 | #if 0 | ||
1711 | /* These lines are put in to try to unstick an un ack'd irq */ | ||
1712 | if (isr != 0) { | ||
1713 | int irq; | ||
1714 | for (irq = 0; irq < 16; irq++) { | ||
1715 | if (isr & (1 << irq)) { | ||
1716 | printk("\tCPU%d: ack irq %d\n", | ||
1717 | cpu, irq); | ||
1718 | local_irq_save(flags); | ||
1719 | outb(VIC_CPU_MASQUERADE_ENABLE | cpu, | ||
1720 | VIC_PROCESSOR_ID); | ||
1721 | ack_vic_irq(irq); | ||
1722 | outb(old_cpu, VIC_PROCESSOR_ID); | ||
1723 | local_irq_restore(flags); | ||
1724 | } | ||
1725 | } | ||
1726 | } | ||
1727 | #endif | ||
1728 | } | ||
1729 | } | ||
1730 | |||
1731 | void smp_voyager_power_off(void *dummy) | ||
1732 | { | ||
1733 | if (smp_processor_id() == boot_cpu_id) | ||
1734 | voyager_power_off(); | ||
1735 | else | ||
1736 | smp_stop_cpu_function(NULL); | ||
1737 | } | ||
1738 | |||
1739 | static void __init voyager_smp_prepare_cpus(unsigned int max_cpus) | ||
1740 | { | ||
1741 | /* FIXME: ignore max_cpus for now */ | ||
1742 | smp_boot_cpus(); | ||
1743 | } | ||
1744 | |||
1745 | static void __cpuinit voyager_smp_prepare_boot_cpu(void) | ||
1746 | { | ||
1747 | int cpu = smp_processor_id(); | ||
1748 | switch_to_new_gdt(cpu); | ||
1749 | |||
1750 | cpu_set(cpu, cpu_online_map); | ||
1751 | cpu_set(cpu, cpu_callout_map); | ||
1752 | cpu_set(cpu, cpu_possible_map); | ||
1753 | cpu_set(cpu, cpu_present_map); | ||
1754 | |||
1755 | } | ||
1756 | |||
1757 | static int __cpuinit voyager_cpu_up(unsigned int cpu) | ||
1758 | { | ||
1759 | /* This only works at boot for x86. See "rewrite" above. */ | ||
1760 | if (cpu_isset(cpu, smp_commenced_mask)) | ||
1761 | return -ENOSYS; | ||
1762 | |||
1763 | /* In case one didn't come up */ | ||
1764 | if (!cpu_isset(cpu, cpu_callin_map)) | ||
1765 | return -EIO; | ||
1766 | /* Unleash the CPU! */ | ||
1767 | cpu_set(cpu, smp_commenced_mask); | ||
1768 | while (!cpu_online(cpu)) | ||
1769 | mb(); | ||
1770 | return 0; | ||
1771 | } | ||
1772 | |||
1773 | static void __init voyager_smp_cpus_done(unsigned int max_cpus) | ||
1774 | { | ||
1775 | zap_low_mappings(); | ||
1776 | } | ||
1777 | |||
1778 | void __init smp_setup_processor_id(void) | ||
1779 | { | ||
1780 | current_thread_info()->cpu = hard_smp_processor_id(); | ||
1781 | } | ||
1782 | |||
1783 | static void voyager_send_call_func(const struct cpumask *callmask) | ||
1784 | { | ||
1785 | __u32 mask = cpus_addr(*callmask)[0] & ~(1 << smp_processor_id()); | ||
1786 | send_CPI(mask, VIC_CALL_FUNCTION_CPI); | ||
1787 | } | ||
1788 | |||
1789 | static void voyager_send_call_func_single(int cpu) | ||
1790 | { | ||
1791 | send_CPI(1 << cpu, VIC_CALL_FUNCTION_SINGLE_CPI); | ||
1792 | } | ||
1793 | |||
1794 | struct smp_ops smp_ops = { | ||
1795 | .smp_prepare_boot_cpu = voyager_smp_prepare_boot_cpu, | ||
1796 | .smp_prepare_cpus = voyager_smp_prepare_cpus, | ||
1797 | .cpu_up = voyager_cpu_up, | ||
1798 | .smp_cpus_done = voyager_smp_cpus_done, | ||
1799 | |||
1800 | .smp_send_stop = voyager_smp_send_stop, | ||
1801 | .smp_send_reschedule = voyager_smp_send_reschedule, | ||
1802 | |||
1803 | .send_call_func_ipi = voyager_send_call_func, | ||
1804 | .send_call_func_single_ipi = voyager_send_call_func_single, | ||
1805 | }; | ||
diff --git a/arch/x86/mach-voyager/voyager_thread.c b/arch/x86/mach-voyager/voyager_thread.c deleted file mode 100644 index 15464a20fb38..000000000000 --- a/arch/x86/mach-voyager/voyager_thread.c +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | /* -*- mode: c; c-basic-offset: 8 -*- */ | ||
2 | |||
3 | /* Copyright (C) 2001 | ||
4 | * | ||
5 | * Author: J.E.J.Bottomley@HansenPartnership.com | ||
6 | * | ||
7 | * This module provides the machine status monitor thread for the | ||
8 | * voyager architecture. This allows us to monitor the machine | ||
9 | * environment (temp, voltage, fan function) and the front panel and | ||
10 | * internal UPS. If a fault is detected, this thread takes corrective | ||
11 | * action (usually just informing init) | ||
12 | * */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/mm.h> | ||
16 | #include <linux/kernel_stat.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/mc146818rtc.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/bootmem.h> | ||
21 | #include <linux/kmod.h> | ||
22 | #include <linux/completion.h> | ||
23 | #include <linux/sched.h> | ||
24 | #include <linux/kthread.h> | ||
25 | #include <asm/desc.h> | ||
26 | #include <asm/voyager.h> | ||
27 | #include <asm/vic.h> | ||
28 | #include <asm/mtrr.h> | ||
29 | #include <asm/msr.h> | ||
30 | |||
31 | struct task_struct *voyager_thread; | ||
32 | static __u8 set_timeout; | ||
33 | |||
34 | static int execute(const char *string) | ||
35 | { | ||
36 | int ret; | ||
37 | |||
38 | char *envp[] = { | ||
39 | "HOME=/", | ||
40 | "TERM=linux", | ||
41 | "PATH=/sbin:/usr/sbin:/bin:/usr/bin", | ||
42 | NULL, | ||
43 | }; | ||
44 | char *argv[] = { | ||
45 | "/bin/bash", | ||
46 | "-c", | ||
47 | (char *)string, | ||
48 | NULL, | ||
49 | }; | ||
50 | |||
51 | if ((ret = | ||
52 | call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC)) != 0) { | ||
53 | printk(KERN_ERR "Voyager failed to run \"%s\": %i\n", string, | ||
54 | ret); | ||
55 | } | ||
56 | return ret; | ||
57 | } | ||
58 | |||
59 | static void check_from_kernel(void) | ||
60 | { | ||
61 | if (voyager_status.switch_off) { | ||
62 | |||
63 | /* FIXME: This should be configurable via proc */ | ||
64 | execute("umask 600; echo 0 > /etc/initrunlvl; kill -HUP 1"); | ||
65 | } else if (voyager_status.power_fail) { | ||
66 | VDEBUG(("Voyager daemon detected AC power failure\n")); | ||
67 | |||
68 | /* FIXME: This should be configureable via proc */ | ||
69 | execute("umask 600; echo F > /etc/powerstatus; kill -PWR 1"); | ||
70 | set_timeout = 1; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | static void check_continuing_condition(void) | ||
75 | { | ||
76 | if (voyager_status.power_fail) { | ||
77 | __u8 data; | ||
78 | voyager_cat_psi(VOYAGER_PSI_SUBREAD, | ||
79 | VOYAGER_PSI_AC_FAIL_REG, &data); | ||
80 | if ((data & 0x1f) == 0) { | ||
81 | /* all power restored */ | ||
82 | printk(KERN_NOTICE | ||
83 | "VOYAGER AC power restored, cancelling shutdown\n"); | ||
84 | /* FIXME: should be user configureable */ | ||
85 | execute | ||
86 | ("umask 600; echo O > /etc/powerstatus; kill -PWR 1"); | ||
87 | set_timeout = 0; | ||
88 | } | ||
89 | } | ||
90 | } | ||
91 | |||
92 | static int thread(void *unused) | ||
93 | { | ||
94 | printk(KERN_NOTICE "Voyager starting monitor thread\n"); | ||
95 | |||
96 | for (;;) { | ||
97 | set_current_state(TASK_INTERRUPTIBLE); | ||
98 | schedule_timeout(set_timeout ? HZ : MAX_SCHEDULE_TIMEOUT); | ||
99 | |||
100 | VDEBUG(("Voyager Daemon awoken\n")); | ||
101 | if (voyager_status.request_from_kernel == 0) { | ||
102 | /* probably awoken from timeout */ | ||
103 | check_continuing_condition(); | ||
104 | } else { | ||
105 | check_from_kernel(); | ||
106 | voyager_status.request_from_kernel = 0; | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | |||
111 | static int __init voyager_thread_start(void) | ||
112 | { | ||
113 | voyager_thread = kthread_run(thread, NULL, "kvoyagerd"); | ||
114 | if (IS_ERR(voyager_thread)) { | ||
115 | printk(KERN_ERR | ||
116 | "Voyager: Failed to create system monitor thread.\n"); | ||
117 | return PTR_ERR(voyager_thread); | ||
118 | } | ||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | static void __exit voyager_thread_stop(void) | ||
123 | { | ||
124 | kthread_stop(voyager_thread); | ||
125 | } | ||
126 | |||
127 | module_init(voyager_thread_start); | ||
128 | module_exit(voyager_thread_stop); | ||
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 29644175490f..a03b7279efa0 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -1,74 +1,79 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 1995 Linus Torvalds | 2 | * Copyright (C) 1995 Linus Torvalds |
3 | * Copyright (C) 2001,2002 Andi Kleen, SuSE Labs. | 3 | * Copyright (C) 2001, 2002 Andi Kleen, SuSE Labs. |
4 | * Copyright (C) 2008-2009, Red Hat Inc., Ingo Molnar | ||
4 | */ | 5 | */ |
5 | |||
6 | #include <linux/signal.h> | ||
7 | #include <linux/sched.h> | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/errno.h> | ||
10 | #include <linux/string.h> | ||
11 | #include <linux/types.h> | ||
12 | #include <linux/ptrace.h> | ||
13 | #include <linux/mmiotrace.h> | ||
14 | #include <linux/mman.h> | ||
15 | #include <linux/mm.h> | ||
16 | #include <linux/smp.h> | ||
17 | #include <linux/interrupt.h> | 6 | #include <linux/interrupt.h> |
18 | #include <linux/init.h> | 7 | #include <linux/mmiotrace.h> |
19 | #include <linux/tty.h> | 8 | #include <linux/bootmem.h> |
20 | #include <linux/vt_kern.h> /* For unblank_screen() */ | ||
21 | #include <linux/compiler.h> | 9 | #include <linux/compiler.h> |
22 | #include <linux/highmem.h> | 10 | #include <linux/highmem.h> |
23 | #include <linux/bootmem.h> /* for max_low_pfn */ | ||
24 | #include <linux/vmalloc.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/kprobes.h> | 11 | #include <linux/kprobes.h> |
27 | #include <linux/uaccess.h> | 12 | #include <linux/uaccess.h> |
13 | #include <linux/vmalloc.h> | ||
14 | #include <linux/vt_kern.h> | ||
15 | #include <linux/signal.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/ptrace.h> | ||
18 | #include <linux/string.h> | ||
19 | #include <linux/module.h> | ||
28 | #include <linux/kdebug.h> | 20 | #include <linux/kdebug.h> |
21 | #include <linux/errno.h> | ||
29 | #include <linux/magic.h> | 22 | #include <linux/magic.h> |
23 | #include <linux/sched.h> | ||
24 | #include <linux/types.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/mman.h> | ||
27 | #include <linux/tty.h> | ||
28 | #include <linux/smp.h> | ||
29 | #include <linux/mm.h> | ||
30 | |||
31 | #include <asm-generic/sections.h> | ||
30 | 32 | ||
31 | #include <asm/system.h> | ||
32 | #include <asm/desc.h> | ||
33 | #include <asm/segment.h> | ||
34 | #include <asm/pgalloc.h> | ||
35 | #include <asm/smp.h> | ||
36 | #include <asm/tlbflush.h> | 33 | #include <asm/tlbflush.h> |
34 | #include <asm/pgalloc.h> | ||
35 | #include <asm/segment.h> | ||
36 | #include <asm/system.h> | ||
37 | #include <asm/proto.h> | 37 | #include <asm/proto.h> |
38 | #include <asm-generic/sections.h> | ||
39 | #include <asm/traps.h> | 38 | #include <asm/traps.h> |
39 | #include <asm/desc.h> | ||
40 | 40 | ||
41 | /* | 41 | /* |
42 | * Page fault error code bits | 42 | * Page fault error code bits: |
43 | * bit 0 == 0 means no page found, 1 means protection fault | 43 | * |
44 | * bit 1 == 0 means read, 1 means write | 44 | * bit 0 == 0: no page found 1: protection fault |
45 | * bit 2 == 0 means kernel, 1 means user-mode | 45 | * bit 1 == 0: read access 1: write access |
46 | * bit 3 == 1 means use of reserved bit detected | 46 | * bit 2 == 0: kernel-mode access 1: user-mode access |
47 | * bit 4 == 1 means fault was an instruction fetch | 47 | * bit 3 == 1: use of reserved bit detected |
48 | * bit 4 == 1: fault was an instruction fetch | ||
48 | */ | 49 | */ |
49 | #define PF_PROT (1<<0) | 50 | enum x86_pf_error_code { |
50 | #define PF_WRITE (1<<1) | ||
51 | #define PF_USER (1<<2) | ||
52 | #define PF_RSVD (1<<3) | ||
53 | #define PF_INSTR (1<<4) | ||
54 | 51 | ||
52 | PF_PROT = 1 << 0, | ||
53 | PF_WRITE = 1 << 1, | ||
54 | PF_USER = 1 << 2, | ||
55 | PF_RSVD = 1 << 3, | ||
56 | PF_INSTR = 1 << 4, | ||
57 | }; | ||
58 | |||
59 | /* | ||
60 | * Returns 0 if mmiotrace is disabled, or if the fault is not | ||
61 | * handled by mmiotrace: | ||
62 | */ | ||
55 | static inline int kmmio_fault(struct pt_regs *regs, unsigned long addr) | 63 | static inline int kmmio_fault(struct pt_regs *regs, unsigned long addr) |
56 | { | 64 | { |
57 | #ifdef CONFIG_MMIOTRACE | ||
58 | if (unlikely(is_kmmio_active())) | 65 | if (unlikely(is_kmmio_active())) |
59 | if (kmmio_handler(regs, addr) == 1) | 66 | if (kmmio_handler(regs, addr) == 1) |
60 | return -1; | 67 | return -1; |
61 | #endif | ||
62 | return 0; | 68 | return 0; |
63 | } | 69 | } |
64 | 70 | ||
65 | static inline int notify_page_fault(struct pt_regs *regs) | 71 | static inline int notify_page_fault(struct pt_regs *regs) |
66 | { | 72 | { |
67 | #ifdef CONFIG_KPROBES | ||
68 | int ret = 0; | 73 | int ret = 0; |
69 | 74 | ||
70 | /* kprobe_running() needs smp_processor_id() */ | 75 | /* kprobe_running() needs smp_processor_id() */ |
71 | if (!user_mode_vm(regs)) { | 76 | if (kprobes_built_in() && !user_mode_vm(regs)) { |
72 | preempt_disable(); | 77 | preempt_disable(); |
73 | if (kprobe_running() && kprobe_fault_handler(regs, 14)) | 78 | if (kprobe_running() && kprobe_fault_handler(regs, 14)) |
74 | ret = 1; | 79 | ret = 1; |
@@ -76,29 +81,76 @@ static inline int notify_page_fault(struct pt_regs *regs) | |||
76 | } | 81 | } |
77 | 82 | ||
78 | return ret; | 83 | return ret; |
79 | #else | ||
80 | return 0; | ||
81 | #endif | ||
82 | } | 84 | } |
83 | 85 | ||
84 | /* | 86 | /* |
85 | * X86_32 | 87 | * Prefetch quirks: |
86 | * Sometimes AMD Athlon/Opteron CPUs report invalid exceptions on prefetch. | ||
87 | * Check that here and ignore it. | ||
88 | * | 88 | * |
89 | * X86_64 | 89 | * 32-bit mode: |
90 | * Sometimes the CPU reports invalid exceptions on prefetch. | ||
91 | * Check that here and ignore it. | ||
92 | * | 90 | * |
93 | * Opcode checker based on code by Richard Brunner | 91 | * Sometimes AMD Athlon/Opteron CPUs report invalid exceptions on prefetch. |
92 | * Check that here and ignore it. | ||
93 | * | ||
94 | * 64-bit mode: | ||
95 | * | ||
96 | * Sometimes the CPU reports invalid exceptions on prefetch. | ||
97 | * Check that here and ignore it. | ||
98 | * | ||
99 | * Opcode checker based on code by Richard Brunner. | ||
94 | */ | 100 | */ |
95 | static int is_prefetch(struct pt_regs *regs, unsigned long error_code, | 101 | static inline int |
96 | unsigned long addr) | 102 | check_prefetch_opcode(struct pt_regs *regs, unsigned char *instr, |
103 | unsigned char opcode, int *prefetch) | ||
97 | { | 104 | { |
105 | unsigned char instr_hi = opcode & 0xf0; | ||
106 | unsigned char instr_lo = opcode & 0x0f; | ||
107 | |||
108 | switch (instr_hi) { | ||
109 | case 0x20: | ||
110 | case 0x30: | ||
111 | /* | ||
112 | * Values 0x26,0x2E,0x36,0x3E are valid x86 prefixes. | ||
113 | * In X86_64 long mode, the CPU will signal invalid | ||
114 | * opcode if some of these prefixes are present so | ||
115 | * X86_64 will never get here anyway | ||
116 | */ | ||
117 | return ((instr_lo & 7) == 0x6); | ||
118 | #ifdef CONFIG_X86_64 | ||
119 | case 0x40: | ||
120 | /* | ||
121 | * In AMD64 long mode 0x40..0x4F are valid REX prefixes | ||
122 | * Need to figure out under what instruction mode the | ||
123 | * instruction was issued. Could check the LDT for lm, | ||
124 | * but for now it's good enough to assume that long | ||
125 | * mode only uses well known segments or kernel. | ||
126 | */ | ||
127 | return (!user_mode(regs)) || (regs->cs == __USER_CS); | ||
128 | #endif | ||
129 | case 0x60: | ||
130 | /* 0x64 thru 0x67 are valid prefixes in all modes. */ | ||
131 | return (instr_lo & 0xC) == 0x4; | ||
132 | case 0xF0: | ||
133 | /* 0xF0, 0xF2, 0xF3 are valid prefixes in all modes. */ | ||
134 | return !instr_lo || (instr_lo>>1) == 1; | ||
135 | case 0x00: | ||
136 | /* Prefetch instruction is 0x0F0D or 0x0F18 */ | ||
137 | if (probe_kernel_address(instr, opcode)) | ||
138 | return 0; | ||
139 | |||
140 | *prefetch = (instr_lo == 0xF) && | ||
141 | (opcode == 0x0D || opcode == 0x18); | ||
142 | return 0; | ||
143 | default: | ||
144 | return 0; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | static int | ||
149 | is_prefetch(struct pt_regs *regs, unsigned long error_code, unsigned long addr) | ||
150 | { | ||
151 | unsigned char *max_instr; | ||
98 | unsigned char *instr; | 152 | unsigned char *instr; |
99 | int scan_more = 1; | ||
100 | int prefetch = 0; | 153 | int prefetch = 0; |
101 | unsigned char *max_instr; | ||
102 | 154 | ||
103 | /* | 155 | /* |
104 | * If it was a exec (instruction fetch) fault on NX page, then | 156 | * If it was a exec (instruction fetch) fault on NX page, then |
@@ -107,106 +159,170 @@ static int is_prefetch(struct pt_regs *regs, unsigned long error_code, | |||
107 | if (error_code & PF_INSTR) | 159 | if (error_code & PF_INSTR) |
108 | return 0; | 160 | return 0; |
109 | 161 | ||
110 | instr = (unsigned char *)convert_ip_to_linear(current, regs); | 162 | instr = (void *)convert_ip_to_linear(current, regs); |
111 | max_instr = instr + 15; | 163 | max_instr = instr + 15; |
112 | 164 | ||
113 | if (user_mode(regs) && instr >= (unsigned char *)TASK_SIZE) | 165 | if (user_mode(regs) && instr >= (unsigned char *)TASK_SIZE) |
114 | return 0; | 166 | return 0; |
115 | 167 | ||
116 | while (scan_more && instr < max_instr) { | 168 | while (instr < max_instr) { |
117 | unsigned char opcode; | 169 | unsigned char opcode; |
118 | unsigned char instr_hi; | ||
119 | unsigned char instr_lo; | ||
120 | 170 | ||
121 | if (probe_kernel_address(instr, opcode)) | 171 | if (probe_kernel_address(instr, opcode)) |
122 | break; | 172 | break; |
123 | 173 | ||
124 | instr_hi = opcode & 0xf0; | ||
125 | instr_lo = opcode & 0x0f; | ||
126 | instr++; | 174 | instr++; |
127 | 175 | ||
128 | switch (instr_hi) { | 176 | if (!check_prefetch_opcode(regs, instr, opcode, &prefetch)) |
129 | case 0x20: | ||
130 | case 0x30: | ||
131 | /* | ||
132 | * Values 0x26,0x2E,0x36,0x3E are valid x86 prefixes. | ||
133 | * In X86_64 long mode, the CPU will signal invalid | ||
134 | * opcode if some of these prefixes are present so | ||
135 | * X86_64 will never get here anyway | ||
136 | */ | ||
137 | scan_more = ((instr_lo & 7) == 0x6); | ||
138 | break; | ||
139 | #ifdef CONFIG_X86_64 | ||
140 | case 0x40: | ||
141 | /* | ||
142 | * In AMD64 long mode 0x40..0x4F are valid REX prefixes | ||
143 | * Need to figure out under what instruction mode the | ||
144 | * instruction was issued. Could check the LDT for lm, | ||
145 | * but for now it's good enough to assume that long | ||
146 | * mode only uses well known segments or kernel. | ||
147 | */ | ||
148 | scan_more = (!user_mode(regs)) || (regs->cs == __USER_CS); | ||
149 | break; | ||
150 | #endif | ||
151 | case 0x60: | ||
152 | /* 0x64 thru 0x67 are valid prefixes in all modes. */ | ||
153 | scan_more = (instr_lo & 0xC) == 0x4; | ||
154 | break; | ||
155 | case 0xF0: | ||
156 | /* 0xF0, 0xF2, 0xF3 are valid prefixes in all modes. */ | ||
157 | scan_more = !instr_lo || (instr_lo>>1) == 1; | ||
158 | break; | ||
159 | case 0x00: | ||
160 | /* Prefetch instruction is 0x0F0D or 0x0F18 */ | ||
161 | scan_more = 0; | ||
162 | |||
163 | if (probe_kernel_address(instr, opcode)) | ||
164 | break; | ||
165 | prefetch = (instr_lo == 0xF) && | ||
166 | (opcode == 0x0D || opcode == 0x18); | ||
167 | break; | 177 | break; |
168 | default: | ||
169 | scan_more = 0; | ||
170 | break; | ||
171 | } | ||
172 | } | 178 | } |
173 | return prefetch; | 179 | return prefetch; |
174 | } | 180 | } |
175 | 181 | ||
176 | static void force_sig_info_fault(int si_signo, int si_code, | 182 | static void |
177 | unsigned long address, struct task_struct *tsk) | 183 | force_sig_info_fault(int si_signo, int si_code, unsigned long address, |
184 | struct task_struct *tsk) | ||
178 | { | 185 | { |
179 | siginfo_t info; | 186 | siginfo_t info; |
180 | 187 | ||
181 | info.si_signo = si_signo; | 188 | info.si_signo = si_signo; |
182 | info.si_errno = 0; | 189 | info.si_errno = 0; |
183 | info.si_code = si_code; | 190 | info.si_code = si_code; |
184 | info.si_addr = (void __user *)address; | 191 | info.si_addr = (void __user *)address; |
192 | |||
185 | force_sig_info(si_signo, &info, tsk); | 193 | force_sig_info(si_signo, &info, tsk); |
186 | } | 194 | } |
187 | 195 | ||
188 | #ifdef CONFIG_X86_64 | 196 | DEFINE_SPINLOCK(pgd_lock); |
189 | static int bad_address(void *p) | 197 | LIST_HEAD(pgd_list); |
198 | |||
199 | #ifdef CONFIG_X86_32 | ||
200 | static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) | ||
190 | { | 201 | { |
191 | unsigned long dummy; | 202 | unsigned index = pgd_index(address); |
192 | return probe_kernel_address((unsigned long *)p, dummy); | 203 | pgd_t *pgd_k; |
204 | pud_t *pud, *pud_k; | ||
205 | pmd_t *pmd, *pmd_k; | ||
206 | |||
207 | pgd += index; | ||
208 | pgd_k = init_mm.pgd + index; | ||
209 | |||
210 | if (!pgd_present(*pgd_k)) | ||
211 | return NULL; | ||
212 | |||
213 | /* | ||
214 | * set_pgd(pgd, *pgd_k); here would be useless on PAE | ||
215 | * and redundant with the set_pmd() on non-PAE. As would | ||
216 | * set_pud. | ||
217 | */ | ||
218 | pud = pud_offset(pgd, address); | ||
219 | pud_k = pud_offset(pgd_k, address); | ||
220 | if (!pud_present(*pud_k)) | ||
221 | return NULL; | ||
222 | |||
223 | pmd = pmd_offset(pud, address); | ||
224 | pmd_k = pmd_offset(pud_k, address); | ||
225 | if (!pmd_present(*pmd_k)) | ||
226 | return NULL; | ||
227 | |||
228 | if (!pmd_present(*pmd)) { | ||
229 | set_pmd(pmd, *pmd_k); | ||
230 | arch_flush_lazy_mmu_mode(); | ||
231 | } else { | ||
232 | BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k)); | ||
233 | } | ||
234 | |||
235 | return pmd_k; | ||
236 | } | ||
237 | |||
238 | void vmalloc_sync_all(void) | ||
239 | { | ||
240 | unsigned long address; | ||
241 | |||
242 | if (SHARED_KERNEL_PMD) | ||
243 | return; | ||
244 | |||
245 | for (address = VMALLOC_START & PMD_MASK; | ||
246 | address >= TASK_SIZE && address < FIXADDR_TOP; | ||
247 | address += PMD_SIZE) { | ||
248 | |||
249 | unsigned long flags; | ||
250 | struct page *page; | ||
251 | |||
252 | spin_lock_irqsave(&pgd_lock, flags); | ||
253 | list_for_each_entry(page, &pgd_list, lru) { | ||
254 | if (!vmalloc_sync_one(page_address(page), address)) | ||
255 | break; | ||
256 | } | ||
257 | spin_unlock_irqrestore(&pgd_lock, flags); | ||
258 | } | ||
259 | } | ||
260 | |||
261 | /* | ||
262 | * 32-bit: | ||
263 | * | ||
264 | * Handle a fault on the vmalloc or module mapping area | ||
265 | */ | ||
266 | static noinline int vmalloc_fault(unsigned long address) | ||
267 | { | ||
268 | unsigned long pgd_paddr; | ||
269 | pmd_t *pmd_k; | ||
270 | pte_t *pte_k; | ||
271 | |||
272 | /* Make sure we are in vmalloc area: */ | ||
273 | if (!(address >= VMALLOC_START && address < VMALLOC_END)) | ||
274 | return -1; | ||
275 | |||
276 | /* | ||
277 | * Synchronize this task's top level page-table | ||
278 | * with the 'reference' page table. | ||
279 | * | ||
280 | * Do _not_ use "current" here. We might be inside | ||
281 | * an interrupt in the middle of a task switch.. | ||
282 | */ | ||
283 | pgd_paddr = read_cr3(); | ||
284 | pmd_k = vmalloc_sync_one(__va(pgd_paddr), address); | ||
285 | if (!pmd_k) | ||
286 | return -1; | ||
287 | |||
288 | pte_k = pte_offset_kernel(pmd_k, address); | ||
289 | if (!pte_present(*pte_k)) | ||
290 | return -1; | ||
291 | |||
292 | return 0; | ||
293 | } | ||
294 | |||
295 | /* | ||
296 | * Did it hit the DOS screen memory VA from vm86 mode? | ||
297 | */ | ||
298 | static inline void | ||
299 | check_v8086_mode(struct pt_regs *regs, unsigned long address, | ||
300 | struct task_struct *tsk) | ||
301 | { | ||
302 | unsigned long bit; | ||
303 | |||
304 | if (!v8086_mode(regs)) | ||
305 | return; | ||
306 | |||
307 | bit = (address - 0xA0000) >> PAGE_SHIFT; | ||
308 | if (bit < 32) | ||
309 | tsk->thread.screen_bitmap |= 1 << bit; | ||
193 | } | 310 | } |
194 | #endif | ||
195 | 311 | ||
196 | static void dump_pagetable(unsigned long address) | 312 | static void dump_pagetable(unsigned long address) |
197 | { | 313 | { |
198 | #ifdef CONFIG_X86_32 | ||
199 | __typeof__(pte_val(__pte(0))) page; | 314 | __typeof__(pte_val(__pte(0))) page; |
200 | 315 | ||
201 | page = read_cr3(); | 316 | page = read_cr3(); |
202 | page = ((__typeof__(page) *) __va(page))[address >> PGDIR_SHIFT]; | 317 | page = ((__typeof__(page) *) __va(page))[address >> PGDIR_SHIFT]; |
318 | |||
203 | #ifdef CONFIG_X86_PAE | 319 | #ifdef CONFIG_X86_PAE |
204 | printk("*pdpt = %016Lx ", page); | 320 | printk("*pdpt = %016Lx ", page); |
205 | if ((page >> PAGE_SHIFT) < max_low_pfn | 321 | if ((page >> PAGE_SHIFT) < max_low_pfn |
206 | && page & _PAGE_PRESENT) { | 322 | && page & _PAGE_PRESENT) { |
207 | page &= PAGE_MASK; | 323 | page &= PAGE_MASK; |
208 | page = ((__typeof__(page) *) __va(page))[(address >> PMD_SHIFT) | 324 | page = ((__typeof__(page) *) __va(page))[(address >> PMD_SHIFT) |
209 | & (PTRS_PER_PMD - 1)]; | 325 | & (PTRS_PER_PMD - 1)]; |
210 | printk(KERN_CONT "*pde = %016Lx ", page); | 326 | printk(KERN_CONT "*pde = %016Lx ", page); |
211 | page &= ~_PAGE_NX; | 327 | page &= ~_PAGE_NX; |
212 | } | 328 | } |
@@ -218,19 +334,145 @@ static void dump_pagetable(unsigned long address) | |||
218 | * We must not directly access the pte in the highpte | 334 | * We must not directly access the pte in the highpte |
219 | * case if the page table is located in highmem. | 335 | * case if the page table is located in highmem. |
220 | * And let's rather not kmap-atomic the pte, just in case | 336 | * And let's rather not kmap-atomic the pte, just in case |
221 | * it's allocated already. | 337 | * it's allocated already: |
222 | */ | 338 | */ |
223 | if ((page >> PAGE_SHIFT) < max_low_pfn | 339 | if ((page >> PAGE_SHIFT) < max_low_pfn |
224 | && (page & _PAGE_PRESENT) | 340 | && (page & _PAGE_PRESENT) |
225 | && !(page & _PAGE_PSE)) { | 341 | && !(page & _PAGE_PSE)) { |
342 | |||
226 | page &= PAGE_MASK; | 343 | page &= PAGE_MASK; |
227 | page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT) | 344 | page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT) |
228 | & (PTRS_PER_PTE - 1)]; | 345 | & (PTRS_PER_PTE - 1)]; |
229 | printk("*pte = %0*Lx ", sizeof(page)*2, (u64)page); | 346 | printk("*pte = %0*Lx ", sizeof(page)*2, (u64)page); |
230 | } | 347 | } |
231 | 348 | ||
232 | printk("\n"); | 349 | printk("\n"); |
233 | #else /* CONFIG_X86_64 */ | 350 | } |
351 | |||
352 | #else /* CONFIG_X86_64: */ | ||
353 | |||
354 | void vmalloc_sync_all(void) | ||
355 | { | ||
356 | unsigned long address; | ||
357 | |||
358 | for (address = VMALLOC_START & PGDIR_MASK; address <= VMALLOC_END; | ||
359 | address += PGDIR_SIZE) { | ||
360 | |||
361 | const pgd_t *pgd_ref = pgd_offset_k(address); | ||
362 | unsigned long flags; | ||
363 | struct page *page; | ||
364 | |||
365 | if (pgd_none(*pgd_ref)) | ||
366 | continue; | ||
367 | |||
368 | spin_lock_irqsave(&pgd_lock, flags); | ||
369 | list_for_each_entry(page, &pgd_list, lru) { | ||
370 | pgd_t *pgd; | ||
371 | pgd = (pgd_t *)page_address(page) + pgd_index(address); | ||
372 | if (pgd_none(*pgd)) | ||
373 | set_pgd(pgd, *pgd_ref); | ||
374 | else | ||
375 | BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref)); | ||
376 | } | ||
377 | spin_unlock_irqrestore(&pgd_lock, flags); | ||
378 | } | ||
379 | } | ||
380 | |||
381 | /* | ||
382 | * 64-bit: | ||
383 | * | ||
384 | * Handle a fault on the vmalloc area | ||
385 | * | ||
386 | * This assumes no large pages in there. | ||
387 | */ | ||
388 | static noinline int vmalloc_fault(unsigned long address) | ||
389 | { | ||
390 | pgd_t *pgd, *pgd_ref; | ||
391 | pud_t *pud, *pud_ref; | ||
392 | pmd_t *pmd, *pmd_ref; | ||
393 | pte_t *pte, *pte_ref; | ||
394 | |||
395 | /* Make sure we are in vmalloc area: */ | ||
396 | if (!(address >= VMALLOC_START && address < VMALLOC_END)) | ||
397 | return -1; | ||
398 | |||
399 | /* | ||
400 | * Copy kernel mappings over when needed. This can also | ||
401 | * happen within a race in page table update. In the later | ||
402 | * case just flush: | ||
403 | */ | ||
404 | pgd = pgd_offset(current->active_mm, address); | ||
405 | pgd_ref = pgd_offset_k(address); | ||
406 | if (pgd_none(*pgd_ref)) | ||
407 | return -1; | ||
408 | |||
409 | if (pgd_none(*pgd)) | ||
410 | set_pgd(pgd, *pgd_ref); | ||
411 | else | ||
412 | BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref)); | ||
413 | |||
414 | /* | ||
415 | * Below here mismatches are bugs because these lower tables | ||
416 | * are shared: | ||
417 | */ | ||
418 | |||
419 | pud = pud_offset(pgd, address); | ||
420 | pud_ref = pud_offset(pgd_ref, address); | ||
421 | if (pud_none(*pud_ref)) | ||
422 | return -1; | ||
423 | |||
424 | if (pud_none(*pud) || pud_page_vaddr(*pud) != pud_page_vaddr(*pud_ref)) | ||
425 | BUG(); | ||
426 | |||
427 | pmd = pmd_offset(pud, address); | ||
428 | pmd_ref = pmd_offset(pud_ref, address); | ||
429 | if (pmd_none(*pmd_ref)) | ||
430 | return -1; | ||
431 | |||
432 | if (pmd_none(*pmd) || pmd_page(*pmd) != pmd_page(*pmd_ref)) | ||
433 | BUG(); | ||
434 | |||
435 | pte_ref = pte_offset_kernel(pmd_ref, address); | ||
436 | if (!pte_present(*pte_ref)) | ||
437 | return -1; | ||
438 | |||
439 | pte = pte_offset_kernel(pmd, address); | ||
440 | |||
441 | /* | ||
442 | * Don't use pte_page here, because the mappings can point | ||
443 | * outside mem_map, and the NUMA hash lookup cannot handle | ||
444 | * that: | ||
445 | */ | ||
446 | if (!pte_present(*pte) || pte_pfn(*pte) != pte_pfn(*pte_ref)) | ||
447 | BUG(); | ||
448 | |||
449 | return 0; | ||
450 | } | ||
451 | |||
452 | static const char errata93_warning[] = | ||
453 | KERN_ERR "******* Your BIOS seems to not contain a fix for K8 errata #93\n" | ||
454 | KERN_ERR "******* Working around it, but it may cause SEGVs or burn power.\n" | ||
455 | KERN_ERR "******* Please consider a BIOS update.\n" | ||
456 | KERN_ERR "******* Disabling USB legacy in the BIOS may also help.\n"; | ||
457 | |||
458 | /* | ||
459 | * No vm86 mode in 64-bit mode: | ||
460 | */ | ||
461 | static inline void | ||
462 | check_v8086_mode(struct pt_regs *regs, unsigned long address, | ||
463 | struct task_struct *tsk) | ||
464 | { | ||
465 | } | ||
466 | |||
467 | static int bad_address(void *p) | ||
468 | { | ||
469 | unsigned long dummy; | ||
470 | |||
471 | return probe_kernel_address((unsigned long *)p, dummy); | ||
472 | } | ||
473 | |||
474 | static void dump_pagetable(unsigned long address) | ||
475 | { | ||
234 | pgd_t *pgd; | 476 | pgd_t *pgd; |
235 | pud_t *pud; | 477 | pud_t *pud; |
236 | pmd_t *pmd; | 478 | pmd_t *pmd; |
@@ -239,102 +481,77 @@ static void dump_pagetable(unsigned long address) | |||
239 | pgd = (pgd_t *)read_cr3(); | 481 | pgd = (pgd_t *)read_cr3(); |
240 | 482 | ||
241 | pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK); | 483 | pgd = __va((unsigned long)pgd & PHYSICAL_PAGE_MASK); |
484 | |||
242 | pgd += pgd_index(address); | 485 | pgd += pgd_index(address); |
243 | if (bad_address(pgd)) goto bad; | 486 | if (bad_address(pgd)) |
487 | goto bad; | ||
488 | |||
244 | printk("PGD %lx ", pgd_val(*pgd)); | 489 | printk("PGD %lx ", pgd_val(*pgd)); |
245 | if (!pgd_present(*pgd)) goto ret; | 490 | |
491 | if (!pgd_present(*pgd)) | ||
492 | goto out; | ||
246 | 493 | ||
247 | pud = pud_offset(pgd, address); | 494 | pud = pud_offset(pgd, address); |
248 | if (bad_address(pud)) goto bad; | 495 | if (bad_address(pud)) |
496 | goto bad; | ||
497 | |||
249 | printk("PUD %lx ", pud_val(*pud)); | 498 | printk("PUD %lx ", pud_val(*pud)); |
250 | if (!pud_present(*pud) || pud_large(*pud)) | 499 | if (!pud_present(*pud) || pud_large(*pud)) |
251 | goto ret; | 500 | goto out; |
252 | 501 | ||
253 | pmd = pmd_offset(pud, address); | 502 | pmd = pmd_offset(pud, address); |
254 | if (bad_address(pmd)) goto bad; | 503 | if (bad_address(pmd)) |
504 | goto bad; | ||
505 | |||
255 | printk("PMD %lx ", pmd_val(*pmd)); | 506 | printk("PMD %lx ", pmd_val(*pmd)); |
256 | if (!pmd_present(*pmd) || pmd_large(*pmd)) goto ret; | 507 | if (!pmd_present(*pmd) || pmd_large(*pmd)) |
508 | goto out; | ||
257 | 509 | ||
258 | pte = pte_offset_kernel(pmd, address); | 510 | pte = pte_offset_kernel(pmd, address); |
259 | if (bad_address(pte)) goto bad; | 511 | if (bad_address(pte)) |
512 | goto bad; | ||
513 | |||
260 | printk("PTE %lx", pte_val(*pte)); | 514 | printk("PTE %lx", pte_val(*pte)); |
261 | ret: | 515 | out: |
262 | printk("\n"); | 516 | printk("\n"); |
263 | return; | 517 | return; |
264 | bad: | 518 | bad: |
265 | printk("BAD\n"); | 519 | printk("BAD\n"); |
266 | #endif | ||
267 | } | 520 | } |
268 | 521 | ||
269 | #ifdef CONFIG_X86_32 | 522 | #endif /* CONFIG_X86_64 */ |
270 | static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) | ||
271 | { | ||
272 | unsigned index = pgd_index(address); | ||
273 | pgd_t *pgd_k; | ||
274 | pud_t *pud, *pud_k; | ||
275 | pmd_t *pmd, *pmd_k; | ||
276 | |||
277 | pgd += index; | ||
278 | pgd_k = init_mm.pgd + index; | ||
279 | |||
280 | if (!pgd_present(*pgd_k)) | ||
281 | return NULL; | ||
282 | 523 | ||
283 | /* | 524 | /* |
284 | * set_pgd(pgd, *pgd_k); here would be useless on PAE | 525 | * Workaround for K8 erratum #93 & buggy BIOS. |
285 | * and redundant with the set_pmd() on non-PAE. As would | 526 | * |
286 | * set_pud. | 527 | * BIOS SMM functions are required to use a specific workaround |
287 | */ | 528 | * to avoid corruption of the 64bit RIP register on C stepping K8. |
288 | 529 | * | |
289 | pud = pud_offset(pgd, address); | 530 | * A lot of BIOS that didn't get tested properly miss this. |
290 | pud_k = pud_offset(pgd_k, address); | 531 | * |
291 | if (!pud_present(*pud_k)) | 532 | * The OS sees this as a page fault with the upper 32bits of RIP cleared. |
292 | return NULL; | 533 | * Try to work around it here. |
293 | 534 | * | |
294 | pmd = pmd_offset(pud, address); | 535 | * Note we only handle faults in kernel here. |
295 | pmd_k = pmd_offset(pud_k, address); | 536 | * Does nothing on 32-bit. |
296 | if (!pmd_present(*pmd_k)) | ||
297 | return NULL; | ||
298 | if (!pmd_present(*pmd)) { | ||
299 | set_pmd(pmd, *pmd_k); | ||
300 | arch_flush_lazy_mmu_mode(); | ||
301 | } else | ||
302 | BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k)); | ||
303 | return pmd_k; | ||
304 | } | ||
305 | #endif | ||
306 | |||
307 | #ifdef CONFIG_X86_64 | ||
308 | static const char errata93_warning[] = | ||
309 | KERN_ERR "******* Your BIOS seems to not contain a fix for K8 errata #93\n" | ||
310 | KERN_ERR "******* Working around it, but it may cause SEGVs or burn power.\n" | ||
311 | KERN_ERR "******* Please consider a BIOS update.\n" | ||
312 | KERN_ERR "******* Disabling USB legacy in the BIOS may also help.\n"; | ||
313 | #endif | ||
314 | |||
315 | /* Workaround for K8 erratum #93 & buggy BIOS. | ||
316 | BIOS SMM functions are required to use a specific workaround | ||
317 | to avoid corruption of the 64bit RIP register on C stepping K8. | ||
318 | A lot of BIOS that didn't get tested properly miss this. | ||
319 | The OS sees this as a page fault with the upper 32bits of RIP cleared. | ||
320 | Try to work around it here. | ||
321 | Note we only handle faults in kernel here. | ||
322 | Does nothing for X86_32 | ||
323 | */ | 537 | */ |
324 | static int is_errata93(struct pt_regs *regs, unsigned long address) | 538 | static int is_errata93(struct pt_regs *regs, unsigned long address) |
325 | { | 539 | { |
326 | #ifdef CONFIG_X86_64 | 540 | #ifdef CONFIG_X86_64 |
327 | static int warned; | 541 | static int once; |
542 | |||
328 | if (address != regs->ip) | 543 | if (address != regs->ip) |
329 | return 0; | 544 | return 0; |
545 | |||
330 | if ((address >> 32) != 0) | 546 | if ((address >> 32) != 0) |
331 | return 0; | 547 | return 0; |
548 | |||
332 | address |= 0xffffffffUL << 32; | 549 | address |= 0xffffffffUL << 32; |
333 | if ((address >= (u64)_stext && address <= (u64)_etext) || | 550 | if ((address >= (u64)_stext && address <= (u64)_etext) || |
334 | (address >= MODULES_VADDR && address <= MODULES_END)) { | 551 | (address >= MODULES_VADDR && address <= MODULES_END)) { |
335 | if (!warned) { | 552 | if (!once) { |
336 | printk(errata93_warning); | 553 | printk(errata93_warning); |
337 | warned = 1; | 554 | once = 1; |
338 | } | 555 | } |
339 | regs->ip = address; | 556 | regs->ip = address; |
340 | return 1; | 557 | return 1; |
@@ -344,16 +561,17 @@ static int is_errata93(struct pt_regs *regs, unsigned long address) | |||
344 | } | 561 | } |
345 | 562 | ||
346 | /* | 563 | /* |
347 | * Work around K8 erratum #100 K8 in compat mode occasionally jumps to illegal | 564 | * Work around K8 erratum #100 K8 in compat mode occasionally jumps |
348 | * addresses >4GB. We catch this in the page fault handler because these | 565 | * to illegal addresses >4GB. |
349 | * addresses are not reachable. Just detect this case and return. Any code | 566 | * |
567 | * We catch this in the page fault handler because these addresses | ||
568 | * are not reachable. Just detect this case and return. Any code | ||
350 | * segment in LDT is compatibility mode. | 569 | * segment in LDT is compatibility mode. |
351 | */ | 570 | */ |
352 | static int is_errata100(struct pt_regs *regs, unsigned long address) | 571 | static int is_errata100(struct pt_regs *regs, unsigned long address) |
353 | { | 572 | { |
354 | #ifdef CONFIG_X86_64 | 573 | #ifdef CONFIG_X86_64 |
355 | if ((regs->cs == __USER32_CS || (regs->cs & (1<<2))) && | 574 | if ((regs->cs == __USER32_CS || (regs->cs & (1<<2))) && (address >> 32)) |
356 | (address >> 32)) | ||
357 | return 1; | 575 | return 1; |
358 | #endif | 576 | #endif |
359 | return 0; | 577 | return 0; |
@@ -363,8 +581,9 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned long address) | |||
363 | { | 581 | { |
364 | #ifdef CONFIG_X86_F00F_BUG | 582 | #ifdef CONFIG_X86_F00F_BUG |
365 | unsigned long nr; | 583 | unsigned long nr; |
584 | |||
366 | /* | 585 | /* |
367 | * Pentium F0 0F C7 C8 bug workaround. | 586 | * Pentium F0 0F C7 C8 bug workaround: |
368 | */ | 587 | */ |
369 | if (boot_cpu_data.f00f_bug) { | 588 | if (boot_cpu_data.f00f_bug) { |
370 | nr = (address - idt_descr.address) >> 3; | 589 | nr = (address - idt_descr.address) >> 3; |
@@ -378,80 +597,87 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned long address) | |||
378 | return 0; | 597 | return 0; |
379 | } | 598 | } |
380 | 599 | ||
381 | static void show_fault_oops(struct pt_regs *regs, unsigned long error_code, | 600 | static const char nx_warning[] = KERN_CRIT |
382 | unsigned long address) | 601 | "kernel tried to execute NX-protected page - exploit attempt? (uid: %d)\n"; |
602 | |||
603 | static void | ||
604 | show_fault_oops(struct pt_regs *regs, unsigned long error_code, | ||
605 | unsigned long address) | ||
383 | { | 606 | { |
384 | #ifdef CONFIG_X86_32 | ||
385 | if (!oops_may_print()) | 607 | if (!oops_may_print()) |
386 | return; | 608 | return; |
387 | #endif | ||
388 | 609 | ||
389 | #ifdef CONFIG_X86_PAE | ||
390 | if (error_code & PF_INSTR) { | 610 | if (error_code & PF_INSTR) { |
391 | unsigned int level; | 611 | unsigned int level; |
612 | |||
392 | pte_t *pte = lookup_address(address, &level); | 613 | pte_t *pte = lookup_address(address, &level); |
393 | 614 | ||
394 | if (pte && pte_present(*pte) && !pte_exec(*pte)) | 615 | if (pte && pte_present(*pte) && !pte_exec(*pte)) |
395 | printk(KERN_CRIT "kernel tried to execute " | 616 | printk(nx_warning, current_uid()); |
396 | "NX-protected page - exploit attempt? " | ||
397 | "(uid: %d)\n", current_uid()); | ||
398 | } | 617 | } |
399 | #endif | ||
400 | 618 | ||
401 | printk(KERN_ALERT "BUG: unable to handle kernel "); | 619 | printk(KERN_ALERT "BUG: unable to handle kernel "); |
402 | if (address < PAGE_SIZE) | 620 | if (address < PAGE_SIZE) |
403 | printk(KERN_CONT "NULL pointer dereference"); | 621 | printk(KERN_CONT "NULL pointer dereference"); |
404 | else | 622 | else |
405 | printk(KERN_CONT "paging request"); | 623 | printk(KERN_CONT "paging request"); |
624 | |||
406 | printk(KERN_CONT " at %p\n", (void *) address); | 625 | printk(KERN_CONT " at %p\n", (void *) address); |
407 | printk(KERN_ALERT "IP:"); | 626 | printk(KERN_ALERT "IP:"); |
408 | printk_address(regs->ip, 1); | 627 | printk_address(regs->ip, 1); |
628 | |||
409 | dump_pagetable(address); | 629 | dump_pagetable(address); |
410 | } | 630 | } |
411 | 631 | ||
412 | #ifdef CONFIG_X86_64 | 632 | static noinline void |
413 | static noinline void pgtable_bad(struct pt_regs *regs, | 633 | pgtable_bad(struct pt_regs *regs, unsigned long error_code, |
414 | unsigned long error_code, unsigned long address) | 634 | unsigned long address) |
415 | { | 635 | { |
416 | unsigned long flags = oops_begin(); | 636 | struct task_struct *tsk; |
417 | int sig = SIGKILL; | 637 | unsigned long flags; |
418 | struct task_struct *tsk = current; | 638 | int sig; |
639 | |||
640 | flags = oops_begin(); | ||
641 | tsk = current; | ||
642 | sig = SIGKILL; | ||
419 | 643 | ||
420 | printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", | 644 | printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", |
421 | tsk->comm, address); | 645 | tsk->comm, address); |
422 | dump_pagetable(address); | 646 | dump_pagetable(address); |
423 | tsk->thread.cr2 = address; | 647 | |
424 | tsk->thread.trap_no = 14; | 648 | tsk->thread.cr2 = address; |
425 | tsk->thread.error_code = error_code; | 649 | tsk->thread.trap_no = 14; |
650 | tsk->thread.error_code = error_code; | ||
651 | |||
426 | if (__die("Bad pagetable", regs, error_code)) | 652 | if (__die("Bad pagetable", regs, error_code)) |
427 | sig = 0; | 653 | sig = 0; |
654 | |||
428 | oops_end(flags, regs, sig); | 655 | oops_end(flags, regs, sig); |
429 | } | 656 | } |
430 | #endif | ||
431 | 657 | ||
432 | static noinline void no_context(struct pt_regs *regs, | 658 | static noinline void |
433 | unsigned long error_code, unsigned long address) | 659 | no_context(struct pt_regs *regs, unsigned long error_code, |
660 | unsigned long address) | ||
434 | { | 661 | { |
435 | struct task_struct *tsk = current; | 662 | struct task_struct *tsk = current; |
436 | unsigned long *stackend; | 663 | unsigned long *stackend; |
437 | |||
438 | #ifdef CONFIG_X86_64 | ||
439 | unsigned long flags; | 664 | unsigned long flags; |
440 | int sig; | 665 | int sig; |
441 | #endif | ||
442 | 666 | ||
443 | /* Are we prepared to handle this kernel fault? */ | 667 | /* Are we prepared to handle this kernel fault? */ |
444 | if (fixup_exception(regs)) | 668 | if (fixup_exception(regs)) |
445 | return; | 669 | return; |
446 | 670 | ||
447 | /* | 671 | /* |
448 | * X86_32 | 672 | * 32-bit: |
449 | * Valid to do another page fault here, because if this fault | 673 | * |
450 | * had been triggered by is_prefetch fixup_exception would have | 674 | * Valid to do another page fault here, because if this fault |
451 | * handled it. | 675 | * had been triggered by is_prefetch fixup_exception would have |
676 | * handled it. | ||
677 | * | ||
678 | * 64-bit: | ||
452 | * | 679 | * |
453 | * X86_64 | 680 | * Hall of shame of CPU/BIOS bugs. |
454 | * Hall of shame of CPU/BIOS bugs. | ||
455 | */ | 681 | */ |
456 | if (is_prefetch(regs, error_code, address)) | 682 | if (is_prefetch(regs, error_code, address)) |
457 | return; | 683 | return; |
@@ -461,54 +687,70 @@ static noinline void no_context(struct pt_regs *regs, | |||
461 | 687 | ||
462 | /* | 688 | /* |
463 | * Oops. The kernel tried to access some bad page. We'll have to | 689 | * Oops. The kernel tried to access some bad page. We'll have to |
464 | * terminate things with extreme prejudice. | 690 | * terminate things with extreme prejudice: |
465 | */ | 691 | */ |
466 | #ifdef CONFIG_X86_32 | ||
467 | bust_spinlocks(1); | ||
468 | #else | ||
469 | flags = oops_begin(); | 692 | flags = oops_begin(); |
470 | #endif | ||
471 | 693 | ||
472 | show_fault_oops(regs, error_code, address); | 694 | show_fault_oops(regs, error_code, address); |
473 | 695 | ||
474 | stackend = end_of_stack(tsk); | 696 | stackend = end_of_stack(tsk); |
475 | if (*stackend != STACK_END_MAGIC) | 697 | if (*stackend != STACK_END_MAGIC) |
476 | printk(KERN_ALERT "Thread overran stack, or stack corrupted\n"); | 698 | printk(KERN_ALERT "Thread overran stack, or stack corrupted\n"); |
477 | 699 | ||
478 | tsk->thread.cr2 = address; | 700 | tsk->thread.cr2 = address; |
479 | tsk->thread.trap_no = 14; | 701 | tsk->thread.trap_no = 14; |
480 | tsk->thread.error_code = error_code; | 702 | tsk->thread.error_code = error_code; |
481 | 703 | ||
482 | #ifdef CONFIG_X86_32 | ||
483 | die("Oops", regs, error_code); | ||
484 | bust_spinlocks(0); | ||
485 | do_exit(SIGKILL); | ||
486 | #else | ||
487 | sig = SIGKILL; | 704 | sig = SIGKILL; |
488 | if (__die("Oops", regs, error_code)) | 705 | if (__die("Oops", regs, error_code)) |
489 | sig = 0; | 706 | sig = 0; |
707 | |||
490 | /* Executive summary in case the body of the oops scrolled away */ | 708 | /* Executive summary in case the body of the oops scrolled away */ |
491 | printk(KERN_EMERG "CR2: %016lx\n", address); | 709 | printk(KERN_EMERG "CR2: %016lx\n", address); |
710 | |||
492 | oops_end(flags, regs, sig); | 711 | oops_end(flags, regs, sig); |
493 | #endif | ||
494 | } | 712 | } |
495 | 713 | ||
496 | static void __bad_area_nosemaphore(struct pt_regs *regs, | 714 | /* |
497 | unsigned long error_code, unsigned long address, | 715 | * Print out info about fatal segfaults, if the show_unhandled_signals |
498 | int si_code) | 716 | * sysctl is set: |
717 | */ | ||
718 | static inline void | ||
719 | show_signal_msg(struct pt_regs *regs, unsigned long error_code, | ||
720 | unsigned long address, struct task_struct *tsk) | ||
721 | { | ||
722 | if (!unhandled_signal(tsk, SIGSEGV)) | ||
723 | return; | ||
724 | |||
725 | if (!printk_ratelimit()) | ||
726 | return; | ||
727 | |||
728 | printk(KERN_CONT "%s%s[%d]: segfault at %lx ip %p sp %p error %lx", | ||
729 | task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, | ||
730 | tsk->comm, task_pid_nr(tsk), address, | ||
731 | (void *)regs->ip, (void *)regs->sp, error_code); | ||
732 | |||
733 | print_vma_addr(KERN_CONT " in ", regs->ip); | ||
734 | |||
735 | printk(KERN_CONT "\n"); | ||
736 | } | ||
737 | |||
738 | static void | ||
739 | __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code, | ||
740 | unsigned long address, int si_code) | ||
499 | { | 741 | { |
500 | struct task_struct *tsk = current; | 742 | struct task_struct *tsk = current; |
501 | 743 | ||
502 | /* User mode accesses just cause a SIGSEGV */ | 744 | /* User mode accesses just cause a SIGSEGV */ |
503 | if (error_code & PF_USER) { | 745 | if (error_code & PF_USER) { |
504 | /* | 746 | /* |
505 | * It's possible to have interrupts off here. | 747 | * It's possible to have interrupts off here: |
506 | */ | 748 | */ |
507 | local_irq_enable(); | 749 | local_irq_enable(); |
508 | 750 | ||
509 | /* | 751 | /* |
510 | * Valid to do another page fault here because this one came | 752 | * Valid to do another page fault here because this one came |
511 | * from user space. | 753 | * from user space: |
512 | */ | 754 | */ |
513 | if (is_prefetch(regs, error_code, address)) | 755 | if (is_prefetch(regs, error_code, address)) |
514 | return; | 756 | return; |
@@ -516,22 +758,16 @@ static void __bad_area_nosemaphore(struct pt_regs *regs, | |||
516 | if (is_errata100(regs, address)) | 758 | if (is_errata100(regs, address)) |
517 | return; | 759 | return; |
518 | 760 | ||
519 | if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && | 761 | if (unlikely(show_unhandled_signals)) |
520 | printk_ratelimit()) { | 762 | show_signal_msg(regs, error_code, address, tsk); |
521 | printk( | 763 | |
522 | "%s%s[%d]: segfault at %lx ip %p sp %p error %lx", | 764 | /* Kernel addresses are always protection faults: */ |
523 | task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, | 765 | tsk->thread.cr2 = address; |
524 | tsk->comm, task_pid_nr(tsk), address, | 766 | tsk->thread.error_code = error_code | (address >= TASK_SIZE); |
525 | (void *) regs->ip, (void *) regs->sp, error_code); | 767 | tsk->thread.trap_no = 14; |
526 | print_vma_addr(" in ", regs->ip); | ||
527 | printk("\n"); | ||
528 | } | ||
529 | 768 | ||
530 | tsk->thread.cr2 = address; | ||
531 | /* Kernel addresses are always protection faults */ | ||
532 | tsk->thread.error_code = error_code | (address >= TASK_SIZE); | ||
533 | tsk->thread.trap_no = 14; | ||
534 | force_sig_info_fault(SIGSEGV, si_code, address, tsk); | 769 | force_sig_info_fault(SIGSEGV, si_code, address, tsk); |
770 | |||
535 | return; | 771 | return; |
536 | } | 772 | } |
537 | 773 | ||
@@ -541,15 +777,16 @@ static void __bad_area_nosemaphore(struct pt_regs *regs, | |||
541 | no_context(regs, error_code, address); | 777 | no_context(regs, error_code, address); |
542 | } | 778 | } |
543 | 779 | ||
544 | static noinline void bad_area_nosemaphore(struct pt_regs *regs, | 780 | static noinline void |
545 | unsigned long error_code, unsigned long address) | 781 | bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code, |
782 | unsigned long address) | ||
546 | { | 783 | { |
547 | __bad_area_nosemaphore(regs, error_code, address, SEGV_MAPERR); | 784 | __bad_area_nosemaphore(regs, error_code, address, SEGV_MAPERR); |
548 | } | 785 | } |
549 | 786 | ||
550 | static void __bad_area(struct pt_regs *regs, | 787 | static void |
551 | unsigned long error_code, unsigned long address, | 788 | __bad_area(struct pt_regs *regs, unsigned long error_code, |
552 | int si_code) | 789 | unsigned long address, int si_code) |
553 | { | 790 | { |
554 | struct mm_struct *mm = current->mm; | 791 | struct mm_struct *mm = current->mm; |
555 | 792 | ||
@@ -562,67 +799,75 @@ static void __bad_area(struct pt_regs *regs, | |||
562 | __bad_area_nosemaphore(regs, error_code, address, si_code); | 799 | __bad_area_nosemaphore(regs, error_code, address, si_code); |
563 | } | 800 | } |
564 | 801 | ||
565 | static noinline void bad_area(struct pt_regs *regs, | 802 | static noinline void |
566 | unsigned long error_code, unsigned long address) | 803 | bad_area(struct pt_regs *regs, unsigned long error_code, unsigned long address) |
567 | { | 804 | { |
568 | __bad_area(regs, error_code, address, SEGV_MAPERR); | 805 | __bad_area(regs, error_code, address, SEGV_MAPERR); |
569 | } | 806 | } |
570 | 807 | ||
571 | static noinline void bad_area_access_error(struct pt_regs *regs, | 808 | static noinline void |
572 | unsigned long error_code, unsigned long address) | 809 | bad_area_access_error(struct pt_regs *regs, unsigned long error_code, |
810 | unsigned long address) | ||
573 | { | 811 | { |
574 | __bad_area(regs, error_code, address, SEGV_ACCERR); | 812 | __bad_area(regs, error_code, address, SEGV_ACCERR); |
575 | } | 813 | } |
576 | 814 | ||
577 | /* TODO: fixup for "mm-invoke-oom-killer-from-page-fault.patch" */ | 815 | /* TODO: fixup for "mm-invoke-oom-killer-from-page-fault.patch" */ |
578 | static void out_of_memory(struct pt_regs *regs, | 816 | static void |
579 | unsigned long error_code, unsigned long address) | 817 | out_of_memory(struct pt_regs *regs, unsigned long error_code, |
818 | unsigned long address) | ||
580 | { | 819 | { |
581 | /* | 820 | /* |
582 | * We ran out of memory, call the OOM killer, and return the userspace | 821 | * We ran out of memory, call the OOM killer, and return the userspace |
583 | * (which will retry the fault, or kill us if we got oom-killed). | 822 | * (which will retry the fault, or kill us if we got oom-killed): |
584 | */ | 823 | */ |
585 | up_read(¤t->mm->mmap_sem); | 824 | up_read(¤t->mm->mmap_sem); |
825 | |||
586 | pagefault_out_of_memory(); | 826 | pagefault_out_of_memory(); |
587 | } | 827 | } |
588 | 828 | ||
589 | static void do_sigbus(struct pt_regs *regs, | 829 | static void |
590 | unsigned long error_code, unsigned long address) | 830 | do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address) |
591 | { | 831 | { |
592 | struct task_struct *tsk = current; | 832 | struct task_struct *tsk = current; |
593 | struct mm_struct *mm = tsk->mm; | 833 | struct mm_struct *mm = tsk->mm; |
594 | 834 | ||
595 | up_read(&mm->mmap_sem); | 835 | up_read(&mm->mmap_sem); |
596 | 836 | ||
597 | /* Kernel mode? Handle exceptions or die */ | 837 | /* Kernel mode? Handle exceptions or die: */ |
598 | if (!(error_code & PF_USER)) | 838 | if (!(error_code & PF_USER)) |
599 | no_context(regs, error_code, address); | 839 | no_context(regs, error_code, address); |
600 | #ifdef CONFIG_X86_32 | 840 | |
601 | /* User space => ok to do another page fault */ | 841 | /* User-space => ok to do another page fault: */ |
602 | if (is_prefetch(regs, error_code, address)) | 842 | if (is_prefetch(regs, error_code, address)) |
603 | return; | 843 | return; |
604 | #endif | 844 | |
605 | tsk->thread.cr2 = address; | 845 | tsk->thread.cr2 = address; |
606 | tsk->thread.error_code = error_code; | 846 | tsk->thread.error_code = error_code; |
607 | tsk->thread.trap_no = 14; | 847 | tsk->thread.trap_no = 14; |
848 | |||
608 | force_sig_info_fault(SIGBUS, BUS_ADRERR, address, tsk); | 849 | force_sig_info_fault(SIGBUS, BUS_ADRERR, address, tsk); |
609 | } | 850 | } |
610 | 851 | ||
611 | static noinline void mm_fault_error(struct pt_regs *regs, | 852 | static noinline void |
612 | unsigned long error_code, unsigned long address, unsigned int fault) | 853 | mm_fault_error(struct pt_regs *regs, unsigned long error_code, |
854 | unsigned long address, unsigned int fault) | ||
613 | { | 855 | { |
614 | if (fault & VM_FAULT_OOM) | 856 | if (fault & VM_FAULT_OOM) { |
615 | out_of_memory(regs, error_code, address); | 857 | out_of_memory(regs, error_code, address); |
616 | else if (fault & VM_FAULT_SIGBUS) | 858 | } else { |
617 | do_sigbus(regs, error_code, address); | 859 | if (fault & VM_FAULT_SIGBUS) |
618 | else | 860 | do_sigbus(regs, error_code, address); |
619 | BUG(); | 861 | else |
862 | BUG(); | ||
863 | } | ||
620 | } | 864 | } |
621 | 865 | ||
622 | static int spurious_fault_check(unsigned long error_code, pte_t *pte) | 866 | static int spurious_fault_check(unsigned long error_code, pte_t *pte) |
623 | { | 867 | { |
624 | if ((error_code & PF_WRITE) && !pte_write(*pte)) | 868 | if ((error_code & PF_WRITE) && !pte_write(*pte)) |
625 | return 0; | 869 | return 0; |
870 | |||
626 | if ((error_code & PF_INSTR) && !pte_exec(*pte)) | 871 | if ((error_code & PF_INSTR) && !pte_exec(*pte)) |
627 | return 0; | 872 | return 0; |
628 | 873 | ||
@@ -630,21 +875,25 @@ static int spurious_fault_check(unsigned long error_code, pte_t *pte) | |||
630 | } | 875 | } |
631 | 876 | ||
632 | /* | 877 | /* |
633 | * Handle a spurious fault caused by a stale TLB entry. This allows | 878 | * Handle a spurious fault caused by a stale TLB entry. |
634 | * us to lazily refresh the TLB when increasing the permissions of a | 879 | * |
635 | * kernel page (RO -> RW or NX -> X). Doing it eagerly is very | 880 | * This allows us to lazily refresh the TLB when increasing the |
636 | * expensive since that implies doing a full cross-processor TLB | 881 | * permissions of a kernel page (RO -> RW or NX -> X). Doing it |
637 | * flush, even if no stale TLB entries exist on other processors. | 882 | * eagerly is very expensive since that implies doing a full |
883 | * cross-processor TLB flush, even if no stale TLB entries exist | ||
884 | * on other processors. | ||
885 | * | ||
638 | * There are no security implications to leaving a stale TLB when | 886 | * There are no security implications to leaving a stale TLB when |
639 | * increasing the permissions on a page. | 887 | * increasing the permissions on a page. |
640 | */ | 888 | */ |
641 | static noinline int spurious_fault(unsigned long error_code, | 889 | static noinline int |
642 | unsigned long address) | 890 | spurious_fault(unsigned long error_code, unsigned long address) |
643 | { | 891 | { |
644 | pgd_t *pgd; | 892 | pgd_t *pgd; |
645 | pud_t *pud; | 893 | pud_t *pud; |
646 | pmd_t *pmd; | 894 | pmd_t *pmd; |
647 | pte_t *pte; | 895 | pte_t *pte; |
896 | int ret; | ||
648 | 897 | ||
649 | /* Reserved-bit violation or user access to kernel space? */ | 898 | /* Reserved-bit violation or user access to kernel space? */ |
650 | if (error_code & (PF_USER | PF_RSVD)) | 899 | if (error_code & (PF_USER | PF_RSVD)) |
@@ -672,123 +921,46 @@ static noinline int spurious_fault(unsigned long error_code, | |||
672 | if (!pte_present(*pte)) | 921 | if (!pte_present(*pte)) |
673 | return 0; | 922 | return 0; |
674 | 923 | ||
675 | return spurious_fault_check(error_code, pte); | 924 | ret = spurious_fault_check(error_code, pte); |
676 | } | 925 | if (!ret) |
677 | 926 | return 0; | |
678 | /* | ||
679 | * X86_32 | ||
680 | * Handle a fault on the vmalloc or module mapping area | ||
681 | * | ||
682 | * X86_64 | ||
683 | * Handle a fault on the vmalloc area | ||
684 | * | ||
685 | * This assumes no large pages in there. | ||
686 | */ | ||
687 | static noinline int vmalloc_fault(unsigned long address) | ||
688 | { | ||
689 | #ifdef CONFIG_X86_32 | ||
690 | unsigned long pgd_paddr; | ||
691 | pmd_t *pmd_k; | ||
692 | pte_t *pte_k; | ||
693 | |||
694 | /* Make sure we are in vmalloc area */ | ||
695 | if (!(address >= VMALLOC_START && address < VMALLOC_END)) | ||
696 | return -1; | ||
697 | 927 | ||
698 | /* | 928 | /* |
699 | * Synchronize this task's top level page-table | 929 | * Make sure we have permissions in PMD. |
700 | * with the 'reference' page table. | 930 | * If not, then there's a bug in the page tables: |
701 | * | ||
702 | * Do _not_ use "current" here. We might be inside | ||
703 | * an interrupt in the middle of a task switch.. | ||
704 | */ | 931 | */ |
705 | pgd_paddr = read_cr3(); | 932 | ret = spurious_fault_check(error_code, (pte_t *) pmd); |
706 | pmd_k = vmalloc_sync_one(__va(pgd_paddr), address); | 933 | WARN_ONCE(!ret, "PMD has incorrect permission bits\n"); |
707 | if (!pmd_k) | ||
708 | return -1; | ||
709 | pte_k = pte_offset_kernel(pmd_k, address); | ||
710 | if (!pte_present(*pte_k)) | ||
711 | return -1; | ||
712 | return 0; | ||
713 | #else | ||
714 | pgd_t *pgd, *pgd_ref; | ||
715 | pud_t *pud, *pud_ref; | ||
716 | pmd_t *pmd, *pmd_ref; | ||
717 | pte_t *pte, *pte_ref; | ||
718 | 934 | ||
719 | /* Make sure we are in vmalloc area */ | 935 | return ret; |
720 | if (!(address >= VMALLOC_START && address < VMALLOC_END)) | ||
721 | return -1; | ||
722 | |||
723 | /* Copy kernel mappings over when needed. This can also | ||
724 | happen within a race in page table update. In the later | ||
725 | case just flush. */ | ||
726 | |||
727 | pgd = pgd_offset(current->active_mm, address); | ||
728 | pgd_ref = pgd_offset_k(address); | ||
729 | if (pgd_none(*pgd_ref)) | ||
730 | return -1; | ||
731 | if (pgd_none(*pgd)) | ||
732 | set_pgd(pgd, *pgd_ref); | ||
733 | else | ||
734 | BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref)); | ||
735 | |||
736 | /* Below here mismatches are bugs because these lower tables | ||
737 | are shared */ | ||
738 | |||
739 | pud = pud_offset(pgd, address); | ||
740 | pud_ref = pud_offset(pgd_ref, address); | ||
741 | if (pud_none(*pud_ref)) | ||
742 | return -1; | ||
743 | if (pud_none(*pud) || pud_page_vaddr(*pud) != pud_page_vaddr(*pud_ref)) | ||
744 | BUG(); | ||
745 | pmd = pmd_offset(pud, address); | ||
746 | pmd_ref = pmd_offset(pud_ref, address); | ||
747 | if (pmd_none(*pmd_ref)) | ||
748 | return -1; | ||
749 | if (pmd_none(*pmd) || pmd_page(*pmd) != pmd_page(*pmd_ref)) | ||
750 | BUG(); | ||
751 | pte_ref = pte_offset_kernel(pmd_ref, address); | ||
752 | if (!pte_present(*pte_ref)) | ||
753 | return -1; | ||
754 | pte = pte_offset_kernel(pmd, address); | ||
755 | /* Don't use pte_page here, because the mappings can point | ||
756 | outside mem_map, and the NUMA hash lookup cannot handle | ||
757 | that. */ | ||
758 | if (!pte_present(*pte) || pte_pfn(*pte) != pte_pfn(*pte_ref)) | ||
759 | BUG(); | ||
760 | return 0; | ||
761 | #endif | ||
762 | } | 936 | } |
763 | 937 | ||
764 | int show_unhandled_signals = 1; | 938 | int show_unhandled_signals = 1; |
765 | 939 | ||
766 | static inline int access_error(unsigned long error_code, int write, | 940 | static inline int |
767 | struct vm_area_struct *vma) | 941 | access_error(unsigned long error_code, int write, struct vm_area_struct *vma) |
768 | { | 942 | { |
769 | if (write) { | 943 | if (write) { |
770 | /* write, present and write, not present */ | 944 | /* write, present and write, not present: */ |
771 | if (unlikely(!(vma->vm_flags & VM_WRITE))) | 945 | if (unlikely(!(vma->vm_flags & VM_WRITE))) |
772 | return 1; | 946 | return 1; |
773 | } else if (unlikely(error_code & PF_PROT)) { | 947 | return 0; |
774 | /* read, present */ | ||
775 | return 1; | ||
776 | } else { | ||
777 | /* read, not present */ | ||
778 | if (unlikely(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))) | ||
779 | return 1; | ||
780 | } | 948 | } |
781 | 949 | ||
950 | /* read, present: */ | ||
951 | if (unlikely(error_code & PF_PROT)) | ||
952 | return 1; | ||
953 | |||
954 | /* read, not present: */ | ||
955 | if (unlikely(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))) | ||
956 | return 1; | ||
957 | |||
782 | return 0; | 958 | return 0; |
783 | } | 959 | } |
784 | 960 | ||
785 | static int fault_in_kernel_space(unsigned long address) | 961 | static int fault_in_kernel_space(unsigned long address) |
786 | { | 962 | { |
787 | #ifdef CONFIG_X86_32 | 963 | return address >= TASK_SIZE_MAX; |
788 | return address >= TASK_SIZE; | ||
789 | #else /* !CONFIG_X86_32 */ | ||
790 | return address >= TASK_SIZE64; | ||
791 | #endif /* CONFIG_X86_32 */ | ||
792 | } | 964 | } |
793 | 965 | ||
794 | /* | 966 | /* |
@@ -796,23 +968,22 @@ static int fault_in_kernel_space(unsigned long address) | |||
796 | * and the problem, and then passes it off to one of the appropriate | 968 | * and the problem, and then passes it off to one of the appropriate |
797 | * routines. | 969 | * routines. |
798 | */ | 970 | */ |
799 | #ifdef CONFIG_X86_64 | 971 | dotraplinkage void __kprobes |
800 | asmlinkage | 972 | do_page_fault(struct pt_regs *regs, unsigned long error_code) |
801 | #endif | ||
802 | void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | ||
803 | { | 973 | { |
804 | unsigned long address; | 974 | struct vm_area_struct *vma; |
805 | struct task_struct *tsk; | 975 | struct task_struct *tsk; |
976 | unsigned long address; | ||
806 | struct mm_struct *mm; | 977 | struct mm_struct *mm; |
807 | struct vm_area_struct *vma; | ||
808 | int write; | 978 | int write; |
809 | int fault; | 979 | int fault; |
810 | 980 | ||
811 | tsk = current; | 981 | tsk = current; |
812 | mm = tsk->mm; | 982 | mm = tsk->mm; |
983 | |||
813 | prefetchw(&mm->mmap_sem); | 984 | prefetchw(&mm->mmap_sem); |
814 | 985 | ||
815 | /* get the address */ | 986 | /* Get the faulting address: */ |
816 | address = read_cr2(); | 987 | address = read_cr2(); |
817 | 988 | ||
818 | if (unlikely(kmmio_fault(regs, address))) | 989 | if (unlikely(kmmio_fault(regs, address))) |
@@ -836,22 +1007,23 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
836 | vmalloc_fault(address) >= 0) | 1007 | vmalloc_fault(address) >= 0) |
837 | return; | 1008 | return; |
838 | 1009 | ||
839 | /* Can handle a stale RO->RW TLB */ | 1010 | /* Can handle a stale RO->RW TLB: */ |
840 | if (spurious_fault(error_code, address)) | 1011 | if (spurious_fault(error_code, address)) |
841 | return; | 1012 | return; |
842 | 1013 | ||
843 | /* kprobes don't want to hook the spurious faults. */ | 1014 | /* kprobes don't want to hook the spurious faults: */ |
844 | if (notify_page_fault(regs)) | 1015 | if (notify_page_fault(regs)) |
845 | return; | 1016 | return; |
846 | /* | 1017 | /* |
847 | * Don't take the mm semaphore here. If we fixup a prefetch | 1018 | * Don't take the mm semaphore here. If we fixup a prefetch |
848 | * fault we could otherwise deadlock. | 1019 | * fault we could otherwise deadlock: |
849 | */ | 1020 | */ |
850 | bad_area_nosemaphore(regs, error_code, address); | 1021 | bad_area_nosemaphore(regs, error_code, address); |
1022 | |||
851 | return; | 1023 | return; |
852 | } | 1024 | } |
853 | 1025 | ||
854 | /* kprobes don't want to hook the spurious faults. */ | 1026 | /* kprobes don't want to hook the spurious faults: */ |
855 | if (unlikely(notify_page_fault(regs))) | 1027 | if (unlikely(notify_page_fault(regs))) |
856 | return; | 1028 | return; |
857 | /* | 1029 | /* |
@@ -859,22 +1031,22 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
859 | * vmalloc fault has been handled. | 1031 | * vmalloc fault has been handled. |
860 | * | 1032 | * |
861 | * User-mode registers count as a user access even for any | 1033 | * User-mode registers count as a user access even for any |
862 | * potential system fault or CPU buglet. | 1034 | * potential system fault or CPU buglet: |
863 | */ | 1035 | */ |
864 | if (user_mode_vm(regs)) { | 1036 | if (user_mode_vm(regs)) { |
865 | local_irq_enable(); | 1037 | local_irq_enable(); |
866 | error_code |= PF_USER; | 1038 | error_code |= PF_USER; |
867 | } else if (regs->flags & X86_EFLAGS_IF) | 1039 | } else { |
868 | local_irq_enable(); | 1040 | if (regs->flags & X86_EFLAGS_IF) |
1041 | local_irq_enable(); | ||
1042 | } | ||
869 | 1043 | ||
870 | #ifdef CONFIG_X86_64 | ||
871 | if (unlikely(error_code & PF_RSVD)) | 1044 | if (unlikely(error_code & PF_RSVD)) |
872 | pgtable_bad(regs, error_code, address); | 1045 | pgtable_bad(regs, error_code, address); |
873 | #endif | ||
874 | 1046 | ||
875 | /* | 1047 | /* |
876 | * If we're in an interrupt, have no user context or are running in an | 1048 | * If we're in an interrupt, have no user context or are running |
877 | * atomic region then we must not take the fault. | 1049 | * in an atomic region then we must not take the fault: |
878 | */ | 1050 | */ |
879 | if (unlikely(in_atomic() || !mm)) { | 1051 | if (unlikely(in_atomic() || !mm)) { |
880 | bad_area_nosemaphore(regs, error_code, address); | 1052 | bad_area_nosemaphore(regs, error_code, address); |
@@ -883,19 +1055,19 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
883 | 1055 | ||
884 | /* | 1056 | /* |
885 | * When running in the kernel we expect faults to occur only to | 1057 | * When running in the kernel we expect faults to occur only to |
886 | * addresses in user space. All other faults represent errors in the | 1058 | * addresses in user space. All other faults represent errors in |
887 | * kernel and should generate an OOPS. Unfortunately, in the case of an | 1059 | * the kernel and should generate an OOPS. Unfortunately, in the |
888 | * erroneous fault occurring in a code path which already holds mmap_sem | 1060 | * case of an erroneous fault occurring in a code path which already |
889 | * we will deadlock attempting to validate the fault against the | 1061 | * holds mmap_sem we will deadlock attempting to validate the fault |
890 | * address space. Luckily the kernel only validly references user | 1062 | * against the address space. Luckily the kernel only validly |
891 | * space from well defined areas of code, which are listed in the | 1063 | * references user space from well defined areas of code, which are |
892 | * exceptions table. | 1064 | * listed in the exceptions table. |
893 | * | 1065 | * |
894 | * As the vast majority of faults will be valid we will only perform | 1066 | * As the vast majority of faults will be valid we will only perform |
895 | * the source reference check when there is a possibility of a deadlock. | 1067 | * the source reference check when there is a possibility of a |
896 | * Attempt to lock the address space, if we cannot we then validate the | 1068 | * deadlock. Attempt to lock the address space, if we cannot we then |
897 | * source. If this is invalid we can skip the address space check, | 1069 | * validate the source. If this is invalid we can skip the address |
898 | * thus avoiding the deadlock. | 1070 | * space check, thus avoiding the deadlock: |
899 | */ | 1071 | */ |
900 | if (unlikely(!down_read_trylock(&mm->mmap_sem))) { | 1072 | if (unlikely(!down_read_trylock(&mm->mmap_sem))) { |
901 | if ((error_code & PF_USER) == 0 && | 1073 | if ((error_code & PF_USER) == 0 && |
@@ -906,8 +1078,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
906 | down_read(&mm->mmap_sem); | 1078 | down_read(&mm->mmap_sem); |
907 | } else { | 1079 | } else { |
908 | /* | 1080 | /* |
909 | * The above down_read_trylock() might have succeeded in which | 1081 | * The above down_read_trylock() might have succeeded in |
910 | * case we'll have missed the might_sleep() from down_read(). | 1082 | * which case we'll have missed the might_sleep() from |
1083 | * down_read(): | ||
911 | */ | 1084 | */ |
912 | might_sleep(); | 1085 | might_sleep(); |
913 | } | 1086 | } |
@@ -927,7 +1100,7 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
927 | /* | 1100 | /* |
928 | * Accessing the stack below %sp is always a bug. | 1101 | * Accessing the stack below %sp is always a bug. |
929 | * The large cushion allows instructions like enter | 1102 | * The large cushion allows instructions like enter |
930 | * and pusha to work. ("enter $65535,$31" pushes | 1103 | * and pusha to work. ("enter $65535, $31" pushes |
931 | * 32 pointers and then decrements %sp by 65535.) | 1104 | * 32 pointers and then decrements %sp by 65535.) |
932 | */ | 1105 | */ |
933 | if (unlikely(address + 65536 + 32 * sizeof(unsigned long) < regs->sp)) { | 1106 | if (unlikely(address + 65536 + 32 * sizeof(unsigned long) < regs->sp)) { |
@@ -946,6 +1119,7 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
946 | */ | 1119 | */ |
947 | good_area: | 1120 | good_area: |
948 | write = error_code & PF_WRITE; | 1121 | write = error_code & PF_WRITE; |
1122 | |||
949 | if (unlikely(access_error(error_code, write, vma))) { | 1123 | if (unlikely(access_error(error_code, write, vma))) { |
950 | bad_area_access_error(regs, error_code, address); | 1124 | bad_area_access_error(regs, error_code, address); |
951 | return; | 1125 | return; |
@@ -954,75 +1128,21 @@ good_area: | |||
954 | /* | 1128 | /* |
955 | * If for any reason at all we couldn't handle the fault, | 1129 | * If for any reason at all we couldn't handle the fault, |
956 | * make sure we exit gracefully rather than endlessly redo | 1130 | * make sure we exit gracefully rather than endlessly redo |
957 | * the fault. | 1131 | * the fault: |
958 | */ | 1132 | */ |
959 | fault = handle_mm_fault(mm, vma, address, write); | 1133 | fault = handle_mm_fault(mm, vma, address, write); |
1134 | |||
960 | if (unlikely(fault & VM_FAULT_ERROR)) { | 1135 | if (unlikely(fault & VM_FAULT_ERROR)) { |
961 | mm_fault_error(regs, error_code, address, fault); | 1136 | mm_fault_error(regs, error_code, address, fault); |
962 | return; | 1137 | return; |
963 | } | 1138 | } |
1139 | |||
964 | if (fault & VM_FAULT_MAJOR) | 1140 | if (fault & VM_FAULT_MAJOR) |
965 | tsk->maj_flt++; | 1141 | tsk->maj_flt++; |
966 | else | 1142 | else |
967 | tsk->min_flt++; | 1143 | tsk->min_flt++; |
968 | 1144 | ||
969 | #ifdef CONFIG_X86_32 | 1145 | check_v8086_mode(regs, address, tsk); |
970 | /* | ||
971 | * Did it hit the DOS screen memory VA from vm86 mode? | ||
972 | */ | ||
973 | if (v8086_mode(regs)) { | ||
974 | unsigned long bit = (address - 0xA0000) >> PAGE_SHIFT; | ||
975 | if (bit < 32) | ||
976 | tsk->thread.screen_bitmap |= 1 << bit; | ||
977 | } | ||
978 | #endif | ||
979 | up_read(&mm->mmap_sem); | ||
980 | } | ||
981 | |||
982 | DEFINE_SPINLOCK(pgd_lock); | ||
983 | LIST_HEAD(pgd_list); | ||
984 | 1146 | ||
985 | void vmalloc_sync_all(void) | 1147 | up_read(&mm->mmap_sem); |
986 | { | ||
987 | unsigned long address; | ||
988 | |||
989 | #ifdef CONFIG_X86_32 | ||
990 | if (SHARED_KERNEL_PMD) | ||
991 | return; | ||
992 | |||
993 | for (address = VMALLOC_START & PMD_MASK; | ||
994 | address >= TASK_SIZE && address < FIXADDR_TOP; | ||
995 | address += PMD_SIZE) { | ||
996 | unsigned long flags; | ||
997 | struct page *page; | ||
998 | |||
999 | spin_lock_irqsave(&pgd_lock, flags); | ||
1000 | list_for_each_entry(page, &pgd_list, lru) { | ||
1001 | if (!vmalloc_sync_one(page_address(page), | ||
1002 | address)) | ||
1003 | break; | ||
1004 | } | ||
1005 | spin_unlock_irqrestore(&pgd_lock, flags); | ||
1006 | } | ||
1007 | #else /* CONFIG_X86_64 */ | ||
1008 | for (address = VMALLOC_START & PGDIR_MASK; address <= VMALLOC_END; | ||
1009 | address += PGDIR_SIZE) { | ||
1010 | const pgd_t *pgd_ref = pgd_offset_k(address); | ||
1011 | unsigned long flags; | ||
1012 | struct page *page; | ||
1013 | |||
1014 | if (pgd_none(*pgd_ref)) | ||
1015 | continue; | ||
1016 | spin_lock_irqsave(&pgd_lock, flags); | ||
1017 | list_for_each_entry(page, &pgd_list, lru) { | ||
1018 | pgd_t *pgd; | ||
1019 | pgd = (pgd_t *)page_address(page) + pgd_index(address); | ||
1020 | if (pgd_none(*pgd)) | ||
1021 | set_pgd(pgd, *pgd_ref); | ||
1022 | else | ||
1023 | BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref)); | ||
1024 | } | ||
1025 | spin_unlock_irqrestore(&pgd_lock, flags); | ||
1026 | } | ||
1027 | #endif | ||
1028 | } | 1148 | } |
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c index d1f7439d173c..3957cd6d6454 100644 --- a/arch/x86/mm/numa_32.c +++ b/arch/x86/mm/numa_32.c | |||
@@ -194,7 +194,7 @@ void *alloc_remap(int nid, unsigned long size) | |||
194 | size = ALIGN(size, L1_CACHE_BYTES); | 194 | size = ALIGN(size, L1_CACHE_BYTES); |
195 | 195 | ||
196 | if (!allocation || (allocation + size) >= node_remap_end_vaddr[nid]) | 196 | if (!allocation || (allocation + size) >= node_remap_end_vaddr[nid]) |
197 | return 0; | 197 | return NULL; |
198 | 198 | ||
199 | node_remap_alloc_vaddr[nid] += size; | 199 | node_remap_alloc_vaddr[nid] += size; |
200 | memset(allocation, 0, size); | 200 | memset(allocation, 0, size); |
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index deb1c1ab7868..64c9cf043cdd 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -166,7 +166,7 @@ int __init compute_hash_shift(struct bootnode *nodes, int numnodes, | |||
166 | return shift; | 166 | return shift; |
167 | } | 167 | } |
168 | 168 | ||
169 | int early_pfn_to_nid(unsigned long pfn) | 169 | int __meminit __early_pfn_to_nid(unsigned long pfn) |
170 | { | 170 | { |
171 | return phys_to_nid(pfn << PAGE_SHIFT); | 171 | return phys_to_nid(pfn << PAGE_SHIFT); |
172 | } | 172 | } |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 8ca0d8566fc8..8253bc97587e 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -482,6 +482,13 @@ static int split_large_page(pte_t *kpte, unsigned long address) | |||
482 | pbase = (pte_t *)page_address(base); | 482 | pbase = (pte_t *)page_address(base); |
483 | paravirt_alloc_pte(&init_mm, page_to_pfn(base)); | 483 | paravirt_alloc_pte(&init_mm, page_to_pfn(base)); |
484 | ref_prot = pte_pgprot(pte_clrhuge(*kpte)); | 484 | ref_prot = pte_pgprot(pte_clrhuge(*kpte)); |
485 | /* | ||
486 | * If we ever want to utilize the PAT bit, we need to | ||
487 | * update this function to make sure it's converted from | ||
488 | * bit 12 to bit 7 when we cross from the 2MB level to | ||
489 | * the 4K level: | ||
490 | */ | ||
491 | WARN_ON_ONCE(pgprot_val(ref_prot) & _PAGE_PAT_LARGE); | ||
485 | 492 | ||
486 | #ifdef CONFIG_X86_64 | 493 | #ifdef CONFIG_X86_64 |
487 | if (level == PG_LEVEL_1G) { | 494 | if (level == PG_LEVEL_1G) { |
@@ -508,18 +515,13 @@ static int split_large_page(pte_t *kpte, unsigned long address) | |||
508 | #endif | 515 | #endif |
509 | 516 | ||
510 | /* | 517 | /* |
511 | * Install the new, split up pagetable. Important details here: | 518 | * Install the new, split up pagetable. |
512 | * | ||
513 | * On Intel the NX bit of all levels must be cleared to make a | ||
514 | * page executable. See section 4.13.2 of Intel 64 and IA-32 | ||
515 | * Architectures Software Developer's Manual). | ||
516 | * | 519 | * |
517 | * Mark the entry present. The current mapping might be | 520 | * We use the standard kernel pagetable protections for the new |
518 | * set to not present, which we preserved above. | 521 | * pagetable protections, the actual ptes set above control the |
522 | * primary protection behavior: | ||
519 | */ | 523 | */ |
520 | ref_prot = pte_pgprot(pte_mkexec(pte_clrhuge(*kpte))); | 524 | __set_pmd_pte(kpte, address, mk_pte(base, __pgprot(_KERNPG_TABLE))); |
521 | pgprot_val(ref_prot) |= _PAGE_PRESENT; | ||
522 | __set_pmd_pte(kpte, address, mk_pte(base, ref_prot)); | ||
523 | base = NULL; | 525 | base = NULL; |
524 | 526 | ||
525 | out_unlock: | 527 | out_unlock: |
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c index 15df1baee100..574c8bc95ef0 100644 --- a/arch/x86/mm/srat_64.c +++ b/arch/x86/mm/srat_64.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <asm/proto.h> | 20 | #include <asm/proto.h> |
21 | #include <asm/numa.h> | 21 | #include <asm/numa.h> |
22 | #include <asm/e820.h> | 22 | #include <asm/e820.h> |
23 | #include <asm/genapic.h> | 23 | #include <asm/apic.h> |
24 | #include <asm/uv/uv.h> | 24 | #include <asm/uv/uv.h> |
25 | 25 | ||
26 | int acpi_numa __initdata; | 26 | int acpi_numa __initdata; |
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 14c5af4d11e6..a654d59e4483 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c | |||
@@ -14,7 +14,6 @@ | |||
14 | DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) | 14 | DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) |
15 | = { &init_mm, 0, }; | 15 | = { &init_mm, 0, }; |
16 | 16 | ||
17 | #include <asm/genapic.h> | ||
18 | /* | 17 | /* |
19 | * Smarter SMP flushing macros. | 18 | * Smarter SMP flushing macros. |
20 | * c/o Linus Torvalds. | 19 | * c/o Linus Torvalds. |
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c index 5601e829c387..8eb295e116f6 100644 --- a/arch/x86/pci/numaq_32.c +++ b/arch/x86/pci/numaq_32.c | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/pci.h> | 5 | #include <linux/pci.h> |
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | #include <linux/nodemask.h> | 7 | #include <linux/nodemask.h> |
8 | #include <asm/genapic.h> | 8 | #include <asm/apic.h> |
9 | #include <asm/mpspec.h> | 9 | #include <asm/mpspec.h> |
10 | #include <asm/pci_x86.h> | 10 | #include <asm/pci_x86.h> |
11 | 11 | ||
diff --git a/arch/x86/power/hibernate_asm_32.S b/arch/x86/power/hibernate_asm_32.S index d1e9b53f9d33..b641388d8286 100644 --- a/arch/x86/power/hibernate_asm_32.S +++ b/arch/x86/power/hibernate_asm_32.S | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/linkage.h> | 9 | #include <linux/linkage.h> |
10 | #include <asm/segment.h> | 10 | #include <asm/segment.h> |
11 | #include <asm/page.h> | 11 | #include <asm/page_types.h> |
12 | #include <asm/asm-offsets.h> | 12 | #include <asm/asm-offsets.h> |
13 | #include <asm/processor-flags.h> | 13 | #include <asm/processor-flags.h> |
14 | 14 | ||
diff --git a/arch/x86/power/hibernate_asm_64.S b/arch/x86/power/hibernate_asm_64.S index 000415947d93..9356547d8c01 100644 --- a/arch/x86/power/hibernate_asm_64.S +++ b/arch/x86/power/hibernate_asm_64.S | |||
@@ -18,7 +18,7 @@ | |||
18 | .text | 18 | .text |
19 | #include <linux/linkage.h> | 19 | #include <linux/linkage.h> |
20 | #include <asm/segment.h> | 20 | #include <asm/segment.h> |
21 | #include <asm/page.h> | 21 | #include <asm/page_types.h> |
22 | #include <asm/asm-offsets.h> | 22 | #include <asm/asm-offsets.h> |
23 | #include <asm/processor-flags.h> | 23 | #include <asm/processor-flags.h> |
24 | 24 | ||
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c index 9c98cc6ba978..7133cdf9098b 100644 --- a/arch/x86/vdso/vma.c +++ b/arch/x86/vdso/vma.c | |||
@@ -85,8 +85,8 @@ static unsigned long vdso_addr(unsigned long start, unsigned len) | |||
85 | unsigned long addr, end; | 85 | unsigned long addr, end; |
86 | unsigned offset; | 86 | unsigned offset; |
87 | end = (start + PMD_SIZE - 1) & PMD_MASK; | 87 | end = (start + PMD_SIZE - 1) & PMD_MASK; |
88 | if (end >= TASK_SIZE64) | 88 | if (end >= TASK_SIZE_MAX) |
89 | end = TASK_SIZE64; | 89 | end = TASK_SIZE_MAX; |
90 | end -= len; | 90 | end -= len; |
91 | /* This loses some more bits than a modulo, but is cheaper */ | 91 | /* This loses some more bits than a modulo, but is cheaper */ |
92 | offset = get_random_int() & (PTRS_PER_PTE - 1); | 92 | offset = get_random_int() & (PTRS_PER_PTE - 1); |
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig index 87b9ab166423..b83e119fbeb0 100644 --- a/arch/x86/xen/Kconfig +++ b/arch/x86/xen/Kconfig | |||
@@ -6,7 +6,7 @@ config XEN | |||
6 | bool "Xen guest support" | 6 | bool "Xen guest support" |
7 | select PARAVIRT | 7 | select PARAVIRT |
8 | select PARAVIRT_CLOCK | 8 | select PARAVIRT_CLOCK |
9 | depends on X86_64 || (X86_32 && X86_PAE && !(X86_VISWS || X86_VOYAGER)) | 9 | depends on X86_64 || (X86_32 && X86_PAE && !X86_VISWS) |
10 | depends on X86_CMPXCHG && X86_TSC | 10 | depends on X86_CMPXCHG && X86_TSC |
11 | help | 11 | help |
12 | This is the Linux Xen port. Enabling this will allow the | 12 | This is the Linux Xen port. Enabling this will allow the |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 95ff6a0e942a..86497d5f44cd 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -554,14 +554,15 @@ static u32 xen_safe_apic_wait_icr_idle(void) | |||
554 | return 0; | 554 | return 0; |
555 | } | 555 | } |
556 | 556 | ||
557 | static struct apic_ops xen_basic_apic_ops = { | 557 | static void set_xen_basic_apic_ops(void) |
558 | .read = xen_apic_read, | 558 | { |
559 | .write = xen_apic_write, | 559 | apic->read = xen_apic_read; |
560 | .icr_read = xen_apic_icr_read, | 560 | apic->write = xen_apic_write; |
561 | .icr_write = xen_apic_icr_write, | 561 | apic->icr_read = xen_apic_icr_read; |
562 | .wait_icr_idle = xen_apic_wait_icr_idle, | 562 | apic->icr_write = xen_apic_icr_write; |
563 | .safe_wait_icr_idle = xen_safe_apic_wait_icr_idle, | 563 | apic->wait_icr_idle = xen_apic_wait_icr_idle; |
564 | }; | 564 | apic->safe_wait_icr_idle = xen_safe_apic_wait_icr_idle; |
565 | } | ||
565 | 566 | ||
566 | #endif | 567 | #endif |
567 | 568 | ||
@@ -898,7 +899,7 @@ asmlinkage void __init xen_start_kernel(void) | |||
898 | /* | 899 | /* |
899 | * set up the basic apic ops. | 900 | * set up the basic apic ops. |
900 | */ | 901 | */ |
901 | apic_ops = &xen_basic_apic_ops; | 902 | set_xen_basic_apic_ops(); |
902 | #endif | 903 | #endif |
903 | 904 | ||
904 | if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) { | 905 | if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) { |
diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S index 63d49a523ed3..1a5ff24e29c0 100644 --- a/arch/x86/xen/xen-head.S +++ b/arch/x86/xen/xen-head.S | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | #include <asm/boot.h> | 9 | #include <asm/boot.h> |
10 | #include <asm/asm.h> | 10 | #include <asm/asm.h> |
11 | #include <asm/page.h> | 11 | #include <asm/page_types.h> |
12 | 12 | ||
13 | #include <xen/interface/elfnote.h> | 13 | #include <xen/interface/elfnote.h> |
14 | #include <asm/xen/interface.h> | 14 | #include <asm/xen/interface.h> |
diff --git a/block/blk-timeout.c b/block/blk-timeout.c index a09535377a94..bbbdc4b8ccf2 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c | |||
@@ -209,12 +209,19 @@ void blk_abort_queue(struct request_queue *q) | |||
209 | { | 209 | { |
210 | unsigned long flags; | 210 | unsigned long flags; |
211 | struct request *rq, *tmp; | 211 | struct request *rq, *tmp; |
212 | LIST_HEAD(list); | ||
212 | 213 | ||
213 | spin_lock_irqsave(q->queue_lock, flags); | 214 | spin_lock_irqsave(q->queue_lock, flags); |
214 | 215 | ||
215 | elv_abort_queue(q); | 216 | elv_abort_queue(q); |
216 | 217 | ||
217 | list_for_each_entry_safe(rq, tmp, &q->timeout_list, timeout_list) | 218 | /* |
219 | * Splice entries to local list, to avoid deadlocking if entries | ||
220 | * get readded to the timeout list by error handling | ||
221 | */ | ||
222 | list_splice_init(&q->timeout_list, &list); | ||
223 | |||
224 | list_for_each_entry_safe(rq, tmp, &list, timeout_list) | ||
218 | blk_abort_request(rq); | 225 | blk_abort_request(rq); |
219 | 226 | ||
220 | spin_unlock_irqrestore(q->queue_lock, flags); | 227 | spin_unlock_irqrestore(q->queue_lock, flags); |
diff --git a/block/blktrace.c b/block/blktrace.c index 39cc3bfe56e4..7cf9d1ff45a0 100644 --- a/block/blktrace.c +++ b/block/blktrace.c | |||
@@ -142,7 +142,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, | |||
142 | 142 | ||
143 | what |= ddir_act[rw & WRITE]; | 143 | what |= ddir_act[rw & WRITE]; |
144 | what |= MASK_TC_BIT(rw, BARRIER); | 144 | what |= MASK_TC_BIT(rw, BARRIER); |
145 | what |= MASK_TC_BIT(rw, SYNC); | 145 | what |= MASK_TC_BIT(rw, SYNCIO); |
146 | what |= MASK_TC_BIT(rw, AHEAD); | 146 | what |= MASK_TC_BIT(rw, AHEAD); |
147 | what |= MASK_TC_BIT(rw, META); | 147 | what |= MASK_TC_BIT(rw, META); |
148 | what |= MASK_TC_BIT(rw, DISCARD); | 148 | what |= MASK_TC_BIT(rw, DISCARD); |
diff --git a/block/bsg.c b/block/bsg.c index d414bb5607e8..0ce8806dd0c1 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -244,7 +244,8 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw) | |||
244 | * map sg_io_v4 to a request. | 244 | * map sg_io_v4 to a request. |
245 | */ | 245 | */ |
246 | static struct request * | 246 | static struct request * |
247 | bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm) | 247 | bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm, |
248 | u8 *sense) | ||
248 | { | 249 | { |
249 | struct request_queue *q = bd->queue; | 250 | struct request_queue *q = bd->queue; |
250 | struct request *rq, *next_rq = NULL; | 251 | struct request *rq, *next_rq = NULL; |
@@ -306,6 +307,10 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm) | |||
306 | if (ret) | 307 | if (ret) |
307 | goto out; | 308 | goto out; |
308 | } | 309 | } |
310 | |||
311 | rq->sense = sense; | ||
312 | rq->sense_len = 0; | ||
313 | |||
309 | return rq; | 314 | return rq; |
310 | out: | 315 | out: |
311 | if (rq->cmd != rq->__cmd) | 316 | if (rq->cmd != rq->__cmd) |
@@ -348,9 +353,6 @@ static void bsg_rq_end_io(struct request *rq, int uptodate) | |||
348 | static void bsg_add_command(struct bsg_device *bd, struct request_queue *q, | 353 | static void bsg_add_command(struct bsg_device *bd, struct request_queue *q, |
349 | struct bsg_command *bc, struct request *rq) | 354 | struct bsg_command *bc, struct request *rq) |
350 | { | 355 | { |
351 | rq->sense = bc->sense; | ||
352 | rq->sense_len = 0; | ||
353 | |||
354 | /* | 356 | /* |
355 | * add bc command to busy queue and submit rq for io | 357 | * add bc command to busy queue and submit rq for io |
356 | */ | 358 | */ |
@@ -419,7 +421,7 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr, | |||
419 | { | 421 | { |
420 | int ret = 0; | 422 | int ret = 0; |
421 | 423 | ||
422 | dprintk("rq %p bio %p %u\n", rq, bio, rq->errors); | 424 | dprintk("rq %p bio %p 0x%x\n", rq, bio, rq->errors); |
423 | /* | 425 | /* |
424 | * fill in all the output members | 426 | * fill in all the output members |
425 | */ | 427 | */ |
@@ -635,7 +637,7 @@ static int __bsg_write(struct bsg_device *bd, const char __user *buf, | |||
635 | /* | 637 | /* |
636 | * get a request, fill in the blanks, and add to request queue | 638 | * get a request, fill in the blanks, and add to request queue |
637 | */ | 639 | */ |
638 | rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm); | 640 | rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm, bc->sense); |
639 | if (IS_ERR(rq)) { | 641 | if (IS_ERR(rq)) { |
640 | ret = PTR_ERR(rq); | 642 | ret = PTR_ERR(rq); |
641 | rq = NULL; | 643 | rq = NULL; |
@@ -922,11 +924,12 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
922 | struct request *rq; | 924 | struct request *rq; |
923 | struct bio *bio, *bidi_bio = NULL; | 925 | struct bio *bio, *bidi_bio = NULL; |
924 | struct sg_io_v4 hdr; | 926 | struct sg_io_v4 hdr; |
927 | u8 sense[SCSI_SENSE_BUFFERSIZE]; | ||
925 | 928 | ||
926 | if (copy_from_user(&hdr, uarg, sizeof(hdr))) | 929 | if (copy_from_user(&hdr, uarg, sizeof(hdr))) |
927 | return -EFAULT; | 930 | return -EFAULT; |
928 | 931 | ||
929 | rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE); | 932 | rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE, sense); |
930 | if (IS_ERR(rq)) | 933 | if (IS_ERR(rq)) |
931 | return PTR_ERR(rq); | 934 | return PTR_ERR(rq); |
932 | 935 | ||
diff --git a/block/genhd.c b/block/genhd.c index 397960cf26af..e1eadcc9546a 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1087,6 +1087,14 @@ dev_t blk_lookup_devt(const char *name, int partno) | |||
1087 | if (strcmp(dev_name(dev), name)) | 1087 | if (strcmp(dev_name(dev), name)) |
1088 | continue; | 1088 | continue; |
1089 | 1089 | ||
1090 | if (partno < disk->minors) { | ||
1091 | /* We need to return the right devno, even | ||
1092 | * if the partition doesn't exist yet. | ||
1093 | */ | ||
1094 | devt = MKDEV(MAJOR(dev->devt), | ||
1095 | MINOR(dev->devt) + partno); | ||
1096 | break; | ||
1097 | } | ||
1090 | part = disk_get_part(disk, partno); | 1098 | part = disk_get_part(disk, partno); |
1091 | if (part) { | 1099 | if (part) { |
1092 | devt = part_devt(part); | 1100 | devt = part_devt(part); |
diff --git a/crypto/lrw.c b/crypto/lrw.c index 8ef664e3bcd9..358f80be2bf9 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c | |||
@@ -45,7 +45,13 @@ struct priv { | |||
45 | 45 | ||
46 | static inline void setbit128_bbe(void *b, int bit) | 46 | static inline void setbit128_bbe(void *b, int bit) |
47 | { | 47 | { |
48 | __set_bit(bit ^ 0x78, b); | 48 | __set_bit(bit ^ (0x80 - |
49 | #ifdef __BIG_ENDIAN | ||
50 | BITS_PER_LONG | ||
51 | #else | ||
52 | BITS_PER_BYTE | ||
53 | #endif | ||
54 | ), b); | ||
49 | } | 55 | } |
50 | 56 | ||
51 | static int setkey(struct crypto_tfm *parent, const u8 *key, | 57 | static int setkey(struct crypto_tfm *parent, const u8 *key, |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index a7799a99f2d9..8a851d0f4384 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -254,13 +254,6 @@ config ACPI_PCI_SLOT | |||
254 | help you correlate PCI bus addresses with the physical geography | 254 | help you correlate PCI bus addresses with the physical geography |
255 | of your slots. If you are unsure, say N. | 255 | of your slots. If you are unsure, say N. |
256 | 256 | ||
257 | config ACPI_SYSTEM | ||
258 | bool | ||
259 | default y | ||
260 | help | ||
261 | This driver will enable your system to shut down using ACPI, and | ||
262 | dump your ACPI DSDT table using /proc/acpi/dsdt. | ||
263 | |||
264 | config X86_PM_TIMER | 257 | config X86_PM_TIMER |
265 | bool "Power Management Timer Support" if EMBEDDED | 258 | bool "Power Management Timer Support" if EMBEDDED |
266 | depends on X86 | 259 | depends on X86 |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 65d90c720b5a..b130ea0d0759 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -52,7 +52,7 @@ obj-$(CONFIG_ACPI_PROCESSOR) += processor.o | |||
52 | obj-$(CONFIG_ACPI_CONTAINER) += container.o | 52 | obj-$(CONFIG_ACPI_CONTAINER) += container.o |
53 | obj-$(CONFIG_ACPI_THERMAL) += thermal.o | 53 | obj-$(CONFIG_ACPI_THERMAL) += thermal.o |
54 | obj-y += power.o | 54 | obj-y += power.o |
55 | obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o | 55 | obj-y += system.o event.o |
56 | obj-$(CONFIG_ACPI_DEBUG) += debug.o | 56 | obj-$(CONFIG_ACPI_DEBUG) += debug.o |
57 | obj-$(CONFIG_ACPI_NUMA) += numa.o | 57 | obj-$(CONFIG_ACPI_NUMA) += numa.o |
58 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o | 58 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 65132f920459..69cbc57c2d1c 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -138,6 +138,29 @@ static int acpi_battery_technology(struct acpi_battery *battery) | |||
138 | 138 | ||
139 | static int acpi_battery_get_state(struct acpi_battery *battery); | 139 | static int acpi_battery_get_state(struct acpi_battery *battery); |
140 | 140 | ||
141 | static int acpi_battery_is_charged(struct acpi_battery *battery) | ||
142 | { | ||
143 | /* either charging or discharging */ | ||
144 | if (battery->state != 0) | ||
145 | return 0; | ||
146 | |||
147 | /* battery not reporting charge */ | ||
148 | if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN || | ||
149 | battery->capacity_now == 0) | ||
150 | return 0; | ||
151 | |||
152 | /* good batteries update full_charge as the batteries degrade */ | ||
153 | if (battery->full_charge_capacity == battery->capacity_now) | ||
154 | return 1; | ||
155 | |||
156 | /* fallback to using design values for broken batteries */ | ||
157 | if (battery->design_capacity == battery->capacity_now) | ||
158 | return 1; | ||
159 | |||
160 | /* we don't do any sort of metric based on percentages */ | ||
161 | return 0; | ||
162 | } | ||
163 | |||
141 | static int acpi_battery_get_property(struct power_supply *psy, | 164 | static int acpi_battery_get_property(struct power_supply *psy, |
142 | enum power_supply_property psp, | 165 | enum power_supply_property psp, |
143 | union power_supply_propval *val) | 166 | union power_supply_propval *val) |
@@ -155,7 +178,7 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
155 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; | 178 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; |
156 | else if (battery->state & 0x02) | 179 | else if (battery->state & 0x02) |
157 | val->intval = POWER_SUPPLY_STATUS_CHARGING; | 180 | val->intval = POWER_SUPPLY_STATUS_CHARGING; |
158 | else if (battery->state == 0) | 181 | else if (acpi_battery_is_charged(battery)) |
159 | val->intval = POWER_SUPPLY_STATUS_FULL; | 182 | val->intval = POWER_SUPPLY_STATUS_FULL; |
160 | else | 183 | else |
161 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; | 184 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 5c2f5d343be6..2fe15060dcdc 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -120,6 +120,8 @@ static struct acpi_ec { | |||
120 | spinlock_t curr_lock; | 120 | spinlock_t curr_lock; |
121 | } *boot_ec, *first_ec; | 121 | } *boot_ec, *first_ec; |
122 | 122 | ||
123 | static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */ | ||
124 | |||
123 | /* -------------------------------------------------------------------------- | 125 | /* -------------------------------------------------------------------------- |
124 | Transaction Management | 126 | Transaction Management |
125 | -------------------------------------------------------------------------- */ | 127 | -------------------------------------------------------------------------- */ |
@@ -259,6 +261,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
259 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 261 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
260 | acpi_disable_gpe(NULL, ec->gpe); | 262 | acpi_disable_gpe(NULL, ec->gpe); |
261 | } | 263 | } |
264 | if (EC_FLAGS_MSI) | ||
265 | udelay(ACPI_EC_DELAY); | ||
262 | /* start transaction */ | 266 | /* start transaction */ |
263 | spin_lock_irqsave(&ec->curr_lock, tmp); | 267 | spin_lock_irqsave(&ec->curr_lock, tmp); |
264 | /* following two actions should be kept atomic */ | 268 | /* following two actions should be kept atomic */ |
@@ -967,6 +971,11 @@ int __init acpi_ec_ecdt_probe(void) | |||
967 | /* | 971 | /* |
968 | * Generate a boot ec context | 972 | * Generate a boot ec context |
969 | */ | 973 | */ |
974 | if (dmi_name_in_vendors("Micro-Star") || | ||
975 | dmi_name_in_vendors("Notebook")) { | ||
976 | pr_info(PREFIX "Enabling special treatment for EC from MSI.\n"); | ||
977 | EC_FLAGS_MSI = 1; | ||
978 | } | ||
970 | status = acpi_get_table(ACPI_SIG_ECDT, 1, | 979 | status = acpi_get_table(ACPI_SIG_ECDT, 1, |
971 | (struct acpi_table_header **)&ecdt_ptr); | 980 | (struct acpi_table_header **)&ecdt_ptr); |
972 | if (ACPI_SUCCESS(status)) { | 981 | if (ACPI_SUCCESS(status)) { |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index d1dd5160daa9..2b6c59028254 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -272,7 +272,7 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size) | |||
272 | } | 272 | } |
273 | EXPORT_SYMBOL_GPL(acpi_os_map_memory); | 273 | EXPORT_SYMBOL_GPL(acpi_os_map_memory); |
274 | 274 | ||
275 | void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) | 275 | void __ref acpi_os_unmap_memory(void __iomem *virt, acpi_size size) |
276 | { | 276 | { |
277 | if (acpi_gbl_permanent_mmap) | 277 | if (acpi_gbl_permanent_mmap) |
278 | iounmap(virt); | 278 | iounmap(virt); |
@@ -281,7 +281,7 @@ void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) | |||
281 | } | 281 | } |
282 | EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); | 282 | EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); |
283 | 283 | ||
284 | void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size) | 284 | void __init early_acpi_os_unmap_memory(void __iomem *virt, acpi_size size) |
285 | { | 285 | { |
286 | if (!acpi_gbl_permanent_mmap) | 286 | if (!acpi_gbl_permanent_mmap) |
287 | __acpi_unmap_table(virt, size); | 287 | __acpi_unmap_table(virt, size); |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 0b299b0f8172..714cb046b594 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -773,18 +773,32 @@ unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf, | |||
773 | else | 773 | else |
774 | iowrite32_rep(data_addr, buf, words); | 774 | iowrite32_rep(data_addr, buf, words); |
775 | 775 | ||
776 | /* Transfer trailing bytes, if any */ | ||
776 | if (unlikely(slop)) { | 777 | if (unlikely(slop)) { |
777 | __le32 pad; | 778 | unsigned char pad[4]; |
779 | |||
780 | /* Point buf to the tail of buffer */ | ||
781 | buf += buflen - slop; | ||
782 | |||
783 | /* | ||
784 | * Use io*_rep() accessors here as well to avoid pointlessly | ||
785 | * swapping bytes to and fro on the big endian machines... | ||
786 | */ | ||
778 | if (rw == READ) { | 787 | if (rw == READ) { |
779 | pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); | 788 | if (slop < 3) |
780 | memcpy(buf + buflen - slop, &pad, slop); | 789 | ioread16_rep(data_addr, pad, 1); |
790 | else | ||
791 | ioread32_rep(data_addr, pad, 1); | ||
792 | memcpy(buf, pad, slop); | ||
781 | } else { | 793 | } else { |
782 | memcpy(&pad, buf + buflen - slop, slop); | 794 | memcpy(pad, buf, slop); |
783 | iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); | 795 | if (slop < 3) |
796 | iowrite16_rep(data_addr, pad, 1); | ||
797 | else | ||
798 | iowrite32_rep(data_addr, pad, 1); | ||
784 | } | 799 | } |
785 | words++; | ||
786 | } | 800 | } |
787 | return words << 2; | 801 | return (buflen + 1) & ~1; |
788 | } | 802 | } |
789 | EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); | 803 | EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); |
790 | 804 | ||
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 79a6c9a0b721..ba556d3e6963 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -110,7 +110,8 @@ static const struct via_isa_bridge { | |||
110 | { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 110 | { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
111 | { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 111 | { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
112 | { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, | 112 | { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, |
113 | { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES}, | 113 | { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, |
114 | { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, | ||
114 | { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 115 | { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
115 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 116 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
116 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 117 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
@@ -593,6 +594,7 @@ static int via_reinit_one(struct pci_dev *pdev) | |||
593 | #endif | 594 | #endif |
594 | 595 | ||
595 | static const struct pci_device_id via[] = { | 596 | static const struct pci_device_id via[] = { |
597 | { PCI_VDEVICE(VIA, 0x0415), }, | ||
596 | { PCI_VDEVICE(VIA, 0x0571), }, | 598 | { PCI_VDEVICE(VIA, 0x0571), }, |
597 | { PCI_VDEVICE(VIA, 0x0581), }, | 599 | { PCI_VDEVICE(VIA, 0x0581), }, |
598 | { PCI_VDEVICE(VIA, 0x1571), }, | 600 | { PCI_VDEVICE(VIA, 0x1571), }, |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 444af0415ca1..55a8eed3f3a3 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -421,19 +421,21 @@ static struct ata_port_operations nv_generic_ops = { | |||
421 | .hardreset = ATA_OP_NULL, | 421 | .hardreset = ATA_OP_NULL, |
422 | }; | 422 | }; |
423 | 423 | ||
424 | /* OSDL bz3352 reports that nf2/3 controllers can't determine device | 424 | /* nf2 is ripe with hardreset related problems. |
425 | * signature reliably. Also, the following thread reports detection | 425 | * |
426 | * failure on cold boot with the standard debouncing timing. | 426 | * kernel bz#3352 reports nf2/3 controllers can't determine device |
427 | * signature reliably. The following thread reports detection failure | ||
428 | * on cold boot with the standard debouncing timing. | ||
427 | * | 429 | * |
428 | * http://thread.gmane.org/gmane.linux.ide/34098 | 430 | * http://thread.gmane.org/gmane.linux.ide/34098 |
429 | * | 431 | * |
430 | * Debounce with hotplug timing and request follow-up SRST. | 432 | * And bz#12176 reports that hardreset simply doesn't work on nf2. |
433 | * Give up on it and just don't do hardreset. | ||
431 | */ | 434 | */ |
432 | static struct ata_port_operations nv_nf2_ops = { | 435 | static struct ata_port_operations nv_nf2_ops = { |
433 | .inherits = &nv_common_ops, | 436 | .inherits = &nv_generic_ops, |
434 | .freeze = nv_nf2_freeze, | 437 | .freeze = nv_nf2_freeze, |
435 | .thaw = nv_nf2_thaw, | 438 | .thaw = nv_nf2_thaw, |
436 | .hardreset = nv_noclassify_hardreset, | ||
437 | }; | 439 | }; |
438 | 440 | ||
439 | /* For initial probing after boot and hot plugging, hardreset mostly | 441 | /* For initial probing after boot and hot plugging, hardreset mostly |
diff --git a/drivers/base/base.h b/drivers/base/base.h index 0a5f055dffba..9f50f1b545dc 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
@@ -88,8 +88,6 @@ extern void driver_detach(struct device_driver *drv); | |||
88 | extern int driver_probe_device(struct device_driver *drv, struct device *dev); | 88 | extern int driver_probe_device(struct device_driver *drv, struct device *dev); |
89 | 89 | ||
90 | extern void sysdev_shutdown(void); | 90 | extern void sysdev_shutdown(void); |
91 | extern int sysdev_suspend(pm_message_t state); | ||
92 | extern int sysdev_resume(void); | ||
93 | 91 | ||
94 | extern char *make_class_name(const char *name, struct kobject *kobj); | 92 | extern char *make_class_name(const char *name, struct kobject *kobj); |
95 | 93 | ||
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 315bed8d5e7f..135231239103 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -18,9 +18,11 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/delay.h> | ||
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
22 | #include <linux/kthread.h> | 23 | #include <linux/kthread.h> |
23 | #include <linux/wait.h> | 24 | #include <linux/wait.h> |
25 | #include <linux/async.h> | ||
24 | 26 | ||
25 | #include "base.h" | 27 | #include "base.h" |
26 | #include "power/power.h" | 28 | #include "power/power.h" |
@@ -168,6 +170,21 @@ int driver_probe_done(void) | |||
168 | } | 170 | } |
169 | 171 | ||
170 | /** | 172 | /** |
173 | * wait_for_device_probe | ||
174 | * Wait for device probing to be completed. | ||
175 | * | ||
176 | * Note: this function polls at 100 msec intervals. | ||
177 | */ | ||
178 | int wait_for_device_probe(void) | ||
179 | { | ||
180 | /* wait for the known devices to complete their probing */ | ||
181 | while (driver_probe_done() != 0) | ||
182 | msleep(100); | ||
183 | async_synchronize_full(); | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | /** | ||
171 | * driver_probe_device - attempt to bind device & driver together | 188 | * driver_probe_device - attempt to bind device & driver together |
172 | * @drv: driver to bind a device to | 189 | * @drv: driver to bind a device to |
173 | * @dev: device to try to bind to the driver | 190 | * @dev: device to try to bind to the driver |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 670c9d6c1407..2d14f4ae6c01 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -333,7 +333,6 @@ static void dpm_power_up(pm_message_t state) | |||
333 | */ | 333 | */ |
334 | void device_power_up(pm_message_t state) | 334 | void device_power_up(pm_message_t state) |
335 | { | 335 | { |
336 | sysdev_resume(); | ||
337 | dpm_power_up(state); | 336 | dpm_power_up(state); |
338 | } | 337 | } |
339 | EXPORT_SYMBOL_GPL(device_power_up); | 338 | EXPORT_SYMBOL_GPL(device_power_up); |
@@ -577,8 +576,6 @@ int device_power_down(pm_message_t state) | |||
577 | } | 576 | } |
578 | dev->power.status = DPM_OFF_IRQ; | 577 | dev->power.status = DPM_OFF_IRQ; |
579 | } | 578 | } |
580 | if (!error) | ||
581 | error = sysdev_suspend(state); | ||
582 | if (error) | 579 | if (error) |
583 | dpm_power_up(resume_event(state)); | 580 | dpm_power_up(resume_event(state)); |
584 | return error; | 581 | return error; |
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index c98c31ec2f75..b428c8c4bc64 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
@@ -303,7 +303,6 @@ void sysdev_unregister(struct sys_device * sysdev) | |||
303 | * is guaranteed by virtue of the fact that child devices are registered | 303 | * is guaranteed by virtue of the fact that child devices are registered |
304 | * after their parents. | 304 | * after their parents. |
305 | */ | 305 | */ |
306 | |||
307 | void sysdev_shutdown(void) | 306 | void sysdev_shutdown(void) |
308 | { | 307 | { |
309 | struct sysdev_class * cls; | 308 | struct sysdev_class * cls; |
@@ -363,7 +362,6 @@ static void __sysdev_resume(struct sys_device *dev) | |||
363 | * This is only called by the device PM core, so we let them handle | 362 | * This is only called by the device PM core, so we let them handle |
364 | * all synchronization. | 363 | * all synchronization. |
365 | */ | 364 | */ |
366 | |||
367 | int sysdev_suspend(pm_message_t state) | 365 | int sysdev_suspend(pm_message_t state) |
368 | { | 366 | { |
369 | struct sysdev_class * cls; | 367 | struct sysdev_class * cls; |
@@ -432,7 +430,7 @@ aux_driver: | |||
432 | } | 430 | } |
433 | return ret; | 431 | return ret; |
434 | } | 432 | } |
435 | 433 | EXPORT_SYMBOL_GPL(sysdev_suspend); | |
436 | 434 | ||
437 | /** | 435 | /** |
438 | * sysdev_resume - Bring system devices back to life. | 436 | * sysdev_resume - Bring system devices back to life. |
@@ -442,7 +440,6 @@ aux_driver: | |||
442 | * | 440 | * |
443 | * Note: Interrupts are disabled when called. | 441 | * Note: Interrupts are disabled when called. |
444 | */ | 442 | */ |
445 | |||
446 | int sysdev_resume(void) | 443 | int sysdev_resume(void) |
447 | { | 444 | { |
448 | struct sysdev_class * cls; | 445 | struct sysdev_class * cls; |
@@ -463,7 +460,7 @@ int sysdev_resume(void) | |||
463 | } | 460 | } |
464 | return 0; | 461 | return 0; |
465 | } | 462 | } |
466 | 463 | EXPORT_SYMBOL_GPL(sysdev_resume); | |
467 | 464 | ||
468 | int __init system_bus_init(void) | 465 | int __init system_bus_init(void) |
469 | { | 466 | { |
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h index c237527b1aa5..5e41e6dd657b 100644 --- a/drivers/block/aoe/aoe.h +++ b/drivers/block/aoe/aoe.h | |||
@@ -18,6 +18,7 @@ | |||
18 | enum { | 18 | enum { |
19 | AOECMD_ATA, | 19 | AOECMD_ATA, |
20 | AOECMD_CFG, | 20 | AOECMD_CFG, |
21 | AOECMD_VEND_MIN = 0xf0, | ||
21 | 22 | ||
22 | AOEFL_RSP = (1<<3), | 23 | AOEFL_RSP = (1<<3), |
23 | AOEFL_ERR = (1<<2), | 24 | AOEFL_ERR = (1<<2), |
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c index 30de5b1c647e..c6099ba9a4b8 100644 --- a/drivers/block/aoe/aoenet.c +++ b/drivers/block/aoe/aoenet.c | |||
@@ -142,6 +142,8 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, | |||
142 | aoecmd_cfg_rsp(skb); | 142 | aoecmd_cfg_rsp(skb); |
143 | break; | 143 | break; |
144 | default: | 144 | default: |
145 | if (h->cmd >= AOECMD_VEND_MIN) | ||
146 | break; /* don't complain about vendor commands */ | ||
145 | printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd); | 147 | printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd); |
146 | } | 148 | } |
147 | exit: | 149 | exit: |
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index 69e1df7dfa14..4234c11c1e4c 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c | |||
@@ -1730,7 +1730,7 @@ static int __init fd_test_drive_present( int drive ) | |||
1730 | 1730 | ||
1731 | timeout = jiffies + 2*HZ+HZ/2; | 1731 | timeout = jiffies + 2*HZ+HZ/2; |
1732 | while (time_before(jiffies, timeout)) | 1732 | while (time_before(jiffies, timeout)) |
1733 | if (!(mfp.par_dt_reg & 0x20)) | 1733 | if (!(st_mfp.par_dt_reg & 0x20)) |
1734 | break; | 1734 | break; |
1735 | 1735 | ||
1736 | status = FDC_READ( FDCREG_STATUS ); | 1736 | status = FDC_READ( FDCREG_STATUS ); |
@@ -1747,7 +1747,7 @@ static int __init fd_test_drive_present( int drive ) | |||
1747 | /* dummy seek command to make WP bit accessible */ | 1747 | /* dummy seek command to make WP bit accessible */ |
1748 | FDC_WRITE( FDCREG_DATA, 0 ); | 1748 | FDC_WRITE( FDCREG_DATA, 0 ); |
1749 | FDC_WRITE( FDCREG_CMD, FDCCMD_SEEK ); | 1749 | FDC_WRITE( FDCREG_CMD, FDCCMD_SEEK ); |
1750 | while( mfp.par_dt_reg & 0x20 ) | 1750 | while( st_mfp.par_dt_reg & 0x20 ) |
1751 | ; | 1751 | ; |
1752 | status = FDC_READ( FDCREG_STATUS ); | 1752 | status = FDC_READ( FDCREG_STATUS ); |
1753 | } | 1753 | } |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 01e69383d9c0..d2cb67b61176 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -3390,6 +3390,203 @@ static void free_hba(int i) | |||
3390 | kfree(p); | 3390 | kfree(p); |
3391 | } | 3391 | } |
3392 | 3392 | ||
3393 | /* Send a message CDB to the firmware. */ | ||
3394 | static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, unsigned char type) | ||
3395 | { | ||
3396 | typedef struct { | ||
3397 | CommandListHeader_struct CommandHeader; | ||
3398 | RequestBlock_struct Request; | ||
3399 | ErrDescriptor_struct ErrorDescriptor; | ||
3400 | } Command; | ||
3401 | static const size_t cmd_sz = sizeof(Command) + sizeof(ErrorInfo_struct); | ||
3402 | Command *cmd; | ||
3403 | dma_addr_t paddr64; | ||
3404 | uint32_t paddr32, tag; | ||
3405 | void __iomem *vaddr; | ||
3406 | int i, err; | ||
3407 | |||
3408 | vaddr = ioremap_nocache(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); | ||
3409 | if (vaddr == NULL) | ||
3410 | return -ENOMEM; | ||
3411 | |||
3412 | /* The Inbound Post Queue only accepts 32-bit physical addresses for the | ||
3413 | CCISS commands, so they must be allocated from the lower 4GiB of | ||
3414 | memory. */ | ||
3415 | err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); | ||
3416 | if (err) { | ||
3417 | iounmap(vaddr); | ||
3418 | return -ENOMEM; | ||
3419 | } | ||
3420 | |||
3421 | cmd = pci_alloc_consistent(pdev, cmd_sz, &paddr64); | ||
3422 | if (cmd == NULL) { | ||
3423 | iounmap(vaddr); | ||
3424 | return -ENOMEM; | ||
3425 | } | ||
3426 | |||
3427 | /* This must fit, because of the 32-bit consistent DMA mask. Also, | ||
3428 | although there's no guarantee, we assume that the address is at | ||
3429 | least 4-byte aligned (most likely, it's page-aligned). */ | ||
3430 | paddr32 = paddr64; | ||
3431 | |||
3432 | cmd->CommandHeader.ReplyQueue = 0; | ||
3433 | cmd->CommandHeader.SGList = 0; | ||
3434 | cmd->CommandHeader.SGTotal = 0; | ||
3435 | cmd->CommandHeader.Tag.lower = paddr32; | ||
3436 | cmd->CommandHeader.Tag.upper = 0; | ||
3437 | memset(&cmd->CommandHeader.LUN.LunAddrBytes, 0, 8); | ||
3438 | |||
3439 | cmd->Request.CDBLen = 16; | ||
3440 | cmd->Request.Type.Type = TYPE_MSG; | ||
3441 | cmd->Request.Type.Attribute = ATTR_HEADOFQUEUE; | ||
3442 | cmd->Request.Type.Direction = XFER_NONE; | ||
3443 | cmd->Request.Timeout = 0; /* Don't time out */ | ||
3444 | cmd->Request.CDB[0] = opcode; | ||
3445 | cmd->Request.CDB[1] = type; | ||
3446 | memset(&cmd->Request.CDB[2], 0, 14); /* the rest of the CDB is reserved */ | ||
3447 | |||
3448 | cmd->ErrorDescriptor.Addr.lower = paddr32 + sizeof(Command); | ||
3449 | cmd->ErrorDescriptor.Addr.upper = 0; | ||
3450 | cmd->ErrorDescriptor.Len = sizeof(ErrorInfo_struct); | ||
3451 | |||
3452 | writel(paddr32, vaddr + SA5_REQUEST_PORT_OFFSET); | ||
3453 | |||
3454 | for (i = 0; i < 10; i++) { | ||
3455 | tag = readl(vaddr + SA5_REPLY_PORT_OFFSET); | ||
3456 | if ((tag & ~3) == paddr32) | ||
3457 | break; | ||
3458 | schedule_timeout_uninterruptible(HZ); | ||
3459 | } | ||
3460 | |||
3461 | iounmap(vaddr); | ||
3462 | |||
3463 | /* we leak the DMA buffer here ... no choice since the controller could | ||
3464 | still complete the command. */ | ||
3465 | if (i == 10) { | ||
3466 | printk(KERN_ERR "cciss: controller message %02x:%02x timed out\n", | ||
3467 | opcode, type); | ||
3468 | return -ETIMEDOUT; | ||
3469 | } | ||
3470 | |||
3471 | pci_free_consistent(pdev, cmd_sz, cmd, paddr64); | ||
3472 | |||
3473 | if (tag & 2) { | ||
3474 | printk(KERN_ERR "cciss: controller message %02x:%02x failed\n", | ||
3475 | opcode, type); | ||
3476 | return -EIO; | ||
3477 | } | ||
3478 | |||
3479 | printk(KERN_INFO "cciss: controller message %02x:%02x succeeded\n", | ||
3480 | opcode, type); | ||
3481 | return 0; | ||
3482 | } | ||
3483 | |||
3484 | #define cciss_soft_reset_controller(p) cciss_message(p, 1, 0) | ||
3485 | #define cciss_noop(p) cciss_message(p, 3, 0) | ||
3486 | |||
3487 | static __devinit int cciss_reset_msi(struct pci_dev *pdev) | ||
3488 | { | ||
3489 | /* the #defines are stolen from drivers/pci/msi.h. */ | ||
3490 | #define msi_control_reg(base) (base + PCI_MSI_FLAGS) | ||
3491 | #define PCI_MSIX_FLAGS_ENABLE (1 << 15) | ||
3492 | |||
3493 | int pos; | ||
3494 | u16 control = 0; | ||
3495 | |||
3496 | pos = pci_find_capability(pdev, PCI_CAP_ID_MSI); | ||
3497 | if (pos) { | ||
3498 | pci_read_config_word(pdev, msi_control_reg(pos), &control); | ||
3499 | if (control & PCI_MSI_FLAGS_ENABLE) { | ||
3500 | printk(KERN_INFO "cciss: resetting MSI\n"); | ||
3501 | pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSI_FLAGS_ENABLE); | ||
3502 | } | ||
3503 | } | ||
3504 | |||
3505 | pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX); | ||
3506 | if (pos) { | ||
3507 | pci_read_config_word(pdev, msi_control_reg(pos), &control); | ||
3508 | if (control & PCI_MSIX_FLAGS_ENABLE) { | ||
3509 | printk(KERN_INFO "cciss: resetting MSI-X\n"); | ||
3510 | pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSIX_FLAGS_ENABLE); | ||
3511 | } | ||
3512 | } | ||
3513 | |||
3514 | return 0; | ||
3515 | } | ||
3516 | |||
3517 | /* This does a hard reset of the controller using PCI power management | ||
3518 | * states. */ | ||
3519 | static __devinit int cciss_hard_reset_controller(struct pci_dev *pdev) | ||
3520 | { | ||
3521 | u16 pmcsr, saved_config_space[32]; | ||
3522 | int i, pos; | ||
3523 | |||
3524 | printk(KERN_INFO "cciss: using PCI PM to reset controller\n"); | ||
3525 | |||
3526 | /* This is very nearly the same thing as | ||
3527 | |||
3528 | pci_save_state(pci_dev); | ||
3529 | pci_set_power_state(pci_dev, PCI_D3hot); | ||
3530 | pci_set_power_state(pci_dev, PCI_D0); | ||
3531 | pci_restore_state(pci_dev); | ||
3532 | |||
3533 | but we can't use these nice canned kernel routines on | ||
3534 | kexec, because they also check the MSI/MSI-X state in PCI | ||
3535 | configuration space and do the wrong thing when it is | ||
3536 | set/cleared. Also, the pci_save/restore_state functions | ||
3537 | violate the ordering requirements for restoring the | ||
3538 | configuration space from the CCISS document (see the | ||
3539 | comment below). So we roll our own .... */ | ||
3540 | |||
3541 | for (i = 0; i < 32; i++) | ||
3542 | pci_read_config_word(pdev, 2*i, &saved_config_space[i]); | ||
3543 | |||
3544 | pos = pci_find_capability(pdev, PCI_CAP_ID_PM); | ||
3545 | if (pos == 0) { | ||
3546 | printk(KERN_ERR "cciss_reset_controller: PCI PM not supported\n"); | ||
3547 | return -ENODEV; | ||
3548 | } | ||
3549 | |||
3550 | /* Quoting from the Open CISS Specification: "The Power | ||
3551 | * Management Control/Status Register (CSR) controls the power | ||
3552 | * state of the device. The normal operating state is D0, | ||
3553 | * CSR=00h. The software off state is D3, CSR=03h. To reset | ||
3554 | * the controller, place the interface device in D3 then to | ||
3555 | * D0, this causes a secondary PCI reset which will reset the | ||
3556 | * controller." */ | ||
3557 | |||
3558 | /* enter the D3hot power management state */ | ||
3559 | pci_read_config_word(pdev, pos + PCI_PM_CTRL, &pmcsr); | ||
3560 | pmcsr &= ~PCI_PM_CTRL_STATE_MASK; | ||
3561 | pmcsr |= PCI_D3hot; | ||
3562 | pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr); | ||
3563 | |||
3564 | schedule_timeout_uninterruptible(HZ >> 1); | ||
3565 | |||
3566 | /* enter the D0 power management state */ | ||
3567 | pmcsr &= ~PCI_PM_CTRL_STATE_MASK; | ||
3568 | pmcsr |= PCI_D0; | ||
3569 | pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr); | ||
3570 | |||
3571 | schedule_timeout_uninterruptible(HZ >> 1); | ||
3572 | |||
3573 | /* Restore the PCI configuration space. The Open CISS | ||
3574 | * Specification says, "Restore the PCI Configuration | ||
3575 | * Registers, offsets 00h through 60h. It is important to | ||
3576 | * restore the command register, 16-bits at offset 04h, | ||
3577 | * last. Do not restore the configuration status register, | ||
3578 | * 16-bits at offset 06h." Note that the offset is 2*i. */ | ||
3579 | for (i = 0; i < 32; i++) { | ||
3580 | if (i == 2 || i == 3) | ||
3581 | continue; | ||
3582 | pci_write_config_word(pdev, 2*i, saved_config_space[i]); | ||
3583 | } | ||
3584 | wmb(); | ||
3585 | pci_write_config_word(pdev, 4, saved_config_space[2]); | ||
3586 | |||
3587 | return 0; | ||
3588 | } | ||
3589 | |||
3393 | /* | 3590 | /* |
3394 | * This is it. Find all the controllers and register them. I really hate | 3591 | * This is it. Find all the controllers and register them. I really hate |
3395 | * stealing all these major device numbers. | 3592 | * stealing all these major device numbers. |
@@ -3404,6 +3601,24 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3404 | int dac, return_code; | 3601 | int dac, return_code; |
3405 | InquiryData_struct *inq_buff = NULL; | 3602 | InquiryData_struct *inq_buff = NULL; |
3406 | 3603 | ||
3604 | if (reset_devices) { | ||
3605 | /* Reset the controller with a PCI power-cycle */ | ||
3606 | if (cciss_hard_reset_controller(pdev) || cciss_reset_msi(pdev)) | ||
3607 | return -ENODEV; | ||
3608 | |||
3609 | /* Some devices (notably the HP Smart Array 5i Controller) | ||
3610 | need a little pause here */ | ||
3611 | schedule_timeout_uninterruptible(30*HZ); | ||
3612 | |||
3613 | /* Now try to get the controller to respond to a no-op */ | ||
3614 | for (i=0; i<12; i++) { | ||
3615 | if (cciss_noop(pdev) == 0) | ||
3616 | break; | ||
3617 | else | ||
3618 | printk("cciss: no-op failed%s\n", (i < 11 ? "; re-trying" : "")); | ||
3619 | } | ||
3620 | } | ||
3621 | |||
3407 | i = alloc_cciss_hba(); | 3622 | i = alloc_cciss_hba(); |
3408 | if (i < 0) | 3623 | if (i < 0) |
3409 | return -1; | 3624 | return -1; |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index cf29cc4e6ab7..83d8ed39433d 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -558,6 +558,8 @@ static void process_fd_request(void); | |||
558 | static void recalibrate_floppy(void); | 558 | static void recalibrate_floppy(void); |
559 | static void floppy_shutdown(unsigned long); | 559 | static void floppy_shutdown(unsigned long); |
560 | 560 | ||
561 | static int floppy_request_regions(int); | ||
562 | static void floppy_release_regions(int); | ||
561 | static int floppy_grab_irq_and_dma(void); | 563 | static int floppy_grab_irq_and_dma(void); |
562 | static void floppy_release_irq_and_dma(void); | 564 | static void floppy_release_irq_and_dma(void); |
563 | 565 | ||
@@ -4274,8 +4276,7 @@ static int __init floppy_init(void) | |||
4274 | FDCS->rawcmd = 2; | 4276 | FDCS->rawcmd = 2; |
4275 | if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) { | 4277 | if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) { |
4276 | /* free ioports reserved by floppy_grab_irq_and_dma() */ | 4278 | /* free ioports reserved by floppy_grab_irq_and_dma() */ |
4277 | release_region(FDCS->address + 2, 4); | 4279 | floppy_release_regions(fdc); |
4278 | release_region(FDCS->address + 7, 1); | ||
4279 | FDCS->address = -1; | 4280 | FDCS->address = -1; |
4280 | FDCS->version = FDC_NONE; | 4281 | FDCS->version = FDC_NONE; |
4281 | continue; | 4282 | continue; |
@@ -4284,8 +4285,7 @@ static int __init floppy_init(void) | |||
4284 | FDCS->version = get_fdc_version(); | 4285 | FDCS->version = get_fdc_version(); |
4285 | if (FDCS->version == FDC_NONE) { | 4286 | if (FDCS->version == FDC_NONE) { |
4286 | /* free ioports reserved by floppy_grab_irq_and_dma() */ | 4287 | /* free ioports reserved by floppy_grab_irq_and_dma() */ |
4287 | release_region(FDCS->address + 2, 4); | 4288 | floppy_release_regions(fdc); |
4288 | release_region(FDCS->address + 7, 1); | ||
4289 | FDCS->address = -1; | 4289 | FDCS->address = -1; |
4290 | continue; | 4290 | continue; |
4291 | } | 4291 | } |
@@ -4358,6 +4358,47 @@ out_put_disk: | |||
4358 | 4358 | ||
4359 | static DEFINE_SPINLOCK(floppy_usage_lock); | 4359 | static DEFINE_SPINLOCK(floppy_usage_lock); |
4360 | 4360 | ||
4361 | static const struct io_region { | ||
4362 | int offset; | ||
4363 | int size; | ||
4364 | } io_regions[] = { | ||
4365 | { 2, 1 }, | ||
4366 | /* address + 3 is sometimes reserved by pnp bios for motherboard */ | ||
4367 | { 4, 2 }, | ||
4368 | /* address + 6 is reserved, and may be taken by IDE. | ||
4369 | * Unfortunately, Adaptec doesn't know this :-(, */ | ||
4370 | { 7, 1 }, | ||
4371 | }; | ||
4372 | |||
4373 | static void floppy_release_allocated_regions(int fdc, const struct io_region *p) | ||
4374 | { | ||
4375 | while (p != io_regions) { | ||
4376 | p--; | ||
4377 | release_region(FDCS->address + p->offset, p->size); | ||
4378 | } | ||
4379 | } | ||
4380 | |||
4381 | #define ARRAY_END(X) (&((X)[ARRAY_SIZE(X)])) | ||
4382 | |||
4383 | static int floppy_request_regions(int fdc) | ||
4384 | { | ||
4385 | const struct io_region *p; | ||
4386 | |||
4387 | for (p = io_regions; p < ARRAY_END(io_regions); p++) { | ||
4388 | if (!request_region(FDCS->address + p->offset, p->size, "floppy")) { | ||
4389 | DPRINT("Floppy io-port 0x%04lx in use\n", FDCS->address + p->offset); | ||
4390 | floppy_release_allocated_regions(fdc, p); | ||
4391 | return -EBUSY; | ||
4392 | } | ||
4393 | } | ||
4394 | return 0; | ||
4395 | } | ||
4396 | |||
4397 | static void floppy_release_regions(int fdc) | ||
4398 | { | ||
4399 | floppy_release_allocated_regions(fdc, ARRAY_END(io_regions)); | ||
4400 | } | ||
4401 | |||
4361 | static int floppy_grab_irq_and_dma(void) | 4402 | static int floppy_grab_irq_and_dma(void) |
4362 | { | 4403 | { |
4363 | unsigned long flags; | 4404 | unsigned long flags; |
@@ -4399,18 +4440,8 @@ static int floppy_grab_irq_and_dma(void) | |||
4399 | 4440 | ||
4400 | for (fdc = 0; fdc < N_FDC; fdc++) { | 4441 | for (fdc = 0; fdc < N_FDC; fdc++) { |
4401 | if (FDCS->address != -1) { | 4442 | if (FDCS->address != -1) { |
4402 | if (!request_region(FDCS->address + 2, 4, "floppy")) { | 4443 | if (floppy_request_regions(fdc)) |
4403 | DPRINT("Floppy io-port 0x%04lx in use\n", | 4444 | goto cleanup; |
4404 | FDCS->address + 2); | ||
4405 | goto cleanup1; | ||
4406 | } | ||
4407 | if (!request_region(FDCS->address + 7, 1, "floppy DIR")) { | ||
4408 | DPRINT("Floppy io-port 0x%04lx in use\n", | ||
4409 | FDCS->address + 7); | ||
4410 | goto cleanup2; | ||
4411 | } | ||
4412 | /* address + 6 is reserved, and may be taken by IDE. | ||
4413 | * Unfortunately, Adaptec doesn't know this :-(, */ | ||
4414 | } | 4445 | } |
4415 | } | 4446 | } |
4416 | for (fdc = 0; fdc < N_FDC; fdc++) { | 4447 | for (fdc = 0; fdc < N_FDC; fdc++) { |
@@ -4432,15 +4463,11 @@ static int floppy_grab_irq_and_dma(void) | |||
4432 | fdc = 0; | 4463 | fdc = 0; |
4433 | irqdma_allocated = 1; | 4464 | irqdma_allocated = 1; |
4434 | return 0; | 4465 | return 0; |
4435 | cleanup2: | 4466 | cleanup: |
4436 | release_region(FDCS->address + 2, 4); | ||
4437 | cleanup1: | ||
4438 | fd_free_irq(); | 4467 | fd_free_irq(); |
4439 | fd_free_dma(); | 4468 | fd_free_dma(); |
4440 | while (--fdc >= 0) { | 4469 | while (--fdc >= 0) |
4441 | release_region(FDCS->address + 2, 4); | 4470 | floppy_release_regions(fdc); |
4442 | release_region(FDCS->address + 7, 1); | ||
4443 | } | ||
4444 | spin_lock_irqsave(&floppy_usage_lock, flags); | 4471 | spin_lock_irqsave(&floppy_usage_lock, flags); |
4445 | usage_count--; | 4472 | usage_count--; |
4446 | spin_unlock_irqrestore(&floppy_usage_lock, flags); | 4473 | spin_unlock_irqrestore(&floppy_usage_lock, flags); |
@@ -4501,10 +4528,8 @@ static void floppy_release_irq_and_dma(void) | |||
4501 | #endif | 4528 | #endif |
4502 | old_fdc = fdc; | 4529 | old_fdc = fdc; |
4503 | for (fdc = 0; fdc < N_FDC; fdc++) | 4530 | for (fdc = 0; fdc < N_FDC; fdc++) |
4504 | if (FDCS->address != -1) { | 4531 | if (FDCS->address != -1) |
4505 | release_region(FDCS->address + 2, 4); | 4532 | floppy_release_regions(fdc); |
4506 | release_region(FDCS->address + 7, 1); | ||
4507 | } | ||
4508 | fdc = old_fdc; | 4533 | fdc = old_fdc; |
4509 | } | 4534 | } |
4510 | 4535 | ||
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 9dfa27163001..c397b3ddba9b 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c | |||
@@ -422,7 +422,7 @@ static void xs(char *buf, char *targ, int len) | |||
422 | 422 | ||
423 | for (k = 0; k < len; k++) { | 423 | for (k = 0; k < len; k++) { |
424 | char c = *buf++; | 424 | char c = *buf++; |
425 | if (c != ' ' || c != l) | 425 | if (c != ' ' && c != l) |
426 | l = *targ++ = c; | 426 | l = *targ++ = c; |
427 | } | 427 | } |
428 | if (l == ' ') | 428 | if (l == ' ') |
diff --git a/drivers/char/scc.h b/drivers/char/scc.h index 93998f5baff5..341b1142bea8 100644 --- a/drivers/char/scc.h +++ b/drivers/char/scc.h | |||
@@ -387,7 +387,7 @@ struct scc_port { | |||
387 | /* The SCC needs 3.5 PCLK cycles recovery time between to register | 387 | /* The SCC needs 3.5 PCLK cycles recovery time between to register |
388 | * accesses. PCLK runs with 8 MHz on an Atari, so this delay is 3.5 * | 388 | * accesses. PCLK runs with 8 MHz on an Atari, so this delay is 3.5 * |
389 | * 125 ns = 437.5 ns. This is too short for udelay(). | 389 | * 125 ns = 437.5 ns. This is too short for udelay(). |
390 | * 10/16/95: A tstb mfp.par_dt_reg takes 600ns (sure?) and thus should be | 390 | * 10/16/95: A tstb st_mfp.par_dt_reg takes 600ns (sure?) and thus should be |
391 | * quite right | 391 | * quite right |
392 | */ | 392 | */ |
393 | 393 | ||
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index f146e90404fa..518f2a25d91e 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -1746,9 +1746,10 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd, | |||
1746 | sx_dprintk(SX_DEBUG_FIRMWARE, "returning type= %ld\n", rc); | 1746 | sx_dprintk(SX_DEBUG_FIRMWARE, "returning type= %ld\n", rc); |
1747 | break; | 1747 | break; |
1748 | case SXIO_DO_RAMTEST: | 1748 | case SXIO_DO_RAMTEST: |
1749 | if (sx_initialized) /* Already initialized: better not ramtest the board. */ | 1749 | if (sx_initialized) { /* Already initialized: better not ramtest the board. */ |
1750 | rc = -EPERM; | 1750 | rc = -EPERM; |
1751 | break; | 1751 | break; |
1752 | } | ||
1752 | if (IS_SX_BOARD(board)) { | 1753 | if (IS_SX_BOARD(board)) { |
1753 | rc = do_memtest(board, 0, 0x7000); | 1754 | rc = do_memtest(board, 0, 0x7000); |
1754 | if (!rc) | 1755 | if (!rc) |
@@ -1788,7 +1789,7 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd, | |||
1788 | nbytes - i : SX_CHUNK_SIZE)) { | 1789 | nbytes - i : SX_CHUNK_SIZE)) { |
1789 | kfree(tmp); | 1790 | kfree(tmp); |
1790 | rc = -EFAULT; | 1791 | rc = -EFAULT; |
1791 | break; | 1792 | goto out; |
1792 | } | 1793 | } |
1793 | memcpy_toio(board->base2 + offset + i, tmp, | 1794 | memcpy_toio(board->base2 + offset + i, tmp, |
1794 | (i + SX_CHUNK_SIZE > nbytes) ? | 1795 | (i + SX_CHUNK_SIZE > nbytes) ? |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index a58993011edb..280a9d263eb3 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -518,6 +518,7 @@ struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, v | |||
518 | dma_chan_name(chan), err); | 518 | dma_chan_name(chan), err); |
519 | else | 519 | else |
520 | break; | 520 | break; |
521 | chan->private = NULL; | ||
521 | chan = NULL; | 522 | chan = NULL; |
522 | } | 523 | } |
523 | } | 524 | } |
@@ -536,6 +537,7 @@ void dma_release_channel(struct dma_chan *chan) | |||
536 | WARN_ONCE(chan->client_count != 1, | 537 | WARN_ONCE(chan->client_count != 1, |
537 | "chan reference count %d != 1\n", chan->client_count); | 538 | "chan reference count %d != 1\n", chan->client_count); |
538 | dma_chan_put(chan); | 539 | dma_chan_put(chan); |
540 | chan->private = NULL; | ||
539 | mutex_unlock(&dma_list_mutex); | 541 | mutex_unlock(&dma_list_mutex); |
540 | } | 542 | } |
541 | EXPORT_SYMBOL_GPL(dma_release_channel); | 543 | EXPORT_SYMBOL_GPL(dma_release_channel); |
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index 6b702cc46b3d..a97c07eef7ec 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c | |||
@@ -560,7 +560,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, | |||
560 | unsigned long flags) | 560 | unsigned long flags) |
561 | { | 561 | { |
562 | struct dw_dma_chan *dwc = to_dw_dma_chan(chan); | 562 | struct dw_dma_chan *dwc = to_dw_dma_chan(chan); |
563 | struct dw_dma_slave *dws = dwc->dws; | 563 | struct dw_dma_slave *dws = chan->private; |
564 | struct dw_desc *prev; | 564 | struct dw_desc *prev; |
565 | struct dw_desc *first; | 565 | struct dw_desc *first; |
566 | u32 ctllo; | 566 | u32 ctllo; |
@@ -790,7 +790,7 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan) | |||
790 | cfghi = DWC_CFGH_FIFO_MODE; | 790 | cfghi = DWC_CFGH_FIFO_MODE; |
791 | cfglo = 0; | 791 | cfglo = 0; |
792 | 792 | ||
793 | dws = dwc->dws; | 793 | dws = chan->private; |
794 | if (dws) { | 794 | if (dws) { |
795 | /* | 795 | /* |
796 | * We need controller-specific data to set up slave | 796 | * We need controller-specific data to set up slave |
@@ -866,7 +866,6 @@ static void dwc_free_chan_resources(struct dma_chan *chan) | |||
866 | spin_lock_bh(&dwc->lock); | 866 | spin_lock_bh(&dwc->lock); |
867 | list_splice_init(&dwc->free_list, &list); | 867 | list_splice_init(&dwc->free_list, &list); |
868 | dwc->descs_allocated = 0; | 868 | dwc->descs_allocated = 0; |
869 | dwc->dws = NULL; | ||
870 | 869 | ||
871 | /* Disable interrupts */ | 870 | /* Disable interrupts */ |
872 | channel_clear_bit(dw, MASK.XFER, dwc->mask); | 871 | channel_clear_bit(dw, MASK.XFER, dwc->mask); |
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h index 00fdd187bb0c..b252b202c5cf 100644 --- a/drivers/dma/dw_dmac_regs.h +++ b/drivers/dma/dw_dmac_regs.h | |||
@@ -139,8 +139,6 @@ struct dw_dma_chan { | |||
139 | struct list_head queue; | 139 | struct list_head queue; |
140 | struct list_head free_list; | 140 | struct list_head free_list; |
141 | 141 | ||
142 | struct dw_dma_slave *dws; | ||
143 | |||
144 | unsigned int descs_allocated; | 142 | unsigned int descs_allocated; |
145 | }; | 143 | }; |
146 | 144 | ||
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c index 261b9aa3f248..05aa2d406ac6 100644 --- a/drivers/firmware/memmap.c +++ b/drivers/firmware/memmap.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/firmware/memmap.c | 2 | * linux/drivers/firmware/memmap.c |
3 | * Copyright (C) 2008 SUSE LINUX Products GmbH | 3 | * Copyright (C) 2008 SUSE LINUX Products GmbH |
4 | * by Bernhard Walle <bwalle@suse.de> | 4 | * by Bernhard Walle <bernhard.walle@gmx.de> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License v2.0 as published by | 7 | * it under the terms of the GNU General Public License v2.0 as published by |
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 4be3acbaaf9a..3a22eb9be378 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
@@ -80,18 +80,17 @@ config DRM_I915 | |||
80 | XFree86 4.4 and above. If unsure, build this and i830 as modules and | 80 | XFree86 4.4 and above. If unsure, build this and i830 as modules and |
81 | the X server will load the correct one. | 81 | the X server will load the correct one. |
82 | 82 | ||
83 | endchoice | ||
84 | |||
85 | config DRM_I915_KMS | 83 | config DRM_I915_KMS |
86 | bool "Enable modesetting on intel by default" | 84 | bool "Enable modesetting on intel by default" |
87 | depends on DRM_I915 | 85 | depends on DRM_I915 |
88 | help | 86 | help |
89 | Choose this option if you want kernel modesetting enabled by default, | 87 | Choose this option if you want kernel modesetting enabled by default, |
90 | and you have a new enough userspace to support this. Running old | 88 | and you have a new enough userspace to support this. Running old |
91 | userspaces with this enabled will cause pain. Note that this causes | 89 | userspaces with this enabled will cause pain. Note that this causes |
92 | the driver to bind to PCI devices, which precludes loading things | 90 | the driver to bind to PCI devices, which precludes loading things |
93 | like intelfb. | 91 | like intelfb. |
94 | 92 | ||
93 | endchoice | ||
95 | 94 | ||
96 | config DRM_MGA | 95 | config DRM_MGA |
97 | tristate "Matrox g200/g400" | 96 | tristate "Matrox g200/g400" |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index bfce0992fefb..94a768871734 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -1741,9 +1741,8 @@ out: | |||
1741 | * RETURNS: | 1741 | * RETURNS: |
1742 | * Zero on success, errno on failure. | 1742 | * Zero on success, errno on failure. |
1743 | */ | 1743 | */ |
1744 | void drm_fb_release(struct file *filp) | 1744 | void drm_fb_release(struct drm_file *priv) |
1745 | { | 1745 | { |
1746 | struct drm_file *priv = filp->private_data; | ||
1747 | struct drm_device *dev = priv->minor->dev; | 1746 | struct drm_device *dev = priv->minor->dev; |
1748 | struct drm_framebuffer *fb, *tfb; | 1747 | struct drm_framebuffer *fb, *tfb; |
1749 | 1748 | ||
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 964c5eb1fada..733028b4d45e 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -512,8 +512,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | |||
512 | if (drm_mode_equal(&saved_mode, &crtc->mode)) { | 512 | if (drm_mode_equal(&saved_mode, &crtc->mode)) { |
513 | if (saved_x != crtc->x || saved_y != crtc->y || | 513 | if (saved_x != crtc->x || saved_y != crtc->y || |
514 | depth_changed || bpp_changed) { | 514 | depth_changed || bpp_changed) { |
515 | crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, | 515 | ret = !crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, |
516 | old_fb); | 516 | old_fb); |
517 | goto done; | 517 | goto done; |
518 | } | 518 | } |
519 | } | 519 | } |
@@ -552,7 +552,9 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | |||
552 | /* Set up the DPLL and any encoders state that needs to adjust or depend | 552 | /* Set up the DPLL and any encoders state that needs to adjust or depend |
553 | * on the DPLL. | 553 | * on the DPLL. |
554 | */ | 554 | */ |
555 | crtc_funcs->mode_set(crtc, mode, adjusted_mode, x, y, old_fb); | 555 | ret = !crtc_funcs->mode_set(crtc, mode, adjusted_mode, x, y, old_fb); |
556 | if (!ret) | ||
557 | goto done; | ||
556 | 558 | ||
557 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | 559 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { |
558 | 560 | ||
@@ -752,6 +754,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
752 | if (!drm_crtc_helper_set_mode(set->crtc, set->mode, | 754 | if (!drm_crtc_helper_set_mode(set->crtc, set->mode, |
753 | set->x, set->y, | 755 | set->x, set->y, |
754 | old_fb)) { | 756 | old_fb)) { |
757 | DRM_ERROR("failed to set mode on crtc %p\n", | ||
758 | set->crtc); | ||
755 | ret = -EINVAL; | 759 | ret = -EINVAL; |
756 | goto fail_set_mode; | 760 | goto fail_set_mode; |
757 | } | 761 | } |
@@ -765,7 +769,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
765 | old_fb = set->crtc->fb; | 769 | old_fb = set->crtc->fb; |
766 | if (set->crtc->fb != set->fb) | 770 | if (set->crtc->fb != set->fb) |
767 | set->crtc->fb = set->fb; | 771 | set->crtc->fb = set->fb; |
768 | crtc_funcs->mode_set_base(set->crtc, set->x, set->y, old_fb); | 772 | ret = crtc_funcs->mode_set_base(set->crtc, |
773 | set->x, set->y, old_fb); | ||
774 | if (ret != 0) | ||
775 | goto fail_set_mode; | ||
769 | } | 776 | } |
770 | 777 | ||
771 | kfree(save_encoders); | 778 | kfree(save_encoders); |
@@ -775,8 +782,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
775 | fail_set_mode: | 782 | fail_set_mode: |
776 | set->crtc->enabled = save_enabled; | 783 | set->crtc->enabled = save_enabled; |
777 | count = 0; | 784 | count = 0; |
778 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) | 785 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
786 | if (!connector->encoder) | ||
787 | continue; | ||
788 | |||
779 | connector->encoder->crtc = save_crtcs[count++]; | 789 | connector->encoder->crtc = save_crtcs[count++]; |
790 | } | ||
780 | fail_no_encoder: | 791 | fail_no_encoder: |
781 | kfree(save_crtcs); | 792 | kfree(save_crtcs); |
782 | count = 0; | 793 | count = 0; |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index b06a53715853..6c020fe5431c 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -457,6 +457,9 @@ int drm_release(struct inode *inode, struct file *filp) | |||
457 | if (dev->driver->driver_features & DRIVER_GEM) | 457 | if (dev->driver->driver_features & DRIVER_GEM) |
458 | drm_gem_release(dev, file_priv); | 458 | drm_gem_release(dev, file_priv); |
459 | 459 | ||
460 | if (dev->driver->driver_features & DRIVER_MODESET) | ||
461 | drm_fb_release(file_priv); | ||
462 | |||
460 | mutex_lock(&dev->ctxlist_mutex); | 463 | mutex_lock(&dev->ctxlist_mutex); |
461 | if (!list_empty(&dev->ctxlist)) { | 464 | if (!list_empty(&dev->ctxlist)) { |
462 | struct drm_ctx_list *pos, *n; | 465 | struct drm_ctx_list *pos, *n; |
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 6915fb82d0b0..88d3368ffddd 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -104,8 +104,8 @@ drm_gem_init(struct drm_device *dev) | |||
104 | 104 | ||
105 | if (drm_mm_init(&mm->offset_manager, DRM_FILE_PAGE_OFFSET_START, | 105 | if (drm_mm_init(&mm->offset_manager, DRM_FILE_PAGE_OFFSET_START, |
106 | DRM_FILE_PAGE_OFFSET_SIZE)) { | 106 | DRM_FILE_PAGE_OFFSET_SIZE)) { |
107 | drm_free(mm, sizeof(struct drm_gem_mm), DRM_MEM_MM); | ||
108 | drm_ht_remove(&mm->offset_hash); | 107 | drm_ht_remove(&mm->offset_hash); |
108 | drm_free(mm, sizeof(struct drm_gem_mm), DRM_MEM_MM); | ||
109 | return -ENOMEM; | 109 | return -ENOMEM; |
110 | } | 110 | } |
111 | 111 | ||
@@ -295,35 +295,37 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, | |||
295 | return -EBADF; | 295 | return -EBADF; |
296 | 296 | ||
297 | again: | 297 | again: |
298 | if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0) | 298 | if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0) { |
299 | return -ENOMEM; | 299 | ret = -ENOMEM; |
300 | goto err; | ||
301 | } | ||
300 | 302 | ||
301 | spin_lock(&dev->object_name_lock); | 303 | spin_lock(&dev->object_name_lock); |
302 | if (obj->name) { | 304 | if (!obj->name) { |
303 | args->name = obj->name; | 305 | ret = idr_get_new_above(&dev->object_name_idr, obj, 1, |
306 | &obj->name); | ||
307 | args->name = (uint64_t) obj->name; | ||
304 | spin_unlock(&dev->object_name_lock); | 308 | spin_unlock(&dev->object_name_lock); |
305 | return 0; | ||
306 | } | ||
307 | ret = idr_get_new_above(&dev->object_name_idr, obj, 1, | ||
308 | &obj->name); | ||
309 | spin_unlock(&dev->object_name_lock); | ||
310 | if (ret == -EAGAIN) | ||
311 | goto again; | ||
312 | 309 | ||
313 | if (ret != 0) { | 310 | if (ret == -EAGAIN) |
314 | mutex_lock(&dev->struct_mutex); | 311 | goto again; |
315 | drm_gem_object_unreference(obj); | ||
316 | mutex_unlock(&dev->struct_mutex); | ||
317 | return ret; | ||
318 | } | ||
319 | 312 | ||
320 | /* | 313 | if (ret != 0) |
321 | * Leave the reference from the lookup around as the | 314 | goto err; |
322 | * name table now holds one | ||
323 | */ | ||
324 | args->name = (uint64_t) obj->name; | ||
325 | 315 | ||
326 | return 0; | 316 | /* Allocate a reference for the name table. */ |
317 | drm_gem_object_reference(obj); | ||
318 | } else { | ||
319 | args->name = (uint64_t) obj->name; | ||
320 | spin_unlock(&dev->object_name_lock); | ||
321 | ret = 0; | ||
322 | } | ||
323 | |||
324 | err: | ||
325 | mutex_lock(&dev->struct_mutex); | ||
326 | drm_gem_object_unreference(obj); | ||
327 | mutex_unlock(&dev->struct_mutex); | ||
328 | return ret; | ||
327 | } | 329 | } |
328 | 330 | ||
329 | /** | 331 | /** |
@@ -448,6 +450,7 @@ drm_gem_object_handle_free(struct kref *kref) | |||
448 | spin_lock(&dev->object_name_lock); | 450 | spin_lock(&dev->object_name_lock); |
449 | if (obj->name) { | 451 | if (obj->name) { |
450 | idr_remove(&dev->object_name_idr, obj->name); | 452 | idr_remove(&dev->object_name_idr, obj->name); |
453 | obj->name = 0; | ||
451 | spin_unlock(&dev->object_name_lock); | 454 | spin_unlock(&dev->object_name_lock); |
452 | /* | 455 | /* |
453 | * The object name held a reference to this object, drop | 456 | * The object name held a reference to this object, drop |
@@ -460,6 +463,26 @@ drm_gem_object_handle_free(struct kref *kref) | |||
460 | } | 463 | } |
461 | EXPORT_SYMBOL(drm_gem_object_handle_free); | 464 | EXPORT_SYMBOL(drm_gem_object_handle_free); |
462 | 465 | ||
466 | void drm_gem_vm_open(struct vm_area_struct *vma) | ||
467 | { | ||
468 | struct drm_gem_object *obj = vma->vm_private_data; | ||
469 | |||
470 | drm_gem_object_reference(obj); | ||
471 | } | ||
472 | EXPORT_SYMBOL(drm_gem_vm_open); | ||
473 | |||
474 | void drm_gem_vm_close(struct vm_area_struct *vma) | ||
475 | { | ||
476 | struct drm_gem_object *obj = vma->vm_private_data; | ||
477 | struct drm_device *dev = obj->dev; | ||
478 | |||
479 | mutex_lock(&dev->struct_mutex); | ||
480 | drm_gem_object_unreference(obj); | ||
481 | mutex_unlock(&dev->struct_mutex); | ||
482 | } | ||
483 | EXPORT_SYMBOL(drm_gem_vm_close); | ||
484 | |||
485 | |||
463 | /** | 486 | /** |
464 | * drm_gem_mmap - memory map routine for GEM objects | 487 | * drm_gem_mmap - memory map routine for GEM objects |
465 | * @filp: DRM file pointer | 488 | * @filp: DRM file pointer |
@@ -521,6 +544,14 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) | |||
521 | #endif | 544 | #endif |
522 | vma->vm_page_prot = __pgprot(prot); | 545 | vma->vm_page_prot = __pgprot(prot); |
523 | 546 | ||
547 | /* Take a ref for this mapping of the object, so that the fault | ||
548 | * handler can dereference the mmap offset's pointer to the object. | ||
549 | * This reference is cleaned up by the corresponding vm_close | ||
550 | * (which should happen whether the vma was created by this call, or | ||
551 | * by a vm_open due to mremap or partial unmap or whatever). | ||
552 | */ | ||
553 | drm_gem_object_reference(obj); | ||
554 | |||
524 | vma->vm_file = filp; /* Needed for drm_vm_open() */ | 555 | vma->vm_file = filp; /* Needed for drm_vm_open() */ |
525 | drm_vm_open_locked(vma); | 556 | drm_vm_open_locked(vma); |
526 | 557 | ||
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 81f1cff56fd5..2d797ffe8137 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -202,7 +202,7 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init) | |||
202 | dev_priv->ring.map.flags = 0; | 202 | dev_priv->ring.map.flags = 0; |
203 | dev_priv->ring.map.mtrr = 0; | 203 | dev_priv->ring.map.mtrr = 0; |
204 | 204 | ||
205 | drm_core_ioremap(&dev_priv->ring.map, dev); | 205 | drm_core_ioremap_wc(&dev_priv->ring.map, dev); |
206 | 206 | ||
207 | if (dev_priv->ring.map.handle == NULL) { | 207 | if (dev_priv->ring.map.handle == NULL) { |
208 | i915_dma_cleanup(dev); | 208 | i915_dma_cleanup(dev); |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index aac12ee31a46..0692622ee2b3 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -27,6 +27,7 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/device.h> | ||
30 | #include "drmP.h" | 31 | #include "drmP.h" |
31 | #include "drm.h" | 32 | #include "drm.h" |
32 | #include "i915_drm.h" | 33 | #include "i915_drm.h" |
@@ -66,6 +67,12 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) | |||
66 | 67 | ||
67 | i915_save_state(dev); | 68 | i915_save_state(dev); |
68 | 69 | ||
70 | /* If KMS is active, we do the leavevt stuff here */ | ||
71 | if (drm_core_check_feature(dev, DRIVER_MODESET) && i915_gem_idle(dev)) { | ||
72 | dev_err(&dev->pdev->dev, "GEM idle failed, aborting suspend\n"); | ||
73 | return -EBUSY; | ||
74 | } | ||
75 | |||
69 | intel_opregion_free(dev); | 76 | intel_opregion_free(dev); |
70 | 77 | ||
71 | if (state.event == PM_EVENT_SUSPEND) { | 78 | if (state.event == PM_EVENT_SUSPEND) { |
@@ -79,6 +86,9 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) | |||
79 | 86 | ||
80 | static int i915_resume(struct drm_device *dev) | 87 | static int i915_resume(struct drm_device *dev) |
81 | { | 88 | { |
89 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
90 | int ret = 0; | ||
91 | |||
82 | pci_set_power_state(dev->pdev, PCI_D0); | 92 | pci_set_power_state(dev->pdev, PCI_D0); |
83 | pci_restore_state(dev->pdev); | 93 | pci_restore_state(dev->pdev); |
84 | if (pci_enable_device(dev->pdev)) | 94 | if (pci_enable_device(dev->pdev)) |
@@ -89,11 +99,24 @@ static int i915_resume(struct drm_device *dev) | |||
89 | 99 | ||
90 | intel_opregion_init(dev); | 100 | intel_opregion_init(dev); |
91 | 101 | ||
92 | return 0; | 102 | /* KMS EnterVT equivalent */ |
103 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | ||
104 | mutex_lock(&dev->struct_mutex); | ||
105 | dev_priv->mm.suspended = 0; | ||
106 | |||
107 | ret = i915_gem_init_ringbuffer(dev); | ||
108 | if (ret != 0) | ||
109 | ret = -1; | ||
110 | mutex_unlock(&dev->struct_mutex); | ||
111 | } | ||
112 | |||
113 | return ret; | ||
93 | } | 114 | } |
94 | 115 | ||
95 | static struct vm_operations_struct i915_gem_vm_ops = { | 116 | static struct vm_operations_struct i915_gem_vm_ops = { |
96 | .fault = i915_gem_fault, | 117 | .fault = i915_gem_fault, |
118 | .open = drm_gem_vm_open, | ||
119 | .close = drm_gem_vm_close, | ||
97 | }; | 120 | }; |
98 | 121 | ||
99 | static struct drm_driver driver = { | 122 | static struct drm_driver driver = { |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 7325363164f8..17fa40858d26 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -184,6 +184,8 @@ typedef struct drm_i915_private { | |||
184 | unsigned int lvds_dither:1; | 184 | unsigned int lvds_dither:1; |
185 | unsigned int lvds_vbt:1; | 185 | unsigned int lvds_vbt:1; |
186 | unsigned int int_crt_support:1; | 186 | unsigned int int_crt_support:1; |
187 | unsigned int lvds_use_ssc:1; | ||
188 | int lvds_ssc_freq; | ||
187 | 189 | ||
188 | struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */ | 190 | struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */ |
189 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ | 191 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ |
@@ -616,6 +618,7 @@ int i915_gem_init_ringbuffer(struct drm_device *dev); | |||
616 | void i915_gem_cleanup_ringbuffer(struct drm_device *dev); | 618 | void i915_gem_cleanup_ringbuffer(struct drm_device *dev); |
617 | int i915_gem_do_init(struct drm_device *dev, unsigned long start, | 619 | int i915_gem_do_init(struct drm_device *dev, unsigned long start, |
618 | unsigned long end); | 620 | unsigned long end); |
621 | int i915_gem_idle(struct drm_device *dev); | ||
619 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); | 622 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); |
620 | int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, | 623 | int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, |
621 | int write); | 624 | int write); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 818576654092..25b337438ca7 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -34,10 +34,6 @@ | |||
34 | 34 | ||
35 | #define I915_GEM_GPU_DOMAINS (~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT)) | 35 | #define I915_GEM_GPU_DOMAINS (~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT)) |
36 | 36 | ||
37 | static void | ||
38 | i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj, | ||
39 | uint32_t read_domains, | ||
40 | uint32_t write_domain); | ||
41 | static void i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj); | 37 | static void i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj); |
42 | static void i915_gem_object_flush_gtt_write_domain(struct drm_gem_object *obj); | 38 | static void i915_gem_object_flush_gtt_write_domain(struct drm_gem_object *obj); |
43 | static void i915_gem_object_flush_cpu_write_domain(struct drm_gem_object *obj); | 39 | static void i915_gem_object_flush_cpu_write_domain(struct drm_gem_object *obj); |
@@ -607,8 +603,6 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
607 | case -EAGAIN: | 603 | case -EAGAIN: |
608 | return VM_FAULT_OOM; | 604 | return VM_FAULT_OOM; |
609 | case -EFAULT: | 605 | case -EFAULT: |
610 | case -EBUSY: | ||
611 | DRM_ERROR("can't insert pfn?? fault or busy...\n"); | ||
612 | return VM_FAULT_SIGBUS; | 606 | return VM_FAULT_SIGBUS; |
613 | default: | 607 | default: |
614 | return VM_FAULT_NOPAGE; | 608 | return VM_FAULT_NOPAGE; |
@@ -684,6 +678,30 @@ out_free_list: | |||
684 | return ret; | 678 | return ret; |
685 | } | 679 | } |
686 | 680 | ||
681 | static void | ||
682 | i915_gem_free_mmap_offset(struct drm_gem_object *obj) | ||
683 | { | ||
684 | struct drm_device *dev = obj->dev; | ||
685 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | ||
686 | struct drm_gem_mm *mm = dev->mm_private; | ||
687 | struct drm_map_list *list; | ||
688 | |||
689 | list = &obj->map_list; | ||
690 | drm_ht_remove_item(&mm->offset_hash, &list->hash); | ||
691 | |||
692 | if (list->file_offset_node) { | ||
693 | drm_mm_put_block(list->file_offset_node); | ||
694 | list->file_offset_node = NULL; | ||
695 | } | ||
696 | |||
697 | if (list->map) { | ||
698 | drm_free(list->map, sizeof(struct drm_map), DRM_MEM_DRIVER); | ||
699 | list->map = NULL; | ||
700 | } | ||
701 | |||
702 | obj_priv->mmap_offset = 0; | ||
703 | } | ||
704 | |||
687 | /** | 705 | /** |
688 | * i915_gem_get_gtt_alignment - return required GTT alignment for an object | 706 | * i915_gem_get_gtt_alignment - return required GTT alignment for an object |
689 | * @obj: object to check | 707 | * @obj: object to check |
@@ -758,8 +776,11 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, | |||
758 | 776 | ||
759 | if (!obj_priv->mmap_offset) { | 777 | if (!obj_priv->mmap_offset) { |
760 | ret = i915_gem_create_mmap_offset(obj); | 778 | ret = i915_gem_create_mmap_offset(obj); |
761 | if (ret) | 779 | if (ret) { |
780 | drm_gem_object_unreference(obj); | ||
781 | mutex_unlock(&dev->struct_mutex); | ||
762 | return ret; | 782 | return ret; |
783 | } | ||
763 | } | 784 | } |
764 | 785 | ||
765 | args->offset = obj_priv->mmap_offset; | 786 | args->offset = obj_priv->mmap_offset; |
@@ -1996,30 +2017,28 @@ i915_gem_object_set_to_cpu_domain(struct drm_gem_object *obj, int write) | |||
1996 | * drm_agp_chipset_flush | 2017 | * drm_agp_chipset_flush |
1997 | */ | 2018 | */ |
1998 | static void | 2019 | static void |
1999 | i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj, | 2020 | i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj) |
2000 | uint32_t read_domains, | ||
2001 | uint32_t write_domain) | ||
2002 | { | 2021 | { |
2003 | struct drm_device *dev = obj->dev; | 2022 | struct drm_device *dev = obj->dev; |
2004 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | 2023 | struct drm_i915_gem_object *obj_priv = obj->driver_private; |
2005 | uint32_t invalidate_domains = 0; | 2024 | uint32_t invalidate_domains = 0; |
2006 | uint32_t flush_domains = 0; | 2025 | uint32_t flush_domains = 0; |
2007 | 2026 | ||
2008 | BUG_ON(read_domains & I915_GEM_DOMAIN_CPU); | 2027 | BUG_ON(obj->pending_read_domains & I915_GEM_DOMAIN_CPU); |
2009 | BUG_ON(write_domain == I915_GEM_DOMAIN_CPU); | 2028 | BUG_ON(obj->pending_write_domain == I915_GEM_DOMAIN_CPU); |
2010 | 2029 | ||
2011 | #if WATCH_BUF | 2030 | #if WATCH_BUF |
2012 | DRM_INFO("%s: object %p read %08x -> %08x write %08x -> %08x\n", | 2031 | DRM_INFO("%s: object %p read %08x -> %08x write %08x -> %08x\n", |
2013 | __func__, obj, | 2032 | __func__, obj, |
2014 | obj->read_domains, read_domains, | 2033 | obj->read_domains, obj->pending_read_domains, |
2015 | obj->write_domain, write_domain); | 2034 | obj->write_domain, obj->pending_write_domain); |
2016 | #endif | 2035 | #endif |
2017 | /* | 2036 | /* |
2018 | * If the object isn't moving to a new write domain, | 2037 | * If the object isn't moving to a new write domain, |
2019 | * let the object stay in multiple read domains | 2038 | * let the object stay in multiple read domains |
2020 | */ | 2039 | */ |
2021 | if (write_domain == 0) | 2040 | if (obj->pending_write_domain == 0) |
2022 | read_domains |= obj->read_domains; | 2041 | obj->pending_read_domains |= obj->read_domains; |
2023 | else | 2042 | else |
2024 | obj_priv->dirty = 1; | 2043 | obj_priv->dirty = 1; |
2025 | 2044 | ||
@@ -2029,15 +2048,17 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj, | |||
2029 | * any read domains which differ from the old | 2048 | * any read domains which differ from the old |
2030 | * write domain | 2049 | * write domain |
2031 | */ | 2050 | */ |
2032 | if (obj->write_domain && obj->write_domain != read_domains) { | 2051 | if (obj->write_domain && |
2052 | obj->write_domain != obj->pending_read_domains) { | ||
2033 | flush_domains |= obj->write_domain; | 2053 | flush_domains |= obj->write_domain; |
2034 | invalidate_domains |= read_domains & ~obj->write_domain; | 2054 | invalidate_domains |= |
2055 | obj->pending_read_domains & ~obj->write_domain; | ||
2035 | } | 2056 | } |
2036 | /* | 2057 | /* |
2037 | * Invalidate any read caches which may have | 2058 | * Invalidate any read caches which may have |
2038 | * stale data. That is, any new read domains. | 2059 | * stale data. That is, any new read domains. |
2039 | */ | 2060 | */ |
2040 | invalidate_domains |= read_domains & ~obj->read_domains; | 2061 | invalidate_domains |= obj->pending_read_domains & ~obj->read_domains; |
2041 | if ((flush_domains | invalidate_domains) & I915_GEM_DOMAIN_CPU) { | 2062 | if ((flush_domains | invalidate_domains) & I915_GEM_DOMAIN_CPU) { |
2042 | #if WATCH_BUF | 2063 | #if WATCH_BUF |
2043 | DRM_INFO("%s: CPU domain flush %08x invalidate %08x\n", | 2064 | DRM_INFO("%s: CPU domain flush %08x invalidate %08x\n", |
@@ -2046,9 +2067,15 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj, | |||
2046 | i915_gem_clflush_object(obj); | 2067 | i915_gem_clflush_object(obj); |
2047 | } | 2068 | } |
2048 | 2069 | ||
2049 | if ((write_domain | flush_domains) != 0) | 2070 | /* The actual obj->write_domain will be updated with |
2050 | obj->write_domain = write_domain; | 2071 | * pending_write_domain after we emit the accumulated flush for all |
2051 | obj->read_domains = read_domains; | 2072 | * of our domain changes in execbuffers (which clears objects' |
2073 | * write_domains). So if we have a current write domain that we | ||
2074 | * aren't changing, set pending_write_domain to that. | ||
2075 | */ | ||
2076 | if (flush_domains == 0 && obj->pending_write_domain == 0) | ||
2077 | obj->pending_write_domain = obj->write_domain; | ||
2078 | obj->read_domains = obj->pending_read_domains; | ||
2052 | 2079 | ||
2053 | dev->invalidate_domains |= invalidate_domains; | 2080 | dev->invalidate_domains |= invalidate_domains; |
2054 | dev->flush_domains |= flush_domains; | 2081 | dev->flush_domains |= flush_domains; |
@@ -2251,6 +2278,8 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | |||
2251 | (int) reloc.offset, | 2278 | (int) reloc.offset, |
2252 | reloc.read_domains, | 2279 | reloc.read_domains, |
2253 | reloc.write_domain); | 2280 | reloc.write_domain); |
2281 | drm_gem_object_unreference(target_obj); | ||
2282 | i915_gem_object_unpin(obj); | ||
2254 | return -EINVAL; | 2283 | return -EINVAL; |
2255 | } | 2284 | } |
2256 | 2285 | ||
@@ -2480,13 +2509,15 @@ i915_gem_execbuffer(struct drm_device *dev, void *data, | |||
2480 | if (dev_priv->mm.wedged) { | 2509 | if (dev_priv->mm.wedged) { |
2481 | DRM_ERROR("Execbuf while wedged\n"); | 2510 | DRM_ERROR("Execbuf while wedged\n"); |
2482 | mutex_unlock(&dev->struct_mutex); | 2511 | mutex_unlock(&dev->struct_mutex); |
2483 | return -EIO; | 2512 | ret = -EIO; |
2513 | goto pre_mutex_err; | ||
2484 | } | 2514 | } |
2485 | 2515 | ||
2486 | if (dev_priv->mm.suspended) { | 2516 | if (dev_priv->mm.suspended) { |
2487 | DRM_ERROR("Execbuf while VT-switched.\n"); | 2517 | DRM_ERROR("Execbuf while VT-switched.\n"); |
2488 | mutex_unlock(&dev->struct_mutex); | 2518 | mutex_unlock(&dev->struct_mutex); |
2489 | return -EBUSY; | 2519 | ret = -EBUSY; |
2520 | goto pre_mutex_err; | ||
2490 | } | 2521 | } |
2491 | 2522 | ||
2492 | /* Look up object handles */ | 2523 | /* Look up object handles */ |
@@ -2554,9 +2585,7 @@ i915_gem_execbuffer(struct drm_device *dev, void *data, | |||
2554 | struct drm_gem_object *obj = object_list[i]; | 2585 | struct drm_gem_object *obj = object_list[i]; |
2555 | 2586 | ||
2556 | /* Compute new gpu domains and update invalidate/flush */ | 2587 | /* Compute new gpu domains and update invalidate/flush */ |
2557 | i915_gem_object_set_to_gpu_domain(obj, | 2588 | i915_gem_object_set_to_gpu_domain(obj); |
2558 | obj->pending_read_domains, | ||
2559 | obj->pending_write_domain); | ||
2560 | } | 2589 | } |
2561 | 2590 | ||
2562 | i915_verify_inactive(dev, __FILE__, __LINE__); | 2591 | i915_verify_inactive(dev, __FILE__, __LINE__); |
@@ -2575,6 +2604,12 @@ i915_gem_execbuffer(struct drm_device *dev, void *data, | |||
2575 | (void)i915_add_request(dev, dev->flush_domains); | 2604 | (void)i915_add_request(dev, dev->flush_domains); |
2576 | } | 2605 | } |
2577 | 2606 | ||
2607 | for (i = 0; i < args->buffer_count; i++) { | ||
2608 | struct drm_gem_object *obj = object_list[i]; | ||
2609 | |||
2610 | obj->write_domain = obj->pending_write_domain; | ||
2611 | } | ||
2612 | |||
2578 | i915_verify_inactive(dev, __FILE__, __LINE__); | 2613 | i915_verify_inactive(dev, __FILE__, __LINE__); |
2579 | 2614 | ||
2580 | #if WATCH_COHERENCY | 2615 | #if WATCH_COHERENCY |
@@ -2632,15 +2667,6 @@ i915_gem_execbuffer(struct drm_device *dev, void *data, | |||
2632 | 2667 | ||
2633 | i915_verify_inactive(dev, __FILE__, __LINE__); | 2668 | i915_verify_inactive(dev, __FILE__, __LINE__); |
2634 | 2669 | ||
2635 | /* Copy the new buffer offsets back to the user's exec list. */ | ||
2636 | ret = copy_to_user((struct drm_i915_relocation_entry __user *) | ||
2637 | (uintptr_t) args->buffers_ptr, | ||
2638 | exec_list, | ||
2639 | sizeof(*exec_list) * args->buffer_count); | ||
2640 | if (ret) | ||
2641 | DRM_ERROR("failed to copy %d exec entries " | ||
2642 | "back to user (%d)\n", | ||
2643 | args->buffer_count, ret); | ||
2644 | err: | 2670 | err: |
2645 | for (i = 0; i < pinned; i++) | 2671 | for (i = 0; i < pinned; i++) |
2646 | i915_gem_object_unpin(object_list[i]); | 2672 | i915_gem_object_unpin(object_list[i]); |
@@ -2650,6 +2676,18 @@ err: | |||
2650 | 2676 | ||
2651 | mutex_unlock(&dev->struct_mutex); | 2677 | mutex_unlock(&dev->struct_mutex); |
2652 | 2678 | ||
2679 | if (!ret) { | ||
2680 | /* Copy the new buffer offsets back to the user's exec list. */ | ||
2681 | ret = copy_to_user((struct drm_i915_relocation_entry __user *) | ||
2682 | (uintptr_t) args->buffers_ptr, | ||
2683 | exec_list, | ||
2684 | sizeof(*exec_list) * args->buffer_count); | ||
2685 | if (ret) | ||
2686 | DRM_ERROR("failed to copy %d exec entries " | ||
2687 | "back to user (%d)\n", | ||
2688 | args->buffer_count, ret); | ||
2689 | } | ||
2690 | |||
2653 | pre_mutex_err: | 2691 | pre_mutex_err: |
2654 | drm_free(object_list, sizeof(*object_list) * args->buffer_count, | 2692 | drm_free(object_list, sizeof(*object_list) * args->buffer_count, |
2655 | DRM_MEM_DRIVER); | 2693 | DRM_MEM_DRIVER); |
@@ -2753,6 +2791,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data, | |||
2753 | if (obj_priv->pin_filp != NULL && obj_priv->pin_filp != file_priv) { | 2791 | if (obj_priv->pin_filp != NULL && obj_priv->pin_filp != file_priv) { |
2754 | DRM_ERROR("Already pinned in i915_gem_pin_ioctl(): %d\n", | 2792 | DRM_ERROR("Already pinned in i915_gem_pin_ioctl(): %d\n", |
2755 | args->handle); | 2793 | args->handle); |
2794 | drm_gem_object_unreference(obj); | ||
2756 | mutex_unlock(&dev->struct_mutex); | 2795 | mutex_unlock(&dev->struct_mutex); |
2757 | return -EINVAL; | 2796 | return -EINVAL; |
2758 | } | 2797 | } |
@@ -2833,6 +2872,13 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
2833 | return -EBADF; | 2872 | return -EBADF; |
2834 | } | 2873 | } |
2835 | 2874 | ||
2875 | /* Update the active list for the hardware's current position. | ||
2876 | * Otherwise this only updates on a delayed timer or when irqs are | ||
2877 | * actually unmasked, and our working set ends up being larger than | ||
2878 | * required. | ||
2879 | */ | ||
2880 | i915_gem_retire_requests(dev); | ||
2881 | |||
2836 | obj_priv = obj->driver_private; | 2882 | obj_priv = obj->driver_private; |
2837 | /* Don't count being on the flushing list against the object being | 2883 | /* Don't count being on the flushing list against the object being |
2838 | * done. Otherwise, a buffer left on the flushing list but not getting | 2884 | * done. Otherwise, a buffer left on the flushing list but not getting |
@@ -2885,9 +2931,6 @@ int i915_gem_init_object(struct drm_gem_object *obj) | |||
2885 | void i915_gem_free_object(struct drm_gem_object *obj) | 2931 | void i915_gem_free_object(struct drm_gem_object *obj) |
2886 | { | 2932 | { |
2887 | struct drm_device *dev = obj->dev; | 2933 | struct drm_device *dev = obj->dev; |
2888 | struct drm_gem_mm *mm = dev->mm_private; | ||
2889 | struct drm_map_list *list; | ||
2890 | struct drm_map *map; | ||
2891 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | 2934 | struct drm_i915_gem_object *obj_priv = obj->driver_private; |
2892 | 2935 | ||
2893 | while (obj_priv->pin_count > 0) | 2936 | while (obj_priv->pin_count > 0) |
@@ -2898,19 +2941,7 @@ void i915_gem_free_object(struct drm_gem_object *obj) | |||
2898 | 2941 | ||
2899 | i915_gem_object_unbind(obj); | 2942 | i915_gem_object_unbind(obj); |
2900 | 2943 | ||
2901 | list = &obj->map_list; | 2944 | i915_gem_free_mmap_offset(obj); |
2902 | drm_ht_remove_item(&mm->offset_hash, &list->hash); | ||
2903 | |||
2904 | if (list->file_offset_node) { | ||
2905 | drm_mm_put_block(list->file_offset_node); | ||
2906 | list->file_offset_node = NULL; | ||
2907 | } | ||
2908 | |||
2909 | map = list->map; | ||
2910 | if (map) { | ||
2911 | drm_free(map, sizeof(*map), DRM_MEM_DRIVER); | ||
2912 | list->map = NULL; | ||
2913 | } | ||
2914 | 2945 | ||
2915 | drm_free(obj_priv->page_cpu_valid, 1, DRM_MEM_DRIVER); | 2946 | drm_free(obj_priv->page_cpu_valid, 1, DRM_MEM_DRIVER); |
2916 | drm_free(obj->driver_private, 1, DRM_MEM_DRIVER); | 2947 | drm_free(obj->driver_private, 1, DRM_MEM_DRIVER); |
@@ -2949,7 +2980,7 @@ i915_gem_evict_from_list(struct drm_device *dev, struct list_head *head) | |||
2949 | return 0; | 2980 | return 0; |
2950 | } | 2981 | } |
2951 | 2982 | ||
2952 | static int | 2983 | int |
2953 | i915_gem_idle(struct drm_device *dev) | 2984 | i915_gem_idle(struct drm_device *dev) |
2954 | { | 2985 | { |
2955 | drm_i915_private_t *dev_priv = dev->dev_private; | 2986 | drm_i915_private_t *dev_priv = dev->dev_private; |
@@ -3095,6 +3126,7 @@ i915_gem_init_hws(struct drm_device *dev) | |||
3095 | if (dev_priv->hw_status_page == NULL) { | 3126 | if (dev_priv->hw_status_page == NULL) { |
3096 | DRM_ERROR("Failed to map status page.\n"); | 3127 | DRM_ERROR("Failed to map status page.\n"); |
3097 | memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map)); | 3128 | memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map)); |
3129 | i915_gem_object_unpin(obj); | ||
3098 | drm_gem_object_unreference(obj); | 3130 | drm_gem_object_unreference(obj); |
3099 | return -EINVAL; | 3131 | return -EINVAL; |
3100 | } | 3132 | } |
@@ -3107,6 +3139,31 @@ i915_gem_init_hws(struct drm_device *dev) | |||
3107 | return 0; | 3139 | return 0; |
3108 | } | 3140 | } |
3109 | 3141 | ||
3142 | static void | ||
3143 | i915_gem_cleanup_hws(struct drm_device *dev) | ||
3144 | { | ||
3145 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
3146 | struct drm_gem_object *obj; | ||
3147 | struct drm_i915_gem_object *obj_priv; | ||
3148 | |||
3149 | if (dev_priv->hws_obj == NULL) | ||
3150 | return; | ||
3151 | |||
3152 | obj = dev_priv->hws_obj; | ||
3153 | obj_priv = obj->driver_private; | ||
3154 | |||
3155 | kunmap(obj_priv->page_list[0]); | ||
3156 | i915_gem_object_unpin(obj); | ||
3157 | drm_gem_object_unreference(obj); | ||
3158 | dev_priv->hws_obj = NULL; | ||
3159 | |||
3160 | memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map)); | ||
3161 | dev_priv->hw_status_page = NULL; | ||
3162 | |||
3163 | /* Write high address into HWS_PGA when disabling. */ | ||
3164 | I915_WRITE(HWS_PGA, 0x1ffff000); | ||
3165 | } | ||
3166 | |||
3110 | int | 3167 | int |
3111 | i915_gem_init_ringbuffer(struct drm_device *dev) | 3168 | i915_gem_init_ringbuffer(struct drm_device *dev) |
3112 | { | 3169 | { |
@@ -3124,6 +3181,7 @@ i915_gem_init_ringbuffer(struct drm_device *dev) | |||
3124 | obj = drm_gem_object_alloc(dev, 128 * 1024); | 3181 | obj = drm_gem_object_alloc(dev, 128 * 1024); |
3125 | if (obj == NULL) { | 3182 | if (obj == NULL) { |
3126 | DRM_ERROR("Failed to allocate ringbuffer\n"); | 3183 | DRM_ERROR("Failed to allocate ringbuffer\n"); |
3184 | i915_gem_cleanup_hws(dev); | ||
3127 | return -ENOMEM; | 3185 | return -ENOMEM; |
3128 | } | 3186 | } |
3129 | obj_priv = obj->driver_private; | 3187 | obj_priv = obj->driver_private; |
@@ -3131,6 +3189,7 @@ i915_gem_init_ringbuffer(struct drm_device *dev) | |||
3131 | ret = i915_gem_object_pin(obj, 4096); | 3189 | ret = i915_gem_object_pin(obj, 4096); |
3132 | if (ret != 0) { | 3190 | if (ret != 0) { |
3133 | drm_gem_object_unreference(obj); | 3191 | drm_gem_object_unreference(obj); |
3192 | i915_gem_cleanup_hws(dev); | ||
3134 | return ret; | 3193 | return ret; |
3135 | } | 3194 | } |
3136 | 3195 | ||
@@ -3148,7 +3207,9 @@ i915_gem_init_ringbuffer(struct drm_device *dev) | |||
3148 | if (ring->map.handle == NULL) { | 3207 | if (ring->map.handle == NULL) { |
3149 | DRM_ERROR("Failed to map ringbuffer.\n"); | 3208 | DRM_ERROR("Failed to map ringbuffer.\n"); |
3150 | memset(&dev_priv->ring, 0, sizeof(dev_priv->ring)); | 3209 | memset(&dev_priv->ring, 0, sizeof(dev_priv->ring)); |
3210 | i915_gem_object_unpin(obj); | ||
3151 | drm_gem_object_unreference(obj); | 3211 | drm_gem_object_unreference(obj); |
3212 | i915_gem_cleanup_hws(dev); | ||
3152 | return -EINVAL; | 3213 | return -EINVAL; |
3153 | } | 3214 | } |
3154 | ring->ring_obj = obj; | 3215 | ring->ring_obj = obj; |
@@ -3228,20 +3289,7 @@ i915_gem_cleanup_ringbuffer(struct drm_device *dev) | |||
3228 | dev_priv->ring.ring_obj = NULL; | 3289 | dev_priv->ring.ring_obj = NULL; |
3229 | memset(&dev_priv->ring, 0, sizeof(dev_priv->ring)); | 3290 | memset(&dev_priv->ring, 0, sizeof(dev_priv->ring)); |
3230 | 3291 | ||
3231 | if (dev_priv->hws_obj != NULL) { | 3292 | i915_gem_cleanup_hws(dev); |
3232 | struct drm_gem_object *obj = dev_priv->hws_obj; | ||
3233 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | ||
3234 | |||
3235 | kunmap(obj_priv->page_list[0]); | ||
3236 | i915_gem_object_unpin(obj); | ||
3237 | drm_gem_object_unreference(obj); | ||
3238 | dev_priv->hws_obj = NULL; | ||
3239 | memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map)); | ||
3240 | dev_priv->hw_status_page = NULL; | ||
3241 | |||
3242 | /* Write high address into HWS_PGA when disabling. */ | ||
3243 | I915_WRITE(HWS_PGA, 0x1ffff000); | ||
3244 | } | ||
3245 | } | 3293 | } |
3246 | 3294 | ||
3247 | int | 3295 | int |
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index fa1685cba840..7fb4191ef934 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -299,9 +299,8 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
299 | } | 299 | } |
300 | obj_priv->stride = args->stride; | 300 | obj_priv->stride = args->stride; |
301 | 301 | ||
302 | mutex_unlock(&dev->struct_mutex); | ||
303 | |||
304 | drm_gem_object_unreference(obj); | 302 | drm_gem_object_unreference(obj); |
303 | mutex_unlock(&dev->struct_mutex); | ||
305 | 304 | ||
306 | return 0; | 305 | return 0; |
307 | } | 306 | } |
@@ -340,9 +339,8 @@ i915_gem_get_tiling(struct drm_device *dev, void *data, | |||
340 | DRM_ERROR("unknown tiling mode\n"); | 339 | DRM_ERROR("unknown tiling mode\n"); |
341 | } | 340 | } |
342 | 341 | ||
343 | mutex_unlock(&dev->struct_mutex); | ||
344 | |||
345 | drm_gem_object_unreference(obj); | 342 | drm_gem_object_unreference(obj); |
343 | mutex_unlock(&dev->struct_mutex); | ||
346 | 344 | ||
347 | return 0; | 345 | return 0; |
348 | } | 346 | } |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 4ca82a025525..65be30dccc77 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -135,6 +135,14 @@ parse_general_features(struct drm_i915_private *dev_priv, | |||
135 | if (general) { | 135 | if (general) { |
136 | dev_priv->int_tv_support = general->int_tv_support; | 136 | dev_priv->int_tv_support = general->int_tv_support; |
137 | dev_priv->int_crt_support = general->int_crt_support; | 137 | dev_priv->int_crt_support = general->int_crt_support; |
138 | dev_priv->lvds_use_ssc = general->enable_ssc; | ||
139 | |||
140 | if (dev_priv->lvds_use_ssc) { | ||
141 | if (IS_I855(dev_priv->dev)) | ||
142 | dev_priv->lvds_ssc_freq = general->ssc_freq ? 66 : 48; | ||
143 | else | ||
144 | dev_priv->lvds_ssc_freq = general->ssc_freq ? 100 : 96; | ||
145 | } | ||
138 | } | 146 | } |
139 | } | 147 | } |
140 | 148 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index bbdd72909a11..65b635ce28c8 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -90,12 +90,12 @@ typedef struct { | |||
90 | #define I9XX_DOT_MAX 400000 | 90 | #define I9XX_DOT_MAX 400000 |
91 | #define I9XX_VCO_MIN 1400000 | 91 | #define I9XX_VCO_MIN 1400000 |
92 | #define I9XX_VCO_MAX 2800000 | 92 | #define I9XX_VCO_MAX 2800000 |
93 | #define I9XX_N_MIN 3 | 93 | #define I9XX_N_MIN 1 |
94 | #define I9XX_N_MAX 8 | 94 | #define I9XX_N_MAX 6 |
95 | #define I9XX_M_MIN 70 | 95 | #define I9XX_M_MIN 70 |
96 | #define I9XX_M_MAX 120 | 96 | #define I9XX_M_MAX 120 |
97 | #define I9XX_M1_MIN 10 | 97 | #define I9XX_M1_MIN 10 |
98 | #define I9XX_M1_MAX 20 | 98 | #define I9XX_M1_MAX 22 |
99 | #define I9XX_M2_MIN 5 | 99 | #define I9XX_M2_MIN 5 |
100 | #define I9XX_M2_MAX 9 | 100 | #define I9XX_M2_MAX 9 |
101 | #define I9XX_P_SDVO_DAC_MIN 5 | 101 | #define I9XX_P_SDVO_DAC_MIN 5 |
@@ -189,9 +189,7 @@ static const intel_limit_t *intel_limit(struct drm_crtc *crtc) | |||
189 | return limit; | 189 | return limit; |
190 | } | 190 | } |
191 | 191 | ||
192 | /** Derive the pixel clock for the given refclk and divisors for 8xx chips. */ | 192 | static void intel_clock(int refclk, intel_clock_t *clock) |
193 | |||
194 | static void i8xx_clock(int refclk, intel_clock_t *clock) | ||
195 | { | 193 | { |
196 | clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2); | 194 | clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2); |
197 | clock->p = clock->p1 * clock->p2; | 195 | clock->p = clock->p1 * clock->p2; |
@@ -199,25 +197,6 @@ static void i8xx_clock(int refclk, intel_clock_t *clock) | |||
199 | clock->dot = clock->vco / clock->p; | 197 | clock->dot = clock->vco / clock->p; |
200 | } | 198 | } |
201 | 199 | ||
202 | /** Derive the pixel clock for the given refclk and divisors for 9xx chips. */ | ||
203 | |||
204 | static void i9xx_clock(int refclk, intel_clock_t *clock) | ||
205 | { | ||
206 | clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2); | ||
207 | clock->p = clock->p1 * clock->p2; | ||
208 | clock->vco = refclk * clock->m / (clock->n + 2); | ||
209 | clock->dot = clock->vco / clock->p; | ||
210 | } | ||
211 | |||
212 | static void intel_clock(struct drm_device *dev, int refclk, | ||
213 | intel_clock_t *clock) | ||
214 | { | ||
215 | if (IS_I9XX(dev)) | ||
216 | i9xx_clock (refclk, clock); | ||
217 | else | ||
218 | i8xx_clock (refclk, clock); | ||
219 | } | ||
220 | |||
221 | /** | 200 | /** |
222 | * Returns whether any output on the specified pipe is of the specified type | 201 | * Returns whether any output on the specified pipe is of the specified type |
223 | */ | 202 | */ |
@@ -238,7 +217,7 @@ bool intel_pipe_has_type (struct drm_crtc *crtc, int type) | |||
238 | return false; | 217 | return false; |
239 | } | 218 | } |
240 | 219 | ||
241 | #define INTELPllInvalid(s) { /* ErrorF (s) */; return false; } | 220 | #define INTELPllInvalid(s) do { DRM_DEBUG(s); return false; } while (0) |
242 | /** | 221 | /** |
243 | * Returns whether the given set of divisors are valid for a given refclk with | 222 | * Returns whether the given set of divisors are valid for a given refclk with |
244 | * the given connectors. | 223 | * the given connectors. |
@@ -318,7 +297,7 @@ static bool intel_find_best_PLL(struct drm_crtc *crtc, int target, | |||
318 | clock.p1 <= limit->p1.max; clock.p1++) { | 297 | clock.p1 <= limit->p1.max; clock.p1++) { |
319 | int this_err; | 298 | int this_err; |
320 | 299 | ||
321 | intel_clock(dev, refclk, &clock); | 300 | intel_clock(refclk, &clock); |
322 | 301 | ||
323 | if (!intel_PLL_is_valid(crtc, &clock)) | 302 | if (!intel_PLL_is_valid(crtc, &clock)) |
324 | continue; | 303 | continue; |
@@ -343,7 +322,7 @@ intel_wait_for_vblank(struct drm_device *dev) | |||
343 | udelay(20000); | 322 | udelay(20000); |
344 | } | 323 | } |
345 | 324 | ||
346 | static void | 325 | static int |
347 | intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | 326 | intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, |
348 | struct drm_framebuffer *old_fb) | 327 | struct drm_framebuffer *old_fb) |
349 | { | 328 | { |
@@ -361,11 +340,21 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
361 | int dspstride = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE; | 340 | int dspstride = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE; |
362 | int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR; | 341 | int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR; |
363 | u32 dspcntr, alignment; | 342 | u32 dspcntr, alignment; |
343 | int ret; | ||
364 | 344 | ||
365 | /* no fb bound */ | 345 | /* no fb bound */ |
366 | if (!crtc->fb) { | 346 | if (!crtc->fb) { |
367 | DRM_DEBUG("No FB bound\n"); | 347 | DRM_DEBUG("No FB bound\n"); |
368 | return; | 348 | return 0; |
349 | } | ||
350 | |||
351 | switch (pipe) { | ||
352 | case 0: | ||
353 | case 1: | ||
354 | break; | ||
355 | default: | ||
356 | DRM_ERROR("Can't update pipe %d in SAREA\n", pipe); | ||
357 | return -EINVAL; | ||
369 | } | 358 | } |
370 | 359 | ||
371 | intel_fb = to_intel_framebuffer(crtc->fb); | 360 | intel_fb = to_intel_framebuffer(crtc->fb); |
@@ -377,28 +366,30 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
377 | alignment = 64 * 1024; | 366 | alignment = 64 * 1024; |
378 | break; | 367 | break; |
379 | case I915_TILING_X: | 368 | case I915_TILING_X: |
380 | if (IS_I9XX(dev)) | 369 | /* pin() will align the object as required by fence */ |
381 | alignment = 1024 * 1024; | 370 | alignment = 0; |
382 | else | ||
383 | alignment = 512 * 1024; | ||
384 | break; | 371 | break; |
385 | case I915_TILING_Y: | 372 | case I915_TILING_Y: |
386 | /* FIXME: Is this true? */ | 373 | /* FIXME: Is this true? */ |
387 | DRM_ERROR("Y tiled not allowed for scan out buffers\n"); | 374 | DRM_ERROR("Y tiled not allowed for scan out buffers\n"); |
388 | return; | 375 | return -EINVAL; |
389 | default: | 376 | default: |
390 | BUG(); | 377 | BUG(); |
391 | } | 378 | } |
392 | 379 | ||
393 | if (i915_gem_object_pin(intel_fb->obj, alignment)) | 380 | mutex_lock(&dev->struct_mutex); |
394 | return; | 381 | ret = i915_gem_object_pin(intel_fb->obj, alignment); |
395 | 382 | if (ret != 0) { | |
396 | i915_gem_object_set_to_gtt_domain(intel_fb->obj, 1); | 383 | mutex_unlock(&dev->struct_mutex); |
397 | 384 | return ret; | |
398 | Start = obj_priv->gtt_offset; | 385 | } |
399 | Offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel / 8); | ||
400 | 386 | ||
401 | I915_WRITE(dspstride, crtc->fb->pitch); | 387 | ret = i915_gem_object_set_to_gtt_domain(intel_fb->obj, 1); |
388 | if (ret != 0) { | ||
389 | i915_gem_object_unpin(intel_fb->obj); | ||
390 | mutex_unlock(&dev->struct_mutex); | ||
391 | return ret; | ||
392 | } | ||
402 | 393 | ||
403 | dspcntr = I915_READ(dspcntr_reg); | 394 | dspcntr = I915_READ(dspcntr_reg); |
404 | /* Mask out pixel format bits in case we change it */ | 395 | /* Mask out pixel format bits in case we change it */ |
@@ -419,11 +410,17 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
419 | break; | 410 | break; |
420 | default: | 411 | default: |
421 | DRM_ERROR("Unknown color depth\n"); | 412 | DRM_ERROR("Unknown color depth\n"); |
422 | return; | 413 | i915_gem_object_unpin(intel_fb->obj); |
414 | mutex_unlock(&dev->struct_mutex); | ||
415 | return -EINVAL; | ||
423 | } | 416 | } |
424 | I915_WRITE(dspcntr_reg, dspcntr); | 417 | I915_WRITE(dspcntr_reg, dspcntr); |
425 | 418 | ||
419 | Start = obj_priv->gtt_offset; | ||
420 | Offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel / 8); | ||
421 | |||
426 | DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y); | 422 | DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y); |
423 | I915_WRITE(dspstride, crtc->fb->pitch); | ||
427 | if (IS_I965G(dev)) { | 424 | if (IS_I965G(dev)) { |
428 | I915_WRITE(dspbase, Offset); | 425 | I915_WRITE(dspbase, Offset); |
429 | I915_READ(dspbase); | 426 | I915_READ(dspbase); |
@@ -440,27 +437,24 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
440 | intel_fb = to_intel_framebuffer(old_fb); | 437 | intel_fb = to_intel_framebuffer(old_fb); |
441 | i915_gem_object_unpin(intel_fb->obj); | 438 | i915_gem_object_unpin(intel_fb->obj); |
442 | } | 439 | } |
440 | mutex_unlock(&dev->struct_mutex); | ||
443 | 441 | ||
444 | if (!dev->primary->master) | 442 | if (!dev->primary->master) |
445 | return; | 443 | return 0; |
446 | 444 | ||
447 | master_priv = dev->primary->master->driver_priv; | 445 | master_priv = dev->primary->master->driver_priv; |
448 | if (!master_priv->sarea_priv) | 446 | if (!master_priv->sarea_priv) |
449 | return; | 447 | return 0; |
450 | 448 | ||
451 | switch (pipe) { | 449 | if (pipe) { |
452 | case 0: | ||
453 | master_priv->sarea_priv->pipeA_x = x; | ||
454 | master_priv->sarea_priv->pipeA_y = y; | ||
455 | break; | ||
456 | case 1: | ||
457 | master_priv->sarea_priv->pipeB_x = x; | 450 | master_priv->sarea_priv->pipeB_x = x; |
458 | master_priv->sarea_priv->pipeB_y = y; | 451 | master_priv->sarea_priv->pipeB_y = y; |
459 | break; | 452 | } else { |
460 | default: | 453 | master_priv->sarea_priv->pipeA_x = x; |
461 | DRM_ERROR("Can't update pipe %d in SAREA\n", pipe); | 454 | master_priv->sarea_priv->pipeA_y = y; |
462 | break; | ||
463 | } | 455 | } |
456 | |||
457 | return 0; | ||
464 | } | 458 | } |
465 | 459 | ||
466 | 460 | ||
@@ -708,11 +702,11 @@ static int intel_panel_fitter_pipe (struct drm_device *dev) | |||
708 | return 1; | 702 | return 1; |
709 | } | 703 | } |
710 | 704 | ||
711 | static void intel_crtc_mode_set(struct drm_crtc *crtc, | 705 | static int intel_crtc_mode_set(struct drm_crtc *crtc, |
712 | struct drm_display_mode *mode, | 706 | struct drm_display_mode *mode, |
713 | struct drm_display_mode *adjusted_mode, | 707 | struct drm_display_mode *adjusted_mode, |
714 | int x, int y, | 708 | int x, int y, |
715 | struct drm_framebuffer *old_fb) | 709 | struct drm_framebuffer *old_fb) |
716 | { | 710 | { |
717 | struct drm_device *dev = crtc->dev; | 711 | struct drm_device *dev = crtc->dev; |
718 | struct drm_i915_private *dev_priv = dev->dev_private; | 712 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -732,13 +726,14 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc, | |||
732 | int dspsize_reg = (pipe == 0) ? DSPASIZE : DSPBSIZE; | 726 | int dspsize_reg = (pipe == 0) ? DSPASIZE : DSPBSIZE; |
733 | int dsppos_reg = (pipe == 0) ? DSPAPOS : DSPBPOS; | 727 | int dsppos_reg = (pipe == 0) ? DSPAPOS : DSPBPOS; |
734 | int pipesrc_reg = (pipe == 0) ? PIPEASRC : PIPEBSRC; | 728 | int pipesrc_reg = (pipe == 0) ? PIPEASRC : PIPEBSRC; |
735 | int refclk; | 729 | int refclk, num_outputs = 0; |
736 | intel_clock_t clock; | 730 | intel_clock_t clock; |
737 | u32 dpll = 0, fp = 0, dspcntr, pipeconf; | 731 | u32 dpll = 0, fp = 0, dspcntr, pipeconf; |
738 | bool ok, is_sdvo = false, is_dvo = false; | 732 | bool ok, is_sdvo = false, is_dvo = false; |
739 | bool is_crt = false, is_lvds = false, is_tv = false; | 733 | bool is_crt = false, is_lvds = false, is_tv = false; |
740 | struct drm_mode_config *mode_config = &dev->mode_config; | 734 | struct drm_mode_config *mode_config = &dev->mode_config; |
741 | struct drm_connector *connector; | 735 | struct drm_connector *connector; |
736 | int ret; | ||
742 | 737 | ||
743 | drm_vblank_pre_modeset(dev, pipe); | 738 | drm_vblank_pre_modeset(dev, pipe); |
744 | 739 | ||
@@ -768,9 +763,14 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc, | |||
768 | is_crt = true; | 763 | is_crt = true; |
769 | break; | 764 | break; |
770 | } | 765 | } |
766 | |||
767 | num_outputs++; | ||
771 | } | 768 | } |
772 | 769 | ||
773 | if (IS_I9XX(dev)) { | 770 | if (is_lvds && dev_priv->lvds_use_ssc && num_outputs < 2) { |
771 | refclk = dev_priv->lvds_ssc_freq * 1000; | ||
772 | DRM_DEBUG("using SSC reference clock of %d MHz\n", refclk / 1000); | ||
773 | } else if (IS_I9XX(dev)) { | ||
774 | refclk = 96000; | 774 | refclk = 96000; |
775 | } else { | 775 | } else { |
776 | refclk = 48000; | 776 | refclk = 48000; |
@@ -779,7 +779,7 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc, | |||
779 | ok = intel_find_best_PLL(crtc, adjusted_mode->clock, refclk, &clock); | 779 | ok = intel_find_best_PLL(crtc, adjusted_mode->clock, refclk, &clock); |
780 | if (!ok) { | 780 | if (!ok) { |
781 | DRM_ERROR("Couldn't find PLL settings for mode!\n"); | 781 | DRM_ERROR("Couldn't find PLL settings for mode!\n"); |
782 | return; | 782 | return -EINVAL; |
783 | } | 783 | } |
784 | 784 | ||
785 | fp = clock.n << 16 | clock.m1 << 8 | clock.m2; | 785 | fp = clock.n << 16 | clock.m1 << 8 | clock.m2; |
@@ -829,11 +829,14 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc, | |||
829 | } | 829 | } |
830 | } | 830 | } |
831 | 831 | ||
832 | if (is_tv) { | 832 | if (is_sdvo && is_tv) |
833 | dpll |= PLL_REF_INPUT_TVCLKINBC; | ||
834 | else if (is_tv) | ||
833 | /* XXX: just matching BIOS for now */ | 835 | /* XXX: just matching BIOS for now */ |
834 | /* dpll |= PLL_REF_INPUT_TVCLKINBC; */ | 836 | /* dpll |= PLL_REF_INPUT_TVCLKINBC; */ |
835 | dpll |= 3; | 837 | dpll |= 3; |
836 | } | 838 | else if (is_lvds && dev_priv->lvds_use_ssc && num_outputs < 2) |
839 | dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; | ||
837 | else | 840 | else |
838 | dpll |= PLL_REF_INPUT_DREFCLK; | 841 | dpll |= PLL_REF_INPUT_DREFCLK; |
839 | 842 | ||
@@ -950,9 +953,13 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc, | |||
950 | I915_WRITE(dspcntr_reg, dspcntr); | 953 | I915_WRITE(dspcntr_reg, dspcntr); |
951 | 954 | ||
952 | /* Flush the plane changes */ | 955 | /* Flush the plane changes */ |
953 | intel_pipe_set_base(crtc, x, y, old_fb); | 956 | ret = intel_pipe_set_base(crtc, x, y, old_fb); |
957 | if (ret != 0) | ||
958 | return ret; | ||
954 | 959 | ||
955 | drm_vblank_post_modeset(dev, pipe); | 960 | drm_vblank_post_modeset(dev, pipe); |
961 | |||
962 | return 0; | ||
956 | } | 963 | } |
957 | 964 | ||
958 | /** Loads the palette/gamma unit for the CRTC with the prepared values */ | 965 | /** Loads the palette/gamma unit for the CRTC with the prepared values */ |
@@ -1001,6 +1008,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1001 | temp = CURSOR_MODE_DISABLE; | 1008 | temp = CURSOR_MODE_DISABLE; |
1002 | addr = 0; | 1009 | addr = 0; |
1003 | bo = NULL; | 1010 | bo = NULL; |
1011 | mutex_lock(&dev->struct_mutex); | ||
1004 | goto finish; | 1012 | goto finish; |
1005 | } | 1013 | } |
1006 | 1014 | ||
@@ -1023,18 +1031,19 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1023 | } | 1031 | } |
1024 | 1032 | ||
1025 | /* we only need to pin inside GTT if cursor is non-phy */ | 1033 | /* we only need to pin inside GTT if cursor is non-phy */ |
1034 | mutex_lock(&dev->struct_mutex); | ||
1026 | if (!dev_priv->cursor_needs_physical) { | 1035 | if (!dev_priv->cursor_needs_physical) { |
1027 | ret = i915_gem_object_pin(bo, PAGE_SIZE); | 1036 | ret = i915_gem_object_pin(bo, PAGE_SIZE); |
1028 | if (ret) { | 1037 | if (ret) { |
1029 | DRM_ERROR("failed to pin cursor bo\n"); | 1038 | DRM_ERROR("failed to pin cursor bo\n"); |
1030 | goto fail; | 1039 | goto fail_locked; |
1031 | } | 1040 | } |
1032 | addr = obj_priv->gtt_offset; | 1041 | addr = obj_priv->gtt_offset; |
1033 | } else { | 1042 | } else { |
1034 | ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1); | 1043 | ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1); |
1035 | if (ret) { | 1044 | if (ret) { |
1036 | DRM_ERROR("failed to attach phys object\n"); | 1045 | DRM_ERROR("failed to attach phys object\n"); |
1037 | goto fail; | 1046 | goto fail_locked; |
1038 | } | 1047 | } |
1039 | addr = obj_priv->phys_obj->handle->busaddr; | 1048 | addr = obj_priv->phys_obj->handle->busaddr; |
1040 | } | 1049 | } |
@@ -1054,10 +1063,9 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1054 | i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); | 1063 | i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); |
1055 | } else | 1064 | } else |
1056 | i915_gem_object_unpin(intel_crtc->cursor_bo); | 1065 | i915_gem_object_unpin(intel_crtc->cursor_bo); |
1057 | mutex_lock(&dev->struct_mutex); | ||
1058 | drm_gem_object_unreference(intel_crtc->cursor_bo); | 1066 | drm_gem_object_unreference(intel_crtc->cursor_bo); |
1059 | mutex_unlock(&dev->struct_mutex); | ||
1060 | } | 1067 | } |
1068 | mutex_unlock(&dev->struct_mutex); | ||
1061 | 1069 | ||
1062 | intel_crtc->cursor_addr = addr; | 1070 | intel_crtc->cursor_addr = addr; |
1063 | intel_crtc->cursor_bo = bo; | 1071 | intel_crtc->cursor_bo = bo; |
@@ -1065,6 +1073,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1065 | return 0; | 1073 | return 0; |
1066 | fail: | 1074 | fail: |
1067 | mutex_lock(&dev->struct_mutex); | 1075 | mutex_lock(&dev->struct_mutex); |
1076 | fail_locked: | ||
1068 | drm_gem_object_unreference(bo); | 1077 | drm_gem_object_unreference(bo); |
1069 | mutex_unlock(&dev->struct_mutex); | 1078 | mutex_unlock(&dev->struct_mutex); |
1070 | return ret; | 1079 | return ret; |
@@ -1292,7 +1301,7 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc) | |||
1292 | } | 1301 | } |
1293 | 1302 | ||
1294 | /* XXX: Handle the 100Mhz refclk */ | 1303 | /* XXX: Handle the 100Mhz refclk */ |
1295 | i9xx_clock(96000, &clock); | 1304 | intel_clock(96000, &clock); |
1296 | } else { | 1305 | } else { |
1297 | bool is_lvds = (pipe == 1) && (I915_READ(LVDS) & LVDS_PORT_EN); | 1306 | bool is_lvds = (pipe == 1) && (I915_READ(LVDS) & LVDS_PORT_EN); |
1298 | 1307 | ||
@@ -1304,9 +1313,9 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc) | |||
1304 | if ((dpll & PLL_REF_INPUT_MASK) == | 1313 | if ((dpll & PLL_REF_INPUT_MASK) == |
1305 | PLLB_REF_INPUT_SPREADSPECTRUMIN) { | 1314 | PLLB_REF_INPUT_SPREADSPECTRUMIN) { |
1306 | /* XXX: might not be 66MHz */ | 1315 | /* XXX: might not be 66MHz */ |
1307 | i8xx_clock(66000, &clock); | 1316 | intel_clock(66000, &clock); |
1308 | } else | 1317 | } else |
1309 | i8xx_clock(48000, &clock); | 1318 | intel_clock(48000, &clock); |
1310 | } else { | 1319 | } else { |
1311 | if (dpll & PLL_P1_DIVIDE_BY_TWO) | 1320 | if (dpll & PLL_P1_DIVIDE_BY_TWO) |
1312 | clock.p1 = 2; | 1321 | clock.p1 = 2; |
@@ -1319,7 +1328,7 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc) | |||
1319 | else | 1328 | else |
1320 | clock.p2 = 2; | 1329 | clock.p2 = 2; |
1321 | 1330 | ||
1322 | i8xx_clock(48000, &clock); | 1331 | intel_clock(48000, &clock); |
1323 | } | 1332 | } |
1324 | } | 1333 | } |
1325 | 1334 | ||
@@ -1598,7 +1607,9 @@ intel_user_framebuffer_create(struct drm_device *dev, | |||
1598 | 1607 | ||
1599 | ret = intel_framebuffer_create(dev, mode_cmd, &fb, obj); | 1608 | ret = intel_framebuffer_create(dev, mode_cmd, &fb, obj); |
1600 | if (ret) { | 1609 | if (ret) { |
1610 | mutex_lock(&dev->struct_mutex); | ||
1601 | drm_gem_object_unreference(obj); | 1611 | drm_gem_object_unreference(obj); |
1612 | mutex_unlock(&dev->struct_mutex); | ||
1602 | return NULL; | 1613 | return NULL; |
1603 | } | 1614 | } |
1604 | 1615 | ||
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index afd1217b8a02..b7f0ebe9f810 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -473,7 +473,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width, | |||
473 | ret = intel_framebuffer_create(dev, &mode_cmd, &fb, fbo); | 473 | ret = intel_framebuffer_create(dev, &mode_cmd, &fb, fbo); |
474 | if (ret) { | 474 | if (ret) { |
475 | DRM_ERROR("failed to allocate fb.\n"); | 475 | DRM_ERROR("failed to allocate fb.\n"); |
476 | goto out_unref; | 476 | goto out_unpin; |
477 | } | 477 | } |
478 | 478 | ||
479 | list_add(&fb->filp_head, &dev->mode_config.fb_kernel_list); | 479 | list_add(&fb->filp_head, &dev->mode_config.fb_kernel_list); |
@@ -484,7 +484,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width, | |||
484 | info = framebuffer_alloc(sizeof(struct intelfb_par), device); | 484 | info = framebuffer_alloc(sizeof(struct intelfb_par), device); |
485 | if (!info) { | 485 | if (!info) { |
486 | ret = -ENOMEM; | 486 | ret = -ENOMEM; |
487 | goto out_unref; | 487 | goto out_unpin; |
488 | } | 488 | } |
489 | 489 | ||
490 | par = info->par; | 490 | par = info->par; |
@@ -513,7 +513,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width, | |||
513 | size); | 513 | size); |
514 | if (!info->screen_base) { | 514 | if (!info->screen_base) { |
515 | ret = -ENOSPC; | 515 | ret = -ENOSPC; |
516 | goto out_unref; | 516 | goto out_unpin; |
517 | } | 517 | } |
518 | info->screen_size = size; | 518 | info->screen_size = size; |
519 | 519 | ||
@@ -608,6 +608,8 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width, | |||
608 | mutex_unlock(&dev->struct_mutex); | 608 | mutex_unlock(&dev->struct_mutex); |
609 | return 0; | 609 | return 0; |
610 | 610 | ||
611 | out_unpin: | ||
612 | i915_gem_object_unpin(fbo); | ||
611 | out_unref: | 613 | out_unref: |
612 | drm_gem_object_unreference(fbo); | 614 | drm_gem_object_unreference(fbo); |
613 | mutex_unlock(&dev->struct_mutex); | 615 | mutex_unlock(&dev->struct_mutex); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 6d4f91265354..0d211af98854 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -481,8 +481,6 @@ void intel_lvds_init(struct drm_device *dev) | |||
481 | if (dev_priv->panel_fixed_mode) { | 481 | if (dev_priv->panel_fixed_mode) { |
482 | dev_priv->panel_fixed_mode->type |= | 482 | dev_priv->panel_fixed_mode->type |= |
483 | DRM_MODE_TYPE_PREFERRED; | 483 | DRM_MODE_TYPE_PREFERRED; |
484 | drm_mode_probed_add(connector, | ||
485 | dev_priv->panel_fixed_mode); | ||
486 | goto out; | 484 | goto out; |
487 | } | 485 | } |
488 | } | 486 | } |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index a30508b639ba..fbe6f3931b1b 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -193,7 +193,7 @@ static bool intel_sdvo_write_byte(struct intel_output *intel_output, int addr, | |||
193 | 193 | ||
194 | #define SDVO_CMD_NAME_ENTRY(cmd) {cmd, #cmd} | 194 | #define SDVO_CMD_NAME_ENTRY(cmd) {cmd, #cmd} |
195 | /** Mapping of command numbers to names, for debug output */ | 195 | /** Mapping of command numbers to names, for debug output */ |
196 | const static struct _sdvo_cmd_name { | 196 | static const struct _sdvo_cmd_name { |
197 | u8 cmd; | 197 | u8 cmd; |
198 | char *name; | 198 | char *name; |
199 | } sdvo_cmd_names[] = { | 199 | } sdvo_cmd_names[] = { |
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index fbb35dc56f5c..56485d67369b 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -411,7 +411,7 @@ struct tv_mode { | |||
411 | * These values account for -1s required. | 411 | * These values account for -1s required. |
412 | */ | 412 | */ |
413 | 413 | ||
414 | const static struct tv_mode tv_modes[] = { | 414 | static const struct tv_mode tv_modes[] = { |
415 | { | 415 | { |
416 | .name = "NTSC-M", | 416 | .name = "NTSC-M", |
417 | .clock = 107520, | 417 | .clock = 107520, |
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c index df4cf97e5d97..92965dbb3c14 100644 --- a/drivers/gpu/drm/radeon/radeon_cp.c +++ b/drivers/gpu/drm/radeon/radeon_cp.c | |||
@@ -557,8 +557,10 @@ static int radeon_do_engine_reset(struct drm_device * dev) | |||
557 | } | 557 | } |
558 | 558 | ||
559 | static void radeon_cp_init_ring_buffer(struct drm_device * dev, | 559 | static void radeon_cp_init_ring_buffer(struct drm_device * dev, |
560 | drm_radeon_private_t * dev_priv) | 560 | drm_radeon_private_t *dev_priv, |
561 | struct drm_file *file_priv) | ||
561 | { | 562 | { |
563 | struct drm_radeon_master_private *master_priv; | ||
562 | u32 ring_start, cur_read_ptr; | 564 | u32 ring_start, cur_read_ptr; |
563 | u32 tmp; | 565 | u32 tmp; |
564 | 566 | ||
@@ -677,6 +679,14 @@ static void radeon_cp_init_ring_buffer(struct drm_device * dev, | |||
677 | dev_priv->scratch[2] = 0; | 679 | dev_priv->scratch[2] = 0; |
678 | RADEON_WRITE(RADEON_LAST_CLEAR_REG, 0); | 680 | RADEON_WRITE(RADEON_LAST_CLEAR_REG, 0); |
679 | 681 | ||
682 | /* reset sarea copies of these */ | ||
683 | master_priv = file_priv->master->driver_priv; | ||
684 | if (master_priv->sarea_priv) { | ||
685 | master_priv->sarea_priv->last_frame = 0; | ||
686 | master_priv->sarea_priv->last_dispatch = 0; | ||
687 | master_priv->sarea_priv->last_clear = 0; | ||
688 | } | ||
689 | |||
680 | radeon_do_wait_for_idle(dev_priv); | 690 | radeon_do_wait_for_idle(dev_priv); |
681 | 691 | ||
682 | /* Sync everything up */ | 692 | /* Sync everything up */ |
@@ -1215,7 +1225,7 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init, | |||
1215 | } | 1225 | } |
1216 | 1226 | ||
1217 | radeon_cp_load_microcode(dev_priv); | 1227 | radeon_cp_load_microcode(dev_priv); |
1218 | radeon_cp_init_ring_buffer(dev, dev_priv); | 1228 | radeon_cp_init_ring_buffer(dev, dev_priv, file_priv); |
1219 | 1229 | ||
1220 | dev_priv->last_buf = 0; | 1230 | dev_priv->last_buf = 0; |
1221 | 1231 | ||
@@ -1281,7 +1291,7 @@ static int radeon_do_cleanup_cp(struct drm_device * dev) | |||
1281 | * | 1291 | * |
1282 | * Charl P. Botha <http://cpbotha.net> | 1292 | * Charl P. Botha <http://cpbotha.net> |
1283 | */ | 1293 | */ |
1284 | static int radeon_do_resume_cp(struct drm_device * dev) | 1294 | static int radeon_do_resume_cp(struct drm_device *dev, struct drm_file *file_priv) |
1285 | { | 1295 | { |
1286 | drm_radeon_private_t *dev_priv = dev->dev_private; | 1296 | drm_radeon_private_t *dev_priv = dev->dev_private; |
1287 | 1297 | ||
@@ -1304,7 +1314,7 @@ static int radeon_do_resume_cp(struct drm_device * dev) | |||
1304 | } | 1314 | } |
1305 | 1315 | ||
1306 | radeon_cp_load_microcode(dev_priv); | 1316 | radeon_cp_load_microcode(dev_priv); |
1307 | radeon_cp_init_ring_buffer(dev, dev_priv); | 1317 | radeon_cp_init_ring_buffer(dev, dev_priv, file_priv); |
1308 | 1318 | ||
1309 | radeon_do_engine_reset(dev); | 1319 | radeon_do_engine_reset(dev); |
1310 | radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1); | 1320 | radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1); |
@@ -1479,8 +1489,7 @@ int radeon_cp_idle(struct drm_device *dev, void *data, struct drm_file *file_pri | |||
1479 | */ | 1489 | */ |
1480 | int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file *file_priv) | 1490 | int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file *file_priv) |
1481 | { | 1491 | { |
1482 | 1492 | return radeon_do_resume_cp(dev, file_priv); | |
1483 | return radeon_do_resume_cp(dev); | ||
1484 | } | 1493 | } |
1485 | 1494 | ||
1486 | int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv) | 1495 | int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv) |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 6cad69ed21c5..1cc967448f4d 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1300,7 +1300,13 @@ static const struct hid_device_id hid_blacklist[] = { | |||
1300 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | 1300 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, |
1301 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, | 1301 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, |
1302 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, | 1302 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, |
1303 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, | ||
1304 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, | ||
1305 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, | ||
1306 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, | ||
1303 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, | 1307 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, |
1308 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, | ||
1309 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, | ||
1304 | 1310 | ||
1305 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, | 1311 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, |
1306 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, | 1312 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, |
@@ -1605,6 +1611,7 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1605 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, | 1611 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) }, |
1606 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, | 1612 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) }, |
1607 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, | 1613 | { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, |
1614 | { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, | ||
1608 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) }, | 1615 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) }, |
1609 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2) }, | 1616 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2) }, |
1610 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) }, | 1617 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) }, |
@@ -1612,10 +1619,6 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1612 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD5) }, | 1619 | { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD5) }, |
1613 | { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) }, | 1620 | { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) }, |
1614 | { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) }, | 1621 | { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) }, |
1615 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, | ||
1616 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, | ||
1617 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) }, | ||
1618 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, | ||
1619 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, | 1622 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, |
1620 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, | 1623 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, |
1621 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, | 1624 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, |
@@ -1626,8 +1629,6 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1626 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, | 1629 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, |
1627 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, | 1630 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, |
1628 | { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, | 1631 | { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) }, |
1629 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, | ||
1630 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, | ||
1631 | { } | 1632 | { } |
1632 | }; | 1633 | }; |
1633 | 1634 | ||
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index e899f510ebeb..88511970508d 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -348,6 +348,9 @@ | |||
348 | #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 | 348 | #define USB_VENDOR_ID_PLAYDOTCOM 0x0b43 |
349 | #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 | 349 | #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII 0x0003 |
350 | 350 | ||
351 | #define USB_VENDOR_ID_POWERCOM 0x0d9f | ||
352 | #define USB_DEVICE_ID_POWERCOM_UPS 0x0002 | ||
353 | |||
351 | #define USB_VENDOR_ID_SAITEK 0x06a3 | 354 | #define USB_VENDOR_ID_SAITEK 0x06a3 |
352 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 | 355 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 |
353 | 356 | ||
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 732449628971..02b19db5442e 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -267,8 +267,10 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, | |||
267 | default: | 267 | default: |
268 | { | 268 | { |
269 | struct hid_device *hid = dev->hid; | 269 | struct hid_device *hid = dev->hid; |
270 | if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) | 270 | if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) { |
271 | return -EINVAL; | 271 | ret = -EINVAL; |
272 | break; | ||
273 | } | ||
272 | 274 | ||
273 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { | 275 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { |
274 | int len; | 276 | int len; |
@@ -277,8 +279,9 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, | |||
277 | len = strlen(hid->name) + 1; | 279 | len = strlen(hid->name) + 1; |
278 | if (len > _IOC_SIZE(cmd)) | 280 | if (len > _IOC_SIZE(cmd)) |
279 | len = _IOC_SIZE(cmd); | 281 | len = _IOC_SIZE(cmd); |
280 | return copy_to_user(user_arg, hid->name, len) ? | 282 | ret = copy_to_user(user_arg, hid->name, len) ? |
281 | -EFAULT : len; | 283 | -EFAULT : len; |
284 | break; | ||
282 | } | 285 | } |
283 | 286 | ||
284 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { | 287 | if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { |
@@ -288,12 +291,13 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, | |||
288 | len = strlen(hid->phys) + 1; | 291 | len = strlen(hid->phys) + 1; |
289 | if (len > _IOC_SIZE(cmd)) | 292 | if (len > _IOC_SIZE(cmd)) |
290 | len = _IOC_SIZE(cmd); | 293 | len = _IOC_SIZE(cmd); |
291 | return copy_to_user(user_arg, hid->phys, len) ? | 294 | ret = copy_to_user(user_arg, hid->phys, len) ? |
292 | -EFAULT : len; | 295 | -EFAULT : len; |
296 | break; | ||
293 | } | 297 | } |
294 | } | 298 | } |
295 | 299 | ||
296 | ret = -ENOTTY; | 300 | ret = -ENOTTY; |
297 | } | 301 | } |
298 | unlock_kernel(); | 302 | unlock_kernel(); |
299 | return ret; | 303 | return ret; |
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index 609cafff86bc..5f81ddf71508 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c | |||
@@ -1872,7 +1872,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
1872 | 1872 | ||
1873 | devid = superio_inw(sioaddr, SIO_REG_MANID); | 1873 | devid = superio_inw(sioaddr, SIO_REG_MANID); |
1874 | if (devid != SIO_FINTEK_ID) { | 1874 | if (devid != SIO_FINTEK_ID) { |
1875 | printk(KERN_INFO DRVNAME ": Not a Fintek device\n"); | 1875 | pr_debug(DRVNAME ": Not a Fintek device\n"); |
1876 | goto exit; | 1876 | goto exit; |
1877 | } | 1877 | } |
1878 | 1878 | ||
@@ -1932,7 +1932,7 @@ static int __init f71882fg_device_add(unsigned short address, | |||
1932 | res.name = f71882fg_pdev->name; | 1932 | res.name = f71882fg_pdev->name; |
1933 | err = acpi_check_resource_conflict(&res); | 1933 | err = acpi_check_resource_conflict(&res); |
1934 | if (err) | 1934 | if (err) |
1935 | return err; | 1935 | goto exit_device_put; |
1936 | 1936 | ||
1937 | err = platform_device_add_resources(f71882fg_pdev, &res, 1); | 1937 | err = platform_device_add_resources(f71882fg_pdev, &res, 1); |
1938 | if (err) { | 1938 | if (err) { |
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c index abf4dfc8ec22..29c83b5b9697 100644 --- a/drivers/hwmon/hp_accel.c +++ b/drivers/hwmon/hp_accel.c | |||
@@ -166,6 +166,18 @@ static struct axis_conversion lis3lv02d_axis_xy_swap_yz_inverted = {2, -1, -3}; | |||
166 | }, \ | 166 | }, \ |
167 | .driver_data = &lis3lv02d_axis_##_axis \ | 167 | .driver_data = &lis3lv02d_axis_##_axis \ |
168 | } | 168 | } |
169 | |||
170 | #define AXIS_DMI_MATCH2(_ident, _class1, _name1, \ | ||
171 | _class2, _name2, \ | ||
172 | _axis) { \ | ||
173 | .ident = _ident, \ | ||
174 | .callback = lis3lv02d_dmi_matched, \ | ||
175 | .matches = { \ | ||
176 | DMI_MATCH(DMI_##_class1, _name1), \ | ||
177 | DMI_MATCH(DMI_##_class2, _name2), \ | ||
178 | }, \ | ||
179 | .driver_data = &lis3lv02d_axis_##_axis \ | ||
180 | } | ||
169 | static struct dmi_system_id lis3lv02d_dmi_ids[] = { | 181 | static struct dmi_system_id lis3lv02d_dmi_ids[] = { |
170 | /* product names are truncated to match all kinds of a same model */ | 182 | /* product names are truncated to match all kinds of a same model */ |
171 | AXIS_DMI_MATCH("NC64x0", "HP Compaq nc64", x_inverted), | 183 | AXIS_DMI_MATCH("NC64x0", "HP Compaq nc64", x_inverted), |
@@ -179,6 +191,16 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { | |||
179 | AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd), | 191 | AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd), |
180 | AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right), | 192 | AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right), |
181 | AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted), | 193 | AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted), |
194 | /* Intel-based HP Pavilion dv5 */ | ||
195 | AXIS_DMI_MATCH2("HPDV5_I", | ||
196 | PRODUCT_NAME, "HP Pavilion dv5", | ||
197 | BOARD_NAME, "3603", | ||
198 | x_inverted), | ||
199 | /* AMD-based HP Pavilion dv5 */ | ||
200 | AXIS_DMI_MATCH2("HPDV5_A", | ||
201 | PRODUCT_NAME, "HP Pavilion dv5", | ||
202 | BOARD_NAME, "3600", | ||
203 | y_inverted), | ||
182 | { NULL, } | 204 | { NULL, } |
183 | /* Laptop models without axis info (yet): | 205 | /* Laptop models without axis info (yet): |
184 | * "NC6910" "HP Compaq 6910" | 206 | * "NC6910" "HP Compaq 6910" |
@@ -213,9 +235,49 @@ static struct delayed_led_classdev hpled_led = { | |||
213 | .set_brightness = hpled_set, | 235 | .set_brightness = hpled_set, |
214 | }; | 236 | }; |
215 | 237 | ||
238 | static acpi_status | ||
239 | lis3lv02d_get_resource(struct acpi_resource *resource, void *context) | ||
240 | { | ||
241 | if (resource->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) { | ||
242 | struct acpi_resource_extended_irq *irq; | ||
243 | u32 *device_irq = context; | ||
244 | |||
245 | irq = &resource->data.extended_irq; | ||
246 | *device_irq = irq->interrupts[0]; | ||
247 | } | ||
248 | |||
249 | return AE_OK; | ||
250 | } | ||
251 | |||
252 | static void lis3lv02d_enum_resources(struct acpi_device *device) | ||
253 | { | ||
254 | acpi_status status; | ||
255 | |||
256 | status = acpi_walk_resources(device->handle, METHOD_NAME__CRS, | ||
257 | lis3lv02d_get_resource, &adev.irq); | ||
258 | if (ACPI_FAILURE(status)) | ||
259 | printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n"); | ||
260 | } | ||
261 | |||
262 | static s16 lis3lv02d_read_16(acpi_handle handle, int reg) | ||
263 | { | ||
264 | u8 lo, hi; | ||
265 | |||
266 | adev.read(handle, reg - 1, &lo); | ||
267 | adev.read(handle, reg, &hi); | ||
268 | /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */ | ||
269 | return (s16)((hi << 8) | lo); | ||
270 | } | ||
271 | |||
272 | static s16 lis3lv02d_read_8(acpi_handle handle, int reg) | ||
273 | { | ||
274 | s8 lo; | ||
275 | adev.read(handle, reg, &lo); | ||
276 | return lo; | ||
277 | } | ||
278 | |||
216 | static int lis3lv02d_add(struct acpi_device *device) | 279 | static int lis3lv02d_add(struct acpi_device *device) |
217 | { | 280 | { |
218 | u8 val; | ||
219 | int ret; | 281 | int ret; |
220 | 282 | ||
221 | if (!device) | 283 | if (!device) |
@@ -229,10 +291,22 @@ static int lis3lv02d_add(struct acpi_device *device) | |||
229 | strcpy(acpi_device_class(device), ACPI_MDPS_CLASS); | 291 | strcpy(acpi_device_class(device), ACPI_MDPS_CLASS); |
230 | device->driver_data = &adev; | 292 | device->driver_data = &adev; |
231 | 293 | ||
232 | lis3lv02d_acpi_read(device->handle, WHO_AM_I, &val); | 294 | lis3lv02d_acpi_read(device->handle, WHO_AM_I, &adev.whoami); |
233 | if ((val != LIS3LV02DL_ID) && (val != LIS302DL_ID)) { | 295 | switch (adev.whoami) { |
296 | case LIS_DOUBLE_ID: | ||
297 | printk(KERN_INFO DRIVER_NAME ": 2-byte sensor found\n"); | ||
298 | adev.read_data = lis3lv02d_read_16; | ||
299 | adev.mdps_max_val = 2048; | ||
300 | break; | ||
301 | case LIS_SINGLE_ID: | ||
302 | printk(KERN_INFO DRIVER_NAME ": 1-byte sensor found\n"); | ||
303 | adev.read_data = lis3lv02d_read_8; | ||
304 | adev.mdps_max_val = 128; | ||
305 | break; | ||
306 | default: | ||
234 | printk(KERN_ERR DRIVER_NAME | 307 | printk(KERN_ERR DRIVER_NAME |
235 | ": Accelerometer chip not LIS3LV02D{L,Q}\n"); | 308 | ": unknown sensor type 0x%X\n", adev.whoami); |
309 | return -EINVAL; | ||
236 | } | 310 | } |
237 | 311 | ||
238 | /* If possible use a "standard" axes order */ | 312 | /* If possible use a "standard" axes order */ |
@@ -247,6 +321,9 @@ static int lis3lv02d_add(struct acpi_device *device) | |||
247 | if (ret) | 321 | if (ret) |
248 | return ret; | 322 | return ret; |
249 | 323 | ||
324 | /* obtain IRQ number of our device from ACPI */ | ||
325 | lis3lv02d_enum_resources(adev.device); | ||
326 | |||
250 | ret = lis3lv02d_init_device(&adev); | 327 | ret = lis3lv02d_init_device(&adev); |
251 | if (ret) { | 328 | if (ret) { |
252 | flush_work(&hpled_led.work); | 329 | flush_work(&hpled_led.work); |
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c index 219d2d0d5a62..8bb2158f0453 100644 --- a/drivers/hwmon/lis3lv02d.c +++ b/drivers/hwmon/lis3lv02d.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2007-2008 Yan Burman | 4 | * Copyright (C) 2007-2008 Yan Burman |
5 | * Copyright (C) 2008 Eric Piel | 5 | * Copyright (C) 2008 Eric Piel |
6 | * Copyright (C) 2008 Pavel Machek | 6 | * Copyright (C) 2008-2009 Pavel Machek |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/poll.h> | 35 | #include <linux/poll.h> |
36 | #include <linux/freezer.h> | 36 | #include <linux/freezer.h> |
37 | #include <linux/uaccess.h> | 37 | #include <linux/uaccess.h> |
38 | #include <linux/miscdevice.h> | ||
38 | #include <acpi/acpi_drivers.h> | 39 | #include <acpi/acpi_drivers.h> |
39 | #include <asm/atomic.h> | 40 | #include <asm/atomic.h> |
40 | #include "lis3lv02d.h" | 41 | #include "lis3lv02d.h" |
@@ -52,24 +53,14 @@ | |||
52 | * joystick. | 53 | * joystick. |
53 | */ | 54 | */ |
54 | 55 | ||
55 | /* Maximum value our axis may get for the input device (signed 12 bits) */ | 56 | struct acpi_lis3lv02d adev = { |
56 | #define MDPS_MAX_VAL 2048 | 57 | .misc_wait = __WAIT_QUEUE_HEAD_INITIALIZER(adev.misc_wait), |
58 | }; | ||
57 | 59 | ||
58 | struct acpi_lis3lv02d adev; | ||
59 | EXPORT_SYMBOL_GPL(adev); | 60 | EXPORT_SYMBOL_GPL(adev); |
60 | 61 | ||
61 | static int lis3lv02d_add_fs(struct acpi_device *device); | 62 | static int lis3lv02d_add_fs(struct acpi_device *device); |
62 | 63 | ||
63 | static s16 lis3lv02d_read_16(acpi_handle handle, int reg) | ||
64 | { | ||
65 | u8 lo, hi; | ||
66 | |||
67 | adev.read(handle, reg, &lo); | ||
68 | adev.read(handle, reg + 1, &hi); | ||
69 | /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */ | ||
70 | return (s16)((hi << 8) | lo); | ||
71 | } | ||
72 | |||
73 | /** | 64 | /** |
74 | * lis3lv02d_get_axis - For the given axis, give the value converted | 65 | * lis3lv02d_get_axis - For the given axis, give the value converted |
75 | * @axis: 1,2,3 - can also be negative | 66 | * @axis: 1,2,3 - can also be negative |
@@ -98,9 +89,9 @@ static void lis3lv02d_get_xyz(acpi_handle handle, int *x, int *y, int *z) | |||
98 | { | 89 | { |
99 | int position[3]; | 90 | int position[3]; |
100 | 91 | ||
101 | position[0] = lis3lv02d_read_16(handle, OUTX_L); | 92 | position[0] = adev.read_data(handle, OUTX); |
102 | position[1] = lis3lv02d_read_16(handle, OUTY_L); | 93 | position[1] = adev.read_data(handle, OUTY); |
103 | position[2] = lis3lv02d_read_16(handle, OUTZ_L); | 94 | position[2] = adev.read_data(handle, OUTZ); |
104 | 95 | ||
105 | *x = lis3lv02d_get_axis(adev.ac.x, position); | 96 | *x = lis3lv02d_get_axis(adev.ac.x, position); |
106 | *y = lis3lv02d_get_axis(adev.ac.y, position); | 97 | *y = lis3lv02d_get_axis(adev.ac.y, position); |
@@ -110,26 +101,13 @@ static void lis3lv02d_get_xyz(acpi_handle handle, int *x, int *y, int *z) | |||
110 | void lis3lv02d_poweroff(acpi_handle handle) | 101 | void lis3lv02d_poweroff(acpi_handle handle) |
111 | { | 102 | { |
112 | adev.is_on = 0; | 103 | adev.is_on = 0; |
113 | /* disable X,Y,Z axis and power down */ | ||
114 | adev.write(handle, CTRL_REG1, 0x00); | ||
115 | } | 104 | } |
116 | EXPORT_SYMBOL_GPL(lis3lv02d_poweroff); | 105 | EXPORT_SYMBOL_GPL(lis3lv02d_poweroff); |
117 | 106 | ||
118 | void lis3lv02d_poweron(acpi_handle handle) | 107 | void lis3lv02d_poweron(acpi_handle handle) |
119 | { | 108 | { |
120 | u8 val; | ||
121 | |||
122 | adev.is_on = 1; | 109 | adev.is_on = 1; |
123 | adev.init(handle); | 110 | adev.init(handle); |
124 | adev.write(handle, FF_WU_CFG, 0); | ||
125 | /* | ||
126 | * BDU: LSB and MSB values are not updated until both have been read. | ||
127 | * So the value read will always be correct. | ||
128 | * IEN: Interrupt for free-fall and DD, not for data-ready. | ||
129 | */ | ||
130 | adev.read(handle, CTRL_REG2, &val); | ||
131 | val |= CTRL2_BDU | CTRL2_IEN; | ||
132 | adev.write(handle, CTRL_REG2, val); | ||
133 | } | 111 | } |
134 | EXPORT_SYMBOL_GPL(lis3lv02d_poweron); | 112 | EXPORT_SYMBOL_GPL(lis3lv02d_poweron); |
135 | 113 | ||
@@ -162,6 +140,140 @@ static void lis3lv02d_decrease_use(struct acpi_lis3lv02d *dev) | |||
162 | mutex_unlock(&dev->lock); | 140 | mutex_unlock(&dev->lock); |
163 | } | 141 | } |
164 | 142 | ||
143 | static irqreturn_t lis302dl_interrupt(int irq, void *dummy) | ||
144 | { | ||
145 | /* | ||
146 | * Be careful: on some HP laptops the bios force DD when on battery and | ||
147 | * the lid is closed. This leads to interrupts as soon as a little move | ||
148 | * is done. | ||
149 | */ | ||
150 | atomic_inc(&adev.count); | ||
151 | |||
152 | wake_up_interruptible(&adev.misc_wait); | ||
153 | kill_fasync(&adev.async_queue, SIGIO, POLL_IN); | ||
154 | return IRQ_HANDLED; | ||
155 | } | ||
156 | |||
157 | static int lis3lv02d_misc_open(struct inode *inode, struct file *file) | ||
158 | { | ||
159 | int ret; | ||
160 | |||
161 | if (test_and_set_bit(0, &adev.misc_opened)) | ||
162 | return -EBUSY; /* already open */ | ||
163 | |||
164 | atomic_set(&adev.count, 0); | ||
165 | |||
166 | /* | ||
167 | * The sensor can generate interrupts for free-fall and direction | ||
168 | * detection (distinguishable with FF_WU_SRC and DD_SRC) but to keep | ||
169 | * the things simple and _fast_ we activate it only for free-fall, so | ||
170 | * no need to read register (very slow with ACPI). For the same reason, | ||
171 | * we forbid shared interrupts. | ||
172 | * | ||
173 | * IRQF_TRIGGER_RISING seems pointless on HP laptops because the | ||
174 | * io-apic is not configurable (and generates a warning) but I keep it | ||
175 | * in case of support for other hardware. | ||
176 | */ | ||
177 | ret = request_irq(adev.irq, lis302dl_interrupt, IRQF_TRIGGER_RISING, | ||
178 | DRIVER_NAME, &adev); | ||
179 | |||
180 | if (ret) { | ||
181 | clear_bit(0, &adev.misc_opened); | ||
182 | printk(KERN_ERR DRIVER_NAME ": IRQ%d allocation failed\n", adev.irq); | ||
183 | return -EBUSY; | ||
184 | } | ||
185 | lis3lv02d_increase_use(&adev); | ||
186 | printk("lis3: registered interrupt %d\n", adev.irq); | ||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | static int lis3lv02d_misc_release(struct inode *inode, struct file *file) | ||
191 | { | ||
192 | fasync_helper(-1, file, 0, &adev.async_queue); | ||
193 | lis3lv02d_decrease_use(&adev); | ||
194 | free_irq(adev.irq, &adev); | ||
195 | clear_bit(0, &adev.misc_opened); /* release the device */ | ||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf, | ||
200 | size_t count, loff_t *pos) | ||
201 | { | ||
202 | DECLARE_WAITQUEUE(wait, current); | ||
203 | u32 data; | ||
204 | unsigned char byte_data; | ||
205 | ssize_t retval = 1; | ||
206 | |||
207 | if (count < 1) | ||
208 | return -EINVAL; | ||
209 | |||
210 | add_wait_queue(&adev.misc_wait, &wait); | ||
211 | while (true) { | ||
212 | set_current_state(TASK_INTERRUPTIBLE); | ||
213 | data = atomic_xchg(&adev.count, 0); | ||
214 | if (data) | ||
215 | break; | ||
216 | |||
217 | if (file->f_flags & O_NONBLOCK) { | ||
218 | retval = -EAGAIN; | ||
219 | goto out; | ||
220 | } | ||
221 | |||
222 | if (signal_pending(current)) { | ||
223 | retval = -ERESTARTSYS; | ||
224 | goto out; | ||
225 | } | ||
226 | |||
227 | schedule(); | ||
228 | } | ||
229 | |||
230 | if (data < 255) | ||
231 | byte_data = data; | ||
232 | else | ||
233 | byte_data = 255; | ||
234 | |||
235 | /* make sure we are not going into copy_to_user() with | ||
236 | * TASK_INTERRUPTIBLE state */ | ||
237 | set_current_state(TASK_RUNNING); | ||
238 | if (copy_to_user(buf, &byte_data, sizeof(byte_data))) | ||
239 | retval = -EFAULT; | ||
240 | |||
241 | out: | ||
242 | __set_current_state(TASK_RUNNING); | ||
243 | remove_wait_queue(&adev.misc_wait, &wait); | ||
244 | |||
245 | return retval; | ||
246 | } | ||
247 | |||
248 | static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait) | ||
249 | { | ||
250 | poll_wait(file, &adev.misc_wait, wait); | ||
251 | if (atomic_read(&adev.count)) | ||
252 | return POLLIN | POLLRDNORM; | ||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | static int lis3lv02d_misc_fasync(int fd, struct file *file, int on) | ||
257 | { | ||
258 | return fasync_helper(fd, file, on, &adev.async_queue); | ||
259 | } | ||
260 | |||
261 | static const struct file_operations lis3lv02d_misc_fops = { | ||
262 | .owner = THIS_MODULE, | ||
263 | .llseek = no_llseek, | ||
264 | .read = lis3lv02d_misc_read, | ||
265 | .open = lis3lv02d_misc_open, | ||
266 | .release = lis3lv02d_misc_release, | ||
267 | .poll = lis3lv02d_misc_poll, | ||
268 | .fasync = lis3lv02d_misc_fasync, | ||
269 | }; | ||
270 | |||
271 | static struct miscdevice lis3lv02d_misc_device = { | ||
272 | .minor = MISC_DYNAMIC_MINOR, | ||
273 | .name = "freefall", | ||
274 | .fops = &lis3lv02d_misc_fops, | ||
275 | }; | ||
276 | |||
165 | /** | 277 | /** |
166 | * lis3lv02d_joystick_kthread - Kthread polling function | 278 | * lis3lv02d_joystick_kthread - Kthread polling function |
167 | * @data: unused - here to conform to threadfn prototype | 279 | * @data: unused - here to conform to threadfn prototype |
@@ -203,7 +315,6 @@ static void lis3lv02d_joystick_close(struct input_dev *input) | |||
203 | lis3lv02d_decrease_use(&adev); | 315 | lis3lv02d_decrease_use(&adev); |
204 | } | 316 | } |
205 | 317 | ||
206 | |||
207 | static inline void lis3lv02d_calibrate_joystick(void) | 318 | static inline void lis3lv02d_calibrate_joystick(void) |
208 | { | 319 | { |
209 | lis3lv02d_get_xyz(adev.device->handle, &adev.xcalib, &adev.ycalib, &adev.zcalib); | 320 | lis3lv02d_get_xyz(adev.device->handle, &adev.xcalib, &adev.ycalib, &adev.zcalib); |
@@ -231,9 +342,9 @@ int lis3lv02d_joystick_enable(void) | |||
231 | adev.idev->close = lis3lv02d_joystick_close; | 342 | adev.idev->close = lis3lv02d_joystick_close; |
232 | 343 | ||
233 | set_bit(EV_ABS, adev.idev->evbit); | 344 | set_bit(EV_ABS, adev.idev->evbit); |
234 | input_set_abs_params(adev.idev, ABS_X, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3); | 345 | input_set_abs_params(adev.idev, ABS_X, -adev.mdps_max_val, adev.mdps_max_val, 3, 3); |
235 | input_set_abs_params(adev.idev, ABS_Y, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3); | 346 | input_set_abs_params(adev.idev, ABS_Y, -adev.mdps_max_val, adev.mdps_max_val, 3, 3); |
236 | input_set_abs_params(adev.idev, ABS_Z, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3); | 347 | input_set_abs_params(adev.idev, ABS_Z, -adev.mdps_max_val, adev.mdps_max_val, 3, 3); |
237 | 348 | ||
238 | err = input_register_device(adev.idev); | 349 | err = input_register_device(adev.idev); |
239 | if (err) { | 350 | if (err) { |
@@ -250,6 +361,7 @@ void lis3lv02d_joystick_disable(void) | |||
250 | if (!adev.idev) | 361 | if (!adev.idev) |
251 | return; | 362 | return; |
252 | 363 | ||
364 | misc_deregister(&lis3lv02d_misc_device); | ||
253 | input_unregister_device(adev.idev); | 365 | input_unregister_device(adev.idev); |
254 | adev.idev = NULL; | 366 | adev.idev = NULL; |
255 | } | 367 | } |
@@ -268,6 +380,19 @@ int lis3lv02d_init_device(struct acpi_lis3lv02d *dev) | |||
268 | if (lis3lv02d_joystick_enable()) | 380 | if (lis3lv02d_joystick_enable()) |
269 | printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n"); | 381 | printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n"); |
270 | 382 | ||
383 | printk("lis3_init_device: irq %d\n", dev->irq); | ||
384 | |||
385 | /* if we did not get an IRQ from ACPI - we have nothing more to do */ | ||
386 | if (!dev->irq) { | ||
387 | printk(KERN_ERR DRIVER_NAME | ||
388 | ": No IRQ in ACPI. Disabling /dev/freefall\n"); | ||
389 | goto out; | ||
390 | } | ||
391 | |||
392 | printk("lis3: registering device\n"); | ||
393 | if (misc_register(&lis3lv02d_misc_device)) | ||
394 | printk(KERN_ERR DRIVER_NAME ": misc_register failed\n"); | ||
395 | out: | ||
271 | lis3lv02d_decrease_use(dev); | 396 | lis3lv02d_decrease_use(dev); |
272 | return 0; | 397 | return 0; |
273 | } | 398 | } |
@@ -351,6 +476,6 @@ int lis3lv02d_remove_fs(void) | |||
351 | EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs); | 476 | EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs); |
352 | 477 | ||
353 | MODULE_DESCRIPTION("ST LIS3LV02Dx three-axis digital accelerometer driver"); | 478 | MODULE_DESCRIPTION("ST LIS3LV02Dx three-axis digital accelerometer driver"); |
354 | MODULE_AUTHOR("Yan Burman and Eric Piel"); | 479 | MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek"); |
355 | MODULE_LICENSE("GPL"); | 480 | MODULE_LICENSE("GPL"); |
356 | 481 | ||
diff --git a/drivers/hwmon/lis3lv02d.h b/drivers/hwmon/lis3lv02d.h index 223f1c0763bb..75972bf372ff 100644 --- a/drivers/hwmon/lis3lv02d.h +++ b/drivers/hwmon/lis3lv02d.h | |||
@@ -22,12 +22,15 @@ | |||
22 | /* | 22 | /* |
23 | * The actual chip is STMicroelectronics LIS3LV02DL or LIS3LV02DQ that seems to | 23 | * The actual chip is STMicroelectronics LIS3LV02DL or LIS3LV02DQ that seems to |
24 | * be connected via SPI. There exists also several similar chips (such as LIS302DL or | 24 | * be connected via SPI. There exists also several similar chips (such as LIS302DL or |
25 | * LIS3L02DQ) but not in the HP laptops and they have slightly different registers. | 25 | * LIS3L02DQ) and they have slightly different registers, but we can provide a |
26 | * common interface for all of them. | ||
26 | * They can also be connected via I²C. | 27 | * They can also be connected via I²C. |
27 | */ | 28 | */ |
28 | 29 | ||
29 | #define LIS3LV02DL_ID 0x3A /* Also the LIS3LV02DQ */ | 30 | /* 2-byte registers */ |
30 | #define LIS302DL_ID 0x3B /* Also the LIS202DL! */ | 31 | #define LIS_DOUBLE_ID 0x3A /* LIS3LV02D[LQ] */ |
32 | /* 1-byte registers */ | ||
33 | #define LIS_SINGLE_ID 0x3B /* LIS[32]02DL and others */ | ||
31 | 34 | ||
32 | enum lis3lv02d_reg { | 35 | enum lis3lv02d_reg { |
33 | WHO_AM_I = 0x0F, | 36 | WHO_AM_I = 0x0F, |
@@ -44,10 +47,13 @@ enum lis3lv02d_reg { | |||
44 | STATUS_REG = 0x27, | 47 | STATUS_REG = 0x27, |
45 | OUTX_L = 0x28, | 48 | OUTX_L = 0x28, |
46 | OUTX_H = 0x29, | 49 | OUTX_H = 0x29, |
50 | OUTX = 0x29, | ||
47 | OUTY_L = 0x2A, | 51 | OUTY_L = 0x2A, |
48 | OUTY_H = 0x2B, | 52 | OUTY_H = 0x2B, |
53 | OUTY = 0x2B, | ||
49 | OUTZ_L = 0x2C, | 54 | OUTZ_L = 0x2C, |
50 | OUTZ_H = 0x2D, | 55 | OUTZ_H = 0x2D, |
56 | OUTZ = 0x2D, | ||
51 | FF_WU_CFG = 0x30, | 57 | FF_WU_CFG = 0x30, |
52 | FF_WU_SRC = 0x31, | 58 | FF_WU_SRC = 0x31, |
53 | FF_WU_ACK = 0x32, | 59 | FF_WU_ACK = 0x32, |
@@ -159,6 +165,10 @@ struct acpi_lis3lv02d { | |||
159 | acpi_status (*write) (acpi_handle handle, int reg, u8 val); | 165 | acpi_status (*write) (acpi_handle handle, int reg, u8 val); |
160 | acpi_status (*read) (acpi_handle handle, int reg, u8 *ret); | 166 | acpi_status (*read) (acpi_handle handle, int reg, u8 *ret); |
161 | 167 | ||
168 | u8 whoami; /* 3Ah: 2-byte registries, 3Bh: 1-byte registries */ | ||
169 | s16 (*read_data) (acpi_handle handle, int reg); | ||
170 | int mdps_max_val; | ||
171 | |||
162 | struct input_dev *idev; /* input device */ | 172 | struct input_dev *idev; /* input device */ |
163 | struct task_struct *kthread; /* kthread for input */ | 173 | struct task_struct *kthread; /* kthread for input */ |
164 | struct mutex lock; | 174 | struct mutex lock; |
@@ -170,6 +180,11 @@ struct acpi_lis3lv02d { | |||
170 | unsigned char is_on; /* whether the device is on or off */ | 180 | unsigned char is_on; /* whether the device is on or off */ |
171 | unsigned char usage; /* usage counter */ | 181 | unsigned char usage; /* usage counter */ |
172 | struct axis_conversion ac; /* hw -> logical axis */ | 182 | struct axis_conversion ac; /* hw -> logical axis */ |
183 | |||
184 | u32 irq; /* IRQ number */ | ||
185 | struct fasync_struct *async_queue; /* queue for the misc device */ | ||
186 | wait_queue_head_t misc_wait; /* Wait queue for the misc device */ | ||
187 | unsigned long misc_opened; /* bit0: whether the device is open */ | ||
173 | }; | 188 | }; |
174 | 189 | ||
175 | int lis3lv02d_init_device(struct acpi_lis3lv02d *dev); | 190 | int lis3lv02d_init_device(struct acpi_lis3lv02d *dev); |
diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c index b0ce37852281..73f77a9b8b18 100644 --- a/drivers/hwmon/vt1211.c +++ b/drivers/hwmon/vt1211.c | |||
@@ -1262,7 +1262,7 @@ static int __init vt1211_device_add(unsigned short address) | |||
1262 | res.name = pdev->name; | 1262 | res.name = pdev->name; |
1263 | err = acpi_check_resource_conflict(&res); | 1263 | err = acpi_check_resource_conflict(&res); |
1264 | if (err) | 1264 | if (err) |
1265 | goto EXIT; | 1265 | goto EXIT_DEV_PUT; |
1266 | 1266 | ||
1267 | err = platform_device_add_resources(pdev, &res, 1); | 1267 | err = platform_device_add_resources(pdev, &res, 1); |
1268 | if (err) { | 1268 | if (err) { |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index cb808d015361..feae743ba991 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -1548,7 +1548,7 @@ static int __init sensors_w83627ehf_init(void) | |||
1548 | 1548 | ||
1549 | err = acpi_check_resource_conflict(&res); | 1549 | err = acpi_check_resource_conflict(&res); |
1550 | if (err) | 1550 | if (err) |
1551 | goto exit; | 1551 | goto exit_device_put; |
1552 | 1552 | ||
1553 | err = platform_device_add_resources(pdev, &res, 1); | 1553 | err = platform_device_add_resources(pdev, &res, 1); |
1554 | if (err) { | 1554 | if (err) { |
diff --git a/drivers/lguest/Kconfig b/drivers/lguest/Kconfig index 76f2b36881c3..a3d3cbab359a 100644 --- a/drivers/lguest/Kconfig +++ b/drivers/lguest/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config LGUEST | 1 | config LGUEST |
2 | tristate "Linux hypervisor example code" | 2 | tristate "Linux hypervisor example code" |
3 | depends on X86_32 && EXPERIMENTAL && !X86_PAE && FUTEX && !X86_VOYAGER | 3 | depends on X86_32 && EXPERIMENTAL && !X86_PAE && FUTEX |
4 | select HVC_DRIVER | 4 | select HVC_DRIVER |
5 | ---help--- | 5 | ---help--- |
6 | This is a very simple module which allows you to run | 6 | This is a very simple module which allows you to run |
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index a34338567a2a..f14813be4eff 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -328,7 +328,7 @@ static void dispatch_io(int rw, unsigned int num_regions, | |||
328 | struct dpages old_pages = *dp; | 328 | struct dpages old_pages = *dp; |
329 | 329 | ||
330 | if (sync) | 330 | if (sync) |
331 | rw |= (1 << BIO_RW_SYNC); | 331 | rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); |
332 | 332 | ||
333 | /* | 333 | /* |
334 | * For multiple regions we need to be careful to rewind | 334 | * For multiple regions we need to be careful to rewind |
diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c index 3073618269ea..0a225da21272 100644 --- a/drivers/md/dm-kcopyd.c +++ b/drivers/md/dm-kcopyd.c | |||
@@ -344,7 +344,7 @@ static int run_io_job(struct kcopyd_job *job) | |||
344 | { | 344 | { |
345 | int r; | 345 | int r; |
346 | struct dm_io_request io_req = { | 346 | struct dm_io_request io_req = { |
347 | .bi_rw = job->rw | (1 << BIO_RW_SYNC), | 347 | .bi_rw = job->rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG), |
348 | .mem.type = DM_IO_PAGE_LIST, | 348 | .mem.type = DM_IO_PAGE_LIST, |
349 | .mem.ptr.pl = job->pages, | 349 | .mem.ptr.pl = job->pages, |
350 | .mem.offset = job->offset, | 350 | .mem.offset = job->offset, |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 4495104f6c9f..03b4cd0a6344 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -474,7 +474,7 @@ void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, | |||
474 | * causes ENOTSUPP, we allocate a spare bio... | 474 | * causes ENOTSUPP, we allocate a spare bio... |
475 | */ | 475 | */ |
476 | struct bio *bio = bio_alloc(GFP_NOIO, 1); | 476 | struct bio *bio = bio_alloc(GFP_NOIO, 1); |
477 | int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNC); | 477 | int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNCIO) | (1<<BIO_RW_UNPLUG); |
478 | 478 | ||
479 | bio->bi_bdev = rdev->bdev; | 479 | bio->bi_bdev = rdev->bdev; |
480 | bio->bi_sector = sector; | 480 | bio->bi_sector = sector; |
@@ -531,7 +531,7 @@ int sync_page_io(struct block_device *bdev, sector_t sector, int size, | |||
531 | struct completion event; | 531 | struct completion event; |
532 | int ret; | 532 | int ret; |
533 | 533 | ||
534 | rw |= (1 << BIO_RW_SYNC); | 534 | rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); |
535 | 535 | ||
536 | bio->bi_bdev = bdev; | 536 | bio->bi_bdev = bdev; |
537 | bio->bi_sector = sector; | 537 | bio->bi_sector = sector; |
diff --git a/drivers/media/common/tuners/tuner-simple.c b/drivers/media/common/tuners/tuner-simple.c index de7adaf5fa5b..78412c9c424a 100644 --- a/drivers/media/common/tuners/tuner-simple.c +++ b/drivers/media/common/tuners/tuner-simple.c | |||
@@ -318,7 +318,6 @@ static int simple_std_setup(struct dvb_frontend *fe, | |||
318 | u8 *config, u8 *cb) | 318 | u8 *config, u8 *cb) |
319 | { | 319 | { |
320 | struct tuner_simple_priv *priv = fe->tuner_priv; | 320 | struct tuner_simple_priv *priv = fe->tuner_priv; |
321 | u8 tuneraddr; | ||
322 | int rc; | 321 | int rc; |
323 | 322 | ||
324 | /* tv norm specific stuff for multi-norm tuners */ | 323 | /* tv norm specific stuff for multi-norm tuners */ |
@@ -387,6 +386,7 @@ static int simple_std_setup(struct dvb_frontend *fe, | |||
387 | 386 | ||
388 | case TUNER_PHILIPS_TUV1236D: | 387 | case TUNER_PHILIPS_TUV1236D: |
389 | { | 388 | { |
389 | struct tuner_i2c_props i2c = priv->i2c_props; | ||
390 | /* 0x40 -> ATSC antenna input 1 */ | 390 | /* 0x40 -> ATSC antenna input 1 */ |
391 | /* 0x48 -> ATSC antenna input 2 */ | 391 | /* 0x48 -> ATSC antenna input 2 */ |
392 | /* 0x00 -> NTSC antenna input 1 */ | 392 | /* 0x00 -> NTSC antenna input 1 */ |
@@ -398,17 +398,15 @@ static int simple_std_setup(struct dvb_frontend *fe, | |||
398 | buffer[1] = 0x04; | 398 | buffer[1] = 0x04; |
399 | } | 399 | } |
400 | /* set to the correct mode (analog or digital) */ | 400 | /* set to the correct mode (analog or digital) */ |
401 | tuneraddr = priv->i2c_props.addr; | 401 | i2c.addr = 0x0a; |
402 | priv->i2c_props.addr = 0x0a; | 402 | rc = tuner_i2c_xfer_send(&i2c, &buffer[0], 2); |
403 | rc = tuner_i2c_xfer_send(&priv->i2c_props, &buffer[0], 2); | ||
404 | if (2 != rc) | 403 | if (2 != rc) |
405 | tuner_warn("i2c i/o error: rc == %d " | 404 | tuner_warn("i2c i/o error: rc == %d " |
406 | "(should be 2)\n", rc); | 405 | "(should be 2)\n", rc); |
407 | rc = tuner_i2c_xfer_send(&priv->i2c_props, &buffer[2], 2); | 406 | rc = tuner_i2c_xfer_send(&i2c, &buffer[2], 2); |
408 | if (2 != rc) | 407 | if (2 != rc) |
409 | tuner_warn("i2c i/o error: rc == %d " | 408 | tuner_warn("i2c i/o error: rc == %d " |
410 | "(should be 2)\n", rc); | 409 | "(should be 2)\n", rc); |
411 | priv->i2c_props.addr = tuneraddr; | ||
412 | break; | 410 | break; |
413 | } | 411 | } |
414 | } | 412 | } |
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c index 0c733c66a441..069d847ba887 100644 --- a/drivers/media/dvb/dvb-core/dmxdev.c +++ b/drivers/media/dvb/dvb-core/dmxdev.c | |||
@@ -364,16 +364,15 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len, | |||
364 | enum dmx_success success) | 364 | enum dmx_success success) |
365 | { | 365 | { |
366 | struct dmxdev_filter *dmxdevfilter = filter->priv; | 366 | struct dmxdev_filter *dmxdevfilter = filter->priv; |
367 | unsigned long flags; | ||
368 | int ret; | 367 | int ret; |
369 | 368 | ||
370 | if (dmxdevfilter->buffer.error) { | 369 | if (dmxdevfilter->buffer.error) { |
371 | wake_up(&dmxdevfilter->buffer.queue); | 370 | wake_up(&dmxdevfilter->buffer.queue); |
372 | return 0; | 371 | return 0; |
373 | } | 372 | } |
374 | spin_lock_irqsave(&dmxdevfilter->dev->lock, flags); | 373 | spin_lock(&dmxdevfilter->dev->lock); |
375 | if (dmxdevfilter->state != DMXDEV_STATE_GO) { | 374 | if (dmxdevfilter->state != DMXDEV_STATE_GO) { |
376 | spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); | 375 | spin_unlock(&dmxdevfilter->dev->lock); |
377 | return 0; | 376 | return 0; |
378 | } | 377 | } |
379 | del_timer(&dmxdevfilter->timer); | 378 | del_timer(&dmxdevfilter->timer); |
@@ -392,7 +391,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len, | |||
392 | } | 391 | } |
393 | if (dmxdevfilter->params.sec.flags & DMX_ONESHOT) | 392 | if (dmxdevfilter->params.sec.flags & DMX_ONESHOT) |
394 | dmxdevfilter->state = DMXDEV_STATE_DONE; | 393 | dmxdevfilter->state = DMXDEV_STATE_DONE; |
395 | spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); | 394 | spin_unlock(&dmxdevfilter->dev->lock); |
396 | wake_up(&dmxdevfilter->buffer.queue); | 395 | wake_up(&dmxdevfilter->buffer.queue); |
397 | return 0; | 396 | return 0; |
398 | } | 397 | } |
@@ -404,12 +403,11 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len, | |||
404 | { | 403 | { |
405 | struct dmxdev_filter *dmxdevfilter = feed->priv; | 404 | struct dmxdev_filter *dmxdevfilter = feed->priv; |
406 | struct dvb_ringbuffer *buffer; | 405 | struct dvb_ringbuffer *buffer; |
407 | unsigned long flags; | ||
408 | int ret; | 406 | int ret; |
409 | 407 | ||
410 | spin_lock_irqsave(&dmxdevfilter->dev->lock, flags); | 408 | spin_lock(&dmxdevfilter->dev->lock); |
411 | if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) { | 409 | if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) { |
412 | spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); | 410 | spin_unlock(&dmxdevfilter->dev->lock); |
413 | return 0; | 411 | return 0; |
414 | } | 412 | } |
415 | 413 | ||
@@ -419,7 +417,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len, | |||
419 | else | 417 | else |
420 | buffer = &dmxdevfilter->dev->dvr_buffer; | 418 | buffer = &dmxdevfilter->dev->dvr_buffer; |
421 | if (buffer->error) { | 419 | if (buffer->error) { |
422 | spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); | 420 | spin_unlock(&dmxdevfilter->dev->lock); |
423 | wake_up(&buffer->queue); | 421 | wake_up(&buffer->queue); |
424 | return 0; | 422 | return 0; |
425 | } | 423 | } |
@@ -430,7 +428,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len, | |||
430 | dvb_ringbuffer_flush(buffer); | 428 | dvb_ringbuffer_flush(buffer); |
431 | buffer->error = ret; | 429 | buffer->error = ret; |
432 | } | 430 | } |
433 | spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags); | 431 | spin_unlock(&dmxdevfilter->dev->lock); |
434 | wake_up(&buffer->queue); | 432 | wake_up(&buffer->queue); |
435 | return 0; | 433 | return 0; |
436 | } | 434 | } |
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c index a2c1fd5d2f67..e2eca0b1fe7c 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/drivers/media/dvb/dvb-core/dvb_demux.c | |||
@@ -399,9 +399,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) | |||
399 | void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, | 399 | void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, |
400 | size_t count) | 400 | size_t count) |
401 | { | 401 | { |
402 | unsigned long flags; | 402 | spin_lock(&demux->lock); |
403 | |||
404 | spin_lock_irqsave(&demux->lock, flags); | ||
405 | 403 | ||
406 | while (count--) { | 404 | while (count--) { |
407 | if (buf[0] == 0x47) | 405 | if (buf[0] == 0x47) |
@@ -409,17 +407,16 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, | |||
409 | buf += 188; | 407 | buf += 188; |
410 | } | 408 | } |
411 | 409 | ||
412 | spin_unlock_irqrestore(&demux->lock, flags); | 410 | spin_unlock(&demux->lock); |
413 | } | 411 | } |
414 | 412 | ||
415 | EXPORT_SYMBOL(dvb_dmx_swfilter_packets); | 413 | EXPORT_SYMBOL(dvb_dmx_swfilter_packets); |
416 | 414 | ||
417 | void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) | 415 | void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) |
418 | { | 416 | { |
419 | unsigned long flags; | ||
420 | int p = 0, i, j; | 417 | int p = 0, i, j; |
421 | 418 | ||
422 | spin_lock_irqsave(&demux->lock, flags); | 419 | spin_lock(&demux->lock); |
423 | 420 | ||
424 | if (demux->tsbufp) { | 421 | if (demux->tsbufp) { |
425 | i = demux->tsbufp; | 422 | i = demux->tsbufp; |
@@ -452,18 +449,17 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) | |||
452 | } | 449 | } |
453 | 450 | ||
454 | bailout: | 451 | bailout: |
455 | spin_unlock_irqrestore(&demux->lock, flags); | 452 | spin_unlock(&demux->lock); |
456 | } | 453 | } |
457 | 454 | ||
458 | EXPORT_SYMBOL(dvb_dmx_swfilter); | 455 | EXPORT_SYMBOL(dvb_dmx_swfilter); |
459 | 456 | ||
460 | void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) | 457 | void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) |
461 | { | 458 | { |
462 | unsigned long flags; | ||
463 | int p = 0, i, j; | 459 | int p = 0, i, j; |
464 | u8 tmppack[188]; | 460 | u8 tmppack[188]; |
465 | 461 | ||
466 | spin_lock_irqsave(&demux->lock, flags); | 462 | spin_lock(&demux->lock); |
467 | 463 | ||
468 | if (demux->tsbufp) { | 464 | if (demux->tsbufp) { |
469 | i = demux->tsbufp; | 465 | i = demux->tsbufp; |
@@ -504,7 +500,7 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) | |||
504 | } | 500 | } |
505 | 501 | ||
506 | bailout: | 502 | bailout: |
507 | spin_unlock_irqrestore(&demux->lock, flags); | 503 | spin_unlock(&demux->lock); |
508 | } | 504 | } |
509 | 505 | ||
510 | EXPORT_SYMBOL(dvb_dmx_swfilter_204); | 506 | EXPORT_SYMBOL(dvb_dmx_swfilter_204); |
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 67cbce82cb91..4dfed6aa2dbc 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -98,11 +98,16 @@ | |||
98 | * - blacklisted KWorld radio in hid-core.c and hid-ids.h | 98 | * - blacklisted KWorld radio in hid-core.c and hid-ids.h |
99 | * 2008-12-03 Mark Lord <mlord@pobox.com> | 99 | * 2008-12-03 Mark Lord <mlord@pobox.com> |
100 | * - add support for DealExtreme USB Radio | 100 | * - add support for DealExtreme USB Radio |
101 | * 2009-01-31 Bob Ross <pigiron@gmx.com> | ||
102 | * - correction of stereo detection/setting | ||
103 | * - correction of signal strength indicator scaling | ||
104 | * 2009-01-31 Rick Bronson <rick@efn.org> | ||
105 | * Tobias Lorenz <tobias.lorenz@gmx.net> | ||
106 | * - add LED status output | ||
101 | * | 107 | * |
102 | * ToDo: | 108 | * ToDo: |
103 | * - add firmware download/update support | 109 | * - add firmware download/update support |
104 | * - RDS support: interrupt mode, instead of polling | 110 | * - RDS support: interrupt mode, instead of polling |
105 | * - add LED status output (check if that's not already done in firmware) | ||
106 | */ | 111 | */ |
107 | 112 | ||
108 | 113 | ||
@@ -882,6 +887,30 @@ static int si470x_rds_on(struct si470x_device *radio) | |||
882 | 887 | ||
883 | 888 | ||
884 | /************************************************************************** | 889 | /************************************************************************** |
890 | * General Driver Functions - LED_REPORT | ||
891 | **************************************************************************/ | ||
892 | |||
893 | /* | ||
894 | * si470x_set_led_state - sets the led state | ||
895 | */ | ||
896 | static int si470x_set_led_state(struct si470x_device *radio, | ||
897 | unsigned char led_state) | ||
898 | { | ||
899 | unsigned char buf[LED_REPORT_SIZE]; | ||
900 | int retval; | ||
901 | |||
902 | buf[0] = LED_REPORT; | ||
903 | buf[1] = LED_COMMAND; | ||
904 | buf[2] = led_state; | ||
905 | |||
906 | retval = si470x_set_report(radio, (void *) &buf, sizeof(buf)); | ||
907 | |||
908 | return (retval < 0) ? -EINVAL : 0; | ||
909 | } | ||
910 | |||
911 | |||
912 | |||
913 | /************************************************************************** | ||
885 | * RDS Driver Functions | 914 | * RDS Driver Functions |
886 | **************************************************************************/ | 915 | **************************************************************************/ |
887 | 916 | ||
@@ -1385,20 +1414,22 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, | |||
1385 | }; | 1414 | }; |
1386 | 1415 | ||
1387 | /* stereo indicator == stereo (instead of mono) */ | 1416 | /* stereo indicator == stereo (instead of mono) */ |
1388 | if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 1) | 1417 | if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 0) |
1389 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | ||
1390 | else | ||
1391 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO; | 1418 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO; |
1419 | else | ||
1420 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | ||
1392 | 1421 | ||
1393 | /* mono/stereo selector */ | 1422 | /* mono/stereo selector */ |
1394 | if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 1) | 1423 | if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 0) |
1395 | tuner->audmode = V4L2_TUNER_MODE_MONO; | ||
1396 | else | ||
1397 | tuner->audmode = V4L2_TUNER_MODE_STEREO; | 1424 | tuner->audmode = V4L2_TUNER_MODE_STEREO; |
1425 | else | ||
1426 | tuner->audmode = V4L2_TUNER_MODE_MONO; | ||
1398 | 1427 | ||
1399 | /* min is worst, max is best; signal:0..0xffff; rssi: 0..0xff */ | 1428 | /* min is worst, max is best; signal:0..0xffff; rssi: 0..0xff */ |
1400 | tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI) | 1429 | /* measured in units of dbµV in 1 db increments (max at ~75 dbµV) */ |
1401 | * 0x0101; | 1430 | tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI); |
1431 | /* the ideal factor is 0xffff/75 = 873,8 */ | ||
1432 | tuner->signal = (tuner->signal * 873) + (8 * tuner->signal / 10); | ||
1402 | 1433 | ||
1403 | /* automatic frequency control: -1: freq to low, 1 freq to high */ | 1434 | /* automatic frequency control: -1: freq to low, 1 freq to high */ |
1404 | /* AFCRL does only indicate that freq. differs, not if too low/high */ | 1435 | /* AFCRL does only indicate that freq. differs, not if too low/high */ |
@@ -1632,6 +1663,9 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, | |||
1632 | /* set initial frequency */ | 1663 | /* set initial frequency */ |
1633 | si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */ | 1664 | si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */ |
1634 | 1665 | ||
1666 | /* set led to connect state */ | ||
1667 | si470x_set_led_state(radio, BLINK_GREEN_LED); | ||
1668 | |||
1635 | /* rds buffer allocation */ | 1669 | /* rds buffer allocation */ |
1636 | radio->buf_size = rds_buf * 3; | 1670 | radio->buf_size = rds_buf * 3; |
1637 | radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); | 1671 | radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); |
@@ -1715,6 +1749,9 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf) | |||
1715 | cancel_delayed_work_sync(&radio->work); | 1749 | cancel_delayed_work_sync(&radio->work); |
1716 | usb_set_intfdata(intf, NULL); | 1750 | usb_set_intfdata(intf, NULL); |
1717 | if (radio->users == 0) { | 1751 | if (radio->users == 0) { |
1752 | /* set led to disconnect state */ | ||
1753 | si470x_set_led_state(radio, BLINK_ORANGE_LED); | ||
1754 | |||
1718 | video_unregister_device(radio->videodev); | 1755 | video_unregister_device(radio->videodev); |
1719 | kfree(radio->buffer); | 1756 | kfree(radio->buffer); |
1720 | kfree(radio); | 1757 | kfree(radio); |
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 2ed24527ecd6..65e4901f4db7 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -422,6 +422,7 @@ static void destroy_urbs(struct gspca_dev *gspca_dev) | |||
422 | if (urb == NULL) | 422 | if (urb == NULL) |
423 | break; | 423 | break; |
424 | 424 | ||
425 | BUG_ON(!gspca_dev->dev); | ||
425 | gspca_dev->urb[i] = NULL; | 426 | gspca_dev->urb[i] = NULL; |
426 | if (!gspca_dev->present) | 427 | if (!gspca_dev->present) |
427 | usb_kill_urb(urb); | 428 | usb_kill_urb(urb); |
@@ -1950,8 +1951,12 @@ void gspca_disconnect(struct usb_interface *intf) | |||
1950 | { | 1951 | { |
1951 | struct gspca_dev *gspca_dev = usb_get_intfdata(intf); | 1952 | struct gspca_dev *gspca_dev = usb_get_intfdata(intf); |
1952 | 1953 | ||
1954 | mutex_lock(&gspca_dev->usb_lock); | ||
1953 | gspca_dev->present = 0; | 1955 | gspca_dev->present = 0; |
1956 | mutex_unlock(&gspca_dev->usb_lock); | ||
1954 | 1957 | ||
1958 | destroy_urbs(gspca_dev); | ||
1959 | gspca_dev->dev = NULL; | ||
1955 | usb_set_intfdata(intf, NULL); | 1960 | usb_set_intfdata(intf, NULL); |
1956 | 1961 | ||
1957 | /* release the device */ | 1962 | /* release the device */ |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index f6b3ef6e691b..c13bd2aa0bea 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -393,7 +393,7 @@ static int ivtv_g_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_fo | |||
393 | return 0; | 393 | return 0; |
394 | } | 394 | } |
395 | 395 | ||
396 | v4l2_subdev_call(itv->sd_video, video, s_fmt, fmt); | 396 | v4l2_subdev_call(itv->sd_video, video, g_fmt, fmt); |
397 | vbifmt->service_set = ivtv_get_service_set(vbifmt); | 397 | vbifmt->service_set = ivtv_get_service_set(vbifmt); |
398 | return 0; | 398 | return 0; |
399 | } | 399 | } |
@@ -1748,6 +1748,18 @@ static long ivtv_default(struct file *file, void *fh, int cmd, void *arg) | |||
1748 | break; | 1748 | break; |
1749 | } | 1749 | } |
1750 | 1750 | ||
1751 | case IVTV_IOC_DMA_FRAME: | ||
1752 | case VIDEO_GET_PTS: | ||
1753 | case VIDEO_GET_FRAME_COUNT: | ||
1754 | case VIDEO_GET_EVENT: | ||
1755 | case VIDEO_PLAY: | ||
1756 | case VIDEO_STOP: | ||
1757 | case VIDEO_FREEZE: | ||
1758 | case VIDEO_CONTINUE: | ||
1759 | case VIDEO_COMMAND: | ||
1760 | case VIDEO_TRY_COMMAND: | ||
1761 | return ivtv_decoder_ioctls(file, cmd, (void *)arg); | ||
1762 | |||
1751 | default: | 1763 | default: |
1752 | return -EINVAL; | 1764 | return -EINVAL; |
1753 | } | 1765 | } |
@@ -1790,18 +1802,6 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, | |||
1790 | ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); | 1802 | ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); |
1791 | return 0; | 1803 | return 0; |
1792 | 1804 | ||
1793 | case IVTV_IOC_DMA_FRAME: | ||
1794 | case VIDEO_GET_PTS: | ||
1795 | case VIDEO_GET_FRAME_COUNT: | ||
1796 | case VIDEO_GET_EVENT: | ||
1797 | case VIDEO_PLAY: | ||
1798 | case VIDEO_STOP: | ||
1799 | case VIDEO_FREEZE: | ||
1800 | case VIDEO_CONTINUE: | ||
1801 | case VIDEO_COMMAND: | ||
1802 | case VIDEO_TRY_COMMAND: | ||
1803 | return ivtv_decoder_ioctls(filp, cmd, (void *)arg); | ||
1804 | |||
1805 | default: | 1805 | default: |
1806 | break; | 1806 | break; |
1807 | } | 1807 | } |
diff --git a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c index 1a4d04664d6d..aa266e1f69b2 100644 --- a/drivers/mfd/htc-egpio.c +++ b/drivers/mfd/htc-egpio.c | |||
@@ -286,7 +286,7 @@ static int __init egpio_probe(struct platform_device *pdev) | |||
286 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 286 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
287 | if (!res) | 287 | if (!res) |
288 | goto fail; | 288 | goto fail; |
289 | ei->base_addr = ioremap_nocache(res->start, res->end - res->start); | 289 | ei->base_addr = ioremap_nocache(res->start, resource_size(res)); |
290 | if (!ei->base_addr) | 290 | if (!ei->base_addr) |
291 | goto fail; | 291 | goto fail; |
292 | pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr); | 292 | pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr); |
@@ -307,7 +307,7 @@ static int __init egpio_probe(struct platform_device *pdev) | |||
307 | 307 | ||
308 | ei->nchips = pdata->num_chips; | 308 | ei->nchips = pdata->num_chips; |
309 | ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL); | 309 | ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL); |
310 | if (!ei) { | 310 | if (!ei->chip) { |
311 | ret = -ENOMEM; | 311 | ret = -ENOMEM; |
312 | goto fail; | 312 | goto fail; |
313 | } | 313 | } |
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c index ea9488e7ad6d..2e36057659e1 100644 --- a/drivers/mfd/pcf50633-core.c +++ b/drivers/mfd/pcf50633-core.c | |||
@@ -678,6 +678,7 @@ static int __devexit pcf50633_remove(struct i2c_client *client) | |||
678 | 678 | ||
679 | static struct i2c_device_id pcf50633_id_table[] = { | 679 | static struct i2c_device_id pcf50633_id_table[] = { |
680 | {"pcf50633", 0x73}, | 680 | {"pcf50633", 0x73}, |
681 | {/* end of list */} | ||
681 | }; | 682 | }; |
682 | 683 | ||
683 | static struct i2c_driver pcf50633_driver = { | 684 | static struct i2c_driver pcf50633_driver = { |
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 0e5761f12634..4c7b7962f6b8 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c | |||
@@ -1050,7 +1050,7 @@ static int __devinit sm501_gpio_register_chip(struct sm501_devdata *sm, | |||
1050 | return gpiochip_add(gchip); | 1050 | return gpiochip_add(gchip); |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | static int sm501_register_gpio(struct sm501_devdata *sm) | 1053 | static int __devinit sm501_register_gpio(struct sm501_devdata *sm) |
1054 | { | 1054 | { |
1055 | struct sm501_gpio *gpio = &sm->gpio; | 1055 | struct sm501_gpio *gpio = &sm->gpio; |
1056 | resource_size_t iobase = sm->io_res->start + SM501_GPIO; | 1056 | resource_size_t iobase = sm->io_res->start + SM501_GPIO; |
@@ -1321,7 +1321,7 @@ static unsigned int sm501_mem_local[] = { | |||
1321 | * Common init code for an SM501 | 1321 | * Common init code for an SM501 |
1322 | */ | 1322 | */ |
1323 | 1323 | ||
1324 | static int sm501_init_dev(struct sm501_devdata *sm) | 1324 | static int __devinit sm501_init_dev(struct sm501_devdata *sm) |
1325 | { | 1325 | { |
1326 | struct sm501_initdata *idata; | 1326 | struct sm501_initdata *idata; |
1327 | struct sm501_platdata *pdata; | 1327 | struct sm501_platdata *pdata; |
@@ -1397,7 +1397,7 @@ static int sm501_init_dev(struct sm501_devdata *sm) | |||
1397 | return 0; | 1397 | return 0; |
1398 | } | 1398 | } |
1399 | 1399 | ||
1400 | static int sm501_plat_probe(struct platform_device *dev) | 1400 | static int __devinit sm501_plat_probe(struct platform_device *dev) |
1401 | { | 1401 | { |
1402 | struct sm501_devdata *sm; | 1402 | struct sm501_devdata *sm; |
1403 | int ret; | 1403 | int ret; |
@@ -1586,8 +1586,8 @@ static struct sm501_platdata sm501_pci_platdata = { | |||
1586 | .gpio_base = -1, | 1586 | .gpio_base = -1, |
1587 | }; | 1587 | }; |
1588 | 1588 | ||
1589 | static int sm501_pci_probe(struct pci_dev *dev, | 1589 | static int __devinit sm501_pci_probe(struct pci_dev *dev, |
1590 | const struct pci_device_id *id) | 1590 | const struct pci_device_id *id) |
1591 | { | 1591 | { |
1592 | struct sm501_devdata *sm; | 1592 | struct sm501_devdata *sm; |
1593 | int err; | 1593 | int err; |
@@ -1693,7 +1693,7 @@ static void sm501_dev_remove(struct sm501_devdata *sm) | |||
1693 | sm501_gpio_remove(sm); | 1693 | sm501_gpio_remove(sm); |
1694 | } | 1694 | } |
1695 | 1695 | ||
1696 | static void sm501_pci_remove(struct pci_dev *dev) | 1696 | static void __devexit sm501_pci_remove(struct pci_dev *dev) |
1697 | { | 1697 | { |
1698 | struct sm501_devdata *sm = pci_get_drvdata(dev); | 1698 | struct sm501_devdata *sm = pci_get_drvdata(dev); |
1699 | 1699 | ||
@@ -1727,16 +1727,16 @@ static struct pci_device_id sm501_pci_tbl[] = { | |||
1727 | 1727 | ||
1728 | MODULE_DEVICE_TABLE(pci, sm501_pci_tbl); | 1728 | MODULE_DEVICE_TABLE(pci, sm501_pci_tbl); |
1729 | 1729 | ||
1730 | static struct pci_driver sm501_pci_drv = { | 1730 | static struct pci_driver sm501_pci_driver = { |
1731 | .name = "sm501", | 1731 | .name = "sm501", |
1732 | .id_table = sm501_pci_tbl, | 1732 | .id_table = sm501_pci_tbl, |
1733 | .probe = sm501_pci_probe, | 1733 | .probe = sm501_pci_probe, |
1734 | .remove = sm501_pci_remove, | 1734 | .remove = __devexit_p(sm501_pci_remove), |
1735 | }; | 1735 | }; |
1736 | 1736 | ||
1737 | MODULE_ALIAS("platform:sm501"); | 1737 | MODULE_ALIAS("platform:sm501"); |
1738 | 1738 | ||
1739 | static struct platform_driver sm501_plat_drv = { | 1739 | static struct platform_driver sm501_plat_driver = { |
1740 | .driver = { | 1740 | .driver = { |
1741 | .name = "sm501", | 1741 | .name = "sm501", |
1742 | .owner = THIS_MODULE, | 1742 | .owner = THIS_MODULE, |
@@ -1749,14 +1749,14 @@ static struct platform_driver sm501_plat_drv = { | |||
1749 | 1749 | ||
1750 | static int __init sm501_base_init(void) | 1750 | static int __init sm501_base_init(void) |
1751 | { | 1751 | { |
1752 | platform_driver_register(&sm501_plat_drv); | 1752 | platform_driver_register(&sm501_plat_driver); |
1753 | return pci_register_driver(&sm501_pci_drv); | 1753 | return pci_register_driver(&sm501_pci_driver); |
1754 | } | 1754 | } |
1755 | 1755 | ||
1756 | static void __exit sm501_base_exit(void) | 1756 | static void __exit sm501_base_exit(void) |
1757 | { | 1757 | { |
1758 | platform_driver_unregister(&sm501_plat_drv); | 1758 | platform_driver_unregister(&sm501_plat_driver); |
1759 | pci_unregister_driver(&sm501_pci_drv); | 1759 | pci_unregister_driver(&sm501_pci_driver); |
1760 | } | 1760 | } |
1761 | 1761 | ||
1762 | module_init(sm501_base_init); | 1762 | module_init(sm501_base_init); |
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c index e7ab0035d305..68826f1e36bc 100644 --- a/drivers/mfd/twl4030-core.c +++ b/drivers/mfd/twl4030-core.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <linux/i2c.h> | 38 | #include <linux/i2c.h> |
39 | #include <linux/i2c/twl4030.h> | 39 | #include <linux/i2c/twl4030.h> |
40 | 40 | ||
41 | #ifdef CONFIG_ARM | 41 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) |
42 | #include <mach/cpu.h> | 42 | #include <mach/cpu.h> |
43 | #endif | 43 | #endif |
44 | 44 | ||
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c index f92595c8f165..84d5ea1ec171 100644 --- a/drivers/mfd/wm8350-core.c +++ b/drivers/mfd/wm8350-core.c | |||
@@ -1111,7 +1111,7 @@ int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, int vref) | |||
1111 | do { | 1111 | do { |
1112 | schedule_timeout_interruptible(1); | 1112 | schedule_timeout_interruptible(1); |
1113 | reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1); | 1113 | reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1); |
1114 | } while (tries-- && (reg & WM8350_AUXADC_POLL)); | 1114 | } while (--tries && (reg & WM8350_AUXADC_POLL)); |
1115 | 1115 | ||
1116 | if (!tries) | 1116 | if (!tries) |
1117 | dev_err(wm8350->dev, "adc chn %d read timeout\n", channel); | 1117 | dev_err(wm8350->dev, "adc chn %d read timeout\n", channel); |
@@ -1297,14 +1297,29 @@ static void wm8350_client_dev_register(struct wm8350 *wm8350, | |||
1297 | int wm8350_device_init(struct wm8350 *wm8350, int irq, | 1297 | int wm8350_device_init(struct wm8350 *wm8350, int irq, |
1298 | struct wm8350_platform_data *pdata) | 1298 | struct wm8350_platform_data *pdata) |
1299 | { | 1299 | { |
1300 | int ret = -EINVAL; | 1300 | int ret; |
1301 | u16 id1, id2, mask_rev; | 1301 | u16 id1, id2, mask_rev; |
1302 | u16 cust_id, mode, chip_rev; | 1302 | u16 cust_id, mode, chip_rev; |
1303 | 1303 | ||
1304 | /* get WM8350 revision and config mode */ | 1304 | /* get WM8350 revision and config mode */ |
1305 | wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1); | 1305 | ret = wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1); |
1306 | wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2); | 1306 | if (ret != 0) { |
1307 | wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), &mask_rev); | 1307 | dev_err(wm8350->dev, "Failed to read ID: %d\n", ret); |
1308 | goto err; | ||
1309 | } | ||
1310 | |||
1311 | ret = wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2); | ||
1312 | if (ret != 0) { | ||
1313 | dev_err(wm8350->dev, "Failed to read ID: %d\n", ret); | ||
1314 | goto err; | ||
1315 | } | ||
1316 | |||
1317 | ret = wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), | ||
1318 | &mask_rev); | ||
1319 | if (ret != 0) { | ||
1320 | dev_err(wm8350->dev, "Failed to read revision: %d\n", ret); | ||
1321 | goto err; | ||
1322 | } | ||
1308 | 1323 | ||
1309 | id1 = be16_to_cpu(id1); | 1324 | id1 = be16_to_cpu(id1); |
1310 | id2 = be16_to_cpu(id2); | 1325 | id2 = be16_to_cpu(id2); |
@@ -1404,14 +1419,12 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, | |||
1404 | return ret; | 1419 | return ret; |
1405 | } | 1420 | } |
1406 | 1421 | ||
1407 | if (pdata && pdata->init) { | 1422 | wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0xFFFF); |
1408 | ret = pdata->init(wm8350); | 1423 | wm8350_reg_write(wm8350, WM8350_INT_STATUS_1_MASK, 0xFFFF); |
1409 | if (ret != 0) { | 1424 | wm8350_reg_write(wm8350, WM8350_INT_STATUS_2_MASK, 0xFFFF); |
1410 | dev_err(wm8350->dev, "Platform init() failed: %d\n", | 1425 | wm8350_reg_write(wm8350, WM8350_UNDER_VOLTAGE_INT_STATUS_MASK, 0xFFFF); |
1411 | ret); | 1426 | wm8350_reg_write(wm8350, WM8350_GPIO_INT_STATUS_MASK, 0xFFFF); |
1412 | goto err; | 1427 | wm8350_reg_write(wm8350, WM8350_COMPARATOR_INT_STATUS_MASK, 0xFFFF); |
1413 | } | ||
1414 | } | ||
1415 | 1428 | ||
1416 | mutex_init(&wm8350->auxadc_mutex); | 1429 | mutex_init(&wm8350->auxadc_mutex); |
1417 | mutex_init(&wm8350->irq_mutex); | 1430 | mutex_init(&wm8350->irq_mutex); |
@@ -1430,6 +1443,15 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, | |||
1430 | } | 1443 | } |
1431 | wm8350->chip_irq = irq; | 1444 | wm8350->chip_irq = irq; |
1432 | 1445 | ||
1446 | if (pdata && pdata->init) { | ||
1447 | ret = pdata->init(wm8350); | ||
1448 | if (ret != 0) { | ||
1449 | dev_err(wm8350->dev, "Platform init() failed: %d\n", | ||
1450 | ret); | ||
1451 | goto err; | ||
1452 | } | ||
1453 | } | ||
1454 | |||
1433 | wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0); | 1455 | wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0); |
1434 | 1456 | ||
1435 | wm8350_client_dev_register(wm8350, "wm8350-codec", | 1457 | wm8350_client_dev_register(wm8350, "wm8350-codec", |
diff --git a/drivers/mfd/wm8350-regmap.c b/drivers/mfd/wm8350-regmap.c index 68887b817d17..9a4cc954cb7c 100644 --- a/drivers/mfd/wm8350-regmap.c +++ b/drivers/mfd/wm8350-regmap.c | |||
@@ -3188,7 +3188,7 @@ const struct wm8350_reg_access wm8350_reg_io_map[] = { | |||
3188 | { 0x7CFF, 0x0C00, 0x7FFF }, /* R1 - ID */ | 3188 | { 0x7CFF, 0x0C00, 0x7FFF }, /* R1 - ID */ |
3189 | { 0x0000, 0x0000, 0x0000 }, /* R2 */ | 3189 | { 0x0000, 0x0000, 0x0000 }, /* R2 */ |
3190 | { 0xBE3B, 0xBE3B, 0x8000 }, /* R3 - System Control 1 */ | 3190 | { 0xBE3B, 0xBE3B, 0x8000 }, /* R3 - System Control 1 */ |
3191 | { 0xFCF7, 0xFCF7, 0xF800 }, /* R4 - System Control 2 */ | 3191 | { 0xFEF7, 0xFEF7, 0xF800 }, /* R4 - System Control 2 */ |
3192 | { 0x80FF, 0x80FF, 0x8000 }, /* R5 - System Hibernate */ | 3192 | { 0x80FF, 0x80FF, 0x8000 }, /* R5 - System Hibernate */ |
3193 | { 0xFB0E, 0xFB0E, 0x0000 }, /* R6 - Interface Control */ | 3193 | { 0xFB0E, 0xFB0E, 0x0000 }, /* R6 - Interface Control */ |
3194 | { 0x0000, 0x0000, 0x0000 }, /* R7 */ | 3194 | { 0x0000, 0x0000, 0x0000 }, /* R7 */ |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 45b1f430685f..513eb09a638f 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -584,7 +584,7 @@ static int mmc_blk_probe(struct mmc_card *card) | |||
584 | if (err) | 584 | if (err) |
585 | goto out; | 585 | goto out; |
586 | 586 | ||
587 | string_get_size(get_capacity(md->disk) << 9, STRING_UNITS_2, | 587 | string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2, |
588 | cap_str, sizeof(cap_str)); | 588 | cap_str, sizeof(cap_str)); |
589 | printk(KERN_INFO "%s: %s %s %s %s\n", | 589 | printk(KERN_INFO "%s: %s %s %s %s\n", |
590 | md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), | 590 | md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), |
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index b92b172074ee..b9f1e84897cc 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c | |||
@@ -494,7 +494,7 @@ static int mmc_test_basic_read(struct mmc_test_card *test) | |||
494 | 494 | ||
495 | sg_init_one(&sg, test->buffer, 512); | 495 | sg_init_one(&sg, test->buffer, 512); |
496 | 496 | ||
497 | ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1); | 497 | ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0); |
498 | if (ret) | 498 | if (ret) |
499 | return ret; | 499 | return ret; |
500 | 500 | ||
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 76bfe16c09b1..2b1196e6142c 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -1548,9 +1548,10 @@ static bool filter(struct dma_chan *chan, void *slave) | |||
1548 | { | 1548 | { |
1549 | struct dw_dma_slave *dws = slave; | 1549 | struct dw_dma_slave *dws = slave; |
1550 | 1550 | ||
1551 | if (dws->dma_dev == chan->device->dev) | 1551 | if (dws->dma_dev == chan->device->dev) { |
1552 | chan->private = dws; | ||
1552 | return true; | 1553 | return true; |
1553 | else | 1554 | } else |
1554 | return false; | 1555 | return false; |
1555 | } | 1556 | } |
1556 | #endif | 1557 | #endif |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index db37490f67ec..a631c81dce12 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #define VS30 (1 << 25) | 55 | #define VS30 (1 << 25) |
56 | #define SDVS18 (0x5 << 9) | 56 | #define SDVS18 (0x5 << 9) |
57 | #define SDVS30 (0x6 << 9) | 57 | #define SDVS30 (0x6 << 9) |
58 | #define SDVS33 (0x7 << 9) | ||
58 | #define SDVSCLR 0xFFFFF1FF | 59 | #define SDVSCLR 0xFFFFF1FF |
59 | #define SDVSDET 0x00000400 | 60 | #define SDVSDET 0x00000400 |
60 | #define AUTOIDLE 0x1 | 61 | #define AUTOIDLE 0x1 |
@@ -375,6 +376,32 @@ static void mmc_omap_report_irq(struct mmc_omap_host *host, u32 status) | |||
375 | } | 376 | } |
376 | #endif /* CONFIG_MMC_DEBUG */ | 377 | #endif /* CONFIG_MMC_DEBUG */ |
377 | 378 | ||
379 | /* | ||
380 | * MMC controller internal state machines reset | ||
381 | * | ||
382 | * Used to reset command or data internal state machines, using respectively | ||
383 | * SRC or SRD bit of SYSCTL register | ||
384 | * Can be called from interrupt context | ||
385 | */ | ||
386 | static inline void mmc_omap_reset_controller_fsm(struct mmc_omap_host *host, | ||
387 | unsigned long bit) | ||
388 | { | ||
389 | unsigned long i = 0; | ||
390 | unsigned long limit = (loops_per_jiffy * | ||
391 | msecs_to_jiffies(MMC_TIMEOUT_MS)); | ||
392 | |||
393 | OMAP_HSMMC_WRITE(host->base, SYSCTL, | ||
394 | OMAP_HSMMC_READ(host->base, SYSCTL) | bit); | ||
395 | |||
396 | while ((OMAP_HSMMC_READ(host->base, SYSCTL) & bit) && | ||
397 | (i++ < limit)) | ||
398 | cpu_relax(); | ||
399 | |||
400 | if (OMAP_HSMMC_READ(host->base, SYSCTL) & bit) | ||
401 | dev_err(mmc_dev(host->mmc), | ||
402 | "Timeout waiting on controller reset in %s\n", | ||
403 | __func__); | ||
404 | } | ||
378 | 405 | ||
379 | /* | 406 | /* |
380 | * MMC controller IRQ handler | 407 | * MMC controller IRQ handler |
@@ -403,21 +430,17 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
403 | (status & CMD_CRC)) { | 430 | (status & CMD_CRC)) { |
404 | if (host->cmd) { | 431 | if (host->cmd) { |
405 | if (status & CMD_TIMEOUT) { | 432 | if (status & CMD_TIMEOUT) { |
406 | OMAP_HSMMC_WRITE(host->base, SYSCTL, | 433 | mmc_omap_reset_controller_fsm(host, SRC); |
407 | OMAP_HSMMC_READ(host->base, | ||
408 | SYSCTL) | SRC); | ||
409 | while (OMAP_HSMMC_READ(host->base, | ||
410 | SYSCTL) & SRC) | ||
411 | ; | ||
412 | |||
413 | host->cmd->error = -ETIMEDOUT; | 434 | host->cmd->error = -ETIMEDOUT; |
414 | } else { | 435 | } else { |
415 | host->cmd->error = -EILSEQ; | 436 | host->cmd->error = -EILSEQ; |
416 | } | 437 | } |
417 | end_cmd = 1; | 438 | end_cmd = 1; |
418 | } | 439 | } |
419 | if (host->data) | 440 | if (host->data) { |
420 | mmc_dma_cleanup(host); | 441 | mmc_dma_cleanup(host); |
442 | mmc_omap_reset_controller_fsm(host, SRD); | ||
443 | } | ||
421 | } | 444 | } |
422 | if ((status & DATA_TIMEOUT) || | 445 | if ((status & DATA_TIMEOUT) || |
423 | (status & DATA_CRC)) { | 446 | (status & DATA_CRC)) { |
@@ -426,12 +449,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
426 | mmc_dma_cleanup(host); | 449 | mmc_dma_cleanup(host); |
427 | else | 450 | else |
428 | host->data->error = -EILSEQ; | 451 | host->data->error = -EILSEQ; |
429 | OMAP_HSMMC_WRITE(host->base, SYSCTL, | 452 | mmc_omap_reset_controller_fsm(host, SRD); |
430 | OMAP_HSMMC_READ(host->base, | ||
431 | SYSCTL) | SRD); | ||
432 | while (OMAP_HSMMC_READ(host->base, | ||
433 | SYSCTL) & SRD) | ||
434 | ; | ||
435 | end_trans = 1; | 453 | end_trans = 1; |
436 | } | 454 | } |
437 | } | 455 | } |
@@ -456,13 +474,20 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
456 | } | 474 | } |
457 | 475 | ||
458 | /* | 476 | /* |
459 | * Switch MMC operating voltage | 477 | * Switch MMC interface voltage ... only relevant for MMC1. |
478 | * | ||
479 | * MMC2 and MMC3 use fixed 1.8V levels, and maybe a transceiver. | ||
480 | * The MMC2 transceiver controls are used instead of DAT4..DAT7. | ||
481 | * Some chips, like eMMC ones, use internal transceivers. | ||
460 | */ | 482 | */ |
461 | static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd) | 483 | static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd) |
462 | { | 484 | { |
463 | u32 reg_val = 0; | 485 | u32 reg_val = 0; |
464 | int ret; | 486 | int ret; |
465 | 487 | ||
488 | if (host->id != OMAP_MMC1_DEVID) | ||
489 | return 0; | ||
490 | |||
466 | /* Disable the clocks */ | 491 | /* Disable the clocks */ |
467 | clk_disable(host->fclk); | 492 | clk_disable(host->fclk); |
468 | clk_disable(host->iclk); | 493 | clk_disable(host->iclk); |
@@ -485,19 +510,26 @@ static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd) | |||
485 | OMAP_HSMMC_WRITE(host->base, HCTL, | 510 | OMAP_HSMMC_WRITE(host->base, HCTL, |
486 | OMAP_HSMMC_READ(host->base, HCTL) & SDVSCLR); | 511 | OMAP_HSMMC_READ(host->base, HCTL) & SDVSCLR); |
487 | reg_val = OMAP_HSMMC_READ(host->base, HCTL); | 512 | reg_val = OMAP_HSMMC_READ(host->base, HCTL); |
513 | |||
488 | /* | 514 | /* |
489 | * If a MMC dual voltage card is detected, the set_ios fn calls | 515 | * If a MMC dual voltage card is detected, the set_ios fn calls |
490 | * this fn with VDD bit set for 1.8V. Upon card removal from the | 516 | * this fn with VDD bit set for 1.8V. Upon card removal from the |
491 | * slot, omap_mmc_set_ios sets the VDD back to 3V on MMC_POWER_OFF. | 517 | * slot, omap_mmc_set_ios sets the VDD back to 3V on MMC_POWER_OFF. |
492 | * | 518 | * |
493 | * Only MMC1 supports 3.0V. MMC2 will not function if SDVS30 is | 519 | * Cope with a bit of slop in the range ... per data sheets: |
494 | * set in HCTL. | 520 | * - "1.8V" for vdds_mmc1/vdds_mmc1a can be up to 2.45V max, |
521 | * but recommended values are 1.71V to 1.89V | ||
522 | * - "3.0V" for vdds_mmc1/vdds_mmc1a can be up to 3.5V max, | ||
523 | * but recommended values are 2.7V to 3.3V | ||
524 | * | ||
525 | * Board setup code shouldn't permit anything very out-of-range. | ||
526 | * TWL4030-family VMMC1 and VSIM regulators are fine (avoiding the | ||
527 | * middle range) but VSIM can't power DAT4..DAT7 at more than 3V. | ||
495 | */ | 528 | */ |
496 | if (host->id == OMAP_MMC1_DEVID && (((1 << vdd) == MMC_VDD_32_33) || | 529 | if ((1 << vdd) <= MMC_VDD_23_24) |
497 | ((1 << vdd) == MMC_VDD_33_34))) | ||
498 | reg_val |= SDVS30; | ||
499 | if ((1 << vdd) == MMC_VDD_165_195) | ||
500 | reg_val |= SDVS18; | 530 | reg_val |= SDVS18; |
531 | else | ||
532 | reg_val |= SDVS30; | ||
501 | 533 | ||
502 | OMAP_HSMMC_WRITE(host->base, HCTL, reg_val); | 534 | OMAP_HSMMC_WRITE(host->base, HCTL, reg_val); |
503 | 535 | ||
@@ -517,16 +549,15 @@ static void mmc_omap_detect(struct work_struct *work) | |||
517 | { | 549 | { |
518 | struct mmc_omap_host *host = container_of(work, struct mmc_omap_host, | 550 | struct mmc_omap_host *host = container_of(work, struct mmc_omap_host, |
519 | mmc_carddetect_work); | 551 | mmc_carddetect_work); |
552 | struct omap_mmc_slot_data *slot = &mmc_slot(host); | ||
553 | |||
554 | host->carddetect = slot->card_detect(slot->card_detect_irq); | ||
520 | 555 | ||
521 | sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); | 556 | sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); |
522 | if (host->carddetect) { | 557 | if (host->carddetect) { |
523 | mmc_detect_change(host->mmc, (HZ * 200) / 1000); | 558 | mmc_detect_change(host->mmc, (HZ * 200) / 1000); |
524 | } else { | 559 | } else { |
525 | OMAP_HSMMC_WRITE(host->base, SYSCTL, | 560 | mmc_omap_reset_controller_fsm(host, SRD); |
526 | OMAP_HSMMC_READ(host->base, SYSCTL) | SRD); | ||
527 | while (OMAP_HSMMC_READ(host->base, SYSCTL) & SRD) | ||
528 | ; | ||
529 | |||
530 | mmc_detect_change(host->mmc, (HZ * 50) / 1000); | 561 | mmc_detect_change(host->mmc, (HZ * 50) / 1000); |
531 | } | 562 | } |
532 | } | 563 | } |
@@ -538,7 +569,6 @@ static irqreturn_t omap_mmc_cd_handler(int irq, void *dev_id) | |||
538 | { | 569 | { |
539 | struct mmc_omap_host *host = (struct mmc_omap_host *)dev_id; | 570 | struct mmc_omap_host *host = (struct mmc_omap_host *)dev_id; |
540 | 571 | ||
541 | host->carddetect = mmc_slot(host).card_detect(irq); | ||
542 | schedule_work(&host->mmc_carddetect_work); | 572 | schedule_work(&host->mmc_carddetect_work); |
543 | 573 | ||
544 | return IRQ_HANDLED; | 574 | return IRQ_HANDLED; |
@@ -757,10 +787,14 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
757 | case MMC_POWER_OFF: | 787 | case MMC_POWER_OFF: |
758 | mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0); | 788 | mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0); |
759 | /* | 789 | /* |
760 | * Reset bus voltage to 3V if it got set to 1.8V earlier. | 790 | * Reset interface voltage to 3V if it's 1.8V now; |
791 | * only relevant on MMC-1, the others always use 1.8V. | ||
792 | * | ||
761 | * REVISIT: If we are able to detect cards after unplugging | 793 | * REVISIT: If we are able to detect cards after unplugging |
762 | * a 1.8V card, this code should not be needed. | 794 | * a 1.8V card, this code should not be needed. |
763 | */ | 795 | */ |
796 | if (host->id != OMAP_MMC1_DEVID) | ||
797 | break; | ||
764 | if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) { | 798 | if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) { |
765 | int vdd = fls(host->mmc->ocr_avail) - 1; | 799 | int vdd = fls(host->mmc->ocr_avail) - 1; |
766 | if (omap_mmc_switch_opcond(host, vdd) != 0) | 800 | if (omap_mmc_switch_opcond(host, vdd) != 0) |
@@ -784,7 +818,9 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
784 | } | 818 | } |
785 | 819 | ||
786 | if (host->id == OMAP_MMC1_DEVID) { | 820 | if (host->id == OMAP_MMC1_DEVID) { |
787 | /* Only MMC1 can operate at 3V/1.8V */ | 821 | /* Only MMC1 can interface at 3V without some flavor |
822 | * of external transceiver; but they all handle 1.8V. | ||
823 | */ | ||
788 | if ((OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET) && | 824 | if ((OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET) && |
789 | (ios->vdd == DUAL_VOLT_OCR_BIT)) { | 825 | (ios->vdd == DUAL_VOLT_OCR_BIT)) { |
790 | /* | 826 | /* |
@@ -1137,7 +1173,9 @@ static int omap_mmc_suspend(struct platform_device *pdev, pm_message_t state) | |||
1137 | " level suspend\n"); | 1173 | " level suspend\n"); |
1138 | } | 1174 | } |
1139 | 1175 | ||
1140 | if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) { | 1176 | if (host->id == OMAP_MMC1_DEVID |
1177 | && !(OMAP_HSMMC_READ(host->base, HCTL) | ||
1178 | & SDVSDET)) { | ||
1141 | OMAP_HSMMC_WRITE(host->base, HCTL, | 1179 | OMAP_HSMMC_WRITE(host->base, HCTL, |
1142 | OMAP_HSMMC_READ(host->base, HCTL) | 1180 | OMAP_HSMMC_READ(host->base, HCTL) |
1143 | & SDVSCLR); | 1181 | & SDVSCLR); |
diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c index 35a98eec7414..f4a67c65d301 100644 --- a/drivers/mmc/host/s3cmci.c +++ b/drivers/mmc/host/s3cmci.c | |||
@@ -329,7 +329,7 @@ static void do_pio_write(struct s3cmci_host *host) | |||
329 | 329 | ||
330 | to_ptr = host->base + host->sdidata; | 330 | to_ptr = host->base + host->sdidata; |
331 | 331 | ||
332 | while ((fifo = fifo_free(host))) { | 332 | while ((fifo = fifo_free(host)) > 3) { |
333 | if (!host->pio_bytes) { | 333 | if (!host->pio_bytes) { |
334 | res = get_data_buffer(host, &host->pio_bytes, | 334 | res = get_data_buffer(host, &host->pio_bytes, |
335 | &host->pio_ptr); | 335 | &host->pio_ptr); |
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index f07255cb17ee..8cff5f5e7f86 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c | |||
@@ -144,8 +144,7 @@ static int jmicron_probe(struct sdhci_pci_chip *chip) | |||
144 | SDHCI_QUIRK_32BIT_DMA_SIZE | | 144 | SDHCI_QUIRK_32BIT_DMA_SIZE | |
145 | SDHCI_QUIRK_32BIT_ADMA_SIZE | | 145 | SDHCI_QUIRK_32BIT_ADMA_SIZE | |
146 | SDHCI_QUIRK_RESET_AFTER_REQUEST | | 146 | SDHCI_QUIRK_RESET_AFTER_REQUEST | |
147 | SDHCI_QUIRK_BROKEN_SMALL_PIO | | 147 | SDHCI_QUIRK_BROKEN_SMALL_PIO; |
148 | SDHCI_QUIRK_FORCE_HIGHSPEED; | ||
149 | } | 148 | } |
150 | 149 | ||
151 | /* | 150 | /* |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 6b2d1f99af67..f52f3053ed92 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -1636,8 +1636,7 @@ int sdhci_add_host(struct sdhci_host *host) | |||
1636 | mmc->f_max = host->max_clk; | 1636 | mmc->f_max = host->max_clk; |
1637 | mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; | 1637 | mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; |
1638 | 1638 | ||
1639 | if ((caps & SDHCI_CAN_DO_HISPD) || | 1639 | if (caps & SDHCI_CAN_DO_HISPD) |
1640 | (host->quirks & SDHCI_QUIRK_FORCE_HIGHSPEED)) | ||
1641 | mmc->caps |= MMC_CAP_SD_HIGHSPEED; | 1640 | mmc->caps |= MMC_CAP_SD_HIGHSPEED; |
1642 | 1641 | ||
1643 | mmc->ocr_avail = 0; | 1642 | mmc->ocr_avail = 0; |
@@ -1723,7 +1722,9 @@ int sdhci_add_host(struct sdhci_host *host) | |||
1723 | #endif | 1722 | #endif |
1724 | 1723 | ||
1725 | #ifdef SDHCI_USE_LEDS_CLASS | 1724 | #ifdef SDHCI_USE_LEDS_CLASS |
1726 | host->led.name = mmc_hostname(mmc); | 1725 | snprintf(host->led_name, sizeof(host->led_name), |
1726 | "%s::", mmc_hostname(mmc)); | ||
1727 | host->led.name = host->led_name; | ||
1727 | host->led.brightness = LED_OFF; | 1728 | host->led.brightness = LED_OFF; |
1728 | host->led.default_trigger = mmc_hostname(mmc); | 1729 | host->led.default_trigger = mmc_hostname(mmc); |
1729 | host->led.brightness_set = sdhci_led_control; | 1730 | host->led.brightness_set = sdhci_led_control; |
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 3efba2363941..ebb83657e27a 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
@@ -208,8 +208,6 @@ struct sdhci_host { | |||
208 | #define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12) | 208 | #define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12) |
209 | /* Controller has an issue with buffer bits for small transfers */ | 209 | /* Controller has an issue with buffer bits for small transfers */ |
210 | #define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13) | 210 | #define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13) |
211 | /* Controller supports high speed but doesn't have the caps bit set */ | ||
212 | #define SDHCI_QUIRK_FORCE_HIGHSPEED (1<<14) | ||
213 | 211 | ||
214 | int irq; /* Device IRQ */ | 212 | int irq; /* Device IRQ */ |
215 | void __iomem * ioaddr; /* Mapped address */ | 213 | void __iomem * ioaddr; /* Mapped address */ |
@@ -222,6 +220,7 @@ struct sdhci_host { | |||
222 | 220 | ||
223 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) | 221 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) |
224 | struct led_classdev led; /* LED control */ | 222 | struct led_classdev led; /* LED control */ |
223 | char led_name[32]; | ||
225 | #endif | 224 | #endif |
226 | 225 | ||
227 | spinlock_t lock; /* Mutex */ | 226 | spinlock_t lock; /* Mutex */ |
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index c98c1570a40b..47a33cec3793 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c | |||
@@ -139,7 +139,8 @@ static int atmel_nand_device_ready(struct mtd_info *mtd) | |||
139 | struct nand_chip *nand_chip = mtd->priv; | 139 | struct nand_chip *nand_chip = mtd->priv; |
140 | struct atmel_nand_host *host = nand_chip->priv; | 140 | struct atmel_nand_host *host = nand_chip->priv; |
141 | 141 | ||
142 | return gpio_get_value(host->board->rdy_pin); | 142 | return gpio_get_value(host->board->rdy_pin) ^ |
143 | !!host->board->rdy_pin_active_low; | ||
143 | } | 144 | } |
144 | 145 | ||
145 | /* | 146 | /* |
diff --git a/drivers/parport/parport_atari.c b/drivers/parport/parport_atari.c index ad4cdd256137..0b28fccec03f 100644 --- a/drivers/parport/parport_atari.c +++ b/drivers/parport/parport_atari.c | |||
@@ -84,7 +84,7 @@ parport_atari_frob_control(struct parport *p, unsigned char mask, | |||
84 | static unsigned char | 84 | static unsigned char |
85 | parport_atari_read_status(struct parport *p) | 85 | parport_atari_read_status(struct parport *p) |
86 | { | 86 | { |
87 | return ((mfp.par_dt_reg & 1 ? 0 : PARPORT_STATUS_BUSY) | | 87 | return ((st_mfp.par_dt_reg & 1 ? 0 : PARPORT_STATUS_BUSY) | |
88 | PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR); | 88 | PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR); |
89 | } | 89 | } |
90 | 90 | ||
@@ -193,9 +193,9 @@ static int __init parport_atari_init(void) | |||
193 | sound_ym.wd_data = sound_ym.rd_data_reg_sel | (1 << 5); | 193 | sound_ym.wd_data = sound_ym.rd_data_reg_sel | (1 << 5); |
194 | local_irq_restore(flags); | 194 | local_irq_restore(flags); |
195 | /* MFP port I0 as input. */ | 195 | /* MFP port I0 as input. */ |
196 | mfp.data_dir &= ~1; | 196 | st_mfp.data_dir &= ~1; |
197 | /* MFP port I0 interrupt on high->low edge. */ | 197 | /* MFP port I0 interrupt on high->low edge. */ |
198 | mfp.active_edge &= ~1; | 198 | st_mfp.active_edge &= ~1; |
199 | p = parport_register_port((unsigned long)&sound_ym.wd_data, | 199 | p = parport_register_port((unsigned long)&sound_ym.wd_data, |
200 | IRQ_MFP_BUSY, PARPORT_DMA_NONE, | 200 | IRQ_MFP_BUSY, PARPORT_DMA_NONE, |
201 | &parport_atari_ops); | 201 | &parport_atari_ops); |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index f4b7c79023ff..f3f686581a90 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -61,6 +61,8 @@ | |||
61 | /* global iommu list, set NULL for ignored DMAR units */ | 61 | /* global iommu list, set NULL for ignored DMAR units */ |
62 | static struct intel_iommu **g_iommus; | 62 | static struct intel_iommu **g_iommus; |
63 | 63 | ||
64 | static int rwbf_quirk; | ||
65 | |||
64 | /* | 66 | /* |
65 | * 0: Present | 67 | * 0: Present |
66 | * 1-11: Reserved | 68 | * 1-11: Reserved |
@@ -785,7 +787,7 @@ static void iommu_flush_write_buffer(struct intel_iommu *iommu) | |||
785 | u32 val; | 787 | u32 val; |
786 | unsigned long flag; | 788 | unsigned long flag; |
787 | 789 | ||
788 | if (!cap_rwbf(iommu->cap)) | 790 | if (!rwbf_quirk && !cap_rwbf(iommu->cap)) |
789 | return; | 791 | return; |
790 | val = iommu->gcmd | DMA_GCMD_WBF; | 792 | val = iommu->gcmd | DMA_GCMD_WBF; |
791 | 793 | ||
@@ -3137,3 +3139,15 @@ static struct iommu_ops intel_iommu_ops = { | |||
3137 | .unmap = intel_iommu_unmap_range, | 3139 | .unmap = intel_iommu_unmap_range, |
3138 | .iova_to_phys = intel_iommu_iova_to_phys, | 3140 | .iova_to_phys = intel_iommu_iova_to_phys, |
3139 | }; | 3141 | }; |
3142 | |||
3143 | static void __devinit quirk_iommu_rwbf(struct pci_dev *dev) | ||
3144 | { | ||
3145 | /* | ||
3146 | * Mobile 4 Series Chipset neglects to set RWBF capability, | ||
3147 | * but needs it: | ||
3148 | */ | ||
3149 | printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n"); | ||
3150 | rwbf_quirk = 1; | ||
3151 | } | ||
3152 | |||
3153 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); | ||
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 44f15ff70c1d..baba2eb5367d 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -103,14 +103,12 @@ static void msix_set_enable(struct pci_dev *dev, int enable) | |||
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | /* | ||
107 | * Essentially, this is ((1 << (1 << x)) - 1), but without the | ||
108 | * undefinedness of a << 32. | ||
109 | */ | ||
110 | static inline __attribute_const__ u32 msi_mask(unsigned x) | 106 | static inline __attribute_const__ u32 msi_mask(unsigned x) |
111 | { | 107 | { |
112 | static const u32 mask[] = { 1, 2, 4, 0xf, 0xff, 0xffff, 0xffffffff }; | 108 | /* Don't shift by >= width of type */ |
113 | return mask[x]; | 109 | if (x >= 5) |
110 | return 0xffffffff; | ||
111 | return (1 << (1 << x)) - 1; | ||
114 | } | 112 | } |
115 | 113 | ||
116 | static void msix_flush_writes(struct irq_desc *desc) | 114 | static void msix_flush_writes(struct irq_desc *desc) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e3efe6b19ee7..6d6120007af4 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1540,16 +1540,21 @@ void pci_release_region(struct pci_dev *pdev, int bar) | |||
1540 | } | 1540 | } |
1541 | 1541 | ||
1542 | /** | 1542 | /** |
1543 | * pci_request_region - Reserved PCI I/O and memory resource | 1543 | * __pci_request_region - Reserved PCI I/O and memory resource |
1544 | * @pdev: PCI device whose resources are to be reserved | 1544 | * @pdev: PCI device whose resources are to be reserved |
1545 | * @bar: BAR to be reserved | 1545 | * @bar: BAR to be reserved |
1546 | * @res_name: Name to be associated with resource. | 1546 | * @res_name: Name to be associated with resource. |
1547 | * @exclusive: whether the region access is exclusive or not | ||
1547 | * | 1548 | * |
1548 | * Mark the PCI region associated with PCI device @pdev BR @bar as | 1549 | * Mark the PCI region associated with PCI device @pdev BR @bar as |
1549 | * being reserved by owner @res_name. Do not access any | 1550 | * being reserved by owner @res_name. Do not access any |
1550 | * address inside the PCI regions unless this call returns | 1551 | * address inside the PCI regions unless this call returns |
1551 | * successfully. | 1552 | * successfully. |
1552 | * | 1553 | * |
1554 | * If @exclusive is set, then the region is marked so that userspace | ||
1555 | * is explicitly not allowed to map the resource via /dev/mem or | ||
1556 | * sysfs MMIO access. | ||
1557 | * | ||
1553 | * Returns 0 on success, or %EBUSY on error. A warning | 1558 | * Returns 0 on success, or %EBUSY on error. A warning |
1554 | * message is also printed on failure. | 1559 | * message is also printed on failure. |
1555 | */ | 1560 | */ |
@@ -1588,12 +1593,12 @@ err_out: | |||
1588 | } | 1593 | } |
1589 | 1594 | ||
1590 | /** | 1595 | /** |
1591 | * pci_request_region - Reserved PCI I/O and memory resource | 1596 | * pci_request_region - Reserve PCI I/O and memory resource |
1592 | * @pdev: PCI device whose resources are to be reserved | 1597 | * @pdev: PCI device whose resources are to be reserved |
1593 | * @bar: BAR to be reserved | 1598 | * @bar: BAR to be reserved |
1594 | * @res_name: Name to be associated with resource. | 1599 | * @res_name: Name to be associated with resource |
1595 | * | 1600 | * |
1596 | * Mark the PCI region associated with PCI device @pdev BR @bar as | 1601 | * Mark the PCI region associated with PCI device @pdev BAR @bar as |
1597 | * being reserved by owner @res_name. Do not access any | 1602 | * being reserved by owner @res_name. Do not access any |
1598 | * address inside the PCI regions unless this call returns | 1603 | * address inside the PCI regions unless this call returns |
1599 | * successfully. | 1604 | * successfully. |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 26ddf78ac300..07c0aa5275e6 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -16,21 +16,21 @@ extern int pci_mmap_fits(struct pci_dev *pdev, int resno, | |||
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Firmware PM callbacks | 19 | * struct pci_platform_pm_ops - Firmware PM callbacks |
20 | * | 20 | * |
21 | * @is_manageable - returns 'true' if given device is power manageable by the | 21 | * @is_manageable: returns 'true' if given device is power manageable by the |
22 | * platform firmware | 22 | * platform firmware |
23 | * | 23 | * |
24 | * @set_state - invokes the platform firmware to set the device's power state | 24 | * @set_state: invokes the platform firmware to set the device's power state |
25 | * | 25 | * |
26 | * @choose_state - returns PCI power state of given device preferred by the | 26 | * @choose_state: returns PCI power state of given device preferred by the |
27 | * platform; to be used during system-wide transitions from a | 27 | * platform; to be used during system-wide transitions from a |
28 | * sleeping state to the working state and vice versa | 28 | * sleeping state to the working state and vice versa |
29 | * | 29 | * |
30 | * @can_wakeup - returns 'true' if given device is capable of waking up the | 30 | * @can_wakeup: returns 'true' if given device is capable of waking up the |
31 | * system from a sleeping state | 31 | * system from a sleeping state |
32 | * | 32 | * |
33 | * @sleep_wake - enables/disables the system wake up capability of given device | 33 | * @sleep_wake: enables/disables the system wake up capability of given device |
34 | * | 34 | * |
35 | * If given platform is generally capable of power managing PCI devices, all of | 35 | * If given platform is generally capable of power managing PCI devices, all of |
36 | * these callbacks are mandatory. | 36 | * these callbacks are mandatory. |
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index 29cbe47f219f..36864a935d68 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
@@ -55,6 +55,7 @@ void pci_disable_rom(struct pci_dev *pdev) | |||
55 | 55 | ||
56 | /** | 56 | /** |
57 | * pci_get_rom_size - obtain the actual size of the ROM image | 57 | * pci_get_rom_size - obtain the actual size of the ROM image |
58 | * @pdev: target PCI device | ||
58 | * @rom: kernel virtual pointer to image of ROM | 59 | * @rom: kernel virtual pointer to image of ROM |
59 | * @size: size of PCI window | 60 | * @size: size of PCI window |
60 | * return: size of actual ROM image | 61 | * return: size of actual ROM image |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 94363115a42a..b3866ad50227 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -62,6 +62,7 @@ config DELL_LAPTOP | |||
62 | depends on EXPERIMENTAL | 62 | depends on EXPERIMENTAL |
63 | depends on BACKLIGHT_CLASS_DEVICE | 63 | depends on BACKLIGHT_CLASS_DEVICE |
64 | depends on RFKILL | 64 | depends on RFKILL |
65 | depends on POWER_SUPPLY | ||
65 | default n | 66 | default n |
66 | ---help--- | 67 | ---help--- |
67 | This driver adds support for rfkill and backlight control to Dell | 68 | This driver adds support for rfkill and backlight control to Dell |
@@ -301,6 +302,7 @@ config INTEL_MENLOW | |||
301 | config EEEPC_LAPTOP | 302 | config EEEPC_LAPTOP |
302 | tristate "Eee PC Hotkey Driver (EXPERIMENTAL)" | 303 | tristate "Eee PC Hotkey Driver (EXPERIMENTAL)" |
303 | depends on ACPI | 304 | depends on ACPI |
305 | depends on INPUT | ||
304 | depends on EXPERIMENTAL | 306 | depends on EXPERIMENTAL |
305 | select BACKLIGHT_CLASS_DEVICE | 307 | select BACKLIGHT_CLASS_DEVICE |
306 | select HWMON | 308 | select HWMON |
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 65dc41540c62..45940f31fe9e 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
@@ -166,6 +166,7 @@ struct fujitsu_hotkey_t { | |||
166 | struct platform_device *pf_device; | 166 | struct platform_device *pf_device; |
167 | struct kfifo *fifo; | 167 | struct kfifo *fifo; |
168 | spinlock_t fifo_lock; | 168 | spinlock_t fifo_lock; |
169 | int rfkill_supported; | ||
169 | int rfkill_state; | 170 | int rfkill_state; |
170 | int logolamp_registered; | 171 | int logolamp_registered; |
171 | int kblamps_registered; | 172 | int kblamps_registered; |
@@ -526,7 +527,7 @@ static ssize_t | |||
526 | show_lid_state(struct device *dev, | 527 | show_lid_state(struct device *dev, |
527 | struct device_attribute *attr, char *buf) | 528 | struct device_attribute *attr, char *buf) |
528 | { | 529 | { |
529 | if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) | 530 | if (!(fujitsu_hotkey->rfkill_supported & 0x100)) |
530 | return sprintf(buf, "unknown\n"); | 531 | return sprintf(buf, "unknown\n"); |
531 | if (fujitsu_hotkey->rfkill_state & 0x100) | 532 | if (fujitsu_hotkey->rfkill_state & 0x100) |
532 | return sprintf(buf, "open\n"); | 533 | return sprintf(buf, "open\n"); |
@@ -538,7 +539,7 @@ static ssize_t | |||
538 | show_dock_state(struct device *dev, | 539 | show_dock_state(struct device *dev, |
539 | struct device_attribute *attr, char *buf) | 540 | struct device_attribute *attr, char *buf) |
540 | { | 541 | { |
541 | if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) | 542 | if (!(fujitsu_hotkey->rfkill_supported & 0x200)) |
542 | return sprintf(buf, "unknown\n"); | 543 | return sprintf(buf, "unknown\n"); |
543 | if (fujitsu_hotkey->rfkill_state & 0x200) | 544 | if (fujitsu_hotkey->rfkill_state & 0x200) |
544 | return sprintf(buf, "docked\n"); | 545 | return sprintf(buf, "docked\n"); |
@@ -550,7 +551,7 @@ static ssize_t | |||
550 | show_radios_state(struct device *dev, | 551 | show_radios_state(struct device *dev, |
551 | struct device_attribute *attr, char *buf) | 552 | struct device_attribute *attr, char *buf) |
552 | { | 553 | { |
553 | if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) | 554 | if (!(fujitsu_hotkey->rfkill_supported & 0x20)) |
554 | return sprintf(buf, "unknown\n"); | 555 | return sprintf(buf, "unknown\n"); |
555 | if (fujitsu_hotkey->rfkill_state & 0x20) | 556 | if (fujitsu_hotkey->rfkill_state & 0x20) |
556 | return sprintf(buf, "on\n"); | 557 | return sprintf(buf, "on\n"); |
@@ -928,8 +929,17 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) | |||
928 | ; /* No action, result is discarded */ | 929 | ; /* No action, result is discarded */ |
929 | vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i); | 930 | vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i); |
930 | 931 | ||
931 | fujitsu_hotkey->rfkill_state = | 932 | fujitsu_hotkey->rfkill_supported = |
932 | call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); | 933 | call_fext_func(FUNC_RFKILL, 0x0, 0x0, 0x0); |
934 | |||
935 | /* Make sure our bitmask of supported functions is cleared if the | ||
936 | RFKILL function block is not implemented, like on the S7020. */ | ||
937 | if (fujitsu_hotkey->rfkill_supported == UNSUPPORTED_CMD) | ||
938 | fujitsu_hotkey->rfkill_supported = 0; | ||
939 | |||
940 | if (fujitsu_hotkey->rfkill_supported) | ||
941 | fujitsu_hotkey->rfkill_state = | ||
942 | call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); | ||
933 | 943 | ||
934 | /* Suspect this is a keymap of the application panel, print it */ | 944 | /* Suspect this is a keymap of the application panel, print it */ |
935 | printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n", | 945 | printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n", |
@@ -1005,8 +1015,9 @@ static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, | |||
1005 | 1015 | ||
1006 | input = fujitsu_hotkey->input; | 1016 | input = fujitsu_hotkey->input; |
1007 | 1017 | ||
1008 | fujitsu_hotkey->rfkill_state = | 1018 | if (fujitsu_hotkey->rfkill_supported) |
1009 | call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); | 1019 | fujitsu_hotkey->rfkill_state = |
1020 | call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); | ||
1010 | 1021 | ||
1011 | switch (event) { | 1022 | switch (event) { |
1012 | case ACPI_FUJITSU_NOTIFY_CODE1: | 1023 | case ACPI_FUJITSU_NOTIFY_CODE1: |
diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c index 1fd8f2193ed8..4377e93a43d7 100644 --- a/drivers/s390/char/sclp.c +++ b/drivers/s390/char/sclp.c | |||
@@ -280,8 +280,11 @@ sclp_dispatch_evbufs(struct sccb_header *sccb) | |||
280 | rc = 0; | 280 | rc = 0; |
281 | for (offset = sizeof(struct sccb_header); offset < sccb->length; | 281 | for (offset = sizeof(struct sccb_header); offset < sccb->length; |
282 | offset += evbuf->length) { | 282 | offset += evbuf->length) { |
283 | /* Search for event handler */ | ||
284 | evbuf = (struct evbuf_header *) ((addr_t) sccb + offset); | 283 | evbuf = (struct evbuf_header *) ((addr_t) sccb + offset); |
284 | /* Check for malformed hardware response */ | ||
285 | if (evbuf->length == 0) | ||
286 | break; | ||
287 | /* Search for event handler */ | ||
285 | reg = NULL; | 288 | reg = NULL; |
286 | list_for_each(l, &sclp_reg_list) { | 289 | list_for_each(l, &sclp_reg_list) { |
287 | reg = list_entry(l, struct sclp_register, list); | 290 | reg = list_entry(l, struct sclp_register, list); |
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index 506390496416..77ab6e34a100 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/memory.h> | 19 | #include <linux/memory.h> |
20 | #include <asm/chpid.h> | 20 | #include <asm/chpid.h> |
21 | #include <asm/sclp.h> | 21 | #include <asm/sclp.h> |
22 | #include <asm/setup.h> | ||
22 | 23 | ||
23 | #include "sclp.h" | 24 | #include "sclp.h" |
24 | 25 | ||
@@ -474,6 +475,10 @@ static void __init add_memory_merged(u16 rn) | |||
474 | goto skip_add; | 475 | goto skip_add; |
475 | if (start + size > VMEM_MAX_PHYS) | 476 | if (start + size > VMEM_MAX_PHYS) |
476 | size = VMEM_MAX_PHYS - start; | 477 | size = VMEM_MAX_PHYS - start; |
478 | if (memory_end_set && (start >= memory_end)) | ||
479 | goto skip_add; | ||
480 | if (memory_end_set && (start + size > memory_end)) | ||
481 | size = memory_end - start; | ||
477 | add_memory(0, start, size); | 482 | add_memory(0, start, size); |
478 | skip_add: | 483 | skip_add: |
479 | first_rn = rn; | 484 | first_rn = rn; |
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index a1a511bdec8c..ed1e728763a2 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c | |||
@@ -1573,9 +1573,6 @@ static int ibmvfc_queuecommand(struct scsi_cmnd *cmnd, | |||
1573 | vfc_cmd->resp_len = sizeof(vfc_cmd->rsp); | 1573 | vfc_cmd->resp_len = sizeof(vfc_cmd->rsp); |
1574 | vfc_cmd->cancel_key = (unsigned long)cmnd->device->hostdata; | 1574 | vfc_cmd->cancel_key = (unsigned long)cmnd->device->hostdata; |
1575 | vfc_cmd->tgt_scsi_id = rport->port_id; | 1575 | vfc_cmd->tgt_scsi_id = rport->port_id; |
1576 | if ((rport->supported_classes & FC_COS_CLASS3) && | ||
1577 | (fc_host_supported_classes(vhost->host) & FC_COS_CLASS3)) | ||
1578 | vfc_cmd->flags = IBMVFC_CLASS_3_ERR; | ||
1579 | vfc_cmd->iu.xfer_len = scsi_bufflen(cmnd); | 1576 | vfc_cmd->iu.xfer_len = scsi_bufflen(cmnd); |
1580 | int_to_scsilun(cmnd->device->lun, &vfc_cmd->iu.lun); | 1577 | int_to_scsilun(cmnd->device->lun, &vfc_cmd->iu.lun); |
1581 | memcpy(vfc_cmd->iu.cdb, cmnd->cmnd, cmnd->cmd_len); | 1578 | memcpy(vfc_cmd->iu.cdb, cmnd->cmnd, cmnd->cmd_len); |
@@ -3266,6 +3263,7 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *vhost, u64 scsi_id) | |||
3266 | return -ENOMEM; | 3263 | return -ENOMEM; |
3267 | } | 3264 | } |
3268 | 3265 | ||
3266 | memset(tgt, 0, sizeof(*tgt)); | ||
3269 | tgt->scsi_id = scsi_id; | 3267 | tgt->scsi_id = scsi_id; |
3270 | tgt->new_scsi_id = scsi_id; | 3268 | tgt->new_scsi_id = scsi_id; |
3271 | tgt->vhost = vhost; | 3269 | tgt->vhost = vhost; |
@@ -3576,9 +3574,18 @@ static void ibmvfc_log_ae(struct ibmvfc_host *vhost, int events) | |||
3576 | static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt) | 3574 | static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt) |
3577 | { | 3575 | { |
3578 | struct ibmvfc_host *vhost = tgt->vhost; | 3576 | struct ibmvfc_host *vhost = tgt->vhost; |
3579 | struct fc_rport *rport; | 3577 | struct fc_rport *rport = tgt->rport; |
3580 | unsigned long flags; | 3578 | unsigned long flags; |
3581 | 3579 | ||
3580 | if (rport) { | ||
3581 | tgt_dbg(tgt, "Setting rport roles\n"); | ||
3582 | fc_remote_port_rolechg(rport, tgt->ids.roles); | ||
3583 | spin_lock_irqsave(vhost->host->host_lock, flags); | ||
3584 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); | ||
3585 | spin_unlock_irqrestore(vhost->host->host_lock, flags); | ||
3586 | return; | ||
3587 | } | ||
3588 | |||
3582 | tgt_dbg(tgt, "Adding rport\n"); | 3589 | tgt_dbg(tgt, "Adding rport\n"); |
3583 | rport = fc_remote_port_add(vhost->host, 0, &tgt->ids); | 3590 | rport = fc_remote_port_add(vhost->host, 0, &tgt->ids); |
3584 | spin_lock_irqsave(vhost->host->host_lock, flags); | 3591 | spin_lock_irqsave(vhost->host->host_lock, flags); |
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h index 87dafd0f8d44..b21e071b9862 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.h +++ b/drivers/scsi/ibmvscsi/ibmvfc.h | |||
@@ -32,7 +32,7 @@ | |||
32 | #define IBMVFC_DRIVER_VERSION "1.0.4" | 32 | #define IBMVFC_DRIVER_VERSION "1.0.4" |
33 | #define IBMVFC_DRIVER_DATE "(November 14, 2008)" | 33 | #define IBMVFC_DRIVER_DATE "(November 14, 2008)" |
34 | 34 | ||
35 | #define IBMVFC_DEFAULT_TIMEOUT 15 | 35 | #define IBMVFC_DEFAULT_TIMEOUT 60 |
36 | #define IBMVFC_INIT_TIMEOUT 120 | 36 | #define IBMVFC_INIT_TIMEOUT 120 |
37 | #define IBMVFC_MAX_REQUESTS_DEFAULT 100 | 37 | #define IBMVFC_MAX_REQUESTS_DEFAULT 100 |
38 | 38 | ||
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 74d07d137dae..c9aa7611e408 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -432,6 +432,7 @@ static int map_sg_data(struct scsi_cmnd *cmd, | |||
432 | sdev_printk(KERN_ERR, cmd->device, | 432 | sdev_printk(KERN_ERR, cmd->device, |
433 | "Can't allocate memory " | 433 | "Can't allocate memory " |
434 | "for indirect table\n"); | 434 | "for indirect table\n"); |
435 | scsi_dma_unmap(cmd); | ||
435 | return 0; | 436 | return 0; |
436 | } | 437 | } |
437 | } | 438 | } |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 257c24115de9..809d32d95c76 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -1998,6 +1998,8 @@ int iscsi_host_add(struct Scsi_Host *shost, struct device *pdev) | |||
1998 | if (!shost->can_queue) | 1998 | if (!shost->can_queue) |
1999 | shost->can_queue = ISCSI_DEF_XMIT_CMDS_MAX; | 1999 | shost->can_queue = ISCSI_DEF_XMIT_CMDS_MAX; |
2000 | 2000 | ||
2001 | if (!shost->transportt->eh_timed_out) | ||
2002 | shost->transportt->eh_timed_out = iscsi_eh_cmd_timed_out; | ||
2001 | return scsi_add_host(shost, pdev); | 2003 | return scsi_add_host(shost, pdev); |
2002 | } | 2004 | } |
2003 | EXPORT_SYMBOL_GPL(iscsi_host_add); | 2005 | EXPORT_SYMBOL_GPL(iscsi_host_add); |
@@ -2020,7 +2022,6 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, | |||
2020 | shost = scsi_host_alloc(sht, sizeof(struct iscsi_host) + dd_data_size); | 2022 | shost = scsi_host_alloc(sht, sizeof(struct iscsi_host) + dd_data_size); |
2021 | if (!shost) | 2023 | if (!shost) |
2022 | return NULL; | 2024 | return NULL; |
2023 | shost->transportt->eh_timed_out = iscsi_eh_cmd_timed_out; | ||
2024 | 2025 | ||
2025 | if (qdepth > ISCSI_MAX_CMD_PER_LUN || qdepth < 1) { | 2026 | if (qdepth > ISCSI_MAX_CMD_PER_LUN || qdepth < 1) { |
2026 | if (qdepth != 0) | 2027 | if (qdepth != 0) |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index a8f30bdaff69..a7302480bc4a 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -5258,6 +5258,7 @@ lpfc_send_els_event(struct lpfc_vport *vport, | |||
5258 | sizeof(struct lpfc_name)); | 5258 | sizeof(struct lpfc_name)); |
5259 | break; | 5259 | break; |
5260 | default: | 5260 | default: |
5261 | kfree(els_data); | ||
5261 | return; | 5262 | return; |
5262 | } | 5263 | } |
5263 | memcpy(els_data->wwpn, &ndlp->nlp_portname, sizeof(struct lpfc_name)); | 5264 | memcpy(els_data->wwpn, &ndlp->nlp_portname, sizeof(struct lpfc_name)); |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 33a3c13fd893..f4c57227ec18 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -1265,13 +1265,6 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) | |||
1265 | test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags)) | 1265 | test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags)) |
1266 | msleep(1000); | 1266 | msleep(1000); |
1267 | 1267 | ||
1268 | if (ha->mqenable) { | ||
1269 | if (qla25xx_delete_queues(vha, 0) != QLA_SUCCESS) | ||
1270 | qla_printk(KERN_WARNING, ha, | ||
1271 | "Queue delete failed.\n"); | ||
1272 | vha->req_ques[0] = ha->req_q_map[0]->id; | ||
1273 | } | ||
1274 | |||
1275 | qla24xx_disable_vp(vha); | 1268 | qla24xx_disable_vp(vha); |
1276 | 1269 | ||
1277 | fc_remove_host(vha->host); | 1270 | fc_remove_host(vha->host); |
@@ -1293,6 +1286,12 @@ qla24xx_vport_delete(struct fc_vport *fc_vport) | |||
1293 | vha->host_no, vha->vp_idx, vha)); | 1286 | vha->host_no, vha->vp_idx, vha)); |
1294 | } | 1287 | } |
1295 | 1288 | ||
1289 | if (ha->mqenable) { | ||
1290 | if (qla25xx_delete_queues(vha, 0) != QLA_SUCCESS) | ||
1291 | qla_printk(KERN_WARNING, ha, | ||
1292 | "Queue delete failed.\n"); | ||
1293 | } | ||
1294 | |||
1296 | scsi_host_put(vha->host); | 1295 | scsi_host_put(vha->host); |
1297 | qla_printk(KERN_INFO, ha, "vport %d deleted\n", id); | 1296 | qla_printk(KERN_INFO, ha, "vport %d deleted\n", id); |
1298 | return 0; | 1297 | return 0; |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 023ee77fb027..e0c5bb54b258 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -2135,6 +2135,7 @@ struct qla_msix_entry { | |||
2135 | /* Work events. */ | 2135 | /* Work events. */ |
2136 | enum qla_work_type { | 2136 | enum qla_work_type { |
2137 | QLA_EVT_AEN, | 2137 | QLA_EVT_AEN, |
2138 | QLA_EVT_IDC_ACK, | ||
2138 | }; | 2139 | }; |
2139 | 2140 | ||
2140 | 2141 | ||
@@ -2149,6 +2150,10 @@ struct qla_work_evt { | |||
2149 | enum fc_host_event_code code; | 2150 | enum fc_host_event_code code; |
2150 | u32 data; | 2151 | u32 data; |
2151 | } aen; | 2152 | } aen; |
2153 | struct { | ||
2154 | #define QLA_IDC_ACK_REGS 7 | ||
2155 | uint16_t mb[QLA_IDC_ACK_REGS]; | ||
2156 | } idc_ack; | ||
2152 | } u; | 2157 | } u; |
2153 | }; | 2158 | }; |
2154 | 2159 | ||
diff --git a/drivers/scsi/qla2xxx/qla_devtbl.h b/drivers/scsi/qla2xxx/qla_devtbl.h index d78d35e681ab..d6ea69df7c5c 100644 --- a/drivers/scsi/qla2xxx/qla_devtbl.h +++ b/drivers/scsi/qla2xxx/qla_devtbl.h | |||
@@ -72,7 +72,7 @@ static char *qla2x00_model_name[QLA_MODEL_NAMES*2] = { | |||
72 | "QLA2462", "Sun PCI-X 2.0 to 4Gb FC, Dual Channel", /* 0x141 */ | 72 | "QLA2462", "Sun PCI-X 2.0 to 4Gb FC, Dual Channel", /* 0x141 */ |
73 | "QLE2460", "Sun PCI-Express to 2Gb FC, Single Channel", /* 0x142 */ | 73 | "QLE2460", "Sun PCI-Express to 2Gb FC, Single Channel", /* 0x142 */ |
74 | "QLE2462", "Sun PCI-Express to 4Gb FC, Single Channel", /* 0x143 */ | 74 | "QLE2462", "Sun PCI-Express to 4Gb FC, Single Channel", /* 0x143 */ |
75 | "QEM2462" "Server I/O Module 4Gb FC, Dual Channel", /* 0x144 */ | 75 | "QEM2462", "Server I/O Module 4Gb FC, Dual Channel", /* 0x144 */ |
76 | "QLE2440", "PCI-Express to 4Gb FC, Single Channel", /* 0x145 */ | 76 | "QLE2440", "PCI-Express to 4Gb FC, Single Channel", /* 0x145 */ |
77 | "QLE2464", "PCI-Express to 4Gb FC, Quad Channel", /* 0x146 */ | 77 | "QLE2464", "PCI-Express to 4Gb FC, Quad Channel", /* 0x146 */ |
78 | "QLA2440", "PCI-X 2.0 to 4Gb FC, Single Channel", /* 0x147 */ | 78 | "QLA2440", "PCI-X 2.0 to 4Gb FC, Single Channel", /* 0x147 */ |
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index 7abb045a0410..ffff42554087 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h | |||
@@ -1402,6 +1402,8 @@ struct access_chip_rsp_84xx { | |||
1402 | #define MBA_IDC_NOTIFY 0x8101 | 1402 | #define MBA_IDC_NOTIFY 0x8101 |
1403 | #define MBA_IDC_TIME_EXT 0x8102 | 1403 | #define MBA_IDC_TIME_EXT 0x8102 |
1404 | 1404 | ||
1405 | #define MBC_IDC_ACK 0x101 | ||
1406 | |||
1405 | struct nvram_81xx { | 1407 | struct nvram_81xx { |
1406 | /* NVRAM header. */ | 1408 | /* NVRAM header. */ |
1407 | uint8_t id[4]; | 1409 | uint8_t id[4]; |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index a336b4bc81a7..6de283f8f111 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -72,6 +72,7 @@ extern int qla2x00_loop_reset(scsi_qla_host_t *); | |||
72 | extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); | 72 | extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); |
73 | extern int qla2x00_post_aen_work(struct scsi_qla_host *, enum | 73 | extern int qla2x00_post_aen_work(struct scsi_qla_host *, enum |
74 | fc_host_event_code, u32); | 74 | fc_host_event_code, u32); |
75 | extern int qla2x00_post_idc_ack_work(struct scsi_qla_host *, uint16_t *); | ||
75 | 76 | ||
76 | extern void qla2x00_abort_fcport_cmds(fc_port_t *); | 77 | extern void qla2x00_abort_fcport_cmds(fc_port_t *); |
77 | extern struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *, | 78 | extern struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *, |
@@ -266,6 +267,8 @@ qla2x00_set_idma_speed(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t *); | |||
266 | 267 | ||
267 | extern int qla84xx_verify_chip(struct scsi_qla_host *, uint16_t *); | 268 | extern int qla84xx_verify_chip(struct scsi_qla_host *, uint16_t *); |
268 | 269 | ||
270 | extern int qla81xx_idc_ack(scsi_qla_host_t *, uint16_t *); | ||
271 | |||
269 | /* | 272 | /* |
270 | * Global Function Prototypes in qla_isr.c source file. | 273 | * Global Function Prototypes in qla_isr.c source file. |
271 | */ | 274 | */ |
@@ -376,10 +379,8 @@ extern int qla2x00_dfs_remove(scsi_qla_host_t *); | |||
376 | 379 | ||
377 | /* Globa function prototypes for multi-q */ | 380 | /* Globa function prototypes for multi-q */ |
378 | extern int qla25xx_request_irq(struct rsp_que *); | 381 | extern int qla25xx_request_irq(struct rsp_que *); |
379 | extern int qla25xx_init_req_que(struct scsi_qla_host *, struct req_que *, | 382 | extern int qla25xx_init_req_que(struct scsi_qla_host *, struct req_que *); |
380 | uint8_t); | 383 | extern int qla25xx_init_rsp_que(struct scsi_qla_host *, struct rsp_que *); |
381 | extern int qla25xx_init_rsp_que(struct scsi_qla_host *, struct rsp_que *, | ||
382 | uint8_t); | ||
383 | extern int qla25xx_create_req_que(struct qla_hw_data *, uint16_t, uint8_t, | 384 | extern int qla25xx_create_req_que(struct qla_hw_data *, uint16_t, uint8_t, |
384 | uint16_t, uint8_t, uint8_t); | 385 | uint16_t, uint8_t, uint8_t); |
385 | extern int qla25xx_create_rsp_que(struct qla_hw_data *, uint16_t, uint8_t, | 386 | extern int qla25xx_create_rsp_que(struct qla_hw_data *, uint16_t, uint8_t, |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index f6368a1d3021..986501759ad4 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -1226,9 +1226,8 @@ qla24xx_config_rings(struct scsi_qla_host *vha) | |||
1226 | icb->firmware_options_2 |= | 1226 | icb->firmware_options_2 |= |
1227 | __constant_cpu_to_le32(BIT_18); | 1227 | __constant_cpu_to_le32(BIT_18); |
1228 | 1228 | ||
1229 | icb->firmware_options_2 |= __constant_cpu_to_le32(BIT_22); | 1229 | icb->firmware_options_2 &= __constant_cpu_to_le32(~BIT_22); |
1230 | icb->firmware_options_2 |= __constant_cpu_to_le32(BIT_23); | 1230 | icb->firmware_options_2 |= __constant_cpu_to_le32(BIT_23); |
1231 | ha->rsp_q_map[0]->options = icb->firmware_options_2; | ||
1232 | 1231 | ||
1233 | WRT_REG_DWORD(®->isp25mq.req_q_in, 0); | 1232 | WRT_REG_DWORD(®->isp25mq.req_q_in, 0); |
1234 | WRT_REG_DWORD(®->isp25mq.req_q_out, 0); | 1233 | WRT_REG_DWORD(®->isp25mq.req_q_out, 0); |
@@ -3493,7 +3492,7 @@ qla25xx_init_queues(struct qla_hw_data *ha) | |||
3493 | rsp = ha->rsp_q_map[i]; | 3492 | rsp = ha->rsp_q_map[i]; |
3494 | if (rsp) { | 3493 | if (rsp) { |
3495 | rsp->options &= ~BIT_0; | 3494 | rsp->options &= ~BIT_0; |
3496 | ret = qla25xx_init_rsp_que(base_vha, rsp, rsp->options); | 3495 | ret = qla25xx_init_rsp_que(base_vha, rsp); |
3497 | if (ret != QLA_SUCCESS) | 3496 | if (ret != QLA_SUCCESS) |
3498 | DEBUG2_17(printk(KERN_WARNING | 3497 | DEBUG2_17(printk(KERN_WARNING |
3499 | "%s Rsp que:%d init failed\n", __func__, | 3498 | "%s Rsp que:%d init failed\n", __func__, |
@@ -3507,7 +3506,7 @@ qla25xx_init_queues(struct qla_hw_data *ha) | |||
3507 | if (req) { | 3506 | if (req) { |
3508 | /* Clear outstanding commands array. */ | 3507 | /* Clear outstanding commands array. */ |
3509 | req->options &= ~BIT_0; | 3508 | req->options &= ~BIT_0; |
3510 | ret = qla25xx_init_req_que(base_vha, req, req->options); | 3509 | ret = qla25xx_init_req_que(base_vha, req); |
3511 | if (ret != QLA_SUCCESS) | 3510 | if (ret != QLA_SUCCESS) |
3512 | DEBUG2_17(printk(KERN_WARNING | 3511 | DEBUG2_17(printk(KERN_WARNING |
3513 | "%s Req que:%d init failed\n", __func__, | 3512 | "%s Req que:%d init failed\n", __func__, |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index e28ad81baf1e..f250e5b7897c 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -266,6 +266,40 @@ qla2x00_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0) | |||
266 | } | 266 | } |
267 | } | 267 | } |
268 | 268 | ||
269 | static void | ||
270 | qla81xx_idc_event(scsi_qla_host_t *vha, uint16_t aen, uint16_t descr) | ||
271 | { | ||
272 | static char *event[] = | ||
273 | { "Complete", "Request Notification", "Time Extension" }; | ||
274 | int rval; | ||
275 | struct device_reg_24xx __iomem *reg24 = &vha->hw->iobase->isp24; | ||
276 | uint16_t __iomem *wptr; | ||
277 | uint16_t cnt, timeout, mb[QLA_IDC_ACK_REGS]; | ||
278 | |||
279 | /* Seed data -- mailbox1 -> mailbox7. */ | ||
280 | wptr = (uint16_t __iomem *)®24->mailbox1; | ||
281 | for (cnt = 0; cnt < QLA_IDC_ACK_REGS; cnt++, wptr++) | ||
282 | mb[cnt] = RD_REG_WORD(wptr); | ||
283 | |||
284 | DEBUG2(printk("scsi(%ld): Inter-Driver Commucation %s -- " | ||
285 | "%04x %04x %04x %04x %04x %04x %04x.\n", vha->host_no, | ||
286 | event[aen & 0xff], | ||
287 | mb[0], mb[1], mb[2], mb[3], mb[4], mb[5], mb[6])); | ||
288 | |||
289 | /* Acknowledgement needed? [Notify && non-zero timeout]. */ | ||
290 | timeout = (descr >> 8) & 0xf; | ||
291 | if (aen != MBA_IDC_NOTIFY || !timeout) | ||
292 | return; | ||
293 | |||
294 | DEBUG2(printk("scsi(%ld): Inter-Driver Commucation %s -- " | ||
295 | "ACK timeout=%d.\n", vha->host_no, event[aen & 0xff], timeout)); | ||
296 | |||
297 | rval = qla2x00_post_idc_ack_work(vha, mb); | ||
298 | if (rval != QLA_SUCCESS) | ||
299 | qla_printk(KERN_WARNING, vha->hw, | ||
300 | "IDC failed to post ACK.\n"); | ||
301 | } | ||
302 | |||
269 | /** | 303 | /** |
270 | * qla2x00_async_event() - Process aynchronous events. | 304 | * qla2x00_async_event() - Process aynchronous events. |
271 | * @ha: SCSI driver HA context | 305 | * @ha: SCSI driver HA context |
@@ -714,21 +748,9 @@ skip_rio: | |||
714 | "%04x %04x %04x\n", vha->host_no, mb[1], mb[2], mb[3])); | 748 | "%04x %04x %04x\n", vha->host_no, mb[1], mb[2], mb[3])); |
715 | break; | 749 | break; |
716 | case MBA_IDC_COMPLETE: | 750 | case MBA_IDC_COMPLETE: |
717 | DEBUG2(printk("scsi(%ld): Inter-Driver Commucation " | ||
718 | "Complete -- %04x %04x %04x\n", vha->host_no, mb[1], mb[2], | ||
719 | mb[3])); | ||
720 | break; | ||
721 | case MBA_IDC_NOTIFY: | 751 | case MBA_IDC_NOTIFY: |
722 | DEBUG2(printk("scsi(%ld): Inter-Driver Commucation " | ||
723 | "Request Notification -- %04x %04x %04x\n", vha->host_no, | ||
724 | mb[1], mb[2], mb[3])); | ||
725 | /**** Mailbox registers 4 - 7 valid!!! */ | ||
726 | break; | ||
727 | case MBA_IDC_TIME_EXT: | 752 | case MBA_IDC_TIME_EXT: |
728 | DEBUG2(printk("scsi(%ld): Inter-Driver Commucation " | 753 | qla81xx_idc_event(vha, mb[0], mb[1]); |
729 | "Time Extension -- %04x %04x %04x\n", vha->host_no, mb[1], | ||
730 | mb[2], mb[3])); | ||
731 | /**** Mailbox registers 4 - 7 valid!!! */ | ||
732 | break; | 754 | break; |
733 | } | 755 | } |
734 | 756 | ||
@@ -1707,7 +1729,6 @@ qla25xx_msix_rsp_q(int irq, void *dev_id) | |||
1707 | struct qla_hw_data *ha; | 1729 | struct qla_hw_data *ha; |
1708 | struct rsp_que *rsp; | 1730 | struct rsp_que *rsp; |
1709 | struct device_reg_24xx __iomem *reg; | 1731 | struct device_reg_24xx __iomem *reg; |
1710 | uint16_t msix_disabled_hccr = 0; | ||
1711 | 1732 | ||
1712 | rsp = (struct rsp_que *) dev_id; | 1733 | rsp = (struct rsp_que *) dev_id; |
1713 | if (!rsp) { | 1734 | if (!rsp) { |
@@ -1720,17 +1741,8 @@ qla25xx_msix_rsp_q(int irq, void *dev_id) | |||
1720 | 1741 | ||
1721 | spin_lock_irq(&ha->hardware_lock); | 1742 | spin_lock_irq(&ha->hardware_lock); |
1722 | 1743 | ||
1723 | msix_disabled_hccr = rsp->options; | ||
1724 | if (!rsp->id) | ||
1725 | msix_disabled_hccr &= __constant_cpu_to_le32(BIT_22); | ||
1726 | else | ||
1727 | msix_disabled_hccr &= __constant_cpu_to_le32(BIT_6); | ||
1728 | |||
1729 | qla24xx_process_response_queue(rsp); | 1744 | qla24xx_process_response_queue(rsp); |
1730 | 1745 | ||
1731 | if (!msix_disabled_hccr) | ||
1732 | WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_INT); | ||
1733 | |||
1734 | spin_unlock_irq(&ha->hardware_lock); | 1746 | spin_unlock_irq(&ha->hardware_lock); |
1735 | 1747 | ||
1736 | return IRQ_HANDLED; | 1748 | return IRQ_HANDLED; |
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index f94ffbb98e95..4c7504cb3990 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -3090,8 +3090,7 @@ verify_done: | |||
3090 | } | 3090 | } |
3091 | 3091 | ||
3092 | int | 3092 | int |
3093 | qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req, | 3093 | qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req) |
3094 | uint8_t options) | ||
3095 | { | 3094 | { |
3096 | int rval; | 3095 | int rval; |
3097 | unsigned long flags; | 3096 | unsigned long flags; |
@@ -3101,7 +3100,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req, | |||
3101 | struct qla_hw_data *ha = vha->hw; | 3100 | struct qla_hw_data *ha = vha->hw; |
3102 | 3101 | ||
3103 | mcp->mb[0] = MBC_INITIALIZE_MULTIQ; | 3102 | mcp->mb[0] = MBC_INITIALIZE_MULTIQ; |
3104 | mcp->mb[1] = options; | 3103 | mcp->mb[1] = req->options; |
3105 | mcp->mb[2] = MSW(LSD(req->dma)); | 3104 | mcp->mb[2] = MSW(LSD(req->dma)); |
3106 | mcp->mb[3] = LSW(LSD(req->dma)); | 3105 | mcp->mb[3] = LSW(LSD(req->dma)); |
3107 | mcp->mb[6] = MSW(MSD(req->dma)); | 3106 | mcp->mb[6] = MSW(MSD(req->dma)); |
@@ -3128,7 +3127,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req, | |||
3128 | mcp->tov = 60; | 3127 | mcp->tov = 60; |
3129 | 3128 | ||
3130 | spin_lock_irqsave(&ha->hardware_lock, flags); | 3129 | spin_lock_irqsave(&ha->hardware_lock, flags); |
3131 | if (!(options & BIT_0)) { | 3130 | if (!(req->options & BIT_0)) { |
3132 | WRT_REG_DWORD(®->req_q_in, 0); | 3131 | WRT_REG_DWORD(®->req_q_in, 0); |
3133 | WRT_REG_DWORD(®->req_q_out, 0); | 3132 | WRT_REG_DWORD(®->req_q_out, 0); |
3134 | } | 3133 | } |
@@ -3142,8 +3141,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req, | |||
3142 | } | 3141 | } |
3143 | 3142 | ||
3144 | int | 3143 | int |
3145 | qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp, | 3144 | qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp) |
3146 | uint8_t options) | ||
3147 | { | 3145 | { |
3148 | int rval; | 3146 | int rval; |
3149 | unsigned long flags; | 3147 | unsigned long flags; |
@@ -3153,7 +3151,7 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp, | |||
3153 | struct qla_hw_data *ha = vha->hw; | 3151 | struct qla_hw_data *ha = vha->hw; |
3154 | 3152 | ||
3155 | mcp->mb[0] = MBC_INITIALIZE_MULTIQ; | 3153 | mcp->mb[0] = MBC_INITIALIZE_MULTIQ; |
3156 | mcp->mb[1] = options; | 3154 | mcp->mb[1] = rsp->options; |
3157 | mcp->mb[2] = MSW(LSD(rsp->dma)); | 3155 | mcp->mb[2] = MSW(LSD(rsp->dma)); |
3158 | mcp->mb[3] = LSW(LSD(rsp->dma)); | 3156 | mcp->mb[3] = LSW(LSD(rsp->dma)); |
3159 | mcp->mb[6] = MSW(MSD(rsp->dma)); | 3157 | mcp->mb[6] = MSW(MSD(rsp->dma)); |
@@ -3178,7 +3176,7 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp, | |||
3178 | mcp->tov = 60; | 3176 | mcp->tov = 60; |
3179 | 3177 | ||
3180 | spin_lock_irqsave(&ha->hardware_lock, flags); | 3178 | spin_lock_irqsave(&ha->hardware_lock, flags); |
3181 | if (!(options & BIT_0)) { | 3179 | if (!(rsp->options & BIT_0)) { |
3182 | WRT_REG_DWORD(®->rsp_q_out, 0); | 3180 | WRT_REG_DWORD(®->rsp_q_out, 0); |
3183 | WRT_REG_DWORD(®->rsp_q_in, 0); | 3181 | WRT_REG_DWORD(®->rsp_q_in, 0); |
3184 | } | 3182 | } |
@@ -3193,3 +3191,29 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp, | |||
3193 | return rval; | 3191 | return rval; |
3194 | } | 3192 | } |
3195 | 3193 | ||
3194 | int | ||
3195 | qla81xx_idc_ack(scsi_qla_host_t *vha, uint16_t *mb) | ||
3196 | { | ||
3197 | int rval; | ||
3198 | mbx_cmd_t mc; | ||
3199 | mbx_cmd_t *mcp = &mc; | ||
3200 | |||
3201 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); | ||
3202 | |||
3203 | mcp->mb[0] = MBC_IDC_ACK; | ||
3204 | memcpy(&mcp->mb[1], mb, QLA_IDC_ACK_REGS * sizeof(uint16_t)); | ||
3205 | mcp->out_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0; | ||
3206 | mcp->in_mb = MBX_0; | ||
3207 | mcp->tov = MBX_TOV_SECONDS; | ||
3208 | mcp->flags = 0; | ||
3209 | rval = qla2x00_mailbox_command(vha, mcp); | ||
3210 | |||
3211 | if (rval != QLA_SUCCESS) { | ||
3212 | DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__, | ||
3213 | vha->host_no, rval, mcp->mb[0])); | ||
3214 | } else { | ||
3215 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); | ||
3216 | } | ||
3217 | |||
3218 | return rval; | ||
3219 | } | ||
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index f53179c46423..3f23932210c4 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
@@ -396,7 +396,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) | |||
396 | 396 | ||
397 | qla2x00_start_timer(vha, qla2x00_timer, WATCH_INTERVAL); | 397 | qla2x00_start_timer(vha, qla2x00_timer, WATCH_INTERVAL); |
398 | 398 | ||
399 | memset(vha->req_ques, 0, sizeof(vha->req_ques) * QLA_MAX_HOST_QUES); | 399 | memset(vha->req_ques, 0, sizeof(vha->req_ques)); |
400 | vha->req_ques[0] = ha->req_q_map[0]->id; | 400 | vha->req_ques[0] = ha->req_q_map[0]->id; |
401 | host->can_queue = ha->req_q_map[0]->length + 128; | 401 | host->can_queue = ha->req_q_map[0]->length + 128; |
402 | host->this_id = 255; | 402 | host->this_id = 255; |
@@ -471,7 +471,7 @@ qla25xx_delete_req_que(struct scsi_qla_host *vha, struct req_que *req) | |||
471 | 471 | ||
472 | if (req) { | 472 | if (req) { |
473 | req->options |= BIT_0; | 473 | req->options |= BIT_0; |
474 | ret = qla25xx_init_req_que(vha, req, req->options); | 474 | ret = qla25xx_init_req_que(vha, req); |
475 | } | 475 | } |
476 | if (ret == QLA_SUCCESS) | 476 | if (ret == QLA_SUCCESS) |
477 | qla25xx_free_req_que(vha, req); | 477 | qla25xx_free_req_que(vha, req); |
@@ -486,7 +486,7 @@ qla25xx_delete_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp) | |||
486 | 486 | ||
487 | if (rsp) { | 487 | if (rsp) { |
488 | rsp->options |= BIT_0; | 488 | rsp->options |= BIT_0; |
489 | ret = qla25xx_init_rsp_que(vha, rsp, rsp->options); | 489 | ret = qla25xx_init_rsp_que(vha, rsp); |
490 | } | 490 | } |
491 | if (ret == QLA_SUCCESS) | 491 | if (ret == QLA_SUCCESS) |
492 | qla25xx_free_rsp_que(vha, rsp); | 492 | qla25xx_free_rsp_que(vha, rsp); |
@@ -502,7 +502,7 @@ int qla25xx_update_req_que(struct scsi_qla_host *vha, uint8_t que, uint8_t qos) | |||
502 | 502 | ||
503 | req->options |= BIT_3; | 503 | req->options |= BIT_3; |
504 | req->qos = qos; | 504 | req->qos = qos; |
505 | ret = qla25xx_init_req_que(vha, req, req->options); | 505 | ret = qla25xx_init_req_que(vha, req); |
506 | if (ret != QLA_SUCCESS) | 506 | if (ret != QLA_SUCCESS) |
507 | DEBUG2_17(printk(KERN_WARNING "%s failed\n", __func__)); | 507 | DEBUG2_17(printk(KERN_WARNING "%s failed\n", __func__)); |
508 | /* restore options bit */ | 508 | /* restore options bit */ |
@@ -632,7 +632,7 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options, | |||
632 | req->max_q_depth = ha->req_q_map[0]->max_q_depth; | 632 | req->max_q_depth = ha->req_q_map[0]->max_q_depth; |
633 | mutex_unlock(&ha->vport_lock); | 633 | mutex_unlock(&ha->vport_lock); |
634 | 634 | ||
635 | ret = qla25xx_init_req_que(base_vha, req, options); | 635 | ret = qla25xx_init_req_que(base_vha, req); |
636 | if (ret != QLA_SUCCESS) { | 636 | if (ret != QLA_SUCCESS) { |
637 | qla_printk(KERN_WARNING, ha, "%s failed\n", __func__); | 637 | qla_printk(KERN_WARNING, ha, "%s failed\n", __func__); |
638 | mutex_lock(&ha->vport_lock); | 638 | mutex_lock(&ha->vport_lock); |
@@ -710,7 +710,7 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options, | |||
710 | if (ret) | 710 | if (ret) |
711 | goto que_failed; | 711 | goto que_failed; |
712 | 712 | ||
713 | ret = qla25xx_init_rsp_que(base_vha, rsp, options); | 713 | ret = qla25xx_init_rsp_que(base_vha, rsp); |
714 | if (ret != QLA_SUCCESS) { | 714 | if (ret != QLA_SUCCESS) { |
715 | qla_printk(KERN_WARNING, ha, "%s failed\n", __func__); | 715 | qla_printk(KERN_WARNING, ha, "%s failed\n", __func__); |
716 | mutex_lock(&ha->vport_lock); | 716 | mutex_lock(&ha->vport_lock); |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index c11f872d3e10..2f5f72531e23 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -2522,6 +2522,19 @@ qla2x00_post_aen_work(struct scsi_qla_host *vha, enum fc_host_event_code code, | |||
2522 | return qla2x00_post_work(vha, e, 1); | 2522 | return qla2x00_post_work(vha, e, 1); |
2523 | } | 2523 | } |
2524 | 2524 | ||
2525 | int | ||
2526 | qla2x00_post_idc_ack_work(struct scsi_qla_host *vha, uint16_t *mb) | ||
2527 | { | ||
2528 | struct qla_work_evt *e; | ||
2529 | |||
2530 | e = qla2x00_alloc_work(vha, QLA_EVT_IDC_ACK, 1); | ||
2531 | if (!e) | ||
2532 | return QLA_FUNCTION_FAILED; | ||
2533 | |||
2534 | memcpy(e->u.idc_ack.mb, mb, QLA_IDC_ACK_REGS * sizeof(uint16_t)); | ||
2535 | return qla2x00_post_work(vha, e, 1); | ||
2536 | } | ||
2537 | |||
2525 | static void | 2538 | static void |
2526 | qla2x00_do_work(struct scsi_qla_host *vha) | 2539 | qla2x00_do_work(struct scsi_qla_host *vha) |
2527 | { | 2540 | { |
@@ -2539,6 +2552,9 @@ qla2x00_do_work(struct scsi_qla_host *vha) | |||
2539 | fc_host_post_event(vha->host, fc_get_event_number(), | 2552 | fc_host_post_event(vha->host, fc_get_event_number(), |
2540 | e->u.aen.code, e->u.aen.data); | 2553 | e->u.aen.code, e->u.aen.data); |
2541 | break; | 2554 | break; |
2555 | case QLA_EVT_IDC_ACK: | ||
2556 | qla81xx_idc_ack(vha, e->u.idc_ack.mb); | ||
2557 | break; | ||
2542 | } | 2558 | } |
2543 | if (e->flags & QLA_EVT_FLAG_FREE) | 2559 | if (e->flags & QLA_EVT_FLAG_FREE) |
2544 | kfree(e); | 2560 | kfree(e); |
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c index 9c3b694c049d..284827926eff 100644 --- a/drivers/scsi/qla2xxx/qla_sup.c +++ b/drivers/scsi/qla2xxx/qla_sup.c | |||
@@ -684,7 +684,7 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr) | |||
684 | "end=0x%x size=0x%x.\n", le32_to_cpu(region->code), start, | 684 | "end=0x%x size=0x%x.\n", le32_to_cpu(region->code), start, |
685 | le32_to_cpu(region->end) >> 2, le32_to_cpu(region->size))); | 685 | le32_to_cpu(region->end) >> 2, le32_to_cpu(region->size))); |
686 | 686 | ||
687 | switch (le32_to_cpu(region->code)) { | 687 | switch (le32_to_cpu(region->code) & 0xff) { |
688 | case FLT_REG_FW: | 688 | case FLT_REG_FW: |
689 | ha->flt_region_fw = start; | 689 | ha->flt_region_fw = start; |
690 | break; | 690 | break; |
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index cfa4c11a4797..79f7053da99b 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
@@ -7,7 +7,7 @@ | |||
7 | /* | 7 | /* |
8 | * Driver version | 8 | * Driver version |
9 | */ | 9 | */ |
10 | #define QLA2XXX_VERSION "8.03.00-k2" | 10 | #define QLA2XXX_VERSION "8.03.00-k3" |
11 | 11 | ||
12 | #define QLA_DRIVER_MAJOR_VER 8 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
13 | #define QLA_DRIVER_MINOR_VER 3 | 13 | #define QLA_DRIVER_MINOR_VER 3 |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 66505bb79410..8f4de20c9deb 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -317,6 +317,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, | |||
317 | return sdev; | 317 | return sdev; |
318 | 318 | ||
319 | out_device_destroy: | 319 | out_device_destroy: |
320 | scsi_device_set_state(sdev, SDEV_DEL); | ||
320 | transport_destroy_device(&sdev->sdev_gendev); | 321 | transport_destroy_device(&sdev->sdev_gendev); |
321 | put_device(&sdev->sdev_gendev); | 322 | put_device(&sdev->sdev_gendev); |
322 | out: | 323 | out: |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 8f0bd3f7a59f..516925d8b570 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1078,7 +1078,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
1078 | case BLKTRACESETUP: | 1078 | case BLKTRACESETUP: |
1079 | return blk_trace_setup(sdp->device->request_queue, | 1079 | return blk_trace_setup(sdp->device->request_queue, |
1080 | sdp->disk->disk_name, | 1080 | sdp->disk->disk_name, |
1081 | sdp->device->sdev_gendev.devt, | 1081 | MKDEV(SCSI_GENERIC_MAJOR, sdp->index), |
1082 | (char *)arg); | 1082 | (char *)arg); |
1083 | case BLKTRACESTART: | 1083 | case BLKTRACESTART: |
1084 | return blk_trace_startstop(sdp->device->request_queue, 1); | 1084 | return blk_trace_startstop(sdp->device->request_queue, 1); |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 0d934bfbdd9b..b4b39811b445 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -2083,6 +2083,20 @@ static int serial8250_startup(struct uart_port *port) | |||
2083 | 2083 | ||
2084 | serial8250_set_mctrl(&up->port, up->port.mctrl); | 2084 | serial8250_set_mctrl(&up->port, up->port.mctrl); |
2085 | 2085 | ||
2086 | /* Serial over Lan (SoL) hack: | ||
2087 | Intel 8257x Gigabit ethernet chips have a | ||
2088 | 16550 emulation, to be used for Serial Over Lan. | ||
2089 | Those chips take a longer time than a normal | ||
2090 | serial device to signalize that a transmission | ||
2091 | data was queued. Due to that, the above test generally | ||
2092 | fails. One solution would be to delay the reading of | ||
2093 | iir. However, this is not reliable, since the timeout | ||
2094 | is variable. So, let's just don't test if we receive | ||
2095 | TX irq. This way, we'll never enable UART_BUG_TXEN. | ||
2096 | */ | ||
2097 | if (up->port.flags & UPF_NO_TXEN_TEST) | ||
2098 | goto dont_test_tx_en; | ||
2099 | |||
2086 | /* | 2100 | /* |
2087 | * Do a quick test to see if we receive an | 2101 | * Do a quick test to see if we receive an |
2088 | * interrupt when we enable the TX irq. | 2102 | * interrupt when we enable the TX irq. |
@@ -2102,6 +2116,7 @@ static int serial8250_startup(struct uart_port *port) | |||
2102 | up->bugs &= ~UART_BUG_TXEN; | 2116 | up->bugs &= ~UART_BUG_TXEN; |
2103 | } | 2117 | } |
2104 | 2118 | ||
2119 | dont_test_tx_en: | ||
2105 | spin_unlock_irqrestore(&up->port.lock, flags); | 2120 | spin_unlock_irqrestore(&up->port.lock, flags); |
2106 | 2121 | ||
2107 | /* | 2122 | /* |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 536d8e510f66..533f82025adf 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -798,6 +798,21 @@ pci_default_setup(struct serial_private *priv, | |||
798 | return setup_port(priv, port, bar, offset, board->reg_shift); | 798 | return setup_port(priv, port, bar, offset, board->reg_shift); |
799 | } | 799 | } |
800 | 800 | ||
801 | static int skip_tx_en_setup(struct serial_private *priv, | ||
802 | const struct pciserial_board *board, | ||
803 | struct uart_port *port, int idx) | ||
804 | { | ||
805 | port->flags |= UPF_NO_TXEN_TEST; | ||
806 | printk(KERN_DEBUG "serial8250: skipping TxEn test for device " | ||
807 | "[%04x:%04x] subsystem [%04x:%04x]\n", | ||
808 | priv->dev->vendor, | ||
809 | priv->dev->device, | ||
810 | priv->dev->subsystem_vendor, | ||
811 | priv->dev->subsystem_device); | ||
812 | |||
813 | return pci_default_setup(priv, board, port, idx); | ||
814 | } | ||
815 | |||
801 | /* This should be in linux/pci_ids.h */ | 816 | /* This should be in linux/pci_ids.h */ |
802 | #define PCI_VENDOR_ID_SBSMODULARIO 0x124B | 817 | #define PCI_VENDOR_ID_SBSMODULARIO 0x124B |
803 | #define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B | 818 | #define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B |
@@ -864,6 +879,27 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
864 | .init = pci_inteli960ni_init, | 879 | .init = pci_inteli960ni_init, |
865 | .setup = pci_default_setup, | 880 | .setup = pci_default_setup, |
866 | }, | 881 | }, |
882 | { | ||
883 | .vendor = PCI_VENDOR_ID_INTEL, | ||
884 | .device = PCI_DEVICE_ID_INTEL_8257X_SOL, | ||
885 | .subvendor = PCI_ANY_ID, | ||
886 | .subdevice = PCI_ANY_ID, | ||
887 | .setup = skip_tx_en_setup, | ||
888 | }, | ||
889 | { | ||
890 | .vendor = PCI_VENDOR_ID_INTEL, | ||
891 | .device = PCI_DEVICE_ID_INTEL_82573L_SOL, | ||
892 | .subvendor = PCI_ANY_ID, | ||
893 | .subdevice = PCI_ANY_ID, | ||
894 | .setup = skip_tx_en_setup, | ||
895 | }, | ||
896 | { | ||
897 | .vendor = PCI_VENDOR_ID_INTEL, | ||
898 | .device = PCI_DEVICE_ID_INTEL_82573E_SOL, | ||
899 | .subvendor = PCI_ANY_ID, | ||
900 | .subdevice = PCI_ANY_ID, | ||
901 | .setup = skip_tx_en_setup, | ||
902 | }, | ||
867 | /* | 903 | /* |
868 | * ITE | 904 | * ITE |
869 | */ | 905 | */ |
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 89362d733d62..8f58f7ff0dd7 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -877,6 +877,10 @@ static int atmel_startup(struct uart_port *port) | |||
877 | } | 877 | } |
878 | } | 878 | } |
879 | 879 | ||
880 | /* Save current CSR for comparison in atmel_tasklet_func() */ | ||
881 | atmel_port->irq_status_prev = UART_GET_CSR(port); | ||
882 | atmel_port->irq_status = atmel_port->irq_status_prev; | ||
883 | |||
880 | /* | 884 | /* |
881 | * Finally, enable the serial port | 885 | * Finally, enable the serial port |
882 | */ | 886 | */ |
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c index 92187e28608a..ac79cbe4c2cf 100644 --- a/drivers/serial/jsm/jsm_driver.c +++ b/drivers/serial/jsm/jsm_driver.c | |||
@@ -84,6 +84,8 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
84 | brd->pci_dev = pdev; | 84 | brd->pci_dev = pdev; |
85 | if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM) | 85 | if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM) |
86 | brd->maxports = 4; | 86 | brd->maxports = 4; |
87 | else if (pdev->device == PCI_DEVICE_ID_DIGI_NEO_8) | ||
88 | brd->maxports = 8; | ||
87 | else | 89 | else |
88 | brd->maxports = 2; | 90 | brd->maxports = 2; |
89 | 91 | ||
@@ -212,6 +214,7 @@ static struct pci_device_id jsm_pci_tbl[] = { | |||
212 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 }, | 214 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 }, |
213 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 }, | 215 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 }, |
214 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 }, | 216 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 }, |
217 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_NEO_8), 0, 0, 5 }, | ||
215 | { 0, } | 218 | { 0, } |
216 | }; | 219 | }; |
217 | MODULE_DEVICE_TABLE(pci, jsm_pci_tbl); | 220 | MODULE_DEVICE_TABLE(pci, jsm_pci_tbl); |
diff --git a/drivers/spi/spi_gpio.c b/drivers/spi/spi_gpio.c index 49698cabc30d..f5ed9721aabb 100644 --- a/drivers/spi/spi_gpio.c +++ b/drivers/spi/spi_gpio.c | |||
@@ -114,7 +114,7 @@ static inline void setmosi(const struct spi_device *spi, int is_on) | |||
114 | 114 | ||
115 | static inline int getmiso(const struct spi_device *spi) | 115 | static inline int getmiso(const struct spi_device *spi) |
116 | { | 116 | { |
117 | return gpio_get_value(SPI_MISO_GPIO); | 117 | return !!gpio_get_value(SPI_MISO_GPIO); |
118 | } | 118 | } |
119 | 119 | ||
120 | #undef pdata | 120 | #undef pdata |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index c54fc40458b1..a4301dc02d27 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -298,19 +298,6 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message) | |||
298 | EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend); | 298 | EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend); |
299 | 299 | ||
300 | /** | 300 | /** |
301 | * usb_hcd_pci_resume_early - resume a PCI-based HCD before IRQs are enabled | ||
302 | * @dev: USB Host Controller being resumed | ||
303 | * | ||
304 | * Store this function in the HCD's struct pci_driver as .resume_early. | ||
305 | */ | ||
306 | int usb_hcd_pci_resume_early(struct pci_dev *dev) | ||
307 | { | ||
308 | pci_restore_state(dev); | ||
309 | return 0; | ||
310 | } | ||
311 | EXPORT_SYMBOL_GPL(usb_hcd_pci_resume_early); | ||
312 | |||
313 | /** | ||
314 | * usb_hcd_pci_resume - power management resume of a PCI-based HCD | 301 | * usb_hcd_pci_resume - power management resume of a PCI-based HCD |
315 | * @dev: USB Host Controller being resumed | 302 | * @dev: USB Host Controller being resumed |
316 | * | 303 | * |
@@ -333,6 +320,8 @@ int usb_hcd_pci_resume(struct pci_dev *dev) | |||
333 | } | 320 | } |
334 | #endif | 321 | #endif |
335 | 322 | ||
323 | pci_restore_state(dev); | ||
324 | |||
336 | hcd = pci_get_drvdata(dev); | 325 | hcd = pci_get_drvdata(dev); |
337 | if (hcd->state != HC_STATE_SUSPENDED) { | 326 | if (hcd->state != HC_STATE_SUSPENDED) { |
338 | dev_dbg(hcd->self.controller, | 327 | dev_dbg(hcd->self.controller, |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 5b94a56bec23..f750eb1ab595 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -257,7 +257,6 @@ extern void usb_hcd_pci_remove(struct pci_dev *dev); | |||
257 | 257 | ||
258 | #ifdef CONFIG_PM | 258 | #ifdef CONFIG_PM |
259 | extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t msg); | 259 | extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t msg); |
260 | extern int usb_hcd_pci_resume_early(struct pci_dev *dev); | ||
261 | extern int usb_hcd_pci_resume(struct pci_dev *dev); | 260 | extern int usb_hcd_pci_resume(struct pci_dev *dev); |
262 | #endif /* CONFIG_PM */ | 261 | #endif /* CONFIG_PM */ |
263 | 262 | ||
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index 9b36205c5759..0ce4e2819847 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -904,8 +904,8 @@ static void pxa25x_ep_fifo_flush(struct usb_ep *_ep) | |||
904 | 904 | ||
905 | /* most IN status is the same, but ISO can't stall */ | 905 | /* most IN status is the same, but ISO can't stall */ |
906 | *ep->reg_udccs = UDCCS_BI_TPC|UDCCS_BI_FTF|UDCCS_BI_TUR | 906 | *ep->reg_udccs = UDCCS_BI_TPC|UDCCS_BI_FTF|UDCCS_BI_TUR |
907 | | (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) | 907 | | (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC |
908 | ? 0 : UDCCS_BI_SST; | 908 | ? 0 : UDCCS_BI_SST); |
909 | } | 909 | } |
910 | 910 | ||
911 | 911 | ||
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index bb21fb0a4969..abb9a7706ec7 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -432,7 +432,6 @@ static struct pci_driver ehci_pci_driver = { | |||
432 | 432 | ||
433 | #ifdef CONFIG_PM | 433 | #ifdef CONFIG_PM |
434 | .suspend = usb_hcd_pci_suspend, | 434 | .suspend = usb_hcd_pci_suspend, |
435 | .resume_early = usb_hcd_pci_resume_early, | ||
436 | .resume = usb_hcd_pci_resume, | 435 | .resume = usb_hcd_pci_resume, |
437 | #endif | 436 | #endif |
438 | .shutdown = usb_hcd_pci_shutdown, | 437 | .shutdown = usb_hcd_pci_shutdown, |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 5d625c3fd423..f9961b4c0da3 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -487,7 +487,6 @@ static struct pci_driver ohci_pci_driver = { | |||
487 | 487 | ||
488 | #ifdef CONFIG_PM | 488 | #ifdef CONFIG_PM |
489 | .suspend = usb_hcd_pci_suspend, | 489 | .suspend = usb_hcd_pci_suspend, |
490 | .resume_early = usb_hcd_pci_resume_early, | ||
491 | .resume = usb_hcd_pci_resume, | 490 | .resume = usb_hcd_pci_resume, |
492 | #endif | 491 | #endif |
493 | 492 | ||
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 944f7e0ca4df..cf5e4cf7ea42 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -942,7 +942,6 @@ static struct pci_driver uhci_pci_driver = { | |||
942 | 942 | ||
943 | #ifdef CONFIG_PM | 943 | #ifdef CONFIG_PM |
944 | .suspend = usb_hcd_pci_suspend, | 944 | .suspend = usb_hcd_pci_suspend, |
945 | .resume_early = usb_hcd_pci_resume_early, | ||
946 | .resume = usb_hcd_pci_resume, | 945 | .resume = usb_hcd_pci_resume, |
947 | #endif /* PM */ | 946 | #endif /* PM */ |
948 | }; | 947 | }; |
diff --git a/drivers/usb/host/whci/asl.c b/drivers/usb/host/whci/asl.c index 2291c5f5af51..958751ccea43 100644 --- a/drivers/usb/host/whci/asl.c +++ b/drivers/usb/host/whci/asl.c | |||
@@ -227,13 +227,13 @@ void scan_async_work(struct work_struct *work) | |||
227 | * Now that the ASL is updated, complete the removal of any | 227 | * Now that the ASL is updated, complete the removal of any |
228 | * removed qsets. | 228 | * removed qsets. |
229 | */ | 229 | */ |
230 | spin_lock(&whc->lock); | 230 | spin_lock_irq(&whc->lock); |
231 | 231 | ||
232 | list_for_each_entry_safe(qset, t, &whc->async_removed_list, list_node) { | 232 | list_for_each_entry_safe(qset, t, &whc->async_removed_list, list_node) { |
233 | qset_remove_complete(whc, qset); | 233 | qset_remove_complete(whc, qset); |
234 | } | 234 | } |
235 | 235 | ||
236 | spin_unlock(&whc->lock); | 236 | spin_unlock_irq(&whc->lock); |
237 | } | 237 | } |
238 | 238 | ||
239 | /** | 239 | /** |
diff --git a/drivers/usb/host/whci/pzl.c b/drivers/usb/host/whci/pzl.c index 7dc85a0bee7c..df8b85f07092 100644 --- a/drivers/usb/host/whci/pzl.c +++ b/drivers/usb/host/whci/pzl.c | |||
@@ -255,13 +255,13 @@ void scan_periodic_work(struct work_struct *work) | |||
255 | * Now that the PZL is updated, complete the removal of any | 255 | * Now that the PZL is updated, complete the removal of any |
256 | * removed qsets. | 256 | * removed qsets. |
257 | */ | 257 | */ |
258 | spin_lock(&whc->lock); | 258 | spin_lock_irq(&whc->lock); |
259 | 259 | ||
260 | list_for_each_entry_safe(qset, t, &whc->periodic_removed_list, list_node) { | 260 | list_for_each_entry_safe(qset, t, &whc->periodic_removed_list, list_node) { |
261 | qset_remove_complete(whc, qset); | 261 | qset_remove_complete(whc, qset); |
262 | } | 262 | } |
263 | 263 | ||
264 | spin_unlock(&whc->lock); | 264 | spin_unlock_irq(&whc->lock); |
265 | } | 265 | } |
266 | 266 | ||
267 | /** | 267 | /** |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index bf0af660df8a..fb19803060cf 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -1054,10 +1054,7 @@ config FB_RIVA_BACKLIGHT | |||
1054 | 1054 | ||
1055 | config FB_I810 | 1055 | config FB_I810 |
1056 | tristate "Intel 810/815 support (EXPERIMENTAL)" | 1056 | tristate "Intel 810/815 support (EXPERIMENTAL)" |
1057 | depends on EXPERIMENTAL && PCI && X86_32 | 1057 | depends on EXPERIMENTAL && FB && PCI && X86_32 && AGP_INTEL |
1058 | select AGP | ||
1059 | select AGP_INTEL | ||
1060 | select FB | ||
1061 | select FB_MODE_HELPERS | 1058 | select FB_MODE_HELPERS |
1062 | select FB_CFB_FILLRECT | 1059 | select FB_CFB_FILLRECT |
1063 | select FB_CFB_COPYAREA | 1060 | select FB_CFB_COPYAREA |
@@ -1120,10 +1117,7 @@ config FB_CARILLO_RANCH | |||
1120 | 1117 | ||
1121 | config FB_INTEL | 1118 | config FB_INTEL |
1122 | tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)" | 1119 | tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)" |
1123 | depends on EXPERIMENTAL && PCI && X86 | 1120 | depends on EXPERIMENTAL && FB && PCI && X86 && AGP_INTEL |
1124 | select FB | ||
1125 | select AGP | ||
1126 | select AGP_INTEL | ||
1127 | select FB_MODE_HELPERS | 1121 | select FB_MODE_HELPERS |
1128 | select FB_CFB_FILLRECT | 1122 | select FB_CFB_FILLRECT |
1129 | select FB_CFB_COPYAREA | 1123 | select FB_CFB_COPYAREA |
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c index 8058572a7428..018850c116c6 100644 --- a/drivers/video/atafb.c +++ b/drivers/video/atafb.c | |||
@@ -841,7 +841,7 @@ static int tt_detect(void) | |||
841 | tt_dmasnd.ctrl = DMASND_CTRL_OFF; | 841 | tt_dmasnd.ctrl = DMASND_CTRL_OFF; |
842 | udelay(20); /* wait a while for things to settle down */ | 842 | udelay(20); /* wait a while for things to settle down */ |
843 | } | 843 | } |
844 | mono_moni = (mfp.par_dt_reg & 0x80) == 0; | 844 | mono_moni = (st_mfp.par_dt_reg & 0x80) == 0; |
845 | 845 | ||
846 | tt_get_par(&par); | 846 | tt_get_par(&par); |
847 | tt_encode_var(&atafb_predefined[0], &par); | 847 | tt_encode_var(&atafb_predefined[0], &par); |
@@ -2035,7 +2035,7 @@ static int stste_detect(void) | |||
2035 | tt_dmasnd.ctrl = DMASND_CTRL_OFF; | 2035 | tt_dmasnd.ctrl = DMASND_CTRL_OFF; |
2036 | udelay(20); /* wait a while for things to settle down */ | 2036 | udelay(20); /* wait a while for things to settle down */ |
2037 | } | 2037 | } |
2038 | mono_moni = (mfp.par_dt_reg & 0x80) == 0; | 2038 | mono_moni = (st_mfp.par_dt_reg & 0x80) == 0; |
2039 | 2039 | ||
2040 | stste_get_par(&par); | 2040 | stste_get_par(&par); |
2041 | stste_encode_var(&atafb_predefined[0], &par); | 2041 | stste_encode_var(&atafb_predefined[0], &par); |
@@ -2086,20 +2086,20 @@ static void st_ovsc_switch(void) | |||
2086 | return; | 2086 | return; |
2087 | local_irq_save(flags); | 2087 | local_irq_save(flags); |
2088 | 2088 | ||
2089 | mfp.tim_ct_b = 0x10; | 2089 | st_mfp.tim_ct_b = 0x10; |
2090 | mfp.active_edge |= 8; | 2090 | st_mfp.active_edge |= 8; |
2091 | mfp.tim_ct_b = 0; | 2091 | st_mfp.tim_ct_b = 0; |
2092 | mfp.tim_dt_b = 0xf0; | 2092 | st_mfp.tim_dt_b = 0xf0; |
2093 | mfp.tim_ct_b = 8; | 2093 | st_mfp.tim_ct_b = 8; |
2094 | while (mfp.tim_dt_b > 1) /* TOS does it this way, don't ask why */ | 2094 | while (st_mfp.tim_dt_b > 1) /* TOS does it this way, don't ask why */ |
2095 | ; | 2095 | ; |
2096 | new = mfp.tim_dt_b; | 2096 | new = st_mfp.tim_dt_b; |
2097 | do { | 2097 | do { |
2098 | udelay(LINE_DELAY); | 2098 | udelay(LINE_DELAY); |
2099 | old = new; | 2099 | old = new; |
2100 | new = mfp.tim_dt_b; | 2100 | new = st_mfp.tim_dt_b; |
2101 | } while (old != new); | 2101 | } while (old != new); |
2102 | mfp.tim_ct_b = 0x10; | 2102 | st_mfp.tim_ct_b = 0x10; |
2103 | udelay(SYNC_DELAY); | 2103 | udelay(SYNC_DELAY); |
2104 | 2104 | ||
2105 | if (atari_switches & ATARI_SWITCH_OVSC_IKBD) | 2105 | if (atari_switches & ATARI_SWITCH_OVSC_IKBD) |
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index e6e299feb51b..2181ce4d7ebd 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -2365,7 +2365,6 @@ static void fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy, int dx | |||
2365 | static void aty128_set_suspend(struct aty128fb_par *par, int suspend) | 2365 | static void aty128_set_suspend(struct aty128fb_par *par, int suspend) |
2366 | { | 2366 | { |
2367 | u32 pmgt; | 2367 | u32 pmgt; |
2368 | u16 pwr_command; | ||
2369 | struct pci_dev *pdev = par->pdev; | 2368 | struct pci_dev *pdev = par->pdev; |
2370 | 2369 | ||
2371 | if (!par->pm_reg) | 2370 | if (!par->pm_reg) |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 09a3d5522b43..325c10ff6a2c 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -406,7 +406,7 @@ config ITCO_WDT | |||
406 | ---help--- | 406 | ---help--- |
407 | Hardware driver for the intel TCO timer based watchdog devices. | 407 | Hardware driver for the intel TCO timer based watchdog devices. |
408 | These drivers are included in the Intel 82801 I/O Controller | 408 | These drivers are included in the Intel 82801 I/O Controller |
409 | Hub family (from ICH0 up to ICH8) and in the Intel 6300ESB | 409 | Hub family (from ICH0 up to ICH10) and in the Intel 63xxESB |
410 | controller hub. | 410 | controller hub. |
411 | 411 | ||
412 | The TCO (Total Cost of Ownership) timer is a watchdog timer | 412 | The TCO (Total Cost of Ownership) timer is a watchdog timer |
diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c index 5531691f46ea..e35d54589232 100644 --- a/drivers/watchdog/at91rm9200_wdt.c +++ b/drivers/watchdog/at91rm9200_wdt.c | |||
@@ -107,10 +107,10 @@ static int at91_wdt_close(struct inode *inode, struct file *file) | |||
107 | static int at91_wdt_settimeout(int new_time) | 107 | static int at91_wdt_settimeout(int new_time) |
108 | { | 108 | { |
109 | /* | 109 | /* |
110 | * All counting occurs at SLOW_CLOCK / 128 = 0.256 Hz | 110 | * All counting occurs at SLOW_CLOCK / 128 = 256 Hz |
111 | * | 111 | * |
112 | * Since WDV is a 16-bit counter, the maximum period is | 112 | * Since WDV is a 16-bit counter, the maximum period is |
113 | * 65536 / 0.256 = 256 seconds. | 113 | * 65536 / 256 = 256 seconds. |
114 | */ | 114 | */ |
115 | if ((new_time <= 0) || (new_time > WDT_MAX_TIME)) | 115 | if ((new_time <= 0) || (new_time > WDT_MAX_TIME)) |
116 | return -EINVAL; | 116 | return -EINVAL; |
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c index b1da287f90ec..a56ac84381b1 100644 --- a/drivers/watchdog/at91sam9_wdt.c +++ b/drivers/watchdog/at91sam9_wdt.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/io.h> | ||
21 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
22 | #include <linux/miscdevice.h> | 23 | #include <linux/miscdevice.h> |
23 | #include <linux/module.h> | 24 | #include <linux/module.h> |
diff --git a/drivers/watchdog/iTCO_vendor_support.c b/drivers/watchdog/iTCO_vendor_support.c index 2474ebca88f6..d8264ad0be41 100644 --- a/drivers/watchdog/iTCO_vendor_support.c +++ b/drivers/watchdog/iTCO_vendor_support.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * intel TCO vendor specific watchdog driver support | 2 | * intel TCO vendor specific watchdog driver support |
3 | * | 3 | * |
4 | * (c) Copyright 2006-2008 Wim Van Sebroeck <wim@iguana.be>. | 4 | * (c) Copyright 2006-2009 Wim Van Sebroeck <wim@iguana.be>. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | /* Module and version information */ | 20 | /* Module and version information */ |
21 | #define DRV_NAME "iTCO_vendor_support" | 21 | #define DRV_NAME "iTCO_vendor_support" |
22 | #define DRV_VERSION "1.02" | 22 | #define DRV_VERSION "1.03" |
23 | #define PFX DRV_NAME ": " | 23 | #define PFX DRV_NAME ": " |
24 | 24 | ||
25 | /* Includes */ | 25 | /* Includes */ |
@@ -77,6 +77,26 @@ MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default=0 (n | |||
77 | * 20.6 seconds. | 77 | * 20.6 seconds. |
78 | */ | 78 | */ |
79 | 79 | ||
80 | static void supermicro_old_pre_start(unsigned long acpibase) | ||
81 | { | ||
82 | unsigned long val32; | ||
83 | |||
84 | /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */ | ||
85 | val32 = inl(SMI_EN); | ||
86 | val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ | ||
87 | outl(val32, SMI_EN); /* Needed to activate watchdog */ | ||
88 | } | ||
89 | |||
90 | static void supermicro_old_pre_stop(unsigned long acpibase) | ||
91 | { | ||
92 | unsigned long val32; | ||
93 | |||
94 | /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */ | ||
95 | val32 = inl(SMI_EN); | ||
96 | val32 |= 0x00002000; /* Turn on SMI clearing watchdog */ | ||
97 | outl(val32, SMI_EN); /* Needed to deactivate watchdog */ | ||
98 | } | ||
99 | |||
80 | static void supermicro_old_pre_keepalive(unsigned long acpibase) | 100 | static void supermicro_old_pre_keepalive(unsigned long acpibase) |
81 | { | 101 | { |
82 | /* Reload TCO Timer (done in iTCO_wdt_keepalive) + */ | 102 | /* Reload TCO Timer (done in iTCO_wdt_keepalive) + */ |
@@ -228,14 +248,18 @@ static void supermicro_new_pre_set_heartbeat(unsigned int heartbeat) | |||
228 | void iTCO_vendor_pre_start(unsigned long acpibase, | 248 | void iTCO_vendor_pre_start(unsigned long acpibase, |
229 | unsigned int heartbeat) | 249 | unsigned int heartbeat) |
230 | { | 250 | { |
231 | if (vendorsupport == SUPERMICRO_NEW_BOARD) | 251 | if (vendorsupport == SUPERMICRO_OLD_BOARD) |
252 | supermicro_old_pre_start(acpibase); | ||
253 | else if (vendorsupport == SUPERMICRO_NEW_BOARD) | ||
232 | supermicro_new_pre_start(heartbeat); | 254 | supermicro_new_pre_start(heartbeat); |
233 | } | 255 | } |
234 | EXPORT_SYMBOL(iTCO_vendor_pre_start); | 256 | EXPORT_SYMBOL(iTCO_vendor_pre_start); |
235 | 257 | ||
236 | void iTCO_vendor_pre_stop(unsigned long acpibase) | 258 | void iTCO_vendor_pre_stop(unsigned long acpibase) |
237 | { | 259 | { |
238 | if (vendorsupport == SUPERMICRO_NEW_BOARD) | 260 | if (vendorsupport == SUPERMICRO_OLD_BOARD) |
261 | supermicro_old_pre_stop(acpibase); | ||
262 | else if (vendorsupport == SUPERMICRO_NEW_BOARD) | ||
239 | supermicro_new_pre_stop(); | 263 | supermicro_new_pre_stop(); |
240 | } | 264 | } |
241 | EXPORT_SYMBOL(iTCO_vendor_pre_stop); | 265 | EXPORT_SYMBOL(iTCO_vendor_pre_stop); |
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index 5b395a4ddfdf..352334947ea3 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * intel TCO Watchdog Driver (Used in i82801 and i6300ESB chipsets) | 2 | * intel TCO Watchdog Driver (Used in i82801 and i63xxESB chipsets) |
3 | * | 3 | * |
4 | * (c) Copyright 2006-2008 Wim Van Sebroeck <wim@iguana.be>. | 4 | * (c) Copyright 2006-2009 Wim Van Sebroeck <wim@iguana.be>. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
@@ -63,7 +63,7 @@ | |||
63 | 63 | ||
64 | /* Module and version information */ | 64 | /* Module and version information */ |
65 | #define DRV_NAME "iTCO_wdt" | 65 | #define DRV_NAME "iTCO_wdt" |
66 | #define DRV_VERSION "1.04" | 66 | #define DRV_VERSION "1.05" |
67 | #define PFX DRV_NAME ": " | 67 | #define PFX DRV_NAME ": " |
68 | 68 | ||
69 | /* Includes */ | 69 | /* Includes */ |
@@ -236,16 +236,16 @@ MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl); | |||
236 | 236 | ||
237 | /* Address definitions for the TCO */ | 237 | /* Address definitions for the TCO */ |
238 | /* TCO base address */ | 238 | /* TCO base address */ |
239 | #define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60 | 239 | #define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60 |
240 | /* SMI Control and Enable Register */ | 240 | /* SMI Control and Enable Register */ |
241 | #define SMI_EN iTCO_wdt_private.ACPIBASE + 0x30 | 241 | #define SMI_EN iTCO_wdt_private.ACPIBASE + 0x30 |
242 | 242 | ||
243 | #define TCO_RLD TCOBASE + 0x00 /* TCO Timer Reload and Curr. Value */ | 243 | #define TCO_RLD TCOBASE + 0x00 /* TCO Timer Reload and Curr. Value */ |
244 | #define TCOv1_TMR TCOBASE + 0x01 /* TCOv1 Timer Initial Value */ | 244 | #define TCOv1_TMR TCOBASE + 0x01 /* TCOv1 Timer Initial Value */ |
245 | #define TCO_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */ | 245 | #define TCO_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */ |
246 | #define TCO_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */ | 246 | #define TCO_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */ |
247 | #define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ | 247 | #define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ |
248 | #define TCO2_STS TCOBASE + 0x06 /* TCO2 Status Register */ | 248 | #define TCO2_STS TCOBASE + 0x06 /* TCO2 Status Register */ |
249 | #define TCO1_CNT TCOBASE + 0x08 /* TCO1 Control Register */ | 249 | #define TCO1_CNT TCOBASE + 0x08 /* TCO1 Control Register */ |
250 | #define TCO2_CNT TCOBASE + 0x0a /* TCO2 Control Register */ | 250 | #define TCO2_CNT TCOBASE + 0x0a /* TCO2 Control Register */ |
251 | #define TCOv2_TMR TCOBASE + 0x12 /* TCOv2 Timer Initial Value */ | 251 | #define TCOv2_TMR TCOBASE + 0x12 /* TCOv2 Timer Initial Value */ |
@@ -338,7 +338,6 @@ static int iTCO_wdt_unset_NO_REBOOT_bit(void) | |||
338 | static int iTCO_wdt_start(void) | 338 | static int iTCO_wdt_start(void) |
339 | { | 339 | { |
340 | unsigned int val; | 340 | unsigned int val; |
341 | unsigned long val32; | ||
342 | 341 | ||
343 | spin_lock(&iTCO_wdt_private.io_lock); | 342 | spin_lock(&iTCO_wdt_private.io_lock); |
344 | 343 | ||
@@ -351,11 +350,6 @@ static int iTCO_wdt_start(void) | |||
351 | return -EIO; | 350 | return -EIO; |
352 | } | 351 | } |
353 | 352 | ||
354 | /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */ | ||
355 | val32 = inl(SMI_EN); | ||
356 | val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ | ||
357 | outl(val32, SMI_EN); | ||
358 | |||
359 | /* Force the timer to its reload value by writing to the TCO_RLD | 353 | /* Force the timer to its reload value by writing to the TCO_RLD |
360 | register */ | 354 | register */ |
361 | if (iTCO_wdt_private.iTCO_version == 2) | 355 | if (iTCO_wdt_private.iTCO_version == 2) |
@@ -378,7 +372,6 @@ static int iTCO_wdt_start(void) | |||
378 | static int iTCO_wdt_stop(void) | 372 | static int iTCO_wdt_stop(void) |
379 | { | 373 | { |
380 | unsigned int val; | 374 | unsigned int val; |
381 | unsigned long val32; | ||
382 | 375 | ||
383 | spin_lock(&iTCO_wdt_private.io_lock); | 376 | spin_lock(&iTCO_wdt_private.io_lock); |
384 | 377 | ||
@@ -390,11 +383,6 @@ static int iTCO_wdt_stop(void) | |||
390 | outw(val, TCO1_CNT); | 383 | outw(val, TCO1_CNT); |
391 | val = inw(TCO1_CNT); | 384 | val = inw(TCO1_CNT); |
392 | 385 | ||
393 | /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */ | ||
394 | val32 = inl(SMI_EN); | ||
395 | val32 |= 0x00002000; | ||
396 | outl(val32, SMI_EN); | ||
397 | |||
398 | /* Set the NO_REBOOT bit to prevent later reboots, just for sure */ | 386 | /* Set the NO_REBOOT bit to prevent later reboots, just for sure */ |
399 | iTCO_wdt_set_NO_REBOOT_bit(); | 387 | iTCO_wdt_set_NO_REBOOT_bit(); |
400 | 388 | ||
@@ -649,6 +637,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
649 | int ret; | 637 | int ret; |
650 | u32 base_address; | 638 | u32 base_address; |
651 | unsigned long RCBA; | 639 | unsigned long RCBA; |
640 | unsigned long val32; | ||
652 | 641 | ||
653 | /* | 642 | /* |
654 | * Find the ACPI/PM base I/O address which is the base | 643 | * Find the ACPI/PM base I/O address which is the base |
@@ -695,6 +684,10 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
695 | ret = -EIO; | 684 | ret = -EIO; |
696 | goto out; | 685 | goto out; |
697 | } | 686 | } |
687 | /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */ | ||
688 | val32 = inl(SMI_EN); | ||
689 | val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ | ||
690 | outl(val32, SMI_EN); | ||
698 | 691 | ||
699 | /* The TCO I/O registers reside in a 32-byte range pointed to | 692 | /* The TCO I/O registers reside in a 32-byte range pointed to |
700 | by the TCOBASE value */ | 693 | by the TCOBASE value */ |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index e7e83b65c18f..3ccd348d112d 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -45,6 +45,13 @@ static int xen_suspend(void *data) | |||
45 | err); | 45 | err); |
46 | return err; | 46 | return err; |
47 | } | 47 | } |
48 | err = sysdev_suspend(PMSG_SUSPEND); | ||
49 | if (err) { | ||
50 | printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", | ||
51 | err); | ||
52 | device_power_up(PMSG_RESUME); | ||
53 | return err; | ||
54 | } | ||
48 | 55 | ||
49 | xen_mm_pin_all(); | 56 | xen_mm_pin_all(); |
50 | gnttab_suspend(); | 57 | gnttab_suspend(); |
@@ -61,6 +68,7 @@ static int xen_suspend(void *data) | |||
61 | gnttab_resume(); | 68 | gnttab_resume(); |
62 | xen_mm_unpin_all(); | 69 | xen_mm_unpin_all(); |
63 | 70 | ||
71 | sysdev_resume(); | ||
64 | device_power_up(PMSG_RESUME); | 72 | device_power_up(PMSG_RESUME); |
65 | 73 | ||
66 | if (!*cancelled) { | 74 | if (!*cancelled) { |
@@ -302,9 +302,10 @@ void bio_init(struct bio *bio) | |||
302 | struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) | 302 | struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) |
303 | { | 303 | { |
304 | struct bio *bio = NULL; | 304 | struct bio *bio = NULL; |
305 | void *p; | ||
305 | 306 | ||
306 | if (bs) { | 307 | if (bs) { |
307 | void *p = mempool_alloc(bs->bio_pool, gfp_mask); | 308 | p = mempool_alloc(bs->bio_pool, gfp_mask); |
308 | 309 | ||
309 | if (p) | 310 | if (p) |
310 | bio = p + bs->front_pad; | 311 | bio = p + bs->front_pad; |
@@ -329,7 +330,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) | |||
329 | } | 330 | } |
330 | if (unlikely(!bvl)) { | 331 | if (unlikely(!bvl)) { |
331 | if (bs) | 332 | if (bs) |
332 | mempool_free(bio, bs->bio_pool); | 333 | mempool_free(p, bs->bio_pool); |
333 | else | 334 | else |
334 | kfree(bio); | 335 | kfree(bio); |
335 | bio = NULL; | 336 | bio = NULL; |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 35443cc4b9a9..42491d728e99 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -38,19 +38,12 @@ static int balance_node_right(struct btrfs_trans_handle *trans, | |||
38 | static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 38 | static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
39 | struct btrfs_path *path, int level, int slot); | 39 | struct btrfs_path *path, int level, int slot); |
40 | 40 | ||
41 | inline void btrfs_init_path(struct btrfs_path *p) | ||
42 | { | ||
43 | memset(p, 0, sizeof(*p)); | ||
44 | } | ||
45 | |||
46 | struct btrfs_path *btrfs_alloc_path(void) | 41 | struct btrfs_path *btrfs_alloc_path(void) |
47 | { | 42 | { |
48 | struct btrfs_path *path; | 43 | struct btrfs_path *path; |
49 | path = kmem_cache_alloc(btrfs_path_cachep, GFP_NOFS); | 44 | path = kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS); |
50 | if (path) { | 45 | if (path) |
51 | btrfs_init_path(path); | ||
52 | path->reada = 1; | 46 | path->reada = 1; |
53 | } | ||
54 | return path; | 47 | return path; |
55 | } | 48 | } |
56 | 49 | ||
@@ -69,14 +62,38 @@ noinline void btrfs_set_path_blocking(struct btrfs_path *p) | |||
69 | 62 | ||
70 | /* | 63 | /* |
71 | * reset all the locked nodes in the patch to spinning locks. | 64 | * reset all the locked nodes in the patch to spinning locks. |
65 | * | ||
66 | * held is used to keep lockdep happy, when lockdep is enabled | ||
67 | * we set held to a blocking lock before we go around and | ||
68 | * retake all the spinlocks in the path. You can safely use NULL | ||
69 | * for held | ||
72 | */ | 70 | */ |
73 | noinline void btrfs_clear_path_blocking(struct btrfs_path *p) | 71 | noinline void btrfs_clear_path_blocking(struct btrfs_path *p, |
72 | struct extent_buffer *held) | ||
74 | { | 73 | { |
75 | int i; | 74 | int i; |
76 | for (i = 0; i < BTRFS_MAX_LEVEL; i++) { | 75 | |
76 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
77 | /* lockdep really cares that we take all of these spinlocks | ||
78 | * in the right order. If any of the locks in the path are not | ||
79 | * currently blocking, it is going to complain. So, make really | ||
80 | * really sure by forcing the path to blocking before we clear | ||
81 | * the path blocking. | ||
82 | */ | ||
83 | if (held) | ||
84 | btrfs_set_lock_blocking(held); | ||
85 | btrfs_set_path_blocking(p); | ||
86 | #endif | ||
87 | |||
88 | for (i = BTRFS_MAX_LEVEL - 1; i >= 0; i--) { | ||
77 | if (p->nodes[i] && p->locks[i]) | 89 | if (p->nodes[i] && p->locks[i]) |
78 | btrfs_clear_lock_blocking(p->nodes[i]); | 90 | btrfs_clear_lock_blocking(p->nodes[i]); |
79 | } | 91 | } |
92 | |||
93 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
94 | if (held) | ||
95 | btrfs_clear_lock_blocking(held); | ||
96 | #endif | ||
80 | } | 97 | } |
81 | 98 | ||
82 | /* this also releases the path */ | 99 | /* this also releases the path */ |
@@ -286,7 +303,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, | |||
286 | trans->transid, level, &ins); | 303 | trans->transid, level, &ins); |
287 | BUG_ON(ret); | 304 | BUG_ON(ret); |
288 | cow = btrfs_init_new_buffer(trans, root, prealloc_dest, | 305 | cow = btrfs_init_new_buffer(trans, root, prealloc_dest, |
289 | buf->len); | 306 | buf->len, level); |
290 | } else { | 307 | } else { |
291 | cow = btrfs_alloc_free_block(trans, root, buf->len, | 308 | cow = btrfs_alloc_free_block(trans, root, buf->len, |
292 | parent_start, | 309 | parent_start, |
@@ -917,9 +934,9 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
917 | 934 | ||
918 | /* promote the child to a root */ | 935 | /* promote the child to a root */ |
919 | child = read_node_slot(root, mid, 0); | 936 | child = read_node_slot(root, mid, 0); |
937 | BUG_ON(!child); | ||
920 | btrfs_tree_lock(child); | 938 | btrfs_tree_lock(child); |
921 | btrfs_set_lock_blocking(child); | 939 | btrfs_set_lock_blocking(child); |
922 | BUG_ON(!child); | ||
923 | ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0); | 940 | ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0); |
924 | BUG_ON(ret); | 941 | BUG_ON(ret); |
925 | 942 | ||
@@ -1566,7 +1583,7 @@ cow_done: | |||
1566 | if (!p->skip_locking) | 1583 | if (!p->skip_locking) |
1567 | p->locks[level] = 1; | 1584 | p->locks[level] = 1; |
1568 | 1585 | ||
1569 | btrfs_clear_path_blocking(p); | 1586 | btrfs_clear_path_blocking(p, NULL); |
1570 | 1587 | ||
1571 | /* | 1588 | /* |
1572 | * we have a lock on b and as long as we aren't changing | 1589 | * we have a lock on b and as long as we aren't changing |
@@ -1605,7 +1622,7 @@ cow_done: | |||
1605 | 1622 | ||
1606 | btrfs_set_path_blocking(p); | 1623 | btrfs_set_path_blocking(p); |
1607 | sret = split_node(trans, root, p, level); | 1624 | sret = split_node(trans, root, p, level); |
1608 | btrfs_clear_path_blocking(p); | 1625 | btrfs_clear_path_blocking(p, NULL); |
1609 | 1626 | ||
1610 | BUG_ON(sret > 0); | 1627 | BUG_ON(sret > 0); |
1611 | if (sret) { | 1628 | if (sret) { |
@@ -1625,7 +1642,7 @@ cow_done: | |||
1625 | 1642 | ||
1626 | btrfs_set_path_blocking(p); | 1643 | btrfs_set_path_blocking(p); |
1627 | sret = balance_level(trans, root, p, level); | 1644 | sret = balance_level(trans, root, p, level); |
1628 | btrfs_clear_path_blocking(p); | 1645 | btrfs_clear_path_blocking(p, NULL); |
1629 | 1646 | ||
1630 | if (sret) { | 1647 | if (sret) { |
1631 | ret = sret; | 1648 | ret = sret; |
@@ -1688,13 +1705,13 @@ cow_done: | |||
1688 | if (!p->skip_locking) { | 1705 | if (!p->skip_locking) { |
1689 | int lret; | 1706 | int lret; |
1690 | 1707 | ||
1691 | btrfs_clear_path_blocking(p); | 1708 | btrfs_clear_path_blocking(p, NULL); |
1692 | lret = btrfs_try_spin_lock(b); | 1709 | lret = btrfs_try_spin_lock(b); |
1693 | 1710 | ||
1694 | if (!lret) { | 1711 | if (!lret) { |
1695 | btrfs_set_path_blocking(p); | 1712 | btrfs_set_path_blocking(p); |
1696 | btrfs_tree_lock(b); | 1713 | btrfs_tree_lock(b); |
1697 | btrfs_clear_path_blocking(p); | 1714 | btrfs_clear_path_blocking(p, b); |
1698 | } | 1715 | } |
1699 | } | 1716 | } |
1700 | } else { | 1717 | } else { |
@@ -1706,7 +1723,7 @@ cow_done: | |||
1706 | btrfs_set_path_blocking(p); | 1723 | btrfs_set_path_blocking(p); |
1707 | sret = split_leaf(trans, root, key, | 1724 | sret = split_leaf(trans, root, key, |
1708 | p, ins_len, ret == 0); | 1725 | p, ins_len, ret == 0); |
1709 | btrfs_clear_path_blocking(p); | 1726 | btrfs_clear_path_blocking(p, NULL); |
1710 | 1727 | ||
1711 | BUG_ON(sret > 0); | 1728 | BUG_ON(sret > 0); |
1712 | if (sret) { | 1729 | if (sret) { |
@@ -3926,7 +3943,6 @@ find_next_key: | |||
3926 | btrfs_release_path(root, path); | 3943 | btrfs_release_path(root, path); |
3927 | goto again; | 3944 | goto again; |
3928 | } else { | 3945 | } else { |
3929 | btrfs_clear_path_blocking(path); | ||
3930 | goto out; | 3946 | goto out; |
3931 | } | 3947 | } |
3932 | } | 3948 | } |
@@ -3946,7 +3962,7 @@ find_next_key: | |||
3946 | path->locks[level - 1] = 1; | 3962 | path->locks[level - 1] = 1; |
3947 | path->nodes[level - 1] = cur; | 3963 | path->nodes[level - 1] = cur; |
3948 | unlock_up(path, level, 1); | 3964 | unlock_up(path, level, 1); |
3949 | btrfs_clear_path_blocking(path); | 3965 | btrfs_clear_path_blocking(path, NULL); |
3950 | } | 3966 | } |
3951 | out: | 3967 | out: |
3952 | if (ret == 0) | 3968 | if (ret == 0) |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 531db112c8bd..766b31ae3186 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -43,11 +43,7 @@ struct btrfs_ordered_sum; | |||
43 | 43 | ||
44 | #define BTRFS_ACL_NOT_CACHED ((void *)-1) | 44 | #define BTRFS_ACL_NOT_CACHED ((void *)-1) |
45 | 45 | ||
46 | #ifdef CONFIG_LOCKDEP | 46 | #define BTRFS_MAX_LEVEL 8 |
47 | # define BTRFS_MAX_LEVEL 7 | ||
48 | #else | ||
49 | # define BTRFS_MAX_LEVEL 8 | ||
50 | #endif | ||
51 | 47 | ||
52 | /* holds pointers to all of the tree roots */ | 48 | /* holds pointers to all of the tree roots */ |
53 | #define BTRFS_ROOT_TREE_OBJECTID 1ULL | 49 | #define BTRFS_ROOT_TREE_OBJECTID 1ULL |
@@ -1715,7 +1711,8 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | |||
1715 | u64 empty_size); | 1711 | u64 empty_size); |
1716 | struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, | 1712 | struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, |
1717 | struct btrfs_root *root, | 1713 | struct btrfs_root *root, |
1718 | u64 bytenr, u32 blocksize); | 1714 | u64 bytenr, u32 blocksize, |
1715 | int level); | ||
1719 | int btrfs_alloc_extent(struct btrfs_trans_handle *trans, | 1716 | int btrfs_alloc_extent(struct btrfs_trans_handle *trans, |
1720 | struct btrfs_root *root, | 1717 | struct btrfs_root *root, |
1721 | u64 num_bytes, u64 parent, u64 min_bytes, | 1718 | u64 num_bytes, u64 parent, u64 min_bytes, |
@@ -1834,9 +1831,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, | |||
1834 | void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p); | 1831 | void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p); |
1835 | struct btrfs_path *btrfs_alloc_path(void); | 1832 | struct btrfs_path *btrfs_alloc_path(void); |
1836 | void btrfs_free_path(struct btrfs_path *p); | 1833 | void btrfs_free_path(struct btrfs_path *p); |
1837 | void btrfs_init_path(struct btrfs_path *p); | ||
1838 | void btrfs_set_path_blocking(struct btrfs_path *p); | 1834 | void btrfs_set_path_blocking(struct btrfs_path *p); |
1839 | void btrfs_clear_path_blocking(struct btrfs_path *p); | ||
1840 | void btrfs_unlock_up_safe(struct btrfs_path *p, int level); | 1835 | void btrfs_unlock_up_safe(struct btrfs_path *p, int level); |
1841 | 1836 | ||
1842 | int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 1837 | int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 5aebddd71193..adda739a0215 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -75,6 +75,40 @@ struct async_submit_bio { | |||
75 | struct btrfs_work work; | 75 | struct btrfs_work work; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | /* These are used to set the lockdep class on the extent buffer locks. | ||
79 | * The class is set by the readpage_end_io_hook after the buffer has | ||
80 | * passed csum validation but before the pages are unlocked. | ||
81 | * | ||
82 | * The lockdep class is also set by btrfs_init_new_buffer on freshly | ||
83 | * allocated blocks. | ||
84 | * | ||
85 | * The class is based on the level in the tree block, which allows lockdep | ||
86 | * to know that lower nodes nest inside the locks of higher nodes. | ||
87 | * | ||
88 | * We also add a check to make sure the highest level of the tree is | ||
89 | * the same as our lockdep setup here. If BTRFS_MAX_LEVEL changes, this | ||
90 | * code needs update as well. | ||
91 | */ | ||
92 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
93 | # if BTRFS_MAX_LEVEL != 8 | ||
94 | # error | ||
95 | # endif | ||
96 | static struct lock_class_key btrfs_eb_class[BTRFS_MAX_LEVEL + 1]; | ||
97 | static const char *btrfs_eb_name[BTRFS_MAX_LEVEL + 1] = { | ||
98 | /* leaf */ | ||
99 | "btrfs-extent-00", | ||
100 | "btrfs-extent-01", | ||
101 | "btrfs-extent-02", | ||
102 | "btrfs-extent-03", | ||
103 | "btrfs-extent-04", | ||
104 | "btrfs-extent-05", | ||
105 | "btrfs-extent-06", | ||
106 | "btrfs-extent-07", | ||
107 | /* highest possible level */ | ||
108 | "btrfs-extent-08", | ||
109 | }; | ||
110 | #endif | ||
111 | |||
78 | /* | 112 | /* |
79 | * extents on the btree inode are pretty simple, there's one extent | 113 | * extents on the btree inode are pretty simple, there's one extent |
80 | * that covers the entire device | 114 | * that covers the entire device |
@@ -347,6 +381,15 @@ static int check_tree_block_fsid(struct btrfs_root *root, | |||
347 | return ret; | 381 | return ret; |
348 | } | 382 | } |
349 | 383 | ||
384 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
385 | void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, int level) | ||
386 | { | ||
387 | lockdep_set_class_and_name(&eb->lock, | ||
388 | &btrfs_eb_class[level], | ||
389 | btrfs_eb_name[level]); | ||
390 | } | ||
391 | #endif | ||
392 | |||
350 | static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, | 393 | static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, |
351 | struct extent_state *state) | 394 | struct extent_state *state) |
352 | { | 395 | { |
@@ -392,6 +435,8 @@ static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, | |||
392 | } | 435 | } |
393 | found_level = btrfs_header_level(eb); | 436 | found_level = btrfs_header_level(eb); |
394 | 437 | ||
438 | btrfs_set_buffer_lockdep_class(eb, found_level); | ||
439 | |||
395 | ret = csum_tree_block(root, eb, 1); | 440 | ret = csum_tree_block(root, eb, 1); |
396 | if (ret) | 441 | if (ret) |
397 | ret = -EIO; | 442 | ret = -EIO; |
@@ -1777,7 +1822,6 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1777 | ret = find_and_setup_root(tree_root, fs_info, | 1822 | ret = find_and_setup_root(tree_root, fs_info, |
1778 | BTRFS_DEV_TREE_OBJECTID, dev_root); | 1823 | BTRFS_DEV_TREE_OBJECTID, dev_root); |
1779 | dev_root->track_dirty = 1; | 1824 | dev_root->track_dirty = 1; |
1780 | |||
1781 | if (ret) | 1825 | if (ret) |
1782 | goto fail_extent_root; | 1826 | goto fail_extent_root; |
1783 | 1827 | ||
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index 494a56eb2986..95029db227be 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h | |||
@@ -101,4 +101,14 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans, | |||
101 | int btrfs_add_log_tree(struct btrfs_trans_handle *trans, | 101 | int btrfs_add_log_tree(struct btrfs_trans_handle *trans, |
102 | struct btrfs_root *root); | 102 | struct btrfs_root *root); |
103 | int btree_lock_page_hook(struct page *page); | 103 | int btree_lock_page_hook(struct page *page); |
104 | |||
105 | |||
106 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
107 | void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, int level); | ||
108 | #else | ||
109 | static inline void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, | ||
110 | int level) | ||
111 | { | ||
112 | } | ||
113 | #endif | ||
104 | #endif | 114 | #endif |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 7527523c2d2d..0a5d796c9f7e 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -1323,8 +1323,25 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, | |||
1323 | int btrfs_extent_post_op(struct btrfs_trans_handle *trans, | 1323 | int btrfs_extent_post_op(struct btrfs_trans_handle *trans, |
1324 | struct btrfs_root *root) | 1324 | struct btrfs_root *root) |
1325 | { | 1325 | { |
1326 | finish_current_insert(trans, root->fs_info->extent_root, 1); | 1326 | u64 start; |
1327 | del_pending_extents(trans, root->fs_info->extent_root, 1); | 1327 | u64 end; |
1328 | int ret; | ||
1329 | |||
1330 | while(1) { | ||
1331 | finish_current_insert(trans, root->fs_info->extent_root, 1); | ||
1332 | del_pending_extents(trans, root->fs_info->extent_root, 1); | ||
1333 | |||
1334 | /* is there more work to do? */ | ||
1335 | ret = find_first_extent_bit(&root->fs_info->pending_del, | ||
1336 | 0, &start, &end, EXTENT_WRITEBACK); | ||
1337 | if (!ret) | ||
1338 | continue; | ||
1339 | ret = find_first_extent_bit(&root->fs_info->extent_ins, | ||
1340 | 0, &start, &end, EXTENT_WRITEBACK); | ||
1341 | if (!ret) | ||
1342 | continue; | ||
1343 | break; | ||
1344 | } | ||
1328 | return 0; | 1345 | return 0; |
1329 | } | 1346 | } |
1330 | 1347 | ||
@@ -2211,13 +2228,12 @@ static int finish_current_insert(struct btrfs_trans_handle *trans, | |||
2211 | u64 end; | 2228 | u64 end; |
2212 | u64 priv; | 2229 | u64 priv; |
2213 | u64 search = 0; | 2230 | u64 search = 0; |
2214 | u64 skipped = 0; | ||
2215 | struct btrfs_fs_info *info = extent_root->fs_info; | 2231 | struct btrfs_fs_info *info = extent_root->fs_info; |
2216 | struct btrfs_path *path; | 2232 | struct btrfs_path *path; |
2217 | struct pending_extent_op *extent_op, *tmp; | 2233 | struct pending_extent_op *extent_op, *tmp; |
2218 | struct list_head insert_list, update_list; | 2234 | struct list_head insert_list, update_list; |
2219 | int ret; | 2235 | int ret; |
2220 | int num_inserts = 0, max_inserts; | 2236 | int num_inserts = 0, max_inserts, restart = 0; |
2221 | 2237 | ||
2222 | path = btrfs_alloc_path(); | 2238 | path = btrfs_alloc_path(); |
2223 | INIT_LIST_HEAD(&insert_list); | 2239 | INIT_LIST_HEAD(&insert_list); |
@@ -2233,19 +2249,19 @@ again: | |||
2233 | ret = find_first_extent_bit(&info->extent_ins, search, &start, | 2249 | ret = find_first_extent_bit(&info->extent_ins, search, &start, |
2234 | &end, EXTENT_WRITEBACK); | 2250 | &end, EXTENT_WRITEBACK); |
2235 | if (ret) { | 2251 | if (ret) { |
2236 | if (skipped && all && !num_inserts && | 2252 | if (restart && !num_inserts && |
2237 | list_empty(&update_list)) { | 2253 | list_empty(&update_list)) { |
2238 | skipped = 0; | 2254 | restart = 0; |
2239 | search = 0; | 2255 | search = 0; |
2240 | continue; | 2256 | continue; |
2241 | } | 2257 | } |
2242 | mutex_unlock(&info->extent_ins_mutex); | ||
2243 | break; | 2258 | break; |
2244 | } | 2259 | } |
2245 | 2260 | ||
2246 | ret = try_lock_extent(&info->extent_ins, start, end, GFP_NOFS); | 2261 | ret = try_lock_extent(&info->extent_ins, start, end, GFP_NOFS); |
2247 | if (!ret) { | 2262 | if (!ret) { |
2248 | skipped = 1; | 2263 | if (all) |
2264 | restart = 1; | ||
2249 | search = end + 1; | 2265 | search = end + 1; |
2250 | if (need_resched()) { | 2266 | if (need_resched()) { |
2251 | mutex_unlock(&info->extent_ins_mutex); | 2267 | mutex_unlock(&info->extent_ins_mutex); |
@@ -2264,7 +2280,7 @@ again: | |||
2264 | list_add_tail(&extent_op->list, &insert_list); | 2280 | list_add_tail(&extent_op->list, &insert_list); |
2265 | search = end + 1; | 2281 | search = end + 1; |
2266 | if (num_inserts == max_inserts) { | 2282 | if (num_inserts == max_inserts) { |
2267 | mutex_unlock(&info->extent_ins_mutex); | 2283 | restart = 1; |
2268 | break; | 2284 | break; |
2269 | } | 2285 | } |
2270 | } else if (extent_op->type == PENDING_BACKREF_UPDATE) { | 2286 | } else if (extent_op->type == PENDING_BACKREF_UPDATE) { |
@@ -2280,7 +2296,6 @@ again: | |||
2280 | * somebody marked this thing for deletion then just unlock it and be | 2296 | * somebody marked this thing for deletion then just unlock it and be |
2281 | * done, the free_extents will handle it | 2297 | * done, the free_extents will handle it |
2282 | */ | 2298 | */ |
2283 | mutex_lock(&info->extent_ins_mutex); | ||
2284 | list_for_each_entry_safe(extent_op, tmp, &update_list, list) { | 2299 | list_for_each_entry_safe(extent_op, tmp, &update_list, list) { |
2285 | clear_extent_bits(&info->extent_ins, extent_op->bytenr, | 2300 | clear_extent_bits(&info->extent_ins, extent_op->bytenr, |
2286 | extent_op->bytenr + extent_op->num_bytes - 1, | 2301 | extent_op->bytenr + extent_op->num_bytes - 1, |
@@ -2302,6 +2317,10 @@ again: | |||
2302 | if (!list_empty(&update_list)) { | 2317 | if (!list_empty(&update_list)) { |
2303 | ret = update_backrefs(trans, extent_root, path, &update_list); | 2318 | ret = update_backrefs(trans, extent_root, path, &update_list); |
2304 | BUG_ON(ret); | 2319 | BUG_ON(ret); |
2320 | |||
2321 | /* we may have COW'ed new blocks, so lets start over */ | ||
2322 | if (all) | ||
2323 | restart = 1; | ||
2305 | } | 2324 | } |
2306 | 2325 | ||
2307 | /* | 2326 | /* |
@@ -2309,9 +2328,9 @@ again: | |||
2309 | * need to make sure everything is cleaned then reset everything and | 2328 | * need to make sure everything is cleaned then reset everything and |
2310 | * go back to the beginning | 2329 | * go back to the beginning |
2311 | */ | 2330 | */ |
2312 | if (!num_inserts && all && skipped) { | 2331 | if (!num_inserts && restart) { |
2313 | search = 0; | 2332 | search = 0; |
2314 | skipped = 0; | 2333 | restart = 0; |
2315 | INIT_LIST_HEAD(&update_list); | 2334 | INIT_LIST_HEAD(&update_list); |
2316 | INIT_LIST_HEAD(&insert_list); | 2335 | INIT_LIST_HEAD(&insert_list); |
2317 | goto again; | 2336 | goto again; |
@@ -2368,27 +2387,19 @@ again: | |||
2368 | BUG_ON(ret); | 2387 | BUG_ON(ret); |
2369 | 2388 | ||
2370 | /* | 2389 | /* |
2371 | * if we broke out of the loop in order to insert stuff because we hit | 2390 | * if restart is set for whatever reason we need to go back and start |
2372 | * the maximum number of inserts at a time we can handle, then loop | 2391 | * searching through the pending list again. |
2373 | * back and pick up where we left off | 2392 | * |
2393 | * We just inserted some extents, which could have resulted in new | ||
2394 | * blocks being allocated, which would result in new blocks needing | ||
2395 | * updates, so if all is set we _must_ restart to get the updated | ||
2396 | * blocks. | ||
2374 | */ | 2397 | */ |
2375 | if (num_inserts == max_inserts) { | 2398 | if (restart || all) { |
2376 | INIT_LIST_HEAD(&insert_list); | ||
2377 | INIT_LIST_HEAD(&update_list); | ||
2378 | num_inserts = 0; | ||
2379 | goto again; | ||
2380 | } | ||
2381 | |||
2382 | /* | ||
2383 | * again, if we need to make absolutely sure there are no more pending | ||
2384 | * extent operations left and we know that we skipped some, go back to | ||
2385 | * the beginning and do it all again | ||
2386 | */ | ||
2387 | if (all && skipped) { | ||
2388 | INIT_LIST_HEAD(&insert_list); | 2399 | INIT_LIST_HEAD(&insert_list); |
2389 | INIT_LIST_HEAD(&update_list); | 2400 | INIT_LIST_HEAD(&update_list); |
2390 | search = 0; | 2401 | search = 0; |
2391 | skipped = 0; | 2402 | restart = 0; |
2392 | num_inserts = 0; | 2403 | num_inserts = 0; |
2393 | goto again; | 2404 | goto again; |
2394 | } | 2405 | } |
@@ -2709,6 +2720,8 @@ again: | |||
2709 | goto again; | 2720 | goto again; |
2710 | } | 2721 | } |
2711 | 2722 | ||
2723 | if (!err) | ||
2724 | finish_current_insert(trans, extent_root, 0); | ||
2712 | return err; | 2725 | return err; |
2713 | } | 2726 | } |
2714 | 2727 | ||
@@ -2859,7 +2872,8 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, | |||
2859 | 2872 | ||
2860 | if (data & BTRFS_BLOCK_GROUP_METADATA) { | 2873 | if (data & BTRFS_BLOCK_GROUP_METADATA) { |
2861 | last_ptr = &root->fs_info->last_alloc; | 2874 | last_ptr = &root->fs_info->last_alloc; |
2862 | empty_cluster = 64 * 1024; | 2875 | if (!btrfs_test_opt(root, SSD)) |
2876 | empty_cluster = 64 * 1024; | ||
2863 | } | 2877 | } |
2864 | 2878 | ||
2865 | if ((data & BTRFS_BLOCK_GROUP_DATA) && btrfs_test_opt(root, SSD)) | 2879 | if ((data & BTRFS_BLOCK_GROUP_DATA) && btrfs_test_opt(root, SSD)) |
@@ -3402,7 +3416,8 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans, | |||
3402 | 3416 | ||
3403 | struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, | 3417 | struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, |
3404 | struct btrfs_root *root, | 3418 | struct btrfs_root *root, |
3405 | u64 bytenr, u32 blocksize) | 3419 | u64 bytenr, u32 blocksize, |
3420 | int level) | ||
3406 | { | 3421 | { |
3407 | struct extent_buffer *buf; | 3422 | struct extent_buffer *buf; |
3408 | 3423 | ||
@@ -3410,6 +3425,7 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, | |||
3410 | if (!buf) | 3425 | if (!buf) |
3411 | return ERR_PTR(-ENOMEM); | 3426 | return ERR_PTR(-ENOMEM); |
3412 | btrfs_set_header_generation(buf, trans->transid); | 3427 | btrfs_set_header_generation(buf, trans->transid); |
3428 | btrfs_set_buffer_lockdep_class(buf, level); | ||
3413 | btrfs_tree_lock(buf); | 3429 | btrfs_tree_lock(buf); |
3414 | clean_tree_block(trans, root, buf); | 3430 | clean_tree_block(trans, root, buf); |
3415 | 3431 | ||
@@ -3453,7 +3469,8 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | |||
3453 | return ERR_PTR(ret); | 3469 | return ERR_PTR(ret); |
3454 | } | 3470 | } |
3455 | 3471 | ||
3456 | buf = btrfs_init_new_buffer(trans, root, ins.objectid, blocksize); | 3472 | buf = btrfs_init_new_buffer(trans, root, ins.objectid, |
3473 | blocksize, level); | ||
3457 | return buf; | 3474 | return buf; |
3458 | } | 3475 | } |
3459 | 3476 | ||
@@ -5641,7 +5658,9 @@ static noinline int relocate_one_extent(struct btrfs_root *extent_root, | |||
5641 | prev_block = block_start; | 5658 | prev_block = block_start; |
5642 | } | 5659 | } |
5643 | 5660 | ||
5661 | mutex_lock(&extent_root->fs_info->trans_mutex); | ||
5644 | btrfs_record_root_in_trans(found_root); | 5662 | btrfs_record_root_in_trans(found_root); |
5663 | mutex_unlock(&extent_root->fs_info->trans_mutex); | ||
5645 | if (ref_path->owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) { | 5664 | if (ref_path->owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) { |
5646 | /* | 5665 | /* |
5647 | * try to update data extent references while | 5666 | * try to update data extent references while |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 37d43b516b79..ebe6b29e6069 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -415,8 +415,6 @@ static int split_state(struct extent_io_tree *tree, struct extent_state *orig, | |||
415 | 415 | ||
416 | node = tree_insert(&tree->state, prealloc->end, &prealloc->rb_node); | 416 | node = tree_insert(&tree->state, prealloc->end, &prealloc->rb_node); |
417 | if (node) { | 417 | if (node) { |
418 | struct extent_state *found; | ||
419 | found = rb_entry(node, struct extent_state, rb_node); | ||
420 | free_extent_state(prealloc); | 418 | free_extent_state(prealloc); |
421 | return -EEXIST; | 419 | return -EEXIST; |
422 | } | 420 | } |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 3e8023efaff7..872f104576e5 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1222,7 +1222,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
1222 | /* | 1222 | /* |
1223 | * ok we haven't committed the transaction yet, lets do a commit | 1223 | * ok we haven't committed the transaction yet, lets do a commit |
1224 | */ | 1224 | */ |
1225 | if (file->private_data) | 1225 | if (file && file->private_data) |
1226 | btrfs_ioctl_trans_end(file); | 1226 | btrfs_ioctl_trans_end(file); |
1227 | 1227 | ||
1228 | trans = btrfs_start_transaction(root, 1); | 1228 | trans = btrfs_start_transaction(root, 1); |
@@ -1231,7 +1231,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
1231 | goto out; | 1231 | goto out; |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | ret = btrfs_log_dentry_safe(trans, root, file->f_dentry); | 1234 | ret = btrfs_log_dentry_safe(trans, root, dentry); |
1235 | if (ret < 0) | 1235 | if (ret < 0) |
1236 | goto out; | 1236 | goto out; |
1237 | 1237 | ||
@@ -1245,7 +1245,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
1245 | * file again, but that will end up using the synchronization | 1245 | * file again, but that will end up using the synchronization |
1246 | * inside btrfs_sync_log to keep things safe. | 1246 | * inside btrfs_sync_log to keep things safe. |
1247 | */ | 1247 | */ |
1248 | mutex_unlock(&file->f_dentry->d_inode->i_mutex); | 1248 | mutex_unlock(&dentry->d_inode->i_mutex); |
1249 | 1249 | ||
1250 | if (ret > 0) { | 1250 | if (ret > 0) { |
1251 | ret = btrfs_commit_transaction(trans, root); | 1251 | ret = btrfs_commit_transaction(trans, root); |
@@ -1253,7 +1253,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
1253 | btrfs_sync_log(trans, root); | 1253 | btrfs_sync_log(trans, root); |
1254 | ret = btrfs_end_transaction(trans, root); | 1254 | ret = btrfs_end_transaction(trans, root); |
1255 | } | 1255 | } |
1256 | mutex_lock(&file->f_dentry->d_inode->i_mutex); | 1256 | mutex_lock(&dentry->d_inode->i_mutex); |
1257 | out: | 1257 | out: |
1258 | return ret > 0 ? EIO : ret; | 1258 | return ret > 0 ? EIO : ret; |
1259 | } | 1259 | } |
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index 2aa79873eb46..cc7334d833c9 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c | |||
@@ -84,7 +84,6 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans, | |||
84 | search_key.type = 0; | 84 | search_key.type = 0; |
85 | search_key.offset = 0; | 85 | search_key.offset = 0; |
86 | 86 | ||
87 | btrfs_init_path(path); | ||
88 | start_found = 0; | 87 | start_found = 0; |
89 | ret = btrfs_search_slot(trans, root, &search_key, path, 0, 0); | 88 | ret = btrfs_search_slot(trans, root, &search_key, path, 0, 0); |
90 | if (ret < 0) | 89 | if (ret < 0) |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8f0706210a47..3cee77ae03c8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -2531,8 +2531,6 @@ noinline int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, | |||
2531 | key.offset = (u64)-1; | 2531 | key.offset = (u64)-1; |
2532 | key.type = (u8)-1; | 2532 | key.type = (u8)-1; |
2533 | 2533 | ||
2534 | btrfs_init_path(path); | ||
2535 | |||
2536 | search_again: | 2534 | search_again: |
2537 | ret = btrfs_search_slot(trans, root, &key, path, -1, 1); | 2535 | ret = btrfs_search_slot(trans, root, &key, path, -1, 1); |
2538 | if (ret < 0) | 2536 | if (ret < 0) |
@@ -4263,7 +4261,7 @@ static int btrfs_releasepage(struct page *page, gfp_t gfp_flags) | |||
4263 | { | 4261 | { |
4264 | if (PageWriteback(page) || PageDirty(page)) | 4262 | if (PageWriteback(page) || PageDirty(page)) |
4265 | return 0; | 4263 | return 0; |
4266 | return __btrfs_releasepage(page, gfp_flags); | 4264 | return __btrfs_releasepage(page, gfp_flags & GFP_NOFS); |
4267 | } | 4265 | } |
4268 | 4266 | ||
4269 | static void btrfs_invalidatepage(struct page *page, unsigned long offset) | 4267 | static void btrfs_invalidatepage(struct page *page, unsigned long offset) |
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index 9ebe9385129b..85506c4a3af7 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c | |||
@@ -25,21 +25,10 @@ | |||
25 | #include "extent_io.h" | 25 | #include "extent_io.h" |
26 | #include "locking.h" | 26 | #include "locking.h" |
27 | 27 | ||
28 | /* | ||
29 | * btrfs_header_level() isn't free, so don't call it when lockdep isn't | ||
30 | * on | ||
31 | */ | ||
32 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
33 | static inline void spin_nested(struct extent_buffer *eb) | ||
34 | { | ||
35 | spin_lock_nested(&eb->lock, BTRFS_MAX_LEVEL - btrfs_header_level(eb)); | ||
36 | } | ||
37 | #else | ||
38 | static inline void spin_nested(struct extent_buffer *eb) | 28 | static inline void spin_nested(struct extent_buffer *eb) |
39 | { | 29 | { |
40 | spin_lock(&eb->lock); | 30 | spin_lock(&eb->lock); |
41 | } | 31 | } |
42 | #endif | ||
43 | 32 | ||
44 | /* | 33 | /* |
45 | * Setting a lock to blocking will drop the spinlock and set the | 34 | * Setting a lock to blocking will drop the spinlock and set the |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index f3fd7e2cbc38..19a4daf03ccb 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -379,7 +379,6 @@ int btrfs_sync_fs(struct super_block *sb, int wait) | |||
379 | btrfs_start_delalloc_inodes(root); | 379 | btrfs_start_delalloc_inodes(root); |
380 | btrfs_wait_ordered_extents(root, 0); | 380 | btrfs_wait_ordered_extents(root, 0); |
381 | 381 | ||
382 | btrfs_clean_old_snapshots(root); | ||
383 | trans = btrfs_start_transaction(root, 1); | 382 | trans = btrfs_start_transaction(root, 1); |
384 | ret = btrfs_commit_transaction(trans, root); | 383 | ret = btrfs_commit_transaction(trans, root); |
385 | sb->s_dirt = 0; | 384 | sb->s_dirt = 0; |
@@ -511,6 +510,10 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
511 | struct btrfs_root *root = btrfs_sb(sb); | 510 | struct btrfs_root *root = btrfs_sb(sb); |
512 | int ret; | 511 | int ret; |
513 | 512 | ||
513 | ret = btrfs_parse_options(root, data); | ||
514 | if (ret) | ||
515 | return -EINVAL; | ||
516 | |||
514 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) | 517 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) |
515 | return 0; | 518 | return 0; |
516 | 519 | ||
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 919172de5c9a..4112d53d4f4d 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -688,7 +688,9 @@ static noinline int drop_dirty_roots(struct btrfs_root *tree_root, | |||
688 | num_bytes -= btrfs_root_used(&dirty->root->root_item); | 688 | num_bytes -= btrfs_root_used(&dirty->root->root_item); |
689 | bytes_used = btrfs_root_used(&root->root_item); | 689 | bytes_used = btrfs_root_used(&root->root_item); |
690 | if (num_bytes) { | 690 | if (num_bytes) { |
691 | mutex_lock(&root->fs_info->trans_mutex); | ||
691 | btrfs_record_root_in_trans(root); | 692 | btrfs_record_root_in_trans(root); |
693 | mutex_unlock(&root->fs_info->trans_mutex); | ||
692 | btrfs_set_root_used(&root->root_item, | 694 | btrfs_set_root_used(&root->root_item, |
693 | bytes_used - num_bytes); | 695 | bytes_used - num_bytes); |
694 | } | 696 | } |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 20794290256b..9c462fbd60fa 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -2832,7 +2832,9 @@ again: | |||
2832 | BUG_ON(!wc.replay_dest); | 2832 | BUG_ON(!wc.replay_dest); |
2833 | 2833 | ||
2834 | wc.replay_dest->log_root = log; | 2834 | wc.replay_dest->log_root = log; |
2835 | mutex_lock(&fs_info->trans_mutex); | ||
2835 | btrfs_record_root_in_trans(wc.replay_dest); | 2836 | btrfs_record_root_in_trans(wc.replay_dest); |
2837 | mutex_unlock(&fs_info->trans_mutex); | ||
2836 | ret = walk_log_tree(trans, log, &wc); | 2838 | ret = walk_log_tree(trans, log, &wc); |
2837 | BUG_ON(ret); | 2839 | BUG_ON(ret); |
2838 | 2840 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index bcd14ebccae1..1316139bf9e8 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -2894,10 +2894,6 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key, | |||
2894 | free_extent_map(em); | 2894 | free_extent_map(em); |
2895 | } | 2895 | } |
2896 | 2896 | ||
2897 | map = kzalloc(sizeof(*map), GFP_NOFS); | ||
2898 | if (!map) | ||
2899 | return -ENOMEM; | ||
2900 | |||
2901 | em = alloc_extent_map(GFP_NOFS); | 2897 | em = alloc_extent_map(GFP_NOFS); |
2902 | if (!em) | 2898 | if (!em) |
2903 | return -ENOMEM; | 2899 | return -ENOMEM; |
@@ -3106,6 +3102,8 @@ int btrfs_read_sys_array(struct btrfs_root *root) | |||
3106 | if (!sb) | 3102 | if (!sb) |
3107 | return -ENOMEM; | 3103 | return -ENOMEM; |
3108 | btrfs_set_buffer_uptodate(sb); | 3104 | btrfs_set_buffer_uptodate(sb); |
3105 | btrfs_set_buffer_lockdep_class(sb, 0); | ||
3106 | |||
3109 | write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE); | 3107 | write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE); |
3110 | array_size = btrfs_super_sys_array_size(super_copy); | 3108 | array_size = btrfs_super_sys_array_size(super_copy); |
3111 | 3109 | ||
diff --git a/fs/buffer.c b/fs/buffer.c index 665d446b25bc..9f697419ed8e 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -777,6 +777,7 @@ static int __set_page_dirty(struct page *page, | |||
777 | __inc_zone_page_state(page, NR_FILE_DIRTY); | 777 | __inc_zone_page_state(page, NR_FILE_DIRTY); |
778 | __inc_bdi_stat(mapping->backing_dev_info, | 778 | __inc_bdi_stat(mapping->backing_dev_info, |
779 | BDI_RECLAIMABLE); | 779 | BDI_RECLAIMABLE); |
780 | task_dirty_inc(current); | ||
780 | task_io_account_write(PAGE_CACHE_SIZE); | 781 | task_io_account_write(PAGE_CACHE_SIZE); |
781 | } | 782 | } |
782 | radix_tree_tag_set(&mapping->page_tree, | 783 | radix_tree_tag_set(&mapping->page_tree, |
@@ -3108,7 +3109,7 @@ int sync_dirty_buffer(struct buffer_head *bh) | |||
3108 | if (test_clear_buffer_dirty(bh)) { | 3109 | if (test_clear_buffer_dirty(bh)) { |
3109 | get_bh(bh); | 3110 | get_bh(bh); |
3110 | bh->b_end_io = end_buffer_write_sync; | 3111 | bh->b_end_io = end_buffer_write_sync; |
3111 | ret = submit_bh(WRITE_SYNC, bh); | 3112 | ret = submit_bh(WRITE, bh); |
3112 | wait_on_buffer(bh); | 3113 | wait_on_buffer(bh); |
3113 | if (buffer_eopnotsupp(bh)) { | 3114 | if (buffer_eopnotsupp(bh)) { |
3114 | clear_buffer_eopnotsupp(bh); | 3115 | clear_buffer_eopnotsupp(bh); |
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 73ac7ebd1dfc..851388fafc73 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,3 +1,13 @@ | |||
1 | Version 1.57 | ||
2 | ------------ | ||
3 | Improve support for multiple security contexts to the same server. We | ||
4 | used to use the same "vcnumber" for all connections which could cause | ||
5 | the server to treat subsequent connections, especially those that | ||
6 | are authenticated as guest, as reconnections, invalidating the earlier | ||
7 | user's smb session. This fix allows cifs to mount multiple times to the | ||
8 | same server with different userids without risking invalidating earlier | ||
9 | established security contexts. | ||
10 | |||
1 | Version 1.56 | 11 | Version 1.56 |
2 | ------------ | 12 | ------------ |
3 | Add "forcemandatorylock" mount option to allow user to use mandatory | 13 | Add "forcemandatorylock" mount option to allow user to use mandatory |
@@ -7,7 +17,10 @@ specified and user does not have access to query information about the | |||
7 | top of the share. Fix problem in 2.6.28 resolving DFS paths to | 17 | top of the share. Fix problem in 2.6.28 resolving DFS paths to |
8 | Samba servers (worked to Windows). Fix rmdir so that pending search | 18 | Samba servers (worked to Windows). Fix rmdir so that pending search |
9 | (readdir) requests do not get invalid results which include the now | 19 | (readdir) requests do not get invalid results which include the now |
10 | removed directory. | 20 | removed directory. Fix oops in cifs_dfs_ref.c when prefixpath is not reachable |
21 | when using DFS. Add better file create support to servers which support | ||
22 | the CIFS POSIX protocol extensions (this adds support for new flags | ||
23 | on create, and improves semantics for write of locked ranges). | ||
11 | 24 | ||
12 | Version 1.55 | 25 | Version 1.55 |
13 | ------------ | 26 | ------------ |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 7ac481841f87..2b1d28a9ee28 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -100,5 +100,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); | |||
100 | extern const struct export_operations cifs_export_ops; | 100 | extern const struct export_operations cifs_export_ops; |
101 | #endif /* EXPERIMENTAL */ | 101 | #endif /* EXPERIMENTAL */ |
102 | 102 | ||
103 | #define CIFS_VERSION "1.56" | 103 | #define CIFS_VERSION "1.57" |
104 | #endif /* _CIFSFS_H */ | 104 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 94c1ca0ec953..e004f6db5fc8 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -164,9 +164,12 @@ struct TCP_Server_Info { | |||
164 | /* multiplexed reads or writes */ | 164 | /* multiplexed reads or writes */ |
165 | unsigned int maxBuf; /* maxBuf specifies the maximum */ | 165 | unsigned int maxBuf; /* maxBuf specifies the maximum */ |
166 | /* message size the server can send or receive for non-raw SMBs */ | 166 | /* message size the server can send or receive for non-raw SMBs */ |
167 | unsigned int maxRw; /* maxRw specifies the maximum */ | 167 | unsigned int max_rw; /* maxRw specifies the maximum */ |
168 | /* message size the server can send or receive for */ | 168 | /* message size the server can send or receive for */ |
169 | /* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */ | 169 | /* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */ |
170 | unsigned int max_vcs; /* maximum number of smb sessions, at least | ||
171 | those that can be specified uniquely with | ||
172 | vcnumbers */ | ||
170 | char sessid[4]; /* unique token id for this session */ | 173 | char sessid[4]; /* unique token id for this session */ |
171 | /* (returned on Negotiate */ | 174 | /* (returned on Negotiate */ |
172 | int capabilities; /* allow selective disabling of caps by smb sess */ | 175 | int capabilities; /* allow selective disabling of caps by smb sess */ |
@@ -210,6 +213,7 @@ struct cifsSesInfo { | |||
210 | unsigned overrideSecFlg; /* if non-zero override global sec flags */ | 213 | unsigned overrideSecFlg; /* if non-zero override global sec flags */ |
211 | __u16 ipc_tid; /* special tid for connection to IPC share */ | 214 | __u16 ipc_tid; /* special tid for connection to IPC share */ |
212 | __u16 flags; | 215 | __u16 flags; |
216 | __u16 vcnum; | ||
213 | char *serverOS; /* name of operating system underlying server */ | 217 | char *serverOS; /* name of operating system underlying server */ |
214 | char *serverNOS; /* name of network operating system of server */ | 218 | char *serverNOS; /* name of network operating system of server */ |
215 | char *serverDomain; /* security realm of server */ | 219 | char *serverDomain; /* security realm of server */ |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 382ba6298809..083dfc57c7a3 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -42,6 +42,7 @@ extern void _FreeXid(unsigned int); | |||
42 | #define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__func__, xid,current_fsuid())); | 42 | #define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__func__, xid,current_fsuid())); |
43 | #define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__func__,curr_xid,(int)rc));} | 43 | #define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__func__,curr_xid,(int)rc));} |
44 | extern char *build_path_from_dentry(struct dentry *); | 44 | extern char *build_path_from_dentry(struct dentry *); |
45 | extern char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb); | ||
45 | extern char *build_wildcard_path_from_dentry(struct dentry *direntry); | 46 | extern char *build_wildcard_path_from_dentry(struct dentry *direntry); |
46 | /* extern void renew_parental_timestamps(struct dentry *direntry);*/ | 47 | /* extern void renew_parental_timestamps(struct dentry *direntry);*/ |
47 | extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *, | 48 | extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *, |
@@ -91,6 +92,9 @@ extern u64 cifs_UnixTimeToNT(struct timespec); | |||
91 | extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time); | 92 | extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time); |
92 | extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time); | 93 | extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time); |
93 | 94 | ||
95 | extern void posix_fill_in_inode(struct inode *tmp_inode, | ||
96 | FILE_UNIX_BASIC_INFO *pData, int isNewInode); | ||
97 | extern struct inode *cifs_new_inode(struct super_block *sb, __u64 *inum); | ||
94 | extern int cifs_get_inode_info(struct inode **pinode, | 98 | extern int cifs_get_inode_info(struct inode **pinode, |
95 | const unsigned char *search_path, | 99 | const unsigned char *search_path, |
96 | FILE_ALL_INFO *pfile_info, | 100 | FILE_ALL_INFO *pfile_info, |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 552642a507c4..939e2f76b959 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -528,14 +528,15 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) | |||
528 | server->maxReq = le16_to_cpu(rsp->MaxMpxCount); | 528 | server->maxReq = le16_to_cpu(rsp->MaxMpxCount); |
529 | server->maxBuf = min((__u32)le16_to_cpu(rsp->MaxBufSize), | 529 | server->maxBuf = min((__u32)le16_to_cpu(rsp->MaxBufSize), |
530 | (__u32)CIFSMaxBufSize + MAX_CIFS_HDR_SIZE); | 530 | (__u32)CIFSMaxBufSize + MAX_CIFS_HDR_SIZE); |
531 | server->max_vcs = le16_to_cpu(rsp->MaxNumberVcs); | ||
531 | GETU32(server->sessid) = le32_to_cpu(rsp->SessionKey); | 532 | GETU32(server->sessid) = le32_to_cpu(rsp->SessionKey); |
532 | /* even though we do not use raw we might as well set this | 533 | /* even though we do not use raw we might as well set this |
533 | accurately, in case we ever find a need for it */ | 534 | accurately, in case we ever find a need for it */ |
534 | if ((le16_to_cpu(rsp->RawMode) & RAW_ENABLE) == RAW_ENABLE) { | 535 | if ((le16_to_cpu(rsp->RawMode) & RAW_ENABLE) == RAW_ENABLE) { |
535 | server->maxRw = 0xFF00; | 536 | server->max_rw = 0xFF00; |
536 | server->capabilities = CAP_MPX_MODE | CAP_RAW_MODE; | 537 | server->capabilities = CAP_MPX_MODE | CAP_RAW_MODE; |
537 | } else { | 538 | } else { |
538 | server->maxRw = 0;/* we do not need to use raw anyway */ | 539 | server->max_rw = 0;/* do not need to use raw anyway */ |
539 | server->capabilities = CAP_MPX_MODE; | 540 | server->capabilities = CAP_MPX_MODE; |
540 | } | 541 | } |
541 | tmp = (__s16)le16_to_cpu(rsp->ServerTimeZone); | 542 | tmp = (__s16)le16_to_cpu(rsp->ServerTimeZone); |
@@ -638,7 +639,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) | |||
638 | /* probably no need to store and check maxvcs */ | 639 | /* probably no need to store and check maxvcs */ |
639 | server->maxBuf = min(le32_to_cpu(pSMBr->MaxBufferSize), | 640 | server->maxBuf = min(le32_to_cpu(pSMBr->MaxBufferSize), |
640 | (__u32) CIFSMaxBufSize + MAX_CIFS_HDR_SIZE); | 641 | (__u32) CIFSMaxBufSize + MAX_CIFS_HDR_SIZE); |
641 | server->maxRw = le32_to_cpu(pSMBr->MaxRawSize); | 642 | server->max_rw = le32_to_cpu(pSMBr->MaxRawSize); |
642 | cFYI(DBG2, ("Max buf = %d", ses->server->maxBuf)); | 643 | cFYI(DBG2, ("Max buf = %d", ses->server->maxBuf)); |
643 | GETU32(ses->server->sessid) = le32_to_cpu(pSMBr->SessionKey); | 644 | GETU32(ses->server->sessid) = le32_to_cpu(pSMBr->SessionKey); |
644 | server->capabilities = le32_to_cpu(pSMBr->Capabilities); | 645 | server->capabilities = le32_to_cpu(pSMBr->Capabilities); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 2209be943051..da0f4ffa0613 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/string.h> | 23 | #include <linux/string.h> |
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/wait.h> | 25 | #include <linux/wait.h> |
26 | #include <linux/ipv6.h> | ||
27 | #include <linux/pagemap.h> | 26 | #include <linux/pagemap.h> |
28 | #include <linux/ctype.h> | 27 | #include <linux/ctype.h> |
29 | #include <linux/utsname.h> | 28 | #include <linux/utsname.h> |
@@ -35,6 +34,7 @@ | |||
35 | #include <linux/freezer.h> | 34 | #include <linux/freezer.h> |
36 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
37 | #include <asm/processor.h> | 36 | #include <asm/processor.h> |
37 | #include <net/ipv6.h> | ||
38 | #include "cifspdu.h" | 38 | #include "cifspdu.h" |
39 | #include "cifsglob.h" | 39 | #include "cifsglob.h" |
40 | #include "cifsproto.h" | 40 | #include "cifsproto.h" |
@@ -1379,8 +1379,8 @@ cifs_find_tcp_session(struct sockaddr_storage *addr) | |||
1379 | server->addr.sockAddr.sin_addr.s_addr)) | 1379 | server->addr.sockAddr.sin_addr.s_addr)) |
1380 | continue; | 1380 | continue; |
1381 | else if (addr->ss_family == AF_INET6 && | 1381 | else if (addr->ss_family == AF_INET6 && |
1382 | memcmp(&server->addr.sockAddr6.sin6_addr, | 1382 | !ipv6_addr_equal(&server->addr.sockAddr6.sin6_addr, |
1383 | &addr6->sin6_addr, sizeof(addr6->sin6_addr))) | 1383 | &addr6->sin6_addr)) |
1384 | continue; | 1384 | continue; |
1385 | 1385 | ||
1386 | ++server->srv_count; | 1386 | ++server->srv_count; |
@@ -2180,6 +2180,33 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info, | |||
2180 | "mount option supported")); | 2180 | "mount option supported")); |
2181 | } | 2181 | } |
2182 | 2182 | ||
2183 | static int | ||
2184 | is_path_accessible(int xid, struct cifsTconInfo *tcon, | ||
2185 | struct cifs_sb_info *cifs_sb, const char *full_path) | ||
2186 | { | ||
2187 | int rc; | ||
2188 | __u64 inode_num; | ||
2189 | FILE_ALL_INFO *pfile_info; | ||
2190 | |||
2191 | rc = CIFSGetSrvInodeNumber(xid, tcon, full_path, &inode_num, | ||
2192 | cifs_sb->local_nls, | ||
2193 | cifs_sb->mnt_cifs_flags & | ||
2194 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
2195 | if (rc != -EOPNOTSUPP) | ||
2196 | return rc; | ||
2197 | |||
2198 | pfile_info = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL); | ||
2199 | if (pfile_info == NULL) | ||
2200 | return -ENOMEM; | ||
2201 | |||
2202 | rc = CIFSSMBQPathInfo(xid, tcon, full_path, pfile_info, | ||
2203 | 0 /* not legacy */, cifs_sb->local_nls, | ||
2204 | cifs_sb->mnt_cifs_flags & | ||
2205 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
2206 | kfree(pfile_info); | ||
2207 | return rc; | ||
2208 | } | ||
2209 | |||
2183 | int | 2210 | int |
2184 | cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | 2211 | cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, |
2185 | char *mount_data, const char *devname) | 2212 | char *mount_data, const char *devname) |
@@ -2190,6 +2217,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2190 | struct cifsSesInfo *pSesInfo = NULL; | 2217 | struct cifsSesInfo *pSesInfo = NULL; |
2191 | struct cifsTconInfo *tcon = NULL; | 2218 | struct cifsTconInfo *tcon = NULL; |
2192 | struct TCP_Server_Info *srvTcp = NULL; | 2219 | struct TCP_Server_Info *srvTcp = NULL; |
2220 | char *full_path; | ||
2193 | 2221 | ||
2194 | xid = GetXid(); | 2222 | xid = GetXid(); |
2195 | 2223 | ||
@@ -2426,6 +2454,23 @@ mount_fail_check: | |||
2426 | cifs_sb->rsize = min(cifs_sb->rsize, | 2454 | cifs_sb->rsize = min(cifs_sb->rsize, |
2427 | (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE)); | 2455 | (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE)); |
2428 | 2456 | ||
2457 | if (!rc && cifs_sb->prepathlen) { | ||
2458 | /* build_path_to_root works only when we have a valid tcon */ | ||
2459 | full_path = cifs_build_path_to_root(cifs_sb); | ||
2460 | if (full_path == NULL) { | ||
2461 | rc = -ENOMEM; | ||
2462 | goto mount_fail_check; | ||
2463 | } | ||
2464 | rc = is_path_accessible(xid, tcon, cifs_sb, full_path); | ||
2465 | if (rc) { | ||
2466 | cERROR(1, ("Path %s in not accessible: %d", | ||
2467 | full_path, rc)); | ||
2468 | kfree(full_path); | ||
2469 | goto mount_fail_check; | ||
2470 | } | ||
2471 | kfree(full_path); | ||
2472 | } | ||
2473 | |||
2429 | /* volume_info->password is freed above when existing session found | 2474 | /* volume_info->password is freed above when existing session found |
2430 | (in which case it is not needed anymore) but when new sesion is created | 2475 | (in which case it is not needed anymore) but when new sesion is created |
2431 | the password ptr is put in the new session structure (in which case the | 2476 | the password ptr is put in the new session structure (in which case the |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 964aad03c5ad..89fb72832652 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * vfs operations that deal with dentries | 4 | * vfs operations that deal with dentries |
5 | * | 5 | * |
6 | * Copyright (C) International Business Machines Corp., 2002,2008 | 6 | * Copyright (C) International Business Machines Corp., 2002,2009 |
7 | * Author(s): Steve French (sfrench@us.ibm.com) | 7 | * Author(s): Steve French (sfrench@us.ibm.com) |
8 | * | 8 | * |
9 | * This library is free software; you can redistribute it and/or modify | 9 | * This library is free software; you can redistribute it and/or modify |
@@ -129,6 +129,78 @@ cifs_bp_rename_retry: | |||
129 | return full_path; | 129 | return full_path; |
130 | } | 130 | } |
131 | 131 | ||
132 | static int cifs_posix_open(char *full_path, struct inode **pinode, | ||
133 | struct super_block *sb, int mode, int oflags, | ||
134 | int *poplock, __u16 *pnetfid, int xid) | ||
135 | { | ||
136 | int rc; | ||
137 | __u32 oplock; | ||
138 | FILE_UNIX_BASIC_INFO *presp_data; | ||
139 | __u32 posix_flags = 0; | ||
140 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | ||
141 | |||
142 | cFYI(1, ("posix open %s", full_path)); | ||
143 | |||
144 | presp_data = kzalloc(sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL); | ||
145 | if (presp_data == NULL) | ||
146 | return -ENOMEM; | ||
147 | |||
148 | /* So far cifs posix extensions can only map the following flags. | ||
149 | There are other valid fmode oflags such as FMODE_LSEEK, FMODE_PREAD, but | ||
150 | so far we do not seem to need them, and we can treat them as local only */ | ||
151 | if ((oflags & (FMODE_READ | FMODE_WRITE)) == | ||
152 | (FMODE_READ | FMODE_WRITE)) | ||
153 | posix_flags = SMB_O_RDWR; | ||
154 | else if (oflags & FMODE_READ) | ||
155 | posix_flags = SMB_O_RDONLY; | ||
156 | else if (oflags & FMODE_WRITE) | ||
157 | posix_flags = SMB_O_WRONLY; | ||
158 | if (oflags & O_CREAT) | ||
159 | posix_flags |= SMB_O_CREAT; | ||
160 | if (oflags & O_EXCL) | ||
161 | posix_flags |= SMB_O_EXCL; | ||
162 | if (oflags & O_TRUNC) | ||
163 | posix_flags |= SMB_O_TRUNC; | ||
164 | if (oflags & O_APPEND) | ||
165 | posix_flags |= SMB_O_APPEND; | ||
166 | if (oflags & O_SYNC) | ||
167 | posix_flags |= SMB_O_SYNC; | ||
168 | if (oflags & O_DIRECTORY) | ||
169 | posix_flags |= SMB_O_DIRECTORY; | ||
170 | if (oflags & O_NOFOLLOW) | ||
171 | posix_flags |= SMB_O_NOFOLLOW; | ||
172 | if (oflags & O_DIRECT) | ||
173 | posix_flags |= SMB_O_DIRECT; | ||
174 | |||
175 | |||
176 | rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode, | ||
177 | pnetfid, presp_data, &oplock, full_path, | ||
178 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | ||
179 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
180 | if (rc) | ||
181 | goto posix_open_ret; | ||
182 | |||
183 | if (presp_data->Type == cpu_to_le32(-1)) | ||
184 | goto posix_open_ret; /* open ok, caller does qpathinfo */ | ||
185 | |||
186 | /* get new inode and set it up */ | ||
187 | if (!pinode) | ||
188 | goto posix_open_ret; /* caller does not need info */ | ||
189 | |||
190 | *pinode = cifs_new_inode(sb, &presp_data->UniqueId); | ||
191 | |||
192 | /* We do not need to close the file if new_inode fails since | ||
193 | the caller will retry qpathinfo as long as inode is null */ | ||
194 | if (*pinode == NULL) | ||
195 | goto posix_open_ret; | ||
196 | |||
197 | posix_fill_in_inode(*pinode, presp_data, 1); | ||
198 | |||
199 | posix_open_ret: | ||
200 | kfree(presp_data); | ||
201 | return rc; | ||
202 | } | ||
203 | |||
132 | static void setup_cifs_dentry(struct cifsTconInfo *tcon, | 204 | static void setup_cifs_dentry(struct cifsTconInfo *tcon, |
133 | struct dentry *direntry, | 205 | struct dentry *direntry, |
134 | struct inode *newinode) | 206 | struct inode *newinode) |
@@ -150,7 +222,14 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
150 | int xid; | 222 | int xid; |
151 | int create_options = CREATE_NOT_DIR; | 223 | int create_options = CREATE_NOT_DIR; |
152 | int oplock = 0; | 224 | int oplock = 0; |
153 | /* BB below access is too much for the mknod to request */ | 225 | int oflags; |
226 | /* | ||
227 | * BB below access is probably too much for mknod to request | ||
228 | * but we have to do query and setpathinfo so requesting | ||
229 | * less could fail (unless we want to request getatr and setatr | ||
230 | * permissions (only). At least for POSIX we do not have to | ||
231 | * request so much. | ||
232 | */ | ||
154 | int desiredAccess = GENERIC_READ | GENERIC_WRITE; | 233 | int desiredAccess = GENERIC_READ | GENERIC_WRITE; |
155 | __u16 fileHandle; | 234 | __u16 fileHandle; |
156 | struct cifs_sb_info *cifs_sb; | 235 | struct cifs_sb_info *cifs_sb; |
@@ -174,13 +253,43 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
174 | } | 253 | } |
175 | 254 | ||
176 | mode &= ~current->fs->umask; | 255 | mode &= ~current->fs->umask; |
256 | if (oplockEnabled) | ||
257 | oplock = REQ_OPLOCK; | ||
177 | 258 | ||
178 | if (nd && (nd->flags & LOOKUP_OPEN)) { | 259 | if (nd && (nd->flags & LOOKUP_OPEN)) |
179 | int oflags = nd->intent.open.flags; | 260 | oflags = nd->intent.open.flags; |
261 | else | ||
262 | oflags = FMODE_READ; | ||
263 | |||
264 | if (tcon->unix_ext && (tcon->ses->capabilities & CAP_UNIX) && | ||
265 | (CIFS_UNIX_POSIX_PATH_OPS_CAP & | ||
266 | le64_to_cpu(tcon->fsUnixInfo.Capability))) { | ||
267 | rc = cifs_posix_open(full_path, &newinode, inode->i_sb, | ||
268 | mode, oflags, &oplock, &fileHandle, xid); | ||
269 | /* EIO could indicate that (posix open) operation is not | ||
270 | supported, despite what server claimed in capability | ||
271 | negotation. EREMOTE indicates DFS junction, which is not | ||
272 | handled in posix open */ | ||
273 | |||
274 | if ((rc == 0) && (newinode == NULL)) | ||
275 | goto cifs_create_get_file_info; /* query inode info */ | ||
276 | else if (rc == 0) /* success, no need to query */ | ||
277 | goto cifs_create_set_dentry; | ||
278 | else if ((rc != -EIO) && (rc != -EREMOTE) && | ||
279 | (rc != -EOPNOTSUPP)) /* path not found or net err */ | ||
280 | goto cifs_create_out; | ||
281 | /* else fallthrough to retry, using older open call, this is | ||
282 | case where server does not support this SMB level, and | ||
283 | falsely claims capability (also get here for DFS case | ||
284 | which should be rare for path not covered on files) */ | ||
285 | } | ||
180 | 286 | ||
287 | if (nd && (nd->flags & LOOKUP_OPEN)) { | ||
288 | /* if the file is going to stay open, then we | ||
289 | need to set the desired access properly */ | ||
181 | desiredAccess = 0; | 290 | desiredAccess = 0; |
182 | if (oflags & FMODE_READ) | 291 | if (oflags & FMODE_READ) |
183 | desiredAccess |= GENERIC_READ; | 292 | desiredAccess |= GENERIC_READ; /* is this too little? */ |
184 | if (oflags & FMODE_WRITE) { | 293 | if (oflags & FMODE_WRITE) { |
185 | desiredAccess |= GENERIC_WRITE; | 294 | desiredAccess |= GENERIC_WRITE; |
186 | if (!(oflags & FMODE_READ)) | 295 | if (!(oflags & FMODE_READ)) |
@@ -199,8 +308,6 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
199 | 308 | ||
200 | /* BB add processing to set equivalent of mode - e.g. via CreateX with | 309 | /* BB add processing to set equivalent of mode - e.g. via CreateX with |
201 | ACLs */ | 310 | ACLs */ |
202 | if (oplockEnabled) | ||
203 | oplock = REQ_OPLOCK; | ||
204 | 311 | ||
205 | buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL); | 312 | buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL); |
206 | if (buf == NULL) { | 313 | if (buf == NULL) { |
@@ -233,116 +340,112 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
233 | } | 340 | } |
234 | if (rc) { | 341 | if (rc) { |
235 | cFYI(1, ("cifs_create returned 0x%x", rc)); | 342 | cFYI(1, ("cifs_create returned 0x%x", rc)); |
236 | } else { | 343 | goto cifs_create_out; |
237 | /* If Open reported that we actually created a file | 344 | } |
238 | then we now have to set the mode if possible */ | 345 | |
239 | if ((tcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) { | 346 | /* If Open reported that we actually created a file |
240 | struct cifs_unix_set_info_args args = { | 347 | then we now have to set the mode if possible */ |
348 | if ((tcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) { | ||
349 | struct cifs_unix_set_info_args args = { | ||
241 | .mode = mode, | 350 | .mode = mode, |
242 | .ctime = NO_CHANGE_64, | 351 | .ctime = NO_CHANGE_64, |
243 | .atime = NO_CHANGE_64, | 352 | .atime = NO_CHANGE_64, |
244 | .mtime = NO_CHANGE_64, | 353 | .mtime = NO_CHANGE_64, |
245 | .device = 0, | 354 | .device = 0, |
246 | }; | 355 | }; |
247 | 356 | ||
248 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { | 357 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { |
249 | args.uid = (__u64) current_fsuid(); | 358 | args.uid = (__u64) current_fsuid(); |
250 | if (inode->i_mode & S_ISGID) | 359 | if (inode->i_mode & S_ISGID) |
251 | args.gid = (__u64) inode->i_gid; | 360 | args.gid = (__u64) inode->i_gid; |
252 | else | 361 | else |
253 | args.gid = (__u64) current_fsgid(); | 362 | args.gid = (__u64) current_fsgid(); |
254 | } else { | ||
255 | args.uid = NO_CHANGE_64; | ||
256 | args.gid = NO_CHANGE_64; | ||
257 | } | ||
258 | CIFSSMBUnixSetInfo(xid, tcon, full_path, &args, | ||
259 | cifs_sb->local_nls, | ||
260 | cifs_sb->mnt_cifs_flags & | ||
261 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
262 | } else { | 363 | } else { |
263 | /* BB implement mode setting via Windows security | 364 | args.uid = NO_CHANGE_64; |
264 | descriptors e.g. */ | 365 | args.gid = NO_CHANGE_64; |
265 | /* CIFSSMBWinSetPerms(xid,tcon,path,mode,-1,-1,nls);*/ | ||
266 | |||
267 | /* Could set r/o dos attribute if mode & 0222 == 0 */ | ||
268 | } | 366 | } |
367 | CIFSSMBUnixSetInfo(xid, tcon, full_path, &args, | ||
368 | cifs_sb->local_nls, | ||
369 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
370 | } else { | ||
371 | /* BB implement mode setting via Windows security | ||
372 | descriptors e.g. */ | ||
373 | /* CIFSSMBWinSetPerms(xid,tcon,path,mode,-1,-1,nls);*/ | ||
269 | 374 | ||
270 | /* server might mask mode so we have to query for it */ | 375 | /* Could set r/o dos attribute if mode & 0222 == 0 */ |
271 | if (tcon->unix_ext) | 376 | } |
272 | rc = cifs_get_inode_info_unix(&newinode, full_path, | 377 | |
273 | inode->i_sb, xid); | 378 | cifs_create_get_file_info: |
274 | else { | 379 | /* server might mask mode so we have to query for it */ |
275 | rc = cifs_get_inode_info(&newinode, full_path, | 380 | if (tcon->unix_ext) |
276 | buf, inode->i_sb, xid, | 381 | rc = cifs_get_inode_info_unix(&newinode, full_path, |
277 | &fileHandle); | 382 | inode->i_sb, xid); |
278 | if (newinode) { | 383 | else { |
279 | if (cifs_sb->mnt_cifs_flags & | 384 | rc = cifs_get_inode_info(&newinode, full_path, buf, |
280 | CIFS_MOUNT_DYNPERM) | 385 | inode->i_sb, xid, &fileHandle); |
281 | newinode->i_mode = mode; | 386 | if (newinode) { |
282 | if ((oplock & CIFS_CREATE_ACTION) && | 387 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) |
283 | (cifs_sb->mnt_cifs_flags & | 388 | newinode->i_mode = mode; |
284 | CIFS_MOUNT_SET_UID)) { | 389 | if ((oplock & CIFS_CREATE_ACTION) && |
285 | newinode->i_uid = current_fsuid(); | 390 | (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)) { |
286 | if (inode->i_mode & S_ISGID) | 391 | newinode->i_uid = current_fsuid(); |
287 | newinode->i_gid = | 392 | if (inode->i_mode & S_ISGID) |
288 | inode->i_gid; | 393 | newinode->i_gid = inode->i_gid; |
289 | else | 394 | else |
290 | newinode->i_gid = | 395 | newinode->i_gid = current_fsgid(); |
291 | current_fsgid(); | ||
292 | } | ||
293 | } | 396 | } |
294 | } | 397 | } |
398 | } | ||
295 | 399 | ||
296 | if (rc != 0) { | 400 | cifs_create_set_dentry: |
297 | cFYI(1, ("Create worked, get_inode_info failed rc = %d", | 401 | if (rc == 0) |
298 | rc)); | 402 | setup_cifs_dentry(tcon, direntry, newinode); |
299 | } else | 403 | else |
300 | setup_cifs_dentry(tcon, direntry, newinode); | 404 | cFYI(1, ("Create worked, get_inode_info failed rc = %d", rc)); |
301 | 405 | ||
302 | if ((nd == NULL /* nfsd case - nfs srv does not set nd */) || | 406 | /* nfsd case - nfs srv does not set nd */ |
303 | (!(nd->flags & LOOKUP_OPEN))) { | 407 | if ((nd == NULL) || (!(nd->flags & LOOKUP_OPEN))) { |
304 | /* mknod case - do not leave file open */ | 408 | /* mknod case - do not leave file open */ |
305 | CIFSSMBClose(xid, tcon, fileHandle); | 409 | CIFSSMBClose(xid, tcon, fileHandle); |
306 | } else if (newinode) { | 410 | } else if (newinode) { |
307 | struct cifsFileInfo *pCifsFile = | 411 | struct cifsFileInfo *pCifsFile = |
308 | kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); | 412 | kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); |
309 | 413 | ||
310 | if (pCifsFile == NULL) | 414 | if (pCifsFile == NULL) |
311 | goto cifs_create_out; | 415 | goto cifs_create_out; |
312 | pCifsFile->netfid = fileHandle; | 416 | pCifsFile->netfid = fileHandle; |
313 | pCifsFile->pid = current->tgid; | 417 | pCifsFile->pid = current->tgid; |
314 | pCifsFile->pInode = newinode; | 418 | pCifsFile->pInode = newinode; |
315 | pCifsFile->invalidHandle = false; | 419 | pCifsFile->invalidHandle = false; |
316 | pCifsFile->closePend = false; | 420 | pCifsFile->closePend = false; |
317 | init_MUTEX(&pCifsFile->fh_sem); | 421 | init_MUTEX(&pCifsFile->fh_sem); |
318 | mutex_init(&pCifsFile->lock_mutex); | 422 | mutex_init(&pCifsFile->lock_mutex); |
319 | INIT_LIST_HEAD(&pCifsFile->llist); | 423 | INIT_LIST_HEAD(&pCifsFile->llist); |
320 | atomic_set(&pCifsFile->wrtPending, 0); | 424 | atomic_set(&pCifsFile->wrtPending, 0); |
321 | 425 | ||
322 | /* set the following in open now | 426 | /* set the following in open now |
323 | pCifsFile->pfile = file; */ | 427 | pCifsFile->pfile = file; */ |
324 | write_lock(&GlobalSMBSeslock); | 428 | write_lock(&GlobalSMBSeslock); |
325 | list_add(&pCifsFile->tlist, &tcon->openFileList); | 429 | list_add(&pCifsFile->tlist, &tcon->openFileList); |
326 | pCifsInode = CIFS_I(newinode); | 430 | pCifsInode = CIFS_I(newinode); |
327 | if (pCifsInode) { | 431 | if (pCifsInode) { |
328 | /* if readable file instance put first in list*/ | 432 | /* if readable file instance put first in list*/ |
329 | if (write_only) { | 433 | if (write_only) { |
330 | list_add_tail(&pCifsFile->flist, | 434 | list_add_tail(&pCifsFile->flist, |
331 | &pCifsInode->openFileList); | 435 | &pCifsInode->openFileList); |
332 | } else { | 436 | } else { |
333 | list_add(&pCifsFile->flist, | 437 | list_add(&pCifsFile->flist, |
334 | &pCifsInode->openFileList); | 438 | &pCifsInode->openFileList); |
335 | } | ||
336 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { | ||
337 | pCifsInode->clientCanCacheAll = true; | ||
338 | pCifsInode->clientCanCacheRead = true; | ||
339 | cFYI(1, ("Exclusive Oplock inode %p", | ||
340 | newinode)); | ||
341 | } else if ((oplock & 0xF) == OPLOCK_READ) | ||
342 | pCifsInode->clientCanCacheRead = true; | ||
343 | } | 439 | } |
344 | write_unlock(&GlobalSMBSeslock); | 440 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
441 | pCifsInode->clientCanCacheAll = true; | ||
442 | pCifsInode->clientCanCacheRead = true; | ||
443 | cFYI(1, ("Exclusive Oplock inode %p", | ||
444 | newinode)); | ||
445 | } else if ((oplock & 0xF) == OPLOCK_READ) | ||
446 | pCifsInode->clientCanCacheRead = true; | ||
345 | } | 447 | } |
448 | write_unlock(&GlobalSMBSeslock); | ||
346 | } | 449 | } |
347 | cifs_create_out: | 450 | cifs_create_out: |
348 | kfree(buf); | 451 | kfree(buf); |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index bcf7b5184664..4690a360c855 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -199,6 +199,49 @@ static void fill_fake_finddataunix(FILE_UNIX_BASIC_INFO *pfnd_dat, | |||
199 | pfnd_dat->Gid = cpu_to_le64(pinode->i_gid); | 199 | pfnd_dat->Gid = cpu_to_le64(pinode->i_gid); |
200 | } | 200 | } |
201 | 201 | ||
202 | /** | ||
203 | * cifs_new inode - create new inode, initialize, and hash it | ||
204 | * @sb - pointer to superblock | ||
205 | * @inum - if valid pointer and serverino is enabled, replace i_ino with val | ||
206 | * | ||
207 | * Create a new inode, initialize it for CIFS and hash it. Returns the new | ||
208 | * inode or NULL if one couldn't be allocated. | ||
209 | * | ||
210 | * If the share isn't mounted with "serverino" or inum is a NULL pointer then | ||
211 | * we'll just use the inode number assigned by new_inode(). Note that this can | ||
212 | * mean i_ino collisions since the i_ino assigned by new_inode is not | ||
213 | * guaranteed to be unique. | ||
214 | */ | ||
215 | struct inode * | ||
216 | cifs_new_inode(struct super_block *sb, __u64 *inum) | ||
217 | { | ||
218 | struct inode *inode; | ||
219 | |||
220 | inode = new_inode(sb); | ||
221 | if (inode == NULL) | ||
222 | return NULL; | ||
223 | |||
224 | /* | ||
225 | * BB: Is i_ino == 0 legal? Here, we assume that it is. If it isn't we | ||
226 | * stop passing inum as ptr. Are there sanity checks we can use to | ||
227 | * ensure that the server is really filling in that field? Also, | ||
228 | * if serverino is disabled, perhaps we should be using iunique()? | ||
229 | */ | ||
230 | if (inum && (CIFS_SB(sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) | ||
231 | inode->i_ino = (unsigned long) *inum; | ||
232 | |||
233 | /* | ||
234 | * must set this here instead of cifs_alloc_inode since VFS will | ||
235 | * clobber i_flags | ||
236 | */ | ||
237 | if (sb->s_flags & MS_NOATIME) | ||
238 | inode->i_flags |= S_NOATIME | S_NOCMTIME; | ||
239 | |||
240 | insert_inode_hash(inode); | ||
241 | |||
242 | return inode; | ||
243 | } | ||
244 | |||
202 | int cifs_get_inode_info_unix(struct inode **pinode, | 245 | int cifs_get_inode_info_unix(struct inode **pinode, |
203 | const unsigned char *full_path, struct super_block *sb, int xid) | 246 | const unsigned char *full_path, struct super_block *sb, int xid) |
204 | { | 247 | { |
@@ -233,22 +276,11 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
233 | 276 | ||
234 | /* get new inode */ | 277 | /* get new inode */ |
235 | if (*pinode == NULL) { | 278 | if (*pinode == NULL) { |
236 | *pinode = new_inode(sb); | 279 | *pinode = cifs_new_inode(sb, &find_data.UniqueId); |
237 | if (*pinode == NULL) { | 280 | if (*pinode == NULL) { |
238 | rc = -ENOMEM; | 281 | rc = -ENOMEM; |
239 | goto cgiiu_exit; | 282 | goto cgiiu_exit; |
240 | } | 283 | } |
241 | /* Is an i_ino of zero legal? */ | ||
242 | /* note ino incremented to unique num in new_inode */ | ||
243 | /* Are there sanity checks we can use to ensure that | ||
244 | the server is really filling in that field? */ | ||
245 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) | ||
246 | (*pinode)->i_ino = (unsigned long)find_data.UniqueId; | ||
247 | |||
248 | if (sb->s_flags & MS_NOATIME) | ||
249 | (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME; | ||
250 | |||
251 | insert_inode_hash(*pinode); | ||
252 | } | 284 | } |
253 | 285 | ||
254 | inode = *pinode; | 286 | inode = *pinode; |
@@ -465,11 +497,9 @@ int cifs_get_inode_info(struct inode **pinode, | |||
465 | 497 | ||
466 | /* get new inode */ | 498 | /* get new inode */ |
467 | if (*pinode == NULL) { | 499 | if (*pinode == NULL) { |
468 | *pinode = new_inode(sb); | 500 | __u64 inode_num; |
469 | if (*pinode == NULL) { | 501 | __u64 *pinum = &inode_num; |
470 | rc = -ENOMEM; | 502 | |
471 | goto cgii_exit; | ||
472 | } | ||
473 | /* Is an i_ino of zero legal? Can we use that to check | 503 | /* Is an i_ino of zero legal? Can we use that to check |
474 | if the server supports returning inode numbers? Are | 504 | if the server supports returning inode numbers? Are |
475 | there other sanity checks we can use to ensure that | 505 | there other sanity checks we can use to ensure that |
@@ -486,22 +516,26 @@ int cifs_get_inode_info(struct inode **pinode, | |||
486 | 516 | ||
487 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { | 517 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { |
488 | int rc1 = 0; | 518 | int rc1 = 0; |
489 | __u64 inode_num; | ||
490 | 519 | ||
491 | rc1 = CIFSGetSrvInodeNumber(xid, pTcon, | 520 | rc1 = CIFSGetSrvInodeNumber(xid, pTcon, |
492 | full_path, &inode_num, | 521 | full_path, pinum, |
493 | cifs_sb->local_nls, | 522 | cifs_sb->local_nls, |
494 | cifs_sb->mnt_cifs_flags & | 523 | cifs_sb->mnt_cifs_flags & |
495 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 524 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
496 | if (rc1) { | 525 | if (rc1) { |
497 | cFYI(1, ("GetSrvInodeNum rc %d", rc1)); | 526 | cFYI(1, ("GetSrvInodeNum rc %d", rc1)); |
527 | pinum = NULL; | ||
498 | /* BB EOPNOSUPP disable SERVER_INUM? */ | 528 | /* BB EOPNOSUPP disable SERVER_INUM? */ |
499 | } else /* do we need cast or hash to ino? */ | 529 | } |
500 | (*pinode)->i_ino = inode_num; | 530 | } else { |
501 | } /* else ino incremented to unique num in new_inode*/ | 531 | pinum = NULL; |
502 | if (sb->s_flags & MS_NOATIME) | 532 | } |
503 | (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME; | 533 | |
504 | insert_inode_hash(*pinode); | 534 | *pinode = cifs_new_inode(sb, pinum); |
535 | if (*pinode == NULL) { | ||
536 | rc = -ENOMEM; | ||
537 | goto cgii_exit; | ||
538 | } | ||
505 | } | 539 | } |
506 | inode = *pinode; | 540 | inode = *pinode; |
507 | cifsInfo = CIFS_I(inode); | 541 | cifsInfo = CIFS_I(inode); |
@@ -621,7 +655,7 @@ static const struct inode_operations cifs_ipc_inode_ops = { | |||
621 | .lookup = cifs_lookup, | 655 | .lookup = cifs_lookup, |
622 | }; | 656 | }; |
623 | 657 | ||
624 | static char *build_path_to_root(struct cifs_sb_info *cifs_sb) | 658 | char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb) |
625 | { | 659 | { |
626 | int pplen = cifs_sb->prepathlen; | 660 | int pplen = cifs_sb->prepathlen; |
627 | int dfsplen; | 661 | int dfsplen; |
@@ -678,7 +712,7 @@ struct inode *cifs_iget(struct super_block *sb, unsigned long ino) | |||
678 | return inode; | 712 | return inode; |
679 | 713 | ||
680 | cifs_sb = CIFS_SB(inode->i_sb); | 714 | cifs_sb = CIFS_SB(inode->i_sb); |
681 | full_path = build_path_to_root(cifs_sb); | 715 | full_path = cifs_build_path_to_root(cifs_sb); |
682 | if (full_path == NULL) | 716 | if (full_path == NULL) |
683 | return ERR_PTR(-ENOMEM); | 717 | return ERR_PTR(-ENOMEM); |
684 | 718 | ||
@@ -1017,7 +1051,7 @@ out_reval: | |||
1017 | return rc; | 1051 | return rc; |
1018 | } | 1052 | } |
1019 | 1053 | ||
1020 | static void posix_fill_in_inode(struct inode *tmp_inode, | 1054 | void posix_fill_in_inode(struct inode *tmp_inode, |
1021 | FILE_UNIX_BASIC_INFO *pData, int isNewInode) | 1055 | FILE_UNIX_BASIC_INFO *pData, int isNewInode) |
1022 | { | 1056 | { |
1023 | struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); | 1057 | struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); |
@@ -1114,24 +1148,14 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
1114 | else | 1148 | else |
1115 | direntry->d_op = &cifs_dentry_ops; | 1149 | direntry->d_op = &cifs_dentry_ops; |
1116 | 1150 | ||
1117 | newinode = new_inode(inode->i_sb); | 1151 | newinode = cifs_new_inode(inode->i_sb, |
1152 | &pInfo->UniqueId); | ||
1118 | if (newinode == NULL) { | 1153 | if (newinode == NULL) { |
1119 | kfree(pInfo); | 1154 | kfree(pInfo); |
1120 | goto mkdir_get_info; | 1155 | goto mkdir_get_info; |
1121 | } | 1156 | } |
1122 | 1157 | ||
1123 | /* Is an i_ino of zero legal? */ | ||
1124 | /* Are there sanity checks we can use to ensure that | ||
1125 | the server is really filling in that field? */ | ||
1126 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { | ||
1127 | newinode->i_ino = | ||
1128 | (unsigned long)pInfo->UniqueId; | ||
1129 | } /* note ino incremented to unique num in new_inode */ | ||
1130 | if (inode->i_sb->s_flags & MS_NOATIME) | ||
1131 | newinode->i_flags |= S_NOATIME | S_NOCMTIME; | ||
1132 | newinode->i_nlink = 2; | 1158 | newinode->i_nlink = 2; |
1133 | |||
1134 | insert_inode_hash(newinode); | ||
1135 | d_instantiate(direntry, newinode); | 1159 | d_instantiate(direntry, newinode); |
1136 | 1160 | ||
1137 | /* we already checked in POSIXCreate whether | 1161 | /* we already checked in POSIXCreate whether |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 9f51f9bf0292..c2c01ff4c32c 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -56,35 +56,34 @@ static inline void dump_cifs_file_struct(struct file *file, char *label) | |||
56 | } | 56 | } |
57 | #endif /* DEBUG2 */ | 57 | #endif /* DEBUG2 */ |
58 | 58 | ||
59 | /* Returns one if new inode created (which therefore needs to be hashed) */ | 59 | /* Returns 1 if new inode created, 2 if both dentry and inode were */ |
60 | /* Might check in the future if inode number changed so we can rehash inode */ | 60 | /* Might check in the future if inode number changed so we can rehash inode */ |
61 | static int construct_dentry(struct qstr *qstring, struct file *file, | 61 | static int |
62 | struct inode **ptmp_inode, struct dentry **pnew_dentry) | 62 | construct_dentry(struct qstr *qstring, struct file *file, |
63 | struct inode **ptmp_inode, struct dentry **pnew_dentry, | ||
64 | __u64 *inum) | ||
63 | { | 65 | { |
64 | struct dentry *tmp_dentry; | 66 | struct dentry *tmp_dentry = NULL; |
65 | struct cifs_sb_info *cifs_sb; | 67 | struct super_block *sb = file->f_path.dentry->d_sb; |
66 | struct cifsTconInfo *pTcon; | ||
67 | int rc = 0; | 68 | int rc = 0; |
68 | 69 | ||
69 | cFYI(1, ("For %s", qstring->name)); | 70 | cFYI(1, ("For %s", qstring->name)); |
70 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | ||
71 | pTcon = cifs_sb->tcon; | ||
72 | 71 | ||
73 | qstring->hash = full_name_hash(qstring->name, qstring->len); | 72 | qstring->hash = full_name_hash(qstring->name, qstring->len); |
74 | tmp_dentry = d_lookup(file->f_path.dentry, qstring); | 73 | tmp_dentry = d_lookup(file->f_path.dentry, qstring); |
75 | if (tmp_dentry) { | 74 | if (tmp_dentry) { |
75 | /* BB: overwrite old name? i.e. tmp_dentry->d_name and | ||
76 | * tmp_dentry->d_name.len?? | ||
77 | */ | ||
76 | cFYI(0, ("existing dentry with inode 0x%p", | 78 | cFYI(0, ("existing dentry with inode 0x%p", |
77 | tmp_dentry->d_inode)); | 79 | tmp_dentry->d_inode)); |
78 | *ptmp_inode = tmp_dentry->d_inode; | 80 | *ptmp_inode = tmp_dentry->d_inode; |
79 | /* BB overwrite old name? i.e. tmp_dentry->d_name and tmp_dentry->d_name.len??*/ | ||
80 | if (*ptmp_inode == NULL) { | 81 | if (*ptmp_inode == NULL) { |
81 | *ptmp_inode = new_inode(file->f_path.dentry->d_sb); | 82 | *ptmp_inode = cifs_new_inode(sb, inum); |
82 | if (*ptmp_inode == NULL) | 83 | if (*ptmp_inode == NULL) |
83 | return rc; | 84 | return rc; |
84 | rc = 1; | 85 | rc = 1; |
85 | } | 86 | } |
86 | if (file->f_path.dentry->d_sb->s_flags & MS_NOATIME) | ||
87 | (*ptmp_inode)->i_flags |= S_NOATIME | S_NOCMTIME; | ||
88 | } else { | 87 | } else { |
89 | tmp_dentry = d_alloc(file->f_path.dentry, qstring); | 88 | tmp_dentry = d_alloc(file->f_path.dentry, qstring); |
90 | if (tmp_dentry == NULL) { | 89 | if (tmp_dentry == NULL) { |
@@ -93,15 +92,14 @@ static int construct_dentry(struct qstr *qstring, struct file *file, | |||
93 | return rc; | 92 | return rc; |
94 | } | 93 | } |
95 | 94 | ||
96 | *ptmp_inode = new_inode(file->f_path.dentry->d_sb); | 95 | if (CIFS_SB(sb)->tcon->nocase) |
97 | if (pTcon->nocase) | ||
98 | tmp_dentry->d_op = &cifs_ci_dentry_ops; | 96 | tmp_dentry->d_op = &cifs_ci_dentry_ops; |
99 | else | 97 | else |
100 | tmp_dentry->d_op = &cifs_dentry_ops; | 98 | tmp_dentry->d_op = &cifs_dentry_ops; |
99 | |||
100 | *ptmp_inode = cifs_new_inode(sb, inum); | ||
101 | if (*ptmp_inode == NULL) | 101 | if (*ptmp_inode == NULL) |
102 | return rc; | 102 | return rc; |
103 | if (file->f_path.dentry->d_sb->s_flags & MS_NOATIME) | ||
104 | (*ptmp_inode)->i_flags |= S_NOATIME | S_NOCMTIME; | ||
105 | rc = 2; | 103 | rc = 2; |
106 | } | 104 | } |
107 | 105 | ||
@@ -822,7 +820,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
822 | /* inode num, inode type and filename returned */ | 820 | /* inode num, inode type and filename returned */ |
823 | static int cifs_get_name_from_search_buf(struct qstr *pqst, | 821 | static int cifs_get_name_from_search_buf(struct qstr *pqst, |
824 | char *current_entry, __u16 level, unsigned int unicode, | 822 | char *current_entry, __u16 level, unsigned int unicode, |
825 | struct cifs_sb_info *cifs_sb, int max_len, ino_t *pinum) | 823 | struct cifs_sb_info *cifs_sb, int max_len, __u64 *pinum) |
826 | { | 824 | { |
827 | int rc = 0; | 825 | int rc = 0; |
828 | unsigned int len = 0; | 826 | unsigned int len = 0; |
@@ -842,9 +840,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst, | |||
842 | len = strnlen(filename, PATH_MAX); | 840 | len = strnlen(filename, PATH_MAX); |
843 | } | 841 | } |
844 | 842 | ||
845 | /* BB fixme - hash low and high 32 bits if not 64 bit arch BB */ | 843 | *pinum = pFindData->UniqueId; |
846 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) | ||
847 | *pinum = pFindData->UniqueId; | ||
848 | } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { | 844 | } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { |
849 | FILE_DIRECTORY_INFO *pFindData = | 845 | FILE_DIRECTORY_INFO *pFindData = |
850 | (FILE_DIRECTORY_INFO *)current_entry; | 846 | (FILE_DIRECTORY_INFO *)current_entry; |
@@ -907,7 +903,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file, | |||
907 | struct qstr qstring; | 903 | struct qstr qstring; |
908 | struct cifsFileInfo *pCifsF; | 904 | struct cifsFileInfo *pCifsF; |
909 | unsigned int obj_type; | 905 | unsigned int obj_type; |
910 | ino_t inum; | 906 | __u64 inum; |
911 | struct cifs_sb_info *cifs_sb; | 907 | struct cifs_sb_info *cifs_sb; |
912 | struct inode *tmp_inode; | 908 | struct inode *tmp_inode; |
913 | struct dentry *tmp_dentry; | 909 | struct dentry *tmp_dentry; |
@@ -940,20 +936,18 @@ static int cifs_filldir(char *pfindEntry, struct file *file, | |||
940 | if (rc) | 936 | if (rc) |
941 | return rc; | 937 | return rc; |
942 | 938 | ||
943 | rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry); | 939 | /* only these two infolevels return valid inode numbers */ |
940 | if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_UNIX || | ||
941 | pCifsF->srch_inf.info_level == SMB_FIND_FILE_ID_FULL_DIR_INFO) | ||
942 | rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry, | ||
943 | &inum); | ||
944 | else | ||
945 | rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry, | ||
946 | NULL); | ||
947 | |||
944 | if ((tmp_inode == NULL) || (tmp_dentry == NULL)) | 948 | if ((tmp_inode == NULL) || (tmp_dentry == NULL)) |
945 | return -ENOMEM; | 949 | return -ENOMEM; |
946 | 950 | ||
947 | if (rc) { | ||
948 | /* inode created, we need to hash it with right inode number */ | ||
949 | if (inum != 0) { | ||
950 | /* BB fixme - hash the 2 32 quantities bits together if | ||
951 | * necessary BB */ | ||
952 | tmp_inode->i_ino = inum; | ||
953 | } | ||
954 | insert_inode_hash(tmp_inode); | ||
955 | } | ||
956 | |||
957 | /* we pass in rc below, indicating whether it is a new inode, | 951 | /* we pass in rc below, indicating whether it is a new inode, |
958 | so we can figure out whether to invalidate the inode cached | 952 | so we can figure out whether to invalidate the inode cached |
959 | data if the file has changed */ | 953 | data if the file has changed */ |
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 5f22de7b79a9..5c68b4282be9 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -34,15 +34,99 @@ | |||
34 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, | 34 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, |
35 | unsigned char *p24); | 35 | unsigned char *p24); |
36 | 36 | ||
37 | /* Checks if this is the first smb session to be reconnected after | ||
38 | the socket has been reestablished (so we know whether to use vc 0). | ||
39 | Called while holding the cifs_tcp_ses_lock, so do not block */ | ||
40 | static bool is_first_ses_reconnect(struct cifsSesInfo *ses) | ||
41 | { | ||
42 | struct list_head *tmp; | ||
43 | struct cifsSesInfo *tmp_ses; | ||
44 | |||
45 | list_for_each(tmp, &ses->server->smb_ses_list) { | ||
46 | tmp_ses = list_entry(tmp, struct cifsSesInfo, | ||
47 | smb_ses_list); | ||
48 | if (tmp_ses->need_reconnect == false) | ||
49 | return false; | ||
50 | } | ||
51 | /* could not find a session that was already connected, | ||
52 | this must be the first one we are reconnecting */ | ||
53 | return true; | ||
54 | } | ||
55 | |||
56 | /* | ||
57 | * vc number 0 is treated specially by some servers, and should be the | ||
58 | * first one we request. After that we can use vcnumbers up to maxvcs, | ||
59 | * one for each smb session (some Windows versions set maxvcs incorrectly | ||
60 | * so maxvc=1 can be ignored). If we have too many vcs, we can reuse | ||
61 | * any vc but zero (some servers reset the connection on vcnum zero) | ||
62 | * | ||
63 | */ | ||
64 | static __le16 get_next_vcnum(struct cifsSesInfo *ses) | ||
65 | { | ||
66 | __u16 vcnum = 0; | ||
67 | struct list_head *tmp; | ||
68 | struct cifsSesInfo *tmp_ses; | ||
69 | __u16 max_vcs = ses->server->max_vcs; | ||
70 | __u16 i; | ||
71 | int free_vc_found = 0; | ||
72 | |||
73 | /* Quoting the MS-SMB specification: "Windows-based SMB servers set this | ||
74 | field to one but do not enforce this limit, which allows an SMB client | ||
75 | to establish more virtual circuits than allowed by this value ... but | ||
76 | other server implementations can enforce this limit." */ | ||
77 | if (max_vcs < 2) | ||
78 | max_vcs = 0xFFFF; | ||
79 | |||
80 | write_lock(&cifs_tcp_ses_lock); | ||
81 | if ((ses->need_reconnect) && is_first_ses_reconnect(ses)) | ||
82 | goto get_vc_num_exit; /* vcnum will be zero */ | ||
83 | for (i = ses->server->srv_count - 1; i < max_vcs; i++) { | ||
84 | if (i == 0) /* this is the only connection, use vc 0 */ | ||
85 | break; | ||
86 | |||
87 | free_vc_found = 1; | ||
88 | |||
89 | list_for_each(tmp, &ses->server->smb_ses_list) { | ||
90 | tmp_ses = list_entry(tmp, struct cifsSesInfo, | ||
91 | smb_ses_list); | ||
92 | if (tmp_ses->vcnum == i) { | ||
93 | free_vc_found = 0; | ||
94 | break; /* found duplicate, try next vcnum */ | ||
95 | } | ||
96 | } | ||
97 | if (free_vc_found) | ||
98 | break; /* we found a vcnumber that will work - use it */ | ||
99 | } | ||
100 | |||
101 | if (i == 0) | ||
102 | vcnum = 0; /* for most common case, ie if one smb session, use | ||
103 | vc zero. Also for case when no free vcnum, zero | ||
104 | is safest to send (some clients only send zero) */ | ||
105 | else if (free_vc_found == 0) | ||
106 | vcnum = 1; /* we can not reuse vc=0 safely, since some servers | ||
107 | reset all uids on that, but 1 is ok. */ | ||
108 | else | ||
109 | vcnum = i; | ||
110 | ses->vcnum = vcnum; | ||
111 | get_vc_num_exit: | ||
112 | write_unlock(&cifs_tcp_ses_lock); | ||
113 | |||
114 | return le16_to_cpu(vcnum); | ||
115 | } | ||
116 | |||
37 | static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB) | 117 | static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB) |
38 | { | 118 | { |
39 | __u32 capabilities = 0; | 119 | __u32 capabilities = 0; |
40 | 120 | ||
41 | /* init fields common to all four types of SessSetup */ | 121 | /* init fields common to all four types of SessSetup */ |
42 | /* note that header is initialized to zero in header_assemble */ | 122 | /* Note that offsets for first seven fields in req struct are same */ |
123 | /* in CIFS Specs so does not matter which of 3 forms of struct */ | ||
124 | /* that we use in next few lines */ | ||
125 | /* Note that header is initialized to zero in header_assemble */ | ||
43 | pSMB->req.AndXCommand = 0xFF; | 126 | pSMB->req.AndXCommand = 0xFF; |
44 | pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf); | 127 | pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf); |
45 | pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq); | 128 | pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq); |
129 | pSMB->req.VcNumber = get_next_vcnum(ses); | ||
46 | 130 | ||
47 | /* Now no need to set SMBFLG_CASELESS or obsolete CANONICAL PATH */ | 131 | /* Now no need to set SMBFLG_CASELESS or obsolete CANONICAL PATH */ |
48 | 132 | ||
@@ -71,7 +155,6 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB) | |||
71 | if (ses->capabilities & CAP_UNIX) | 155 | if (ses->capabilities & CAP_UNIX) |
72 | capabilities |= CAP_UNIX; | 156 | capabilities |= CAP_UNIX; |
73 | 157 | ||
74 | /* BB check whether to init vcnum BB */ | ||
75 | return capabilities; | 158 | return capabilities; |
76 | } | 159 | } |
77 | 160 | ||
@@ -228,7 +311,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft, | |||
228 | 311 | ||
229 | kfree(ses->serverOS); | 312 | kfree(ses->serverOS); |
230 | /* UTF-8 string will not grow more than four times as big as UCS-16 */ | 313 | /* UTF-8 string will not grow more than four times as big as UCS-16 */ |
231 | ses->serverOS = kzalloc(4 * len, GFP_KERNEL); | 314 | ses->serverOS = kzalloc((4 * len) + 2 /* trailing null */, GFP_KERNEL); |
232 | if (ses->serverOS != NULL) | 315 | if (ses->serverOS != NULL) |
233 | cifs_strfromUCS_le(ses->serverOS, (__le16 *)data, len, nls_cp); | 316 | cifs_strfromUCS_le(ses->serverOS, (__le16 *)data, len, nls_cp); |
234 | data += 2 * (len + 1); | 317 | data += 2 * (len + 1); |
@@ -241,7 +324,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft, | |||
241 | return rc; | 324 | return rc; |
242 | 325 | ||
243 | kfree(ses->serverNOS); | 326 | kfree(ses->serverNOS); |
244 | ses->serverNOS = kzalloc(4 * len, GFP_KERNEL); /* BB this is wrong length FIXME BB */ | 327 | ses->serverNOS = kzalloc((4 * len) + 2 /* trailing null */, GFP_KERNEL); |
245 | if (ses->serverNOS != NULL) { | 328 | if (ses->serverNOS != NULL) { |
246 | cifs_strfromUCS_le(ses->serverNOS, (__le16 *)data, len, | 329 | cifs_strfromUCS_le(ses->serverNOS, (__le16 *)data, len, |
247 | nls_cp); | 330 | nls_cp); |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 9c6d815dd191..39bd4d38e889 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -1938,6 +1938,8 @@ ULONG_IOCTL(SET_BITMAP_FILE) | |||
1938 | /* Big K */ | 1938 | /* Big K */ |
1939 | COMPATIBLE_IOCTL(PIO_FONT) | 1939 | COMPATIBLE_IOCTL(PIO_FONT) |
1940 | COMPATIBLE_IOCTL(GIO_FONT) | 1940 | COMPATIBLE_IOCTL(GIO_FONT) |
1941 | COMPATIBLE_IOCTL(PIO_CMAP) | ||
1942 | COMPATIBLE_IOCTL(GIO_CMAP) | ||
1941 | ULONG_IOCTL(KDSIGACCEPT) | 1943 | ULONG_IOCTL(KDSIGACCEPT) |
1942 | COMPATIBLE_IOCTL(KDGETKEYCODE) | 1944 | COMPATIBLE_IOCTL(KDGETKEYCODE) |
1943 | COMPATIBLE_IOCTL(KDSETKEYCODE) | 1945 | COMPATIBLE_IOCTL(KDSETKEYCODE) |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index aafc9eba1c25..b0c87dce66a3 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -868,7 +868,7 @@ static inline unsigned ext4_rec_len_from_disk(__le16 dlen) | |||
868 | { | 868 | { |
869 | unsigned len = le16_to_cpu(dlen); | 869 | unsigned len = le16_to_cpu(dlen); |
870 | 870 | ||
871 | if (len == EXT4_MAX_REC_LEN) | 871 | if (len == EXT4_MAX_REC_LEN || len == 0) |
872 | return 1 << 16; | 872 | return 1 << 16; |
873 | return len; | 873 | return len; |
874 | } | 874 | } |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 03ba20be1329..cbd2ca99d113 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -47,8 +47,10 @@ | |||
47 | static inline int ext4_begin_ordered_truncate(struct inode *inode, | 47 | static inline int ext4_begin_ordered_truncate(struct inode *inode, |
48 | loff_t new_size) | 48 | loff_t new_size) |
49 | { | 49 | { |
50 | return jbd2_journal_begin_ordered_truncate(&EXT4_I(inode)->jinode, | 50 | return jbd2_journal_begin_ordered_truncate( |
51 | new_size); | 51 | EXT4_SB(inode->i_sb)->s_journal, |
52 | &EXT4_I(inode)->jinode, | ||
53 | new_size); | ||
52 | } | 54 | } |
53 | 55 | ||
54 | static void ext4_invalidatepage(struct page *page, unsigned long offset); | 56 | static void ext4_invalidatepage(struct page *page, unsigned long offset); |
@@ -2437,6 +2439,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2437 | int no_nrwrite_index_update; | 2439 | int no_nrwrite_index_update; |
2438 | int pages_written = 0; | 2440 | int pages_written = 0; |
2439 | long pages_skipped; | 2441 | long pages_skipped; |
2442 | int range_cyclic, cycled = 1, io_done = 0; | ||
2440 | int needed_blocks, ret = 0, nr_to_writebump = 0; | 2443 | int needed_blocks, ret = 0, nr_to_writebump = 0; |
2441 | struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb); | 2444 | struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb); |
2442 | 2445 | ||
@@ -2488,9 +2491,15 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2488 | if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) | 2491 | if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) |
2489 | range_whole = 1; | 2492 | range_whole = 1; |
2490 | 2493 | ||
2491 | if (wbc->range_cyclic) | 2494 | range_cyclic = wbc->range_cyclic; |
2495 | if (wbc->range_cyclic) { | ||
2492 | index = mapping->writeback_index; | 2496 | index = mapping->writeback_index; |
2493 | else | 2497 | if (index) |
2498 | cycled = 0; | ||
2499 | wbc->range_start = index << PAGE_CACHE_SHIFT; | ||
2500 | wbc->range_end = LLONG_MAX; | ||
2501 | wbc->range_cyclic = 0; | ||
2502 | } else | ||
2494 | index = wbc->range_start >> PAGE_CACHE_SHIFT; | 2503 | index = wbc->range_start >> PAGE_CACHE_SHIFT; |
2495 | 2504 | ||
2496 | mpd.wbc = wbc; | 2505 | mpd.wbc = wbc; |
@@ -2504,6 +2513,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2504 | wbc->no_nrwrite_index_update = 1; | 2513 | wbc->no_nrwrite_index_update = 1; |
2505 | pages_skipped = wbc->pages_skipped; | 2514 | pages_skipped = wbc->pages_skipped; |
2506 | 2515 | ||
2516 | retry: | ||
2507 | while (!ret && wbc->nr_to_write > 0) { | 2517 | while (!ret && wbc->nr_to_write > 0) { |
2508 | 2518 | ||
2509 | /* | 2519 | /* |
@@ -2546,6 +2556,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2546 | pages_written += mpd.pages_written; | 2556 | pages_written += mpd.pages_written; |
2547 | wbc->pages_skipped = pages_skipped; | 2557 | wbc->pages_skipped = pages_skipped; |
2548 | ret = 0; | 2558 | ret = 0; |
2559 | io_done = 1; | ||
2549 | } else if (wbc->nr_to_write) | 2560 | } else if (wbc->nr_to_write) |
2550 | /* | 2561 | /* |
2551 | * There is no more writeout needed | 2562 | * There is no more writeout needed |
@@ -2554,6 +2565,13 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2554 | */ | 2565 | */ |
2555 | break; | 2566 | break; |
2556 | } | 2567 | } |
2568 | if (!io_done && !cycled) { | ||
2569 | cycled = 1; | ||
2570 | index = 0; | ||
2571 | wbc->range_start = index << PAGE_CACHE_SHIFT; | ||
2572 | wbc->range_end = mapping->writeback_index - 1; | ||
2573 | goto retry; | ||
2574 | } | ||
2557 | if (pages_skipped != wbc->pages_skipped) | 2575 | if (pages_skipped != wbc->pages_skipped) |
2558 | printk(KERN_EMERG "This should not happen leaving %s " | 2576 | printk(KERN_EMERG "This should not happen leaving %s " |
2559 | "with nr_to_write = %ld ret = %d\n", | 2577 | "with nr_to_write = %ld ret = %d\n", |
@@ -2561,6 +2579,7 @@ static int ext4_da_writepages(struct address_space *mapping, | |||
2561 | 2579 | ||
2562 | /* Update index */ | 2580 | /* Update index */ |
2563 | index += pages_written; | 2581 | index += pages_written; |
2582 | wbc->range_cyclic = range_cyclic; | ||
2564 | if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) | 2583 | if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) |
2565 | /* | 2584 | /* |
2566 | * set the writeback_index so that range_cyclic | 2585 | * set the writeback_index so that range_cyclic |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index deba54f6cbed..4415beeb0b62 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -3693,6 +3693,8 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac) | |||
3693 | pa->pa_free = pa->pa_len; | 3693 | pa->pa_free = pa->pa_len; |
3694 | atomic_set(&pa->pa_count, 1); | 3694 | atomic_set(&pa->pa_count, 1); |
3695 | spin_lock_init(&pa->pa_lock); | 3695 | spin_lock_init(&pa->pa_lock); |
3696 | INIT_LIST_HEAD(&pa->pa_inode_list); | ||
3697 | INIT_LIST_HEAD(&pa->pa_group_list); | ||
3696 | pa->pa_deleted = 0; | 3698 | pa->pa_deleted = 0; |
3697 | pa->pa_linear = 0; | 3699 | pa->pa_linear = 0; |
3698 | 3700 | ||
@@ -3755,6 +3757,7 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac) | |||
3755 | atomic_set(&pa->pa_count, 1); | 3757 | atomic_set(&pa->pa_count, 1); |
3756 | spin_lock_init(&pa->pa_lock); | 3758 | spin_lock_init(&pa->pa_lock); |
3757 | INIT_LIST_HEAD(&pa->pa_inode_list); | 3759 | INIT_LIST_HEAD(&pa->pa_inode_list); |
3760 | INIT_LIST_HEAD(&pa->pa_group_list); | ||
3758 | pa->pa_deleted = 0; | 3761 | pa->pa_deleted = 0; |
3759 | pa->pa_linear = 1; | 3762 | pa->pa_linear = 1; |
3760 | 3763 | ||
@@ -4476,23 +4479,26 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac) | |||
4476 | pa->pa_free -= ac->ac_b_ex.fe_len; | 4479 | pa->pa_free -= ac->ac_b_ex.fe_len; |
4477 | pa->pa_len -= ac->ac_b_ex.fe_len; | 4480 | pa->pa_len -= ac->ac_b_ex.fe_len; |
4478 | spin_unlock(&pa->pa_lock); | 4481 | spin_unlock(&pa->pa_lock); |
4479 | /* | ||
4480 | * We want to add the pa to the right bucket. | ||
4481 | * Remove it from the list and while adding | ||
4482 | * make sure the list to which we are adding | ||
4483 | * doesn't grow big. | ||
4484 | */ | ||
4485 | if (likely(pa->pa_free)) { | ||
4486 | spin_lock(pa->pa_obj_lock); | ||
4487 | list_del_rcu(&pa->pa_inode_list); | ||
4488 | spin_unlock(pa->pa_obj_lock); | ||
4489 | ext4_mb_add_n_trim(ac); | ||
4490 | } | ||
4491 | } | 4482 | } |
4492 | ext4_mb_put_pa(ac, ac->ac_sb, pa); | ||
4493 | } | 4483 | } |
4494 | if (ac->alloc_semp) | 4484 | if (ac->alloc_semp) |
4495 | up_read(ac->alloc_semp); | 4485 | up_read(ac->alloc_semp); |
4486 | if (pa) { | ||
4487 | /* | ||
4488 | * We want to add the pa to the right bucket. | ||
4489 | * Remove it from the list and while adding | ||
4490 | * make sure the list to which we are adding | ||
4491 | * doesn't grow big. We need to release | ||
4492 | * alloc_semp before calling ext4_mb_add_n_trim() | ||
4493 | */ | ||
4494 | if (pa->pa_linear && likely(pa->pa_free)) { | ||
4495 | spin_lock(pa->pa_obj_lock); | ||
4496 | list_del_rcu(&pa->pa_inode_list); | ||
4497 | spin_unlock(pa->pa_obj_lock); | ||
4498 | ext4_mb_add_n_trim(ac); | ||
4499 | } | ||
4500 | ext4_mb_put_pa(ac, ac->ac_sb, pa); | ||
4501 | } | ||
4496 | if (ac->ac_bitmap_page) | 4502 | if (ac->ac_bitmap_page) |
4497 | page_cache_release(ac->ac_bitmap_page); | 4503 | page_cache_release(ac->ac_bitmap_page); |
4498 | if (ac->ac_buddy_page) | 4504 | if (ac->ac_buddy_page) |
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 734abca25e35..fe64d9f79852 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
@@ -481,7 +481,7 @@ int ext4_ext_migrate(struct inode *inode) | |||
481 | + 1); | 481 | + 1); |
482 | if (IS_ERR(handle)) { | 482 | if (IS_ERR(handle)) { |
483 | retval = PTR_ERR(handle); | 483 | retval = PTR_ERR(handle); |
484 | goto err_out; | 484 | return retval; |
485 | } | 485 | } |
486 | tmp_inode = ext4_new_inode(handle, | 486 | tmp_inode = ext4_new_inode(handle, |
487 | inode->i_sb->s_root->d_inode, | 487 | inode->i_sb->s_root->d_inode, |
@@ -489,8 +489,7 @@ int ext4_ext_migrate(struct inode *inode) | |||
489 | if (IS_ERR(tmp_inode)) { | 489 | if (IS_ERR(tmp_inode)) { |
490 | retval = -ENOMEM; | 490 | retval = -ENOMEM; |
491 | ext4_journal_stop(handle); | 491 | ext4_journal_stop(handle); |
492 | tmp_inode = NULL; | 492 | return retval; |
493 | goto err_out; | ||
494 | } | 493 | } |
495 | i_size_write(tmp_inode, i_size_read(inode)); | 494 | i_size_write(tmp_inode, i_size_read(inode)); |
496 | /* | 495 | /* |
@@ -618,8 +617,7 @@ err_out: | |||
618 | 617 | ||
619 | ext4_journal_stop(handle); | 618 | ext4_journal_stop(handle); |
620 | 619 | ||
621 | if (tmp_inode) | 620 | iput(tmp_inode); |
622 | iput(tmp_inode); | ||
623 | 621 | ||
624 | return retval; | 622 | return retval; |
625 | } | 623 | } |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index e5f06a5f045e..a5732c58f676 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3046,14 +3046,17 @@ static void ext4_write_super(struct super_block *sb) | |||
3046 | static int ext4_sync_fs(struct super_block *sb, int wait) | 3046 | static int ext4_sync_fs(struct super_block *sb, int wait) |
3047 | { | 3047 | { |
3048 | int ret = 0; | 3048 | int ret = 0; |
3049 | tid_t target; | ||
3049 | 3050 | ||
3050 | trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait); | 3051 | trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait); |
3051 | sb->s_dirt = 0; | 3052 | sb->s_dirt = 0; |
3052 | if (EXT4_SB(sb)->s_journal) { | 3053 | if (EXT4_SB(sb)->s_journal) { |
3053 | if (wait) | 3054 | if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, |
3054 | ret = ext4_force_commit(sb); | 3055 | &target)) { |
3055 | else | 3056 | if (wait) |
3056 | jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, NULL); | 3057 | jbd2_log_wait_commit(EXT4_SB(sb)->s_journal, |
3058 | target); | ||
3059 | } | ||
3057 | } else { | 3060 | } else { |
3058 | ext4_commit_super(sb, EXT4_SB(sb)->s_es, wait); | 3061 | ext4_commit_super(sb, EXT4_SB(sb)->s_es, wait); |
3059 | } | 3062 | } |
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index eb343008eded..58144102bf25 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -450,7 +450,7 @@ int __jbd2_log_space_left(journal_t *journal) | |||
450 | } | 450 | } |
451 | 451 | ||
452 | /* | 452 | /* |
453 | * Called under j_state_lock. Returns true if a transaction was started. | 453 | * Called under j_state_lock. Returns true if a transaction commit was started. |
454 | */ | 454 | */ |
455 | int __jbd2_log_start_commit(journal_t *journal, tid_t target) | 455 | int __jbd2_log_start_commit(journal_t *journal, tid_t target) |
456 | { | 456 | { |
@@ -518,7 +518,8 @@ int jbd2_journal_force_commit_nested(journal_t *journal) | |||
518 | 518 | ||
519 | /* | 519 | /* |
520 | * Start a commit of the current running transaction (if any). Returns true | 520 | * Start a commit of the current running transaction (if any). Returns true |
521 | * if a transaction was started, and fills its tid in at *ptid | 521 | * if a transaction is going to be committed (or is currently already |
522 | * committing), and fills its tid in at *ptid | ||
522 | */ | 523 | */ |
523 | int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid) | 524 | int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid) |
524 | { | 525 | { |
@@ -528,15 +529,19 @@ int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid) | |||
528 | if (journal->j_running_transaction) { | 529 | if (journal->j_running_transaction) { |
529 | tid_t tid = journal->j_running_transaction->t_tid; | 530 | tid_t tid = journal->j_running_transaction->t_tid; |
530 | 531 | ||
531 | ret = __jbd2_log_start_commit(journal, tid); | 532 | __jbd2_log_start_commit(journal, tid); |
532 | if (ret && ptid) | 533 | /* There's a running transaction and we've just made sure |
534 | * it's commit has been scheduled. */ | ||
535 | if (ptid) | ||
533 | *ptid = tid; | 536 | *ptid = tid; |
534 | } else if (journal->j_committing_transaction && ptid) { | 537 | ret = 1; |
538 | } else if (journal->j_committing_transaction) { | ||
535 | /* | 539 | /* |
536 | * If ext3_write_super() recently started a commit, then we | 540 | * If ext3_write_super() recently started a commit, then we |
537 | * have to wait for completion of that transaction | 541 | * have to wait for completion of that transaction |
538 | */ | 542 | */ |
539 | *ptid = journal->j_committing_transaction->t_tid; | 543 | if (ptid) |
544 | *ptid = journal->j_committing_transaction->t_tid; | ||
540 | ret = 1; | 545 | ret = 1; |
541 | } | 546 | } |
542 | spin_unlock(&journal->j_state_lock); | 547 | spin_unlock(&journal->j_state_lock); |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 46b4e347ed7d..28ce21d8598e 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -2129,26 +2129,46 @@ done: | |||
2129 | } | 2129 | } |
2130 | 2130 | ||
2131 | /* | 2131 | /* |
2132 | * This function must be called when inode is journaled in ordered mode | 2132 | * File truncate and transaction commit interact with each other in a |
2133 | * before truncation happens. It starts writeout of truncated part in | 2133 | * non-trivial way. If a transaction writing data block A is |
2134 | * case it is in the committing transaction so that we stand to ordered | 2134 | * committing, we cannot discard the data by truncate until we have |
2135 | * mode consistency guarantees. | 2135 | * written them. Otherwise if we crashed after the transaction with |
2136 | * write has committed but before the transaction with truncate has | ||
2137 | * committed, we could see stale data in block A. This function is a | ||
2138 | * helper to solve this problem. It starts writeout of the truncated | ||
2139 | * part in case it is in the committing transaction. | ||
2140 | * | ||
2141 | * Filesystem code must call this function when inode is journaled in | ||
2142 | * ordered mode before truncation happens and after the inode has been | ||
2143 | * placed on orphan list with the new inode size. The second condition | ||
2144 | * avoids the race that someone writes new data and we start | ||
2145 | * committing the transaction after this function has been called but | ||
2146 | * before a transaction for truncate is started (and furthermore it | ||
2147 | * allows us to optimize the case where the addition to orphan list | ||
2148 | * happens in the same transaction as write --- we don't have to write | ||
2149 | * any data in such case). | ||
2136 | */ | 2150 | */ |
2137 | int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, | 2151 | int jbd2_journal_begin_ordered_truncate(journal_t *journal, |
2152 | struct jbd2_inode *jinode, | ||
2138 | loff_t new_size) | 2153 | loff_t new_size) |
2139 | { | 2154 | { |
2140 | journal_t *journal; | 2155 | transaction_t *inode_trans, *commit_trans; |
2141 | transaction_t *commit_trans; | ||
2142 | int ret = 0; | 2156 | int ret = 0; |
2143 | 2157 | ||
2144 | if (!inode->i_transaction && !inode->i_next_transaction) | 2158 | /* This is a quick check to avoid locking if not necessary */ |
2159 | if (!jinode->i_transaction) | ||
2145 | goto out; | 2160 | goto out; |
2146 | journal = inode->i_transaction->t_journal; | 2161 | /* Locks are here just to force reading of recent values, it is |
2162 | * enough that the transaction was not committing before we started | ||
2163 | * a transaction adding the inode to orphan list */ | ||
2147 | spin_lock(&journal->j_state_lock); | 2164 | spin_lock(&journal->j_state_lock); |
2148 | commit_trans = journal->j_committing_transaction; | 2165 | commit_trans = journal->j_committing_transaction; |
2149 | spin_unlock(&journal->j_state_lock); | 2166 | spin_unlock(&journal->j_state_lock); |
2150 | if (inode->i_transaction == commit_trans) { | 2167 | spin_lock(&journal->j_list_lock); |
2151 | ret = filemap_fdatawrite_range(inode->i_vfs_inode->i_mapping, | 2168 | inode_trans = jinode->i_transaction; |
2169 | spin_unlock(&journal->j_list_lock); | ||
2170 | if (inode_trans == commit_trans) { | ||
2171 | ret = filemap_fdatawrite_range(jinode->i_vfs_inode->i_mapping, | ||
2152 | new_size, LLONG_MAX); | 2172 | new_size, LLONG_MAX); |
2153 | if (ret) | 2173 | if (ret) |
2154 | jbd2_journal_abort(journal, ret); | 2174 | jbd2_journal_abort(journal, ret); |
diff --git a/fs/namespace.c b/fs/namespace.c index 228d8c4bfd18..06f8e63f6cb1 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -614,9 +614,11 @@ static inline void __mntput(struct vfsmount *mnt) | |||
614 | */ | 614 | */ |
615 | for_each_possible_cpu(cpu) { | 615 | for_each_possible_cpu(cpu) { |
616 | struct mnt_writer *cpu_writer = &per_cpu(mnt_writers, cpu); | 616 | struct mnt_writer *cpu_writer = &per_cpu(mnt_writers, cpu); |
617 | if (cpu_writer->mnt != mnt) | ||
618 | continue; | ||
619 | spin_lock(&cpu_writer->lock); | 617 | spin_lock(&cpu_writer->lock); |
618 | if (cpu_writer->mnt != mnt) { | ||
619 | spin_unlock(&cpu_writer->lock); | ||
620 | continue; | ||
621 | } | ||
620 | atomic_add(cpu_writer->count, &mnt->__mnt_writers); | 622 | atomic_add(cpu_writer->count, &mnt->__mnt_writers); |
621 | cpu_writer->count = 0; | 623 | cpu_writer->count = 0; |
622 | /* | 624 | /* |
diff --git a/fs/notify/inotify/inotify.c b/fs/notify/inotify/inotify.c index dae3f28f30d4..331f2e88e284 100644 --- a/fs/notify/inotify/inotify.c +++ b/fs/notify/inotify/inotify.c | |||
@@ -156,7 +156,7 @@ static int inotify_handle_get_wd(struct inotify_handle *ih, | |||
156 | int ret; | 156 | int ret; |
157 | 157 | ||
158 | do { | 158 | do { |
159 | if (unlikely(!idr_pre_get(&ih->idr, GFP_KERNEL))) | 159 | if (unlikely(!idr_pre_get(&ih->idr, GFP_NOFS))) |
160 | return -ENOSPC; | 160 | return -ENOSPC; |
161 | ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd); | 161 | ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd); |
162 | } while (ret == -EAGAIN); | 162 | } while (ret == -EAGAIN); |
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 3c3532e1307c..172850a9a12a 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -513,8 +513,10 @@ static inline int ocfs2_jbd2_file_inode(handle_t *handle, struct inode *inode) | |||
513 | static inline int ocfs2_begin_ordered_truncate(struct inode *inode, | 513 | static inline int ocfs2_begin_ordered_truncate(struct inode *inode, |
514 | loff_t new_size) | 514 | loff_t new_size) |
515 | { | 515 | { |
516 | return jbd2_journal_begin_ordered_truncate(&OCFS2_I(inode)->ip_jinode, | 516 | return jbd2_journal_begin_ordered_truncate( |
517 | new_size); | 517 | OCFS2_SB(inode->i_sb)->journal->j_journal, |
518 | &OCFS2_I(inode)->ip_jinode, | ||
519 | new_size); | ||
518 | } | 520 | } |
519 | 521 | ||
520 | #endif /* OCFS2_JOURNAL_H */ | 522 | #endif /* OCFS2_JOURNAL_H */ |
diff --git a/fs/seq_file.c b/fs/seq_file.c index 5267098532bf..a1a4cfe19210 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
@@ -48,8 +48,16 @@ int seq_open(struct file *file, const struct seq_operations *op) | |||
48 | */ | 48 | */ |
49 | file->f_version = 0; | 49 | file->f_version = 0; |
50 | 50 | ||
51 | /* SEQ files support lseek, but not pread/pwrite */ | 51 | /* |
52 | file->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE); | 52 | * seq_files support lseek() and pread(). They do not implement |
53 | * write() at all, but we clear FMODE_PWRITE here for historical | ||
54 | * reasons. | ||
55 | * | ||
56 | * If a client of seq_files a) implements file.write() and b) wishes to | ||
57 | * support pwrite() then that client will need to implement its own | ||
58 | * file.open() which calls seq_open() and then sets FMODE_PWRITE. | ||
59 | */ | ||
60 | file->f_mode &= ~FMODE_PWRITE; | ||
53 | return 0; | 61 | return 0; |
54 | } | 62 | } |
55 | EXPORT_SYMBOL(seq_open); | 63 | EXPORT_SYMBOL(seq_open); |
@@ -131,6 +139,22 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | |||
131 | int err = 0; | 139 | int err = 0; |
132 | 140 | ||
133 | mutex_lock(&m->lock); | 141 | mutex_lock(&m->lock); |
142 | |||
143 | /* Don't assume *ppos is where we left it */ | ||
144 | if (unlikely(*ppos != m->read_pos)) { | ||
145 | m->read_pos = *ppos; | ||
146 | while ((err = traverse(m, *ppos)) == -EAGAIN) | ||
147 | ; | ||
148 | if (err) { | ||
149 | /* With prejudice... */ | ||
150 | m->read_pos = 0; | ||
151 | m->version = 0; | ||
152 | m->index = 0; | ||
153 | m->count = 0; | ||
154 | goto Done; | ||
155 | } | ||
156 | } | ||
157 | |||
134 | /* | 158 | /* |
135 | * seq_file->op->..m_start/m_stop/m_next may do special actions | 159 | * seq_file->op->..m_start/m_stop/m_next may do special actions |
136 | * or optimisations based on the file->f_version, so we want to | 160 | * or optimisations based on the file->f_version, so we want to |
@@ -230,8 +254,10 @@ Fill: | |||
230 | Done: | 254 | Done: |
231 | if (!copied) | 255 | if (!copied) |
232 | copied = err; | 256 | copied = err; |
233 | else | 257 | else { |
234 | *ppos += copied; | 258 | *ppos += copied; |
259 | m->read_pos += copied; | ||
260 | } | ||
235 | file->f_version = m->version; | 261 | file->f_version = m->version; |
236 | mutex_unlock(&m->lock); | 262 | mutex_unlock(&m->lock); |
237 | return copied; | 263 | return copied; |
@@ -266,16 +292,18 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin) | |||
266 | if (offset < 0) | 292 | if (offset < 0) |
267 | break; | 293 | break; |
268 | retval = offset; | 294 | retval = offset; |
269 | if (offset != file->f_pos) { | 295 | if (offset != m->read_pos) { |
270 | while ((retval=traverse(m, offset)) == -EAGAIN) | 296 | while ((retval=traverse(m, offset)) == -EAGAIN) |
271 | ; | 297 | ; |
272 | if (retval) { | 298 | if (retval) { |
273 | /* with extreme prejudice... */ | 299 | /* with extreme prejudice... */ |
274 | file->f_pos = 0; | 300 | file->f_pos = 0; |
301 | m->read_pos = 0; | ||
275 | m->version = 0; | 302 | m->version = 0; |
276 | m->index = 0; | 303 | m->index = 0; |
277 | m->count = 0; | 304 | m->count = 0; |
278 | } else { | 305 | } else { |
306 | m->read_pos = offset; | ||
279 | retval = file->f_pos = offset; | 307 | retval = file->f_pos = offset; |
280 | } | 308 | } |
281 | } | 309 | } |
diff --git a/fs/super.c b/fs/super.c index 61dce001dd57..8349ed6b1412 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -82,7 +82,22 @@ static struct super_block *alloc_super(struct file_system_type *type) | |||
82 | * lock ordering than usbfs: | 82 | * lock ordering than usbfs: |
83 | */ | 83 | */ |
84 | lockdep_set_class(&s->s_lock, &type->s_lock_key); | 84 | lockdep_set_class(&s->s_lock, &type->s_lock_key); |
85 | down_write(&s->s_umount); | 85 | /* |
86 | * sget() can have s_umount recursion. | ||
87 | * | ||
88 | * When it cannot find a suitable sb, it allocates a new | ||
89 | * one (this one), and tries again to find a suitable old | ||
90 | * one. | ||
91 | * | ||
92 | * In case that succeeds, it will acquire the s_umount | ||
93 | * lock of the old one. Since these are clearly distrinct | ||
94 | * locks, and this object isn't exposed yet, there's no | ||
95 | * risk of deadlocks. | ||
96 | * | ||
97 | * Annotate this by putting this lock in a different | ||
98 | * subclass. | ||
99 | */ | ||
100 | down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING); | ||
86 | s->s_count = S_BIAS; | 101 | s->s_count = S_BIAS; |
87 | atomic_set(&s->s_active, 1); | 102 | atomic_set(&s->s_active, 1); |
88 | mutex_init(&s->s_vfs_rename_mutex); | 103 | mutex_init(&s->s_vfs_rename_mutex); |
diff --git a/fs/timerfd.c b/fs/timerfd.c index 6a123b8ff3f5..b042bd7034b1 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c | |||
@@ -186,10 +186,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) | |||
186 | BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); | 186 | BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); |
187 | BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); | 187 | BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); |
188 | 188 | ||
189 | if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) | 189 | if ((flags & ~TFD_CREATE_FLAGS) || |
190 | return -EINVAL; | 190 | (clockid != CLOCK_MONOTONIC && |
191 | if (clockid != CLOCK_MONOTONIC && | 191 | clockid != CLOCK_REALTIME)) |
192 | clockid != CLOCK_REALTIME) | ||
193 | return -EINVAL; | 192 | return -EINVAL; |
194 | 193 | ||
195 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); | 194 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); |
@@ -201,7 +200,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) | |||
201 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); | 200 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); |
202 | 201 | ||
203 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, | 202 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, |
204 | flags & (O_CLOEXEC | O_NONBLOCK)); | 203 | flags & TFD_SHARED_FCNTL_FLAGS); |
205 | if (ufd < 0) | 204 | if (ufd < 0) |
206 | kfree(ctx); | 205 | kfree(ctx); |
207 | 206 | ||
@@ -219,7 +218,8 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, | |||
219 | if (copy_from_user(&ktmr, utmr, sizeof(ktmr))) | 218 | if (copy_from_user(&ktmr, utmr, sizeof(ktmr))) |
220 | return -EFAULT; | 219 | return -EFAULT; |
221 | 220 | ||
222 | if (!timespec_valid(&ktmr.it_value) || | 221 | if ((flags & ~TFD_SETTIME_FLAGS) || |
222 | !timespec_valid(&ktmr.it_value) || | ||
223 | !timespec_valid(&ktmr.it_interval)) | 223 | !timespec_valid(&ktmr.it_interval)) |
224 | return -EINVAL; | 224 | return -EINVAL; |
225 | 225 | ||
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index d71dc44e21ed..cb329edc925b 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -166,6 +166,75 @@ test_page_region( | |||
166 | } | 166 | } |
167 | 167 | ||
168 | /* | 168 | /* |
169 | * Mapping of multi-page buffers into contiguous virtual space | ||
170 | */ | ||
171 | |||
172 | typedef struct a_list { | ||
173 | void *vm_addr; | ||
174 | struct a_list *next; | ||
175 | } a_list_t; | ||
176 | |||
177 | static a_list_t *as_free_head; | ||
178 | static int as_list_len; | ||
179 | static DEFINE_SPINLOCK(as_lock); | ||
180 | |||
181 | /* | ||
182 | * Try to batch vunmaps because they are costly. | ||
183 | */ | ||
184 | STATIC void | ||
185 | free_address( | ||
186 | void *addr) | ||
187 | { | ||
188 | a_list_t *aentry; | ||
189 | |||
190 | #ifdef CONFIG_XEN | ||
191 | /* | ||
192 | * Xen needs to be able to make sure it can get an exclusive | ||
193 | * RO mapping of pages it wants to turn into a pagetable. If | ||
194 | * a newly allocated page is also still being vmap()ed by xfs, | ||
195 | * it will cause pagetable construction to fail. This is a | ||
196 | * quick workaround to always eagerly unmap pages so that Xen | ||
197 | * is happy. | ||
198 | */ | ||
199 | vunmap(addr); | ||
200 | return; | ||
201 | #endif | ||
202 | |||
203 | aentry = kmalloc(sizeof(a_list_t), GFP_NOWAIT); | ||
204 | if (likely(aentry)) { | ||
205 | spin_lock(&as_lock); | ||
206 | aentry->next = as_free_head; | ||
207 | aentry->vm_addr = addr; | ||
208 | as_free_head = aentry; | ||
209 | as_list_len++; | ||
210 | spin_unlock(&as_lock); | ||
211 | } else { | ||
212 | vunmap(addr); | ||
213 | } | ||
214 | } | ||
215 | |||
216 | STATIC void | ||
217 | purge_addresses(void) | ||
218 | { | ||
219 | a_list_t *aentry, *old; | ||
220 | |||
221 | if (as_free_head == NULL) | ||
222 | return; | ||
223 | |||
224 | spin_lock(&as_lock); | ||
225 | aentry = as_free_head; | ||
226 | as_free_head = NULL; | ||
227 | as_list_len = 0; | ||
228 | spin_unlock(&as_lock); | ||
229 | |||
230 | while ((old = aentry) != NULL) { | ||
231 | vunmap(aentry->vm_addr); | ||
232 | aentry = aentry->next; | ||
233 | kfree(old); | ||
234 | } | ||
235 | } | ||
236 | |||
237 | /* | ||
169 | * Internal xfs_buf_t object manipulation | 238 | * Internal xfs_buf_t object manipulation |
170 | */ | 239 | */ |
171 | 240 | ||
@@ -264,7 +333,7 @@ xfs_buf_free( | |||
264 | uint i; | 333 | uint i; |
265 | 334 | ||
266 | if ((bp->b_flags & XBF_MAPPED) && (bp->b_page_count > 1)) | 335 | if ((bp->b_flags & XBF_MAPPED) && (bp->b_page_count > 1)) |
267 | vm_unmap_ram(bp->b_addr - bp->b_offset, bp->b_page_count); | 336 | free_address(bp->b_addr - bp->b_offset); |
268 | 337 | ||
269 | for (i = 0; i < bp->b_page_count; i++) { | 338 | for (i = 0; i < bp->b_page_count; i++) { |
270 | struct page *page = bp->b_pages[i]; | 339 | struct page *page = bp->b_pages[i]; |
@@ -386,8 +455,10 @@ _xfs_buf_map_pages( | |||
386 | bp->b_addr = page_address(bp->b_pages[0]) + bp->b_offset; | 455 | bp->b_addr = page_address(bp->b_pages[0]) + bp->b_offset; |
387 | bp->b_flags |= XBF_MAPPED; | 456 | bp->b_flags |= XBF_MAPPED; |
388 | } else if (flags & XBF_MAPPED) { | 457 | } else if (flags & XBF_MAPPED) { |
389 | bp->b_addr = vm_map_ram(bp->b_pages, bp->b_page_count, | 458 | if (as_list_len > 64) |
390 | -1, PAGE_KERNEL); | 459 | purge_addresses(); |
460 | bp->b_addr = vmap(bp->b_pages, bp->b_page_count, | ||
461 | VM_MAP, PAGE_KERNEL); | ||
391 | if (unlikely(bp->b_addr == NULL)) | 462 | if (unlikely(bp->b_addr == NULL)) |
392 | return -ENOMEM; | 463 | return -ENOMEM; |
393 | bp->b_addr += bp->b_offset; | 464 | bp->b_addr += bp->b_offset; |
@@ -1672,6 +1743,8 @@ xfsbufd( | |||
1672 | count++; | 1743 | count++; |
1673 | } | 1744 | } |
1674 | 1745 | ||
1746 | if (as_list_len > 0) | ||
1747 | purge_addresses(); | ||
1675 | if (count) | 1748 | if (count) |
1676 | blk_run_address_space(target->bt_mapping); | 1749 | blk_run_address_space(target->bt_mapping); |
1677 | 1750 | ||
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h index 83c51aba534b..e16fdb1f4f4f 100644 --- a/include/asm-frv/pgtable.h +++ b/include/asm-frv/pgtable.h | |||
@@ -478,7 +478,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
478 | #define __swp_type(x) (((x).val >> 2) & 0x1f) | 478 | #define __swp_type(x) (((x).val >> 2) & 0x1f) |
479 | #define __swp_offset(x) ((x).val >> 8) | 479 | #define __swp_offset(x) ((x).val >> 8) |
480 | #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 8) }) | 480 | #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 8) }) |
481 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte }) | 481 | #define __pte_to_swp_entry(_pte) ((swp_entry_t) { (_pte).pte }) |
482 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | 482 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) |
483 | 483 | ||
484 | static inline int pte_file(pte_t pte) | 484 | static inline int pte_file(pte_t pte) |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 8190b9bcc2d9..e5f4ae989abf 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1321,6 +1321,8 @@ void drm_gem_object_free(struct kref *kref); | |||
1321 | struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, | 1321 | struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, |
1322 | size_t size); | 1322 | size_t size); |
1323 | void drm_gem_object_handle_free(struct kref *kref); | 1323 | void drm_gem_object_handle_free(struct kref *kref); |
1324 | void drm_gem_vm_open(struct vm_area_struct *vma); | ||
1325 | void drm_gem_vm_close(struct vm_area_struct *vma); | ||
1324 | int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); | 1326 | int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); |
1325 | 1327 | ||
1326 | static inline void | 1328 | static inline void |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index d54de24bf371..5ded1acfb543 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -609,7 +609,7 @@ extern char *drm_get_dvi_i_subconnector_name(int val); | |||
609 | extern char *drm_get_dvi_i_select_name(int val); | 609 | extern char *drm_get_dvi_i_select_name(int val); |
610 | extern char *drm_get_tv_subconnector_name(int val); | 610 | extern char *drm_get_tv_subconnector_name(int val); |
611 | extern char *drm_get_tv_select_name(int val); | 611 | extern char *drm_get_tv_select_name(int val); |
612 | extern void drm_fb_release(struct file *filp); | 612 | extern void drm_fb_release(struct drm_file *file_priv); |
613 | extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); | 613 | extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); |
614 | extern struct edid *drm_get_edid(struct drm_connector *connector, | 614 | extern struct edid *drm_get_edid(struct drm_connector *connector, |
615 | struct i2c_adapter *adapter); | 615 | struct i2c_adapter *adapter); |
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index 0c6f0e11b41b..0b0d236c2154 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h | |||
@@ -54,13 +54,13 @@ struct drm_crtc_helper_funcs { | |||
54 | struct drm_display_mode *mode, | 54 | struct drm_display_mode *mode, |
55 | struct drm_display_mode *adjusted_mode); | 55 | struct drm_display_mode *adjusted_mode); |
56 | /* Actually set the mode */ | 56 | /* Actually set the mode */ |
57 | void (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode, | 57 | int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode, |
58 | struct drm_display_mode *adjusted_mode, int x, int y, | 58 | struct drm_display_mode *adjusted_mode, int x, int y, |
59 | struct drm_framebuffer *old_fb); | 59 | struct drm_framebuffer *old_fb); |
60 | 60 | ||
61 | /* Move the crtc on the current fb to the given position *optional* */ | 61 | /* Move the crtc on the current fb to the given position *optional* */ |
62 | void (*mode_set_base)(struct drm_crtc *crtc, int x, int y, | 62 | int (*mode_set_base)(struct drm_crtc *crtc, int x, int y, |
63 | struct drm_framebuffer *old_fb); | 63 | struct drm_framebuffer *old_fb); |
64 | }; | 64 | }; |
65 | 65 | ||
66 | struct drm_encoder_helper_funcs { | 66 | struct drm_encoder_helper_funcs { |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 2aa283ab062b..1b16108a5417 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -171,8 +171,6 @@ struct bio { | |||
171 | #define BIO_RW_FAILFAST_TRANSPORT 8 | 171 | #define BIO_RW_FAILFAST_TRANSPORT 8 |
172 | #define BIO_RW_FAILFAST_DRIVER 9 | 172 | #define BIO_RW_FAILFAST_DRIVER 9 |
173 | 173 | ||
174 | #define BIO_RW_SYNC (BIO_RW_SYNCIO | BIO_RW_UNPLUG) | ||
175 | |||
176 | #define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) | 174 | #define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) |
177 | 175 | ||
178 | /* | 176 | /* |
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 25379cba2370..6e915878e88c 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -15,6 +15,7 @@ enum blktrace_cat { | |||
15 | BLK_TC_WRITE = 1 << 1, /* writes */ | 15 | BLK_TC_WRITE = 1 << 1, /* writes */ |
16 | BLK_TC_BARRIER = 1 << 2, /* barrier */ | 16 | BLK_TC_BARRIER = 1 << 2, /* barrier */ |
17 | BLK_TC_SYNC = 1 << 3, /* sync IO */ | 17 | BLK_TC_SYNC = 1 << 3, /* sync IO */ |
18 | BLK_TC_SYNCIO = BLK_TC_SYNC, | ||
18 | BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ | 19 | BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ |
19 | BLK_TC_REQUEUE = 1 << 5, /* requeueing */ | 20 | BLK_TC_REQUEUE = 1 << 5, /* requeueing */ |
20 | BLK_TC_ISSUE = 1 << 6, /* issue */ | 21 | BLK_TC_ISSUE = 1 << 6, /* issue */ |
diff --git a/include/linux/device.h b/include/linux/device.h index 45e5b1921fbb..47f343c7bdda 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -147,6 +147,8 @@ extern void put_driver(struct device_driver *drv); | |||
147 | extern struct device_driver *driver_find(const char *name, | 147 | extern struct device_driver *driver_find(const char *name, |
148 | struct bus_type *bus); | 148 | struct bus_type *bus); |
149 | extern int driver_probe_done(void); | 149 | extern int driver_probe_done(void); |
150 | extern int wait_for_device_probe(void); | ||
151 | |||
150 | 152 | ||
151 | /* sysfs interface for exporting driver attributes */ | 153 | /* sysfs interface for exporting driver attributes */ |
152 | 154 | ||
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 3e68469c1885..f0413845f20e 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -121,6 +121,7 @@ struct dma_chan_percpu { | |||
121 | * @local: per-cpu pointer to a struct dma_chan_percpu | 121 | * @local: per-cpu pointer to a struct dma_chan_percpu |
122 | * @client-count: how many clients are using this channel | 122 | * @client-count: how many clients are using this channel |
123 | * @table_count: number of appearances in the mem-to-mem allocation table | 123 | * @table_count: number of appearances in the mem-to-mem allocation table |
124 | * @private: private data for certain client-channel associations | ||
124 | */ | 125 | */ |
125 | struct dma_chan { | 126 | struct dma_chan { |
126 | struct dma_device *device; | 127 | struct dma_device *device; |
@@ -134,6 +135,7 @@ struct dma_chan { | |||
134 | struct dma_chan_percpu *local; | 135 | struct dma_chan_percpu *local; |
135 | int client_count; | 136 | int client_count; |
136 | int table_count; | 137 | int table_count; |
138 | void *private; | ||
137 | }; | 139 | }; |
138 | 140 | ||
139 | /** | 141 | /** |
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h index 6e199c8dfacc..cca686b39123 100644 --- a/include/linux/firmware-map.h +++ b/include/linux/firmware-map.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * include/linux/firmware-map.h: | 2 | * include/linux/firmware-map.h: |
3 | * Copyright (C) 2008 SUSE LINUX Products GmbH | 3 | * Copyright (C) 2008 SUSE LINUX Products GmbH |
4 | * by Bernhard Walle <bwalle@suse.de> | 4 | * by Bernhard Walle <bernhard.walle@gmx.de> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License v2.0 as published by | 7 | * it under the terms of the GNU General Public License v2.0 as published by |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 6022f44043f2..92734c0012e6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -54,24 +54,30 @@ struct inodes_stat_t { | |||
54 | #define MAY_ACCESS 16 | 54 | #define MAY_ACCESS 16 |
55 | #define MAY_OPEN 32 | 55 | #define MAY_OPEN 32 |
56 | 56 | ||
57 | /* | ||
58 | * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond | ||
59 | * to O_WRONLY and O_RDWR via the strange trick in __dentry_open() | ||
60 | */ | ||
61 | |||
57 | /* file is open for reading */ | 62 | /* file is open for reading */ |
58 | #define FMODE_READ ((__force fmode_t)1) | 63 | #define FMODE_READ ((__force fmode_t)1) |
59 | /* file is open for writing */ | 64 | /* file is open for writing */ |
60 | #define FMODE_WRITE ((__force fmode_t)2) | 65 | #define FMODE_WRITE ((__force fmode_t)2) |
61 | /* file is seekable */ | 66 | /* file is seekable */ |
62 | #define FMODE_LSEEK ((__force fmode_t)4) | 67 | #define FMODE_LSEEK ((__force fmode_t)4) |
63 | /* file can be accessed using pread/pwrite */ | 68 | /* file can be accessed using pread */ |
64 | #define FMODE_PREAD ((__force fmode_t)8) | 69 | #define FMODE_PREAD ((__force fmode_t)8) |
65 | #define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ | 70 | /* file can be accessed using pwrite */ |
71 | #define FMODE_PWRITE ((__force fmode_t)16) | ||
66 | /* File is opened for execution with sys_execve / sys_uselib */ | 72 | /* File is opened for execution with sys_execve / sys_uselib */ |
67 | #define FMODE_EXEC ((__force fmode_t)16) | 73 | #define FMODE_EXEC ((__force fmode_t)32) |
68 | /* File is opened with O_NDELAY (only set for block devices) */ | 74 | /* File is opened with O_NDELAY (only set for block devices) */ |
69 | #define FMODE_NDELAY ((__force fmode_t)32) | 75 | #define FMODE_NDELAY ((__force fmode_t)64) |
70 | /* File is opened with O_EXCL (only set for block devices) */ | 76 | /* File is opened with O_EXCL (only set for block devices) */ |
71 | #define FMODE_EXCL ((__force fmode_t)64) | 77 | #define FMODE_EXCL ((__force fmode_t)128) |
72 | /* File is opened using open(.., 3, ..) and is writeable only for ioctls | 78 | /* File is opened using open(.., 3, ..) and is writeable only for ioctls |
73 | (specialy hack for floppy.c) */ | 79 | (specialy hack for floppy.c) */ |
74 | #define FMODE_WRITE_IOCTL ((__force fmode_t)128) | 80 | #define FMODE_WRITE_IOCTL ((__force fmode_t)256) |
75 | 81 | ||
76 | /* | 82 | /* |
77 | * Don't update ctime and mtime. | 83 | * Don't update ctime and mtime. |
@@ -87,10 +93,10 @@ struct inodes_stat_t { | |||
87 | #define WRITE 1 | 93 | #define WRITE 1 |
88 | #define READA 2 /* read-ahead - don't block if no resources */ | 94 | #define READA 2 /* read-ahead - don't block if no resources */ |
89 | #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ | 95 | #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ |
90 | #define READ_SYNC (READ | (1 << BIO_RW_SYNC)) | 96 | #define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) |
91 | #define READ_META (READ | (1 << BIO_RW_META)) | 97 | #define READ_META (READ | (1 << BIO_RW_META)) |
92 | #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) | 98 | #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) |
93 | #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC)) | 99 | #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) |
94 | #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) | 100 | #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) |
95 | #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) | 101 | #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) |
96 | #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) | 102 | #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) |
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index b28b37eb11c6..4d248b3f1323 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
@@ -1150,7 +1150,8 @@ extern int jbd2_journal_clear_err (journal_t *); | |||
1150 | extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); | 1150 | extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); |
1151 | extern int jbd2_journal_force_commit(journal_t *); | 1151 | extern int jbd2_journal_force_commit(journal_t *); |
1152 | extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode); | 1152 | extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode); |
1153 | extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size); | 1153 | extern int jbd2_journal_begin_ordered_truncate(journal_t *journal, |
1154 | struct jbd2_inode *inode, loff_t new_size); | ||
1154 | extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode); | 1155 | extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode); |
1155 | extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode); | 1156 | extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode); |
1156 | 1157 | ||
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 32851eef48f0..2ec6cc14a114 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -182,6 +182,14 @@ struct kprobe_blackpoint { | |||
182 | DECLARE_PER_CPU(struct kprobe *, current_kprobe); | 182 | DECLARE_PER_CPU(struct kprobe *, current_kprobe); |
183 | DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | 183 | DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); |
184 | 184 | ||
185 | /* | ||
186 | * For #ifdef avoidance: | ||
187 | */ | ||
188 | static inline int kprobes_built_in(void) | ||
189 | { | ||
190 | return 1; | ||
191 | } | ||
192 | |||
185 | #ifdef CONFIG_KRETPROBES | 193 | #ifdef CONFIG_KRETPROBES |
186 | extern void arch_prepare_kretprobe(struct kretprobe_instance *ri, | 194 | extern void arch_prepare_kretprobe(struct kretprobe_instance *ri, |
187 | struct pt_regs *regs); | 195 | struct pt_regs *regs); |
@@ -271,8 +279,16 @@ void unregister_kretprobes(struct kretprobe **rps, int num); | |||
271 | void kprobe_flush_task(struct task_struct *tk); | 279 | void kprobe_flush_task(struct task_struct *tk); |
272 | void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); | 280 | void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); |
273 | 281 | ||
274 | #else /* CONFIG_KPROBES */ | 282 | #else /* !CONFIG_KPROBES: */ |
275 | 283 | ||
284 | static inline int kprobes_built_in(void) | ||
285 | { | ||
286 | return 0; | ||
287 | } | ||
288 | static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) | ||
289 | { | ||
290 | return 0; | ||
291 | } | ||
276 | static inline struct kprobe *get_kprobe(void *addr) | 292 | static inline struct kprobe *get_kprobe(void *addr) |
277 | { | 293 | { |
278 | return NULL; | 294 | return NULL; |
@@ -329,5 +345,5 @@ static inline void unregister_kretprobes(struct kretprobe **rps, int num) | |||
329 | static inline void kprobe_flush_task(struct task_struct *tk) | 345 | static inline void kprobe_flush_task(struct task_struct *tk) |
330 | { | 346 | { |
331 | } | 347 | } |
332 | #endif /* CONFIG_KPROBES */ | 348 | #endif /* CONFIG_KPROBES */ |
333 | #endif /* _LINUX_KPROBES_H */ | 349 | #endif /* _LINUX_KPROBES_H */ |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 5715f1907601..0424326f1679 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -58,10 +58,10 @@ struct kvm_irqchip { | |||
58 | __u32 pad; | 58 | __u32 pad; |
59 | union { | 59 | union { |
60 | char dummy[512]; /* reserving space */ | 60 | char dummy[512]; /* reserving space */ |
61 | #ifdef CONFIG_X86 | 61 | #ifdef __KVM_HAVE_PIT |
62 | struct kvm_pic_state pic; | 62 | struct kvm_pic_state pic; |
63 | #endif | 63 | #endif |
64 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | 64 | #ifdef __KVM_HAVE_IOAPIC |
65 | struct kvm_ioapic_state ioapic; | 65 | struct kvm_ioapic_state ioapic; |
66 | #endif | 66 | #endif |
67 | } chip; | 67 | } chip; |
@@ -384,16 +384,16 @@ struct kvm_trace_rec { | |||
384 | #define KVM_CAP_MP_STATE 14 | 384 | #define KVM_CAP_MP_STATE 14 |
385 | #define KVM_CAP_COALESCED_MMIO 15 | 385 | #define KVM_CAP_COALESCED_MMIO 15 |
386 | #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ | 386 | #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ |
387 | #if defined(CONFIG_X86)||defined(CONFIG_IA64) | 387 | #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT |
388 | #define KVM_CAP_DEVICE_ASSIGNMENT 17 | 388 | #define KVM_CAP_DEVICE_ASSIGNMENT 17 |
389 | #endif | 389 | #endif |
390 | #define KVM_CAP_IOMMU 18 | 390 | #define KVM_CAP_IOMMU 18 |
391 | #if defined(CONFIG_X86) | 391 | #ifdef __KVM_HAVE_MSI |
392 | #define KVM_CAP_DEVICE_MSI 20 | 392 | #define KVM_CAP_DEVICE_MSI 20 |
393 | #endif | 393 | #endif |
394 | /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ | 394 | /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ |
395 | #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 | 395 | #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 |
396 | #if defined(CONFIG_X86) | 396 | #ifdef __KVM_HAVE_USER_NMI |
397 | #define KVM_CAP_USER_NMI 22 | 397 | #define KVM_CAP_USER_NMI 22 |
398 | #endif | 398 | #endif |
399 | 399 | ||
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index ec49d0be7f52..bf6f703642fc 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -285,6 +285,7 @@ void kvm_free_physmem(struct kvm *kvm); | |||
285 | struct kvm *kvm_arch_create_vm(void); | 285 | struct kvm *kvm_arch_create_vm(void); |
286 | void kvm_arch_destroy_vm(struct kvm *kvm); | 286 | void kvm_arch_destroy_vm(struct kvm *kvm); |
287 | void kvm_free_all_assigned_devices(struct kvm *kvm); | 287 | void kvm_free_all_assigned_devices(struct kvm *kvm); |
288 | void kvm_arch_sync_events(struct kvm *kvm); | ||
288 | 289 | ||
289 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); | 290 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); |
290 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); | 291 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 7dc04ff5ab89..065cdf8c09fb 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1041,10 +1041,23 @@ extern void free_bootmem_with_active_regions(int nid, | |||
1041 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); | 1041 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); |
1042 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); | 1042 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); |
1043 | extern void sparse_memory_present_with_active_regions(int nid); | 1043 | extern void sparse_memory_present_with_active_regions(int nid); |
1044 | #ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID | ||
1045 | extern int early_pfn_to_nid(unsigned long pfn); | ||
1046 | #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ | ||
1047 | #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ | 1044 | #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ |
1045 | |||
1046 | #if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \ | ||
1047 | !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) | ||
1048 | static inline int __early_pfn_to_nid(unsigned long pfn) | ||
1049 | { | ||
1050 | return 0; | ||
1051 | } | ||
1052 | #else | ||
1053 | /* please see mm/page_alloc.c */ | ||
1054 | extern int __meminit early_pfn_to_nid(unsigned long pfn); | ||
1055 | #ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID | ||
1056 | /* there is a per-arch backend function. */ | ||
1057 | extern int __meminit __early_pfn_to_nid(unsigned long pfn); | ||
1058 | #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ | ||
1059 | #endif | ||
1060 | |||
1048 | extern void set_dma_reserve(unsigned long new_dma_reserve); | 1061 | extern void set_dma_reserve(unsigned long new_dma_reserve); |
1049 | extern void memmap_init_zone(unsigned long, int, unsigned long, | 1062 | extern void memmap_init_zone(unsigned long, int, unsigned long, |
1050 | unsigned long, enum memmap_context); | 1063 | unsigned long, enum memmap_context); |
@@ -1159,6 +1172,7 @@ extern int filemap_fault(struct vm_area_struct *, struct vm_fault *); | |||
1159 | 1172 | ||
1160 | /* mm/page-writeback.c */ | 1173 | /* mm/page-writeback.c */ |
1161 | int write_one_page(struct page *page, int wait); | 1174 | int write_one_page(struct page *page, int wait); |
1175 | void task_dirty_inc(struct task_struct *tsk); | ||
1162 | 1176 | ||
1163 | /* readahead.c */ | 1177 | /* readahead.c */ |
1164 | #define VM_MAX_READAHEAD 128 /* kbytes */ | 1178 | #define VM_MAX_READAHEAD 128 /* kbytes */ |
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h index 139d7c88d9c9..3d1b7bde1283 100644 --- a/include/linux/mmiotrace.h +++ b/include/linux/mmiotrace.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef MMIOTRACE_H | 1 | #ifndef _LINUX_MMIOTRACE_H |
2 | #define MMIOTRACE_H | 2 | #define _LINUX_MMIOTRACE_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
@@ -13,28 +13,34 @@ typedef void (*kmmio_post_handler_t)(struct kmmio_probe *, | |||
13 | unsigned long condition, struct pt_regs *); | 13 | unsigned long condition, struct pt_regs *); |
14 | 14 | ||
15 | struct kmmio_probe { | 15 | struct kmmio_probe { |
16 | struct list_head list; /* kmmio internal list */ | 16 | /* kmmio internal list: */ |
17 | unsigned long addr; /* start location of the probe point */ | 17 | struct list_head list; |
18 | unsigned long len; /* length of the probe region */ | 18 | /* start location of the probe point: */ |
19 | kmmio_pre_handler_t pre_handler; /* Called before addr is executed. */ | 19 | unsigned long addr; |
20 | kmmio_post_handler_t post_handler; /* Called after addr is executed */ | 20 | /* length of the probe region: */ |
21 | void *private; | 21 | unsigned long len; |
22 | /* Called before addr is executed: */ | ||
23 | kmmio_pre_handler_t pre_handler; | ||
24 | /* Called after addr is executed: */ | ||
25 | kmmio_post_handler_t post_handler; | ||
26 | void *private; | ||
22 | }; | 27 | }; |
23 | 28 | ||
29 | extern unsigned int kmmio_count; | ||
30 | |||
31 | extern int register_kmmio_probe(struct kmmio_probe *p); | ||
32 | extern void unregister_kmmio_probe(struct kmmio_probe *p); | ||
33 | |||
34 | #ifdef CONFIG_MMIOTRACE | ||
24 | /* kmmio is active by some kmmio_probes? */ | 35 | /* kmmio is active by some kmmio_probes? */ |
25 | static inline int is_kmmio_active(void) | 36 | static inline int is_kmmio_active(void) |
26 | { | 37 | { |
27 | extern unsigned int kmmio_count; | ||
28 | return kmmio_count; | 38 | return kmmio_count; |
29 | } | 39 | } |
30 | 40 | ||
31 | extern int register_kmmio_probe(struct kmmio_probe *p); | ||
32 | extern void unregister_kmmio_probe(struct kmmio_probe *p); | ||
33 | |||
34 | /* Called from page fault handler. */ | 41 | /* Called from page fault handler. */ |
35 | extern int kmmio_handler(struct pt_regs *regs, unsigned long addr); | 42 | extern int kmmio_handler(struct pt_regs *regs, unsigned long addr); |
36 | 43 | ||
37 | #ifdef CONFIG_MMIOTRACE | ||
38 | /* Called from ioremap.c */ | 44 | /* Called from ioremap.c */ |
39 | extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, | 45 | extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, |
40 | void __iomem *addr); | 46 | void __iomem *addr); |
@@ -43,7 +49,17 @@ extern void mmiotrace_iounmap(volatile void __iomem *addr); | |||
43 | /* For anyone to insert markers. Remember trailing newline. */ | 49 | /* For anyone to insert markers. Remember trailing newline. */ |
44 | extern int mmiotrace_printk(const char *fmt, ...) | 50 | extern int mmiotrace_printk(const char *fmt, ...) |
45 | __attribute__ ((format (printf, 1, 2))); | 51 | __attribute__ ((format (printf, 1, 2))); |
46 | #else | 52 | #else /* !CONFIG_MMIOTRACE: */ |
53 | static inline int is_kmmio_active(void) | ||
54 | { | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static inline int kmmio_handler(struct pt_regs *regs, unsigned long addr) | ||
59 | { | ||
60 | return 0; | ||
61 | } | ||
62 | |||
47 | static inline void mmiotrace_ioremap(resource_size_t offset, | 63 | static inline void mmiotrace_ioremap(resource_size_t offset, |
48 | unsigned long size, void __iomem *addr) | 64 | unsigned long size, void __iomem *addr) |
49 | { | 65 | { |
@@ -63,28 +79,28 @@ static inline int mmiotrace_printk(const char *fmt, ...) | |||
63 | #endif /* CONFIG_MMIOTRACE */ | 79 | #endif /* CONFIG_MMIOTRACE */ |
64 | 80 | ||
65 | enum mm_io_opcode { | 81 | enum mm_io_opcode { |
66 | MMIO_READ = 0x1, /* struct mmiotrace_rw */ | 82 | MMIO_READ = 0x1, /* struct mmiotrace_rw */ |
67 | MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ | 83 | MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ |
68 | MMIO_PROBE = 0x3, /* struct mmiotrace_map */ | 84 | MMIO_PROBE = 0x3, /* struct mmiotrace_map */ |
69 | MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ | 85 | MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ |
70 | MMIO_UNKNOWN_OP = 0x5, /* struct mmiotrace_rw */ | 86 | MMIO_UNKNOWN_OP = 0x5, /* struct mmiotrace_rw */ |
71 | }; | 87 | }; |
72 | 88 | ||
73 | struct mmiotrace_rw { | 89 | struct mmiotrace_rw { |
74 | resource_size_t phys; /* PCI address of register */ | 90 | resource_size_t phys; /* PCI address of register */ |
75 | unsigned long value; | 91 | unsigned long value; |
76 | unsigned long pc; /* optional program counter */ | 92 | unsigned long pc; /* optional program counter */ |
77 | int map_id; | 93 | int map_id; |
78 | unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */ | 94 | unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */ |
79 | unsigned char width; /* size of register access in bytes */ | 95 | unsigned char width; /* size of register access in bytes */ |
80 | }; | 96 | }; |
81 | 97 | ||
82 | struct mmiotrace_map { | 98 | struct mmiotrace_map { |
83 | resource_size_t phys; /* base address in PCI space */ | 99 | resource_size_t phys; /* base address in PCI space */ |
84 | unsigned long virt; /* base virtual address */ | 100 | unsigned long virt; /* base virtual address */ |
85 | unsigned long len; /* mapping size */ | 101 | unsigned long len; /* mapping size */ |
86 | int map_id; | 102 | int map_id; |
87 | unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */ | 103 | unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */ |
88 | }; | 104 | }; |
89 | 105 | ||
90 | /* in kernel/trace/trace_mmiotrace.c */ | 106 | /* in kernel/trace/trace_mmiotrace.c */ |
@@ -94,4 +110,4 @@ extern void mmio_trace_rw(struct mmiotrace_rw *rw); | |||
94 | extern void mmio_trace_mapping(struct mmiotrace_map *map); | 110 | extern void mmio_trace_mapping(struct mmiotrace_map *map); |
95 | extern int mmio_trace_printk(const char *fmt, va_list args); | 111 | extern int mmio_trace_printk(const char *fmt, va_list args); |
96 | 112 | ||
97 | #endif /* MMIOTRACE_H */ | 113 | #endif /* _LINUX_MMIOTRACE_H */ |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 09c14e213b63..1aca6cebbb78 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -1071,7 +1071,7 @@ void sparse_init(void); | |||
1071 | #endif /* CONFIG_SPARSEMEM */ | 1071 | #endif /* CONFIG_SPARSEMEM */ |
1072 | 1072 | ||
1073 | #ifdef CONFIG_NODES_SPAN_OTHER_NODES | 1073 | #ifdef CONFIG_NODES_SPAN_OTHER_NODES |
1074 | #define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid)) | 1074 | bool early_pfn_in_nid(unsigned long pfn, int nid); |
1075 | #else | 1075 | #else |
1076 | #define early_pfn_in_nid(pfn, nid) (1) | 1076 | #define early_pfn_in_nid(pfn, nid) (1) |
1077 | #endif | 1077 | #endif |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 52a9fe08451c..aca8c458aa8a 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1312,6 +1312,7 @@ | |||
1312 | #define PCI_DEVICE_ID_VIA_VT3351 0x0351 | 1312 | #define PCI_DEVICE_ID_VIA_VT3351 0x0351 |
1313 | #define PCI_DEVICE_ID_VIA_VT3364 0x0364 | 1313 | #define PCI_DEVICE_ID_VIA_VT3364 0x0364 |
1314 | #define PCI_DEVICE_ID_VIA_8371_0 0x0391 | 1314 | #define PCI_DEVICE_ID_VIA_8371_0 0x0391 |
1315 | #define PCI_DEVICE_ID_VIA_6415 0x0415 | ||
1315 | #define PCI_DEVICE_ID_VIA_8501_0 0x0501 | 1316 | #define PCI_DEVICE_ID_VIA_8501_0 0x0501 |
1316 | #define PCI_DEVICE_ID_VIA_82C561 0x0561 | 1317 | #define PCI_DEVICE_ID_VIA_82C561 0x0561 |
1317 | #define PCI_DEVICE_ID_VIA_82C586_1 0x0571 | 1318 | #define PCI_DEVICE_ID_VIA_82C586_1 0x0571 |
@@ -1444,6 +1445,7 @@ | |||
1444 | #define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 | 1445 | #define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 |
1445 | #define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072 | 1446 | #define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072 |
1446 | #define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073 | 1447 | #define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073 |
1448 | #define PCI_DEVICE_ID_DIGI_NEO_8 0x00B1 | ||
1447 | #define PCI_DEVICE_ID_NEO_2DB9 0x00C8 | 1449 | #define PCI_DEVICE_ID_NEO_2DB9 0x00C8 |
1448 | #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 | 1450 | #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 |
1449 | #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA | 1451 | #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA |
@@ -2321,6 +2323,9 @@ | |||
2321 | #define PCI_DEVICE_ID_INTEL_82378 0x0484 | 2323 | #define PCI_DEVICE_ID_INTEL_82378 0x0484 |
2322 | #define PCI_DEVICE_ID_INTEL_I960 0x0960 | 2324 | #define PCI_DEVICE_ID_INTEL_I960 0x0960 |
2323 | #define PCI_DEVICE_ID_INTEL_I960RM 0x0962 | 2325 | #define PCI_DEVICE_ID_INTEL_I960RM 0x0962 |
2326 | #define PCI_DEVICE_ID_INTEL_8257X_SOL 0x1062 | ||
2327 | #define PCI_DEVICE_ID_INTEL_82573E_SOL 0x1085 | ||
2328 | #define PCI_DEVICE_ID_INTEL_82573L_SOL 0x108F | ||
2324 | #define PCI_DEVICE_ID_INTEL_82815_MC 0x1130 | 2329 | #define PCI_DEVICE_ID_INTEL_82815_MC 0x1130 |
2325 | #define PCI_DEVICE_ID_INTEL_82815_CGC 0x1132 | 2330 | #define PCI_DEVICE_ID_INTEL_82815_CGC 0x1132 |
2326 | #define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221 | 2331 | #define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221 |
diff --git a/include/linux/pm.h b/include/linux/pm.h index de2e0a8f6728..24ba5f67b3a3 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -381,10 +381,12 @@ struct dev_pm_info { | |||
381 | 381 | ||
382 | #ifdef CONFIG_PM_SLEEP | 382 | #ifdef CONFIG_PM_SLEEP |
383 | extern void device_pm_lock(void); | 383 | extern void device_pm_lock(void); |
384 | extern int sysdev_resume(void); | ||
384 | extern void device_power_up(pm_message_t state); | 385 | extern void device_power_up(pm_message_t state); |
385 | extern void device_resume(pm_message_t state); | 386 | extern void device_resume(pm_message_t state); |
386 | 387 | ||
387 | extern void device_pm_unlock(void); | 388 | extern void device_pm_unlock(void); |
389 | extern int sysdev_suspend(pm_message_t state); | ||
388 | extern int device_power_down(pm_message_t state); | 390 | extern int device_power_down(pm_message_t state); |
389 | extern int device_suspend(pm_message_t state); | 391 | extern int device_suspend(pm_message_t state); |
390 | extern int device_prepare_suspend(pm_message_t state); | 392 | extern int device_prepare_suspend(pm_message_t state); |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 40ea5058c2ec..f616f31576d7 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -19,6 +19,7 @@ struct seq_file { | |||
19 | size_t from; | 19 | size_t from; |
20 | size_t count; | 20 | size_t count; |
21 | loff_t index; | 21 | loff_t index; |
22 | loff_t read_pos; | ||
22 | u64 version; | 23 | u64 version; |
23 | struct mutex lock; | 24 | struct mutex lock; |
24 | const struct seq_operations *op; | 25 | const struct seq_operations *op; |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 90bbbf0b1161..df9245c7bd3b 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -296,6 +296,7 @@ struct uart_port { | |||
296 | #define UPF_HARDPPS_CD ((__force upf_t) (1 << 11)) | 296 | #define UPF_HARDPPS_CD ((__force upf_t) (1 << 11)) |
297 | #define UPF_LOW_LATENCY ((__force upf_t) (1 << 13)) | 297 | #define UPF_LOW_LATENCY ((__force upf_t) (1 << 13)) |
298 | #define UPF_BUGGY_UART ((__force upf_t) (1 << 14)) | 298 | #define UPF_BUGGY_UART ((__force upf_t) (1 << 14)) |
299 | #define UPF_NO_TXEN_TEST ((__force upf_t) (1 << 15)) | ||
299 | #define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16)) | 300 | #define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16)) |
300 | #define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) | 301 | #define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) |
301 | #define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) | 302 | #define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) |
diff --git a/include/linux/slab.h b/include/linux/slab.h index f96d13c281e8..24c5602bee99 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -127,6 +127,7 @@ int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr); | |||
127 | void * __must_check __krealloc(const void *, size_t, gfp_t); | 127 | void * __must_check __krealloc(const void *, size_t, gfp_t); |
128 | void * __must_check krealloc(const void *, size_t, gfp_t); | 128 | void * __must_check krealloc(const void *, size_t, gfp_t); |
129 | void kfree(const void *); | 129 | void kfree(const void *); |
130 | void kzfree(const void *); | ||
130 | size_t ksize(const void *); | 131 | size_t ksize(const void *); |
131 | 132 | ||
132 | /* | 133 | /* |
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index bf8de281b4ed..eed4254bd503 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h | |||
@@ -83,6 +83,13 @@ extern int spi_bitbang_stop(struct spi_bitbang *spi); | |||
83 | * int getmiso(struct spi_device *); | 83 | * int getmiso(struct spi_device *); |
84 | * void spidelay(unsigned); | 84 | * void spidelay(unsigned); |
85 | * | 85 | * |
86 | * setsck()'s is_on parameter is a zero/nonzero boolean. | ||
87 | * | ||
88 | * setmosi()'s is_on parameter is a zero/nonzero boolean. | ||
89 | * | ||
90 | * getmiso() is required to return 0 or 1 only. Any other value is invalid | ||
91 | * and will result in improper operation. | ||
92 | * | ||
86 | * A non-inlined routine would call bitbang_txrx_*() routines. The | 93 | * A non-inlined routine would call bitbang_txrx_*() routines. The |
87 | * main loop could easily compile down to a handful of instructions, | 94 | * main loop could easily compile down to a handful of instructions, |
88 | * especially if the delay is a NOP (to run at peak speed). | 95 | * especially if the delay is a NOP (to run at peak speed). |
diff --git a/include/linux/timerfd.h b/include/linux/timerfd.h index 86cb0501d3e2..2d0792983f8c 100644 --- a/include/linux/timerfd.h +++ b/include/linux/timerfd.h | |||
@@ -11,13 +11,21 @@ | |||
11 | /* For O_CLOEXEC and O_NONBLOCK */ | 11 | /* For O_CLOEXEC and O_NONBLOCK */ |
12 | #include <linux/fcntl.h> | 12 | #include <linux/fcntl.h> |
13 | 13 | ||
14 | /* Flags for timerfd_settime. */ | 14 | /* |
15 | * CAREFUL: Check include/asm-generic/fcntl.h when defining | ||
16 | * new flags, since they might collide with O_* ones. We want | ||
17 | * to re-use O_* flags that couldn't possibly have a meaning | ||
18 | * from eventfd, in order to leave a free define-space for | ||
19 | * shared O_* flags. | ||
20 | */ | ||
15 | #define TFD_TIMER_ABSTIME (1 << 0) | 21 | #define TFD_TIMER_ABSTIME (1 << 0) |
16 | |||
17 | /* Flags for timerfd_create. */ | ||
18 | #define TFD_CLOEXEC O_CLOEXEC | 22 | #define TFD_CLOEXEC O_CLOEXEC |
19 | #define TFD_NONBLOCK O_NONBLOCK | 23 | #define TFD_NONBLOCK O_NONBLOCK |
20 | 24 | ||
25 | #define TFD_SHARED_FCNTL_FLAGS (TFD_CLOEXEC | TFD_NONBLOCK) | ||
26 | /* Flags for timerfd_create. */ | ||
27 | #define TFD_CREATE_FLAGS TFD_SHARED_FCNTL_FLAGS | ||
28 | /* Flags for timerfd_settime. */ | ||
29 | #define TFD_SETTIME_FLAGS TFD_TIMER_ABSTIME | ||
21 | 30 | ||
22 | #endif /* _LINUX_TIMERFD_H */ | 31 | #endif /* _LINUX_TIMERFD_H */ |
23 | |||
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 506e7620a986..9c0890c7a06a 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
@@ -84,6 +84,10 @@ extern struct vm_struct *get_vm_area_caller(unsigned long size, | |||
84 | unsigned long flags, void *caller); | 84 | unsigned long flags, void *caller); |
85 | extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, | 85 | extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, |
86 | unsigned long start, unsigned long end); | 86 | unsigned long start, unsigned long end); |
87 | extern struct vm_struct *__get_vm_area_caller(unsigned long size, | ||
88 | unsigned long flags, | ||
89 | unsigned long start, unsigned long end, | ||
90 | void *caller); | ||
87 | extern struct vm_struct *get_vm_area_node(unsigned long size, | 91 | extern struct vm_struct *get_vm_area_node(unsigned long size, |
88 | unsigned long flags, int node, | 92 | unsigned long flags, int node, |
89 | gfp_t gfp_mask); | 93 | gfp_t gfp_mask); |
diff --git a/init/do_mounts.c b/init/do_mounts.c index 708105e163df..8d4ff5afc1d8 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
@@ -370,10 +370,14 @@ void __init prepare_namespace(void) | |||
370 | ssleep(root_delay); | 370 | ssleep(root_delay); |
371 | } | 371 | } |
372 | 372 | ||
373 | /* wait for the known devices to complete their probing */ | 373 | /* |
374 | while (driver_probe_done() != 0) | 374 | * wait for the known devices to complete their probing |
375 | msleep(100); | 375 | * |
376 | async_synchronize_full(); | 376 | * Note: this is a potential source of long boot delays. |
377 | * For example, it is not atypical to wait 5 seconds here | ||
378 | * for the touchpad of a laptop to initialize. | ||
379 | */ | ||
380 | wait_for_device_probe(); | ||
377 | 381 | ||
378 | md_run_setup(); | 382 | md_run_setup(); |
379 | 383 | ||
@@ -399,6 +403,7 @@ void __init prepare_namespace(void) | |||
399 | while (driver_probe_done() != 0 || | 403 | while (driver_probe_done() != 0 || |
400 | (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0) | 404 | (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0) |
401 | msleep(100); | 405 | msleep(100); |
406 | async_synchronize_full(); | ||
402 | } | 407 | } |
403 | 408 | ||
404 | is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR; | 409 | is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR; |
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c index ff95e3192884..9bdddbcb3d6a 100644 --- a/init/do_mounts_md.c +++ b/init/do_mounts_md.c | |||
@@ -281,8 +281,9 @@ static void __init autodetect_raid(void) | |||
281 | */ | 281 | */ |
282 | printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n"); | 282 | printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n"); |
283 | printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n"); | 283 | printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n"); |
284 | while (driver_probe_done() < 0) | 284 | |
285 | msleep(100); | 285 | wait_for_device_probe(); |
286 | |||
286 | fd = sys_open("/dev/md0", 0, 0); | 287 | fd = sys_open("/dev/md0", 0, 0); |
287 | if (fd >= 0) { | 288 | if (fd >= 0) { |
288 | sys_ioctl(fd, RAID_AUTORUN, raid_autopart); | 289 | sys_ioctl(fd, RAID_AUTORUN, raid_autopart); |
diff --git a/kernel/Makefile b/kernel/Makefile index 170a9213c1b6..e4791b3ba55d 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -51,6 +51,7 @@ obj-$(CONFIG_UID16) += uid16.o | |||
51 | obj-$(CONFIG_MODULES) += module.o | 51 | obj-$(CONFIG_MODULES) += module.o |
52 | obj-$(CONFIG_KALLSYMS) += kallsyms.o | 52 | obj-$(CONFIG_KALLSYMS) += kallsyms.o |
53 | obj-$(CONFIG_PM) += power/ | 53 | obj-$(CONFIG_PM) += power/ |
54 | obj-$(CONFIG_FREEZER) += power/ | ||
54 | obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o | 55 | obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o |
55 | obj-$(CONFIG_KEXEC) += kexec.o | 56 | obj-$(CONFIG_KEXEC) += kexec.o |
56 | obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o | 57 | obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index e14db9c089b9..9edb5c4b79b4 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1122,8 +1122,8 @@ static void cgroup_kill_sb(struct super_block *sb) { | |||
1122 | 1122 | ||
1123 | mutex_unlock(&cgroup_mutex); | 1123 | mutex_unlock(&cgroup_mutex); |
1124 | 1124 | ||
1125 | kfree(root); | ||
1126 | kill_litter_super(sb); | 1125 | kill_litter_super(sb); |
1126 | kfree(root); | ||
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | static struct file_system_type cgroup_fs_type = { | 1129 | static struct file_system_type cgroup_fs_type = { |
diff --git a/kernel/futex.c b/kernel/futex.c index f89d373a9c6d..438701adce23 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -1165,6 +1165,7 @@ static int futex_wait(u32 __user *uaddr, int fshared, | |||
1165 | u32 val, ktime_t *abs_time, u32 bitset, int clockrt) | 1165 | u32 val, ktime_t *abs_time, u32 bitset, int clockrt) |
1166 | { | 1166 | { |
1167 | struct task_struct *curr = current; | 1167 | struct task_struct *curr = current; |
1168 | struct restart_block *restart; | ||
1168 | DECLARE_WAITQUEUE(wait, curr); | 1169 | DECLARE_WAITQUEUE(wait, curr); |
1169 | struct futex_hash_bucket *hb; | 1170 | struct futex_hash_bucket *hb; |
1170 | struct futex_q q; | 1171 | struct futex_q q; |
@@ -1216,11 +1217,13 @@ retry: | |||
1216 | 1217 | ||
1217 | if (!ret) | 1218 | if (!ret) |
1218 | goto retry; | 1219 | goto retry; |
1219 | return ret; | 1220 | goto out; |
1220 | } | 1221 | } |
1221 | ret = -EWOULDBLOCK; | 1222 | ret = -EWOULDBLOCK; |
1222 | if (uval != val) | 1223 | if (unlikely(uval != val)) { |
1223 | goto out_unlock_put_key; | 1224 | queue_unlock(&q, hb); |
1225 | goto out_put_key; | ||
1226 | } | ||
1224 | 1227 | ||
1225 | /* Only actually queue if *uaddr contained val. */ | 1228 | /* Only actually queue if *uaddr contained val. */ |
1226 | queue_me(&q, hb); | 1229 | queue_me(&q, hb); |
@@ -1284,38 +1287,38 @@ retry: | |||
1284 | */ | 1287 | */ |
1285 | 1288 | ||
1286 | /* If we were woken (and unqueued), we succeeded, whatever. */ | 1289 | /* If we were woken (and unqueued), we succeeded, whatever. */ |
1290 | ret = 0; | ||
1287 | if (!unqueue_me(&q)) | 1291 | if (!unqueue_me(&q)) |
1288 | return 0; | 1292 | goto out_put_key; |
1293 | ret = -ETIMEDOUT; | ||
1289 | if (rem) | 1294 | if (rem) |
1290 | return -ETIMEDOUT; | 1295 | goto out_put_key; |
1291 | 1296 | ||
1292 | /* | 1297 | /* |
1293 | * We expect signal_pending(current), but another thread may | 1298 | * We expect signal_pending(current), but another thread may |
1294 | * have handled it for us already. | 1299 | * have handled it for us already. |
1295 | */ | 1300 | */ |
1301 | ret = -ERESTARTSYS; | ||
1296 | if (!abs_time) | 1302 | if (!abs_time) |
1297 | return -ERESTARTSYS; | 1303 | goto out_put_key; |
1298 | else { | ||
1299 | struct restart_block *restart; | ||
1300 | restart = ¤t_thread_info()->restart_block; | ||
1301 | restart->fn = futex_wait_restart; | ||
1302 | restart->futex.uaddr = (u32 *)uaddr; | ||
1303 | restart->futex.val = val; | ||
1304 | restart->futex.time = abs_time->tv64; | ||
1305 | restart->futex.bitset = bitset; | ||
1306 | restart->futex.flags = 0; | ||
1307 | |||
1308 | if (fshared) | ||
1309 | restart->futex.flags |= FLAGS_SHARED; | ||
1310 | if (clockrt) | ||
1311 | restart->futex.flags |= FLAGS_CLOCKRT; | ||
1312 | return -ERESTART_RESTARTBLOCK; | ||
1313 | } | ||
1314 | 1304 | ||
1315 | out_unlock_put_key: | 1305 | restart = ¤t_thread_info()->restart_block; |
1316 | queue_unlock(&q, hb); | 1306 | restart->fn = futex_wait_restart; |
1317 | put_futex_key(fshared, &q.key); | 1307 | restart->futex.uaddr = (u32 *)uaddr; |
1308 | restart->futex.val = val; | ||
1309 | restart->futex.time = abs_time->tv64; | ||
1310 | restart->futex.bitset = bitset; | ||
1311 | restart->futex.flags = 0; | ||
1312 | |||
1313 | if (fshared) | ||
1314 | restart->futex.flags |= FLAGS_SHARED; | ||
1315 | if (clockrt) | ||
1316 | restart->futex.flags |= FLAGS_CLOCKRT; | ||
1318 | 1317 | ||
1318 | ret = -ERESTART_RESTARTBLOCK; | ||
1319 | |||
1320 | out_put_key: | ||
1321 | put_futex_key(fshared, &q.key); | ||
1319 | out: | 1322 | out: |
1320 | return ret; | 1323 | return ret; |
1321 | } | 1324 | } |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 795e7b67a228..c7fd6692939d 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -1465,6 +1465,11 @@ int kernel_kexec(void) | |||
1465 | error = device_power_down(PMSG_FREEZE); | 1465 | error = device_power_down(PMSG_FREEZE); |
1466 | if (error) | 1466 | if (error) |
1467 | goto Enable_irqs; | 1467 | goto Enable_irqs; |
1468 | |||
1469 | /* Suspend system devices */ | ||
1470 | error = sysdev_suspend(PMSG_FREEZE); | ||
1471 | if (error) | ||
1472 | goto Power_up_devices; | ||
1468 | } else | 1473 | } else |
1469 | #endif | 1474 | #endif |
1470 | { | 1475 | { |
@@ -1477,6 +1482,8 @@ int kernel_kexec(void) | |||
1477 | 1482 | ||
1478 | #ifdef CONFIG_KEXEC_JUMP | 1483 | #ifdef CONFIG_KEXEC_JUMP |
1479 | if (kexec_image->preserve_context) { | 1484 | if (kexec_image->preserve_context) { |
1485 | sysdev_resume(); | ||
1486 | Power_up_devices: | ||
1480 | device_power_up(PMSG_RESTORE); | 1487 | device_power_up(PMSG_RESTORE); |
1481 | Enable_irqs: | 1488 | Enable_irqs: |
1482 | local_irq_enable(); | 1489 | local_irq_enable(); |
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 2313a4cc14ea..e976e505648d 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -681,6 +681,33 @@ static void cpu_timer_fire(struct k_itimer *timer) | |||
681 | } | 681 | } |
682 | 682 | ||
683 | /* | 683 | /* |
684 | * Sample a process (thread group) timer for the given group_leader task. | ||
685 | * Must be called with tasklist_lock held for reading. | ||
686 | */ | ||
687 | static int cpu_timer_sample_group(const clockid_t which_clock, | ||
688 | struct task_struct *p, | ||
689 | union cpu_time_count *cpu) | ||
690 | { | ||
691 | struct task_cputime cputime; | ||
692 | |||
693 | thread_group_cputimer(p, &cputime); | ||
694 | switch (CPUCLOCK_WHICH(which_clock)) { | ||
695 | default: | ||
696 | return -EINVAL; | ||
697 | case CPUCLOCK_PROF: | ||
698 | cpu->cpu = cputime_add(cputime.utime, cputime.stime); | ||
699 | break; | ||
700 | case CPUCLOCK_VIRT: | ||
701 | cpu->cpu = cputime.utime; | ||
702 | break; | ||
703 | case CPUCLOCK_SCHED: | ||
704 | cpu->sched = cputime.sum_exec_runtime + task_delta_exec(p); | ||
705 | break; | ||
706 | } | ||
707 | return 0; | ||
708 | } | ||
709 | |||
710 | /* | ||
684 | * Guts of sys_timer_settime for CPU timers. | 711 | * Guts of sys_timer_settime for CPU timers. |
685 | * This is called with the timer locked and interrupts disabled. | 712 | * This is called with the timer locked and interrupts disabled. |
686 | * If we return TIMER_RETRY, it's necessary to release the timer's lock | 713 | * If we return TIMER_RETRY, it's necessary to release the timer's lock |
@@ -741,7 +768,7 @@ int posix_cpu_timer_set(struct k_itimer *timer, int flags, | |||
741 | if (CPUCLOCK_PERTHREAD(timer->it_clock)) { | 768 | if (CPUCLOCK_PERTHREAD(timer->it_clock)) { |
742 | cpu_clock_sample(timer->it_clock, p, &val); | 769 | cpu_clock_sample(timer->it_clock, p, &val); |
743 | } else { | 770 | } else { |
744 | cpu_clock_sample_group(timer->it_clock, p, &val); | 771 | cpu_timer_sample_group(timer->it_clock, p, &val); |
745 | } | 772 | } |
746 | 773 | ||
747 | if (old) { | 774 | if (old) { |
@@ -889,7 +916,7 @@ void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp) | |||
889 | read_unlock(&tasklist_lock); | 916 | read_unlock(&tasklist_lock); |
890 | goto dead; | 917 | goto dead; |
891 | } else { | 918 | } else { |
892 | cpu_clock_sample_group(timer->it_clock, p, &now); | 919 | cpu_timer_sample_group(timer->it_clock, p, &now); |
893 | clear_dead = (unlikely(p->exit_state) && | 920 | clear_dead = (unlikely(p->exit_state) && |
894 | thread_group_empty(p)); | 921 | thread_group_empty(p)); |
895 | } | 922 | } |
@@ -1244,7 +1271,7 @@ void posix_cpu_timer_schedule(struct k_itimer *timer) | |||
1244 | clear_dead_task(timer, now); | 1271 | clear_dead_task(timer, now); |
1245 | goto out_unlock; | 1272 | goto out_unlock; |
1246 | } | 1273 | } |
1247 | cpu_clock_sample_group(timer->it_clock, p, &now); | 1274 | cpu_timer_sample_group(timer->it_clock, p, &now); |
1248 | bump_cpu_timer(timer, now); | 1275 | bump_cpu_timer(timer, now); |
1249 | /* Leave the tasklist_lock locked for the call below. */ | 1276 | /* Leave the tasklist_lock locked for the call below. */ |
1250 | } | 1277 | } |
@@ -1409,33 +1436,6 @@ void run_posix_cpu_timers(struct task_struct *tsk) | |||
1409 | } | 1436 | } |
1410 | 1437 | ||
1411 | /* | 1438 | /* |
1412 | * Sample a process (thread group) timer for the given group_leader task. | ||
1413 | * Must be called with tasklist_lock held for reading. | ||
1414 | */ | ||
1415 | static int cpu_timer_sample_group(const clockid_t which_clock, | ||
1416 | struct task_struct *p, | ||
1417 | union cpu_time_count *cpu) | ||
1418 | { | ||
1419 | struct task_cputime cputime; | ||
1420 | |||
1421 | thread_group_cputimer(p, &cputime); | ||
1422 | switch (CPUCLOCK_WHICH(which_clock)) { | ||
1423 | default: | ||
1424 | return -EINVAL; | ||
1425 | case CPUCLOCK_PROF: | ||
1426 | cpu->cpu = cputime_add(cputime.utime, cputime.stime); | ||
1427 | break; | ||
1428 | case CPUCLOCK_VIRT: | ||
1429 | cpu->cpu = cputime.utime; | ||
1430 | break; | ||
1431 | case CPUCLOCK_SCHED: | ||
1432 | cpu->sched = cputime.sum_exec_runtime + task_delta_exec(p); | ||
1433 | break; | ||
1434 | } | ||
1435 | return 0; | ||
1436 | } | ||
1437 | |||
1438 | /* | ||
1439 | * Set one of the process-wide special case CPU timers. | 1439 | * Set one of the process-wide special case CPU timers. |
1440 | * The tsk->sighand->siglock must be held by the caller. | 1440 | * The tsk->sighand->siglock must be held by the caller. |
1441 | * The *newval argument is relative and we update it to be absolute, *oldval | 1441 | * The *newval argument is relative and we update it to be absolute, *oldval |
diff --git a/kernel/power/Makefile b/kernel/power/Makefile index d7a10167a25b..720ea4f781bd 100644 --- a/kernel/power/Makefile +++ b/kernel/power/Makefile | |||
@@ -3,7 +3,7 @@ ifeq ($(CONFIG_PM_DEBUG),y) | |||
3 | EXTRA_CFLAGS += -DDEBUG | 3 | EXTRA_CFLAGS += -DDEBUG |
4 | endif | 4 | endif |
5 | 5 | ||
6 | obj-y := main.o | 6 | obj-$(CONFIG_PM) += main.o |
7 | obj-$(CONFIG_PM_SLEEP) += console.o | 7 | obj-$(CONFIG_PM_SLEEP) += console.o |
8 | obj-$(CONFIG_FREEZER) += process.o | 8 | obj-$(CONFIG_FREEZER) += process.o |
9 | obj-$(CONFIG_HIBERNATION) += swsusp.o disk.o snapshot.o swap.o user.o | 9 | obj-$(CONFIG_HIBERNATION) += swsusp.o disk.o snapshot.o swap.o user.o |
diff --git a/kernel/power/console.c b/kernel/power/console.c index b8628be2a465..a3961b205de7 100644 --- a/kernel/power/console.c +++ b/kernel/power/console.c | |||
@@ -78,6 +78,12 @@ void pm_restore_console(void) | |||
78 | } | 78 | } |
79 | set_console(orig_fgconsole); | 79 | set_console(orig_fgconsole); |
80 | release_console_sem(); | 80 | release_console_sem(); |
81 | |||
82 | if (vt_waitactive(orig_fgconsole)) { | ||
83 | pr_debug("Resume: Can't switch VCs."); | ||
84 | return; | ||
85 | } | ||
86 | |||
81 | kmsg_redirect = orig_kmsg; | 87 | kmsg_redirect = orig_kmsg; |
82 | } | 88 | } |
83 | #endif | 89 | #endif |
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 432ee575c9ee..4a4a206b1979 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -227,6 +227,12 @@ static int create_image(int platform_mode) | |||
227 | "aborting hibernation\n"); | 227 | "aborting hibernation\n"); |
228 | goto Enable_irqs; | 228 | goto Enable_irqs; |
229 | } | 229 | } |
230 | sysdev_suspend(PMSG_FREEZE); | ||
231 | if (error) { | ||
232 | printk(KERN_ERR "PM: Some devices failed to power down, " | ||
233 | "aborting hibernation\n"); | ||
234 | goto Power_up_devices; | ||
235 | } | ||
230 | 236 | ||
231 | if (hibernation_test(TEST_CORE)) | 237 | if (hibernation_test(TEST_CORE)) |
232 | goto Power_up; | 238 | goto Power_up; |
@@ -242,9 +248,11 @@ static int create_image(int platform_mode) | |||
242 | if (!in_suspend) | 248 | if (!in_suspend) |
243 | platform_leave(platform_mode); | 249 | platform_leave(platform_mode); |
244 | Power_up: | 250 | Power_up: |
251 | sysdev_resume(); | ||
245 | /* NOTE: device_power_up() is just a resume() for devices | 252 | /* NOTE: device_power_up() is just a resume() for devices |
246 | * that suspended with irqs off ... no overall powerup. | 253 | * that suspended with irqs off ... no overall powerup. |
247 | */ | 254 | */ |
255 | Power_up_devices: | ||
248 | device_power_up(in_suspend ? | 256 | device_power_up(in_suspend ? |
249 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); | 257 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); |
250 | Enable_irqs: | 258 | Enable_irqs: |
@@ -335,6 +343,7 @@ static int resume_target_kernel(void) | |||
335 | "aborting resume\n"); | 343 | "aborting resume\n"); |
336 | goto Enable_irqs; | 344 | goto Enable_irqs; |
337 | } | 345 | } |
346 | sysdev_suspend(PMSG_QUIESCE); | ||
338 | /* We'll ignore saved state, but this gets preempt count (etc) right */ | 347 | /* We'll ignore saved state, but this gets preempt count (etc) right */ |
339 | save_processor_state(); | 348 | save_processor_state(); |
340 | error = restore_highmem(); | 349 | error = restore_highmem(); |
@@ -357,6 +366,7 @@ static int resume_target_kernel(void) | |||
357 | swsusp_free(); | 366 | swsusp_free(); |
358 | restore_processor_state(); | 367 | restore_processor_state(); |
359 | touch_softlockup_watchdog(); | 368 | touch_softlockup_watchdog(); |
369 | sysdev_resume(); | ||
360 | device_power_up(PMSG_RECOVER); | 370 | device_power_up(PMSG_RECOVER); |
361 | Enable_irqs: | 371 | Enable_irqs: |
362 | local_irq_enable(); | 372 | local_irq_enable(); |
@@ -440,6 +450,7 @@ int hibernation_platform_enter(void) | |||
440 | local_irq_disable(); | 450 | local_irq_disable(); |
441 | error = device_power_down(PMSG_HIBERNATE); | 451 | error = device_power_down(PMSG_HIBERNATE); |
442 | if (!error) { | 452 | if (!error) { |
453 | sysdev_suspend(PMSG_HIBERNATE); | ||
443 | hibernation_ops->enter(); | 454 | hibernation_ops->enter(); |
444 | /* We should never get here */ | 455 | /* We should never get here */ |
445 | while (1); | 456 | while (1); |
@@ -595,6 +606,12 @@ static int software_resume(void) | |||
595 | unsigned int flags; | 606 | unsigned int flags; |
596 | 607 | ||
597 | /* | 608 | /* |
609 | * If the user said "noresume".. bail out early. | ||
610 | */ | ||
611 | if (noresume) | ||
612 | return 0; | ||
613 | |||
614 | /* | ||
598 | * name_to_dev_t() below takes a sysfs buffer mutex when sysfs | 615 | * name_to_dev_t() below takes a sysfs buffer mutex when sysfs |
599 | * is configured into the kernel. Since the regular hibernate | 616 | * is configured into the kernel. Since the regular hibernate |
600 | * trigger path is via sysfs which takes a buffer mutex before | 617 | * trigger path is via sysfs which takes a buffer mutex before |
@@ -610,6 +627,11 @@ static int software_resume(void) | |||
610 | mutex_unlock(&pm_mutex); | 627 | mutex_unlock(&pm_mutex); |
611 | return -ENOENT; | 628 | return -ENOENT; |
612 | } | 629 | } |
630 | /* | ||
631 | * Some device discovery might still be in progress; we need | ||
632 | * to wait for this to finish. | ||
633 | */ | ||
634 | wait_for_device_probe(); | ||
613 | swsusp_resume_device = name_to_dev_t(resume_file); | 635 | swsusp_resume_device = name_to_dev_t(resume_file); |
614 | pr_debug("PM: Resume from partition %s\n", resume_file); | 636 | pr_debug("PM: Resume from partition %s\n", resume_file); |
615 | } else { | 637 | } else { |
diff --git a/kernel/power/main.c b/kernel/power/main.c index b4d219016b6c..c9632f841f64 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -298,8 +298,12 @@ static int suspend_enter(suspend_state_t state) | |||
298 | goto Done; | 298 | goto Done; |
299 | } | 299 | } |
300 | 300 | ||
301 | if (!suspend_test(TEST_CORE)) | 301 | error = sysdev_suspend(PMSG_SUSPEND); |
302 | error = suspend_ops->enter(state); | 302 | if (!error) { |
303 | if (!suspend_test(TEST_CORE)) | ||
304 | error = suspend_ops->enter(state); | ||
305 | sysdev_resume(); | ||
306 | } | ||
303 | 307 | ||
304 | device_power_up(PMSG_RESUME); | 308 | device_power_up(PMSG_RESUME); |
305 | Done: | 309 | Done: |
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 6da14358537c..505f319e489c 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
@@ -60,6 +60,7 @@ static struct block_device *resume_bdev; | |||
60 | static int submit(int rw, pgoff_t page_off, struct page *page, | 60 | static int submit(int rw, pgoff_t page_off, struct page *page, |
61 | struct bio **bio_chain) | 61 | struct bio **bio_chain) |
62 | { | 62 | { |
63 | const int bio_rw = rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); | ||
63 | struct bio *bio; | 64 | struct bio *bio; |
64 | 65 | ||
65 | bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1); | 66 | bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1); |
@@ -80,7 +81,7 @@ static int submit(int rw, pgoff_t page_off, struct page *page, | |||
80 | bio_get(bio); | 81 | bio_get(bio); |
81 | 82 | ||
82 | if (bio_chain == NULL) { | 83 | if (bio_chain == NULL) { |
83 | submit_bio(rw | (1 << BIO_RW_SYNC), bio); | 84 | submit_bio(bio_rw, bio); |
84 | wait_on_page_locked(page); | 85 | wait_on_page_locked(page); |
85 | if (rw == READ) | 86 | if (rw == READ) |
86 | bio_set_pages_dirty(bio); | 87 | bio_set_pages_dirty(bio); |
@@ -90,7 +91,7 @@ static int submit(int rw, pgoff_t page_off, struct page *page, | |||
90 | get_page(page); /* These pages are freed later */ | 91 | get_page(page); /* These pages are freed later */ |
91 | bio->bi_private = *bio_chain; | 92 | bio->bi_private = *bio_chain; |
92 | *bio_chain = bio; | 93 | *bio_chain = bio; |
93 | submit_bio(rw | (1 << BIO_RW_SYNC), bio); | 94 | submit_bio(bio_rw, bio); |
94 | } | 95 | } |
95 | return 0; | 96 | return 0; |
96 | } | 97 | } |
diff --git a/kernel/power/user.c b/kernel/power/user.c index 005b93d839ba..6c85359364f2 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -95,15 +95,15 @@ static int snapshot_open(struct inode *inode, struct file *filp) | |||
95 | data->swap = swsusp_resume_device ? | 95 | data->swap = swsusp_resume_device ? |
96 | swap_type_of(swsusp_resume_device, 0, NULL) : -1; | 96 | swap_type_of(swsusp_resume_device, 0, NULL) : -1; |
97 | data->mode = O_RDONLY; | 97 | data->mode = O_RDONLY; |
98 | error = pm_notifier_call_chain(PM_RESTORE_PREPARE); | 98 | error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); |
99 | if (error) | 99 | if (error) |
100 | pm_notifier_call_chain(PM_POST_RESTORE); | 100 | pm_notifier_call_chain(PM_POST_HIBERNATION); |
101 | } else { | 101 | } else { |
102 | data->swap = -1; | 102 | data->swap = -1; |
103 | data->mode = O_WRONLY; | 103 | data->mode = O_WRONLY; |
104 | error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); | 104 | error = pm_notifier_call_chain(PM_RESTORE_PREPARE); |
105 | if (error) | 105 | if (error) |
106 | pm_notifier_call_chain(PM_POST_HIBERNATION); | 106 | pm_notifier_call_chain(PM_POST_RESTORE); |
107 | } | 107 | } |
108 | if (error) | 108 | if (error) |
109 | atomic_inc(&snapshot_device_available); | 109 | atomic_inc(&snapshot_device_available); |
diff --git a/kernel/printk.c b/kernel/printk.c index 69188f226a93..e3602d0755b0 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -73,7 +73,6 @@ EXPORT_SYMBOL(oops_in_progress); | |||
73 | * driver system. | 73 | * driver system. |
74 | */ | 74 | */ |
75 | static DECLARE_MUTEX(console_sem); | 75 | static DECLARE_MUTEX(console_sem); |
76 | static DECLARE_MUTEX(secondary_console_sem); | ||
77 | struct console *console_drivers; | 76 | struct console *console_drivers; |
78 | EXPORT_SYMBOL_GPL(console_drivers); | 77 | EXPORT_SYMBOL_GPL(console_drivers); |
79 | 78 | ||
@@ -891,12 +890,14 @@ void suspend_console(void) | |||
891 | printk("Suspending console(s) (use no_console_suspend to debug)\n"); | 890 | printk("Suspending console(s) (use no_console_suspend to debug)\n"); |
892 | acquire_console_sem(); | 891 | acquire_console_sem(); |
893 | console_suspended = 1; | 892 | console_suspended = 1; |
893 | up(&console_sem); | ||
894 | } | 894 | } |
895 | 895 | ||
896 | void resume_console(void) | 896 | void resume_console(void) |
897 | { | 897 | { |
898 | if (!console_suspend_enabled) | 898 | if (!console_suspend_enabled) |
899 | return; | 899 | return; |
900 | down(&console_sem); | ||
900 | console_suspended = 0; | 901 | console_suspended = 0; |
901 | release_console_sem(); | 902 | release_console_sem(); |
902 | } | 903 | } |
@@ -912,11 +913,9 @@ void resume_console(void) | |||
912 | void acquire_console_sem(void) | 913 | void acquire_console_sem(void) |
913 | { | 914 | { |
914 | BUG_ON(in_interrupt()); | 915 | BUG_ON(in_interrupt()); |
915 | if (console_suspended) { | ||
916 | down(&secondary_console_sem); | ||
917 | return; | ||
918 | } | ||
919 | down(&console_sem); | 916 | down(&console_sem); |
917 | if (console_suspended) | ||
918 | return; | ||
920 | console_locked = 1; | 919 | console_locked = 1; |
921 | console_may_schedule = 1; | 920 | console_may_schedule = 1; |
922 | } | 921 | } |
@@ -926,6 +925,10 @@ int try_acquire_console_sem(void) | |||
926 | { | 925 | { |
927 | if (down_trylock(&console_sem)) | 926 | if (down_trylock(&console_sem)) |
928 | return -1; | 927 | return -1; |
928 | if (console_suspended) { | ||
929 | up(&console_sem); | ||
930 | return -1; | ||
931 | } | ||
929 | console_locked = 1; | 932 | console_locked = 1; |
930 | console_may_schedule = 0; | 933 | console_may_schedule = 0; |
931 | return 0; | 934 | return 0; |
@@ -979,7 +982,7 @@ void release_console_sem(void) | |||
979 | unsigned wake_klogd = 0; | 982 | unsigned wake_klogd = 0; |
980 | 983 | ||
981 | if (console_suspended) { | 984 | if (console_suspended) { |
982 | up(&secondary_console_sem); | 985 | up(&console_sem); |
983 | return; | 986 | return; |
984 | } | 987 | } |
985 | 988 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index 61245b8d0f16..7d97ff7c4478 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -6939,20 +6939,26 @@ static void free_rootdomain(struct root_domain *rd) | |||
6939 | 6939 | ||
6940 | static void rq_attach_root(struct rq *rq, struct root_domain *rd) | 6940 | static void rq_attach_root(struct rq *rq, struct root_domain *rd) |
6941 | { | 6941 | { |
6942 | struct root_domain *old_rd = NULL; | ||
6942 | unsigned long flags; | 6943 | unsigned long flags; |
6943 | 6944 | ||
6944 | spin_lock_irqsave(&rq->lock, flags); | 6945 | spin_lock_irqsave(&rq->lock, flags); |
6945 | 6946 | ||
6946 | if (rq->rd) { | 6947 | if (rq->rd) { |
6947 | struct root_domain *old_rd = rq->rd; | 6948 | old_rd = rq->rd; |
6948 | 6949 | ||
6949 | if (cpumask_test_cpu(rq->cpu, old_rd->online)) | 6950 | if (cpumask_test_cpu(rq->cpu, old_rd->online)) |
6950 | set_rq_offline(rq); | 6951 | set_rq_offline(rq); |
6951 | 6952 | ||
6952 | cpumask_clear_cpu(rq->cpu, old_rd->span); | 6953 | cpumask_clear_cpu(rq->cpu, old_rd->span); |
6953 | 6954 | ||
6954 | if (atomic_dec_and_test(&old_rd->refcount)) | 6955 | /* |
6955 | free_rootdomain(old_rd); | 6956 | * If we dont want to free the old_rt yet then |
6957 | * set old_rd to NULL to skip the freeing later | ||
6958 | * in this function: | ||
6959 | */ | ||
6960 | if (!atomic_dec_and_test(&old_rd->refcount)) | ||
6961 | old_rd = NULL; | ||
6956 | } | 6962 | } |
6957 | 6963 | ||
6958 | atomic_inc(&rd->refcount); | 6964 | atomic_inc(&rd->refcount); |
@@ -6963,6 +6969,9 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd) | |||
6963 | set_rq_online(rq); | 6969 | set_rq_online(rq); |
6964 | 6970 | ||
6965 | spin_unlock_irqrestore(&rq->lock, flags); | 6971 | spin_unlock_irqrestore(&rq->lock, flags); |
6972 | |||
6973 | if (old_rd) | ||
6974 | free_rootdomain(old_rd); | ||
6966 | } | 6975 | } |
6967 | 6976 | ||
6968 | static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) | 6977 | static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) |
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index e2a4ff6fc3a6..34e707e5ab87 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
@@ -52,6 +52,7 @@ config FUNCTION_TRACER | |||
52 | depends on HAVE_FUNCTION_TRACER | 52 | depends on HAVE_FUNCTION_TRACER |
53 | depends on DEBUG_KERNEL | 53 | depends on DEBUG_KERNEL |
54 | select FRAME_POINTER | 54 | select FRAME_POINTER |
55 | select KALLSYMS | ||
55 | select TRACING | 56 | select TRACING |
56 | select CONTEXT_SWITCH_TRACER | 57 | select CONTEXT_SWITCH_TRACER |
57 | help | 58 | help |
@@ -238,6 +239,7 @@ config STACK_TRACER | |||
238 | depends on DEBUG_KERNEL | 239 | depends on DEBUG_KERNEL |
239 | select FUNCTION_TRACER | 240 | select FUNCTION_TRACER |
240 | select STACKTRACE | 241 | select STACKTRACE |
242 | select KALLSYMS | ||
241 | help | 243 | help |
242 | This special tracer records the maximum stack footprint of the | 244 | This special tracer records the maximum stack footprint of the |
243 | kernel and displays it in debugfs/tracing/stack_trace. | 245 | kernel and displays it in debugfs/tracing/stack_trace. |
@@ -302,4 +304,27 @@ config FTRACE_STARTUP_TEST | |||
302 | functioning properly. It will do tests on all the configured | 304 | functioning properly. It will do tests on all the configured |
303 | tracers of ftrace. | 305 | tracers of ftrace. |
304 | 306 | ||
307 | config MMIOTRACE | ||
308 | bool "Memory mapped IO tracing" | ||
309 | depends on HAVE_MMIOTRACE_SUPPORT && DEBUG_KERNEL && PCI | ||
310 | select TRACING | ||
311 | help | ||
312 | Mmiotrace traces Memory Mapped I/O access and is meant for | ||
313 | debugging and reverse engineering. It is called from the ioremap | ||
314 | implementation and works via page faults. Tracing is disabled by | ||
315 | default and can be enabled at run-time. | ||
316 | |||
317 | See Documentation/tracers/mmiotrace.txt. | ||
318 | If you are not helping to develop drivers, say N. | ||
319 | |||
320 | config MMIOTRACE_TEST | ||
321 | tristate "Test module for mmiotrace" | ||
322 | depends on MMIOTRACE && m | ||
323 | help | ||
324 | This is a dumb module for testing mmiotrace. It is very dangerous | ||
325 | as it will write garbage to IO memory starting at a given address. | ||
326 | However, it should be safe to use on e.g. unused portion of VRAM. | ||
327 | |||
328 | Say N, unless you absolutely know what you are doing. | ||
329 | |||
305 | endmenu | 330 | endmenu |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 9a236ffe2aa4..fdf913dfc7e8 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -2033,7 +2033,7 @@ free: | |||
2033 | static int start_graph_tracing(void) | 2033 | static int start_graph_tracing(void) |
2034 | { | 2034 | { |
2035 | struct ftrace_ret_stack **ret_stack_list; | 2035 | struct ftrace_ret_stack **ret_stack_list; |
2036 | int ret; | 2036 | int ret, cpu; |
2037 | 2037 | ||
2038 | ret_stack_list = kmalloc(FTRACE_RETSTACK_ALLOC_SIZE * | 2038 | ret_stack_list = kmalloc(FTRACE_RETSTACK_ALLOC_SIZE * |
2039 | sizeof(struct ftrace_ret_stack *), | 2039 | sizeof(struct ftrace_ret_stack *), |
@@ -2042,6 +2042,10 @@ static int start_graph_tracing(void) | |||
2042 | if (!ret_stack_list) | 2042 | if (!ret_stack_list) |
2043 | return -ENOMEM; | 2043 | return -ENOMEM; |
2044 | 2044 | ||
2045 | /* The cpu_boot init_task->ret_stack will never be freed */ | ||
2046 | for_each_online_cpu(cpu) | ||
2047 | ftrace_graph_init_task(idle_task(cpu)); | ||
2048 | |||
2045 | do { | 2049 | do { |
2046 | ret = alloc_retstack_tasklist(ret_stack_list); | 2050 | ret = alloc_retstack_tasklist(ret_stack_list); |
2047 | } while (ret == -EAGAIN); | 2051 | } while (ret == -EAGAIN); |
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c index fffcb069f1dc..80e503ef6136 100644 --- a/kernel/trace/trace_mmiotrace.c +++ b/kernel/trace/trace_mmiotrace.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/mmiotrace.h> | 10 | #include <linux/mmiotrace.h> |
11 | #include <linux/pci.h> | 11 | #include <linux/pci.h> |
12 | #include <asm/atomic.h> | ||
12 | 13 | ||
13 | #include "trace.h" | 14 | #include "trace.h" |
14 | 15 | ||
@@ -19,6 +20,7 @@ struct header_iter { | |||
19 | static struct trace_array *mmio_trace_array; | 20 | static struct trace_array *mmio_trace_array; |
20 | static bool overrun_detected; | 21 | static bool overrun_detected; |
21 | static unsigned long prev_overruns; | 22 | static unsigned long prev_overruns; |
23 | static atomic_t dropped_count; | ||
22 | 24 | ||
23 | static void mmio_reset_data(struct trace_array *tr) | 25 | static void mmio_reset_data(struct trace_array *tr) |
24 | { | 26 | { |
@@ -121,11 +123,11 @@ static void mmio_close(struct trace_iterator *iter) | |||
121 | 123 | ||
122 | static unsigned long count_overruns(struct trace_iterator *iter) | 124 | static unsigned long count_overruns(struct trace_iterator *iter) |
123 | { | 125 | { |
124 | unsigned long cnt = 0; | 126 | unsigned long cnt = atomic_xchg(&dropped_count, 0); |
125 | unsigned long over = ring_buffer_overruns(iter->tr->buffer); | 127 | unsigned long over = ring_buffer_overruns(iter->tr->buffer); |
126 | 128 | ||
127 | if (over > prev_overruns) | 129 | if (over > prev_overruns) |
128 | cnt = over - prev_overruns; | 130 | cnt += over - prev_overruns; |
129 | prev_overruns = over; | 131 | prev_overruns = over; |
130 | return cnt; | 132 | return cnt; |
131 | } | 133 | } |
@@ -310,8 +312,10 @@ static void __trace_mmiotrace_rw(struct trace_array *tr, | |||
310 | 312 | ||
311 | event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), | 313 | event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), |
312 | &irq_flags); | 314 | &irq_flags); |
313 | if (!event) | 315 | if (!event) { |
316 | atomic_inc(&dropped_count); | ||
314 | return; | 317 | return; |
318 | } | ||
315 | entry = ring_buffer_event_data(event); | 319 | entry = ring_buffer_event_data(event); |
316 | tracing_generic_entry_update(&entry->ent, 0, preempt_count()); | 320 | tracing_generic_entry_update(&entry->ent, 0, preempt_count()); |
317 | entry->ent.type = TRACE_MMIO_RW; | 321 | entry->ent.type = TRACE_MMIO_RW; |
@@ -338,8 +342,10 @@ static void __trace_mmiotrace_map(struct trace_array *tr, | |||
338 | 342 | ||
339 | event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), | 343 | event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), |
340 | &irq_flags); | 344 | &irq_flags); |
341 | if (!event) | 345 | if (!event) { |
346 | atomic_inc(&dropped_count); | ||
342 | return; | 347 | return; |
348 | } | ||
343 | entry = ring_buffer_event_data(event); | 349 | entry = ring_buffer_event_data(event); |
344 | tracing_generic_entry_update(&entry->ent, 0, preempt_count()); | 350 | tracing_generic_entry_update(&entry->ent, 0, preempt_count()); |
345 | entry->ent.type = TRACE_MMIO_MAP; | 351 | entry->ent.type = TRACE_MMIO_MAP; |
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c index 88c8eb70f54a..bc8e80a86bca 100644 --- a/kernel/trace/trace_selftest.c +++ b/kernel/trace/trace_selftest.c | |||
@@ -23,10 +23,20 @@ static int trace_test_buffer_cpu(struct trace_array *tr, int cpu) | |||
23 | { | 23 | { |
24 | struct ring_buffer_event *event; | 24 | struct ring_buffer_event *event; |
25 | struct trace_entry *entry; | 25 | struct trace_entry *entry; |
26 | unsigned int loops = 0; | ||
26 | 27 | ||
27 | while ((event = ring_buffer_consume(tr->buffer, cpu, NULL))) { | 28 | while ((event = ring_buffer_consume(tr->buffer, cpu, NULL))) { |
28 | entry = ring_buffer_event_data(event); | 29 | entry = ring_buffer_event_data(event); |
29 | 30 | ||
31 | /* | ||
32 | * The ring buffer is a size of trace_buf_size, if | ||
33 | * we loop more than the size, there's something wrong | ||
34 | * with the ring buffer. | ||
35 | */ | ||
36 | if (loops++ > trace_buf_size) { | ||
37 | printk(KERN_CONT ".. bad ring buffer "); | ||
38 | goto failed; | ||
39 | } | ||
30 | if (!trace_valid_entry(entry)) { | 40 | if (!trace_valid_entry(entry)) { |
31 | printk(KERN_CONT ".. invalid entry %d ", | 41 | printk(KERN_CONT ".. invalid entry %d ", |
32 | entry->type); | 42 | entry->type); |
@@ -57,11 +67,20 @@ static int trace_test_buffer(struct trace_array *tr, unsigned long *count) | |||
57 | 67 | ||
58 | cnt = ring_buffer_entries(tr->buffer); | 68 | cnt = ring_buffer_entries(tr->buffer); |
59 | 69 | ||
70 | /* | ||
71 | * The trace_test_buffer_cpu runs a while loop to consume all data. | ||
72 | * If the calling tracer is broken, and is constantly filling | ||
73 | * the buffer, this will run forever, and hard lock the box. | ||
74 | * We disable the ring buffer while we do this test to prevent | ||
75 | * a hard lock up. | ||
76 | */ | ||
77 | tracing_off(); | ||
60 | for_each_possible_cpu(cpu) { | 78 | for_each_possible_cpu(cpu) { |
61 | ret = trace_test_buffer_cpu(tr, cpu); | 79 | ret = trace_test_buffer_cpu(tr, cpu); |
62 | if (ret) | 80 | if (ret) |
63 | break; | 81 | break; |
64 | } | 82 | } |
83 | tracing_on(); | ||
65 | __raw_spin_unlock(&ftrace_max_lock); | 84 | __raw_spin_unlock(&ftrace_max_lock); |
66 | local_irq_restore(flags); | 85 | local_irq_restore(flags); |
67 | 86 | ||
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 29044f500269..1bcf9cd4baa0 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -838,7 +838,7 @@ config FIREWIRE_OHCI_REMOTE_DMA | |||
838 | 838 | ||
839 | If unsure, say N. | 839 | If unsure, say N. |
840 | 840 | ||
841 | menuconfig BUILD_DOCSRC | 841 | config BUILD_DOCSRC |
842 | bool "Build targets in Documentation/ tree" | 842 | bool "Build targets in Documentation/ tree" |
843 | depends on HEADERS_CHECK | 843 | depends on HEADERS_CHECK |
844 | help | 844 | help |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 3c84128596ba..74dc57c74349 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -240,7 +240,7 @@ void bdi_writeout_inc(struct backing_dev_info *bdi) | |||
240 | } | 240 | } |
241 | EXPORT_SYMBOL_GPL(bdi_writeout_inc); | 241 | EXPORT_SYMBOL_GPL(bdi_writeout_inc); |
242 | 242 | ||
243 | static inline void task_dirty_inc(struct task_struct *tsk) | 243 | void task_dirty_inc(struct task_struct *tsk) |
244 | { | 244 | { |
245 | prop_inc_single(&vm_dirties, &tsk->dirties); | 245 | prop_inc_single(&vm_dirties, &tsk->dirties); |
246 | } | 246 | } |
@@ -1230,6 +1230,7 @@ int __set_page_dirty_nobuffers(struct page *page) | |||
1230 | __inc_zone_page_state(page, NR_FILE_DIRTY); | 1230 | __inc_zone_page_state(page, NR_FILE_DIRTY); |
1231 | __inc_bdi_stat(mapping->backing_dev_info, | 1231 | __inc_bdi_stat(mapping->backing_dev_info, |
1232 | BDI_RECLAIMABLE); | 1232 | BDI_RECLAIMABLE); |
1233 | task_dirty_inc(current); | ||
1233 | task_io_account_write(PAGE_CACHE_SIZE); | 1234 | task_io_account_write(PAGE_CACHE_SIZE); |
1234 | } | 1235 | } |
1235 | radix_tree_tag_set(&mapping->page_tree, | 1236 | radix_tree_tag_set(&mapping->page_tree, |
@@ -1262,7 +1263,7 @@ EXPORT_SYMBOL(redirty_page_for_writepage); | |||
1262 | * If the mapping doesn't provide a set_page_dirty a_op, then | 1263 | * If the mapping doesn't provide a set_page_dirty a_op, then |
1263 | * just fall through and assume that it wants buffer_heads. | 1264 | * just fall through and assume that it wants buffer_heads. |
1264 | */ | 1265 | */ |
1265 | static int __set_page_dirty(struct page *page) | 1266 | int set_page_dirty(struct page *page) |
1266 | { | 1267 | { |
1267 | struct address_space *mapping = page_mapping(page); | 1268 | struct address_space *mapping = page_mapping(page); |
1268 | 1269 | ||
@@ -1280,14 +1281,6 @@ static int __set_page_dirty(struct page *page) | |||
1280 | } | 1281 | } |
1281 | return 0; | 1282 | return 0; |
1282 | } | 1283 | } |
1283 | |||
1284 | int set_page_dirty(struct page *page) | ||
1285 | { | ||
1286 | int ret = __set_page_dirty(page); | ||
1287 | if (ret) | ||
1288 | task_dirty_inc(current); | ||
1289 | return ret; | ||
1290 | } | ||
1291 | EXPORT_SYMBOL(set_page_dirty); | 1284 | EXPORT_SYMBOL(set_page_dirty); |
1292 | 1285 | ||
1293 | /* | 1286 | /* |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5675b3073854..5c44ed49ca93 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2989,7 +2989,7 @@ static int __meminit next_active_region_index_in_nid(int index, int nid) | |||
2989 | * was used and there are no special requirements, this is a convenient | 2989 | * was used and there are no special requirements, this is a convenient |
2990 | * alternative | 2990 | * alternative |
2991 | */ | 2991 | */ |
2992 | int __meminit early_pfn_to_nid(unsigned long pfn) | 2992 | int __meminit __early_pfn_to_nid(unsigned long pfn) |
2993 | { | 2993 | { |
2994 | int i; | 2994 | int i; |
2995 | 2995 | ||
@@ -3000,10 +3000,33 @@ int __meminit early_pfn_to_nid(unsigned long pfn) | |||
3000 | if (start_pfn <= pfn && pfn < end_pfn) | 3000 | if (start_pfn <= pfn && pfn < end_pfn) |
3001 | return early_node_map[i].nid; | 3001 | return early_node_map[i].nid; |
3002 | } | 3002 | } |
3003 | /* This is a memory hole */ | ||
3004 | return -1; | ||
3005 | } | ||
3006 | #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ | ||
3007 | |||
3008 | int __meminit early_pfn_to_nid(unsigned long pfn) | ||
3009 | { | ||
3010 | int nid; | ||
3003 | 3011 | ||
3012 | nid = __early_pfn_to_nid(pfn); | ||
3013 | if (nid >= 0) | ||
3014 | return nid; | ||
3015 | /* just returns 0 */ | ||
3004 | return 0; | 3016 | return 0; |
3005 | } | 3017 | } |
3006 | #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ | 3018 | |
3019 | #ifdef CONFIG_NODES_SPAN_OTHER_NODES | ||
3020 | bool __meminit early_pfn_in_nid(unsigned long pfn, int node) | ||
3021 | { | ||
3022 | int nid; | ||
3023 | |||
3024 | nid = __early_pfn_to_nid(pfn); | ||
3025 | if (nid >= 0 && nid != node) | ||
3026 | return false; | ||
3027 | return true; | ||
3028 | } | ||
3029 | #endif | ||
3007 | 3030 | ||
3008 | /* Basic iterator support to walk early_node_map[] */ | 3031 | /* Basic iterator support to walk early_node_map[] */ |
3009 | #define for_each_active_range_index_in_nid(i, nid) \ | 3032 | #define for_each_active_range_index_in_nid(i, nid) \ |
diff --git a/mm/page_io.c b/mm/page_io.c index dc6ce0afbded..3023c475e041 100644 --- a/mm/page_io.c +++ b/mm/page_io.c | |||
@@ -111,7 +111,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) | |||
111 | goto out; | 111 | goto out; |
112 | } | 112 | } |
113 | if (wbc->sync_mode == WB_SYNC_ALL) | 113 | if (wbc->sync_mode == WB_SYNC_ALL) |
114 | rw |= (1 << BIO_RW_SYNC); | 114 | rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); |
115 | count_vm_event(PSWPOUT); | 115 | count_vm_event(PSWPOUT); |
116 | set_page_writeback(page); | 116 | set_page_writeback(page); |
117 | unlock_page(page); | 117 | unlock_page(page); |
diff --git a/mm/swapfile.c b/mm/swapfile.c index 7e6304dfafab..312fafe0ab6e 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -635,7 +635,7 @@ int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p) | |||
635 | 635 | ||
636 | if (!bdev) { | 636 | if (!bdev) { |
637 | if (bdev_p) | 637 | if (bdev_p) |
638 | *bdev_p = sis->bdev; | 638 | *bdev_p = bdget(sis->bdev->bd_dev); |
639 | 639 | ||
640 | spin_unlock(&swap_lock); | 640 | spin_unlock(&swap_lock); |
641 | return i; | 641 | return i; |
@@ -647,7 +647,7 @@ int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p) | |||
647 | struct swap_extent, list); | 647 | struct swap_extent, list); |
648 | if (se->start_block == offset) { | 648 | if (se->start_block == offset) { |
649 | if (bdev_p) | 649 | if (bdev_p) |
650 | *bdev_p = sis->bdev; | 650 | *bdev_p = bdget(sis->bdev->bd_dev); |
651 | 651 | ||
652 | spin_unlock(&swap_lock); | 652 | spin_unlock(&swap_lock); |
653 | bdput(bdev); | 653 | bdput(bdev); |
@@ -129,6 +129,26 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags) | |||
129 | } | 129 | } |
130 | EXPORT_SYMBOL(krealloc); | 130 | EXPORT_SYMBOL(krealloc); |
131 | 131 | ||
132 | /** | ||
133 | * kzfree - like kfree but zero memory | ||
134 | * @p: object to free memory of | ||
135 | * | ||
136 | * The memory of the object @p points to is zeroed before freed. | ||
137 | * If @p is %NULL, kzfree() does nothing. | ||
138 | */ | ||
139 | void kzfree(const void *p) | ||
140 | { | ||
141 | size_t ks; | ||
142 | void *mem = (void *)p; | ||
143 | |||
144 | if (unlikely(ZERO_OR_NULL_PTR(mem))) | ||
145 | return; | ||
146 | ks = ksize(mem); | ||
147 | memset(mem, 0, ks); | ||
148 | kfree(mem); | ||
149 | } | ||
150 | EXPORT_SYMBOL(kzfree); | ||
151 | |||
132 | /* | 152 | /* |
133 | * strndup_user - duplicate an existing string from user space | 153 | * strndup_user - duplicate an existing string from user space |
134 | * @s: The string to duplicate | 154 | * @s: The string to duplicate |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 75f49d312e8c..903cad46e796 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -1012,6 +1012,8 @@ void __init vmalloc_init(void) | |||
1012 | void unmap_kernel_range(unsigned long addr, unsigned long size) | 1012 | void unmap_kernel_range(unsigned long addr, unsigned long size) |
1013 | { | 1013 | { |
1014 | unsigned long end = addr + size; | 1014 | unsigned long end = addr + size; |
1015 | |||
1016 | flush_cache_vunmap(addr, end); | ||
1015 | vunmap_page_range(addr, end); | 1017 | vunmap_page_range(addr, end); |
1016 | flush_tlb_kernel_range(addr, end); | 1018 | flush_tlb_kernel_range(addr, end); |
1017 | } | 1019 | } |
@@ -1106,6 +1108,14 @@ struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, | |||
1106 | } | 1108 | } |
1107 | EXPORT_SYMBOL_GPL(__get_vm_area); | 1109 | EXPORT_SYMBOL_GPL(__get_vm_area); |
1108 | 1110 | ||
1111 | struct vm_struct *__get_vm_area_caller(unsigned long size, unsigned long flags, | ||
1112 | unsigned long start, unsigned long end, | ||
1113 | void *caller) | ||
1114 | { | ||
1115 | return __get_vm_area_node(size, flags, start, end, -1, GFP_KERNEL, | ||
1116 | caller); | ||
1117 | } | ||
1118 | |||
1109 | /** | 1119 | /** |
1110 | * get_vm_area - reserve a contiguous kernel virtual area | 1120 | * get_vm_area - reserve a contiguous kernel virtual area |
1111 | * @size: size of the area | 1121 | * @size: size of the area |
diff --git a/mm/vmscan.c b/mm/vmscan.c index 9a27c44aa327..6177e3bcd66b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -2057,31 +2057,31 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int prio, | |||
2057 | int pass, struct scan_control *sc) | 2057 | int pass, struct scan_control *sc) |
2058 | { | 2058 | { |
2059 | struct zone *zone; | 2059 | struct zone *zone; |
2060 | unsigned long nr_to_scan, ret = 0; | 2060 | unsigned long ret = 0; |
2061 | enum lru_list l; | ||
2062 | 2061 | ||
2063 | for_each_zone(zone) { | 2062 | for_each_zone(zone) { |
2063 | enum lru_list l; | ||
2064 | 2064 | ||
2065 | if (!populated_zone(zone)) | 2065 | if (!populated_zone(zone)) |
2066 | continue; | 2066 | continue; |
2067 | |||
2068 | if (zone_is_all_unreclaimable(zone) && prio != DEF_PRIORITY) | 2067 | if (zone_is_all_unreclaimable(zone) && prio != DEF_PRIORITY) |
2069 | continue; | 2068 | continue; |
2070 | 2069 | ||
2071 | for_each_evictable_lru(l) { | 2070 | for_each_evictable_lru(l) { |
2071 | enum zone_stat_item ls = NR_LRU_BASE + l; | ||
2072 | unsigned long lru_pages = zone_page_state(zone, ls); | ||
2073 | |||
2072 | /* For pass = 0, we don't shrink the active list */ | 2074 | /* For pass = 0, we don't shrink the active list */ |
2073 | if (pass == 0 && | 2075 | if (pass == 0 && (l == LRU_ACTIVE_ANON || |
2074 | (l == LRU_ACTIVE || l == LRU_ACTIVE_FILE)) | 2076 | l == LRU_ACTIVE_FILE)) |
2075 | continue; | 2077 | continue; |
2076 | 2078 | ||
2077 | zone->lru[l].nr_scan += | 2079 | zone->lru[l].nr_scan += (lru_pages >> prio) + 1; |
2078 | (zone_page_state(zone, NR_LRU_BASE + l) | ||
2079 | >> prio) + 1; | ||
2080 | if (zone->lru[l].nr_scan >= nr_pages || pass > 3) { | 2080 | if (zone->lru[l].nr_scan >= nr_pages || pass > 3) { |
2081 | unsigned long nr_to_scan; | ||
2082 | |||
2081 | zone->lru[l].nr_scan = 0; | 2083 | zone->lru[l].nr_scan = 0; |
2082 | nr_to_scan = min(nr_pages, | 2084 | nr_to_scan = min(nr_pages, lru_pages); |
2083 | zone_page_state(zone, | ||
2084 | NR_LRU_BASE + l)); | ||
2085 | ret += shrink_list(l, nr_to_scan, zone, | 2085 | ret += shrink_list(l, nr_to_scan, zone, |
2086 | sc, prio); | 2086 | sc, prio); |
2087 | if (ret >= nr_pages) | 2087 | if (ret >= nr_pages) |
@@ -2089,7 +2089,6 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int prio, | |||
2089 | } | 2089 | } |
2090 | } | 2090 | } |
2091 | } | 2091 | } |
2092 | |||
2093 | return ret; | 2092 | return ret; |
2094 | } | 2093 | } |
2095 | 2094 | ||
@@ -2112,7 +2111,6 @@ unsigned long shrink_all_memory(unsigned long nr_pages) | |||
2112 | .may_swap = 0, | 2111 | .may_swap = 0, |
2113 | .swap_cluster_max = nr_pages, | 2112 | .swap_cluster_max = nr_pages, |
2114 | .may_writepage = 1, | 2113 | .may_writepage = 1, |
2115 | .swappiness = vm_swappiness, | ||
2116 | .isolate_pages = isolate_pages_global, | 2114 | .isolate_pages = isolate_pages_global, |
2117 | }; | 2115 | }; |
2118 | 2116 | ||
@@ -2146,10 +2144,8 @@ unsigned long shrink_all_memory(unsigned long nr_pages) | |||
2146 | int prio; | 2144 | int prio; |
2147 | 2145 | ||
2148 | /* Force reclaiming mapped pages in the passes #3 and #4 */ | 2146 | /* Force reclaiming mapped pages in the passes #3 and #4 */ |
2149 | if (pass > 2) { | 2147 | if (pass > 2) |
2150 | sc.may_swap = 1; | 2148 | sc.may_swap = 1; |
2151 | sc.swappiness = 100; | ||
2152 | } | ||
2153 | 2149 | ||
2154 | for (prio = DEF_PRIORITY; prio >= 0; prio--) { | 2150 | for (prio = DEF_PRIORITY; prio >= 0; prio--) { |
2155 | unsigned long nr_to_scan = nr_pages - ret; | 2151 | unsigned long nr_to_scan = nr_pages - ret; |
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index 6bb2635b5ded..7bc992976d29 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c | |||
@@ -3,11 +3,16 @@ | |||
3 | * | 3 | * |
4 | * This is an implementation of the CIPSO 2.2 protocol as specified in | 4 | * This is an implementation of the CIPSO 2.2 protocol as specified in |
5 | * draft-ietf-cipso-ipsecurity-01.txt with additional tag types as found in | 5 | * draft-ietf-cipso-ipsecurity-01.txt with additional tag types as found in |
6 | * FIPS-188, copies of both documents can be found in the Documentation | 6 | * FIPS-188. While CIPSO never became a full IETF RFC standard many vendors |
7 | * directory. While CIPSO never became a full IETF RFC standard many vendors | ||
8 | * have chosen to adopt the protocol and over the years it has become a | 7 | * have chosen to adopt the protocol and over the years it has become a |
9 | * de-facto standard for labeled networking. | 8 | * de-facto standard for labeled networking. |
10 | * | 9 | * |
10 | * The CIPSO draft specification can be found in the kernel's Documentation | ||
11 | * directory as well as the following URL: | ||
12 | * http://netlabel.sourceforge.net/files/draft-ietf-cipso-ipsecurity-01.txt | ||
13 | * The FIPS-188 specification can be found at the following URL: | ||
14 | * http://www.itl.nist.gov/fipspubs/fip188.htm | ||
15 | * | ||
11 | * Author: Paul Moore <paul.moore@hp.com> | 16 | * Author: Paul Moore <paul.moore@hp.com> |
12 | * | 17 | * |
13 | */ | 18 | */ |
diff --git a/scripts/bootgraph.pl b/scripts/bootgraph.pl index b0246307aac4..12caa822a232 100644 --- a/scripts/bootgraph.pl +++ b/scripts/bootgraph.pl | |||
@@ -51,7 +51,7 @@ my %pidctr; | |||
51 | 51 | ||
52 | while (<>) { | 52 | while (<>) { |
53 | my $line = $_; | 53 | my $line = $_; |
54 | if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_]+)\+/) { | 54 | if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_\.]+)\+/) { |
55 | my $func = $2; | 55 | my $func = $2; |
56 | if ($done == 0) { | 56 | if ($done == 0) { |
57 | $start{$func} = $1; | 57 | $start{$func} = $1; |
@@ -87,7 +87,7 @@ while (<>) { | |||
87 | $count = $count + 1; | 87 | $count = $count + 1; |
88 | } | 88 | } |
89 | 89 | ||
90 | if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_]+)\+.*returned/) { | 90 | if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_\.]+)\+.*returned/) { |
91 | if ($done == 0) { | 91 | if ($done == 0) { |
92 | $end{$2} = $1; | 92 | $end{$2} = $1; |
93 | $maxtime = $1; | 93 | $maxtime = $1; |
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index d40449cafa84..528492bcba5b 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl -w | 1 | #!/usr/bin/perl |
2 | 2 | ||
3 | use File::Basename; | 3 | use File::Basename; |
4 | 4 | ||
@@ -29,27 +29,151 @@ my $filename = $vmlinux_name; | |||
29 | my $target = "0"; | 29 | my $target = "0"; |
30 | my $function; | 30 | my $function; |
31 | my $module = ""; | 31 | my $module = ""; |
32 | my $func_offset; | 32 | my $func_offset = 0; |
33 | my $vmaoffset = 0; | 33 | my $vmaoffset = 0; |
34 | 34 | ||
35 | my %regs; | ||
36 | |||
37 | |||
38 | sub parse_x86_regs | ||
39 | { | ||
40 | my ($line) = @_; | ||
41 | if ($line =~ /EAX: ([0-9a-f]+) EBX: ([0-9a-f]+) ECX: ([0-9a-f]+) EDX: ([0-9a-f]+)/) { | ||
42 | $regs{"%eax"} = $1; | ||
43 | $regs{"%ebx"} = $2; | ||
44 | $regs{"%ecx"} = $3; | ||
45 | $regs{"%edx"} = $4; | ||
46 | } | ||
47 | if ($line =~ /ESI: ([0-9a-f]+) EDI: ([0-9a-f]+) EBP: ([0-9a-f]+) ESP: ([0-9a-f]+)/) { | ||
48 | $regs{"%esi"} = $1; | ||
49 | $regs{"%edi"} = $2; | ||
50 | $regs{"%esp"} = $4; | ||
51 | } | ||
52 | if ($line =~ /RAX: ([0-9a-f]+) RBX: ([0-9a-f]+) RCX: ([0-9a-f]+)/) { | ||
53 | $regs{"%eax"} = $1; | ||
54 | $regs{"%ebx"} = $2; | ||
55 | $regs{"%ecx"} = $3; | ||
56 | } | ||
57 | if ($line =~ /RDX: ([0-9a-f]+) RSI: ([0-9a-f]+) RDI: ([0-9a-f]+)/) { | ||
58 | $regs{"%edx"} = $1; | ||
59 | $regs{"%esi"} = $2; | ||
60 | $regs{"%edi"} = $3; | ||
61 | } | ||
62 | if ($line =~ /RBP: ([0-9a-f]+) R08: ([0-9a-f]+) R09: ([0-9a-f]+)/) { | ||
63 | $regs{"%r08"} = $2; | ||
64 | $regs{"%r09"} = $3; | ||
65 | } | ||
66 | if ($line =~ /R10: ([0-9a-f]+) R11: ([0-9a-f]+) R12: ([0-9a-f]+)/) { | ||
67 | $regs{"%r10"} = $1; | ||
68 | $regs{"%r11"} = $2; | ||
69 | $regs{"%r12"} = $3; | ||
70 | } | ||
71 | if ($line =~ /R13: ([0-9a-f]+) R14: ([0-9a-f]+) R15: ([0-9a-f]+)/) { | ||
72 | $regs{"%r13"} = $1; | ||
73 | $regs{"%r14"} = $2; | ||
74 | $regs{"%r15"} = $3; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | sub reg_name | ||
79 | { | ||
80 | my ($reg) = @_; | ||
81 | $reg =~ s/r(.)x/e\1x/; | ||
82 | $reg =~ s/r(.)i/e\1i/; | ||
83 | $reg =~ s/r(.)p/e\1p/; | ||
84 | return $reg; | ||
85 | } | ||
86 | |||
87 | sub process_x86_regs | ||
88 | { | ||
89 | my ($line, $cntr) = @_; | ||
90 | my $str = ""; | ||
91 | if (length($line) < 40) { | ||
92 | return ""; # not an asm istruction | ||
93 | } | ||
94 | |||
95 | # find the arguments to the instruction | ||
96 | if ($line =~ /([0-9a-zA-Z\,\%\(\)\-\+]+)$/) { | ||
97 | $lastword = $1; | ||
98 | } else { | ||
99 | return ""; | ||
100 | } | ||
101 | |||
102 | # we need to find the registers that get clobbered, | ||
103 | # since their value is no longer relevant for previous | ||
104 | # instructions in the stream. | ||
105 | |||
106 | $clobber = $lastword; | ||
107 | # first, remove all memory operands, they're read only | ||
108 | $clobber =~ s/\([a-z0-9\%\,]+\)//g; | ||
109 | # then, remove everything before the comma, thats the read part | ||
110 | $clobber =~ s/.*\,//g; | ||
111 | |||
112 | # if this is the instruction that faulted, we haven't actually done | ||
113 | # the write yet... nothing is clobbered. | ||
114 | if ($cntr == 0) { | ||
115 | $clobber = ""; | ||
116 | } | ||
117 | |||
118 | foreach $reg (keys(%regs)) { | ||
119 | my $clobberprime = reg_name($clobber); | ||
120 | my $lastwordprime = reg_name($lastword); | ||
121 | my $val = $regs{$reg}; | ||
122 | if ($val =~ /^[0]+$/) { | ||
123 | $val = "0"; | ||
124 | } else { | ||
125 | $val =~ s/^0*//; | ||
126 | } | ||
127 | |||
128 | # first check if we're clobbering this register; if we do | ||
129 | # we print it with a =>, and then delete its value | ||
130 | if ($clobber =~ /$reg/ || $clobberprime =~ /$reg/) { | ||
131 | if (length($val) > 0) { | ||
132 | $str = $str . " $reg => $val "; | ||
133 | } | ||
134 | $regs{$reg} = ""; | ||
135 | $val = ""; | ||
136 | } | ||
137 | # now check if we're reading this register | ||
138 | if ($lastword =~ /$reg/ || $lastwordprime =~ /$reg/) { | ||
139 | if (length($val) > 0) { | ||
140 | $str = $str . " $reg = $val "; | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | return $str; | ||
145 | } | ||
146 | |||
147 | # parse the oops | ||
35 | while (<STDIN>) { | 148 | while (<STDIN>) { |
36 | my $line = $_; | 149 | my $line = $_; |
37 | if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) { | 150 | if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) { |
38 | $target = $1; | 151 | $target = $1; |
39 | } | 152 | } |
153 | if ($line =~ /RIP: 0010:\[\<([a-z0-9]+)\>\]/) { | ||
154 | $target = $1; | ||
155 | } | ||
40 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { | 156 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { |
41 | $function = $1; | 157 | $function = $1; |
42 | $func_offset = $2; | 158 | $func_offset = $2; |
43 | } | 159 | } |
160 | if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { | ||
161 | $function = $1; | ||
162 | $func_offset = $2; | ||
163 | } | ||
44 | 164 | ||
45 | # check if it's a module | 165 | # check if it's a module |
46 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { | 166 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { |
47 | $module = $3; | 167 | $module = $3; |
48 | } | 168 | } |
169 | if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { | ||
170 | $module = $3; | ||
171 | } | ||
172 | parse_x86_regs($line); | ||
49 | } | 173 | } |
50 | 174 | ||
51 | my $decodestart = hex($target) - hex($func_offset); | 175 | my $decodestart = hex($target) - hex($func_offset); |
52 | my $decodestop = $decodestart + 8192; | 176 | my $decodestop = hex($target) + 8192; |
53 | if ($target eq "0") { | 177 | if ($target eq "0") { |
54 | print "No oops found!\n"; | 178 | print "No oops found!\n"; |
55 | print "Usage: \n"; | 179 | print "Usage: \n"; |
@@ -84,6 +208,7 @@ my $counter = 0; | |||
84 | my $state = 0; | 208 | my $state = 0; |
85 | my $center = 0; | 209 | my $center = 0; |
86 | my @lines; | 210 | my @lines; |
211 | my @reglines; | ||
87 | 212 | ||
88 | sub InRange { | 213 | sub InRange { |
89 | my ($address, $target) = @_; | 214 | my ($address, $target) = @_; |
@@ -188,16 +313,36 @@ while ($finish < $counter) { | |||
188 | 313 | ||
189 | my $i; | 314 | my $i; |
190 | 315 | ||
191 | my $fulltext = ""; | 316 | |
317 | # start annotating the registers in the asm. | ||
318 | # this goes from the oopsing point back, so that the annotator | ||
319 | # can track (opportunistically) which registers got written and | ||
320 | # whos value no longer is relevant. | ||
321 | |||
322 | $i = $center; | ||
323 | while ($i >= $start) { | ||
324 | $reglines[$i] = process_x86_regs($lines[$i], $center - $i); | ||
325 | $i = $i - 1; | ||
326 | } | ||
327 | |||
192 | $i = $start; | 328 | $i = $start; |
193 | while ($i < $finish) { | 329 | while ($i < $finish) { |
330 | my $line; | ||
194 | if ($i == $center) { | 331 | if ($i == $center) { |
195 | $fulltext = $fulltext . "*$lines[$i] <----- faulting instruction\n"; | 332 | $line = "*$lines[$i] "; |
196 | } else { | 333 | } else { |
197 | $fulltext = $fulltext . " $lines[$i]\n"; | 334 | $line = " $lines[$i] "; |
335 | } | ||
336 | print $line; | ||
337 | if (defined($reglines[$i]) && length($reglines[$i]) > 0) { | ||
338 | my $c = 60 - length($line); | ||
339 | while ($c > 0) { print " "; $c = $c - 1; }; | ||
340 | print "| $reglines[$i]"; | ||
198 | } | 341 | } |
342 | if ($i == $center) { | ||
343 | print "<--- faulting instruction"; | ||
344 | } | ||
345 | print "\n"; | ||
199 | $i = $i +1; | 346 | $i = $i +1; |
200 | } | 347 | } |
201 | 348 | ||
202 | print $fulltext; | ||
203 | |||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 491b8b1b6abf..4eea60b1693e 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -210,6 +210,7 @@ static void do_usb_table(void *symval, unsigned long size, | |||
210 | static int do_hid_entry(const char *filename, | 210 | static int do_hid_entry(const char *filename, |
211 | struct hid_device_id *id, char *alias) | 211 | struct hid_device_id *id, char *alias) |
212 | { | 212 | { |
213 | id->bus = TO_NATIVE(id->bus); | ||
213 | id->vendor = TO_NATIVE(id->vendor); | 214 | id->vendor = TO_NATIVE(id->vendor); |
214 | id->product = TO_NATIVE(id->product); | 215 | id->product = TO_NATIVE(id->product); |
215 | 216 | ||
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 2500886fb90a..ee448cdc6a2b 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
@@ -86,6 +86,14 @@ echo "%endif" | |||
86 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" | 86 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" |
87 | 87 | ||
88 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" | 88 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" |
89 | |||
90 | echo "%ifnarch ppc64" | ||
91 | echo 'cp vmlinux vmlinux.orig' | ||
92 | echo 'bzip2 -9 vmlinux' | ||
93 | echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" | ||
94 | echo 'mv vmlinux.orig vmlinux' | ||
95 | echo "%endif" | ||
96 | |||
89 | echo "" | 97 | echo "" |
90 | echo "%clean" | 98 | echo "%clean" |
91 | echo '#echo -rf $RPM_BUILD_ROOT' | 99 | echo '#echo -rf $RPM_BUILD_ROOT' |
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index f6946cf99ce1..f1c4b35bc324 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -58,14 +58,7 @@ fi | |||
58 | # Check for svn and a svn repo. | 58 | # Check for svn and a svn repo. |
59 | if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then | 59 | if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then |
60 | rev=`echo $rev | awk '{print $NF}'` | 60 | rev=`echo $rev | awk '{print $NF}'` |
61 | changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` | 61 | printf -- '-svn%s' "$rev" |
62 | |||
63 | # Are there uncommitted changes? | ||
64 | if [ $changes != 0 ]; then | ||
65 | printf -- '-svn%s%s' "$rev" -dirty | ||
66 | else | ||
67 | printf -- '-svn%s' "$rev" | ||
68 | fi | ||
69 | 62 | ||
70 | # All done with svn | 63 | # All done with svn |
71 | exit | 64 | exit |
diff --git a/scripts/tags.sh b/scripts/tags.sh index fdbe78bb5e2b..5bd8b1003d44 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -76,7 +76,10 @@ all_sources() | |||
76 | 76 | ||
77 | all_kconfigs() | 77 | all_kconfigs() |
78 | { | 78 | { |
79 | find_sources $ALLSOURCE_ARCHS 'Kconfig*' | 79 | for arch in $ALLSOURCE_ARCHS; do |
80 | find_sources $arch 'Kconfig*' | ||
81 | done | ||
82 | find_other_sources 'Kconfig*' | ||
80 | } | 83 | } |
81 | 84 | ||
82 | all_defconfigs() | 85 | all_defconfigs() |
@@ -99,7 +102,8 @@ exuberant() | |||
99 | -I ____cacheline_internodealigned_in_smp \ | 102 | -I ____cacheline_internodealigned_in_smp \ |
100 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | 103 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
101 | --extra=+f --c-kinds=+px \ | 104 | --extra=+f --c-kinds=+px \ |
102 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' | 105 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ |
106 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' | ||
103 | 107 | ||
104 | all_kconfigs | xargs $1 -a \ | 108 | all_kconfigs | xargs $1 -a \ |
105 | --langdef=kconfig --language-force=kconfig \ | 109 | --langdef=kconfig --language-force=kconfig \ |
@@ -117,7 +121,9 @@ exuberant() | |||
117 | 121 | ||
118 | emacs() | 122 | emacs() |
119 | { | 123 | { |
120 | all_sources | xargs $1 -a | 124 | all_sources | xargs $1 -a \ |
125 | --regex='/^ENTRY(\([^)]*\)).*/\1/' \ | ||
126 | --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' | ||
121 | 127 | ||
122 | all_kconfigs | xargs $1 -a \ | 128 | all_kconfigs | xargs $1 -a \ |
123 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' | 129 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' |
diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c index f58701a7b728..3f4b26647386 100644 --- a/security/selinux/netlabel.c +++ b/security/selinux/netlabel.c | |||
@@ -490,8 +490,10 @@ int selinux_netlbl_socket_setsockopt(struct socket *sock, | |||
490 | lock_sock(sk); | 490 | lock_sock(sk); |
491 | rc = netlbl_sock_getattr(sk, &secattr); | 491 | rc = netlbl_sock_getattr(sk, &secattr); |
492 | release_sock(sk); | 492 | release_sock(sk); |
493 | if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE) | 493 | if (rc == 0) |
494 | rc = -EACCES; | 494 | rc = -EACCES; |
495 | else if (rc == -ENOMSG) | ||
496 | rc = 0; | ||
495 | netlbl_secattr_destroy(&secattr); | 497 | netlbl_secattr_destroy(&secattr); |
496 | } | 498 | } |
497 | 499 | ||
diff --git a/sound/core/jack.c b/sound/core/jack.c index dd4a12dc09aa..077a85262c1c 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c | |||
@@ -47,7 +47,7 @@ static int snd_jack_dev_register(struct snd_device *device) | |||
47 | int err; | 47 | int err; |
48 | 48 | ||
49 | snprintf(jack->name, sizeof(jack->name), "%s %s", | 49 | snprintf(jack->name, sizeof(jack->name), "%s %s", |
50 | card->longname, jack->id); | 50 | card->shortname, jack->id); |
51 | jack->input_dev->name = jack->name; | 51 | jack->input_dev->name = jack->name; |
52 | 52 | ||
53 | /* Default to the sound card device. */ | 53 | /* Default to the sound card device. */ |
diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c index 57d9f154c88b..38931f2f6967 100644 --- a/sound/oss/dmasound/dmasound_atari.c +++ b/sound/oss/dmasound/dmasound_atari.c | |||
@@ -847,23 +847,23 @@ static int __init AtaIrqInit(void) | |||
847 | of events. So all we need to keep the music playing is | 847 | of events. So all we need to keep the music playing is |
848 | to provide the sound hardware with new data upon | 848 | to provide the sound hardware with new data upon |
849 | an interrupt from timer A. */ | 849 | an interrupt from timer A. */ |
850 | mfp.tim_ct_a = 0; /* ++roman: Stop timer before programming! */ | 850 | st_mfp.tim_ct_a = 0; /* ++roman: Stop timer before programming! */ |
851 | mfp.tim_dt_a = 1; /* Cause interrupt after first event. */ | 851 | st_mfp.tim_dt_a = 1; /* Cause interrupt after first event. */ |
852 | mfp.tim_ct_a = 8; /* Turn on event counting. */ | 852 | st_mfp.tim_ct_a = 8; /* Turn on event counting. */ |
853 | /* Register interrupt handler. */ | 853 | /* Register interrupt handler. */ |
854 | if (request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound", | 854 | if (request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound", |
855 | AtaInterrupt)) | 855 | AtaInterrupt)) |
856 | return 0; | 856 | return 0; |
857 | mfp.int_en_a |= 0x20; /* Turn interrupt on. */ | 857 | st_mfp.int_en_a |= 0x20; /* Turn interrupt on. */ |
858 | mfp.int_mk_a |= 0x20; | 858 | st_mfp.int_mk_a |= 0x20; |
859 | return 1; | 859 | return 1; |
860 | } | 860 | } |
861 | 861 | ||
862 | #ifdef MODULE | 862 | #ifdef MODULE |
863 | static void AtaIrqCleanUp(void) | 863 | static void AtaIrqCleanUp(void) |
864 | { | 864 | { |
865 | mfp.tim_ct_a = 0; /* stop timer */ | 865 | st_mfp.tim_ct_a = 0; /* stop timer */ |
866 | mfp.int_en_a &= ~0x20; /* turn interrupt off */ | 866 | st_mfp.int_en_a &= ~0x20; /* turn interrupt off */ |
867 | free_irq(IRQ_MFP_TIMA, AtaInterrupt); | 867 | free_irq(IRQ_MFP_TIMA, AtaInterrupt); |
868 | } | 868 | } |
869 | #endif /* MODULE */ | 869 | #endif /* MODULE */ |
@@ -1599,7 +1599,7 @@ static int __init dmasound_atari_init(void) | |||
1599 | is_falcon = 0; | 1599 | is_falcon = 0; |
1600 | } else | 1600 | } else |
1601 | return -ENODEV; | 1601 | return -ENODEV; |
1602 | if ((mfp.int_en_a & mfp.int_mk_a & 0x20) == 0) | 1602 | if ((st_mfp.int_en_a & st_mfp.int_mk_a & 0x20) == 0) |
1603 | return dmasound_init(); | 1603 | return dmasound_init(); |
1604 | else { | 1604 | else { |
1605 | printk("DMA sound driver: Timer A interrupt already in use\n"); | 1605 | printk("DMA sound driver: Timer A interrupt already in use\n"); |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 11e791b965f6..c8d9178f47e5 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -1947,16 +1947,13 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state) | |||
1947 | return 0; | 1947 | return 0; |
1948 | } | 1948 | } |
1949 | 1949 | ||
1950 | static int azx_resume_early(struct pci_dev *pci) | ||
1951 | { | ||
1952 | return pci_restore_state(pci); | ||
1953 | } | ||
1954 | |||
1955 | static int azx_resume(struct pci_dev *pci) | 1950 | static int azx_resume(struct pci_dev *pci) |
1956 | { | 1951 | { |
1957 | struct snd_card *card = pci_get_drvdata(pci); | 1952 | struct snd_card *card = pci_get_drvdata(pci); |
1958 | struct azx *chip = card->private_data; | 1953 | struct azx *chip = card->private_data; |
1959 | 1954 | ||
1955 | pci_set_power_state(pci, PCI_D0); | ||
1956 | pci_restore_state(pci); | ||
1960 | if (pci_enable_device(pci) < 0) { | 1957 | if (pci_enable_device(pci) < 0) { |
1961 | printk(KERN_ERR "hda-intel: pci_enable_device failed, " | 1958 | printk(KERN_ERR "hda-intel: pci_enable_device failed, " |
1962 | "disabling device\n"); | 1959 | "disabling device\n"); |
@@ -2468,7 +2465,6 @@ static struct pci_driver driver = { | |||
2468 | .remove = __devexit_p(azx_remove), | 2465 | .remove = __devexit_p(azx_remove), |
2469 | #ifdef CONFIG_PM | 2466 | #ifdef CONFIG_PM |
2470 | .suspend = azx_suspend, | 2467 | .suspend = azx_suspend, |
2471 | .resume_early = azx_resume_early, | ||
2472 | .resume = azx_resume, | 2468 | .resume = azx_resume, |
2473 | #endif | 2469 | #endif |
2474 | }; | 2470 | }; |
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 18c7c91786bc..6c870c12a177 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c | |||
@@ -26,7 +26,7 @@ | |||
26 | * SPI 0 -> 1st PCM1796 (front) | 26 | * SPI 0 -> 1st PCM1796 (front) |
27 | * SPI 1 -> 2nd PCM1796 (surround) | 27 | * SPI 1 -> 2nd PCM1796 (surround) |
28 | * SPI 2 -> 3rd PCM1796 (center/LFE) | 28 | * SPI 2 -> 3rd PCM1796 (center/LFE) |
29 | * SPI 4 -> 4th PCM1796 (back) and EEPROM self-destruct (do not use!) | 29 | * SPI 4 -> 4th PCM1796 (back) |
30 | * | 30 | * |
31 | * GPIO 2 -> M0 of CS5381 | 31 | * GPIO 2 -> M0 of CS5381 |
32 | * GPIO 3 -> M1 of CS5381 | 32 | * GPIO 3 -> M1 of CS5381 |
@@ -207,12 +207,6 @@ static void xonar_gpio_changed(struct oxygen *chip); | |||
207 | static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, | 207 | static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, |
208 | u8 reg, u8 value) | 208 | u8 reg, u8 value) |
209 | { | 209 | { |
210 | /* | ||
211 | * We don't want to do writes on SPI 4 because the EEPROM, which shares | ||
212 | * the same pin, might get confused and broken. We'd better take care | ||
213 | * that the driver works with the default register values ... | ||
214 | */ | ||
215 | #if 0 | ||
216 | /* maps ALSA channel pair number to SPI output */ | 210 | /* maps ALSA channel pair number to SPI output */ |
217 | static const u8 codec_map[4] = { | 211 | static const u8 codec_map[4] = { |
218 | 0, 1, 2, 4 | 212 | 0, 1, 2, 4 |
@@ -223,7 +217,6 @@ static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec, | |||
223 | (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) | | 217 | (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) | |
224 | OXYGEN_SPI_CEN_LATCH_CLOCK_HI, | 218 | OXYGEN_SPI_CEN_LATCH_CLOCK_HI, |
225 | (reg << 8) | value); | 219 | (reg << 8) | value); |
226 | #endif | ||
227 | } | 220 | } |
228 | 221 | ||
229 | static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec, | 222 | static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec, |
@@ -757,9 +750,6 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0); | |||
757 | 750 | ||
758 | static int xonar_d2_control_filter(struct snd_kcontrol_new *template) | 751 | static int xonar_d2_control_filter(struct snd_kcontrol_new *template) |
759 | { | 752 | { |
760 | if (!strncmp(template->name, "Master Playback ", 16)) | ||
761 | /* disable volume/mute because they would require SPI writes */ | ||
762 | return 1; | ||
763 | if (!strncmp(template->name, "CD Capture ", 11)) | 753 | if (!strncmp(template->name, "CD Capture ", 11)) |
764 | /* CD in is actually connected to the video in pin */ | 754 | /* CD in is actually connected to the video in pin */ |
765 | template->private_value ^= AC97_CD ^ AC97_VIDEO; | 755 | template->private_value ^= AC97_CD ^ AC97_VIDEO; |
@@ -850,8 +840,9 @@ static const struct oxygen_model model_xonar_d2 = { | |||
850 | .dac_volume_min = 0x0f, | 840 | .dac_volume_min = 0x0f, |
851 | .dac_volume_max = 0xff, | 841 | .dac_volume_max = 0xff, |
852 | .misc_flags = OXYGEN_MISC_MIDI, | 842 | .misc_flags = OXYGEN_MISC_MIDI, |
853 | .function_flags = OXYGEN_FUNCTION_SPI, | 843 | .function_flags = OXYGEN_FUNCTION_SPI | |
854 | .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S, | 844 | OXYGEN_FUNCTION_ENABLE_SPI_4_5, |
845 | .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | ||
855 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | 846 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, |
856 | }; | 847 | }; |
857 | 848 | ||
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 2ab83129d9b0..19e37451c216 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2524,7 +2524,6 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform | |||
2524 | * build the rate table and bitmap flags | 2524 | * build the rate table and bitmap flags |
2525 | */ | 2525 | */ |
2526 | int r, idx; | 2526 | int r, idx; |
2527 | unsigned int nonzero_rates = 0; | ||
2528 | 2527 | ||
2529 | fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); | 2528 | fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); |
2530 | if (fp->rate_table == NULL) { | 2529 | if (fp->rate_table == NULL) { |
@@ -2532,24 +2531,27 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform | |||
2532 | return -1; | 2531 | return -1; |
2533 | } | 2532 | } |
2534 | 2533 | ||
2535 | fp->nr_rates = nr_rates; | 2534 | fp->nr_rates = 0; |
2536 | fp->rate_min = fp->rate_max = combine_triple(&fmt[8]); | 2535 | fp->rate_min = fp->rate_max = 0; |
2537 | for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) { | 2536 | for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) { |
2538 | unsigned int rate = combine_triple(&fmt[idx]); | 2537 | unsigned int rate = combine_triple(&fmt[idx]); |
2538 | if (!rate) | ||
2539 | continue; | ||
2539 | /* C-Media CM6501 mislabels its 96 kHz altsetting */ | 2540 | /* C-Media CM6501 mislabels its 96 kHz altsetting */ |
2540 | if (rate == 48000 && nr_rates == 1 && | 2541 | if (rate == 48000 && nr_rates == 1 && |
2541 | chip->usb_id == USB_ID(0x0d8c, 0x0201) && | 2542 | (chip->usb_id == USB_ID(0x0d8c, 0x0201) || |
2543 | chip->usb_id == USB_ID(0x0d8c, 0x0102)) && | ||
2542 | fp->altsetting == 5 && fp->maxpacksize == 392) | 2544 | fp->altsetting == 5 && fp->maxpacksize == 392) |
2543 | rate = 96000; | 2545 | rate = 96000; |
2544 | fp->rate_table[r] = rate; | 2546 | fp->rate_table[fp->nr_rates] = rate; |
2545 | nonzero_rates |= rate; | 2547 | if (!fp->rate_min || rate < fp->rate_min) |
2546 | if (rate < fp->rate_min) | ||
2547 | fp->rate_min = rate; | 2548 | fp->rate_min = rate; |
2548 | else if (rate > fp->rate_max) | 2549 | if (!fp->rate_max || rate > fp->rate_max) |
2549 | fp->rate_max = rate; | 2550 | fp->rate_max = rate; |
2550 | fp->rates |= snd_pcm_rate_to_rate_bit(rate); | 2551 | fp->rates |= snd_pcm_rate_to_rate_bit(rate); |
2552 | fp->nr_rates++; | ||
2551 | } | 2553 | } |
2552 | if (!nonzero_rates) { | 2554 | if (!fp->nr_rates) { |
2553 | hwc_debug("All rates were zero. Skipping format!\n"); | 2555 | hwc_debug("All rates were zero. Skipping format!\n"); |
2554 | return -1; | 2556 | return -1; |
2555 | } | 2557 | } |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 320641ab5be7..26bad373fe65 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -1625,6 +1625,7 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, | |||
1625 | } | 1625 | } |
1626 | 1626 | ||
1627 | ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1627 | ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; |
1628 | ep_info.out_interval = 0; | ||
1628 | ep_info.out_cables = endpoint->out_cables & 0x5555; | 1629 | ep_info.out_cables = endpoint->out_cables & 0x5555; |
1629 | err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]); | 1630 | err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]); |
1630 | if (err < 0) | 1631 | if (err < 0) |
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index e9693a29d00e..4c4037503600 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c | |||
@@ -73,14 +73,13 @@ static int kvm_iommu_map_memslots(struct kvm *kvm) | |||
73 | { | 73 | { |
74 | int i, r = 0; | 74 | int i, r = 0; |
75 | 75 | ||
76 | down_read(&kvm->slots_lock); | ||
77 | for (i = 0; i < kvm->nmemslots; i++) { | 76 | for (i = 0; i < kvm->nmemslots; i++) { |
78 | r = kvm_iommu_map_pages(kvm, kvm->memslots[i].base_gfn, | 77 | r = kvm_iommu_map_pages(kvm, kvm->memslots[i].base_gfn, |
79 | kvm->memslots[i].npages); | 78 | kvm->memslots[i].npages); |
80 | if (r) | 79 | if (r) |
81 | break; | 80 | break; |
82 | } | 81 | } |
83 | up_read(&kvm->slots_lock); | 82 | |
84 | return r; | 83 | return r; |
85 | } | 84 | } |
86 | 85 | ||
@@ -190,12 +189,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm, | |||
190 | static int kvm_iommu_unmap_memslots(struct kvm *kvm) | 189 | static int kvm_iommu_unmap_memslots(struct kvm *kvm) |
191 | { | 190 | { |
192 | int i; | 191 | int i; |
193 | down_read(&kvm->slots_lock); | 192 | |
194 | for (i = 0; i < kvm->nmemslots; i++) { | 193 | for (i = 0; i < kvm->nmemslots; i++) { |
195 | kvm_iommu_put_pages(kvm, kvm->memslots[i].base_gfn, | 194 | kvm_iommu_put_pages(kvm, kvm->memslots[i].base_gfn, |
196 | kvm->memslots[i].npages); | 195 | kvm->memslots[i].npages); |
197 | } | 196 | } |
198 | up_read(&kvm->slots_lock); | ||
199 | 197 | ||
200 | return 0; | 198 | return 0; |
201 | } | 199 | } |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 3a5a08298aab..29a667ce35b0 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -173,7 +173,6 @@ static void kvm_assigned_dev_interrupt_work_handler(struct work_struct *work) | |||
173 | assigned_dev->host_irq_disabled = false; | 173 | assigned_dev->host_irq_disabled = false; |
174 | } | 174 | } |
175 | mutex_unlock(&assigned_dev->kvm->lock); | 175 | mutex_unlock(&assigned_dev->kvm->lock); |
176 | kvm_put_kvm(assigned_dev->kvm); | ||
177 | } | 176 | } |
178 | 177 | ||
179 | static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id) | 178 | static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id) |
@@ -181,8 +180,6 @@ static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id) | |||
181 | struct kvm_assigned_dev_kernel *assigned_dev = | 180 | struct kvm_assigned_dev_kernel *assigned_dev = |
182 | (struct kvm_assigned_dev_kernel *) dev_id; | 181 | (struct kvm_assigned_dev_kernel *) dev_id; |
183 | 182 | ||
184 | kvm_get_kvm(assigned_dev->kvm); | ||
185 | |||
186 | schedule_work(&assigned_dev->interrupt_work); | 183 | schedule_work(&assigned_dev->interrupt_work); |
187 | 184 | ||
188 | disable_irq_nosync(irq); | 185 | disable_irq_nosync(irq); |
@@ -213,6 +210,7 @@ static void kvm_assigned_dev_ack_irq(struct kvm_irq_ack_notifier *kian) | |||
213 | } | 210 | } |
214 | } | 211 | } |
215 | 212 | ||
213 | /* The function implicit hold kvm->lock mutex due to cancel_work_sync() */ | ||
216 | static void kvm_free_assigned_irq(struct kvm *kvm, | 214 | static void kvm_free_assigned_irq(struct kvm *kvm, |
217 | struct kvm_assigned_dev_kernel *assigned_dev) | 215 | struct kvm_assigned_dev_kernel *assigned_dev) |
218 | { | 216 | { |
@@ -228,11 +226,24 @@ static void kvm_free_assigned_irq(struct kvm *kvm, | |||
228 | if (!assigned_dev->irq_requested_type) | 226 | if (!assigned_dev->irq_requested_type) |
229 | return; | 227 | return; |
230 | 228 | ||
231 | if (cancel_work_sync(&assigned_dev->interrupt_work)) | 229 | /* |
232 | /* We had pending work. That means we will have to take | 230 | * In kvm_free_device_irq, cancel_work_sync return true if: |
233 | * care of kvm_put_kvm. | 231 | * 1. work is scheduled, and then cancelled. |
234 | */ | 232 | * 2. work callback is executed. |
235 | kvm_put_kvm(kvm); | 233 | * |
234 | * The first one ensured that the irq is disabled and no more events | ||
235 | * would happen. But for the second one, the irq may be enabled (e.g. | ||
236 | * for MSI). So we disable irq here to prevent further events. | ||
237 | * | ||
238 | * Notice this maybe result in nested disable if the interrupt type is | ||
239 | * INTx, but it's OK for we are going to free it. | ||
240 | * | ||
241 | * If this function is a part of VM destroy, please ensure that till | ||
242 | * now, the kvm state is still legal for probably we also have to wait | ||
243 | * interrupt_work done. | ||
244 | */ | ||
245 | disable_irq_nosync(assigned_dev->host_irq); | ||
246 | cancel_work_sync(&assigned_dev->interrupt_work); | ||
236 | 247 | ||
237 | free_irq(assigned_dev->host_irq, (void *)assigned_dev); | 248 | free_irq(assigned_dev->host_irq, (void *)assigned_dev); |
238 | 249 | ||
@@ -285,8 +296,8 @@ static int assigned_device_update_intx(struct kvm *kvm, | |||
285 | 296 | ||
286 | if (irqchip_in_kernel(kvm)) { | 297 | if (irqchip_in_kernel(kvm)) { |
287 | if (!msi2intx && | 298 | if (!msi2intx && |
288 | adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI) { | 299 | (adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI)) { |
289 | free_irq(adev->host_irq, (void *)kvm); | 300 | free_irq(adev->host_irq, (void *)adev); |
290 | pci_disable_msi(adev->dev); | 301 | pci_disable_msi(adev->dev); |
291 | } | 302 | } |
292 | 303 | ||
@@ -455,6 +466,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | |||
455 | struct kvm_assigned_dev_kernel *match; | 466 | struct kvm_assigned_dev_kernel *match; |
456 | struct pci_dev *dev; | 467 | struct pci_dev *dev; |
457 | 468 | ||
469 | down_read(&kvm->slots_lock); | ||
458 | mutex_lock(&kvm->lock); | 470 | mutex_lock(&kvm->lock); |
459 | 471 | ||
460 | match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head, | 472 | match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head, |
@@ -516,6 +528,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm, | |||
516 | 528 | ||
517 | out: | 529 | out: |
518 | mutex_unlock(&kvm->lock); | 530 | mutex_unlock(&kvm->lock); |
531 | up_read(&kvm->slots_lock); | ||
519 | return r; | 532 | return r; |
520 | out_list_del: | 533 | out_list_del: |
521 | list_del(&match->list); | 534 | list_del(&match->list); |
@@ -527,6 +540,7 @@ out_put: | |||
527 | out_free: | 540 | out_free: |
528 | kfree(match); | 541 | kfree(match); |
529 | mutex_unlock(&kvm->lock); | 542 | mutex_unlock(&kvm->lock); |
543 | up_read(&kvm->slots_lock); | ||
530 | return r; | 544 | return r; |
531 | } | 545 | } |
532 | #endif | 546 | #endif |
@@ -789,11 +803,19 @@ static int kvm_mmu_notifier_clear_flush_young(struct mmu_notifier *mn, | |||
789 | return young; | 803 | return young; |
790 | } | 804 | } |
791 | 805 | ||
806 | static void kvm_mmu_notifier_release(struct mmu_notifier *mn, | ||
807 | struct mm_struct *mm) | ||
808 | { | ||
809 | struct kvm *kvm = mmu_notifier_to_kvm(mn); | ||
810 | kvm_arch_flush_shadow(kvm); | ||
811 | } | ||
812 | |||
792 | static const struct mmu_notifier_ops kvm_mmu_notifier_ops = { | 813 | static const struct mmu_notifier_ops kvm_mmu_notifier_ops = { |
793 | .invalidate_page = kvm_mmu_notifier_invalidate_page, | 814 | .invalidate_page = kvm_mmu_notifier_invalidate_page, |
794 | .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start, | 815 | .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start, |
795 | .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end, | 816 | .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end, |
796 | .clear_flush_young = kvm_mmu_notifier_clear_flush_young, | 817 | .clear_flush_young = kvm_mmu_notifier_clear_flush_young, |
818 | .release = kvm_mmu_notifier_release, | ||
797 | }; | 819 | }; |
798 | #endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */ | 820 | #endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */ |
799 | 821 | ||
@@ -883,6 +905,7 @@ static void kvm_destroy_vm(struct kvm *kvm) | |||
883 | { | 905 | { |
884 | struct mm_struct *mm = kvm->mm; | 906 | struct mm_struct *mm = kvm->mm; |
885 | 907 | ||
908 | kvm_arch_sync_events(kvm); | ||
886 | spin_lock(&kvm_lock); | 909 | spin_lock(&kvm_lock); |
887 | list_del(&kvm->vm_list); | 910 | list_del(&kvm->vm_list); |
888 | spin_unlock(&kvm_lock); | 911 | spin_unlock(&kvm_lock); |