aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/fb/pvr2fb.txt22
-rw-r--r--Documentation/i386/zero-page.txt10
-rw-r--r--Documentation/kbuild/kconfig-language.txt9
-rw-r--r--Documentation/kernel-parameters.txt2
-rw-r--r--Documentation/memory-hotplug.txt322
-rw-r--r--Documentation/sysrq.txt4
-rw-r--r--MAINTAINERS23
-rw-r--r--arch/alpha/kernel/sys_titan.c27
-rw-r--r--arch/blackfin/kernel/init_task.c1
-rw-r--r--arch/blackfin/kernel/process.c2
-rw-r--r--arch/blackfin/kernel/sys_bfin.c1
-rw-r--r--arch/blackfin/kernel/traps.c1
-rw-r--r--arch/cris/Kconfig2
-rw-r--r--arch/frv/kernel/entry.S1
-rw-r--r--arch/i386/kernel/alternative.c37
-rw-r--r--arch/i386/kernel/apic.c10
-rw-r--r--arch/i386/kernel/cpu/amd.c7
-rw-r--r--arch/i386/kernel/doublefault.c13
-rw-r--r--arch/i386/kernel/head.S4
-rw-r--r--arch/i386/kernel/paravirt.c52
-rw-r--r--arch/i386/kernel/vmi.c35
-rw-r--r--arch/i386/mm/pageattr.c2
-rw-r--r--arch/i386/pci/common.c23
-rw-r--r--arch/i386/pci/fixup.c6
-rw-r--r--arch/i386/pci/irq.c5
-rw-r--r--arch/i386/pci/legacy.c2
-rw-r--r--arch/i386/pci/mmconfig.c14
-rw-r--r--arch/i386/pci/numa.c15
-rw-r--r--arch/i386/pci/pci.h43
-rw-r--r--arch/i386/pci/visws.c4
-rw-r--r--arch/i386/xen/enlighten.c12
-rw-r--r--arch/powerpc/configs/ps3_defconfig200
-rw-r--r--arch/powerpc/kernel/head_64.S16
-rw-r--r--arch/powerpc/kernel/pci_64.c1
-rw-r--r--arch/powerpc/mm/slb.c45
-rw-r--r--arch/powerpc/mm/slice.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_rdb.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc836x_mds.c1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c1
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c141
-rw-r--r--arch/powerpc/platforms/cell/spu_manage.c163
-rw-r--r--arch/powerpc/platforms/ps3/Kconfig10
-rw-r--r--arch/powerpc/platforms/ps3/device-init.c37
-rw-r--r--arch/powerpc/platforms/ps3/spu.c6
-rw-r--r--arch/x86_64/boot/compressed/head.S7
-rw-r--r--arch/x86_64/kernel/apic.c6
-rw-r--r--arch/x86_64/kernel/pci-calgary.c13
-rw-r--r--arch/x86_64/mm/pageattr.c3
-rw-r--r--arch/x86_64/pci/mmconfig.c12
-rw-r--r--arch/x86_64/vdso/.gitignore1
-rw-r--r--block/ll_rw_blk.c4
-rw-r--r--drivers/acpi/resources/rsxface.c2
-rw-r--r--drivers/block/cciss.c16
-rw-r--r--drivers/block/cpqarray.c78
-rw-r--r--drivers/block/viodasd.c1
-rw-r--r--drivers/block/xsysace.c29
-rw-r--r--drivers/char/hvc_lguest.c1
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c5
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c2
-rw-r--r--drivers/char/tty_io.c56
-rw-r--r--drivers/lguest/lguest.c9
-rw-r--r--drivers/lguest/lguest_bus.c1
-rw-r--r--drivers/md/dm.c4
-rw-r--r--drivers/mtd/mtdchar.c1
-rw-r--r--drivers/spi/spi_mpc83xx.c25
-rw-r--r--drivers/spi/spidev.c4
-rw-r--r--drivers/video/console/fbcon.c14
-rw-r--r--drivers/video/matrox/g450_pll.c23
-rw-r--r--drivers/video/matrox/matroxfb_DAC1064.h15
-rw-r--r--drivers/video/matrox/matroxfb_base.h1
-rw-r--r--drivers/video/matrox/matroxfb_misc.c1
-rw-r--r--drivers/video/pvr2fb.c16
-rw-r--r--drivers/video/stifb.c19
-rw-r--r--fs/direct-io.c1
-rw-r--r--fs/ecryptfs/inode.c4
-rw-r--r--fs/ecryptfs/main.c18
-rw-r--r--fs/ocfs2/alloc.c4
-rw-r--r--fs/ocfs2/cluster/tcp.c24
-rw-r--r--fs/ocfs2/file.c28
-rw-r--r--fs/ocfs2/namei.c16
-rw-r--r--fs/ocfs2/ocfs2.h8
-rw-r--r--fs/ocfs2/super.c69
-rw-r--r--fs/ocfs2/super.h2
-rw-r--r--include/asm-frv/unistd.h3
-rw-r--r--include/asm-generic/pgtable.h73
-rw-r--r--include/asm-i386/apic.h2
-rw-r--r--include/asm-i386/cpufeature.h2
-rw-r--r--include/asm-i386/paravirt.h16
-rw-r--r--include/asm-i386/pci.h3
-rw-r--r--include/asm-powerpc/dma-mapping.h2
-rw-r--r--include/asm-powerpc/spu_priv1.h7
-rw-r--r--include/asm-x86_64/pci.h2
-rw-r--r--include/linux/bio.h3
-rw-r--r--include/linux/blktrace_api.h3
-rw-r--r--include/linux/clockchips.h1
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/init.h2
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/proc_fs.h1
-rw-r--r--include/linux/rcupdate.h1
-rw-r--r--include/linux/tty.h2
-rw-r--r--kernel/kprobes.c5
-rw-r--r--kernel/power/snapshot.c3
-rw-r--r--kernel/profile.c4
-rw-r--r--kernel/sched.c15
-rw-r--r--kernel/sched_debug.c2
-rw-r--r--kernel/sched_fair.c7
-rw-r--r--kernel/sysctl.c2
-rw-r--r--kernel/time/clockevents.c10
-rw-r--r--lib/hexdump.c2
-rw-r--r--mm/filemap.c22
-rwxr-xr-xscripts/checkpatch.pl102
113 files changed, 1391 insertions, 788 deletions
diff --git a/Documentation/fb/pvr2fb.txt b/Documentation/fb/pvr2fb.txt
index 2bf6c2321c2d..36bdeff585e2 100644
--- a/Documentation/fb/pvr2fb.txt
+++ b/Documentation/fb/pvr2fb.txt
@@ -9,14 +9,13 @@ one found in the Dreamcast.
9Advantages: 9Advantages:
10 10
11 * It provides a nice large console (128 cols + 48 lines with 1024x768) 11 * It provides a nice large console (128 cols + 48 lines with 1024x768)
12 without using tiny, unreadable fonts. 12 without using tiny, unreadable fonts (NOT on the Dreamcast)
13 * You can run XF86_FBDev on top of /dev/fb0 13 * You can run XF86_FBDev on top of /dev/fb0
14 * Most important: boot logo :-) 14 * Most important: boot logo :-)
15 15
16Disadvantages: 16Disadvantages:
17 17
18 * Driver is currently limited to the Dreamcast PowerVR 2 implementation 18 * Driver is largely untested on non-Dreamcast systems.
19 at the time of this writing.
20 19
21Configuration 20Configuration
22============= 21=============
@@ -29,11 +28,16 @@ Accepted options:
29font:X - default font to use. All fonts are supported, including the 28font:X - default font to use. All fonts are supported, including the
30 SUN12x22 font which is very nice at high resolutions. 29 SUN12x22 font which is very nice at high resolutions.
31 30
32mode:X - default video mode. The following video modes are supported:
33 640x240-60, 640x480-60.
34 31
32mode:X - default video mode with format [xres]x[yres]-<bpp>@<refresh rate>
33 The following video modes are supported:
34 640x640-16@60, 640x480-24@60, 640x480-32@60. The Dreamcast
35 defaults to 640x480-16@60. At the time of writing the
36 24bpp and 32bpp modes function poorly. Work to fix that is
37 ongoing
38
35 Note: the 640x240 mode is currently broken, and should not be 39 Note: the 640x240 mode is currently broken, and should not be
36 used for any reason. It is only mentioned as a reference. 40 used for any reason. It is only mentioned here as a reference.
37 41
38inverse - invert colors on screen (for LCD displays) 42inverse - invert colors on screen (for LCD displays)
39 43
@@ -52,10 +56,10 @@ output:X - output type. This can be any of the following: pal, ntsc, and
52X11 56X11
53=== 57===
54 58
55XF86_FBDev should work, in theory. At the time of this writing it is 59XF86_FBDev has been shown to work on the Dreamcast in the past - though not yet
56totally untested and may or may not even portray the beginnings of 60on any 2.6 series kernel.
57working. If you end up testing this, please let me know!
58 61
59-- 62--
60Paul Mundt <lethal@linuxdc.org> 63Paul Mundt <lethal@linuxdc.org>
64Updated by Adrian McMenamin <adrian@mcmen.demon.co.uk>
61 65
diff --git a/Documentation/i386/zero-page.txt b/Documentation/i386/zero-page.txt
index 75b3680c41eb..6c0817c45683 100644
--- a/Documentation/i386/zero-page.txt
+++ b/Documentation/i386/zero-page.txt
@@ -1,3 +1,13 @@
1---------------------------------------------------------------------------
2!!!!!!!!!!!!!!!WARNING!!!!!!!!
3The zero page is a kernel internal data structure, not a stable ABI. It might change
4without warning and the kernel has no way to detect old version of it.
5If you're writing some external code like a boot loader you should only use
6the stable versioned real mode boot protocol described in boot.txt. Otherwise the kernel
7might break you at any time.
8!!!!!!!!!!!!!WARNING!!!!!!!!!!!
9----------------------------------------------------------------------------
10
1Summary of boot_params layout (kernel point of view) 11Summary of boot_params layout (kernel point of view)
2 ( collected by Hans Lermen and Martin Mares ) 12 ( collected by Hans Lermen and Martin Mares )
3 13
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index 536d5bfbdb8d..fe8b0c4892cf 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -98,6 +98,15 @@ applicable everywhere (see syntax).
98 times, the limit is set to the largest selection. 98 times, the limit is set to the largest selection.
99 Reverse dependencies can only be used with boolean or tristate 99 Reverse dependencies can only be used with boolean or tristate
100 symbols. 100 symbols.
101 Note:
102 select is evil.... select will by brute force set a symbol
103 equal to 'y' without visiting the dependencies. So abusing
104 select you are able to select a symbol FOO even if FOO depends
105 on BAR that is not set. In general use select only for
106 non-visible symbols (no promts anywhere) and for symbols with
107 no dependencies. That will limit the usefulness but on the
108 other hand avoid the illegal configurations all over. kconfig
109 should one day warn about such things.
101 110
102- numerical ranges: "range" <symbol> <symbol> ["if" <expr>] 111- numerical ranges: "range" <symbol> <symbol> ["if" <expr>]
103 This allows to limit the range of possible input values for int 112 This allows to limit the range of possible input values for int
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index efdb42fd3fb8..a326487a3ab5 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1922,7 +1922,7 @@ and is between 256 and 4096 characters. It is defined in the file
1922 See header of drivers/scsi/wd7000.c. 1922 See header of drivers/scsi/wd7000.c.
1923 1923
1924 wdt= [WDT] Watchdog 1924 wdt= [WDT] Watchdog
1925 See Documentation/watchdog/watchdog.txt. 1925 See Documentation/watchdog/wdt.txt.
1926 1926
1927 xd= [HW,XT] Original XT pre-IDE (RLL encoded) disks. 1927 xd= [HW,XT] Original XT pre-IDE (RLL encoded) disks.
1928 xd_geo= See header of drivers/block/xd.c. 1928 xd_geo= See header of drivers/block/xd.c.
diff --git a/Documentation/memory-hotplug.txt b/Documentation/memory-hotplug.txt
new file mode 100644
index 000000000000..5fbcc22c98e9
--- /dev/null
+++ b/Documentation/memory-hotplug.txt
@@ -0,0 +1,322 @@
1==============
2Memory Hotplug
3==============
4
5Last Updated: Jul 28 2007
6
7This document is about memory hotplug including how-to-use and current status.
8Because Memory Hotplug is still under development, contents of this text will
9be changed often.
10
111. Introduction
12 1.1 purpose of memory hotplug
13 1.2. Phases of memory hotplug
14 1.3. Unit of Memory online/offline operation
152. Kernel Configuration
163. sysfs files for memory hotplug
174. Physical memory hot-add phase
18 4.1 Hardware(Firmware) Support
19 4.2 Notify memory hot-add event by hand
205. Logical Memory hot-add phase
21 5.1. State of memory
22 5.2. How to online memory
236. Logical memory remove
24 6.1 Memory offline and ZONE_MOVABLE
25 6.2. How to offline memory
267. Physical memory remove
278. Future Work List
28
29Note(1): x86_64's has special implementation for memory hotplug.
30 This text does not describe it.
31Note(2): This text assumes that sysfs is mounted at /sys.
32
33
34---------------
351. Introduction
36---------------
37
381.1 purpose of memory hotplug
39------------
40Memory Hotplug allows users to increase/decrease the amount of memory.
41Generally, there are two purposes.
42
43(A) For changing the amount of memory.
44 This is to allow a feature like capacity on demand.
45(B) For installing/removing DIMMs or NUMA-nodes physically.
46 This is to exchange DIMMs/NUMA-nodes, reduce power consumption, etc.
47
48(A) is required by highly virtualized environments and (B) is required by
49hardware which supports memory power management.
50
51Linux memory hotplug is designed for both purpose.
52
53
541.2. Phases of memory hotplug
55---------------
56There are 2 phases in Memory Hotplug.
57 1) Physical Memory Hotplug phase
58 2) Logical Memory Hotplug phase.
59
60The First phase is to communicate hardware/firmware and make/erase
61environment for hotplugged memory. Basically, this phase is necessary
62for the purpose (B), but this is good phase for communication between
63highly virtualized environments too.
64
65When memory is hotplugged, the kernel recognizes new memory, makes new memory
66management tables, and makes sysfs files for new memory's operation.
67
68If firmware supports notification of connection of new memory to OS,
69this phase is triggered automatically. ACPI can notify this event. If not,
70"probe" operation by system administration is used instead.
71(see Section 4.).
72
73Logical Memory Hotplug phase is to change memory state into
74avaiable/unavailable for users. Amount of memory from user's view is
75changed by this phase. The kernel makes all memory in it as free pages
76when a memory range is available.
77
78In this document, this phase is described as online/offline.
79
80Logical Memory Hotplug phase is triggred by write of sysfs file by system
81administrator. For the hot-add case, it must be executed after Physical Hotplug
82phase by hand.
83(However, if you writes udev's hotplug scripts for memory hotplug, these
84 phases can be execute in seamless way.)
85
86
871.3. Unit of Memory online/offline operation
88------------
89Memory hotplug uses SPARSEMEM memory model. SPARSEMEM divides the whole memory
90into chunks of the same size. The chunk is called a "section". The size of
91a section is architecture dependent. For example, power uses 16MiB, ia64 uses
921GiB. The unit of online/offline operation is "one section". (see Section 3.)
93
94To determine the size of sections, please read this file:
95
96/sys/devices/system/memory/block_size_bytes
97
98This file shows the size of sections in byte.
99
100-----------------------
1012. Kernel Configuration
102-----------------------
103To use memory hotplug feature, kernel must be compiled with following
104config options.
105
106- For all memory hotplug
107 Memory model -> Sparse Memory (CONFIG_SPARSEMEM)
108 Allow for memory hot-add (CONFIG_MEMORY_HOTPLUG)
109
110- To enable memory removal, the followings are also necessary
111 Allow for memory hot remove (CONFIG_MEMORY_HOTREMOVE)
112 Page Migration (CONFIG_MIGRATION)
113
114- For ACPI memory hotplug, the followings are also necessary
115 Memory hotplug (under ACPI Support menu) (CONFIG_ACPI_HOTPLUG_MEMORY)
116 This option can be kernel module.
117
118- As a related configuration, if your box has a feature of NUMA-node hotplug
119 via ACPI, then this option is necessary too.
120 ACPI0004,PNP0A05 and PNP0A06 Container Driver (under ACPI Support menu)
121 (CONFIG_ACPI_CONTAINER).
122 This option can be kernel module too.
123
124--------------------------------
1253 sysfs files for memory hotplug
126--------------------------------
127All sections have their device information under /sys/devices/system/memory as
128
129/sys/devices/system/memory/memoryXXX
130(XXX is section id.)
131
132Now, XXX is defined as start_address_of_section / section_size.
133
134For example, assume 1GiB section size. A device for a memory starting at
1350x100000000 is /sys/device/system/memory/memory4
136(0x100000000 / 1Gib = 4)
137This device covers address range [0x100000000 ... 0x140000000)
138
139Under each section, you can see 3 files.
140
141/sys/devices/system/memory/memoryXXX/phys_index
142/sys/devices/system/memory/memoryXXX/phys_device
143/sys/devices/system/memory/memoryXXX/state
144
145'phys_index' : read-only and contains section id, same as XXX.
146'state' : read-write
147 at read: contains online/offline state of memory.
148 at write: user can specify "online", "offline" command
149'phys_device': read-only: designed to show the name of physical memory device.
150 This is not well implemented now.
151
152NOTE:
153 These directories/files appear after physical memory hotplug phase.
154
155
156--------------------------------
1574. Physical memory hot-add phase
158--------------------------------
159
1604.1 Hardware(Firmware) Support
161------------
162On x86_64/ia64 platform, memory hotplug by ACPI is supported.
163
164In general, the firmware (ACPI) which supports memory hotplug defines
165memory class object of _HID "PNP0C80". When a notify is asserted to PNP0C80,
166Linux's ACPI handler does hot-add memory to the system and calls a hotplug udev
167script. This will be done automatically.
168
169But scripts for memory hotplug are not contained in generic udev package(now).
170You may have to write it by yourself or online/offline memory by hand.
171Please see "How to online memory", "How to offline memory" in this text.
172
173If firmware supports NUMA-node hotplug, and defines an object _HID "ACPI0004",
174"PNP0A05", or "PNP0A06", notification is asserted to it, and ACPI handler
175calls hotplug code for all of objects which are defined in it.
176If memory device is found, memory hotplug code will be called.
177
178
1794.2 Notify memory hot-add event by hand
180------------
181In some environments, especially virtualized environment, firmware will not
182notify memory hotplug event to the kernel. For such environment, "probe"
183interface is supported. This interface depends on CONFIG_ARCH_MEMORY_PROBE.
184
185Now, CONFIG_ARCH_MEMORY_PROBE is supported only by powerpc but it does not
186contain highly architecture codes. Please add config if you need "probe"
187interface.
188
189Probe interface is located at
190/sys/devices/system/memory/probe
191
192You can tell the physical address of new memory to the kernel by
193
194% echo start_address_of_new_memory > /sys/devices/system/memory/probe
195
196Then, [start_address_of_new_memory, start_address_of_new_memory + section_size)
197memory range is hot-added. In this case, hotplug script is not called (in
198current implementation). You'll have to online memory by yourself.
199Please see "How to online memory" in this text.
200
201
202
203------------------------------
2045. Logical Memory hot-add phase
205------------------------------
206
2075.1. State of memory
208------------
209To see (online/offline) state of memory section, read 'state' file.
210
211% cat /sys/device/system/memory/memoryXXX/state
212
213
214If the memory section is online, you'll read "online".
215If the memory section is offline, you'll read "offline".
216
217
2185.2. How to online memory
219------------
220Even if the memory is hot-added, it is not at ready-to-use state.
221For using newly added memory, you have to "online" the memory section.
222
223For onlining, you have to write "online" to the section's state file as:
224
225% echo online > /sys/devices/system/memory/memoryXXX/state
226
227After this, section memoryXXX's state will be 'online' and the amount of
228available memory will be increased.
229
230Currently, newly added memory is added as ZONE_NORMAL (for powerpc, ZONE_DMA).
231This may be changed in future.
232
233
234
235------------------------
2366. Logical memory remove
237------------------------
238
2396.1 Memory offline and ZONE_MOVABLE
240------------
241Memory offlining is more complicated than memory online. Because memory offline
242has to make the whole memory section be unused, memory offline can fail if
243the section includes memory which cannot be freed.
244
245In general, memory offline can use 2 techniques.
246
247(1) reclaim and free all memory in the section.
248(2) migrate all pages in the section.
249
250In the current implementation, Linux's memory offline uses method (2), freeing
251all pages in the section by page migration. But not all pages are
252migratable. Under current Linux, migratable pages are anonymous pages and
253page caches. For offlining a section by migration, the kernel has to guarantee
254that the section contains only migratable pages.
255
256Now, a boot option for making a section which consists of migratable pages is
257supported. By specifying "kernelcore=" or "movablecore=" boot option, you can
258create ZONE_MOVABLE...a zone which is just used for movable pages.
259(See also Documentation/kernel-parameters.txt)
260
261Assume the system has "TOTAL" amount of memory at boot time, this boot option
262creates ZONE_MOVABLE as following.
263
2641) When kernelcore=YYYY boot option is used,
265 Size of memory not for movable pages (not for offline) is YYYY.
266 Size of memory for movable pages (for offline) is TOTAL-YYYY.
267
2682) When movablecore=ZZZZ boot option is used,
269 Size of memory not for movable pages (not for offline) is TOTAL - ZZZZ.
270 Size of memory for movable pages (for offline) is ZZZZ.
271
272
273Note) Unfortunately, there is no information to show which section belongs
274to ZONE_MOVABLE. This is TBD.
275
276
2776.2. How to offline memory
278------------
279You can offline a section by using the same sysfs interface that was used in
280memory onlining.
281
282% echo offline > /sys/devices/system/memory/memoryXXX/state
283
284If offline succeeds, the state of the memory section is changed to be "offline".
285If it fails, some error core (like -EBUSY) will be returned by the kernel.
286Even if a section does not belong to ZONE_MOVABLE, you can try to offline it.
287If it doesn't contain 'unmovable' memory, you'll get success.
288
289A section under ZONE_MOVABLE is considered to be able to be offlined easily.
290But under some busy state, it may return -EBUSY. Even if a memory section
291cannot be offlined due to -EBUSY, you can retry offlining it and may be able to
292offline it (or not).
293(For example, a page is referred to by some kernel internal call and released
294 soon.)
295
296Consideration:
297Memory hotplug's design direction is to make the possibility of memory offlining
298higher and to guarantee unplugging memory under any situation. But it needs
299more work. Returning -EBUSY under some situation may be good because the user
300can decide to retry more or not by himself. Currently, memory offlining code
301does some amount of retry with 120 seconds timeout.
302
303-------------------------
3047. Physical memory remove
305-------------------------
306Need more implementation yet....
307 - Notification completion of remove works by OS to firmware.
308 - Guard from remove if not yet.
309
310--------------
3118. Future Work
312--------------
313 - allowing memory hot-add to ZONE_MOVABLE. maybe we need some switch like
314 sysctl or new control file.
315 - showing memory section and physical device relationship.
316 - showing memory section and node relationship (maybe good for NUMA)
317 - showing memory section is under ZONE_MOVABLE or not
318 - test and make it better memory offlining.
319 - support HugeTLB page migration and offlining.
320 - memmap removing at memory offline.
321 - physical remove memory.
322
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index ba328f255417..ef19142896ca 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -1,6 +1,6 @@
1Linux Magic System Request Key Hacks 1Linux Magic System Request Key Hacks
2Documentation for sysrq.c 2Documentation for sysrq.c
3Last update: 2007-MAR-14 3Last update: 2007-AUG-04
4 4
5* What is the magic SysRq key? 5* What is the magic SysRq key?
6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -78,7 +78,7 @@ On all - write a character to /proc/sysrq-trigger. e.g.:
78'g' - Used by kgdb on ppc and sh platforms. 78'g' - Used by kgdb on ppc and sh platforms.
79 79
80'h' - Will display help (actually any other key than those listed 80'h' - Will display help (actually any other key than those listed
81 above will display help. but 'h' is easy to remember :-) 81 here will display help. but 'h' is easy to remember :-)
82 82
83'i' - Send a SIGKILL to all processes, except for init. 83'i' - Send a SIGKILL to all processes, except for init.
84 84
diff --git a/MAINTAINERS b/MAINTAINERS
index e65e96a14bec..d3a0684945b4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -612,6 +612,15 @@ W: http://sourceforge.net/projects/acpi4asus
612W: http://xf.iksaif.net/acpi4asus 612W: http://xf.iksaif.net/acpi4asus
613S: Maintained 613S: Maintained
614 614
615ASYNCHRONOUS TRANSFERS/TRANSFORMS API
616P: Dan Williams
617M: dan.j.williams@intel.com
618P: Shannon Nelson
619M: shannon.nelson@intel.com
620L: linux-kernel@vger.kernel.org
621W: http://sourceforge.net/projects/xscaleiop
622S: Supported
623
615ATA OVER ETHERNET DRIVER 624ATA OVER ETHERNET DRIVER
616P: Ed L. Cashin 625P: Ed L. Cashin
617M: ecashin@coraid.com 626M: ecashin@coraid.com
@@ -664,7 +673,7 @@ S: Maintained
664AUDIT SUBSYSTEM 673AUDIT SUBSYSTEM
665P: David Woodhouse 674P: David Woodhouse
666M: dwmw2@infradead.org 675M: dwmw2@infradead.org
667L: linux-audit@redhat.com 676L: linux-audit@redhat.com (subscribers-only)
668W: http://people.redhat.com/sgrubb/audit/ 677W: http://people.redhat.com/sgrubb/audit/
669T: git kernel.org:/pub/scm/linux/kernel/git/dwmw2/audit-2.6.git 678T: git kernel.org:/pub/scm/linux/kernel/git/dwmw2/audit-2.6.git
670S: Maintained 679S: Maintained
@@ -1277,11 +1286,13 @@ M: tori@unhappy.mine.nu
1277L: netdev@vger.kernel.org 1286L: netdev@vger.kernel.org
1278S: Maintained 1287S: Maintained
1279 1288
1280DMA GENERIC MEMCPY SUBSYSTEM 1289DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
1281P: Shannon Nelson 1290P: Shannon Nelson
1282M: shannon.nelson@intel.com 1291M: shannon.nelson@intel.com
1292P: Dan Williams
1293M: dan.j.williams@intel.com
1283L: linux-kernel@vger.kernel.org 1294L: linux-kernel@vger.kernel.org
1284S: Maintained 1295S: Supported
1285 1296
1286DME1737 HARDWARE MONITOR DRIVER 1297DME1737 HARDWARE MONITOR DRIVER
1287P: Juerg Haefliger 1298P: Juerg Haefliger
@@ -1958,6 +1969,12 @@ M: shannon.nelson@intel.com
1958L: linux-kernel@vger.kernel.org 1969L: linux-kernel@vger.kernel.org
1959S: Supported 1970S: Supported
1960 1971
1972INTEL IOP-ADMA DMA DRIVER
1973P: Dan Williams
1974M: dan.j.williams@intel.com
1975L: linux-kernel@vger.kernel.org
1976S: Supported
1977
1961INTEL IXP4XX RANDOM NUMBER GENERATOR SUPPORT 1978INTEL IXP4XX RANDOM NUMBER GENERATOR SUPPORT
1962P: Deepak Saxena 1979P: Deepak Saxena
1963M: dsaxena@plexity.net 1980M: dsaxena@plexity.net
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index 1d3c1398c428..52c91ccc1648 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -271,6 +271,19 @@ titan_dispatch_irqs(u64 mask)
271 * Titan Family 271 * Titan Family
272 */ 272 */
273static void __init 273static void __init
274titan_request_irq(unsigned int irq, irq_handler_t handler,
275 unsigned long irqflags, const char *devname,
276 void *dev_id)
277{
278 int err;
279 err = request_irq(irq, handler, irqflags, devname, dev_id);
280 if (err) {
281 printk("titan_request_irq for IRQ %d returned %d; ignoring\n",
282 irq, err);
283 }
284}
285
286static void __init
274titan_late_init(void) 287titan_late_init(void)
275{ 288{
276 /* 289 /*
@@ -278,15 +291,15 @@ titan_late_init(void)
278 * all reported to the kernel as machine checks, so the handler 291 * all reported to the kernel as machine checks, so the handler
279 * is a nop so it can be called to count the individual events. 292 * is a nop so it can be called to count the individual events.
280 */ 293 */
281 request_irq(63+16, titan_intr_nop, IRQF_DISABLED, 294 titan_request_irq(63+16, titan_intr_nop, IRQF_DISABLED,
282 "CChip Error", NULL); 295 "CChip Error", NULL);
283 request_irq(62+16, titan_intr_nop, IRQF_DISABLED, 296 titan_request_irq(62+16, titan_intr_nop, IRQF_DISABLED,
284 "PChip 0 H_Error", NULL); 297 "PChip 0 H_Error", NULL);
285 request_irq(61+16, titan_intr_nop, IRQF_DISABLED, 298 titan_request_irq(61+16, titan_intr_nop, IRQF_DISABLED,
286 "PChip 1 H_Error", NULL); 299 "PChip 1 H_Error", NULL);
287 request_irq(60+16, titan_intr_nop, IRQF_DISABLED, 300 titan_request_irq(60+16, titan_intr_nop, IRQF_DISABLED,
288 "PChip 0 C_Error", NULL); 301 "PChip 0 C_Error", NULL);
289 request_irq(59+16, titan_intr_nop, IRQF_DISABLED, 302 titan_request_irq(59+16, titan_intr_nop, IRQF_DISABLED,
290 "PChip 1 C_Error", NULL); 303 "PChip 1 C_Error", NULL);
291 304
292 /* 305 /*
@@ -345,9 +358,9 @@ privateer_init_pci(void)
345 * Hook a couple of extra err interrupts that the 358 * Hook a couple of extra err interrupts that the
346 * common titan code won't. 359 * common titan code won't.
347 */ 360 */
348 request_irq(53+16, titan_intr_nop, IRQF_DISABLED, 361 titan_request_irq(53+16, titan_intr_nop, IRQF_DISABLED,
349 "NMI", NULL); 362 "NMI", NULL);
350 request_irq(50+16, titan_intr_nop, IRQF_DISABLED, 363 titan_request_irq(50+16, titan_intr_nop, IRQF_DISABLED,
351 "Temperature Warning", NULL); 364 "Temperature Warning", NULL);
352 365
353 /* 366 /*
diff --git a/arch/blackfin/kernel/init_task.c b/arch/blackfin/kernel/init_task.c
index b45188f8512e..673c860ffc23 100644
--- a/arch/blackfin/kernel/init_task.c
+++ b/arch/blackfin/kernel/init_task.c
@@ -31,6 +31,7 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/init_task.h> 32#include <linux/init_task.h>
33#include <linux/mqueue.h> 33#include <linux/mqueue.h>
34#include <linux/fs.h>
34 35
35static struct fs_struct init_fs = INIT_FS; 36static struct fs_struct init_fs = INIT_FS;
36static struct files_struct init_files = INIT_FILES; 37static struct files_struct init_files = INIT_FILES;
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 5a51dd6ab280..6a7aefe48346 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -33,6 +33,8 @@
33#include <linux/user.h> 33#include <linux/user.h>
34#include <linux/a.out.h> 34#include <linux/a.out.h>
35#include <linux/uaccess.h> 35#include <linux/uaccess.h>
36#include <linux/fs.h>
37#include <linux/err.h>
36 38
37#include <asm/blackfin.h> 39#include <asm/blackfin.h>
38#include <asm/fixed_code.h> 40#include <asm/fixed_code.h>
diff --git a/arch/blackfin/kernel/sys_bfin.c b/arch/blackfin/kernel/sys_bfin.c
index f5e1ae3d1705..abcd14817d0e 100644
--- a/arch/blackfin/kernel/sys_bfin.c
+++ b/arch/blackfin/kernel/sys_bfin.c
@@ -37,6 +37,7 @@
37#include <linux/syscalls.h> 37#include <linux/syscalls.h>
38#include <linux/mman.h> 38#include <linux/mman.h>
39#include <linux/file.h> 39#include <linux/file.h>
40#include <linux/fs.h>
40#include <linux/uaccess.h> 41#include <linux/uaccess.h>
41#include <linux/ipc.h> 42#include <linux/ipc.h>
42#include <linux/unistd.h> 43#include <linux/unistd.h>
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index 8766bd612b47..792a8416fe10 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -31,6 +31,7 @@
31#include <linux/interrupt.h> 31#include <linux/interrupt.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/kallsyms.h> 33#include <linux/kallsyms.h>
34#include <linux/fs.h>
34#include <asm/traps.h> 35#include <asm/traps.h>
35#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
36#include <asm/blackfin.h> 37#include <asm/blackfin.h>
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 4b41248b61ad..6b4d026a00a1 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -180,8 +180,6 @@ source "drivers/isdn/Kconfig"
180 180
181source "drivers/telephony/Kconfig" 181source "drivers/telephony/Kconfig"
182 182
183source "drivers/cdrom/Kconfig"
184
185# 183#
186# input before char - char/joystick depends on it. As does USB. 184# input before char - char/joystick depends on it. As does USB.
187# 185#
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index 275673c192aa..1e74f3c5cee2 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -1496,6 +1496,7 @@ sys_call_table:
1496 .long sys_signalfd 1496 .long sys_signalfd
1497 .long sys_timerfd 1497 .long sys_timerfd
1498 .long sys_eventfd 1498 .long sys_eventfd
1499 .long sys_fallocate
1499 1500
1500 1501
1501syscall_table_size = (. - sys_call_table) 1502syscall_table_size = (. - sys_call_table)
diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c
index c85598acb8fd..1b66d5c70eaf 100644
--- a/arch/i386/kernel/alternative.c
+++ b/arch/i386/kernel/alternative.c
@@ -11,6 +11,8 @@
11#include <asm/mce.h> 11#include <asm/mce.h>
12#include <asm/nmi.h> 12#include <asm/nmi.h>
13 13
14#define MAX_PATCH_LEN (255-1)
15
14#ifdef CONFIG_HOTPLUG_CPU 16#ifdef CONFIG_HOTPLUG_CPU
15static int smp_alt_once; 17static int smp_alt_once;
16 18
@@ -148,7 +150,8 @@ static unsigned char** find_nop_table(void)
148 150
149#endif /* CONFIG_X86_64 */ 151#endif /* CONFIG_X86_64 */
150 152
151static void nop_out(void *insns, unsigned int len) 153/* Use this to add nops to a buffer, then text_poke the whole buffer. */
154static void add_nops(void *insns, unsigned int len)
152{ 155{
153 unsigned char **noptable = find_nop_table(); 156 unsigned char **noptable = find_nop_table();
154 157
@@ -156,7 +159,7 @@ static void nop_out(void *insns, unsigned int len)
156 unsigned int noplen = len; 159 unsigned int noplen = len;
157 if (noplen > ASM_NOP_MAX) 160 if (noplen > ASM_NOP_MAX)
158 noplen = ASM_NOP_MAX; 161 noplen = ASM_NOP_MAX;
159 text_poke(insns, noptable[noplen], noplen); 162 memcpy(insns, noptable[noplen], noplen);
160 insns += noplen; 163 insns += noplen;
161 len -= noplen; 164 len -= noplen;
162 } 165 }
@@ -174,15 +177,15 @@ extern u8 *__smp_locks[], *__smp_locks_end[];
174void apply_alternatives(struct alt_instr *start, struct alt_instr *end) 177void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
175{ 178{
176 struct alt_instr *a; 179 struct alt_instr *a;
177 u8 *instr; 180 char insnbuf[MAX_PATCH_LEN];
178 int diff;
179 181
180 DPRINTK("%s: alt table %p -> %p\n", __FUNCTION__, start, end); 182 DPRINTK("%s: alt table %p -> %p\n", __FUNCTION__, start, end);
181 for (a = start; a < end; a++) { 183 for (a = start; a < end; a++) {
184 u8 *instr = a->instr;
182 BUG_ON(a->replacementlen > a->instrlen); 185 BUG_ON(a->replacementlen > a->instrlen);
186 BUG_ON(a->instrlen > sizeof(insnbuf));
183 if (!boot_cpu_has(a->cpuid)) 187 if (!boot_cpu_has(a->cpuid))
184 continue; 188 continue;
185 instr = a->instr;
186#ifdef CONFIG_X86_64 189#ifdef CONFIG_X86_64
187 /* vsyscall code is not mapped yet. resolve it manually. */ 190 /* vsyscall code is not mapped yet. resolve it manually. */
188 if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END) { 191 if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END) {
@@ -191,9 +194,10 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
191 __FUNCTION__, a->instr, instr); 194 __FUNCTION__, a->instr, instr);
192 } 195 }
193#endif 196#endif
194 memcpy(instr, a->replacement, a->replacementlen); 197 memcpy(insnbuf, a->replacement, a->replacementlen);
195 diff = a->instrlen - a->replacementlen; 198 add_nops(insnbuf + a->replacementlen,
196 nop_out(instr + a->replacementlen, diff); 199 a->instrlen - a->replacementlen);
200 text_poke(instr, insnbuf, a->instrlen);
197 } 201 }
198} 202}
199 203
@@ -215,16 +219,18 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end)
215static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end) 219static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end)
216{ 220{
217 u8 **ptr; 221 u8 **ptr;
222 char insn[1];
218 223
219 if (noreplace_smp) 224 if (noreplace_smp)
220 return; 225 return;
221 226
227 add_nops(insn, 1);
222 for (ptr = start; ptr < end; ptr++) { 228 for (ptr = start; ptr < end; ptr++) {
223 if (*ptr < text) 229 if (*ptr < text)
224 continue; 230 continue;
225 if (*ptr > text_end) 231 if (*ptr > text_end)
226 continue; 232 continue;
227 nop_out(*ptr, 1); 233 text_poke(*ptr, insn, 1);
228 }; 234 };
229} 235}
230 236
@@ -351,6 +357,7 @@ void apply_paravirt(struct paravirt_patch_site *start,
351 struct paravirt_patch_site *end) 357 struct paravirt_patch_site *end)
352{ 358{
353 struct paravirt_patch_site *p; 359 struct paravirt_patch_site *p;
360 char insnbuf[MAX_PATCH_LEN];
354 361
355 if (noreplace_paravirt) 362 if (noreplace_paravirt)
356 return; 363 return;
@@ -358,13 +365,15 @@ void apply_paravirt(struct paravirt_patch_site *start,
358 for (p = start; p < end; p++) { 365 for (p = start; p < end; p++) {
359 unsigned int used; 366 unsigned int used;
360 367
361 used = paravirt_ops.patch(p->instrtype, p->clobbers, p->instr, 368 BUG_ON(p->len > MAX_PATCH_LEN);
362 p->len); 369 used = paravirt_ops.patch(p->instrtype, p->clobbers, insnbuf,
370 (unsigned long)p->instr, p->len);
363 371
364 BUG_ON(used > p->len); 372 BUG_ON(used > p->len);
365 373
366 /* Pad the rest with nops */ 374 /* Pad the rest with nops */
367 nop_out(p->instr + used, p->len - used); 375 add_nops(insnbuf + used, p->len - used);
376 text_poke(p->instr, insnbuf, p->len);
368 } 377 }
369} 378}
370extern struct paravirt_patch_site __start_parainstructions[], 379extern struct paravirt_patch_site __start_parainstructions[],
@@ -379,7 +388,7 @@ void __init alternative_instructions(void)
379 that might execute the to be patched code. 388 that might execute the to be patched code.
380 Other CPUs are not running. */ 389 Other CPUs are not running. */
381 stop_nmi(); 390 stop_nmi();
382#ifdef CONFIG_MCE 391#ifdef CONFIG_X86_MCE
383 stop_mce(); 392 stop_mce();
384#endif 393#endif
385 394
@@ -417,7 +426,7 @@ void __init alternative_instructions(void)
417 local_irq_restore(flags); 426 local_irq_restore(flags);
418 427
419 restart_nmi(); 428 restart_nmi();
420#ifdef CONFIG_MCE 429#ifdef CONFIG_X86_MCE
421 restart_mce(); 430 restart_mce();
422#endif 431#endif
423} 432}
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index bfc6cb7df7e7..f9fff29e01a9 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -61,8 +61,9 @@ static int enable_local_apic __initdata = 0;
61 61
62/* Local APIC timer verification ok */ 62/* Local APIC timer verification ok */
63static int local_apic_timer_verify_ok; 63static int local_apic_timer_verify_ok;
64/* Disable local APIC timer from the kernel commandline or via dmi quirk */ 64/* Disable local APIC timer from the kernel commandline or via dmi quirk
65static int local_apic_timer_disabled; 65 or using CPU MSR check */
66int local_apic_timer_disabled;
66/* Local APIC timer works in C2 */ 67/* Local APIC timer works in C2 */
67int local_apic_timer_c2_ok; 68int local_apic_timer_c2_ok;
68EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok); 69EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
@@ -370,12 +371,9 @@ void __init setup_boot_APIC_clock(void)
370 long delta, deltapm; 371 long delta, deltapm;
371 int pm_referenced = 0; 372 int pm_referenced = 0;
372 373
373 if (boot_cpu_has(X86_FEATURE_LAPIC_TIMER_BROKEN))
374 local_apic_timer_disabled = 1;
375
376 /* 374 /*
377 * The local apic timer can be disabled via the kernel 375 * The local apic timer can be disabled via the kernel
378 * commandline or from the test above. Register the lapic 376 * commandline or from the CPU detection code. Register the lapic
379 * timer as a dummy clock event source on SMP systems, so the 377 * timer as a dummy clock event source on SMP systems, so the
380 * broadcast mechanism is used. On UP systems simply ignore it. 378 * broadcast mechanism is used. On UP systems simply ignore it.
381 */ 379 */
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c
index c7ba455d5ac7..dcf6bbb1c7c0 100644
--- a/arch/i386/kernel/cpu/amd.c
+++ b/arch/i386/kernel/cpu/amd.c
@@ -3,6 +3,7 @@
3#include <linux/mm.h> 3#include <linux/mm.h>
4#include <asm/io.h> 4#include <asm/io.h>
5#include <asm/processor.h> 5#include <asm/processor.h>
6#include <asm/apic.h>
6 7
7#include "cpu.h" 8#include "cpu.h"
8 9
@@ -22,6 +23,7 @@
22extern void vide(void); 23extern void vide(void);
23__asm__(".align 4\nvide: ret"); 24__asm__(".align 4\nvide: ret");
24 25
26#ifdef CONFIG_X86_LOCAL_APIC
25#define ENABLE_C1E_MASK 0x18000000 27#define ENABLE_C1E_MASK 0x18000000
26#define CPUID_PROCESSOR_SIGNATURE 1 28#define CPUID_PROCESSOR_SIGNATURE 1
27#define CPUID_XFAM 0x0ff00000 29#define CPUID_XFAM 0x0ff00000
@@ -52,6 +54,7 @@ static __cpuinit int amd_apic_timer_broken(void)
52 } 54 }
53 return 0; 55 return 0;
54} 56}
57#endif
55 58
56int force_mwait __cpuinitdata; 59int force_mwait __cpuinitdata;
57 60
@@ -282,8 +285,10 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
282 num_cache_leaves = 3; 285 num_cache_leaves = 3;
283 } 286 }
284 287
288#ifdef CONFIG_X86_LOCAL_APIC
285 if (amd_apic_timer_broken()) 289 if (amd_apic_timer_broken())
286 set_bit(X86_FEATURE_LAPIC_TIMER_BROKEN, c->x86_capability); 290 local_apic_timer_disabled = 1;
291#endif
287 292
288 if (c->x86 == 0x10 && !force_mwait) 293 if (c->x86 == 0x10 && !force_mwait)
289 clear_bit(X86_FEATURE_MWAIT, c->x86_capability); 294 clear_bit(X86_FEATURE_MWAIT, c->x86_capability);
diff --git a/arch/i386/kernel/doublefault.c b/arch/i386/kernel/doublefault.c
index 265c5597efb0..40978af630e7 100644
--- a/arch/i386/kernel/doublefault.c
+++ b/arch/i386/kernel/doublefault.c
@@ -13,7 +13,7 @@
13static unsigned long doublefault_stack[DOUBLEFAULT_STACKSIZE]; 13static unsigned long doublefault_stack[DOUBLEFAULT_STACKSIZE];
14#define STACK_START (unsigned long)(doublefault_stack+DOUBLEFAULT_STACKSIZE) 14#define STACK_START (unsigned long)(doublefault_stack+DOUBLEFAULT_STACKSIZE)
15 15
16#define ptr_ok(x) ((x) > PAGE_OFFSET && (x) < PAGE_OFFSET + 0x1000000) 16#define ptr_ok(x) ((x) > PAGE_OFFSET && (x) < PAGE_OFFSET + MAXMEM)
17 17
18static void doublefault_fn(void) 18static void doublefault_fn(void)
19{ 19{
@@ -23,23 +23,23 @@ static void doublefault_fn(void)
23 store_gdt(&gdt_desc); 23 store_gdt(&gdt_desc);
24 gdt = gdt_desc.address; 24 gdt = gdt_desc.address;
25 25
26 printk("double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size); 26 printk(KERN_EMERG "PANIC: double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size);
27 27
28 if (ptr_ok(gdt)) { 28 if (ptr_ok(gdt)) {
29 gdt += GDT_ENTRY_TSS << 3; 29 gdt += GDT_ENTRY_TSS << 3;
30 tss = *(u16 *)(gdt+2); 30 tss = *(u16 *)(gdt+2);
31 tss += *(u8 *)(gdt+4) << 16; 31 tss += *(u8 *)(gdt+4) << 16;
32 tss += *(u8 *)(gdt+7) << 24; 32 tss += *(u8 *)(gdt+7) << 24;
33 printk("double fault, tss at %08lx\n", tss); 33 printk(KERN_EMERG "double fault, tss at %08lx\n", tss);
34 34
35 if (ptr_ok(tss)) { 35 if (ptr_ok(tss)) {
36 struct i386_hw_tss *t = (struct i386_hw_tss *)tss; 36 struct i386_hw_tss *t = (struct i386_hw_tss *)tss;
37 37
38 printk("eip = %08lx, esp = %08lx\n", t->eip, t->esp); 38 printk(KERN_EMERG "eip = %08lx, esp = %08lx\n", t->eip, t->esp);
39 39
40 printk("eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n", 40 printk(KERN_EMERG "eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n",
41 t->eax, t->ebx, t->ecx, t->edx); 41 t->eax, t->ebx, t->ecx, t->edx);
42 printk("esi = %08lx, edi = %08lx\n", 42 printk(KERN_EMERG "esi = %08lx, edi = %08lx\n",
43 t->esi, t->edi); 43 t->esi, t->edi);
44 } 44 }
45 } 45 }
@@ -63,6 +63,7 @@ struct tss_struct doublefault_tss __cacheline_aligned = {
63 .cs = __KERNEL_CS, 63 .cs = __KERNEL_CS,
64 .ss = __KERNEL_DS, 64 .ss = __KERNEL_DS,
65 .ds = __USER_DS, 65 .ds = __USER_DS,
66 .fs = __KERNEL_PERCPU,
66 67
67 .__cr3 = __pa(swapper_pg_dir) 68 .__cr3 = __pa(swapper_pg_dir)
68 } 69 }
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index 7c52b222207e..8f0382161c91 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -162,9 +162,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
162 * which will be freed later 162 * which will be freed later
163 */ 163 */
164 164
165#ifdef CONFIG_HOTPLUG_CPU 165#ifndef CONFIG_HOTPLUG_CPU
166.section .text,"ax",@progbits
167#else
168.section .init.text,"ax",@progbits 166.section .init.text,"ax",@progbits
169#endif 167#endif
170 168
diff --git a/arch/i386/kernel/paravirt.c b/arch/i386/kernel/paravirt.c
index ea962c0667d5..739cfb207dd7 100644
--- a/arch/i386/kernel/paravirt.c
+++ b/arch/i386/kernel/paravirt.c
@@ -69,7 +69,8 @@ DEF_NATIVE(read_tsc, "rdtsc");
69 69
70DEF_NATIVE(ud2a, "ud2a"); 70DEF_NATIVE(ud2a, "ud2a");
71 71
72static unsigned native_patch(u8 type, u16 clobbers, void *insns, unsigned len) 72static unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
73 unsigned long addr, unsigned len)
73{ 74{
74 const unsigned char *start, *end; 75 const unsigned char *start, *end;
75 unsigned ret; 76 unsigned ret;
@@ -90,7 +91,7 @@ static unsigned native_patch(u8 type, u16 clobbers, void *insns, unsigned len)
90#undef SITE 91#undef SITE
91 92
92 patch_site: 93 patch_site:
93 ret = paravirt_patch_insns(insns, len, start, end); 94 ret = paravirt_patch_insns(ibuf, len, start, end);
94 break; 95 break;
95 96
96 case PARAVIRT_PATCH(make_pgd): 97 case PARAVIRT_PATCH(make_pgd):
@@ -107,7 +108,7 @@ static unsigned native_patch(u8 type, u16 clobbers, void *insns, unsigned len)
107 break; 108 break;
108 109
109 default: 110 default:
110 ret = paravirt_patch_default(type, clobbers, insns, len); 111 ret = paravirt_patch_default(type, clobbers, ibuf, addr, len);
111 break; 112 break;
112 } 113 }
113 114
@@ -129,68 +130,67 @@ struct branch {
129 u32 delta; 130 u32 delta;
130} __attribute__((packed)); 131} __attribute__((packed));
131 132
132unsigned paravirt_patch_call(void *target, u16 tgt_clobbers, 133unsigned paravirt_patch_call(void *insnbuf,
133 void *site, u16 site_clobbers, 134 const void *target, u16 tgt_clobbers,
135 unsigned long addr, u16 site_clobbers,
134 unsigned len) 136 unsigned len)
135{ 137{
136 unsigned char *call = site; 138 struct branch *b = insnbuf;
137 unsigned long delta = (unsigned long)target - (unsigned long)(call+5); 139 unsigned long delta = (unsigned long)target - (addr+5);
138 struct branch b;
139 140
140 if (tgt_clobbers & ~site_clobbers) 141 if (tgt_clobbers & ~site_clobbers)
141 return len; /* target would clobber too much for this site */ 142 return len; /* target would clobber too much for this site */
142 if (len < 5) 143 if (len < 5)
143 return len; /* call too long for patch site */ 144 return len; /* call too long for patch site */
144 145
145 b.opcode = 0xe8; /* call */ 146 b->opcode = 0xe8; /* call */
146 b.delta = delta; 147 b->delta = delta;
147 BUILD_BUG_ON(sizeof(b) != 5); 148 BUILD_BUG_ON(sizeof(*b) != 5);
148 text_poke(call, (unsigned char *)&b, 5);
149 149
150 return 5; 150 return 5;
151} 151}
152 152
153unsigned paravirt_patch_jmp(void *target, void *site, unsigned len) 153unsigned paravirt_patch_jmp(const void *target, void *insnbuf,
154 unsigned long addr, unsigned len)
154{ 155{
155 unsigned char *jmp = site; 156 struct branch *b = insnbuf;
156 unsigned long delta = (unsigned long)target - (unsigned long)(jmp+5); 157 unsigned long delta = (unsigned long)target - (addr+5);
157 struct branch b;
158 158
159 if (len < 5) 159 if (len < 5)
160 return len; /* call too long for patch site */ 160 return len; /* call too long for patch site */
161 161
162 b.opcode = 0xe9; /* jmp */ 162 b->opcode = 0xe9; /* jmp */
163 b.delta = delta; 163 b->delta = delta;
164 text_poke(jmp, (unsigned char *)&b, 5);
165 164
166 return 5; 165 return 5;
167} 166}
168 167
169unsigned paravirt_patch_default(u8 type, u16 clobbers, void *site, unsigned len) 168unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
169 unsigned long addr, unsigned len)
170{ 170{
171 void *opfunc = *((void **)&paravirt_ops + type); 171 void *opfunc = *((void **)&paravirt_ops + type);
172 unsigned ret; 172 unsigned ret;
173 173
174 if (opfunc == NULL) 174 if (opfunc == NULL)
175 /* If there's no function, patch it with a ud2a (BUG) */ 175 /* If there's no function, patch it with a ud2a (BUG) */
176 ret = paravirt_patch_insns(site, len, start_ud2a, end_ud2a); 176 ret = paravirt_patch_insns(insnbuf, len, start_ud2a, end_ud2a);
177 else if (opfunc == paravirt_nop) 177 else if (opfunc == paravirt_nop)
178 /* If the operation is a nop, then nop the callsite */ 178 /* If the operation is a nop, then nop the callsite */
179 ret = paravirt_patch_nop(); 179 ret = paravirt_patch_nop();
180 else if (type == PARAVIRT_PATCH(iret) || 180 else if (type == PARAVIRT_PATCH(iret) ||
181 type == PARAVIRT_PATCH(irq_enable_sysexit)) 181 type == PARAVIRT_PATCH(irq_enable_sysexit))
182 /* If operation requires a jmp, then jmp */ 182 /* If operation requires a jmp, then jmp */
183 ret = paravirt_patch_jmp(opfunc, site, len); 183 ret = paravirt_patch_jmp(opfunc, insnbuf, addr, len);
184 else 184 else
185 /* Otherwise call the function; assume target could 185 /* Otherwise call the function; assume target could
186 clobber any caller-save reg */ 186 clobber any caller-save reg */
187 ret = paravirt_patch_call(opfunc, CLBR_ANY, 187 ret = paravirt_patch_call(insnbuf, opfunc, CLBR_ANY,
188 site, clobbers, len); 188 addr, clobbers, len);
189 189
190 return ret; 190 return ret;
191} 191}
192 192
193unsigned paravirt_patch_insns(void *site, unsigned len, 193unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
194 const char *start, const char *end) 194 const char *start, const char *end)
195{ 195{
196 unsigned insn_len = end - start; 196 unsigned insn_len = end - start;
@@ -198,7 +198,7 @@ unsigned paravirt_patch_insns(void *site, unsigned len,
198 if (insn_len > len || start == NULL) 198 if (insn_len > len || start == NULL)
199 insn_len = len; 199 insn_len = len;
200 else 200 else
201 memcpy(site, start, insn_len); 201 memcpy(insnbuf, start, insn_len);
202 202
203 return insn_len; 203 return insn_len;
204} 204}
diff --git a/arch/i386/kernel/vmi.c b/arch/i386/kernel/vmi.c
index 72042bb7ec94..18673e0f193b 100644
--- a/arch/i386/kernel/vmi.c
+++ b/arch/i386/kernel/vmi.c
@@ -87,12 +87,14 @@ struct vmi_timer_ops vmi_timer_ops;
87#define IRQ_PATCH_INT_MASK 0 87#define IRQ_PATCH_INT_MASK 0
88#define IRQ_PATCH_DISABLE 5 88#define IRQ_PATCH_DISABLE 5
89 89
90static inline void patch_offset(unsigned char *eip, unsigned char *dest) 90static inline void patch_offset(void *insnbuf,
91 unsigned long eip, unsigned long dest)
91{ 92{
92 *(unsigned long *)(eip+1) = dest-eip-5; 93 *(unsigned long *)(insnbuf+1) = dest-eip-5;
93} 94}
94 95
95static unsigned patch_internal(int call, unsigned len, void *insns) 96static unsigned patch_internal(int call, unsigned len, void *insnbuf,
97 unsigned long eip)
96{ 98{
97 u64 reloc; 99 u64 reloc;
98 struct vmi_relocation_info *const rel = (struct vmi_relocation_info *)&reloc; 100 struct vmi_relocation_info *const rel = (struct vmi_relocation_info *)&reloc;
@@ -100,14 +102,14 @@ static unsigned patch_internal(int call, unsigned len, void *insns)
100 switch(rel->type) { 102 switch(rel->type) {
101 case VMI_RELOCATION_CALL_REL: 103 case VMI_RELOCATION_CALL_REL:
102 BUG_ON(len < 5); 104 BUG_ON(len < 5);
103 *(char *)insns = MNEM_CALL; 105 *(char *)insnbuf = MNEM_CALL;
104 patch_offset(insns, rel->eip); 106 patch_offset(insnbuf, eip, (unsigned long)rel->eip);
105 return 5; 107 return 5;
106 108
107 case VMI_RELOCATION_JUMP_REL: 109 case VMI_RELOCATION_JUMP_REL:
108 BUG_ON(len < 5); 110 BUG_ON(len < 5);
109 *(char *)insns = MNEM_JMP; 111 *(char *)insnbuf = MNEM_JMP;
110 patch_offset(insns, rel->eip); 112 patch_offset(insnbuf, eip, (unsigned long)rel->eip);
111 return 5; 113 return 5;
112 114
113 case VMI_RELOCATION_NOP: 115 case VMI_RELOCATION_NOP:
@@ -128,21 +130,26 @@ static unsigned patch_internal(int call, unsigned len, void *insns)
128 * Apply patch if appropriate, return length of new instruction 130 * Apply patch if appropriate, return length of new instruction
129 * sequence. The callee does nop padding for us. 131 * sequence. The callee does nop padding for us.
130 */ 132 */
131static unsigned vmi_patch(u8 type, u16 clobbers, void *insns, unsigned len) 133static unsigned vmi_patch(u8 type, u16 clobbers, void *insns,
134 unsigned long eip, unsigned len)
132{ 135{
133 switch (type) { 136 switch (type) {
134 case PARAVIRT_PATCH(irq_disable): 137 case PARAVIRT_PATCH(irq_disable):
135 return patch_internal(VMI_CALL_DisableInterrupts, len, insns); 138 return patch_internal(VMI_CALL_DisableInterrupts, len,
139 insns, eip);
136 case PARAVIRT_PATCH(irq_enable): 140 case PARAVIRT_PATCH(irq_enable):
137 return patch_internal(VMI_CALL_EnableInterrupts, len, insns); 141 return patch_internal(VMI_CALL_EnableInterrupts, len,
142 insns, eip);
138 case PARAVIRT_PATCH(restore_fl): 143 case PARAVIRT_PATCH(restore_fl):
139 return patch_internal(VMI_CALL_SetInterruptMask, len, insns); 144 return patch_internal(VMI_CALL_SetInterruptMask, len,
145 insns, eip);
140 case PARAVIRT_PATCH(save_fl): 146 case PARAVIRT_PATCH(save_fl):
141 return patch_internal(VMI_CALL_GetInterruptMask, len, insns); 147 return patch_internal(VMI_CALL_GetInterruptMask, len,
148 insns, eip);
142 case PARAVIRT_PATCH(iret): 149 case PARAVIRT_PATCH(iret):
143 return patch_internal(VMI_CALL_IRET, len, insns); 150 return patch_internal(VMI_CALL_IRET, len, insns, eip);
144 case PARAVIRT_PATCH(irq_enable_sysexit): 151 case PARAVIRT_PATCH(irq_enable_sysexit):
145 return patch_internal(VMI_CALL_SYSEXIT, len, insns); 152 return patch_internal(VMI_CALL_SYSEXIT, len, insns, eip);
146 default: 153 default:
147 break; 154 break;
148 } 155 }
diff --git a/arch/i386/mm/pageattr.c b/arch/i386/mm/pageattr.c
index 8927222b3ab2..4241a74d16c8 100644
--- a/arch/i386/mm/pageattr.c
+++ b/arch/i386/mm/pageattr.c
@@ -82,7 +82,7 @@ static void flush_kernel_map(void *arg)
82 struct page *p; 82 struct page *p;
83 83
84 /* High level code is not ready for clflush yet */ 84 /* High level code is not ready for clflush yet */
85 if (cpu_has_clflush) { 85 if (0 && cpu_has_clflush) {
86 list_for_each_entry (p, lh, lru) 86 list_for_each_entry (p, lh, lru)
87 cache_flush_page(p); 87 cache_flush_page(p);
88 } else if (boot_cpu_data.x86_model >= 4) 88 } else if (boot_cpu_data.x86_model >= 4)
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
index 85503deeda46..ebc6f3c66340 100644
--- a/arch/i386/pci/common.c
+++ b/arch/i386/pci/common.c
@@ -455,3 +455,26 @@ void pcibios_disable_device (struct pci_dev *dev)
455 if (!dev->msi_enabled && pcibios_disable_irq) 455 if (!dev->msi_enabled && pcibios_disable_irq)
456 pcibios_disable_irq(dev); 456 pcibios_disable_irq(dev);
457} 457}
458
459struct pci_bus *pci_scan_bus_with_sysdata(int busno)
460{
461 struct pci_bus *bus = NULL;
462 struct pci_sysdata *sd;
463
464 /*
465 * Allocate per-root-bus (not per bus) arch-specific data.
466 * TODO: leak; this memory is never freed.
467 * It's arguable whether it's worth the trouble to care.
468 */
469 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
470 if (!sd) {
471 printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busno);
472 return NULL;
473 }
474 sd->node = -1;
475 bus = pci_scan_bus(busno, &pci_root_ops, sd);
476 if (!bus)
477 kfree(sd);
478
479 return bus;
480}
diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c
index e7306dbf6c42..c82cbf4c7226 100644
--- a/arch/i386/pci/fixup.c
+++ b/arch/i386/pci/fixup.c
@@ -25,9 +25,9 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
25 pci_read_config_byte(d, reg++, &subb); 25 pci_read_config_byte(d, reg++, &subb);
26 DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb); 26 DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb);
27 if (busno) 27 if (busno)
28 pci_scan_bus(busno, &pci_root_ops, NULL); /* Bus A */ 28 pci_scan_bus_with_sysdata(busno); /* Bus A */
29 if (suba < subb) 29 if (suba < subb)
30 pci_scan_bus(suba+1, &pci_root_ops, NULL); /* Bus B */ 30 pci_scan_bus_with_sysdata(suba+1); /* Bus B */
31 } 31 }
32 pcibios_last_bus = -1; 32 pcibios_last_bus = -1;
33} 33}
@@ -42,7 +42,7 @@ static void __devinit pci_fixup_i450gx(struct pci_dev *d)
42 u8 busno; 42 u8 busno;
43 pci_read_config_byte(d, 0x4a, &busno); 43 pci_read_config_byte(d, 0x4a, &busno);
44 printk(KERN_INFO "PCI: i440KX/GX host bridge %s: secondary bus %02x\n", pci_name(d), busno); 44 printk(KERN_INFO "PCI: i440KX/GX host bridge %s: secondary bus %02x\n", pci_name(d), busno);
45 pci_scan_bus(busno, &pci_root_ops, NULL); 45 pci_scan_bus_with_sysdata(busno);
46 pcibios_last_bus = -1; 46 pcibios_last_bus = -1;
47} 47}
48DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx); 48DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx);
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
index f2cb942f8281..665db063a40a 100644
--- a/arch/i386/pci/irq.c
+++ b/arch/i386/pci/irq.c
@@ -138,8 +138,9 @@ static void __init pirq_peer_trick(void)
138 for(i = 1; i < 256; i++) { 138 for(i = 1; i < 256; i++) {
139 if (!busmap[i] || pci_find_bus(0, i)) 139 if (!busmap[i] || pci_find_bus(0, i))
140 continue; 140 continue;
141 if (pci_scan_bus(i, &pci_root_ops, NULL)) 141 if (pci_scan_bus_with_sysdata(i))
142 printk(KERN_INFO "PCI: Discovered primary peer bus %02x [IRQ]\n", i); 142 printk(KERN_INFO "PCI: Discovered primary peer "
143 "bus %02x [IRQ]\n", i);
143 } 144 }
144 pcibios_last_bus = -1; 145 pcibios_last_bus = -1;
145} 146}
diff --git a/arch/i386/pci/legacy.c b/arch/i386/pci/legacy.c
index 149a9588c256..5565d7016b75 100644
--- a/arch/i386/pci/legacy.c
+++ b/arch/i386/pci/legacy.c
@@ -26,7 +26,7 @@ static void __devinit pcibios_fixup_peer_bridges(void)
26 l != 0x0000 && l != 0xffff) { 26 l != 0x0000 && l != 0xffff) {
27 DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l); 27 DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l);
28 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n); 28 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n);
29 pci_scan_bus(n, &pci_root_ops, NULL); 29 pci_scan_bus_with_sysdata(n);
30 break; 30 break;
31 } 31 }
32 } 32 }
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
index bb1afd9e589d..0d46b7a88b3b 100644
--- a/arch/i386/pci/mmconfig.c
+++ b/arch/i386/pci/mmconfig.c
@@ -82,16 +82,15 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
82 82
83 switch (len) { 83 switch (len) {
84 case 1: 84 case 1:
85 *value = readb(mmcfg_virt_addr + reg); 85 *value = mmio_config_readb(mmcfg_virt_addr + reg);
86 break; 86 break;
87 case 2: 87 case 2:
88 *value = readw(mmcfg_virt_addr + reg); 88 *value = mmio_config_readw(mmcfg_virt_addr + reg);
89 break; 89 break;
90 case 4: 90 case 4:
91 *value = readl(mmcfg_virt_addr + reg); 91 *value = mmio_config_readl(mmcfg_virt_addr + reg);
92 break; 92 break;
93 } 93 }
94
95 spin_unlock_irqrestore(&pci_config_lock, flags); 94 spin_unlock_irqrestore(&pci_config_lock, flags);
96 95
97 return 0; 96 return 0;
@@ -116,16 +115,15 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
116 115
117 switch (len) { 116 switch (len) {
118 case 1: 117 case 1:
119 writeb(value, mmcfg_virt_addr + reg); 118 mmio_config_writeb(mmcfg_virt_addr, value);
120 break; 119 break;
121 case 2: 120 case 2:
122 writew(value, mmcfg_virt_addr + reg); 121 mmio_config_writew(mmcfg_virt_addr, value);
123 break; 122 break;
124 case 4: 123 case 4:
125 writel(value, mmcfg_virt_addr + reg); 124 mmio_config_writel(mmcfg_virt_addr, value);
126 break; 125 break;
127 } 126 }
128
129 spin_unlock_irqrestore(&pci_config_lock, flags); 127 spin_unlock_irqrestore(&pci_config_lock, flags);
130 128
131 return 0; 129 return 0;
diff --git a/arch/i386/pci/numa.c b/arch/i386/pci/numa.c
index adbe17a38f6f..f5f165f69e0c 100644
--- a/arch/i386/pci/numa.c
+++ b/arch/i386/pci/numa.c
@@ -96,10 +96,14 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
96 pci_read_config_byte(d, reg++, &suba); 96 pci_read_config_byte(d, reg++, &suba);
97 pci_read_config_byte(d, reg++, &subb); 97 pci_read_config_byte(d, reg++, &subb);
98 DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb); 98 DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb);
99 if (busno) 99 if (busno) {
100 pci_scan_bus(QUADLOCAL2BUS(quad,busno), &pci_root_ops, NULL); /* Bus A */ 100 /* Bus A */
101 if (suba < subb) 101 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno));
102 pci_scan_bus(QUADLOCAL2BUS(quad,suba+1), &pci_root_ops, NULL); /* Bus B */ 102 }
103 if (suba < subb) {
104 /* Bus B */
105 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, suba+1));
106 }
103 } 107 }
104 pcibios_last_bus = -1; 108 pcibios_last_bus = -1;
105} 109}
@@ -123,8 +127,7 @@ static int __init pci_numa_init(void)
123 continue; 127 continue;
124 printk("Scanning PCI bus %d for quad %d\n", 128 printk("Scanning PCI bus %d for quad %d\n",
125 QUADLOCAL2BUS(quad,0), quad); 129 QUADLOCAL2BUS(quad,0), quad);
126 pci_scan_bus(QUADLOCAL2BUS(quad,0), 130 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, 0));
127 &pci_root_ops, NULL);
128 } 131 }
129 return 0; 132 return 0;
130} 133}
diff --git a/arch/i386/pci/pci.h b/arch/i386/pci/pci.h
index e58bae2076ad..8c66f275756f 100644
--- a/arch/i386/pci/pci.h
+++ b/arch/i386/pci/pci.h
@@ -104,3 +104,46 @@ extern DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS);
104extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus, 104extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
105 unsigned int devfn); 105 unsigned int devfn);
106extern int __init pci_mmcfg_arch_init(void); 106extern int __init pci_mmcfg_arch_init(void);
107
108/*
109 * AMD Fam10h CPUs are buggy, and cannot access MMIO config space
110 * on their northbrige except through the * %eax register. As such, you MUST
111 * NOT use normal IOMEM accesses, you need to only use the magic mmio-config
112 * accessor functions.
113 * In fact just use pci_config_*, nothing else please.
114 */
115static inline unsigned char mmio_config_readb(void __iomem *pos)
116{
117 u8 val;
118 asm volatile("movb (%1),%%al" : "=a" (val) : "r" (pos));
119 return val;
120}
121
122static inline unsigned short mmio_config_readw(void __iomem *pos)
123{
124 u16 val;
125 asm volatile("movw (%1),%%ax" : "=a" (val) : "r" (pos));
126 return val;
127}
128
129static inline unsigned int mmio_config_readl(void __iomem *pos)
130{
131 u32 val;
132 asm volatile("movl (%1),%%eax" : "=a" (val) : "r" (pos));
133 return val;
134}
135
136static inline void mmio_config_writeb(void __iomem *pos, u8 val)
137{
138 asm volatile("movb %%al,(%1)" :: "a" (val), "r" (pos) : "memory");
139}
140
141static inline void mmio_config_writew(void __iomem *pos, u16 val)
142{
143 asm volatile("movw %%ax,(%1)" :: "a" (val), "r" (pos) : "memory");
144}
145
146static inline void mmio_config_writel(void __iomem *pos, u32 val)
147{
148 asm volatile("movl %%eax,(%1)" :: "a" (val), "r" (pos) : "memory");
149}
diff --git a/arch/i386/pci/visws.c b/arch/i386/pci/visws.c
index f1b486d4190b..8ecb1c722594 100644
--- a/arch/i386/pci/visws.c
+++ b/arch/i386/pci/visws.c
@@ -101,8 +101,8 @@ static int __init pcibios_init(void)
101 "bridge B (PIIX4) bus: %u\n", pci_bus1, pci_bus0); 101 "bridge B (PIIX4) bus: %u\n", pci_bus1, pci_bus0);
102 102
103 raw_pci_ops = &pci_direct_conf1; 103 raw_pci_ops = &pci_direct_conf1;
104 pci_scan_bus(pci_bus0, &pci_root_ops, NULL); 104 pci_scan_bus_with_sysdata(pci_bus0);
105 pci_scan_bus(pci_bus1, &pci_root_ops, NULL); 105 pci_scan_bus_with_sysdata(pci_bus1);
106 pci_fixup_irqs(visws_swizzle, visws_map_irq); 106 pci_fixup_irqs(visws_swizzle, visws_map_irq);
107 pcibios_resource_survey(); 107 pcibios_resource_survey();
108 return 0; 108 return 0;
diff --git a/arch/i386/xen/enlighten.c b/arch/i386/xen/enlighten.c
index 9a8c1181c001..f0c37511d8da 100644
--- a/arch/i386/xen/enlighten.c
+++ b/arch/i386/xen/enlighten.c
@@ -842,7 +842,8 @@ void __init xen_setup_vcpu_info_placement(void)
842 } 842 }
843} 843}
844 844
845static unsigned xen_patch(u8 type, u16 clobbers, void *insns, unsigned len) 845static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
846 unsigned long addr, unsigned len)
846{ 847{
847 char *start, *end, *reloc; 848 char *start, *end, *reloc;
848 unsigned ret; 849 unsigned ret;
@@ -869,7 +870,7 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insns, unsigned len)
869 if (start == NULL || (end-start) > len) 870 if (start == NULL || (end-start) > len)
870 goto default_patch; 871 goto default_patch;
871 872
872 ret = paravirt_patch_insns(insns, len, start, end); 873 ret = paravirt_patch_insns(insnbuf, len, start, end);
873 874
874 /* Note: because reloc is assigned from something that 875 /* Note: because reloc is assigned from something that
875 appears to be an array, gcc assumes it's non-null, 876 appears to be an array, gcc assumes it's non-null,
@@ -877,8 +878,8 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insns, unsigned len)
877 end. */ 878 end. */
878 if (reloc > start && reloc < end) { 879 if (reloc > start && reloc < end) {
879 int reloc_off = reloc - start; 880 int reloc_off = reloc - start;
880 long *relocp = (long *)(insns + reloc_off); 881 long *relocp = (long *)(insnbuf + reloc_off);
881 long delta = start - (char *)insns; 882 long delta = start - (char *)addr;
882 883
883 *relocp += delta; 884 *relocp += delta;
884 } 885 }
@@ -886,7 +887,8 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insns, unsigned len)
886 887
887 default_patch: 888 default_patch:
888 default: 889 default:
889 ret = paravirt_patch_default(type, clobbers, insns, len); 890 ret = paravirt_patch_default(type, clobbers, insnbuf,
891 addr, len);
890 break; 892 break;
891 } 893 }
892 894
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig
index d0b43df44426..ca7a197998ee 100644
--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -1,9 +1,23 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22-rc6 3# Linux kernel version: 2.6.23-rc2
4# Tue Jun 26 14:15:19 2007 4# Tue Aug 7 19:17:26 2007
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7
8#
9# Processor support
10#
11# CONFIG_POWER4_ONLY is not set
12CONFIG_POWER3=y
13CONFIG_POWER4=y
14CONFIG_PPC_FPU=y
15CONFIG_ALTIVEC=y
16CONFIG_PPC_STD_MMU=y
17# CONFIG_PPC_MM_SLICES is not set
18CONFIG_VIRT_CPU_ACCOUNTING=y
19CONFIG_SMP=y
20CONFIG_NR_CPUS=2
7CONFIG_64BIT=y 21CONFIG_64BIT=y
8CONFIG_PPC_MERGE=y 22CONFIG_PPC_MERGE=y
9CONFIG_MMU=y 23CONFIG_MMU=y
@@ -15,6 +29,7 @@ CONFIG_ARCH_HAS_ILOG2_U64=y
15CONFIG_GENERIC_HWEIGHT=y 29CONFIG_GENERIC_HWEIGHT=y
16CONFIG_GENERIC_CALIBRATE_DELAY=y 30CONFIG_GENERIC_CALIBRATE_DELAY=y
17CONFIG_GENERIC_FIND_NEXT_BIT=y 31CONFIG_GENERIC_FIND_NEXT_BIT=y
32CONFIG_ARCH_NO_VIRT_TO_BUS=y
18CONFIG_PPC=y 33CONFIG_PPC=y
19CONFIG_EARLY_PRINTK=y 34CONFIG_EARLY_PRINTK=y
20CONFIG_COMPAT=y 35CONFIG_COMPAT=y
@@ -22,50 +37,32 @@ CONFIG_SYSVIPC_COMPAT=y
22CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 37CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
23CONFIG_ARCH_MAY_HAVE_PC_FDC=y 38CONFIG_ARCH_MAY_HAVE_PC_FDC=y
24CONFIG_PPC_OF=y 39CONFIG_PPC_OF=y
40CONFIG_OF=y
25# CONFIG_PPC_UDBG_16550 is not set 41# CONFIG_PPC_UDBG_16550 is not set
26# CONFIG_GENERIC_TBSYNC is not set 42# CONFIG_GENERIC_TBSYNC is not set
27CONFIG_AUDIT_ARCH=y 43CONFIG_AUDIT_ARCH=y
28CONFIG_GENERIC_BUG=y 44CONFIG_GENERIC_BUG=y
29# CONFIG_DEFAULT_UIMAGE is not set 45# CONFIG_DEFAULT_UIMAGE is not set
30
31#
32# Processor support
33#
34# CONFIG_POWER4_ONLY is not set
35CONFIG_POWER3=y
36CONFIG_POWER4=y
37CONFIG_PPC_FPU=y
38# CONFIG_PPC_DCR_NATIVE is not set 46# CONFIG_PPC_DCR_NATIVE is not set
39# CONFIG_PPC_DCR_MMIO is not set 47# CONFIG_PPC_DCR_MMIO is not set
40# CONFIG_PPC_OF_PLATFORM_PCI is not set 48# CONFIG_PPC_OF_PLATFORM_PCI is not set
41CONFIG_ALTIVEC=y
42CONFIG_PPC_STD_MMU=y
43# CONFIG_PPC_MM_SLICES is not set
44CONFIG_VIRT_CPU_ACCOUNTING=y
45CONFIG_SMP=y
46CONFIG_NR_CPUS=2
47CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 49CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
48 50
49# 51#
50# Code maturity level options 52# General setup
51# 53#
52CONFIG_EXPERIMENTAL=y 54CONFIG_EXPERIMENTAL=y
53CONFIG_LOCK_KERNEL=y 55CONFIG_LOCK_KERNEL=y
54CONFIG_INIT_ENV_ARG_LIMIT=32 56CONFIG_INIT_ENV_ARG_LIMIT=32
55
56#
57# General setup
58#
59CONFIG_LOCALVERSION="" 57CONFIG_LOCALVERSION=""
60CONFIG_LOCALVERSION_AUTO=y 58CONFIG_LOCALVERSION_AUTO=y
61CONFIG_SWAP=y 59CONFIG_SWAP=y
62CONFIG_SYSVIPC=y 60CONFIG_SYSVIPC=y
63# CONFIG_IPC_NS is not set
64CONFIG_SYSVIPC_SYSCTL=y 61CONFIG_SYSVIPC_SYSCTL=y
65# CONFIG_POSIX_MQUEUE is not set 62# CONFIG_POSIX_MQUEUE is not set
66# CONFIG_BSD_PROCESS_ACCT is not set 63# CONFIG_BSD_PROCESS_ACCT is not set
67# CONFIG_TASKSTATS is not set 64# CONFIG_TASKSTATS is not set
68# CONFIG_UTS_NS is not set 65# CONFIG_USER_NS is not set
69# CONFIG_AUDIT is not set 66# CONFIG_AUDIT is not set
70# CONFIG_IKCONFIG is not set 67# CONFIG_IKCONFIG is not set
71CONFIG_LOG_BUF_SHIFT=17 68CONFIG_LOG_BUF_SHIFT=17
@@ -100,10 +97,6 @@ CONFIG_SLAB=y
100CONFIG_RT_MUTEXES=y 97CONFIG_RT_MUTEXES=y
101# CONFIG_TINY_SHMEM is not set 98# CONFIG_TINY_SHMEM is not set
102CONFIG_BASE_SMALL=0 99CONFIG_BASE_SMALL=0
103
104#
105# Loadable module support
106#
107CONFIG_MODULES=y 100CONFIG_MODULES=y
108CONFIG_MODULE_UNLOAD=y 101CONFIG_MODULE_UNLOAD=y
109# CONFIG_MODULE_FORCE_UNLOAD is not set 102# CONFIG_MODULE_FORCE_UNLOAD is not set
@@ -111,12 +104,9 @@ CONFIG_MODULE_UNLOAD=y
111# CONFIG_MODULE_SRCVERSION_ALL is not set 104# CONFIG_MODULE_SRCVERSION_ALL is not set
112CONFIG_KMOD=y 105CONFIG_KMOD=y
113CONFIG_STOP_MACHINE=y 106CONFIG_STOP_MACHINE=y
114
115#
116# Block layer
117#
118CONFIG_BLOCK=y 107CONFIG_BLOCK=y
119# CONFIG_BLK_DEV_IO_TRACE is not set 108# CONFIG_BLK_DEV_IO_TRACE is not set
109CONFIG_BLK_DEV_BSG=y
120 110
121# 111#
122# IO Schedulers 112# IO Schedulers
@@ -136,7 +126,9 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
136# 126#
137CONFIG_PPC_MULTIPLATFORM=y 127CONFIG_PPC_MULTIPLATFORM=y
138# CONFIG_EMBEDDED6xx is not set 128# CONFIG_EMBEDDED6xx is not set
139# CONFIG_APUS is not set 129# CONFIG_PPC_82xx is not set
130# CONFIG_PPC_83xx is not set
131# CONFIG_PPC_86xx is not set
140# CONFIG_PPC_PSERIES is not set 132# CONFIG_PPC_PSERIES is not set
141# CONFIG_PPC_ISERIES is not set 133# CONFIG_PPC_ISERIES is not set
142# CONFIG_PPC_MPC52xx is not set 134# CONFIG_PPC_MPC52xx is not set
@@ -223,6 +215,7 @@ CONFIG_MEMORY_HOTPLUG_SPARSE=y
223CONFIG_SPLIT_PTLOCK_CPUS=4 215CONFIG_SPLIT_PTLOCK_CPUS=4
224CONFIG_RESOURCES_64BIT=y 216CONFIG_RESOURCES_64BIT=y
225CONFIG_ZONE_DMA_FLAG=1 217CONFIG_ZONE_DMA_FLAG=1
218CONFIG_BOUNCE=y
226CONFIG_ARCH_MEMORY_PROBE=y 219CONFIG_ARCH_MEMORY_PROBE=y
227# CONFIG_PPC_HAS_HASH_64K is not set 220# CONFIG_PPC_HAS_HASH_64K is not set
228# CONFIG_PPC_64K_PAGES is not set 221# CONFIG_PPC_64K_PAGES is not set
@@ -241,6 +234,7 @@ CONFIG_ZONE_DMA=y
241CONFIG_GENERIC_ISA_DMA=y 234CONFIG_GENERIC_ISA_DMA=y
242# CONFIG_PCI is not set 235# CONFIG_PCI is not set
243# CONFIG_PCI_DOMAINS is not set 236# CONFIG_PCI_DOMAINS is not set
237# CONFIG_PCI_SYSCALL is not set
244# CONFIG_ARCH_SUPPORTS_MSI is not set 238# CONFIG_ARCH_SUPPORTS_MSI is not set
245 239
246# 240#
@@ -365,6 +359,7 @@ CONFIG_WIRELESS_EXT=y
365# CONFIG_MAC80211 is not set 359# CONFIG_MAC80211 is not set
366# CONFIG_IEEE80211 is not set 360# CONFIG_IEEE80211 is not set
367# CONFIG_RFKILL is not set 361# CONFIG_RFKILL is not set
362# CONFIG_NET_9P is not set
368 363
369# 364#
370# Device Drivers 365# Device Drivers
@@ -379,26 +374,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
379# CONFIG_DEBUG_DRIVER is not set 374# CONFIG_DEBUG_DRIVER is not set
380# CONFIG_DEBUG_DEVRES is not set 375# CONFIG_DEBUG_DEVRES is not set
381# CONFIG_SYS_HYPERVISOR is not set 376# CONFIG_SYS_HYPERVISOR is not set
382
383#
384# Connector - unified userspace <-> kernelspace linker
385#
386# CONFIG_CONNECTOR is not set 377# CONFIG_CONNECTOR is not set
387# CONFIG_MTD is not set 378# CONFIG_MTD is not set
388 379CONFIG_OF_DEVICE=y
389#
390# Parallel port support
391#
392# CONFIG_PARPORT is not set 380# CONFIG_PARPORT is not set
393 381CONFIG_BLK_DEV=y
394#
395# Plug and Play support
396#
397# CONFIG_PNPACPI is not set
398
399#
400# Block devices
401#
402# CONFIG_BLK_DEV_FD is not set 382# CONFIG_BLK_DEV_FD is not set
403# CONFIG_BLK_DEV_COW_COMMON is not set 383# CONFIG_BLK_DEV_COW_COMMON is not set
404CONFIG_BLK_DEV_LOOP=y 384CONFIG_BLK_DEV_LOOP=y
@@ -411,11 +391,8 @@ CONFIG_BLK_DEV_RAM_SIZE=65535
411CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 391CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
412# CONFIG_CDROM_PKTCDVD is not set 392# CONFIG_CDROM_PKTCDVD is not set
413# CONFIG_ATA_OVER_ETH is not set 393# CONFIG_ATA_OVER_ETH is not set
414 394CONFIG_MISC_DEVICES=y
415# 395# CONFIG_EEPROM_93CX6 is not set
416# Misc devices
417#
418# CONFIG_BLINK is not set
419# CONFIG_IDE is not set 396# CONFIG_IDE is not set
420 397
421# 398#
@@ -423,6 +400,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
423# 400#
424# CONFIG_RAID_ATTRS is not set 401# CONFIG_RAID_ATTRS is not set
425CONFIG_SCSI=y 402CONFIG_SCSI=y
403CONFIG_SCSI_DMA=y
426# CONFIG_SCSI_TGT is not set 404# CONFIG_SCSI_TGT is not set
427# CONFIG_SCSI_NETLINK is not set 405# CONFIG_SCSI_NETLINK is not set
428CONFIG_SCSI_PROC_FS=y 406CONFIG_SCSI_PROC_FS=y
@@ -455,37 +433,22 @@ CONFIG_SCSI_WAIT_SCAN=m
455# CONFIG_SCSI_ISCSI_ATTRS is not set 433# CONFIG_SCSI_ISCSI_ATTRS is not set
456# CONFIG_SCSI_SAS_ATTRS is not set 434# CONFIG_SCSI_SAS_ATTRS is not set
457# CONFIG_SCSI_SAS_LIBSAS is not set 435# CONFIG_SCSI_SAS_LIBSAS is not set
458 436# CONFIG_SCSI_LOWLEVEL is not set
459#
460# SCSI low-level drivers
461#
462# CONFIG_ISCSI_TCP is not set
463# CONFIG_SCSI_DEBUG is not set
464# CONFIG_ATA is not set 437# CONFIG_ATA is not set
465
466#
467# Multi-device support (RAID and LVM)
468#
469# CONFIG_MD is not set 438# CONFIG_MD is not set
470# CONFIG_MACINTOSH_DRIVERS is not set 439# CONFIG_MACINTOSH_DRIVERS is not set
471
472#
473# Network device support
474#
475CONFIG_NETDEVICES=y 440CONFIG_NETDEVICES=y
441# CONFIG_NETDEVICES_MULTIQUEUE is not set
476# CONFIG_DUMMY is not set 442# CONFIG_DUMMY is not set
477# CONFIG_BONDING is not set 443# CONFIG_BONDING is not set
444# CONFIG_MACVLAN is not set
478# CONFIG_EQUALIZER is not set 445# CONFIG_EQUALIZER is not set
479# CONFIG_TUN is not set 446# CONFIG_TUN is not set
480
481#
482# Ethernet (10 or 100Mbit)
483#
484# CONFIG_NET_ETHERNET is not set 447# CONFIG_NET_ETHERNET is not set
485CONFIG_MII=m 448CONFIG_MII=m
486CONFIG_NETDEV_1000=y 449CONFIG_NETDEV_1000=y
487CONFIG_NETDEV_10000=y
488CONFIG_GELIC_NET=y 450CONFIG_GELIC_NET=y
451# CONFIG_NETDEV_10000 is not set
489 452
490# 453#
491# Wireless LAN 454# Wireless LAN
@@ -518,15 +481,7 @@ CONFIG_USB_NET_MCS7830=m
518# CONFIG_NETCONSOLE is not set 481# CONFIG_NETCONSOLE is not set
519# CONFIG_NETPOLL is not set 482# CONFIG_NETPOLL is not set
520# CONFIG_NET_POLL_CONTROLLER is not set 483# CONFIG_NET_POLL_CONTROLLER is not set
521
522#
523# ISDN subsystem
524#
525# CONFIG_ISDN is not set 484# CONFIG_ISDN is not set
526
527#
528# Telephony Support
529#
530# CONFIG_PHONE is not set 485# CONFIG_PHONE is not set
531 486
532# 487#
@@ -604,10 +559,6 @@ CONFIG_VT_HW_CONSOLE_BINDING=y
604CONFIG_UNIX98_PTYS=y 559CONFIG_UNIX98_PTYS=y
605CONFIG_LEGACY_PTYS=y 560CONFIG_LEGACY_PTYS=y
606CONFIG_LEGACY_PTY_COUNT=16 561CONFIG_LEGACY_PTY_COUNT=16
607
608#
609# IPMI
610#
611# CONFIG_IPMI_HANDLER is not set 562# CONFIG_IPMI_HANDLER is not set
612# CONFIG_WATCHDOG is not set 563# CONFIG_WATCHDOG is not set
613# CONFIG_HW_RANDOM is not set 564# CONFIG_HW_RANDOM is not set
@@ -616,10 +567,6 @@ CONFIG_GEN_RTC=y
616# CONFIG_R3964 is not set 567# CONFIG_R3964 is not set
617# CONFIG_RAW_DRIVER is not set 568# CONFIG_RAW_DRIVER is not set
618# CONFIG_HANGCHECK_TIMER is not set 569# CONFIG_HANGCHECK_TIMER is not set
619
620#
621# TPM devices
622#
623# CONFIG_TCG_TPM is not set 570# CONFIG_TCG_TPM is not set
624# CONFIG_I2C is not set 571# CONFIG_I2C is not set
625 572
@@ -628,11 +575,8 @@ CONFIG_GEN_RTC=y
628# 575#
629# CONFIG_SPI is not set 576# CONFIG_SPI is not set
630# CONFIG_SPI_MASTER is not set 577# CONFIG_SPI_MASTER is not set
631
632#
633# Dallas's 1-wire bus
634#
635# CONFIG_W1 is not set 578# CONFIG_W1 is not set
579# CONFIG_POWER_SUPPLY is not set
636# CONFIG_HWMON is not set 580# CONFIG_HWMON is not set
637 581
638# 582#
@@ -657,6 +601,7 @@ CONFIG_GEN_RTC=y
657# 601#
658# CONFIG_DISPLAY_SUPPORT is not set 602# CONFIG_DISPLAY_SUPPORT is not set
659# CONFIG_VGASTATE is not set 603# CONFIG_VGASTATE is not set
604CONFIG_VIDEO_OUTPUT_CONTROL=m
660CONFIG_FB=y 605CONFIG_FB=y
661# CONFIG_FIRMWARE_EDID is not set 606# CONFIG_FIRMWARE_EDID is not set
662# CONFIG_FB_DDC is not set 607# CONFIG_FB_DDC is not set
@@ -691,11 +636,13 @@ CONFIG_FB_PS3_DEFAULT_SIZE_M=18
691# CONFIG_VGA_CONSOLE is not set 636# CONFIG_VGA_CONSOLE is not set
692CONFIG_DUMMY_CONSOLE=y 637CONFIG_DUMMY_CONSOLE=y
693CONFIG_FRAMEBUFFER_CONSOLE=y 638CONFIG_FRAMEBUFFER_CONSOLE=y
639CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
694CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y 640CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
695# CONFIG_FONTS is not set 641# CONFIG_FONTS is not set
696CONFIG_FONT_8x8=y 642CONFIG_FONT_8x8=y
697CONFIG_FONT_8x16=y 643CONFIG_FONT_8x16=y
698CONFIG_LOGO=y 644CONFIG_LOGO=y
645CONFIG_FB_LOGO_EXTRA=y
699# CONFIG_LOGO_LINUX_MONO is not set 646# CONFIG_LOGO_LINUX_MONO is not set
700# CONFIG_LOGO_LINUX_VGA16 is not set 647# CONFIG_LOGO_LINUX_VGA16 is not set
701CONFIG_LOGO_LINUX_CLUT224=y 648CONFIG_LOGO_LINUX_CLUT224=y
@@ -709,6 +656,8 @@ CONFIG_SOUND=y
709# Advanced Linux Sound Architecture 656# Advanced Linux Sound Architecture
710# 657#
711CONFIG_SND=y 658CONFIG_SND=y
659CONFIG_SND_TIMER=y
660CONFIG_SND_PCM=y
712# CONFIG_SND_SEQUENCER is not set 661# CONFIG_SND_SEQUENCER is not set
713# CONFIG_SND_MIXER_OSS is not set 662# CONFIG_SND_MIXER_OSS is not set
714# CONFIG_SND_PCM_OSS is not set 663# CONFIG_SND_PCM_OSS is not set
@@ -735,6 +684,12 @@ CONFIG_SND_VERBOSE_PROCFS=y
735# 684#
736 685
737# 686#
687# ALSA PowerPC devices
688#
689CONFIG_SND_PS3=y
690CONFIG_SND_PS3_DEFAULT_START_DELAY=2000
691
692#
738# USB devices 693# USB devices
739# 694#
740# CONFIG_SND_USB_AUDIO is not set 695# CONFIG_SND_USB_AUDIO is not set
@@ -747,13 +702,14 @@ CONFIG_SND_VERBOSE_PROCFS=y
747# CONFIG_SND_SOC is not set 702# CONFIG_SND_SOC is not set
748 703
749# 704#
750# Open Sound System 705# SoC Audio support for SuperH
751# 706#
752# CONFIG_SOUND_PRIME is not set
753 707
754# 708#
755# HID Devices 709# Open Sound System
756# 710#
711# CONFIG_SOUND_PRIME is not set
712CONFIG_HID_SUPPORT=y
757CONFIG_HID=y 713CONFIG_HID=y
758# CONFIG_HID_DEBUG is not set 714# CONFIG_HID_DEBUG is not set
759 715
@@ -770,10 +726,7 @@ CONFIG_USB_HID=m
770# 726#
771# CONFIG_USB_KBD is not set 727# CONFIG_USB_KBD is not set
772# CONFIG_USB_MOUSE is not set 728# CONFIG_USB_MOUSE is not set
773 729CONFIG_USB_SUPPORT=y
774#
775# USB support
776#
777CONFIG_USB_ARCH_HAS_HCD=y 730CONFIG_USB_ARCH_HAS_HCD=y
778CONFIG_USB_ARCH_HAS_OHCI=y 731CONFIG_USB_ARCH_HAS_OHCI=y
779CONFIG_USB_ARCH_HAS_EHCI=y 732CONFIG_USB_ARCH_HAS_EHCI=y
@@ -803,6 +756,7 @@ CONFIG_USB_OHCI_HCD=y
803CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y 756CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
804CONFIG_USB_OHCI_LITTLE_ENDIAN=y 757CONFIG_USB_OHCI_LITTLE_ENDIAN=y
805# CONFIG_USB_SL811_HCD is not set 758# CONFIG_USB_SL811_HCD is not set
759# CONFIG_USB_R8A66597_HCD is not set
806 760
807# 761#
808# USB Device Class drivers 762# USB Device Class drivers
@@ -879,31 +833,8 @@ CONFIG_USB_MON=y
879# 833#
880# CONFIG_USB_GADGET is not set 834# CONFIG_USB_GADGET is not set
881# CONFIG_MMC is not set 835# CONFIG_MMC is not set
882
883#
884# LED devices
885#
886# CONFIG_NEW_LEDS is not set 836# CONFIG_NEW_LEDS is not set
887 837# CONFIG_EDAC is not set
888#
889# LED drivers
890#
891
892#
893# LED Triggers
894#
895
896#
897# InfiniBand support
898#
899
900#
901# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
902#
903
904#
905# Real Time Clock
906#
907# CONFIG_RTC_CLASS is not set 838# CONFIG_RTC_CLASS is not set
908 839
909# 840#
@@ -920,6 +851,11 @@ CONFIG_USB_MON=y
920# 851#
921 852
922# 853#
854# Userspace I/O
855#
856# CONFIG_UIO is not set
857
858#
923# File systems 859# File systems
924# 860#
925CONFIG_EXT2_FS=m 861CONFIG_EXT2_FS=m
@@ -948,8 +884,8 @@ CONFIG_QUOTA=y
948CONFIG_QFMT_V2=y 884CONFIG_QFMT_V2=y
949CONFIG_QUOTACTL=y 885CONFIG_QUOTACTL=y
950CONFIG_DNOTIFY=y 886CONFIG_DNOTIFY=y
951# CONFIG_AUTOFS_FS is not set 887CONFIG_AUTOFS_FS=m
952CONFIG_AUTOFS4_FS=y 888CONFIG_AUTOFS4_FS=m
953# CONFIG_FUSE_FS is not set 889# CONFIG_FUSE_FS is not set
954 890
955# 891#
@@ -1030,7 +966,6 @@ CONFIG_CIFS=m
1030# CONFIG_NCP_FS is not set 966# CONFIG_NCP_FS is not set
1031# CONFIG_CODA_FS is not set 967# CONFIG_CODA_FS is not set
1032# CONFIG_AFS_FS is not set 968# CONFIG_AFS_FS is not set
1033# CONFIG_9P_FS is not set
1034 969
1035# 970#
1036# Partition Types 971# Partition Types
@@ -1096,6 +1031,7 @@ CONFIG_BITREVERSE=y
1096# CONFIG_CRC16 is not set 1031# CONFIG_CRC16 is not set
1097# CONFIG_CRC_ITU_T is not set 1032# CONFIG_CRC_ITU_T is not set
1098CONFIG_CRC32=y 1033CONFIG_CRC32=y
1034# CONFIG_CRC7 is not set
1099# CONFIG_LIBCRC32C is not set 1035# CONFIG_LIBCRC32C is not set
1100CONFIG_PLIST=y 1036CONFIG_PLIST=y
1101CONFIG_HAS_IOMEM=y 1037CONFIG_HAS_IOMEM=y
@@ -1120,6 +1056,7 @@ CONFIG_MAGIC_SYSRQ=y
1120CONFIG_DEBUG_KERNEL=y 1056CONFIG_DEBUG_KERNEL=y
1121# CONFIG_DEBUG_SHIRQ is not set 1057# CONFIG_DEBUG_SHIRQ is not set
1122CONFIG_DETECT_SOFTLOCKUP=y 1058CONFIG_DETECT_SOFTLOCKUP=y
1059CONFIG_SCHED_DEBUG=y
1123# CONFIG_SCHEDSTATS is not set 1060# CONFIG_SCHEDSTATS is not set
1124# CONFIG_TIMER_STATS is not set 1061# CONFIG_TIMER_STATS is not set
1125# CONFIG_DEBUG_SLAB is not set 1062# CONFIG_DEBUG_SLAB is not set
@@ -1150,10 +1087,6 @@ CONFIG_IRQSTACKS=y
1150# 1087#
1151# CONFIG_KEYS is not set 1088# CONFIG_KEYS is not set
1152# CONFIG_SECURITY is not set 1089# CONFIG_SECURITY is not set
1153
1154#
1155# Cryptographic options
1156#
1157CONFIG_CRYPTO=y 1090CONFIG_CRYPTO=y
1158CONFIG_CRYPTO_ALGAPI=y 1091CONFIG_CRYPTO_ALGAPI=y
1159CONFIG_CRYPTO_BLKCIPHER=y 1092CONFIG_CRYPTO_BLKCIPHER=y
@@ -1191,7 +1124,4 @@ CONFIG_CRYPTO_DES=y
1191# CONFIG_CRYPTO_CRC32C is not set 1124# CONFIG_CRYPTO_CRC32C is not set
1192# CONFIG_CRYPTO_CAMELLIA is not set 1125# CONFIG_CRYPTO_CAMELLIA is not set
1193# CONFIG_CRYPTO_TEST is not set 1126# CONFIG_CRYPTO_TEST is not set
1194 1127CONFIG_CRYPTO_HW=y
1195#
1196# Hardware crypto devices
1197#
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 1448af92c6a9..171800002ede 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -1672,8 +1672,9 @@ _GLOBAL(__start_initialization_multiplatform)
1672 * Are we booted from a PROM Of-type client-interface ? 1672 * Are we booted from a PROM Of-type client-interface ?
1673 */ 1673 */
1674 cmpldi cr0,r5,0 1674 cmpldi cr0,r5,0
1675 bne .__boot_from_prom /* yes -> prom */ 1675 beq 1f
1676 1676 b .__boot_from_prom /* yes -> prom */
16771:
1677 /* Save parameters */ 1678 /* Save parameters */
1678 mr r31,r3 1679 mr r31,r3
1679 mr r30,r4 1680 mr r30,r4
@@ -1701,7 +1702,7 @@ _GLOBAL(__start_initialization_multiplatform)
1701 bl .__mmu_off 1702 bl .__mmu_off
1702 b .__after_prom_start 1703 b .__after_prom_start
1703 1704
1704_STATIC(__boot_from_prom) 1705_INIT_STATIC(__boot_from_prom)
1705 /* Save parameters */ 1706 /* Save parameters */
1706 mr r31,r3 1707 mr r31,r3
1707 mr r30,r4 1708 mr r30,r4
@@ -1768,9 +1769,10 @@ _STATIC(__after_prom_start)
1768 /* the source addr */ 1769 /* the source addr */
1769 1770
1770 cmpdi r4,0 /* In some cases the loader may */ 1771 cmpdi r4,0 /* In some cases the loader may */
1771 beq .start_here_multiplatform /* have already put us at zero */ 1772 bne 1f
1773 b .start_here_multiplatform /* have already put us at zero */
1772 /* so we can skip the copy. */ 1774 /* so we can skip the copy. */
1773 LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */ 17751: LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */
1774 sub r5,r5,r27 1776 sub r5,r5,r27
1775 1777
1776 li r6,0x100 /* Start offset, the first 0x100 */ 1778 li r6,0x100 /* Start offset, the first 0x100 */
@@ -1957,7 +1959,7 @@ _GLOBAL(enable_64b_mode)
1957/* 1959/*
1958 * This is where the main kernel code starts. 1960 * This is where the main kernel code starts.
1959 */ 1961 */
1960_STATIC(start_here_multiplatform) 1962_INIT_STATIC(start_here_multiplatform)
1961 /* get a new offset, now that the kernel has moved. */ 1963 /* get a new offset, now that the kernel has moved. */
1962 bl .reloc_offset 1964 bl .reloc_offset
1963 mr r26,r3 1965 mr r26,r3
@@ -2019,7 +2021,7 @@ _STATIC(start_here_multiplatform)
2019 b . /* prevent speculative execution */ 2021 b . /* prevent speculative execution */
2020 2022
2021 /* This is where all platforms converge execution */ 2023 /* This is where all platforms converge execution */
2022_STATIC(start_here_common) 2024_INIT_STATIC(start_here_common)
2023 /* relocation is on at this point */ 2025 /* relocation is on at this point */
2024 2026
2025 /* The following code sets up the SP and TOC now that we are */ 2027 /* The following code sets up the SP and TOC now that we are */
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index a97e23ac1976..291ffbc360c9 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -313,6 +313,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
313 313
314 dev->current_state = 4; /* unknown power state */ 314 dev->current_state = 4; /* unknown power state */
315 dev->error_state = pci_channel_io_normal; 315 dev->error_state = pci_channel_io_normal;
316 dev->dma_mask = 0xffffffff;
316 317
317 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) { 318 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
318 /* a PCI-PCI bridge */ 319 /* a PCI-PCI bridge */
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index b0697017d0e8..a73d2d700973 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -69,20 +69,9 @@ static inline void slb_shadow_update(unsigned long ea,
69 smp_wmb(); 69 smp_wmb();
70} 70}
71 71
72static inline void create_shadowed_slbe(unsigned long ea, unsigned long flags, 72static inline void slb_shadow_clear(unsigned long entry)
73 unsigned long entry)
74{ 73{
75 /* 74 get_slb_shadow()->save_area[entry].esid = 0;
76 * Updating the shadow buffer before writing the SLB ensures
77 * we don't get a stale entry here if we get preempted by PHYP
78 * between these two statements.
79 */
80 slb_shadow_update(ea, flags, entry);
81
82 asm volatile("slbmte %0,%1" :
83 : "r" (mk_vsid_data(ea, flags)),
84 "r" (mk_esid_data(ea, entry))
85 : "memory" );
86} 75}
87 76
88void slb_flush_and_rebolt(void) 77void slb_flush_and_rebolt(void)
@@ -100,11 +89,13 @@ void slb_flush_and_rebolt(void)
100 vflags = SLB_VSID_KERNEL | vmalloc_llp; 89 vflags = SLB_VSID_KERNEL | vmalloc_llp;
101 90
102 ksp_esid_data = mk_esid_data(get_paca()->kstack, 2); 91 ksp_esid_data = mk_esid_data(get_paca()->kstack, 2);
103 if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET) 92 if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET) {
104 ksp_esid_data &= ~SLB_ESID_V; 93 ksp_esid_data &= ~SLB_ESID_V;
105 94 slb_shadow_clear(2);
106 /* Only third entry (stack) may change here so only resave that */ 95 } else {
107 slb_shadow_update(get_paca()->kstack, lflags, 2); 96 /* Update stack entry; others don't change */
97 slb_shadow_update(get_paca()->kstack, lflags, 2);
98 }
108 99
109 /* We need to do this all in asm, so we're sure we don't touch 100 /* We need to do this all in asm, so we're sure we don't touch
110 * the stack between the slbia and rebolting it. */ 101 * the stack between the slbia and rebolting it. */
@@ -235,16 +226,12 @@ void slb_initialize(void)
235 vflags = SLB_VSID_KERNEL | vmalloc_llp; 226 vflags = SLB_VSID_KERNEL | vmalloc_llp;
236 227
237 /* Invalidate the entire SLB (even slot 0) & all the ERATS */ 228 /* Invalidate the entire SLB (even slot 0) & all the ERATS */
238 asm volatile("isync":::"memory"); 229 slb_shadow_update(PAGE_OFFSET, lflags, 0);
239 asm volatile("slbmte %0,%0"::"r" (0) : "memory"); 230 asm volatile("isync; slbia; sync; slbmte %0,%1; isync" ::
240 asm volatile("isync; slbia; isync":::"memory"); 231 "r" (get_slb_shadow()->save_area[0].vsid),
241 create_shadowed_slbe(PAGE_OFFSET, lflags, 0); 232 "r" (get_slb_shadow()->save_area[0].esid) : "memory");
242 233
243 create_shadowed_slbe(VMALLOC_START, vflags, 1); 234 slb_shadow_update(VMALLOC_START, vflags, 1);
244 235
245 /* We don't bolt the stack for the time being - we're in boot, 236 slb_flush_and_rebolt();
246 * so the stack is in the bolted segment. By the time it goes
247 * elsewhere, we'll call _switch() which will bolt in the new
248 * one. */
249 asm volatile("isync":::"memory");
250} 237}
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index f833dba2a028..d5fd3909d13a 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -405,6 +405,8 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
405 405
406 if (len > mm->task_size) 406 if (len > mm->task_size)
407 return -ENOMEM; 407 return -ENOMEM;
408 if (len & ((1ul << pshift) - 1))
409 return -EINVAL;
408 if (fixed && (addr & ((1ul << pshift) - 1))) 410 if (fixed && (addr & ((1ul << pshift) - 1)))
409 return -EINVAL; 411 return -EINVAL;
410 if (fixed && addr > (mm->task_size - len)) 412 if (fixed && addr > (mm->task_size - len))
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index b39cb52c6fb9..2c8e641a739b 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -106,7 +106,6 @@ static struct of_device_id mpc832x_ids[] = {
106 { .type = "soc", }, 106 { .type = "soc", },
107 { .compatible = "soc", }, 107 { .compatible = "soc", },
108 { .type = "qe", }, 108 { .type = "qe", },
109 { .type = "mdio", },
110 {}, 109 {},
111}; 110};
112 111
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index b2b28a44738c..090906170a41 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -70,7 +70,6 @@ static struct of_device_id mpc832x_ids[] = {
70 { .type = "soc", }, 70 { .type = "soc", },
71 { .compatible = "soc", }, 71 { .compatible = "soc", },
72 { .type = "qe", }, 72 { .type = "qe", },
73 { .type = "mdio", },
74 {}, 73 {},
75}; 74};
76 75
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 0e615fd65c1f..84b58934aafd 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -113,7 +113,6 @@ static struct of_device_id mpc836x_ids[] = {
113 { .type = "soc", }, 113 { .type = "soc", },
114 { .compatible = "soc", }, 114 { .compatible = "soc", },
115 { .type = "qe", }, 115 { .type = "qe", },
116 { .type = "mdio", },
117 {}, 116 {},
118}; 117};
119 118
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index e8003bf00c9a..be25ecd911ba 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -142,7 +142,6 @@ static struct of_device_id mpc85xx_ids[] = {
142 { .type = "soc", }, 142 { .type = "soc", },
143 { .compatible = "soc", }, 143 { .compatible = "soc", },
144 { .type = "qe", }, 144 { .type = "qe", },
145 { .type = "mdio", },
146 {}, 145 {},
147}; 146};
148 147
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index 90124228b8f4..095a30304c56 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -36,7 +36,6 @@
36#include <asm/spu_priv1.h> 36#include <asm/spu_priv1.h>
37#include <asm/xmon.h> 37#include <asm/xmon.h>
38#include <asm/prom.h> 38#include <asm/prom.h>
39#include "spu_priv1_mmio.h"
40 39
41const struct spu_management_ops *spu_management_ops; 40const struct spu_management_ops *spu_management_ops;
42EXPORT_SYMBOL_GPL(spu_management_ops); 41EXPORT_SYMBOL_GPL(spu_management_ops);
@@ -636,138 +635,6 @@ static ssize_t spu_stat_show(struct sys_device *sysdev, char *buf)
636 635
637static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL); 636static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL);
638 637
639/* Hardcoded affinity idxs for QS20 */
640#define SPES_PER_BE 8
641static int QS20_reg_idxs[SPES_PER_BE] = { 0, 2, 4, 6, 7, 5, 3, 1 };
642static int QS20_reg_memory[SPES_PER_BE] = { 1, 1, 0, 0, 0, 0, 0, 0 };
643
644static struct spu *spu_lookup_reg(int node, u32 reg)
645{
646 struct spu *spu;
647
648 list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
649 if (*(u32 *)get_property(spu_devnode(spu), "reg", NULL) == reg)
650 return spu;
651 }
652 return NULL;
653}
654
655static void init_aff_QS20_harcoded(void)
656{
657 int node, i;
658 struct spu *last_spu, *spu;
659 u32 reg;
660
661 for (node = 0; node < MAX_NUMNODES; node++) {
662 last_spu = NULL;
663 for (i = 0; i < SPES_PER_BE; i++) {
664 reg = QS20_reg_idxs[i];
665 spu = spu_lookup_reg(node, reg);
666 if (!spu)
667 continue;
668 spu->has_mem_affinity = QS20_reg_memory[reg];
669 if (last_spu)
670 list_add_tail(&spu->aff_list,
671 &last_spu->aff_list);
672 last_spu = spu;
673 }
674 }
675}
676
677static int of_has_vicinity(void)
678{
679 struct spu* spu;
680
681 spu = list_entry(cbe_spu_info[0].spus.next, struct spu, cbe_list);
682 return of_find_property(spu_devnode(spu), "vicinity", NULL) != NULL;
683}
684
685static struct spu *aff_devnode_spu(int cbe, struct device_node *dn)
686{
687 struct spu *spu;
688
689 list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list)
690 if (spu_devnode(spu) == dn)
691 return spu;
692 return NULL;
693}
694
695static struct spu *
696aff_node_next_to(int cbe, struct device_node *target, struct device_node *avoid)
697{
698 struct spu *spu;
699 const phandle *vic_handles;
700 int lenp, i;
701
702 list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list) {
703 if (spu_devnode(spu) == avoid)
704 continue;
705 vic_handles = get_property(spu_devnode(spu), "vicinity", &lenp);
706 for (i=0; i < (lenp / sizeof(phandle)); i++) {
707 if (vic_handles[i] == target->linux_phandle)
708 return spu;
709 }
710 }
711 return NULL;
712}
713
714static void init_aff_fw_vicinity_node(int cbe)
715{
716 struct spu *spu, *last_spu;
717 struct device_node *vic_dn, *last_spu_dn;
718 phandle avoid_ph;
719 const phandle *vic_handles;
720 const char *name;
721 int lenp, i, added, mem_aff;
722
723 last_spu = list_entry(cbe_spu_info[cbe].spus.next, struct spu, cbe_list);
724 avoid_ph = 0;
725 for (added = 1; added < cbe_spu_info[cbe].n_spus; added++) {
726 last_spu_dn = spu_devnode(last_spu);
727 vic_handles = get_property(last_spu_dn, "vicinity", &lenp);
728
729 for (i = 0; i < (lenp / sizeof(phandle)); i++) {
730 if (vic_handles[i] == avoid_ph)
731 continue;
732
733 vic_dn = of_find_node_by_phandle(vic_handles[i]);
734 if (!vic_dn)
735 continue;
736
737 name = get_property(vic_dn, "name", NULL);
738 if (strcmp(name, "spe") == 0) {
739 spu = aff_devnode_spu(cbe, vic_dn);
740 avoid_ph = last_spu_dn->linux_phandle;
741 }
742 else {
743 mem_aff = strcmp(name, "mic-tm") == 0;
744 spu = aff_node_next_to(cbe, vic_dn, last_spu_dn);
745 if (!spu)
746 continue;
747 if (mem_aff) {
748 last_spu->has_mem_affinity = 1;
749 spu->has_mem_affinity = 1;
750 }
751 avoid_ph = vic_dn->linux_phandle;
752 }
753 list_add_tail(&spu->aff_list, &last_spu->aff_list);
754 last_spu = spu;
755 break;
756 }
757 }
758}
759
760static void init_aff_fw_vicinity(void)
761{
762 int cbe;
763
764 /* sets has_mem_affinity for each spu, as long as the
765 * spu->aff_list list, linking each spu to its neighbors
766 */
767 for (cbe = 0; cbe < MAX_NUMNODES; cbe++)
768 init_aff_fw_vicinity_node(cbe);
769}
770
771static int __init init_spu_base(void) 638static int __init init_spu_base(void)
772{ 639{
773 int i, ret = 0; 640 int i, ret = 0;
@@ -811,13 +678,7 @@ static int __init init_spu_base(void)
811 mutex_unlock(&spu_full_list_mutex); 678 mutex_unlock(&spu_full_list_mutex);
812 spu_add_sysdev_attr(&attr_stat); 679 spu_add_sysdev_attr(&attr_stat);
813 680
814 if (of_has_vicinity()) { 681 spu_init_affinity();
815 init_aff_fw_vicinity();
816 } else {
817 long root = of_get_flat_dt_root();
818 if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
819 init_aff_QS20_harcoded();
820 }
821 682
822 return 0; 683 return 0;
823 684
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
index 75ed50fcc3db..5eb88346181a 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -361,8 +361,171 @@ static int of_destroy_spu(struct spu *spu)
361 return 0; 361 return 0;
362} 362}
363 363
364/* Hardcoded affinity idxs for qs20 */
365#define QS20_SPES_PER_BE 8
366static int qs20_reg_idxs[QS20_SPES_PER_BE] = { 0, 2, 4, 6, 7, 5, 3, 1 };
367static int qs20_reg_memory[QS20_SPES_PER_BE] = { 1, 1, 0, 0, 0, 0, 0, 0 };
368
369static struct spu *spu_lookup_reg(int node, u32 reg)
370{
371 struct spu *spu;
372 u32 *spu_reg;
373
374 list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
375 spu_reg = (u32*)of_get_property(spu_devnode(spu), "reg", NULL);
376 if (*spu_reg == reg)
377 return spu;
378 }
379 return NULL;
380}
381
382static void init_affinity_qs20_harcoded(void)
383{
384 int node, i;
385 struct spu *last_spu, *spu;
386 u32 reg;
387
388 for (node = 0; node < MAX_NUMNODES; node++) {
389 last_spu = NULL;
390 for (i = 0; i < QS20_SPES_PER_BE; i++) {
391 reg = qs20_reg_idxs[i];
392 spu = spu_lookup_reg(node, reg);
393 if (!spu)
394 continue;
395 spu->has_mem_affinity = qs20_reg_memory[reg];
396 if (last_spu)
397 list_add_tail(&spu->aff_list,
398 &last_spu->aff_list);
399 last_spu = spu;
400 }
401 }
402}
403
404static int of_has_vicinity(void)
405{
406 struct spu* spu;
407
408 spu = list_first_entry(&cbe_spu_info[0].spus, struct spu, cbe_list);
409 return of_find_property(spu_devnode(spu), "vicinity", NULL) != NULL;
410}
411
412static struct spu *devnode_spu(int cbe, struct device_node *dn)
413{
414 struct spu *spu;
415
416 list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list)
417 if (spu_devnode(spu) == dn)
418 return spu;
419 return NULL;
420}
421
422static struct spu *
423neighbour_spu(int cbe, struct device_node *target, struct device_node *avoid)
424{
425 struct spu *spu;
426 struct device_node *spu_dn;
427 const phandle *vic_handles;
428 int lenp, i;
429
430 list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list) {
431 spu_dn = spu_devnode(spu);
432 if (spu_dn == avoid)
433 continue;
434 vic_handles = of_get_property(spu_dn, "vicinity", &lenp);
435 for (i=0; i < (lenp / sizeof(phandle)); i++) {
436 if (vic_handles[i] == target->linux_phandle)
437 return spu;
438 }
439 }
440 return NULL;
441}
442
443static void init_affinity_node(int cbe)
444{
445 struct spu *spu, *last_spu;
446 struct device_node *vic_dn, *last_spu_dn;
447 phandle avoid_ph;
448 const phandle *vic_handles;
449 const char *name;
450 int lenp, i, added;
451
452 last_spu = list_first_entry(&cbe_spu_info[cbe].spus, struct spu,
453 cbe_list);
454 avoid_ph = 0;
455 for (added = 1; added < cbe_spu_info[cbe].n_spus; added++) {
456 last_spu_dn = spu_devnode(last_spu);
457 vic_handles = of_get_property(last_spu_dn, "vicinity", &lenp);
458
459 /*
460 * Walk through each phandle in vicinity property of the spu
461 * (tipically two vicinity phandles per spe node)
462 */
463 for (i = 0; i < (lenp / sizeof(phandle)); i++) {
464 if (vic_handles[i] == avoid_ph)
465 continue;
466
467 vic_dn = of_find_node_by_phandle(vic_handles[i]);
468 if (!vic_dn)
469 continue;
470
471 /* a neighbour might be spe, mic-tm, or bif0 */
472 name = of_get_property(vic_dn, "name", NULL);
473 if (!name)
474 continue;
475
476 if (strcmp(name, "spe") == 0) {
477 spu = devnode_spu(cbe, vic_dn);
478 avoid_ph = last_spu_dn->linux_phandle;
479 } else {
480 /*
481 * "mic-tm" and "bif0" nodes do not have
482 * vicinity property. So we need to find the
483 * spe which has vic_dn as neighbour, but
484 * skipping the one we came from (last_spu_dn)
485 */
486 spu = neighbour_spu(cbe, vic_dn, last_spu_dn);
487 if (!spu)
488 continue;
489 if (!strcmp(name, "mic-tm")) {
490 last_spu->has_mem_affinity = 1;
491 spu->has_mem_affinity = 1;
492 }
493 avoid_ph = vic_dn->linux_phandle;
494 }
495
496 list_add_tail(&spu->aff_list, &last_spu->aff_list);
497 last_spu = spu;
498 break;
499 }
500 }
501}
502
503static void init_affinity_fw(void)
504{
505 int cbe;
506
507 for (cbe = 0; cbe < MAX_NUMNODES; cbe++)
508 init_affinity_node(cbe);
509}
510
511static int __init init_affinity(void)
512{
513 if (of_has_vicinity()) {
514 init_affinity_fw();
515 } else {
516 long root = of_get_flat_dt_root();
517 if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
518 init_affinity_qs20_harcoded();
519 else
520 printk("No affinity configuration found");
521 }
522
523 return 0;
524}
525
364const struct spu_management_ops spu_management_of_ops = { 526const struct spu_management_ops spu_management_of_ops = {
365 .enumerate_spus = of_enumerate_spus, 527 .enumerate_spus = of_enumerate_spus,
366 .create_spu = of_create_spu, 528 .create_spu = of_create_spu,
367 .destroy_spu = of_destroy_spu, 529 .destroy_spu = of_destroy_spu,
530 .init_affinity = init_affinity,
368}; 531};
diff --git a/arch/powerpc/platforms/ps3/Kconfig b/arch/powerpc/platforms/ps3/Kconfig
index d4fc74f7bb15..67144d1d1405 100644
--- a/arch/powerpc/platforms/ps3/Kconfig
+++ b/arch/powerpc/platforms/ps3/Kconfig
@@ -1,5 +1,5 @@
1config PPC_PS3 1config PPC_PS3
2 bool "Sony PS3 (incomplete)" 2 bool "Sony PS3"
3 depends on PPC_MULTIPLATFORM && PPC64 3 depends on PPC_MULTIPLATFORM && PPC64
4 select PPC_CELL 4 select PPC_CELL
5 select USB_ARCH_HAS_OHCI 5 select USB_ARCH_HAS_OHCI
@@ -10,10 +10,10 @@ config PPC_PS3
10 select MEMORY_HOTPLUG 10 select MEMORY_HOTPLUG
11 help 11 help
12 This option enables support for the Sony PS3 game console 12 This option enables support for the Sony PS3 game console
13 and other platforms using the PS3 hypervisor. 13 and other platforms using the PS3 hypervisor. Enabling this
14 Support for this platform is not yet complete, so 14 option will allow building otheros.bld, a kernel image suitable
15 enabling this will not result in a bootable kernel on a 15 for programming into flash memory, and vmlinux, a kernel image
16 PS3 system. 16 suitable for loading via kexec.
17 17
18menu "PS3 Platform Options" 18menu "PS3 Platform Options"
19 depends on PPC_PS3 19 depends on PPC_PS3
diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
index 825ebb2cbc2a..e23a5a874ad3 100644
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -273,55 +273,58 @@ static int ps3stor_wait_for_completion(u64 dev_id, u64 tag,
273 273
274static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo) 274static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
275{ 275{
276 int error = -ENODEV;
276 int result; 277 int result;
277 const u64 notification_dev_id = (u64)-1LL; 278 const u64 notification_dev_id = (u64)-1LL;
278 const unsigned int timeout = HZ; 279 const unsigned int timeout = HZ;
279 u64 lpar; 280 u64 lpar;
280 u64 tag; 281 u64 tag;
282 void *buf;
283 enum ps3_notify_type {
284 notify_device_ready = 0,
285 notify_region_probe = 1,
286 notify_region_update = 2,
287 };
281 struct { 288 struct {
282 u64 operation_code; /* must be zero */ 289 u64 operation_code; /* must be zero */
283 u64 event_mask; /* 1 = device ready */ 290 u64 event_mask; /* OR of 1UL << enum ps3_notify_type */
284 } *notify_cmd; 291 } *notify_cmd;
285 struct { 292 struct {
286 u64 event_type; /* notify_device_ready */ 293 u64 event_type; /* enum ps3_notify_type */
287 u64 bus_id; 294 u64 bus_id;
288 u64 dev_id; 295 u64 dev_id;
289 u64 dev_type; 296 u64 dev_type;
290 u64 dev_port; 297 u64 dev_port;
291 } *notify_event; 298 } *notify_event;
292 enum {
293 notify_device_ready = 1
294 };
295 299
296 pr_debug(" -> %s:%u: bus_id %u, dev_id %u, dev_type %u\n", __func__, 300 pr_debug(" -> %s:%u: bus_id %u, dev_id %u, dev_type %u\n", __func__,
297 __LINE__, repo->bus_id, repo->dev_id, repo->dev_type); 301 __LINE__, repo->bus_id, repo->dev_id, repo->dev_type);
298 302
299 notify_cmd = kzalloc(512, GFP_KERNEL); 303 buf = kzalloc(512, GFP_KERNEL);
300 notify_event = (void *)notify_cmd; 304 if (!buf)
301 if (!notify_cmd)
302 return -ENOMEM; 305 return -ENOMEM;
303 306
304 lpar = ps3_mm_phys_to_lpar(__pa(notify_cmd)); 307 lpar = ps3_mm_phys_to_lpar(__pa(buf));
308 notify_cmd = buf;
309 notify_event = buf;
305 310
306 result = lv1_open_device(repo->bus_id, notification_dev_id, 0); 311 result = lv1_open_device(repo->bus_id, notification_dev_id, 0);
307 if (result) { 312 if (result) {
308 printk(KERN_ERR "%s:%u: lv1_open_device %s\n", __func__, 313 printk(KERN_ERR "%s:%u: lv1_open_device %s\n", __func__,
309 __LINE__, ps3_result(result)); 314 __LINE__, ps3_result(result));
310 result = -ENODEV;
311 goto fail_free; 315 goto fail_free;
312 } 316 }
313 317
314 /* Setup and write the request for device notification. */ 318 /* Setup and write the request for device notification. */
315 319
316 notify_cmd->operation_code = 0; /* must be zero */ 320 notify_cmd->operation_code = 0; /* must be zero */
317 notify_cmd->event_mask = 0x01; /* device ready */ 321 notify_cmd->event_mask = 1UL << notify_region_probe;
318 322
319 result = lv1_storage_write(notification_dev_id, 0, 0, 1, 0, lpar, 323 result = lv1_storage_write(notification_dev_id, 0, 0, 1, 0, lpar,
320 &tag); 324 &tag);
321 if (result) { 325 if (result) {
322 printk(KERN_ERR "%s:%u: write failed %s\n", __func__, __LINE__, 326 printk(KERN_ERR "%s:%u: write failed %s\n", __func__, __LINE__,
323 ps3_result(result)); 327 ps3_result(result));
324 result = -ENODEV;
325 goto fail_close; 328 goto fail_close;
326 } 329 }
327 330
@@ -332,13 +335,11 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
332 if (result) { 335 if (result) {
333 printk(KERN_ERR "%s:%u: write not completed %s\n", __func__, 336 printk(KERN_ERR "%s:%u: write not completed %s\n", __func__,
334 __LINE__, ps3_result(result)); 337 __LINE__, ps3_result(result));
335 result = -ENODEV;
336 goto fail_close; 338 goto fail_close;
337 } 339 }
338 340
339 /* Loop here processing the requested notification events. */ 341 /* Loop here processing the requested notification events. */
340 342
341 result = -ENODEV;
342 while (1) { 343 while (1) {
343 memset(notify_event, 0, sizeof(*notify_event)); 344 memset(notify_event, 0, sizeof(*notify_event));
344 345
@@ -358,7 +359,7 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
358 break; 359 break;
359 } 360 }
360 361
361 if (notify_event->event_type != notify_device_ready || 362 if (notify_event->event_type != notify_region_probe ||
362 notify_event->bus_id != repo->bus_id) { 363 notify_event->bus_id != repo->bus_id) {
363 pr_debug("%s:%u: bad notify_event: event %lu, " 364 pr_debug("%s:%u: bad notify_event: event %lu, "
364 "dev_id %lu, dev_type %lu\n", 365 "dev_id %lu, dev_type %lu\n",
@@ -386,9 +387,9 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
386fail_close: 387fail_close:
387 lv1_close_device(repo->bus_id, notification_dev_id); 388 lv1_close_device(repo->bus_id, notification_dev_id);
388fail_free: 389fail_free:
389 kfree(notify_cmd); 390 kfree(buf);
390 pr_debug(" <- %s:%u\n", __func__, __LINE__); 391 pr_debug(" <- %s:%u\n", __func__, __LINE__);
391 return result; 392 return error;
392} 393}
393 394
394static int ps3_setup_storage_dev(const struct ps3_repository_device *repo, 395static int ps3_setup_storage_dev(const struct ps3_repository_device *repo,
diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
index 502d80ed982b..ac2a4b8a4c14 100644
--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -414,10 +414,16 @@ static int __init ps3_enumerate_spus(int (*fn)(void *data))
414 return num_resource_id; 414 return num_resource_id;
415} 415}
416 416
417static int ps3_init_affinity(void)
418{
419 return 0;
420}
421
417const struct spu_management_ops spu_management_ps3_ops = { 422const struct spu_management_ops spu_management_ps3_ops = {
418 .enumerate_spus = ps3_enumerate_spus, 423 .enumerate_spus = ps3_enumerate_spus,
419 .create_spu = ps3_create_spu, 424 .create_spu = ps3_create_spu,
420 .destroy_spu = ps3_destroy_spu, 425 .destroy_spu = ps3_destroy_spu,
426 .init_affinity = ps3_init_affinity,
421}; 427};
422 428
423/* spu_priv1_ops */ 429/* spu_priv1_ops */
diff --git a/arch/x86_64/boot/compressed/head.S b/arch/x86_64/boot/compressed/head.S
index 1312bfaff306..9fd8030cc54f 100644
--- a/arch/x86_64/boot/compressed/head.S
+++ b/arch/x86_64/boot/compressed/head.S
@@ -195,6 +195,11 @@ ENTRY(startup_64)
195 movl %eax, %ds 195 movl %eax, %ds
196 movl %eax, %es 196 movl %eax, %es
197 movl %eax, %ss 197 movl %eax, %ss
198 movl %eax, %fs
199 movl %eax, %gs
200 lldt %ax
201 movl $0x20, %eax
202 ltr %ax
198 203
199 /* Compute the decompressed kernel start address. It is where 204 /* Compute the decompressed kernel start address. It is where
200 * we were loaded at aligned to a 2M boundary. %rbp contains the 205 * we were loaded at aligned to a 2M boundary. %rbp contains the
@@ -295,6 +300,8 @@ gdt:
295 .quad 0x0000000000000000 /* NULL descriptor */ 300 .quad 0x0000000000000000 /* NULL descriptor */
296 .quad 0x00af9a000000ffff /* __KERNEL_CS */ 301 .quad 0x00af9a000000ffff /* __KERNEL_CS */
297 .quad 0x00cf92000000ffff /* __KERNEL_DS */ 302 .quad 0x00cf92000000ffff /* __KERNEL_DS */
303 .quad 0x0080890000000000 /* TS descriptor */
304 .quad 0x0000000000000000 /* TS continued */
298gdt_end: 305gdt_end:
299 .bss 306 .bss
300/* Stack for uncompression */ 307/* Stack for uncompression */
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 900ff38d68de..925758dbca0c 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -791,10 +791,8 @@ static void setup_APIC_timer(unsigned int clocks)
791 791
792 /* wait for irq slice */ 792 /* wait for irq slice */
793 if (hpet_address && hpet_use_timer) { 793 if (hpet_address && hpet_use_timer) {
794 int trigger = hpet_readl(HPET_T0_CMP); 794 u32 trigger = hpet_readl(HPET_T0_CMP);
795 while (hpet_readl(HPET_COUNTER) >= trigger) 795 while (hpet_readl(HPET_T0_CMP) == trigger)
796 /* do nothing */ ;
797 while (hpet_readl(HPET_COUNTER) < trigger)
798 /* do nothing */ ; 796 /* do nothing */ ;
799 } else { 797 } else {
800 int c1, c2; 798 int c1, c2;
diff --git a/arch/x86_64/kernel/pci-calgary.c b/arch/x86_64/kernel/pci-calgary.c
index ba16c968ca3f..71da01e73f03 100644
--- a/arch/x86_64/kernel/pci-calgary.c
+++ b/arch/x86_64/kernel/pci-calgary.c
@@ -367,16 +367,15 @@ static inline struct iommu_table *find_iommu_table(struct device *dev)
367 367
368 pdev = to_pci_dev(dev); 368 pdev = to_pci_dev(dev);
369 369
370 /* is the device behind a bridge? */ 370 pbus = pdev->bus;
371 if (unlikely(pdev->bus->parent)) 371
372 pbus = pdev->bus->parent; 372 /* is the device behind a bridge? Look for the root bus */
373 else 373 while (pbus->parent)
374 pbus = pdev->bus; 374 pbus = pbus->parent;
375 375
376 tbl = pci_iommu(pbus); 376 tbl = pci_iommu(pbus);
377 377
378 BUG_ON(pdev->bus->parent && 378 BUG_ON(tbl && (tbl->it_busno != pbus->number));
379 (tbl->it_busno != pdev->bus->parent->number));
380 379
381 return tbl; 380 return tbl;
382} 381}
diff --git a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c
index 7e161c698af4..10b9809ce821 100644
--- a/arch/x86_64/mm/pageattr.c
+++ b/arch/x86_64/mm/pageattr.c
@@ -75,7 +75,8 @@ static void flush_kernel_map(void *arg)
75 75
76 /* When clflush is available always use it because it is 76 /* When clflush is available always use it because it is
77 much cheaper than WBINVD. */ 77 much cheaper than WBINVD. */
78 if (!cpu_has_clflush) 78 /* clflush is still broken. Disable for now. */
79 if (1 || !cpu_has_clflush)
79 asm volatile("wbinvd" ::: "memory"); 80 asm volatile("wbinvd" ::: "memory");
80 else list_for_each_entry(pg, l, lru) { 81 else list_for_each_entry(pg, l, lru) {
81 void *adr = page_address(pg); 82 void *adr = page_address(pg);
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index 65d82736987e..4095e4d66a1d 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -66,13 +66,13 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
66 66
67 switch (len) { 67 switch (len) {
68 case 1: 68 case 1:
69 *value = readb(addr + reg); 69 *value = mmio_config_readb(addr + reg);
70 break; 70 break;
71 case 2: 71 case 2:
72 *value = readw(addr + reg); 72 *value = mmio_config_readw(addr + reg);
73 break; 73 break;
74 case 4: 74 case 4:
75 *value = readl(addr + reg); 75 *value = mmio_config_readl(addr + reg);
76 break; 76 break;
77 } 77 }
78 78
@@ -94,13 +94,13 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
94 94
95 switch (len) { 95 switch (len) {
96 case 1: 96 case 1:
97 writeb(value, addr + reg); 97 mmio_config_writeb(addr + reg, value);
98 break; 98 break;
99 case 2: 99 case 2:
100 writew(value, addr + reg); 100 mmio_config_writew(addr + reg, value);
101 break; 101 break;
102 case 4: 102 case 4:
103 writel(value, addr + reg); 103 mmio_config_writel(addr + reg, value);
104 break; 104 break;
105 } 105 }
106 106
diff --git a/arch/x86_64/vdso/.gitignore b/arch/x86_64/vdso/.gitignore
new file mode 100644
index 000000000000..f8b69d84238e
--- /dev/null
+++ b/arch/x86_64/vdso/.gitignore
@@ -0,0 +1 @@
vdso.lds
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 8c2caff87cc3..a15845c164f2 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -3047,6 +3047,10 @@ static inline void blk_partition_remap(struct bio *bio)
3047 3047
3048 bio->bi_sector += p->start_sect; 3048 bio->bi_sector += p->start_sect;
3049 bio->bi_bdev = bdev->bd_contains; 3049 bio->bi_bdev = bdev->bd_contains;
3050
3051 blk_add_trace_remap(bdev_get_queue(bio->bi_bdev), bio,
3052 bdev->bd_dev, bio->bi_sector,
3053 bio->bi_sector - p->start_sect);
3050 } 3054 }
3051} 3055}
3052 3056
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c
index f63813a358c5..4c3fd4cdaf73 100644
--- a/drivers/acpi/resources/rsxface.c
+++ b/drivers/acpi/resources/rsxface.c
@@ -474,8 +474,6 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
474 return (AE_CTRL_TERMINATE); 474 return (AE_CTRL_TERMINATE);
475} 475}
476 476
477ACPI_EXPORT_SYMBOL(acpi_rs_match_vendor_resource)
478
479/******************************************************************************* 477/*******************************************************************************
480 * 478 *
481 * FUNCTION: acpi_walk_resources 479 * FUNCTION: acpi_walk_resources
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index a11b2bd54bbe..084358a828e9 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1977,12 +1977,13 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
1977{ 1977{
1978 ReadCapdata_struct *buf; 1978 ReadCapdata_struct *buf;
1979 int return_code; 1979 int return_code;
1980 buf = kmalloc(sizeof(ReadCapdata_struct), GFP_KERNEL); 1980
1981 if (buf == NULL) { 1981 buf = kzalloc(sizeof(ReadCapdata_struct), GFP_KERNEL);
1982 if (!buf) {
1982 printk(KERN_WARNING "cciss: out of memory\n"); 1983 printk(KERN_WARNING "cciss: out of memory\n");
1983 return; 1984 return;
1984 } 1985 }
1985 memset(buf, 0, sizeof(ReadCapdata_struct)); 1986
1986 if (withirq) 1987 if (withirq)
1987 return_code = sendcmd_withirq(CCISS_READ_CAPACITY, 1988 return_code = sendcmd_withirq(CCISS_READ_CAPACITY,
1988 ctlr, buf, sizeof(ReadCapdata_struct), 1989 ctlr, buf, sizeof(ReadCapdata_struct),
@@ -2003,7 +2004,6 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
2003 printk(KERN_INFO " blocks= %llu block_size= %d\n", 2004 printk(KERN_INFO " blocks= %llu block_size= %d\n",
2004 (unsigned long long)*total_size+1, *block_size); 2005 (unsigned long long)*total_size+1, *block_size);
2005 kfree(buf); 2006 kfree(buf);
2006 return;
2007} 2007}
2008 2008
2009static void 2009static void
@@ -2011,12 +2011,13 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
2011{ 2011{
2012 ReadCapdata_struct_16 *buf; 2012 ReadCapdata_struct_16 *buf;
2013 int return_code; 2013 int return_code;
2014 buf = kmalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL); 2014
2015 if (buf == NULL) { 2015 buf = kzalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL);
2016 if (!buf) {
2016 printk(KERN_WARNING "cciss: out of memory\n"); 2017 printk(KERN_WARNING "cciss: out of memory\n");
2017 return; 2018 return;
2018 } 2019 }
2019 memset(buf, 0, sizeof(ReadCapdata_struct_16)); 2020
2020 if (withirq) { 2021 if (withirq) {
2021 return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16, 2022 return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16,
2022 ctlr, buf, sizeof(ReadCapdata_struct_16), 2023 ctlr, buf, sizeof(ReadCapdata_struct_16),
@@ -2038,7 +2039,6 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
2038 printk(KERN_INFO " blocks= %llu block_size= %d\n", 2039 printk(KERN_INFO " blocks= %llu block_size= %d\n",
2039 (unsigned long long)*total_size+1, *block_size); 2040 (unsigned long long)*total_size+1, *block_size);
2040 kfree(buf); 2041 kfree(buf);
2041 return;
2042} 2042}
2043 2043
2044static int cciss_revalidate(struct gendisk *disk) 2044static int cciss_revalidate(struct gendisk *disk)
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index be4e3477d83b..eb9799acf65b 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -420,18 +420,17 @@ static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev)
420 goto Enomem2; 420 goto Enomem2;
421 } 421 }
422 422
423 hba[i]->cmd_pool = (cmdlist_t *)pci_alloc_consistent( 423 hba[i]->cmd_pool = pci_alloc_consistent(
424 hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t), 424 hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t),
425 &(hba[i]->cmd_pool_dhandle)); 425 &(hba[i]->cmd_pool_dhandle));
426 hba[i]->cmd_pool_bits = kmalloc( 426 hba[i]->cmd_pool_bits = kcalloc(
427 ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long), 427 (NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG, sizeof(unsigned long),
428 GFP_KERNEL); 428 GFP_KERNEL);
429 429
430 if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool) 430 if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool)
431 goto Enomem1; 431 goto Enomem1;
432 432
433 memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t)); 433 memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t));
434 memset(hba[i]->cmd_pool_bits, 0, ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long));
435 printk(KERN_INFO "cpqarray: Finding drives on %s", 434 printk(KERN_INFO "cpqarray: Finding drives on %s",
436 hba[i]->devname); 435 hba[i]->devname);
437 436
@@ -1660,45 +1659,30 @@ static void getgeometry(int ctlr)
1660 1659
1661 info_p->log_drv_map = 0; 1660 info_p->log_drv_map = 0;
1662 1661
1663 id_ldrive = kmalloc(sizeof(id_log_drv_t), GFP_KERNEL); 1662 id_ldrive = kzalloc(sizeof(id_log_drv_t), GFP_KERNEL);
1664 if(id_ldrive == NULL) 1663 if (!id_ldrive) {
1665 {
1666 printk( KERN_ERR "cpqarray: out of memory.\n"); 1664 printk( KERN_ERR "cpqarray: out of memory.\n");
1667 return; 1665 goto err_0;
1668 } 1666 }
1669 1667
1670 id_ctlr_buf = kmalloc(sizeof(id_ctlr_t), GFP_KERNEL); 1668 id_ctlr_buf = kzalloc(sizeof(id_ctlr_t), GFP_KERNEL);
1671 if(id_ctlr_buf == NULL) 1669 if (!id_ctlr_buf) {
1672 {
1673 kfree(id_ldrive);
1674 printk( KERN_ERR "cpqarray: out of memory.\n"); 1670 printk( KERN_ERR "cpqarray: out of memory.\n");
1675 return; 1671 goto err_1;
1676 } 1672 }
1677 1673
1678 id_lstatus_buf = kmalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); 1674 id_lstatus_buf = kzalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL);
1679 if(id_lstatus_buf == NULL) 1675 if (!id_lstatus_buf) {
1680 {
1681 kfree(id_ctlr_buf);
1682 kfree(id_ldrive);
1683 printk( KERN_ERR "cpqarray: out of memory.\n"); 1676 printk( KERN_ERR "cpqarray: out of memory.\n");
1684 return; 1677 goto err_2;
1685 } 1678 }
1686 1679
1687 sense_config_buf = kmalloc(sizeof(config_t), GFP_KERNEL); 1680 sense_config_buf = kzalloc(sizeof(config_t), GFP_KERNEL);
1688 if(sense_config_buf == NULL) 1681 if (!sense_config_buf) {
1689 {
1690 kfree(id_lstatus_buf);
1691 kfree(id_ctlr_buf);
1692 kfree(id_ldrive);
1693 printk( KERN_ERR "cpqarray: out of memory.\n"); 1682 printk( KERN_ERR "cpqarray: out of memory.\n");
1694 return; 1683 goto err_3;
1695 } 1684 }
1696 1685
1697 memset(id_ldrive, 0, sizeof(id_log_drv_t));
1698 memset(id_ctlr_buf, 0, sizeof(id_ctlr_t));
1699 memset(id_lstatus_buf, 0, sizeof(sense_log_drv_stat_t));
1700 memset(sense_config_buf, 0, sizeof(config_t));
1701
1702 info_p->phys_drives = 0; 1686 info_p->phys_drives = 0;
1703 info_p->log_drv_map = 0; 1687 info_p->log_drv_map = 0;
1704 info_p->drv_assign_map = 0; 1688 info_p->drv_assign_map = 0;
@@ -1712,13 +1696,8 @@ static void getgeometry(int ctlr)
1712 * so the idastubopen will fail on all logical drives 1696 * so the idastubopen will fail on all logical drives
1713 * on the controller. 1697 * on the controller.
1714 */ 1698 */
1715 /* Free all the buffers and return */
1716 printk(KERN_ERR "cpqarray: error sending ID controller\n"); 1699 printk(KERN_ERR "cpqarray: error sending ID controller\n");
1717 kfree(sense_config_buf); 1700 goto err_4;
1718 kfree(id_lstatus_buf);
1719 kfree(id_ctlr_buf);
1720 kfree(id_ldrive);
1721 return;
1722 } 1701 }
1723 1702
1724 info_p->log_drives = id_ctlr_buf->nr_drvs; 1703 info_p->log_drives = id_ctlr_buf->nr_drvs;
@@ -1764,12 +1743,7 @@ static void getgeometry(int ctlr)
1764 " failed to report status of logical drive %d\n" 1743 " failed to report status of logical drive %d\n"
1765 "Access to this controller has been disabled\n", 1744 "Access to this controller has been disabled\n",
1766 ctlr, log_unit); 1745 ctlr, log_unit);
1767 /* Free all the buffers and return */ 1746 goto err_4;
1768 kfree(sense_config_buf);
1769 kfree(id_lstatus_buf);
1770 kfree(id_ctlr_buf);
1771 kfree(id_ldrive);
1772 return;
1773 } 1747 }
1774 /* 1748 /*
1775 Make sure the logical drive is configured 1749 Make sure the logical drive is configured
@@ -1798,14 +1772,8 @@ static void getgeometry(int ctlr)
1798 sizeof(config_t), 0, 0, log_unit); 1772 sizeof(config_t), 0, 0, log_unit);
1799 if (ret_code == IO_ERROR) { 1773 if (ret_code == IO_ERROR) {
1800 info_p->log_drv_map = 0; 1774 info_p->log_drv_map = 0;
1801 /* Free all the buffers and return */
1802 printk(KERN_ERR "cpqarray: error sending sense config\n"); 1775 printk(KERN_ERR "cpqarray: error sending sense config\n");
1803 kfree(sense_config_buf); 1776 goto err_4;
1804 kfree(id_lstatus_buf);
1805 kfree(id_ctlr_buf);
1806 kfree(id_ldrive);
1807 return;
1808
1809 } 1777 }
1810 1778
1811 info_p->phys_drives = 1779 info_p->phys_drives =
@@ -1820,12 +1788,18 @@ static void getgeometry(int ctlr)
1820 log_index = log_index + 1; 1788 log_index = log_index + 1;
1821 } /* end of if logical drive configured */ 1789 } /* end of if logical drive configured */
1822 } /* end of for log_unit */ 1790 } /* end of for log_unit */
1791
1792 /* Free all the buffers and return */
1793err_4:
1823 kfree(sense_config_buf); 1794 kfree(sense_config_buf);
1824 kfree(id_ldrive); 1795err_3:
1825 kfree(id_lstatus_buf); 1796 kfree(id_lstatus_buf);
1797err_2:
1826 kfree(id_ctlr_buf); 1798 kfree(id_ctlr_buf);
1799err_1:
1800 kfree(id_ldrive);
1801err_0:
1827 return; 1802 return;
1828
1829} 1803}
1830 1804
1831static void __exit cpqarray_exit(void) 1805static void __exit cpqarray_exit(void)
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index 85916e2665d4..af3969a9c963 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -41,7 +41,6 @@
41#include <linux/dma-mapping.h> 41#include <linux/dma-mapping.h>
42#include <linux/completion.h> 42#include <linux/completion.h>
43#include <linux/device.h> 43#include <linux/device.h>
44#include <linux/kernel.h>
45 44
46#include <asm/uaccess.h> 45#include <asm/uaccess.h>
47#include <asm/vio.h> 46#include <asm/vio.h>
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index cb27e8863d7c..3ede0b63da13 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -902,26 +902,17 @@ static int ace_release(struct inode *inode, struct file *filp)
902 return 0; 902 return 0;
903} 903}
904 904
905static int ace_ioctl(struct inode *inode, struct file *filp, 905static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo)
906 unsigned int cmd, unsigned long arg)
907{ 906{
908 struct ace_device *ace = inode->i_bdev->bd_disk->private_data; 907 struct ace_device *ace = bdev->bd_disk->private_data;
909 struct hd_geometry __user *geo = (struct hd_geometry __user *)arg;
910 struct hd_geometry g;
911 dev_dbg(ace->dev, "ace_ioctl()\n");
912
913 switch (cmd) {
914 case HDIO_GETGEO:
915 g.heads = ace->cf_id.heads;
916 g.sectors = ace->cf_id.sectors;
917 g.cylinders = ace->cf_id.cyls;
918 g.start = 0;
919 return copy_to_user(geo, &g, sizeof(g)) ? -EFAULT : 0;
920 908
921 default: 909 dev_dbg(ace->dev, "ace_getgeo()\n");
922 return -ENOTTY; 910
923 } 911 geo->heads = ace->cf_id.heads;
924 return -ENOTTY; 912 geo->sectors = ace->cf_id.sectors;
913 geo->cylinders = ace->cf_id.cyls;
914
915 return 0;
925} 916}
926 917
927static struct block_device_operations ace_fops = { 918static struct block_device_operations ace_fops = {
@@ -930,7 +921,7 @@ static struct block_device_operations ace_fops = {
930 .release = ace_release, 921 .release = ace_release,
931 .media_changed = ace_media_changed, 922 .media_changed = ace_media_changed,
932 .revalidate_disk = ace_revalidate_disk, 923 .revalidate_disk = ace_revalidate_disk,
933 .ioctl = ace_ioctl, 924 .getgeo = ace_getgeo,
934}; 925};
935 926
936/* -------------------------------------------------------------------- 927/* --------------------------------------------------------------------
diff --git a/drivers/char/hvc_lguest.c b/drivers/char/hvc_lguest.c
index feeccbaec438..3d6bd0baa56d 100644
--- a/drivers/char/hvc_lguest.c
+++ b/drivers/char/hvc_lguest.c
@@ -35,6 +35,7 @@
35#include <linux/err.h> 35#include <linux/err.h>
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/lguest_bus.h> 37#include <linux/lguest_bus.h>
38#include <asm/paravirt.h>
38#include "hvc_console.h" 39#include "hvc_console.h"
39 40
40/*D:340 This is our single console input buffer, with associated "struct 41/*D:340 This is our single console input buffer, with associated "struct
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index fee58e03dbe2..4177f6db83e9 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1629,7 +1629,7 @@ static int cmm_open(struct inode *inode, struct file *filp)
1629{ 1629{
1630 struct cm4000_dev *dev; 1630 struct cm4000_dev *dev;
1631 struct pcmcia_device *link; 1631 struct pcmcia_device *link;
1632 int rc, minor = iminor(inode); 1632 int minor = iminor(inode);
1633 1633
1634 if (minor >= CM4000_MAX_DEV) 1634 if (minor >= CM4000_MAX_DEV)
1635 return -ENODEV; 1635 return -ENODEV;
@@ -1668,7 +1668,6 @@ static int cmm_open(struct inode *inode, struct file *filp)
1668 start_monitor(dev); 1668 start_monitor(dev);
1669 1669
1670 link->open = 1; /* only one open per device */ 1670 link->open = 1; /* only one open per device */
1671 rc = 0;
1672 1671
1673 DEBUGP(2, dev, "<- cmm_open\n"); 1672 DEBUGP(2, dev, "<- cmm_open\n");
1674 return nonseekable_open(inode, filp); 1673 return nonseekable_open(inode, filp);
@@ -1824,7 +1823,7 @@ static int cm4000_resume(struct pcmcia_device *link)
1824 1823
1825static void cm4000_release(struct pcmcia_device *link) 1824static void cm4000_release(struct pcmcia_device *link)
1826{ 1825{
1827 cmm_cm4000_release(link->priv); /* delay release until device closed */ 1826 cmm_cm4000_release(link); /* delay release until device closed */
1828 pcmcia_disable_device(link); 1827 pcmcia_disable_device(link);
1829} 1828}
1830 1829
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index af88181a17f4..b24a3e7bbb9f 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -599,7 +599,7 @@ cs_release:
599 599
600static void reader_release(struct pcmcia_device *link) 600static void reader_release(struct pcmcia_device *link)
601{ 601{
602 cm4040_reader_release(link->priv); 602 cm4040_reader_release(link);
603 pcmcia_disable_device(link); 603 pcmcia_disable_device(link);
604} 604}
605 605
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index de37ebc3a4cf..51ea93cab6c4 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -369,25 +369,54 @@ static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b)
369} 369}
370 370
371/** 371/**
372 * tty_buffer_flush - flush full tty buffers 372 * __tty_buffer_flush - flush full tty buffers
373 * @tty: tty to flush 373 * @tty: tty to flush
374 * 374 *
375 * flush all the buffers containing receive data 375 * flush all the buffers containing receive data. Caller must
376 * hold the buffer lock and must have ensured no parallel flush to
377 * ldisc is running.
376 * 378 *
377 * Locking: none 379 * Locking: Caller must hold tty->buf.lock
378 */ 380 */
379 381
380static void tty_buffer_flush(struct tty_struct *tty) 382static void __tty_buffer_flush(struct tty_struct *tty)
381{ 383{
382 struct tty_buffer *thead; 384 struct tty_buffer *thead;
383 unsigned long flags;
384 385
385 spin_lock_irqsave(&tty->buf.lock, flags);
386 while((thead = tty->buf.head) != NULL) { 386 while((thead = tty->buf.head) != NULL) {
387 tty->buf.head = thead->next; 387 tty->buf.head = thead->next;
388 tty_buffer_free(tty, thead); 388 tty_buffer_free(tty, thead);
389 } 389 }
390 tty->buf.tail = NULL; 390 tty->buf.tail = NULL;
391}
392
393/**
394 * tty_buffer_flush - flush full tty buffers
395 * @tty: tty to flush
396 *
397 * flush all the buffers containing receive data. If the buffer is
398 * being processed by flush_to_ldisc then we defer the processing
399 * to that function
400 *
401 * Locking: none
402 */
403
404static void tty_buffer_flush(struct tty_struct *tty)
405{
406 unsigned long flags;
407 spin_lock_irqsave(&tty->buf.lock, flags);
408
409 /* If the data is being pushed to the tty layer then we can't
410 process it here. Instead set a flag and the flush_to_ldisc
411 path will process the flush request before it exits */
412 if (test_bit(TTY_FLUSHING, &tty->flags)) {
413 set_bit(TTY_FLUSHPENDING, &tty->flags);
414 spin_unlock_irqrestore(&tty->buf.lock, flags);
415 wait_event(tty->read_wait,
416 test_bit(TTY_FLUSHPENDING, &tty->flags) == 0);
417 return;
418 } else
419 __tty_buffer_flush(tty);
391 spin_unlock_irqrestore(&tty->buf.lock, flags); 420 spin_unlock_irqrestore(&tty->buf.lock, flags);
392} 421}
393 422
@@ -3594,6 +3623,7 @@ static void flush_to_ldisc(struct work_struct *work)
3594 return; 3623 return;
3595 3624
3596 spin_lock_irqsave(&tty->buf.lock, flags); 3625 spin_lock_irqsave(&tty->buf.lock, flags);
3626 set_bit(TTY_FLUSHING, &tty->flags); /* So we know a flush is running */
3597 head = tty->buf.head; 3627 head = tty->buf.head;
3598 if (head != NULL) { 3628 if (head != NULL) {
3599 tty->buf.head = NULL; 3629 tty->buf.head = NULL;
@@ -3607,6 +3637,11 @@ static void flush_to_ldisc(struct work_struct *work)
3607 tty_buffer_free(tty, tbuf); 3637 tty_buffer_free(tty, tbuf);
3608 continue; 3638 continue;
3609 } 3639 }
3640 /* Ldisc or user is trying to flush the buffers
3641 we are feeding to the ldisc, stop feeding the
3642 line discipline as we want to empty the queue */
3643 if (test_bit(TTY_FLUSHPENDING, &tty->flags))
3644 break;
3610 if (!tty->receive_room) { 3645 if (!tty->receive_room) {
3611 schedule_delayed_work(&tty->buf.work, 1); 3646 schedule_delayed_work(&tty->buf.work, 1);
3612 break; 3647 break;
@@ -3620,8 +3655,17 @@ static void flush_to_ldisc(struct work_struct *work)
3620 disc->receive_buf(tty, char_buf, flag_buf, count); 3655 disc->receive_buf(tty, char_buf, flag_buf, count);
3621 spin_lock_irqsave(&tty->buf.lock, flags); 3656 spin_lock_irqsave(&tty->buf.lock, flags);
3622 } 3657 }
3658 /* Restore the queue head */
3623 tty->buf.head = head; 3659 tty->buf.head = head;
3624 } 3660 }
3661 /* We may have a deferred request to flush the input buffer,
3662 if so pull the chain under the lock and empty the queue */
3663 if (test_bit(TTY_FLUSHPENDING, &tty->flags)) {
3664 __tty_buffer_flush(tty);
3665 clear_bit(TTY_FLUSHPENDING, &tty->flags);
3666 wake_up(&tty->read_wait);
3667 }
3668 clear_bit(TTY_FLUSHING, &tty->flags);
3625 spin_unlock_irqrestore(&tty->buf.lock, flags); 3669 spin_unlock_irqrestore(&tty->buf.lock, flags);
3626 3670
3627 tty_ldisc_deref(disc); 3671 tty_ldisc_deref(disc);
diff --git a/drivers/lguest/lguest.c b/drivers/lguest/lguest.c
index 524beea7fb19..6e135ac0834f 100644
--- a/drivers/lguest/lguest.c
+++ b/drivers/lguest/lguest.c
@@ -936,23 +936,24 @@ static const struct lguest_insns
936/* Now our patch routine is fairly simple (based on the native one in 936/* Now our patch routine is fairly simple (based on the native one in
937 * paravirt.c). If we have a replacement, we copy it in and return how much of 937 * paravirt.c). If we have a replacement, we copy it in and return how much of
938 * the available space we used. */ 938 * the available space we used. */
939static unsigned lguest_patch(u8 type, u16 clobber, void *insns, unsigned len) 939static unsigned lguest_patch(u8 type, u16 clobber, void *ibuf,
940 unsigned long addr, unsigned len)
940{ 941{
941 unsigned int insn_len; 942 unsigned int insn_len;
942 943
943 /* Don't do anything special if we don't have a replacement */ 944 /* Don't do anything special if we don't have a replacement */
944 if (type >= ARRAY_SIZE(lguest_insns) || !lguest_insns[type].start) 945 if (type >= ARRAY_SIZE(lguest_insns) || !lguest_insns[type].start)
945 return paravirt_patch_default(type, clobber, insns, len); 946 return paravirt_patch_default(type, clobber, ibuf, addr, len);
946 947
947 insn_len = lguest_insns[type].end - lguest_insns[type].start; 948 insn_len = lguest_insns[type].end - lguest_insns[type].start;
948 949
949 /* Similarly if we can't fit replacement (shouldn't happen, but let's 950 /* Similarly if we can't fit replacement (shouldn't happen, but let's
950 * be thorough). */ 951 * be thorough). */
951 if (len < insn_len) 952 if (len < insn_len)
952 return paravirt_patch_default(type, clobber, insns, len); 953 return paravirt_patch_default(type, clobber, ibuf, addr, len);
953 954
954 /* Copy in our instructions. */ 955 /* Copy in our instructions. */
955 memcpy(insns, lguest_insns[type].start, insn_len); 956 memcpy(ibuf, lguest_insns[type].start, insn_len);
956 return insn_len; 957 return insn_len;
957} 958}
958 959
diff --git a/drivers/lguest/lguest_bus.c b/drivers/lguest/lguest_bus.c
index 55a7940ca732..9e7752cc8002 100644
--- a/drivers/lguest/lguest_bus.c
+++ b/drivers/lguest/lguest_bus.c
@@ -5,6 +5,7 @@
5#include <linux/bootmem.h> 5#include <linux/bootmem.h>
6#include <linux/lguest_bus.h> 6#include <linux/lguest_bus.h>
7#include <asm/io.h> 7#include <asm/io.h>
8#include <asm/paravirt.h>
8 9
9static ssize_t type_show(struct device *_dev, 10static ssize_t type_show(struct device *_dev,
10 struct device_attribute *attr, char *buf) 11 struct device_attribute *attr, char *buf)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 141ff9fa296e..2120155929a6 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -580,8 +580,8 @@ static void __map_bio(struct dm_target *ti, struct bio *clone,
580 /* the bio has been remapped so dispatch it */ 580 /* the bio has been remapped so dispatch it */
581 581
582 blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone, 582 blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone,
583 tio->io->bio->bi_bdev->bd_dev, sector, 583 tio->io->bio->bi_bdev->bd_dev,
584 clone->bi_sector); 584 clone->bi_sector, sector);
585 585
586 generic_make_request(clone); 586 generic_make_request(clone);
587 } else if (r < 0 || r == DM_MAPIO_REQUEUE) { 587 } else if (r < 0 || r == DM_MAPIO_REQUEUE) {
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 8c86b802f212..d091b2430b48 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -7,6 +7,7 @@
7 7
8#include <linux/device.h> 8#include <linux/device.h>
9#include <linux/fs.h> 9#include <linux/fs.h>
10#include <linux/mm.h>
10#include <linux/err.h> 11#include <linux/err.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 0c16a2b39b41..2adf856e44c2 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -86,7 +86,7 @@ struct mpc83xx_spi {
86 86
87 unsigned nsecs; /* (clock cycle time)/2 */ 87 unsigned nsecs; /* (clock cycle time)/2 */
88 88
89 u32 sysclk; 89 u32 spibrg; /* SPIBRG input clock */
90 u32 rx_shift; /* RX data reg shift when in qe mode */ 90 u32 rx_shift; /* RX data reg shift when in qe mode */
91 u32 tx_shift; /* TX data reg shift when in qe mode */ 91 u32 tx_shift; /* TX data reg shift when in qe mode */
92 92
@@ -148,6 +148,8 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
148 if (value == BITBANG_CS_ACTIVE) { 148 if (value == BITBANG_CS_ACTIVE) {
149 u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode); 149 u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
150 u32 len = spi->bits_per_word; 150 u32 len = spi->bits_per_word;
151 u8 pm;
152
151 if (len == 32) 153 if (len == 32)
152 len = 0; 154 len = 0;
153 else 155 else
@@ -169,17 +171,20 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
169 171
170 regval |= SPMODE_LEN(len); 172 regval |= SPMODE_LEN(len);
171 173
172 if ((mpc83xx_spi->sysclk / spi->max_speed_hz) >= 64) { 174 if ((mpc83xx_spi->spibrg / spi->max_speed_hz) >= 64) {
173 u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 64); 175 pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 64) - 1;
174 if (pm > 0x0f) { 176 if (pm > 0x0f) {
175 printk(KERN_WARNING "MPC83xx SPI: SPICLK can't be less then a SYSCLK/1024!\n" 177 dev_err(&spi->dev, "Requested speed is too "
176 "Requested SPICLK is %d Hz. Will use %d Hz instead.\n", 178 "low: %d Hz. Will use %d Hz instead.\n",
177 spi->max_speed_hz, mpc83xx_spi->sysclk / 1024); 179 spi->max_speed_hz,
180 mpc83xx_spi->spibrg / 1024);
178 pm = 0x0f; 181 pm = 0x0f;
179 } 182 }
180 regval |= SPMODE_PM(pm) | SPMODE_DIV16; 183 regval |= SPMODE_PM(pm) | SPMODE_DIV16;
181 } else { 184 } else {
182 u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 4); 185 pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 4);
186 if (pm)
187 pm--;
183 regval |= SPMODE_PM(pm); 188 regval |= SPMODE_PM(pm);
184 } 189 }
185 190
@@ -429,13 +434,17 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
429 mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect; 434 mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect;
430 mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer; 435 mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer;
431 mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs; 436 mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs;
432 mpc83xx_spi->sysclk = pdata->sysclk;
433 mpc83xx_spi->activate_cs = pdata->activate_cs; 437 mpc83xx_spi->activate_cs = pdata->activate_cs;
434 mpc83xx_spi->deactivate_cs = pdata->deactivate_cs; 438 mpc83xx_spi->deactivate_cs = pdata->deactivate_cs;
435 mpc83xx_spi->qe_mode = pdata->qe_mode; 439 mpc83xx_spi->qe_mode = pdata->qe_mode;
436 mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; 440 mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;
437 mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; 441 mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;
438 442
443 if (mpc83xx_spi->qe_mode)
444 mpc83xx_spi->spibrg = pdata->sysclk / 2;
445 else
446 mpc83xx_spi->spibrg = pdata->sysclk;
447
439 mpc83xx_spi->rx_shift = 0; 448 mpc83xx_spi->rx_shift = 0;
440 mpc83xx_spi->tx_shift = 0; 449 mpc83xx_spi->tx_shift = 0;
441 if (mpc83xx_spi->qe_mode) { 450 if (mpc83xx_spi->qe_mode) {
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 630f781aeb19..c55459c592b8 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -183,7 +183,9 @@ static int spidev_message(struct spidev_data *spidev,
183 183
184 if (u_tmp->rx_buf) { 184 if (u_tmp->rx_buf) {
185 k_tmp->rx_buf = buf; 185 k_tmp->rx_buf = buf;
186 if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len)) 186 if (!access_ok(VERIFY_WRITE, (u8 __user *)
187 (ptrdiff_t) u_tmp->rx_buf,
188 u_tmp->len))
187 goto done; 189 goto done;
188 } 190 }
189 if (u_tmp->tx_buf) { 191 if (u_tmp->tx_buf) {
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index decfdc8eb9cc..e58c87b3e3a0 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -127,8 +127,20 @@ static int last_fb_vc = MAX_NR_CONSOLES - 1;
127static int fbcon_is_default = 1; 127static int fbcon_is_default = 1;
128static int fbcon_has_exited; 128static int fbcon_has_exited;
129static int primary_device = -1; 129static int primary_device = -1;
130
131#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
130static int map_override; 132static int map_override;
131 133
134static inline void fbcon_map_override(void)
135{
136 map_override = 1;
137}
138#else
139static inline void fbcon_map_override(void)
140{
141}
142#endif /* CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY */
143
132/* font data */ 144/* font data */
133static char fontname[40]; 145static char fontname[40];
134 146
@@ -506,7 +518,7 @@ static int __init fb_console_setup(char *this_opt)
506 (options[j++]-'0') % FB_MAX; 518 (options[j++]-'0') % FB_MAX;
507 } 519 }
508 520
509 map_override = 1; 521 fbcon_map_override();
510 } 522 }
511 523
512 return 1; 524 return 1;
diff --git a/drivers/video/matrox/g450_pll.c b/drivers/video/matrox/g450_pll.c
index 7c76e079ca7d..d42346e7fdda 100644
--- a/drivers/video/matrox/g450_pll.c
+++ b/drivers/video/matrox/g450_pll.c
@@ -331,16 +331,19 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll,
331 tmp |= M1064_XPIXCLKCTRL_PLL_UP; 331 tmp |= M1064_XPIXCLKCTRL_PLL_UP;
332 } 332 }
333 matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp); 333 matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp);
334#ifdef __powerpc__ 334 /* DVI PLL preferred for frequencies up to
335 /* This is necessary to avoid jitter on PowerPC 335 panel link max, standard PLL otherwise */
336 * (OpenFirmware) systems, but apparently 336 if (fout >= MINFO->max_pixel_clock_panellink)
337 * introduces jitter, at least on a x86-64 337 tmp = 0;
338 * using DVI. 338 else tmp =
339 * A simple workaround is disable for non-PPC. 339 M1064_XDVICLKCTRL_DVIDATAPATHSEL |
340 */ 340 M1064_XDVICLKCTRL_C1DVICLKSEL |
341 matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL, 0); 341 M1064_XDVICLKCTRL_C1DVICLKEN |
342#endif /* __powerpc__ */ 342 M1064_XDVICLKCTRL_DVILOOPCTL |
343 matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl); 343 M1064_XDVICLKCTRL_P1LOOPBWDTCTL;
344 matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL,tmp);
345 matroxfb_DAC_out(PMINFO M1064_XPWRCTRL,
346 xpwrctrl);
344 347
345 matroxfb_DAC_unlock_irqrestore(flags); 348 matroxfb_DAC_unlock_irqrestore(flags);
346 } 349 }
diff --git a/drivers/video/matrox/matroxfb_DAC1064.h b/drivers/video/matrox/matroxfb_DAC1064.h
index df39c3193735..7a98ce8043d7 100644
--- a/drivers/video/matrox/matroxfb_DAC1064.h
+++ b/drivers/video/matrox/matroxfb_DAC1064.h
@@ -33,6 +33,21 @@ void DAC1064_global_restore(WPMINFO2);
33#define M1064_XCURCTRL_3COLOR 0x01 /* transparent, 0, 1, 2 */ 33#define M1064_XCURCTRL_3COLOR 0x01 /* transparent, 0, 1, 2 */
34#define M1064_XCURCTRL_XGA 0x02 /* 0, 1, transparent, complement */ 34#define M1064_XCURCTRL_XGA 0x02 /* 0, 1, transparent, complement */
35#define M1064_XCURCTRL_XWIN 0x03 /* transparent, transparent, 0, 1 */ 35#define M1064_XCURCTRL_XWIN 0x03 /* transparent, transparent, 0, 1 */
36 /* drive DVI by standard(0)/DVI(1) PLL */
37 /* if set(1), C?DVICLKEN and C?DVICLKSEL must be set(1) */
38#define M1064_XDVICLKCTRL_DVIDATAPATHSEL 0x01
39 /* drive CRTC1 by standard(0)/DVI(1) PLL */
40#define M1064_XDVICLKCTRL_C1DVICLKSEL 0x02
41 /* drive CRTC2 by standard(0)/DVI(1) PLL */
42#define M1064_XDVICLKCTRL_C2DVICLKSEL 0x04
43 /* pixel clock allowed to(0)/blocked from(1) driving CRTC1 */
44#define M1064_XDVICLKCTRL_C1DVICLKEN 0x08
45 /* DVI PLL loop filter bandwidth selection bits */
46#define M1064_XDVICLKCTRL_DVILOOPCTL 0x30
47 /* CRTC2 pixel clock allowed to(0)/blocked from(1) driving CRTC2 */
48#define M1064_XDVICLKCTRL_C2DVICLKEN 0x40
49 /* P1PLL loop filter bandwith selection */
50#define M1064_XDVICLKCTRL_P1LOOPBWDTCTL 0x80
36#define M1064_XCURCOL0RED 0x08 51#define M1064_XCURCOL0RED 0x08
37#define M1064_XCURCOL0GREEN 0x09 52#define M1064_XCURCOL0GREEN 0x09
38#define M1064_XCURCOL0BLUE 0x0A 53#define M1064_XCURCOL0BLUE 0x0A
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h
index d59577c8de86..f3107ad7e545 100644
--- a/drivers/video/matrox/matroxfb_base.h
+++ b/drivers/video/matrox/matroxfb_base.h
@@ -424,6 +424,7 @@ struct matrox_fb_info {
424 } mmio; 424 } mmio;
425 425
426 unsigned int max_pixel_clock; 426 unsigned int max_pixel_clock;
427 unsigned int max_pixel_clock_panellink;
427 428
428 struct matrox_switch* hw_switch; 429 struct matrox_switch* hw_switch;
429 430
diff --git a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/matrox/matroxfb_misc.c
index 5948e54b9ef9..ab7fb50bc1de 100644
--- a/drivers/video/matrox/matroxfb_misc.c
+++ b/drivers/video/matrox/matroxfb_misc.c
@@ -658,6 +658,7 @@ static int parse_pins5(WPMINFO const struct matrox_bios* bd) {
658 MINFO->values.reg.mctlwtst_core = (MINFO->values.reg.mctlwtst & ~7) | 658 MINFO->values.reg.mctlwtst_core = (MINFO->values.reg.mctlwtst & ~7) |
659 wtst_xlat[MINFO->values.reg.mctlwtst & 7]; 659 wtst_xlat[MINFO->values.reg.mctlwtst & 7];
660 } 660 }
661 MINFO->max_pixel_clock_panellink = bd->pins[47] * 4000;
661 return 0; 662 return 0;
662} 663}
663 664
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c
index f9300266044d..7d6c29800d14 100644
--- a/drivers/video/pvr2fb.c
+++ b/drivers/video/pvr2fb.c
@@ -94,6 +94,7 @@
94#define DISP_DIWCONF (DISP_BASE + 0xe8) 94#define DISP_DIWCONF (DISP_BASE + 0xe8)
95#define DISP_DIWHSTRT (DISP_BASE + 0xec) 95#define DISP_DIWHSTRT (DISP_BASE + 0xec)
96#define DISP_DIWVSTRT (DISP_BASE + 0xf0) 96#define DISP_DIWVSTRT (DISP_BASE + 0xf0)
97#define DISP_PIXDEPTH (DISP_BASE + 0x108)
97 98
98/* Pixel clocks, one for TV output, doubled for VGA output */ 99/* Pixel clocks, one for TV output, doubled for VGA output */
99#define TV_CLK 74239 100#define TV_CLK 74239
@@ -143,6 +144,7 @@ static struct pvr2fb_par {
143 unsigned char is_lowres; /* Is horizontal pixel-doubling enabled? */ 144 unsigned char is_lowres; /* Is horizontal pixel-doubling enabled? */
144 145
145 unsigned long mmio_base; /* MMIO base */ 146 unsigned long mmio_base; /* MMIO base */
147 u32 palette[16];
146} *currentpar; 148} *currentpar;
147 149
148static struct fb_info *fb_info; 150static struct fb_info *fb_info;
@@ -599,6 +601,7 @@ static void pvr2_init_display(struct fb_info *info)
599 601
600 /* bits per pixel */ 602 /* bits per pixel */
601 fb_writel(fb_readl(DISP_DIWMODE) | (--bytesperpixel << 2), DISP_DIWMODE); 603 fb_writel(fb_readl(DISP_DIWMODE) | (--bytesperpixel << 2), DISP_DIWMODE);
604 fb_writel(bytesperpixel << 2, DISP_PIXDEPTH);
602 605
603 /* video enable, color sync, interlace, 606 /* video enable, color sync, interlace,
604 * hsync and vsync polarity (currently unused) */ 607 * hsync and vsync polarity (currently unused) */
@@ -790,7 +793,7 @@ static int __devinit pvr2fb_common_init(void)
790 fb_info->fbops = &pvr2fb_ops; 793 fb_info->fbops = &pvr2fb_ops;
791 fb_info->fix = pvr2_fix; 794 fb_info->fix = pvr2_fix;
792 fb_info->par = currentpar; 795 fb_info->par = currentpar;
793 fb_info->pseudo_palette = (void *)(fb_info->par + 1); 796 fb_info->pseudo_palette = currentpar->palette;
794 fb_info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; 797 fb_info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
795 798
796 if (video_output == VO_VGA) 799 if (video_output == VO_VGA)
@@ -807,6 +810,8 @@ static int __devinit pvr2fb_common_init(void)
807 810
808 if (register_framebuffer(fb_info) < 0) 811 if (register_framebuffer(fb_info) < 0)
809 goto out_err; 812 goto out_err;
813 /*Must write PIXDEPTH to register before anything is displayed - so force init */
814 pvr2_init_display(fb_info);
810 815
811 modememused = get_line_length(fb_info->var.xres_virtual, 816 modememused = get_line_length(fb_info->var.xres_virtual,
812 fb_info->var.bits_per_pixel); 817 fb_info->var.bits_per_pixel);
@@ -1082,14 +1087,15 @@ static int __init pvr2fb_init(void)
1082#endif 1087#endif
1083 size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32); 1088 size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32);
1084 1089
1085 fb_info = kzalloc(size, GFP_KERNEL); 1090 fb_info = framebuffer_alloc(sizeof(struct pvr2fb_par), NULL);
1091
1086 if (!fb_info) { 1092 if (!fb_info) {
1087 printk(KERN_ERR "Failed to allocate memory for fb_info\n"); 1093 printk(KERN_ERR "Failed to allocate memory for fb_info\n");
1088 return -ENOMEM; 1094 return -ENOMEM;
1089 } 1095 }
1090 1096
1091 1097
1092 currentpar = (struct pvr2fb_par *)(fb_info + 1); 1098 currentpar = fb_info->par;
1093 1099
1094 for (i = 0; i < ARRAY_SIZE(board_driver); i++) { 1100 for (i = 0; i < ARRAY_SIZE(board_driver); i++) {
1095 struct pvr2_board *pvr_board = board_driver + i; 1101 struct pvr2_board *pvr_board = board_driver + i;
@@ -1102,7 +1108,7 @@ static int __init pvr2fb_init(void)
1102 if (ret != 0) { 1108 if (ret != 0) {
1103 printk(KERN_ERR "pvr2fb: Failed init of %s device\n", 1109 printk(KERN_ERR "pvr2fb: Failed init of %s device\n",
1104 pvr_board->name); 1110 pvr_board->name);
1105 kfree(fb_info); 1111 framebuffer_release(fb_info);
1106 break; 1112 break;
1107 } 1113 }
1108 } 1114 }
@@ -1126,7 +1132,7 @@ static void __exit pvr2fb_exit(void)
1126#endif 1132#endif
1127 1133
1128 unregister_framebuffer(fb_info); 1134 unregister_framebuffer(fb_info);
1129 kfree(fb_info); 1135 framebuffer_release(fb_info);
1130} 1136}
1131 1137
1132module_init(pvr2fb_init); 1138module_init(pvr2fb_init);
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c
index c97709ecbad0..e7c8db2eb49b 100644
--- a/drivers/video/stifb.c
+++ b/drivers/video/stifb.c
@@ -1100,13 +1100,18 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref)
1100 /* only supported cards are allowed */ 1100 /* only supported cards are allowed */
1101 switch (fb->id) { 1101 switch (fb->id) {
1102 case CRT_ID_VISUALIZE_EG: 1102 case CRT_ID_VISUALIZE_EG:
1103 /* look for a double buffering device like e.g. the 1103 /* Visualize cards can run either in "double buffer" or
1104 "INTERNAL_EG_DX1024" in the RDI precisionbook laptop 1104 "standard" mode. Depending on the mode, the card reports
1105 which won't work. The same device in non-double 1105 a different device name, e.g. "INTERNAL_EG_DX1024" in double
1106 buffering mode returns "INTERNAL_EG_X1024". */ 1106 buffer mode and "INTERNAL_EG_X1024" in standard mode.
1107 if (strstr(sti->outptr.dev_name, "EG_DX")) { 1107 Since this driver only supports standard mode, we check
1108 printk(KERN_WARNING 1108 if the device name contains the string "DX" and tell the
1109 "stifb: ignoring '%s'. Disable double buffering in IPL menu.\n", 1109 user how to reconfigure the card. */
1110 if (strstr(sti->outptr.dev_name, "DX")) {
1111 printk(KERN_WARNING "WARNING: stifb framebuffer driver does not "
1112 "support '%s' in double-buffer mode.\n"
1113 KERN_WARNING "WARNING: Please disable the double-buffer mode "
1114 "in IPL menu (the PARISC-BIOS).\n",
1110 sti->outptr.dev_name); 1115 sti->outptr.dev_name);
1111 goto out_err0; 1116 goto out_err0;
1112 } 1117 }
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 52bb2638f7ab..6874785bb65a 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -974,6 +974,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
974 dio->get_block = get_block; 974 dio->get_block = get_block;
975 dio->end_io = end_io; 975 dio->end_io = end_io;
976 dio->map_bh.b_private = NULL; 976 dio->map_bh.b_private = NULL;
977 dio->map_bh.b_state = 0;
977 dio->final_block_in_bio = -1; 978 dio->final_block_in_bio = -1;
978 dio->next_block_for_io = -1; 979 dio->next_block_for_io = -1;
979 980
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 0a50942b4378..131954b3fb98 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -353,6 +353,10 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
353 ecryptfs_printk(KERN_DEBUG, "Is a symlink; returning\n"); 353 ecryptfs_printk(KERN_DEBUG, "Is a symlink; returning\n");
354 goto out; 354 goto out;
355 } 355 }
356 if (special_file(lower_inode->i_mode)) {
357 ecryptfs_printk(KERN_DEBUG, "Is a special file; returning\n");
358 goto out;
359 }
356 if (!nd) { 360 if (!nd) {
357 ecryptfs_printk(KERN_DEBUG, "We have a NULL nd, just leave" 361 ecryptfs_printk(KERN_DEBUG, "We have a NULL nd, just leave"
358 "as we *think* we are about to unlink\n"); 362 "as we *think* we are about to unlink\n");
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index e557a6766927..a98497264fe8 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -813,6 +813,15 @@ out:
813 return rc; 813 return rc;
814} 814}
815 815
816static void do_sysfs_unregistration(void)
817{
818 sysfs_remove_file(&ecryptfs_subsys.kobj,
819 &sysfs_attr_version.attr);
820 sysfs_remove_file(&ecryptfs_subsys.kobj,
821 &sysfs_attr_version_str.attr);
822 subsystem_unregister(&ecryptfs_subsys);
823}
824
816static int __init ecryptfs_init(void) 825static int __init ecryptfs_init(void)
817{ 826{
818 int rc; 827 int rc;
@@ -851,6 +860,9 @@ static int __init ecryptfs_init(void)
851 if (rc) { 860 if (rc) {
852 ecryptfs_printk(KERN_ERR, "Failure occured while attempting to " 861 ecryptfs_printk(KERN_ERR, "Failure occured while attempting to "
853 "initialize the eCryptfs netlink socket\n"); 862 "initialize the eCryptfs netlink socket\n");
863 do_sysfs_unregistration();
864 unregister_filesystem(&ecryptfs_fs_type);
865 ecryptfs_free_kmem_caches();
854 } 866 }
855out: 867out:
856 return rc; 868 return rc;
@@ -858,11 +870,7 @@ out:
858 870
859static void __exit ecryptfs_exit(void) 871static void __exit ecryptfs_exit(void)
860{ 872{
861 sysfs_remove_file(&ecryptfs_subsys.kobj, 873 do_sysfs_unregistration();
862 &sysfs_attr_version.attr);
863 sysfs_remove_file(&ecryptfs_subsys.kobj,
864 &sysfs_attr_version_str.attr);
865 subsystem_unregister(&ecryptfs_subsys);
866 ecryptfs_release_messaging(ecryptfs_transport); 874 ecryptfs_release_messaging(ecryptfs_transport);
867 unregister_filesystem(&ecryptfs_fs_type); 875 unregister_filesystem(&ecryptfs_fs_type);
868 ecryptfs_free_kmem_caches(); 876 ecryptfs_free_kmem_caches();
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index f5e11f4fa952..4f517665c9a0 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -3731,7 +3731,6 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
3731{ 3731{
3732 int status; 3732 int status;
3733 struct buffer_head *last_eb_bh = NULL; 3733 struct buffer_head *last_eb_bh = NULL;
3734 struct buffer_head *bh = NULL;
3735 struct ocfs2_insert_type insert = {0, }; 3734 struct ocfs2_insert_type insert = {0, };
3736 struct ocfs2_extent_rec rec; 3735 struct ocfs2_extent_rec rec;
3737 3736
@@ -3783,9 +3782,6 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
3783 ocfs2_extent_map_insert_rec(inode, &rec); 3782 ocfs2_extent_map_insert_rec(inode, &rec);
3784 3783
3785bail: 3784bail:
3786 if (bh)
3787 brelse(bh);
3788
3789 if (last_eb_bh) 3785 if (last_eb_bh)
3790 brelse(last_eb_bh); 3786 brelse(last_eb_bh);
3791 3787
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index f0bdfd944c44..685c18065c82 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -854,17 +854,25 @@ static void o2net_sendpage(struct o2net_sock_container *sc,
854 struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); 854 struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
855 ssize_t ret; 855 ssize_t ret;
856 856
857 857 while (1) {
858 mutex_lock(&sc->sc_send_lock); 858 mutex_lock(&sc->sc_send_lock);
859 ret = sc->sc_sock->ops->sendpage(sc->sc_sock, 859 ret = sc->sc_sock->ops->sendpage(sc->sc_sock,
860 virt_to_page(kmalloced_virt), 860 virt_to_page(kmalloced_virt),
861 (long)kmalloced_virt & ~PAGE_MASK, 861 (long)kmalloced_virt & ~PAGE_MASK,
862 size, MSG_DONTWAIT); 862 size, MSG_DONTWAIT);
863 mutex_unlock(&sc->sc_send_lock); 863 mutex_unlock(&sc->sc_send_lock);
864 if (ret != size) { 864 if (ret == size)
865 break;
866 if (ret == (ssize_t)-EAGAIN) {
867 mlog(0, "sendpage of size %zu to " SC_NODEF_FMT
868 " returned EAGAIN\n", size, SC_NODEF_ARGS(sc));
869 cond_resched();
870 continue;
871 }
865 mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT 872 mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT
866 " failed with %zd\n", size, SC_NODEF_ARGS(sc), ret); 873 " failed with %zd\n", size, SC_NODEF_ARGS(sc), ret);
867 o2net_ensure_shutdown(nn, sc, 0); 874 o2net_ensure_shutdown(nn, sc, 0);
875 break;
868 } 876 }
869} 877}
870 878
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index c4034f693e7b..4ffa715be09c 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -187,6 +187,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
187 int ret; 187 int ret;
188 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 188 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
189 handle_t *handle; 189 handle_t *handle;
190 struct ocfs2_dinode *di = (struct ocfs2_dinode *) bh->b_data;
190 191
191 mlog_entry_void(); 192 mlog_entry_void();
192 193
@@ -197,11 +198,27 @@ int ocfs2_update_inode_atime(struct inode *inode,
197 goto out; 198 goto out;
198 } 199 }
199 200
201 ret = ocfs2_journal_access(handle, inode, bh,
202 OCFS2_JOURNAL_ACCESS_WRITE);
203 if (ret) {
204 mlog_errno(ret);
205 goto out_commit;
206 }
207
208 /*
209 * Don't use ocfs2_mark_inode_dirty() here as we don't always
210 * have i_mutex to guard against concurrent changes to other
211 * inode fields.
212 */
200 inode->i_atime = CURRENT_TIME; 213 inode->i_atime = CURRENT_TIME;
201 ret = ocfs2_mark_inode_dirty(handle, inode, bh); 214 di->i_atime = cpu_to_le64(inode->i_atime.tv_sec);
215 di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec);
216
217 ret = ocfs2_journal_dirty(handle, bh);
202 if (ret < 0) 218 if (ret < 0)
203 mlog_errno(ret); 219 mlog_errno(ret);
204 220
221out_commit:
205 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); 222 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
206out: 223out:
207 mlog_exit(ret); 224 mlog_exit(ret);
@@ -1011,6 +1028,11 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
1011 } 1028 }
1012 1029
1013 if (size_change && attr->ia_size != i_size_read(inode)) { 1030 if (size_change && attr->ia_size != i_size_read(inode)) {
1031 if (attr->ia_size > sb->s_maxbytes) {
1032 status = -EFBIG;
1033 goto bail_unlock;
1034 }
1035
1014 if (i_size_read(inode) > attr->ia_size) 1036 if (i_size_read(inode) > attr->ia_size)
1015 status = ocfs2_truncate_file(inode, bh, attr->ia_size); 1037 status = ocfs2_truncate_file(inode, bh, attr->ia_size);
1016 else 1038 else
@@ -1516,7 +1538,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
1516 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1538 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1517 struct buffer_head *di_bh = NULL; 1539 struct buffer_head *di_bh = NULL;
1518 handle_t *handle; 1540 handle_t *handle;
1519 unsigned long long max_off = ocfs2_max_file_offset(inode->i_sb->s_blocksize_bits); 1541 unsigned long long max_off = inode->i_sb->s_maxbytes;
1520 1542
1521 if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) 1543 if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
1522 return -EROFS; 1544 return -EROFS;
@@ -1942,7 +1964,7 @@ static ssize_t ocfs2_file_buffered_write(struct file *file, loff_t *ppos,
1942 } 1964 }
1943 1965
1944 dst = kmap_atomic(page, KM_USER0); 1966 dst = kmap_atomic(page, KM_USER0);
1945 memcpy(dst + (pos & (PAGE_CACHE_SIZE - 1)), buf, bytes); 1967 memcpy(dst + (pos & (loff_t)(PAGE_CACHE_SIZE - 1)), buf, bytes);
1946 kunmap_atomic(dst, KM_USER0); 1968 kunmap_atomic(dst, KM_USER0);
1947 flush_dcache_page(page); 1969 flush_dcache_page(page);
1948 ocfs2_put_write_source(user_page); 1970 ocfs2_put_write_source(user_page);
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index d430fdab16e9..701e6d04ed5d 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -1080,6 +1080,7 @@ static int ocfs2_rename(struct inode *old_dir,
1080 struct buffer_head *old_inode_de_bh = NULL; // if old_dentry is a dir, 1080 struct buffer_head *old_inode_de_bh = NULL; // if old_dentry is a dir,
1081 // this is the 1st dirent bh 1081 // this is the 1st dirent bh
1082 nlink_t old_dir_nlink = old_dir->i_nlink; 1082 nlink_t old_dir_nlink = old_dir->i_nlink;
1083 struct ocfs2_dinode *old_di;
1083 1084
1084 /* At some point it might be nice to break this function up a 1085 /* At some point it might be nice to break this function up a
1085 * bit. */ 1086 * bit. */
@@ -1354,7 +1355,20 @@ static int ocfs2_rename(struct inode *old_dir,
1354 1355
1355 old_inode->i_ctime = CURRENT_TIME; 1356 old_inode->i_ctime = CURRENT_TIME;
1356 mark_inode_dirty(old_inode); 1357 mark_inode_dirty(old_inode);
1357 ocfs2_mark_inode_dirty(handle, old_inode, old_inode_bh); 1358
1359 status = ocfs2_journal_access(handle, old_inode, old_inode_bh,
1360 OCFS2_JOURNAL_ACCESS_WRITE);
1361 if (status >= 0) {
1362 old_di = (struct ocfs2_dinode *) old_inode_bh->b_data;
1363
1364 old_di->i_ctime = cpu_to_le64(old_inode->i_ctime.tv_sec);
1365 old_di->i_ctime_nsec = cpu_to_le32(old_inode->i_ctime.tv_nsec);
1366
1367 status = ocfs2_journal_dirty(handle, old_inode_bh);
1368 if (status < 0)
1369 mlog_errno(status);
1370 } else
1371 mlog_errno(status);
1358 1372
1359 /* now that the name has been added to new_dir, remove the old name */ 1373 /* now that the name has been added to new_dir, remove the old name */
1360 status = ocfs2_delete_entry(handle, old_dir, old_de, old_de_bh); 1374 status = ocfs2_delete_entry(handle, old_dir, old_de, old_de_bh);
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 5cc90a40b3c5..58307853fb4a 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -494,16 +494,16 @@ static inline unsigned int ocfs2_page_index_to_clusters(struct super_block *sb,
494/* 494/*
495 * Find the 1st page index which covers the given clusters. 495 * Find the 1st page index which covers the given clusters.
496 */ 496 */
497static inline unsigned long ocfs2_align_clusters_to_page_index(struct super_block *sb, 497static inline pgoff_t ocfs2_align_clusters_to_page_index(struct super_block *sb,
498 u32 clusters) 498 u32 clusters)
499{ 499{
500 unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits; 500 unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits;
501 unsigned long index = clusters; 501 pgoff_t index = clusters;
502 502
503 if (PAGE_CACHE_SHIFT > cbits) { 503 if (PAGE_CACHE_SHIFT > cbits) {
504 index = clusters >> (PAGE_CACHE_SHIFT - cbits); 504 index = (pgoff_t)clusters >> (PAGE_CACHE_SHIFT - cbits);
505 } else if (PAGE_CACHE_SHIFT < cbits) { 505 } else if (PAGE_CACHE_SHIFT < cbits) {
506 index = clusters << (cbits - PAGE_CACHE_SHIFT); 506 index = (pgoff_t)clusters << (cbits - PAGE_CACHE_SHIFT);
507 } 507 }
508 508
509 return index; 509 return index;
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 200c7d4790dc..f2fc9a795deb 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -316,39 +316,51 @@ static void ocfs2_destroy_inode(struct inode *inode)
316 kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode)); 316 kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode));
317} 317}
318 318
319/* From xfs_super.c:xfs_max_file_offset 319static unsigned long long ocfs2_max_file_offset(unsigned int bbits,
320 * Copyright (c) 2000-2004 Silicon Graphics, Inc. 320 unsigned int cbits)
321 */
322unsigned long long ocfs2_max_file_offset(unsigned int blockshift)
323{ 321{
324 unsigned int pagefactor = 1; 322 unsigned int bytes = 1 << cbits;
325 unsigned int bitshift = BITS_PER_LONG - 1; 323 unsigned int trim = bytes;
326 324 unsigned int bitshift = 32;
327 /* Figure out maximum filesize, on Linux this can depend on 325
328 * the filesystem blocksize (on 32 bit platforms). 326 /*
329 * __block_prepare_write does this in an [unsigned] long... 327 * i_size and all block offsets in ocfs2 are always 64 bits
330 * page->index << (PAGE_CACHE_SHIFT - bbits) 328 * wide. i_clusters is 32 bits, in cluster-sized units. So on
331 * So, for page sized blocks (4K on 32 bit platforms), 329 * 64 bit platforms, cluster size will be the limiting factor.
332 * this wraps at around 8Tb (hence MAX_LFS_FILESIZE which is
333 * (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
334 * but for smaller blocksizes it is less (bbits = log2 bsize).
335 * Note1: get_block_t takes a long (implicit cast from above)
336 * Note2: The Large Block Device (LBD and HAVE_SECTOR_T) patch
337 * can optionally convert the [unsigned] long from above into
338 * an [unsigned] long long.
339 */ 330 */
340 331
341#if BITS_PER_LONG == 32 332#if BITS_PER_LONG == 32
342# if defined(CONFIG_LBD) 333# if defined(CONFIG_LBD)
343 BUILD_BUG_ON(sizeof(sector_t) != 8); 334 BUILD_BUG_ON(sizeof(sector_t) != 8);
344 pagefactor = PAGE_CACHE_SIZE; 335 /*
345 bitshift = BITS_PER_LONG; 336 * We might be limited by page cache size.
337 */
338 if (bytes > PAGE_CACHE_SIZE) {
339 bytes = PAGE_CACHE_SIZE;
340 trim = 1;
341 /*
342 * Shift by 31 here so that we don't get larger than
343 * MAX_LFS_FILESIZE
344 */
345 bitshift = 31;
346 }
346# else 347# else
347 pagefactor = PAGE_CACHE_SIZE >> (PAGE_CACHE_SHIFT - blockshift); 348 /*
349 * We are limited by the size of sector_t. Use block size, as
350 * that's what we expose to the VFS.
351 */
352 bytes = 1 << bbits;
353 trim = 1;
354 bitshift = 31;
348# endif 355# endif
349#endif 356#endif
350 357
351 return (((unsigned long long)pagefactor) << bitshift) - 1; 358 /*
359 * Trim by a whole cluster when we can actually approach the
360 * on-disk limits. Otherwise we can overflow i_clusters when
361 * an extent start is at the max offset.
362 */
363 return (((unsigned long long)bytes) << bitshift) - trim;
352} 364}
353 365
354static int ocfs2_remount(struct super_block *sb, int *flags, char *data) 366static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
@@ -1259,8 +1271,8 @@ static int ocfs2_initialize_super(struct super_block *sb,
1259 int sector_size) 1271 int sector_size)
1260{ 1272{
1261 int status = 0; 1273 int status = 0;
1262 int i; 1274 int i, cbits, bbits;
1263 struct ocfs2_dinode *di = NULL; 1275 struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
1264 struct inode *inode = NULL; 1276 struct inode *inode = NULL;
1265 struct buffer_head *bitmap_bh = NULL; 1277 struct buffer_head *bitmap_bh = NULL;
1266 struct ocfs2_journal *journal; 1278 struct ocfs2_journal *journal;
@@ -1279,9 +1291,12 @@ static int ocfs2_initialize_super(struct super_block *sb,
1279 sb->s_fs_info = osb; 1291 sb->s_fs_info = osb;
1280 sb->s_op = &ocfs2_sops; 1292 sb->s_op = &ocfs2_sops;
1281 sb->s_export_op = &ocfs2_export_ops; 1293 sb->s_export_op = &ocfs2_export_ops;
1294 sb->s_time_gran = 1;
1282 sb->s_flags |= MS_NOATIME; 1295 sb->s_flags |= MS_NOATIME;
1283 /* this is needed to support O_LARGEFILE */ 1296 /* this is needed to support O_LARGEFILE */
1284 sb->s_maxbytes = ocfs2_max_file_offset(sb->s_blocksize_bits); 1297 cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
1298 bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
1299 sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
1285 1300
1286 osb->sb = sb; 1301 osb->sb = sb;
1287 /* Save off for ocfs2_rw_direct */ 1302 /* Save off for ocfs2_rw_direct */
@@ -1341,8 +1356,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
1341 goto bail; 1356 goto bail;
1342 } 1357 }
1343 1358
1344 di = (struct ocfs2_dinode *)bh->b_data;
1345
1346 osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); 1359 osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
1347 if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) { 1360 if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) {
1348 mlog(ML_ERROR, "Invalid number of node slots (%u)\n", 1361 mlog(ML_ERROR, "Invalid number of node slots (%u)\n",
diff --git a/fs/ocfs2/super.h b/fs/ocfs2/super.h
index 3b9cb3d0b008..783f5270f2a1 100644
--- a/fs/ocfs2/super.h
+++ b/fs/ocfs2/super.h
@@ -45,6 +45,4 @@ void __ocfs2_abort(struct super_block *sb,
45 45
46#define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##args) 46#define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##args)
47 47
48unsigned long long ocfs2_max_file_offset(unsigned int blockshift);
49
50#endif /* OCFS2_SUPER_H */ 48#endif /* OCFS2_SUPER_H */
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
index 7306c71a8926..cd84f1771e34 100644
--- a/include/asm-frv/unistd.h
+++ b/include/asm-frv/unistd.h
@@ -330,10 +330,11 @@
330#define __NR_signalfd 321 330#define __NR_signalfd 321
331#define __NR_timerfd 322 331#define __NR_timerfd 322
332#define __NR_eventfd 323 332#define __NR_eventfd 323
333#define __NR_fallocate 324
333 334
334#ifdef __KERNEL__ 335#ifdef __KERNEL__
335 336
336#define NR_syscalls 324 337#define NR_syscalls 325
337 338
338#define __ARCH_WANT_IPC_PARSE_VERSION 339#define __ARCH_WANT_IPC_PARSE_VERSION
339/* #define __ARCH_WANT_OLD_READDIR */ 340/* #define __ARCH_WANT_OLD_READDIR */
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index f605e8d0eed3..5f0d797d33fd 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -2,6 +2,7 @@
2#define _ASM_GENERIC_PGTABLE_H 2#define _ASM_GENERIC_PGTABLE_H
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5#ifdef CONFIG_MMU
5 6
6#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 7#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
7/* 8/*
@@ -133,41 +134,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
133#endif 134#endif
134 135
135/* 136/*
136 * A facility to provide lazy MMU batching. This allows PTE updates and
137 * page invalidations to be delayed until a call to leave lazy MMU mode
138 * is issued. Some architectures may benefit from doing this, and it is
139 * beneficial for both shadow and direct mode hypervisors, which may batch
140 * the PTE updates which happen during this window. Note that using this
141 * interface requires that read hazards be removed from the code. A read
142 * hazard could result in the direct mode hypervisor case, since the actual
143 * write to the page tables may not yet have taken place, so reads though
144 * a raw PTE pointer after it has been modified are not guaranteed to be
145 * up to date. This mode can only be entered and left under the protection of
146 * the page table locks for all page tables which may be modified. In the UP
147 * case, this is required so that preemption is disabled, and in the SMP case,
148 * it must synchronize the delayed page table writes properly on other CPUs.
149 */
150#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
151#define arch_enter_lazy_mmu_mode() do {} while (0)
152#define arch_leave_lazy_mmu_mode() do {} while (0)
153#define arch_flush_lazy_mmu_mode() do {} while (0)
154#endif
155
156/*
157 * A facility to provide batching of the reload of page tables with the
158 * actual context switch code for paravirtualized guests. By convention,
159 * only one of the lazy modes (CPU, MMU) should be active at any given
160 * time, entry should never be nested, and entry and exits should always
161 * be paired. This is for sanity of maintaining and reasoning about the
162 * kernel code.
163 */
164#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
165#define arch_enter_lazy_cpu_mode() do {} while (0)
166#define arch_leave_lazy_cpu_mode() do {} while (0)
167#define arch_flush_lazy_cpu_mode() do {} while (0)
168#endif
169
170/*
171 * When walking page tables, get the address of the next boundary, 137 * When walking page tables, get the address of the next boundary,
172 * or the end address of the range if that comes earlier. Although no 138 * or the end address of the range if that comes earlier. Although no
173 * vma end wraps to 0, rounded up __boundary may wrap to 0 throughout. 139 * vma end wraps to 0, rounded up __boundary may wrap to 0 throughout.
@@ -233,6 +199,43 @@ static inline int pmd_none_or_clear_bad(pmd_t *pmd)
233 } 199 }
234 return 0; 200 return 0;
235} 201}
202#endif /* CONFIG_MMU */
203
204/*
205 * A facility to provide lazy MMU batching. This allows PTE updates and
206 * page invalidations to be delayed until a call to leave lazy MMU mode
207 * is issued. Some architectures may benefit from doing this, and it is
208 * beneficial for both shadow and direct mode hypervisors, which may batch
209 * the PTE updates which happen during this window. Note that using this
210 * interface requires that read hazards be removed from the code. A read
211 * hazard could result in the direct mode hypervisor case, since the actual
212 * write to the page tables may not yet have taken place, so reads though
213 * a raw PTE pointer after it has been modified are not guaranteed to be
214 * up to date. This mode can only be entered and left under the protection of
215 * the page table locks for all page tables which may be modified. In the UP
216 * case, this is required so that preemption is disabled, and in the SMP case,
217 * it must synchronize the delayed page table writes properly on other CPUs.
218 */
219#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
220#define arch_enter_lazy_mmu_mode() do {} while (0)
221#define arch_leave_lazy_mmu_mode() do {} while (0)
222#define arch_flush_lazy_mmu_mode() do {} while (0)
223#endif
224
225/*
226 * A facility to provide batching of the reload of page tables with the
227 * actual context switch code for paravirtualized guests. By convention,
228 * only one of the lazy modes (CPU, MMU) should be active at any given
229 * time, entry should never be nested, and entry and exits should always
230 * be paired. This is for sanity of maintaining and reasoning about the
231 * kernel code.
232 */
233#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
234#define arch_enter_lazy_cpu_mode() do {} while (0)
235#define arch_leave_lazy_cpu_mode() do {} while (0)
236#define arch_flush_lazy_cpu_mode() do {} while (0)
237#endif
238
236#endif /* !__ASSEMBLY__ */ 239#endif /* !__ASSEMBLY__ */
237 240
238#endif /* _ASM_GENERIC_PGTABLE_H */ 241#endif /* _ASM_GENERIC_PGTABLE_H */
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index 1e8f6f252dd3..4091b33dcb10 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -116,6 +116,8 @@ extern void enable_NMI_through_LVT0 (void * dummy);
116extern int timer_over_8254; 116extern int timer_over_8254;
117extern int local_apic_timer_c2_ok; 117extern int local_apic_timer_c2_ok;
118 118
119extern int local_apic_timer_disabled;
120
119#else /* !CONFIG_X86_LOCAL_APIC */ 121#else /* !CONFIG_X86_LOCAL_APIC */
120static inline void lapic_shutdown(void) { } 122static inline void lapic_shutdown(void) { }
121 123
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index c961c03cf1e2..7b3aa28ebc6e 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -79,7 +79,7 @@
79#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */ 79#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
80#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */ 80#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */
81#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */ 81#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
82#define X86_FEATURE_LAPIC_TIMER_BROKEN (3*32+ 14) /* lapic timer broken in C1 */ 82/* 14 free */
83#define X86_FEATURE_SYNC_RDTSC (3*32+15) /* RDTSC synchronizes the CPU */ 83#define X86_FEATURE_SYNC_RDTSC (3*32+15) /* RDTSC synchronizes the CPU */
84#define X86_FEATURE_REP_GOOD (3*32+16) /* rep microcode works well on this CPU */ 84#define X86_FEATURE_REP_GOOD (3*32+16) /* rep microcode works well on this CPU */
85 85
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
index 7df88be2dd9e..9fa3fa9e62d1 100644
--- a/include/asm-i386/paravirt.h
+++ b/include/asm-i386/paravirt.h
@@ -47,7 +47,8 @@ struct paravirt_ops
47 * The patch function should return the number of bytes of code 47 * The patch function should return the number of bytes of code
48 * generated, as we nop pad the rest in generic code. 48 * generated, as we nop pad the rest in generic code.
49 */ 49 */
50 unsigned (*patch)(u8 type, u16 clobber, void *firstinsn, unsigned len); 50 unsigned (*patch)(u8 type, u16 clobber, void *insnbuf,
51 unsigned long addr, unsigned len);
51 52
52 /* Basic arch-specific setup */ 53 /* Basic arch-specific setup */
53 void (*arch_setup)(void); 54 void (*arch_setup)(void);
@@ -253,13 +254,16 @@ extern struct paravirt_ops paravirt_ops;
253 254
254unsigned paravirt_patch_nop(void); 255unsigned paravirt_patch_nop(void);
255unsigned paravirt_patch_ignore(unsigned len); 256unsigned paravirt_patch_ignore(unsigned len);
256unsigned paravirt_patch_call(void *target, u16 tgt_clobbers, 257unsigned paravirt_patch_call(void *insnbuf,
257 void *site, u16 site_clobbers, 258 const void *target, u16 tgt_clobbers,
259 unsigned long addr, u16 site_clobbers,
258 unsigned len); 260 unsigned len);
259unsigned paravirt_patch_jmp(void *target, void *site, unsigned len); 261unsigned paravirt_patch_jmp(const void *target, void *insnbuf,
260unsigned paravirt_patch_default(u8 type, u16 clobbers, void *site, unsigned len); 262 unsigned long addr, unsigned len);
263unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
264 unsigned long addr, unsigned len);
261 265
262unsigned paravirt_patch_insns(void *site, unsigned len, 266unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
263 const char *start, const char *end); 267 const char *start, const char *end);
264 268
265int paravirt_disable_iospace(void); 269int paravirt_disable_iospace(void);
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
index d790343e9982..4fcacc711385 100644
--- a/include/asm-i386/pci.h
+++ b/include/asm-i386/pci.h
@@ -8,6 +8,9 @@ struct pci_sysdata {
8 int node; /* NUMA node */ 8 int node; /* NUMA node */
9}; 9};
10 10
11/* scan a bus after allocating a pci_sysdata for it */
12extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
13
11#include <linux/mm.h> /* for struct page */ 14#include <linux/mm.h> /* for struct page */
12 15
13/* Can be used to override the logic in pci_scan_bus for skipping 16/* Can be used to override the logic in pci_scan_bus for skipping
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index f6bd804d9090..744d6bb24116 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -95,7 +95,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
95 return -EIO; 95 return -EIO;
96 if (dma_ops->set_dma_mask != NULL) 96 if (dma_ops->set_dma_mask != NULL)
97 return dma_ops->set_dma_mask(dev, dma_mask); 97 return dma_ops->set_dma_mask(dev, dma_mask);
98 if (!dev->dma_mask || !dma_supported(dev, *dev->dma_mask)) 98 if (!dev->dma_mask || !dma_supported(dev, dma_mask))
99 return -EIO; 99 return -EIO;
100 *dev->dma_mask = dma_mask; 100 *dev->dma_mask = dma_mask;
101 return 0; 101 return 0;
diff --git a/include/asm-powerpc/spu_priv1.h b/include/asm-powerpc/spu_priv1.h
index 7e78f6a1ab8b..0f37c7c90820 100644
--- a/include/asm-powerpc/spu_priv1.h
+++ b/include/asm-powerpc/spu_priv1.h
@@ -178,6 +178,7 @@ struct spu_management_ops {
178 int (*enumerate_spus)(int (*fn)(void *data)); 178 int (*enumerate_spus)(int (*fn)(void *data));
179 int (*create_spu)(struct spu *spu, void *data); 179 int (*create_spu)(struct spu *spu, void *data);
180 int (*destroy_spu)(struct spu *spu); 180 int (*destroy_spu)(struct spu *spu);
181 int (*init_affinity)(void);
181}; 182};
182 183
183extern const struct spu_management_ops* spu_management_ops; 184extern const struct spu_management_ops* spu_management_ops;
@@ -200,6 +201,12 @@ spu_destroy_spu (struct spu *spu)
200 return spu_management_ops->destroy_spu(spu); 201 return spu_management_ops->destroy_spu(spu);
201} 202}
202 203
204static inline int
205spu_init_affinity (void)
206{
207 return spu_management_ops->init_affinity();
208}
209
203/* 210/*
204 * The declarations folowing are put here for convenience 211 * The declarations folowing are put here for convenience
205 * and only intended to be used by the platform setup code. 212 * and only intended to be used by the platform setup code.
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index 88926eb44f5c..5da8cb0c0599 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -10,6 +10,8 @@ struct pci_sysdata {
10 void* iommu; /* IOMMU private data */ 10 void* iommu; /* IOMMU private data */
11}; 11};
12 12
13extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
14
13#ifdef CONFIG_CALGARY_IOMMU 15#ifdef CONFIG_CALGARY_IOMMU
14static inline void* pci_iommu(struct pci_bus *bus) 16static inline void* pci_iommu(struct pci_bus *bus)
15{ 17{
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 4d85262b4fa4..1ddef34f43c3 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -24,6 +24,8 @@
24#include <linux/mempool.h> 24#include <linux/mempool.h>
25#include <linux/ioprio.h> 25#include <linux/ioprio.h>
26 26
27#ifdef CONFIG_BLOCK
28
27/* Platforms may set this to teach the BIO layer about IOMMU hardware. */ 29/* Platforms may set this to teach the BIO layer about IOMMU hardware. */
28#include <asm/io.h> 30#include <asm/io.h>
29 31
@@ -361,4 +363,5 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
361 __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) 363 __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
362#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) 364#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
363 365
366#endif /* CONFIG_BLOCK */
364#endif /* __LINUX_BIO_H */ 367#endif /* __LINUX_BIO_H */
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 90874a5d7d78..7b5d56b82b59 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -105,7 +105,7 @@ struct blk_io_trace {
105 */ 105 */
106struct blk_io_trace_remap { 106struct blk_io_trace_remap {
107 __be32 device; 107 __be32 device;
108 u32 __pad; 108 __be32 device_from;
109 __be64 sector; 109 __be64 sector;
110}; 110};
111 111
@@ -272,6 +272,7 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
272 return; 272 return;
273 273
274 r.device = cpu_to_be32(dev); 274 r.device = cpu_to_be32(dev);
275 r.device_from = cpu_to_be32(bio->bi_bdev->bd_dev);
275 r.sector = cpu_to_be64(to); 276 r.sector = cpu_to_be64(to);
276 277
277 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r); 278 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index e0bd46eb2414..def5a659b8a5 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -123,7 +123,6 @@ extern void clockevents_exchange_device(struct clock_event_device *old,
123extern void clockevents_set_mode(struct clock_event_device *dev, 123extern void clockevents_set_mode(struct clock_event_device *dev,
124 enum clock_event_mode mode); 124 enum clock_event_mode mode);
125extern int clockevents_register_notifier(struct notifier_block *nb); 125extern int clockevents_register_notifier(struct notifier_block *nb);
126extern void clockevents_unregister_notifier(struct notifier_block *nb);
127extern int clockevents_program_event(struct clock_event_device *dev, 126extern int clockevents_program_event(struct clock_event_device *dev,
128 ktime_t expires, ktime_t now); 127 ktime_t expires, ktime_t now);
129 128
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 6bf139562947..16421f662a7a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1659,7 +1659,6 @@ extern int sb_min_blocksize(struct super_block *, int);
1659extern int generic_file_mmap(struct file *, struct vm_area_struct *); 1659extern int generic_file_mmap(struct file *, struct vm_area_struct *);
1660extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 1660extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
1661extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 1661extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
1662extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
1663int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 1662int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
1664extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 1663extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
1665extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); 1664extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
diff --git a/include/linux/init.h b/include/linux/init.h
index 1a4a283d19a9..74b1f43bf982 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -43,7 +43,7 @@
43#define __init __attribute__ ((__section__ (".init.text"))) __cold 43#define __init __attribute__ ((__section__ (".init.text"))) __cold
44#define __initdata __attribute__ ((__section__ (".init.data"))) 44#define __initdata __attribute__ ((__section__ (".init.data")))
45#define __exitdata __attribute__ ((__section__(".exit.data"))) 45#define __exitdata __attribute__ ((__section__(".exit.data")))
46#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) __cold 46#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
47 47
48/* modpost check for section mismatches during the kernel build. 48/* modpost check for section mismatches during the kernel build.
49 * A section mismatch happens when there are references from a 49 * A section mismatch happens when there are references from a
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index b4f5b81b4257..f592df74b3cf 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -226,7 +226,7 @@ extern void print_hex_dump(const char *level, const char *prefix_str,
226 int prefix_type, int rowsize, int groupsize, 226 int prefix_type, int rowsize, int groupsize,
227 const void *buf, size_t len, bool ascii); 227 const void *buf, size_t len, bool ascii);
228extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, 228extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
229 void *buf, size_t len); 229 const void *buf, size_t len);
230#define hex_asc(x) "0123456789abcdef"[x] 230#define hex_asc(x) "0123456789abcdef"[x]
231 231
232#ifdef DEBUG 232#ifdef DEBUG
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 28e3664fdf1b..cd13a78c5db8 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -75,7 +75,6 @@ struct proc_dir_entry {
75 write_proc_t *write_proc; 75 write_proc_t *write_proc;
76 atomic_t count; /* use count */ 76 atomic_t count; /* use count */
77 int deleted; /* delete flag */ 77 int deleted; /* delete flag */
78 void *set;
79 int pde_users; /* number of callers into module in progress */ 78 int pde_users; /* number of callers into module in progress */
80 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ 79 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
81 struct completion *pde_unload_completion; 80 struct completion *pde_unload_completion;
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index c6b7485eac7c..fe17d7d750c2 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -281,7 +281,6 @@ extern void FASTCALL(call_rcu(struct rcu_head *head,
281extern void FASTCALL(call_rcu_bh(struct rcu_head *head, 281extern void FASTCALL(call_rcu_bh(struct rcu_head *head,
282 void (*func)(struct rcu_head *head))); 282 void (*func)(struct rcu_head *head)));
283extern void synchronize_rcu(void); 283extern void synchronize_rcu(void);
284void synchronize_idle(void);
285extern void rcu_barrier(void); 284extern void rcu_barrier(void);
286 285
287#endif /* __KERNEL__ */ 286#endif /* __KERNEL__ */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 691a1748d9d2..6570719eafdf 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -274,6 +274,8 @@ struct tty_struct {
274#define TTY_PTY_LOCK 16 /* pty private */ 274#define TTY_PTY_LOCK 16 /* pty private */
275#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ 275#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
276#define TTY_HUPPED 18 /* Post driver->hangup() */ 276#define TTY_HUPPED 18 /* Post driver->hangup() */
277#define TTY_FLUSHING 19 /* Flushing to ldisc in progress */
278#define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */
277 279
278#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) 280#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
279 281
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 3e9f513a728d..4b8a4493c541 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1063,6 +1063,11 @@ EXPORT_SYMBOL_GPL(register_kprobe);
1063EXPORT_SYMBOL_GPL(unregister_kprobe); 1063EXPORT_SYMBOL_GPL(unregister_kprobe);
1064EXPORT_SYMBOL_GPL(register_jprobe); 1064EXPORT_SYMBOL_GPL(register_jprobe);
1065EXPORT_SYMBOL_GPL(unregister_jprobe); 1065EXPORT_SYMBOL_GPL(unregister_jprobe);
1066#ifdef CONFIG_KPROBES
1066EXPORT_SYMBOL_GPL(jprobe_return); 1067EXPORT_SYMBOL_GPL(jprobe_return);
1068#endif
1069
1070#ifdef CONFIG_KPROBES
1067EXPORT_SYMBOL_GPL(register_kretprobe); 1071EXPORT_SYMBOL_GPL(register_kretprobe);
1068EXPORT_SYMBOL_GPL(unregister_kretprobe); 1072EXPORT_SYMBOL_GPL(unregister_kretprobe);
1073#endif
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index a3b7854b8f7c..a686590d88c1 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -709,7 +709,8 @@ static void mark_nosave_pages(struct memory_bitmap *bm)
709 region->end_pfn << PAGE_SHIFT); 709 region->end_pfn << PAGE_SHIFT);
710 710
711 for (pfn = region->start_pfn; pfn < region->end_pfn; pfn++) 711 for (pfn = region->start_pfn; pfn < region->end_pfn; pfn++)
712 memory_bm_set_bit(bm, pfn); 712 if (pfn_valid(pfn))
713 memory_bm_set_bit(bm, pfn);
713 } 714 }
714} 715}
715 716
diff --git a/kernel/profile.c b/kernel/profile.c
index 5b20fe977bed..cb1e37d2dac3 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -199,11 +199,11 @@ EXPORT_SYMBOL_GPL(register_timer_hook);
199EXPORT_SYMBOL_GPL(unregister_timer_hook); 199EXPORT_SYMBOL_GPL(unregister_timer_hook);
200EXPORT_SYMBOL_GPL(task_handoff_register); 200EXPORT_SYMBOL_GPL(task_handoff_register);
201EXPORT_SYMBOL_GPL(task_handoff_unregister); 201EXPORT_SYMBOL_GPL(task_handoff_unregister);
202EXPORT_SYMBOL_GPL(profile_event_register);
203EXPORT_SYMBOL_GPL(profile_event_unregister);
202 204
203#endif /* CONFIG_PROFILING */ 205#endif /* CONFIG_PROFILING */
204 206
205EXPORT_SYMBOL_GPL(profile_event_register);
206EXPORT_SYMBOL_GPL(profile_event_unregister);
207 207
208#ifdef CONFIG_SMP 208#ifdef CONFIG_SMP
209/* 209/*
diff --git a/kernel/sched.c b/kernel/sched.c
index b0afd8db1396..6247e4a8350f 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -263,6 +263,7 @@ struct rq {
263 263
264 unsigned int clock_warps, clock_overflows; 264 unsigned int clock_warps, clock_overflows;
265 unsigned int clock_unstable_events; 265 unsigned int clock_unstable_events;
266 u64 tick_timestamp;
266 267
267 atomic_t nr_iowait; 268 atomic_t nr_iowait;
268 269
@@ -341,8 +342,11 @@ static void __update_rq_clock(struct rq *rq)
341 /* 342 /*
342 * Catch too large forward jumps too: 343 * Catch too large forward jumps too:
343 */ 344 */
344 if (unlikely(delta > 2*TICK_NSEC)) { 345 if (unlikely(clock + delta > rq->tick_timestamp + TICK_NSEC)) {
345 clock++; 346 if (clock < rq->tick_timestamp + TICK_NSEC)
347 clock = rq->tick_timestamp + TICK_NSEC;
348 else
349 clock++;
346 rq->clock_overflows++; 350 rq->clock_overflows++;
347 } else { 351 } else {
348 if (unlikely(delta > rq->clock_max_delta)) 352 if (unlikely(delta > rq->clock_max_delta))
@@ -3308,9 +3312,16 @@ void scheduler_tick(void)
3308 int cpu = smp_processor_id(); 3312 int cpu = smp_processor_id();
3309 struct rq *rq = cpu_rq(cpu); 3313 struct rq *rq = cpu_rq(cpu);
3310 struct task_struct *curr = rq->curr; 3314 struct task_struct *curr = rq->curr;
3315 u64 next_tick = rq->tick_timestamp + TICK_NSEC;
3311 3316
3312 spin_lock(&rq->lock); 3317 spin_lock(&rq->lock);
3313 __update_rq_clock(rq); 3318 __update_rq_clock(rq);
3319 /*
3320 * Let rq->clock advance by at least TICK_NSEC:
3321 */
3322 if (unlikely(rq->clock < next_tick))
3323 rq->clock = next_tick;
3324 rq->tick_timestamp = rq->clock;
3314 update_cpu_load(rq); 3325 update_cpu_load(rq);
3315 if (curr != rq->idle) /* FIXME: needed? */ 3326 if (curr != rq->idle) /* FIXME: needed? */
3316 curr->sched_class->task_tick(rq, curr); 3327 curr->sched_class->task_tick(rq, curr);
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 3da32156394e..87e524762b85 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -108,7 +108,7 @@ print_cfs_rq_runtime_sum(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
108 108
109void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) 109void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
110{ 110{
111 SEQ_printf(m, "\ncfs_rq %p\n", cfs_rq); 111 SEQ_printf(m, "\ncfs_rq\n");
112 112
113#define P(x) \ 113#define P(x) \
114 SEQ_printf(m, " .%-30s: %Ld\n", #x, (long long)(cfs_rq->x)) 114 SEQ_printf(m, " .%-30s: %Ld\n", #x, (long long)(cfs_rq->x))
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index e91db32cadfd..c5af38948a1e 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -959,13 +959,12 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
959 for_each_leaf_cfs_rq(busiest, busy_cfs_rq) { 959 for_each_leaf_cfs_rq(busiest, busy_cfs_rq) {
960#ifdef CONFIG_FAIR_GROUP_SCHED 960#ifdef CONFIG_FAIR_GROUP_SCHED
961 struct cfs_rq *this_cfs_rq; 961 struct cfs_rq *this_cfs_rq;
962 long imbalances; 962 long imbalance;
963 unsigned long maxload; 963 unsigned long maxload;
964 964
965 this_cfs_rq = cpu_cfs_rq(busy_cfs_rq, this_cpu); 965 this_cfs_rq = cpu_cfs_rq(busy_cfs_rq, this_cpu);
966 966
967 imbalance = busy_cfs_rq->load.weight - 967 imbalance = busy_cfs_rq->load.weight - this_cfs_rq->load.weight;
968 this_cfs_rq->load.weight;
969 /* Don't pull if this_cfs_rq has more load than busy_cfs_rq */ 968 /* Don't pull if this_cfs_rq has more load than busy_cfs_rq */
970 if (imbalance <= 0) 969 if (imbalance <= 0)
971 continue; 970 continue;
@@ -976,7 +975,7 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
976 975
977 *this_best_prio = cfs_rq_best_prio(this_cfs_rq); 976 *this_best_prio = cfs_rq_best_prio(this_cfs_rq);
978#else 977#else
979#define maxload rem_load_move 978# define maxload rem_load_move
980#endif 979#endif
981 /* pass busy_cfs_rq argument into 980 /* pass busy_cfs_rq argument into
982 * load_balance_[start|next]_fair iterators 981 * load_balance_[start|next]_fair iterators
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 79c891e6266c..8bdb8c07e04f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1023,6 +1023,7 @@ static ctl_table vm_table[] = {
1023 .mode = 0644, 1023 .mode = 0644,
1024 .proc_handler = &proc_doulongvec_minmax, 1024 .proc_handler = &proc_doulongvec_minmax,
1025 }, 1025 },
1026#endif
1026#ifdef CONFIG_NUMA 1027#ifdef CONFIG_NUMA
1027 { 1028 {
1028 .ctl_name = CTL_UNNUMBERED, 1029 .ctl_name = CTL_UNNUMBERED,
@@ -1034,7 +1035,6 @@ static ctl_table vm_table[] = {
1034 .strategy = &sysctl_string, 1035 .strategy = &sysctl_string,
1035 }, 1036 },
1036#endif 1037#endif
1037#endif
1038#if defined(CONFIG_X86_32) || \ 1038#if defined(CONFIG_X86_32) || \
1039 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)) 1039 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1040 { 1040 {
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 2ad1c37b8dfe..41dd3105ce7f 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -113,16 +113,6 @@ int clockevents_register_notifier(struct notifier_block *nb)
113 return ret; 113 return ret;
114} 114}
115 115
116/**
117 * clockevents_unregister_notifier - unregister a clock events change listener
118 */
119void clockevents_unregister_notifier(struct notifier_block *nb)
120{
121 spin_lock(&clockevents_lock);
122 raw_notifier_chain_unregister(&clockevents_chain, nb);
123 spin_unlock(&clockevents_lock);
124}
125
126/* 116/*
127 * Notify about a clock event change. Called with clockevents_lock 117 * Notify about a clock event change. Called with clockevents_lock
128 * held. 118 * held.
diff --git a/lib/hexdump.c b/lib/hexdump.c
index 16f2e2935e87..bd5edaeaa80b 100644
--- a/lib/hexdump.c
+++ b/lib/hexdump.c
@@ -189,7 +189,7 @@ EXPORT_SYMBOL(print_hex_dump);
189 * rowsize of 16, groupsize of 1, and ASCII output included. 189 * rowsize of 16, groupsize of 1, and ASCII output included.
190 */ 190 */
191void print_hex_dump_bytes(const char *prefix_str, int prefix_type, 191void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
192 void *buf, size_t len) 192 const void *buf, size_t len)
193{ 193{
194 print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, 16, 1, 194 print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, 16, 1,
195 buf, len, 1); 195 buf, len, 1);
diff --git a/mm/filemap.c b/mm/filemap.c
index 6cf700d41844..90b657b50f81 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -843,7 +843,7 @@ static void shrink_readahead_size_eio(struct file *filp,
843/** 843/**
844 * do_generic_mapping_read - generic file read routine 844 * do_generic_mapping_read - generic file read routine
845 * @mapping: address_space to be read 845 * @mapping: address_space to be read
846 * @ra: file's readahead state 846 * @_ra: file's readahead state
847 * @filp: the file to read 847 * @filp: the file to read
848 * @ppos: current file position 848 * @ppos: current file position
849 * @desc: read_descriptor 849 * @desc: read_descriptor
@@ -1218,26 +1218,6 @@ out:
1218} 1218}
1219EXPORT_SYMBOL(generic_file_aio_read); 1219EXPORT_SYMBOL(generic_file_aio_read);
1220 1220
1221int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size)
1222{
1223 ssize_t written;
1224 unsigned long count = desc->count;
1225 struct file *file = desc->arg.data;
1226
1227 if (size > count)
1228 size = count;
1229
1230 written = file->f_op->sendpage(file, page, offset,
1231 size, &file->f_pos, size<count);
1232 if (written < 0) {
1233 desc->error = written;
1234 written = 0;
1235 }
1236 desc->count = count - written;
1237 desc->written += written;
1238 return written;
1239}
1240
1241static ssize_t 1221static ssize_t
1242do_readahead(struct address_space *mapping, struct file *filp, 1222do_readahead(struct address_space *mapping, struct file *filp,
1243 unsigned long index, unsigned long nr) 1223 unsigned long index, unsigned long nr)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 73751ab6ec0c..dae7d30dca0f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -9,7 +9,7 @@ use strict;
9my $P = $0; 9my $P = $0;
10$P =~ s@.*/@@g; 10$P =~ s@.*/@@g;
11 11
12my $V = '0.08'; 12my $V = '0.09';
13 13
14use Getopt::Long qw(:config no_auto_abbrev); 14use Getopt::Long qw(:config no_auto_abbrev);
15 15
@@ -311,7 +311,7 @@ sub process {
311 311
312 my $Ident = qr{[A-Za-z\d_]+}; 312 my $Ident = qr{[A-Za-z\d_]+};
313 my $Storage = qr{extern|static}; 313 my $Storage = qr{extern|static};
314 my $Sparse = qr{__user|__kernel|__force|__iomem}; 314 my $Sparse = qr{__user|__kernel|__force|__iomem|__must_check|__init_refok};
315 my $NonptrType = qr{ 315 my $NonptrType = qr{
316 \b 316 \b
317 (?:const\s+)? 317 (?:const\s+)?
@@ -325,6 +325,7 @@ sub process {
325 unsigned| 325 unsigned|
326 float| 326 float|
327 double| 327 double|
328 bool|
328 long\s+int| 329 long\s+int|
329 long\s+long| 330 long\s+long|
330 long\s+long\s+int| 331 long\s+long\s+int|
@@ -340,7 +341,8 @@ sub process {
340 }x; 341 }x;
341 my $Type = qr{ 342 my $Type = qr{
342 \b$NonptrType\b 343 \b$NonptrType\b
343 (?:\s*\*+\s*const|\s*\*+)? 344 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
345 (?:\s+$Sparse)*
344 }x; 346 }x;
345 my $Declare = qr{(?:$Storage\s+)?$Type}; 347 my $Declare = qr{(?:$Storage\s+)?$Type};
346 my $Attribute = qr{const|__read_mostly|__init|__initdata|__meminit}; 348 my $Attribute = qr{const|__read_mostly|__init|__initdata|__meminit};
@@ -494,16 +496,15 @@ sub process {
494 ERROR("use tabs not spaces\n" . $herevet); 496 ERROR("use tabs not spaces\n" . $herevet);
495 } 497 }
496 498
497 #
498 # The rest of our checks refer specifically to C style
499 # only apply those _outside_ comments.
500 #
501 next if ($in_comment);
502
503# Remove comments from the line before processing. 499# Remove comments from the line before processing.
504 $line =~ s@/\*.*\*/@@g; 500 my $comment_edge = ($line =~ s@/\*.*\*/@@g) +
505 $line =~ s@/\*.*@@; 501 ($line =~ s@/\*.*@@) +
506 $line =~ s@.*\*/@@; 502 ($line =~ s@^(.).*\*/@$1@);
503
504# The rest of our checks refer specifically to C style
505# only apply those _outside_ comments. Only skip
506# lines in the middle of comments.
507 next if (!$comment_edge && $in_comment);
507 508
508# Standardise the strings and chars within the input to simplify matching. 509# Standardise the strings and chars within the input to simplify matching.
509 $line = sanitise_line($line); 510 $line = sanitise_line($line);
@@ -599,7 +600,7 @@ sub process {
599 if (($prevline !~ /^}/) && 600 if (($prevline !~ /^}/) &&
600 ($prevline !~ /^\+}/) && 601 ($prevline !~ /^\+}/) &&
601 ($prevline !~ /^ }/) && 602 ($prevline !~ /^ }/) &&
602 ($prevline !~ /\s$name(?:\s+$Attribute)?\s*(?:;|=)/)) { 603 ($prevline !~ /\b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=)/)) {
603 WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr); 604 WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr);
604 } 605 }
605 } 606 }
@@ -680,9 +681,9 @@ sub process {
680 681
681# check for spaces between functions and their parentheses. 682# check for spaces between functions and their parentheses.
682 if ($line =~ /($Ident)\s+\(/ && 683 if ($line =~ /($Ident)\s+\(/ &&
683 $1 !~ /^(?:if|for|while|switch|return|volatile)$/ && 684 $1 !~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright)$/ &&
684 $line !~ /$Type\s+\(/ && $line !~ /^.\#\s*define\b/) { 685 $line !~ /$Type\s+\(/ && $line !~ /^.\#\s*define\b/) {
685 ERROR("no space between function name and open parenthesis '('\n" . $herecurr); 686 WARN("no space between function name and open parenthesis '('\n" . $herecurr);
686 } 687 }
687# Check operator spacing. 688# Check operator spacing.
688 # Note we expand the line with the leading + as the real 689 # Note we expand the line with the leading + as the real
@@ -712,6 +713,7 @@ sub process {
712 $c = 'W' if ($elements[$n + 2] =~ /^\s/); 713 $c = 'W' if ($elements[$n + 2] =~ /^\s/);
713 $c = 'B' if ($elements[$n + 2] =~ /^(\)|\]|;)/); 714 $c = 'B' if ($elements[$n + 2] =~ /^(\)|\]|;)/);
714 $c = 'O' if ($elements[$n + 2] eq ''); 715 $c = 'O' if ($elements[$n + 2] eq '');
716 $c = 'E' if ($elements[$n + 2] =~ /\s*\\$/);
715 } else { 717 } else {
716 $c = 'E'; 718 $c = 'E';
717 } 719 }
@@ -812,7 +814,11 @@ sub process {
812 814
813 # All the others need spaces both sides. 815 # All the others need spaces both sides.
814 } elsif ($ctx !~ /[EW]x[WE]/) { 816 } elsif ($ctx !~ /[EW]x[WE]/) {
815 ERROR("need spaces around that '$op' $at\n" . $hereptr); 817 # Ignore email addresses <foo@bar>
818 if (!($op eq '<' && $cb =~ /$;\S+\@\S+>/) &&
819 !($op eq '>' && $cb =~ /<\S+\@\S+$;/)) {
820 ERROR("need spaces around that '$op' $at\n" . $hereptr);
821 }
816 } 822 }
817 $off += length($elements[$n + 1]); 823 $off += length($elements[$n + 1]);
818 } 824 }
@@ -823,15 +829,24 @@ sub process {
823 WARN("multiple assignments should be avoided\n" . $herecurr); 829 WARN("multiple assignments should be avoided\n" . $herecurr);
824 } 830 }
825 831
826# check for multiple declarations, allowing for a function declaration 832## # check for multiple declarations, allowing for a function declaration
827# continuation. 833## # continuation.
828 if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ && 834## if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
829 $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) { 835## $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
830 WARN("declaring multiple variables together should be avoided\n" . $herecurr); 836##
831 } 837## # Remove any bracketed sections to ensure we do not
838## # falsly report the parameters of functions.
839## my $ln = $line;
840## while ($ln =~ s/\([^\(\)]*\)//g) {
841## }
842## if ($ln =~ /,/) {
843## WARN("declaring multiple variables together should be avoided\n" . $herecurr);
844## }
845## }
832 846
833#need space before brace following if, while, etc 847#need space before brace following if, while, etc
834 if ($line =~ /\(.*\){/ || $line =~ /do{/) { 848 if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
849 $line =~ /do{/) {
835 ERROR("need a space before the open brace '{'\n" . $herecurr); 850 ERROR("need a space before the open brace '{'\n" . $herecurr);
836 } 851 }
837 852
@@ -841,6 +856,22 @@ sub process {
841 ERROR("need a space after that close brace '}'\n" . $herecurr); 856 ERROR("need a space after that close brace '}'\n" . $herecurr);
842 } 857 }
843 858
859# check spacing on square brackets
860 if ($line =~ /\[\s/ && $line !~ /\[\s*$/) {
861 ERROR("no space after that open square bracket '['\n" . $herecurr);
862 }
863 if ($line =~ /\s\]/) {
864 ERROR("no space before that close square bracket ']'\n" . $herecurr);
865 }
866
867# check spacing on paretheses
868 if ($line =~ /\(\s/ && $line !~ /\(\s*$/) {
869 ERROR("no space after that open parenthesis '('\n" . $herecurr);
870 }
871 if ($line =~ /\s\)/) {
872 ERROR("no space before that close parenthesis ')'\n" . $herecurr);
873 }
874
844#goto labels aren't indented, allow a single space however 875#goto labels aren't indented, allow a single space however
845 if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and 876 if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and
846 !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) { 877 !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) {
@@ -910,7 +941,7 @@ sub process {
910 # grabbing the statement after the identifier 941 # grabbing the statement after the identifier
911 $prevline =~ m{^(.#\s*define\s*$Ident(?:\([^\)]*\))?\s*)(.*)\\\s*$}; 942 $prevline =~ m{^(.#\s*define\s*$Ident(?:\([^\)]*\))?\s*)(.*)\\\s*$};
912 ##print "1<$1> 2<$2>\n"; 943 ##print "1<$1> 2<$2>\n";
913 if ($2 ne '') { 944 if (defined $2 && $2 ne '') {
914 $off = length($1); 945 $off = length($1);
915 $ln--; 946 $ln--;
916 $cnt++; 947 $cnt++;
@@ -950,8 +981,10 @@ sub process {
950 my ($lvl, @block) = ctx_block_level($nr, $cnt); 981 my ($lvl, @block) = ctx_block_level($nr, $cnt);
951 982
952 my $stmt = join(' ', @block); 983 my $stmt = join(' ', @block);
953 $stmt =~ s/^[^{]*{//; 984 $stmt =~ s/(^[^{]*){//;
954 $stmt =~ s/}[^}]*$//; 985 my $before = $1;
986 $stmt =~ s/}([^}]*$)//;
987 my $after = $1;
955 988
956 #print "block<" . join(' ', @block) . "><" . scalar(@block) . ">\n"; 989 #print "block<" . join(' ', @block) . "><" . scalar(@block) . ">\n";
957 #print "stmt<$stmt>\n\n"; 990 #print "stmt<$stmt>\n\n";
@@ -963,12 +996,14 @@ sub process {
963 # Also nested if's often require braces to 996 # Also nested if's often require braces to
964 # disambiguate the else binding so shhh there. 997 # disambiguate the else binding so shhh there.
965 my @semi = ($stmt =~ /;/g); 998 my @semi = ($stmt =~ /;/g);
999 push(@semi, "/**/") if ($stmt =~ m@/\*@);
966 ##print "semi<" . scalar(@semi) . ">\n"; 1000 ##print "semi<" . scalar(@semi) . ">\n";
967 if ($lvl == 0 && scalar(@semi) < 2 && 1001 if ($lvl == 0 && scalar(@semi) < 2 &&
968 $stmt !~ /{/ && $stmt !~ /\bif\b/) { 1002 $stmt !~ /{/ && $stmt !~ /\bif\b/ &&
1003 $before !~ /}/ && $after !~ /{/) {
969 my $herectx = "$here\n" . join("\n", @control, @block[1 .. $#block]) . "\n"; 1004 my $herectx = "$here\n" . join("\n", @control, @block[1 .. $#block]) . "\n";
970 shift(@block); 1005 shift(@block);
971 ERROR("braces {} are not necessary for single statement blocks\n" . $herectx); 1006 WARN("braces {} are not necessary for single statement blocks\n" . $herectx);
972 } 1007 }
973 } 1008 }
974 } 1009 }
@@ -1013,6 +1048,11 @@ sub process {
1013# $clean = 0; 1048# $clean = 0;
1014# } 1049# }
1015 1050
1051# warn about spacing in #ifdefs
1052 if ($line =~ /^.#\s*(ifdef|ifndef|elif)\s\s+/) {
1053 ERROR("exactly one space required after that #$1\n" . $herecurr);
1054 }
1055
1016# check for spinlock_t definitions without a comment. 1056# check for spinlock_t definitions without a comment.
1017 if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/) { 1057 if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/) {
1018 my $which = $1; 1058 my $which = $1;
@@ -1027,14 +1067,14 @@ sub process {
1027 } 1067 }
1028 } 1068 }
1029# check of hardware specific defines 1069# check of hardware specific defines
1030 if ($line =~ m@^.#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@) { 1070 if ($line =~ m@^.#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) {
1031 CHK("architecture specific defines should be avoided\n" . $herecurr); 1071 CHK("architecture specific defines should be avoided\n" . $herecurr);
1032 } 1072 }
1033 1073
1034# check the location of the inline attribute, that it is between 1074# check the location of the inline attribute, that it is between
1035# storage class and type. 1075# storage class and type.
1036 if ($line =~ /$Type\s+(?:inline|__always_inline)\b/ || 1076 if ($line =~ /$Type\s+(?:inline|__always_inline|noinline)\b/ ||
1037 $line =~ /\b(?:inline|always_inline)\s+$Storage/) { 1077 $line =~ /\b(?:inline|__always_inline|noinline)\s+$Storage/) {
1038 ERROR("inline keyword should sit between storage class and type\n" . $herecurr); 1078 ERROR("inline keyword should sit between storage class and type\n" . $herecurr);
1039 } 1079 }
1040 1080