diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-09-10 19:09:23 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-09-10 19:09:23 -0400 |
commit | 8f8ffe2485bcaa890800681451d380779cea06af (patch) | |
tree | 1d2ef3a27f1cab9a2b9014f4b75886a96a1ae8db | |
parent | 70069577323e6f72b845166724f34b9858134437 (diff) | |
parent | d28daf923ac5e4a0d7cecebae56f3e339189366b (diff) |
Merge commit 'tracing/core' into tracing/kprobes
Conflicts:
kernel/trace/trace_export.c
kernel/trace/trace_kprobe.c
Merge reason: This topic branch lacks an important
build fix in tracing/core:
0dd7b74787eaf7858c6c573353a83c3e2766e674:
tracing: Fix double CPP substitution in TRACE_EVENT_FN
that prevents from multiple tracepoint headers inclusion crashes.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
614 files changed, 7550 insertions, 4301 deletions
diff --git a/Documentation/filesystems/9p.txt b/Documentation/filesystems/9p.txt index bf8080640eba..6208f55c44c3 100644 --- a/Documentation/filesystems/9p.txt +++ b/Documentation/filesystems/9p.txt | |||
@@ -123,6 +123,9 @@ available from the same CVS repository. | |||
123 | There are user and developer mailing lists available through the v9fs project | 123 | There are user and developer mailing lists available through the v9fs project |
124 | on sourceforge (http://sourceforge.net/projects/v9fs). | 124 | on sourceforge (http://sourceforge.net/projects/v9fs). |
125 | 125 | ||
126 | A stand-alone version of the module (which should build for any 2.6 kernel) | ||
127 | is available via (http://github.com/ericvh/9p-sac/tree/master) | ||
128 | |||
126 | News and other information is maintained on SWiK (http://swik.net/v9fs). | 129 | News and other information is maintained on SWiK (http://swik.net/v9fs). |
127 | 130 | ||
128 | Bug reports may be issued through the kernel.org bugzilla | 131 | Bug reports may be issued through the kernel.org bugzilla |
diff --git a/Documentation/filesystems/afs.txt b/Documentation/filesystems/afs.txt index 12ad6c7f4e50..ffef91c4e0d6 100644 --- a/Documentation/filesystems/afs.txt +++ b/Documentation/filesystems/afs.txt | |||
@@ -23,15 +23,13 @@ it does support include: | |||
23 | 23 | ||
24 | (*) Security (currently only AFS kaserver and KerberosIV tickets). | 24 | (*) Security (currently only AFS kaserver and KerberosIV tickets). |
25 | 25 | ||
26 | (*) File reading. | 26 | (*) File reading and writing. |
27 | 27 | ||
28 | (*) Automounting. | 28 | (*) Automounting. |
29 | 29 | ||
30 | It does not yet support the following AFS features: | 30 | (*) Local caching (via fscache). |
31 | |||
32 | (*) Write support. | ||
33 | 31 | ||
34 | (*) Local caching. | 32 | It does not yet support the following AFS features: |
35 | 33 | ||
36 | (*) pioctl() system call. | 34 | (*) pioctl() system call. |
37 | 35 | ||
@@ -56,7 +54,7 @@ They permit the debugging messages to be turned on dynamically by manipulating | |||
56 | the masks in the following files: | 54 | the masks in the following files: |
57 | 55 | ||
58 | /sys/module/af_rxrpc/parameters/debug | 56 | /sys/module/af_rxrpc/parameters/debug |
59 | /sys/module/afs/parameters/debug | 57 | /sys/module/kafs/parameters/debug |
60 | 58 | ||
61 | 59 | ||
62 | ===== | 60 | ===== |
@@ -66,9 +64,9 @@ USAGE | |||
66 | When inserting the driver modules the root cell must be specified along with a | 64 | When inserting the driver modules the root cell must be specified along with a |
67 | list of volume location server IP addresses: | 65 | list of volume location server IP addresses: |
68 | 66 | ||
69 | insmod af_rxrpc.o | 67 | modprobe af_rxrpc |
70 | insmod rxkad.o | 68 | modprobe rxkad |
71 | insmod kafs.o rootcell=cambridge.redhat.com:172.16.18.73:172.16.18.91 | 69 | modprobe kafs rootcell=cambridge.redhat.com:172.16.18.73:172.16.18.91 |
72 | 70 | ||
73 | The first module is the AF_RXRPC network protocol driver. This provides the | 71 | The first module is the AF_RXRPC network protocol driver. This provides the |
74 | RxRPC remote operation protocol and may also be accessed from userspace. See: | 72 | RxRPC remote operation protocol and may also be accessed from userspace. See: |
@@ -81,7 +79,7 @@ is the actual filesystem driver for the AFS filesystem. | |||
81 | Once the module has been loaded, more modules can be added by the following | 79 | Once the module has been loaded, more modules can be added by the following |
82 | procedure: | 80 | procedure: |
83 | 81 | ||
84 | echo add grand.central.org 18.7.14.88:128.2.191.224 >/proc/fs/afs/cells | 82 | echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 >/proc/fs/afs/cells |
85 | 83 | ||
86 | Where the parameters to the "add" command are the name of a cell and a list of | 84 | Where the parameters to the "add" command are the name of a cell and a list of |
87 | volume location servers within that cell, with the latter separated by colons. | 85 | volume location servers within that cell, with the latter separated by colons. |
@@ -101,7 +99,7 @@ The name of the volume can be suffixes with ".backup" or ".readonly" to | |||
101 | specify connection to only volumes of those types. | 99 | specify connection to only volumes of those types. |
102 | 100 | ||
103 | The name of the cell is optional, and if not given during a mount, then the | 101 | The name of the cell is optional, and if not given during a mount, then the |
104 | named volume will be looked up in the cell specified during insmod. | 102 | named volume will be looked up in the cell specified during modprobe. |
105 | 103 | ||
106 | Additional cells can be added through /proc (see later section). | 104 | Additional cells can be added through /proc (see later section). |
107 | 105 | ||
@@ -163,14 +161,14 @@ THE CELL DATABASE | |||
163 | 161 | ||
164 | The filesystem maintains an internal database of all the cells it knows and the | 162 | The filesystem maintains an internal database of all the cells it knows and the |
165 | IP addresses of the volume location servers for those cells. The cell to which | 163 | IP addresses of the volume location servers for those cells. The cell to which |
166 | the system belongs is added to the database when insmod is performed by the | 164 | the system belongs is added to the database when modprobe is performed by the |
167 | "rootcell=" argument or, if compiled in, using a "kafs.rootcell=" argument on | 165 | "rootcell=" argument or, if compiled in, using a "kafs.rootcell=" argument on |
168 | the kernel command line. | 166 | the kernel command line. |
169 | 167 | ||
170 | Further cells can be added by commands similar to the following: | 168 | Further cells can be added by commands similar to the following: |
171 | 169 | ||
172 | echo add CELLNAME VLADDR[:VLADDR][:VLADDR]... >/proc/fs/afs/cells | 170 | echo add CELLNAME VLADDR[:VLADDR][:VLADDR]... >/proc/fs/afs/cells |
173 | echo add grand.central.org 18.7.14.88:128.2.191.224 >/proc/fs/afs/cells | 171 | echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 >/proc/fs/afs/cells |
174 | 172 | ||
175 | No other cell database operations are available at this time. | 173 | No other cell database operations are available at this time. |
176 | 174 | ||
@@ -233,7 +231,7 @@ insmod /tmp/kafs.o rootcell=cambridge.redhat.com:172.16.18.91 | |||
233 | mount -t afs \%root.afs. /afs | 231 | mount -t afs \%root.afs. /afs |
234 | mount -t afs \%cambridge.redhat.com:root.cell. /afs/cambridge.redhat.com/ | 232 | mount -t afs \%cambridge.redhat.com:root.cell. /afs/cambridge.redhat.com/ |
235 | 233 | ||
236 | echo add grand.central.org 18.7.14.88:128.2.191.224 > /proc/fs/afs/cells | 234 | echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 > /proc/fs/afs/cells |
237 | mount -t afs "#grand.central.org:root.cell." /afs/grand.central.org/ | 235 | mount -t afs "#grand.central.org:root.cell." /afs/grand.central.org/ |
238 | mount -t afs "#grand.central.org:root.archive." /afs/grand.central.org/archive | 236 | mount -t afs "#grand.central.org:root.archive." /afs/grand.central.org/archive |
239 | mount -t afs "#grand.central.org:root.contrib." /afs/grand.central.org/contrib | 237 | mount -t afs "#grand.central.org:root.contrib." /afs/grand.central.org/contrib |
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index fad18f9456e4..ffead13f9443 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -1167,13 +1167,11 @@ CHAPTER 3: PER-PROCESS PARAMETERS | |||
1167 | 3.1 /proc/<pid>/oom_adj - Adjust the oom-killer score | 1167 | 3.1 /proc/<pid>/oom_adj - Adjust the oom-killer score |
1168 | ------------------------------------------------------ | 1168 | ------------------------------------------------------ |
1169 | 1169 | ||
1170 | This file can be used to adjust the score used to select which processes should | 1170 | This file can be used to adjust the score used to select which processes |
1171 | be killed in an out-of-memory situation. The oom_adj value is a characteristic | 1171 | should be killed in an out-of-memory situation. Giving it a high score will |
1172 | of the task's mm, so all threads that share an mm with pid will have the same | 1172 | increase the likelihood of this process being killed by the oom-killer. Valid |
1173 | oom_adj value. A high value will increase the likelihood of this process being | 1173 | values are in the range -16 to +15, plus the special value -17, which disables |
1174 | killed by the oom-killer. Valid values are in the range -16 to +15 as | 1174 | oom-killing altogether for this process. |
1175 | explained below and a special value of -17, which disables oom-killing | ||
1176 | altogether for threads sharing pid's mm. | ||
1177 | 1175 | ||
1178 | The process to be killed in an out-of-memory situation is selected among all others | 1176 | The process to be killed in an out-of-memory situation is selected among all others |
1179 | based on its badness score. This value equals the original memory size of the process | 1177 | based on its badness score. This value equals the original memory size of the process |
@@ -1187,9 +1185,6 @@ the parent's score if they do not share the same memory. Thus forking servers | |||
1187 | are the prime candidates to be killed. Having only one 'hungry' child will make | 1185 | are the prime candidates to be killed. Having only one 'hungry' child will make |
1188 | parent less preferable than the child. | 1186 | parent less preferable than the child. |
1189 | 1187 | ||
1190 | /proc/<pid>/oom_adj cannot be changed for kthreads since they are immune from | ||
1191 | oom-killing already. | ||
1192 | |||
1193 | /proc/<pid>/oom_score shows process' current badness score. | 1188 | /proc/<pid>/oom_score shows process' current badness score. |
1194 | 1189 | ||
1195 | The following heuristics are then applied: | 1190 | The following heuristics are then applied: |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 81cdb7d5e380..8e91863190e8 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1115,6 +1115,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1115 | libata.dma=4 Compact Flash DMA only | 1115 | libata.dma=4 Compact Flash DMA only |
1116 | Combinations also work, so libata.dma=3 enables DMA | 1116 | Combinations also work, so libata.dma=3 enables DMA |
1117 | for disks and CDROMs, but not CFs. | 1117 | for disks and CDROMs, but not CFs. |
1118 | |||
1119 | libata.ignore_hpa= [LIBATA] Ignore HPA limit | ||
1120 | libata.ignore_hpa=0 keep BIOS limits (default) | ||
1121 | libata.ignore_hpa=1 ignore limits, using full disk | ||
1118 | 1122 | ||
1119 | libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume | 1123 | libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume |
1120 | when set. | 1124 | when set. |
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt index a39b3c749de5..355d0f1f8c50 100644 --- a/Documentation/trace/ftrace.txt +++ b/Documentation/trace/ftrace.txt | |||
@@ -85,26 +85,19 @@ of ftrace. Here is a list of some of the key files: | |||
85 | This file holds the output of the trace in a human | 85 | This file holds the output of the trace in a human |
86 | readable format (described below). | 86 | readable format (described below). |
87 | 87 | ||
88 | latency_trace: | ||
89 | |||
90 | This file shows the same trace but the information | ||
91 | is organized more to display possible latencies | ||
92 | in the system (described below). | ||
93 | |||
94 | trace_pipe: | 88 | trace_pipe: |
95 | 89 | ||
96 | The output is the same as the "trace" file but this | 90 | The output is the same as the "trace" file but this |
97 | file is meant to be streamed with live tracing. | 91 | file is meant to be streamed with live tracing. |
98 | Reads from this file will block until new data | 92 | Reads from this file will block until new data is |
99 | is retrieved. Unlike the "trace" and "latency_trace" | 93 | retrieved. Unlike the "trace" file, this file is a |
100 | files, this file is a consumer. This means reading | 94 | consumer. This means reading from this file causes |
101 | from this file causes sequential reads to display | 95 | sequential reads to display more current data. Once |
102 | more current data. Once data is read from this | 96 | data is read from this file, it is consumed, and |
103 | file, it is consumed, and will not be read | 97 | will not be read again with a sequential read. The |
104 | again with a sequential read. The "trace" and | 98 | "trace" file is static, and if the tracer is not |
105 | "latency_trace" files are static, and if the | 99 | adding more data,they will display the same |
106 | tracer is not adding more data, they will display | 100 | information every time they are read. |
107 | the same information every time they are read. | ||
108 | 101 | ||
109 | trace_options: | 102 | trace_options: |
110 | 103 | ||
@@ -117,10 +110,10 @@ of ftrace. Here is a list of some of the key files: | |||
117 | Some of the tracers record the max latency. | 110 | Some of the tracers record the max latency. |
118 | For example, the time interrupts are disabled. | 111 | For example, the time interrupts are disabled. |
119 | This time is saved in this file. The max trace | 112 | This time is saved in this file. The max trace |
120 | will also be stored, and displayed by either | 113 | will also be stored, and displayed by "trace". |
121 | "trace" or "latency_trace". A new max trace will | 114 | A new max trace will only be recorded if the |
122 | only be recorded if the latency is greater than | 115 | latency is greater than the value in this |
123 | the value in this file. (in microseconds) | 116 | file. (in microseconds) |
124 | 117 | ||
125 | buffer_size_kb: | 118 | buffer_size_kb: |
126 | 119 | ||
@@ -210,7 +203,7 @@ Here is the list of current tracers that may be configured. | |||
210 | the trace with the longest max latency. | 203 | the trace with the longest max latency. |
211 | See tracing_max_latency. When a new max is recorded, | 204 | See tracing_max_latency. When a new max is recorded, |
212 | it replaces the old trace. It is best to view this | 205 | it replaces the old trace. It is best to view this |
213 | trace via the latency_trace file. | 206 | trace with the latency-format option enabled. |
214 | 207 | ||
215 | "preemptoff" | 208 | "preemptoff" |
216 | 209 | ||
@@ -307,8 +300,8 @@ the lowest priority thread (pid 0). | |||
307 | Latency trace format | 300 | Latency trace format |
308 | -------------------- | 301 | -------------------- |
309 | 302 | ||
310 | For traces that display latency times, the latency_trace file | 303 | When the latency-format option is enabled, the trace file gives |
311 | gives somewhat more information to see why a latency happened. | 304 | somewhat more information to see why a latency happened. |
312 | Here is a typical trace. | 305 | Here is a typical trace. |
313 | 306 | ||
314 | # tracer: irqsoff | 307 | # tracer: irqsoff |
@@ -380,9 +373,10 @@ explains which is which. | |||
380 | 373 | ||
381 | The above is mostly meaningful for kernel developers. | 374 | The above is mostly meaningful for kernel developers. |
382 | 375 | ||
383 | time: This differs from the trace file output. The trace file output | 376 | time: When the latency-format option is enabled, the trace file |
384 | includes an absolute timestamp. The timestamp used by the | 377 | output includes a timestamp relative to the start of the |
385 | latency_trace file is relative to the start of the trace. | 378 | trace. This differs from the output when latency-format |
379 | is disabled, which includes an absolute timestamp. | ||
386 | 380 | ||
387 | delay: This is just to help catch your eye a bit better. And | 381 | delay: This is just to help catch your eye a bit better. And |
388 | needs to be fixed to be only relative to the same CPU. | 382 | needs to be fixed to be only relative to the same CPU. |
@@ -440,7 +434,8 @@ Here are the available options: | |||
440 | sym-addr: | 434 | sym-addr: |
441 | bash-4000 [01] 1477.606694: simple_strtoul <c0339346> | 435 | bash-4000 [01] 1477.606694: simple_strtoul <c0339346> |
442 | 436 | ||
443 | verbose - This deals with the latency_trace file. | 437 | verbose - This deals with the trace file when the |
438 | latency-format option is enabled. | ||
444 | 439 | ||
445 | bash 4000 1 0 00000000 00010a95 [58127d26] 1720.415ms \ | 440 | bash 4000 1 0 00000000 00010a95 [58127d26] 1720.415ms \ |
446 | (+0.000ms): simple_strtoul (strict_strtoul) | 441 | (+0.000ms): simple_strtoul (strict_strtoul) |
@@ -472,7 +467,7 @@ Here are the available options: | |||
472 | the app is no longer running | 467 | the app is no longer running |
473 | 468 | ||
474 | The lookup is performed when you read | 469 | The lookup is performed when you read |
475 | trace,trace_pipe,latency_trace. Example: | 470 | trace,trace_pipe. Example: |
476 | 471 | ||
477 | a.out-1623 [000] 40874.465068: /root/a.out[+0x480] <-/root/a.out[+0 | 472 | a.out-1623 [000] 40874.465068: /root/a.out[+0x480] <-/root/a.out[+0 |
478 | x494] <- /root/a.out[+0x4a8] <- /lib/libc-2.7.so[+0x1e1a6] | 473 | x494] <- /root/a.out[+0x4a8] <- /lib/libc-2.7.so[+0x1e1a6] |
@@ -481,6 +476,11 @@ x494] <- /root/a.out[+0x4a8] <- /lib/libc-2.7.so[+0x1e1a6] | |||
481 | every scheduling event. Will add overhead if | 476 | every scheduling event. Will add overhead if |
482 | there's a lot of tasks running at once. | 477 | there's a lot of tasks running at once. |
483 | 478 | ||
479 | latency-format - This option changes the trace. When | ||
480 | it is enabled, the trace displays | ||
481 | additional information about the | ||
482 | latencies, as described in "Latency | ||
483 | trace format". | ||
484 | 484 | ||
485 | sched_switch | 485 | sched_switch |
486 | ------------ | 486 | ------------ |
@@ -596,12 +596,13 @@ To reset the maximum, echo 0 into tracing_max_latency. Here is | |||
596 | an example: | 596 | an example: |
597 | 597 | ||
598 | # echo irqsoff > current_tracer | 598 | # echo irqsoff > current_tracer |
599 | # echo latency-format > trace_options | ||
599 | # echo 0 > tracing_max_latency | 600 | # echo 0 > tracing_max_latency |
600 | # echo 1 > tracing_enabled | 601 | # echo 1 > tracing_enabled |
601 | # ls -ltr | 602 | # ls -ltr |
602 | [...] | 603 | [...] |
603 | # echo 0 > tracing_enabled | 604 | # echo 0 > tracing_enabled |
604 | # cat latency_trace | 605 | # cat trace |
605 | # tracer: irqsoff | 606 | # tracer: irqsoff |
606 | # | 607 | # |
607 | irqsoff latency trace v1.1.5 on 2.6.26 | 608 | irqsoff latency trace v1.1.5 on 2.6.26 |
@@ -703,12 +704,13 @@ which preemption was disabled. The control of preemptoff tracer | |||
703 | is much like the irqsoff tracer. | 704 | is much like the irqsoff tracer. |
704 | 705 | ||
705 | # echo preemptoff > current_tracer | 706 | # echo preemptoff > current_tracer |
707 | # echo latency-format > trace_options | ||
706 | # echo 0 > tracing_max_latency | 708 | # echo 0 > tracing_max_latency |
707 | # echo 1 > tracing_enabled | 709 | # echo 1 > tracing_enabled |
708 | # ls -ltr | 710 | # ls -ltr |
709 | [...] | 711 | [...] |
710 | # echo 0 > tracing_enabled | 712 | # echo 0 > tracing_enabled |
711 | # cat latency_trace | 713 | # cat trace |
712 | # tracer: preemptoff | 714 | # tracer: preemptoff |
713 | # | 715 | # |
714 | preemptoff latency trace v1.1.5 on 2.6.26-rc8 | 716 | preemptoff latency trace v1.1.5 on 2.6.26-rc8 |
@@ -850,12 +852,13 @@ Again, using this trace is much like the irqsoff and preemptoff | |||
850 | tracers. | 852 | tracers. |
851 | 853 | ||
852 | # echo preemptirqsoff > current_tracer | 854 | # echo preemptirqsoff > current_tracer |
855 | # echo latency-format > trace_options | ||
853 | # echo 0 > tracing_max_latency | 856 | # echo 0 > tracing_max_latency |
854 | # echo 1 > tracing_enabled | 857 | # echo 1 > tracing_enabled |
855 | # ls -ltr | 858 | # ls -ltr |
856 | [...] | 859 | [...] |
857 | # echo 0 > tracing_enabled | 860 | # echo 0 > tracing_enabled |
858 | # cat latency_trace | 861 | # cat trace |
859 | # tracer: preemptirqsoff | 862 | # tracer: preemptirqsoff |
860 | # | 863 | # |
861 | preemptirqsoff latency trace v1.1.5 on 2.6.26-rc8 | 864 | preemptirqsoff latency trace v1.1.5 on 2.6.26-rc8 |
@@ -1012,11 +1015,12 @@ Instead of performing an 'ls', we will run 'sleep 1' under | |||
1012 | 'chrt' which changes the priority of the task. | 1015 | 'chrt' which changes the priority of the task. |
1013 | 1016 | ||
1014 | # echo wakeup > current_tracer | 1017 | # echo wakeup > current_tracer |
1018 | # echo latency-format > trace_options | ||
1015 | # echo 0 > tracing_max_latency | 1019 | # echo 0 > tracing_max_latency |
1016 | # echo 1 > tracing_enabled | 1020 | # echo 1 > tracing_enabled |
1017 | # chrt -f 5 sleep 1 | 1021 | # chrt -f 5 sleep 1 |
1018 | # echo 0 > tracing_enabled | 1022 | # echo 0 > tracing_enabled |
1019 | # cat latency_trace | 1023 | # cat trace |
1020 | # tracer: wakeup | 1024 | # tracer: wakeup |
1021 | # | 1025 | # |
1022 | wakeup latency trace v1.1.5 on 2.6.26-rc8 | 1026 | wakeup latency trace v1.1.5 on 2.6.26-rc8 |
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index 68c236c01846..e352d754875c 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx | |||
@@ -1,5 +1,5 @@ | |||
1 | 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] | 1 | 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] |
2 | 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883] | 2 | 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2710,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883] |
3 | 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] | 3 | 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] |
4 | 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] | 4 | 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] |
5 | 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201] | 5 | 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201] |
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 15562427e8a9..c913e5614195 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 | |||
@@ -153,8 +153,8 @@ | |||
153 | 152 -> Asus Tiger Rev:1.00 [1043:4857] | 153 | 152 -> Asus Tiger Rev:1.00 [1043:4857] |
154 | 153 -> Kworld Plus TV Analog Lite PCI [17de:7128] | 154 | 153 -> Kworld Plus TV Analog Lite PCI [17de:7128] |
155 | 154 -> Avermedia AVerTV GO 007 FM Plus [1461:f31d] | 155 | 154 -> Avermedia AVerTV GO 007 FM Plus [1461:f31d] |
156 | 155 -> Hauppauge WinTV-HVR1120 ATSC/QAM-Hybrid [0070:6706,0070:6708] | 156 | 155 -> Hauppauge WinTV-HVR1150 ATSC/QAM-Hybrid [0070:6706,0070:6708] |
157 | 156 -> Hauppauge WinTV-HVR1110r3 DVB-T/Hybrid [0070:6707,0070:6709,0070:670a] | 157 | 156 -> Hauppauge WinTV-HVR1120 DVB-T/Hybrid [0070:6707,0070:6709,0070:670a] |
158 | 157 -> Avermedia AVerTV Studio 507UA [1461:a11b] | 158 | 157 -> Avermedia AVerTV Studio 507UA [1461:a11b] |
159 | 158 -> AVerMedia Cardbus TV/Radio (E501R) [1461:b7e9] | 159 | 158 -> AVerMedia Cardbus TV/Radio (E501R) [1461:b7e9] |
160 | 159 -> Beholder BeholdTV 505 RDS [0000:505B] | 160 | 159 -> Beholder BeholdTV 505 RDS [0000:505B] |
diff --git a/MAINTAINERS b/MAINTAINERS index b1114cfac6bf..8dca9d89c6c1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -904,7 +904,7 @@ F: drivers/input/misc/ati_remote2.c | |||
904 | 904 | ||
905 | ATLX ETHERNET DRIVERS | 905 | ATLX ETHERNET DRIVERS |
906 | M: Jay Cliburn <jcliburn@gmail.com> | 906 | M: Jay Cliburn <jcliburn@gmail.com> |
907 | M: Chris Snook <csnook@redhat.com> | 907 | M: Chris Snook <chris.snook@gmail.com> |
908 | M: Jie Yang <jie.yang@atheros.com> | 908 | M: Jie Yang <jie.yang@atheros.com> |
909 | L: atl1-devel@lists.sourceforge.net | 909 | L: atl1-devel@lists.sourceforge.net |
910 | W: http://sourceforge.net/projects/atl1 | 910 | W: http://sourceforge.net/projects/atl1 |
@@ -2238,6 +2238,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | |||
2238 | S: Maintained | 2238 | S: Maintained |
2239 | F: drivers/media/video/gspca/pac207.c | 2239 | F: drivers/media/video/gspca/pac207.c |
2240 | 2240 | ||
2241 | GSPCA SN9C20X SUBDRIVER | ||
2242 | M: Brian Johnson <brijohn@gmail.com> | ||
2243 | L: linux-media@vger.kernel.org | ||
2244 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | ||
2245 | S: Maintained | ||
2246 | F: drivers/media/video/gspca/sn9c20x.c | ||
2247 | |||
2241 | GSPCA T613 SUBDRIVER | 2248 | GSPCA T613 SUBDRIVER |
2242 | M: Leandro Costantino <lcostantino@gmail.com> | 2249 | M: Leandro Costantino <lcostantino@gmail.com> |
2243 | L: linux-media@vger.kernel.org | 2250 | L: linux-media@vger.kernel.org |
@@ -3421,6 +3428,7 @@ F: drivers/mfd/ | |||
3421 | 3428 | ||
3422 | MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM | 3429 | MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM |
3423 | S: Orphan | 3430 | S: Orphan |
3431 | L: linux-mmc@vger.kernel.org | ||
3424 | F: drivers/mmc/ | 3432 | F: drivers/mmc/ |
3425 | F: include/linux/mmc/ | 3433 | F: include/linux/mmc/ |
3426 | 3434 | ||
@@ -3555,6 +3563,9 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git | |||
3555 | S: Maintained | 3563 | S: Maintained |
3556 | F: net/ | 3564 | F: net/ |
3557 | F: include/net/ | 3565 | F: include/net/ |
3566 | F: include/linux/in.h | ||
3567 | F: include/linux/net.h | ||
3568 | F: include/linux/netdevice.h | ||
3558 | 3569 | ||
3559 | NETWORKING [IPv4/IPv6] | 3570 | NETWORKING [IPv4/IPv6] |
3560 | M: "David S. Miller" <davem@davemloft.net> | 3571 | M: "David S. Miller" <davem@davemloft.net> |
@@ -3590,6 +3601,8 @@ W: http://www.linuxfoundation.org/en/Net | |||
3590 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git | 3601 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git |
3591 | S: Odd Fixes | 3602 | S: Odd Fixes |
3592 | F: drivers/net/ | 3603 | F: drivers/net/ |
3604 | F: include/linux/if_* | ||
3605 | F: include/linux/*device.h | ||
3593 | 3606 | ||
3594 | NETXEN (1/10) GbE SUPPORT | 3607 | NETXEN (1/10) GbE SUPPORT |
3595 | M: Dhananjay Phadke <dhananjay@netxen.com> | 3608 | M: Dhananjay Phadke <dhananjay@netxen.com> |
@@ -3796,7 +3809,7 @@ W: http://open-osd.org | |||
3796 | T: git git://git.open-osd.org/open-osd.git | 3809 | T: git git://git.open-osd.org/open-osd.git |
3797 | S: Maintained | 3810 | S: Maintained |
3798 | F: drivers/scsi/osd/ | 3811 | F: drivers/scsi/osd/ |
3799 | F: drivers/include/scsi/osd_* | 3812 | F: include/scsi/osd_* |
3800 | F: fs/exofs/ | 3813 | F: fs/exofs/ |
3801 | 3814 | ||
3802 | P54 WIRELESS DRIVER | 3815 | P54 WIRELESS DRIVER |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 31 | 3 | SUBLEVEL = 31 |
4 | EXTRAVERSION = -rc5 | 4 | EXTRAVERSION = -rc9 |
5 | NAME = Man-Eating Seals of Antiquity | 5 | NAME = Man-Eating Seals of Antiquity |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/REPORTING-BUGS b/REPORTING-BUGS index ab0c56630a8c..55a6074ccbb7 100644 --- a/REPORTING-BUGS +++ b/REPORTING-BUGS | |||
@@ -15,7 +15,10 @@ worry too much about getting the wrong person. If you are unsure send it | |||
15 | to the person responsible for the code relevant to what you were doing. | 15 | to the person responsible for the code relevant to what you were doing. |
16 | If it occurs repeatably try and describe how to recreate it. That is | 16 | If it occurs repeatably try and describe how to recreate it. That is |
17 | worth even more than the oops itself. The list of maintainers and | 17 | worth even more than the oops itself. The list of maintainers and |
18 | mailing lists is in the MAINTAINERS file in this directory. | 18 | mailing lists is in the MAINTAINERS file in this directory. If you |
19 | know the file name that causes the problem you can use the following | ||
20 | command in this directory to find some of the maintainers of that file: | ||
21 | perl scripts/get_maintainer.pl -f <filename> | ||
19 | 22 | ||
20 | If it is a security bug, please copy the Security Contact listed | 23 | If it is a security bug, please copy the Security Contact listed |
21 | in the MAINTAINERS file. They can help coordinate bugfix and disclosure. | 24 | in the MAINTAINERS file. They can help coordinate bugfix and disclosure. |
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig index 0a1abb978d7e..af74cc2de8b6 100644 --- a/arch/arm/configs/kirkwood_defconfig +++ b/arch/arm/configs/kirkwood_defconfig | |||
@@ -629,7 +629,7 @@ CONFIG_SCSI_LOWLEVEL=y | |||
629 | CONFIG_ATA=y | 629 | CONFIG_ATA=y |
630 | # CONFIG_ATA_NONSTANDARD is not set | 630 | # CONFIG_ATA_NONSTANDARD is not set |
631 | CONFIG_SATA_PMP=y | 631 | CONFIG_SATA_PMP=y |
632 | # CONFIG_SATA_AHCI is not set | 632 | CONFIG_SATA_AHCI=y |
633 | # CONFIG_SATA_SIL24 is not set | 633 | # CONFIG_SATA_SIL24 is not set |
634 | CONFIG_ATA_SFF=y | 634 | CONFIG_ATA_SFF=y |
635 | # CONFIG_SATA_SVW is not set | 635 | # CONFIG_SATA_SVW is not set |
diff --git a/arch/arm/configs/rx51_defconfig b/arch/arm/configs/rx51_defconfig index eb2cb31825c0..f238df66efd4 100644 --- a/arch/arm/configs/rx51_defconfig +++ b/arch/arm/configs/rx51_defconfig | |||
@@ -282,7 +282,7 @@ CONFIG_ALIGNMENT_TRAP=y | |||
282 | # | 282 | # |
283 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 283 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
284 | CONFIG_ZBOOT_ROM_BSS=0x0 | 284 | CONFIG_ZBOOT_ROM_BSS=0x0 |
285 | CONFIG_CMDLINE="init=/sbin/preinit ubi.mtd=rootfs root=ubi0:rootfs rootfstype=ubifs rootflags=bulk_read,no_chk_data_crc rw console=ttyMTD,log console=tty0" | 285 | CONFIG_CMDLINE="init=/sbin/preinit ubi.mtd=rootfs root=ubi0:rootfs rootfstype=ubifs rootflags=bulk_read,no_chk_data_crc rw console=ttyMTD,log console=tty0 console=ttyS2,115200n8" |
286 | # CONFIG_XIP_KERNEL is not set | 286 | # CONFIG_XIP_KERNEL is not set |
287 | # CONFIG_KEXEC is not set | 287 | # CONFIG_KEXEC is not set |
288 | 288 | ||
@@ -1354,7 +1354,7 @@ CONFIG_USB_OTG_UTILS=y | |||
1354 | # CONFIG_USB_GPIO_VBUS is not set | 1354 | # CONFIG_USB_GPIO_VBUS is not set |
1355 | # CONFIG_ISP1301_OMAP is not set | 1355 | # CONFIG_ISP1301_OMAP is not set |
1356 | CONFIG_TWL4030_USB=y | 1356 | CONFIG_TWL4030_USB=y |
1357 | CONFIG_MMC=m | 1357 | CONFIG_MMC=y |
1358 | # CONFIG_MMC_DEBUG is not set | 1358 | # CONFIG_MMC_DEBUG is not set |
1359 | # CONFIG_MMC_UNSAFE_RESUME is not set | 1359 | # CONFIG_MMC_UNSAFE_RESUME is not set |
1360 | 1360 | ||
@@ -1449,7 +1449,8 @@ CONFIG_RTC_DRV_TWL4030=m | |||
1449 | # on-CPU RTC drivers | 1449 | # on-CPU RTC drivers |
1450 | # | 1450 | # |
1451 | # CONFIG_DMADEVICES is not set | 1451 | # CONFIG_DMADEVICES is not set |
1452 | # CONFIG_REGULATOR is not set | 1452 | CONFIG_REGULATOR=y |
1453 | CONFIG_REGULATOR_TWL4030=y | ||
1453 | # CONFIG_UIO is not set | 1454 | # CONFIG_UIO is not set |
1454 | # CONFIG_STAGING is not set | 1455 | # CONFIG_STAGING is not set |
1455 | 1456 | ||
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index ee1304f22f94..5ccce0a9b03c 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h | |||
@@ -201,7 +201,8 @@ static struct tagtable __tagtable_##fn __tag = { tag, fn } | |||
201 | struct membank { | 201 | struct membank { |
202 | unsigned long start; | 202 | unsigned long start; |
203 | unsigned long size; | 203 | unsigned long size; |
204 | int node; | 204 | unsigned short node; |
205 | unsigned short highmem; | ||
205 | }; | 206 | }; |
206 | 207 | ||
207 | struct meminfo { | 208 | struct meminfo { |
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h index ce63048d45eb..8a947d42a6f1 100644 --- a/arch/arm/mach-ixp4xx/include/mach/io.h +++ b/arch/arm/mach-ixp4xx/include/mach/io.h | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | #include <mach/hardware.h> | 18 | #include <mach/hardware.h> |
19 | 19 | ||
20 | #define IO_SPACE_LIMIT 0xffff0000 | 20 | #define IO_SPACE_LIMIT 0x0000ffff |
21 | 21 | ||
22 | extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data); | 22 | extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data); |
23 | extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data); | 23 | extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data); |
diff --git a/arch/arm/mach-kirkwood/ts219-setup.c b/arch/arm/mach-kirkwood/ts219-setup.c index 01aa213c0a6f..ec1a64f263d2 100644 --- a/arch/arm/mach-kirkwood/ts219-setup.c +++ b/arch/arm/mach-kirkwood/ts219-setup.c | |||
@@ -206,6 +206,15 @@ static void __init qnap_ts219_init(void) | |||
206 | 206 | ||
207 | } | 207 | } |
208 | 208 | ||
209 | static int __init ts219_pci_init(void) | ||
210 | { | ||
211 | if (machine_is_ts219()) | ||
212 | kirkwood_pcie_init(); | ||
213 | |||
214 | return 0; | ||
215 | } | ||
216 | subsys_initcall(ts219_pci_init); | ||
217 | |||
209 | MACHINE_START(TS219, "QNAP TS-119/TS-219") | 218 | MACHINE_START(TS219, "QNAP TS-119/TS-219") |
210 | /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */ | 219 | /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */ |
211 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, | 220 | .phys_io = KIRKWOOD_REGS_PHYS_BASE, |
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c index 4704405165a1..b48581e7dedd 100644 --- a/arch/arm/mach-mx3/mx31moboard-devboard.c +++ b/arch/arm/mach-mx3/mx31moboard-devboard.c | |||
@@ -63,7 +63,7 @@ static struct imxuart_platform_data uart_pdata = { | |||
63 | 63 | ||
64 | static int devboard_sdhc2_get_ro(struct device *dev) | 64 | static int devboard_sdhc2_get_ro(struct device *dev) |
65 | { | 65 | { |
66 | return gpio_get_value(SDHC2_WP); | 66 | return !gpio_get_value(SDHC2_WP); |
67 | } | 67 | } |
68 | 68 | ||
69 | static int devboard_sdhc2_init(struct device *dev, irq_handler_t detect_irq, | 69 | static int devboard_sdhc2_init(struct device *dev, irq_handler_t detect_irq, |
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c index 641c3d6153ae..901fb0166c0e 100644 --- a/arch/arm/mach-mx3/mx31moboard-marxbot.c +++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c | |||
@@ -67,7 +67,7 @@ static unsigned int marxbot_pins[] = { | |||
67 | 67 | ||
68 | static int marxbot_sdhc2_get_ro(struct device *dev) | 68 | static int marxbot_sdhc2_get_ro(struct device *dev) |
69 | { | 69 | { |
70 | return gpio_get_value(SDHC2_WP); | 70 | return !gpio_get_value(SDHC2_WP); |
71 | } | 71 | } |
72 | 72 | ||
73 | static int marxbot_sdhc2_init(struct device *dev, irq_handler_t detect_irq, | 73 | static int marxbot_sdhc2_init(struct device *dev, irq_handler_t detect_irq, |
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c index a17f2e411609..2a2da4739ecf 100644 --- a/arch/arm/mach-mx3/mx31moboard.c +++ b/arch/arm/mach-mx3/mx31moboard.c | |||
@@ -94,7 +94,7 @@ static struct imxi2c_platform_data moboard_i2c1_pdata = { | |||
94 | 94 | ||
95 | static int moboard_sdhc1_get_ro(struct device *dev) | 95 | static int moboard_sdhc1_get_ro(struct device *dev) |
96 | { | 96 | { |
97 | return gpio_get_value(SDHC1_WP); | 97 | return !gpio_get_value(SDHC1_WP); |
98 | } | 98 | } |
99 | 99 | ||
100 | static int moboard_sdhc1_init(struct device *dev, irq_handler_t detect_irq, | 100 | static int moboard_sdhc1_init(struct device *dev, irq_handler_t detect_irq, |
diff --git a/arch/arm/mach-mx3/pcm037_eet.c b/arch/arm/mach-mx3/pcm037_eet.c index fe52fb1bb8b7..8d386000fc40 100644 --- a/arch/arm/mach-mx3/pcm037_eet.c +++ b/arch/arm/mach-mx3/pcm037_eet.c | |||
@@ -24,15 +24,6 @@ | |||
24 | #include "devices.h" | 24 | #include "devices.h" |
25 | 25 | ||
26 | static unsigned int pcm037_eet_pins[] = { | 26 | static unsigned int pcm037_eet_pins[] = { |
27 | /* SPI #1 */ | ||
28 | MX31_PIN_CSPI1_MISO__MISO, | ||
29 | MX31_PIN_CSPI1_MOSI__MOSI, | ||
30 | MX31_PIN_CSPI1_SCLK__SCLK, | ||
31 | MX31_PIN_CSPI1_SPI_RDY__SPI_RDY, | ||
32 | MX31_PIN_CSPI1_SS0__SS0, | ||
33 | MX31_PIN_CSPI1_SS1__SS1, | ||
34 | MX31_PIN_CSPI1_SS2__SS2, | ||
35 | |||
36 | /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */ | 27 | /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */ |
37 | IOMUX_MODE(MX31_PIN_KEY_COL7, IOMUX_CONFIG_GPIO), | 28 | IOMUX_MODE(MX31_PIN_KEY_COL7, IOMUX_CONFIG_GPIO), |
38 | /* GPIO keys */ | 29 | /* GPIO keys */ |
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 9c3fdcdf76c3..8ec2a132904d 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c | |||
@@ -141,7 +141,7 @@ static inline void board_smc91x_init(void) | |||
141 | 141 | ||
142 | static void __init omap_2430sdp_init_irq(void) | 142 | static void __init omap_2430sdp_init_irq(void) |
143 | { | 143 | { |
144 | omap2_init_common_hw(NULL); | 144 | omap2_init_common_hw(NULL, NULL); |
145 | omap_init_irq(); | 145 | omap_init_irq(); |
146 | omap_gpio_init(); | 146 | omap_gpio_init(); |
147 | } | 147 | } |
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 496a90e4ea7a..ac262cd74503 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -169,7 +169,7 @@ static struct platform_device *sdp3430_devices[] __initdata = { | |||
169 | 169 | ||
170 | static void __init omap_3430sdp_init_irq(void) | 170 | static void __init omap_3430sdp_init_irq(void) |
171 | { | 171 | { |
172 | omap2_init_common_hw(hyb18m512160af6_sdrc_params); | 172 | omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL); |
173 | omap_init_irq(); | 173 | omap_init_irq(); |
174 | omap_gpio_init(); | 174 | omap_gpio_init(); |
175 | } | 175 | } |
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 57e477bd89c6..b0c7402248f7 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
@@ -59,7 +59,7 @@ static void __init gic_init_irq(void) | |||
59 | 59 | ||
60 | static void __init omap_4430sdp_init_irq(void) | 60 | static void __init omap_4430sdp_init_irq(void) |
61 | { | 61 | { |
62 | omap2_init_common_hw(NULL); | 62 | omap2_init_common_hw(NULL, NULL); |
63 | #ifdef CONFIG_OMAP_32K_TIMER | 63 | #ifdef CONFIG_OMAP_32K_TIMER |
64 | omap2_gp_clockevent_set_gptimer(1); | 64 | omap2_gp_clockevent_set_gptimer(1); |
65 | #endif | 65 | #endif |
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c index 06dfba888b0c..dcfc20d03894 100644 --- a/arch/arm/mach-omap2/board-apollon.c +++ b/arch/arm/mach-omap2/board-apollon.c | |||
@@ -250,7 +250,7 @@ out: | |||
250 | 250 | ||
251 | static void __init omap_apollon_init_irq(void) | 251 | static void __init omap_apollon_init_irq(void) |
252 | { | 252 | { |
253 | omap2_init_common_hw(NULL); | 253 | omap2_init_common_hw(NULL, NULL); |
254 | omap_init_irq(); | 254 | omap_init_irq(); |
255 | omap_gpio_init(); | 255 | omap_gpio_init(); |
256 | apollon_init_smc91x(); | 256 | apollon_init_smc91x(); |
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 3492162a65c3..fd00aa03690c 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | static void __init omap_generic_init_irq(void) | 34 | static void __init omap_generic_init_irq(void) |
35 | { | 35 | { |
36 | omap2_init_common_hw(NULL); | 36 | omap2_init_common_hw(NULL, NULL); |
37 | omap_init_irq(); | 37 | omap_init_irq(); |
38 | } | 38 | } |
39 | 39 | ||
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index e7d017cdc438..7b1d61d5bb2c 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
@@ -270,7 +270,7 @@ static void __init h4_init_flash(void) | |||
270 | 270 | ||
271 | static void __init omap_h4_init_irq(void) | 271 | static void __init omap_h4_init_irq(void) |
272 | { | 272 | { |
273 | omap2_init_common_hw(NULL); | 273 | omap2_init_common_hw(NULL, NULL); |
274 | omap_init_irq(); | 274 | omap_init_irq(); |
275 | omap_gpio_init(); | 275 | omap_gpio_init(); |
276 | h4_init_flash(); | 276 | h4_init_flash(); |
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index d8bc0a7dcb8d..ea383f88cb1b 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c | |||
@@ -270,7 +270,7 @@ static inline void __init ldp_init_smsc911x(void) | |||
270 | 270 | ||
271 | static void __init omap_ldp_init_irq(void) | 271 | static void __init omap_ldp_init_irq(void) |
272 | { | 272 | { |
273 | omap2_init_common_hw(NULL); | 273 | omap2_init_common_hw(NULL, NULL); |
274 | omap_init_irq(); | 274 | omap_init_irq(); |
275 | omap_gpio_init(); | 275 | omap_gpio_init(); |
276 | ldp_init_smsc911x(); | 276 | ldp_init_smsc911x(); |
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 991ac9c38032..e00ba128cece 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -282,7 +282,8 @@ static int __init omap3_beagle_i2c_init(void) | |||
282 | 282 | ||
283 | static void __init omap3_beagle_init_irq(void) | 283 | static void __init omap3_beagle_init_irq(void) |
284 | { | 284 | { |
285 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params); | 285 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, |
286 | mt46h32m32lf6_sdrc_params); | ||
286 | omap_init_irq(); | 287 | omap_init_irq(); |
287 | #ifdef CONFIG_OMAP_32K_TIMER | 288 | #ifdef CONFIG_OMAP_32K_TIMER |
288 | omap2_gp_clockevent_set_gptimer(12); | 289 | omap2_gp_clockevent_set_gptimer(12); |
@@ -408,6 +409,10 @@ static void __init omap3_beagle_init(void) | |||
408 | 409 | ||
409 | usb_musb_init(); | 410 | usb_musb_init(); |
410 | omap3beagle_flash_init(); | 411 | omap3beagle_flash_init(); |
412 | |||
413 | /* Ensure SDRC pins are mux'd for self-refresh */ | ||
414 | omap_cfg_reg(H16_34XX_SDRC_CKE0); | ||
415 | omap_cfg_reg(H17_34XX_SDRC_CKE1); | ||
411 | } | 416 | } |
412 | 417 | ||
413 | static void __init omap3_beagle_map_io(void) | 418 | static void __init omap3_beagle_map_io(void) |
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index cf3dd771a678..c4b144647dc5 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c | |||
@@ -280,7 +280,7 @@ struct spi_board_info omap3evm_spi_board_info[] = { | |||
280 | 280 | ||
281 | static void __init omap3_evm_init_irq(void) | 281 | static void __init omap3_evm_init_irq(void) |
282 | { | 282 | { |
283 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params); | 283 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL); |
284 | omap_init_irq(); | 284 | omap_init_irq(); |
285 | omap_gpio_init(); | 285 | omap_gpio_init(); |
286 | omap3evm_init_smc911x(); | 286 | omap3evm_init_smc911x(); |
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c index e32aa23ce962..864ee3d021f7 100644 --- a/arch/arm/mach-omap2/board-omap3pandora.c +++ b/arch/arm/mach-omap2/board-omap3pandora.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <mach/mcspi.h> | 40 | #include <mach/mcspi.h> |
41 | #include <mach/usb.h> | 41 | #include <mach/usb.h> |
42 | #include <mach/keypad.h> | 42 | #include <mach/keypad.h> |
43 | #include <mach/mux.h> | ||
43 | 44 | ||
44 | #include "sdram-micron-mt46h32m32lf-6.h" | 45 | #include "sdram-micron-mt46h32m32lf-6.h" |
45 | #include "mmc-twl4030.h" | 46 | #include "mmc-twl4030.h" |
@@ -310,7 +311,8 @@ static int __init omap3pandora_i2c_init(void) | |||
310 | 311 | ||
311 | static void __init omap3pandora_init_irq(void) | 312 | static void __init omap3pandora_init_irq(void) |
312 | { | 313 | { |
313 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params); | 314 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, |
315 | mt46h32m32lf6_sdrc_params); | ||
314 | omap_init_irq(); | 316 | omap_init_irq(); |
315 | omap_gpio_init(); | 317 | omap_gpio_init(); |
316 | } | 318 | } |
@@ -397,6 +399,10 @@ static void __init omap3pandora_init(void) | |||
397 | omap3pandora_ads7846_init(); | 399 | omap3pandora_ads7846_init(); |
398 | pandora_keys_gpio_init(); | 400 | pandora_keys_gpio_init(); |
399 | usb_musb_init(); | 401 | usb_musb_init(); |
402 | |||
403 | /* Ensure SDRC pins are mux'd for self-refresh */ | ||
404 | omap_cfg_reg(H16_34XX_SDRC_CKE0); | ||
405 | omap_cfg_reg(H17_34XX_SDRC_CKE1); | ||
400 | } | 406 | } |
401 | 407 | ||
402 | static void __init omap3pandora_map_io(void) | 408 | static void __init omap3pandora_map_io(void) |
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index dff5528fbfb5..6bce23004aa4 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <mach/gpmc.h> | 44 | #include <mach/gpmc.h> |
45 | #include <mach/hardware.h> | 45 | #include <mach/hardware.h> |
46 | #include <mach/nand.h> | 46 | #include <mach/nand.h> |
47 | #include <mach/mux.h> | ||
47 | #include <mach/usb.h> | 48 | #include <mach/usb.h> |
48 | 49 | ||
49 | #include "sdram-micron-mt46h32m32lf-6.h" | 50 | #include "sdram-micron-mt46h32m32lf-6.h" |
@@ -51,6 +52,7 @@ | |||
51 | 52 | ||
52 | #define OVERO_GPIO_BT_XGATE 15 | 53 | #define OVERO_GPIO_BT_XGATE 15 |
53 | #define OVERO_GPIO_W2W_NRESET 16 | 54 | #define OVERO_GPIO_W2W_NRESET 16 |
55 | #define OVERO_GPIO_PENDOWN 114 | ||
54 | #define OVERO_GPIO_BT_NRESET 164 | 56 | #define OVERO_GPIO_BT_NRESET 164 |
55 | #define OVERO_GPIO_USBH_CPEN 168 | 57 | #define OVERO_GPIO_USBH_CPEN 168 |
56 | #define OVERO_GPIO_USBH_NRESET 183 | 58 | #define OVERO_GPIO_USBH_NRESET 183 |
@@ -146,7 +148,7 @@ static struct platform_device overo_smsc911x_device = { | |||
146 | .name = "smsc911x", | 148 | .name = "smsc911x", |
147 | .id = -1, | 149 | .id = -1, |
148 | .num_resources = ARRAY_SIZE(overo_smsc911x_resources), | 150 | .num_resources = ARRAY_SIZE(overo_smsc911x_resources), |
149 | .resource = &overo_smsc911x_resources, | 151 | .resource = overo_smsc911x_resources, |
150 | .dev = { | 152 | .dev = { |
151 | .platform_data = &overo_smsc911x_config, | 153 | .platform_data = &overo_smsc911x_config, |
152 | }, | 154 | }, |
@@ -360,7 +362,8 @@ static int __init overo_i2c_init(void) | |||
360 | 362 | ||
361 | static void __init overo_init_irq(void) | 363 | static void __init overo_init_irq(void) |
362 | { | 364 | { |
363 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params); | 365 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, |
366 | mt46h32m32lf6_sdrc_params); | ||
364 | omap_init_irq(); | 367 | omap_init_irq(); |
365 | omap_gpio_init(); | 368 | omap_gpio_init(); |
366 | } | 369 | } |
@@ -395,6 +398,10 @@ static void __init overo_init(void) | |||
395 | overo_ads7846_init(); | 398 | overo_ads7846_init(); |
396 | overo_init_smsc911x(); | 399 | overo_init_smsc911x(); |
397 | 400 | ||
401 | /* Ensure SDRC pins are mux'd for self-refresh */ | ||
402 | omap_cfg_reg(H16_34XX_SDRC_CKE0); | ||
403 | omap_cfg_reg(H17_34XX_SDRC_CKE1); | ||
404 | |||
398 | if ((gpio_request(OVERO_GPIO_W2W_NRESET, | 405 | if ((gpio_request(OVERO_GPIO_W2W_NRESET, |
399 | "OVERO_GPIO_W2W_NRESET") == 0) && | 406 | "OVERO_GPIO_W2W_NRESET") == 0) && |
400 | (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) { | 407 | (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) { |
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index 9a0bf6744a05..56d931a425f7 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c | |||
@@ -278,6 +278,10 @@ static struct twl4030_gpio_platform_data rx51_gpio_data = { | |||
278 | .setup = rx51_twlgpio_setup, | 278 | .setup = rx51_twlgpio_setup, |
279 | }; | 279 | }; |
280 | 280 | ||
281 | static struct twl4030_usb_data rx51_usb_data = { | ||
282 | .usb_mode = T2_USB_MODE_ULPI, | ||
283 | }; | ||
284 | |||
281 | static struct twl4030_platform_data rx51_twldata = { | 285 | static struct twl4030_platform_data rx51_twldata = { |
282 | .irq_base = TWL4030_IRQ_BASE, | 286 | .irq_base = TWL4030_IRQ_BASE, |
283 | .irq_end = TWL4030_IRQ_END, | 287 | .irq_end = TWL4030_IRQ_END, |
@@ -286,6 +290,7 @@ static struct twl4030_platform_data rx51_twldata = { | |||
286 | .gpio = &rx51_gpio_data, | 290 | .gpio = &rx51_gpio_data, |
287 | .keypad = &rx51_kp_data, | 291 | .keypad = &rx51_kp_data, |
288 | .madc = &rx51_madc_data, | 292 | .madc = &rx51_madc_data, |
293 | .usb = &rx51_usb_data, | ||
289 | 294 | ||
290 | .vaux1 = &rx51_vaux1, | 295 | .vaux1 = &rx51_vaux1, |
291 | .vaux2 = &rx51_vaux2, | 296 | .vaux2 = &rx51_vaux2, |
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c index 374ff63c3eb2..1c9e07fe8266 100644 --- a/arch/arm/mach-omap2/board-rx51.c +++ b/arch/arm/mach-omap2/board-rx51.c | |||
@@ -61,7 +61,7 @@ static struct omap_board_config_kernel rx51_config[] = { | |||
61 | 61 | ||
62 | static void __init rx51_init_irq(void) | 62 | static void __init rx51_init_irq(void) |
63 | { | 63 | { |
64 | omap2_init_common_hw(NULL); | 64 | omap2_init_common_hw(NULL, NULL); |
65 | omap_init_irq(); | 65 | omap_init_irq(); |
66 | omap_gpio_init(); | 66 | omap_gpio_init(); |
67 | } | 67 | } |
@@ -75,6 +75,10 @@ static void __init rx51_init(void) | |||
75 | omap_serial_init(); | 75 | omap_serial_init(); |
76 | usb_musb_init(); | 76 | usb_musb_init(); |
77 | rx51_peripherals_init(); | 77 | rx51_peripherals_init(); |
78 | |||
79 | /* Ensure SDRC pins are mux'd for self-refresh */ | ||
80 | omap_cfg_reg(H16_34XX_SDRC_CKE0); | ||
81 | omap_cfg_reg(H17_34XX_SDRC_CKE1); | ||
78 | } | 82 | } |
79 | 83 | ||
80 | static void __init rx51_map_io(void) | 84 | static void __init rx51_map_io(void) |
diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c index bcc0f7632dea..427b7b8b1237 100644 --- a/arch/arm/mach-omap2/board-zoom2.c +++ b/arch/arm/mach-omap2/board-zoom2.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | static void __init omap_zoom2_init_irq(void) | 26 | static void __init omap_zoom2_init_irq(void) |
27 | { | 27 | { |
28 | omap2_init_common_hw(NULL); | 28 | omap2_init_common_hw(NULL, NULL); |
29 | omap_init_irq(); | 29 | omap_init_irq(); |
30 | omap_gpio_init(); | 30 | omap_gpio_init(); |
31 | } | 31 | } |
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index b0665f161c03..456e2ad5f621 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <mach/clock.h> | 27 | #include <mach/clock.h> |
28 | #include <mach/clockdomain.h> | 28 | #include <mach/clockdomain.h> |
29 | #include <mach/cpu.h> | 29 | #include <mach/cpu.h> |
30 | #include <mach/prcm.h> | ||
30 | #include <asm/div64.h> | 31 | #include <asm/div64.h> |
31 | 32 | ||
32 | #include <mach/sdrc.h> | 33 | #include <mach/sdrc.h> |
@@ -38,8 +39,6 @@ | |||
38 | #include "cm-regbits-24xx.h" | 39 | #include "cm-regbits-24xx.h" |
39 | #include "cm-regbits-34xx.h" | 40 | #include "cm-regbits-34xx.h" |
40 | 41 | ||
41 | #define MAX_CLOCK_ENABLE_WAIT 100000 | ||
42 | |||
43 | /* DPLL rate rounding: minimum DPLL multiplier, divider values */ | 42 | /* DPLL rate rounding: minimum DPLL multiplier, divider values */ |
44 | #define DPLL_MIN_MULTIPLIER 1 | 43 | #define DPLL_MIN_MULTIPLIER 1 |
45 | #define DPLL_MIN_DIVIDER 1 | 44 | #define DPLL_MIN_DIVIDER 1 |
@@ -274,83 +273,97 @@ unsigned long omap2_fixed_divisor_recalc(struct clk *clk) | |||
274 | } | 273 | } |
275 | 274 | ||
276 | /** | 275 | /** |
277 | * omap2_wait_clock_ready - wait for clock to enable | 276 | * omap2_clk_dflt_find_companion - find companion clock to @clk |
278 | * @reg: physical address of clock IDLEST register | 277 | * @clk: struct clk * to find the companion clock of |
279 | * @mask: value to mask against to determine if the clock is active | 278 | * @other_reg: void __iomem ** to return the companion clock CM_*CLKEN va in |
280 | * @name: name of the clock (for printk) | 279 | * @other_bit: u8 ** to return the companion clock bit shift in |
280 | * | ||
281 | * Note: We don't need special code here for INVERT_ENABLE for the | ||
282 | * time being since INVERT_ENABLE only applies to clocks enabled by | ||
283 | * CM_CLKEN_PLL | ||
281 | * | 284 | * |
282 | * Returns 1 if the clock enabled in time, or 0 if it failed to enable | 285 | * Convert CM_ICLKEN* <-> CM_FCLKEN*. This conversion assumes it's |
283 | * in roughly MAX_CLOCK_ENABLE_WAIT microseconds. | 286 | * just a matter of XORing the bits. |
287 | * | ||
288 | * Some clocks don't have companion clocks. For example, modules with | ||
289 | * only an interface clock (such as MAILBOXES) don't have a companion | ||
290 | * clock. Right now, this code relies on the hardware exporting a bit | ||
291 | * in the correct companion register that indicates that the | ||
292 | * nonexistent 'companion clock' is active. Future patches will | ||
293 | * associate this type of code with per-module data structures to | ||
294 | * avoid this issue, and remove the casts. No return value. | ||
284 | */ | 295 | */ |
285 | int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name) | 296 | void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, |
297 | u8 *other_bit) | ||
286 | { | 298 | { |
287 | int i = 0; | 299 | u32 r; |
288 | int ena = 0; | ||
289 | 300 | ||
290 | /* | 301 | /* |
291 | * 24xx uses 0 to indicate not ready, and 1 to indicate ready. | 302 | * Convert CM_ICLKEN* <-> CM_FCLKEN*. This conversion assumes |
292 | * 34xx reverses this, just to keep us on our toes | 303 | * it's just a matter of XORing the bits. |
293 | */ | 304 | */ |
294 | if (cpu_mask & (RATE_IN_242X | RATE_IN_243X)) | 305 | r = ((__force u32)clk->enable_reg ^ (CM_FCLKEN ^ CM_ICLKEN)); |
295 | ena = mask; | ||
296 | else if (cpu_mask & RATE_IN_343X) | ||
297 | ena = 0; | ||
298 | |||
299 | /* Wait for lock */ | ||
300 | while (((__raw_readl(reg) & mask) != ena) && | ||
301 | (i++ < MAX_CLOCK_ENABLE_WAIT)) { | ||
302 | udelay(1); | ||
303 | } | ||
304 | |||
305 | if (i <= MAX_CLOCK_ENABLE_WAIT) | ||
306 | pr_debug("Clock %s stable after %d loops\n", name, i); | ||
307 | else | ||
308 | printk(KERN_ERR "Clock %s didn't enable in %d tries\n", | ||
309 | name, MAX_CLOCK_ENABLE_WAIT); | ||
310 | |||
311 | |||
312 | return (i < MAX_CLOCK_ENABLE_WAIT) ? 1 : 0; | ||
313 | }; | ||
314 | 306 | ||
307 | *other_reg = (__force void __iomem *)r; | ||
308 | *other_bit = clk->enable_bit; | ||
309 | } | ||
315 | 310 | ||
316 | /* | 311 | /** |
317 | * Note: We don't need special code here for INVERT_ENABLE | 312 | * omap2_clk_dflt_find_idlest - find CM_IDLEST reg va, bit shift for @clk |
318 | * for the time being since INVERT_ENABLE only applies to clocks enabled by | 313 | * @clk: struct clk * to find IDLEST info for |
319 | * CM_CLKEN_PLL | 314 | * @idlest_reg: void __iomem ** to return the CM_IDLEST va in |
315 | * @idlest_bit: u8 ** to return the CM_IDLEST bit shift in | ||
316 | * | ||
317 | * Return the CM_IDLEST register address and bit shift corresponding | ||
318 | * to the module that "owns" this clock. This default code assumes | ||
319 | * that the CM_IDLEST bit shift is the CM_*CLKEN bit shift, and that | ||
320 | * the IDLEST register address ID corresponds to the CM_*CLKEN | ||
321 | * register address ID (e.g., that CM_FCLKEN2 corresponds to | ||
322 | * CM_IDLEST2). This is not true for all modules. No return value. | ||
320 | */ | 323 | */ |
321 | static void omap2_clk_wait_ready(struct clk *clk) | 324 | void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, |
325 | u8 *idlest_bit) | ||
322 | { | 326 | { |
323 | void __iomem *reg, *other_reg, *st_reg; | 327 | u32 r; |
324 | u32 bit; | ||
325 | 328 | ||
326 | /* | 329 | r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20); |
327 | * REVISIT: This code is pretty ugly. It would be nice to generalize | 330 | *idlest_reg = (__force void __iomem *)r; |
328 | * it and pull it into struct clk itself somehow. | 331 | *idlest_bit = clk->enable_bit; |
329 | */ | 332 | } |
330 | reg = clk->enable_reg; | ||
331 | 333 | ||
332 | /* | 334 | /** |
333 | * Convert CM_ICLKEN* <-> CM_FCLKEN*. This conversion assumes | 335 | * omap2_module_wait_ready - wait for an OMAP module to leave IDLE |
334 | * it's just a matter of XORing the bits. | 336 | * @clk: struct clk * belonging to the module |
335 | */ | 337 | * |
336 | other_reg = (void __iomem *)((u32)reg ^ (CM_FCLKEN ^ CM_ICLKEN)); | 338 | * If the necessary clocks for the OMAP hardware IP block that |
339 | * corresponds to clock @clk are enabled, then wait for the module to | ||
340 | * indicate readiness (i.e., to leave IDLE). This code does not | ||
341 | * belong in the clock code and will be moved in the medium term to | ||
342 | * module-dependent code. No return value. | ||
343 | */ | ||
344 | static void omap2_module_wait_ready(struct clk *clk) | ||
345 | { | ||
346 | void __iomem *companion_reg, *idlest_reg; | ||
347 | u8 other_bit, idlest_bit; | ||
348 | |||
349 | /* Not all modules have multiple clocks that their IDLEST depends on */ | ||
350 | if (clk->ops->find_companion) { | ||
351 | clk->ops->find_companion(clk, &companion_reg, &other_bit); | ||
352 | if (!(__raw_readl(companion_reg) & (1 << other_bit))) | ||
353 | return; | ||
354 | } | ||
337 | 355 | ||
338 | /* Check if both functional and interface clocks | 356 | clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit); |
339 | * are running. */ | ||
340 | bit = 1 << clk->enable_bit; | ||
341 | if (!(__raw_readl(other_reg) & bit)) | ||
342 | return; | ||
343 | st_reg = (void __iomem *)(((u32)other_reg & ~0xf0) | 0x20); /* CM_IDLEST* */ | ||
344 | 357 | ||
345 | omap2_wait_clock_ready(st_reg, bit, clk->name); | 358 | omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), clk->name); |
346 | } | 359 | } |
347 | 360 | ||
348 | static int omap2_dflt_clk_enable(struct clk *clk) | 361 | int omap2_dflt_clk_enable(struct clk *clk) |
349 | { | 362 | { |
350 | u32 v; | 363 | u32 v; |
351 | 364 | ||
352 | if (unlikely(clk->enable_reg == NULL)) { | 365 | if (unlikely(clk->enable_reg == NULL)) { |
353 | printk(KERN_ERR "clock.c: Enable for %s without enable code\n", | 366 | pr_err("clock.c: Enable for %s without enable code\n", |
354 | clk->name); | 367 | clk->name); |
355 | return 0; /* REVISIT: -EINVAL */ | 368 | return 0; /* REVISIT: -EINVAL */ |
356 | } | 369 | } |
@@ -363,26 +376,13 @@ static int omap2_dflt_clk_enable(struct clk *clk) | |||
363 | __raw_writel(v, clk->enable_reg); | 376 | __raw_writel(v, clk->enable_reg); |
364 | v = __raw_readl(clk->enable_reg); /* OCP barrier */ | 377 | v = __raw_readl(clk->enable_reg); /* OCP barrier */ |
365 | 378 | ||
366 | return 0; | 379 | if (clk->ops->find_idlest) |
367 | } | 380 | omap2_module_wait_ready(clk); |
368 | 381 | ||
369 | static int omap2_dflt_clk_enable_wait(struct clk *clk) | 382 | return 0; |
370 | { | ||
371 | int ret; | ||
372 | |||
373 | if (!clk->enable_reg) { | ||
374 | printk(KERN_ERR "clock.c: Enable for %s without enable code\n", | ||
375 | clk->name); | ||
376 | return 0; /* REVISIT: -EINVAL */ | ||
377 | } | ||
378 | |||
379 | ret = omap2_dflt_clk_enable(clk); | ||
380 | if (ret == 0) | ||
381 | omap2_clk_wait_ready(clk); | ||
382 | return ret; | ||
383 | } | 383 | } |
384 | 384 | ||
385 | static void omap2_dflt_clk_disable(struct clk *clk) | 385 | void omap2_dflt_clk_disable(struct clk *clk) |
386 | { | 386 | { |
387 | u32 v; | 387 | u32 v; |
388 | 388 | ||
@@ -406,8 +406,10 @@ static void omap2_dflt_clk_disable(struct clk *clk) | |||
406 | } | 406 | } |
407 | 407 | ||
408 | const struct clkops clkops_omap2_dflt_wait = { | 408 | const struct clkops clkops_omap2_dflt_wait = { |
409 | .enable = omap2_dflt_clk_enable_wait, | 409 | .enable = omap2_dflt_clk_enable, |
410 | .disable = omap2_dflt_clk_disable, | 410 | .disable = omap2_dflt_clk_disable, |
411 | .find_companion = omap2_clk_dflt_find_companion, | ||
412 | .find_idlest = omap2_clk_dflt_find_idlest, | ||
411 | }; | 413 | }; |
412 | 414 | ||
413 | const struct clkops clkops_omap2_dflt = { | 415 | const struct clkops clkops_omap2_dflt = { |
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 2679ddfa6424..9ae7540f8af2 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
@@ -65,6 +65,12 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); | |||
65 | u32 omap2_get_dpll_rate(struct clk *clk); | 65 | u32 omap2_get_dpll_rate(struct clk *clk); |
66 | int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); | 66 | int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); |
67 | void omap2_clk_prepare_for_reboot(void); | 67 | void omap2_clk_prepare_for_reboot(void); |
68 | int omap2_dflt_clk_enable(struct clk *clk); | ||
69 | void omap2_dflt_clk_disable(struct clk *clk); | ||
70 | void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, | ||
71 | u8 *other_bit); | ||
72 | void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, | ||
73 | u8 *idlest_bit); | ||
68 | 74 | ||
69 | extern const struct clkops clkops_omap2_dflt_wait; | 75 | extern const struct clkops clkops_omap2_dflt_wait; |
70 | extern const struct clkops clkops_omap2_dflt; | 76 | extern const struct clkops clkops_omap2_dflt; |
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c index 44de0271fc2f..bc5d3ac66611 100644 --- a/arch/arm/mach-omap2/clock24xx.c +++ b/arch/arm/mach-omap2/clock24xx.c | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | #include <mach/clock.h> | 31 | #include <mach/clock.h> |
32 | #include <mach/sram.h> | 32 | #include <mach/sram.h> |
33 | #include <mach/prcm.h> | ||
33 | #include <asm/div64.h> | 34 | #include <asm/div64.h> |
34 | #include <asm/clkdev.h> | 35 | #include <asm/clkdev.h> |
35 | 36 | ||
@@ -43,6 +44,18 @@ | |||
43 | static const struct clkops clkops_oscck; | 44 | static const struct clkops clkops_oscck; |
44 | static const struct clkops clkops_fixed; | 45 | static const struct clkops clkops_fixed; |
45 | 46 | ||
47 | static void omap2430_clk_i2chs_find_idlest(struct clk *clk, | ||
48 | void __iomem **idlest_reg, | ||
49 | u8 *idlest_bit); | ||
50 | |||
51 | /* 2430 I2CHS has non-standard IDLEST register */ | ||
52 | static const struct clkops clkops_omap2430_i2chs_wait = { | ||
53 | .enable = omap2_dflt_clk_enable, | ||
54 | .disable = omap2_dflt_clk_disable, | ||
55 | .find_idlest = omap2430_clk_i2chs_find_idlest, | ||
56 | .find_companion = omap2_clk_dflt_find_companion, | ||
57 | }; | ||
58 | |||
46 | #include "clock24xx.h" | 59 | #include "clock24xx.h" |
47 | 60 | ||
48 | struct omap_clk { | 61 | struct omap_clk { |
@@ -240,6 +253,26 @@ static void __iomem *prcm_clksrc_ctrl; | |||
240 | *-------------------------------------------------------------------------*/ | 253 | *-------------------------------------------------------------------------*/ |
241 | 254 | ||
242 | /** | 255 | /** |
256 | * omap2430_clk_i2chs_find_idlest - return CM_IDLEST info for 2430 I2CHS | ||
257 | * @clk: struct clk * being enabled | ||
258 | * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into | ||
259 | * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into | ||
260 | * | ||
261 | * OMAP2430 I2CHS CM_IDLEST bits are in CM_IDLEST1_CORE, but the | ||
262 | * CM_*CLKEN bits are in CM_{I,F}CLKEN2_CORE. This custom function | ||
263 | * passes back the correct CM_IDLEST register address for I2CHS | ||
264 | * modules. No return value. | ||
265 | */ | ||
266 | static void omap2430_clk_i2chs_find_idlest(struct clk *clk, | ||
267 | void __iomem **idlest_reg, | ||
268 | u8 *idlest_bit) | ||
269 | { | ||
270 | *idlest_reg = OMAP_CM_REGADDR(CORE_MOD, CM_IDLEST); | ||
271 | *idlest_bit = clk->enable_bit; | ||
272 | } | ||
273 | |||
274 | |||
275 | /** | ||
243 | * omap2xxx_clk_get_core_rate - return the CORE_CLK rate | 276 | * omap2xxx_clk_get_core_rate - return the CORE_CLK rate |
244 | * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck") | 277 | * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck") |
245 | * | 278 | * |
@@ -325,8 +358,8 @@ static int omap2_clk_fixed_enable(struct clk *clk) | |||
325 | else if (clk == &apll54_ck) | 358 | else if (clk == &apll54_ck) |
326 | cval = OMAP24XX_ST_54M_APLL; | 359 | cval = OMAP24XX_ST_54M_APLL; |
327 | 360 | ||
328 | omap2_wait_clock_ready(OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), cval, | 361 | omap2_cm_wait_idlest(OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), cval, |
329 | clk->name); | 362 | clk->name); |
330 | 363 | ||
331 | /* | 364 | /* |
332 | * REVISIT: Should we return an error code if omap2_wait_clock_ready() | 365 | * REVISIT: Should we return an error code if omap2_wait_clock_ready() |
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h index 458f00cdcbea..d19cf7a7d8db 100644 --- a/arch/arm/mach-omap2/clock24xx.h +++ b/arch/arm/mach-omap2/clock24xx.h | |||
@@ -2337,7 +2337,7 @@ static struct clk i2c2_fck = { | |||
2337 | 2337 | ||
2338 | static struct clk i2chs2_fck = { | 2338 | static struct clk i2chs2_fck = { |
2339 | .name = "i2c_fck", | 2339 | .name = "i2c_fck", |
2340 | .ops = &clkops_omap2_dflt_wait, | 2340 | .ops = &clkops_omap2430_i2chs_wait, |
2341 | .id = 2, | 2341 | .id = 2, |
2342 | .parent = &func_96m_ck, | 2342 | .parent = &func_96m_ck, |
2343 | .clkdm_name = "core_l4_clkdm", | 2343 | .clkdm_name = "core_l4_clkdm", |
@@ -2370,7 +2370,7 @@ static struct clk i2c1_fck = { | |||
2370 | 2370 | ||
2371 | static struct clk i2chs1_fck = { | 2371 | static struct clk i2chs1_fck = { |
2372 | .name = "i2c_fck", | 2372 | .name = "i2c_fck", |
2373 | .ops = &clkops_omap2_dflt_wait, | 2373 | .ops = &clkops_omap2430_i2chs_wait, |
2374 | .id = 1, | 2374 | .id = 1, |
2375 | .parent = &func_96m_ck, | 2375 | .parent = &func_96m_ck, |
2376 | .clkdm_name = "core_l4_clkdm", | 2376 | .clkdm_name = "core_l4_clkdm", |
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c index 045da923e75b..cd7819cc0c9e 100644 --- a/arch/arm/mach-omap2/clock34xx.c +++ b/arch/arm/mach-omap2/clock34xx.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * OMAP3-specific clock framework functions | 2 | * OMAP3-specific clock framework functions |
3 | * | 3 | * |
4 | * Copyright (C) 2007-2008 Texas Instruments, Inc. | 4 | * Copyright (C) 2007-2008 Texas Instruments, Inc. |
5 | * Copyright (C) 2007-2008 Nokia Corporation | 5 | * Copyright (C) 2007-2009 Nokia Corporation |
6 | * | 6 | * |
7 | * Written by Paul Walmsley | 7 | * Written by Paul Walmsley |
8 | * Testing and integration fixes by Jouni Högander | 8 | * Testing and integration fixes by Jouni Högander |
@@ -41,6 +41,37 @@ | |||
41 | 41 | ||
42 | static const struct clkops clkops_noncore_dpll_ops; | 42 | static const struct clkops clkops_noncore_dpll_ops; |
43 | 43 | ||
44 | static void omap3430es2_clk_ssi_find_idlest(struct clk *clk, | ||
45 | void __iomem **idlest_reg, | ||
46 | u8 *idlest_bit); | ||
47 | static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk, | ||
48 | void __iomem **idlest_reg, | ||
49 | u8 *idlest_bit); | ||
50 | static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk, | ||
51 | void __iomem **idlest_reg, | ||
52 | u8 *idlest_bit); | ||
53 | |||
54 | static const struct clkops clkops_omap3430es2_ssi_wait = { | ||
55 | .enable = omap2_dflt_clk_enable, | ||
56 | .disable = omap2_dflt_clk_disable, | ||
57 | .find_idlest = omap3430es2_clk_ssi_find_idlest, | ||
58 | .find_companion = omap2_clk_dflt_find_companion, | ||
59 | }; | ||
60 | |||
61 | static const struct clkops clkops_omap3430es2_hsotgusb_wait = { | ||
62 | .enable = omap2_dflt_clk_enable, | ||
63 | .disable = omap2_dflt_clk_disable, | ||
64 | .find_idlest = omap3430es2_clk_hsotgusb_find_idlest, | ||
65 | .find_companion = omap2_clk_dflt_find_companion, | ||
66 | }; | ||
67 | |||
68 | static const struct clkops clkops_omap3430es2_dss_usbhost_wait = { | ||
69 | .enable = omap2_dflt_clk_enable, | ||
70 | .disable = omap2_dflt_clk_disable, | ||
71 | .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest, | ||
72 | .find_companion = omap2_clk_dflt_find_companion, | ||
73 | }; | ||
74 | |||
44 | #include "clock34xx.h" | 75 | #include "clock34xx.h" |
45 | 76 | ||
46 | struct omap_clk { | 77 | struct omap_clk { |
@@ -157,10 +188,13 @@ static struct omap_clk omap34xx_clks[] = { | |||
157 | CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1), | 188 | CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1), |
158 | CLK(NULL, "core_12m_fck", &core_12m_fck, CK_343X), | 189 | CLK(NULL, "core_12m_fck", &core_12m_fck, CK_343X), |
159 | CLK("omap_hdq.0", "fck", &hdq_fck, CK_343X), | 190 | CLK("omap_hdq.0", "fck", &hdq_fck, CK_343X), |
160 | CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck, CK_343X), | 191 | CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1), |
161 | CLK(NULL, "ssi_sst_fck", &ssi_sst_fck, CK_343X), | 192 | CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2), |
193 | CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1), | ||
194 | CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2, CK_3430ES2), | ||
162 | CLK(NULL, "core_l3_ick", &core_l3_ick, CK_343X), | 195 | CLK(NULL, "core_l3_ick", &core_l3_ick, CK_343X), |
163 | CLK("musb_hdrc", "ick", &hsotgusb_ick, CK_343X), | 196 | CLK("musb_hdrc", "ick", &hsotgusb_ick_3430es1, CK_3430ES1), |
197 | CLK("musb_hdrc", "ick", &hsotgusb_ick_3430es2, CK_3430ES2), | ||
164 | CLK(NULL, "sdrc_ick", &sdrc_ick, CK_343X), | 198 | CLK(NULL, "sdrc_ick", &sdrc_ick, CK_343X), |
165 | CLK(NULL, "gpmc_fck", &gpmc_fck, CK_343X), | 199 | CLK(NULL, "gpmc_fck", &gpmc_fck, CK_343X), |
166 | CLK(NULL, "security_l3_ick", &security_l3_ick, CK_343X), | 200 | CLK(NULL, "security_l3_ick", &security_l3_ick, CK_343X), |
@@ -193,18 +227,21 @@ static struct omap_clk omap34xx_clks[] = { | |||
193 | CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_343X), | 227 | CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_343X), |
194 | CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_343X), | 228 | CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_343X), |
195 | CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_343X), | 229 | CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_343X), |
196 | CLK(NULL, "ssi_ick", &ssi_ick, CK_343X), | 230 | CLK(NULL, "ssi_ick", &ssi_ick_3430es1, CK_3430ES1), |
231 | CLK(NULL, "ssi_ick", &ssi_ick_3430es2, CK_3430ES2), | ||
197 | CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_3430ES1), | 232 | CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_3430ES1), |
198 | CLK(NULL, "security_l4_ick2", &security_l4_ick2, CK_343X), | 233 | CLK(NULL, "security_l4_ick2", &security_l4_ick2, CK_343X), |
199 | CLK(NULL, "aes1_ick", &aes1_ick, CK_343X), | 234 | CLK(NULL, "aes1_ick", &aes1_ick, CK_343X), |
200 | CLK("omap_rng", "ick", &rng_ick, CK_343X), | 235 | CLK("omap_rng", "ick", &rng_ick, CK_343X), |
201 | CLK(NULL, "sha11_ick", &sha11_ick, CK_343X), | 236 | CLK(NULL, "sha11_ick", &sha11_ick, CK_343X), |
202 | CLK(NULL, "des1_ick", &des1_ick, CK_343X), | 237 | CLK(NULL, "des1_ick", &des1_ick, CK_343X), |
203 | CLK("omapfb", "dss1_fck", &dss1_alwon_fck, CK_343X), | 238 | CLK("omapfb", "dss1_fck", &dss1_alwon_fck_3430es1, CK_3430ES1), |
239 | CLK("omapfb", "dss1_fck", &dss1_alwon_fck_3430es2, CK_3430ES2), | ||
204 | CLK("omapfb", "tv_fck", &dss_tv_fck, CK_343X), | 240 | CLK("omapfb", "tv_fck", &dss_tv_fck, CK_343X), |
205 | CLK("omapfb", "video_fck", &dss_96m_fck, CK_343X), | 241 | CLK("omapfb", "video_fck", &dss_96m_fck, CK_343X), |
206 | CLK("omapfb", "dss2_fck", &dss2_alwon_fck, CK_343X), | 242 | CLK("omapfb", "dss2_fck", &dss2_alwon_fck, CK_343X), |
207 | CLK("omapfb", "ick", &dss_ick, CK_343X), | 243 | CLK("omapfb", "ick", &dss_ick_3430es1, CK_3430ES1), |
244 | CLK("omapfb", "ick", &dss_ick_3430es2, CK_3430ES2), | ||
208 | CLK(NULL, "cam_mclk", &cam_mclk, CK_343X), | 245 | CLK(NULL, "cam_mclk", &cam_mclk, CK_343X), |
209 | CLK(NULL, "cam_ick", &cam_ick, CK_343X), | 246 | CLK(NULL, "cam_ick", &cam_ick, CK_343X), |
210 | CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_343X), | 247 | CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_343X), |
@@ -301,6 +338,73 @@ static struct omap_clk omap34xx_clks[] = { | |||
301 | #define SDRC_MPURATE_LOOPS 96 | 338 | #define SDRC_MPURATE_LOOPS 96 |
302 | 339 | ||
303 | /** | 340 | /** |
341 | * omap3430es2_clk_ssi_find_idlest - return CM_IDLEST info for SSI | ||
342 | * @clk: struct clk * being enabled | ||
343 | * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into | ||
344 | * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into | ||
345 | * | ||
346 | * The OMAP3430ES2 SSI target CM_IDLEST bit is at a different shift | ||
347 | * from the CM_{I,F}CLKEN bit. Pass back the correct info via | ||
348 | * @idlest_reg and @idlest_bit. No return value. | ||
349 | */ | ||
350 | static void omap3430es2_clk_ssi_find_idlest(struct clk *clk, | ||
351 | void __iomem **idlest_reg, | ||
352 | u8 *idlest_bit) | ||
353 | { | ||
354 | u32 r; | ||
355 | |||
356 | r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20); | ||
357 | *idlest_reg = (__force void __iomem *)r; | ||
358 | *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT; | ||
359 | } | ||
360 | |||
361 | /** | ||
362 | * omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST | ||
363 | * @clk: struct clk * being enabled | ||
364 | * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into | ||
365 | * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into | ||
366 | * | ||
367 | * Some OMAP modules on OMAP3 ES2+ chips have both initiator and | ||
368 | * target IDLEST bits. For our purposes, we are concerned with the | ||
369 | * target IDLEST bits, which exist at a different bit position than | ||
370 | * the *CLKEN bit position for these modules (DSS and USBHOST) (The | ||
371 | * default find_idlest code assumes that they are at the same | ||
372 | * position.) No return value. | ||
373 | */ | ||
374 | static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk, | ||
375 | void __iomem **idlest_reg, | ||
376 | u8 *idlest_bit) | ||
377 | { | ||
378 | u32 r; | ||
379 | |||
380 | r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20); | ||
381 | *idlest_reg = (__force void __iomem *)r; | ||
382 | /* USBHOST_IDLE has same shift */ | ||
383 | *idlest_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT; | ||
384 | } | ||
385 | |||
386 | /** | ||
387 | * omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB | ||
388 | * @clk: struct clk * being enabled | ||
389 | * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into | ||
390 | * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into | ||
391 | * | ||
392 | * The OMAP3430ES2 HSOTGUSB target CM_IDLEST bit is at a different | ||
393 | * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via | ||
394 | * @idlest_reg and @idlest_bit. No return value. | ||
395 | */ | ||
396 | static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk, | ||
397 | void __iomem **idlest_reg, | ||
398 | u8 *idlest_bit) | ||
399 | { | ||
400 | u32 r; | ||
401 | |||
402 | r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20); | ||
403 | *idlest_reg = (__force void __iomem *)r; | ||
404 | *idlest_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT; | ||
405 | } | ||
406 | |||
407 | /** | ||
304 | * omap3_dpll_recalc - recalculate DPLL rate | 408 | * omap3_dpll_recalc - recalculate DPLL rate |
305 | * @clk: DPLL struct clk | 409 | * @clk: DPLL struct clk |
306 | * | 410 | * |
@@ -725,7 +829,9 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) | |||
725 | u32 unlock_dll = 0; | 829 | u32 unlock_dll = 0; |
726 | u32 c; | 830 | u32 c; |
727 | unsigned long validrate, sdrcrate, mpurate; | 831 | unsigned long validrate, sdrcrate, mpurate; |
728 | struct omap_sdrc_params *sp; | 832 | struct omap_sdrc_params *sdrc_cs0; |
833 | struct omap_sdrc_params *sdrc_cs1; | ||
834 | int ret; | ||
729 | 835 | ||
730 | if (!clk || !rate) | 836 | if (!clk || !rate) |
731 | return -EINVAL; | 837 | return -EINVAL; |
@@ -743,8 +849,8 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) | |||
743 | else | 849 | else |
744 | sdrcrate >>= ((clk->rate / rate) >> 1); | 850 | sdrcrate >>= ((clk->rate / rate) >> 1); |
745 | 851 | ||
746 | sp = omap2_sdrc_get_params(sdrcrate); | 852 | ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1); |
747 | if (!sp) | 853 | if (ret) |
748 | return -EINVAL; | 854 | return -EINVAL; |
749 | 855 | ||
750 | if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) { | 856 | if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) { |
@@ -765,12 +871,29 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) | |||
765 | 871 | ||
766 | pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate, | 872 | pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate, |
767 | validrate); | 873 | validrate); |
768 | pr_debug("clock: SDRC timing params used: %08x %08x %08x\n", | 874 | pr_debug("clock: SDRC CS0 timing params used:" |
769 | sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb); | 875 | " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n", |
770 | 876 | sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla, | |
771 | omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla, | 877 | sdrc_cs0->actim_ctrlb, sdrc_cs0->mr); |
772 | sp->actim_ctrlb, new_div, unlock_dll, c, | 878 | if (sdrc_cs1) |
773 | sp->mr, rate > clk->rate); | 879 | pr_debug("clock: SDRC CS1 timing params used: " |
880 | " RFR %08x CTRLA %08x CTRLB %08x MR %08x\n", | ||
881 | sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla, | ||
882 | sdrc_cs1->actim_ctrlb, sdrc_cs1->mr); | ||
883 | |||
884 | if (sdrc_cs1) | ||
885 | omap3_configure_core_dpll( | ||
886 | new_div, unlock_dll, c, rate > clk->rate, | ||
887 | sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla, | ||
888 | sdrc_cs0->actim_ctrlb, sdrc_cs0->mr, | ||
889 | sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla, | ||
890 | sdrc_cs1->actim_ctrlb, sdrc_cs1->mr); | ||
891 | else | ||
892 | omap3_configure_core_dpll( | ||
893 | new_div, unlock_dll, c, rate > clk->rate, | ||
894 | sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla, | ||
895 | sdrc_cs0->actim_ctrlb, sdrc_cs0->mr, | ||
896 | 0, 0, 0, 0); | ||
774 | 897 | ||
775 | return 0; | 898 | return 0; |
776 | } | 899 | } |
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h index e433aec4efdd..57cc2725b923 100644 --- a/arch/arm/mach-omap2/clock34xx.h +++ b/arch/arm/mach-omap2/clock34xx.h | |||
@@ -1568,7 +1568,7 @@ static const struct clksel ssi_ssr_clksel[] = { | |||
1568 | { .parent = NULL } | 1568 | { .parent = NULL } |
1569 | }; | 1569 | }; |
1570 | 1570 | ||
1571 | static struct clk ssi_ssr_fck = { | 1571 | static struct clk ssi_ssr_fck_3430es1 = { |
1572 | .name = "ssi_ssr_fck", | 1572 | .name = "ssi_ssr_fck", |
1573 | .ops = &clkops_omap2_dflt, | 1573 | .ops = &clkops_omap2_dflt, |
1574 | .init = &omap2_init_clksel_parent, | 1574 | .init = &omap2_init_clksel_parent, |
@@ -1581,10 +1581,31 @@ static struct clk ssi_ssr_fck = { | |||
1581 | .recalc = &omap2_clksel_recalc, | 1581 | .recalc = &omap2_clksel_recalc, |
1582 | }; | 1582 | }; |
1583 | 1583 | ||
1584 | static struct clk ssi_sst_fck = { | 1584 | static struct clk ssi_ssr_fck_3430es2 = { |
1585 | .name = "ssi_ssr_fck", | ||
1586 | .ops = &clkops_omap3430es2_ssi_wait, | ||
1587 | .init = &omap2_init_clksel_parent, | ||
1588 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | ||
1589 | .enable_bit = OMAP3430_EN_SSI_SHIFT, | ||
1590 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), | ||
1591 | .clksel_mask = OMAP3430_CLKSEL_SSI_MASK, | ||
1592 | .clksel = ssi_ssr_clksel, | ||
1593 | .clkdm_name = "core_l4_clkdm", | ||
1594 | .recalc = &omap2_clksel_recalc, | ||
1595 | }; | ||
1596 | |||
1597 | static struct clk ssi_sst_fck_3430es1 = { | ||
1585 | .name = "ssi_sst_fck", | 1598 | .name = "ssi_sst_fck", |
1586 | .ops = &clkops_null, | 1599 | .ops = &clkops_null, |
1587 | .parent = &ssi_ssr_fck, | 1600 | .parent = &ssi_ssr_fck_3430es1, |
1601 | .fixed_div = 2, | ||
1602 | .recalc = &omap2_fixed_divisor_recalc, | ||
1603 | }; | ||
1604 | |||
1605 | static struct clk ssi_sst_fck_3430es2 = { | ||
1606 | .name = "ssi_sst_fck", | ||
1607 | .ops = &clkops_null, | ||
1608 | .parent = &ssi_ssr_fck_3430es2, | ||
1588 | .fixed_div = 2, | 1609 | .fixed_div = 2, |
1589 | .recalc = &omap2_fixed_divisor_recalc, | 1610 | .recalc = &omap2_fixed_divisor_recalc, |
1590 | }; | 1611 | }; |
@@ -1606,9 +1627,19 @@ static struct clk core_l3_ick = { | |||
1606 | .recalc = &followparent_recalc, | 1627 | .recalc = &followparent_recalc, |
1607 | }; | 1628 | }; |
1608 | 1629 | ||
1609 | static struct clk hsotgusb_ick = { | 1630 | static struct clk hsotgusb_ick_3430es1 = { |
1610 | .name = "hsotgusb_ick", | 1631 | .name = "hsotgusb_ick", |
1611 | .ops = &clkops_omap2_dflt_wait, | 1632 | .ops = &clkops_omap2_dflt, |
1633 | .parent = &core_l3_ick, | ||
1634 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1635 | .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT, | ||
1636 | .clkdm_name = "core_l3_clkdm", | ||
1637 | .recalc = &followparent_recalc, | ||
1638 | }; | ||
1639 | |||
1640 | static struct clk hsotgusb_ick_3430es2 = { | ||
1641 | .name = "hsotgusb_ick", | ||
1642 | .ops = &clkops_omap3430es2_hsotgusb_wait, | ||
1612 | .parent = &core_l3_ick, | 1643 | .parent = &core_l3_ick, |
1613 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | 1644 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), |
1614 | .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT, | 1645 | .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT, |
@@ -1947,7 +1978,7 @@ static struct clk ssi_l4_ick = { | |||
1947 | .recalc = &followparent_recalc, | 1978 | .recalc = &followparent_recalc, |
1948 | }; | 1979 | }; |
1949 | 1980 | ||
1950 | static struct clk ssi_ick = { | 1981 | static struct clk ssi_ick_3430es1 = { |
1951 | .name = "ssi_ick", | 1982 | .name = "ssi_ick", |
1952 | .ops = &clkops_omap2_dflt, | 1983 | .ops = &clkops_omap2_dflt, |
1953 | .parent = &ssi_l4_ick, | 1984 | .parent = &ssi_l4_ick, |
@@ -1957,6 +1988,16 @@ static struct clk ssi_ick = { | |||
1957 | .recalc = &followparent_recalc, | 1988 | .recalc = &followparent_recalc, |
1958 | }; | 1989 | }; |
1959 | 1990 | ||
1991 | static struct clk ssi_ick_3430es2 = { | ||
1992 | .name = "ssi_ick", | ||
1993 | .ops = &clkops_omap3430es2_ssi_wait, | ||
1994 | .parent = &ssi_l4_ick, | ||
1995 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | ||
1996 | .enable_bit = OMAP3430_EN_SSI_SHIFT, | ||
1997 | .clkdm_name = "core_l4_clkdm", | ||
1998 | .recalc = &followparent_recalc, | ||
1999 | }; | ||
2000 | |||
1960 | /* REVISIT: Technically the TRM claims that this is CORE_CLK based, | 2001 | /* REVISIT: Technically the TRM claims that this is CORE_CLK based, |
1961 | * but l4_ick makes more sense to me */ | 2002 | * but l4_ick makes more sense to me */ |
1962 | 2003 | ||
@@ -2024,7 +2065,7 @@ static struct clk des1_ick = { | |||
2024 | }; | 2065 | }; |
2025 | 2066 | ||
2026 | /* DSS */ | 2067 | /* DSS */ |
2027 | static struct clk dss1_alwon_fck = { | 2068 | static struct clk dss1_alwon_fck_3430es1 = { |
2028 | .name = "dss1_alwon_fck", | 2069 | .name = "dss1_alwon_fck", |
2029 | .ops = &clkops_omap2_dflt, | 2070 | .ops = &clkops_omap2_dflt, |
2030 | .parent = &dpll4_m4x2_ck, | 2071 | .parent = &dpll4_m4x2_ck, |
@@ -2034,6 +2075,16 @@ static struct clk dss1_alwon_fck = { | |||
2034 | .recalc = &followparent_recalc, | 2075 | .recalc = &followparent_recalc, |
2035 | }; | 2076 | }; |
2036 | 2077 | ||
2078 | static struct clk dss1_alwon_fck_3430es2 = { | ||
2079 | .name = "dss1_alwon_fck", | ||
2080 | .ops = &clkops_omap3430es2_dss_usbhost_wait, | ||
2081 | .parent = &dpll4_m4x2_ck, | ||
2082 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN), | ||
2083 | .enable_bit = OMAP3430_EN_DSS1_SHIFT, | ||
2084 | .clkdm_name = "dss_clkdm", | ||
2085 | .recalc = &followparent_recalc, | ||
2086 | }; | ||
2087 | |||
2037 | static struct clk dss_tv_fck = { | 2088 | static struct clk dss_tv_fck = { |
2038 | .name = "dss_tv_fck", | 2089 | .name = "dss_tv_fck", |
2039 | .ops = &clkops_omap2_dflt, | 2090 | .ops = &clkops_omap2_dflt, |
@@ -2067,7 +2118,7 @@ static struct clk dss2_alwon_fck = { | |||
2067 | .recalc = &followparent_recalc, | 2118 | .recalc = &followparent_recalc, |
2068 | }; | 2119 | }; |
2069 | 2120 | ||
2070 | static struct clk dss_ick = { | 2121 | static struct clk dss_ick_3430es1 = { |
2071 | /* Handles both L3 and L4 clocks */ | 2122 | /* Handles both L3 and L4 clocks */ |
2072 | .name = "dss_ick", | 2123 | .name = "dss_ick", |
2073 | .ops = &clkops_omap2_dflt, | 2124 | .ops = &clkops_omap2_dflt, |
@@ -2079,6 +2130,18 @@ static struct clk dss_ick = { | |||
2079 | .recalc = &followparent_recalc, | 2130 | .recalc = &followparent_recalc, |
2080 | }; | 2131 | }; |
2081 | 2132 | ||
2133 | static struct clk dss_ick_3430es2 = { | ||
2134 | /* Handles both L3 and L4 clocks */ | ||
2135 | .name = "dss_ick", | ||
2136 | .ops = &clkops_omap3430es2_dss_usbhost_wait, | ||
2137 | .parent = &l4_ick, | ||
2138 | .init = &omap2_init_clk_clkdm, | ||
2139 | .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN), | ||
2140 | .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT, | ||
2141 | .clkdm_name = "dss_clkdm", | ||
2142 | .recalc = &followparent_recalc, | ||
2143 | }; | ||
2144 | |||
2082 | /* CAM */ | 2145 | /* CAM */ |
2083 | 2146 | ||
2084 | static struct clk cam_mclk = { | 2147 | static struct clk cam_mclk = { |
@@ -2118,7 +2181,7 @@ static struct clk csi2_96m_fck = { | |||
2118 | 2181 | ||
2119 | static struct clk usbhost_120m_fck = { | 2182 | static struct clk usbhost_120m_fck = { |
2120 | .name = "usbhost_120m_fck", | 2183 | .name = "usbhost_120m_fck", |
2121 | .ops = &clkops_omap2_dflt_wait, | 2184 | .ops = &clkops_omap2_dflt, |
2122 | .parent = &dpll5_m2_ck, | 2185 | .parent = &dpll5_m2_ck, |
2123 | .init = &omap2_init_clk_clkdm, | 2186 | .init = &omap2_init_clk_clkdm, |
2124 | .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN), | 2187 | .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN), |
@@ -2129,7 +2192,7 @@ static struct clk usbhost_120m_fck = { | |||
2129 | 2192 | ||
2130 | static struct clk usbhost_48m_fck = { | 2193 | static struct clk usbhost_48m_fck = { |
2131 | .name = "usbhost_48m_fck", | 2194 | .name = "usbhost_48m_fck", |
2132 | .ops = &clkops_omap2_dflt_wait, | 2195 | .ops = &clkops_omap3430es2_dss_usbhost_wait, |
2133 | .parent = &omap_48m_fck, | 2196 | .parent = &omap_48m_fck, |
2134 | .init = &omap2_init_clk_clkdm, | 2197 | .init = &omap2_init_clk_clkdm, |
2135 | .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN), | 2198 | .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN), |
@@ -2141,7 +2204,7 @@ static struct clk usbhost_48m_fck = { | |||
2141 | static struct clk usbhost_ick = { | 2204 | static struct clk usbhost_ick = { |
2142 | /* Handles both L3 and L4 clocks */ | 2205 | /* Handles both L3 and L4 clocks */ |
2143 | .name = "usbhost_ick", | 2206 | .name = "usbhost_ick", |
2144 | .ops = &clkops_omap2_dflt_wait, | 2207 | .ops = &clkops_omap3430es2_dss_usbhost_wait, |
2145 | .parent = &l4_ick, | 2208 | .parent = &l4_ick, |
2146 | .init = &omap2_init_clk_clkdm, | 2209 | .init = &omap2_init_clk_clkdm, |
2147 | .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN), | 2210 | .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN), |
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h index 1d3c93bf86d3..f3c91a1ca391 100644 --- a/arch/arm/mach-omap2/cm.h +++ b/arch/arm/mach-omap2/cm.h | |||
@@ -29,9 +29,9 @@ | |||
29 | * These registers appear once per CM module. | 29 | * These registers appear once per CM module. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #define OMAP3430_CM_REVISION OMAP_CM_REGADDR(OCP_MOD, 0x0000) | 32 | #define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000) |
33 | #define OMAP3430_CM_SYSCONFIG OMAP_CM_REGADDR(OCP_MOD, 0x0010) | 33 | #define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010) |
34 | #define OMAP3430_CM_POLCTRL OMAP_CM_REGADDR(OCP_MOD, 0x009c) | 34 | #define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c) |
35 | 35 | ||
36 | #define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070 | 36 | #define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070 |
37 | #define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070) | 37 | #define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070) |
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 3a86b0f66031..e9b9bcb19b4e 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -276,14 +276,15 @@ static int __init _omap2_init_reprogram_sdrc(void) | |||
276 | return v; | 276 | return v; |
277 | } | 277 | } |
278 | 278 | ||
279 | void __init omap2_init_common_hw(struct omap_sdrc_params *sp) | 279 | void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0, |
280 | struct omap_sdrc_params *sdrc_cs1) | ||
280 | { | 281 | { |
281 | omap2_mux_init(); | 282 | omap2_mux_init(); |
282 | #ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once the clkdev is ready */ | 283 | #ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once the clkdev is ready */ |
283 | pwrdm_init(powerdomains_omap); | 284 | pwrdm_init(powerdomains_omap); |
284 | clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps); | 285 | clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps); |
285 | omap2_clk_init(); | 286 | omap2_clk_init(); |
286 | omap2_sdrc_init(sp); | 287 | omap2_sdrc_init(sdrc_cs0, sdrc_cs1); |
287 | _omap2_init_reprogram_sdrc(); | 288 | _omap2_init_reprogram_sdrc(); |
288 | #endif | 289 | #endif |
289 | gpmc_init(); | 290 | gpmc_init(); |
diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc-twl4030.c index 1541fd4c8d0f..3c04c2f1b23f 100644 --- a/arch/arm/mach-omap2/mmc-twl4030.c +++ b/arch/arm/mach-omap2/mmc-twl4030.c | |||
@@ -119,6 +119,7 @@ static int twl_mmc_late_init(struct device *dev) | |||
119 | if (i != 0) | 119 | if (i != 0) |
120 | break; | 120 | break; |
121 | ret = PTR_ERR(reg); | 121 | ret = PTR_ERR(reg); |
122 | hsmmc[i].vcc = NULL; | ||
122 | goto err; | 123 | goto err; |
123 | } | 124 | } |
124 | hsmmc[i].vcc = reg; | 125 | hsmmc[i].vcc = reg; |
@@ -165,8 +166,13 @@ done: | |||
165 | static void twl_mmc_cleanup(struct device *dev) | 166 | static void twl_mmc_cleanup(struct device *dev) |
166 | { | 167 | { |
167 | struct omap_mmc_platform_data *mmc = dev->platform_data; | 168 | struct omap_mmc_platform_data *mmc = dev->platform_data; |
169 | int i; | ||
168 | 170 | ||
169 | gpio_free(mmc->slots[0].switch_pin); | 171 | gpio_free(mmc->slots[0].switch_pin); |
172 | for(i = 0; i < ARRAY_SIZE(hsmmc); i++) { | ||
173 | regulator_put(hsmmc[i].vcc); | ||
174 | regulator_put(hsmmc[i].vcc_aux); | ||
175 | } | ||
170 | } | 176 | } |
171 | 177 | ||
172 | #ifdef CONFIG_PM | 178 | #ifdef CONFIG_PM |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 026c4fc883a7..43d6b92b65f2 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -486,6 +486,12 @@ MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c, | |||
486 | OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT) | 486 | OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT) |
487 | MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6, | 487 | MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6, |
488 | OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT) | 488 | OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT) |
489 | |||
490 | /* OMAP3 SDRC CKE signals to SDR/DDR ram chips */ | ||
491 | MUX_CFG_34XX("H16_34XX_SDRC_CKE0", 0x262, | ||
492 | OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT) | ||
493 | MUX_CFG_34XX("H17_34XX_SDRC_CKE1", 0x264, | ||
494 | OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT) | ||
489 | }; | 495 | }; |
490 | 496 | ||
491 | #define OMAP34XX_PINS_SZ ARRAY_SIZE(omap34xx_pins) | 497 | #define OMAP34XX_PINS_SZ ARRAY_SIZE(omap34xx_pins) |
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index f7b3baf76678..21201cd4117b 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h | |||
@@ -11,9 +11,6 @@ | |||
11 | #ifndef __ARCH_ARM_MACH_OMAP2_PM_H | 11 | #ifndef __ARCH_ARM_MACH_OMAP2_PM_H |
12 | #define __ARCH_ARM_MACH_OMAP2_PM_H | 12 | #define __ARCH_ARM_MACH_OMAP2_PM_H |
13 | 13 | ||
14 | extern int omap2_pm_init(void); | ||
15 | extern int omap3_pm_init(void); | ||
16 | |||
17 | #ifdef CONFIG_PM_DEBUG | 14 | #ifdef CONFIG_PM_DEBUG |
18 | extern void omap2_pm_dump(int mode, int resume, unsigned int us); | 15 | extern void omap2_pm_dump(int mode, int resume, unsigned int us); |
19 | extern int omap2_pm_debug; | 16 | extern int omap2_pm_debug; |
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index db1025562fb0..528dbdc26e23 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
@@ -470,7 +470,7 @@ static void __init prcm_setup_regs(void) | |||
470 | WKUP_MOD, PM_WKEN); | 470 | WKUP_MOD, PM_WKEN); |
471 | } | 471 | } |
472 | 472 | ||
473 | int __init omap2_pm_init(void) | 473 | static int __init omap2_pm_init(void) |
474 | { | 474 | { |
475 | u32 l; | 475 | u32 l; |
476 | 476 | ||
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 841d4c5ed8be..488d595d8e4b 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -39,7 +39,9 @@ | |||
39 | struct power_state { | 39 | struct power_state { |
40 | struct powerdomain *pwrdm; | 40 | struct powerdomain *pwrdm; |
41 | u32 next_state; | 41 | u32 next_state; |
42 | #ifdef CONFIG_SUSPEND | ||
42 | u32 saved_state; | 43 | u32 saved_state; |
44 | #endif | ||
43 | struct list_head node; | 45 | struct list_head node; |
44 | }; | 46 | }; |
45 | 47 | ||
@@ -293,6 +295,9 @@ out: | |||
293 | local_irq_enable(); | 295 | local_irq_enable(); |
294 | } | 296 | } |
295 | 297 | ||
298 | #ifdef CONFIG_SUSPEND | ||
299 | static suspend_state_t suspend_state; | ||
300 | |||
296 | static int omap3_pm_prepare(void) | 301 | static int omap3_pm_prepare(void) |
297 | { | 302 | { |
298 | disable_hlt(); | 303 | disable_hlt(); |
@@ -321,7 +326,6 @@ static int omap3_pm_suspend(void) | |||
321 | restore: | 326 | restore: |
322 | /* Restore next_pwrsts */ | 327 | /* Restore next_pwrsts */ |
323 | list_for_each_entry(pwrst, &pwrst_list, node) { | 328 | list_for_each_entry(pwrst, &pwrst_list, node) { |
324 | set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state); | ||
325 | state = pwrdm_read_prev_pwrst(pwrst->pwrdm); | 329 | state = pwrdm_read_prev_pwrst(pwrst->pwrdm); |
326 | if (state > pwrst->next_state) { | 330 | if (state > pwrst->next_state) { |
327 | printk(KERN_INFO "Powerdomain (%s) didn't enter " | 331 | printk(KERN_INFO "Powerdomain (%s) didn't enter " |
@@ -329,6 +333,7 @@ restore: | |||
329 | pwrst->pwrdm->name, pwrst->next_state); | 333 | pwrst->pwrdm->name, pwrst->next_state); |
330 | ret = -1; | 334 | ret = -1; |
331 | } | 335 | } |
336 | set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state); | ||
332 | } | 337 | } |
333 | if (ret) | 338 | if (ret) |
334 | printk(KERN_ERR "Could not enter target state in pm_suspend\n"); | 339 | printk(KERN_ERR "Could not enter target state in pm_suspend\n"); |
@@ -339,11 +344,11 @@ restore: | |||
339 | return ret; | 344 | return ret; |
340 | } | 345 | } |
341 | 346 | ||
342 | static int omap3_pm_enter(suspend_state_t state) | 347 | static int omap3_pm_enter(suspend_state_t unused) |
343 | { | 348 | { |
344 | int ret = 0; | 349 | int ret = 0; |
345 | 350 | ||
346 | switch (state) { | 351 | switch (suspend_state) { |
347 | case PM_SUSPEND_STANDBY: | 352 | case PM_SUSPEND_STANDBY: |
348 | case PM_SUSPEND_MEM: | 353 | case PM_SUSPEND_MEM: |
349 | ret = omap3_pm_suspend(); | 354 | ret = omap3_pm_suspend(); |
@@ -360,12 +365,30 @@ static void omap3_pm_finish(void) | |||
360 | enable_hlt(); | 365 | enable_hlt(); |
361 | } | 366 | } |
362 | 367 | ||
368 | /* Hooks to enable / disable UART interrupts during suspend */ | ||
369 | static int omap3_pm_begin(suspend_state_t state) | ||
370 | { | ||
371 | suspend_state = state; | ||
372 | omap_uart_enable_irqs(0); | ||
373 | return 0; | ||
374 | } | ||
375 | |||
376 | static void omap3_pm_end(void) | ||
377 | { | ||
378 | suspend_state = PM_SUSPEND_ON; | ||
379 | omap_uart_enable_irqs(1); | ||
380 | return; | ||
381 | } | ||
382 | |||
363 | static struct platform_suspend_ops omap_pm_ops = { | 383 | static struct platform_suspend_ops omap_pm_ops = { |
384 | .begin = omap3_pm_begin, | ||
385 | .end = omap3_pm_end, | ||
364 | .prepare = omap3_pm_prepare, | 386 | .prepare = omap3_pm_prepare, |
365 | .enter = omap3_pm_enter, | 387 | .enter = omap3_pm_enter, |
366 | .finish = omap3_pm_finish, | 388 | .finish = omap3_pm_finish, |
367 | .valid = suspend_valid_only_mem, | 389 | .valid = suspend_valid_only_mem, |
368 | }; | 390 | }; |
391 | #endif /* CONFIG_SUSPEND */ | ||
369 | 392 | ||
370 | 393 | ||
371 | /** | 394 | /** |
@@ -613,6 +636,24 @@ static void __init prcm_setup_regs(void) | |||
613 | /* Clear any pending PRCM interrupts */ | 636 | /* Clear any pending PRCM interrupts */ |
614 | prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); | 637 | prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); |
615 | 638 | ||
639 | /* Don't attach IVA interrupts */ | ||
640 | prm_write_mod_reg(0, WKUP_MOD, OMAP3430_PM_IVAGRPSEL); | ||
641 | prm_write_mod_reg(0, CORE_MOD, OMAP3430_PM_IVAGRPSEL1); | ||
642 | prm_write_mod_reg(0, CORE_MOD, OMAP3430ES2_PM_IVAGRPSEL3); | ||
643 | prm_write_mod_reg(0, OMAP3430_PER_MOD, OMAP3430_PM_IVAGRPSEL); | ||
644 | |||
645 | /* Clear any pending 'reset' flags */ | ||
646 | prm_write_mod_reg(0xffffffff, MPU_MOD, RM_RSTST); | ||
647 | prm_write_mod_reg(0xffffffff, CORE_MOD, RM_RSTST); | ||
648 | prm_write_mod_reg(0xffffffff, OMAP3430_PER_MOD, RM_RSTST); | ||
649 | prm_write_mod_reg(0xffffffff, OMAP3430_EMU_MOD, RM_RSTST); | ||
650 | prm_write_mod_reg(0xffffffff, OMAP3430_NEON_MOD, RM_RSTST); | ||
651 | prm_write_mod_reg(0xffffffff, OMAP3430_DSS_MOD, RM_RSTST); | ||
652 | prm_write_mod_reg(0xffffffff, OMAP3430ES2_USBHOST_MOD, RM_RSTST); | ||
653 | |||
654 | /* Clear any pending PRCM interrupts */ | ||
655 | prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); | ||
656 | |||
616 | omap3_iva_idle(); | 657 | omap3_iva_idle(); |
617 | omap3_d2d_idle(); | 658 | omap3_d2d_idle(); |
618 | } | 659 | } |
@@ -652,7 +693,7 @@ static int __init clkdms_setup(struct clockdomain *clkdm) | |||
652 | return 0; | 693 | return 0; |
653 | } | 694 | } |
654 | 695 | ||
655 | int __init omap3_pm_init(void) | 696 | static int __init omap3_pm_init(void) |
656 | { | 697 | { |
657 | struct power_state *pwrst, *tmp; | 698 | struct power_state *pwrst, *tmp; |
658 | int ret; | 699 | int ret; |
@@ -692,7 +733,9 @@ int __init omap3_pm_init(void) | |||
692 | _omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend, | 733 | _omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend, |
693 | omap34xx_cpu_suspend_sz); | 734 | omap34xx_cpu_suspend_sz); |
694 | 735 | ||
736 | #ifdef CONFIG_SUSPEND | ||
695 | suspend_set_ops(&omap_pm_ops); | 737 | suspend_set_ops(&omap_pm_ops); |
738 | #endif /* CONFIG_SUSPEND */ | ||
696 | 739 | ||
697 | pm_idle = omap3_pm_idle; | 740 | pm_idle = omap3_pm_idle; |
698 | 741 | ||
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c index f945156d5585..ced555a4cd1a 100644 --- a/arch/arm/mach-omap2/prcm.c +++ b/arch/arm/mach-omap2/prcm.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <linux/delay.h> | ||
20 | 21 | ||
21 | #include <mach/common.h> | 22 | #include <mach/common.h> |
22 | #include <mach/prcm.h> | 23 | #include <mach/prcm.h> |
@@ -28,6 +29,8 @@ | |||
28 | static void __iomem *prm_base; | 29 | static void __iomem *prm_base; |
29 | static void __iomem *cm_base; | 30 | static void __iomem *cm_base; |
30 | 31 | ||
32 | #define MAX_MODULE_ENABLE_WAIT 100000 | ||
33 | |||
31 | u32 omap_prcm_get_reset_sources(void) | 34 | u32 omap_prcm_get_reset_sources(void) |
32 | { | 35 | { |
33 | /* XXX This presumably needs modification for 34XX */ | 36 | /* XXX This presumably needs modification for 34XX */ |
@@ -120,6 +123,46 @@ u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx) | |||
120 | } | 123 | } |
121 | EXPORT_SYMBOL(cm_rmw_mod_reg_bits); | 124 | EXPORT_SYMBOL(cm_rmw_mod_reg_bits); |
122 | 125 | ||
126 | /** | ||
127 | * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness | ||
128 | * @reg: physical address of module IDLEST register | ||
129 | * @mask: value to mask against to determine if the module is active | ||
130 | * @name: name of the clock (for printk) | ||
131 | * | ||
132 | * Returns 1 if the module indicated readiness in time, or 0 if it | ||
133 | * failed to enable in roughly MAX_MODULE_ENABLE_WAIT microseconds. | ||
134 | */ | ||
135 | int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, const char *name) | ||
136 | { | ||
137 | int i = 0; | ||
138 | int ena = 0; | ||
139 | |||
140 | /* | ||
141 | * 24xx uses 0 to indicate not ready, and 1 to indicate ready. | ||
142 | * 34xx reverses this, just to keep us on our toes | ||
143 | */ | ||
144 | if (cpu_is_omap24xx()) | ||
145 | ena = mask; | ||
146 | else if (cpu_is_omap34xx()) | ||
147 | ena = 0; | ||
148 | else | ||
149 | BUG(); | ||
150 | |||
151 | /* Wait for lock */ | ||
152 | while (((__raw_readl(reg) & mask) != ena) && | ||
153 | (i++ < MAX_MODULE_ENABLE_WAIT)) | ||
154 | udelay(1); | ||
155 | |||
156 | if (i < MAX_MODULE_ENABLE_WAIT) | ||
157 | pr_debug("cm: Module associated with clock %s ready after %d " | ||
158 | "loops\n", name, i); | ||
159 | else | ||
160 | pr_err("cm: Module associated with clock %s didn't enable in " | ||
161 | "%d tries\n", name, MAX_MODULE_ENABLE_WAIT); | ||
162 | |||
163 | return (i < MAX_MODULE_ENABLE_WAIT) ? 1 : 0; | ||
164 | }; | ||
165 | |||
123 | void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals) | 166 | void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals) |
124 | { | 167 | { |
125 | prm_base = omap2_globals->prm; | 168 | prm_base = omap2_globals->prm; |
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c index 2045441e8385..9e3bd4fa7810 100644 --- a/arch/arm/mach-omap2/sdrc.c +++ b/arch/arm/mach-omap2/sdrc.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <mach/sdrc.h> | 32 | #include <mach/sdrc.h> |
33 | #include "sdrc.h" | 33 | #include "sdrc.h" |
34 | 34 | ||
35 | static struct omap_sdrc_params *sdrc_init_params; | 35 | static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1; |
36 | 36 | ||
37 | void __iomem *omap2_sdrc_base; | 37 | void __iomem *omap2_sdrc_base; |
38 | void __iomem *omap2_sms_base; | 38 | void __iomem *omap2_sms_base; |
@@ -45,33 +45,49 @@ void __iomem *omap2_sms_base; | |||
45 | /** | 45 | /** |
46 | * omap2_sdrc_get_params - return SDRC register values for a given clock rate | 46 | * omap2_sdrc_get_params - return SDRC register values for a given clock rate |
47 | * @r: SDRC clock rate (in Hz) | 47 | * @r: SDRC clock rate (in Hz) |
48 | * @sdrc_cs0: chip select 0 ram timings ** | ||
49 | * @sdrc_cs1: chip select 1 ram timings ** | ||
48 | * | 50 | * |
49 | * Return pre-calculated values for the SDRC_ACTIM_CTRLA, | 51 | * Return pre-calculated values for the SDRC_ACTIM_CTRLA, |
50 | * SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL, and SDRC_MR registers, for a given | 52 | * SDRC_ACTIM_CTRLB, SDRC_RFR_CTRL and SDRC_MR registers in sdrc_cs[01] |
51 | * SDRC clock rate 'r'. These parameters control various timing | 53 | * structs,for a given SDRC clock rate 'r'. |
52 | * delays in the SDRAM controller that are expressed in terms of the | 54 | * These parameters control various timing delays in the SDRAM controller |
53 | * number of SDRC clock cycles to wait; hence the clock rate | 55 | * that are expressed in terms of the number of SDRC clock cycles to |
54 | * dependency. Note that sdrc_init_params must be sorted rate | 56 | * wait; hence the clock rate dependency. |
55 | * descending. Also assumes that both chip-selects use the same | 57 | * |
56 | * timing parameters. Returns a struct omap_sdrc_params * upon | 58 | * Supports 2 different timing parameters for both chip selects. |
57 | * success, or NULL upon failure. | 59 | * |
60 | * Note 1: the sdrc_init_params_cs[01] must be sorted rate descending. | ||
61 | * Note 2: If sdrc_init_params_cs_1 is not NULL it must be of same size | ||
62 | * as sdrc_init_params_cs_0. | ||
63 | * | ||
64 | * Fills in the struct omap_sdrc_params * for each chip select. | ||
65 | * Returns 0 upon success or -1 upon failure. | ||
58 | */ | 66 | */ |
59 | struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r) | 67 | int omap2_sdrc_get_params(unsigned long r, |
68 | struct omap_sdrc_params **sdrc_cs0, | ||
69 | struct omap_sdrc_params **sdrc_cs1) | ||
60 | { | 70 | { |
61 | struct omap_sdrc_params *sp; | 71 | struct omap_sdrc_params *sp0, *sp1; |
62 | 72 | ||
63 | if (!sdrc_init_params) | 73 | if (!sdrc_init_params_cs0) |
64 | return NULL; | 74 | return -1; |
65 | 75 | ||
66 | sp = sdrc_init_params; | 76 | sp0 = sdrc_init_params_cs0; |
77 | sp1 = sdrc_init_params_cs1; | ||
67 | 78 | ||
68 | while (sp->rate && sp->rate != r) | 79 | while (sp0->rate && sp0->rate != r) { |
69 | sp++; | 80 | sp0++; |
81 | if (sdrc_init_params_cs1) | ||
82 | sp1++; | ||
83 | } | ||
70 | 84 | ||
71 | if (!sp->rate) | 85 | if (!sp0->rate) |
72 | return NULL; | 86 | return -1; |
73 | 87 | ||
74 | return sp; | 88 | *sdrc_cs0 = sp0; |
89 | *sdrc_cs1 = sp1; | ||
90 | return 0; | ||
75 | } | 91 | } |
76 | 92 | ||
77 | 93 | ||
@@ -83,13 +99,15 @@ void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals) | |||
83 | 99 | ||
84 | /** | 100 | /** |
85 | * omap2_sdrc_init - initialize SMS, SDRC devices on boot | 101 | * omap2_sdrc_init - initialize SMS, SDRC devices on boot |
86 | * @sp: pointer to a null-terminated list of struct omap_sdrc_params | 102 | * @sdrc_cs[01]: pointers to a null-terminated list of struct omap_sdrc_params |
103 | * Support for 2 chip selects timings | ||
87 | * | 104 | * |
88 | * Turn on smart idle modes for SDRAM scheduler and controller. | 105 | * Turn on smart idle modes for SDRAM scheduler and controller. |
89 | * Program a known-good configuration for the SDRC to deal with buggy | 106 | * Program a known-good configuration for the SDRC to deal with buggy |
90 | * bootloaders. | 107 | * bootloaders. |
91 | */ | 108 | */ |
92 | void __init omap2_sdrc_init(struct omap_sdrc_params *sp) | 109 | void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0, |
110 | struct omap_sdrc_params *sdrc_cs1) | ||
93 | { | 111 | { |
94 | u32 l; | 112 | u32 l; |
95 | 113 | ||
@@ -103,11 +121,15 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sp) | |||
103 | l |= (0x2 << 3); | 121 | l |= (0x2 << 3); |
104 | sdrc_write_reg(l, SDRC_SYSCONFIG); | 122 | sdrc_write_reg(l, SDRC_SYSCONFIG); |
105 | 123 | ||
106 | sdrc_init_params = sp; | 124 | sdrc_init_params_cs0 = sdrc_cs0; |
125 | sdrc_init_params_cs1 = sdrc_cs1; | ||
107 | 126 | ||
108 | /* XXX Enable SRFRONIDLEREQ here also? */ | 127 | /* XXX Enable SRFRONIDLEREQ here also? */ |
128 | /* | ||
129 | * PWDENA should not be set due to 34xx erratum 1.150 - PWDENA | ||
130 | * can cause random memory corruption | ||
131 | */ | ||
109 | l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) | | 132 | l = (1 << SDRC_POWER_EXTCLKDIS_SHIFT) | |
110 | (1 << SDRC_POWER_PWDENA_SHIFT) | | ||
111 | (1 << SDRC_POWER_PAGEPOLICY_SHIFT); | 133 | (1 << SDRC_POWER_PAGEPOLICY_SHIFT); |
112 | sdrc_write_reg(l, SDRC_POWER); | 134 | sdrc_write_reg(l, SDRC_POWER); |
113 | } | 135 | } |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index b094c15bfe47..a7421a50410b 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -54,6 +54,7 @@ struct omap_uart_state { | |||
54 | 54 | ||
55 | struct plat_serial8250_port *p; | 55 | struct plat_serial8250_port *p; |
56 | struct list_head node; | 56 | struct list_head node; |
57 | struct platform_device pdev; | ||
57 | 58 | ||
58 | #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) | 59 | #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) |
59 | int context_valid; | 60 | int context_valid; |
@@ -68,10 +69,9 @@ struct omap_uart_state { | |||
68 | #endif | 69 | #endif |
69 | }; | 70 | }; |
70 | 71 | ||
71 | static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS]; | ||
72 | static LIST_HEAD(uart_list); | 72 | static LIST_HEAD(uart_list); |
73 | 73 | ||
74 | static struct plat_serial8250_port serial_platform_data[] = { | 74 | static struct plat_serial8250_port serial_platform_data0[] = { |
75 | { | 75 | { |
76 | .membase = IO_ADDRESS(OMAP_UART1_BASE), | 76 | .membase = IO_ADDRESS(OMAP_UART1_BASE), |
77 | .mapbase = OMAP_UART1_BASE, | 77 | .mapbase = OMAP_UART1_BASE, |
@@ -81,6 +81,12 @@ static struct plat_serial8250_port serial_platform_data[] = { | |||
81 | .regshift = 2, | 81 | .regshift = 2, |
82 | .uartclk = OMAP24XX_BASE_BAUD * 16, | 82 | .uartclk = OMAP24XX_BASE_BAUD * 16, |
83 | }, { | 83 | }, { |
84 | .flags = 0 | ||
85 | } | ||
86 | }; | ||
87 | |||
88 | static struct plat_serial8250_port serial_platform_data1[] = { | ||
89 | { | ||
84 | .membase = IO_ADDRESS(OMAP_UART2_BASE), | 90 | .membase = IO_ADDRESS(OMAP_UART2_BASE), |
85 | .mapbase = OMAP_UART2_BASE, | 91 | .mapbase = OMAP_UART2_BASE, |
86 | .irq = 73, | 92 | .irq = 73, |
@@ -89,6 +95,12 @@ static struct plat_serial8250_port serial_platform_data[] = { | |||
89 | .regshift = 2, | 95 | .regshift = 2, |
90 | .uartclk = OMAP24XX_BASE_BAUD * 16, | 96 | .uartclk = OMAP24XX_BASE_BAUD * 16, |
91 | }, { | 97 | }, { |
98 | .flags = 0 | ||
99 | } | ||
100 | }; | ||
101 | |||
102 | static struct plat_serial8250_port serial_platform_data2[] = { | ||
103 | { | ||
92 | .membase = IO_ADDRESS(OMAP_UART3_BASE), | 104 | .membase = IO_ADDRESS(OMAP_UART3_BASE), |
93 | .mapbase = OMAP_UART3_BASE, | 105 | .mapbase = OMAP_UART3_BASE, |
94 | .irq = 74, | 106 | .irq = 74, |
@@ -217,6 +229,40 @@ static inline void omap_uart_disable_clocks(struct omap_uart_state *uart) | |||
217 | clk_disable(uart->fck); | 229 | clk_disable(uart->fck); |
218 | } | 230 | } |
219 | 231 | ||
232 | static void omap_uart_enable_wakeup(struct omap_uart_state *uart) | ||
233 | { | ||
234 | /* Set wake-enable bit */ | ||
235 | if (uart->wk_en && uart->wk_mask) { | ||
236 | u32 v = __raw_readl(uart->wk_en); | ||
237 | v |= uart->wk_mask; | ||
238 | __raw_writel(v, uart->wk_en); | ||
239 | } | ||
240 | |||
241 | /* Ensure IOPAD wake-enables are set */ | ||
242 | if (cpu_is_omap34xx() && uart->padconf) { | ||
243 | u16 v = omap_ctrl_readw(uart->padconf); | ||
244 | v |= OMAP3_PADCONF_WAKEUPENABLE0; | ||
245 | omap_ctrl_writew(v, uart->padconf); | ||
246 | } | ||
247 | } | ||
248 | |||
249 | static void omap_uart_disable_wakeup(struct omap_uart_state *uart) | ||
250 | { | ||
251 | /* Clear wake-enable bit */ | ||
252 | if (uart->wk_en && uart->wk_mask) { | ||
253 | u32 v = __raw_readl(uart->wk_en); | ||
254 | v &= ~uart->wk_mask; | ||
255 | __raw_writel(v, uart->wk_en); | ||
256 | } | ||
257 | |||
258 | /* Ensure IOPAD wake-enables are cleared */ | ||
259 | if (cpu_is_omap34xx() && uart->padconf) { | ||
260 | u16 v = omap_ctrl_readw(uart->padconf); | ||
261 | v &= ~OMAP3_PADCONF_WAKEUPENABLE0; | ||
262 | omap_ctrl_writew(v, uart->padconf); | ||
263 | } | ||
264 | } | ||
265 | |||
220 | static void omap_uart_smart_idle_enable(struct omap_uart_state *uart, | 266 | static void omap_uart_smart_idle_enable(struct omap_uart_state *uart, |
221 | int enable) | 267 | int enable) |
222 | { | 268 | { |
@@ -246,6 +292,11 @@ static void omap_uart_block_sleep(struct omap_uart_state *uart) | |||
246 | 292 | ||
247 | static void omap_uart_allow_sleep(struct omap_uart_state *uart) | 293 | static void omap_uart_allow_sleep(struct omap_uart_state *uart) |
248 | { | 294 | { |
295 | if (device_may_wakeup(&uart->pdev.dev)) | ||
296 | omap_uart_enable_wakeup(uart); | ||
297 | else | ||
298 | omap_uart_disable_wakeup(uart); | ||
299 | |||
249 | if (!uart->clocked) | 300 | if (!uart->clocked) |
250 | return; | 301 | return; |
251 | 302 | ||
@@ -292,7 +343,6 @@ void omap_uart_resume_idle(int num) | |||
292 | /* Check for normal UART wakeup */ | 343 | /* Check for normal UART wakeup */ |
293 | if (__raw_readl(uart->wk_st) & uart->wk_mask) | 344 | if (__raw_readl(uart->wk_st) & uart->wk_mask) |
294 | omap_uart_block_sleep(uart); | 345 | omap_uart_block_sleep(uart); |
295 | |||
296 | return; | 346 | return; |
297 | } | 347 | } |
298 | } | 348 | } |
@@ -346,16 +396,13 @@ static irqreturn_t omap_uart_interrupt(int irq, void *dev_id) | |||
346 | return IRQ_NONE; | 396 | return IRQ_NONE; |
347 | } | 397 | } |
348 | 398 | ||
349 | static u32 sleep_timeout = DEFAULT_TIMEOUT; | ||
350 | |||
351 | static void omap_uart_idle_init(struct omap_uart_state *uart) | 399 | static void omap_uart_idle_init(struct omap_uart_state *uart) |
352 | { | 400 | { |
353 | u32 v; | ||
354 | struct plat_serial8250_port *p = uart->p; | 401 | struct plat_serial8250_port *p = uart->p; |
355 | int ret; | 402 | int ret; |
356 | 403 | ||
357 | uart->can_sleep = 0; | 404 | uart->can_sleep = 0; |
358 | uart->timeout = sleep_timeout; | 405 | uart->timeout = DEFAULT_TIMEOUT; |
359 | setup_timer(&uart->timer, omap_uart_idle_timer, | 406 | setup_timer(&uart->timer, omap_uart_idle_timer, |
360 | (unsigned long) uart); | 407 | (unsigned long) uart); |
361 | mod_timer(&uart->timer, jiffies + uart->timeout); | 408 | mod_timer(&uart->timer, jiffies + uart->timeout); |
@@ -413,76 +460,101 @@ static void omap_uart_idle_init(struct omap_uart_state *uart) | |||
413 | uart->padconf = 0; | 460 | uart->padconf = 0; |
414 | } | 461 | } |
415 | 462 | ||
416 | /* Set wake-enable bit */ | ||
417 | if (uart->wk_en && uart->wk_mask) { | ||
418 | v = __raw_readl(uart->wk_en); | ||
419 | v |= uart->wk_mask; | ||
420 | __raw_writel(v, uart->wk_en); | ||
421 | } | ||
422 | |||
423 | /* Ensure IOPAD wake-enables are set */ | ||
424 | if (cpu_is_omap34xx() && uart->padconf) { | ||
425 | u16 v; | ||
426 | |||
427 | v = omap_ctrl_readw(uart->padconf); | ||
428 | v |= OMAP3_PADCONF_WAKEUPENABLE0; | ||
429 | omap_ctrl_writew(v, uart->padconf); | ||
430 | } | ||
431 | |||
432 | p->flags |= UPF_SHARE_IRQ; | 463 | p->flags |= UPF_SHARE_IRQ; |
433 | ret = request_irq(p->irq, omap_uart_interrupt, IRQF_SHARED, | 464 | ret = request_irq(p->irq, omap_uart_interrupt, IRQF_SHARED, |
434 | "serial idle", (void *)uart); | 465 | "serial idle", (void *)uart); |
435 | WARN_ON(ret); | 466 | WARN_ON(ret); |
436 | } | 467 | } |
437 | 468 | ||
438 | static ssize_t sleep_timeout_show(struct kobject *kobj, | 469 | void omap_uart_enable_irqs(int enable) |
439 | struct kobj_attribute *attr, | 470 | { |
471 | int ret; | ||
472 | struct omap_uart_state *uart; | ||
473 | |||
474 | list_for_each_entry(uart, &uart_list, node) { | ||
475 | if (enable) | ||
476 | ret = request_irq(uart->p->irq, omap_uart_interrupt, | ||
477 | IRQF_SHARED, "serial idle", (void *)uart); | ||
478 | else | ||
479 | free_irq(uart->p->irq, (void *)uart); | ||
480 | } | ||
481 | } | ||
482 | |||
483 | static ssize_t sleep_timeout_show(struct device *dev, | ||
484 | struct device_attribute *attr, | ||
440 | char *buf) | 485 | char *buf) |
441 | { | 486 | { |
442 | return sprintf(buf, "%u\n", sleep_timeout / HZ); | 487 | struct platform_device *pdev = container_of(dev, |
488 | struct platform_device, dev); | ||
489 | struct omap_uart_state *uart = container_of(pdev, | ||
490 | struct omap_uart_state, pdev); | ||
491 | |||
492 | return sprintf(buf, "%u\n", uart->timeout / HZ); | ||
443 | } | 493 | } |
444 | 494 | ||
445 | static ssize_t sleep_timeout_store(struct kobject *kobj, | 495 | static ssize_t sleep_timeout_store(struct device *dev, |
446 | struct kobj_attribute *attr, | 496 | struct device_attribute *attr, |
447 | const char *buf, size_t n) | 497 | const char *buf, size_t n) |
448 | { | 498 | { |
449 | struct omap_uart_state *uart; | 499 | struct platform_device *pdev = container_of(dev, |
500 | struct platform_device, dev); | ||
501 | struct omap_uart_state *uart = container_of(pdev, | ||
502 | struct omap_uart_state, pdev); | ||
450 | unsigned int value; | 503 | unsigned int value; |
451 | 504 | ||
452 | if (sscanf(buf, "%u", &value) != 1) { | 505 | if (sscanf(buf, "%u", &value) != 1) { |
453 | printk(KERN_ERR "sleep_timeout_store: Invalid value\n"); | 506 | printk(KERN_ERR "sleep_timeout_store: Invalid value\n"); |
454 | return -EINVAL; | 507 | return -EINVAL; |
455 | } | 508 | } |
456 | sleep_timeout = value * HZ; | 509 | |
457 | list_for_each_entry(uart, &uart_list, node) { | 510 | uart->timeout = value * HZ; |
458 | uart->timeout = sleep_timeout; | 511 | if (uart->timeout) |
459 | if (uart->timeout) | 512 | mod_timer(&uart->timer, jiffies + uart->timeout); |
460 | mod_timer(&uart->timer, jiffies + uart->timeout); | 513 | else |
461 | else | 514 | /* A zero value means disable timeout feature */ |
462 | /* A zero value means disable timeout feature */ | 515 | omap_uart_block_sleep(uart); |
463 | omap_uart_block_sleep(uart); | 516 | |
464 | } | ||
465 | return n; | 517 | return n; |
466 | } | 518 | } |
467 | 519 | ||
468 | static struct kobj_attribute sleep_timeout_attr = | 520 | DEVICE_ATTR(sleep_timeout, 0644, sleep_timeout_show, sleep_timeout_store); |
469 | __ATTR(sleep_timeout, 0644, sleep_timeout_show, sleep_timeout_store); | 521 | #define DEV_CREATE_FILE(dev, attr) WARN_ON(device_create_file(dev, attr)) |
470 | |||
471 | #else | 522 | #else |
472 | static inline void omap_uart_idle_init(struct omap_uart_state *uart) {} | 523 | static inline void omap_uart_idle_init(struct omap_uart_state *uart) {} |
524 | #define DEV_CREATE_FILE(dev, attr) | ||
473 | #endif /* CONFIG_PM */ | 525 | #endif /* CONFIG_PM */ |
474 | 526 | ||
475 | static struct platform_device serial_device = { | 527 | static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = { |
476 | .name = "serial8250", | 528 | { |
477 | .id = PLAT8250_DEV_PLATFORM, | 529 | .pdev = { |
478 | .dev = { | 530 | .name = "serial8250", |
479 | .platform_data = serial_platform_data, | 531 | .id = PLAT8250_DEV_PLATFORM, |
532 | .dev = { | ||
533 | .platform_data = serial_platform_data0, | ||
534 | }, | ||
535 | }, | ||
536 | }, { | ||
537 | .pdev = { | ||
538 | .name = "serial8250", | ||
539 | .id = PLAT8250_DEV_PLATFORM1, | ||
540 | .dev = { | ||
541 | .platform_data = serial_platform_data1, | ||
542 | }, | ||
543 | }, | ||
544 | }, { | ||
545 | .pdev = { | ||
546 | .name = "serial8250", | ||
547 | .id = PLAT8250_DEV_PLATFORM2, | ||
548 | .dev = { | ||
549 | .platform_data = serial_platform_data2, | ||
550 | }, | ||
551 | }, | ||
480 | }, | 552 | }, |
481 | }; | 553 | }; |
482 | 554 | ||
483 | void __init omap_serial_init(void) | 555 | void __init omap_serial_init(void) |
484 | { | 556 | { |
485 | int i, err; | 557 | int i; |
486 | const struct omap_uart_config *info; | 558 | const struct omap_uart_config *info; |
487 | char name[16]; | 559 | char name[16]; |
488 | 560 | ||
@@ -496,14 +568,12 @@ void __init omap_serial_init(void) | |||
496 | 568 | ||
497 | if (info == NULL) | 569 | if (info == NULL) |
498 | return; | 570 | return; |
499 | if (cpu_is_omap44xx()) { | ||
500 | for (i = 0; i < OMAP_MAX_NR_PORTS; i++) | ||
501 | serial_platform_data[i].irq += 32; | ||
502 | } | ||
503 | 571 | ||
504 | for (i = 0; i < OMAP_MAX_NR_PORTS; i++) { | 572 | for (i = 0; i < OMAP_MAX_NR_PORTS; i++) { |
505 | struct plat_serial8250_port *p = serial_platform_data + i; | ||
506 | struct omap_uart_state *uart = &omap_uart[i]; | 573 | struct omap_uart_state *uart = &omap_uart[i]; |
574 | struct platform_device *pdev = &uart->pdev; | ||
575 | struct device *dev = &pdev->dev; | ||
576 | struct plat_serial8250_port *p = dev->platform_data; | ||
507 | 577 | ||
508 | if (!(info->enabled_uarts & (1 << i))) { | 578 | if (!(info->enabled_uarts & (1 << i))) { |
509 | p->membase = NULL; | 579 | p->membase = NULL; |
@@ -531,20 +601,21 @@ void __init omap_serial_init(void) | |||
531 | uart->num = i; | 601 | uart->num = i; |
532 | p->private_data = uart; | 602 | p->private_data = uart; |
533 | uart->p = p; | 603 | uart->p = p; |
534 | list_add(&uart->node, &uart_list); | 604 | list_add_tail(&uart->node, &uart_list); |
605 | |||
606 | if (cpu_is_omap44xx()) | ||
607 | p->irq += 32; | ||
535 | 608 | ||
536 | omap_uart_enable_clocks(uart); | 609 | omap_uart_enable_clocks(uart); |
537 | omap_uart_reset(uart); | 610 | omap_uart_reset(uart); |
538 | omap_uart_idle_init(uart); | 611 | omap_uart_idle_init(uart); |
539 | } | ||
540 | |||
541 | err = platform_device_register(&serial_device); | ||
542 | |||
543 | #ifdef CONFIG_PM | ||
544 | if (!err) | ||
545 | err = sysfs_create_file(&serial_device.dev.kobj, | ||
546 | &sleep_timeout_attr.attr); | ||
547 | #endif | ||
548 | 612 | ||
613 | if (WARN_ON(platform_device_register(pdev))) | ||
614 | continue; | ||
615 | if ((cpu_is_omap34xx() && uart->padconf) || | ||
616 | (uart->wk_en && uart->wk_mask)) { | ||
617 | device_init_wakeup(dev, true); | ||
618 | DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout); | ||
619 | } | ||
620 | } | ||
549 | } | 621 | } |
550 | |||
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S index f41f8d96ddba..82aa4a3d160c 100644 --- a/arch/arm/mach-omap2/sram34xx.S +++ b/arch/arm/mach-omap2/sram34xx.S | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | .text | 37 | .text |
38 | 38 | ||
39 | /* r4 parameters */ | 39 | /* r1 parameters */ |
40 | #define SDRC_NO_UNLOCK_DLL 0x0 | 40 | #define SDRC_NO_UNLOCK_DLL 0x0 |
41 | #define SDRC_UNLOCK_DLL 0x1 | 41 | #define SDRC_UNLOCK_DLL 0x1 |
42 | 42 | ||
@@ -58,7 +58,6 @@ | |||
58 | 58 | ||
59 | /* SDRC_POWER bit settings */ | 59 | /* SDRC_POWER bit settings */ |
60 | #define SRFRONIDLEREQ_MASK 0x40 | 60 | #define SRFRONIDLEREQ_MASK 0x40 |
61 | #define PWDENA_MASK 0x4 | ||
62 | 61 | ||
63 | /* CM_IDLEST1_CORE bit settings */ | 62 | /* CM_IDLEST1_CORE bit settings */ |
64 | #define ST_SDRC_MASK 0x2 | 63 | #define ST_SDRC_MASK 0x2 |
@@ -71,41 +70,72 @@ | |||
71 | 70 | ||
72 | /* | 71 | /* |
73 | * omap3_sram_configure_core_dpll - change DPLL3 M2 divider | 72 | * omap3_sram_configure_core_dpll - change DPLL3 M2 divider |
74 | * r0 = new SDRC_RFR_CTRL register contents | 73 | * |
75 | * r1 = new SDRC_ACTIM_CTRLA register contents | 74 | * Params passed in registers: |
76 | * r2 = new SDRC_ACTIM_CTRLB register contents | 75 | * r0 = new M2 divider setting (only 1 and 2 supported right now) |
77 | * r3 = new M2 divider setting (only 1 and 2 supported right now) | 76 | * r1 = unlock SDRC DLL? (1 = yes, 0 = no). Only unlock DLL for |
78 | * r4 = unlock SDRC DLL? (1 = yes, 0 = no). Only unlock DLL for | ||
79 | * SDRC rates < 83MHz | 77 | * SDRC rates < 83MHz |
80 | * r5 = number of MPU cycles to wait for SDRC to stabilize after | 78 | * r2 = number of MPU cycles to wait for SDRC to stabilize after |
81 | * reprogramming the SDRC when switching to a slower MPU speed | 79 | * reprogramming the SDRC when switching to a slower MPU speed |
82 | * r6 = new SDRC_MR_0 register value | 80 | * r3 = increasing SDRC rate? (1 = yes, 0 = no) |
83 | * r7 = increasing SDRC rate? (1 = yes, 0 = no) | 81 | * |
82 | * Params passed via the stack. The needed params will be copied in SRAM | ||
83 | * before use by the code in SRAM (SDRAM is not accessible during SDRC | ||
84 | * reconfiguration): | ||
85 | * new SDRC_RFR_CTRL_0 register contents | ||
86 | * new SDRC_ACTIM_CTRL_A_0 register contents | ||
87 | * new SDRC_ACTIM_CTRL_B_0 register contents | ||
88 | * new SDRC_MR_0 register value | ||
89 | * new SDRC_RFR_CTRL_1 register contents | ||
90 | * new SDRC_ACTIM_CTRL_A_1 register contents | ||
91 | * new SDRC_ACTIM_CTRL_B_1 register contents | ||
92 | * new SDRC_MR_1 register value | ||
84 | * | 93 | * |
94 | * If the param SDRC_RFR_CTRL_1 is 0, the parameters | ||
95 | * are not programmed into the SDRC CS1 registers | ||
85 | */ | 96 | */ |
86 | ENTRY(omap3_sram_configure_core_dpll) | 97 | ENTRY(omap3_sram_configure_core_dpll) |
87 | stmfd sp!, {r1-r12, lr} @ store regs to stack | 98 | stmfd sp!, {r1-r12, lr} @ store regs to stack |
88 | ldr r4, [sp, #52] @ pull extra args off the stack | 99 | |
89 | ldr r5, [sp, #56] @ load extra args from the stack | 100 | @ pull the extra args off the stack |
90 | ldr r6, [sp, #60] @ load extra args from the stack | 101 | @ and store them in SRAM |
91 | ldr r7, [sp, #64] @ load extra args from the stack | 102 | ldr r4, [sp, #52] |
103 | str r4, omap_sdrc_rfr_ctrl_0_val | ||
104 | ldr r4, [sp, #56] | ||
105 | str r4, omap_sdrc_actim_ctrl_a_0_val | ||
106 | ldr r4, [sp, #60] | ||
107 | str r4, omap_sdrc_actim_ctrl_b_0_val | ||
108 | ldr r4, [sp, #64] | ||
109 | str r4, omap_sdrc_mr_0_val | ||
110 | ldr r4, [sp, #68] | ||
111 | str r4, omap_sdrc_rfr_ctrl_1_val | ||
112 | cmp r4, #0 @ if SDRC_RFR_CTRL_1 is 0, | ||
113 | beq skip_cs1_params @ do not use cs1 params | ||
114 | ldr r4, [sp, #72] | ||
115 | str r4, omap_sdrc_actim_ctrl_a_1_val | ||
116 | ldr r4, [sp, #76] | ||
117 | str r4, omap_sdrc_actim_ctrl_b_1_val | ||
118 | ldr r4, [sp, #80] | ||
119 | str r4, omap_sdrc_mr_1_val | ||
120 | skip_cs1_params: | ||
92 | dsb @ flush buffered writes to interconnect | 121 | dsb @ flush buffered writes to interconnect |
93 | cmp r7, #1 @ if increasing SDRC clk rate, | 122 | |
123 | cmp r3, #1 @ if increasing SDRC clk rate, | ||
94 | bleq configure_sdrc @ program the SDRC regs early (for RFR) | 124 | bleq configure_sdrc @ program the SDRC regs early (for RFR) |
95 | cmp r4, #SDRC_UNLOCK_DLL @ set the intended DLL state | 125 | cmp r1, #SDRC_UNLOCK_DLL @ set the intended DLL state |
96 | bleq unlock_dll | 126 | bleq unlock_dll |
97 | blne lock_dll | 127 | blne lock_dll |
98 | bl sdram_in_selfrefresh @ put SDRAM in self refresh, idle SDRC | 128 | bl sdram_in_selfrefresh @ put SDRAM in self refresh, idle SDRC |
99 | bl configure_core_dpll @ change the DPLL3 M2 divider | 129 | bl configure_core_dpll @ change the DPLL3 M2 divider |
130 | mov r12, r2 | ||
131 | bl wait_clk_stable @ wait for SDRC to stabilize | ||
100 | bl enable_sdrc @ take SDRC out of idle | 132 | bl enable_sdrc @ take SDRC out of idle |
101 | cmp r4, #SDRC_UNLOCK_DLL @ wait for DLL status to change | 133 | cmp r1, #SDRC_UNLOCK_DLL @ wait for DLL status to change |
102 | bleq wait_dll_unlock | 134 | bleq wait_dll_unlock |
103 | blne wait_dll_lock | 135 | blne wait_dll_lock |
104 | cmp r7, #1 @ if increasing SDRC clk rate, | 136 | cmp r3, #1 @ if increasing SDRC clk rate, |
105 | beq return_to_sdram @ return to SDRAM code, otherwise, | 137 | beq return_to_sdram @ return to SDRAM code, otherwise, |
106 | bl configure_sdrc @ reprogram SDRC regs now | 138 | bl configure_sdrc @ reprogram SDRC regs now |
107 | mov r12, r5 | ||
108 | bl wait_clk_stable @ wait for SDRC to stabilize | ||
109 | return_to_sdram: | 139 | return_to_sdram: |
110 | isb @ prevent speculative exec past here | 140 | isb @ prevent speculative exec past here |
111 | mov r0, #0 @ return value | 141 | mov r0, #0 @ return value |
@@ -113,7 +143,7 @@ return_to_sdram: | |||
113 | unlock_dll: | 143 | unlock_dll: |
114 | ldr r11, omap3_sdrc_dlla_ctrl | 144 | ldr r11, omap3_sdrc_dlla_ctrl |
115 | ldr r12, [r11] | 145 | ldr r12, [r11] |
116 | and r12, r12, #FIXEDDELAY_MASK | 146 | bic r12, r12, #FIXEDDELAY_MASK |
117 | orr r12, r12, #FIXEDDELAY_DEFAULT | 147 | orr r12, r12, #FIXEDDELAY_DEFAULT |
118 | orr r12, r12, #DLLIDLE_MASK | 148 | orr r12, r12, #DLLIDLE_MASK |
119 | str r12, [r11] @ (no OCP barrier needed) | 149 | str r12, [r11] @ (no OCP barrier needed) |
@@ -129,7 +159,6 @@ sdram_in_selfrefresh: | |||
129 | ldr r12, [r11] @ read the contents of SDRC_POWER | 159 | ldr r12, [r11] @ read the contents of SDRC_POWER |
130 | mov r9, r12 @ keep a copy of SDRC_POWER bits | 160 | mov r9, r12 @ keep a copy of SDRC_POWER bits |
131 | orr r12, r12, #SRFRONIDLEREQ_MASK @ enable self refresh on idle | 161 | orr r12, r12, #SRFRONIDLEREQ_MASK @ enable self refresh on idle |
132 | bic r12, r12, #PWDENA_MASK @ clear PWDENA | ||
133 | str r12, [r11] @ write back to SDRC_POWER register | 162 | str r12, [r11] @ write back to SDRC_POWER register |
134 | ldr r12, [r11] @ posted-write barrier for SDRC | 163 | ldr r12, [r11] @ posted-write barrier for SDRC |
135 | idle_sdrc: | 164 | idle_sdrc: |
@@ -149,7 +178,7 @@ configure_core_dpll: | |||
149 | ldr r12, [r11] | 178 | ldr r12, [r11] |
150 | ldr r10, core_m2_mask_val @ modify m2 for core dpll | 179 | ldr r10, core_m2_mask_val @ modify m2 for core dpll |
151 | and r12, r12, r10 | 180 | and r12, r12, r10 |
152 | orr r12, r12, r3, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT | 181 | orr r12, r12, r0, lsl #CORE_DPLL_CLKOUT_DIV_SHIFT |
153 | str r12, [r11] | 182 | str r12, [r11] |
154 | ldr r12, [r11] @ posted-write barrier for CM | 183 | ldr r12, [r11] @ posted-write barrier for CM |
155 | bx lr | 184 | bx lr |
@@ -187,15 +216,34 @@ wait_dll_unlock: | |||
187 | bne wait_dll_unlock | 216 | bne wait_dll_unlock |
188 | bx lr | 217 | bx lr |
189 | configure_sdrc: | 218 | configure_sdrc: |
190 | ldr r11, omap3_sdrc_rfr_ctrl | 219 | ldr r12, omap_sdrc_rfr_ctrl_0_val @ fetch value from SRAM |
191 | str r0, [r11] | 220 | ldr r11, omap3_sdrc_rfr_ctrl_0 @ fetch addr from SRAM |
192 | ldr r11, omap3_sdrc_actim_ctrla | 221 | str r12, [r11] @ store |
193 | str r1, [r11] | 222 | ldr r12, omap_sdrc_actim_ctrl_a_0_val |
194 | ldr r11, omap3_sdrc_actim_ctrlb | 223 | ldr r11, omap3_sdrc_actim_ctrl_a_0 |
195 | str r2, [r11] | 224 | str r12, [r11] |
225 | ldr r12, omap_sdrc_actim_ctrl_b_0_val | ||
226 | ldr r11, omap3_sdrc_actim_ctrl_b_0 | ||
227 | str r12, [r11] | ||
228 | ldr r12, omap_sdrc_mr_0_val | ||
196 | ldr r11, omap3_sdrc_mr_0 | 229 | ldr r11, omap3_sdrc_mr_0 |
197 | str r6, [r11] | 230 | str r12, [r11] |
198 | ldr r6, [r11] @ posted-write barrier for SDRC | 231 | ldr r12, omap_sdrc_rfr_ctrl_1_val |
232 | cmp r12, #0 @ if SDRC_RFR_CTRL_1 is 0, | ||
233 | beq skip_cs1_prog @ do not program cs1 params | ||
234 | ldr r11, omap3_sdrc_rfr_ctrl_1 | ||
235 | str r12, [r11] | ||
236 | ldr r12, omap_sdrc_actim_ctrl_a_1_val | ||
237 | ldr r11, omap3_sdrc_actim_ctrl_a_1 | ||
238 | str r12, [r11] | ||
239 | ldr r12, omap_sdrc_actim_ctrl_b_1_val | ||
240 | ldr r11, omap3_sdrc_actim_ctrl_b_1 | ||
241 | str r12, [r11] | ||
242 | ldr r12, omap_sdrc_mr_1_val | ||
243 | ldr r11, omap3_sdrc_mr_1 | ||
244 | str r12, [r11] | ||
245 | skip_cs1_prog: | ||
246 | ldr r12, [r11] @ posted-write barrier for SDRC | ||
199 | bx lr | 247 | bx lr |
200 | 248 | ||
201 | omap3_sdrc_power: | 249 | omap3_sdrc_power: |
@@ -206,14 +254,40 @@ omap3_cm_idlest1_core: | |||
206 | .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST) | 254 | .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_IDLEST) |
207 | omap3_cm_iclken1_core: | 255 | omap3_cm_iclken1_core: |
208 | .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_ICLKEN1) | 256 | .word OMAP34XX_CM_REGADDR(CORE_MOD, CM_ICLKEN1) |
209 | omap3_sdrc_rfr_ctrl: | 257 | |
258 | omap3_sdrc_rfr_ctrl_0: | ||
210 | .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_0) | 259 | .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_0) |
211 | omap3_sdrc_actim_ctrla: | 260 | omap3_sdrc_rfr_ctrl_1: |
261 | .word OMAP34XX_SDRC_REGADDR(SDRC_RFR_CTRL_1) | ||
262 | omap3_sdrc_actim_ctrl_a_0: | ||
212 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0) | 263 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_0) |
213 | omap3_sdrc_actim_ctrlb: | 264 | omap3_sdrc_actim_ctrl_a_1: |
265 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_A_1) | ||
266 | omap3_sdrc_actim_ctrl_b_0: | ||
214 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0) | 267 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_0) |
268 | omap3_sdrc_actim_ctrl_b_1: | ||
269 | .word OMAP34XX_SDRC_REGADDR(SDRC_ACTIM_CTRL_B_1) | ||
215 | omap3_sdrc_mr_0: | 270 | omap3_sdrc_mr_0: |
216 | .word OMAP34XX_SDRC_REGADDR(SDRC_MR_0) | 271 | .word OMAP34XX_SDRC_REGADDR(SDRC_MR_0) |
272 | omap3_sdrc_mr_1: | ||
273 | .word OMAP34XX_SDRC_REGADDR(SDRC_MR_1) | ||
274 | omap_sdrc_rfr_ctrl_0_val: | ||
275 | .word 0xDEADBEEF | ||
276 | omap_sdrc_rfr_ctrl_1_val: | ||
277 | .word 0xDEADBEEF | ||
278 | omap_sdrc_actim_ctrl_a_0_val: | ||
279 | .word 0xDEADBEEF | ||
280 | omap_sdrc_actim_ctrl_a_1_val: | ||
281 | .word 0xDEADBEEF | ||
282 | omap_sdrc_actim_ctrl_b_0_val: | ||
283 | .word 0xDEADBEEF | ||
284 | omap_sdrc_actim_ctrl_b_1_val: | ||
285 | .word 0xDEADBEEF | ||
286 | omap_sdrc_mr_0_val: | ||
287 | .word 0xDEADBEEF | ||
288 | omap_sdrc_mr_1_val: | ||
289 | .word 0xDEADBEEF | ||
290 | |||
217 | omap3_sdrc_dlla_status: | 291 | omap3_sdrc_dlla_status: |
218 | .word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS) | 292 | .word OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS) |
219 | omap3_sdrc_dlla_ctrl: | 293 | omap3_sdrc_dlla_ctrl: |
@@ -223,3 +297,4 @@ core_m2_mask_val: | |||
223 | 297 | ||
224 | ENTRY(omap3_sram_configure_core_dpll_sz) | 298 | ENTRY(omap3_sram_configure_core_dpll_sz) |
225 | .word . - omap3_sram_configure_core_dpll | 299 | .word . - omap3_sram_configure_core_dpll |
300 | |||
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c index 7936085dd758..2e9b8ccd8ec2 100644 --- a/arch/arm/mach-u300/core.c +++ b/arch/arm/mach-u300/core.c | |||
@@ -510,7 +510,7 @@ static struct db_chip db_chips[] __initdata = { | |||
510 | } | 510 | } |
511 | }; | 511 | }; |
512 | 512 | ||
513 | static void u300_init_check_chip(void) | 513 | static void __init u300_init_check_chip(void) |
514 | { | 514 | { |
515 | 515 | ||
516 | u16 val; | 516 | u16 val; |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 8277802ec859..3a7279c1ce5e 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -120,6 +120,32 @@ void show_mem(void) | |||
120 | printk("%d pages swap cached\n", cached); | 120 | printk("%d pages swap cached\n", cached); |
121 | } | 121 | } |
122 | 122 | ||
123 | static void __init find_node_limits(int node, struct meminfo *mi, | ||
124 | unsigned long *min, unsigned long *max_low, unsigned long *max_high) | ||
125 | { | ||
126 | int i; | ||
127 | |||
128 | *min = -1UL; | ||
129 | *max_low = *max_high = 0; | ||
130 | |||
131 | for_each_nodebank(i, mi, node) { | ||
132 | struct membank *bank = &mi->bank[i]; | ||
133 | unsigned long start, end; | ||
134 | |||
135 | start = bank_pfn_start(bank); | ||
136 | end = bank_pfn_end(bank); | ||
137 | |||
138 | if (*min > start) | ||
139 | *min = start; | ||
140 | if (*max_high < end) | ||
141 | *max_high = end; | ||
142 | if (bank->highmem) | ||
143 | continue; | ||
144 | if (*max_low < end) | ||
145 | *max_low = end; | ||
146 | } | ||
147 | } | ||
148 | |||
123 | /* | 149 | /* |
124 | * FIXME: We really want to avoid allocating the bootmap bitmap | 150 | * FIXME: We really want to avoid allocating the bootmap bitmap |
125 | * over the top of the initrd. Hopefully, this is located towards | 151 | * over the top of the initrd. Hopefully, this is located towards |
@@ -210,41 +236,25 @@ static inline void map_memory_bank(struct membank *bank) | |||
210 | #endif | 236 | #endif |
211 | } | 237 | } |
212 | 238 | ||
213 | static unsigned long __init bootmem_init_node(int node, struct meminfo *mi) | 239 | static void __init bootmem_init_node(int node, struct meminfo *mi, |
240 | unsigned long start_pfn, unsigned long end_pfn) | ||
214 | { | 241 | { |
215 | unsigned long start_pfn, end_pfn, boot_pfn; | 242 | unsigned long boot_pfn; |
216 | unsigned int boot_pages; | 243 | unsigned int boot_pages; |
217 | pg_data_t *pgdat; | 244 | pg_data_t *pgdat; |
218 | int i; | 245 | int i; |
219 | 246 | ||
220 | start_pfn = -1UL; | ||
221 | end_pfn = 0; | ||
222 | |||
223 | /* | 247 | /* |
224 | * Calculate the pfn range, and map the memory banks for this node. | 248 | * Map the memory banks for this node. |
225 | */ | 249 | */ |
226 | for_each_nodebank(i, mi, node) { | 250 | for_each_nodebank(i, mi, node) { |
227 | struct membank *bank = &mi->bank[i]; | 251 | struct membank *bank = &mi->bank[i]; |
228 | unsigned long start, end; | ||
229 | 252 | ||
230 | start = bank_pfn_start(bank); | 253 | if (!bank->highmem) |
231 | end = bank_pfn_end(bank); | 254 | map_memory_bank(bank); |
232 | |||
233 | if (start_pfn > start) | ||
234 | start_pfn = start; | ||
235 | if (end_pfn < end) | ||
236 | end_pfn = end; | ||
237 | |||
238 | map_memory_bank(bank); | ||
239 | } | 255 | } |
240 | 256 | ||
241 | /* | 257 | /* |
242 | * If there is no memory in this node, ignore it. | ||
243 | */ | ||
244 | if (end_pfn == 0) | ||
245 | return end_pfn; | ||
246 | |||
247 | /* | ||
248 | * Allocate the bootmem bitmap page. | 258 | * Allocate the bootmem bitmap page. |
249 | */ | 259 | */ |
250 | boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn); | 260 | boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn); |
@@ -260,7 +270,8 @@ static unsigned long __init bootmem_init_node(int node, struct meminfo *mi) | |||
260 | 270 | ||
261 | for_each_nodebank(i, mi, node) { | 271 | for_each_nodebank(i, mi, node) { |
262 | struct membank *bank = &mi->bank[i]; | 272 | struct membank *bank = &mi->bank[i]; |
263 | free_bootmem_node(pgdat, bank_phys_start(bank), bank_phys_size(bank)); | 273 | if (!bank->highmem) |
274 | free_bootmem_node(pgdat, bank_phys_start(bank), bank_phys_size(bank)); | ||
264 | memory_present(node, bank_pfn_start(bank), bank_pfn_end(bank)); | 275 | memory_present(node, bank_pfn_start(bank), bank_pfn_end(bank)); |
265 | } | 276 | } |
266 | 277 | ||
@@ -269,8 +280,6 @@ static unsigned long __init bootmem_init_node(int node, struct meminfo *mi) | |||
269 | */ | 280 | */ |
270 | reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT, | 281 | reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT, |
271 | boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT); | 282 | boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT); |
272 | |||
273 | return end_pfn; | ||
274 | } | 283 | } |
275 | 284 | ||
276 | static void __init bootmem_reserve_initrd(int node) | 285 | static void __init bootmem_reserve_initrd(int node) |
@@ -297,33 +306,39 @@ static void __init bootmem_reserve_initrd(int node) | |||
297 | static void __init bootmem_free_node(int node, struct meminfo *mi) | 306 | static void __init bootmem_free_node(int node, struct meminfo *mi) |
298 | { | 307 | { |
299 | unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; | 308 | unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; |
300 | unsigned long start_pfn, end_pfn; | 309 | unsigned long min, max_low, max_high; |
301 | pg_data_t *pgdat = NODE_DATA(node); | ||
302 | int i; | 310 | int i; |
303 | 311 | ||
304 | start_pfn = pgdat->bdata->node_min_pfn; | 312 | find_node_limits(node, mi, &min, &max_low, &max_high); |
305 | end_pfn = pgdat->bdata->node_low_pfn; | ||
306 | 313 | ||
307 | /* | 314 | /* |
308 | * initialise the zones within this node. | 315 | * initialise the zones within this node. |
309 | */ | 316 | */ |
310 | memset(zone_size, 0, sizeof(zone_size)); | 317 | memset(zone_size, 0, sizeof(zone_size)); |
311 | memset(zhole_size, 0, sizeof(zhole_size)); | ||
312 | 318 | ||
313 | /* | 319 | /* |
314 | * The size of this node has already been determined. If we need | 320 | * The size of this node has already been determined. If we need |
315 | * to do anything fancy with the allocation of this memory to the | 321 | * to do anything fancy with the allocation of this memory to the |
316 | * zones, now is the time to do it. | 322 | * zones, now is the time to do it. |
317 | */ | 323 | */ |
318 | zone_size[0] = end_pfn - start_pfn; | 324 | zone_size[0] = max_low - min; |
325 | #ifdef CONFIG_HIGHMEM | ||
326 | zone_size[ZONE_HIGHMEM] = max_high - max_low; | ||
327 | #endif | ||
319 | 328 | ||
320 | /* | 329 | /* |
321 | * For each bank in this node, calculate the size of the holes. | 330 | * For each bank in this node, calculate the size of the holes. |
322 | * holes = node_size - sum(bank_sizes_in_node) | 331 | * holes = node_size - sum(bank_sizes_in_node) |
323 | */ | 332 | */ |
324 | zhole_size[0] = zone_size[0]; | 333 | memcpy(zhole_size, zone_size, sizeof(zhole_size)); |
325 | for_each_nodebank(i, mi, node) | 334 | for_each_nodebank(i, mi, node) { |
326 | zhole_size[0] -= bank_pfn_size(&mi->bank[i]); | 335 | int idx = 0; |
336 | #ifdef CONFIG_HIGHMEM | ||
337 | if (mi->bank[i].highmem) | ||
338 | idx = ZONE_HIGHMEM; | ||
339 | #endif | ||
340 | zhole_size[idx] -= bank_pfn_size(&mi->bank[i]); | ||
341 | } | ||
327 | 342 | ||
328 | /* | 343 | /* |
329 | * Adjust the sizes according to any special requirements for | 344 | * Adjust the sizes according to any special requirements for |
@@ -331,13 +346,13 @@ static void __init bootmem_free_node(int node, struct meminfo *mi) | |||
331 | */ | 346 | */ |
332 | arch_adjust_zones(node, zone_size, zhole_size); | 347 | arch_adjust_zones(node, zone_size, zhole_size); |
333 | 348 | ||
334 | free_area_init_node(node, zone_size, start_pfn, zhole_size); | 349 | free_area_init_node(node, zone_size, min, zhole_size); |
335 | } | 350 | } |
336 | 351 | ||
337 | void __init bootmem_init(void) | 352 | void __init bootmem_init(void) |
338 | { | 353 | { |
339 | struct meminfo *mi = &meminfo; | 354 | struct meminfo *mi = &meminfo; |
340 | unsigned long memend_pfn = 0; | 355 | unsigned long min, max_low, max_high; |
341 | int node, initrd_node; | 356 | int node, initrd_node; |
342 | 357 | ||
343 | /* | 358 | /* |
@@ -345,11 +360,29 @@ void __init bootmem_init(void) | |||
345 | */ | 360 | */ |
346 | initrd_node = check_initrd(mi); | 361 | initrd_node = check_initrd(mi); |
347 | 362 | ||
363 | max_low = max_high = 0; | ||
364 | |||
348 | /* | 365 | /* |
349 | * Run through each node initialising the bootmem allocator. | 366 | * Run through each node initialising the bootmem allocator. |
350 | */ | 367 | */ |
351 | for_each_node(node) { | 368 | for_each_node(node) { |
352 | unsigned long end_pfn = bootmem_init_node(node, mi); | 369 | unsigned long node_low, node_high; |
370 | |||
371 | find_node_limits(node, mi, &min, &node_low, &node_high); | ||
372 | |||
373 | if (node_low > max_low) | ||
374 | max_low = node_low; | ||
375 | if (node_high > max_high) | ||
376 | max_high = node_high; | ||
377 | |||
378 | /* | ||
379 | * If there is no memory in this node, ignore it. | ||
380 | * (We can't have nodes which have no lowmem) | ||
381 | */ | ||
382 | if (node_low == 0) | ||
383 | continue; | ||
384 | |||
385 | bootmem_init_node(node, mi, min, node_low); | ||
353 | 386 | ||
354 | /* | 387 | /* |
355 | * Reserve any special node zero regions. | 388 | * Reserve any special node zero regions. |
@@ -362,12 +395,6 @@ void __init bootmem_init(void) | |||
362 | */ | 395 | */ |
363 | if (node == initrd_node) | 396 | if (node == initrd_node) |
364 | bootmem_reserve_initrd(node); | 397 | bootmem_reserve_initrd(node); |
365 | |||
366 | /* | ||
367 | * Remember the highest memory PFN. | ||
368 | */ | ||
369 | if (end_pfn > memend_pfn) | ||
370 | memend_pfn = end_pfn; | ||
371 | } | 398 | } |
372 | 399 | ||
373 | /* | 400 | /* |
@@ -383,7 +410,7 @@ void __init bootmem_init(void) | |||
383 | for_each_node(node) | 410 | for_each_node(node) |
384 | bootmem_free_node(node, mi); | 411 | bootmem_free_node(node, mi); |
385 | 412 | ||
386 | high_memory = __va((memend_pfn << PAGE_SHIFT) - 1) + 1; | 413 | high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1; |
387 | 414 | ||
388 | /* | 415 | /* |
389 | * This doesn't seem to be used by the Linux memory manager any | 416 | * This doesn't seem to be used by the Linux memory manager any |
@@ -393,7 +420,8 @@ void __init bootmem_init(void) | |||
393 | * Note: max_low_pfn and max_pfn reflect the number of _pages_ in | 420 | * Note: max_low_pfn and max_pfn reflect the number of _pages_ in |
394 | * the system, not the maximum PFN. | 421 | * the system, not the maximum PFN. |
395 | */ | 422 | */ |
396 | max_pfn = max_low_pfn = memend_pfn - PHYS_PFN_OFFSET; | 423 | max_low_pfn = max_low - PHYS_PFN_OFFSET; |
424 | max_pfn = max_high - PHYS_PFN_OFFSET; | ||
397 | } | 425 | } |
398 | 426 | ||
399 | static inline int free_area(unsigned long pfn, unsigned long end, char *s) | 427 | static inline int free_area(unsigned long pfn, unsigned long end, char *s) |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 4722582b17b8..4426ee67ceca 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -687,13 +687,19 @@ __early_param("vmalloc=", early_vmalloc); | |||
687 | 687 | ||
688 | static void __init sanity_check_meminfo(void) | 688 | static void __init sanity_check_meminfo(void) |
689 | { | 689 | { |
690 | int i, j; | 690 | int i, j, highmem = 0; |
691 | 691 | ||
692 | for (i = 0, j = 0; i < meminfo.nr_banks; i++) { | 692 | for (i = 0, j = 0; i < meminfo.nr_banks; i++) { |
693 | struct membank *bank = &meminfo.bank[j]; | 693 | struct membank *bank = &meminfo.bank[j]; |
694 | *bank = meminfo.bank[i]; | 694 | *bank = meminfo.bank[i]; |
695 | 695 | ||
696 | #ifdef CONFIG_HIGHMEM | 696 | #ifdef CONFIG_HIGHMEM |
697 | if (__va(bank->start) > VMALLOC_MIN || | ||
698 | __va(bank->start) < (void *)PAGE_OFFSET) | ||
699 | highmem = 1; | ||
700 | |||
701 | bank->highmem = highmem; | ||
702 | |||
697 | /* | 703 | /* |
698 | * Split those memory banks which are partially overlapping | 704 | * Split those memory banks which are partially overlapping |
699 | * the vmalloc area greatly simplifying things later. | 705 | * the vmalloc area greatly simplifying things later. |
@@ -714,6 +720,7 @@ static void __init sanity_check_meminfo(void) | |||
714 | i++; | 720 | i++; |
715 | bank[1].size -= VMALLOC_MIN - __va(bank->start); | 721 | bank[1].size -= VMALLOC_MIN - __va(bank->start); |
716 | bank[1].start = __pa(VMALLOC_MIN - 1) + 1; | 722 | bank[1].start = __pa(VMALLOC_MIN - 1) + 1; |
723 | bank[1].highmem = highmem = 1; | ||
717 | j++; | 724 | j++; |
718 | } | 725 | } |
719 | bank->size = VMALLOC_MIN - __va(bank->start); | 726 | bank->size = VMALLOC_MIN - __va(bank->start); |
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c index 843e8af64066..1868c0d8f9b5 100644 --- a/arch/arm/plat-omap/cpu-omap.c +++ b/arch/arm/plat-omap/cpu-omap.c | |||
@@ -78,10 +78,10 @@ static int omap_target(struct cpufreq_policy *policy, | |||
78 | 78 | ||
79 | /* Ensure desired rate is within allowed range. Some govenors | 79 | /* Ensure desired rate is within allowed range. Some govenors |
80 | * (ondemand) will just pass target_freq=0 to get the minimum. */ | 80 | * (ondemand) will just pass target_freq=0 to get the minimum. */ |
81 | if (target_freq < policy->cpuinfo.min_freq) | 81 | if (target_freq < policy->min) |
82 | target_freq = policy->cpuinfo.min_freq; | 82 | target_freq = policy->min; |
83 | if (target_freq > policy->cpuinfo.max_freq) | 83 | if (target_freq > policy->max) |
84 | target_freq = policy->cpuinfo.max_freq; | 84 | target_freq = policy->max; |
85 | 85 | ||
86 | freqs.old = omap_getspeed(0); | 86 | freqs.old = omap_getspeed(0); |
87 | freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000; | 87 | freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000; |
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index 7677a4a1cef2..e3ac94f09006 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c | |||
@@ -946,7 +946,9 @@ void omap_start_dma(int lch) | |||
946 | 946 | ||
947 | cur_lch = next_lch; | 947 | cur_lch = next_lch; |
948 | } while (next_lch != -1); | 948 | } while (next_lch != -1); |
949 | } else if (cpu_class_is_omap2()) { | 949 | } else if (cpu_is_omap242x() || |
950 | (cpu_is_omap243x() && omap_type() <= OMAP2430_REV_ES1_0)) { | ||
951 | |||
950 | /* Errata: Need to write lch even if not using chaining */ | 952 | /* Errata: Need to write lch even if not using chaining */ |
951 | dma_write(lch, CLNK_CTRL(lch)); | 953 | dma_write(lch, CLNK_CTRL(lch)); |
952 | } | 954 | } |
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 26b387c12423..9298bc0ab171 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c | |||
@@ -476,14 +476,12 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) | |||
476 | __raw_writel(l, reg); | 476 | __raw_writel(l, reg); |
477 | } | 477 | } |
478 | 478 | ||
479 | static int __omap_get_gpio_datain(int gpio) | 479 | static int _get_gpio_datain(struct gpio_bank *bank, int gpio) |
480 | { | 480 | { |
481 | struct gpio_bank *bank; | ||
482 | void __iomem *reg; | 481 | void __iomem *reg; |
483 | 482 | ||
484 | if (check_gpio(gpio) < 0) | 483 | if (check_gpio(gpio) < 0) |
485 | return -EINVAL; | 484 | return -EINVAL; |
486 | bank = get_gpio_bank(gpio); | ||
487 | reg = bank->base; | 485 | reg = bank->base; |
488 | switch (bank->method) { | 486 | switch (bank->method) { |
489 | #ifdef CONFIG_ARCH_OMAP1 | 487 | #ifdef CONFIG_ARCH_OMAP1 |
@@ -524,6 +522,53 @@ static int __omap_get_gpio_datain(int gpio) | |||
524 | & (1 << get_gpio_index(gpio))) != 0; | 522 | & (1 << get_gpio_index(gpio))) != 0; |
525 | } | 523 | } |
526 | 524 | ||
525 | static int _get_gpio_dataout(struct gpio_bank *bank, int gpio) | ||
526 | { | ||
527 | void __iomem *reg; | ||
528 | |||
529 | if (check_gpio(gpio) < 0) | ||
530 | return -EINVAL; | ||
531 | reg = bank->base; | ||
532 | |||
533 | switch (bank->method) { | ||
534 | #ifdef CONFIG_ARCH_OMAP1 | ||
535 | case METHOD_MPUIO: | ||
536 | reg += OMAP_MPUIO_OUTPUT; | ||
537 | break; | ||
538 | #endif | ||
539 | #ifdef CONFIG_ARCH_OMAP15XX | ||
540 | case METHOD_GPIO_1510: | ||
541 | reg += OMAP1510_GPIO_DATA_OUTPUT; | ||
542 | break; | ||
543 | #endif | ||
544 | #ifdef CONFIG_ARCH_OMAP16XX | ||
545 | case METHOD_GPIO_1610: | ||
546 | reg += OMAP1610_GPIO_DATAOUT; | ||
547 | break; | ||
548 | #endif | ||
549 | #ifdef CONFIG_ARCH_OMAP730 | ||
550 | case METHOD_GPIO_730: | ||
551 | reg += OMAP730_GPIO_DATA_OUTPUT; | ||
552 | break; | ||
553 | #endif | ||
554 | #ifdef CONFIG_ARCH_OMAP850 | ||
555 | case METHOD_GPIO_850: | ||
556 | reg += OMAP850_GPIO_DATA_OUTPUT; | ||
557 | break; | ||
558 | #endif | ||
559 | #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ | ||
560 | defined(CONFIG_ARCH_OMAP4) | ||
561 | case METHOD_GPIO_24XX: | ||
562 | reg += OMAP24XX_GPIO_DATAOUT; | ||
563 | break; | ||
564 | #endif | ||
565 | default: | ||
566 | return -EINVAL; | ||
567 | } | ||
568 | |||
569 | return (__raw_readl(reg) & (1 << get_gpio_index(gpio))) != 0; | ||
570 | } | ||
571 | |||
527 | #define MOD_REG_BIT(reg, bit_mask, set) \ | 572 | #define MOD_REG_BIT(reg, bit_mask, set) \ |
528 | do { \ | 573 | do { \ |
529 | int l = __raw_readl(base + reg); \ | 574 | int l = __raw_readl(base + reg); \ |
@@ -1189,6 +1234,7 @@ static void gpio_mask_irq(unsigned int irq) | |||
1189 | struct gpio_bank *bank = get_irq_chip_data(irq); | 1234 | struct gpio_bank *bank = get_irq_chip_data(irq); |
1190 | 1235 | ||
1191 | _set_gpio_irqenable(bank, gpio, 0); | 1236 | _set_gpio_irqenable(bank, gpio, 0); |
1237 | _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); | ||
1192 | } | 1238 | } |
1193 | 1239 | ||
1194 | static void gpio_unmask_irq(unsigned int irq) | 1240 | static void gpio_unmask_irq(unsigned int irq) |
@@ -1196,6 +1242,11 @@ static void gpio_unmask_irq(unsigned int irq) | |||
1196 | unsigned int gpio = irq - IH_GPIO_BASE; | 1242 | unsigned int gpio = irq - IH_GPIO_BASE; |
1197 | struct gpio_bank *bank = get_irq_chip_data(irq); | 1243 | struct gpio_bank *bank = get_irq_chip_data(irq); |
1198 | unsigned int irq_mask = 1 << get_gpio_index(gpio); | 1244 | unsigned int irq_mask = 1 << get_gpio_index(gpio); |
1245 | struct irq_desc *desc = irq_to_desc(irq); | ||
1246 | u32 trigger = desc->status & IRQ_TYPE_SENSE_MASK; | ||
1247 | |||
1248 | if (trigger) | ||
1249 | _set_gpio_triggering(bank, get_gpio_index(gpio), trigger); | ||
1199 | 1250 | ||
1200 | /* For level-triggered GPIOs, the clearing must be done after | 1251 | /* For level-triggered GPIOs, the clearing must be done after |
1201 | * the HW source is cleared, thus after the handler has run */ | 1252 | * the HW source is cleared, thus after the handler has run */ |
@@ -1350,9 +1401,49 @@ static int gpio_input(struct gpio_chip *chip, unsigned offset) | |||
1350 | return 0; | 1401 | return 0; |
1351 | } | 1402 | } |
1352 | 1403 | ||
1404 | static int gpio_is_input(struct gpio_bank *bank, int mask) | ||
1405 | { | ||
1406 | void __iomem *reg = bank->base; | ||
1407 | |||
1408 | switch (bank->method) { | ||
1409 | case METHOD_MPUIO: | ||
1410 | reg += OMAP_MPUIO_IO_CNTL; | ||
1411 | break; | ||
1412 | case METHOD_GPIO_1510: | ||
1413 | reg += OMAP1510_GPIO_DIR_CONTROL; | ||
1414 | break; | ||
1415 | case METHOD_GPIO_1610: | ||
1416 | reg += OMAP1610_GPIO_DIRECTION; | ||
1417 | break; | ||
1418 | case METHOD_GPIO_730: | ||
1419 | reg += OMAP730_GPIO_DIR_CONTROL; | ||
1420 | break; | ||
1421 | case METHOD_GPIO_850: | ||
1422 | reg += OMAP850_GPIO_DIR_CONTROL; | ||
1423 | break; | ||
1424 | case METHOD_GPIO_24XX: | ||
1425 | reg += OMAP24XX_GPIO_OE; | ||
1426 | break; | ||
1427 | } | ||
1428 | return __raw_readl(reg) & mask; | ||
1429 | } | ||
1430 | |||
1353 | static int gpio_get(struct gpio_chip *chip, unsigned offset) | 1431 | static int gpio_get(struct gpio_chip *chip, unsigned offset) |
1354 | { | 1432 | { |
1355 | return __omap_get_gpio_datain(chip->base + offset); | 1433 | struct gpio_bank *bank; |
1434 | void __iomem *reg; | ||
1435 | int gpio; | ||
1436 | u32 mask; | ||
1437 | |||
1438 | gpio = chip->base + offset; | ||
1439 | bank = get_gpio_bank(gpio); | ||
1440 | reg = bank->base; | ||
1441 | mask = 1 << get_gpio_index(gpio); | ||
1442 | |||
1443 | if (gpio_is_input(bank, mask)) | ||
1444 | return _get_gpio_datain(bank, gpio); | ||
1445 | else | ||
1446 | return _get_gpio_dataout(bank, gpio); | ||
1356 | } | 1447 | } |
1357 | 1448 | ||
1358 | static int gpio_output(struct gpio_chip *chip, unsigned offset, int value) | 1449 | static int gpio_output(struct gpio_chip *chip, unsigned offset, int value) |
@@ -1886,34 +1977,6 @@ arch_initcall(omap_gpio_sysinit); | |||
1886 | #include <linux/debugfs.h> | 1977 | #include <linux/debugfs.h> |
1887 | #include <linux/seq_file.h> | 1978 | #include <linux/seq_file.h> |
1888 | 1979 | ||
1889 | static int gpio_is_input(struct gpio_bank *bank, int mask) | ||
1890 | { | ||
1891 | void __iomem *reg = bank->base; | ||
1892 | |||
1893 | switch (bank->method) { | ||
1894 | case METHOD_MPUIO: | ||
1895 | reg += OMAP_MPUIO_IO_CNTL; | ||
1896 | break; | ||
1897 | case METHOD_GPIO_1510: | ||
1898 | reg += OMAP1510_GPIO_DIR_CONTROL; | ||
1899 | break; | ||
1900 | case METHOD_GPIO_1610: | ||
1901 | reg += OMAP1610_GPIO_DIRECTION; | ||
1902 | break; | ||
1903 | case METHOD_GPIO_730: | ||
1904 | reg += OMAP730_GPIO_DIR_CONTROL; | ||
1905 | break; | ||
1906 | case METHOD_GPIO_850: | ||
1907 | reg += OMAP850_GPIO_DIR_CONTROL; | ||
1908 | break; | ||
1909 | case METHOD_GPIO_24XX: | ||
1910 | reg += OMAP24XX_GPIO_OE; | ||
1911 | break; | ||
1912 | } | ||
1913 | return __raw_readl(reg) & mask; | ||
1914 | } | ||
1915 | |||
1916 | |||
1917 | static int dbg_gpio_show(struct seq_file *s, void *unused) | 1980 | static int dbg_gpio_show(struct seq_file *s, void *unused) |
1918 | { | 1981 | { |
1919 | unsigned i, j, gpio; | 1982 | unsigned i, j, gpio; |
diff --git a/arch/arm/plat-omap/include/mach/clock.h b/arch/arm/plat-omap/include/mach/clock.h index f9f65e1ba3f1..4b8b0d65cbf2 100644 --- a/arch/arm/plat-omap/include/mach/clock.h +++ b/arch/arm/plat-omap/include/mach/clock.h | |||
@@ -20,6 +20,8 @@ struct clockdomain; | |||
20 | struct clkops { | 20 | struct clkops { |
21 | int (*enable)(struct clk *); | 21 | int (*enable)(struct clk *); |
22 | void (*disable)(struct clk *); | 22 | void (*disable)(struct clk *); |
23 | void (*find_idlest)(struct clk *, void __iomem **, u8 *); | ||
24 | void (*find_companion)(struct clk *, void __iomem **, u8 *); | ||
23 | }; | 25 | }; |
24 | 26 | ||
25 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ | 27 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ |
diff --git a/arch/arm/plat-omap/include/mach/cpu.h b/arch/arm/plat-omap/include/mach/cpu.h index 285eaa3a8275..11e73d9e8928 100644 --- a/arch/arm/plat-omap/include/mach/cpu.h +++ b/arch/arm/plat-omap/include/mach/cpu.h | |||
@@ -378,9 +378,6 @@ IS_OMAP_TYPE(3430, 0x3430) | |||
378 | #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \ | 378 | #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \ |
379 | cpu_is_omap44xx()) | 379 | cpu_is_omap44xx()) |
380 | 380 | ||
381 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ | ||
382 | defined(CONFIG_ARCH_OMAP4) | ||
383 | |||
384 | /* Various silicon revisions for omap2 */ | 381 | /* Various silicon revisions for omap2 */ |
385 | #define OMAP242X_CLASS 0x24200024 | 382 | #define OMAP242X_CLASS 0x24200024 |
386 | #define OMAP2420_REV_ES1_0 0x24200024 | 383 | #define OMAP2420_REV_ES1_0 0x24200024 |
@@ -436,5 +433,3 @@ IS_OMAP_TYPE(3430, 0x3430) | |||
436 | 433 | ||
437 | int omap_chip_is(struct omap_chip_id oci); | 434 | int omap_chip_is(struct omap_chip_id oci); |
438 | void omap2_check_revision(void); | 435 | void omap2_check_revision(void); |
439 | |||
440 | #endif /* defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) */ | ||
diff --git a/arch/arm/plat-omap/include/mach/io.h b/arch/arm/plat-omap/include/mach/io.h index 73f483d56ca6..21fb0efdda86 100644 --- a/arch/arm/plat-omap/include/mach/io.h +++ b/arch/arm/plat-omap/include/mach/io.h | |||
@@ -228,7 +228,8 @@ extern void omap1_map_common_io(void); | |||
228 | extern void omap1_init_common_hw(void); | 228 | extern void omap1_init_common_hw(void); |
229 | 229 | ||
230 | extern void omap2_map_common_io(void); | 230 | extern void omap2_map_common_io(void); |
231 | extern void omap2_init_common_hw(struct omap_sdrc_params *sp); | 231 | extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0, |
232 | struct omap_sdrc_params *sdrc_cs1); | ||
232 | 233 | ||
233 | #define __arch_ioremap(p,s,t) omap_ioremap(p,s,t) | 234 | #define __arch_ioremap(p,s,t) omap_ioremap(p,s,t) |
234 | #define __arch_iounmap(v) omap_iounmap(v) | 235 | #define __arch_iounmap(v) omap_iounmap(v) |
diff --git a/arch/arm/plat-omap/include/mach/mux.h b/arch/arm/plat-omap/include/mach/mux.h index 85a621705766..80281c458baf 100644 --- a/arch/arm/plat-omap/include/mach/mux.h +++ b/arch/arm/plat-omap/include/mach/mux.h | |||
@@ -853,6 +853,10 @@ enum omap34xx_index { | |||
853 | AE5_34XX_GPIO143, | 853 | AE5_34XX_GPIO143, |
854 | H19_34XX_GPIO164_OUT, | 854 | H19_34XX_GPIO164_OUT, |
855 | J25_34XX_GPIO170, | 855 | J25_34XX_GPIO170, |
856 | |||
857 | /* OMAP3 SDRC CKE signals to SDR/DDR ram chips */ | ||
858 | H16_34XX_SDRC_CKE0, | ||
859 | H17_34XX_SDRC_CKE1, | ||
856 | }; | 860 | }; |
857 | 861 | ||
858 | struct omap_mux_cfg { | 862 | struct omap_mux_cfg { |
diff --git a/arch/arm/plat-omap/include/mach/prcm.h b/arch/arm/plat-omap/include/mach/prcm.h index 24ac3c715912..cda2a70397b4 100644 --- a/arch/arm/plat-omap/include/mach/prcm.h +++ b/arch/arm/plat-omap/include/mach/prcm.h | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | u32 omap_prcm_get_reset_sources(void); | 26 | u32 omap_prcm_get_reset_sources(void); |
27 | void omap_prcm_arch_reset(char mode); | 27 | void omap_prcm_arch_reset(char mode); |
28 | int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, const char *name); | ||
28 | 29 | ||
29 | #endif | 30 | #endif |
30 | 31 | ||
diff --git a/arch/arm/plat-omap/include/mach/sdrc.h b/arch/arm/plat-omap/include/mach/sdrc.h index adc73522491f..0be18e4ff182 100644 --- a/arch/arm/plat-omap/include/mach/sdrc.h +++ b/arch/arm/plat-omap/include/mach/sdrc.h | |||
@@ -30,6 +30,10 @@ | |||
30 | #define SDRC_ACTIM_CTRL_A_0 0x09c | 30 | #define SDRC_ACTIM_CTRL_A_0 0x09c |
31 | #define SDRC_ACTIM_CTRL_B_0 0x0a0 | 31 | #define SDRC_ACTIM_CTRL_B_0 0x0a0 |
32 | #define SDRC_RFR_CTRL_0 0x0a4 | 32 | #define SDRC_RFR_CTRL_0 0x0a4 |
33 | #define SDRC_MR_1 0x0B4 | ||
34 | #define SDRC_ACTIM_CTRL_A_1 0x0C4 | ||
35 | #define SDRC_ACTIM_CTRL_B_1 0x0C8 | ||
36 | #define SDRC_RFR_CTRL_1 0x0D4 | ||
33 | 37 | ||
34 | /* | 38 | /* |
35 | * These values represent the number of memory clock cycles between | 39 | * These values represent the number of memory clock cycles between |
@@ -102,8 +106,11 @@ struct omap_sdrc_params { | |||
102 | u32 mr; | 106 | u32 mr; |
103 | }; | 107 | }; |
104 | 108 | ||
105 | void __init omap2_sdrc_init(struct omap_sdrc_params *sp); | 109 | void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0, |
106 | struct omap_sdrc_params *omap2_sdrc_get_params(unsigned long r); | 110 | struct omap_sdrc_params *sdrc_cs1); |
111 | int omap2_sdrc_get_params(unsigned long r, | ||
112 | struct omap_sdrc_params **sdrc_cs0, | ||
113 | struct omap_sdrc_params **sdrc_cs1); | ||
107 | 114 | ||
108 | #ifdef CONFIG_ARCH_OMAP2 | 115 | #ifdef CONFIG_ARCH_OMAP2 |
109 | 116 | ||
diff --git a/arch/arm/plat-omap/include/mach/serial.h b/arch/arm/plat-omap/include/mach/serial.h index 13abd02d1527..def0529c75eb 100644 --- a/arch/arm/plat-omap/include/mach/serial.h +++ b/arch/arm/plat-omap/include/mach/serial.h | |||
@@ -59,6 +59,7 @@ extern void omap_uart_check_wakeup(void); | |||
59 | extern void omap_uart_prepare_suspend(void); | 59 | extern void omap_uart_prepare_suspend(void); |
60 | extern void omap_uart_prepare_idle(int num); | 60 | extern void omap_uart_prepare_idle(int num); |
61 | extern void omap_uart_resume_idle(int num); | 61 | extern void omap_uart_resume_idle(int num); |
62 | extern void omap_uart_enable_irqs(int enable); | ||
62 | #endif | 63 | #endif |
63 | 64 | ||
64 | #endif | 65 | #endif |
diff --git a/arch/arm/plat-omap/include/mach/sram.h b/arch/arm/plat-omap/include/mach/sram.h index 4d53cc59d7a3..8974e3fc2691 100644 --- a/arch/arm/plat-omap/include/mach/sram.h +++ b/arch/arm/plat-omap/include/mach/sram.h | |||
@@ -21,11 +21,12 @@ extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val, | |||
21 | u32 mem_type); | 21 | u32 mem_type); |
22 | extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass); | 22 | extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass); |
23 | 23 | ||
24 | extern u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, | 24 | extern u32 omap3_configure_core_dpll( |
25 | u32 sdrc_actim_ctrla, | 25 | u32 m2, u32 unlock_dll, u32 f, u32 inc, |
26 | u32 sdrc_actim_ctrlb, u32 m2, | 26 | u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0, |
27 | u32 unlock_dll, u32 f, u32 sdrc_mr, | 27 | u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0, |
28 | u32 inc); | 28 | u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1, |
29 | u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1); | ||
29 | 30 | ||
30 | /* Do not use these */ | 31 | /* Do not use these */ |
31 | extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl); | 32 | extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl); |
@@ -59,12 +60,12 @@ extern void omap243x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val, | |||
59 | u32 mem_type); | 60 | u32 mem_type); |
60 | extern unsigned long omap243x_sram_reprogram_sdrc_sz; | 61 | extern unsigned long omap243x_sram_reprogram_sdrc_sz; |
61 | 62 | ||
62 | 63 | extern u32 omap3_sram_configure_core_dpll( | |
63 | extern u32 omap3_sram_configure_core_dpll(u32 sdrc_rfr_ctrl, | 64 | u32 m2, u32 unlock_dll, u32 f, u32 inc, |
64 | u32 sdrc_actim_ctrla, | 65 | u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0, |
65 | u32 sdrc_actim_ctrlb, u32 m2, | 66 | u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0, |
66 | u32 unlock_dll, u32 f, u32 sdrc_mr, | 67 | u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1, |
67 | u32 inc); | 68 | u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1); |
68 | extern unsigned long omap3_sram_configure_core_dpll_sz; | 69 | extern unsigned long omap3_sram_configure_core_dpll_sz; |
69 | 70 | ||
70 | #endif | 71 | #endif |
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c index 4ea73804d21e..5eae7876979c 100644 --- a/arch/arm/plat-omap/sram.c +++ b/arch/arm/plat-omap/sram.c | |||
@@ -44,9 +44,9 @@ | |||
44 | #define OMAP2_SRAM_VA 0xe3000000 | 44 | #define OMAP2_SRAM_VA 0xe3000000 |
45 | #define OMAP2_SRAM_PUB_VA (OMAP2_SRAM_VA + 0x800) | 45 | #define OMAP2_SRAM_PUB_VA (OMAP2_SRAM_VA + 0x800) |
46 | #define OMAP3_SRAM_PA 0x40200000 | 46 | #define OMAP3_SRAM_PA 0x40200000 |
47 | #define OMAP3_SRAM_VA 0xd7000000 | 47 | #define OMAP3_SRAM_VA 0xe3000000 |
48 | #define OMAP3_SRAM_PUB_PA 0x40208000 | 48 | #define OMAP3_SRAM_PUB_PA 0x40208000 |
49 | #define OMAP3_SRAM_PUB_VA 0xd7008000 | 49 | #define OMAP3_SRAM_PUB_VA (OMAP3_SRAM_VA + 0x8000) |
50 | #define OMAP4_SRAM_PA 0x40200000 /*0x402f0000*/ | 50 | #define OMAP4_SRAM_PA 0x40200000 /*0x402f0000*/ |
51 | #define OMAP4_SRAM_VA 0xd7000000 /*0xd70f0000*/ | 51 | #define OMAP4_SRAM_VA 0xd7000000 /*0xd70f0000*/ |
52 | 52 | ||
@@ -373,20 +373,26 @@ static inline int omap243x_sram_init(void) | |||
373 | 373 | ||
374 | #ifdef CONFIG_ARCH_OMAP3 | 374 | #ifdef CONFIG_ARCH_OMAP3 |
375 | 375 | ||
376 | static u32 (*_omap3_sram_configure_core_dpll)(u32 sdrc_rfr_ctrl, | 376 | static u32 (*_omap3_sram_configure_core_dpll)( |
377 | u32 sdrc_actim_ctrla, | 377 | u32 m2, u32 unlock_dll, u32 f, u32 inc, |
378 | u32 sdrc_actim_ctrlb, | 378 | u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0, |
379 | u32 m2, u32 unlock_dll, | 379 | u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0, |
380 | u32 f, u32 sdrc_mr, u32 inc); | 380 | u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1, |
381 | u32 omap3_configure_core_dpll(u32 sdrc_rfr_ctrl, u32 sdrc_actim_ctrla, | 381 | u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1); |
382 | u32 sdrc_actim_ctrlb, u32 m2, u32 unlock_dll, | 382 | |
383 | u32 f, u32 sdrc_mr, u32 inc) | 383 | u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc, |
384 | u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0, | ||
385 | u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0, | ||
386 | u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1, | ||
387 | u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1) | ||
384 | { | 388 | { |
385 | BUG_ON(!_omap3_sram_configure_core_dpll); | 389 | BUG_ON(!_omap3_sram_configure_core_dpll); |
386 | return _omap3_sram_configure_core_dpll(sdrc_rfr_ctrl, | 390 | return _omap3_sram_configure_core_dpll( |
387 | sdrc_actim_ctrla, | 391 | m2, unlock_dll, f, inc, |
388 | sdrc_actim_ctrlb, m2, | 392 | sdrc_rfr_ctrl_0, sdrc_actim_ctrl_a_0, |
389 | unlock_dll, f, sdrc_mr, inc); | 393 | sdrc_actim_ctrl_b_0, sdrc_mr_0, |
394 | sdrc_rfr_ctrl_1, sdrc_actim_ctrl_a_1, | ||
395 | sdrc_actim_ctrl_b_1, sdrc_mr_1); | ||
390 | } | 396 | } |
391 | 397 | ||
392 | /* REVISIT: Should this be same as omap34xx_sram_init() after off-idle? */ | 398 | /* REVISIT: Should this be same as omap34xx_sram_init() after off-idle? */ |
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h index 9646a94ed3d0..07c430fdc9ef 100644 --- a/arch/arm/plat-orion/include/plat/gpio.h +++ b/arch/arm/plat-orion/include/plat/gpio.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #ifndef __PLAT_GPIO_H | 11 | #ifndef __PLAT_GPIO_H |
12 | #define __PLAT_GPIO_H | 12 | #define __PLAT_GPIO_H |
13 | 13 | ||
14 | #include <linux/init.h> | ||
15 | |||
14 | /* | 16 | /* |
15 | * GENERIC_GPIO primitives. | 17 | * GENERIC_GPIO primitives. |
16 | */ | 18 | */ |
diff --git a/arch/arm/plat-s3c24xx/clock-dclk.c b/arch/arm/plat-s3c24xx/clock-dclk.c index 5b75a797b5ab..0afb217a775e 100644 --- a/arch/arm/plat-s3c24xx/clock-dclk.c +++ b/arch/arm/plat-s3c24xx/clock-dclk.c | |||
@@ -129,7 +129,7 @@ static int s3c24xx_clkout_setparent(struct clk *clk, struct clk *parent) | |||
129 | 129 | ||
130 | /* calculate the MISCCR setting for the clock */ | 130 | /* calculate the MISCCR setting for the clock */ |
131 | 131 | ||
132 | if (parent == &clk_xtal) | 132 | if (parent == &clk_mpll) |
133 | source = S3C2410_MISCCR_CLK0_MPLL; | 133 | source = S3C2410_MISCCR_CLK0_MPLL; |
134 | else if (parent == &clk_upll) | 134 | else if (parent == &clk_upll) |
135 | source = S3C2410_MISCCR_CLK0_UPLL; | 135 | source = S3C2410_MISCCR_CLK0_UPLL; |
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c index 46c9b0a224cf..75f19f47fb2f 100644 --- a/arch/avr32/boards/favr-32/setup.c +++ b/arch/avr32/boards/favr-32/setup.c | |||
@@ -72,6 +72,10 @@ static struct ads7846_platform_data ads7843_data = { | |||
72 | .debounce_max = 20, | 72 | .debounce_max = 20, |
73 | .debounce_rep = 4, | 73 | .debounce_rep = 4, |
74 | .debounce_tol = 5, | 74 | .debounce_tol = 5, |
75 | |||
76 | .keep_vref_on = true, | ||
77 | .settle_delay_usecs = 500, | ||
78 | .penirq_recheck_delay_usecs = 100, | ||
75 | }; | 79 | }; |
76 | 80 | ||
77 | static struct spi_board_info __initdata spi1_board_info[] = { | 81 | static struct spi_board_info __initdata spi1_board_info[] = { |
diff --git a/arch/avr32/lib/memcpy.S b/arch/avr32/lib/memcpy.S index 0abb26142b64..c2ca49d705af 100644 --- a/arch/avr32/lib/memcpy.S +++ b/arch/avr32/lib/memcpy.S | |||
@@ -24,8 +24,8 @@ memcpy: | |||
24 | brne 1f | 24 | brne 1f |
25 | 25 | ||
26 | /* At this point, "from" is word-aligned */ | 26 | /* At this point, "from" is word-aligned */ |
27 | 2: sub r10, 4 | 27 | 2: mov r9, r12 |
28 | mov r9, r12 | 28 | 5: sub r10, 4 |
29 | brlt 4f | 29 | brlt 4f |
30 | 30 | ||
31 | 3: ld.w r8, r11++ | 31 | 3: ld.w r8, r11++ |
@@ -49,6 +49,7 @@ memcpy: | |||
49 | 49 | ||
50 | /* Handle unaligned "from" pointer */ | 50 | /* Handle unaligned "from" pointer */ |
51 | 1: sub r10, 4 | 51 | 1: sub r10, 4 |
52 | movlt r9, r12 | ||
52 | brlt 4b | 53 | brlt 4b |
53 | add r10, r9 | 54 | add r10, r9 |
54 | lsl r9, 2 | 55 | lsl r9, 2 |
@@ -59,4 +60,13 @@ memcpy: | |||
59 | st.b r12++, r8 | 60 | st.b r12++, r8 |
60 | ld.ub r8, r11++ | 61 | ld.ub r8, r11++ |
61 | st.b r12++, r8 | 62 | st.b r12++, r8 |
62 | rjmp 2b | 63 | mov r8, r12 |
64 | add pc, pc, r9 | ||
65 | sub r8, 1 | ||
66 | nop | ||
67 | sub r8, 1 | ||
68 | nop | ||
69 | sub r8, 1 | ||
70 | nop | ||
71 | mov r9, r8 | ||
72 | rjmp 5b | ||
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile index 58a7e46affda..e7cbaa02cd0b 100644 --- a/arch/ia64/Makefile +++ b/arch/ia64/Makefile | |||
@@ -41,11 +41,6 @@ $(error Sorry, you need a newer version of the assember, one that is built from | |||
41 | ftp://ftp.hpl.hp.com/pub/linux-ia64/gas-030124.tar.gz) | 41 | ftp://ftp.hpl.hp.com/pub/linux-ia64/gas-030124.tar.gz) |
42 | endif | 42 | endif |
43 | 43 | ||
44 | ifeq ($(call cc-version),0304) | ||
45 | cflags-$(CONFIG_ITANIUM) += -mtune=merced | ||
46 | cflags-$(CONFIG_MCKINLEY) += -mtune=mckinley | ||
47 | endif | ||
48 | |||
49 | KBUILD_CFLAGS += $(cflags-y) | 44 | KBUILD_CFLAGS += $(cflags-y) |
50 | head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o | 45 | head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o |
51 | 46 | ||
diff --git a/arch/ia64/include/asm/bitops.h b/arch/ia64/include/asm/bitops.h index e2ca80037335..57a2787bc9fb 100644 --- a/arch/ia64/include/asm/bitops.h +++ b/arch/ia64/include/asm/bitops.h | |||
@@ -286,7 +286,7 @@ __test_and_clear_bit(int nr, volatile void * addr) | |||
286 | { | 286 | { |
287 | __u32 *p = (__u32 *) addr + (nr >> 5); | 287 | __u32 *p = (__u32 *) addr + (nr >> 5); |
288 | __u32 m = 1 << (nr & 31); | 288 | __u32 m = 1 << (nr & 31); |
289 | int oldbitset = *p & m; | 289 | int oldbitset = (*p & m) != 0; |
290 | 290 | ||
291 | *p &= ~m; | 291 | *p &= ~m; |
292 | return oldbitset; | 292 | return oldbitset; |
diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h index 0a9cc73d35c7..8840a690d1e7 100644 --- a/arch/ia64/include/asm/pgtable.h +++ b/arch/ia64/include/asm/pgtable.h | |||
@@ -155,7 +155,6 @@ | |||
155 | #include <linux/bitops.h> | 155 | #include <linux/bitops.h> |
156 | #include <asm/cacheflush.h> | 156 | #include <asm/cacheflush.h> |
157 | #include <asm/mmu_context.h> | 157 | #include <asm/mmu_context.h> |
158 | #include <asm/processor.h> | ||
159 | 158 | ||
160 | /* | 159 | /* |
161 | * Next come the mappings that determine how mmap() protection bits | 160 | * Next come the mappings that determine how mmap() protection bits |
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c index 39a3cd0a4173..f2c1600da097 100644 --- a/arch/ia64/kernel/dma-mapping.c +++ b/arch/ia64/kernel/dma-mapping.c | |||
@@ -10,7 +10,9 @@ EXPORT_SYMBOL(dma_ops); | |||
10 | 10 | ||
11 | static int __init dma_init(void) | 11 | static int __init dma_init(void) |
12 | { | 12 | { |
13 | dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES); | 13 | dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES); |
14 | |||
15 | return 0; | ||
14 | } | 16 | } |
15 | fs_initcall(dma_init); | 17 | fs_initcall(dma_init); |
16 | 18 | ||
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c index 2d311864e359..8ebccb589e1c 100644 --- a/arch/ia64/kernel/ia64_ksyms.c +++ b/arch/ia64/kernel/ia64_ksyms.c | |||
@@ -21,6 +21,7 @@ EXPORT_SYMBOL(csum_ipv6_magic); | |||
21 | 21 | ||
22 | #include <asm/page.h> | 22 | #include <asm/page.h> |
23 | EXPORT_SYMBOL(clear_page); | 23 | EXPORT_SYMBOL(clear_page); |
24 | EXPORT_SYMBOL(copy_page); | ||
24 | 25 | ||
25 | #ifdef CONFIG_VIRTUAL_MEM_MAP | 26 | #ifdef CONFIG_VIRTUAL_MEM_MAP |
26 | #include <linux/bootmem.h> | 27 | #include <linux/bootmem.h> |
@@ -60,9 +61,6 @@ EXPORT_SYMBOL(__udivdi3); | |||
60 | EXPORT_SYMBOL(__moddi3); | 61 | EXPORT_SYMBOL(__moddi3); |
61 | EXPORT_SYMBOL(__umoddi3); | 62 | EXPORT_SYMBOL(__umoddi3); |
62 | 63 | ||
63 | #include <asm/page.h> | ||
64 | EXPORT_SYMBOL(copy_page); | ||
65 | |||
66 | #if defined(CONFIG_MD_RAID456) || defined(CONFIG_MD_RAID456_MODULE) | 64 | #if defined(CONFIG_MD_RAID456) || defined(CONFIG_MD_RAID456_MODULE) |
67 | extern void xor_ia64_2(void); | 65 | extern void xor_ia64_2(void); |
68 | extern void xor_ia64_3(void); | 66 | extern void xor_ia64_3(void); |
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c index c48b03f2b61d..dab4d393908c 100644 --- a/arch/ia64/kernel/iosapic.c +++ b/arch/ia64/kernel/iosapic.c | |||
@@ -1072,6 +1072,10 @@ iosapic_init (unsigned long phys_addr, unsigned int gsi_base) | |||
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | addr = ioremap(phys_addr, 0); | 1074 | addr = ioremap(phys_addr, 0); |
1075 | if (addr == NULL) { | ||
1076 | spin_unlock_irqrestore(&iosapic_lock, flags); | ||
1077 | return -ENOMEM; | ||
1078 | } | ||
1075 | ver = iosapic_version(addr); | 1079 | ver = iosapic_version(addr); |
1076 | if ((err = iosapic_check_gsi_range(gsi_base, ver))) { | 1080 | if ((err = iosapic_check_gsi_range(gsi_base, ver))) { |
1077 | iounmap(addr); | 1081 | iounmap(addr); |
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c index 05695962fe44..f6b1ff0aea76 100644 --- a/arch/ia64/kernel/pci-dma.c +++ b/arch/ia64/kernel/pci-dma.c | |||
@@ -69,11 +69,6 @@ iommu_dma_init(void) | |||
69 | 69 | ||
70 | int iommu_dma_supported(struct device *dev, u64 mask) | 70 | int iommu_dma_supported(struct device *dev, u64 mask) |
71 | { | 71 | { |
72 | struct dma_map_ops *ops = platform_dma_get_ops(dev); | ||
73 | |||
74 | if (ops->dma_supported) | ||
75 | return ops->dma_supported(dev, mask); | ||
76 | |||
77 | /* Copied from i386. Doesn't make much sense, because it will | 72 | /* Copied from i386. Doesn't make much sense, because it will |
78 | only work for pci_alloc_coherent. | 73 | only work for pci_alloc_coherent. |
79 | The caller just has to use GFP_DMA in this case. */ | 74 | The caller just has to use GFP_DMA in this case. */ |
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index bc80dff1df7a..8f060352e129 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c | |||
@@ -372,6 +372,10 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) | |||
372 | retval = kobject_init_and_add(&all_cpu_cache_info[cpu].kobj, | 372 | retval = kobject_init_and_add(&all_cpu_cache_info[cpu].kobj, |
373 | &cache_ktype_percpu_entry, &sys_dev->kobj, | 373 | &cache_ktype_percpu_entry, &sys_dev->kobj, |
374 | "%s", "cache"); | 374 | "%s", "cache"); |
375 | if (unlikely(retval < 0)) { | ||
376 | cpu_cache_sysfs_exit(cpu); | ||
377 | return retval; | ||
378 | } | ||
375 | 379 | ||
376 | for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++) { | 380 | for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++) { |
377 | this_object = LEAF_KOBJECT_PTR(cpu,i); | 381 | this_object = LEAF_KOBJECT_PTR(cpu,i); |
@@ -385,7 +389,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) | |||
385 | } | 389 | } |
386 | kobject_put(&all_cpu_cache_info[cpu].kobj); | 390 | kobject_put(&all_cpu_cache_info[cpu].kobj); |
387 | cpu_cache_sysfs_exit(cpu); | 391 | cpu_cache_sysfs_exit(cpu); |
388 | break; | 392 | return retval; |
389 | } | 393 | } |
390 | kobject_uevent(&(this_object->kobj), KOBJ_ADD); | 394 | kobject_uevent(&(this_object->kobj), KOBJ_ADD); |
391 | } | 395 | } |
diff --git a/arch/ia64/lib/ip_fast_csum.S b/arch/ia64/lib/ip_fast_csum.S index 1f86aeb2c948..620d9dc5220f 100644 --- a/arch/ia64/lib/ip_fast_csum.S +++ b/arch/ia64/lib/ip_fast_csum.S | |||
@@ -96,20 +96,22 @@ END(ip_fast_csum) | |||
96 | GLOBAL_ENTRY(csum_ipv6_magic) | 96 | GLOBAL_ENTRY(csum_ipv6_magic) |
97 | ld4 r20=[in0],4 | 97 | ld4 r20=[in0],4 |
98 | ld4 r21=[in1],4 | 98 | ld4 r21=[in1],4 |
99 | dep r15=in3,in2,32,16 | 99 | zxt4 in2=in2 |
100 | ;; | 100 | ;; |
101 | ld4 r22=[in0],4 | 101 | ld4 r22=[in0],4 |
102 | ld4 r23=[in1],4 | 102 | ld4 r23=[in1],4 |
103 | mux1 r15=r15,@rev | 103 | dep r15=in3,in2,32,16 |
104 | ;; | 104 | ;; |
105 | ld4 r24=[in0],4 | 105 | ld4 r24=[in0],4 |
106 | ld4 r25=[in1],4 | 106 | ld4 r25=[in1],4 |
107 | shr.u r15=r15,16 | 107 | mux1 r15=r15,@rev |
108 | add r16=r20,r21 | 108 | add r16=r20,r21 |
109 | add r17=r22,r23 | 109 | add r17=r22,r23 |
110 | zxt4 in4=in4 | ||
110 | ;; | 111 | ;; |
111 | ld4 r26=[in0],4 | 112 | ld4 r26=[in0],4 |
112 | ld4 r27=[in1],4 | 113 | ld4 r27=[in1],4 |
114 | shr.u r15=r15,16 | ||
113 | add r18=r24,r25 | 115 | add r18=r24,r25 |
114 | add r8=r16,r17 | 116 | add r8=r16,r17 |
115 | ;; | 117 | ;; |
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c index 6e562751ad51..6c74751c7b82 100644 --- a/arch/m68k/amiga/config.c +++ b/arch/m68k/amiga/config.c | |||
@@ -574,10 +574,11 @@ static int a2000_hwclk(int op, struct rtc_time *t) | |||
574 | 574 | ||
575 | tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD; | 575 | tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD; |
576 | 576 | ||
577 | while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) { | 577 | while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt) { |
578 | tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD; | 578 | tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD; |
579 | udelay(70); | 579 | udelay(70); |
580 | tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; | 580 | tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; |
581 | --cnt; | ||
581 | } | 582 | } |
582 | 583 | ||
583 | if (!cnt) | 584 | if (!cnt) |
@@ -649,10 +650,11 @@ static int amiga_set_clock_mmss(unsigned long nowtime) | |||
649 | 650 | ||
650 | tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; | 651 | tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; |
651 | 652 | ||
652 | while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) { | 653 | while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt) { |
653 | tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD; | 654 | tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD; |
654 | udelay(70); | 655 | udelay(70); |
655 | tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; | 656 | tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; |
657 | --cnt; | ||
656 | } | 658 | } |
657 | 659 | ||
658 | if (!cnt) | 660 | if (!cnt) |
diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h index 15ee4c74a9f0..2f02f264e694 100644 --- a/arch/m68k/include/asm/motorola_pgalloc.h +++ b/arch/m68k/include/asm/motorola_pgalloc.h | |||
@@ -36,12 +36,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addres | |||
36 | return NULL; | 36 | return NULL; |
37 | 37 | ||
38 | pte = kmap(page); | 38 | pte = kmap(page); |
39 | if (pte) { | 39 | __flush_page_to_ram(pte); |
40 | __flush_page_to_ram(pte); | 40 | flush_tlb_kernel_page(pte); |
41 | flush_tlb_kernel_page(pte); | 41 | nocache_page(pte); |
42 | nocache_page(pte); | 42 | kunmap(page); |
43 | } | ||
44 | kunmap(pte); | ||
45 | pgtable_page_ctor(page); | 43 | pgtable_page_ctor(page); |
46 | return page; | 44 | return page; |
47 | } | 45 | } |
diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h index 0b604f0f192d..fe60e1abaee8 100644 --- a/arch/m68k/include/asm/pgtable_mm.h +++ b/arch/m68k/include/asm/pgtable_mm.h | |||
@@ -135,8 +135,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, | |||
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | #ifndef __ASSEMBLY__ | 137 | #ifndef __ASSEMBLY__ |
138 | #include <asm-generic/pgtable.h> | ||
139 | |||
140 | /* | 138 | /* |
141 | * Macro to mark a page protection value as "uncacheable". | 139 | * Macro to mark a page protection value as "uncacheable". |
142 | */ | 140 | */ |
@@ -154,6 +152,7 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, | |||
154 | ? (__pgprot((pgprot_val(prot) & _CACHEMASK040) | _PAGE_NOCACHE_S)) \ | 152 | ? (__pgprot((pgprot_val(prot) & _CACHEMASK040) | _PAGE_NOCACHE_S)) \ |
155 | : (prot))) | 153 | : (prot))) |
156 | 154 | ||
155 | #include <asm-generic/pgtable.h> | ||
157 | #endif /* !__ASSEMBLY__ */ | 156 | #endif /* !__ASSEMBLY__ */ |
158 | 157 | ||
159 | /* | 158 | /* |
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index aa29a8640f74..946d8691f2b0 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
@@ -334,10 +334,12 @@ | |||
334 | #define __NR_inotify_init1 328 | 334 | #define __NR_inotify_init1 328 |
335 | #define __NR_preadv 329 | 335 | #define __NR_preadv 329 |
336 | #define __NR_pwritev 330 | 336 | #define __NR_pwritev 330 |
337 | #define __NR_rt_tgsigqueueinfo 331 | ||
338 | #define __NR_perf_counter_open 332 | ||
337 | 339 | ||
338 | #ifdef __KERNEL__ | 340 | #ifdef __KERNEL__ |
339 | 341 | ||
340 | #define NR_syscalls 331 | 342 | #define NR_syscalls 333 |
341 | 343 | ||
342 | #define __ARCH_WANT_IPC_PARSE_VERSION | 344 | #define __ARCH_WANT_IPC_PARSE_VERSION |
343 | #define __ARCH_WANT_OLD_READDIR | 345 | #define __ARCH_WANT_OLD_READDIR |
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S index 8744f60c07a9..c3735cd6207e 100644 --- a/arch/m68k/kernel/entry.S +++ b/arch/m68k/kernel/entry.S | |||
@@ -755,4 +755,6 @@ sys_call_table: | |||
755 | .long sys_inotify_init1 | 755 | .long sys_inotify_init1 |
756 | .long sys_preadv | 756 | .long sys_preadv |
757 | .long sys_pwritev /* 330 */ | 757 | .long sys_pwritev /* 330 */ |
758 | .long sys_rt_tgsigqueueinfo | ||
759 | .long sys_perf_counter_open | ||
758 | 760 | ||
diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S index c0b8782832fd..0ae123e08985 100644 --- a/arch/m68knommu/kernel/syscalltable.S +++ b/arch/m68knommu/kernel/syscalltable.S | |||
@@ -349,6 +349,8 @@ ENTRY(sys_call_table) | |||
349 | .long sys_inotify_init1 | 349 | .long sys_inotify_init1 |
350 | .long sys_preadv | 350 | .long sys_preadv |
351 | .long sys_pwritev /* 330 */ | 351 | .long sys_pwritev /* 330 */ |
352 | .long sys_rt_tgsigqueueinfo | ||
353 | .long sys_perf_counter_open | ||
352 | 354 | ||
353 | .rept NR_syscalls-(.-sys_call_table)/4 | 355 | .rept NR_syscalls-(.-sys_call_table)/4 |
354 | .long sys_ni_syscall | 356 | .long sys_ni_syscall |
diff --git a/arch/microblaze/configs/mmu_defconfig b/arch/microblaze/configs/mmu_defconfig index bd0b85ec38f5..09c32962b66f 100644 --- a/arch/microblaze/configs/mmu_defconfig +++ b/arch/microblaze/configs/mmu_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.30-rc6 | 3 | # Linux kernel version: 2.6.31-rc6 |
4 | # Fri May 22 10:02:33 2009 | 4 | # Tue Aug 18 11:00:02 2009 |
5 | # | 5 | # |
6 | CONFIG_MICROBLAZE=y | 6 | CONFIG_MICROBLAZE=y |
7 | # CONFIG_SWAP is not set | 7 | # CONFIG_SWAP is not set |
@@ -18,7 +18,11 @@ CONFIG_GENERIC_TIME=y | |||
18 | CONFIG_GENERIC_CLOCKEVENTS=y | 18 | CONFIG_GENERIC_CLOCKEVENTS=y |
19 | CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y | 19 | CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y |
20 | CONFIG_GENERIC_GPIO=y | 20 | CONFIG_GENERIC_GPIO=y |
21 | CONFIG_GENERIC_CSUM=y | ||
22 | # CONFIG_PCI is not set | ||
23 | CONFIG_NO_DMA=y | ||
21 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 24 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
25 | CONFIG_CONSTRUCTORS=y | ||
22 | 26 | ||
23 | # | 27 | # |
24 | # General setup | 28 | # General setup |
@@ -59,8 +63,8 @@ CONFIG_INITRAMFS_ROOT_GID=0 | |||
59 | CONFIG_RD_GZIP=y | 63 | CONFIG_RD_GZIP=y |
60 | # CONFIG_RD_BZIP2 is not set | 64 | # CONFIG_RD_BZIP2 is not set |
61 | # CONFIG_RD_LZMA is not set | 65 | # CONFIG_RD_LZMA is not set |
62 | CONFIG_INITRAMFS_COMPRESSION_NONE=y | 66 | # CONFIG_INITRAMFS_COMPRESSION_NONE is not set |
63 | # CONFIG_INITRAMFS_COMPRESSION_GZIP is not set | 67 | CONFIG_INITRAMFS_COMPRESSION_GZIP=y |
64 | # CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set | 68 | # CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set |
65 | # CONFIG_INITRAMFS_COMPRESSION_LZMA is not set | 69 | # CONFIG_INITRAMFS_COMPRESSION_LZMA is not set |
66 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | 70 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set |
@@ -71,7 +75,6 @@ CONFIG_SYSCTL_SYSCALL=y | |||
71 | CONFIG_KALLSYMS=y | 75 | CONFIG_KALLSYMS=y |
72 | CONFIG_KALLSYMS_ALL=y | 76 | CONFIG_KALLSYMS_ALL=y |
73 | CONFIG_KALLSYMS_EXTRA_PASS=y | 77 | CONFIG_KALLSYMS_EXTRA_PASS=y |
74 | # CONFIG_STRIP_ASM_SYMS is not set | ||
75 | # CONFIG_HOTPLUG is not set | 78 | # CONFIG_HOTPLUG is not set |
76 | CONFIG_PRINTK=y | 79 | CONFIG_PRINTK=y |
77 | CONFIG_BUG=y | 80 | CONFIG_BUG=y |
@@ -84,13 +87,22 @@ CONFIG_TIMERFD=y | |||
84 | CONFIG_EVENTFD=y | 87 | CONFIG_EVENTFD=y |
85 | # CONFIG_SHMEM is not set | 88 | # CONFIG_SHMEM is not set |
86 | CONFIG_AIO=y | 89 | CONFIG_AIO=y |
90 | |||
91 | # | ||
92 | # Performance Counters | ||
93 | # | ||
87 | CONFIG_VM_EVENT_COUNTERS=y | 94 | CONFIG_VM_EVENT_COUNTERS=y |
95 | # CONFIG_STRIP_ASM_SYMS is not set | ||
88 | CONFIG_COMPAT_BRK=y | 96 | CONFIG_COMPAT_BRK=y |
89 | CONFIG_SLAB=y | 97 | CONFIG_SLAB=y |
90 | # CONFIG_SLUB is not set | 98 | # CONFIG_SLUB is not set |
91 | # CONFIG_SLOB is not set | 99 | # CONFIG_SLOB is not set |
92 | # CONFIG_PROFILING is not set | 100 | # CONFIG_PROFILING is not set |
93 | # CONFIG_MARKERS is not set | 101 | # CONFIG_MARKERS is not set |
102 | |||
103 | # | ||
104 | # GCOV-based kernel profiling | ||
105 | # | ||
94 | # CONFIG_SLOW_WORK is not set | 106 | # CONFIG_SLOW_WORK is not set |
95 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | 107 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set |
96 | CONFIG_SLABINFO=y | 108 | CONFIG_SLABINFO=y |
@@ -102,7 +114,7 @@ CONFIG_MODULE_UNLOAD=y | |||
102 | # CONFIG_MODVERSIONS is not set | 114 | # CONFIG_MODVERSIONS is not set |
103 | # CONFIG_MODULE_SRCVERSION_ALL is not set | 115 | # CONFIG_MODULE_SRCVERSION_ALL is not set |
104 | CONFIG_BLOCK=y | 116 | CONFIG_BLOCK=y |
105 | # CONFIG_LBD is not set | 117 | CONFIG_LBDAF=y |
106 | # CONFIG_BLK_DEV_BSG is not set | 118 | # CONFIG_BLK_DEV_BSG is not set |
107 | # CONFIG_BLK_DEV_INTEGRITY is not set | 119 | # CONFIG_BLK_DEV_INTEGRITY is not set |
108 | 120 | ||
@@ -194,9 +206,9 @@ CONFIG_SPLIT_PTLOCK_CPUS=4 | |||
194 | # CONFIG_PHYS_ADDR_T_64BIT is not set | 206 | # CONFIG_PHYS_ADDR_T_64BIT is not set |
195 | CONFIG_ZONE_DMA_FLAG=0 | 207 | CONFIG_ZONE_DMA_FLAG=0 |
196 | CONFIG_VIRT_TO_BUS=y | 208 | CONFIG_VIRT_TO_BUS=y |
197 | CONFIG_UNEVICTABLE_LRU=y | ||
198 | CONFIG_HAVE_MLOCK=y | 209 | CONFIG_HAVE_MLOCK=y |
199 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y | 210 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y |
211 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 | ||
200 | 212 | ||
201 | # | 213 | # |
202 | # Exectuable file formats | 214 | # Exectuable file formats |
@@ -262,6 +274,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic" | |||
262 | # CONFIG_ECONET is not set | 274 | # CONFIG_ECONET is not set |
263 | # CONFIG_WAN_ROUTER is not set | 275 | # CONFIG_WAN_ROUTER is not set |
264 | # CONFIG_PHONET is not set | 276 | # CONFIG_PHONET is not set |
277 | # CONFIG_IEEE802154 is not set | ||
265 | # CONFIG_NET_SCHED is not set | 278 | # CONFIG_NET_SCHED is not set |
266 | # CONFIG_DCB is not set | 279 | # CONFIG_DCB is not set |
267 | 280 | ||
@@ -325,7 +338,6 @@ CONFIG_MISC_DEVICES=y | |||
325 | # CONFIG_ATA is not set | 338 | # CONFIG_ATA is not set |
326 | # CONFIG_MD is not set | 339 | # CONFIG_MD is not set |
327 | CONFIG_NETDEVICES=y | 340 | CONFIG_NETDEVICES=y |
328 | CONFIG_COMPAT_NET_DEV_OPS=y | ||
329 | # CONFIG_DUMMY is not set | 341 | # CONFIG_DUMMY is not set |
330 | # CONFIG_BONDING is not set | 342 | # CONFIG_BONDING is not set |
331 | # CONFIG_MACVLAN is not set | 343 | # CONFIG_MACVLAN is not set |
@@ -344,7 +356,7 @@ CONFIG_NET_ETHERNET=y | |||
344 | # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set | 356 | # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set |
345 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set | 357 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set |
346 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set | 358 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set |
347 | # CONFIG_B44 is not set | 359 | # CONFIG_KS8842 is not set |
348 | CONFIG_NETDEV_1000=y | 360 | CONFIG_NETDEV_1000=y |
349 | CONFIG_NETDEV_10000=y | 361 | CONFIG_NETDEV_10000=y |
350 | 362 | ||
@@ -410,6 +422,11 @@ CONFIG_LEGACY_PTY_COUNT=256 | |||
410 | # CONFIG_TCG_TPM is not set | 422 | # CONFIG_TCG_TPM is not set |
411 | # CONFIG_I2C is not set | 423 | # CONFIG_I2C is not set |
412 | # CONFIG_SPI is not set | 424 | # CONFIG_SPI is not set |
425 | |||
426 | # | ||
427 | # PPS support | ||
428 | # | ||
429 | # CONFIG_PPS is not set | ||
413 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | 430 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y |
414 | # CONFIG_GPIOLIB is not set | 431 | # CONFIG_GPIOLIB is not set |
415 | # CONFIG_W1 is not set | 432 | # CONFIG_W1 is not set |
@@ -418,12 +435,6 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | |||
418 | # CONFIG_THERMAL is not set | 435 | # CONFIG_THERMAL is not set |
419 | # CONFIG_THERMAL_HWMON is not set | 436 | # CONFIG_THERMAL_HWMON is not set |
420 | # CONFIG_WATCHDOG is not set | 437 | # CONFIG_WATCHDOG is not set |
421 | CONFIG_SSB_POSSIBLE=y | ||
422 | |||
423 | # | ||
424 | # Sonics Silicon Backplane | ||
425 | # | ||
426 | # CONFIG_SSB is not set | ||
427 | 438 | ||
428 | # | 439 | # |
429 | # Multifunction device drivers | 440 | # Multifunction device drivers |
@@ -433,22 +444,7 @@ CONFIG_SSB_POSSIBLE=y | |||
433 | # CONFIG_HTC_PASIC3 is not set | 444 | # CONFIG_HTC_PASIC3 is not set |
434 | # CONFIG_MFD_TMIO is not set | 445 | # CONFIG_MFD_TMIO is not set |
435 | # CONFIG_REGULATOR is not set | 446 | # CONFIG_REGULATOR is not set |
436 | 447 | # CONFIG_MEDIA_SUPPORT is not set | |
437 | # | ||
438 | # Multimedia devices | ||
439 | # | ||
440 | |||
441 | # | ||
442 | # Multimedia core support | ||
443 | # | ||
444 | # CONFIG_VIDEO_DEV is not set | ||
445 | # CONFIG_DVB_CORE is not set | ||
446 | # CONFIG_VIDEO_MEDIA is not set | ||
447 | |||
448 | # | ||
449 | # Multimedia drivers | ||
450 | # | ||
451 | # CONFIG_DAB is not set | ||
452 | 448 | ||
453 | # | 449 | # |
454 | # Graphics support | 450 | # Graphics support |
@@ -469,9 +465,12 @@ CONFIG_SSB_POSSIBLE=y | |||
469 | # CONFIG_NEW_LEDS is not set | 465 | # CONFIG_NEW_LEDS is not set |
470 | # CONFIG_ACCESSIBILITY is not set | 466 | # CONFIG_ACCESSIBILITY is not set |
471 | # CONFIG_RTC_CLASS is not set | 467 | # CONFIG_RTC_CLASS is not set |
472 | # CONFIG_DMADEVICES is not set | ||
473 | # CONFIG_AUXDISPLAY is not set | 468 | # CONFIG_AUXDISPLAY is not set |
474 | # CONFIG_UIO is not set | 469 | # CONFIG_UIO is not set |
470 | |||
471 | # | ||
472 | # TI VLYNQ | ||
473 | # | ||
475 | # CONFIG_STAGING is not set | 474 | # CONFIG_STAGING is not set |
476 | 475 | ||
477 | # | 476 | # |
@@ -485,12 +484,15 @@ CONFIG_EXT2_FS=y | |||
485 | # CONFIG_REISERFS_FS is not set | 484 | # CONFIG_REISERFS_FS is not set |
486 | # CONFIG_JFS_FS is not set | 485 | # CONFIG_JFS_FS is not set |
487 | # CONFIG_FS_POSIX_ACL is not set | 486 | # CONFIG_FS_POSIX_ACL is not set |
488 | CONFIG_FILE_LOCKING=y | ||
489 | # CONFIG_XFS_FS is not set | 487 | # CONFIG_XFS_FS is not set |
488 | # CONFIG_GFS2_FS is not set | ||
490 | # CONFIG_OCFS2_FS is not set | 489 | # CONFIG_OCFS2_FS is not set |
491 | # CONFIG_BTRFS_FS is not set | 490 | # CONFIG_BTRFS_FS is not set |
491 | CONFIG_FILE_LOCKING=y | ||
492 | CONFIG_FSNOTIFY=y | ||
492 | # CONFIG_DNOTIFY is not set | 493 | # CONFIG_DNOTIFY is not set |
493 | # CONFIG_INOTIFY is not set | 494 | # CONFIG_INOTIFY is not set |
495 | CONFIG_INOTIFY_USER=y | ||
494 | # CONFIG_QUOTA is not set | 496 | # CONFIG_QUOTA is not set |
495 | # CONFIG_AUTOFS_FS is not set | 497 | # CONFIG_AUTOFS_FS is not set |
496 | # CONFIG_AUTOFS4_FS is not set | 498 | # CONFIG_AUTOFS4_FS is not set |
@@ -678,6 +680,7 @@ CONFIG_DEBUG_INFO=y | |||
678 | # CONFIG_SYSCTL_SYSCALL_CHECK is not set | 680 | # CONFIG_SYSCTL_SYSCALL_CHECK is not set |
679 | # CONFIG_PAGE_POISONING is not set | 681 | # CONFIG_PAGE_POISONING is not set |
680 | # CONFIG_SAMPLES is not set | 682 | # CONFIG_SAMPLES is not set |
683 | # CONFIG_KMEMCHECK is not set | ||
681 | CONFIG_EARLY_PRINTK=y | 684 | CONFIG_EARLY_PRINTK=y |
682 | CONFIG_HEART_BEAT=y | 685 | CONFIG_HEART_BEAT=y |
683 | CONFIG_DEBUG_BOOTMEM=y | 686 | CONFIG_DEBUG_BOOTMEM=y |
@@ -793,6 +796,5 @@ CONFIG_ZLIB_INFLATE=y | |||
793 | CONFIG_DECOMPRESS_GZIP=y | 796 | CONFIG_DECOMPRESS_GZIP=y |
794 | CONFIG_HAS_IOMEM=y | 797 | CONFIG_HAS_IOMEM=y |
795 | CONFIG_HAS_IOPORT=y | 798 | CONFIG_HAS_IOPORT=y |
796 | CONFIG_HAS_DMA=y | ||
797 | CONFIG_HAVE_LMB=y | 799 | CONFIG_HAVE_LMB=y |
798 | CONFIG_NLATTR=y | 800 | CONFIG_NLATTR=y |
diff --git a/arch/microblaze/configs/nommu_defconfig b/arch/microblaze/configs/nommu_defconfig index 4ef6af0a8f31..8b638615a972 100644 --- a/arch/microblaze/configs/nommu_defconfig +++ b/arch/microblaze/configs/nommu_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.30-rc5 | 3 | # Linux kernel version: 2.6.31-rc6 |
4 | # Mon May 11 09:01:02 2009 | 4 | # Tue Aug 18 10:35:30 2009 |
5 | # | 5 | # |
6 | CONFIG_MICROBLAZE=y | 6 | CONFIG_MICROBLAZE=y |
7 | # CONFIG_SWAP is not set | 7 | # CONFIG_SWAP is not set |
@@ -17,9 +17,12 @@ CONFIG_GENERIC_TIME=y | |||
17 | # CONFIG_GENERIC_TIME_VSYSCALL is not set | 17 | # CONFIG_GENERIC_TIME_VSYSCALL is not set |
18 | CONFIG_GENERIC_CLOCKEVENTS=y | 18 | CONFIG_GENERIC_CLOCKEVENTS=y |
19 | CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y | 19 | CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y |
20 | CONFIG_GENERIC_GPIO=y | ||
21 | CONFIG_GENERIC_CSUM=y | ||
20 | # CONFIG_PCI is not set | 22 | # CONFIG_PCI is not set |
21 | # CONFIG_NO_DMA is not set | 23 | CONFIG_NO_DMA=y |
22 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 24 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
25 | CONFIG_CONSTRUCTORS=y | ||
23 | 26 | ||
24 | # | 27 | # |
25 | # General setup | 28 | # General setup |
@@ -64,7 +67,6 @@ CONFIG_SYSCTL_SYSCALL=y | |||
64 | CONFIG_KALLSYMS=y | 67 | CONFIG_KALLSYMS=y |
65 | CONFIG_KALLSYMS_ALL=y | 68 | CONFIG_KALLSYMS_ALL=y |
66 | CONFIG_KALLSYMS_EXTRA_PASS=y | 69 | CONFIG_KALLSYMS_EXTRA_PASS=y |
67 | # CONFIG_STRIP_ASM_SYMS is not set | ||
68 | # CONFIG_HOTPLUG is not set | 70 | # CONFIG_HOTPLUG is not set |
69 | CONFIG_PRINTK=y | 71 | CONFIG_PRINTK=y |
70 | CONFIG_BUG=y | 72 | CONFIG_BUG=y |
@@ -76,13 +78,23 @@ CONFIG_SIGNALFD=y | |||
76 | CONFIG_TIMERFD=y | 78 | CONFIG_TIMERFD=y |
77 | CONFIG_EVENTFD=y | 79 | CONFIG_EVENTFD=y |
78 | CONFIG_AIO=y | 80 | CONFIG_AIO=y |
81 | |||
82 | # | ||
83 | # Performance Counters | ||
84 | # | ||
79 | CONFIG_VM_EVENT_COUNTERS=y | 85 | CONFIG_VM_EVENT_COUNTERS=y |
86 | # CONFIG_STRIP_ASM_SYMS is not set | ||
80 | CONFIG_COMPAT_BRK=y | 87 | CONFIG_COMPAT_BRK=y |
81 | CONFIG_SLAB=y | 88 | CONFIG_SLAB=y |
82 | # CONFIG_SLUB is not set | 89 | # CONFIG_SLUB is not set |
83 | # CONFIG_SLOB is not set | 90 | # CONFIG_SLOB is not set |
84 | # CONFIG_PROFILING is not set | 91 | # CONFIG_PROFILING is not set |
85 | # CONFIG_MARKERS is not set | 92 | # CONFIG_MARKERS is not set |
93 | |||
94 | # | ||
95 | # GCOV-based kernel profiling | ||
96 | # | ||
97 | # CONFIG_GCOV_KERNEL is not set | ||
86 | # CONFIG_SLOW_WORK is not set | 98 | # CONFIG_SLOW_WORK is not set |
87 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | 99 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set |
88 | CONFIG_SLABINFO=y | 100 | CONFIG_SLABINFO=y |
@@ -95,7 +107,7 @@ CONFIG_MODULE_UNLOAD=y | |||
95 | # CONFIG_MODVERSIONS is not set | 107 | # CONFIG_MODVERSIONS is not set |
96 | # CONFIG_MODULE_SRCVERSION_ALL is not set | 108 | # CONFIG_MODULE_SRCVERSION_ALL is not set |
97 | CONFIG_BLOCK=y | 109 | CONFIG_BLOCK=y |
98 | # CONFIG_LBD is not set | 110 | CONFIG_LBDAF=y |
99 | # CONFIG_BLK_DEV_BSG is not set | 111 | # CONFIG_BLK_DEV_BSG is not set |
100 | # CONFIG_BLK_DEV_INTEGRITY is not set | 112 | # CONFIG_BLK_DEV_INTEGRITY is not set |
101 | 113 | ||
@@ -156,8 +168,16 @@ CONFIG_CMDLINE_BOOL=y | |||
156 | CONFIG_CMDLINE="console=ttyUL0,115200" | 168 | CONFIG_CMDLINE="console=ttyUL0,115200" |
157 | # CONFIG_CMDLINE_FORCE is not set | 169 | # CONFIG_CMDLINE_FORCE is not set |
158 | CONFIG_OF=y | 170 | CONFIG_OF=y |
159 | CONFIG_OF_DEVICE=y | ||
160 | CONFIG_PROC_DEVICETREE=y | 171 | CONFIG_PROC_DEVICETREE=y |
172 | |||
173 | # | ||
174 | # Advanced setup | ||
175 | # | ||
176 | |||
177 | # | ||
178 | # Default settings for advanced configuration options are used | ||
179 | # | ||
180 | CONFIG_KERNEL_START=0x90000000 | ||
161 | CONFIG_SELECT_MEMORY_MODEL=y | 181 | CONFIG_SELECT_MEMORY_MODEL=y |
162 | CONFIG_FLATMEM_MANUAL=y | 182 | CONFIG_FLATMEM_MANUAL=y |
163 | # CONFIG_DISCONTIGMEM_MANUAL is not set | 183 | # CONFIG_DISCONTIGMEM_MANUAL is not set |
@@ -169,7 +189,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4 | |||
169 | # CONFIG_PHYS_ADDR_T_64BIT is not set | 189 | # CONFIG_PHYS_ADDR_T_64BIT is not set |
170 | CONFIG_ZONE_DMA_FLAG=0 | 190 | CONFIG_ZONE_DMA_FLAG=0 |
171 | CONFIG_VIRT_TO_BUS=y | 191 | CONFIG_VIRT_TO_BUS=y |
172 | CONFIG_UNEVICTABLE_LRU=y | 192 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 |
173 | CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1 | 193 | CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1 |
174 | 194 | ||
175 | # | 195 | # |
@@ -237,6 +257,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic" | |||
237 | # CONFIG_ECONET is not set | 257 | # CONFIG_ECONET is not set |
238 | # CONFIG_WAN_ROUTER is not set | 258 | # CONFIG_WAN_ROUTER is not set |
239 | # CONFIG_PHONET is not set | 259 | # CONFIG_PHONET is not set |
260 | # CONFIG_IEEE802154 is not set | ||
240 | # CONFIG_NET_SCHED is not set | 261 | # CONFIG_NET_SCHED is not set |
241 | # CONFIG_DCB is not set | 262 | # CONFIG_DCB is not set |
242 | 263 | ||
@@ -254,7 +275,11 @@ CONFIG_WIRELESS=y | |||
254 | CONFIG_WIRELESS_OLD_REGULATORY=y | 275 | CONFIG_WIRELESS_OLD_REGULATORY=y |
255 | # CONFIG_WIRELESS_EXT is not set | 276 | # CONFIG_WIRELESS_EXT is not set |
256 | # CONFIG_LIB80211 is not set | 277 | # CONFIG_LIB80211 is not set |
257 | # CONFIG_MAC80211 is not set | 278 | |
279 | # | ||
280 | # CFG80211 needs to be enabled for MAC80211 | ||
281 | # | ||
282 | CONFIG_MAC80211_DEFAULT_PS_VALUE=0 | ||
258 | # CONFIG_WIMAX is not set | 283 | # CONFIG_WIMAX is not set |
259 | # CONFIG_RFKILL is not set | 284 | # CONFIG_RFKILL is not set |
260 | # CONFIG_NET_9P is not set | 285 | # CONFIG_NET_9P is not set |
@@ -353,6 +378,7 @@ CONFIG_MTD_UCLINUX=y | |||
353 | # UBI - Unsorted block images | 378 | # UBI - Unsorted block images |
354 | # | 379 | # |
355 | # CONFIG_MTD_UBI is not set | 380 | # CONFIG_MTD_UBI is not set |
381 | CONFIG_OF_DEVICE=y | ||
356 | # CONFIG_PARPORT is not set | 382 | # CONFIG_PARPORT is not set |
357 | CONFIG_BLK_DEV=y | 383 | CONFIG_BLK_DEV=y |
358 | # CONFIG_BLK_DEV_COW_COMMON is not set | 384 | # CONFIG_BLK_DEV_COW_COMMON is not set |
@@ -364,6 +390,7 @@ CONFIG_BLK_DEV_RAM_SIZE=4096 | |||
364 | # CONFIG_BLK_DEV_XIP is not set | 390 | # CONFIG_BLK_DEV_XIP is not set |
365 | # CONFIG_CDROM_PKTCDVD is not set | 391 | # CONFIG_CDROM_PKTCDVD is not set |
366 | # CONFIG_ATA_OVER_ETH is not set | 392 | # CONFIG_ATA_OVER_ETH is not set |
393 | # CONFIG_XILINX_SYSACE is not set | ||
367 | CONFIG_MISC_DEVICES=y | 394 | CONFIG_MISC_DEVICES=y |
368 | # CONFIG_ENCLOSURE_SERVICES is not set | 395 | # CONFIG_ENCLOSURE_SERVICES is not set |
369 | # CONFIG_C2PORT is not set | 396 | # CONFIG_C2PORT is not set |
@@ -383,7 +410,6 @@ CONFIG_MISC_DEVICES=y | |||
383 | # CONFIG_ATA is not set | 410 | # CONFIG_ATA is not set |
384 | # CONFIG_MD is not set | 411 | # CONFIG_MD is not set |
385 | CONFIG_NETDEVICES=y | 412 | CONFIG_NETDEVICES=y |
386 | CONFIG_COMPAT_NET_DEV_OPS=y | ||
387 | # CONFIG_DUMMY is not set | 413 | # CONFIG_DUMMY is not set |
388 | # CONFIG_BONDING is not set | 414 | # CONFIG_BONDING is not set |
389 | # CONFIG_MACVLAN is not set | 415 | # CONFIG_MACVLAN is not set |
@@ -402,7 +428,7 @@ CONFIG_NET_ETHERNET=y | |||
402 | # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set | 428 | # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set |
403 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set | 429 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set |
404 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set | 430 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set |
405 | # CONFIG_B44 is not set | 431 | # CONFIG_KS8842 is not set |
406 | CONFIG_NETDEV_1000=y | 432 | CONFIG_NETDEV_1000=y |
407 | CONFIG_NETDEV_10000=y | 433 | CONFIG_NETDEV_10000=y |
408 | 434 | ||
@@ -463,23 +489,25 @@ CONFIG_HW_RANDOM=y | |||
463 | # CONFIG_HW_RANDOM_TIMERIOMEM is not set | 489 | # CONFIG_HW_RANDOM_TIMERIOMEM is not set |
464 | # CONFIG_RTC is not set | 490 | # CONFIG_RTC is not set |
465 | # CONFIG_GEN_RTC is not set | 491 | # CONFIG_GEN_RTC is not set |
492 | # CONFIG_XILINX_HWICAP is not set | ||
466 | # CONFIG_R3964 is not set | 493 | # CONFIG_R3964 is not set |
467 | # CONFIG_RAW_DRIVER is not set | 494 | # CONFIG_RAW_DRIVER is not set |
468 | # CONFIG_TCG_TPM is not set | 495 | # CONFIG_TCG_TPM is not set |
469 | # CONFIG_I2C is not set | 496 | # CONFIG_I2C is not set |
470 | # CONFIG_SPI is not set | 497 | # CONFIG_SPI is not set |
498 | |||
499 | # | ||
500 | # PPS support | ||
501 | # | ||
502 | # CONFIG_PPS is not set | ||
503 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | ||
504 | # CONFIG_GPIOLIB is not set | ||
471 | # CONFIG_W1 is not set | 505 | # CONFIG_W1 is not set |
472 | # CONFIG_POWER_SUPPLY is not set | 506 | # CONFIG_POWER_SUPPLY is not set |
473 | # CONFIG_HWMON is not set | 507 | # CONFIG_HWMON is not set |
474 | # CONFIG_THERMAL is not set | 508 | # CONFIG_THERMAL is not set |
475 | # CONFIG_THERMAL_HWMON is not set | 509 | # CONFIG_THERMAL_HWMON is not set |
476 | # CONFIG_WATCHDOG is not set | 510 | # CONFIG_WATCHDOG is not set |
477 | CONFIG_SSB_POSSIBLE=y | ||
478 | |||
479 | # | ||
480 | # Sonics Silicon Backplane | ||
481 | # | ||
482 | # CONFIG_SSB is not set | ||
483 | 511 | ||
484 | # | 512 | # |
485 | # Multifunction device drivers | 513 | # Multifunction device drivers |
@@ -489,22 +517,7 @@ CONFIG_SSB_POSSIBLE=y | |||
489 | # CONFIG_HTC_PASIC3 is not set | 517 | # CONFIG_HTC_PASIC3 is not set |
490 | # CONFIG_MFD_TMIO is not set | 518 | # CONFIG_MFD_TMIO is not set |
491 | # CONFIG_REGULATOR is not set | 519 | # CONFIG_REGULATOR is not set |
492 | 520 | # CONFIG_MEDIA_SUPPORT is not set | |
493 | # | ||
494 | # Multimedia devices | ||
495 | # | ||
496 | |||
497 | # | ||
498 | # Multimedia core support | ||
499 | # | ||
500 | # CONFIG_VIDEO_DEV is not set | ||
501 | # CONFIG_DVB_CORE is not set | ||
502 | # CONFIG_VIDEO_MEDIA is not set | ||
503 | |||
504 | # | ||
505 | # Multimedia drivers | ||
506 | # | ||
507 | CONFIG_DAB=y | ||
508 | 521 | ||
509 | # | 522 | # |
510 | # Graphics support | 523 | # Graphics support |
@@ -520,9 +533,10 @@ CONFIG_VIDEO_OUTPUT_CONTROL=y | |||
520 | # CONFIG_DISPLAY_SUPPORT is not set | 533 | # CONFIG_DISPLAY_SUPPORT is not set |
521 | # CONFIG_SOUND is not set | 534 | # CONFIG_SOUND is not set |
522 | CONFIG_USB_SUPPORT=y | 535 | CONFIG_USB_SUPPORT=y |
523 | # CONFIG_USB_ARCH_HAS_HCD is not set | 536 | CONFIG_USB_ARCH_HAS_HCD=y |
524 | # CONFIG_USB_ARCH_HAS_OHCI is not set | 537 | # CONFIG_USB_ARCH_HAS_OHCI is not set |
525 | # CONFIG_USB_ARCH_HAS_EHCI is not set | 538 | # CONFIG_USB_ARCH_HAS_EHCI is not set |
539 | # CONFIG_USB is not set | ||
526 | # CONFIG_USB_OTG_WHITELIST is not set | 540 | # CONFIG_USB_OTG_WHITELIST is not set |
527 | # CONFIG_USB_OTG_BLACKLIST_HUB is not set | 541 | # CONFIG_USB_OTG_BLACKLIST_HUB is not set |
528 | 542 | ||
@@ -543,9 +557,12 @@ CONFIG_USB_SUPPORT=y | |||
543 | # CONFIG_NEW_LEDS is not set | 557 | # CONFIG_NEW_LEDS is not set |
544 | # CONFIG_ACCESSIBILITY is not set | 558 | # CONFIG_ACCESSIBILITY is not set |
545 | # CONFIG_RTC_CLASS is not set | 559 | # CONFIG_RTC_CLASS is not set |
546 | # CONFIG_DMADEVICES is not set | ||
547 | # CONFIG_AUXDISPLAY is not set | 560 | # CONFIG_AUXDISPLAY is not set |
548 | # CONFIG_UIO is not set | 561 | # CONFIG_UIO is not set |
562 | |||
563 | # | ||
564 | # TI VLYNQ | ||
565 | # | ||
549 | # CONFIG_STAGING is not set | 566 | # CONFIG_STAGING is not set |
550 | 567 | ||
551 | # | 568 | # |
@@ -558,12 +575,15 @@ CONFIG_EXT2_FS=y | |||
558 | # CONFIG_REISERFS_FS is not set | 575 | # CONFIG_REISERFS_FS is not set |
559 | # CONFIG_JFS_FS is not set | 576 | # CONFIG_JFS_FS is not set |
560 | CONFIG_FS_POSIX_ACL=y | 577 | CONFIG_FS_POSIX_ACL=y |
561 | CONFIG_FILE_LOCKING=y | ||
562 | # CONFIG_XFS_FS is not set | 578 | # CONFIG_XFS_FS is not set |
579 | # CONFIG_GFS2_FS is not set | ||
563 | # CONFIG_OCFS2_FS is not set | 580 | # CONFIG_OCFS2_FS is not set |
564 | # CONFIG_BTRFS_FS is not set | 581 | # CONFIG_BTRFS_FS is not set |
582 | CONFIG_FILE_LOCKING=y | ||
583 | CONFIG_FSNOTIFY=y | ||
565 | # CONFIG_DNOTIFY is not set | 584 | # CONFIG_DNOTIFY is not set |
566 | # CONFIG_INOTIFY is not set | 585 | # CONFIG_INOTIFY is not set |
586 | CONFIG_INOTIFY_USER=y | ||
567 | # CONFIG_QUOTA is not set | 587 | # CONFIG_QUOTA is not set |
568 | # CONFIG_AUTOFS_FS is not set | 588 | # CONFIG_AUTOFS_FS is not set |
569 | # CONFIG_AUTOFS4_FS is not set | 589 | # CONFIG_AUTOFS4_FS is not set |
@@ -813,6 +833,5 @@ CONFIG_GENERIC_FIND_LAST_BIT=y | |||
813 | CONFIG_ZLIB_INFLATE=y | 833 | CONFIG_ZLIB_INFLATE=y |
814 | CONFIG_HAS_IOMEM=y | 834 | CONFIG_HAS_IOMEM=y |
815 | CONFIG_HAS_IOPORT=y | 835 | CONFIG_HAS_IOPORT=y |
816 | CONFIG_HAS_DMA=y | ||
817 | CONFIG_HAVE_LMB=y | 836 | CONFIG_HAVE_LMB=y |
818 | CONFIG_NLATTR=y | 837 | CONFIG_NLATTR=y |
diff --git a/arch/microblaze/include/asm/hardirq.h b/arch/microblaze/include/asm/hardirq.h index 41e1e1aa36ac..cd1ac9aad56c 100644 --- a/arch/microblaze/include/asm/hardirq.h +++ b/arch/microblaze/include/asm/hardirq.h | |||
@@ -12,8 +12,6 @@ | |||
12 | /* should be defined in each interrupt controller driver */ | 12 | /* should be defined in each interrupt controller driver */ |
13 | extern unsigned int get_irq(struct pt_regs *regs); | 13 | extern unsigned int get_irq(struct pt_regs *regs); |
14 | 14 | ||
15 | #define ack_bad_irq ack_bad_irq | ||
16 | void ack_bad_irq(unsigned int irq); | ||
17 | #include <asm-generic/hardirq.h> | 15 | #include <asm-generic/hardirq.h> |
18 | 16 | ||
19 | #endif /* _ASM_MICROBLAZE_HARDIRQ_H */ | 17 | #endif /* _ASM_MICROBLAZE_HARDIRQ_H */ |
diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c index b15605299a57..6eea6f92b84e 100644 --- a/arch/microblaze/kernel/intc.c +++ b/arch/microblaze/kernel/intc.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/irq.h> | 12 | #include <linux/irq.h> |
13 | #include <asm/page.h> | 13 | #include <asm/page.h> |
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <linux/bug.h> | ||
15 | 16 | ||
16 | #include <asm/prom.h> | 17 | #include <asm/prom.h> |
17 | #include <asm/irq.h> | 18 | #include <asm/irq.h> |
@@ -130,6 +131,7 @@ void __init init_IRQ(void) | |||
130 | if (intc) | 131 | if (intc) |
131 | break; | 132 | break; |
132 | } | 133 | } |
134 | BUG_ON(!intc); | ||
133 | 135 | ||
134 | intc_baseaddr = *(int *) of_get_property(intc, "reg", NULL); | 136 | intc_baseaddr = *(int *) of_get_property(intc, "reg", NULL); |
135 | intc_baseaddr = (unsigned long) ioremap(intc_baseaddr, PAGE_SIZE); | 137 | intc_baseaddr = (unsigned long) ioremap(intc_baseaddr, PAGE_SIZE); |
diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c index f688ee93e3b9..7d5ddd62d4d2 100644 --- a/arch/microblaze/kernel/irq.c +++ b/arch/microblaze/kernel/irq.c | |||
@@ -30,15 +30,6 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index) | |||
30 | } | 30 | } |
31 | EXPORT_SYMBOL_GPL(irq_of_parse_and_map); | 31 | EXPORT_SYMBOL_GPL(irq_of_parse_and_map); |
32 | 32 | ||
33 | /* | ||
34 | * 'what should we do if we get a hw irq event on an illegal vector'. | ||
35 | * each architecture has to answer this themselves. | ||
36 | */ | ||
37 | void ack_bad_irq(unsigned int irq) | ||
38 | { | ||
39 | printk(KERN_WARNING "unexpected IRQ trap at vector %02x\n", irq); | ||
40 | } | ||
41 | |||
42 | static u32 concurrent_irq; | 33 | static u32 concurrent_irq; |
43 | 34 | ||
44 | void do_IRQ(struct pt_regs *regs) | 35 | void do_IRQ(struct pt_regs *regs) |
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S index 216db817beb6..457216097dfd 100644 --- a/arch/microblaze/kernel/syscall_table.S +++ b/arch/microblaze/kernel/syscall_table.S | |||
@@ -313,7 +313,7 @@ ENTRY(sys_call_table) | |||
313 | .long sys_fchmodat | 313 | .long sys_fchmodat |
314 | .long sys_faccessat | 314 | .long sys_faccessat |
315 | .long sys_ni_syscall /* pselect6 */ | 315 | .long sys_ni_syscall /* pselect6 */ |
316 | .long sys_ni_syscall /* sys_ppoll */ | 316 | .long sys_ppoll |
317 | .long sys_unshare /* 310 */ | 317 | .long sys_unshare /* 310 */ |
318 | .long sys_set_robust_list | 318 | .long sys_set_robust_list |
319 | .long sys_get_robust_list | 319 | .long sys_get_robust_list |
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c index bdfa2f9f0c81..5499deae7fa6 100644 --- a/arch/microblaze/kernel/timer.c +++ b/arch/microblaze/kernel/timer.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/clocksource.h> | 22 | #include <linux/clocksource.h> |
23 | #include <linux/clockchips.h> | 23 | #include <linux/clockchips.h> |
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/bug.h> | ||
25 | #include <asm/cpuinfo.h> | 26 | #include <asm/cpuinfo.h> |
26 | #include <asm/setup.h> | 27 | #include <asm/setup.h> |
27 | #include <asm/prom.h> | 28 | #include <asm/prom.h> |
@@ -234,6 +235,7 @@ void __init time_init(void) | |||
234 | if (timer) | 235 | if (timer) |
235 | break; | 236 | break; |
236 | } | 237 | } |
238 | BUG_ON(!timer); | ||
237 | 239 | ||
238 | timer_baseaddr = *(int *) of_get_property(timer, "reg", NULL); | 240 | timer_baseaddr = *(int *) of_get_property(timer, "reg", NULL); |
239 | timer_baseaddr = (unsigned long) ioremap(timer_baseaddr, PAGE_SIZE); | 241 | timer_baseaddr = (unsigned long) ioremap(timer_baseaddr, PAGE_SIZE); |
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c index 8d92c4efe9a4..f207f1a94dbc 100644 --- a/arch/microblaze/mm/init.c +++ b/arch/microblaze/mm/init.c | |||
@@ -130,13 +130,13 @@ void __init setup_memory(void) | |||
130 | * (in case the address isn't page-aligned). | 130 | * (in case the address isn't page-aligned). |
131 | */ | 131 | */ |
132 | #ifndef CONFIG_MMU | 132 | #ifndef CONFIG_MMU |
133 | map_size = init_bootmem_node(NODE_DATA(0), PFN_UP(TOPHYS((u32)_end)), | 133 | map_size = init_bootmem_node(NODE_DATA(0), PFN_UP(TOPHYS((u32)klimit)), |
134 | min_low_pfn, max_low_pfn); | 134 | min_low_pfn, max_low_pfn); |
135 | #else | 135 | #else |
136 | map_size = init_bootmem_node(&contig_page_data, | 136 | map_size = init_bootmem_node(&contig_page_data, |
137 | PFN_UP(TOPHYS((u32)_end)), min_low_pfn, max_low_pfn); | 137 | PFN_UP(TOPHYS((u32)klimit)), min_low_pfn, max_low_pfn); |
138 | #endif | 138 | #endif |
139 | lmb_reserve(PFN_UP(TOPHYS((u32)_end)) << PAGE_SHIFT, map_size); | 139 | lmb_reserve(PFN_UP(TOPHYS((u32)klimit)) << PAGE_SHIFT, map_size); |
140 | 140 | ||
141 | /* free bootmem is whole main memory */ | 141 | /* free bootmem is whole main memory */ |
142 | free_bootmem(memory_start, memory_size); | 142 | free_bootmem(memory_start, memory_size); |
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h index 96a14a426a7c..4320239cf4ef 100644 --- a/arch/mips/include/asm/page.h +++ b/arch/mips/include/asm/page.h | |||
@@ -32,10 +32,12 @@ | |||
32 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | 32 | #define PAGE_SIZE (1UL << PAGE_SHIFT) |
33 | #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) | 33 | #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) |
34 | 34 | ||
35 | #ifdef CONFIG_HUGETLB_PAGE | ||
35 | #define HPAGE_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3) | 36 | #define HPAGE_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3) |
36 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) | 37 | #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) |
37 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) | 38 | #define HPAGE_MASK (~(HPAGE_SIZE - 1)) |
38 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | 39 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) |
40 | #endif /* CONFIG_HUGETLB_PAGE */ | ||
39 | 41 | ||
40 | #ifndef __ASSEMBLY__ | 42 | #ifndef __ASSEMBLY__ |
41 | 43 | ||
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c index 528f0ff9b273..8b58bf0b7d5a 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c | |||
@@ -532,7 +532,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs) | |||
532 | /* Kill the user process later */ | 532 | /* Kill the user process later */ |
533 | regs->iaoq[0] = 0 | 3; | 533 | regs->iaoq[0] = 0 | 3; |
534 | regs->iaoq[1] = regs->iaoq[0] + 4; | 534 | regs->iaoq[1] = regs->iaoq[0] + 4; |
535 | regs->iasq[0] = regs->iasq[0] = regs->sr[7]; | 535 | regs->iasq[0] = regs->iasq[1] = regs->sr[7]; |
536 | regs->gr[0] &= ~PSW_B; | 536 | regs->gr[0] &= ~PSW_B; |
537 | return; | 537 | return; |
538 | } | 538 | } |
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig index e28e65e7a0e1..7de127e4ceef 100644 --- a/arch/powerpc/configs/ps3_defconfig +++ b/arch/powerpc/configs/ps3_defconfig | |||
@@ -1,13 +1,14 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.30-rc5 | 3 | # Linux kernel version: 2.6.31-rc7 |
4 | # Fri May 15 10:37:00 2009 | 4 | # Mon Aug 24 17:38:50 2009 |
5 | # | 5 | # |
6 | CONFIG_PPC64=y | 6 | CONFIG_PPC64=y |
7 | 7 | ||
8 | # | 8 | # |
9 | # Processor support | 9 | # Processor support |
10 | # | 10 | # |
11 | CONFIG_PPC_BOOK3S_64=y | ||
11 | CONFIG_PPC_BOOK3S=y | 12 | CONFIG_PPC_BOOK3S=y |
12 | # CONFIG_POWER4_ONLY is not set | 13 | # CONFIG_POWER4_ONLY is not set |
13 | CONFIG_POWER3=y | 14 | CONFIG_POWER3=y |
@@ -20,6 +21,7 @@ CONFIG_PPC_STD_MMU=y | |||
20 | CONFIG_PPC_STD_MMU_64=y | 21 | CONFIG_PPC_STD_MMU_64=y |
21 | CONFIG_PPC_MM_SLICES=y | 22 | CONFIG_PPC_MM_SLICES=y |
22 | CONFIG_VIRT_CPU_ACCOUNTING=y | 23 | CONFIG_VIRT_CPU_ACCOUNTING=y |
24 | CONFIG_PPC_HAVE_PMU_SUPPORT=y | ||
23 | CONFIG_SMP=y | 25 | CONFIG_SMP=y |
24 | CONFIG_NR_CPUS=2 | 26 | CONFIG_NR_CPUS=2 |
25 | CONFIG_64BIT=y | 27 | CONFIG_64BIT=y |
@@ -31,6 +33,7 @@ CONFIG_GENERIC_TIME=y | |||
31 | CONFIG_GENERIC_TIME_VSYSCALL=y | 33 | CONFIG_GENERIC_TIME_VSYSCALL=y |
32 | CONFIG_GENERIC_CLOCKEVENTS=y | 34 | CONFIG_GENERIC_CLOCKEVENTS=y |
33 | CONFIG_GENERIC_HARDIRQS=y | 35 | CONFIG_GENERIC_HARDIRQS=y |
36 | CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y | ||
34 | CONFIG_HAVE_SETUP_PER_CPU_AREA=y | 37 | CONFIG_HAVE_SETUP_PER_CPU_AREA=y |
35 | CONFIG_IRQ_PER_CPU=y | 38 | CONFIG_IRQ_PER_CPU=y |
36 | CONFIG_STACKTRACE_SUPPORT=y | 39 | CONFIG_STACKTRACE_SUPPORT=y |
@@ -41,7 +44,6 @@ CONFIG_RWSEM_XCHGADD_ALGORITHM=y | |||
41 | CONFIG_ARCH_HAS_ILOG2_U32=y | 44 | CONFIG_ARCH_HAS_ILOG2_U32=y |
42 | CONFIG_ARCH_HAS_ILOG2_U64=y | 45 | CONFIG_ARCH_HAS_ILOG2_U64=y |
43 | CONFIG_GENERIC_HWEIGHT=y | 46 | CONFIG_GENERIC_HWEIGHT=y |
44 | CONFIG_GENERIC_CALIBRATE_DELAY=y | ||
45 | CONFIG_GENERIC_FIND_NEXT_BIT=y | 47 | CONFIG_GENERIC_FIND_NEXT_BIT=y |
46 | CONFIG_ARCH_NO_VIRT_TO_BUS=y | 48 | CONFIG_ARCH_NO_VIRT_TO_BUS=y |
47 | CONFIG_PPC=y | 49 | CONFIG_PPC=y |
@@ -62,6 +64,7 @@ CONFIG_DTC=y | |||
62 | # CONFIG_PPC_DCR_MMIO is not set | 64 | # CONFIG_PPC_DCR_MMIO is not set |
63 | CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y | 65 | CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y |
64 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 66 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
67 | CONFIG_CONSTRUCTORS=y | ||
65 | 68 | ||
66 | # | 69 | # |
67 | # General setup | 70 | # General setup |
@@ -113,7 +116,6 @@ CONFIG_SYSCTL_SYSCALL=y | |||
113 | CONFIG_KALLSYMS=y | 116 | CONFIG_KALLSYMS=y |
114 | CONFIG_KALLSYMS_ALL=y | 117 | CONFIG_KALLSYMS_ALL=y |
115 | CONFIG_KALLSYMS_EXTRA_PASS=y | 118 | CONFIG_KALLSYMS_EXTRA_PASS=y |
116 | # CONFIG_STRIP_ASM_SYMS is not set | ||
117 | CONFIG_HOTPLUG=y | 119 | CONFIG_HOTPLUG=y |
118 | CONFIG_PRINTK=y | 120 | CONFIG_PRINTK=y |
119 | CONFIG_BUG=y | 121 | CONFIG_BUG=y |
@@ -126,7 +128,14 @@ CONFIG_TIMERFD=y | |||
126 | CONFIG_EVENTFD=y | 128 | CONFIG_EVENTFD=y |
127 | CONFIG_SHMEM=y | 129 | CONFIG_SHMEM=y |
128 | CONFIG_AIO=y | 130 | CONFIG_AIO=y |
131 | CONFIG_HAVE_PERF_COUNTERS=y | ||
132 | |||
133 | # | ||
134 | # Performance Counters | ||
135 | # | ||
136 | # CONFIG_PERF_COUNTERS is not set | ||
129 | CONFIG_VM_EVENT_COUNTERS=y | 137 | CONFIG_VM_EVENT_COUNTERS=y |
138 | # CONFIG_STRIP_ASM_SYMS is not set | ||
130 | # CONFIG_COMPAT_BRK is not set | 139 | # CONFIG_COMPAT_BRK is not set |
131 | CONFIG_SLAB=y | 140 | CONFIG_SLAB=y |
132 | # CONFIG_SLUB is not set | 141 | # CONFIG_SLUB is not set |
@@ -145,6 +154,11 @@ CONFIG_HAVE_KRETPROBES=y | |||
145 | CONFIG_HAVE_ARCH_TRACEHOOK=y | 154 | CONFIG_HAVE_ARCH_TRACEHOOK=y |
146 | CONFIG_HAVE_DMA_ATTRS=y | 155 | CONFIG_HAVE_DMA_ATTRS=y |
147 | CONFIG_USE_GENERIC_SMP_HELPERS=y | 156 | CONFIG_USE_GENERIC_SMP_HELPERS=y |
157 | |||
158 | # | ||
159 | # GCOV-based kernel profiling | ||
160 | # | ||
161 | # CONFIG_GCOV_KERNEL is not set | ||
148 | # CONFIG_SLOW_WORK is not set | 162 | # CONFIG_SLOW_WORK is not set |
149 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | 163 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set |
150 | CONFIG_SLABINFO=y | 164 | CONFIG_SLABINFO=y |
@@ -210,7 +224,7 @@ CONFIG_PPC_CELL=y | |||
210 | # | 224 | # |
211 | # Cell Broadband Engine options | 225 | # Cell Broadband Engine options |
212 | # | 226 | # |
213 | CONFIG_SPU_FS=y | 227 | CONFIG_SPU_FS=m |
214 | CONFIG_SPU_FS_64K_LS=y | 228 | CONFIG_SPU_FS_64K_LS=y |
215 | # CONFIG_SPU_TRACE is not set | 229 | # CONFIG_SPU_TRACE is not set |
216 | CONFIG_SPU_BASE=y | 230 | CONFIG_SPU_BASE=y |
@@ -255,6 +269,7 @@ CONFIG_BINFMT_MISC=y | |||
255 | CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y | 269 | CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y |
256 | # CONFIG_IOMMU_VMERGE is not set | 270 | # CONFIG_IOMMU_VMERGE is not set |
257 | CONFIG_IOMMU_HELPER=y | 271 | CONFIG_IOMMU_HELPER=y |
272 | # CONFIG_SWIOTLB is not set | ||
258 | CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y | 273 | CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y |
259 | CONFIG_ARCH_HAS_WALK_MEMORY=y | 274 | CONFIG_ARCH_HAS_WALK_MEMORY=y |
260 | CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y | 275 | CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y |
@@ -285,9 +300,9 @@ CONFIG_MIGRATION=y | |||
285 | CONFIG_PHYS_ADDR_T_64BIT=y | 300 | CONFIG_PHYS_ADDR_T_64BIT=y |
286 | CONFIG_ZONE_DMA_FLAG=1 | 301 | CONFIG_ZONE_DMA_FLAG=1 |
287 | CONFIG_BOUNCE=y | 302 | CONFIG_BOUNCE=y |
288 | CONFIG_UNEVICTABLE_LRU=y | ||
289 | CONFIG_HAVE_MLOCK=y | 303 | CONFIG_HAVE_MLOCK=y |
290 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y | 304 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y |
305 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 | ||
291 | CONFIG_ARCH_MEMORY_PROBE=y | 306 | CONFIG_ARCH_MEMORY_PROBE=y |
292 | CONFIG_PPC_HAS_HASH_64K=y | 307 | CONFIG_PPC_HAS_HASH_64K=y |
293 | CONFIG_PPC_4K_PAGES=y | 308 | CONFIG_PPC_4K_PAGES=y |
@@ -399,6 +414,7 @@ CONFIG_IPV6_NDISC_NODETYPE=y | |||
399 | # CONFIG_ECONET is not set | 414 | # CONFIG_ECONET is not set |
400 | # CONFIG_WAN_ROUTER is not set | 415 | # CONFIG_WAN_ROUTER is not set |
401 | # CONFIG_PHONET is not set | 416 | # CONFIG_PHONET is not set |
417 | # CONFIG_IEEE802154 is not set | ||
402 | # CONFIG_NET_SCHED is not set | 418 | # CONFIG_NET_SCHED is not set |
403 | # CONFIG_DCB is not set | 419 | # CONFIG_DCB is not set |
404 | 420 | ||
@@ -433,11 +449,14 @@ CONFIG_BT_HCIBTUSB=m | |||
433 | CONFIG_WIRELESS=y | 449 | CONFIG_WIRELESS=y |
434 | CONFIG_CFG80211=m | 450 | CONFIG_CFG80211=m |
435 | # CONFIG_CFG80211_REG_DEBUG is not set | 451 | # CONFIG_CFG80211_REG_DEBUG is not set |
452 | # CONFIG_CFG80211_DEBUGFS is not set | ||
436 | # CONFIG_WIRELESS_OLD_REGULATORY is not set | 453 | # CONFIG_WIRELESS_OLD_REGULATORY is not set |
437 | CONFIG_WIRELESS_EXT=y | 454 | CONFIG_WIRELESS_EXT=y |
438 | # CONFIG_WIRELESS_EXT_SYSFS is not set | 455 | # CONFIG_WIRELESS_EXT_SYSFS is not set |
439 | # CONFIG_LIB80211 is not set | 456 | # CONFIG_LIB80211 is not set |
440 | CONFIG_MAC80211=m | 457 | CONFIG_MAC80211=m |
458 | CONFIG_MAC80211_DEFAULT_PS=y | ||
459 | CONFIG_MAC80211_DEFAULT_PS_VALUE=1 | ||
441 | 460 | ||
442 | # | 461 | # |
443 | # Rate control algorithm selection | 462 | # Rate control algorithm selection |
@@ -447,7 +466,6 @@ CONFIG_MAC80211_RC_PID=y | |||
447 | CONFIG_MAC80211_RC_DEFAULT_PID=y | 466 | CONFIG_MAC80211_RC_DEFAULT_PID=y |
448 | # CONFIG_MAC80211_RC_DEFAULT_MINSTREL is not set | 467 | # CONFIG_MAC80211_RC_DEFAULT_MINSTREL is not set |
449 | CONFIG_MAC80211_RC_DEFAULT="pid" | 468 | CONFIG_MAC80211_RC_DEFAULT="pid" |
450 | # CONFIG_MAC80211_MESH is not set | ||
451 | # CONFIG_MAC80211_LEDS is not set | 469 | # CONFIG_MAC80211_LEDS is not set |
452 | # CONFIG_MAC80211_DEBUGFS is not set | 470 | # CONFIG_MAC80211_DEBUGFS is not set |
453 | # CONFIG_MAC80211_DEBUG_MENU is not set | 471 | # CONFIG_MAC80211_DEBUG_MENU is not set |
@@ -472,77 +490,7 @@ CONFIG_EXTRA_FIRMWARE="" | |||
472 | # CONFIG_DEBUG_DEVRES is not set | 490 | # CONFIG_DEBUG_DEVRES is not set |
473 | # CONFIG_SYS_HYPERVISOR is not set | 491 | # CONFIG_SYS_HYPERVISOR is not set |
474 | # CONFIG_CONNECTOR is not set | 492 | # CONFIG_CONNECTOR is not set |
475 | CONFIG_MTD=y | 493 | # CONFIG_MTD is not set |
476 | CONFIG_MTD_DEBUG=y | ||
477 | CONFIG_MTD_DEBUG_VERBOSE=0 | ||
478 | # CONFIG_MTD_CONCAT is not set | ||
479 | # CONFIG_MTD_PARTITIONS is not set | ||
480 | # CONFIG_MTD_TESTS is not set | ||
481 | |||
482 | # | ||
483 | # User Modules And Translation Layers | ||
484 | # | ||
485 | # CONFIG_MTD_CHAR is not set | ||
486 | CONFIG_MTD_BLKDEVS=y | ||
487 | CONFIG_MTD_BLOCK=y | ||
488 | # CONFIG_FTL is not set | ||
489 | # CONFIG_NFTL is not set | ||
490 | # CONFIG_INFTL is not set | ||
491 | # CONFIG_RFD_FTL is not set | ||
492 | # CONFIG_SSFDC is not set | ||
493 | # CONFIG_MTD_OOPS is not set | ||
494 | |||
495 | # | ||
496 | # RAM/ROM/Flash chip drivers | ||
497 | # | ||
498 | # CONFIG_MTD_CFI is not set | ||
499 | # CONFIG_MTD_JEDECPROBE is not set | ||
500 | CONFIG_MTD_MAP_BANK_WIDTH_1=y | ||
501 | CONFIG_MTD_MAP_BANK_WIDTH_2=y | ||
502 | CONFIG_MTD_MAP_BANK_WIDTH_4=y | ||
503 | # CONFIG_MTD_MAP_BANK_WIDTH_8 is not set | ||
504 | # CONFIG_MTD_MAP_BANK_WIDTH_16 is not set | ||
505 | # CONFIG_MTD_MAP_BANK_WIDTH_32 is not set | ||
506 | CONFIG_MTD_CFI_I1=y | ||
507 | CONFIG_MTD_CFI_I2=y | ||
508 | # CONFIG_MTD_CFI_I4 is not set | ||
509 | # CONFIG_MTD_CFI_I8 is not set | ||
510 | # CONFIG_MTD_RAM is not set | ||
511 | # CONFIG_MTD_ROM is not set | ||
512 | # CONFIG_MTD_ABSENT is not set | ||
513 | |||
514 | # | ||
515 | # Mapping drivers for chip access | ||
516 | # | ||
517 | # CONFIG_MTD_COMPLEX_MAPPINGS is not set | ||
518 | # CONFIG_MTD_PLATRAM is not set | ||
519 | |||
520 | # | ||
521 | # Self-contained MTD device drivers | ||
522 | # | ||
523 | # CONFIG_MTD_SLRAM is not set | ||
524 | # CONFIG_MTD_PHRAM is not set | ||
525 | # CONFIG_MTD_MTDRAM is not set | ||
526 | # CONFIG_MTD_BLOCK2MTD is not set | ||
527 | |||
528 | # | ||
529 | # Disk-On-Chip Device Drivers | ||
530 | # | ||
531 | # CONFIG_MTD_DOC2000 is not set | ||
532 | # CONFIG_MTD_DOC2001 is not set | ||
533 | # CONFIG_MTD_DOC2001PLUS is not set | ||
534 | # CONFIG_MTD_NAND is not set | ||
535 | # CONFIG_MTD_ONENAND is not set | ||
536 | |||
537 | # | ||
538 | # LPDDR flash memory drivers | ||
539 | # | ||
540 | # CONFIG_MTD_LPDDR is not set | ||
541 | |||
542 | # | ||
543 | # UBI - Unsorted block images | ||
544 | # | ||
545 | # CONFIG_MTD_UBI is not set | ||
546 | CONFIG_OF_DEVICE=y | 494 | CONFIG_OF_DEVICE=y |
547 | # CONFIG_PARPORT is not set | 495 | # CONFIG_PARPORT is not set |
548 | CONFIG_BLK_DEV=y | 496 | CONFIG_BLK_DEV=y |
@@ -590,10 +538,6 @@ CONFIG_BLK_DEV_SR=y | |||
590 | # CONFIG_BLK_DEV_SR_VENDOR is not set | 538 | # CONFIG_BLK_DEV_SR_VENDOR is not set |
591 | CONFIG_CHR_DEV_SG=m | 539 | CONFIG_CHR_DEV_SG=m |
592 | # CONFIG_CHR_DEV_SCH is not set | 540 | # CONFIG_CHR_DEV_SCH is not set |
593 | |||
594 | # | ||
595 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs | ||
596 | # | ||
597 | CONFIG_SCSI_MULTI_LUN=y | 541 | CONFIG_SCSI_MULTI_LUN=y |
598 | # CONFIG_SCSI_CONSTANTS is not set | 542 | # CONFIG_SCSI_CONSTANTS is not set |
599 | # CONFIG_SCSI_LOGGING is not set | 543 | # CONFIG_SCSI_LOGGING is not set |
@@ -626,7 +570,6 @@ CONFIG_BLK_DEV_DM=m | |||
626 | # CONFIG_DM_UEVENT is not set | 570 | # CONFIG_DM_UEVENT is not set |
627 | # CONFIG_MACINTOSH_DRIVERS is not set | 571 | # CONFIG_MACINTOSH_DRIVERS is not set |
628 | CONFIG_NETDEVICES=y | 572 | CONFIG_NETDEVICES=y |
629 | CONFIG_COMPAT_NET_DEV_OPS=y | ||
630 | # CONFIG_DUMMY is not set | 573 | # CONFIG_DUMMY is not set |
631 | # CONFIG_BONDING is not set | 574 | # CONFIG_BONDING is not set |
632 | # CONFIG_MACVLAN is not set | 575 | # CONFIG_MACVLAN is not set |
@@ -646,10 +589,11 @@ CONFIG_MII=m | |||
646 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set | 589 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set |
647 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set | 590 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set |
648 | # CONFIG_B44 is not set | 591 | # CONFIG_B44 is not set |
592 | # CONFIG_KS8842 is not set | ||
649 | CONFIG_NETDEV_1000=y | 593 | CONFIG_NETDEV_1000=y |
650 | CONFIG_GELIC_NET=y | 594 | CONFIG_GELIC_NET=y |
651 | CONFIG_GELIC_WIRELESS=y | 595 | CONFIG_GELIC_WIRELESS=y |
652 | CONFIG_GELIC_WIRELESS_OLD_PSK_INTERFACE=y | 596 | # CONFIG_GELIC_WIRELESS_OLD_PSK_INTERFACE is not set |
653 | # CONFIG_NETDEV_10000 is not set | 597 | # CONFIG_NETDEV_10000 is not set |
654 | 598 | ||
655 | # | 599 | # |
@@ -669,8 +613,7 @@ CONFIG_WLAN_80211=y | |||
669 | # CONFIG_HOSTAP is not set | 613 | # CONFIG_HOSTAP is not set |
670 | # CONFIG_B43 is not set | 614 | # CONFIG_B43 is not set |
671 | # CONFIG_B43LEGACY is not set | 615 | # CONFIG_B43LEGACY is not set |
672 | CONFIG_ZD1211RW=m | 616 | # CONFIG_ZD1211RW is not set |
673 | # CONFIG_ZD1211RW_DEBUG is not set | ||
674 | # CONFIG_RT2X00 is not set | 617 | # CONFIG_RT2X00 is not set |
675 | 618 | ||
676 | # | 619 | # |
@@ -682,7 +625,7 @@ CONFIG_ZD1211RW=m | |||
682 | # | 625 | # |
683 | # CONFIG_USB_CATC is not set | 626 | # CONFIG_USB_CATC is not set |
684 | # CONFIG_USB_KAWETH is not set | 627 | # CONFIG_USB_KAWETH is not set |
685 | CONFIG_USB_PEGASUS=m | 628 | # CONFIG_USB_PEGASUS is not set |
686 | # CONFIG_USB_RTL8150 is not set | 629 | # CONFIG_USB_RTL8150 is not set |
687 | CONFIG_USB_USBNET=m | 630 | CONFIG_USB_USBNET=m |
688 | CONFIG_USB_NET_AX8817X=m | 631 | CONFIG_USB_NET_AX8817X=m |
@@ -693,10 +636,11 @@ CONFIG_USB_NET_AX8817X=m | |||
693 | # CONFIG_USB_NET_GL620A is not set | 636 | # CONFIG_USB_NET_GL620A is not set |
694 | # CONFIG_USB_NET_NET1080 is not set | 637 | # CONFIG_USB_NET_NET1080 is not set |
695 | # CONFIG_USB_NET_PLUSB is not set | 638 | # CONFIG_USB_NET_PLUSB is not set |
696 | CONFIG_USB_NET_MCS7830=m | 639 | # CONFIG_USB_NET_MCS7830 is not set |
697 | # CONFIG_USB_NET_RNDIS_HOST is not set | 640 | # CONFIG_USB_NET_RNDIS_HOST is not set |
698 | # CONFIG_USB_NET_CDC_SUBSET is not set | 641 | # CONFIG_USB_NET_CDC_SUBSET is not set |
699 | # CONFIG_USB_NET_ZAURUS is not set | 642 | # CONFIG_USB_NET_ZAURUS is not set |
643 | # CONFIG_USB_NET_INT51X1 is not set | ||
700 | # CONFIG_WAN is not set | 644 | # CONFIG_WAN is not set |
701 | CONFIG_PPP=m | 645 | CONFIG_PPP=m |
702 | CONFIG_PPP_MULTILINK=y | 646 | CONFIG_PPP_MULTILINK=y |
@@ -771,8 +715,7 @@ CONFIG_DEVKMEM=y | |||
771 | # | 715 | # |
772 | CONFIG_UNIX98_PTYS=y | 716 | CONFIG_UNIX98_PTYS=y |
773 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set | 717 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set |
774 | CONFIG_LEGACY_PTYS=y | 718 | # CONFIG_LEGACY_PTYS is not set |
775 | CONFIG_LEGACY_PTY_COUNT=16 | ||
776 | # CONFIG_HVC_UDBG is not set | 719 | # CONFIG_HVC_UDBG is not set |
777 | # CONFIG_IPMI_HANDLER is not set | 720 | # CONFIG_IPMI_HANDLER is not set |
778 | # CONFIG_HW_RANDOM is not set | 721 | # CONFIG_HW_RANDOM is not set |
@@ -782,6 +725,11 @@ CONFIG_LEGACY_PTY_COUNT=16 | |||
782 | # CONFIG_TCG_TPM is not set | 725 | # CONFIG_TCG_TPM is not set |
783 | # CONFIG_I2C is not set | 726 | # CONFIG_I2C is not set |
784 | # CONFIG_SPI is not set | 727 | # CONFIG_SPI is not set |
728 | |||
729 | # | ||
730 | # PPS support | ||
731 | # | ||
732 | # CONFIG_PPS is not set | ||
785 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | 733 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y |
786 | # CONFIG_GPIOLIB is not set | 734 | # CONFIG_GPIOLIB is not set |
787 | # CONFIG_W1 is not set | 735 | # CONFIG_W1 is not set |
@@ -805,22 +753,7 @@ CONFIG_SSB_POSSIBLE=y | |||
805 | # CONFIG_HTC_PASIC3 is not set | 753 | # CONFIG_HTC_PASIC3 is not set |
806 | # CONFIG_MFD_TMIO is not set | 754 | # CONFIG_MFD_TMIO is not set |
807 | # CONFIG_REGULATOR is not set | 755 | # CONFIG_REGULATOR is not set |
808 | 756 | # CONFIG_MEDIA_SUPPORT is not set | |
809 | # | ||
810 | # Multimedia devices | ||
811 | # | ||
812 | |||
813 | # | ||
814 | # Multimedia core support | ||
815 | # | ||
816 | # CONFIG_VIDEO_DEV is not set | ||
817 | # CONFIG_DVB_CORE is not set | ||
818 | # CONFIG_VIDEO_MEDIA is not set | ||
819 | |||
820 | # | ||
821 | # Multimedia drivers | ||
822 | # | ||
823 | # CONFIG_DAB is not set | ||
824 | 757 | ||
825 | # | 758 | # |
826 | # Graphics support | 759 | # Graphics support |
@@ -898,6 +831,11 @@ CONFIG_SND_SUPPORT_OLD_API=y | |||
898 | CONFIG_SND_VERBOSE_PROCFS=y | 831 | CONFIG_SND_VERBOSE_PROCFS=y |
899 | # CONFIG_SND_VERBOSE_PRINTK is not set | 832 | # CONFIG_SND_VERBOSE_PRINTK is not set |
900 | # CONFIG_SND_DEBUG is not set | 833 | # CONFIG_SND_DEBUG is not set |
834 | # CONFIG_SND_RAWMIDI_SEQ is not set | ||
835 | # CONFIG_SND_OPL3_LIB_SEQ is not set | ||
836 | # CONFIG_SND_OPL4_LIB_SEQ is not set | ||
837 | # CONFIG_SND_SBAWE_SEQ is not set | ||
838 | # CONFIG_SND_EMU10K1_SEQ is not set | ||
901 | # CONFIG_SND_DRIVERS is not set | 839 | # CONFIG_SND_DRIVERS is not set |
902 | CONFIG_SND_PPC=y | 840 | CONFIG_SND_PPC=y |
903 | CONFIG_SND_PS3=m | 841 | CONFIG_SND_PS3=m |
@@ -930,29 +868,34 @@ CONFIG_USB_HIDDEV=y | |||
930 | # Special HID drivers | 868 | # Special HID drivers |
931 | # | 869 | # |
932 | # CONFIG_HID_A4TECH is not set | 870 | # CONFIG_HID_A4TECH is not set |
933 | # CONFIG_HID_APPLE is not set | 871 | CONFIG_HID_APPLE=m |
934 | # CONFIG_HID_BELKIN is not set | 872 | CONFIG_HID_BELKIN=m |
935 | # CONFIG_HID_CHERRY is not set | 873 | CONFIG_HID_CHERRY=m |
936 | # CONFIG_HID_CHICONY is not set | 874 | # CONFIG_HID_CHICONY is not set |
937 | # CONFIG_HID_CYPRESS is not set | 875 | # CONFIG_HID_CYPRESS is not set |
938 | # CONFIG_DRAGONRISE_FF is not set | 876 | # CONFIG_HID_DRAGONRISE is not set |
939 | # CONFIG_HID_EZKEY is not set | 877 | CONFIG_HID_EZKEY=m |
940 | # CONFIG_HID_KYE is not set | 878 | # CONFIG_HID_KYE is not set |
941 | # CONFIG_HID_GYRATION is not set | 879 | # CONFIG_HID_GYRATION is not set |
942 | # CONFIG_HID_KENSINGTON is not set | 880 | # CONFIG_HID_KENSINGTON is not set |
943 | # CONFIG_HID_LOGITECH is not set | 881 | CONFIG_HID_LOGITECH=m |
944 | # CONFIG_HID_MICROSOFT is not set | 882 | # CONFIG_LOGITECH_FF is not set |
883 | # CONFIG_LOGIRUMBLEPAD2_FF is not set | ||
884 | CONFIG_HID_MICROSOFT=m | ||
945 | # CONFIG_HID_MONTEREY is not set | 885 | # CONFIG_HID_MONTEREY is not set |
946 | # CONFIG_HID_NTRIG is not set | 886 | # CONFIG_HID_NTRIG is not set |
947 | # CONFIG_HID_PANTHERLORD is not set | 887 | # CONFIG_HID_PANTHERLORD is not set |
948 | # CONFIG_HID_PETALYNX is not set | 888 | # CONFIG_HID_PETALYNX is not set |
949 | # CONFIG_HID_SAMSUNG is not set | 889 | # CONFIG_HID_SAMSUNG is not set |
950 | CONFIG_HID_SONY=m | 890 | CONFIG_HID_SONY=m |
951 | # CONFIG_HID_SUNPLUS is not set | 891 | CONFIG_HID_SUNPLUS=m |
952 | # CONFIG_GREENASIA_FF is not set | 892 | # CONFIG_HID_GREENASIA is not set |
893 | CONFIG_HID_SMARTJOYPLUS=m | ||
894 | # CONFIG_SMARTJOYPLUS_FF is not set | ||
953 | # CONFIG_HID_TOPSEED is not set | 895 | # CONFIG_HID_TOPSEED is not set |
954 | # CONFIG_THRUSTMASTER_FF is not set | 896 | # CONFIG_HID_THRUSTMASTER is not set |
955 | # CONFIG_ZEROPLUS_FF is not set | 897 | # CONFIG_HID_WACOM is not set |
898 | # CONFIG_HID_ZEROPLUS is not set | ||
956 | CONFIG_USB_SUPPORT=y | 899 | CONFIG_USB_SUPPORT=y |
957 | CONFIG_USB_ARCH_HAS_HCD=y | 900 | CONFIG_USB_ARCH_HAS_HCD=y |
958 | CONFIG_USB_ARCH_HAS_OHCI=y | 901 | CONFIG_USB_ARCH_HAS_OHCI=y |
@@ -988,6 +931,8 @@ CONFIG_USB_EHCI_BIG_ENDIAN_MMIO=y | |||
988 | # CONFIG_USB_ISP116X_HCD is not set | 931 | # CONFIG_USB_ISP116X_HCD is not set |
989 | # CONFIG_USB_ISP1760_HCD is not set | 932 | # CONFIG_USB_ISP1760_HCD is not set |
990 | CONFIG_USB_OHCI_HCD=m | 933 | CONFIG_USB_OHCI_HCD=m |
934 | # CONFIG_USB_OHCI_HCD_PPC_OF_BE is not set | ||
935 | # CONFIG_USB_OHCI_HCD_PPC_OF_LE is not set | ||
991 | # CONFIG_USB_OHCI_HCD_PPC_OF is not set | 936 | # CONFIG_USB_OHCI_HCD_PPC_OF is not set |
992 | # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set | 937 | # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set |
993 | CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y | 938 | CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y |
@@ -1115,6 +1060,10 @@ CONFIG_RTC_DRV_PS3=m | |||
1115 | # CONFIG_DMADEVICES is not set | 1060 | # CONFIG_DMADEVICES is not set |
1116 | # CONFIG_AUXDISPLAY is not set | 1061 | # CONFIG_AUXDISPLAY is not set |
1117 | # CONFIG_UIO is not set | 1062 | # CONFIG_UIO is not set |
1063 | |||
1064 | # | ||
1065 | # TI VLYNQ | ||
1066 | # | ||
1118 | # CONFIG_STAGING is not set | 1067 | # CONFIG_STAGING is not set |
1119 | 1068 | ||
1120 | # | 1069 | # |
@@ -1141,11 +1090,12 @@ CONFIG_FS_MBCACHE=y | |||
1141 | # CONFIG_REISERFS_FS is not set | 1090 | # CONFIG_REISERFS_FS is not set |
1142 | # CONFIG_JFS_FS is not set | 1091 | # CONFIG_JFS_FS is not set |
1143 | # CONFIG_FS_POSIX_ACL is not set | 1092 | # CONFIG_FS_POSIX_ACL is not set |
1144 | CONFIG_FILE_LOCKING=y | ||
1145 | # CONFIG_XFS_FS is not set | 1093 | # CONFIG_XFS_FS is not set |
1146 | # CONFIG_GFS2_FS is not set | 1094 | # CONFIG_GFS2_FS is not set |
1147 | # CONFIG_OCFS2_FS is not set | 1095 | # CONFIG_OCFS2_FS is not set |
1148 | # CONFIG_BTRFS_FS is not set | 1096 | # CONFIG_BTRFS_FS is not set |
1097 | CONFIG_FILE_LOCKING=y | ||
1098 | CONFIG_FSNOTIFY=y | ||
1149 | CONFIG_DNOTIFY=y | 1099 | CONFIG_DNOTIFY=y |
1150 | CONFIG_INOTIFY=y | 1100 | CONFIG_INOTIFY=y |
1151 | CONFIG_INOTIFY_USER=y | 1101 | CONFIG_INOTIFY_USER=y |
@@ -1205,7 +1155,6 @@ CONFIG_MISC_FILESYSTEMS=y | |||
1205 | # CONFIG_BEFS_FS is not set | 1155 | # CONFIG_BEFS_FS is not set |
1206 | # CONFIG_BFS_FS is not set | 1156 | # CONFIG_BFS_FS is not set |
1207 | # CONFIG_EFS_FS is not set | 1157 | # CONFIG_EFS_FS is not set |
1208 | # CONFIG_JFFS2_FS is not set | ||
1209 | # CONFIG_CRAMFS is not set | 1158 | # CONFIG_CRAMFS is not set |
1210 | # CONFIG_SQUASHFS is not set | 1159 | # CONFIG_SQUASHFS is not set |
1211 | # CONFIG_VXFS_FS is not set | 1160 | # CONFIG_VXFS_FS is not set |
@@ -1222,6 +1171,7 @@ CONFIG_NFS_FS=y | |||
1222 | CONFIG_NFS_V3=y | 1171 | CONFIG_NFS_V3=y |
1223 | # CONFIG_NFS_V3_ACL is not set | 1172 | # CONFIG_NFS_V3_ACL is not set |
1224 | CONFIG_NFS_V4=y | 1173 | CONFIG_NFS_V4=y |
1174 | # CONFIG_NFS_V4_1 is not set | ||
1225 | CONFIG_ROOT_NFS=y | 1175 | CONFIG_ROOT_NFS=y |
1226 | # CONFIG_NFSD is not set | 1176 | # CONFIG_NFSD is not set |
1227 | CONFIG_LOCKD=y | 1177 | CONFIG_LOCKD=y |
@@ -1359,7 +1309,6 @@ CONFIG_DEBUG_MEMORY_INIT=y | |||
1359 | CONFIG_DEBUG_LIST=y | 1309 | CONFIG_DEBUG_LIST=y |
1360 | # CONFIG_DEBUG_SG is not set | 1310 | # CONFIG_DEBUG_SG is not set |
1361 | # CONFIG_DEBUG_NOTIFIERS is not set | 1311 | # CONFIG_DEBUG_NOTIFIERS is not set |
1362 | # CONFIG_BOOT_PRINTK_DELAY is not set | ||
1363 | # CONFIG_RCU_TORTURE_TEST is not set | 1312 | # CONFIG_RCU_TORTURE_TEST is not set |
1364 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | 1313 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set |
1365 | # CONFIG_BACKTRACE_SELF_TEST is not set | 1314 | # CONFIG_BACKTRACE_SELF_TEST is not set |
@@ -1374,31 +1323,21 @@ CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y | |||
1374 | CONFIG_HAVE_DYNAMIC_FTRACE=y | 1323 | CONFIG_HAVE_DYNAMIC_FTRACE=y |
1375 | CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y | 1324 | CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y |
1376 | CONFIG_RING_BUFFER=y | 1325 | CONFIG_RING_BUFFER=y |
1326 | CONFIG_EVENT_TRACING=y | ||
1327 | CONFIG_CONTEXT_SWITCH_TRACER=y | ||
1377 | CONFIG_TRACING=y | 1328 | CONFIG_TRACING=y |
1378 | CONFIG_TRACING_SUPPORT=y | 1329 | CONFIG_TRACING_SUPPORT=y |
1379 | 1330 | # CONFIG_FTRACE is not set | |
1380 | # | ||
1381 | # Tracers | ||
1382 | # | ||
1383 | # CONFIG_FUNCTION_TRACER is not set | ||
1384 | # CONFIG_IRQSOFF_TRACER is not set | ||
1385 | # CONFIG_SCHED_TRACER is not set | ||
1386 | # CONFIG_CONTEXT_SWITCH_TRACER is not set | ||
1387 | # CONFIG_EVENT_TRACER is not set | ||
1388 | # CONFIG_BOOT_TRACER is not set | ||
1389 | # CONFIG_TRACE_BRANCH_PROFILING is not set | ||
1390 | # CONFIG_STACK_TRACER is not set | ||
1391 | # CONFIG_KMEMTRACE is not set | ||
1392 | # CONFIG_WORKQUEUE_TRACER is not set | ||
1393 | # CONFIG_BLK_DEV_IO_TRACE is not set | ||
1394 | # CONFIG_FTRACE_STARTUP_TEST is not set | ||
1395 | # CONFIG_DYNAMIC_DEBUG is not set | 1331 | # CONFIG_DYNAMIC_DEBUG is not set |
1396 | # CONFIG_SAMPLES is not set | 1332 | # CONFIG_SAMPLES is not set |
1397 | CONFIG_HAVE_ARCH_KGDB=y | 1333 | CONFIG_HAVE_ARCH_KGDB=y |
1398 | # CONFIG_KGDB is not set | 1334 | # CONFIG_KGDB is not set |
1335 | # CONFIG_PPC_DISABLE_WERROR is not set | ||
1336 | CONFIG_PPC_WERROR=y | ||
1399 | CONFIG_PRINT_STACK_DEPTH=64 | 1337 | CONFIG_PRINT_STACK_DEPTH=64 |
1400 | CONFIG_DEBUG_STACKOVERFLOW=y | 1338 | CONFIG_DEBUG_STACKOVERFLOW=y |
1401 | # CONFIG_DEBUG_STACK_USAGE is not set | 1339 | # CONFIG_DEBUG_STACK_USAGE is not set |
1340 | # CONFIG_PPC_EMULATED_STATS is not set | ||
1402 | # CONFIG_CODE_PATCHING_SELFTEST is not set | 1341 | # CONFIG_CODE_PATCHING_SELFTEST is not set |
1403 | # CONFIG_FTR_FIXUP_SELFTEST is not set | 1342 | # CONFIG_FTR_FIXUP_SELFTEST is not set |
1404 | # CONFIG_MSI_BITMAP_SELFTEST is not set | 1343 | # CONFIG_MSI_BITMAP_SELFTEST is not set |
diff --git a/arch/powerpc/kernel/power7-pmu.c b/arch/powerpc/kernel/power7-pmu.c index 388cf57ad827..018d094d92f9 100644 --- a/arch/powerpc/kernel/power7-pmu.c +++ b/arch/powerpc/kernel/power7-pmu.c | |||
@@ -317,7 +317,7 @@ static int power7_generic_events[] = { | |||
317 | */ | 317 | */ |
318 | static int power7_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { | 318 | static int power7_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { |
319 | [C(L1D)] = { /* RESULT_ACCESS RESULT_MISS */ | 319 | [C(L1D)] = { /* RESULT_ACCESS RESULT_MISS */ |
320 | [C(OP_READ)] = { 0x400f0, 0xc880 }, | 320 | [C(OP_READ)] = { 0xc880, 0x400f0 }, |
321 | [C(OP_WRITE)] = { 0, 0x300f0 }, | 321 | [C(OP_WRITE)] = { 0, 0x300f0 }, |
322 | [C(OP_PREFETCH)] = { 0xd8b8, 0 }, | 322 | [C(OP_PREFETCH)] = { 0xd8b8, 0 }, |
323 | }, | 323 | }, |
@@ -327,8 +327,8 @@ static int power7_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { | |||
327 | [C(OP_PREFETCH)] = { 0x408a, 0 }, | 327 | [C(OP_PREFETCH)] = { 0x408a, 0 }, |
328 | }, | 328 | }, |
329 | [C(LL)] = { /* RESULT_ACCESS RESULT_MISS */ | 329 | [C(LL)] = { /* RESULT_ACCESS RESULT_MISS */ |
330 | [C(OP_READ)] = { 0x6080, 0x6084 }, | 330 | [C(OP_READ)] = { 0x16080, 0x26080 }, |
331 | [C(OP_WRITE)] = { 0x6082, 0x6086 }, | 331 | [C(OP_WRITE)] = { 0x16082, 0x26082 }, |
332 | [C(OP_PREFETCH)] = { 0, 0 }, | 332 | [C(OP_PREFETCH)] = { 0, 0 }, |
333 | }, | 333 | }, |
334 | [C(DTLB)] = { /* RESULT_ACCESS RESULT_MISS */ | 334 | [C(DTLB)] = { /* RESULT_ACCESS RESULT_MISS */ |
diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c index b178a1e66c91..40b5cb433005 100644 --- a/arch/powerpc/platforms/ps3/time.c +++ b/arch/powerpc/platforms/ps3/time.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | 23 | ||
24 | #include <asm/firmware.h> | ||
24 | #include <asm/rtc.h> | 25 | #include <asm/rtc.h> |
25 | #include <asm/lv1call.h> | 26 | #include <asm/lv1call.h> |
26 | #include <asm/ps3.h> | 27 | #include <asm/ps3.h> |
@@ -84,6 +85,9 @@ static int __init ps3_rtc_init(void) | |||
84 | { | 85 | { |
85 | struct platform_device *pdev; | 86 | struct platform_device *pdev; |
86 | 87 | ||
88 | if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) | ||
89 | return -ENODEV; | ||
90 | |||
87 | pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0); | 91 | pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0); |
88 | if (IS_ERR(pdev)) | 92 | if (IS_ERR(pdev)) |
89 | return PTR_ERR(pdev); | 93 | return PTR_ERR(pdev); |
diff --git a/arch/powerpc/sysdev/xilinx_intc.c b/arch/powerpc/sysdev/xilinx_intc.c index 3ee1fd37bbfc..40edad520770 100644 --- a/arch/powerpc/sysdev/xilinx_intc.c +++ b/arch/powerpc/sysdev/xilinx_intc.c | |||
@@ -234,7 +234,6 @@ static void xilinx_i8259_cascade(unsigned int irq, struct irq_desc *desc) | |||
234 | generic_handle_irq(cascade_irq); | 234 | generic_handle_irq(cascade_irq); |
235 | 235 | ||
236 | /* Let xilinx_intc end the interrupt */ | 236 | /* Let xilinx_intc end the interrupt */ |
237 | desc->chip->ack(irq); | ||
238 | desc->chip->unmask(irq); | 237 | desc->chip->unmask(irq); |
239 | } | 238 | } |
240 | 239 | ||
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c index 3e298e64f0db..57bdcb1e3cdf 100644 --- a/arch/s390/kernel/ftrace.c +++ b/arch/s390/kernel/ftrace.c | |||
@@ -220,6 +220,29 @@ struct syscall_metadata *syscall_nr_to_meta(int nr) | |||
220 | return syscalls_metadata[nr]; | 220 | return syscalls_metadata[nr]; |
221 | } | 221 | } |
222 | 222 | ||
223 | int syscall_name_to_nr(char *name) | ||
224 | { | ||
225 | int i; | ||
226 | |||
227 | if (!syscalls_metadata) | ||
228 | return -1; | ||
229 | for (i = 0; i < NR_syscalls; i++) | ||
230 | if (syscalls_metadata[i]) | ||
231 | if (!strcmp(syscalls_metadata[i]->name, name)) | ||
232 | return i; | ||
233 | return -1; | ||
234 | } | ||
235 | |||
236 | void set_syscall_enter_id(int num, int id) | ||
237 | { | ||
238 | syscalls_metadata[num]->enter_id = id; | ||
239 | } | ||
240 | |||
241 | void set_syscall_exit_id(int num, int id) | ||
242 | { | ||
243 | syscalls_metadata[num]->exit_id = id; | ||
244 | } | ||
245 | |||
223 | static struct syscall_metadata *find_syscall_meta(unsigned long syscall) | 246 | static struct syscall_metadata *find_syscall_meta(unsigned long syscall) |
224 | { | 247 | { |
225 | struct syscall_metadata *start; | 248 | struct syscall_metadata *start; |
@@ -237,24 +260,19 @@ static struct syscall_metadata *find_syscall_meta(unsigned long syscall) | |||
237 | return NULL; | 260 | return NULL; |
238 | } | 261 | } |
239 | 262 | ||
240 | void arch_init_ftrace_syscalls(void) | 263 | static int __init arch_init_ftrace_syscalls(void) |
241 | { | 264 | { |
242 | struct syscall_metadata *meta; | 265 | struct syscall_metadata *meta; |
243 | int i; | 266 | int i; |
244 | static atomic_t refs; | ||
245 | |||
246 | if (atomic_inc_return(&refs) != 1) | ||
247 | goto out; | ||
248 | syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * NR_syscalls, | 267 | syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * NR_syscalls, |
249 | GFP_KERNEL); | 268 | GFP_KERNEL); |
250 | if (!syscalls_metadata) | 269 | if (!syscalls_metadata) |
251 | goto out; | 270 | return -ENOMEM; |
252 | for (i = 0; i < NR_syscalls; i++) { | 271 | for (i = 0; i < NR_syscalls; i++) { |
253 | meta = find_syscall_meta((unsigned long)sys_call_table[i]); | 272 | meta = find_syscall_meta((unsigned long)sys_call_table[i]); |
254 | syscalls_metadata[i] = meta; | 273 | syscalls_metadata[i] = meta; |
255 | } | 274 | } |
256 | return; | 275 | return 0; |
257 | out: | ||
258 | atomic_dec(&refs); | ||
259 | } | 276 | } |
277 | arch_initcall(arch_init_ftrace_syscalls); | ||
260 | #endif | 278 | #endif |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 9717717c6fea..cbb897bc50bd 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -154,6 +154,20 @@ static int __init condev_setup(char *str) | |||
154 | 154 | ||
155 | __setup("condev=", condev_setup); | 155 | __setup("condev=", condev_setup); |
156 | 156 | ||
157 | static void __init set_preferred_console(void) | ||
158 | { | ||
159 | if (MACHINE_IS_KVM) { | ||
160 | add_preferred_console("hvc", 0, NULL); | ||
161 | s390_virtio_console_init(); | ||
162 | return; | ||
163 | } | ||
164 | |||
165 | if (CONSOLE_IS_3215 || CONSOLE_IS_SCLP) | ||
166 | add_preferred_console("ttyS", 0, NULL); | ||
167 | if (CONSOLE_IS_3270) | ||
168 | add_preferred_console("tty3270", 0, NULL); | ||
169 | } | ||
170 | |||
157 | static int __init conmode_setup(char *str) | 171 | static int __init conmode_setup(char *str) |
158 | { | 172 | { |
159 | #if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE) | 173 | #if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE) |
@@ -168,6 +182,7 @@ static int __init conmode_setup(char *str) | |||
168 | if (strncmp(str, "3270", 5) == 0) | 182 | if (strncmp(str, "3270", 5) == 0) |
169 | SET_CONSOLE_3270; | 183 | SET_CONSOLE_3270; |
170 | #endif | 184 | #endif |
185 | set_preferred_console(); | ||
171 | return 1; | 186 | return 1; |
172 | } | 187 | } |
173 | 188 | ||
@@ -780,9 +795,6 @@ static void __init setup_hwcaps(void) | |||
780 | void __init | 795 | void __init |
781 | setup_arch(char **cmdline_p) | 796 | setup_arch(char **cmdline_p) |
782 | { | 797 | { |
783 | /* set up preferred console */ | ||
784 | add_preferred_console("ttyS", 0, NULL); | ||
785 | |||
786 | /* | 798 | /* |
787 | * print what head.S has found out about the machine | 799 | * print what head.S has found out about the machine |
788 | */ | 800 | */ |
@@ -802,11 +814,9 @@ setup_arch(char **cmdline_p) | |||
802 | if (MACHINE_IS_VM) | 814 | if (MACHINE_IS_VM) |
803 | pr_info("Linux is running as a z/VM " | 815 | pr_info("Linux is running as a z/VM " |
804 | "guest operating system in 64-bit mode\n"); | 816 | "guest operating system in 64-bit mode\n"); |
805 | else if (MACHINE_IS_KVM) { | 817 | else if (MACHINE_IS_KVM) |
806 | pr_info("Linux is running under KVM in 64-bit mode\n"); | 818 | pr_info("Linux is running under KVM in 64-bit mode\n"); |
807 | add_preferred_console("hvc", 0, NULL); | 819 | else |
808 | s390_virtio_console_init(); | ||
809 | } else | ||
810 | pr_info("Linux is running natively in 64-bit mode\n"); | 820 | pr_info("Linux is running natively in 64-bit mode\n"); |
811 | #endif /* CONFIG_64BIT */ | 821 | #endif /* CONFIG_64BIT */ |
812 | 822 | ||
@@ -851,6 +861,7 @@ setup_arch(char **cmdline_p) | |||
851 | 861 | ||
852 | /* Setup default console */ | 862 | /* Setup default console */ |
853 | conmode_default(); | 863 | conmode_default(); |
864 | set_preferred_console(); | ||
854 | 865 | ||
855 | /* Setup zfcpdump support */ | 866 | /* Setup zfcpdump support */ |
856 | setup_zfcpdump(console_devno); | 867 | setup_zfcpdump(console_devno); |
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c index 7ffd1b4315bd..b9c88cc519e2 100644 --- a/arch/sh/boards/board-ap325rxa.c +++ b/arch/sh/boards/board-ap325rxa.c | |||
@@ -547,7 +547,7 @@ static int __init ap325rxa_devices_setup(void) | |||
547 | return platform_add_devices(ap325rxa_devices, | 547 | return platform_add_devices(ap325rxa_devices, |
548 | ARRAY_SIZE(ap325rxa_devices)); | 548 | ARRAY_SIZE(ap325rxa_devices)); |
549 | } | 549 | } |
550 | device_initcall(ap325rxa_devices_setup); | 550 | arch_initcall(ap325rxa_devices_setup); |
551 | 551 | ||
552 | /* Return the board specific boot mode pin configuration */ | 552 | /* Return the board specific boot mode pin configuration */ |
553 | static int ap325rxa_mode_pins(void) | 553 | static int ap325rxa_mode_pins(void) |
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c index f70f4644deb4..f9b2e4df35b9 100644 --- a/arch/sh/boards/mach-migor/setup.c +++ b/arch/sh/boards/mach-migor/setup.c | |||
@@ -608,7 +608,7 @@ static int __init migor_devices_setup(void) | |||
608 | 608 | ||
609 | return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices)); | 609 | return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices)); |
610 | } | 610 | } |
611 | __initcall(migor_devices_setup); | 611 | arch_initcall(migor_devices_setup); |
612 | 612 | ||
613 | /* Return the board specific boot mode pin configuration */ | 613 | /* Return the board specific boot mode pin configuration */ |
614 | static int migor_mode_pins(void) | 614 | static int migor_mode_pins(void) |
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index 8fed45a2fb85..15456a0773bf 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c | |||
@@ -238,7 +238,7 @@ static struct platform_device ceu1_device = { | |||
238 | }, | 238 | }, |
239 | }; | 239 | }; |
240 | 240 | ||
241 | /* KEYSC */ | 241 | /* KEYSC in SoC (Needs SW33-2 set to ON) */ |
242 | static struct sh_keysc_info keysc_info = { | 242 | static struct sh_keysc_info keysc_info = { |
243 | .mode = SH_KEYSC_MODE_1, | 243 | .mode = SH_KEYSC_MODE_1, |
244 | .scan_timing = 10, | 244 | .scan_timing = 10, |
@@ -255,12 +255,13 @@ static struct sh_keysc_info keysc_info = { | |||
255 | 255 | ||
256 | static struct resource keysc_resources[] = { | 256 | static struct resource keysc_resources[] = { |
257 | [0] = { | 257 | [0] = { |
258 | .start = 0x1a204000, | 258 | .name = "KEYSC", |
259 | .end = 0x1a20400f, | 259 | .start = 0x044b0000, |
260 | .end = 0x044b000f, | ||
260 | .flags = IORESOURCE_MEM, | 261 | .flags = IORESOURCE_MEM, |
261 | }, | 262 | }, |
262 | [1] = { | 263 | [1] = { |
263 | .start = IRQ0_KEY, | 264 | .start = 79, |
264 | .flags = IORESOURCE_IRQ, | 265 | .flags = IORESOURCE_IRQ, |
265 | }, | 266 | }, |
266 | }; | 267 | }; |
diff --git a/arch/sh/kernel/cpu/sh2/setup-sh7619.c b/arch/sh/kernel/cpu/sh2/setup-sh7619.c index 13798733f2db..8555c05e8667 100644 --- a/arch/sh/kernel/cpu/sh2/setup-sh7619.c +++ b/arch/sh/kernel/cpu/sh2/setup-sh7619.c | |||
@@ -187,7 +187,7 @@ static int __init sh7619_devices_setup(void) | |||
187 | return platform_add_devices(sh7619_devices, | 187 | return platform_add_devices(sh7619_devices, |
188 | ARRAY_SIZE(sh7619_devices)); | 188 | ARRAY_SIZE(sh7619_devices)); |
189 | } | 189 | } |
190 | __initcall(sh7619_devices_setup); | 190 | arch_initcall(sh7619_devices_setup); |
191 | 191 | ||
192 | void __init plat_irq_setup(void) | 192 | void __init plat_irq_setup(void) |
193 | { | 193 | { |
diff --git a/arch/sh/kernel/cpu/sh2a/setup-mxg.c b/arch/sh/kernel/cpu/sh2a/setup-mxg.c index 869c2da4820b..b67376445315 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-mxg.c +++ b/arch/sh/kernel/cpu/sh2a/setup-mxg.c | |||
@@ -238,7 +238,7 @@ static int __init mxg_devices_setup(void) | |||
238 | return platform_add_devices(mxg_devices, | 238 | return platform_add_devices(mxg_devices, |
239 | ARRAY_SIZE(mxg_devices)); | 239 | ARRAY_SIZE(mxg_devices)); |
240 | } | 240 | } |
241 | __initcall(mxg_devices_setup); | 241 | arch_initcall(mxg_devices_setup); |
242 | 242 | ||
243 | void __init plat_irq_setup(void) | 243 | void __init plat_irq_setup(void) |
244 | { | 244 | { |
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c index d8febe128066..fbde5b75deb9 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c +++ b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c | |||
@@ -357,7 +357,7 @@ static int __init sh7201_devices_setup(void) | |||
357 | return platform_add_devices(sh7201_devices, | 357 | return platform_add_devices(sh7201_devices, |
358 | ARRAY_SIZE(sh7201_devices)); | 358 | ARRAY_SIZE(sh7201_devices)); |
359 | } | 359 | } |
360 | __initcall(sh7201_devices_setup); | 360 | arch_initcall(sh7201_devices_setup); |
361 | 361 | ||
362 | void __init plat_irq_setup(void) | 362 | void __init plat_irq_setup(void) |
363 | { | 363 | { |
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c index 62e3039d2398..d3fd536c9a84 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c +++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c | |||
@@ -367,7 +367,7 @@ static int __init sh7203_devices_setup(void) | |||
367 | return platform_add_devices(sh7203_devices, | 367 | return platform_add_devices(sh7203_devices, |
368 | ARRAY_SIZE(sh7203_devices)); | 368 | ARRAY_SIZE(sh7203_devices)); |
369 | } | 369 | } |
370 | __initcall(sh7203_devices_setup); | 370 | arch_initcall(sh7203_devices_setup); |
371 | 371 | ||
372 | void __init plat_irq_setup(void) | 372 | void __init plat_irq_setup(void) |
373 | { | 373 | { |
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c index 3e6f3d7a58be..a9ccc5e8d9e9 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c +++ b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c | |||
@@ -338,7 +338,7 @@ static int __init sh7206_devices_setup(void) | |||
338 | return platform_add_devices(sh7206_devices, | 338 | return platform_add_devices(sh7206_devices, |
339 | ARRAY_SIZE(sh7206_devices)); | 339 | ARRAY_SIZE(sh7206_devices)); |
340 | } | 340 | } |
341 | __initcall(sh7206_devices_setup); | 341 | arch_initcall(sh7206_devices_setup); |
342 | 342 | ||
343 | void __init plat_irq_setup(void) | 343 | void __init plat_irq_setup(void) |
344 | { | 344 | { |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7705.c b/arch/sh/kernel/cpu/sh3/setup-sh7705.c index 88f742fed9ed..c23105983878 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7705.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7705.c | |||
@@ -222,7 +222,7 @@ static int __init sh7705_devices_setup(void) | |||
222 | return platform_add_devices(sh7705_devices, | 222 | return platform_add_devices(sh7705_devices, |
223 | ARRAY_SIZE(sh7705_devices)); | 223 | ARRAY_SIZE(sh7705_devices)); |
224 | } | 224 | } |
225 | __initcall(sh7705_devices_setup); | 225 | arch_initcall(sh7705_devices_setup); |
226 | 226 | ||
227 | static struct platform_device *sh7705_early_devices[] __initdata = { | 227 | static struct platform_device *sh7705_early_devices[] __initdata = { |
228 | &tmu0_device, | 228 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c index c56306798584..347ab35d0697 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c | |||
@@ -250,7 +250,7 @@ static int __init sh770x_devices_setup(void) | |||
250 | return platform_add_devices(sh770x_devices, | 250 | return platform_add_devices(sh770x_devices, |
251 | ARRAY_SIZE(sh770x_devices)); | 251 | ARRAY_SIZE(sh770x_devices)); |
252 | } | 252 | } |
253 | __initcall(sh770x_devices_setup); | 253 | arch_initcall(sh770x_devices_setup); |
254 | 254 | ||
255 | static struct platform_device *sh770x_early_devices[] __initdata = { | 255 | static struct platform_device *sh770x_early_devices[] __initdata = { |
256 | &tmu0_device, | 256 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7710.c b/arch/sh/kernel/cpu/sh3/setup-sh7710.c index efa76c8148f4..717e90ae1097 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7710.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7710.c | |||
@@ -226,7 +226,7 @@ static int __init sh7710_devices_setup(void) | |||
226 | return platform_add_devices(sh7710_devices, | 226 | return platform_add_devices(sh7710_devices, |
227 | ARRAY_SIZE(sh7710_devices)); | 227 | ARRAY_SIZE(sh7710_devices)); |
228 | } | 228 | } |
229 | __initcall(sh7710_devices_setup); | 229 | arch_initcall(sh7710_devices_setup); |
230 | 230 | ||
231 | static struct platform_device *sh7710_early_devices[] __initdata = { | 231 | static struct platform_device *sh7710_early_devices[] __initdata = { |
232 | &tmu0_device, | 232 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c index 5b2107798edb..74d8baaf8e96 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c | |||
@@ -388,7 +388,7 @@ static int __init sh7720_devices_setup(void) | |||
388 | return platform_add_devices(sh7720_devices, | 388 | return platform_add_devices(sh7720_devices, |
389 | ARRAY_SIZE(sh7720_devices)); | 389 | ARRAY_SIZE(sh7720_devices)); |
390 | } | 390 | } |
391 | __initcall(sh7720_devices_setup); | 391 | arch_initcall(sh7720_devices_setup); |
392 | 392 | ||
393 | static struct platform_device *sh7720_early_devices[] __initdata = { | 393 | static struct platform_device *sh7720_early_devices[] __initdata = { |
394 | &cmt0_device, | 394 | &cmt0_device, |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c index 6d088d123591..de4827df19aa 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c | |||
@@ -138,7 +138,7 @@ static int __init sh4202_devices_setup(void) | |||
138 | return platform_add_devices(sh4202_devices, | 138 | return platform_add_devices(sh4202_devices, |
139 | ARRAY_SIZE(sh4202_devices)); | 139 | ARRAY_SIZE(sh4202_devices)); |
140 | } | 140 | } |
141 | __initcall(sh4202_devices_setup); | 141 | arch_initcall(sh4202_devices_setup); |
142 | 142 | ||
143 | static struct platform_device *sh4202_early_devices[] __initdata = { | 143 | static struct platform_device *sh4202_early_devices[] __initdata = { |
144 | &tmu0_device, | 144 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c index 851672d15cf4..1b8b122e8f3d 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c | |||
@@ -239,7 +239,7 @@ static int __init sh7750_devices_setup(void) | |||
239 | return platform_add_devices(sh7750_devices, | 239 | return platform_add_devices(sh7750_devices, |
240 | ARRAY_SIZE(sh7750_devices)); | 240 | ARRAY_SIZE(sh7750_devices)); |
241 | } | 241 | } |
242 | __initcall(sh7750_devices_setup); | 242 | arch_initcall(sh7750_devices_setup); |
243 | 243 | ||
244 | static struct platform_device *sh7750_early_devices[] __initdata = { | 244 | static struct platform_device *sh7750_early_devices[] __initdata = { |
245 | &tmu0_device, | 245 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7760.c b/arch/sh/kernel/cpu/sh4/setup-sh7760.c index 5b822519bd90..7fbb7be9284c 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7760.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh7760.c | |||
@@ -265,7 +265,7 @@ static int __init sh7760_devices_setup(void) | |||
265 | return platform_add_devices(sh7760_devices, | 265 | return platform_add_devices(sh7760_devices, |
266 | ARRAY_SIZE(sh7760_devices)); | 266 | ARRAY_SIZE(sh7760_devices)); |
267 | } | 267 | } |
268 | __initcall(sh7760_devices_setup); | 268 | arch_initcall(sh7760_devices_setup); |
269 | 269 | ||
270 | static struct platform_device *sh7760_early_devices[] __initdata = { | 270 | static struct platform_device *sh7760_early_devices[] __initdata = { |
271 | &tmu0_device, | 271 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c index 6307e087c864..ac4d5672ec1a 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c | |||
@@ -325,7 +325,7 @@ static int __init sh7343_devices_setup(void) | |||
325 | return platform_add_devices(sh7343_devices, | 325 | return platform_add_devices(sh7343_devices, |
326 | ARRAY_SIZE(sh7343_devices)); | 326 | ARRAY_SIZE(sh7343_devices)); |
327 | } | 327 | } |
328 | __initcall(sh7343_devices_setup); | 328 | arch_initcall(sh7343_devices_setup); |
329 | 329 | ||
330 | static struct platform_device *sh7343_early_devices[] __initdata = { | 330 | static struct platform_device *sh7343_early_devices[] __initdata = { |
331 | &cmt_device, | 331 | &cmt_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c index c18f7d09281b..1a956b1beccc 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c | |||
@@ -318,7 +318,7 @@ static int __init sh7366_devices_setup(void) | |||
318 | return platform_add_devices(sh7366_devices, | 318 | return platform_add_devices(sh7366_devices, |
319 | ARRAY_SIZE(sh7366_devices)); | 319 | ARRAY_SIZE(sh7366_devices)); |
320 | } | 320 | } |
321 | __initcall(sh7366_devices_setup); | 321 | arch_initcall(sh7366_devices_setup); |
322 | 322 | ||
323 | static struct platform_device *sh7366_early_devices[] __initdata = { | 323 | static struct platform_device *sh7366_early_devices[] __initdata = { |
324 | &cmt_device, | 324 | &cmt_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c index ea524a2da3e4..cda76ebf87c3 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c | |||
@@ -359,7 +359,7 @@ static int __init sh7722_devices_setup(void) | |||
359 | return platform_add_devices(sh7722_devices, | 359 | return platform_add_devices(sh7722_devices, |
360 | ARRAY_SIZE(sh7722_devices)); | 360 | ARRAY_SIZE(sh7722_devices)); |
361 | } | 361 | } |
362 | __initcall(sh7722_devices_setup); | 362 | arch_initcall(sh7722_devices_setup); |
363 | 363 | ||
364 | static struct platform_device *sh7722_early_devices[] __initdata = { | 364 | static struct platform_device *sh7722_early_devices[] __initdata = { |
365 | &cmt_device, | 365 | &cmt_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c index e1bb80b2a27b..b45dace9539f 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c | |||
@@ -473,7 +473,7 @@ static int __init sh7723_devices_setup(void) | |||
473 | return platform_add_devices(sh7723_devices, | 473 | return platform_add_devices(sh7723_devices, |
474 | ARRAY_SIZE(sh7723_devices)); | 474 | ARRAY_SIZE(sh7723_devices)); |
475 | } | 475 | } |
476 | __initcall(sh7723_devices_setup); | 476 | arch_initcall(sh7723_devices_setup); |
477 | 477 | ||
478 | static struct platform_device *sh7723_early_devices[] __initdata = { | 478 | static struct platform_device *sh7723_early_devices[] __initdata = { |
479 | &cmt_device, | 479 | &cmt_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c index e5ac9eb11c63..a04edaab9a29 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c | |||
@@ -508,7 +508,7 @@ static int __init sh7724_devices_setup(void) | |||
508 | return platform_add_devices(sh7724_devices, | 508 | return platform_add_devices(sh7724_devices, |
509 | ARRAY_SIZE(sh7724_devices)); | 509 | ARRAY_SIZE(sh7724_devices)); |
510 | } | 510 | } |
511 | device_initcall(sh7724_devices_setup); | 511 | arch_initcall(sh7724_devices_setup); |
512 | 512 | ||
513 | static struct platform_device *sh7724_early_devices[] __initdata = { | 513 | static struct platform_device *sh7724_early_devices[] __initdata = { |
514 | &cmt_device, | 514 | &cmt_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c index f1e0c0d36da7..4659fff6b842 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c | |||
@@ -314,7 +314,7 @@ static int __init sh7763_devices_setup(void) | |||
314 | return platform_add_devices(sh7763_devices, | 314 | return platform_add_devices(sh7763_devices, |
315 | ARRAY_SIZE(sh7763_devices)); | 315 | ARRAY_SIZE(sh7763_devices)); |
316 | } | 316 | } |
317 | __initcall(sh7763_devices_setup); | 317 | arch_initcall(sh7763_devices_setup); |
318 | 318 | ||
319 | static struct platform_device *sh7763_early_devices[] __initdata = { | 319 | static struct platform_device *sh7763_early_devices[] __initdata = { |
320 | &tmu0_device, | 320 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c index 1e86209db284..eead08d89d32 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c | |||
@@ -368,7 +368,7 @@ static int __init sh7770_devices_setup(void) | |||
368 | return platform_add_devices(sh7770_devices, | 368 | return platform_add_devices(sh7770_devices, |
369 | ARRAY_SIZE(sh7770_devices)); | 369 | ARRAY_SIZE(sh7770_devices)); |
370 | } | 370 | } |
371 | __initcall(sh7770_devices_setup); | 371 | arch_initcall(sh7770_devices_setup); |
372 | 372 | ||
373 | static struct platform_device *sh7770_early_devices[] __initdata = { | 373 | static struct platform_device *sh7770_early_devices[] __initdata = { |
374 | &tmu0_device, | 374 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c index 715e05b431e5..2c901f446959 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c | |||
@@ -256,7 +256,7 @@ static int __init sh7780_devices_setup(void) | |||
256 | return platform_add_devices(sh7780_devices, | 256 | return platform_add_devices(sh7780_devices, |
257 | ARRAY_SIZE(sh7780_devices)); | 257 | ARRAY_SIZE(sh7780_devices)); |
258 | } | 258 | } |
259 | __initcall(sh7780_devices_setup); | 259 | arch_initcall(sh7780_devices_setup); |
260 | 260 | ||
261 | static struct platform_device *sh7780_early_devices[] __initdata = { | 261 | static struct platform_device *sh7780_early_devices[] __initdata = { |
262 | &tmu0_device, | 262 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c index af561402570b..7f6c718b6c36 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c | |||
@@ -263,7 +263,7 @@ static int __init sh7785_devices_setup(void) | |||
263 | return platform_add_devices(sh7785_devices, | 263 | return platform_add_devices(sh7785_devices, |
264 | ARRAY_SIZE(sh7785_devices)); | 264 | ARRAY_SIZE(sh7785_devices)); |
265 | } | 265 | } |
266 | __initcall(sh7785_devices_setup); | 266 | arch_initcall(sh7785_devices_setup); |
267 | 267 | ||
268 | static struct platform_device *sh7785_early_devices[] __initdata = { | 268 | static struct platform_device *sh7785_early_devices[] __initdata = { |
269 | &tmu0_device, | 269 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c index b70049470a0b..0104a8ec5369 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c | |||
@@ -547,7 +547,7 @@ static int __init sh7786_devices_setup(void) | |||
547 | return platform_add_devices(sh7786_devices, | 547 | return platform_add_devices(sh7786_devices, |
548 | ARRAY_SIZE(sh7786_devices)); | 548 | ARRAY_SIZE(sh7786_devices)); |
549 | } | 549 | } |
550 | device_initcall(sh7786_devices_setup); | 550 | arch_initcall(sh7786_devices_setup); |
551 | 551 | ||
552 | void __init plat_early_device_setup(void) | 552 | void __init plat_early_device_setup(void) |
553 | { | 553 | { |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-shx3.c b/arch/sh/kernel/cpu/sh4a/setup-shx3.c index 53c65fd9ccef..07f078961c71 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-shx3.c +++ b/arch/sh/kernel/cpu/sh4a/setup-shx3.c | |||
@@ -256,7 +256,7 @@ static int __init shx3_devices_setup(void) | |||
256 | return platform_add_devices(shx3_devices, | 256 | return platform_add_devices(shx3_devices, |
257 | ARRAY_SIZE(shx3_devices)); | 257 | ARRAY_SIZE(shx3_devices)); |
258 | } | 258 | } |
259 | __initcall(shx3_devices_setup); | 259 | arch_initcall(shx3_devices_setup); |
260 | 260 | ||
261 | void __init plat_early_device_setup(void) | 261 | void __init plat_early_device_setup(void) |
262 | { | 262 | { |
diff --git a/arch/sh/kernel/cpu/sh5/setup-sh5.c b/arch/sh/kernel/cpu/sh5/setup-sh5.c index f5ff1ac57fc2..6a0f82f70032 100644 --- a/arch/sh/kernel/cpu/sh5/setup-sh5.c +++ b/arch/sh/kernel/cpu/sh5/setup-sh5.c | |||
@@ -186,7 +186,7 @@ static int __init sh5_devices_setup(void) | |||
186 | return platform_add_devices(sh5_devices, | 186 | return platform_add_devices(sh5_devices, |
187 | ARRAY_SIZE(sh5_devices)); | 187 | ARRAY_SIZE(sh5_devices)); |
188 | } | 188 | } |
189 | __initcall(sh5_devices_setup); | 189 | arch_initcall(sh5_devices_setup); |
190 | 190 | ||
191 | void __init plat_early_device_setup(void) | 191 | void __init plat_early_device_setup(void) |
192 | { | 192 | { |
diff --git a/arch/sh/kernel/cpu/shmobile/sleep.S b/arch/sh/kernel/cpu/shmobile/sleep.S index 5d888ef53d82..baf2d7d46b05 100644 --- a/arch/sh/kernel/cpu/shmobile/sleep.S +++ b/arch/sh/kernel/cpu/shmobile/sleep.S | |||
@@ -26,8 +26,30 @@ ENTRY(sh_mobile_standby) | |||
26 | 26 | ||
27 | tst #SUSP_SH_SF, r0 | 27 | tst #SUSP_SH_SF, r0 |
28 | bt skip_set_sf | 28 | bt skip_set_sf |
29 | #ifdef CONFIG_CPU_SUBTYPE_SH7724 | ||
30 | /* DBSC: put memory in self-refresh mode */ | ||
29 | 31 | ||
30 | /* SDRAM: disable power down and put in self-refresh mode */ | 32 | mov.l dben_reg, r4 |
33 | mov.l dben_data0, r1 | ||
34 | mov.l r1, @r4 | ||
35 | |||
36 | mov.l dbrfpdn0_reg, r4 | ||
37 | mov.l dbrfpdn0_data0, r1 | ||
38 | mov.l r1, @r4 | ||
39 | |||
40 | mov.l dbcmdcnt_reg, r4 | ||
41 | mov.l dbcmdcnt_data0, r1 | ||
42 | mov.l r1, @r4 | ||
43 | |||
44 | mov.l dbcmdcnt_reg, r4 | ||
45 | mov.l dbcmdcnt_data1, r1 | ||
46 | mov.l r1, @r4 | ||
47 | |||
48 | mov.l dbrfpdn0_reg, r4 | ||
49 | mov.l dbrfpdn0_data1, r1 | ||
50 | mov.l r1, @r4 | ||
51 | #else | ||
52 | /* SBSC: disable power down and put in self-refresh mode */ | ||
31 | mov.l 1f, r4 | 53 | mov.l 1f, r4 |
32 | mov.l 2f, r1 | 54 | mov.l 2f, r1 |
33 | mov.l @r4, r2 | 55 | mov.l @r4, r2 |
@@ -35,6 +57,7 @@ ENTRY(sh_mobile_standby) | |||
35 | mov.l 3f, r3 | 57 | mov.l 3f, r3 |
36 | and r3, r2 | 58 | and r3, r2 |
37 | mov.l r2, @r4 | 59 | mov.l r2, @r4 |
60 | #endif | ||
38 | 61 | ||
39 | skip_set_sf: | 62 | skip_set_sf: |
40 | tst #SUSP_SH_SLEEP, r0 | 63 | tst #SUSP_SH_SLEEP, r0 |
@@ -84,7 +107,36 @@ done_sleep: | |||
84 | tst #SUSP_SH_SF, r0 | 107 | tst #SUSP_SH_SF, r0 |
85 | bt skip_restore_sf | 108 | bt skip_restore_sf |
86 | 109 | ||
87 | /* SDRAM: set auto-refresh mode */ | 110 | #ifdef CONFIG_CPU_SUBTYPE_SH7724 |
111 | /* DBSC: put memory in auto-refresh mode */ | ||
112 | |||
113 | mov.l dbrfpdn0_reg, r4 | ||
114 | mov.l dbrfpdn0_data0, r1 | ||
115 | mov.l r1, @r4 | ||
116 | |||
117 | /* sleep 140 ns */ | ||
118 | nop | ||
119 | nop | ||
120 | nop | ||
121 | nop | ||
122 | |||
123 | mov.l dbcmdcnt_reg, r4 | ||
124 | mov.l dbcmdcnt_data0, r1 | ||
125 | mov.l r1, @r4 | ||
126 | |||
127 | mov.l dbcmdcnt_reg, r4 | ||
128 | mov.l dbcmdcnt_data1, r1 | ||
129 | mov.l r1, @r4 | ||
130 | |||
131 | mov.l dben_reg, r4 | ||
132 | mov.l dben_data1, r1 | ||
133 | mov.l r1, @r4 | ||
134 | |||
135 | mov.l dbrfpdn0_reg, r4 | ||
136 | mov.l dbrfpdn0_data2, r1 | ||
137 | mov.l r1, @r4 | ||
138 | #else | ||
139 | /* SBSC: set auto-refresh mode */ | ||
88 | mov.l 1f, r4 | 140 | mov.l 1f, r4 |
89 | mov.l @r4, r2 | 141 | mov.l @r4, r2 |
90 | mov.l 4f, r3 | 142 | mov.l 4f, r3 |
@@ -98,15 +150,29 @@ done_sleep: | |||
98 | add r4, r3 | 150 | add r4, r3 |
99 | or r2, r3 | 151 | or r2, r3 |
100 | mov.l r3, @r1 | 152 | mov.l r3, @r1 |
153 | #endif | ||
101 | skip_restore_sf: | 154 | skip_restore_sf: |
102 | rts | 155 | rts |
103 | nop | 156 | nop |
104 | 157 | ||
105 | .balign 4 | 158 | .balign 4 |
159 | #ifdef CONFIG_CPU_SUBTYPE_SH7724 | ||
160 | dben_reg: .long 0xfd000010 /* DBEN */ | ||
161 | dben_data0: .long 0 | ||
162 | dben_data1: .long 1 | ||
163 | dbrfpdn0_reg: .long 0xfd000040 /* DBRFPDN0 */ | ||
164 | dbrfpdn0_data0: .long 0 | ||
165 | dbrfpdn0_data1: .long 1 | ||
166 | dbrfpdn0_data2: .long 0x00010000 | ||
167 | dbcmdcnt_reg: .long 0xfd000014 /* DBCMDCNT */ | ||
168 | dbcmdcnt_data0: .long 2 | ||
169 | dbcmdcnt_data1: .long 4 | ||
170 | #else | ||
106 | 1: .long 0xfe400008 /* SDCR0 */ | 171 | 1: .long 0xfe400008 /* SDCR0 */ |
107 | 2: .long 0x00000400 | 172 | 2: .long 0x00000400 |
108 | 3: .long 0xffff7fff | 173 | 3: .long 0xffff7fff |
109 | 4: .long 0xfffffbff | 174 | 4: .long 0xfffffbff |
175 | #endif | ||
110 | 5: .long 0xa4150020 /* STBCR */ | 176 | 5: .long 0xa4150020 /* STBCR */ |
111 | 6: .long 0xfe40001c /* RTCOR */ | 177 | 6: .long 0xfe40001c /* RTCOR */ |
112 | 7: .long 0xfe400018 /* RTCNT */ | 178 | 7: .long 0xfe400018 /* RTCNT */ |
diff --git a/arch/sparc/configs/sparc32_defconfig b/arch/sparc/configs/sparc32_defconfig index 8bcd27af724b..a0f62a808edb 100644 --- a/arch/sparc/configs/sparc32_defconfig +++ b/arch/sparc/configs/sparc32_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.30-rc2 | 3 | # Linux kernel version: 2.6.31-rc1 |
4 | # Fri Apr 17 04:04:46 2009 | 4 | # Tue Aug 18 23:45:52 2009 |
5 | # | 5 | # |
6 | # CONFIG_64BIT is not set | 6 | # CONFIG_64BIT is not set |
7 | CONFIG_SPARC=y | 7 | CONFIG_SPARC=y |
@@ -17,6 +17,7 @@ CONFIG_GENERIC_ISA_DMA=y | |||
17 | CONFIG_ARCH_NO_VIRT_TO_BUS=y | 17 | CONFIG_ARCH_NO_VIRT_TO_BUS=y |
18 | CONFIG_OF=y | 18 | CONFIG_OF=y |
19 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 19 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
20 | CONFIG_CONSTRUCTORS=y | ||
20 | 21 | ||
21 | # | 22 | # |
22 | # General setup | 23 | # General setup |
@@ -74,7 +75,6 @@ CONFIG_SYSCTL_SYSCALL=y | |||
74 | CONFIG_KALLSYMS=y | 75 | CONFIG_KALLSYMS=y |
75 | # CONFIG_KALLSYMS_ALL is not set | 76 | # CONFIG_KALLSYMS_ALL is not set |
76 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | 77 | # CONFIG_KALLSYMS_EXTRA_PASS is not set |
77 | # CONFIG_STRIP_ASM_SYMS is not set | ||
78 | CONFIG_HOTPLUG=y | 78 | CONFIG_HOTPLUG=y |
79 | CONFIG_PRINTK=y | 79 | CONFIG_PRINTK=y |
80 | CONFIG_BUG=y | 80 | CONFIG_BUG=y |
@@ -87,8 +87,13 @@ CONFIG_TIMERFD=y | |||
87 | CONFIG_EVENTFD=y | 87 | CONFIG_EVENTFD=y |
88 | CONFIG_SHMEM=y | 88 | CONFIG_SHMEM=y |
89 | CONFIG_AIO=y | 89 | CONFIG_AIO=y |
90 | |||
91 | # | ||
92 | # Performance Counters | ||
93 | # | ||
90 | CONFIG_VM_EVENT_COUNTERS=y | 94 | CONFIG_VM_EVENT_COUNTERS=y |
91 | CONFIG_PCI_QUIRKS=y | 95 | CONFIG_PCI_QUIRKS=y |
96 | # CONFIG_STRIP_ASM_SYMS is not set | ||
92 | CONFIG_COMPAT_BRK=y | 97 | CONFIG_COMPAT_BRK=y |
93 | CONFIG_SLAB=y | 98 | CONFIG_SLAB=y |
94 | # CONFIG_SLUB is not set | 99 | # CONFIG_SLUB is not set |
@@ -97,6 +102,10 @@ CONFIG_SLAB=y | |||
97 | # CONFIG_MARKERS is not set | 102 | # CONFIG_MARKERS is not set |
98 | CONFIG_HAVE_OPROFILE=y | 103 | CONFIG_HAVE_OPROFILE=y |
99 | CONFIG_HAVE_ARCH_TRACEHOOK=y | 104 | CONFIG_HAVE_ARCH_TRACEHOOK=y |
105 | |||
106 | # | ||
107 | # GCOV-based kernel profiling | ||
108 | # | ||
100 | # CONFIG_SLOW_WORK is not set | 109 | # CONFIG_SLOW_WORK is not set |
101 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | 110 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set |
102 | CONFIG_SLABINFO=y | 111 | CONFIG_SLABINFO=y |
@@ -109,7 +118,7 @@ CONFIG_MODULE_UNLOAD=y | |||
109 | # CONFIG_MODVERSIONS is not set | 118 | # CONFIG_MODVERSIONS is not set |
110 | # CONFIG_MODULE_SRCVERSION_ALL is not set | 119 | # CONFIG_MODULE_SRCVERSION_ALL is not set |
111 | CONFIG_BLOCK=y | 120 | CONFIG_BLOCK=y |
112 | # CONFIG_LBD is not set | 121 | CONFIG_LBDAF=y |
113 | # CONFIG_BLK_DEV_BSG is not set | 122 | # CONFIG_BLK_DEV_BSG is not set |
114 | # CONFIG_BLK_DEV_INTEGRITY is not set | 123 | # CONFIG_BLK_DEV_INTEGRITY is not set |
115 | 124 | ||
@@ -154,9 +163,9 @@ CONFIG_SPLIT_PTLOCK_CPUS=4 | |||
154 | # CONFIG_PHYS_ADDR_T_64BIT is not set | 163 | # CONFIG_PHYS_ADDR_T_64BIT is not set |
155 | CONFIG_ZONE_DMA_FLAG=1 | 164 | CONFIG_ZONE_DMA_FLAG=1 |
156 | CONFIG_BOUNCE=y | 165 | CONFIG_BOUNCE=y |
157 | CONFIG_UNEVICTABLE_LRU=y | ||
158 | CONFIG_HAVE_MLOCK=y | 166 | CONFIG_HAVE_MLOCK=y |
159 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y | 167 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y |
168 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 | ||
160 | CONFIG_SUN_PM=y | 169 | CONFIG_SUN_PM=y |
161 | # CONFIG_SPARC_LED is not set | 170 | # CONFIG_SPARC_LED is not set |
162 | CONFIG_SERIAL_CONSOLE=y | 171 | CONFIG_SERIAL_CONSOLE=y |
@@ -264,6 +273,7 @@ CONFIG_IPV6_TUNNEL=m | |||
264 | # CONFIG_ECONET is not set | 273 | # CONFIG_ECONET is not set |
265 | # CONFIG_WAN_ROUTER is not set | 274 | # CONFIG_WAN_ROUTER is not set |
266 | # CONFIG_PHONET is not set | 275 | # CONFIG_PHONET is not set |
276 | # CONFIG_IEEE802154 is not set | ||
267 | # CONFIG_NET_SCHED is not set | 277 | # CONFIG_NET_SCHED is not set |
268 | # CONFIG_DCB is not set | 278 | # CONFIG_DCB is not set |
269 | 279 | ||
@@ -281,7 +291,11 @@ CONFIG_WIRELESS=y | |||
281 | CONFIG_WIRELESS_OLD_REGULATORY=y | 291 | CONFIG_WIRELESS_OLD_REGULATORY=y |
282 | # CONFIG_WIRELESS_EXT is not set | 292 | # CONFIG_WIRELESS_EXT is not set |
283 | # CONFIG_LIB80211 is not set | 293 | # CONFIG_LIB80211 is not set |
284 | # CONFIG_MAC80211 is not set | 294 | |
295 | # | ||
296 | # CFG80211 needs to be enabled for MAC80211 | ||
297 | # | ||
298 | CONFIG_MAC80211_DEFAULT_PS_VALUE=0 | ||
285 | # CONFIG_WIMAX is not set | 299 | # CONFIG_WIMAX is not set |
286 | # CONFIG_RFKILL is not set | 300 | # CONFIG_RFKILL is not set |
287 | # CONFIG_NET_9P is not set | 301 | # CONFIG_NET_9P is not set |
@@ -335,6 +349,7 @@ CONFIG_MISC_DEVICES=y | |||
335 | # EEPROM support | 349 | # EEPROM support |
336 | # | 350 | # |
337 | # CONFIG_EEPROM_93CX6 is not set | 351 | # CONFIG_EEPROM_93CX6 is not set |
352 | # CONFIG_CB710_CORE is not set | ||
338 | CONFIG_HAVE_IDE=y | 353 | CONFIG_HAVE_IDE=y |
339 | # CONFIG_IDE is not set | 354 | # CONFIG_IDE is not set |
340 | 355 | ||
@@ -358,10 +373,6 @@ CONFIG_BLK_DEV_SR=m | |||
358 | # CONFIG_BLK_DEV_SR_VENDOR is not set | 373 | # CONFIG_BLK_DEV_SR_VENDOR is not set |
359 | CONFIG_CHR_DEV_SG=m | 374 | CONFIG_CHR_DEV_SG=m |
360 | # CONFIG_CHR_DEV_SCH is not set | 375 | # CONFIG_CHR_DEV_SCH is not set |
361 | |||
362 | # | ||
363 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs | ||
364 | # | ||
365 | # CONFIG_SCSI_MULTI_LUN is not set | 376 | # CONFIG_SCSI_MULTI_LUN is not set |
366 | # CONFIG_SCSI_CONSTANTS is not set | 377 | # CONFIG_SCSI_CONSTANTS is not set |
367 | # CONFIG_SCSI_LOGGING is not set | 378 | # CONFIG_SCSI_LOGGING is not set |
@@ -379,6 +390,7 @@ CONFIG_SCSI_SPI_ATTRS=y | |||
379 | CONFIG_SCSI_LOWLEVEL=y | 390 | CONFIG_SCSI_LOWLEVEL=y |
380 | # CONFIG_ISCSI_TCP is not set | 391 | # CONFIG_ISCSI_TCP is not set |
381 | # CONFIG_SCSI_CXGB3_ISCSI is not set | 392 | # CONFIG_SCSI_CXGB3_ISCSI is not set |
393 | # CONFIG_SCSI_BNX2_ISCSI is not set | ||
382 | # CONFIG_BLK_DEV_3W_XXXX_RAID is not set | 394 | # CONFIG_BLK_DEV_3W_XXXX_RAID is not set |
383 | # CONFIG_SCSI_3W_9XXX is not set | 395 | # CONFIG_SCSI_3W_9XXX is not set |
384 | # CONFIG_SCSI_ACARD is not set | 396 | # CONFIG_SCSI_ACARD is not set |
@@ -387,6 +399,7 @@ CONFIG_SCSI_LOWLEVEL=y | |||
387 | # CONFIG_SCSI_AIC7XXX_OLD is not set | 399 | # CONFIG_SCSI_AIC7XXX_OLD is not set |
388 | # CONFIG_SCSI_AIC79XX is not set | 400 | # CONFIG_SCSI_AIC79XX is not set |
389 | # CONFIG_SCSI_AIC94XX is not set | 401 | # CONFIG_SCSI_AIC94XX is not set |
402 | # CONFIG_SCSI_MVSAS is not set | ||
390 | # CONFIG_SCSI_ARCMSR is not set | 403 | # CONFIG_SCSI_ARCMSR is not set |
391 | # CONFIG_MEGARAID_NEWGEN is not set | 404 | # CONFIG_MEGARAID_NEWGEN is not set |
392 | # CONFIG_MEGARAID_LEGACY is not set | 405 | # CONFIG_MEGARAID_LEGACY is not set |
@@ -401,7 +414,6 @@ CONFIG_SCSI_LOWLEVEL=y | |||
401 | # CONFIG_SCSI_IPS is not set | 414 | # CONFIG_SCSI_IPS is not set |
402 | # CONFIG_SCSI_INITIO is not set | 415 | # CONFIG_SCSI_INITIO is not set |
403 | # CONFIG_SCSI_INIA100 is not set | 416 | # CONFIG_SCSI_INIA100 is not set |
404 | # CONFIG_SCSI_MVSAS is not set | ||
405 | # CONFIG_SCSI_STEX is not set | 417 | # CONFIG_SCSI_STEX is not set |
406 | # CONFIG_SCSI_SYM53C8XX_2 is not set | 418 | # CONFIG_SCSI_SYM53C8XX_2 is not set |
407 | # CONFIG_SCSI_QLOGIC_1280 is not set | 419 | # CONFIG_SCSI_QLOGIC_1280 is not set |
@@ -426,13 +438,16 @@ CONFIG_SCSI_SUNESP=y | |||
426 | # | 438 | # |
427 | 439 | ||
428 | # | 440 | # |
429 | # Enable only one of the two stacks, unless you know what you are doing | 441 | # You can enable one or both FireWire driver stacks. |
442 | # | ||
443 | |||
444 | # | ||
445 | # See the help texts for more information. | ||
430 | # | 446 | # |
431 | # CONFIG_FIREWIRE is not set | 447 | # CONFIG_FIREWIRE is not set |
432 | # CONFIG_IEEE1394 is not set | 448 | # CONFIG_IEEE1394 is not set |
433 | # CONFIG_I2O is not set | 449 | # CONFIG_I2O is not set |
434 | CONFIG_NETDEVICES=y | 450 | CONFIG_NETDEVICES=y |
435 | CONFIG_COMPAT_NET_DEV_OPS=y | ||
436 | CONFIG_DUMMY=m | 451 | CONFIG_DUMMY=m |
437 | # CONFIG_BONDING is not set | 452 | # CONFIG_BONDING is not set |
438 | # CONFIG_MACVLAN is not set | 453 | # CONFIG_MACVLAN is not set |
@@ -463,6 +478,7 @@ CONFIG_SUNQE=m | |||
463 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set | 478 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set |
464 | # CONFIG_NET_PCI is not set | 479 | # CONFIG_NET_PCI is not set |
465 | # CONFIG_B44 is not set | 480 | # CONFIG_B44 is not set |
481 | # CONFIG_KS8842 is not set | ||
466 | # CONFIG_ATL2 is not set | 482 | # CONFIG_ATL2 is not set |
467 | CONFIG_NETDEV_1000=y | 483 | CONFIG_NETDEV_1000=y |
468 | # CONFIG_ACENIC is not set | 484 | # CONFIG_ACENIC is not set |
@@ -482,6 +498,7 @@ CONFIG_NETDEV_1000=y | |||
482 | # CONFIG_VIA_VELOCITY is not set | 498 | # CONFIG_VIA_VELOCITY is not set |
483 | # CONFIG_TIGON3 is not set | 499 | # CONFIG_TIGON3 is not set |
484 | # CONFIG_BNX2 is not set | 500 | # CONFIG_BNX2 is not set |
501 | # CONFIG_CNIC is not set | ||
485 | # CONFIG_QLA3XXX is not set | 502 | # CONFIG_QLA3XXX is not set |
486 | # CONFIG_ATL1 is not set | 503 | # CONFIG_ATL1 is not set |
487 | # CONFIG_ATL1E is not set | 504 | # CONFIG_ATL1E is not set |
@@ -629,6 +646,11 @@ CONFIG_HW_RANDOM=m | |||
629 | CONFIG_DEVPORT=y | 646 | CONFIG_DEVPORT=y |
630 | # CONFIG_I2C is not set | 647 | # CONFIG_I2C is not set |
631 | # CONFIG_SPI is not set | 648 | # CONFIG_SPI is not set |
649 | |||
650 | # | ||
651 | # PPS support | ||
652 | # | ||
653 | # CONFIG_PPS is not set | ||
632 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | 654 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y |
633 | # CONFIG_GPIOLIB is not set | 655 | # CONFIG_GPIOLIB is not set |
634 | # CONFIG_W1 is not set | 656 | # CONFIG_W1 is not set |
@@ -668,22 +690,7 @@ CONFIG_SSB_POSSIBLE=y | |||
668 | # CONFIG_HTC_PASIC3 is not set | 690 | # CONFIG_HTC_PASIC3 is not set |
669 | # CONFIG_MFD_TMIO is not set | 691 | # CONFIG_MFD_TMIO is not set |
670 | # CONFIG_REGULATOR is not set | 692 | # CONFIG_REGULATOR is not set |
671 | 693 | # CONFIG_MEDIA_SUPPORT is not set | |
672 | # | ||
673 | # Multimedia devices | ||
674 | # | ||
675 | |||
676 | # | ||
677 | # Multimedia core support | ||
678 | # | ||
679 | # CONFIG_VIDEO_DEV is not set | ||
680 | # CONFIG_DVB_CORE is not set | ||
681 | # CONFIG_VIDEO_MEDIA is not set | ||
682 | |||
683 | # | ||
684 | # Multimedia drivers | ||
685 | # | ||
686 | # CONFIG_DAB is not set | ||
687 | 694 | ||
688 | # | 695 | # |
689 | # Graphics support | 696 | # Graphics support |
@@ -776,6 +783,10 @@ CONFIG_RTC_DRV_M48T59=y | |||
776 | # CONFIG_DMADEVICES is not set | 783 | # CONFIG_DMADEVICES is not set |
777 | # CONFIG_AUXDISPLAY is not set | 784 | # CONFIG_AUXDISPLAY is not set |
778 | # CONFIG_UIO is not set | 785 | # CONFIG_UIO is not set |
786 | |||
787 | # | ||
788 | # TI VLYNQ | ||
789 | # | ||
779 | # CONFIG_STAGING is not set | 790 | # CONFIG_STAGING is not set |
780 | 791 | ||
781 | # | 792 | # |
@@ -799,10 +810,12 @@ CONFIG_FS_MBCACHE=y | |||
799 | # CONFIG_REISERFS_FS is not set | 810 | # CONFIG_REISERFS_FS is not set |
800 | # CONFIG_JFS_FS is not set | 811 | # CONFIG_JFS_FS is not set |
801 | CONFIG_FS_POSIX_ACL=y | 812 | CONFIG_FS_POSIX_ACL=y |
802 | CONFIG_FILE_LOCKING=y | ||
803 | # CONFIG_XFS_FS is not set | 813 | # CONFIG_XFS_FS is not set |
814 | # CONFIG_GFS2_FS is not set | ||
804 | # CONFIG_OCFS2_FS is not set | 815 | # CONFIG_OCFS2_FS is not set |
805 | # CONFIG_BTRFS_FS is not set | 816 | # CONFIG_BTRFS_FS is not set |
817 | CONFIG_FILE_LOCKING=y | ||
818 | CONFIG_FSNOTIFY=y | ||
806 | CONFIG_DNOTIFY=y | 819 | CONFIG_DNOTIFY=y |
807 | CONFIG_INOTIFY=y | 820 | CONFIG_INOTIFY=y |
808 | CONFIG_INOTIFY_USER=y | 821 | CONFIG_INOTIFY_USER=y |
@@ -985,6 +998,7 @@ CONFIG_KGDB=y | |||
985 | CONFIG_KGDB_SERIAL_CONSOLE=y | 998 | CONFIG_KGDB_SERIAL_CONSOLE=y |
986 | CONFIG_KGDB_TESTS=y | 999 | CONFIG_KGDB_TESTS=y |
987 | # CONFIG_KGDB_TESTS_ON_BOOT is not set | 1000 | # CONFIG_KGDB_TESTS_ON_BOOT is not set |
1001 | # CONFIG_KMEMCHECK is not set | ||
988 | # CONFIG_DEBUG_STACK_USAGE is not set | 1002 | # CONFIG_DEBUG_STACK_USAGE is not set |
989 | # CONFIG_STACK_DEBUG is not set | 1003 | # CONFIG_STACK_DEBUG is not set |
990 | 1004 | ||
diff --git a/arch/sparc/configs/sparc64_defconfig b/arch/sparc/configs/sparc64_defconfig index 0123a4c596ce..fdddf7a6f725 100644 --- a/arch/sparc/configs/sparc64_defconfig +++ b/arch/sparc/configs/sparc64_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.30 | 3 | # Linux kernel version: 2.6.31-rc1 |
4 | # Tue Jun 16 04:59:36 2009 | 4 | # Tue Aug 18 23:56:02 2009 |
5 | # | 5 | # |
6 | CONFIG_64BIT=y | 6 | CONFIG_64BIT=y |
7 | CONFIG_SPARC=y | 7 | CONFIG_SPARC=y |
@@ -26,6 +26,7 @@ CONFIG_ARCH_NO_VIRT_TO_BUS=y | |||
26 | CONFIG_OF=y | 26 | CONFIG_OF=y |
27 | CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y | 27 | CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y |
28 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 28 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
29 | CONFIG_CONSTRUCTORS=y | ||
29 | 30 | ||
30 | # | 31 | # |
31 | # General setup | 32 | # General setup |
@@ -119,6 +120,11 @@ CONFIG_HAVE_KPROBES=y | |||
119 | CONFIG_HAVE_KRETPROBES=y | 120 | CONFIG_HAVE_KRETPROBES=y |
120 | CONFIG_HAVE_ARCH_TRACEHOOK=y | 121 | CONFIG_HAVE_ARCH_TRACEHOOK=y |
121 | CONFIG_USE_GENERIC_SMP_HELPERS=y | 122 | CONFIG_USE_GENERIC_SMP_HELPERS=y |
123 | |||
124 | # | ||
125 | # GCOV-based kernel profiling | ||
126 | # | ||
127 | # CONFIG_GCOV_KERNEL is not set | ||
122 | # CONFIG_SLOW_WORK is not set | 128 | # CONFIG_SLOW_WORK is not set |
123 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | 129 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set |
124 | CONFIG_SLABINFO=y | 130 | CONFIG_SLABINFO=y |
@@ -204,7 +210,6 @@ CONFIG_MIGRATION=y | |||
204 | CONFIG_PHYS_ADDR_T_64BIT=y | 210 | CONFIG_PHYS_ADDR_T_64BIT=y |
205 | CONFIG_ZONE_DMA_FLAG=0 | 211 | CONFIG_ZONE_DMA_FLAG=0 |
206 | CONFIG_NR_QUICK=1 | 212 | CONFIG_NR_QUICK=1 |
207 | CONFIG_UNEVICTABLE_LRU=y | ||
208 | CONFIG_HAVE_MLOCK=y | 213 | CONFIG_HAVE_MLOCK=y |
209 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y | 214 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y |
210 | CONFIG_DEFAULT_MMAP_MIN_ADDR=8192 | 215 | CONFIG_DEFAULT_MMAP_MIN_ADDR=8192 |
@@ -410,6 +415,7 @@ CONFIG_MISC_DEVICES=y | |||
410 | # | 415 | # |
411 | # CONFIG_EEPROM_AT24 is not set | 416 | # CONFIG_EEPROM_AT24 is not set |
412 | # CONFIG_EEPROM_LEGACY is not set | 417 | # CONFIG_EEPROM_LEGACY is not set |
418 | # CONFIG_EEPROM_MAX6875 is not set | ||
413 | # CONFIG_EEPROM_93CX6 is not set | 419 | # CONFIG_EEPROM_93CX6 is not set |
414 | # CONFIG_CB710_CORE is not set | 420 | # CONFIG_CB710_CORE is not set |
415 | CONFIG_HAVE_IDE=y | 421 | CONFIG_HAVE_IDE=y |
@@ -562,6 +568,7 @@ CONFIG_BLK_DEV_DM=m | |||
562 | CONFIG_DM_CRYPT=m | 568 | CONFIG_DM_CRYPT=m |
563 | CONFIG_DM_SNAPSHOT=m | 569 | CONFIG_DM_SNAPSHOT=m |
564 | CONFIG_DM_MIRROR=m | 570 | CONFIG_DM_MIRROR=m |
571 | # CONFIG_DM_LOG_USERSPACE is not set | ||
565 | CONFIG_DM_ZERO=m | 572 | CONFIG_DM_ZERO=m |
566 | # CONFIG_DM_MULTIPATH is not set | 573 | # CONFIG_DM_MULTIPATH is not set |
567 | # CONFIG_DM_DELAY is not set | 574 | # CONFIG_DM_DELAY is not set |
@@ -573,7 +580,11 @@ CONFIG_DM_ZERO=m | |||
573 | # | 580 | # |
574 | 581 | ||
575 | # | 582 | # |
576 | # Enable only one of the two stacks, unless you know what you are doing | 583 | # You can enable one or both FireWire driver stacks. |
584 | # | ||
585 | |||
586 | # | ||
587 | # See the help texts for more information. | ||
577 | # | 588 | # |
578 | # CONFIG_FIREWIRE is not set | 589 | # CONFIG_FIREWIRE is not set |
579 | # CONFIG_IEEE1394 is not set | 590 | # CONFIG_IEEE1394 is not set |
@@ -667,6 +678,7 @@ CONFIG_E1000E=m | |||
667 | # CONFIG_VIA_VELOCITY is not set | 678 | # CONFIG_VIA_VELOCITY is not set |
668 | CONFIG_TIGON3=m | 679 | CONFIG_TIGON3=m |
669 | CONFIG_BNX2=m | 680 | CONFIG_BNX2=m |
681 | # CONFIG_CNIC is not set | ||
670 | # CONFIG_QLA3XXX is not set | 682 | # CONFIG_QLA3XXX is not set |
671 | # CONFIG_ATL1 is not set | 683 | # CONFIG_ATL1 is not set |
672 | # CONFIG_ATL1E is not set | 684 | # CONFIG_ATL1E is not set |
@@ -773,6 +785,7 @@ CONFIG_MOUSE_SERIAL=y | |||
773 | # CONFIG_MOUSE_APPLETOUCH is not set | 785 | # CONFIG_MOUSE_APPLETOUCH is not set |
774 | # CONFIG_MOUSE_BCM5974 is not set | 786 | # CONFIG_MOUSE_BCM5974 is not set |
775 | # CONFIG_MOUSE_VSXXXAA is not set | 787 | # CONFIG_MOUSE_VSXXXAA is not set |
788 | # CONFIG_MOUSE_SYNAPTICS_I2C is not set | ||
776 | # CONFIG_INPUT_JOYSTICK is not set | 789 | # CONFIG_INPUT_JOYSTICK is not set |
777 | # CONFIG_INPUT_TABLET is not set | 790 | # CONFIG_INPUT_TABLET is not set |
778 | # CONFIG_INPUT_TOUCHSCREEN is not set | 791 | # CONFIG_INPUT_TOUCHSCREEN is not set |
@@ -870,6 +883,7 @@ CONFIG_I2C_ALGOBIT=y | |||
870 | # | 883 | # |
871 | # I2C system bus drivers (mostly embedded / system-on-chip) | 884 | # I2C system bus drivers (mostly embedded / system-on-chip) |
872 | # | 885 | # |
886 | # CONFIG_I2C_DESIGNWARE is not set | ||
873 | # CONFIG_I2C_OCORES is not set | 887 | # CONFIG_I2C_OCORES is not set |
874 | # CONFIG_I2C_SIMTEC is not set | 888 | # CONFIG_I2C_SIMTEC is not set |
875 | 889 | ||
@@ -898,13 +912,17 @@ CONFIG_I2C_ALGOBIT=y | |||
898 | # CONFIG_SENSORS_PCF8574 is not set | 912 | # CONFIG_SENSORS_PCF8574 is not set |
899 | # CONFIG_PCF8575 is not set | 913 | # CONFIG_PCF8575 is not set |
900 | # CONFIG_SENSORS_PCA9539 is not set | 914 | # CONFIG_SENSORS_PCA9539 is not set |
901 | # CONFIG_SENSORS_MAX6875 is not set | ||
902 | # CONFIG_SENSORS_TSL2550 is not set | 915 | # CONFIG_SENSORS_TSL2550 is not set |
903 | # CONFIG_I2C_DEBUG_CORE is not set | 916 | # CONFIG_I2C_DEBUG_CORE is not set |
904 | # CONFIG_I2C_DEBUG_ALGO is not set | 917 | # CONFIG_I2C_DEBUG_ALGO is not set |
905 | # CONFIG_I2C_DEBUG_BUS is not set | 918 | # CONFIG_I2C_DEBUG_BUS is not set |
906 | # CONFIG_I2C_DEBUG_CHIP is not set | 919 | # CONFIG_I2C_DEBUG_CHIP is not set |
907 | # CONFIG_SPI is not set | 920 | # CONFIG_SPI is not set |
921 | |||
922 | # | ||
923 | # PPS support | ||
924 | # | ||
925 | # CONFIG_PPS is not set | ||
908 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | 926 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y |
909 | # CONFIG_GPIOLIB is not set | 927 | # CONFIG_GPIOLIB is not set |
910 | # CONFIG_W1 is not set | 928 | # CONFIG_W1 is not set |
@@ -959,6 +977,7 @@ CONFIG_HWMON=y | |||
959 | # CONFIG_SENSORS_SMSC47B397 is not set | 977 | # CONFIG_SENSORS_SMSC47B397 is not set |
960 | # CONFIG_SENSORS_ADS7828 is not set | 978 | # CONFIG_SENSORS_ADS7828 is not set |
961 | # CONFIG_SENSORS_THMC50 is not set | 979 | # CONFIG_SENSORS_THMC50 is not set |
980 | # CONFIG_SENSORS_TMP401 is not set | ||
962 | # CONFIG_SENSORS_VIA686A is not set | 981 | # CONFIG_SENSORS_VIA686A is not set |
963 | # CONFIG_SENSORS_VT1211 is not set | 982 | # CONFIG_SENSORS_VT1211 is not set |
964 | # CONFIG_SENSORS_VT8231 is not set | 983 | # CONFIG_SENSORS_VT8231 is not set |
@@ -994,23 +1013,9 @@ CONFIG_SSB_POSSIBLE=y | |||
994 | # CONFIG_MFD_WM8400 is not set | 1013 | # CONFIG_MFD_WM8400 is not set |
995 | # CONFIG_MFD_WM8350_I2C is not set | 1014 | # CONFIG_MFD_WM8350_I2C is not set |
996 | # CONFIG_MFD_PCF50633 is not set | 1015 | # CONFIG_MFD_PCF50633 is not set |
1016 | # CONFIG_AB3100_CORE is not set | ||
997 | # CONFIG_REGULATOR is not set | 1017 | # CONFIG_REGULATOR is not set |
998 | 1018 | # CONFIG_MEDIA_SUPPORT is not set | |
999 | # | ||
1000 | # Multimedia devices | ||
1001 | # | ||
1002 | |||
1003 | # | ||
1004 | # Multimedia core support | ||
1005 | # | ||
1006 | # CONFIG_VIDEO_DEV is not set | ||
1007 | # CONFIG_DVB_CORE is not set | ||
1008 | # CONFIG_VIDEO_MEDIA is not set | ||
1009 | |||
1010 | # | ||
1011 | # Multimedia drivers | ||
1012 | # | ||
1013 | # CONFIG_DAB is not set | ||
1014 | 1019 | ||
1015 | # | 1020 | # |
1016 | # Graphics support | 1021 | # Graphics support |
@@ -1284,7 +1289,6 @@ CONFIG_USB=y | |||
1284 | # | 1289 | # |
1285 | # Miscellaneous USB options | 1290 | # Miscellaneous USB options |
1286 | # | 1291 | # |
1287 | CONFIG_USB_DEVICEFS=y | ||
1288 | # CONFIG_USB_DEVICE_CLASS is not set | 1292 | # CONFIG_USB_DEVICE_CLASS is not set |
1289 | # CONFIG_USB_DYNAMIC_MINORS is not set | 1293 | # CONFIG_USB_DYNAMIC_MINORS is not set |
1290 | # CONFIG_USB_OTG is not set | 1294 | # CONFIG_USB_OTG is not set |
@@ -1296,6 +1300,7 @@ CONFIG_USB_DEVICEFS=y | |||
1296 | # USB Host Controller Drivers | 1300 | # USB Host Controller Drivers |
1297 | # | 1301 | # |
1298 | # CONFIG_USB_C67X00_HCD is not set | 1302 | # CONFIG_USB_C67X00_HCD is not set |
1303 | # CONFIG_USB_XHCI_HCD is not set | ||
1299 | CONFIG_USB_EHCI_HCD=m | 1304 | CONFIG_USB_EHCI_HCD=m |
1300 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set | 1305 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set |
1301 | # CONFIG_USB_EHCI_TT_NEWSCHED is not set | 1306 | # CONFIG_USB_EHCI_TT_NEWSCHED is not set |
@@ -1374,7 +1379,6 @@ CONFIG_USB_STORAGE=m | |||
1374 | # CONFIG_USB_LD is not set | 1379 | # CONFIG_USB_LD is not set |
1375 | # CONFIG_USB_TRANCEVIBRATOR is not set | 1380 | # CONFIG_USB_TRANCEVIBRATOR is not set |
1376 | # CONFIG_USB_IOWARRIOR is not set | 1381 | # CONFIG_USB_IOWARRIOR is not set |
1377 | # CONFIG_USB_TEST is not set | ||
1378 | # CONFIG_USB_ISIGHTFW is not set | 1382 | # CONFIG_USB_ISIGHTFW is not set |
1379 | # CONFIG_USB_VST is not set | 1383 | # CONFIG_USB_VST is not set |
1380 | # CONFIG_USB_GADGET is not set | 1384 | # CONFIG_USB_GADGET is not set |
@@ -1420,6 +1424,7 @@ CONFIG_RTC_INTF_DEV=y | |||
1420 | # CONFIG_RTC_DRV_S35390A is not set | 1424 | # CONFIG_RTC_DRV_S35390A is not set |
1421 | # CONFIG_RTC_DRV_FM3130 is not set | 1425 | # CONFIG_RTC_DRV_FM3130 is not set |
1422 | # CONFIG_RTC_DRV_RX8581 is not set | 1426 | # CONFIG_RTC_DRV_RX8581 is not set |
1427 | # CONFIG_RTC_DRV_RX8025 is not set | ||
1423 | 1428 | ||
1424 | # | 1429 | # |
1425 | # SPI RTC drivers | 1430 | # SPI RTC drivers |
@@ -1448,6 +1453,10 @@ CONFIG_RTC_DRV_STARFIRE=y | |||
1448 | # CONFIG_DMADEVICES is not set | 1453 | # CONFIG_DMADEVICES is not set |
1449 | # CONFIG_AUXDISPLAY is not set | 1454 | # CONFIG_AUXDISPLAY is not set |
1450 | # CONFIG_UIO is not set | 1455 | # CONFIG_UIO is not set |
1456 | |||
1457 | # | ||
1458 | # TI VLYNQ | ||
1459 | # | ||
1451 | # CONFIG_STAGING is not set | 1460 | # CONFIG_STAGING is not set |
1452 | 1461 | ||
1453 | # | 1462 | # |
@@ -1480,11 +1489,11 @@ CONFIG_FS_MBCACHE=y | |||
1480 | # CONFIG_REISERFS_FS is not set | 1489 | # CONFIG_REISERFS_FS is not set |
1481 | # CONFIG_JFS_FS is not set | 1490 | # CONFIG_JFS_FS is not set |
1482 | CONFIG_FS_POSIX_ACL=y | 1491 | CONFIG_FS_POSIX_ACL=y |
1483 | CONFIG_FILE_LOCKING=y | ||
1484 | # CONFIG_XFS_FS is not set | 1492 | # CONFIG_XFS_FS is not set |
1485 | # CONFIG_GFS2_FS is not set | 1493 | # CONFIG_GFS2_FS is not set |
1486 | # CONFIG_OCFS2_FS is not set | 1494 | # CONFIG_OCFS2_FS is not set |
1487 | # CONFIG_BTRFS_FS is not set | 1495 | # CONFIG_BTRFS_FS is not set |
1496 | CONFIG_FILE_LOCKING=y | ||
1488 | CONFIG_FSNOTIFY=y | 1497 | CONFIG_FSNOTIFY=y |
1489 | CONFIG_DNOTIFY=y | 1498 | CONFIG_DNOTIFY=y |
1490 | CONFIG_INOTIFY=y | 1499 | CONFIG_INOTIFY=y |
@@ -1560,7 +1569,7 @@ CONFIG_NETWORK_FILESYSTEMS=y | |||
1560 | # CONFIG_PARTITION_ADVANCED is not set | 1569 | # CONFIG_PARTITION_ADVANCED is not set |
1561 | CONFIG_MSDOS_PARTITION=y | 1570 | CONFIG_MSDOS_PARTITION=y |
1562 | CONFIG_SUN_PARTITION=y | 1571 | CONFIG_SUN_PARTITION=y |
1563 | CONFIG_NLS=m | 1572 | CONFIG_NLS=y |
1564 | CONFIG_NLS_DEFAULT="iso8859-1" | 1573 | CONFIG_NLS_DEFAULT="iso8859-1" |
1565 | # CONFIG_NLS_CODEPAGE_437 is not set | 1574 | # CONFIG_NLS_CODEPAGE_437 is not set |
1566 | # CONFIG_NLS_CODEPAGE_737 is not set | 1575 | # CONFIG_NLS_CODEPAGE_737 is not set |
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index b049abf9902f..0ff92fa22064 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h | |||
@@ -726,11 +726,17 @@ extern unsigned long pte_file(pte_t); | |||
726 | extern pte_t pgoff_to_pte(unsigned long); | 726 | extern pte_t pgoff_to_pte(unsigned long); |
727 | #define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) | 727 | #define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) |
728 | 728 | ||
729 | extern unsigned long *sparc64_valid_addr_bitmap; | 729 | extern unsigned long sparc64_valid_addr_bitmap[]; |
730 | 730 | ||
731 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ | 731 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ |
732 | #define kern_addr_valid(addr) \ | 732 | static inline bool kern_addr_valid(unsigned long addr) |
733 | (test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap)) | 733 | { |
734 | unsigned long paddr = __pa(addr); | ||
735 | |||
736 | if ((paddr >> 41UL) != 0UL) | ||
737 | return false; | ||
738 | return test_bit(paddr >> 22, sparc64_valid_addr_bitmap); | ||
739 | } | ||
734 | 740 | ||
735 | extern int page_in_phys_avail(unsigned long paddr); | 741 | extern int page_in_phys_avail(unsigned long paddr); |
736 | 742 | ||
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c index f0ee79055409..8daab33fc17d 100644 --- a/arch/sparc/kernel/irq_64.c +++ b/arch/sparc/kernel/irq_64.c | |||
@@ -886,7 +886,7 @@ void notrace init_irqwork_curcpu(void) | |||
886 | * Therefore you cannot make any OBP calls, not even prom_printf, | 886 | * Therefore you cannot make any OBP calls, not even prom_printf, |
887 | * from these two routines. | 887 | * from these two routines. |
888 | */ | 888 | */ |
889 | static void __cpuinit register_one_mondo(unsigned long paddr, unsigned long type, unsigned long qmask) | 889 | static void __cpuinit notrace register_one_mondo(unsigned long paddr, unsigned long type, unsigned long qmask) |
890 | { | 890 | { |
891 | unsigned long num_entries = (qmask + 1) / 64; | 891 | unsigned long num_entries = (qmask + 1) / 64; |
892 | unsigned long status; | 892 | unsigned long status; |
diff --git a/arch/sparc/kernel/ktlb.S b/arch/sparc/kernel/ktlb.S index cef8defcd7a9..3ea6e8cde8c5 100644 --- a/arch/sparc/kernel/ktlb.S +++ b/arch/sparc/kernel/ktlb.S | |||
@@ -151,12 +151,46 @@ kvmap_dtlb_4v: | |||
151 | * Must preserve %g1 and %g6 (TAG). | 151 | * Must preserve %g1 and %g6 (TAG). |
152 | */ | 152 | */ |
153 | kvmap_dtlb_tsb4m_miss: | 153 | kvmap_dtlb_tsb4m_miss: |
154 | sethi %hi(kpte_linear_bitmap), %g2 | 154 | /* Clear the PAGE_OFFSET top virtual bits, shift |
155 | or %g2, %lo(kpte_linear_bitmap), %g2 | 155 | * down to get PFN, and make sure PFN is in range. |
156 | */ | ||
157 | sllx %g4, 21, %g5 | ||
156 | 158 | ||
157 | /* Clear the PAGE_OFFSET top virtual bits, then shift | 159 | /* Check to see if we know about valid memory at the 4MB |
158 | * down to get a 256MB physical address index. | 160 | * chunk this physical address will reside within. |
159 | */ | 161 | */ |
162 | srlx %g5, 21 + 41, %g2 | ||
163 | brnz,pn %g2, kvmap_dtlb_longpath | ||
164 | nop | ||
165 | |||
166 | /* This unconditional branch and delay-slot nop gets patched | ||
167 | * by the sethi sequence once the bitmap is properly setup. | ||
168 | */ | ||
169 | .globl valid_addr_bitmap_insn | ||
170 | valid_addr_bitmap_insn: | ||
171 | ba,pt %xcc, 2f | ||
172 | nop | ||
173 | .subsection 2 | ||
174 | .globl valid_addr_bitmap_patch | ||
175 | valid_addr_bitmap_patch: | ||
176 | sethi %hi(sparc64_valid_addr_bitmap), %g7 | ||
177 | or %g7, %lo(sparc64_valid_addr_bitmap), %g7 | ||
178 | .previous | ||
179 | |||
180 | srlx %g5, 21 + 22, %g2 | ||
181 | srlx %g2, 6, %g5 | ||
182 | and %g2, 63, %g2 | ||
183 | sllx %g5, 3, %g5 | ||
184 | ldx [%g7 + %g5], %g5 | ||
185 | mov 1, %g7 | ||
186 | sllx %g7, %g2, %g7 | ||
187 | andcc %g5, %g7, %g0 | ||
188 | be,pn %xcc, kvmap_dtlb_longpath | ||
189 | |||
190 | 2: sethi %hi(kpte_linear_bitmap), %g2 | ||
191 | or %g2, %lo(kpte_linear_bitmap), %g2 | ||
192 | |||
193 | /* Get the 256MB physical address index. */ | ||
160 | sllx %g4, 21, %g5 | 194 | sllx %g4, 21, %g5 |
161 | mov 1, %g7 | 195 | mov 1, %g7 |
162 | srlx %g5, 21 + 28, %g5 | 196 | srlx %g5, 21 + 28, %g5 |
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c index 2c0cc72d295b..b75bf502cd42 100644 --- a/arch/sparc/kernel/nmi.c +++ b/arch/sparc/kernel/nmi.c | |||
@@ -103,7 +103,7 @@ notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs) | |||
103 | } | 103 | } |
104 | if (!touched && __get_cpu_var(last_irq_sum) == sum) { | 104 | if (!touched && __get_cpu_var(last_irq_sum) == sum) { |
105 | local_inc(&__get_cpu_var(alert_counter)); | 105 | local_inc(&__get_cpu_var(alert_counter)); |
106 | if (local_read(&__get_cpu_var(alert_counter)) == 5 * nmi_hz) | 106 | if (local_read(&__get_cpu_var(alert_counter)) == 30 * nmi_hz) |
107 | die_nmi("BUG: NMI Watchdog detected LOCKUP", | 107 | die_nmi("BUG: NMI Watchdog detected LOCKUP", |
108 | regs, panic_on_timeout); | 108 | regs, panic_on_timeout); |
109 | } else { | 109 | } else { |
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index fa44eaf8d897..3691907a43b4 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c | |||
@@ -1499,7 +1499,7 @@ void __init setup_per_cpu_areas(void) | |||
1499 | dyn_size = pcpur_size - static_size - PERCPU_MODULE_RESERVE; | 1499 | dyn_size = pcpur_size - static_size - PERCPU_MODULE_RESERVE; |
1500 | 1500 | ||
1501 | 1501 | ||
1502 | ptrs_size = PFN_ALIGN(num_possible_cpus() * sizeof(pcpur_ptrs[0])); | 1502 | ptrs_size = PFN_ALIGN(nr_cpu_ids * sizeof(pcpur_ptrs[0])); |
1503 | pcpur_ptrs = alloc_bootmem(ptrs_size); | 1503 | pcpur_ptrs = alloc_bootmem(ptrs_size); |
1504 | 1504 | ||
1505 | for_each_possible_cpu(cpu) { | 1505 | for_each_possible_cpu(cpu) { |
@@ -1514,7 +1514,7 @@ void __init setup_per_cpu_areas(void) | |||
1514 | 1514 | ||
1515 | /* allocate address and map */ | 1515 | /* allocate address and map */ |
1516 | vm.flags = VM_ALLOC; | 1516 | vm.flags = VM_ALLOC; |
1517 | vm.size = num_possible_cpus() * PCPU_CHUNK_SIZE; | 1517 | vm.size = nr_cpu_ids * PCPU_CHUNK_SIZE; |
1518 | vm_area_register_early(&vm, PCPU_CHUNK_SIZE); | 1518 | vm_area_register_early(&vm, PCPU_CHUNK_SIZE); |
1519 | 1519 | ||
1520 | for_each_possible_cpu(cpu) { | 1520 | for_each_possible_cpu(cpu) { |
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index 54fb02468f0d..68791cad7b74 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c | |||
@@ -162,9 +162,6 @@ extern void cpu_panic(void); | |||
162 | */ | 162 | */ |
163 | 163 | ||
164 | extern struct linux_prom_registers smp_penguin_ctable; | 164 | extern struct linux_prom_registers smp_penguin_ctable; |
165 | extern unsigned long trapbase_cpu1[]; | ||
166 | extern unsigned long trapbase_cpu2[]; | ||
167 | extern unsigned long trapbase_cpu3[]; | ||
168 | 165 | ||
169 | void __init smp4d_boot_cpus(void) | 166 | void __init smp4d_boot_cpus(void) |
170 | { | 167 | { |
@@ -235,25 +232,6 @@ void __init smp4d_smp_done(void) | |||
235 | *prev = first; | 232 | *prev = first; |
236 | local_flush_cache_all(); | 233 | local_flush_cache_all(); |
237 | 234 | ||
238 | /* Free unneeded trap tables */ | ||
239 | ClearPageReserved(virt_to_page(trapbase_cpu1)); | ||
240 | init_page_count(virt_to_page(trapbase_cpu1)); | ||
241 | free_page((unsigned long)trapbase_cpu1); | ||
242 | totalram_pages++; | ||
243 | num_physpages++; | ||
244 | |||
245 | ClearPageReserved(virt_to_page(trapbase_cpu2)); | ||
246 | init_page_count(virt_to_page(trapbase_cpu2)); | ||
247 | free_page((unsigned long)trapbase_cpu2); | ||
248 | totalram_pages++; | ||
249 | num_physpages++; | ||
250 | |||
251 | ClearPageReserved(virt_to_page(trapbase_cpu3)); | ||
252 | init_page_count(virt_to_page(trapbase_cpu3)); | ||
253 | free_page((unsigned long)trapbase_cpu3); | ||
254 | totalram_pages++; | ||
255 | num_physpages++; | ||
256 | |||
257 | /* Ok, they are spinning and ready to go. */ | 235 | /* Ok, they are spinning and ready to go. */ |
258 | smp_processors_ready = 1; | 236 | smp_processors_ready = 1; |
259 | sun4d_distribute_irqs(); | 237 | sun4d_distribute_irqs(); |
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c index 960b113d0006..762d6eedd944 100644 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c | |||
@@ -121,9 +121,6 @@ void __cpuinit smp4m_callin(void) | |||
121 | */ | 121 | */ |
122 | 122 | ||
123 | extern struct linux_prom_registers smp_penguin_ctable; | 123 | extern struct linux_prom_registers smp_penguin_ctable; |
124 | extern unsigned long trapbase_cpu1[]; | ||
125 | extern unsigned long trapbase_cpu2[]; | ||
126 | extern unsigned long trapbase_cpu3[]; | ||
127 | 124 | ||
128 | void __init smp4m_boot_cpus(void) | 125 | void __init smp4m_boot_cpus(void) |
129 | { | 126 | { |
@@ -193,29 +190,6 @@ void __init smp4m_smp_done(void) | |||
193 | *prev = first; | 190 | *prev = first; |
194 | local_flush_cache_all(); | 191 | local_flush_cache_all(); |
195 | 192 | ||
196 | /* Free unneeded trap tables */ | ||
197 | if (!cpu_isset(1, cpu_present_map)) { | ||
198 | ClearPageReserved(virt_to_page(trapbase_cpu1)); | ||
199 | init_page_count(virt_to_page(trapbase_cpu1)); | ||
200 | free_page((unsigned long)trapbase_cpu1); | ||
201 | totalram_pages++; | ||
202 | num_physpages++; | ||
203 | } | ||
204 | if (!cpu_isset(2, cpu_present_map)) { | ||
205 | ClearPageReserved(virt_to_page(trapbase_cpu2)); | ||
206 | init_page_count(virt_to_page(trapbase_cpu2)); | ||
207 | free_page((unsigned long)trapbase_cpu2); | ||
208 | totalram_pages++; | ||
209 | num_physpages++; | ||
210 | } | ||
211 | if (!cpu_isset(3, cpu_present_map)) { | ||
212 | ClearPageReserved(virt_to_page(trapbase_cpu3)); | ||
213 | init_page_count(virt_to_page(trapbase_cpu3)); | ||
214 | free_page((unsigned long)trapbase_cpu3); | ||
215 | totalram_pages++; | ||
216 | num_physpages++; | ||
217 | } | ||
218 | |||
219 | /* Ok, they are spinning and ready to go. */ | 193 | /* Ok, they are spinning and ready to go. */ |
220 | } | 194 | } |
221 | 195 | ||
diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S index f061c4dda9ef..aed94869ad6a 100644 --- a/arch/sparc/kernel/sys32.S +++ b/arch/sparc/kernel/sys32.S | |||
@@ -134,10 +134,12 @@ SIGN1(sys32_getpeername, sys_getpeername, %o0) | |||
134 | SIGN1(sys32_getsockname, sys_getsockname, %o0) | 134 | SIGN1(sys32_getsockname, sys_getsockname, %o0) |
135 | SIGN2(sys32_ioprio_get, sys_ioprio_get, %o0, %o1) | 135 | SIGN2(sys32_ioprio_get, sys_ioprio_get, %o0, %o1) |
136 | SIGN3(sys32_ioprio_set, sys_ioprio_set, %o0, %o1, %o2) | 136 | SIGN3(sys32_ioprio_set, sys_ioprio_set, %o0, %o1, %o2) |
137 | SIGN2(sys32_splice, sys_splice, %o0, %o1) | 137 | SIGN2(sys32_splice, sys_splice, %o0, %o2) |
138 | SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5) | 138 | SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5) |
139 | SIGN2(sys32_tee, sys_tee, %o0, %o1) | 139 | SIGN2(sys32_tee, sys_tee, %o0, %o1) |
140 | SIGN1(sys32_vmsplice, compat_sys_vmsplice, %o0) | 140 | SIGN1(sys32_vmsplice, compat_sys_vmsplice, %o0) |
141 | SIGN1(sys32_truncate, sys_truncate, %o1) | ||
142 | SIGN1(sys32_ftruncate, sys_ftruncate, %o1) | ||
141 | 143 | ||
142 | .globl sys32_mmap2 | 144 | .globl sys32_mmap2 |
143 | sys32_mmap2: | 145 | sys32_mmap2: |
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index 6b3ee88e253c..2ee7250ba7ae 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S | |||
@@ -43,8 +43,8 @@ sys_call_table32: | |||
43 | /*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall | 43 | /*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall |
44 | .word sys32_getgroups, compat_sys_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd | 44 | .word sys32_getgroups, compat_sys_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd |
45 | /*120*/ .word compat_sys_readv, compat_sys_writev, compat_sys_settimeofday, sys_fchown16, sys_fchmod | 45 | /*120*/ .word compat_sys_readv, compat_sys_writev, compat_sys_settimeofday, sys_fchown16, sys_fchmod |
46 | .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, sys_truncate | 46 | .word sys_nis_syscall, sys_setreuid16, sys_setregid16, sys_rename, sys32_truncate |
47 | /*130*/ .word sys_ftruncate, sys_flock, compat_sys_lstat64, sys_nis_syscall, sys_nis_syscall | 47 | /*130*/ .word sys32_ftruncate, sys_flock, compat_sys_lstat64, sys_nis_syscall, sys_nis_syscall |
48 | .word sys_nis_syscall, sys32_mkdir, sys_rmdir, compat_sys_utimes, compat_sys_stat64 | 48 | .word sys_nis_syscall, sys32_mkdir, sys_rmdir, compat_sys_utimes, compat_sys_stat64 |
49 | /*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit | 49 | /*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit |
50 | .word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys_pciconfig_read, sys_pciconfig_write | 50 | .word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys_pciconfig_read, sys_pciconfig_write |
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c index a5e30c642ee3..b99f81c4906f 100644 --- a/arch/sparc/mm/fault_32.c +++ b/arch/sparc/mm/fault_32.c | |||
@@ -319,9 +319,10 @@ no_context: | |||
319 | */ | 319 | */ |
320 | out_of_memory: | 320 | out_of_memory: |
321 | up_read(&mm->mmap_sem); | 321 | up_read(&mm->mmap_sem); |
322 | printk("VM: killing process %s\n", tsk->comm); | 322 | if (from_user) { |
323 | if (from_user) | 323 | pagefault_out_of_memory(); |
324 | do_group_exit(SIGKILL); | 324 | return; |
325 | } | ||
325 | goto no_context; | 326 | goto no_context; |
326 | 327 | ||
327 | do_sigbus: | 328 | do_sigbus: |
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c index e5620b27c8bf..43b0da96a4fb 100644 --- a/arch/sparc/mm/fault_64.c +++ b/arch/sparc/mm/fault_64.c | |||
@@ -447,9 +447,10 @@ handle_kernel_fault: | |||
447 | out_of_memory: | 447 | out_of_memory: |
448 | insn = get_fault_insn(regs, insn); | 448 | insn = get_fault_insn(regs, insn); |
449 | up_read(&mm->mmap_sem); | 449 | up_read(&mm->mmap_sem); |
450 | printk("VM: killing process %s\n", current->comm); | 450 | if (!(regs->tstate & TSTATE_PRIV)) { |
451 | if (!(regs->tstate & TSTATE_PRIV)) | 451 | pagefault_out_of_memory(); |
452 | do_group_exit(SIGKILL); | 452 | return; |
453 | } | ||
453 | goto handle_kernel_fault; | 454 | goto handle_kernel_fault; |
454 | 455 | ||
455 | intr_or_no_mm: | 456 | intr_or_no_mm: |
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index ed6be6ba2f4e..a70a5e1904d9 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -145,7 +145,8 @@ static void __init read_obp_memory(const char *property, | |||
145 | cmp_p64, NULL); | 145 | cmp_p64, NULL); |
146 | } | 146 | } |
147 | 147 | ||
148 | unsigned long *sparc64_valid_addr_bitmap __read_mostly; | 148 | unsigned long sparc64_valid_addr_bitmap[VALID_ADDR_BITMAP_BYTES / |
149 | sizeof(unsigned long)]; | ||
149 | EXPORT_SYMBOL(sparc64_valid_addr_bitmap); | 150 | EXPORT_SYMBOL(sparc64_valid_addr_bitmap); |
150 | 151 | ||
151 | /* Kernel physical address base and size in bytes. */ | 152 | /* Kernel physical address base and size in bytes. */ |
@@ -1874,7 +1875,7 @@ static int pavail_rescan_ents __initdata; | |||
1874 | * memory list again, and make sure it provides at least as much | 1875 | * memory list again, and make sure it provides at least as much |
1875 | * memory as 'pavail' does. | 1876 | * memory as 'pavail' does. |
1876 | */ | 1877 | */ |
1877 | static void __init setup_valid_addr_bitmap_from_pavail(void) | 1878 | static void __init setup_valid_addr_bitmap_from_pavail(unsigned long *bitmap) |
1878 | { | 1879 | { |
1879 | int i; | 1880 | int i; |
1880 | 1881 | ||
@@ -1897,8 +1898,7 @@ static void __init setup_valid_addr_bitmap_from_pavail(void) | |||
1897 | 1898 | ||
1898 | if (new_start <= old_start && | 1899 | if (new_start <= old_start && |
1899 | new_end >= (old_start + PAGE_SIZE)) { | 1900 | new_end >= (old_start + PAGE_SIZE)) { |
1900 | set_bit(old_start >> 22, | 1901 | set_bit(old_start >> 22, bitmap); |
1901 | sparc64_valid_addr_bitmap); | ||
1902 | goto do_next_page; | 1902 | goto do_next_page; |
1903 | } | 1903 | } |
1904 | } | 1904 | } |
@@ -1919,20 +1919,21 @@ static void __init setup_valid_addr_bitmap_from_pavail(void) | |||
1919 | } | 1919 | } |
1920 | } | 1920 | } |
1921 | 1921 | ||
1922 | static void __init patch_tlb_miss_handler_bitmap(void) | ||
1923 | { | ||
1924 | extern unsigned int valid_addr_bitmap_insn[]; | ||
1925 | extern unsigned int valid_addr_bitmap_patch[]; | ||
1926 | |||
1927 | valid_addr_bitmap_insn[1] = valid_addr_bitmap_patch[1]; | ||
1928 | mb(); | ||
1929 | valid_addr_bitmap_insn[0] = valid_addr_bitmap_patch[0]; | ||
1930 | flushi(&valid_addr_bitmap_insn[0]); | ||
1931 | } | ||
1932 | |||
1922 | void __init mem_init(void) | 1933 | void __init mem_init(void) |
1923 | { | 1934 | { |
1924 | unsigned long codepages, datapages, initpages; | 1935 | unsigned long codepages, datapages, initpages; |
1925 | unsigned long addr, last; | 1936 | unsigned long addr, last; |
1926 | int i; | ||
1927 | |||
1928 | i = last_valid_pfn >> ((22 - PAGE_SHIFT) + 6); | ||
1929 | i += 1; | ||
1930 | sparc64_valid_addr_bitmap = (unsigned long *) alloc_bootmem(i << 3); | ||
1931 | if (sparc64_valid_addr_bitmap == NULL) { | ||
1932 | prom_printf("mem_init: Cannot alloc valid_addr_bitmap.\n"); | ||
1933 | prom_halt(); | ||
1934 | } | ||
1935 | memset(sparc64_valid_addr_bitmap, 0, i << 3); | ||
1936 | 1937 | ||
1937 | addr = PAGE_OFFSET + kern_base; | 1938 | addr = PAGE_OFFSET + kern_base; |
1938 | last = PAGE_ALIGN(kern_size) + addr; | 1939 | last = PAGE_ALIGN(kern_size) + addr; |
@@ -1941,15 +1942,19 @@ void __init mem_init(void) | |||
1941 | addr += PAGE_SIZE; | 1942 | addr += PAGE_SIZE; |
1942 | } | 1943 | } |
1943 | 1944 | ||
1944 | setup_valid_addr_bitmap_from_pavail(); | 1945 | setup_valid_addr_bitmap_from_pavail(sparc64_valid_addr_bitmap); |
1946 | patch_tlb_miss_handler_bitmap(); | ||
1945 | 1947 | ||
1946 | high_memory = __va(last_valid_pfn << PAGE_SHIFT); | 1948 | high_memory = __va(last_valid_pfn << PAGE_SHIFT); |
1947 | 1949 | ||
1948 | #ifdef CONFIG_NEED_MULTIPLE_NODES | 1950 | #ifdef CONFIG_NEED_MULTIPLE_NODES |
1949 | for_each_online_node(i) { | 1951 | { |
1950 | if (NODE_DATA(i)->node_spanned_pages != 0) { | 1952 | int i; |
1951 | totalram_pages += | 1953 | for_each_online_node(i) { |
1952 | free_all_bootmem_node(NODE_DATA(i)); | 1954 | if (NODE_DATA(i)->node_spanned_pages != 0) { |
1955 | totalram_pages += | ||
1956 | free_all_bootmem_node(NODE_DATA(i)); | ||
1957 | } | ||
1953 | } | 1958 | } |
1954 | } | 1959 | } |
1955 | #else | 1960 | #else |
diff --git a/arch/sparc/mm/init_64.h b/arch/sparc/mm/init_64.h index 16063870a489..c2f772dbd556 100644 --- a/arch/sparc/mm/init_64.h +++ b/arch/sparc/mm/init_64.h | |||
@@ -5,10 +5,13 @@ | |||
5 | * marked non-static so that assembler code can get at them. | 5 | * marked non-static so that assembler code can get at them. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #define MAX_PHYS_ADDRESS (1UL << 42UL) | 8 | #define MAX_PHYS_ADDRESS (1UL << 41UL) |
9 | #define KPTE_BITMAP_CHUNK_SZ (256UL * 1024UL * 1024UL) | 9 | #define KPTE_BITMAP_CHUNK_SZ (256UL * 1024UL * 1024UL) |
10 | #define KPTE_BITMAP_BYTES \ | 10 | #define KPTE_BITMAP_BYTES \ |
11 | ((MAX_PHYS_ADDRESS / KPTE_BITMAP_CHUNK_SZ) / 8) | 11 | ((MAX_PHYS_ADDRESS / KPTE_BITMAP_CHUNK_SZ) / 8) |
12 | #define VALID_ADDR_BITMAP_CHUNK_SZ (4UL * 1024UL * 1024UL) | ||
13 | #define VALID_ADDR_BITMAP_BYTES \ | ||
14 | ((MAX_PHYS_ADDRESS / VALID_ADDR_BITMAP_CHUNK_SZ) / 8) | ||
12 | 15 | ||
13 | extern unsigned long kern_linear_pte_xor[2]; | 16 | extern unsigned long kern_linear_pte_xor[2]; |
14 | extern unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)]; | 17 | extern unsigned long kpte_linear_bitmap[KPTE_BITMAP_BYTES / sizeof(unsigned long)]; |
diff --git a/arch/sparc/prom/misc_64.c b/arch/sparc/prom/misc_64.c index eedffb4fec2d..39fc6af21b7c 100644 --- a/arch/sparc/prom/misc_64.c +++ b/arch/sparc/prom/misc_64.c | |||
@@ -88,7 +88,7 @@ void prom_cmdline(void) | |||
88 | /* Drop into the prom, but completely terminate the program. | 88 | /* Drop into the prom, but completely terminate the program. |
89 | * No chance of continuing. | 89 | * No chance of continuing. |
90 | */ | 90 | */ |
91 | void prom_halt(void) | 91 | void notrace prom_halt(void) |
92 | { | 92 | { |
93 | #ifdef CONFIG_SUN_LDOMS | 93 | #ifdef CONFIG_SUN_LDOMS |
94 | if (ldom_domaining_enabled) | 94 | if (ldom_domaining_enabled) |
diff --git a/arch/sparc/prom/printf.c b/arch/sparc/prom/printf.c index 660943ee4c2a..ca869266b9f3 100644 --- a/arch/sparc/prom/printf.c +++ b/arch/sparc/prom/printf.c | |||
@@ -14,14 +14,14 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/compiler.h> | ||
17 | 18 | ||
18 | #include <asm/openprom.h> | 19 | #include <asm/openprom.h> |
19 | #include <asm/oplib.h> | 20 | #include <asm/oplib.h> |
20 | 21 | ||
21 | static char ppbuf[1024]; | 22 | static char ppbuf[1024]; |
22 | 23 | ||
23 | void | 24 | void notrace prom_write(const char *buf, unsigned int n) |
24 | prom_write(const char *buf, unsigned int n) | ||
25 | { | 25 | { |
26 | char ch; | 26 | char ch; |
27 | 27 | ||
@@ -33,8 +33,7 @@ prom_write(const char *buf, unsigned int n) | |||
33 | } | 33 | } |
34 | } | 34 | } |
35 | 35 | ||
36 | void | 36 | void notrace prom_printf(const char *fmt, ...) |
37 | prom_printf(const char *fmt, ...) | ||
38 | { | 37 | { |
39 | va_list args; | 38 | va_list args; |
40 | int i; | 39 | int i; |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index d59cbf758f34..071c6b0e760c 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -24,6 +24,7 @@ config X86 | |||
24 | select HAVE_UNSTABLE_SCHED_CLOCK | 24 | select HAVE_UNSTABLE_SCHED_CLOCK |
25 | select HAVE_IDE | 25 | select HAVE_IDE |
26 | select HAVE_OPROFILE | 26 | select HAVE_OPROFILE |
27 | select HAVE_PERF_COUNTERS if (!M386 && !M486) | ||
27 | select HAVE_IOREMAP_PROT | 28 | select HAVE_IOREMAP_PROT |
28 | select HAVE_KPROBES | 29 | select HAVE_KPROBES |
29 | select ARCH_WANT_OPTIONAL_GPIOLIB | 30 | select ARCH_WANT_OPTIONAL_GPIOLIB |
@@ -742,7 +743,6 @@ config X86_UP_IOAPIC | |||
742 | config X86_LOCAL_APIC | 743 | config X86_LOCAL_APIC |
743 | def_bool y | 744 | def_bool y |
744 | depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC | 745 | depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC |
745 | select HAVE_PERF_COUNTERS if (!M386 && !M486) | ||
746 | 746 | ||
747 | config X86_IO_APIC | 747 | config X86_IO_APIC |
748 | def_bool y | 748 | def_bool y |
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index e2ff504b4ddc..f8ed0658404c 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | # create a compressed vmlinux image from the original vmlinux | 4 | # create a compressed vmlinux image from the original vmlinux |
5 | # | 5 | # |
6 | 6 | ||
7 | targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o | 7 | targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o |
8 | 8 | ||
9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 | 9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 |
10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC | 10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC |
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h index 71136545187a..db24c2278be0 100644 --- a/arch/x86/include/asm/ftrace.h +++ b/arch/x86/include/asm/ftrace.h | |||
@@ -28,13 +28,6 @@ | |||
28 | 28 | ||
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | /* FIXME: I don't want to stay hardcoded */ | ||
32 | #ifdef CONFIG_X86_64 | ||
33 | # define FTRACE_SYSCALL_MAX 299 | ||
34 | #else | ||
35 | # define FTRACE_SYSCALL_MAX 337 | ||
36 | #endif | ||
37 | |||
38 | #ifdef CONFIG_FUNCTION_TRACER | 31 | #ifdef CONFIG_FUNCTION_TRACER |
39 | #define MCOUNT_ADDR ((long)(mcount)) | 32 | #define MCOUNT_ADDR ((long)(mcount)) |
40 | #define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */ | 33 | #define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */ |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 3cc06e3fceb8..16748077559a 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _ASM_X86_PGTABLE_H | 2 | #define _ASM_X86_PGTABLE_H |
3 | 3 | ||
4 | #include <asm/page.h> | 4 | #include <asm/page.h> |
5 | #include <asm/e820.h> | ||
5 | 6 | ||
6 | #include <asm/pgtable_types.h> | 7 | #include <asm/pgtable_types.h> |
7 | 8 | ||
@@ -269,10 +270,17 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot) | |||
269 | 270 | ||
270 | #define canon_pgprot(p) __pgprot(massage_pgprot(p)) | 271 | #define canon_pgprot(p) __pgprot(massage_pgprot(p)) |
271 | 272 | ||
272 | static inline int is_new_memtype_allowed(unsigned long flags, | 273 | static inline int is_new_memtype_allowed(u64 paddr, unsigned long size, |
273 | unsigned long new_flags) | 274 | unsigned long flags, |
275 | unsigned long new_flags) | ||
274 | { | 276 | { |
275 | /* | 277 | /* |
278 | * PAT type is always WB for ISA. So no need to check. | ||
279 | */ | ||
280 | if (is_ISA_range(paddr, paddr + size - 1)) | ||
281 | return 1; | ||
282 | |||
283 | /* | ||
276 | * Certain new memtypes are not allowed with certain | 284 | * Certain new memtypes are not allowed with certain |
277 | * requested memtype: | 285 | * requested memtype: |
278 | * - request is uncached, return cannot be write-back | 286 | * - request is uncached, return cannot be write-back |
diff --git a/arch/x86/include/asm/unistd_32.h b/arch/x86/include/asm/unistd_32.h index 732a30706153..8deaada61bc8 100644 --- a/arch/x86/include/asm/unistd_32.h +++ b/arch/x86/include/asm/unistd_32.h | |||
@@ -345,6 +345,8 @@ | |||
345 | 345 | ||
346 | #ifdef __KERNEL__ | 346 | #ifdef __KERNEL__ |
347 | 347 | ||
348 | #define NR_syscalls 337 | ||
349 | |||
348 | #define __ARCH_WANT_IPC_PARSE_VERSION | 350 | #define __ARCH_WANT_IPC_PARSE_VERSION |
349 | #define __ARCH_WANT_OLD_READDIR | 351 | #define __ARCH_WANT_OLD_READDIR |
350 | #define __ARCH_WANT_OLD_STAT | 352 | #define __ARCH_WANT_OLD_STAT |
diff --git a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h index 900e1617e672..b9f3c60de5f7 100644 --- a/arch/x86/include/asm/unistd_64.h +++ b/arch/x86/include/asm/unistd_64.h | |||
@@ -688,6 +688,12 @@ __SYSCALL(__NR_perf_counter_open, sys_perf_counter_open) | |||
688 | #endif /* __NO_STUBS */ | 688 | #endif /* __NO_STUBS */ |
689 | 689 | ||
690 | #ifdef __KERNEL__ | 690 | #ifdef __KERNEL__ |
691 | |||
692 | #ifndef COMPILE_OFFSETS | ||
693 | #include <asm/asm-offsets.h> | ||
694 | #define NR_syscalls (__NR_syscall_max + 1) | ||
695 | #endif | ||
696 | |||
691 | /* | 697 | /* |
692 | * "Conditional" syscalls | 698 | * "Conditional" syscalls |
693 | * | 699 | * |
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h index bddd44f2f0ab..80e2984f521c 100644 --- a/arch/x86/include/asm/uv/uv_bau.h +++ b/arch/x86/include/asm/uv/uv_bau.h | |||
@@ -133,7 +133,7 @@ struct bau_msg_payload { | |||
133 | * see table 4.2.3.0.1 in broacast_assist spec. | 133 | * see table 4.2.3.0.1 in broacast_assist spec. |
134 | */ | 134 | */ |
135 | struct bau_msg_header { | 135 | struct bau_msg_header { |
136 | unsigned int dest_subnodeid:6; /* must be zero */ | 136 | unsigned int dest_subnodeid:6; /* must be 0x10, for the LB */ |
137 | /* bits 5:0 */ | 137 | /* bits 5:0 */ |
138 | unsigned int base_dest_nodeid:15; /* nasid>>1 (pnode) of */ | 138 | unsigned int base_dest_nodeid:15; /* nasid>>1 (pnode) of */ |
139 | /* bits 20:6 */ /* first bit in node_map */ | 139 | /* bits 20:6 */ /* first bit in node_map */ |
diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c index dbf5445727a9..6ef00ba4c886 100644 --- a/arch/x86/kernel/apic/ipi.c +++ b/arch/x86/kernel/apic/ipi.c | |||
@@ -106,6 +106,9 @@ void default_send_IPI_mask_logical(const struct cpumask *cpumask, int vector) | |||
106 | unsigned long mask = cpumask_bits(cpumask)[0]; | 106 | unsigned long mask = cpumask_bits(cpumask)[0]; |
107 | unsigned long flags; | 107 | unsigned long flags; |
108 | 108 | ||
109 | if (WARN_ONCE(!mask, "empty IPI mask")) | ||
110 | return; | ||
111 | |||
109 | local_irq_save(flags); | 112 | local_irq_save(flags); |
110 | WARN_ON(mask & ~cpumask_bits(cpu_online_mask)[0]); | 113 | WARN_ON(mask & ~cpumask_bits(cpu_online_mask)[0]); |
111 | __default_send_IPI_dest_field(mask, vector, apic->dest_logical); | 114 | __default_send_IPI_dest_field(mask, vector, apic->dest_logical); |
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c index bc3e880f9b82..fcec2f1d34a1 100644 --- a/arch/x86/kernel/apic/probe_64.c +++ b/arch/x86/kernel/apic/probe_64.c | |||
@@ -44,6 +44,11 @@ static struct apic *apic_probe[] __initdata = { | |||
44 | NULL, | 44 | NULL, |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static int apicid_phys_pkg_id(int initial_apic_id, int index_msb) | ||
48 | { | ||
49 | return hard_smp_processor_id() >> index_msb; | ||
50 | } | ||
51 | |||
47 | /* | 52 | /* |
48 | * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode. | 53 | * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode. |
49 | */ | 54 | */ |
@@ -69,6 +74,11 @@ void __init default_setup_apic_routing(void) | |||
69 | printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); | 74 | printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); |
70 | } | 75 | } |
71 | 76 | ||
77 | if (is_vsmp_box()) { | ||
78 | /* need to update phys_pkg_id */ | ||
79 | apic->phys_pkg_id = apicid_phys_pkg_id; | ||
80 | } | ||
81 | |||
72 | /* | 82 | /* |
73 | * Now that apic routing model is selected, configure the | 83 | * Now that apic routing model is selected, configure the |
74 | * fault handling for intr remapping. | 84 | * fault handling for intr remapping. |
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 832e908adcb5..601159374e87 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -46,7 +46,7 @@ static int early_get_nodeid(void) | |||
46 | return node_id.s.node_id; | 46 | return node_id.s.node_id; |
47 | } | 47 | } |
48 | 48 | ||
49 | static int uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | 49 | static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
50 | { | 50 | { |
51 | if (!strcmp(oem_id, "SGI")) { | 51 | if (!strcmp(oem_id, "SGI")) { |
52 | if (!strcmp(oem_table_id, "UVL")) | 52 | if (!strcmp(oem_table_id, "UVL")) |
@@ -253,7 +253,7 @@ static void uv_send_IPI_self(int vector) | |||
253 | apic_write(APIC_SELF_IPI, vector); | 253 | apic_write(APIC_SELF_IPI, vector); |
254 | } | 254 | } |
255 | 255 | ||
256 | struct apic apic_x2apic_uv_x = { | 256 | struct apic __refdata apic_x2apic_uv_x = { |
257 | 257 | ||
258 | .name = "UV large system", | 258 | .name = "UV large system", |
259 | .probe = NULL, | 259 | .probe = NULL, |
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c index 898ecc47e129..4a6aeedcd965 100644 --- a/arch/x86/kernel/asm-offsets_64.c +++ b/arch/x86/kernel/asm-offsets_64.c | |||
@@ -3,6 +3,7 @@ | |||
3 | * This code generates raw asm output which is post-processed to extract | 3 | * This code generates raw asm output which is post-processed to extract |
4 | * and format the required data. | 4 | * and format the required data. |
5 | */ | 5 | */ |
6 | #define COMPILE_OFFSETS | ||
6 | 7 | ||
7 | #include <linux/crypto.h> | 8 | #include <linux/crypto.h> |
8 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index 3efcb2b96a15..c1f253dac155 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile | |||
@@ -7,6 +7,10 @@ ifdef CONFIG_FUNCTION_TRACER | |||
7 | CFLAGS_REMOVE_common.o = -pg | 7 | CFLAGS_REMOVE_common.o = -pg |
8 | endif | 8 | endif |
9 | 9 | ||
10 | # Make sure load_percpu_segment has no stackprotector | ||
11 | nostackp := $(call cc-option, -fno-stack-protector) | ||
12 | CFLAGS_common.o := $(nostackp) | ||
13 | |||
10 | obj-y := intel_cacheinfo.o addon_cpuid_features.o | 14 | obj-y := intel_cacheinfo.o addon_cpuid_features.o |
11 | obj-y += proc.o capflags.o powerflags.o common.o | 15 | obj-y += proc.o capflags.o powerflags.o common.o |
12 | obj-y += vmware.o hypervisor.o | 16 | obj-y += vmware.o hypervisor.o |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index e2485b03f1cf..63fddcd082cd 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -400,6 +400,13 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) | |||
400 | level = cpuid_eax(1); | 400 | level = cpuid_eax(1); |
401 | if((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58) | 401 | if((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58) |
402 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); | 402 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); |
403 | |||
404 | /* | ||
405 | * Some BIOSes incorrectly force this feature, but only K8 | ||
406 | * revision D (model = 0x14) and later actually support it. | ||
407 | */ | ||
408 | if (c->x86_model < 0x14) | ||
409 | clear_cpu_cap(c, X86_FEATURE_LAHF_LM); | ||
403 | } | 410 | } |
404 | if (c->x86 == 0x10 || c->x86 == 0x11) | 411 | if (c->x86 == 0x10 || c->x86 == 0x11) |
405 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); | 412 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index f1961c07af9a..5ce60a88027b 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -59,7 +59,30 @@ void __init setup_cpu_local_masks(void) | |||
59 | alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask); | 59 | alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask); |
60 | } | 60 | } |
61 | 61 | ||
62 | static const struct cpu_dev *this_cpu __cpuinitdata; | 62 | static void __cpuinit default_init(struct cpuinfo_x86 *c) |
63 | { | ||
64 | #ifdef CONFIG_X86_64 | ||
65 | display_cacheinfo(c); | ||
66 | #else | ||
67 | /* Not much we can do here... */ | ||
68 | /* Check if at least it has cpuid */ | ||
69 | if (c->cpuid_level == -1) { | ||
70 | /* No cpuid. It must be an ancient CPU */ | ||
71 | if (c->x86 == 4) | ||
72 | strcpy(c->x86_model_id, "486"); | ||
73 | else if (c->x86 == 3) | ||
74 | strcpy(c->x86_model_id, "386"); | ||
75 | } | ||
76 | #endif | ||
77 | } | ||
78 | |||
79 | static const struct cpu_dev __cpuinitconst default_cpu = { | ||
80 | .c_init = default_init, | ||
81 | .c_vendor = "Unknown", | ||
82 | .c_x86_vendor = X86_VENDOR_UNKNOWN, | ||
83 | }; | ||
84 | |||
85 | static const struct cpu_dev *this_cpu __cpuinitdata = &default_cpu; | ||
63 | 86 | ||
64 | DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { | 87 | DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { |
65 | #ifdef CONFIG_X86_64 | 88 | #ifdef CONFIG_X86_64 |
@@ -332,29 +355,6 @@ void switch_to_new_gdt(int cpu) | |||
332 | 355 | ||
333 | static const struct cpu_dev *__cpuinitdata cpu_devs[X86_VENDOR_NUM] = {}; | 356 | static const struct cpu_dev *__cpuinitdata cpu_devs[X86_VENDOR_NUM] = {}; |
334 | 357 | ||
335 | static void __cpuinit default_init(struct cpuinfo_x86 *c) | ||
336 | { | ||
337 | #ifdef CONFIG_X86_64 | ||
338 | display_cacheinfo(c); | ||
339 | #else | ||
340 | /* Not much we can do here... */ | ||
341 | /* Check if at least it has cpuid */ | ||
342 | if (c->cpuid_level == -1) { | ||
343 | /* No cpuid. It must be an ancient CPU */ | ||
344 | if (c->x86 == 4) | ||
345 | strcpy(c->x86_model_id, "486"); | ||
346 | else if (c->x86 == 3) | ||
347 | strcpy(c->x86_model_id, "386"); | ||
348 | } | ||
349 | #endif | ||
350 | } | ||
351 | |||
352 | static const struct cpu_dev __cpuinitconst default_cpu = { | ||
353 | .c_init = default_init, | ||
354 | .c_vendor = "Unknown", | ||
355 | .c_x86_vendor = X86_VENDOR_UNKNOWN, | ||
356 | }; | ||
357 | |||
358 | static void __cpuinit get_model_name(struct cpuinfo_x86 *c) | 358 | static void __cpuinit get_model_name(struct cpuinfo_x86 *c) |
359 | { | 359 | { |
360 | unsigned int *v; | 360 | unsigned int *v; |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 1cfb623ce11c..01213048f62f 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -1226,8 +1226,13 @@ static void mce_init(void) | |||
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | /* Add per CPU specific workarounds here */ | 1228 | /* Add per CPU specific workarounds here */ |
1229 | static void mce_cpu_quirks(struct cpuinfo_x86 *c) | 1229 | static int mce_cpu_quirks(struct cpuinfo_x86 *c) |
1230 | { | 1230 | { |
1231 | if (c->x86_vendor == X86_VENDOR_UNKNOWN) { | ||
1232 | pr_info("MCE: unknown CPU type - not enabling MCE support.\n"); | ||
1233 | return -EOPNOTSUPP; | ||
1234 | } | ||
1235 | |||
1231 | /* This should be disabled by the BIOS, but isn't always */ | 1236 | /* This should be disabled by the BIOS, but isn't always */ |
1232 | if (c->x86_vendor == X86_VENDOR_AMD) { | 1237 | if (c->x86_vendor == X86_VENDOR_AMD) { |
1233 | if (c->x86 == 15 && banks > 4) { | 1238 | if (c->x86 == 15 && banks > 4) { |
@@ -1273,11 +1278,20 @@ static void mce_cpu_quirks(struct cpuinfo_x86 *c) | |||
1273 | if ((c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xe)) && | 1278 | if ((c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xe)) && |
1274 | monarch_timeout < 0) | 1279 | monarch_timeout < 0) |
1275 | monarch_timeout = USEC_PER_SEC; | 1280 | monarch_timeout = USEC_PER_SEC; |
1281 | |||
1282 | /* | ||
1283 | * There are also broken BIOSes on some Pentium M and | ||
1284 | * earlier systems: | ||
1285 | */ | ||
1286 | if (c->x86 == 6 && c->x86_model <= 13 && mce_bootlog < 0) | ||
1287 | mce_bootlog = 0; | ||
1276 | } | 1288 | } |
1277 | if (monarch_timeout < 0) | 1289 | if (monarch_timeout < 0) |
1278 | monarch_timeout = 0; | 1290 | monarch_timeout = 0; |
1279 | if (mce_bootlog != 0) | 1291 | if (mce_bootlog != 0) |
1280 | mce_panic_timeout = 30; | 1292 | mce_panic_timeout = 30; |
1293 | |||
1294 | return 0; | ||
1281 | } | 1295 | } |
1282 | 1296 | ||
1283 | static void __cpuinit mce_ancient_init(struct cpuinfo_x86 *c) | 1297 | static void __cpuinit mce_ancient_init(struct cpuinfo_x86 *c) |
@@ -1338,11 +1352,10 @@ void __cpuinit mcheck_init(struct cpuinfo_x86 *c) | |||
1338 | if (!mce_available(c)) | 1352 | if (!mce_available(c)) |
1339 | return; | 1353 | return; |
1340 | 1354 | ||
1341 | if (mce_cap_init() < 0) { | 1355 | if (mce_cap_init() < 0 || mce_cpu_quirks(c) < 0) { |
1342 | mce_disabled = 1; | 1356 | mce_disabled = 1; |
1343 | return; | 1357 | return; |
1344 | } | 1358 | } |
1345 | mce_cpu_quirks(c); | ||
1346 | 1359 | ||
1347 | machine_check_vector = do_machine_check; | 1360 | machine_check_vector = do_machine_check; |
1348 | 1361 | ||
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index bff8dd191dd5..5957a93e5173 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | static DEFINE_PER_CPU(__u64, next_check) = INITIAL_JIFFIES; | 37 | static DEFINE_PER_CPU(__u64, next_check) = INITIAL_JIFFIES; |
38 | static DEFINE_PER_CPU(unsigned long, thermal_throttle_count); | 38 | static DEFINE_PER_CPU(unsigned long, thermal_throttle_count); |
39 | static DEFINE_PER_CPU(bool, thermal_throttle_active); | ||
39 | 40 | ||
40 | static atomic_t therm_throt_en = ATOMIC_INIT(0); | 41 | static atomic_t therm_throt_en = ATOMIC_INIT(0); |
41 | 42 | ||
@@ -96,27 +97,33 @@ static int therm_throt_process(int curr) | |||
96 | { | 97 | { |
97 | unsigned int cpu = smp_processor_id(); | 98 | unsigned int cpu = smp_processor_id(); |
98 | __u64 tmp_jiffs = get_jiffies_64(); | 99 | __u64 tmp_jiffs = get_jiffies_64(); |
100 | bool was_throttled = __get_cpu_var(thermal_throttle_active); | ||
101 | bool is_throttled = __get_cpu_var(thermal_throttle_active) = curr; | ||
99 | 102 | ||
100 | if (curr) | 103 | if (is_throttled) |
101 | __get_cpu_var(thermal_throttle_count)++; | 104 | __get_cpu_var(thermal_throttle_count)++; |
102 | 105 | ||
103 | if (time_before64(tmp_jiffs, __get_cpu_var(next_check))) | 106 | if (!(was_throttled ^ is_throttled) && |
107 | time_before64(tmp_jiffs, __get_cpu_var(next_check))) | ||
104 | return 0; | 108 | return 0; |
105 | 109 | ||
106 | __get_cpu_var(next_check) = tmp_jiffs + CHECK_INTERVAL; | 110 | __get_cpu_var(next_check) = tmp_jiffs + CHECK_INTERVAL; |
107 | 111 | ||
108 | /* if we just entered the thermal event */ | 112 | /* if we just entered the thermal event */ |
109 | if (curr) { | 113 | if (is_throttled) { |
110 | printk(KERN_CRIT "CPU%d: Temperature above threshold, " | 114 | printk(KERN_CRIT "CPU%d: Temperature above threshold, " |
111 | "cpu clock throttled (total events = %lu)\n", cpu, | 115 | "cpu clock throttled (total events = %lu)\n", |
112 | __get_cpu_var(thermal_throttle_count)); | 116 | cpu, __get_cpu_var(thermal_throttle_count)); |
113 | 117 | ||
114 | add_taint(TAINT_MACHINE_CHECK); | 118 | add_taint(TAINT_MACHINE_CHECK); |
115 | } else { | 119 | return 1; |
116 | printk(KERN_CRIT "CPU%d: Temperature/speed normal\n", cpu); | 120 | } |
121 | if (was_throttled) { | ||
122 | printk(KERN_INFO "CPU%d: Temperature/speed normal\n", cpu); | ||
123 | return 1; | ||
117 | } | 124 | } |
118 | 125 | ||
119 | return 1; | 126 | return 0; |
120 | } | 127 | } |
121 | 128 | ||
122 | #ifdef CONFIG_SYSFS | 129 | #ifdef CONFIG_SYSFS |
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c index a7aa8f900954..900332b800f8 100644 --- a/arch/x86/kernel/cpu/perf_counter.c +++ b/arch/x86/kernel/cpu/perf_counter.c | |||
@@ -55,6 +55,7 @@ struct x86_pmu { | |||
55 | int num_counters_fixed; | 55 | int num_counters_fixed; |
56 | int counter_bits; | 56 | int counter_bits; |
57 | u64 counter_mask; | 57 | u64 counter_mask; |
58 | int apic; | ||
58 | u64 max_period; | 59 | u64 max_period; |
59 | u64 intel_ctrl; | 60 | u64 intel_ctrl; |
60 | }; | 61 | }; |
@@ -72,8 +73,8 @@ static const u64 p6_perfmon_event_map[] = | |||
72 | { | 73 | { |
73 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0079, | 74 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0079, |
74 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | 75 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
75 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0000, | 76 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0f2e, |
76 | [PERF_COUNT_HW_CACHE_MISSES] = 0x0000, | 77 | [PERF_COUNT_HW_CACHE_MISSES] = 0x012e, |
77 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c4, | 78 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c4, |
78 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c5, | 79 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c5, |
79 | [PERF_COUNT_HW_BUS_CYCLES] = 0x0062, | 80 | [PERF_COUNT_HW_BUS_CYCLES] = 0x0062, |
@@ -613,6 +614,7 @@ static DEFINE_MUTEX(pmc_reserve_mutex); | |||
613 | 614 | ||
614 | static bool reserve_pmc_hardware(void) | 615 | static bool reserve_pmc_hardware(void) |
615 | { | 616 | { |
617 | #ifdef CONFIG_X86_LOCAL_APIC | ||
616 | int i; | 618 | int i; |
617 | 619 | ||
618 | if (nmi_watchdog == NMI_LOCAL_APIC) | 620 | if (nmi_watchdog == NMI_LOCAL_APIC) |
@@ -627,9 +629,11 @@ static bool reserve_pmc_hardware(void) | |||
627 | if (!reserve_evntsel_nmi(x86_pmu.eventsel + i)) | 629 | if (!reserve_evntsel_nmi(x86_pmu.eventsel + i)) |
628 | goto eventsel_fail; | 630 | goto eventsel_fail; |
629 | } | 631 | } |
632 | #endif | ||
630 | 633 | ||
631 | return true; | 634 | return true; |
632 | 635 | ||
636 | #ifdef CONFIG_X86_LOCAL_APIC | ||
633 | eventsel_fail: | 637 | eventsel_fail: |
634 | for (i--; i >= 0; i--) | 638 | for (i--; i >= 0; i--) |
635 | release_evntsel_nmi(x86_pmu.eventsel + i); | 639 | release_evntsel_nmi(x86_pmu.eventsel + i); |
@@ -644,10 +648,12 @@ perfctr_fail: | |||
644 | enable_lapic_nmi_watchdog(); | 648 | enable_lapic_nmi_watchdog(); |
645 | 649 | ||
646 | return false; | 650 | return false; |
651 | #endif | ||
647 | } | 652 | } |
648 | 653 | ||
649 | static void release_pmc_hardware(void) | 654 | static void release_pmc_hardware(void) |
650 | { | 655 | { |
656 | #ifdef CONFIG_X86_LOCAL_APIC | ||
651 | int i; | 657 | int i; |
652 | 658 | ||
653 | for (i = 0; i < x86_pmu.num_counters; i++) { | 659 | for (i = 0; i < x86_pmu.num_counters; i++) { |
@@ -657,6 +663,7 @@ static void release_pmc_hardware(void) | |||
657 | 663 | ||
658 | if (nmi_watchdog == NMI_LOCAL_APIC) | 664 | if (nmi_watchdog == NMI_LOCAL_APIC) |
659 | enable_lapic_nmi_watchdog(); | 665 | enable_lapic_nmi_watchdog(); |
666 | #endif | ||
660 | } | 667 | } |
661 | 668 | ||
662 | static void hw_perf_counter_destroy(struct perf_counter *counter) | 669 | static void hw_perf_counter_destroy(struct perf_counter *counter) |
@@ -748,6 +755,15 @@ static int __hw_perf_counter_init(struct perf_counter *counter) | |||
748 | hwc->sample_period = x86_pmu.max_period; | 755 | hwc->sample_period = x86_pmu.max_period; |
749 | hwc->last_period = hwc->sample_period; | 756 | hwc->last_period = hwc->sample_period; |
750 | atomic64_set(&hwc->period_left, hwc->sample_period); | 757 | atomic64_set(&hwc->period_left, hwc->sample_period); |
758 | } else { | ||
759 | /* | ||
760 | * If we have a PMU initialized but no APIC | ||
761 | * interrupts, we cannot sample hardware | ||
762 | * counters (user-space has to fall back and | ||
763 | * sample via a hrtimer based software counter): | ||
764 | */ | ||
765 | if (!x86_pmu.apic) | ||
766 | return -EOPNOTSUPP; | ||
751 | } | 767 | } |
752 | 768 | ||
753 | counter->destroy = hw_perf_counter_destroy; | 769 | counter->destroy = hw_perf_counter_destroy; |
@@ -1449,18 +1465,22 @@ void smp_perf_pending_interrupt(struct pt_regs *regs) | |||
1449 | 1465 | ||
1450 | void set_perf_counter_pending(void) | 1466 | void set_perf_counter_pending(void) |
1451 | { | 1467 | { |
1468 | #ifdef CONFIG_X86_LOCAL_APIC | ||
1452 | apic->send_IPI_self(LOCAL_PENDING_VECTOR); | 1469 | apic->send_IPI_self(LOCAL_PENDING_VECTOR); |
1470 | #endif | ||
1453 | } | 1471 | } |
1454 | 1472 | ||
1455 | void perf_counters_lapic_init(void) | 1473 | void perf_counters_lapic_init(void) |
1456 | { | 1474 | { |
1457 | if (!x86_pmu_initialized()) | 1475 | #ifdef CONFIG_X86_LOCAL_APIC |
1476 | if (!x86_pmu.apic || !x86_pmu_initialized()) | ||
1458 | return; | 1477 | return; |
1459 | 1478 | ||
1460 | /* | 1479 | /* |
1461 | * Always use NMI for PMU | 1480 | * Always use NMI for PMU |
1462 | */ | 1481 | */ |
1463 | apic_write(APIC_LVTPC, APIC_DM_NMI); | 1482 | apic_write(APIC_LVTPC, APIC_DM_NMI); |
1483 | #endif | ||
1464 | } | 1484 | } |
1465 | 1485 | ||
1466 | static int __kprobes | 1486 | static int __kprobes |
@@ -1484,7 +1504,9 @@ perf_counter_nmi_handler(struct notifier_block *self, | |||
1484 | 1504 | ||
1485 | regs = args->regs; | 1505 | regs = args->regs; |
1486 | 1506 | ||
1507 | #ifdef CONFIG_X86_LOCAL_APIC | ||
1487 | apic_write(APIC_LVTPC, APIC_DM_NMI); | 1508 | apic_write(APIC_LVTPC, APIC_DM_NMI); |
1509 | #endif | ||
1488 | /* | 1510 | /* |
1489 | * Can't rely on the handled return value to say it was our NMI, two | 1511 | * Can't rely on the handled return value to say it was our NMI, two |
1490 | * counters could trigger 'simultaneously' raising two back-to-back NMIs. | 1512 | * counters could trigger 'simultaneously' raising two back-to-back NMIs. |
@@ -1515,6 +1537,7 @@ static struct x86_pmu p6_pmu = { | |||
1515 | .event_map = p6_pmu_event_map, | 1537 | .event_map = p6_pmu_event_map, |
1516 | .raw_event = p6_pmu_raw_event, | 1538 | .raw_event = p6_pmu_raw_event, |
1517 | .max_events = ARRAY_SIZE(p6_perfmon_event_map), | 1539 | .max_events = ARRAY_SIZE(p6_perfmon_event_map), |
1540 | .apic = 1, | ||
1518 | .max_period = (1ULL << 31) - 1, | 1541 | .max_period = (1ULL << 31) - 1, |
1519 | .version = 0, | 1542 | .version = 0, |
1520 | .num_counters = 2, | 1543 | .num_counters = 2, |
@@ -1541,6 +1564,7 @@ static struct x86_pmu intel_pmu = { | |||
1541 | .event_map = intel_pmu_event_map, | 1564 | .event_map = intel_pmu_event_map, |
1542 | .raw_event = intel_pmu_raw_event, | 1565 | .raw_event = intel_pmu_raw_event, |
1543 | .max_events = ARRAY_SIZE(intel_perfmon_event_map), | 1566 | .max_events = ARRAY_SIZE(intel_perfmon_event_map), |
1567 | .apic = 1, | ||
1544 | /* | 1568 | /* |
1545 | * Intel PMCs cannot be accessed sanely above 32 bit width, | 1569 | * Intel PMCs cannot be accessed sanely above 32 bit width, |
1546 | * so we install an artificial 1<<31 period regardless of | 1570 | * so we install an artificial 1<<31 period regardless of |
@@ -1564,6 +1588,7 @@ static struct x86_pmu amd_pmu = { | |||
1564 | .num_counters = 4, | 1588 | .num_counters = 4, |
1565 | .counter_bits = 48, | 1589 | .counter_bits = 48, |
1566 | .counter_mask = (1ULL << 48) - 1, | 1590 | .counter_mask = (1ULL << 48) - 1, |
1591 | .apic = 1, | ||
1567 | /* use highest bit to detect overflow */ | 1592 | /* use highest bit to detect overflow */ |
1568 | .max_period = (1ULL << 47) - 1, | 1593 | .max_period = (1ULL << 47) - 1, |
1569 | }; | 1594 | }; |
@@ -1589,13 +1614,14 @@ static int p6_pmu_init(void) | |||
1589 | return -ENODEV; | 1614 | return -ENODEV; |
1590 | } | 1615 | } |
1591 | 1616 | ||
1617 | x86_pmu = p6_pmu; | ||
1618 | |||
1592 | if (!cpu_has_apic) { | 1619 | if (!cpu_has_apic) { |
1593 | pr_info("no Local APIC, try rebooting with lapic"); | 1620 | pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n"); |
1594 | return -ENODEV; | 1621 | pr_info("no hardware sampling interrupt available.\n"); |
1622 | x86_pmu.apic = 0; | ||
1595 | } | 1623 | } |
1596 | 1624 | ||
1597 | x86_pmu = p6_pmu; | ||
1598 | |||
1599 | return 0; | 1625 | return 0; |
1600 | } | 1626 | } |
1601 | 1627 | ||
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 3cff1214e176..9dbb527e1652 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -494,7 +494,7 @@ static struct syscall_metadata *find_syscall_meta(unsigned long *syscall) | |||
494 | 494 | ||
495 | struct syscall_metadata *syscall_nr_to_meta(int nr) | 495 | struct syscall_metadata *syscall_nr_to_meta(int nr) |
496 | { | 496 | { |
497 | if (!syscalls_metadata || nr >= FTRACE_SYSCALL_MAX || nr < 0) | 497 | if (!syscalls_metadata || nr >= NR_syscalls || nr < 0) |
498 | return NULL; | 498 | return NULL; |
499 | 499 | ||
500 | return syscalls_metadata[nr]; | 500 | return syscalls_metadata[nr]; |
@@ -507,7 +507,7 @@ int syscall_name_to_nr(char *name) | |||
507 | if (!syscalls_metadata) | 507 | if (!syscalls_metadata) |
508 | return -1; | 508 | return -1; |
509 | 509 | ||
510 | for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { | 510 | for (i = 0; i < NR_syscalls; i++) { |
511 | if (syscalls_metadata[i]) { | 511 | if (syscalls_metadata[i]) { |
512 | if (!strcmp(syscalls_metadata[i]->name, name)) | 512 | if (!strcmp(syscalls_metadata[i]->name, name)) |
513 | return i; | 513 | return i; |
@@ -533,13 +533,13 @@ static int __init arch_init_ftrace_syscalls(void) | |||
533 | unsigned long **psys_syscall_table = &sys_call_table; | 533 | unsigned long **psys_syscall_table = &sys_call_table; |
534 | 534 | ||
535 | syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * | 535 | syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * |
536 | FTRACE_SYSCALL_MAX, GFP_KERNEL); | 536 | NR_syscalls, GFP_KERNEL); |
537 | if (!syscalls_metadata) { | 537 | if (!syscalls_metadata) { |
538 | WARN_ON(1); | 538 | WARN_ON(1); |
539 | return -ENOMEM; | 539 | return -ENOMEM; |
540 | } | 540 | } |
541 | 541 | ||
542 | for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { | 542 | for (i = 0; i < NR_syscalls; i++) { |
543 | meta = find_syscall_meta(psys_syscall_table[i]); | 543 | meta = find_syscall_meta(psys_syscall_table[i]); |
544 | syscalls_metadata[i] = meta; | 544 | syscalls_metadata[i] = meta; |
545 | } | 545 | } |
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index 0d98a01cbdb2..cc827ac9e8d3 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -261,9 +261,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20); | |||
261 | * which will be freed later | 261 | * which will be freed later |
262 | */ | 262 | */ |
263 | 263 | ||
264 | #ifndef CONFIG_HOTPLUG_CPU | 264 | __CPUINIT |
265 | .section .init.text,"ax",@progbits | ||
266 | #endif | ||
267 | 265 | ||
268 | #ifdef CONFIG_SMP | 266 | #ifdef CONFIG_SMP |
269 | ENTRY(startup_32_smp) | 267 | ENTRY(startup_32_smp) |
@@ -602,11 +600,7 @@ ignore_int: | |||
602 | #endif | 600 | #endif |
603 | iret | 601 | iret |
604 | 602 | ||
605 | #ifndef CONFIG_HOTPLUG_CPU | ||
606 | __CPUINITDATA | ||
607 | #else | ||
608 | __REFDATA | 603 | __REFDATA |
609 | #endif | ||
610 | .align 4 | 604 | .align 4 |
611 | ENTRY(initial_code) | 605 | ENTRY(initial_code) |
612 | .long i386_start_kernel | 606 | .long i386_start_kernel |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 994dd6a4a2a0..071166a4ba83 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -519,16 +519,12 @@ static void c1e_idle(void) | |||
519 | if (!cpumask_test_cpu(cpu, c1e_mask)) { | 519 | if (!cpumask_test_cpu(cpu, c1e_mask)) { |
520 | cpumask_set_cpu(cpu, c1e_mask); | 520 | cpumask_set_cpu(cpu, c1e_mask); |
521 | /* | 521 | /* |
522 | * Force broadcast so ACPI can not interfere. Needs | 522 | * Force broadcast so ACPI can not interfere. |
523 | * to run with interrupts enabled as it uses | ||
524 | * smp_function_call. | ||
525 | */ | 523 | */ |
526 | local_irq_enable(); | ||
527 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE, | 524 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE, |
528 | &cpu); | 525 | &cpu); |
529 | printk(KERN_INFO "Switch to broadcast mode on CPU%d\n", | 526 | printk(KERN_INFO "Switch to broadcast mode on CPU%d\n", |
530 | cpu); | 527 | cpu); |
531 | local_irq_disable(); | ||
532 | } | 528 | } |
533 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); | 529 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); |
534 | 530 | ||
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 9eb897603705..a06e8d101844 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -418,20 +418,20 @@ static int __init set_pci_reboot(const struct dmi_system_id *d) | |||
418 | } | 418 | } |
419 | 419 | ||
420 | static struct dmi_system_id __initdata pci_reboot_dmi_table[] = { | 420 | static struct dmi_system_id __initdata pci_reboot_dmi_table[] = { |
421 | { /* Handle problems with rebooting on Apple MacBook5,2 */ | 421 | { /* Handle problems with rebooting on Apple MacBook5 */ |
422 | .callback = set_pci_reboot, | 422 | .callback = set_pci_reboot, |
423 | .ident = "Apple MacBook", | 423 | .ident = "Apple MacBook5", |
424 | .matches = { | 424 | .matches = { |
425 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | 425 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), |
426 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5,2"), | 426 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5"), |
427 | }, | 427 | }, |
428 | }, | 428 | }, |
429 | { /* Handle problems with rebooting on Apple MacBookPro5,1 */ | 429 | { /* Handle problems with rebooting on Apple MacBookPro5 */ |
430 | .callback = set_pci_reboot, | 430 | .callback = set_pci_reboot, |
431 | .ident = "Apple MacBookPro5,1", | 431 | .ident = "Apple MacBookPro5", |
432 | .matches = { | 432 | .matches = { |
433 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | 433 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), |
434 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5,1"), | 434 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5"), |
435 | }, | 435 | }, |
436 | }, | 436 | }, |
437 | { } | 437 | { } |
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index 29a3eef7cf4a..07d81916f212 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c | |||
@@ -165,7 +165,7 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | |||
165 | 165 | ||
166 | if (!chosen) { | 166 | if (!chosen) { |
167 | size_t vm_size = VMALLOC_END - VMALLOC_START; | 167 | size_t vm_size = VMALLOC_END - VMALLOC_START; |
168 | size_t tot_size = num_possible_cpus() * PMD_SIZE; | 168 | size_t tot_size = nr_cpu_ids * PMD_SIZE; |
169 | 169 | ||
170 | /* on non-NUMA, embedding is better */ | 170 | /* on non-NUMA, embedding is better */ |
171 | if (!pcpu_need_numa()) | 171 | if (!pcpu_need_numa()) |
@@ -199,7 +199,7 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | |||
199 | dyn_size = pcpul_size - static_size - PERCPU_FIRST_CHUNK_RESERVE; | 199 | dyn_size = pcpul_size - static_size - PERCPU_FIRST_CHUNK_RESERVE; |
200 | 200 | ||
201 | /* allocate pointer array and alloc large pages */ | 201 | /* allocate pointer array and alloc large pages */ |
202 | map_size = PFN_ALIGN(num_possible_cpus() * sizeof(pcpul_map[0])); | 202 | map_size = PFN_ALIGN(nr_cpu_ids * sizeof(pcpul_map[0])); |
203 | pcpul_map = alloc_bootmem(map_size); | 203 | pcpul_map = alloc_bootmem(map_size); |
204 | 204 | ||
205 | for_each_possible_cpu(cpu) { | 205 | for_each_possible_cpu(cpu) { |
@@ -228,7 +228,7 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | |||
228 | 228 | ||
229 | /* allocate address and map */ | 229 | /* allocate address and map */ |
230 | pcpul_vm.flags = VM_ALLOC; | 230 | pcpul_vm.flags = VM_ALLOC; |
231 | pcpul_vm.size = num_possible_cpus() * PMD_SIZE; | 231 | pcpul_vm.size = nr_cpu_ids * PMD_SIZE; |
232 | vm_area_register_early(&pcpul_vm, PMD_SIZE); | 232 | vm_area_register_early(&pcpul_vm, PMD_SIZE); |
233 | 233 | ||
234 | for_each_possible_cpu(cpu) { | 234 | for_each_possible_cpu(cpu) { |
@@ -250,8 +250,8 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen) | |||
250 | PMD_SIZE, pcpul_vm.addr, NULL); | 250 | PMD_SIZE, pcpul_vm.addr, NULL); |
251 | 251 | ||
252 | /* sort pcpul_map array for pcpu_lpage_remapped() */ | 252 | /* sort pcpul_map array for pcpu_lpage_remapped() */ |
253 | for (i = 0; i < num_possible_cpus() - 1; i++) | 253 | for (i = 0; i < nr_cpu_ids - 1; i++) |
254 | for (j = i + 1; j < num_possible_cpus(); j++) | 254 | for (j = i + 1; j < nr_cpu_ids; j++) |
255 | if (pcpul_map[i].ptr > pcpul_map[j].ptr) { | 255 | if (pcpul_map[i].ptr > pcpul_map[j].ptr) { |
256 | struct pcpul_ent tmp = pcpul_map[i]; | 256 | struct pcpul_ent tmp = pcpul_map[i]; |
257 | pcpul_map[i] = pcpul_map[j]; | 257 | pcpul_map[i] = pcpul_map[j]; |
@@ -288,7 +288,7 @@ void *pcpu_lpage_remapped(void *kaddr) | |||
288 | { | 288 | { |
289 | void *pmd_addr = (void *)((unsigned long)kaddr & PMD_MASK); | 289 | void *pmd_addr = (void *)((unsigned long)kaddr & PMD_MASK); |
290 | unsigned long offset = (unsigned long)kaddr & ~PMD_MASK; | 290 | unsigned long offset = (unsigned long)kaddr & ~PMD_MASK; |
291 | int left = 0, right = num_possible_cpus() - 1; | 291 | int left = 0, right = nr_cpu_ids - 1; |
292 | int pos; | 292 | int pos; |
293 | 293 | ||
294 | /* pcpul in use at all? */ | 294 | /* pcpul in use at all? */ |
@@ -377,7 +377,7 @@ static ssize_t __init setup_pcpu_4k(size_t static_size) | |||
377 | pcpu4k_nr_static_pages = PFN_UP(static_size); | 377 | pcpu4k_nr_static_pages = PFN_UP(static_size); |
378 | 378 | ||
379 | /* unaligned allocations can't be freed, round up to page size */ | 379 | /* unaligned allocations can't be freed, round up to page size */ |
380 | pages_size = PFN_ALIGN(pcpu4k_nr_static_pages * num_possible_cpus() | 380 | pages_size = PFN_ALIGN(pcpu4k_nr_static_pages * nr_cpu_ids |
381 | * sizeof(pcpu4k_pages[0])); | 381 | * sizeof(pcpu4k_pages[0])); |
382 | pcpu4k_pages = alloc_bootmem(pages_size); | 382 | pcpu4k_pages = alloc_bootmem(pages_size); |
383 | 383 | ||
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c index 8ccabb8a2f6a..77b9689f8edb 100644 --- a/arch/x86/kernel/tlb_uv.c +++ b/arch/x86/kernel/tlb_uv.c | |||
@@ -744,6 +744,7 @@ uv_activation_descriptor_init(int node, int pnode) | |||
744 | * note that base_dest_nodeid is actually a nasid. | 744 | * note that base_dest_nodeid is actually a nasid. |
745 | */ | 745 | */ |
746 | ad2->header.base_dest_nodeid = uv_partition_base_pnode << 1; | 746 | ad2->header.base_dest_nodeid = uv_partition_base_pnode << 1; |
747 | ad2->header.dest_subnodeid = 0x10; /* the LB */ | ||
747 | ad2->header.command = UV_NET_ENDPOINT_INTD; | 748 | ad2->header.command = UV_NET_ENDPOINT_INTD; |
748 | ad2->header.int_both = 1; | 749 | ad2->header.int_both = 1; |
749 | /* | 750 | /* |
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 78d185d797de..9fc178255c04 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S | |||
@@ -46,11 +46,10 @@ PHDRS { | |||
46 | data PT_LOAD FLAGS(7); /* RWE */ | 46 | data PT_LOAD FLAGS(7); /* RWE */ |
47 | #ifdef CONFIG_X86_64 | 47 | #ifdef CONFIG_X86_64 |
48 | user PT_LOAD FLAGS(7); /* RWE */ | 48 | user PT_LOAD FLAGS(7); /* RWE */ |
49 | data.init PT_LOAD FLAGS(7); /* RWE */ | ||
50 | #ifdef CONFIG_SMP | 49 | #ifdef CONFIG_SMP |
51 | percpu PT_LOAD FLAGS(7); /* RWE */ | 50 | percpu PT_LOAD FLAGS(7); /* RWE */ |
52 | #endif | 51 | #endif |
53 | data.init2 PT_LOAD FLAGS(7); /* RWE */ | 52 | init PT_LOAD FLAGS(7); /* RWE */ |
54 | #endif | 53 | #endif |
55 | note PT_NOTE FLAGS(0); /* ___ */ | 54 | note PT_NOTE FLAGS(0); /* ___ */ |
56 | } | 55 | } |
@@ -103,65 +102,43 @@ SECTIONS | |||
103 | __stop___ex_table = .; | 102 | __stop___ex_table = .; |
104 | } :text = 0x9090 | 103 | } :text = 0x9090 |
105 | 104 | ||
106 | RODATA | 105 | RO_DATA(PAGE_SIZE) |
107 | 106 | ||
108 | /* Data */ | 107 | /* Data */ |
109 | . = ALIGN(PAGE_SIZE); | ||
110 | .data : AT(ADDR(.data) - LOAD_OFFSET) { | 108 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
111 | /* Start of data section */ | 109 | /* Start of data section */ |
112 | _sdata = .; | 110 | _sdata = .; |
113 | DATA_DATA | 111 | |
114 | CONSTRUCTORS | 112 | /* init_task */ |
115 | } :data | 113 | INIT_TASK_DATA(THREAD_SIZE) |
116 | 114 | ||
117 | #ifdef CONFIG_X86_32 | 115 | #ifdef CONFIG_X86_32 |
118 | /* 32 bit has nosave before _edata */ | 116 | /* 32 bit has nosave before _edata */ |
119 | . = ALIGN(PAGE_SIZE); | 117 | NOSAVE_DATA |
120 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { | ||
121 | __nosave_begin = .; | ||
122 | *(.data.nosave) | ||
123 | . = ALIGN(PAGE_SIZE); | ||
124 | __nosave_end = .; | ||
125 | } | ||
126 | #endif | 118 | #endif |
127 | 119 | ||
128 | . = ALIGN(PAGE_SIZE); | 120 | PAGE_ALIGNED_DATA(PAGE_SIZE) |
129 | .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { | ||
130 | *(.data.page_aligned) | ||
131 | *(.data.idt) | 121 | *(.data.idt) |
132 | } | ||
133 | 122 | ||
134 | #ifdef CONFIG_X86_32 | 123 | CACHELINE_ALIGNED_DATA(CONFIG_X86_L1_CACHE_BYTES) |
135 | . = ALIGN(32); | ||
136 | #else | ||
137 | . = ALIGN(PAGE_SIZE); | ||
138 | . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); | ||
139 | #endif | ||
140 | .data.cacheline_aligned : | ||
141 | AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { | ||
142 | *(.data.cacheline_aligned) | ||
143 | } | ||
144 | 124 | ||
145 | /* rarely changed data like cpu maps */ | 125 | DATA_DATA |
146 | #ifdef CONFIG_X86_32 | 126 | CONSTRUCTORS |
147 | . = ALIGN(32); | 127 | |
148 | #else | 128 | /* rarely changed data like cpu maps */ |
149 | . = ALIGN(CONFIG_X86_INTERNODE_CACHE_BYTES); | 129 | READ_MOSTLY_DATA(CONFIG_X86_INTERNODE_CACHE_BYTES) |
150 | #endif | ||
151 | .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { | ||
152 | *(.data.read_mostly) | ||
153 | 130 | ||
154 | /* End of data section */ | 131 | /* End of data section */ |
155 | _edata = .; | 132 | _edata = .; |
156 | } | 133 | } :data |
157 | 134 | ||
158 | #ifdef CONFIG_X86_64 | 135 | #ifdef CONFIG_X86_64 |
159 | 136 | ||
160 | #define VSYSCALL_ADDR (-10*1024*1024) | 137 | #define VSYSCALL_ADDR (-10*1024*1024) |
161 | #define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + \ | 138 | #define VSYSCALL_PHYS_ADDR ((LOADADDR(.data) + SIZEOF(.data) + \ |
162 | SIZEOF(.data.read_mostly) + 4095) & ~(4095)) | 139 | PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) |
163 | #define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + \ | 140 | #define VSYSCALL_VIRT_ADDR ((ADDR(.data) + SIZEOF(.data) + \ |
164 | SIZEOF(.data.read_mostly) + 4095) & ~(4095)) | 141 | PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) |
165 | 142 | ||
166 | #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR) | 143 | #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR) |
167 | #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET) | 144 | #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET) |
@@ -227,35 +204,29 @@ SECTIONS | |||
227 | 204 | ||
228 | #endif /* CONFIG_X86_64 */ | 205 | #endif /* CONFIG_X86_64 */ |
229 | 206 | ||
230 | /* init_task */ | 207 | /* Init code and data - will be freed after init */ |
231 | . = ALIGN(THREAD_SIZE); | 208 | . = ALIGN(PAGE_SIZE); |
232 | .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { | 209 | .init.begin : AT(ADDR(.init.begin) - LOAD_OFFSET) { |
233 | *(.data.init_task) | 210 | __init_begin = .; /* paired with __init_end */ |
234 | } | 211 | } |
235 | #ifdef CONFIG_X86_64 | ||
236 | :data.init | ||
237 | #endif | ||
238 | 212 | ||
213 | #if defined(CONFIG_X86_64) && defined(CONFIG_SMP) | ||
239 | /* | 214 | /* |
240 | * smp_locks might be freed after init | 215 | * percpu offsets are zero-based on SMP. PERCPU_VADDR() changes the |
241 | * start/end must be page aligned | 216 | * output PHDR, so the next output section - .init.text - should |
217 | * start another segment - init. | ||
242 | */ | 218 | */ |
243 | . = ALIGN(PAGE_SIZE); | 219 | PERCPU_VADDR(0, :percpu) |
244 | .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { | 220 | #endif |
245 | __smp_locks = .; | ||
246 | *(.smp_locks) | ||
247 | __smp_locks_end = .; | ||
248 | . = ALIGN(PAGE_SIZE); | ||
249 | } | ||
250 | 221 | ||
251 | /* Init code and data - will be freed after init */ | ||
252 | . = ALIGN(PAGE_SIZE); | ||
253 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { | 222 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { |
254 | __init_begin = .; /* paired with __init_end */ | ||
255 | _sinittext = .; | 223 | _sinittext = .; |
256 | INIT_TEXT | 224 | INIT_TEXT |
257 | _einittext = .; | 225 | _einittext = .; |
258 | } | 226 | } |
227 | #ifdef CONFIG_X86_64 | ||
228 | :init | ||
229 | #endif | ||
259 | 230 | ||
260 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { | 231 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { |
261 | INIT_DATA | 232 | INIT_DATA |
@@ -326,17 +297,7 @@ SECTIONS | |||
326 | } | 297 | } |
327 | #endif | 298 | #endif |
328 | 299 | ||
329 | #if defined(CONFIG_X86_64) && defined(CONFIG_SMP) | 300 | #if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP) |
330 | /* | ||
331 | * percpu offsets are zero-based on SMP. PERCPU_VADDR() changes the | ||
332 | * output PHDR, so the next output section - __data_nosave - should | ||
333 | * start another section data.init2. Also, pda should be at the head of | ||
334 | * percpu area. Preallocate it and define the percpu offset symbol | ||
335 | * so that it can be accessed as a percpu variable. | ||
336 | */ | ||
337 | . = ALIGN(PAGE_SIZE); | ||
338 | PERCPU_VADDR(0, :percpu) | ||
339 | #else | ||
340 | PERCPU(PAGE_SIZE) | 301 | PERCPU(PAGE_SIZE) |
341 | #endif | 302 | #endif |
342 | 303 | ||
@@ -347,15 +308,22 @@ SECTIONS | |||
347 | __init_end = .; | 308 | __init_end = .; |
348 | } | 309 | } |
349 | 310 | ||
311 | /* | ||
312 | * smp_locks might be freed after init | ||
313 | * start/end must be page aligned | ||
314 | */ | ||
315 | . = ALIGN(PAGE_SIZE); | ||
316 | .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { | ||
317 | __smp_locks = .; | ||
318 | *(.smp_locks) | ||
319 | __smp_locks_end = .; | ||
320 | . = ALIGN(PAGE_SIZE); | ||
321 | } | ||
322 | |||
350 | #ifdef CONFIG_X86_64 | 323 | #ifdef CONFIG_X86_64 |
351 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { | 324 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { |
352 | . = ALIGN(PAGE_SIZE); | 325 | NOSAVE_DATA |
353 | __nosave_begin = .; | 326 | } |
354 | *(.data.nosave) | ||
355 | . = ALIGN(PAGE_SIZE); | ||
356 | __nosave_end = .; | ||
357 | } :data.init2 | ||
358 | /* use another section data.init2, see PERCPU_VADDR() above */ | ||
359 | #endif | 327 | #endif |
360 | 328 | ||
361 | /* BSS */ | 329 | /* BSS */ |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 6176fe8f29e0..ea56b8cbb6a6 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -796,7 +796,7 @@ int __init reserve_bootmem_generic(unsigned long phys, unsigned long len, | |||
796 | return ret; | 796 | return ret; |
797 | 797 | ||
798 | #else | 798 | #else |
799 | reserve_bootmem(phys, len, BOOTMEM_DEFAULT); | 799 | reserve_bootmem(phys, len, flags); |
800 | #endif | 800 | #endif |
801 | 801 | ||
802 | if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) { | 802 | if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) { |
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index e6718bb28065..352aa9e927e2 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -623,7 +623,8 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot, | |||
623 | return ret; | 623 | return ret; |
624 | 624 | ||
625 | if (flags != want_flags) { | 625 | if (flags != want_flags) { |
626 | if (strict_prot || !is_new_memtype_allowed(want_flags, flags)) { | 626 | if (strict_prot || |
627 | !is_new_memtype_allowed(paddr, size, want_flags, flags)) { | ||
627 | free_memtype(paddr, paddr + size); | 628 | free_memtype(paddr, paddr + size); |
628 | printk(KERN_ERR "%s:%d map pfn expected mapping type %s" | 629 | printk(KERN_ERR "%s:%d map pfn expected mapping type %s" |
629 | " for %Lx-%Lx, got %s\n", | 630 | " for %Lx-%Lx, got %s\n", |
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 821e97017e95..c814e144a3f0 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c | |||
@@ -183,18 +183,17 @@ static void flush_tlb_others_ipi(const struct cpumask *cpumask, | |||
183 | 183 | ||
184 | f->flush_mm = mm; | 184 | f->flush_mm = mm; |
185 | f->flush_va = va; | 185 | f->flush_va = va; |
186 | cpumask_andnot(to_cpumask(f->flush_cpumask), | 186 | if (cpumask_andnot(to_cpumask(f->flush_cpumask), cpumask, cpumask_of(smp_processor_id()))) { |
187 | cpumask, cpumask_of(smp_processor_id())); | 187 | /* |
188 | 188 | * We have to send the IPI only to | |
189 | /* | 189 | * CPUs affected. |
190 | * We have to send the IPI only to | 190 | */ |
191 | * CPUs affected. | 191 | apic->send_IPI_mask(to_cpumask(f->flush_cpumask), |
192 | */ | 192 | INVALIDATE_TLB_VECTOR_START + sender); |
193 | apic->send_IPI_mask(to_cpumask(f->flush_cpumask), | ||
194 | INVALIDATE_TLB_VECTOR_START + sender); | ||
195 | 193 | ||
196 | while (!cpumask_empty(to_cpumask(f->flush_cpumask))) | 194 | while (!cpumask_empty(to_cpumask(f->flush_cpumask))) |
197 | cpu_relax(); | 195 | cpu_relax(); |
196 | } | ||
198 | 197 | ||
199 | f->flush_mm = NULL; | 198 | f->flush_mm = NULL; |
200 | f->flush_va = 0; | 199 | f->flush_va = 0; |
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile index 172438f86a02..7410640db173 100644 --- a/arch/x86/xen/Makefile +++ b/arch/x86/xen/Makefile | |||
@@ -5,6 +5,10 @@ CFLAGS_REMOVE_time.o = -pg | |||
5 | CFLAGS_REMOVE_irq.o = -pg | 5 | CFLAGS_REMOVE_irq.o = -pg |
6 | endif | 6 | endif |
7 | 7 | ||
8 | # Make sure early boot has no stackprotector | ||
9 | nostackp := $(call cc-option, -fno-stack-protector) | ||
10 | CFLAGS_enlighten.o := $(nostackp) | ||
11 | |||
8 | obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ | 12 | obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ |
9 | time.o xen-asm.o xen-asm_$(BITS).o \ | 13 | time.o xen-asm.o xen-asm_$(BITS).o \ |
10 | grant-table.o suspend.o | 14 | grant-table.o suspend.o |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 0a1700a2be9c..eb33aaa8415d 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -215,6 +215,7 @@ static __init void xen_init_cpuid_mask(void) | |||
215 | (1 << X86_FEATURE_ACPI)); /* disable ACPI */ | 215 | (1 << X86_FEATURE_ACPI)); /* disable ACPI */ |
216 | 216 | ||
217 | ax = 1; | 217 | ax = 1; |
218 | cx = 0; | ||
218 | xen_cpuid(&ax, &bx, &cx, &dx); | 219 | xen_cpuid(&ax, &bx, &cx, &dx); |
219 | 220 | ||
220 | /* cpuid claims we support xsave; try enabling it to see what happens */ | 221 | /* cpuid claims we support xsave; try enabling it to see what happens */ |
@@ -974,10 +975,6 @@ asmlinkage void __init xen_start_kernel(void) | |||
974 | 975 | ||
975 | xen_domain_type = XEN_PV_DOMAIN; | 976 | xen_domain_type = XEN_PV_DOMAIN; |
976 | 977 | ||
977 | BUG_ON(memcmp(xen_start_info->magic, "xen-3", 5) != 0); | ||
978 | |||
979 | xen_setup_features(); | ||
980 | |||
981 | /* Install Xen paravirt ops */ | 978 | /* Install Xen paravirt ops */ |
982 | pv_info = xen_info; | 979 | pv_info = xen_info; |
983 | pv_init_ops = xen_init_ops; | 980 | pv_init_ops = xen_init_ops; |
@@ -986,8 +983,15 @@ asmlinkage void __init xen_start_kernel(void) | |||
986 | pv_apic_ops = xen_apic_ops; | 983 | pv_apic_ops = xen_apic_ops; |
987 | pv_mmu_ops = xen_mmu_ops; | 984 | pv_mmu_ops = xen_mmu_ops; |
988 | 985 | ||
989 | xen_init_irq_ops(); | 986 | #ifdef CONFIG_X86_64 |
987 | /* | ||
988 | * Setup percpu state. We only need to do this for 64-bit | ||
989 | * because 32-bit already has %fs set properly. | ||
990 | */ | ||
991 | load_percpu_segment(0); | ||
992 | #endif | ||
990 | 993 | ||
994 | xen_init_irq_ops(); | ||
991 | xen_init_cpuid_mask(); | 995 | xen_init_cpuid_mask(); |
992 | 996 | ||
993 | #ifdef CONFIG_X86_LOCAL_APIC | 997 | #ifdef CONFIG_X86_LOCAL_APIC |
@@ -997,6 +1001,8 @@ asmlinkage void __init xen_start_kernel(void) | |||
997 | set_xen_basic_apic_ops(); | 1001 | set_xen_basic_apic_ops(); |
998 | #endif | 1002 | #endif |
999 | 1003 | ||
1004 | xen_setup_features(); | ||
1005 | |||
1000 | if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) { | 1006 | if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) { |
1001 | pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; | 1007 | pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; |
1002 | pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; | 1008 | pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; |
@@ -1004,13 +1010,6 @@ asmlinkage void __init xen_start_kernel(void) | |||
1004 | 1010 | ||
1005 | machine_ops = xen_machine_ops; | 1011 | machine_ops = xen_machine_ops; |
1006 | 1012 | ||
1007 | #ifdef CONFIG_X86_64 | ||
1008 | /* | ||
1009 | * Setup percpu state. We only need to do this for 64-bit | ||
1010 | * because 32-bit already has %fs set properly. | ||
1011 | */ | ||
1012 | load_percpu_segment(0); | ||
1013 | #endif | ||
1014 | /* | 1013 | /* |
1015 | * The only reliable way to retain the initial address of the | 1014 | * The only reliable way to retain the initial address of the |
1016 | * percpu gdt_page is to remember it here, so we can go and | 1015 | * percpu gdt_page is to remember it here, so we can go and |
@@ -1061,6 +1060,7 @@ asmlinkage void __init xen_start_kernel(void) | |||
1061 | /* set up basic CPUID stuff */ | 1060 | /* set up basic CPUID stuff */ |
1062 | cpu_detect(&new_cpu_data); | 1061 | cpu_detect(&new_cpu_data); |
1063 | new_cpu_data.hard_math = 1; | 1062 | new_cpu_data.hard_math = 1; |
1063 | new_cpu_data.wp_works_ok = 1; | ||
1064 | new_cpu_data.x86_capability[0] = cpuid_edx(1); | 1064 | new_cpu_data.x86_capability[0] = cpuid_edx(1); |
1065 | #endif | 1065 | #endif |
1066 | 1066 | ||
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 418d63619680..d3aa2aadb3e0 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -133,7 +133,7 @@ queue_max_sectors_store(struct request_queue *q, const char *page, size_t count) | |||
133 | return -EINVAL; | 133 | return -EINVAL; |
134 | 134 | ||
135 | spin_lock_irq(q->queue_lock); | 135 | spin_lock_irq(q->queue_lock); |
136 | blk_queue_max_sectors(q, max_sectors_kb << 1); | 136 | q->limits.max_sectors = max_sectors_kb << 1; |
137 | spin_unlock_irq(q->queue_lock); | 137 | spin_unlock_irq(q->queue_lock); |
138 | 138 | ||
139 | return ret; | 139 | return ret; |
diff --git a/crypto/algapi.c b/crypto/algapi.c index 56c62e2858d5..df0863d56995 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c | |||
@@ -692,7 +692,7 @@ out: | |||
692 | } | 692 | } |
693 | EXPORT_SYMBOL_GPL(crypto_enqueue_request); | 693 | EXPORT_SYMBOL_GPL(crypto_enqueue_request); |
694 | 694 | ||
695 | struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue) | 695 | void *__crypto_dequeue_request(struct crypto_queue *queue, unsigned int offset) |
696 | { | 696 | { |
697 | struct list_head *request; | 697 | struct list_head *request; |
698 | 698 | ||
@@ -707,7 +707,14 @@ struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue) | |||
707 | request = queue->list.next; | 707 | request = queue->list.next; |
708 | list_del(request); | 708 | list_del(request); |
709 | 709 | ||
710 | return list_entry(request, struct crypto_async_request, list); | 710 | return (char *)list_entry(request, struct crypto_async_request, list) - |
711 | offset; | ||
712 | } | ||
713 | EXPORT_SYMBOL_GPL(__crypto_dequeue_request); | ||
714 | |||
715 | struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue) | ||
716 | { | ||
717 | return __crypto_dequeue_request(queue, 0); | ||
711 | } | 718 | } |
712 | EXPORT_SYMBOL_GPL(crypto_dequeue_request); | 719 | EXPORT_SYMBOL_GPL(crypto_dequeue_request); |
713 | 720 | ||
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c index 67340cc70142..257706e7734f 100644 --- a/drivers/acpi/acpica/exstorob.c +++ b/drivers/acpi/acpica/exstorob.c | |||
@@ -70,6 +70,12 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE_PTR(ex_store_buffer_to_buffer, source_desc); | 71 | ACPI_FUNCTION_TRACE_PTR(ex_store_buffer_to_buffer, source_desc); |
72 | 72 | ||
73 | /* If Source and Target are the same, just return */ | ||
74 | |||
75 | if (source_desc == target_desc) { | ||
76 | return_ACPI_STATUS(AE_OK); | ||
77 | } | ||
78 | |||
73 | /* We know that source_desc is a buffer by now */ | 79 | /* We know that source_desc is a buffer by now */ |
74 | 80 | ||
75 | buffer = ACPI_CAST_PTR(u8, source_desc->buffer.pointer); | 81 | buffer = ACPI_CAST_PTR(u8, source_desc->buffer.pointer); |
@@ -161,6 +167,12 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, | |||
161 | 167 | ||
162 | ACPI_FUNCTION_TRACE_PTR(ex_store_string_to_string, source_desc); | 168 | ACPI_FUNCTION_TRACE_PTR(ex_store_string_to_string, source_desc); |
163 | 169 | ||
170 | /* If Source and Target are the same, just return */ | ||
171 | |||
172 | if (source_desc == target_desc) { | ||
173 | return_ACPI_STATUS(AE_OK); | ||
174 | } | ||
175 | |||
164 | /* We know that source_desc is a string by now */ | 176 | /* We know that source_desc is a string by now */ |
165 | 177 | ||
166 | buffer = ACPI_CAST_PTR(u8, source_desc->string.pointer); | 178 | buffer = ACPI_CAST_PTR(u8, source_desc->string.pointer); |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 84e0f3c07442..2cc4b3033872 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -1151,6 +1151,9 @@ static int __init acpi_processor_init(void) | |||
1151 | { | 1151 | { |
1152 | int result = 0; | 1152 | int result = 0; |
1153 | 1153 | ||
1154 | if (acpi_disabled) | ||
1155 | return 0; | ||
1156 | |||
1154 | memset(&errata, 0, sizeof(errata)); | 1157 | memset(&errata, 0, sizeof(errata)); |
1155 | 1158 | ||
1156 | #ifdef CONFIG_SMP | 1159 | #ifdef CONFIG_SMP |
@@ -1197,6 +1200,9 @@ out_proc: | |||
1197 | 1200 | ||
1198 | static void __exit acpi_processor_exit(void) | 1201 | static void __exit acpi_processor_exit(void) |
1199 | { | 1202 | { |
1203 | if (acpi_disabled) | ||
1204 | return; | ||
1205 | |||
1200 | acpi_processor_ppc_exit(); | 1206 | acpi_processor_ppc_exit(); |
1201 | 1207 | ||
1202 | acpi_thermal_cpufreq_exit(); | 1208 | acpi_thermal_cpufreq_exit(); |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 0efa59e7e3af..66393d5c4c7c 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -162,8 +162,9 @@ static void lapic_timer_check_state(int state, struct acpi_processor *pr, | |||
162 | pr->power.timer_broadcast_on_state = state; | 162 | pr->power.timer_broadcast_on_state = state; |
163 | } | 163 | } |
164 | 164 | ||
165 | static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) | 165 | static void lapic_timer_propagate_broadcast(void *arg) |
166 | { | 166 | { |
167 | struct acpi_processor *pr = (struct acpi_processor *) arg; | ||
167 | unsigned long reason; | 168 | unsigned long reason; |
168 | 169 | ||
169 | reason = pr->power.timer_broadcast_on_state < INT_MAX ? | 170 | reason = pr->power.timer_broadcast_on_state < INT_MAX ? |
@@ -635,7 +636,8 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
635 | working++; | 636 | working++; |
636 | } | 637 | } |
637 | 638 | ||
638 | lapic_timer_propagate_broadcast(pr); | 639 | smp_call_function_single(pr->id, lapic_timer_propagate_broadcast, |
640 | pr, 1); | ||
639 | 641 | ||
640 | return (working); | 642 | return (working); |
641 | } | 643 | } |
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 39838c666032..31adda1099e0 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
@@ -66,7 +66,7 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) | |||
66 | if (pr->limit.thermal.tx > tx) | 66 | if (pr->limit.thermal.tx > tx) |
67 | tx = pr->limit.thermal.tx; | 67 | tx = pr->limit.thermal.tx; |
68 | 68 | ||
69 | result = acpi_processor_set_throttling(pr, tx); | 69 | result = acpi_processor_set_throttling(pr, tx, false); |
70 | if (result) | 70 | if (result) |
71 | goto end; | 71 | goto end; |
72 | } | 72 | } |
@@ -421,12 +421,12 @@ processor_set_cur_state(struct thermal_cooling_device *cdev, | |||
421 | 421 | ||
422 | if (state <= max_pstate) { | 422 | if (state <= max_pstate) { |
423 | if (pr->flags.throttling && pr->throttling.state) | 423 | if (pr->flags.throttling && pr->throttling.state) |
424 | result = acpi_processor_set_throttling(pr, 0); | 424 | result = acpi_processor_set_throttling(pr, 0, false); |
425 | cpufreq_set_cur_state(pr->id, state); | 425 | cpufreq_set_cur_state(pr->id, state); |
426 | } else { | 426 | } else { |
427 | cpufreq_set_cur_state(pr->id, max_pstate); | 427 | cpufreq_set_cur_state(pr->id, max_pstate); |
428 | result = acpi_processor_set_throttling(pr, | 428 | result = acpi_processor_set_throttling(pr, |
429 | state - max_pstate); | 429 | state - max_pstate, false); |
430 | } | 430 | } |
431 | return result; | 431 | return result; |
432 | } | 432 | } |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 227543789ba9..ae39797aab55 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -62,7 +62,8 @@ struct throttling_tstate { | |||
62 | #define THROTTLING_POSTCHANGE (2) | 62 | #define THROTTLING_POSTCHANGE (2) |
63 | 63 | ||
64 | static int acpi_processor_get_throttling(struct acpi_processor *pr); | 64 | static int acpi_processor_get_throttling(struct acpi_processor *pr); |
65 | int acpi_processor_set_throttling(struct acpi_processor *pr, int state); | 65 | int acpi_processor_set_throttling(struct acpi_processor *pr, |
66 | int state, bool force); | ||
66 | 67 | ||
67 | static int acpi_processor_update_tsd_coord(void) | 68 | static int acpi_processor_update_tsd_coord(void) |
68 | { | 69 | { |
@@ -361,7 +362,7 @@ int acpi_processor_tstate_has_changed(struct acpi_processor *pr) | |||
361 | */ | 362 | */ |
362 | target_state = throttling_limit; | 363 | target_state = throttling_limit; |
363 | } | 364 | } |
364 | return acpi_processor_set_throttling(pr, target_state); | 365 | return acpi_processor_set_throttling(pr, target_state, false); |
365 | } | 366 | } |
366 | 367 | ||
367 | /* | 368 | /* |
@@ -839,10 +840,10 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | |||
839 | if (ret >= 0) { | 840 | if (ret >= 0) { |
840 | state = acpi_get_throttling_state(pr, value); | 841 | state = acpi_get_throttling_state(pr, value); |
841 | if (state == -1) { | 842 | if (state == -1) { |
842 | ACPI_WARNING((AE_INFO, | 843 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
843 | "Invalid throttling state, reset")); | 844 | "Invalid throttling state, reset\n")); |
844 | state = 0; | 845 | state = 0; |
845 | ret = acpi_processor_set_throttling(pr, state); | 846 | ret = acpi_processor_set_throttling(pr, state, true); |
846 | if (ret) | 847 | if (ret) |
847 | return ret; | 848 | return ret; |
848 | } | 849 | } |
@@ -915,7 +916,7 @@ static int acpi_processor_get_fadt_info(struct acpi_processor *pr) | |||
915 | } | 916 | } |
916 | 917 | ||
917 | static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, | 918 | static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, |
918 | int state) | 919 | int state, bool force) |
919 | { | 920 | { |
920 | u32 value = 0; | 921 | u32 value = 0; |
921 | u32 duty_mask = 0; | 922 | u32 duty_mask = 0; |
@@ -930,7 +931,7 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, | |||
930 | if (!pr->flags.throttling) | 931 | if (!pr->flags.throttling) |
931 | return -ENODEV; | 932 | return -ENODEV; |
932 | 933 | ||
933 | if (state == pr->throttling.state) | 934 | if (!force && (state == pr->throttling.state)) |
934 | return 0; | 935 | return 0; |
935 | 936 | ||
936 | if (state < pr->throttling_platform_limit) | 937 | if (state < pr->throttling_platform_limit) |
@@ -988,7 +989,7 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, | |||
988 | } | 989 | } |
989 | 990 | ||
990 | static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | 991 | static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, |
991 | int state) | 992 | int state, bool force) |
992 | { | 993 | { |
993 | int ret; | 994 | int ret; |
994 | acpi_integer value; | 995 | acpi_integer value; |
@@ -1002,7 +1003,7 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | |||
1002 | if (!pr->flags.throttling) | 1003 | if (!pr->flags.throttling) |
1003 | return -ENODEV; | 1004 | return -ENODEV; |
1004 | 1005 | ||
1005 | if (state == pr->throttling.state) | 1006 | if (!force && (state == pr->throttling.state)) |
1006 | return 0; | 1007 | return 0; |
1007 | 1008 | ||
1008 | if (state < pr->throttling_platform_limit) | 1009 | if (state < pr->throttling_platform_limit) |
@@ -1018,7 +1019,8 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | |||
1018 | return 0; | 1019 | return 0; |
1019 | } | 1020 | } |
1020 | 1021 | ||
1021 | int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | 1022 | int acpi_processor_set_throttling(struct acpi_processor *pr, |
1023 | int state, bool force) | ||
1022 | { | 1024 | { |
1023 | cpumask_var_t saved_mask; | 1025 | cpumask_var_t saved_mask; |
1024 | int ret = 0; | 1026 | int ret = 0; |
@@ -1070,7 +1072,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
1070 | /* FIXME: use work_on_cpu() */ | 1072 | /* FIXME: use work_on_cpu() */ |
1071 | set_cpus_allowed_ptr(current, cpumask_of(pr->id)); | 1073 | set_cpus_allowed_ptr(current, cpumask_of(pr->id)); |
1072 | ret = p_throttling->acpi_processor_set_throttling(pr, | 1074 | ret = p_throttling->acpi_processor_set_throttling(pr, |
1073 | t_state.target_state); | 1075 | t_state.target_state, force); |
1074 | } else { | 1076 | } else { |
1075 | /* | 1077 | /* |
1076 | * When the T-state coordination is SW_ALL or HW_ALL, | 1078 | * When the T-state coordination is SW_ALL or HW_ALL, |
@@ -1103,7 +1105,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
1103 | set_cpus_allowed_ptr(current, cpumask_of(i)); | 1105 | set_cpus_allowed_ptr(current, cpumask_of(i)); |
1104 | ret = match_pr->throttling. | 1106 | ret = match_pr->throttling. |
1105 | acpi_processor_set_throttling( | 1107 | acpi_processor_set_throttling( |
1106 | match_pr, t_state.target_state); | 1108 | match_pr, t_state.target_state, force); |
1107 | } | 1109 | } |
1108 | } | 1110 | } |
1109 | /* | 1111 | /* |
@@ -1201,7 +1203,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
1201 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1203 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
1202 | "Disabling throttling (was T%d)\n", | 1204 | "Disabling throttling (was T%d)\n", |
1203 | pr->throttling.state)); | 1205 | pr->throttling.state)); |
1204 | result = acpi_processor_set_throttling(pr, 0); | 1206 | result = acpi_processor_set_throttling(pr, 0, false); |
1205 | if (result) | 1207 | if (result) |
1206 | goto end; | 1208 | goto end; |
1207 | } | 1209 | } |
@@ -1307,7 +1309,7 @@ static ssize_t acpi_processor_write_throttling(struct file *file, | |||
1307 | if (strcmp(tmpbuf, charp) != 0) | 1309 | if (strcmp(tmpbuf, charp) != 0) |
1308 | return -EINVAL; | 1310 | return -EINVAL; |
1309 | 1311 | ||
1310 | result = acpi_processor_set_throttling(pr, state_val); | 1312 | result = acpi_processor_set_throttling(pr, state_val, false); |
1311 | if (result) | 1313 | if (result) |
1312 | return result; | 1314 | return result; |
1313 | 1315 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 8851315ce858..60ea984c84a0 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -2004,8 +2004,11 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
2004 | status = acpi_remove_notify_handler(device->dev->handle, | 2004 | status = acpi_remove_notify_handler(device->dev->handle, |
2005 | ACPI_DEVICE_NOTIFY, | 2005 | ACPI_DEVICE_NOTIFY, |
2006 | acpi_video_device_notify); | 2006 | acpi_video_device_notify); |
2007 | sysfs_remove_link(&device->backlight->dev.kobj, "device"); | 2007 | if (device->backlight) { |
2008 | backlight_device_unregister(device->backlight); | 2008 | sysfs_remove_link(&device->backlight->dev.kobj, "device"); |
2009 | backlight_device_unregister(device->backlight); | ||
2010 | device->backlight = NULL; | ||
2011 | } | ||
2009 | if (device->cdev) { | 2012 | if (device->cdev) { |
2010 | sysfs_remove_link(&device->dev->dev.kobj, | 2013 | sysfs_remove_link(&device->dev->dev.kobj, |
2011 | "thermal_cooling"); | 2014 | "thermal_cooling"); |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 958c1fa41900..fe3eba5d6b3e 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -219,6 +219,8 @@ enum { | |||
219 | AHCI_HFLAG_SECT255 = (1 << 8), /* max 255 sectors */ | 219 | AHCI_HFLAG_SECT255 = (1 << 8), /* max 255 sectors */ |
220 | AHCI_HFLAG_YES_NCQ = (1 << 9), /* force NCQ cap on */ | 220 | AHCI_HFLAG_YES_NCQ = (1 << 9), /* force NCQ cap on */ |
221 | AHCI_HFLAG_NO_SUSPEND = (1 << 10), /* don't suspend */ | 221 | AHCI_HFLAG_NO_SUSPEND = (1 << 10), /* don't suspend */ |
222 | AHCI_HFLAG_SRST_TOUT_IS_OFFLINE = (1 << 11), /* treat SRST timeout as | ||
223 | link offline */ | ||
222 | 224 | ||
223 | /* ap->flags bits */ | 225 | /* ap->flags bits */ |
224 | 226 | ||
@@ -1663,6 +1665,7 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class, | |||
1663 | int (*check_ready)(struct ata_link *link)) | 1665 | int (*check_ready)(struct ata_link *link)) |
1664 | { | 1666 | { |
1665 | struct ata_port *ap = link->ap; | 1667 | struct ata_port *ap = link->ap; |
1668 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
1666 | const char *reason = NULL; | 1669 | const char *reason = NULL; |
1667 | unsigned long now, msecs; | 1670 | unsigned long now, msecs; |
1668 | struct ata_taskfile tf; | 1671 | struct ata_taskfile tf; |
@@ -1701,12 +1704,21 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class, | |||
1701 | 1704 | ||
1702 | /* wait for link to become ready */ | 1705 | /* wait for link to become ready */ |
1703 | rc = ata_wait_after_reset(link, deadline, check_ready); | 1706 | rc = ata_wait_after_reset(link, deadline, check_ready); |
1704 | /* link occupied, -ENODEV too is an error */ | 1707 | if (rc == -EBUSY && hpriv->flags & AHCI_HFLAG_SRST_TOUT_IS_OFFLINE) { |
1705 | if (rc) { | 1708 | /* |
1709 | * Workaround for cases where link online status can't | ||
1710 | * be trusted. Treat device readiness timeout as link | ||
1711 | * offline. | ||
1712 | */ | ||
1713 | ata_link_printk(link, KERN_INFO, | ||
1714 | "device not ready, treating as offline\n"); | ||
1715 | *class = ATA_DEV_NONE; | ||
1716 | } else if (rc) { | ||
1717 | /* link occupied, -ENODEV too is an error */ | ||
1706 | reason = "device not ready"; | 1718 | reason = "device not ready"; |
1707 | goto fail; | 1719 | goto fail; |
1708 | } | 1720 | } else |
1709 | *class = ahci_dev_classify(ap); | 1721 | *class = ahci_dev_classify(ap); |
1710 | 1722 | ||
1711 | DPRINTK("EXIT, class=%u\n", *class); | 1723 | DPRINTK("EXIT, class=%u\n", *class); |
1712 | return 0; | 1724 | return 0; |
@@ -1773,7 +1785,8 @@ static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class, | |||
1773 | irq_sts = readl(port_mmio + PORT_IRQ_STAT); | 1785 | irq_sts = readl(port_mmio + PORT_IRQ_STAT); |
1774 | if (irq_sts & PORT_IRQ_BAD_PMP) { | 1786 | if (irq_sts & PORT_IRQ_BAD_PMP) { |
1775 | ata_link_printk(link, KERN_WARNING, | 1787 | ata_link_printk(link, KERN_WARNING, |
1776 | "failed due to HW bug, retry pmp=0\n"); | 1788 | "applying SB600 PMP SRST workaround " |
1789 | "and retrying\n"); | ||
1777 | rc = ahci_do_softreset(link, class, 0, deadline, | 1790 | rc = ahci_do_softreset(link, class, 0, deadline, |
1778 | ahci_check_ready); | 1791 | ahci_check_ready); |
1779 | } | 1792 | } |
@@ -2726,6 +2739,56 @@ static bool ahci_broken_suspend(struct pci_dev *pdev) | |||
2726 | return !ver || strcmp(ver, dmi->driver_data) < 0; | 2739 | return !ver || strcmp(ver, dmi->driver_data) < 0; |
2727 | } | 2740 | } |
2728 | 2741 | ||
2742 | static bool ahci_broken_online(struct pci_dev *pdev) | ||
2743 | { | ||
2744 | #define ENCODE_BUSDEVFN(bus, slot, func) \ | ||
2745 | (void *)(unsigned long)(((bus) << 8) | PCI_DEVFN((slot), (func))) | ||
2746 | static const struct dmi_system_id sysids[] = { | ||
2747 | /* | ||
2748 | * There are several gigabyte boards which use | ||
2749 | * SIMG5723s configured as hardware RAID. Certain | ||
2750 | * 5723 firmware revisions shipped there keep the link | ||
2751 | * online but fail to answer properly to SRST or | ||
2752 | * IDENTIFY when no device is attached downstream | ||
2753 | * causing libata to retry quite a few times leading | ||
2754 | * to excessive detection delay. | ||
2755 | * | ||
2756 | * As these firmwares respond to the second reset try | ||
2757 | * with invalid device signature, considering unknown | ||
2758 | * sig as offline works around the problem acceptably. | ||
2759 | */ | ||
2760 | { | ||
2761 | .ident = "EP45-DQ6", | ||
2762 | .matches = { | ||
2763 | DMI_MATCH(DMI_BOARD_VENDOR, | ||
2764 | "Gigabyte Technology Co., Ltd."), | ||
2765 | DMI_MATCH(DMI_BOARD_NAME, "EP45-DQ6"), | ||
2766 | }, | ||
2767 | .driver_data = ENCODE_BUSDEVFN(0x0a, 0x00, 0), | ||
2768 | }, | ||
2769 | { | ||
2770 | .ident = "EP45-DS5", | ||
2771 | .matches = { | ||
2772 | DMI_MATCH(DMI_BOARD_VENDOR, | ||
2773 | "Gigabyte Technology Co., Ltd."), | ||
2774 | DMI_MATCH(DMI_BOARD_NAME, "EP45-DS5"), | ||
2775 | }, | ||
2776 | .driver_data = ENCODE_BUSDEVFN(0x03, 0x00, 0), | ||
2777 | }, | ||
2778 | { } /* terminate list */ | ||
2779 | }; | ||
2780 | #undef ENCODE_BUSDEVFN | ||
2781 | const struct dmi_system_id *dmi = dmi_first_match(sysids); | ||
2782 | unsigned int val; | ||
2783 | |||
2784 | if (!dmi) | ||
2785 | return false; | ||
2786 | |||
2787 | val = (unsigned long)dmi->driver_data; | ||
2788 | |||
2789 | return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff); | ||
2790 | } | ||
2791 | |||
2729 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 2792 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
2730 | { | 2793 | { |
2731 | static int printed_version; | 2794 | static int printed_version; |
@@ -2841,6 +2904,12 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2841 | "BIOS update required for suspend/resume\n"); | 2904 | "BIOS update required for suspend/resume\n"); |
2842 | } | 2905 | } |
2843 | 2906 | ||
2907 | if (ahci_broken_online(pdev)) { | ||
2908 | hpriv->flags |= AHCI_HFLAG_SRST_TOUT_IS_OFFLINE; | ||
2909 | dev_info(&pdev->dev, | ||
2910 | "online status unreliable, applying workaround\n"); | ||
2911 | } | ||
2912 | |||
2844 | /* CAP.NP sometimes indicate the index of the last enabled | 2913 | /* CAP.NP sometimes indicate the index of the last enabled |
2845 | * port, at other times, that of the last possible port, so | 2914 | * port, at other times, that of the last possible port, so |
2846 | * determining the maximum port number requires looking at | 2915 | * determining the maximum port number requires looking at |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 56b8a3ff1286..9ac4e378992e 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -664,6 +664,8 @@ static int piix_pata_prereset(struct ata_link *link, unsigned long deadline) | |||
664 | return ata_sff_prereset(link, deadline); | 664 | return ata_sff_prereset(link, deadline); |
665 | } | 665 | } |
666 | 666 | ||
667 | static DEFINE_SPINLOCK(piix_lock); | ||
668 | |||
667 | /** | 669 | /** |
668 | * piix_set_piomode - Initialize host controller PATA PIO timings | 670 | * piix_set_piomode - Initialize host controller PATA PIO timings |
669 | * @ap: Port whose timings we are configuring | 671 | * @ap: Port whose timings we are configuring |
@@ -677,8 +679,9 @@ static int piix_pata_prereset(struct ata_link *link, unsigned long deadline) | |||
677 | 679 | ||
678 | static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev) | 680 | static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev) |
679 | { | 681 | { |
680 | unsigned int pio = adev->pio_mode - XFER_PIO_0; | ||
681 | struct pci_dev *dev = to_pci_dev(ap->host->dev); | 682 | struct pci_dev *dev = to_pci_dev(ap->host->dev); |
683 | unsigned long flags; | ||
684 | unsigned int pio = adev->pio_mode - XFER_PIO_0; | ||
682 | unsigned int is_slave = (adev->devno != 0); | 685 | unsigned int is_slave = (adev->devno != 0); |
683 | unsigned int master_port= ap->port_no ? 0x42 : 0x40; | 686 | unsigned int master_port= ap->port_no ? 0x42 : 0x40; |
684 | unsigned int slave_port = 0x44; | 687 | unsigned int slave_port = 0x44; |
@@ -708,6 +711,8 @@ static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
708 | if (adev->class == ATA_DEV_ATA) | 711 | if (adev->class == ATA_DEV_ATA) |
709 | control |= 4; /* PPE enable */ | 712 | control |= 4; /* PPE enable */ |
710 | 713 | ||
714 | spin_lock_irqsave(&piix_lock, flags); | ||
715 | |||
711 | /* PIO configuration clears DTE unconditionally. It will be | 716 | /* PIO configuration clears DTE unconditionally. It will be |
712 | * programmed in set_dmamode which is guaranteed to be called | 717 | * programmed in set_dmamode which is guaranteed to be called |
713 | * after set_piomode if any DMA mode is available. | 718 | * after set_piomode if any DMA mode is available. |
@@ -747,6 +752,8 @@ static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
747 | udma_enable &= ~(1 << (2 * ap->port_no + adev->devno)); | 752 | udma_enable &= ~(1 << (2 * ap->port_no + adev->devno)); |
748 | pci_write_config_byte(dev, 0x48, udma_enable); | 753 | pci_write_config_byte(dev, 0x48, udma_enable); |
749 | } | 754 | } |
755 | |||
756 | spin_unlock_irqrestore(&piix_lock, flags); | ||
750 | } | 757 | } |
751 | 758 | ||
752 | /** | 759 | /** |
@@ -764,6 +771,7 @@ static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
764 | static void do_pata_set_dmamode(struct ata_port *ap, struct ata_device *adev, int isich) | 771 | static void do_pata_set_dmamode(struct ata_port *ap, struct ata_device *adev, int isich) |
765 | { | 772 | { |
766 | struct pci_dev *dev = to_pci_dev(ap->host->dev); | 773 | struct pci_dev *dev = to_pci_dev(ap->host->dev); |
774 | unsigned long flags; | ||
767 | u8 master_port = ap->port_no ? 0x42 : 0x40; | 775 | u8 master_port = ap->port_no ? 0x42 : 0x40; |
768 | u16 master_data; | 776 | u16 master_data; |
769 | u8 speed = adev->dma_mode; | 777 | u8 speed = adev->dma_mode; |
@@ -777,6 +785,8 @@ static void do_pata_set_dmamode(struct ata_port *ap, struct ata_device *adev, in | |||
777 | { 2, 1 }, | 785 | { 2, 1 }, |
778 | { 2, 3 }, }; | 786 | { 2, 3 }, }; |
779 | 787 | ||
788 | spin_lock_irqsave(&piix_lock, flags); | ||
789 | |||
780 | pci_read_config_word(dev, master_port, &master_data); | 790 | pci_read_config_word(dev, master_port, &master_data); |
781 | if (ap->udma_mask) | 791 | if (ap->udma_mask) |
782 | pci_read_config_byte(dev, 0x48, &udma_enable); | 792 | pci_read_config_byte(dev, 0x48, &udma_enable); |
@@ -867,6 +877,8 @@ static void do_pata_set_dmamode(struct ata_port *ap, struct ata_device *adev, in | |||
867 | /* Don't scribble on 0x48 if the controller does not support UDMA */ | 877 | /* Don't scribble on 0x48 if the controller does not support UDMA */ |
868 | if (ap->udma_mask) | 878 | if (ap->udma_mask) |
869 | pci_write_config_byte(dev, 0x48, udma_enable); | 879 | pci_write_config_byte(dev, 0x48, udma_enable); |
880 | |||
881 | spin_unlock_irqrestore(&piix_lock, flags); | ||
870 | } | 882 | } |
871 | 883 | ||
872 | /** | 884 | /** |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 8ac98ff16d7d..072ba5ea138f 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4302,6 +4302,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4302 | { "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_HORKAGE_BROKEN_HPA }, | 4302 | { "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_HORKAGE_BROKEN_HPA }, |
4303 | { "MAXTOR 6L080L4", "A93.0500", ATA_HORKAGE_BROKEN_HPA }, | 4303 | { "MAXTOR 6L080L4", "A93.0500", ATA_HORKAGE_BROKEN_HPA }, |
4304 | 4304 | ||
4305 | /* this one allows HPA unlocking but fails IOs on the area */ | ||
4306 | { "OCZ-VERTEX", "1.30", ATA_HORKAGE_BROKEN_HPA }, | ||
4307 | |||
4305 | /* Devices which report 1 sector over size HPA */ | 4308 | /* Devices which report 1 sector over size HPA */ |
4306 | { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, }, | 4309 | { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, }, |
4307 | { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, }, | 4310 | { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, }, |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index 5702affcb325..41c94b1ae493 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
@@ -250,7 +250,7 @@ static int __devinit pata_at91_probe(struct platform_device *pdev) | |||
250 | ata_port_desc(ap, "no IRQ, using PIO polling"); | 250 | ata_port_desc(ap, "no IRQ, using PIO polling"); |
251 | } | 251 | } |
252 | 252 | ||
253 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 253 | info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); |
254 | 254 | ||
255 | if (!info) { | 255 | if (!info) { |
256 | dev_err(dev, "failed to allocate memory for private data\n"); | 256 | dev_err(dev, "failed to allocate memory for private data\n"); |
@@ -275,7 +275,7 @@ static int __devinit pata_at91_probe(struct platform_device *pdev) | |||
275 | if (!info->ide_addr) { | 275 | if (!info->ide_addr) { |
276 | dev_err(dev, "failed to map IO base\n"); | 276 | dev_err(dev, "failed to map IO base\n"); |
277 | ret = -ENOMEM; | 277 | ret = -ENOMEM; |
278 | goto err_ide_ioremap; | 278 | goto err_put; |
279 | } | 279 | } |
280 | 280 | ||
281 | info->alt_addr = devm_ioremap(dev, | 281 | info->alt_addr = devm_ioremap(dev, |
@@ -284,7 +284,7 @@ static int __devinit pata_at91_probe(struct platform_device *pdev) | |||
284 | if (!info->alt_addr) { | 284 | if (!info->alt_addr) { |
285 | dev_err(dev, "failed to map CTL base\n"); | 285 | dev_err(dev, "failed to map CTL base\n"); |
286 | ret = -ENOMEM; | 286 | ret = -ENOMEM; |
287 | goto err_alt_ioremap; | 287 | goto err_put; |
288 | } | 288 | } |
289 | 289 | ||
290 | ap->ioaddr.cmd_addr = info->ide_addr; | 290 | ap->ioaddr.cmd_addr = info->ide_addr; |
@@ -303,13 +303,8 @@ static int __devinit pata_at91_probe(struct platform_device *pdev) | |||
303 | irq ? ata_sff_interrupt : NULL, | 303 | irq ? ata_sff_interrupt : NULL, |
304 | irq_flags, &pata_at91_sht); | 304 | irq_flags, &pata_at91_sht); |
305 | 305 | ||
306 | err_alt_ioremap: | 306 | err_put: |
307 | devm_iounmap(dev, info->ide_addr); | ||
308 | |||
309 | err_ide_ioremap: | ||
310 | clk_put(info->mck); | 307 | clk_put(info->mck); |
311 | kfree(info); | ||
312 | |||
313 | return ret; | 308 | return ret; |
314 | } | 309 | } |
315 | 310 | ||
@@ -317,7 +312,6 @@ static int __devexit pata_at91_remove(struct platform_device *pdev) | |||
317 | { | 312 | { |
318 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 313 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
319 | struct at91_ide_info *info; | 314 | struct at91_ide_info *info; |
320 | struct device *dev = &pdev->dev; | ||
321 | 315 | ||
322 | if (!host) | 316 | if (!host) |
323 | return 0; | 317 | return 0; |
@@ -328,11 +322,8 @@ static int __devexit pata_at91_remove(struct platform_device *pdev) | |||
328 | if (!info) | 322 | if (!info) |
329 | return 0; | 323 | return 0; |
330 | 324 | ||
331 | devm_iounmap(dev, info->ide_addr); | ||
332 | devm_iounmap(dev, info->alt_addr); | ||
333 | clk_put(info->mck); | 325 | clk_put(info->mck); |
334 | 326 | ||
335 | kfree(info); | ||
336 | return 0; | 327 | return 0; |
337 | } | 328 | } |
338 | 329 | ||
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index bec0b8ade66d..45915566e4e9 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_atiixp.c - ATI PATA for new ATA layer | 2 | * pata_atiixp.c - ATI PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * (C) 2009 Bartlomiej Zolnierkiewicz | ||
4 | * | 5 | * |
5 | * Based on | 6 | * Based on |
6 | * | 7 | * |
@@ -61,20 +62,19 @@ static void atiixp_set_pio_timing(struct ata_port *ap, struct ata_device *adev, | |||
61 | 62 | ||
62 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 63 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
63 | int dn = 2 * ap->port_no + adev->devno; | 64 | int dn = 2 * ap->port_no + adev->devno; |
64 | |||
65 | /* Check this is correct - the order is odd in both drivers */ | ||
66 | int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); | 65 | int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); |
67 | u16 pio_mode_data, pio_timing_data; | 66 | u32 pio_timing_data; |
67 | u16 pio_mode_data; | ||
68 | 68 | ||
69 | pci_read_config_word(pdev, ATIIXP_IDE_PIO_MODE, &pio_mode_data); | 69 | pci_read_config_word(pdev, ATIIXP_IDE_PIO_MODE, &pio_mode_data); |
70 | pio_mode_data &= ~(0x7 << (4 * dn)); | 70 | pio_mode_data &= ~(0x7 << (4 * dn)); |
71 | pio_mode_data |= pio << (4 * dn); | 71 | pio_mode_data |= pio << (4 * dn); |
72 | pci_write_config_word(pdev, ATIIXP_IDE_PIO_MODE, pio_mode_data); | 72 | pci_write_config_word(pdev, ATIIXP_IDE_PIO_MODE, pio_mode_data); |
73 | 73 | ||
74 | pci_read_config_word(pdev, ATIIXP_IDE_PIO_TIMING, &pio_timing_data); | 74 | pci_read_config_dword(pdev, ATIIXP_IDE_PIO_TIMING, &pio_timing_data); |
75 | pio_timing_data &= ~(0xFF << timing_shift); | 75 | pio_timing_data &= ~(0xFF << timing_shift); |
76 | pio_timing_data |= (pio_timings[pio] << timing_shift); | 76 | pio_timing_data |= (pio_timings[pio] << timing_shift); |
77 | pci_write_config_word(pdev, ATIIXP_IDE_PIO_TIMING, pio_timing_data); | 77 | pci_write_config_dword(pdev, ATIIXP_IDE_PIO_TIMING, pio_timing_data); |
78 | } | 78 | } |
79 | 79 | ||
80 | /** | 80 | /** |
@@ -119,16 +119,17 @@ static void atiixp_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
119 | udma_mode_data |= dma << (4 * dn); | 119 | udma_mode_data |= dma << (4 * dn); |
120 | pci_write_config_word(pdev, ATIIXP_IDE_UDMA_MODE, udma_mode_data); | 120 | pci_write_config_word(pdev, ATIIXP_IDE_UDMA_MODE, udma_mode_data); |
121 | } else { | 121 | } else { |
122 | u16 mwdma_timing_data; | ||
123 | /* Check this is correct - the order is odd in both drivers */ | ||
124 | int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); | 122 | int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); |
123 | u32 mwdma_timing_data; | ||
125 | 124 | ||
126 | dma -= XFER_MW_DMA_0; | 125 | dma -= XFER_MW_DMA_0; |
127 | 126 | ||
128 | pci_read_config_word(pdev, ATIIXP_IDE_MWDMA_TIMING, &mwdma_timing_data); | 127 | pci_read_config_dword(pdev, ATIIXP_IDE_MWDMA_TIMING, |
128 | &mwdma_timing_data); | ||
129 | mwdma_timing_data &= ~(0xFF << timing_shift); | 129 | mwdma_timing_data &= ~(0xFF << timing_shift); |
130 | mwdma_timing_data |= (mwdma_timings[dma] << timing_shift); | 130 | mwdma_timing_data |= (mwdma_timings[dma] << timing_shift); |
131 | pci_write_config_word(pdev, ATIIXP_IDE_MWDMA_TIMING, mwdma_timing_data); | 131 | pci_write_config_dword(pdev, ATIIXP_IDE_MWDMA_TIMING, |
132 | mwdma_timing_data); | ||
132 | } | 133 | } |
133 | /* | 134 | /* |
134 | * We must now look at the PIO mode situation. We may need to | 135 | * We must now look at the PIO mode situation. We may need to |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index b2d11f300c39..86a40582999c 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -602,6 +602,7 @@ MODULE_VERSION(DRV_VERSION); | |||
602 | 602 | ||
603 | static int adma_enabled; | 603 | static int adma_enabled; |
604 | static int swncq_enabled = 1; | 604 | static int swncq_enabled = 1; |
605 | static int msi_enabled; | ||
605 | 606 | ||
606 | static void nv_adma_register_mode(struct ata_port *ap) | 607 | static void nv_adma_register_mode(struct ata_port *ap) |
607 | { | 608 | { |
@@ -2459,6 +2460,11 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2459 | } else if (type == SWNCQ) | 2460 | } else if (type == SWNCQ) |
2460 | nv_swncq_host_init(host); | 2461 | nv_swncq_host_init(host); |
2461 | 2462 | ||
2463 | if (msi_enabled) { | ||
2464 | dev_printk(KERN_NOTICE, &pdev->dev, "Using MSI\n"); | ||
2465 | pci_enable_msi(pdev); | ||
2466 | } | ||
2467 | |||
2462 | pci_set_master(pdev); | 2468 | pci_set_master(pdev); |
2463 | return ata_host_activate(host, pdev->irq, ipriv->irq_handler, | 2469 | return ata_host_activate(host, pdev->irq, ipriv->irq_handler, |
2464 | IRQF_SHARED, ipriv->sht); | 2470 | IRQF_SHARED, ipriv->sht); |
@@ -2558,4 +2564,6 @@ module_param_named(adma, adma_enabled, bool, 0444); | |||
2558 | MODULE_PARM_DESC(adma, "Enable use of ADMA (Default: false)"); | 2564 | MODULE_PARM_DESC(adma, "Enable use of ADMA (Default: false)"); |
2559 | module_param_named(swncq, swncq_enabled, bool, 0444); | 2565 | module_param_named(swncq, swncq_enabled, bool, 0444); |
2560 | MODULE_PARM_DESC(swncq, "Enable use of SWNCQ (Default: true)"); | 2566 | MODULE_PARM_DESC(swncq, "Enable use of SWNCQ (Default: true)"); |
2567 | module_param_named(msi, msi_enabled, bool, 0444); | ||
2568 | MODULE_PARM_DESC(msi, "Enable use of MSI (Default: false)"); | ||
2561 | 2569 | ||
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 81cb01bfc356..456594bd97bc 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -483,9 +483,6 @@ int platform_driver_register(struct platform_driver *drv) | |||
483 | drv->driver.remove = platform_drv_remove; | 483 | drv->driver.remove = platform_drv_remove; |
484 | if (drv->shutdown) | 484 | if (drv->shutdown) |
485 | drv->driver.shutdown = platform_drv_shutdown; | 485 | drv->driver.shutdown = platform_drv_shutdown; |
486 | if (drv->suspend || drv->resume) | ||
487 | pr_warning("Platform driver '%s' needs updating - please use " | ||
488 | "dev_pm_ops\n", drv->driver.name); | ||
489 | 486 | ||
490 | return driver_register(&drv->driver); | 487 | return driver_register(&drv->driver); |
491 | } | 488 | } |
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index 973be2f44195..4e28b35024ec 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -300,8 +300,7 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space) | |||
300 | if (space < 2) | 300 | if (space < 2) |
301 | return -1; | 301 | return -1; |
302 | tty->canon_column = tty->column = 0; | 302 | tty->canon_column = tty->column = 0; |
303 | tty_put_char(tty, '\r'); | 303 | tty->ops->write(tty, "\r\n", 2); |
304 | tty_put_char(tty, c); | ||
305 | return 2; | 304 | return 2; |
306 | } | 305 | } |
307 | tty->canon_column = tty->column; | 306 | tty->canon_column = tty->column; |
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index d083c73d784a..b33d6688e910 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
@@ -109,21 +109,13 @@ static int pty_space(struct tty_struct *to) | |||
109 | * the other side of the pty/tty pair. | 109 | * the other side of the pty/tty pair. |
110 | */ | 110 | */ |
111 | 111 | ||
112 | static int pty_write(struct tty_struct *tty, const unsigned char *buf, | 112 | static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) |
113 | int count) | ||
114 | { | 113 | { |
115 | struct tty_struct *to = tty->link; | 114 | struct tty_struct *to = tty->link; |
116 | int c; | ||
117 | 115 | ||
118 | if (tty->stopped) | 116 | if (tty->stopped) |
119 | return 0; | 117 | return 0; |
120 | 118 | ||
121 | /* This isn't locked but our 8K is quite sloppy so no | ||
122 | big deal */ | ||
123 | |||
124 | c = pty_space(to); | ||
125 | if (c > count) | ||
126 | c = count; | ||
127 | if (c > 0) { | 119 | if (c > 0) { |
128 | /* Stuff the data into the input queue of the other end */ | 120 | /* Stuff the data into the input queue of the other end */ |
129 | c = tty_insert_flip_string(to, buf, c); | 121 | c = tty_insert_flip_string(to, buf, c); |
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c index 1733d3439ad2..e48af9f79219 100644 --- a/drivers/char/tty_ldisc.c +++ b/drivers/char/tty_ldisc.c | |||
@@ -508,8 +508,9 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) | |||
508 | * be obtained while the delayed work queue halt ensures that no more | 508 | * be obtained while the delayed work queue halt ensures that no more |
509 | * data is fed to the ldisc. | 509 | * data is fed to the ldisc. |
510 | * | 510 | * |
511 | * In order to wait for any existing references to complete see | 511 | * You need to do a 'flush_scheduled_work()' (outside the ldisc_mutex) |
512 | * tty_ldisc_wait_idle. | 512 | * in order to make sure any currently executing ldisc work is also |
513 | * flushed. | ||
513 | */ | 514 | */ |
514 | 515 | ||
515 | static int tty_ldisc_halt(struct tty_struct *tty) | 516 | static int tty_ldisc_halt(struct tty_struct *tty) |
@@ -753,11 +754,14 @@ void tty_ldisc_hangup(struct tty_struct *tty) | |||
753 | * N_TTY. | 754 | * N_TTY. |
754 | */ | 755 | */ |
755 | if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { | 756 | if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { |
757 | /* Make sure the old ldisc is quiescent */ | ||
758 | tty_ldisc_halt(tty); | ||
759 | flush_scheduled_work(); | ||
760 | |||
756 | /* Avoid racing set_ldisc or tty_ldisc_release */ | 761 | /* Avoid racing set_ldisc or tty_ldisc_release */ |
757 | mutex_lock(&tty->ldisc_mutex); | 762 | mutex_lock(&tty->ldisc_mutex); |
758 | if (tty->ldisc) { /* Not yet closed */ | 763 | if (tty->ldisc) { /* Not yet closed */ |
759 | /* Switch back to N_TTY */ | 764 | /* Switch back to N_TTY */ |
760 | tty_ldisc_halt(tty); | ||
761 | tty_ldisc_reinit(tty); | 765 | tty_ldisc_reinit(tty); |
762 | /* At this point we have a closed ldisc and we want to | 766 | /* At this point we have a closed ldisc and we want to |
763 | reopen it. We could defer this to the next open but | 767 | reopen it. We could defer this to the next open but |
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 2964f5f4a7ef..6b3e0c2f33e2 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -40,6 +40,7 @@ struct sh_cmt_priv { | |||
40 | struct platform_device *pdev; | 40 | struct platform_device *pdev; |
41 | 41 | ||
42 | unsigned long flags; | 42 | unsigned long flags; |
43 | unsigned long flags_suspend; | ||
43 | unsigned long match_value; | 44 | unsigned long match_value; |
44 | unsigned long next_match_value; | 45 | unsigned long next_match_value; |
45 | unsigned long max_match_value; | 46 | unsigned long max_match_value; |
@@ -667,11 +668,38 @@ static int __devexit sh_cmt_remove(struct platform_device *pdev) | |||
667 | return -EBUSY; /* cannot unregister clockevent and clocksource */ | 668 | return -EBUSY; /* cannot unregister clockevent and clocksource */ |
668 | } | 669 | } |
669 | 670 | ||
671 | static int sh_cmt_suspend(struct device *dev) | ||
672 | { | ||
673 | struct platform_device *pdev = to_platform_device(dev); | ||
674 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); | ||
675 | |||
676 | /* save flag state and stop CMT channel */ | ||
677 | p->flags_suspend = p->flags; | ||
678 | sh_cmt_stop(p, p->flags); | ||
679 | return 0; | ||
680 | } | ||
681 | |||
682 | static int sh_cmt_resume(struct device *dev) | ||
683 | { | ||
684 | struct platform_device *pdev = to_platform_device(dev); | ||
685 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); | ||
686 | |||
687 | /* start CMT channel from saved state */ | ||
688 | sh_cmt_start(p, p->flags_suspend); | ||
689 | return 0; | ||
690 | } | ||
691 | |||
692 | static struct dev_pm_ops sh_cmt_dev_pm_ops = { | ||
693 | .suspend = sh_cmt_suspend, | ||
694 | .resume = sh_cmt_resume, | ||
695 | }; | ||
696 | |||
670 | static struct platform_driver sh_cmt_device_driver = { | 697 | static struct platform_driver sh_cmt_device_driver = { |
671 | .probe = sh_cmt_probe, | 698 | .probe = sh_cmt_probe, |
672 | .remove = __devexit_p(sh_cmt_remove), | 699 | .remove = __devexit_p(sh_cmt_remove), |
673 | .driver = { | 700 | .driver = { |
674 | .name = "sh_cmt", | 701 | .name = "sh_cmt", |
702 | .pm = &sh_cmt_dev_pm_ops, | ||
675 | } | 703 | } |
676 | }; | 704 | }; |
677 | 705 | ||
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index fd69086d08d5..2968ed6a9c49 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1250,20 +1250,11 @@ static int cpufreq_suspend(struct sys_device *sysdev, pm_message_t pmsg) | |||
1250 | { | 1250 | { |
1251 | int ret = 0; | 1251 | int ret = 0; |
1252 | 1252 | ||
1253 | #ifdef __powerpc__ | ||
1254 | int cpu = sysdev->id; | 1253 | int cpu = sysdev->id; |
1255 | unsigned int cur_freq = 0; | ||
1256 | struct cpufreq_policy *cpu_policy; | 1254 | struct cpufreq_policy *cpu_policy; |
1257 | 1255 | ||
1258 | dprintk("suspending cpu %u\n", cpu); | 1256 | dprintk("suspending cpu %u\n", cpu); |
1259 | 1257 | ||
1260 | /* | ||
1261 | * This whole bogosity is here because Powerbooks are made of fail. | ||
1262 | * No sane platform should need any of the code below to be run. | ||
1263 | * (it's entirely the wrong thing to do, as driver->get may | ||
1264 | * reenable interrupts on some architectures). | ||
1265 | */ | ||
1266 | |||
1267 | if (!cpu_online(cpu)) | 1258 | if (!cpu_online(cpu)) |
1268 | return 0; | 1259 | return 0; |
1269 | 1260 | ||
@@ -1282,47 +1273,13 @@ static int cpufreq_suspend(struct sys_device *sysdev, pm_message_t pmsg) | |||
1282 | 1273 | ||
1283 | if (cpufreq_driver->suspend) { | 1274 | if (cpufreq_driver->suspend) { |
1284 | ret = cpufreq_driver->suspend(cpu_policy, pmsg); | 1275 | ret = cpufreq_driver->suspend(cpu_policy, pmsg); |
1285 | if (ret) { | 1276 | if (ret) |
1286 | printk(KERN_ERR "cpufreq: suspend failed in ->suspend " | 1277 | printk(KERN_ERR "cpufreq: suspend failed in ->suspend " |
1287 | "step on CPU %u\n", cpu_policy->cpu); | 1278 | "step on CPU %u\n", cpu_policy->cpu); |
1288 | goto out; | ||
1289 | } | ||
1290 | } | ||
1291 | |||
1292 | if (cpufreq_driver->flags & CPUFREQ_CONST_LOOPS) | ||
1293 | goto out; | ||
1294 | |||
1295 | if (cpufreq_driver->get) | ||
1296 | cur_freq = cpufreq_driver->get(cpu_policy->cpu); | ||
1297 | |||
1298 | if (!cur_freq || !cpu_policy->cur) { | ||
1299 | printk(KERN_ERR "cpufreq: suspend failed to assert current " | ||
1300 | "frequency is what timing core thinks it is.\n"); | ||
1301 | goto out; | ||
1302 | } | ||
1303 | |||
1304 | if (unlikely(cur_freq != cpu_policy->cur)) { | ||
1305 | struct cpufreq_freqs freqs; | ||
1306 | |||
1307 | if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN)) | ||
1308 | dprintk("Warning: CPU frequency is %u, " | ||
1309 | "cpufreq assumed %u kHz.\n", | ||
1310 | cur_freq, cpu_policy->cur); | ||
1311 | |||
1312 | freqs.cpu = cpu; | ||
1313 | freqs.old = cpu_policy->cur; | ||
1314 | freqs.new = cur_freq; | ||
1315 | |||
1316 | srcu_notifier_call_chain(&cpufreq_transition_notifier_list, | ||
1317 | CPUFREQ_SUSPENDCHANGE, &freqs); | ||
1318 | adjust_jiffies(CPUFREQ_SUSPENDCHANGE, &freqs); | ||
1319 | |||
1320 | cpu_policy->cur = cur_freq; | ||
1321 | } | 1279 | } |
1322 | 1280 | ||
1323 | out: | 1281 | out: |
1324 | cpufreq_cpu_put(cpu_policy); | 1282 | cpufreq_cpu_put(cpu_policy); |
1325 | #endif /* __powerpc__ */ | ||
1326 | return ret; | 1283 | return ret; |
1327 | } | 1284 | } |
1328 | 1285 | ||
@@ -1330,24 +1287,21 @@ out: | |||
1330 | * cpufreq_resume - restore proper CPU frequency handling after resume | 1287 | * cpufreq_resume - restore proper CPU frequency handling after resume |
1331 | * | 1288 | * |
1332 | * 1.) resume CPUfreq hardware support (cpufreq_driver->resume()) | 1289 | * 1.) resume CPUfreq hardware support (cpufreq_driver->resume()) |
1333 | * 2.) if ->target and !CPUFREQ_CONST_LOOPS: verify we're in sync | 1290 | * 2.) schedule call cpufreq_update_policy() ASAP as interrupts are |
1334 | * 3.) schedule call cpufreq_update_policy() ASAP as interrupts are | 1291 | * restored. It will verify that the current freq is in sync with |
1335 | * restored. | 1292 | * what we believe it to be. This is a bit later than when it |
1293 | * should be, but nonethteless it's better than calling | ||
1294 | * cpufreq_driver->get() here which might re-enable interrupts... | ||
1336 | */ | 1295 | */ |
1337 | static int cpufreq_resume(struct sys_device *sysdev) | 1296 | static int cpufreq_resume(struct sys_device *sysdev) |
1338 | { | 1297 | { |
1339 | int ret = 0; | 1298 | int ret = 0; |
1340 | 1299 | ||
1341 | #ifdef __powerpc__ | ||
1342 | int cpu = sysdev->id; | 1300 | int cpu = sysdev->id; |
1343 | struct cpufreq_policy *cpu_policy; | 1301 | struct cpufreq_policy *cpu_policy; |
1344 | 1302 | ||
1345 | dprintk("resuming cpu %u\n", cpu); | 1303 | dprintk("resuming cpu %u\n", cpu); |
1346 | 1304 | ||
1347 | /* As with the ->suspend method, all the code below is | ||
1348 | * only necessary because Powerbooks suck. | ||
1349 | * See commit 42d4dc3f4e1e for jokes. */ | ||
1350 | |||
1351 | if (!cpu_online(cpu)) | 1305 | if (!cpu_online(cpu)) |
1352 | return 0; | 1306 | return 0; |
1353 | 1307 | ||
@@ -1373,45 +1327,10 @@ static int cpufreq_resume(struct sys_device *sysdev) | |||
1373 | } | 1327 | } |
1374 | } | 1328 | } |
1375 | 1329 | ||
1376 | if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) { | ||
1377 | unsigned int cur_freq = 0; | ||
1378 | |||
1379 | if (cpufreq_driver->get) | ||
1380 | cur_freq = cpufreq_driver->get(cpu_policy->cpu); | ||
1381 | |||
1382 | if (!cur_freq || !cpu_policy->cur) { | ||
1383 | printk(KERN_ERR "cpufreq: resume failed to assert " | ||
1384 | "current frequency is what timing core " | ||
1385 | "thinks it is.\n"); | ||
1386 | goto out; | ||
1387 | } | ||
1388 | |||
1389 | if (unlikely(cur_freq != cpu_policy->cur)) { | ||
1390 | struct cpufreq_freqs freqs; | ||
1391 | |||
1392 | if (!(cpufreq_driver->flags & CPUFREQ_PM_NO_WARN)) | ||
1393 | dprintk("Warning: CPU frequency " | ||
1394 | "is %u, cpufreq assumed %u kHz.\n", | ||
1395 | cur_freq, cpu_policy->cur); | ||
1396 | |||
1397 | freqs.cpu = cpu; | ||
1398 | freqs.old = cpu_policy->cur; | ||
1399 | freqs.new = cur_freq; | ||
1400 | |||
1401 | srcu_notifier_call_chain( | ||
1402 | &cpufreq_transition_notifier_list, | ||
1403 | CPUFREQ_RESUMECHANGE, &freqs); | ||
1404 | adjust_jiffies(CPUFREQ_RESUMECHANGE, &freqs); | ||
1405 | |||
1406 | cpu_policy->cur = cur_freq; | ||
1407 | } | ||
1408 | } | ||
1409 | |||
1410 | out: | ||
1411 | schedule_work(&cpu_policy->update); | 1330 | schedule_work(&cpu_policy->update); |
1331 | |||
1412 | fail: | 1332 | fail: |
1413 | cpufreq_cpu_put(cpu_policy); | 1333 | cpufreq_cpu_put(cpu_policy); |
1414 | #endif /* __powerpc__ */ | ||
1415 | return ret; | 1334 | return ret; |
1416 | } | 1335 | } |
1417 | 1336 | ||
diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c index 110e731f5574..1c0b504a42f3 100644 --- a/drivers/firewire/core-iso.c +++ b/drivers/firewire/core-iso.c | |||
@@ -196,7 +196,7 @@ static int manage_bandwidth(struct fw_card *card, int irm_id, int generation, | |||
196 | switch (fw_run_transaction(card, TCODE_LOCK_COMPARE_SWAP, | 196 | switch (fw_run_transaction(card, TCODE_LOCK_COMPARE_SWAP, |
197 | irm_id, generation, SCODE_100, | 197 | irm_id, generation, SCODE_100, |
198 | CSR_REGISTER_BASE + CSR_BANDWIDTH_AVAILABLE, | 198 | CSR_REGISTER_BASE + CSR_BANDWIDTH_AVAILABLE, |
199 | data, sizeof(data))) { | 199 | data, 8)) { |
200 | case RCODE_GENERATION: | 200 | case RCODE_GENERATION: |
201 | /* A generation change frees all bandwidth. */ | 201 | /* A generation change frees all bandwidth. */ |
202 | return allocate ? -EAGAIN : bandwidth; | 202 | return allocate ? -EAGAIN : bandwidth; |
@@ -233,7 +233,7 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation, | |||
233 | data[1] = old ^ c; | 233 | data[1] = old ^ c; |
234 | switch (fw_run_transaction(card, TCODE_LOCK_COMPARE_SWAP, | 234 | switch (fw_run_transaction(card, TCODE_LOCK_COMPARE_SWAP, |
235 | irm_id, generation, SCODE_100, | 235 | irm_id, generation, SCODE_100, |
236 | offset, data, sizeof(data))) { | 236 | offset, data, 8)) { |
237 | case RCODE_GENERATION: | 237 | case RCODE_GENERATION: |
238 | /* A generation change frees all channels. */ | 238 | /* A generation change frees all channels. */ |
239 | return allocate ? -EAGAIN : i; | 239 | return allocate ? -EAGAIN : i; |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index ecddd11b797a..76b321bb73f9 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
36 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
37 | #include <linux/pci_ids.h> | ||
37 | #include <linux/spinlock.h> | 38 | #include <linux/spinlock.h> |
38 | #include <linux/string.h> | 39 | #include <linux/string.h> |
39 | 40 | ||
@@ -2372,6 +2373,9 @@ static void ohci_pmac_off(struct pci_dev *dev) | |||
2372 | #define ohci_pmac_off(dev) | 2373 | #define ohci_pmac_off(dev) |
2373 | #endif /* CONFIG_PPC_PMAC */ | 2374 | #endif /* CONFIG_PPC_PMAC */ |
2374 | 2375 | ||
2376 | #define PCI_VENDOR_ID_AGERE PCI_VENDOR_ID_ATT | ||
2377 | #define PCI_DEVICE_ID_AGERE_FW643 0x5901 | ||
2378 | |||
2375 | static int __devinit pci_probe(struct pci_dev *dev, | 2379 | static int __devinit pci_probe(struct pci_dev *dev, |
2376 | const struct pci_device_id *ent) | 2380 | const struct pci_device_id *ent) |
2377 | { | 2381 | { |
@@ -2422,6 +2426,16 @@ static int __devinit pci_probe(struct pci_dev *dev, | |||
2422 | version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; | 2426 | version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; |
2423 | ohci->use_dualbuffer = version >= OHCI_VERSION_1_1; | 2427 | ohci->use_dualbuffer = version >= OHCI_VERSION_1_1; |
2424 | 2428 | ||
2429 | /* dual-buffer mode is broken if more than one IR context is active */ | ||
2430 | if (dev->vendor == PCI_VENDOR_ID_AGERE && | ||
2431 | dev->device == PCI_DEVICE_ID_AGERE_FW643) | ||
2432 | ohci->use_dualbuffer = false; | ||
2433 | |||
2434 | /* dual-buffer mode is broken */ | ||
2435 | if (dev->vendor == PCI_VENDOR_ID_RICOH && | ||
2436 | dev->device == PCI_DEVICE_ID_RICOH_R5C832) | ||
2437 | ohci->use_dualbuffer = false; | ||
2438 | |||
2425 | /* x86-32 currently doesn't use highmem for dma_alloc_coherent */ | 2439 | /* x86-32 currently doesn't use highmem for dma_alloc_coherent */ |
2426 | #if !defined(CONFIG_X86_32) | 2440 | #if !defined(CONFIG_X86_32) |
2427 | /* dual-buffer mode is broken with descriptor addresses above 2G */ | 2441 | /* dual-buffer mode is broken with descriptor addresses above 2G */ |
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 8d51568ee143..e5df822a8130 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -456,12 +456,12 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request, | |||
456 | } | 456 | } |
457 | spin_unlock_irqrestore(&card->lock, flags); | 457 | spin_unlock_irqrestore(&card->lock, flags); |
458 | 458 | ||
459 | if (&orb->link != &lu->orb_list) | 459 | if (&orb->link != &lu->orb_list) { |
460 | orb->callback(orb, &status); | 460 | orb->callback(orb, &status); |
461 | else | 461 | kref_put(&orb->kref, free_orb); |
462 | } else { | ||
462 | fw_error("status write for unknown orb\n"); | 463 | fw_error("status write for unknown orb\n"); |
463 | 464 | } | |
464 | kref_put(&orb->kref, free_orb); | ||
465 | 465 | ||
466 | fw_send_response(card, request, RCODE_COMPLETE); | 466 | fw_send_response(card, request, RCODE_COMPLETE); |
467 | } | 467 | } |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 33be210d6723..2f631c75f704 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -258,31 +258,6 @@ void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type) | |||
258 | EXPORT_SYMBOL(drm_mode_object_find); | 258 | EXPORT_SYMBOL(drm_mode_object_find); |
259 | 259 | ||
260 | /** | 260 | /** |
261 | * drm_crtc_from_fb - find the CRTC structure associated with an fb | ||
262 | * @dev: DRM device | ||
263 | * @fb: framebuffer in question | ||
264 | * | ||
265 | * LOCKING: | ||
266 | * Caller must hold mode_config lock. | ||
267 | * | ||
268 | * Find CRTC in the mode_config structure that matches @fb. | ||
269 | * | ||
270 | * RETURNS: | ||
271 | * Pointer to the CRTC or NULL if it wasn't found. | ||
272 | */ | ||
273 | struct drm_crtc *drm_crtc_from_fb(struct drm_device *dev, | ||
274 | struct drm_framebuffer *fb) | ||
275 | { | ||
276 | struct drm_crtc *crtc; | ||
277 | |||
278 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
279 | if (crtc->fb == fb) | ||
280 | return crtc; | ||
281 | } | ||
282 | return NULL; | ||
283 | } | ||
284 | |||
285 | /** | ||
286 | * drm_framebuffer_init - initialize a framebuffer | 261 | * drm_framebuffer_init - initialize a framebuffer |
287 | * @dev: DRM device | 262 | * @dev: DRM device |
288 | * | 263 | * |
@@ -328,11 +303,20 @@ void drm_framebuffer_cleanup(struct drm_framebuffer *fb) | |||
328 | { | 303 | { |
329 | struct drm_device *dev = fb->dev; | 304 | struct drm_device *dev = fb->dev; |
330 | struct drm_crtc *crtc; | 305 | struct drm_crtc *crtc; |
306 | struct drm_mode_set set; | ||
307 | int ret; | ||
331 | 308 | ||
332 | /* remove from any CRTC */ | 309 | /* remove from any CRTC */ |
333 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 310 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
334 | if (crtc->fb == fb) | 311 | if (crtc->fb == fb) { |
335 | crtc->fb = NULL; | 312 | /* should turn off the crtc */ |
313 | memset(&set, 0, sizeof(struct drm_mode_set)); | ||
314 | set.crtc = crtc; | ||
315 | set.fb = NULL; | ||
316 | ret = crtc->funcs->set_config(&set); | ||
317 | if (ret) | ||
318 | DRM_ERROR("failed to reset crtc %p when fb was deleted\n", crtc); | ||
319 | } | ||
336 | } | 320 | } |
337 | 321 | ||
338 | drm_mode_object_put(dev, &fb->base); | 322 | drm_mode_object_put(dev, &fb->base); |
@@ -1511,7 +1495,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, | |||
1511 | set.mode = mode; | 1495 | set.mode = mode; |
1512 | set.connectors = connector_set; | 1496 | set.connectors = connector_set; |
1513 | set.num_connectors = crtc_req->count_connectors; | 1497 | set.num_connectors = crtc_req->count_connectors; |
1514 | set.fb =fb; | 1498 | set.fb = fb; |
1515 | ret = crtc->funcs->set_config(&set); | 1499 | ret = crtc->funcs->set_config(&set); |
1516 | 1500 | ||
1517 | out: | 1501 | out: |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 80cc6d06d61b..7f2728bbc16c 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -502,12 +502,40 @@ static int add_detailed_info(struct drm_connector *connector, | |||
502 | struct detailed_non_pixel *data = &timing->data.other_data; | 502 | struct detailed_non_pixel *data = &timing->data.other_data; |
503 | struct drm_display_mode *newmode; | 503 | struct drm_display_mode *newmode; |
504 | 504 | ||
505 | /* EDID up to and including 1.2 may put monitor info here */ | 505 | /* X server check is version 1.1 or higher */ |
506 | if (edid->version == 1 && edid->revision < 3) | 506 | if (edid->version == 1 && edid->revision >= 1 && |
507 | continue; | 507 | !timing->pixel_clock) { |
508 | 508 | /* Other timing or info */ | |
509 | /* Detailed mode timing */ | 509 | switch (data->type) { |
510 | if (timing->pixel_clock) { | 510 | case EDID_DETAIL_MONITOR_SERIAL: |
511 | break; | ||
512 | case EDID_DETAIL_MONITOR_STRING: | ||
513 | break; | ||
514 | case EDID_DETAIL_MONITOR_RANGE: | ||
515 | /* Get monitor range data */ | ||
516 | break; | ||
517 | case EDID_DETAIL_MONITOR_NAME: | ||
518 | break; | ||
519 | case EDID_DETAIL_MONITOR_CPDATA: | ||
520 | break; | ||
521 | case EDID_DETAIL_STD_MODES: | ||
522 | /* Five modes per detailed section */ | ||
523 | for (j = 0; j < 5; i++) { | ||
524 | struct std_timing *std; | ||
525 | struct drm_display_mode *newmode; | ||
526 | |||
527 | std = &data->data.timings[j]; | ||
528 | newmode = drm_mode_std(dev, std); | ||
529 | if (newmode) { | ||
530 | drm_mode_probed_add(connector, newmode); | ||
531 | modes++; | ||
532 | } | ||
533 | } | ||
534 | break; | ||
535 | default: | ||
536 | break; | ||
537 | } | ||
538 | } else { | ||
511 | newmode = drm_mode_detailed(dev, edid, timing, quirks); | 539 | newmode = drm_mode_detailed(dev, edid, timing, quirks); |
512 | if (!newmode) | 540 | if (!newmode) |
513 | continue; | 541 | continue; |
@@ -518,38 +546,6 @@ static int add_detailed_info(struct drm_connector *connector, | |||
518 | drm_mode_probed_add(connector, newmode); | 546 | drm_mode_probed_add(connector, newmode); |
519 | 547 | ||
520 | modes++; | 548 | modes++; |
521 | continue; | ||
522 | } | ||
523 | |||
524 | /* Other timing or info */ | ||
525 | switch (data->type) { | ||
526 | case EDID_DETAIL_MONITOR_SERIAL: | ||
527 | break; | ||
528 | case EDID_DETAIL_MONITOR_STRING: | ||
529 | break; | ||
530 | case EDID_DETAIL_MONITOR_RANGE: | ||
531 | /* Get monitor range data */ | ||
532 | break; | ||
533 | case EDID_DETAIL_MONITOR_NAME: | ||
534 | break; | ||
535 | case EDID_DETAIL_MONITOR_CPDATA: | ||
536 | break; | ||
537 | case EDID_DETAIL_STD_MODES: | ||
538 | /* Five modes per detailed section */ | ||
539 | for (j = 0; j < 5; i++) { | ||
540 | struct std_timing *std; | ||
541 | struct drm_display_mode *newmode; | ||
542 | |||
543 | std = &data->data.timings[j]; | ||
544 | newmode = drm_mode_std(dev, std); | ||
545 | if (newmode) { | ||
546 | drm_mode_probed_add(connector, newmode); | ||
547 | modes++; | ||
548 | } | ||
549 | } | ||
550 | break; | ||
551 | default: | ||
552 | break; | ||
553 | } | 549 | } |
554 | } | 550 | } |
555 | 551 | ||
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 85ec31b3ff00..f7a615b80c70 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
@@ -22,44 +22,50 @@ | |||
22 | #define to_drm_minor(d) container_of(d, struct drm_minor, kdev) | 22 | #define to_drm_minor(d) container_of(d, struct drm_minor, kdev) |
23 | #define to_drm_connector(d) container_of(d, struct drm_connector, kdev) | 23 | #define to_drm_connector(d) container_of(d, struct drm_connector, kdev) |
24 | 24 | ||
25 | static struct device_type drm_sysfs_device_minor = { | ||
26 | .name = "drm_minor" | ||
27 | }; | ||
28 | |||
25 | /** | 29 | /** |
26 | * drm_sysfs_suspend - DRM class suspend hook | 30 | * drm_class_suspend - DRM class suspend hook |
27 | * @dev: Linux device to suspend | 31 | * @dev: Linux device to suspend |
28 | * @state: power state to enter | 32 | * @state: power state to enter |
29 | * | 33 | * |
30 | * Just figures out what the actual struct drm_device associated with | 34 | * Just figures out what the actual struct drm_device associated with |
31 | * @dev is and calls its suspend hook, if present. | 35 | * @dev is and calls its suspend hook, if present. |
32 | */ | 36 | */ |
33 | static int drm_sysfs_suspend(struct device *dev, pm_message_t state) | 37 | static int drm_class_suspend(struct device *dev, pm_message_t state) |
34 | { | 38 | { |
35 | struct drm_minor *drm_minor = to_drm_minor(dev); | 39 | if (dev->type == &drm_sysfs_device_minor) { |
36 | struct drm_device *drm_dev = drm_minor->dev; | 40 | struct drm_minor *drm_minor = to_drm_minor(dev); |
37 | 41 | struct drm_device *drm_dev = drm_minor->dev; | |
38 | if (drm_minor->type == DRM_MINOR_LEGACY && | 42 | |
39 | !drm_core_check_feature(drm_dev, DRIVER_MODESET) && | 43 | if (drm_minor->type == DRM_MINOR_LEGACY && |
40 | drm_dev->driver->suspend) | 44 | !drm_core_check_feature(drm_dev, DRIVER_MODESET) && |
41 | return drm_dev->driver->suspend(drm_dev, state); | 45 | drm_dev->driver->suspend) |
42 | 46 | return drm_dev->driver->suspend(drm_dev, state); | |
47 | } | ||
43 | return 0; | 48 | return 0; |
44 | } | 49 | } |
45 | 50 | ||
46 | /** | 51 | /** |
47 | * drm_sysfs_resume - DRM class resume hook | 52 | * drm_class_resume - DRM class resume hook |
48 | * @dev: Linux device to resume | 53 | * @dev: Linux device to resume |
49 | * | 54 | * |
50 | * Just figures out what the actual struct drm_device associated with | 55 | * Just figures out what the actual struct drm_device associated with |
51 | * @dev is and calls its resume hook, if present. | 56 | * @dev is and calls its resume hook, if present. |
52 | */ | 57 | */ |
53 | static int drm_sysfs_resume(struct device *dev) | 58 | static int drm_class_resume(struct device *dev) |
54 | { | 59 | { |
55 | struct drm_minor *drm_minor = to_drm_minor(dev); | 60 | if (dev->type == &drm_sysfs_device_minor) { |
56 | struct drm_device *drm_dev = drm_minor->dev; | 61 | struct drm_minor *drm_minor = to_drm_minor(dev); |
57 | 62 | struct drm_device *drm_dev = drm_minor->dev; | |
58 | if (drm_minor->type == DRM_MINOR_LEGACY && | 63 | |
59 | !drm_core_check_feature(drm_dev, DRIVER_MODESET) && | 64 | if (drm_minor->type == DRM_MINOR_LEGACY && |
60 | drm_dev->driver->resume) | 65 | !drm_core_check_feature(drm_dev, DRIVER_MODESET) && |
61 | return drm_dev->driver->resume(drm_dev); | 66 | drm_dev->driver->resume) |
62 | 67 | return drm_dev->driver->resume(drm_dev); | |
68 | } | ||
63 | return 0; | 69 | return 0; |
64 | } | 70 | } |
65 | 71 | ||
@@ -99,8 +105,8 @@ struct class *drm_sysfs_create(struct module *owner, char *name) | |||
99 | goto err_out; | 105 | goto err_out; |
100 | } | 106 | } |
101 | 107 | ||
102 | class->suspend = drm_sysfs_suspend; | 108 | class->suspend = drm_class_suspend; |
103 | class->resume = drm_sysfs_resume; | 109 | class->resume = drm_class_resume; |
104 | 110 | ||
105 | err = class_create_file(class, &class_attr_version); | 111 | err = class_create_file(class, &class_attr_version); |
106 | if (err) | 112 | if (err) |
@@ -480,6 +486,7 @@ int drm_sysfs_device_add(struct drm_minor *minor) | |||
480 | minor->kdev.class = drm_class; | 486 | minor->kdev.class = drm_class; |
481 | minor->kdev.release = drm_sysfs_device_release; | 487 | minor->kdev.release = drm_sysfs_device_release; |
482 | minor->kdev.devt = minor->device; | 488 | minor->kdev.devt = minor->device; |
489 | minor->kdev.type = &drm_sysfs_device_minor; | ||
483 | if (minor->type == DRM_MINOR_CONTROL) | 490 | if (minor->type == DRM_MINOR_CONTROL) |
484 | minor_str = "controlD%d"; | 491 | minor_str = "controlD%d"; |
485 | else if (minor->type == DRM_MINOR_RENDER) | 492 | else if (minor->type == DRM_MINOR_RENDER) |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 7537f57d8a87..5b4f87e55621 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -222,6 +222,7 @@ typedef struct drm_i915_private { | |||
222 | unsigned int edp_support:1; | 222 | unsigned int edp_support:1; |
223 | int lvds_ssc_freq; | 223 | int lvds_ssc_freq; |
224 | 224 | ||
225 | int crt_ddc_bus; /* -1 = unknown, else GPIO to use for CRT DDC */ | ||
225 | struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */ | 226 | struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */ |
226 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ | 227 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ |
227 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ | 228 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ |
@@ -384,6 +385,9 @@ typedef struct drm_i915_private { | |||
384 | */ | 385 | */ |
385 | struct list_head inactive_list; | 386 | struct list_head inactive_list; |
386 | 387 | ||
388 | /** LRU list of objects with fence regs on them. */ | ||
389 | struct list_head fence_list; | ||
390 | |||
387 | /** | 391 | /** |
388 | * List of breadcrumbs associated with GPU requests currently | 392 | * List of breadcrumbs associated with GPU requests currently |
389 | * outstanding. | 393 | * outstanding. |
@@ -451,6 +455,9 @@ struct drm_i915_gem_object { | |||
451 | /** This object's place on the active/flushing/inactive lists */ | 455 | /** This object's place on the active/flushing/inactive lists */ |
452 | struct list_head list; | 456 | struct list_head list; |
453 | 457 | ||
458 | /** This object's place on the fenced object LRU */ | ||
459 | struct list_head fence_list; | ||
460 | |||
454 | /** | 461 | /** |
455 | * This is set if the object is on the active or flushing lists | 462 | * This is set if the object is on the active or flushing lists |
456 | * (has pending rendering), and is not set if it's on inactive (ready | 463 | * (has pending rendering), and is not set if it's on inactive (ready |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 140bee142fc2..0c07a755b3a3 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -978,6 +978,7 @@ int | |||
978 | i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, | 978 | i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, |
979 | struct drm_file *file_priv) | 979 | struct drm_file *file_priv) |
980 | { | 980 | { |
981 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
981 | struct drm_i915_gem_set_domain *args = data; | 982 | struct drm_i915_gem_set_domain *args = data; |
982 | struct drm_gem_object *obj; | 983 | struct drm_gem_object *obj; |
983 | uint32_t read_domains = args->read_domains; | 984 | uint32_t read_domains = args->read_domains; |
@@ -1010,8 +1011,18 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, | |||
1010 | obj, obj->size, read_domains, write_domain); | 1011 | obj, obj->size, read_domains, write_domain); |
1011 | #endif | 1012 | #endif |
1012 | if (read_domains & I915_GEM_DOMAIN_GTT) { | 1013 | if (read_domains & I915_GEM_DOMAIN_GTT) { |
1014 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | ||
1015 | |||
1013 | ret = i915_gem_object_set_to_gtt_domain(obj, write_domain != 0); | 1016 | ret = i915_gem_object_set_to_gtt_domain(obj, write_domain != 0); |
1014 | 1017 | ||
1018 | /* Update the LRU on the fence for the CPU access that's | ||
1019 | * about to occur. | ||
1020 | */ | ||
1021 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) { | ||
1022 | list_move_tail(&obj_priv->fence_list, | ||
1023 | &dev_priv->mm.fence_list); | ||
1024 | } | ||
1025 | |||
1015 | /* Silently promote "you're not bound, there was nothing to do" | 1026 | /* Silently promote "you're not bound, there was nothing to do" |
1016 | * to success, since the client was just asking us to | 1027 | * to success, since the client was just asking us to |
1017 | * make sure everything was done. | 1028 | * make sure everything was done. |
@@ -1155,8 +1166,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
1155 | } | 1166 | } |
1156 | 1167 | ||
1157 | /* Need a new fence register? */ | 1168 | /* Need a new fence register? */ |
1158 | if (obj_priv->fence_reg == I915_FENCE_REG_NONE && | 1169 | if (obj_priv->tiling_mode != I915_TILING_NONE) { |
1159 | obj_priv->tiling_mode != I915_TILING_NONE) { | ||
1160 | ret = i915_gem_object_get_fence_reg(obj); | 1170 | ret = i915_gem_object_get_fence_reg(obj); |
1161 | if (ret) { | 1171 | if (ret) { |
1162 | mutex_unlock(&dev->struct_mutex); | 1172 | mutex_unlock(&dev->struct_mutex); |
@@ -2208,6 +2218,12 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj) | |||
2208 | struct drm_i915_gem_object *old_obj_priv = NULL; | 2218 | struct drm_i915_gem_object *old_obj_priv = NULL; |
2209 | int i, ret, avail; | 2219 | int i, ret, avail; |
2210 | 2220 | ||
2221 | /* Just update our place in the LRU if our fence is getting used. */ | ||
2222 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) { | ||
2223 | list_move_tail(&obj_priv->fence_list, &dev_priv->mm.fence_list); | ||
2224 | return 0; | ||
2225 | } | ||
2226 | |||
2211 | switch (obj_priv->tiling_mode) { | 2227 | switch (obj_priv->tiling_mode) { |
2212 | case I915_TILING_NONE: | 2228 | case I915_TILING_NONE: |
2213 | WARN(1, "allocating a fence for non-tiled object?\n"); | 2229 | WARN(1, "allocating a fence for non-tiled object?\n"); |
@@ -2229,7 +2245,6 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj) | |||
2229 | } | 2245 | } |
2230 | 2246 | ||
2231 | /* First try to find a free reg */ | 2247 | /* First try to find a free reg */ |
2232 | try_again: | ||
2233 | avail = 0; | 2248 | avail = 0; |
2234 | for (i = dev_priv->fence_reg_start; i < dev_priv->num_fence_regs; i++) { | 2249 | for (i = dev_priv->fence_reg_start; i < dev_priv->num_fence_regs; i++) { |
2235 | reg = &dev_priv->fence_regs[i]; | 2250 | reg = &dev_priv->fence_regs[i]; |
@@ -2243,52 +2258,41 @@ try_again: | |||
2243 | 2258 | ||
2244 | /* None available, try to steal one or wait for a user to finish */ | 2259 | /* None available, try to steal one or wait for a user to finish */ |
2245 | if (i == dev_priv->num_fence_regs) { | 2260 | if (i == dev_priv->num_fence_regs) { |
2246 | uint32_t seqno = dev_priv->mm.next_gem_seqno; | 2261 | struct drm_gem_object *old_obj = NULL; |
2247 | 2262 | ||
2248 | if (avail == 0) | 2263 | if (avail == 0) |
2249 | return -ENOSPC; | 2264 | return -ENOSPC; |
2250 | 2265 | ||
2251 | for (i = dev_priv->fence_reg_start; | 2266 | list_for_each_entry(old_obj_priv, &dev_priv->mm.fence_list, |
2252 | i < dev_priv->num_fence_regs; i++) { | 2267 | fence_list) { |
2253 | uint32_t this_seqno; | 2268 | old_obj = old_obj_priv->obj; |
2254 | 2269 | ||
2255 | reg = &dev_priv->fence_regs[i]; | 2270 | reg = &dev_priv->fence_regs[old_obj_priv->fence_reg]; |
2256 | old_obj_priv = reg->obj->driver_private; | ||
2257 | 2271 | ||
2258 | if (old_obj_priv->pin_count) | 2272 | if (old_obj_priv->pin_count) |
2259 | continue; | 2273 | continue; |
2260 | 2274 | ||
2275 | /* Take a reference, as otherwise the wait_rendering | ||
2276 | * below may cause the object to get freed out from | ||
2277 | * under us. | ||
2278 | */ | ||
2279 | drm_gem_object_reference(old_obj); | ||
2280 | |||
2261 | /* i915 uses fences for GPU access to tiled buffers */ | 2281 | /* i915 uses fences for GPU access to tiled buffers */ |
2262 | if (IS_I965G(dev) || !old_obj_priv->active) | 2282 | if (IS_I965G(dev) || !old_obj_priv->active) |
2263 | break; | 2283 | break; |
2264 | 2284 | ||
2265 | /* find the seqno of the first available fence */ | 2285 | /* This brings the object to the head of the LRU if it |
2266 | this_seqno = old_obj_priv->last_rendering_seqno; | 2286 | * had been written to. The only way this should |
2267 | if (this_seqno != 0 && | 2287 | * result in us waiting longer than the expected |
2268 | reg->obj->write_domain == 0 && | 2288 | * optimal amount of time is if there was a |
2269 | i915_seqno_passed(seqno, this_seqno)) | 2289 | * fence-using buffer later that was read-only. |
2270 | seqno = this_seqno; | 2290 | */ |
2271 | } | 2291 | i915_gem_object_flush_gpu_write_domain(old_obj); |
2272 | 2292 | ret = i915_gem_object_wait_rendering(old_obj); | |
2273 | /* | 2293 | if (ret != 0) |
2274 | * Now things get ugly... we have to wait for one of the | ||
2275 | * objects to finish before trying again. | ||
2276 | */ | ||
2277 | if (i == dev_priv->num_fence_regs) { | ||
2278 | if (seqno == dev_priv->mm.next_gem_seqno) { | ||
2279 | i915_gem_flush(dev, | ||
2280 | I915_GEM_GPU_DOMAINS, | ||
2281 | I915_GEM_GPU_DOMAINS); | ||
2282 | seqno = i915_add_request(dev, NULL, | ||
2283 | I915_GEM_GPU_DOMAINS); | ||
2284 | if (seqno == 0) | ||
2285 | return -ENOMEM; | ||
2286 | } | ||
2287 | |||
2288 | ret = i915_wait_request(dev, seqno); | ||
2289 | if (ret) | ||
2290 | return ret; | 2294 | return ret; |
2291 | goto try_again; | 2295 | break; |
2292 | } | 2296 | } |
2293 | 2297 | ||
2294 | /* | 2298 | /* |
@@ -2296,10 +2300,15 @@ try_again: | |||
2296 | * for this object next time we need it. | 2300 | * for this object next time we need it. |
2297 | */ | 2301 | */ |
2298 | i915_gem_release_mmap(reg->obj); | 2302 | i915_gem_release_mmap(reg->obj); |
2303 | i = old_obj_priv->fence_reg; | ||
2299 | old_obj_priv->fence_reg = I915_FENCE_REG_NONE; | 2304 | old_obj_priv->fence_reg = I915_FENCE_REG_NONE; |
2305 | list_del_init(&old_obj_priv->fence_list); | ||
2306 | drm_gem_object_unreference(old_obj); | ||
2300 | } | 2307 | } |
2301 | 2308 | ||
2302 | obj_priv->fence_reg = i; | 2309 | obj_priv->fence_reg = i; |
2310 | list_add_tail(&obj_priv->fence_list, &dev_priv->mm.fence_list); | ||
2311 | |||
2303 | reg->obj = obj; | 2312 | reg->obj = obj; |
2304 | 2313 | ||
2305 | if (IS_I965G(dev)) | 2314 | if (IS_I965G(dev)) |
@@ -2342,6 +2351,7 @@ i915_gem_clear_fence_reg(struct drm_gem_object *obj) | |||
2342 | 2351 | ||
2343 | dev_priv->fence_regs[obj_priv->fence_reg].obj = NULL; | 2352 | dev_priv->fence_regs[obj_priv->fence_reg].obj = NULL; |
2344 | obj_priv->fence_reg = I915_FENCE_REG_NONE; | 2353 | obj_priv->fence_reg = I915_FENCE_REG_NONE; |
2354 | list_del_init(&obj_priv->fence_list); | ||
2345 | } | 2355 | } |
2346 | 2356 | ||
2347 | /** | 2357 | /** |
@@ -3595,9 +3605,7 @@ i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment) | |||
3595 | * Pre-965 chips need a fence register set up in order to | 3605 | * Pre-965 chips need a fence register set up in order to |
3596 | * properly handle tiled surfaces. | 3606 | * properly handle tiled surfaces. |
3597 | */ | 3607 | */ |
3598 | if (!IS_I965G(dev) && | 3608 | if (!IS_I965G(dev) && obj_priv->tiling_mode != I915_TILING_NONE) { |
3599 | obj_priv->fence_reg == I915_FENCE_REG_NONE && | ||
3600 | obj_priv->tiling_mode != I915_TILING_NONE) { | ||
3601 | ret = i915_gem_object_get_fence_reg(obj); | 3609 | ret = i915_gem_object_get_fence_reg(obj); |
3602 | if (ret != 0) { | 3610 | if (ret != 0) { |
3603 | if (ret != -EBUSY && ret != -ERESTARTSYS) | 3611 | if (ret != -EBUSY && ret != -ERESTARTSYS) |
@@ -3806,6 +3814,7 @@ int i915_gem_init_object(struct drm_gem_object *obj) | |||
3806 | obj_priv->obj = obj; | 3814 | obj_priv->obj = obj; |
3807 | obj_priv->fence_reg = I915_FENCE_REG_NONE; | 3815 | obj_priv->fence_reg = I915_FENCE_REG_NONE; |
3808 | INIT_LIST_HEAD(&obj_priv->list); | 3816 | INIT_LIST_HEAD(&obj_priv->list); |
3817 | INIT_LIST_HEAD(&obj_priv->fence_list); | ||
3809 | 3818 | ||
3810 | return 0; | 3819 | return 0; |
3811 | } | 3820 | } |
@@ -4253,6 +4262,7 @@ i915_gem_load(struct drm_device *dev) | |||
4253 | INIT_LIST_HEAD(&dev_priv->mm.flushing_list); | 4262 | INIT_LIST_HEAD(&dev_priv->mm.flushing_list); |
4254 | INIT_LIST_HEAD(&dev_priv->mm.inactive_list); | 4263 | INIT_LIST_HEAD(&dev_priv->mm.inactive_list); |
4255 | INIT_LIST_HEAD(&dev_priv->mm.request_list); | 4264 | INIT_LIST_HEAD(&dev_priv->mm.request_list); |
4265 | INIT_LIST_HEAD(&dev_priv->mm.fence_list); | ||
4256 | INIT_DELAYED_WORK(&dev_priv->mm.retire_work, | 4266 | INIT_DELAYED_WORK(&dev_priv->mm.retire_work, |
4257 | i915_gem_retire_work_handler); | 4267 | i915_gem_retire_work_handler); |
4258 | dev_priv->mm.next_gem_seqno = 1; | 4268 | dev_priv->mm.next_gem_seqno = 1; |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 300aee3296c2..f806fcc54e09 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -59,6 +59,16 @@ find_section(struct bdb_header *bdb, int section_id) | |||
59 | return NULL; | 59 | return NULL; |
60 | } | 60 | } |
61 | 61 | ||
62 | static u16 | ||
63 | get_blocksize(void *p) | ||
64 | { | ||
65 | u16 *block_ptr, block_size; | ||
66 | |||
67 | block_ptr = (u16 *)((char *)p - 2); | ||
68 | block_size = *block_ptr; | ||
69 | return block_size; | ||
70 | } | ||
71 | |||
62 | static void | 72 | static void |
63 | fill_detail_timing_data(struct drm_display_mode *panel_fixed_mode, | 73 | fill_detail_timing_data(struct drm_display_mode *panel_fixed_mode, |
64 | struct lvds_dvo_timing *dvo_timing) | 74 | struct lvds_dvo_timing *dvo_timing) |
@@ -215,6 +225,41 @@ parse_general_features(struct drm_i915_private *dev_priv, | |||
215 | } | 225 | } |
216 | 226 | ||
217 | static void | 227 | static void |
228 | parse_general_definitions(struct drm_i915_private *dev_priv, | ||
229 | struct bdb_header *bdb) | ||
230 | { | ||
231 | struct bdb_general_definitions *general; | ||
232 | const int crt_bus_map_table[] = { | ||
233 | GPIOB, | ||
234 | GPIOA, | ||
235 | GPIOC, | ||
236 | GPIOD, | ||
237 | GPIOE, | ||
238 | GPIOF, | ||
239 | }; | ||
240 | |||
241 | /* Set sensible defaults in case we can't find the general block | ||
242 | or it is the wrong chipset */ | ||
243 | dev_priv->crt_ddc_bus = -1; | ||
244 | |||
245 | general = find_section(bdb, BDB_GENERAL_DEFINITIONS); | ||
246 | if (general) { | ||
247 | u16 block_size = get_blocksize(general); | ||
248 | if (block_size >= sizeof(*general)) { | ||
249 | int bus_pin = general->crt_ddc_gmbus_pin; | ||
250 | DRM_DEBUG("crt_ddc_bus_pin: %d\n", bus_pin); | ||
251 | if ((bus_pin >= 1) && (bus_pin <= 6)) { | ||
252 | dev_priv->crt_ddc_bus = | ||
253 | crt_bus_map_table[bus_pin-1]; | ||
254 | } | ||
255 | } else { | ||
256 | DRM_DEBUG("BDB_GD too small (%d). Invalid.\n", | ||
257 | block_size); | ||
258 | } | ||
259 | } | ||
260 | } | ||
261 | |||
262 | static void | ||
218 | parse_sdvo_device_mapping(struct drm_i915_private *dev_priv, | 263 | parse_sdvo_device_mapping(struct drm_i915_private *dev_priv, |
219 | struct bdb_header *bdb) | 264 | struct bdb_header *bdb) |
220 | { | 265 | { |
@@ -222,7 +267,7 @@ parse_sdvo_device_mapping(struct drm_i915_private *dev_priv, | |||
222 | struct bdb_general_definitions *p_defs; | 267 | struct bdb_general_definitions *p_defs; |
223 | struct child_device_config *p_child; | 268 | struct child_device_config *p_child; |
224 | int i, child_device_num, count; | 269 | int i, child_device_num, count; |
225 | u16 block_size, *block_ptr; | 270 | u16 block_size; |
226 | 271 | ||
227 | p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS); | 272 | p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS); |
228 | if (!p_defs) { | 273 | if (!p_defs) { |
@@ -240,8 +285,7 @@ parse_sdvo_device_mapping(struct drm_i915_private *dev_priv, | |||
240 | return; | 285 | return; |
241 | } | 286 | } |
242 | /* get the block size of general definitions */ | 287 | /* get the block size of general definitions */ |
243 | block_ptr = (u16 *)((char *)p_defs - 2); | 288 | block_size = get_blocksize(p_defs); |
244 | block_size = *block_ptr; | ||
245 | /* get the number of child device */ | 289 | /* get the number of child device */ |
246 | child_device_num = (block_size - sizeof(*p_defs)) / | 290 | child_device_num = (block_size - sizeof(*p_defs)) / |
247 | sizeof(*p_child); | 291 | sizeof(*p_child); |
@@ -362,6 +406,7 @@ intel_init_bios(struct drm_device *dev) | |||
362 | 406 | ||
363 | /* Grab useful general definitions */ | 407 | /* Grab useful general definitions */ |
364 | parse_general_features(dev_priv, bdb); | 408 | parse_general_features(dev_priv, bdb); |
409 | parse_general_definitions(dev_priv, bdb); | ||
365 | parse_lfp_panel_data(dev_priv, bdb); | 410 | parse_lfp_panel_data(dev_priv, bdb); |
366 | parse_sdvo_panel_data(dev_priv, bdb); | 411 | parse_sdvo_panel_data(dev_priv, bdb); |
367 | parse_sdvo_device_mapping(dev_priv, bdb); | 412 | parse_sdvo_device_mapping(dev_priv, bdb); |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 4cf8e2e88a40..590f81c8f594 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -508,6 +508,7 @@ void intel_crt_init(struct drm_device *dev) | |||
508 | { | 508 | { |
509 | struct drm_connector *connector; | 509 | struct drm_connector *connector; |
510 | struct intel_output *intel_output; | 510 | struct intel_output *intel_output; |
511 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
511 | u32 i2c_reg; | 512 | u32 i2c_reg; |
512 | 513 | ||
513 | intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL); | 514 | intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL); |
@@ -527,8 +528,12 @@ void intel_crt_init(struct drm_device *dev) | |||
527 | /* Set up the DDC bus. */ | 528 | /* Set up the DDC bus. */ |
528 | if (IS_IGDNG(dev)) | 529 | if (IS_IGDNG(dev)) |
529 | i2c_reg = PCH_GPIOA; | 530 | i2c_reg = PCH_GPIOA; |
530 | else | 531 | else { |
531 | i2c_reg = GPIOA; | 532 | i2c_reg = GPIOA; |
533 | /* Use VBT information for CRT DDC if available */ | ||
534 | if (dev_priv->crt_ddc_bus != -1) | ||
535 | i2c_reg = dev_priv->crt_ddc_bus; | ||
536 | } | ||
532 | intel_output->ddc_bus = intel_i2c_create(dev, i2c_reg, "CRTDDC_A"); | 537 | intel_output->ddc_bus = intel_i2c_create(dev, i2c_reg, "CRTDDC_A"); |
533 | if (!intel_output->ddc_bus) { | 538 | if (!intel_output->ddc_bus) { |
534 | dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " | 539 | dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " |
@@ -537,6 +542,10 @@ void intel_crt_init(struct drm_device *dev) | |||
537 | } | 542 | } |
538 | 543 | ||
539 | intel_output->type = INTEL_OUTPUT_ANALOG; | 544 | intel_output->type = INTEL_OUTPUT_ANALOG; |
545 | intel_output->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | | ||
546 | (1 << INTEL_ANALOG_CLONE_BIT) | | ||
547 | (1 << INTEL_SDVO_LVDS_CLONE_BIT); | ||
548 | intel_output->crtc_mask = (1 << 0) | (1 << 1); | ||
540 | connector->interlace_allowed = 0; | 549 | connector->interlace_allowed = 0; |
541 | connector->doublescan_allowed = 0; | 550 | connector->doublescan_allowed = 0; |
542 | 551 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index d6fce2133413..3fadb5358858 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -666,7 +666,7 @@ intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
666 | intel_clock_t clock; | 666 | intel_clock_t clock; |
667 | int err = target; | 667 | int err = target; |
668 | 668 | ||
669 | if (IS_I9XX(dev) && intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) && | 669 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) && |
670 | (I915_READ(LVDS)) != 0) { | 670 | (I915_READ(LVDS)) != 0) { |
671 | /* | 671 | /* |
672 | * For LVDS, if the panel is on, just rely on its current | 672 | * For LVDS, if the panel is on, just rely on its current |
@@ -2396,7 +2396,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
2396 | if (is_sdvo) { | 2396 | if (is_sdvo) { |
2397 | dpll |= DPLL_DVO_HIGH_SPEED; | 2397 | dpll |= DPLL_DVO_HIGH_SPEED; |
2398 | sdvo_pixel_multiply = adjusted_mode->clock / mode->clock; | 2398 | sdvo_pixel_multiply = adjusted_mode->clock / mode->clock; |
2399 | if (IS_I945G(dev) || IS_I945GM(dev)) | 2399 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) |
2400 | dpll |= (sdvo_pixel_multiply - 1) << SDVO_MULTIPLIER_SHIFT_HIRES; | 2400 | dpll |= (sdvo_pixel_multiply - 1) << SDVO_MULTIPLIER_SHIFT_HIRES; |
2401 | else if (IS_IGDNG(dev)) | 2401 | else if (IS_IGDNG(dev)) |
2402 | dpll |= (sdvo_pixel_multiply - 1) << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT; | 2402 | dpll |= (sdvo_pixel_multiply - 1) << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT; |
@@ -3170,7 +3170,7 @@ static int intel_connector_clones(struct drm_device *dev, int type_mask) | |||
3170 | 3170 | ||
3171 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 3171 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
3172 | struct intel_output *intel_output = to_intel_output(connector); | 3172 | struct intel_output *intel_output = to_intel_output(connector); |
3173 | if (type_mask & (1 << intel_output->type)) | 3173 | if (type_mask & intel_output->clone_mask) |
3174 | index_mask |= (1 << entry); | 3174 | index_mask |= (1 << entry); |
3175 | entry++; | 3175 | entry++; |
3176 | } | 3176 | } |
@@ -3218,30 +3218,30 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
3218 | intel_dp_init(dev, PCH_DP_D); | 3218 | intel_dp_init(dev, PCH_DP_D); |
3219 | 3219 | ||
3220 | } else if (IS_I9XX(dev)) { | 3220 | } else if (IS_I9XX(dev)) { |
3221 | int found; | 3221 | bool found = false; |
3222 | u32 reg; | ||
3223 | 3222 | ||
3224 | if (I915_READ(SDVOB) & SDVO_DETECTED) { | 3223 | if (I915_READ(SDVOB) & SDVO_DETECTED) { |
3225 | found = intel_sdvo_init(dev, SDVOB); | 3224 | found = intel_sdvo_init(dev, SDVOB); |
3226 | if (!found && SUPPORTS_INTEGRATED_HDMI(dev)) | 3225 | if (!found && SUPPORTS_INTEGRATED_HDMI(dev)) |
3227 | intel_hdmi_init(dev, SDVOB); | 3226 | intel_hdmi_init(dev, SDVOB); |
3227 | |||
3228 | if (!found && SUPPORTS_INTEGRATED_DP(dev)) | 3228 | if (!found && SUPPORTS_INTEGRATED_DP(dev)) |
3229 | intel_dp_init(dev, DP_B); | 3229 | intel_dp_init(dev, DP_B); |
3230 | } | 3230 | } |
3231 | 3231 | ||
3232 | /* Before G4X SDVOC doesn't have its own detect register */ | 3232 | /* Before G4X SDVOC doesn't have its own detect register */ |
3233 | if (IS_G4X(dev)) | ||
3234 | reg = SDVOC; | ||
3235 | else | ||
3236 | reg = SDVOB; | ||
3237 | 3233 | ||
3238 | if (I915_READ(reg) & SDVO_DETECTED) { | 3234 | if (I915_READ(SDVOB) & SDVO_DETECTED) |
3239 | found = intel_sdvo_init(dev, SDVOC); | 3235 | found = intel_sdvo_init(dev, SDVOC); |
3240 | if (!found && SUPPORTS_INTEGRATED_HDMI(dev)) | 3236 | |
3237 | if (!found && (I915_READ(SDVOC) & SDVO_DETECTED)) { | ||
3238 | |||
3239 | if (SUPPORTS_INTEGRATED_HDMI(dev)) | ||
3241 | intel_hdmi_init(dev, SDVOC); | 3240 | intel_hdmi_init(dev, SDVOC); |
3242 | if (!found && SUPPORTS_INTEGRATED_DP(dev)) | 3241 | if (SUPPORTS_INTEGRATED_DP(dev)) |
3243 | intel_dp_init(dev, DP_C); | 3242 | intel_dp_init(dev, DP_C); |
3244 | } | 3243 | } |
3244 | |||
3245 | if (SUPPORTS_INTEGRATED_DP(dev) && (I915_READ(DP_D) & DP_DETECTED)) | 3245 | if (SUPPORTS_INTEGRATED_DP(dev) && (I915_READ(DP_D) & DP_DETECTED)) |
3246 | intel_dp_init(dev, DP_D); | 3246 | intel_dp_init(dev, DP_D); |
3247 | } else | 3247 | } else |
@@ -3253,51 +3253,10 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
3253 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 3253 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
3254 | struct intel_output *intel_output = to_intel_output(connector); | 3254 | struct intel_output *intel_output = to_intel_output(connector); |
3255 | struct drm_encoder *encoder = &intel_output->enc; | 3255 | struct drm_encoder *encoder = &intel_output->enc; |
3256 | int crtc_mask = 0, clone_mask = 0; | ||
3257 | 3256 | ||
3258 | /* valid crtcs */ | 3257 | encoder->possible_crtcs = intel_output->crtc_mask; |
3259 | switch(intel_output->type) { | 3258 | encoder->possible_clones = intel_connector_clones(dev, |
3260 | case INTEL_OUTPUT_HDMI: | 3259 | intel_output->clone_mask); |
3261 | crtc_mask = ((1 << 0)| | ||
3262 | (1 << 1)); | ||
3263 | clone_mask = ((1 << INTEL_OUTPUT_HDMI)); | ||
3264 | break; | ||
3265 | case INTEL_OUTPUT_DVO: | ||
3266 | case INTEL_OUTPUT_SDVO: | ||
3267 | crtc_mask = ((1 << 0)| | ||
3268 | (1 << 1)); | ||
3269 | clone_mask = ((1 << INTEL_OUTPUT_ANALOG) | | ||
3270 | (1 << INTEL_OUTPUT_DVO) | | ||
3271 | (1 << INTEL_OUTPUT_SDVO)); | ||
3272 | break; | ||
3273 | case INTEL_OUTPUT_ANALOG: | ||
3274 | crtc_mask = ((1 << 0)| | ||
3275 | (1 << 1)); | ||
3276 | clone_mask = ((1 << INTEL_OUTPUT_ANALOG) | | ||
3277 | (1 << INTEL_OUTPUT_DVO) | | ||
3278 | (1 << INTEL_OUTPUT_SDVO)); | ||
3279 | break; | ||
3280 | case INTEL_OUTPUT_LVDS: | ||
3281 | crtc_mask = (1 << 1); | ||
3282 | clone_mask = (1 << INTEL_OUTPUT_LVDS); | ||
3283 | break; | ||
3284 | case INTEL_OUTPUT_TVOUT: | ||
3285 | crtc_mask = ((1 << 0) | | ||
3286 | (1 << 1)); | ||
3287 | clone_mask = (1 << INTEL_OUTPUT_TVOUT); | ||
3288 | break; | ||
3289 | case INTEL_OUTPUT_DISPLAYPORT: | ||
3290 | crtc_mask = ((1 << 0) | | ||
3291 | (1 << 1)); | ||
3292 | clone_mask = (1 << INTEL_OUTPUT_DISPLAYPORT); | ||
3293 | break; | ||
3294 | case INTEL_OUTPUT_EDP: | ||
3295 | crtc_mask = (1 << 1); | ||
3296 | clone_mask = (1 << INTEL_OUTPUT_EDP); | ||
3297 | break; | ||
3298 | } | ||
3299 | encoder->possible_crtcs = crtc_mask; | ||
3300 | encoder->possible_clones = intel_connector_clones(dev, clone_mask); | ||
3301 | } | 3260 | } |
3302 | } | 3261 | } |
3303 | 3262 | ||
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index a6ff15ac548a..f2afc4af4bc9 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1254,6 +1254,18 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
1254 | else | 1254 | else |
1255 | intel_output->type = INTEL_OUTPUT_DISPLAYPORT; | 1255 | intel_output->type = INTEL_OUTPUT_DISPLAYPORT; |
1256 | 1256 | ||
1257 | if (output_reg == DP_B) | ||
1258 | intel_output->clone_mask = (1 << INTEL_DP_B_CLONE_BIT); | ||
1259 | else if (output_reg == DP_C) | ||
1260 | intel_output->clone_mask = (1 << INTEL_DP_C_CLONE_BIT); | ||
1261 | else if (output_reg == DP_D) | ||
1262 | intel_output->clone_mask = (1 << INTEL_DP_D_CLONE_BIT); | ||
1263 | |||
1264 | if (IS_eDP(intel_output)) { | ||
1265 | intel_output->crtc_mask = (1 << 1); | ||
1266 | intel_output->clone_mask = (1 << INTEL_OUTPUT_EDP); | ||
1267 | } else | ||
1268 | intel_output->crtc_mask = (1 << 0) | (1 << 1); | ||
1257 | connector->interlace_allowed = true; | 1269 | connector->interlace_allowed = true; |
1258 | connector->doublescan_allowed = 0; | 1270 | connector->doublescan_allowed = 0; |
1259 | 1271 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index d6f92ea1b553..25aa6facc12d 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -57,6 +57,24 @@ | |||
57 | #define INTEL_OUTPUT_DISPLAYPORT 7 | 57 | #define INTEL_OUTPUT_DISPLAYPORT 7 |
58 | #define INTEL_OUTPUT_EDP 8 | 58 | #define INTEL_OUTPUT_EDP 8 |
59 | 59 | ||
60 | /* Intel Pipe Clone Bit */ | ||
61 | #define INTEL_HDMIB_CLONE_BIT 1 | ||
62 | #define INTEL_HDMIC_CLONE_BIT 2 | ||
63 | #define INTEL_HDMID_CLONE_BIT 3 | ||
64 | #define INTEL_HDMIE_CLONE_BIT 4 | ||
65 | #define INTEL_HDMIF_CLONE_BIT 5 | ||
66 | #define INTEL_SDVO_NON_TV_CLONE_BIT 6 | ||
67 | #define INTEL_SDVO_TV_CLONE_BIT 7 | ||
68 | #define INTEL_SDVO_LVDS_CLONE_BIT 8 | ||
69 | #define INTEL_ANALOG_CLONE_BIT 9 | ||
70 | #define INTEL_TV_CLONE_BIT 10 | ||
71 | #define INTEL_DP_B_CLONE_BIT 11 | ||
72 | #define INTEL_DP_C_CLONE_BIT 12 | ||
73 | #define INTEL_DP_D_CLONE_BIT 13 | ||
74 | #define INTEL_LVDS_CLONE_BIT 14 | ||
75 | #define INTEL_DVO_TMDS_CLONE_BIT 15 | ||
76 | #define INTEL_DVO_LVDS_CLONE_BIT 16 | ||
77 | |||
60 | #define INTEL_DVO_CHIP_NONE 0 | 78 | #define INTEL_DVO_CHIP_NONE 0 |
61 | #define INTEL_DVO_CHIP_LVDS 1 | 79 | #define INTEL_DVO_CHIP_LVDS 1 |
62 | #define INTEL_DVO_CHIP_TMDS 2 | 80 | #define INTEL_DVO_CHIP_TMDS 2 |
@@ -86,6 +104,8 @@ struct intel_output { | |||
86 | bool needs_tv_clock; | 104 | bool needs_tv_clock; |
87 | void *dev_priv; | 105 | void *dev_priv; |
88 | void (*hot_plug)(struct intel_output *); | 106 | void (*hot_plug)(struct intel_output *); |
107 | int crtc_mask; | ||
108 | int clone_mask; | ||
89 | }; | 109 | }; |
90 | 110 | ||
91 | struct intel_crtc { | 111 | struct intel_crtc { |
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c index 13bff20930e8..a4d2606de778 100644 --- a/drivers/gpu/drm/i915/intel_dvo.c +++ b/drivers/gpu/drm/i915/intel_dvo.c | |||
@@ -435,14 +435,20 @@ void intel_dvo_init(struct drm_device *dev) | |||
435 | continue; | 435 | continue; |
436 | 436 | ||
437 | intel_output->type = INTEL_OUTPUT_DVO; | 437 | intel_output->type = INTEL_OUTPUT_DVO; |
438 | intel_output->crtc_mask = (1 << 0) | (1 << 1); | ||
438 | switch (dvo->type) { | 439 | switch (dvo->type) { |
439 | case INTEL_DVO_CHIP_TMDS: | 440 | case INTEL_DVO_CHIP_TMDS: |
441 | intel_output->clone_mask = | ||
442 | (1 << INTEL_DVO_TMDS_CLONE_BIT) | | ||
443 | (1 << INTEL_ANALOG_CLONE_BIT); | ||
440 | drm_connector_init(dev, connector, | 444 | drm_connector_init(dev, connector, |
441 | &intel_dvo_connector_funcs, | 445 | &intel_dvo_connector_funcs, |
442 | DRM_MODE_CONNECTOR_DVII); | 446 | DRM_MODE_CONNECTOR_DVII); |
443 | encoder_type = DRM_MODE_ENCODER_TMDS; | 447 | encoder_type = DRM_MODE_ENCODER_TMDS; |
444 | break; | 448 | break; |
445 | case INTEL_DVO_CHIP_LVDS: | 449 | case INTEL_DVO_CHIP_LVDS: |
450 | intel_output->clone_mask = | ||
451 | (1 << INTEL_DVO_LVDS_CLONE_BIT); | ||
446 | drm_connector_init(dev, connector, | 452 | drm_connector_init(dev, connector, |
447 | &intel_dvo_connector_funcs, | 453 | &intel_dvo_connector_funcs, |
448 | DRM_MODE_CONNECTOR_LVDS); | 454 | DRM_MODE_CONNECTOR_LVDS); |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 1842290cded3..fa304e136010 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -230,22 +230,28 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) | |||
230 | 230 | ||
231 | connector->interlace_allowed = 0; | 231 | connector->interlace_allowed = 0; |
232 | connector->doublescan_allowed = 0; | 232 | connector->doublescan_allowed = 0; |
233 | intel_output->crtc_mask = (1 << 0) | (1 << 1); | ||
233 | 234 | ||
234 | /* Set up the DDC bus. */ | 235 | /* Set up the DDC bus. */ |
235 | if (sdvox_reg == SDVOB) | 236 | if (sdvox_reg == SDVOB) { |
237 | intel_output->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT); | ||
236 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB"); | 238 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB"); |
237 | else if (sdvox_reg == SDVOC) | 239 | } else if (sdvox_reg == SDVOC) { |
240 | intel_output->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT); | ||
238 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC"); | 241 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC"); |
239 | else if (sdvox_reg == HDMIB) | 242 | } else if (sdvox_reg == HDMIB) { |
243 | intel_output->clone_mask = (1 << INTEL_HDMID_CLONE_BIT); | ||
240 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE, | 244 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE, |
241 | "HDMIB"); | 245 | "HDMIB"); |
242 | else if (sdvox_reg == HDMIC) | 246 | } else if (sdvox_reg == HDMIC) { |
247 | intel_output->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT); | ||
243 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD, | 248 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD, |
244 | "HDMIC"); | 249 | "HDMIC"); |
245 | else if (sdvox_reg == HDMID) | 250 | } else if (sdvox_reg == HDMID) { |
251 | intel_output->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT); | ||
246 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF, | 252 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF, |
247 | "HDMID"); | 253 | "HDMID"); |
248 | 254 | } | |
249 | if (!intel_output->ddc_bus) | 255 | if (!intel_output->ddc_bus) |
250 | goto err_connector; | 256 | goto err_connector; |
251 | 257 | ||
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 3f445a80c552..8df02ef89261 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -916,6 +916,8 @@ void intel_lvds_init(struct drm_device *dev) | |||
916 | drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); | 916 | drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); |
917 | intel_output->type = INTEL_OUTPUT_LVDS; | 917 | intel_output->type = INTEL_OUTPUT_LVDS; |
918 | 918 | ||
919 | intel_output->clone_mask = (1 << INTEL_LVDS_CLONE_BIT); | ||
920 | intel_output->crtc_mask = (1 << 1); | ||
919 | drm_encoder_helper_add(encoder, &intel_lvds_helper_funcs); | 921 | drm_encoder_helper_add(encoder, &intel_lvds_helper_funcs); |
920 | drm_connector_helper_add(connector, &intel_lvds_connector_helper_funcs); | 922 | drm_connector_helper_add(connector, &intel_lvds_connector_helper_funcs); |
921 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; | 923 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 5371d9332554..d3b74ba62b4a 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -1458,7 +1458,7 @@ intel_sdvo_multifunc_encoder(struct intel_output *intel_output) | |||
1458 | (SDVO_OUTPUT_RGB0 | SDVO_OUTPUT_RGB1)) | 1458 | (SDVO_OUTPUT_RGB0 | SDVO_OUTPUT_RGB1)) |
1459 | caps++; | 1459 | caps++; |
1460 | if (sdvo_priv->caps.output_flags & | 1460 | if (sdvo_priv->caps.output_flags & |
1461 | (SDVO_OUTPUT_SVID0 | SDVO_OUTPUT_SVID0)) | 1461 | (SDVO_OUTPUT_SVID0 | SDVO_OUTPUT_SVID1)) |
1462 | caps++; | 1462 | caps++; |
1463 | if (sdvo_priv->caps.output_flags & | 1463 | if (sdvo_priv->caps.output_flags & |
1464 | (SDVO_OUTPUT_CVBS0 | SDVO_OUTPUT_CVBS1)) | 1464 | (SDVO_OUTPUT_CVBS0 | SDVO_OUTPUT_CVBS1)) |
@@ -1967,6 +1967,9 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags) | |||
1967 | intel_sdvo_set_colorimetry(intel_output, | 1967 | intel_sdvo_set_colorimetry(intel_output, |
1968 | SDVO_COLORIMETRY_RGB256); | 1968 | SDVO_COLORIMETRY_RGB256); |
1969 | connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; | 1969 | connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; |
1970 | intel_output->clone_mask = | ||
1971 | (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | | ||
1972 | (1 << INTEL_ANALOG_CLONE_BIT); | ||
1970 | } | 1973 | } |
1971 | } else if (flags & SDVO_OUTPUT_SVID0) { | 1974 | } else if (flags & SDVO_OUTPUT_SVID0) { |
1972 | 1975 | ||
@@ -1975,11 +1978,14 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags) | |||
1975 | connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO; | 1978 | connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO; |
1976 | sdvo_priv->is_tv = true; | 1979 | sdvo_priv->is_tv = true; |
1977 | intel_output->needs_tv_clock = true; | 1980 | intel_output->needs_tv_clock = true; |
1981 | intel_output->clone_mask = 1 << INTEL_SDVO_TV_CLONE_BIT; | ||
1978 | } else if (flags & SDVO_OUTPUT_RGB0) { | 1982 | } else if (flags & SDVO_OUTPUT_RGB0) { |
1979 | 1983 | ||
1980 | sdvo_priv->controlled_output = SDVO_OUTPUT_RGB0; | 1984 | sdvo_priv->controlled_output = SDVO_OUTPUT_RGB0; |
1981 | encoder->encoder_type = DRM_MODE_ENCODER_DAC; | 1985 | encoder->encoder_type = DRM_MODE_ENCODER_DAC; |
1982 | connector->connector_type = DRM_MODE_CONNECTOR_VGA; | 1986 | connector->connector_type = DRM_MODE_CONNECTOR_VGA; |
1987 | intel_output->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | | ||
1988 | (1 << INTEL_ANALOG_CLONE_BIT); | ||
1983 | } else if (flags & SDVO_OUTPUT_RGB1) { | 1989 | } else if (flags & SDVO_OUTPUT_RGB1) { |
1984 | 1990 | ||
1985 | sdvo_priv->controlled_output = SDVO_OUTPUT_RGB1; | 1991 | sdvo_priv->controlled_output = SDVO_OUTPUT_RGB1; |
@@ -1991,12 +1997,16 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags) | |||
1991 | encoder->encoder_type = DRM_MODE_ENCODER_LVDS; | 1997 | encoder->encoder_type = DRM_MODE_ENCODER_LVDS; |
1992 | connector->connector_type = DRM_MODE_CONNECTOR_LVDS; | 1998 | connector->connector_type = DRM_MODE_CONNECTOR_LVDS; |
1993 | sdvo_priv->is_lvds = true; | 1999 | sdvo_priv->is_lvds = true; |
2000 | intel_output->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT) | | ||
2001 | (1 << INTEL_SDVO_LVDS_CLONE_BIT); | ||
1994 | } else if (flags & SDVO_OUTPUT_LVDS1) { | 2002 | } else if (flags & SDVO_OUTPUT_LVDS1) { |
1995 | 2003 | ||
1996 | sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS1; | 2004 | sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS1; |
1997 | encoder->encoder_type = DRM_MODE_ENCODER_LVDS; | 2005 | encoder->encoder_type = DRM_MODE_ENCODER_LVDS; |
1998 | connector->connector_type = DRM_MODE_CONNECTOR_LVDS; | 2006 | connector->connector_type = DRM_MODE_CONNECTOR_LVDS; |
1999 | sdvo_priv->is_lvds = true; | 2007 | sdvo_priv->is_lvds = true; |
2008 | intel_output->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT) | | ||
2009 | (1 << INTEL_SDVO_LVDS_CLONE_BIT); | ||
2000 | } else { | 2010 | } else { |
2001 | 2011 | ||
2002 | unsigned char bytes[2]; | 2012 | unsigned char bytes[2]; |
@@ -2009,6 +2019,7 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags) | |||
2009 | bytes[0], bytes[1]); | 2019 | bytes[0], bytes[1]); |
2010 | ret = false; | 2020 | ret = false; |
2011 | } | 2021 | } |
2022 | intel_output->crtc_mask = (1 << 0) | (1 << 1); | ||
2012 | 2023 | ||
2013 | if (ret && registered) | 2024 | if (ret && registered) |
2014 | ret = drm_sysfs_connector_add(connector) == 0 ? true : false; | 2025 | ret = drm_sysfs_connector_add(connector) == 0 ? true : false; |
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index da4ab4dc1630..2fbe13a0de81 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -1718,6 +1718,7 @@ intel_tv_init(struct drm_device *dev) | |||
1718 | if (!intel_output) { | 1718 | if (!intel_output) { |
1719 | return; | 1719 | return; |
1720 | } | 1720 | } |
1721 | |||
1721 | connector = &intel_output->base; | 1722 | connector = &intel_output->base; |
1722 | 1723 | ||
1723 | drm_connector_init(dev, connector, &intel_tv_connector_funcs, | 1724 | drm_connector_init(dev, connector, &intel_tv_connector_funcs, |
@@ -1729,6 +1730,7 @@ intel_tv_init(struct drm_device *dev) | |||
1729 | drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); | 1730 | drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); |
1730 | tv_priv = (struct intel_tv_priv *)(intel_output + 1); | 1731 | tv_priv = (struct intel_tv_priv *)(intel_output + 1); |
1731 | intel_output->type = INTEL_OUTPUT_TVOUT; | 1732 | intel_output->type = INTEL_OUTPUT_TVOUT; |
1733 | intel_output->clone_mask = (1 << INTEL_TV_CLONE_BIT); | ||
1732 | intel_output->enc.possible_crtcs = ((1 << 0) | (1 << 1)); | 1734 | intel_output->enc.possible_crtcs = ((1 << 0) | (1 << 1)); |
1733 | intel_output->enc.possible_clones = (1 << INTEL_OUTPUT_TVOUT); | 1735 | intel_output->enc.possible_clones = (1 << INTEL_OUTPUT_TVOUT); |
1734 | intel_output->dev_priv = tv_priv; | 1736 | intel_output->dev_priv = tv_priv; |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index f1ba8ff41130..68e728e8be4d 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -254,6 +254,72 @@ void r100_mc_fini(struct radeon_device *rdev) | |||
254 | 254 | ||
255 | 255 | ||
256 | /* | 256 | /* |
257 | * Interrupts | ||
258 | */ | ||
259 | int r100_irq_set(struct radeon_device *rdev) | ||
260 | { | ||
261 | uint32_t tmp = 0; | ||
262 | |||
263 | if (rdev->irq.sw_int) { | ||
264 | tmp |= RADEON_SW_INT_ENABLE; | ||
265 | } | ||
266 | if (rdev->irq.crtc_vblank_int[0]) { | ||
267 | tmp |= RADEON_CRTC_VBLANK_MASK; | ||
268 | } | ||
269 | if (rdev->irq.crtc_vblank_int[1]) { | ||
270 | tmp |= RADEON_CRTC2_VBLANK_MASK; | ||
271 | } | ||
272 | WREG32(RADEON_GEN_INT_CNTL, tmp); | ||
273 | return 0; | ||
274 | } | ||
275 | |||
276 | static inline uint32_t r100_irq_ack(struct radeon_device *rdev) | ||
277 | { | ||
278 | uint32_t irqs = RREG32(RADEON_GEN_INT_STATUS); | ||
279 | uint32_t irq_mask = RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT | | ||
280 | RADEON_CRTC2_VBLANK_STAT; | ||
281 | |||
282 | if (irqs) { | ||
283 | WREG32(RADEON_GEN_INT_STATUS, irqs); | ||
284 | } | ||
285 | return irqs & irq_mask; | ||
286 | } | ||
287 | |||
288 | int r100_irq_process(struct radeon_device *rdev) | ||
289 | { | ||
290 | uint32_t status; | ||
291 | |||
292 | status = r100_irq_ack(rdev); | ||
293 | if (!status) { | ||
294 | return IRQ_NONE; | ||
295 | } | ||
296 | while (status) { | ||
297 | /* SW interrupt */ | ||
298 | if (status & RADEON_SW_INT_TEST) { | ||
299 | radeon_fence_process(rdev); | ||
300 | } | ||
301 | /* Vertical blank interrupts */ | ||
302 | if (status & RADEON_CRTC_VBLANK_STAT) { | ||
303 | drm_handle_vblank(rdev->ddev, 0); | ||
304 | } | ||
305 | if (status & RADEON_CRTC2_VBLANK_STAT) { | ||
306 | drm_handle_vblank(rdev->ddev, 1); | ||
307 | } | ||
308 | status = r100_irq_ack(rdev); | ||
309 | } | ||
310 | return IRQ_HANDLED; | ||
311 | } | ||
312 | |||
313 | u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc) | ||
314 | { | ||
315 | if (crtc == 0) | ||
316 | return RREG32(RADEON_CRTC_CRNT_FRAME); | ||
317 | else | ||
318 | return RREG32(RADEON_CRTC2_CRNT_FRAME); | ||
319 | } | ||
320 | |||
321 | |||
322 | /* | ||
257 | * Fence emission | 323 | * Fence emission |
258 | */ | 324 | */ |
259 | void r100_fence_ring_emit(struct radeon_device *rdev, | 325 | void r100_fence_ring_emit(struct radeon_device *rdev, |
@@ -1025,6 +1091,16 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1025 | tmp |= tile_flags; | 1091 | tmp |= tile_flags; |
1026 | ib[idx] = tmp; | 1092 | ib[idx] = tmp; |
1027 | break; | 1093 | break; |
1094 | case RADEON_RB3D_ZPASS_ADDR: | ||
1095 | r = r100_cs_packet_next_reloc(p, &reloc); | ||
1096 | if (r) { | ||
1097 | DRM_ERROR("No reloc for ib[%d]=0x%04X\n", | ||
1098 | idx, reg); | ||
1099 | r100_cs_dump_packet(p, pkt); | ||
1100 | return r; | ||
1101 | } | ||
1102 | ib[idx] = ib_chunk->kdata[idx] + ((u32)reloc->lobj.gpu_offset); | ||
1103 | break; | ||
1028 | default: | 1104 | default: |
1029 | /* FIXME: we don't want to allow anyothers packet */ | 1105 | /* FIXME: we don't want to allow anyothers packet */ |
1030 | break; | 1106 | break; |
@@ -1556,26 +1632,6 @@ void r100_pll_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | |||
1556 | r100_pll_errata_after_data(rdev); | 1632 | r100_pll_errata_after_data(rdev); |
1557 | } | 1633 | } |
1558 | 1634 | ||
1559 | uint32_t r100_mm_rreg(struct radeon_device *rdev, uint32_t reg) | ||
1560 | { | ||
1561 | if (reg < 0x10000) | ||
1562 | return readl(((void __iomem *)rdev->rmmio) + reg); | ||
1563 | else { | ||
1564 | writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX); | ||
1565 | return readl(((void __iomem *)rdev->rmmio) + RADEON_MM_DATA); | ||
1566 | } | ||
1567 | } | ||
1568 | |||
1569 | void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | ||
1570 | { | ||
1571 | if (reg < 0x10000) | ||
1572 | writel(v, ((void __iomem *)rdev->rmmio) + reg); | ||
1573 | else { | ||
1574 | writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX); | ||
1575 | writel(v, ((void __iomem *)rdev->rmmio) + RADEON_MM_DATA); | ||
1576 | } | ||
1577 | } | ||
1578 | |||
1579 | int r100_init(struct radeon_device *rdev) | 1635 | int r100_init(struct radeon_device *rdev) |
1580 | { | 1636 | { |
1581 | return 0; | 1637 | return 0; |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 9c8d41534a5d..053f4ec397f7 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -83,8 +83,8 @@ void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev) | |||
83 | WREG32_PCIE(RADEON_PCIE_TX_GART_CNTL, tmp | RADEON_PCIE_TX_GART_INVALIDATE_TLB); | 83 | WREG32_PCIE(RADEON_PCIE_TX_GART_CNTL, tmp | RADEON_PCIE_TX_GART_INVALIDATE_TLB); |
84 | (void)RREG32_PCIE(RADEON_PCIE_TX_GART_CNTL); | 84 | (void)RREG32_PCIE(RADEON_PCIE_TX_GART_CNTL); |
85 | WREG32_PCIE(RADEON_PCIE_TX_GART_CNTL, tmp); | 85 | WREG32_PCIE(RADEON_PCIE_TX_GART_CNTL, tmp); |
86 | mb(); | ||
87 | } | 86 | } |
87 | mb(); | ||
88 | } | 88 | } |
89 | 89 | ||
90 | int rv370_pcie_gart_enable(struct radeon_device *rdev) | 90 | int rv370_pcie_gart_enable(struct radeon_device *rdev) |
@@ -448,6 +448,7 @@ void r300_gpu_init(struct radeon_device *rdev) | |||
448 | /* rv350,rv370,rv380 */ | 448 | /* rv350,rv370,rv380 */ |
449 | rdev->num_gb_pipes = 1; | 449 | rdev->num_gb_pipes = 1; |
450 | } | 450 | } |
451 | rdev->num_z_pipes = 1; | ||
451 | gb_tile_config = (R300_ENABLE_TILING | R300_TILE_SIZE_16); | 452 | gb_tile_config = (R300_ENABLE_TILING | R300_TILE_SIZE_16); |
452 | switch (rdev->num_gb_pipes) { | 453 | switch (rdev->num_gb_pipes) { |
453 | case 2: | 454 | case 2: |
@@ -486,7 +487,8 @@ void r300_gpu_init(struct radeon_device *rdev) | |||
486 | printk(KERN_WARNING "Failed to wait MC idle while " | 487 | printk(KERN_WARNING "Failed to wait MC idle while " |
487 | "programming pipes. Bad things might happen.\n"); | 488 | "programming pipes. Bad things might happen.\n"); |
488 | } | 489 | } |
489 | DRM_INFO("radeon: %d pipes initialized.\n", rdev->num_gb_pipes); | 490 | DRM_INFO("radeon: %d quad pipes, %d Z pipes initialized.\n", |
491 | rdev->num_gb_pipes, rdev->num_z_pipes); | ||
490 | } | 492 | } |
491 | 493 | ||
492 | int r300_ga_reset(struct radeon_device *rdev) | 494 | int r300_ga_reset(struct radeon_device *rdev) |
@@ -593,27 +595,6 @@ void r300_vram_info(struct radeon_device *rdev) | |||
593 | 595 | ||
594 | 596 | ||
595 | /* | 597 | /* |
596 | * Indirect registers accessor | ||
597 | */ | ||
598 | uint32_t rv370_pcie_rreg(struct radeon_device *rdev, uint32_t reg) | ||
599 | { | ||
600 | uint32_t r; | ||
601 | |||
602 | WREG8(RADEON_PCIE_INDEX, ((reg) & 0xff)); | ||
603 | (void)RREG32(RADEON_PCIE_INDEX); | ||
604 | r = RREG32(RADEON_PCIE_DATA); | ||
605 | return r; | ||
606 | } | ||
607 | |||
608 | void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | ||
609 | { | ||
610 | WREG8(RADEON_PCIE_INDEX, ((reg) & 0xff)); | ||
611 | (void)RREG32(RADEON_PCIE_INDEX); | ||
612 | WREG32(RADEON_PCIE_DATA, (v)); | ||
613 | (void)RREG32(RADEON_PCIE_DATA); | ||
614 | } | ||
615 | |||
616 | /* | ||
617 | * PCIE Lanes | 598 | * PCIE Lanes |
618 | */ | 599 | */ |
619 | 600 | ||
@@ -1403,6 +1384,21 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
1403 | tmp = (ib_chunk->kdata[idx] >> 22) & 0xF; | 1384 | tmp = (ib_chunk->kdata[idx] >> 22) & 0xF; |
1404 | track->textures[i].txdepth = tmp; | 1385 | track->textures[i].txdepth = tmp; |
1405 | break; | 1386 | break; |
1387 | case R300_ZB_ZPASS_ADDR: | ||
1388 | r = r100_cs_packet_next_reloc(p, &reloc); | ||
1389 | if (r) { | ||
1390 | DRM_ERROR("No reloc for ib[%d]=0x%04X\n", | ||
1391 | idx, reg); | ||
1392 | r100_cs_dump_packet(p, pkt); | ||
1393 | return r; | ||
1394 | } | ||
1395 | ib[idx] = ib_chunk->kdata[idx] + ((u32)reloc->lobj.gpu_offset); | ||
1396 | break; | ||
1397 | case 0x4be8: | ||
1398 | /* valid register only on RV530 */ | ||
1399 | if (p->rdev->family == CHIP_RV530) | ||
1400 | break; | ||
1401 | /* fallthrough do not move */ | ||
1406 | default: | 1402 | default: |
1407 | printk(KERN_ERR "Forbidden register 0x%04X in cs at %d\n", | 1403 | printk(KERN_ERR "Forbidden register 0x%04X in cs at %d\n", |
1408 | reg, idx); | 1404 | reg, idx); |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index dea497a979f2..97426a6f370f 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
@@ -165,7 +165,18 @@ void r420_pipes_init(struct radeon_device *rdev) | |||
165 | printk(KERN_WARNING "Failed to wait GUI idle while " | 165 | printk(KERN_WARNING "Failed to wait GUI idle while " |
166 | "programming pipes. Bad things might happen.\n"); | 166 | "programming pipes. Bad things might happen.\n"); |
167 | } | 167 | } |
168 | DRM_INFO("radeon: %d pipes initialized.\n", rdev->num_gb_pipes); | 168 | |
169 | if (rdev->family == CHIP_RV530) { | ||
170 | tmp = RREG32(RV530_GB_PIPE_SELECT2); | ||
171 | if ((tmp & 3) == 3) | ||
172 | rdev->num_z_pipes = 2; | ||
173 | else | ||
174 | rdev->num_z_pipes = 1; | ||
175 | } else | ||
176 | rdev->num_z_pipes = 1; | ||
177 | |||
178 | DRM_INFO("radeon: %d quad pipes, %d z pipes initialized.\n", | ||
179 | rdev->num_gb_pipes, rdev->num_z_pipes); | ||
169 | } | 180 | } |
170 | 181 | ||
171 | void r420_gpu_init(struct radeon_device *rdev) | 182 | void r420_gpu_init(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/r500_reg.h b/drivers/gpu/drm/radeon/r500_reg.h index 036691b38cb7..e1d5e0331e19 100644 --- a/drivers/gpu/drm/radeon/r500_reg.h +++ b/drivers/gpu/drm/radeon/r500_reg.h | |||
@@ -350,6 +350,7 @@ | |||
350 | #define AVIVO_D1CRTC_BLANK_CONTROL 0x6084 | 350 | #define AVIVO_D1CRTC_BLANK_CONTROL 0x6084 |
351 | #define AVIVO_D1CRTC_INTERLACE_CONTROL 0x6088 | 351 | #define AVIVO_D1CRTC_INTERLACE_CONTROL 0x6088 |
352 | #define AVIVO_D1CRTC_INTERLACE_STATUS 0x608c | 352 | #define AVIVO_D1CRTC_INTERLACE_STATUS 0x608c |
353 | #define AVIVO_D1CRTC_FRAME_COUNT 0x60a4 | ||
353 | #define AVIVO_D1CRTC_STEREO_CONTROL 0x60c4 | 354 | #define AVIVO_D1CRTC_STEREO_CONTROL 0x60c4 |
354 | 355 | ||
355 | /* master controls */ | 356 | /* master controls */ |
@@ -438,14 +439,15 @@ | |||
438 | # define AVIVO_DC_LB_DISP1_END_ADR_SHIFT 4 | 439 | # define AVIVO_DC_LB_DISP1_END_ADR_SHIFT 4 |
439 | # define AVIVO_DC_LB_DISP1_END_ADR_MASK 0x7ff | 440 | # define AVIVO_DC_LB_DISP1_END_ADR_MASK 0x7ff |
440 | 441 | ||
441 | #define R500_DxMODE_INT_MASK 0x6540 | ||
442 | #define R500_D1MODE_INT_MASK (1<<0) | ||
443 | #define R500_D2MODE_INT_MASK (1<<8) | ||
444 | |||
445 | #define AVIVO_D1MODE_DATA_FORMAT 0x6528 | 442 | #define AVIVO_D1MODE_DATA_FORMAT 0x6528 |
446 | # define AVIVO_D1MODE_INTERLEAVE_EN (1 << 0) | 443 | # define AVIVO_D1MODE_INTERLEAVE_EN (1 << 0) |
447 | #define AVIVO_D1MODE_DESKTOP_HEIGHT 0x652C | 444 | #define AVIVO_D1MODE_DESKTOP_HEIGHT 0x652C |
445 | #define AVIVO_D1MODE_VBLANK_STATUS 0x6534 | ||
446 | # define AVIVO_VBLANK_ACK (1 << 4) | ||
448 | #define AVIVO_D1MODE_VLINE_START_END 0x6538 | 447 | #define AVIVO_D1MODE_VLINE_START_END 0x6538 |
448 | #define AVIVO_DxMODE_INT_MASK 0x6540 | ||
449 | # define AVIVO_D1MODE_INT_MASK (1 << 0) | ||
450 | # define AVIVO_D2MODE_INT_MASK (1 << 8) | ||
449 | #define AVIVO_D1MODE_VIEWPORT_START 0x6580 | 451 | #define AVIVO_D1MODE_VIEWPORT_START 0x6580 |
450 | #define AVIVO_D1MODE_VIEWPORT_SIZE 0x6584 | 452 | #define AVIVO_D1MODE_VIEWPORT_SIZE 0x6584 |
451 | #define AVIVO_D1MODE_EXT_OVERSCAN_LEFT_RIGHT 0x6588 | 453 | #define AVIVO_D1MODE_EXT_OVERSCAN_LEFT_RIGHT 0x6588 |
@@ -475,6 +477,7 @@ | |||
475 | #define AVIVO_D2CRTC_BLANK_CONTROL 0x6884 | 477 | #define AVIVO_D2CRTC_BLANK_CONTROL 0x6884 |
476 | #define AVIVO_D2CRTC_INTERLACE_CONTROL 0x6888 | 478 | #define AVIVO_D2CRTC_INTERLACE_CONTROL 0x6888 |
477 | #define AVIVO_D2CRTC_INTERLACE_STATUS 0x688c | 479 | #define AVIVO_D2CRTC_INTERLACE_STATUS 0x688c |
480 | #define AVIVO_D2CRTC_FRAME_COUNT 0x68a4 | ||
478 | #define AVIVO_D2CRTC_STEREO_CONTROL 0x68c4 | 481 | #define AVIVO_D2CRTC_STEREO_CONTROL 0x68c4 |
479 | 482 | ||
480 | #define AVIVO_D2GRPH_ENABLE 0x6900 | 483 | #define AVIVO_D2GRPH_ENABLE 0x6900 |
@@ -497,6 +500,7 @@ | |||
497 | #define AVIVO_D2CUR_SIZE 0x6c10 | 500 | #define AVIVO_D2CUR_SIZE 0x6c10 |
498 | #define AVIVO_D2CUR_POSITION 0x6c14 | 501 | #define AVIVO_D2CUR_POSITION 0x6c14 |
499 | 502 | ||
503 | #define AVIVO_D2MODE_VBLANK_STATUS 0x6d34 | ||
500 | #define AVIVO_D2MODE_VLINE_START_END 0x6d38 | 504 | #define AVIVO_D2MODE_VLINE_START_END 0x6d38 |
501 | #define AVIVO_D2MODE_VIEWPORT_START 0x6d80 | 505 | #define AVIVO_D2MODE_VIEWPORT_START 0x6d80 |
502 | #define AVIVO_D2MODE_VIEWPORT_SIZE 0x6d84 | 506 | #define AVIVO_D2MODE_VIEWPORT_SIZE 0x6d84 |
@@ -748,4 +752,8 @@ | |||
748 | # define AVIVO_I2C_EN (1 << 0) | 752 | # define AVIVO_I2C_EN (1 << 0) |
749 | # define AVIVO_I2C_RESET (1 << 8) | 753 | # define AVIVO_I2C_RESET (1 << 8) |
750 | 754 | ||
755 | #define AVIVO_DISP_INTERRUPT_STATUS 0x7edc | ||
756 | # define AVIVO_D1_VBLANK_INTERRUPT (1 << 4) | ||
757 | # define AVIVO_D2_VBLANK_INTERRUPT (1 << 5) | ||
758 | |||
751 | #endif | 759 | #endif |
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c index 09fb0b6ec7dd..ebd6b0f7bdff 100644 --- a/drivers/gpu/drm/radeon/r520.c +++ b/drivers/gpu/drm/radeon/r520.c | |||
@@ -177,7 +177,6 @@ void r520_gpu_init(struct radeon_device *rdev) | |||
177 | */ | 177 | */ |
178 | /* workaround for RV530 */ | 178 | /* workaround for RV530 */ |
179 | if (rdev->family == CHIP_RV530) { | 179 | if (rdev->family == CHIP_RV530) { |
180 | WREG32(0x4124, 1); | ||
181 | WREG32(0x4128, 0xFF); | 180 | WREG32(0x4128, 0xFF); |
182 | } | 181 | } |
183 | r420_pipes_init(rdev); | 182 | r420_pipes_init(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index b1d945b8ed6c..b519fb2fecbb 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -242,6 +242,7 @@ int radeon_object_pin(struct radeon_object *robj, uint32_t domain, | |||
242 | uint64_t *gpu_addr); | 242 | uint64_t *gpu_addr); |
243 | void radeon_object_unpin(struct radeon_object *robj); | 243 | void radeon_object_unpin(struct radeon_object *robj); |
244 | int radeon_object_wait(struct radeon_object *robj); | 244 | int radeon_object_wait(struct radeon_object *robj); |
245 | int radeon_object_busy_domain(struct radeon_object *robj, uint32_t *cur_placement); | ||
245 | int radeon_object_evict_vram(struct radeon_device *rdev); | 246 | int radeon_object_evict_vram(struct radeon_device *rdev); |
246 | int radeon_object_mmap(struct radeon_object *robj, uint64_t *offset); | 247 | int radeon_object_mmap(struct radeon_object *robj, uint64_t *offset); |
247 | void radeon_object_force_delete(struct radeon_device *rdev); | 248 | void radeon_object_force_delete(struct radeon_device *rdev); |
@@ -574,6 +575,7 @@ struct radeon_asic { | |||
574 | void (*ring_start)(struct radeon_device *rdev); | 575 | void (*ring_start)(struct radeon_device *rdev); |
575 | int (*irq_set)(struct radeon_device *rdev); | 576 | int (*irq_set)(struct radeon_device *rdev); |
576 | int (*irq_process)(struct radeon_device *rdev); | 577 | int (*irq_process)(struct radeon_device *rdev); |
578 | u32 (*get_vblank_counter)(struct radeon_device *rdev, int crtc); | ||
577 | void (*fence_ring_emit)(struct radeon_device *rdev, struct radeon_fence *fence); | 579 | void (*fence_ring_emit)(struct radeon_device *rdev, struct radeon_fence *fence); |
578 | int (*cs_parse)(struct radeon_cs_parser *p); | 580 | int (*cs_parse)(struct radeon_cs_parser *p); |
579 | int (*copy_blit)(struct radeon_device *rdev, | 581 | int (*copy_blit)(struct radeon_device *rdev, |
@@ -653,6 +655,7 @@ struct radeon_device { | |||
653 | int usec_timeout; | 655 | int usec_timeout; |
654 | enum radeon_pll_errata pll_errata; | 656 | enum radeon_pll_errata pll_errata; |
655 | int num_gb_pipes; | 657 | int num_gb_pipes; |
658 | int num_z_pipes; | ||
656 | int disp_priority; | 659 | int disp_priority; |
657 | /* BIOS */ | 660 | /* BIOS */ |
658 | uint8_t *bios; | 661 | uint8_t *bios; |
@@ -666,14 +669,11 @@ struct radeon_device { | |||
666 | resource_size_t rmmio_base; | 669 | resource_size_t rmmio_base; |
667 | resource_size_t rmmio_size; | 670 | resource_size_t rmmio_size; |
668 | void *rmmio; | 671 | void *rmmio; |
669 | radeon_rreg_t mm_rreg; | ||
670 | radeon_wreg_t mm_wreg; | ||
671 | radeon_rreg_t mc_rreg; | 672 | radeon_rreg_t mc_rreg; |
672 | radeon_wreg_t mc_wreg; | 673 | radeon_wreg_t mc_wreg; |
673 | radeon_rreg_t pll_rreg; | 674 | radeon_rreg_t pll_rreg; |
674 | radeon_wreg_t pll_wreg; | 675 | radeon_wreg_t pll_wreg; |
675 | radeon_rreg_t pcie_rreg; | 676 | uint32_t pcie_reg_mask; |
676 | radeon_wreg_t pcie_wreg; | ||
677 | radeon_rreg_t pciep_rreg; | 677 | radeon_rreg_t pciep_rreg; |
678 | radeon_wreg_t pciep_wreg; | 678 | radeon_wreg_t pciep_wreg; |
679 | struct radeon_clock clock; | 679 | struct radeon_clock clock; |
@@ -705,22 +705,42 @@ int radeon_device_init(struct radeon_device *rdev, | |||
705 | void radeon_device_fini(struct radeon_device *rdev); | 705 | void radeon_device_fini(struct radeon_device *rdev); |
706 | int radeon_gpu_wait_for_idle(struct radeon_device *rdev); | 706 | int radeon_gpu_wait_for_idle(struct radeon_device *rdev); |
707 | 707 | ||
708 | static inline uint32_t r100_mm_rreg(struct radeon_device *rdev, uint32_t reg) | ||
709 | { | ||
710 | if (reg < 0x10000) | ||
711 | return readl(((void __iomem *)rdev->rmmio) + reg); | ||
712 | else { | ||
713 | writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX); | ||
714 | return readl(((void __iomem *)rdev->rmmio) + RADEON_MM_DATA); | ||
715 | } | ||
716 | } | ||
717 | |||
718 | static inline void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | ||
719 | { | ||
720 | if (reg < 0x10000) | ||
721 | writel(v, ((void __iomem *)rdev->rmmio) + reg); | ||
722 | else { | ||
723 | writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX); | ||
724 | writel(v, ((void __iomem *)rdev->rmmio) + RADEON_MM_DATA); | ||
725 | } | ||
726 | } | ||
727 | |||
708 | 728 | ||
709 | /* | 729 | /* |
710 | * Registers read & write functions. | 730 | * Registers read & write functions. |
711 | */ | 731 | */ |
712 | #define RREG8(reg) readb(((void __iomem *)rdev->rmmio) + (reg)) | 732 | #define RREG8(reg) readb(((void __iomem *)rdev->rmmio) + (reg)) |
713 | #define WREG8(reg, v) writeb(v, ((void __iomem *)rdev->rmmio) + (reg)) | 733 | #define WREG8(reg, v) writeb(v, ((void __iomem *)rdev->rmmio) + (reg)) |
714 | #define RREG32(reg) rdev->mm_rreg(rdev, (reg)) | 734 | #define RREG32(reg) r100_mm_rreg(rdev, (reg)) |
715 | #define WREG32(reg, v) rdev->mm_wreg(rdev, (reg), (v)) | 735 | #define WREG32(reg, v) r100_mm_wreg(rdev, (reg), (v)) |
716 | #define REG_SET(FIELD, v) (((v) << FIELD##_SHIFT) & FIELD##_MASK) | 736 | #define REG_SET(FIELD, v) (((v) << FIELD##_SHIFT) & FIELD##_MASK) |
717 | #define REG_GET(FIELD, v) (((v) << FIELD##_SHIFT) & FIELD##_MASK) | 737 | #define REG_GET(FIELD, v) (((v) << FIELD##_SHIFT) & FIELD##_MASK) |
718 | #define RREG32_PLL(reg) rdev->pll_rreg(rdev, (reg)) | 738 | #define RREG32_PLL(reg) rdev->pll_rreg(rdev, (reg)) |
719 | #define WREG32_PLL(reg, v) rdev->pll_wreg(rdev, (reg), (v)) | 739 | #define WREG32_PLL(reg, v) rdev->pll_wreg(rdev, (reg), (v)) |
720 | #define RREG32_MC(reg) rdev->mc_rreg(rdev, (reg)) | 740 | #define RREG32_MC(reg) rdev->mc_rreg(rdev, (reg)) |
721 | #define WREG32_MC(reg, v) rdev->mc_wreg(rdev, (reg), (v)) | 741 | #define WREG32_MC(reg, v) rdev->mc_wreg(rdev, (reg), (v)) |
722 | #define RREG32_PCIE(reg) rdev->pcie_rreg(rdev, (reg)) | 742 | #define RREG32_PCIE(reg) rv370_pcie_rreg(rdev, (reg)) |
723 | #define WREG32_PCIE(reg, v) rdev->pcie_wreg(rdev, (reg), (v)) | 743 | #define WREG32_PCIE(reg, v) rv370_pcie_wreg(rdev, (reg), (v)) |
724 | #define WREG32_P(reg, val, mask) \ | 744 | #define WREG32_P(reg, val, mask) \ |
725 | do { \ | 745 | do { \ |
726 | uint32_t tmp_ = RREG32(reg); \ | 746 | uint32_t tmp_ = RREG32(reg); \ |
@@ -736,6 +756,24 @@ int radeon_gpu_wait_for_idle(struct radeon_device *rdev); | |||
736 | WREG32_PLL(reg, tmp_); \ | 756 | WREG32_PLL(reg, tmp_); \ |
737 | } while (0) | 757 | } while (0) |
738 | 758 | ||
759 | /* | ||
760 | * Indirect registers accessor | ||
761 | */ | ||
762 | static inline uint32_t rv370_pcie_rreg(struct radeon_device *rdev, uint32_t reg) | ||
763 | { | ||
764 | uint32_t r; | ||
765 | |||
766 | WREG32(RADEON_PCIE_INDEX, ((reg) & rdev->pcie_reg_mask)); | ||
767 | r = RREG32(RADEON_PCIE_DATA); | ||
768 | return r; | ||
769 | } | ||
770 | |||
771 | static inline void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | ||
772 | { | ||
773 | WREG32(RADEON_PCIE_INDEX, ((reg) & rdev->pcie_reg_mask)); | ||
774 | WREG32(RADEON_PCIE_DATA, (v)); | ||
775 | } | ||
776 | |||
739 | void r100_pll_errata_after_index(struct radeon_device *rdev); | 777 | void r100_pll_errata_after_index(struct radeon_device *rdev); |
740 | 778 | ||
741 | 779 | ||
@@ -862,6 +900,7 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v) | |||
862 | #define radeon_ring_start(rdev) (rdev)->asic->ring_start((rdev)) | 900 | #define radeon_ring_start(rdev) (rdev)->asic->ring_start((rdev)) |
863 | #define radeon_irq_set(rdev) (rdev)->asic->irq_set((rdev)) | 901 | #define radeon_irq_set(rdev) (rdev)->asic->irq_set((rdev)) |
864 | #define radeon_irq_process(rdev) (rdev)->asic->irq_process((rdev)) | 902 | #define radeon_irq_process(rdev) (rdev)->asic->irq_process((rdev)) |
903 | #define radeon_get_vblank_counter(rdev, crtc) (rdev)->asic->get_vblank_counter((rdev), (crtc)) | ||
865 | #define radeon_fence_ring_emit(rdev, fence) (rdev)->asic->fence_ring_emit((rdev), (fence)) | 904 | #define radeon_fence_ring_emit(rdev, fence) (rdev)->asic->fence_ring_emit((rdev), (fence)) |
866 | #define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy_blit((rdev), (s), (d), (np), (f)) | 905 | #define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy_blit((rdev), (s), (d), (np), (f)) |
867 | #define radeon_copy_dma(rdev, s, d, np, f) (rdev)->asic->copy_dma((rdev), (s), (d), (np), (f)) | 906 | #define radeon_copy_dma(rdev, s, d, np, f) (rdev)->asic->copy_dma((rdev), (s), (d), (np), (f)) |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 9a75876e0c3b..7ca6c13569b5 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -49,6 +49,7 @@ void r100_vram_info(struct radeon_device *rdev); | |||
49 | int r100_gpu_reset(struct radeon_device *rdev); | 49 | int r100_gpu_reset(struct radeon_device *rdev); |
50 | int r100_mc_init(struct radeon_device *rdev); | 50 | int r100_mc_init(struct radeon_device *rdev); |
51 | void r100_mc_fini(struct radeon_device *rdev); | 51 | void r100_mc_fini(struct radeon_device *rdev); |
52 | u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc); | ||
52 | int r100_wb_init(struct radeon_device *rdev); | 53 | int r100_wb_init(struct radeon_device *rdev); |
53 | void r100_wb_fini(struct radeon_device *rdev); | 54 | void r100_wb_fini(struct radeon_device *rdev); |
54 | int r100_gart_enable(struct radeon_device *rdev); | 55 | int r100_gart_enable(struct radeon_device *rdev); |
@@ -96,6 +97,7 @@ static struct radeon_asic r100_asic = { | |||
96 | .ring_start = &r100_ring_start, | 97 | .ring_start = &r100_ring_start, |
97 | .irq_set = &r100_irq_set, | 98 | .irq_set = &r100_irq_set, |
98 | .irq_process = &r100_irq_process, | 99 | .irq_process = &r100_irq_process, |
100 | .get_vblank_counter = &r100_get_vblank_counter, | ||
99 | .fence_ring_emit = &r100_fence_ring_emit, | 101 | .fence_ring_emit = &r100_fence_ring_emit, |
100 | .cs_parse = &r100_cs_parse, | 102 | .cs_parse = &r100_cs_parse, |
101 | .copy_blit = &r100_copy_blit, | 103 | .copy_blit = &r100_copy_blit, |
@@ -156,6 +158,7 @@ static struct radeon_asic r300_asic = { | |||
156 | .ring_start = &r300_ring_start, | 158 | .ring_start = &r300_ring_start, |
157 | .irq_set = &r100_irq_set, | 159 | .irq_set = &r100_irq_set, |
158 | .irq_process = &r100_irq_process, | 160 | .irq_process = &r100_irq_process, |
161 | .get_vblank_counter = &r100_get_vblank_counter, | ||
159 | .fence_ring_emit = &r300_fence_ring_emit, | 162 | .fence_ring_emit = &r300_fence_ring_emit, |
160 | .cs_parse = &r300_cs_parse, | 163 | .cs_parse = &r300_cs_parse, |
161 | .copy_blit = &r100_copy_blit, | 164 | .copy_blit = &r100_copy_blit, |
@@ -196,6 +199,7 @@ static struct radeon_asic r420_asic = { | |||
196 | .ring_start = &r300_ring_start, | 199 | .ring_start = &r300_ring_start, |
197 | .irq_set = &r100_irq_set, | 200 | .irq_set = &r100_irq_set, |
198 | .irq_process = &r100_irq_process, | 201 | .irq_process = &r100_irq_process, |
202 | .get_vblank_counter = &r100_get_vblank_counter, | ||
199 | .fence_ring_emit = &r300_fence_ring_emit, | 203 | .fence_ring_emit = &r300_fence_ring_emit, |
200 | .cs_parse = &r300_cs_parse, | 204 | .cs_parse = &r300_cs_parse, |
201 | .copy_blit = &r100_copy_blit, | 205 | .copy_blit = &r100_copy_blit, |
@@ -243,6 +247,7 @@ static struct radeon_asic rs400_asic = { | |||
243 | .ring_start = &r300_ring_start, | 247 | .ring_start = &r300_ring_start, |
244 | .irq_set = &r100_irq_set, | 248 | .irq_set = &r100_irq_set, |
245 | .irq_process = &r100_irq_process, | 249 | .irq_process = &r100_irq_process, |
250 | .get_vblank_counter = &r100_get_vblank_counter, | ||
246 | .fence_ring_emit = &r300_fence_ring_emit, | 251 | .fence_ring_emit = &r300_fence_ring_emit, |
247 | .cs_parse = &r300_cs_parse, | 252 | .cs_parse = &r300_cs_parse, |
248 | .copy_blit = &r100_copy_blit, | 253 | .copy_blit = &r100_copy_blit, |
@@ -266,6 +271,8 @@ void rs600_vram_info(struct radeon_device *rdev); | |||
266 | int rs600_mc_init(struct radeon_device *rdev); | 271 | int rs600_mc_init(struct radeon_device *rdev); |
267 | void rs600_mc_fini(struct radeon_device *rdev); | 272 | void rs600_mc_fini(struct radeon_device *rdev); |
268 | int rs600_irq_set(struct radeon_device *rdev); | 273 | int rs600_irq_set(struct radeon_device *rdev); |
274 | int rs600_irq_process(struct radeon_device *rdev); | ||
275 | u32 rs600_get_vblank_counter(struct radeon_device *rdev, int crtc); | ||
269 | int rs600_gart_enable(struct radeon_device *rdev); | 276 | int rs600_gart_enable(struct radeon_device *rdev); |
270 | void rs600_gart_disable(struct radeon_device *rdev); | 277 | void rs600_gart_disable(struct radeon_device *rdev); |
271 | void rs600_gart_tlb_flush(struct radeon_device *rdev); | 278 | void rs600_gart_tlb_flush(struct radeon_device *rdev); |
@@ -291,7 +298,8 @@ static struct radeon_asic rs600_asic = { | |||
291 | .cp_disable = &r100_cp_disable, | 298 | .cp_disable = &r100_cp_disable, |
292 | .ring_start = &r300_ring_start, | 299 | .ring_start = &r300_ring_start, |
293 | .irq_set = &rs600_irq_set, | 300 | .irq_set = &rs600_irq_set, |
294 | .irq_process = &r100_irq_process, | 301 | .irq_process = &rs600_irq_process, |
302 | .get_vblank_counter = &rs600_get_vblank_counter, | ||
295 | .fence_ring_emit = &r300_fence_ring_emit, | 303 | .fence_ring_emit = &r300_fence_ring_emit, |
296 | .cs_parse = &r300_cs_parse, | 304 | .cs_parse = &r300_cs_parse, |
297 | .copy_blit = &r100_copy_blit, | 305 | .copy_blit = &r100_copy_blit, |
@@ -308,6 +316,7 @@ static struct radeon_asic rs600_asic = { | |||
308 | /* | 316 | /* |
309 | * rs690,rs740 | 317 | * rs690,rs740 |
310 | */ | 318 | */ |
319 | int rs690_init(struct radeon_device *rdev); | ||
311 | void rs690_errata(struct radeon_device *rdev); | 320 | void rs690_errata(struct radeon_device *rdev); |
312 | void rs690_vram_info(struct radeon_device *rdev); | 321 | void rs690_vram_info(struct radeon_device *rdev); |
313 | int rs690_mc_init(struct radeon_device *rdev); | 322 | int rs690_mc_init(struct radeon_device *rdev); |
@@ -316,7 +325,7 @@ uint32_t rs690_mc_rreg(struct radeon_device *rdev, uint32_t reg); | |||
316 | void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v); | 325 | void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v); |
317 | void rs690_bandwidth_update(struct radeon_device *rdev); | 326 | void rs690_bandwidth_update(struct radeon_device *rdev); |
318 | static struct radeon_asic rs690_asic = { | 327 | static struct radeon_asic rs690_asic = { |
319 | .init = &r300_init, | 328 | .init = &rs690_init, |
320 | .errata = &rs690_errata, | 329 | .errata = &rs690_errata, |
321 | .vram_info = &rs690_vram_info, | 330 | .vram_info = &rs690_vram_info, |
322 | .gpu_reset = &r300_gpu_reset, | 331 | .gpu_reset = &r300_gpu_reset, |
@@ -333,7 +342,8 @@ static struct radeon_asic rs690_asic = { | |||
333 | .cp_disable = &r100_cp_disable, | 342 | .cp_disable = &r100_cp_disable, |
334 | .ring_start = &r300_ring_start, | 343 | .ring_start = &r300_ring_start, |
335 | .irq_set = &rs600_irq_set, | 344 | .irq_set = &rs600_irq_set, |
336 | .irq_process = &r100_irq_process, | 345 | .irq_process = &rs600_irq_process, |
346 | .get_vblank_counter = &rs600_get_vblank_counter, | ||
337 | .fence_ring_emit = &r300_fence_ring_emit, | 347 | .fence_ring_emit = &r300_fence_ring_emit, |
338 | .cs_parse = &r300_cs_parse, | 348 | .cs_parse = &r300_cs_parse, |
339 | .copy_blit = &r100_copy_blit, | 349 | .copy_blit = &r100_copy_blit, |
@@ -381,8 +391,9 @@ static struct radeon_asic rv515_asic = { | |||
381 | .cp_fini = &r100_cp_fini, | 391 | .cp_fini = &r100_cp_fini, |
382 | .cp_disable = &r100_cp_disable, | 392 | .cp_disable = &r100_cp_disable, |
383 | .ring_start = &rv515_ring_start, | 393 | .ring_start = &rv515_ring_start, |
384 | .irq_set = &r100_irq_set, | 394 | .irq_set = &rs600_irq_set, |
385 | .irq_process = &r100_irq_process, | 395 | .irq_process = &rs600_irq_process, |
396 | .get_vblank_counter = &rs600_get_vblank_counter, | ||
386 | .fence_ring_emit = &r300_fence_ring_emit, | 397 | .fence_ring_emit = &r300_fence_ring_emit, |
387 | .cs_parse = &r300_cs_parse, | 398 | .cs_parse = &r300_cs_parse, |
388 | .copy_blit = &r100_copy_blit, | 399 | .copy_blit = &r100_copy_blit, |
@@ -423,8 +434,9 @@ static struct radeon_asic r520_asic = { | |||
423 | .cp_fini = &r100_cp_fini, | 434 | .cp_fini = &r100_cp_fini, |
424 | .cp_disable = &r100_cp_disable, | 435 | .cp_disable = &r100_cp_disable, |
425 | .ring_start = &rv515_ring_start, | 436 | .ring_start = &rv515_ring_start, |
426 | .irq_set = &r100_irq_set, | 437 | .irq_set = &rs600_irq_set, |
427 | .irq_process = &r100_irq_process, | 438 | .irq_process = &rs600_irq_process, |
439 | .get_vblank_counter = &rs600_get_vblank_counter, | ||
428 | .fence_ring_emit = &r300_fence_ring_emit, | 440 | .fence_ring_emit = &r300_fence_ring_emit, |
429 | .cs_parse = &r300_cs_parse, | 441 | .cs_parse = &r300_cs_parse, |
430 | .copy_blit = &r100_copy_blit, | 442 | .copy_blit = &r100_copy_blit, |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index afc4db280b94..2a027e00762a 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -685,23 +685,15 @@ static const uint32_t default_tvdac_adj[CHIP_LAST] = { | |||
685 | 0x00780000, /* rs480 */ | 685 | 0x00780000, /* rs480 */ |
686 | }; | 686 | }; |
687 | 687 | ||
688 | static struct radeon_encoder_tv_dac | 688 | static void radeon_legacy_get_tv_dac_info_from_table(struct radeon_device *rdev, |
689 | *radeon_legacy_get_tv_dac_info_from_table(struct radeon_device *rdev) | 689 | struct radeon_encoder_tv_dac *tv_dac) |
690 | { | 690 | { |
691 | struct radeon_encoder_tv_dac *tv_dac = NULL; | ||
692 | |||
693 | tv_dac = kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL); | ||
694 | |||
695 | if (!tv_dac) | ||
696 | return NULL; | ||
697 | |||
698 | tv_dac->ps2_tvdac_adj = default_tvdac_adj[rdev->family]; | 691 | tv_dac->ps2_tvdac_adj = default_tvdac_adj[rdev->family]; |
699 | if ((rdev->flags & RADEON_IS_MOBILITY) && (rdev->family == CHIP_RV250)) | 692 | if ((rdev->flags & RADEON_IS_MOBILITY) && (rdev->family == CHIP_RV250)) |
700 | tv_dac->ps2_tvdac_adj = 0x00880000; | 693 | tv_dac->ps2_tvdac_adj = 0x00880000; |
701 | tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; | 694 | tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; |
702 | tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; | 695 | tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; |
703 | 696 | return; | |
704 | return tv_dac; | ||
705 | } | 697 | } |
706 | 698 | ||
707 | struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct | 699 | struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct |
@@ -713,19 +705,18 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct | |||
713 | uint16_t dac_info; | 705 | uint16_t dac_info; |
714 | uint8_t rev, bg, dac; | 706 | uint8_t rev, bg, dac; |
715 | struct radeon_encoder_tv_dac *tv_dac = NULL; | 707 | struct radeon_encoder_tv_dac *tv_dac = NULL; |
708 | int found = 0; | ||
709 | |||
710 | tv_dac = kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL); | ||
711 | if (!tv_dac) | ||
712 | return NULL; | ||
716 | 713 | ||
717 | if (rdev->bios == NULL) | 714 | if (rdev->bios == NULL) |
718 | return radeon_legacy_get_tv_dac_info_from_table(rdev); | 715 | goto out; |
719 | 716 | ||
720 | /* first check TV table */ | 717 | /* first check TV table */ |
721 | dac_info = combios_get_table_offset(dev, COMBIOS_TV_INFO_TABLE); | 718 | dac_info = combios_get_table_offset(dev, COMBIOS_TV_INFO_TABLE); |
722 | if (dac_info) { | 719 | if (dac_info) { |
723 | tv_dac = | ||
724 | kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL); | ||
725 | |||
726 | if (!tv_dac) | ||
727 | return NULL; | ||
728 | |||
729 | rev = RBIOS8(dac_info + 0x3); | 720 | rev = RBIOS8(dac_info + 0x3); |
730 | if (rev > 4) { | 721 | if (rev > 4) { |
731 | bg = RBIOS8(dac_info + 0xc) & 0xf; | 722 | bg = RBIOS8(dac_info + 0xc) & 0xf; |
@@ -739,6 +730,7 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct | |||
739 | bg = RBIOS8(dac_info + 0x10) & 0xf; | 730 | bg = RBIOS8(dac_info + 0x10) & 0xf; |
740 | dac = RBIOS8(dac_info + 0x11) & 0xf; | 731 | dac = RBIOS8(dac_info + 0x11) & 0xf; |
741 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); | 732 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); |
733 | found = 1; | ||
742 | } else if (rev > 1) { | 734 | } else if (rev > 1) { |
743 | bg = RBIOS8(dac_info + 0xc) & 0xf; | 735 | bg = RBIOS8(dac_info + 0xc) & 0xf; |
744 | dac = (RBIOS8(dac_info + 0xc) >> 4) & 0xf; | 736 | dac = (RBIOS8(dac_info + 0xc) >> 4) & 0xf; |
@@ -751,22 +743,15 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct | |||
751 | bg = RBIOS8(dac_info + 0xe) & 0xf; | 743 | bg = RBIOS8(dac_info + 0xe) & 0xf; |
752 | dac = (RBIOS8(dac_info + 0xe) >> 4) & 0xf; | 744 | dac = (RBIOS8(dac_info + 0xe) >> 4) & 0xf; |
753 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); | 745 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); |
746 | found = 1; | ||
754 | } | 747 | } |
755 | |||
756 | tv_dac->tv_std = radeon_combios_get_tv_info(encoder); | 748 | tv_dac->tv_std = radeon_combios_get_tv_info(encoder); |
757 | 749 | } | |
758 | } else { | 750 | if (!found) { |
759 | /* then check CRT table */ | 751 | /* then check CRT table */ |
760 | dac_info = | 752 | dac_info = |
761 | combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE); | 753 | combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE); |
762 | if (dac_info) { | 754 | if (dac_info) { |
763 | tv_dac = | ||
764 | kzalloc(sizeof(struct radeon_encoder_tv_dac), | ||
765 | GFP_KERNEL); | ||
766 | |||
767 | if (!tv_dac) | ||
768 | return NULL; | ||
769 | |||
770 | rev = RBIOS8(dac_info) & 0x3; | 755 | rev = RBIOS8(dac_info) & 0x3; |
771 | if (rev < 2) { | 756 | if (rev < 2) { |
772 | bg = RBIOS8(dac_info + 0x3) & 0xf; | 757 | bg = RBIOS8(dac_info + 0x3) & 0xf; |
@@ -775,6 +760,7 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct | |||
775 | (bg << 16) | (dac << 20); | 760 | (bg << 16) | (dac << 20); |
776 | tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; | 761 | tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; |
777 | tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; | 762 | tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; |
763 | found = 1; | ||
778 | } else { | 764 | } else { |
779 | bg = RBIOS8(dac_info + 0x4) & 0xf; | 765 | bg = RBIOS8(dac_info + 0x4) & 0xf; |
780 | dac = RBIOS8(dac_info + 0x5) & 0xf; | 766 | dac = RBIOS8(dac_info + 0x5) & 0xf; |
@@ -782,13 +768,17 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct | |||
782 | (bg << 16) | (dac << 20); | 768 | (bg << 16) | (dac << 20); |
783 | tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; | 769 | tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; |
784 | tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; | 770 | tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; |
771 | found = 1; | ||
785 | } | 772 | } |
786 | } else { | 773 | } else { |
787 | DRM_INFO("No TV DAC info found in BIOS\n"); | 774 | DRM_INFO("No TV DAC info found in BIOS\n"); |
788 | return radeon_legacy_get_tv_dac_info_from_table(rdev); | ||
789 | } | 775 | } |
790 | } | 776 | } |
791 | 777 | ||
778 | out: | ||
779 | if (!found) /* fallback to defaults */ | ||
780 | radeon_legacy_get_tv_dac_info_from_table(rdev, tv_dac); | ||
781 | |||
792 | return tv_dac; | 782 | return tv_dac; |
793 | } | 783 | } |
794 | 784 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c index d8356827ef17..7a52c461145c 100644 --- a/drivers/gpu/drm/radeon/radeon_cp.c +++ b/drivers/gpu/drm/radeon/radeon_cp.c | |||
@@ -406,6 +406,15 @@ static void radeon_init_pipes(drm_radeon_private_t *dev_priv) | |||
406 | { | 406 | { |
407 | uint32_t gb_tile_config, gb_pipe_sel = 0; | 407 | uint32_t gb_tile_config, gb_pipe_sel = 0; |
408 | 408 | ||
409 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV530) { | ||
410 | uint32_t z_pipe_sel = RADEON_READ(RV530_GB_PIPE_SELECT2); | ||
411 | if ((z_pipe_sel & 3) == 3) | ||
412 | dev_priv->num_z_pipes = 2; | ||
413 | else | ||
414 | dev_priv->num_z_pipes = 1; | ||
415 | } else | ||
416 | dev_priv->num_z_pipes = 1; | ||
417 | |||
409 | /* RS4xx/RS6xx/R4xx/R5xx */ | 418 | /* RS4xx/RS6xx/R4xx/R5xx */ |
410 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) { | 419 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) { |
411 | gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT); | 420 | gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT); |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 9ff6dcb97f9d..7693f7c67bd3 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -225,25 +225,18 @@ void radeon_invalid_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | |||
225 | 225 | ||
226 | void radeon_register_accessor_init(struct radeon_device *rdev) | 226 | void radeon_register_accessor_init(struct radeon_device *rdev) |
227 | { | 227 | { |
228 | rdev->mm_rreg = &r100_mm_rreg; | ||
229 | rdev->mm_wreg = &r100_mm_wreg; | ||
230 | rdev->mc_rreg = &radeon_invalid_rreg; | 228 | rdev->mc_rreg = &radeon_invalid_rreg; |
231 | rdev->mc_wreg = &radeon_invalid_wreg; | 229 | rdev->mc_wreg = &radeon_invalid_wreg; |
232 | rdev->pll_rreg = &radeon_invalid_rreg; | 230 | rdev->pll_rreg = &radeon_invalid_rreg; |
233 | rdev->pll_wreg = &radeon_invalid_wreg; | 231 | rdev->pll_wreg = &radeon_invalid_wreg; |
234 | rdev->pcie_rreg = &radeon_invalid_rreg; | ||
235 | rdev->pcie_wreg = &radeon_invalid_wreg; | ||
236 | rdev->pciep_rreg = &radeon_invalid_rreg; | 232 | rdev->pciep_rreg = &radeon_invalid_rreg; |
237 | rdev->pciep_wreg = &radeon_invalid_wreg; | 233 | rdev->pciep_wreg = &radeon_invalid_wreg; |
238 | 234 | ||
239 | /* Don't change order as we are overridding accessor. */ | 235 | /* Don't change order as we are overridding accessor. */ |
240 | if (rdev->family < CHIP_RV515) { | 236 | if (rdev->family < CHIP_RV515) { |
241 | rdev->pcie_rreg = &rv370_pcie_rreg; | 237 | rdev->pcie_reg_mask = 0xff; |
242 | rdev->pcie_wreg = &rv370_pcie_wreg; | 238 | } else { |
243 | } | 239 | rdev->pcie_reg_mask = 0x7ff; |
244 | if (rdev->family >= CHIP_RV515) { | ||
245 | rdev->pcie_rreg = &rv515_pcie_rreg; | ||
246 | rdev->pcie_wreg = &rv515_pcie_wreg; | ||
247 | } | 240 | } |
248 | /* FIXME: not sure here */ | 241 | /* FIXME: not sure here */ |
249 | if (rdev->family <= CHIP_R580) { | 242 | if (rdev->family <= CHIP_R580) { |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h index 3933f8216a34..6fa32dac4e97 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.h +++ b/drivers/gpu/drm/radeon/radeon_drv.h | |||
@@ -100,9 +100,10 @@ | |||
100 | * 1.28- Add support for VBL on CRTC2 | 100 | * 1.28- Add support for VBL on CRTC2 |
101 | * 1.29- R500 3D cmd buffer support | 101 | * 1.29- R500 3D cmd buffer support |
102 | * 1.30- Add support for occlusion queries | 102 | * 1.30- Add support for occlusion queries |
103 | * 1.31- Add support for num Z pipes from GET_PARAM | ||
103 | */ | 104 | */ |
104 | #define DRIVER_MAJOR 1 | 105 | #define DRIVER_MAJOR 1 |
105 | #define DRIVER_MINOR 30 | 106 | #define DRIVER_MINOR 31 |
106 | #define DRIVER_PATCHLEVEL 0 | 107 | #define DRIVER_PATCHLEVEL 0 |
107 | 108 | ||
108 | /* | 109 | /* |
@@ -329,6 +330,7 @@ typedef struct drm_radeon_private { | |||
329 | resource_size_t fb_aper_offset; | 330 | resource_size_t fb_aper_offset; |
330 | 331 | ||
331 | int num_gb_pipes; | 332 | int num_gb_pipes; |
333 | int num_z_pipes; | ||
332 | int track_flush; | 334 | int track_flush; |
333 | drm_local_map_t *mmio; | 335 | drm_local_map_t *mmio; |
334 | 336 | ||
@@ -689,6 +691,7 @@ extern void r600_page_table_cleanup(struct drm_device *dev, struct drm_ati_pciga | |||
689 | 691 | ||
690 | /* pipe config regs */ | 692 | /* pipe config regs */ |
691 | #define R400_GB_PIPE_SELECT 0x402c | 693 | #define R400_GB_PIPE_SELECT 0x402c |
694 | #define RV530_GB_PIPE_SELECT2 0x4124 | ||
692 | #define R500_DYN_SCLK_PWMEM_PIPE 0x000d /* PLL */ | 695 | #define R500_DYN_SCLK_PWMEM_PIPE 0x000d /* PLL */ |
693 | #define R300_GB_TILE_CONFIG 0x4018 | 696 | #define R300_GB_TILE_CONFIG 0x4018 |
694 | # define R300_ENABLE_TILING (1 << 0) | 697 | # define R300_ENABLE_TILING (1 << 0) |
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index 3206c0ad7b6c..ec383edf5f38 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
@@ -574,6 +574,8 @@ int radeonfb_create(struct radeon_device *rdev, | |||
574 | goto out_unref; | 574 | goto out_unref; |
575 | } | 575 | } |
576 | 576 | ||
577 | memset_io(fbptr, 0, aligned_size); | ||
578 | |||
577 | strcpy(info->fix.id, "radeondrmfb"); | 579 | strcpy(info->fix.id, "radeondrmfb"); |
578 | info->fix.type = FB_TYPE_PACKED_PIXELS; | 580 | info->fix.type = FB_TYPE_PACKED_PIXELS; |
579 | info->fix.visual = FB_VISUAL_TRUECOLOR; | 581 | info->fix.visual = FB_VISUAL_TRUECOLOR; |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index cded5180c752..d880edf254db 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -262,8 +262,34 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
262 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | 262 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, |
263 | struct drm_file *filp) | 263 | struct drm_file *filp) |
264 | { | 264 | { |
265 | /* FIXME: implement */ | 265 | struct drm_radeon_gem_busy *args = data; |
266 | return 0; | 266 | struct drm_gem_object *gobj; |
267 | struct radeon_object *robj; | ||
268 | int r; | ||
269 | uint32_t cur_placement; | ||
270 | |||
271 | gobj = drm_gem_object_lookup(dev, filp, args->handle); | ||
272 | if (gobj == NULL) { | ||
273 | return -EINVAL; | ||
274 | } | ||
275 | robj = gobj->driver_private; | ||
276 | r = radeon_object_busy_domain(robj, &cur_placement); | ||
277 | switch (cur_placement) { | ||
278 | case TTM_PL_VRAM: | ||
279 | args->domain = RADEON_GEM_DOMAIN_VRAM; | ||
280 | break; | ||
281 | case TTM_PL_TT: | ||
282 | args->domain = RADEON_GEM_DOMAIN_GTT; | ||
283 | break; | ||
284 | case TTM_PL_SYSTEM: | ||
285 | args->domain = RADEON_GEM_DOMAIN_CPU; | ||
286 | default: | ||
287 | break; | ||
288 | } | ||
289 | mutex_lock(&dev->struct_mutex); | ||
290 | drm_gem_object_unreference(gobj); | ||
291 | mutex_unlock(&dev->struct_mutex); | ||
292 | return r; | ||
267 | } | 293 | } |
268 | 294 | ||
269 | int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | 295 | int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 491d569deb0e..9805e4b6ca1b 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -32,60 +32,6 @@ | |||
32 | #include "radeon.h" | 32 | #include "radeon.h" |
33 | #include "atom.h" | 33 | #include "atom.h" |
34 | 34 | ||
35 | static inline uint32_t r100_irq_ack(struct radeon_device *rdev) | ||
36 | { | ||
37 | uint32_t irqs = RREG32(RADEON_GEN_INT_STATUS); | ||
38 | uint32_t irq_mask = RADEON_SW_INT_TEST; | ||
39 | |||
40 | if (irqs) { | ||
41 | WREG32(RADEON_GEN_INT_STATUS, irqs); | ||
42 | } | ||
43 | return irqs & irq_mask; | ||
44 | } | ||
45 | |||
46 | int r100_irq_set(struct radeon_device *rdev) | ||
47 | { | ||
48 | uint32_t tmp = 0; | ||
49 | |||
50 | if (rdev->irq.sw_int) { | ||
51 | tmp |= RADEON_SW_INT_ENABLE; | ||
52 | } | ||
53 | /* Todo go through CRTC and enable vblank int or not */ | ||
54 | WREG32(RADEON_GEN_INT_CNTL, tmp); | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | int r100_irq_process(struct radeon_device *rdev) | ||
59 | { | ||
60 | uint32_t status; | ||
61 | |||
62 | status = r100_irq_ack(rdev); | ||
63 | if (!status) { | ||
64 | return IRQ_NONE; | ||
65 | } | ||
66 | while (status) { | ||
67 | /* SW interrupt */ | ||
68 | if (status & RADEON_SW_INT_TEST) { | ||
69 | radeon_fence_process(rdev); | ||
70 | } | ||
71 | status = r100_irq_ack(rdev); | ||
72 | } | ||
73 | return IRQ_HANDLED; | ||
74 | } | ||
75 | |||
76 | int rs600_irq_set(struct radeon_device *rdev) | ||
77 | { | ||
78 | uint32_t tmp = 0; | ||
79 | |||
80 | if (rdev->irq.sw_int) { | ||
81 | tmp |= RADEON_SW_INT_ENABLE; | ||
82 | } | ||
83 | WREG32(RADEON_GEN_INT_CNTL, tmp); | ||
84 | /* Todo go through CRTC and enable vblank int or not */ | ||
85 | WREG32(R500_DxMODE_INT_MASK, 0); | ||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | irqreturn_t radeon_driver_irq_handler_kms(DRM_IRQ_ARGS) | 35 | irqreturn_t radeon_driver_irq_handler_kms(DRM_IRQ_ARGS) |
90 | { | 36 | { |
91 | struct drm_device *dev = (struct drm_device *) arg; | 37 | struct drm_device *dev = (struct drm_device *) arg; |
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 3357110e30ce..dce09ada32bc 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
@@ -95,6 +95,9 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
95 | case RADEON_INFO_NUM_GB_PIPES: | 95 | case RADEON_INFO_NUM_GB_PIPES: |
96 | value = rdev->num_gb_pipes; | 96 | value = rdev->num_gb_pipes; |
97 | break; | 97 | break; |
98 | case RADEON_INFO_NUM_Z_PIPES: | ||
99 | value = rdev->num_z_pipes; | ||
100 | break; | ||
98 | default: | 101 | default: |
99 | DRM_DEBUG("Invalid request %d\n", info->request); | 102 | DRM_DEBUG("Invalid request %d\n", info->request); |
100 | return -EINVAL; | 103 | return -EINVAL; |
@@ -141,19 +144,42 @@ void radeon_driver_preclose_kms(struct drm_device *dev, | |||
141 | */ | 144 | */ |
142 | u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc) | 145 | u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc) |
143 | { | 146 | { |
144 | /* FIXME: implement */ | 147 | struct radeon_device *rdev = dev->dev_private; |
145 | return 0; | 148 | |
149 | if (crtc < 0 || crtc > 1) { | ||
150 | DRM_ERROR("Invalid crtc %d\n", crtc); | ||
151 | return -EINVAL; | ||
152 | } | ||
153 | |||
154 | return radeon_get_vblank_counter(rdev, crtc); | ||
146 | } | 155 | } |
147 | 156 | ||
148 | int radeon_enable_vblank_kms(struct drm_device *dev, int crtc) | 157 | int radeon_enable_vblank_kms(struct drm_device *dev, int crtc) |
149 | { | 158 | { |
150 | /* FIXME: implement */ | 159 | struct radeon_device *rdev = dev->dev_private; |
151 | return 0; | 160 | |
161 | if (crtc < 0 || crtc > 1) { | ||
162 | DRM_ERROR("Invalid crtc %d\n", crtc); | ||
163 | return -EINVAL; | ||
164 | } | ||
165 | |||
166 | rdev->irq.crtc_vblank_int[crtc] = true; | ||
167 | |||
168 | return radeon_irq_set(rdev); | ||
152 | } | 169 | } |
153 | 170 | ||
154 | void radeon_disable_vblank_kms(struct drm_device *dev, int crtc) | 171 | void radeon_disable_vblank_kms(struct drm_device *dev, int crtc) |
155 | { | 172 | { |
156 | /* FIXME: implement */ | 173 | struct radeon_device *rdev = dev->dev_private; |
174 | |||
175 | if (crtc < 0 || crtc > 1) { | ||
176 | DRM_ERROR("Invalid crtc %d\n", crtc); | ||
177 | return; | ||
178 | } | ||
179 | |||
180 | rdev->irq.crtc_vblank_int[crtc] = false; | ||
181 | |||
182 | radeon_irq_set(rdev); | ||
157 | } | 183 | } |
158 | 184 | ||
159 | 185 | ||
@@ -295,5 +321,6 @@ struct drm_ioctl_desc radeon_ioctls_kms[] = { | |||
295 | DRM_IOCTL_DEF(DRM_RADEON_INFO, radeon_info_ioctl, DRM_AUTH), | 321 | DRM_IOCTL_DEF(DRM_RADEON_INFO, radeon_info_ioctl, DRM_AUTH), |
296 | DRM_IOCTL_DEF(DRM_RADEON_GEM_SET_TILING, radeon_gem_set_tiling_ioctl, DRM_AUTH), | 322 | DRM_IOCTL_DEF(DRM_RADEON_GEM_SET_TILING, radeon_gem_set_tiling_ioctl, DRM_AUTH), |
297 | DRM_IOCTL_DEF(DRM_RADEON_GEM_GET_TILING, radeon_gem_get_tiling_ioctl, DRM_AUTH), | 323 | DRM_IOCTL_DEF(DRM_RADEON_GEM_GET_TILING, radeon_gem_get_tiling_ioctl, DRM_AUTH), |
324 | DRM_IOCTL_DEF(DRM_RADEON_GEM_BUSY, radeon_gem_busy_ioctl, DRM_AUTH), | ||
298 | }; | 325 | }; |
299 | int radeon_max_kms_ioctl = DRM_ARRAY_SIZE(radeon_ioctls_kms); | 326 | int radeon_max_kms_ioctl = DRM_ARRAY_SIZE(radeon_ioctls_kms); |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index 7d06dc98a42a..0da72f18fd3a 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | |||
@@ -310,10 +310,13 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
310 | RADEON_CRTC_DISP_REQ_EN_B)); | 310 | RADEON_CRTC_DISP_REQ_EN_B)); |
311 | WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask); | 311 | WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask); |
312 | } | 312 | } |
313 | drm_vblank_post_modeset(dev, radeon_crtc->crtc_id); | ||
314 | radeon_crtc_load_lut(crtc); | ||
313 | break; | 315 | break; |
314 | case DRM_MODE_DPMS_STANDBY: | 316 | case DRM_MODE_DPMS_STANDBY: |
315 | case DRM_MODE_DPMS_SUSPEND: | 317 | case DRM_MODE_DPMS_SUSPEND: |
316 | case DRM_MODE_DPMS_OFF: | 318 | case DRM_MODE_DPMS_OFF: |
319 | drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id); | ||
317 | if (radeon_crtc->crtc_id) | 320 | if (radeon_crtc->crtc_id) |
318 | WREG32_P(RADEON_CRTC2_GEN_CNTL, mask, ~mask); | 321 | WREG32_P(RADEON_CRTC2_GEN_CNTL, mask, ~mask); |
319 | else { | 322 | else { |
@@ -323,10 +326,6 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
323 | } | 326 | } |
324 | break; | 327 | break; |
325 | } | 328 | } |
326 | |||
327 | if (mode != DRM_MODE_DPMS_OFF) { | ||
328 | radeon_crtc_load_lut(crtc); | ||
329 | } | ||
330 | } | 329 | } |
331 | 330 | ||
332 | /* properly set crtc bpp when using atombios */ | 331 | /* properly set crtc bpp when using atombios */ |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 34d0f58eb944..9322675ef6d0 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -1066,6 +1066,7 @@ radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t | |||
1066 | 1066 | ||
1067 | switch (radeon_encoder->encoder_id) { | 1067 | switch (radeon_encoder->encoder_id) { |
1068 | case ENCODER_OBJECT_ID_INTERNAL_LVDS: | 1068 | case ENCODER_OBJECT_ID_INTERNAL_LVDS: |
1069 | encoder->possible_crtcs = 0x1; | ||
1069 | drm_encoder_init(dev, encoder, &radeon_legacy_lvds_enc_funcs, DRM_MODE_ENCODER_LVDS); | 1070 | drm_encoder_init(dev, encoder, &radeon_legacy_lvds_enc_funcs, DRM_MODE_ENCODER_LVDS); |
1070 | drm_encoder_helper_add(encoder, &radeon_legacy_lvds_helper_funcs); | 1071 | drm_encoder_helper_add(encoder, &radeon_legacy_lvds_helper_funcs); |
1071 | if (rdev->is_atom_bios) | 1072 | if (rdev->is_atom_bios) |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index e98cae3bf4a6..b85fb83d7ae8 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -316,6 +316,25 @@ int radeon_object_wait(struct radeon_object *robj) | |||
316 | return r; | 316 | return r; |
317 | } | 317 | } |
318 | 318 | ||
319 | int radeon_object_busy_domain(struct radeon_object *robj, uint32_t *cur_placement) | ||
320 | { | ||
321 | int r = 0; | ||
322 | |||
323 | r = radeon_object_reserve(robj, true); | ||
324 | if (unlikely(r != 0)) { | ||
325 | DRM_ERROR("radeon: failed to reserve object for waiting.\n"); | ||
326 | return r; | ||
327 | } | ||
328 | spin_lock(&robj->tobj.lock); | ||
329 | *cur_placement = robj->tobj.mem.mem_type; | ||
330 | if (robj->tobj.sync_obj) { | ||
331 | r = ttm_bo_wait(&robj->tobj, true, true, true); | ||
332 | } | ||
333 | spin_unlock(&robj->tobj.lock); | ||
334 | radeon_object_unreserve(robj); | ||
335 | return r; | ||
336 | } | ||
337 | |||
319 | int radeon_object_evict_vram(struct radeon_device *rdev) | 338 | int radeon_object_evict_vram(struct radeon_device *rdev) |
320 | { | 339 | { |
321 | if (rdev->flags & RADEON_IS_IGP) { | 340 | if (rdev->flags & RADEON_IS_IGP) { |
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h index e1b618574461..4df43f62c678 100644 --- a/drivers/gpu/drm/radeon/radeon_reg.h +++ b/drivers/gpu/drm/radeon/radeon_reg.h | |||
@@ -982,12 +982,15 @@ | |||
982 | # define RS400_TMDS2_PLLRST (1 << 1) | 982 | # define RS400_TMDS2_PLLRST (1 << 1) |
983 | 983 | ||
984 | #define RADEON_GEN_INT_CNTL 0x0040 | 984 | #define RADEON_GEN_INT_CNTL 0x0040 |
985 | # define RADEON_CRTC_VBLANK_MASK (1 << 0) | ||
986 | # define RADEON_CRTC2_VBLANK_MASK (1 << 9) | ||
985 | # define RADEON_SW_INT_ENABLE (1 << 25) | 987 | # define RADEON_SW_INT_ENABLE (1 << 25) |
986 | #define RADEON_GEN_INT_STATUS 0x0044 | 988 | #define RADEON_GEN_INT_STATUS 0x0044 |
987 | # define RADEON_VSYNC_INT_AK (1 << 2) | 989 | # define AVIVO_DISPLAY_INT_STATUS (1 << 0) |
988 | # define RADEON_VSYNC_INT (1 << 2) | 990 | # define RADEON_CRTC_VBLANK_STAT (1 << 0) |
989 | # define RADEON_VSYNC2_INT_AK (1 << 6) | 991 | # define RADEON_CRTC_VBLANK_STAT_ACK (1 << 0) |
990 | # define RADEON_VSYNC2_INT (1 << 6) | 992 | # define RADEON_CRTC2_VBLANK_STAT (1 << 9) |
993 | # define RADEON_CRTC2_VBLANK_STAT_ACK (1 << 9) | ||
991 | # define RADEON_SW_INT_FIRE (1 << 26) | 994 | # define RADEON_SW_INT_FIRE (1 << 26) |
992 | # define RADEON_SW_INT_TEST (1 << 25) | 995 | # define RADEON_SW_INT_TEST (1 << 25) |
993 | # define RADEON_SW_INT_TEST_ACK (1 << 25) | 996 | # define RADEON_SW_INT_TEST_ACK (1 << 25) |
@@ -2334,6 +2337,9 @@ | |||
2334 | # define RADEON_RE_WIDTH_SHIFT 0 | 2337 | # define RADEON_RE_WIDTH_SHIFT 0 |
2335 | # define RADEON_RE_HEIGHT_SHIFT 16 | 2338 | # define RADEON_RE_HEIGHT_SHIFT 16 |
2336 | 2339 | ||
2340 | #define RADEON_RB3D_ZPASS_DATA 0x3290 | ||
2341 | #define RADEON_RB3D_ZPASS_ADDR 0x3294 | ||
2342 | |||
2337 | #define RADEON_SE_CNTL 0x1c4c | 2343 | #define RADEON_SE_CNTL 0x1c4c |
2338 | # define RADEON_FFACE_CULL_CW (0 << 0) | 2344 | # define RADEON_FFACE_CULL_CW (0 << 0) |
2339 | # define RADEON_FFACE_CULL_CCW (1 << 0) | 2345 | # define RADEON_FFACE_CULL_CCW (1 << 0) |
@@ -3568,4 +3574,6 @@ | |||
3568 | #define RADEON_SCRATCH_REG4 0x15f0 | 3574 | #define RADEON_SCRATCH_REG4 0x15f0 |
3569 | #define RADEON_SCRATCH_REG5 0x15f4 | 3575 | #define RADEON_SCRATCH_REG5 0x15f4 |
3570 | 3576 | ||
3577 | #define RV530_GB_PIPE_SELECT2 0x4124 | ||
3578 | |||
3571 | #endif | 3579 | #endif |
diff --git a/drivers/gpu/drm/radeon/radeon_state.c b/drivers/gpu/drm/radeon/radeon_state.c index 46645f3e0328..2882f40d5ec5 100644 --- a/drivers/gpu/drm/radeon/radeon_state.c +++ b/drivers/gpu/drm/radeon/radeon_state.c | |||
@@ -3081,6 +3081,9 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_fil | |||
3081 | case RADEON_PARAM_NUM_GB_PIPES: | 3081 | case RADEON_PARAM_NUM_GB_PIPES: |
3082 | value = dev_priv->num_gb_pipes; | 3082 | value = dev_priv->num_gb_pipes; |
3083 | break; | 3083 | break; |
3084 | case RADEON_PARAM_NUM_Z_PIPES: | ||
3085 | value = dev_priv->num_z_pipes; | ||
3086 | break; | ||
3084 | default: | 3087 | default: |
3085 | DRM_DEBUG("Invalid parameter %d\n", param->param); | 3088 | DRM_DEBUG("Invalid parameter %d\n", param->param); |
3086 | return -EINVAL; | 3089 | return -EINVAL; |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index bbea6dee4a94..7e8ce983a908 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -240,6 +240,88 @@ void rs600_mc_fini(struct radeon_device *rdev) | |||
240 | 240 | ||
241 | 241 | ||
242 | /* | 242 | /* |
243 | * Interrupts | ||
244 | */ | ||
245 | int rs600_irq_set(struct radeon_device *rdev) | ||
246 | { | ||
247 | uint32_t tmp = 0; | ||
248 | uint32_t mode_int = 0; | ||
249 | |||
250 | if (rdev->irq.sw_int) { | ||
251 | tmp |= RADEON_SW_INT_ENABLE; | ||
252 | } | ||
253 | if (rdev->irq.crtc_vblank_int[0]) { | ||
254 | tmp |= AVIVO_DISPLAY_INT_STATUS; | ||
255 | mode_int |= AVIVO_D1MODE_INT_MASK; | ||
256 | } | ||
257 | if (rdev->irq.crtc_vblank_int[1]) { | ||
258 | tmp |= AVIVO_DISPLAY_INT_STATUS; | ||
259 | mode_int |= AVIVO_D2MODE_INT_MASK; | ||
260 | } | ||
261 | WREG32(RADEON_GEN_INT_CNTL, tmp); | ||
262 | WREG32(AVIVO_DxMODE_INT_MASK, mode_int); | ||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | static inline uint32_t rs600_irq_ack(struct radeon_device *rdev, u32 *r500_disp_int) | ||
267 | { | ||
268 | uint32_t irqs = RREG32(RADEON_GEN_INT_STATUS); | ||
269 | uint32_t irq_mask = RADEON_SW_INT_TEST; | ||
270 | |||
271 | if (irqs & AVIVO_DISPLAY_INT_STATUS) { | ||
272 | *r500_disp_int = RREG32(AVIVO_DISP_INTERRUPT_STATUS); | ||
273 | if (*r500_disp_int & AVIVO_D1_VBLANK_INTERRUPT) { | ||
274 | WREG32(AVIVO_D1MODE_VBLANK_STATUS, AVIVO_VBLANK_ACK); | ||
275 | } | ||
276 | if (*r500_disp_int & AVIVO_D2_VBLANK_INTERRUPT) { | ||
277 | WREG32(AVIVO_D2MODE_VBLANK_STATUS, AVIVO_VBLANK_ACK); | ||
278 | } | ||
279 | } else { | ||
280 | *r500_disp_int = 0; | ||
281 | } | ||
282 | |||
283 | if (irqs) { | ||
284 | WREG32(RADEON_GEN_INT_STATUS, irqs); | ||
285 | } | ||
286 | return irqs & irq_mask; | ||
287 | } | ||
288 | |||
289 | int rs600_irq_process(struct radeon_device *rdev) | ||
290 | { | ||
291 | uint32_t status; | ||
292 | uint32_t r500_disp_int; | ||
293 | |||
294 | status = rs600_irq_ack(rdev, &r500_disp_int); | ||
295 | if (!status && !r500_disp_int) { | ||
296 | return IRQ_NONE; | ||
297 | } | ||
298 | while (status || r500_disp_int) { | ||
299 | /* SW interrupt */ | ||
300 | if (status & RADEON_SW_INT_TEST) { | ||
301 | radeon_fence_process(rdev); | ||
302 | } | ||
303 | /* Vertical blank interrupts */ | ||
304 | if (r500_disp_int & AVIVO_D1_VBLANK_INTERRUPT) { | ||
305 | drm_handle_vblank(rdev->ddev, 0); | ||
306 | } | ||
307 | if (r500_disp_int & AVIVO_D2_VBLANK_INTERRUPT) { | ||
308 | drm_handle_vblank(rdev->ddev, 1); | ||
309 | } | ||
310 | status = rs600_irq_ack(rdev, &r500_disp_int); | ||
311 | } | ||
312 | return IRQ_HANDLED; | ||
313 | } | ||
314 | |||
315 | u32 rs600_get_vblank_counter(struct radeon_device *rdev, int crtc) | ||
316 | { | ||
317 | if (crtc == 0) | ||
318 | return RREG32(AVIVO_D1CRTC_FRAME_COUNT); | ||
319 | else | ||
320 | return RREG32(AVIVO_D2CRTC_FRAME_COUNT); | ||
321 | } | ||
322 | |||
323 | |||
324 | /* | ||
243 | * Global GPU functions | 325 | * Global GPU functions |
244 | */ | 326 | */ |
245 | void rs600_disable_vga(struct radeon_device *rdev) | 327 | void rs600_disable_vga(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 839595b00728..bc6b7c5339bc 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -652,3 +652,68 @@ void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | |||
652 | WREG32(RS690_MC_DATA, v); | 652 | WREG32(RS690_MC_DATA, v); |
653 | WREG32(RS690_MC_INDEX, RS690_MC_INDEX_WR_ACK); | 653 | WREG32(RS690_MC_INDEX, RS690_MC_INDEX_WR_ACK); |
654 | } | 654 | } |
655 | |||
656 | static const unsigned rs690_reg_safe_bm[219] = { | ||
657 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
658 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
659 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
660 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
661 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
662 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
663 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
664 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
665 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
666 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
667 | 0x17FF1FFF,0xFFFFFFFC,0xFFFFFFFF,0xFF30FFBF, | ||
668 | 0xFFFFFFF8,0xC3E6FFFF,0xFFFFF6DF,0xFFFFFFFF, | ||
669 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
670 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
671 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFF03F, | ||
672 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
673 | 0xFFFFFFFF,0xFFFFEFCE,0xF00EBFFF,0x007C0000, | ||
674 | 0xF0000078,0xFF000009,0xFFFFFFFF,0xFFFFFFFF, | ||
675 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
676 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
677 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
678 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
679 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
680 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
681 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
682 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
683 | 0xFFFFF7FF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
684 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
685 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
686 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
687 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
688 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
689 | 0xFFFFFC78,0xFFFFFFFF,0xFFFFFFFE,0xFFFFFFFF, | ||
690 | 0x38FF8F50,0xFFF88082,0xF000000C,0xFAE009FF, | ||
691 | 0x0000FFFF,0xFFFFFFFF,0xFFFFFFFF,0x00000000, | ||
692 | 0x00000000,0x0000C100,0x00000000,0x00000000, | ||
693 | 0x00000000,0x00000000,0x00000000,0x00000000, | ||
694 | 0x00000000,0xFFFF0000,0xFFFFFFFF,0xFF80FFFF, | ||
695 | 0x00000000,0x00000000,0x00000000,0x00000000, | ||
696 | 0x0003FC01,0xFFFFFFF8,0xFE800B19,0xFFFFFFFF, | ||
697 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
698 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
699 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
700 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
701 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
702 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
703 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
704 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
705 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
706 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
707 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
708 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
709 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
710 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
711 | 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, | ||
712 | }; | ||
713 | |||
714 | int rs690_init(struct radeon_device *rdev) | ||
715 | { | ||
716 | rdev->config.r300.reg_safe_bm = rs690_reg_safe_bm; | ||
717 | rdev->config.r300.reg_safe_bm_size = ARRAY_SIZE(rs690_reg_safe_bm); | ||
718 | return 0; | ||
719 | } | ||
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index fd8f3ca716ea..31a7f668ae5a 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
@@ -400,25 +400,6 @@ void rv515_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | |||
400 | WREG32(MC_IND_INDEX, 0); | 400 | WREG32(MC_IND_INDEX, 0); |
401 | } | 401 | } |
402 | 402 | ||
403 | uint32_t rv515_pcie_rreg(struct radeon_device *rdev, uint32_t reg) | ||
404 | { | ||
405 | uint32_t r; | ||
406 | |||
407 | WREG32(PCIE_INDEX, ((reg) & 0x7ff)); | ||
408 | (void)RREG32(PCIE_INDEX); | ||
409 | r = RREG32(PCIE_DATA); | ||
410 | return r; | ||
411 | } | ||
412 | |||
413 | void rv515_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v) | ||
414 | { | ||
415 | WREG32(PCIE_INDEX, ((reg) & 0x7ff)); | ||
416 | (void)RREG32(PCIE_INDEX); | ||
417 | WREG32(PCIE_DATA, (v)); | ||
418 | (void)RREG32(PCIE_DATA); | ||
419 | } | ||
420 | |||
421 | |||
422 | /* | 403 | /* |
423 | * Debugfs info | 404 | * Debugfs info |
424 | */ | 405 | */ |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index d258b02aef44..827da0858136 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -674,7 +674,14 @@ omap_i2c_isr(int this_irq, void *dev_id) | |||
674 | 674 | ||
675 | err = 0; | 675 | err = 0; |
676 | complete: | 676 | complete: |
677 | omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat); | 677 | /* |
678 | * Ack the stat in one go, but [R/X]DR and [R/X]RDY should be | ||
679 | * acked after the data operation is complete. | ||
680 | * Ref: TRM SWPU114Q Figure 18-31 | ||
681 | */ | ||
682 | omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat & | ||
683 | ~(OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR | | ||
684 | OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)); | ||
678 | 685 | ||
679 | if (stat & OMAP_I2C_STAT_NACK) { | 686 | if (stat & OMAP_I2C_STAT_NACK) { |
680 | err |= OMAP_I2C_STAT_NACK; | 687 | err |= OMAP_I2C_STAT_NACK; |
@@ -687,6 +694,9 @@ complete: | |||
687 | } | 694 | } |
688 | if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK | | 695 | if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK | |
689 | OMAP_I2C_STAT_AL)) { | 696 | OMAP_I2C_STAT_AL)) { |
697 | omap_i2c_ack_stat(dev, stat & | ||
698 | (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR | | ||
699 | OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)); | ||
690 | omap_i2c_complete_cmd(dev, err); | 700 | omap_i2c_complete_cmd(dev, err); |
691 | return IRQ_HANDLED; | 701 | return IRQ_HANDLED; |
692 | } | 702 | } |
@@ -774,7 +784,7 @@ complete: | |||
774 | * memory to the I2C interface. | 784 | * memory to the I2C interface. |
775 | */ | 785 | */ |
776 | 786 | ||
777 | if (cpu_is_omap34xx()) { | 787 | if (dev->rev <= OMAP_I2C_REV_ON_3430) { |
778 | while (!(stat & OMAP_I2C_STAT_XUDF)) { | 788 | while (!(stat & OMAP_I2C_STAT_XUDF)) { |
779 | if (stat & (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) { | 789 | if (stat & (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) { |
780 | omap_i2c_ack_stat(dev, stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)); | 790 | omap_i2c_ack_stat(dev, stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)); |
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c index 182e711318ba..d2728a28a8db 100644 --- a/drivers/i2c/busses/i2c-stu300.c +++ b/drivers/i2c/busses/i2c-stu300.c | |||
@@ -117,7 +117,8 @@ enum stu300_error { | |||
117 | STU300_ERROR_NONE = 0, | 117 | STU300_ERROR_NONE = 0, |
118 | STU300_ERROR_ACKNOWLEDGE_FAILURE, | 118 | STU300_ERROR_ACKNOWLEDGE_FAILURE, |
119 | STU300_ERROR_BUS_ERROR, | 119 | STU300_ERROR_BUS_ERROR, |
120 | STU300_ERROR_ARBITRATION_LOST | 120 | STU300_ERROR_ARBITRATION_LOST, |
121 | STU300_ERROR_UNKNOWN | ||
121 | }; | 122 | }; |
122 | 123 | ||
123 | /* timeout waiting for the controller to respond */ | 124 | /* timeout waiting for the controller to respond */ |
@@ -127,7 +128,7 @@ enum stu300_error { | |||
127 | * The number of address send athemps tried before giving up. | 128 | * The number of address send athemps tried before giving up. |
128 | * If the first one failes it seems like 5 to 8 attempts are required. | 129 | * If the first one failes it seems like 5 to 8 attempts are required. |
129 | */ | 130 | */ |
130 | #define NUM_ADDR_RESEND_ATTEMPTS 10 | 131 | #define NUM_ADDR_RESEND_ATTEMPTS 12 |
131 | 132 | ||
132 | /* I2C clock speed, in Hz 0-400kHz*/ | 133 | /* I2C clock speed, in Hz 0-400kHz*/ |
133 | static unsigned int scl_frequency = 100000; | 134 | static unsigned int scl_frequency = 100000; |
@@ -149,6 +150,7 @@ module_param(scl_frequency, uint, 0644); | |||
149 | * @msg_index: index of current message | 150 | * @msg_index: index of current message |
150 | * @msg_len: length of current message | 151 | * @msg_len: length of current message |
151 | */ | 152 | */ |
153 | |||
152 | struct stu300_dev { | 154 | struct stu300_dev { |
153 | struct platform_device *pdev; | 155 | struct platform_device *pdev; |
154 | struct i2c_adapter adapter; | 156 | struct i2c_adapter adapter; |
@@ -188,6 +190,27 @@ static inline u32 stu300_r8(void __iomem *address) | |||
188 | return readl(address) & 0x000000FFU; | 190 | return readl(address) & 0x000000FFU; |
189 | } | 191 | } |
190 | 192 | ||
193 | static void stu300_irq_enable(struct stu300_dev *dev) | ||
194 | { | ||
195 | u32 val; | ||
196 | val = stu300_r8(dev->virtbase + I2C_CR); | ||
197 | val |= I2C_CR_INTERRUPT_ENABLE; | ||
198 | /* Twice paranoia (possible HW glitch) */ | ||
199 | stu300_wr8(val, dev->virtbase + I2C_CR); | ||
200 | stu300_wr8(val, dev->virtbase + I2C_CR); | ||
201 | } | ||
202 | |||
203 | static void stu300_irq_disable(struct stu300_dev *dev) | ||
204 | { | ||
205 | u32 val; | ||
206 | val = stu300_r8(dev->virtbase + I2C_CR); | ||
207 | val &= ~I2C_CR_INTERRUPT_ENABLE; | ||
208 | /* Twice paranoia (possible HW glitch) */ | ||
209 | stu300_wr8(val, dev->virtbase + I2C_CR); | ||
210 | stu300_wr8(val, dev->virtbase + I2C_CR); | ||
211 | } | ||
212 | |||
213 | |||
191 | /* | 214 | /* |
192 | * Tells whether a certain event or events occurred in | 215 | * Tells whether a certain event or events occurred in |
193 | * response to a command. The events represent states in | 216 | * response to a command. The events represent states in |
@@ -196,9 +219,10 @@ static inline u32 stu300_r8(void __iomem *address) | |||
196 | * documentation and can only be treated as abstract state | 219 | * documentation and can only be treated as abstract state |
197 | * machine states. | 220 | * machine states. |
198 | * | 221 | * |
199 | * @ret 0 = event has not occurred, any other value means | 222 | * @ret 0 = event has not occurred or unknown error, any |
200 | * the event occurred. | 223 | * other value means the correct event occurred or an error. |
201 | */ | 224 | */ |
225 | |||
202 | static int stu300_event_occurred(struct stu300_dev *dev, | 226 | static int stu300_event_occurred(struct stu300_dev *dev, |
203 | enum stu300_event mr_event) { | 227 | enum stu300_event mr_event) { |
204 | u32 status1; | 228 | u32 status1; |
@@ -206,11 +230,28 @@ static int stu300_event_occurred(struct stu300_dev *dev, | |||
206 | 230 | ||
207 | /* What event happened? */ | 231 | /* What event happened? */ |
208 | status1 = stu300_r8(dev->virtbase + I2C_SR1); | 232 | status1 = stu300_r8(dev->virtbase + I2C_SR1); |
233 | |||
209 | if (!(status1 & I2C_SR1_EVF_IND)) | 234 | if (!(status1 & I2C_SR1_EVF_IND)) |
210 | /* No event at all */ | 235 | /* No event at all */ |
211 | return 0; | 236 | return 0; |
237 | |||
212 | status2 = stu300_r8(dev->virtbase + I2C_SR2); | 238 | status2 = stu300_r8(dev->virtbase + I2C_SR2); |
213 | 239 | ||
240 | /* Block any multiple interrupts */ | ||
241 | stu300_irq_disable(dev); | ||
242 | |||
243 | /* Check for errors first */ | ||
244 | if (status2 & I2C_SR2_AF_IND) { | ||
245 | dev->cmd_err = STU300_ERROR_ACKNOWLEDGE_FAILURE; | ||
246 | return 1; | ||
247 | } else if (status2 & I2C_SR2_BERR_IND) { | ||
248 | dev->cmd_err = STU300_ERROR_BUS_ERROR; | ||
249 | return 1; | ||
250 | } else if (status2 & I2C_SR2_ARLO_IND) { | ||
251 | dev->cmd_err = STU300_ERROR_ARBITRATION_LOST; | ||
252 | return 1; | ||
253 | } | ||
254 | |||
214 | switch (mr_event) { | 255 | switch (mr_event) { |
215 | case STU300_EVENT_1: | 256 | case STU300_EVENT_1: |
216 | if (status1 & I2C_SR1_ADSL_IND) | 257 | if (status1 & I2C_SR1_ADSL_IND) |
@@ -221,10 +262,6 @@ static int stu300_event_occurred(struct stu300_dev *dev, | |||
221 | case STU300_EVENT_7: | 262 | case STU300_EVENT_7: |
222 | case STU300_EVENT_8: | 263 | case STU300_EVENT_8: |
223 | if (status1 & I2C_SR1_BTF_IND) { | 264 | if (status1 & I2C_SR1_BTF_IND) { |
224 | if (status2 & I2C_SR2_AF_IND) | ||
225 | dev->cmd_err = STU300_ERROR_ACKNOWLEDGE_FAILURE; | ||
226 | else if (status2 & I2C_SR2_BERR_IND) | ||
227 | dev->cmd_err = STU300_ERROR_BUS_ERROR; | ||
228 | return 1; | 265 | return 1; |
229 | } | 266 | } |
230 | break; | 267 | break; |
@@ -240,8 +277,6 @@ static int stu300_event_occurred(struct stu300_dev *dev, | |||
240 | case STU300_EVENT_6: | 277 | case STU300_EVENT_6: |
241 | if (status2 & I2C_SR2_ENDAD_IND) { | 278 | if (status2 & I2C_SR2_ENDAD_IND) { |
242 | /* First check for any errors */ | 279 | /* First check for any errors */ |
243 | if (status2 & I2C_SR2_AF_IND) | ||
244 | dev->cmd_err = STU300_ERROR_ACKNOWLEDGE_FAILURE; | ||
245 | return 1; | 280 | return 1; |
246 | } | 281 | } |
247 | break; | 282 | break; |
@@ -252,8 +287,15 @@ static int stu300_event_occurred(struct stu300_dev *dev, | |||
252 | default: | 287 | default: |
253 | break; | 288 | break; |
254 | } | 289 | } |
255 | if (status2 & I2C_SR2_ARLO_IND) | 290 | /* If we get here, we're on thin ice. |
256 | dev->cmd_err = STU300_ERROR_ARBITRATION_LOST; | 291 | * Here we are in a status where we have |
292 | * gotten a response that does not match | ||
293 | * what we requested. | ||
294 | */ | ||
295 | dev->cmd_err = STU300_ERROR_UNKNOWN; | ||
296 | dev_err(&dev->pdev->dev, | ||
297 | "Unhandled interrupt! %d sr1: 0x%x sr2: 0x%x\n", | ||
298 | mr_event, status1, status2); | ||
257 | return 0; | 299 | return 0; |
258 | } | 300 | } |
259 | 301 | ||
@@ -262,21 +304,20 @@ static irqreturn_t stu300_irh(int irq, void *data) | |||
262 | struct stu300_dev *dev = data; | 304 | struct stu300_dev *dev = data; |
263 | int res; | 305 | int res; |
264 | 306 | ||
307 | /* Just make sure that the block is clocked */ | ||
308 | clk_enable(dev->clk); | ||
309 | |||
265 | /* See if this was what we were waiting for */ | 310 | /* See if this was what we were waiting for */ |
266 | spin_lock(&dev->cmd_issue_lock); | 311 | spin_lock(&dev->cmd_issue_lock); |
267 | if (dev->cmd_event != STU300_EVENT_NONE) { | 312 | |
268 | res = stu300_event_occurred(dev, dev->cmd_event); | 313 | res = stu300_event_occurred(dev, dev->cmd_event); |
269 | if (res || dev->cmd_err != STU300_ERROR_NONE) { | 314 | if (res || dev->cmd_err != STU300_ERROR_NONE) |
270 | u32 val; | 315 | complete(&dev->cmd_complete); |
271 | 316 | ||
272 | complete(&dev->cmd_complete); | ||
273 | /* Block any multiple interrupts */ | ||
274 | val = stu300_r8(dev->virtbase + I2C_CR); | ||
275 | val &= ~I2C_CR_INTERRUPT_ENABLE; | ||
276 | stu300_wr8(val, dev->virtbase + I2C_CR); | ||
277 | } | ||
278 | } | ||
279 | spin_unlock(&dev->cmd_issue_lock); | 317 | spin_unlock(&dev->cmd_issue_lock); |
318 | |||
319 | clk_disable(dev->clk); | ||
320 | |||
280 | return IRQ_HANDLED; | 321 | return IRQ_HANDLED; |
281 | } | 322 | } |
282 | 323 | ||
@@ -308,7 +349,6 @@ static int stu300_start_and_await_event(struct stu300_dev *dev, | |||
308 | stu300_wr8(cr_value, dev->virtbase + I2C_CR); | 349 | stu300_wr8(cr_value, dev->virtbase + I2C_CR); |
309 | ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete, | 350 | ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete, |
310 | STU300_TIMEOUT); | 351 | STU300_TIMEOUT); |
311 | |||
312 | if (ret < 0) { | 352 | if (ret < 0) { |
313 | dev_err(&dev->pdev->dev, | 353 | dev_err(&dev->pdev->dev, |
314 | "wait_for_completion_interruptible_timeout() " | 354 | "wait_for_completion_interruptible_timeout() " |
@@ -342,7 +382,6 @@ static int stu300_await_event(struct stu300_dev *dev, | |||
342 | enum stu300_event mr_event) | 382 | enum stu300_event mr_event) |
343 | { | 383 | { |
344 | int ret; | 384 | int ret; |
345 | u32 val; | ||
346 | 385 | ||
347 | if (unlikely(irqs_disabled())) { | 386 | if (unlikely(irqs_disabled())) { |
348 | /* TODO: implement polling for this case if need be. */ | 387 | /* TODO: implement polling for this case if need be. */ |
@@ -354,36 +393,18 @@ static int stu300_await_event(struct stu300_dev *dev, | |||
354 | /* Is it already here? */ | 393 | /* Is it already here? */ |
355 | spin_lock_irq(&dev->cmd_issue_lock); | 394 | spin_lock_irq(&dev->cmd_issue_lock); |
356 | dev->cmd_err = STU300_ERROR_NONE; | 395 | dev->cmd_err = STU300_ERROR_NONE; |
357 | if (stu300_event_occurred(dev, mr_event)) { | ||
358 | spin_unlock_irq(&dev->cmd_issue_lock); | ||
359 | goto exit_await_check_err; | ||
360 | } | ||
361 | init_completion(&dev->cmd_complete); | ||
362 | dev->cmd_err = STU300_ERROR_NONE; | ||
363 | dev->cmd_event = mr_event; | 396 | dev->cmd_event = mr_event; |
364 | 397 | ||
365 | /* Turn on the I2C interrupt for current operation */ | 398 | init_completion(&dev->cmd_complete); |
366 | val = stu300_r8(dev->virtbase + I2C_CR); | ||
367 | val |= I2C_CR_INTERRUPT_ENABLE; | ||
368 | stu300_wr8(val, dev->virtbase + I2C_CR); | ||
369 | |||
370 | /* Twice paranoia (possible HW glitch) */ | ||
371 | stu300_wr8(val, dev->virtbase + I2C_CR); | ||
372 | 399 | ||
373 | /* Check again: is it already here? */ | 400 | /* Turn on the I2C interrupt for current operation */ |
374 | if (unlikely(stu300_event_occurred(dev, mr_event))) { | 401 | stu300_irq_enable(dev); |
375 | /* Disable IRQ again. */ | ||
376 | val &= ~I2C_CR_INTERRUPT_ENABLE; | ||
377 | stu300_wr8(val, dev->virtbase + I2C_CR); | ||
378 | spin_unlock_irq(&dev->cmd_issue_lock); | ||
379 | goto exit_await_check_err; | ||
380 | } | ||
381 | 402 | ||
382 | /* Unlock the command block and wait for the event to occur */ | 403 | /* Unlock the command block and wait for the event to occur */ |
383 | spin_unlock_irq(&dev->cmd_issue_lock); | 404 | spin_unlock_irq(&dev->cmd_issue_lock); |
405 | |||
384 | ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete, | 406 | ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete, |
385 | STU300_TIMEOUT); | 407 | STU300_TIMEOUT); |
386 | |||
387 | if (ret < 0) { | 408 | if (ret < 0) { |
388 | dev_err(&dev->pdev->dev, | 409 | dev_err(&dev->pdev->dev, |
389 | "wait_for_completion_interruptible_timeout()" | 410 | "wait_for_completion_interruptible_timeout()" |
@@ -401,7 +422,6 @@ static int stu300_await_event(struct stu300_dev *dev, | |||
401 | return -ETIMEDOUT; | 422 | return -ETIMEDOUT; |
402 | } | 423 | } |
403 | 424 | ||
404 | exit_await_check_err: | ||
405 | if (dev->cmd_err != STU300_ERROR_NONE) { | 425 | if (dev->cmd_err != STU300_ERROR_NONE) { |
406 | if (mr_event != STU300_EVENT_6) { | 426 | if (mr_event != STU300_EVENT_6) { |
407 | dev_err(&dev->pdev->dev, "controller " | 427 | dev_err(&dev->pdev->dev, "controller " |
@@ -457,18 +477,19 @@ struct stu300_clkset { | |||
457 | }; | 477 | }; |
458 | 478 | ||
459 | static const struct stu300_clkset stu300_clktable[] = { | 479 | static const struct stu300_clkset stu300_clktable[] = { |
460 | { 0, 0xFFU }, | 480 | { 0, 0xFFU }, |
461 | { 2500000, I2C_OAR2_FR_25_10MHZ }, | 481 | { 2500000, I2C_OAR2_FR_25_10MHZ }, |
462 | { 10000000, I2C_OAR2_FR_10_1667MHZ }, | 482 | { 10000000, I2C_OAR2_FR_10_1667MHZ }, |
463 | { 16670000, I2C_OAR2_FR_1667_2667MHZ }, | 483 | { 16670000, I2C_OAR2_FR_1667_2667MHZ }, |
464 | { 26670000, I2C_OAR2_FR_2667_40MHZ }, | 484 | { 26670000, I2C_OAR2_FR_2667_40MHZ }, |
465 | { 40000000, I2C_OAR2_FR_40_5333MHZ }, | 485 | { 40000000, I2C_OAR2_FR_40_5333MHZ }, |
466 | { 53330000, I2C_OAR2_FR_5333_66MHZ }, | 486 | { 53330000, I2C_OAR2_FR_5333_66MHZ }, |
467 | { 66000000, I2C_OAR2_FR_66_80MHZ }, | 487 | { 66000000, I2C_OAR2_FR_66_80MHZ }, |
468 | { 80000000, I2C_OAR2_FR_80_100MHZ }, | 488 | { 80000000, I2C_OAR2_FR_80_100MHZ }, |
469 | { 100000000, 0xFFU }, | 489 | { 100000000, 0xFFU }, |
470 | }; | 490 | }; |
471 | 491 | ||
492 | |||
472 | static int stu300_set_clk(struct stu300_dev *dev, unsigned long clkrate) | 493 | static int stu300_set_clk(struct stu300_dev *dev, unsigned long clkrate) |
473 | { | 494 | { |
474 | 495 | ||
@@ -494,10 +515,10 @@ static int stu300_set_clk(struct stu300_dev *dev, unsigned long clkrate) | |||
494 | 515 | ||
495 | if (dev->speed > 100000) | 516 | if (dev->speed > 100000) |
496 | /* Fast Mode I2C */ | 517 | /* Fast Mode I2C */ |
497 | val = ((clkrate/dev->speed)-9)/3; | 518 | val = ((clkrate/dev->speed) - 9)/3 + 1; |
498 | else | 519 | else |
499 | /* Standard Mode I2C */ | 520 | /* Standard Mode I2C */ |
500 | val = ((clkrate/dev->speed)-7)/2; | 521 | val = ((clkrate/dev->speed) - 7)/2 + 1; |
501 | 522 | ||
502 | /* According to spec the divider must be > 2 */ | 523 | /* According to spec the divider must be > 2 */ |
503 | if (val < 0x002) { | 524 | if (val < 0x002) { |
@@ -557,6 +578,7 @@ static int stu300_init_hw(struct stu300_dev *dev) | |||
557 | */ | 578 | */ |
558 | clkrate = clk_get_rate(dev->clk); | 579 | clkrate = clk_get_rate(dev->clk); |
559 | ret = stu300_set_clk(dev, clkrate); | 580 | ret = stu300_set_clk(dev, clkrate); |
581 | |||
560 | if (ret) | 582 | if (ret) |
561 | return ret; | 583 | return ret; |
562 | /* | 584 | /* |
@@ -641,7 +663,6 @@ static int stu300_xfer_msg(struct i2c_adapter *adap, | |||
641 | int attempts = 0; | 663 | int attempts = 0; |
642 | struct stu300_dev *dev = i2c_get_adapdata(adap); | 664 | struct stu300_dev *dev = i2c_get_adapdata(adap); |
643 | 665 | ||
644 | |||
645 | clk_enable(dev->clk); | 666 | clk_enable(dev->clk); |
646 | 667 | ||
647 | /* Remove this if (0) to trace each and every message. */ | 668 | /* Remove this if (0) to trace each and every message. */ |
@@ -715,14 +736,15 @@ static int stu300_xfer_msg(struct i2c_adapter *adap, | |||
715 | 736 | ||
716 | if (attempts < NUM_ADDR_RESEND_ATTEMPTS && attempts > 0) { | 737 | if (attempts < NUM_ADDR_RESEND_ATTEMPTS && attempts > 0) { |
717 | dev_dbg(&dev->pdev->dev, "managed to get address " | 738 | dev_dbg(&dev->pdev->dev, "managed to get address " |
718 | "through after %d attempts\n", attempts); | 739 | "through after %d attempts\n", attempts); |
719 | } else if (attempts == NUM_ADDR_RESEND_ATTEMPTS) { | 740 | } else if (attempts == NUM_ADDR_RESEND_ATTEMPTS) { |
720 | dev_dbg(&dev->pdev->dev, "I give up, tried %d times " | 741 | dev_dbg(&dev->pdev->dev, "I give up, tried %d times " |
721 | "to resend address.\n", | 742 | "to resend address.\n", |
722 | NUM_ADDR_RESEND_ATTEMPTS); | 743 | NUM_ADDR_RESEND_ATTEMPTS); |
723 | goto exit_disable; | 744 | goto exit_disable; |
724 | } | 745 | } |
725 | 746 | ||
747 | |||
726 | if (msg->flags & I2C_M_RD) { | 748 | if (msg->flags & I2C_M_RD) { |
727 | /* READ: we read the actual bytes one at a time */ | 749 | /* READ: we read the actual bytes one at a time */ |
728 | for (i = 0; i < msg->len; i++) { | 750 | for (i = 0; i < msg->len; i++) { |
@@ -804,8 +826,10 @@ static int stu300_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, | |||
804 | { | 826 | { |
805 | int ret = -1; | 827 | int ret = -1; |
806 | int i; | 828 | int i; |
829 | |||
807 | struct stu300_dev *dev = i2c_get_adapdata(adap); | 830 | struct stu300_dev *dev = i2c_get_adapdata(adap); |
808 | dev->msg_len = num; | 831 | dev->msg_len = num; |
832 | |||
809 | for (i = 0; i < num; i++) { | 833 | for (i = 0; i < num; i++) { |
810 | /* | 834 | /* |
811 | * Another driver appears to send stop for each message, | 835 | * Another driver appears to send stop for each message, |
@@ -817,6 +841,7 @@ static int stu300_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, | |||
817 | dev->msg_index = i; | 841 | dev->msg_index = i; |
818 | 842 | ||
819 | ret = stu300_xfer_msg(adap, &msgs[i], (i == (num - 1))); | 843 | ret = stu300_xfer_msg(adap, &msgs[i], (i == (num - 1))); |
844 | |||
820 | if (ret != 0) { | 845 | if (ret != 0) { |
821 | num = ret; | 846 | num = ret; |
822 | break; | 847 | break; |
@@ -845,6 +870,7 @@ stu300_probe(struct platform_device *pdev) | |||
845 | struct resource *res; | 870 | struct resource *res; |
846 | int bus_nr; | 871 | int bus_nr; |
847 | int ret = 0; | 872 | int ret = 0; |
873 | char clk_name[] = "I2C0"; | ||
848 | 874 | ||
849 | dev = kzalloc(sizeof(struct stu300_dev), GFP_KERNEL); | 875 | dev = kzalloc(sizeof(struct stu300_dev), GFP_KERNEL); |
850 | if (!dev) { | 876 | if (!dev) { |
@@ -854,7 +880,8 @@ stu300_probe(struct platform_device *pdev) | |||
854 | } | 880 | } |
855 | 881 | ||
856 | bus_nr = pdev->id; | 882 | bus_nr = pdev->id; |
857 | dev->clk = clk_get(&pdev->dev, NULL); | 883 | clk_name[3] += (char)bus_nr; |
884 | dev->clk = clk_get(&pdev->dev, clk_name); | ||
858 | if (IS_ERR(dev->clk)) { | 885 | if (IS_ERR(dev->clk)) { |
859 | ret = PTR_ERR(dev->clk); | 886 | ret = PTR_ERR(dev->clk); |
860 | dev_err(&pdev->dev, "could not retrieve i2c bus clock\n"); | 887 | dev_err(&pdev->dev, "could not retrieve i2c bus clock\n"); |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 4cfd084fa897..9a1d55b74d7a 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -456,8 +456,11 @@ static int joydev_ioctl_common(struct joydev *joydev, | |||
456 | unsigned int cmd, void __user *argp) | 456 | unsigned int cmd, void __user *argp) |
457 | { | 457 | { |
458 | struct input_dev *dev = joydev->handle.dev; | 458 | struct input_dev *dev = joydev->handle.dev; |
459 | size_t len; | ||
459 | int i, j; | 460 | int i, j; |
461 | const char *name; | ||
460 | 462 | ||
463 | /* Process fixed-sized commands. */ | ||
461 | switch (cmd) { | 464 | switch (cmd) { |
462 | 465 | ||
463 | case JS_SET_CAL: | 466 | case JS_SET_CAL: |
@@ -499,9 +502,22 @@ static int joydev_ioctl_common(struct joydev *joydev, | |||
499 | return copy_to_user(argp, joydev->corr, | 502 | return copy_to_user(argp, joydev->corr, |
500 | sizeof(joydev->corr[0]) * joydev->nabs) ? -EFAULT : 0; | 503 | sizeof(joydev->corr[0]) * joydev->nabs) ? -EFAULT : 0; |
501 | 504 | ||
502 | case JSIOCSAXMAP: | 505 | } |
503 | if (copy_from_user(joydev->abspam, argp, | 506 | |
504 | sizeof(__u8) * (ABS_MAX + 1))) | 507 | /* |
508 | * Process variable-sized commands (the axis and button map commands | ||
509 | * are considered variable-sized to decouple them from the values of | ||
510 | * ABS_MAX and KEY_MAX). | ||
511 | */ | ||
512 | switch (cmd & ~IOCSIZE_MASK) { | ||
513 | |||
514 | case (JSIOCSAXMAP & ~IOCSIZE_MASK): | ||
515 | len = min_t(size_t, _IOC_SIZE(cmd), sizeof(joydev->abspam)); | ||
516 | /* | ||
517 | * FIXME: we should not copy into our axis map before | ||
518 | * validating the data. | ||
519 | */ | ||
520 | if (copy_from_user(joydev->abspam, argp, len)) | ||
505 | return -EFAULT; | 521 | return -EFAULT; |
506 | 522 | ||
507 | for (i = 0; i < joydev->nabs; i++) { | 523 | for (i = 0; i < joydev->nabs; i++) { |
@@ -511,13 +527,17 @@ static int joydev_ioctl_common(struct joydev *joydev, | |||
511 | } | 527 | } |
512 | return 0; | 528 | return 0; |
513 | 529 | ||
514 | case JSIOCGAXMAP: | 530 | case (JSIOCGAXMAP & ~IOCSIZE_MASK): |
515 | return copy_to_user(argp, joydev->abspam, | 531 | len = min_t(size_t, _IOC_SIZE(cmd), sizeof(joydev->abspam)); |
516 | sizeof(__u8) * (ABS_MAX + 1)) ? -EFAULT : 0; | 532 | return copy_to_user(argp, joydev->abspam, len) ? -EFAULT : 0; |
517 | 533 | ||
518 | case JSIOCSBTNMAP: | 534 | case (JSIOCSBTNMAP & ~IOCSIZE_MASK): |
519 | if (copy_from_user(joydev->keypam, argp, | 535 | len = min_t(size_t, _IOC_SIZE(cmd), sizeof(joydev->keypam)); |
520 | sizeof(__u16) * (KEY_MAX - BTN_MISC + 1))) | 536 | /* |
537 | * FIXME: we should not copy into our keymap before | ||
538 | * validating the data. | ||
539 | */ | ||
540 | if (copy_from_user(joydev->keypam, argp, len)) | ||
521 | return -EFAULT; | 541 | return -EFAULT; |
522 | 542 | ||
523 | for (i = 0; i < joydev->nkey; i++) { | 543 | for (i = 0; i < joydev->nkey; i++) { |
@@ -529,25 +549,19 @@ static int joydev_ioctl_common(struct joydev *joydev, | |||
529 | 549 | ||
530 | return 0; | 550 | return 0; |
531 | 551 | ||
532 | case JSIOCGBTNMAP: | 552 | case (JSIOCGBTNMAP & ~IOCSIZE_MASK): |
533 | return copy_to_user(argp, joydev->keypam, | 553 | len = min_t(size_t, _IOC_SIZE(cmd), sizeof(joydev->keypam)); |
534 | sizeof(__u16) * (KEY_MAX - BTN_MISC + 1)) ? -EFAULT : 0; | 554 | return copy_to_user(argp, joydev->keypam, len) ? -EFAULT : 0; |
535 | 555 | ||
536 | default: | 556 | case JSIOCGNAME(0): |
537 | if ((cmd & ~IOCSIZE_MASK) == JSIOCGNAME(0)) { | 557 | name = dev->name; |
538 | int len; | 558 | if (!name) |
539 | const char *name = dev->name; | 559 | return 0; |
540 | 560 | ||
541 | if (!name) | 561 | len = min_t(size_t, _IOC_SIZE(cmd), strlen(name) + 1); |
542 | return 0; | 562 | return copy_to_user(argp, name, len) ? -EFAULT : len; |
543 | len = strlen(name) + 1; | ||
544 | if (len > _IOC_SIZE(cmd)) | ||
545 | len = _IOC_SIZE(cmd); | ||
546 | if (copy_to_user(argp, name, len)) | ||
547 | return -EFAULT; | ||
548 | return len; | ||
549 | } | ||
550 | } | 563 | } |
564 | |||
551 | return -EINVAL; | 565 | return -EINVAL; |
552 | } | 566 | } |
553 | 567 | ||
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index baabf8302645..f6c688cae334 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c | |||
@@ -74,6 +74,7 @@ static struct iforce_device iforce_device[] = { | |||
74 | { 0x05ef, 0x8884, "AVB Mag Turbo Force", btn_avb_wheel, abs_wheel, ff_iforce }, | 74 | { 0x05ef, 0x8884, "AVB Mag Turbo Force", btn_avb_wheel, abs_wheel, ff_iforce }, |
75 | { 0x05ef, 0x8888, "AVB Top Shot Force Feedback Racing Wheel", btn_avb_tw, abs_wheel, ff_iforce }, //? | 75 | { 0x05ef, 0x8888, "AVB Top Shot Force Feedback Racing Wheel", btn_avb_tw, abs_wheel, ff_iforce }, //? |
76 | { 0x061c, 0xc0a4, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, //? | 76 | { 0x061c, 0xc0a4, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, //? |
77 | { 0x061c, 0xc084, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, | ||
77 | { 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback", btn_wheel, abs_wheel, ff_iforce }, //? | 78 | { 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback", btn_wheel, abs_wheel, ff_iforce }, //? |
78 | { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //? | 79 | { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //? |
79 | { 0x06f8, 0x0004, "Gullemot Jet Leader 3D", btn_joystick, abs_joystick, ff_iforce }, //? | 80 | { 0x06f8, 0x0004, "Gullemot Jet Leader 3D", btn_joystick, abs_joystick, ff_iforce }, //? |
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index f83185aeb511..9f289d8f52c6 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c | |||
@@ -223,6 +223,7 @@ static struct usb_device_id iforce_usb_ids [] = { | |||
223 | { USB_DEVICE(0x05ef, 0x8884) }, /* AVB Mag Turbo Force */ | 223 | { USB_DEVICE(0x05ef, 0x8884) }, /* AVB Mag Turbo Force */ |
224 | { USB_DEVICE(0x05ef, 0x8888) }, /* AVB Top Shot FFB Racing Wheel */ | 224 | { USB_DEVICE(0x05ef, 0x8888) }, /* AVB Top Shot FFB Racing Wheel */ |
225 | { USB_DEVICE(0x061c, 0xc0a4) }, /* ACT LABS Force RS */ | 225 | { USB_DEVICE(0x061c, 0xc0a4) }, /* ACT LABS Force RS */ |
226 | { USB_DEVICE(0x061c, 0xc084) }, /* ACT LABS Force RS */ | ||
226 | { USB_DEVICE(0x06f8, 0x0001) }, /* Guillemot Race Leader Force Feedback */ | 227 | { USB_DEVICE(0x06f8, 0x0001) }, /* Guillemot Race Leader Force Feedback */ |
227 | { USB_DEVICE(0x06f8, 0x0004) }, /* Guillemot Force Feedback Racing Wheel */ | 228 | { USB_DEVICE(0x06f8, 0x0004) }, /* Guillemot Force Feedback Racing Wheel */ |
228 | { USB_DEVICE(0x06f8, 0xa302) }, /* Guillemot Jet Leader 3D */ | 229 | { USB_DEVICE(0x06f8, 0xa302) }, /* Guillemot Jet Leader 3D */ |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 95fe0452dae4..6c6a09b1c0fe 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -880,6 +880,14 @@ static unsigned int atkbd_hp_zv6100_forced_release_keys[] = { | |||
880 | }; | 880 | }; |
881 | 881 | ||
882 | /* | 882 | /* |
883 | * Perform fixup for HP (Compaq) Presario R4000 R4100 R4200 that don't generate | ||
884 | * release for their volume buttons | ||
885 | */ | ||
886 | static unsigned int atkbd_hp_r4000_forced_release_keys[] = { | ||
887 | 0xae, 0xb0, -1U | ||
888 | }; | ||
889 | |||
890 | /* | ||
883 | * Samsung NC10,NC20 with Fn+F? key release not working | 891 | * Samsung NC10,NC20 with Fn+F? key release not working |
884 | */ | 892 | */ |
885 | static unsigned int atkbd_samsung_forced_release_keys[] = { | 893 | static unsigned int atkbd_samsung_forced_release_keys[] = { |
@@ -1537,6 +1545,33 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { | |||
1537 | .driver_data = atkbd_hp_zv6100_forced_release_keys, | 1545 | .driver_data = atkbd_hp_zv6100_forced_release_keys, |
1538 | }, | 1546 | }, |
1539 | { | 1547 | { |
1548 | .ident = "HP Presario R4000", | ||
1549 | .matches = { | ||
1550 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
1551 | DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4000"), | ||
1552 | }, | ||
1553 | .callback = atkbd_setup_forced_release, | ||
1554 | .driver_data = atkbd_hp_r4000_forced_release_keys, | ||
1555 | }, | ||
1556 | { | ||
1557 | .ident = "HP Presario R4100", | ||
1558 | .matches = { | ||
1559 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
1560 | DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4100"), | ||
1561 | }, | ||
1562 | .callback = atkbd_setup_forced_release, | ||
1563 | .driver_data = atkbd_hp_r4000_forced_release_keys, | ||
1564 | }, | ||
1565 | { | ||
1566 | .ident = "HP Presario R4200", | ||
1567 | .matches = { | ||
1568 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
1569 | DMI_MATCH(DMI_PRODUCT_NAME, "Presario R4200"), | ||
1570 | }, | ||
1571 | .callback = atkbd_setup_forced_release, | ||
1572 | .driver_data = atkbd_hp_r4000_forced_release_keys, | ||
1573 | }, | ||
1574 | { | ||
1540 | .ident = "Inventec Symphony", | 1575 | .ident = "Inventec Symphony", |
1541 | .matches = { | 1576 | .matches = { |
1542 | DMI_MATCH(DMI_SYS_VENDOR, "INVENTEC"), | 1577 | DMI_MATCH(DMI_SYS_VENDOR, "INVENTEC"), |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index ae04d8a494e5..ccbf23ece8e3 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -382,6 +382,14 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { | |||
382 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"), | 382 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"), |
383 | }, | 383 | }, |
384 | }, | 384 | }, |
385 | { | ||
386 | .ident = "Acer Aspire 5536", | ||
387 | .matches = { | ||
388 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
389 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"), | ||
390 | DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), | ||
391 | }, | ||
392 | }, | ||
385 | { } | 393 | { } |
386 | }; | 394 | }; |
387 | 395 | ||
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index a9d5031b855e..ea30c983a33e 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -388,6 +388,32 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi | |||
388 | return result; | 388 | return result; |
389 | } | 389 | } |
390 | 390 | ||
391 | static int wacom_query_tablet_data(struct usb_interface *intf) | ||
392 | { | ||
393 | unsigned char *rep_data; | ||
394 | int limit = 0; | ||
395 | int error; | ||
396 | |||
397 | rep_data = kmalloc(2, GFP_KERNEL); | ||
398 | if (!rep_data) | ||
399 | return -ENOMEM; | ||
400 | |||
401 | do { | ||
402 | rep_data[0] = 2; | ||
403 | rep_data[1] = 2; | ||
404 | error = usb_set_report(intf, WAC_HID_FEATURE_REPORT, | ||
405 | 2, rep_data, 2); | ||
406 | if (error >= 0) | ||
407 | error = usb_get_report(intf, | ||
408 | WAC_HID_FEATURE_REPORT, 2, | ||
409 | rep_data, 2); | ||
410 | } while ((error < 0 || rep_data[1] != 2) && limit++ < 5); | ||
411 | |||
412 | kfree(rep_data); | ||
413 | |||
414 | return error < 0 ? error : 0; | ||
415 | } | ||
416 | |||
391 | static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) | 417 | static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) |
392 | { | 418 | { |
393 | struct usb_device *dev = interface_to_usbdev(intf); | 419 | struct usb_device *dev = interface_to_usbdev(intf); |
@@ -398,7 +424,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
398 | struct wacom_features *features; | 424 | struct wacom_features *features; |
399 | struct input_dev *input_dev; | 425 | struct input_dev *input_dev; |
400 | int error = -ENOMEM; | 426 | int error = -ENOMEM; |
401 | char rep_data[2], limit = 0; | ||
402 | struct hid_descriptor *hid_desc; | 427 | struct hid_descriptor *hid_desc; |
403 | 428 | ||
404 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); | 429 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
@@ -489,20 +514,10 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
489 | 514 | ||
490 | /* | 515 | /* |
491 | * Ask the tablet to report tablet data if it is not a Tablet PC. | 516 | * Ask the tablet to report tablet data if it is not a Tablet PC. |
492 | * Repeat until it succeeds | 517 | * Note that if query fails it is not a hard failure. |
493 | */ | 518 | */ |
494 | if (wacom_wac->features->type != TABLETPC) { | 519 | if (wacom_wac->features->type != TABLETPC) |
495 | do { | 520 | wacom_query_tablet_data(intf); |
496 | rep_data[0] = 2; | ||
497 | rep_data[1] = 2; | ||
498 | error = usb_set_report(intf, WAC_HID_FEATURE_REPORT, | ||
499 | 2, rep_data, 2); | ||
500 | if (error >= 0) | ||
501 | error = usb_get_report(intf, | ||
502 | WAC_HID_FEATURE_REPORT, 2, | ||
503 | rep_data, 2); | ||
504 | } while ((error < 0 || rep_data[1] != 2) && limit++ < 5); | ||
505 | } | ||
506 | 521 | ||
507 | usb_set_intfdata(intf, wacom); | 522 | usb_set_intfdata(intf, wacom); |
508 | return 0; | 523 | return 0; |
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index 6954f5500108..3a7a58222f83 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c | |||
@@ -170,11 +170,11 @@ static void ucb1400_handle_pending_irq(struct ucb1400_ts *ucb) | |||
170 | ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, isr); | 170 | ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, isr); |
171 | ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); | 171 | ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); |
172 | 172 | ||
173 | if (isr & UCB_IE_TSPX) { | 173 | if (isr & UCB_IE_TSPX) |
174 | ucb1400_ts_irq_disable(ucb->ac97); | 174 | ucb1400_ts_irq_disable(ucb->ac97); |
175 | enable_irq(ucb->irq); | 175 | else |
176 | } else | 176 | dev_dbg(&ucb->ts_idev->dev, "ucb1400: unexpected IE_STATUS = %#x\n", isr); |
177 | printk(KERN_ERR "ucb1400: unexpected IE_STATUS = %#x\n", isr); | 177 | enable_irq(ucb->irq); |
178 | } | 178 | } |
179 | 179 | ||
180 | static int ucb1400_ts_thread(void *_ucb) | 180 | static int ucb1400_ts_thread(void *_ucb) |
@@ -345,6 +345,7 @@ static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb) | |||
345 | static int ucb1400_ts_probe(struct platform_device *dev) | 345 | static int ucb1400_ts_probe(struct platform_device *dev) |
346 | { | 346 | { |
347 | int error, x_res, y_res; | 347 | int error, x_res, y_res; |
348 | u16 fcsr; | ||
348 | struct ucb1400_ts *ucb = dev->dev.platform_data; | 349 | struct ucb1400_ts *ucb = dev->dev.platform_data; |
349 | 350 | ||
350 | ucb->ts_idev = input_allocate_device(); | 351 | ucb->ts_idev = input_allocate_device(); |
@@ -382,6 +383,14 @@ static int ucb1400_ts_probe(struct platform_device *dev) | |||
382 | ucb->ts_idev->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY); | 383 | ucb->ts_idev->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY); |
383 | ucb->ts_idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | 384 | ucb->ts_idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); |
384 | 385 | ||
386 | /* | ||
387 | * Enable ADC filter to prevent horrible jitter on Colibri. | ||
388 | * This also further reduces jitter on boards where ADCSYNC | ||
389 | * pin is connected. | ||
390 | */ | ||
391 | fcsr = ucb1400_reg_read(ucb->ac97, UCB_FCSR); | ||
392 | ucb1400_reg_write(ucb->ac97, UCB_FCSR, fcsr | UCB_FCSR_AVE); | ||
393 | |||
385 | ucb1400_adc_enable(ucb->ac97); | 394 | ucb1400_adc_enable(ucb->ac97); |
386 | x_res = ucb1400_ts_read_xres(ucb); | 395 | x_res = ucb1400_ts_read_xres(ucb); |
387 | y_res = ucb1400_ts_read_yres(ucb); | 396 | y_res = ucb1400_ts_read_yres(ucb); |
diff --git a/drivers/leds/ledtrig-gpio.c b/drivers/leds/ledtrig-gpio.c index a247ae63374f..1bc5db4ece0d 100644 --- a/drivers/leds/ledtrig-gpio.c +++ b/drivers/leds/ledtrig-gpio.c | |||
@@ -117,6 +117,9 @@ static ssize_t gpio_trig_inverted_store(struct device *dev, | |||
117 | 117 | ||
118 | gpio_data->inverted = !!inverted; | 118 | gpio_data->inverted = !!inverted; |
119 | 119 | ||
120 | /* After inverting, we need to update the LED. */ | ||
121 | schedule_work(&gpio_data->work); | ||
122 | |||
120 | return n; | 123 | return n; |
121 | } | 124 | } |
122 | static DEVICE_ATTR(inverted, 0644, gpio_trig_inverted_show, | 125 | static DEVICE_ATTR(inverted, 0644, gpio_trig_inverted_show, |
@@ -146,20 +149,26 @@ static ssize_t gpio_trig_gpio_store(struct device *dev, | |||
146 | return -EINVAL; | 149 | return -EINVAL; |
147 | } | 150 | } |
148 | 151 | ||
152 | if (gpio_data->gpio == gpio) | ||
153 | return n; | ||
154 | |||
149 | if (!gpio) { | 155 | if (!gpio) { |
150 | free_irq(gpio_to_irq(gpio_data->gpio), led); | 156 | if (gpio_data->gpio != 0) |
157 | free_irq(gpio_to_irq(gpio_data->gpio), led); | ||
158 | gpio_data->gpio = 0; | ||
151 | return n; | 159 | return n; |
152 | } | 160 | } |
153 | 161 | ||
154 | if (gpio_data->gpio > 0 && gpio_data->gpio != gpio) | ||
155 | free_irq(gpio_to_irq(gpio_data->gpio), led); | ||
156 | |||
157 | gpio_data->gpio = gpio; | ||
158 | ret = request_irq(gpio_to_irq(gpio), gpio_trig_irq, | 162 | ret = request_irq(gpio_to_irq(gpio), gpio_trig_irq, |
159 | IRQF_SHARED | IRQF_TRIGGER_RISING | 163 | IRQF_SHARED | IRQF_TRIGGER_RISING |
160 | | IRQF_TRIGGER_FALLING, "ledtrig-gpio", led); | 164 | | IRQF_TRIGGER_FALLING, "ledtrig-gpio", led); |
161 | if (ret) | 165 | if (ret) { |
162 | dev_err(dev, "request_irq failed with error %d\n", ret); | 166 | dev_err(dev, "request_irq failed with error %d\n", ret); |
167 | } else { | ||
168 | if (gpio_data->gpio != 0) | ||
169 | free_irq(gpio_to_irq(gpio_data->gpio), led); | ||
170 | gpio_data->gpio = gpio; | ||
171 | } | ||
163 | 172 | ||
164 | return ret ? ret : n; | 173 | return ret ? ret : n; |
165 | } | 174 | } |
@@ -211,7 +220,8 @@ static void gpio_trig_deactivate(struct led_classdev *led) | |||
211 | device_remove_file(led->dev, &dev_attr_inverted); | 220 | device_remove_file(led->dev, &dev_attr_inverted); |
212 | device_remove_file(led->dev, &dev_attr_desired_brightness); | 221 | device_remove_file(led->dev, &dev_attr_desired_brightness); |
213 | flush_work(&gpio_data->work); | 222 | flush_work(&gpio_data->work); |
214 | free_irq(gpio_to_irq(gpio_data->gpio),led); | 223 | if (gpio_data->gpio != 0) |
224 | free_irq(gpio_to_irq(gpio_data->gpio), led); | ||
215 | kfree(gpio_data); | 225 | kfree(gpio_data); |
216 | } | 226 | } |
217 | } | 227 | } |
diff --git a/drivers/macintosh/via-maciisi.c b/drivers/macintosh/via-maciisi.c index 4d686c0bdea0..9ab5b0c34f0d 100644 --- a/drivers/macintosh/via-maciisi.c +++ b/drivers/macintosh/via-maciisi.c | |||
@@ -288,7 +288,7 @@ static void maciisi_sync(struct adb_request *req) | |||
288 | } | 288 | } |
289 | /* This could be BAD... when the ADB controller doesn't respond | 289 | /* This could be BAD... when the ADB controller doesn't respond |
290 | * for this long, it's probably not coming back :-( */ | 290 | * for this long, it's probably not coming back :-( */ |
291 | if(count >= 50) /* Hopefully shouldn't happen */ | 291 | if (count > 50) /* Hopefully shouldn't happen */ |
292 | printk(KERN_ERR "maciisi_send_request: poll timed out!\n"); | 292 | printk(KERN_ERR "maciisi_send_request: poll timed out!\n"); |
293 | } | 293 | } |
294 | 294 | ||
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c index 3710ff88fc10..556acff3952f 100644 --- a/drivers/md/dm-exception-store.c +++ b/drivers/md/dm-exception-store.c | |||
@@ -171,6 +171,14 @@ static int set_chunk_size(struct dm_exception_store *store, | |||
171 | */ | 171 | */ |
172 | chunk_size_ulong = round_up(chunk_size_ulong, PAGE_SIZE >> 9); | 172 | chunk_size_ulong = round_up(chunk_size_ulong, PAGE_SIZE >> 9); |
173 | 173 | ||
174 | return dm_exception_store_set_chunk_size(store, chunk_size_ulong, | ||
175 | error); | ||
176 | } | ||
177 | |||
178 | int dm_exception_store_set_chunk_size(struct dm_exception_store *store, | ||
179 | unsigned long chunk_size_ulong, | ||
180 | char **error) | ||
181 | { | ||
174 | /* Check chunk_size is a power of 2 */ | 182 | /* Check chunk_size is a power of 2 */ |
175 | if (!is_power_of_2(chunk_size_ulong)) { | 183 | if (!is_power_of_2(chunk_size_ulong)) { |
176 | *error = "Chunk size is not a power of 2"; | 184 | *error = "Chunk size is not a power of 2"; |
@@ -183,6 +191,11 @@ static int set_chunk_size(struct dm_exception_store *store, | |||
183 | return -EINVAL; | 191 | return -EINVAL; |
184 | } | 192 | } |
185 | 193 | ||
194 | if (chunk_size_ulong > INT_MAX >> SECTOR_SHIFT) { | ||
195 | *error = "Chunk size is too high"; | ||
196 | return -EINVAL; | ||
197 | } | ||
198 | |||
186 | store->chunk_size = chunk_size_ulong; | 199 | store->chunk_size = chunk_size_ulong; |
187 | store->chunk_mask = chunk_size_ulong - 1; | 200 | store->chunk_mask = chunk_size_ulong - 1; |
188 | store->chunk_shift = ffs(chunk_size_ulong) - 1; | 201 | store->chunk_shift = ffs(chunk_size_ulong) - 1; |
diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h index 2442c8c07898..812c71872ba0 100644 --- a/drivers/md/dm-exception-store.h +++ b/drivers/md/dm-exception-store.h | |||
@@ -168,6 +168,10 @@ static inline chunk_t sector_to_chunk(struct dm_exception_store *store, | |||
168 | int dm_exception_store_type_register(struct dm_exception_store_type *type); | 168 | int dm_exception_store_type_register(struct dm_exception_store_type *type); |
169 | int dm_exception_store_type_unregister(struct dm_exception_store_type *type); | 169 | int dm_exception_store_type_unregister(struct dm_exception_store_type *type); |
170 | 170 | ||
171 | int dm_exception_store_set_chunk_size(struct dm_exception_store *store, | ||
172 | unsigned long chunk_size_ulong, | ||
173 | char **error); | ||
174 | |||
171 | int dm_exception_store_create(struct dm_target *ti, int argc, char **argv, | 175 | int dm_exception_store_create(struct dm_target *ti, int argc, char **argv, |
172 | unsigned *args_used, | 176 | unsigned *args_used, |
173 | struct dm_exception_store **store); | 177 | struct dm_exception_store **store); |
diff --git a/drivers/md/dm-log-userspace-base.c b/drivers/md/dm-log-userspace-base.c index e69b96560997..6e186b1a062d 100644 --- a/drivers/md/dm-log-userspace-base.c +++ b/drivers/md/dm-log-userspace-base.c | |||
@@ -21,6 +21,7 @@ struct log_c { | |||
21 | struct dm_target *ti; | 21 | struct dm_target *ti; |
22 | uint32_t region_size; | 22 | uint32_t region_size; |
23 | region_t region_count; | 23 | region_t region_count; |
24 | uint64_t luid; | ||
24 | char uuid[DM_UUID_LEN]; | 25 | char uuid[DM_UUID_LEN]; |
25 | 26 | ||
26 | char *usr_argv_str; | 27 | char *usr_argv_str; |
@@ -63,7 +64,7 @@ static int userspace_do_request(struct log_c *lc, const char *uuid, | |||
63 | * restored. | 64 | * restored. |
64 | */ | 65 | */ |
65 | retry: | 66 | retry: |
66 | r = dm_consult_userspace(uuid, request_type, data, | 67 | r = dm_consult_userspace(uuid, lc->luid, request_type, data, |
67 | data_size, rdata, rdata_size); | 68 | data_size, rdata, rdata_size); |
68 | 69 | ||
69 | if (r != -ESRCH) | 70 | if (r != -ESRCH) |
@@ -74,14 +75,15 @@ retry: | |||
74 | set_current_state(TASK_INTERRUPTIBLE); | 75 | set_current_state(TASK_INTERRUPTIBLE); |
75 | schedule_timeout(2*HZ); | 76 | schedule_timeout(2*HZ); |
76 | DMWARN("Attempting to contact userspace log server..."); | 77 | DMWARN("Attempting to contact userspace log server..."); |
77 | r = dm_consult_userspace(uuid, DM_ULOG_CTR, lc->usr_argv_str, | 78 | r = dm_consult_userspace(uuid, lc->luid, DM_ULOG_CTR, |
79 | lc->usr_argv_str, | ||
78 | strlen(lc->usr_argv_str) + 1, | 80 | strlen(lc->usr_argv_str) + 1, |
79 | NULL, NULL); | 81 | NULL, NULL); |
80 | if (!r) | 82 | if (!r) |
81 | break; | 83 | break; |
82 | } | 84 | } |
83 | DMINFO("Reconnected to userspace log server... DM_ULOG_CTR complete"); | 85 | DMINFO("Reconnected to userspace log server... DM_ULOG_CTR complete"); |
84 | r = dm_consult_userspace(uuid, DM_ULOG_RESUME, NULL, | 86 | r = dm_consult_userspace(uuid, lc->luid, DM_ULOG_RESUME, NULL, |
85 | 0, NULL, NULL); | 87 | 0, NULL, NULL); |
86 | if (!r) | 88 | if (!r) |
87 | goto retry; | 89 | goto retry; |
@@ -111,10 +113,9 @@ static int build_constructor_string(struct dm_target *ti, | |||
111 | return -ENOMEM; | 113 | return -ENOMEM; |
112 | } | 114 | } |
113 | 115 | ||
114 | for (i = 0, str_size = 0; i < argc; i++) | 116 | str_size = sprintf(str, "%llu", (unsigned long long)ti->len); |
115 | str_size += sprintf(str + str_size, "%s ", argv[i]); | 117 | for (i = 0; i < argc; i++) |
116 | str_size += sprintf(str + str_size, "%llu", | 118 | str_size += sprintf(str + str_size, " %s", argv[i]); |
117 | (unsigned long long)ti->len); | ||
118 | 119 | ||
119 | *ctr_str = str; | 120 | *ctr_str = str; |
120 | return str_size; | 121 | return str_size; |
@@ -154,6 +155,9 @@ static int userspace_ctr(struct dm_dirty_log *log, struct dm_target *ti, | |||
154 | return -ENOMEM; | 155 | return -ENOMEM; |
155 | } | 156 | } |
156 | 157 | ||
158 | /* The ptr value is sufficient for local unique id */ | ||
159 | lc->luid = (uint64_t)lc; | ||
160 | |||
157 | lc->ti = ti; | 161 | lc->ti = ti; |
158 | 162 | ||
159 | if (strlen(argv[0]) > (DM_UUID_LEN - 1)) { | 163 | if (strlen(argv[0]) > (DM_UUID_LEN - 1)) { |
@@ -173,7 +177,7 @@ static int userspace_ctr(struct dm_dirty_log *log, struct dm_target *ti, | |||
173 | } | 177 | } |
174 | 178 | ||
175 | /* Send table string */ | 179 | /* Send table string */ |
176 | r = dm_consult_userspace(lc->uuid, DM_ULOG_CTR, | 180 | r = dm_consult_userspace(lc->uuid, lc->luid, DM_ULOG_CTR, |
177 | ctr_str, str_size, NULL, NULL); | 181 | ctr_str, str_size, NULL, NULL); |
178 | 182 | ||
179 | if (r == -ESRCH) { | 183 | if (r == -ESRCH) { |
@@ -183,7 +187,7 @@ static int userspace_ctr(struct dm_dirty_log *log, struct dm_target *ti, | |||
183 | 187 | ||
184 | /* Since the region size does not change, get it now */ | 188 | /* Since the region size does not change, get it now */ |
185 | rdata_size = sizeof(rdata); | 189 | rdata_size = sizeof(rdata); |
186 | r = dm_consult_userspace(lc->uuid, DM_ULOG_GET_REGION_SIZE, | 190 | r = dm_consult_userspace(lc->uuid, lc->luid, DM_ULOG_GET_REGION_SIZE, |
187 | NULL, 0, (char *)&rdata, &rdata_size); | 191 | NULL, 0, (char *)&rdata, &rdata_size); |
188 | 192 | ||
189 | if (r) { | 193 | if (r) { |
@@ -212,7 +216,7 @@ static void userspace_dtr(struct dm_dirty_log *log) | |||
212 | int r; | 216 | int r; |
213 | struct log_c *lc = log->context; | 217 | struct log_c *lc = log->context; |
214 | 218 | ||
215 | r = dm_consult_userspace(lc->uuid, DM_ULOG_DTR, | 219 | r = dm_consult_userspace(lc->uuid, lc->luid, DM_ULOG_DTR, |
216 | NULL, 0, | 220 | NULL, 0, |
217 | NULL, NULL); | 221 | NULL, NULL); |
218 | 222 | ||
@@ -227,7 +231,7 @@ static int userspace_presuspend(struct dm_dirty_log *log) | |||
227 | int r; | 231 | int r; |
228 | struct log_c *lc = log->context; | 232 | struct log_c *lc = log->context; |
229 | 233 | ||
230 | r = dm_consult_userspace(lc->uuid, DM_ULOG_PRESUSPEND, | 234 | r = dm_consult_userspace(lc->uuid, lc->luid, DM_ULOG_PRESUSPEND, |
231 | NULL, 0, | 235 | NULL, 0, |
232 | NULL, NULL); | 236 | NULL, NULL); |
233 | 237 | ||
@@ -239,7 +243,7 @@ static int userspace_postsuspend(struct dm_dirty_log *log) | |||
239 | int r; | 243 | int r; |
240 | struct log_c *lc = log->context; | 244 | struct log_c *lc = log->context; |
241 | 245 | ||
242 | r = dm_consult_userspace(lc->uuid, DM_ULOG_POSTSUSPEND, | 246 | r = dm_consult_userspace(lc->uuid, lc->luid, DM_ULOG_POSTSUSPEND, |
243 | NULL, 0, | 247 | NULL, 0, |
244 | NULL, NULL); | 248 | NULL, NULL); |
245 | 249 | ||
@@ -252,7 +256,7 @@ static int userspace_resume(struct dm_dirty_log *log) | |||
252 | struct log_c *lc = log->context; | 256 | struct log_c *lc = log->context; |
253 | 257 | ||
254 | lc->in_sync_hint = 0; | 258 | lc->in_sync_hint = 0; |
255 | r = dm_consult_userspace(lc->uuid, DM_ULOG_RESUME, | 259 | r = dm_consult_userspace(lc->uuid, lc->luid, DM_ULOG_RESUME, |
256 | NULL, 0, | 260 | NULL, 0, |
257 | NULL, NULL); | 261 | NULL, NULL); |
258 | 262 | ||
@@ -561,6 +565,7 @@ static int userspace_status(struct dm_dirty_log *log, status_type_t status_type, | |||
561 | char *result, unsigned maxlen) | 565 | char *result, unsigned maxlen) |
562 | { | 566 | { |
563 | int r = 0; | 567 | int r = 0; |
568 | char *table_args; | ||
564 | size_t sz = (size_t)maxlen; | 569 | size_t sz = (size_t)maxlen; |
565 | struct log_c *lc = log->context; | 570 | struct log_c *lc = log->context; |
566 | 571 | ||
@@ -577,8 +582,12 @@ static int userspace_status(struct dm_dirty_log *log, status_type_t status_type, | |||
577 | break; | 582 | break; |
578 | case STATUSTYPE_TABLE: | 583 | case STATUSTYPE_TABLE: |
579 | sz = 0; | 584 | sz = 0; |
580 | DMEMIT("%s %u %s %s", log->type->name, lc->usr_argc + 1, | 585 | table_args = strstr(lc->usr_argv_str, " "); |
581 | lc->uuid, lc->usr_argv_str); | 586 | BUG_ON(!table_args); /* There will always be a ' ' */ |
587 | table_args++; | ||
588 | |||
589 | DMEMIT("%s %u %s %s ", log->type->name, lc->usr_argc, | ||
590 | lc->uuid, table_args); | ||
582 | break; | 591 | break; |
583 | } | 592 | } |
584 | return (r) ? 0 : (int)sz; | 593 | return (r) ? 0 : (int)sz; |
diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c index 0ca1ee768a1f..ba0edad2d048 100644 --- a/drivers/md/dm-log-userspace-transfer.c +++ b/drivers/md/dm-log-userspace-transfer.c | |||
@@ -108,7 +108,7 @@ static int fill_pkg(struct cn_msg *msg, struct dm_ulog_request *tfr) | |||
108 | *(pkg->data_size) = 0; | 108 | *(pkg->data_size) = 0; |
109 | } else if (tfr->data_size > *(pkg->data_size)) { | 109 | } else if (tfr->data_size > *(pkg->data_size)) { |
110 | DMERR("Insufficient space to receive package [%u] " | 110 | DMERR("Insufficient space to receive package [%u] " |
111 | "(%u vs %lu)", tfr->request_type, | 111 | "(%u vs %zu)", tfr->request_type, |
112 | tfr->data_size, *(pkg->data_size)); | 112 | tfr->data_size, *(pkg->data_size)); |
113 | 113 | ||
114 | *(pkg->data_size) = 0; | 114 | *(pkg->data_size) = 0; |
@@ -147,7 +147,8 @@ static void cn_ulog_callback(void *data) | |||
147 | 147 | ||
148 | /** | 148 | /** |
149 | * dm_consult_userspace | 149 | * dm_consult_userspace |
150 | * @uuid: log's uuid (must be DM_UUID_LEN in size) | 150 | * @uuid: log's universal unique identifier (must be DM_UUID_LEN in size) |
151 | * @luid: log's local unique identifier | ||
151 | * @request_type: found in include/linux/dm-log-userspace.h | 152 | * @request_type: found in include/linux/dm-log-userspace.h |
152 | * @data: data to tx to the server | 153 | * @data: data to tx to the server |
153 | * @data_size: size of data in bytes | 154 | * @data_size: size of data in bytes |
@@ -163,7 +164,7 @@ static void cn_ulog_callback(void *data) | |||
163 | * | 164 | * |
164 | * Returns: 0 on success, -EXXX on failure | 165 | * Returns: 0 on success, -EXXX on failure |
165 | **/ | 166 | **/ |
166 | int dm_consult_userspace(const char *uuid, int request_type, | 167 | int dm_consult_userspace(const char *uuid, uint64_t luid, int request_type, |
167 | char *data, size_t data_size, | 168 | char *data, size_t data_size, |
168 | char *rdata, size_t *rdata_size) | 169 | char *rdata, size_t *rdata_size) |
169 | { | 170 | { |
@@ -190,6 +191,7 @@ resend: | |||
190 | 191 | ||
191 | memset(tfr, 0, DM_ULOG_PREALLOCED_SIZE - overhead_size); | 192 | memset(tfr, 0, DM_ULOG_PREALLOCED_SIZE - overhead_size); |
192 | memcpy(tfr->uuid, uuid, DM_UUID_LEN); | 193 | memcpy(tfr->uuid, uuid, DM_UUID_LEN); |
194 | tfr->luid = luid; | ||
193 | tfr->seq = dm_ulog_seq++; | 195 | tfr->seq = dm_ulog_seq++; |
194 | 196 | ||
195 | /* | 197 | /* |
diff --git a/drivers/md/dm-log-userspace-transfer.h b/drivers/md/dm-log-userspace-transfer.h index c26d8e4e2710..04ee874f9153 100644 --- a/drivers/md/dm-log-userspace-transfer.h +++ b/drivers/md/dm-log-userspace-transfer.h | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | int dm_ulog_tfr_init(void); | 12 | int dm_ulog_tfr_init(void); |
13 | void dm_ulog_tfr_exit(void); | 13 | void dm_ulog_tfr_exit(void); |
14 | int dm_consult_userspace(const char *uuid, int request_type, | 14 | int dm_consult_userspace(const char *uuid, uint64_t luid, int request_type, |
15 | char *data, size_t data_size, | 15 | char *data, size_t data_size, |
16 | char *rdata, size_t *rdata_size); | 16 | char *rdata, size_t *rdata_size); |
17 | 17 | ||
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 9726577cde49..33f179e66bf5 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -648,7 +648,13 @@ static void do_writes(struct mirror_set *ms, struct bio_list *writes) | |||
648 | */ | 648 | */ |
649 | dm_rh_inc_pending(ms->rh, &sync); | 649 | dm_rh_inc_pending(ms->rh, &sync); |
650 | dm_rh_inc_pending(ms->rh, &nosync); | 650 | dm_rh_inc_pending(ms->rh, &nosync); |
651 | ms->log_failure = dm_rh_flush(ms->rh) ? 1 : 0; | 651 | |
652 | /* | ||
653 | * If the flush fails on a previous call and succeeds here, | ||
654 | * we must not reset the log_failure variable. We need | ||
655 | * userspace interaction to do that. | ||
656 | */ | ||
657 | ms->log_failure = dm_rh_flush(ms->rh) ? 1 : ms->log_failure; | ||
652 | 658 | ||
653 | /* | 659 | /* |
654 | * Dispatch io. | 660 | * Dispatch io. |
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c index 6e3fe4f14934..d5b2e08750d5 100644 --- a/drivers/md/dm-snap-persistent.c +++ b/drivers/md/dm-snap-persistent.c | |||
@@ -106,6 +106,13 @@ struct pstore { | |||
106 | void *zero_area; | 106 | void *zero_area; |
107 | 107 | ||
108 | /* | 108 | /* |
109 | * An area used for header. The header can be written | ||
110 | * concurrently with metadata (when invalidating the snapshot), | ||
111 | * so it needs a separate buffer. | ||
112 | */ | ||
113 | void *header_area; | ||
114 | |||
115 | /* | ||
109 | * Used to keep track of which metadata area the data in | 116 | * Used to keep track of which metadata area the data in |
110 | * 'chunk' refers to. | 117 | * 'chunk' refers to. |
111 | */ | 118 | */ |
@@ -148,16 +155,27 @@ static int alloc_area(struct pstore *ps) | |||
148 | */ | 155 | */ |
149 | ps->area = vmalloc(len); | 156 | ps->area = vmalloc(len); |
150 | if (!ps->area) | 157 | if (!ps->area) |
151 | return r; | 158 | goto err_area; |
152 | 159 | ||
153 | ps->zero_area = vmalloc(len); | 160 | ps->zero_area = vmalloc(len); |
154 | if (!ps->zero_area) { | 161 | if (!ps->zero_area) |
155 | vfree(ps->area); | 162 | goto err_zero_area; |
156 | return r; | ||
157 | } | ||
158 | memset(ps->zero_area, 0, len); | 163 | memset(ps->zero_area, 0, len); |
159 | 164 | ||
165 | ps->header_area = vmalloc(len); | ||
166 | if (!ps->header_area) | ||
167 | goto err_header_area; | ||
168 | |||
160 | return 0; | 169 | return 0; |
170 | |||
171 | err_header_area: | ||
172 | vfree(ps->zero_area); | ||
173 | |||
174 | err_zero_area: | ||
175 | vfree(ps->area); | ||
176 | |||
177 | err_area: | ||
178 | return r; | ||
161 | } | 179 | } |
162 | 180 | ||
163 | static void free_area(struct pstore *ps) | 181 | static void free_area(struct pstore *ps) |
@@ -169,6 +187,10 @@ static void free_area(struct pstore *ps) | |||
169 | if (ps->zero_area) | 187 | if (ps->zero_area) |
170 | vfree(ps->zero_area); | 188 | vfree(ps->zero_area); |
171 | ps->zero_area = NULL; | 189 | ps->zero_area = NULL; |
190 | |||
191 | if (ps->header_area) | ||
192 | vfree(ps->header_area); | ||
193 | ps->header_area = NULL; | ||
172 | } | 194 | } |
173 | 195 | ||
174 | struct mdata_req { | 196 | struct mdata_req { |
@@ -188,7 +210,8 @@ static void do_metadata(struct work_struct *work) | |||
188 | /* | 210 | /* |
189 | * Read or write a chunk aligned and sized block of data from a device. | 211 | * Read or write a chunk aligned and sized block of data from a device. |
190 | */ | 212 | */ |
191 | static int chunk_io(struct pstore *ps, chunk_t chunk, int rw, int metadata) | 213 | static int chunk_io(struct pstore *ps, void *area, chunk_t chunk, int rw, |
214 | int metadata) | ||
192 | { | 215 | { |
193 | struct dm_io_region where = { | 216 | struct dm_io_region where = { |
194 | .bdev = ps->store->cow->bdev, | 217 | .bdev = ps->store->cow->bdev, |
@@ -198,7 +221,7 @@ static int chunk_io(struct pstore *ps, chunk_t chunk, int rw, int metadata) | |||
198 | struct dm_io_request io_req = { | 221 | struct dm_io_request io_req = { |
199 | .bi_rw = rw, | 222 | .bi_rw = rw, |
200 | .mem.type = DM_IO_VMA, | 223 | .mem.type = DM_IO_VMA, |
201 | .mem.ptr.vma = ps->area, | 224 | .mem.ptr.vma = area, |
202 | .client = ps->io_client, | 225 | .client = ps->io_client, |
203 | .notify.fn = NULL, | 226 | .notify.fn = NULL, |
204 | }; | 227 | }; |
@@ -240,7 +263,7 @@ static int area_io(struct pstore *ps, int rw) | |||
240 | 263 | ||
241 | chunk = area_location(ps, ps->current_area); | 264 | chunk = area_location(ps, ps->current_area); |
242 | 265 | ||
243 | r = chunk_io(ps, chunk, rw, 0); | 266 | r = chunk_io(ps, ps->area, chunk, rw, 0); |
244 | if (r) | 267 | if (r) |
245 | return r; | 268 | return r; |
246 | 269 | ||
@@ -254,20 +277,7 @@ static void zero_memory_area(struct pstore *ps) | |||
254 | 277 | ||
255 | static int zero_disk_area(struct pstore *ps, chunk_t area) | 278 | static int zero_disk_area(struct pstore *ps, chunk_t area) |
256 | { | 279 | { |
257 | struct dm_io_region where = { | 280 | return chunk_io(ps, ps->zero_area, area_location(ps, area), WRITE, 0); |
258 | .bdev = ps->store->cow->bdev, | ||
259 | .sector = ps->store->chunk_size * area_location(ps, area), | ||
260 | .count = ps->store->chunk_size, | ||
261 | }; | ||
262 | struct dm_io_request io_req = { | ||
263 | .bi_rw = WRITE, | ||
264 | .mem.type = DM_IO_VMA, | ||
265 | .mem.ptr.vma = ps->zero_area, | ||
266 | .client = ps->io_client, | ||
267 | .notify.fn = NULL, | ||
268 | }; | ||
269 | |||
270 | return dm_io(&io_req, 1, &where, NULL); | ||
271 | } | 281 | } |
272 | 282 | ||
273 | static int read_header(struct pstore *ps, int *new_snapshot) | 283 | static int read_header(struct pstore *ps, int *new_snapshot) |
@@ -276,6 +286,7 @@ static int read_header(struct pstore *ps, int *new_snapshot) | |||
276 | struct disk_header *dh; | 286 | struct disk_header *dh; |
277 | chunk_t chunk_size; | 287 | chunk_t chunk_size; |
278 | int chunk_size_supplied = 1; | 288 | int chunk_size_supplied = 1; |
289 | char *chunk_err; | ||
279 | 290 | ||
280 | /* | 291 | /* |
281 | * Use default chunk size (or hardsect_size, if larger) if none supplied | 292 | * Use default chunk size (or hardsect_size, if larger) if none supplied |
@@ -297,11 +308,11 @@ static int read_header(struct pstore *ps, int *new_snapshot) | |||
297 | if (r) | 308 | if (r) |
298 | return r; | 309 | return r; |
299 | 310 | ||
300 | r = chunk_io(ps, 0, READ, 1); | 311 | r = chunk_io(ps, ps->header_area, 0, READ, 1); |
301 | if (r) | 312 | if (r) |
302 | goto bad; | 313 | goto bad; |
303 | 314 | ||
304 | dh = (struct disk_header *) ps->area; | 315 | dh = ps->header_area; |
305 | 316 | ||
306 | if (le32_to_cpu(dh->magic) == 0) { | 317 | if (le32_to_cpu(dh->magic) == 0) { |
307 | *new_snapshot = 1; | 318 | *new_snapshot = 1; |
@@ -319,20 +330,25 @@ static int read_header(struct pstore *ps, int *new_snapshot) | |||
319 | ps->version = le32_to_cpu(dh->version); | 330 | ps->version = le32_to_cpu(dh->version); |
320 | chunk_size = le32_to_cpu(dh->chunk_size); | 331 | chunk_size = le32_to_cpu(dh->chunk_size); |
321 | 332 | ||
322 | if (!chunk_size_supplied || ps->store->chunk_size == chunk_size) | 333 | if (ps->store->chunk_size == chunk_size) |
323 | return 0; | 334 | return 0; |
324 | 335 | ||
325 | DMWARN("chunk size %llu in device metadata overrides " | 336 | if (chunk_size_supplied) |
326 | "table chunk size of %llu.", | 337 | DMWARN("chunk size %llu in device metadata overrides " |
327 | (unsigned long long)chunk_size, | 338 | "table chunk size of %llu.", |
328 | (unsigned long long)ps->store->chunk_size); | 339 | (unsigned long long)chunk_size, |
340 | (unsigned long long)ps->store->chunk_size); | ||
329 | 341 | ||
330 | /* We had a bogus chunk_size. Fix stuff up. */ | 342 | /* We had a bogus chunk_size. Fix stuff up. */ |
331 | free_area(ps); | 343 | free_area(ps); |
332 | 344 | ||
333 | ps->store->chunk_size = chunk_size; | 345 | r = dm_exception_store_set_chunk_size(ps->store, chunk_size, |
334 | ps->store->chunk_mask = chunk_size - 1; | 346 | &chunk_err); |
335 | ps->store->chunk_shift = ffs(chunk_size) - 1; | 347 | if (r) { |
348 | DMERR("invalid on-disk chunk size %llu: %s.", | ||
349 | (unsigned long long)chunk_size, chunk_err); | ||
350 | return r; | ||
351 | } | ||
336 | 352 | ||
337 | r = dm_io_client_resize(sectors_to_pages(ps->store->chunk_size), | 353 | r = dm_io_client_resize(sectors_to_pages(ps->store->chunk_size), |
338 | ps->io_client); | 354 | ps->io_client); |
@@ -351,15 +367,15 @@ static int write_header(struct pstore *ps) | |||
351 | { | 367 | { |
352 | struct disk_header *dh; | 368 | struct disk_header *dh; |
353 | 369 | ||
354 | memset(ps->area, 0, ps->store->chunk_size << SECTOR_SHIFT); | 370 | memset(ps->header_area, 0, ps->store->chunk_size << SECTOR_SHIFT); |
355 | 371 | ||
356 | dh = (struct disk_header *) ps->area; | 372 | dh = ps->header_area; |
357 | dh->magic = cpu_to_le32(SNAP_MAGIC); | 373 | dh->magic = cpu_to_le32(SNAP_MAGIC); |
358 | dh->valid = cpu_to_le32(ps->valid); | 374 | dh->valid = cpu_to_le32(ps->valid); |
359 | dh->version = cpu_to_le32(ps->version); | 375 | dh->version = cpu_to_le32(ps->version); |
360 | dh->chunk_size = cpu_to_le32(ps->store->chunk_size); | 376 | dh->chunk_size = cpu_to_le32(ps->store->chunk_size); |
361 | 377 | ||
362 | return chunk_io(ps, 0, WRITE, 1); | 378 | return chunk_io(ps, ps->header_area, 0, WRITE, 1); |
363 | } | 379 | } |
364 | 380 | ||
365 | /* | 381 | /* |
@@ -679,6 +695,8 @@ static int persistent_ctr(struct dm_exception_store *store, | |||
679 | ps->valid = 1; | 695 | ps->valid = 1; |
680 | ps->version = SNAPSHOT_DISK_VERSION; | 696 | ps->version = SNAPSHOT_DISK_VERSION; |
681 | ps->area = NULL; | 697 | ps->area = NULL; |
698 | ps->zero_area = NULL; | ||
699 | ps->header_area = NULL; | ||
682 | ps->next_free = 2; /* skipping the header and first area */ | 700 | ps->next_free = 2; /* skipping the header and first area */ |
683 | ps->current_committed = 0; | 701 | ps->current_committed = 0; |
684 | 702 | ||
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index d573165cd2b7..57f1bf7f3b7a 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -1176,6 +1176,15 @@ static int snapshot_status(struct dm_target *ti, status_type_t type, | |||
1176 | return 0; | 1176 | return 0; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | static int snapshot_iterate_devices(struct dm_target *ti, | ||
1180 | iterate_devices_callout_fn fn, void *data) | ||
1181 | { | ||
1182 | struct dm_snapshot *snap = ti->private; | ||
1183 | |||
1184 | return fn(ti, snap->origin, 0, ti->len, data); | ||
1185 | } | ||
1186 | |||
1187 | |||
1179 | /*----------------------------------------------------------------- | 1188 | /*----------------------------------------------------------------- |
1180 | * Origin methods | 1189 | * Origin methods |
1181 | *---------------------------------------------------------------*/ | 1190 | *---------------------------------------------------------------*/ |
@@ -1410,20 +1419,29 @@ static int origin_status(struct dm_target *ti, status_type_t type, char *result, | |||
1410 | return 0; | 1419 | return 0; |
1411 | } | 1420 | } |
1412 | 1421 | ||
1422 | static int origin_iterate_devices(struct dm_target *ti, | ||
1423 | iterate_devices_callout_fn fn, void *data) | ||
1424 | { | ||
1425 | struct dm_dev *dev = ti->private; | ||
1426 | |||
1427 | return fn(ti, dev, 0, ti->len, data); | ||
1428 | } | ||
1429 | |||
1413 | static struct target_type origin_target = { | 1430 | static struct target_type origin_target = { |
1414 | .name = "snapshot-origin", | 1431 | .name = "snapshot-origin", |
1415 | .version = {1, 6, 0}, | 1432 | .version = {1, 7, 0}, |
1416 | .module = THIS_MODULE, | 1433 | .module = THIS_MODULE, |
1417 | .ctr = origin_ctr, | 1434 | .ctr = origin_ctr, |
1418 | .dtr = origin_dtr, | 1435 | .dtr = origin_dtr, |
1419 | .map = origin_map, | 1436 | .map = origin_map, |
1420 | .resume = origin_resume, | 1437 | .resume = origin_resume, |
1421 | .status = origin_status, | 1438 | .status = origin_status, |
1439 | .iterate_devices = origin_iterate_devices, | ||
1422 | }; | 1440 | }; |
1423 | 1441 | ||
1424 | static struct target_type snapshot_target = { | 1442 | static struct target_type snapshot_target = { |
1425 | .name = "snapshot", | 1443 | .name = "snapshot", |
1426 | .version = {1, 6, 0}, | 1444 | .version = {1, 7, 0}, |
1427 | .module = THIS_MODULE, | 1445 | .module = THIS_MODULE, |
1428 | .ctr = snapshot_ctr, | 1446 | .ctr = snapshot_ctr, |
1429 | .dtr = snapshot_dtr, | 1447 | .dtr = snapshot_dtr, |
@@ -1431,6 +1449,7 @@ static struct target_type snapshot_target = { | |||
1431 | .end_io = snapshot_end_io, | 1449 | .end_io = snapshot_end_io, |
1432 | .resume = snapshot_resume, | 1450 | .resume = snapshot_resume, |
1433 | .status = snapshot_status, | 1451 | .status = snapshot_status, |
1452 | .iterate_devices = snapshot_iterate_devices, | ||
1434 | }; | 1453 | }; |
1435 | 1454 | ||
1436 | static int __init dm_snapshot_init(void) | 1455 | static int __init dm_snapshot_init(void) |
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 4e0e5937e42a..3e563d251733 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
@@ -329,9 +329,19 @@ static int stripe_iterate_devices(struct dm_target *ti, | |||
329 | return ret; | 329 | return ret; |
330 | } | 330 | } |
331 | 331 | ||
332 | static void stripe_io_hints(struct dm_target *ti, | ||
333 | struct queue_limits *limits) | ||
334 | { | ||
335 | struct stripe_c *sc = ti->private; | ||
336 | unsigned chunk_size = (sc->chunk_mask + 1) << 9; | ||
337 | |||
338 | blk_limits_io_min(limits, chunk_size); | ||
339 | limits->io_opt = chunk_size * sc->stripes; | ||
340 | } | ||
341 | |||
332 | static struct target_type stripe_target = { | 342 | static struct target_type stripe_target = { |
333 | .name = "striped", | 343 | .name = "striped", |
334 | .version = {1, 2, 0}, | 344 | .version = {1, 3, 0}, |
335 | .module = THIS_MODULE, | 345 | .module = THIS_MODULE, |
336 | .ctr = stripe_ctr, | 346 | .ctr = stripe_ctr, |
337 | .dtr = stripe_dtr, | 347 | .dtr = stripe_dtr, |
@@ -339,6 +349,7 @@ static struct target_type stripe_target = { | |||
339 | .end_io = stripe_end_io, | 349 | .end_io = stripe_end_io, |
340 | .status = stripe_status, | 350 | .status = stripe_status, |
341 | .iterate_devices = stripe_iterate_devices, | 351 | .iterate_devices = stripe_iterate_devices, |
352 | .io_hints = stripe_io_hints, | ||
342 | }; | 353 | }; |
343 | 354 | ||
344 | int __init dm_stripe_init(void) | 355 | int __init dm_stripe_init(void) |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index d952b3441913..1a6cb3c7822e 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -343,10 +343,10 @@ static void close_dev(struct dm_dev_internal *d, struct mapped_device *md) | |||
343 | } | 343 | } |
344 | 344 | ||
345 | /* | 345 | /* |
346 | * If possible, this checks an area of a destination device is valid. | 346 | * If possible, this checks an area of a destination device is invalid. |
347 | */ | 347 | */ |
348 | static int device_area_is_valid(struct dm_target *ti, struct dm_dev *dev, | 348 | static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev, |
349 | sector_t start, sector_t len, void *data) | 349 | sector_t start, sector_t len, void *data) |
350 | { | 350 | { |
351 | struct queue_limits *limits = data; | 351 | struct queue_limits *limits = data; |
352 | struct block_device *bdev = dev->bdev; | 352 | struct block_device *bdev = dev->bdev; |
@@ -357,36 +357,40 @@ static int device_area_is_valid(struct dm_target *ti, struct dm_dev *dev, | |||
357 | char b[BDEVNAME_SIZE]; | 357 | char b[BDEVNAME_SIZE]; |
358 | 358 | ||
359 | if (!dev_size) | 359 | if (!dev_size) |
360 | return 1; | 360 | return 0; |
361 | 361 | ||
362 | if ((start >= dev_size) || (start + len > dev_size)) { | 362 | if ((start >= dev_size) || (start + len > dev_size)) { |
363 | DMWARN("%s: %s too small for target", | 363 | DMWARN("%s: %s too small for target: " |
364 | dm_device_name(ti->table->md), bdevname(bdev, b)); | 364 | "start=%llu, len=%llu, dev_size=%llu", |
365 | return 0; | 365 | dm_device_name(ti->table->md), bdevname(bdev, b), |
366 | (unsigned long long)start, | ||
367 | (unsigned long long)len, | ||
368 | (unsigned long long)dev_size); | ||
369 | return 1; | ||
366 | } | 370 | } |
367 | 371 | ||
368 | if (logical_block_size_sectors <= 1) | 372 | if (logical_block_size_sectors <= 1) |
369 | return 1; | 373 | return 0; |
370 | 374 | ||
371 | if (start & (logical_block_size_sectors - 1)) { | 375 | if (start & (logical_block_size_sectors - 1)) { |
372 | DMWARN("%s: start=%llu not aligned to h/w " | 376 | DMWARN("%s: start=%llu not aligned to h/w " |
373 | "logical block size %hu of %s", | 377 | "logical block size %u of %s", |
374 | dm_device_name(ti->table->md), | 378 | dm_device_name(ti->table->md), |
375 | (unsigned long long)start, | 379 | (unsigned long long)start, |
376 | limits->logical_block_size, bdevname(bdev, b)); | 380 | limits->logical_block_size, bdevname(bdev, b)); |
377 | return 0; | 381 | return 1; |
378 | } | 382 | } |
379 | 383 | ||
380 | if (len & (logical_block_size_sectors - 1)) { | 384 | if (len & (logical_block_size_sectors - 1)) { |
381 | DMWARN("%s: len=%llu not aligned to h/w " | 385 | DMWARN("%s: len=%llu not aligned to h/w " |
382 | "logical block size %hu of %s", | 386 | "logical block size %u of %s", |
383 | dm_device_name(ti->table->md), | 387 | dm_device_name(ti->table->md), |
384 | (unsigned long long)len, | 388 | (unsigned long long)len, |
385 | limits->logical_block_size, bdevname(bdev, b)); | 389 | limits->logical_block_size, bdevname(bdev, b)); |
386 | return 0; | 390 | return 1; |
387 | } | 391 | } |
388 | 392 | ||
389 | return 1; | 393 | return 0; |
390 | } | 394 | } |
391 | 395 | ||
392 | /* | 396 | /* |
@@ -496,8 +500,15 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, | |||
496 | } | 500 | } |
497 | 501 | ||
498 | if (blk_stack_limits(limits, &q->limits, start << 9) < 0) | 502 | if (blk_stack_limits(limits, &q->limits, start << 9) < 0) |
499 | DMWARN("%s: target device %s is misaligned", | 503 | DMWARN("%s: target device %s is misaligned: " |
500 | dm_device_name(ti->table->md), bdevname(bdev, b)); | 504 | "physical_block_size=%u, logical_block_size=%u, " |
505 | "alignment_offset=%u, start=%llu", | ||
506 | dm_device_name(ti->table->md), bdevname(bdev, b), | ||
507 | q->limits.physical_block_size, | ||
508 | q->limits.logical_block_size, | ||
509 | q->limits.alignment_offset, | ||
510 | (unsigned long long) start << 9); | ||
511 | |||
501 | 512 | ||
502 | /* | 513 | /* |
503 | * Check if merge fn is supported. | 514 | * Check if merge fn is supported. |
@@ -698,7 +709,7 @@ static int validate_hardware_logical_block_alignment(struct dm_table *table, | |||
698 | 709 | ||
699 | if (remaining) { | 710 | if (remaining) { |
700 | DMWARN("%s: table line %u (start sect %llu len %llu) " | 711 | DMWARN("%s: table line %u (start sect %llu len %llu) " |
701 | "not aligned to h/w logical block size %hu", | 712 | "not aligned to h/w logical block size %u", |
702 | dm_device_name(table->md), i, | 713 | dm_device_name(table->md), i, |
703 | (unsigned long long) ti->begin, | 714 | (unsigned long long) ti->begin, |
704 | (unsigned long long) ti->len, | 715 | (unsigned long long) ti->len, |
@@ -996,12 +1007,16 @@ int dm_calculate_queue_limits(struct dm_table *table, | |||
996 | ti->type->iterate_devices(ti, dm_set_device_limits, | 1007 | ti->type->iterate_devices(ti, dm_set_device_limits, |
997 | &ti_limits); | 1008 | &ti_limits); |
998 | 1009 | ||
1010 | /* Set I/O hints portion of queue limits */ | ||
1011 | if (ti->type->io_hints) | ||
1012 | ti->type->io_hints(ti, &ti_limits); | ||
1013 | |||
999 | /* | 1014 | /* |
1000 | * Check each device area is consistent with the target's | 1015 | * Check each device area is consistent with the target's |
1001 | * overall queue limits. | 1016 | * overall queue limits. |
1002 | */ | 1017 | */ |
1003 | if (!ti->type->iterate_devices(ti, device_area_is_valid, | 1018 | if (ti->type->iterate_devices(ti, device_area_is_invalid, |
1004 | &ti_limits)) | 1019 | &ti_limits)) |
1005 | return -EINVAL; | 1020 | return -EINVAL; |
1006 | 1021 | ||
1007 | combine_limits: | 1022 | combine_limits: |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 8a311ea0d441..b4845b14740d 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -738,16 +738,22 @@ static void rq_completed(struct mapped_device *md, int run_queue) | |||
738 | dm_put(md); | 738 | dm_put(md); |
739 | } | 739 | } |
740 | 740 | ||
741 | static void free_rq_clone(struct request *clone) | ||
742 | { | ||
743 | struct dm_rq_target_io *tio = clone->end_io_data; | ||
744 | |||
745 | blk_rq_unprep_clone(clone); | ||
746 | free_rq_tio(tio); | ||
747 | } | ||
748 | |||
741 | static void dm_unprep_request(struct request *rq) | 749 | static void dm_unprep_request(struct request *rq) |
742 | { | 750 | { |
743 | struct request *clone = rq->special; | 751 | struct request *clone = rq->special; |
744 | struct dm_rq_target_io *tio = clone->end_io_data; | ||
745 | 752 | ||
746 | rq->special = NULL; | 753 | rq->special = NULL; |
747 | rq->cmd_flags &= ~REQ_DONTPREP; | 754 | rq->cmd_flags &= ~REQ_DONTPREP; |
748 | 755 | ||
749 | blk_rq_unprep_clone(clone); | 756 | free_rq_clone(clone); |
750 | free_rq_tio(tio); | ||
751 | } | 757 | } |
752 | 758 | ||
753 | /* | 759 | /* |
@@ -825,8 +831,7 @@ static void dm_end_request(struct request *clone, int error) | |||
825 | rq->sense_len = clone->sense_len; | 831 | rq->sense_len = clone->sense_len; |
826 | } | 832 | } |
827 | 833 | ||
828 | BUG_ON(clone->bio); | 834 | free_rq_clone(clone); |
829 | free_rq_tio(tio); | ||
830 | 835 | ||
831 | blk_end_request_all(rq, error); | 836 | blk_end_request_all(rq, error); |
832 | 837 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 5b98bea4ff9b..9dd872000cec 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -359,6 +359,7 @@ static mddev_t * mddev_find(dev_t unit) | |||
359 | else | 359 | else |
360 | new->md_minor = MINOR(unit) >> MdpMinorShift; | 360 | new->md_minor = MINOR(unit) >> MdpMinorShift; |
361 | 361 | ||
362 | mutex_init(&new->open_mutex); | ||
362 | mutex_init(&new->reconfig_mutex); | 363 | mutex_init(&new->reconfig_mutex); |
363 | INIT_LIST_HEAD(&new->disks); | 364 | INIT_LIST_HEAD(&new->disks); |
364 | INIT_LIST_HEAD(&new->all_mddevs); | 365 | INIT_LIST_HEAD(&new->all_mddevs); |
@@ -1974,17 +1975,14 @@ repeat: | |||
1974 | /* otherwise we have to go forward and ... */ | 1975 | /* otherwise we have to go forward and ... */ |
1975 | mddev->events ++; | 1976 | mddev->events ++; |
1976 | if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */ | 1977 | if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */ |
1977 | /* .. if the array isn't clean, insist on an odd 'events' */ | 1978 | /* .. if the array isn't clean, an 'even' event must also go |
1978 | if ((mddev->events&1)==0) { | 1979 | * to spares. */ |
1979 | mddev->events++; | 1980 | if ((mddev->events&1)==0) |
1980 | nospares = 0; | 1981 | nospares = 0; |
1981 | } | ||
1982 | } else { | 1982 | } else { |
1983 | /* otherwise insist on an even 'events' (for clean states) */ | 1983 | /* otherwise an 'odd' event must go to spares */ |
1984 | if ((mddev->events&1)) { | 1984 | if ((mddev->events&1)) |
1985 | mddev->events++; | ||
1986 | nospares = 0; | 1985 | nospares = 0; |
1987 | } | ||
1988 | } | 1986 | } |
1989 | } | 1987 | } |
1990 | 1988 | ||
@@ -3601,6 +3599,7 @@ max_sync_store(mddev_t *mddev, const char *buf, size_t len) | |||
3601 | if (max < mddev->resync_min) | 3599 | if (max < mddev->resync_min) |
3602 | return -EINVAL; | 3600 | return -EINVAL; |
3603 | if (max < mddev->resync_max && | 3601 | if (max < mddev->resync_max && |
3602 | mddev->ro == 0 && | ||
3604 | test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) | 3603 | test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) |
3605 | return -EBUSY; | 3604 | return -EBUSY; |
3606 | 3605 | ||
@@ -4304,12 +4303,11 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4304 | struct gendisk *disk = mddev->gendisk; | 4303 | struct gendisk *disk = mddev->gendisk; |
4305 | mdk_rdev_t *rdev; | 4304 | mdk_rdev_t *rdev; |
4306 | 4305 | ||
4306 | mutex_lock(&mddev->open_mutex); | ||
4307 | if (atomic_read(&mddev->openers) > is_open) { | 4307 | if (atomic_read(&mddev->openers) > is_open) { |
4308 | printk("md: %s still in use.\n",mdname(mddev)); | 4308 | printk("md: %s still in use.\n",mdname(mddev)); |
4309 | return -EBUSY; | 4309 | err = -EBUSY; |
4310 | } | 4310 | } else if (mddev->pers) { |
4311 | |||
4312 | if (mddev->pers) { | ||
4313 | 4311 | ||
4314 | if (mddev->sync_thread) { | 4312 | if (mddev->sync_thread) { |
4315 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 4313 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
@@ -4366,8 +4364,12 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4366 | if (mode == 1) | 4364 | if (mode == 1) |
4367 | set_disk_ro(disk, 1); | 4365 | set_disk_ro(disk, 1); |
4368 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 4366 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
4367 | err = 0; | ||
4369 | } | 4368 | } |
4370 | 4369 | out: | |
4370 | mutex_unlock(&mddev->open_mutex); | ||
4371 | if (err) | ||
4372 | return err; | ||
4371 | /* | 4373 | /* |
4372 | * Free resources if final stop | 4374 | * Free resources if final stop |
4373 | */ | 4375 | */ |
@@ -4433,7 +4435,6 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4433 | blk_integrity_unregister(disk); | 4435 | blk_integrity_unregister(disk); |
4434 | md_new_event(mddev); | 4436 | md_new_event(mddev); |
4435 | sysfs_notify_dirent(mddev->sysfs_state); | 4437 | sysfs_notify_dirent(mddev->sysfs_state); |
4436 | out: | ||
4437 | return err; | 4438 | return err; |
4438 | } | 4439 | } |
4439 | 4440 | ||
@@ -5518,12 +5519,12 @@ static int md_open(struct block_device *bdev, fmode_t mode) | |||
5518 | } | 5519 | } |
5519 | BUG_ON(mddev != bdev->bd_disk->private_data); | 5520 | BUG_ON(mddev != bdev->bd_disk->private_data); |
5520 | 5521 | ||
5521 | if ((err = mutex_lock_interruptible_nested(&mddev->reconfig_mutex, 1))) | 5522 | if ((err = mutex_lock_interruptible(&mddev->open_mutex))) |
5522 | goto out; | 5523 | goto out; |
5523 | 5524 | ||
5524 | err = 0; | 5525 | err = 0; |
5525 | atomic_inc(&mddev->openers); | 5526 | atomic_inc(&mddev->openers); |
5526 | mddev_unlock(mddev); | 5527 | mutex_unlock(&mddev->open_mutex); |
5527 | 5528 | ||
5528 | check_disk_change(bdev); | 5529 | check_disk_change(bdev); |
5529 | out: | 5530 | out: |
diff --git a/drivers/md/md.h b/drivers/md/md.h index 78f03168baf9..f8fc188bc762 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -223,6 +223,16 @@ struct mddev_s | |||
223 | * so we don't loop trying */ | 223 | * so we don't loop trying */ |
224 | 224 | ||
225 | int in_sync; /* know to not need resync */ | 225 | int in_sync; /* know to not need resync */ |
226 | /* 'open_mutex' avoids races between 'md_open' and 'do_md_stop', so | ||
227 | * that we are never stopping an array while it is open. | ||
228 | * 'reconfig_mutex' protects all other reconfiguration. | ||
229 | * These locks are separate due to conflicting interactions | ||
230 | * with bdev->bd_mutex. | ||
231 | * Lock ordering is: | ||
232 | * reconfig_mutex -> bd_mutex : e.g. do_md_run -> revalidate_disk | ||
233 | * bd_mutex -> open_mutex: e.g. __blkdev_get -> md_open | ||
234 | */ | ||
235 | struct mutex open_mutex; | ||
226 | struct mutex reconfig_mutex; | 236 | struct mutex reconfig_mutex; |
227 | atomic_t active; /* general refcount */ | 237 | atomic_t active; /* general refcount */ |
228 | atomic_t openers; /* number of active opens */ | 238 | atomic_t openers; /* number of active opens */ |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 2b521ee67dfa..b8a2c5dc67ba 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3785,7 +3785,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped | |||
3785 | conf->reshape_progress < raid5_size(mddev, 0, 0)) { | 3785 | conf->reshape_progress < raid5_size(mddev, 0, 0)) { |
3786 | sector_nr = raid5_size(mddev, 0, 0) | 3786 | sector_nr = raid5_size(mddev, 0, 0) |
3787 | - conf->reshape_progress; | 3787 | - conf->reshape_progress; |
3788 | } else if (mddev->delta_disks > 0 && | 3788 | } else if (mddev->delta_disks >= 0 && |
3789 | conf->reshape_progress > 0) | 3789 | conf->reshape_progress > 0) |
3790 | sector_nr = conf->reshape_progress; | 3790 | sector_nr = conf->reshape_progress; |
3791 | sector_div(sector_nr, new_data_disks); | 3791 | sector_div(sector_nr, new_data_disks); |
@@ -4509,7 +4509,26 @@ static int run(mddev_t *mddev) | |||
4509 | (old_disks-max_degraded)); | 4509 | (old_disks-max_degraded)); |
4510 | /* here_old is the first stripe that we might need to read | 4510 | /* here_old is the first stripe that we might need to read |
4511 | * from */ | 4511 | * from */ |
4512 | if (here_new >= here_old) { | 4512 | if (mddev->delta_disks == 0) { |
4513 | /* We cannot be sure it is safe to start an in-place | ||
4514 | * reshape. It is only safe if user-space if monitoring | ||
4515 | * and taking constant backups. | ||
4516 | * mdadm always starts a situation like this in | ||
4517 | * readonly mode so it can take control before | ||
4518 | * allowing any writes. So just check for that. | ||
4519 | */ | ||
4520 | if ((here_new * mddev->new_chunk_sectors != | ||
4521 | here_old * mddev->chunk_sectors) || | ||
4522 | mddev->ro == 0) { | ||
4523 | printk(KERN_ERR "raid5: in-place reshape must be started" | ||
4524 | " in read-only mode - aborting\n"); | ||
4525 | return -EINVAL; | ||
4526 | } | ||
4527 | } else if (mddev->delta_disks < 0 | ||
4528 | ? (here_new * mddev->new_chunk_sectors <= | ||
4529 | here_old * mddev->chunk_sectors) | ||
4530 | : (here_new * mddev->new_chunk_sectors >= | ||
4531 | here_old * mddev->chunk_sectors)) { | ||
4513 | /* Reading from the same stripe as writing to - bad */ | 4532 | /* Reading from the same stripe as writing to - bad */ |
4514 | printk(KERN_ERR "raid5: reshape_position too early for " | 4533 | printk(KERN_ERR "raid5: reshape_position too early for " |
4515 | "auto-recovery - aborting.\n"); | 4534 | "auto-recovery - aborting.\n"); |
@@ -5078,8 +5097,15 @@ static void raid5_finish_reshape(mddev_t *mddev) | |||
5078 | mddev->degraded--; | 5097 | mddev->degraded--; |
5079 | for (d = conf->raid_disks ; | 5098 | for (d = conf->raid_disks ; |
5080 | d < conf->raid_disks - mddev->delta_disks; | 5099 | d < conf->raid_disks - mddev->delta_disks; |
5081 | d++) | 5100 | d++) { |
5082 | raid5_remove_disk(mddev, d); | 5101 | mdk_rdev_t *rdev = conf->disks[d].rdev; |
5102 | if (rdev && raid5_remove_disk(mddev, d) == 0) { | ||
5103 | char nm[20]; | ||
5104 | sprintf(nm, "rd%d", rdev->raid_disk); | ||
5105 | sysfs_remove_link(&mddev->kobj, nm); | ||
5106 | rdev->raid_disk = -1; | ||
5107 | } | ||
5108 | } | ||
5083 | } | 5109 | } |
5084 | mddev->layout = conf->algorithm; | 5110 | mddev->layout = conf->algorithm; |
5085 | mddev->chunk_sectors = conf->chunk_sectors; | 5111 | mddev->chunk_sectors = conf->chunk_sectors; |
diff --git a/drivers/media/common/tuners/qt1010.c b/drivers/media/common/tuners/qt1010.c index 825aa1412e6f..9f5dba244cb8 100644 --- a/drivers/media/common/tuners/qt1010.c +++ b/drivers/media/common/tuners/qt1010.c | |||
@@ -64,24 +64,22 @@ static int qt1010_writereg(struct qt1010_priv *priv, u8 reg, u8 val) | |||
64 | /* dump all registers */ | 64 | /* dump all registers */ |
65 | static void qt1010_dump_regs(struct qt1010_priv *priv) | 65 | static void qt1010_dump_regs(struct qt1010_priv *priv) |
66 | { | 66 | { |
67 | char buf[52], buf2[4]; | ||
68 | u8 reg, val; | 67 | u8 reg, val; |
69 | 68 | ||
70 | for (reg = 0; ; reg++) { | 69 | for (reg = 0; ; reg++) { |
71 | if (reg % 16 == 0) { | 70 | if (reg % 16 == 0) { |
72 | if (reg) | 71 | if (reg) |
73 | printk("%s\n", buf); | 72 | printk(KERN_CONT "\n"); |
74 | sprintf(buf, "%02x: ", reg); | 73 | printk(KERN_DEBUG "%02x:", reg); |
75 | } | 74 | } |
76 | if (qt1010_readreg(priv, reg, &val) == 0) | 75 | if (qt1010_readreg(priv, reg, &val) == 0) |
77 | sprintf(buf2, "%02x ", val); | 76 | printk(KERN_CONT " %02x", val); |
78 | else | 77 | else |
79 | strcpy(buf2, "-- "); | 78 | printk(KERN_CONT " --"); |
80 | strcat(buf, buf2); | ||
81 | if (reg == 0x2f) | 79 | if (reg == 0x2f) |
82 | break; | 80 | break; |
83 | } | 81 | } |
84 | printk("%s\n", buf); | 82 | printk(KERN_CONT "\n"); |
85 | } | 83 | } |
86 | 84 | ||
87 | static int qt1010_set_params(struct dvb_frontend *fe, | 85 | static int qt1010_set_params(struct dvb_frontend *fe, |
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c index aa20ce8cc668..f270e605da83 100644 --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c | |||
@@ -1119,8 +1119,8 @@ static int xc2028_sleep(struct dvb_frontend *fe) | |||
1119 | struct xc2028_data *priv = fe->tuner_priv; | 1119 | struct xc2028_data *priv = fe->tuner_priv; |
1120 | int rc = 0; | 1120 | int rc = 0; |
1121 | 1121 | ||
1122 | /* Avoid firmware reload on slow devices */ | 1122 | /* Avoid firmware reload on slow devices or if PM disabled */ |
1123 | if (no_poweroff) | 1123 | if (no_poweroff || priv->ctrl.disable_power_mgmt) |
1124 | return 0; | 1124 | return 0; |
1125 | 1125 | ||
1126 | tuner_dbg("Putting xc2028/3028 into poweroff mode.\n"); | 1126 | tuner_dbg("Putting xc2028/3028 into poweroff mode.\n"); |
diff --git a/drivers/media/common/tuners/tuner-xc2028.h b/drivers/media/common/tuners/tuner-xc2028.h index 19de7928a74e..a90c35d50add 100644 --- a/drivers/media/common/tuners/tuner-xc2028.h +++ b/drivers/media/common/tuners/tuner-xc2028.h | |||
@@ -38,6 +38,7 @@ struct xc2028_ctrl { | |||
38 | unsigned int input1:1; | 38 | unsigned int input1:1; |
39 | unsigned int vhfbw7:1; | 39 | unsigned int vhfbw7:1; |
40 | unsigned int uhfbw8:1; | 40 | unsigned int uhfbw8:1; |
41 | unsigned int disable_power_mgmt:1; | ||
41 | unsigned int demod; | 42 | unsigned int demod; |
42 | enum firmware_type type:2; | 43 | enum firmware_type type:2; |
43 | }; | 44 | }; |
diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index 4cb31e7c13c2..26690dfb3260 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c | |||
@@ -81,7 +81,6 @@ static int af9015_rw_udev(struct usb_device *udev, struct req_t *req) | |||
81 | 81 | ||
82 | switch (req->cmd) { | 82 | switch (req->cmd) { |
83 | case GET_CONFIG: | 83 | case GET_CONFIG: |
84 | case BOOT: | ||
85 | case READ_MEMORY: | 84 | case READ_MEMORY: |
86 | case RECONNECT_USB: | 85 | case RECONNECT_USB: |
87 | case GET_IR_CODE: | 86 | case GET_IR_CODE: |
@@ -100,6 +99,7 @@ static int af9015_rw_udev(struct usb_device *udev, struct req_t *req) | |||
100 | case WRITE_VIRTUAL_MEMORY: | 99 | case WRITE_VIRTUAL_MEMORY: |
101 | case COPY_FIRMWARE: | 100 | case COPY_FIRMWARE: |
102 | case DOWNLOAD_FIRMWARE: | 101 | case DOWNLOAD_FIRMWARE: |
102 | case BOOT: | ||
103 | break; | 103 | break; |
104 | default: | 104 | default: |
105 | err("unknown command:%d", req->cmd); | 105 | err("unknown command:%d", req->cmd); |
diff --git a/drivers/media/dvb/frontends/cx22700.c b/drivers/media/dvb/frontends/cx22700.c index ace5cb17165d..fbd838eca268 100644 --- a/drivers/media/dvb/frontends/cx22700.c +++ b/drivers/media/dvb/frontends/cx22700.c | |||
@@ -380,7 +380,7 @@ struct dvb_frontend* cx22700_attach(const struct cx22700_config* config, | |||
380 | struct cx22700_state* state = NULL; | 380 | struct cx22700_state* state = NULL; |
381 | 381 | ||
382 | /* allocate memory for the internal state */ | 382 | /* allocate memory for the internal state */ |
383 | state = kmalloc(sizeof(struct cx22700_state), GFP_KERNEL); | 383 | state = kzalloc(sizeof(struct cx22700_state), GFP_KERNEL); |
384 | if (state == NULL) goto error; | 384 | if (state == NULL) goto error; |
385 | 385 | ||
386 | /* setup the state */ | 386 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/cx22702.c b/drivers/media/dvb/frontends/cx22702.c index 5d1abe34bddb..00b5c7e91d5d 100644 --- a/drivers/media/dvb/frontends/cx22702.c +++ b/drivers/media/dvb/frontends/cx22702.c | |||
@@ -580,7 +580,7 @@ struct dvb_frontend *cx22702_attach(const struct cx22702_config *config, | |||
580 | struct cx22702_state *state = NULL; | 580 | struct cx22702_state *state = NULL; |
581 | 581 | ||
582 | /* allocate memory for the internal state */ | 582 | /* allocate memory for the internal state */ |
583 | state = kmalloc(sizeof(struct cx22702_state), GFP_KERNEL); | 583 | state = kzalloc(sizeof(struct cx22702_state), GFP_KERNEL); |
584 | if (state == NULL) | 584 | if (state == NULL) |
585 | goto error; | 585 | goto error; |
586 | 586 | ||
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c index 87ae29db024f..ffbcfabd83f0 100644 --- a/drivers/media/dvb/frontends/cx24110.c +++ b/drivers/media/dvb/frontends/cx24110.c | |||
@@ -598,7 +598,7 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, | |||
598 | int ret; | 598 | int ret; |
599 | 599 | ||
600 | /* allocate memory for the internal state */ | 600 | /* allocate memory for the internal state */ |
601 | state = kmalloc(sizeof(struct cx24110_state), GFP_KERNEL); | 601 | state = kzalloc(sizeof(struct cx24110_state), GFP_KERNEL); |
602 | if (state == NULL) goto error; | 602 | if (state == NULL) goto error; |
603 | 603 | ||
604 | /* setup the state */ | 604 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/dvb_dummy_fe.c b/drivers/media/dvb/frontends/dvb_dummy_fe.c index db8a937cc630..a7fc7e53a551 100644 --- a/drivers/media/dvb/frontends/dvb_dummy_fe.c +++ b/drivers/media/dvb/frontends/dvb_dummy_fe.c | |||
@@ -117,7 +117,7 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void) | |||
117 | struct dvb_dummy_fe_state* state = NULL; | 117 | struct dvb_dummy_fe_state* state = NULL; |
118 | 118 | ||
119 | /* allocate memory for the internal state */ | 119 | /* allocate memory for the internal state */ |
120 | state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); | 120 | state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); |
121 | if (state == NULL) goto error; | 121 | if (state == NULL) goto error; |
122 | 122 | ||
123 | /* create dvb_frontend */ | 123 | /* create dvb_frontend */ |
@@ -137,7 +137,7 @@ struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void) | |||
137 | struct dvb_dummy_fe_state* state = NULL; | 137 | struct dvb_dummy_fe_state* state = NULL; |
138 | 138 | ||
139 | /* allocate memory for the internal state */ | 139 | /* allocate memory for the internal state */ |
140 | state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); | 140 | state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); |
141 | if (state == NULL) goto error; | 141 | if (state == NULL) goto error; |
142 | 142 | ||
143 | /* create dvb_frontend */ | 143 | /* create dvb_frontend */ |
@@ -157,7 +157,7 @@ struct dvb_frontend *dvb_dummy_fe_qam_attach(void) | |||
157 | struct dvb_dummy_fe_state* state = NULL; | 157 | struct dvb_dummy_fe_state* state = NULL; |
158 | 158 | ||
159 | /* allocate memory for the internal state */ | 159 | /* allocate memory for the internal state */ |
160 | state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); | 160 | state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); |
161 | if (state == NULL) goto error; | 161 | if (state == NULL) goto error; |
162 | 162 | ||
163 | /* create dvb_frontend */ | 163 | /* create dvb_frontend */ |
diff --git a/drivers/media/dvb/frontends/l64781.c b/drivers/media/dvb/frontends/l64781.c index e1e70e9e0cb9..3051b64aa17c 100644 --- a/drivers/media/dvb/frontends/l64781.c +++ b/drivers/media/dvb/frontends/l64781.c | |||
@@ -501,7 +501,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config, | |||
501 | { .addr = config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; | 501 | { .addr = config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; |
502 | 502 | ||
503 | /* allocate memory for the internal state */ | 503 | /* allocate memory for the internal state */ |
504 | state = kmalloc(sizeof(struct l64781_state), GFP_KERNEL); | 504 | state = kzalloc(sizeof(struct l64781_state), GFP_KERNEL); |
505 | if (state == NULL) goto error; | 505 | if (state == NULL) goto error; |
506 | 506 | ||
507 | /* setup the state */ | 507 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/lgs8gl5.c b/drivers/media/dvb/frontends/lgs8gl5.c index 855852fddf22..bb37ed289a05 100644 --- a/drivers/media/dvb/frontends/lgs8gl5.c +++ b/drivers/media/dvb/frontends/lgs8gl5.c | |||
@@ -387,7 +387,7 @@ lgs8gl5_attach(const struct lgs8gl5_config *config, struct i2c_adapter *i2c) | |||
387 | dprintk("%s\n", __func__); | 387 | dprintk("%s\n", __func__); |
388 | 388 | ||
389 | /* Allocate memory for the internal state */ | 389 | /* Allocate memory for the internal state */ |
390 | state = kmalloc(sizeof(struct lgs8gl5_state), GFP_KERNEL); | 390 | state = kzalloc(sizeof(struct lgs8gl5_state), GFP_KERNEL); |
391 | if (state == NULL) | 391 | if (state == NULL) |
392 | goto error; | 392 | goto error; |
393 | 393 | ||
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c index a621f727935f..f69daaac78c9 100644 --- a/drivers/media/dvb/frontends/mt312.c +++ b/drivers/media/dvb/frontends/mt312.c | |||
@@ -782,7 +782,7 @@ struct dvb_frontend *mt312_attach(const struct mt312_config *config, | |||
782 | struct mt312_state *state = NULL; | 782 | struct mt312_state *state = NULL; |
783 | 783 | ||
784 | /* allocate memory for the internal state */ | 784 | /* allocate memory for the internal state */ |
785 | state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL); | 785 | state = kzalloc(sizeof(struct mt312_state), GFP_KERNEL); |
786 | if (state == NULL) | 786 | if (state == NULL) |
787 | goto error; | 787 | goto error; |
788 | 788 | ||
diff --git a/drivers/media/dvb/frontends/nxt6000.c b/drivers/media/dvb/frontends/nxt6000.c index 0eef22dbf8a0..a763ec756f7f 100644 --- a/drivers/media/dvb/frontends/nxt6000.c +++ b/drivers/media/dvb/frontends/nxt6000.c | |||
@@ -545,7 +545,7 @@ struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, | |||
545 | struct nxt6000_state* state = NULL; | 545 | struct nxt6000_state* state = NULL; |
546 | 546 | ||
547 | /* allocate memory for the internal state */ | 547 | /* allocate memory for the internal state */ |
548 | state = kmalloc(sizeof(struct nxt6000_state), GFP_KERNEL); | 548 | state = kzalloc(sizeof(struct nxt6000_state), GFP_KERNEL); |
549 | if (state == NULL) goto error; | 549 | if (state == NULL) goto error; |
550 | 550 | ||
551 | /* setup the state */ | 551 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c index 8133ea3cddd7..38e67accb8c3 100644 --- a/drivers/media/dvb/frontends/or51132.c +++ b/drivers/media/dvb/frontends/or51132.c | |||
@@ -562,7 +562,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config, | |||
562 | struct or51132_state* state = NULL; | 562 | struct or51132_state* state = NULL; |
563 | 563 | ||
564 | /* Allocate memory for the internal state */ | 564 | /* Allocate memory for the internal state */ |
565 | state = kmalloc(sizeof(struct or51132_state), GFP_KERNEL); | 565 | state = kzalloc(sizeof(struct or51132_state), GFP_KERNEL); |
566 | if (state == NULL) | 566 | if (state == NULL) |
567 | return NULL; | 567 | return NULL; |
568 | 568 | ||
diff --git a/drivers/media/dvb/frontends/or51211.c b/drivers/media/dvb/frontends/or51211.c index 16cf2fdd5d7d..c709ce6771c8 100644 --- a/drivers/media/dvb/frontends/or51211.c +++ b/drivers/media/dvb/frontends/or51211.c | |||
@@ -527,7 +527,7 @@ struct dvb_frontend* or51211_attach(const struct or51211_config* config, | |||
527 | struct or51211_state* state = NULL; | 527 | struct or51211_state* state = NULL; |
528 | 528 | ||
529 | /* Allocate memory for the internal state */ | 529 | /* Allocate memory for the internal state */ |
530 | state = kmalloc(sizeof(struct or51211_state), GFP_KERNEL); | 530 | state = kzalloc(sizeof(struct or51211_state), GFP_KERNEL); |
531 | if (state == NULL) | 531 | if (state == NULL) |
532 | return NULL; | 532 | return NULL; |
533 | 533 | ||
diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c index 3e08d985d6e5..fb3011518427 100644 --- a/drivers/media/dvb/frontends/s5h1409.c +++ b/drivers/media/dvb/frontends/s5h1409.c | |||
@@ -796,7 +796,7 @@ struct dvb_frontend *s5h1409_attach(const struct s5h1409_config *config, | |||
796 | u16 reg; | 796 | u16 reg; |
797 | 797 | ||
798 | /* allocate memory for the internal state */ | 798 | /* allocate memory for the internal state */ |
799 | state = kmalloc(sizeof(struct s5h1409_state), GFP_KERNEL); | 799 | state = kzalloc(sizeof(struct s5h1409_state), GFP_KERNEL); |
800 | if (state == NULL) | 800 | if (state == NULL) |
801 | goto error; | 801 | goto error; |
802 | 802 | ||
diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c index 66e2dd6d6fe4..d8adf1e32019 100644 --- a/drivers/media/dvb/frontends/s5h1411.c +++ b/drivers/media/dvb/frontends/s5h1411.c | |||
@@ -844,7 +844,7 @@ struct dvb_frontend *s5h1411_attach(const struct s5h1411_config *config, | |||
844 | u16 reg; | 844 | u16 reg; |
845 | 845 | ||
846 | /* allocate memory for the internal state */ | 846 | /* allocate memory for the internal state */ |
847 | state = kmalloc(sizeof(struct s5h1411_state), GFP_KERNEL); | 847 | state = kzalloc(sizeof(struct s5h1411_state), GFP_KERNEL); |
848 | if (state == NULL) | 848 | if (state == NULL) |
849 | goto error; | 849 | goto error; |
850 | 850 | ||
diff --git a/drivers/media/dvb/frontends/si21xx.c b/drivers/media/dvb/frontends/si21xx.c index 0bd16af8a6cd..9552a22ccffb 100644 --- a/drivers/media/dvb/frontends/si21xx.c +++ b/drivers/media/dvb/frontends/si21xx.c | |||
@@ -928,7 +928,7 @@ struct dvb_frontend *si21xx_attach(const struct si21xx_config *config, | |||
928 | dprintk("%s\n", __func__); | 928 | dprintk("%s\n", __func__); |
929 | 929 | ||
930 | /* allocate memory for the internal state */ | 930 | /* allocate memory for the internal state */ |
931 | state = kmalloc(sizeof(struct si21xx_state), GFP_KERNEL); | 931 | state = kzalloc(sizeof(struct si21xx_state), GFP_KERNEL); |
932 | if (state == NULL) | 932 | if (state == NULL) |
933 | goto error; | 933 | goto error; |
934 | 934 | ||
diff --git a/drivers/media/dvb/frontends/sp8870.c b/drivers/media/dvb/frontends/sp8870.c index 1c9a9b4051b9..b85eb60a893e 100644 --- a/drivers/media/dvb/frontends/sp8870.c +++ b/drivers/media/dvb/frontends/sp8870.c | |||
@@ -557,7 +557,7 @@ struct dvb_frontend* sp8870_attach(const struct sp8870_config* config, | |||
557 | struct sp8870_state* state = NULL; | 557 | struct sp8870_state* state = NULL; |
558 | 558 | ||
559 | /* allocate memory for the internal state */ | 559 | /* allocate memory for the internal state */ |
560 | state = kmalloc(sizeof(struct sp8870_state), GFP_KERNEL); | 560 | state = kzalloc(sizeof(struct sp8870_state), GFP_KERNEL); |
561 | if (state == NULL) goto error; | 561 | if (state == NULL) goto error; |
562 | 562 | ||
563 | /* setup the state */ | 563 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/sp887x.c b/drivers/media/dvb/frontends/sp887x.c index 559509ab4dab..4a7c3d842608 100644 --- a/drivers/media/dvb/frontends/sp887x.c +++ b/drivers/media/dvb/frontends/sp887x.c | |||
@@ -557,7 +557,7 @@ struct dvb_frontend* sp887x_attach(const struct sp887x_config* config, | |||
557 | struct sp887x_state* state = NULL; | 557 | struct sp887x_state* state = NULL; |
558 | 558 | ||
559 | /* allocate memory for the internal state */ | 559 | /* allocate memory for the internal state */ |
560 | state = kmalloc(sizeof(struct sp887x_state), GFP_KERNEL); | 560 | state = kzalloc(sizeof(struct sp887x_state), GFP_KERNEL); |
561 | if (state == NULL) goto error; | 561 | if (state == NULL) goto error; |
562 | 562 | ||
563 | /* setup the state */ | 563 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/stv0288.c b/drivers/media/dvb/frontends/stv0288.c index ff1194de34c0..2930a5d6768a 100644 --- a/drivers/media/dvb/frontends/stv0288.c +++ b/drivers/media/dvb/frontends/stv0288.c | |||
@@ -570,7 +570,7 @@ struct dvb_frontend *stv0288_attach(const struct stv0288_config *config, | |||
570 | int id; | 570 | int id; |
571 | 571 | ||
572 | /* allocate memory for the internal state */ | 572 | /* allocate memory for the internal state */ |
573 | state = kmalloc(sizeof(struct stv0288_state), GFP_KERNEL); | 573 | state = kzalloc(sizeof(struct stv0288_state), GFP_KERNEL); |
574 | if (state == NULL) | 574 | if (state == NULL) |
575 | goto error; | 575 | goto error; |
576 | 576 | ||
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c index 62caf802ed99..4fd7479bb62b 100644 --- a/drivers/media/dvb/frontends/stv0297.c +++ b/drivers/media/dvb/frontends/stv0297.c | |||
@@ -663,7 +663,7 @@ struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, | |||
663 | struct stv0297_state *state = NULL; | 663 | struct stv0297_state *state = NULL; |
664 | 664 | ||
665 | /* allocate memory for the internal state */ | 665 | /* allocate memory for the internal state */ |
666 | state = kmalloc(sizeof(struct stv0297_state), GFP_KERNEL); | 666 | state = kzalloc(sizeof(struct stv0297_state), GFP_KERNEL); |
667 | if (state == NULL) | 667 | if (state == NULL) |
668 | goto error; | 668 | goto error; |
669 | 669 | ||
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index 6c1cb1973c6e..968874469726 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c | |||
@@ -667,7 +667,7 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, | |||
667 | int id; | 667 | int id; |
668 | 668 | ||
669 | /* allocate memory for the internal state */ | 669 | /* allocate memory for the internal state */ |
670 | state = kmalloc(sizeof(struct stv0299_state), GFP_KERNEL); | 670 | state = kzalloc(sizeof(struct stv0299_state), GFP_KERNEL); |
671 | if (state == NULL) goto error; | 671 | if (state == NULL) goto error; |
672 | 672 | ||
673 | /* setup the state */ | 673 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c index f648fdb64bb7..f5d7b3277a2f 100644 --- a/drivers/media/dvb/frontends/tda10021.c +++ b/drivers/media/dvb/frontends/tda10021.c | |||
@@ -413,7 +413,7 @@ struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config, | |||
413 | u8 id; | 413 | u8 id; |
414 | 414 | ||
415 | /* allocate memory for the internal state */ | 415 | /* allocate memory for the internal state */ |
416 | state = kmalloc(sizeof(struct tda10021_state), GFP_KERNEL); | 416 | state = kzalloc(sizeof(struct tda10021_state), GFP_KERNEL); |
417 | if (state == NULL) goto error; | 417 | if (state == NULL) goto error; |
418 | 418 | ||
419 | /* setup the state */ | 419 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/tda10048.c b/drivers/media/dvb/frontends/tda10048.c index cc8862ce4aae..4e2a7c8b2f62 100644 --- a/drivers/media/dvb/frontends/tda10048.c +++ b/drivers/media/dvb/frontends/tda10048.c | |||
@@ -1095,7 +1095,7 @@ struct dvb_frontend *tda10048_attach(const struct tda10048_config *config, | |||
1095 | dprintk(1, "%s()\n", __func__); | 1095 | dprintk(1, "%s()\n", __func__); |
1096 | 1096 | ||
1097 | /* allocate memory for the internal state */ | 1097 | /* allocate memory for the internal state */ |
1098 | state = kmalloc(sizeof(struct tda10048_state), GFP_KERNEL); | 1098 | state = kzalloc(sizeof(struct tda10048_state), GFP_KERNEL); |
1099 | if (state == NULL) | 1099 | if (state == NULL) |
1100 | goto error; | 1100 | goto error; |
1101 | 1101 | ||
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c index 4981cef8b444..f2a8abe0a243 100644 --- a/drivers/media/dvb/frontends/tda1004x.c +++ b/drivers/media/dvb/frontends/tda1004x.c | |||
@@ -1269,7 +1269,7 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, | |||
1269 | int id; | 1269 | int id; |
1270 | 1270 | ||
1271 | /* allocate memory for the internal state */ | 1271 | /* allocate memory for the internal state */ |
1272 | state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); | 1272 | state = kzalloc(sizeof(struct tda1004x_state), GFP_KERNEL); |
1273 | if (!state) { | 1273 | if (!state) { |
1274 | printk(KERN_ERR "Can't alocate memory for tda10045 state\n"); | 1274 | printk(KERN_ERR "Can't alocate memory for tda10045 state\n"); |
1275 | return NULL; | 1275 | return NULL; |
@@ -1339,7 +1339,7 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, | |||
1339 | int id; | 1339 | int id; |
1340 | 1340 | ||
1341 | /* allocate memory for the internal state */ | 1341 | /* allocate memory for the internal state */ |
1342 | state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); | 1342 | state = kzalloc(sizeof(struct tda1004x_state), GFP_KERNEL); |
1343 | if (!state) { | 1343 | if (!state) { |
1344 | printk(KERN_ERR "Can't alocate memory for tda10046 state\n"); | 1344 | printk(KERN_ERR "Can't alocate memory for tda10046 state\n"); |
1345 | return NULL; | 1345 | return NULL; |
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c index a17ce3c4ad86..f2c8faac6f36 100644 --- a/drivers/media/dvb/frontends/tda10086.c +++ b/drivers/media/dvb/frontends/tda10086.c | |||
@@ -745,7 +745,7 @@ struct dvb_frontend* tda10086_attach(const struct tda10086_config* config, | |||
745 | dprintk ("%s\n", __func__); | 745 | dprintk ("%s\n", __func__); |
746 | 746 | ||
747 | /* allocate memory for the internal state */ | 747 | /* allocate memory for the internal state */ |
748 | state = kmalloc(sizeof(struct tda10086_state), GFP_KERNEL); | 748 | state = kzalloc(sizeof(struct tda10086_state), GFP_KERNEL); |
749 | if (!state) | 749 | if (!state) |
750 | return NULL; | 750 | return NULL; |
751 | 751 | ||
diff --git a/drivers/media/dvb/frontends/tda8083.c b/drivers/media/dvb/frontends/tda8083.c index 5b843b2e67e8..9369f7442f27 100644 --- a/drivers/media/dvb/frontends/tda8083.c +++ b/drivers/media/dvb/frontends/tda8083.c | |||
@@ -417,7 +417,7 @@ struct dvb_frontend* tda8083_attach(const struct tda8083_config* config, | |||
417 | struct tda8083_state* state = NULL; | 417 | struct tda8083_state* state = NULL; |
418 | 418 | ||
419 | /* allocate memory for the internal state */ | 419 | /* allocate memory for the internal state */ |
420 | state = kmalloc(sizeof(struct tda8083_state), GFP_KERNEL); | 420 | state = kzalloc(sizeof(struct tda8083_state), GFP_KERNEL); |
421 | if (state == NULL) goto error; | 421 | if (state == NULL) goto error; |
422 | 422 | ||
423 | /* setup the state */ | 423 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c index a184597f1d9b..6e78e4865515 100644 --- a/drivers/media/dvb/frontends/ves1820.c +++ b/drivers/media/dvb/frontends/ves1820.c | |||
@@ -374,7 +374,7 @@ struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, | |||
374 | struct ves1820_state* state = NULL; | 374 | struct ves1820_state* state = NULL; |
375 | 375 | ||
376 | /* allocate memory for the internal state */ | 376 | /* allocate memory for the internal state */ |
377 | state = kmalloc(sizeof(struct ves1820_state), GFP_KERNEL); | 377 | state = kzalloc(sizeof(struct ves1820_state), GFP_KERNEL); |
378 | if (state == NULL) | 378 | if (state == NULL) |
379 | goto error; | 379 | goto error; |
380 | 380 | ||
diff --git a/drivers/media/dvb/frontends/ves1x93.c b/drivers/media/dvb/frontends/ves1x93.c index bd558960bd87..8d7854c2fb0c 100644 --- a/drivers/media/dvb/frontends/ves1x93.c +++ b/drivers/media/dvb/frontends/ves1x93.c | |||
@@ -456,7 +456,7 @@ struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, | |||
456 | u8 identity; | 456 | u8 identity; |
457 | 457 | ||
458 | /* allocate memory for the internal state */ | 458 | /* allocate memory for the internal state */ |
459 | state = kmalloc(sizeof(struct ves1x93_state), GFP_KERNEL); | 459 | state = kzalloc(sizeof(struct ves1x93_state), GFP_KERNEL); |
460 | if (state == NULL) goto error; | 460 | if (state == NULL) goto error; |
461 | 461 | ||
462 | /* setup the state */ | 462 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c index 148b6f7f6cb2..66f5c1fb3074 100644 --- a/drivers/media/dvb/frontends/zl10353.c +++ b/drivers/media/dvb/frontends/zl10353.c | |||
@@ -98,7 +98,6 @@ static int zl10353_read_register(struct zl10353_state *state, u8 reg) | |||
98 | static void zl10353_dump_regs(struct dvb_frontend *fe) | 98 | static void zl10353_dump_regs(struct dvb_frontend *fe) |
99 | { | 99 | { |
100 | struct zl10353_state *state = fe->demodulator_priv; | 100 | struct zl10353_state *state = fe->demodulator_priv; |
101 | char buf[52], buf2[4]; | ||
102 | int ret; | 101 | int ret; |
103 | u8 reg; | 102 | u8 reg; |
104 | 103 | ||
@@ -106,19 +105,18 @@ static void zl10353_dump_regs(struct dvb_frontend *fe) | |||
106 | for (reg = 0; ; reg++) { | 105 | for (reg = 0; ; reg++) { |
107 | if (reg % 16 == 0) { | 106 | if (reg % 16 == 0) { |
108 | if (reg) | 107 | if (reg) |
109 | printk(KERN_DEBUG "%s\n", buf); | 108 | printk(KERN_CONT "\n"); |
110 | sprintf(buf, "%02x: ", reg); | 109 | printk(KERN_DEBUG "%02x:", reg); |
111 | } | 110 | } |
112 | ret = zl10353_read_register(state, reg); | 111 | ret = zl10353_read_register(state, reg); |
113 | if (ret >= 0) | 112 | if (ret >= 0) |
114 | sprintf(buf2, "%02x ", (u8)ret); | 113 | printk(KERN_CONT " %02x", (u8)ret); |
115 | else | 114 | else |
116 | strcpy(buf2, "-- "); | 115 | printk(KERN_CONT " --"); |
117 | strcat(buf, buf2); | ||
118 | if (reg == 0xff) | 116 | if (reg == 0xff) |
119 | break; | 117 | break; |
120 | } | 118 | } |
121 | printk(KERN_DEBUG "%s\n", buf); | 119 | printk(KERN_CONT "\n"); |
122 | } | 120 | } |
123 | 121 | ||
124 | static void zl10353_calc_nominal_rate(struct dvb_frontend *fe, | 122 | static void zl10353_calc_nominal_rate(struct dvb_frontend *fe, |
diff --git a/drivers/media/dvb/siano/Kconfig b/drivers/media/dvb/siano/Kconfig index dd863f261672..8c1aed77ea30 100644 --- a/drivers/media/dvb/siano/Kconfig +++ b/drivers/media/dvb/siano/Kconfig | |||
@@ -2,25 +2,33 @@ | |||
2 | # Siano Mobile Silicon Digital TV device configuration | 2 | # Siano Mobile Silicon Digital TV device configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | config DVB_SIANO_SMS1XXX | 5 | config SMS_SIANO_MDTV |
6 | tristate "Siano SMS1XXX USB dongle support" | 6 | tristate "Siano SMS1xxx based MDTV receiver" |
7 | depends on DVB_CORE && USB | 7 | depends on DVB_CORE && INPUT |
8 | ---help--- | 8 | ---help--- |
9 | Choose Y here if you have a USB dongle with a SMS1XXX chipset. | 9 | Choose Y or M here if you have MDTV receiver with a Siano chipset. |
10 | 10 | ||
11 | To compile this driver as a module, choose M here: the | 11 | To compile this driver as a module, choose M here |
12 | module will be called sms1xxx. | 12 | (The module will be called smsmdtv). |
13 | 13 | ||
14 | config DVB_SIANO_SMS1XXX_SMS_IDS | 14 | Further documentation on this driver can be found on the WWW |
15 | bool "Enable support for Siano Mobile Silicon default USB IDs" | 15 | at http://www.siano-ms.com/ |
16 | depends on DVB_SIANO_SMS1XXX | 16 | |
17 | default y | 17 | if SMS_SIANO_MDTV |
18 | ---help--- | 18 | menu "Siano module components" |
19 | Choose Y here if you have a USB dongle with a SMS1XXX chipset | ||
20 | that uses Siano Mobile Silicon's default usb vid:pid. | ||
21 | 19 | ||
22 | Choose N here if you would prefer to use Siano's external driver. | 20 | # Hardware interfaces support |
23 | 21 | ||
24 | Further documentation on this driver can be found on the WWW at | 22 | config SMS_USB_DRV |
25 | <http://www.siano-ms.com/>. | 23 | tristate "USB interface support" |
24 | depends on DVB_CORE && USB | ||
25 | ---help--- | ||
26 | Choose if you would like to have Siano's support for USB interface | ||
26 | 27 | ||
28 | config SMS_SDIO_DRV | ||
29 | tristate "SDIO interface support" | ||
30 | depends on DVB_CORE && MMC | ||
31 | ---help--- | ||
32 | Choose if you would like to have Siano's support for SDIO interface | ||
33 | endmenu | ||
34 | endif # SMS_SIANO_MDTV | ||
diff --git a/drivers/media/dvb/siano/Makefile b/drivers/media/dvb/siano/Makefile index c6644d909433..c54140b5ab5a 100644 --- a/drivers/media/dvb/siano/Makefile +++ b/drivers/media/dvb/siano/Makefile | |||
@@ -1,8 +1,9 @@ | |||
1 | sms1xxx-objs := smscoreapi.o sms-cards.o smsendian.o smsir.o | ||
2 | 1 | ||
3 | obj-$(CONFIG_DVB_SIANO_SMS1XXX) += sms1xxx.o | 2 | smsmdtv-objs := smscoreapi.o sms-cards.o smsendian.o smsir.o |
4 | obj-$(CONFIG_DVB_SIANO_SMS1XXX) += smsusb.o | 3 | |
5 | obj-$(CONFIG_DVB_SIANO_SMS1XXX) += smsdvb.o | 4 | obj-$(CONFIG_SMS_SIANO_MDTV) += smsmdtv.o smsdvb.o |
5 | obj-$(CONFIG_SMS_USB_DRV) += smsusb.o | ||
6 | obj-$(CONFIG_SMS_SDIO_DRV) += smssdio.o | ||
6 | 7 | ||
7 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core | 8 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core |
8 | 9 | ||
diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c index d8b15d583bde..0420e2885e75 100644 --- a/drivers/media/dvb/siano/sms-cards.c +++ b/drivers/media/dvb/siano/sms-cards.c | |||
@@ -116,99 +116,21 @@ static inline void sms_gpio_assign_11xx_default_led_config( | |||
116 | 116 | ||
117 | int sms_board_event(struct smscore_device_t *coredev, | 117 | int sms_board_event(struct smscore_device_t *coredev, |
118 | enum SMS_BOARD_EVENTS gevent) { | 118 | enum SMS_BOARD_EVENTS gevent) { |
119 | int board_id = smscore_get_board_id(coredev); | ||
120 | struct sms_board *board = sms_get_board(board_id); | ||
121 | struct smscore_gpio_config MyGpioConfig; | 119 | struct smscore_gpio_config MyGpioConfig; |
122 | 120 | ||
123 | sms_gpio_assign_11xx_default_led_config(&MyGpioConfig); | 121 | sms_gpio_assign_11xx_default_led_config(&MyGpioConfig); |
124 | 122 | ||
125 | switch (gevent) { | 123 | switch (gevent) { |
126 | case BOARD_EVENT_POWER_INIT: /* including hotplug */ | 124 | case BOARD_EVENT_POWER_INIT: /* including hotplug */ |
127 | switch (board_id) { | ||
128 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
129 | /* set I/O and turn off all LEDs */ | ||
130 | smscore_gpio_configure(coredev, | ||
131 | board->board_cfg.leds_power, | ||
132 | &MyGpioConfig); | ||
133 | smscore_gpio_set_level(coredev, | ||
134 | board->board_cfg.leds_power, 0); | ||
135 | smscore_gpio_configure(coredev, board->board_cfg.led0, | ||
136 | &MyGpioConfig); | ||
137 | smscore_gpio_set_level(coredev, | ||
138 | board->board_cfg.led0, 0); | ||
139 | smscore_gpio_configure(coredev, board->board_cfg.led1, | ||
140 | &MyGpioConfig); | ||
141 | smscore_gpio_set_level(coredev, | ||
142 | board->board_cfg.led1, 0); | ||
143 | break; | ||
144 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
145 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
146 | /* set I/O and turn off LNA */ | ||
147 | smscore_gpio_configure(coredev, | ||
148 | board->board_cfg.foreign_lna0_ctrl, | ||
149 | &MyGpioConfig); | ||
150 | smscore_gpio_set_level(coredev, | ||
151 | board->board_cfg.foreign_lna0_ctrl, | ||
152 | 0); | ||
153 | break; | ||
154 | } | ||
155 | break; /* BOARD_EVENT_BIND */ | 125 | break; /* BOARD_EVENT_BIND */ |
156 | 126 | ||
157 | case BOARD_EVENT_POWER_SUSPEND: | 127 | case BOARD_EVENT_POWER_SUSPEND: |
158 | switch (board_id) { | ||
159 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
160 | smscore_gpio_set_level(coredev, | ||
161 | board->board_cfg.leds_power, 0); | ||
162 | smscore_gpio_set_level(coredev, | ||
163 | board->board_cfg.led0, 0); | ||
164 | smscore_gpio_set_level(coredev, | ||
165 | board->board_cfg.led1, 0); | ||
166 | break; | ||
167 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
168 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
169 | smscore_gpio_set_level(coredev, | ||
170 | board->board_cfg.foreign_lna0_ctrl, | ||
171 | 0); | ||
172 | break; | ||
173 | } | ||
174 | break; /* BOARD_EVENT_POWER_SUSPEND */ | 128 | break; /* BOARD_EVENT_POWER_SUSPEND */ |
175 | 129 | ||
176 | case BOARD_EVENT_POWER_RESUME: | 130 | case BOARD_EVENT_POWER_RESUME: |
177 | switch (board_id) { | ||
178 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
179 | smscore_gpio_set_level(coredev, | ||
180 | board->board_cfg.leds_power, 1); | ||
181 | smscore_gpio_set_level(coredev, | ||
182 | board->board_cfg.led0, 1); | ||
183 | smscore_gpio_set_level(coredev, | ||
184 | board->board_cfg.led1, 0); | ||
185 | break; | ||
186 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
187 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
188 | smscore_gpio_set_level(coredev, | ||
189 | board->board_cfg.foreign_lna0_ctrl, | ||
190 | 1); | ||
191 | break; | ||
192 | } | ||
193 | break; /* BOARD_EVENT_POWER_RESUME */ | 131 | break; /* BOARD_EVENT_POWER_RESUME */ |
194 | 132 | ||
195 | case BOARD_EVENT_BIND: | 133 | case BOARD_EVENT_BIND: |
196 | switch (board_id) { | ||
197 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
198 | smscore_gpio_set_level(coredev, | ||
199 | board->board_cfg.leds_power, 1); | ||
200 | smscore_gpio_set_level(coredev, | ||
201 | board->board_cfg.led0, 1); | ||
202 | smscore_gpio_set_level(coredev, | ||
203 | board->board_cfg.led1, 0); | ||
204 | break; | ||
205 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
206 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
207 | smscore_gpio_set_level(coredev, | ||
208 | board->board_cfg.foreign_lna0_ctrl, | ||
209 | 1); | ||
210 | break; | ||
211 | } | ||
212 | break; /* BOARD_EVENT_BIND */ | 134 | break; /* BOARD_EVENT_BIND */ |
213 | 135 | ||
214 | case BOARD_EVENT_SCAN_PROG: | 136 | case BOARD_EVENT_SCAN_PROG: |
@@ -218,20 +140,8 @@ int sms_board_event(struct smscore_device_t *coredev, | |||
218 | case BOARD_EVENT_EMERGENCY_WARNING_SIGNAL: | 140 | case BOARD_EVENT_EMERGENCY_WARNING_SIGNAL: |
219 | break; /* BOARD_EVENT_EMERGENCY_WARNING_SIGNAL */ | 141 | break; /* BOARD_EVENT_EMERGENCY_WARNING_SIGNAL */ |
220 | case BOARD_EVENT_FE_LOCK: | 142 | case BOARD_EVENT_FE_LOCK: |
221 | switch (board_id) { | ||
222 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
223 | smscore_gpio_set_level(coredev, | ||
224 | board->board_cfg.led1, 1); | ||
225 | break; | ||
226 | } | ||
227 | break; /* BOARD_EVENT_FE_LOCK */ | 143 | break; /* BOARD_EVENT_FE_LOCK */ |
228 | case BOARD_EVENT_FE_UNLOCK: | 144 | case BOARD_EVENT_FE_UNLOCK: |
229 | switch (board_id) { | ||
230 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
231 | smscore_gpio_set_level(coredev, | ||
232 | board->board_cfg.led1, 0); | ||
233 | break; | ||
234 | } | ||
235 | break; /* BOARD_EVENT_FE_UNLOCK */ | 145 | break; /* BOARD_EVENT_FE_UNLOCK */ |
236 | case BOARD_EVENT_DEMOD_LOCK: | 146 | case BOARD_EVENT_DEMOD_LOCK: |
237 | break; /* BOARD_EVENT_DEMOD_LOCK */ | 147 | break; /* BOARD_EVENT_DEMOD_LOCK */ |
@@ -248,20 +158,8 @@ int sms_board_event(struct smscore_device_t *coredev, | |||
248 | case BOARD_EVENT_RECEPTION_LOST_0: | 158 | case BOARD_EVENT_RECEPTION_LOST_0: |
249 | break; /* BOARD_EVENT_RECEPTION_LOST_0 */ | 159 | break; /* BOARD_EVENT_RECEPTION_LOST_0 */ |
250 | case BOARD_EVENT_MULTIPLEX_OK: | 160 | case BOARD_EVENT_MULTIPLEX_OK: |
251 | switch (board_id) { | ||
252 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
253 | smscore_gpio_set_level(coredev, | ||
254 | board->board_cfg.led1, 1); | ||
255 | break; | ||
256 | } | ||
257 | break; /* BOARD_EVENT_MULTIPLEX_OK */ | 161 | break; /* BOARD_EVENT_MULTIPLEX_OK */ |
258 | case BOARD_EVENT_MULTIPLEX_ERRORS: | 162 | case BOARD_EVENT_MULTIPLEX_ERRORS: |
259 | switch (board_id) { | ||
260 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
261 | smscore_gpio_set_level(coredev, | ||
262 | board->board_cfg.led1, 0); | ||
263 | break; | ||
264 | } | ||
265 | break; /* BOARD_EVENT_MULTIPLEX_ERRORS */ | 163 | break; /* BOARD_EVENT_MULTIPLEX_ERRORS */ |
266 | 164 | ||
267 | default: | 165 | default: |
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index a246903c3341..bd9ab9d0d12a 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c | |||
@@ -816,7 +816,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) | |||
816 | 816 | ||
817 | sms_debug("set device mode to %d", mode); | 817 | sms_debug("set device mode to %d", mode); |
818 | if (coredev->device_flags & SMS_DEVICE_FAMILY2) { | 818 | if (coredev->device_flags & SMS_DEVICE_FAMILY2) { |
819 | if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_RAW_TUNER) { | 819 | if (mode < DEVICE_MODE_DVBT || mode >= DEVICE_MODE_RAW_TUNER) { |
820 | sms_err("invalid mode specified %d", mode); | 820 | sms_err("invalid mode specified %d", mode); |
821 | return -EINVAL; | 821 | return -EINVAL; |
822 | } | 822 | } |
diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index 3ee1c3902c56..266033ae2784 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c | |||
@@ -325,6 +325,16 @@ static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client, | |||
325 | 0 : -ETIME; | 325 | 0 : -ETIME; |
326 | } | 326 | } |
327 | 327 | ||
328 | static inline int led_feedback(struct smsdvb_client_t *client) | ||
329 | { | ||
330 | if (client->fe_status & FE_HAS_LOCK) | ||
331 | return sms_board_led_feedback(client->coredev, | ||
332 | (client->sms_stat_dvb.ReceptionData.BER | ||
333 | == 0) ? SMS_LED_HI : SMS_LED_LO); | ||
334 | else | ||
335 | return sms_board_led_feedback(client->coredev, SMS_LED_OFF); | ||
336 | } | ||
337 | |||
328 | static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) | 338 | static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) |
329 | { | 339 | { |
330 | struct smsdvb_client_t *client; | 340 | struct smsdvb_client_t *client; |
@@ -332,6 +342,8 @@ static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) | |||
332 | 342 | ||
333 | *stat = client->fe_status; | 343 | *stat = client->fe_status; |
334 | 344 | ||
345 | led_feedback(client); | ||
346 | |||
335 | return 0; | 347 | return 0; |
336 | } | 348 | } |
337 | 349 | ||
@@ -342,6 +354,8 @@ static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber) | |||
342 | 354 | ||
343 | *ber = client->sms_stat_dvb.ReceptionData.BER; | 355 | *ber = client->sms_stat_dvb.ReceptionData.BER; |
344 | 356 | ||
357 | led_feedback(client); | ||
358 | |||
345 | return 0; | 359 | return 0; |
346 | } | 360 | } |
347 | 361 | ||
@@ -359,6 +373,8 @@ static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength) | |||
359 | (client->sms_stat_dvb.ReceptionData.InBandPwr | 373 | (client->sms_stat_dvb.ReceptionData.InBandPwr |
360 | + 95) * 3 / 2; | 374 | + 95) * 3 / 2; |
361 | 375 | ||
376 | led_feedback(client); | ||
377 | |||
362 | return 0; | 378 | return 0; |
363 | } | 379 | } |
364 | 380 | ||
@@ -369,6 +385,8 @@ static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) | |||
369 | 385 | ||
370 | *snr = client->sms_stat_dvb.ReceptionData.SNR; | 386 | *snr = client->sms_stat_dvb.ReceptionData.SNR; |
371 | 387 | ||
388 | led_feedback(client); | ||
389 | |||
372 | return 0; | 390 | return 0; |
373 | } | 391 | } |
374 | 392 | ||
@@ -379,6 +397,8 @@ static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) | |||
379 | 397 | ||
380 | *ucblocks = client->sms_stat_dvb.ReceptionData.ErrorTSPackets; | 398 | *ucblocks = client->sms_stat_dvb.ReceptionData.ErrorTSPackets; |
381 | 399 | ||
400 | led_feedback(client); | ||
401 | |||
382 | return 0; | 402 | return 0; |
383 | } | 403 | } |
384 | 404 | ||
@@ -404,6 +424,8 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe, | |||
404 | u32 Data[3]; | 424 | u32 Data[3]; |
405 | } Msg; | 425 | } Msg; |
406 | 426 | ||
427 | int ret; | ||
428 | |||
407 | client->fe_status = FE_HAS_SIGNAL; | 429 | client->fe_status = FE_HAS_SIGNAL; |
408 | client->event_fe_state = -1; | 430 | client->event_fe_state = -1; |
409 | client->event_unc_state = -1; | 431 | client->event_unc_state = -1; |
@@ -426,6 +448,23 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe, | |||
426 | case BANDWIDTH_AUTO: return -EOPNOTSUPP; | 448 | case BANDWIDTH_AUTO: return -EOPNOTSUPP; |
427 | default: return -EINVAL; | 449 | default: return -EINVAL; |
428 | } | 450 | } |
451 | /* Disable LNA, if any. An error is returned if no LNA is present */ | ||
452 | ret = sms_board_lna_control(client->coredev, 0); | ||
453 | if (ret == 0) { | ||
454 | fe_status_t status; | ||
455 | |||
456 | /* tune with LNA off at first */ | ||
457 | ret = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), | ||
458 | &client->tune_done); | ||
459 | |||
460 | smsdvb_read_status(fe, &status); | ||
461 | |||
462 | if (status & FE_HAS_LOCK) | ||
463 | return ret; | ||
464 | |||
465 | /* previous tune didnt lock - enable LNA and tune again */ | ||
466 | sms_board_lna_control(client->coredev, 1); | ||
467 | } | ||
429 | 468 | ||
430 | return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), | 469 | return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), |
431 | &client->tune_done); | 470 | &client->tune_done); |
@@ -451,6 +490,8 @@ static int smsdvb_init(struct dvb_frontend *fe) | |||
451 | struct smsdvb_client_t *client = | 490 | struct smsdvb_client_t *client = |
452 | container_of(fe, struct smsdvb_client_t, frontend); | 491 | container_of(fe, struct smsdvb_client_t, frontend); |
453 | 492 | ||
493 | sms_board_power(client->coredev, 1); | ||
494 | |||
454 | sms_board_dvb3_event(client, DVB3_EVENT_INIT); | 495 | sms_board_dvb3_event(client, DVB3_EVENT_INIT); |
455 | return 0; | 496 | return 0; |
456 | } | 497 | } |
@@ -460,6 +501,9 @@ static int smsdvb_sleep(struct dvb_frontend *fe) | |||
460 | struct smsdvb_client_t *client = | 501 | struct smsdvb_client_t *client = |
461 | container_of(fe, struct smsdvb_client_t, frontend); | 502 | container_of(fe, struct smsdvb_client_t, frontend); |
462 | 503 | ||
504 | sms_board_led_feedback(client->coredev, SMS_LED_OFF); | ||
505 | sms_board_power(client->coredev, 0); | ||
506 | |||
463 | sms_board_dvb3_event(client, DVB3_EVENT_SLEEP); | 507 | sms_board_dvb3_event(client, DVB3_EVENT_SLEEP); |
464 | 508 | ||
465 | return 0; | 509 | return 0; |
diff --git a/drivers/media/dvb/siano/smssdio.c b/drivers/media/dvb/siano/smssdio.c index dfaa49a53f32..d1d652e7f890 100644 --- a/drivers/media/dvb/siano/smssdio.c +++ b/drivers/media/dvb/siano/smssdio.c | |||
@@ -46,6 +46,7 @@ | |||
46 | 46 | ||
47 | #define SMSSDIO_DATA 0x00 | 47 | #define SMSSDIO_DATA 0x00 |
48 | #define SMSSDIO_INT 0x04 | 48 | #define SMSSDIO_INT 0x04 |
49 | #define SMSSDIO_BLOCK_SIZE 128 | ||
49 | 50 | ||
50 | static const struct sdio_device_id smssdio_ids[] = { | 51 | static const struct sdio_device_id smssdio_ids[] = { |
51 | {SDIO_DEVICE(SDIO_VENDOR_ID_SIANO, SDIO_DEVICE_ID_SIANO_STELLAR), | 52 | {SDIO_DEVICE(SDIO_VENDOR_ID_SIANO, SDIO_DEVICE_ID_SIANO_STELLAR), |
@@ -85,7 +86,8 @@ static int smssdio_sendrequest(void *context, void *buffer, size_t size) | |||
85 | sdio_claim_host(smsdev->func); | 86 | sdio_claim_host(smsdev->func); |
86 | 87 | ||
87 | while (size >= smsdev->func->cur_blksize) { | 88 | while (size >= smsdev->func->cur_blksize) { |
88 | ret = sdio_write_blocks(smsdev->func, SMSSDIO_DATA, buffer, 1); | 89 | ret = sdio_memcpy_toio(smsdev->func, SMSSDIO_DATA, |
90 | buffer, smsdev->func->cur_blksize); | ||
89 | if (ret) | 91 | if (ret) |
90 | goto out; | 92 | goto out; |
91 | 93 | ||
@@ -94,8 +96,8 @@ static int smssdio_sendrequest(void *context, void *buffer, size_t size) | |||
94 | } | 96 | } |
95 | 97 | ||
96 | if (size) { | 98 | if (size) { |
97 | ret = sdio_write_bytes(smsdev->func, SMSSDIO_DATA, | 99 | ret = sdio_memcpy_toio(smsdev->func, SMSSDIO_DATA, |
98 | buffer, size); | 100 | buffer, size); |
99 | } | 101 | } |
100 | 102 | ||
101 | out: | 103 | out: |
@@ -125,23 +127,23 @@ static void smssdio_interrupt(struct sdio_func *func) | |||
125 | */ | 127 | */ |
126 | isr = sdio_readb(func, SMSSDIO_INT, &ret); | 128 | isr = sdio_readb(func, SMSSDIO_INT, &ret); |
127 | if (ret) { | 129 | if (ret) { |
128 | dev_err(&smsdev->func->dev, | 130 | sms_err("Unable to read interrupt register!\n"); |
129 | "Unable to read interrupt register!\n"); | ||
130 | return; | 131 | return; |
131 | } | 132 | } |
132 | 133 | ||
133 | if (smsdev->split_cb == NULL) { | 134 | if (smsdev->split_cb == NULL) { |
134 | cb = smscore_getbuffer(smsdev->coredev); | 135 | cb = smscore_getbuffer(smsdev->coredev); |
135 | if (!cb) { | 136 | if (!cb) { |
136 | dev_err(&smsdev->func->dev, | 137 | sms_err("Unable to allocate data buffer!\n"); |
137 | "Unable to allocate data buffer!\n"); | ||
138 | return; | 138 | return; |
139 | } | 139 | } |
140 | 140 | ||
141 | ret = sdio_read_blocks(smsdev->func, cb->p, SMSSDIO_DATA, 1); | 141 | ret = sdio_memcpy_fromio(smsdev->func, |
142 | cb->p, | ||
143 | SMSSDIO_DATA, | ||
144 | SMSSDIO_BLOCK_SIZE); | ||
142 | if (ret) { | 145 | if (ret) { |
143 | dev_err(&smsdev->func->dev, | 146 | sms_err("Error %d reading initial block!\n", ret); |
144 | "Error %d reading initial block!\n", ret); | ||
145 | return; | 147 | return; |
146 | } | 148 | } |
147 | 149 | ||
@@ -152,7 +154,10 @@ static void smssdio_interrupt(struct sdio_func *func) | |||
152 | return; | 154 | return; |
153 | } | 155 | } |
154 | 156 | ||
155 | size = hdr->msgLength - smsdev->func->cur_blksize; | 157 | if (hdr->msgLength > smsdev->func->cur_blksize) |
158 | size = hdr->msgLength - smsdev->func->cur_blksize; | ||
159 | else | ||
160 | size = 0; | ||
156 | } else { | 161 | } else { |
157 | cb = smsdev->split_cb; | 162 | cb = smsdev->split_cb; |
158 | hdr = cb->p; | 163 | hdr = cb->p; |
@@ -162,23 +167,24 @@ static void smssdio_interrupt(struct sdio_func *func) | |||
162 | smsdev->split_cb = NULL; | 167 | smsdev->split_cb = NULL; |
163 | } | 168 | } |
164 | 169 | ||
165 | if (hdr->msgLength > smsdev->func->cur_blksize) { | 170 | if (size) { |
166 | void *buffer; | 171 | void *buffer; |
167 | 172 | ||
168 | size = ALIGN(size, 128); | 173 | buffer = cb->p + (hdr->msgLength - size); |
169 | buffer = cb->p + hdr->msgLength; | 174 | size = ALIGN(size, SMSSDIO_BLOCK_SIZE); |
170 | 175 | ||
171 | BUG_ON(smsdev->func->cur_blksize != 128); | 176 | BUG_ON(smsdev->func->cur_blksize != SMSSDIO_BLOCK_SIZE); |
172 | 177 | ||
173 | /* | 178 | /* |
174 | * First attempt to transfer all of it in one go... | 179 | * First attempt to transfer all of it in one go... |
175 | */ | 180 | */ |
176 | ret = sdio_read_blocks(smsdev->func, buffer, | 181 | ret = sdio_memcpy_fromio(smsdev->func, |
177 | SMSSDIO_DATA, size / 128); | 182 | buffer, |
183 | SMSSDIO_DATA, | ||
184 | size); | ||
178 | if (ret && ret != -EINVAL) { | 185 | if (ret && ret != -EINVAL) { |
179 | smscore_putbuffer(smsdev->coredev, cb); | 186 | smscore_putbuffer(smsdev->coredev, cb); |
180 | dev_err(&smsdev->func->dev, | 187 | sms_err("Error %d reading data from card!\n", ret); |
181 | "Error %d reading data from card!\n", ret); | ||
182 | return; | 188 | return; |
183 | } | 189 | } |
184 | 190 | ||
@@ -191,12 +197,12 @@ static void smssdio_interrupt(struct sdio_func *func) | |||
191 | */ | 197 | */ |
192 | if (ret == -EINVAL) { | 198 | if (ret == -EINVAL) { |
193 | while (size) { | 199 | while (size) { |
194 | ret = sdio_read_blocks(smsdev->func, | 200 | ret = sdio_memcpy_fromio(smsdev->func, |
195 | buffer, SMSSDIO_DATA, 1); | 201 | buffer, SMSSDIO_DATA, |
202 | smsdev->func->cur_blksize); | ||
196 | if (ret) { | 203 | if (ret) { |
197 | smscore_putbuffer(smsdev->coredev, cb); | 204 | smscore_putbuffer(smsdev->coredev, cb); |
198 | dev_err(&smsdev->func->dev, | 205 | sms_err("Error %d reading " |
199 | "Error %d reading " | ||
200 | "data from card!\n", ret); | 206 | "data from card!\n", ret); |
201 | return; | 207 | return; |
202 | } | 208 | } |
@@ -269,7 +275,7 @@ static int smssdio_probe(struct sdio_func *func, | |||
269 | if (ret) | 275 | if (ret) |
270 | goto release; | 276 | goto release; |
271 | 277 | ||
272 | ret = sdio_set_block_size(func, 128); | 278 | ret = sdio_set_block_size(func, SMSSDIO_BLOCK_SIZE); |
273 | if (ret) | 279 | if (ret) |
274 | goto disable; | 280 | goto disable; |
275 | 281 | ||
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 84b6fc15519d..dcf9fa9264bb 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -920,6 +920,8 @@ source "drivers/media/video/pwc/Kconfig" | |||
920 | config USB_ZR364XX | 920 | config USB_ZR364XX |
921 | tristate "USB ZR364XX Camera support" | 921 | tristate "USB ZR364XX Camera support" |
922 | depends on VIDEO_V4L2 | 922 | depends on VIDEO_V4L2 |
923 | select VIDEOBUF_GEN | ||
924 | select VIDEOBUF_VMALLOC | ||
923 | ---help--- | 925 | ---help--- |
924 | Say Y here if you want to connect this type of camera to your | 926 | Say Y here if you want to connect this type of camera to your |
925 | computer's USB port. | 927 | computer's USB port. |
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index 10dbd4a11b30..9e39bc5f7b00 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c | |||
@@ -992,7 +992,7 @@ static int accept_bwqcam(struct parport *port) | |||
992 | 992 | ||
993 | if (parport[0] && strncmp(parport[0], "auto", 4) != 0) { | 993 | if (parport[0] && strncmp(parport[0], "auto", 4) != 0) { |
994 | /* user gave parport parameters */ | 994 | /* user gave parport parameters */ |
995 | for(n=0; parport[n] && n<MAX_CAMS; n++){ | 995 | for (n = 0; n < MAX_CAMS && parport[n]; n++) { |
996 | char *ep; | 996 | char *ep; |
997 | unsigned long r; | 997 | unsigned long r; |
998 | r = simple_strtoul(parport[n], &ep, 0); | 998 | r = simple_strtoul(parport[n], &ep, 0); |
diff --git a/drivers/media/video/cx18/cx18-controls.c b/drivers/media/video/cx18/cx18-controls.c index 5136df198338..93f0dae01350 100644 --- a/drivers/media/video/cx18/cx18-controls.c +++ b/drivers/media/video/cx18/cx18-controls.c | |||
@@ -20,6 +20,7 @@ | |||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
21 | * 02111-1307 USA | 21 | * 02111-1307 USA |
22 | */ | 22 | */ |
23 | #include <linux/kernel.h> | ||
23 | 24 | ||
24 | #include "cx18-driver.h" | 25 | #include "cx18-driver.h" |
25 | #include "cx18-cards.h" | 26 | #include "cx18-cards.h" |
@@ -317,7 +318,7 @@ int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
317 | idx = p.audio_properties & 0x03; | 318 | idx = p.audio_properties & 0x03; |
318 | /* The audio clock of the digitizer must match the codec sample | 319 | /* The audio clock of the digitizer must match the codec sample |
319 | rate otherwise you get some very strange effects. */ | 320 | rate otherwise you get some very strange effects. */ |
320 | if (idx < sizeof(freqs)) | 321 | if (idx < ARRAY_SIZE(freqs)) |
321 | cx18_call_all(cx, audio, s_clock_freq, freqs[idx]); | 322 | cx18_call_all(cx, audio, s_clock_freq, freqs[idx]); |
322 | return err; | 323 | return err; |
323 | } | 324 | } |
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c index e0cf21e0b1bf..1a1048b18f70 100644 --- a/drivers/media/video/cx23885/cx23885-417.c +++ b/drivers/media/video/cx23885/cx23885-417.c | |||
@@ -1715,6 +1715,8 @@ static struct video_device cx23885_mpeg_template = { | |||
1715 | .fops = &mpeg_fops, | 1715 | .fops = &mpeg_fops, |
1716 | .ioctl_ops = &mpeg_ioctl_ops, | 1716 | .ioctl_ops = &mpeg_ioctl_ops, |
1717 | .minor = -1, | 1717 | .minor = -1, |
1718 | .tvnorms = CX23885_NORMS, | ||
1719 | .current_norm = V4L2_STD_NTSC_M, | ||
1718 | }; | 1720 | }; |
1719 | 1721 | ||
1720 | void cx23885_417_unregister(struct cx23885_dev *dev) | 1722 | void cx23885_417_unregister(struct cx23885_dev *dev) |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index a5cc1c1fc2d6..39465301ec94 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -3003,6 +3003,14 @@ void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl) | |||
3003 | case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: | 3003 | case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: |
3004 | ctl->demod = XC3028_FE_OREN538; | 3004 | ctl->demod = XC3028_FE_OREN538; |
3005 | break; | 3005 | break; |
3006 | case CX88_BOARD_GENIATECH_X8000_MT: | ||
3007 | /* FIXME: For this board, the xc3028 never recovers after being | ||
3008 | powered down (the reset GPIO probably is not set properly). | ||
3009 | We don't have access to the hardware so we cannot determine | ||
3010 | which GPIO is used for xc3028, so just disable power xc3028 | ||
3011 | power management for now */ | ||
3012 | ctl->disable_power_mgmt = 1; | ||
3013 | break; | ||
3006 | case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL: | 3014 | case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL: |
3007 | case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME: | 3015 | case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME: |
3008 | case CX88_BOARD_PROLINK_PV_8000GT: | 3016 | case CX88_BOARD_PROLINK_PV_8000GT: |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index c44e87600219..e237b507659b 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -501,6 +501,7 @@ static struct zl10353_config cx88_pinnacle_hybrid_pctv = { | |||
501 | static struct zl10353_config cx88_geniatech_x8000_mt = { | 501 | static struct zl10353_config cx88_geniatech_x8000_mt = { |
502 | .demod_address = (0x1e >> 1), | 502 | .demod_address = (0x1e >> 1), |
503 | .no_tuner = 1, | 503 | .no_tuner = 1, |
504 | .disable_i2c_gate_ctrl = 1, | ||
504 | }; | 505 | }; |
505 | 506 | ||
506 | static struct s5h1411_config dvico_fusionhdtv7_config = { | 507 | static struct s5h1411_config dvico_fusionhdtv7_config = { |
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index da4e3912cd37..7172dcf2a4fa 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -116,6 +116,10 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
116 | udelay(100); | 116 | udelay(100); |
117 | break; | 117 | break; |
118 | case CX88_BOARD_HAUPPAUGE_HVR1300: | 118 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
119 | /* Enable MPEG parallel IO and video signal pins */ | ||
120 | cx_write(MO_PINMUX_IO, 0x88); | ||
121 | cx_write(TS_SOP_STAT, 0); | ||
122 | cx_write(TS_VALERR_CNTRL, 0); | ||
119 | break; | 123 | break; |
120 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: | 124 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: |
121 | /* Enable MPEG parallel IO and video signal pins */ | 125 | /* Enable MPEG parallel IO and video signal pins */ |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 320f1f60276e..1c2e544eda73 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -218,7 +218,7 @@ static struct em28xx_reg_seq silvercrest_reg_seq[] = { | |||
218 | struct em28xx_board em28xx_boards[] = { | 218 | struct em28xx_board em28xx_boards[] = { |
219 | [EM2750_BOARD_UNKNOWN] = { | 219 | [EM2750_BOARD_UNKNOWN] = { |
220 | .name = "EM2710/EM2750/EM2751 webcam grabber", | 220 | .name = "EM2710/EM2750/EM2751 webcam grabber", |
221 | .xclk = EM28XX_XCLK_FREQUENCY_48MHZ, | 221 | .xclk = EM28XX_XCLK_FREQUENCY_20MHZ, |
222 | .tuner_type = TUNER_ABSENT, | 222 | .tuner_type = TUNER_ABSENT, |
223 | .is_webcam = 1, | 223 | .is_webcam = 1, |
224 | .input = { { | 224 | .input = { { |
@@ -622,22 +622,27 @@ struct em28xx_board em28xx_boards[] = { | |||
622 | }, | 622 | }, |
623 | [EM2861_BOARD_PLEXTOR_PX_TV100U] = { | 623 | [EM2861_BOARD_PLEXTOR_PX_TV100U] = { |
624 | .name = "Plextor ConvertX PX-TV100U", | 624 | .name = "Plextor ConvertX PX-TV100U", |
625 | .valid = EM28XX_BOARD_NOT_VALIDATED, | ||
626 | .tuner_type = TUNER_TNF_5335MF, | 625 | .tuner_type = TUNER_TNF_5335MF, |
626 | .xclk = EM28XX_XCLK_I2S_MSB_TIMING | | ||
627 | EM28XX_XCLK_FREQUENCY_12MHZ, | ||
627 | .tda9887_conf = TDA9887_PRESENT, | 628 | .tda9887_conf = TDA9887_PRESENT, |
628 | .decoder = EM28XX_TVP5150, | 629 | .decoder = EM28XX_TVP5150, |
630 | .has_msp34xx = 1, | ||
629 | .input = { { | 631 | .input = { { |
630 | .type = EM28XX_VMUX_TELEVISION, | 632 | .type = EM28XX_VMUX_TELEVISION, |
631 | .vmux = TVP5150_COMPOSITE0, | 633 | .vmux = TVP5150_COMPOSITE0, |
632 | .amux = EM28XX_AMUX_LINE_IN, | 634 | .amux = EM28XX_AMUX_LINE_IN, |
635 | .gpio = pinnacle_hybrid_pro_analog, | ||
633 | }, { | 636 | }, { |
634 | .type = EM28XX_VMUX_COMPOSITE1, | 637 | .type = EM28XX_VMUX_COMPOSITE1, |
635 | .vmux = TVP5150_COMPOSITE1, | 638 | .vmux = TVP5150_COMPOSITE1, |
636 | .amux = EM28XX_AMUX_LINE_IN, | 639 | .amux = EM28XX_AMUX_LINE_IN, |
640 | .gpio = pinnacle_hybrid_pro_analog, | ||
637 | }, { | 641 | }, { |
638 | .type = EM28XX_VMUX_SVIDEO, | 642 | .type = EM28XX_VMUX_SVIDEO, |
639 | .vmux = TVP5150_SVIDEO, | 643 | .vmux = TVP5150_SVIDEO, |
640 | .amux = EM28XX_AMUX_LINE_IN, | 644 | .amux = EM28XX_AMUX_LINE_IN, |
645 | .gpio = pinnacle_hybrid_pro_analog, | ||
641 | } }, | 646 | } }, |
642 | }, | 647 | }, |
643 | 648 | ||
@@ -1544,6 +1549,8 @@ struct usb_device_id em28xx_id_table[] = { | |||
1544 | .driver_info = EM2750_BOARD_UNKNOWN }, | 1549 | .driver_info = EM2750_BOARD_UNKNOWN }, |
1545 | { USB_DEVICE(0xeb1a, 0x2800), | 1550 | { USB_DEVICE(0xeb1a, 0x2800), |
1546 | .driver_info = EM2800_BOARD_UNKNOWN }, | 1551 | .driver_info = EM2800_BOARD_UNKNOWN }, |
1552 | { USB_DEVICE(0xeb1a, 0x2710), | ||
1553 | .driver_info = EM2820_BOARD_UNKNOWN }, | ||
1547 | { USB_DEVICE(0xeb1a, 0x2820), | 1554 | { USB_DEVICE(0xeb1a, 0x2820), |
1548 | .driver_info = EM2820_BOARD_UNKNOWN }, | 1555 | .driver_info = EM2820_BOARD_UNKNOWN }, |
1549 | { USB_DEVICE(0xeb1a, 0x2821), | 1556 | { USB_DEVICE(0xeb1a, 0x2821), |
@@ -1723,6 +1730,25 @@ static inline void em28xx_set_model(struct em28xx *dev) | |||
1723 | EM28XX_I2C_FREQ_100_KHZ; | 1730 | EM28XX_I2C_FREQ_100_KHZ; |
1724 | } | 1731 | } |
1725 | 1732 | ||
1733 | |||
1734 | /* FIXME: Should be replaced by a proper mt9m111 driver */ | ||
1735 | static int em28xx_initialize_mt9m111(struct em28xx *dev) | ||
1736 | { | ||
1737 | int i; | ||
1738 | unsigned char regs[][3] = { | ||
1739 | { 0x0d, 0x00, 0x01, }, /* reset and use defaults */ | ||
1740 | { 0x0d, 0x00, 0x00, }, | ||
1741 | { 0x0a, 0x00, 0x21, }, | ||
1742 | { 0x21, 0x04, 0x00, }, /* full readout speed, no row/col skipping */ | ||
1743 | }; | ||
1744 | |||
1745 | for (i = 0; i < ARRAY_SIZE(regs); i++) | ||
1746 | i2c_master_send(&dev->i2c_client, ®s[i][0], 3); | ||
1747 | |||
1748 | return 0; | ||
1749 | } | ||
1750 | |||
1751 | |||
1726 | /* FIXME: Should be replaced by a proper mt9m001 driver */ | 1752 | /* FIXME: Should be replaced by a proper mt9m001 driver */ |
1727 | static int em28xx_initialize_mt9m001(struct em28xx *dev) | 1753 | static int em28xx_initialize_mt9m001(struct em28xx *dev) |
1728 | { | 1754 | { |
@@ -1751,7 +1777,7 @@ static int em28xx_initialize_mt9m001(struct em28xx *dev) | |||
1751 | 1777 | ||
1752 | /* HINT method: webcam I2C chips | 1778 | /* HINT method: webcam I2C chips |
1753 | * | 1779 | * |
1754 | * This method work for webcams with Micron sensors | 1780 | * This method works for webcams with Micron sensors |
1755 | */ | 1781 | */ |
1756 | static int em28xx_hint_sensor(struct em28xx *dev) | 1782 | static int em28xx_hint_sensor(struct em28xx *dev) |
1757 | { | 1783 | { |
@@ -1761,6 +1787,7 @@ static int em28xx_hint_sensor(struct em28xx *dev) | |||
1761 | __be16 version_be; | 1787 | __be16 version_be; |
1762 | u16 version; | 1788 | u16 version; |
1763 | 1789 | ||
1790 | /* Micron sensor detection */ | ||
1764 | dev->i2c_client.addr = 0xba >> 1; | 1791 | dev->i2c_client.addr = 0xba >> 1; |
1765 | cmd = 0; | 1792 | cmd = 0; |
1766 | i2c_master_send(&dev->i2c_client, &cmd, 1); | 1793 | i2c_master_send(&dev->i2c_client, &cmd, 1); |
@@ -1769,23 +1796,54 @@ static int em28xx_hint_sensor(struct em28xx *dev) | |||
1769 | return -EINVAL; | 1796 | return -EINVAL; |
1770 | 1797 | ||
1771 | version = be16_to_cpu(version_be); | 1798 | version = be16_to_cpu(version_be); |
1772 | |||
1773 | switch (version) { | 1799 | switch (version) { |
1774 | case 0x8243: /* mt9v011 640x480 1.3 Mpix sensor */ | 1800 | case 0x8232: /* mt9v011 640x480 1.3 Mpix sensor */ |
1801 | case 0x8243: /* mt9v011 rev B 640x480 1.3 Mpix sensor */ | ||
1775 | dev->model = EM2820_BOARD_SILVERCREST_WEBCAM; | 1802 | dev->model = EM2820_BOARD_SILVERCREST_WEBCAM; |
1803 | em28xx_set_model(dev); | ||
1804 | |||
1776 | sensor_name = "mt9v011"; | 1805 | sensor_name = "mt9v011"; |
1777 | dev->em28xx_sensor = EM28XX_MT9V011; | 1806 | dev->em28xx_sensor = EM28XX_MT9V011; |
1778 | dev->sensor_xres = 640; | 1807 | dev->sensor_xres = 640; |
1779 | dev->sensor_yres = 480; | 1808 | dev->sensor_yres = 480; |
1780 | dev->sensor_xtal = 6300000; | 1809 | /* |
1810 | * FIXME: mt9v011 uses I2S speed as xtal clk - at least with | ||
1811 | * the Silvercrest cam I have here for testing - for higher | ||
1812 | * resolutions, a high clock cause horizontal artifacts, so we | ||
1813 | * need to use a lower xclk frequency. | ||
1814 | * Yet, it would be possible to adjust xclk depending on the | ||
1815 | * desired resolution, since this affects directly the | ||
1816 | * frame rate. | ||
1817 | */ | ||
1818 | dev->board.xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ; | ||
1819 | dev->sensor_xtal = 4300000; | ||
1781 | 1820 | ||
1782 | /* probably means GRGB 16 bit bayer */ | 1821 | /* probably means GRGB 16 bit bayer */ |
1783 | dev->vinmode = 0x0d; | 1822 | dev->vinmode = 0x0d; |
1784 | dev->vinctl = 0x00; | 1823 | dev->vinctl = 0x00; |
1785 | 1824 | ||
1786 | break; | 1825 | break; |
1826 | |||
1827 | case 0x143a: /* MT9M111 as found in the ECS G200 */ | ||
1828 | dev->model = EM2750_BOARD_UNKNOWN; | ||
1829 | em28xx_set_model(dev); | ||
1830 | |||
1831 | sensor_name = "mt9m111"; | ||
1832 | dev->board.xclk = EM28XX_XCLK_FREQUENCY_48MHZ; | ||
1833 | dev->em28xx_sensor = EM28XX_MT9M111; | ||
1834 | em28xx_initialize_mt9m111(dev); | ||
1835 | dev->sensor_xres = 640; | ||
1836 | dev->sensor_yres = 512; | ||
1837 | |||
1838 | dev->vinmode = 0x0a; | ||
1839 | dev->vinctl = 0x00; | ||
1840 | |||
1841 | break; | ||
1842 | |||
1787 | case 0x8431: | 1843 | case 0x8431: |
1788 | dev->model = EM2750_BOARD_UNKNOWN; | 1844 | dev->model = EM2750_BOARD_UNKNOWN; |
1845 | em28xx_set_model(dev); | ||
1846 | |||
1789 | sensor_name = "mt9m001"; | 1847 | sensor_name = "mt9m001"; |
1790 | dev->em28xx_sensor = EM28XX_MT9M001; | 1848 | dev->em28xx_sensor = EM28XX_MT9M001; |
1791 | em28xx_initialize_mt9m001(dev); | 1849 | em28xx_initialize_mt9m001(dev); |
@@ -1798,10 +1856,13 @@ static int em28xx_hint_sensor(struct em28xx *dev) | |||
1798 | 1856 | ||
1799 | break; | 1857 | break; |
1800 | default: | 1858 | default: |
1801 | printk("Unknown Micron Sensor 0x%04x\n", be16_to_cpu(version)); | 1859 | printk("Unknown Micron Sensor 0x%04x\n", version); |
1802 | return -EINVAL; | 1860 | return -EINVAL; |
1803 | } | 1861 | } |
1804 | 1862 | ||
1863 | /* Setup webcam defaults */ | ||
1864 | em28xx_pre_card_setup(dev); | ||
1865 | |||
1805 | em28xx_errdev("Sensor is %s, using model %s entry.\n", | 1866 | em28xx_errdev("Sensor is %s, using model %s entry.\n", |
1806 | sensor_name, em28xx_boards[dev->model].name); | 1867 | sensor_name, em28xx_boards[dev->model].name); |
1807 | 1868 | ||
@@ -1813,60 +1874,6 @@ static int em28xx_hint_sensor(struct em28xx *dev) | |||
1813 | */ | 1874 | */ |
1814 | void em28xx_pre_card_setup(struct em28xx *dev) | 1875 | void em28xx_pre_card_setup(struct em28xx *dev) |
1815 | { | 1876 | { |
1816 | int rc; | ||
1817 | |||
1818 | em28xx_set_model(dev); | ||
1819 | |||
1820 | em28xx_info("Identified as %s (card=%d)\n", | ||
1821 | dev->board.name, dev->model); | ||
1822 | |||
1823 | /* Set the default GPO/GPIO for legacy devices */ | ||
1824 | dev->reg_gpo_num = EM2880_R04_GPO; | ||
1825 | dev->reg_gpio_num = EM28XX_R08_GPIO; | ||
1826 | |||
1827 | dev->wait_after_write = 5; | ||
1828 | |||
1829 | /* Based on the Chip ID, set the device configuration */ | ||
1830 | rc = em28xx_read_reg(dev, EM28XX_R0A_CHIPID); | ||
1831 | if (rc > 0) { | ||
1832 | dev->chip_id = rc; | ||
1833 | |||
1834 | switch (dev->chip_id) { | ||
1835 | case CHIP_ID_EM2750: | ||
1836 | em28xx_info("chip ID is em2750\n"); | ||
1837 | break; | ||
1838 | case CHIP_ID_EM2820: | ||
1839 | em28xx_info("chip ID is em2710 or em2820\n"); | ||
1840 | break; | ||
1841 | case CHIP_ID_EM2840: | ||
1842 | em28xx_info("chip ID is em2840\n"); | ||
1843 | break; | ||
1844 | case CHIP_ID_EM2860: | ||
1845 | em28xx_info("chip ID is em2860\n"); | ||
1846 | break; | ||
1847 | case CHIP_ID_EM2870: | ||
1848 | em28xx_info("chip ID is em2870\n"); | ||
1849 | dev->wait_after_write = 0; | ||
1850 | break; | ||
1851 | case CHIP_ID_EM2874: | ||
1852 | em28xx_info("chip ID is em2874\n"); | ||
1853 | dev->reg_gpio_num = EM2874_R80_GPIO; | ||
1854 | dev->wait_after_write = 0; | ||
1855 | break; | ||
1856 | case CHIP_ID_EM2883: | ||
1857 | em28xx_info("chip ID is em2882/em2883\n"); | ||
1858 | dev->wait_after_write = 0; | ||
1859 | break; | ||
1860 | default: | ||
1861 | em28xx_info("em28xx chip ID = %d\n", dev->chip_id); | ||
1862 | } | ||
1863 | } | ||
1864 | |||
1865 | /* Prepopulate cached GPO register content */ | ||
1866 | rc = em28xx_read_reg(dev, dev->reg_gpo_num); | ||
1867 | if (rc >= 0) | ||
1868 | dev->reg_gpo = rc; | ||
1869 | |||
1870 | /* Set the initial XCLK and I2C clock values based on the board | 1877 | /* Set the initial XCLK and I2C clock values based on the board |
1871 | definition */ | 1878 | definition */ |
1872 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f); | 1879 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f); |
@@ -1876,9 +1883,8 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1876 | /* request some modules */ | 1883 | /* request some modules */ |
1877 | switch (dev->model) { | 1884 | switch (dev->model) { |
1878 | case EM2861_BOARD_PLEXTOR_PX_TV100U: | 1885 | case EM2861_BOARD_PLEXTOR_PX_TV100U: |
1879 | /* FIXME guess */ | 1886 | /* Sets the msp34xx I2S speed */ |
1880 | /* Turn on analog audio output */ | 1887 | dev->i2s_speed = 2048000; |
1881 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd); | ||
1882 | break; | 1888 | break; |
1883 | case EM2861_BOARD_KWORLD_PVRTV_300U: | 1889 | case EM2861_BOARD_KWORLD_PVRTV_300U: |
1884 | case EM2880_BOARD_KWORLD_DVB_305U: | 1890 | case EM2880_BOARD_KWORLD_DVB_305U: |
@@ -2216,7 +2222,20 @@ void em28xx_register_i2c_ir(struct em28xx *dev) | |||
2216 | 2222 | ||
2217 | void em28xx_card_setup(struct em28xx *dev) | 2223 | void em28xx_card_setup(struct em28xx *dev) |
2218 | { | 2224 | { |
2219 | em28xx_set_model(dev); | 2225 | /* |
2226 | * If the device can be a webcam, seek for a sensor. | ||
2227 | * If sensor is not found, then it isn't a webcam. | ||
2228 | */ | ||
2229 | if (dev->board.is_webcam) { | ||
2230 | if (em28xx_hint_sensor(dev) < 0) | ||
2231 | dev->board.is_webcam = 0; | ||
2232 | else | ||
2233 | dev->progressive = 1; | ||
2234 | } else | ||
2235 | em28xx_set_model(dev); | ||
2236 | |||
2237 | em28xx_info("Identified as %s (card=%d)\n", | ||
2238 | dev->board.name, dev->model); | ||
2220 | 2239 | ||
2221 | dev->tuner_type = em28xx_boards[dev->model].tuner_type; | 2240 | dev->tuner_type = em28xx_boards[dev->model].tuner_type; |
2222 | if (em28xx_boards[dev->model].tuner_addr) | 2241 | if (em28xx_boards[dev->model].tuner_addr) |
@@ -2290,10 +2309,6 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2290 | em28xx_gpio_set(dev, dev->board.tuner_gpio); | 2309 | em28xx_gpio_set(dev, dev->board.tuner_gpio); |
2291 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); | 2310 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); |
2292 | break; | 2311 | break; |
2293 | case EM2820_BOARD_SILVERCREST_WEBCAM: | ||
2294 | /* FIXME: need to document the registers bellow */ | ||
2295 | em28xx_write_reg(dev, 0x0d, 0x42); | ||
2296 | em28xx_write_reg(dev, 0x13, 0x08); | ||
2297 | } | 2312 | } |
2298 | 2313 | ||
2299 | if (dev->board.has_snapshot_button) | 2314 | if (dev->board.has_snapshot_button) |
@@ -2367,7 +2382,9 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2367 | } | 2382 | } |
2368 | 2383 | ||
2369 | em28xx_tuner_setup(dev); | 2384 | em28xx_tuner_setup(dev); |
2370 | em28xx_ir_init(dev); | 2385 | |
2386 | if(!disable_ir) | ||
2387 | em28xx_ir_init(dev); | ||
2371 | } | 2388 | } |
2372 | 2389 | ||
2373 | 2390 | ||
@@ -2433,7 +2450,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
2433 | int minor) | 2450 | int minor) |
2434 | { | 2451 | { |
2435 | struct em28xx *dev = *devhandle; | 2452 | struct em28xx *dev = *devhandle; |
2436 | int retval = -ENOMEM; | 2453 | int retval; |
2437 | int errCode; | 2454 | int errCode; |
2438 | 2455 | ||
2439 | dev->udev = udev; | 2456 | dev->udev = udev; |
@@ -2450,6 +2467,58 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
2450 | dev->em28xx_read_reg_req = em28xx_read_reg_req; | 2467 | dev->em28xx_read_reg_req = em28xx_read_reg_req; |
2451 | dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800; | 2468 | dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800; |
2452 | 2469 | ||
2470 | em28xx_set_model(dev); | ||
2471 | |||
2472 | /* Set the default GPO/GPIO for legacy devices */ | ||
2473 | dev->reg_gpo_num = EM2880_R04_GPO; | ||
2474 | dev->reg_gpio_num = EM28XX_R08_GPIO; | ||
2475 | |||
2476 | dev->wait_after_write = 5; | ||
2477 | |||
2478 | /* Based on the Chip ID, set the device configuration */ | ||
2479 | retval = em28xx_read_reg(dev, EM28XX_R0A_CHIPID); | ||
2480 | if (retval > 0) { | ||
2481 | dev->chip_id = retval; | ||
2482 | |||
2483 | switch (dev->chip_id) { | ||
2484 | case CHIP_ID_EM2710: | ||
2485 | em28xx_info("chip ID is em2710\n"); | ||
2486 | break; | ||
2487 | case CHIP_ID_EM2750: | ||
2488 | em28xx_info("chip ID is em2750\n"); | ||
2489 | break; | ||
2490 | case CHIP_ID_EM2820: | ||
2491 | em28xx_info("chip ID is em2820 (or em2710)\n"); | ||
2492 | break; | ||
2493 | case CHIP_ID_EM2840: | ||
2494 | em28xx_info("chip ID is em2840\n"); | ||
2495 | break; | ||
2496 | case CHIP_ID_EM2860: | ||
2497 | em28xx_info("chip ID is em2860\n"); | ||
2498 | break; | ||
2499 | case CHIP_ID_EM2870: | ||
2500 | em28xx_info("chip ID is em2870\n"); | ||
2501 | dev->wait_after_write = 0; | ||
2502 | break; | ||
2503 | case CHIP_ID_EM2874: | ||
2504 | em28xx_info("chip ID is em2874\n"); | ||
2505 | dev->reg_gpio_num = EM2874_R80_GPIO; | ||
2506 | dev->wait_after_write = 0; | ||
2507 | break; | ||
2508 | case CHIP_ID_EM2883: | ||
2509 | em28xx_info("chip ID is em2882/em2883\n"); | ||
2510 | dev->wait_after_write = 0; | ||
2511 | break; | ||
2512 | default: | ||
2513 | em28xx_info("em28xx chip ID = %d\n", dev->chip_id); | ||
2514 | } | ||
2515 | } | ||
2516 | |||
2517 | /* Prepopulate cached GPO register content */ | ||
2518 | retval = em28xx_read_reg(dev, dev->reg_gpo_num); | ||
2519 | if (retval >= 0) | ||
2520 | dev->reg_gpo = retval; | ||
2521 | |||
2453 | em28xx_pre_card_setup(dev); | 2522 | em28xx_pre_card_setup(dev); |
2454 | 2523 | ||
2455 | if (!dev->board.is_em2800) { | 2524 | if (!dev->board.is_em2800) { |
@@ -2484,14 +2553,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
2484 | dev->vinmode = 0x10; | 2553 | dev->vinmode = 0x10; |
2485 | dev->vinctl = 0x11; | 2554 | dev->vinctl = 0x11; |
2486 | 2555 | ||
2487 | /* | ||
2488 | * If the device can be a webcam, seek for a sensor. | ||
2489 | * If sensor is not found, then it isn't a webcam. | ||
2490 | */ | ||
2491 | if (dev->board.is_webcam) | ||
2492 | if (em28xx_hint_sensor(dev) < 0) | ||
2493 | dev->board.is_webcam = 0; | ||
2494 | |||
2495 | /* Do board specific init and eeprom reading */ | 2556 | /* Do board specific init and eeprom reading */ |
2496 | em28xx_card_setup(dev); | 2557 | em28xx_card_setup(dev); |
2497 | 2558 | ||
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 5b78e199abd1..98e140b5d95e 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -632,6 +632,9 @@ int em28xx_capture_start(struct em28xx *dev, int start) | |||
632 | return rc; | 632 | return rc; |
633 | } | 633 | } |
634 | 634 | ||
635 | if (dev->board.is_webcam) | ||
636 | rc = em28xx_write_reg(dev, 0x13, 0x0c); | ||
637 | |||
635 | /* enable video capture */ | 638 | /* enable video capture */ |
636 | rc = em28xx_write_reg(dev, 0x48, 0x00); | 639 | rc = em28xx_write_reg(dev, 0x48, 0x00); |
637 | 640 | ||
@@ -720,7 +723,10 @@ int em28xx_resolution_set(struct em28xx *dev) | |||
720 | { | 723 | { |
721 | int width, height; | 724 | int width, height; |
722 | width = norm_maxw(dev); | 725 | width = norm_maxw(dev); |
723 | height = norm_maxh(dev) >> 1; | 726 | height = norm_maxh(dev); |
727 | |||
728 | if (!dev->progressive) | ||
729 | height >>= norm_maxh(dev); | ||
724 | 730 | ||
725 | em28xx_set_outfmt(dev); | 731 | em28xx_set_outfmt(dev); |
726 | 732 | ||
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c index cf0ac7f2a30d..d603575431b4 100644 --- a/drivers/media/video/em28xx/em28xx-dvb.c +++ b/drivers/media/video/em28xx/em28xx-dvb.c | |||
@@ -478,7 +478,6 @@ static int dvb_init(struct em28xx *dev) | |||
478 | } | 478 | } |
479 | break; | 479 | break; |
480 | case EM2880_BOARD_KWORLD_DVB_310U: | 480 | case EM2880_BOARD_KWORLD_DVB_310U: |
481 | case EM2880_BOARD_EMPIRE_DUAL_TV: | ||
482 | dvb->frontend = dvb_attach(zl10353_attach, | 481 | dvb->frontend = dvb_attach(zl10353_attach, |
483 | &em28xx_zl10353_with_xc3028, | 482 | &em28xx_zl10353_with_xc3028, |
484 | &dev->i2c_adap); | 483 | &dev->i2c_adap); |
@@ -488,6 +487,7 @@ static int dvb_init(struct em28xx *dev) | |||
488 | } | 487 | } |
489 | break; | 488 | break; |
490 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: | 489 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: |
490 | case EM2880_BOARD_EMPIRE_DUAL_TV: | ||
491 | dvb->frontend = dvb_attach(zl10353_attach, | 491 | dvb->frontend = dvb_attach(zl10353_attach, |
492 | &em28xx_zl10353_xc3028_no_i2c_gate, | 492 | &em28xx_zl10353_xc3028_no_i2c_gate, |
493 | &dev->i2c_adap); | 493 | &dev->i2c_adap); |
diff --git a/drivers/media/video/em28xx/em28xx-reg.h b/drivers/media/video/em28xx/em28xx-reg.h index a2676d63cfd0..6bf84bd787df 100644 --- a/drivers/media/video/em28xx/em28xx-reg.h +++ b/drivers/media/video/em28xx/em28xx-reg.h | |||
@@ -176,7 +176,8 @@ | |||
176 | 176 | ||
177 | /* FIXME: Need to be populated with the other chip ID's */ | 177 | /* FIXME: Need to be populated with the other chip ID's */ |
178 | enum em28xx_chip_id { | 178 | enum em28xx_chip_id { |
179 | CHIP_ID_EM2820 = 18, /* Also used by em2710 */ | 179 | CHIP_ID_EM2710 = 17, |
180 | CHIP_ID_EM2820 = 18, /* Also used by some em2710 */ | ||
180 | CHIP_ID_EM2840 = 20, | 181 | CHIP_ID_EM2840 = 20, |
181 | CHIP_ID_EM2750 = 33, | 182 | CHIP_ID_EM2750 = 33, |
182 | CHIP_ID_EM2860 = 34, | 183 | CHIP_ID_EM2860 = 34, |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index ff37b4c15f44..ab079d9256c4 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -194,15 +194,24 @@ static void em28xx_copy_video(struct em28xx *dev, | |||
194 | startread = p; | 194 | startread = p; |
195 | remain = len; | 195 | remain = len; |
196 | 196 | ||
197 | /* Interlaces frame */ | 197 | if (dev->progressive) |
198 | if (buf->top_field) | ||
199 | fieldstart = outp; | 198 | fieldstart = outp; |
200 | else | 199 | else { |
201 | fieldstart = outp + bytesperline; | 200 | /* Interlaces two half frames */ |
201 | if (buf->top_field) | ||
202 | fieldstart = outp; | ||
203 | else | ||
204 | fieldstart = outp + bytesperline; | ||
205 | } | ||
202 | 206 | ||
203 | linesdone = dma_q->pos / bytesperline; | 207 | linesdone = dma_q->pos / bytesperline; |
204 | currlinedone = dma_q->pos % bytesperline; | 208 | currlinedone = dma_q->pos % bytesperline; |
205 | offset = linesdone * bytesperline * 2 + currlinedone; | 209 | |
210 | if (dev->progressive) | ||
211 | offset = linesdone * bytesperline + currlinedone; | ||
212 | else | ||
213 | offset = linesdone * bytesperline * 2 + currlinedone; | ||
214 | |||
206 | startwrite = fieldstart + offset; | 215 | startwrite = fieldstart + offset; |
207 | lencopy = bytesperline - currlinedone; | 216 | lencopy = bytesperline - currlinedone; |
208 | lencopy = lencopy > remain ? remain : lencopy; | 217 | lencopy = lencopy > remain ? remain : lencopy; |
@@ -376,7 +385,7 @@ static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb) | |||
376 | em28xx_isocdbg("Video frame %d, length=%i, %s\n", p[2], | 385 | em28xx_isocdbg("Video frame %d, length=%i, %s\n", p[2], |
377 | len, (p[2] & 1) ? "odd" : "even"); | 386 | len, (p[2] & 1) ? "odd" : "even"); |
378 | 387 | ||
379 | if (!(p[2] & 1)) { | 388 | if (dev->progressive || !(p[2] & 1)) { |
380 | if (buf != NULL) | 389 | if (buf != NULL) |
381 | buffer_filled(dev, dma_q, buf); | 390 | buffer_filled(dev, dma_q, buf); |
382 | get_next_buf(dma_q, &buf); | 391 | get_next_buf(dma_q, &buf); |
@@ -689,7 +698,10 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, | |||
689 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; | 698 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; |
690 | 699 | ||
691 | /* FIXME: TOP? NONE? BOTTOM? ALTENATE? */ | 700 | /* FIXME: TOP? NONE? BOTTOM? ALTENATE? */ |
692 | f->fmt.pix.field = dev->interlaced ? | 701 | if (dev->progressive) |
702 | f->fmt.pix.field = V4L2_FIELD_NONE; | ||
703 | else | ||
704 | f->fmt.pix.field = dev->interlaced ? | ||
693 | V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; | 705 | V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; |
694 | 706 | ||
695 | mutex_unlock(&dev->lock); | 707 | mutex_unlock(&dev->lock); |
@@ -753,7 +765,11 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
753 | f->fmt.pix.bytesperline = (dev->width * fmt->depth + 7) >> 3; | 765 | f->fmt.pix.bytesperline = (dev->width * fmt->depth + 7) >> 3; |
754 | f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * height; | 766 | f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * height; |
755 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; | 767 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; |
756 | f->fmt.pix.field = V4L2_FIELD_INTERLACED; | 768 | if (dev->progressive) |
769 | f->fmt.pix.field = V4L2_FIELD_NONE; | ||
770 | else | ||
771 | f->fmt.pix.field = dev->interlaced ? | ||
772 | V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; | ||
757 | 773 | ||
758 | return 0; | 774 | return 0; |
759 | } | 775 | } |
@@ -846,6 +862,41 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm) | |||
846 | return 0; | 862 | return 0; |
847 | } | 863 | } |
848 | 864 | ||
865 | static int vidioc_g_parm(struct file *file, void *priv, | ||
866 | struct v4l2_streamparm *p) | ||
867 | { | ||
868 | struct em28xx_fh *fh = priv; | ||
869 | struct em28xx *dev = fh->dev; | ||
870 | int rc = 0; | ||
871 | |||
872 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
873 | return -EINVAL; | ||
874 | |||
875 | if (dev->board.is_webcam) | ||
876 | rc = v4l2_device_call_until_err(&dev->v4l2_dev, 0, | ||
877 | video, g_parm, p); | ||
878 | else | ||
879 | v4l2_video_std_frame_period(dev->norm, | ||
880 | &p->parm.capture.timeperframe); | ||
881 | |||
882 | return rc; | ||
883 | } | ||
884 | |||
885 | static int vidioc_s_parm(struct file *file, void *priv, | ||
886 | struct v4l2_streamparm *p) | ||
887 | { | ||
888 | struct em28xx_fh *fh = priv; | ||
889 | struct em28xx *dev = fh->dev; | ||
890 | |||
891 | if (!dev->board.is_webcam) | ||
892 | return -EINVAL; | ||
893 | |||
894 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
895 | return -EINVAL; | ||
896 | |||
897 | return v4l2_device_call_until_err(&dev->v4l2_dev, 0, video, s_parm, p); | ||
898 | } | ||
899 | |||
849 | static const char *iname[] = { | 900 | static const char *iname[] = { |
850 | [EM28XX_VMUX_COMPOSITE1] = "Composite1", | 901 | [EM28XX_VMUX_COMPOSITE1] = "Composite1", |
851 | [EM28XX_VMUX_COMPOSITE2] = "Composite2", | 902 | [EM28XX_VMUX_COMPOSITE2] = "Composite2", |
@@ -1624,6 +1675,7 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1624 | struct em28xx *dev; | 1675 | struct em28xx *dev; |
1625 | enum v4l2_buf_type fh_type; | 1676 | enum v4l2_buf_type fh_type; |
1626 | struct em28xx_fh *fh; | 1677 | struct em28xx_fh *fh; |
1678 | enum v4l2_field field; | ||
1627 | 1679 | ||
1628 | dev = em28xx_get_device(minor, &fh_type, &radio); | 1680 | dev = em28xx_get_device(minor, &fh_type, &radio); |
1629 | 1681 | ||
@@ -1665,8 +1717,13 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1665 | 1717 | ||
1666 | dev->users++; | 1718 | dev->users++; |
1667 | 1719 | ||
1720 | if (dev->progressive) | ||
1721 | field = V4L2_FIELD_NONE; | ||
1722 | else | ||
1723 | field = V4L2_FIELD_INTERLACED; | ||
1724 | |||
1668 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &em28xx_video_qops, | 1725 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &em28xx_video_qops, |
1669 | NULL, &dev->slock, fh->type, V4L2_FIELD_INTERLACED, | 1726 | NULL, &dev->slock, fh->type, field, |
1670 | sizeof(struct em28xx_buffer), fh); | 1727 | sizeof(struct em28xx_buffer), fh); |
1671 | 1728 | ||
1672 | mutex_unlock(&dev->lock); | 1729 | mutex_unlock(&dev->lock); |
@@ -1885,6 +1942,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
1885 | .vidioc_qbuf = vidioc_qbuf, | 1942 | .vidioc_qbuf = vidioc_qbuf, |
1886 | .vidioc_dqbuf = vidioc_dqbuf, | 1943 | .vidioc_dqbuf = vidioc_dqbuf, |
1887 | .vidioc_s_std = vidioc_s_std, | 1944 | .vidioc_s_std = vidioc_s_std, |
1945 | .vidioc_g_parm = vidioc_g_parm, | ||
1946 | .vidioc_s_parm = vidioc_s_parm, | ||
1888 | .vidioc_enum_input = vidioc_enum_input, | 1947 | .vidioc_enum_input = vidioc_enum_input, |
1889 | .vidioc_g_input = vidioc_g_input, | 1948 | .vidioc_g_input = vidioc_g_input, |
1890 | .vidioc_s_input = vidioc_s_input, | 1949 | .vidioc_s_input = vidioc_s_input, |
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 45bd513f62dc..a2add61f7d59 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -367,6 +367,7 @@ enum em28xx_sensor { | |||
367 | EM28XX_NOSENSOR = 0, | 367 | EM28XX_NOSENSOR = 0, |
368 | EM28XX_MT9V011, | 368 | EM28XX_MT9V011, |
369 | EM28XX_MT9M001, | 369 | EM28XX_MT9M001, |
370 | EM28XX_MT9M111, | ||
370 | }; | 371 | }; |
371 | 372 | ||
372 | enum em28xx_adecoder { | 373 | enum em28xx_adecoder { |
@@ -484,6 +485,9 @@ struct em28xx { | |||
484 | int sensor_xres, sensor_yres; | 485 | int sensor_xres, sensor_yres; |
485 | int sensor_xtal; | 486 | int sensor_xtal; |
486 | 487 | ||
488 | /* Allows progressive (e. g. non-interlaced) mode */ | ||
489 | int progressive; | ||
490 | |||
487 | /* Vinmode/Vinctl used at the driver */ | 491 | /* Vinmode/Vinctl used at the driver */ |
488 | int vinmode, vinctl; | 492 | int vinmode, vinctl; |
489 | 493 | ||
diff --git a/drivers/media/video/gspca/Kconfig b/drivers/media/video/gspca/Kconfig index 34f46f2bc040..e994dcac43ff 100644 --- a/drivers/media/video/gspca/Kconfig +++ b/drivers/media/video/gspca/Kconfig | |||
@@ -114,7 +114,7 @@ config USB_GSPCA_SN9C20X | |||
114 | 114 | ||
115 | config USB_GSPCA_SN9C20X_EVDEV | 115 | config USB_GSPCA_SN9C20X_EVDEV |
116 | bool "Enable evdev support" | 116 | bool "Enable evdev support" |
117 | depends on USB_GSPCA_SN9C20X | 117 | depends on USB_GSPCA_SN9C20X && INPUT |
118 | ---help--- | 118 | ---help--- |
119 | Say Y here in order to enable evdev support for sn9c20x webcam button. | 119 | Say Y here in order to enable evdev support for sn9c20x webcam button. |
120 | 120 | ||
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c index ccd47f57f42c..d678765cbba2 100644 --- a/drivers/media/video/hdpvr/hdpvr-video.c +++ b/drivers/media/video/hdpvr/hdpvr-video.c | |||
@@ -1220,6 +1220,8 @@ static const struct video_device hdpvr_video_template = { | |||
1220 | V4L2_STD_PAL_G | V4L2_STD_PAL_H | V4L2_STD_PAL_I | | 1220 | V4L2_STD_PAL_G | V4L2_STD_PAL_H | V4L2_STD_PAL_I | |
1221 | V4L2_STD_PAL_D | V4L2_STD_PAL_M | V4L2_STD_PAL_N | | 1221 | V4L2_STD_PAL_D | V4L2_STD_PAL_M | V4L2_STD_PAL_N | |
1222 | V4L2_STD_PAL_60, | 1222 | V4L2_STD_PAL_60, |
1223 | .current_norm = V4L2_STD_NTSC | V4L2_STD_PAL_M | | ||
1224 | V4L2_STD_PAL_60, | ||
1223 | }; | 1225 | }; |
1224 | 1226 | ||
1225 | int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent, | 1227 | int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent, |
diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c index a3b77ed3f089..4a9c8ce0ecb3 100644 --- a/drivers/media/video/ivtv/ivtv-controls.c +++ b/drivers/media/video/ivtv/ivtv-controls.c | |||
@@ -17,6 +17,7 @@ | |||
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | #include <linux/kernel.h> | ||
20 | 21 | ||
21 | #include "ivtv-driver.h" | 22 | #include "ivtv-driver.h" |
22 | #include "ivtv-cards.h" | 23 | #include "ivtv-cards.h" |
@@ -281,7 +282,7 @@ int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
281 | idx = p.audio_properties & 0x03; | 282 | idx = p.audio_properties & 0x03; |
282 | /* The audio clock of the digitizer must match the codec sample | 283 | /* The audio clock of the digitizer must match the codec sample |
283 | rate otherwise you get some very strange effects. */ | 284 | rate otherwise you get some very strange effects. */ |
284 | if (idx < sizeof(freqs)) | 285 | if (idx < ARRAY_SIZE(freqs)) |
285 | ivtv_call_all(itv, audio, s_clock_freq, freqs[idx]); | 286 | ivtv_call_all(itv, audio, s_clock_freq, freqs[idx]); |
286 | return err; | 287 | return err; |
287 | } | 288 | } |
diff --git a/drivers/media/video/mt9v011.c b/drivers/media/video/mt9v011.c index b2260de645f0..cc85f77a5706 100644 --- a/drivers/media/video/mt9v011.c +++ b/drivers/media/video/mt9v011.c | |||
@@ -52,13 +52,34 @@ static struct v4l2_queryctrl mt9v011_qctrl[] = { | |||
52 | .step = 1, | 52 | .step = 1, |
53 | .default_value = 0, | 53 | .default_value = 0, |
54 | .flags = 0, | 54 | .flags = 0, |
55 | }, | 55 | }, { |
56 | .id = V4L2_CID_HFLIP, | ||
57 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
58 | .name = "Mirror", | ||
59 | .minimum = 0, | ||
60 | .maximum = 1, | ||
61 | .step = 1, | ||
62 | .default_value = 0, | ||
63 | .flags = 0, | ||
64 | }, { | ||
65 | .id = V4L2_CID_VFLIP, | ||
66 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
67 | .name = "Vflip", | ||
68 | .minimum = 0, | ||
69 | .maximum = 1, | ||
70 | .step = 1, | ||
71 | .default_value = 0, | ||
72 | .flags = 0, | ||
73 | }, { | ||
74 | } | ||
56 | }; | 75 | }; |
57 | 76 | ||
58 | struct mt9v011 { | 77 | struct mt9v011 { |
59 | struct v4l2_subdev sd; | 78 | struct v4l2_subdev sd; |
60 | unsigned width, height; | 79 | unsigned width, height; |
61 | unsigned xtal; | 80 | unsigned xtal; |
81 | unsigned hflip:1; | ||
82 | unsigned vflip:1; | ||
62 | 83 | ||
63 | u16 global_gain, red_bal, blue_bal; | 84 | u16 global_gain, red_bal, blue_bal; |
64 | }; | 85 | }; |
@@ -131,7 +152,6 @@ static const struct i2c_reg_value mt9v011_init_default[] = { | |||
131 | 152 | ||
132 | { R0A_MT9V011_CLK_SPEED, 0x0000 }, | 153 | { R0A_MT9V011_CLK_SPEED, 0x0000 }, |
133 | { R1E_MT9V011_DIGITAL_ZOOM, 0x0000 }, | 154 | { R1E_MT9V011_DIGITAL_ZOOM, 0x0000 }, |
134 | { R20_MT9V011_READ_MODE, 0x1000 }, | ||
135 | 155 | ||
136 | { R07_MT9V011_OUT_CTRL, 0x0002 }, /* chip enable */ | 156 | { R07_MT9V011_OUT_CTRL, 0x0002 }, /* chip enable */ |
137 | }; | 157 | }; |
@@ -156,7 +176,7 @@ static void set_balance(struct v4l2_subdev *sd) | |||
156 | mt9v011_write(sd, R2D_MT9V011_RED_GAIN, red_gain); | 176 | mt9v011_write(sd, R2D_MT9V011_RED_GAIN, red_gain); |
157 | } | 177 | } |
158 | 178 | ||
159 | static void calc_fps(struct v4l2_subdev *sd) | 179 | static void calc_fps(struct v4l2_subdev *sd, u32 *numerator, u32 *denominator) |
160 | { | 180 | { |
161 | struct mt9v011 *core = to_mt9v011(sd); | 181 | struct mt9v011 *core = to_mt9v011(sd); |
162 | unsigned height, width, hblank, vblank, speed; | 182 | unsigned height, width, hblank, vblank, speed; |
@@ -179,6 +199,51 @@ static void calc_fps(struct v4l2_subdev *sd) | |||
179 | 199 | ||
180 | v4l2_dbg(1, debug, sd, "Programmed to %u.%03u fps (%d pixel clcks)\n", | 200 | v4l2_dbg(1, debug, sd, "Programmed to %u.%03u fps (%d pixel clcks)\n", |
181 | tmp / 1000, tmp % 1000, t_time); | 201 | tmp / 1000, tmp % 1000, t_time); |
202 | |||
203 | if (numerator && denominator) { | ||
204 | *numerator = 1000; | ||
205 | *denominator = (u32)frames_per_ms; | ||
206 | } | ||
207 | } | ||
208 | |||
209 | static u16 calc_speed(struct v4l2_subdev *sd, u32 numerator, u32 denominator) | ||
210 | { | ||
211 | struct mt9v011 *core = to_mt9v011(sd); | ||
212 | unsigned height, width, hblank, vblank; | ||
213 | unsigned row_time, line_time; | ||
214 | u64 t_time, speed; | ||
215 | |||
216 | /* Avoid bogus calculus */ | ||
217 | if (!numerator || !denominator) | ||
218 | return 0; | ||
219 | |||
220 | height = mt9v011_read(sd, R03_MT9V011_HEIGHT); | ||
221 | width = mt9v011_read(sd, R04_MT9V011_WIDTH); | ||
222 | hblank = mt9v011_read(sd, R05_MT9V011_HBLANK); | ||
223 | vblank = mt9v011_read(sd, R06_MT9V011_VBLANK); | ||
224 | |||
225 | row_time = width + 113 + hblank; | ||
226 | line_time = height + vblank + 1; | ||
227 | |||
228 | t_time = core->xtal * ((u64)numerator); | ||
229 | /* round to the closest value */ | ||
230 | t_time += denominator / 2; | ||
231 | do_div(t_time, denominator); | ||
232 | |||
233 | speed = t_time; | ||
234 | do_div(speed, row_time * line_time); | ||
235 | |||
236 | /* Avoid having a negative value for speed */ | ||
237 | if (speed < 2) | ||
238 | speed = 0; | ||
239 | else | ||
240 | speed -= 2; | ||
241 | |||
242 | /* Avoid speed overflow */ | ||
243 | if (speed > 15) | ||
244 | return 15; | ||
245 | |||
246 | return (u16)speed; | ||
182 | } | 247 | } |
183 | 248 | ||
184 | static void set_res(struct v4l2_subdev *sd) | 249 | static void set_res(struct v4l2_subdev *sd) |
@@ -207,9 +272,23 @@ static void set_res(struct v4l2_subdev *sd) | |||
207 | mt9v011_write(sd, R03_MT9V011_HEIGHT, core->height); | 272 | mt9v011_write(sd, R03_MT9V011_HEIGHT, core->height); |
208 | mt9v011_write(sd, R06_MT9V011_VBLANK, 508 - core->height); | 273 | mt9v011_write(sd, R06_MT9V011_VBLANK, 508 - core->height); |
209 | 274 | ||
210 | calc_fps(sd); | 275 | calc_fps(sd, NULL, NULL); |
211 | }; | 276 | }; |
212 | 277 | ||
278 | static void set_read_mode(struct v4l2_subdev *sd) | ||
279 | { | ||
280 | struct mt9v011 *core = to_mt9v011(sd); | ||
281 | unsigned mode = 0x1000; | ||
282 | |||
283 | if (core->hflip) | ||
284 | mode |= 0x4000; | ||
285 | |||
286 | if (core->vflip) | ||
287 | mode |= 0x8000; | ||
288 | |||
289 | mt9v011_write(sd, R20_MT9V011_READ_MODE, mode); | ||
290 | } | ||
291 | |||
213 | static int mt9v011_reset(struct v4l2_subdev *sd, u32 val) | 292 | static int mt9v011_reset(struct v4l2_subdev *sd, u32 val) |
214 | { | 293 | { |
215 | int i; | 294 | int i; |
@@ -220,6 +299,7 @@ static int mt9v011_reset(struct v4l2_subdev *sd, u32 val) | |||
220 | 299 | ||
221 | set_balance(sd); | 300 | set_balance(sd); |
222 | set_res(sd); | 301 | set_res(sd); |
302 | set_read_mode(sd); | ||
223 | 303 | ||
224 | return 0; | 304 | return 0; |
225 | }; | 305 | }; |
@@ -240,6 +320,12 @@ static int mt9v011_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
240 | case V4L2_CID_BLUE_BALANCE: | 320 | case V4L2_CID_BLUE_BALANCE: |
241 | ctrl->value = core->blue_bal; | 321 | ctrl->value = core->blue_bal; |
242 | return 0; | 322 | return 0; |
323 | case V4L2_CID_HFLIP: | ||
324 | ctrl->value = core->hflip ? 1 : 0; | ||
325 | return 0; | ||
326 | case V4L2_CID_VFLIP: | ||
327 | ctrl->value = core->vflip ? 1 : 0; | ||
328 | return 0; | ||
243 | } | 329 | } |
244 | return -EINVAL; | 330 | return -EINVAL; |
245 | } | 331 | } |
@@ -288,6 +374,14 @@ static int mt9v011_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
288 | case V4L2_CID_BLUE_BALANCE: | 374 | case V4L2_CID_BLUE_BALANCE: |
289 | core->blue_bal = ctrl->value; | 375 | core->blue_bal = ctrl->value; |
290 | break; | 376 | break; |
377 | case V4L2_CID_HFLIP: | ||
378 | core->hflip = ctrl->value; | ||
379 | set_read_mode(sd); | ||
380 | return 0; | ||
381 | case V4L2_CID_VFLIP: | ||
382 | core->vflip = ctrl->value; | ||
383 | set_read_mode(sd); | ||
384 | return 0; | ||
291 | default: | 385 | default: |
292 | return -EINVAL; | 386 | return -EINVAL; |
293 | } | 387 | } |
@@ -322,6 +416,44 @@ static int mt9v011_try_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | |||
322 | return 0; | 416 | return 0; |
323 | } | 417 | } |
324 | 418 | ||
419 | static int mt9v011_g_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) | ||
420 | { | ||
421 | struct v4l2_captureparm *cp = &parms->parm.capture; | ||
422 | |||
423 | if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
424 | return -EINVAL; | ||
425 | |||
426 | memset(cp, 0, sizeof(struct v4l2_captureparm)); | ||
427 | cp->capability = V4L2_CAP_TIMEPERFRAME; | ||
428 | calc_fps(sd, | ||
429 | &cp->timeperframe.numerator, | ||
430 | &cp->timeperframe.denominator); | ||
431 | |||
432 | return 0; | ||
433 | } | ||
434 | |||
435 | static int mt9v011_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) | ||
436 | { | ||
437 | struct v4l2_captureparm *cp = &parms->parm.capture; | ||
438 | struct v4l2_fract *tpf = &cp->timeperframe; | ||
439 | u16 speed; | ||
440 | |||
441 | if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
442 | return -EINVAL; | ||
443 | if (cp->extendedmode != 0) | ||
444 | return -EINVAL; | ||
445 | |||
446 | speed = calc_speed(sd, tpf->numerator, tpf->denominator); | ||
447 | |||
448 | mt9v011_write(sd, R0A_MT9V011_CLK_SPEED, speed); | ||
449 | v4l2_dbg(1, debug, sd, "Setting speed to %d\n", speed); | ||
450 | |||
451 | /* Recalculate and update fps info */ | ||
452 | calc_fps(sd, &tpf->numerator, &tpf->denominator); | ||
453 | |||
454 | return 0; | ||
455 | } | ||
456 | |||
325 | static int mt9v011_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | 457 | static int mt9v011_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) |
326 | { | 458 | { |
327 | struct v4l2_pix_format *pix = &fmt->fmt.pix; | 459 | struct v4l2_pix_format *pix = &fmt->fmt.pix; |
@@ -393,10 +525,13 @@ static int mt9v011_s_register(struct v4l2_subdev *sd, | |||
393 | static int mt9v011_g_chip_ident(struct v4l2_subdev *sd, | 525 | static int mt9v011_g_chip_ident(struct v4l2_subdev *sd, |
394 | struct v4l2_dbg_chip_ident *chip) | 526 | struct v4l2_dbg_chip_ident *chip) |
395 | { | 527 | { |
528 | u16 version; | ||
396 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 529 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
397 | 530 | ||
531 | version = mt9v011_read(sd, R00_MT9V011_CHIP_VERSION); | ||
532 | |||
398 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_MT9V011, | 533 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_MT9V011, |
399 | MT9V011_VERSION); | 534 | version); |
400 | } | 535 | } |
401 | 536 | ||
402 | static const struct v4l2_subdev_core_ops mt9v011_core_ops = { | 537 | static const struct v4l2_subdev_core_ops mt9v011_core_ops = { |
@@ -416,6 +551,8 @@ static const struct v4l2_subdev_video_ops mt9v011_video_ops = { | |||
416 | .enum_fmt = mt9v011_enum_fmt, | 551 | .enum_fmt = mt9v011_enum_fmt, |
417 | .try_fmt = mt9v011_try_fmt, | 552 | .try_fmt = mt9v011_try_fmt, |
418 | .s_fmt = mt9v011_s_fmt, | 553 | .s_fmt = mt9v011_s_fmt, |
554 | .g_parm = mt9v011_g_parm, | ||
555 | .s_parm = mt9v011_s_parm, | ||
419 | }; | 556 | }; |
420 | 557 | ||
421 | static const struct v4l2_subdev_ops mt9v011_ops = { | 558 | static const struct v4l2_subdev_ops mt9v011_ops = { |
@@ -449,8 +586,9 @@ static int mt9v011_probe(struct i2c_client *c, | |||
449 | 586 | ||
450 | /* Check if the sensor is really a MT9V011 */ | 587 | /* Check if the sensor is really a MT9V011 */ |
451 | version = mt9v011_read(sd, R00_MT9V011_CHIP_VERSION); | 588 | version = mt9v011_read(sd, R00_MT9V011_CHIP_VERSION); |
452 | if (version != MT9V011_VERSION) { | 589 | if ((version != MT9V011_VERSION) && |
453 | v4l2_info(sd, "*** unknown micron chip detected (0x%04x.\n", | 590 | (version != MT9V011_REV_B_VERSION)) { |
591 | v4l2_info(sd, "*** unknown micron chip detected (0x%04x).\n", | ||
454 | version); | 592 | version); |
455 | kfree(core); | 593 | kfree(core); |
456 | return -EINVAL; | 594 | return -EINVAL; |
@@ -461,8 +599,8 @@ static int mt9v011_probe(struct i2c_client *c, | |||
461 | core->height = 480; | 599 | core->height = 480; |
462 | core->xtal = 27000000; /* Hz */ | 600 | core->xtal = 27000000; /* Hz */ |
463 | 601 | ||
464 | v4l_info(c, "chip found @ 0x%02x (%s)\n", | 602 | v4l_info(c, "chip found @ 0x%02x (%s - chip version 0x%04x)\n", |
465 | c->addr << 1, c->adapter->name); | 603 | c->addr << 1, c->adapter->name, version); |
466 | 604 | ||
467 | return 0; | 605 | return 0; |
468 | } | 606 | } |
diff --git a/drivers/media/video/mt9v011.h b/drivers/media/video/mt9v011.h index 9e443ee30558..3350fd6083c3 100644 --- a/drivers/media/video/mt9v011.h +++ b/drivers/media/video/mt9v011.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define R35_MT9V011_GLOBAL_GAIN 0x35 | 30 | #define R35_MT9V011_GLOBAL_GAIN 0x35 |
31 | #define RF1_MT9V011_CHIP_ENABLE 0xf1 | 31 | #define RF1_MT9V011_CHIP_ENABLE 0xf1 |
32 | 32 | ||
33 | #define MT9V011_VERSION 0x8243 | 33 | #define MT9V011_VERSION 0x8232 |
34 | #define MT9V011_REV_B_VERSION 0x8243 | ||
34 | 35 | ||
35 | #endif | 36 | #endif |
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 2d075205bdfe..736c31d23194 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c | |||
@@ -234,6 +234,7 @@ static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev) | |||
234 | return ret; | 234 | return ret; |
235 | } | 235 | } |
236 | 236 | ||
237 | /* Called under spinlock_irqsave(&pcdev->lock, ...) */ | ||
237 | static void mx1_videobuf_queue(struct videobuf_queue *vq, | 238 | static void mx1_videobuf_queue(struct videobuf_queue *vq, |
238 | struct videobuf_buffer *vb) | 239 | struct videobuf_buffer *vb) |
239 | { | 240 | { |
@@ -241,13 +242,10 @@ static void mx1_videobuf_queue(struct videobuf_queue *vq, | |||
241 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 242 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
242 | struct mx1_camera_dev *pcdev = ici->priv; | 243 | struct mx1_camera_dev *pcdev = ici->priv; |
243 | struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); | 244 | struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); |
244 | unsigned long flags; | ||
245 | 245 | ||
246 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 246 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
247 | vb, vb->baddr, vb->bsize); | 247 | vb, vb->baddr, vb->bsize); |
248 | 248 | ||
249 | spin_lock_irqsave(&pcdev->lock, flags); | ||
250 | |||
251 | list_add_tail(&vb->queue, &pcdev->capture); | 249 | list_add_tail(&vb->queue, &pcdev->capture); |
252 | 250 | ||
253 | vb->state = VIDEOBUF_ACTIVE; | 251 | vb->state = VIDEOBUF_ACTIVE; |
@@ -264,8 +262,6 @@ static void mx1_videobuf_queue(struct videobuf_queue *vq, | |||
264 | __raw_writel(temp, pcdev->base + CSICR1); | 262 | __raw_writel(temp, pcdev->base + CSICR1); |
265 | } | 263 | } |
266 | } | 264 | } |
267 | |||
268 | spin_unlock_irqrestore(&pcdev->lock, flags); | ||
269 | } | 265 | } |
270 | 266 | ||
271 | static void mx1_videobuf_release(struct videobuf_queue *vq, | 267 | static void mx1_videobuf_release(struct videobuf_queue *vq, |
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index e605c076ed89..9770cb7932ca 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -332,7 +332,10 @@ static enum pixel_fmt fourcc_to_ipu_pix(__u32 fourcc) | |||
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | /* Called with .vb_lock held */ | 335 | /* |
336 | * Called with .vb_lock mutex held and | ||
337 | * under spinlock_irqsave(&mx3_cam->lock, ...) | ||
338 | */ | ||
336 | static void mx3_videobuf_queue(struct videobuf_queue *vq, | 339 | static void mx3_videobuf_queue(struct videobuf_queue *vq, |
337 | struct videobuf_buffer *vb) | 340 | struct videobuf_buffer *vb) |
338 | { | 341 | { |
@@ -346,7 +349,8 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq, | |||
346 | struct idmac_video_param *video = &ichan->params.video; | 349 | struct idmac_video_param *video = &ichan->params.video; |
347 | const struct soc_camera_data_format *data_fmt = icd->current_fmt; | 350 | const struct soc_camera_data_format *data_fmt = icd->current_fmt; |
348 | dma_cookie_t cookie; | 351 | dma_cookie_t cookie; |
349 | unsigned long flags; | 352 | |
353 | BUG_ON(!irqs_disabled()); | ||
350 | 354 | ||
351 | /* This is the configuration of one sg-element */ | 355 | /* This is the configuration of one sg-element */ |
352 | video->out_pixel_fmt = fourcc_to_ipu_pix(data_fmt->fourcc); | 356 | video->out_pixel_fmt = fourcc_to_ipu_pix(data_fmt->fourcc); |
@@ -359,8 +363,6 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq, | |||
359 | memset((void *)vb->baddr, 0xaa, vb->bsize); | 363 | memset((void *)vb->baddr, 0xaa, vb->bsize); |
360 | #endif | 364 | #endif |
361 | 365 | ||
362 | spin_lock_irqsave(&mx3_cam->lock, flags); | ||
363 | |||
364 | list_add_tail(&vb->queue, &mx3_cam->capture); | 366 | list_add_tail(&vb->queue, &mx3_cam->capture); |
365 | 367 | ||
366 | if (!mx3_cam->active) { | 368 | if (!mx3_cam->active) { |
@@ -370,24 +372,23 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq, | |||
370 | vb->state = VIDEOBUF_QUEUED; | 372 | vb->state = VIDEOBUF_QUEUED; |
371 | } | 373 | } |
372 | 374 | ||
373 | spin_unlock_irqrestore(&mx3_cam->lock, flags); | 375 | spin_unlock_irq(&mx3_cam->lock); |
374 | 376 | ||
375 | cookie = txd->tx_submit(txd); | 377 | cookie = txd->tx_submit(txd); |
376 | dev_dbg(&icd->dev, "Submitted cookie %d DMA 0x%08x\n", cookie, sg_dma_address(&buf->sg)); | 378 | dev_dbg(&icd->dev, "Submitted cookie %d DMA 0x%08x\n", cookie, sg_dma_address(&buf->sg)); |
379 | |||
380 | spin_lock_irq(&mx3_cam->lock); | ||
381 | |||
377 | if (cookie >= 0) | 382 | if (cookie >= 0) |
378 | return; | 383 | return; |
379 | 384 | ||
380 | /* Submit error */ | 385 | /* Submit error */ |
381 | vb->state = VIDEOBUF_PREPARED; | 386 | vb->state = VIDEOBUF_PREPARED; |
382 | 387 | ||
383 | spin_lock_irqsave(&mx3_cam->lock, flags); | ||
384 | |||
385 | list_del_init(&vb->queue); | 388 | list_del_init(&vb->queue); |
386 | 389 | ||
387 | if (mx3_cam->active == buf) | 390 | if (mx3_cam->active == buf) |
388 | mx3_cam->active = NULL; | 391 | mx3_cam->active = NULL; |
389 | |||
390 | spin_unlock_irqrestore(&mx3_cam->lock, flags); | ||
391 | } | 392 | } |
392 | 393 | ||
393 | /* Called with .vb_lock held */ | 394 | /* Called with .vb_lock held */ |
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index 46e0d8ad880f..016bb45ba0c3 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
@@ -612,6 +612,7 @@ static void pxa_camera_stop_capture(struct pxa_camera_dev *pcdev) | |||
612 | dev_dbg(pcdev->soc_host.dev, "%s\n", __func__); | 612 | dev_dbg(pcdev->soc_host.dev, "%s\n", __func__); |
613 | } | 613 | } |
614 | 614 | ||
615 | /* Called under spinlock_irqsave(&pcdev->lock, ...) */ | ||
615 | static void pxa_videobuf_queue(struct videobuf_queue *vq, | 616 | static void pxa_videobuf_queue(struct videobuf_queue *vq, |
616 | struct videobuf_buffer *vb) | 617 | struct videobuf_buffer *vb) |
617 | { | 618 | { |
@@ -619,13 +620,10 @@ static void pxa_videobuf_queue(struct videobuf_queue *vq, | |||
619 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 620 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
620 | struct pxa_camera_dev *pcdev = ici->priv; | 621 | struct pxa_camera_dev *pcdev = ici->priv; |
621 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); | 622 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); |
622 | unsigned long flags; | ||
623 | 623 | ||
624 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d active=%p\n", __func__, | 624 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d active=%p\n", __func__, |
625 | vb, vb->baddr, vb->bsize, pcdev->active); | 625 | vb, vb->baddr, vb->bsize, pcdev->active); |
626 | 626 | ||
627 | spin_lock_irqsave(&pcdev->lock, flags); | ||
628 | |||
629 | list_add_tail(&vb->queue, &pcdev->capture); | 627 | list_add_tail(&vb->queue, &pcdev->capture); |
630 | 628 | ||
631 | vb->state = VIDEOBUF_ACTIVE; | 629 | vb->state = VIDEOBUF_ACTIVE; |
@@ -633,8 +631,6 @@ static void pxa_videobuf_queue(struct videobuf_queue *vq, | |||
633 | 631 | ||
634 | if (!pcdev->active) | 632 | if (!pcdev->active) |
635 | pxa_camera_start_capture(pcdev); | 633 | pxa_camera_start_capture(pcdev); |
636 | |||
637 | spin_unlock_irqrestore(&pcdev->lock, flags); | ||
638 | } | 634 | } |
639 | 635 | ||
640 | static void pxa_videobuf_release(struct videobuf_queue *vq, | 636 | static void pxa_videobuf_release(struct videobuf_queue *vq, |
@@ -1579,6 +1575,7 @@ static int __devinit pxa_camera_probe(struct platform_device *pdev) | |||
1579 | pcdev->mclk = 20000000; | 1575 | pcdev->mclk = 20000000; |
1580 | } | 1576 | } |
1581 | 1577 | ||
1578 | pcdev->soc_host.dev = &pdev->dev; | ||
1582 | pcdev->mclk_divisor = mclk_get_divisor(pcdev); | 1579 | pcdev->mclk_divisor = mclk_get_divisor(pcdev); |
1583 | 1580 | ||
1584 | INIT_LIST_HEAD(&pcdev->capture); | 1581 | INIT_LIST_HEAD(&pcdev->capture); |
@@ -1644,7 +1641,6 @@ static int __devinit pxa_camera_probe(struct platform_device *pdev) | |||
1644 | pcdev->soc_host.drv_name = PXA_CAM_DRV_NAME; | 1641 | pcdev->soc_host.drv_name = PXA_CAM_DRV_NAME; |
1645 | pcdev->soc_host.ops = &pxa_soc_camera_host_ops; | 1642 | pcdev->soc_host.ops = &pxa_soc_camera_host_ops; |
1646 | pcdev->soc_host.priv = pcdev; | 1643 | pcdev->soc_host.priv = pcdev; |
1647 | pcdev->soc_host.dev = &pdev->dev; | ||
1648 | pcdev->soc_host.nr = pdev->id; | 1644 | pcdev->soc_host.nr = pdev->id; |
1649 | 1645 | ||
1650 | err = soc_camera_host_register(&pcdev->soc_host); | 1646 | err = soc_camera_host_register(&pcdev->soc_host); |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 06861b782b95..6eebe3ef97d3 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -3331,8 +3331,8 @@ struct saa7134_board saa7134_boards[] = { | |||
3331 | .gpio = 0x0200100, | 3331 | .gpio = 0x0200100, |
3332 | }, | 3332 | }, |
3333 | }, | 3333 | }, |
3334 | [SAA7134_BOARD_HAUPPAUGE_HVR1120] = { | 3334 | [SAA7134_BOARD_HAUPPAUGE_HVR1150] = { |
3335 | .name = "Hauppauge WinTV-HVR1120 ATSC/QAM-Hybrid", | 3335 | .name = "Hauppauge WinTV-HVR1150 ATSC/QAM-Hybrid", |
3336 | .audio_clock = 0x00187de7, | 3336 | .audio_clock = 0x00187de7, |
3337 | .tuner_type = TUNER_PHILIPS_TDA8290, | 3337 | .tuner_type = TUNER_PHILIPS_TDA8290, |
3338 | .radio_type = UNSET, | 3338 | .radio_type = UNSET, |
@@ -3363,8 +3363,8 @@ struct saa7134_board saa7134_boards[] = { | |||
3363 | .gpio = 0x0800100, /* GPIO 23 HI for FM */ | 3363 | .gpio = 0x0800100, /* GPIO 23 HI for FM */ |
3364 | }, | 3364 | }, |
3365 | }, | 3365 | }, |
3366 | [SAA7134_BOARD_HAUPPAUGE_HVR1110R3] = { | 3366 | [SAA7134_BOARD_HAUPPAUGE_HVR1120] = { |
3367 | .name = "Hauppauge WinTV-HVR1110r3 DVB-T/Hybrid", | 3367 | .name = "Hauppauge WinTV-HVR1120 DVB-T/Hybrid", |
3368 | .audio_clock = 0x00187de7, | 3368 | .audio_clock = 0x00187de7, |
3369 | .tuner_type = TUNER_PHILIPS_TDA8290, | 3369 | .tuner_type = TUNER_PHILIPS_TDA8290, |
3370 | .radio_type = UNSET, | 3370 | .radio_type = UNSET, |
@@ -5862,31 +5862,31 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
5862 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 5862 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
5863 | .subvendor = 0x0070, | 5863 | .subvendor = 0x0070, |
5864 | .subdevice = 0x6706, | 5864 | .subdevice = 0x6706, |
5865 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1120, | 5865 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1150, |
5866 | },{ | 5866 | },{ |
5867 | .vendor = PCI_VENDOR_ID_PHILIPS, | 5867 | .vendor = PCI_VENDOR_ID_PHILIPS, |
5868 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 5868 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
5869 | .subvendor = 0x0070, | 5869 | .subvendor = 0x0070, |
5870 | .subdevice = 0x6707, | 5870 | .subdevice = 0x6707, |
5871 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1110R3, | 5871 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1120, |
5872 | },{ | 5872 | },{ |
5873 | .vendor = PCI_VENDOR_ID_PHILIPS, | 5873 | .vendor = PCI_VENDOR_ID_PHILIPS, |
5874 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 5874 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
5875 | .subvendor = 0x0070, | 5875 | .subvendor = 0x0070, |
5876 | .subdevice = 0x6708, | 5876 | .subdevice = 0x6708, |
5877 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1120, | 5877 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1150, |
5878 | },{ | 5878 | },{ |
5879 | .vendor = PCI_VENDOR_ID_PHILIPS, | 5879 | .vendor = PCI_VENDOR_ID_PHILIPS, |
5880 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 5880 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
5881 | .subvendor = 0x0070, | 5881 | .subvendor = 0x0070, |
5882 | .subdevice = 0x6709, | 5882 | .subdevice = 0x6709, |
5883 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1110R3, | 5883 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1120, |
5884 | },{ | 5884 | },{ |
5885 | .vendor = PCI_VENDOR_ID_PHILIPS, | 5885 | .vendor = PCI_VENDOR_ID_PHILIPS, |
5886 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 5886 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
5887 | .subvendor = 0x0070, | 5887 | .subvendor = 0x0070, |
5888 | .subdevice = 0x670a, | 5888 | .subdevice = 0x670a, |
5889 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1110R3, | 5889 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1120, |
5890 | },{ | 5890 | },{ |
5891 | .vendor = PCI_VENDOR_ID_PHILIPS, | 5891 | .vendor = PCI_VENDOR_ID_PHILIPS, |
5892 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 5892 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
@@ -6363,8 +6363,8 @@ static int saa7134_tda8290_18271_callback(struct saa7134_dev *dev, | |||
6363 | switch (command) { | 6363 | switch (command) { |
6364 | case TDA18271_CALLBACK_CMD_AGC_ENABLE: /* 0 */ | 6364 | case TDA18271_CALLBACK_CMD_AGC_ENABLE: /* 0 */ |
6365 | switch (dev->board) { | 6365 | switch (dev->board) { |
6366 | case SAA7134_BOARD_HAUPPAUGE_HVR1150: | ||
6366 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: | 6367 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: |
6367 | case SAA7134_BOARD_HAUPPAUGE_HVR1110R3: | ||
6368 | ret = saa7134_tda18271_hvr11x0_toggle_agc(dev, arg); | 6368 | ret = saa7134_tda18271_hvr11x0_toggle_agc(dev, arg); |
6369 | break; | 6369 | break; |
6370 | default: | 6370 | default: |
@@ -6384,8 +6384,8 @@ static int saa7134_tda8290_callback(struct saa7134_dev *dev, | |||
6384 | int ret; | 6384 | int ret; |
6385 | 6385 | ||
6386 | switch (dev->board) { | 6386 | switch (dev->board) { |
6387 | case SAA7134_BOARD_HAUPPAUGE_HVR1150: | ||
6387 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: | 6388 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: |
6388 | case SAA7134_BOARD_HAUPPAUGE_HVR1110R3: | ||
6389 | /* tda8290 + tda18271 */ | 6389 | /* tda8290 + tda18271 */ |
6390 | ret = saa7134_tda8290_18271_callback(dev, command, arg); | 6390 | ret = saa7134_tda8290_18271_callback(dev, command, arg); |
6391 | break; | 6391 | break; |
@@ -6427,7 +6427,7 @@ static void hauppauge_eeprom(struct saa7134_dev *dev, u8 *eeprom_data) | |||
6427 | switch (tv.model) { | 6427 | switch (tv.model) { |
6428 | case 67019: /* WinTV-HVR1110 (Retail, IR Blaster, hybrid, FM, SVid/Comp, 3.5mm audio in) */ | 6428 | case 67019: /* WinTV-HVR1110 (Retail, IR Blaster, hybrid, FM, SVid/Comp, 3.5mm audio in) */ |
6429 | case 67109: /* WinTV-HVR1000 (Retail, IR Receive, analog, no FM, SVid/Comp, 3.5mm audio in) */ | 6429 | case 67109: /* WinTV-HVR1000 (Retail, IR Receive, analog, no FM, SVid/Comp, 3.5mm audio in) */ |
6430 | case 67201: /* WinTV-HVR1120 (Retail, IR Receive, hybrid, FM, SVid/Comp, 3.5mm audio in) */ | 6430 | case 67201: /* WinTV-HVR1150 (Retail, IR Receive, hybrid, FM, SVid/Comp, 3.5mm audio in) */ |
6431 | case 67301: /* WinTV-HVR1000 (Retail, IR Receive, analog, no FM, SVid/Comp, 3.5mm audio in) */ | 6431 | case 67301: /* WinTV-HVR1000 (Retail, IR Receive, analog, no FM, SVid/Comp, 3.5mm audio in) */ |
6432 | case 67209: /* WinTV-HVR1110 (Retail, IR Receive, hybrid, FM, SVid/Comp, 3.5mm audio in) */ | 6432 | case 67209: /* WinTV-HVR1110 (Retail, IR Receive, hybrid, FM, SVid/Comp, 3.5mm audio in) */ |
6433 | case 67559: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ | 6433 | case 67559: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ |
@@ -6435,7 +6435,7 @@ static void hauppauge_eeprom(struct saa7134_dev *dev, u8 *eeprom_data) | |||
6435 | case 67579: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM) */ | 6435 | case 67579: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM) */ |
6436 | case 67589: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */ | 6436 | case 67589: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */ |
6437 | case 67599: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */ | 6437 | case 67599: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */ |
6438 | case 67651: /* WinTV-HVR1120 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ | 6438 | case 67651: /* WinTV-HVR1150 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ |
6439 | case 67659: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ | 6439 | case 67659: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ |
6440 | break; | 6440 | break; |
6441 | default: | 6441 | default: |
@@ -6625,8 +6625,8 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
6625 | 6625 | ||
6626 | saa_writeb (SAA7134_PRODUCTION_TEST_MODE, 0x00); | 6626 | saa_writeb (SAA7134_PRODUCTION_TEST_MODE, 0x00); |
6627 | break; | 6627 | break; |
6628 | case SAA7134_BOARD_HAUPPAUGE_HVR1150: | ||
6628 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: | 6629 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: |
6629 | case SAA7134_BOARD_HAUPPAUGE_HVR1110R3: | ||
6630 | /* GPIO 26 high for digital, low for analog */ | 6630 | /* GPIO 26 high for digital, low for analog */ |
6631 | saa7134_set_gpio(dev, 26, 0); | 6631 | saa7134_set_gpio(dev, 26, 0); |
6632 | msleep(1); | 6632 | msleep(1); |
@@ -6891,8 +6891,8 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
6891 | dev->name, saa7134_boards[dev->board].name); | 6891 | dev->name, saa7134_boards[dev->board].name); |
6892 | } | 6892 | } |
6893 | break; | 6893 | break; |
6894 | case SAA7134_BOARD_HAUPPAUGE_HVR1150: | ||
6894 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: | 6895 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: |
6895 | case SAA7134_BOARD_HAUPPAUGE_HVR1110R3: | ||
6896 | hauppauge_eeprom(dev, dev->eedata+0x80); | 6896 | hauppauge_eeprom(dev, dev->eedata+0x80); |
6897 | break; | 6897 | break; |
6898 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: | 6898 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 31930f26ffc7..98f3efd1e944 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -1119,7 +1119,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1119 | &tda827x_cfg_2) < 0) | 1119 | &tda827x_cfg_2) < 0) |
1120 | goto dettach_frontend; | 1120 | goto dettach_frontend; |
1121 | break; | 1121 | break; |
1122 | case SAA7134_BOARD_HAUPPAUGE_HVR1110R3: | 1122 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: |
1123 | fe0->dvb.frontend = dvb_attach(tda10048_attach, | 1123 | fe0->dvb.frontend = dvb_attach(tda10048_attach, |
1124 | &hcw_tda10048_config, | 1124 | &hcw_tda10048_config, |
1125 | &dev->i2c_adap); | 1125 | &dev->i2c_adap); |
@@ -1147,7 +1147,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1147 | &tda827x_cfg_1) < 0) | 1147 | &tda827x_cfg_1) < 0) |
1148 | goto dettach_frontend; | 1148 | goto dettach_frontend; |
1149 | break; | 1149 | break; |
1150 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: | 1150 | case SAA7134_BOARD_HAUPPAUGE_HVR1150: |
1151 | fe0->dvb.frontend = dvb_attach(lgdt3305_attach, | 1151 | fe0->dvb.frontend = dvb_attach(lgdt3305_attach, |
1152 | &hcw_lgdt3305_config, | 1152 | &hcw_lgdt3305_config, |
1153 | &dev->i2c_adap); | 1153 | &dev->i2c_adap); |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 82268848f26a..fb564f14887c 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -278,8 +278,8 @@ struct saa7134_format { | |||
278 | #define SAA7134_BOARD_ASUSTeK_TIGER 152 | 278 | #define SAA7134_BOARD_ASUSTeK_TIGER 152 |
279 | #define SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG 153 | 279 | #define SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG 153 |
280 | #define SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS 154 | 280 | #define SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS 154 |
281 | #define SAA7134_BOARD_HAUPPAUGE_HVR1120 155 | 281 | #define SAA7134_BOARD_HAUPPAUGE_HVR1150 155 |
282 | #define SAA7134_BOARD_HAUPPAUGE_HVR1110R3 156 | 282 | #define SAA7134_BOARD_HAUPPAUGE_HVR1120 156 |
283 | #define SAA7134_BOARD_AVERMEDIA_STUDIO_507UA 157 | 283 | #define SAA7134_BOARD_AVERMEDIA_STUDIO_507UA 157 |
284 | #define SAA7134_BOARD_AVERMEDIA_CARDBUS_501 158 | 284 | #define SAA7134_BOARD_AVERMEDIA_CARDBUS_501 158 |
285 | #define SAA7134_BOARD_BEHOLD_505RDS 159 | 285 | #define SAA7134_BOARD_BEHOLD_505RDS 159 |
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 0db88a53d92c..e86878deea71 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -282,27 +282,24 @@ out: | |||
282 | return ret; | 282 | return ret; |
283 | } | 283 | } |
284 | 284 | ||
285 | /* Called under spinlock_irqsave(&pcdev->lock, ...) */ | ||
285 | static void sh_mobile_ceu_videobuf_queue(struct videobuf_queue *vq, | 286 | static void sh_mobile_ceu_videobuf_queue(struct videobuf_queue *vq, |
286 | struct videobuf_buffer *vb) | 287 | struct videobuf_buffer *vb) |
287 | { | 288 | { |
288 | struct soc_camera_device *icd = vq->priv_data; | 289 | struct soc_camera_device *icd = vq->priv_data; |
289 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 290 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
290 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 291 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
291 | unsigned long flags; | ||
292 | 292 | ||
293 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, | 293 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, |
294 | vb, vb->baddr, vb->bsize); | 294 | vb, vb->baddr, vb->bsize); |
295 | 295 | ||
296 | vb->state = VIDEOBUF_QUEUED; | 296 | vb->state = VIDEOBUF_QUEUED; |
297 | spin_lock_irqsave(&pcdev->lock, flags); | ||
298 | list_add_tail(&vb->queue, &pcdev->capture); | 297 | list_add_tail(&vb->queue, &pcdev->capture); |
299 | 298 | ||
300 | if (!pcdev->active) { | 299 | if (!pcdev->active) { |
301 | pcdev->active = vb; | 300 | pcdev->active = vb; |
302 | sh_mobile_ceu_capture(pcdev); | 301 | sh_mobile_ceu_capture(pcdev); |
303 | } | 302 | } |
304 | |||
305 | spin_unlock_irqrestore(&pcdev->lock, flags); | ||
306 | } | 303 | } |
307 | 304 | ||
308 | static void sh_mobile_ceu_videobuf_release(struct videobuf_queue *vq, | 305 | static void sh_mobile_ceu_videobuf_release(struct videobuf_queue *vq, |
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c index 4d6785e63455..b154bd961e3b 100644 --- a/drivers/media/video/stk-webcam.c +++ b/drivers/media/video/stk-webcam.c | |||
@@ -1050,8 +1050,8 @@ static int stk_setup_format(struct stk_camera *dev) | |||
1050 | depth = 1; | 1050 | depth = 1; |
1051 | else | 1051 | else |
1052 | depth = 2; | 1052 | depth = 2; |
1053 | while (stk_sizes[i].m != dev->vsettings.mode | 1053 | while (i < ARRAY_SIZE(stk_sizes) && |
1054 | && i < ARRAY_SIZE(stk_sizes)) | 1054 | stk_sizes[i].m != dev->vsettings.mode) |
1055 | i++; | 1055 | i++; |
1056 | if (i == ARRAY_SIZE(stk_sizes)) { | 1056 | if (i == ARRAY_SIZE(stk_sizes)) { |
1057 | STK_ERROR("Something is broken in %s\n", __func__); | 1057 | STK_ERROR("Something is broken in %s\n", __func__); |
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c index 89927b7aec28..04b47832fa0a 100644 --- a/drivers/media/video/uvc/uvc_driver.c +++ b/drivers/media/video/uvc/uvc_driver.c | |||
@@ -1845,11 +1845,29 @@ static struct usb_device_id uvc_ids[] = { | |||
1845 | .bInterfaceSubClass = 1, | 1845 | .bInterfaceSubClass = 1, |
1846 | .bInterfaceProtocol = 0, | 1846 | .bInterfaceProtocol = 0, |
1847 | .driver_info = UVC_QUIRK_STREAM_NO_FID }, | 1847 | .driver_info = UVC_QUIRK_STREAM_NO_FID }, |
1848 | /* ViMicro */ | 1848 | /* ViMicro Vega */ |
1849 | { .match_flags = USB_DEVICE_ID_MATCH_VENDOR | 1849 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
1850 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
1851 | .idVendor = 0x0ac8, | ||
1852 | .idProduct = 0x332d, | ||
1853 | .bInterfaceClass = USB_CLASS_VIDEO, | ||
1854 | .bInterfaceSubClass = 1, | ||
1855 | .bInterfaceProtocol = 0, | ||
1856 | .driver_info = UVC_QUIRK_FIX_BANDWIDTH }, | ||
1857 | /* ViMicro - Minoru3D */ | ||
1858 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | ||
1859 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
1860 | .idVendor = 0x0ac8, | ||
1861 | .idProduct = 0x3410, | ||
1862 | .bInterfaceClass = USB_CLASS_VIDEO, | ||
1863 | .bInterfaceSubClass = 1, | ||
1864 | .bInterfaceProtocol = 0, | ||
1865 | .driver_info = UVC_QUIRK_FIX_BANDWIDTH }, | ||
1866 | /* ViMicro Venus - Minoru3D */ | ||
1867 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | ||
1850 | | USB_DEVICE_ID_MATCH_INT_INFO, | 1868 | | USB_DEVICE_ID_MATCH_INT_INFO, |
1851 | .idVendor = 0x0ac8, | 1869 | .idVendor = 0x0ac8, |
1852 | .idProduct = 0x0000, | 1870 | .idProduct = 0x3420, |
1853 | .bInterfaceClass = USB_CLASS_VIDEO, | 1871 | .bInterfaceClass = USB_CLASS_VIDEO, |
1854 | .bInterfaceSubClass = 1, | 1872 | .bInterfaceSubClass = 1, |
1855 | .bInterfaceProtocol = 0, | 1873 | .bInterfaceProtocol = 0, |
diff --git a/drivers/media/video/uvc/uvc_status.c b/drivers/media/video/uvc/uvc_status.c index f152a9903862..1ca6dff73612 100644 --- a/drivers/media/video/uvc/uvc_status.c +++ b/drivers/media/video/uvc/uvc_status.c | |||
@@ -145,8 +145,8 @@ static void uvc_status_complete(struct urb *urb) | |||
145 | break; | 145 | break; |
146 | 146 | ||
147 | default: | 147 | default: |
148 | uvc_printk(KERN_INFO, "unknown event type %u.\n", | 148 | uvc_trace(UVC_TRACE_STATUS, "Unknown status event " |
149 | dev->status[0]); | 149 | "type %u.\n", dev->status[0]); |
150 | break; | 150 | break; |
151 | } | 151 | } |
152 | } | 152 | } |
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index be64a502ea27..f2afc4e08379 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c | |||
@@ -1081,8 +1081,10 @@ static long __video_do_ioctl(struct file *file, | |||
1081 | /* Calls the specific handler */ | 1081 | /* Calls the specific handler */ |
1082 | if (ops->vidioc_g_std) | 1082 | if (ops->vidioc_g_std) |
1083 | ret = ops->vidioc_g_std(file, fh, id); | 1083 | ret = ops->vidioc_g_std(file, fh, id); |
1084 | else | 1084 | else if (vfd->current_norm) |
1085 | *id = vfd->current_norm; | 1085 | *id = vfd->current_norm; |
1086 | else | ||
1087 | ret = -EINVAL; | ||
1086 | 1088 | ||
1087 | if (!ret) | 1089 | if (!ret) |
1088 | dbgarg(cmd, "std=0x%08Lx\n", (long long unsigned)*id); | 1090 | dbgarg(cmd, "std=0x%08Lx\n", (long long unsigned)*id); |
@@ -1553,12 +1555,19 @@ static long __video_do_ioctl(struct file *file, | |||
1553 | break; | 1555 | break; |
1554 | ret = ops->vidioc_g_parm(file, fh, p); | 1556 | ret = ops->vidioc_g_parm(file, fh, p); |
1555 | } else { | 1557 | } else { |
1558 | v4l2_std_id std = vfd->current_norm; | ||
1559 | |||
1556 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1560 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1557 | return -EINVAL; | 1561 | return -EINVAL; |
1558 | 1562 | ||
1559 | v4l2_video_std_frame_period(vfd->current_norm, | ||
1560 | &p->parm.capture.timeperframe); | ||
1561 | ret = 0; | 1563 | ret = 0; |
1564 | if (ops->vidioc_g_std) | ||
1565 | ret = ops->vidioc_g_std(file, fh, &std); | ||
1566 | else if (std == 0) | ||
1567 | ret = -EINVAL; | ||
1568 | if (ret == 0) | ||
1569 | v4l2_video_std_frame_period(std, | ||
1570 | &p->parm.capture.timeperframe); | ||
1562 | } | 1571 | } |
1563 | 1572 | ||
1564 | dbgarg(cmd, "type=%d\n", p->type); | 1573 | dbgarg(cmd, "type=%d\n", p->type); |
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c index fc976f42f432..2622a6e63da1 100644 --- a/drivers/media/video/zr364xx.c +++ b/drivers/media/video/zr364xx.c | |||
@@ -695,7 +695,7 @@ static int zr364xx_release(struct file *file) | |||
695 | for (i = 0; i < 2; i++) { | 695 | for (i = 0; i < 2; i++) { |
696 | err = | 696 | err = |
697 | send_control_msg(udev, 1, init[cam->method][i].value, | 697 | send_control_msg(udev, 1, init[cam->method][i].value, |
698 | 0, init[i][cam->method].bytes, | 698 | 0, init[cam->method][i].bytes, |
699 | init[cam->method][i].size); | 699 | init[cam->method][i].size); |
700 | if (err < 0) { | 700 | if (err < 0) { |
701 | dev_err(&udev->dev, "error during release sequence\n"); | 701 | dev_err(&udev->dev, "error during release sequence\n"); |
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index ae5fe91867e1..10ed195c0c1c 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -736,7 +736,7 @@ static int __devinit m25p_probe(struct spi_device *spi) | |||
736 | flash->partitioned = 1; | 736 | flash->partitioned = 1; |
737 | return add_mtd_partitions(&flash->mtd, parts, nr_parts); | 737 | return add_mtd_partitions(&flash->mtd, parts, nr_parts); |
738 | } | 738 | } |
739 | } else if (data->nr_parts) | 739 | } else if (data && data->nr_parts) |
740 | dev_warn(&spi->dev, "ignoring %d default partitions on %s\n", | 740 | dev_warn(&spi->dev, "ignoring %d default partitions on %s\n", |
741 | data->nr_parts, data->name); | 741 | data->nr_parts, data->name); |
742 | 742 | ||
diff --git a/drivers/mtd/maps/sbc8240.c b/drivers/mtd/maps/sbc8240.c deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/drivers/mtd/maps/sbc8240.c +++ /dev/null | |||
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c index 7ad972229db4..0d9d4bc9c762 100644 --- a/drivers/mtd/nand/orion_nand.c +++ b/drivers/mtd/nand/orion_nand.c | |||
@@ -61,7 +61,7 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) | |||
61 | buf64 = (uint64_t *)buf; | 61 | buf64 = (uint64_t *)buf; |
62 | while (i < len/8) { | 62 | while (i < len/8) { |
63 | uint64_t x; | 63 | uint64_t x; |
64 | asm ("ldrd\t%0, [%1]" : "=r" (x) : "r" (io_base)); | 64 | asm volatile ("ldrd\t%0, [%1]" : "=&r" (x) : "r" (io_base)); |
65 | buf64[i++] = x; | 65 | buf64[i++] = x; |
66 | } | 66 | } |
67 | i *= 8; | 67 | i *= 8; |
diff --git a/drivers/mtd/nftlcore.c b/drivers/mtd/nftlcore.c index fb86cacd5bdb..1002e1882996 100644 --- a/drivers/mtd/nftlcore.c +++ b/drivers/mtd/nftlcore.c | |||
@@ -135,16 +135,17 @@ static void nftl_remove_dev(struct mtd_blktrans_dev *dev) | |||
135 | int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len, | 135 | int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len, |
136 | size_t *retlen, uint8_t *buf) | 136 | size_t *retlen, uint8_t *buf) |
137 | { | 137 | { |
138 | loff_t mask = mtd->writesize - 1; | ||
138 | struct mtd_oob_ops ops; | 139 | struct mtd_oob_ops ops; |
139 | int res; | 140 | int res; |
140 | 141 | ||
141 | ops.mode = MTD_OOB_PLACE; | 142 | ops.mode = MTD_OOB_PLACE; |
142 | ops.ooboffs = offs & (mtd->writesize - 1); | 143 | ops.ooboffs = offs & mask; |
143 | ops.ooblen = len; | 144 | ops.ooblen = len; |
144 | ops.oobbuf = buf; | 145 | ops.oobbuf = buf; |
145 | ops.datbuf = NULL; | 146 | ops.datbuf = NULL; |
146 | 147 | ||
147 | res = mtd->read_oob(mtd, offs & ~(mtd->writesize - 1), &ops); | 148 | res = mtd->read_oob(mtd, offs & ~mask, &ops); |
148 | *retlen = ops.oobretlen; | 149 | *retlen = ops.oobretlen; |
149 | return res; | 150 | return res; |
150 | } | 151 | } |
@@ -155,16 +156,17 @@ int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len, | |||
155 | int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len, | 156 | int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len, |
156 | size_t *retlen, uint8_t *buf) | 157 | size_t *retlen, uint8_t *buf) |
157 | { | 158 | { |
159 | loff_t mask = mtd->writesize - 1; | ||
158 | struct mtd_oob_ops ops; | 160 | struct mtd_oob_ops ops; |
159 | int res; | 161 | int res; |
160 | 162 | ||
161 | ops.mode = MTD_OOB_PLACE; | 163 | ops.mode = MTD_OOB_PLACE; |
162 | ops.ooboffs = offs & (mtd->writesize - 1); | 164 | ops.ooboffs = offs & mask; |
163 | ops.ooblen = len; | 165 | ops.ooblen = len; |
164 | ops.oobbuf = buf; | 166 | ops.oobbuf = buf; |
165 | ops.datbuf = NULL; | 167 | ops.datbuf = NULL; |
166 | 168 | ||
167 | res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops); | 169 | res = mtd->write_oob(mtd, offs & ~mask, &ops); |
168 | *retlen = ops.oobretlen; | 170 | *retlen = ops.oobretlen; |
169 | return res; | 171 | return res; |
170 | } | 172 | } |
@@ -177,17 +179,18 @@ int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len, | |||
177 | static int nftl_write(struct mtd_info *mtd, loff_t offs, size_t len, | 179 | static int nftl_write(struct mtd_info *mtd, loff_t offs, size_t len, |
178 | size_t *retlen, uint8_t *buf, uint8_t *oob) | 180 | size_t *retlen, uint8_t *buf, uint8_t *oob) |
179 | { | 181 | { |
182 | loff_t mask = mtd->writesize - 1; | ||
180 | struct mtd_oob_ops ops; | 183 | struct mtd_oob_ops ops; |
181 | int res; | 184 | int res; |
182 | 185 | ||
183 | ops.mode = MTD_OOB_PLACE; | 186 | ops.mode = MTD_OOB_PLACE; |
184 | ops.ooboffs = offs; | 187 | ops.ooboffs = offs & mask; |
185 | ops.ooblen = mtd->oobsize; | 188 | ops.ooblen = mtd->oobsize; |
186 | ops.oobbuf = oob; | 189 | ops.oobbuf = oob; |
187 | ops.datbuf = buf; | 190 | ops.datbuf = buf; |
188 | ops.len = len; | 191 | ops.len = len; |
189 | 192 | ||
190 | res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops); | 193 | res = mtd->write_oob(mtd, offs & ~mask, &ops); |
191 | *retlen = ops.retlen; | 194 | *retlen = ops.retlen; |
192 | return res; | 195 | return res; |
193 | } | 196 | } |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index c20416850948..45675889850b 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -235,6 +235,7 @@ enum vortex_chips { | |||
235 | CH_3C900B_FL, | 235 | CH_3C900B_FL, |
236 | CH_3C905_1, | 236 | CH_3C905_1, |
237 | CH_3C905_2, | 237 | CH_3C905_2, |
238 | CH_3C905B_TX, | ||
238 | CH_3C905B_1, | 239 | CH_3C905B_1, |
239 | 240 | ||
240 | CH_3C905B_2, | 241 | CH_3C905B_2, |
@@ -307,6 +308,8 @@ static struct vortex_chip_info { | |||
307 | PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, }, | 308 | PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, }, |
308 | {"3c905 Boomerang 100baseT4", | 309 | {"3c905 Boomerang 100baseT4", |
309 | PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, }, | 310 | PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, }, |
311 | {"3C905B-TX Fast Etherlink XL PCI", | ||
312 | PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, }, | ||
310 | {"3c905B Cyclone 100baseTx", | 313 | {"3c905B Cyclone 100baseTx", |
311 | PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, }, | 314 | PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, }, |
312 | 315 | ||
@@ -389,6 +392,7 @@ static struct pci_device_id vortex_pci_tbl[] = { | |||
389 | { 0x10B7, 0x900A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C900B_FL }, | 392 | { 0x10B7, 0x900A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C900B_FL }, |
390 | { 0x10B7, 0x9050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_1 }, | 393 | { 0x10B7, 0x9050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_1 }, |
391 | { 0x10B7, 0x9051, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_2 }, | 394 | { 0x10B7, 0x9051, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_2 }, |
395 | { 0x10B7, 0x9054, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_TX }, | ||
392 | { 0x10B7, 0x9055, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_1 }, | 396 | { 0x10B7, 0x9055, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_1 }, |
393 | 397 | ||
394 | { 0x10B7, 0x9058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_2 }, | 398 | { 0x10B7, 0x9058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_2 }, |
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 50efde11ea6c..d0dbbf39349a 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
@@ -515,7 +515,7 @@ rx_status_loop: | |||
515 | dma_addr_t mapping; | 515 | dma_addr_t mapping; |
516 | struct sk_buff *skb, *new_skb; | 516 | struct sk_buff *skb, *new_skb; |
517 | struct cp_desc *desc; | 517 | struct cp_desc *desc; |
518 | unsigned buflen; | 518 | const unsigned buflen = cp->rx_buf_sz; |
519 | 519 | ||
520 | skb = cp->rx_skb[rx_tail]; | 520 | skb = cp->rx_skb[rx_tail]; |
521 | BUG_ON(!skb); | 521 | BUG_ON(!skb); |
@@ -549,8 +549,7 @@ rx_status_loop: | |||
549 | pr_debug("%s: rx slot %d status 0x%x len %d\n", | 549 | pr_debug("%s: rx slot %d status 0x%x len %d\n", |
550 | dev->name, rx_tail, status, len); | 550 | dev->name, rx_tail, status, len); |
551 | 551 | ||
552 | buflen = cp->rx_buf_sz + NET_IP_ALIGN; | 552 | new_skb = netdev_alloc_skb(dev, buflen + NET_IP_ALIGN); |
553 | new_skb = netdev_alloc_skb(dev, buflen); | ||
554 | if (!new_skb) { | 553 | if (!new_skb) { |
555 | dev->stats.rx_dropped++; | 554 | dev->stats.rx_dropped++; |
556 | goto rx_next; | 555 | goto rx_next; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 5f6509a5f640..5ce7cbabd7a7 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1727,12 +1727,14 @@ config KS8842 | |||
1727 | tristate "Micrel KSZ8842" | 1727 | tristate "Micrel KSZ8842" |
1728 | depends on HAS_IOMEM | 1728 | depends on HAS_IOMEM |
1729 | help | 1729 | help |
1730 | This platform driver is for Micrel KSZ8842 chip. | 1730 | This platform driver is for Micrel KSZ8842 / KS8842 |
1731 | 2-port ethernet switch chip (managed, VLAN, QoS). | ||
1731 | 1732 | ||
1732 | config KS8851 | 1733 | config KS8851 |
1733 | tristate "Micrel KS8851 SPI" | 1734 | tristate "Micrel KS8851 SPI" |
1734 | depends on SPI | 1735 | depends on SPI |
1735 | select MII | 1736 | select MII |
1737 | select CRC32 | ||
1736 | help | 1738 | help |
1737 | SPI driver for Micrel KS8851 SPI attached network chip. | 1739 | SPI driver for Micrel KS8851 SPI attached network chip. |
1738 | 1740 | ||
diff --git a/drivers/net/arm/w90p910_ether.c b/drivers/net/arm/w90p910_ether.c index 616fb7985a34..ddd231cb54b7 100644 --- a/drivers/net/arm/w90p910_ether.c +++ b/drivers/net/arm/w90p910_ether.c | |||
@@ -1080,7 +1080,7 @@ static struct platform_driver w90p910_ether_driver = { | |||
1080 | .probe = w90p910_ether_probe, | 1080 | .probe = w90p910_ether_probe, |
1081 | .remove = __devexit_p(w90p910_ether_remove), | 1081 | .remove = __devexit_p(w90p910_ether_remove), |
1082 | .driver = { | 1082 | .driver = { |
1083 | .name = "w90p910-emc", | 1083 | .name = "nuc900-emc", |
1084 | .owner = THIS_MODULE, | 1084 | .owner = THIS_MODULE, |
1085 | }, | 1085 | }, |
1086 | }; | 1086 | }; |
@@ -1101,5 +1101,5 @@ module_exit(w90p910_ether_exit); | |||
1101 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); | 1101 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); |
1102 | MODULE_DESCRIPTION("w90p910 MAC driver!"); | 1102 | MODULE_DESCRIPTION("w90p910 MAC driver!"); |
1103 | MODULE_LICENSE("GPL"); | 1103 | MODULE_LICENSE("GPL"); |
1104 | MODULE_ALIAS("platform:w90p910-emc"); | 1104 | MODULE_ALIAS("platform:nuc900-emc"); |
1105 | 1105 | ||
diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c index 607007d75b6f..00d11b480af3 100644 --- a/drivers/net/atl1c/atl1c_ethtool.c +++ b/drivers/net/atl1c/atl1c_ethtool.c | |||
@@ -232,11 +232,11 @@ static void atl1c_get_drvinfo(struct net_device *netdev, | |||
232 | { | 232 | { |
233 | struct atl1c_adapter *adapter = netdev_priv(netdev); | 233 | struct atl1c_adapter *adapter = netdev_priv(netdev); |
234 | 234 | ||
235 | strncpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver)); | 235 | strlcpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver)); |
236 | strncpy(drvinfo->version, atl1c_driver_version, | 236 | strlcpy(drvinfo->version, atl1c_driver_version, |
237 | sizeof(drvinfo->version)); | 237 | sizeof(drvinfo->version)); |
238 | strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | 238 | strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
239 | strncpy(drvinfo->bus_info, pci_name(adapter->pdev), | 239 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
240 | sizeof(drvinfo->bus_info)); | 240 | sizeof(drvinfo->bus_info)); |
241 | drvinfo->n_stats = 0; | 241 | drvinfo->n_stats = 0; |
242 | drvinfo->testinfo_len = 0; | 242 | drvinfo->testinfo_len = 0; |
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 94d7325caf4f..8bca12f71390 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -3378,11 +3378,11 @@ static void atl1_get_drvinfo(struct net_device *netdev, | |||
3378 | { | 3378 | { |
3379 | struct atl1_adapter *adapter = netdev_priv(netdev); | 3379 | struct atl1_adapter *adapter = netdev_priv(netdev); |
3380 | 3380 | ||
3381 | strncpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver)); | 3381 | strlcpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver)); |
3382 | strncpy(drvinfo->version, ATLX_DRIVER_VERSION, | 3382 | strlcpy(drvinfo->version, ATLX_DRIVER_VERSION, |
3383 | sizeof(drvinfo->version)); | 3383 | sizeof(drvinfo->version)); |
3384 | strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); | 3384 | strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
3385 | strncpy(drvinfo->bus_info, pci_name(adapter->pdev), | 3385 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), |
3386 | sizeof(drvinfo->bus_info)); | 3386 | sizeof(drvinfo->bus_info)); |
3387 | drvinfo->eedump_len = ATL1_EEDUMP_LEN; | 3387 | drvinfo->eedump_len = ATL1_EEDUMP_LEN; |
3388 | } | 3388 | } |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 36d4d377ec2f..bafca672ea7d 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -952,9 +952,10 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
952 | int rc = NETDEV_TX_OK; | 952 | int rc = NETDEV_TX_OK; |
953 | dma_addr_t mapping; | 953 | dma_addr_t mapping; |
954 | u32 len, entry, ctrl; | 954 | u32 len, entry, ctrl; |
955 | unsigned long flags; | ||
955 | 956 | ||
956 | len = skb->len; | 957 | len = skb->len; |
957 | spin_lock_irq(&bp->lock); | 958 | spin_lock_irqsave(&bp->lock, flags); |
958 | 959 | ||
959 | /* This is a hard error, log it. */ | 960 | /* This is a hard error, log it. */ |
960 | if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { | 961 | if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { |
@@ -1027,7 +1028,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1027 | dev->trans_start = jiffies; | 1028 | dev->trans_start = jiffies; |
1028 | 1029 | ||
1029 | out_unlock: | 1030 | out_unlock: |
1030 | spin_unlock_irq(&bp->lock); | 1031 | spin_unlock_irqrestore(&bp->lock, flags); |
1031 | 1032 | ||
1032 | return rc; | 1033 | return rc; |
1033 | 1034 | ||
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index b70cc99962fc..06b901152d44 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -399,9 +399,11 @@ static int bnx2_unregister_cnic(struct net_device *dev) | |||
399 | struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; | 399 | struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; |
400 | struct cnic_eth_dev *cp = &bp->cnic_eth_dev; | 400 | struct cnic_eth_dev *cp = &bp->cnic_eth_dev; |
401 | 401 | ||
402 | mutex_lock(&bp->cnic_lock); | ||
402 | cp->drv_state = 0; | 403 | cp->drv_state = 0; |
403 | bnapi->cnic_present = 0; | 404 | bnapi->cnic_present = 0; |
404 | rcu_assign_pointer(bp->cnic_ops, NULL); | 405 | rcu_assign_pointer(bp->cnic_ops, NULL); |
406 | mutex_unlock(&bp->cnic_lock); | ||
405 | synchronize_rcu(); | 407 | synchronize_rcu(); |
406 | return 0; | 408 | return 0; |
407 | } | 409 | } |
@@ -429,13 +431,13 @@ bnx2_cnic_stop(struct bnx2 *bp) | |||
429 | struct cnic_ops *c_ops; | 431 | struct cnic_ops *c_ops; |
430 | struct cnic_ctl_info info; | 432 | struct cnic_ctl_info info; |
431 | 433 | ||
432 | rcu_read_lock(); | 434 | mutex_lock(&bp->cnic_lock); |
433 | c_ops = rcu_dereference(bp->cnic_ops); | 435 | c_ops = bp->cnic_ops; |
434 | if (c_ops) { | 436 | if (c_ops) { |
435 | info.cmd = CNIC_CTL_STOP_CMD; | 437 | info.cmd = CNIC_CTL_STOP_CMD; |
436 | c_ops->cnic_ctl(bp->cnic_data, &info); | 438 | c_ops->cnic_ctl(bp->cnic_data, &info); |
437 | } | 439 | } |
438 | rcu_read_unlock(); | 440 | mutex_unlock(&bp->cnic_lock); |
439 | } | 441 | } |
440 | 442 | ||
441 | static void | 443 | static void |
@@ -444,8 +446,8 @@ bnx2_cnic_start(struct bnx2 *bp) | |||
444 | struct cnic_ops *c_ops; | 446 | struct cnic_ops *c_ops; |
445 | struct cnic_ctl_info info; | 447 | struct cnic_ctl_info info; |
446 | 448 | ||
447 | rcu_read_lock(); | 449 | mutex_lock(&bp->cnic_lock); |
448 | c_ops = rcu_dereference(bp->cnic_ops); | 450 | c_ops = bp->cnic_ops; |
449 | if (c_ops) { | 451 | if (c_ops) { |
450 | if (!(bp->flags & BNX2_FLAG_USING_MSIX)) { | 452 | if (!(bp->flags & BNX2_FLAG_USING_MSIX)) { |
451 | struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; | 453 | struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; |
@@ -455,7 +457,7 @@ bnx2_cnic_start(struct bnx2 *bp) | |||
455 | info.cmd = CNIC_CTL_START_CMD; | 457 | info.cmd = CNIC_CTL_START_CMD; |
456 | c_ops->cnic_ctl(bp->cnic_data, &info); | 458 | c_ops->cnic_ctl(bp->cnic_data, &info); |
457 | } | 459 | } |
458 | rcu_read_unlock(); | 460 | mutex_unlock(&bp->cnic_lock); |
459 | } | 461 | } |
460 | 462 | ||
461 | #else | 463 | #else |
@@ -7663,6 +7665,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
7663 | 7665 | ||
7664 | spin_lock_init(&bp->phy_lock); | 7666 | spin_lock_init(&bp->phy_lock); |
7665 | spin_lock_init(&bp->indirect_lock); | 7667 | spin_lock_init(&bp->indirect_lock); |
7668 | #ifdef BCM_CNIC | ||
7669 | mutex_init(&bp->cnic_lock); | ||
7670 | #endif | ||
7666 | INIT_WORK(&bp->reset_task, bnx2_reset_task); | 7671 | INIT_WORK(&bp->reset_task, bnx2_reset_task); |
7667 | 7672 | ||
7668 | dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0); | 7673 | dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0); |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index f1edfaa9e56a..a4f12fd0ecd2 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -6902,6 +6902,7 @@ struct bnx2 { | |||
6902 | u32 idle_chk_status_idx; | 6902 | u32 idle_chk_status_idx; |
6903 | 6903 | ||
6904 | #ifdef BCM_CNIC | 6904 | #ifdef BCM_CNIC |
6905 | struct mutex cnic_lock; | ||
6905 | struct cnic_eth_dev cnic_eth_dev; | 6906 | struct cnic_eth_dev cnic_eth_dev; |
6906 | #endif | 6907 | #endif |
6907 | 6908 | ||
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 9e4283aff828..e1a4f8214239 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -611,11 +611,18 @@ nla_put_failure: | |||
611 | return -EMSGSIZE; | 611 | return -EMSGSIZE; |
612 | } | 612 | } |
613 | 613 | ||
614 | static int can_newlink(struct net_device *dev, | ||
615 | struct nlattr *tb[], struct nlattr *data[]) | ||
616 | { | ||
617 | return -EOPNOTSUPP; | ||
618 | } | ||
619 | |||
614 | static struct rtnl_link_ops can_link_ops __read_mostly = { | 620 | static struct rtnl_link_ops can_link_ops __read_mostly = { |
615 | .kind = "can", | 621 | .kind = "can", |
616 | .maxtype = IFLA_CAN_MAX, | 622 | .maxtype = IFLA_CAN_MAX, |
617 | .policy = can_policy, | 623 | .policy = can_policy, |
618 | .setup = can_setup, | 624 | .setup = can_setup, |
625 | .newlink = can_newlink, | ||
619 | .changelink = can_changelink, | 626 | .changelink = can_changelink, |
620 | .fill_info = can_fill_info, | 627 | .fill_info = can_fill_info, |
621 | .fill_xstats = can_fill_xstats, | 628 | .fill_xstats = can_fill_xstats, |
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 4869d77cbe91..74c342959b7b 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -138,6 +138,16 @@ static struct cnic_dev *cnic_from_netdev(struct net_device *netdev) | |||
138 | return NULL; | 138 | return NULL; |
139 | } | 139 | } |
140 | 140 | ||
141 | static inline void ulp_get(struct cnic_ulp_ops *ulp_ops) | ||
142 | { | ||
143 | atomic_inc(&ulp_ops->ref_count); | ||
144 | } | ||
145 | |||
146 | static inline void ulp_put(struct cnic_ulp_ops *ulp_ops) | ||
147 | { | ||
148 | atomic_dec(&ulp_ops->ref_count); | ||
149 | } | ||
150 | |||
141 | static void cnic_ctx_wr(struct cnic_dev *dev, u32 cid_addr, u32 off, u32 val) | 151 | static void cnic_ctx_wr(struct cnic_dev *dev, u32 cid_addr, u32 off, u32 val) |
142 | { | 152 | { |
143 | struct cnic_local *cp = dev->cnic_priv; | 153 | struct cnic_local *cp = dev->cnic_priv; |
@@ -358,6 +368,7 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops) | |||
358 | } | 368 | } |
359 | read_unlock(&cnic_dev_lock); | 369 | read_unlock(&cnic_dev_lock); |
360 | 370 | ||
371 | atomic_set(&ulp_ops->ref_count, 0); | ||
361 | rcu_assign_pointer(cnic_ulp_tbl[ulp_type], ulp_ops); | 372 | rcu_assign_pointer(cnic_ulp_tbl[ulp_type], ulp_ops); |
362 | mutex_unlock(&cnic_lock); | 373 | mutex_unlock(&cnic_lock); |
363 | 374 | ||
@@ -379,6 +390,8 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops) | |||
379 | int cnic_unregister_driver(int ulp_type) | 390 | int cnic_unregister_driver(int ulp_type) |
380 | { | 391 | { |
381 | struct cnic_dev *dev; | 392 | struct cnic_dev *dev; |
393 | struct cnic_ulp_ops *ulp_ops; | ||
394 | int i = 0; | ||
382 | 395 | ||
383 | if (ulp_type >= MAX_CNIC_ULP_TYPE) { | 396 | if (ulp_type >= MAX_CNIC_ULP_TYPE) { |
384 | printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n", | 397 | printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n", |
@@ -386,7 +399,8 @@ int cnic_unregister_driver(int ulp_type) | |||
386 | return -EINVAL; | 399 | return -EINVAL; |
387 | } | 400 | } |
388 | mutex_lock(&cnic_lock); | 401 | mutex_lock(&cnic_lock); |
389 | if (!cnic_ulp_tbl[ulp_type]) { | 402 | ulp_ops = cnic_ulp_tbl[ulp_type]; |
403 | if (!ulp_ops) { | ||
390 | printk(KERN_ERR PFX "cnic_unregister_driver: Type %d has not " | 404 | printk(KERN_ERR PFX "cnic_unregister_driver: Type %d has not " |
391 | "been registered\n", ulp_type); | 405 | "been registered\n", ulp_type); |
392 | goto out_unlock; | 406 | goto out_unlock; |
@@ -411,6 +425,14 @@ int cnic_unregister_driver(int ulp_type) | |||
411 | 425 | ||
412 | mutex_unlock(&cnic_lock); | 426 | mutex_unlock(&cnic_lock); |
413 | synchronize_rcu(); | 427 | synchronize_rcu(); |
428 | while ((atomic_read(&ulp_ops->ref_count) != 0) && (i < 20)) { | ||
429 | msleep(100); | ||
430 | i++; | ||
431 | } | ||
432 | |||
433 | if (atomic_read(&ulp_ops->ref_count) != 0) | ||
434 | printk(KERN_WARNING PFX "%s: Failed waiting for ref count to go" | ||
435 | " to zero.\n", dev->netdev->name); | ||
414 | return 0; | 436 | return 0; |
415 | 437 | ||
416 | out_unlock: | 438 | out_unlock: |
@@ -466,6 +488,7 @@ EXPORT_SYMBOL(cnic_register_driver); | |||
466 | static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) | 488 | static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) |
467 | { | 489 | { |
468 | struct cnic_local *cp = dev->cnic_priv; | 490 | struct cnic_local *cp = dev->cnic_priv; |
491 | int i = 0; | ||
469 | 492 | ||
470 | if (ulp_type >= MAX_CNIC_ULP_TYPE) { | 493 | if (ulp_type >= MAX_CNIC_ULP_TYPE) { |
471 | printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n", | 494 | printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n", |
@@ -486,6 +509,15 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) | |||
486 | 509 | ||
487 | synchronize_rcu(); | 510 | synchronize_rcu(); |
488 | 511 | ||
512 | while (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]) && | ||
513 | i < 20) { | ||
514 | msleep(100); | ||
515 | i++; | ||
516 | } | ||
517 | if (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type])) | ||
518 | printk(KERN_WARNING PFX "%s: Failed waiting for ULP up call" | ||
519 | " to complete.\n", dev->netdev->name); | ||
520 | |||
489 | return 0; | 521 | return 0; |
490 | } | 522 | } |
491 | EXPORT_SYMBOL(cnic_unregister_driver); | 523 | EXPORT_SYMBOL(cnic_unregister_driver); |
@@ -1076,18 +1108,23 @@ static void cnic_ulp_stop(struct cnic_dev *dev) | |||
1076 | if (cp->cnic_uinfo) | 1108 | if (cp->cnic_uinfo) |
1077 | cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); | 1109 | cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); |
1078 | 1110 | ||
1079 | rcu_read_lock(); | ||
1080 | for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { | 1111 | for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { |
1081 | struct cnic_ulp_ops *ulp_ops; | 1112 | struct cnic_ulp_ops *ulp_ops; |
1082 | 1113 | ||
1083 | ulp_ops = rcu_dereference(cp->ulp_ops[if_type]); | 1114 | mutex_lock(&cnic_lock); |
1084 | if (!ulp_ops) | 1115 | ulp_ops = cp->ulp_ops[if_type]; |
1116 | if (!ulp_ops) { | ||
1117 | mutex_unlock(&cnic_lock); | ||
1085 | continue; | 1118 | continue; |
1119 | } | ||
1120 | set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); | ||
1121 | mutex_unlock(&cnic_lock); | ||
1086 | 1122 | ||
1087 | if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type])) | 1123 | if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type])) |
1088 | ulp_ops->cnic_stop(cp->ulp_handle[if_type]); | 1124 | ulp_ops->cnic_stop(cp->ulp_handle[if_type]); |
1125 | |||
1126 | clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); | ||
1089 | } | 1127 | } |
1090 | rcu_read_unlock(); | ||
1091 | } | 1128 | } |
1092 | 1129 | ||
1093 | static void cnic_ulp_start(struct cnic_dev *dev) | 1130 | static void cnic_ulp_start(struct cnic_dev *dev) |
@@ -1095,18 +1132,23 @@ static void cnic_ulp_start(struct cnic_dev *dev) | |||
1095 | struct cnic_local *cp = dev->cnic_priv; | 1132 | struct cnic_local *cp = dev->cnic_priv; |
1096 | int if_type; | 1133 | int if_type; |
1097 | 1134 | ||
1098 | rcu_read_lock(); | ||
1099 | for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { | 1135 | for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { |
1100 | struct cnic_ulp_ops *ulp_ops; | 1136 | struct cnic_ulp_ops *ulp_ops; |
1101 | 1137 | ||
1102 | ulp_ops = rcu_dereference(cp->ulp_ops[if_type]); | 1138 | mutex_lock(&cnic_lock); |
1103 | if (!ulp_ops || !ulp_ops->cnic_start) | 1139 | ulp_ops = cp->ulp_ops[if_type]; |
1140 | if (!ulp_ops || !ulp_ops->cnic_start) { | ||
1141 | mutex_unlock(&cnic_lock); | ||
1104 | continue; | 1142 | continue; |
1143 | } | ||
1144 | set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); | ||
1145 | mutex_unlock(&cnic_lock); | ||
1105 | 1146 | ||
1106 | if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type])) | 1147 | if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type])) |
1107 | ulp_ops->cnic_start(cp->ulp_handle[if_type]); | 1148 | ulp_ops->cnic_start(cp->ulp_handle[if_type]); |
1149 | |||
1150 | clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); | ||
1108 | } | 1151 | } |
1109 | rcu_read_unlock(); | ||
1110 | } | 1152 | } |
1111 | 1153 | ||
1112 | static int cnic_ctl(void *data, struct cnic_ctl_info *info) | 1154 | static int cnic_ctl(void *data, struct cnic_ctl_info *info) |
@@ -1116,22 +1158,18 @@ static int cnic_ctl(void *data, struct cnic_ctl_info *info) | |||
1116 | switch (info->cmd) { | 1158 | switch (info->cmd) { |
1117 | case CNIC_CTL_STOP_CMD: | 1159 | case CNIC_CTL_STOP_CMD: |
1118 | cnic_hold(dev); | 1160 | cnic_hold(dev); |
1119 | mutex_lock(&cnic_lock); | ||
1120 | 1161 | ||
1121 | cnic_ulp_stop(dev); | 1162 | cnic_ulp_stop(dev); |
1122 | cnic_stop_hw(dev); | 1163 | cnic_stop_hw(dev); |
1123 | 1164 | ||
1124 | mutex_unlock(&cnic_lock); | ||
1125 | cnic_put(dev); | 1165 | cnic_put(dev); |
1126 | break; | 1166 | break; |
1127 | case CNIC_CTL_START_CMD: | 1167 | case CNIC_CTL_START_CMD: |
1128 | cnic_hold(dev); | 1168 | cnic_hold(dev); |
1129 | mutex_lock(&cnic_lock); | ||
1130 | 1169 | ||
1131 | if (!cnic_start_hw(dev)) | 1170 | if (!cnic_start_hw(dev)) |
1132 | cnic_ulp_start(dev); | 1171 | cnic_ulp_start(dev); |
1133 | 1172 | ||
1134 | mutex_unlock(&cnic_lock); | ||
1135 | cnic_put(dev); | 1173 | cnic_put(dev); |
1136 | break; | 1174 | break; |
1137 | default: | 1175 | default: |
@@ -1145,19 +1183,23 @@ static void cnic_ulp_init(struct cnic_dev *dev) | |||
1145 | int i; | 1183 | int i; |
1146 | struct cnic_local *cp = dev->cnic_priv; | 1184 | struct cnic_local *cp = dev->cnic_priv; |
1147 | 1185 | ||
1148 | rcu_read_lock(); | ||
1149 | for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { | 1186 | for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { |
1150 | struct cnic_ulp_ops *ulp_ops; | 1187 | struct cnic_ulp_ops *ulp_ops; |
1151 | 1188 | ||
1152 | ulp_ops = rcu_dereference(cnic_ulp_tbl[i]); | 1189 | mutex_lock(&cnic_lock); |
1153 | if (!ulp_ops || !ulp_ops->cnic_init) | 1190 | ulp_ops = cnic_ulp_tbl[i]; |
1191 | if (!ulp_ops || !ulp_ops->cnic_init) { | ||
1192 | mutex_unlock(&cnic_lock); | ||
1154 | continue; | 1193 | continue; |
1194 | } | ||
1195 | ulp_get(ulp_ops); | ||
1196 | mutex_unlock(&cnic_lock); | ||
1155 | 1197 | ||
1156 | if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i])) | 1198 | if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i])) |
1157 | ulp_ops->cnic_init(dev); | 1199 | ulp_ops->cnic_init(dev); |
1158 | 1200 | ||
1201 | ulp_put(ulp_ops); | ||
1159 | } | 1202 | } |
1160 | rcu_read_unlock(); | ||
1161 | } | 1203 | } |
1162 | 1204 | ||
1163 | static void cnic_ulp_exit(struct cnic_dev *dev) | 1205 | static void cnic_ulp_exit(struct cnic_dev *dev) |
@@ -1165,19 +1207,23 @@ static void cnic_ulp_exit(struct cnic_dev *dev) | |||
1165 | int i; | 1207 | int i; |
1166 | struct cnic_local *cp = dev->cnic_priv; | 1208 | struct cnic_local *cp = dev->cnic_priv; |
1167 | 1209 | ||
1168 | rcu_read_lock(); | ||
1169 | for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { | 1210 | for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { |
1170 | struct cnic_ulp_ops *ulp_ops; | 1211 | struct cnic_ulp_ops *ulp_ops; |
1171 | 1212 | ||
1172 | ulp_ops = rcu_dereference(cnic_ulp_tbl[i]); | 1213 | mutex_lock(&cnic_lock); |
1173 | if (!ulp_ops || !ulp_ops->cnic_exit) | 1214 | ulp_ops = cnic_ulp_tbl[i]; |
1215 | if (!ulp_ops || !ulp_ops->cnic_exit) { | ||
1216 | mutex_unlock(&cnic_lock); | ||
1174 | continue; | 1217 | continue; |
1218 | } | ||
1219 | ulp_get(ulp_ops); | ||
1220 | mutex_unlock(&cnic_lock); | ||
1175 | 1221 | ||
1176 | if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i])) | 1222 | if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i])) |
1177 | ulp_ops->cnic_exit(dev); | 1223 | ulp_ops->cnic_exit(dev); |
1178 | 1224 | ||
1225 | ulp_put(ulp_ops); | ||
1179 | } | 1226 | } |
1180 | rcu_read_unlock(); | ||
1181 | } | 1227 | } |
1182 | 1228 | ||
1183 | static int cnic_cm_offload_pg(struct cnic_sock *csk) | 1229 | static int cnic_cm_offload_pg(struct cnic_sock *csk) |
@@ -2393,21 +2439,45 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev) | |||
2393 | return 0; | 2439 | return 0; |
2394 | } | 2440 | } |
2395 | 2441 | ||
2396 | static int cnic_start_hw(struct cnic_dev *dev) | 2442 | static int cnic_register_netdev(struct cnic_dev *dev) |
2397 | { | 2443 | { |
2398 | struct cnic_local *cp = dev->cnic_priv; | 2444 | struct cnic_local *cp = dev->cnic_priv; |
2399 | struct cnic_eth_dev *ethdev = cp->ethdev; | 2445 | struct cnic_eth_dev *ethdev = cp->ethdev; |
2400 | int err; | 2446 | int err; |
2401 | 2447 | ||
2402 | if (test_bit(CNIC_F_CNIC_UP, &dev->flags)) | 2448 | if (!ethdev) |
2403 | return -EALREADY; | 2449 | return -ENODEV; |
2450 | |||
2451 | if (ethdev->drv_state & CNIC_DRV_STATE_REGD) | ||
2452 | return 0; | ||
2404 | 2453 | ||
2405 | err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev); | 2454 | err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev); |
2406 | if (err) { | 2455 | if (err) |
2407 | printk(KERN_ERR PFX "%s: register_cnic failed\n", | 2456 | printk(KERN_ERR PFX "%s: register_cnic failed\n", |
2408 | dev->netdev->name); | 2457 | dev->netdev->name); |
2409 | goto err2; | 2458 | |
2410 | } | 2459 | return err; |
2460 | } | ||
2461 | |||
2462 | static void cnic_unregister_netdev(struct cnic_dev *dev) | ||
2463 | { | ||
2464 | struct cnic_local *cp = dev->cnic_priv; | ||
2465 | struct cnic_eth_dev *ethdev = cp->ethdev; | ||
2466 | |||
2467 | if (!ethdev) | ||
2468 | return; | ||
2469 | |||
2470 | ethdev->drv_unregister_cnic(dev->netdev); | ||
2471 | } | ||
2472 | |||
2473 | static int cnic_start_hw(struct cnic_dev *dev) | ||
2474 | { | ||
2475 | struct cnic_local *cp = dev->cnic_priv; | ||
2476 | struct cnic_eth_dev *ethdev = cp->ethdev; | ||
2477 | int err; | ||
2478 | |||
2479 | if (test_bit(CNIC_F_CNIC_UP, &dev->flags)) | ||
2480 | return -EALREADY; | ||
2411 | 2481 | ||
2412 | dev->regview = ethdev->io_base; | 2482 | dev->regview = ethdev->io_base; |
2413 | cp->chip_id = ethdev->chip_id; | 2483 | cp->chip_id = ethdev->chip_id; |
@@ -2438,18 +2508,13 @@ static int cnic_start_hw(struct cnic_dev *dev) | |||
2438 | return 0; | 2508 | return 0; |
2439 | 2509 | ||
2440 | err1: | 2510 | err1: |
2441 | ethdev->drv_unregister_cnic(dev->netdev); | ||
2442 | cp->free_resc(dev); | 2511 | cp->free_resc(dev); |
2443 | pci_dev_put(dev->pcidev); | 2512 | pci_dev_put(dev->pcidev); |
2444 | err2: | ||
2445 | return err; | 2513 | return err; |
2446 | } | 2514 | } |
2447 | 2515 | ||
2448 | static void cnic_stop_bnx2_hw(struct cnic_dev *dev) | 2516 | static void cnic_stop_bnx2_hw(struct cnic_dev *dev) |
2449 | { | 2517 | { |
2450 | struct cnic_local *cp = dev->cnic_priv; | ||
2451 | struct cnic_eth_dev *ethdev = cp->ethdev; | ||
2452 | |||
2453 | cnic_disable_bnx2_int_sync(dev); | 2518 | cnic_disable_bnx2_int_sync(dev); |
2454 | 2519 | ||
2455 | cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0); | 2520 | cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0); |
@@ -2461,8 +2526,6 @@ static void cnic_stop_bnx2_hw(struct cnic_dev *dev) | |||
2461 | cnic_setup_5709_context(dev, 0); | 2526 | cnic_setup_5709_context(dev, 0); |
2462 | cnic_free_irq(dev); | 2527 | cnic_free_irq(dev); |
2463 | 2528 | ||
2464 | ethdev->drv_unregister_cnic(dev->netdev); | ||
2465 | |||
2466 | cnic_free_resc(dev); | 2529 | cnic_free_resc(dev); |
2467 | } | 2530 | } |
2468 | 2531 | ||
@@ -2543,7 +2606,7 @@ static struct cnic_dev *init_bnx2_cnic(struct net_device *dev) | |||
2543 | probe = symbol_get(bnx2_cnic_probe); | 2606 | probe = symbol_get(bnx2_cnic_probe); |
2544 | if (probe) { | 2607 | if (probe) { |
2545 | ethdev = (*probe)(dev); | 2608 | ethdev = (*probe)(dev); |
2546 | symbol_put_addr(probe); | 2609 | symbol_put(bnx2_cnic_probe); |
2547 | } | 2610 | } |
2548 | if (!ethdev) | 2611 | if (!ethdev) |
2549 | return NULL; | 2612 | return NULL; |
@@ -2646,10 +2709,12 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event, | |||
2646 | else if (event == NETDEV_UNREGISTER) | 2709 | else if (event == NETDEV_UNREGISTER) |
2647 | cnic_ulp_exit(dev); | 2710 | cnic_ulp_exit(dev); |
2648 | else if (event == NETDEV_UP) { | 2711 | else if (event == NETDEV_UP) { |
2649 | mutex_lock(&cnic_lock); | 2712 | if (cnic_register_netdev(dev) != 0) { |
2713 | cnic_put(dev); | ||
2714 | goto done; | ||
2715 | } | ||
2650 | if (!cnic_start_hw(dev)) | 2716 | if (!cnic_start_hw(dev)) |
2651 | cnic_ulp_start(dev); | 2717 | cnic_ulp_start(dev); |
2652 | mutex_unlock(&cnic_lock); | ||
2653 | } | 2718 | } |
2654 | 2719 | ||
2655 | rcu_read_lock(); | 2720 | rcu_read_lock(); |
@@ -2668,10 +2733,9 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event, | |||
2668 | rcu_read_unlock(); | 2733 | rcu_read_unlock(); |
2669 | 2734 | ||
2670 | if (event == NETDEV_GOING_DOWN) { | 2735 | if (event == NETDEV_GOING_DOWN) { |
2671 | mutex_lock(&cnic_lock); | ||
2672 | cnic_ulp_stop(dev); | 2736 | cnic_ulp_stop(dev); |
2673 | cnic_stop_hw(dev); | 2737 | cnic_stop_hw(dev); |
2674 | mutex_unlock(&cnic_lock); | 2738 | cnic_unregister_netdev(dev); |
2675 | } else if (event == NETDEV_UNREGISTER) { | 2739 | } else if (event == NETDEV_UNREGISTER) { |
2676 | write_lock(&cnic_dev_lock); | 2740 | write_lock(&cnic_dev_lock); |
2677 | list_del_init(&dev->list); | 2741 | list_del_init(&dev->list); |
@@ -2703,6 +2767,7 @@ static void cnic_release(void) | |||
2703 | } | 2767 | } |
2704 | 2768 | ||
2705 | cnic_ulp_exit(dev); | 2769 | cnic_ulp_exit(dev); |
2770 | cnic_unregister_netdev(dev); | ||
2706 | list_del_init(&dev->list); | 2771 | list_del_init(&dev->list); |
2707 | cnic_free_dev(dev); | 2772 | cnic_free_dev(dev); |
2708 | } | 2773 | } |
diff --git a/drivers/net/cnic.h b/drivers/net/cnic.h index 5192d4a9df5a..a94b302bb464 100644 --- a/drivers/net/cnic.h +++ b/drivers/net/cnic.h | |||
@@ -176,6 +176,7 @@ struct cnic_local { | |||
176 | unsigned long ulp_flags[MAX_CNIC_ULP_TYPE]; | 176 | unsigned long ulp_flags[MAX_CNIC_ULP_TYPE]; |
177 | #define ULP_F_INIT 0 | 177 | #define ULP_F_INIT 0 |
178 | #define ULP_F_START 1 | 178 | #define ULP_F_START 1 |
179 | #define ULP_F_CALL_PENDING 2 | ||
179 | struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE]; | 180 | struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE]; |
180 | 181 | ||
181 | /* protected by ulp_lock */ | 182 | /* protected by ulp_lock */ |
diff --git a/drivers/net/cnic_if.h b/drivers/net/cnic_if.h index d1bce27ee99e..a49235739eef 100644 --- a/drivers/net/cnic_if.h +++ b/drivers/net/cnic_if.h | |||
@@ -290,6 +290,7 @@ struct cnic_ulp_ops { | |||
290 | void (*iscsi_nl_send_msg)(struct cnic_dev *dev, u32 msg_type, | 290 | void (*iscsi_nl_send_msg)(struct cnic_dev *dev, u32 msg_type, |
291 | char *data, u16 data_size); | 291 | char *data, u16 data_size); |
292 | struct module *owner; | 292 | struct module *owner; |
293 | atomic_t ref_count; | ||
293 | }; | 294 | }; |
294 | 295 | ||
295 | extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); | 296 | extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 41b648a67fec..3a6735dc9f6a 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -1899,7 +1899,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx, | |||
1899 | nic->ru_running = RU_SUSPENDED; | 1899 | nic->ru_running = RU_SUSPENDED; |
1900 | pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr, | 1900 | pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr, |
1901 | sizeof(struct rfd), | 1901 | sizeof(struct rfd), |
1902 | PCI_DMA_BIDIRECTIONAL); | 1902 | PCI_DMA_FROMDEVICE); |
1903 | return -ENODATA; | 1903 | return -ENODATA; |
1904 | } | 1904 | } |
1905 | 1905 | ||
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index d56c7473144a..99df2abf82a9 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -338,10 +338,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) | |||
338 | { | 338 | { |
339 | struct e1000_nvm_info *nvm = &hw->nvm; | 339 | struct e1000_nvm_info *nvm = &hw->nvm; |
340 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; | 340 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
341 | union ich8_hws_flash_status hsfsts; | 341 | u32 gfpreg, sector_base_addr, sector_end_addr; |
342 | u32 gfpreg; | ||
343 | u32 sector_base_addr; | ||
344 | u32 sector_end_addr; | ||
345 | u16 i; | 342 | u16 i; |
346 | 343 | ||
347 | /* Can't read flash registers if the register set isn't mapped. */ | 344 | /* Can't read flash registers if the register set isn't mapped. */ |
@@ -375,20 +372,6 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) | |||
375 | /* Adjust to word count */ | 372 | /* Adjust to word count */ |
376 | nvm->flash_bank_size /= sizeof(u16); | 373 | nvm->flash_bank_size /= sizeof(u16); |
377 | 374 | ||
378 | /* | ||
379 | * Make sure the flash bank size does not overwrite the 4k | ||
380 | * sector ranges. We may have 64k allotted to us but we only care | ||
381 | * about the first 2 4k sectors. Therefore, if we have anything less | ||
382 | * than 64k set in the HSFSTS register, we will reduce the bank size | ||
383 | * down to 4k and let the rest remain unused. If berasesz == 3, then | ||
384 | * we are working in 64k mode. Otherwise we are not. | ||
385 | */ | ||
386 | if (nvm->flash_bank_size > E1000_ICH8_SHADOW_RAM_WORDS) { | ||
387 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); | ||
388 | if (hsfsts.hsf_status.berasesz != 3) | ||
389 | nvm->flash_bank_size = E1000_ICH8_SHADOW_RAM_WORDS; | ||
390 | } | ||
391 | |||
392 | nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; | 375 | nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; |
393 | 376 | ||
394 | /* Clear shadow ram */ | 377 | /* Clear shadow ram */ |
@@ -594,8 +577,8 @@ static DEFINE_MUTEX(nvm_mutex); | |||
594 | **/ | 577 | **/ |
595 | static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | 578 | static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) |
596 | { | 579 | { |
597 | u32 extcnf_ctrl; | 580 | u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT; |
598 | u32 timeout = PHY_CFG_TIMEOUT; | 581 | s32 ret_val = 0; |
599 | 582 | ||
600 | might_sleep(); | 583 | might_sleep(); |
601 | 584 | ||
@@ -603,28 +586,46 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) | |||
603 | 586 | ||
604 | while (timeout) { | 587 | while (timeout) { |
605 | extcnf_ctrl = er32(EXTCNF_CTRL); | 588 | extcnf_ctrl = er32(EXTCNF_CTRL); |
589 | if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)) | ||
590 | break; | ||
606 | 591 | ||
607 | if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)) { | 592 | mdelay(1); |
608 | extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; | 593 | timeout--; |
609 | ew32(EXTCNF_CTRL, extcnf_ctrl); | 594 | } |
595 | |||
596 | if (!timeout) { | ||
597 | hw_dbg(hw, "SW/FW/HW has locked the resource for too long.\n"); | ||
598 | ret_val = -E1000_ERR_CONFIG; | ||
599 | goto out; | ||
600 | } | ||
601 | |||
602 | timeout = PHY_CFG_TIMEOUT * 2; | ||
603 | |||
604 | extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; | ||
605 | ew32(EXTCNF_CTRL, extcnf_ctrl); | ||
606 | |||
607 | while (timeout) { | ||
608 | extcnf_ctrl = er32(EXTCNF_CTRL); | ||
609 | if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG) | ||
610 | break; | ||
610 | 611 | ||
611 | extcnf_ctrl = er32(EXTCNF_CTRL); | ||
612 | if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG) | ||
613 | break; | ||
614 | } | ||
615 | mdelay(1); | 612 | mdelay(1); |
616 | timeout--; | 613 | timeout--; |
617 | } | 614 | } |
618 | 615 | ||
619 | if (!timeout) { | 616 | if (!timeout) { |
620 | hw_dbg(hw, "FW or HW has locked the resource for too long.\n"); | 617 | hw_dbg(hw, "Failed to acquire the semaphore.\n"); |
621 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; | 618 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; |
622 | ew32(EXTCNF_CTRL, extcnf_ctrl); | 619 | ew32(EXTCNF_CTRL, extcnf_ctrl); |
623 | mutex_unlock(&nvm_mutex); | 620 | ret_val = -E1000_ERR_CONFIG; |
624 | return -E1000_ERR_CONFIG; | 621 | goto out; |
625 | } | 622 | } |
626 | 623 | ||
627 | return 0; | 624 | out: |
625 | if (ret_val) | ||
626 | mutex_unlock(&nvm_mutex); | ||
627 | |||
628 | return ret_val; | ||
628 | } | 629 | } |
629 | 630 | ||
630 | /** | 631 | /** |
@@ -1306,7 +1307,7 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1306 | struct e1000_nvm_info *nvm = &hw->nvm; | 1307 | struct e1000_nvm_info *nvm = &hw->nvm; |
1307 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; | 1308 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
1308 | u32 act_offset; | 1309 | u32 act_offset; |
1309 | s32 ret_val; | 1310 | s32 ret_val = 0; |
1310 | u32 bank = 0; | 1311 | u32 bank = 0; |
1311 | u16 i, word; | 1312 | u16 i, word; |
1312 | 1313 | ||
@@ -1321,12 +1322,15 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1321 | goto out; | 1322 | goto out; |
1322 | 1323 | ||
1323 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); | 1324 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); |
1324 | if (ret_val) | 1325 | if (ret_val) { |
1325 | goto release; | 1326 | hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n"); |
1327 | bank = 0; | ||
1328 | } | ||
1326 | 1329 | ||
1327 | act_offset = (bank) ? nvm->flash_bank_size : 0; | 1330 | act_offset = (bank) ? nvm->flash_bank_size : 0; |
1328 | act_offset += offset; | 1331 | act_offset += offset; |
1329 | 1332 | ||
1333 | ret_val = 0; | ||
1330 | for (i = 0; i < words; i++) { | 1334 | for (i = 0; i < words; i++) { |
1331 | if ((dev_spec->shadow_ram) && | 1335 | if ((dev_spec->shadow_ram) && |
1332 | (dev_spec->shadow_ram[offset+i].modified)) { | 1336 | (dev_spec->shadow_ram[offset+i].modified)) { |
@@ -1341,7 +1345,6 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1341 | } | 1345 | } |
1342 | } | 1346 | } |
1343 | 1347 | ||
1344 | release: | ||
1345 | e1000_release_swflag_ich8lan(hw); | 1348 | e1000_release_swflag_ich8lan(hw); |
1346 | 1349 | ||
1347 | out: | 1350 | out: |
@@ -1592,7 +1595,6 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1592 | { | 1595 | { |
1593 | struct e1000_nvm_info *nvm = &hw->nvm; | 1596 | struct e1000_nvm_info *nvm = &hw->nvm; |
1594 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; | 1597 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
1595 | s32 ret_val; | ||
1596 | u16 i; | 1598 | u16 i; |
1597 | 1599 | ||
1598 | if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || | 1600 | if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || |
@@ -1601,17 +1603,11 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words, | |||
1601 | return -E1000_ERR_NVM; | 1603 | return -E1000_ERR_NVM; |
1602 | } | 1604 | } |
1603 | 1605 | ||
1604 | ret_val = e1000_acquire_swflag_ich8lan(hw); | ||
1605 | if (ret_val) | ||
1606 | return ret_val; | ||
1607 | |||
1608 | for (i = 0; i < words; i++) { | 1606 | for (i = 0; i < words; i++) { |
1609 | dev_spec->shadow_ram[offset+i].modified = 1; | 1607 | dev_spec->shadow_ram[offset+i].modified = 1; |
1610 | dev_spec->shadow_ram[offset+i].value = data[i]; | 1608 | dev_spec->shadow_ram[offset+i].value = data[i]; |
1611 | } | 1609 | } |
1612 | 1610 | ||
1613 | e1000_release_swflag_ich8lan(hw); | ||
1614 | |||
1615 | return 0; | 1611 | return 0; |
1616 | } | 1612 | } |
1617 | 1613 | ||
@@ -1652,8 +1648,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw) | |||
1652 | */ | 1648 | */ |
1653 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); | 1649 | ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); |
1654 | if (ret_val) { | 1650 | if (ret_val) { |
1655 | e1000_release_swflag_ich8lan(hw); | 1651 | hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n"); |
1656 | goto out; | 1652 | bank = 0; |
1657 | } | 1653 | } |
1658 | 1654 | ||
1659 | if (bank == 0) { | 1655 | if (bank == 0) { |
@@ -2039,12 +2035,8 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) | |||
2039 | iteration = 1; | 2035 | iteration = 1; |
2040 | break; | 2036 | break; |
2041 | case 2: | 2037 | case 2: |
2042 | if (hw->mac.type == e1000_ich9lan) { | 2038 | sector_size = ICH_FLASH_SEG_SIZE_8K; |
2043 | sector_size = ICH_FLASH_SEG_SIZE_8K; | 2039 | iteration = 1; |
2044 | iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_8K; | ||
2045 | } else { | ||
2046 | return -E1000_ERR_NVM; | ||
2047 | } | ||
2048 | break; | 2040 | break; |
2049 | case 3: | 2041 | case 3: |
2050 | sector_size = ICH_FLASH_SEG_SIZE_64K; | 2042 | sector_size = ICH_FLASH_SEG_SIZE_64K; |
@@ -2056,7 +2048,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) | |||
2056 | 2048 | ||
2057 | /* Start with the base address, then add the sector offset. */ | 2049 | /* Start with the base address, then add the sector offset. */ |
2058 | flash_linear_addr = hw->nvm.flash_base_addr; | 2050 | flash_linear_addr = hw->nvm.flash_base_addr; |
2059 | flash_linear_addr += (bank) ? (sector_size * iteration) : 0; | 2051 | flash_linear_addr += (bank) ? flash_bank_size : 0; |
2060 | 2052 | ||
2061 | for (j = 0; j < iteration ; j++) { | 2053 | for (j = 0; j < iteration ; j++) { |
2062 | do { | 2054 | do { |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 63415bb6f48f..fa92a683aefd 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -4538,8 +4538,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
4538 | /* Allow time for pending master requests to run */ | 4538 | /* Allow time for pending master requests to run */ |
4539 | e1000e_disable_pcie_master(&adapter->hw); | 4539 | e1000e_disable_pcie_master(&adapter->hw); |
4540 | 4540 | ||
4541 | if ((adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) && | 4541 | if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) { |
4542 | !(hw->mac.ops.check_mng_mode(hw))) { | ||
4543 | /* enable wakeup by the PHY */ | 4542 | /* enable wakeup by the PHY */ |
4544 | retval = e1000_init_phy_wakeup(adapter, wufc); | 4543 | retval = e1000_init_phy_wakeup(adapter, wufc); |
4545 | if (retval) | 4544 | if (retval) |
@@ -4557,7 +4556,8 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
4557 | *enable_wake = !!wufc; | 4556 | *enable_wake = !!wufc; |
4558 | 4557 | ||
4559 | /* make sure adapter isn't asleep if manageability is enabled */ | 4558 | /* make sure adapter isn't asleep if manageability is enabled */ |
4560 | if (adapter->flags & FLAG_MNG_PT_ENABLED) | 4559 | if ((adapter->flags & FLAG_MNG_PT_ENABLED) || |
4560 | (hw->mac.ops.check_mng_mode(hw))) | ||
4561 | *enable_wake = true; | 4561 | *enable_wake = true; |
4562 | 4562 | ||
4563 | if (adapter->hw.phy.type == e1000_phy_igp_3) | 4563 | if (adapter->hw.phy.type == e1000_phy_igp_3) |
@@ -4670,14 +4670,6 @@ static int e1000_resume(struct pci_dev *pdev) | |||
4670 | return err; | 4670 | return err; |
4671 | } | 4671 | } |
4672 | 4672 | ||
4673 | /* AER (Advanced Error Reporting) hooks */ | ||
4674 | err = pci_enable_pcie_error_reporting(pdev); | ||
4675 | if (err) { | ||
4676 | dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed " | ||
4677 | "0x%x\n", err); | ||
4678 | /* non-fatal, continue */ | ||
4679 | } | ||
4680 | |||
4681 | pci_set_master(pdev); | 4673 | pci_set_master(pdev); |
4682 | 4674 | ||
4683 | pci_enable_wake(pdev, PCI_D3hot, 0); | 4675 | pci_enable_wake(pdev, PCI_D3hot, 0); |
@@ -4990,6 +4982,14 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
4990 | if (err) | 4982 | if (err) |
4991 | goto err_pci_reg; | 4983 | goto err_pci_reg; |
4992 | 4984 | ||
4985 | /* AER (Advanced Error Reporting) hooks */ | ||
4986 | err = pci_enable_pcie_error_reporting(pdev); | ||
4987 | if (err) { | ||
4988 | dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed " | ||
4989 | "0x%x\n", err); | ||
4990 | /* non-fatal, continue */ | ||
4991 | } | ||
4992 | |||
4993 | pci_set_master(pdev); | 4993 | pci_set_master(pdev); |
4994 | /* PCI config space info */ | 4994 | /* PCI config space info */ |
4995 | err = pci_save_state(pdev); | 4995 | err = pci_save_state(pdev); |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index d4b98074b1b7..c9fd82d3a80d 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -285,6 +285,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
285 | { | 285 | { |
286 | struct fec_enet_private *fep = netdev_priv(dev); | 286 | struct fec_enet_private *fep = netdev_priv(dev); |
287 | struct bufdesc *bdp; | 287 | struct bufdesc *bdp; |
288 | void *bufaddr; | ||
288 | unsigned short status; | 289 | unsigned short status; |
289 | unsigned long flags; | 290 | unsigned long flags; |
290 | 291 | ||
@@ -312,7 +313,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
312 | status &= ~BD_ENET_TX_STATS; | 313 | status &= ~BD_ENET_TX_STATS; |
313 | 314 | ||
314 | /* Set buffer length and buffer pointer */ | 315 | /* Set buffer length and buffer pointer */ |
315 | bdp->cbd_bufaddr = __pa(skb->data); | 316 | bufaddr = skb->data; |
316 | bdp->cbd_datlen = skb->len; | 317 | bdp->cbd_datlen = skb->len; |
317 | 318 | ||
318 | /* | 319 | /* |
@@ -320,11 +321,11 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
320 | * 4-byte boundaries. Use bounce buffers to copy data | 321 | * 4-byte boundaries. Use bounce buffers to copy data |
321 | * and get it aligned. Ugh. | 322 | * and get it aligned. Ugh. |
322 | */ | 323 | */ |
323 | if (bdp->cbd_bufaddr & FEC_ALIGNMENT) { | 324 | if (((unsigned long) bufaddr) & FEC_ALIGNMENT) { |
324 | unsigned int index; | 325 | unsigned int index; |
325 | index = bdp - fep->tx_bd_base; | 326 | index = bdp - fep->tx_bd_base; |
326 | memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len); | 327 | memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len); |
327 | bdp->cbd_bufaddr = __pa(fep->tx_bounce[index]); | 328 | bufaddr = fep->tx_bounce[index]; |
328 | } | 329 | } |
329 | 330 | ||
330 | /* Save skb pointer */ | 331 | /* Save skb pointer */ |
@@ -336,7 +337,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
336 | /* Push the data cache so the CPM does not get stale memory | 337 | /* Push the data cache so the CPM does not get stale memory |
337 | * data. | 338 | * data. |
338 | */ | 339 | */ |
339 | bdp->cbd_bufaddr = dma_map_single(&dev->dev, skb->data, | 340 | bdp->cbd_bufaddr = dma_map_single(&dev->dev, bufaddr, |
340 | FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); | 341 | FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); |
341 | 342 | ||
342 | /* Send it on its way. Tell FEC it's ready, interrupt when done, | 343 | /* Send it on its way. Tell FEC it's ready, interrupt when done, |
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index cc786333d95c..c40113f58963 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c | |||
@@ -309,6 +309,7 @@ static int mpc52xx_fec_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
309 | { | 309 | { |
310 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); | 310 | struct mpc52xx_fec_priv *priv = netdev_priv(dev); |
311 | struct bcom_fec_bd *bd; | 311 | struct bcom_fec_bd *bd; |
312 | unsigned long flags; | ||
312 | 313 | ||
313 | if (bcom_queue_full(priv->tx_dmatsk)) { | 314 | if (bcom_queue_full(priv->tx_dmatsk)) { |
314 | if (net_ratelimit()) | 315 | if (net_ratelimit()) |
@@ -316,7 +317,7 @@ static int mpc52xx_fec_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
316 | return NETDEV_TX_BUSY; | 317 | return NETDEV_TX_BUSY; |
317 | } | 318 | } |
318 | 319 | ||
319 | spin_lock_irq(&priv->lock); | 320 | spin_lock_irqsave(&priv->lock, flags); |
320 | dev->trans_start = jiffies; | 321 | dev->trans_start = jiffies; |
321 | 322 | ||
322 | bd = (struct bcom_fec_bd *) | 323 | bd = (struct bcom_fec_bd *) |
@@ -332,7 +333,7 @@ static int mpc52xx_fec_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
332 | netif_stop_queue(dev); | 333 | netif_stop_queue(dev); |
333 | } | 334 | } |
334 | 335 | ||
335 | spin_unlock_irq(&priv->lock); | 336 | spin_unlock_irqrestore(&priv->lock, flags); |
336 | 337 | ||
337 | return NETDEV_TX_OK; | 338 | return NETDEV_TX_OK; |
338 | } | 339 | } |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index f8ffcbf0bc39..24f7ca5e17de 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -491,6 +491,7 @@ static int gfar_remove(struct of_device *ofdev) | |||
491 | 491 | ||
492 | dev_set_drvdata(&ofdev->dev, NULL); | 492 | dev_set_drvdata(&ofdev->dev, NULL); |
493 | 493 | ||
494 | unregister_netdev(dev); | ||
494 | iounmap(priv->regs); | 495 | iounmap(priv->regs); |
495 | free_netdev(priv->ndev); | 496 | free_netdev(priv->ndev); |
496 | 497 | ||
@@ -936,6 +937,7 @@ int startup_gfar(struct net_device *dev) | |||
936 | struct gfar __iomem *regs = priv->regs; | 937 | struct gfar __iomem *regs = priv->regs; |
937 | int err = 0; | 938 | int err = 0; |
938 | u32 rctrl = 0; | 939 | u32 rctrl = 0; |
940 | u32 tctrl = 0; | ||
939 | u32 attrs = 0; | 941 | u32 attrs = 0; |
940 | 942 | ||
941 | gfar_write(®s->imask, IMASK_INIT_CLEAR); | 943 | gfar_write(®s->imask, IMASK_INIT_CLEAR); |
@@ -1111,11 +1113,19 @@ int startup_gfar(struct net_device *dev) | |||
1111 | rctrl |= RCTRL_PADDING(priv->padding); | 1113 | rctrl |= RCTRL_PADDING(priv->padding); |
1112 | } | 1114 | } |
1113 | 1115 | ||
1116 | /* keep vlan related bits if it's enabled */ | ||
1117 | if (priv->vlgrp) { | ||
1118 | rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT; | ||
1119 | tctrl |= TCTRL_VLINS; | ||
1120 | } | ||
1121 | |||
1114 | /* Init rctrl based on our settings */ | 1122 | /* Init rctrl based on our settings */ |
1115 | gfar_write(&priv->regs->rctrl, rctrl); | 1123 | gfar_write(&priv->regs->rctrl, rctrl); |
1116 | 1124 | ||
1117 | if (dev->features & NETIF_F_IP_CSUM) | 1125 | if (dev->features & NETIF_F_IP_CSUM) |
1118 | gfar_write(&priv->regs->tctrl, TCTRL_INIT_CSUM); | 1126 | tctrl |= TCTRL_INIT_CSUM; |
1127 | |||
1128 | gfar_write(&priv->regs->tctrl, tctrl); | ||
1119 | 1129 | ||
1120 | /* Set the extraction length and index */ | 1130 | /* Set the extraction length and index */ |
1121 | attrs = ATTRELI_EL(priv->rx_stash_size) | | 1131 | attrs = ATTRELI_EL(priv->rx_stash_size) | |
@@ -1450,7 +1460,6 @@ static void gfar_vlan_rx_register(struct net_device *dev, | |||
1450 | 1460 | ||
1451 | /* Enable VLAN tag extraction */ | 1461 | /* Enable VLAN tag extraction */ |
1452 | tempval = gfar_read(&priv->regs->rctrl); | 1462 | tempval = gfar_read(&priv->regs->rctrl); |
1453 | tempval |= RCTRL_VLEX; | ||
1454 | tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT); | 1463 | tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT); |
1455 | gfar_write(&priv->regs->rctrl, tempval); | 1464 | gfar_write(&priv->regs->rctrl, tempval); |
1456 | } else { | 1465 | } else { |
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index beb84213b671..f0f890803710 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
@@ -1305,6 +1305,8 @@ static int emac_close(struct net_device *ndev) | |||
1305 | 1305 | ||
1306 | free_irq(dev->emac_irq, dev); | 1306 | free_irq(dev->emac_irq, dev); |
1307 | 1307 | ||
1308 | netif_carrier_off(ndev); | ||
1309 | |||
1308 | return 0; | 1310 | return 0; |
1309 | } | 1311 | } |
1310 | 1312 | ||
diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c index c4361d466597..ee1cff5c9b21 100644 --- a/drivers/net/irda/au1k_ir.c +++ b/drivers/net/irda/au1k_ir.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/netdevice.h> | 25 | #include <linux/netdevice.h> |
26 | #include <linux/etherdevice.h> | ||
27 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
28 | #include <linux/rtnetlink.h> | 27 | #include <linux/rtnetlink.h> |
29 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
@@ -205,9 +204,6 @@ static const struct net_device_ops au1k_irda_netdev_ops = { | |||
205 | .ndo_start_xmit = au1k_irda_hard_xmit, | 204 | .ndo_start_xmit = au1k_irda_hard_xmit, |
206 | .ndo_tx_timeout = au1k_tx_timeout, | 205 | .ndo_tx_timeout = au1k_tx_timeout, |
207 | .ndo_do_ioctl = au1k_irda_ioctl, | 206 | .ndo_do_ioctl = au1k_irda_ioctl, |
208 | .ndo_change_mtu = eth_change_mtu, | ||
209 | .ndo_validate_addr = eth_validate_addr, | ||
210 | .ndo_set_mac_address = eth_mac_addr, | ||
211 | }; | 207 | }; |
212 | 208 | ||
213 | static int au1k_irda_net_init(struct net_device *dev) | 209 | static int au1k_irda_net_init(struct net_device *dev) |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index 3376a4f39e0a..77d10edefd25 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -803,9 +803,6 @@ static const struct net_device_ops pxa_irda_netdev_ops = { | |||
803 | .ndo_stop = pxa_irda_stop, | 803 | .ndo_stop = pxa_irda_stop, |
804 | .ndo_start_xmit = pxa_irda_hard_xmit, | 804 | .ndo_start_xmit = pxa_irda_hard_xmit, |
805 | .ndo_do_ioctl = pxa_irda_ioctl, | 805 | .ndo_do_ioctl = pxa_irda_ioctl, |
806 | .ndo_change_mtu = eth_change_mtu, | ||
807 | .ndo_validate_addr = eth_validate_addr, | ||
808 | .ndo_set_mac_address = eth_mac_addr, | ||
809 | }; | 806 | }; |
810 | 807 | ||
811 | static int pxa_irda_probe(struct platform_device *pdev) | 808 | static int pxa_irda_probe(struct platform_device *pdev) |
@@ -830,6 +827,7 @@ static int pxa_irda_probe(struct platform_device *pdev) | |||
830 | if (!dev) | 827 | if (!dev) |
831 | goto err_mem_3; | 828 | goto err_mem_3; |
832 | 829 | ||
830 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
833 | si = netdev_priv(dev); | 831 | si = netdev_priv(dev); |
834 | si->dev = &pdev->dev; | 832 | si->dev = &pdev->dev; |
835 | si->pdata = pdev->dev.platform_data; | 833 | si->pdata = pdev->dev.platform_data; |
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c index 2aeb2e6aec1b..b039cb081e94 100644 --- a/drivers/net/irda/sa1100_ir.c +++ b/drivers/net/irda/sa1100_ir.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
26 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
27 | #include <linux/etherdevice.h> | ||
28 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
29 | #include <linux/rtnetlink.h> | 28 | #include <linux/rtnetlink.h> |
30 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
@@ -881,9 +880,6 @@ static const struct net_device_ops sa1100_irda_netdev_ops = { | |||
881 | .ndo_stop = sa1100_irda_stop, | 880 | .ndo_stop = sa1100_irda_stop, |
882 | .ndo_start_xmit = sa1100_irda_hard_xmit, | 881 | .ndo_start_xmit = sa1100_irda_hard_xmit, |
883 | .ndo_do_ioctl = sa1100_irda_ioctl, | 882 | .ndo_do_ioctl = sa1100_irda_ioctl, |
884 | .ndo_change_mtu = eth_change_mtu, | ||
885 | .ndo_validate_addr = eth_validate_addr, | ||
886 | .ndo_set_mac_address = eth_mac_addr, | ||
887 | }; | 883 | }; |
888 | 884 | ||
889 | static int sa1100_irda_probe(struct platform_device *pdev) | 885 | static int sa1100_irda_probe(struct platform_device *pdev) |
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c index d0883835b0c6..fe4f2b2bff96 100644 --- a/drivers/net/irda/w83977af_ir.c +++ b/drivers/net/irda/w83977af_ir.c | |||
@@ -115,7 +115,7 @@ static int __init w83977af_init(void) | |||
115 | 115 | ||
116 | IRDA_DEBUG(0, "%s()\n", __func__ ); | 116 | IRDA_DEBUG(0, "%s()\n", __func__ ); |
117 | 117 | ||
118 | for (i=0; (io[i] < 2000) && (i < ARRAY_SIZE(dev_self)); i++) { | 118 | for (i=0; i < ARRAY_SIZE(dev_self) && io[i] < 2000; i++) { |
119 | if (w83977af_open(i, io[i], irq[i], dma[i]) == 0) | 119 | if (w83977af_open(i, io[i], irq[i], dma[i]) == 0) |
120 | return 0; | 120 | return 0; |
121 | } | 121 | } |
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index e11d83d5852b..2c4dc8221dcd 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -136,6 +136,8 @@ struct ixgbe_ring { | |||
136 | 136 | ||
137 | u8 queue_index; /* needed for multiqueue queue management */ | 137 | u8 queue_index; /* needed for multiqueue queue management */ |
138 | 138 | ||
139 | #define IXGBE_RING_RX_PS_ENABLED (u8)(1) | ||
140 | u8 flags; /* per ring feature flags */ | ||
139 | u16 head; | 141 | u16 head; |
140 | u16 tail; | 142 | u16 tail; |
141 | 143 | ||
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 79144e950a34..dff8dfac7ed9 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -1948,6 +1948,7 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
1948 | struct ethtool_coalesce *ec) | 1948 | struct ethtool_coalesce *ec) |
1949 | { | 1949 | { |
1950 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 1950 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
1951 | struct ixgbe_q_vector *q_vector; | ||
1951 | int i; | 1952 | int i; |
1952 | 1953 | ||
1953 | if (ec->tx_max_coalesced_frames_irq) | 1954 | if (ec->tx_max_coalesced_frames_irq) |
@@ -1982,14 +1983,24 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
1982 | adapter->itr_setting = 0; | 1983 | adapter->itr_setting = 0; |
1983 | } | 1984 | } |
1984 | 1985 | ||
1985 | for (i = 0; i < adapter->num_msix_vectors - NON_Q_VECTORS; i++) { | 1986 | /* MSI/MSIx Interrupt Mode */ |
1986 | struct ixgbe_q_vector *q_vector = adapter->q_vector[i]; | 1987 | if (adapter->flags & |
1987 | if (q_vector->txr_count && !q_vector->rxr_count) | 1988 | (IXGBE_FLAG_MSIX_ENABLED | IXGBE_FLAG_MSI_ENABLED)) { |
1988 | /* tx vector gets half the rate */ | 1989 | int num_vectors = adapter->num_msix_vectors - NON_Q_VECTORS; |
1989 | q_vector->eitr = (adapter->eitr_param >> 1); | 1990 | for (i = 0; i < num_vectors; i++) { |
1990 | else | 1991 | q_vector = adapter->q_vector[i]; |
1991 | /* rx only or mixed */ | 1992 | if (q_vector->txr_count && !q_vector->rxr_count) |
1992 | q_vector->eitr = adapter->eitr_param; | 1993 | /* tx vector gets half the rate */ |
1994 | q_vector->eitr = (adapter->eitr_param >> 1); | ||
1995 | else | ||
1996 | /* rx only or mixed */ | ||
1997 | q_vector->eitr = adapter->eitr_param; | ||
1998 | ixgbe_write_eitr(q_vector); | ||
1999 | } | ||
2000 | /* Legacy Interrupt Mode */ | ||
2001 | } else { | ||
2002 | q_vector = adapter->q_vector[0]; | ||
2003 | q_vector->eitr = adapter->eitr_param; | ||
1993 | ixgbe_write_eitr(q_vector); | 2004 | ixgbe_write_eitr(q_vector); |
1994 | } | 2005 | } |
1995 | 2006 | ||
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c index fa9f24e23683..28cf104e36cc 100644 --- a/drivers/net/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ixgbe/ixgbe_fcoe.c | |||
@@ -336,7 +336,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, | |||
336 | /* return 0 to bypass going to ULD for DDPed data */ | 336 | /* return 0 to bypass going to ULD for DDPed data */ |
337 | if (fcstat == IXGBE_RXDADV_STAT_FCSTAT_DDP) | 337 | if (fcstat == IXGBE_RXDADV_STAT_FCSTAT_DDP) |
338 | rc = 0; | 338 | rc = 0; |
339 | else | 339 | else if (ddp->len) |
340 | rc = ddp->len; | 340 | rc = ddp->len; |
341 | } | 341 | } |
342 | 342 | ||
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 110c65ab5cb5..77b0381a2b5c 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -492,12 +492,12 @@ static void ixgbe_receive_skb(struct ixgbe_q_vector *q_vector, | |||
492 | 492 | ||
493 | skb_record_rx_queue(skb, ring->queue_index); | 493 | skb_record_rx_queue(skb, ring->queue_index); |
494 | if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) { | 494 | if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) { |
495 | if (adapter->vlgrp && is_vlan && (tag != 0)) | 495 | if (adapter->vlgrp && is_vlan && (tag & VLAN_VID_MASK)) |
496 | vlan_gro_receive(napi, adapter->vlgrp, tag, skb); | 496 | vlan_gro_receive(napi, adapter->vlgrp, tag, skb); |
497 | else | 497 | else |
498 | napi_gro_receive(napi, skb); | 498 | napi_gro_receive(napi, skb); |
499 | } else { | 499 | } else { |
500 | if (adapter->vlgrp && is_vlan && (tag != 0)) | 500 | if (adapter->vlgrp && is_vlan && (tag & VLAN_VID_MASK)) |
501 | vlan_hwaccel_rx(skb, adapter->vlgrp, tag); | 501 | vlan_hwaccel_rx(skb, adapter->vlgrp, tag); |
502 | else | 502 | else |
503 | netif_rx(skb); | 503 | netif_rx(skb); |
@@ -585,7 +585,7 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, | |||
585 | rx_desc = IXGBE_RX_DESC_ADV(*rx_ring, i); | 585 | rx_desc = IXGBE_RX_DESC_ADV(*rx_ring, i); |
586 | 586 | ||
587 | if (!bi->page_dma && | 587 | if (!bi->page_dma && |
588 | (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED)) { | 588 | (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED)) { |
589 | if (!bi->page) { | 589 | if (!bi->page) { |
590 | bi->page = alloc_page(GFP_ATOMIC); | 590 | bi->page = alloc_page(GFP_ATOMIC); |
591 | if (!bi->page) { | 591 | if (!bi->page) { |
@@ -629,7 +629,7 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, | |||
629 | } | 629 | } |
630 | /* Refresh the desc even if buffer_addrs didn't change because | 630 | /* Refresh the desc even if buffer_addrs didn't change because |
631 | * each write-back erases this info. */ | 631 | * each write-back erases this info. */ |
632 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 632 | if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) { |
633 | rx_desc->read.pkt_addr = cpu_to_le64(bi->page_dma); | 633 | rx_desc->read.pkt_addr = cpu_to_le64(bi->page_dma); |
634 | rx_desc->read.hdr_addr = cpu_to_le64(bi->dma); | 634 | rx_desc->read.hdr_addr = cpu_to_le64(bi->dma); |
635 | } else { | 635 | } else { |
@@ -726,7 +726,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
726 | break; | 726 | break; |
727 | (*work_done)++; | 727 | (*work_done)++; |
728 | 728 | ||
729 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 729 | if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) { |
730 | hdr_info = le16_to_cpu(ixgbe_get_hdr_info(rx_desc)); | 730 | hdr_info = le16_to_cpu(ixgbe_get_hdr_info(rx_desc)); |
731 | len = (hdr_info & IXGBE_RXDADV_HDRBUFLEN_MASK) >> | 731 | len = (hdr_info & IXGBE_RXDADV_HDRBUFLEN_MASK) >> |
732 | IXGBE_RXDADV_HDRBUFLEN_SHIFT; | 732 | IXGBE_RXDADV_HDRBUFLEN_SHIFT; |
@@ -798,7 +798,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
798 | rx_ring->stats.packets++; | 798 | rx_ring->stats.packets++; |
799 | rx_ring->stats.bytes += skb->len; | 799 | rx_ring->stats.bytes += skb->len; |
800 | } else { | 800 | } else { |
801 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 801 | if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) { |
802 | rx_buffer_info->skb = next_buffer->skb; | 802 | rx_buffer_info->skb = next_buffer->skb; |
803 | rx_buffer_info->dma = next_buffer->dma; | 803 | rx_buffer_info->dma = next_buffer->dma; |
804 | next_buffer->skb = skb; | 804 | next_buffer->skb = skb; |
@@ -1898,46 +1898,19 @@ static void ixgbe_configure_tx(struct ixgbe_adapter *adapter) | |||
1898 | 1898 | ||
1899 | #define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2 | 1899 | #define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2 |
1900 | 1900 | ||
1901 | static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index) | 1901 | static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, |
1902 | struct ixgbe_ring *rx_ring) | ||
1902 | { | 1903 | { |
1903 | struct ixgbe_ring *rx_ring; | ||
1904 | u32 srrctl; | 1904 | u32 srrctl; |
1905 | int queue0 = 0; | 1905 | int index; |
1906 | unsigned long mask; | ||
1907 | struct ixgbe_ring_feature *feature = adapter->ring_feature; | 1906 | struct ixgbe_ring_feature *feature = adapter->ring_feature; |
1908 | 1907 | ||
1909 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | 1908 | index = rx_ring->reg_idx; |
1910 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | 1909 | if (adapter->hw.mac.type == ixgbe_mac_82598EB) { |
1911 | int dcb_i = feature[RING_F_DCB].indices; | 1910 | unsigned long mask; |
1912 | if (dcb_i == 8) | ||
1913 | queue0 = index >> 4; | ||
1914 | else if (dcb_i == 4) | ||
1915 | queue0 = index >> 5; | ||
1916 | else | ||
1917 | dev_err(&adapter->pdev->dev, "Invalid DCB " | ||
1918 | "configuration\n"); | ||
1919 | #ifdef IXGBE_FCOE | ||
1920 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) { | ||
1921 | struct ixgbe_ring_feature *f; | ||
1922 | |||
1923 | rx_ring = &adapter->rx_ring[queue0]; | ||
1924 | f = &adapter->ring_feature[RING_F_FCOE]; | ||
1925 | if ((queue0 == 0) && (index > rx_ring->reg_idx)) | ||
1926 | queue0 = f->mask + index - | ||
1927 | rx_ring->reg_idx - 1; | ||
1928 | } | ||
1929 | #endif /* IXGBE_FCOE */ | ||
1930 | } else { | ||
1931 | queue0 = index; | ||
1932 | } | ||
1933 | } else { | ||
1934 | mask = (unsigned long) feature[RING_F_RSS].mask; | 1911 | mask = (unsigned long) feature[RING_F_RSS].mask; |
1935 | queue0 = index & mask; | ||
1936 | index = index & mask; | 1912 | index = index & mask; |
1937 | } | 1913 | } |
1938 | |||
1939 | rx_ring = &adapter->rx_ring[queue0]; | ||
1940 | |||
1941 | srrctl = IXGBE_READ_REG(&adapter->hw, IXGBE_SRRCTL(index)); | 1914 | srrctl = IXGBE_READ_REG(&adapter->hw, IXGBE_SRRCTL(index)); |
1942 | 1915 | ||
1943 | srrctl &= ~IXGBE_SRRCTL_BSIZEHDR_MASK; | 1916 | srrctl &= ~IXGBE_SRRCTL_BSIZEHDR_MASK; |
@@ -1946,7 +1919,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index) | |||
1946 | srrctl |= (IXGBE_RX_HDR_SIZE << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) & | 1919 | srrctl |= (IXGBE_RX_HDR_SIZE << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) & |
1947 | IXGBE_SRRCTL_BSIZEHDR_MASK; | 1920 | IXGBE_SRRCTL_BSIZEHDR_MASK; |
1948 | 1921 | ||
1949 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 1922 | if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) { |
1950 | #if (PAGE_SIZE / 2) > IXGBE_MAX_RXBUFFER | 1923 | #if (PAGE_SIZE / 2) > IXGBE_MAX_RXBUFFER |
1951 | srrctl |= IXGBE_MAX_RXBUFFER >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; | 1924 | srrctl |= IXGBE_MAX_RXBUFFER >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; |
1952 | #else | 1925 | #else |
@@ -2002,6 +1975,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2002 | { | 1975 | { |
2003 | u64 rdba; | 1976 | u64 rdba; |
2004 | struct ixgbe_hw *hw = &adapter->hw; | 1977 | struct ixgbe_hw *hw = &adapter->hw; |
1978 | struct ixgbe_ring *rx_ring; | ||
2005 | struct net_device *netdev = adapter->netdev; | 1979 | struct net_device *netdev = adapter->netdev; |
2006 | int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; | 1980 | int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; |
2007 | int i, j; | 1981 | int i, j; |
@@ -2018,11 +1992,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2018 | /* Decide whether to use packet split mode or not */ | 1992 | /* Decide whether to use packet split mode or not */ |
2019 | adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; | 1993 | adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; |
2020 | 1994 | ||
2021 | #ifdef IXGBE_FCOE | ||
2022 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) | ||
2023 | adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED; | ||
2024 | #endif /* IXGBE_FCOE */ | ||
2025 | |||
2026 | /* Set the RX buffer length according to the mode */ | 1995 | /* Set the RX buffer length according to the mode */ |
2027 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 1996 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { |
2028 | rx_buf_len = IXGBE_RX_HDR_SIZE; | 1997 | rx_buf_len = IXGBE_RX_HDR_SIZE; |
@@ -2070,29 +2039,35 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2070 | * the Base and Length of the Rx Descriptor Ring | 2039 | * the Base and Length of the Rx Descriptor Ring |
2071 | */ | 2040 | */ |
2072 | for (i = 0; i < adapter->num_rx_queues; i++) { | 2041 | for (i = 0; i < adapter->num_rx_queues; i++) { |
2073 | rdba = adapter->rx_ring[i].dma; | 2042 | rx_ring = &adapter->rx_ring[i]; |
2074 | j = adapter->rx_ring[i].reg_idx; | 2043 | rdba = rx_ring->dma; |
2044 | j = rx_ring->reg_idx; | ||
2075 | IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j), (rdba & DMA_BIT_MASK(32))); | 2045 | IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j), (rdba & DMA_BIT_MASK(32))); |
2076 | IXGBE_WRITE_REG(hw, IXGBE_RDBAH(j), (rdba >> 32)); | 2046 | IXGBE_WRITE_REG(hw, IXGBE_RDBAH(j), (rdba >> 32)); |
2077 | IXGBE_WRITE_REG(hw, IXGBE_RDLEN(j), rdlen); | 2047 | IXGBE_WRITE_REG(hw, IXGBE_RDLEN(j), rdlen); |
2078 | IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0); | 2048 | IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0); |
2079 | IXGBE_WRITE_REG(hw, IXGBE_RDT(j), 0); | 2049 | IXGBE_WRITE_REG(hw, IXGBE_RDT(j), 0); |
2080 | adapter->rx_ring[i].head = IXGBE_RDH(j); | 2050 | rx_ring->head = IXGBE_RDH(j); |
2081 | adapter->rx_ring[i].tail = IXGBE_RDT(j); | 2051 | rx_ring->tail = IXGBE_RDT(j); |
2082 | adapter->rx_ring[i].rx_buf_len = rx_buf_len; | 2052 | rx_ring->rx_buf_len = rx_buf_len; |
2053 | |||
2054 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) | ||
2055 | rx_ring->flags |= IXGBE_RING_RX_PS_ENABLED; | ||
2083 | 2056 | ||
2084 | #ifdef IXGBE_FCOE | 2057 | #ifdef IXGBE_FCOE |
2085 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) { | 2058 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) { |
2086 | struct ixgbe_ring_feature *f; | 2059 | struct ixgbe_ring_feature *f; |
2087 | f = &adapter->ring_feature[RING_F_FCOE]; | 2060 | f = &adapter->ring_feature[RING_F_FCOE]; |
2088 | if ((rx_buf_len < IXGBE_FCOE_JUMBO_FRAME_SIZE) && | 2061 | if ((i >= f->mask) && (i < f->mask + f->indices)) { |
2089 | (i >= f->mask) && (i < f->mask + f->indices)) | 2062 | rx_ring->flags &= ~IXGBE_RING_RX_PS_ENABLED; |
2090 | adapter->rx_ring[i].rx_buf_len = | 2063 | if (rx_buf_len < IXGBE_FCOE_JUMBO_FRAME_SIZE) |
2091 | IXGBE_FCOE_JUMBO_FRAME_SIZE; | 2064 | rx_ring->rx_buf_len = |
2065 | IXGBE_FCOE_JUMBO_FRAME_SIZE; | ||
2066 | } | ||
2092 | } | 2067 | } |
2093 | 2068 | ||
2094 | #endif /* IXGBE_FCOE */ | 2069 | #endif /* IXGBE_FCOE */ |
2095 | ixgbe_configure_srrctl(adapter, j); | 2070 | ixgbe_configure_srrctl(adapter, rx_ring); |
2096 | } | 2071 | } |
2097 | 2072 | ||
2098 | if (hw->mac.type == ixgbe_mac_82598EB) { | 2073 | if (hw->mac.type == ixgbe_mac_82598EB) { |
@@ -2168,7 +2143,8 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2168 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { | 2143 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { |
2169 | /* Enable 82599 HW-RSC */ | 2144 | /* Enable 82599 HW-RSC */ |
2170 | for (i = 0; i < adapter->num_rx_queues; i++) { | 2145 | for (i = 0; i < adapter->num_rx_queues; i++) { |
2171 | j = adapter->rx_ring[i].reg_idx; | 2146 | rx_ring = &adapter->rx_ring[i]; |
2147 | j = rx_ring->reg_idx; | ||
2172 | rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(j)); | 2148 | rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(j)); |
2173 | rscctrl |= IXGBE_RSCCTL_RSCEN; | 2149 | rscctrl |= IXGBE_RSCCTL_RSCEN; |
2174 | /* | 2150 | /* |
@@ -2176,7 +2152,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2176 | * total size of max desc * buf_len is not greater | 2152 | * total size of max desc * buf_len is not greater |
2177 | * than 65535 | 2153 | * than 65535 |
2178 | */ | 2154 | */ |
2179 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 2155 | if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) { |
2180 | #if (MAX_SKB_FRAGS > 16) | 2156 | #if (MAX_SKB_FRAGS > 16) |
2181 | rscctrl |= IXGBE_RSCCTL_MAXDESC_16; | 2157 | rscctrl |= IXGBE_RSCCTL_MAXDESC_16; |
2182 | #elif (MAX_SKB_FRAGS > 8) | 2158 | #elif (MAX_SKB_FRAGS > 8) |
diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c index 2a0174b62e96..92fb8235c766 100644 --- a/drivers/net/ixp2000/ixpdev.c +++ b/drivers/net/ixp2000/ixpdev.c | |||
@@ -41,6 +41,7 @@ static int ixpdev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
41 | struct ixpdev_priv *ip = netdev_priv(dev); | 41 | struct ixpdev_priv *ip = netdev_priv(dev); |
42 | struct ixpdev_tx_desc *desc; | 42 | struct ixpdev_tx_desc *desc; |
43 | int entry; | 43 | int entry; |
44 | unsigned long flags; | ||
44 | 45 | ||
45 | if (unlikely(skb->len > PAGE_SIZE)) { | 46 | if (unlikely(skb->len > PAGE_SIZE)) { |
46 | /* @@@ Count drops. */ | 47 | /* @@@ Count drops. */ |
@@ -63,11 +64,11 @@ static int ixpdev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
63 | 64 | ||
64 | dev->trans_start = jiffies; | 65 | dev->trans_start = jiffies; |
65 | 66 | ||
66 | local_irq_disable(); | 67 | local_irq_save(flags); |
67 | ip->tx_queue_entries++; | 68 | ip->tx_queue_entries++; |
68 | if (ip->tx_queue_entries == TX_BUF_COUNT_PER_CHAN) | 69 | if (ip->tx_queue_entries == TX_BUF_COUNT_PER_CHAN) |
69 | netif_stop_queue(dev); | 70 | netif_stop_queue(dev); |
70 | local_irq_enable(); | 71 | local_irq_restore(flags); |
71 | 72 | ||
72 | return 0; | 73 | return 0; |
73 | } | 74 | } |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 5b5c25368d1e..e3601cf3f931 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -620,6 +620,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
620 | dma_addr_t mapping; | 620 | dma_addr_t mapping; |
621 | unsigned int len, entry; | 621 | unsigned int len, entry; |
622 | u32 ctrl; | 622 | u32 ctrl; |
623 | unsigned long flags; | ||
623 | 624 | ||
624 | #ifdef DEBUG | 625 | #ifdef DEBUG |
625 | int i; | 626 | int i; |
@@ -635,12 +636,12 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
635 | #endif | 636 | #endif |
636 | 637 | ||
637 | len = skb->len; | 638 | len = skb->len; |
638 | spin_lock_irq(&bp->lock); | 639 | spin_lock_irqsave(&bp->lock, flags); |
639 | 640 | ||
640 | /* This is a hard error, log it. */ | 641 | /* This is a hard error, log it. */ |
641 | if (TX_BUFFS_AVAIL(bp) < 1) { | 642 | if (TX_BUFFS_AVAIL(bp) < 1) { |
642 | netif_stop_queue(dev); | 643 | netif_stop_queue(dev); |
643 | spin_unlock_irq(&bp->lock); | 644 | spin_unlock_irqrestore(&bp->lock, flags); |
644 | dev_err(&bp->pdev->dev, | 645 | dev_err(&bp->pdev->dev, |
645 | "BUG! Tx Ring full when queue awake!\n"); | 646 | "BUG! Tx Ring full when queue awake!\n"); |
646 | dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n", | 647 | dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n", |
@@ -674,7 +675,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
674 | if (TX_BUFFS_AVAIL(bp) < 1) | 675 | if (TX_BUFFS_AVAIL(bp) < 1) |
675 | netif_stop_queue(dev); | 676 | netif_stop_queue(dev); |
676 | 677 | ||
677 | spin_unlock_irq(&bp->lock); | 678 | spin_unlock_irqrestore(&bp->lock, flags); |
678 | 679 | ||
679 | dev->trans_start = jiffies; | 680 | dev->trans_start = jiffies; |
680 | 681 | ||
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c index 91bdfdfd431f..3ac0404d0d11 100644 --- a/drivers/net/mlx4/en_rx.c +++ b/drivers/net/mlx4/en_rx.c | |||
@@ -506,8 +506,9 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv, | |||
506 | PCI_DMA_FROMDEVICE); | 506 | PCI_DMA_FROMDEVICE); |
507 | } | 507 | } |
508 | /* Adjust size of last fragment to match actual length */ | 508 | /* Adjust size of last fragment to match actual length */ |
509 | skb_frags_rx[nr - 1].size = length - | 509 | if (nr > 0) |
510 | priv->frag_info[nr - 1].frag_prefix_size; | 510 | skb_frags_rx[nr - 1].size = length - |
511 | priv->frag_info[nr - 1].frag_prefix_size; | ||
511 | return nr; | 512 | return nr; |
512 | 513 | ||
513 | fail: | 514 | fail: |
diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c index 5a88b3f57693..62208401c4df 100644 --- a/drivers/net/mlx4/en_tx.c +++ b/drivers/net/mlx4/en_tx.c | |||
@@ -437,6 +437,7 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind) | |||
437 | { | 437 | { |
438 | struct mlx4_en_cq *cq = &priv->tx_cq[tx_ind]; | 438 | struct mlx4_en_cq *cq = &priv->tx_cq[tx_ind]; |
439 | struct mlx4_en_tx_ring *ring = &priv->tx_ring[tx_ind]; | 439 | struct mlx4_en_tx_ring *ring = &priv->tx_ring[tx_ind]; |
440 | unsigned long flags; | ||
440 | 441 | ||
441 | /* If we don't have a pending timer, set one up to catch our recent | 442 | /* If we don't have a pending timer, set one up to catch our recent |
442 | post in case the interface becomes idle */ | 443 | post in case the interface becomes idle */ |
@@ -445,9 +446,9 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind) | |||
445 | 446 | ||
446 | /* Poll the CQ every mlx4_en_TX_MODER_POLL packets */ | 447 | /* Poll the CQ every mlx4_en_TX_MODER_POLL packets */ |
447 | if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0) | 448 | if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0) |
448 | if (spin_trylock_irq(&ring->comp_lock)) { | 449 | if (spin_trylock_irqsave(&ring->comp_lock, flags)) { |
449 | mlx4_en_process_tx_cq(priv->dev, cq); | 450 | mlx4_en_process_tx_cq(priv->dev, cq); |
450 | spin_unlock_irq(&ring->comp_lock); | 451 | spin_unlock_irqrestore(&ring->comp_lock, flags); |
451 | } | 452 | } |
452 | } | 453 | } |
453 | 454 | ||
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index f86e05047d19..a9c1fcca5e75 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -1254,7 +1254,7 @@ struct netxen_adapter { | |||
1254 | u8 mc_enabled; | 1254 | u8 mc_enabled; |
1255 | u8 max_mc_count; | 1255 | u8 max_mc_count; |
1256 | u8 rss_supported; | 1256 | u8 rss_supported; |
1257 | u8 resv2; | 1257 | u8 link_changed; |
1258 | u32 resv3; | 1258 | u32 resv3; |
1259 | 1259 | ||
1260 | u8 has_link_events; | 1260 | u8 has_link_events; |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 7acf204e38c9..5d3343ef3d86 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -184,13 +184,6 @@ void netxen_free_sw_resources(struct netxen_adapter *adapter) | |||
184 | kfree(recv_ctx->rds_rings); | 184 | kfree(recv_ctx->rds_rings); |
185 | 185 | ||
186 | skip_rds: | 186 | skip_rds: |
187 | if (recv_ctx->sds_rings == NULL) | ||
188 | goto skip_sds; | ||
189 | |||
190 | for(ring = 0; ring < adapter->max_sds_rings; ring++) | ||
191 | recv_ctx->sds_rings[ring].consumer = 0; | ||
192 | |||
193 | skip_sds: | ||
194 | if (adapter->tx_ring == NULL) | 187 | if (adapter->tx_ring == NULL) |
195 | return; | 188 | return; |
196 | 189 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 3cd8cfcf627b..28f270f5ac78 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -94,10 +94,6 @@ static struct pci_device_id netxen_pci_tbl[] __devinitdata = { | |||
94 | 94 | ||
95 | MODULE_DEVICE_TABLE(pci, netxen_pci_tbl); | 95 | MODULE_DEVICE_TABLE(pci, netxen_pci_tbl); |
96 | 96 | ||
97 | static struct workqueue_struct *netxen_workq; | ||
98 | #define SCHEDULE_WORK(tp) queue_work(netxen_workq, tp) | ||
99 | #define FLUSH_SCHEDULED_WORK() flush_workqueue(netxen_workq) | ||
100 | |||
101 | static void netxen_watchdog(unsigned long); | 97 | static void netxen_watchdog(unsigned long); |
102 | 98 | ||
103 | static uint32_t crb_cmd_producer[4] = { | 99 | static uint32_t crb_cmd_producer[4] = { |
@@ -171,6 +167,8 @@ netxen_free_sds_rings(struct netxen_recv_context *recv_ctx) | |||
171 | { | 167 | { |
172 | if (recv_ctx->sds_rings != NULL) | 168 | if (recv_ctx->sds_rings != NULL) |
173 | kfree(recv_ctx->sds_rings); | 169 | kfree(recv_ctx->sds_rings); |
170 | |||
171 | recv_ctx->sds_rings = NULL; | ||
174 | } | 172 | } |
175 | 173 | ||
176 | static int | 174 | static int |
@@ -193,6 +191,21 @@ netxen_napi_add(struct netxen_adapter *adapter, struct net_device *netdev) | |||
193 | } | 191 | } |
194 | 192 | ||
195 | static void | 193 | static void |
194 | netxen_napi_del(struct netxen_adapter *adapter) | ||
195 | { | ||
196 | int ring; | ||
197 | struct nx_host_sds_ring *sds_ring; | ||
198 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; | ||
199 | |||
200 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | ||
201 | sds_ring = &recv_ctx->sds_rings[ring]; | ||
202 | netif_napi_del(&sds_ring->napi); | ||
203 | } | ||
204 | |||
205 | netxen_free_sds_rings(&adapter->recv_ctx); | ||
206 | } | ||
207 | |||
208 | static void | ||
196 | netxen_napi_enable(struct netxen_adapter *adapter) | 209 | netxen_napi_enable(struct netxen_adapter *adapter) |
197 | { | 210 | { |
198 | int ring; | 211 | int ring; |
@@ -260,7 +273,7 @@ nx_update_dma_mask(struct netxen_adapter *adapter) | |||
260 | change = 0; | 273 | change = 0; |
261 | 274 | ||
262 | shift = NXRD32(adapter, CRB_DMA_SHIFT); | 275 | shift = NXRD32(adapter, CRB_DMA_SHIFT); |
263 | if (shift >= 32) | 276 | if (shift > 32) |
264 | return 0; | 277 | return 0; |
265 | 278 | ||
266 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id) && (shift > 9)) | 279 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id) && (shift > 9)) |
@@ -272,7 +285,7 @@ nx_update_dma_mask(struct netxen_adapter *adapter) | |||
272 | old_mask = pdev->dma_mask; | 285 | old_mask = pdev->dma_mask; |
273 | old_cmask = pdev->dev.coherent_dma_mask; | 286 | old_cmask = pdev->dev.coherent_dma_mask; |
274 | 287 | ||
275 | mask = (1ULL<<(32+shift)) - 1; | 288 | mask = DMA_BIT_MASK(32+shift); |
276 | 289 | ||
277 | err = pci_set_dma_mask(pdev, mask); | 290 | err = pci_set_dma_mask(pdev, mask); |
278 | if (err) | 291 | if (err) |
@@ -880,7 +893,6 @@ netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) | |||
880 | spin_unlock(&adapter->tx_clean_lock); | 893 | spin_unlock(&adapter->tx_clean_lock); |
881 | 894 | ||
882 | del_timer_sync(&adapter->watchdog_timer); | 895 | del_timer_sync(&adapter->watchdog_timer); |
883 | FLUSH_SCHEDULED_WORK(); | ||
884 | } | 896 | } |
885 | 897 | ||
886 | 898 | ||
@@ -894,10 +906,12 @@ netxen_nic_attach(struct netxen_adapter *adapter) | |||
894 | struct nx_host_tx_ring *tx_ring; | 906 | struct nx_host_tx_ring *tx_ring; |
895 | 907 | ||
896 | err = netxen_init_firmware(adapter); | 908 | err = netxen_init_firmware(adapter); |
897 | if (err != 0) { | 909 | if (err) |
898 | printk(KERN_ERR "Failed to init firmware\n"); | 910 | return err; |
899 | return -EIO; | 911 | |
900 | } | 912 | err = netxen_napi_add(adapter, netdev); |
913 | if (err) | ||
914 | return err; | ||
901 | 915 | ||
902 | if (adapter->fw_major < 4) | 916 | if (adapter->fw_major < 4) |
903 | adapter->max_rds_rings = 3; | 917 | adapter->max_rds_rings = 3; |
@@ -961,6 +975,7 @@ netxen_nic_detach(struct netxen_adapter *adapter) | |||
961 | netxen_free_hw_resources(adapter); | 975 | netxen_free_hw_resources(adapter); |
962 | netxen_release_rx_buffers(adapter); | 976 | netxen_release_rx_buffers(adapter); |
963 | netxen_nic_free_irq(adapter); | 977 | netxen_nic_free_irq(adapter); |
978 | netxen_napi_del(adapter); | ||
964 | netxen_free_sw_resources(adapter); | 979 | netxen_free_sw_resources(adapter); |
965 | 980 | ||
966 | adapter->is_up = 0; | 981 | adapter->is_up = 0; |
@@ -1105,9 +1120,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1105 | 1120 | ||
1106 | netdev->irq = adapter->msix_entries[0].vector; | 1121 | netdev->irq = adapter->msix_entries[0].vector; |
1107 | 1122 | ||
1108 | if (netxen_napi_add(adapter, netdev)) | ||
1109 | goto err_out_disable_msi; | ||
1110 | |||
1111 | init_timer(&adapter->watchdog_timer); | 1123 | init_timer(&adapter->watchdog_timer); |
1112 | adapter->watchdog_timer.function = &netxen_watchdog; | 1124 | adapter->watchdog_timer.function = &netxen_watchdog; |
1113 | adapter->watchdog_timer.data = (unsigned long)adapter; | 1125 | adapter->watchdog_timer.data = (unsigned long)adapter; |
@@ -1177,6 +1189,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
1177 | 1189 | ||
1178 | unregister_netdev(netdev); | 1190 | unregister_netdev(netdev); |
1179 | 1191 | ||
1192 | cancel_work_sync(&adapter->watchdog_task); | ||
1193 | cancel_work_sync(&adapter->tx_timeout_task); | ||
1194 | |||
1180 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { | 1195 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { |
1181 | netxen_nic_detach(adapter); | 1196 | netxen_nic_detach(adapter); |
1182 | } | 1197 | } |
@@ -1185,7 +1200,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
1185 | netxen_free_adapter_offload(adapter); | 1200 | netxen_free_adapter_offload(adapter); |
1186 | 1201 | ||
1187 | netxen_teardown_intr(adapter); | 1202 | netxen_teardown_intr(adapter); |
1188 | netxen_free_sds_rings(&adapter->recv_ctx); | ||
1189 | 1203 | ||
1190 | netxen_cleanup_pci_map(adapter); | 1204 | netxen_cleanup_pci_map(adapter); |
1191 | 1205 | ||
@@ -1211,6 +1225,9 @@ netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1211 | if (netif_running(netdev)) | 1225 | if (netif_running(netdev)) |
1212 | netxen_nic_down(adapter, netdev); | 1226 | netxen_nic_down(adapter, netdev); |
1213 | 1227 | ||
1228 | cancel_work_sync(&adapter->watchdog_task); | ||
1229 | cancel_work_sync(&adapter->tx_timeout_task); | ||
1230 | |||
1214 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) | 1231 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) |
1215 | netxen_nic_detach(adapter); | 1232 | netxen_nic_detach(adapter); |
1216 | 1233 | ||
@@ -1549,11 +1566,6 @@ static int netxen_nic_check_temp(struct netxen_adapter *adapter) | |||
1549 | "%s: Device temperature %d degrees C exceeds" | 1566 | "%s: Device temperature %d degrees C exceeds" |
1550 | " maximum allowed. Hardware has been shut down.\n", | 1567 | " maximum allowed. Hardware has been shut down.\n", |
1551 | netdev->name, temp_val); | 1568 | netdev->name, temp_val); |
1552 | |||
1553 | netif_device_detach(netdev); | ||
1554 | netxen_nic_down(adapter, netdev); | ||
1555 | netxen_nic_detach(adapter); | ||
1556 | |||
1557 | rv = 1; | 1569 | rv = 1; |
1558 | } else if (temp_state == NX_TEMP_WARN) { | 1570 | } else if (temp_state == NX_TEMP_WARN) { |
1559 | if (adapter->temp == NX_TEMP_NORMAL) { | 1571 | if (adapter->temp == NX_TEMP_NORMAL) { |
@@ -1587,10 +1599,7 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup) | |||
1587 | netif_carrier_off(netdev); | 1599 | netif_carrier_off(netdev); |
1588 | netif_stop_queue(netdev); | 1600 | netif_stop_queue(netdev); |
1589 | } | 1601 | } |
1590 | 1602 | adapter->link_changed = !adapter->has_link_events; | |
1591 | if (!adapter->has_link_events) | ||
1592 | netxen_nic_set_link_parameters(adapter); | ||
1593 | |||
1594 | } else if (!adapter->ahw.linkup && linkup) { | 1603 | } else if (!adapter->ahw.linkup && linkup) { |
1595 | printk(KERN_INFO "%s: %s NIC Link is up\n", | 1604 | printk(KERN_INFO "%s: %s NIC Link is up\n", |
1596 | netxen_nic_driver_name, netdev->name); | 1605 | netxen_nic_driver_name, netdev->name); |
@@ -1599,9 +1608,7 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup) | |||
1599 | netif_carrier_on(netdev); | 1608 | netif_carrier_on(netdev); |
1600 | netif_wake_queue(netdev); | 1609 | netif_wake_queue(netdev); |
1601 | } | 1610 | } |
1602 | 1611 | adapter->link_changed = !adapter->has_link_events; | |
1603 | if (!adapter->has_link_events) | ||
1604 | netxen_nic_set_link_parameters(adapter); | ||
1605 | } | 1612 | } |
1606 | } | 1613 | } |
1607 | 1614 | ||
@@ -1628,11 +1635,36 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | |||
1628 | netxen_advert_link_change(adapter, linkup); | 1635 | netxen_advert_link_change(adapter, linkup); |
1629 | } | 1636 | } |
1630 | 1637 | ||
1638 | static void netxen_nic_thermal_shutdown(struct netxen_adapter *adapter) | ||
1639 | { | ||
1640 | struct net_device *netdev = adapter->netdev; | ||
1641 | |||
1642 | netif_device_detach(netdev); | ||
1643 | netxen_nic_down(adapter, netdev); | ||
1644 | netxen_nic_detach(adapter); | ||
1645 | } | ||
1646 | |||
1631 | static void netxen_watchdog(unsigned long v) | 1647 | static void netxen_watchdog(unsigned long v) |
1632 | { | 1648 | { |
1633 | struct netxen_adapter *adapter = (struct netxen_adapter *)v; | 1649 | struct netxen_adapter *adapter = (struct netxen_adapter *)v; |
1634 | 1650 | ||
1635 | SCHEDULE_WORK(&adapter->watchdog_task); | 1651 | if (netxen_nic_check_temp(adapter)) |
1652 | goto do_sched; | ||
1653 | |||
1654 | if (!adapter->has_link_events) { | ||
1655 | netxen_nic_handle_phy_intr(adapter); | ||
1656 | |||
1657 | if (adapter->link_changed) | ||
1658 | goto do_sched; | ||
1659 | } | ||
1660 | |||
1661 | if (netif_running(adapter->netdev)) | ||
1662 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | ||
1663 | |||
1664 | return; | ||
1665 | |||
1666 | do_sched: | ||
1667 | schedule_work(&adapter->watchdog_task); | ||
1636 | } | 1668 | } |
1637 | 1669 | ||
1638 | void netxen_watchdog_task(struct work_struct *work) | 1670 | void netxen_watchdog_task(struct work_struct *work) |
@@ -1640,11 +1672,13 @@ void netxen_watchdog_task(struct work_struct *work) | |||
1640 | struct netxen_adapter *adapter = | 1672 | struct netxen_adapter *adapter = |
1641 | container_of(work, struct netxen_adapter, watchdog_task); | 1673 | container_of(work, struct netxen_adapter, watchdog_task); |
1642 | 1674 | ||
1643 | if (netxen_nic_check_temp(adapter)) | 1675 | if (adapter->temp == NX_TEMP_PANIC) { |
1676 | netxen_nic_thermal_shutdown(adapter); | ||
1644 | return; | 1677 | return; |
1678 | } | ||
1645 | 1679 | ||
1646 | if (!adapter->has_link_events) | 1680 | if (adapter->link_changed) |
1647 | netxen_nic_handle_phy_intr(adapter); | 1681 | netxen_nic_set_link_parameters(adapter); |
1648 | 1682 | ||
1649 | if (netif_running(adapter->netdev)) | 1683 | if (netif_running(adapter->netdev)) |
1650 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | 1684 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); |
@@ -1652,9 +1686,8 @@ void netxen_watchdog_task(struct work_struct *work) | |||
1652 | 1686 | ||
1653 | static void netxen_tx_timeout(struct net_device *netdev) | 1687 | static void netxen_tx_timeout(struct net_device *netdev) |
1654 | { | 1688 | { |
1655 | struct netxen_adapter *adapter = (struct netxen_adapter *) | 1689 | struct netxen_adapter *adapter = netdev_priv(netdev); |
1656 | netdev_priv(netdev); | 1690 | schedule_work(&adapter->tx_timeout_task); |
1657 | SCHEDULE_WORK(&adapter->tx_timeout_task); | ||
1658 | } | 1691 | } |
1659 | 1692 | ||
1660 | static void netxen_tx_timeout_task(struct work_struct *work) | 1693 | static void netxen_tx_timeout_task(struct work_struct *work) |
@@ -1811,9 +1844,6 @@ static int __init netxen_init_module(void) | |||
1811 | { | 1844 | { |
1812 | printk(KERN_INFO "%s\n", netxen_nic_driver_string); | 1845 | printk(KERN_INFO "%s\n", netxen_nic_driver_string); |
1813 | 1846 | ||
1814 | if ((netxen_workq = create_singlethread_workqueue("netxen")) == NULL) | ||
1815 | return -ENOMEM; | ||
1816 | |||
1817 | return pci_register_driver(&netxen_driver); | 1847 | return pci_register_driver(&netxen_driver); |
1818 | } | 1848 | } |
1819 | 1849 | ||
@@ -1822,7 +1852,6 @@ module_init(netxen_init_module); | |||
1822 | static void __exit netxen_exit_module(void) | 1852 | static void __exit netxen_exit_module(void) |
1823 | { | 1853 | { |
1824 | pci_unregister_driver(&netxen_driver); | 1854 | pci_unregister_driver(&netxen_driver); |
1825 | destroy_workqueue(netxen_workq); | ||
1826 | } | 1855 | } |
1827 | 1856 | ||
1828 | module_exit(netxen_exit_module); | 1857 | module_exit(netxen_exit_module); |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index a646a445fda9..23e1a0750fe0 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -1839,7 +1839,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1839 | lp->chip_version = chip_version; | 1839 | lp->chip_version = chip_version; |
1840 | lp->msg_enable = pcnet32_debug; | 1840 | lp->msg_enable = pcnet32_debug; |
1841 | if ((cards_found >= MAX_UNITS) | 1841 | if ((cards_found >= MAX_UNITS) |
1842 | || (options[cards_found] > sizeof(options_mapping))) | 1842 | || (options[cards_found] >= sizeof(options_mapping))) |
1843 | lp->options = PCNET32_PORT_ASEL; | 1843 | lp->options = PCNET32_PORT_ASEL; |
1844 | else | 1844 | else |
1845 | lp->options = options_mapping[options[cards_found]]; | 1845 | lp->options = options_mapping[options[cards_found]]; |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 1c70e999cc50..7567f510eff5 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -196,21 +196,23 @@ static void PRINT_PKT(u_char *buf, int length) | |||
196 | /* this enables an interrupt in the interrupt mask register */ | 196 | /* this enables an interrupt in the interrupt mask register */ |
197 | #define SMC_ENABLE_INT(lp, x) do { \ | 197 | #define SMC_ENABLE_INT(lp, x) do { \ |
198 | unsigned char mask; \ | 198 | unsigned char mask; \ |
199 | spin_lock_irq(&lp->lock); \ | 199 | unsigned long smc_enable_flags; \ |
200 | spin_lock_irqsave(&lp->lock, smc_enable_flags); \ | ||
200 | mask = SMC_GET_INT_MASK(lp); \ | 201 | mask = SMC_GET_INT_MASK(lp); \ |
201 | mask |= (x); \ | 202 | mask |= (x); \ |
202 | SMC_SET_INT_MASK(lp, mask); \ | 203 | SMC_SET_INT_MASK(lp, mask); \ |
203 | spin_unlock_irq(&lp->lock); \ | 204 | spin_unlock_irqrestore(&lp->lock, smc_enable_flags); \ |
204 | } while (0) | 205 | } while (0) |
205 | 206 | ||
206 | /* this disables an interrupt from the interrupt mask register */ | 207 | /* this disables an interrupt from the interrupt mask register */ |
207 | #define SMC_DISABLE_INT(lp, x) do { \ | 208 | #define SMC_DISABLE_INT(lp, x) do { \ |
208 | unsigned char mask; \ | 209 | unsigned char mask; \ |
209 | spin_lock_irq(&lp->lock); \ | 210 | unsigned long smc_disable_flags; \ |
211 | spin_lock_irqsave(&lp->lock, smc_disable_flags); \ | ||
210 | mask = SMC_GET_INT_MASK(lp); \ | 212 | mask = SMC_GET_INT_MASK(lp); \ |
211 | mask &= ~(x); \ | 213 | mask &= ~(x); \ |
212 | SMC_SET_INT_MASK(lp, mask); \ | 214 | SMC_SET_INT_MASK(lp, mask); \ |
213 | spin_unlock_irq(&lp->lock); \ | 215 | spin_unlock_irqrestore(&lp->lock, smc_disable_flags); \ |
214 | } while (0) | 216 | } while (0) |
215 | 217 | ||
216 | /* | 218 | /* |
@@ -520,21 +522,21 @@ static inline void smc_rcv(struct net_device *dev) | |||
520 | * any other concurrent access and C would always interrupt B. But life | 522 | * any other concurrent access and C would always interrupt B. But life |
521 | * isn't that easy in a SMP world... | 523 | * isn't that easy in a SMP world... |
522 | */ | 524 | */ |
523 | #define smc_special_trylock(lock) \ | 525 | #define smc_special_trylock(lock, flags) \ |
524 | ({ \ | 526 | ({ \ |
525 | int __ret; \ | 527 | int __ret; \ |
526 | local_irq_disable(); \ | 528 | local_irq_save(flags); \ |
527 | __ret = spin_trylock(lock); \ | 529 | __ret = spin_trylock(lock); \ |
528 | if (!__ret) \ | 530 | if (!__ret) \ |
529 | local_irq_enable(); \ | 531 | local_irq_restore(flags); \ |
530 | __ret; \ | 532 | __ret; \ |
531 | }) | 533 | }) |
532 | #define smc_special_lock(lock) spin_lock_irq(lock) | 534 | #define smc_special_lock(lock, flags) spin_lock_irqsave(lock, flags) |
533 | #define smc_special_unlock(lock) spin_unlock_irq(lock) | 535 | #define smc_special_unlock(lock, flags) spin_unlock_irqrestore(lock, flags) |
534 | #else | 536 | #else |
535 | #define smc_special_trylock(lock) (1) | 537 | #define smc_special_trylock(lock, flags) (1) |
536 | #define smc_special_lock(lock) do { } while (0) | 538 | #define smc_special_lock(lock, flags) do { } while (0) |
537 | #define smc_special_unlock(lock) do { } while (0) | 539 | #define smc_special_unlock(lock, flags) do { } while (0) |
538 | #endif | 540 | #endif |
539 | 541 | ||
540 | /* | 542 | /* |
@@ -548,10 +550,11 @@ static void smc_hardware_send_pkt(unsigned long data) | |||
548 | struct sk_buff *skb; | 550 | struct sk_buff *skb; |
549 | unsigned int packet_no, len; | 551 | unsigned int packet_no, len; |
550 | unsigned char *buf; | 552 | unsigned char *buf; |
553 | unsigned long flags; | ||
551 | 554 | ||
552 | DBG(3, "%s: %s\n", dev->name, __func__); | 555 | DBG(3, "%s: %s\n", dev->name, __func__); |
553 | 556 | ||
554 | if (!smc_special_trylock(&lp->lock)) { | 557 | if (!smc_special_trylock(&lp->lock, flags)) { |
555 | netif_stop_queue(dev); | 558 | netif_stop_queue(dev); |
556 | tasklet_schedule(&lp->tx_task); | 559 | tasklet_schedule(&lp->tx_task); |
557 | return; | 560 | return; |
@@ -559,7 +562,7 @@ static void smc_hardware_send_pkt(unsigned long data) | |||
559 | 562 | ||
560 | skb = lp->pending_tx_skb; | 563 | skb = lp->pending_tx_skb; |
561 | if (unlikely(!skb)) { | 564 | if (unlikely(!skb)) { |
562 | smc_special_unlock(&lp->lock); | 565 | smc_special_unlock(&lp->lock, flags); |
563 | return; | 566 | return; |
564 | } | 567 | } |
565 | lp->pending_tx_skb = NULL; | 568 | lp->pending_tx_skb = NULL; |
@@ -569,7 +572,7 @@ static void smc_hardware_send_pkt(unsigned long data) | |||
569 | printk("%s: Memory allocation failed.\n", dev->name); | 572 | printk("%s: Memory allocation failed.\n", dev->name); |
570 | dev->stats.tx_errors++; | 573 | dev->stats.tx_errors++; |
571 | dev->stats.tx_fifo_errors++; | 574 | dev->stats.tx_fifo_errors++; |
572 | smc_special_unlock(&lp->lock); | 575 | smc_special_unlock(&lp->lock, flags); |
573 | goto done; | 576 | goto done; |
574 | } | 577 | } |
575 | 578 | ||
@@ -608,7 +611,7 @@ static void smc_hardware_send_pkt(unsigned long data) | |||
608 | 611 | ||
609 | /* queue the packet for TX */ | 612 | /* queue the packet for TX */ |
610 | SMC_SET_MMU_CMD(lp, MC_ENQUEUE); | 613 | SMC_SET_MMU_CMD(lp, MC_ENQUEUE); |
611 | smc_special_unlock(&lp->lock); | 614 | smc_special_unlock(&lp->lock, flags); |
612 | 615 | ||
613 | dev->trans_start = jiffies; | 616 | dev->trans_start = jiffies; |
614 | dev->stats.tx_packets++; | 617 | dev->stats.tx_packets++; |
@@ -633,6 +636,7 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
633 | struct smc_local *lp = netdev_priv(dev); | 636 | struct smc_local *lp = netdev_priv(dev); |
634 | void __iomem *ioaddr = lp->base; | 637 | void __iomem *ioaddr = lp->base; |
635 | unsigned int numPages, poll_count, status; | 638 | unsigned int numPages, poll_count, status; |
639 | unsigned long flags; | ||
636 | 640 | ||
637 | DBG(3, "%s: %s\n", dev->name, __func__); | 641 | DBG(3, "%s: %s\n", dev->name, __func__); |
638 | 642 | ||
@@ -658,7 +662,7 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
658 | return 0; | 662 | return 0; |
659 | } | 663 | } |
660 | 664 | ||
661 | smc_special_lock(&lp->lock); | 665 | smc_special_lock(&lp->lock, flags); |
662 | 666 | ||
663 | /* now, try to allocate the memory */ | 667 | /* now, try to allocate the memory */ |
664 | SMC_SET_MMU_CMD(lp, MC_ALLOC | numPages); | 668 | SMC_SET_MMU_CMD(lp, MC_ALLOC | numPages); |
@@ -676,7 +680,7 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
676 | } | 680 | } |
677 | } while (--poll_count); | 681 | } while (--poll_count); |
678 | 682 | ||
679 | smc_special_unlock(&lp->lock); | 683 | smc_special_unlock(&lp->lock, flags); |
680 | 684 | ||
681 | lp->pending_tx_skb = skb; | 685 | lp->pending_tx_skb = skb; |
682 | if (!poll_count) { | 686 | if (!poll_count) { |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 99a63649f4fc..4cf9a6588751 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -652,8 +652,9 @@ tulip_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
652 | int entry; | 652 | int entry; |
653 | u32 flag; | 653 | u32 flag; |
654 | dma_addr_t mapping; | 654 | dma_addr_t mapping; |
655 | unsigned long flags; | ||
655 | 656 | ||
656 | spin_lock_irq(&tp->lock); | 657 | spin_lock_irqsave(&tp->lock, flags); |
657 | 658 | ||
658 | /* Calculate the next Tx descriptor entry. */ | 659 | /* Calculate the next Tx descriptor entry. */ |
659 | entry = tp->cur_tx % TX_RING_SIZE; | 660 | entry = tp->cur_tx % TX_RING_SIZE; |
@@ -688,7 +689,7 @@ tulip_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
688 | /* Trigger an immediate transmit demand. */ | 689 | /* Trigger an immediate transmit demand. */ |
689 | iowrite32(0, tp->base_addr + CSR1); | 690 | iowrite32(0, tp->base_addr + CSR1); |
690 | 691 | ||
691 | spin_unlock_irq(&tp->lock); | 692 | spin_unlock_irqrestore(&tp->lock, flags); |
692 | 693 | ||
693 | dev->trans_start = jiffies; | 694 | dev->trans_start = jiffies; |
694 | 695 | ||
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 027f7aba26af..42b6c6319bc2 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1048,20 +1048,15 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
1048 | return err; | 1048 | return err; |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | static int tun_get_iff(struct net *net, struct file *file, struct ifreq *ifr) | 1051 | static int tun_get_iff(struct net *net, struct tun_struct *tun, |
1052 | struct ifreq *ifr) | ||
1052 | { | 1053 | { |
1053 | struct tun_struct *tun = tun_get(file); | ||
1054 | |||
1055 | if (!tun) | ||
1056 | return -EBADFD; | ||
1057 | |||
1058 | DBG(KERN_INFO "%s: tun_get_iff\n", tun->dev->name); | 1054 | DBG(KERN_INFO "%s: tun_get_iff\n", tun->dev->name); |
1059 | 1055 | ||
1060 | strcpy(ifr->ifr_name, tun->dev->name); | 1056 | strcpy(ifr->ifr_name, tun->dev->name); |
1061 | 1057 | ||
1062 | ifr->ifr_flags = tun_flags(tun); | 1058 | ifr->ifr_flags = tun_flags(tun); |
1063 | 1059 | ||
1064 | tun_put(tun); | ||
1065 | return 0; | 1060 | return 0; |
1066 | } | 1061 | } |
1067 | 1062 | ||
@@ -1105,8 +1100,8 @@ static int set_offload(struct net_device *dev, unsigned long arg) | |||
1105 | return 0; | 1100 | return 0; |
1106 | } | 1101 | } |
1107 | 1102 | ||
1108 | static int tun_chr_ioctl(struct inode *inode, struct file *file, | 1103 | static long tun_chr_ioctl(struct file *file, unsigned int cmd, |
1109 | unsigned int cmd, unsigned long arg) | 1104 | unsigned long arg) |
1110 | { | 1105 | { |
1111 | struct tun_file *tfile = file->private_data; | 1106 | struct tun_file *tfile = file->private_data; |
1112 | struct tun_struct *tun; | 1107 | struct tun_struct *tun; |
@@ -1128,34 +1123,32 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1128 | (unsigned int __user*)argp); | 1123 | (unsigned int __user*)argp); |
1129 | } | 1124 | } |
1130 | 1125 | ||
1126 | rtnl_lock(); | ||
1127 | |||
1131 | tun = __tun_get(tfile); | 1128 | tun = __tun_get(tfile); |
1132 | if (cmd == TUNSETIFF && !tun) { | 1129 | if (cmd == TUNSETIFF && !tun) { |
1133 | int err; | ||
1134 | |||
1135 | ifr.ifr_name[IFNAMSIZ-1] = '\0'; | 1130 | ifr.ifr_name[IFNAMSIZ-1] = '\0'; |
1136 | 1131 | ||
1137 | rtnl_lock(); | 1132 | ret = tun_set_iff(tfile->net, file, &ifr); |
1138 | err = tun_set_iff(tfile->net, file, &ifr); | ||
1139 | rtnl_unlock(); | ||
1140 | 1133 | ||
1141 | if (err) | 1134 | if (ret) |
1142 | return err; | 1135 | goto unlock; |
1143 | 1136 | ||
1144 | if (copy_to_user(argp, &ifr, sizeof(ifr))) | 1137 | if (copy_to_user(argp, &ifr, sizeof(ifr))) |
1145 | return -EFAULT; | 1138 | ret = -EFAULT; |
1146 | return 0; | 1139 | goto unlock; |
1147 | } | 1140 | } |
1148 | 1141 | ||
1149 | 1142 | ret = -EBADFD; | |
1150 | if (!tun) | 1143 | if (!tun) |
1151 | return -EBADFD; | 1144 | goto unlock; |
1152 | 1145 | ||
1153 | DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd); | 1146 | DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd); |
1154 | 1147 | ||
1155 | ret = 0; | 1148 | ret = 0; |
1156 | switch (cmd) { | 1149 | switch (cmd) { |
1157 | case TUNGETIFF: | 1150 | case TUNGETIFF: |
1158 | ret = tun_get_iff(current->nsproxy->net_ns, file, &ifr); | 1151 | ret = tun_get_iff(current->nsproxy->net_ns, tun, &ifr); |
1159 | if (ret) | 1152 | if (ret) |
1160 | break; | 1153 | break; |
1161 | 1154 | ||
@@ -1201,7 +1194,6 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1201 | 1194 | ||
1202 | case TUNSETLINK: | 1195 | case TUNSETLINK: |
1203 | /* Only allow setting the type when the interface is down */ | 1196 | /* Only allow setting the type when the interface is down */ |
1204 | rtnl_lock(); | ||
1205 | if (tun->dev->flags & IFF_UP) { | 1197 | if (tun->dev->flags & IFF_UP) { |
1206 | DBG(KERN_INFO "%s: Linktype set failed because interface is up\n", | 1198 | DBG(KERN_INFO "%s: Linktype set failed because interface is up\n", |
1207 | tun->dev->name); | 1199 | tun->dev->name); |
@@ -1211,7 +1203,6 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1211 | DBG(KERN_INFO "%s: linktype set to %d\n", tun->dev->name, tun->dev->type); | 1203 | DBG(KERN_INFO "%s: linktype set to %d\n", tun->dev->name, tun->dev->type); |
1212 | ret = 0; | 1204 | ret = 0; |
1213 | } | 1205 | } |
1214 | rtnl_unlock(); | ||
1215 | break; | 1206 | break; |
1216 | 1207 | ||
1217 | #ifdef TUN_DEBUG | 1208 | #ifdef TUN_DEBUG |
@@ -1220,9 +1211,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1220 | break; | 1211 | break; |
1221 | #endif | 1212 | #endif |
1222 | case TUNSETOFFLOAD: | 1213 | case TUNSETOFFLOAD: |
1223 | rtnl_lock(); | ||
1224 | ret = set_offload(tun->dev, arg); | 1214 | ret = set_offload(tun->dev, arg); |
1225 | rtnl_unlock(); | ||
1226 | break; | 1215 | break; |
1227 | 1216 | ||
1228 | case TUNSETTXFILTER: | 1217 | case TUNSETTXFILTER: |
@@ -1230,9 +1219,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1230 | ret = -EINVAL; | 1219 | ret = -EINVAL; |
1231 | if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) | 1220 | if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) |
1232 | break; | 1221 | break; |
1233 | rtnl_lock(); | ||
1234 | ret = update_filter(&tun->txflt, (void __user *)arg); | 1222 | ret = update_filter(&tun->txflt, (void __user *)arg); |
1235 | rtnl_unlock(); | ||
1236 | break; | 1223 | break; |
1237 | 1224 | ||
1238 | case SIOCGIFHWADDR: | 1225 | case SIOCGIFHWADDR: |
@@ -1248,9 +1235,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1248 | DBG(KERN_DEBUG "%s: set hw address: %pM\n", | 1235 | DBG(KERN_DEBUG "%s: set hw address: %pM\n", |
1249 | tun->dev->name, ifr.ifr_hwaddr.sa_data); | 1236 | tun->dev->name, ifr.ifr_hwaddr.sa_data); |
1250 | 1237 | ||
1251 | rtnl_lock(); | ||
1252 | ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr); | 1238 | ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr); |
1253 | rtnl_unlock(); | ||
1254 | break; | 1239 | break; |
1255 | 1240 | ||
1256 | case TUNGETSNDBUF: | 1241 | case TUNGETSNDBUF: |
@@ -1273,7 +1258,10 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
1273 | break; | 1258 | break; |
1274 | }; | 1259 | }; |
1275 | 1260 | ||
1276 | tun_put(tun); | 1261 | unlock: |
1262 | rtnl_unlock(); | ||
1263 | if (tun) | ||
1264 | tun_put(tun); | ||
1277 | return ret; | 1265 | return ret; |
1278 | } | 1266 | } |
1279 | 1267 | ||
@@ -1361,7 +1349,7 @@ static const struct file_operations tun_fops = { | |||
1361 | .write = do_sync_write, | 1349 | .write = do_sync_write, |
1362 | .aio_write = tun_chr_aio_write, | 1350 | .aio_write = tun_chr_aio_write, |
1363 | .poll = tun_chr_poll, | 1351 | .poll = tun_chr_poll, |
1364 | .ioctl = tun_chr_ioctl, | 1352 | .unlocked_ioctl = tun_chr_ioctl, |
1365 | .open = tun_chr_open, | 1353 | .open = tun_chr_open, |
1366 | .release = tun_chr_close, | 1354 | .release = tun_chr_close, |
1367 | .fasync = tun_chr_fasync | 1355 | .fasync = tun_chr_fasync |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 3b957e6412ee..8a7b8c7bd781 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -3111,10 +3111,11 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3111 | u8 __iomem *bd; /* BD pointer */ | 3111 | u8 __iomem *bd; /* BD pointer */ |
3112 | u32 bd_status; | 3112 | u32 bd_status; |
3113 | u8 txQ = 0; | 3113 | u8 txQ = 0; |
3114 | unsigned long flags; | ||
3114 | 3115 | ||
3115 | ugeth_vdbg("%s: IN", __func__); | 3116 | ugeth_vdbg("%s: IN", __func__); |
3116 | 3117 | ||
3117 | spin_lock_irq(&ugeth->lock); | 3118 | spin_lock_irqsave(&ugeth->lock, flags); |
3118 | 3119 | ||
3119 | dev->stats.tx_bytes += skb->len; | 3120 | dev->stats.tx_bytes += skb->len; |
3120 | 3121 | ||
@@ -3171,7 +3172,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3171 | uccf = ugeth->uccf; | 3172 | uccf = ugeth->uccf; |
3172 | out_be16(uccf->p_utodr, UCC_FAST_TOD); | 3173 | out_be16(uccf->p_utodr, UCC_FAST_TOD); |
3173 | #endif | 3174 | #endif |
3174 | spin_unlock_irq(&ugeth->lock); | 3175 | spin_unlock_irqrestore(&ugeth->lock, flags); |
3175 | 3176 | ||
3176 | return 0; | 3177 | return 0; |
3177 | } | 3178 | } |
diff --git a/drivers/net/usb/pegasus.h b/drivers/net/usb/pegasus.h index c7467823cd1c..f968c834ff63 100644 --- a/drivers/net/usb/pegasus.h +++ b/drivers/net/usb/pegasus.h | |||
@@ -250,6 +250,8 @@ PEGASUS_DEV( "IO DATA USB ET/TX", VENDOR_IODATA, 0x0904, | |||
250 | DEFAULT_GPIO_RESET ) | 250 | DEFAULT_GPIO_RESET ) |
251 | PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913, | 251 | PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913, |
252 | DEFAULT_GPIO_RESET | PEGASUS_II ) | 252 | DEFAULT_GPIO_RESET | PEGASUS_II ) |
253 | PEGASUS_DEV( "IO DATA USB ETX-US2", VENDOR_IODATA, 0x092a, | ||
254 | DEFAULT_GPIO_RESET | PEGASUS_II ) | ||
253 | PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a, | 255 | PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a, |
254 | DEFAULT_GPIO_RESET) | 256 | DEFAULT_GPIO_RESET) |
255 | PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002, | 257 | PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002, |
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 88c30a58b4bd..934f7671650a 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -1218,6 +1218,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
1218 | struct rhine_private *rp = netdev_priv(dev); | 1218 | struct rhine_private *rp = netdev_priv(dev); |
1219 | void __iomem *ioaddr = rp->base; | 1219 | void __iomem *ioaddr = rp->base; |
1220 | unsigned entry; | 1220 | unsigned entry; |
1221 | unsigned long flags; | ||
1221 | 1222 | ||
1222 | /* Caution: the write order is important here, set the field | 1223 | /* Caution: the write order is important here, set the field |
1223 | with the "ownership" bits last. */ | 1224 | with the "ownership" bits last. */ |
@@ -1261,7 +1262,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
1261 | cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); | 1262 | cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); |
1262 | 1263 | ||
1263 | /* lock eth irq */ | 1264 | /* lock eth irq */ |
1264 | spin_lock_irq(&rp->lock); | 1265 | spin_lock_irqsave(&rp->lock, flags); |
1265 | wmb(); | 1266 | wmb(); |
1266 | rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn); | 1267 | rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn); |
1267 | wmb(); | 1268 | wmb(); |
@@ -1280,7 +1281,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
1280 | 1281 | ||
1281 | dev->trans_start = jiffies; | 1282 | dev->trans_start = jiffies; |
1282 | 1283 | ||
1283 | spin_unlock_irq(&rp->lock); | 1284 | spin_unlock_irqrestore(&rp->lock, flags); |
1284 | 1285 | ||
1285 | if (debug > 4) { | 1286 | if (debug > 4) { |
1286 | printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", | 1287 | printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 3ba35956327a..cee08a1e497a 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -1778,7 +1778,7 @@ static void velocity_error(struct velocity_info *vptr, int status) | |||
1778 | * mode | 1778 | * mode |
1779 | */ | 1779 | */ |
1780 | if (vptr->rev_id < REV_ID_VT3216_A0) { | 1780 | if (vptr->rev_id < REV_ID_VT3216_A0) { |
1781 | if (vptr->mii_status | VELOCITY_DUPLEX_FULL) | 1781 | if (vptr->mii_status & VELOCITY_DUPLEX_FULL) |
1782 | BYTE_REG_BITS_ON(TCR_TB2BDIS, ®s->TCR); | 1782 | BYTE_REG_BITS_ON(TCR_TB2BDIS, ®s->TCR); |
1783 | else | 1783 | else |
1784 | BYTE_REG_BITS_OFF(TCR_TB2BDIS, ®s->TCR); | 1784 | BYTE_REG_BITS_OFF(TCR_TB2BDIS, ®s->TCR); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 2a6e81d5b579..bbedf03a2124 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -70,6 +70,9 @@ struct virtnet_info | |||
70 | struct sk_buff_head recv; | 70 | struct sk_buff_head recv; |
71 | struct sk_buff_head send; | 71 | struct sk_buff_head send; |
72 | 72 | ||
73 | /* Work struct for refilling if we run low on memory. */ | ||
74 | struct delayed_work refill; | ||
75 | |||
73 | /* Chain pages by the private ptr. */ | 76 | /* Chain pages by the private ptr. */ |
74 | struct page *pages; | 77 | struct page *pages; |
75 | }; | 78 | }; |
@@ -273,19 +276,22 @@ drop: | |||
273 | dev_kfree_skb(skb); | 276 | dev_kfree_skb(skb); |
274 | } | 277 | } |
275 | 278 | ||
276 | static void try_fill_recv_maxbufs(struct virtnet_info *vi) | 279 | static bool try_fill_recv_maxbufs(struct virtnet_info *vi, gfp_t gfp) |
277 | { | 280 | { |
278 | struct sk_buff *skb; | 281 | struct sk_buff *skb; |
279 | struct scatterlist sg[2+MAX_SKB_FRAGS]; | 282 | struct scatterlist sg[2+MAX_SKB_FRAGS]; |
280 | int num, err, i; | 283 | int num, err, i; |
284 | bool oom = false; | ||
281 | 285 | ||
282 | sg_init_table(sg, 2+MAX_SKB_FRAGS); | 286 | sg_init_table(sg, 2+MAX_SKB_FRAGS); |
283 | for (;;) { | 287 | for (;;) { |
284 | struct virtio_net_hdr *hdr; | 288 | struct virtio_net_hdr *hdr; |
285 | 289 | ||
286 | skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN + NET_IP_ALIGN); | 290 | skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN + NET_IP_ALIGN); |
287 | if (unlikely(!skb)) | 291 | if (unlikely(!skb)) { |
292 | oom = true; | ||
288 | break; | 293 | break; |
294 | } | ||
289 | 295 | ||
290 | skb_reserve(skb, NET_IP_ALIGN); | 296 | skb_reserve(skb, NET_IP_ALIGN); |
291 | skb_put(skb, MAX_PACKET_LEN); | 297 | skb_put(skb, MAX_PACKET_LEN); |
@@ -296,7 +302,7 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi) | |||
296 | if (vi->big_packets) { | 302 | if (vi->big_packets) { |
297 | for (i = 0; i < MAX_SKB_FRAGS; i++) { | 303 | for (i = 0; i < MAX_SKB_FRAGS; i++) { |
298 | skb_frag_t *f = &skb_shinfo(skb)->frags[i]; | 304 | skb_frag_t *f = &skb_shinfo(skb)->frags[i]; |
299 | f->page = get_a_page(vi, GFP_ATOMIC); | 305 | f->page = get_a_page(vi, gfp); |
300 | if (!f->page) | 306 | if (!f->page) |
301 | break; | 307 | break; |
302 | 308 | ||
@@ -325,31 +331,35 @@ static void try_fill_recv_maxbufs(struct virtnet_info *vi) | |||
325 | if (unlikely(vi->num > vi->max)) | 331 | if (unlikely(vi->num > vi->max)) |
326 | vi->max = vi->num; | 332 | vi->max = vi->num; |
327 | vi->rvq->vq_ops->kick(vi->rvq); | 333 | vi->rvq->vq_ops->kick(vi->rvq); |
334 | return !oom; | ||
328 | } | 335 | } |
329 | 336 | ||
330 | static void try_fill_recv(struct virtnet_info *vi) | 337 | /* Returns false if we couldn't fill entirely (OOM). */ |
338 | static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp) | ||
331 | { | 339 | { |
332 | struct sk_buff *skb; | 340 | struct sk_buff *skb; |
333 | struct scatterlist sg[1]; | 341 | struct scatterlist sg[1]; |
334 | int err; | 342 | int err; |
343 | bool oom = false; | ||
335 | 344 | ||
336 | if (!vi->mergeable_rx_bufs) { | 345 | if (!vi->mergeable_rx_bufs) |
337 | try_fill_recv_maxbufs(vi); | 346 | return try_fill_recv_maxbufs(vi, gfp); |
338 | return; | ||
339 | } | ||
340 | 347 | ||
341 | for (;;) { | 348 | for (;;) { |
342 | skb_frag_t *f; | 349 | skb_frag_t *f; |
343 | 350 | ||
344 | skb = netdev_alloc_skb(vi->dev, GOOD_COPY_LEN + NET_IP_ALIGN); | 351 | skb = netdev_alloc_skb(vi->dev, GOOD_COPY_LEN + NET_IP_ALIGN); |
345 | if (unlikely(!skb)) | 352 | if (unlikely(!skb)) { |
353 | oom = true; | ||
346 | break; | 354 | break; |
355 | } | ||
347 | 356 | ||
348 | skb_reserve(skb, NET_IP_ALIGN); | 357 | skb_reserve(skb, NET_IP_ALIGN); |
349 | 358 | ||
350 | f = &skb_shinfo(skb)->frags[0]; | 359 | f = &skb_shinfo(skb)->frags[0]; |
351 | f->page = get_a_page(vi, GFP_ATOMIC); | 360 | f->page = get_a_page(vi, gfp); |
352 | if (!f->page) { | 361 | if (!f->page) { |
362 | oom = true; | ||
353 | kfree_skb(skb); | 363 | kfree_skb(skb); |
354 | break; | 364 | break; |
355 | } | 365 | } |
@@ -373,6 +383,7 @@ static void try_fill_recv(struct virtnet_info *vi) | |||
373 | if (unlikely(vi->num > vi->max)) | 383 | if (unlikely(vi->num > vi->max)) |
374 | vi->max = vi->num; | 384 | vi->max = vi->num; |
375 | vi->rvq->vq_ops->kick(vi->rvq); | 385 | vi->rvq->vq_ops->kick(vi->rvq); |
386 | return !oom; | ||
376 | } | 387 | } |
377 | 388 | ||
378 | static void skb_recv_done(struct virtqueue *rvq) | 389 | static void skb_recv_done(struct virtqueue *rvq) |
@@ -385,6 +396,23 @@ static void skb_recv_done(struct virtqueue *rvq) | |||
385 | } | 396 | } |
386 | } | 397 | } |
387 | 398 | ||
399 | static void refill_work(struct work_struct *work) | ||
400 | { | ||
401 | struct virtnet_info *vi; | ||
402 | bool still_empty; | ||
403 | |||
404 | vi = container_of(work, struct virtnet_info, refill.work); | ||
405 | napi_disable(&vi->napi); | ||
406 | try_fill_recv(vi, GFP_KERNEL); | ||
407 | still_empty = (vi->num == 0); | ||
408 | napi_enable(&vi->napi); | ||
409 | |||
410 | /* In theory, this can happen: if we don't get any buffers in | ||
411 | * we will *never* try to fill again. */ | ||
412 | if (still_empty) | ||
413 | schedule_delayed_work(&vi->refill, HZ/2); | ||
414 | } | ||
415 | |||
388 | static int virtnet_poll(struct napi_struct *napi, int budget) | 416 | static int virtnet_poll(struct napi_struct *napi, int budget) |
389 | { | 417 | { |
390 | struct virtnet_info *vi = container_of(napi, struct virtnet_info, napi); | 418 | struct virtnet_info *vi = container_of(napi, struct virtnet_info, napi); |
@@ -400,10 +428,10 @@ again: | |||
400 | received++; | 428 | received++; |
401 | } | 429 | } |
402 | 430 | ||
403 | /* FIXME: If we oom and completely run out of inbufs, we need | 431 | if (vi->num < vi->max / 2) { |
404 | * to start a timer trying to fill more. */ | 432 | if (!try_fill_recv(vi, GFP_ATOMIC)) |
405 | if (vi->num < vi->max / 2) | 433 | schedule_delayed_work(&vi->refill, 0); |
406 | try_fill_recv(vi); | 434 | } |
407 | 435 | ||
408 | /* Out of packets? */ | 436 | /* Out of packets? */ |
409 | if (received < budget) { | 437 | if (received < budget) { |
@@ -893,6 +921,7 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
893 | vi->vdev = vdev; | 921 | vi->vdev = vdev; |
894 | vdev->priv = vi; | 922 | vdev->priv = vi; |
895 | vi->pages = NULL; | 923 | vi->pages = NULL; |
924 | INIT_DELAYED_WORK(&vi->refill, refill_work); | ||
896 | 925 | ||
897 | /* If they give us a callback when all buffers are done, we don't need | 926 | /* If they give us a callback when all buffers are done, we don't need |
898 | * the timer. */ | 927 | * the timer. */ |
@@ -941,7 +970,7 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
941 | } | 970 | } |
942 | 971 | ||
943 | /* Last of all, set up some receive buffers. */ | 972 | /* Last of all, set up some receive buffers. */ |
944 | try_fill_recv(vi); | 973 | try_fill_recv(vi, GFP_KERNEL); |
945 | 974 | ||
946 | /* If we didn't even get one input buffer, we're useless. */ | 975 | /* If we didn't even get one input buffer, we're useless. */ |
947 | if (vi->num == 0) { | 976 | if (vi->num == 0) { |
@@ -958,6 +987,7 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
958 | 987 | ||
959 | unregister: | 988 | unregister: |
960 | unregister_netdev(dev); | 989 | unregister_netdev(dev); |
990 | cancel_delayed_work_sync(&vi->refill); | ||
961 | free_vqs: | 991 | free_vqs: |
962 | vdev->config->del_vqs(vdev); | 992 | vdev->config->del_vqs(vdev); |
963 | free: | 993 | free: |
@@ -986,6 +1016,7 @@ static void virtnet_remove(struct virtio_device *vdev) | |||
986 | BUG_ON(vi->num != 0); | 1016 | BUG_ON(vi->num != 0); |
987 | 1017 | ||
988 | unregister_netdev(vi->dev); | 1018 | unregister_netdev(vi->dev); |
1019 | cancel_delayed_work_sync(&vi->refill); | ||
989 | 1020 | ||
990 | vdev->config->del_vqs(vi->vdev); | 1021 | vdev->config->del_vqs(vi->vdev); |
991 | 1022 | ||
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c index 9d38cf60a0db..88c3d8573869 100644 --- a/drivers/net/wireless/ath/ar9170/main.c +++ b/drivers/net/wireless/ath/ar9170/main.c | |||
@@ -1967,13 +1967,14 @@ static int ar9170_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
1967 | int ret; | 1967 | int ret; |
1968 | 1968 | ||
1969 | mutex_lock(&ar->mutex); | 1969 | mutex_lock(&ar->mutex); |
1970 | if ((param) && !(queue > __AR9170_NUM_TXQ)) { | 1970 | if (queue < __AR9170_NUM_TXQ) { |
1971 | memcpy(&ar->edcf[ar9170_qos_hwmap[queue]], | 1971 | memcpy(&ar->edcf[ar9170_qos_hwmap[queue]], |
1972 | param, sizeof(*param)); | 1972 | param, sizeof(*param)); |
1973 | 1973 | ||
1974 | ret = ar9170_set_qos(ar); | 1974 | ret = ar9170_set_qos(ar); |
1975 | } else | 1975 | } else { |
1976 | ret = -EINVAL; | 1976 | ret = -EINVAL; |
1977 | } | ||
1977 | 1978 | ||
1978 | mutex_unlock(&ar->mutex); | 1979 | mutex_unlock(&ar->mutex); |
1979 | return ret; | 1980 | return ret; |
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c index 754b1f8d8da9..007eb85fc67e 100644 --- a/drivers/net/wireless/ath/ar9170/usb.c +++ b/drivers/net/wireless/ath/ar9170/usb.c | |||
@@ -598,11 +598,15 @@ static int ar9170_usb_request_firmware(struct ar9170_usb *aru) | |||
598 | 598 | ||
599 | err = request_firmware(&aru->init_values, "ar9170-1.fw", | 599 | err = request_firmware(&aru->init_values, "ar9170-1.fw", |
600 | &aru->udev->dev); | 600 | &aru->udev->dev); |
601 | if (err) { | ||
602 | dev_err(&aru->udev->dev, "file with init values not found.\n"); | ||
603 | return err; | ||
604 | } | ||
601 | 605 | ||
602 | err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev); | 606 | err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev); |
603 | if (err) { | 607 | if (err) { |
604 | release_firmware(aru->init_values); | 608 | release_firmware(aru->init_values); |
605 | dev_err(&aru->udev->dev, "file with init values not found.\n"); | 609 | dev_err(&aru->udev->dev, "firmware file not found.\n"); |
606 | return err; | 610 | return err; |
607 | } | 611 | } |
608 | 612 | ||
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index 44c29b3f6728..f593fbbb4e52 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
@@ -2874,45 +2874,27 @@ static int ipw_fw_dma_add_command_block(struct ipw_priv *priv, | |||
2874 | return 0; | 2874 | return 0; |
2875 | } | 2875 | } |
2876 | 2876 | ||
2877 | static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, | 2877 | static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, dma_addr_t *src_address, |
2878 | u32 src_phys, u32 dest_address, u32 length) | 2878 | int nr, u32 dest_address, u32 len) |
2879 | { | 2879 | { |
2880 | u32 bytes_left = length; | 2880 | int ret, i; |
2881 | u32 src_offset = 0; | 2881 | u32 size; |
2882 | u32 dest_offset = 0; | 2882 | |
2883 | int status = 0; | ||
2884 | IPW_DEBUG_FW(">> \n"); | 2883 | IPW_DEBUG_FW(">> \n"); |
2885 | IPW_DEBUG_FW_INFO("src_phys=0x%x dest_address=0x%x length=0x%x\n", | 2884 | IPW_DEBUG_FW_INFO("nr=%d dest_address=0x%x len=0x%x\n", |
2886 | src_phys, dest_address, length); | 2885 | nr, dest_address, len); |
2887 | while (bytes_left > CB_MAX_LENGTH) { | 2886 | |
2888 | status = ipw_fw_dma_add_command_block(priv, | 2887 | for (i = 0; i < nr; i++) { |
2889 | src_phys + src_offset, | 2888 | size = min_t(u32, len - i * CB_MAX_LENGTH, CB_MAX_LENGTH); |
2890 | dest_address + | 2889 | ret = ipw_fw_dma_add_command_block(priv, src_address[i], |
2891 | dest_offset, | 2890 | dest_address + |
2892 | CB_MAX_LENGTH, 0, 0); | 2891 | i * CB_MAX_LENGTH, size, |
2893 | if (status) { | 2892 | 0, 0); |
2893 | if (ret) { | ||
2894 | IPW_DEBUG_FW_INFO(": Failed\n"); | 2894 | IPW_DEBUG_FW_INFO(": Failed\n"); |
2895 | return -1; | 2895 | return -1; |
2896 | } else | 2896 | } else |
2897 | IPW_DEBUG_FW_INFO(": Added new cb\n"); | 2897 | IPW_DEBUG_FW_INFO(": Added new cb\n"); |
2898 | |||
2899 | src_offset += CB_MAX_LENGTH; | ||
2900 | dest_offset += CB_MAX_LENGTH; | ||
2901 | bytes_left -= CB_MAX_LENGTH; | ||
2902 | } | ||
2903 | |||
2904 | /* add the buffer tail */ | ||
2905 | if (bytes_left > 0) { | ||
2906 | status = | ||
2907 | ipw_fw_dma_add_command_block(priv, src_phys + src_offset, | ||
2908 | dest_address + dest_offset, | ||
2909 | bytes_left, 0, 0); | ||
2910 | if (status) { | ||
2911 | IPW_DEBUG_FW_INFO(": Failed on the buffer tail\n"); | ||
2912 | return -1; | ||
2913 | } else | ||
2914 | IPW_DEBUG_FW_INFO | ||
2915 | (": Adding new cb - the buffer tail\n"); | ||
2916 | } | 2898 | } |
2917 | 2899 | ||
2918 | IPW_DEBUG_FW("<< \n"); | 2900 | IPW_DEBUG_FW("<< \n"); |
@@ -3160,59 +3142,91 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
3160 | 3142 | ||
3161 | static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len) | 3143 | static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len) |
3162 | { | 3144 | { |
3163 | int rc = -1; | 3145 | int ret = -1; |
3164 | int offset = 0; | 3146 | int offset = 0; |
3165 | struct fw_chunk *chunk; | 3147 | struct fw_chunk *chunk; |
3166 | dma_addr_t shared_phys; | 3148 | int total_nr = 0; |
3167 | u8 *shared_virt; | 3149 | int i; |
3150 | struct pci_pool *pool; | ||
3151 | u32 *virts[CB_NUMBER_OF_ELEMENTS_SMALL]; | ||
3152 | dma_addr_t phys[CB_NUMBER_OF_ELEMENTS_SMALL]; | ||
3168 | 3153 | ||
3169 | IPW_DEBUG_TRACE("<< : \n"); | 3154 | IPW_DEBUG_TRACE("<< : \n"); |
3170 | shared_virt = pci_alloc_consistent(priv->pci_dev, len, &shared_phys); | ||
3171 | 3155 | ||
3172 | if (!shared_virt) | 3156 | pool = pci_pool_create("ipw2200", priv->pci_dev, CB_MAX_LENGTH, 0, 0); |
3157 | if (!pool) { | ||
3158 | IPW_ERROR("pci_pool_create failed\n"); | ||
3173 | return -ENOMEM; | 3159 | return -ENOMEM; |
3174 | 3160 | } | |
3175 | memmove(shared_virt, data, len); | ||
3176 | 3161 | ||
3177 | /* Start the Dma */ | 3162 | /* Start the Dma */ |
3178 | rc = ipw_fw_dma_enable(priv); | 3163 | ret = ipw_fw_dma_enable(priv); |
3179 | 3164 | ||
3180 | /* the DMA is already ready this would be a bug. */ | 3165 | /* the DMA is already ready this would be a bug. */ |
3181 | BUG_ON(priv->sram_desc.last_cb_index > 0); | 3166 | BUG_ON(priv->sram_desc.last_cb_index > 0); |
3182 | 3167 | ||
3183 | do { | 3168 | do { |
3169 | u32 chunk_len; | ||
3170 | u8 *start; | ||
3171 | int size; | ||
3172 | int nr = 0; | ||
3173 | |||
3184 | chunk = (struct fw_chunk *)(data + offset); | 3174 | chunk = (struct fw_chunk *)(data + offset); |
3185 | offset += sizeof(struct fw_chunk); | 3175 | offset += sizeof(struct fw_chunk); |
3176 | chunk_len = le32_to_cpu(chunk->length); | ||
3177 | start = data + offset; | ||
3178 | |||
3179 | nr = (chunk_len + CB_MAX_LENGTH - 1) / CB_MAX_LENGTH; | ||
3180 | for (i = 0; i < nr; i++) { | ||
3181 | virts[total_nr] = pci_pool_alloc(pool, GFP_KERNEL, | ||
3182 | &phys[total_nr]); | ||
3183 | if (!virts[total_nr]) { | ||
3184 | ret = -ENOMEM; | ||
3185 | goto out; | ||
3186 | } | ||
3187 | size = min_t(u32, chunk_len - i * CB_MAX_LENGTH, | ||
3188 | CB_MAX_LENGTH); | ||
3189 | memcpy(virts[total_nr], start, size); | ||
3190 | start += size; | ||
3191 | total_nr++; | ||
3192 | /* We don't support fw chunk larger than 64*8K */ | ||
3193 | BUG_ON(total_nr > CB_NUMBER_OF_ELEMENTS_SMALL); | ||
3194 | } | ||
3195 | |||
3186 | /* build DMA packet and queue up for sending */ | 3196 | /* build DMA packet and queue up for sending */ |
3187 | /* dma to chunk->address, the chunk->length bytes from data + | 3197 | /* dma to chunk->address, the chunk->length bytes from data + |
3188 | * offeset*/ | 3198 | * offeset*/ |
3189 | /* Dma loading */ | 3199 | /* Dma loading */ |
3190 | rc = ipw_fw_dma_add_buffer(priv, shared_phys + offset, | 3200 | ret = ipw_fw_dma_add_buffer(priv, &phys[total_nr - nr], |
3191 | le32_to_cpu(chunk->address), | 3201 | nr, le32_to_cpu(chunk->address), |
3192 | le32_to_cpu(chunk->length)); | 3202 | chunk_len); |
3193 | if (rc) { | 3203 | if (ret) { |
3194 | IPW_DEBUG_INFO("dmaAddBuffer Failed\n"); | 3204 | IPW_DEBUG_INFO("dmaAddBuffer Failed\n"); |
3195 | goto out; | 3205 | goto out; |
3196 | } | 3206 | } |
3197 | 3207 | ||
3198 | offset += le32_to_cpu(chunk->length); | 3208 | offset += chunk_len; |
3199 | } while (offset < len); | 3209 | } while (offset < len); |
3200 | 3210 | ||
3201 | /* Run the DMA and wait for the answer */ | 3211 | /* Run the DMA and wait for the answer */ |
3202 | rc = ipw_fw_dma_kick(priv); | 3212 | ret = ipw_fw_dma_kick(priv); |
3203 | if (rc) { | 3213 | if (ret) { |
3204 | IPW_ERROR("dmaKick Failed\n"); | 3214 | IPW_ERROR("dmaKick Failed\n"); |
3205 | goto out; | 3215 | goto out; |
3206 | } | 3216 | } |
3207 | 3217 | ||
3208 | rc = ipw_fw_dma_wait(priv); | 3218 | ret = ipw_fw_dma_wait(priv); |
3209 | if (rc) { | 3219 | if (ret) { |
3210 | IPW_ERROR("dmaWaitSync Failed\n"); | 3220 | IPW_ERROR("dmaWaitSync Failed\n"); |
3211 | goto out; | 3221 | goto out; |
3212 | } | 3222 | } |
3213 | out: | 3223 | out: |
3214 | pci_free_consistent(priv->pci_dev, len, shared_virt, shared_phys); | 3224 | for (i = 0; i < total_nr; i++) |
3215 | return rc; | 3225 | pci_pool_free(pool, virts[i], phys[i]); |
3226 | |||
3227 | pci_pool_destroy(pool); | ||
3228 | |||
3229 | return ret; | ||
3216 | } | 3230 | } |
3217 | 3231 | ||
3218 | /* stop nic */ | 3232 | /* stop nic */ |
@@ -6226,7 +6240,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv, | |||
6226 | }; | 6240 | }; |
6227 | 6241 | ||
6228 | u8 channel; | 6242 | u8 channel; |
6229 | while (channel_index < IPW_SCAN_CHANNELS) { | 6243 | while (channel_index < IPW_SCAN_CHANNELS - 1) { |
6230 | channel = | 6244 | channel = |
6231 | priv->speed_scan[priv->speed_scan_pos]; | 6245 | priv->speed_scan[priv->speed_scan_pos]; |
6232 | if (channel == 0) { | 6246 | if (channel == 0) { |
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index d6997371c27e..b9b374119033 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* Copyright (C) 2006, Red Hat, Inc. */ | 1 | /* Copyright (C) 2006, Red Hat, Inc. */ |
2 | 2 | ||
3 | #include <linux/types.h> | 3 | #include <linux/types.h> |
4 | #include <linux/kernel.h> | ||
5 | #include <linux/etherdevice.h> | 4 | #include <linux/etherdevice.h> |
6 | #include <linux/ieee80211.h> | 5 | #include <linux/ieee80211.h> |
7 | #include <linux/if_arp.h> | 6 | #include <linux/if_arp.h> |
@@ -44,21 +43,21 @@ static int get_common_rates(struct lbs_private *priv, | |||
44 | u16 *rates_size) | 43 | u16 *rates_size) |
45 | { | 44 | { |
46 | u8 *card_rates = lbs_bg_rates; | 45 | u8 *card_rates = lbs_bg_rates; |
46 | size_t num_card_rates = sizeof(lbs_bg_rates); | ||
47 | int ret = 0, i, j; | 47 | int ret = 0, i, j; |
48 | u8 tmp[(ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1)]; | 48 | u8 tmp[30]; |
49 | size_t tmp_size = 0; | 49 | size_t tmp_size = 0; |
50 | 50 | ||
51 | /* For each rate in card_rates that exists in rate1, copy to tmp */ | 51 | /* For each rate in card_rates that exists in rate1, copy to tmp */ |
52 | for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && card_rates[i]; i++) { | 52 | for (i = 0; card_rates[i] && (i < num_card_rates); i++) { |
53 | for (j = 0; j < *rates_size && rates[j]; j++) { | 53 | for (j = 0; rates[j] && (j < *rates_size); j++) { |
54 | if (rates[j] == card_rates[i]) | 54 | if (rates[j] == card_rates[i]) |
55 | tmp[tmp_size++] = card_rates[i]; | 55 | tmp[tmp_size++] = card_rates[i]; |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); | 59 | lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); |
60 | lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, | 60 | lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates); |
61 | ARRAY_SIZE(lbs_bg_rates)); | ||
62 | lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); | 61 | lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); |
63 | lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); | 62 | lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); |
64 | 63 | ||
@@ -70,7 +69,10 @@ static int get_common_rates(struct lbs_private *priv, | |||
70 | lbs_pr_alert("Previously set fixed data rate %#x isn't " | 69 | lbs_pr_alert("Previously set fixed data rate %#x isn't " |
71 | "compatible with the network.\n", priv->cur_rate); | 70 | "compatible with the network.\n", priv->cur_rate); |
72 | ret = -1; | 71 | ret = -1; |
72 | goto done; | ||
73 | } | 73 | } |
74 | ret = 0; | ||
75 | |||
74 | done: | 76 | done: |
75 | memset(rates, 0, *rates_size); | 77 | memset(rates, 0, *rates_size); |
76 | *rates_size = min_t(int, tmp_size, *rates_size); | 78 | *rates_size = min_t(int, tmp_size, *rates_size); |
@@ -320,7 +322,7 @@ static int lbs_associate(struct lbs_private *priv, | |||
320 | rates = (struct mrvl_ie_rates_param_set *) pos; | 322 | rates = (struct mrvl_ie_rates_param_set *) pos; |
321 | rates->header.type = cpu_to_le16(TLV_TYPE_RATES); | 323 | rates->header.type = cpu_to_le16(TLV_TYPE_RATES); |
322 | memcpy(&rates->rates, &bss->rates, MAX_RATES); | 324 | memcpy(&rates->rates, &bss->rates, MAX_RATES); |
323 | tmplen = min_t(u16, ARRAY_SIZE(rates->rates), MAX_RATES); | 325 | tmplen = MAX_RATES; |
324 | if (get_common_rates(priv, rates->rates, &tmplen)) { | 326 | if (get_common_rates(priv, rates->rates, &tmplen)) { |
325 | ret = -1; | 327 | ret = -1; |
326 | goto done; | 328 | goto done; |
@@ -596,7 +598,7 @@ static int lbs_adhoc_join(struct lbs_private *priv, | |||
596 | 598 | ||
597 | /* Copy Data rates from the rates recorded in scan response */ | 599 | /* Copy Data rates from the rates recorded in scan response */ |
598 | memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); | 600 | memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); |
599 | ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), MAX_RATES); | 601 | ratesize = min_t(u16, sizeof(cmd.bss.rates), MAX_RATES); |
600 | memcpy(cmd.bss.rates, bss->rates, ratesize); | 602 | memcpy(cmd.bss.rates, bss->rates, ratesize); |
601 | if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { | 603 | if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { |
602 | lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); | 604 | lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); |
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 0a2e29140add..c8a1998d4744 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h | |||
@@ -56,8 +56,8 @@ struct rxpd { | |||
56 | u8 bss_type; | 56 | u8 bss_type; |
57 | /* BSS number */ | 57 | /* BSS number */ |
58 | u8 bss_num; | 58 | u8 bss_num; |
59 | } bss; | 59 | } __attribute__ ((packed)) bss; |
60 | } u; | 60 | } __attribute__ ((packed)) u; |
61 | 61 | ||
62 | /* SNR */ | 62 | /* SNR */ |
63 | u8 snr; | 63 | u8 snr; |
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index a263d5c84c08..83967afe0821 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -261,7 +261,7 @@ struct mwl8k_vif { | |||
261 | */ | 261 | */ |
262 | }; | 262 | }; |
263 | 263 | ||
264 | #define MWL8K_VIF(_vif) (struct mwl8k_vif *)(&((_vif)->drv_priv)) | 264 | #define MWL8K_VIF(_vif) ((struct mwl8k_vif *)&((_vif)->drv_priv)) |
265 | 265 | ||
266 | static const struct ieee80211_channel mwl8k_channels[] = { | 266 | static const struct ieee80211_channel mwl8k_channels[] = { |
267 | { .center_freq = 2412, .hw_value = 1, }, | 267 | { .center_freq = 2412, .hw_value = 1, }, |
@@ -1012,6 +1012,8 @@ static int rxq_process(struct ieee80211_hw *hw, int index, int limit) | |||
1012 | rmb(); | 1012 | rmb(); |
1013 | 1013 | ||
1014 | skb = rxq->rx_skb[rxq->rx_head]; | 1014 | skb = rxq->rx_skb[rxq->rx_head]; |
1015 | if (skb == NULL) | ||
1016 | break; | ||
1015 | rxq->rx_skb[rxq->rx_head] = NULL; | 1017 | rxq->rx_skb[rxq->rx_head] = NULL; |
1016 | 1018 | ||
1017 | rxq->rx_head = (rxq->rx_head + 1) % MWL8K_RX_DESCS; | 1019 | rxq->rx_head = (rxq->rx_head + 1) % MWL8K_RX_DESCS; |
@@ -1591,6 +1593,9 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) | |||
1591 | timeout = wait_for_completion_timeout(&cmd_wait, | 1593 | timeout = wait_for_completion_timeout(&cmd_wait, |
1592 | msecs_to_jiffies(MWL8K_CMD_TIMEOUT_MS)); | 1594 | msecs_to_jiffies(MWL8K_CMD_TIMEOUT_MS)); |
1593 | 1595 | ||
1596 | pci_unmap_single(priv->pdev, dma_addr, dma_size, | ||
1597 | PCI_DMA_BIDIRECTIONAL); | ||
1598 | |||
1594 | result = &cmd->result; | 1599 | result = &cmd->result; |
1595 | if (!timeout) { | 1600 | if (!timeout) { |
1596 | spin_lock_irq(&priv->fw_lock); | 1601 | spin_lock_irq(&priv->fw_lock); |
@@ -1610,8 +1615,6 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) | |||
1610 | *result); | 1615 | *result); |
1611 | } | 1616 | } |
1612 | 1617 | ||
1613 | pci_unmap_single(priv->pdev, dma_addr, dma_size, | ||
1614 | PCI_DMA_BIDIRECTIONAL); | ||
1615 | return rc; | 1618 | return rc; |
1616 | } | 1619 | } |
1617 | 1620 | ||
@@ -1654,18 +1657,18 @@ static int mwl8k_cmd_get_hw_spec(struct ieee80211_hw *hw) | |||
1654 | memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr)); | 1657 | memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr)); |
1655 | cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); | 1658 | cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); |
1656 | cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rx_desc_dma); | 1659 | cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rx_desc_dma); |
1657 | cmd->num_tx_queues = MWL8K_TX_QUEUES; | 1660 | cmd->num_tx_queues = cpu_to_le32(MWL8K_TX_QUEUES); |
1658 | for (i = 0; i < MWL8K_TX_QUEUES; i++) | 1661 | for (i = 0; i < MWL8K_TX_QUEUES; i++) |
1659 | cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].tx_desc_dma); | 1662 | cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].tx_desc_dma); |
1660 | cmd->num_tx_desc_per_queue = MWL8K_TX_DESCS; | 1663 | cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS); |
1661 | cmd->total_rx_desc = MWL8K_RX_DESCS; | 1664 | cmd->total_rx_desc = cpu_to_le32(MWL8K_RX_DESCS); |
1662 | 1665 | ||
1663 | rc = mwl8k_post_cmd(hw, &cmd->header); | 1666 | rc = mwl8k_post_cmd(hw, &cmd->header); |
1664 | 1667 | ||
1665 | if (!rc) { | 1668 | if (!rc) { |
1666 | SET_IEEE80211_PERM_ADDR(hw, cmd->perm_addr); | 1669 | SET_IEEE80211_PERM_ADDR(hw, cmd->perm_addr); |
1667 | priv->num_mcaddrs = le16_to_cpu(cmd->num_mcaddrs); | 1670 | priv->num_mcaddrs = le16_to_cpu(cmd->num_mcaddrs); |
1668 | priv->fw_rev = cmd->fw_rev; | 1671 | priv->fw_rev = le32_to_cpu(cmd->fw_rev); |
1669 | priv->hw_rev = cmd->hw_rev; | 1672 | priv->hw_rev = cmd->hw_rev; |
1670 | priv->region_code = le16_to_cpu(cmd->region_code); | 1673 | priv->region_code = le16_to_cpu(cmd->region_code); |
1671 | } | 1674 | } |
@@ -3216,15 +3219,19 @@ static int mwl8k_configure_filter_wt(struct work_struct *wt) | |||
3216 | struct dev_addr_list *mclist = worker->mclist; | 3219 | struct dev_addr_list *mclist = worker->mclist; |
3217 | 3220 | ||
3218 | struct mwl8k_priv *priv = hw->priv; | 3221 | struct mwl8k_priv *priv = hw->priv; |
3219 | struct mwl8k_vif *mv_vif; | ||
3220 | int rc = 0; | 3222 | int rc = 0; |
3221 | 3223 | ||
3222 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { | 3224 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { |
3223 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) | 3225 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) |
3224 | rc = mwl8k_cmd_set_pre_scan(hw); | 3226 | rc = mwl8k_cmd_set_pre_scan(hw); |
3225 | else { | 3227 | else { |
3226 | mv_vif = MWL8K_VIF(priv->vif); | 3228 | u8 *bssid; |
3227 | rc = mwl8k_cmd_set_post_scan(hw, mv_vif->bssid); | 3229 | |
3230 | bssid = "\x00\x00\x00\x00\x00\x00"; | ||
3231 | if (priv->vif != NULL) | ||
3232 | bssid = MWL8K_VIF(priv->vif)->bssid; | ||
3233 | |||
3234 | rc = mwl8k_cmd_set_post_scan(hw, bssid); | ||
3228 | } | 3235 | } |
3229 | } | 3236 | } |
3230 | 3237 | ||
@@ -3726,6 +3733,8 @@ static void __devexit mwl8k_remove(struct pci_dev *pdev) | |||
3726 | 3733 | ||
3727 | ieee80211_stop_queues(hw); | 3734 | ieee80211_stop_queues(hw); |
3728 | 3735 | ||
3736 | ieee80211_unregister_hw(hw); | ||
3737 | |||
3729 | /* Remove tx reclaim tasklet */ | 3738 | /* Remove tx reclaim tasklet */ |
3730 | tasklet_kill(&priv->tx_reclaim_task); | 3739 | tasklet_kill(&priv->tx_reclaim_task); |
3731 | 3740 | ||
@@ -3739,8 +3748,6 @@ static void __devexit mwl8k_remove(struct pci_dev *pdev) | |||
3739 | for (i = 0; i < MWL8K_TX_QUEUES; i++) | 3748 | for (i = 0; i < MWL8K_TX_QUEUES; i++) |
3740 | mwl8k_txq_reclaim(hw, i, 1); | 3749 | mwl8k_txq_reclaim(hw, i, 1); |
3741 | 3750 | ||
3742 | ieee80211_unregister_hw(hw); | ||
3743 | |||
3744 | for (i = 0; i < MWL8K_TX_QUEUES; i++) | 3751 | for (i = 0; i < MWL8K_TX_QUEUES; i++) |
3745 | mwl8k_txq_deinit(hw, i); | 3752 | mwl8k_txq_deinit(hw, i); |
3746 | 3753 | ||
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c index 632fac86a308..b3946272c72e 100644 --- a/drivers/net/wireless/orinoco/hw.c +++ b/drivers/net/wireless/orinoco/hw.c | |||
@@ -70,7 +70,7 @@ int orinoco_hw_get_tkip_iv(struct orinoco_private *priv, int key, u8 *tsc) | |||
70 | int err = 0; | 70 | int err = 0; |
71 | u8 tsc_arr[4][IW_ENCODE_SEQ_MAX_SIZE]; | 71 | u8 tsc_arr[4][IW_ENCODE_SEQ_MAX_SIZE]; |
72 | 72 | ||
73 | if ((key < 0) || (key > 4)) | 73 | if ((key < 0) || (key >= 4)) |
74 | return -EINVAL; | 74 | return -EINVAL; |
75 | 75 | ||
76 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV, | 76 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index a498dde024e1..49c9e2c1433d 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -849,13 +849,15 @@ struct rt2x00_dev { | |||
849 | static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev, | 849 | static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev, |
850 | const unsigned int word, u32 *data) | 850 | const unsigned int word, u32 *data) |
851 | { | 851 | { |
852 | *data = rt2x00dev->rf[word]; | 852 | BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32)); |
853 | *data = rt2x00dev->rf[word - 1]; | ||
853 | } | 854 | } |
854 | 855 | ||
855 | static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev, | 856 | static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev, |
856 | const unsigned int word, u32 data) | 857 | const unsigned int word, u32 data) |
857 | { | 858 | { |
858 | rt2x00dev->rf[word] = data; | 859 | BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32)); |
860 | rt2x00dev->rf[word - 1] = data; | ||
859 | } | 861 | } |
860 | 862 | ||
861 | /* | 863 | /* |
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c index 294250e294dd..87a95588a8e3 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c | |||
@@ -869,6 +869,9 @@ static int rtl8187b_init_hw(struct ieee80211_hw *dev) | |||
869 | priv->aifsn[3] = 3; /* AIFSN[AC_BE] */ | 869 | priv->aifsn[3] = 3; /* AIFSN[AC_BE] */ |
870 | rtl818x_iowrite8(priv, &priv->map->ACM_CONTROL, 0); | 870 | rtl818x_iowrite8(priv, &priv->map->ACM_CONTROL, 0); |
871 | 871 | ||
872 | /* ENEDCA flag must always be set, transmit issues? */ | ||
873 | rtl818x_iowrite8(priv, &priv->map->MSR, RTL818X_MSR_ENEDCA); | ||
874 | |||
872 | return 0; | 875 | return 0; |
873 | } | 876 | } |
874 | 877 | ||
@@ -1173,13 +1176,16 @@ static void rtl8187_bss_info_changed(struct ieee80211_hw *dev, | |||
1173 | rtl818x_iowrite8(priv, &priv->map->BSSID[i], | 1176 | rtl818x_iowrite8(priv, &priv->map->BSSID[i], |
1174 | info->bssid[i]); | 1177 | info->bssid[i]); |
1175 | 1178 | ||
1179 | if (priv->is_rtl8187b) | ||
1180 | reg = RTL818X_MSR_ENEDCA; | ||
1181 | else | ||
1182 | reg = 0; | ||
1183 | |||
1176 | if (is_valid_ether_addr(info->bssid)) { | 1184 | if (is_valid_ether_addr(info->bssid)) { |
1177 | reg = RTL818X_MSR_INFRA; | 1185 | reg |= RTL818X_MSR_INFRA; |
1178 | if (priv->is_rtl8187b) | ||
1179 | reg |= RTL818X_MSR_ENEDCA; | ||
1180 | rtl818x_iowrite8(priv, &priv->map->MSR, reg); | 1186 | rtl818x_iowrite8(priv, &priv->map->MSR, reg); |
1181 | } else { | 1187 | } else { |
1182 | reg = RTL818X_MSR_NO_LINK; | 1188 | reg |= RTL818X_MSR_NO_LINK; |
1183 | rtl818x_iowrite8(priv, &priv->map->MSR, reg); | 1189 | rtl818x_iowrite8(priv, &priv->map->MSR, reg); |
1184 | } | 1190 | } |
1185 | 1191 | ||
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index a07580138e81..c2fd6187773f 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -346,7 +346,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | |||
346 | static int yellowfin_open(struct net_device *dev); | 346 | static int yellowfin_open(struct net_device *dev); |
347 | static void yellowfin_timer(unsigned long data); | 347 | static void yellowfin_timer(unsigned long data); |
348 | static void yellowfin_tx_timeout(struct net_device *dev); | 348 | static void yellowfin_tx_timeout(struct net_device *dev); |
349 | static void yellowfin_init_ring(struct net_device *dev); | 349 | static int yellowfin_init_ring(struct net_device *dev); |
350 | static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev); | 350 | static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev); |
351 | static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance); | 351 | static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance); |
352 | static int yellowfin_rx(struct net_device *dev); | 352 | static int yellowfin_rx(struct net_device *dev); |
@@ -573,19 +573,24 @@ static int yellowfin_open(struct net_device *dev) | |||
573 | { | 573 | { |
574 | struct yellowfin_private *yp = netdev_priv(dev); | 574 | struct yellowfin_private *yp = netdev_priv(dev); |
575 | void __iomem *ioaddr = yp->base; | 575 | void __iomem *ioaddr = yp->base; |
576 | int i; | 576 | int i, ret; |
577 | 577 | ||
578 | /* Reset the chip. */ | 578 | /* Reset the chip. */ |
579 | iowrite32(0x80000000, ioaddr + DMACtrl); | 579 | iowrite32(0x80000000, ioaddr + DMACtrl); |
580 | 580 | ||
581 | i = request_irq(dev->irq, &yellowfin_interrupt, IRQF_SHARED, dev->name, dev); | 581 | ret = request_irq(dev->irq, &yellowfin_interrupt, IRQF_SHARED, dev->name, dev); |
582 | if (i) return i; | 582 | if (ret) |
583 | return ret; | ||
583 | 584 | ||
584 | if (yellowfin_debug > 1) | 585 | if (yellowfin_debug > 1) |
585 | printk(KERN_DEBUG "%s: yellowfin_open() irq %d.\n", | 586 | printk(KERN_DEBUG "%s: yellowfin_open() irq %d.\n", |
586 | dev->name, dev->irq); | 587 | dev->name, dev->irq); |
587 | 588 | ||
588 | yellowfin_init_ring(dev); | 589 | ret = yellowfin_init_ring(dev); |
590 | if (ret) { | ||
591 | free_irq(dev->irq, dev); | ||
592 | return ret; | ||
593 | } | ||
589 | 594 | ||
590 | iowrite32(yp->rx_ring_dma, ioaddr + RxPtr); | 595 | iowrite32(yp->rx_ring_dma, ioaddr + RxPtr); |
591 | iowrite32(yp->tx_ring_dma, ioaddr + TxPtr); | 596 | iowrite32(yp->tx_ring_dma, ioaddr + TxPtr); |
@@ -725,10 +730,10 @@ static void yellowfin_tx_timeout(struct net_device *dev) | |||
725 | } | 730 | } |
726 | 731 | ||
727 | /* Initialize the Rx and Tx rings, along with various 'dev' bits. */ | 732 | /* Initialize the Rx and Tx rings, along with various 'dev' bits. */ |
728 | static void yellowfin_init_ring(struct net_device *dev) | 733 | static int yellowfin_init_ring(struct net_device *dev) |
729 | { | 734 | { |
730 | struct yellowfin_private *yp = netdev_priv(dev); | 735 | struct yellowfin_private *yp = netdev_priv(dev); |
731 | int i; | 736 | int i, j; |
732 | 737 | ||
733 | yp->tx_full = 0; | 738 | yp->tx_full = 0; |
734 | yp->cur_rx = yp->cur_tx = 0; | 739 | yp->cur_rx = yp->cur_tx = 0; |
@@ -753,6 +758,11 @@ static void yellowfin_init_ring(struct net_device *dev) | |||
753 | yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev, | 758 | yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev, |
754 | skb->data, yp->rx_buf_sz, PCI_DMA_FROMDEVICE)); | 759 | skb->data, yp->rx_buf_sz, PCI_DMA_FROMDEVICE)); |
755 | } | 760 | } |
761 | if (i != RX_RING_SIZE) { | ||
762 | for (j = 0; j < i; j++) | ||
763 | dev_kfree_skb(yp->rx_skbuff[j]); | ||
764 | return -ENOMEM; | ||
765 | } | ||
756 | yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP); | 766 | yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP); |
757 | yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); | 767 | yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); |
758 | 768 | ||
@@ -769,8 +779,6 @@ static void yellowfin_init_ring(struct net_device *dev) | |||
769 | yp->tx_ring[--i].dbdma_cmd = cpu_to_le32(CMD_STOP | BRANCH_ALWAYS); | 779 | yp->tx_ring[--i].dbdma_cmd = cpu_to_le32(CMD_STOP | BRANCH_ALWAYS); |
770 | #else | 780 | #else |
771 | { | 781 | { |
772 | int j; | ||
773 | |||
774 | /* Tx ring needs a pair of descriptors, the second for the status. */ | 782 | /* Tx ring needs a pair of descriptors, the second for the status. */ |
775 | for (i = 0; i < TX_RING_SIZE; i++) { | 783 | for (i = 0; i < TX_RING_SIZE; i++) { |
776 | j = 2*i; | 784 | j = 2*i; |
@@ -805,7 +813,7 @@ static void yellowfin_init_ring(struct net_device *dev) | |||
805 | } | 813 | } |
806 | #endif | 814 | #endif |
807 | yp->tx_tail_desc = &yp->tx_status[0]; | 815 | yp->tx_tail_desc = &yp->tx_status[0]; |
808 | return; | 816 | return 0; |
809 | } | 817 | } |
810 | 818 | ||
811 | static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev) | 819 | static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev) |
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c index 37c84e3b8be0..81c753a617ab 100644 --- a/drivers/net/zorro8390.c +++ b/drivers/net/zorro8390.c | |||
@@ -120,6 +120,9 @@ static int __devinit zorro8390_init_one(struct zorro_dev *z, | |||
120 | for (i = ARRAY_SIZE(cards)-1; i >= 0; i--) | 120 | for (i = ARRAY_SIZE(cards)-1; i >= 0; i--) |
121 | if (z->id == cards[i].id) | 121 | if (z->id == cards[i].id) |
122 | break; | 122 | break; |
123 | if (i < 0) | ||
124 | return -ENODEV; | ||
125 | |||
123 | board = z->resource.start; | 126 | board = z->resource.start; |
124 | ioaddr = board+cards[i].offset; | 127 | ioaddr = board+cards[i].offset; |
125 | dev = alloc_ei_netdev(); | 128 | dev = alloc_ei_netdev(); |
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index e3a87210e947..e03fe98f0619 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c | |||
@@ -598,6 +598,29 @@ int pci_iov_resource_bar(struct pci_dev *dev, int resno, | |||
598 | } | 598 | } |
599 | 599 | ||
600 | /** | 600 | /** |
601 | * pci_sriov_resource_alignment - get resource alignment for VF BAR | ||
602 | * @dev: the PCI device | ||
603 | * @resno: the resource number | ||
604 | * | ||
605 | * Returns the alignment of the VF BAR found in the SR-IOV capability. | ||
606 | * This is not the same as the resource size which is defined as | ||
607 | * the VF BAR size multiplied by the number of VFs. The alignment | ||
608 | * is just the VF BAR size. | ||
609 | */ | ||
610 | int pci_sriov_resource_alignment(struct pci_dev *dev, int resno) | ||
611 | { | ||
612 | struct resource tmp; | ||
613 | enum pci_bar_type type; | ||
614 | int reg = pci_iov_resource_bar(dev, resno, &type); | ||
615 | |||
616 | if (!reg) | ||
617 | return 0; | ||
618 | |||
619 | __pci_read_base(dev, type, &tmp, reg); | ||
620 | return resource_alignment(&tmp); | ||
621 | } | ||
622 | |||
623 | /** | ||
601 | * pci_restore_iov_state - restore the state of the IOV capability | 624 | * pci_restore_iov_state - restore the state of the IOV capability |
602 | * @dev: the PCI device | 625 | * @dev: the PCI device |
603 | */ | 626 | */ |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index d76c4c85367e..f99bc7f089f1 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -508,7 +508,7 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev) | |||
508 | return error; | 508 | return error; |
509 | } | 509 | } |
510 | 510 | ||
511 | return pci_dev->state_saved ? pci_restore_state(pci_dev) : 0; | 511 | return pci_restore_state(pci_dev); |
512 | } | 512 | } |
513 | 513 | ||
514 | static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev) | 514 | static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index dbd0f947f497..7b70312181d7 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -846,6 +846,8 @@ pci_restore_state(struct pci_dev *dev) | |||
846 | int i; | 846 | int i; |
847 | u32 val; | 847 | u32 val; |
848 | 848 | ||
849 | if (!dev->state_saved) | ||
850 | return 0; | ||
849 | /* PCI Express register must be restored first */ | 851 | /* PCI Express register must be restored first */ |
850 | pci_restore_pcie_state(dev); | 852 | pci_restore_pcie_state(dev); |
851 | 853 | ||
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index f73bcbedf37c..5ff4d25bf0e9 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -243,6 +243,7 @@ extern int pci_iov_init(struct pci_dev *dev); | |||
243 | extern void pci_iov_release(struct pci_dev *dev); | 243 | extern void pci_iov_release(struct pci_dev *dev); |
244 | extern int pci_iov_resource_bar(struct pci_dev *dev, int resno, | 244 | extern int pci_iov_resource_bar(struct pci_dev *dev, int resno, |
245 | enum pci_bar_type *type); | 245 | enum pci_bar_type *type); |
246 | extern int pci_sriov_resource_alignment(struct pci_dev *dev, int resno); | ||
246 | extern void pci_restore_iov_state(struct pci_dev *dev); | 247 | extern void pci_restore_iov_state(struct pci_dev *dev); |
247 | extern int pci_iov_bus_range(struct pci_bus *bus); | 248 | extern int pci_iov_bus_range(struct pci_bus *bus); |
248 | 249 | ||
@@ -298,4 +299,16 @@ static inline int pci_ats_enabled(struct pci_dev *dev) | |||
298 | } | 299 | } |
299 | #endif /* CONFIG_PCI_IOV */ | 300 | #endif /* CONFIG_PCI_IOV */ |
300 | 301 | ||
302 | static inline int pci_resource_alignment(struct pci_dev *dev, | ||
303 | struct resource *res) | ||
304 | { | ||
305 | #ifdef CONFIG_PCI_IOV | ||
306 | int resno = res - dev->resource; | ||
307 | |||
308 | if (resno >= PCI_IOV_RESOURCES && resno <= PCI_IOV_RESOURCE_END) | ||
309 | return pci_sriov_resource_alignment(dev, resno); | ||
310 | #endif | ||
311 | return resource_alignment(res); | ||
312 | } | ||
313 | |||
301 | #endif /* DRIVERS_PCI_H */ | 314 | #endif /* DRIVERS_PCI_H */ |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index b636e245445d..7c443b4583ab 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/ioport.h> | 25 | #include <linux/ioport.h> |
26 | #include <linux/cache.h> | 26 | #include <linux/cache.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | 28 | #include "pci.h" | |
29 | 29 | ||
30 | static void pbus_assign_resources_sorted(const struct pci_bus *bus) | 30 | static void pbus_assign_resources_sorted(const struct pci_bus *bus) |
31 | { | 31 | { |
@@ -384,7 +384,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long | |||
384 | continue; | 384 | continue; |
385 | r_size = resource_size(r); | 385 | r_size = resource_size(r); |
386 | /* For bridges size != alignment */ | 386 | /* For bridges size != alignment */ |
387 | align = resource_alignment(r); | 387 | align = pci_resource_alignment(dev, r); |
388 | order = __ffs(align) - 20; | 388 | order = __ffs(align) - 20; |
389 | if (order > 11) { | 389 | if (order > 11) { |
390 | dev_warn(&dev->dev, "BAR %d bad alignment %llx: " | 390 | dev_warn(&dev->dev, "BAR %d bad alignment %llx: " |
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 1898c7b47907..88cdd1a937d6 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
@@ -144,7 +144,7 @@ static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev, | |||
144 | 144 | ||
145 | size = resource_size(res); | 145 | size = resource_size(res); |
146 | min = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM; | 146 | min = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM; |
147 | align = resource_alignment(res); | 147 | align = pci_resource_alignment(dev, res); |
148 | 148 | ||
149 | /* First, try exact prefetching match.. */ | 149 | /* First, try exact prefetching match.. */ |
150 | ret = pci_bus_alloc_resource(bus, res, size, align, min, | 150 | ret = pci_bus_alloc_resource(bus, res, size, align, min, |
@@ -178,7 +178,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
178 | struct pci_bus *bus; | 178 | struct pci_bus *bus; |
179 | int ret; | 179 | int ret; |
180 | 180 | ||
181 | align = resource_alignment(res); | 181 | align = pci_resource_alignment(dev, res); |
182 | if (!align) { | 182 | if (!align) { |
183 | dev_info(&dev->dev, "BAR %d: can't allocate resource (bogus " | 183 | dev_info(&dev->dev, "BAR %d: can't allocate resource (bogus " |
184 | "alignment) %pR flags %#lx\n", | 184 | "alignment) %pR flags %#lx\n", |
@@ -259,7 +259,7 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) | |||
259 | if (!(r->flags) || r->parent) | 259 | if (!(r->flags) || r->parent) |
260 | continue; | 260 | continue; |
261 | 261 | ||
262 | r_align = resource_alignment(r); | 262 | r_align = pci_resource_alignment(dev, r); |
263 | if (!r_align) { | 263 | if (!r_align) { |
264 | dev_warn(&dev->dev, "BAR %d: bogus alignment " | 264 | dev_warn(&dev->dev, "BAR %d: bogus alignment " |
265 | "%pR flags %#lx\n", | 265 | "%pR flags %#lx\n", |
@@ -271,7 +271,7 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) | |||
271 | struct resource_list *ln = list->next; | 271 | struct resource_list *ln = list->next; |
272 | 272 | ||
273 | if (ln) | 273 | if (ln) |
274 | align = resource_alignment(ln->res); | 274 | align = pci_resource_alignment(ln->dev, ln->res); |
275 | 275 | ||
276 | if (r_align > align) { | 276 | if (r_align > align) { |
277 | tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); | 277 | tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); |
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 81d31ea507d1..51c0a8bee414 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -335,6 +335,7 @@ static void bt_rfkill_poll(struct rfkill *rfkill, void *data) | |||
335 | if (hci_result != HCI_SUCCESS) { | 335 | if (hci_result != HCI_SUCCESS) { |
336 | /* Can't do anything useful */ | 336 | /* Can't do anything useful */ |
337 | mutex_unlock(&dev->mutex); | 337 | mutex_unlock(&dev->mutex); |
338 | return; | ||
338 | } | 339 | } |
339 | 340 | ||
340 | new_rfk_state = value; | 341 | new_rfk_state = value; |
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 043b208d971d..f215a5919192 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
@@ -270,7 +270,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out) | |||
270 | acpi_status status; | 270 | acpi_status status; |
271 | struct acpi_object_list input; | 271 | struct acpi_object_list input; |
272 | union acpi_object params[3]; | 272 | union acpi_object params[3]; |
273 | char method[4] = "WM"; | 273 | char method[5] = "WM"; |
274 | 274 | ||
275 | if (!find_guid(guid_string, &wblock)) | 275 | if (!find_guid(guid_string, &wblock)) |
276 | return AE_ERROR; | 276 | return AE_ERROR; |
@@ -328,8 +328,8 @@ struct acpi_buffer *out) | |||
328 | acpi_status status, wc_status = AE_ERROR; | 328 | acpi_status status, wc_status = AE_ERROR; |
329 | struct acpi_object_list input, wc_input; | 329 | struct acpi_object_list input, wc_input; |
330 | union acpi_object wc_params[1], wq_params[1]; | 330 | union acpi_object wc_params[1], wq_params[1]; |
331 | char method[4]; | 331 | char method[5]; |
332 | char wc_method[4] = "WC"; | 332 | char wc_method[5] = "WC"; |
333 | 333 | ||
334 | if (!guid_string || !out) | 334 | if (!guid_string || !out) |
335 | return AE_BAD_PARAMETER; | 335 | return AE_BAD_PARAMETER; |
@@ -410,7 +410,7 @@ const struct acpi_buffer *in) | |||
410 | acpi_handle handle; | 410 | acpi_handle handle; |
411 | struct acpi_object_list input; | 411 | struct acpi_object_list input; |
412 | union acpi_object params[2]; | 412 | union acpi_object params[2]; |
413 | char method[4] = "WS"; | 413 | char method[5] = "WS"; |
414 | 414 | ||
415 | if (!guid_string || !in) | 415 | if (!guid_string || !in) |
416 | return AE_BAD_DATA; | 416 | return AE_BAD_DATA; |
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c index ac8cc8cea1e3..fea17e7805e9 100644 --- a/drivers/pps/pps.c +++ b/drivers/pps/pps.c | |||
@@ -244,7 +244,7 @@ int pps_register_cdev(struct pps_device *pps) | |||
244 | } | 244 | } |
245 | pps->dev = device_create(pps_class, pps->info.dev, pps->devno, NULL, | 245 | pps->dev = device_create(pps_class, pps->info.dev, pps->devno, NULL, |
246 | "pps%d", pps->id); | 246 | "pps%d", pps->id); |
247 | if (err) | 247 | if (IS_ERR(pps->dev)) |
248 | goto del_cdev; | 248 | goto del_cdev; |
249 | dev_set_drvdata(pps->dev, pps); | 249 | dev_set_drvdata(pps->dev, pps); |
250 | 250 | ||
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 749836668655..3f62dd50bbbe 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -2135,9 +2135,9 @@ static int dasd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
2135 | struct dasd_device *base; | 2135 | struct dasd_device *base; |
2136 | 2136 | ||
2137 | block = bdev->bd_disk->private_data; | 2137 | block = bdev->bd_disk->private_data; |
2138 | base = block->base; | ||
2139 | if (!block) | 2138 | if (!block) |
2140 | return -ENODEV; | 2139 | return -ENODEV; |
2140 | base = block->base; | ||
2141 | 2141 | ||
2142 | if (!base->discipline || | 2142 | if (!base->discipline || |
2143 | !base->discipline->fill_geometry) | 2143 | !base->discipline->fill_geometry) |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 3c57c1a18bb8..d593bc76afe3 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -772,10 +772,8 @@ static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch) | |||
772 | cdev = io_subchannel_allocate_dev(sch); | 772 | cdev = io_subchannel_allocate_dev(sch); |
773 | if (!IS_ERR(cdev)) { | 773 | if (!IS_ERR(cdev)) { |
774 | ret = io_subchannel_initialize_dev(sch, cdev); | 774 | ret = io_subchannel_initialize_dev(sch, cdev); |
775 | if (ret) { | 775 | if (ret) |
776 | kfree(cdev); | ||
777 | cdev = ERR_PTR(ret); | 776 | cdev = ERR_PTR(ret); |
778 | } | ||
779 | } | 777 | } |
780 | return cdev; | 778 | return cdev; |
781 | } | 779 | } |
diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c index 15dab96d05e3..7c815d3327f7 100644 --- a/drivers/sbus/char/bbc_envctrl.c +++ b/drivers/sbus/char/bbc_envctrl.c | |||
@@ -537,8 +537,12 @@ int bbc_envctrl_init(struct bbc_i2c_bus *bp) | |||
537 | } | 537 | } |
538 | if (temp_index != 0 && fan_index != 0) { | 538 | if (temp_index != 0 && fan_index != 0) { |
539 | kenvctrld_task = kthread_run(kenvctrld, NULL, "kenvctrld"); | 539 | kenvctrld_task = kthread_run(kenvctrld, NULL, "kenvctrld"); |
540 | if (IS_ERR(kenvctrld_task)) | 540 | if (IS_ERR(kenvctrld_task)) { |
541 | return PTR_ERR(kenvctrld_task); | 541 | int err = PTR_ERR(kenvctrld_task); |
542 | |||
543 | kenvctrld_task = NULL; | ||
544 | return err; | ||
545 | } | ||
542 | } | 546 | } |
543 | 547 | ||
544 | return 0; | 548 | return 0; |
@@ -561,7 +565,8 @@ void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp) | |||
561 | struct bbc_cpu_temperature *tp, *tpos; | 565 | struct bbc_cpu_temperature *tp, *tpos; |
562 | struct bbc_fan_control *fp, *fpos; | 566 | struct bbc_fan_control *fp, *fpos; |
563 | 567 | ||
564 | kthread_stop(kenvctrld_task); | 568 | if (kenvctrld_task) |
569 | kthread_stop(kenvctrld_task); | ||
565 | 570 | ||
566 | list_for_each_entry_safe(tp, tpos, &bp->temps, bp_list) { | 571 | list_for_each_entry_safe(tp, tpos, &bp->temps, bp_list) { |
567 | list_del(&tp->bp_list); | 572 | list_del(&tp->bp_list); |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index f3da592f7bcc..35a13867495e 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c | |||
@@ -119,6 +119,64 @@ _base_fault_reset_work(struct work_struct *work) | |||
119 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); | 119 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); |
120 | } | 120 | } |
121 | 121 | ||
122 | /** | ||
123 | * mpt2sas_base_start_watchdog - start the fault_reset_work_q | ||
124 | * @ioc: pointer to scsi command object | ||
125 | * Context: sleep. | ||
126 | * | ||
127 | * Return nothing. | ||
128 | */ | ||
129 | void | ||
130 | mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc) | ||
131 | { | ||
132 | unsigned long flags; | ||
133 | |||
134 | if (ioc->fault_reset_work_q) | ||
135 | return; | ||
136 | |||
137 | /* initialize fault polling */ | ||
138 | INIT_DELAYED_WORK(&ioc->fault_reset_work, _base_fault_reset_work); | ||
139 | snprintf(ioc->fault_reset_work_q_name, | ||
140 | sizeof(ioc->fault_reset_work_q_name), "poll_%d_status", ioc->id); | ||
141 | ioc->fault_reset_work_q = | ||
142 | create_singlethread_workqueue(ioc->fault_reset_work_q_name); | ||
143 | if (!ioc->fault_reset_work_q) { | ||
144 | printk(MPT2SAS_ERR_FMT "%s: failed (line=%d)\n", | ||
145 | ioc->name, __func__, __LINE__); | ||
146 | return; | ||
147 | } | ||
148 | spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); | ||
149 | if (ioc->fault_reset_work_q) | ||
150 | queue_delayed_work(ioc->fault_reset_work_q, | ||
151 | &ioc->fault_reset_work, | ||
152 | msecs_to_jiffies(FAULT_POLLING_INTERVAL)); | ||
153 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); | ||
154 | } | ||
155 | |||
156 | /** | ||
157 | * mpt2sas_base_stop_watchdog - stop the fault_reset_work_q | ||
158 | * @ioc: pointer to scsi command object | ||
159 | * Context: sleep. | ||
160 | * | ||
161 | * Return nothing. | ||
162 | */ | ||
163 | void | ||
164 | mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc) | ||
165 | { | ||
166 | unsigned long flags; | ||
167 | struct workqueue_struct *wq; | ||
168 | |||
169 | spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); | ||
170 | wq = ioc->fault_reset_work_q; | ||
171 | ioc->fault_reset_work_q = NULL; | ||
172 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); | ||
173 | if (wq) { | ||
174 | if (!cancel_delayed_work(&ioc->fault_reset_work)) | ||
175 | flush_workqueue(wq); | ||
176 | destroy_workqueue(wq); | ||
177 | } | ||
178 | } | ||
179 | |||
122 | #ifdef CONFIG_SCSI_MPT2SAS_LOGGING | 180 | #ifdef CONFIG_SCSI_MPT2SAS_LOGGING |
123 | /** | 181 | /** |
124 | * _base_sas_ioc_info - verbose translation of the ioc status | 182 | * _base_sas_ioc_info - verbose translation of the ioc status |
@@ -440,6 +498,10 @@ _base_sas_log_info(struct MPT2SAS_ADAPTER *ioc , u32 log_info) | |||
440 | if (sas_loginfo.dw.bus_type != 3 /*SAS*/) | 498 | if (sas_loginfo.dw.bus_type != 3 /*SAS*/) |
441 | return; | 499 | return; |
442 | 500 | ||
501 | /* each nexus loss loginfo */ | ||
502 | if (log_info == 0x31170000) | ||
503 | return; | ||
504 | |||
443 | /* eat the loginfos associated with task aborts */ | 505 | /* eat the loginfos associated with task aborts */ |
444 | if (ioc->ignore_loginfos && (log_info == 30050000 || log_info == | 506 | if (ioc->ignore_loginfos && (log_info == 30050000 || log_info == |
445 | 0x31140000 || log_info == 0x31130000)) | 507 | 0x31140000 || log_info == 0x31130000)) |
@@ -1109,7 +1171,6 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc) | |||
1109 | } | 1171 | } |
1110 | } | 1172 | } |
1111 | 1173 | ||
1112 | pci_set_drvdata(pdev, ioc->shost); | ||
1113 | _base_mask_interrupts(ioc); | 1174 | _base_mask_interrupts(ioc); |
1114 | r = _base_enable_msix(ioc); | 1175 | r = _base_enable_msix(ioc); |
1115 | if (r) | 1176 | if (r) |
@@ -1132,7 +1193,6 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc) | |||
1132 | ioc->pci_irq = -1; | 1193 | ioc->pci_irq = -1; |
1133 | pci_release_selected_regions(ioc->pdev, ioc->bars); | 1194 | pci_release_selected_regions(ioc->pdev, ioc->bars); |
1134 | pci_disable_device(pdev); | 1195 | pci_disable_device(pdev); |
1135 | pci_set_drvdata(pdev, NULL); | ||
1136 | return r; | 1196 | return r; |
1137 | } | 1197 | } |
1138 | 1198 | ||
@@ -3191,7 +3251,6 @@ mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER *ioc) | |||
3191 | ioc->chip_phys = 0; | 3251 | ioc->chip_phys = 0; |
3192 | pci_release_selected_regions(ioc->pdev, ioc->bars); | 3252 | pci_release_selected_regions(ioc->pdev, ioc->bars); |
3193 | pci_disable_device(pdev); | 3253 | pci_disable_device(pdev); |
3194 | pci_set_drvdata(pdev, NULL); | ||
3195 | return; | 3254 | return; |
3196 | } | 3255 | } |
3197 | 3256 | ||
@@ -3205,7 +3264,6 @@ int | |||
3205 | mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | 3264 | mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) |
3206 | { | 3265 | { |
3207 | int r, i; | 3266 | int r, i; |
3208 | unsigned long flags; | ||
3209 | 3267 | ||
3210 | dinitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name, | 3268 | dinitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name, |
3211 | __func__)); | 3269 | __func__)); |
@@ -3214,6 +3272,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
3214 | if (r) | 3272 | if (r) |
3215 | return r; | 3273 | return r; |
3216 | 3274 | ||
3275 | pci_set_drvdata(ioc->pdev, ioc->shost); | ||
3217 | r = _base_make_ioc_ready(ioc, CAN_SLEEP, SOFT_RESET); | 3276 | r = _base_make_ioc_ready(ioc, CAN_SLEEP, SOFT_RESET); |
3218 | if (r) | 3277 | if (r) |
3219 | goto out_free_resources; | 3278 | goto out_free_resources; |
@@ -3288,23 +3347,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
3288 | if (r) | 3347 | if (r) |
3289 | goto out_free_resources; | 3348 | goto out_free_resources; |
3290 | 3349 | ||
3291 | /* initialize fault polling */ | 3350 | mpt2sas_base_start_watchdog(ioc); |
3292 | INIT_DELAYED_WORK(&ioc->fault_reset_work, _base_fault_reset_work); | ||
3293 | snprintf(ioc->fault_reset_work_q_name, | ||
3294 | sizeof(ioc->fault_reset_work_q_name), "poll_%d_status", ioc->id); | ||
3295 | ioc->fault_reset_work_q = | ||
3296 | create_singlethread_workqueue(ioc->fault_reset_work_q_name); | ||
3297 | if (!ioc->fault_reset_work_q) { | ||
3298 | printk(MPT2SAS_ERR_FMT "%s: failed (line=%d)\n", | ||
3299 | ioc->name, __func__, __LINE__); | ||
3300 | goto out_free_resources; | ||
3301 | } | ||
3302 | spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); | ||
3303 | if (ioc->fault_reset_work_q) | ||
3304 | queue_delayed_work(ioc->fault_reset_work_q, | ||
3305 | &ioc->fault_reset_work, | ||
3306 | msecs_to_jiffies(FAULT_POLLING_INTERVAL)); | ||
3307 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); | ||
3308 | return 0; | 3351 | return 0; |
3309 | 3352 | ||
3310 | out_free_resources: | 3353 | out_free_resources: |
@@ -3312,6 +3355,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
3312 | ioc->remove_host = 1; | 3355 | ioc->remove_host = 1; |
3313 | mpt2sas_base_free_resources(ioc); | 3356 | mpt2sas_base_free_resources(ioc); |
3314 | _base_release_memory_pools(ioc); | 3357 | _base_release_memory_pools(ioc); |
3358 | pci_set_drvdata(ioc->pdev, NULL); | ||
3315 | kfree(ioc->tm_cmds.reply); | 3359 | kfree(ioc->tm_cmds.reply); |
3316 | kfree(ioc->transport_cmds.reply); | 3360 | kfree(ioc->transport_cmds.reply); |
3317 | kfree(ioc->config_cmds.reply); | 3361 | kfree(ioc->config_cmds.reply); |
@@ -3337,22 +3381,14 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
3337 | void | 3381 | void |
3338 | mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc) | 3382 | mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc) |
3339 | { | 3383 | { |
3340 | unsigned long flags; | ||
3341 | struct workqueue_struct *wq; | ||
3342 | 3384 | ||
3343 | dexitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name, | 3385 | dexitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name, |
3344 | __func__)); | 3386 | __func__)); |
3345 | 3387 | ||
3346 | spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); | 3388 | mpt2sas_base_stop_watchdog(ioc); |
3347 | wq = ioc->fault_reset_work_q; | ||
3348 | ioc->fault_reset_work_q = NULL; | ||
3349 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); | ||
3350 | if (!cancel_delayed_work(&ioc->fault_reset_work)) | ||
3351 | flush_workqueue(wq); | ||
3352 | destroy_workqueue(wq); | ||
3353 | |||
3354 | mpt2sas_base_free_resources(ioc); | 3389 | mpt2sas_base_free_resources(ioc); |
3355 | _base_release_memory_pools(ioc); | 3390 | _base_release_memory_pools(ioc); |
3391 | pci_set_drvdata(ioc->pdev, NULL); | ||
3356 | kfree(ioc->pfacts); | 3392 | kfree(ioc->pfacts); |
3357 | kfree(ioc->ctl_cmds.reply); | 3393 | kfree(ioc->ctl_cmds.reply); |
3358 | kfree(ioc->base_cmds.reply); | 3394 | kfree(ioc->base_cmds.reply); |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 286c185fa9e4..acdcff150a35 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h | |||
@@ -69,10 +69,10 @@ | |||
69 | #define MPT2SAS_DRIVER_NAME "mpt2sas" | 69 | #define MPT2SAS_DRIVER_NAME "mpt2sas" |
70 | #define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>" | 70 | #define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>" |
71 | #define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver" | 71 | #define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver" |
72 | #define MPT2SAS_DRIVER_VERSION "01.100.03.00" | 72 | #define MPT2SAS_DRIVER_VERSION "01.100.04.00" |
73 | #define MPT2SAS_MAJOR_VERSION 01 | 73 | #define MPT2SAS_MAJOR_VERSION 01 |
74 | #define MPT2SAS_MINOR_VERSION 100 | 74 | #define MPT2SAS_MINOR_VERSION 100 |
75 | #define MPT2SAS_BUILD_VERSION 03 | 75 | #define MPT2SAS_BUILD_VERSION 04 |
76 | #define MPT2SAS_RELEASE_VERSION 00 | 76 | #define MPT2SAS_RELEASE_VERSION 00 |
77 | 77 | ||
78 | /* | 78 | /* |
@@ -673,6 +673,8 @@ typedef void (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, | |||
673 | 673 | ||
674 | /* base shared API */ | 674 | /* base shared API */ |
675 | extern struct list_head mpt2sas_ioc_list; | 675 | extern struct list_head mpt2sas_ioc_list; |
676 | void mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc); | ||
677 | void mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc); | ||
676 | 678 | ||
677 | int mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc); | 679 | int mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc); |
678 | void mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc); | 680 | void mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc); |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_config.c b/drivers/scsi/mpt2sas/mpt2sas_config.c index 58cfb97846f7..6ddee161beb3 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_config.c +++ b/drivers/scsi/mpt2sas/mpt2sas_config.c | |||
@@ -236,17 +236,25 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t | |||
236 | Mpi2ConfigRequest_t *config_request; | 236 | Mpi2ConfigRequest_t *config_request; |
237 | int r; | 237 | int r; |
238 | u8 retry_count; | 238 | u8 retry_count; |
239 | u8 issue_reset; | 239 | u8 issue_host_reset = 0; |
240 | u16 wait_state_count; | 240 | u16 wait_state_count; |
241 | 241 | ||
242 | mutex_lock(&ioc->config_cmds.mutex); | ||
242 | if (ioc->config_cmds.status != MPT2_CMD_NOT_USED) { | 243 | if (ioc->config_cmds.status != MPT2_CMD_NOT_USED) { |
243 | printk(MPT2SAS_ERR_FMT "%s: config_cmd in use\n", | 244 | printk(MPT2SAS_ERR_FMT "%s: config_cmd in use\n", |
244 | ioc->name, __func__); | 245 | ioc->name, __func__); |
246 | mutex_unlock(&ioc->config_cmds.mutex); | ||
245 | return -EAGAIN; | 247 | return -EAGAIN; |
246 | } | 248 | } |
247 | retry_count = 0; | 249 | retry_count = 0; |
248 | 250 | ||
249 | retry_config: | 251 | retry_config: |
252 | if (retry_count) { | ||
253 | if (retry_count > 2) /* attempt only 2 retries */ | ||
254 | return -EFAULT; | ||
255 | printk(MPT2SAS_INFO_FMT "%s: attempting retry (%d)\n", | ||
256 | ioc->name, __func__, retry_count); | ||
257 | } | ||
250 | wait_state_count = 0; | 258 | wait_state_count = 0; |
251 | ioc_state = mpt2sas_base_get_iocstate(ioc, 1); | 259 | ioc_state = mpt2sas_base_get_iocstate(ioc, 1); |
252 | while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { | 260 | while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { |
@@ -254,8 +262,8 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t | |||
254 | printk(MPT2SAS_ERR_FMT | 262 | printk(MPT2SAS_ERR_FMT |
255 | "%s: failed due to ioc not operational\n", | 263 | "%s: failed due to ioc not operational\n", |
256 | ioc->name, __func__); | 264 | ioc->name, __func__); |
257 | ioc->config_cmds.status = MPT2_CMD_NOT_USED; | 265 | r = -EFAULT; |
258 | return -EFAULT; | 266 | goto out; |
259 | } | 267 | } |
260 | ssleep(1); | 268 | ssleep(1); |
261 | ioc_state = mpt2sas_base_get_iocstate(ioc, 1); | 269 | ioc_state = mpt2sas_base_get_iocstate(ioc, 1); |
@@ -271,8 +279,8 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t | |||
271 | if (!smid) { | 279 | if (!smid) { |
272 | printk(MPT2SAS_ERR_FMT "%s: failed obtaining a smid\n", | 280 | printk(MPT2SAS_ERR_FMT "%s: failed obtaining a smid\n", |
273 | ioc->name, __func__); | 281 | ioc->name, __func__); |
274 | ioc->config_cmds.status = MPT2_CMD_NOT_USED; | 282 | r = -EAGAIN; |
275 | return -EAGAIN; | 283 | goto out; |
276 | } | 284 | } |
277 | 285 | ||
278 | r = 0; | 286 | r = 0; |
@@ -292,9 +300,15 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t | |||
292 | ioc->name, __func__); | 300 | ioc->name, __func__); |
293 | _debug_dump_mf(mpi_request, | 301 | _debug_dump_mf(mpi_request, |
294 | sizeof(Mpi2ConfigRequest_t)/4); | 302 | sizeof(Mpi2ConfigRequest_t)/4); |
295 | if (!(ioc->config_cmds.status & MPT2_CMD_RESET)) | 303 | retry_count++; |
296 | issue_reset = 1; | 304 | if (ioc->config_cmds.smid == smid) |
297 | goto issue_host_reset; | 305 | mpt2sas_base_free_smid(ioc, smid); |
306 | if ((ioc->shost_recovery) || | ||
307 | (ioc->config_cmds.status & MPT2_CMD_RESET)) | ||
308 | goto retry_config; | ||
309 | issue_host_reset = 1; | ||
310 | r = -EFAULT; | ||
311 | goto out; | ||
298 | } | 312 | } |
299 | if (ioc->config_cmds.status & MPT2_CMD_REPLY_VALID) | 313 | if (ioc->config_cmds.status & MPT2_CMD_REPLY_VALID) |
300 | memcpy(mpi_reply, ioc->config_cmds.reply, | 314 | memcpy(mpi_reply, ioc->config_cmds.reply, |
@@ -302,21 +316,13 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t | |||
302 | if (retry_count) | 316 | if (retry_count) |
303 | printk(MPT2SAS_INFO_FMT "%s: retry completed!!\n", | 317 | printk(MPT2SAS_INFO_FMT "%s: retry completed!!\n", |
304 | ioc->name, __func__); | 318 | ioc->name, __func__); |
319 | out: | ||
305 | ioc->config_cmds.status = MPT2_CMD_NOT_USED; | 320 | ioc->config_cmds.status = MPT2_CMD_NOT_USED; |
306 | return r; | 321 | mutex_unlock(&ioc->config_cmds.mutex); |
307 | 322 | if (issue_host_reset) | |
308 | issue_host_reset: | ||
309 | if (issue_reset) | ||
310 | mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP, | 323 | mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP, |
311 | FORCE_BIG_HAMMER); | 324 | FORCE_BIG_HAMMER); |
312 | ioc->config_cmds.status = MPT2_CMD_NOT_USED; | 325 | return r; |
313 | if (!retry_count) { | ||
314 | printk(MPT2SAS_INFO_FMT "%s: attempting retry\n", | ||
315 | ioc->name, __func__); | ||
316 | retry_count++; | ||
317 | goto retry_config; | ||
318 | } | ||
319 | return -EFAULT; | ||
320 | } | 326 | } |
321 | 327 | ||
322 | /** | 328 | /** |
@@ -375,7 +381,6 @@ mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc, | |||
375 | int r; | 381 | int r; |
376 | struct config_request mem; | 382 | struct config_request mem; |
377 | 383 | ||
378 | mutex_lock(&ioc->config_cmds.mutex); | ||
379 | memset(config_page, 0, sizeof(Mpi2ManufacturingPage0_t)); | 384 | memset(config_page, 0, sizeof(Mpi2ManufacturingPage0_t)); |
380 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 385 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
381 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 386 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -417,7 +422,6 @@ mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc, | |||
417 | _config_free_config_dma_memory(ioc, &mem); | 422 | _config_free_config_dma_memory(ioc, &mem); |
418 | 423 | ||
419 | out: | 424 | out: |
420 | mutex_unlock(&ioc->config_cmds.mutex); | ||
421 | return r; | 425 | return r; |
422 | } | 426 | } |
423 | 427 | ||
@@ -438,7 +442,6 @@ mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc, | |||
438 | int r; | 442 | int r; |
439 | struct config_request mem; | 443 | struct config_request mem; |
440 | 444 | ||
441 | mutex_lock(&ioc->config_cmds.mutex); | ||
442 | memset(config_page, 0, sizeof(Mpi2BiosPage2_t)); | 445 | memset(config_page, 0, sizeof(Mpi2BiosPage2_t)); |
443 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 446 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
444 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 447 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -480,7 +483,6 @@ mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc, | |||
480 | _config_free_config_dma_memory(ioc, &mem); | 483 | _config_free_config_dma_memory(ioc, &mem); |
481 | 484 | ||
482 | out: | 485 | out: |
483 | mutex_unlock(&ioc->config_cmds.mutex); | ||
484 | return r; | 486 | return r; |
485 | } | 487 | } |
486 | 488 | ||
@@ -501,7 +503,6 @@ mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
501 | int r; | 503 | int r; |
502 | struct config_request mem; | 504 | struct config_request mem; |
503 | 505 | ||
504 | mutex_lock(&ioc->config_cmds.mutex); | ||
505 | memset(config_page, 0, sizeof(Mpi2BiosPage3_t)); | 506 | memset(config_page, 0, sizeof(Mpi2BiosPage3_t)); |
506 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 507 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
507 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 508 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -543,7 +544,6 @@ mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
543 | _config_free_config_dma_memory(ioc, &mem); | 544 | _config_free_config_dma_memory(ioc, &mem); |
544 | 545 | ||
545 | out: | 546 | out: |
546 | mutex_unlock(&ioc->config_cmds.mutex); | ||
547 | return r; | 547 | return r; |
548 | } | 548 | } |
549 | 549 | ||
@@ -564,7 +564,6 @@ mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, | |||
564 | int r; | 564 | int r; |
565 | struct config_request mem; | 565 | struct config_request mem; |
566 | 566 | ||
567 | mutex_lock(&ioc->config_cmds.mutex); | ||
568 | memset(config_page, 0, sizeof(Mpi2IOUnitPage0_t)); | 567 | memset(config_page, 0, sizeof(Mpi2IOUnitPage0_t)); |
569 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 568 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
570 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 569 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -606,7 +605,6 @@ mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, | |||
606 | _config_free_config_dma_memory(ioc, &mem); | 605 | _config_free_config_dma_memory(ioc, &mem); |
607 | 606 | ||
608 | out: | 607 | out: |
609 | mutex_unlock(&ioc->config_cmds.mutex); | ||
610 | return r; | 608 | return r; |
611 | } | 609 | } |
612 | 610 | ||
@@ -627,7 +625,6 @@ mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, | |||
627 | int r; | 625 | int r; |
628 | struct config_request mem; | 626 | struct config_request mem; |
629 | 627 | ||
630 | mutex_lock(&ioc->config_cmds.mutex); | ||
631 | memset(config_page, 0, sizeof(Mpi2IOUnitPage1_t)); | 628 | memset(config_page, 0, sizeof(Mpi2IOUnitPage1_t)); |
632 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 629 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
633 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 630 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -669,7 +666,6 @@ mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, | |||
669 | _config_free_config_dma_memory(ioc, &mem); | 666 | _config_free_config_dma_memory(ioc, &mem); |
670 | 667 | ||
671 | out: | 668 | out: |
672 | mutex_unlock(&ioc->config_cmds.mutex); | ||
673 | return r; | 669 | return r; |
674 | } | 670 | } |
675 | 671 | ||
@@ -690,7 +686,6 @@ mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, | |||
690 | int r; | 686 | int r; |
691 | struct config_request mem; | 687 | struct config_request mem; |
692 | 688 | ||
693 | mutex_lock(&ioc->config_cmds.mutex); | ||
694 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 689 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
695 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 690 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
696 | mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER; | 691 | mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER; |
@@ -732,7 +727,6 @@ mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, | |||
732 | _config_free_config_dma_memory(ioc, &mem); | 727 | _config_free_config_dma_memory(ioc, &mem); |
733 | 728 | ||
734 | out: | 729 | out: |
735 | mutex_unlock(&ioc->config_cmds.mutex); | ||
736 | return r; | 730 | return r; |
737 | } | 731 | } |
738 | 732 | ||
@@ -753,7 +747,6 @@ mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc, | |||
753 | int r; | 747 | int r; |
754 | struct config_request mem; | 748 | struct config_request mem; |
755 | 749 | ||
756 | mutex_lock(&ioc->config_cmds.mutex); | ||
757 | memset(config_page, 0, sizeof(Mpi2IOCPage8_t)); | 750 | memset(config_page, 0, sizeof(Mpi2IOCPage8_t)); |
758 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 751 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
759 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 752 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -795,7 +788,6 @@ mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc, | |||
795 | _config_free_config_dma_memory(ioc, &mem); | 788 | _config_free_config_dma_memory(ioc, &mem); |
796 | 789 | ||
797 | out: | 790 | out: |
798 | mutex_unlock(&ioc->config_cmds.mutex); | ||
799 | return r; | 791 | return r; |
800 | } | 792 | } |
801 | 793 | ||
@@ -818,7 +810,6 @@ mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
818 | int r; | 810 | int r; |
819 | struct config_request mem; | 811 | struct config_request mem; |
820 | 812 | ||
821 | mutex_lock(&ioc->config_cmds.mutex); | ||
822 | memset(config_page, 0, sizeof(Mpi2SasDevicePage0_t)); | 813 | memset(config_page, 0, sizeof(Mpi2SasDevicePage0_t)); |
823 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 814 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
824 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 815 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -863,7 +854,6 @@ mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
863 | _config_free_config_dma_memory(ioc, &mem); | 854 | _config_free_config_dma_memory(ioc, &mem); |
864 | 855 | ||
865 | out: | 856 | out: |
866 | mutex_unlock(&ioc->config_cmds.mutex); | ||
867 | return r; | 857 | return r; |
868 | } | 858 | } |
869 | 859 | ||
@@ -886,7 +876,6 @@ mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
886 | int r; | 876 | int r; |
887 | struct config_request mem; | 877 | struct config_request mem; |
888 | 878 | ||
889 | mutex_lock(&ioc->config_cmds.mutex); | ||
890 | memset(config_page, 0, sizeof(Mpi2SasDevicePage1_t)); | 879 | memset(config_page, 0, sizeof(Mpi2SasDevicePage1_t)); |
891 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 880 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
892 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 881 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -931,7 +920,6 @@ mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
931 | _config_free_config_dma_memory(ioc, &mem); | 920 | _config_free_config_dma_memory(ioc, &mem); |
932 | 921 | ||
933 | out: | 922 | out: |
934 | mutex_unlock(&ioc->config_cmds.mutex); | ||
935 | return r; | 923 | return r; |
936 | } | 924 | } |
937 | 925 | ||
@@ -953,7 +941,6 @@ mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys) | |||
953 | Mpi2ConfigReply_t mpi_reply; | 941 | Mpi2ConfigReply_t mpi_reply; |
954 | Mpi2SasIOUnitPage0_t config_page; | 942 | Mpi2SasIOUnitPage0_t config_page; |
955 | 943 | ||
956 | mutex_lock(&ioc->config_cmds.mutex); | ||
957 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 944 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
958 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 945 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
959 | mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER; | 946 | mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER; |
@@ -1002,7 +989,6 @@ mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys) | |||
1002 | _config_free_config_dma_memory(ioc, &mem); | 989 | _config_free_config_dma_memory(ioc, &mem); |
1003 | 990 | ||
1004 | out: | 991 | out: |
1005 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1006 | return r; | 992 | return r; |
1007 | } | 993 | } |
1008 | 994 | ||
@@ -1026,8 +1012,6 @@ mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1026 | Mpi2ConfigRequest_t mpi_request; | 1012 | Mpi2ConfigRequest_t mpi_request; |
1027 | int r; | 1013 | int r; |
1028 | struct config_request mem; | 1014 | struct config_request mem; |
1029 | |||
1030 | mutex_lock(&ioc->config_cmds.mutex); | ||
1031 | memset(config_page, 0, sz); | 1015 | memset(config_page, 0, sz); |
1032 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 1016 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
1033 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 1017 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -1070,7 +1054,6 @@ mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1070 | _config_free_config_dma_memory(ioc, &mem); | 1054 | _config_free_config_dma_memory(ioc, &mem); |
1071 | 1055 | ||
1072 | out: | 1056 | out: |
1073 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1074 | return r; | 1057 | return r; |
1075 | } | 1058 | } |
1076 | 1059 | ||
@@ -1095,7 +1078,6 @@ mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1095 | int r; | 1078 | int r; |
1096 | struct config_request mem; | 1079 | struct config_request mem; |
1097 | 1080 | ||
1098 | mutex_lock(&ioc->config_cmds.mutex); | ||
1099 | memset(config_page, 0, sz); | 1081 | memset(config_page, 0, sz); |
1100 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 1082 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
1101 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 1083 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -1138,7 +1120,6 @@ mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1138 | _config_free_config_dma_memory(ioc, &mem); | 1120 | _config_free_config_dma_memory(ioc, &mem); |
1139 | 1121 | ||
1140 | out: | 1122 | out: |
1141 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1142 | return r; | 1123 | return r; |
1143 | } | 1124 | } |
1144 | 1125 | ||
@@ -1161,7 +1142,6 @@ mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1161 | int r; | 1142 | int r; |
1162 | struct config_request mem; | 1143 | struct config_request mem; |
1163 | 1144 | ||
1164 | mutex_lock(&ioc->config_cmds.mutex); | ||
1165 | memset(config_page, 0, sizeof(Mpi2ExpanderPage0_t)); | 1145 | memset(config_page, 0, sizeof(Mpi2ExpanderPage0_t)); |
1166 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 1146 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
1167 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 1147 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -1206,7 +1186,6 @@ mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1206 | _config_free_config_dma_memory(ioc, &mem); | 1186 | _config_free_config_dma_memory(ioc, &mem); |
1207 | 1187 | ||
1208 | out: | 1188 | out: |
1209 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1210 | return r; | 1189 | return r; |
1211 | } | 1190 | } |
1212 | 1191 | ||
@@ -1230,7 +1209,6 @@ mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1230 | int r; | 1209 | int r; |
1231 | struct config_request mem; | 1210 | struct config_request mem; |
1232 | 1211 | ||
1233 | mutex_lock(&ioc->config_cmds.mutex); | ||
1234 | memset(config_page, 0, sizeof(Mpi2ExpanderPage1_t)); | 1212 | memset(config_page, 0, sizeof(Mpi2ExpanderPage1_t)); |
1235 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 1213 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
1236 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 1214 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -1277,7 +1255,6 @@ mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1277 | _config_free_config_dma_memory(ioc, &mem); | 1255 | _config_free_config_dma_memory(ioc, &mem); |
1278 | 1256 | ||
1279 | out: | 1257 | out: |
1280 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1281 | return r; | 1258 | return r; |
1282 | } | 1259 | } |
1283 | 1260 | ||
@@ -1300,7 +1277,6 @@ mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1300 | int r; | 1277 | int r; |
1301 | struct config_request mem; | 1278 | struct config_request mem; |
1302 | 1279 | ||
1303 | mutex_lock(&ioc->config_cmds.mutex); | ||
1304 | memset(config_page, 0, sizeof(Mpi2SasEnclosurePage0_t)); | 1280 | memset(config_page, 0, sizeof(Mpi2SasEnclosurePage0_t)); |
1305 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 1281 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
1306 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 1282 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -1345,7 +1321,6 @@ mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1345 | _config_free_config_dma_memory(ioc, &mem); | 1321 | _config_free_config_dma_memory(ioc, &mem); |
1346 | 1322 | ||
1347 | out: | 1323 | out: |
1348 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1349 | return r; | 1324 | return r; |
1350 | } | 1325 | } |
1351 | 1326 | ||
@@ -1367,7 +1342,6 @@ mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1367 | int r; | 1342 | int r; |
1368 | struct config_request mem; | 1343 | struct config_request mem; |
1369 | 1344 | ||
1370 | mutex_lock(&ioc->config_cmds.mutex); | ||
1371 | memset(config_page, 0, sizeof(Mpi2SasPhyPage0_t)); | 1345 | memset(config_page, 0, sizeof(Mpi2SasPhyPage0_t)); |
1372 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 1346 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
1373 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 1347 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -1413,7 +1387,6 @@ mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1413 | _config_free_config_dma_memory(ioc, &mem); | 1387 | _config_free_config_dma_memory(ioc, &mem); |
1414 | 1388 | ||
1415 | out: | 1389 | out: |
1416 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1417 | return r; | 1390 | return r; |
1418 | } | 1391 | } |
1419 | 1392 | ||
@@ -1435,7 +1408,6 @@ mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1435 | int r; | 1408 | int r; |
1436 | struct config_request mem; | 1409 | struct config_request mem; |
1437 | 1410 | ||
1438 | mutex_lock(&ioc->config_cmds.mutex); | ||
1439 | memset(config_page, 0, sizeof(Mpi2SasPhyPage1_t)); | 1411 | memset(config_page, 0, sizeof(Mpi2SasPhyPage1_t)); |
1440 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 1412 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
1441 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 1413 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -1481,7 +1453,6 @@ mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1481 | _config_free_config_dma_memory(ioc, &mem); | 1453 | _config_free_config_dma_memory(ioc, &mem); |
1482 | 1454 | ||
1483 | out: | 1455 | out: |
1484 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1485 | return r; | 1456 | return r; |
1486 | } | 1457 | } |
1487 | 1458 | ||
@@ -1505,7 +1476,6 @@ mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc, | |||
1505 | int r; | 1476 | int r; |
1506 | struct config_request mem; | 1477 | struct config_request mem; |
1507 | 1478 | ||
1508 | mutex_lock(&ioc->config_cmds.mutex); | ||
1509 | memset(config_page, 0, sizeof(Mpi2RaidVolPage1_t)); | 1479 | memset(config_page, 0, sizeof(Mpi2RaidVolPage1_t)); |
1510 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 1480 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
1511 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 1481 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -1548,7 +1518,6 @@ mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc, | |||
1548 | _config_free_config_dma_memory(ioc, &mem); | 1518 | _config_free_config_dma_memory(ioc, &mem); |
1549 | 1519 | ||
1550 | out: | 1520 | out: |
1551 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1552 | return r; | 1521 | return r; |
1553 | } | 1522 | } |
1554 | 1523 | ||
@@ -1572,7 +1541,6 @@ mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle, | |||
1572 | struct config_request mem; | 1541 | struct config_request mem; |
1573 | u16 ioc_status; | 1542 | u16 ioc_status; |
1574 | 1543 | ||
1575 | mutex_lock(&ioc->config_cmds.mutex); | ||
1576 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 1544 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
1577 | *num_pds = 0; | 1545 | *num_pds = 0; |
1578 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 1546 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -1620,7 +1588,6 @@ mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle, | |||
1620 | _config_free_config_dma_memory(ioc, &mem); | 1588 | _config_free_config_dma_memory(ioc, &mem); |
1621 | 1589 | ||
1622 | out: | 1590 | out: |
1623 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1624 | return r; | 1591 | return r; |
1625 | } | 1592 | } |
1626 | 1593 | ||
@@ -1645,7 +1612,6 @@ mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc, | |||
1645 | int r; | 1612 | int r; |
1646 | struct config_request mem; | 1613 | struct config_request mem; |
1647 | 1614 | ||
1648 | mutex_lock(&ioc->config_cmds.mutex); | ||
1649 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 1615 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
1650 | memset(config_page, 0, sz); | 1616 | memset(config_page, 0, sz); |
1651 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 1617 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -1687,7 +1653,6 @@ mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc, | |||
1687 | _config_free_config_dma_memory(ioc, &mem); | 1653 | _config_free_config_dma_memory(ioc, &mem); |
1688 | 1654 | ||
1689 | out: | 1655 | out: |
1690 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1691 | return r; | 1656 | return r; |
1692 | } | 1657 | } |
1693 | 1658 | ||
@@ -1711,7 +1676,6 @@ mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1711 | int r; | 1676 | int r; |
1712 | struct config_request mem; | 1677 | struct config_request mem; |
1713 | 1678 | ||
1714 | mutex_lock(&ioc->config_cmds.mutex); | ||
1715 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 1679 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
1716 | memset(config_page, 0, sizeof(Mpi2RaidPhysDiskPage0_t)); | 1680 | memset(config_page, 0, sizeof(Mpi2RaidPhysDiskPage0_t)); |
1717 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 1681 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -1754,7 +1718,6 @@ mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t | |||
1754 | _config_free_config_dma_memory(ioc, &mem); | 1718 | _config_free_config_dma_memory(ioc, &mem); |
1755 | 1719 | ||
1756 | out: | 1720 | out: |
1757 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1758 | return r; | 1721 | return r; |
1759 | } | 1722 | } |
1760 | 1723 | ||
@@ -1778,7 +1741,6 @@ mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle, | |||
1778 | struct config_request mem; | 1741 | struct config_request mem; |
1779 | u16 ioc_status; | 1742 | u16 ioc_status; |
1780 | 1743 | ||
1781 | mutex_lock(&ioc->config_cmds.mutex); | ||
1782 | *volume_handle = 0; | 1744 | *volume_handle = 0; |
1783 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); | 1745 | memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); |
1784 | mpi_request.Function = MPI2_FUNCTION_CONFIG; | 1746 | mpi_request.Function = MPI2_FUNCTION_CONFIG; |
@@ -1842,7 +1804,6 @@ mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle, | |||
1842 | _config_free_config_dma_memory(ioc, &mem); | 1804 | _config_free_config_dma_memory(ioc, &mem); |
1843 | 1805 | ||
1844 | out: | 1806 | out: |
1845 | mutex_unlock(&ioc->config_cmds.mutex); | ||
1846 | return r; | 1807 | return r; |
1847 | } | 1808 | } |
1848 | 1809 | ||
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 2a01a5f2a84d..2e9a4445596f 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c | |||
@@ -2767,6 +2767,10 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, | |||
2767 | char *desc_ioc_state = NULL; | 2767 | char *desc_ioc_state = NULL; |
2768 | char *desc_scsi_status = NULL; | 2768 | char *desc_scsi_status = NULL; |
2769 | char *desc_scsi_state = ioc->tmp_string; | 2769 | char *desc_scsi_state = ioc->tmp_string; |
2770 | u32 log_info = le32_to_cpu(mpi_reply->IOCLogInfo); | ||
2771 | |||
2772 | if (log_info == 0x31170000) | ||
2773 | return; | ||
2770 | 2774 | ||
2771 | switch (ioc_status) { | 2775 | switch (ioc_status) { |
2772 | case MPI2_IOCSTATUS_SUCCESS: | 2776 | case MPI2_IOCSTATUS_SUCCESS: |
@@ -3426,7 +3430,7 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle) | |||
3426 | __le64 sas_address; | 3430 | __le64 sas_address; |
3427 | int i; | 3431 | int i; |
3428 | unsigned long flags; | 3432 | unsigned long flags; |
3429 | struct _sas_port *mpt2sas_port; | 3433 | struct _sas_port *mpt2sas_port = NULL; |
3430 | int rc = 0; | 3434 | int rc = 0; |
3431 | 3435 | ||
3432 | if (!handle) | 3436 | if (!handle) |
@@ -3518,12 +3522,20 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle) | |||
3518 | &expander_pg1, i, handle))) { | 3522 | &expander_pg1, i, handle))) { |
3519 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", | 3523 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", |
3520 | ioc->name, __FILE__, __LINE__, __func__); | 3524 | ioc->name, __FILE__, __LINE__, __func__); |
3521 | continue; | 3525 | rc = -1; |
3526 | goto out_fail; | ||
3522 | } | 3527 | } |
3523 | sas_expander->phy[i].handle = handle; | 3528 | sas_expander->phy[i].handle = handle; |
3524 | sas_expander->phy[i].phy_id = i; | 3529 | sas_expander->phy[i].phy_id = i; |
3525 | mpt2sas_transport_add_expander_phy(ioc, &sas_expander->phy[i], | 3530 | |
3526 | expander_pg1, sas_expander->parent_dev); | 3531 | if ((mpt2sas_transport_add_expander_phy(ioc, |
3532 | &sas_expander->phy[i], expander_pg1, | ||
3533 | sas_expander->parent_dev))) { | ||
3534 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", | ||
3535 | ioc->name, __FILE__, __LINE__, __func__); | ||
3536 | rc = -1; | ||
3537 | goto out_fail; | ||
3538 | } | ||
3527 | } | 3539 | } |
3528 | 3540 | ||
3529 | if (sas_expander->enclosure_handle) { | 3541 | if (sas_expander->enclosure_handle) { |
@@ -3540,8 +3552,9 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle) | |||
3540 | 3552 | ||
3541 | out_fail: | 3553 | out_fail: |
3542 | 3554 | ||
3543 | if (sas_expander) | 3555 | if (mpt2sas_port) |
3544 | kfree(sas_expander->phy); | 3556 | mpt2sas_transport_port_remove(ioc, sas_expander->sas_address, |
3557 | sas_expander->parent_handle); | ||
3545 | kfree(sas_expander); | 3558 | kfree(sas_expander); |
3546 | return rc; | 3559 | return rc; |
3547 | } | 3560 | } |
@@ -3663,12 +3676,11 @@ _scsih_add_device(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 phy_num, u8 is_pd) | |||
3663 | sas_device->hidden_raid_component = is_pd; | 3676 | sas_device->hidden_raid_component = is_pd; |
3664 | 3677 | ||
3665 | /* get enclosure_logical_id */ | 3678 | /* get enclosure_logical_id */ |
3666 | if (!(mpt2sas_config_get_enclosure_pg0(ioc, &mpi_reply, &enclosure_pg0, | 3679 | if (sas_device->enclosure_handle && !(mpt2sas_config_get_enclosure_pg0( |
3667 | MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE, | 3680 | ioc, &mpi_reply, &enclosure_pg0, MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE, |
3668 | sas_device->enclosure_handle))) { | 3681 | sas_device->enclosure_handle))) |
3669 | sas_device->enclosure_logical_id = | 3682 | sas_device->enclosure_logical_id = |
3670 | le64_to_cpu(enclosure_pg0.EnclosureLogicalID); | 3683 | le64_to_cpu(enclosure_pg0.EnclosureLogicalID); |
3671 | } | ||
3672 | 3684 | ||
3673 | /* get device name */ | 3685 | /* get device name */ |
3674 | sas_device->device_name = le64_to_cpu(sas_device_pg0.DeviceName); | 3686 | sas_device->device_name = le64_to_cpu(sas_device_pg0.DeviceName); |
@@ -4250,12 +4262,6 @@ _scsih_sas_volume_add(struct MPT2SAS_ADAPTER *ioc, | |||
4250 | u16 handle = le16_to_cpu(element->VolDevHandle); | 4262 | u16 handle = le16_to_cpu(element->VolDevHandle); |
4251 | int rc; | 4263 | int rc; |
4252 | 4264 | ||
4253 | #if 0 /* RAID_HACKS */ | ||
4254 | if (le32_to_cpu(event_data->Flags) & | ||
4255 | MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) | ||
4256 | return; | ||
4257 | #endif | ||
4258 | |||
4259 | mpt2sas_config_get_volume_wwid(ioc, handle, &wwid); | 4265 | mpt2sas_config_get_volume_wwid(ioc, handle, &wwid); |
4260 | if (!wwid) { | 4266 | if (!wwid) { |
4261 | printk(MPT2SAS_ERR_FMT | 4267 | printk(MPT2SAS_ERR_FMT |
@@ -4310,12 +4316,6 @@ _scsih_sas_volume_delete(struct MPT2SAS_ADAPTER *ioc, | |||
4310 | unsigned long flags; | 4316 | unsigned long flags; |
4311 | struct MPT2SAS_TARGET *sas_target_priv_data; | 4317 | struct MPT2SAS_TARGET *sas_target_priv_data; |
4312 | 4318 | ||
4313 | #if 0 /* RAID_HACKS */ | ||
4314 | if (le32_to_cpu(event_data->Flags) & | ||
4315 | MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) | ||
4316 | return; | ||
4317 | #endif | ||
4318 | |||
4319 | spin_lock_irqsave(&ioc->raid_device_lock, flags); | 4319 | spin_lock_irqsave(&ioc->raid_device_lock, flags); |
4320 | raid_device = _scsih_raid_device_find_by_handle(ioc, handle); | 4320 | raid_device = _scsih_raid_device_find_by_handle(ioc, handle); |
4321 | spin_unlock_irqrestore(&ioc->raid_device_lock, flags); | 4321 | spin_unlock_irqrestore(&ioc->raid_device_lock, flags); |
@@ -4428,14 +4428,38 @@ _scsih_sas_pd_add(struct MPT2SAS_ADAPTER *ioc, | |||
4428 | struct _sas_device *sas_device; | 4428 | struct _sas_device *sas_device; |
4429 | unsigned long flags; | 4429 | unsigned long flags; |
4430 | u16 handle = le16_to_cpu(element->PhysDiskDevHandle); | 4430 | u16 handle = le16_to_cpu(element->PhysDiskDevHandle); |
4431 | Mpi2ConfigReply_t mpi_reply; | ||
4432 | Mpi2SasDevicePage0_t sas_device_pg0; | ||
4433 | u32 ioc_status; | ||
4431 | 4434 | ||
4432 | spin_lock_irqsave(&ioc->sas_device_lock, flags); | 4435 | spin_lock_irqsave(&ioc->sas_device_lock, flags); |
4433 | sas_device = _scsih_sas_device_find_by_handle(ioc, handle); | 4436 | sas_device = _scsih_sas_device_find_by_handle(ioc, handle); |
4434 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); | 4437 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); |
4435 | if (sas_device) | 4438 | if (sas_device) { |
4436 | sas_device->hidden_raid_component = 1; | 4439 | sas_device->hidden_raid_component = 1; |
4437 | else | 4440 | return; |
4438 | _scsih_add_device(ioc, handle, 0, 1); | 4441 | } |
4442 | |||
4443 | if ((mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, | ||
4444 | MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) { | ||
4445 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", | ||
4446 | ioc->name, __FILE__, __LINE__, __func__); | ||
4447 | return; | ||
4448 | } | ||
4449 | |||
4450 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & | ||
4451 | MPI2_IOCSTATUS_MASK; | ||
4452 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { | ||
4453 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", | ||
4454 | ioc->name, __FILE__, __LINE__, __func__); | ||
4455 | return; | ||
4456 | } | ||
4457 | |||
4458 | _scsih_link_change(ioc, | ||
4459 | le16_to_cpu(sas_device_pg0.ParentDevHandle), | ||
4460 | handle, sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5); | ||
4461 | |||
4462 | _scsih_add_device(ioc, handle, 0, 1); | ||
4439 | } | 4463 | } |
4440 | 4464 | ||
4441 | #ifdef CONFIG_SCSI_MPT2SAS_LOGGING | 4465 | #ifdef CONFIG_SCSI_MPT2SAS_LOGGING |
@@ -4535,12 +4559,15 @@ _scsih_sas_ir_config_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, | |||
4535 | { | 4559 | { |
4536 | Mpi2EventIrConfigElement_t *element; | 4560 | Mpi2EventIrConfigElement_t *element; |
4537 | int i; | 4561 | int i; |
4562 | u8 foreign_config; | ||
4538 | 4563 | ||
4539 | #ifdef CONFIG_SCSI_MPT2SAS_LOGGING | 4564 | #ifdef CONFIG_SCSI_MPT2SAS_LOGGING |
4540 | if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) | 4565 | if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) |
4541 | _scsih_sas_ir_config_change_event_debug(ioc, event_data); | 4566 | _scsih_sas_ir_config_change_event_debug(ioc, event_data); |
4542 | 4567 | ||
4543 | #endif | 4568 | #endif |
4569 | foreign_config = (le32_to_cpu(event_data->Flags) & | ||
4570 | MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) ? 1 : 0; | ||
4544 | 4571 | ||
4545 | element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0]; | 4572 | element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0]; |
4546 | for (i = 0; i < event_data->NumElements; i++, element++) { | 4573 | for (i = 0; i < event_data->NumElements; i++, element++) { |
@@ -4548,11 +4575,13 @@ _scsih_sas_ir_config_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, | |||
4548 | switch (element->ReasonCode) { | 4575 | switch (element->ReasonCode) { |
4549 | case MPI2_EVENT_IR_CHANGE_RC_VOLUME_CREATED: | 4576 | case MPI2_EVENT_IR_CHANGE_RC_VOLUME_CREATED: |
4550 | case MPI2_EVENT_IR_CHANGE_RC_ADDED: | 4577 | case MPI2_EVENT_IR_CHANGE_RC_ADDED: |
4551 | _scsih_sas_volume_add(ioc, element); | 4578 | if (!foreign_config) |
4579 | _scsih_sas_volume_add(ioc, element); | ||
4552 | break; | 4580 | break; |
4553 | case MPI2_EVENT_IR_CHANGE_RC_VOLUME_DELETED: | 4581 | case MPI2_EVENT_IR_CHANGE_RC_VOLUME_DELETED: |
4554 | case MPI2_EVENT_IR_CHANGE_RC_REMOVED: | 4582 | case MPI2_EVENT_IR_CHANGE_RC_REMOVED: |
4555 | _scsih_sas_volume_delete(ioc, element); | 4583 | if (!foreign_config) |
4584 | _scsih_sas_volume_delete(ioc, element); | ||
4556 | break; | 4585 | break; |
4557 | case MPI2_EVENT_IR_CHANGE_RC_PD_CREATED: | 4586 | case MPI2_EVENT_IR_CHANGE_RC_PD_CREATED: |
4558 | _scsih_sas_pd_hide(ioc, element); | 4587 | _scsih_sas_pd_hide(ioc, element); |
@@ -4671,6 +4700,9 @@ _scsih_sas_ir_physical_disk_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, | |||
4671 | u32 state; | 4700 | u32 state; |
4672 | struct _sas_device *sas_device; | 4701 | struct _sas_device *sas_device; |
4673 | unsigned long flags; | 4702 | unsigned long flags; |
4703 | Mpi2ConfigReply_t mpi_reply; | ||
4704 | Mpi2SasDevicePage0_t sas_device_pg0; | ||
4705 | u32 ioc_status; | ||
4674 | 4706 | ||
4675 | if (event_data->ReasonCode != MPI2_EVENT_IR_PHYSDISK_RC_STATE_CHANGED) | 4707 | if (event_data->ReasonCode != MPI2_EVENT_IR_PHYSDISK_RC_STATE_CHANGED) |
4676 | return; | 4708 | return; |
@@ -4687,22 +4719,40 @@ _scsih_sas_ir_physical_disk_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, | |||
4687 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); | 4719 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); |
4688 | 4720 | ||
4689 | switch (state) { | 4721 | switch (state) { |
4690 | #if 0 | ||
4691 | case MPI2_RAID_PD_STATE_OFFLINE: | ||
4692 | if (sas_device) | ||
4693 | _scsih_remove_device(ioc, handle); | ||
4694 | break; | ||
4695 | #endif | ||
4696 | case MPI2_RAID_PD_STATE_ONLINE: | 4722 | case MPI2_RAID_PD_STATE_ONLINE: |
4697 | case MPI2_RAID_PD_STATE_DEGRADED: | 4723 | case MPI2_RAID_PD_STATE_DEGRADED: |
4698 | case MPI2_RAID_PD_STATE_REBUILDING: | 4724 | case MPI2_RAID_PD_STATE_REBUILDING: |
4699 | case MPI2_RAID_PD_STATE_OPTIMAL: | 4725 | case MPI2_RAID_PD_STATE_OPTIMAL: |
4700 | if (sas_device) | 4726 | if (sas_device) { |
4701 | sas_device->hidden_raid_component = 1; | 4727 | sas_device->hidden_raid_component = 1; |
4702 | else | 4728 | return; |
4703 | _scsih_add_device(ioc, handle, 0, 1); | 4729 | } |
4730 | |||
4731 | if ((mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply, | ||
4732 | &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, | ||
4733 | handle))) { | ||
4734 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", | ||
4735 | ioc->name, __FILE__, __LINE__, __func__); | ||
4736 | return; | ||
4737 | } | ||
4738 | |||
4739 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & | ||
4740 | MPI2_IOCSTATUS_MASK; | ||
4741 | if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { | ||
4742 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", | ||
4743 | ioc->name, __FILE__, __LINE__, __func__); | ||
4744 | return; | ||
4745 | } | ||
4746 | |||
4747 | _scsih_link_change(ioc, | ||
4748 | le16_to_cpu(sas_device_pg0.ParentDevHandle), | ||
4749 | handle, sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5); | ||
4750 | |||
4751 | _scsih_add_device(ioc, handle, 0, 1); | ||
4752 | |||
4704 | break; | 4753 | break; |
4705 | 4754 | ||
4755 | case MPI2_RAID_PD_STATE_OFFLINE: | ||
4706 | case MPI2_RAID_PD_STATE_NOT_CONFIGURED: | 4756 | case MPI2_RAID_PD_STATE_NOT_CONFIGURED: |
4707 | case MPI2_RAID_PD_STATE_NOT_COMPATIBLE: | 4757 | case MPI2_RAID_PD_STATE_NOT_COMPATIBLE: |
4708 | case MPI2_RAID_PD_STATE_HOT_SPARE: | 4758 | case MPI2_RAID_PD_STATE_HOT_SPARE: |
@@ -5774,6 +5824,7 @@ _scsih_suspend(struct pci_dev *pdev, pm_message_t state) | |||
5774 | struct MPT2SAS_ADAPTER *ioc = shost_priv(shost); | 5824 | struct MPT2SAS_ADAPTER *ioc = shost_priv(shost); |
5775 | u32 device_state; | 5825 | u32 device_state; |
5776 | 5826 | ||
5827 | mpt2sas_base_stop_watchdog(ioc); | ||
5777 | flush_scheduled_work(); | 5828 | flush_scheduled_work(); |
5778 | scsi_block_requests(shost); | 5829 | scsi_block_requests(shost); |
5779 | device_state = pci_choose_state(pdev, state); | 5830 | device_state = pci_choose_state(pdev, state); |
@@ -5816,6 +5867,7 @@ _scsih_resume(struct pci_dev *pdev) | |||
5816 | 5867 | ||
5817 | mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP, SOFT_RESET); | 5868 | mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP, SOFT_RESET); |
5818 | scsi_unblock_requests(shost); | 5869 | scsi_unblock_requests(shost); |
5870 | mpt2sas_base_start_watchdog(ioc); | ||
5819 | return 0; | 5871 | return 0; |
5820 | } | 5872 | } |
5821 | #endif /* CONFIG_PM */ | 5873 | #endif /* CONFIG_PM */ |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 037c1e0b7c4c..6553833c12db 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -527,7 +527,7 @@ config SERIAL_S3C24A0 | |||
527 | 527 | ||
528 | config SERIAL_S3C6400 | 528 | config SERIAL_S3C6400 |
529 | tristate "Samsung S3C6400/S3C6410 Serial port support" | 529 | tristate "Samsung S3C6400/S3C6410 Serial port support" |
530 | depends on SERIAL_SAMSUNG && (CPU_S3C600 || CPU_S3C6410) | 530 | depends on SERIAL_SAMSUNG && (CPU_S3C6400 || CPU_S3C6410) |
531 | default y | 531 | default y |
532 | help | 532 | help |
533 | Serial port support for the Samsung S3C6400 and S3C6410 | 533 | Serial port support for the Samsung S3C6400 and S3C6410 |
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c index e0d44af4745a..3f3119d760db 100644 --- a/drivers/spi/spi_s3c24xx.c +++ b/drivers/spi/spi_s3c24xx.c | |||
@@ -111,29 +111,32 @@ static int s3c24xx_spi_setupxfer(struct spi_device *spi, | |||
111 | unsigned int bpw; | 111 | unsigned int bpw; |
112 | unsigned int hz; | 112 | unsigned int hz; |
113 | unsigned int div; | 113 | unsigned int div; |
114 | unsigned long clk; | ||
114 | 115 | ||
115 | bpw = t ? t->bits_per_word : spi->bits_per_word; | 116 | bpw = t ? t->bits_per_word : spi->bits_per_word; |
116 | hz = t ? t->speed_hz : spi->max_speed_hz; | 117 | hz = t ? t->speed_hz : spi->max_speed_hz; |
117 | 118 | ||
119 | if (!bpw) | ||
120 | bpw = 8; | ||
121 | |||
122 | if (!hz) | ||
123 | hz = spi->max_speed_hz; | ||
124 | |||
118 | if (bpw != 8) { | 125 | if (bpw != 8) { |
119 | dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw); | 126 | dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw); |
120 | return -EINVAL; | 127 | return -EINVAL; |
121 | } | 128 | } |
122 | 129 | ||
123 | div = clk_get_rate(hw->clk) / hz; | 130 | clk = clk_get_rate(hw->clk); |
124 | 131 | div = DIV_ROUND_UP(clk, hz * 2) - 1; | |
125 | /* is clk = pclk / (2 * (pre+1)), or is it | ||
126 | * clk = (pclk * 2) / ( pre + 1) */ | ||
127 | |||
128 | div /= 2; | ||
129 | |||
130 | if (div > 0) | ||
131 | div -= 1; | ||
132 | 132 | ||
133 | if (div > 255) | 133 | if (div > 255) |
134 | div = 255; | 134 | div = 255; |
135 | 135 | ||
136 | dev_dbg(&spi->dev, "setting pre-scaler to %d (hz %d)\n", div, hz); | 136 | dev_dbg(&spi->dev, "setting pre-scaler to %d (wanted %d, got %ld)\n", |
137 | div, hz, clk / (2 * (div + 1))); | ||
138 | |||
139 | |||
137 | writeb(div, hw->regs + S3C2410_SPPRE); | 140 | writeb(div, hw->regs + S3C2410_SPPRE); |
138 | 141 | ||
139 | spin_lock(&hw->bitbang.lock); | 142 | spin_lock(&hw->bitbang.lock); |
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index 0a69672097a8..4e83c297ec9e 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c | |||
@@ -953,7 +953,12 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) | |||
953 | 953 | ||
954 | mutex_lock(&tz->lock); | 954 | mutex_lock(&tz->lock); |
955 | 955 | ||
956 | tz->ops->get_temp(tz, &temp); | 956 | if (tz->ops->get_temp(tz, &temp)) { |
957 | /* get_temp failed - retry it later */ | ||
958 | printk(KERN_WARNING PREFIX "failed to read out thermal zone " | ||
959 | "%d\n", tz->id); | ||
960 | goto leave; | ||
961 | } | ||
957 | 962 | ||
958 | for (count = 0; count < tz->trips; count++) { | 963 | for (count = 0; count < tz->trips; count++) { |
959 | tz->ops->get_trip_type(tz, count, &trip_type); | 964 | tz->ops->get_trip_type(tz, count, &trip_type); |
@@ -1005,6 +1010,8 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) | |||
1005 | THERMAL_TRIPS_NONE); | 1010 | THERMAL_TRIPS_NONE); |
1006 | 1011 | ||
1007 | tz->last_temperature = temp; | 1012 | tz->last_temperature = temp; |
1013 | |||
1014 | leave: | ||
1008 | if (tz->passive) | 1015 | if (tz->passive) |
1009 | thermal_zone_device_set_polling(tz, tz->passive_delay); | 1016 | thermal_zone_device_set_polling(tz, tz->passive_delay); |
1010 | else if (tz->polling_delay) | 1017 | else if (tz->polling_delay) |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 8f24564f77b0..07f22b625632 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -481,6 +481,9 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
481 | /* tell the board code to enable the panel */ | 481 | /* tell the board code to enable the panel */ |
482 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { | 482 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { |
483 | ch = &priv->ch[k]; | 483 | ch = &priv->ch[k]; |
484 | if (!ch->enabled) | ||
485 | continue; | ||
486 | |||
484 | board_cfg = &ch->cfg.board_cfg; | 487 | board_cfg = &ch->cfg.board_cfg; |
485 | if (board_cfg->display_on) | 488 | if (board_cfg->display_on) |
486 | board_cfg->display_on(board_cfg->board_data); | 489 | board_cfg->display_on(board_cfg->board_data); |
@@ -498,6 +501,8 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv) | |||
498 | /* clean up deferred io and ask board code to disable panel */ | 501 | /* clean up deferred io and ask board code to disable panel */ |
499 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { | 502 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { |
500 | ch = &priv->ch[k]; | 503 | ch = &priv->ch[k]; |
504 | if (!ch->enabled) | ||
505 | continue; | ||
501 | 506 | ||
502 | /* deferred io mode: | 507 | /* deferred io mode: |
503 | * flush frame, and wait for frame end interrupt | 508 | * flush frame, and wait for frame end interrupt |
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c index 15502d5e3641..54cd91610174 100644 --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/xen-fbfront.c | |||
@@ -454,6 +454,10 @@ static int __devinit xenfb_probe(struct xenbus_device *dev, | |||
454 | 454 | ||
455 | xenfb_init_shared_page(info, fb_info); | 455 | xenfb_init_shared_page(info, fb_info); |
456 | 456 | ||
457 | ret = xenfb_connect_backend(dev, info); | ||
458 | if (ret < 0) | ||
459 | goto error; | ||
460 | |||
457 | ret = register_framebuffer(fb_info); | 461 | ret = register_framebuffer(fb_info); |
458 | if (ret) { | 462 | if (ret) { |
459 | fb_deferred_io_cleanup(fb_info); | 463 | fb_deferred_io_cleanup(fb_info); |
@@ -464,10 +468,6 @@ static int __devinit xenfb_probe(struct xenbus_device *dev, | |||
464 | } | 468 | } |
465 | info->fb_info = fb_info; | 469 | info->fb_info = fb_info; |
466 | 470 | ||
467 | ret = xenfb_connect_backend(dev, info); | ||
468 | if (ret < 0) | ||
469 | goto error; | ||
470 | |||
471 | xenfb_make_preferred_console(); | 471 | xenfb_make_preferred_console(); |
472 | return 0; | 472 | return 0; |
473 | 473 | ||
diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c index 3fe9742c23ca..2f8643efe92c 100644 --- a/drivers/watchdog/ar7_wdt.c +++ b/drivers/watchdog/ar7_wdt.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/uaccess.h> | 37 | #include <linux/uaccess.h> |
38 | 38 | ||
39 | #include <asm/addrspace.h> | 39 | #include <asm/addrspace.h> |
40 | #include <asm/ar7/ar7.h> | 40 | #include <asm/mach-ar7/ar7.h> |
41 | 41 | ||
42 | #define DRVNAME "ar7_wdt" | 42 | #define DRVNAME "ar7_wdt" |
43 | #define LONGNAME "TI AR7 Watchdog Timer" | 43 | #define LONGNAME "TI AR7 Watchdog Timer" |
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 332b5ff02fec..f7003cfac63d 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -76,7 +76,7 @@ static const match_table_t tokens = { | |||
76 | * Return 0 upon success, -ERRNO upon failure. | 76 | * Return 0 upon success, -ERRNO upon failure. |
77 | */ | 77 | */ |
78 | 78 | ||
79 | static int v9fs_parse_options(struct v9fs_session_info *v9ses) | 79 | static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) |
80 | { | 80 | { |
81 | char *options; | 81 | char *options; |
82 | substring_t args[MAX_OPT_ARGS]; | 82 | substring_t args[MAX_OPT_ARGS]; |
@@ -90,10 +90,10 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses) | |||
90 | v9ses->debug = 0; | 90 | v9ses->debug = 0; |
91 | v9ses->cache = 0; | 91 | v9ses->cache = 0; |
92 | 92 | ||
93 | if (!v9ses->options) | 93 | if (!opts) |
94 | return 0; | 94 | return 0; |
95 | 95 | ||
96 | options = kstrdup(v9ses->options, GFP_KERNEL); | 96 | options = kstrdup(opts, GFP_KERNEL); |
97 | if (!options) { | 97 | if (!options) { |
98 | P9_DPRINTK(P9_DEBUG_ERROR, | 98 | P9_DPRINTK(P9_DEBUG_ERROR, |
99 | "failed to allocate copy of option string\n"); | 99 | "failed to allocate copy of option string\n"); |
@@ -206,24 +206,14 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
206 | v9ses->uid = ~0; | 206 | v9ses->uid = ~0; |
207 | v9ses->dfltuid = V9FS_DEFUID; | 207 | v9ses->dfltuid = V9FS_DEFUID; |
208 | v9ses->dfltgid = V9FS_DEFGID; | 208 | v9ses->dfltgid = V9FS_DEFGID; |
209 | if (data) { | ||
210 | v9ses->options = kstrdup(data, GFP_KERNEL); | ||
211 | if (!v9ses->options) { | ||
212 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
213 | "failed to allocate copy of option string\n"); | ||
214 | retval = -ENOMEM; | ||
215 | goto error; | ||
216 | } | ||
217 | } | ||
218 | 209 | ||
219 | rc = v9fs_parse_options(v9ses); | 210 | rc = v9fs_parse_options(v9ses, data); |
220 | if (rc < 0) { | 211 | if (rc < 0) { |
221 | retval = rc; | 212 | retval = rc; |
222 | goto error; | 213 | goto error; |
223 | } | 214 | } |
224 | 215 | ||
225 | v9ses->clnt = p9_client_create(dev_name, v9ses->options); | 216 | v9ses->clnt = p9_client_create(dev_name, data); |
226 | |||
227 | if (IS_ERR(v9ses->clnt)) { | 217 | if (IS_ERR(v9ses->clnt)) { |
228 | retval = PTR_ERR(v9ses->clnt); | 218 | retval = PTR_ERR(v9ses->clnt); |
229 | v9ses->clnt = NULL; | 219 | v9ses->clnt = NULL; |
@@ -280,7 +270,6 @@ void v9fs_session_close(struct v9fs_session_info *v9ses) | |||
280 | 270 | ||
281 | __putname(v9ses->uname); | 271 | __putname(v9ses->uname); |
282 | __putname(v9ses->aname); | 272 | __putname(v9ses->aname); |
283 | kfree(v9ses->options); | ||
284 | } | 273 | } |
285 | 274 | ||
286 | /** | 275 | /** |
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index a7d567192998..38762bf102a9 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h | |||
@@ -85,7 +85,6 @@ struct v9fs_session_info { | |||
85 | unsigned int afid; | 85 | unsigned int afid; |
86 | unsigned int cache; | 86 | unsigned int cache; |
87 | 87 | ||
88 | char *options; /* copy of mount options */ | ||
89 | char *uname; /* user name to mount as */ | 88 | char *uname; /* user name to mount as */ |
90 | char *aname; /* name of remote hierarchy being mounted */ | 89 | char *aname; /* name of remote hierarchy being mounted */ |
91 | unsigned int maxdata; /* max data for client interface */ | 90 | unsigned int maxdata; /* max data for client interface */ |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 81f8bbf12f9f..06a223d50a81 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -171,7 +171,6 @@ int v9fs_uflags2omode(int uflags, int extended) | |||
171 | 171 | ||
172 | /** | 172 | /** |
173 | * v9fs_blank_wstat - helper function to setup a 9P stat structure | 173 | * v9fs_blank_wstat - helper function to setup a 9P stat structure |
174 | * @v9ses: 9P session info (for determining extended mode) | ||
175 | * @wstat: structure to initialize | 174 | * @wstat: structure to initialize |
176 | * | 175 | * |
177 | */ | 176 | */ |
@@ -207,65 +206,72 @@ v9fs_blank_wstat(struct p9_wstat *wstat) | |||
207 | 206 | ||
208 | struct inode *v9fs_get_inode(struct super_block *sb, int mode) | 207 | struct inode *v9fs_get_inode(struct super_block *sb, int mode) |
209 | { | 208 | { |
209 | int err; | ||
210 | struct inode *inode; | 210 | struct inode *inode; |
211 | struct v9fs_session_info *v9ses = sb->s_fs_info; | 211 | struct v9fs_session_info *v9ses = sb->s_fs_info; |
212 | 212 | ||
213 | P9_DPRINTK(P9_DEBUG_VFS, "super block: %p mode: %o\n", sb, mode); | 213 | P9_DPRINTK(P9_DEBUG_VFS, "super block: %p mode: %o\n", sb, mode); |
214 | 214 | ||
215 | inode = new_inode(sb); | 215 | inode = new_inode(sb); |
216 | if (inode) { | 216 | if (!inode) { |
217 | inode->i_mode = mode; | ||
218 | inode->i_uid = current_fsuid(); | ||
219 | inode->i_gid = current_fsgid(); | ||
220 | inode->i_blocks = 0; | ||
221 | inode->i_rdev = 0; | ||
222 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
223 | inode->i_mapping->a_ops = &v9fs_addr_operations; | ||
224 | |||
225 | switch (mode & S_IFMT) { | ||
226 | case S_IFIFO: | ||
227 | case S_IFBLK: | ||
228 | case S_IFCHR: | ||
229 | case S_IFSOCK: | ||
230 | if (!v9fs_extended(v9ses)) { | ||
231 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
232 | "special files without extended mode\n"); | ||
233 | return ERR_PTR(-EINVAL); | ||
234 | } | ||
235 | init_special_inode(inode, inode->i_mode, | ||
236 | inode->i_rdev); | ||
237 | break; | ||
238 | case S_IFREG: | ||
239 | inode->i_op = &v9fs_file_inode_operations; | ||
240 | inode->i_fop = &v9fs_file_operations; | ||
241 | break; | ||
242 | case S_IFLNK: | ||
243 | if (!v9fs_extended(v9ses)) { | ||
244 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
245 | "extended modes used w/o 9P2000.u\n"); | ||
246 | return ERR_PTR(-EINVAL); | ||
247 | } | ||
248 | inode->i_op = &v9fs_symlink_inode_operations; | ||
249 | break; | ||
250 | case S_IFDIR: | ||
251 | inc_nlink(inode); | ||
252 | if (v9fs_extended(v9ses)) | ||
253 | inode->i_op = &v9fs_dir_inode_operations_ext; | ||
254 | else | ||
255 | inode->i_op = &v9fs_dir_inode_operations; | ||
256 | inode->i_fop = &v9fs_dir_operations; | ||
257 | break; | ||
258 | default: | ||
259 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
260 | "BAD mode 0x%x S_IFMT 0x%x\n", | ||
261 | mode, mode & S_IFMT); | ||
262 | return ERR_PTR(-EINVAL); | ||
263 | } | ||
264 | } else { | ||
265 | P9_EPRINTK(KERN_WARNING, "Problem allocating inode\n"); | 217 | P9_EPRINTK(KERN_WARNING, "Problem allocating inode\n"); |
266 | return ERR_PTR(-ENOMEM); | 218 | return ERR_PTR(-ENOMEM); |
267 | } | 219 | } |
220 | |||
221 | inode->i_mode = mode; | ||
222 | inode->i_uid = current_fsuid(); | ||
223 | inode->i_gid = current_fsgid(); | ||
224 | inode->i_blocks = 0; | ||
225 | inode->i_rdev = 0; | ||
226 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
227 | inode->i_mapping->a_ops = &v9fs_addr_operations; | ||
228 | |||
229 | switch (mode & S_IFMT) { | ||
230 | case S_IFIFO: | ||
231 | case S_IFBLK: | ||
232 | case S_IFCHR: | ||
233 | case S_IFSOCK: | ||
234 | if (!v9fs_extended(v9ses)) { | ||
235 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
236 | "special files without extended mode\n"); | ||
237 | err = -EINVAL; | ||
238 | goto error; | ||
239 | } | ||
240 | init_special_inode(inode, inode->i_mode, inode->i_rdev); | ||
241 | break; | ||
242 | case S_IFREG: | ||
243 | inode->i_op = &v9fs_file_inode_operations; | ||
244 | inode->i_fop = &v9fs_file_operations; | ||
245 | break; | ||
246 | case S_IFLNK: | ||
247 | if (!v9fs_extended(v9ses)) { | ||
248 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
249 | "extended modes used w/o 9P2000.u\n"); | ||
250 | err = -EINVAL; | ||
251 | goto error; | ||
252 | } | ||
253 | inode->i_op = &v9fs_symlink_inode_operations; | ||
254 | break; | ||
255 | case S_IFDIR: | ||
256 | inc_nlink(inode); | ||
257 | if (v9fs_extended(v9ses)) | ||
258 | inode->i_op = &v9fs_dir_inode_operations_ext; | ||
259 | else | ||
260 | inode->i_op = &v9fs_dir_inode_operations; | ||
261 | inode->i_fop = &v9fs_dir_operations; | ||
262 | break; | ||
263 | default: | ||
264 | P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n", | ||
265 | mode, mode & S_IFMT); | ||
266 | err = -EINVAL; | ||
267 | goto error; | ||
268 | } | ||
269 | |||
268 | return inode; | 270 | return inode; |
271 | |||
272 | error: | ||
273 | iput(inode); | ||
274 | return ERR_PTR(err); | ||
269 | } | 275 | } |
270 | 276 | ||
271 | /* | 277 | /* |
@@ -338,30 +344,25 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, | |||
338 | 344 | ||
339 | ret = NULL; | 345 | ret = NULL; |
340 | st = p9_client_stat(fid); | 346 | st = p9_client_stat(fid); |
341 | if (IS_ERR(st)) { | 347 | if (IS_ERR(st)) |
342 | err = PTR_ERR(st); | 348 | return ERR_CAST(st); |
343 | st = NULL; | ||
344 | goto error; | ||
345 | } | ||
346 | 349 | ||
347 | umode = p9mode2unixmode(v9ses, st->mode); | 350 | umode = p9mode2unixmode(v9ses, st->mode); |
348 | ret = v9fs_get_inode(sb, umode); | 351 | ret = v9fs_get_inode(sb, umode); |
349 | if (IS_ERR(ret)) { | 352 | if (IS_ERR(ret)) { |
350 | err = PTR_ERR(ret); | 353 | err = PTR_ERR(ret); |
351 | ret = NULL; | ||
352 | goto error; | 354 | goto error; |
353 | } | 355 | } |
354 | 356 | ||
355 | v9fs_stat2inode(st, ret, sb); | 357 | v9fs_stat2inode(st, ret, sb); |
356 | ret->i_ino = v9fs_qid2ino(&st->qid); | 358 | ret->i_ino = v9fs_qid2ino(&st->qid); |
359 | p9stat_free(st); | ||
357 | kfree(st); | 360 | kfree(st); |
358 | return ret; | 361 | return ret; |
359 | 362 | ||
360 | error: | 363 | error: |
364 | p9stat_free(st); | ||
361 | kfree(st); | 365 | kfree(st); |
362 | if (ret) | ||
363 | iput(ret); | ||
364 | |||
365 | return ERR_PTR(err); | 366 | return ERR_PTR(err); |
366 | } | 367 | } |
367 | 368 | ||
@@ -403,9 +404,9 @@ v9fs_open_created(struct inode *inode, struct file *file) | |||
403 | * @v9ses: session information | 404 | * @v9ses: session information |
404 | * @dir: directory that dentry is being created in | 405 | * @dir: directory that dentry is being created in |
405 | * @dentry: dentry that is being created | 406 | * @dentry: dentry that is being created |
407 | * @extension: 9p2000.u extension string to support devices, etc. | ||
406 | * @perm: create permissions | 408 | * @perm: create permissions |
407 | * @mode: open mode | 409 | * @mode: open mode |
408 | * @extension: 9p2000.u extension string to support devices, etc. | ||
409 | * | 410 | * |
410 | */ | 411 | */ |
411 | static struct p9_fid * | 412 | static struct p9_fid * |
@@ -470,7 +471,10 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
470 | dentry->d_op = &v9fs_dentry_operations; | 471 | dentry->d_op = &v9fs_dentry_operations; |
471 | 472 | ||
472 | d_instantiate(dentry, inode); | 473 | d_instantiate(dentry, inode); |
473 | v9fs_fid_add(dentry, fid); | 474 | err = v9fs_fid_add(dentry, fid); |
475 | if (err < 0) | ||
476 | goto error; | ||
477 | |||
474 | return ofid; | 478 | return ofid; |
475 | 479 | ||
476 | error: | 480 | error: |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 38d695d66a0b..8961f1a8f668 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -81,7 +81,7 @@ static int v9fs_set_super(struct super_block *s, void *data) | |||
81 | 81 | ||
82 | static void | 82 | static void |
83 | v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, | 83 | v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, |
84 | int flags) | 84 | int flags, void *data) |
85 | { | 85 | { |
86 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 86 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
87 | sb->s_blocksize_bits = fls(v9ses->maxdata - 1); | 87 | sb->s_blocksize_bits = fls(v9ses->maxdata - 1); |
@@ -91,6 +91,8 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, | |||
91 | 91 | ||
92 | sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC | | 92 | sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC | |
93 | MS_NOATIME; | 93 | MS_NOATIME; |
94 | |||
95 | save_mount_options(sb, data); | ||
94 | } | 96 | } |
95 | 97 | ||
96 | /** | 98 | /** |
@@ -113,14 +115,11 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, | |||
113 | struct v9fs_session_info *v9ses = NULL; | 115 | struct v9fs_session_info *v9ses = NULL; |
114 | struct p9_wstat *st = NULL; | 116 | struct p9_wstat *st = NULL; |
115 | int mode = S_IRWXUGO | S_ISVTX; | 117 | int mode = S_IRWXUGO | S_ISVTX; |
116 | uid_t uid = current_fsuid(); | ||
117 | gid_t gid = current_fsgid(); | ||
118 | struct p9_fid *fid; | 118 | struct p9_fid *fid; |
119 | int retval = 0; | 119 | int retval = 0; |
120 | 120 | ||
121 | P9_DPRINTK(P9_DEBUG_VFS, " \n"); | 121 | P9_DPRINTK(P9_DEBUG_VFS, " \n"); |
122 | 122 | ||
123 | st = NULL; | ||
124 | v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); | 123 | v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); |
125 | if (!v9ses) | 124 | if (!v9ses) |
126 | return -ENOMEM; | 125 | return -ENOMEM; |
@@ -142,7 +141,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, | |||
142 | retval = PTR_ERR(sb); | 141 | retval = PTR_ERR(sb); |
143 | goto free_stat; | 142 | goto free_stat; |
144 | } | 143 | } |
145 | v9fs_fill_super(sb, v9ses, flags); | 144 | v9fs_fill_super(sb, v9ses, flags, data); |
146 | 145 | ||
147 | inode = v9fs_get_inode(sb, S_IFDIR | mode); | 146 | inode = v9fs_get_inode(sb, S_IFDIR | mode); |
148 | if (IS_ERR(inode)) { | 147 | if (IS_ERR(inode)) { |
@@ -150,9 +149,6 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, | |||
150 | goto release_sb; | 149 | goto release_sb; |
151 | } | 150 | } |
152 | 151 | ||
153 | inode->i_uid = uid; | ||
154 | inode->i_gid = gid; | ||
155 | |||
156 | root = d_alloc_root(inode); | 152 | root = d_alloc_root(inode); |
157 | if (!root) { | 153 | if (!root) { |
158 | iput(inode); | 154 | iput(inode); |
@@ -173,10 +169,8 @@ P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); | |||
173 | simple_set_mnt(mnt, sb); | 169 | simple_set_mnt(mnt, sb); |
174 | return 0; | 170 | return 0; |
175 | 171 | ||
176 | release_sb: | ||
177 | deactivate_locked_super(sb); | ||
178 | |||
179 | free_stat: | 172 | free_stat: |
173 | p9stat_free(st); | ||
180 | kfree(st); | 174 | kfree(st); |
181 | 175 | ||
182 | clunk_fid: | 176 | clunk_fid: |
@@ -185,7 +179,12 @@ clunk_fid: | |||
185 | close_session: | 179 | close_session: |
186 | v9fs_session_close(v9ses); | 180 | v9fs_session_close(v9ses); |
187 | kfree(v9ses); | 181 | kfree(v9ses); |
182 | return retval; | ||
188 | 183 | ||
184 | release_sb: | ||
185 | p9stat_free(st); | ||
186 | kfree(st); | ||
187 | deactivate_locked_super(sb); | ||
189 | return retval; | 188 | return retval; |
190 | } | 189 | } |
191 | 190 | ||
@@ -207,24 +206,10 @@ static void v9fs_kill_super(struct super_block *s) | |||
207 | 206 | ||
208 | v9fs_session_close(v9ses); | 207 | v9fs_session_close(v9ses); |
209 | kfree(v9ses); | 208 | kfree(v9ses); |
209 | s->s_fs_info = NULL; | ||
210 | P9_DPRINTK(P9_DEBUG_VFS, "exiting kill_super\n"); | 210 | P9_DPRINTK(P9_DEBUG_VFS, "exiting kill_super\n"); |
211 | } | 211 | } |
212 | 212 | ||
213 | /** | ||
214 | * v9fs_show_options - Show mount options in /proc/mounts | ||
215 | * @m: seq_file to write to | ||
216 | * @mnt: mount descriptor | ||
217 | * | ||
218 | */ | ||
219 | |||
220 | static int v9fs_show_options(struct seq_file *m, struct vfsmount *mnt) | ||
221 | { | ||
222 | struct v9fs_session_info *v9ses = mnt->mnt_sb->s_fs_info; | ||
223 | |||
224 | seq_printf(m, "%s", v9ses->options); | ||
225 | return 0; | ||
226 | } | ||
227 | |||
228 | static void | 213 | static void |
229 | v9fs_umount_begin(struct super_block *sb) | 214 | v9fs_umount_begin(struct super_block *sb) |
230 | { | 215 | { |
@@ -237,7 +222,7 @@ v9fs_umount_begin(struct super_block *sb) | |||
237 | static const struct super_operations v9fs_super_ops = { | 222 | static const struct super_operations v9fs_super_ops = { |
238 | .statfs = simple_statfs, | 223 | .statfs = simple_statfs, |
239 | .clear_inode = v9fs_clear_inode, | 224 | .clear_inode = v9fs_clear_inode, |
240 | .show_options = v9fs_show_options, | 225 | .show_options = generic_show_options, |
241 | .umount_begin = v9fs_umount_begin, | 226 | .umount_begin = v9fs_umount_begin, |
242 | }; | 227 | }; |
243 | 228 | ||
diff --git a/fs/afs/file.c b/fs/afs/file.c index 0149dab365e7..681c2a7b013f 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c | |||
@@ -134,9 +134,16 @@ static int afs_readpage(struct file *file, struct page *page) | |||
134 | 134 | ||
135 | inode = page->mapping->host; | 135 | inode = page->mapping->host; |
136 | 136 | ||
137 | ASSERT(file != NULL); | 137 | if (file) { |
138 | key = file->private_data; | 138 | key = file->private_data; |
139 | ASSERT(key != NULL); | 139 | ASSERT(key != NULL); |
140 | } else { | ||
141 | key = afs_request_key(AFS_FS_S(inode->i_sb)->volume->cell); | ||
142 | if (IS_ERR(key)) { | ||
143 | ret = PTR_ERR(key); | ||
144 | goto error_nokey; | ||
145 | } | ||
146 | } | ||
140 | 147 | ||
141 | _enter("{%x},{%lu},{%lu}", key_serial(key), inode->i_ino, page->index); | 148 | _enter("{%x},{%lu},{%lu}", key_serial(key), inode->i_ino, page->index); |
142 | 149 | ||
@@ -207,12 +214,17 @@ static int afs_readpage(struct file *file, struct page *page) | |||
207 | unlock_page(page); | 214 | unlock_page(page); |
208 | } | 215 | } |
209 | 216 | ||
217 | if (!file) | ||
218 | key_put(key); | ||
210 | _leave(" = 0"); | 219 | _leave(" = 0"); |
211 | return 0; | 220 | return 0; |
212 | 221 | ||
213 | error: | 222 | error: |
214 | SetPageError(page); | 223 | SetPageError(page); |
215 | unlock_page(page); | 224 | unlock_page(page); |
225 | if (!file) | ||
226 | key_put(key); | ||
227 | error_nokey: | ||
216 | _leave(" = %d", ret); | 228 | _leave(" = %d", ret); |
217 | return ret; | 229 | return ret; |
218 | } | 230 | } |
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index aa39ae83f019..3da18d453488 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -77,7 +77,7 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) | |||
77 | } | 77 | } |
78 | 78 | ||
79 | /* Update the expiry counter if fs is busy */ | 79 | /* Update the expiry counter if fs is busy */ |
80 | if (!may_umount_tree(mnt)) { | 80 | if (!may_umount_tree(path.mnt)) { |
81 | struct autofs_info *ino = autofs4_dentry_ino(top); | 81 | struct autofs_info *ino = autofs4_dentry_ino(top); |
82 | ino->last_used = jiffies; | 82 | ino->last_used = jiffies; |
83 | goto done; | 83 | goto done; |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 272b9b2bea86..59cba180fe83 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -3099,8 +3099,12 @@ static void inode_tree_add(struct inode *inode) | |||
3099 | { | 3099 | { |
3100 | struct btrfs_root *root = BTRFS_I(inode)->root; | 3100 | struct btrfs_root *root = BTRFS_I(inode)->root; |
3101 | struct btrfs_inode *entry; | 3101 | struct btrfs_inode *entry; |
3102 | struct rb_node **p = &root->inode_tree.rb_node; | 3102 | struct rb_node **p; |
3103 | struct rb_node *parent = NULL; | 3103 | struct rb_node *parent; |
3104 | |||
3105 | again: | ||
3106 | p = &root->inode_tree.rb_node; | ||
3107 | parent = NULL; | ||
3104 | 3108 | ||
3105 | spin_lock(&root->inode_lock); | 3109 | spin_lock(&root->inode_lock); |
3106 | while (*p) { | 3110 | while (*p) { |
@@ -3108,13 +3112,16 @@ static void inode_tree_add(struct inode *inode) | |||
3108 | entry = rb_entry(parent, struct btrfs_inode, rb_node); | 3112 | entry = rb_entry(parent, struct btrfs_inode, rb_node); |
3109 | 3113 | ||
3110 | if (inode->i_ino < entry->vfs_inode.i_ino) | 3114 | if (inode->i_ino < entry->vfs_inode.i_ino) |
3111 | p = &(*p)->rb_left; | 3115 | p = &parent->rb_left; |
3112 | else if (inode->i_ino > entry->vfs_inode.i_ino) | 3116 | else if (inode->i_ino > entry->vfs_inode.i_ino) |
3113 | p = &(*p)->rb_right; | 3117 | p = &parent->rb_right; |
3114 | else { | 3118 | else { |
3115 | WARN_ON(!(entry->vfs_inode.i_state & | 3119 | WARN_ON(!(entry->vfs_inode.i_state & |
3116 | (I_WILL_FREE | I_FREEING | I_CLEAR))); | 3120 | (I_WILL_FREE | I_FREEING | I_CLEAR))); |
3117 | break; | 3121 | rb_erase(parent, &root->inode_tree); |
3122 | RB_CLEAR_NODE(parent); | ||
3123 | spin_unlock(&root->inode_lock); | ||
3124 | goto again; | ||
3118 | } | 3125 | } |
3119 | } | 3126 | } |
3120 | rb_link_node(&BTRFS_I(inode)->rb_node, parent, p); | 3127 | rb_link_node(&BTRFS_I(inode)->rb_node, parent, p); |
@@ -3126,12 +3133,12 @@ static void inode_tree_del(struct inode *inode) | |||
3126 | { | 3133 | { |
3127 | struct btrfs_root *root = BTRFS_I(inode)->root; | 3134 | struct btrfs_root *root = BTRFS_I(inode)->root; |
3128 | 3135 | ||
3136 | spin_lock(&root->inode_lock); | ||
3129 | if (!RB_EMPTY_NODE(&BTRFS_I(inode)->rb_node)) { | 3137 | if (!RB_EMPTY_NODE(&BTRFS_I(inode)->rb_node)) { |
3130 | spin_lock(&root->inode_lock); | ||
3131 | rb_erase(&BTRFS_I(inode)->rb_node, &root->inode_tree); | 3138 | rb_erase(&BTRFS_I(inode)->rb_node, &root->inode_tree); |
3132 | spin_unlock(&root->inode_lock); | ||
3133 | RB_CLEAR_NODE(&BTRFS_I(inode)->rb_node); | 3139 | RB_CLEAR_NODE(&BTRFS_I(inode)->rb_node); |
3134 | } | 3140 | } |
3141 | spin_unlock(&root->inode_lock); | ||
3135 | } | 3142 | } |
3136 | 3143 | ||
3137 | static noinline void init_btrfs_i(struct inode *inode) | 3144 | static noinline void init_btrfs_i(struct inode *inode) |
diff --git a/fs/buffer.c b/fs/buffer.c index a3ef091a45bd..28f320fac4d4 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -1165,8 +1165,11 @@ void mark_buffer_dirty(struct buffer_head *bh) | |||
1165 | 1165 | ||
1166 | if (!test_set_buffer_dirty(bh)) { | 1166 | if (!test_set_buffer_dirty(bh)) { |
1167 | struct page *page = bh->b_page; | 1167 | struct page *page = bh->b_page; |
1168 | if (!TestSetPageDirty(page)) | 1168 | if (!TestSetPageDirty(page)) { |
1169 | __set_page_dirty(page, page_mapping(page), 0); | 1169 | struct address_space *mapping = page_mapping(page); |
1170 | if (mapping) | ||
1171 | __set_page_dirty(page, mapping, 0); | ||
1172 | } | ||
1170 | } | 1173 | } |
1171 | } | 1174 | } |
1172 | 1175 | ||
diff --git a/fs/compat.c b/fs/compat.c index 94502dab972a..6d6f98fe64a0 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1485,20 +1485,15 @@ int compat_do_execve(char * filename, | |||
1485 | if (!bprm) | 1485 | if (!bprm) |
1486 | goto out_files; | 1486 | goto out_files; |
1487 | 1487 | ||
1488 | retval = -ERESTARTNOINTR; | 1488 | retval = prepare_bprm_creds(bprm); |
1489 | if (mutex_lock_interruptible(¤t->cred_guard_mutex)) | 1489 | if (retval) |
1490 | goto out_free; | 1490 | goto out_free; |
1491 | current->in_execve = 1; | ||
1492 | |||
1493 | retval = -ENOMEM; | ||
1494 | bprm->cred = prepare_exec_creds(); | ||
1495 | if (!bprm->cred) | ||
1496 | goto out_unlock; | ||
1497 | 1491 | ||
1498 | retval = check_unsafe_exec(bprm); | 1492 | retval = check_unsafe_exec(bprm); |
1499 | if (retval < 0) | 1493 | if (retval < 0) |
1500 | goto out_unlock; | 1494 | goto out_free; |
1501 | clear_in_exec = retval; | 1495 | clear_in_exec = retval; |
1496 | current->in_execve = 1; | ||
1502 | 1497 | ||
1503 | file = open_exec(filename); | 1498 | file = open_exec(filename); |
1504 | retval = PTR_ERR(file); | 1499 | retval = PTR_ERR(file); |
@@ -1547,7 +1542,6 @@ int compat_do_execve(char * filename, | |||
1547 | /* execve succeeded */ | 1542 | /* execve succeeded */ |
1548 | current->fs->in_exec = 0; | 1543 | current->fs->in_exec = 0; |
1549 | current->in_execve = 0; | 1544 | current->in_execve = 0; |
1550 | mutex_unlock(¤t->cred_guard_mutex); | ||
1551 | acct_update_integrals(current); | 1545 | acct_update_integrals(current); |
1552 | free_bprm(bprm); | 1546 | free_bprm(bprm); |
1553 | if (displaced) | 1547 | if (displaced) |
@@ -1567,10 +1561,7 @@ out_file: | |||
1567 | out_unmark: | 1561 | out_unmark: |
1568 | if (clear_in_exec) | 1562 | if (clear_in_exec) |
1569 | current->fs->in_exec = 0; | 1563 | current->fs->in_exec = 0; |
1570 | |||
1571 | out_unlock: | ||
1572 | current->in_execve = 0; | 1564 | current->in_execve = 0; |
1573 | mutex_unlock(¤t->cred_guard_mutex); | ||
1574 | 1565 | ||
1575 | out_free: | 1566 | out_free: |
1576 | free_bprm(bprm); | 1567 | free_bprm(bprm); |
@@ -678,8 +678,8 @@ exit: | |||
678 | } | 678 | } |
679 | EXPORT_SYMBOL(open_exec); | 679 | EXPORT_SYMBOL(open_exec); |
680 | 680 | ||
681 | int kernel_read(struct file *file, unsigned long offset, | 681 | int kernel_read(struct file *file, loff_t offset, |
682 | char *addr, unsigned long count) | 682 | char *addr, unsigned long count) |
683 | { | 683 | { |
684 | mm_segment_t old_fs; | 684 | mm_segment_t old_fs; |
685 | loff_t pos = offset; | 685 | loff_t pos = offset; |
@@ -1016,6 +1016,35 @@ out: | |||
1016 | EXPORT_SYMBOL(flush_old_exec); | 1016 | EXPORT_SYMBOL(flush_old_exec); |
1017 | 1017 | ||
1018 | /* | 1018 | /* |
1019 | * Prepare credentials and lock ->cred_guard_mutex. | ||
1020 | * install_exec_creds() commits the new creds and drops the lock. | ||
1021 | * Or, if exec fails before, free_bprm() should release ->cred and | ||
1022 | * and unlock. | ||
1023 | */ | ||
1024 | int prepare_bprm_creds(struct linux_binprm *bprm) | ||
1025 | { | ||
1026 | if (mutex_lock_interruptible(¤t->cred_guard_mutex)) | ||
1027 | return -ERESTARTNOINTR; | ||
1028 | |||
1029 | bprm->cred = prepare_exec_creds(); | ||
1030 | if (likely(bprm->cred)) | ||
1031 | return 0; | ||
1032 | |||
1033 | mutex_unlock(¤t->cred_guard_mutex); | ||
1034 | return -ENOMEM; | ||
1035 | } | ||
1036 | |||
1037 | void free_bprm(struct linux_binprm *bprm) | ||
1038 | { | ||
1039 | free_arg_pages(bprm); | ||
1040 | if (bprm->cred) { | ||
1041 | mutex_unlock(¤t->cred_guard_mutex); | ||
1042 | abort_creds(bprm->cred); | ||
1043 | } | ||
1044 | kfree(bprm); | ||
1045 | } | ||
1046 | |||
1047 | /* | ||
1019 | * install the new credentials for this executable | 1048 | * install the new credentials for this executable |
1020 | */ | 1049 | */ |
1021 | void install_exec_creds(struct linux_binprm *bprm) | 1050 | void install_exec_creds(struct linux_binprm *bprm) |
@@ -1024,12 +1053,13 @@ void install_exec_creds(struct linux_binprm *bprm) | |||
1024 | 1053 | ||
1025 | commit_creds(bprm->cred); | 1054 | commit_creds(bprm->cred); |
1026 | bprm->cred = NULL; | 1055 | bprm->cred = NULL; |
1027 | 1056 | /* | |
1028 | /* cred_guard_mutex must be held at least to this point to prevent | 1057 | * cred_guard_mutex must be held at least to this point to prevent |
1029 | * ptrace_attach() from altering our determination of the task's | 1058 | * ptrace_attach() from altering our determination of the task's |
1030 | * credentials; any time after this it may be unlocked */ | 1059 | * credentials; any time after this it may be unlocked. |
1031 | 1060 | */ | |
1032 | security_bprm_committed_creds(bprm); | 1061 | security_bprm_committed_creds(bprm); |
1062 | mutex_unlock(¤t->cred_guard_mutex); | ||
1033 | } | 1063 | } |
1034 | EXPORT_SYMBOL(install_exec_creds); | 1064 | EXPORT_SYMBOL(install_exec_creds); |
1035 | 1065 | ||
@@ -1246,14 +1276,6 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1246 | 1276 | ||
1247 | EXPORT_SYMBOL(search_binary_handler); | 1277 | EXPORT_SYMBOL(search_binary_handler); |
1248 | 1278 | ||
1249 | void free_bprm(struct linux_binprm *bprm) | ||
1250 | { | ||
1251 | free_arg_pages(bprm); | ||
1252 | if (bprm->cred) | ||
1253 | abort_creds(bprm->cred); | ||
1254 | kfree(bprm); | ||
1255 | } | ||
1256 | |||
1257 | /* | 1279 | /* |
1258 | * sys_execve() executes a new program. | 1280 | * sys_execve() executes a new program. |
1259 | */ | 1281 | */ |
@@ -1277,20 +1299,15 @@ int do_execve(char * filename, | |||
1277 | if (!bprm) | 1299 | if (!bprm) |
1278 | goto out_files; | 1300 | goto out_files; |
1279 | 1301 | ||
1280 | retval = -ERESTARTNOINTR; | 1302 | retval = prepare_bprm_creds(bprm); |
1281 | if (mutex_lock_interruptible(¤t->cred_guard_mutex)) | 1303 | if (retval) |
1282 | goto out_free; | 1304 | goto out_free; |
1283 | current->in_execve = 1; | ||
1284 | |||
1285 | retval = -ENOMEM; | ||
1286 | bprm->cred = prepare_exec_creds(); | ||
1287 | if (!bprm->cred) | ||
1288 | goto out_unlock; | ||
1289 | 1305 | ||
1290 | retval = check_unsafe_exec(bprm); | 1306 | retval = check_unsafe_exec(bprm); |
1291 | if (retval < 0) | 1307 | if (retval < 0) |
1292 | goto out_unlock; | 1308 | goto out_free; |
1293 | clear_in_exec = retval; | 1309 | clear_in_exec = retval; |
1310 | current->in_execve = 1; | ||
1294 | 1311 | ||
1295 | file = open_exec(filename); | 1312 | file = open_exec(filename); |
1296 | retval = PTR_ERR(file); | 1313 | retval = PTR_ERR(file); |
@@ -1340,7 +1357,6 @@ int do_execve(char * filename, | |||
1340 | /* execve succeeded */ | 1357 | /* execve succeeded */ |
1341 | current->fs->in_exec = 0; | 1358 | current->fs->in_exec = 0; |
1342 | current->in_execve = 0; | 1359 | current->in_execve = 0; |
1343 | mutex_unlock(¤t->cred_guard_mutex); | ||
1344 | acct_update_integrals(current); | 1360 | acct_update_integrals(current); |
1345 | free_bprm(bprm); | 1361 | free_bprm(bprm); |
1346 | if (displaced) | 1362 | if (displaced) |
@@ -1360,10 +1376,7 @@ out_file: | |||
1360 | out_unmark: | 1376 | out_unmark: |
1361 | if (clear_in_exec) | 1377 | if (clear_in_exec) |
1362 | current->fs->in_exec = 0; | 1378 | current->fs->in_exec = 0; |
1363 | |||
1364 | out_unlock: | ||
1365 | current->in_execve = 0; | 1379 | current->in_execve = 0; |
1366 | mutex_unlock(¤t->cred_guard_mutex); | ||
1367 | 1380 | ||
1368 | out_free: | 1381 | out_free: |
1369 | free_bprm(bprm); | 1382 | free_bprm(bprm); |
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index e1dedb0f7873..78d9b925fc94 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
@@ -362,6 +362,10 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, | |||
362 | if (dir_de) { | 362 | if (dir_de) { |
363 | if (old_dir != new_dir) | 363 | if (old_dir != new_dir) |
364 | ext2_set_link(old_inode, dir_de, dir_page, new_dir, 0); | 364 | ext2_set_link(old_inode, dir_de, dir_page, new_dir, 0); |
365 | else { | ||
366 | kunmap(dir_page); | ||
367 | page_cache_release(dir_page); | ||
368 | } | ||
365 | inode_dec_link_count(old_dir); | 369 | inode_dec_link_count(old_dir); |
366 | } | 370 | } |
367 | return 0; | 371 | return 0; |
diff --git a/fs/ext3/Kconfig b/fs/ext3/Kconfig index fb3c1a21b135..522b15498f45 100644 --- a/fs/ext3/Kconfig +++ b/fs/ext3/Kconfig | |||
@@ -29,23 +29,25 @@ config EXT3_FS | |||
29 | module will be called ext3. | 29 | module will be called ext3. |
30 | 30 | ||
31 | config EXT3_DEFAULTS_TO_ORDERED | 31 | config EXT3_DEFAULTS_TO_ORDERED |
32 | bool "Default to 'data=ordered' in ext3 (legacy option)" | 32 | bool "Default to 'data=ordered' in ext3" |
33 | depends on EXT3_FS | 33 | depends on EXT3_FS |
34 | help | 34 | help |
35 | If a filesystem does not explicitly specify a data ordering | 35 | The journal mode options for ext3 have different tradeoffs |
36 | mode, and the journal capability allowed it, ext3 used to | 36 | between when data is guaranteed to be on disk and |
37 | historically default to 'data=ordered'. | 37 | performance. The use of "data=writeback" can cause |
38 | 38 | unwritten data to appear in files after an system crash or | |
39 | That was a rather unfortunate choice, because it leads to all | 39 | power failure, which can be a security issue. However, |
40 | kinds of latency problems, and the 'data=writeback' mode is more | 40 | "data=ordered" mode can also result in major performance |
41 | appropriate these days. | 41 | problems, including seconds-long delays before an fsync() |
42 | 42 | call returns. For details, see: | |
43 | You should probably always answer 'n' here, and if you really | 43 | |
44 | want to use 'data=ordered' mode, set it in the filesystem itself | 44 | http://ext4.wiki.kernel.org/index.php/Ext3_data_mode_tradeoffs |
45 | with 'tune2fs -o journal_data_ordered'. | 45 | |
46 | 46 | If you have been historically happy with ext3's performance, | |
47 | But if you really want to enable the legacy default, you can do | 47 | data=ordered mode will be a safe choice and you should |
48 | so by answering 'y' to this question. | 48 | answer 'y' here. If you understand the reliability and data |
49 | privacy issues of data=writeback and are willing to make | ||
50 | that trade off, answer 'n'. | ||
49 | 51 | ||
50 | config EXT3_FS_XATTR | 52 | config EXT3_FS_XATTR |
51 | bool "Ext3 extended attributes" | 53 | bool "Ext3 extended attributes" |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 524b349c6299..a8d80a7f1105 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -543,6 +543,19 @@ static inline void ext3_show_quota_options(struct seq_file *seq, struct super_bl | |||
543 | #endif | 543 | #endif |
544 | } | 544 | } |
545 | 545 | ||
546 | static char *data_mode_string(unsigned long mode) | ||
547 | { | ||
548 | switch (mode) { | ||
549 | case EXT3_MOUNT_JOURNAL_DATA: | ||
550 | return "journal"; | ||
551 | case EXT3_MOUNT_ORDERED_DATA: | ||
552 | return "ordered"; | ||
553 | case EXT3_MOUNT_WRITEBACK_DATA: | ||
554 | return "writeback"; | ||
555 | } | ||
556 | return "unknown"; | ||
557 | } | ||
558 | |||
546 | /* | 559 | /* |
547 | * Show an option if | 560 | * Show an option if |
548 | * - it's set to a non-default value OR | 561 | * - it's set to a non-default value OR |
@@ -616,13 +629,8 @@ static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
616 | if (test_opt(sb, NOBH)) | 629 | if (test_opt(sb, NOBH)) |
617 | seq_puts(seq, ",nobh"); | 630 | seq_puts(seq, ",nobh"); |
618 | 631 | ||
619 | if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) | 632 | seq_printf(seq, ",data=%s", data_mode_string(sbi->s_mount_opt & |
620 | seq_puts(seq, ",data=journal"); | 633 | EXT3_MOUNT_DATA_FLAGS)); |
621 | else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA) | ||
622 | seq_puts(seq, ",data=ordered"); | ||
623 | else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) | ||
624 | seq_puts(seq, ",data=writeback"); | ||
625 | |||
626 | if (test_opt(sb, DATA_ERR_ABORT)) | 634 | if (test_opt(sb, DATA_ERR_ABORT)) |
627 | seq_puts(seq, ",data_err=abort"); | 635 | seq_puts(seq, ",data_err=abort"); |
628 | 636 | ||
@@ -1024,12 +1032,18 @@ static int parse_options (char *options, struct super_block *sb, | |||
1024 | datacheck: | 1032 | datacheck: |
1025 | if (is_remount) { | 1033 | if (is_remount) { |
1026 | if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS) | 1034 | if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS) |
1027 | != data_opt) { | 1035 | == data_opt) |
1028 | printk(KERN_ERR | 1036 | break; |
1029 | "EXT3-fs: cannot change data " | 1037 | printk(KERN_ERR |
1030 | "mode on remount\n"); | 1038 | "EXT3-fs (device %s): Cannot change " |
1031 | return 0; | 1039 | "data mode on remount. The filesystem " |
1032 | } | 1040 | "is mounted in data=%s mode and you " |
1041 | "try to remount it in data=%s mode.\n", | ||
1042 | sb->s_id, | ||
1043 | data_mode_string(sbi->s_mount_opt & | ||
1044 | EXT3_MOUNT_DATA_FLAGS), | ||
1045 | data_mode_string(data_opt)); | ||
1046 | return 0; | ||
1033 | } else { | 1047 | } else { |
1034 | sbi->s_mount_opt &= ~EXT3_MOUNT_DATA_FLAGS; | 1048 | sbi->s_mount_opt &= ~EXT3_MOUNT_DATA_FLAGS; |
1035 | sbi->s_mount_opt |= data_opt; | 1049 | sbi->s_mount_opt |= data_opt; |
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 23419dc3027b..a7cbfbd340c7 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -386,16 +386,16 @@ static ssize_t jid_show(struct gfs2_sbd *sdp, char *buf) | |||
386 | #define GDLM_ATTR(_name,_mode,_show,_store) \ | 386 | #define GDLM_ATTR(_name,_mode,_show,_store) \ |
387 | static struct gfs2_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store) | 387 | static struct gfs2_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store) |
388 | 388 | ||
389 | GDLM_ATTR(proto_name, 0444, proto_name_show, NULL); | 389 | GDLM_ATTR(proto_name, 0444, proto_name_show, NULL); |
390 | GDLM_ATTR(block, 0644, block_show, block_store); | 390 | GDLM_ATTR(block, 0644, block_show, block_store); |
391 | GDLM_ATTR(withdraw, 0644, withdraw_show, withdraw_store); | 391 | GDLM_ATTR(withdraw, 0644, withdraw_show, withdraw_store); |
392 | GDLM_ATTR(id, 0444, lkid_show, NULL); | 392 | GDLM_ATTR(id, 0444, lkid_show, NULL); |
393 | GDLM_ATTR(jid, 0444, jid_show, NULL); | 393 | GDLM_ATTR(jid, 0444, jid_show, NULL); |
394 | GDLM_ATTR(first, 0444, lkfirst_show, NULL); | 394 | GDLM_ATTR(first, 0444, lkfirst_show, NULL); |
395 | GDLM_ATTR(first_done, 0444, first_done_show, NULL); | 395 | GDLM_ATTR(first_done, 0444, first_done_show, NULL); |
396 | GDLM_ATTR(recover, 0200, NULL, recover_store); | 396 | GDLM_ATTR(recover, 0600, NULL, recover_store); |
397 | GDLM_ATTR(recover_done, 0444, recover_done_show, NULL); | 397 | GDLM_ATTR(recover_done, 0444, recover_done_show, NULL); |
398 | GDLM_ATTR(recover_status, 0444, recover_status_show, NULL); | 398 | GDLM_ATTR(recover_status, 0444, recover_status_show, NULL); |
399 | 399 | ||
400 | static struct attribute *lock_module_attrs[] = { | 400 | static struct attribute *lock_module_attrs[] = { |
401 | &gdlm_attr_proto_name.attr, | 401 | &gdlm_attr_proto_name.attr, |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 941c8425c10b..cb88dac8ccaa 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -935,26 +935,28 @@ static int can_do_hugetlb_shm(void) | |||
935 | return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group); | 935 | return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group); |
936 | } | 936 | } |
937 | 937 | ||
938 | struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag) | 938 | struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag, |
939 | struct user_struct **user) | ||
939 | { | 940 | { |
940 | int error = -ENOMEM; | 941 | int error = -ENOMEM; |
941 | int unlock_shm = 0; | ||
942 | struct file *file; | 942 | struct file *file; |
943 | struct inode *inode; | 943 | struct inode *inode; |
944 | struct dentry *dentry, *root; | 944 | struct dentry *dentry, *root; |
945 | struct qstr quick_string; | 945 | struct qstr quick_string; |
946 | struct user_struct *user = current_user(); | ||
947 | 946 | ||
947 | *user = NULL; | ||
948 | if (!hugetlbfs_vfsmount) | 948 | if (!hugetlbfs_vfsmount) |
949 | return ERR_PTR(-ENOENT); | 949 | return ERR_PTR(-ENOENT); |
950 | 950 | ||
951 | if (!can_do_hugetlb_shm()) { | 951 | if (!can_do_hugetlb_shm()) { |
952 | if (user_shm_lock(size, user)) { | 952 | *user = current_user(); |
953 | unlock_shm = 1; | 953 | if (user_shm_lock(size, *user)) { |
954 | WARN_ONCE(1, | 954 | WARN_ONCE(1, |
955 | "Using mlock ulimits for SHM_HUGETLB deprecated\n"); | 955 | "Using mlock ulimits for SHM_HUGETLB deprecated\n"); |
956 | } else | 956 | } else { |
957 | *user = NULL; | ||
957 | return ERR_PTR(-EPERM); | 958 | return ERR_PTR(-EPERM); |
959 | } | ||
958 | } | 960 | } |
959 | 961 | ||
960 | root = hugetlbfs_vfsmount->mnt_root; | 962 | root = hugetlbfs_vfsmount->mnt_root; |
@@ -996,8 +998,10 @@ out_inode: | |||
996 | out_dentry: | 998 | out_dentry: |
997 | dput(dentry); | 999 | dput(dentry); |
998 | out_shm_unlock: | 1000 | out_shm_unlock: |
999 | if (unlock_shm) | 1001 | if (*user) { |
1000 | user_shm_unlock(size, user); | 1002 | user_shm_unlock(size, *user); |
1003 | *user = NULL; | ||
1004 | } | ||
1001 | return ERR_PTR(error); | 1005 | return ERR_PTR(error); |
1002 | } | 1006 | } |
1003 | 1007 | ||
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c index d9a721e6db70..5ef7bac265e5 100644 --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c | |||
@@ -1268,10 +1268,20 @@ int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c) { | |||
1268 | if (!c->wbuf) | 1268 | if (!c->wbuf) |
1269 | return -ENOMEM; | 1269 | return -ENOMEM; |
1270 | 1270 | ||
1271 | #ifdef CONFIG_JFFS2_FS_WBUF_VERIFY | ||
1272 | c->wbuf_verify = kmalloc(c->wbuf_pagesize, GFP_KERNEL); | ||
1273 | if (!c->wbuf_verify) { | ||
1274 | kfree(c->wbuf); | ||
1275 | return -ENOMEM; | ||
1276 | } | ||
1277 | #endif | ||
1271 | return 0; | 1278 | return 0; |
1272 | } | 1279 | } |
1273 | 1280 | ||
1274 | void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) { | 1281 | void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) { |
1282 | #ifdef CONFIG_JFFS2_FS_WBUF_VERIFY | ||
1283 | kfree(c->wbuf_verify); | ||
1284 | #endif | ||
1275 | kfree(c->wbuf); | 1285 | kfree(c->wbuf); |
1276 | } | 1286 | } |
1277 | 1287 | ||
diff --git a/fs/libfs.c b/fs/libfs.c index ddfa89948c3f..dcec3d3ea64f 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -217,7 +217,7 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name, | |||
217 | return PTR_ERR(s); | 217 | return PTR_ERR(s); |
218 | 218 | ||
219 | s->s_flags = MS_NOUSER; | 219 | s->s_flags = MS_NOUSER; |
220 | s->s_maxbytes = ~0ULL; | 220 | s->s_maxbytes = MAX_LFS_FILESIZE; |
221 | s->s_blocksize = PAGE_SIZE; | 221 | s->s_blocksize = PAGE_SIZE; |
222 | s->s_blocksize_bits = PAGE_SHIFT; | 222 | s->s_blocksize_bits = PAGE_SHIFT; |
223 | s->s_magic = magic; | 223 | s->s_magic = magic; |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 489fc01a3204..e4e089a8f294 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -255,7 +255,7 @@ static void nfs_direct_read_release(void *calldata) | |||
255 | 255 | ||
256 | if (put_dreq(dreq)) | 256 | if (put_dreq(dreq)) |
257 | nfs_direct_complete(dreq); | 257 | nfs_direct_complete(dreq); |
258 | nfs_readdata_release(calldata); | 258 | nfs_readdata_free(data); |
259 | } | 259 | } |
260 | 260 | ||
261 | static const struct rpc_call_ops nfs_read_direct_ops = { | 261 | static const struct rpc_call_ops nfs_read_direct_ops = { |
@@ -314,14 +314,14 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq, | |||
314 | data->npages, 1, 0, data->pagevec, NULL); | 314 | data->npages, 1, 0, data->pagevec, NULL); |
315 | up_read(¤t->mm->mmap_sem); | 315 | up_read(¤t->mm->mmap_sem); |
316 | if (result < 0) { | 316 | if (result < 0) { |
317 | nfs_readdata_release(data); | 317 | nfs_readdata_free(data); |
318 | break; | 318 | break; |
319 | } | 319 | } |
320 | if ((unsigned)result < data->npages) { | 320 | if ((unsigned)result < data->npages) { |
321 | bytes = result * PAGE_SIZE; | 321 | bytes = result * PAGE_SIZE; |
322 | if (bytes <= pgbase) { | 322 | if (bytes <= pgbase) { |
323 | nfs_direct_release_pages(data->pagevec, result); | 323 | nfs_direct_release_pages(data->pagevec, result); |
324 | nfs_readdata_release(data); | 324 | nfs_readdata_free(data); |
325 | break; | 325 | break; |
326 | } | 326 | } |
327 | bytes -= pgbase; | 327 | bytes -= pgbase; |
@@ -334,7 +334,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq, | |||
334 | data->inode = inode; | 334 | data->inode = inode; |
335 | data->cred = msg.rpc_cred; | 335 | data->cred = msg.rpc_cred; |
336 | data->args.fh = NFS_FH(inode); | 336 | data->args.fh = NFS_FH(inode); |
337 | data->args.context = get_nfs_open_context(ctx); | 337 | data->args.context = ctx; |
338 | data->args.offset = pos; | 338 | data->args.offset = pos; |
339 | data->args.pgbase = pgbase; | 339 | data->args.pgbase = pgbase; |
340 | data->args.pages = data->pagevec; | 340 | data->args.pages = data->pagevec; |
@@ -441,7 +441,7 @@ static void nfs_direct_free_writedata(struct nfs_direct_req *dreq) | |||
441 | struct nfs_write_data *data = list_entry(dreq->rewrite_list.next, struct nfs_write_data, pages); | 441 | struct nfs_write_data *data = list_entry(dreq->rewrite_list.next, struct nfs_write_data, pages); |
442 | list_del(&data->pages); | 442 | list_del(&data->pages); |
443 | nfs_direct_release_pages(data->pagevec, data->npages); | 443 | nfs_direct_release_pages(data->pagevec, data->npages); |
444 | nfs_writedata_release(data); | 444 | nfs_writedata_free(data); |
445 | } | 445 | } |
446 | } | 446 | } |
447 | 447 | ||
@@ -534,7 +534,7 @@ static void nfs_direct_commit_release(void *calldata) | |||
534 | 534 | ||
535 | dprintk("NFS: %5u commit returned %d\n", data->task.tk_pid, status); | 535 | dprintk("NFS: %5u commit returned %d\n", data->task.tk_pid, status); |
536 | nfs_direct_write_complete(dreq, data->inode); | 536 | nfs_direct_write_complete(dreq, data->inode); |
537 | nfs_commitdata_release(calldata); | 537 | nfs_commit_free(data); |
538 | } | 538 | } |
539 | 539 | ||
540 | static const struct rpc_call_ops nfs_commit_direct_ops = { | 540 | static const struct rpc_call_ops nfs_commit_direct_ops = { |
@@ -570,7 +570,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) | |||
570 | data->args.fh = NFS_FH(data->inode); | 570 | data->args.fh = NFS_FH(data->inode); |
571 | data->args.offset = 0; | 571 | data->args.offset = 0; |
572 | data->args.count = 0; | 572 | data->args.count = 0; |
573 | data->args.context = get_nfs_open_context(dreq->ctx); | 573 | data->args.context = dreq->ctx; |
574 | data->res.count = 0; | 574 | data->res.count = 0; |
575 | data->res.fattr = &data->fattr; | 575 | data->res.fattr = &data->fattr; |
576 | data->res.verf = &data->verf; | 576 | data->res.verf = &data->verf; |
@@ -734,14 +734,14 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq, | |||
734 | data->npages, 0, 0, data->pagevec, NULL); | 734 | data->npages, 0, 0, data->pagevec, NULL); |
735 | up_read(¤t->mm->mmap_sem); | 735 | up_read(¤t->mm->mmap_sem); |
736 | if (result < 0) { | 736 | if (result < 0) { |
737 | nfs_writedata_release(data); | 737 | nfs_writedata_free(data); |
738 | break; | 738 | break; |
739 | } | 739 | } |
740 | if ((unsigned)result < data->npages) { | 740 | if ((unsigned)result < data->npages) { |
741 | bytes = result * PAGE_SIZE; | 741 | bytes = result * PAGE_SIZE; |
742 | if (bytes <= pgbase) { | 742 | if (bytes <= pgbase) { |
743 | nfs_direct_release_pages(data->pagevec, result); | 743 | nfs_direct_release_pages(data->pagevec, result); |
744 | nfs_writedata_release(data); | 744 | nfs_writedata_free(data); |
745 | break; | 745 | break; |
746 | } | 746 | } |
747 | bytes -= pgbase; | 747 | bytes -= pgbase; |
@@ -756,7 +756,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq, | |||
756 | data->inode = inode; | 756 | data->inode = inode; |
757 | data->cred = msg.rpc_cred; | 757 | data->cred = msg.rpc_cred; |
758 | data->args.fh = NFS_FH(inode); | 758 | data->args.fh = NFS_FH(inode); |
759 | data->args.context = get_nfs_open_context(ctx); | 759 | data->args.context = ctx; |
760 | data->args.offset = pos; | 760 | data->args.offset = pos; |
761 | data->args.pgbase = pgbase; | 761 | data->args.pgbase = pgbase; |
762 | data->args.pages = data->pagevec; | 762 | data->args.pages = data->pagevec; |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 65ca8c18476f..1434080aefeb 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1250,8 +1250,8 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
1250 | continue; | 1250 | continue; |
1251 | } | 1251 | } |
1252 | /* Initialize or reset the session */ | 1252 | /* Initialize or reset the session */ |
1253 | if (nfs4_has_session(clp) && | 1253 | if (test_and_clear_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state) |
1254 | test_and_clear_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state)) { | 1254 | && nfs4_has_session(clp)) { |
1255 | if (clp->cl_cons_state == NFS_CS_SESSION_INITING) | 1255 | if (clp->cl_cons_state == NFS_CS_SESSION_INITING) |
1256 | status = nfs4_initialize_session(clp); | 1256 | status = nfs4_initialize_session(clp); |
1257 | else | 1257 | else |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 73ea5e8d66ce..12c9e66d3f1d 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -60,17 +60,15 @@ struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount) | |||
60 | return p; | 60 | return p; |
61 | } | 61 | } |
62 | 62 | ||
63 | static void nfs_readdata_free(struct nfs_read_data *p) | 63 | void nfs_readdata_free(struct nfs_read_data *p) |
64 | { | 64 | { |
65 | if (p && (p->pagevec != &p->page_array[0])) | 65 | if (p && (p->pagevec != &p->page_array[0])) |
66 | kfree(p->pagevec); | 66 | kfree(p->pagevec); |
67 | mempool_free(p, nfs_rdata_mempool); | 67 | mempool_free(p, nfs_rdata_mempool); |
68 | } | 68 | } |
69 | 69 | ||
70 | void nfs_readdata_release(void *data) | 70 | static void nfs_readdata_release(struct nfs_read_data *rdata) |
71 | { | 71 | { |
72 | struct nfs_read_data *rdata = data; | ||
73 | |||
74 | put_nfs_open_context(rdata->args.context); | 72 | put_nfs_open_context(rdata->args.context); |
75 | nfs_readdata_free(rdata); | 73 | nfs_readdata_free(rdata); |
76 | } | 74 | } |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 0a0a2ff767c3..a34fae21fe10 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -87,17 +87,15 @@ struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount) | |||
87 | return p; | 87 | return p; |
88 | } | 88 | } |
89 | 89 | ||
90 | static void nfs_writedata_free(struct nfs_write_data *p) | 90 | void nfs_writedata_free(struct nfs_write_data *p) |
91 | { | 91 | { |
92 | if (p && (p->pagevec != &p->page_array[0])) | 92 | if (p && (p->pagevec != &p->page_array[0])) |
93 | kfree(p->pagevec); | 93 | kfree(p->pagevec); |
94 | mempool_free(p, nfs_wdata_mempool); | 94 | mempool_free(p, nfs_wdata_mempool); |
95 | } | 95 | } |
96 | 96 | ||
97 | void nfs_writedata_release(void *data) | 97 | static void nfs_writedata_release(struct nfs_write_data *wdata) |
98 | { | 98 | { |
99 | struct nfs_write_data *wdata = data; | ||
100 | |||
101 | put_nfs_open_context(wdata->args.context); | 99 | put_nfs_open_context(wdata->args.context); |
102 | nfs_writedata_free(wdata); | 100 | nfs_writedata_free(wdata); |
103 | } | 101 | } |
diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c index 7e0b61be212e..c668bca579c1 100644 --- a/fs/nilfs2/btnode.c +++ b/fs/nilfs2/btnode.c | |||
@@ -209,6 +209,7 @@ int nilfs_btnode_prepare_change_key(struct address_space *btnc, | |||
209 | * We cannot call radix_tree_preload for the kernels older | 209 | * We cannot call radix_tree_preload for the kernels older |
210 | * than 2.6.23, because it is not exported for modules. | 210 | * than 2.6.23, because it is not exported for modules. |
211 | */ | 211 | */ |
212 | retry: | ||
212 | err = radix_tree_preload(GFP_NOFS & ~__GFP_HIGHMEM); | 213 | err = radix_tree_preload(GFP_NOFS & ~__GFP_HIGHMEM); |
213 | if (err) | 214 | if (err) |
214 | goto failed_unlock; | 215 | goto failed_unlock; |
@@ -219,7 +220,6 @@ int nilfs_btnode_prepare_change_key(struct address_space *btnc, | |||
219 | (unsigned long long)oldkey, | 220 | (unsigned long long)oldkey, |
220 | (unsigned long long)newkey); | 221 | (unsigned long long)newkey); |
221 | 222 | ||
222 | retry: | ||
223 | spin_lock_irq(&btnc->tree_lock); | 223 | spin_lock_irq(&btnc->tree_lock); |
224 | err = radix_tree_insert(&btnc->page_tree, newkey, obh->b_page); | 224 | err = radix_tree_insert(&btnc->page_tree, newkey, obh->b_page); |
225 | spin_unlock_irq(&btnc->tree_lock); | 225 | spin_unlock_irq(&btnc->tree_lock); |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 8e2ec43b18f4..151964f0de4c 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -416,8 +416,10 @@ int nilfs_attach_checkpoint(struct nilfs_sb_info *sbi, __u64 cno) | |||
416 | if (unlikely(err)) | 416 | if (unlikely(err)) |
417 | goto failed; | 417 | goto failed; |
418 | 418 | ||
419 | down_read(&nilfs->ns_segctor_sem); | ||
419 | err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp, | 420 | err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp, |
420 | &bh_cp); | 421 | &bh_cp); |
422 | up_read(&nilfs->ns_segctor_sem); | ||
421 | if (unlikely(err)) { | 423 | if (unlikely(err)) { |
422 | if (err == -ENOENT || err == -EINVAL) { | 424 | if (err == -ENOENT || err == -EINVAL) { |
423 | printk(KERN_ERR | 425 | printk(KERN_ERR |
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h index e8adbffc626f..1b9caafb8662 100644 --- a/fs/nilfs2/the_nilfs.h +++ b/fs/nilfs2/the_nilfs.h | |||
@@ -253,7 +253,7 @@ nilfs_detach_writer(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi) | |||
253 | 253 | ||
254 | static inline void nilfs_put_sbinfo(struct nilfs_sb_info *sbi) | 254 | static inline void nilfs_put_sbinfo(struct nilfs_sb_info *sbi) |
255 | { | 255 | { |
256 | if (!atomic_dec_and_test(&sbi->s_count)) | 256 | if (atomic_dec_and_test(&sbi->s_count)) |
257 | kfree(sbi); | 257 | kfree(sbi); |
258 | } | 258 | } |
259 | 259 | ||
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c index 47cd258fd24d..c9ee67b442e1 100644 --- a/fs/notify/inotify/inotify_fsnotify.c +++ b/fs/notify/inotify/inotify_fsnotify.c | |||
@@ -62,13 +62,14 @@ static int inotify_handle_event(struct fsnotify_group *group, struct fsnotify_ev | |||
62 | event_priv->wd = wd; | 62 | event_priv->wd = wd; |
63 | 63 | ||
64 | ret = fsnotify_add_notify_event(group, event, fsn_event_priv); | 64 | ret = fsnotify_add_notify_event(group, event, fsn_event_priv); |
65 | /* EEXIST is not an error */ | 65 | if (ret) { |
66 | if (ret == -EEXIST) | ||
67 | ret = 0; | ||
68 | |||
69 | /* did event_priv get attached? */ | ||
70 | if (list_empty(&fsn_event_priv->event_list)) | ||
71 | inotify_free_event_priv(fsn_event_priv); | 66 | inotify_free_event_priv(fsn_event_priv); |
67 | /* EEXIST says we tail matched, EOVERFLOW isn't something | ||
68 | * to report up the stack. */ | ||
69 | if ((ret == -EEXIST) || | ||
70 | (ret == -EOVERFLOW)) | ||
71 | ret = 0; | ||
72 | } | ||
72 | 73 | ||
73 | /* | 74 | /* |
74 | * If we hold the entry until after the event is on the queue | 75 | * If we hold the entry until after the event is on the queue |
@@ -104,16 +105,45 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode | |||
104 | return send; | 105 | return send; |
105 | } | 106 | } |
106 | 107 | ||
108 | /* | ||
109 | * This is NEVER supposed to be called. Inotify marks should either have been | ||
110 | * removed from the idr when the watch was removed or in the | ||
111 | * fsnotify_destroy_mark_by_group() call when the inotify instance was being | ||
112 | * torn down. This is only called if the idr is about to be freed but there | ||
113 | * are still marks in it. | ||
114 | */ | ||
107 | static int idr_callback(int id, void *p, void *data) | 115 | static int idr_callback(int id, void *p, void *data) |
108 | { | 116 | { |
109 | BUG(); | 117 | struct fsnotify_mark_entry *entry; |
118 | struct inotify_inode_mark_entry *ientry; | ||
119 | static bool warned = false; | ||
120 | |||
121 | if (warned) | ||
122 | return 0; | ||
123 | |||
124 | warned = false; | ||
125 | entry = p; | ||
126 | ientry = container_of(entry, struct inotify_inode_mark_entry, fsn_entry); | ||
127 | |||
128 | WARN(1, "inotify closing but id=%d for entry=%p in group=%p still in " | ||
129 | "idr. Probably leaking memory\n", id, p, data); | ||
130 | |||
131 | /* | ||
132 | * I'm taking the liberty of assuming that the mark in question is a | ||
133 | * valid address and I'm dereferencing it. This might help to figure | ||
134 | * out why we got here and the panic is no worse than the original | ||
135 | * BUG() that was here. | ||
136 | */ | ||
137 | if (entry) | ||
138 | printk(KERN_WARNING "entry->group=%p inode=%p wd=%d\n", | ||
139 | entry->group, entry->inode, ientry->wd); | ||
110 | return 0; | 140 | return 0; |
111 | } | 141 | } |
112 | 142 | ||
113 | static void inotify_free_group_priv(struct fsnotify_group *group) | 143 | static void inotify_free_group_priv(struct fsnotify_group *group) |
114 | { | 144 | { |
115 | /* ideally the idr is empty and we won't hit the BUG in teh callback */ | 145 | /* ideally the idr is empty and we won't hit the BUG in teh callback */ |
116 | idr_for_each(&group->inotify_data.idr, idr_callback, NULL); | 146 | idr_for_each(&group->inotify_data.idr, idr_callback, group); |
117 | idr_remove_all(&group->inotify_data.idr); | 147 | idr_remove_all(&group->inotify_data.idr); |
118 | idr_destroy(&group->inotify_data.idr); | 148 | idr_destroy(&group->inotify_data.idr); |
119 | } | 149 | } |
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index f30d9bbc2e1b..dcd2040d330c 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -47,9 +47,6 @@ | |||
47 | 47 | ||
48 | static struct vfsmount *inotify_mnt __read_mostly; | 48 | static struct vfsmount *inotify_mnt __read_mostly; |
49 | 49 | ||
50 | /* this just sits here and wastes global memory. used to just pad userspace messages with zeros */ | ||
51 | static struct inotify_event nul_inotify_event; | ||
52 | |||
53 | /* these are configurable via /proc/sys/fs/inotify/ */ | 50 | /* these are configurable via /proc/sys/fs/inotify/ */ |
54 | static int inotify_max_user_instances __read_mostly; | 51 | static int inotify_max_user_instances __read_mostly; |
55 | static int inotify_max_queued_events __read_mostly; | 52 | static int inotify_max_queued_events __read_mostly; |
@@ -157,7 +154,8 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group, | |||
157 | 154 | ||
158 | event = fsnotify_peek_notify_event(group); | 155 | event = fsnotify_peek_notify_event(group); |
159 | 156 | ||
160 | event_size += roundup(event->name_len, event_size); | 157 | if (event->name_len) |
158 | event_size += roundup(event->name_len + 1, event_size); | ||
161 | 159 | ||
162 | if (event_size > count) | 160 | if (event_size > count) |
163 | return ERR_PTR(-EINVAL); | 161 | return ERR_PTR(-EINVAL); |
@@ -183,7 +181,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, | |||
183 | struct fsnotify_event_private_data *fsn_priv; | 181 | struct fsnotify_event_private_data *fsn_priv; |
184 | struct inotify_event_private_data *priv; | 182 | struct inotify_event_private_data *priv; |
185 | size_t event_size = sizeof(struct inotify_event); | 183 | size_t event_size = sizeof(struct inotify_event); |
186 | size_t name_len; | 184 | size_t name_len = 0; |
187 | 185 | ||
188 | /* we get the inotify watch descriptor from the event private data */ | 186 | /* we get the inotify watch descriptor from the event private data */ |
189 | spin_lock(&event->lock); | 187 | spin_lock(&event->lock); |
@@ -199,8 +197,12 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, | |||
199 | inotify_free_event_priv(fsn_priv); | 197 | inotify_free_event_priv(fsn_priv); |
200 | } | 198 | } |
201 | 199 | ||
202 | /* round up event->name_len so it is a multiple of event_size */ | 200 | /* |
203 | name_len = roundup(event->name_len, event_size); | 201 | * round up event->name_len so it is a multiple of event_size |
202 | * plus an extra byte for the terminating '\0'. | ||
203 | */ | ||
204 | if (event->name_len) | ||
205 | name_len = roundup(event->name_len + 1, event_size); | ||
204 | inotify_event.len = name_len; | 206 | inotify_event.len = name_len; |
205 | 207 | ||
206 | inotify_event.mask = inotify_mask_to_arg(event->mask); | 208 | inotify_event.mask = inotify_mask_to_arg(event->mask); |
@@ -224,8 +226,8 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, | |||
224 | return -EFAULT; | 226 | return -EFAULT; |
225 | buf += event->name_len; | 227 | buf += event->name_len; |
226 | 228 | ||
227 | /* fill userspace with 0's from nul_inotify_event */ | 229 | /* fill userspace with 0's */ |
228 | if (copy_to_user(buf, &nul_inotify_event, len_to_zero)) | 230 | if (clear_user(buf, len_to_zero)) |
229 | return -EFAULT; | 231 | return -EFAULT; |
230 | buf += len_to_zero; | 232 | buf += len_to_zero; |
231 | event_size += name_len; | 233 | event_size += name_len; |
@@ -326,8 +328,9 @@ static long inotify_ioctl(struct file *file, unsigned int cmd, | |||
326 | list_for_each_entry(holder, &group->notification_list, event_list) { | 328 | list_for_each_entry(holder, &group->notification_list, event_list) { |
327 | event = holder->event; | 329 | event = holder->event; |
328 | send_len += sizeof(struct inotify_event); | 330 | send_len += sizeof(struct inotify_event); |
329 | send_len += roundup(event->name_len, | 331 | if (event->name_len) |
330 | sizeof(struct inotify_event)); | 332 | send_len += roundup(event->name_len + 1, |
333 | sizeof(struct inotify_event)); | ||
331 | } | 334 | } |
332 | mutex_unlock(&group->notification_mutex); | 335 | mutex_unlock(&group->notification_mutex); |
333 | ret = put_user(send_len, (int __user *) p); | 336 | ret = put_user(send_len, (int __user *) p); |
@@ -364,20 +367,53 @@ static int inotify_find_inode(const char __user *dirname, struct path *path, uns | |||
364 | return error; | 367 | return error; |
365 | } | 368 | } |
366 | 369 | ||
370 | /* | ||
371 | * Remove the mark from the idr (if present) and drop the reference | ||
372 | * on the mark because it was in the idr. | ||
373 | */ | ||
367 | static void inotify_remove_from_idr(struct fsnotify_group *group, | 374 | static void inotify_remove_from_idr(struct fsnotify_group *group, |
368 | struct inotify_inode_mark_entry *ientry) | 375 | struct inotify_inode_mark_entry *ientry) |
369 | { | 376 | { |
370 | struct idr *idr; | 377 | struct idr *idr; |
378 | struct fsnotify_mark_entry *entry; | ||
379 | struct inotify_inode_mark_entry *found_ientry; | ||
380 | int wd; | ||
371 | 381 | ||
372 | spin_lock(&group->inotify_data.idr_lock); | 382 | spin_lock(&group->inotify_data.idr_lock); |
373 | idr = &group->inotify_data.idr; | 383 | idr = &group->inotify_data.idr; |
374 | idr_remove(idr, ientry->wd); | 384 | wd = ientry->wd; |
375 | spin_unlock(&group->inotify_data.idr_lock); | 385 | |
386 | if (wd == -1) | ||
387 | goto out; | ||
388 | |||
389 | entry = idr_find(&group->inotify_data.idr, wd); | ||
390 | if (unlikely(!entry)) | ||
391 | goto out; | ||
392 | |||
393 | found_ientry = container_of(entry, struct inotify_inode_mark_entry, fsn_entry); | ||
394 | if (unlikely(found_ientry != ientry)) { | ||
395 | /* We found an entry in the idr with the right wd, but it's | ||
396 | * not the entry we were told to remove. eparis seriously | ||
397 | * fucked up somewhere. */ | ||
398 | WARN_ON(1); | ||
399 | ientry->wd = -1; | ||
400 | goto out; | ||
401 | } | ||
402 | |||
403 | /* One ref for being in the idr, one ref held by the caller */ | ||
404 | BUG_ON(atomic_read(&entry->refcnt) < 2); | ||
405 | |||
406 | idr_remove(idr, wd); | ||
376 | ientry->wd = -1; | 407 | ientry->wd = -1; |
408 | |||
409 | /* removed from the idr, drop that ref */ | ||
410 | fsnotify_put_mark(entry); | ||
411 | out: | ||
412 | spin_unlock(&group->inotify_data.idr_lock); | ||
377 | } | 413 | } |
414 | |||
378 | /* | 415 | /* |
379 | * Send IN_IGNORED for this wd, remove this wd from the idr, and drop the | 416 | * Send IN_IGNORED for this wd, remove this wd from the idr. |
380 | * internal reference help on the mark because it is in the idr. | ||
381 | */ | 417 | */ |
382 | void inotify_ignored_and_remove_idr(struct fsnotify_mark_entry *entry, | 418 | void inotify_ignored_and_remove_idr(struct fsnotify_mark_entry *entry, |
383 | struct fsnotify_group *group) | 419 | struct fsnotify_group *group) |
@@ -386,6 +422,7 @@ void inotify_ignored_and_remove_idr(struct fsnotify_mark_entry *entry, | |||
386 | struct fsnotify_event *ignored_event; | 422 | struct fsnotify_event *ignored_event; |
387 | struct inotify_event_private_data *event_priv; | 423 | struct inotify_event_private_data *event_priv; |
388 | struct fsnotify_event_private_data *fsn_event_priv; | 424 | struct fsnotify_event_private_data *fsn_event_priv; |
425 | int ret; | ||
389 | 426 | ||
390 | ignored_event = fsnotify_create_event(NULL, FS_IN_IGNORED, NULL, | 427 | ignored_event = fsnotify_create_event(NULL, FS_IN_IGNORED, NULL, |
391 | FSNOTIFY_EVENT_NONE, NULL, 0, | 428 | FSNOTIFY_EVENT_NONE, NULL, 0, |
@@ -404,10 +441,8 @@ void inotify_ignored_and_remove_idr(struct fsnotify_mark_entry *entry, | |||
404 | fsn_event_priv->group = group; | 441 | fsn_event_priv->group = group; |
405 | event_priv->wd = ientry->wd; | 442 | event_priv->wd = ientry->wd; |
406 | 443 | ||
407 | fsnotify_add_notify_event(group, ignored_event, fsn_event_priv); | 444 | ret = fsnotify_add_notify_event(group, ignored_event, fsn_event_priv); |
408 | 445 | if (ret) | |
409 | /* did the private data get added? */ | ||
410 | if (list_empty(&fsn_event_priv->event_list)) | ||
411 | inotify_free_event_priv(fsn_event_priv); | 446 | inotify_free_event_priv(fsn_event_priv); |
412 | 447 | ||
413 | skip_send_ignore: | 448 | skip_send_ignore: |
@@ -418,9 +453,6 @@ skip_send_ignore: | |||
418 | /* remove this entry from the idr */ | 453 | /* remove this entry from the idr */ |
419 | inotify_remove_from_idr(group, ientry); | 454 | inotify_remove_from_idr(group, ientry); |
420 | 455 | ||
421 | /* removed from idr, drop that reference */ | ||
422 | fsnotify_put_mark(entry); | ||
423 | |||
424 | atomic_dec(&group->inotify_data.user->inotify_watches); | 456 | atomic_dec(&group->inotify_data.user->inotify_watches); |
425 | } | 457 | } |
426 | 458 | ||
@@ -432,80 +464,29 @@ static void inotify_free_mark(struct fsnotify_mark_entry *entry) | |||
432 | kmem_cache_free(inotify_inode_mark_cachep, ientry); | 464 | kmem_cache_free(inotify_inode_mark_cachep, ientry); |
433 | } | 465 | } |
434 | 466 | ||
435 | static int inotify_update_watch(struct fsnotify_group *group, struct inode *inode, u32 arg) | 467 | static int inotify_update_existing_watch(struct fsnotify_group *group, |
468 | struct inode *inode, | ||
469 | u32 arg) | ||
436 | { | 470 | { |
437 | struct fsnotify_mark_entry *entry = NULL; | 471 | struct fsnotify_mark_entry *entry; |
438 | struct inotify_inode_mark_entry *ientry; | 472 | struct inotify_inode_mark_entry *ientry; |
439 | struct inotify_inode_mark_entry *tmp_ientry; | ||
440 | int ret = 0; | ||
441 | int add = (arg & IN_MASK_ADD); | ||
442 | __u32 mask; | ||
443 | __u32 old_mask, new_mask; | 473 | __u32 old_mask, new_mask; |
474 | __u32 mask; | ||
475 | int add = (arg & IN_MASK_ADD); | ||
476 | int ret; | ||
444 | 477 | ||
445 | /* don't allow invalid bits: we don't want flags set */ | 478 | /* don't allow invalid bits: we don't want flags set */ |
446 | mask = inotify_arg_to_mask(arg); | 479 | mask = inotify_arg_to_mask(arg); |
447 | if (unlikely(!mask)) | 480 | if (unlikely(!mask)) |
448 | return -EINVAL; | 481 | return -EINVAL; |
449 | 482 | ||
450 | tmp_ientry = kmem_cache_alloc(inotify_inode_mark_cachep, GFP_KERNEL); | ||
451 | if (unlikely(!tmp_ientry)) | ||
452 | return -ENOMEM; | ||
453 | /* we set the mask at the end after attaching it */ | ||
454 | fsnotify_init_mark(&tmp_ientry->fsn_entry, inotify_free_mark); | ||
455 | tmp_ientry->wd = -1; | ||
456 | |||
457 | find_entry: | ||
458 | spin_lock(&inode->i_lock); | 483 | spin_lock(&inode->i_lock); |
459 | entry = fsnotify_find_mark_entry(group, inode); | 484 | entry = fsnotify_find_mark_entry(group, inode); |
460 | spin_unlock(&inode->i_lock); | 485 | spin_unlock(&inode->i_lock); |
461 | if (entry) { | 486 | if (!entry) |
462 | ientry = container_of(entry, struct inotify_inode_mark_entry, fsn_entry); | 487 | return -ENOENT; |
463 | } else { | ||
464 | ret = -ENOSPC; | ||
465 | if (atomic_read(&group->inotify_data.user->inotify_watches) >= inotify_max_user_watches) | ||
466 | goto out_err; | ||
467 | retry: | ||
468 | ret = -ENOMEM; | ||
469 | if (unlikely(!idr_pre_get(&group->inotify_data.idr, GFP_KERNEL))) | ||
470 | goto out_err; | ||
471 | |||
472 | spin_lock(&group->inotify_data.idr_lock); | ||
473 | ret = idr_get_new_above(&group->inotify_data.idr, &tmp_ientry->fsn_entry, | ||
474 | group->inotify_data.last_wd, | ||
475 | &tmp_ientry->wd); | ||
476 | spin_unlock(&group->inotify_data.idr_lock); | ||
477 | if (ret) { | ||
478 | if (ret == -EAGAIN) | ||
479 | goto retry; | ||
480 | goto out_err; | ||
481 | } | ||
482 | 488 | ||
483 | ret = fsnotify_add_mark(&tmp_ientry->fsn_entry, group, inode); | 489 | ientry = container_of(entry, struct inotify_inode_mark_entry, fsn_entry); |
484 | if (ret) { | ||
485 | inotify_remove_from_idr(group, tmp_ientry); | ||
486 | if (ret == -EEXIST) | ||
487 | goto find_entry; | ||
488 | goto out_err; | ||
489 | } | ||
490 | |||
491 | /* tmp_ientry has been added to the inode, so we are all set up. | ||
492 | * now we just need to make sure tmp_ientry doesn't get freed and | ||
493 | * we need to set up entry and ientry so the generic code can | ||
494 | * do its thing. */ | ||
495 | ientry = tmp_ientry; | ||
496 | entry = &ientry->fsn_entry; | ||
497 | tmp_ientry = NULL; | ||
498 | |||
499 | atomic_inc(&group->inotify_data.user->inotify_watches); | ||
500 | |||
501 | /* update the idr hint */ | ||
502 | group->inotify_data.last_wd = ientry->wd; | ||
503 | |||
504 | /* we put the mark on the idr, take a reference */ | ||
505 | fsnotify_get_mark(entry); | ||
506 | } | ||
507 | |||
508 | ret = ientry->wd; | ||
509 | 490 | ||
510 | spin_lock(&entry->lock); | 491 | spin_lock(&entry->lock); |
511 | 492 | ||
@@ -537,18 +518,107 @@ retry: | |||
537 | fsnotify_recalc_group_mask(group); | 518 | fsnotify_recalc_group_mask(group); |
538 | } | 519 | } |
539 | 520 | ||
540 | /* this either matches fsnotify_find_mark_entry, or init_mark_entry | 521 | /* return the wd */ |
541 | * depending on which path we took... */ | 522 | ret = ientry->wd; |
523 | |||
524 | /* match the get from fsnotify_find_mark_entry() */ | ||
542 | fsnotify_put_mark(entry); | 525 | fsnotify_put_mark(entry); |
543 | 526 | ||
527 | return ret; | ||
528 | } | ||
529 | |||
530 | static int inotify_new_watch(struct fsnotify_group *group, | ||
531 | struct inode *inode, | ||
532 | u32 arg) | ||
533 | { | ||
534 | struct inotify_inode_mark_entry *tmp_ientry; | ||
535 | __u32 mask; | ||
536 | int ret; | ||
537 | |||
538 | /* don't allow invalid bits: we don't want flags set */ | ||
539 | mask = inotify_arg_to_mask(arg); | ||
540 | if (unlikely(!mask)) | ||
541 | return -EINVAL; | ||
542 | |||
543 | tmp_ientry = kmem_cache_alloc(inotify_inode_mark_cachep, GFP_KERNEL); | ||
544 | if (unlikely(!tmp_ientry)) | ||
545 | return -ENOMEM; | ||
546 | |||
547 | fsnotify_init_mark(&tmp_ientry->fsn_entry, inotify_free_mark); | ||
548 | tmp_ientry->fsn_entry.mask = mask; | ||
549 | tmp_ientry->wd = -1; | ||
550 | |||
551 | ret = -ENOSPC; | ||
552 | if (atomic_read(&group->inotify_data.user->inotify_watches) >= inotify_max_user_watches) | ||
553 | goto out_err; | ||
554 | retry: | ||
555 | ret = -ENOMEM; | ||
556 | if (unlikely(!idr_pre_get(&group->inotify_data.idr, GFP_KERNEL))) | ||
557 | goto out_err; | ||
558 | |||
559 | spin_lock(&group->inotify_data.idr_lock); | ||
560 | ret = idr_get_new_above(&group->inotify_data.idr, &tmp_ientry->fsn_entry, | ||
561 | group->inotify_data.last_wd, | ||
562 | &tmp_ientry->wd); | ||
563 | spin_unlock(&group->inotify_data.idr_lock); | ||
564 | if (ret) { | ||
565 | /* idr was out of memory allocate and try again */ | ||
566 | if (ret == -EAGAIN) | ||
567 | goto retry; | ||
568 | goto out_err; | ||
569 | } | ||
570 | |||
571 | /* we put the mark on the idr, take a reference */ | ||
572 | fsnotify_get_mark(&tmp_ientry->fsn_entry); | ||
573 | |||
574 | /* we are on the idr, now get on the inode */ | ||
575 | ret = fsnotify_add_mark(&tmp_ientry->fsn_entry, group, inode); | ||
576 | if (ret) { | ||
577 | /* we failed to get on the inode, get off the idr */ | ||
578 | inotify_remove_from_idr(group, tmp_ientry); | ||
579 | goto out_err; | ||
580 | } | ||
581 | |||
582 | /* update the idr hint, who cares about races, it's just a hint */ | ||
583 | group->inotify_data.last_wd = tmp_ientry->wd; | ||
584 | |||
585 | /* increment the number of watches the user has */ | ||
586 | atomic_inc(&group->inotify_data.user->inotify_watches); | ||
587 | |||
588 | /* return the watch descriptor for this new entry */ | ||
589 | ret = tmp_ientry->wd; | ||
590 | |||
591 | /* match the ref from fsnotify_init_markentry() */ | ||
592 | fsnotify_put_mark(&tmp_ientry->fsn_entry); | ||
593 | |||
594 | /* if this mark added a new event update the group mask */ | ||
595 | if (mask & ~group->mask) | ||
596 | fsnotify_recalc_group_mask(group); | ||
597 | |||
544 | out_err: | 598 | out_err: |
545 | /* could be an error, could be that we found an existing mark */ | 599 | if (ret < 0) |
546 | if (tmp_ientry) { | ||
547 | /* on the idr but didn't make it on the inode */ | ||
548 | if (tmp_ientry->wd != -1) | ||
549 | inotify_remove_from_idr(group, tmp_ientry); | ||
550 | kmem_cache_free(inotify_inode_mark_cachep, tmp_ientry); | 600 | kmem_cache_free(inotify_inode_mark_cachep, tmp_ientry); |
551 | } | 601 | |
602 | return ret; | ||
603 | } | ||
604 | |||
605 | static int inotify_update_watch(struct fsnotify_group *group, struct inode *inode, u32 arg) | ||
606 | { | ||
607 | int ret = 0; | ||
608 | |||
609 | retry: | ||
610 | /* try to update and existing watch with the new arg */ | ||
611 | ret = inotify_update_existing_watch(group, inode, arg); | ||
612 | /* no mark present, try to add a new one */ | ||
613 | if (ret == -ENOENT) | ||
614 | ret = inotify_new_watch(group, inode, arg); | ||
615 | /* | ||
616 | * inotify_new_watch could race with another thread which did an | ||
617 | * inotify_new_watch between the update_existing and the add watch | ||
618 | * here, go back and try to update an existing mark again. | ||
619 | */ | ||
620 | if (ret == -EEXIST) | ||
621 | goto retry; | ||
552 | 622 | ||
553 | return ret; | 623 | return ret; |
554 | } | 624 | } |
@@ -568,7 +638,7 @@ static struct fsnotify_group *inotify_new_group(struct user_struct *user, unsign | |||
568 | 638 | ||
569 | spin_lock_init(&group->inotify_data.idr_lock); | 639 | spin_lock_init(&group->inotify_data.idr_lock); |
570 | idr_init(&group->inotify_data.idr); | 640 | idr_init(&group->inotify_data.idr); |
571 | group->inotify_data.last_wd = 0; | 641 | group->inotify_data.last_wd = 1; |
572 | group->inotify_data.user = user; | 642 | group->inotify_data.user = user; |
573 | group->inotify_data.fa = NULL; | 643 | group->inotify_data.fa = NULL; |
574 | 644 | ||
diff --git a/fs/notify/notification.c b/fs/notify/notification.c index 521368574e97..3816d5750dd5 100644 --- a/fs/notify/notification.c +++ b/fs/notify/notification.c | |||
@@ -153,6 +153,10 @@ static bool event_compare(struct fsnotify_event *old, struct fsnotify_event *new | |||
153 | return true; | 153 | return true; |
154 | break; | 154 | break; |
155 | case (FSNOTIFY_EVENT_NONE): | 155 | case (FSNOTIFY_EVENT_NONE): |
156 | if (old->mask & FS_Q_OVERFLOW) | ||
157 | return true; | ||
158 | else if (old->mask & FS_IN_IGNORED) | ||
159 | return false; | ||
156 | return false; | 160 | return false; |
157 | }; | 161 | }; |
158 | } | 162 | } |
@@ -171,9 +175,7 @@ int fsnotify_add_notify_event(struct fsnotify_group *group, struct fsnotify_even | |||
171 | struct list_head *list = &group->notification_list; | 175 | struct list_head *list = &group->notification_list; |
172 | struct fsnotify_event_holder *last_holder; | 176 | struct fsnotify_event_holder *last_holder; |
173 | struct fsnotify_event *last_event; | 177 | struct fsnotify_event *last_event; |
174 | 178 | int ret = 0; | |
175 | /* easy to tell if priv was attached to the event */ | ||
176 | INIT_LIST_HEAD(&priv->event_list); | ||
177 | 179 | ||
178 | /* | 180 | /* |
179 | * There is one fsnotify_event_holder embedded inside each fsnotify_event. | 181 | * There is one fsnotify_event_holder embedded inside each fsnotify_event. |
@@ -194,6 +196,7 @@ alloc_holder: | |||
194 | 196 | ||
195 | if (group->q_len >= group->max_events) { | 197 | if (group->q_len >= group->max_events) { |
196 | event = &q_overflow_event; | 198 | event = &q_overflow_event; |
199 | ret = -EOVERFLOW; | ||
197 | /* sorry, no private data on the overflow event */ | 200 | /* sorry, no private data on the overflow event */ |
198 | priv = NULL; | 201 | priv = NULL; |
199 | } | 202 | } |
@@ -235,7 +238,7 @@ alloc_holder: | |||
235 | mutex_unlock(&group->notification_mutex); | 238 | mutex_unlock(&group->notification_mutex); |
236 | 239 | ||
237 | wake_up(&group->notification_waitq); | 240 | wake_up(&group->notification_waitq); |
238 | return 0; | 241 | return ret; |
239 | } | 242 | } |
240 | 243 | ||
241 | /* | 244 | /* |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 9edcde4974aa..ab513ddaeff2 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -1914,7 +1914,8 @@ static void ocfs2_adjust_adjacent_records(struct ocfs2_extent_rec *left_rec, | |||
1914 | * immediately to their right. | 1914 | * immediately to their right. |
1915 | */ | 1915 | */ |
1916 | left_clusters = le32_to_cpu(right_child_el->l_recs[0].e_cpos); | 1916 | left_clusters = le32_to_cpu(right_child_el->l_recs[0].e_cpos); |
1917 | if (ocfs2_is_empty_extent(&right_child_el->l_recs[0])) { | 1917 | if (!ocfs2_rec_clusters(right_child_el, &right_child_el->l_recs[0])) { |
1918 | BUG_ON(right_child_el->l_tree_depth); | ||
1918 | BUG_ON(le16_to_cpu(right_child_el->l_next_free_rec) <= 1); | 1919 | BUG_ON(le16_to_cpu(right_child_el->l_next_free_rec) <= 1); |
1919 | left_clusters = le32_to_cpu(right_child_el->l_recs[1].e_cpos); | 1920 | left_clusters = le32_to_cpu(right_child_el->l_recs[1].e_cpos); |
1920 | } | 1921 | } |
@@ -2476,15 +2477,37 @@ out_ret_path: | |||
2476 | return ret; | 2477 | return ret; |
2477 | } | 2478 | } |
2478 | 2479 | ||
2479 | static void ocfs2_update_edge_lengths(struct inode *inode, handle_t *handle, | 2480 | static int ocfs2_update_edge_lengths(struct inode *inode, handle_t *handle, |
2480 | struct ocfs2_path *path) | 2481 | int subtree_index, struct ocfs2_path *path) |
2481 | { | 2482 | { |
2482 | int i, idx; | 2483 | int i, idx, ret; |
2483 | struct ocfs2_extent_rec *rec; | 2484 | struct ocfs2_extent_rec *rec; |
2484 | struct ocfs2_extent_list *el; | 2485 | struct ocfs2_extent_list *el; |
2485 | struct ocfs2_extent_block *eb; | 2486 | struct ocfs2_extent_block *eb; |
2486 | u32 range; | 2487 | u32 range; |
2487 | 2488 | ||
2489 | /* | ||
2490 | * In normal tree rotation process, we will never touch the | ||
2491 | * tree branch above subtree_index and ocfs2_extend_rotate_transaction | ||
2492 | * doesn't reserve the credits for them either. | ||
2493 | * | ||
2494 | * But we do have a special case here which will update the rightmost | ||
2495 | * records for all the bh in the path. | ||
2496 | * So we have to allocate extra credits and access them. | ||
2497 | */ | ||
2498 | ret = ocfs2_extend_trans(handle, | ||
2499 | handle->h_buffer_credits + subtree_index); | ||
2500 | if (ret) { | ||
2501 | mlog_errno(ret); | ||
2502 | goto out; | ||
2503 | } | ||
2504 | |||
2505 | ret = ocfs2_journal_access_path(inode, handle, path); | ||
2506 | if (ret) { | ||
2507 | mlog_errno(ret); | ||
2508 | goto out; | ||
2509 | } | ||
2510 | |||
2488 | /* Path should always be rightmost. */ | 2511 | /* Path should always be rightmost. */ |
2489 | eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data; | 2512 | eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data; |
2490 | BUG_ON(eb->h_next_leaf_blk != 0ULL); | 2513 | BUG_ON(eb->h_next_leaf_blk != 0ULL); |
@@ -2505,6 +2528,8 @@ static void ocfs2_update_edge_lengths(struct inode *inode, handle_t *handle, | |||
2505 | 2528 | ||
2506 | ocfs2_journal_dirty(handle, path->p_node[i].bh); | 2529 | ocfs2_journal_dirty(handle, path->p_node[i].bh); |
2507 | } | 2530 | } |
2531 | out: | ||
2532 | return ret; | ||
2508 | } | 2533 | } |
2509 | 2534 | ||
2510 | static void ocfs2_unlink_path(struct inode *inode, handle_t *handle, | 2535 | static void ocfs2_unlink_path(struct inode *inode, handle_t *handle, |
@@ -2717,7 +2742,12 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle, | |||
2717 | if (del_right_subtree) { | 2742 | if (del_right_subtree) { |
2718 | ocfs2_unlink_subtree(inode, handle, left_path, right_path, | 2743 | ocfs2_unlink_subtree(inode, handle, left_path, right_path, |
2719 | subtree_index, dealloc); | 2744 | subtree_index, dealloc); |
2720 | ocfs2_update_edge_lengths(inode, handle, left_path); | 2745 | ret = ocfs2_update_edge_lengths(inode, handle, subtree_index, |
2746 | left_path); | ||
2747 | if (ret) { | ||
2748 | mlog_errno(ret); | ||
2749 | goto out; | ||
2750 | } | ||
2721 | 2751 | ||
2722 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; | 2752 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; |
2723 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | 2753 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); |
@@ -3034,7 +3064,12 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, | |||
3034 | 3064 | ||
3035 | ocfs2_unlink_subtree(inode, handle, left_path, path, | 3065 | ocfs2_unlink_subtree(inode, handle, left_path, path, |
3036 | subtree_index, dealloc); | 3066 | subtree_index, dealloc); |
3037 | ocfs2_update_edge_lengths(inode, handle, left_path); | 3067 | ret = ocfs2_update_edge_lengths(inode, handle, subtree_index, |
3068 | left_path); | ||
3069 | if (ret) { | ||
3070 | mlog_errno(ret); | ||
3071 | goto out; | ||
3072 | } | ||
3038 | 3073 | ||
3039 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; | 3074 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; |
3040 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | 3075 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); |
@@ -6816,7 +6851,7 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb, | |||
6816 | } | 6851 | } |
6817 | status = 0; | 6852 | status = 0; |
6818 | bail: | 6853 | bail: |
6819 | 6854 | brelse(last_eb_bh); | |
6820 | mlog_exit(status); | 6855 | mlog_exit(status); |
6821 | return status; | 6856 | return status; |
6822 | } | 6857 | } |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index b2c52b3a1484..8a1e61545f41 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -193,6 +193,7 @@ static int ocfs2_get_block(struct inode *inode, sector_t iblock, | |||
193 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 193 | (unsigned long long)OCFS2_I(inode)->ip_blkno); |
194 | mlog(ML_ERROR, "Size %llu, clusters %u\n", (unsigned long long)i_size_read(inode), OCFS2_I(inode)->ip_clusters); | 194 | mlog(ML_ERROR, "Size %llu, clusters %u\n", (unsigned long long)i_size_read(inode), OCFS2_I(inode)->ip_clusters); |
195 | dump_stack(); | 195 | dump_stack(); |
196 | goto bail; | ||
196 | } | 197 | } |
197 | 198 | ||
198 | past_eof = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode)); | 199 | past_eof = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode)); |
@@ -894,18 +895,17 @@ struct ocfs2_write_cluster_desc { | |||
894 | */ | 895 | */ |
895 | unsigned c_new; | 896 | unsigned c_new; |
896 | unsigned c_unwritten; | 897 | unsigned c_unwritten; |
898 | unsigned c_needs_zero; | ||
897 | }; | 899 | }; |
898 | 900 | ||
899 | static inline int ocfs2_should_zero_cluster(struct ocfs2_write_cluster_desc *d) | ||
900 | { | ||
901 | return d->c_new || d->c_unwritten; | ||
902 | } | ||
903 | |||
904 | struct ocfs2_write_ctxt { | 901 | struct ocfs2_write_ctxt { |
905 | /* Logical cluster position / len of write */ | 902 | /* Logical cluster position / len of write */ |
906 | u32 w_cpos; | 903 | u32 w_cpos; |
907 | u32 w_clen; | 904 | u32 w_clen; |
908 | 905 | ||
906 | /* First cluster allocated in a nonsparse extend */ | ||
907 | u32 w_first_new_cpos; | ||
908 | |||
909 | struct ocfs2_write_cluster_desc w_desc[OCFS2_MAX_CLUSTERS_PER_PAGE]; | 909 | struct ocfs2_write_cluster_desc w_desc[OCFS2_MAX_CLUSTERS_PER_PAGE]; |
910 | 910 | ||
911 | /* | 911 | /* |
@@ -983,6 +983,7 @@ static int ocfs2_alloc_write_ctxt(struct ocfs2_write_ctxt **wcp, | |||
983 | return -ENOMEM; | 983 | return -ENOMEM; |
984 | 984 | ||
985 | wc->w_cpos = pos >> osb->s_clustersize_bits; | 985 | wc->w_cpos = pos >> osb->s_clustersize_bits; |
986 | wc->w_first_new_cpos = UINT_MAX; | ||
986 | cend = (pos + len - 1) >> osb->s_clustersize_bits; | 987 | cend = (pos + len - 1) >> osb->s_clustersize_bits; |
987 | wc->w_clen = cend - wc->w_cpos + 1; | 988 | wc->w_clen = cend - wc->w_cpos + 1; |
988 | get_bh(di_bh); | 989 | get_bh(di_bh); |
@@ -1217,20 +1218,18 @@ out: | |||
1217 | */ | 1218 | */ |
1218 | static int ocfs2_write_cluster(struct address_space *mapping, | 1219 | static int ocfs2_write_cluster(struct address_space *mapping, |
1219 | u32 phys, unsigned int unwritten, | 1220 | u32 phys, unsigned int unwritten, |
1221 | unsigned int should_zero, | ||
1220 | struct ocfs2_alloc_context *data_ac, | 1222 | struct ocfs2_alloc_context *data_ac, |
1221 | struct ocfs2_alloc_context *meta_ac, | 1223 | struct ocfs2_alloc_context *meta_ac, |
1222 | struct ocfs2_write_ctxt *wc, u32 cpos, | 1224 | struct ocfs2_write_ctxt *wc, u32 cpos, |
1223 | loff_t user_pos, unsigned user_len) | 1225 | loff_t user_pos, unsigned user_len) |
1224 | { | 1226 | { |
1225 | int ret, i, new, should_zero = 0; | 1227 | int ret, i, new; |
1226 | u64 v_blkno, p_blkno; | 1228 | u64 v_blkno, p_blkno; |
1227 | struct inode *inode = mapping->host; | 1229 | struct inode *inode = mapping->host; |
1228 | struct ocfs2_extent_tree et; | 1230 | struct ocfs2_extent_tree et; |
1229 | 1231 | ||
1230 | new = phys == 0 ? 1 : 0; | 1232 | new = phys == 0 ? 1 : 0; |
1231 | if (new || unwritten) | ||
1232 | should_zero = 1; | ||
1233 | |||
1234 | if (new) { | 1233 | if (new) { |
1235 | u32 tmp_pos; | 1234 | u32 tmp_pos; |
1236 | 1235 | ||
@@ -1301,7 +1300,7 @@ static int ocfs2_write_cluster(struct address_space *mapping, | |||
1301 | if (tmpret) { | 1300 | if (tmpret) { |
1302 | mlog_errno(tmpret); | 1301 | mlog_errno(tmpret); |
1303 | if (ret == 0) | 1302 | if (ret == 0) |
1304 | tmpret = ret; | 1303 | ret = tmpret; |
1305 | } | 1304 | } |
1306 | } | 1305 | } |
1307 | 1306 | ||
@@ -1341,7 +1340,9 @@ static int ocfs2_write_cluster_by_desc(struct address_space *mapping, | |||
1341 | local_len = osb->s_clustersize - cluster_off; | 1340 | local_len = osb->s_clustersize - cluster_off; |
1342 | 1341 | ||
1343 | ret = ocfs2_write_cluster(mapping, desc->c_phys, | 1342 | ret = ocfs2_write_cluster(mapping, desc->c_phys, |
1344 | desc->c_unwritten, data_ac, meta_ac, | 1343 | desc->c_unwritten, |
1344 | desc->c_needs_zero, | ||
1345 | data_ac, meta_ac, | ||
1345 | wc, desc->c_cpos, pos, local_len); | 1346 | wc, desc->c_cpos, pos, local_len); |
1346 | if (ret) { | 1347 | if (ret) { |
1347 | mlog_errno(ret); | 1348 | mlog_errno(ret); |
@@ -1391,14 +1392,14 @@ static void ocfs2_set_target_boundaries(struct ocfs2_super *osb, | |||
1391 | * newly allocated cluster. | 1392 | * newly allocated cluster. |
1392 | */ | 1393 | */ |
1393 | desc = &wc->w_desc[0]; | 1394 | desc = &wc->w_desc[0]; |
1394 | if (ocfs2_should_zero_cluster(desc)) | 1395 | if (desc->c_needs_zero) |
1395 | ocfs2_figure_cluster_boundaries(osb, | 1396 | ocfs2_figure_cluster_boundaries(osb, |
1396 | desc->c_cpos, | 1397 | desc->c_cpos, |
1397 | &wc->w_target_from, | 1398 | &wc->w_target_from, |
1398 | NULL); | 1399 | NULL); |
1399 | 1400 | ||
1400 | desc = &wc->w_desc[wc->w_clen - 1]; | 1401 | desc = &wc->w_desc[wc->w_clen - 1]; |
1401 | if (ocfs2_should_zero_cluster(desc)) | 1402 | if (desc->c_needs_zero) |
1402 | ocfs2_figure_cluster_boundaries(osb, | 1403 | ocfs2_figure_cluster_boundaries(osb, |
1403 | desc->c_cpos, | 1404 | desc->c_cpos, |
1404 | NULL, | 1405 | NULL, |
@@ -1466,13 +1467,28 @@ static int ocfs2_populate_write_desc(struct inode *inode, | |||
1466 | phys++; | 1467 | phys++; |
1467 | } | 1468 | } |
1468 | 1469 | ||
1470 | /* | ||
1471 | * If w_first_new_cpos is < UINT_MAX, we have a non-sparse | ||
1472 | * file that got extended. w_first_new_cpos tells us | ||
1473 | * where the newly allocated clusters are so we can | ||
1474 | * zero them. | ||
1475 | */ | ||
1476 | if (desc->c_cpos >= wc->w_first_new_cpos) { | ||
1477 | BUG_ON(phys == 0); | ||
1478 | desc->c_needs_zero = 1; | ||
1479 | } | ||
1480 | |||
1469 | desc->c_phys = phys; | 1481 | desc->c_phys = phys; |
1470 | if (phys == 0) { | 1482 | if (phys == 0) { |
1471 | desc->c_new = 1; | 1483 | desc->c_new = 1; |
1484 | desc->c_needs_zero = 1; | ||
1472 | *clusters_to_alloc = *clusters_to_alloc + 1; | 1485 | *clusters_to_alloc = *clusters_to_alloc + 1; |
1473 | } | 1486 | } |
1474 | if (ext_flags & OCFS2_EXT_UNWRITTEN) | 1487 | |
1488 | if (ext_flags & OCFS2_EXT_UNWRITTEN) { | ||
1475 | desc->c_unwritten = 1; | 1489 | desc->c_unwritten = 1; |
1490 | desc->c_needs_zero = 1; | ||
1491 | } | ||
1476 | 1492 | ||
1477 | num_clusters--; | 1493 | num_clusters--; |
1478 | } | 1494 | } |
@@ -1632,10 +1648,13 @@ static int ocfs2_expand_nonsparse_inode(struct inode *inode, loff_t pos, | |||
1632 | if (newsize <= i_size_read(inode)) | 1648 | if (newsize <= i_size_read(inode)) |
1633 | return 0; | 1649 | return 0; |
1634 | 1650 | ||
1635 | ret = ocfs2_extend_no_holes(inode, newsize, newsize - len); | 1651 | ret = ocfs2_extend_no_holes(inode, newsize, pos); |
1636 | if (ret) | 1652 | if (ret) |
1637 | mlog_errno(ret); | 1653 | mlog_errno(ret); |
1638 | 1654 | ||
1655 | wc->w_first_new_cpos = | ||
1656 | ocfs2_clusters_for_bytes(inode->i_sb, i_size_read(inode)); | ||
1657 | |||
1639 | return ret; | 1658 | return ret; |
1640 | } | 1659 | } |
1641 | 1660 | ||
@@ -1644,7 +1663,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1644 | struct page **pagep, void **fsdata, | 1663 | struct page **pagep, void **fsdata, |
1645 | struct buffer_head *di_bh, struct page *mmap_page) | 1664 | struct buffer_head *di_bh, struct page *mmap_page) |
1646 | { | 1665 | { |
1647 | int ret, credits = OCFS2_INODE_UPDATE_CREDITS; | 1666 | int ret, cluster_of_pages, credits = OCFS2_INODE_UPDATE_CREDITS; |
1648 | unsigned int clusters_to_alloc, extents_to_split; | 1667 | unsigned int clusters_to_alloc, extents_to_split; |
1649 | struct ocfs2_write_ctxt *wc; | 1668 | struct ocfs2_write_ctxt *wc; |
1650 | struct inode *inode = mapping->host; | 1669 | struct inode *inode = mapping->host; |
@@ -1722,8 +1741,19 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1722 | 1741 | ||
1723 | } | 1742 | } |
1724 | 1743 | ||
1725 | ocfs2_set_target_boundaries(osb, wc, pos, len, | 1744 | /* |
1726 | clusters_to_alloc + extents_to_split); | 1745 | * We have to zero sparse allocated clusters, unwritten extent clusters, |
1746 | * and non-sparse clusters we just extended. For non-sparse writes, | ||
1747 | * we know zeros will only be needed in the first and/or last cluster. | ||
1748 | */ | ||
1749 | if (clusters_to_alloc || extents_to_split || | ||
1750 | (wc->w_clen && (wc->w_desc[0].c_needs_zero || | ||
1751 | wc->w_desc[wc->w_clen - 1].c_needs_zero))) | ||
1752 | cluster_of_pages = 1; | ||
1753 | else | ||
1754 | cluster_of_pages = 0; | ||
1755 | |||
1756 | ocfs2_set_target_boundaries(osb, wc, pos, len, cluster_of_pages); | ||
1727 | 1757 | ||
1728 | handle = ocfs2_start_trans(osb, credits); | 1758 | handle = ocfs2_start_trans(osb, credits); |
1729 | if (IS_ERR(handle)) { | 1759 | if (IS_ERR(handle)) { |
@@ -1756,8 +1786,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1756 | * extent. | 1786 | * extent. |
1757 | */ | 1787 | */ |
1758 | ret = ocfs2_grab_pages_for_write(mapping, wc, wc->w_cpos, pos, | 1788 | ret = ocfs2_grab_pages_for_write(mapping, wc, wc->w_cpos, pos, |
1759 | clusters_to_alloc + extents_to_split, | 1789 | cluster_of_pages, mmap_page); |
1760 | mmap_page); | ||
1761 | if (ret) { | 1790 | if (ret) { |
1762 | mlog_errno(ret); | 1791 | mlog_errno(ret); |
1763 | goto out_quota; | 1792 | goto out_quota; |
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index b574431a031d..b4957c7d9fe2 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c | |||
@@ -85,6 +85,17 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry, | |||
85 | goto bail; | 85 | goto bail; |
86 | } | 86 | } |
87 | 87 | ||
88 | /* | ||
89 | * If the last lookup failed to create dentry lock, let us | ||
90 | * redo it. | ||
91 | */ | ||
92 | if (!dentry->d_fsdata) { | ||
93 | mlog(0, "Inode %llu doesn't have dentry lock, " | ||
94 | "returning false\n", | ||
95 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
96 | goto bail; | ||
97 | } | ||
98 | |||
88 | ret = 1; | 99 | ret = 1; |
89 | 100 | ||
90 | bail: | 101 | bail: |
@@ -310,22 +321,19 @@ out_attach: | |||
310 | return ret; | 321 | return ret; |
311 | } | 322 | } |
312 | 323 | ||
313 | static DEFINE_SPINLOCK(dentry_list_lock); | 324 | DEFINE_SPINLOCK(dentry_list_lock); |
314 | 325 | ||
315 | /* We limit the number of dentry locks to drop in one go. We have | 326 | /* We limit the number of dentry locks to drop in one go. We have |
316 | * this limit so that we don't starve other users of ocfs2_wq. */ | 327 | * this limit so that we don't starve other users of ocfs2_wq. */ |
317 | #define DL_INODE_DROP_COUNT 64 | 328 | #define DL_INODE_DROP_COUNT 64 |
318 | 329 | ||
319 | /* Drop inode references from dentry locks */ | 330 | /* Drop inode references from dentry locks */ |
320 | void ocfs2_drop_dl_inodes(struct work_struct *work) | 331 | static void __ocfs2_drop_dl_inodes(struct ocfs2_super *osb, int drop_count) |
321 | { | 332 | { |
322 | struct ocfs2_super *osb = container_of(work, struct ocfs2_super, | ||
323 | dentry_lock_work); | ||
324 | struct ocfs2_dentry_lock *dl; | 333 | struct ocfs2_dentry_lock *dl; |
325 | int drop_count = DL_INODE_DROP_COUNT; | ||
326 | 334 | ||
327 | spin_lock(&dentry_list_lock); | 335 | spin_lock(&dentry_list_lock); |
328 | while (osb->dentry_lock_list && drop_count--) { | 336 | while (osb->dentry_lock_list && (drop_count < 0 || drop_count--)) { |
329 | dl = osb->dentry_lock_list; | 337 | dl = osb->dentry_lock_list; |
330 | osb->dentry_lock_list = dl->dl_next; | 338 | osb->dentry_lock_list = dl->dl_next; |
331 | spin_unlock(&dentry_list_lock); | 339 | spin_unlock(&dentry_list_lock); |
@@ -333,11 +341,32 @@ void ocfs2_drop_dl_inodes(struct work_struct *work) | |||
333 | kfree(dl); | 341 | kfree(dl); |
334 | spin_lock(&dentry_list_lock); | 342 | spin_lock(&dentry_list_lock); |
335 | } | 343 | } |
336 | if (osb->dentry_lock_list) | 344 | spin_unlock(&dentry_list_lock); |
345 | } | ||
346 | |||
347 | void ocfs2_drop_dl_inodes(struct work_struct *work) | ||
348 | { | ||
349 | struct ocfs2_super *osb = container_of(work, struct ocfs2_super, | ||
350 | dentry_lock_work); | ||
351 | |||
352 | __ocfs2_drop_dl_inodes(osb, DL_INODE_DROP_COUNT); | ||
353 | /* | ||
354 | * Don't queue dropping if umount is in progress. We flush the | ||
355 | * list in ocfs2_dismount_volume | ||
356 | */ | ||
357 | spin_lock(&dentry_list_lock); | ||
358 | if (osb->dentry_lock_list && | ||
359 | !ocfs2_test_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED)) | ||
337 | queue_work(ocfs2_wq, &osb->dentry_lock_work); | 360 | queue_work(ocfs2_wq, &osb->dentry_lock_work); |
338 | spin_unlock(&dentry_list_lock); | 361 | spin_unlock(&dentry_list_lock); |
339 | } | 362 | } |
340 | 363 | ||
364 | /* Flush the whole work queue */ | ||
365 | void ocfs2_drop_all_dl_inodes(struct ocfs2_super *osb) | ||
366 | { | ||
367 | __ocfs2_drop_dl_inodes(osb, -1); | ||
368 | } | ||
369 | |||
341 | /* | 370 | /* |
342 | * ocfs2_dentry_iput() and friends. | 371 | * ocfs2_dentry_iput() and friends. |
343 | * | 372 | * |
@@ -368,7 +397,8 @@ static void ocfs2_drop_dentry_lock(struct ocfs2_super *osb, | |||
368 | /* We leave dropping of inode reference to ocfs2_wq as that can | 397 | /* We leave dropping of inode reference to ocfs2_wq as that can |
369 | * possibly lead to inode deletion which gets tricky */ | 398 | * possibly lead to inode deletion which gets tricky */ |
370 | spin_lock(&dentry_list_lock); | 399 | spin_lock(&dentry_list_lock); |
371 | if (!osb->dentry_lock_list) | 400 | if (!osb->dentry_lock_list && |
401 | !ocfs2_test_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED)) | ||
372 | queue_work(ocfs2_wq, &osb->dentry_lock_work); | 402 | queue_work(ocfs2_wq, &osb->dentry_lock_work); |
373 | dl->dl_next = osb->dentry_lock_list; | 403 | dl->dl_next = osb->dentry_lock_list; |
374 | osb->dentry_lock_list = dl; | 404 | osb->dentry_lock_list = dl; |
diff --git a/fs/ocfs2/dcache.h b/fs/ocfs2/dcache.h index faa12e75f98d..f5dd1789acf1 100644 --- a/fs/ocfs2/dcache.h +++ b/fs/ocfs2/dcache.h | |||
@@ -49,10 +49,13 @@ struct ocfs2_dentry_lock { | |||
49 | int ocfs2_dentry_attach_lock(struct dentry *dentry, struct inode *inode, | 49 | int ocfs2_dentry_attach_lock(struct dentry *dentry, struct inode *inode, |
50 | u64 parent_blkno); | 50 | u64 parent_blkno); |
51 | 51 | ||
52 | extern spinlock_t dentry_list_lock; | ||
53 | |||
52 | void ocfs2_dentry_lock_put(struct ocfs2_super *osb, | 54 | void ocfs2_dentry_lock_put(struct ocfs2_super *osb, |
53 | struct ocfs2_dentry_lock *dl); | 55 | struct ocfs2_dentry_lock *dl); |
54 | 56 | ||
55 | void ocfs2_drop_dl_inodes(struct work_struct *work); | 57 | void ocfs2_drop_dl_inodes(struct work_struct *work); |
58 | void ocfs2_drop_all_dl_inodes(struct ocfs2_super *osb); | ||
56 | 59 | ||
57 | struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno, | 60 | struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno, |
58 | int skip_unhashed); | 61 | int skip_unhashed); |
diff --git a/fs/ocfs2/dlm/dlmast.c b/fs/ocfs2/dlm/dlmast.c index d07ddbe4b283..81eff8e58322 100644 --- a/fs/ocfs2/dlm/dlmast.c +++ b/fs/ocfs2/dlm/dlmast.c | |||
@@ -103,7 +103,6 @@ static void __dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock) | |||
103 | lock->ast_pending, lock->ml.type); | 103 | lock->ast_pending, lock->ml.type); |
104 | BUG(); | 104 | BUG(); |
105 | } | 105 | } |
106 | BUG_ON(!list_empty(&lock->ast_list)); | ||
107 | if (lock->ast_pending) | 106 | if (lock->ast_pending) |
108 | mlog(0, "lock has an ast getting flushed right now\n"); | 107 | mlog(0, "lock has an ast getting flushed right now\n"); |
109 | 108 | ||
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index bcb9260c3735..43e6e3280569 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -1118,7 +1118,7 @@ static int dlm_send_mig_lockres_msg(struct dlm_ctxt *dlm, | |||
1118 | 1118 | ||
1119 | mlog(0, "%s:%.*s: sending mig lockres (%s) to %u\n", | 1119 | mlog(0, "%s:%.*s: sending mig lockres (%s) to %u\n", |
1120 | dlm->name, res->lockname.len, res->lockname.name, | 1120 | dlm->name, res->lockname.len, res->lockname.name, |
1121 | orig_flags & DLM_MRES_MIGRATION ? "migrate" : "recovery", | 1121 | orig_flags & DLM_MRES_MIGRATION ? "migration" : "recovery", |
1122 | send_to); | 1122 | send_to); |
1123 | 1123 | ||
1124 | /* send it */ | 1124 | /* send it */ |
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c index fcf879ed6930..756f5b0998e0 100644 --- a/fs/ocfs2/dlm/dlmunlock.c +++ b/fs/ocfs2/dlm/dlmunlock.c | |||
@@ -122,7 +122,7 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm, | |||
122 | * that still has AST's pending... */ | 122 | * that still has AST's pending... */ |
123 | in_use = !list_empty(&lock->ast_list); | 123 | in_use = !list_empty(&lock->ast_list); |
124 | spin_unlock(&dlm->ast_lock); | 124 | spin_unlock(&dlm->ast_lock); |
125 | if (in_use) { | 125 | if (in_use && !(flags & LKM_CANCEL)) { |
126 | mlog(ML_ERROR, "lockres %.*s: Someone is calling dlmunlock " | 126 | mlog(ML_ERROR, "lockres %.*s: Someone is calling dlmunlock " |
127 | "while waiting for an ast!", res->lockname.len, | 127 | "while waiting for an ast!", res->lockname.len, |
128 | res->lockname.name); | 128 | res->lockname.name); |
@@ -131,7 +131,7 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm, | |||
131 | 131 | ||
132 | spin_lock(&res->spinlock); | 132 | spin_lock(&res->spinlock); |
133 | if (res->state & DLM_LOCK_RES_IN_PROGRESS) { | 133 | if (res->state & DLM_LOCK_RES_IN_PROGRESS) { |
134 | if (master_node) { | 134 | if (master_node && !(flags & LKM_CANCEL)) { |
135 | mlog(ML_ERROR, "lockres in progress!\n"); | 135 | mlog(ML_ERROR, "lockres in progress!\n"); |
136 | spin_unlock(&res->spinlock); | 136 | spin_unlock(&res->spinlock); |
137 | return DLM_FORWARD; | 137 | return DLM_FORWARD; |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 62442e413a00..aa501d3f93f1 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1851,6 +1851,7 @@ relock: | |||
1851 | if (ret) | 1851 | if (ret) |
1852 | goto out_dio; | 1852 | goto out_dio; |
1853 | 1853 | ||
1854 | count = ocount; | ||
1854 | ret = generic_write_checks(file, ppos, &count, | 1855 | ret = generic_write_checks(file, ppos, &count, |
1855 | S_ISBLK(inode->i_mode)); | 1856 | S_ISBLK(inode->i_mode)); |
1856 | if (ret) | 1857 | if (ret) |
@@ -1918,8 +1919,10 @@ out_sems: | |||
1918 | 1919 | ||
1919 | mutex_unlock(&inode->i_mutex); | 1920 | mutex_unlock(&inode->i_mutex); |
1920 | 1921 | ||
1922 | if (written) | ||
1923 | ret = written; | ||
1921 | mlog_exit(ret); | 1924 | mlog_exit(ret); |
1922 | return written ? written : ret; | 1925 | return ret; |
1923 | } | 1926 | } |
1924 | 1927 | ||
1925 | static int ocfs2_splice_to_file(struct pipe_inode_info *pipe, | 1928 | static int ocfs2_splice_to_file(struct pipe_inode_info *pipe, |
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index f033760ecbea..c48b93ac6b65 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -1954,10 +1954,16 @@ void ocfs2_orphan_scan_init(struct ocfs2_super *osb) | |||
1954 | os->os_osb = osb; | 1954 | os->os_osb = osb; |
1955 | os->os_count = 0; | 1955 | os->os_count = 0; |
1956 | os->os_seqno = 0; | 1956 | os->os_seqno = 0; |
1957 | os->os_scantime = CURRENT_TIME; | ||
1958 | mutex_init(&os->os_lock); | 1957 | mutex_init(&os->os_lock); |
1959 | INIT_DELAYED_WORK(&os->os_orphan_scan_work, ocfs2_orphan_scan_work); | 1958 | INIT_DELAYED_WORK(&os->os_orphan_scan_work, ocfs2_orphan_scan_work); |
1959 | } | ||
1960 | 1960 | ||
1961 | void ocfs2_orphan_scan_start(struct ocfs2_super *osb) | ||
1962 | { | ||
1963 | struct ocfs2_orphan_scan *os; | ||
1964 | |||
1965 | os = &osb->osb_orphan_scan; | ||
1966 | os->os_scantime = CURRENT_TIME; | ||
1961 | if (ocfs2_is_hard_readonly(osb) || ocfs2_mount_local(osb)) | 1967 | if (ocfs2_is_hard_readonly(osb) || ocfs2_mount_local(osb)) |
1962 | atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE); | 1968 | atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE); |
1963 | else { | 1969 | else { |
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 5432c7f79cc6..2c3222aec622 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -145,6 +145,7 @@ static inline void ocfs2_inode_set_new(struct ocfs2_super *osb, | |||
145 | 145 | ||
146 | /* Exported only for the journal struct init code in super.c. Do not call. */ | 146 | /* Exported only for the journal struct init code in super.c. Do not call. */ |
147 | void ocfs2_orphan_scan_init(struct ocfs2_super *osb); | 147 | void ocfs2_orphan_scan_init(struct ocfs2_super *osb); |
148 | void ocfs2_orphan_scan_start(struct ocfs2_super *osb); | ||
148 | void ocfs2_orphan_scan_stop(struct ocfs2_super *osb); | 149 | void ocfs2_orphan_scan_stop(struct ocfs2_super *osb); |
149 | void ocfs2_orphan_scan_exit(struct ocfs2_super *osb); | 150 | void ocfs2_orphan_scan_exit(struct ocfs2_super *osb); |
150 | 151 | ||
@@ -329,20 +330,27 @@ int ocfs2_journal_dirty(handle_t *handle, | |||
329 | /* extended attribute block update */ | 330 | /* extended attribute block update */ |
330 | #define OCFS2_XATTR_BLOCK_UPDATE_CREDITS 1 | 331 | #define OCFS2_XATTR_BLOCK_UPDATE_CREDITS 1 |
331 | 332 | ||
333 | /* Update of a single quota block */ | ||
334 | #define OCFS2_QUOTA_BLOCK_UPDATE_CREDITS 1 | ||
335 | |||
332 | /* global quotafile inode update, data block */ | 336 | /* global quotafile inode update, data block */ |
333 | #define OCFS2_QINFO_WRITE_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 1) | 337 | #define OCFS2_QINFO_WRITE_CREDITS (OCFS2_INODE_UPDATE_CREDITS + \ |
338 | OCFS2_QUOTA_BLOCK_UPDATE_CREDITS) | ||
334 | 339 | ||
340 | #define OCFS2_LOCAL_QINFO_WRITE_CREDITS OCFS2_QUOTA_BLOCK_UPDATE_CREDITS | ||
335 | /* | 341 | /* |
336 | * The two writes below can accidentally see global info dirty due | 342 | * The two writes below can accidentally see global info dirty due |
337 | * to set_info() quotactl so make them prepared for the writes. | 343 | * to set_info() quotactl so make them prepared for the writes. |
338 | */ | 344 | */ |
339 | /* quota data block, global info */ | 345 | /* quota data block, global info */ |
340 | /* Write to local quota file */ | 346 | /* Write to local quota file */ |
341 | #define OCFS2_QWRITE_CREDITS (OCFS2_QINFO_WRITE_CREDITS + 1) | 347 | #define OCFS2_QWRITE_CREDITS (OCFS2_QINFO_WRITE_CREDITS + \ |
348 | OCFS2_QUOTA_BLOCK_UPDATE_CREDITS) | ||
342 | 349 | ||
343 | /* global quota data block, local quota data block, global quota inode, | 350 | /* global quota data block, local quota data block, global quota inode, |
344 | * global quota info */ | 351 | * global quota info */ |
345 | #define OCFS2_QSYNC_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 3) | 352 | #define OCFS2_QSYNC_CREDITS (OCFS2_QINFO_WRITE_CREDITS + \ |
353 | 2 * OCFS2_QUOTA_BLOCK_UPDATE_CREDITS) | ||
346 | 354 | ||
347 | static inline int ocfs2_quota_trans_credits(struct super_block *sb) | 355 | static inline int ocfs2_quota_trans_credits(struct super_block *sb) |
348 | { | 356 | { |
@@ -355,11 +363,6 @@ static inline int ocfs2_quota_trans_credits(struct super_block *sb) | |||
355 | return credits; | 363 | return credits; |
356 | } | 364 | } |
357 | 365 | ||
358 | /* Number of credits needed for removing quota structure from file */ | ||
359 | int ocfs2_calc_qdel_credits(struct super_block *sb, int type); | ||
360 | /* Number of credits needed for initialization of new quota structure */ | ||
361 | int ocfs2_calc_qinit_credits(struct super_block *sb, int type); | ||
362 | |||
363 | /* group extend. inode update and last group update. */ | 366 | /* group extend. inode update and last group update. */ |
364 | #define OCFS2_GROUP_EXTEND_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 1) | 367 | #define OCFS2_GROUP_EXTEND_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 1) |
365 | 368 | ||
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index c9345ebb8493..39e1d5a39505 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -224,10 +224,12 @@ enum ocfs2_mount_options | |||
224 | OCFS2_MOUNT_GRPQUOTA = 1 << 10, /* We support group quotas */ | 224 | OCFS2_MOUNT_GRPQUOTA = 1 << 10, /* We support group quotas */ |
225 | }; | 225 | }; |
226 | 226 | ||
227 | #define OCFS2_OSB_SOFT_RO 0x0001 | 227 | #define OCFS2_OSB_SOFT_RO 0x0001 |
228 | #define OCFS2_OSB_HARD_RO 0x0002 | 228 | #define OCFS2_OSB_HARD_RO 0x0002 |
229 | #define OCFS2_OSB_ERROR_FS 0x0004 | 229 | #define OCFS2_OSB_ERROR_FS 0x0004 |
230 | #define OCFS2_DEFAULT_ATIME_QUANTUM 60 | 230 | #define OCFS2_OSB_DROP_DENTRY_LOCK_IMMED 0x0008 |
231 | |||
232 | #define OCFS2_DEFAULT_ATIME_QUANTUM 60 | ||
231 | 233 | ||
232 | struct ocfs2_journal; | 234 | struct ocfs2_journal; |
233 | struct ocfs2_slot_info; | 235 | struct ocfs2_slot_info; |
@@ -490,6 +492,18 @@ static inline void ocfs2_set_osb_flag(struct ocfs2_super *osb, | |||
490 | spin_unlock(&osb->osb_lock); | 492 | spin_unlock(&osb->osb_lock); |
491 | } | 493 | } |
492 | 494 | ||
495 | |||
496 | static inline unsigned long ocfs2_test_osb_flag(struct ocfs2_super *osb, | ||
497 | unsigned long flag) | ||
498 | { | ||
499 | unsigned long ret; | ||
500 | |||
501 | spin_lock(&osb->osb_lock); | ||
502 | ret = osb->osb_flags & flag; | ||
503 | spin_unlock(&osb->osb_lock); | ||
504 | return ret; | ||
505 | } | ||
506 | |||
493 | static inline void ocfs2_set_ro_flag(struct ocfs2_super *osb, | 507 | static inline void ocfs2_set_ro_flag(struct ocfs2_super *osb, |
494 | int hard) | 508 | int hard) |
495 | { | 509 | { |
diff --git a/fs/ocfs2/ocfs2_lockid.h b/fs/ocfs2/ocfs2_lockid.h index fcdba091af3d..c212cf5a2bdf 100644 --- a/fs/ocfs2/ocfs2_lockid.h +++ b/fs/ocfs2/ocfs2_lockid.h | |||
@@ -108,6 +108,7 @@ static char *ocfs2_lock_type_strings[] = { | |||
108 | [OCFS2_LOCK_TYPE_OPEN] = "Open", | 108 | [OCFS2_LOCK_TYPE_OPEN] = "Open", |
109 | [OCFS2_LOCK_TYPE_FLOCK] = "Flock", | 109 | [OCFS2_LOCK_TYPE_FLOCK] = "Flock", |
110 | [OCFS2_LOCK_TYPE_QINFO] = "Quota", | 110 | [OCFS2_LOCK_TYPE_QINFO] = "Quota", |
111 | [OCFS2_LOCK_TYPE_NFS_SYNC] = "NFSSync", | ||
111 | [OCFS2_LOCK_TYPE_ORPHAN_SCAN] = "OrphanScan", | 112 | [OCFS2_LOCK_TYPE_ORPHAN_SCAN] = "OrphanScan", |
112 | }; | 113 | }; |
113 | 114 | ||
diff --git a/fs/ocfs2/quota.h b/fs/ocfs2/quota.h index 7365e2e08706..3fb96fcd4c81 100644 --- a/fs/ocfs2/quota.h +++ b/fs/ocfs2/quota.h | |||
@@ -50,7 +50,6 @@ struct ocfs2_mem_dqinfo { | |||
50 | unsigned int dqi_chunks; /* Number of chunks in local quota file */ | 50 | unsigned int dqi_chunks; /* Number of chunks in local quota file */ |
51 | unsigned int dqi_blocks; /* Number of blocks allocated for local quota file */ | 51 | unsigned int dqi_blocks; /* Number of blocks allocated for local quota file */ |
52 | unsigned int dqi_syncms; /* How often should we sync with other nodes */ | 52 | unsigned int dqi_syncms; /* How often should we sync with other nodes */ |
53 | unsigned int dqi_syncjiff; /* Precomputed dqi_syncms in jiffies */ | ||
54 | struct list_head dqi_chunk; /* List of chunks */ | 53 | struct list_head dqi_chunk; /* List of chunks */ |
55 | struct inode *dqi_gqinode; /* Global quota file inode */ | 54 | struct inode *dqi_gqinode; /* Global quota file inode */ |
56 | struct ocfs2_lock_res dqi_gqlock; /* Lock protecting quota information structure */ | 55 | struct ocfs2_lock_res dqi_gqlock; /* Lock protecting quota information structure */ |
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index edfa60cd155c..44f2a5e1d042 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "sysfile.h" | 23 | #include "sysfile.h" |
24 | #include "dlmglue.h" | 24 | #include "dlmglue.h" |
25 | #include "uptodate.h" | 25 | #include "uptodate.h" |
26 | #include "super.h" | ||
26 | #include "quota.h" | 27 | #include "quota.h" |
27 | 28 | ||
28 | static struct workqueue_struct *ocfs2_quota_wq = NULL; | 29 | static struct workqueue_struct *ocfs2_quota_wq = NULL; |
@@ -69,6 +70,7 @@ static void ocfs2_global_mem2diskdqb(void *dp, struct dquot *dquot) | |||
69 | d->dqb_curspace = cpu_to_le64(m->dqb_curspace); | 70 | d->dqb_curspace = cpu_to_le64(m->dqb_curspace); |
70 | d->dqb_btime = cpu_to_le64(m->dqb_btime); | 71 | d->dqb_btime = cpu_to_le64(m->dqb_btime); |
71 | d->dqb_itime = cpu_to_le64(m->dqb_itime); | 72 | d->dqb_itime = cpu_to_le64(m->dqb_itime); |
73 | d->dqb_pad1 = d->dqb_pad2 = 0; | ||
72 | } | 74 | } |
73 | 75 | ||
74 | static int ocfs2_global_is_id(void *dp, struct dquot *dquot) | 76 | static int ocfs2_global_is_id(void *dp, struct dquot *dquot) |
@@ -113,6 +115,15 @@ int ocfs2_read_quota_block(struct inode *inode, u64 v_block, | |||
113 | int rc = 0; | 115 | int rc = 0; |
114 | struct buffer_head *tmp = *bh; | 116 | struct buffer_head *tmp = *bh; |
115 | 117 | ||
118 | if (i_size_read(inode) >> inode->i_sb->s_blocksize_bits <= v_block) { | ||
119 | ocfs2_error(inode->i_sb, | ||
120 | "Quota file %llu is probably corrupted! Requested " | ||
121 | "to read block %Lu but file has size only %Lu\n", | ||
122 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
123 | (unsigned long long)v_block, | ||
124 | (unsigned long long)i_size_read(inode)); | ||
125 | return -EIO; | ||
126 | } | ||
116 | rc = ocfs2_read_virt_blocks(inode, v_block, 1, &tmp, 0, | 127 | rc = ocfs2_read_virt_blocks(inode, v_block, 1, &tmp, 0, |
117 | ocfs2_validate_quota_block); | 128 | ocfs2_validate_quota_block); |
118 | if (rc) | 129 | if (rc) |
@@ -211,14 +222,13 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type, | |||
211 | 222 | ||
212 | mutex_lock_nested(&gqinode->i_mutex, I_MUTEX_QUOTA); | 223 | mutex_lock_nested(&gqinode->i_mutex, I_MUTEX_QUOTA); |
213 | if (gqinode->i_size < off + len) { | 224 | if (gqinode->i_size < off + len) { |
214 | down_write(&OCFS2_I(gqinode)->ip_alloc_sem); | 225 | loff_t rounded_end = |
215 | err = ocfs2_extend_no_holes(gqinode, off + len, off); | 226 | ocfs2_align_bytes_to_blocks(sb, off + len); |
216 | up_write(&OCFS2_I(gqinode)->ip_alloc_sem); | 227 | |
217 | if (err < 0) | 228 | /* Space is already allocated in ocfs2_global_read_dquot() */ |
218 | goto out; | ||
219 | err = ocfs2_simple_size_update(gqinode, | 229 | err = ocfs2_simple_size_update(gqinode, |
220 | oinfo->dqi_gqi_bh, | 230 | oinfo->dqi_gqi_bh, |
221 | off + len); | 231 | rounded_end); |
222 | if (err < 0) | 232 | if (err < 0) |
223 | goto out; | 233 | goto out; |
224 | new = 1; | 234 | new = 1; |
@@ -234,7 +244,7 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type, | |||
234 | } | 244 | } |
235 | if (err) { | 245 | if (err) { |
236 | mlog_errno(err); | 246 | mlog_errno(err); |
237 | return err; | 247 | goto out; |
238 | } | 248 | } |
239 | lock_buffer(bh); | 249 | lock_buffer(bh); |
240 | if (new) | 250 | if (new) |
@@ -342,7 +352,6 @@ int ocfs2_global_read_info(struct super_block *sb, int type) | |||
342 | info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace); | 352 | info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace); |
343 | info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace); | 353 | info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace); |
344 | oinfo->dqi_syncms = le32_to_cpu(dinfo.dqi_syncms); | 354 | oinfo->dqi_syncms = le32_to_cpu(dinfo.dqi_syncms); |
345 | oinfo->dqi_syncjiff = msecs_to_jiffies(oinfo->dqi_syncms); | ||
346 | oinfo->dqi_gi.dqi_blocks = le32_to_cpu(dinfo.dqi_blocks); | 355 | oinfo->dqi_gi.dqi_blocks = le32_to_cpu(dinfo.dqi_blocks); |
347 | oinfo->dqi_gi.dqi_free_blk = le32_to_cpu(dinfo.dqi_free_blk); | 356 | oinfo->dqi_gi.dqi_free_blk = le32_to_cpu(dinfo.dqi_free_blk); |
348 | oinfo->dqi_gi.dqi_free_entry = le32_to_cpu(dinfo.dqi_free_entry); | 357 | oinfo->dqi_gi.dqi_free_entry = le32_to_cpu(dinfo.dqi_free_entry); |
@@ -352,7 +361,7 @@ int ocfs2_global_read_info(struct super_block *sb, int type) | |||
352 | oinfo->dqi_gi.dqi_qtree_depth = qtree_depth(&oinfo->dqi_gi); | 361 | oinfo->dqi_gi.dqi_qtree_depth = qtree_depth(&oinfo->dqi_gi); |
353 | INIT_DELAYED_WORK(&oinfo->dqi_sync_work, qsync_work_fn); | 362 | INIT_DELAYED_WORK(&oinfo->dqi_sync_work, qsync_work_fn); |
354 | queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work, | 363 | queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work, |
355 | oinfo->dqi_syncjiff); | 364 | msecs_to_jiffies(oinfo->dqi_syncms)); |
356 | 365 | ||
357 | out_err: | 366 | out_err: |
358 | mlog_exit(status); | 367 | mlog_exit(status); |
@@ -402,13 +411,36 @@ int ocfs2_global_write_info(struct super_block *sb, int type) | |||
402 | return err; | 411 | return err; |
403 | } | 412 | } |
404 | 413 | ||
414 | static int ocfs2_global_qinit_alloc(struct super_block *sb, int type) | ||
415 | { | ||
416 | struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; | ||
417 | |||
418 | /* | ||
419 | * We may need to allocate tree blocks and a leaf block but not the | ||
420 | * root block | ||
421 | */ | ||
422 | return oinfo->dqi_gi.dqi_qtree_depth; | ||
423 | } | ||
424 | |||
425 | static int ocfs2_calc_global_qinit_credits(struct super_block *sb, int type) | ||
426 | { | ||
427 | /* We modify all the allocated blocks, tree root, and info block */ | ||
428 | return (ocfs2_global_qinit_alloc(sb, type) + 2) * | ||
429 | OCFS2_QUOTA_BLOCK_UPDATE_CREDITS; | ||
430 | } | ||
431 | |||
405 | /* Read in information from global quota file and acquire a reference to it. | 432 | /* Read in information from global quota file and acquire a reference to it. |
406 | * dquot_acquire() has already started the transaction and locked quota file */ | 433 | * dquot_acquire() has already started the transaction and locked quota file */ |
407 | int ocfs2_global_read_dquot(struct dquot *dquot) | 434 | int ocfs2_global_read_dquot(struct dquot *dquot) |
408 | { | 435 | { |
409 | int err, err2, ex = 0; | 436 | int err, err2, ex = 0; |
410 | struct ocfs2_mem_dqinfo *info = | 437 | struct super_block *sb = dquot->dq_sb; |
411 | sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv; | 438 | int type = dquot->dq_type; |
439 | struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv; | ||
440 | struct ocfs2_super *osb = OCFS2_SB(sb); | ||
441 | struct inode *gqinode = info->dqi_gqinode; | ||
442 | int need_alloc = ocfs2_global_qinit_alloc(sb, type); | ||
443 | handle_t *handle = NULL; | ||
412 | 444 | ||
413 | err = ocfs2_qinfo_lock(info, 0); | 445 | err = ocfs2_qinfo_lock(info, 0); |
414 | if (err < 0) | 446 | if (err < 0) |
@@ -419,14 +451,33 @@ int ocfs2_global_read_dquot(struct dquot *dquot) | |||
419 | OCFS2_DQUOT(dquot)->dq_use_count++; | 451 | OCFS2_DQUOT(dquot)->dq_use_count++; |
420 | OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace; | 452 | OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace; |
421 | OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes; | 453 | OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes; |
454 | ocfs2_qinfo_unlock(info, 0); | ||
455 | |||
422 | if (!dquot->dq_off) { /* No real quota entry? */ | 456 | if (!dquot->dq_off) { /* No real quota entry? */ |
423 | /* Upgrade to exclusive lock for allocation */ | ||
424 | ocfs2_qinfo_unlock(info, 0); | ||
425 | err = ocfs2_qinfo_lock(info, 1); | ||
426 | if (err < 0) | ||
427 | goto out_qlock; | ||
428 | ex = 1; | 457 | ex = 1; |
458 | /* | ||
459 | * Add blocks to quota file before we start a transaction since | ||
460 | * locking allocators ranks above a transaction start | ||
461 | */ | ||
462 | WARN_ON(journal_current_handle()); | ||
463 | down_write(&OCFS2_I(gqinode)->ip_alloc_sem); | ||
464 | err = ocfs2_extend_no_holes(gqinode, | ||
465 | gqinode->i_size + (need_alloc << sb->s_blocksize_bits), | ||
466 | gqinode->i_size); | ||
467 | up_write(&OCFS2_I(gqinode)->ip_alloc_sem); | ||
468 | if (err < 0) | ||
469 | goto out; | ||
429 | } | 470 | } |
471 | |||
472 | handle = ocfs2_start_trans(osb, | ||
473 | ocfs2_calc_global_qinit_credits(sb, type)); | ||
474 | if (IS_ERR(handle)) { | ||
475 | err = PTR_ERR(handle); | ||
476 | goto out; | ||
477 | } | ||
478 | err = ocfs2_qinfo_lock(info, ex); | ||
479 | if (err < 0) | ||
480 | goto out_trans; | ||
430 | err = qtree_write_dquot(&info->dqi_gi, dquot); | 481 | err = qtree_write_dquot(&info->dqi_gi, dquot); |
431 | if (ex && info_dirty(sb_dqinfo(dquot->dq_sb, dquot->dq_type))) { | 482 | if (ex && info_dirty(sb_dqinfo(dquot->dq_sb, dquot->dq_type))) { |
432 | err2 = __ocfs2_global_write_info(dquot->dq_sb, dquot->dq_type); | 483 | err2 = __ocfs2_global_write_info(dquot->dq_sb, dquot->dq_type); |
@@ -438,6 +489,9 @@ out_qlock: | |||
438 | ocfs2_qinfo_unlock(info, 1); | 489 | ocfs2_qinfo_unlock(info, 1); |
439 | else | 490 | else |
440 | ocfs2_qinfo_unlock(info, 0); | 491 | ocfs2_qinfo_unlock(info, 0); |
492 | out_trans: | ||
493 | if (handle) | ||
494 | ocfs2_commit_trans(osb, handle); | ||
441 | out: | 495 | out: |
442 | if (err < 0) | 496 | if (err < 0) |
443 | mlog_errno(err); | 497 | mlog_errno(err); |
@@ -607,7 +661,7 @@ static void qsync_work_fn(struct work_struct *work) | |||
607 | 661 | ||
608 | dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type); | 662 | dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type); |
609 | queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work, | 663 | queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work, |
610 | oinfo->dqi_syncjiff); | 664 | msecs_to_jiffies(oinfo->dqi_syncms)); |
611 | } | 665 | } |
612 | 666 | ||
613 | /* | 667 | /* |
@@ -635,20 +689,18 @@ out: | |||
635 | return status; | 689 | return status; |
636 | } | 690 | } |
637 | 691 | ||
638 | int ocfs2_calc_qdel_credits(struct super_block *sb, int type) | 692 | static int ocfs2_calc_qdel_credits(struct super_block *sb, int type) |
639 | { | 693 | { |
640 | struct ocfs2_mem_dqinfo *oinfo; | 694 | struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; |
641 | int features[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, | 695 | /* |
642 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA }; | 696 | * We modify tree, leaf block, global info, local chunk header, |
643 | 697 | * global and local inode; OCFS2_QINFO_WRITE_CREDITS already | |
644 | if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, features[type])) | 698 | * accounts for inode update |
645 | return 0; | 699 | */ |
646 | 700 | return (oinfo->dqi_gi.dqi_qtree_depth + 2) * | |
647 | oinfo = sb_dqinfo(sb, type)->dqi_priv; | 701 | OCFS2_QUOTA_BLOCK_UPDATE_CREDITS + |
648 | /* We modify tree, leaf block, global info, local chunk header, | 702 | OCFS2_QINFO_WRITE_CREDITS + |
649 | * global and local inode */ | 703 | OCFS2_INODE_UPDATE_CREDITS; |
650 | return oinfo->dqi_gi.dqi_qtree_depth + 2 + 1 + | ||
651 | 2 * OCFS2_INODE_UPDATE_CREDITS; | ||
652 | } | 704 | } |
653 | 705 | ||
654 | static int ocfs2_release_dquot(struct dquot *dquot) | 706 | static int ocfs2_release_dquot(struct dquot *dquot) |
@@ -680,33 +732,10 @@ out: | |||
680 | return status; | 732 | return status; |
681 | } | 733 | } |
682 | 734 | ||
683 | int ocfs2_calc_qinit_credits(struct super_block *sb, int type) | ||
684 | { | ||
685 | struct ocfs2_mem_dqinfo *oinfo; | ||
686 | int features[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, | ||
687 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA }; | ||
688 | struct ocfs2_dinode *lfe, *gfe; | ||
689 | |||
690 | if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, features[type])) | ||
691 | return 0; | ||
692 | |||
693 | oinfo = sb_dqinfo(sb, type)->dqi_priv; | ||
694 | gfe = (struct ocfs2_dinode *)oinfo->dqi_gqi_bh->b_data; | ||
695 | lfe = (struct ocfs2_dinode *)oinfo->dqi_lqi_bh->b_data; | ||
696 | /* We can extend local file + global file. In local file we | ||
697 | * can modify info, chunk header block and dquot block. In | ||
698 | * global file we can modify info, tree and leaf block */ | ||
699 | return ocfs2_calc_extend_credits(sb, &lfe->id2.i_list, 0) + | ||
700 | ocfs2_calc_extend_credits(sb, &gfe->id2.i_list, 0) + | ||
701 | 3 + oinfo->dqi_gi.dqi_qtree_depth + 2; | ||
702 | } | ||
703 | |||
704 | static int ocfs2_acquire_dquot(struct dquot *dquot) | 735 | static int ocfs2_acquire_dquot(struct dquot *dquot) |
705 | { | 736 | { |
706 | handle_t *handle; | ||
707 | struct ocfs2_mem_dqinfo *oinfo = | 737 | struct ocfs2_mem_dqinfo *oinfo = |
708 | sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv; | 738 | sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv; |
709 | struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb); | ||
710 | int status = 0; | 739 | int status = 0; |
711 | 740 | ||
712 | mlog_entry("id=%u, type=%d", dquot->dq_id, dquot->dq_type); | 741 | mlog_entry("id=%u, type=%d", dquot->dq_id, dquot->dq_type); |
@@ -715,16 +744,7 @@ static int ocfs2_acquire_dquot(struct dquot *dquot) | |||
715 | status = ocfs2_lock_global_qf(oinfo, 1); | 744 | status = ocfs2_lock_global_qf(oinfo, 1); |
716 | if (status < 0) | 745 | if (status < 0) |
717 | goto out; | 746 | goto out; |
718 | handle = ocfs2_start_trans(osb, | ||
719 | ocfs2_calc_qinit_credits(dquot->dq_sb, dquot->dq_type)); | ||
720 | if (IS_ERR(handle)) { | ||
721 | status = PTR_ERR(handle); | ||
722 | mlog_errno(status); | ||
723 | goto out_ilock; | ||
724 | } | ||
725 | status = dquot_acquire(dquot); | 747 | status = dquot_acquire(dquot); |
726 | ocfs2_commit_trans(osb, handle); | ||
727 | out_ilock: | ||
728 | ocfs2_unlock_global_qf(oinfo, 1); | 748 | ocfs2_unlock_global_qf(oinfo, 1); |
729 | out: | 749 | out: |
730 | mlog_exit(status); | 750 | mlog_exit(status); |
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index 5a460fa82553..bdb09cb6e1fe 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "sysfile.h" | 20 | #include "sysfile.h" |
21 | #include "dlmglue.h" | 21 | #include "dlmglue.h" |
22 | #include "quota.h" | 22 | #include "quota.h" |
23 | #include "uptodate.h" | ||
23 | 24 | ||
24 | /* Number of local quota structures per block */ | 25 | /* Number of local quota structures per block */ |
25 | static inline unsigned int ol_quota_entries_per_block(struct super_block *sb) | 26 | static inline unsigned int ol_quota_entries_per_block(struct super_block *sb) |
@@ -100,7 +101,8 @@ static int ocfs2_modify_bh(struct inode *inode, struct buffer_head *bh, | |||
100 | handle_t *handle; | 101 | handle_t *handle; |
101 | int status; | 102 | int status; |
102 | 103 | ||
103 | handle = ocfs2_start_trans(OCFS2_SB(sb), 1); | 104 | handle = ocfs2_start_trans(OCFS2_SB(sb), |
105 | OCFS2_QUOTA_BLOCK_UPDATE_CREDITS); | ||
104 | if (IS_ERR(handle)) { | 106 | if (IS_ERR(handle)) { |
105 | status = PTR_ERR(handle); | 107 | status = PTR_ERR(handle); |
106 | mlog_errno(status); | 108 | mlog_errno(status); |
@@ -610,7 +612,8 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, | |||
610 | goto out_bh; | 612 | goto out_bh; |
611 | /* Mark quota file as clean if we are recovering quota file of | 613 | /* Mark quota file as clean if we are recovering quota file of |
612 | * some other node. */ | 614 | * some other node. */ |
613 | handle = ocfs2_start_trans(osb, 1); | 615 | handle = ocfs2_start_trans(osb, |
616 | OCFS2_LOCAL_QINFO_WRITE_CREDITS); | ||
614 | if (IS_ERR(handle)) { | 617 | if (IS_ERR(handle)) { |
615 | status = PTR_ERR(handle); | 618 | status = PTR_ERR(handle); |
616 | mlog_errno(status); | 619 | mlog_errno(status); |
@@ -940,7 +943,7 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk( | |||
940 | struct ocfs2_local_disk_chunk *dchunk; | 943 | struct ocfs2_local_disk_chunk *dchunk; |
941 | int status; | 944 | int status; |
942 | handle_t *handle; | 945 | handle_t *handle; |
943 | struct buffer_head *bh = NULL; | 946 | struct buffer_head *bh = NULL, *dbh = NULL; |
944 | u64 p_blkno; | 947 | u64 p_blkno; |
945 | 948 | ||
946 | /* We are protected by dqio_sem so no locking needed */ | 949 | /* We are protected by dqio_sem so no locking needed */ |
@@ -964,32 +967,35 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk( | |||
964 | mlog_errno(status); | 967 | mlog_errno(status); |
965 | goto out; | 968 | goto out; |
966 | } | 969 | } |
970 | /* Local quota info and two new blocks we initialize */ | ||
971 | handle = ocfs2_start_trans(OCFS2_SB(sb), | ||
972 | OCFS2_LOCAL_QINFO_WRITE_CREDITS + | ||
973 | 2 * OCFS2_QUOTA_BLOCK_UPDATE_CREDITS); | ||
974 | if (IS_ERR(handle)) { | ||
975 | status = PTR_ERR(handle); | ||
976 | mlog_errno(status); | ||
977 | goto out; | ||
978 | } | ||
967 | 979 | ||
980 | /* Initialize chunk header */ | ||
968 | down_read(&OCFS2_I(lqinode)->ip_alloc_sem); | 981 | down_read(&OCFS2_I(lqinode)->ip_alloc_sem); |
969 | status = ocfs2_extent_map_get_blocks(lqinode, oinfo->dqi_blocks, | 982 | status = ocfs2_extent_map_get_blocks(lqinode, oinfo->dqi_blocks, |
970 | &p_blkno, NULL, NULL); | 983 | &p_blkno, NULL, NULL); |
971 | up_read(&OCFS2_I(lqinode)->ip_alloc_sem); | 984 | up_read(&OCFS2_I(lqinode)->ip_alloc_sem); |
972 | if (status < 0) { | 985 | if (status < 0) { |
973 | mlog_errno(status); | 986 | mlog_errno(status); |
974 | goto out; | 987 | goto out_trans; |
975 | } | 988 | } |
976 | bh = sb_getblk(sb, p_blkno); | 989 | bh = sb_getblk(sb, p_blkno); |
977 | if (!bh) { | 990 | if (!bh) { |
978 | status = -ENOMEM; | 991 | status = -ENOMEM; |
979 | mlog_errno(status); | 992 | mlog_errno(status); |
980 | goto out; | 993 | goto out_trans; |
981 | } | 994 | } |
982 | dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data; | 995 | dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data; |
983 | 996 | ocfs2_set_new_buffer_uptodate(lqinode, bh); | |
984 | handle = ocfs2_start_trans(OCFS2_SB(sb), 2); | ||
985 | if (IS_ERR(handle)) { | ||
986 | status = PTR_ERR(handle); | ||
987 | mlog_errno(status); | ||
988 | goto out; | ||
989 | } | ||
990 | |||
991 | status = ocfs2_journal_access_dq(handle, lqinode, bh, | 997 | status = ocfs2_journal_access_dq(handle, lqinode, bh, |
992 | OCFS2_JOURNAL_ACCESS_WRITE); | 998 | OCFS2_JOURNAL_ACCESS_CREATE); |
993 | if (status < 0) { | 999 | if (status < 0) { |
994 | mlog_errno(status); | 1000 | mlog_errno(status); |
995 | goto out_trans; | 1001 | goto out_trans; |
@@ -999,7 +1005,6 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk( | |||
999 | memset(dchunk->dqc_bitmap, 0, | 1005 | memset(dchunk->dqc_bitmap, 0, |
1000 | sb->s_blocksize - sizeof(struct ocfs2_local_disk_chunk) - | 1006 | sb->s_blocksize - sizeof(struct ocfs2_local_disk_chunk) - |
1001 | OCFS2_QBLK_RESERVED_SPACE); | 1007 | OCFS2_QBLK_RESERVED_SPACE); |
1002 | set_buffer_uptodate(bh); | ||
1003 | unlock_buffer(bh); | 1008 | unlock_buffer(bh); |
1004 | status = ocfs2_journal_dirty(handle, bh); | 1009 | status = ocfs2_journal_dirty(handle, bh); |
1005 | if (status < 0) { | 1010 | if (status < 0) { |
@@ -1007,6 +1012,38 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk( | |||
1007 | goto out_trans; | 1012 | goto out_trans; |
1008 | } | 1013 | } |
1009 | 1014 | ||
1015 | /* Initialize new block with structures */ | ||
1016 | down_read(&OCFS2_I(lqinode)->ip_alloc_sem); | ||
1017 | status = ocfs2_extent_map_get_blocks(lqinode, oinfo->dqi_blocks + 1, | ||
1018 | &p_blkno, NULL, NULL); | ||
1019 | up_read(&OCFS2_I(lqinode)->ip_alloc_sem); | ||
1020 | if (status < 0) { | ||
1021 | mlog_errno(status); | ||
1022 | goto out_trans; | ||
1023 | } | ||
1024 | dbh = sb_getblk(sb, p_blkno); | ||
1025 | if (!dbh) { | ||
1026 | status = -ENOMEM; | ||
1027 | mlog_errno(status); | ||
1028 | goto out_trans; | ||
1029 | } | ||
1030 | ocfs2_set_new_buffer_uptodate(lqinode, dbh); | ||
1031 | status = ocfs2_journal_access_dq(handle, lqinode, dbh, | ||
1032 | OCFS2_JOURNAL_ACCESS_CREATE); | ||
1033 | if (status < 0) { | ||
1034 | mlog_errno(status); | ||
1035 | goto out_trans; | ||
1036 | } | ||
1037 | lock_buffer(dbh); | ||
1038 | memset(dbh->b_data, 0, sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE); | ||
1039 | unlock_buffer(dbh); | ||
1040 | status = ocfs2_journal_dirty(handle, dbh); | ||
1041 | if (status < 0) { | ||
1042 | mlog_errno(status); | ||
1043 | goto out_trans; | ||
1044 | } | ||
1045 | |||
1046 | /* Update local quotafile info */ | ||
1010 | oinfo->dqi_blocks += 2; | 1047 | oinfo->dqi_blocks += 2; |
1011 | oinfo->dqi_chunks++; | 1048 | oinfo->dqi_chunks++; |
1012 | status = ocfs2_local_write_info(sb, type); | 1049 | status = ocfs2_local_write_info(sb, type); |
@@ -1031,6 +1068,7 @@ out_trans: | |||
1031 | ocfs2_commit_trans(OCFS2_SB(sb), handle); | 1068 | ocfs2_commit_trans(OCFS2_SB(sb), handle); |
1032 | out: | 1069 | out: |
1033 | brelse(bh); | 1070 | brelse(bh); |
1071 | brelse(dbh); | ||
1034 | kmem_cache_free(ocfs2_qf_chunk_cachep, chunk); | 1072 | kmem_cache_free(ocfs2_qf_chunk_cachep, chunk); |
1035 | return ERR_PTR(status); | 1073 | return ERR_PTR(status); |
1036 | } | 1074 | } |
@@ -1048,6 +1086,8 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file( | |||
1048 | struct ocfs2_local_disk_chunk *dchunk; | 1086 | struct ocfs2_local_disk_chunk *dchunk; |
1049 | int epb = ol_quota_entries_per_block(sb); | 1087 | int epb = ol_quota_entries_per_block(sb); |
1050 | unsigned int chunk_blocks; | 1088 | unsigned int chunk_blocks; |
1089 | struct buffer_head *bh; | ||
1090 | u64 p_blkno; | ||
1051 | int status; | 1091 | int status; |
1052 | handle_t *handle; | 1092 | handle_t *handle; |
1053 | 1093 | ||
@@ -1075,12 +1115,49 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file( | |||
1075 | mlog_errno(status); | 1115 | mlog_errno(status); |
1076 | goto out; | 1116 | goto out; |
1077 | } | 1117 | } |
1078 | handle = ocfs2_start_trans(OCFS2_SB(sb), 2); | 1118 | |
1119 | /* Get buffer from the just added block */ | ||
1120 | down_read(&OCFS2_I(lqinode)->ip_alloc_sem); | ||
1121 | status = ocfs2_extent_map_get_blocks(lqinode, oinfo->dqi_blocks, | ||
1122 | &p_blkno, NULL, NULL); | ||
1123 | up_read(&OCFS2_I(lqinode)->ip_alloc_sem); | ||
1124 | if (status < 0) { | ||
1125 | mlog_errno(status); | ||
1126 | goto out; | ||
1127 | } | ||
1128 | bh = sb_getblk(sb, p_blkno); | ||
1129 | if (!bh) { | ||
1130 | status = -ENOMEM; | ||
1131 | mlog_errno(status); | ||
1132 | goto out; | ||
1133 | } | ||
1134 | ocfs2_set_new_buffer_uptodate(lqinode, bh); | ||
1135 | |||
1136 | /* Local quota info, chunk header and the new block we initialize */ | ||
1137 | handle = ocfs2_start_trans(OCFS2_SB(sb), | ||
1138 | OCFS2_LOCAL_QINFO_WRITE_CREDITS + | ||
1139 | 2 * OCFS2_QUOTA_BLOCK_UPDATE_CREDITS); | ||
1079 | if (IS_ERR(handle)) { | 1140 | if (IS_ERR(handle)) { |
1080 | status = PTR_ERR(handle); | 1141 | status = PTR_ERR(handle); |
1081 | mlog_errno(status); | 1142 | mlog_errno(status); |
1082 | goto out; | 1143 | goto out; |
1083 | } | 1144 | } |
1145 | /* Zero created block */ | ||
1146 | status = ocfs2_journal_access_dq(handle, lqinode, bh, | ||
1147 | OCFS2_JOURNAL_ACCESS_CREATE); | ||
1148 | if (status < 0) { | ||
1149 | mlog_errno(status); | ||
1150 | goto out_trans; | ||
1151 | } | ||
1152 | lock_buffer(bh); | ||
1153 | memset(bh->b_data, 0, sb->s_blocksize); | ||
1154 | unlock_buffer(bh); | ||
1155 | status = ocfs2_journal_dirty(handle, bh); | ||
1156 | if (status < 0) { | ||
1157 | mlog_errno(status); | ||
1158 | goto out_trans; | ||
1159 | } | ||
1160 | /* Update chunk header */ | ||
1084 | status = ocfs2_journal_access_dq(handle, lqinode, chunk->qc_headerbh, | 1161 | status = ocfs2_journal_access_dq(handle, lqinode, chunk->qc_headerbh, |
1085 | OCFS2_JOURNAL_ACCESS_WRITE); | 1162 | OCFS2_JOURNAL_ACCESS_WRITE); |
1086 | if (status < 0) { | 1163 | if (status < 0) { |
@@ -1097,6 +1174,7 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file( | |||
1097 | mlog_errno(status); | 1174 | mlog_errno(status); |
1098 | goto out_trans; | 1175 | goto out_trans; |
1099 | } | 1176 | } |
1177 | /* Update file header */ | ||
1100 | oinfo->dqi_blocks++; | 1178 | oinfo->dqi_blocks++; |
1101 | status = ocfs2_local_write_info(sb, type); | 1179 | status = ocfs2_local_write_info(sb, type); |
1102 | if (status < 0) { | 1180 | if (status < 0) { |
diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c index 3f661376a2de..e49c41050264 100644 --- a/fs/ocfs2/stack_o2cb.c +++ b/fs/ocfs2/stack_o2cb.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * General Public License for more details. | 17 | * General Public License for more details. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/kernel.h> | ||
20 | #include <linux/crc32.h> | 21 | #include <linux/crc32.h> |
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
22 | 23 | ||
@@ -153,7 +154,7 @@ static int status_map[] = { | |||
153 | 154 | ||
154 | static int dlm_status_to_errno(enum dlm_status status) | 155 | static int dlm_status_to_errno(enum dlm_status status) |
155 | { | 156 | { |
156 | BUG_ON(status > (sizeof(status_map) / sizeof(status_map[0]))); | 157 | BUG_ON(status < 0 || status >= ARRAY_SIZE(status_map)); |
157 | 158 | ||
158 | return status_map[status]; | 159 | return status_map[status]; |
159 | } | 160 | } |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 7efb349fb9bd..a3f8871d21fd 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -777,6 +777,7 @@ static int ocfs2_sb_probe(struct super_block *sb, | |||
777 | } | 777 | } |
778 | di = (struct ocfs2_dinode *) (*bh)->b_data; | 778 | di = (struct ocfs2_dinode *) (*bh)->b_data; |
779 | memset(stats, 0, sizeof(struct ocfs2_blockcheck_stats)); | 779 | memset(stats, 0, sizeof(struct ocfs2_blockcheck_stats)); |
780 | spin_lock_init(&stats->b_lock); | ||
780 | status = ocfs2_verify_volume(di, *bh, blksize, stats); | 781 | status = ocfs2_verify_volume(di, *bh, blksize, stats); |
781 | if (status >= 0) | 782 | if (status >= 0) |
782 | goto bail; | 783 | goto bail; |
@@ -1182,7 +1183,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1182 | wake_up(&osb->osb_mount_event); | 1183 | wake_up(&osb->osb_mount_event); |
1183 | 1184 | ||
1184 | /* Start this when the mount is almost sure of being successful */ | 1185 | /* Start this when the mount is almost sure of being successful */ |
1185 | ocfs2_orphan_scan_init(osb); | 1186 | ocfs2_orphan_scan_start(osb); |
1186 | 1187 | ||
1187 | mlog_exit(status); | 1188 | mlog_exit(status); |
1188 | return status; | 1189 | return status; |
@@ -1213,14 +1214,31 @@ static int ocfs2_get_sb(struct file_system_type *fs_type, | |||
1213 | mnt); | 1214 | mnt); |
1214 | } | 1215 | } |
1215 | 1216 | ||
1217 | static void ocfs2_kill_sb(struct super_block *sb) | ||
1218 | { | ||
1219 | struct ocfs2_super *osb = OCFS2_SB(sb); | ||
1220 | |||
1221 | /* Failed mount? */ | ||
1222 | if (!osb || atomic_read(&osb->vol_state) == VOLUME_DISABLED) | ||
1223 | goto out; | ||
1224 | |||
1225 | /* Prevent further queueing of inode drop events */ | ||
1226 | spin_lock(&dentry_list_lock); | ||
1227 | ocfs2_set_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED); | ||
1228 | spin_unlock(&dentry_list_lock); | ||
1229 | /* Wait for work to finish and/or remove it */ | ||
1230 | cancel_work_sync(&osb->dentry_lock_work); | ||
1231 | out: | ||
1232 | kill_block_super(sb); | ||
1233 | } | ||
1234 | |||
1216 | static struct file_system_type ocfs2_fs_type = { | 1235 | static struct file_system_type ocfs2_fs_type = { |
1217 | .owner = THIS_MODULE, | 1236 | .owner = THIS_MODULE, |
1218 | .name = "ocfs2", | 1237 | .name = "ocfs2", |
1219 | .get_sb = ocfs2_get_sb, /* is this called when we mount | 1238 | .get_sb = ocfs2_get_sb, /* is this called when we mount |
1220 | * the fs? */ | 1239 | * the fs? */ |
1221 | .kill_sb = kill_block_super, /* set to the generic one | 1240 | .kill_sb = ocfs2_kill_sb, |
1222 | * right now, but do we | 1241 | |
1223 | * need to change that? */ | ||
1224 | .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE, | 1242 | .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE, |
1225 | .next = NULL | 1243 | .next = NULL |
1226 | }; | 1244 | }; |
@@ -1819,6 +1837,12 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) | |||
1819 | 1837 | ||
1820 | debugfs_remove(osb->osb_ctxt); | 1838 | debugfs_remove(osb->osb_ctxt); |
1821 | 1839 | ||
1840 | /* | ||
1841 | * Flush inode dropping work queue so that deletes are | ||
1842 | * performed while the filesystem is still working | ||
1843 | */ | ||
1844 | ocfs2_drop_all_dl_inodes(osb); | ||
1845 | |||
1822 | /* Orphan scan should be stopped as early as possible */ | 1846 | /* Orphan scan should be stopped as early as possible */ |
1823 | ocfs2_orphan_scan_stop(osb); | 1847 | ocfs2_orphan_scan_stop(osb); |
1824 | 1848 | ||
@@ -1981,6 +2005,8 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1981 | snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u", | 2005 | snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u", |
1982 | MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); | 2006 | MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); |
1983 | 2007 | ||
2008 | ocfs2_orphan_scan_init(osb); | ||
2009 | |||
1984 | status = ocfs2_recovery_init(osb); | 2010 | status = ocfs2_recovery_init(osb); |
1985 | if (status) { | 2011 | if (status) { |
1986 | mlog(ML_ERROR, "Unable to initialize recovery state\n"); | 2012 | mlog(ML_ERROR, "Unable to initialize recovery state\n"); |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index ba320e250747..d1a27cda984f 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -1052,7 +1052,8 @@ static int ocfs2_xattr_block_get(struct inode *inode, | |||
1052 | struct ocfs2_xattr_block *xb; | 1052 | struct ocfs2_xattr_block *xb; |
1053 | struct ocfs2_xattr_value_root *xv; | 1053 | struct ocfs2_xattr_value_root *xv; |
1054 | size_t size; | 1054 | size_t size; |
1055 | int ret = -ENODATA, name_offset, name_len, block_off, i; | 1055 | int ret = -ENODATA, name_offset, name_len, i; |
1056 | int uninitialized_var(block_off); | ||
1056 | 1057 | ||
1057 | xs->bucket = ocfs2_xattr_bucket_new(inode); | 1058 | xs->bucket = ocfs2_xattr_bucket_new(inode); |
1058 | if (!xs->bucket) { | 1059 | if (!xs->bucket) { |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 175db258942f..6f742f6658a9 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1003,12 +1003,7 @@ static ssize_t oom_adjust_read(struct file *file, char __user *buf, | |||
1003 | 1003 | ||
1004 | if (!task) | 1004 | if (!task) |
1005 | return -ESRCH; | 1005 | return -ESRCH; |
1006 | task_lock(task); | 1006 | oom_adjust = task->oomkilladj; |
1007 | if (task->mm) | ||
1008 | oom_adjust = task->mm->oom_adj; | ||
1009 | else | ||
1010 | oom_adjust = OOM_DISABLE; | ||
1011 | task_unlock(task); | ||
1012 | put_task_struct(task); | 1007 | put_task_struct(task); |
1013 | 1008 | ||
1014 | len = snprintf(buffer, sizeof(buffer), "%i\n", oom_adjust); | 1009 | len = snprintf(buffer, sizeof(buffer), "%i\n", oom_adjust); |
@@ -1037,19 +1032,11 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, | |||
1037 | task = get_proc_task(file->f_path.dentry->d_inode); | 1032 | task = get_proc_task(file->f_path.dentry->d_inode); |
1038 | if (!task) | 1033 | if (!task) |
1039 | return -ESRCH; | 1034 | return -ESRCH; |
1040 | task_lock(task); | 1035 | if (oom_adjust < task->oomkilladj && !capable(CAP_SYS_RESOURCE)) { |
1041 | if (!task->mm) { | ||
1042 | task_unlock(task); | ||
1043 | put_task_struct(task); | ||
1044 | return -EINVAL; | ||
1045 | } | ||
1046 | if (oom_adjust < task->mm->oom_adj && !capable(CAP_SYS_RESOURCE)) { | ||
1047 | task_unlock(task); | ||
1048 | put_task_struct(task); | 1036 | put_task_struct(task); |
1049 | return -EACCES; | 1037 | return -EACCES; |
1050 | } | 1038 | } |
1051 | task->mm->oom_adj = oom_adjust; | 1039 | task->oomkilladj = oom_adjust; |
1052 | task_unlock(task); | ||
1053 | put_task_struct(task); | 1040 | put_task_struct(task); |
1054 | if (end - buffer == 0) | 1041 | if (end - buffer == 0) |
1055 | return -EIO; | 1042 | return -EIO; |
diff --git a/fs/select.c b/fs/select.c index d870237e42c7..8084834e123e 100644 --- a/fs/select.c +++ b/fs/select.c | |||
@@ -110,6 +110,7 @@ void poll_initwait(struct poll_wqueues *pwq) | |||
110 | { | 110 | { |
111 | init_poll_funcptr(&pwq->pt, __pollwait); | 111 | init_poll_funcptr(&pwq->pt, __pollwait); |
112 | pwq->polling_task = current; | 112 | pwq->polling_task = current; |
113 | pwq->triggered = 0; | ||
113 | pwq->error = 0; | 114 | pwq->error = 0; |
114 | pwq->table = NULL; | 115 | pwq->table = NULL; |
115 | pwq->inline_index = 0; | 116 | pwq->inline_index = 0; |
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 0c93c7ef3d18..965df1227d64 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -770,7 +770,7 @@ xfs_buf_associate_memory( | |||
770 | bp->b_pages = NULL; | 770 | bp->b_pages = NULL; |
771 | bp->b_addr = mem; | 771 | bp->b_addr = mem; |
772 | 772 | ||
773 | rval = _xfs_buf_get_pages(bp, page_count, 0); | 773 | rval = _xfs_buf_get_pages(bp, page_count, XBF_DONT_BLOCK); |
774 | if (rval) | 774 | if (rval) |
775 | return rval; | 775 | return rval; |
776 | 776 | ||
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index 0882d166239a..eafcc7c18706 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
@@ -619,7 +619,7 @@ xfs_file_compat_ioctl( | |||
619 | case XFS_IOC_GETVERSION_32: | 619 | case XFS_IOC_GETVERSION_32: |
620 | cmd = _NATIVE_IOC(cmd, long); | 620 | cmd = _NATIVE_IOC(cmd, long); |
621 | return xfs_file_ioctl(filp, cmd, p); | 621 | return xfs_file_ioctl(filp, cmd, p); |
622 | case XFS_IOC_SWAPEXT: { | 622 | case XFS_IOC_SWAPEXT_32: { |
623 | struct xfs_swapext sxp; | 623 | struct xfs_swapext sxp; |
624 | struct compat_xfs_swapext __user *sxu = arg; | 624 | struct compat_xfs_swapext __user *sxu = arg; |
625 | 625 | ||
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index b619d6b8ca43..98ef624d9baf 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -708,6 +708,16 @@ xfs_reclaim_inode( | |||
708 | return 0; | 708 | return 0; |
709 | } | 709 | } |
710 | 710 | ||
711 | void | ||
712 | __xfs_inode_set_reclaim_tag( | ||
713 | struct xfs_perag *pag, | ||
714 | struct xfs_inode *ip) | ||
715 | { | ||
716 | radix_tree_tag_set(&pag->pag_ici_root, | ||
717 | XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino), | ||
718 | XFS_ICI_RECLAIM_TAG); | ||
719 | } | ||
720 | |||
711 | /* | 721 | /* |
712 | * We set the inode flag atomically with the radix tree tag. | 722 | * We set the inode flag atomically with the radix tree tag. |
713 | * Once we get tag lookups on the radix tree, this inode flag | 723 | * Once we get tag lookups on the radix tree, this inode flag |
@@ -722,8 +732,7 @@ xfs_inode_set_reclaim_tag( | |||
722 | 732 | ||
723 | read_lock(&pag->pag_ici_lock); | 733 | read_lock(&pag->pag_ici_lock); |
724 | spin_lock(&ip->i_flags_lock); | 734 | spin_lock(&ip->i_flags_lock); |
725 | radix_tree_tag_set(&pag->pag_ici_root, | 735 | __xfs_inode_set_reclaim_tag(pag, ip); |
726 | XFS_INO_TO_AGINO(mp, ip->i_ino), XFS_ICI_RECLAIM_TAG); | ||
727 | __xfs_iflags_set(ip, XFS_IRECLAIMABLE); | 736 | __xfs_iflags_set(ip, XFS_IRECLAIMABLE); |
728 | spin_unlock(&ip->i_flags_lock); | 737 | spin_unlock(&ip->i_flags_lock); |
729 | read_unlock(&pag->pag_ici_lock); | 738 | read_unlock(&pag->pag_ici_lock); |
diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/linux-2.6/xfs_sync.h index 2a10301c99c7..59120602588a 100644 --- a/fs/xfs/linux-2.6/xfs_sync.h +++ b/fs/xfs/linux-2.6/xfs_sync.h | |||
@@ -48,6 +48,7 @@ int xfs_reclaim_inode(struct xfs_inode *ip, int locked, int sync_mode); | |||
48 | int xfs_reclaim_inodes(struct xfs_mount *mp, int mode); | 48 | int xfs_reclaim_inodes(struct xfs_mount *mp, int mode); |
49 | 49 | ||
50 | void xfs_inode_set_reclaim_tag(struct xfs_inode *ip); | 50 | void xfs_inode_set_reclaim_tag(struct xfs_inode *ip); |
51 | void __xfs_inode_set_reclaim_tag(struct xfs_perag *pag, struct xfs_inode *ip); | ||
51 | void xfs_inode_clear_reclaim_tag(struct xfs_inode *ip); | 52 | void xfs_inode_clear_reclaim_tag(struct xfs_inode *ip); |
52 | void __xfs_inode_clear_reclaim_tag(struct xfs_mount *mp, struct xfs_perag *pag, | 53 | void __xfs_inode_clear_reclaim_tag(struct xfs_mount *mp, struct xfs_perag *pag, |
53 | struct xfs_inode *ip); | 54 | struct xfs_inode *ip); |
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index db15feb906ff..4ece1906bd41 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -2010,7 +2010,9 @@ xfs_attr_rmtval_get(xfs_da_args_t *args) | |||
2010 | dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock); | 2010 | dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock); |
2011 | blkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount); | 2011 | blkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount); |
2012 | error = xfs_read_buf(mp, mp->m_ddev_targp, dblkno, | 2012 | error = xfs_read_buf(mp, mp->m_ddev_targp, dblkno, |
2013 | blkcnt, XFS_BUF_LOCK, &bp); | 2013 | blkcnt, |
2014 | XFS_BUF_LOCK | XBF_DONT_BLOCK, | ||
2015 | &bp); | ||
2014 | if (error) | 2016 | if (error) |
2015 | return(error); | 2017 | return(error); |
2016 | 2018 | ||
@@ -2141,8 +2143,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2141 | dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock), | 2143 | dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock), |
2142 | blkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount); | 2144 | blkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount); |
2143 | 2145 | ||
2144 | bp = xfs_buf_get_flags(mp->m_ddev_targp, dblkno, | 2146 | bp = xfs_buf_get_flags(mp->m_ddev_targp, dblkno, blkcnt, |
2145 | blkcnt, XFS_BUF_LOCK); | 2147 | XFS_BUF_LOCK | XBF_DONT_BLOCK); |
2146 | ASSERT(bp); | 2148 | ASSERT(bp); |
2147 | ASSERT(!XFS_BUF_GETERROR(bp)); | 2149 | ASSERT(!XFS_BUF_GETERROR(bp)); |
2148 | 2150 | ||
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 7928b9983c1d..8ee5b5a76a2a 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -6009,7 +6009,7 @@ xfs_getbmap( | |||
6009 | */ | 6009 | */ |
6010 | error = ENOMEM; | 6010 | error = ENOMEM; |
6011 | subnex = 16; | 6011 | subnex = 16; |
6012 | map = kmem_alloc(subnex * sizeof(*map), KM_MAYFAIL); | 6012 | map = kmem_alloc(subnex * sizeof(*map), KM_MAYFAIL | KM_NOFS); |
6013 | if (!map) | 6013 | if (!map) |
6014 | goto out_unlock_ilock; | 6014 | goto out_unlock_ilock; |
6015 | 6015 | ||
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c index e9df99574829..26717388acf5 100644 --- a/fs/xfs/xfs_btree.c +++ b/fs/xfs/xfs_btree.c | |||
@@ -120,8 +120,8 @@ xfs_btree_check_sblock( | |||
120 | XFS_RANDOM_BTREE_CHECK_SBLOCK))) { | 120 | XFS_RANDOM_BTREE_CHECK_SBLOCK))) { |
121 | if (bp) | 121 | if (bp) |
122 | xfs_buftrace("SBTREE ERROR", bp); | 122 | xfs_buftrace("SBTREE ERROR", bp); |
123 | XFS_ERROR_REPORT("xfs_btree_check_sblock", XFS_ERRLEVEL_LOW, | 123 | XFS_CORRUPTION_ERROR("xfs_btree_check_sblock", |
124 | cur->bc_mp); | 124 | XFS_ERRLEVEL_LOW, cur->bc_mp, block); |
125 | return XFS_ERROR(EFSCORRUPTED); | 125 | return XFS_ERROR(EFSCORRUPTED); |
126 | } | 126 | } |
127 | return 0; | 127 | return 0; |
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index 9ff6e57a5075..2847bbc1c534 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c | |||
@@ -2201,7 +2201,7 @@ kmem_zone_t *xfs_dabuf_zone; /* dabuf zone */ | |||
2201 | xfs_da_state_t * | 2201 | xfs_da_state_t * |
2202 | xfs_da_state_alloc(void) | 2202 | xfs_da_state_alloc(void) |
2203 | { | 2203 | { |
2204 | return kmem_zone_zalloc(xfs_da_state_zone, KM_SLEEP); | 2204 | return kmem_zone_zalloc(xfs_da_state_zone, KM_NOFS); |
2205 | } | 2205 | } |
2206 | 2206 | ||
2207 | /* | 2207 | /* |
@@ -2261,9 +2261,9 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra) | |||
2261 | int off; | 2261 | int off; |
2262 | 2262 | ||
2263 | if (nbuf == 1) | 2263 | if (nbuf == 1) |
2264 | dabuf = kmem_zone_alloc(xfs_dabuf_zone, KM_SLEEP); | 2264 | dabuf = kmem_zone_alloc(xfs_dabuf_zone, KM_NOFS); |
2265 | else | 2265 | else |
2266 | dabuf = kmem_alloc(XFS_DA_BUF_SIZE(nbuf), KM_SLEEP); | 2266 | dabuf = kmem_alloc(XFS_DA_BUF_SIZE(nbuf), KM_NOFS); |
2267 | dabuf->dirty = 0; | 2267 | dabuf->dirty = 0; |
2268 | #ifdef XFS_DABUF_DEBUG | 2268 | #ifdef XFS_DABUF_DEBUG |
2269 | dabuf->ra = ra; | 2269 | dabuf->ra = ra; |
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c index c657bec6d951..bb1d58eb3982 100644 --- a/fs/xfs/xfs_dir2.c +++ b/fs/xfs/xfs_dir2.c | |||
@@ -256,7 +256,7 @@ xfs_dir_cilookup_result( | |||
256 | !(args->op_flags & XFS_DA_OP_CILOOKUP)) | 256 | !(args->op_flags & XFS_DA_OP_CILOOKUP)) |
257 | return EEXIST; | 257 | return EEXIST; |
258 | 258 | ||
259 | args->value = kmem_alloc(len, KM_MAYFAIL); | 259 | args->value = kmem_alloc(len, KM_NOFS | KM_MAYFAIL); |
260 | if (!args->value) | 260 | if (!args->value) |
261 | return ENOMEM; | 261 | return ENOMEM; |
262 | 262 | ||
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index cbd451bb4848..2d0b3e1da9e6 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c | |||
@@ -167,17 +167,25 @@ xfs_growfs_data_private( | |||
167 | new = nb - mp->m_sb.sb_dblocks; | 167 | new = nb - mp->m_sb.sb_dblocks; |
168 | oagcount = mp->m_sb.sb_agcount; | 168 | oagcount = mp->m_sb.sb_agcount; |
169 | if (nagcount > oagcount) { | 169 | if (nagcount > oagcount) { |
170 | void *new_perag, *old_perag; | ||
171 | |||
170 | xfs_filestream_flush(mp); | 172 | xfs_filestream_flush(mp); |
173 | |||
174 | new_perag = kmem_zalloc(sizeof(xfs_perag_t) * nagcount, | ||
175 | KM_MAYFAIL); | ||
176 | if (!new_perag) | ||
177 | return XFS_ERROR(ENOMEM); | ||
178 | |||
171 | down_write(&mp->m_peraglock); | 179 | down_write(&mp->m_peraglock); |
172 | mp->m_perag = kmem_realloc(mp->m_perag, | 180 | memcpy(new_perag, mp->m_perag, sizeof(xfs_perag_t) * oagcount); |
173 | sizeof(xfs_perag_t) * nagcount, | 181 | old_perag = mp->m_perag; |
174 | sizeof(xfs_perag_t) * oagcount, | 182 | mp->m_perag = new_perag; |
175 | KM_SLEEP); | 183 | |
176 | memset(&mp->m_perag[oagcount], 0, | ||
177 | (nagcount - oagcount) * sizeof(xfs_perag_t)); | ||
178 | mp->m_flags |= XFS_MOUNT_32BITINODES; | 184 | mp->m_flags |= XFS_MOUNT_32BITINODES; |
179 | nagimax = xfs_initialize_perag(mp, nagcount); | 185 | nagimax = xfs_initialize_perag(mp, nagcount); |
180 | up_write(&mp->m_peraglock); | 186 | up_write(&mp->m_peraglock); |
187 | |||
188 | kmem_free(old_perag); | ||
181 | } | 189 | } |
182 | tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS); | 190 | tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS); |
183 | tp->t_flags |= XFS_TRANS_RESERVE; | 191 | tp->t_flags |= XFS_TRANS_RESERVE; |
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 34ec86923f7e..ecbf8b4d2e2e 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -191,80 +191,82 @@ xfs_iget_cache_hit( | |||
191 | int flags, | 191 | int flags, |
192 | int lock_flags) __releases(pag->pag_ici_lock) | 192 | int lock_flags) __releases(pag->pag_ici_lock) |
193 | { | 193 | { |
194 | struct inode *inode = VFS_I(ip); | ||
194 | struct xfs_mount *mp = ip->i_mount; | 195 | struct xfs_mount *mp = ip->i_mount; |
195 | int error = EAGAIN; | 196 | int error; |
197 | |||
198 | spin_lock(&ip->i_flags_lock); | ||
196 | 199 | ||
197 | /* | 200 | /* |
198 | * If INEW is set this inode is being set up | 201 | * If we are racing with another cache hit that is currently |
199 | * If IRECLAIM is set this inode is being torn down | 202 | * instantiating this inode or currently recycling it out of |
200 | * Pause and try again. | 203 | * reclaimabe state, wait for the initialisation to complete |
204 | * before continuing. | ||
205 | * | ||
206 | * XXX(hch): eventually we should do something equivalent to | ||
207 | * wait_on_inode to wait for these flags to be cleared | ||
208 | * instead of polling for it. | ||
201 | */ | 209 | */ |
202 | if (xfs_iflags_test(ip, (XFS_INEW|XFS_IRECLAIM))) { | 210 | if (ip->i_flags & (XFS_INEW|XFS_IRECLAIM)) { |
203 | XFS_STATS_INC(xs_ig_frecycle); | 211 | XFS_STATS_INC(xs_ig_frecycle); |
212 | error = EAGAIN; | ||
204 | goto out_error; | 213 | goto out_error; |
205 | } | 214 | } |
206 | 215 | ||
207 | /* If IRECLAIMABLE is set, we've torn down the vfs inode part */ | 216 | /* |
208 | if (xfs_iflags_test(ip, XFS_IRECLAIMABLE)) { | 217 | * If lookup is racing with unlink return an error immediately. |
209 | 218 | */ | |
210 | /* | 219 | if (ip->i_d.di_mode == 0 && !(flags & XFS_IGET_CREATE)) { |
211 | * If lookup is racing with unlink, then we should return an | 220 | error = ENOENT; |
212 | * error immediately so we don't remove it from the reclaim | 221 | goto out_error; |
213 | * list and potentially leak the inode. | 222 | } |
214 | */ | ||
215 | if ((ip->i_d.di_mode == 0) && !(flags & XFS_IGET_CREATE)) { | ||
216 | error = ENOENT; | ||
217 | goto out_error; | ||
218 | } | ||
219 | 223 | ||
224 | /* | ||
225 | * If IRECLAIMABLE is set, we've torn down the VFS inode already. | ||
226 | * Need to carefully get it back into useable state. | ||
227 | */ | ||
228 | if (ip->i_flags & XFS_IRECLAIMABLE) { | ||
220 | xfs_itrace_exit_tag(ip, "xfs_iget.alloc"); | 229 | xfs_itrace_exit_tag(ip, "xfs_iget.alloc"); |
221 | 230 | ||
222 | /* | 231 | /* |
223 | * We need to re-initialise the VFS inode as it has been | 232 | * We need to set XFS_INEW atomically with clearing the |
224 | * 'freed' by the VFS. Do this here so we can deal with | 233 | * reclaimable tag so that we do have an indicator of the |
225 | * errors cleanly, then tag it so it can be set up correctly | 234 | * inode still being initialized. |
226 | * later. | ||
227 | */ | 235 | */ |
228 | if (inode_init_always(mp->m_super, VFS_I(ip))) { | 236 | ip->i_flags |= XFS_INEW; |
229 | error = ENOMEM; | 237 | ip->i_flags &= ~XFS_IRECLAIMABLE; |
230 | goto out_error; | 238 | __xfs_inode_clear_reclaim_tag(mp, pag, ip); |
231 | } | ||
232 | 239 | ||
233 | /* | 240 | spin_unlock(&ip->i_flags_lock); |
234 | * We must set the XFS_INEW flag before clearing the | 241 | read_unlock(&pag->pag_ici_lock); |
235 | * XFS_IRECLAIMABLE flag so that if a racing lookup does | ||
236 | * not find the XFS_IRECLAIMABLE above but has the igrab() | ||
237 | * below succeed we can safely check XFS_INEW to detect | ||
238 | * that this inode is still being initialised. | ||
239 | */ | ||
240 | xfs_iflags_set(ip, XFS_INEW); | ||
241 | xfs_iflags_clear(ip, XFS_IRECLAIMABLE); | ||
242 | 242 | ||
243 | /* clear the radix tree reclaim flag as well. */ | 243 | error = -inode_init_always(mp->m_super, inode); |
244 | __xfs_inode_clear_reclaim_tag(mp, pag, ip); | 244 | if (error) { |
245 | } else if (!igrab(VFS_I(ip))) { | 245 | /* |
246 | * Re-initializing the inode failed, and we are in deep | ||
247 | * trouble. Try to re-add it to the reclaim list. | ||
248 | */ | ||
249 | read_lock(&pag->pag_ici_lock); | ||
250 | spin_lock(&ip->i_flags_lock); | ||
251 | |||
252 | ip->i_flags &= ~XFS_INEW; | ||
253 | ip->i_flags |= XFS_IRECLAIMABLE; | ||
254 | __xfs_inode_set_reclaim_tag(pag, ip); | ||
255 | goto out_error; | ||
256 | } | ||
257 | inode->i_state = I_LOCK|I_NEW; | ||
258 | } else { | ||
246 | /* If the VFS inode is being torn down, pause and try again. */ | 259 | /* If the VFS inode is being torn down, pause and try again. */ |
247 | XFS_STATS_INC(xs_ig_frecycle); | 260 | if (!igrab(inode)) { |
248 | goto out_error; | 261 | error = EAGAIN; |
249 | } else if (xfs_iflags_test(ip, XFS_INEW)) { | 262 | goto out_error; |
250 | /* | 263 | } |
251 | * We are racing with another cache hit that is | ||
252 | * currently recycling this inode out of the XFS_IRECLAIMABLE | ||
253 | * state. Wait for the initialisation to complete before | ||
254 | * continuing. | ||
255 | */ | ||
256 | wait_on_inode(VFS_I(ip)); | ||
257 | } | ||
258 | 264 | ||
259 | if (ip->i_d.di_mode == 0 && !(flags & XFS_IGET_CREATE)) { | 265 | /* We've got a live one. */ |
260 | error = ENOENT; | 266 | spin_unlock(&ip->i_flags_lock); |
261 | iput(VFS_I(ip)); | 267 | read_unlock(&pag->pag_ici_lock); |
262 | goto out_error; | ||
263 | } | 268 | } |
264 | 269 | ||
265 | /* We've got a live one. */ | ||
266 | read_unlock(&pag->pag_ici_lock); | ||
267 | |||
268 | if (lock_flags != 0) | 270 | if (lock_flags != 0) |
269 | xfs_ilock(ip, lock_flags); | 271 | xfs_ilock(ip, lock_flags); |
270 | 272 | ||
@@ -274,6 +276,7 @@ xfs_iget_cache_hit( | |||
274 | return 0; | 276 | return 0; |
275 | 277 | ||
276 | out_error: | 278 | out_error: |
279 | spin_unlock(&ip->i_flags_lock); | ||
277 | read_unlock(&pag->pag_ici_lock); | 280 | read_unlock(&pag->pag_ici_lock); |
278 | return error; | 281 | return error; |
279 | } | 282 | } |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 1f22d65fed0a..da428b3fe0f5 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -343,6 +343,16 @@ xfs_iformat( | |||
343 | return XFS_ERROR(EFSCORRUPTED); | 343 | return XFS_ERROR(EFSCORRUPTED); |
344 | } | 344 | } |
345 | 345 | ||
346 | if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) && | ||
347 | !ip->i_mount->m_rtdev_targp)) { | ||
348 | xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, | ||
349 | "corrupt dinode %Lu, has realtime flag set.", | ||
350 | ip->i_ino); | ||
351 | XFS_CORRUPTION_ERROR("xfs_iformat(realtime)", | ||
352 | XFS_ERRLEVEL_LOW, ip->i_mount, dip); | ||
353 | return XFS_ERROR(EFSCORRUPTED); | ||
354 | } | ||
355 | |||
346 | switch (ip->i_d.di_mode & S_IFMT) { | 356 | switch (ip->i_d.di_mode & S_IFMT) { |
347 | case S_IFIFO: | 357 | case S_IFIFO: |
348 | case S_IFCHR: | 358 | case S_IFCHR: |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 3750f04ede0b..9dbdff3ea484 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -3180,7 +3180,7 @@ try_again: | |||
3180 | STATIC void | 3180 | STATIC void |
3181 | xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog) | 3181 | xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog) |
3182 | { | 3182 | { |
3183 | ASSERT(spin_is_locked(&log->l_icloglock)); | 3183 | assert_spin_locked(&log->l_icloglock); |
3184 | 3184 | ||
3185 | if (iclog->ic_state == XLOG_STATE_ACTIVE) { | 3185 | if (iclog->ic_state == XLOG_STATE_ACTIVE) { |
3186 | xlog_state_switch_iclogs(log, iclog, 0); | 3186 | xlog_state_switch_iclogs(log, iclog, 0); |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index c4eca5ed5dab..492d75bae2bf 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -538,7 +538,9 @@ xfs_readlink_bmap( | |||
538 | d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock); | 538 | d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock); |
539 | byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount); | 539 | byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount); |
540 | 540 | ||
541 | bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 0); | 541 | bp = xfs_buf_read_flags(mp->m_ddev_targp, d, BTOBB(byte_cnt), |
542 | XBF_LOCK | XBF_MAPPED | | ||
543 | XBF_DONT_BLOCK); | ||
542 | error = XFS_BUF_GETERROR(bp); | 544 | error = XFS_BUF_GETERROR(bp); |
543 | if (error) { | 545 | if (error) { |
544 | xfs_ioerror_alert("xfs_readlink", | 546 | xfs_ioerror_alert("xfs_readlink", |
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index baf1e0a9a7ee..740ac3ad8fd0 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
@@ -174,7 +174,7 @@ struct acpi_processor_throttling { | |||
174 | cpumask_var_t shared_cpu_map; | 174 | cpumask_var_t shared_cpu_map; |
175 | int (*acpi_processor_get_throttling) (struct acpi_processor * pr); | 175 | int (*acpi_processor_get_throttling) (struct acpi_processor * pr); |
176 | int (*acpi_processor_set_throttling) (struct acpi_processor * pr, | 176 | int (*acpi_processor_set_throttling) (struct acpi_processor * pr, |
177 | int state); | 177 | int state, bool force); |
178 | 178 | ||
179 | u32 address; | 179 | u32 address; |
180 | u8 duty_offset; | 180 | u8 duty_offset; |
@@ -321,7 +321,8 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) | |||
321 | /* in processor_throttling.c */ | 321 | /* in processor_throttling.c */ |
322 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr); | 322 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr); |
323 | int acpi_processor_get_throttling_info(struct acpi_processor *pr); | 323 | int acpi_processor_get_throttling_info(struct acpi_processor *pr); |
324 | extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state); | 324 | extern int acpi_processor_set_throttling(struct acpi_processor *pr, |
325 | int state, bool force); | ||
325 | extern const struct file_operations acpi_processor_throttling_fops; | 326 | extern const struct file_operations acpi_processor_throttling_fops; |
326 | extern void acpi_processor_throttling_init(void); | 327 | extern void acpi_processor_throttling_init(void); |
327 | /* in processor_idle.c */ | 328 | /* in processor_idle.c */ |
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 010545436efa..5a2bd1cc9656 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
@@ -137,6 +137,7 @@ struct crypto_instance *crypto_alloc_instance(const char *name, | |||
137 | void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen); | 137 | void crypto_init_queue(struct crypto_queue *queue, unsigned int max_qlen); |
138 | int crypto_enqueue_request(struct crypto_queue *queue, | 138 | int crypto_enqueue_request(struct crypto_queue *queue, |
139 | struct crypto_async_request *request); | 139 | struct crypto_async_request *request); |
140 | void *__crypto_dequeue_request(struct crypto_queue *queue, unsigned int offset); | ||
140 | struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue); | 141 | struct crypto_async_request *crypto_dequeue_request(struct crypto_queue *queue); |
141 | int crypto_tfm_in_queue(struct crypto_queue *queue, struct crypto_tfm *tfm); | 142 | int crypto_tfm_in_queue(struct crypto_queue *queue, struct crypto_tfm *tfm); |
142 | 143 | ||
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h index 2ba42cd7d6aa..3a748a6bf772 100644 --- a/include/crypto/internal/skcipher.h +++ b/include/crypto/internal/skcipher.h | |||
@@ -79,8 +79,8 @@ static inline int skcipher_enqueue_givcrypt( | |||
79 | static inline struct skcipher_givcrypt_request *skcipher_dequeue_givcrypt( | 79 | static inline struct skcipher_givcrypt_request *skcipher_dequeue_givcrypt( |
80 | struct crypto_queue *queue) | 80 | struct crypto_queue *queue) |
81 | { | 81 | { |
82 | return container_of(ablkcipher_dequeue_request(queue), | 82 | return __crypto_dequeue_request( |
83 | struct skcipher_givcrypt_request, creq); | 83 | queue, offsetof(struct skcipher_givcrypt_request, creq.base)); |
84 | } | 84 | } |
85 | 85 | ||
86 | static inline void *skcipher_givcrypt_reqctx( | 86 | static inline void *skcipher_givcrypt_reqctx( |
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index af4b4826997e..2ba61e18fc8b 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h | |||
@@ -508,6 +508,7 @@ typedef struct { | |||
508 | #define DRM_RADEON_INFO 0x27 | 508 | #define DRM_RADEON_INFO 0x27 |
509 | #define DRM_RADEON_GEM_SET_TILING 0x28 | 509 | #define DRM_RADEON_GEM_SET_TILING 0x28 |
510 | #define DRM_RADEON_GEM_GET_TILING 0x29 | 510 | #define DRM_RADEON_GEM_GET_TILING 0x29 |
511 | #define DRM_RADEON_GEM_BUSY 0x2a | ||
511 | 512 | ||
512 | #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) | 513 | #define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) |
513 | #define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) | 514 | #define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) |
@@ -548,6 +549,7 @@ typedef struct { | |||
548 | #define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info) | 549 | #define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info) |
549 | #define DRM_IOCTL_RADEON_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling) | 550 | #define DRM_IOCTL_RADEON_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling) |
550 | #define DRM_IOCTL_RADEON_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) | 551 | #define DRM_IOCTL_RADEON_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) |
552 | #define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy) | ||
551 | 553 | ||
552 | typedef struct drm_radeon_init { | 554 | typedef struct drm_radeon_init { |
553 | enum { | 555 | enum { |
@@ -707,6 +709,7 @@ typedef struct drm_radeon_indirect { | |||
707 | #define RADEON_PARAM_FB_LOCATION 14 /* FB location */ | 709 | #define RADEON_PARAM_FB_LOCATION 14 /* FB location */ |
708 | #define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ | 710 | #define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ |
709 | #define RADEON_PARAM_DEVICE_ID 16 | 711 | #define RADEON_PARAM_DEVICE_ID 16 |
712 | #define RADEON_PARAM_NUM_Z_PIPES 17 /* num Z pipes */ | ||
710 | 713 | ||
711 | typedef struct drm_radeon_getparam { | 714 | typedef struct drm_radeon_getparam { |
712 | int param; | 715 | int param; |
@@ -838,7 +841,7 @@ struct drm_radeon_gem_wait_idle { | |||
838 | 841 | ||
839 | struct drm_radeon_gem_busy { | 842 | struct drm_radeon_gem_busy { |
840 | uint32_t handle; | 843 | uint32_t handle; |
841 | uint32_t busy; | 844 | uint32_t domain; |
842 | }; | 845 | }; |
843 | 846 | ||
844 | struct drm_radeon_gem_pread { | 847 | struct drm_radeon_gem_pread { |
@@ -895,6 +898,7 @@ struct drm_radeon_cs { | |||
895 | 898 | ||
896 | #define RADEON_INFO_DEVICE_ID 0x00 | 899 | #define RADEON_INFO_DEVICE_ID 0x00 |
897 | #define RADEON_INFO_NUM_GB_PIPES 0x01 | 900 | #define RADEON_INFO_NUM_GB_PIPES 0x01 |
901 | #define RADEON_INFO_NUM_Z_PIPES 0x02 | ||
898 | 902 | ||
899 | struct drm_radeon_info { | 903 | struct drm_radeon_info { |
900 | uint32_t request; | 904 | uint32_t request; |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 61ee18c1bdb4..2046b5b8af48 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -117,6 +117,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm, | |||
117 | int executable_stack); | 117 | int executable_stack); |
118 | extern int bprm_mm_init(struct linux_binprm *bprm); | 118 | extern int bprm_mm_init(struct linux_binprm *bprm); |
119 | extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); | 119 | extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); |
120 | extern int prepare_bprm_creds(struct linux_binprm *bprm); | ||
120 | extern void install_exec_creds(struct linux_binprm *bprm); | 121 | extern void install_exec_creds(struct linux_binprm *bprm); |
121 | extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); | 122 | extern void do_coredump(long signr, int exit_code, struct pt_regs *regs); |
122 | extern int set_binfmt(struct linux_binfmt *new); | 123 | extern int set_binfmt(struct linux_binfmt *new); |
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 2878811c6134..756d78b8c1c5 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h | |||
@@ -94,13 +94,13 @@ extern void __bitmap_shift_right(unsigned long *dst, | |||
94 | const unsigned long *src, int shift, int bits); | 94 | const unsigned long *src, int shift, int bits); |
95 | extern void __bitmap_shift_left(unsigned long *dst, | 95 | extern void __bitmap_shift_left(unsigned long *dst, |
96 | const unsigned long *src, int shift, int bits); | 96 | const unsigned long *src, int shift, int bits); |
97 | extern void __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, | 97 | extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, |
98 | const unsigned long *bitmap2, int bits); | 98 | const unsigned long *bitmap2, int bits); |
99 | extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, | 99 | extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, |
100 | const unsigned long *bitmap2, int bits); | 100 | const unsigned long *bitmap2, int bits); |
101 | extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, | 101 | extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, |
102 | const unsigned long *bitmap2, int bits); | 102 | const unsigned long *bitmap2, int bits); |
103 | extern void __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, | 103 | extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, |
104 | const unsigned long *bitmap2, int bits); | 104 | const unsigned long *bitmap2, int bits); |
105 | extern int __bitmap_intersects(const unsigned long *bitmap1, | 105 | extern int __bitmap_intersects(const unsigned long *bitmap1, |
106 | const unsigned long *bitmap2, int bits); | 106 | const unsigned long *bitmap2, int bits); |
@@ -171,13 +171,12 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src, | |||
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | static inline void bitmap_and(unsigned long *dst, const unsigned long *src1, | 174 | static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, |
175 | const unsigned long *src2, int nbits) | 175 | const unsigned long *src2, int nbits) |
176 | { | 176 | { |
177 | if (small_const_nbits(nbits)) | 177 | if (small_const_nbits(nbits)) |
178 | *dst = *src1 & *src2; | 178 | return (*dst = *src1 & *src2) != 0; |
179 | else | 179 | return __bitmap_and(dst, src1, src2, nbits); |
180 | __bitmap_and(dst, src1, src2, nbits); | ||
181 | } | 180 | } |
182 | 181 | ||
183 | static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, | 182 | static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, |
@@ -198,13 +197,12 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, | |||
198 | __bitmap_xor(dst, src1, src2, nbits); | 197 | __bitmap_xor(dst, src1, src2, nbits); |
199 | } | 198 | } |
200 | 199 | ||
201 | static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1, | 200 | static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, |
202 | const unsigned long *src2, int nbits) | 201 | const unsigned long *src2, int nbits) |
203 | { | 202 | { |
204 | if (small_const_nbits(nbits)) | 203 | if (small_const_nbits(nbits)) |
205 | *dst = *src1 & ~(*src2); | 204 | return (*dst = *src1 & ~(*src2)) != 0; |
206 | else | 205 | return __bitmap_andnot(dst, src1, src2, nbits); |
207 | __bitmap_andnot(dst, src1, src2, nbits); | ||
208 | } | 206 | } |
209 | 207 | ||
210 | static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, | 208 | static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index c5ac87ca7bc6..796df12091b7 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -43,10 +43,10 @@ | |||
43 | * int cpu_isset(cpu, mask) true iff bit 'cpu' set in mask | 43 | * int cpu_isset(cpu, mask) true iff bit 'cpu' set in mask |
44 | * int cpu_test_and_set(cpu, mask) test and set bit 'cpu' in mask | 44 | * int cpu_test_and_set(cpu, mask) test and set bit 'cpu' in mask |
45 | * | 45 | * |
46 | * void cpus_and(dst, src1, src2) dst = src1 & src2 [intersection] | 46 | * int cpus_and(dst, src1, src2) dst = src1 & src2 [intersection] |
47 | * void cpus_or(dst, src1, src2) dst = src1 | src2 [union] | 47 | * void cpus_or(dst, src1, src2) dst = src1 | src2 [union] |
48 | * void cpus_xor(dst, src1, src2) dst = src1 ^ src2 | 48 | * void cpus_xor(dst, src1, src2) dst = src1 ^ src2 |
49 | * void cpus_andnot(dst, src1, src2) dst = src1 & ~src2 | 49 | * int cpus_andnot(dst, src1, src2) dst = src1 & ~src2 |
50 | * void cpus_complement(dst, src) dst = ~src | 50 | * void cpus_complement(dst, src) dst = ~src |
51 | * | 51 | * |
52 | * int cpus_equal(mask1, mask2) Does mask1 == mask2? | 52 | * int cpus_equal(mask1, mask2) Does mask1 == mask2? |
@@ -179,10 +179,10 @@ static inline int __cpu_test_and_set(int cpu, cpumask_t *addr) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | #define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS) | 181 | #define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS) |
182 | static inline void __cpus_and(cpumask_t *dstp, const cpumask_t *src1p, | 182 | static inline int __cpus_and(cpumask_t *dstp, const cpumask_t *src1p, |
183 | const cpumask_t *src2p, int nbits) | 183 | const cpumask_t *src2p, int nbits) |
184 | { | 184 | { |
185 | bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits); | 185 | return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits); |
186 | } | 186 | } |
187 | 187 | ||
188 | #define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS) | 188 | #define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS) |
@@ -201,10 +201,10 @@ static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p, | |||
201 | 201 | ||
202 | #define cpus_andnot(dst, src1, src2) \ | 202 | #define cpus_andnot(dst, src1, src2) \ |
203 | __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS) | 203 | __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS) |
204 | static inline void __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p, | 204 | static inline int __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p, |
205 | const cpumask_t *src2p, int nbits) | 205 | const cpumask_t *src2p, int nbits) |
206 | { | 206 | { |
207 | bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits); | 207 | return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits); |
208 | } | 208 | } |
209 | 209 | ||
210 | #define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS) | 210 | #define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS) |
@@ -738,11 +738,11 @@ static inline void cpumask_clear(struct cpumask *dstp) | |||
738 | * @src1p: the first input | 738 | * @src1p: the first input |
739 | * @src2p: the second input | 739 | * @src2p: the second input |
740 | */ | 740 | */ |
741 | static inline void cpumask_and(struct cpumask *dstp, | 741 | static inline int cpumask_and(struct cpumask *dstp, |
742 | const struct cpumask *src1p, | 742 | const struct cpumask *src1p, |
743 | const struct cpumask *src2p) | 743 | const struct cpumask *src2p) |
744 | { | 744 | { |
745 | bitmap_and(cpumask_bits(dstp), cpumask_bits(src1p), | 745 | return bitmap_and(cpumask_bits(dstp), cpumask_bits(src1p), |
746 | cpumask_bits(src2p), nr_cpumask_bits); | 746 | cpumask_bits(src2p), nr_cpumask_bits); |
747 | } | 747 | } |
748 | 748 | ||
@@ -779,11 +779,11 @@ static inline void cpumask_xor(struct cpumask *dstp, | |||
779 | * @src1p: the first input | 779 | * @src1p: the first input |
780 | * @src2p: the second input | 780 | * @src2p: the second input |
781 | */ | 781 | */ |
782 | static inline void cpumask_andnot(struct cpumask *dstp, | 782 | static inline int cpumask_andnot(struct cpumask *dstp, |
783 | const struct cpumask *src1p, | 783 | const struct cpumask *src1p, |
784 | const struct cpumask *src2p) | 784 | const struct cpumask *src2p) |
785 | { | 785 | { |
786 | bitmap_andnot(cpumask_bits(dstp), cpumask_bits(src1p), | 786 | return bitmap_andnot(cpumask_bits(dstp), cpumask_bits(src1p), |
787 | cpumask_bits(src2p), nr_cpumask_bits); | 787 | cpumask_bits(src2p), nr_cpumask_bits); |
788 | } | 788 | } |
789 | 789 | ||
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 655e7721580a..df7607e6dce8 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -91,6 +91,9 @@ typedef int (*dm_iterate_devices_fn) (struct dm_target *ti, | |||
91 | iterate_devices_callout_fn fn, | 91 | iterate_devices_callout_fn fn, |
92 | void *data); | 92 | void *data); |
93 | 93 | ||
94 | typedef void (*dm_io_hints_fn) (struct dm_target *ti, | ||
95 | struct queue_limits *limits); | ||
96 | |||
94 | /* | 97 | /* |
95 | * Returns: | 98 | * Returns: |
96 | * 0: The target can handle the next I/O immediately. | 99 | * 0: The target can handle the next I/O immediately. |
@@ -151,6 +154,7 @@ struct target_type { | |||
151 | dm_merge_fn merge; | 154 | dm_merge_fn merge; |
152 | dm_busy_fn busy; | 155 | dm_busy_fn busy; |
153 | dm_iterate_devices_fn iterate_devices; | 156 | dm_iterate_devices_fn iterate_devices; |
157 | dm_io_hints_fn io_hints; | ||
154 | 158 | ||
155 | /* For internal device-mapper use. */ | 159 | /* For internal device-mapper use. */ |
156 | struct list_head list; | 160 | struct list_head list; |
diff --git a/include/linux/dm-log-userspace.h b/include/linux/dm-log-userspace.h index 642e3017b51f..8a1f972c0fe9 100644 --- a/include/linux/dm-log-userspace.h +++ b/include/linux/dm-log-userspace.h | |||
@@ -371,7 +371,18 @@ | |||
371 | (DM_ULOG_REQUEST_MASK & (request_type)) | 371 | (DM_ULOG_REQUEST_MASK & (request_type)) |
372 | 372 | ||
373 | struct dm_ulog_request { | 373 | struct dm_ulog_request { |
374 | char uuid[DM_UUID_LEN]; /* Ties a request to a specific mirror log */ | 374 | /* |
375 | * The local unique identifier (luid) and the universally unique | ||
376 | * identifier (uuid) are used to tie a request to a specific | ||
377 | * mirror log. A single machine log could probably make due with | ||
378 | * just the 'luid', but a cluster-aware log must use the 'uuid' and | ||
379 | * the 'luid'. The uuid is what is required for node to node | ||
380 | * communication concerning a particular log, but the 'luid' helps | ||
381 | * differentiate between logs that are being swapped and have the | ||
382 | * same 'uuid'. (Think "live" and "inactive" device-mapper tables.) | ||
383 | */ | ||
384 | uint64_t luid; | ||
385 | char uuid[DM_UUID_LEN]; | ||
375 | char padding[7]; /* Padding because DM_UUID_LEN = 129 */ | 386 | char padding[7]; /* Padding because DM_UUID_LEN = 129 */ |
376 | 387 | ||
377 | int32_t error; /* Used to report back processing errors */ | 388 | int32_t error; /* Used to report back processing errors */ |
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h index 23c1ec79a31b..45ff18491514 100644 --- a/include/linux/flex_array.h +++ b/include/linux/flex_array.h | |||
@@ -21,7 +21,7 @@ struct flex_array { | |||
21 | struct { | 21 | struct { |
22 | int element_size; | 22 | int element_size; |
23 | int total_nr_elements; | 23 | int total_nr_elements; |
24 | struct flex_array_part *parts[0]; | 24 | struct flex_array_part *parts[]; |
25 | }; | 25 | }; |
26 | /* | 26 | /* |
27 | * This little trick makes sure that | 27 | * This little trick makes sure that |
@@ -36,12 +36,14 @@ struct flex_array { | |||
36 | .total_nr_elements = (total), \ | 36 | .total_nr_elements = (total), \ |
37 | } } } | 37 | } } } |
38 | 38 | ||
39 | struct flex_array *flex_array_alloc(int element_size, int total, gfp_t flags); | 39 | struct flex_array *flex_array_alloc(int element_size, unsigned int total, |
40 | int flex_array_prealloc(struct flex_array *fa, int start, int end, gfp_t flags); | 40 | gfp_t flags); |
41 | int flex_array_prealloc(struct flex_array *fa, unsigned int start, | ||
42 | unsigned int end, gfp_t flags); | ||
41 | void flex_array_free(struct flex_array *fa); | 43 | void flex_array_free(struct flex_array *fa); |
42 | void flex_array_free_parts(struct flex_array *fa); | 44 | void flex_array_free_parts(struct flex_array *fa); |
43 | int flex_array_put(struct flex_array *fa, int element_nr, void *src, | 45 | int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, |
44 | gfp_t flags); | 46 | gfp_t flags); |
45 | void *flex_array_get(struct flex_array *fa, int element_nr); | 47 | void *flex_array_get(struct flex_array *fa, unsigned int element_nr); |
46 | 48 | ||
47 | #endif /* _FLEX_ARRAY_H */ | 49 | #endif /* _FLEX_ARRAY_H */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 67888a9e0655..73e9b643e455 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2123,7 +2123,7 @@ extern struct file *do_filp_open(int dfd, const char *pathname, | |||
2123 | int open_flag, int mode, int acc_mode); | 2123 | int open_flag, int mode, int acc_mode); |
2124 | extern int may_open(struct path *, int, int); | 2124 | extern int may_open(struct path *, int, int); |
2125 | 2125 | ||
2126 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); | 2126 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); |
2127 | extern struct file * open_exec(const char *); | 2127 | extern struct file * open_exec(const char *); |
2128 | 2128 | ||
2129 | /* fs/dcache.c -- generic fs support functions */ | 2129 | /* fs/dcache.c -- generic fs support functions */ |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 73edf5a52e31..a256c8f78290 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -93,13 +93,17 @@ void tracing_generic_entry_update(struct trace_entry *entry, | |||
93 | unsigned long flags, | 93 | unsigned long flags, |
94 | int pc); | 94 | int pc); |
95 | struct ring_buffer_event * | 95 | struct ring_buffer_event * |
96 | trace_current_buffer_lock_reserve(int type, unsigned long len, | 96 | trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer, |
97 | int type, unsigned long len, | ||
97 | unsigned long flags, int pc); | 98 | unsigned long flags, int pc); |
98 | void trace_current_buffer_unlock_commit(struct ring_buffer_event *event, | 99 | void trace_current_buffer_unlock_commit(struct ring_buffer *buffer, |
100 | struct ring_buffer_event *event, | ||
99 | unsigned long flags, int pc); | 101 | unsigned long flags, int pc); |
100 | void trace_nowake_buffer_unlock_commit(struct ring_buffer_event *event, | 102 | void trace_nowake_buffer_unlock_commit(struct ring_buffer *buffer, |
103 | struct ring_buffer_event *event, | ||
101 | unsigned long flags, int pc); | 104 | unsigned long flags, int pc); |
102 | void trace_current_buffer_discard_commit(struct ring_buffer_event *event); | 105 | void trace_current_buffer_discard_commit(struct ring_buffer *buffer, |
106 | struct ring_buffer_event *event); | ||
103 | 107 | ||
104 | void tracing_record_cmdline(struct task_struct *tsk); | 108 | void tracing_record_cmdline(struct task_struct *tsk); |
105 | 109 | ||
@@ -133,10 +137,10 @@ struct ftrace_event_call { | |||
133 | #define MAX_FILTER_PRED 32 | 137 | #define MAX_FILTER_PRED 32 |
134 | #define MAX_FILTER_STR_VAL 128 | 138 | #define MAX_FILTER_STR_VAL 128 |
135 | 139 | ||
136 | extern int init_preds(struct ftrace_event_call *call); | ||
137 | extern void destroy_preds(struct ftrace_event_call *call); | 140 | extern void destroy_preds(struct ftrace_event_call *call); |
138 | extern int filter_match_preds(struct ftrace_event_call *call, void *rec); | 141 | extern int filter_match_preds(struct ftrace_event_call *call, void *rec); |
139 | extern int filter_current_check_discard(struct ftrace_event_call *call, | 142 | extern int filter_current_check_discard(struct ring_buffer *buffer, |
143 | struct ftrace_event_call *call, | ||
140 | void *rec, | 144 | void *rec, |
141 | struct ring_buffer_event *event); | 145 | struct ring_buffer_event *event); |
142 | 146 | ||
diff --git a/include/linux/gen_stats.h b/include/linux/gen_stats.h index 0ffa41df0ee8..710e901085d0 100644 --- a/include/linux/gen_stats.h +++ b/include/linux/gen_stats.h | |||
@@ -22,6 +22,11 @@ struct gnet_stats_basic | |||
22 | { | 22 | { |
23 | __u64 bytes; | 23 | __u64 bytes; |
24 | __u32 packets; | 24 | __u32 packets; |
25 | }; | ||
26 | struct gnet_stats_basic_packed | ||
27 | { | ||
28 | __u64 bytes; | ||
29 | __u32 packets; | ||
25 | } __attribute__ ((packed)); | 30 | } __attribute__ ((packed)); |
26 | 31 | ||
27 | /** | 32 | /** |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 2723513a5651..5cbc620bdfe0 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <asm/tlbflush.h> | 10 | #include <asm/tlbflush.h> |
11 | 11 | ||
12 | struct ctl_table; | 12 | struct ctl_table; |
13 | struct user_struct; | ||
13 | 14 | ||
14 | int PageHuge(struct page *page); | 15 | int PageHuge(struct page *page); |
15 | 16 | ||
@@ -146,7 +147,8 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) | |||
146 | 147 | ||
147 | extern const struct file_operations hugetlbfs_file_operations; | 148 | extern const struct file_operations hugetlbfs_file_operations; |
148 | extern struct vm_operations_struct hugetlb_vm_ops; | 149 | extern struct vm_operations_struct hugetlb_vm_ops; |
149 | struct file *hugetlb_file_setup(const char *name, size_t, int); | 150 | struct file *hugetlb_file_setup(const char *name, size_t size, int acct, |
151 | struct user_struct **user); | ||
150 | int hugetlb_get_quota(struct address_space *mapping, long delta); | 152 | int hugetlb_get_quota(struct address_space *mapping, long delta); |
151 | void hugetlb_put_quota(struct address_space *mapping, long delta); | 153 | void hugetlb_put_quota(struct address_space *mapping, long delta); |
152 | 154 | ||
@@ -168,7 +170,7 @@ static inline void set_file_hugepages(struct file *file) | |||
168 | 170 | ||
169 | #define is_file_hugepages(file) 0 | 171 | #define is_file_hugepages(file) 0 |
170 | #define set_file_hugepages(file) BUG() | 172 | #define set_file_hugepages(file) BUG() |
171 | #define hugetlb_file_setup(name,size,acctflag) ERR_PTR(-ENOSYS) | 173 | #define hugetlb_file_setup(name,size,acct,user) ERR_PTR(-ENOSYS) |
172 | 174 | ||
173 | #endif /* !CONFIG_HUGETLBFS */ | 175 | #endif /* !CONFIG_HUGETLBFS */ |
174 | 176 | ||
diff --git a/include/linux/lmb.h b/include/linux/lmb.h index c46c89505dac..2442e3f3d033 100644 --- a/include/linux/lmb.h +++ b/include/linux/lmb.h | |||
@@ -51,7 +51,7 @@ extern u64 __init lmb_alloc_base(u64 size, | |||
51 | extern u64 __init __lmb_alloc_base(u64 size, | 51 | extern u64 __init __lmb_alloc_base(u64 size, |
52 | u64 align, u64 max_addr); | 52 | u64 align, u64 max_addr); |
53 | extern u64 __init lmb_phys_mem_size(void); | 53 | extern u64 __init lmb_phys_mem_size(void); |
54 | extern u64 __init lmb_end_of_DRAM(void); | 54 | extern u64 lmb_end_of_DRAM(void); |
55 | extern void __init lmb_enforce_memory_limit(u64 memory_limit); | 55 | extern void __init lmb_enforce_memory_limit(u64 memory_limit); |
56 | extern int __init lmb_is_reserved(u64 addr); | 56 | extern int __init lmb_is_reserved(u64 addr); |
57 | extern int lmb_find(struct lmb_property *res); | 57 | extern int lmb_find(struct lmb_property *res); |
diff --git a/include/linux/mm.h b/include/linux/mm.h index ba3a7cb1eaa0..9a72cc78e6b8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -34,8 +34,6 @@ extern int sysctl_legacy_va_layout; | |||
34 | #define sysctl_legacy_va_layout 0 | 34 | #define sysctl_legacy_va_layout 0 |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | extern unsigned long mmap_min_addr; | ||
38 | |||
39 | #include <asm/page.h> | 37 | #include <asm/page.h> |
40 | #include <asm/pgtable.h> | 38 | #include <asm/pgtable.h> |
41 | #include <asm/processor.h> | 39 | #include <asm/processor.h> |
@@ -575,19 +573,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone, | |||
575 | } | 573 | } |
576 | 574 | ||
577 | /* | 575 | /* |
578 | * If a hint addr is less than mmap_min_addr change hint to be as | ||
579 | * low as possible but still greater than mmap_min_addr | ||
580 | */ | ||
581 | static inline unsigned long round_hint_to_min(unsigned long hint) | ||
582 | { | ||
583 | hint &= PAGE_MASK; | ||
584 | if (((void *)hint != NULL) && | ||
585 | (hint < mmap_min_addr)) | ||
586 | return PAGE_ALIGN(mmap_min_addr); | ||
587 | return hint; | ||
588 | } | ||
589 | |||
590 | /* | ||
591 | * Some inline functions in vmstat.h depend on page_zone() | 576 | * Some inline functions in vmstat.h depend on page_zone() |
592 | */ | 577 | */ |
593 | #include <linux/vmstat.h> | 578 | #include <linux/vmstat.h> |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 7acc8439d9b3..0042090a4d70 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -240,8 +240,6 @@ struct mm_struct { | |||
240 | 240 | ||
241 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ | 241 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ |
242 | 242 | ||
243 | s8 oom_adj; /* OOM kill score adjustment (bit shift) */ | ||
244 | |||
245 | cpumask_t cpu_vm_mask; | 243 | cpumask_t cpu_vm_mask; |
246 | 244 | ||
247 | /* Architecture-specific MM context */ | 245 | /* Architecture-specific MM context */ |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index fdffb413b192..f6b90240dd41 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -473,7 +473,6 @@ extern int nfs_writepages(struct address_space *, struct writeback_control *); | |||
473 | extern int nfs_flush_incompatible(struct file *file, struct page *page); | 473 | extern int nfs_flush_incompatible(struct file *file, struct page *page); |
474 | extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); | 474 | extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); |
475 | extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); | 475 | extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); |
476 | extern void nfs_writedata_release(void *); | ||
477 | 476 | ||
478 | /* | 477 | /* |
479 | * Try to write back everything synchronously (but check the | 478 | * Try to write back everything synchronously (but check the |
@@ -488,7 +487,6 @@ extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); | |||
488 | extern int nfs_commit_inode(struct inode *, int); | 487 | extern int nfs_commit_inode(struct inode *, int); |
489 | extern struct nfs_write_data *nfs_commitdata_alloc(void); | 488 | extern struct nfs_write_data *nfs_commitdata_alloc(void); |
490 | extern void nfs_commit_free(struct nfs_write_data *wdata); | 489 | extern void nfs_commit_free(struct nfs_write_data *wdata); |
491 | extern void nfs_commitdata_release(void *wdata); | ||
492 | #else | 490 | #else |
493 | static inline int | 491 | static inline int |
494 | nfs_commit_inode(struct inode *inode, int how) | 492 | nfs_commit_inode(struct inode *inode, int how) |
@@ -507,6 +505,7 @@ nfs_have_writebacks(struct inode *inode) | |||
507 | * Allocate nfs_write_data structures | 505 | * Allocate nfs_write_data structures |
508 | */ | 506 | */ |
509 | extern struct nfs_write_data *nfs_writedata_alloc(unsigned int npages); | 507 | extern struct nfs_write_data *nfs_writedata_alloc(unsigned int npages); |
508 | extern void nfs_writedata_free(struct nfs_write_data *); | ||
510 | 509 | ||
511 | /* | 510 | /* |
512 | * linux/fs/nfs/read.c | 511 | * linux/fs/nfs/read.c |
@@ -515,7 +514,6 @@ extern int nfs_readpage(struct file *, struct page *); | |||
515 | extern int nfs_readpages(struct file *, struct address_space *, | 514 | extern int nfs_readpages(struct file *, struct address_space *, |
516 | struct list_head *, unsigned); | 515 | struct list_head *, unsigned); |
517 | extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); | 516 | extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); |
518 | extern void nfs_readdata_release(void *data); | ||
519 | extern int nfs_readpage_async(struct nfs_open_context *, struct inode *, | 517 | extern int nfs_readpage_async(struct nfs_open_context *, struct inode *, |
520 | struct page *); | 518 | struct page *); |
521 | 519 | ||
@@ -523,6 +521,7 @@ extern int nfs_readpage_async(struct nfs_open_context *, struct inode *, | |||
523 | * Allocate nfs_read_data structures | 521 | * Allocate nfs_read_data structures |
524 | */ | 522 | */ |
525 | extern struct nfs_read_data *nfs_readdata_alloc(unsigned int npages); | 523 | extern struct nfs_read_data *nfs_readdata_alloc(unsigned int npages); |
524 | extern void nfs_readdata_free(struct nfs_read_data *); | ||
526 | 525 | ||
527 | /* | 526 | /* |
528 | * linux/fs/nfs3proc.c | 527 | * linux/fs/nfs3proc.c |
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index 8e6460fb4c02..9ba1822272c7 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -115,7 +115,7 @@ enum perf_counter_sample_format { | |||
115 | PERF_SAMPLE_TID = 1U << 1, | 115 | PERF_SAMPLE_TID = 1U << 1, |
116 | PERF_SAMPLE_TIME = 1U << 2, | 116 | PERF_SAMPLE_TIME = 1U << 2, |
117 | PERF_SAMPLE_ADDR = 1U << 3, | 117 | PERF_SAMPLE_ADDR = 1U << 3, |
118 | PERF_SAMPLE_GROUP = 1U << 4, | 118 | PERF_SAMPLE_READ = 1U << 4, |
119 | PERF_SAMPLE_CALLCHAIN = 1U << 5, | 119 | PERF_SAMPLE_CALLCHAIN = 1U << 5, |
120 | PERF_SAMPLE_ID = 1U << 6, | 120 | PERF_SAMPLE_ID = 1U << 6, |
121 | PERF_SAMPLE_CPU = 1U << 7, | 121 | PERF_SAMPLE_CPU = 1U << 7, |
@@ -127,16 +127,32 @@ enum perf_counter_sample_format { | |||
127 | }; | 127 | }; |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * Bits that can be set in attr.read_format to request that | 130 | * The format of the data returned by read() on a perf counter fd, |
131 | * reads on the counter should return the indicated quantities, | 131 | * as specified by attr.read_format: |
132 | * in increasing order of bit value, after the counter value. | 132 | * |
133 | * struct read_format { | ||
134 | * { u64 value; | ||
135 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | ||
136 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
137 | * { u64 id; } && PERF_FORMAT_ID | ||
138 | * } && !PERF_FORMAT_GROUP | ||
139 | * | ||
140 | * { u64 nr; | ||
141 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | ||
142 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
143 | * { u64 value; | ||
144 | * { u64 id; } && PERF_FORMAT_ID | ||
145 | * } cntr[nr]; | ||
146 | * } && PERF_FORMAT_GROUP | ||
147 | * }; | ||
133 | */ | 148 | */ |
134 | enum perf_counter_read_format { | 149 | enum perf_counter_read_format { |
135 | PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, | 150 | PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, |
136 | PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, | 151 | PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, |
137 | PERF_FORMAT_ID = 1U << 2, | 152 | PERF_FORMAT_ID = 1U << 2, |
153 | PERF_FORMAT_GROUP = 1U << 3, | ||
138 | 154 | ||
139 | PERF_FORMAT_MAX = 1U << 3, /* non-ABI */ | 155 | PERF_FORMAT_MAX = 1U << 4, /* non-ABI */ |
140 | }; | 156 | }; |
141 | 157 | ||
142 | #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ | 158 | #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ |
@@ -343,10 +359,8 @@ enum perf_event_type { | |||
343 | * struct { | 359 | * struct { |
344 | * struct perf_event_header header; | 360 | * struct perf_event_header header; |
345 | * u32 pid, tid; | 361 | * u32 pid, tid; |
346 | * u64 value; | 362 | * |
347 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | 363 | * struct read_format values; |
348 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
349 | * { u64 parent_id; } && PERF_FORMAT_ID | ||
350 | * }; | 364 | * }; |
351 | */ | 365 | */ |
352 | PERF_EVENT_READ = 8, | 366 | PERF_EVENT_READ = 8, |
@@ -364,11 +378,22 @@ enum perf_event_type { | |||
364 | * { u32 cpu, res; } && PERF_SAMPLE_CPU | 378 | * { u32 cpu, res; } && PERF_SAMPLE_CPU |
365 | * { u64 period; } && PERF_SAMPLE_PERIOD | 379 | * { u64 period; } && PERF_SAMPLE_PERIOD |
366 | * | 380 | * |
367 | * { u64 nr; | 381 | * { struct read_format values; } && PERF_SAMPLE_READ |
368 | * { u64 id, val; } cnt[nr]; } && PERF_SAMPLE_GROUP | ||
369 | * | 382 | * |
370 | * { u64 nr, | 383 | * { u64 nr, |
371 | * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN | 384 | * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN |
385 | * | ||
386 | * # | ||
387 | * # The RAW record below is opaque data wrt the ABI | ||
388 | * # | ||
389 | * # That is, the ABI doesn't make any promises wrt to | ||
390 | * # the stability of its content, it may vary depending | ||
391 | * # on event, hardware, kernel version and phase of | ||
392 | * # the moon. | ||
393 | * # | ||
394 | * # In other words, PERF_SAMPLE_RAW contents are not an ABI. | ||
395 | * # | ||
396 | * | ||
372 | * { u32 size; | 397 | * { u32 size; |
373 | * char data[size];}&& PERF_SAMPLE_RAW | 398 | * char data[size];}&& PERF_SAMPLE_RAW |
374 | * }; | 399 | * }; |
@@ -694,6 +719,8 @@ struct perf_sample_data { | |||
694 | 719 | ||
695 | extern int perf_counter_overflow(struct perf_counter *counter, int nmi, | 720 | extern int perf_counter_overflow(struct perf_counter *counter, int nmi, |
696 | struct perf_sample_data *data); | 721 | struct perf_sample_data *data); |
722 | extern void perf_counter_output(struct perf_counter *counter, int nmi, | ||
723 | struct perf_sample_data *data); | ||
697 | 724 | ||
698 | /* | 725 | /* |
699 | * Return 1 for a software counter, 0 for a hardware counter | 726 | * Return 1 for a software counter, 0 for a hardware counter |
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index 7fca71693ae7..5fcc31ed5771 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
@@ -75,20 +75,6 @@ ring_buffer_event_time_delta(struct ring_buffer_event *event) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * ring_buffer_event_discard can discard any event in the ring buffer. | ||
79 | * it is up to the caller to protect against a reader from | ||
80 | * consuming it or a writer from wrapping and replacing it. | ||
81 | * | ||
82 | * No external protection is needed if this is called before | ||
83 | * the event is commited. But in that case it would be better to | ||
84 | * use ring_buffer_discard_commit. | ||
85 | * | ||
86 | * Note, if an event that has not been committed is discarded | ||
87 | * with ring_buffer_event_discard, it must still be committed. | ||
88 | */ | ||
89 | void ring_buffer_event_discard(struct ring_buffer_event *event); | ||
90 | |||
91 | /* | ||
92 | * ring_buffer_discard_commit will remove an event that has not | 78 | * ring_buffer_discard_commit will remove an event that has not |
93 | * ben committed yet. If this is used, then ring_buffer_unlock_commit | 79 | * ben committed yet. If this is used, then ring_buffer_unlock_commit |
94 | * must not be called on the discarded event. This function | 80 | * must not be called on the discarded event. This function |
@@ -154,8 +140,17 @@ unsigned long ring_buffer_size(struct ring_buffer *buffer); | |||
154 | void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu); | 140 | void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu); |
155 | void ring_buffer_reset(struct ring_buffer *buffer); | 141 | void ring_buffer_reset(struct ring_buffer *buffer); |
156 | 142 | ||
143 | #ifdef CONFIG_RING_BUFFER_ALLOW_SWAP | ||
157 | int ring_buffer_swap_cpu(struct ring_buffer *buffer_a, | 144 | int ring_buffer_swap_cpu(struct ring_buffer *buffer_a, |
158 | struct ring_buffer *buffer_b, int cpu); | 145 | struct ring_buffer *buffer_b, int cpu); |
146 | #else | ||
147 | static inline int | ||
148 | ring_buffer_swap_cpu(struct ring_buffer *buffer_a, | ||
149 | struct ring_buffer *buffer_b, int cpu) | ||
150 | { | ||
151 | return -ENODEV; | ||
152 | } | ||
153 | #endif | ||
159 | 154 | ||
160 | int ring_buffer_empty(struct ring_buffer *buffer); | 155 | int ring_buffer_empty(struct ring_buffer *buffer); |
161 | int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu); | 156 | int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu); |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 3ab08e4bb6b8..0f1ea4a66957 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1198,6 +1198,7 @@ struct task_struct { | |||
1198 | * a short time | 1198 | * a short time |
1199 | */ | 1199 | */ |
1200 | unsigned char fpu_counter; | 1200 | unsigned char fpu_counter; |
1201 | s8 oomkilladj; /* OOM kill score adjustment (bit shift). */ | ||
1201 | #ifdef CONFIG_BLK_DEV_IO_TRACE | 1202 | #ifdef CONFIG_BLK_DEV_IO_TRACE |
1202 | unsigned int btrace_seq; | 1203 | unsigned int btrace_seq; |
1203 | #endif | 1204 | #endif |
diff --git a/include/linux/security.h b/include/linux/security.h index 5eff459b3833..1f16eea2017b 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/resource.h> | 28 | #include <linux/resource.h> |
29 | #include <linux/sem.h> | 29 | #include <linux/sem.h> |
30 | #include <linux/shm.h> | 30 | #include <linux/shm.h> |
31 | #include <linux/mm.h> /* PAGE_ALIGN */ | ||
31 | #include <linux/msg.h> | 32 | #include <linux/msg.h> |
32 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
33 | #include <linux/key.h> | 34 | #include <linux/key.h> |
@@ -66,6 +67,9 @@ extern int cap_inode_setxattr(struct dentry *dentry, const char *name, | |||
66 | extern int cap_inode_removexattr(struct dentry *dentry, const char *name); | 67 | extern int cap_inode_removexattr(struct dentry *dentry, const char *name); |
67 | extern int cap_inode_need_killpriv(struct dentry *dentry); | 68 | extern int cap_inode_need_killpriv(struct dentry *dentry); |
68 | extern int cap_inode_killpriv(struct dentry *dentry); | 69 | extern int cap_inode_killpriv(struct dentry *dentry); |
70 | extern int cap_file_mmap(struct file *file, unsigned long reqprot, | ||
71 | unsigned long prot, unsigned long flags, | ||
72 | unsigned long addr, unsigned long addr_only); | ||
69 | extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags); | 73 | extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags); |
70 | extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, | 74 | extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, |
71 | unsigned long arg4, unsigned long arg5); | 75 | unsigned long arg4, unsigned long arg5); |
@@ -92,6 +96,7 @@ extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); | |||
92 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); | 96 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); |
93 | 97 | ||
94 | extern unsigned long mmap_min_addr; | 98 | extern unsigned long mmap_min_addr; |
99 | extern unsigned long dac_mmap_min_addr; | ||
95 | /* | 100 | /* |
96 | * Values used in the task_security_ops calls | 101 | * Values used in the task_security_ops calls |
97 | */ | 102 | */ |
@@ -116,6 +121,21 @@ struct request_sock; | |||
116 | #define LSM_UNSAFE_PTRACE 2 | 121 | #define LSM_UNSAFE_PTRACE 2 |
117 | #define LSM_UNSAFE_PTRACE_CAP 4 | 122 | #define LSM_UNSAFE_PTRACE_CAP 4 |
118 | 123 | ||
124 | /* | ||
125 | * If a hint addr is less than mmap_min_addr change hint to be as | ||
126 | * low as possible but still greater than mmap_min_addr | ||
127 | */ | ||
128 | static inline unsigned long round_hint_to_min(unsigned long hint) | ||
129 | { | ||
130 | hint &= PAGE_MASK; | ||
131 | if (((void *)hint != NULL) && | ||
132 | (hint < mmap_min_addr)) | ||
133 | return PAGE_ALIGN(mmap_min_addr); | ||
134 | return hint; | ||
135 | } | ||
136 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, struct file *filp, | ||
137 | void __user *buffer, size_t *lenp, loff_t *ppos); | ||
138 | |||
119 | #ifdef CONFIG_SECURITY | 139 | #ifdef CONFIG_SECURITY |
120 | 140 | ||
121 | struct security_mnt_opts { | 141 | struct security_mnt_opts { |
@@ -2197,9 +2217,7 @@ static inline int security_file_mmap(struct file *file, unsigned long reqprot, | |||
2197 | unsigned long addr, | 2217 | unsigned long addr, |
2198 | unsigned long addr_only) | 2218 | unsigned long addr_only) |
2199 | { | 2219 | { |
2200 | if ((addr < mmap_min_addr) && !capable(CAP_SYS_RAWIO)) | 2220 | return cap_file_mmap(file, reqprot, prot, flags, addr, addr_only); |
2201 | return -EACCES; | ||
2202 | return 0; | ||
2203 | } | 2221 | } |
2204 | 2222 | ||
2205 | static inline int security_file_mprotect(struct vm_area_struct *vma, | 2223 | static inline int security_file_mprotect(struct vm_area_struct *vma, |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 646102eeff92..317d913a1488 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -177,7 +177,6 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *event_call) \ | |||
177 | event_enter_##sname.id = id; \ | 177 | event_enter_##sname.id = id; \ |
178 | set_syscall_enter_id(num, id); \ | 178 | set_syscall_enter_id(num, id); \ |
179 | INIT_LIST_HEAD(&event_enter_##sname.fields); \ | 179 | INIT_LIST_HEAD(&event_enter_##sname.fields); \ |
180 | init_preds(&event_enter_##sname); \ | ||
181 | return 0; \ | 180 | return 0; \ |
182 | } \ | 181 | } \ |
183 | TRACE_SYS_ENTER_PROFILE(sname); \ | 182 | TRACE_SYS_ENTER_PROFILE(sname); \ |
@@ -214,7 +213,6 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *event_call) \ | |||
214 | event_exit_##sname.id = id; \ | 213 | event_exit_##sname.id = id; \ |
215 | set_syscall_exit_id(num, id); \ | 214 | set_syscall_exit_id(num, id); \ |
216 | INIT_LIST_HEAD(&event_exit_##sname.fields); \ | 215 | INIT_LIST_HEAD(&event_exit_##sname.fields); \ |
217 | init_preds(&event_exit_##sname); \ | ||
218 | return 0; \ | 216 | return 0; \ |
219 | } \ | 217 | } \ |
220 | TRACE_SYS_EXIT_PROFILE(sname); \ | 218 | TRACE_SYS_EXIT_PROFILE(sname); \ |
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h index ed889f4168f3..ae779bb8cc0f 100644 --- a/include/linux/ucb1400.h +++ b/include/linux/ucb1400.h | |||
@@ -73,6 +73,10 @@ | |||
73 | 73 | ||
74 | #define UCB_ADC_DATA 0x68 | 74 | #define UCB_ADC_DATA 0x68 |
75 | #define UCB_ADC_DAT_VALID (1 << 15) | 75 | #define UCB_ADC_DAT_VALID (1 << 15) |
76 | |||
77 | #define UCB_FCSR 0x6c | ||
78 | #define UCB_FCSR_AVE (1 << 12) | ||
79 | |||
76 | #define UCB_ADC_DAT_MASK 0x3ff | 80 | #define UCB_ADC_DAT_MASK 0x3ff |
77 | 81 | ||
78 | #define UCB_ID 0x7e | 82 | #define UCB_ID 0x7e |
diff --git a/include/linux/wait.h b/include/linux/wait.h index 6788e1a4d4ca..cf3c2f5dba51 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -77,7 +77,14 @@ struct task_struct; | |||
77 | #define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ | 77 | #define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ |
78 | { .flags = word, .bit_nr = bit, } | 78 | { .flags = word, .bit_nr = bit, } |
79 | 79 | ||
80 | extern void init_waitqueue_head(wait_queue_head_t *q); | 80 | extern void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *); |
81 | |||
82 | #define init_waitqueue_head(q) \ | ||
83 | do { \ | ||
84 | static struct lock_class_key __key; \ | ||
85 | \ | ||
86 | __init_waitqueue_head((q), &__key); \ | ||
87 | } while (0) | ||
81 | 88 | ||
82 | #ifdef CONFIG_LOCKDEP | 89 | #ifdef CONFIG_LOCKDEP |
83 | # define __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) \ | 90 | # define __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) \ |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 13e1adf55c4c..6273fa97b527 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -240,6 +240,21 @@ static inline int cancel_delayed_work(struct delayed_work *work) | |||
240 | return ret; | 240 | return ret; |
241 | } | 241 | } |
242 | 242 | ||
243 | /* | ||
244 | * Like above, but uses del_timer() instead of del_timer_sync(). This means, | ||
245 | * if it returns 0 the timer function may be running and the queueing is in | ||
246 | * progress. | ||
247 | */ | ||
248 | static inline int __cancel_delayed_work(struct delayed_work *work) | ||
249 | { | ||
250 | int ret; | ||
251 | |||
252 | ret = del_timer(&work->timer); | ||
253 | if (ret) | ||
254 | work_clear_pending(&work->work); | ||
255 | return ret; | ||
256 | } | ||
257 | |||
243 | extern int cancel_delayed_work_sync(struct delayed_work *work); | 258 | extern int cancel_delayed_work_sync(struct delayed_work *work); |
244 | 259 | ||
245 | /* Obsolete. use cancel_delayed_work_sync() */ | 260 | /* Obsolete. use cancel_delayed_work_sync() */ |
diff --git a/include/net/act_api.h b/include/net/act_api.h index 565eed8fe496..c05fd717c588 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
@@ -16,7 +16,7 @@ struct tcf_common { | |||
16 | u32 tcfc_capab; | 16 | u32 tcfc_capab; |
17 | int tcfc_action; | 17 | int tcfc_action; |
18 | struct tcf_t tcfc_tm; | 18 | struct tcf_t tcfc_tm; |
19 | struct gnet_stats_basic tcfc_bstats; | 19 | struct gnet_stats_basic_packed tcfc_bstats; |
20 | struct gnet_stats_queue tcfc_qstats; | 20 | struct gnet_stats_queue tcfc_qstats; |
21 | struct gnet_stats_rate_est tcfc_rate_est; | 21 | struct gnet_stats_rate_est tcfc_rate_est; |
22 | spinlock_t tcfc_lock; | 22 | spinlock_t tcfc_lock; |
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h index d136b5240ef2..c1488553e349 100644 --- a/include/net/gen_stats.h +++ b/include/net/gen_stats.h | |||
@@ -28,7 +28,7 @@ extern int gnet_stats_start_copy_compat(struct sk_buff *skb, int type, | |||
28 | spinlock_t *lock, struct gnet_dump *d); | 28 | spinlock_t *lock, struct gnet_dump *d); |
29 | 29 | ||
30 | extern int gnet_stats_copy_basic(struct gnet_dump *d, | 30 | extern int gnet_stats_copy_basic(struct gnet_dump *d, |
31 | struct gnet_stats_basic *b); | 31 | struct gnet_stats_basic_packed *b); |
32 | extern int gnet_stats_copy_rate_est(struct gnet_dump *d, | 32 | extern int gnet_stats_copy_rate_est(struct gnet_dump *d, |
33 | struct gnet_stats_rate_est *r); | 33 | struct gnet_stats_rate_est *r); |
34 | extern int gnet_stats_copy_queue(struct gnet_dump *d, | 34 | extern int gnet_stats_copy_queue(struct gnet_dump *d, |
@@ -37,14 +37,14 @@ extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len); | |||
37 | 37 | ||
38 | extern int gnet_stats_finish_copy(struct gnet_dump *d); | 38 | extern int gnet_stats_finish_copy(struct gnet_dump *d); |
39 | 39 | ||
40 | extern int gen_new_estimator(struct gnet_stats_basic *bstats, | 40 | extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats, |
41 | struct gnet_stats_rate_est *rate_est, | 41 | struct gnet_stats_rate_est *rate_est, |
42 | spinlock_t *stats_lock, struct nlattr *opt); | 42 | spinlock_t *stats_lock, struct nlattr *opt); |
43 | extern void gen_kill_estimator(struct gnet_stats_basic *bstats, | 43 | extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, |
44 | struct gnet_stats_rate_est *rate_est); | 44 | struct gnet_stats_rate_est *rate_est); |
45 | extern int gen_replace_estimator(struct gnet_stats_basic *bstats, | 45 | extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, |
46 | struct gnet_stats_rate_est *rate_est, | 46 | struct gnet_stats_rate_est *rate_est, |
47 | spinlock_t *stats_lock, struct nlattr *opt); | 47 | spinlock_t *stats_lock, struct nlattr *opt); |
48 | extern bool gen_estimator_active(const struct gnet_stats_basic *bstats, | 48 | extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, |
49 | const struct gnet_stats_rate_est *rate_est); | 49 | const struct gnet_stats_rate_est *rate_est); |
50 | #endif | 50 | #endif |
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h index 65d594dffbff..ddbf37e19616 100644 --- a/include/net/netfilter/xt_rateest.h +++ b/include/net/netfilter/xt_rateest.h | |||
@@ -8,7 +8,7 @@ struct xt_rateest { | |||
8 | spinlock_t lock; | 8 | spinlock_t lock; |
9 | struct gnet_estimator params; | 9 | struct gnet_estimator params; |
10 | struct gnet_stats_rate_est rstats; | 10 | struct gnet_stats_rate_est rstats; |
11 | struct gnet_stats_basic bstats; | 11 | struct gnet_stats_basic_packed bstats; |
12 | }; | 12 | }; |
13 | 13 | ||
14 | extern struct xt_rateest *xt_rateest_lookup(const char *name); | 14 | extern struct xt_rateest *xt_rateest_lookup(const char *name); |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 964ffa0d8815..5482e9582f55 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -72,7 +72,7 @@ struct Qdisc | |||
72 | */ | 72 | */ |
73 | unsigned long state; | 73 | unsigned long state; |
74 | struct sk_buff_head q; | 74 | struct sk_buff_head q; |
75 | struct gnet_stats_basic bstats; | 75 | struct gnet_stats_basic_packed bstats; |
76 | struct gnet_stats_queue qstats; | 76 | struct gnet_stats_queue qstats; |
77 | }; | 77 | }; |
78 | 78 | ||
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h index a89ed590597a..2a4b3bf74033 100644 --- a/include/trace/define_trace.h +++ b/include/trace/define_trace.h | |||
@@ -62,6 +62,7 @@ | |||
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | #undef TRACE_EVENT | 64 | #undef TRACE_EVENT |
65 | #undef TRACE_EVENT_FN | ||
65 | #undef TRACE_HEADER_MULTI_READ | 66 | #undef TRACE_HEADER_MULTI_READ |
66 | 67 | ||
67 | /* Only undef what we defined in this file */ | 68 | /* Only undef what we defined in this file */ |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index f2bd7a8f8e8b..5d3df2a5049d 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -45,14 +45,15 @@ | |||
45 | }; \ | 45 | }; \ |
46 | static struct ftrace_event_call event_##name | 46 | static struct ftrace_event_call event_##name |
47 | 47 | ||
48 | #undef __cpparg | ||
49 | #define __cpparg(arg...) arg | ||
50 | |||
48 | /* Callbacks are meaningless to ftrace. */ | 51 | /* Callbacks are meaningless to ftrace. */ |
49 | #undef TRACE_EVENT_FN | 52 | #undef TRACE_EVENT_FN |
50 | #define TRACE_EVENT_FN(name, proto, args, tstruct, \ | 53 | #define TRACE_EVENT_FN(name, proto, args, tstruct, \ |
51 | assign, print, reg, unreg) \ | 54 | assign, print, reg, unreg) \ |
52 | TRACE_EVENT(name, TP_PROTO(proto), TP_ARGS(args), \ | 55 | TRACE_EVENT(name, __cpparg(proto), __cpparg(args), \ |
53 | TP_STRUCT__entry(tstruct), \ | 56 | __cpparg(tstruct), __cpparg(assign), __cpparg(print)) \ |
54 | TP_fast_assign(assign), \ | ||
55 | TP_printk(print)) | ||
56 | 57 | ||
57 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 58 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
58 | 59 | ||
@@ -459,13 +460,15 @@ static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\ | |||
459 | * { | 460 | * { |
460 | * struct ring_buffer_event *event; | 461 | * struct ring_buffer_event *event; |
461 | * struct ftrace_raw_<call> *entry; <-- defined in stage 1 | 462 | * struct ftrace_raw_<call> *entry; <-- defined in stage 1 |
463 | * struct ring_buffer *buffer; | ||
462 | * unsigned long irq_flags; | 464 | * unsigned long irq_flags; |
463 | * int pc; | 465 | * int pc; |
464 | * | 466 | * |
465 | * local_save_flags(irq_flags); | 467 | * local_save_flags(irq_flags); |
466 | * pc = preempt_count(); | 468 | * pc = preempt_count(); |
467 | * | 469 | * |
468 | * event = trace_current_buffer_lock_reserve(event_<call>.id, | 470 | * event = trace_current_buffer_lock_reserve(&buffer, |
471 | * event_<call>.id, | ||
469 | * sizeof(struct ftrace_raw_<call>), | 472 | * sizeof(struct ftrace_raw_<call>), |
470 | * irq_flags, pc); | 473 | * irq_flags, pc); |
471 | * if (!event) | 474 | * if (!event) |
@@ -475,7 +478,7 @@ static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\ | |||
475 | * <assign>; <-- Here we assign the entries by the __field and | 478 | * <assign>; <-- Here we assign the entries by the __field and |
476 | * __array macros. | 479 | * __array macros. |
477 | * | 480 | * |
478 | * trace_current_buffer_unlock_commit(event, irq_flags, pc); | 481 | * trace_current_buffer_unlock_commit(buffer, event, irq_flags, pc); |
479 | * } | 482 | * } |
480 | * | 483 | * |
481 | * static int ftrace_raw_reg_event_<call>(struct ftrace_event_call *unused) | 484 | * static int ftrace_raw_reg_event_<call>(struct ftrace_event_call *unused) |
@@ -567,6 +570,7 @@ static void ftrace_raw_event_##call(proto) \ | |||
567 | struct ftrace_event_call *event_call = &event_##call; \ | 570 | struct ftrace_event_call *event_call = &event_##call; \ |
568 | struct ring_buffer_event *event; \ | 571 | struct ring_buffer_event *event; \ |
569 | struct ftrace_raw_##call *entry; \ | 572 | struct ftrace_raw_##call *entry; \ |
573 | struct ring_buffer *buffer; \ | ||
570 | unsigned long irq_flags; \ | 574 | unsigned long irq_flags; \ |
571 | int __data_size; \ | 575 | int __data_size; \ |
572 | int pc; \ | 576 | int pc; \ |
@@ -576,7 +580,8 @@ static void ftrace_raw_event_##call(proto) \ | |||
576 | \ | 580 | \ |
577 | __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ | 581 | __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ |
578 | \ | 582 | \ |
579 | event = trace_current_buffer_lock_reserve(event_##call.id, \ | 583 | event = trace_current_buffer_lock_reserve(&buffer, \ |
584 | event_##call.id, \ | ||
580 | sizeof(*entry) + __data_size, \ | 585 | sizeof(*entry) + __data_size, \ |
581 | irq_flags, pc); \ | 586 | irq_flags, pc); \ |
582 | if (!event) \ | 587 | if (!event) \ |
@@ -588,8 +593,9 @@ static void ftrace_raw_event_##call(proto) \ | |||
588 | \ | 593 | \ |
589 | { assign; } \ | 594 | { assign; } \ |
590 | \ | 595 | \ |
591 | if (!filter_current_check_discard(event_call, entry, event)) \ | 596 | if (!filter_current_check_discard(buffer, event_call, entry, event)) \ |
592 | trace_nowake_buffer_unlock_commit(event, irq_flags, pc); \ | 597 | trace_nowake_buffer_unlock_commit(buffer, \ |
598 | event, irq_flags, pc); \ | ||
593 | } \ | 599 | } \ |
594 | \ | 600 | \ |
595 | static int ftrace_raw_reg_event_##call(struct ftrace_event_call *unused)\ | 601 | static int ftrace_raw_reg_event_##call(struct ftrace_event_call *unused)\ |
@@ -621,7 +627,6 @@ static int ftrace_raw_init_event_##call(struct ftrace_event_call *unused)\ | |||
621 | return -ENODEV; \ | 627 | return -ENODEV; \ |
622 | event_##call.id = id; \ | 628 | event_##call.id = id; \ |
623 | INIT_LIST_HEAD(&event_##call.fields); \ | 629 | INIT_LIST_HEAD(&event_##call.fields); \ |
624 | init_preds(&event_##call); \ | ||
625 | return 0; \ | 630 | return 0; \ |
626 | } \ | 631 | } \ |
627 | \ | 632 | \ |
diff --git a/init/main.c b/init/main.c index 2c5ade79eb81..11f4f145be3f 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -584,8 +584,8 @@ asmlinkage void __init start_kernel(void) | |||
584 | setup_arch(&command_line); | 584 | setup_arch(&command_line); |
585 | mm_init_owner(&init_mm, &init_task); | 585 | mm_init_owner(&init_mm, &init_task); |
586 | setup_command_line(command_line); | 586 | setup_command_line(command_line); |
587 | setup_per_cpu_areas(); | ||
588 | setup_nr_cpu_ids(); | 587 | setup_nr_cpu_ids(); |
588 | setup_per_cpu_areas(); | ||
589 | smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ | 589 | smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ |
590 | 590 | ||
591 | build_all_zonelists(); | 591 | build_all_zonelists(); |
@@ -733,13 +733,14 @@ static void __init do_ctors(void) | |||
733 | int initcall_debug; | 733 | int initcall_debug; |
734 | core_param(initcall_debug, initcall_debug, bool, 0644); | 734 | core_param(initcall_debug, initcall_debug, bool, 0644); |
735 | 735 | ||
736 | static char msgbuf[64]; | ||
737 | static struct boot_trace_call call; | ||
738 | static struct boot_trace_ret ret; | ||
739 | |||
736 | int do_one_initcall(initcall_t fn) | 740 | int do_one_initcall(initcall_t fn) |
737 | { | 741 | { |
738 | int count = preempt_count(); | 742 | int count = preempt_count(); |
739 | ktime_t calltime, delta, rettime; | 743 | ktime_t calltime, delta, rettime; |
740 | char msgbuf[64]; | ||
741 | struct boot_trace_call call; | ||
742 | struct boot_trace_ret ret; | ||
743 | 744 | ||
744 | if (initcall_debug) { | 745 | if (initcall_debug) { |
745 | call.caller = task_pid_nr(current); | 746 | call.caller = task_pid_nr(current); |
@@ -174,7 +174,7 @@ static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp) | |||
174 | shm_unlock(shp); | 174 | shm_unlock(shp); |
175 | if (!is_file_hugepages(shp->shm_file)) | 175 | if (!is_file_hugepages(shp->shm_file)) |
176 | shmem_lock(shp->shm_file, 0, shp->mlock_user); | 176 | shmem_lock(shp->shm_file, 0, shp->mlock_user); |
177 | else | 177 | else if (shp->mlock_user) |
178 | user_shm_unlock(shp->shm_file->f_path.dentry->d_inode->i_size, | 178 | user_shm_unlock(shp->shm_file->f_path.dentry->d_inode->i_size, |
179 | shp->mlock_user); | 179 | shp->mlock_user); |
180 | fput (shp->shm_file); | 180 | fput (shp->shm_file); |
@@ -369,8 +369,8 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) | |||
369 | /* hugetlb_file_setup applies strict accounting */ | 369 | /* hugetlb_file_setup applies strict accounting */ |
370 | if (shmflg & SHM_NORESERVE) | 370 | if (shmflg & SHM_NORESERVE) |
371 | acctflag = VM_NORESERVE; | 371 | acctflag = VM_NORESERVE; |
372 | file = hugetlb_file_setup(name, size, acctflag); | 372 | file = hugetlb_file_setup(name, size, acctflag, |
373 | shp->mlock_user = current_user(); | 373 | &shp->mlock_user); |
374 | } else { | 374 | } else { |
375 | /* | 375 | /* |
376 | * Do not allow no accounting for OVERCOMMIT_NEVER, even | 376 | * Do not allow no accounting for OVERCOMMIT_NEVER, even |
@@ -410,6 +410,8 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) | |||
410 | return error; | 410 | return error; |
411 | 411 | ||
412 | no_id: | 412 | no_id: |
413 | if (shp->mlock_user) /* shmflg & SHM_HUGETLB case */ | ||
414 | user_shm_unlock(size, shp->mlock_user); | ||
413 | fput(file); | 415 | fput(file); |
414 | no_file: | 416 | no_file: |
415 | security_shm_free(shp); | 417 | security_shm_free(shp); |
diff --git a/kernel/fork.c b/kernel/fork.c index 021e1138556e..e6c04d462ab2 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -426,7 +426,6 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p) | |||
426 | init_rwsem(&mm->mmap_sem); | 426 | init_rwsem(&mm->mmap_sem); |
427 | INIT_LIST_HEAD(&mm->mmlist); | 427 | INIT_LIST_HEAD(&mm->mmlist); |
428 | mm->flags = (current->mm) ? current->mm->flags : default_dump_filter; | 428 | mm->flags = (current->mm) ? current->mm->flags : default_dump_filter; |
429 | mm->oom_adj = (current->mm) ? current->mm->oom_adj : 0; | ||
430 | mm->core_state = NULL; | 429 | mm->core_state = NULL; |
431 | mm->nr_ptes = 0; | 430 | mm->nr_ptes = 0; |
432 | set_mm_counter(mm, file_rss, 0); | 431 | set_mm_counter(mm, file_rss, 0); |
@@ -816,11 +815,8 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) | |||
816 | { | 815 | { |
817 | struct signal_struct *sig; | 816 | struct signal_struct *sig; |
818 | 817 | ||
819 | if (clone_flags & CLONE_THREAD) { | 818 | if (clone_flags & CLONE_THREAD) |
820 | atomic_inc(¤t->signal->count); | ||
821 | atomic_inc(¤t->signal->live); | ||
822 | return 0; | 819 | return 0; |
823 | } | ||
824 | 820 | ||
825 | sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); | 821 | sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); |
826 | tsk->signal = sig; | 822 | tsk->signal = sig; |
@@ -878,16 +874,6 @@ void __cleanup_signal(struct signal_struct *sig) | |||
878 | kmem_cache_free(signal_cachep, sig); | 874 | kmem_cache_free(signal_cachep, sig); |
879 | } | 875 | } |
880 | 876 | ||
881 | static void cleanup_signal(struct task_struct *tsk) | ||
882 | { | ||
883 | struct signal_struct *sig = tsk->signal; | ||
884 | |||
885 | atomic_dec(&sig->live); | ||
886 | |||
887 | if (atomic_dec_and_test(&sig->count)) | ||
888 | __cleanup_signal(sig); | ||
889 | } | ||
890 | |||
891 | static void copy_flags(unsigned long clone_flags, struct task_struct *p) | 877 | static void copy_flags(unsigned long clone_flags, struct task_struct *p) |
892 | { | 878 | { |
893 | unsigned long new_flags = p->flags; | 879 | unsigned long new_flags = p->flags; |
@@ -1240,6 +1226,8 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1240 | } | 1226 | } |
1241 | 1227 | ||
1242 | if (clone_flags & CLONE_THREAD) { | 1228 | if (clone_flags & CLONE_THREAD) { |
1229 | atomic_inc(¤t->signal->count); | ||
1230 | atomic_inc(¤t->signal->live); | ||
1243 | p->group_leader = current->group_leader; | 1231 | p->group_leader = current->group_leader; |
1244 | list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group); | 1232 | list_add_tail_rcu(&p->thread_group, &p->group_leader->thread_group); |
1245 | } | 1233 | } |
@@ -1283,7 +1271,8 @@ bad_fork_cleanup_mm: | |||
1283 | if (p->mm) | 1271 | if (p->mm) |
1284 | mmput(p->mm); | 1272 | mmput(p->mm); |
1285 | bad_fork_cleanup_signal: | 1273 | bad_fork_cleanup_signal: |
1286 | cleanup_signal(p); | 1274 | if (!(clone_flags & CLONE_THREAD)) |
1275 | __cleanup_signal(p->signal); | ||
1287 | bad_fork_cleanup_sighand: | 1276 | bad_fork_cleanup_sighand: |
1288 | __cleanup_sighand(p->sighand); | 1277 | __cleanup_sighand(p->sighand); |
1289 | bad_fork_cleanup_fs: | 1278 | bad_fork_cleanup_fs: |
diff --git a/kernel/futex.c b/kernel/futex.c index 0672ff88f159..e18cfbdc7190 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -1010,15 +1010,19 @@ void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1, | |||
1010 | * requeue_pi_wake_futex() - Wake a task that acquired the lock during requeue | 1010 | * requeue_pi_wake_futex() - Wake a task that acquired the lock during requeue |
1011 | * q: the futex_q | 1011 | * q: the futex_q |
1012 | * key: the key of the requeue target futex | 1012 | * key: the key of the requeue target futex |
1013 | * hb: the hash_bucket of the requeue target futex | ||
1013 | * | 1014 | * |
1014 | * During futex_requeue, with requeue_pi=1, it is possible to acquire the | 1015 | * During futex_requeue, with requeue_pi=1, it is possible to acquire the |
1015 | * target futex if it is uncontended or via a lock steal. Set the futex_q key | 1016 | * target futex if it is uncontended or via a lock steal. Set the futex_q key |
1016 | * to the requeue target futex so the waiter can detect the wakeup on the right | 1017 | * to the requeue target futex so the waiter can detect the wakeup on the right |
1017 | * futex, but remove it from the hb and NULL the rt_waiter so it can detect | 1018 | * futex, but remove it from the hb and NULL the rt_waiter so it can detect |
1018 | * atomic lock acquisition. Must be called with the q->lock_ptr held. | 1019 | * atomic lock acquisition. Set the q->lock_ptr to the requeue target hb->lock |
1020 | * to protect access to the pi_state to fixup the owner later. Must be called | ||
1021 | * with both q->lock_ptr and hb->lock held. | ||
1019 | */ | 1022 | */ |
1020 | static inline | 1023 | static inline |
1021 | void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key) | 1024 | void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key, |
1025 | struct futex_hash_bucket *hb) | ||
1022 | { | 1026 | { |
1023 | drop_futex_key_refs(&q->key); | 1027 | drop_futex_key_refs(&q->key); |
1024 | get_futex_key_refs(key); | 1028 | get_futex_key_refs(key); |
@@ -1030,6 +1034,11 @@ void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key) | |||
1030 | WARN_ON(!q->rt_waiter); | 1034 | WARN_ON(!q->rt_waiter); |
1031 | q->rt_waiter = NULL; | 1035 | q->rt_waiter = NULL; |
1032 | 1036 | ||
1037 | q->lock_ptr = &hb->lock; | ||
1038 | #ifdef CONFIG_DEBUG_PI_LIST | ||
1039 | q->list.plist.lock = &hb->lock; | ||
1040 | #endif | ||
1041 | |||
1033 | wake_up_state(q->task, TASK_NORMAL); | 1042 | wake_up_state(q->task, TASK_NORMAL); |
1034 | } | 1043 | } |
1035 | 1044 | ||
@@ -1088,7 +1097,7 @@ static int futex_proxy_trylock_atomic(u32 __user *pifutex, | |||
1088 | ret = futex_lock_pi_atomic(pifutex, hb2, key2, ps, top_waiter->task, | 1097 | ret = futex_lock_pi_atomic(pifutex, hb2, key2, ps, top_waiter->task, |
1089 | set_waiters); | 1098 | set_waiters); |
1090 | if (ret == 1) | 1099 | if (ret == 1) |
1091 | requeue_pi_wake_futex(top_waiter, key2); | 1100 | requeue_pi_wake_futex(top_waiter, key2, hb2); |
1092 | 1101 | ||
1093 | return ret; | 1102 | return ret; |
1094 | } | 1103 | } |
@@ -1247,8 +1256,15 @@ retry_private: | |||
1247 | if (!match_futex(&this->key, &key1)) | 1256 | if (!match_futex(&this->key, &key1)) |
1248 | continue; | 1257 | continue; |
1249 | 1258 | ||
1250 | WARN_ON(!requeue_pi && this->rt_waiter); | 1259 | /* |
1251 | WARN_ON(requeue_pi && !this->rt_waiter); | 1260 | * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always |
1261 | * be paired with each other and no other futex ops. | ||
1262 | */ | ||
1263 | if ((requeue_pi && !this->rt_waiter) || | ||
1264 | (!requeue_pi && this->rt_waiter)) { | ||
1265 | ret = -EINVAL; | ||
1266 | break; | ||
1267 | } | ||
1252 | 1268 | ||
1253 | /* | 1269 | /* |
1254 | * Wake nr_wake waiters. For requeue_pi, if we acquired the | 1270 | * Wake nr_wake waiters. For requeue_pi, if we acquired the |
@@ -1273,7 +1289,7 @@ retry_private: | |||
1273 | this->task, 1); | 1289 | this->task, 1); |
1274 | if (ret == 1) { | 1290 | if (ret == 1) { |
1275 | /* We got the lock. */ | 1291 | /* We got the lock. */ |
1276 | requeue_pi_wake_futex(this, &key2); | 1292 | requeue_pi_wake_futex(this, &key2, hb2); |
1277 | continue; | 1293 | continue; |
1278 | } else if (ret) { | 1294 | } else if (ret) { |
1279 | /* -EDEADLK */ | 1295 | /* -EDEADLK */ |
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c index d607a5b9ee29..235716556bf1 100644 --- a/kernel/futex_compat.c +++ b/kernel/futex_compat.c | |||
@@ -180,7 +180,8 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, | |||
180 | int cmd = op & FUTEX_CMD_MASK; | 180 | int cmd = op & FUTEX_CMD_MASK; |
181 | 181 | ||
182 | if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI || | 182 | if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI || |
183 | cmd == FUTEX_WAIT_BITSET)) { | 183 | cmd == FUTEX_WAIT_BITSET || |
184 | cmd == FUTEX_WAIT_REQUEUE_PI)) { | ||
184 | if (get_compat_timespec(&ts, utime)) | 185 | if (get_compat_timespec(&ts, utime)) |
185 | return -EFAULT; | 186 | return -EFAULT; |
186 | if (!timespec_valid(&ts)) | 187 | if (!timespec_valid(&ts)) |
@@ -191,7 +192,8 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, | |||
191 | t = ktime_add_safe(ktime_get(), t); | 192 | t = ktime_add_safe(ktime_get(), t); |
192 | tp = &t; | 193 | tp = &t; |
193 | } | 194 | } |
194 | if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE) | 195 | if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE || |
196 | cmd == FUTEX_CMP_REQUEUE_PI || cmd == FUTEX_WAKE_OP) | ||
195 | val2 = (int) (unsigned long) utime; | 197 | val2 = (int) (unsigned long) utime; |
196 | 198 | ||
197 | return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); | 199 | return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 61c679db4687..0ec9ed831737 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -607,7 +607,6 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) | |||
607 | */ | 607 | */ |
608 | get_task_struct(t); | 608 | get_task_struct(t); |
609 | new->thread = t; | 609 | new->thread = t; |
610 | wake_up_process(t); | ||
611 | } | 610 | } |
612 | 611 | ||
613 | /* | 612 | /* |
@@ -690,6 +689,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) | |||
690 | (int)(new->flags & IRQF_TRIGGER_MASK)); | 689 | (int)(new->flags & IRQF_TRIGGER_MASK)); |
691 | } | 690 | } |
692 | 691 | ||
692 | new->irq = irq; | ||
693 | *old_ptr = new; | 693 | *old_ptr = new; |
694 | 694 | ||
695 | /* Reset broken irq detection when installing new handler */ | 695 | /* Reset broken irq detection when installing new handler */ |
@@ -707,7 +707,13 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) | |||
707 | 707 | ||
708 | spin_unlock_irqrestore(&desc->lock, flags); | 708 | spin_unlock_irqrestore(&desc->lock, flags); |
709 | 709 | ||
710 | new->irq = irq; | 710 | /* |
711 | * Strictly no need to wake it up, but hung_task complains | ||
712 | * when no hard interrupt wakes the thread up. | ||
713 | */ | ||
714 | if (new->thread) | ||
715 | wake_up_process(new->thread); | ||
716 | |||
711 | register_irq_proc(irq, desc); | 717 | register_irq_proc(irq, desc); |
712 | new->dir = NULL; | 718 | new->dir = NULL; |
713 | register_handler_proc(irq, new); | 719 | register_handler_proc(irq, new); |
@@ -761,7 +767,6 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) | |||
761 | { | 767 | { |
762 | struct irq_desc *desc = irq_to_desc(irq); | 768 | struct irq_desc *desc = irq_to_desc(irq); |
763 | struct irqaction *action, **action_ptr; | 769 | struct irqaction *action, **action_ptr; |
764 | struct task_struct *irqthread; | ||
765 | unsigned long flags; | 770 | unsigned long flags; |
766 | 771 | ||
767 | WARN(in_interrupt(), "Trying to free IRQ %d from IRQ context!\n", irq); | 772 | WARN(in_interrupt(), "Trying to free IRQ %d from IRQ context!\n", irq); |
@@ -809,9 +814,6 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) | |||
809 | desc->chip->disable(irq); | 814 | desc->chip->disable(irq); |
810 | } | 815 | } |
811 | 816 | ||
812 | irqthread = action->thread; | ||
813 | action->thread = NULL; | ||
814 | |||
815 | spin_unlock_irqrestore(&desc->lock, flags); | 817 | spin_unlock_irqrestore(&desc->lock, flags); |
816 | 818 | ||
817 | unregister_handler_proc(irq, action); | 819 | unregister_handler_proc(irq, action); |
@@ -819,12 +821,6 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) | |||
819 | /* Make sure it's not being used on another CPU: */ | 821 | /* Make sure it's not being used on another CPU: */ |
820 | synchronize_irq(irq); | 822 | synchronize_irq(irq); |
821 | 823 | ||
822 | if (irqthread) { | ||
823 | if (!test_bit(IRQTF_DIED, &action->thread_flags)) | ||
824 | kthread_stop(irqthread); | ||
825 | put_task_struct(irqthread); | ||
826 | } | ||
827 | |||
828 | #ifdef CONFIG_DEBUG_SHIRQ | 824 | #ifdef CONFIG_DEBUG_SHIRQ |
829 | /* | 825 | /* |
830 | * It's a shared IRQ -- the driver ought to be prepared for an IRQ | 826 | * It's a shared IRQ -- the driver ought to be prepared for an IRQ |
@@ -840,6 +836,13 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) | |||
840 | local_irq_restore(flags); | 836 | local_irq_restore(flags); |
841 | } | 837 | } |
842 | #endif | 838 | #endif |
839 | |||
840 | if (action->thread) { | ||
841 | if (!test_bit(IRQTF_DIED, &action->thread_flags)) | ||
842 | kthread_stop(action->thread); | ||
843 | put_task_struct(action->thread); | ||
844 | } | ||
845 | |||
843 | return action; | 846 | return action; |
844 | } | 847 | } |
845 | 848 | ||
diff --git a/kernel/module.c b/kernel/module.c index b1821438694e..46580edff0cb 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -914,16 +914,18 @@ void __symbol_put(const char *symbol) | |||
914 | } | 914 | } |
915 | EXPORT_SYMBOL(__symbol_put); | 915 | EXPORT_SYMBOL(__symbol_put); |
916 | 916 | ||
917 | /* Note this assumes addr is a function, which it currently always is. */ | ||
917 | void symbol_put_addr(void *addr) | 918 | void symbol_put_addr(void *addr) |
918 | { | 919 | { |
919 | struct module *modaddr; | 920 | struct module *modaddr; |
921 | unsigned long a = (unsigned long)dereference_function_descriptor(addr); | ||
920 | 922 | ||
921 | if (core_kernel_text((unsigned long)addr)) | 923 | if (core_kernel_text(a)) |
922 | return; | 924 | return; |
923 | 925 | ||
924 | /* module_text_address is safe here: we're supposed to have reference | 926 | /* module_text_address is safe here: we're supposed to have reference |
925 | * to module from symbol_get, so it can't go away. */ | 927 | * to module from symbol_get, so it can't go away. */ |
926 | modaddr = __module_text_address((unsigned long)addr); | 928 | modaddr = __module_text_address(a); |
927 | BUG_ON(!modaddr); | 929 | BUG_ON(!modaddr); |
928 | module_put(modaddr); | 930 | module_put(modaddr); |
929 | } | 931 | } |
@@ -1279,6 +1281,10 @@ static void add_notes_attrs(struct module *mod, unsigned int nsect, | |||
1279 | struct module_notes_attrs *notes_attrs; | 1281 | struct module_notes_attrs *notes_attrs; |
1280 | struct bin_attribute *nattr; | 1282 | struct bin_attribute *nattr; |
1281 | 1283 | ||
1284 | /* failed to create section attributes, so can't create notes */ | ||
1285 | if (!mod->sect_attrs) | ||
1286 | return; | ||
1287 | |||
1282 | /* Count notes sections and allocate structures. */ | 1288 | /* Count notes sections and allocate structures. */ |
1283 | notes = 0; | 1289 | notes = 0; |
1284 | for (i = 0; i < nsect; i++) | 1290 | for (i = 0; i < nsect; i++) |
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index b0b20a07f394..d7cbc579fc80 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -50,7 +50,7 @@ static atomic_t nr_task_counters __read_mostly; | |||
50 | * 1 - disallow cpu counters to unpriv | 50 | * 1 - disallow cpu counters to unpriv |
51 | * 2 - disallow kernel profiling to unpriv | 51 | * 2 - disallow kernel profiling to unpriv |
52 | */ | 52 | */ |
53 | int sysctl_perf_counter_paranoid __read_mostly; | 53 | int sysctl_perf_counter_paranoid __read_mostly = 1; |
54 | 54 | ||
55 | static inline bool perf_paranoid_cpu(void) | 55 | static inline bool perf_paranoid_cpu(void) |
56 | { | 56 | { |
@@ -88,6 +88,7 @@ void __weak hw_perf_disable(void) { barrier(); } | |||
88 | void __weak hw_perf_enable(void) { barrier(); } | 88 | void __weak hw_perf_enable(void) { barrier(); } |
89 | 89 | ||
90 | void __weak hw_perf_counter_setup(int cpu) { barrier(); } | 90 | void __weak hw_perf_counter_setup(int cpu) { barrier(); } |
91 | void __weak hw_perf_counter_setup_online(int cpu) { barrier(); } | ||
91 | 92 | ||
92 | int __weak | 93 | int __weak |
93 | hw_perf_group_sched_in(struct perf_counter *group_leader, | 94 | hw_perf_group_sched_in(struct perf_counter *group_leader, |
@@ -306,6 +307,10 @@ counter_sched_out(struct perf_counter *counter, | |||
306 | return; | 307 | return; |
307 | 308 | ||
308 | counter->state = PERF_COUNTER_STATE_INACTIVE; | 309 | counter->state = PERF_COUNTER_STATE_INACTIVE; |
310 | if (counter->pending_disable) { | ||
311 | counter->pending_disable = 0; | ||
312 | counter->state = PERF_COUNTER_STATE_OFF; | ||
313 | } | ||
309 | counter->tstamp_stopped = ctx->time; | 314 | counter->tstamp_stopped = ctx->time; |
310 | counter->pmu->disable(counter); | 315 | counter->pmu->disable(counter); |
311 | counter->oncpu = -1; | 316 | counter->oncpu = -1; |
@@ -1498,10 +1503,21 @@ static void perf_counter_enable_on_exec(struct task_struct *task) | |||
1498 | */ | 1503 | */ |
1499 | static void __perf_counter_read(void *info) | 1504 | static void __perf_counter_read(void *info) |
1500 | { | 1505 | { |
1506 | struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context); | ||
1501 | struct perf_counter *counter = info; | 1507 | struct perf_counter *counter = info; |
1502 | struct perf_counter_context *ctx = counter->ctx; | 1508 | struct perf_counter_context *ctx = counter->ctx; |
1503 | unsigned long flags; | 1509 | unsigned long flags; |
1504 | 1510 | ||
1511 | /* | ||
1512 | * If this is a task context, we need to check whether it is | ||
1513 | * the current task context of this cpu. If not it has been | ||
1514 | * scheduled out before the smp call arrived. In that case | ||
1515 | * counter->count would have been updated to a recent sample | ||
1516 | * when the counter was scheduled out. | ||
1517 | */ | ||
1518 | if (ctx->task && cpuctx->task_ctx != ctx) | ||
1519 | return; | ||
1520 | |||
1505 | local_irq_save(flags); | 1521 | local_irq_save(flags); |
1506 | if (ctx->is_active) | 1522 | if (ctx->is_active) |
1507 | update_context_time(ctx); | 1523 | update_context_time(ctx); |
@@ -1691,7 +1707,32 @@ static int perf_release(struct inode *inode, struct file *file) | |||
1691 | return 0; | 1707 | return 0; |
1692 | } | 1708 | } |
1693 | 1709 | ||
1694 | static u64 perf_counter_read_tree(struct perf_counter *counter) | 1710 | static int perf_counter_read_size(struct perf_counter *counter) |
1711 | { | ||
1712 | int entry = sizeof(u64); /* value */ | ||
1713 | int size = 0; | ||
1714 | int nr = 1; | ||
1715 | |||
1716 | if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) | ||
1717 | size += sizeof(u64); | ||
1718 | |||
1719 | if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) | ||
1720 | size += sizeof(u64); | ||
1721 | |||
1722 | if (counter->attr.read_format & PERF_FORMAT_ID) | ||
1723 | entry += sizeof(u64); | ||
1724 | |||
1725 | if (counter->attr.read_format & PERF_FORMAT_GROUP) { | ||
1726 | nr += counter->group_leader->nr_siblings; | ||
1727 | size += sizeof(u64); | ||
1728 | } | ||
1729 | |||
1730 | size += entry * nr; | ||
1731 | |||
1732 | return size; | ||
1733 | } | ||
1734 | |||
1735 | static u64 perf_counter_read_value(struct perf_counter *counter) | ||
1695 | { | 1736 | { |
1696 | struct perf_counter *child; | 1737 | struct perf_counter *child; |
1697 | u64 total = 0; | 1738 | u64 total = 0; |
@@ -1703,14 +1744,96 @@ static u64 perf_counter_read_tree(struct perf_counter *counter) | |||
1703 | return total; | 1744 | return total; |
1704 | } | 1745 | } |
1705 | 1746 | ||
1747 | static int perf_counter_read_entry(struct perf_counter *counter, | ||
1748 | u64 read_format, char __user *buf) | ||
1749 | { | ||
1750 | int n = 0, count = 0; | ||
1751 | u64 values[2]; | ||
1752 | |||
1753 | values[n++] = perf_counter_read_value(counter); | ||
1754 | if (read_format & PERF_FORMAT_ID) | ||
1755 | values[n++] = primary_counter_id(counter); | ||
1756 | |||
1757 | count = n * sizeof(u64); | ||
1758 | |||
1759 | if (copy_to_user(buf, values, count)) | ||
1760 | return -EFAULT; | ||
1761 | |||
1762 | return count; | ||
1763 | } | ||
1764 | |||
1765 | static int perf_counter_read_group(struct perf_counter *counter, | ||
1766 | u64 read_format, char __user *buf) | ||
1767 | { | ||
1768 | struct perf_counter *leader = counter->group_leader, *sub; | ||
1769 | int n = 0, size = 0, err = -EFAULT; | ||
1770 | u64 values[3]; | ||
1771 | |||
1772 | values[n++] = 1 + leader->nr_siblings; | ||
1773 | if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) { | ||
1774 | values[n++] = leader->total_time_enabled + | ||
1775 | atomic64_read(&leader->child_total_time_enabled); | ||
1776 | } | ||
1777 | if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) { | ||
1778 | values[n++] = leader->total_time_running + | ||
1779 | atomic64_read(&leader->child_total_time_running); | ||
1780 | } | ||
1781 | |||
1782 | size = n * sizeof(u64); | ||
1783 | |||
1784 | if (copy_to_user(buf, values, size)) | ||
1785 | return -EFAULT; | ||
1786 | |||
1787 | err = perf_counter_read_entry(leader, read_format, buf + size); | ||
1788 | if (err < 0) | ||
1789 | return err; | ||
1790 | |||
1791 | size += err; | ||
1792 | |||
1793 | list_for_each_entry(sub, &leader->sibling_list, list_entry) { | ||
1794 | err = perf_counter_read_entry(sub, read_format, | ||
1795 | buf + size); | ||
1796 | if (err < 0) | ||
1797 | return err; | ||
1798 | |||
1799 | size += err; | ||
1800 | } | ||
1801 | |||
1802 | return size; | ||
1803 | } | ||
1804 | |||
1805 | static int perf_counter_read_one(struct perf_counter *counter, | ||
1806 | u64 read_format, char __user *buf) | ||
1807 | { | ||
1808 | u64 values[4]; | ||
1809 | int n = 0; | ||
1810 | |||
1811 | values[n++] = perf_counter_read_value(counter); | ||
1812 | if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) { | ||
1813 | values[n++] = counter->total_time_enabled + | ||
1814 | atomic64_read(&counter->child_total_time_enabled); | ||
1815 | } | ||
1816 | if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) { | ||
1817 | values[n++] = counter->total_time_running + | ||
1818 | atomic64_read(&counter->child_total_time_running); | ||
1819 | } | ||
1820 | if (read_format & PERF_FORMAT_ID) | ||
1821 | values[n++] = primary_counter_id(counter); | ||
1822 | |||
1823 | if (copy_to_user(buf, values, n * sizeof(u64))) | ||
1824 | return -EFAULT; | ||
1825 | |||
1826 | return n * sizeof(u64); | ||
1827 | } | ||
1828 | |||
1706 | /* | 1829 | /* |
1707 | * Read the performance counter - simple non blocking version for now | 1830 | * Read the performance counter - simple non blocking version for now |
1708 | */ | 1831 | */ |
1709 | static ssize_t | 1832 | static ssize_t |
1710 | perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count) | 1833 | perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count) |
1711 | { | 1834 | { |
1712 | u64 values[4]; | 1835 | u64 read_format = counter->attr.read_format; |
1713 | int n; | 1836 | int ret; |
1714 | 1837 | ||
1715 | /* | 1838 | /* |
1716 | * Return end-of-file for a read on a counter that is in | 1839 | * Return end-of-file for a read on a counter that is in |
@@ -1720,28 +1843,18 @@ perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count) | |||
1720 | if (counter->state == PERF_COUNTER_STATE_ERROR) | 1843 | if (counter->state == PERF_COUNTER_STATE_ERROR) |
1721 | return 0; | 1844 | return 0; |
1722 | 1845 | ||
1846 | if (count < perf_counter_read_size(counter)) | ||
1847 | return -ENOSPC; | ||
1848 | |||
1723 | WARN_ON_ONCE(counter->ctx->parent_ctx); | 1849 | WARN_ON_ONCE(counter->ctx->parent_ctx); |
1724 | mutex_lock(&counter->child_mutex); | 1850 | mutex_lock(&counter->child_mutex); |
1725 | values[0] = perf_counter_read_tree(counter); | 1851 | if (read_format & PERF_FORMAT_GROUP) |
1726 | n = 1; | 1852 | ret = perf_counter_read_group(counter, read_format, buf); |
1727 | if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) | 1853 | else |
1728 | values[n++] = counter->total_time_enabled + | 1854 | ret = perf_counter_read_one(counter, read_format, buf); |
1729 | atomic64_read(&counter->child_total_time_enabled); | ||
1730 | if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) | ||
1731 | values[n++] = counter->total_time_running + | ||
1732 | atomic64_read(&counter->child_total_time_running); | ||
1733 | if (counter->attr.read_format & PERF_FORMAT_ID) | ||
1734 | values[n++] = primary_counter_id(counter); | ||
1735 | mutex_unlock(&counter->child_mutex); | 1855 | mutex_unlock(&counter->child_mutex); |
1736 | 1856 | ||
1737 | if (count < n * sizeof(u64)) | 1857 | return ret; |
1738 | return -EINVAL; | ||
1739 | count = n * sizeof(u64); | ||
1740 | |||
1741 | if (copy_to_user(buf, values, count)) | ||
1742 | return -EFAULT; | ||
1743 | |||
1744 | return count; | ||
1745 | } | 1858 | } |
1746 | 1859 | ||
1747 | static ssize_t | 1860 | static ssize_t |
@@ -1906,6 +2019,10 @@ int perf_counter_task_disable(void) | |||
1906 | return 0; | 2019 | return 0; |
1907 | } | 2020 | } |
1908 | 2021 | ||
2022 | #ifndef PERF_COUNTER_INDEX_OFFSET | ||
2023 | # define PERF_COUNTER_INDEX_OFFSET 0 | ||
2024 | #endif | ||
2025 | |||
1909 | static int perf_counter_index(struct perf_counter *counter) | 2026 | static int perf_counter_index(struct perf_counter *counter) |
1910 | { | 2027 | { |
1911 | if (counter->state != PERF_COUNTER_STATE_ACTIVE) | 2028 | if (counter->state != PERF_COUNTER_STATE_ACTIVE) |
@@ -2245,7 +2362,7 @@ static void perf_pending_counter(struct perf_pending_entry *entry) | |||
2245 | 2362 | ||
2246 | if (counter->pending_disable) { | 2363 | if (counter->pending_disable) { |
2247 | counter->pending_disable = 0; | 2364 | counter->pending_disable = 0; |
2248 | perf_counter_disable(counter); | 2365 | __perf_counter_disable(counter); |
2249 | } | 2366 | } |
2250 | 2367 | ||
2251 | if (counter->pending_wakeup) { | 2368 | if (counter->pending_wakeup) { |
@@ -2630,7 +2747,80 @@ static u32 perf_counter_tid(struct perf_counter *counter, struct task_struct *p) | |||
2630 | return task_pid_nr_ns(p, counter->ns); | 2747 | return task_pid_nr_ns(p, counter->ns); |
2631 | } | 2748 | } |
2632 | 2749 | ||
2633 | static void perf_counter_output(struct perf_counter *counter, int nmi, | 2750 | static void perf_output_read_one(struct perf_output_handle *handle, |
2751 | struct perf_counter *counter) | ||
2752 | { | ||
2753 | u64 read_format = counter->attr.read_format; | ||
2754 | u64 values[4]; | ||
2755 | int n = 0; | ||
2756 | |||
2757 | values[n++] = atomic64_read(&counter->count); | ||
2758 | if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) { | ||
2759 | values[n++] = counter->total_time_enabled + | ||
2760 | atomic64_read(&counter->child_total_time_enabled); | ||
2761 | } | ||
2762 | if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) { | ||
2763 | values[n++] = counter->total_time_running + | ||
2764 | atomic64_read(&counter->child_total_time_running); | ||
2765 | } | ||
2766 | if (read_format & PERF_FORMAT_ID) | ||
2767 | values[n++] = primary_counter_id(counter); | ||
2768 | |||
2769 | perf_output_copy(handle, values, n * sizeof(u64)); | ||
2770 | } | ||
2771 | |||
2772 | /* | ||
2773 | * XXX PERF_FORMAT_GROUP vs inherited counters seems difficult. | ||
2774 | */ | ||
2775 | static void perf_output_read_group(struct perf_output_handle *handle, | ||
2776 | struct perf_counter *counter) | ||
2777 | { | ||
2778 | struct perf_counter *leader = counter->group_leader, *sub; | ||
2779 | u64 read_format = counter->attr.read_format; | ||
2780 | u64 values[5]; | ||
2781 | int n = 0; | ||
2782 | |||
2783 | values[n++] = 1 + leader->nr_siblings; | ||
2784 | |||
2785 | if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) | ||
2786 | values[n++] = leader->total_time_enabled; | ||
2787 | |||
2788 | if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) | ||
2789 | values[n++] = leader->total_time_running; | ||
2790 | |||
2791 | if (leader != counter) | ||
2792 | leader->pmu->read(leader); | ||
2793 | |||
2794 | values[n++] = atomic64_read(&leader->count); | ||
2795 | if (read_format & PERF_FORMAT_ID) | ||
2796 | values[n++] = primary_counter_id(leader); | ||
2797 | |||
2798 | perf_output_copy(handle, values, n * sizeof(u64)); | ||
2799 | |||
2800 | list_for_each_entry(sub, &leader->sibling_list, list_entry) { | ||
2801 | n = 0; | ||
2802 | |||
2803 | if (sub != counter) | ||
2804 | sub->pmu->read(sub); | ||
2805 | |||
2806 | values[n++] = atomic64_read(&sub->count); | ||
2807 | if (read_format & PERF_FORMAT_ID) | ||
2808 | values[n++] = primary_counter_id(sub); | ||
2809 | |||
2810 | perf_output_copy(handle, values, n * sizeof(u64)); | ||
2811 | } | ||
2812 | } | ||
2813 | |||
2814 | static void perf_output_read(struct perf_output_handle *handle, | ||
2815 | struct perf_counter *counter) | ||
2816 | { | ||
2817 | if (counter->attr.read_format & PERF_FORMAT_GROUP) | ||
2818 | perf_output_read_group(handle, counter); | ||
2819 | else | ||
2820 | perf_output_read_one(handle, counter); | ||
2821 | } | ||
2822 | |||
2823 | void perf_counter_output(struct perf_counter *counter, int nmi, | ||
2634 | struct perf_sample_data *data) | 2824 | struct perf_sample_data *data) |
2635 | { | 2825 | { |
2636 | int ret; | 2826 | int ret; |
@@ -2641,10 +2831,6 @@ static void perf_counter_output(struct perf_counter *counter, int nmi, | |||
2641 | struct { | 2831 | struct { |
2642 | u32 pid, tid; | 2832 | u32 pid, tid; |
2643 | } tid_entry; | 2833 | } tid_entry; |
2644 | struct { | ||
2645 | u64 id; | ||
2646 | u64 counter; | ||
2647 | } group_entry; | ||
2648 | struct perf_callchain_entry *callchain = NULL; | 2834 | struct perf_callchain_entry *callchain = NULL; |
2649 | int callchain_size = 0; | 2835 | int callchain_size = 0; |
2650 | u64 time; | 2836 | u64 time; |
@@ -2699,10 +2885,8 @@ static void perf_counter_output(struct perf_counter *counter, int nmi, | |||
2699 | if (sample_type & PERF_SAMPLE_PERIOD) | 2885 | if (sample_type & PERF_SAMPLE_PERIOD) |
2700 | header.size += sizeof(u64); | 2886 | header.size += sizeof(u64); |
2701 | 2887 | ||
2702 | if (sample_type & PERF_SAMPLE_GROUP) { | 2888 | if (sample_type & PERF_SAMPLE_READ) |
2703 | header.size += sizeof(u64) + | 2889 | header.size += perf_counter_read_size(counter); |
2704 | counter->nr_siblings * sizeof(group_entry); | ||
2705 | } | ||
2706 | 2890 | ||
2707 | if (sample_type & PERF_SAMPLE_CALLCHAIN) { | 2891 | if (sample_type & PERF_SAMPLE_CALLCHAIN) { |
2708 | callchain = perf_callchain(data->regs); | 2892 | callchain = perf_callchain(data->regs); |
@@ -2759,26 +2943,8 @@ static void perf_counter_output(struct perf_counter *counter, int nmi, | |||
2759 | if (sample_type & PERF_SAMPLE_PERIOD) | 2943 | if (sample_type & PERF_SAMPLE_PERIOD) |
2760 | perf_output_put(&handle, data->period); | 2944 | perf_output_put(&handle, data->period); |
2761 | 2945 | ||
2762 | /* | 2946 | if (sample_type & PERF_SAMPLE_READ) |
2763 | * XXX PERF_SAMPLE_GROUP vs inherited counters seems difficult. | 2947 | perf_output_read(&handle, counter); |
2764 | */ | ||
2765 | if (sample_type & PERF_SAMPLE_GROUP) { | ||
2766 | struct perf_counter *leader, *sub; | ||
2767 | u64 nr = counter->nr_siblings; | ||
2768 | |||
2769 | perf_output_put(&handle, nr); | ||
2770 | |||
2771 | leader = counter->group_leader; | ||
2772 | list_for_each_entry(sub, &leader->sibling_list, list_entry) { | ||
2773 | if (sub != counter) | ||
2774 | sub->pmu->read(sub); | ||
2775 | |||
2776 | group_entry.id = primary_counter_id(sub); | ||
2777 | group_entry.counter = atomic64_read(&sub->count); | ||
2778 | |||
2779 | perf_output_put(&handle, group_entry); | ||
2780 | } | ||
2781 | } | ||
2782 | 2948 | ||
2783 | if (sample_type & PERF_SAMPLE_CALLCHAIN) { | 2949 | if (sample_type & PERF_SAMPLE_CALLCHAIN) { |
2784 | if (callchain) | 2950 | if (callchain) |
@@ -2817,8 +2983,6 @@ struct perf_read_event { | |||
2817 | 2983 | ||
2818 | u32 pid; | 2984 | u32 pid; |
2819 | u32 tid; | 2985 | u32 tid; |
2820 | u64 value; | ||
2821 | u64 format[3]; | ||
2822 | }; | 2986 | }; |
2823 | 2987 | ||
2824 | static void | 2988 | static void |
@@ -2830,34 +2994,20 @@ perf_counter_read_event(struct perf_counter *counter, | |||
2830 | .header = { | 2994 | .header = { |
2831 | .type = PERF_EVENT_READ, | 2995 | .type = PERF_EVENT_READ, |
2832 | .misc = 0, | 2996 | .misc = 0, |
2833 | .size = sizeof(event) - sizeof(event.format), | 2997 | .size = sizeof(event) + perf_counter_read_size(counter), |
2834 | }, | 2998 | }, |
2835 | .pid = perf_counter_pid(counter, task), | 2999 | .pid = perf_counter_pid(counter, task), |
2836 | .tid = perf_counter_tid(counter, task), | 3000 | .tid = perf_counter_tid(counter, task), |
2837 | .value = atomic64_read(&counter->count), | ||
2838 | }; | 3001 | }; |
2839 | int ret, i = 0; | 3002 | int ret; |
2840 | |||
2841 | if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) { | ||
2842 | event.header.size += sizeof(u64); | ||
2843 | event.format[i++] = counter->total_time_enabled; | ||
2844 | } | ||
2845 | |||
2846 | if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) { | ||
2847 | event.header.size += sizeof(u64); | ||
2848 | event.format[i++] = counter->total_time_running; | ||
2849 | } | ||
2850 | |||
2851 | if (counter->attr.read_format & PERF_FORMAT_ID) { | ||
2852 | event.header.size += sizeof(u64); | ||
2853 | event.format[i++] = primary_counter_id(counter); | ||
2854 | } | ||
2855 | 3003 | ||
2856 | ret = perf_output_begin(&handle, counter, event.header.size, 0, 0); | 3004 | ret = perf_output_begin(&handle, counter, event.header.size, 0, 0); |
2857 | if (ret) | 3005 | if (ret) |
2858 | return; | 3006 | return; |
2859 | 3007 | ||
2860 | perf_output_copy(&handle, &event, event.header.size); | 3008 | perf_output_put(&handle, event); |
3009 | perf_output_read(&handle, counter); | ||
3010 | |||
2861 | perf_output_end(&handle); | 3011 | perf_output_end(&handle); |
2862 | } | 3012 | } |
2863 | 3013 | ||
@@ -2893,10 +3043,10 @@ static void perf_counter_task_output(struct perf_counter *counter, | |||
2893 | return; | 3043 | return; |
2894 | 3044 | ||
2895 | task_event->event.pid = perf_counter_pid(counter, task); | 3045 | task_event->event.pid = perf_counter_pid(counter, task); |
2896 | task_event->event.ppid = perf_counter_pid(counter, task->real_parent); | 3046 | task_event->event.ppid = perf_counter_pid(counter, current); |
2897 | 3047 | ||
2898 | task_event->event.tid = perf_counter_tid(counter, task); | 3048 | task_event->event.tid = perf_counter_tid(counter, task); |
2899 | task_event->event.ptid = perf_counter_tid(counter, task->real_parent); | 3049 | task_event->event.ptid = perf_counter_tid(counter, current); |
2900 | 3050 | ||
2901 | perf_output_put(&handle, task_event->event); | 3051 | perf_output_put(&handle, task_event->event); |
2902 | perf_output_end(&handle); | 3052 | perf_output_end(&handle); |
@@ -3443,40 +3593,32 @@ static void perf_swcounter_add(struct perf_counter *counter, u64 nr, | |||
3443 | 3593 | ||
3444 | static int perf_swcounter_is_counting(struct perf_counter *counter) | 3594 | static int perf_swcounter_is_counting(struct perf_counter *counter) |
3445 | { | 3595 | { |
3446 | struct perf_counter_context *ctx; | 3596 | /* |
3447 | unsigned long flags; | 3597 | * The counter is active, we're good! |
3448 | int count; | 3598 | */ |
3449 | |||
3450 | if (counter->state == PERF_COUNTER_STATE_ACTIVE) | 3599 | if (counter->state == PERF_COUNTER_STATE_ACTIVE) |
3451 | return 1; | 3600 | return 1; |
3452 | 3601 | ||
3602 | /* | ||
3603 | * The counter is off/error, not counting. | ||
3604 | */ | ||
3453 | if (counter->state != PERF_COUNTER_STATE_INACTIVE) | 3605 | if (counter->state != PERF_COUNTER_STATE_INACTIVE) |
3454 | return 0; | 3606 | return 0; |
3455 | 3607 | ||
3456 | /* | 3608 | /* |
3457 | * If the counter is inactive, it could be just because | 3609 | * The counter is inactive, if the context is active |
3458 | * its task is scheduled out, or because it's in a group | 3610 | * we're part of a group that didn't make it on the 'pmu', |
3459 | * which could not go on the PMU. We want to count in | 3611 | * not counting. |
3460 | * the first case but not the second. If the context is | ||
3461 | * currently active then an inactive software counter must | ||
3462 | * be the second case. If it's not currently active then | ||
3463 | * we need to know whether the counter was active when the | ||
3464 | * context was last active, which we can determine by | ||
3465 | * comparing counter->tstamp_stopped with ctx->time. | ||
3466 | * | ||
3467 | * We are within an RCU read-side critical section, | ||
3468 | * which protects the existence of *ctx. | ||
3469 | */ | 3612 | */ |
3470 | ctx = counter->ctx; | 3613 | if (counter->ctx->is_active) |
3471 | spin_lock_irqsave(&ctx->lock, flags); | 3614 | return 0; |
3472 | count = 1; | 3615 | |
3473 | /* Re-check state now we have the lock */ | 3616 | /* |
3474 | if (counter->state < PERF_COUNTER_STATE_INACTIVE || | 3617 | * We're inactive and the context is too, this means the |
3475 | counter->ctx->is_active || | 3618 | * task is scheduled out, we're counting events that happen |
3476 | counter->tstamp_stopped < ctx->time) | 3619 | * to us, like migration events. |
3477 | count = 0; | 3620 | */ |
3478 | spin_unlock_irqrestore(&ctx->lock, flags); | 3621 | return 1; |
3479 | return count; | ||
3480 | } | 3622 | } |
3481 | 3623 | ||
3482 | static int perf_swcounter_match(struct perf_counter *counter, | 3624 | static int perf_swcounter_match(struct perf_counter *counter, |
@@ -3924,13 +4066,14 @@ perf_counter_alloc(struct perf_counter_attr *attr, | |||
3924 | hwc->sample_period = attr->sample_period; | 4066 | hwc->sample_period = attr->sample_period; |
3925 | if (attr->freq && attr->sample_freq) | 4067 | if (attr->freq && attr->sample_freq) |
3926 | hwc->sample_period = 1; | 4068 | hwc->sample_period = 1; |
4069 | hwc->last_period = hwc->sample_period; | ||
3927 | 4070 | ||
3928 | atomic64_set(&hwc->period_left, hwc->sample_period); | 4071 | atomic64_set(&hwc->period_left, hwc->sample_period); |
3929 | 4072 | ||
3930 | /* | 4073 | /* |
3931 | * we currently do not support PERF_SAMPLE_GROUP on inherited counters | 4074 | * we currently do not support PERF_FORMAT_GROUP on inherited counters |
3932 | */ | 4075 | */ |
3933 | if (attr->inherit && (attr->sample_type & PERF_SAMPLE_GROUP)) | 4076 | if (attr->inherit && (attr->read_format & PERF_FORMAT_GROUP)) |
3934 | goto done; | 4077 | goto done; |
3935 | 4078 | ||
3936 | switch (attr->type) { | 4079 | switch (attr->type) { |
@@ -4592,6 +4735,11 @@ perf_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) | |||
4592 | perf_counter_init_cpu(cpu); | 4735 | perf_counter_init_cpu(cpu); |
4593 | break; | 4736 | break; |
4594 | 4737 | ||
4738 | case CPU_ONLINE: | ||
4739 | case CPU_ONLINE_FROZEN: | ||
4740 | hw_perf_counter_setup_online(cpu); | ||
4741 | break; | ||
4742 | |||
4595 | case CPU_DOWN_PREPARE: | 4743 | case CPU_DOWN_PREPARE: |
4596 | case CPU_DOWN_PREPARE_FROZEN: | 4744 | case CPU_DOWN_PREPARE_FROZEN: |
4597 | perf_counter_exit_cpu(cpu); | 4745 | perf_counter_exit_cpu(cpu); |
@@ -4616,6 +4764,8 @@ void __init perf_counter_init(void) | |||
4616 | { | 4764 | { |
4617 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE, | 4765 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE, |
4618 | (void *)(long)smp_processor_id()); | 4766 | (void *)(long)smp_processor_id()); |
4767 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_ONLINE, | ||
4768 | (void *)(long)smp_processor_id()); | ||
4619 | register_cpu_notifier(&perf_cpu_nb); | 4769 | register_cpu_notifier(&perf_cpu_nb); |
4620 | } | 4770 | } |
4621 | 4771 | ||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 98e02328c67d..58be76017fd0 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/acpi.h> | 49 | #include <linux/acpi.h> |
50 | #include <linux/reboot.h> | 50 | #include <linux/reboot.h> |
51 | #include <linux/ftrace.h> | 51 | #include <linux/ftrace.h> |
52 | #include <linux/security.h> | ||
52 | #include <linux/slow-work.h> | 53 | #include <linux/slow-work.h> |
53 | #include <linux/perf_counter.h> | 54 | #include <linux/perf_counter.h> |
54 | 55 | ||
@@ -1306,10 +1307,10 @@ static struct ctl_table vm_table[] = { | |||
1306 | { | 1307 | { |
1307 | .ctl_name = CTL_UNNUMBERED, | 1308 | .ctl_name = CTL_UNNUMBERED, |
1308 | .procname = "mmap_min_addr", | 1309 | .procname = "mmap_min_addr", |
1309 | .data = &mmap_min_addr, | 1310 | .data = &dac_mmap_min_addr, |
1310 | .maxlen = sizeof(unsigned long), | 1311 | .maxlen = sizeof(unsigned long), |
1311 | .mode = 0644, | 1312 | .mode = 0644, |
1312 | .proc_handler = &proc_doulongvec_minmax, | 1313 | .proc_handler = &mmap_min_addr_handler, |
1313 | }, | 1314 | }, |
1314 | #ifdef CONFIG_NUMA | 1315 | #ifdef CONFIG_NUMA |
1315 | { | 1316 | { |
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index a6dcd67b041d..620b58abdc32 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
@@ -137,11 +137,12 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, | |||
137 | */ | 137 | */ |
138 | int clockevents_register_notifier(struct notifier_block *nb) | 138 | int clockevents_register_notifier(struct notifier_block *nb) |
139 | { | 139 | { |
140 | unsigned long flags; | ||
140 | int ret; | 141 | int ret; |
141 | 142 | ||
142 | spin_lock(&clockevents_lock); | 143 | spin_lock_irqsave(&clockevents_lock, flags); |
143 | ret = raw_notifier_chain_register(&clockevents_chain, nb); | 144 | ret = raw_notifier_chain_register(&clockevents_chain, nb); |
144 | spin_unlock(&clockevents_lock); | 145 | spin_unlock_irqrestore(&clockevents_lock, flags); |
145 | 146 | ||
146 | return ret; | 147 | return ret; |
147 | } | 148 | } |
@@ -178,16 +179,18 @@ static void clockevents_notify_released(void) | |||
178 | */ | 179 | */ |
179 | void clockevents_register_device(struct clock_event_device *dev) | 180 | void clockevents_register_device(struct clock_event_device *dev) |
180 | { | 181 | { |
182 | unsigned long flags; | ||
183 | |||
181 | BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED); | 184 | BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED); |
182 | BUG_ON(!dev->cpumask); | 185 | BUG_ON(!dev->cpumask); |
183 | 186 | ||
184 | spin_lock(&clockevents_lock); | 187 | spin_lock_irqsave(&clockevents_lock, flags); |
185 | 188 | ||
186 | list_add(&dev->list, &clockevent_devices); | 189 | list_add(&dev->list, &clockevent_devices); |
187 | clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev); | 190 | clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev); |
188 | clockevents_notify_released(); | 191 | clockevents_notify_released(); |
189 | 192 | ||
190 | spin_unlock(&clockevents_lock); | 193 | spin_unlock_irqrestore(&clockevents_lock, flags); |
191 | } | 194 | } |
192 | EXPORT_SYMBOL_GPL(clockevents_register_device); | 195 | EXPORT_SYMBOL_GPL(clockevents_register_device); |
193 | 196 | ||
@@ -235,8 +238,9 @@ void clockevents_exchange_device(struct clock_event_device *old, | |||
235 | void clockevents_notify(unsigned long reason, void *arg) | 238 | void clockevents_notify(unsigned long reason, void *arg) |
236 | { | 239 | { |
237 | struct list_head *node, *tmp; | 240 | struct list_head *node, *tmp; |
241 | unsigned long flags; | ||
238 | 242 | ||
239 | spin_lock(&clockevents_lock); | 243 | spin_lock_irqsave(&clockevents_lock, flags); |
240 | clockevents_do_notify(reason, arg); | 244 | clockevents_do_notify(reason, arg); |
241 | 245 | ||
242 | switch (reason) { | 246 | switch (reason) { |
@@ -251,7 +255,7 @@ void clockevents_notify(unsigned long reason, void *arg) | |||
251 | default: | 255 | default: |
252 | break; | 256 | break; |
253 | } | 257 | } |
254 | spin_unlock(&clockevents_lock); | 258 | spin_unlock_irqrestore(&clockevents_lock, flags); |
255 | } | 259 | } |
256 | EXPORT_SYMBOL_GPL(clockevents_notify); | 260 | EXPORT_SYMBOL_GPL(clockevents_notify); |
257 | #endif | 261 | #endif |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 877dbedc3118..c2ec25087a35 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -205,11 +205,11 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev) | |||
205 | * Powerstate information: The system enters/leaves a state, where | 205 | * Powerstate information: The system enters/leaves a state, where |
206 | * affected devices might stop | 206 | * affected devices might stop |
207 | */ | 207 | */ |
208 | static void tick_do_broadcast_on_off(void *why) | 208 | static void tick_do_broadcast_on_off(unsigned long *reason) |
209 | { | 209 | { |
210 | struct clock_event_device *bc, *dev; | 210 | struct clock_event_device *bc, *dev; |
211 | struct tick_device *td; | 211 | struct tick_device *td; |
212 | unsigned long flags, *reason = why; | 212 | unsigned long flags; |
213 | int cpu, bc_stopped; | 213 | int cpu, bc_stopped; |
214 | 214 | ||
215 | spin_lock_irqsave(&tick_broadcast_lock, flags); | 215 | spin_lock_irqsave(&tick_broadcast_lock, flags); |
@@ -276,8 +276,7 @@ void tick_broadcast_on_off(unsigned long reason, int *oncpu) | |||
276 | printk(KERN_ERR "tick-broadcast: ignoring broadcast for " | 276 | printk(KERN_ERR "tick-broadcast: ignoring broadcast for " |
277 | "offline CPU #%d\n", *oncpu); | 277 | "offline CPU #%d\n", *oncpu); |
278 | else | 278 | else |
279 | smp_call_function_single(*oncpu, tick_do_broadcast_on_off, | 279 | tick_do_broadcast_on_off(&reason); |
280 | &reason, 1); | ||
281 | } | 280 | } |
282 | 281 | ||
283 | /* | 282 | /* |
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c index a999b92a1277..fddd69d16e03 100644 --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c | |||
@@ -286,7 +286,7 @@ static int __init init_timer_list_procfs(void) | |||
286 | { | 286 | { |
287 | struct proc_dir_entry *pe; | 287 | struct proc_dir_entry *pe; |
288 | 288 | ||
289 | pe = proc_create("timer_list", 0644, NULL, &timer_list_fops); | 289 | pe = proc_create("timer_list", 0444, NULL, &timer_list_fops); |
290 | if (!pe) | 290 | if (!pe) |
291 | return -ENOMEM; | 291 | return -ENOMEM; |
292 | return 0; | 292 | return 0; |
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index fb5fbf75f279..e78dcbde1a81 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
@@ -60,9 +60,14 @@ config EVENT_TRACING | |||
60 | bool | 60 | bool |
61 | 61 | ||
62 | config CONTEXT_SWITCH_TRACER | 62 | config CONTEXT_SWITCH_TRACER |
63 | select MARKERS | ||
64 | bool | 63 | bool |
65 | 64 | ||
65 | config RING_BUFFER_ALLOW_SWAP | ||
66 | bool | ||
67 | help | ||
68 | Allow the use of ring_buffer_swap_cpu. | ||
69 | Adds a very slight overhead to tracing when enabled. | ||
70 | |||
66 | # All tracer options should select GENERIC_TRACER. For those options that are | 71 | # All tracer options should select GENERIC_TRACER. For those options that are |
67 | # enabled by all tracers (context switch and event tracer) they select TRACING. | 72 | # enabled by all tracers (context switch and event tracer) they select TRACING. |
68 | # This allows those options to appear when no other tracer is selected. But the | 73 | # This allows those options to appear when no other tracer is selected. But the |
@@ -147,6 +152,7 @@ config IRQSOFF_TRACER | |||
147 | select TRACE_IRQFLAGS | 152 | select TRACE_IRQFLAGS |
148 | select GENERIC_TRACER | 153 | select GENERIC_TRACER |
149 | select TRACER_MAX_TRACE | 154 | select TRACER_MAX_TRACE |
155 | select RING_BUFFER_ALLOW_SWAP | ||
150 | help | 156 | help |
151 | This option measures the time spent in irqs-off critical | 157 | This option measures the time spent in irqs-off critical |
152 | sections, with microsecond accuracy. | 158 | sections, with microsecond accuracy. |
@@ -168,6 +174,7 @@ config PREEMPT_TRACER | |||
168 | depends on PREEMPT | 174 | depends on PREEMPT |
169 | select GENERIC_TRACER | 175 | select GENERIC_TRACER |
170 | select TRACER_MAX_TRACE | 176 | select TRACER_MAX_TRACE |
177 | select RING_BUFFER_ALLOW_SWAP | ||
171 | help | 178 | help |
172 | This option measures the time spent in preemption off critical | 179 | This option measures the time spent in preemption off critical |
173 | sections, with microsecond accuracy. | 180 | sections, with microsecond accuracy. |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 1090b0aed9ba..3eb159c277c8 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -65,13 +65,15 @@ static void trace_note(struct blk_trace *bt, pid_t pid, int action, | |||
65 | { | 65 | { |
66 | struct blk_io_trace *t; | 66 | struct blk_io_trace *t; |
67 | struct ring_buffer_event *event = NULL; | 67 | struct ring_buffer_event *event = NULL; |
68 | struct ring_buffer *buffer = NULL; | ||
68 | int pc = 0; | 69 | int pc = 0; |
69 | int cpu = smp_processor_id(); | 70 | int cpu = smp_processor_id(); |
70 | bool blk_tracer = blk_tracer_enabled; | 71 | bool blk_tracer = blk_tracer_enabled; |
71 | 72 | ||
72 | if (blk_tracer) { | 73 | if (blk_tracer) { |
74 | buffer = blk_tr->buffer; | ||
73 | pc = preempt_count(); | 75 | pc = preempt_count(); |
74 | event = trace_buffer_lock_reserve(blk_tr, TRACE_BLK, | 76 | event = trace_buffer_lock_reserve(buffer, TRACE_BLK, |
75 | sizeof(*t) + len, | 77 | sizeof(*t) + len, |
76 | 0, pc); | 78 | 0, pc); |
77 | if (!event) | 79 | if (!event) |
@@ -96,7 +98,7 @@ record_it: | |||
96 | memcpy((void *) t + sizeof(*t), data, len); | 98 | memcpy((void *) t + sizeof(*t), data, len); |
97 | 99 | ||
98 | if (blk_tracer) | 100 | if (blk_tracer) |
99 | trace_buffer_unlock_commit(blk_tr, event, 0, pc); | 101 | trace_buffer_unlock_commit(buffer, event, 0, pc); |
100 | } | 102 | } |
101 | } | 103 | } |
102 | 104 | ||
@@ -179,6 +181,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, | |||
179 | { | 181 | { |
180 | struct task_struct *tsk = current; | 182 | struct task_struct *tsk = current; |
181 | struct ring_buffer_event *event = NULL; | 183 | struct ring_buffer_event *event = NULL; |
184 | struct ring_buffer *buffer = NULL; | ||
182 | struct blk_io_trace *t; | 185 | struct blk_io_trace *t; |
183 | unsigned long flags = 0; | 186 | unsigned long flags = 0; |
184 | unsigned long *sequence; | 187 | unsigned long *sequence; |
@@ -204,8 +207,9 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes, | |||
204 | if (blk_tracer) { | 207 | if (blk_tracer) { |
205 | tracing_record_cmdline(current); | 208 | tracing_record_cmdline(current); |
206 | 209 | ||
210 | buffer = blk_tr->buffer; | ||
207 | pc = preempt_count(); | 211 | pc = preempt_count(); |
208 | event = trace_buffer_lock_reserve(blk_tr, TRACE_BLK, | 212 | event = trace_buffer_lock_reserve(buffer, TRACE_BLK, |
209 | sizeof(*t) + pdu_len, | 213 | sizeof(*t) + pdu_len, |
210 | 0, pc); | 214 | 0, pc); |
211 | if (!event) | 215 | if (!event) |
@@ -252,7 +256,7 @@ record_it: | |||
252 | memcpy((void *) t + sizeof(*t), pdu_data, pdu_len); | 256 | memcpy((void *) t + sizeof(*t), pdu_data, pdu_len); |
253 | 257 | ||
254 | if (blk_tracer) { | 258 | if (blk_tracer) { |
255 | trace_buffer_unlock_commit(blk_tr, event, 0, pc); | 259 | trace_buffer_unlock_commit(buffer, event, 0, pc); |
256 | return; | 260 | return; |
257 | } | 261 | } |
258 | } | 262 | } |
@@ -267,8 +271,8 @@ static void blk_trace_free(struct blk_trace *bt) | |||
267 | { | 271 | { |
268 | debugfs_remove(bt->msg_file); | 272 | debugfs_remove(bt->msg_file); |
269 | debugfs_remove(bt->dropped_file); | 273 | debugfs_remove(bt->dropped_file); |
270 | debugfs_remove(bt->dir); | ||
271 | relay_close(bt->rchan); | 274 | relay_close(bt->rchan); |
275 | debugfs_remove(bt->dir); | ||
272 | free_percpu(bt->sequence); | 276 | free_percpu(bt->sequence); |
273 | free_percpu(bt->msg_data); | 277 | free_percpu(bt->msg_data); |
274 | kfree(bt); | 278 | kfree(bt); |
@@ -378,18 +382,8 @@ static int blk_subbuf_start_callback(struct rchan_buf *buf, void *subbuf, | |||
378 | 382 | ||
379 | static int blk_remove_buf_file_callback(struct dentry *dentry) | 383 | static int blk_remove_buf_file_callback(struct dentry *dentry) |
380 | { | 384 | { |
381 | struct dentry *parent = dentry->d_parent; | ||
382 | debugfs_remove(dentry); | 385 | debugfs_remove(dentry); |
383 | 386 | ||
384 | /* | ||
385 | * this will fail for all but the last file, but that is ok. what we | ||
386 | * care about is the top level buts->name directory going away, when | ||
387 | * the last trace file is gone. Then we don't have to rmdir() that | ||
388 | * manually on trace stop, so it nicely solves the issue with | ||
389 | * force killing of running traces. | ||
390 | */ | ||
391 | |||
392 | debugfs_remove(parent); | ||
393 | return 0; | 387 | return 0; |
394 | } | 388 | } |
395 | 389 | ||
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 1993b7186cdb..8c804e24f96f 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -2222,7 +2222,11 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, | |||
2222 | read++; | 2222 | read++; |
2223 | cnt--; | 2223 | cnt--; |
2224 | 2224 | ||
2225 | if (!(iter->flags & ~FTRACE_ITER_CONT)) { | 2225 | /* |
2226 | * If the parser haven't finished with the last write, | ||
2227 | * continue reading the user input without skipping spaces. | ||
2228 | */ | ||
2229 | if (!(iter->flags & FTRACE_ITER_CONT)) { | ||
2226 | /* skip white space */ | 2230 | /* skip white space */ |
2227 | while (cnt && isspace(ch)) { | 2231 | while (cnt && isspace(ch)) { |
2228 | ret = get_user(ch, ubuf++); | 2232 | ret = get_user(ch, ubuf++); |
@@ -2232,8 +2236,9 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, | |||
2232 | cnt--; | 2236 | cnt--; |
2233 | } | 2237 | } |
2234 | 2238 | ||
2239 | /* only spaces were written */ | ||
2235 | if (isspace(ch)) { | 2240 | if (isspace(ch)) { |
2236 | file->f_pos += read; | 2241 | *ppos += read; |
2237 | ret = read; | 2242 | ret = read; |
2238 | goto out; | 2243 | goto out; |
2239 | } | 2244 | } |
@@ -2262,12 +2267,12 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, | |||
2262 | if (ret) | 2267 | if (ret) |
2263 | goto out; | 2268 | goto out; |
2264 | iter->buffer_idx = 0; | 2269 | iter->buffer_idx = 0; |
2265 | } else | 2270 | } else { |
2266 | iter->flags |= FTRACE_ITER_CONT; | 2271 | iter->flags |= FTRACE_ITER_CONT; |
2272 | iter->buffer[iter->buffer_idx++] = ch; | ||
2273 | } | ||
2267 | 2274 | ||
2268 | 2275 | *ppos += read; | |
2269 | file->f_pos += read; | ||
2270 | |||
2271 | ret = read; | 2276 | ret = read; |
2272 | out: | 2277 | out: |
2273 | mutex_unlock(&ftrace_regex_lock); | 2278 | mutex_unlock(&ftrace_regex_lock); |
diff --git a/kernel/trace/kmemtrace.c b/kernel/trace/kmemtrace.c index dda53ccf749b..81b1645c8549 100644 --- a/kernel/trace/kmemtrace.c +++ b/kernel/trace/kmemtrace.c | |||
@@ -183,11 +183,9 @@ static void kmemtrace_stop_probes(void) | |||
183 | 183 | ||
184 | static int kmem_trace_init(struct trace_array *tr) | 184 | static int kmem_trace_init(struct trace_array *tr) |
185 | { | 185 | { |
186 | int cpu; | ||
187 | kmemtrace_array = tr; | 186 | kmemtrace_array = tr; |
188 | 187 | ||
189 | for_each_cpu(cpu, cpu_possible_mask) | 188 | tracing_reset_online_cpus(tr); |
190 | tracing_reset(tr, cpu); | ||
191 | 189 | ||
192 | kmemtrace_start_probes(); | 190 | kmemtrace_start_probes(); |
193 | 191 | ||
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index da2c59d8f486..454e74e718cf 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -218,17 +218,12 @@ enum { | |||
218 | 218 | ||
219 | static inline int rb_null_event(struct ring_buffer_event *event) | 219 | static inline int rb_null_event(struct ring_buffer_event *event) |
220 | { | 220 | { |
221 | return event->type_len == RINGBUF_TYPE_PADDING | 221 | return event->type_len == RINGBUF_TYPE_PADDING && !event->time_delta; |
222 | && event->time_delta == 0; | ||
223 | } | ||
224 | |||
225 | static inline int rb_discarded_event(struct ring_buffer_event *event) | ||
226 | { | ||
227 | return event->type_len == RINGBUF_TYPE_PADDING && event->time_delta; | ||
228 | } | 222 | } |
229 | 223 | ||
230 | static void rb_event_set_padding(struct ring_buffer_event *event) | 224 | static void rb_event_set_padding(struct ring_buffer_event *event) |
231 | { | 225 | { |
226 | /* padding has a NULL time_delta */ | ||
232 | event->type_len = RINGBUF_TYPE_PADDING; | 227 | event->type_len = RINGBUF_TYPE_PADDING; |
233 | event->time_delta = 0; | 228 | event->time_delta = 0; |
234 | } | 229 | } |
@@ -472,14 +467,19 @@ struct ring_buffer_iter { | |||
472 | }; | 467 | }; |
473 | 468 | ||
474 | /* buffer may be either ring_buffer or ring_buffer_per_cpu */ | 469 | /* buffer may be either ring_buffer or ring_buffer_per_cpu */ |
475 | #define RB_WARN_ON(buffer, cond) \ | 470 | #define RB_WARN_ON(b, cond) \ |
476 | ({ \ | 471 | ({ \ |
477 | int _____ret = unlikely(cond); \ | 472 | int _____ret = unlikely(cond); \ |
478 | if (_____ret) { \ | 473 | if (_____ret) { \ |
479 | atomic_inc(&buffer->record_disabled); \ | 474 | if (__same_type(*(b), struct ring_buffer_per_cpu)) { \ |
480 | WARN_ON(1); \ | 475 | struct ring_buffer_per_cpu *__b = \ |
481 | } \ | 476 | (void *)b; \ |
482 | _____ret; \ | 477 | atomic_inc(&__b->buffer->record_disabled); \ |
478 | } else \ | ||
479 | atomic_inc(&b->record_disabled); \ | ||
480 | WARN_ON(1); \ | ||
481 | } \ | ||
482 | _____ret; \ | ||
483 | }) | 483 | }) |
484 | 484 | ||
485 | /* Up this if you want to test the TIME_EXTENTS and normalization */ | 485 | /* Up this if you want to test the TIME_EXTENTS and normalization */ |
@@ -1778,9 +1778,6 @@ rb_reset_tail(struct ring_buffer_per_cpu *cpu_buffer, | |||
1778 | event->type_len = RINGBUF_TYPE_PADDING; | 1778 | event->type_len = RINGBUF_TYPE_PADDING; |
1779 | /* time delta must be non zero */ | 1779 | /* time delta must be non zero */ |
1780 | event->time_delta = 1; | 1780 | event->time_delta = 1; |
1781 | /* Account for this as an entry */ | ||
1782 | local_inc(&tail_page->entries); | ||
1783 | local_inc(&cpu_buffer->entries); | ||
1784 | 1781 | ||
1785 | /* Set write to end of buffer */ | 1782 | /* Set write to end of buffer */ |
1786 | length = (tail + length) - BUF_PAGE_SIZE; | 1783 | length = (tail + length) - BUF_PAGE_SIZE; |
@@ -2076,7 +2073,8 @@ static void rb_end_commit(struct ring_buffer_per_cpu *cpu_buffer) | |||
2076 | } | 2073 | } |
2077 | 2074 | ||
2078 | static struct ring_buffer_event * | 2075 | static struct ring_buffer_event * |
2079 | rb_reserve_next_event(struct ring_buffer_per_cpu *cpu_buffer, | 2076 | rb_reserve_next_event(struct ring_buffer *buffer, |
2077 | struct ring_buffer_per_cpu *cpu_buffer, | ||
2080 | unsigned long length) | 2078 | unsigned long length) |
2081 | { | 2079 | { |
2082 | struct ring_buffer_event *event; | 2080 | struct ring_buffer_event *event; |
@@ -2086,6 +2084,21 @@ rb_reserve_next_event(struct ring_buffer_per_cpu *cpu_buffer, | |||
2086 | 2084 | ||
2087 | rb_start_commit(cpu_buffer); | 2085 | rb_start_commit(cpu_buffer); |
2088 | 2086 | ||
2087 | #ifdef CONFIG_RING_BUFFER_ALLOW_SWAP | ||
2088 | /* | ||
2089 | * Due to the ability to swap a cpu buffer from a buffer | ||
2090 | * it is possible it was swapped before we committed. | ||
2091 | * (committing stops a swap). We check for it here and | ||
2092 | * if it happened, we have to fail the write. | ||
2093 | */ | ||
2094 | barrier(); | ||
2095 | if (unlikely(ACCESS_ONCE(cpu_buffer->buffer) != buffer)) { | ||
2096 | local_dec(&cpu_buffer->committing); | ||
2097 | local_dec(&cpu_buffer->commits); | ||
2098 | return NULL; | ||
2099 | } | ||
2100 | #endif | ||
2101 | |||
2089 | length = rb_calculate_event_length(length); | 2102 | length = rb_calculate_event_length(length); |
2090 | again: | 2103 | again: |
2091 | /* | 2104 | /* |
@@ -2246,7 +2259,7 @@ ring_buffer_lock_reserve(struct ring_buffer *buffer, unsigned long length) | |||
2246 | if (length > BUF_MAX_DATA_SIZE) | 2259 | if (length > BUF_MAX_DATA_SIZE) |
2247 | goto out; | 2260 | goto out; |
2248 | 2261 | ||
2249 | event = rb_reserve_next_event(cpu_buffer, length); | 2262 | event = rb_reserve_next_event(buffer, cpu_buffer, length); |
2250 | if (!event) | 2263 | if (!event) |
2251 | goto out; | 2264 | goto out; |
2252 | 2265 | ||
@@ -2269,18 +2282,23 @@ ring_buffer_lock_reserve(struct ring_buffer *buffer, unsigned long length) | |||
2269 | } | 2282 | } |
2270 | EXPORT_SYMBOL_GPL(ring_buffer_lock_reserve); | 2283 | EXPORT_SYMBOL_GPL(ring_buffer_lock_reserve); |
2271 | 2284 | ||
2272 | static void rb_commit(struct ring_buffer_per_cpu *cpu_buffer, | 2285 | static void |
2286 | rb_update_write_stamp(struct ring_buffer_per_cpu *cpu_buffer, | ||
2273 | struct ring_buffer_event *event) | 2287 | struct ring_buffer_event *event) |
2274 | { | 2288 | { |
2275 | local_inc(&cpu_buffer->entries); | ||
2276 | |||
2277 | /* | 2289 | /* |
2278 | * The event first in the commit queue updates the | 2290 | * The event first in the commit queue updates the |
2279 | * time stamp. | 2291 | * time stamp. |
2280 | */ | 2292 | */ |
2281 | if (rb_event_is_commit(cpu_buffer, event)) | 2293 | if (rb_event_is_commit(cpu_buffer, event)) |
2282 | cpu_buffer->write_stamp += event->time_delta; | 2294 | cpu_buffer->write_stamp += event->time_delta; |
2295 | } | ||
2283 | 2296 | ||
2297 | static void rb_commit(struct ring_buffer_per_cpu *cpu_buffer, | ||
2298 | struct ring_buffer_event *event) | ||
2299 | { | ||
2300 | local_inc(&cpu_buffer->entries); | ||
2301 | rb_update_write_stamp(cpu_buffer, event); | ||
2284 | rb_end_commit(cpu_buffer); | 2302 | rb_end_commit(cpu_buffer); |
2285 | } | 2303 | } |
2286 | 2304 | ||
@@ -2327,32 +2345,57 @@ static inline void rb_event_discard(struct ring_buffer_event *event) | |||
2327 | event->time_delta = 1; | 2345 | event->time_delta = 1; |
2328 | } | 2346 | } |
2329 | 2347 | ||
2330 | /** | 2348 | /* |
2331 | * ring_buffer_event_discard - discard any event in the ring buffer | 2349 | * Decrement the entries to the page that an event is on. |
2332 | * @event: the event to discard | 2350 | * The event does not even need to exist, only the pointer |
2333 | * | 2351 | * to the page it is on. This may only be called before the commit |
2334 | * Sometimes a event that is in the ring buffer needs to be ignored. | 2352 | * takes place. |
2335 | * This function lets the user discard an event in the ring buffer | ||
2336 | * and then that event will not be read later. | ||
2337 | * | ||
2338 | * Note, it is up to the user to be careful with this, and protect | ||
2339 | * against races. If the user discards an event that has been consumed | ||
2340 | * it is possible that it could corrupt the ring buffer. | ||
2341 | */ | 2353 | */ |
2342 | void ring_buffer_event_discard(struct ring_buffer_event *event) | 2354 | static inline void |
2355 | rb_decrement_entry(struct ring_buffer_per_cpu *cpu_buffer, | ||
2356 | struct ring_buffer_event *event) | ||
2343 | { | 2357 | { |
2344 | rb_event_discard(event); | 2358 | unsigned long addr = (unsigned long)event; |
2359 | struct buffer_page *bpage = cpu_buffer->commit_page; | ||
2360 | struct buffer_page *start; | ||
2361 | |||
2362 | addr &= PAGE_MASK; | ||
2363 | |||
2364 | /* Do the likely case first */ | ||
2365 | if (likely(bpage->page == (void *)addr)) { | ||
2366 | local_dec(&bpage->entries); | ||
2367 | return; | ||
2368 | } | ||
2369 | |||
2370 | /* | ||
2371 | * Because the commit page may be on the reader page we | ||
2372 | * start with the next page and check the end loop there. | ||
2373 | */ | ||
2374 | rb_inc_page(cpu_buffer, &bpage); | ||
2375 | start = bpage; | ||
2376 | do { | ||
2377 | if (bpage->page == (void *)addr) { | ||
2378 | local_dec(&bpage->entries); | ||
2379 | return; | ||
2380 | } | ||
2381 | rb_inc_page(cpu_buffer, &bpage); | ||
2382 | } while (bpage != start); | ||
2383 | |||
2384 | /* commit not part of this buffer?? */ | ||
2385 | RB_WARN_ON(cpu_buffer, 1); | ||
2345 | } | 2386 | } |
2346 | EXPORT_SYMBOL_GPL(ring_buffer_event_discard); | ||
2347 | 2387 | ||
2348 | /** | 2388 | /** |
2349 | * ring_buffer_commit_discard - discard an event that has not been committed | 2389 | * ring_buffer_commit_discard - discard an event that has not been committed |
2350 | * @buffer: the ring buffer | 2390 | * @buffer: the ring buffer |
2351 | * @event: non committed event to discard | 2391 | * @event: non committed event to discard |
2352 | * | 2392 | * |
2353 | * This is similar to ring_buffer_event_discard but must only be | 2393 | * Sometimes an event that is in the ring buffer needs to be ignored. |
2354 | * performed on an event that has not been committed yet. The difference | 2394 | * This function lets the user discard an event in the ring buffer |
2355 | * is that this will also try to free the event from the ring buffer | 2395 | * and then that event will not be read later. |
2396 | * | ||
2397 | * This function only works if it is called before the the item has been | ||
2398 | * committed. It will try to free the event from the ring buffer | ||
2356 | * if another event has not been added behind it. | 2399 | * if another event has not been added behind it. |
2357 | * | 2400 | * |
2358 | * If another event has been added behind it, it will set the event | 2401 | * If another event has been added behind it, it will set the event |
@@ -2380,14 +2423,15 @@ void ring_buffer_discard_commit(struct ring_buffer *buffer, | |||
2380 | */ | 2423 | */ |
2381 | RB_WARN_ON(buffer, !local_read(&cpu_buffer->committing)); | 2424 | RB_WARN_ON(buffer, !local_read(&cpu_buffer->committing)); |
2382 | 2425 | ||
2426 | rb_decrement_entry(cpu_buffer, event); | ||
2383 | if (rb_try_to_discard(cpu_buffer, event)) | 2427 | if (rb_try_to_discard(cpu_buffer, event)) |
2384 | goto out; | 2428 | goto out; |
2385 | 2429 | ||
2386 | /* | 2430 | /* |
2387 | * The commit is still visible by the reader, so we | 2431 | * The commit is still visible by the reader, so we |
2388 | * must increment entries. | 2432 | * must still update the timestamp. |
2389 | */ | 2433 | */ |
2390 | local_inc(&cpu_buffer->entries); | 2434 | rb_update_write_stamp(cpu_buffer, event); |
2391 | out: | 2435 | out: |
2392 | rb_end_commit(cpu_buffer); | 2436 | rb_end_commit(cpu_buffer); |
2393 | 2437 | ||
@@ -2448,7 +2492,7 @@ int ring_buffer_write(struct ring_buffer *buffer, | |||
2448 | if (length > BUF_MAX_DATA_SIZE) | 2492 | if (length > BUF_MAX_DATA_SIZE) |
2449 | goto out; | 2493 | goto out; |
2450 | 2494 | ||
2451 | event = rb_reserve_next_event(cpu_buffer, length); | 2495 | event = rb_reserve_next_event(buffer, cpu_buffer, length); |
2452 | if (!event) | 2496 | if (!event) |
2453 | goto out; | 2497 | goto out; |
2454 | 2498 | ||
@@ -2899,8 +2943,7 @@ static void rb_advance_reader(struct ring_buffer_per_cpu *cpu_buffer) | |||
2899 | 2943 | ||
2900 | event = rb_reader_event(cpu_buffer); | 2944 | event = rb_reader_event(cpu_buffer); |
2901 | 2945 | ||
2902 | if (event->type_len <= RINGBUF_TYPE_DATA_TYPE_LEN_MAX | 2946 | if (event->type_len <= RINGBUF_TYPE_DATA_TYPE_LEN_MAX) |
2903 | || rb_discarded_event(event)) | ||
2904 | cpu_buffer->read++; | 2947 | cpu_buffer->read++; |
2905 | 2948 | ||
2906 | rb_update_read_stamp(cpu_buffer, event); | 2949 | rb_update_read_stamp(cpu_buffer, event); |
@@ -3132,10 +3175,8 @@ ring_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts) | |||
3132 | spin_unlock(&cpu_buffer->reader_lock); | 3175 | spin_unlock(&cpu_buffer->reader_lock); |
3133 | local_irq_restore(flags); | 3176 | local_irq_restore(flags); |
3134 | 3177 | ||
3135 | if (event && event->type_len == RINGBUF_TYPE_PADDING) { | 3178 | if (event && event->type_len == RINGBUF_TYPE_PADDING) |
3136 | cpu_relax(); | ||
3137 | goto again; | 3179 | goto again; |
3138 | } | ||
3139 | 3180 | ||
3140 | return event; | 3181 | return event; |
3141 | } | 3182 | } |
@@ -3160,10 +3201,8 @@ ring_buffer_iter_peek(struct ring_buffer_iter *iter, u64 *ts) | |||
3160 | event = rb_iter_peek(iter, ts); | 3201 | event = rb_iter_peek(iter, ts); |
3161 | spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); | 3202 | spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); |
3162 | 3203 | ||
3163 | if (event && event->type_len == RINGBUF_TYPE_PADDING) { | 3204 | if (event && event->type_len == RINGBUF_TYPE_PADDING) |
3164 | cpu_relax(); | ||
3165 | goto again; | 3205 | goto again; |
3166 | } | ||
3167 | 3206 | ||
3168 | return event; | 3207 | return event; |
3169 | } | 3208 | } |
@@ -3209,10 +3248,8 @@ ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts) | |||
3209 | out: | 3248 | out: |
3210 | preempt_enable(); | 3249 | preempt_enable(); |
3211 | 3250 | ||
3212 | if (event && event->type_len == RINGBUF_TYPE_PADDING) { | 3251 | if (event && event->type_len == RINGBUF_TYPE_PADDING) |
3213 | cpu_relax(); | ||
3214 | goto again; | 3252 | goto again; |
3215 | } | ||
3216 | 3253 | ||
3217 | return event; | 3254 | return event; |
3218 | } | 3255 | } |
@@ -3292,21 +3329,19 @@ ring_buffer_read(struct ring_buffer_iter *iter, u64 *ts) | |||
3292 | struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; | 3329 | struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; |
3293 | unsigned long flags; | 3330 | unsigned long flags; |
3294 | 3331 | ||
3295 | again: | ||
3296 | spin_lock_irqsave(&cpu_buffer->reader_lock, flags); | 3332 | spin_lock_irqsave(&cpu_buffer->reader_lock, flags); |
3333 | again: | ||
3297 | event = rb_iter_peek(iter, ts); | 3334 | event = rb_iter_peek(iter, ts); |
3298 | if (!event) | 3335 | if (!event) |
3299 | goto out; | 3336 | goto out; |
3300 | 3337 | ||
3338 | if (event->type_len == RINGBUF_TYPE_PADDING) | ||
3339 | goto again; | ||
3340 | |||
3301 | rb_advance_iter(iter); | 3341 | rb_advance_iter(iter); |
3302 | out: | 3342 | out: |
3303 | spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); | 3343 | spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); |
3304 | 3344 | ||
3305 | if (event && event->type_len == RINGBUF_TYPE_PADDING) { | ||
3306 | cpu_relax(); | ||
3307 | goto again; | ||
3308 | } | ||
3309 | |||
3310 | return event; | 3345 | return event; |
3311 | } | 3346 | } |
3312 | EXPORT_SYMBOL_GPL(ring_buffer_read); | 3347 | EXPORT_SYMBOL_GPL(ring_buffer_read); |
@@ -3373,12 +3408,16 @@ void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu) | |||
3373 | 3408 | ||
3374 | spin_lock_irqsave(&cpu_buffer->reader_lock, flags); | 3409 | spin_lock_irqsave(&cpu_buffer->reader_lock, flags); |
3375 | 3410 | ||
3411 | if (RB_WARN_ON(cpu_buffer, local_read(&cpu_buffer->committing))) | ||
3412 | goto out; | ||
3413 | |||
3376 | __raw_spin_lock(&cpu_buffer->lock); | 3414 | __raw_spin_lock(&cpu_buffer->lock); |
3377 | 3415 | ||
3378 | rb_reset_cpu(cpu_buffer); | 3416 | rb_reset_cpu(cpu_buffer); |
3379 | 3417 | ||
3380 | __raw_spin_unlock(&cpu_buffer->lock); | 3418 | __raw_spin_unlock(&cpu_buffer->lock); |
3381 | 3419 | ||
3420 | out: | ||
3382 | spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); | 3421 | spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); |
3383 | 3422 | ||
3384 | atomic_dec(&cpu_buffer->record_disabled); | 3423 | atomic_dec(&cpu_buffer->record_disabled); |
@@ -3461,6 +3500,7 @@ int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu) | |||
3461 | } | 3500 | } |
3462 | EXPORT_SYMBOL_GPL(ring_buffer_empty_cpu); | 3501 | EXPORT_SYMBOL_GPL(ring_buffer_empty_cpu); |
3463 | 3502 | ||
3503 | #ifdef CONFIG_RING_BUFFER_ALLOW_SWAP | ||
3464 | /** | 3504 | /** |
3465 | * ring_buffer_swap_cpu - swap a CPU buffer between two ring buffers | 3505 | * ring_buffer_swap_cpu - swap a CPU buffer between two ring buffers |
3466 | * @buffer_a: One buffer to swap with | 3506 | * @buffer_a: One buffer to swap with |
@@ -3515,20 +3555,28 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a, | |||
3515 | atomic_inc(&cpu_buffer_a->record_disabled); | 3555 | atomic_inc(&cpu_buffer_a->record_disabled); |
3516 | atomic_inc(&cpu_buffer_b->record_disabled); | 3556 | atomic_inc(&cpu_buffer_b->record_disabled); |
3517 | 3557 | ||
3558 | ret = -EBUSY; | ||
3559 | if (local_read(&cpu_buffer_a->committing)) | ||
3560 | goto out_dec; | ||
3561 | if (local_read(&cpu_buffer_b->committing)) | ||
3562 | goto out_dec; | ||
3563 | |||
3518 | buffer_a->buffers[cpu] = cpu_buffer_b; | 3564 | buffer_a->buffers[cpu] = cpu_buffer_b; |
3519 | buffer_b->buffers[cpu] = cpu_buffer_a; | 3565 | buffer_b->buffers[cpu] = cpu_buffer_a; |
3520 | 3566 | ||
3521 | cpu_buffer_b->buffer = buffer_a; | 3567 | cpu_buffer_b->buffer = buffer_a; |
3522 | cpu_buffer_a->buffer = buffer_b; | 3568 | cpu_buffer_a->buffer = buffer_b; |
3523 | 3569 | ||
3570 | ret = 0; | ||
3571 | |||
3572 | out_dec: | ||
3524 | atomic_dec(&cpu_buffer_a->record_disabled); | 3573 | atomic_dec(&cpu_buffer_a->record_disabled); |
3525 | atomic_dec(&cpu_buffer_b->record_disabled); | 3574 | atomic_dec(&cpu_buffer_b->record_disabled); |
3526 | |||
3527 | ret = 0; | ||
3528 | out: | 3575 | out: |
3529 | return ret; | 3576 | return ret; |
3530 | } | 3577 | } |
3531 | EXPORT_SYMBOL_GPL(ring_buffer_swap_cpu); | 3578 | EXPORT_SYMBOL_GPL(ring_buffer_swap_cpu); |
3579 | #endif /* CONFIG_RING_BUFFER_ALLOW_SWAP */ | ||
3532 | 3580 | ||
3533 | /** | 3581 | /** |
3534 | * ring_buffer_alloc_read_page - allocate a page to read from buffer | 3582 | * ring_buffer_alloc_read_page - allocate a page to read from buffer |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 63dbc7ff213f..5c75deeefe30 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -43,9 +43,6 @@ | |||
43 | 43 | ||
44 | #define TRACE_BUFFER_FLAGS (RB_FL_OVERWRITE) | 44 | #define TRACE_BUFFER_FLAGS (RB_FL_OVERWRITE) |
45 | 45 | ||
46 | unsigned long __read_mostly tracing_max_latency; | ||
47 | unsigned long __read_mostly tracing_thresh; | ||
48 | |||
49 | /* | 46 | /* |
50 | * On boot up, the ring buffer is set to the minimum size, so that | 47 | * On boot up, the ring buffer is set to the minimum size, so that |
51 | * we do not waste memory on systems that are not using tracing. | 48 | * we do not waste memory on systems that are not using tracing. |
@@ -172,10 +169,11 @@ static struct trace_array global_trace; | |||
172 | 169 | ||
173 | static DEFINE_PER_CPU(struct trace_array_cpu, global_trace_cpu); | 170 | static DEFINE_PER_CPU(struct trace_array_cpu, global_trace_cpu); |
174 | 171 | ||
175 | int filter_current_check_discard(struct ftrace_event_call *call, void *rec, | 172 | int filter_current_check_discard(struct ring_buffer *buffer, |
173 | struct ftrace_event_call *call, void *rec, | ||
176 | struct ring_buffer_event *event) | 174 | struct ring_buffer_event *event) |
177 | { | 175 | { |
178 | return filter_check_discard(call, rec, global_trace.buffer, event); | 176 | return filter_check_discard(call, rec, buffer, event); |
179 | } | 177 | } |
180 | EXPORT_SYMBOL_GPL(filter_current_check_discard); | 178 | EXPORT_SYMBOL_GPL(filter_current_check_discard); |
181 | 179 | ||
@@ -266,6 +264,9 @@ unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK | | |||
266 | TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO | TRACE_ITER_SLEEP_TIME | | 264 | TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO | TRACE_ITER_SLEEP_TIME | |
267 | TRACE_ITER_GRAPH_TIME; | 265 | TRACE_ITER_GRAPH_TIME; |
268 | 266 | ||
267 | static int trace_stop_count; | ||
268 | static DEFINE_SPINLOCK(tracing_start_lock); | ||
269 | |||
269 | /** | 270 | /** |
270 | * trace_wake_up - wake up tasks waiting for trace input | 271 | * trace_wake_up - wake up tasks waiting for trace input |
271 | * | 272 | * |
@@ -338,45 +339,6 @@ static struct { | |||
338 | 339 | ||
339 | int trace_clock_id; | 340 | int trace_clock_id; |
340 | 341 | ||
341 | /* | ||
342 | * ftrace_max_lock is used to protect the swapping of buffers | ||
343 | * when taking a max snapshot. The buffers themselves are | ||
344 | * protected by per_cpu spinlocks. But the action of the swap | ||
345 | * needs its own lock. | ||
346 | * | ||
347 | * This is defined as a raw_spinlock_t in order to help | ||
348 | * with performance when lockdep debugging is enabled. | ||
349 | */ | ||
350 | static raw_spinlock_t ftrace_max_lock = | ||
351 | (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED; | ||
352 | |||
353 | /* | ||
354 | * Copy the new maximum trace into the separate maximum-trace | ||
355 | * structure. (this way the maximum trace is permanently saved, | ||
356 | * for later retrieval via /sys/kernel/debug/tracing/latency_trace) | ||
357 | */ | ||
358 | static void | ||
359 | __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) | ||
360 | { | ||
361 | struct trace_array_cpu *data = tr->data[cpu]; | ||
362 | |||
363 | max_tr.cpu = cpu; | ||
364 | max_tr.time_start = data->preempt_timestamp; | ||
365 | |||
366 | data = max_tr.data[cpu]; | ||
367 | data->saved_latency = tracing_max_latency; | ||
368 | |||
369 | memcpy(data->comm, tsk->comm, TASK_COMM_LEN); | ||
370 | data->pid = tsk->pid; | ||
371 | data->uid = task_uid(tsk); | ||
372 | data->nice = tsk->static_prio - 20 - MAX_RT_PRIO; | ||
373 | data->policy = tsk->policy; | ||
374 | data->rt_priority = tsk->rt_priority; | ||
375 | |||
376 | /* record this tasks comm */ | ||
377 | tracing_record_cmdline(tsk); | ||
378 | } | ||
379 | |||
380 | ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt) | 342 | ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt) |
381 | { | 343 | { |
382 | int len; | 344 | int len; |
@@ -420,6 +382,56 @@ static ssize_t trace_seq_to_buffer(struct trace_seq *s, void *buf, size_t cnt) | |||
420 | return cnt; | 382 | return cnt; |
421 | } | 383 | } |
422 | 384 | ||
385 | /* | ||
386 | * ftrace_max_lock is used to protect the swapping of buffers | ||
387 | * when taking a max snapshot. The buffers themselves are | ||
388 | * protected by per_cpu spinlocks. But the action of the swap | ||
389 | * needs its own lock. | ||
390 | * | ||
391 | * This is defined as a raw_spinlock_t in order to help | ||
392 | * with performance when lockdep debugging is enabled. | ||
393 | * | ||
394 | * It is also used in other places outside the update_max_tr | ||
395 | * so it needs to be defined outside of the | ||
396 | * CONFIG_TRACER_MAX_TRACE. | ||
397 | */ | ||
398 | static raw_spinlock_t ftrace_max_lock = | ||
399 | (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED; | ||
400 | |||
401 | #ifdef CONFIG_TRACER_MAX_TRACE | ||
402 | unsigned long __read_mostly tracing_max_latency; | ||
403 | unsigned long __read_mostly tracing_thresh; | ||
404 | |||
405 | /* | ||
406 | * Copy the new maximum trace into the separate maximum-trace | ||
407 | * structure. (this way the maximum trace is permanently saved, | ||
408 | * for later retrieval via /sys/kernel/debug/tracing/latency_trace) | ||
409 | */ | ||
410 | static void | ||
411 | __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) | ||
412 | { | ||
413 | struct trace_array_cpu *data = tr->data[cpu]; | ||
414 | struct trace_array_cpu *max_data = tr->data[cpu]; | ||
415 | |||
416 | max_tr.cpu = cpu; | ||
417 | max_tr.time_start = data->preempt_timestamp; | ||
418 | |||
419 | max_data = max_tr.data[cpu]; | ||
420 | max_data->saved_latency = tracing_max_latency; | ||
421 | max_data->critical_start = data->critical_start; | ||
422 | max_data->critical_end = data->critical_end; | ||
423 | |||
424 | memcpy(data->comm, tsk->comm, TASK_COMM_LEN); | ||
425 | max_data->pid = tsk->pid; | ||
426 | max_data->uid = task_uid(tsk); | ||
427 | max_data->nice = tsk->static_prio - 20 - MAX_RT_PRIO; | ||
428 | max_data->policy = tsk->policy; | ||
429 | max_data->rt_priority = tsk->rt_priority; | ||
430 | |||
431 | /* record this tasks comm */ | ||
432 | tracing_record_cmdline(tsk); | ||
433 | } | ||
434 | |||
423 | /** | 435 | /** |
424 | * update_max_tr - snapshot all trace buffers from global_trace to max_tr | 436 | * update_max_tr - snapshot all trace buffers from global_trace to max_tr |
425 | * @tr: tracer | 437 | * @tr: tracer |
@@ -434,16 +446,15 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) | |||
434 | { | 446 | { |
435 | struct ring_buffer *buf = tr->buffer; | 447 | struct ring_buffer *buf = tr->buffer; |
436 | 448 | ||
449 | if (trace_stop_count) | ||
450 | return; | ||
451 | |||
437 | WARN_ON_ONCE(!irqs_disabled()); | 452 | WARN_ON_ONCE(!irqs_disabled()); |
438 | __raw_spin_lock(&ftrace_max_lock); | 453 | __raw_spin_lock(&ftrace_max_lock); |
439 | 454 | ||
440 | tr->buffer = max_tr.buffer; | 455 | tr->buffer = max_tr.buffer; |
441 | max_tr.buffer = buf; | 456 | max_tr.buffer = buf; |
442 | 457 | ||
443 | ftrace_disable_cpu(); | ||
444 | ring_buffer_reset(tr->buffer); | ||
445 | ftrace_enable_cpu(); | ||
446 | |||
447 | __update_max_tr(tr, tsk, cpu); | 458 | __update_max_tr(tr, tsk, cpu); |
448 | __raw_spin_unlock(&ftrace_max_lock); | 459 | __raw_spin_unlock(&ftrace_max_lock); |
449 | } | 460 | } |
@@ -461,21 +472,35 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu) | |||
461 | { | 472 | { |
462 | int ret; | 473 | int ret; |
463 | 474 | ||
475 | if (trace_stop_count) | ||
476 | return; | ||
477 | |||
464 | WARN_ON_ONCE(!irqs_disabled()); | 478 | WARN_ON_ONCE(!irqs_disabled()); |
465 | __raw_spin_lock(&ftrace_max_lock); | 479 | __raw_spin_lock(&ftrace_max_lock); |
466 | 480 | ||
467 | ftrace_disable_cpu(); | 481 | ftrace_disable_cpu(); |
468 | 482 | ||
469 | ring_buffer_reset(max_tr.buffer); | ||
470 | ret = ring_buffer_swap_cpu(max_tr.buffer, tr->buffer, cpu); | 483 | ret = ring_buffer_swap_cpu(max_tr.buffer, tr->buffer, cpu); |
471 | 484 | ||
485 | if (ret == -EBUSY) { | ||
486 | /* | ||
487 | * We failed to swap the buffer due to a commit taking | ||
488 | * place on this CPU. We fail to record, but we reset | ||
489 | * the max trace buffer (no one writes directly to it) | ||
490 | * and flag that it failed. | ||
491 | */ | ||
492 | trace_array_printk(&max_tr, _THIS_IP_, | ||
493 | "Failed to swap buffers due to commit in progress\n"); | ||
494 | } | ||
495 | |||
472 | ftrace_enable_cpu(); | 496 | ftrace_enable_cpu(); |
473 | 497 | ||
474 | WARN_ON_ONCE(ret && ret != -EAGAIN); | 498 | WARN_ON_ONCE(ret && ret != -EAGAIN && ret != -EBUSY); |
475 | 499 | ||
476 | __update_max_tr(tr, tsk, cpu); | 500 | __update_max_tr(tr, tsk, cpu); |
477 | __raw_spin_unlock(&ftrace_max_lock); | 501 | __raw_spin_unlock(&ftrace_max_lock); |
478 | } | 502 | } |
503 | #endif /* CONFIG_TRACER_MAX_TRACE */ | ||
479 | 504 | ||
480 | /** | 505 | /** |
481 | * register_tracer - register a tracer with the ftrace system. | 506 | * register_tracer - register a tracer with the ftrace system. |
@@ -532,7 +557,6 @@ __acquires(kernel_lock) | |||
532 | if (type->selftest && !tracing_selftest_disabled) { | 557 | if (type->selftest && !tracing_selftest_disabled) { |
533 | struct tracer *saved_tracer = current_trace; | 558 | struct tracer *saved_tracer = current_trace; |
534 | struct trace_array *tr = &global_trace; | 559 | struct trace_array *tr = &global_trace; |
535 | int i; | ||
536 | 560 | ||
537 | /* | 561 | /* |
538 | * Run a selftest on this tracer. | 562 | * Run a selftest on this tracer. |
@@ -541,8 +565,7 @@ __acquires(kernel_lock) | |||
541 | * internal tracing to verify that everything is in order. | 565 | * internal tracing to verify that everything is in order. |
542 | * If we fail, we do not register this tracer. | 566 | * If we fail, we do not register this tracer. |
543 | */ | 567 | */ |
544 | for_each_tracing_cpu(i) | 568 | tracing_reset_online_cpus(tr); |
545 | tracing_reset(tr, i); | ||
546 | 569 | ||
547 | current_trace = type; | 570 | current_trace = type; |
548 | /* the test is responsible for initializing and enabling */ | 571 | /* the test is responsible for initializing and enabling */ |
@@ -555,8 +578,7 @@ __acquires(kernel_lock) | |||
555 | goto out; | 578 | goto out; |
556 | } | 579 | } |
557 | /* Only reset on passing, to avoid touching corrupted buffers */ | 580 | /* Only reset on passing, to avoid touching corrupted buffers */ |
558 | for_each_tracing_cpu(i) | 581 | tracing_reset_online_cpus(tr); |
559 | tracing_reset(tr, i); | ||
560 | 582 | ||
561 | printk(KERN_CONT "PASSED\n"); | 583 | printk(KERN_CONT "PASSED\n"); |
562 | } | 584 | } |
@@ -631,21 +653,42 @@ void unregister_tracer(struct tracer *type) | |||
631 | mutex_unlock(&trace_types_lock); | 653 | mutex_unlock(&trace_types_lock); |
632 | } | 654 | } |
633 | 655 | ||
634 | void tracing_reset(struct trace_array *tr, int cpu) | 656 | static void __tracing_reset(struct trace_array *tr, int cpu) |
635 | { | 657 | { |
636 | ftrace_disable_cpu(); | 658 | ftrace_disable_cpu(); |
637 | ring_buffer_reset_cpu(tr->buffer, cpu); | 659 | ring_buffer_reset_cpu(tr->buffer, cpu); |
638 | ftrace_enable_cpu(); | 660 | ftrace_enable_cpu(); |
639 | } | 661 | } |
640 | 662 | ||
663 | void tracing_reset(struct trace_array *tr, int cpu) | ||
664 | { | ||
665 | struct ring_buffer *buffer = tr->buffer; | ||
666 | |||
667 | ring_buffer_record_disable(buffer); | ||
668 | |||
669 | /* Make sure all commits have finished */ | ||
670 | synchronize_sched(); | ||
671 | __tracing_reset(tr, cpu); | ||
672 | |||
673 | ring_buffer_record_enable(buffer); | ||
674 | } | ||
675 | |||
641 | void tracing_reset_online_cpus(struct trace_array *tr) | 676 | void tracing_reset_online_cpus(struct trace_array *tr) |
642 | { | 677 | { |
678 | struct ring_buffer *buffer = tr->buffer; | ||
643 | int cpu; | 679 | int cpu; |
644 | 680 | ||
681 | ring_buffer_record_disable(buffer); | ||
682 | |||
683 | /* Make sure all commits have finished */ | ||
684 | synchronize_sched(); | ||
685 | |||
645 | tr->time_start = ftrace_now(tr->cpu); | 686 | tr->time_start = ftrace_now(tr->cpu); |
646 | 687 | ||
647 | for_each_online_cpu(cpu) | 688 | for_each_online_cpu(cpu) |
648 | tracing_reset(tr, cpu); | 689 | __tracing_reset(tr, cpu); |
690 | |||
691 | ring_buffer_record_enable(buffer); | ||
649 | } | 692 | } |
650 | 693 | ||
651 | void tracing_reset_current(int cpu) | 694 | void tracing_reset_current(int cpu) |
@@ -676,9 +719,6 @@ static void trace_init_cmdlines(void) | |||
676 | cmdline_idx = 0; | 719 | cmdline_idx = 0; |
677 | } | 720 | } |
678 | 721 | ||
679 | static int trace_stop_count; | ||
680 | static DEFINE_SPINLOCK(tracing_start_lock); | ||
681 | |||
682 | /** | 722 | /** |
683 | * ftrace_off_permanent - disable all ftrace code permanently | 723 | * ftrace_off_permanent - disable all ftrace code permanently |
684 | * | 724 | * |
@@ -859,14 +899,15 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags, | |||
859 | } | 899 | } |
860 | EXPORT_SYMBOL_GPL(tracing_generic_entry_update); | 900 | EXPORT_SYMBOL_GPL(tracing_generic_entry_update); |
861 | 901 | ||
862 | struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr, | 902 | struct ring_buffer_event * |
863 | int type, | 903 | trace_buffer_lock_reserve(struct ring_buffer *buffer, |
864 | unsigned long len, | 904 | int type, |
865 | unsigned long flags, int pc) | 905 | unsigned long len, |
906 | unsigned long flags, int pc) | ||
866 | { | 907 | { |
867 | struct ring_buffer_event *event; | 908 | struct ring_buffer_event *event; |
868 | 909 | ||
869 | event = ring_buffer_lock_reserve(tr->buffer, len); | 910 | event = ring_buffer_lock_reserve(buffer, len); |
870 | if (event != NULL) { | 911 | if (event != NULL) { |
871 | struct trace_entry *ent = ring_buffer_event_data(event); | 912 | struct trace_entry *ent = ring_buffer_event_data(event); |
872 | 913 | ||
@@ -877,53 +918,59 @@ struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr, | |||
877 | return event; | 918 | return event; |
878 | } | 919 | } |
879 | 920 | ||
880 | static inline void __trace_buffer_unlock_commit(struct trace_array *tr, | 921 | static inline void |
881 | struct ring_buffer_event *event, | 922 | __trace_buffer_unlock_commit(struct ring_buffer *buffer, |
882 | unsigned long flags, int pc, | 923 | struct ring_buffer_event *event, |
883 | int wake) | 924 | unsigned long flags, int pc, |
925 | int wake) | ||
884 | { | 926 | { |
885 | ring_buffer_unlock_commit(tr->buffer, event); | 927 | ring_buffer_unlock_commit(buffer, event); |
886 | 928 | ||
887 | ftrace_trace_stack(tr, flags, 6, pc); | 929 | ftrace_trace_stack(buffer, flags, 6, pc); |
888 | ftrace_trace_userstack(tr, flags, pc); | 930 | ftrace_trace_userstack(buffer, flags, pc); |
889 | 931 | ||
890 | if (wake) | 932 | if (wake) |
891 | trace_wake_up(); | 933 | trace_wake_up(); |
892 | } | 934 | } |
893 | 935 | ||
894 | void trace_buffer_unlock_commit(struct trace_array *tr, | 936 | void trace_buffer_unlock_commit(struct ring_buffer *buffer, |
895 | struct ring_buffer_event *event, | 937 | struct ring_buffer_event *event, |
896 | unsigned long flags, int pc) | 938 | unsigned long flags, int pc) |
897 | { | 939 | { |
898 | __trace_buffer_unlock_commit(tr, event, flags, pc, 1); | 940 | __trace_buffer_unlock_commit(buffer, event, flags, pc, 1); |
899 | } | 941 | } |
900 | 942 | ||
901 | struct ring_buffer_event * | 943 | struct ring_buffer_event * |
902 | trace_current_buffer_lock_reserve(int type, unsigned long len, | 944 | trace_current_buffer_lock_reserve(struct ring_buffer **current_rb, |
945 | int type, unsigned long len, | ||
903 | unsigned long flags, int pc) | 946 | unsigned long flags, int pc) |
904 | { | 947 | { |
905 | return trace_buffer_lock_reserve(&global_trace, | 948 | *current_rb = global_trace.buffer; |
949 | return trace_buffer_lock_reserve(*current_rb, | ||
906 | type, len, flags, pc); | 950 | type, len, flags, pc); |
907 | } | 951 | } |
908 | EXPORT_SYMBOL_GPL(trace_current_buffer_lock_reserve); | 952 | EXPORT_SYMBOL_GPL(trace_current_buffer_lock_reserve); |
909 | 953 | ||
910 | void trace_current_buffer_unlock_commit(struct ring_buffer_event *event, | 954 | void trace_current_buffer_unlock_commit(struct ring_buffer *buffer, |
955 | struct ring_buffer_event *event, | ||
911 | unsigned long flags, int pc) | 956 | unsigned long flags, int pc) |
912 | { | 957 | { |
913 | __trace_buffer_unlock_commit(&global_trace, event, flags, pc, 1); | 958 | __trace_buffer_unlock_commit(buffer, event, flags, pc, 1); |
914 | } | 959 | } |
915 | EXPORT_SYMBOL_GPL(trace_current_buffer_unlock_commit); | 960 | EXPORT_SYMBOL_GPL(trace_current_buffer_unlock_commit); |
916 | 961 | ||
917 | void trace_nowake_buffer_unlock_commit(struct ring_buffer_event *event, | 962 | void trace_nowake_buffer_unlock_commit(struct ring_buffer *buffer, |
918 | unsigned long flags, int pc) | 963 | struct ring_buffer_event *event, |
964 | unsigned long flags, int pc) | ||
919 | { | 965 | { |
920 | __trace_buffer_unlock_commit(&global_trace, event, flags, pc, 0); | 966 | __trace_buffer_unlock_commit(buffer, event, flags, pc, 0); |
921 | } | 967 | } |
922 | EXPORT_SYMBOL_GPL(trace_nowake_buffer_unlock_commit); | 968 | EXPORT_SYMBOL_GPL(trace_nowake_buffer_unlock_commit); |
923 | 969 | ||
924 | void trace_current_buffer_discard_commit(struct ring_buffer_event *event) | 970 | void trace_current_buffer_discard_commit(struct ring_buffer *buffer, |
971 | struct ring_buffer_event *event) | ||
925 | { | 972 | { |
926 | ring_buffer_discard_commit(global_trace.buffer, event); | 973 | ring_buffer_discard_commit(buffer, event); |
927 | } | 974 | } |
928 | EXPORT_SYMBOL_GPL(trace_current_buffer_discard_commit); | 975 | EXPORT_SYMBOL_GPL(trace_current_buffer_discard_commit); |
929 | 976 | ||
@@ -933,6 +980,7 @@ trace_function(struct trace_array *tr, | |||
933 | int pc) | 980 | int pc) |
934 | { | 981 | { |
935 | struct ftrace_event_call *call = &event_function; | 982 | struct ftrace_event_call *call = &event_function; |
983 | struct ring_buffer *buffer = tr->buffer; | ||
936 | struct ring_buffer_event *event; | 984 | struct ring_buffer_event *event; |
937 | struct ftrace_entry *entry; | 985 | struct ftrace_entry *entry; |
938 | 986 | ||
@@ -940,7 +988,7 @@ trace_function(struct trace_array *tr, | |||
940 | if (unlikely(local_read(&__get_cpu_var(ftrace_cpu_disabled)))) | 988 | if (unlikely(local_read(&__get_cpu_var(ftrace_cpu_disabled)))) |
941 | return; | 989 | return; |
942 | 990 | ||
943 | event = trace_buffer_lock_reserve(tr, TRACE_FN, sizeof(*entry), | 991 | event = trace_buffer_lock_reserve(buffer, TRACE_FN, sizeof(*entry), |
944 | flags, pc); | 992 | flags, pc); |
945 | if (!event) | 993 | if (!event) |
946 | return; | 994 | return; |
@@ -948,8 +996,8 @@ trace_function(struct trace_array *tr, | |||
948 | entry->ip = ip; | 996 | entry->ip = ip; |
949 | entry->parent_ip = parent_ip; | 997 | entry->parent_ip = parent_ip; |
950 | 998 | ||
951 | if (!filter_check_discard(call, entry, tr->buffer, event)) | 999 | if (!filter_check_discard(call, entry, buffer, event)) |
952 | ring_buffer_unlock_commit(tr->buffer, event); | 1000 | ring_buffer_unlock_commit(buffer, event); |
953 | } | 1001 | } |
954 | 1002 | ||
955 | void | 1003 | void |
@@ -962,7 +1010,7 @@ ftrace(struct trace_array *tr, struct trace_array_cpu *data, | |||
962 | } | 1010 | } |
963 | 1011 | ||
964 | #ifdef CONFIG_STACKTRACE | 1012 | #ifdef CONFIG_STACKTRACE |
965 | static void __ftrace_trace_stack(struct trace_array *tr, | 1013 | static void __ftrace_trace_stack(struct ring_buffer *buffer, |
966 | unsigned long flags, | 1014 | unsigned long flags, |
967 | int skip, int pc) | 1015 | int skip, int pc) |
968 | { | 1016 | { |
@@ -971,7 +1019,7 @@ static void __ftrace_trace_stack(struct trace_array *tr, | |||
971 | struct stack_entry *entry; | 1019 | struct stack_entry *entry; |
972 | struct stack_trace trace; | 1020 | struct stack_trace trace; |
973 | 1021 | ||
974 | event = trace_buffer_lock_reserve(tr, TRACE_STACK, | 1022 | event = trace_buffer_lock_reserve(buffer, TRACE_STACK, |
975 | sizeof(*entry), flags, pc); | 1023 | sizeof(*entry), flags, pc); |
976 | if (!event) | 1024 | if (!event) |
977 | return; | 1025 | return; |
@@ -984,26 +1032,27 @@ static void __ftrace_trace_stack(struct trace_array *tr, | |||
984 | trace.entries = entry->caller; | 1032 | trace.entries = entry->caller; |
985 | 1033 | ||
986 | save_stack_trace(&trace); | 1034 | save_stack_trace(&trace); |
987 | if (!filter_check_discard(call, entry, tr->buffer, event)) | 1035 | if (!filter_check_discard(call, entry, buffer, event)) |
988 | ring_buffer_unlock_commit(tr->buffer, event); | 1036 | ring_buffer_unlock_commit(buffer, event); |
989 | } | 1037 | } |
990 | 1038 | ||
991 | void ftrace_trace_stack(struct trace_array *tr, unsigned long flags, int skip, | 1039 | void ftrace_trace_stack(struct ring_buffer *buffer, unsigned long flags, |
992 | int pc) | 1040 | int skip, int pc) |
993 | { | 1041 | { |
994 | if (!(trace_flags & TRACE_ITER_STACKTRACE)) | 1042 | if (!(trace_flags & TRACE_ITER_STACKTRACE)) |
995 | return; | 1043 | return; |
996 | 1044 | ||
997 | __ftrace_trace_stack(tr, flags, skip, pc); | 1045 | __ftrace_trace_stack(buffer, flags, skip, pc); |
998 | } | 1046 | } |
999 | 1047 | ||
1000 | void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, | 1048 | void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, |
1001 | int pc) | 1049 | int pc) |
1002 | { | 1050 | { |
1003 | __ftrace_trace_stack(tr, flags, skip, pc); | 1051 | __ftrace_trace_stack(tr->buffer, flags, skip, pc); |
1004 | } | 1052 | } |
1005 | 1053 | ||
1006 | void ftrace_trace_userstack(struct trace_array *tr, unsigned long flags, int pc) | 1054 | void |
1055 | ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) | ||
1007 | { | 1056 | { |
1008 | struct ftrace_event_call *call = &event_user_stack; | 1057 | struct ftrace_event_call *call = &event_user_stack; |
1009 | struct ring_buffer_event *event; | 1058 | struct ring_buffer_event *event; |
@@ -1013,7 +1062,7 @@ void ftrace_trace_userstack(struct trace_array *tr, unsigned long flags, int pc) | |||
1013 | if (!(trace_flags & TRACE_ITER_USERSTACKTRACE)) | 1062 | if (!(trace_flags & TRACE_ITER_USERSTACKTRACE)) |
1014 | return; | 1063 | return; |
1015 | 1064 | ||
1016 | event = trace_buffer_lock_reserve(tr, TRACE_USER_STACK, | 1065 | event = trace_buffer_lock_reserve(buffer, TRACE_USER_STACK, |
1017 | sizeof(*entry), flags, pc); | 1066 | sizeof(*entry), flags, pc); |
1018 | if (!event) | 1067 | if (!event) |
1019 | return; | 1068 | return; |
@@ -1027,8 +1076,8 @@ void ftrace_trace_userstack(struct trace_array *tr, unsigned long flags, int pc) | |||
1027 | trace.entries = entry->caller; | 1076 | trace.entries = entry->caller; |
1028 | 1077 | ||
1029 | save_stack_trace_user(&trace); | 1078 | save_stack_trace_user(&trace); |
1030 | if (!filter_check_discard(call, entry, tr->buffer, event)) | 1079 | if (!filter_check_discard(call, entry, buffer, event)) |
1031 | ring_buffer_unlock_commit(tr->buffer, event); | 1080 | ring_buffer_unlock_commit(buffer, event); |
1032 | } | 1081 | } |
1033 | 1082 | ||
1034 | #ifdef UNUSED | 1083 | #ifdef UNUSED |
@@ -1047,9 +1096,10 @@ ftrace_trace_special(void *__tr, | |||
1047 | { | 1096 | { |
1048 | struct ring_buffer_event *event; | 1097 | struct ring_buffer_event *event; |
1049 | struct trace_array *tr = __tr; | 1098 | struct trace_array *tr = __tr; |
1099 | struct ring_buffer *buffer = tr->buffer; | ||
1050 | struct special_entry *entry; | 1100 | struct special_entry *entry; |
1051 | 1101 | ||
1052 | event = trace_buffer_lock_reserve(tr, TRACE_SPECIAL, | 1102 | event = trace_buffer_lock_reserve(buffer, TRACE_SPECIAL, |
1053 | sizeof(*entry), 0, pc); | 1103 | sizeof(*entry), 0, pc); |
1054 | if (!event) | 1104 | if (!event) |
1055 | return; | 1105 | return; |
@@ -1057,7 +1107,7 @@ ftrace_trace_special(void *__tr, | |||
1057 | entry->arg1 = arg1; | 1107 | entry->arg1 = arg1; |
1058 | entry->arg2 = arg2; | 1108 | entry->arg2 = arg2; |
1059 | entry->arg3 = arg3; | 1109 | entry->arg3 = arg3; |
1060 | trace_buffer_unlock_commit(tr, event, 0, pc); | 1110 | trace_buffer_unlock_commit(buffer, event, 0, pc); |
1061 | } | 1111 | } |
1062 | 1112 | ||
1063 | void | 1113 | void |
@@ -1103,6 +1153,7 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args) | |||
1103 | 1153 | ||
1104 | struct ftrace_event_call *call = &event_bprint; | 1154 | struct ftrace_event_call *call = &event_bprint; |
1105 | struct ring_buffer_event *event; | 1155 | struct ring_buffer_event *event; |
1156 | struct ring_buffer *buffer; | ||
1106 | struct trace_array *tr = &global_trace; | 1157 | struct trace_array *tr = &global_trace; |
1107 | struct trace_array_cpu *data; | 1158 | struct trace_array_cpu *data; |
1108 | struct bprint_entry *entry; | 1159 | struct bprint_entry *entry; |
@@ -1135,7 +1186,9 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args) | |||
1135 | goto out_unlock; | 1186 | goto out_unlock; |
1136 | 1187 | ||
1137 | size = sizeof(*entry) + sizeof(u32) * len; | 1188 | size = sizeof(*entry) + sizeof(u32) * len; |
1138 | event = trace_buffer_lock_reserve(tr, TRACE_BPRINT, size, flags, pc); | 1189 | buffer = tr->buffer; |
1190 | event = trace_buffer_lock_reserve(buffer, TRACE_BPRINT, size, | ||
1191 | flags, pc); | ||
1139 | if (!event) | 1192 | if (!event) |
1140 | goto out_unlock; | 1193 | goto out_unlock; |
1141 | entry = ring_buffer_event_data(event); | 1194 | entry = ring_buffer_event_data(event); |
@@ -1143,8 +1196,8 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args) | |||
1143 | entry->fmt = fmt; | 1196 | entry->fmt = fmt; |
1144 | 1197 | ||
1145 | memcpy(entry->buf, trace_buf, sizeof(u32) * len); | 1198 | memcpy(entry->buf, trace_buf, sizeof(u32) * len); |
1146 | if (!filter_check_discard(call, entry, tr->buffer, event)) | 1199 | if (!filter_check_discard(call, entry, buffer, event)) |
1147 | ring_buffer_unlock_commit(tr->buffer, event); | 1200 | ring_buffer_unlock_commit(buffer, event); |
1148 | 1201 | ||
1149 | out_unlock: | 1202 | out_unlock: |
1150 | __raw_spin_unlock(&trace_buf_lock); | 1203 | __raw_spin_unlock(&trace_buf_lock); |
@@ -1159,14 +1212,30 @@ out: | |||
1159 | } | 1212 | } |
1160 | EXPORT_SYMBOL_GPL(trace_vbprintk); | 1213 | EXPORT_SYMBOL_GPL(trace_vbprintk); |
1161 | 1214 | ||
1162 | int trace_vprintk(unsigned long ip, const char *fmt, va_list args) | 1215 | int trace_array_printk(struct trace_array *tr, |
1216 | unsigned long ip, const char *fmt, ...) | ||
1217 | { | ||
1218 | int ret; | ||
1219 | va_list ap; | ||
1220 | |||
1221 | if (!(trace_flags & TRACE_ITER_PRINTK)) | ||
1222 | return 0; | ||
1223 | |||
1224 | va_start(ap, fmt); | ||
1225 | ret = trace_array_vprintk(tr, ip, fmt, ap); | ||
1226 | va_end(ap); | ||
1227 | return ret; | ||
1228 | } | ||
1229 | |||
1230 | int trace_array_vprintk(struct trace_array *tr, | ||
1231 | unsigned long ip, const char *fmt, va_list args) | ||
1163 | { | 1232 | { |
1164 | static raw_spinlock_t trace_buf_lock = __RAW_SPIN_LOCK_UNLOCKED; | 1233 | static raw_spinlock_t trace_buf_lock = __RAW_SPIN_LOCK_UNLOCKED; |
1165 | static char trace_buf[TRACE_BUF_SIZE]; | 1234 | static char trace_buf[TRACE_BUF_SIZE]; |
1166 | 1235 | ||
1167 | struct ftrace_event_call *call = &event_print; | 1236 | struct ftrace_event_call *call = &event_print; |
1168 | struct ring_buffer_event *event; | 1237 | struct ring_buffer_event *event; |
1169 | struct trace_array *tr = &global_trace; | 1238 | struct ring_buffer *buffer; |
1170 | struct trace_array_cpu *data; | 1239 | struct trace_array_cpu *data; |
1171 | int cpu, len = 0, size, pc; | 1240 | int cpu, len = 0, size, pc; |
1172 | struct print_entry *entry; | 1241 | struct print_entry *entry; |
@@ -1194,7 +1263,9 @@ int trace_vprintk(unsigned long ip, const char *fmt, va_list args) | |||
1194 | trace_buf[len] = 0; | 1263 | trace_buf[len] = 0; |
1195 | 1264 | ||
1196 | size = sizeof(*entry) + len + 1; | 1265 | size = sizeof(*entry) + len + 1; |
1197 | event = trace_buffer_lock_reserve(tr, TRACE_PRINT, size, irq_flags, pc); | 1266 | buffer = tr->buffer; |
1267 | event = trace_buffer_lock_reserve(buffer, TRACE_PRINT, size, | ||
1268 | irq_flags, pc); | ||
1198 | if (!event) | 1269 | if (!event) |
1199 | goto out_unlock; | 1270 | goto out_unlock; |
1200 | entry = ring_buffer_event_data(event); | 1271 | entry = ring_buffer_event_data(event); |
@@ -1202,8 +1273,8 @@ int trace_vprintk(unsigned long ip, const char *fmt, va_list args) | |||
1202 | 1273 | ||
1203 | memcpy(&entry->buf, trace_buf, len); | 1274 | memcpy(&entry->buf, trace_buf, len); |
1204 | entry->buf[len] = 0; | 1275 | entry->buf[len] = 0; |
1205 | if (!filter_check_discard(call, entry, tr->buffer, event)) | 1276 | if (!filter_check_discard(call, entry, buffer, event)) |
1206 | ring_buffer_unlock_commit(tr->buffer, event); | 1277 | ring_buffer_unlock_commit(buffer, event); |
1207 | 1278 | ||
1208 | out_unlock: | 1279 | out_unlock: |
1209 | __raw_spin_unlock(&trace_buf_lock); | 1280 | __raw_spin_unlock(&trace_buf_lock); |
@@ -1215,6 +1286,11 @@ int trace_vprintk(unsigned long ip, const char *fmt, va_list args) | |||
1215 | 1286 | ||
1216 | return len; | 1287 | return len; |
1217 | } | 1288 | } |
1289 | |||
1290 | int trace_vprintk(unsigned long ip, const char *fmt, va_list args) | ||
1291 | { | ||
1292 | return trace_array_printk(&global_trace, ip, fmt, args); | ||
1293 | } | ||
1218 | EXPORT_SYMBOL_GPL(trace_vprintk); | 1294 | EXPORT_SYMBOL_GPL(trace_vprintk); |
1219 | 1295 | ||
1220 | enum trace_file_type { | 1296 | enum trace_file_type { |
@@ -1354,6 +1430,37 @@ static void *s_next(struct seq_file *m, void *v, loff_t *pos) | |||
1354 | return ent; | 1430 | return ent; |
1355 | } | 1431 | } |
1356 | 1432 | ||
1433 | static void tracing_iter_reset(struct trace_iterator *iter, int cpu) | ||
1434 | { | ||
1435 | struct trace_array *tr = iter->tr; | ||
1436 | struct ring_buffer_event *event; | ||
1437 | struct ring_buffer_iter *buf_iter; | ||
1438 | unsigned long entries = 0; | ||
1439 | u64 ts; | ||
1440 | |||
1441 | tr->data[cpu]->skipped_entries = 0; | ||
1442 | |||
1443 | if (!iter->buffer_iter[cpu]) | ||
1444 | return; | ||
1445 | |||
1446 | buf_iter = iter->buffer_iter[cpu]; | ||
1447 | ring_buffer_iter_reset(buf_iter); | ||
1448 | |||
1449 | /* | ||
1450 | * We could have the case with the max latency tracers | ||
1451 | * that a reset never took place on a cpu. This is evident | ||
1452 | * by the timestamp being before the start of the buffer. | ||
1453 | */ | ||
1454 | while ((event = ring_buffer_iter_peek(buf_iter, &ts))) { | ||
1455 | if (ts >= iter->tr->time_start) | ||
1456 | break; | ||
1457 | entries++; | ||
1458 | ring_buffer_read(buf_iter, NULL); | ||
1459 | } | ||
1460 | |||
1461 | tr->data[cpu]->skipped_entries = entries; | ||
1462 | } | ||
1463 | |||
1357 | /* | 1464 | /* |
1358 | * No necessary locking here. The worst thing which can | 1465 | * No necessary locking here. The worst thing which can |
1359 | * happen is loosing events consumed at the same time | 1466 | * happen is loosing events consumed at the same time |
@@ -1392,10 +1499,9 @@ static void *s_start(struct seq_file *m, loff_t *pos) | |||
1392 | 1499 | ||
1393 | if (cpu_file == TRACE_PIPE_ALL_CPU) { | 1500 | if (cpu_file == TRACE_PIPE_ALL_CPU) { |
1394 | for_each_tracing_cpu(cpu) | 1501 | for_each_tracing_cpu(cpu) |
1395 | ring_buffer_iter_reset(iter->buffer_iter[cpu]); | 1502 | tracing_iter_reset(iter, cpu); |
1396 | } else | 1503 | } else |
1397 | ring_buffer_iter_reset(iter->buffer_iter[cpu_file]); | 1504 | tracing_iter_reset(iter, cpu_file); |
1398 | |||
1399 | 1505 | ||
1400 | ftrace_enable_cpu(); | 1506 | ftrace_enable_cpu(); |
1401 | 1507 | ||
@@ -1444,16 +1550,32 @@ print_trace_header(struct seq_file *m, struct trace_iterator *iter) | |||
1444 | struct trace_array *tr = iter->tr; | 1550 | struct trace_array *tr = iter->tr; |
1445 | struct trace_array_cpu *data = tr->data[tr->cpu]; | 1551 | struct trace_array_cpu *data = tr->data[tr->cpu]; |
1446 | struct tracer *type = current_trace; | 1552 | struct tracer *type = current_trace; |
1447 | unsigned long total; | 1553 | unsigned long entries = 0; |
1448 | unsigned long entries; | 1554 | unsigned long total = 0; |
1555 | unsigned long count; | ||
1449 | const char *name = "preemption"; | 1556 | const char *name = "preemption"; |
1557 | int cpu; | ||
1450 | 1558 | ||
1451 | if (type) | 1559 | if (type) |
1452 | name = type->name; | 1560 | name = type->name; |
1453 | 1561 | ||
1454 | entries = ring_buffer_entries(iter->tr->buffer); | 1562 | |
1455 | total = entries + | 1563 | for_each_tracing_cpu(cpu) { |
1456 | ring_buffer_overruns(iter->tr->buffer); | 1564 | count = ring_buffer_entries_cpu(tr->buffer, cpu); |
1565 | /* | ||
1566 | * If this buffer has skipped entries, then we hold all | ||
1567 | * entries for the trace and we need to ignore the | ||
1568 | * ones before the time stamp. | ||
1569 | */ | ||
1570 | if (tr->data[cpu]->skipped_entries) { | ||
1571 | count -= tr->data[cpu]->skipped_entries; | ||
1572 | /* total is the same as the entries */ | ||
1573 | total += count; | ||
1574 | } else | ||
1575 | total += count + | ||
1576 | ring_buffer_overrun_cpu(tr->buffer, cpu); | ||
1577 | entries += count; | ||
1578 | } | ||
1457 | 1579 | ||
1458 | seq_printf(m, "# %s latency trace v1.1.5 on %s\n", | 1580 | seq_printf(m, "# %s latency trace v1.1.5 on %s\n", |
1459 | name, UTS_RELEASE); | 1581 | name, UTS_RELEASE); |
@@ -1495,7 +1617,7 @@ print_trace_header(struct seq_file *m, struct trace_iterator *iter) | |||
1495 | seq_puts(m, "\n# => ended at: "); | 1617 | seq_puts(m, "\n# => ended at: "); |
1496 | seq_print_ip_sym(&iter->seq, data->critical_end, sym_flags); | 1618 | seq_print_ip_sym(&iter->seq, data->critical_end, sym_flags); |
1497 | trace_print_seq(m, &iter->seq); | 1619 | trace_print_seq(m, &iter->seq); |
1498 | seq_puts(m, "#\n"); | 1620 | seq_puts(m, "\n#\n"); |
1499 | } | 1621 | } |
1500 | 1622 | ||
1501 | seq_puts(m, "#\n"); | 1623 | seq_puts(m, "#\n"); |
@@ -1514,6 +1636,9 @@ static void test_cpu_buff_start(struct trace_iterator *iter) | |||
1514 | if (cpumask_test_cpu(iter->cpu, iter->started)) | 1636 | if (cpumask_test_cpu(iter->cpu, iter->started)) |
1515 | return; | 1637 | return; |
1516 | 1638 | ||
1639 | if (iter->tr->data[iter->cpu]->skipped_entries) | ||
1640 | return; | ||
1641 | |||
1517 | cpumask_set_cpu(iter->cpu, iter->started); | 1642 | cpumask_set_cpu(iter->cpu, iter->started); |
1518 | 1643 | ||
1519 | /* Don't print started cpu buffer for the first entry of the trace */ | 1644 | /* Don't print started cpu buffer for the first entry of the trace */ |
@@ -1776,19 +1901,23 @@ __tracing_open(struct inode *inode, struct file *file) | |||
1776 | if (ring_buffer_overruns(iter->tr->buffer)) | 1901 | if (ring_buffer_overruns(iter->tr->buffer)) |
1777 | iter->iter_flags |= TRACE_FILE_ANNOTATE; | 1902 | iter->iter_flags |= TRACE_FILE_ANNOTATE; |
1778 | 1903 | ||
1904 | /* stop the trace while dumping */ | ||
1905 | tracing_stop(); | ||
1906 | |||
1779 | if (iter->cpu_file == TRACE_PIPE_ALL_CPU) { | 1907 | if (iter->cpu_file == TRACE_PIPE_ALL_CPU) { |
1780 | for_each_tracing_cpu(cpu) { | 1908 | for_each_tracing_cpu(cpu) { |
1781 | 1909 | ||
1782 | iter->buffer_iter[cpu] = | 1910 | iter->buffer_iter[cpu] = |
1783 | ring_buffer_read_start(iter->tr->buffer, cpu); | 1911 | ring_buffer_read_start(iter->tr->buffer, cpu); |
1912 | tracing_iter_reset(iter, cpu); | ||
1784 | } | 1913 | } |
1785 | } else { | 1914 | } else { |
1786 | cpu = iter->cpu_file; | 1915 | cpu = iter->cpu_file; |
1787 | iter->buffer_iter[cpu] = | 1916 | iter->buffer_iter[cpu] = |
1788 | ring_buffer_read_start(iter->tr->buffer, cpu); | 1917 | ring_buffer_read_start(iter->tr->buffer, cpu); |
1918 | tracing_iter_reset(iter, cpu); | ||
1789 | } | 1919 | } |
1790 | 1920 | ||
1791 | /* TODO stop tracer */ | ||
1792 | ret = seq_open(file, &tracer_seq_ops); | 1921 | ret = seq_open(file, &tracer_seq_ops); |
1793 | if (ret < 0) { | 1922 | if (ret < 0) { |
1794 | fail_ret = ERR_PTR(ret); | 1923 | fail_ret = ERR_PTR(ret); |
@@ -1798,9 +1927,6 @@ __tracing_open(struct inode *inode, struct file *file) | |||
1798 | m = file->private_data; | 1927 | m = file->private_data; |
1799 | m->private = iter; | 1928 | m->private = iter; |
1800 | 1929 | ||
1801 | /* stop the trace while dumping */ | ||
1802 | tracing_stop(); | ||
1803 | |||
1804 | mutex_unlock(&trace_types_lock); | 1930 | mutex_unlock(&trace_types_lock); |
1805 | 1931 | ||
1806 | return iter; | 1932 | return iter; |
@@ -1811,6 +1937,7 @@ __tracing_open(struct inode *inode, struct file *file) | |||
1811 | ring_buffer_read_finish(iter->buffer_iter[cpu]); | 1937 | ring_buffer_read_finish(iter->buffer_iter[cpu]); |
1812 | } | 1938 | } |
1813 | free_cpumask_var(iter->started); | 1939 | free_cpumask_var(iter->started); |
1940 | tracing_start(); | ||
1814 | fail: | 1941 | fail: |
1815 | mutex_unlock(&trace_types_lock); | 1942 | mutex_unlock(&trace_types_lock); |
1816 | kfree(iter->trace); | 1943 | kfree(iter->trace); |
@@ -3774,17 +3901,9 @@ trace_options_core_write(struct file *filp, const char __user *ubuf, size_t cnt, | |||
3774 | if (ret < 0) | 3901 | if (ret < 0) |
3775 | return ret; | 3902 | return ret; |
3776 | 3903 | ||
3777 | switch (val) { | 3904 | if (val != 0 && val != 1) |
3778 | case 0: | ||
3779 | trace_flags &= ~(1 << index); | ||
3780 | break; | ||
3781 | case 1: | ||
3782 | trace_flags |= 1 << index; | ||
3783 | break; | ||
3784 | |||
3785 | default: | ||
3786 | return -EINVAL; | 3905 | return -EINVAL; |
3787 | } | 3906 | set_tracer_flags(1 << index, val); |
3788 | 3907 | ||
3789 | *ppos += cnt; | 3908 | *ppos += cnt; |
3790 | 3909 | ||
@@ -3952,11 +4071,13 @@ static __init int tracer_init_debugfs(void) | |||
3952 | trace_create_file("current_tracer", 0644, d_tracer, | 4071 | trace_create_file("current_tracer", 0644, d_tracer, |
3953 | &global_trace, &set_tracer_fops); | 4072 | &global_trace, &set_tracer_fops); |
3954 | 4073 | ||
4074 | #ifdef CONFIG_TRACER_MAX_TRACE | ||
3955 | trace_create_file("tracing_max_latency", 0644, d_tracer, | 4075 | trace_create_file("tracing_max_latency", 0644, d_tracer, |
3956 | &tracing_max_latency, &tracing_max_lat_fops); | 4076 | &tracing_max_latency, &tracing_max_lat_fops); |
3957 | 4077 | ||
3958 | trace_create_file("tracing_thresh", 0644, d_tracer, | 4078 | trace_create_file("tracing_thresh", 0644, d_tracer, |
3959 | &tracing_thresh, &tracing_max_lat_fops); | 4079 | &tracing_thresh, &tracing_max_lat_fops); |
4080 | #endif | ||
3960 | 4081 | ||
3961 | trace_create_file("README", 0444, d_tracer, | 4082 | trace_create_file("README", 0444, d_tracer, |
3962 | NULL, &tracing_readme_fops); | 4083 | NULL, &tracing_readme_fops); |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index f5362a0529eb..821064914c80 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -258,9 +258,6 @@ struct trace_array_cpu { | |||
258 | atomic_t disabled; | 258 | atomic_t disabled; |
259 | void *buffer_page; /* ring buffer spare */ | 259 | void *buffer_page; /* ring buffer spare */ |
260 | 260 | ||
261 | /* these fields get copied into max-trace: */ | ||
262 | unsigned long trace_idx; | ||
263 | unsigned long overrun; | ||
264 | unsigned long saved_latency; | 261 | unsigned long saved_latency; |
265 | unsigned long critical_start; | 262 | unsigned long critical_start; |
266 | unsigned long critical_end; | 263 | unsigned long critical_end; |
@@ -268,6 +265,7 @@ struct trace_array_cpu { | |||
268 | unsigned long nice; | 265 | unsigned long nice; |
269 | unsigned long policy; | 266 | unsigned long policy; |
270 | unsigned long rt_priority; | 267 | unsigned long rt_priority; |
268 | unsigned long skipped_entries; | ||
271 | cycle_t preempt_timestamp; | 269 | cycle_t preempt_timestamp; |
272 | pid_t pid; | 270 | pid_t pid; |
273 | uid_t uid; | 271 | uid_t uid; |
@@ -441,12 +439,13 @@ void init_tracer_sysprof_debugfs(struct dentry *d_tracer); | |||
441 | 439 | ||
442 | struct ring_buffer_event; | 440 | struct ring_buffer_event; |
443 | 441 | ||
444 | struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr, | 442 | struct ring_buffer_event * |
445 | int type, | 443 | trace_buffer_lock_reserve(struct ring_buffer *buffer, |
446 | unsigned long len, | 444 | int type, |
447 | unsigned long flags, | 445 | unsigned long len, |
448 | int pc); | 446 | unsigned long flags, |
449 | void trace_buffer_unlock_commit(struct trace_array *tr, | 447 | int pc); |
448 | void trace_buffer_unlock_commit(struct ring_buffer *buffer, | ||
450 | struct ring_buffer_event *event, | 449 | struct ring_buffer_event *event, |
451 | unsigned long flags, int pc); | 450 | unsigned long flags, int pc); |
452 | 451 | ||
@@ -497,18 +496,20 @@ void unregister_tracer(struct tracer *type); | |||
497 | 496 | ||
498 | extern unsigned long nsecs_to_usecs(unsigned long nsecs); | 497 | extern unsigned long nsecs_to_usecs(unsigned long nsecs); |
499 | 498 | ||
499 | #ifdef CONFIG_TRACER_MAX_TRACE | ||
500 | extern unsigned long tracing_max_latency; | 500 | extern unsigned long tracing_max_latency; |
501 | extern unsigned long tracing_thresh; | 501 | extern unsigned long tracing_thresh; |
502 | 502 | ||
503 | void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); | 503 | void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); |
504 | void update_max_tr_single(struct trace_array *tr, | 504 | void update_max_tr_single(struct trace_array *tr, |
505 | struct task_struct *tsk, int cpu); | 505 | struct task_struct *tsk, int cpu); |
506 | #endif /* CONFIG_TRACER_MAX_TRACE */ | ||
506 | 507 | ||
507 | #ifdef CONFIG_STACKTRACE | 508 | #ifdef CONFIG_STACKTRACE |
508 | void ftrace_trace_stack(struct trace_array *tr, unsigned long flags, | 509 | void ftrace_trace_stack(struct ring_buffer *buffer, unsigned long flags, |
509 | int skip, int pc); | 510 | int skip, int pc); |
510 | 511 | ||
511 | void ftrace_trace_userstack(struct trace_array *tr, unsigned long flags, | 512 | void ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, |
512 | int pc); | 513 | int pc); |
513 | 514 | ||
514 | void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, | 515 | void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, |
@@ -589,6 +590,11 @@ extern int | |||
589 | trace_vbprintk(unsigned long ip, const char *fmt, va_list args); | 590 | trace_vbprintk(unsigned long ip, const char *fmt, va_list args); |
590 | extern int | 591 | extern int |
591 | trace_vprintk(unsigned long ip, const char *fmt, va_list args); | 592 | trace_vprintk(unsigned long ip, const char *fmt, va_list args); |
593 | extern int | ||
594 | trace_array_vprintk(struct trace_array *tr, | ||
595 | unsigned long ip, const char *fmt, va_list args); | ||
596 | int trace_array_printk(struct trace_array *tr, | ||
597 | unsigned long ip, const char *fmt, ...); | ||
592 | 598 | ||
593 | extern unsigned long trace_flags; | 599 | extern unsigned long trace_flags; |
594 | 600 | ||
diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c index a29ef23ffb47..19bfc75d467e 100644 --- a/kernel/trace/trace_boot.c +++ b/kernel/trace/trace_boot.c | |||
@@ -41,14 +41,12 @@ void disable_boot_trace(void) | |||
41 | 41 | ||
42 | static int boot_trace_init(struct trace_array *tr) | 42 | static int boot_trace_init(struct trace_array *tr) |
43 | { | 43 | { |
44 | int cpu; | ||
45 | boot_trace = tr; | 44 | boot_trace = tr; |
46 | 45 | ||
47 | if (!tr) | 46 | if (!tr) |
48 | return 0; | 47 | return 0; |
49 | 48 | ||
50 | for_each_cpu(cpu, cpu_possible_mask) | 49 | tracing_reset_online_cpus(tr); |
51 | tracing_reset(tr, cpu); | ||
52 | 50 | ||
53 | tracing_sched_switch_assign_trace(tr); | 51 | tracing_sched_switch_assign_trace(tr); |
54 | return 0; | 52 | return 0; |
@@ -132,6 +130,7 @@ struct tracer boot_tracer __read_mostly = | |||
132 | void trace_boot_call(struct boot_trace_call *bt, initcall_t fn) | 130 | void trace_boot_call(struct boot_trace_call *bt, initcall_t fn) |
133 | { | 131 | { |
134 | struct ring_buffer_event *event; | 132 | struct ring_buffer_event *event; |
133 | struct ring_buffer *buffer; | ||
135 | struct trace_boot_call *entry; | 134 | struct trace_boot_call *entry; |
136 | struct trace_array *tr = boot_trace; | 135 | struct trace_array *tr = boot_trace; |
137 | 136 | ||
@@ -144,13 +143,14 @@ void trace_boot_call(struct boot_trace_call *bt, initcall_t fn) | |||
144 | sprint_symbol(bt->func, (unsigned long)fn); | 143 | sprint_symbol(bt->func, (unsigned long)fn); |
145 | preempt_disable(); | 144 | preempt_disable(); |
146 | 145 | ||
147 | event = trace_buffer_lock_reserve(tr, TRACE_BOOT_CALL, | 146 | buffer = tr->buffer; |
147 | event = trace_buffer_lock_reserve(buffer, TRACE_BOOT_CALL, | ||
148 | sizeof(*entry), 0, 0); | 148 | sizeof(*entry), 0, 0); |
149 | if (!event) | 149 | if (!event) |
150 | goto out; | 150 | goto out; |
151 | entry = ring_buffer_event_data(event); | 151 | entry = ring_buffer_event_data(event); |
152 | entry->boot_call = *bt; | 152 | entry->boot_call = *bt; |
153 | trace_buffer_unlock_commit(tr, event, 0, 0); | 153 | trace_buffer_unlock_commit(buffer, event, 0, 0); |
154 | out: | 154 | out: |
155 | preempt_enable(); | 155 | preempt_enable(); |
156 | } | 156 | } |
@@ -158,6 +158,7 @@ void trace_boot_call(struct boot_trace_call *bt, initcall_t fn) | |||
158 | void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn) | 158 | void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn) |
159 | { | 159 | { |
160 | struct ring_buffer_event *event; | 160 | struct ring_buffer_event *event; |
161 | struct ring_buffer *buffer; | ||
161 | struct trace_boot_ret *entry; | 162 | struct trace_boot_ret *entry; |
162 | struct trace_array *tr = boot_trace; | 163 | struct trace_array *tr = boot_trace; |
163 | 164 | ||
@@ -167,13 +168,14 @@ void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn) | |||
167 | sprint_symbol(bt->func, (unsigned long)fn); | 168 | sprint_symbol(bt->func, (unsigned long)fn); |
168 | preempt_disable(); | 169 | preempt_disable(); |
169 | 170 | ||
170 | event = trace_buffer_lock_reserve(tr, TRACE_BOOT_RET, | 171 | buffer = tr->buffer; |
172 | event = trace_buffer_lock_reserve(buffer, TRACE_BOOT_RET, | ||
171 | sizeof(*entry), 0, 0); | 173 | sizeof(*entry), 0, 0); |
172 | if (!event) | 174 | if (!event) |
173 | goto out; | 175 | goto out; |
174 | entry = ring_buffer_event_data(event); | 176 | entry = ring_buffer_event_data(event); |
175 | entry->boot_ret = *bt; | 177 | entry->boot_ret = *bt; |
176 | trace_buffer_unlock_commit(tr, event, 0, 0); | 178 | trace_buffer_unlock_commit(buffer, event, 0, 0); |
177 | out: | 179 | out: |
178 | preempt_enable(); | 180 | preempt_enable(); |
179 | } | 181 | } |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 197cdaa96c43..ba3492076ab2 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -1485,6 +1485,7 @@ static void | |||
1485 | function_test_events_call(unsigned long ip, unsigned long parent_ip) | 1485 | function_test_events_call(unsigned long ip, unsigned long parent_ip) |
1486 | { | 1486 | { |
1487 | struct ring_buffer_event *event; | 1487 | struct ring_buffer_event *event; |
1488 | struct ring_buffer *buffer; | ||
1488 | struct ftrace_entry *entry; | 1489 | struct ftrace_entry *entry; |
1489 | unsigned long flags; | 1490 | unsigned long flags; |
1490 | long disabled; | 1491 | long disabled; |
@@ -1502,7 +1503,8 @@ function_test_events_call(unsigned long ip, unsigned long parent_ip) | |||
1502 | 1503 | ||
1503 | local_save_flags(flags); | 1504 | local_save_flags(flags); |
1504 | 1505 | ||
1505 | event = trace_current_buffer_lock_reserve(TRACE_FN, sizeof(*entry), | 1506 | event = trace_current_buffer_lock_reserve(&buffer, |
1507 | TRACE_FN, sizeof(*entry), | ||
1506 | flags, pc); | 1508 | flags, pc); |
1507 | if (!event) | 1509 | if (!event) |
1508 | goto out; | 1510 | goto out; |
@@ -1510,7 +1512,7 @@ function_test_events_call(unsigned long ip, unsigned long parent_ip) | |||
1510 | entry->ip = ip; | 1512 | entry->ip = ip; |
1511 | entry->parent_ip = parent_ip; | 1513 | entry->parent_ip = parent_ip; |
1512 | 1514 | ||
1513 | trace_nowake_buffer_unlock_commit(event, flags, pc); | 1515 | trace_nowake_buffer_unlock_commit(buffer, event, flags, pc); |
1514 | 1516 | ||
1515 | out: | 1517 | out: |
1516 | atomic_dec(&per_cpu(test_event_disable, cpu)); | 1518 | atomic_dec(&per_cpu(test_event_disable, cpu)); |
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 9f03082c81d8..93660fbbf629 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c | |||
@@ -309,7 +309,7 @@ void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s) | |||
309 | struct event_filter *filter = call->filter; | 309 | struct event_filter *filter = call->filter; |
310 | 310 | ||
311 | mutex_lock(&event_mutex); | 311 | mutex_lock(&event_mutex); |
312 | if (filter->filter_string) | 312 | if (filter && filter->filter_string) |
313 | trace_seq_printf(s, "%s\n", filter->filter_string); | 313 | trace_seq_printf(s, "%s\n", filter->filter_string); |
314 | else | 314 | else |
315 | trace_seq_printf(s, "none\n"); | 315 | trace_seq_printf(s, "none\n"); |
@@ -322,7 +322,7 @@ void print_subsystem_event_filter(struct event_subsystem *system, | |||
322 | struct event_filter *filter = system->filter; | 322 | struct event_filter *filter = system->filter; |
323 | 323 | ||
324 | mutex_lock(&event_mutex); | 324 | mutex_lock(&event_mutex); |
325 | if (filter->filter_string) | 325 | if (filter && filter->filter_string) |
326 | trace_seq_printf(s, "%s\n", filter->filter_string); | 326 | trace_seq_printf(s, "%s\n", filter->filter_string); |
327 | else | 327 | else |
328 | trace_seq_printf(s, "none\n"); | 328 | trace_seq_printf(s, "none\n"); |
@@ -390,6 +390,9 @@ void destroy_preds(struct ftrace_event_call *call) | |||
390 | struct event_filter *filter = call->filter; | 390 | struct event_filter *filter = call->filter; |
391 | int i; | 391 | int i; |
392 | 392 | ||
393 | if (!filter) | ||
394 | return; | ||
395 | |||
393 | for (i = 0; i < MAX_FILTER_PRED; i++) { | 396 | for (i = 0; i < MAX_FILTER_PRED; i++) { |
394 | if (filter->preds[i]) | 397 | if (filter->preds[i]) |
395 | filter_free_pred(filter->preds[i]); | 398 | filter_free_pred(filter->preds[i]); |
@@ -400,17 +403,19 @@ void destroy_preds(struct ftrace_event_call *call) | |||
400 | call->filter = NULL; | 403 | call->filter = NULL; |
401 | } | 404 | } |
402 | 405 | ||
403 | int init_preds(struct ftrace_event_call *call) | 406 | static int init_preds(struct ftrace_event_call *call) |
404 | { | 407 | { |
405 | struct event_filter *filter; | 408 | struct event_filter *filter; |
406 | struct filter_pred *pred; | 409 | struct filter_pred *pred; |
407 | int i; | 410 | int i; |
408 | 411 | ||
412 | if (call->filter) | ||
413 | return 0; | ||
414 | |||
409 | filter = call->filter = kzalloc(sizeof(*filter), GFP_KERNEL); | 415 | filter = call->filter = kzalloc(sizeof(*filter), GFP_KERNEL); |
410 | if (!call->filter) | 416 | if (!call->filter) |
411 | return -ENOMEM; | 417 | return -ENOMEM; |
412 | 418 | ||
413 | call->filter_active = 0; | ||
414 | filter->n_preds = 0; | 419 | filter->n_preds = 0; |
415 | 420 | ||
416 | filter->preds = kzalloc(MAX_FILTER_PRED * sizeof(pred), GFP_KERNEL); | 421 | filter->preds = kzalloc(MAX_FILTER_PRED * sizeof(pred), GFP_KERNEL); |
@@ -432,7 +437,26 @@ oom: | |||
432 | 437 | ||
433 | return -ENOMEM; | 438 | return -ENOMEM; |
434 | } | 439 | } |
435 | EXPORT_SYMBOL_GPL(init_preds); | 440 | |
441 | static int init_subsystem_preds(struct event_subsystem *system) | ||
442 | { | ||
443 | struct ftrace_event_call *call; | ||
444 | int err; | ||
445 | |||
446 | list_for_each_entry(call, &ftrace_events, list) { | ||
447 | if (!call->define_fields) | ||
448 | continue; | ||
449 | |||
450 | if (strcmp(call->system, system->name) != 0) | ||
451 | continue; | ||
452 | |||
453 | err = init_preds(call); | ||
454 | if (err) | ||
455 | return err; | ||
456 | } | ||
457 | |||
458 | return 0; | ||
459 | } | ||
436 | 460 | ||
437 | enum { | 461 | enum { |
438 | FILTER_DISABLE_ALL, | 462 | FILTER_DISABLE_ALL, |
@@ -449,6 +473,9 @@ static void filter_free_subsystem_preds(struct event_subsystem *system, | |||
449 | if (!call->define_fields) | 473 | if (!call->define_fields) |
450 | continue; | 474 | continue; |
451 | 475 | ||
476 | if (strcmp(call->system, system->name) != 0) | ||
477 | continue; | ||
478 | |||
452 | if (flag == FILTER_INIT_NO_RESET) { | 479 | if (flag == FILTER_INIT_NO_RESET) { |
453 | call->filter->no_reset = false; | 480 | call->filter->no_reset = false; |
454 | continue; | 481 | continue; |
@@ -457,10 +484,8 @@ static void filter_free_subsystem_preds(struct event_subsystem *system, | |||
457 | if (flag == FILTER_SKIP_NO_RESET && call->filter->no_reset) | 484 | if (flag == FILTER_SKIP_NO_RESET && call->filter->no_reset) |
458 | continue; | 485 | continue; |
459 | 486 | ||
460 | if (!strcmp(call->system, system->name)) { | 487 | filter_disable_preds(call); |
461 | filter_disable_preds(call); | 488 | remove_filter_string(call->filter); |
462 | remove_filter_string(call->filter); | ||
463 | } | ||
464 | } | 489 | } |
465 | } | 490 | } |
466 | 491 | ||
@@ -1094,6 +1119,10 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string) | |||
1094 | 1119 | ||
1095 | mutex_lock(&event_mutex); | 1120 | mutex_lock(&event_mutex); |
1096 | 1121 | ||
1122 | err = init_preds(call); | ||
1123 | if (err) | ||
1124 | goto out_unlock; | ||
1125 | |||
1097 | if (!strcmp(strstrip(filter_string), "0")) { | 1126 | if (!strcmp(strstrip(filter_string), "0")) { |
1098 | filter_disable_preds(call); | 1127 | filter_disable_preds(call); |
1099 | remove_filter_string(call->filter); | 1128 | remove_filter_string(call->filter); |
@@ -1139,6 +1168,10 @@ int apply_subsystem_event_filter(struct event_subsystem *system, | |||
1139 | 1168 | ||
1140 | mutex_lock(&event_mutex); | 1169 | mutex_lock(&event_mutex); |
1141 | 1170 | ||
1171 | err = init_subsystem_preds(system); | ||
1172 | if (err) | ||
1173 | goto out_unlock; | ||
1174 | |||
1142 | if (!strcmp(strstrip(filter_string), "0")) { | 1175 | if (!strcmp(strstrip(filter_string), "0")) { |
1143 | filter_free_subsystem_preds(system, FILTER_DISABLE_ALL); | 1176 | filter_free_subsystem_preds(system, FILTER_DISABLE_ALL); |
1144 | remove_filter_string(system->filter); | 1177 | remove_filter_string(system->filter); |
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index f75faeccf68e..a79ef6f193c0 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
@@ -120,7 +120,7 @@ ftrace_format_##call(struct ftrace_event_call *unused, \ | |||
120 | static int ftrace_raw_init_event(struct ftrace_event_call *event_call) | 120 | static int ftrace_raw_init_event(struct ftrace_event_call *event_call) |
121 | { | 121 | { |
122 | INIT_LIST_HEAD(&event_call->fields); | 122 | INIT_LIST_HEAD(&event_call->fields); |
123 | init_preds(event_call); | 123 | |
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
126 | 126 | ||
@@ -137,7 +137,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
137 | .raw_init = ftrace_raw_init_event, \ | 137 | .raw_init = ftrace_raw_init_event, \ |
138 | .show_format = ftrace_format_##call, \ | 138 | .show_format = ftrace_format_##call, \ |
139 | .define_fields = ftrace_define_fields_##call, \ | 139 | .define_fields = ftrace_define_fields_##call, \ |
140 | }; | 140 | }; \ |
141 | 141 | ||
142 | #undef TRACE_EVENT_FORMAT_NOFILTER | 142 | #undef TRACE_EVENT_FORMAT_NOFILTER |
143 | #define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct, \ | 143 | #define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct, \ |
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 3f4a251b7d16..b3749a2c3132 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
@@ -173,19 +173,20 @@ static int __trace_graph_entry(struct trace_array *tr, | |||
173 | { | 173 | { |
174 | struct ftrace_event_call *call = &event_funcgraph_entry; | 174 | struct ftrace_event_call *call = &event_funcgraph_entry; |
175 | struct ring_buffer_event *event; | 175 | struct ring_buffer_event *event; |
176 | struct ring_buffer *buffer = tr->buffer; | ||
176 | struct ftrace_graph_ent_entry *entry; | 177 | struct ftrace_graph_ent_entry *entry; |
177 | 178 | ||
178 | if (unlikely(local_read(&__get_cpu_var(ftrace_cpu_disabled)))) | 179 | if (unlikely(local_read(&__get_cpu_var(ftrace_cpu_disabled)))) |
179 | return 0; | 180 | return 0; |
180 | 181 | ||
181 | event = trace_buffer_lock_reserve(tr, TRACE_GRAPH_ENT, | 182 | event = trace_buffer_lock_reserve(buffer, TRACE_GRAPH_ENT, |
182 | sizeof(*entry), flags, pc); | 183 | sizeof(*entry), flags, pc); |
183 | if (!event) | 184 | if (!event) |
184 | return 0; | 185 | return 0; |
185 | entry = ring_buffer_event_data(event); | 186 | entry = ring_buffer_event_data(event); |
186 | entry->graph_ent = *trace; | 187 | entry->graph_ent = *trace; |
187 | if (!filter_current_check_discard(call, entry, event)) | 188 | if (!filter_current_check_discard(buffer, call, entry, event)) |
188 | ring_buffer_unlock_commit(tr->buffer, event); | 189 | ring_buffer_unlock_commit(buffer, event); |
189 | 190 | ||
190 | return 1; | 191 | return 1; |
191 | } | 192 | } |
@@ -236,19 +237,20 @@ static void __trace_graph_return(struct trace_array *tr, | |||
236 | { | 237 | { |
237 | struct ftrace_event_call *call = &event_funcgraph_exit; | 238 | struct ftrace_event_call *call = &event_funcgraph_exit; |
238 | struct ring_buffer_event *event; | 239 | struct ring_buffer_event *event; |
240 | struct ring_buffer *buffer = tr->buffer; | ||
239 | struct ftrace_graph_ret_entry *entry; | 241 | struct ftrace_graph_ret_entry *entry; |
240 | 242 | ||
241 | if (unlikely(local_read(&__get_cpu_var(ftrace_cpu_disabled)))) | 243 | if (unlikely(local_read(&__get_cpu_var(ftrace_cpu_disabled)))) |
242 | return; | 244 | return; |
243 | 245 | ||
244 | event = trace_buffer_lock_reserve(tr, TRACE_GRAPH_RET, | 246 | event = trace_buffer_lock_reserve(buffer, TRACE_GRAPH_RET, |
245 | sizeof(*entry), flags, pc); | 247 | sizeof(*entry), flags, pc); |
246 | if (!event) | 248 | if (!event) |
247 | return; | 249 | return; |
248 | entry = ring_buffer_event_data(event); | 250 | entry = ring_buffer_event_data(event); |
249 | entry->ret = *trace; | 251 | entry->ret = *trace; |
250 | if (!filter_current_check_discard(call, entry, event)) | 252 | if (!filter_current_check_discard(buffer, call, entry, event)) |
251 | ring_buffer_unlock_commit(tr->buffer, event); | 253 | ring_buffer_unlock_commit(buffer, event); |
252 | } | 254 | } |
253 | 255 | ||
254 | void trace_graph_return(struct ftrace_graph_ret *trace) | 256 | void trace_graph_return(struct ftrace_graph_ret *trace) |
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index b923d13e2fad..5555b75a0d12 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c | |||
@@ -178,7 +178,6 @@ out_unlock: | |||
178 | out: | 178 | out: |
179 | data->critical_sequence = max_sequence; | 179 | data->critical_sequence = max_sequence; |
180 | data->preempt_timestamp = ftrace_now(cpu); | 180 | data->preempt_timestamp = ftrace_now(cpu); |
181 | tracing_reset(tr, cpu); | ||
182 | trace_function(tr, CALLER_ADDR0, parent_ip, flags, pc); | 181 | trace_function(tr, CALLER_ADDR0, parent_ip, flags, pc); |
183 | } | 182 | } |
184 | 183 | ||
@@ -208,7 +207,6 @@ start_critical_timing(unsigned long ip, unsigned long parent_ip) | |||
208 | data->critical_sequence = max_sequence; | 207 | data->critical_sequence = max_sequence; |
209 | data->preempt_timestamp = ftrace_now(cpu); | 208 | data->preempt_timestamp = ftrace_now(cpu); |
210 | data->critical_start = parent_ip ? : ip; | 209 | data->critical_start = parent_ip ? : ip; |
211 | tracing_reset(tr, cpu); | ||
212 | 210 | ||
213 | local_save_flags(flags); | 211 | local_save_flags(flags); |
214 | 212 | ||
@@ -379,6 +377,7 @@ static void __irqsoff_tracer_init(struct trace_array *tr) | |||
379 | irqsoff_trace = tr; | 377 | irqsoff_trace = tr; |
380 | /* make sure that the tracer is visible */ | 378 | /* make sure that the tracer is visible */ |
381 | smp_wmb(); | 379 | smp_wmb(); |
380 | tracing_reset_online_cpus(tr); | ||
382 | start_irqsoff_tracer(tr); | 381 | start_irqsoff_tracer(tr); |
383 | } | 382 | } |
384 | 383 | ||
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index f4ec3fc87b2d..19a6de63b44b 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c | |||
@@ -819,6 +819,7 @@ static __kprobes int kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs) | |||
819 | struct trace_probe *tp = container_of(kp, struct trace_probe, kp); | 819 | struct trace_probe *tp = container_of(kp, struct trace_probe, kp); |
820 | struct kprobe_trace_entry *entry; | 820 | struct kprobe_trace_entry *entry; |
821 | struct ring_buffer_event *event; | 821 | struct ring_buffer_event *event; |
822 | struct ring_buffer *buffer; | ||
822 | int size, i, pc; | 823 | int size, i, pc; |
823 | unsigned long irq_flags; | 824 | unsigned long irq_flags; |
824 | struct ftrace_event_call *call = &tp->call; | 825 | struct ftrace_event_call *call = &tp->call; |
@@ -830,7 +831,7 @@ static __kprobes int kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs) | |||
830 | 831 | ||
831 | size = SIZEOF_KPROBE_TRACE_ENTRY(tp->nr_args); | 832 | size = SIZEOF_KPROBE_TRACE_ENTRY(tp->nr_args); |
832 | 833 | ||
833 | event = trace_current_buffer_lock_reserve(call->id, size, | 834 | event = trace_current_buffer_lock_reserve(&buffer, call->id, size, |
834 | irq_flags, pc); | 835 | irq_flags, pc); |
835 | if (!event) | 836 | if (!event) |
836 | return 0; | 837 | return 0; |
@@ -841,8 +842,8 @@ static __kprobes int kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs) | |||
841 | for (i = 0; i < tp->nr_args; i++) | 842 | for (i = 0; i < tp->nr_args; i++) |
842 | entry->args[i] = call_fetch(&tp->args[i], regs); | 843 | entry->args[i] = call_fetch(&tp->args[i], regs); |
843 | 844 | ||
844 | if (!filter_current_check_discard(call, entry, event)) | 845 | if (!filter_current_check_discard(buffer, call, entry, event)) |
845 | trace_nowake_buffer_unlock_commit(event, irq_flags, pc); | 846 | trace_nowake_buffer_unlock_commit(buffer, event, irq_flags, pc); |
846 | return 0; | 847 | return 0; |
847 | } | 848 | } |
848 | 849 | ||
@@ -853,6 +854,7 @@ static __kprobes int kretprobe_trace_func(struct kretprobe_instance *ri, | |||
853 | struct trace_probe *tp = container_of(ri->rp, struct trace_probe, rp); | 854 | struct trace_probe *tp = container_of(ri->rp, struct trace_probe, rp); |
854 | struct kretprobe_trace_entry *entry; | 855 | struct kretprobe_trace_entry *entry; |
855 | struct ring_buffer_event *event; | 856 | struct ring_buffer_event *event; |
857 | struct ring_buffer *buffer; | ||
856 | int size, i, pc; | 858 | int size, i, pc; |
857 | unsigned long irq_flags; | 859 | unsigned long irq_flags; |
858 | struct ftrace_event_call *call = &tp->call; | 860 | struct ftrace_event_call *call = &tp->call; |
@@ -862,7 +864,7 @@ static __kprobes int kretprobe_trace_func(struct kretprobe_instance *ri, | |||
862 | 864 | ||
863 | size = SIZEOF_KRETPROBE_TRACE_ENTRY(tp->nr_args); | 865 | size = SIZEOF_KRETPROBE_TRACE_ENTRY(tp->nr_args); |
864 | 866 | ||
865 | event = trace_current_buffer_lock_reserve(call->id, size, | 867 | event = trace_current_buffer_lock_reserve(&buffer, call->id, size, |
866 | irq_flags, pc); | 868 | irq_flags, pc); |
867 | if (!event) | 869 | if (!event) |
868 | return 0; | 870 | return 0; |
@@ -874,8 +876,8 @@ static __kprobes int kretprobe_trace_func(struct kretprobe_instance *ri, | |||
874 | for (i = 0; i < tp->nr_args; i++) | 876 | for (i = 0; i < tp->nr_args; i++) |
875 | entry->args[i] = call_fetch(&tp->args[i], regs); | 877 | entry->args[i] = call_fetch(&tp->args[i], regs); |
876 | 878 | ||
877 | if (!filter_current_check_discard(call, entry, event)) | 879 | if (!filter_current_check_discard(buffer, call, entry, event)) |
878 | trace_nowake_buffer_unlock_commit(event, irq_flags, pc); | 880 | trace_nowake_buffer_unlock_commit(buffer, event, irq_flags, pc); |
879 | 881 | ||
880 | return 0; | 882 | return 0; |
881 | } | 883 | } |
@@ -964,7 +966,7 @@ static void probe_event_disable(struct ftrace_event_call *call) | |||
964 | static int probe_event_raw_init(struct ftrace_event_call *event_call) | 966 | static int probe_event_raw_init(struct ftrace_event_call *event_call) |
965 | { | 967 | { |
966 | INIT_LIST_HEAD(&event_call->fields); | 968 | INIT_LIST_HEAD(&event_call->fields); |
967 | init_preds(event_call); | 969 | |
968 | return 0; | 970 | return 0; |
969 | } | 971 | } |
970 | 972 | ||
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c index d53b45ed0806..c4c9bbda53d3 100644 --- a/kernel/trace/trace_mmiotrace.c +++ b/kernel/trace/trace_mmiotrace.c | |||
@@ -307,11 +307,12 @@ static void __trace_mmiotrace_rw(struct trace_array *tr, | |||
307 | struct trace_array_cpu *data, | 307 | struct trace_array_cpu *data, |
308 | struct mmiotrace_rw *rw) | 308 | struct mmiotrace_rw *rw) |
309 | { | 309 | { |
310 | struct ring_buffer *buffer = tr->buffer; | ||
310 | struct ring_buffer_event *event; | 311 | struct ring_buffer_event *event; |
311 | struct trace_mmiotrace_rw *entry; | 312 | struct trace_mmiotrace_rw *entry; |
312 | int pc = preempt_count(); | 313 | int pc = preempt_count(); |
313 | 314 | ||
314 | event = trace_buffer_lock_reserve(tr, TRACE_MMIO_RW, | 315 | event = trace_buffer_lock_reserve(buffer, TRACE_MMIO_RW, |
315 | sizeof(*entry), 0, pc); | 316 | sizeof(*entry), 0, pc); |
316 | if (!event) { | 317 | if (!event) { |
317 | atomic_inc(&dropped_count); | 318 | atomic_inc(&dropped_count); |
@@ -319,7 +320,7 @@ static void __trace_mmiotrace_rw(struct trace_array *tr, | |||
319 | } | 320 | } |
320 | entry = ring_buffer_event_data(event); | 321 | entry = ring_buffer_event_data(event); |
321 | entry->rw = *rw; | 322 | entry->rw = *rw; |
322 | trace_buffer_unlock_commit(tr, event, 0, pc); | 323 | trace_buffer_unlock_commit(buffer, event, 0, pc); |
323 | } | 324 | } |
324 | 325 | ||
325 | void mmio_trace_rw(struct mmiotrace_rw *rw) | 326 | void mmio_trace_rw(struct mmiotrace_rw *rw) |
@@ -333,11 +334,12 @@ static void __trace_mmiotrace_map(struct trace_array *tr, | |||
333 | struct trace_array_cpu *data, | 334 | struct trace_array_cpu *data, |
334 | struct mmiotrace_map *map) | 335 | struct mmiotrace_map *map) |
335 | { | 336 | { |
337 | struct ring_buffer *buffer = tr->buffer; | ||
336 | struct ring_buffer_event *event; | 338 | struct ring_buffer_event *event; |
337 | struct trace_mmiotrace_map *entry; | 339 | struct trace_mmiotrace_map *entry; |
338 | int pc = preempt_count(); | 340 | int pc = preempt_count(); |
339 | 341 | ||
340 | event = trace_buffer_lock_reserve(tr, TRACE_MMIO_MAP, | 342 | event = trace_buffer_lock_reserve(buffer, TRACE_MMIO_MAP, |
341 | sizeof(*entry), 0, pc); | 343 | sizeof(*entry), 0, pc); |
342 | if (!event) { | 344 | if (!event) { |
343 | atomic_inc(&dropped_count); | 345 | atomic_inc(&dropped_count); |
@@ -345,7 +347,7 @@ static void __trace_mmiotrace_map(struct trace_array *tr, | |||
345 | } | 347 | } |
346 | entry = ring_buffer_event_data(event); | 348 | entry = ring_buffer_event_data(event); |
347 | entry->map = *map; | 349 | entry->map = *map; |
348 | trace_buffer_unlock_commit(tr, event, 0, pc); | 350 | trace_buffer_unlock_commit(buffer, event, 0, pc); |
349 | } | 351 | } |
350 | 352 | ||
351 | void mmio_trace_mapping(struct mmiotrace_map *map) | 353 | void mmio_trace_mapping(struct mmiotrace_map *map) |
diff --git a/kernel/trace/trace_power.c b/kernel/trace/trace_power.c index 8a30d9874cd4..fe1a00f1445a 100644 --- a/kernel/trace/trace_power.c +++ b/kernel/trace/trace_power.c | |||
@@ -38,6 +38,7 @@ static void probe_power_end(struct power_trace *it) | |||
38 | { | 38 | { |
39 | struct ftrace_event_call *call = &event_power; | 39 | struct ftrace_event_call *call = &event_power; |
40 | struct ring_buffer_event *event; | 40 | struct ring_buffer_event *event; |
41 | struct ring_buffer *buffer; | ||
41 | struct trace_power *entry; | 42 | struct trace_power *entry; |
42 | struct trace_array_cpu *data; | 43 | struct trace_array_cpu *data; |
43 | struct trace_array *tr = power_trace; | 44 | struct trace_array *tr = power_trace; |
@@ -45,18 +46,20 @@ static void probe_power_end(struct power_trace *it) | |||
45 | if (!trace_power_enabled) | 46 | if (!trace_power_enabled) |
46 | return; | 47 | return; |
47 | 48 | ||
49 | buffer = tr->buffer; | ||
50 | |||
48 | preempt_disable(); | 51 | preempt_disable(); |
49 | it->end = ktime_get(); | 52 | it->end = ktime_get(); |
50 | data = tr->data[smp_processor_id()]; | 53 | data = tr->data[smp_processor_id()]; |
51 | 54 | ||
52 | event = trace_buffer_lock_reserve(tr, TRACE_POWER, | 55 | event = trace_buffer_lock_reserve(buffer, TRACE_POWER, |
53 | sizeof(*entry), 0, 0); | 56 | sizeof(*entry), 0, 0); |
54 | if (!event) | 57 | if (!event) |
55 | goto out; | 58 | goto out; |
56 | entry = ring_buffer_event_data(event); | 59 | entry = ring_buffer_event_data(event); |
57 | entry->state_data = *it; | 60 | entry->state_data = *it; |
58 | if (!filter_check_discard(call, entry, tr->buffer, event)) | 61 | if (!filter_check_discard(call, entry, buffer, event)) |
59 | trace_buffer_unlock_commit(tr, event, 0, 0); | 62 | trace_buffer_unlock_commit(buffer, event, 0, 0); |
60 | out: | 63 | out: |
61 | preempt_enable(); | 64 | preempt_enable(); |
62 | } | 65 | } |
@@ -66,6 +69,7 @@ static void probe_power_mark(struct power_trace *it, unsigned int type, | |||
66 | { | 69 | { |
67 | struct ftrace_event_call *call = &event_power; | 70 | struct ftrace_event_call *call = &event_power; |
68 | struct ring_buffer_event *event; | 71 | struct ring_buffer_event *event; |
72 | struct ring_buffer *buffer; | ||
69 | struct trace_power *entry; | 73 | struct trace_power *entry; |
70 | struct trace_array_cpu *data; | 74 | struct trace_array_cpu *data; |
71 | struct trace_array *tr = power_trace; | 75 | struct trace_array *tr = power_trace; |
@@ -73,6 +77,8 @@ static void probe_power_mark(struct power_trace *it, unsigned int type, | |||
73 | if (!trace_power_enabled) | 77 | if (!trace_power_enabled) |
74 | return; | 78 | return; |
75 | 79 | ||
80 | buffer = tr->buffer; | ||
81 | |||
76 | memset(it, 0, sizeof(struct power_trace)); | 82 | memset(it, 0, sizeof(struct power_trace)); |
77 | it->state = level; | 83 | it->state = level; |
78 | it->type = type; | 84 | it->type = type; |
@@ -81,14 +87,14 @@ static void probe_power_mark(struct power_trace *it, unsigned int type, | |||
81 | it->end = it->stamp; | 87 | it->end = it->stamp; |
82 | data = tr->data[smp_processor_id()]; | 88 | data = tr->data[smp_processor_id()]; |
83 | 89 | ||
84 | event = trace_buffer_lock_reserve(tr, TRACE_POWER, | 90 | event = trace_buffer_lock_reserve(buffer, TRACE_POWER, |
85 | sizeof(*entry), 0, 0); | 91 | sizeof(*entry), 0, 0); |
86 | if (!event) | 92 | if (!event) |
87 | goto out; | 93 | goto out; |
88 | entry = ring_buffer_event_data(event); | 94 | entry = ring_buffer_event_data(event); |
89 | entry->state_data = *it; | 95 | entry->state_data = *it; |
90 | if (!filter_check_discard(call, entry, tr->buffer, event)) | 96 | if (!filter_check_discard(call, entry, buffer, event)) |
91 | trace_buffer_unlock_commit(tr, event, 0, 0); | 97 | trace_buffer_unlock_commit(buffer, event, 0, 0); |
92 | out: | 98 | out: |
93 | preempt_enable(); | 99 | preempt_enable(); |
94 | } | 100 | } |
@@ -144,14 +150,12 @@ static void power_trace_reset(struct trace_array *tr) | |||
144 | 150 | ||
145 | static int power_trace_init(struct trace_array *tr) | 151 | static int power_trace_init(struct trace_array *tr) |
146 | { | 152 | { |
147 | int cpu; | ||
148 | power_trace = tr; | 153 | power_trace = tr; |
149 | 154 | ||
150 | trace_power_enabled = 1; | 155 | trace_power_enabled = 1; |
151 | tracing_power_register(); | 156 | tracing_power_register(); |
152 | 157 | ||
153 | for_each_cpu(cpu, cpu_possible_mask) | 158 | tracing_reset_online_cpus(tr); |
154 | tracing_reset(tr, cpu); | ||
155 | return 0; | 159 | return 0; |
156 | } | 160 | } |
157 | 161 | ||
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index e1285d7b5488..5fca0f51fde4 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c | |||
@@ -28,10 +28,11 @@ tracing_sched_switch_trace(struct trace_array *tr, | |||
28 | unsigned long flags, int pc) | 28 | unsigned long flags, int pc) |
29 | { | 29 | { |
30 | struct ftrace_event_call *call = &event_context_switch; | 30 | struct ftrace_event_call *call = &event_context_switch; |
31 | struct ring_buffer *buffer = tr->buffer; | ||
31 | struct ring_buffer_event *event; | 32 | struct ring_buffer_event *event; |
32 | struct ctx_switch_entry *entry; | 33 | struct ctx_switch_entry *entry; |
33 | 34 | ||
34 | event = trace_buffer_lock_reserve(tr, TRACE_CTX, | 35 | event = trace_buffer_lock_reserve(buffer, TRACE_CTX, |
35 | sizeof(*entry), flags, pc); | 36 | sizeof(*entry), flags, pc); |
36 | if (!event) | 37 | if (!event) |
37 | return; | 38 | return; |
@@ -44,8 +45,8 @@ tracing_sched_switch_trace(struct trace_array *tr, | |||
44 | entry->next_state = next->state; | 45 | entry->next_state = next->state; |
45 | entry->next_cpu = task_cpu(next); | 46 | entry->next_cpu = task_cpu(next); |
46 | 47 | ||
47 | if (!filter_check_discard(call, entry, tr->buffer, event)) | 48 | if (!filter_check_discard(call, entry, buffer, event)) |
48 | trace_buffer_unlock_commit(tr, event, flags, pc); | 49 | trace_buffer_unlock_commit(buffer, event, flags, pc); |
49 | } | 50 | } |
50 | 51 | ||
51 | static void | 52 | static void |
@@ -86,8 +87,9 @@ tracing_sched_wakeup_trace(struct trace_array *tr, | |||
86 | struct ftrace_event_call *call = &event_wakeup; | 87 | struct ftrace_event_call *call = &event_wakeup; |
87 | struct ring_buffer_event *event; | 88 | struct ring_buffer_event *event; |
88 | struct ctx_switch_entry *entry; | 89 | struct ctx_switch_entry *entry; |
90 | struct ring_buffer *buffer = tr->buffer; | ||
89 | 91 | ||
90 | event = trace_buffer_lock_reserve(tr, TRACE_WAKE, | 92 | event = trace_buffer_lock_reserve(buffer, TRACE_WAKE, |
91 | sizeof(*entry), flags, pc); | 93 | sizeof(*entry), flags, pc); |
92 | if (!event) | 94 | if (!event) |
93 | return; | 95 | return; |
@@ -100,10 +102,10 @@ tracing_sched_wakeup_trace(struct trace_array *tr, | |||
100 | entry->next_state = wakee->state; | 102 | entry->next_state = wakee->state; |
101 | entry->next_cpu = task_cpu(wakee); | 103 | entry->next_cpu = task_cpu(wakee); |
102 | 104 | ||
103 | if (!filter_check_discard(call, entry, tr->buffer, event)) | 105 | if (!filter_check_discard(call, entry, buffer, event)) |
104 | ring_buffer_unlock_commit(tr->buffer, event); | 106 | ring_buffer_unlock_commit(buffer, event); |
105 | ftrace_trace_stack(tr, flags, 6, pc); | 107 | ftrace_trace_stack(tr->buffer, flags, 6, pc); |
106 | ftrace_trace_userstack(tr, flags, pc); | 108 | ftrace_trace_userstack(tr->buffer, flags, pc); |
107 | } | 109 | } |
108 | 110 | ||
109 | static void | 111 | static void |
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index eacb27225173..ad69f105a7c6 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c | |||
@@ -186,11 +186,6 @@ out: | |||
186 | 186 | ||
187 | static void __wakeup_reset(struct trace_array *tr) | 187 | static void __wakeup_reset(struct trace_array *tr) |
188 | { | 188 | { |
189 | int cpu; | ||
190 | |||
191 | for_each_possible_cpu(cpu) | ||
192 | tracing_reset(tr, cpu); | ||
193 | |||
194 | wakeup_cpu = -1; | 189 | wakeup_cpu = -1; |
195 | wakeup_prio = -1; | 190 | wakeup_prio = -1; |
196 | 191 | ||
@@ -204,6 +199,8 @@ static void wakeup_reset(struct trace_array *tr) | |||
204 | { | 199 | { |
205 | unsigned long flags; | 200 | unsigned long flags; |
206 | 201 | ||
202 | tracing_reset_online_cpus(tr); | ||
203 | |||
207 | local_irq_save(flags); | 204 | local_irq_save(flags); |
208 | __raw_spin_lock(&wakeup_lock); | 205 | __raw_spin_lock(&wakeup_lock); |
209 | __wakeup_reset(tr); | 206 | __wakeup_reset(tr); |
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index e7c676e50a7f..dfc55fed2099 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -11,8 +11,8 @@ | |||
11 | static DEFINE_MUTEX(syscall_trace_lock); | 11 | static DEFINE_MUTEX(syscall_trace_lock); |
12 | static int sys_refcount_enter; | 12 | static int sys_refcount_enter; |
13 | static int sys_refcount_exit; | 13 | static int sys_refcount_exit; |
14 | static DECLARE_BITMAP(enabled_enter_syscalls, FTRACE_SYSCALL_MAX); | 14 | static DECLARE_BITMAP(enabled_enter_syscalls, NR_syscalls); |
15 | static DECLARE_BITMAP(enabled_exit_syscalls, FTRACE_SYSCALL_MAX); | 15 | static DECLARE_BITMAP(enabled_exit_syscalls, NR_syscalls); |
16 | 16 | ||
17 | enum print_line_t | 17 | enum print_line_t |
18 | print_syscall_enter(struct trace_iterator *iter, int flags) | 18 | print_syscall_enter(struct trace_iterator *iter, int flags) |
@@ -223,10 +223,13 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id) | |||
223 | struct syscall_trace_enter *entry; | 223 | struct syscall_trace_enter *entry; |
224 | struct syscall_metadata *sys_data; | 224 | struct syscall_metadata *sys_data; |
225 | struct ring_buffer_event *event; | 225 | struct ring_buffer_event *event; |
226 | struct ring_buffer *buffer; | ||
226 | int size; | 227 | int size; |
227 | int syscall_nr; | 228 | int syscall_nr; |
228 | 229 | ||
229 | syscall_nr = syscall_get_nr(current, regs); | 230 | syscall_nr = syscall_get_nr(current, regs); |
231 | if (syscall_nr < 0) | ||
232 | return; | ||
230 | if (!test_bit(syscall_nr, enabled_enter_syscalls)) | 233 | if (!test_bit(syscall_nr, enabled_enter_syscalls)) |
231 | return; | 234 | return; |
232 | 235 | ||
@@ -236,8 +239,8 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id) | |||
236 | 239 | ||
237 | size = sizeof(*entry) + sizeof(unsigned long) * sys_data->nb_args; | 240 | size = sizeof(*entry) + sizeof(unsigned long) * sys_data->nb_args; |
238 | 241 | ||
239 | event = trace_current_buffer_lock_reserve(sys_data->enter_id, size, | 242 | event = trace_current_buffer_lock_reserve(&buffer, sys_data->enter_id, |
240 | 0, 0); | 243 | size, 0, 0); |
241 | if (!event) | 244 | if (!event) |
242 | return; | 245 | return; |
243 | 246 | ||
@@ -245,8 +248,9 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id) | |||
245 | entry->nr = syscall_nr; | 248 | entry->nr = syscall_nr; |
246 | syscall_get_arguments(current, regs, 0, sys_data->nb_args, entry->args); | 249 | syscall_get_arguments(current, regs, 0, sys_data->nb_args, entry->args); |
247 | 250 | ||
248 | if (!filter_current_check_discard(sys_data->enter_event, entry, event)) | 251 | if (!filter_current_check_discard(buffer, sys_data->enter_event, |
249 | trace_current_buffer_unlock_commit(event, 0, 0); | 252 | entry, event)) |
253 | trace_current_buffer_unlock_commit(buffer, event, 0, 0); | ||
250 | } | 254 | } |
251 | 255 | ||
252 | void ftrace_syscall_exit(struct pt_regs *regs, long ret) | 256 | void ftrace_syscall_exit(struct pt_regs *regs, long ret) |
@@ -254,9 +258,12 @@ void ftrace_syscall_exit(struct pt_regs *regs, long ret) | |||
254 | struct syscall_trace_exit *entry; | 258 | struct syscall_trace_exit *entry; |
255 | struct syscall_metadata *sys_data; | 259 | struct syscall_metadata *sys_data; |
256 | struct ring_buffer_event *event; | 260 | struct ring_buffer_event *event; |
261 | struct ring_buffer *buffer; | ||
257 | int syscall_nr; | 262 | int syscall_nr; |
258 | 263 | ||
259 | syscall_nr = syscall_get_nr(current, regs); | 264 | syscall_nr = syscall_get_nr(current, regs); |
265 | if (syscall_nr < 0) | ||
266 | return; | ||
260 | if (!test_bit(syscall_nr, enabled_exit_syscalls)) | 267 | if (!test_bit(syscall_nr, enabled_exit_syscalls)) |
261 | return; | 268 | return; |
262 | 269 | ||
@@ -264,7 +271,7 @@ void ftrace_syscall_exit(struct pt_regs *regs, long ret) | |||
264 | if (!sys_data) | 271 | if (!sys_data) |
265 | return; | 272 | return; |
266 | 273 | ||
267 | event = trace_current_buffer_lock_reserve(sys_data->exit_id, | 274 | event = trace_current_buffer_lock_reserve(&buffer, sys_data->exit_id, |
268 | sizeof(*entry), 0, 0); | 275 | sizeof(*entry), 0, 0); |
269 | if (!event) | 276 | if (!event) |
270 | return; | 277 | return; |
@@ -273,8 +280,9 @@ void ftrace_syscall_exit(struct pt_regs *regs, long ret) | |||
273 | entry->nr = syscall_nr; | 280 | entry->nr = syscall_nr; |
274 | entry->ret = syscall_get_return_value(current, regs); | 281 | entry->ret = syscall_get_return_value(current, regs); |
275 | 282 | ||
276 | if (!filter_current_check_discard(sys_data->exit_event, entry, event)) | 283 | if (!filter_current_check_discard(buffer, sys_data->exit_event, |
277 | trace_current_buffer_unlock_commit(event, 0, 0); | 284 | entry, event)) |
285 | trace_current_buffer_unlock_commit(buffer, event, 0, 0); | ||
278 | } | 286 | } |
279 | 287 | ||
280 | int reg_event_syscall_enter(struct ftrace_event_call *call) | 288 | int reg_event_syscall_enter(struct ftrace_event_call *call) |
@@ -285,7 +293,7 @@ int reg_event_syscall_enter(struct ftrace_event_call *call) | |||
285 | 293 | ||
286 | name = (char *)call->data; | 294 | name = (char *)call->data; |
287 | num = syscall_name_to_nr(name); | 295 | num = syscall_name_to_nr(name); |
288 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 296 | if (num < 0 || num >= NR_syscalls) |
289 | return -ENOSYS; | 297 | return -ENOSYS; |
290 | mutex_lock(&syscall_trace_lock); | 298 | mutex_lock(&syscall_trace_lock); |
291 | if (!sys_refcount_enter) | 299 | if (!sys_refcount_enter) |
@@ -308,7 +316,7 @@ void unreg_event_syscall_enter(struct ftrace_event_call *call) | |||
308 | 316 | ||
309 | name = (char *)call->data; | 317 | name = (char *)call->data; |
310 | num = syscall_name_to_nr(name); | 318 | num = syscall_name_to_nr(name); |
311 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 319 | if (num < 0 || num >= NR_syscalls) |
312 | return; | 320 | return; |
313 | mutex_lock(&syscall_trace_lock); | 321 | mutex_lock(&syscall_trace_lock); |
314 | sys_refcount_enter--; | 322 | sys_refcount_enter--; |
@@ -326,7 +334,7 @@ int reg_event_syscall_exit(struct ftrace_event_call *call) | |||
326 | 334 | ||
327 | name = call->data; | 335 | name = call->data; |
328 | num = syscall_name_to_nr(name); | 336 | num = syscall_name_to_nr(name); |
329 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 337 | if (num < 0 || num >= NR_syscalls) |
330 | return -ENOSYS; | 338 | return -ENOSYS; |
331 | mutex_lock(&syscall_trace_lock); | 339 | mutex_lock(&syscall_trace_lock); |
332 | if (!sys_refcount_exit) | 340 | if (!sys_refcount_exit) |
@@ -349,7 +357,7 @@ void unreg_event_syscall_exit(struct ftrace_event_call *call) | |||
349 | 357 | ||
350 | name = call->data; | 358 | name = call->data; |
351 | num = syscall_name_to_nr(name); | 359 | num = syscall_name_to_nr(name); |
352 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 360 | if (num < 0 || num >= NR_syscalls) |
353 | return; | 361 | return; |
354 | mutex_lock(&syscall_trace_lock); | 362 | mutex_lock(&syscall_trace_lock); |
355 | sys_refcount_exit--; | 363 | sys_refcount_exit--; |
@@ -369,8 +377,8 @@ struct trace_event event_syscall_exit = { | |||
369 | 377 | ||
370 | #ifdef CONFIG_EVENT_PROFILE | 378 | #ifdef CONFIG_EVENT_PROFILE |
371 | 379 | ||
372 | static DECLARE_BITMAP(enabled_prof_enter_syscalls, FTRACE_SYSCALL_MAX); | 380 | static DECLARE_BITMAP(enabled_prof_enter_syscalls, NR_syscalls); |
373 | static DECLARE_BITMAP(enabled_prof_exit_syscalls, FTRACE_SYSCALL_MAX); | 381 | static DECLARE_BITMAP(enabled_prof_exit_syscalls, NR_syscalls); |
374 | static int sys_prof_refcount_enter; | 382 | static int sys_prof_refcount_enter; |
375 | static int sys_prof_refcount_exit; | 383 | static int sys_prof_refcount_exit; |
376 | 384 | ||
@@ -416,7 +424,7 @@ int reg_prof_syscall_enter(char *name) | |||
416 | int num; | 424 | int num; |
417 | 425 | ||
418 | num = syscall_name_to_nr(name); | 426 | num = syscall_name_to_nr(name); |
419 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 427 | if (num < 0 || num >= NR_syscalls) |
420 | return -ENOSYS; | 428 | return -ENOSYS; |
421 | 429 | ||
422 | mutex_lock(&syscall_trace_lock); | 430 | mutex_lock(&syscall_trace_lock); |
@@ -438,7 +446,7 @@ void unreg_prof_syscall_enter(char *name) | |||
438 | int num; | 446 | int num; |
439 | 447 | ||
440 | num = syscall_name_to_nr(name); | 448 | num = syscall_name_to_nr(name); |
441 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 449 | if (num < 0 || num >= NR_syscalls) |
442 | return; | 450 | return; |
443 | 451 | ||
444 | mutex_lock(&syscall_trace_lock); | 452 | mutex_lock(&syscall_trace_lock); |
@@ -477,7 +485,7 @@ int reg_prof_syscall_exit(char *name) | |||
477 | int num; | 485 | int num; |
478 | 486 | ||
479 | num = syscall_name_to_nr(name); | 487 | num = syscall_name_to_nr(name); |
480 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 488 | if (num < 0 || num >= NR_syscalls) |
481 | return -ENOSYS; | 489 | return -ENOSYS; |
482 | 490 | ||
483 | mutex_lock(&syscall_trace_lock); | 491 | mutex_lock(&syscall_trace_lock); |
@@ -499,7 +507,7 @@ void unreg_prof_syscall_exit(char *name) | |||
499 | int num; | 507 | int num; |
500 | 508 | ||
501 | num = syscall_name_to_nr(name); | 509 | num = syscall_name_to_nr(name); |
502 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 510 | if (num < 0 || num >= NR_syscalls) |
503 | return; | 511 | return; |
504 | 512 | ||
505 | mutex_lock(&syscall_trace_lock); | 513 | mutex_lock(&syscall_trace_lock); |
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index 1a6a453b7efb..9489a0a9b1be 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c | |||
@@ -597,7 +597,9 @@ void syscall_regfunc(void) | |||
597 | if (!sys_tracepoint_refcount) { | 597 | if (!sys_tracepoint_refcount) { |
598 | read_lock_irqsave(&tasklist_lock, flags); | 598 | read_lock_irqsave(&tasklist_lock, flags); |
599 | do_each_thread(g, t) { | 599 | do_each_thread(g, t) { |
600 | set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); | 600 | /* Skip kernel threads. */ |
601 | if (t->mm) | ||
602 | set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); | ||
601 | } while_each_thread(g, t); | 603 | } while_each_thread(g, t); |
602 | read_unlock_irqrestore(&tasklist_lock, flags); | 604 | read_unlock_irqrestore(&tasklist_lock, flags); |
603 | } | 605 | } |
diff --git a/kernel/wait.c b/kernel/wait.c index ea7c3b4275cf..c4bd3d825f35 100644 --- a/kernel/wait.c +++ b/kernel/wait.c | |||
@@ -10,13 +10,14 @@ | |||
10 | #include <linux/wait.h> | 10 | #include <linux/wait.h> |
11 | #include <linux/hash.h> | 11 | #include <linux/hash.h> |
12 | 12 | ||
13 | void init_waitqueue_head(wait_queue_head_t *q) | 13 | void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *key) |
14 | { | 14 | { |
15 | spin_lock_init(&q->lock); | 15 | spin_lock_init(&q->lock); |
16 | lockdep_set_class(&q->lock, key); | ||
16 | INIT_LIST_HEAD(&q->task_list); | 17 | INIT_LIST_HEAD(&q->task_list); |
17 | } | 18 | } |
18 | 19 | ||
19 | EXPORT_SYMBOL(init_waitqueue_head); | 20 | EXPORT_SYMBOL(__init_waitqueue_head); |
20 | 21 | ||
21 | void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait) | 22 | void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait) |
22 | { | 23 | { |
diff --git a/lib/bitmap.c b/lib/bitmap.c index 35a1f7ff4149..702565821c99 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c | |||
@@ -179,14 +179,16 @@ void __bitmap_shift_left(unsigned long *dst, | |||
179 | } | 179 | } |
180 | EXPORT_SYMBOL(__bitmap_shift_left); | 180 | EXPORT_SYMBOL(__bitmap_shift_left); |
181 | 181 | ||
182 | void __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, | 182 | int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, |
183 | const unsigned long *bitmap2, int bits) | 183 | const unsigned long *bitmap2, int bits) |
184 | { | 184 | { |
185 | int k; | 185 | int k; |
186 | int nr = BITS_TO_LONGS(bits); | 186 | int nr = BITS_TO_LONGS(bits); |
187 | unsigned long result = 0; | ||
187 | 188 | ||
188 | for (k = 0; k < nr; k++) | 189 | for (k = 0; k < nr; k++) |
189 | dst[k] = bitmap1[k] & bitmap2[k]; | 190 | result |= (dst[k] = bitmap1[k] & bitmap2[k]); |
191 | return result != 0; | ||
190 | } | 192 | } |
191 | EXPORT_SYMBOL(__bitmap_and); | 193 | EXPORT_SYMBOL(__bitmap_and); |
192 | 194 | ||
@@ -212,14 +214,16 @@ void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, | |||
212 | } | 214 | } |
213 | EXPORT_SYMBOL(__bitmap_xor); | 215 | EXPORT_SYMBOL(__bitmap_xor); |
214 | 216 | ||
215 | void __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, | 217 | int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, |
216 | const unsigned long *bitmap2, int bits) | 218 | const unsigned long *bitmap2, int bits) |
217 | { | 219 | { |
218 | int k; | 220 | int k; |
219 | int nr = BITS_TO_LONGS(bits); | 221 | int nr = BITS_TO_LONGS(bits); |
222 | unsigned long result = 0; | ||
220 | 223 | ||
221 | for (k = 0; k < nr; k++) | 224 | for (k = 0; k < nr; k++) |
222 | dst[k] = bitmap1[k] & ~bitmap2[k]; | 225 | result |= (dst[k] = bitmap1[k] & ~bitmap2[k]); |
226 | return result != 0; | ||
223 | } | 227 | } |
224 | EXPORT_SYMBOL(__bitmap_andnot); | 228 | EXPORT_SYMBOL(__bitmap_andnot); |
225 | 229 | ||
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 65b0d99b6d0a..58a9f9fc609a 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -156,9 +156,13 @@ static bool driver_filter(struct device *dev) | |||
156 | return true; | 156 | return true; |
157 | 157 | ||
158 | /* driver filter on and initialized */ | 158 | /* driver filter on and initialized */ |
159 | if (current_driver && dev->driver == current_driver) | 159 | if (current_driver && dev && dev->driver == current_driver) |
160 | return true; | 160 | return true; |
161 | 161 | ||
162 | /* driver filter on, but we can't filter on a NULL device... */ | ||
163 | if (!dev) | ||
164 | return false; | ||
165 | |||
162 | if (current_driver || !current_driver_name[0]) | 166 | if (current_driver || !current_driver_name[0]) |
163 | return false; | 167 | return false; |
164 | 168 | ||
@@ -183,17 +187,17 @@ static bool driver_filter(struct device *dev) | |||
183 | return ret; | 187 | return ret; |
184 | } | 188 | } |
185 | 189 | ||
186 | #define err_printk(dev, entry, format, arg...) do { \ | 190 | #define err_printk(dev, entry, format, arg...) do { \ |
187 | error_count += 1; \ | 191 | error_count += 1; \ |
188 | if (driver_filter(dev) && \ | 192 | if (driver_filter(dev) && \ |
189 | (show_all_errors || show_num_errors > 0)) { \ | 193 | (show_all_errors || show_num_errors > 0)) { \ |
190 | WARN(1, "%s %s: " format, \ | 194 | WARN(1, "%s %s: " format, \ |
191 | dev_driver_string(dev), \ | 195 | dev ? dev_driver_string(dev) : "NULL", \ |
192 | dev_name(dev) , ## arg); \ | 196 | dev ? dev_name(dev) : "NULL", ## arg); \ |
193 | dump_entry_trace(entry); \ | 197 | dump_entry_trace(entry); \ |
194 | } \ | 198 | } \ |
195 | if (!show_all_errors && show_num_errors > 0) \ | 199 | if (!show_all_errors && show_num_errors > 0) \ |
196 | show_num_errors -= 1; \ | 200 | show_num_errors -= 1; \ |
197 | } while (0); | 201 | } while (0); |
198 | 202 | ||
199 | /* | 203 | /* |
diff --git a/lib/flex_array.c b/lib/flex_array.c index 08f1636d296a..7baed2fc3bc8 100644 --- a/lib/flex_array.c +++ b/lib/flex_array.c | |||
@@ -99,7 +99,8 @@ static inline int elements_fit_in_base(struct flex_array *fa) | |||
99 | * capacity in the base structure. Also note that no effort is made | 99 | * capacity in the base structure. Also note that no effort is made |
100 | * to efficiently pack objects across page boundaries. | 100 | * to efficiently pack objects across page boundaries. |
101 | */ | 101 | */ |
102 | struct flex_array *flex_array_alloc(int element_size, int total, gfp_t flags) | 102 | struct flex_array *flex_array_alloc(int element_size, unsigned int total, |
103 | gfp_t flags) | ||
103 | { | 104 | { |
104 | struct flex_array *ret; | 105 | struct flex_array *ret; |
105 | int max_size = nr_base_part_ptrs() * __elements_per_part(element_size); | 106 | int max_size = nr_base_part_ptrs() * __elements_per_part(element_size); |
@@ -115,16 +116,14 @@ struct flex_array *flex_array_alloc(int element_size, int total, gfp_t flags) | |||
115 | return ret; | 116 | return ret; |
116 | } | 117 | } |
117 | 118 | ||
118 | static int fa_element_to_part_nr(struct flex_array *fa, int element_nr) | 119 | static int fa_element_to_part_nr(struct flex_array *fa, |
120 | unsigned int element_nr) | ||
119 | { | 121 | { |
120 | return element_nr / __elements_per_part(fa->element_size); | 122 | return element_nr / __elements_per_part(fa->element_size); |
121 | } | 123 | } |
122 | 124 | ||
123 | /** | 125 | /** |
124 | * flex_array_free_parts - just free the second-level pages | 126 | * flex_array_free_parts - just free the second-level pages |
125 | * @src: address of data to copy into the array | ||
126 | * @element_nr: index of the position in which to insert | ||
127 | * the new element. | ||
128 | * | 127 | * |
129 | * This is to be used in cases where the base 'struct flex_array' | 128 | * This is to be used in cases where the base 'struct flex_array' |
130 | * has been statically allocated and should not be free. | 129 | * has been statically allocated and should not be free. |
@@ -146,14 +145,12 @@ void flex_array_free(struct flex_array *fa) | |||
146 | kfree(fa); | 145 | kfree(fa); |
147 | } | 146 | } |
148 | 147 | ||
149 | static int fa_index_inside_part(struct flex_array *fa, int element_nr) | 148 | static unsigned int index_inside_part(struct flex_array *fa, |
149 | unsigned int element_nr) | ||
150 | { | 150 | { |
151 | return element_nr % __elements_per_part(fa->element_size); | 151 | unsigned int part_offset; |
152 | } | ||
153 | 152 | ||
154 | static int index_inside_part(struct flex_array *fa, int element_nr) | 153 | part_offset = element_nr % __elements_per_part(fa->element_size); |
155 | { | ||
156 | int part_offset = fa_index_inside_part(fa, element_nr); | ||
157 | return part_offset * fa->element_size; | 154 | return part_offset * fa->element_size; |
158 | } | 155 | } |
159 | 156 | ||
@@ -188,7 +185,8 @@ __fa_get_part(struct flex_array *fa, int part_nr, gfp_t flags) | |||
188 | * | 185 | * |
189 | * Locking must be provided by the caller. | 186 | * Locking must be provided by the caller. |
190 | */ | 187 | */ |
191 | int flex_array_put(struct flex_array *fa, int element_nr, void *src, gfp_t flags) | 188 | int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, |
189 | gfp_t flags) | ||
192 | { | 190 | { |
193 | int part_nr = fa_element_to_part_nr(fa, element_nr); | 191 | int part_nr = fa_element_to_part_nr(fa, element_nr); |
194 | struct flex_array_part *part; | 192 | struct flex_array_part *part; |
@@ -198,10 +196,11 @@ int flex_array_put(struct flex_array *fa, int element_nr, void *src, gfp_t flags | |||
198 | return -ENOSPC; | 196 | return -ENOSPC; |
199 | if (elements_fit_in_base(fa)) | 197 | if (elements_fit_in_base(fa)) |
200 | part = (struct flex_array_part *)&fa->parts[0]; | 198 | part = (struct flex_array_part *)&fa->parts[0]; |
201 | else | 199 | else { |
202 | part = __fa_get_part(fa, part_nr, flags); | 200 | part = __fa_get_part(fa, part_nr, flags); |
203 | if (!part) | 201 | if (!part) |
204 | return -ENOMEM; | 202 | return -ENOMEM; |
203 | } | ||
205 | dst = &part->elements[index_inside_part(fa, element_nr)]; | 204 | dst = &part->elements[index_inside_part(fa, element_nr)]; |
206 | memcpy(dst, src, fa->element_size); | 205 | memcpy(dst, src, fa->element_size); |
207 | return 0; | 206 | return 0; |
@@ -219,7 +218,8 @@ int flex_array_put(struct flex_array *fa, int element_nr, void *src, gfp_t flags | |||
219 | * | 218 | * |
220 | * Locking must be provided by the caller. | 219 | * Locking must be provided by the caller. |
221 | */ | 220 | */ |
222 | int flex_array_prealloc(struct flex_array *fa, int start, int end, gfp_t flags) | 221 | int flex_array_prealloc(struct flex_array *fa, unsigned int start, |
222 | unsigned int end, gfp_t flags) | ||
223 | { | 223 | { |
224 | int start_part; | 224 | int start_part; |
225 | int end_part; | 225 | int end_part; |
@@ -250,18 +250,19 @@ int flex_array_prealloc(struct flex_array *fa, int start, int end, gfp_t flags) | |||
250 | * | 250 | * |
251 | * Locking must be provided by the caller. | 251 | * Locking must be provided by the caller. |
252 | */ | 252 | */ |
253 | void *flex_array_get(struct flex_array *fa, int element_nr) | 253 | void *flex_array_get(struct flex_array *fa, unsigned int element_nr) |
254 | { | 254 | { |
255 | int part_nr = fa_element_to_part_nr(fa, element_nr); | 255 | int part_nr = fa_element_to_part_nr(fa, element_nr); |
256 | struct flex_array_part *part; | 256 | struct flex_array_part *part; |
257 | 257 | ||
258 | if (element_nr >= fa->total_nr_elements) | 258 | if (element_nr >= fa->total_nr_elements) |
259 | return NULL; | 259 | return NULL; |
260 | if (!fa->parts[part_nr]) | ||
261 | return NULL; | ||
262 | if (elements_fit_in_base(fa)) | 260 | if (elements_fit_in_base(fa)) |
263 | part = (struct flex_array_part *)&fa->parts[0]; | 261 | part = (struct flex_array_part *)&fa->parts[0]; |
264 | else | 262 | else { |
265 | part = fa->parts[part_nr]; | 263 | part = fa->parts[part_nr]; |
264 | if (!part) | ||
265 | return NULL; | ||
266 | } | ||
266 | return &part->elements[index_inside_part(fa, element_nr)]; | 267 | return &part->elements[index_inside_part(fa, element_nr)]; |
267 | } | 268 | } |
@@ -429,7 +429,7 @@ u64 __init lmb_phys_mem_size(void) | |||
429 | return lmb.memory.size; | 429 | return lmb.memory.size; |
430 | } | 430 | } |
431 | 431 | ||
432 | u64 __init lmb_end_of_DRAM(void) | 432 | u64 lmb_end_of_DRAM(void) |
433 | { | 433 | { |
434 | int idx = lmb.memory.cnt - 1; | 434 | int idx = lmb.memory.cnt - 1; |
435 | 435 | ||
diff --git a/mm/Kconfig b/mm/Kconfig index c948d4ca8bde..fe5f674d7a7d 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -225,9 +225,9 @@ config DEFAULT_MMAP_MIN_ADDR | |||
225 | For most ia64, ppc64 and x86 users with lots of address space | 225 | For most ia64, ppc64 and x86 users with lots of address space |
226 | a value of 65536 is reasonable and should cause no problems. | 226 | a value of 65536 is reasonable and should cause no problems. |
227 | On arm and other archs it should not be higher than 32768. | 227 | On arm and other archs it should not be higher than 32768. |
228 | Programs which use vm86 functionality would either need additional | 228 | Programs which use vm86 functionality or have some need to map |
229 | permissions from either the LSM or the capabilities module or have | 229 | this low address space will need CAP_SYS_RAWIO or disable this |
230 | this protection disabled. | 230 | protection by setting the value to 0. |
231 | 231 | ||
232 | This value can be changed after boot using the | 232 | This value can be changed after boot using the |
233 | /proc/sys/vm/mmap_min_addr tunable. | 233 | /proc/sys/vm/mmap_min_addr tunable. |
@@ -88,9 +88,6 @@ int sysctl_overcommit_ratio = 50; /* default is 50% */ | |||
88 | int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; | 88 | int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; |
89 | struct percpu_counter vm_committed_as; | 89 | struct percpu_counter vm_committed_as; |
90 | 90 | ||
91 | /* amount of vm to protect from userspace access */ | ||
92 | unsigned long mmap_min_addr = CONFIG_DEFAULT_MMAP_MIN_ADDR; | ||
93 | |||
94 | /* | 91 | /* |
95 | * Check that a process has enough memory to allocate a new virtual | 92 | * Check that a process has enough memory to allocate a new virtual |
96 | * mapping. 0 means there is enough memory for the allocation to | 93 | * mapping. 0 means there is enough memory for the allocation to |
diff --git a/mm/nommu.c b/mm/nommu.c index 53cab10fece4..66e81e7e9fe9 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -69,9 +69,6 @@ int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT; | |||
69 | int sysctl_nr_trim_pages = CONFIG_NOMMU_INITIAL_TRIM_EXCESS; | 69 | int sysctl_nr_trim_pages = CONFIG_NOMMU_INITIAL_TRIM_EXCESS; |
70 | int heap_stack_gap = 0; | 70 | int heap_stack_gap = 0; |
71 | 71 | ||
72 | /* amount of vm to protect from userspace access */ | ||
73 | unsigned long mmap_min_addr = CONFIG_DEFAULT_MMAP_MIN_ADDR; | ||
74 | |||
75 | atomic_long_t mmap_pages_allocated; | 72 | atomic_long_t mmap_pages_allocated; |
76 | 73 | ||
77 | EXPORT_SYMBOL(mem_map); | 74 | EXPORT_SYMBOL(mem_map); |
@@ -922,6 +919,10 @@ static int validate_mmap_request(struct file *file, | |||
922 | if (!file->f_op->read) | 919 | if (!file->f_op->read) |
923 | capabilities &= ~BDI_CAP_MAP_COPY; | 920 | capabilities &= ~BDI_CAP_MAP_COPY; |
924 | 921 | ||
922 | /* The file shall have been opened with read permission. */ | ||
923 | if (!(file->f_mode & FMODE_READ)) | ||
924 | return -EACCES; | ||
925 | |||
925 | if (flags & MAP_SHARED) { | 926 | if (flags & MAP_SHARED) { |
926 | /* do checks for writing, appending and locking */ | 927 | /* do checks for writing, appending and locking */ |
927 | if ((prot & PROT_WRITE) && | 928 | if ((prot & PROT_WRITE) && |
@@ -1351,6 +1352,7 @@ unsigned long do_mmap_pgoff(struct file *file, | |||
1351 | } | 1352 | } |
1352 | 1353 | ||
1353 | vma->vm_region = region; | 1354 | vma->vm_region = region; |
1355 | add_nommu_region(region); | ||
1354 | 1356 | ||
1355 | /* set up the mapping */ | 1357 | /* set up the mapping */ |
1356 | if (file && vma->vm_flags & VM_SHARED) | 1358 | if (file && vma->vm_flags & VM_SHARED) |
@@ -1360,8 +1362,6 @@ unsigned long do_mmap_pgoff(struct file *file, | |||
1360 | if (ret < 0) | 1362 | if (ret < 0) |
1361 | goto error_put_region; | 1363 | goto error_put_region; |
1362 | 1364 | ||
1363 | add_nommu_region(region); | ||
1364 | |||
1365 | /* okay... we have a mapping; now we have to register it */ | 1365 | /* okay... we have a mapping; now we have to register it */ |
1366 | result = vma->vm_start; | 1366 | result = vma->vm_start; |
1367 | 1367 | ||
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 175a67a78a99..a7b2460e922b 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -58,7 +58,6 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) | |||
58 | unsigned long points, cpu_time, run_time; | 58 | unsigned long points, cpu_time, run_time; |
59 | struct mm_struct *mm; | 59 | struct mm_struct *mm; |
60 | struct task_struct *child; | 60 | struct task_struct *child; |
61 | int oom_adj; | ||
62 | 61 | ||
63 | task_lock(p); | 62 | task_lock(p); |
64 | mm = p->mm; | 63 | mm = p->mm; |
@@ -66,11 +65,6 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) | |||
66 | task_unlock(p); | 65 | task_unlock(p); |
67 | return 0; | 66 | return 0; |
68 | } | 67 | } |
69 | oom_adj = mm->oom_adj; | ||
70 | if (oom_adj == OOM_DISABLE) { | ||
71 | task_unlock(p); | ||
72 | return 0; | ||
73 | } | ||
74 | 68 | ||
75 | /* | 69 | /* |
76 | * The memory size of the process is the basis for the badness. | 70 | * The memory size of the process is the basis for the badness. |
@@ -154,15 +148,15 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) | |||
154 | points /= 8; | 148 | points /= 8; |
155 | 149 | ||
156 | /* | 150 | /* |
157 | * Adjust the score by oom_adj. | 151 | * Adjust the score by oomkilladj. |
158 | */ | 152 | */ |
159 | if (oom_adj) { | 153 | if (p->oomkilladj) { |
160 | if (oom_adj > 0) { | 154 | if (p->oomkilladj > 0) { |
161 | if (!points) | 155 | if (!points) |
162 | points = 1; | 156 | points = 1; |
163 | points <<= oom_adj; | 157 | points <<= p->oomkilladj; |
164 | } else | 158 | } else |
165 | points >>= -(oom_adj); | 159 | points >>= -(p->oomkilladj); |
166 | } | 160 | } |
167 | 161 | ||
168 | #ifdef DEBUG | 162 | #ifdef DEBUG |
@@ -257,8 +251,11 @@ static struct task_struct *select_bad_process(unsigned long *ppoints, | |||
257 | *ppoints = ULONG_MAX; | 251 | *ppoints = ULONG_MAX; |
258 | } | 252 | } |
259 | 253 | ||
254 | if (p->oomkilladj == OOM_DISABLE) | ||
255 | continue; | ||
256 | |||
260 | points = badness(p, uptime.tv_sec); | 257 | points = badness(p, uptime.tv_sec); |
261 | if (points > *ppoints) { | 258 | if (points > *ppoints || !chosen) { |
262 | chosen = p; | 259 | chosen = p; |
263 | *ppoints = points; | 260 | *ppoints = points; |
264 | } | 261 | } |
@@ -307,7 +304,8 @@ static void dump_tasks(const struct mem_cgroup *mem) | |||
307 | } | 304 | } |
308 | printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3d %3d %s\n", | 305 | printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3d %3d %s\n", |
309 | p->pid, __task_cred(p)->uid, p->tgid, mm->total_vm, | 306 | p->pid, __task_cred(p)->uid, p->tgid, mm->total_vm, |
310 | get_mm_rss(mm), (int)task_cpu(p), mm->oom_adj, p->comm); | 307 | get_mm_rss(mm), (int)task_cpu(p), p->oomkilladj, |
308 | p->comm); | ||
311 | task_unlock(p); | 309 | task_unlock(p); |
312 | } while_each_thread(g, p); | 310 | } while_each_thread(g, p); |
313 | } | 311 | } |
@@ -325,8 +323,11 @@ static void __oom_kill_task(struct task_struct *p, int verbose) | |||
325 | return; | 323 | return; |
326 | } | 324 | } |
327 | 325 | ||
328 | if (!p->mm) | 326 | if (!p->mm) { |
327 | WARN_ON(1); | ||
328 | printk(KERN_WARNING "tried to kill an mm-less task!\n"); | ||
329 | return; | 329 | return; |
330 | } | ||
330 | 331 | ||
331 | if (verbose) | 332 | if (verbose) |
332 | printk(KERN_ERR "Killed process %d (%s)\n", | 333 | printk(KERN_ERR "Killed process %d (%s)\n", |
@@ -348,13 +349,28 @@ static int oom_kill_task(struct task_struct *p) | |||
348 | struct mm_struct *mm; | 349 | struct mm_struct *mm; |
349 | struct task_struct *g, *q; | 350 | struct task_struct *g, *q; |
350 | 351 | ||
351 | task_lock(p); | ||
352 | mm = p->mm; | 352 | mm = p->mm; |
353 | if (!mm || mm->oom_adj == OOM_DISABLE) { | 353 | |
354 | task_unlock(p); | 354 | /* WARNING: mm may not be dereferenced since we did not obtain its |
355 | * value from get_task_mm(p). This is OK since all we need to do is | ||
356 | * compare mm to q->mm below. | ||
357 | * | ||
358 | * Furthermore, even if mm contains a non-NULL value, p->mm may | ||
359 | * change to NULL at any time since we do not hold task_lock(p). | ||
360 | * However, this is of no concern to us. | ||
361 | */ | ||
362 | |||
363 | if (mm == NULL) | ||
355 | return 1; | 364 | return 1; |
356 | } | 365 | |
357 | task_unlock(p); | 366 | /* |
367 | * Don't kill the process if any threads are set to OOM_DISABLE | ||
368 | */ | ||
369 | do_each_thread(g, q) { | ||
370 | if (q->mm == mm && q->oomkilladj == OOM_DISABLE) | ||
371 | return 1; | ||
372 | } while_each_thread(g, q); | ||
373 | |||
358 | __oom_kill_task(p, 1); | 374 | __oom_kill_task(p, 1); |
359 | 375 | ||
360 | /* | 376 | /* |
@@ -377,11 +393,10 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, | |||
377 | struct task_struct *c; | 393 | struct task_struct *c; |
378 | 394 | ||
379 | if (printk_ratelimit()) { | 395 | if (printk_ratelimit()) { |
380 | task_lock(current); | ||
381 | printk(KERN_WARNING "%s invoked oom-killer: " | 396 | printk(KERN_WARNING "%s invoked oom-killer: " |
382 | "gfp_mask=0x%x, order=%d, oom_adj=%d\n", | 397 | "gfp_mask=0x%x, order=%d, oomkilladj=%d\n", |
383 | current->comm, gfp_mask, order, | 398 | current->comm, gfp_mask, order, current->oomkilladj); |
384 | current->mm ? current->mm->oom_adj : OOM_DISABLE); | 399 | task_lock(current); |
385 | cpuset_print_task_mems_allowed(current); | 400 | cpuset_print_task_mems_allowed(current); |
386 | task_unlock(current); | 401 | task_unlock(current); |
387 | dump_stack(); | 402 | dump_stack(); |
@@ -394,9 +409,8 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, | |||
394 | /* | 409 | /* |
395 | * If the task is already exiting, don't alarm the sysadmin or kill | 410 | * If the task is already exiting, don't alarm the sysadmin or kill |
396 | * its children or threads, just set TIF_MEMDIE so it can die quickly | 411 | * its children or threads, just set TIF_MEMDIE so it can die quickly |
397 | * if its mm is still attached. | ||
398 | */ | 412 | */ |
399 | if (p->mm && (p->flags & PF_EXITING)) { | 413 | if (p->flags & PF_EXITING) { |
400 | __oom_kill_task(p, 0); | 414 | __oom_kill_task(p, 0); |
401 | return 0; | 415 | return 0; |
402 | } | 416 | } |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d052abbe3063..a0de15f46987 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -817,13 +817,15 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype) | |||
817 | * agressive about taking ownership of free pages | 817 | * agressive about taking ownership of free pages |
818 | */ | 818 | */ |
819 | if (unlikely(current_order >= (pageblock_order >> 1)) || | 819 | if (unlikely(current_order >= (pageblock_order >> 1)) || |
820 | start_migratetype == MIGRATE_RECLAIMABLE) { | 820 | start_migratetype == MIGRATE_RECLAIMABLE || |
821 | page_group_by_mobility_disabled) { | ||
821 | unsigned long pages; | 822 | unsigned long pages; |
822 | pages = move_freepages_block(zone, page, | 823 | pages = move_freepages_block(zone, page, |
823 | start_migratetype); | 824 | start_migratetype); |
824 | 825 | ||
825 | /* Claim the whole block if over half of it is free */ | 826 | /* Claim the whole block if over half of it is free */ |
826 | if (pages >= (1 << (pageblock_order-1))) | 827 | if (pages >= (1 << (pageblock_order-1)) || |
828 | page_group_by_mobility_disabled) | ||
827 | set_pageblock_migratetype(page, | 829 | set_pageblock_migratetype(page, |
828 | start_migratetype); | 830 | start_migratetype); |
829 | 831 | ||
@@ -2544,7 +2546,6 @@ static void build_zonelists(pg_data_t *pgdat) | |||
2544 | prev_node = local_node; | 2546 | prev_node = local_node; |
2545 | nodes_clear(used_mask); | 2547 | nodes_clear(used_mask); |
2546 | 2548 | ||
2547 | memset(node_load, 0, sizeof(node_load)); | ||
2548 | memset(node_order, 0, sizeof(node_order)); | 2549 | memset(node_order, 0, sizeof(node_order)); |
2549 | j = 0; | 2550 | j = 0; |
2550 | 2551 | ||
@@ -2653,6 +2654,9 @@ static int __build_all_zonelists(void *dummy) | |||
2653 | { | 2654 | { |
2654 | int nid; | 2655 | int nid; |
2655 | 2656 | ||
2657 | #ifdef CONFIG_NUMA | ||
2658 | memset(node_load, 0, sizeof(node_load)); | ||
2659 | #endif | ||
2656 | for_each_online_node(nid) { | 2660 | for_each_online_node(nid) { |
2657 | pg_data_t *pgdat = NODE_DATA(nid); | 2661 | pg_data_t *pgdat = NODE_DATA(nid); |
2658 | 2662 | ||
diff --git a/mm/percpu.c b/mm/percpu.c index b70f2acd8853..3311c8919f37 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
@@ -8,12 +8,12 @@ | |||
8 | * | 8 | * |
9 | * This is percpu allocator which can handle both static and dynamic | 9 | * This is percpu allocator which can handle both static and dynamic |
10 | * areas. Percpu areas are allocated in chunks in vmalloc area. Each | 10 | * areas. Percpu areas are allocated in chunks in vmalloc area. Each |
11 | * chunk is consisted of num_possible_cpus() units and the first chunk | 11 | * chunk is consisted of nr_cpu_ids units and the first chunk is used |
12 | * is used for static percpu variables in the kernel image (special | 12 | * for static percpu variables in the kernel image (special boot time |
13 | * boot time alloc/init handling necessary as these areas need to be | 13 | * alloc/init handling necessary as these areas need to be brought up |
14 | * brought up before allocation services are running). Unit grows as | 14 | * before allocation services are running). Unit grows as necessary |
15 | * necessary and all units grow or shrink in unison. When a chunk is | 15 | * and all units grow or shrink in unison. When a chunk is filled up, |
16 | * filled up, another chunk is allocated. ie. in vmalloc area | 16 | * another chunk is allocated. ie. in vmalloc area |
17 | * | 17 | * |
18 | * c0 c1 c2 | 18 | * c0 c1 c2 |
19 | * ------------------- ------------------- ------------ | 19 | * ------------------- ------------------- ------------ |
@@ -197,7 +197,12 @@ static unsigned long pcpu_chunk_addr(struct pcpu_chunk *chunk, | |||
197 | static bool pcpu_chunk_page_occupied(struct pcpu_chunk *chunk, | 197 | static bool pcpu_chunk_page_occupied(struct pcpu_chunk *chunk, |
198 | int page_idx) | 198 | int page_idx) |
199 | { | 199 | { |
200 | return *pcpu_chunk_pagep(chunk, 0, page_idx) != NULL; | 200 | /* |
201 | * Any possible cpu id can be used here, so there's no need to | ||
202 | * worry about preemption or cpu hotplug. | ||
203 | */ | ||
204 | return *pcpu_chunk_pagep(chunk, raw_smp_processor_id(), | ||
205 | page_idx) != NULL; | ||
201 | } | 206 | } |
202 | 207 | ||
203 | /* set the pointer to a chunk in a page struct */ | 208 | /* set the pointer to a chunk in a page struct */ |
@@ -297,6 +302,14 @@ static struct pcpu_chunk *pcpu_chunk_addr_search(void *addr) | |||
297 | return pcpu_first_chunk; | 302 | return pcpu_first_chunk; |
298 | } | 303 | } |
299 | 304 | ||
305 | /* | ||
306 | * The address is relative to unit0 which might be unused and | ||
307 | * thus unmapped. Offset the address to the unit space of the | ||
308 | * current processor before looking it up in the vmalloc | ||
309 | * space. Note that any possible cpu id can be used here, so | ||
310 | * there's no need to worry about preemption or cpu hotplug. | ||
311 | */ | ||
312 | addr += raw_smp_processor_id() * pcpu_unit_size; | ||
300 | return pcpu_get_page_chunk(vmalloc_to_page(addr)); | 313 | return pcpu_get_page_chunk(vmalloc_to_page(addr)); |
301 | } | 314 | } |
302 | 315 | ||
@@ -558,7 +571,7 @@ static void pcpu_free_area(struct pcpu_chunk *chunk, int freeme) | |||
558 | static void pcpu_unmap(struct pcpu_chunk *chunk, int page_start, int page_end, | 571 | static void pcpu_unmap(struct pcpu_chunk *chunk, int page_start, int page_end, |
559 | bool flush_tlb) | 572 | bool flush_tlb) |
560 | { | 573 | { |
561 | unsigned int last = num_possible_cpus() - 1; | 574 | unsigned int last = nr_cpu_ids - 1; |
562 | unsigned int cpu; | 575 | unsigned int cpu; |
563 | 576 | ||
564 | /* unmap must not be done on immutable chunk */ | 577 | /* unmap must not be done on immutable chunk */ |
@@ -643,7 +656,7 @@ static void pcpu_depopulate_chunk(struct pcpu_chunk *chunk, int off, int size, | |||
643 | */ | 656 | */ |
644 | static int pcpu_map(struct pcpu_chunk *chunk, int page_start, int page_end) | 657 | static int pcpu_map(struct pcpu_chunk *chunk, int page_start, int page_end) |
645 | { | 658 | { |
646 | unsigned int last = num_possible_cpus() - 1; | 659 | unsigned int last = nr_cpu_ids - 1; |
647 | unsigned int cpu; | 660 | unsigned int cpu; |
648 | int err; | 661 | int err; |
649 | 662 | ||
@@ -749,7 +762,7 @@ static struct pcpu_chunk *alloc_pcpu_chunk(void) | |||
749 | chunk->map[chunk->map_used++] = pcpu_unit_size; | 762 | chunk->map[chunk->map_used++] = pcpu_unit_size; |
750 | chunk->page = chunk->page_ar; | 763 | chunk->page = chunk->page_ar; |
751 | 764 | ||
752 | chunk->vm = get_vm_area(pcpu_chunk_size, GFP_KERNEL); | 765 | chunk->vm = get_vm_area(pcpu_chunk_size, VM_ALLOC); |
753 | if (!chunk->vm) { | 766 | if (!chunk->vm) { |
754 | free_pcpu_chunk(chunk); | 767 | free_pcpu_chunk(chunk); |
755 | return NULL; | 768 | return NULL; |
@@ -1067,9 +1080,9 @@ size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, | |||
1067 | PFN_UP(size_sum)); | 1080 | PFN_UP(size_sum)); |
1068 | 1081 | ||
1069 | pcpu_unit_size = pcpu_unit_pages << PAGE_SHIFT; | 1082 | pcpu_unit_size = pcpu_unit_pages << PAGE_SHIFT; |
1070 | pcpu_chunk_size = num_possible_cpus() * pcpu_unit_size; | 1083 | pcpu_chunk_size = nr_cpu_ids * pcpu_unit_size; |
1071 | pcpu_chunk_struct_size = sizeof(struct pcpu_chunk) | 1084 | pcpu_chunk_struct_size = sizeof(struct pcpu_chunk) |
1072 | + num_possible_cpus() * pcpu_unit_pages * sizeof(struct page *); | 1085 | + nr_cpu_ids * pcpu_unit_pages * sizeof(struct page *); |
1073 | 1086 | ||
1074 | if (dyn_size < 0) | 1087 | if (dyn_size < 0) |
1075 | dyn_size = pcpu_unit_size - static_size - reserved_size; | 1088 | dyn_size = pcpu_unit_size - static_size - reserved_size; |
@@ -1248,7 +1261,7 @@ ssize_t __init pcpu_embed_first_chunk(size_t static_size, size_t reserved_size, | |||
1248 | } else | 1261 | } else |
1249 | pcpue_unit_size = max_t(size_t, pcpue_size, PCPU_MIN_UNIT_SIZE); | 1262 | pcpue_unit_size = max_t(size_t, pcpue_size, PCPU_MIN_UNIT_SIZE); |
1250 | 1263 | ||
1251 | chunk_size = pcpue_unit_size * num_possible_cpus(); | 1264 | chunk_size = pcpue_unit_size * nr_cpu_ids; |
1252 | 1265 | ||
1253 | pcpue_ptr = __alloc_bootmem_nopanic(chunk_size, PAGE_SIZE, | 1266 | pcpue_ptr = __alloc_bootmem_nopanic(chunk_size, PAGE_SIZE, |
1254 | __pa(MAX_DMA_ADDRESS)); | 1267 | __pa(MAX_DMA_ADDRESS)); |
@@ -1259,12 +1272,15 @@ ssize_t __init pcpu_embed_first_chunk(size_t static_size, size_t reserved_size, | |||
1259 | } | 1272 | } |
1260 | 1273 | ||
1261 | /* return the leftover and copy */ | 1274 | /* return the leftover and copy */ |
1262 | for_each_possible_cpu(cpu) { | 1275 | for (cpu = 0; cpu < nr_cpu_ids; cpu++) { |
1263 | void *ptr = pcpue_ptr + cpu * pcpue_unit_size; | 1276 | void *ptr = pcpue_ptr + cpu * pcpue_unit_size; |
1264 | 1277 | ||
1265 | free_bootmem(__pa(ptr + pcpue_size), | 1278 | if (cpu_possible(cpu)) { |
1266 | pcpue_unit_size - pcpue_size); | 1279 | free_bootmem(__pa(ptr + pcpue_size), |
1267 | memcpy(ptr, __per_cpu_load, static_size); | 1280 | pcpue_unit_size - pcpue_size); |
1281 | memcpy(ptr, __per_cpu_load, static_size); | ||
1282 | } else | ||
1283 | free_bootmem(__pa(ptr), pcpue_unit_size); | ||
1268 | } | 1284 | } |
1269 | 1285 | ||
1270 | /* we're ready, commit */ | 1286 | /* we're ready, commit */ |
@@ -358,6 +358,7 @@ static int page_referenced_one(struct page *page, | |||
358 | */ | 358 | */ |
359 | if (vma->vm_flags & VM_LOCKED) { | 359 | if (vma->vm_flags & VM_LOCKED) { |
360 | *mapcount = 1; /* break early from loop */ | 360 | *mapcount = 1; /* break early from loop */ |
361 | *vm_flags |= VM_LOCKED; | ||
361 | goto out_unmap; | 362 | goto out_unmap; |
362 | } | 363 | } |
363 | 364 | ||
@@ -2594,8 +2594,6 @@ static inline int kmem_cache_close(struct kmem_cache *s) | |||
2594 | */ | 2594 | */ |
2595 | void kmem_cache_destroy(struct kmem_cache *s) | 2595 | void kmem_cache_destroy(struct kmem_cache *s) |
2596 | { | 2596 | { |
2597 | if (s->flags & SLAB_DESTROY_BY_RCU) | ||
2598 | rcu_barrier(); | ||
2599 | down_write(&slub_lock); | 2597 | down_write(&slub_lock); |
2600 | s->refcount--; | 2598 | s->refcount--; |
2601 | if (!s->refcount) { | 2599 | if (!s->refcount) { |
@@ -2606,6 +2604,8 @@ void kmem_cache_destroy(struct kmem_cache *s) | |||
2606 | "still has objects.\n", s->name, __func__); | 2604 | "still has objects.\n", s->name, __func__); |
2607 | dump_stack(); | 2605 | dump_stack(); |
2608 | } | 2606 | } |
2607 | if (s->flags & SLAB_DESTROY_BY_RCU) | ||
2608 | rcu_barrier(); | ||
2609 | sysfs_slab_remove(s); | 2609 | sysfs_slab_remove(s); |
2610 | } else | 2610 | } else |
2611 | up_write(&slub_lock); | 2611 | up_write(&slub_lock); |
diff --git a/mm/vmscan.c b/mm/vmscan.c index dea7abd31098..94e86dd6954c 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -630,9 +630,14 @@ static unsigned long shrink_page_list(struct list_head *page_list, | |||
630 | 630 | ||
631 | referenced = page_referenced(page, 1, | 631 | referenced = page_referenced(page, 1, |
632 | sc->mem_cgroup, &vm_flags); | 632 | sc->mem_cgroup, &vm_flags); |
633 | /* In active use or really unfreeable? Activate it. */ | 633 | /* |
634 | * In active use or really unfreeable? Activate it. | ||
635 | * If page which have PG_mlocked lost isoltation race, | ||
636 | * try_to_unmap moves it to unevictable list | ||
637 | */ | ||
634 | if (sc->order <= PAGE_ALLOC_COSTLY_ORDER && | 638 | if (sc->order <= PAGE_ALLOC_COSTLY_ORDER && |
635 | referenced && page_mapping_inuse(page)) | 639 | referenced && page_mapping_inuse(page) |
640 | && !(vm_flags & VM_LOCKED)) | ||
636 | goto activate_locked; | 641 | goto activate_locked; |
637 | 642 | ||
638 | /* | 643 | /* |
diff --git a/net/9p/client.c b/net/9p/client.c index 787ccddb85ea..5bf5f227dbe0 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -60,9 +60,9 @@ static struct p9_req_t * | |||
60 | p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...); | 60 | p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...); |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * v9fs_parse_options - parse mount options into session structure | 63 | * parse_options - parse mount options into client structure |
64 | * @options: options string passed from mount | 64 | * @opts: options string passed from mount |
65 | * @v9ses: existing v9fs session information | 65 | * @clnt: existing v9fs client information |
66 | * | 66 | * |
67 | * Return 0 upon success, -ERRNO upon failure | 67 | * Return 0 upon success, -ERRNO upon failure |
68 | */ | 68 | */ |
@@ -232,7 +232,7 @@ EXPORT_SYMBOL(p9_tag_lookup); | |||
232 | 232 | ||
233 | /** | 233 | /** |
234 | * p9_tag_init - setup tags structure and contents | 234 | * p9_tag_init - setup tags structure and contents |
235 | * @tags: tags structure from the client struct | 235 | * @c: v9fs client struct |
236 | * | 236 | * |
237 | * This initializes the tags structure for each client instance. | 237 | * This initializes the tags structure for each client instance. |
238 | * | 238 | * |
@@ -258,7 +258,7 @@ error: | |||
258 | 258 | ||
259 | /** | 259 | /** |
260 | * p9_tag_cleanup - cleans up tags structure and reclaims resources | 260 | * p9_tag_cleanup - cleans up tags structure and reclaims resources |
261 | * @tags: tags structure from the client struct | 261 | * @c: v9fs client struct |
262 | * | 262 | * |
263 | * This frees resources associated with the tags structure | 263 | * This frees resources associated with the tags structure |
264 | * | 264 | * |
@@ -411,14 +411,9 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req) | |||
411 | if (c->dotu) | 411 | if (c->dotu) |
412 | err = -ecode; | 412 | err = -ecode; |
413 | 413 | ||
414 | if (!err) { | 414 | if (!err || !IS_ERR_VALUE(err)) |
415 | err = p9_errstr2errno(ename, strlen(ename)); | 415 | err = p9_errstr2errno(ename, strlen(ename)); |
416 | 416 | ||
417 | /* string match failed */ | ||
418 | if (!err) | ||
419 | err = -ESERVERFAULT; | ||
420 | } | ||
421 | |||
422 | P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", -ecode, ename); | 417 | P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", -ecode, ename); |
423 | 418 | ||
424 | kfree(ename); | 419 | kfree(ename); |
@@ -430,8 +425,8 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req) | |||
430 | 425 | ||
431 | /** | 426 | /** |
432 | * p9_client_flush - flush (cancel) a request | 427 | * p9_client_flush - flush (cancel) a request |
433 | * c: client state | 428 | * @c: client state |
434 | * req: request to cancel | 429 | * @oldreq: request to cancel |
435 | * | 430 | * |
436 | * This sents a flush for a particular requests and links | 431 | * This sents a flush for a particular requests and links |
437 | * the flush request to the original request. The current | 432 | * the flush request to the original request. The current |
diff --git a/net/9p/error.c b/net/9p/error.c index fdebe4314062..52518512a93e 100644 --- a/net/9p/error.c +++ b/net/9p/error.c | |||
@@ -239,7 +239,7 @@ int p9_errstr2errno(char *errstr, int len) | |||
239 | errstr[len] = 0; | 239 | errstr[len] = 0; |
240 | printk(KERN_ERR "%s: server reported unknown error %s\n", | 240 | printk(KERN_ERR "%s: server reported unknown error %s\n", |
241 | __func__, errstr); | 241 | __func__, errstr); |
242 | errno = 1; | 242 | errno = ESERVERFAULT; |
243 | } | 243 | } |
244 | 244 | ||
245 | return -errno; | 245 | return -errno; |
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index 8c2588e4edc0..8d934dd7fd54 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c | |||
@@ -119,8 +119,8 @@ struct p9_poll_wait { | |||
119 | * @wpos: write position for current frame | 119 | * @wpos: write position for current frame |
120 | * @wsize: amount of data to write for current frame | 120 | * @wsize: amount of data to write for current frame |
121 | * @wbuf: current write buffer | 121 | * @wbuf: current write buffer |
122 | * @poll_pending_link: pending links to be polled per conn | ||
122 | * @poll_wait: array of wait_q's for various worker threads | 123 | * @poll_wait: array of wait_q's for various worker threads |
123 | * @poll_waddr: ???? | ||
124 | * @pt: poll state | 124 | * @pt: poll state |
125 | * @rq: current read work | 125 | * @rq: current read work |
126 | * @wq: current write work | 126 | * @wq: current write work |
@@ -700,9 +700,9 @@ static int p9_fd_cancel(struct p9_client *client, struct p9_req_t *req) | |||
700 | } | 700 | } |
701 | 701 | ||
702 | /** | 702 | /** |
703 | * parse_options - parse mount options into session structure | 703 | * parse_opts - parse mount options into p9_fd_opts structure |
704 | * @options: options string passed from mount | 704 | * @params: options string passed from mount |
705 | * @opts: transport-specific structure to parse options into | 705 | * @opts: fd transport-specific structure to parse options into |
706 | * | 706 | * |
707 | * Returns 0 upon success, -ERRNO upon failure | 707 | * Returns 0 upon success, -ERRNO upon failure |
708 | */ | 708 | */ |
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index ac4990041ebb..65cb29db03f8 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c | |||
@@ -67,14 +67,15 @@ | |||
67 | * @pd: Protection Domain pointer | 67 | * @pd: Protection Domain pointer |
68 | * @qp: Queue Pair pointer | 68 | * @qp: Queue Pair pointer |
69 | * @cq: Completion Queue pointer | 69 | * @cq: Completion Queue pointer |
70 | * @dm_mr: DMA Memory Region pointer | ||
70 | * @lkey: The local access only memory region key | 71 | * @lkey: The local access only memory region key |
71 | * @timeout: Number of uSecs to wait for connection management events | 72 | * @timeout: Number of uSecs to wait for connection management events |
72 | * @sq_depth: The depth of the Send Queue | 73 | * @sq_depth: The depth of the Send Queue |
73 | * @sq_sem: Semaphore for the SQ | 74 | * @sq_sem: Semaphore for the SQ |
74 | * @rq_depth: The depth of the Receive Queue. | 75 | * @rq_depth: The depth of the Receive Queue. |
76 | * @rq_count: Count of requests in the Receive Queue. | ||
75 | * @addr: The remote peer's address | 77 | * @addr: The remote peer's address |
76 | * @req_lock: Protects the active request list | 78 | * @req_lock: Protects the active request list |
77 | * @send_wait: Wait list when the SQ fills up | ||
78 | * @cm_done: Completion event for connection management tracking | 79 | * @cm_done: Completion event for connection management tracking |
79 | */ | 80 | */ |
80 | struct p9_trans_rdma { | 81 | struct p9_trans_rdma { |
@@ -154,9 +155,9 @@ static match_table_t tokens = { | |||
154 | }; | 155 | }; |
155 | 156 | ||
156 | /** | 157 | /** |
157 | * parse_options - parse mount options into session structure | 158 | * parse_opts - parse mount options into rdma options structure |
158 | * @options: options string passed from mount | 159 | * @params: options string passed from mount |
159 | * @opts: transport-specific structure to parse options into | 160 | * @opts: rdma transport-specific structure to parse options into |
160 | * | 161 | * |
161 | * Returns 0 upon success, -ERRNO upon failure | 162 | * Returns 0 upon success, -ERRNO upon failure |
162 | */ | 163 | */ |
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index a49484e67e1d..9bf0b737aa51 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -57,11 +57,9 @@ static int chan_index; | |||
57 | * @initialized: whether the channel is initialized | 57 | * @initialized: whether the channel is initialized |
58 | * @inuse: whether the channel is in use | 58 | * @inuse: whether the channel is in use |
59 | * @lock: protects multiple elements within this structure | 59 | * @lock: protects multiple elements within this structure |
60 | * @client: client instance | ||
60 | * @vdev: virtio dev associated with this channel | 61 | * @vdev: virtio dev associated with this channel |
61 | * @vq: virtio queue associated with this channel | 62 | * @vq: virtio queue associated with this channel |
62 | * @tagpool: accounting for tag ids (and request slots) | ||
63 | * @reqs: array of request slots | ||
64 | * @max_tag: current number of request_slots allocated | ||
65 | * @sg: scatter gather list which is used to pack a request (protected?) | 63 | * @sg: scatter gather list which is used to pack a request (protected?) |
66 | * | 64 | * |
67 | * We keep all per-channel information in a structure. | 65 | * We keep all per-channel information in a structure. |
@@ -92,7 +90,7 @@ static unsigned int rest_of_page(void *data) | |||
92 | 90 | ||
93 | /** | 91 | /** |
94 | * p9_virtio_close - reclaim resources of a channel | 92 | * p9_virtio_close - reclaim resources of a channel |
95 | * @trans: transport state | 93 | * @client: client instance |
96 | * | 94 | * |
97 | * This reclaims a channel by freeing its resources and | 95 | * This reclaims a channel by freeing its resources and |
98 | * reseting its inuse flag. | 96 | * reseting its inuse flag. |
@@ -181,9 +179,8 @@ static int p9_virtio_cancel(struct p9_client *client, struct p9_req_t *req) | |||
181 | 179 | ||
182 | /** | 180 | /** |
183 | * p9_virtio_request - issue a request | 181 | * p9_virtio_request - issue a request |
184 | * @t: transport state | 182 | * @client: client instance issuing the request |
185 | * @tc: &p9_fcall request to transmit | 183 | * @req: request to be issued |
186 | * @rc: &p9_fcall to put reponse into | ||
187 | * | 184 | * |
188 | */ | 185 | */ |
189 | 186 | ||
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index bfbe13786bb4..875eda5dbad7 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -1238,6 +1238,7 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr, | |||
1238 | return -ENOBUFS; | 1238 | return -ENOBUFS; |
1239 | 1239 | ||
1240 | *uaddr_len = sizeof(struct sockaddr_at); | 1240 | *uaddr_len = sizeof(struct sockaddr_at); |
1241 | memset(&sat.sat_zero, 0, sizeof(sat.sat_zero)); | ||
1241 | 1242 | ||
1242 | if (peer) { | 1243 | if (peer) { |
1243 | if (sk->sk_state != TCP_ESTABLISHED) | 1244 | if (sk->sk_state != TCP_ESTABLISHED) |
diff --git a/net/can/raw.c b/net/can/raw.c index f4cc44548bda..db3152df7d2b 100644 --- a/net/can/raw.c +++ b/net/can/raw.c | |||
@@ -401,6 +401,7 @@ static int raw_getname(struct socket *sock, struct sockaddr *uaddr, | |||
401 | if (peer) | 401 | if (peer) |
402 | return -EOPNOTSUPP; | 402 | return -EOPNOTSUPP; |
403 | 403 | ||
404 | memset(addr, 0, sizeof(*addr)); | ||
404 | addr->can_family = AF_CAN; | 405 | addr->can_family = AF_CAN; |
405 | addr->can_ifindex = ro->ifindex; | 406 | addr->can_ifindex = ro->ifindex; |
406 | 407 | ||
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c index 78e5bfc454ae..493775f4f2f1 100644 --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c | |||
@@ -81,7 +81,7 @@ | |||
81 | struct gen_estimator | 81 | struct gen_estimator |
82 | { | 82 | { |
83 | struct list_head list; | 83 | struct list_head list; |
84 | struct gnet_stats_basic *bstats; | 84 | struct gnet_stats_basic_packed *bstats; |
85 | struct gnet_stats_rate_est *rate_est; | 85 | struct gnet_stats_rate_est *rate_est; |
86 | spinlock_t *stats_lock; | 86 | spinlock_t *stats_lock; |
87 | int ewma_log; | 87 | int ewma_log; |
@@ -165,7 +165,7 @@ static void gen_add_node(struct gen_estimator *est) | |||
165 | } | 165 | } |
166 | 166 | ||
167 | static | 167 | static |
168 | struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats, | 168 | struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats, |
169 | const struct gnet_stats_rate_est *rate_est) | 169 | const struct gnet_stats_rate_est *rate_est) |
170 | { | 170 | { |
171 | struct rb_node *p = est_root.rb_node; | 171 | struct rb_node *p = est_root.rb_node; |
@@ -202,7 +202,7 @@ struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats, | |||
202 | * | 202 | * |
203 | * NOTE: Called under rtnl_mutex | 203 | * NOTE: Called under rtnl_mutex |
204 | */ | 204 | */ |
205 | int gen_new_estimator(struct gnet_stats_basic *bstats, | 205 | int gen_new_estimator(struct gnet_stats_basic_packed *bstats, |
206 | struct gnet_stats_rate_est *rate_est, | 206 | struct gnet_stats_rate_est *rate_est, |
207 | spinlock_t *stats_lock, | 207 | spinlock_t *stats_lock, |
208 | struct nlattr *opt) | 208 | struct nlattr *opt) |
@@ -262,7 +262,7 @@ static void __gen_kill_estimator(struct rcu_head *head) | |||
262 | * | 262 | * |
263 | * NOTE: Called under rtnl_mutex | 263 | * NOTE: Called under rtnl_mutex |
264 | */ | 264 | */ |
265 | void gen_kill_estimator(struct gnet_stats_basic *bstats, | 265 | void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, |
266 | struct gnet_stats_rate_est *rate_est) | 266 | struct gnet_stats_rate_est *rate_est) |
267 | { | 267 | { |
268 | struct gen_estimator *e; | 268 | struct gen_estimator *e; |
@@ -292,7 +292,7 @@ EXPORT_SYMBOL(gen_kill_estimator); | |||
292 | * | 292 | * |
293 | * Returns 0 on success or a negative error code. | 293 | * Returns 0 on success or a negative error code. |
294 | */ | 294 | */ |
295 | int gen_replace_estimator(struct gnet_stats_basic *bstats, | 295 | int gen_replace_estimator(struct gnet_stats_basic_packed *bstats, |
296 | struct gnet_stats_rate_est *rate_est, | 296 | struct gnet_stats_rate_est *rate_est, |
297 | spinlock_t *stats_lock, struct nlattr *opt) | 297 | spinlock_t *stats_lock, struct nlattr *opt) |
298 | { | 298 | { |
@@ -308,7 +308,7 @@ EXPORT_SYMBOL(gen_replace_estimator); | |||
308 | * | 308 | * |
309 | * Returns true if estimator is active, and false if not. | 309 | * Returns true if estimator is active, and false if not. |
310 | */ | 310 | */ |
311 | bool gen_estimator_active(const struct gnet_stats_basic *bstats, | 311 | bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, |
312 | const struct gnet_stats_rate_est *rate_est) | 312 | const struct gnet_stats_rate_est *rate_est) |
313 | { | 313 | { |
314 | ASSERT_RTNL(); | 314 | ASSERT_RTNL(); |
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c index c3d0ffeac243..8569310268ab 100644 --- a/net/core/gen_stats.c +++ b/net/core/gen_stats.c | |||
@@ -106,16 +106,21 @@ gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock, | |||
106 | * if the room in the socket buffer was not sufficient. | 106 | * if the room in the socket buffer was not sufficient. |
107 | */ | 107 | */ |
108 | int | 108 | int |
109 | gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic *b) | 109 | gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic_packed *b) |
110 | { | 110 | { |
111 | if (d->compat_tc_stats) { | 111 | if (d->compat_tc_stats) { |
112 | d->tc_stats.bytes = b->bytes; | 112 | d->tc_stats.bytes = b->bytes; |
113 | d->tc_stats.packets = b->packets; | 113 | d->tc_stats.packets = b->packets; |
114 | } | 114 | } |
115 | 115 | ||
116 | if (d->tail) | 116 | if (d->tail) { |
117 | return gnet_stats_copy(d, TCA_STATS_BASIC, b, sizeof(*b)); | 117 | struct gnet_stats_basic sb; |
118 | 118 | ||
119 | memset(&sb, 0, sizeof(sb)); | ||
120 | sb.bytes = b->bytes; | ||
121 | sb.packets = b->packets; | ||
122 | return gnet_stats_copy(d, TCA_STATS_BASIC, &sb, sizeof(sb)); | ||
123 | } | ||
119 | return 0; | 124 | return 0; |
120 | } | 125 | } |
121 | 126 | ||
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index df30feb2fc72..1b76eb11deb4 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -319,6 +319,11 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) | |||
319 | 319 | ||
320 | udelay(USEC_PER_POLL); | 320 | udelay(USEC_PER_POLL); |
321 | } | 321 | } |
322 | |||
323 | WARN_ONCE(!irqs_disabled(), | ||
324 | "netpoll_send_skb(): %s enabled interrupts in poll (%pF)\n", | ||
325 | dev->name, ops->ndo_start_xmit); | ||
326 | |||
322 | local_irq_restore(flags); | 327 | local_irq_restore(flags); |
323 | } | 328 | } |
324 | 329 | ||
diff --git a/net/core/sock.c b/net/core/sock.c index bbb25be7ddfe..76334228ed1c 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1025,6 +1025,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority, | |||
1025 | sk->sk_prot = sk->sk_prot_creator = prot; | 1025 | sk->sk_prot = sk->sk_prot_creator = prot; |
1026 | sock_lock_init(sk); | 1026 | sock_lock_init(sk); |
1027 | sock_net_set(sk, get_net(net)); | 1027 | sock_net_set(sk, get_net(net)); |
1028 | atomic_set(&sk->sk_wmem_alloc, 1); | ||
1028 | } | 1029 | } |
1029 | 1030 | ||
1030 | return sk; | 1031 | return sk; |
@@ -1872,7 +1873,6 @@ void sock_init_data(struct socket *sock, struct sock *sk) | |||
1872 | */ | 1873 | */ |
1873 | smp_wmb(); | 1874 | smp_wmb(); |
1874 | atomic_set(&sk->sk_refcnt, 1); | 1875 | atomic_set(&sk->sk_refcnt, 1); |
1875 | atomic_set(&sk->sk_wmem_alloc, 1); | ||
1876 | atomic_set(&sk->sk_drops, 0); | 1876 | atomic_set(&sk->sk_drops, 0); |
1877 | } | 1877 | } |
1878 | EXPORT_SYMBOL(sock_init_data); | 1878 | EXPORT_SYMBOL(sock_init_data); |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 3281013ce038..1bca9205104e 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -1159,6 +1159,7 @@ static void __exit dccp_fini(void) | |||
1159 | kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); | 1159 | kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); |
1160 | dccp_ackvec_exit(); | 1160 | dccp_ackvec_exit(); |
1161 | dccp_sysctl_exit(); | 1161 | dccp_sysctl_exit(); |
1162 | percpu_counter_destroy(&dccp_orphan_count); | ||
1162 | } | 1163 | } |
1163 | 1164 | ||
1164 | module_init(dccp_init); | 1165 | module_init(dccp_init); |
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 2e1f836d4240..f0bbc57926cd 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -520,6 +520,7 @@ static int econet_getname(struct socket *sock, struct sockaddr *uaddr, | |||
520 | if (peer) | 520 | if (peer) |
521 | return -EOPNOTSUPP; | 521 | return -EOPNOTSUPP; |
522 | 522 | ||
523 | memset(sec, 0, sizeof(*sec)); | ||
523 | mutex_lock(&econet_mutex); | 524 | mutex_lock(&econet_mutex); |
524 | 525 | ||
525 | sk = sock->sk; | 526 | sk = sock->sk; |
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c index 3bb6bdb1dac1..af661805b9fa 100644 --- a/net/ieee802154/af_ieee802154.c +++ b/net/ieee802154/af_ieee802154.c | |||
@@ -136,7 +136,7 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg, | |||
136 | unsigned int cmd) | 136 | unsigned int cmd) |
137 | { | 137 | { |
138 | struct ifreq ifr; | 138 | struct ifreq ifr; |
139 | int ret = -EINVAL; | 139 | int ret = -ENOIOCTLCMD; |
140 | struct net_device *dev; | 140 | struct net_device *dev; |
141 | 141 | ||
142 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) | 142 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) |
@@ -146,8 +146,10 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg, | |||
146 | 146 | ||
147 | dev_load(sock_net(sk), ifr.ifr_name); | 147 | dev_load(sock_net(sk), ifr.ifr_name); |
148 | dev = dev_get_by_name(sock_net(sk), ifr.ifr_name); | 148 | dev = dev_get_by_name(sock_net(sk), ifr.ifr_name); |
149 | if (dev->type == ARPHRD_IEEE802154 || | 149 | |
150 | dev->type == ARPHRD_IEEE802154_PHY) | 150 | if ((dev->type == ARPHRD_IEEE802154 || |
151 | dev->type == ARPHRD_IEEE802154_PHY) && | ||
152 | dev->netdev_ops->ndo_do_ioctl) | ||
151 | ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd); | 153 | ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd); |
152 | 154 | ||
153 | if (!ret && copy_to_user(arg, &ifr, sizeof(struct ifreq))) | 155 | if (!ret && copy_to_user(arg, &ifr, sizeof(struct ifreq))) |
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c index 14d39840dd62..ba8b214dda8f 100644 --- a/net/ieee802154/dgram.c +++ b/net/ieee802154/dgram.c | |||
@@ -377,6 +377,18 @@ int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb) | |||
377 | return ret; | 377 | return ret; |
378 | } | 378 | } |
379 | 379 | ||
380 | static int dgram_getsockopt(struct sock *sk, int level, int optname, | ||
381 | char __user *optval, int __user *optlen) | ||
382 | { | ||
383 | return -EOPNOTSUPP; | ||
384 | } | ||
385 | |||
386 | static int dgram_setsockopt(struct sock *sk, int level, int optname, | ||
387 | char __user *optval, int __user optlen) | ||
388 | { | ||
389 | return -EOPNOTSUPP; | ||
390 | } | ||
391 | |||
380 | struct proto ieee802154_dgram_prot = { | 392 | struct proto ieee802154_dgram_prot = { |
381 | .name = "IEEE-802.15.4-MAC", | 393 | .name = "IEEE-802.15.4-MAC", |
382 | .owner = THIS_MODULE, | 394 | .owner = THIS_MODULE, |
@@ -391,5 +403,7 @@ struct proto ieee802154_dgram_prot = { | |||
391 | .connect = dgram_connect, | 403 | .connect = dgram_connect, |
392 | .disconnect = dgram_disconnect, | 404 | .disconnect = dgram_disconnect, |
393 | .ioctl = dgram_ioctl, | 405 | .ioctl = dgram_ioctl, |
406 | .getsockopt = dgram_getsockopt, | ||
407 | .setsockopt = dgram_setsockopt, | ||
394 | }; | 408 | }; |
395 | 409 | ||
diff --git a/net/ieee802154/raw.c b/net/ieee802154/raw.c index fca44d59f97e..9315977c4c61 100644 --- a/net/ieee802154/raw.c +++ b/net/ieee802154/raw.c | |||
@@ -238,6 +238,18 @@ void ieee802154_raw_deliver(struct net_device *dev, struct sk_buff *skb) | |||
238 | read_unlock(&raw_lock); | 238 | read_unlock(&raw_lock); |
239 | } | 239 | } |
240 | 240 | ||
241 | static int raw_getsockopt(struct sock *sk, int level, int optname, | ||
242 | char __user *optval, int __user *optlen) | ||
243 | { | ||
244 | return -EOPNOTSUPP; | ||
245 | } | ||
246 | |||
247 | static int raw_setsockopt(struct sock *sk, int level, int optname, | ||
248 | char __user *optval, int __user optlen) | ||
249 | { | ||
250 | return -EOPNOTSUPP; | ||
251 | } | ||
252 | |||
241 | struct proto ieee802154_raw_prot = { | 253 | struct proto ieee802154_raw_prot = { |
242 | .name = "IEEE-802.15.4-RAW", | 254 | .name = "IEEE-802.15.4-RAW", |
243 | .owner = THIS_MODULE, | 255 | .owner = THIS_MODULE, |
@@ -250,5 +262,7 @@ struct proto ieee802154_raw_prot = { | |||
250 | .unhash = raw_unhash, | 262 | .unhash = raw_unhash, |
251 | .connect = raw_connect, | 263 | .connect = raw_connect, |
252 | .disconnect = raw_disconnect, | 264 | .disconnect = raw_disconnect, |
265 | .getsockopt = raw_getsockopt, | ||
266 | .setsockopt = raw_setsockopt, | ||
253 | }; | 267 | }; |
254 | 268 | ||
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index cb4a0f4bd5e5..82c11dd10a62 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -951,7 +951,7 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev) | |||
951 | addend += 4; | 951 | addend += 4; |
952 | } | 952 | } |
953 | dev->needed_headroom = addend + hlen; | 953 | dev->needed_headroom = addend + hlen; |
954 | mtu -= dev->hard_header_len - addend; | 954 | mtu -= dev->hard_header_len + addend; |
955 | 955 | ||
956 | if (mtu < 68) | 956 | if (mtu < 68) |
957 | mtu = 68; | 957 | mtu = 68; |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 7d0821054729..7ffcd96fe591 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -813,6 +813,8 @@ int ip_append_data(struct sock *sk, | |||
813 | inet->cork.addr = ipc->addr; | 813 | inet->cork.addr = ipc->addr; |
814 | } | 814 | } |
815 | rt = *rtp; | 815 | rt = *rtp; |
816 | if (unlikely(!rt)) | ||
817 | return -EFAULT; | ||
816 | /* | 818 | /* |
817 | * We steal reference to this route, caller should not release it | 819 | * We steal reference to this route, caller should not release it |
818 | */ | 820 | */ |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index caa0278d30a9..45f9a2a42d56 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -306,8 +306,10 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
306 | v4addr != htonl(INADDR_ANY) && | 306 | v4addr != htonl(INADDR_ANY) && |
307 | chk_addr_ret != RTN_LOCAL && | 307 | chk_addr_ret != RTN_LOCAL && |
308 | chk_addr_ret != RTN_MULTICAST && | 308 | chk_addr_ret != RTN_MULTICAST && |
309 | chk_addr_ret != RTN_BROADCAST) | 309 | chk_addr_ret != RTN_BROADCAST) { |
310 | err = -EADDRNOTAVAIL; | ||
310 | goto out; | 311 | goto out; |
312 | } | ||
311 | } else { | 313 | } else { |
312 | if (addr_type != IPV6_ADDR_ANY) { | 314 | if (addr_type != IPV6_ADDR_ANY) { |
313 | struct net_device *dev = NULL; | 315 | struct net_device *dev = NULL; |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 80cf29aae096..50b43c57d5d8 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -715,6 +715,7 @@ static int irda_getname(struct socket *sock, struct sockaddr *uaddr, | |||
715 | struct sock *sk = sock->sk; | 715 | struct sock *sk = sock->sk; |
716 | struct irda_sock *self = irda_sk(sk); | 716 | struct irda_sock *self = irda_sk(sk); |
717 | 717 | ||
718 | memset(&saddr, 0, sizeof(saddr)); | ||
718 | if (peer) { | 719 | if (peer) { |
719 | if (sk->sk_state != TCP_ESTABLISHED) | 720 | if (sk->sk_state != TCP_ESTABLISHED) |
720 | return -ENOTCONN; | 721 | return -ENOTCONN; |
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 9208cf5f2bd5..c45eee1c0e8d 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
@@ -914,6 +914,7 @@ static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr, | |||
914 | struct llc_sock *llc = llc_sk(sk); | 914 | struct llc_sock *llc = llc_sk(sk); |
915 | int rc = 0; | 915 | int rc = 0; |
916 | 916 | ||
917 | memset(&sllc, 0, sizeof(sllc)); | ||
917 | lock_sock(sk); | 918 | lock_sock(sk); |
918 | if (sock_flag(sk, SOCK_ZAPPED)) | 919 | if (sock_flag(sk, SOCK_ZAPPED)) |
919 | goto out; | 920 | goto out; |
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index 9e5762ad307d..a24e59816b93 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
@@ -381,6 +381,14 @@ static void ieee80211_agg_splice_packets(struct ieee80211_local *local, | |||
381 | &local->hw, queue, | 381 | &local->hw, queue, |
382 | IEEE80211_QUEUE_STOP_REASON_AGGREGATION); | 382 | IEEE80211_QUEUE_STOP_REASON_AGGREGATION); |
383 | 383 | ||
384 | if (!(sta->ampdu_mlme.tid_state_tx[tid] & HT_ADDBA_REQUESTED_MSK)) | ||
385 | return; | ||
386 | |||
387 | if (WARN(!sta->ampdu_mlme.tid_tx[tid], | ||
388 | "TID %d gone but expected when splicing aggregates from" | ||
389 | "the pending queue\n", tid)) | ||
390 | return; | ||
391 | |||
384 | if (!skb_queue_empty(&sta->ampdu_mlme.tid_tx[tid]->pending)) { | 392 | if (!skb_queue_empty(&sta->ampdu_mlme.tid_tx[tid]->pending)) { |
385 | spin_lock_irqsave(&local->queue_stop_reason_lock, flags); | 393 | spin_lock_irqsave(&local->queue_stop_reason_lock, flags); |
386 | /* mark queue as pending, it is stopped already */ | 394 | /* mark queue as pending, it is stopped already */ |
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index ce267565e180..659a42d529e3 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -67,6 +67,8 @@ static DECLARE_WORK(todo_work, key_todo); | |||
67 | * | 67 | * |
68 | * @key: key to add to do item for | 68 | * @key: key to add to do item for |
69 | * @flag: todo flag(s) | 69 | * @flag: todo flag(s) |
70 | * | ||
71 | * Must be called with IRQs or softirqs disabled. | ||
70 | */ | 72 | */ |
71 | static void add_todo(struct ieee80211_key *key, u32 flag) | 73 | static void add_todo(struct ieee80211_key *key, u32 flag) |
72 | { | 74 | { |
@@ -140,9 +142,9 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key) | |||
140 | ret = drv_set_key(key->local, SET_KEY, &sdata->vif, sta, &key->conf); | 142 | ret = drv_set_key(key->local, SET_KEY, &sdata->vif, sta, &key->conf); |
141 | 143 | ||
142 | if (!ret) { | 144 | if (!ret) { |
143 | spin_lock(&todo_lock); | 145 | spin_lock_bh(&todo_lock); |
144 | key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; | 146 | key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; |
145 | spin_unlock(&todo_lock); | 147 | spin_unlock_bh(&todo_lock); |
146 | } | 148 | } |
147 | 149 | ||
148 | if (ret && ret != -ENOSPC && ret != -EOPNOTSUPP) | 150 | if (ret && ret != -ENOSPC && ret != -EOPNOTSUPP) |
@@ -164,12 +166,12 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) | |||
164 | if (!key || !key->local->ops->set_key) | 166 | if (!key || !key->local->ops->set_key) |
165 | return; | 167 | return; |
166 | 168 | ||
167 | spin_lock(&todo_lock); | 169 | spin_lock_bh(&todo_lock); |
168 | if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) { | 170 | if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) { |
169 | spin_unlock(&todo_lock); | 171 | spin_unlock_bh(&todo_lock); |
170 | return; | 172 | return; |
171 | } | 173 | } |
172 | spin_unlock(&todo_lock); | 174 | spin_unlock_bh(&todo_lock); |
173 | 175 | ||
174 | sta = get_sta_for_key(key); | 176 | sta = get_sta_for_key(key); |
175 | sdata = key->sdata; | 177 | sdata = key->sdata; |
@@ -188,9 +190,9 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) | |||
188 | wiphy_name(key->local->hw.wiphy), | 190 | wiphy_name(key->local->hw.wiphy), |
189 | key->conf.keyidx, sta ? sta->addr : bcast_addr, ret); | 191 | key->conf.keyidx, sta ? sta->addr : bcast_addr, ret); |
190 | 192 | ||
191 | spin_lock(&todo_lock); | 193 | spin_lock_bh(&todo_lock); |
192 | key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; | 194 | key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; |
193 | spin_unlock(&todo_lock); | 195 | spin_unlock_bh(&todo_lock); |
194 | } | 196 | } |
195 | 197 | ||
196 | static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, | 198 | static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, |
@@ -437,14 +439,14 @@ void ieee80211_key_link(struct ieee80211_key *key, | |||
437 | 439 | ||
438 | __ieee80211_key_replace(sdata, sta, old_key, key); | 440 | __ieee80211_key_replace(sdata, sta, old_key, key); |
439 | 441 | ||
440 | spin_unlock_irqrestore(&sdata->local->key_lock, flags); | ||
441 | |||
442 | /* free old key later */ | 442 | /* free old key later */ |
443 | add_todo(old_key, KEY_FLAG_TODO_DELETE); | 443 | add_todo(old_key, KEY_FLAG_TODO_DELETE); |
444 | 444 | ||
445 | add_todo(key, KEY_FLAG_TODO_ADD_DEBUGFS); | 445 | add_todo(key, KEY_FLAG_TODO_ADD_DEBUGFS); |
446 | if (netif_running(sdata->dev)) | 446 | if (netif_running(sdata->dev)) |
447 | add_todo(key, KEY_FLAG_TODO_HWACCEL_ADD); | 447 | add_todo(key, KEY_FLAG_TODO_HWACCEL_ADD); |
448 | |||
449 | spin_unlock_irqrestore(&sdata->local->key_lock, flags); | ||
448 | } | 450 | } |
449 | 451 | ||
450 | static void __ieee80211_key_free(struct ieee80211_key *key) | 452 | static void __ieee80211_key_free(struct ieee80211_key *key) |
@@ -547,7 +549,7 @@ static void __ieee80211_key_todo(void) | |||
547 | */ | 549 | */ |
548 | synchronize_rcu(); | 550 | synchronize_rcu(); |
549 | 551 | ||
550 | spin_lock(&todo_lock); | 552 | spin_lock_bh(&todo_lock); |
551 | while (!list_empty(&todo_list)) { | 553 | while (!list_empty(&todo_list)) { |
552 | key = list_first_entry(&todo_list, struct ieee80211_key, todo); | 554 | key = list_first_entry(&todo_list, struct ieee80211_key, todo); |
553 | list_del_init(&key->todo); | 555 | list_del_init(&key->todo); |
@@ -558,7 +560,7 @@ static void __ieee80211_key_todo(void) | |||
558 | KEY_FLAG_TODO_HWACCEL_REMOVE | | 560 | KEY_FLAG_TODO_HWACCEL_REMOVE | |
559 | KEY_FLAG_TODO_DELETE); | 561 | KEY_FLAG_TODO_DELETE); |
560 | key->flags &= ~todoflags; | 562 | key->flags &= ~todoflags; |
561 | spin_unlock(&todo_lock); | 563 | spin_unlock_bh(&todo_lock); |
562 | 564 | ||
563 | work_done = false; | 565 | work_done = false; |
564 | 566 | ||
@@ -591,9 +593,9 @@ static void __ieee80211_key_todo(void) | |||
591 | 593 | ||
592 | WARN_ON(!work_done); | 594 | WARN_ON(!work_done); |
593 | 595 | ||
594 | spin_lock(&todo_lock); | 596 | spin_lock_bh(&todo_lock); |
595 | } | 597 | } |
596 | spin_unlock(&todo_lock); | 598 | spin_unlock_bh(&todo_lock); |
597 | } | 599 | } |
598 | 600 | ||
599 | void ieee80211_key_todo(void) | 601 | void ieee80211_key_todo(void) |
diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c index 43f5676b1af4..d80b8192e0d4 100644 --- a/net/netfilter/xt_RATEEST.c +++ b/net/netfilter/xt_RATEEST.c | |||
@@ -74,7 +74,7 @@ static unsigned int | |||
74 | xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par) | 74 | xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par) |
75 | { | 75 | { |
76 | const struct xt_rateest_target_info *info = par->targinfo; | 76 | const struct xt_rateest_target_info *info = par->targinfo; |
77 | struct gnet_stats_basic *stats = &info->est->bstats; | 77 | struct gnet_stats_basic_packed *stats = &info->est->bstats; |
78 | 78 | ||
79 | spin_lock_bh(&info->est->lock); | 79 | spin_lock_bh(&info->est->lock); |
80 | stats->bytes += skb->len; | 80 | stats->bytes += skb->len; |
diff --git a/net/netfilter/xt_quota.c b/net/netfilter/xt_quota.c index 98fc190e8f0e..390b7d09fe51 100644 --- a/net/netfilter/xt_quota.c +++ b/net/netfilter/xt_quota.c | |||
@@ -52,7 +52,7 @@ static bool quota_mt_check(const struct xt_mtchk_param *par) | |||
52 | 52 | ||
53 | q->master = kmalloc(sizeof(*q->master), GFP_KERNEL); | 53 | q->master = kmalloc(sizeof(*q->master), GFP_KERNEL); |
54 | if (q->master == NULL) | 54 | if (q->master == NULL) |
55 | return -ENOMEM; | 55 | return false; |
56 | 56 | ||
57 | q->master->quota = q->quota; | 57 | q->master->quota = q->quota; |
58 | return true; | 58 | return true; |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index ce51ce012cda..ce1a34b99c23 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -847,6 +847,7 @@ static int nr_getname(struct socket *sock, struct sockaddr *uaddr, | |||
847 | sax->fsa_ax25.sax25_family = AF_NETROM; | 847 | sax->fsa_ax25.sax25_family = AF_NETROM; |
848 | sax->fsa_ax25.sax25_ndigis = 1; | 848 | sax->fsa_ax25.sax25_ndigis = 1; |
849 | sax->fsa_ax25.sax25_call = nr->user_addr; | 849 | sax->fsa_ax25.sax25_call = nr->user_addr; |
850 | memset(sax->fsa_digipeater, 0, sizeof(sax->fsa_digipeater)); | ||
850 | sax->fsa_digipeater[0] = nr->dest_addr; | 851 | sax->fsa_digipeater[0] = nr->dest_addr; |
851 | *uaddr_len = sizeof(struct full_sockaddr_ax25); | 852 | *uaddr_len = sizeof(struct full_sockaddr_ax25); |
852 | } else { | 853 | } else { |
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c index e943c16552a2..4eb1ac9a7679 100644 --- a/net/netrom/nr_route.c +++ b/net/netrom/nr_route.c | |||
@@ -630,23 +630,23 @@ out: | |||
630 | return dev; | 630 | return dev; |
631 | } | 631 | } |
632 | 632 | ||
633 | static ax25_digi *nr_call_to_digi(int ndigis, ax25_address *digipeaters) | 633 | static ax25_digi *nr_call_to_digi(ax25_digi *digi, int ndigis, |
634 | ax25_address *digipeaters) | ||
634 | { | 635 | { |
635 | static ax25_digi ax25_digi; | ||
636 | int i; | 636 | int i; |
637 | 637 | ||
638 | if (ndigis == 0) | 638 | if (ndigis == 0) |
639 | return NULL; | 639 | return NULL; |
640 | 640 | ||
641 | for (i = 0; i < ndigis; i++) { | 641 | for (i = 0; i < ndigis; i++) { |
642 | ax25_digi.calls[i] = digipeaters[i]; | 642 | digi->calls[i] = digipeaters[i]; |
643 | ax25_digi.repeated[i] = 0; | 643 | digi->repeated[i] = 0; |
644 | } | 644 | } |
645 | 645 | ||
646 | ax25_digi.ndigi = ndigis; | 646 | digi->ndigi = ndigis; |
647 | ax25_digi.lastrepeat = -1; | 647 | digi->lastrepeat = -1; |
648 | 648 | ||
649 | return &ax25_digi; | 649 | return digi; |
650 | } | 650 | } |
651 | 651 | ||
652 | /* | 652 | /* |
@@ -656,6 +656,7 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg) | |||
656 | { | 656 | { |
657 | struct nr_route_struct nr_route; | 657 | struct nr_route_struct nr_route; |
658 | struct net_device *dev; | 658 | struct net_device *dev; |
659 | ax25_digi digi; | ||
659 | int ret; | 660 | int ret; |
660 | 661 | ||
661 | switch (cmd) { | 662 | switch (cmd) { |
@@ -673,13 +674,15 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg) | |||
673 | ret = nr_add_node(&nr_route.callsign, | 674 | ret = nr_add_node(&nr_route.callsign, |
674 | nr_route.mnemonic, | 675 | nr_route.mnemonic, |
675 | &nr_route.neighbour, | 676 | &nr_route.neighbour, |
676 | nr_call_to_digi(nr_route.ndigis, nr_route.digipeaters), | 677 | nr_call_to_digi(&digi, nr_route.ndigis, |
678 | nr_route.digipeaters), | ||
677 | dev, nr_route.quality, | 679 | dev, nr_route.quality, |
678 | nr_route.obs_count); | 680 | nr_route.obs_count); |
679 | break; | 681 | break; |
680 | case NETROM_NEIGH: | 682 | case NETROM_NEIGH: |
681 | ret = nr_add_neigh(&nr_route.callsign, | 683 | ret = nr_add_neigh(&nr_route.callsign, |
682 | nr_call_to_digi(nr_route.ndigis, nr_route.digipeaters), | 684 | nr_call_to_digi(&digi, nr_route.ndigis, |
685 | nr_route.digipeaters), | ||
683 | dev, nr_route.quality); | 686 | dev, nr_route.quality); |
684 | break; | 687 | break; |
685 | default: | 688 | default: |
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c index b0d6ddd82a9d..c2b77a698695 100644 --- a/net/phonet/pn_dev.c +++ b/net/phonet/pn_dev.c | |||
@@ -96,7 +96,7 @@ struct net_device *phonet_device_get(struct net *net) | |||
96 | { | 96 | { |
97 | struct phonet_device_list *pndevs = phonet_device_list(net); | 97 | struct phonet_device_list *pndevs = phonet_device_list(net); |
98 | struct phonet_device *pnd; | 98 | struct phonet_device *pnd; |
99 | struct net_device *dev; | 99 | struct net_device *dev = NULL; |
100 | 100 | ||
101 | spin_lock_bh(&pndevs->lock); | 101 | spin_lock_bh(&pndevs->lock); |
102 | list_for_each_entry(pnd, &pndevs->list, list) { | 102 | list_for_each_entry(pnd, &pndevs->list, list) { |
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index f0a76f6bca71..e5f478ca3d61 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -954,6 +954,7 @@ static int rose_getname(struct socket *sock, struct sockaddr *uaddr, | |||
954 | struct rose_sock *rose = rose_sk(sk); | 954 | struct rose_sock *rose = rose_sk(sk); |
955 | int n; | 955 | int n; |
956 | 956 | ||
957 | memset(srose, 0, sizeof(*srose)); | ||
957 | if (peer != 0) { | 958 | if (peer != 0) { |
958 | if (sk->sk_state != TCP_ESTABLISHED) | 959 | if (sk->sk_state != TCP_ESTABLISHED) |
959 | return -ENOTCONN; | 960 | return -ENOTCONN; |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 24d17ce9c294..fdb694e9f759 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -1456,6 +1456,8 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q, | |||
1456 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); | 1456 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); |
1457 | tcm = NLMSG_DATA(nlh); | 1457 | tcm = NLMSG_DATA(nlh); |
1458 | tcm->tcm_family = AF_UNSPEC; | 1458 | tcm->tcm_family = AF_UNSPEC; |
1459 | tcm->tcm__pad1 = 0; | ||
1460 | tcm->tcm__pad2 = 0; | ||
1459 | tcm->tcm_ifindex = qdisc_dev(q)->ifindex; | 1461 | tcm->tcm_ifindex = qdisc_dev(q)->ifindex; |
1460 | tcm->tcm_parent = q->handle; | 1462 | tcm->tcm_parent = q->handle; |
1461 | tcm->tcm_handle = q->handle; | 1463 | tcm->tcm_handle = q->handle; |
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index 2a8b83af7c47..ab82f145f689 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -49,7 +49,7 @@ struct atm_flow_data { | |||
49 | struct socket *sock; /* for closing */ | 49 | struct socket *sock; /* for closing */ |
50 | u32 classid; /* x:y type ID */ | 50 | u32 classid; /* x:y type ID */ |
51 | int ref; /* reference count */ | 51 | int ref; /* reference count */ |
52 | struct gnet_stats_basic bstats; | 52 | struct gnet_stats_basic_packed bstats; |
53 | struct gnet_stats_queue qstats; | 53 | struct gnet_stats_queue qstats; |
54 | struct atm_flow_data *next; | 54 | struct atm_flow_data *next; |
55 | struct atm_flow_data *excess; /* flow for excess traffic; | 55 | struct atm_flow_data *excess; /* flow for excess traffic; |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 23a167670fd5..d5798e17a832 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -128,7 +128,7 @@ struct cbq_class | |||
128 | long avgidle; | 128 | long avgidle; |
129 | long deficit; /* Saved deficit for WRR */ | 129 | long deficit; /* Saved deficit for WRR */ |
130 | psched_time_t penalized; | 130 | psched_time_t penalized; |
131 | struct gnet_stats_basic bstats; | 131 | struct gnet_stats_basic_packed bstats; |
132 | struct gnet_stats_queue qstats; | 132 | struct gnet_stats_queue qstats; |
133 | struct gnet_stats_rate_est rate_est; | 133 | struct gnet_stats_rate_est rate_est; |
134 | struct tc_cbq_xstats xstats; | 134 | struct tc_cbq_xstats xstats; |
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c index 7597fe146866..12b2fb04b29b 100644 --- a/net/sched/sch_drr.c +++ b/net/sched/sch_drr.c | |||
@@ -22,7 +22,7 @@ struct drr_class { | |||
22 | unsigned int refcnt; | 22 | unsigned int refcnt; |
23 | unsigned int filter_cnt; | 23 | unsigned int filter_cnt; |
24 | 24 | ||
25 | struct gnet_stats_basic bstats; | 25 | struct gnet_stats_basic_packed bstats; |
26 | struct gnet_stats_queue qstats; | 26 | struct gnet_stats_queue qstats; |
27 | struct gnet_stats_rate_est rate_est; | 27 | struct gnet_stats_rate_est rate_est; |
28 | struct list_head alist; | 28 | struct list_head alist; |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 362c2811b2df..dad0144423da 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -116,7 +116,7 @@ struct hfsc_class | |||
116 | struct Qdisc_class_common cl_common; | 116 | struct Qdisc_class_common cl_common; |
117 | unsigned int refcnt; /* usage count */ | 117 | unsigned int refcnt; /* usage count */ |
118 | 118 | ||
119 | struct gnet_stats_basic bstats; | 119 | struct gnet_stats_basic_packed bstats; |
120 | struct gnet_stats_queue qstats; | 120 | struct gnet_stats_queue qstats; |
121 | struct gnet_stats_rate_est rate_est; | 121 | struct gnet_stats_rate_est rate_est; |
122 | unsigned int level; /* class level in hierarchy */ | 122 | unsigned int level; /* class level in hierarchy */ |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 88cd02626621..ec4d46399d59 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -74,7 +74,7 @@ enum htb_cmode { | |||
74 | struct htb_class { | 74 | struct htb_class { |
75 | struct Qdisc_class_common common; | 75 | struct Qdisc_class_common common; |
76 | /* general class parameters */ | 76 | /* general class parameters */ |
77 | struct gnet_stats_basic bstats; | 77 | struct gnet_stats_basic_packed bstats; |
78 | struct gnet_stats_queue qstats; | 78 | struct gnet_stats_queue qstats; |
79 | struct gnet_stats_rate_est rate_est; | 79 | struct gnet_stats_rate_est rate_est; |
80 | struct tc_htb_xstats xstats; /* our special stats */ | 80 | struct tc_htb_xstats xstats; /* our special stats */ |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 79cbd47f4df7..a76da657244a 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -160,6 +160,7 @@ static void sctp_proc_exit(void) | |||
160 | remove_proc_entry("sctp", init_net.proc_net); | 160 | remove_proc_entry("sctp", init_net.proc_net); |
161 | } | 161 | } |
162 | #endif | 162 | #endif |
163 | percpu_counter_destroy(&sctp_sockets_allocated); | ||
163 | } | 164 | } |
164 | 165 | ||
165 | /* Private helper to extract ipv4 address and stash them in | 166 | /* Private helper to extract ipv4 address and stash them in |
diff --git a/net/socket.c b/net/socket.c index 791d71a36a93..6d4716559047 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -736,7 +736,7 @@ static ssize_t sock_sendpage(struct file *file, struct page *page, | |||
736 | if (more) | 736 | if (more) |
737 | flags |= MSG_MORE; | 737 | flags |= MSG_MORE; |
738 | 738 | ||
739 | return sock->ops->sendpage(sock, page, offset, size, flags); | 739 | return kernel_sendpage(sock, page, offset, size, flags); |
740 | } | 740 | } |
741 | 741 | ||
742 | static ssize_t sock_splice_read(struct file *file, loff_t *ppos, | 742 | static ssize_t sock_splice_read(struct file *file, loff_t *ppos, |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index ebfcf9b89909..df1039f077c2 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -937,6 +937,7 @@ static inline void | |||
937 | rpc_task_force_reencode(struct rpc_task *task) | 937 | rpc_task_force_reencode(struct rpc_task *task) |
938 | { | 938 | { |
939 | task->tk_rqstp->rq_snd_buf.len = 0; | 939 | task->tk_rqstp->rq_snd_buf.len = 0; |
940 | task->tk_rqstp->rq_bytes_sent = 0; | ||
940 | } | 941 | } |
941 | 942 | ||
942 | static inline void | 943 | static inline void |
diff --git a/net/xfrm/xfrm_hash.h b/net/xfrm/xfrm_hash.h index d401dc8f05ed..e5195c99f71e 100644 --- a/net/xfrm/xfrm_hash.h +++ b/net/xfrm/xfrm_hash.h | |||
@@ -16,7 +16,7 @@ static inline unsigned int __xfrm6_addr_hash(xfrm_address_t *addr) | |||
16 | 16 | ||
17 | static inline unsigned int __xfrm4_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr) | 17 | static inline unsigned int __xfrm4_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr) |
18 | { | 18 | { |
19 | return ntohl(daddr->a4 ^ saddr->a4); | 19 | return ntohl(daddr->a4 + saddr->a4); |
20 | } | 20 | } |
21 | 21 | ||
22 | static inline unsigned int __xfrm6_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr) | 22 | static inline unsigned int __xfrm6_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr) |
diff --git a/security/Kconfig b/security/Kconfig index d23c839038f0..4c865345caa0 100644 --- a/security/Kconfig +++ b/security/Kconfig | |||
@@ -113,6 +113,22 @@ config SECURITY_ROOTPLUG | |||
113 | 113 | ||
114 | If you are unsure how to answer this question, answer N. | 114 | If you are unsure how to answer this question, answer N. |
115 | 115 | ||
116 | config LSM_MMAP_MIN_ADDR | ||
117 | int "Low address space for LSM to protect from user allocation" | ||
118 | depends on SECURITY && SECURITY_SELINUX | ||
119 | default 65536 | ||
120 | help | ||
121 | This is the portion of low virtual memory which should be protected | ||
122 | from userspace allocation. Keeping a user from writing to low pages | ||
123 | can help reduce the impact of kernel NULL pointer bugs. | ||
124 | |||
125 | For most ia64, ppc64 and x86 users with lots of address space | ||
126 | a value of 65536 is reasonable and should cause no problems. | ||
127 | On arm and other archs it should not be higher than 32768. | ||
128 | Programs which use vm86 functionality or have some need to map | ||
129 | this low address space will need the permission specific to the | ||
130 | systems running LSM. | ||
131 | |||
116 | source security/selinux/Kconfig | 132 | source security/selinux/Kconfig |
117 | source security/smack/Kconfig | 133 | source security/smack/Kconfig |
118 | source security/tomoyo/Kconfig | 134 | source security/tomoyo/Kconfig |
diff --git a/security/Makefile b/security/Makefile index c67557cdaa85..b56e7f9ecbc2 100644 --- a/security/Makefile +++ b/security/Makefile | |||
@@ -8,7 +8,7 @@ subdir-$(CONFIG_SECURITY_SMACK) += smack | |||
8 | subdir-$(CONFIG_SECURITY_TOMOYO) += tomoyo | 8 | subdir-$(CONFIG_SECURITY_TOMOYO) += tomoyo |
9 | 9 | ||
10 | # always enable default capabilities | 10 | # always enable default capabilities |
11 | obj-y += commoncap.o | 11 | obj-y += commoncap.o min_addr.o |
12 | 12 | ||
13 | # Object file lists | 13 | # Object file lists |
14 | obj-$(CONFIG_SECURITY) += security.o capability.o | 14 | obj-$(CONFIG_SECURITY) += security.o capability.o |
diff --git a/security/capability.c b/security/capability.c index 21b6cead6a8e..88f752e8152c 100644 --- a/security/capability.c +++ b/security/capability.c | |||
@@ -330,15 +330,6 @@ static int cap_file_ioctl(struct file *file, unsigned int command, | |||
330 | return 0; | 330 | return 0; |
331 | } | 331 | } |
332 | 332 | ||
333 | static int cap_file_mmap(struct file *file, unsigned long reqprot, | ||
334 | unsigned long prot, unsigned long flags, | ||
335 | unsigned long addr, unsigned long addr_only) | ||
336 | { | ||
337 | if ((addr < mmap_min_addr) && !capable(CAP_SYS_RAWIO)) | ||
338 | return -EACCES; | ||
339 | return 0; | ||
340 | } | ||
341 | |||
342 | static int cap_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, | 333 | static int cap_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, |
343 | unsigned long prot) | 334 | unsigned long prot) |
344 | { | 335 | { |
diff --git a/security/commoncap.c b/security/commoncap.c index 48b7e0228fa3..e3097c0a1311 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -984,3 +984,33 @@ int cap_vm_enough_memory(struct mm_struct *mm, long pages) | |||
984 | cap_sys_admin = 1; | 984 | cap_sys_admin = 1; |
985 | return __vm_enough_memory(mm, pages, cap_sys_admin); | 985 | return __vm_enough_memory(mm, pages, cap_sys_admin); |
986 | } | 986 | } |
987 | |||
988 | /* | ||
989 | * cap_file_mmap - check if able to map given addr | ||
990 | * @file: unused | ||
991 | * @reqprot: unused | ||
992 | * @prot: unused | ||
993 | * @flags: unused | ||
994 | * @addr: address attempting to be mapped | ||
995 | * @addr_only: unused | ||
996 | * | ||
997 | * If the process is attempting to map memory below mmap_min_addr they need | ||
998 | * CAP_SYS_RAWIO. The other parameters to this function are unused by the | ||
999 | * capability security module. Returns 0 if this mapping should be allowed | ||
1000 | * -EPERM if not. | ||
1001 | */ | ||
1002 | int cap_file_mmap(struct file *file, unsigned long reqprot, | ||
1003 | unsigned long prot, unsigned long flags, | ||
1004 | unsigned long addr, unsigned long addr_only) | ||
1005 | { | ||
1006 | int ret = 0; | ||
1007 | |||
1008 | if (addr < dac_mmap_min_addr) { | ||
1009 | ret = cap_capable(current, current_cred(), CAP_SYS_RAWIO, | ||
1010 | SECURITY_CAP_AUDIT); | ||
1011 | /* set PF_SUPERPRIV if it turns out we allow the low mmap */ | ||
1012 | if (ret == 0) | ||
1013 | current->flags |= PF_SUPERPRIV; | ||
1014 | } | ||
1015 | return ret; | ||
1016 | } | ||
diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c index 63003a63aaee..46642a19bc78 100644 --- a/security/integrity/ima/ima_crypto.c +++ b/security/integrity/ima/ima_crypto.c | |||
@@ -45,9 +45,9 @@ int ima_calc_hash(struct file *file, char *digest) | |||
45 | { | 45 | { |
46 | struct hash_desc desc; | 46 | struct hash_desc desc; |
47 | struct scatterlist sg[1]; | 47 | struct scatterlist sg[1]; |
48 | loff_t i_size; | 48 | loff_t i_size, offset = 0; |
49 | char *rbuf; | 49 | char *rbuf; |
50 | int rc, offset = 0; | 50 | int rc; |
51 | 51 | ||
52 | rc = init_desc(&desc); | 52 | rc = init_desc(&desc); |
53 | if (rc != 0) | 53 | if (rc != 0) |
@@ -67,6 +67,8 @@ int ima_calc_hash(struct file *file, char *digest) | |||
67 | rc = rbuf_len; | 67 | rc = rbuf_len; |
68 | break; | 68 | break; |
69 | } | 69 | } |
70 | if (rbuf_len == 0) | ||
71 | break; | ||
70 | offset += rbuf_len; | 72 | offset += rbuf_len; |
71 | sg_init_one(sg, rbuf, rbuf_len); | 73 | sg_init_one(sg, rbuf, rbuf_len); |
72 | 74 | ||
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index 101c512564ec..4732f5e5d127 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c | |||
@@ -262,6 +262,8 @@ void ima_counts_put(struct path *path, int mask) | |||
262 | else if (mask & (MAY_READ | MAY_EXEC)) | 262 | else if (mask & (MAY_READ | MAY_EXEC)) |
263 | iint->readcount--; | 263 | iint->readcount--; |
264 | mutex_unlock(&iint->mutex); | 264 | mutex_unlock(&iint->mutex); |
265 | |||
266 | kref_put(&iint->refcount, iint_free); | ||
265 | } | 267 | } |
266 | 268 | ||
267 | /* | 269 | /* |
@@ -291,6 +293,8 @@ void ima_counts_get(struct file *file) | |||
291 | if (file->f_mode & FMODE_WRITE) | 293 | if (file->f_mode & FMODE_WRITE) |
292 | iint->writecount++; | 294 | iint->writecount++; |
293 | mutex_unlock(&iint->mutex); | 295 | mutex_unlock(&iint->mutex); |
296 | |||
297 | kref_put(&iint->refcount, iint_free); | ||
294 | } | 298 | } |
295 | EXPORT_SYMBOL_GPL(ima_counts_get); | 299 | EXPORT_SYMBOL_GPL(ima_counts_get); |
296 | 300 | ||
diff --git a/security/min_addr.c b/security/min_addr.c new file mode 100644 index 000000000000..14cc7b3b8d03 --- /dev/null +++ b/security/min_addr.c | |||
@@ -0,0 +1,49 @@ | |||
1 | #include <linux/init.h> | ||
2 | #include <linux/mm.h> | ||
3 | #include <linux/security.h> | ||
4 | #include <linux/sysctl.h> | ||
5 | |||
6 | /* amount of vm to protect from userspace access by both DAC and the LSM*/ | ||
7 | unsigned long mmap_min_addr; | ||
8 | /* amount of vm to protect from userspace using CAP_SYS_RAWIO (DAC) */ | ||
9 | unsigned long dac_mmap_min_addr = CONFIG_DEFAULT_MMAP_MIN_ADDR; | ||
10 | /* amount of vm to protect from userspace using the LSM = CONFIG_LSM_MMAP_MIN_ADDR */ | ||
11 | |||
12 | /* | ||
13 | * Update mmap_min_addr = max(dac_mmap_min_addr, CONFIG_LSM_MMAP_MIN_ADDR) | ||
14 | */ | ||
15 | static void update_mmap_min_addr(void) | ||
16 | { | ||
17 | #ifdef CONFIG_LSM_MMAP_MIN_ADDR | ||
18 | if (dac_mmap_min_addr > CONFIG_LSM_MMAP_MIN_ADDR) | ||
19 | mmap_min_addr = dac_mmap_min_addr; | ||
20 | else | ||
21 | mmap_min_addr = CONFIG_LSM_MMAP_MIN_ADDR; | ||
22 | #else | ||
23 | mmap_min_addr = dac_mmap_min_addr; | ||
24 | #endif | ||
25 | } | ||
26 | |||
27 | /* | ||
28 | * sysctl handler which just sets dac_mmap_min_addr = the new value and then | ||
29 | * calls update_mmap_min_addr() so non MAP_FIXED hints get rounded properly | ||
30 | */ | ||
31 | int mmap_min_addr_handler(struct ctl_table *table, int write, struct file *filp, | ||
32 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
33 | { | ||
34 | int ret; | ||
35 | |||
36 | ret = proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos); | ||
37 | |||
38 | update_mmap_min_addr(); | ||
39 | |||
40 | return ret; | ||
41 | } | ||
42 | |||
43 | int __init init_mmap_min_addr(void) | ||
44 | { | ||
45 | update_mmap_min_addr(); | ||
46 | |||
47 | return 0; | ||
48 | } | ||
49 | pure_initcall(init_mmap_min_addr); | ||
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 15c2a08a66f1..8d8b69c5664e 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1285,6 +1285,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1285 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, | 1285 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, |
1286 | context, len); | 1286 | context, len); |
1287 | if (rc == -ERANGE) { | 1287 | if (rc == -ERANGE) { |
1288 | kfree(context); | ||
1289 | |||
1288 | /* Need a larger buffer. Query for the right size. */ | 1290 | /* Need a larger buffer. Query for the right size. */ |
1289 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, | 1291 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, |
1290 | NULL, 0); | 1292 | NULL, 0); |
@@ -1292,7 +1294,6 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1292 | dput(dentry); | 1294 | dput(dentry); |
1293 | goto out_unlock; | 1295 | goto out_unlock; |
1294 | } | 1296 | } |
1295 | kfree(context); | ||
1296 | len = rc; | 1297 | len = rc; |
1297 | context = kmalloc(len+1, GFP_NOFS); | 1298 | context = kmalloc(len+1, GFP_NOFS); |
1298 | if (!context) { | 1299 | if (!context) { |
@@ -3029,9 +3030,21 @@ static int selinux_file_mmap(struct file *file, unsigned long reqprot, | |||
3029 | int rc = 0; | 3030 | int rc = 0; |
3030 | u32 sid = current_sid(); | 3031 | u32 sid = current_sid(); |
3031 | 3032 | ||
3032 | if (addr < mmap_min_addr) | 3033 | /* |
3034 | * notice that we are intentionally putting the SELinux check before | ||
3035 | * the secondary cap_file_mmap check. This is such a likely attempt | ||
3036 | * at bad behaviour/exploit that we always want to get the AVC, even | ||
3037 | * if DAC would have also denied the operation. | ||
3038 | */ | ||
3039 | if (addr < CONFIG_LSM_MMAP_MIN_ADDR) { | ||
3033 | rc = avc_has_perm(sid, sid, SECCLASS_MEMPROTECT, | 3040 | rc = avc_has_perm(sid, sid, SECCLASS_MEMPROTECT, |
3034 | MEMPROTECT__MMAP_ZERO, NULL); | 3041 | MEMPROTECT__MMAP_ZERO, NULL); |
3042 | if (rc) | ||
3043 | return rc; | ||
3044 | } | ||
3045 | |||
3046 | /* do DAC check on address space usage */ | ||
3047 | rc = cap_file_mmap(file, reqprot, prot, flags, addr, addr_only); | ||
3035 | if (rc || addr_only) | 3048 | if (rc || addr_only) |
3036 | return rc; | 3049 | return rc; |
3037 | 3050 | ||
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 72cfd47af6b8..9db60d831bb2 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -943,47 +943,24 @@ static int snd_interval_ratden(struct snd_interval *i, | |||
943 | int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask) | 943 | int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask) |
944 | { | 944 | { |
945 | unsigned int k; | 945 | unsigned int k; |
946 | int changed = 0; | 946 | struct snd_interval list_range; |
947 | 947 | ||
948 | if (!count) { | 948 | if (!count) { |
949 | i->empty = 1; | 949 | i->empty = 1; |
950 | return -EINVAL; | 950 | return -EINVAL; |
951 | } | 951 | } |
952 | snd_interval_any(&list_range); | ||
953 | list_range.min = UINT_MAX; | ||
954 | list_range.max = 0; | ||
952 | for (k = 0; k < count; k++) { | 955 | for (k = 0; k < count; k++) { |
953 | if (mask && !(mask & (1 << k))) | 956 | if (mask && !(mask & (1 << k))) |
954 | continue; | 957 | continue; |
955 | if (i->min == list[k] && !i->openmin) | 958 | if (!snd_interval_test(i, list[k])) |
956 | goto _l1; | ||
957 | if (i->min < list[k]) { | ||
958 | i->min = list[k]; | ||
959 | i->openmin = 0; | ||
960 | changed = 1; | ||
961 | goto _l1; | ||
962 | } | ||
963 | } | ||
964 | i->empty = 1; | ||
965 | return -EINVAL; | ||
966 | _l1: | ||
967 | for (k = count; k-- > 0;) { | ||
968 | if (mask && !(mask & (1 << k))) | ||
969 | continue; | 959 | continue; |
970 | if (i->max == list[k] && !i->openmax) | 960 | list_range.min = min(list_range.min, list[k]); |
971 | goto _l2; | 961 | list_range.max = max(list_range.max, list[k]); |
972 | if (i->max > list[k]) { | ||
973 | i->max = list[k]; | ||
974 | i->openmax = 0; | ||
975 | changed = 1; | ||
976 | goto _l2; | ||
977 | } | ||
978 | } | 962 | } |
979 | i->empty = 1; | 963 | return snd_interval_refine(i, &list_range); |
980 | return -EINVAL; | ||
981 | _l2: | ||
982 | if (snd_interval_checkempty(i)) { | ||
983 | i->empty = 1; | ||
984 | return -EINVAL; | ||
985 | } | ||
986 | return changed; | ||
987 | } | 964 | } |
988 | 965 | ||
989 | EXPORT_SYMBOL(snd_interval_list); | 966 | EXPORT_SYMBOL(snd_interval_list); |
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index c551006e2920..76d76c08339b 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -310,12 +310,16 @@ static int snd_ali_codec_ready(struct snd_ali *codec, | |||
310 | unsigned int res; | 310 | unsigned int res; |
311 | 311 | ||
312 | end_time = jiffies + msecs_to_jiffies(250); | 312 | end_time = jiffies + msecs_to_jiffies(250); |
313 | do { | 313 | |
314 | for (;;) { | ||
314 | res = snd_ali_5451_peek(codec,port); | 315 | res = snd_ali_5451_peek(codec,port); |
315 | if (!(res & 0x8000)) | 316 | if (!(res & 0x8000)) |
316 | return 0; | 317 | return 0; |
318 | if (!time_after_eq(end_time, jiffies)) | ||
319 | break; | ||
317 | schedule_timeout_uninterruptible(1); | 320 | schedule_timeout_uninterruptible(1); |
318 | } while (time_after_eq(end_time, jiffies)); | 321 | } |
322 | |||
319 | snd_ali_5451_poke(codec, port, res & ~0x8000); | 323 | snd_ali_5451_poke(codec, port, res & ~0x8000); |
320 | snd_printdd("ali_codec_ready: codec is not ready.\n "); | 324 | snd_printdd("ali_codec_ready: codec is not ready.\n "); |
321 | return -EIO; | 325 | return -EIO; |
@@ -327,15 +331,17 @@ static int snd_ali_stimer_ready(struct snd_ali *codec) | |||
327 | unsigned long dwChk1,dwChk2; | 331 | unsigned long dwChk1,dwChk2; |
328 | 332 | ||
329 | dwChk1 = snd_ali_5451_peek(codec, ALI_STIMER); | 333 | dwChk1 = snd_ali_5451_peek(codec, ALI_STIMER); |
330 | dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); | ||
331 | |||
332 | end_time = jiffies + msecs_to_jiffies(250); | 334 | end_time = jiffies + msecs_to_jiffies(250); |
333 | do { | 335 | |
336 | for (;;) { | ||
334 | dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); | 337 | dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); |
335 | if (dwChk2 != dwChk1) | 338 | if (dwChk2 != dwChk1) |
336 | return 0; | 339 | return 0; |
340 | if (!time_after_eq(end_time, jiffies)) | ||
341 | break; | ||
337 | schedule_timeout_uninterruptible(1); | 342 | schedule_timeout_uninterruptible(1); |
338 | } while (time_after_eq(end_time, jiffies)); | 343 | } |
344 | |||
339 | snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n"); | 345 | snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n"); |
340 | return -EIO; | 346 | return -EIO; |
341 | } | 347 | } |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 3da85caf8af1..403588c6e3f6 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -3835,9 +3835,11 @@ static struct hda_verb ad1884a_laptop_verbs[] = { | |||
3835 | /* Port-F (int speaker) mixer - route only from analog mixer */ | 3835 | /* Port-F (int speaker) mixer - route only from analog mixer */ |
3836 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 3836 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
3837 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 3837 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
3838 | /* Port-F pin */ | 3838 | /* Port-F (int speaker) pin */ |
3839 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 3839 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
3840 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3840 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
3841 | /* required for compaq 6530s/6531s speaker output */ | ||
3842 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
3841 | /* Port-C pin - internal mic-in */ | 3843 | /* Port-C pin - internal mic-in */ |
3842 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 3844 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3843 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ | 3845 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 51c44fdbc0f0..30eeb304351c 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -6423,9 +6423,9 @@ static struct hda_verb alc885_mbp_ch2_init[] = { | |||
6423 | }; | 6423 | }; |
6424 | 6424 | ||
6425 | /* | 6425 | /* |
6426 | * 6ch mode | 6426 | * 4ch mode |
6427 | */ | 6427 | */ |
6428 | static struct hda_verb alc885_mbp_ch6_init[] = { | 6428 | static struct hda_verb alc885_mbp_ch4_init[] = { |
6429 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | 6429 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
6430 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 6430 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
6431 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | 6431 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
@@ -6434,9 +6434,9 @@ static struct hda_verb alc885_mbp_ch6_init[] = { | |||
6434 | { } /* end */ | 6434 | { } /* end */ |
6435 | }; | 6435 | }; |
6436 | 6436 | ||
6437 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { | 6437 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
6438 | { 2, alc885_mbp_ch2_init }, | 6438 | { 2, alc885_mbp_ch2_init }, |
6439 | { 6, alc885_mbp_ch6_init }, | 6439 | { 4, alc885_mbp_ch4_init }, |
6440 | }; | 6440 | }; |
6441 | 6441 | ||
6442 | /* | 6442 | /* |
@@ -6497,10 +6497,11 @@ static struct snd_kcontrol_new alc882_base_mixer[] = { | |||
6497 | }; | 6497 | }; |
6498 | 6498 | ||
6499 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { | 6499 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
6500 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | 6500 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
6501 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | 6501 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
6502 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), | 6502 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
6503 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | 6503 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
6504 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | ||
6504 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | 6505 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
6505 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | 6506 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
6506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | 6507 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
@@ -6814,14 +6815,18 @@ static struct hda_verb alc885_mbp3_init_verbs[] = { | |||
6814 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 6815 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
6815 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 6816 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
6816 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 6817 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
6818 | /* HP mixer */ | ||
6819 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
6820 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
6821 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
6817 | /* Front Pin: output 0 (0x0c) */ | 6822 | /* Front Pin: output 0 (0x0c) */ |
6818 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 6823 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
6819 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 6824 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
6820 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | 6825 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
6821 | /* HP Pin: output 0 (0x0d) */ | 6826 | /* HP Pin: output 0 (0x0e) */ |
6822 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | 6827 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
6823 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 6828 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
6824 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | 6829 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
6825 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | 6830 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
6826 | /* Mic (rear) pin: input vref at 80% */ | 6831 | /* Mic (rear) pin: input vref at 80% */ |
6827 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 6832 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
@@ -7195,10 +7200,11 @@ static struct alc_config_preset alc882_presets[] = { | |||
7195 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | 7200 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
7196 | .init_verbs = { alc885_mbp3_init_verbs, | 7201 | .init_verbs = { alc885_mbp3_init_verbs, |
7197 | alc880_gpio1_init_verbs }, | 7202 | alc880_gpio1_init_verbs }, |
7198 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | 7203 | .num_dacs = 2, |
7199 | .dac_nids = alc882_dac_nids, | 7204 | .dac_nids = alc882_dac_nids, |
7200 | .channel_mode = alc885_mbp_6ch_modes, | 7205 | .hp_nid = 0x04, |
7201 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), | 7206 | .channel_mode = alc885_mbp_4ch_modes, |
7207 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | ||
7202 | .input_mux = &alc882_capture_source, | 7208 | .input_mux = &alc882_capture_source, |
7203 | .dig_out_nid = ALC882_DIGOUT_NID, | 7209 | .dig_out_nid = ALC882_DIGOUT_NID, |
7204 | .dig_in_nid = ALC882_DIGIN_NID, | 7210 | .dig_in_nid = ALC882_DIGIN_NID, |
@@ -12521,8 +12527,6 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = { | |||
12521 | ALC268_TOSHIBA), | 12527 | ALC268_TOSHIBA), |
12522 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), | 12528 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
12523 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), | 12529 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
12524 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", | ||
12525 | ALC268_TOSHIBA), | ||
12526 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), | 12530 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
12527 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), | 12531 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
12528 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), | 12532 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
@@ -12530,6 +12534,15 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = { | |||
12530 | {} | 12534 | {} |
12531 | }; | 12535 | }; |
12532 | 12536 | ||
12537 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ | ||
12538 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { | ||
12539 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), | ||
12540 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), | ||
12541 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", | ||
12542 | ALC268_TOSHIBA), | ||
12543 | {} | ||
12544 | }; | ||
12545 | |||
12533 | static struct alc_config_preset alc268_presets[] = { | 12546 | static struct alc_config_preset alc268_presets[] = { |
12534 | [ALC267_QUANTA_IL1] = { | 12547 | [ALC267_QUANTA_IL1] = { |
12535 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, | 12548 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
@@ -12696,6 +12709,10 @@ static int patch_alc268(struct hda_codec *codec) | |||
12696 | alc268_models, | 12709 | alc268_models, |
12697 | alc268_cfg_tbl); | 12710 | alc268_cfg_tbl); |
12698 | 12711 | ||
12712 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) | ||
12713 | board_config = snd_hda_check_board_codec_sid_config(codec, | ||
12714 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); | ||
12715 | |||
12699 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { | 12716 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
12700 | printk(KERN_INFO "hda_codec: Unknown model for %s, " | 12717 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
12701 | "trying auto-probe from BIOS...\n", codec->chip_name); | 12718 | "trying auto-probe from BIOS...\n", codec->chip_name); |
@@ -13563,6 +13580,8 @@ static int patch_alc269(struct hda_codec *codec) | |||
13563 | set_capture_mixer(spec); | 13580 | set_capture_mixer(spec); |
13564 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | 13581 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
13565 | 13582 | ||
13583 | spec->vmaster_nid = 0x02; | ||
13584 | |||
13566 | codec->patch_ops = alc_patch_ops; | 13585 | codec->patch_ops = alc_patch_ops; |
13567 | if (board_config == ALC269_AUTO) | 13586 | if (board_config == ALC269_AUTO) |
13568 | spec->init_hook = alc269_auto_init; | 13587 | spec->init_hook = alc269_auto_init; |
@@ -15577,9 +15596,12 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
15577 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; | 15596 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
15578 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; | 15597 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
15579 | 15598 | ||
15580 | spec->adc_nids = alc861vd_adc_nids; | 15599 | if (!spec->adc_nids) { |
15581 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | 15600 | spec->adc_nids = alc861vd_adc_nids; |
15582 | spec->capsrc_nids = alc861vd_capsrc_nids; | 15601 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
15602 | } | ||
15603 | if (!spec->capsrc_nids) | ||
15604 | spec->capsrc_nids = alc861vd_capsrc_nids; | ||
15583 | 15605 | ||
15584 | set_capture_mixer(spec); | 15606 | set_capture_mixer(spec); |
15585 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 15607 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
@@ -17496,9 +17518,12 @@ static int patch_alc662(struct hda_codec *codec) | |||
17496 | spec->stream_digital_playback = &alc662_pcm_digital_playback; | 17518 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
17497 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | 17519 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
17498 | 17520 | ||
17499 | spec->adc_nids = alc662_adc_nids; | 17521 | if (!spec->adc_nids) { |
17500 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | 17522 | spec->adc_nids = alc662_adc_nids; |
17501 | spec->capsrc_nids = alc662_capsrc_nids; | 17523 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
17524 | } | ||
17525 | if (!spec->capsrc_nids) | ||
17526 | spec->capsrc_nids = alc662_capsrc_nids; | ||
17502 | 17527 | ||
17503 | if (!spec->cap_mixer) | 17528 | if (!spec->cap_mixer) |
17504 | set_capture_mixer(spec); | 17529 | set_capture_mixer(spec); |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 456ef6ac12e4..6990cfcb6a38 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -76,6 +76,7 @@ enum { | |||
76 | STAC_92HD73XX_AUTO, | 76 | STAC_92HD73XX_AUTO, |
77 | STAC_92HD73XX_NO_JD, /* no jack-detection */ | 77 | STAC_92HD73XX_NO_JD, /* no jack-detection */ |
78 | STAC_92HD73XX_REF, | 78 | STAC_92HD73XX_REF, |
79 | STAC_92HD73XX_INTEL, | ||
79 | STAC_DELL_M6_AMIC, | 80 | STAC_DELL_M6_AMIC, |
80 | STAC_DELL_M6_DMIC, | 81 | STAC_DELL_M6_DMIC, |
81 | STAC_DELL_M6_BOTH, | 82 | STAC_DELL_M6_BOTH, |
@@ -1777,6 +1778,7 @@ static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { | |||
1777 | [STAC_92HD73XX_AUTO] = "auto", | 1778 | [STAC_92HD73XX_AUTO] = "auto", |
1778 | [STAC_92HD73XX_NO_JD] = "no-jd", | 1779 | [STAC_92HD73XX_NO_JD] = "no-jd", |
1779 | [STAC_92HD73XX_REF] = "ref", | 1780 | [STAC_92HD73XX_REF] = "ref", |
1781 | [STAC_92HD73XX_INTEL] = "intel", | ||
1780 | [STAC_DELL_M6_AMIC] = "dell-m6-amic", | 1782 | [STAC_DELL_M6_AMIC] = "dell-m6-amic", |
1781 | [STAC_DELL_M6_DMIC] = "dell-m6-dmic", | 1783 | [STAC_DELL_M6_DMIC] = "dell-m6-dmic", |
1782 | [STAC_DELL_M6_BOTH] = "dell-m6", | 1784 | [STAC_DELL_M6_BOTH] = "dell-m6", |
@@ -1789,6 +1791,10 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | |||
1789 | "DFI LanParty", STAC_92HD73XX_REF), | 1791 | "DFI LanParty", STAC_92HD73XX_REF), |
1790 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, | 1792 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
1791 | "DFI LanParty", STAC_92HD73XX_REF), | 1793 | "DFI LanParty", STAC_92HD73XX_REF), |
1794 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002, | ||
1795 | "Intel DG45ID", STAC_92HD73XX_INTEL), | ||
1796 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003, | ||
1797 | "Intel DG45FC", STAC_92HD73XX_INTEL), | ||
1792 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, | 1798 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, |
1793 | "Dell Studio 1535", STAC_DELL_M6_DMIC), | 1799 | "Dell Studio 1535", STAC_DELL_M6_DMIC), |
1794 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, | 1800 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 9008b4b013aa..e8f10b10cceb 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -1395,6 +1395,7 @@ static int patch_vt1708(struct hda_codec *codec) | |||
1395 | if (!spec->adc_nids && spec->input_mux) { | 1395 | if (!spec->adc_nids && spec->input_mux) { |
1396 | spec->adc_nids = vt1708_adc_nids; | 1396 | spec->adc_nids = vt1708_adc_nids; |
1397 | spec->num_adc_nids = ARRAY_SIZE(vt1708_adc_nids); | 1397 | spec->num_adc_nids = ARRAY_SIZE(vt1708_adc_nids); |
1398 | get_mux_nids(codec); | ||
1398 | spec->mixers[spec->num_mixers] = vt1708_capture_mixer; | 1399 | spec->mixers[spec->num_mixers] = vt1708_capture_mixer; |
1399 | spec->num_mixers++; | 1400 | spec->num_mixers++; |
1400 | } | 1401 | } |
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 312251d39696..9a8936e20744 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c | |||
@@ -260,6 +260,9 @@ oxygen_search_pci_id(struct oxygen *chip, const struct pci_device_id ids[]) | |||
260 | * chip didn't if the first EEPROM word was overwritten. | 260 | * chip didn't if the first EEPROM word was overwritten. |
261 | */ | 261 | */ |
262 | subdevice = oxygen_read_eeprom(chip, 2); | 262 | subdevice = oxygen_read_eeprom(chip, 2); |
263 | /* use default ID if EEPROM is missing */ | ||
264 | if (subdevice == 0xffff) | ||
265 | subdevice = 0x8788; | ||
263 | /* | 266 | /* |
264 | * We use only the subsystem device ID for searching because it is | 267 | * We use only the subsystem device ID for searching because it is |
265 | * unique even without the subsystem vendor ID, which may have been | 268 | * unique even without the subsystem vendor ID, which may have been |
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c index 3b5ca70c9d4d..ef2345d82b86 100644 --- a/sound/pci/oxygen/oxygen_pcm.c +++ b/sound/pci/oxygen/oxygen_pcm.c | |||
@@ -469,9 +469,11 @@ static int oxygen_multich_hw_params(struct snd_pcm_substream *substream, | |||
469 | oxygen_write16_masked(chip, OXYGEN_I2S_MULTICH_FORMAT, | 469 | oxygen_write16_masked(chip, OXYGEN_I2S_MULTICH_FORMAT, |
470 | oxygen_rate(hw_params) | | 470 | oxygen_rate(hw_params) | |
471 | chip->model.dac_i2s_format | | 471 | chip->model.dac_i2s_format | |
472 | oxygen_i2s_mclk(hw_params) | | ||
472 | oxygen_i2s_bits(hw_params), | 473 | oxygen_i2s_bits(hw_params), |
473 | OXYGEN_I2S_RATE_MASK | | 474 | OXYGEN_I2S_RATE_MASK | |
474 | OXYGEN_I2S_FORMAT_MASK | | 475 | OXYGEN_I2S_FORMAT_MASK | |
476 | OXYGEN_I2S_MCLK_MASK | | ||
475 | OXYGEN_I2S_BITS_MASK); | 477 | OXYGEN_I2S_BITS_MASK); |
476 | oxygen_update_dac_routing(chip); | 478 | oxygen_update_dac_routing(chip); |
477 | oxygen_update_spdif_source(chip); | 479 | oxygen_update_spdif_source(chip); |
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c index 6416d3f0c7be..a69e774d0b13 100644 --- a/sound/pci/vx222/vx222_ops.c +++ b/sound/pci/vx222/vx222_ops.c | |||
@@ -885,10 +885,10 @@ static int vx_input_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
885 | struct vx_core *_chip = snd_kcontrol_chip(kcontrol); | 885 | struct vx_core *_chip = snd_kcontrol_chip(kcontrol); |
886 | struct snd_vx222 *chip = (struct snd_vx222 *)_chip; | 886 | struct snd_vx222 *chip = (struct snd_vx222 *)_chip; |
887 | if (ucontrol->value.integer.value[0] < 0 || | 887 | if (ucontrol->value.integer.value[0] < 0 || |
888 | ucontrol->value.integer.value[0] < MIC_LEVEL_MAX) | 888 | ucontrol->value.integer.value[0] > MIC_LEVEL_MAX) |
889 | return -EINVAL; | 889 | return -EINVAL; |
890 | if (ucontrol->value.integer.value[1] < 0 || | 890 | if (ucontrol->value.integer.value[1] < 0 || |
891 | ucontrol->value.integer.value[1] < MIC_LEVEL_MAX) | 891 | ucontrol->value.integer.value[1] > MIC_LEVEL_MAX) |
892 | return -EINVAL; | 892 | return -EINVAL; |
893 | mutex_lock(&_chip->mixer_mutex); | 893 | mutex_lock(&_chip->mixer_mutex); |
894 | if (chip->input_level[0] != ucontrol->value.integer.value[0] || | 894 | if (chip->input_level[0] != ucontrol->value.integer.value[0] || |
diff --git a/sound/soc/fsl/efika-audio-fabric.c b/sound/soc/fsl/efika-audio-fabric.c index 85b0e7569504..3326e2a1e863 100644 --- a/sound/soc/fsl/efika-audio-fabric.c +++ b/sound/soc/fsl/efika-audio-fabric.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include "mpc5200_psc_ac97.h" | 30 | #include "mpc5200_psc_ac97.h" |
31 | #include "../codecs/stac9766.h" | 31 | #include "../codecs/stac9766.h" |
32 | 32 | ||
33 | #define DRV_NAME "efika-audio-fabric" | ||
34 | |||
33 | static struct snd_soc_device device; | 35 | static struct snd_soc_device device; |
34 | static struct snd_soc_card card; | 36 | static struct snd_soc_card card; |
35 | 37 | ||
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c index 8766f7a3893d..b928ef7d28eb 100644 --- a/sound/soc/fsl/pcm030-audio-fabric.c +++ b/sound/soc/fsl/pcm030-audio-fabric.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include "mpc5200_psc_ac97.h" | 30 | #include "mpc5200_psc_ac97.h" |
31 | #include "../codecs/wm9712.h" | 31 | #include "../codecs/wm9712.h" |
32 | 32 | ||
33 | #define DRV_NAME "pcm030-audio-fabric" | ||
34 | |||
33 | static struct snd_soc_device device; | 35 | static struct snd_soc_device device; |
34 | static struct snd_soc_card card; | 36 | static struct snd_soc_card card; |
35 | 37 | ||
diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile index 5457192e1b41..bdd3b7ecad0a 100644 --- a/tools/perf/Documentation/Makefile +++ b/tools/perf/Documentation/Makefile | |||
@@ -35,7 +35,7 @@ man7dir=$(mandir)/man7 | |||
35 | # DESTDIR= | 35 | # DESTDIR= |
36 | 36 | ||
37 | ASCIIDOC=asciidoc | 37 | ASCIIDOC=asciidoc |
38 | ASCIIDOC_EXTRA = | 38 | ASCIIDOC_EXTRA = --unsafe |
39 | MANPAGE_XSL = manpage-normal.xsl | 39 | MANPAGE_XSL = manpage-normal.xsl |
40 | XMLTO_EXTRA = | 40 | XMLTO_EXTRA = |
41 | INSTALL?=install | 41 | INSTALL?=install |
diff --git a/tools/perf/Documentation/perf-examples.txt b/tools/perf/Documentation/examples.txt index 8eb6c489fb15..8eb6c489fb15 100644 --- a/tools/perf/Documentation/perf-examples.txt +++ b/tools/perf/Documentation/examples.txt | |||
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 60411e94113b..c045b4271e57 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -382,22 +382,29 @@ endif | |||
382 | ifdef NO_DEMANGLE | 382 | ifdef NO_DEMANGLE |
383 | BASIC_CFLAGS += -DNO_DEMANGLE | 383 | BASIC_CFLAGS += -DNO_DEMANGLE |
384 | else | 384 | else |
385 | |||
386 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd > /dev/null 2>&1 && echo y") | 385 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd > /dev/null 2>&1 && echo y") |
387 | 386 | ||
388 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty > /dev/null 2>&1 && echo y") | ||
389 | |||
390 | has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty -lz > /dev/null 2>&1 && echo y") | ||
391 | |||
392 | ifeq ($(has_bfd),y) | 387 | ifeq ($(has_bfd),y) |
393 | EXTLIBS += -lbfd | 388 | EXTLIBS += -lbfd |
394 | else ifeq ($(has_bfd_iberty),y) | ||
395 | EXTLIBS += -lbfd -liberty | ||
396 | else ifeq ($(has_bfd_iberty_z),y) | ||
397 | EXTLIBS += -lbfd -liberty -lz | ||
398 | else | 389 | else |
399 | msg := $(warning No bfd.h/libbfd found, install binutils-dev[el] to gain symbol demangling) | 390 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty > /dev/null 2>&1 && echo y") |
400 | BASIC_CFLAGS += -DNO_DEMANGLE | 391 | ifeq ($(has_bfd_iberty),y) |
392 | EXTLIBS += -lbfd -liberty | ||
393 | else | ||
394 | has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty -lz > /dev/null 2>&1 && echo y") | ||
395 | ifeq ($(has_bfd_iberty_z),y) | ||
396 | EXTLIBS += -lbfd -liberty -lz | ||
397 | else | ||
398 | has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -liberty > /dev/null 2>&1 && echo y") | ||
399 | ifeq ($(has_cplus_demangle),y) | ||
400 | EXTLIBS += -liberty | ||
401 | BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE | ||
402 | else | ||
403 | msg := $(warning No bfd.h/libbfd found, install binutils-dev[el] to gain symbol demangling) | ||
404 | BASIC_CFLAGS += -DNO_DEMANGLE | ||
405 | endif | ||
406 | endif | ||
407 | endif | ||
401 | endif | 408 | endif |
402 | endif | 409 | endif |
403 | 410 | ||
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 1dba568e1941..5e17de984dc8 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -31,6 +31,7 @@ static char *vmlinux = "vmlinux"; | |||
31 | static char default_sort_order[] = "comm,symbol"; | 31 | static char default_sort_order[] = "comm,symbol"; |
32 | static char *sort_order = default_sort_order; | 32 | static char *sort_order = default_sort_order; |
33 | 33 | ||
34 | static int force; | ||
34 | static int input; | 35 | static int input; |
35 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; | 36 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; |
36 | 37 | ||
@@ -980,6 +981,13 @@ process_fork_event(event_t *event, unsigned long offset, unsigned long head) | |||
980 | (void *)(long)(event->header.size), | 981 | (void *)(long)(event->header.size), |
981 | event->fork.pid, event->fork.ppid); | 982 | event->fork.pid, event->fork.ppid); |
982 | 983 | ||
984 | /* | ||
985 | * A thread clone will have the same PID for both | ||
986 | * parent and child. | ||
987 | */ | ||
988 | if (thread == parent) | ||
989 | return 0; | ||
990 | |||
983 | if (!thread || !parent || thread__fork(thread, parent)) { | 991 | if (!thread || !parent || thread__fork(thread, parent)) { |
984 | dprintf("problem processing PERF_EVENT_FORK, skipping event.\n"); | 992 | dprintf("problem processing PERF_EVENT_FORK, skipping event.\n"); |
985 | return -1; | 993 | return -1; |
@@ -1327,6 +1335,11 @@ static int __cmd_annotate(void) | |||
1327 | exit(-1); | 1335 | exit(-1); |
1328 | } | 1336 | } |
1329 | 1337 | ||
1338 | if (!force && (stat.st_uid != geteuid())) { | ||
1339 | fprintf(stderr, "file: %s not owned by current user\n", input_name); | ||
1340 | exit(-1); | ||
1341 | } | ||
1342 | |||
1330 | if (!stat.st_size) { | 1343 | if (!stat.st_size) { |
1331 | fprintf(stderr, "zero-sized file, nothing to do!\n"); | 1344 | fprintf(stderr, "zero-sized file, nothing to do!\n"); |
1332 | exit(0); | 1345 | exit(0); |
@@ -1432,6 +1445,7 @@ static const struct option options[] = { | |||
1432 | "input file name"), | 1445 | "input file name"), |
1433 | OPT_STRING('s', "symbol", &sym_hist_filter, "symbol", | 1446 | OPT_STRING('s', "symbol", &sym_hist_filter, "symbol", |
1434 | "symbol to annotate"), | 1447 | "symbol to annotate"), |
1448 | OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), | ||
1435 | OPT_BOOLEAN('v', "verbose", &verbose, | 1449 | OPT_BOOLEAN('v', "verbose", &verbose, |
1436 | "be more verbose (show symbol address, etc)"), | 1450 | "be more verbose (show symbol address, etc)"), |
1437 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 1451 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index f990fa8a35c9..d88c6961274c 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c | |||
@@ -10,11 +10,12 @@ | |||
10 | 10 | ||
11 | #include "perf.h" | 11 | #include "perf.h" |
12 | 12 | ||
13 | #include "util/parse-options.h" | ||
14 | #include "util/parse-events.h" | 13 | #include "util/parse-events.h" |
14 | #include "util/cache.h" | ||
15 | 15 | ||
16 | int cmd_list(int argc __used, const char **argv __used, const char *prefix __used) | 16 | int cmd_list(int argc __used, const char **argv __used, const char *prefix __used) |
17 | { | 17 | { |
18 | setup_pager(); | ||
18 | print_events(); | 19 | print_events(); |
19 | return 0; | 20 | return 0; |
20 | } | 21 | } |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 0345aad8eba5..89a5ddcd1ded 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -34,7 +34,9 @@ static int output; | |||
34 | static const char *output_name = "perf.data"; | 34 | static const char *output_name = "perf.data"; |
35 | static int group = 0; | 35 | static int group = 0; |
36 | static unsigned int realtime_prio = 0; | 36 | static unsigned int realtime_prio = 0; |
37 | static int raw_samples = 0; | ||
37 | static int system_wide = 0; | 38 | static int system_wide = 0; |
39 | static int profile_cpu = -1; | ||
38 | static pid_t target_pid = -1; | 40 | static pid_t target_pid = -1; |
39 | static int inherit = 1; | 41 | static int inherit = 1; |
40 | static int force = 0; | 42 | static int force = 0; |
@@ -203,46 +205,48 @@ static void sig_atexit(void) | |||
203 | kill(getpid(), signr); | 205 | kill(getpid(), signr); |
204 | } | 206 | } |
205 | 207 | ||
206 | static void pid_synthesize_comm_event(pid_t pid, int full) | 208 | static pid_t pid_synthesize_comm_event(pid_t pid, int full) |
207 | { | 209 | { |
208 | struct comm_event comm_ev; | 210 | struct comm_event comm_ev; |
209 | char filename[PATH_MAX]; | 211 | char filename[PATH_MAX]; |
210 | char bf[BUFSIZ]; | 212 | char bf[BUFSIZ]; |
211 | int fd; | 213 | FILE *fp; |
212 | size_t size; | 214 | size_t size = 0; |
213 | char *field, *sep; | ||
214 | DIR *tasks; | 215 | DIR *tasks; |
215 | struct dirent dirent, *next; | 216 | struct dirent dirent, *next; |
217 | pid_t tgid = 0; | ||
216 | 218 | ||
217 | snprintf(filename, sizeof(filename), "/proc/%d/stat", pid); | 219 | snprintf(filename, sizeof(filename), "/proc/%d/status", pid); |
218 | 220 | ||
219 | fd = open(filename, O_RDONLY); | 221 | fp = fopen(filename, "r"); |
220 | if (fd < 0) { | 222 | if (fp == NULL) { |
221 | /* | 223 | /* |
222 | * We raced with a task exiting - just return: | 224 | * We raced with a task exiting - just return: |
223 | */ | 225 | */ |
224 | if (verbose) | 226 | if (verbose) |
225 | fprintf(stderr, "couldn't open %s\n", filename); | 227 | fprintf(stderr, "couldn't open %s\n", filename); |
226 | return; | 228 | return 0; |
227 | } | 229 | } |
228 | if (read(fd, bf, sizeof(bf)) < 0) { | ||
229 | fprintf(stderr, "couldn't read %s\n", filename); | ||
230 | exit(EXIT_FAILURE); | ||
231 | } | ||
232 | close(fd); | ||
233 | 230 | ||
234 | /* 9027 (cat) R 6747 9027 6747 34816 9027 ... */ | ||
235 | memset(&comm_ev, 0, sizeof(comm_ev)); | 231 | memset(&comm_ev, 0, sizeof(comm_ev)); |
236 | field = strchr(bf, '('); | 232 | while (!comm_ev.comm[0] || !comm_ev.pid) { |
237 | if (field == NULL) | 233 | if (fgets(bf, sizeof(bf), fp) == NULL) |
238 | goto out_failure; | 234 | goto out_failure; |
239 | sep = strchr(++field, ')'); | 235 | |
240 | if (sep == NULL) | 236 | if (memcmp(bf, "Name:", 5) == 0) { |
241 | goto out_failure; | 237 | char *name = bf + 5; |
242 | size = sep - field; | 238 | while (*name && isspace(*name)) |
243 | memcpy(comm_ev.comm, field, size++); | 239 | ++name; |
244 | 240 | size = strlen(name) - 1; | |
245 | comm_ev.pid = pid; | 241 | memcpy(comm_ev.comm, name, size++); |
242 | } else if (memcmp(bf, "Tgid:", 5) == 0) { | ||
243 | char *tgids = bf + 5; | ||
244 | while (*tgids && isspace(*tgids)) | ||
245 | ++tgids; | ||
246 | tgid = comm_ev.pid = atoi(tgids); | ||
247 | } | ||
248 | } | ||
249 | |||
246 | comm_ev.header.type = PERF_EVENT_COMM; | 250 | comm_ev.header.type = PERF_EVENT_COMM; |
247 | size = ALIGN(size, sizeof(u64)); | 251 | size = ALIGN(size, sizeof(u64)); |
248 | comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size); | 252 | comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size); |
@@ -251,7 +255,7 @@ static void pid_synthesize_comm_event(pid_t pid, int full) | |||
251 | comm_ev.tid = pid; | 255 | comm_ev.tid = pid; |
252 | 256 | ||
253 | write_output(&comm_ev, comm_ev.header.size); | 257 | write_output(&comm_ev, comm_ev.header.size); |
254 | return; | 258 | goto out_fclose; |
255 | } | 259 | } |
256 | 260 | ||
257 | snprintf(filename, sizeof(filename), "/proc/%d/task", pid); | 261 | snprintf(filename, sizeof(filename), "/proc/%d/task", pid); |
@@ -268,7 +272,10 @@ static void pid_synthesize_comm_event(pid_t pid, int full) | |||
268 | write_output(&comm_ev, comm_ev.header.size); | 272 | write_output(&comm_ev, comm_ev.header.size); |
269 | } | 273 | } |
270 | closedir(tasks); | 274 | closedir(tasks); |
271 | return; | 275 | |
276 | out_fclose: | ||
277 | fclose(fp); | ||
278 | return tgid; | ||
272 | 279 | ||
273 | out_failure: | 280 | out_failure: |
274 | fprintf(stderr, "couldn't get COMM and pgid, malformed %s\n", | 281 | fprintf(stderr, "couldn't get COMM and pgid, malformed %s\n", |
@@ -276,7 +283,7 @@ out_failure: | |||
276 | exit(EXIT_FAILURE); | 283 | exit(EXIT_FAILURE); |
277 | } | 284 | } |
278 | 285 | ||
279 | static void pid_synthesize_mmap_samples(pid_t pid) | 286 | static void pid_synthesize_mmap_samples(pid_t pid, pid_t tgid) |
280 | { | 287 | { |
281 | char filename[PATH_MAX]; | 288 | char filename[PATH_MAX]; |
282 | FILE *fp; | 289 | FILE *fp; |
@@ -328,7 +335,7 @@ static void pid_synthesize_mmap_samples(pid_t pid) | |||
328 | mmap_ev.len -= mmap_ev.start; | 335 | mmap_ev.len -= mmap_ev.start; |
329 | mmap_ev.header.size = (sizeof(mmap_ev) - | 336 | mmap_ev.header.size = (sizeof(mmap_ev) - |
330 | (sizeof(mmap_ev.filename) - size)); | 337 | (sizeof(mmap_ev.filename) - size)); |
331 | mmap_ev.pid = pid; | 338 | mmap_ev.pid = tgid; |
332 | mmap_ev.tid = pid; | 339 | mmap_ev.tid = pid; |
333 | 340 | ||
334 | write_output(&mmap_ev, mmap_ev.header.size); | 341 | write_output(&mmap_ev, mmap_ev.header.size); |
@@ -347,14 +354,14 @@ static void synthesize_all(void) | |||
347 | 354 | ||
348 | while (!readdir_r(proc, &dirent, &next) && next) { | 355 | while (!readdir_r(proc, &dirent, &next) && next) { |
349 | char *end; | 356 | char *end; |
350 | pid_t pid; | 357 | pid_t pid, tgid; |
351 | 358 | ||
352 | pid = strtol(dirent.d_name, &end, 10); | 359 | pid = strtol(dirent.d_name, &end, 10); |
353 | if (*end) /* only interested in proper numerical dirents */ | 360 | if (*end) /* only interested in proper numerical dirents */ |
354 | continue; | 361 | continue; |
355 | 362 | ||
356 | pid_synthesize_comm_event(pid, 1); | 363 | tgid = pid_synthesize_comm_event(pid, 1); |
357 | pid_synthesize_mmap_samples(pid); | 364 | pid_synthesize_mmap_samples(pid, tgid); |
358 | } | 365 | } |
359 | 366 | ||
360 | closedir(proc); | 367 | closedir(proc); |
@@ -392,7 +399,7 @@ static void create_counter(int counter, int cpu, pid_t pid) | |||
392 | PERF_FORMAT_TOTAL_TIME_RUNNING | | 399 | PERF_FORMAT_TOTAL_TIME_RUNNING | |
393 | PERF_FORMAT_ID; | 400 | PERF_FORMAT_ID; |
394 | 401 | ||
395 | attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID; | 402 | attr->sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID; |
396 | 403 | ||
397 | if (freq) { | 404 | if (freq) { |
398 | attr->sample_type |= PERF_SAMPLE_PERIOD; | 405 | attr->sample_type |= PERF_SAMPLE_PERIOD; |
@@ -412,6 +419,8 @@ static void create_counter(int counter, int cpu, pid_t pid) | |||
412 | if (call_graph) | 419 | if (call_graph) |
413 | attr->sample_type |= PERF_SAMPLE_CALLCHAIN; | 420 | attr->sample_type |= PERF_SAMPLE_CALLCHAIN; |
414 | 421 | ||
422 | if (raw_samples) | ||
423 | attr->sample_type |= PERF_SAMPLE_RAW; | ||
415 | 424 | ||
416 | attr->mmap = track; | 425 | attr->mmap = track; |
417 | attr->comm = track; | 426 | attr->comm = track; |
@@ -426,6 +435,8 @@ try_again: | |||
426 | 435 | ||
427 | if (err == EPERM) | 436 | if (err == EPERM) |
428 | die("Permission error - are you root?\n"); | 437 | die("Permission error - are you root?\n"); |
438 | else if (err == ENODEV && profile_cpu != -1) | ||
439 | die("No such device - did you specify an out-of-range profile CPU?\n"); | ||
429 | 440 | ||
430 | /* | 441 | /* |
431 | * If it's cycles then fall back to hrtimer | 442 | * If it's cycles then fall back to hrtimer |
@@ -559,16 +570,22 @@ static int __cmd_record(int argc, const char **argv) | |||
559 | if (pid == -1) | 570 | if (pid == -1) |
560 | pid = getpid(); | 571 | pid = getpid(); |
561 | 572 | ||
562 | open_counters(-1, pid); | 573 | open_counters(profile_cpu, pid); |
563 | } else for (i = 0; i < nr_cpus; i++) | 574 | } else { |
564 | open_counters(i, target_pid); | 575 | if (profile_cpu != -1) { |
576 | open_counters(profile_cpu, target_pid); | ||
577 | } else { | ||
578 | for (i = 0; i < nr_cpus; i++) | ||
579 | open_counters(i, target_pid); | ||
580 | } | ||
581 | } | ||
565 | 582 | ||
566 | if (file_new) | 583 | if (file_new) |
567 | perf_header__write(header, output); | 584 | perf_header__write(header, output); |
568 | 585 | ||
569 | if (!system_wide) { | 586 | if (!system_wide) { |
570 | pid_synthesize_comm_event(pid, 0); | 587 | pid_t tgid = pid_synthesize_comm_event(pid, 0); |
571 | pid_synthesize_mmap_samples(pid); | 588 | pid_synthesize_mmap_samples(pid, tgid); |
572 | } else | 589 | } else |
573 | synthesize_all(); | 590 | synthesize_all(); |
574 | 591 | ||
@@ -636,10 +653,14 @@ static const struct option options[] = { | |||
636 | "record events on existing pid"), | 653 | "record events on existing pid"), |
637 | OPT_INTEGER('r', "realtime", &realtime_prio, | 654 | OPT_INTEGER('r', "realtime", &realtime_prio, |
638 | "collect data with this RT SCHED_FIFO priority"), | 655 | "collect data with this RT SCHED_FIFO priority"), |
656 | OPT_BOOLEAN('R', "raw-samples", &raw_samples, | ||
657 | "collect raw sample records from all opened counters"), | ||
639 | OPT_BOOLEAN('a', "all-cpus", &system_wide, | 658 | OPT_BOOLEAN('a', "all-cpus", &system_wide, |
640 | "system-wide collection from all CPUs"), | 659 | "system-wide collection from all CPUs"), |
641 | OPT_BOOLEAN('A', "append", &append_file, | 660 | OPT_BOOLEAN('A', "append", &append_file, |
642 | "append to the output file to do incremental profiling"), | 661 | "append to the output file to do incremental profiling"), |
662 | OPT_INTEGER('C', "profile_cpu", &profile_cpu, | ||
663 | "CPU to profile on"), | ||
643 | OPT_BOOLEAN('f', "force", &force, | 664 | OPT_BOOLEAN('f', "force", &force, |
644 | "overwrite existing data file"), | 665 | "overwrite existing data file"), |
645 | OPT_LONG('c', "count", &default_interval, | 666 | OPT_LONG('c', "count", &default_interval, |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 99274cec0adb..8b2ec882e6e0 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -38,6 +38,7 @@ static char *dso_list_str, *comm_list_str, *sym_list_str, | |||
38 | static struct strlist *dso_list, *comm_list, *sym_list; | 38 | static struct strlist *dso_list, *comm_list, *sym_list; |
39 | static char *field_sep; | 39 | static char *field_sep; |
40 | 40 | ||
41 | static int force; | ||
41 | static int input; | 42 | static int input; |
42 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; | 43 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; |
43 | 44 | ||
@@ -1526,11 +1527,11 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1526 | more_data += sizeof(u64); | 1527 | more_data += sizeof(u64); |
1527 | } | 1528 | } |
1528 | 1529 | ||
1529 | dprintf("%p [%p]: PERF_EVENT_SAMPLE (IP, %d): %d: %p period: %Ld\n", | 1530 | dprintf("%p [%p]: PERF_EVENT_SAMPLE (IP, %d): %d/%d: %p period: %Ld\n", |
1530 | (void *)(offset + head), | 1531 | (void *)(offset + head), |
1531 | (void *)(long)(event->header.size), | 1532 | (void *)(long)(event->header.size), |
1532 | event->header.misc, | 1533 | event->header.misc, |
1533 | event->ip.pid, | 1534 | event->ip.pid, event->ip.tid, |
1534 | (void *)(long)ip, | 1535 | (void *)(long)ip, |
1535 | (long long)period); | 1536 | (long long)period); |
1536 | 1537 | ||
@@ -1590,10 +1591,11 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1590 | if (show & show_mask) { | 1591 | if (show & show_mask) { |
1591 | struct symbol *sym = resolve_symbol(thread, &map, &dso, &ip); | 1592 | struct symbol *sym = resolve_symbol(thread, &map, &dso, &ip); |
1592 | 1593 | ||
1593 | if (dso_list && dso && dso->name && !strlist__has_entry(dso_list, dso->name)) | 1594 | if (dso_list && (!dso || !dso->name || |
1595 | !strlist__has_entry(dso_list, dso->name))) | ||
1594 | return 0; | 1596 | return 0; |
1595 | 1597 | ||
1596 | if (sym_list && sym && !strlist__has_entry(sym_list, sym->name)) | 1598 | if (sym_list && (!sym || !strlist__has_entry(sym_list, sym->name))) |
1597 | return 0; | 1599 | return 0; |
1598 | 1600 | ||
1599 | if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) { | 1601 | if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) { |
@@ -1612,10 +1614,11 @@ process_mmap_event(event_t *event, unsigned long offset, unsigned long head) | |||
1612 | struct thread *thread = threads__findnew(event->mmap.pid); | 1614 | struct thread *thread = threads__findnew(event->mmap.pid); |
1613 | struct map *map = map__new(&event->mmap); | 1615 | struct map *map = map__new(&event->mmap); |
1614 | 1616 | ||
1615 | dprintf("%p [%p]: PERF_EVENT_MMAP %d: [%p(%p) @ %p]: %s\n", | 1617 | dprintf("%p [%p]: PERF_EVENT_MMAP %d/%d: [%p(%p) @ %p]: %s\n", |
1616 | (void *)(offset + head), | 1618 | (void *)(offset + head), |
1617 | (void *)(long)(event->header.size), | 1619 | (void *)(long)(event->header.size), |
1618 | event->mmap.pid, | 1620 | event->mmap.pid, |
1621 | event->mmap.tid, | ||
1619 | (void *)(long)event->mmap.start, | 1622 | (void *)(long)event->mmap.start, |
1620 | (void *)(long)event->mmap.len, | 1623 | (void *)(long)event->mmap.len, |
1621 | (void *)(long)event->mmap.pgoff, | 1624 | (void *)(long)event->mmap.pgoff, |
@@ -1854,6 +1857,11 @@ static int __cmd_report(void) | |||
1854 | exit(-1); | 1857 | exit(-1); |
1855 | } | 1858 | } |
1856 | 1859 | ||
1860 | if (!force && (stat.st_uid != geteuid())) { | ||
1861 | fprintf(stderr, "file: %s not owned by current user\n", input_name); | ||
1862 | exit(-1); | ||
1863 | } | ||
1864 | |||
1857 | if (!stat.st_size) { | 1865 | if (!stat.st_size) { |
1858 | fprintf(stderr, "zero-sized file, nothing to do!\n"); | 1866 | fprintf(stderr, "zero-sized file, nothing to do!\n"); |
1859 | exit(0); | 1867 | exit(0); |
@@ -2062,6 +2070,7 @@ static const struct option options[] = { | |||
2062 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 2070 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
2063 | "dump raw trace in ASCII"), | 2071 | "dump raw trace in ASCII"), |
2064 | OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), | 2072 | OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), |
2073 | OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), | ||
2065 | OPT_BOOLEAN('m', "modules", &modules, | 2074 | OPT_BOOLEAN('m', "modules", &modules, |
2066 | "load module symbols - WARNING: use only with -k and LIVE kernel"), | 2075 | "load module symbols - WARNING: use only with -k and LIVE kernel"), |
2067 | OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, | 2076 | OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index a5d661b99af6..4bab2784b453 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -379,6 +379,7 @@ static int parse_tracepoint_event(const char **strp, | |||
379 | struct perf_counter_attr *attr) | 379 | struct perf_counter_attr *attr) |
380 | { | 380 | { |
381 | const char *evt_name; | 381 | const char *evt_name; |
382 | char *flags; | ||
382 | char sys_name[MAX_EVENT_LENGTH]; | 383 | char sys_name[MAX_EVENT_LENGTH]; |
383 | char id_buf[4]; | 384 | char id_buf[4]; |
384 | int fd; | 385 | int fd; |
@@ -400,6 +401,15 @@ static int parse_tracepoint_event(const char **strp, | |||
400 | strncpy(sys_name, *strp, sys_length); | 401 | strncpy(sys_name, *strp, sys_length); |
401 | sys_name[sys_length] = '\0'; | 402 | sys_name[sys_length] = '\0'; |
402 | evt_name = evt_name + 1; | 403 | evt_name = evt_name + 1; |
404 | |||
405 | flags = strchr(evt_name, ':'); | ||
406 | if (flags) { | ||
407 | *flags = '\0'; | ||
408 | flags++; | ||
409 | if (!strncmp(flags, "record", strlen(flags))) | ||
410 | attr->sample_type |= PERF_SAMPLE_RAW; | ||
411 | } | ||
412 | |||
403 | evt_length = strlen(evt_name); | 413 | evt_length = strlen(evt_name); |
404 | if (evt_length >= MAX_EVENT_LENGTH) | 414 | if (evt_length >= MAX_EVENT_LENGTH) |
405 | return 0; | 415 | return 0; |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index f1dcede14307..5c0f42e6b33b 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -7,23 +7,8 @@ | |||
7 | #include <gelf.h> | 7 | #include <gelf.h> |
8 | #include <elf.h> | 8 | #include <elf.h> |
9 | 9 | ||
10 | #ifndef NO_DEMANGLE | ||
11 | #include <bfd.h> | ||
12 | #else | ||
13 | static inline | ||
14 | char *bfd_demangle(void __used *v, const char __used *c, int __used i) | ||
15 | { | ||
16 | return NULL; | ||
17 | } | ||
18 | #endif | ||
19 | |||
20 | const char *sym_hist_filter; | 10 | const char *sym_hist_filter; |
21 | 11 | ||
22 | #ifndef DMGL_PARAMS | ||
23 | #define DMGL_PARAMS (1 << 0) /* Include function args */ | ||
24 | #define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ | ||
25 | #endif | ||
26 | |||
27 | enum dso_origin { | 12 | enum dso_origin { |
28 | DSO__ORIG_KERNEL = 0, | 13 | DSO__ORIG_KERNEL = 0, |
29 | DSO__ORIG_JAVA_JIT, | 14 | DSO__ORIG_JAVA_JIT, |
@@ -816,6 +801,8 @@ more: | |||
816 | } | 801 | } |
817 | out: | 802 | out: |
818 | free(name); | 803 | free(name); |
804 | if (ret < 0 && strstr(self->name, " (deleted)") != NULL) | ||
805 | return 0; | ||
819 | return ret; | 806 | return ret; |
820 | } | 807 | } |
821 | 808 | ||
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 1e003ec2f4b1..b53bf0125c1b 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -7,6 +7,30 @@ | |||
7 | #include <linux/rbtree.h> | 7 | #include <linux/rbtree.h> |
8 | #include "module.h" | 8 | #include "module.h" |
9 | 9 | ||
10 | #ifdef HAVE_CPLUS_DEMANGLE | ||
11 | extern char *cplus_demangle(const char *, int); | ||
12 | |||
13 | static inline char *bfd_demangle(void __used *v, const char *c, int i) | ||
14 | { | ||
15 | return cplus_demangle(c, i); | ||
16 | } | ||
17 | #else | ||
18 | #ifdef NO_DEMANGLE | ||
19 | static inline char *bfd_demangle(void __used *v, const char __used *c, | ||
20 | int __used i) | ||
21 | { | ||
22 | return NULL; | ||
23 | } | ||
24 | #else | ||
25 | #include <bfd.h> | ||
26 | #endif | ||
27 | #endif | ||
28 | |||
29 | #ifndef DMGL_PARAMS | ||
30 | #define DMGL_PARAMS (1 << 0) /* Include function args */ | ||
31 | #define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ | ||
32 | #endif | ||
33 | |||
10 | struct symbol { | 34 | struct symbol { |
11 | struct rb_node rb_node; | 35 | struct rb_node rb_node; |
12 | u64 start; | 36 | u64 start; |