diff options
608 files changed, 7357 insertions, 4792 deletions
diff --git a/Documentation/DocBook/media-entities.tmpl b/Documentation/DocBook/media-entities.tmpl index 5d259c632cdf..fea63b45471a 100644 --- a/Documentation/DocBook/media-entities.tmpl +++ b/Documentation/DocBook/media-entities.tmpl | |||
@@ -294,6 +294,7 @@ | |||
294 | <!ENTITY sub-srggb10 SYSTEM "v4l/pixfmt-srggb10.xml"> | 294 | <!ENTITY sub-srggb10 SYSTEM "v4l/pixfmt-srggb10.xml"> |
295 | <!ENTITY sub-srggb8 SYSTEM "v4l/pixfmt-srggb8.xml"> | 295 | <!ENTITY sub-srggb8 SYSTEM "v4l/pixfmt-srggb8.xml"> |
296 | <!ENTITY sub-y10 SYSTEM "v4l/pixfmt-y10.xml"> | 296 | <!ENTITY sub-y10 SYSTEM "v4l/pixfmt-y10.xml"> |
297 | <!ENTITY sub-y12 SYSTEM "v4l/pixfmt-y12.xml"> | ||
297 | <!ENTITY sub-pixfmt SYSTEM "v4l/pixfmt.xml"> | 298 | <!ENTITY sub-pixfmt SYSTEM "v4l/pixfmt.xml"> |
298 | <!ENTITY sub-cropcap SYSTEM "v4l/vidioc-cropcap.xml"> | 299 | <!ENTITY sub-cropcap SYSTEM "v4l/vidioc-cropcap.xml"> |
299 | <!ENTITY sub-dbg-g-register SYSTEM "v4l/vidioc-dbg-g-register.xml"> | 300 | <!ENTITY sub-dbg-g-register SYSTEM "v4l/vidioc-dbg-g-register.xml"> |
diff --git a/Documentation/DocBook/v4l/media-ioc-setup-link.xml b/Documentation/DocBook/v4l/media-ioc-setup-link.xml index 2331e76ded17..cec97af4dab4 100644 --- a/Documentation/DocBook/v4l/media-ioc-setup-link.xml +++ b/Documentation/DocBook/v4l/media-ioc-setup-link.xml | |||
@@ -34,7 +34,7 @@ | |||
34 | <varlistentry> | 34 | <varlistentry> |
35 | <term><parameter>request</parameter></term> | 35 | <term><parameter>request</parameter></term> |
36 | <listitem> | 36 | <listitem> |
37 | <para>MEDIA_IOC_ENUM_LINKS</para> | 37 | <para>MEDIA_IOC_SETUP_LINK</para> |
38 | </listitem> | 38 | </listitem> |
39 | </varlistentry> | 39 | </varlistentry> |
40 | <varlistentry> | 40 | <varlistentry> |
diff --git a/Documentation/DocBook/v4l/pixfmt-y12.xml b/Documentation/DocBook/v4l/pixfmt-y12.xml new file mode 100644 index 000000000000..ff417b858cc9 --- /dev/null +++ b/Documentation/DocBook/v4l/pixfmt-y12.xml | |||
@@ -0,0 +1,79 @@ | |||
1 | <refentry id="V4L2-PIX-FMT-Y12"> | ||
2 | <refmeta> | ||
3 | <refentrytitle>V4L2_PIX_FMT_Y12 ('Y12 ')</refentrytitle> | ||
4 | &manvol; | ||
5 | </refmeta> | ||
6 | <refnamediv> | ||
7 | <refname><constant>V4L2_PIX_FMT_Y12</constant></refname> | ||
8 | <refpurpose>Grey-scale image</refpurpose> | ||
9 | </refnamediv> | ||
10 | <refsect1> | ||
11 | <title>Description</title> | ||
12 | |||
13 | <para>This is a grey-scale image with a depth of 12 bits per pixel. Pixels | ||
14 | are stored in 16-bit words with unused high bits padded with 0. The least | ||
15 | significant byte is stored at lower memory addresses (little-endian).</para> | ||
16 | |||
17 | <example> | ||
18 | <title><constant>V4L2_PIX_FMT_Y12</constant> 4 × 4 | ||
19 | pixel image</title> | ||
20 | |||
21 | <formalpara> | ||
22 | <title>Byte Order.</title> | ||
23 | <para>Each cell is one byte. | ||
24 | <informaltable frame="none"> | ||
25 | <tgroup cols="9" align="center"> | ||
26 | <colspec align="left" colwidth="2*" /> | ||
27 | <tbody valign="top"> | ||
28 | <row> | ||
29 | <entry>start + 0:</entry> | ||
30 | <entry>Y'<subscript>00low</subscript></entry> | ||
31 | <entry>Y'<subscript>00high</subscript></entry> | ||
32 | <entry>Y'<subscript>01low</subscript></entry> | ||
33 | <entry>Y'<subscript>01high</subscript></entry> | ||
34 | <entry>Y'<subscript>02low</subscript></entry> | ||
35 | <entry>Y'<subscript>02high</subscript></entry> | ||
36 | <entry>Y'<subscript>03low</subscript></entry> | ||
37 | <entry>Y'<subscript>03high</subscript></entry> | ||
38 | </row> | ||
39 | <row> | ||
40 | <entry>start + 8:</entry> | ||
41 | <entry>Y'<subscript>10low</subscript></entry> | ||
42 | <entry>Y'<subscript>10high</subscript></entry> | ||
43 | <entry>Y'<subscript>11low</subscript></entry> | ||
44 | <entry>Y'<subscript>11high</subscript></entry> | ||
45 | <entry>Y'<subscript>12low</subscript></entry> | ||
46 | <entry>Y'<subscript>12high</subscript></entry> | ||
47 | <entry>Y'<subscript>13low</subscript></entry> | ||
48 | <entry>Y'<subscript>13high</subscript></entry> | ||
49 | </row> | ||
50 | <row> | ||
51 | <entry>start + 16:</entry> | ||
52 | <entry>Y'<subscript>20low</subscript></entry> | ||
53 | <entry>Y'<subscript>20high</subscript></entry> | ||
54 | <entry>Y'<subscript>21low</subscript></entry> | ||
55 | <entry>Y'<subscript>21high</subscript></entry> | ||
56 | <entry>Y'<subscript>22low</subscript></entry> | ||
57 | <entry>Y'<subscript>22high</subscript></entry> | ||
58 | <entry>Y'<subscript>23low</subscript></entry> | ||
59 | <entry>Y'<subscript>23high</subscript></entry> | ||
60 | </row> | ||
61 | <row> | ||
62 | <entry>start + 24:</entry> | ||
63 | <entry>Y'<subscript>30low</subscript></entry> | ||
64 | <entry>Y'<subscript>30high</subscript></entry> | ||
65 | <entry>Y'<subscript>31low</subscript></entry> | ||
66 | <entry>Y'<subscript>31high</subscript></entry> | ||
67 | <entry>Y'<subscript>32low</subscript></entry> | ||
68 | <entry>Y'<subscript>32high</subscript></entry> | ||
69 | <entry>Y'<subscript>33low</subscript></entry> | ||
70 | <entry>Y'<subscript>33high</subscript></entry> | ||
71 | </row> | ||
72 | </tbody> | ||
73 | </tgroup> | ||
74 | </informaltable> | ||
75 | </para> | ||
76 | </formalpara> | ||
77 | </example> | ||
78 | </refsect1> | ||
79 | </refentry> | ||
diff --git a/Documentation/DocBook/v4l/pixfmt.xml b/Documentation/DocBook/v4l/pixfmt.xml index c6fdcbbd1b41..40af4beb48b9 100644 --- a/Documentation/DocBook/v4l/pixfmt.xml +++ b/Documentation/DocBook/v4l/pixfmt.xml | |||
@@ -696,6 +696,7 @@ information.</para> | |||
696 | &sub-packed-yuv; | 696 | &sub-packed-yuv; |
697 | &sub-grey; | 697 | &sub-grey; |
698 | &sub-y10; | 698 | &sub-y10; |
699 | &sub-y12; | ||
699 | &sub-y16; | 700 | &sub-y16; |
700 | &sub-yuyv; | 701 | &sub-yuyv; |
701 | &sub-uyvy; | 702 | &sub-uyvy; |
diff --git a/Documentation/DocBook/v4l/subdev-formats.xml b/Documentation/DocBook/v4l/subdev-formats.xml index 7041127d6dfc..d7ccd25edcc1 100644 --- a/Documentation/DocBook/v4l/subdev-formats.xml +++ b/Documentation/DocBook/v4l/subdev-formats.xml | |||
@@ -456,6 +456,23 @@ | |||
456 | <entry>b<subscript>1</subscript></entry> | 456 | <entry>b<subscript>1</subscript></entry> |
457 | <entry>b<subscript>0</subscript></entry> | 457 | <entry>b<subscript>0</subscript></entry> |
458 | </row> | 458 | </row> |
459 | <row id="V4L2-MBUS-FMT-SGBRG8-1X8"> | ||
460 | <entry>V4L2_MBUS_FMT_SGBRG8_1X8</entry> | ||
461 | <entry>0x3013</entry> | ||
462 | <entry></entry> | ||
463 | <entry>-</entry> | ||
464 | <entry>-</entry> | ||
465 | <entry>-</entry> | ||
466 | <entry>-</entry> | ||
467 | <entry>g<subscript>7</subscript></entry> | ||
468 | <entry>g<subscript>6</subscript></entry> | ||
469 | <entry>g<subscript>5</subscript></entry> | ||
470 | <entry>g<subscript>4</subscript></entry> | ||
471 | <entry>g<subscript>3</subscript></entry> | ||
472 | <entry>g<subscript>2</subscript></entry> | ||
473 | <entry>g<subscript>1</subscript></entry> | ||
474 | <entry>g<subscript>0</subscript></entry> | ||
475 | </row> | ||
459 | <row id="V4L2-MBUS-FMT-SGRBG8-1X8"> | 476 | <row id="V4L2-MBUS-FMT-SGRBG8-1X8"> |
460 | <entry>V4L2_MBUS_FMT_SGRBG8_1X8</entry> | 477 | <entry>V4L2_MBUS_FMT_SGRBG8_1X8</entry> |
461 | <entry>0x3002</entry> | 478 | <entry>0x3002</entry> |
@@ -473,6 +490,23 @@ | |||
473 | <entry>g<subscript>1</subscript></entry> | 490 | <entry>g<subscript>1</subscript></entry> |
474 | <entry>g<subscript>0</subscript></entry> | 491 | <entry>g<subscript>0</subscript></entry> |
475 | </row> | 492 | </row> |
493 | <row id="V4L2-MBUS-FMT-SRGGB8-1X8"> | ||
494 | <entry>V4L2_MBUS_FMT_SRGGB8_1X8</entry> | ||
495 | <entry>0x3014</entry> | ||
496 | <entry></entry> | ||
497 | <entry>-</entry> | ||
498 | <entry>-</entry> | ||
499 | <entry>-</entry> | ||
500 | <entry>-</entry> | ||
501 | <entry>r<subscript>7</subscript></entry> | ||
502 | <entry>r<subscript>6</subscript></entry> | ||
503 | <entry>r<subscript>5</subscript></entry> | ||
504 | <entry>r<subscript>4</subscript></entry> | ||
505 | <entry>r<subscript>3</subscript></entry> | ||
506 | <entry>r<subscript>2</subscript></entry> | ||
507 | <entry>r<subscript>1</subscript></entry> | ||
508 | <entry>r<subscript>0</subscript></entry> | ||
509 | </row> | ||
476 | <row id="V4L2-MBUS-FMT-SBGGR10-DPCM8-1X8"> | 510 | <row id="V4L2-MBUS-FMT-SBGGR10-DPCM8-1X8"> |
477 | <entry>V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8</entry> | 511 | <entry>V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8</entry> |
478 | <entry>0x300b</entry> | 512 | <entry>0x300b</entry> |
@@ -2159,6 +2193,31 @@ | |||
2159 | <entry>u<subscript>1</subscript></entry> | 2193 | <entry>u<subscript>1</subscript></entry> |
2160 | <entry>u<subscript>0</subscript></entry> | 2194 | <entry>u<subscript>0</subscript></entry> |
2161 | </row> | 2195 | </row> |
2196 | <row id="V4L2-MBUS-FMT-Y12-1X12"> | ||
2197 | <entry>V4L2_MBUS_FMT_Y12_1X12</entry> | ||
2198 | <entry>0x2013</entry> | ||
2199 | <entry></entry> | ||
2200 | <entry>-</entry> | ||
2201 | <entry>-</entry> | ||
2202 | <entry>-</entry> | ||
2203 | <entry>-</entry> | ||
2204 | <entry>-</entry> | ||
2205 | <entry>-</entry> | ||
2206 | <entry>-</entry> | ||
2207 | <entry>-</entry> | ||
2208 | <entry>y<subscript>11</subscript></entry> | ||
2209 | <entry>y<subscript>10</subscript></entry> | ||
2210 | <entry>y<subscript>9</subscript></entry> | ||
2211 | <entry>y<subscript>8</subscript></entry> | ||
2212 | <entry>y<subscript>7</subscript></entry> | ||
2213 | <entry>y<subscript>6</subscript></entry> | ||
2214 | <entry>y<subscript>5</subscript></entry> | ||
2215 | <entry>y<subscript>4</subscript></entry> | ||
2216 | <entry>y<subscript>3</subscript></entry> | ||
2217 | <entry>y<subscript>2</subscript></entry> | ||
2218 | <entry>y<subscript>1</subscript></entry> | ||
2219 | <entry>y<subscript>0</subscript></entry> | ||
2220 | </row> | ||
2162 | <row id="V4L2-MBUS-FMT-UYVY8-1X16"> | 2221 | <row id="V4L2-MBUS-FMT-UYVY8-1X16"> |
2163 | <entry>V4L2_MBUS_FMT_UYVY8_1X16</entry> | 2222 | <entry>V4L2_MBUS_FMT_UYVY8_1X16</entry> |
2164 | <entry>0x200f</entry> | 2223 | <entry>0x200f</entry> |
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index b6ed61c95856..7c163477fcd8 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt | |||
@@ -52,8 +52,10 @@ Brief summary of control files. | |||
52 | tasks # attach a task(thread) and show list of threads | 52 | tasks # attach a task(thread) and show list of threads |
53 | cgroup.procs # show list of processes | 53 | cgroup.procs # show list of processes |
54 | cgroup.event_control # an interface for event_fd() | 54 | cgroup.event_control # an interface for event_fd() |
55 | memory.usage_in_bytes # show current memory(RSS+Cache) usage. | 55 | memory.usage_in_bytes # show current res_counter usage for memory |
56 | memory.memsw.usage_in_bytes # show current memory+Swap usage | 56 | (See 5.5 for details) |
57 | memory.memsw.usage_in_bytes # show current res_counter usage for memory+Swap | ||
58 | (See 5.5 for details) | ||
57 | memory.limit_in_bytes # set/show limit of memory usage | 59 | memory.limit_in_bytes # set/show limit of memory usage |
58 | memory.memsw.limit_in_bytes # set/show limit of memory+Swap usage | 60 | memory.memsw.limit_in_bytes # set/show limit of memory+Swap usage |
59 | memory.failcnt # show the number of memory usage hits limits | 61 | memory.failcnt # show the number of memory usage hits limits |
@@ -453,6 +455,15 @@ memory under it will be reclaimed. | |||
453 | You can reset failcnt by writing 0 to failcnt file. | 455 | You can reset failcnt by writing 0 to failcnt file. |
454 | # echo 0 > .../memory.failcnt | 456 | # echo 0 > .../memory.failcnt |
455 | 457 | ||
458 | 5.5 usage_in_bytes | ||
459 | |||
460 | For efficiency, as other kernel components, memory cgroup uses some optimization | ||
461 | to avoid unnecessary cacheline false sharing. usage_in_bytes is affected by the | ||
462 | method and doesn't show 'exact' value of memory(and swap) usage, it's an fuzz | ||
463 | value for efficient access. (Of course, when necessary, it's synchronized.) | ||
464 | If you want to know more exact memory usage, you should use RSS+CACHE(+SWAP) | ||
465 | value in memory.stat(see 5.2). | ||
466 | |||
456 | 6. Hierarchy support | 467 | 6. Hierarchy support |
457 | 468 | ||
458 | The memory controller supports a deep hierarchy and hierarchical accounting. | 469 | The memory controller supports a deep hierarchy and hierarchical accounting. |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 274b32d12532..492e81df2968 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -387,26 +387,6 @@ Who: Tejun Heo <tj@kernel.org> | |||
387 | 387 | ||
388 | ---------------------------- | 388 | ---------------------------- |
389 | 389 | ||
390 | What: Support for lcd_switch and display_get in asus-laptop driver | ||
391 | When: March 2010 | ||
392 | Why: These two features use non-standard interfaces. There are the | ||
393 | only features that really need multiple path to guess what's | ||
394 | the right method name on a specific laptop. | ||
395 | |||
396 | Removing them will allow to remove a lot of code an significantly | ||
397 | clean the drivers. | ||
398 | |||
399 | This will affect the backlight code which won't be able to know | ||
400 | if the backlight is on or off. The platform display file will also be | ||
401 | write only (like the one in eeepc-laptop). | ||
402 | |||
403 | This should'nt affect a lot of user because they usually know | ||
404 | when their display is on or off. | ||
405 | |||
406 | Who: Corentin Chary <corentin.chary@gmail.com> | ||
407 | |||
408 | ---------------------------- | ||
409 | |||
410 | What: sysfs-class-rfkill state file | 390 | What: sysfs-class-rfkill state file |
411 | When: Feb 2014 | 391 | When: Feb 2014 |
412 | Files: net/rfkill/core.c | 392 | Files: net/rfkill/core.c |
diff --git a/Documentation/hwmon/adm1021 b/Documentation/hwmon/adm1021 index 03d02bfb3df1..02ad96cf9b2b 100644 --- a/Documentation/hwmon/adm1021 +++ b/Documentation/hwmon/adm1021 | |||
@@ -14,10 +14,6 @@ Supported chips: | |||
14 | Prefix: 'gl523sm' | 14 | Prefix: 'gl523sm' |
15 | Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e | 15 | Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e |
16 | Datasheet: | 16 | Datasheet: |
17 | * Intel Xeon Processor | ||
18 | Prefix: - any other - may require 'force_adm1021' parameter | ||
19 | Addresses scanned: none | ||
20 | Datasheet: Publicly available at Intel website | ||
21 | * Maxim MAX1617 | 17 | * Maxim MAX1617 |
22 | Prefix: 'max1617' | 18 | Prefix: 'max1617' |
23 | Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e | 19 | Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e |
@@ -91,21 +87,27 @@ will do no harm, but will return 'old' values. It is possible to make | |||
91 | ADM1021-clones do faster measurements, but there is really no good reason | 87 | ADM1021-clones do faster measurements, but there is really no good reason |
92 | for that. | 88 | for that. |
93 | 89 | ||
94 | Xeon support | ||
95 | ------------ | ||
96 | 90 | ||
97 | Some Xeon processors have real max1617, adm1021, or compatible chips | 91 | Netburst-based Xeon support |
98 | within them, with two temperature sensors. | 92 | --------------------------- |
99 | 93 | ||
100 | Other Xeons have chips with only one sensor. | 94 | Some Xeon processors based on the Netburst (early Pentium 4, from 2001 to |
95 | 2003) microarchitecture had real MAX1617, ADM1021, or compatible chips | ||
96 | within them, with two temperature sensors. Other Xeon processors of this | ||
97 | era (with 400 MHz FSB) had chips with only one temperature sensor. | ||
101 | 98 | ||
102 | If you have a Xeon, and the adm1021 module loads, and both temperatures | 99 | If you have such an old Xeon, and you get two valid temperatures when |
103 | appear valid, then things are good. | 100 | loading the adm1021 module, then things are good. |
104 | 101 | ||
105 | If the adm1021 module doesn't load, you should try this: | 102 | If nothing happens when loading the adm1021 module, and you are certain |
106 | modprobe adm1021 force_adm1021=BUS,ADDRESS | 103 | that your specific Xeon processor model includes compatible sensors, you |
107 | ADDRESS can only be 0x18, 0x1a, 0x29, 0x2b, 0x4c, or 0x4e. | 104 | will have to explicitly instantiate the sensor chips from user-space. See |
105 | method 4 in Documentation/i2c/instantiating-devices. Possible slave | ||
106 | addresses are 0x18, 0x1a, 0x29, 0x2b, 0x4c, or 0x4e. It is likely that | ||
107 | only temp2 will be correct and temp1 will have to be ignored. | ||
108 | 108 | ||
109 | If you have dual Xeons you may have appear to have two separate | 109 | Previous generations of the Xeon processor (based on Pentium II/III) |
110 | adm1021-compatible chips, or two single-temperature sensors, at distinct | 110 | didn't have these sensors. Next generations of Xeon processors (533 MHz |
111 | addresses. | 111 | FSB and faster) lost them, until the Core-based generation which |
112 | introduced integrated digital thermal sensors. These are supported by | ||
113 | the coretemp driver. | ||
diff --git a/Documentation/hwmon/lm90 b/Documentation/hwmon/lm90 index fa475c0a48a3..f3efd18e87f4 100644 --- a/Documentation/hwmon/lm90 +++ b/Documentation/hwmon/lm90 | |||
@@ -32,6 +32,16 @@ Supported chips: | |||
32 | Addresses scanned: I2C 0x4c and 0x4d | 32 | Addresses scanned: I2C 0x4c and 0x4d |
33 | Datasheet: Publicly available at the ON Semiconductor website | 33 | Datasheet: Publicly available at the ON Semiconductor website |
34 | http://www.onsemi.com/PowerSolutions/product.do?id=ADT7461 | 34 | http://www.onsemi.com/PowerSolutions/product.do?id=ADT7461 |
35 | * Analog Devices ADT7461A | ||
36 | Prefix: 'adt7461a' | ||
37 | Addresses scanned: I2C 0x4c and 0x4d | ||
38 | Datasheet: Publicly available at the ON Semiconductor website | ||
39 | http://www.onsemi.com/PowerSolutions/product.do?id=ADT7461A | ||
40 | * ON Semiconductor NCT1008 | ||
41 | Prefix: 'nct1008' | ||
42 | Addresses scanned: I2C 0x4c and 0x4d | ||
43 | Datasheet: Publicly available at the ON Semiconductor website | ||
44 | http://www.onsemi.com/PowerSolutions/product.do?id=NCT1008 | ||
35 | * Maxim MAX6646 | 45 | * Maxim MAX6646 |
36 | Prefix: 'max6646' | 46 | Prefix: 'max6646' |
37 | Addresses scanned: I2C 0x4d | 47 | Addresses scanned: I2C 0x4d |
@@ -149,7 +159,7 @@ ADM1032: | |||
149 | * ALERT is triggered by open remote sensor. | 159 | * ALERT is triggered by open remote sensor. |
150 | * SMBus PEC support for Write Byte and Receive Byte transactions. | 160 | * SMBus PEC support for Write Byte and Receive Byte transactions. |
151 | 161 | ||
152 | ADT7461: | 162 | ADT7461, ADT7461A, NCT1008: |
153 | * Extended temperature range (breaks compatibility) | 163 | * Extended temperature range (breaks compatibility) |
154 | * Lower resolution for remote temperature | 164 | * Lower resolution for remote temperature |
155 | 165 | ||
@@ -195,9 +205,9 @@ are exported, one for each channel, but these values are of course linked. | |||
195 | Only the local hysteresis can be set from user-space, and the same delta | 205 | Only the local hysteresis can be set from user-space, and the same delta |
196 | applies to the remote hysteresis. | 206 | applies to the remote hysteresis. |
197 | 207 | ||
198 | The lm90 driver will not update its values more frequently than every | 208 | The lm90 driver will not update its values more frequently than configured with |
199 | other second; reading them more often will do no harm, but will return | 209 | the update_interval attribute; reading them more often will do no harm, but will |
200 | 'old' values. | 210 | return 'old' values. |
201 | 211 | ||
202 | SMBus Alert Support | 212 | SMBus Alert Support |
203 | ------------------- | 213 | ------------------- |
@@ -205,11 +215,12 @@ SMBus Alert Support | |||
205 | This driver has basic support for SMBus alert. When an alert is received, | 215 | This driver has basic support for SMBus alert. When an alert is received, |
206 | the status register is read and the faulty temperature channel is logged. | 216 | the status register is read and the faulty temperature channel is logged. |
207 | 217 | ||
208 | The Analog Devices chips (ADM1032 and ADT7461) do not implement the SMBus | 218 | The Analog Devices chips (ADM1032, ADT7461 and ADT7461A) and ON |
209 | alert protocol properly so additional care is needed: the ALERT output is | 219 | Semiconductor chips (NCT1008) do not implement the SMBus alert protocol |
210 | disabled when an alert is received, and is re-enabled only when the alarm | 220 | properly so additional care is needed: the ALERT output is disabled when |
211 | is gone. Otherwise the chip would block alerts from other chips in the bus | 221 | an alert is received, and is re-enabled only when the alarm is gone. |
212 | as long as the alarm is active. | 222 | Otherwise the chip would block alerts from other chips in the bus as long |
223 | as the alarm is active. | ||
213 | 224 | ||
214 | PEC Support | 225 | PEC Support |
215 | ----------- | 226 | ----------- |
diff --git a/Documentation/hwmon/max16064 b/Documentation/hwmon/max16064 new file mode 100644 index 000000000000..41728999e142 --- /dev/null +++ b/Documentation/hwmon/max16064 | |||
@@ -0,0 +1,62 @@ | |||
1 | Kernel driver max16064 | ||
2 | ====================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Maxim MAX16064 | ||
6 | Prefix: 'max16064' | ||
7 | Addresses scanned: - | ||
8 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX16064.pdf | ||
9 | |||
10 | Author: Guenter Roeck <guenter.roeck@ericsson.com> | ||
11 | |||
12 | |||
13 | Description | ||
14 | ----------- | ||
15 | |||
16 | This driver supports hardware montoring for Maxim MAX16064 Quad Power-Supply | ||
17 | Controller with Active-Voltage Output Control and PMBus Interface. | ||
18 | |||
19 | The driver is a client driver to the core PMBus driver. | ||
20 | Please see Documentation/hwmon/pmbus for details on PMBus client drivers. | ||
21 | |||
22 | |||
23 | Usage Notes | ||
24 | ----------- | ||
25 | |||
26 | This driver does not auto-detect devices. You will have to instantiate the | ||
27 | devices explicitly. Please see Documentation/i2c/instantiating-devices for | ||
28 | details. | ||
29 | |||
30 | |||
31 | Platform data support | ||
32 | --------------------- | ||
33 | |||
34 | The driver supports standard PMBus driver platform data. | ||
35 | |||
36 | |||
37 | Sysfs entries | ||
38 | ------------- | ||
39 | |||
40 | The following attributes are supported. Limits are read-write; all other | ||
41 | attributes are read-only. | ||
42 | |||
43 | in[1-4]_label "vout[1-4]" | ||
44 | in[1-4]_input Measured voltage. From READ_VOUT register. | ||
45 | in[1-4]_min Minumum Voltage. From VOUT_UV_WARN_LIMIT register. | ||
46 | in[1-4]_max Maximum voltage. From VOUT_OV_WARN_LIMIT register. | ||
47 | in[1-4]_lcrit Critical minumum Voltage. VOUT_UV_FAULT_LIMIT register. | ||
48 | in[1-4]_crit Critical maximum voltage. From VOUT_OV_FAULT_LIMIT register. | ||
49 | in[1-4]_min_alarm Voltage low alarm. From VOLTAGE_UV_WARNING status. | ||
50 | in[1-4]_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. | ||
51 | in[1-4]_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. | ||
52 | in[1-4]_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. | ||
53 | |||
54 | temp1_input Measured temperature. From READ_TEMPERATURE_1 register. | ||
55 | temp1_max Maximum temperature. From OT_WARN_LIMIT register. | ||
56 | temp1_crit Critical high temperature. From OT_FAULT_LIMIT register. | ||
57 | temp1_max_alarm Chip temperature high alarm. Set by comparing | ||
58 | READ_TEMPERATURE_1 with OT_WARN_LIMIT if TEMP_OT_WARNING | ||
59 | status is set. | ||
60 | temp1_crit_alarm Chip temperature critical high alarm. Set by comparing | ||
61 | READ_TEMPERATURE_1 with OT_FAULT_LIMIT if TEMP_OT_FAULT | ||
62 | status is set. | ||
diff --git a/Documentation/hwmon/max34440 b/Documentation/hwmon/max34440 new file mode 100644 index 000000000000..6c525dd07d59 --- /dev/null +++ b/Documentation/hwmon/max34440 | |||
@@ -0,0 +1,79 @@ | |||
1 | Kernel driver max34440 | ||
2 | ====================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Maxim MAX34440 | ||
6 | Prefixes: 'max34440' | ||
7 | Addresses scanned: - | ||
8 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34440.pdf | ||
9 | * Maxim MAX34441 | ||
10 | PMBus 5-Channel Power-Supply Manager and Intelligent Fan Controller | ||
11 | Prefixes: 'max34441' | ||
12 | Addresses scanned: - | ||
13 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34441.pdf | ||
14 | |||
15 | Author: Guenter Roeck <guenter.roeck@ericsson.com> | ||
16 | |||
17 | |||
18 | Description | ||
19 | ----------- | ||
20 | |||
21 | This driver supports hardware montoring for Maxim MAX34440 PMBus 6-Channel | ||
22 | Power-Supply Manager and MAX34441 PMBus 5-Channel Power-Supply Manager | ||
23 | and Intelligent Fan Controller. | ||
24 | |||
25 | The driver is a client driver to the core PMBus driver. Please see | ||
26 | Documentation/hwmon/pmbus for details on PMBus client drivers. | ||
27 | |||
28 | |||
29 | Usage Notes | ||
30 | ----------- | ||
31 | |||
32 | This driver does not auto-detect devices. You will have to instantiate the | ||
33 | devices explicitly. Please see Documentation/i2c/instantiating-devices for | ||
34 | details. | ||
35 | |||
36 | |||
37 | Platform data support | ||
38 | --------------------- | ||
39 | |||
40 | The driver supports standard PMBus driver platform data. | ||
41 | |||
42 | |||
43 | Sysfs entries | ||
44 | ------------- | ||
45 | |||
46 | The following attributes are supported. Limits are read-write; all other | ||
47 | attributes are read-only. | ||
48 | |||
49 | in[1-6]_label "vout[1-6]". | ||
50 | in[1-6]_input Measured voltage. From READ_VOUT register. | ||
51 | in[1-6]_min Minumum Voltage. From VOUT_UV_WARN_LIMIT register. | ||
52 | in[1-6]_max Maximum voltage. From VOUT_OV_WARN_LIMIT register. | ||
53 | in[1-6]_lcrit Critical minumum Voltage. VOUT_UV_FAULT_LIMIT register. | ||
54 | in[1-6]_crit Critical maximum voltage. From VOUT_OV_FAULT_LIMIT register. | ||
55 | in[1-6]_min_alarm Voltage low alarm. From VOLTAGE_UV_WARNING status. | ||
56 | in[1-6]_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. | ||
57 | in[1-6]_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. | ||
58 | in[1-6]_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. | ||
59 | |||
60 | curr[1-6]_label "iout[1-6]". | ||
61 | curr[1-6]_input Measured current. From READ_IOUT register. | ||
62 | curr[1-6]_max Maximum current. From IOUT_OC_WARN_LIMIT register. | ||
63 | curr[1-6]_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register. | ||
64 | curr[1-6]_max_alarm Current high alarm. From IOUT_OC_WARNING status. | ||
65 | curr[1-6]_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status. | ||
66 | |||
67 | in6 and curr6 attributes only exist for MAX34440. | ||
68 | |||
69 | temp[1-8]_input Measured temperatures. From READ_TEMPERATURE_1 register. | ||
70 | temp1 is the chip's internal temperature. temp2..temp5 | ||
71 | are remote I2C temperature sensors. For MAX34441, temp6 | ||
72 | is a remote thermal-diode sensor. For MAX34440, temp6..8 | ||
73 | are remote I2C temperature sensors. | ||
74 | temp[1-8]_max Maximum temperature. From OT_WARN_LIMIT register. | ||
75 | temp[1-8]_crit Critical high temperature. From OT_FAULT_LIMIT register. | ||
76 | temp[1-8]_max_alarm Temperature high alarm. | ||
77 | temp[1-8]_crit_alarm Temperature critical high alarm. | ||
78 | |||
79 | temp7 and temp8 attributes only exist for MAX34440. | ||
diff --git a/Documentation/hwmon/max8688 b/Documentation/hwmon/max8688 new file mode 100644 index 000000000000..0ddd3a412030 --- /dev/null +++ b/Documentation/hwmon/max8688 | |||
@@ -0,0 +1,69 @@ | |||
1 | Kernel driver max8688 | ||
2 | ===================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Maxim MAX8688 | ||
6 | Prefix: 'max8688' | ||
7 | Addresses scanned: - | ||
8 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX8688.pdf | ||
9 | |||
10 | Author: Guenter Roeck <guenter.roeck@ericsson.com> | ||
11 | |||
12 | |||
13 | Description | ||
14 | ----------- | ||
15 | |||
16 | This driver supports hardware montoring for Maxim MAX8688 Digital Power-Supply | ||
17 | Controller/Monitor with PMBus Interface. | ||
18 | |||
19 | The driver is a client driver to the core PMBus driver. Please see | ||
20 | Documentation/hwmon/pmbus for details on PMBus client drivers. | ||
21 | |||
22 | |||
23 | Usage Notes | ||
24 | ----------- | ||
25 | |||
26 | This driver does not auto-detect devices. You will have to instantiate the | ||
27 | devices explicitly. Please see Documentation/i2c/instantiating-devices for | ||
28 | details. | ||
29 | |||
30 | |||
31 | Platform data support | ||
32 | --------------------- | ||
33 | |||
34 | The driver supports standard PMBus driver platform data. | ||
35 | |||
36 | |||
37 | Sysfs entries | ||
38 | ------------- | ||
39 | |||
40 | The following attributes are supported. Limits are read-write; all other | ||
41 | attributes are read-only. | ||
42 | |||
43 | in1_label "vout1" | ||
44 | in1_input Measured voltage. From READ_VOUT register. | ||
45 | in1_min Minumum Voltage. From VOUT_UV_WARN_LIMIT register. | ||
46 | in1_max Maximum voltage. From VOUT_OV_WARN_LIMIT register. | ||
47 | in1_lcrit Critical minumum Voltage. VOUT_UV_FAULT_LIMIT register. | ||
48 | in1_crit Critical maximum voltage. From VOUT_OV_FAULT_LIMIT register. | ||
49 | in1_min_alarm Voltage low alarm. From VOLTAGE_UV_WARNING status. | ||
50 | in1_max_alarm Voltage high alarm. From VOLTAGE_OV_WARNING status. | ||
51 | in1_lcrit_alarm Voltage critical low alarm. From VOLTAGE_UV_FAULT status. | ||
52 | in1_crit_alarm Voltage critical high alarm. From VOLTAGE_OV_FAULT status. | ||
53 | |||
54 | curr1_label "iout1" | ||
55 | curr1_input Measured current. From READ_IOUT register. | ||
56 | curr1_max Maximum current. From IOUT_OC_WARN_LIMIT register. | ||
57 | curr1_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register. | ||
58 | curr1_max_alarm Current high alarm. From IOUT_OC_WARN_LIMIT register. | ||
59 | curr1_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status. | ||
60 | |||
61 | temp1_input Measured temperature. From READ_TEMPERATURE_1 register. | ||
62 | temp1_max Maximum temperature. From OT_WARN_LIMIT register. | ||
63 | temp1_crit Critical high temperature. From OT_FAULT_LIMIT register. | ||
64 | temp1_max_alarm Chip temperature high alarm. Set by comparing | ||
65 | READ_TEMPERATURE_1 with OT_WARN_LIMIT if TEMP_OT_WARNING | ||
66 | status is set. | ||
67 | temp1_crit_alarm Chip temperature critical high alarm. Set by comparing | ||
68 | READ_TEMPERATURE_1 with OT_FAULT_LIMIT if TEMP_OT_FAULT | ||
69 | status is set. | ||
diff --git a/Documentation/hwmon/pmbus b/Documentation/hwmon/pmbus index dc4933e96344..5e462fc7f99b 100644 --- a/Documentation/hwmon/pmbus +++ b/Documentation/hwmon/pmbus | |||
@@ -13,26 +13,6 @@ Supported chips: | |||
13 | Prefix: 'ltc2978' | 13 | Prefix: 'ltc2978' |
14 | Addresses scanned: - | 14 | Addresses scanned: - |
15 | Datasheet: http://cds.linear.com/docs/Datasheet/2978fa.pdf | 15 | Datasheet: http://cds.linear.com/docs/Datasheet/2978fa.pdf |
16 | * Maxim MAX16064 | ||
17 | Quad Power-Supply Controller | ||
18 | Prefix: 'max16064' | ||
19 | Addresses scanned: - | ||
20 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX16064.pdf | ||
21 | * Maxim MAX34440 | ||
22 | PMBus 6-Channel Power-Supply Manager | ||
23 | Prefixes: 'max34440' | ||
24 | Addresses scanned: - | ||
25 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34440.pdf | ||
26 | * Maxim MAX34441 | ||
27 | PMBus 5-Channel Power-Supply Manager and Intelligent Fan Controller | ||
28 | Prefixes: 'max34441' | ||
29 | Addresses scanned: - | ||
30 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34441.pdf | ||
31 | * Maxim MAX8688 | ||
32 | Digital Power-Supply Controller/Monitor | ||
33 | Prefix: 'max8688' | ||
34 | Addresses scanned: - | ||
35 | Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX8688.pdf | ||
36 | * Generic PMBus devices | 16 | * Generic PMBus devices |
37 | Prefix: 'pmbus' | 17 | Prefix: 'pmbus' |
38 | Addresses scanned: - | 18 | Addresses scanned: - |
@@ -175,11 +155,13 @@ currX_crit Critical maximum current. | |||
175 | From IIN_OC_FAULT_LIMIT or IOUT_OC_FAULT_LIMIT register. | 155 | From IIN_OC_FAULT_LIMIT or IOUT_OC_FAULT_LIMIT register. |
176 | currX_alarm Current high alarm. | 156 | currX_alarm Current high alarm. |
177 | From IIN_OC_WARNING or IOUT_OC_WARNING status. | 157 | From IIN_OC_WARNING or IOUT_OC_WARNING status. |
158 | currX_max_alarm Current high alarm. | ||
159 | From IIN_OC_WARN_LIMIT or IOUT_OC_WARN_LIMIT status. | ||
178 | currX_lcrit_alarm Output current critical low alarm. | 160 | currX_lcrit_alarm Output current critical low alarm. |
179 | From IOUT_UC_FAULT status. | 161 | From IOUT_UC_FAULT status. |
180 | currX_crit_alarm Current critical high alarm. | 162 | currX_crit_alarm Current critical high alarm. |
181 | From IIN_OC_FAULT or IOUT_OC_FAULT status. | 163 | From IIN_OC_FAULT or IOUT_OC_FAULT status. |
182 | currX_label "iin" or "vinY" | 164 | currX_label "iin" or "ioutY" |
183 | 165 | ||
184 | powerX_input Measured power. From READ_PIN or READ_POUT register. | 166 | powerX_input Measured power. From READ_PIN or READ_POUT register. |
185 | powerX_cap Output power cap. From POUT_MAX register. | 167 | powerX_cap Output power cap. From POUT_MAX register. |
@@ -193,13 +175,13 @@ powerX_crit_alarm Output power critical high alarm. | |||
193 | From POUT_OP_FAULT status. | 175 | From POUT_OP_FAULT status. |
194 | powerX_label "pin" or "poutY" | 176 | powerX_label "pin" or "poutY" |
195 | 177 | ||
196 | tempX_input Measured tempererature. | 178 | tempX_input Measured temperature. |
197 | From READ_TEMPERATURE_X register. | 179 | From READ_TEMPERATURE_X register. |
198 | tempX_min Mimimum tempererature. From UT_WARN_LIMIT register. | 180 | tempX_min Mimimum temperature. From UT_WARN_LIMIT register. |
199 | tempX_max Maximum tempererature. From OT_WARN_LIMIT register. | 181 | tempX_max Maximum temperature. From OT_WARN_LIMIT register. |
200 | tempX_lcrit Critical low tempererature. | 182 | tempX_lcrit Critical low temperature. |
201 | From UT_FAULT_LIMIT register. | 183 | From UT_FAULT_LIMIT register. |
202 | tempX_crit Critical high tempererature. | 184 | tempX_crit Critical high temperature. |
203 | From OT_FAULT_LIMIT register. | 185 | From OT_FAULT_LIMIT register. |
204 | tempX_min_alarm Chip temperature low alarm. Set by comparing | 186 | tempX_min_alarm Chip temperature low alarm. Set by comparing |
205 | READ_TEMPERATURE_X with UT_WARN_LIMIT if | 187 | READ_TEMPERATURE_X with UT_WARN_LIMIT if |
diff --git a/Documentation/hwmon/smm665 b/Documentation/hwmon/smm665 index 3820fc9ca52d..59e316140542 100644 --- a/Documentation/hwmon/smm665 +++ b/Documentation/hwmon/smm665 | |||
@@ -150,8 +150,8 @@ in8_crit_alarm Channel F critical alarm | |||
150 | in9_crit_alarm AIN1 critical alarm | 150 | in9_crit_alarm AIN1 critical alarm |
151 | in10_crit_alarm AIN2 critical alarm | 151 | in10_crit_alarm AIN2 critical alarm |
152 | 152 | ||
153 | temp1_input Chip tempererature | 153 | temp1_input Chip temperature |
154 | temp1_min Mimimum chip tempererature | 154 | temp1_min Mimimum chip temperature |
155 | temp1_max Maximum chip tempererature | 155 | temp1_max Maximum chip temperature |
156 | temp1_crit Critical chip tempererature | 156 | temp1_crit Critical chip temperature |
157 | temp1_crit_alarm Temperature critical alarm | 157 | temp1_crit_alarm Temperature critical alarm |
diff --git a/Documentation/hwmon/submitting-patches b/Documentation/hwmon/submitting-patches new file mode 100644 index 000000000000..86f42e8e9e49 --- /dev/null +++ b/Documentation/hwmon/submitting-patches | |||
@@ -0,0 +1,109 @@ | |||
1 | How to Get Your Patch Accepted Into the Hwmon Subsystem | ||
2 | ------------------------------------------------------- | ||
3 | |||
4 | This text is is a collection of suggestions for people writing patches or | ||
5 | drivers for the hwmon subsystem. Following these suggestions will greatly | ||
6 | increase the chances of your change being accepted. | ||
7 | |||
8 | |||
9 | 1. General | ||
10 | ---------- | ||
11 | |||
12 | * It should be unnecessary to mention, but please read and follow | ||
13 | Documentation/SubmitChecklist | ||
14 | Documentation/SubmittingDrivers | ||
15 | Documentation/SubmittingPatches | ||
16 | Documentation/CodingStyle | ||
17 | |||
18 | * If your patch generates checkpatch warnings, please refrain from explanations | ||
19 | such as "I don't like that coding style". Keep in mind that each unnecessary | ||
20 | warning helps hiding a real problem. If you don't like the kernel coding | ||
21 | style, don't write kernel drivers. | ||
22 | |||
23 | * Please test your patch thoroughly. We are not your test group. | ||
24 | Sometimes a patch can not or not completely be tested because of missing | ||
25 | hardware. In such cases, you should test-build the code on at least one | ||
26 | architecture. If run-time testing was not achieved, it should be written | ||
27 | explicitly below the patch header. | ||
28 | |||
29 | * If your patch (or the driver) is affected by configuration options such as | ||
30 | CONFIG_SMP or CONFIG_HOTPLUG, make sure it compiles for all configuration | ||
31 | variants. | ||
32 | |||
33 | |||
34 | 2. Adding functionality to existing drivers | ||
35 | ------------------------------------------- | ||
36 | |||
37 | * Make sure the documentation in Documentation/hwmon/<driver_name> is up to | ||
38 | date. | ||
39 | |||
40 | * Make sure the information in Kconfig is up to date. | ||
41 | |||
42 | * If the added functionality requires some cleanup or structural changes, split | ||
43 | your patch into a cleanup part and the actual addition. This makes it easier | ||
44 | to review your changes, and to bisect any resulting problems. | ||
45 | |||
46 | * Never mix bug fixes, cleanup, and functional enhancements in a single patch. | ||
47 | |||
48 | |||
49 | 3. New drivers | ||
50 | -------------- | ||
51 | |||
52 | * Running your patch or driver file(s) through checkpatch does not mean its | ||
53 | formatting is clean. If unsure about formatting in your new driver, run it | ||
54 | through Lindent. Lindent is not perfect, and you may have to do some minor | ||
55 | cleanup, but it is a good start. | ||
56 | |||
57 | * Consider adding yourself to MAINTAINERS. | ||
58 | |||
59 | * Document the driver in Documentation/hwmon/<driver_name>. | ||
60 | |||
61 | * Add the driver to Kconfig and Makefile in alphabetical order. | ||
62 | |||
63 | * Make sure that all dependencies are listed in Kconfig. For new drivers, it | ||
64 | is most likely prudent to add a dependency on EXPERIMENTAL. | ||
65 | |||
66 | * Avoid forward declarations if you can. Rearrange the code if necessary. | ||
67 | |||
68 | * Avoid calculations in macros and macro-generated functions. While such macros | ||
69 | may save a line or so in the source, it obfuscates the code and makes code | ||
70 | review more difficult. It may also result in code which is more complicated | ||
71 | than necessary. Use inline functions or just regular functions instead. | ||
72 | |||
73 | * If the driver has a detect function, make sure it is silent. Debug messages | ||
74 | and messages printed after a successful detection are acceptable, but it | ||
75 | must not print messages such as "Chip XXX not found/supported". | ||
76 | |||
77 | Keep in mind that the detect function will run for all drivers supporting an | ||
78 | address if a chip is detected on that address. Unnecessary messages will just | ||
79 | pollute the kernel log and not provide any value. | ||
80 | |||
81 | * Provide a detect function if and only if a chip can be detected reliably. | ||
82 | |||
83 | * Avoid writing to chip registers in the detect function. If you have to write, | ||
84 | only do it after you have already gathered enough data to be certain that the | ||
85 | detection is going to be successful. | ||
86 | |||
87 | Keep in mind that the chip might not be what your driver believes it is, and | ||
88 | writing to it might cause a bad misconfiguration. | ||
89 | |||
90 | * Make sure there are no race conditions in the probe function. Specifically, | ||
91 | completely initialize your chip first, then create sysfs entries and register | ||
92 | with the hwmon subsystem. | ||
93 | |||
94 | * Do not provide support for deprecated sysfs attributes. | ||
95 | |||
96 | * Do not create non-standard attributes unless really needed. If you have to use | ||
97 | non-standard attributes, or you believe you do, discuss it on the mailing list | ||
98 | first. Either case, provide a detailed explanation why you need the | ||
99 | non-standard attribute(s). | ||
100 | Standard attributes are specified in Documentation/hwmon/sysfs-interface. | ||
101 | |||
102 | * When deciding which sysfs attributes to support, look at the chip's | ||
103 | capabilities. While we do not expect your driver to support everything the | ||
104 | chip may offer, it should at least support all limits and alarms. | ||
105 | |||
106 | * Last but not least, please check if a driver for your chip already exists | ||
107 | before starting to write a new driver. Especially for temperature sensors, | ||
108 | new chips are often variants of previously released chips. In some cases, | ||
109 | a presumably new chip may simply have been relabeled. | ||
diff --git a/Documentation/input/event-codes.txt b/Documentation/input/event-codes.txt new file mode 100644 index 000000000000..23fcb05175be --- /dev/null +++ b/Documentation/input/event-codes.txt | |||
@@ -0,0 +1,262 @@ | |||
1 | The input protocol uses a map of types and codes to express input device values | ||
2 | to userspace. This document describes the types and codes and how and when they | ||
3 | may be used. | ||
4 | |||
5 | A single hardware event generates multiple input events. Each input event | ||
6 | contains the new value of a single data item. A special event type, EV_SYN, is | ||
7 | used to separate input events into packets of input data changes occurring at | ||
8 | the same moment in time. In the following, the term "event" refers to a single | ||
9 | input event encompassing a type, code, and value. | ||
10 | |||
11 | The input protocol is a stateful protocol. Events are emitted only when values | ||
12 | of event codes have changed. However, the state is maintained within the Linux | ||
13 | input subsystem; drivers do not need to maintain the state and may attempt to | ||
14 | emit unchanged values without harm. Userspace may obtain the current state of | ||
15 | event code values using the EVIOCG* ioctls defined in linux/input.h. The event | ||
16 | reports supported by a device are also provided by sysfs in | ||
17 | class/input/event*/device/capabilities/, and the properties of a device are | ||
18 | provided in class/input/event*/device/properties. | ||
19 | |||
20 | Types: | ||
21 | ========== | ||
22 | Types are groupings of codes under a logical input construct. Each type has a | ||
23 | set of applicable codes to be used in generating events. See the Codes section | ||
24 | for details on valid codes for each type. | ||
25 | |||
26 | * EV_SYN: | ||
27 | - Used as markers to separate events. Events may be separated in time or in | ||
28 | space, such as with the multitouch protocol. | ||
29 | |||
30 | * EV_KEY: | ||
31 | - Used to describe state changes of keyboards, buttons, or other key-like | ||
32 | devices. | ||
33 | |||
34 | * EV_REL: | ||
35 | - Used to describe relative axis value changes, e.g. moving the mouse 5 units | ||
36 | to the left. | ||
37 | |||
38 | * EV_ABS: | ||
39 | - Used to describe absolute axis value changes, e.g. describing the | ||
40 | coordinates of a touch on a touchscreen. | ||
41 | |||
42 | * EV_MSC: | ||
43 | - Used to describe miscellaneous input data that do not fit into other types. | ||
44 | |||
45 | * EV_SW: | ||
46 | - Used to describe binary state input switches. | ||
47 | |||
48 | * EV_LED: | ||
49 | - Used to turn LEDs on devices on and off. | ||
50 | |||
51 | * EV_SND: | ||
52 | - Used to output sound to devices. | ||
53 | |||
54 | * EV_REP: | ||
55 | - Used for autorepeating devices. | ||
56 | |||
57 | * EV_FF: | ||
58 | - Used to send force feedback commands to an input device. | ||
59 | |||
60 | * EV_PWR: | ||
61 | - A special type for power button and switch input. | ||
62 | |||
63 | * EV_FF_STATUS: | ||
64 | - Used to receive force feedback device status. | ||
65 | |||
66 | Codes: | ||
67 | ========== | ||
68 | Codes define the precise type of event. | ||
69 | |||
70 | EV_SYN: | ||
71 | ---------- | ||
72 | EV_SYN event values are undefined. Their usage is defined only by when they are | ||
73 | sent in the evdev event stream. | ||
74 | |||
75 | * SYN_REPORT: | ||
76 | - Used to synchronize and separate events into packets of input data changes | ||
77 | occurring at the same moment in time. For example, motion of a mouse may set | ||
78 | the REL_X and REL_Y values for one motion, then emit a SYN_REPORT. The next | ||
79 | motion will emit more REL_X and REL_Y values and send another SYN_REPORT. | ||
80 | |||
81 | * SYN_CONFIG: | ||
82 | - TBD | ||
83 | |||
84 | * SYN_MT_REPORT: | ||
85 | - Used to synchronize and separate touch events. See the | ||
86 | multi-touch-protocol.txt document for more information. | ||
87 | |||
88 | * SYN_DROPPED: | ||
89 | - Used to indicate buffer overrun in the evdev client's event queue. | ||
90 | Client should ignore all events up to and including next SYN_REPORT | ||
91 | event and query the device (using EVIOCG* ioctls) to obtain its | ||
92 | current state. | ||
93 | |||
94 | EV_KEY: | ||
95 | ---------- | ||
96 | EV_KEY events take the form KEY_<name> or BTN_<name>. For example, KEY_A is used | ||
97 | to represent the 'A' key on a keyboard. When a key is depressed, an event with | ||
98 | the key's code is emitted with value 1. When the key is released, an event is | ||
99 | emitted with value 0. Some hardware send events when a key is repeated. These | ||
100 | events have a value of 2. In general, KEY_<name> is used for keyboard keys, and | ||
101 | BTN_<name> is used for other types of momentary switch events. | ||
102 | |||
103 | A few EV_KEY codes have special meanings: | ||
104 | |||
105 | * BTN_TOOL_<name>: | ||
106 | - These codes are used in conjunction with input trackpads, tablets, and | ||
107 | touchscreens. These devices may be used with fingers, pens, or other tools. | ||
108 | When an event occurs and a tool is used, the corresponding BTN_TOOL_<name> | ||
109 | code should be set to a value of 1. When the tool is no longer interacting | ||
110 | with the input device, the BTN_TOOL_<name> code should be reset to 0. All | ||
111 | trackpads, tablets, and touchscreens should use at least one BTN_TOOL_<name> | ||
112 | code when events are generated. | ||
113 | |||
114 | * BTN_TOUCH: | ||
115 | BTN_TOUCH is used for touch contact. While an input tool is determined to be | ||
116 | within meaningful physical contact, the value of this property must be set | ||
117 | to 1. Meaningful physical contact may mean any contact, or it may mean | ||
118 | contact conditioned by an implementation defined property. For example, a | ||
119 | touchpad may set the value to 1 only when the touch pressure rises above a | ||
120 | certain value. BTN_TOUCH may be combined with BTN_TOOL_<name> codes. For | ||
121 | example, a pen tablet may set BTN_TOOL_PEN to 1 and BTN_TOUCH to 0 while the | ||
122 | pen is hovering over but not touching the tablet surface. | ||
123 | |||
124 | Note: For appropriate function of the legacy mousedev emulation driver, | ||
125 | BTN_TOUCH must be the first evdev code emitted in a synchronization frame. | ||
126 | |||
127 | Note: Historically a touch device with BTN_TOOL_FINGER and BTN_TOUCH was | ||
128 | interpreted as a touchpad by userspace, while a similar device without | ||
129 | BTN_TOOL_FINGER was interpreted as a touchscreen. For backwards compatibility | ||
130 | with current userspace it is recommended to follow this distinction. In the | ||
131 | future, this distinction will be deprecated and the device properties ioctl | ||
132 | EVIOCGPROP, defined in linux/input.h, will be used to convey the device type. | ||
133 | |||
134 | * BTN_TOOL_FINGER, BTN_TOOL_DOUBLETAP, BTN_TOOL_TRIPLETAP, BTN_TOOL_QUADTAP: | ||
135 | - These codes denote one, two, three, and four finger interaction on a | ||
136 | trackpad or touchscreen. For example, if the user uses two fingers and moves | ||
137 | them on the touchpad in an effort to scroll content on screen, | ||
138 | BTN_TOOL_DOUBLETAP should be set to value 1 for the duration of the motion. | ||
139 | Note that all BTN_TOOL_<name> codes and the BTN_TOUCH code are orthogonal in | ||
140 | purpose. A trackpad event generated by finger touches should generate events | ||
141 | for one code from each group. At most only one of these BTN_TOOL_<name> | ||
142 | codes should have a value of 1 during any synchronization frame. | ||
143 | |||
144 | Note: Historically some drivers emitted multiple of the finger count codes with | ||
145 | a value of 1 in the same synchronization frame. This usage is deprecated. | ||
146 | |||
147 | Note: In multitouch drivers, the input_mt_report_finger_count() function should | ||
148 | be used to emit these codes. Please see multi-touch-protocol.txt for details. | ||
149 | |||
150 | EV_REL: | ||
151 | ---------- | ||
152 | EV_REL events describe relative changes in a property. For example, a mouse may | ||
153 | move to the left by a certain number of units, but its absolute position in | ||
154 | space is unknown. If the absolute position is known, EV_ABS codes should be used | ||
155 | instead of EV_REL codes. | ||
156 | |||
157 | A few EV_REL codes have special meanings: | ||
158 | |||
159 | * REL_WHEEL, REL_HWHEEL: | ||
160 | - These codes are used for vertical and horizontal scroll wheels, | ||
161 | respectively. | ||
162 | |||
163 | EV_ABS: | ||
164 | ---------- | ||
165 | EV_ABS events describe absolute changes in a property. For example, a touchpad | ||
166 | may emit coordinates for a touch location. | ||
167 | |||
168 | A few EV_ABS codes have special meanings: | ||
169 | |||
170 | * ABS_DISTANCE: | ||
171 | - Used to describe the distance of a tool from an interaction surface. This | ||
172 | event should only be emitted while the tool is hovering, meaning in close | ||
173 | proximity of the device and while the value of the BTN_TOUCH code is 0. If | ||
174 | the input device may be used freely in three dimensions, consider ABS_Z | ||
175 | instead. | ||
176 | |||
177 | * ABS_MT_<name>: | ||
178 | - Used to describe multitouch input events. Please see | ||
179 | multi-touch-protocol.txt for details. | ||
180 | |||
181 | EV_SW: | ||
182 | ---------- | ||
183 | EV_SW events describe stateful binary switches. For example, the SW_LID code is | ||
184 | used to denote when a laptop lid is closed. | ||
185 | |||
186 | Upon binding to a device or resuming from suspend, a driver must report | ||
187 | the current switch state. This ensures that the device, kernel, and userspace | ||
188 | state is in sync. | ||
189 | |||
190 | Upon resume, if the switch state is the same as before suspend, then the input | ||
191 | subsystem will filter out the duplicate switch state reports. The driver does | ||
192 | not need to keep the state of the switch at any time. | ||
193 | |||
194 | EV_MSC: | ||
195 | ---------- | ||
196 | EV_MSC events are used for input and output events that do not fall under other | ||
197 | categories. | ||
198 | |||
199 | EV_LED: | ||
200 | ---------- | ||
201 | EV_LED events are used for input and output to set and query the state of | ||
202 | various LEDs on devices. | ||
203 | |||
204 | EV_REP: | ||
205 | ---------- | ||
206 | EV_REP events are used for specifying autorepeating events. | ||
207 | |||
208 | EV_SND: | ||
209 | ---------- | ||
210 | EV_SND events are used for sending sound commands to simple sound output | ||
211 | devices. | ||
212 | |||
213 | EV_FF: | ||
214 | ---------- | ||
215 | EV_FF events are used to initialize a force feedback capable device and to cause | ||
216 | such device to feedback. | ||
217 | |||
218 | EV_PWR: | ||
219 | ---------- | ||
220 | EV_PWR events are a special type of event used specifically for power | ||
221 | mangement. Its usage is not well defined. To be addressed later. | ||
222 | |||
223 | Guidelines: | ||
224 | ========== | ||
225 | The guidelines below ensure proper single-touch and multi-finger functionality. | ||
226 | For multi-touch functionality, see the multi-touch-protocol.txt document for | ||
227 | more information. | ||
228 | |||
229 | Mice: | ||
230 | ---------- | ||
231 | REL_{X,Y} must be reported when the mouse moves. BTN_LEFT must be used to report | ||
232 | the primary button press. BTN_{MIDDLE,RIGHT,4,5,etc.} should be used to report | ||
233 | further buttons of the device. REL_WHEEL and REL_HWHEEL should be used to report | ||
234 | scroll wheel events where available. | ||
235 | |||
236 | Touchscreens: | ||
237 | ---------- | ||
238 | ABS_{X,Y} must be reported with the location of the touch. BTN_TOUCH must be | ||
239 | used to report when a touch is active on the screen. | ||
240 | BTN_{MOUSE,LEFT,MIDDLE,RIGHT} must not be reported as the result of touch | ||
241 | contact. BTN_TOOL_<name> events should be reported where possible. | ||
242 | |||
243 | Trackpads: | ||
244 | ---------- | ||
245 | Legacy trackpads that only provide relative position information must report | ||
246 | events like mice described above. | ||
247 | |||
248 | Trackpads that provide absolute touch position must report ABS_{X,Y} for the | ||
249 | location of the touch. BTN_TOUCH should be used to report when a touch is active | ||
250 | on the trackpad. Where multi-finger support is available, BTN_TOOL_<name> should | ||
251 | be used to report the number of touches active on the trackpad. | ||
252 | |||
253 | Tablets: | ||
254 | ---------- | ||
255 | BTN_TOOL_<name> events must be reported when a stylus or other tool is active on | ||
256 | the tablet. ABS_{X,Y} must be reported with the location of the tool. BTN_TOUCH | ||
257 | should be used to report when the tool is in contact with the tablet. | ||
258 | BTN_{STYLUS,STYLUS2} should be used to report buttons on the tool itself. Any | ||
259 | button may be used for buttons on the tablet except BTN_{MOUSE,LEFT}. | ||
260 | BTN_{0,1,2,etc} are good generic codes for unlabeled buttons. Do not use | ||
261 | meaningful buttons, like BTN_FORWARD, unless the button is labeled for that | ||
262 | purpose on the device. | ||
diff --git a/Documentation/md.txt b/Documentation/md.txt index a81c7b4790f2..2366b1c8cf19 100644 --- a/Documentation/md.txt +++ b/Documentation/md.txt | |||
@@ -552,6 +552,16 @@ also have | |||
552 | within the array where IO will be blocked. This is currently | 552 | within the array where IO will be blocked. This is currently |
553 | only supported for raid4/5/6. | 553 | only supported for raid4/5/6. |
554 | 554 | ||
555 | sync_min | ||
556 | sync_max | ||
557 | The two values, given as numbers of sectors, indicate a range | ||
558 | withing the array where 'check'/'repair' will operate. Must be | ||
559 | a multiple of chunk_size. When it reaches "sync_max" it will | ||
560 | pause, rather than complete. | ||
561 | You can use 'select' or 'poll' on "sync_completed" to wait for | ||
562 | that number to reach sync_max. Then you can either increase | ||
563 | "sync_max", or can write 'idle' to "sync_action". | ||
564 | |||
555 | 565 | ||
556 | Each active md device may also have attributes specific to the | 566 | Each active md device may also have attributes specific to the |
557 | personality module that manages it. | 567 | personality module that manages it. |
diff --git a/Documentation/sound/alsa/SB-Live-mixer.txt b/Documentation/sound/alsa/SB-Live-mixer.txt index f5639d40521d..f4b5988f450c 100644 --- a/Documentation/sound/alsa/SB-Live-mixer.txt +++ b/Documentation/sound/alsa/SB-Live-mixer.txt | |||
@@ -87,14 +87,14 @@ accumulator. ALSA uses accumulators 0 and 1 for left and right PCM. | |||
87 | The result is forwarded to the ADC capture FIFO (thus to the standard capture | 87 | The result is forwarded to the ADC capture FIFO (thus to the standard capture |
88 | PCM device). | 88 | PCM device). |
89 | 89 | ||
90 | name='Music Playback Volume',index=0 | 90 | name='Synth Playback Volume',index=0 |
91 | 91 | ||
92 | This control is used to attenuate samples for left and right MIDI FX-bus | 92 | This control is used to attenuate samples for left and right MIDI FX-bus |
93 | accumulators. ALSA uses accumulators 4 and 5 for left and right MIDI samples. | 93 | accumulators. ALSA uses accumulators 4 and 5 for left and right MIDI samples. |
94 | The result samples are forwarded to the front DAC PCM slots of the AC97 codec. | 94 | The result samples are forwarded to the front DAC PCM slots of the AC97 codec. |
95 | 95 | ||
96 | name='Music Capture Volume',index=0 | 96 | name='Synth Capture Volume',index=0 |
97 | name='Music Capture Switch',index=0 | 97 | name='Synth Capture Switch',index=0 |
98 | 98 | ||
99 | These controls are used to attenuate samples for left and right MIDI FX-bus | 99 | These controls are used to attenuate samples for left and right MIDI FX-bus |
100 | accumulator. ALSA uses accumulators 4 and 5 for left and right PCM. | 100 | accumulator. ALSA uses accumulators 4 and 5 for left and right PCM. |
diff --git a/Documentation/video4linux/sh_mobile_ceu_camera.txt b/Documentation/video4linux/sh_mobile_ceu_camera.txt index cb47e723af74..1e96ce6e2d2f 100644 --- a/Documentation/video4linux/sh_mobile_ceu_camera.txt +++ b/Documentation/video4linux/sh_mobile_ceu_camera.txt | |||
@@ -37,7 +37,7 @@ Generic scaling / cropping scheme | |||
37 | -1'- | 37 | -1'- |
38 | 38 | ||
39 | In the above chart minuses and slashes represent "real" data amounts, points and | 39 | In the above chart minuses and slashes represent "real" data amounts, points and |
40 | accents represent "useful" data, basically, CEU scaled amd cropped output, | 40 | accents represent "useful" data, basically, CEU scaled and cropped output, |
41 | mapped back onto the client's source plane. | 41 | mapped back onto the client's source plane. |
42 | 42 | ||
43 | Such a configuration can be produced by user requests: | 43 | Such a configuration can be produced by user requests: |
@@ -65,7 +65,7 @@ Do not touch input rectangle - it is already optimal. | |||
65 | 65 | ||
66 | 1. Calculate current sensor scales: | 66 | 1. Calculate current sensor scales: |
67 | 67 | ||
68 | scale_s = ((3') - (3)) / ((2') - (2)) | 68 | scale_s = ((2') - (2)) / ((3') - (3)) |
69 | 69 | ||
70 | 2. Calculate "effective" input crop (sensor subwindow) - CEU crop scaled back at | 70 | 2. Calculate "effective" input crop (sensor subwindow) - CEU crop scaled back at |
71 | current sensor scales onto input window - this is user S_CROP: | 71 | current sensor scales onto input window - this is user S_CROP: |
@@ -80,7 +80,7 @@ window: | |||
80 | 4. Calculate sensor output window by applying combined scales to real input | 80 | 4. Calculate sensor output window by applying combined scales to real input |
81 | window: | 81 | window: |
82 | 82 | ||
83 | width_s_out = ((2') - (2)) / scale_comb | 83 | width_s_out = ((7') - (7)) = ((2') - (2)) / scale_comb |
84 | 84 | ||
85 | 5. Apply iterative sensor S_FMT for sensor output window. | 85 | 5. Apply iterative sensor S_FMT for sensor output window. |
86 | 86 | ||
diff --git a/Documentation/workqueue.txt b/Documentation/workqueue.txt index 01c513fac40e..a0b577de918f 100644 --- a/Documentation/workqueue.txt +++ b/Documentation/workqueue.txt | |||
@@ -12,6 +12,7 @@ CONTENTS | |||
12 | 4. Application Programming Interface (API) | 12 | 4. Application Programming Interface (API) |
13 | 5. Example Execution Scenarios | 13 | 5. Example Execution Scenarios |
14 | 6. Guidelines | 14 | 6. Guidelines |
15 | 7. Debugging | ||
15 | 16 | ||
16 | 17 | ||
17 | 1. Introduction | 18 | 1. Introduction |
@@ -379,3 +380,42 @@ If q1 has WQ_CPU_INTENSIVE set, | |||
379 | * Unless work items are expected to consume a huge amount of CPU | 380 | * Unless work items are expected to consume a huge amount of CPU |
380 | cycles, using a bound wq is usually beneficial due to the increased | 381 | cycles, using a bound wq is usually beneficial due to the increased |
381 | level of locality in wq operations and work item execution. | 382 | level of locality in wq operations and work item execution. |
383 | |||
384 | |||
385 | 7. Debugging | ||
386 | |||
387 | Because the work functions are executed by generic worker threads | ||
388 | there are a few tricks needed to shed some light on misbehaving | ||
389 | workqueue users. | ||
390 | |||
391 | Worker threads show up in the process list as: | ||
392 | |||
393 | root 5671 0.0 0.0 0 0 ? S 12:07 0:00 [kworker/0:1] | ||
394 | root 5672 0.0 0.0 0 0 ? S 12:07 0:00 [kworker/1:2] | ||
395 | root 5673 0.0 0.0 0 0 ? S 12:12 0:00 [kworker/0:0] | ||
396 | root 5674 0.0 0.0 0 0 ? S 12:13 0:00 [kworker/1:0] | ||
397 | |||
398 | If kworkers are going crazy (using too much cpu), there are two types | ||
399 | of possible problems: | ||
400 | |||
401 | 1. Something beeing scheduled in rapid succession | ||
402 | 2. A single work item that consumes lots of cpu cycles | ||
403 | |||
404 | The first one can be tracked using tracing: | ||
405 | |||
406 | $ echo workqueue:workqueue_queue_work > /sys/kernel/debug/tracing/set_event | ||
407 | $ cat /sys/kernel/debug/tracing/trace_pipe > out.txt | ||
408 | (wait a few secs) | ||
409 | ^C | ||
410 | |||
411 | If something is busy looping on work queueing, it would be dominating | ||
412 | the output and the offender can be determined with the work item | ||
413 | function. | ||
414 | |||
415 | For the second type of problems it should be possible to just check | ||
416 | the stack trace of the offending worker thread. | ||
417 | |||
418 | $ cat /proc/THE_OFFENDING_KWORKER/stack | ||
419 | |||
420 | The work item's function should be trivially visible in the stack | ||
421 | trace. | ||
diff --git a/MAINTAINERS b/MAINTAINERS index eb4f996d39b7..16a5c5f2c6a6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -185,10 +185,9 @@ F: Documentation/filesystems/9p.txt | |||
185 | F: fs/9p/ | 185 | F: fs/9p/ |
186 | 186 | ||
187 | A2232 SERIAL BOARD DRIVER | 187 | A2232 SERIAL BOARD DRIVER |
188 | M: Enver Haase <A2232@gmx.net> | ||
189 | L: linux-m68k@lists.linux-m68k.org | 188 | L: linux-m68k@lists.linux-m68k.org |
190 | S: Maintained | 189 | S: Orphan |
191 | F: drivers/char/ser_a2232* | 190 | F: drivers/staging/generic_serial/ser_a2232* |
192 | 191 | ||
193 | AACRAID SCSI RAID DRIVER | 192 | AACRAID SCSI RAID DRIVER |
194 | M: Adaptec OEM Raid Solutions <aacraid@adaptec.com> | 193 | M: Adaptec OEM Raid Solutions <aacraid@adaptec.com> |
@@ -878,6 +877,13 @@ F: arch/arm/mach-mv78xx0/ | |||
878 | F: arch/arm/mach-orion5x/ | 877 | F: arch/arm/mach-orion5x/ |
879 | F: arch/arm/plat-orion/ | 878 | F: arch/arm/plat-orion/ |
880 | 879 | ||
880 | ARM/Orion SoC/Technologic Systems TS-78xx platform support | ||
881 | M: Alexander Clouter <alex@digriz.org.uk> | ||
882 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
883 | W: http://www.digriz.org.uk/ts78xx/kernel | ||
884 | S: Maintained | ||
885 | F: arch/arm/mach-orion5x/ts78xx-* | ||
886 | |||
881 | ARM/MIOA701 MACHINE SUPPORT | 887 | ARM/MIOA701 MACHINE SUPPORT |
882 | M: Robert Jarzmik <robert.jarzmik@free.fr> | 888 | M: Robert Jarzmik <robert.jarzmik@free.fr> |
883 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 889 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
@@ -1026,12 +1032,13 @@ W: http://www.fluff.org/ben/linux/ | |||
1026 | S: Maintained | 1032 | S: Maintained |
1027 | F: arch/arm/mach-s3c64xx/ | 1033 | F: arch/arm/mach-s3c64xx/ |
1028 | 1034 | ||
1029 | ARM/S5P ARM ARCHITECTURES | 1035 | ARM/S5P EXYNOS ARM ARCHITECTURES |
1030 | M: Kukjin Kim <kgene.kim@samsung.com> | 1036 | M: Kukjin Kim <kgene.kim@samsung.com> |
1031 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1037 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1032 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 1038 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
1033 | S: Maintained | 1039 | S: Maintained |
1034 | F: arch/arm/mach-s5p*/ | 1040 | F: arch/arm/mach-s5p*/ |
1041 | F: arch/arm/mach-exynos*/ | ||
1035 | 1042 | ||
1036 | ARM/SAMSUNG MOBILE MACHINE SUPPORT | 1043 | ARM/SAMSUNG MOBILE MACHINE SUPPORT |
1037 | M: Kyungmin Park <kyungmin.park@samsung.com> | 1044 | M: Kyungmin Park <kyungmin.park@samsung.com> |
@@ -1064,7 +1071,7 @@ F: arch/arm/mach-shmobile/ | |||
1064 | F: drivers/sh/ | 1071 | F: drivers/sh/ |
1065 | 1072 | ||
1066 | ARM/TELECHIPS ARM ARCHITECTURE | 1073 | ARM/TELECHIPS ARM ARCHITECTURE |
1067 | M: "Hans J. Koch" <hjk@linutronix.de> | 1074 | M: "Hans J. Koch" <hjk@hansjkoch.de> |
1068 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1075 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1069 | S: Maintained | 1076 | S: Maintained |
1070 | F: arch/arm/plat-tcc/ | 1077 | F: arch/arm/plat-tcc/ |
@@ -1824,11 +1831,10 @@ S: Maintained | |||
1824 | F: drivers/platform/x86/compal-laptop.c | 1831 | F: drivers/platform/x86/compal-laptop.c |
1825 | 1832 | ||
1826 | COMPUTONE INTELLIPORT MULTIPORT CARD | 1833 | COMPUTONE INTELLIPORT MULTIPORT CARD |
1827 | M: "Michael H. Warfield" <mhw@wittsend.com> | ||
1828 | W: http://www.wittsend.com/computone.html | 1834 | W: http://www.wittsend.com/computone.html |
1829 | S: Maintained | 1835 | S: Orphan |
1830 | F: Documentation/serial/computone.txt | 1836 | F: Documentation/serial/computone.txt |
1831 | F: drivers/char/ip2/ | 1837 | F: drivers/staging/tty/ip2/ |
1832 | 1838 | ||
1833 | CONEXANT ACCESSRUNNER USB DRIVER | 1839 | CONEXANT ACCESSRUNNER USB DRIVER |
1834 | M: Simon Arlott <cxacru@fire.lp0.eu> | 1840 | M: Simon Arlott <cxacru@fire.lp0.eu> |
@@ -2011,7 +2017,7 @@ F: drivers/net/wan/cycx* | |||
2011 | CYCLADES ASYNC MUX DRIVER | 2017 | CYCLADES ASYNC MUX DRIVER |
2012 | W: http://www.cyclades.com/ | 2018 | W: http://www.cyclades.com/ |
2013 | S: Orphan | 2019 | S: Orphan |
2014 | F: drivers/char/cyclades.c | 2020 | F: drivers/tty/cyclades.c |
2015 | F: include/linux/cyclades.h | 2021 | F: include/linux/cyclades.h |
2016 | 2022 | ||
2017 | CYCLADES PC300 DRIVER | 2023 | CYCLADES PC300 DRIVER |
@@ -2125,8 +2131,8 @@ L: Eng.Linux@digi.com | |||
2125 | W: http://www.digi.com | 2131 | W: http://www.digi.com |
2126 | S: Orphan | 2132 | S: Orphan |
2127 | F: Documentation/serial/digiepca.txt | 2133 | F: Documentation/serial/digiepca.txt |
2128 | F: drivers/char/epca* | 2134 | F: drivers/staging/tty/epca* |
2129 | F: drivers/char/digi* | 2135 | F: drivers/staging/tty/digi* |
2130 | 2136 | ||
2131 | DIOLAN U2C-12 I2C DRIVER | 2137 | DIOLAN U2C-12 I2C DRIVER |
2132 | M: Guenter Roeck <guenter.roeck@ericsson.com> | 2138 | M: Guenter Roeck <guenter.roeck@ericsson.com> |
@@ -2803,7 +2809,7 @@ GPIO SUBSYSTEM | |||
2803 | M: Grant Likely <grant.likely@secretlab.ca> | 2809 | M: Grant Likely <grant.likely@secretlab.ca> |
2804 | S: Maintained | 2810 | S: Maintained |
2805 | T: git git://git.secretlab.ca/git/linux-2.6.git | 2811 | T: git git://git.secretlab.ca/git/linux-2.6.git |
2806 | F: Documentation/gpio/gpio.txt | 2812 | F: Documentation/gpio.txt |
2807 | F: drivers/gpio/ | 2813 | F: drivers/gpio/ |
2808 | F: include/linux/gpio* | 2814 | F: include/linux/gpio* |
2809 | 2815 | ||
@@ -4078,7 +4084,7 @@ F: drivers/video/matrox/matroxfb_* | |||
4078 | F: include/linux/matroxfb.h | 4084 | F: include/linux/matroxfb.h |
4079 | 4085 | ||
4080 | MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER | 4086 | MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER |
4081 | M: "Hans J. Koch" <hjk@linutronix.de> | 4087 | M: "Hans J. Koch" <hjk@hansjkoch.de> |
4082 | L: lm-sensors@lm-sensors.org | 4088 | L: lm-sensors@lm-sensors.org |
4083 | S: Maintained | 4089 | S: Maintained |
4084 | F: Documentation/hwmon/max6650 | 4090 | F: Documentation/hwmon/max6650 |
@@ -4193,7 +4199,7 @@ MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD | |||
4193 | M: Jiri Slaby <jirislaby@gmail.com> | 4199 | M: Jiri Slaby <jirislaby@gmail.com> |
4194 | S: Maintained | 4200 | S: Maintained |
4195 | F: Documentation/serial/moxa-smartio | 4201 | F: Documentation/serial/moxa-smartio |
4196 | F: drivers/char/mxser.* | 4202 | F: drivers/tty/mxser.* |
4197 | 4203 | ||
4198 | MSI LAPTOP SUPPORT | 4204 | MSI LAPTOP SUPPORT |
4199 | M: "Lee, Chun-Yi" <jlee@novell.com> | 4205 | M: "Lee, Chun-Yi" <jlee@novell.com> |
@@ -4235,7 +4241,7 @@ F: sound/oss/msnd* | |||
4235 | 4241 | ||
4236 | MULTITECH MULTIPORT CARD (ISICOM) | 4242 | MULTITECH MULTIPORT CARD (ISICOM) |
4237 | S: Orphan | 4243 | S: Orphan |
4238 | F: drivers/char/isicom.c | 4244 | F: drivers/tty/isicom.c |
4239 | F: include/linux/isicom.h | 4245 | F: include/linux/isicom.h |
4240 | 4246 | ||
4241 | MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER | 4247 | MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER |
@@ -5274,14 +5280,14 @@ F: drivers/memstick/host/r592.* | |||
5274 | RISCOM8 DRIVER | 5280 | RISCOM8 DRIVER |
5275 | S: Orphan | 5281 | S: Orphan |
5276 | F: Documentation/serial/riscom8.txt | 5282 | F: Documentation/serial/riscom8.txt |
5277 | F: drivers/char/riscom8* | 5283 | F: drivers/staging/tty/riscom8* |
5278 | 5284 | ||
5279 | ROCKETPORT DRIVER | 5285 | ROCKETPORT DRIVER |
5280 | P: Comtrol Corp. | 5286 | P: Comtrol Corp. |
5281 | W: http://www.comtrol.com | 5287 | W: http://www.comtrol.com |
5282 | S: Maintained | 5288 | S: Maintained |
5283 | F: Documentation/serial/rocket.txt | 5289 | F: Documentation/serial/rocket.txt |
5284 | F: drivers/char/rocket* | 5290 | F: drivers/tty/rocket* |
5285 | 5291 | ||
5286 | ROSE NETWORK LAYER | 5292 | ROSE NETWORK LAYER |
5287 | M: Ralf Baechle <ralf@linux-mips.org> | 5293 | M: Ralf Baechle <ralf@linux-mips.org> |
@@ -5391,7 +5397,7 @@ F: drivers/media/video/*7146* | |||
5391 | F: include/media/*7146* | 5397 | F: include/media/*7146* |
5392 | 5398 | ||
5393 | SAMSUNG AUDIO (ASoC) DRIVERS | 5399 | SAMSUNG AUDIO (ASoC) DRIVERS |
5394 | M: Jassi Brar <jassi.brar@samsung.com> | 5400 | M: Jassi Brar <jassisinghbrar@gmail.com> |
5395 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 5401 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
5396 | S: Supported | 5402 | S: Supported |
5397 | F: sound/soc/samsung | 5403 | F: sound/soc/samsung |
@@ -5917,10 +5923,9 @@ F: arch/arm/mach-spear6xx/spear600.c | |||
5917 | F: arch/arm/mach-spear6xx/spear600_evb.c | 5923 | F: arch/arm/mach-spear6xx/spear600_evb.c |
5918 | 5924 | ||
5919 | SPECIALIX IO8+ MULTIPORT SERIAL CARD DRIVER | 5925 | SPECIALIX IO8+ MULTIPORT SERIAL CARD DRIVER |
5920 | M: Roger Wolff <R.E.Wolff@BitWizard.nl> | 5926 | S: Orphan |
5921 | S: Supported | ||
5922 | F: Documentation/serial/specialix.txt | 5927 | F: Documentation/serial/specialix.txt |
5923 | F: drivers/char/specialix* | 5928 | F: drivers/staging/tty/specialix* |
5924 | 5929 | ||
5925 | SPI SUBSYSTEM | 5930 | SPI SUBSYSTEM |
5926 | M: David Brownell <dbrownell@users.sourceforge.net> | 5931 | M: David Brownell <dbrownell@users.sourceforge.net> |
@@ -5965,7 +5970,6 @@ F: arch/alpha/kernel/srm_env.c | |||
5965 | 5970 | ||
5966 | STABLE BRANCH | 5971 | STABLE BRANCH |
5967 | M: Greg Kroah-Hartman <greg@kroah.com> | 5972 | M: Greg Kroah-Hartman <greg@kroah.com> |
5968 | M: Chris Wright <chrisw@sous-sol.org> | ||
5969 | L: stable@kernel.org | 5973 | L: stable@kernel.org |
5970 | S: Maintained | 5974 | S: Maintained |
5971 | 5975 | ||
@@ -6249,7 +6253,8 @@ M: Greg Ungerer <gerg@uclinux.org> | |||
6249 | W: http://www.uclinux.org/ | 6253 | W: http://www.uclinux.org/ |
6250 | L: uclinux-dev@uclinux.org (subscribers-only) | 6254 | L: uclinux-dev@uclinux.org (subscribers-only) |
6251 | S: Maintained | 6255 | S: Maintained |
6252 | F: arch/m68knommu/ | 6256 | F: arch/m68k/*/*_no.* |
6257 | F: arch/m68k/include/asm/*_no.* | ||
6253 | 6258 | ||
6254 | UCLINUX FOR RENESAS H8/300 (H8300) | 6259 | UCLINUX FOR RENESAS H8/300 (H8300) |
6255 | M: Yoshinori Sato <ysato@users.sourceforge.jp> | 6260 | M: Yoshinori Sato <ysato@users.sourceforge.jp> |
@@ -6619,7 +6624,7 @@ F: fs/hostfs/ | |||
6619 | F: fs/hppfs/ | 6624 | F: fs/hppfs/ |
6620 | 6625 | ||
6621 | USERSPACE I/O (UIO) | 6626 | USERSPACE I/O (UIO) |
6622 | M: "Hans J. Koch" <hjk@linutronix.de> | 6627 | M: "Hans J. Koch" <hjk@hansjkoch.de> |
6623 | M: Greg Kroah-Hartman <gregkh@suse.de> | 6628 | M: Greg Kroah-Hartman <gregkh@suse.de> |
6624 | S: Maintained | 6629 | S: Maintained |
6625 | F: Documentation/DocBook/uio-howto.tmpl | 6630 | F: Documentation/DocBook/uio-howto.tmpl |
@@ -6917,6 +6922,18 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86. | |||
6917 | S: Maintained | 6922 | S: Maintained |
6918 | F: drivers/platform/x86 | 6923 | F: drivers/platform/x86 |
6919 | 6924 | ||
6925 | XEN HYPERVISOR INTERFACE | ||
6926 | M: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | ||
6927 | M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | ||
6928 | L: xen-devel@lists.xensource.com (moderated for non-subscribers) | ||
6929 | L: virtualization@lists.linux-foundation.org | ||
6930 | S: Supported | ||
6931 | F: arch/x86/xen/ | ||
6932 | F: drivers/*/xen-*front.c | ||
6933 | F: drivers/xen/ | ||
6934 | F: arch/x86/include/asm/xen/ | ||
6935 | F: include/xen/ | ||
6936 | |||
6920 | XEN NETWORK BACKEND DRIVER | 6937 | XEN NETWORK BACKEND DRIVER |
6921 | M: Ian Campbell <ian.campbell@citrix.com> | 6938 | M: Ian Campbell <ian.campbell@citrix.com> |
6922 | L: xen-devel@lists.xensource.com (moderated for non-subscribers) | 6939 | L: xen-devel@lists.xensource.com (moderated for non-subscribers) |
@@ -6938,18 +6955,6 @@ S: Supported | |||
6938 | F: arch/x86/xen/*swiotlb* | 6955 | F: arch/x86/xen/*swiotlb* |
6939 | F: drivers/xen/*swiotlb* | 6956 | F: drivers/xen/*swiotlb* |
6940 | 6957 | ||
6941 | XEN HYPERVISOR INTERFACE | ||
6942 | M: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | ||
6943 | M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | ||
6944 | L: xen-devel@lists.xensource.com (moderated for non-subscribers) | ||
6945 | L: virtualization@lists.linux-foundation.org | ||
6946 | S: Supported | ||
6947 | F: arch/x86/xen/ | ||
6948 | F: drivers/*/xen-*front.c | ||
6949 | F: drivers/xen/ | ||
6950 | F: arch/x86/include/asm/xen/ | ||
6951 | F: include/xen/ | ||
6952 | |||
6953 | XFS FILESYSTEM | 6958 | XFS FILESYSTEM |
6954 | P: Silicon Graphics Inc | 6959 | P: Silicon Graphics Inc |
6955 | M: Alex Elder <aelder@sgi.com> | 6960 | M: Alex Elder <aelder@sgi.com> |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 39 | 3 | SUBLEVEL = 39 |
4 | EXTRAVERSION = -rc2 | 4 | EXTRAVERSION = -rc5 |
5 | NAME = Flesh-Eating Bats with Fangs | 5 | NAME = Flesh-Eating Bats with Fangs |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile index 9bb7b858ed23..7a6d908bb865 100644 --- a/arch/alpha/kernel/Makefile +++ b/arch/alpha/kernel/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | extra-y := head.o vmlinux.lds | 5 | extra-y := head.o vmlinux.lds |
6 | asflags-y := $(KBUILD_CFLAGS) | 6 | asflags-y := $(KBUILD_CFLAGS) |
7 | ccflags-y := -Werror -Wno-sign-compare | 7 | ccflags-y := -Wno-sign-compare |
8 | 8 | ||
9 | obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \ | 9 | obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \ |
10 | irq_alpha.o signal.o setup.o ptrace.o time.o \ | 10 | irq_alpha.o signal.o setup.o ptrace.o time.o \ |
diff --git a/arch/alpha/kernel/core_mcpcia.c b/arch/alpha/kernel/core_mcpcia.c index 381fec0af52e..da7bcc372f16 100644 --- a/arch/alpha/kernel/core_mcpcia.c +++ b/arch/alpha/kernel/core_mcpcia.c | |||
@@ -88,7 +88,7 @@ conf_read(unsigned long addr, unsigned char type1, | |||
88 | { | 88 | { |
89 | unsigned long flags; | 89 | unsigned long flags; |
90 | unsigned long mid = MCPCIA_HOSE2MID(hose->index); | 90 | unsigned long mid = MCPCIA_HOSE2MID(hose->index); |
91 | unsigned int stat0, value, temp, cpu; | 91 | unsigned int stat0, value, cpu; |
92 | 92 | ||
93 | cpu = smp_processor_id(); | 93 | cpu = smp_processor_id(); |
94 | 94 | ||
@@ -101,7 +101,7 @@ conf_read(unsigned long addr, unsigned char type1, | |||
101 | stat0 = *(vuip)MCPCIA_CAP_ERR(mid); | 101 | stat0 = *(vuip)MCPCIA_CAP_ERR(mid); |
102 | *(vuip)MCPCIA_CAP_ERR(mid) = stat0; | 102 | *(vuip)MCPCIA_CAP_ERR(mid) = stat0; |
103 | mb(); | 103 | mb(); |
104 | temp = *(vuip)MCPCIA_CAP_ERR(mid); | 104 | *(vuip)MCPCIA_CAP_ERR(mid); |
105 | DBG_CFG(("conf_read: MCPCIA_CAP_ERR(%d) was 0x%x\n", mid, stat0)); | 105 | DBG_CFG(("conf_read: MCPCIA_CAP_ERR(%d) was 0x%x\n", mid, stat0)); |
106 | 106 | ||
107 | mb(); | 107 | mb(); |
@@ -136,7 +136,7 @@ conf_write(unsigned long addr, unsigned int value, unsigned char type1, | |||
136 | { | 136 | { |
137 | unsigned long flags; | 137 | unsigned long flags; |
138 | unsigned long mid = MCPCIA_HOSE2MID(hose->index); | 138 | unsigned long mid = MCPCIA_HOSE2MID(hose->index); |
139 | unsigned int stat0, temp, cpu; | 139 | unsigned int stat0, cpu; |
140 | 140 | ||
141 | cpu = smp_processor_id(); | 141 | cpu = smp_processor_id(); |
142 | 142 | ||
@@ -145,7 +145,7 @@ conf_write(unsigned long addr, unsigned int value, unsigned char type1, | |||
145 | /* Reset status register to avoid losing errors. */ | 145 | /* Reset status register to avoid losing errors. */ |
146 | stat0 = *(vuip)MCPCIA_CAP_ERR(mid); | 146 | stat0 = *(vuip)MCPCIA_CAP_ERR(mid); |
147 | *(vuip)MCPCIA_CAP_ERR(mid) = stat0; mb(); | 147 | *(vuip)MCPCIA_CAP_ERR(mid) = stat0; mb(); |
148 | temp = *(vuip)MCPCIA_CAP_ERR(mid); | 148 | *(vuip)MCPCIA_CAP_ERR(mid); |
149 | DBG_CFG(("conf_write: MCPCIA CAP_ERR(%d) was 0x%x\n", mid, stat0)); | 149 | DBG_CFG(("conf_write: MCPCIA CAP_ERR(%d) was 0x%x\n", mid, stat0)); |
150 | 150 | ||
151 | draina(); | 151 | draina(); |
@@ -157,7 +157,7 @@ conf_write(unsigned long addr, unsigned int value, unsigned char type1, | |||
157 | *((vuip)addr) = value; | 157 | *((vuip)addr) = value; |
158 | mb(); | 158 | mb(); |
159 | mb(); /* magic */ | 159 | mb(); /* magic */ |
160 | temp = *(vuip)MCPCIA_CAP_ERR(mid); /* read to force the write */ | 160 | *(vuip)MCPCIA_CAP_ERR(mid); /* read to force the write */ |
161 | mcheck_expected(cpu) = 0; | 161 | mcheck_expected(cpu) = 0; |
162 | mb(); | 162 | mb(); |
163 | 163 | ||
@@ -572,12 +572,10 @@ mcpcia_print_system_area(unsigned long la_ptr) | |||
572 | void | 572 | void |
573 | mcpcia_machine_check(unsigned long vector, unsigned long la_ptr) | 573 | mcpcia_machine_check(unsigned long vector, unsigned long la_ptr) |
574 | { | 574 | { |
575 | struct el_common *mchk_header; | ||
576 | struct el_MCPCIA_uncorrected_frame_mcheck *mchk_logout; | 575 | struct el_MCPCIA_uncorrected_frame_mcheck *mchk_logout; |
577 | unsigned int cpu = smp_processor_id(); | 576 | unsigned int cpu = smp_processor_id(); |
578 | int expected; | 577 | int expected; |
579 | 578 | ||
580 | mchk_header = (struct el_common *)la_ptr; | ||
581 | mchk_logout = (struct el_MCPCIA_uncorrected_frame_mcheck *)la_ptr; | 579 | mchk_logout = (struct el_MCPCIA_uncorrected_frame_mcheck *)la_ptr; |
582 | expected = mcheck_expected(cpu); | 580 | expected = mcheck_expected(cpu); |
583 | 581 | ||
diff --git a/arch/alpha/kernel/err_titan.c b/arch/alpha/kernel/err_titan.c index c3b3781a03de..14b26c466c89 100644 --- a/arch/alpha/kernel/err_titan.c +++ b/arch/alpha/kernel/err_titan.c | |||
@@ -533,8 +533,6 @@ static struct el_subpacket_annotation el_titan_annotations[] = { | |||
533 | static struct el_subpacket * | 533 | static struct el_subpacket * |
534 | el_process_regatta_subpacket(struct el_subpacket *header) | 534 | el_process_regatta_subpacket(struct el_subpacket *header) |
535 | { | 535 | { |
536 | int status; | ||
537 | |||
538 | if (header->class != EL_CLASS__REGATTA_FAMILY) { | 536 | if (header->class != EL_CLASS__REGATTA_FAMILY) { |
539 | printk("%s ** Unexpected header CLASS %d TYPE %d, aborting\n", | 537 | printk("%s ** Unexpected header CLASS %d TYPE %d, aborting\n", |
540 | err_print_prefix, | 538 | err_print_prefix, |
@@ -551,7 +549,7 @@ el_process_regatta_subpacket(struct el_subpacket *header) | |||
551 | printk("%s ** Occurred on CPU %d:\n", | 549 | printk("%s ** Occurred on CPU %d:\n", |
552 | err_print_prefix, | 550 | err_print_prefix, |
553 | (int)header->by_type.regatta_frame.cpuid); | 551 | (int)header->by_type.regatta_frame.cpuid); |
554 | status = privateer_process_logout_frame((struct el_common *) | 552 | privateer_process_logout_frame((struct el_common *) |
555 | header->by_type.regatta_frame.data_start, 1); | 553 | header->by_type.regatta_frame.data_start, 1); |
556 | break; | 554 | break; |
557 | default: | 555 | default: |
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c index 1479dc6ebd97..51b7fbd9e4c1 100644 --- a/arch/alpha/kernel/irq_alpha.c +++ b/arch/alpha/kernel/irq_alpha.c | |||
@@ -228,7 +228,7 @@ struct irqaction timer_irqaction = { | |||
228 | void __init | 228 | void __init |
229 | init_rtc_irq(void) | 229 | init_rtc_irq(void) |
230 | { | 230 | { |
231 | irq_set_chip_and_handler_name(RTC_IRQ, &no_irq_chip, | 231 | irq_set_chip_and_handler_name(RTC_IRQ, &dummy_irq_chip, |
232 | handle_simple_irq, "RTC"); | 232 | handle_simple_irq, "RTC"); |
233 | setup_irq(RTC_IRQ, &timer_irqaction); | 233 | setup_irq(RTC_IRQ, &timer_irqaction); |
234 | } | 234 | } |
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index d2634e4476b4..edbddcbd5bc6 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c | |||
@@ -1404,8 +1404,6 @@ determine_cpu_caches (unsigned int cpu_type) | |||
1404 | case PCA56_CPU: | 1404 | case PCA56_CPU: |
1405 | case PCA57_CPU: | 1405 | case PCA57_CPU: |
1406 | { | 1406 | { |
1407 | unsigned long cbox_config, size; | ||
1408 | |||
1409 | if (cpu_type == PCA56_CPU) { | 1407 | if (cpu_type == PCA56_CPU) { |
1410 | L1I = CSHAPE(16*1024, 6, 1); | 1408 | L1I = CSHAPE(16*1024, 6, 1); |
1411 | L1D = CSHAPE(8*1024, 5, 1); | 1409 | L1D = CSHAPE(8*1024, 5, 1); |
@@ -1415,10 +1413,12 @@ determine_cpu_caches (unsigned int cpu_type) | |||
1415 | } | 1413 | } |
1416 | L3 = -1; | 1414 | L3 = -1; |
1417 | 1415 | ||
1416 | #if 0 | ||
1417 | unsigned long cbox_config, size; | ||
1418 | |||
1418 | cbox_config = *(vulp) phys_to_virt (0xfffff00008UL); | 1419 | cbox_config = *(vulp) phys_to_virt (0xfffff00008UL); |
1419 | size = 512*1024 * (1 << ((cbox_config >> 12) & 3)); | 1420 | size = 512*1024 * (1 << ((cbox_config >> 12) & 3)); |
1420 | 1421 | ||
1421 | #if 0 | ||
1422 | L2 = ((cbox_config >> 31) & 1 ? CSHAPE (size, 6, 1) : -1); | 1422 | L2 = ((cbox_config >> 31) & 1 ? CSHAPE (size, 6, 1) : -1); |
1423 | #else | 1423 | #else |
1424 | L2 = external_cache_probe(512*1024, 6); | 1424 | L2 = external_cache_probe(512*1024, 6); |
diff --git a/arch/alpha/kernel/smc37c93x.c b/arch/alpha/kernel/smc37c93x.c index 3e6a2893af9f..6886b834f487 100644 --- a/arch/alpha/kernel/smc37c93x.c +++ b/arch/alpha/kernel/smc37c93x.c | |||
@@ -79,7 +79,6 @@ | |||
79 | static unsigned long __init SMCConfigState(unsigned long baseAddr) | 79 | static unsigned long __init SMCConfigState(unsigned long baseAddr) |
80 | { | 80 | { |
81 | unsigned char devId; | 81 | unsigned char devId; |
82 | unsigned char devRev; | ||
83 | 82 | ||
84 | unsigned long configPort; | 83 | unsigned long configPort; |
85 | unsigned long indexPort; | 84 | unsigned long indexPort; |
@@ -100,7 +99,7 @@ static unsigned long __init SMCConfigState(unsigned long baseAddr) | |||
100 | devId = inb(dataPort); | 99 | devId = inb(dataPort); |
101 | if (devId == VALID_DEVICE_ID) { | 100 | if (devId == VALID_DEVICE_ID) { |
102 | outb(DEVICE_REV, indexPort); | 101 | outb(DEVICE_REV, indexPort); |
103 | devRev = inb(dataPort); | 102 | /* unsigned char devRev = */ inb(dataPort); |
104 | break; | 103 | break; |
105 | } | 104 | } |
106 | else | 105 | else |
diff --git a/arch/alpha/kernel/sys_wildfire.c b/arch/alpha/kernel/sys_wildfire.c index d3cb28bb8eb0..d92cdc715c65 100644 --- a/arch/alpha/kernel/sys_wildfire.c +++ b/arch/alpha/kernel/sys_wildfire.c | |||
@@ -156,7 +156,6 @@ static void __init | |||
156 | wildfire_init_irq_per_pca(int qbbno, int pcano) | 156 | wildfire_init_irq_per_pca(int qbbno, int pcano) |
157 | { | 157 | { |
158 | int i, irq_bias; | 158 | int i, irq_bias; |
159 | unsigned long io_bias; | ||
160 | static struct irqaction isa_enable = { | 159 | static struct irqaction isa_enable = { |
161 | .handler = no_action, | 160 | .handler = no_action, |
162 | .name = "isa_enable", | 161 | .name = "isa_enable", |
@@ -165,10 +164,12 @@ wildfire_init_irq_per_pca(int qbbno, int pcano) | |||
165 | irq_bias = qbbno * (WILDFIRE_PCA_PER_QBB * WILDFIRE_IRQ_PER_PCA) | 164 | irq_bias = qbbno * (WILDFIRE_PCA_PER_QBB * WILDFIRE_IRQ_PER_PCA) |
166 | + pcano * WILDFIRE_IRQ_PER_PCA; | 165 | + pcano * WILDFIRE_IRQ_PER_PCA; |
167 | 166 | ||
167 | #if 0 | ||
168 | unsigned long io_bias; | ||
169 | |||
168 | /* Only need the following for first PCI bus per PCA. */ | 170 | /* Only need the following for first PCI bus per PCA. */ |
169 | io_bias = WILDFIRE_IO(qbbno, pcano<<1) - WILDFIRE_IO_BIAS; | 171 | io_bias = WILDFIRE_IO(qbbno, pcano<<1) - WILDFIRE_IO_BIAS; |
170 | 172 | ||
171 | #if 0 | ||
172 | outb(0, DMA1_RESET_REG + io_bias); | 173 | outb(0, DMA1_RESET_REG + io_bias); |
173 | outb(0, DMA2_RESET_REG + io_bias); | 174 | outb(0, DMA2_RESET_REG + io_bias); |
174 | outb(DMA_MODE_CASCADE, DMA2_MODE_REG + io_bias); | 175 | outb(DMA_MODE_CASCADE, DMA2_MODE_REG + io_bias); |
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c index a58e84f1a63b..918e8e0b72ff 100644 --- a/arch/alpha/kernel/time.c +++ b/arch/alpha/kernel/time.c | |||
@@ -153,6 +153,7 @@ void read_persistent_clock(struct timespec *ts) | |||
153 | year += 100; | 153 | year += 100; |
154 | 154 | ||
155 | ts->tv_sec = mktime(year, mon, day, hour, min, sec); | 155 | ts->tv_sec = mktime(year, mon, day, hour, min, sec); |
156 | ts->tv_nsec = 0; | ||
156 | } | 157 | } |
157 | 158 | ||
158 | 159 | ||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index fdc9d4dbf85b..377a7a595b08 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1540,7 +1540,6 @@ config HIGHMEM | |||
1540 | config HIGHPTE | 1540 | config HIGHPTE |
1541 | bool "Allocate 2nd-level pagetables from highmem" | 1541 | bool "Allocate 2nd-level pagetables from highmem" |
1542 | depends on HIGHMEM | 1542 | depends on HIGHMEM |
1543 | depends on !OUTER_CACHE | ||
1544 | 1543 | ||
1545 | config HW_PERF_EVENTS | 1544 | config HW_PERF_EVENTS |
1546 | bool "Enable hardware performance counter support for perf events" | 1545 | bool "Enable hardware performance counter support for perf events" |
@@ -2012,6 +2011,8 @@ source "kernel/power/Kconfig" | |||
2012 | 2011 | ||
2013 | config ARCH_SUSPEND_POSSIBLE | 2012 | config ARCH_SUSPEND_POSSIBLE |
2014 | depends on !ARCH_S5P64X0 && !ARCH_S5P6442 | 2013 | depends on !ARCH_S5P64X0 && !ARCH_S5P6442 |
2014 | depends on CPU_ARM920T || CPU_ARM926T || CPU_SA1100 || \ | ||
2015 | CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE | ||
2015 | def_bool y | 2016 | def_bool y |
2016 | 2017 | ||
2017 | endmenu | 2018 | endmenu |
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 494224a9b459..03d01d783e3b 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -63,17 +63,6 @@ config DEBUG_USER | |||
63 | 8 - SIGSEGV faults | 63 | 8 - SIGSEGV faults |
64 | 16 - SIGBUS faults | 64 | 16 - SIGBUS faults |
65 | 65 | ||
66 | config DEBUG_ERRORS | ||
67 | bool "Verbose kernel error messages" | ||
68 | depends on DEBUG_KERNEL | ||
69 | help | ||
70 | This option controls verbose debugging information which can be | ||
71 | printed when the kernel detects an internal error. This debugging | ||
72 | information is useful to kernel hackers when tracking down problems, | ||
73 | but mostly meaningless to other people. It's safe to say Y unless | ||
74 | you are concerned with the code size or don't want to see these | ||
75 | messages. | ||
76 | |||
77 | config DEBUG_STACK_USAGE | 66 | config DEBUG_STACK_USAGE |
78 | bool "Enable stack utilization instrumentation" | 67 | bool "Enable stack utilization instrumentation" |
79 | depends on DEBUG_KERNEL | 68 | depends on DEBUG_KERNEL |
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile index e7521bca2c35..6ea9b6f3607a 100644 --- a/arch/arm/common/Makefile +++ b/arch/arm/common/Makefile | |||
@@ -16,5 +16,4 @@ obj-$(CONFIG_SHARP_SCOOP) += scoop.o | |||
16 | obj-$(CONFIG_ARCH_IXP2000) += uengine.o | 16 | obj-$(CONFIG_ARCH_IXP2000) += uengine.o |
17 | obj-$(CONFIG_ARCH_IXP23XX) += uengine.o | 17 | obj-$(CONFIG_ARCH_IXP23XX) += uengine.o |
18 | obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o | 18 | obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o |
19 | obj-$(CONFIG_COMMON_CLKDEV) += clkdev.o | ||
20 | obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o | 19 | obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o |
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h index ed5bc9e05a4e..cd4458f64171 100644 --- a/arch/arm/include/asm/cputype.h +++ b/arch/arm/include/asm/cputype.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __ASM_ARM_CPUTYPE_H | 2 | #define __ASM_ARM_CPUTYPE_H |
3 | 3 | ||
4 | #include <linux/stringify.h> | 4 | #include <linux/stringify.h> |
5 | #include <linux/kernel.h> | ||
5 | 6 | ||
6 | #define CPUID_ID 0 | 7 | #define CPUID_ID 0 |
7 | #define CPUID_CACHETYPE 1 | 8 | #define CPUID_CACHETYPE 1 |
diff --git a/arch/arm/include/asm/kprobes.h b/arch/arm/include/asm/kprobes.h index bb8a19bd5822..e46bdd0097eb 100644 --- a/arch/arm/include/asm/kprobes.h +++ b/arch/arm/include/asm/kprobes.h | |||
@@ -39,10 +39,13 @@ typedef u32 kprobe_opcode_t; | |||
39 | struct kprobe; | 39 | struct kprobe; |
40 | typedef void (kprobe_insn_handler_t)(struct kprobe *, struct pt_regs *); | 40 | typedef void (kprobe_insn_handler_t)(struct kprobe *, struct pt_regs *); |
41 | 41 | ||
42 | typedef unsigned long (kprobe_check_cc)(unsigned long); | ||
43 | |||
42 | /* Architecture specific copy of original instruction. */ | 44 | /* Architecture specific copy of original instruction. */ |
43 | struct arch_specific_insn { | 45 | struct arch_specific_insn { |
44 | kprobe_opcode_t *insn; | 46 | kprobe_opcode_t *insn; |
45 | kprobe_insn_handler_t *insn_handler; | 47 | kprobe_insn_handler_t *insn_handler; |
48 | kprobe_check_cc *insn_check_cc; | ||
46 | }; | 49 | }; |
47 | 50 | ||
48 | struct prev_kprobe { | 51 | struct prev_kprobe { |
diff --git a/arch/arm/include/asm/thread_notify.h b/arch/arm/include/asm/thread_notify.h index c4391ba20350..1dc980675894 100644 --- a/arch/arm/include/asm/thread_notify.h +++ b/arch/arm/include/asm/thread_notify.h | |||
@@ -43,6 +43,7 @@ static inline void thread_notify(unsigned long rc, struct thread_info *thread) | |||
43 | #define THREAD_NOTIFY_FLUSH 0 | 43 | #define THREAD_NOTIFY_FLUSH 0 |
44 | #define THREAD_NOTIFY_EXIT 1 | 44 | #define THREAD_NOTIFY_EXIT 1 |
45 | #define THREAD_NOTIFY_SWITCH 2 | 45 | #define THREAD_NOTIFY_SWITCH 2 |
46 | #define THREAD_NOTIFY_COPY 3 | ||
46 | 47 | ||
47 | #endif | 48 | #endif |
48 | #endif | 49 | #endif |
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index c891eb76c0e3..87dbe3e21970 100644 --- a/arch/arm/include/asm/unistd.h +++ b/arch/arm/include/asm/unistd.h | |||
@@ -396,6 +396,10 @@ | |||
396 | #define __NR_fanotify_init (__NR_SYSCALL_BASE+367) | 396 | #define __NR_fanotify_init (__NR_SYSCALL_BASE+367) |
397 | #define __NR_fanotify_mark (__NR_SYSCALL_BASE+368) | 397 | #define __NR_fanotify_mark (__NR_SYSCALL_BASE+368) |
398 | #define __NR_prlimit64 (__NR_SYSCALL_BASE+369) | 398 | #define __NR_prlimit64 (__NR_SYSCALL_BASE+369) |
399 | #define __NR_name_to_handle_at (__NR_SYSCALL_BASE+370) | ||
400 | #define __NR_open_by_handle_at (__NR_SYSCALL_BASE+371) | ||
401 | #define __NR_clock_adjtime (__NR_SYSCALL_BASE+372) | ||
402 | #define __NR_syncfs (__NR_SYSCALL_BASE+373) | ||
399 | 403 | ||
400 | /* | 404 | /* |
401 | * The following SWIs are ARM private. | 405 | * The following SWIs are ARM private. |
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 74554f1742d7..8d95446150a3 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
@@ -29,7 +29,7 @@ obj-$(CONFIG_MODULES) += armksyms.o module.o | |||
29 | obj-$(CONFIG_ARTHUR) += arthur.o | 29 | obj-$(CONFIG_ARTHUR) += arthur.o |
30 | obj-$(CONFIG_ISA_DMA) += dma-isa.o | 30 | obj-$(CONFIG_ISA_DMA) += dma-isa.o |
31 | obj-$(CONFIG_PCI) += bios32.o isa.o | 31 | obj-$(CONFIG_PCI) += bios32.o isa.o |
32 | obj-$(CONFIG_PM) += sleep.o | 32 | obj-$(CONFIG_PM_SLEEP) += sleep.o |
33 | obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o | 33 | obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o |
34 | obj-$(CONFIG_SMP) += smp.o smp_tlb.o | 34 | obj-$(CONFIG_SMP) += smp.o smp_tlb.o |
35 | obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o | 35 | obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o |
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 5c26eccef998..7fbf28c35bb2 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S | |||
@@ -379,6 +379,10 @@ | |||
379 | CALL(sys_fanotify_init) | 379 | CALL(sys_fanotify_init) |
380 | CALL(sys_fanotify_mark) | 380 | CALL(sys_fanotify_mark) |
381 | CALL(sys_prlimit64) | 381 | CALL(sys_prlimit64) |
382 | /* 370 */ CALL(sys_name_to_handle_at) | ||
383 | CALL(sys_open_by_handle_at) | ||
384 | CALL(sys_clock_adjtime) | ||
385 | CALL(sys_syncfs) | ||
382 | #ifndef syscalls_counted | 386 | #ifndef syscalls_counted |
383 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls | 387 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls |
384 | #define syscalls_counted | 388 | #define syscalls_counted |
diff --git a/arch/arm/kernel/elf.c b/arch/arm/kernel/elf.c index d4a0da1e48f4..9b05c6a0dcea 100644 --- a/arch/arm/kernel/elf.c +++ b/arch/arm/kernel/elf.c | |||
@@ -40,15 +40,22 @@ EXPORT_SYMBOL(elf_check_arch); | |||
40 | void elf_set_personality(const struct elf32_hdr *x) | 40 | void elf_set_personality(const struct elf32_hdr *x) |
41 | { | 41 | { |
42 | unsigned int eflags = x->e_flags; | 42 | unsigned int eflags = x->e_flags; |
43 | unsigned int personality = PER_LINUX_32BIT; | 43 | unsigned int personality = current->personality & ~PER_MASK; |
44 | |||
45 | /* | ||
46 | * We only support Linux ELF executables, so always set the | ||
47 | * personality to LINUX. | ||
48 | */ | ||
49 | personality |= PER_LINUX; | ||
44 | 50 | ||
45 | /* | 51 | /* |
46 | * APCS-26 is only valid for OABI executables | 52 | * APCS-26 is only valid for OABI executables |
47 | */ | 53 | */ |
48 | if ((eflags & EF_ARM_EABI_MASK) == EF_ARM_EABI_UNKNOWN) { | 54 | if ((eflags & EF_ARM_EABI_MASK) == EF_ARM_EABI_UNKNOWN && |
49 | if (eflags & EF_ARM_APCS_26) | 55 | (eflags & EF_ARM_APCS_26)) |
50 | personality = PER_LINUX; | 56 | personality &= ~ADDR_LIMIT_32BIT; |
51 | } | 57 | else |
58 | personality |= ADDR_LIMIT_32BIT; | ||
52 | 59 | ||
53 | set_personality(personality); | 60 | set_personality(personality); |
54 | 61 | ||
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c index 8dbc126f7152..87acc25d7a3e 100644 --- a/arch/arm/kernel/hw_breakpoint.c +++ b/arch/arm/kernel/hw_breakpoint.c | |||
@@ -868,6 +868,13 @@ static void reset_ctrl_regs(void *info) | |||
868 | */ | 868 | */ |
869 | asm volatile("mcr p14, 0, %0, c1, c0, 4" : : "r" (0)); | 869 | asm volatile("mcr p14, 0, %0, c1, c0, 4" : : "r" (0)); |
870 | isb(); | 870 | isb(); |
871 | |||
872 | /* | ||
873 | * Clear any configured vector-catch events before | ||
874 | * enabling monitor mode. | ||
875 | */ | ||
876 | asm volatile("mcr p14, 0, %0, c0, c7, 0" : : "r" (0)); | ||
877 | isb(); | ||
871 | } | 878 | } |
872 | 879 | ||
873 | if (enable_monitor_mode()) | 880 | if (enable_monitor_mode()) |
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c index 23891317dc4b..15eeff6aea0e 100644 --- a/arch/arm/kernel/kprobes-decode.c +++ b/arch/arm/kernel/kprobes-decode.c | |||
@@ -34,9 +34,6 @@ | |||
34 | * | 34 | * |
35 | * *) If the PC is written to by the instruction, the | 35 | * *) If the PC is written to by the instruction, the |
36 | * instruction must be fully simulated in software. | 36 | * instruction must be fully simulated in software. |
37 | * If it is a conditional instruction, the handler | ||
38 | * will use insn[0] to copy its condition code to | ||
39 | * set r0 to 1 and insn[1] to "mov pc, lr" to return. | ||
40 | * | 37 | * |
41 | * *) Otherwise, a modified form of the instruction is | 38 | * *) Otherwise, a modified form of the instruction is |
42 | * directly executed. Its handler calls the | 39 | * directly executed. Its handler calls the |
@@ -68,13 +65,17 @@ | |||
68 | 65 | ||
69 | #define branch_displacement(insn) sign_extend(((insn) & 0xffffff) << 2, 25) | 66 | #define branch_displacement(insn) sign_extend(((insn) & 0xffffff) << 2, 25) |
70 | 67 | ||
68 | #define is_r15(insn, bitpos) (((insn) & (0xf << bitpos)) == (0xf << bitpos)) | ||
69 | |||
70 | /* | ||
71 | * Test if load/store instructions writeback the address register. | ||
72 | * if P (bit 24) == 0 or W (bit 21) == 1 | ||
73 | */ | ||
74 | #define is_writeback(insn) ((insn ^ 0x01000000) & 0x01200000) | ||
75 | |||
71 | #define PSR_fs (PSR_f|PSR_s) | 76 | #define PSR_fs (PSR_f|PSR_s) |
72 | 77 | ||
73 | #define KPROBE_RETURN_INSTRUCTION 0xe1a0f00e /* mov pc, lr */ | 78 | #define KPROBE_RETURN_INSTRUCTION 0xe1a0f00e /* mov pc, lr */ |
74 | #define SET_R0_TRUE_INSTRUCTION 0xe3a00001 /* mov r0, #1 */ | ||
75 | |||
76 | #define truecc_insn(insn) (((insn) & 0xf0000000) | \ | ||
77 | (SET_R0_TRUE_INSTRUCTION & 0x0fffffff)) | ||
78 | 79 | ||
79 | typedef long (insn_0arg_fn_t)(void); | 80 | typedef long (insn_0arg_fn_t)(void); |
80 | typedef long (insn_1arg_fn_t)(long); | 81 | typedef long (insn_1arg_fn_t)(long); |
@@ -419,14 +420,10 @@ insnslot_llret_4arg_rwflags(long r0, long r1, long r2, long r3, long *cpsr, | |||
419 | 420 | ||
420 | static void __kprobes simulate_bbl(struct kprobe *p, struct pt_regs *regs) | 421 | static void __kprobes simulate_bbl(struct kprobe *p, struct pt_regs *regs) |
421 | { | 422 | { |
422 | insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; | ||
423 | kprobe_opcode_t insn = p->opcode; | 423 | kprobe_opcode_t insn = p->opcode; |
424 | long iaddr = (long)p->addr; | 424 | long iaddr = (long)p->addr; |
425 | int disp = branch_displacement(insn); | 425 | int disp = branch_displacement(insn); |
426 | 426 | ||
427 | if (!insnslot_1arg_rflags(0, regs->ARM_cpsr, i_fn)) | ||
428 | return; | ||
429 | |||
430 | if (insn & (1 << 24)) | 427 | if (insn & (1 << 24)) |
431 | regs->ARM_lr = iaddr + 4; | 428 | regs->ARM_lr = iaddr + 4; |
432 | 429 | ||
@@ -446,14 +443,10 @@ static void __kprobes simulate_blx1(struct kprobe *p, struct pt_regs *regs) | |||
446 | 443 | ||
447 | static void __kprobes simulate_blx2bx(struct kprobe *p, struct pt_regs *regs) | 444 | static void __kprobes simulate_blx2bx(struct kprobe *p, struct pt_regs *regs) |
448 | { | 445 | { |
449 | insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; | ||
450 | kprobe_opcode_t insn = p->opcode; | 446 | kprobe_opcode_t insn = p->opcode; |
451 | int rm = insn & 0xf; | 447 | int rm = insn & 0xf; |
452 | long rmv = regs->uregs[rm]; | 448 | long rmv = regs->uregs[rm]; |
453 | 449 | ||
454 | if (!insnslot_1arg_rflags(0, regs->ARM_cpsr, i_fn)) | ||
455 | return; | ||
456 | |||
457 | if (insn & (1 << 5)) | 450 | if (insn & (1 << 5)) |
458 | regs->ARM_lr = (long)p->addr + 4; | 451 | regs->ARM_lr = (long)p->addr + 4; |
459 | 452 | ||
@@ -463,9 +456,16 @@ static void __kprobes simulate_blx2bx(struct kprobe *p, struct pt_regs *regs) | |||
463 | regs->ARM_cpsr |= PSR_T_BIT; | 456 | regs->ARM_cpsr |= PSR_T_BIT; |
464 | } | 457 | } |
465 | 458 | ||
459 | static void __kprobes simulate_mrs(struct kprobe *p, struct pt_regs *regs) | ||
460 | { | ||
461 | kprobe_opcode_t insn = p->opcode; | ||
462 | int rd = (insn >> 12) & 0xf; | ||
463 | unsigned long mask = 0xf8ff03df; /* Mask out execution state */ | ||
464 | regs->uregs[rd] = regs->ARM_cpsr & mask; | ||
465 | } | ||
466 | |||
466 | static void __kprobes simulate_ldm1stm1(struct kprobe *p, struct pt_regs *regs) | 467 | static void __kprobes simulate_ldm1stm1(struct kprobe *p, struct pt_regs *regs) |
467 | { | 468 | { |
468 | insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; | ||
469 | kprobe_opcode_t insn = p->opcode; | 469 | kprobe_opcode_t insn = p->opcode; |
470 | int rn = (insn >> 16) & 0xf; | 470 | int rn = (insn >> 16) & 0xf; |
471 | int lbit = insn & (1 << 20); | 471 | int lbit = insn & (1 << 20); |
@@ -476,9 +476,6 @@ static void __kprobes simulate_ldm1stm1(struct kprobe *p, struct pt_regs *regs) | |||
476 | int reg_bit_vector; | 476 | int reg_bit_vector; |
477 | int reg_count; | 477 | int reg_count; |
478 | 478 | ||
479 | if (!insnslot_1arg_rflags(0, regs->ARM_cpsr, i_fn)) | ||
480 | return; | ||
481 | |||
482 | reg_count = 0; | 479 | reg_count = 0; |
483 | reg_bit_vector = insn & 0xffff; | 480 | reg_bit_vector = insn & 0xffff; |
484 | while (reg_bit_vector) { | 481 | while (reg_bit_vector) { |
@@ -510,11 +507,6 @@ static void __kprobes simulate_ldm1stm1(struct kprobe *p, struct pt_regs *regs) | |||
510 | 507 | ||
511 | static void __kprobes simulate_stm1_pc(struct kprobe *p, struct pt_regs *regs) | 508 | static void __kprobes simulate_stm1_pc(struct kprobe *p, struct pt_regs *regs) |
512 | { | 509 | { |
513 | insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; | ||
514 | |||
515 | if (!insnslot_1arg_rflags(0, regs->ARM_cpsr, i_fn)) | ||
516 | return; | ||
517 | |||
518 | regs->ARM_pc = (long)p->addr + str_pc_offset; | 510 | regs->ARM_pc = (long)p->addr + str_pc_offset; |
519 | simulate_ldm1stm1(p, regs); | 511 | simulate_ldm1stm1(p, regs); |
520 | regs->ARM_pc = (long)p->addr + 4; | 512 | regs->ARM_pc = (long)p->addr + 4; |
@@ -525,24 +517,16 @@ static void __kprobes simulate_mov_ipsp(struct kprobe *p, struct pt_regs *regs) | |||
525 | regs->uregs[12] = regs->uregs[13]; | 517 | regs->uregs[12] = regs->uregs[13]; |
526 | } | 518 | } |
527 | 519 | ||
528 | static void __kprobes emulate_ldcstc(struct kprobe *p, struct pt_regs *regs) | ||
529 | { | ||
530 | insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; | ||
531 | kprobe_opcode_t insn = p->opcode; | ||
532 | int rn = (insn >> 16) & 0xf; | ||
533 | long rnv = regs->uregs[rn]; | ||
534 | |||
535 | /* Save Rn in case of writeback. */ | ||
536 | regs->uregs[rn] = insnslot_1arg_rflags(rnv, regs->ARM_cpsr, i_fn); | ||
537 | } | ||
538 | |||
539 | static void __kprobes emulate_ldrd(struct kprobe *p, struct pt_regs *regs) | 520 | static void __kprobes emulate_ldrd(struct kprobe *p, struct pt_regs *regs) |
540 | { | 521 | { |
541 | insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0]; | 522 | insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0]; |
542 | kprobe_opcode_t insn = p->opcode; | 523 | kprobe_opcode_t insn = p->opcode; |
524 | long ppc = (long)p->addr + 8; | ||
543 | int rd = (insn >> 12) & 0xf; | 525 | int rd = (insn >> 12) & 0xf; |
544 | int rn = (insn >> 16) & 0xf; | 526 | int rn = (insn >> 16) & 0xf; |
545 | int rm = insn & 0xf; /* rm may be invalid, don't care. */ | 527 | int rm = insn & 0xf; /* rm may be invalid, don't care. */ |
528 | long rmv = (rm == 15) ? ppc : regs->uregs[rm]; | ||
529 | long rnv = (rn == 15) ? ppc : regs->uregs[rn]; | ||
546 | 530 | ||
547 | /* Not following the C calling convention here, so need asm(). */ | 531 | /* Not following the C calling convention here, so need asm(). */ |
548 | __asm__ __volatile__ ( | 532 | __asm__ __volatile__ ( |
@@ -554,29 +538,36 @@ static void __kprobes emulate_ldrd(struct kprobe *p, struct pt_regs *regs) | |||
554 | "str r0, %[rn] \n\t" /* in case of writeback */ | 538 | "str r0, %[rn] \n\t" /* in case of writeback */ |
555 | "str r2, %[rd0] \n\t" | 539 | "str r2, %[rd0] \n\t" |
556 | "str r3, %[rd1] \n\t" | 540 | "str r3, %[rd1] \n\t" |
557 | : [rn] "+m" (regs->uregs[rn]), | 541 | : [rn] "+m" (rnv), |
558 | [rd0] "=m" (regs->uregs[rd]), | 542 | [rd0] "=m" (regs->uregs[rd]), |
559 | [rd1] "=m" (regs->uregs[rd+1]) | 543 | [rd1] "=m" (regs->uregs[rd+1]) |
560 | : [rm] "m" (regs->uregs[rm]), | 544 | : [rm] "m" (rmv), |
561 | [cpsr] "r" (regs->ARM_cpsr), | 545 | [cpsr] "r" (regs->ARM_cpsr), |
562 | [i_fn] "r" (i_fn) | 546 | [i_fn] "r" (i_fn) |
563 | : "r0", "r1", "r2", "r3", "lr", "cc" | 547 | : "r0", "r1", "r2", "r3", "lr", "cc" |
564 | ); | 548 | ); |
549 | if (is_writeback(insn)) | ||
550 | regs->uregs[rn] = rnv; | ||
565 | } | 551 | } |
566 | 552 | ||
567 | static void __kprobes emulate_strd(struct kprobe *p, struct pt_regs *regs) | 553 | static void __kprobes emulate_strd(struct kprobe *p, struct pt_regs *regs) |
568 | { | 554 | { |
569 | insn_4arg_fn_t *i_fn = (insn_4arg_fn_t *)&p->ainsn.insn[0]; | 555 | insn_4arg_fn_t *i_fn = (insn_4arg_fn_t *)&p->ainsn.insn[0]; |
570 | kprobe_opcode_t insn = p->opcode; | 556 | kprobe_opcode_t insn = p->opcode; |
557 | long ppc = (long)p->addr + 8; | ||
571 | int rd = (insn >> 12) & 0xf; | 558 | int rd = (insn >> 12) & 0xf; |
572 | int rn = (insn >> 16) & 0xf; | 559 | int rn = (insn >> 16) & 0xf; |
573 | int rm = insn & 0xf; | 560 | int rm = insn & 0xf; |
574 | long rnv = regs->uregs[rn]; | 561 | long rnv = (rn == 15) ? ppc : regs->uregs[rn]; |
575 | long rmv = regs->uregs[rm]; /* rm/rmv may be invalid, don't care. */ | 562 | /* rm/rmv may be invalid, don't care. */ |
563 | long rmv = (rm == 15) ? ppc : regs->uregs[rm]; | ||
564 | long rnv_wb; | ||
576 | 565 | ||
577 | regs->uregs[rn] = insnslot_4arg_rflags(rnv, rmv, regs->uregs[rd], | 566 | rnv_wb = insnslot_4arg_rflags(rnv, rmv, regs->uregs[rd], |
578 | regs->uregs[rd+1], | 567 | regs->uregs[rd+1], |
579 | regs->ARM_cpsr, i_fn); | 568 | regs->ARM_cpsr, i_fn); |
569 | if (is_writeback(insn)) | ||
570 | regs->uregs[rn] = rnv_wb; | ||
580 | } | 571 | } |
581 | 572 | ||
582 | static void __kprobes emulate_ldr(struct kprobe *p, struct pt_regs *regs) | 573 | static void __kprobes emulate_ldr(struct kprobe *p, struct pt_regs *regs) |
@@ -630,31 +621,6 @@ static void __kprobes emulate_str(struct kprobe *p, struct pt_regs *regs) | |||
630 | regs->uregs[rn] = rnv_wb; /* Save Rn in case of writeback. */ | 621 | regs->uregs[rn] = rnv_wb; /* Save Rn in case of writeback. */ |
631 | } | 622 | } |
632 | 623 | ||
633 | static void __kprobes emulate_mrrc(struct kprobe *p, struct pt_regs *regs) | ||
634 | { | ||
635 | insn_llret_0arg_fn_t *i_fn = (insn_llret_0arg_fn_t *)&p->ainsn.insn[0]; | ||
636 | kprobe_opcode_t insn = p->opcode; | ||
637 | union reg_pair fnr; | ||
638 | int rd = (insn >> 12) & 0xf; | ||
639 | int rn = (insn >> 16) & 0xf; | ||
640 | |||
641 | fnr.dr = insnslot_llret_0arg_rflags(regs->ARM_cpsr, i_fn); | ||
642 | regs->uregs[rn] = fnr.r0; | ||
643 | regs->uregs[rd] = fnr.r1; | ||
644 | } | ||
645 | |||
646 | static void __kprobes emulate_mcrr(struct kprobe *p, struct pt_regs *regs) | ||
647 | { | ||
648 | insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0]; | ||
649 | kprobe_opcode_t insn = p->opcode; | ||
650 | int rd = (insn >> 12) & 0xf; | ||
651 | int rn = (insn >> 16) & 0xf; | ||
652 | long rnv = regs->uregs[rn]; | ||
653 | long rdv = regs->uregs[rd]; | ||
654 | |||
655 | insnslot_2arg_rflags(rnv, rdv, regs->ARM_cpsr, i_fn); | ||
656 | } | ||
657 | |||
658 | static void __kprobes emulate_sat(struct kprobe *p, struct pt_regs *regs) | 624 | static void __kprobes emulate_sat(struct kprobe *p, struct pt_regs *regs) |
659 | { | 625 | { |
660 | insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; | 626 | insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; |
@@ -688,32 +654,32 @@ static void __kprobes emulate_none(struct kprobe *p, struct pt_regs *regs) | |||
688 | insnslot_0arg_rflags(regs->ARM_cpsr, i_fn); | 654 | insnslot_0arg_rflags(regs->ARM_cpsr, i_fn); |
689 | } | 655 | } |
690 | 656 | ||
691 | static void __kprobes emulate_rd12(struct kprobe *p, struct pt_regs *regs) | 657 | static void __kprobes emulate_nop(struct kprobe *p, struct pt_regs *regs) |
692 | { | 658 | { |
693 | insn_0arg_fn_t *i_fn = (insn_0arg_fn_t *)&p->ainsn.insn[0]; | ||
694 | kprobe_opcode_t insn = p->opcode; | ||
695 | int rd = (insn >> 12) & 0xf; | ||
696 | |||
697 | regs->uregs[rd] = insnslot_0arg_rflags(regs->ARM_cpsr, i_fn); | ||
698 | } | 659 | } |
699 | 660 | ||
700 | static void __kprobes emulate_ird12(struct kprobe *p, struct pt_regs *regs) | 661 | static void __kprobes |
662 | emulate_rd12_modify(struct kprobe *p, struct pt_regs *regs) | ||
701 | { | 663 | { |
702 | insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; | 664 | insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; |
703 | kprobe_opcode_t insn = p->opcode; | 665 | kprobe_opcode_t insn = p->opcode; |
704 | int ird = (insn >> 12) & 0xf; | 666 | int rd = (insn >> 12) & 0xf; |
667 | long rdv = regs->uregs[rd]; | ||
705 | 668 | ||
706 | insnslot_1arg_rflags(regs->uregs[ird], regs->ARM_cpsr, i_fn); | 669 | regs->uregs[rd] = insnslot_1arg_rflags(rdv, regs->ARM_cpsr, i_fn); |
707 | } | 670 | } |
708 | 671 | ||
709 | static void __kprobes emulate_rn16(struct kprobe *p, struct pt_regs *regs) | 672 | static void __kprobes |
673 | emulate_rd12rn0_modify(struct kprobe *p, struct pt_regs *regs) | ||
710 | { | 674 | { |
711 | insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; | 675 | insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0]; |
712 | kprobe_opcode_t insn = p->opcode; | 676 | kprobe_opcode_t insn = p->opcode; |
713 | int rn = (insn >> 16) & 0xf; | 677 | int rd = (insn >> 12) & 0xf; |
678 | int rn = insn & 0xf; | ||
679 | long rdv = regs->uregs[rd]; | ||
714 | long rnv = regs->uregs[rn]; | 680 | long rnv = regs->uregs[rn]; |
715 | 681 | ||
716 | insnslot_1arg_rflags(rnv, regs->ARM_cpsr, i_fn); | 682 | regs->uregs[rd] = insnslot_2arg_rflags(rdv, rnv, regs->ARM_cpsr, i_fn); |
717 | } | 683 | } |
718 | 684 | ||
719 | static void __kprobes emulate_rd12rm0(struct kprobe *p, struct pt_regs *regs) | 685 | static void __kprobes emulate_rd12rm0(struct kprobe *p, struct pt_regs *regs) |
@@ -819,6 +785,17 @@ emulate_alu_imm_rwflags(struct kprobe *p, struct pt_regs *regs) | |||
819 | } | 785 | } |
820 | 786 | ||
821 | static void __kprobes | 787 | static void __kprobes |
788 | emulate_alu_tests_imm(struct kprobe *p, struct pt_regs *regs) | ||
789 | { | ||
790 | insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; | ||
791 | kprobe_opcode_t insn = p->opcode; | ||
792 | int rn = (insn >> 16) & 0xf; | ||
793 | long rnv = (rn == 15) ? (long)p->addr + 8 : regs->uregs[rn]; | ||
794 | |||
795 | insnslot_1arg_rwflags(rnv, ®s->ARM_cpsr, i_fn); | ||
796 | } | ||
797 | |||
798 | static void __kprobes | ||
822 | emulate_alu_rflags(struct kprobe *p, struct pt_regs *regs) | 799 | emulate_alu_rflags(struct kprobe *p, struct pt_regs *regs) |
823 | { | 800 | { |
824 | insn_3arg_fn_t *i_fn = (insn_3arg_fn_t *)&p->ainsn.insn[0]; | 801 | insn_3arg_fn_t *i_fn = (insn_3arg_fn_t *)&p->ainsn.insn[0]; |
@@ -854,14 +831,34 @@ emulate_alu_rwflags(struct kprobe *p, struct pt_regs *regs) | |||
854 | insnslot_3arg_rwflags(rnv, rmv, rsv, ®s->ARM_cpsr, i_fn); | 831 | insnslot_3arg_rwflags(rnv, rmv, rsv, ®s->ARM_cpsr, i_fn); |
855 | } | 832 | } |
856 | 833 | ||
834 | static void __kprobes | ||
835 | emulate_alu_tests(struct kprobe *p, struct pt_regs *regs) | ||
836 | { | ||
837 | insn_3arg_fn_t *i_fn = (insn_3arg_fn_t *)&p->ainsn.insn[0]; | ||
838 | kprobe_opcode_t insn = p->opcode; | ||
839 | long ppc = (long)p->addr + 8; | ||
840 | int rn = (insn >> 16) & 0xf; | ||
841 | int rs = (insn >> 8) & 0xf; /* rs/rsv may be invalid, don't care. */ | ||
842 | int rm = insn & 0xf; | ||
843 | long rnv = (rn == 15) ? ppc : regs->uregs[rn]; | ||
844 | long rmv = (rm == 15) ? ppc : regs->uregs[rm]; | ||
845 | long rsv = regs->uregs[rs]; | ||
846 | |||
847 | insnslot_3arg_rwflags(rnv, rmv, rsv, ®s->ARM_cpsr, i_fn); | ||
848 | } | ||
849 | |||
857 | static enum kprobe_insn __kprobes | 850 | static enum kprobe_insn __kprobes |
858 | prep_emulate_ldr_str(kprobe_opcode_t insn, struct arch_specific_insn *asi) | 851 | prep_emulate_ldr_str(kprobe_opcode_t insn, struct arch_specific_insn *asi) |
859 | { | 852 | { |
860 | int ibit = (insn & (1 << 26)) ? 25 : 22; | 853 | int not_imm = (insn & (1 << 26)) ? (insn & (1 << 25)) |
854 | : (~insn & (1 << 22)); | ||
855 | |||
856 | if (is_writeback(insn) && is_r15(insn, 16)) | ||
857 | return INSN_REJECTED; /* Writeback to PC */ | ||
861 | 858 | ||
862 | insn &= 0xfff00fff; | 859 | insn &= 0xfff00fff; |
863 | insn |= 0x00001000; /* Rn = r0, Rd = r1 */ | 860 | insn |= 0x00001000; /* Rn = r0, Rd = r1 */ |
864 | if (insn & (1 << ibit)) { | 861 | if (not_imm) { |
865 | insn &= ~0xf; | 862 | insn &= ~0xf; |
866 | insn |= 2; /* Rm = r2 */ | 863 | insn |= 2; /* Rm = r2 */ |
867 | } | 864 | } |
@@ -871,20 +868,40 @@ prep_emulate_ldr_str(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
871 | } | 868 | } |
872 | 869 | ||
873 | static enum kprobe_insn __kprobes | 870 | static enum kprobe_insn __kprobes |
874 | prep_emulate_rd12rm0(kprobe_opcode_t insn, struct arch_specific_insn *asi) | 871 | prep_emulate_rd12_modify(kprobe_opcode_t insn, struct arch_specific_insn *asi) |
875 | { | 872 | { |
876 | insn &= 0xffff0ff0; /* Rd = r0, Rm = r0 */ | 873 | if (is_r15(insn, 12)) |
874 | return INSN_REJECTED; /* Rd is PC */ | ||
875 | |||
876 | insn &= 0xffff0fff; /* Rd = r0 */ | ||
877 | asi->insn[0] = insn; | 877 | asi->insn[0] = insn; |
878 | asi->insn_handler = emulate_rd12rm0; | 878 | asi->insn_handler = emulate_rd12_modify; |
879 | return INSN_GOOD; | 879 | return INSN_GOOD; |
880 | } | 880 | } |
881 | 881 | ||
882 | static enum kprobe_insn __kprobes | 882 | static enum kprobe_insn __kprobes |
883 | prep_emulate_rd12(kprobe_opcode_t insn, struct arch_specific_insn *asi) | 883 | prep_emulate_rd12rn0_modify(kprobe_opcode_t insn, |
884 | struct arch_specific_insn *asi) | ||
884 | { | 885 | { |
885 | insn &= 0xffff0fff; /* Rd = r0 */ | 886 | if (is_r15(insn, 12)) |
887 | return INSN_REJECTED; /* Rd is PC */ | ||
888 | |||
889 | insn &= 0xffff0ff0; /* Rd = r0 */ | ||
890 | insn |= 0x00000001; /* Rn = r1 */ | ||
891 | asi->insn[0] = insn; | ||
892 | asi->insn_handler = emulate_rd12rn0_modify; | ||
893 | return INSN_GOOD; | ||
894 | } | ||
895 | |||
896 | static enum kprobe_insn __kprobes | ||
897 | prep_emulate_rd12rm0(kprobe_opcode_t insn, struct arch_specific_insn *asi) | ||
898 | { | ||
899 | if (is_r15(insn, 12)) | ||
900 | return INSN_REJECTED; /* Rd is PC */ | ||
901 | |||
902 | insn &= 0xffff0ff0; /* Rd = r0, Rm = r0 */ | ||
886 | asi->insn[0] = insn; | 903 | asi->insn[0] = insn; |
887 | asi->insn_handler = emulate_rd12; | 904 | asi->insn_handler = emulate_rd12rm0; |
888 | return INSN_GOOD; | 905 | return INSN_GOOD; |
889 | } | 906 | } |
890 | 907 | ||
@@ -892,6 +909,9 @@ static enum kprobe_insn __kprobes | |||
892 | prep_emulate_rd12rn16rm0_wflags(kprobe_opcode_t insn, | 909 | prep_emulate_rd12rn16rm0_wflags(kprobe_opcode_t insn, |
893 | struct arch_specific_insn *asi) | 910 | struct arch_specific_insn *asi) |
894 | { | 911 | { |
912 | if (is_r15(insn, 12)) | ||
913 | return INSN_REJECTED; /* Rd is PC */ | ||
914 | |||
895 | insn &= 0xfff00ff0; /* Rd = r0, Rn = r0 */ | 915 | insn &= 0xfff00ff0; /* Rd = r0, Rn = r0 */ |
896 | insn |= 0x00000001; /* Rm = r1 */ | 916 | insn |= 0x00000001; /* Rm = r1 */ |
897 | asi->insn[0] = insn; | 917 | asi->insn[0] = insn; |
@@ -903,6 +923,9 @@ static enum kprobe_insn __kprobes | |||
903 | prep_emulate_rd16rs8rm0_wflags(kprobe_opcode_t insn, | 923 | prep_emulate_rd16rs8rm0_wflags(kprobe_opcode_t insn, |
904 | struct arch_specific_insn *asi) | 924 | struct arch_specific_insn *asi) |
905 | { | 925 | { |
926 | if (is_r15(insn, 16)) | ||
927 | return INSN_REJECTED; /* Rd is PC */ | ||
928 | |||
906 | insn &= 0xfff0f0f0; /* Rd = r0, Rs = r0 */ | 929 | insn &= 0xfff0f0f0; /* Rd = r0, Rs = r0 */ |
907 | insn |= 0x00000001; /* Rm = r1 */ | 930 | insn |= 0x00000001; /* Rm = r1 */ |
908 | asi->insn[0] = insn; | 931 | asi->insn[0] = insn; |
@@ -914,6 +937,9 @@ static enum kprobe_insn __kprobes | |||
914 | prep_emulate_rd16rn12rs8rm0_wflags(kprobe_opcode_t insn, | 937 | prep_emulate_rd16rn12rs8rm0_wflags(kprobe_opcode_t insn, |
915 | struct arch_specific_insn *asi) | 938 | struct arch_specific_insn *asi) |
916 | { | 939 | { |
940 | if (is_r15(insn, 16)) | ||
941 | return INSN_REJECTED; /* Rd is PC */ | ||
942 | |||
917 | insn &= 0xfff000f0; /* Rd = r0, Rn = r0 */ | 943 | insn &= 0xfff000f0; /* Rd = r0, Rn = r0 */ |
918 | insn |= 0x00000102; /* Rs = r1, Rm = r2 */ | 944 | insn |= 0x00000102; /* Rs = r1, Rm = r2 */ |
919 | asi->insn[0] = insn; | 945 | asi->insn[0] = insn; |
@@ -925,6 +951,9 @@ static enum kprobe_insn __kprobes | |||
925 | prep_emulate_rdhi16rdlo12rs8rm0_wflags(kprobe_opcode_t insn, | 951 | prep_emulate_rdhi16rdlo12rs8rm0_wflags(kprobe_opcode_t insn, |
926 | struct arch_specific_insn *asi) | 952 | struct arch_specific_insn *asi) |
927 | { | 953 | { |
954 | if (is_r15(insn, 16) || is_r15(insn, 12)) | ||
955 | return INSN_REJECTED; /* RdHi or RdLo is PC */ | ||
956 | |||
928 | insn &= 0xfff000f0; /* RdHi = r0, RdLo = r1 */ | 957 | insn &= 0xfff000f0; /* RdHi = r0, RdLo = r1 */ |
929 | insn |= 0x00001203; /* Rs = r2, Rm = r3 */ | 958 | insn |= 0x00001203; /* Rs = r2, Rm = r3 */ |
930 | asi->insn[0] = insn; | 959 | asi->insn[0] = insn; |
@@ -945,20 +974,13 @@ prep_emulate_rdhi16rdlo12rs8rm0_wflags(kprobe_opcode_t insn, | |||
945 | static enum kprobe_insn __kprobes | 974 | static enum kprobe_insn __kprobes |
946 | space_1111(kprobe_opcode_t insn, struct arch_specific_insn *asi) | 975 | space_1111(kprobe_opcode_t insn, struct arch_specific_insn *asi) |
947 | { | 976 | { |
948 | /* CPS mmod == 1 : 1111 0001 0000 xx10 xxxx xxxx xx0x xxxx */ | 977 | /* memory hint : 1111 0100 x001 xxxx xxxx xxxx xxxx xxxx : */ |
949 | /* RFE : 1111 100x x0x1 xxxx xxxx 1010 xxxx xxxx */ | 978 | /* PLDI : 1111 0100 x101 xxxx xxxx xxxx xxxx xxxx : */ |
950 | /* SRS : 1111 100x x1x0 1101 xxxx 0101 xxxx xxxx */ | 979 | /* PLDW : 1111 0101 x001 xxxx xxxx xxxx xxxx xxxx : */ |
951 | if ((insn & 0xfff30020) == 0xf1020000 || | 980 | /* PLD : 1111 0101 x101 xxxx xxxx xxxx xxxx xxxx : */ |
952 | (insn & 0xfe500f00) == 0xf8100a00 || | 981 | if ((insn & 0xfe300000) == 0xf4100000) { |
953 | (insn & 0xfe5f0f00) == 0xf84d0500) | 982 | asi->insn_handler = emulate_nop; |
954 | return INSN_REJECTED; | 983 | return INSN_GOOD_NO_SLOT; |
955 | |||
956 | /* PLD : 1111 01x1 x101 xxxx xxxx xxxx xxxx xxxx : */ | ||
957 | if ((insn & 0xfd700000) == 0xf4500000) { | ||
958 | insn &= 0xfff0ffff; /* Rn = r0 */ | ||
959 | asi->insn[0] = insn; | ||
960 | asi->insn_handler = emulate_rn16; | ||
961 | return INSN_GOOD; | ||
962 | } | 984 | } |
963 | 985 | ||
964 | /* BLX(1) : 1111 101x xxxx xxxx xxxx xxxx xxxx xxxx : */ | 986 | /* BLX(1) : 1111 101x xxxx xxxx xxxx xxxx xxxx xxxx : */ |
@@ -967,41 +989,22 @@ space_1111(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
967 | return INSN_GOOD_NO_SLOT; | 989 | return INSN_GOOD_NO_SLOT; |
968 | } | 990 | } |
969 | 991 | ||
970 | /* SETEND : 1111 0001 0000 0001 xxxx xxxx 0000 xxxx */ | 992 | /* CPS : 1111 0001 0000 xxx0 xxxx xxxx xx0x xxxx */ |
971 | /* CDP2 : 1111 1110 xxxx xxxx xxxx xxxx xxx0 xxxx */ | 993 | /* SETEND: 1111 0001 0000 0001 xxxx xxxx 0000 xxxx */ |
972 | if ((insn & 0xffff00f0) == 0xf1010000 || | ||
973 | (insn & 0xff000010) == 0xfe000000) { | ||
974 | asi->insn[0] = insn; | ||
975 | asi->insn_handler = emulate_none; | ||
976 | return INSN_GOOD; | ||
977 | } | ||
978 | 994 | ||
995 | /* SRS : 1111 100x x1x0 xxxx xxxx xxxx xxxx xxxx */ | ||
996 | /* RFE : 1111 100x x0x1 xxxx xxxx xxxx xxxx xxxx */ | ||
997 | |||
998 | /* Coprocessor instructions... */ | ||
979 | /* MCRR2 : 1111 1100 0100 xxxx xxxx xxxx xxxx xxxx : (Rd != Rn) */ | 999 | /* MCRR2 : 1111 1100 0100 xxxx xxxx xxxx xxxx xxxx : (Rd != Rn) */ |
980 | /* MRRC2 : 1111 1100 0101 xxxx xxxx xxxx xxxx xxxx : (Rd != Rn) */ | 1000 | /* MRRC2 : 1111 1100 0101 xxxx xxxx xxxx xxxx xxxx : (Rd != Rn) */ |
981 | if ((insn & 0xffe00000) == 0xfc400000) { | 1001 | /* LDC2 : 1111 110x xxx1 xxxx xxxx xxxx xxxx xxxx */ |
982 | insn &= 0xfff00fff; /* Rn = r0 */ | 1002 | /* STC2 : 1111 110x xxx0 xxxx xxxx xxxx xxxx xxxx */ |
983 | insn |= 0x00001000; /* Rd = r1 */ | 1003 | /* CDP2 : 1111 1110 xxxx xxxx xxxx xxxx xxx0 xxxx */ |
984 | asi->insn[0] = insn; | 1004 | /* MCR2 : 1111 1110 xxx0 xxxx xxxx xxxx xxx1 xxxx */ |
985 | asi->insn_handler = | 1005 | /* MRC2 : 1111 1110 xxx1 xxxx xxxx xxxx xxx1 xxxx */ |
986 | (insn & (1 << 20)) ? emulate_mrrc : emulate_mcrr; | ||
987 | return INSN_GOOD; | ||
988 | } | ||
989 | 1006 | ||
990 | /* LDC2 : 1111 110x xxx1 xxxx xxxx xxxx xxxx xxxx */ | 1007 | return INSN_REJECTED; |
991 | /* STC2 : 1111 110x xxx0 xxxx xxxx xxxx xxxx xxxx */ | ||
992 | if ((insn & 0xfe000000) == 0xfc000000) { | ||
993 | insn &= 0xfff0ffff; /* Rn = r0 */ | ||
994 | asi->insn[0] = insn; | ||
995 | asi->insn_handler = emulate_ldcstc; | ||
996 | return INSN_GOOD; | ||
997 | } | ||
998 | |||
999 | /* MCR2 : 1111 1110 xxx0 xxxx xxxx xxxx xxx1 xxxx */ | ||
1000 | /* MRC2 : 1111 1110 xxx1 xxxx xxxx xxxx xxx1 xxxx */ | ||
1001 | insn &= 0xffff0fff; /* Rd = r0 */ | ||
1002 | asi->insn[0] = insn; | ||
1003 | asi->insn_handler = (insn & (1 << 20)) ? emulate_rd12 : emulate_ird12; | ||
1004 | return INSN_GOOD; | ||
1005 | } | 1008 | } |
1006 | 1009 | ||
1007 | static enum kprobe_insn __kprobes | 1010 | static enum kprobe_insn __kprobes |
@@ -1010,19 +1013,18 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1010 | /* cccc 0001 0xx0 xxxx xxxx xxxx xxxx xxx0 xxxx */ | 1013 | /* cccc 0001 0xx0 xxxx xxxx xxxx xxxx xxx0 xxxx */ |
1011 | if ((insn & 0x0f900010) == 0x01000000) { | 1014 | if ((insn & 0x0f900010) == 0x01000000) { |
1012 | 1015 | ||
1013 | /* BXJ : cccc 0001 0010 xxxx xxxx xxxx 0010 xxxx */ | 1016 | /* MRS cpsr : cccc 0001 0000 xxxx xxxx xxxx 0000 xxxx */ |
1014 | /* MSR : cccc 0001 0x10 xxxx xxxx xxxx 0000 xxxx */ | 1017 | if ((insn & 0x0ff000f0) == 0x01000000) { |
1015 | if ((insn & 0x0ff000f0) == 0x01200020 || | 1018 | if (is_r15(insn, 12)) |
1016 | (insn & 0x0fb000f0) == 0x01200000) | 1019 | return INSN_REJECTED; /* Rd is PC */ |
1017 | return INSN_REJECTED; | 1020 | asi->insn_handler = simulate_mrs; |
1018 | 1021 | return INSN_GOOD_NO_SLOT; | |
1019 | /* MRS : cccc 0001 0x00 xxxx xxxx xxxx 0000 xxxx */ | 1022 | } |
1020 | if ((insn & 0x0fb00010) == 0x01000000) | ||
1021 | return prep_emulate_rd12(insn, asi); | ||
1022 | 1023 | ||
1023 | /* SMLALxy : cccc 0001 0100 xxxx xxxx xxxx 1xx0 xxxx */ | 1024 | /* SMLALxy : cccc 0001 0100 xxxx xxxx xxxx 1xx0 xxxx */ |
1024 | if ((insn & 0x0ff00090) == 0x01400080) | 1025 | if ((insn & 0x0ff00090) == 0x01400080) |
1025 | return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi); | 1026 | return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, |
1027 | asi); | ||
1026 | 1028 | ||
1027 | /* SMULWy : cccc 0001 0010 xxxx xxxx xxxx 1x10 xxxx */ | 1029 | /* SMULWy : cccc 0001 0010 xxxx xxxx xxxx 1x10 xxxx */ |
1028 | /* SMULxy : cccc 0001 0110 xxxx xxxx xxxx 1xx0 xxxx */ | 1030 | /* SMULxy : cccc 0001 0110 xxxx xxxx xxxx 1xx0 xxxx */ |
@@ -1031,24 +1033,29 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1031 | return prep_emulate_rd16rs8rm0_wflags(insn, asi); | 1033 | return prep_emulate_rd16rs8rm0_wflags(insn, asi); |
1032 | 1034 | ||
1033 | /* SMLAxy : cccc 0001 0000 xxxx xxxx xxxx 1xx0 xxxx : Q */ | 1035 | /* SMLAxy : cccc 0001 0000 xxxx xxxx xxxx 1xx0 xxxx : Q */ |
1034 | /* SMLAWy : cccc 0001 0010 xxxx xxxx xxxx 0x00 xxxx : Q */ | 1036 | /* SMLAWy : cccc 0001 0010 xxxx xxxx xxxx 1x00 xxxx : Q */ |
1035 | return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi); | 1037 | if ((insn & 0x0ff00090) == 0x01000080 || |
1038 | (insn & 0x0ff000b0) == 0x01200080) | ||
1039 | return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi); | ||
1040 | |||
1041 | /* BXJ : cccc 0001 0010 xxxx xxxx xxxx 0010 xxxx */ | ||
1042 | /* MSR : cccc 0001 0x10 xxxx xxxx xxxx 0000 xxxx */ | ||
1043 | /* MRS spsr : cccc 0001 0100 xxxx xxxx xxxx 0000 xxxx */ | ||
1036 | 1044 | ||
1045 | /* Other instruction encodings aren't yet defined */ | ||
1046 | return INSN_REJECTED; | ||
1037 | } | 1047 | } |
1038 | 1048 | ||
1039 | /* cccc 0001 0xx0 xxxx xxxx xxxx xxxx 0xx1 xxxx */ | 1049 | /* cccc 0001 0xx0 xxxx xxxx xxxx xxxx 0xx1 xxxx */ |
1040 | else if ((insn & 0x0f900090) == 0x01000010) { | 1050 | else if ((insn & 0x0f900090) == 0x01000010) { |
1041 | 1051 | ||
1042 | /* BKPT : 1110 0001 0010 xxxx xxxx xxxx 0111 xxxx */ | ||
1043 | if ((insn & 0xfff000f0) == 0xe1200070) | ||
1044 | return INSN_REJECTED; | ||
1045 | |||
1046 | /* BLX(2) : cccc 0001 0010 xxxx xxxx xxxx 0011 xxxx */ | 1052 | /* BLX(2) : cccc 0001 0010 xxxx xxxx xxxx 0011 xxxx */ |
1047 | /* BX : cccc 0001 0010 xxxx xxxx xxxx 0001 xxxx */ | 1053 | /* BX : cccc 0001 0010 xxxx xxxx xxxx 0001 xxxx */ |
1048 | if ((insn & 0x0ff000d0) == 0x01200010) { | 1054 | if ((insn & 0x0ff000d0) == 0x01200010) { |
1049 | asi->insn[0] = truecc_insn(insn); | 1055 | if ((insn & 0x0ff000ff) == 0x0120003f) |
1056 | return INSN_REJECTED; /* BLX pc */ | ||
1050 | asi->insn_handler = simulate_blx2bx; | 1057 | asi->insn_handler = simulate_blx2bx; |
1051 | return INSN_GOOD; | 1058 | return INSN_GOOD_NO_SLOT; |
1052 | } | 1059 | } |
1053 | 1060 | ||
1054 | /* CLZ : cccc 0001 0110 xxxx xxxx xxxx 0001 xxxx */ | 1061 | /* CLZ : cccc 0001 0110 xxxx xxxx xxxx 0001 xxxx */ |
@@ -1059,17 +1066,27 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1059 | /* QSUB : cccc 0001 0010 xxxx xxxx xxxx 0101 xxxx :Q */ | 1066 | /* QSUB : cccc 0001 0010 xxxx xxxx xxxx 0101 xxxx :Q */ |
1060 | /* QDADD : cccc 0001 0100 xxxx xxxx xxxx 0101 xxxx :Q */ | 1067 | /* QDADD : cccc 0001 0100 xxxx xxxx xxxx 0101 xxxx :Q */ |
1061 | /* QDSUB : cccc 0001 0110 xxxx xxxx xxxx 0101 xxxx :Q */ | 1068 | /* QDSUB : cccc 0001 0110 xxxx xxxx xxxx 0101 xxxx :Q */ |
1062 | return prep_emulate_rd12rn16rm0_wflags(insn, asi); | 1069 | if ((insn & 0x0f9000f0) == 0x01000050) |
1070 | return prep_emulate_rd12rn16rm0_wflags(insn, asi); | ||
1071 | |||
1072 | /* BKPT : 1110 0001 0010 xxxx xxxx xxxx 0111 xxxx */ | ||
1073 | /* SMC : cccc 0001 0110 xxxx xxxx xxxx 0111 xxxx */ | ||
1074 | |||
1075 | /* Other instruction encodings aren't yet defined */ | ||
1076 | return INSN_REJECTED; | ||
1063 | } | 1077 | } |
1064 | 1078 | ||
1065 | /* cccc 0000 xxxx xxxx xxxx xxxx xxxx 1001 xxxx */ | 1079 | /* cccc 0000 xxxx xxxx xxxx xxxx xxxx 1001 xxxx */ |
1066 | else if ((insn & 0x0f000090) == 0x00000090) { | 1080 | else if ((insn & 0x0f0000f0) == 0x00000090) { |
1067 | 1081 | ||
1068 | /* MUL : cccc 0000 0000 xxxx xxxx xxxx 1001 xxxx : */ | 1082 | /* MUL : cccc 0000 0000 xxxx xxxx xxxx 1001 xxxx : */ |
1069 | /* MULS : cccc 0000 0001 xxxx xxxx xxxx 1001 xxxx :cc */ | 1083 | /* MULS : cccc 0000 0001 xxxx xxxx xxxx 1001 xxxx :cc */ |
1070 | /* MLA : cccc 0000 0010 xxxx xxxx xxxx 1001 xxxx : */ | 1084 | /* MLA : cccc 0000 0010 xxxx xxxx xxxx 1001 xxxx : */ |
1071 | /* MLAS : cccc 0000 0011 xxxx xxxx xxxx 1001 xxxx :cc */ | 1085 | /* MLAS : cccc 0000 0011 xxxx xxxx xxxx 1001 xxxx :cc */ |
1072 | /* UMAAL : cccc 0000 0100 xxxx xxxx xxxx 1001 xxxx : */ | 1086 | /* UMAAL : cccc 0000 0100 xxxx xxxx xxxx 1001 xxxx : */ |
1087 | /* undef : cccc 0000 0101 xxxx xxxx xxxx 1001 xxxx : */ | ||
1088 | /* MLS : cccc 0000 0110 xxxx xxxx xxxx 1001 xxxx : */ | ||
1089 | /* undef : cccc 0000 0111 xxxx xxxx xxxx 1001 xxxx : */ | ||
1073 | /* UMULL : cccc 0000 1000 xxxx xxxx xxxx 1001 xxxx : */ | 1090 | /* UMULL : cccc 0000 1000 xxxx xxxx xxxx 1001 xxxx : */ |
1074 | /* UMULLS : cccc 0000 1001 xxxx xxxx xxxx 1001 xxxx :cc */ | 1091 | /* UMULLS : cccc 0000 1001 xxxx xxxx xxxx 1001 xxxx :cc */ |
1075 | /* UMLAL : cccc 0000 1010 xxxx xxxx xxxx 1001 xxxx : */ | 1092 | /* UMLAL : cccc 0000 1010 xxxx xxxx xxxx 1001 xxxx : */ |
@@ -1078,13 +1095,15 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1078 | /* SMULLS : cccc 0000 1101 xxxx xxxx xxxx 1001 xxxx :cc */ | 1095 | /* SMULLS : cccc 0000 1101 xxxx xxxx xxxx 1001 xxxx :cc */ |
1079 | /* SMLAL : cccc 0000 1110 xxxx xxxx xxxx 1001 xxxx : */ | 1096 | /* SMLAL : cccc 0000 1110 xxxx xxxx xxxx 1001 xxxx : */ |
1080 | /* SMLALS : cccc 0000 1111 xxxx xxxx xxxx 1001 xxxx :cc */ | 1097 | /* SMLALS : cccc 0000 1111 xxxx xxxx xxxx 1001 xxxx :cc */ |
1081 | if ((insn & 0x0fe000f0) == 0x00000090) { | 1098 | if ((insn & 0x00d00000) == 0x00500000) |
1082 | return prep_emulate_rd16rs8rm0_wflags(insn, asi); | 1099 | return INSN_REJECTED; |
1083 | } else if ((insn & 0x0fe000f0) == 0x00200090) { | 1100 | else if ((insn & 0x00e00000) == 0x00000000) |
1084 | return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi); | 1101 | return prep_emulate_rd16rs8rm0_wflags(insn, asi); |
1085 | } else { | 1102 | else if ((insn & 0x00a00000) == 0x00200000) |
1086 | return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi); | 1103 | return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi); |
1087 | } | 1104 | else |
1105 | return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, | ||
1106 | asi); | ||
1088 | } | 1107 | } |
1089 | 1108 | ||
1090 | /* cccc 000x xxxx xxxx xxxx xxxx xxxx 1xx1 xxxx */ | 1109 | /* cccc 000x xxxx xxxx xxxx xxxx xxxx 1xx1 xxxx */ |
@@ -1092,23 +1111,45 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1092 | 1111 | ||
1093 | /* SWP : cccc 0001 0000 xxxx xxxx xxxx 1001 xxxx */ | 1112 | /* SWP : cccc 0001 0000 xxxx xxxx xxxx 1001 xxxx */ |
1094 | /* SWPB : cccc 0001 0100 xxxx xxxx xxxx 1001 xxxx */ | 1113 | /* SWPB : cccc 0001 0100 xxxx xxxx xxxx 1001 xxxx */ |
1095 | /* LDRD : cccc 000x xxx0 xxxx xxxx xxxx 1101 xxxx */ | 1114 | /* ??? : cccc 0001 0x01 xxxx xxxx xxxx 1001 xxxx */ |
1096 | /* STRD : cccc 000x xxx0 xxxx xxxx xxxx 1111 xxxx */ | 1115 | /* ??? : cccc 0001 0x10 xxxx xxxx xxxx 1001 xxxx */ |
1116 | /* ??? : cccc 0001 0x11 xxxx xxxx xxxx 1001 xxxx */ | ||
1097 | /* STREX : cccc 0001 1000 xxxx xxxx xxxx 1001 xxxx */ | 1117 | /* STREX : cccc 0001 1000 xxxx xxxx xxxx 1001 xxxx */ |
1098 | /* LDREX : cccc 0001 1001 xxxx xxxx xxxx 1001 xxxx */ | 1118 | /* LDREX : cccc 0001 1001 xxxx xxxx xxxx 1001 xxxx */ |
1119 | /* STREXD: cccc 0001 1010 xxxx xxxx xxxx 1001 xxxx */ | ||
1120 | /* LDREXD: cccc 0001 1011 xxxx xxxx xxxx 1001 xxxx */ | ||
1121 | /* STREXB: cccc 0001 1100 xxxx xxxx xxxx 1001 xxxx */ | ||
1122 | /* LDREXB: cccc 0001 1101 xxxx xxxx xxxx 1001 xxxx */ | ||
1123 | /* STREXH: cccc 0001 1110 xxxx xxxx xxxx 1001 xxxx */ | ||
1124 | /* LDREXH: cccc 0001 1111 xxxx xxxx xxxx 1001 xxxx */ | ||
1125 | |||
1126 | /* LDRD : cccc 000x xxx0 xxxx xxxx xxxx 1101 xxxx */ | ||
1127 | /* STRD : cccc 000x xxx0 xxxx xxxx xxxx 1111 xxxx */ | ||
1099 | /* LDRH : cccc 000x xxx1 xxxx xxxx xxxx 1011 xxxx */ | 1128 | /* LDRH : cccc 000x xxx1 xxxx xxxx xxxx 1011 xxxx */ |
1100 | /* STRH : cccc 000x xxx0 xxxx xxxx xxxx 1011 xxxx */ | 1129 | /* STRH : cccc 000x xxx0 xxxx xxxx xxxx 1011 xxxx */ |
1101 | /* LDRSB : cccc 000x xxx1 xxxx xxxx xxxx 1101 xxxx */ | 1130 | /* LDRSB : cccc 000x xxx1 xxxx xxxx xxxx 1101 xxxx */ |
1102 | /* LDRSH : cccc 000x xxx1 xxxx xxxx xxxx 1111 xxxx */ | 1131 | /* LDRSH : cccc 000x xxx1 xxxx xxxx xxxx 1111 xxxx */ |
1103 | if ((insn & 0x0fb000f0) == 0x01000090) { | 1132 | if ((insn & 0x0f0000f0) == 0x01000090) { |
1104 | /* SWP/SWPB */ | 1133 | if ((insn & 0x0fb000f0) == 0x01000090) { |
1105 | return prep_emulate_rd12rn16rm0_wflags(insn, asi); | 1134 | /* SWP/SWPB */ |
1135 | return prep_emulate_rd12rn16rm0_wflags(insn, | ||
1136 | asi); | ||
1137 | } else { | ||
1138 | /* STREX/LDREX variants and unallocaed space */ | ||
1139 | return INSN_REJECTED; | ||
1140 | } | ||
1141 | |||
1106 | } else if ((insn & 0x0e1000d0) == 0x00000d0) { | 1142 | } else if ((insn & 0x0e1000d0) == 0x00000d0) { |
1107 | /* STRD/LDRD */ | 1143 | /* STRD/LDRD */ |
1144 | if ((insn & 0x0000e000) == 0x0000e000) | ||
1145 | return INSN_REJECTED; /* Rd is LR or PC */ | ||
1146 | if (is_writeback(insn) && is_r15(insn, 16)) | ||
1147 | return INSN_REJECTED; /* Writeback to PC */ | ||
1148 | |||
1108 | insn &= 0xfff00fff; | 1149 | insn &= 0xfff00fff; |
1109 | insn |= 0x00002000; /* Rn = r0, Rd = r2 */ | 1150 | insn |= 0x00002000; /* Rn = r0, Rd = r2 */ |
1110 | if (insn & (1 << 22)) { | 1151 | if (!(insn & (1 << 22))) { |
1111 | /* I bit */ | 1152 | /* Register index */ |
1112 | insn &= ~0xf; | 1153 | insn &= ~0xf; |
1113 | insn |= 1; /* Rm = r1 */ | 1154 | insn |= 1; /* Rm = r1 */ |
1114 | } | 1155 | } |
@@ -1118,6 +1159,9 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1118 | return INSN_GOOD; | 1159 | return INSN_GOOD; |
1119 | } | 1160 | } |
1120 | 1161 | ||
1162 | /* LDRH/STRH/LDRSB/LDRSH */ | ||
1163 | if (is_r15(insn, 12)) | ||
1164 | return INSN_REJECTED; /* Rd is PC */ | ||
1121 | return prep_emulate_ldr_str(insn, asi); | 1165 | return prep_emulate_ldr_str(insn, asi); |
1122 | } | 1166 | } |
1123 | 1167 | ||
@@ -1125,7 +1169,7 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1125 | 1169 | ||
1126 | /* | 1170 | /* |
1127 | * ALU op with S bit and Rd == 15 : | 1171 | * ALU op with S bit and Rd == 15 : |
1128 | * cccc 000x xxx1 xxxx 1111 xxxx xxxx xxxx | 1172 | * cccc 000x xxx1 xxxx 1111 xxxx xxxx xxxx |
1129 | */ | 1173 | */ |
1130 | if ((insn & 0x0e10f000) == 0x0010f000) | 1174 | if ((insn & 0x0e10f000) == 0x0010f000) |
1131 | return INSN_REJECTED; | 1175 | return INSN_REJECTED; |
@@ -1154,22 +1198,61 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1154 | insn |= 0x00000200; /* Rs = r2 */ | 1198 | insn |= 0x00000200; /* Rs = r2 */ |
1155 | } | 1199 | } |
1156 | asi->insn[0] = insn; | 1200 | asi->insn[0] = insn; |
1157 | asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */ | 1201 | |
1202 | if ((insn & 0x0f900000) == 0x01100000) { | ||
1203 | /* | ||
1204 | * TST : cccc 0001 0001 xxxx xxxx xxxx xxxx xxxx | ||
1205 | * TEQ : cccc 0001 0011 xxxx xxxx xxxx xxxx xxxx | ||
1206 | * CMP : cccc 0001 0101 xxxx xxxx xxxx xxxx xxxx | ||
1207 | * CMN : cccc 0001 0111 xxxx xxxx xxxx xxxx xxxx | ||
1208 | */ | ||
1209 | asi->insn_handler = emulate_alu_tests; | ||
1210 | } else { | ||
1211 | /* ALU ops which write to Rd */ | ||
1212 | asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */ | ||
1158 | emulate_alu_rwflags : emulate_alu_rflags; | 1213 | emulate_alu_rwflags : emulate_alu_rflags; |
1214 | } | ||
1159 | return INSN_GOOD; | 1215 | return INSN_GOOD; |
1160 | } | 1216 | } |
1161 | 1217 | ||
1162 | static enum kprobe_insn __kprobes | 1218 | static enum kprobe_insn __kprobes |
1163 | space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | 1219 | space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi) |
1164 | { | 1220 | { |
1221 | /* MOVW : cccc 0011 0000 xxxx xxxx xxxx xxxx xxxx */ | ||
1222 | /* MOVT : cccc 0011 0100 xxxx xxxx xxxx xxxx xxxx */ | ||
1223 | if ((insn & 0x0fb00000) == 0x03000000) | ||
1224 | return prep_emulate_rd12_modify(insn, asi); | ||
1225 | |||
1226 | /* hints : cccc 0011 0010 0000 xxxx xxxx xxxx xxxx */ | ||
1227 | if ((insn & 0x0fff0000) == 0x03200000) { | ||
1228 | unsigned op2 = insn & 0x000000ff; | ||
1229 | if (op2 == 0x01 || op2 == 0x04) { | ||
1230 | /* YIELD : cccc 0011 0010 0000 xxxx xxxx 0000 0001 */ | ||
1231 | /* SEV : cccc 0011 0010 0000 xxxx xxxx 0000 0100 */ | ||
1232 | asi->insn[0] = insn; | ||
1233 | asi->insn_handler = emulate_none; | ||
1234 | return INSN_GOOD; | ||
1235 | } else if (op2 <= 0x03) { | ||
1236 | /* NOP : cccc 0011 0010 0000 xxxx xxxx 0000 0000 */ | ||
1237 | /* WFE : cccc 0011 0010 0000 xxxx xxxx 0000 0010 */ | ||
1238 | /* WFI : cccc 0011 0010 0000 xxxx xxxx 0000 0011 */ | ||
1239 | /* | ||
1240 | * We make WFE and WFI true NOPs to avoid stalls due | ||
1241 | * to missing events whilst processing the probe. | ||
1242 | */ | ||
1243 | asi->insn_handler = emulate_nop; | ||
1244 | return INSN_GOOD_NO_SLOT; | ||
1245 | } | ||
1246 | /* For DBG and unallocated hints it's safest to reject them */ | ||
1247 | return INSN_REJECTED; | ||
1248 | } | ||
1249 | |||
1165 | /* | 1250 | /* |
1166 | * MSR : cccc 0011 0x10 xxxx xxxx xxxx xxxx xxxx | 1251 | * MSR : cccc 0011 0x10 xxxx xxxx xxxx xxxx xxxx |
1167 | * Undef : cccc 0011 0100 xxxx xxxx xxxx xxxx xxxx | ||
1168 | * ALU op with S bit and Rd == 15 : | 1252 | * ALU op with S bit and Rd == 15 : |
1169 | * cccc 001x xxx1 xxxx 1111 xxxx xxxx xxxx | 1253 | * cccc 001x xxx1 xxxx 1111 xxxx xxxx xxxx |
1170 | */ | 1254 | */ |
1171 | if ((insn & 0x0fb00000) == 0x03200000 || /* MSR */ | 1255 | if ((insn & 0x0fb00000) == 0x03200000 || /* MSR */ |
1172 | (insn & 0x0ff00000) == 0x03400000 || /* Undef */ | ||
1173 | (insn & 0x0e10f000) == 0x0210f000) /* ALU s-bit, R15 */ | 1256 | (insn & 0x0e10f000) == 0x0210f000) /* ALU s-bit, R15 */ |
1174 | return INSN_REJECTED; | 1257 | return INSN_REJECTED; |
1175 | 1258 | ||
@@ -1180,10 +1263,22 @@ space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1180 | * *S (bit 20) updates condition codes | 1263 | * *S (bit 20) updates condition codes |
1181 | * ADC/SBC/RSC reads the C flag | 1264 | * ADC/SBC/RSC reads the C flag |
1182 | */ | 1265 | */ |
1183 | insn &= 0xffff0fff; /* Rd = r0 */ | 1266 | insn &= 0xfff00fff; /* Rn = r0 and Rd = r0 */ |
1184 | asi->insn[0] = insn; | 1267 | asi->insn[0] = insn; |
1185 | asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */ | 1268 | |
1269 | if ((insn & 0x0f900000) == 0x03100000) { | ||
1270 | /* | ||
1271 | * TST : cccc 0011 0001 xxxx xxxx xxxx xxxx xxxx | ||
1272 | * TEQ : cccc 0011 0011 xxxx xxxx xxxx xxxx xxxx | ||
1273 | * CMP : cccc 0011 0101 xxxx xxxx xxxx xxxx xxxx | ||
1274 | * CMN : cccc 0011 0111 xxxx xxxx xxxx xxxx xxxx | ||
1275 | */ | ||
1276 | asi->insn_handler = emulate_alu_tests_imm; | ||
1277 | } else { | ||
1278 | /* ALU ops which write to Rd */ | ||
1279 | asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */ | ||
1186 | emulate_alu_imm_rwflags : emulate_alu_imm_rflags; | 1280 | emulate_alu_imm_rwflags : emulate_alu_imm_rflags; |
1281 | } | ||
1187 | return INSN_GOOD; | 1282 | return INSN_GOOD; |
1188 | } | 1283 | } |
1189 | 1284 | ||
@@ -1192,6 +1287,8 @@ space_cccc_0110__1(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1192 | { | 1287 | { |
1193 | /* SEL : cccc 0110 1000 xxxx xxxx xxxx 1011 xxxx GE: !!! */ | 1288 | /* SEL : cccc 0110 1000 xxxx xxxx xxxx 1011 xxxx GE: !!! */ |
1194 | if ((insn & 0x0ff000f0) == 0x068000b0) { | 1289 | if ((insn & 0x0ff000f0) == 0x068000b0) { |
1290 | if (is_r15(insn, 12)) | ||
1291 | return INSN_REJECTED; /* Rd is PC */ | ||
1195 | insn &= 0xfff00ff0; /* Rd = r0, Rn = r0 */ | 1292 | insn &= 0xfff00ff0; /* Rd = r0, Rn = r0 */ |
1196 | insn |= 0x00000001; /* Rm = r1 */ | 1293 | insn |= 0x00000001; /* Rm = r1 */ |
1197 | asi->insn[0] = insn; | 1294 | asi->insn[0] = insn; |
@@ -1205,6 +1302,8 @@ space_cccc_0110__1(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1205 | /* USAT16 : cccc 0110 1110 xxxx xxxx xxxx 0011 xxxx :Q */ | 1302 | /* USAT16 : cccc 0110 1110 xxxx xxxx xxxx 0011 xxxx :Q */ |
1206 | if ((insn & 0x0fa00030) == 0x06a00010 || | 1303 | if ((insn & 0x0fa00030) == 0x06a00010 || |
1207 | (insn & 0x0fb000f0) == 0x06a00030) { | 1304 | (insn & 0x0fb000f0) == 0x06a00030) { |
1305 | if (is_r15(insn, 12)) | ||
1306 | return INSN_REJECTED; /* Rd is PC */ | ||
1208 | insn &= 0xffff0ff0; /* Rd = r0, Rm = r0 */ | 1307 | insn &= 0xffff0ff0; /* Rd = r0, Rm = r0 */ |
1209 | asi->insn[0] = insn; | 1308 | asi->insn[0] = insn; |
1210 | asi->insn_handler = emulate_sat; | 1309 | asi->insn_handler = emulate_sat; |
@@ -1213,57 +1312,101 @@ space_cccc_0110__1(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1213 | 1312 | ||
1214 | /* REV : cccc 0110 1011 xxxx xxxx xxxx 0011 xxxx */ | 1313 | /* REV : cccc 0110 1011 xxxx xxxx xxxx 0011 xxxx */ |
1215 | /* REV16 : cccc 0110 1011 xxxx xxxx xxxx 1011 xxxx */ | 1314 | /* REV16 : cccc 0110 1011 xxxx xxxx xxxx 1011 xxxx */ |
1315 | /* RBIT : cccc 0110 1111 xxxx xxxx xxxx 0011 xxxx */ | ||
1216 | /* REVSH : cccc 0110 1111 xxxx xxxx xxxx 1011 xxxx */ | 1316 | /* REVSH : cccc 0110 1111 xxxx xxxx xxxx 1011 xxxx */ |
1217 | if ((insn & 0x0ff00070) == 0x06b00030 || | 1317 | if ((insn & 0x0ff00070) == 0x06b00030 || |
1218 | (insn & 0x0ff000f0) == 0x06f000b0) | 1318 | (insn & 0x0ff00070) == 0x06f00030) |
1219 | return prep_emulate_rd12rm0(insn, asi); | 1319 | return prep_emulate_rd12rm0(insn, asi); |
1220 | 1320 | ||
1321 | /* ??? : cccc 0110 0000 xxxx xxxx xxxx xxx1 xxxx : */ | ||
1221 | /* SADD16 : cccc 0110 0001 xxxx xxxx xxxx 0001 xxxx :GE */ | 1322 | /* SADD16 : cccc 0110 0001 xxxx xxxx xxxx 0001 xxxx :GE */ |
1222 | /* SADDSUBX : cccc 0110 0001 xxxx xxxx xxxx 0011 xxxx :GE */ | 1323 | /* SADDSUBX : cccc 0110 0001 xxxx xxxx xxxx 0011 xxxx :GE */ |
1223 | /* SSUBADDX : cccc 0110 0001 xxxx xxxx xxxx 0101 xxxx :GE */ | 1324 | /* SSUBADDX : cccc 0110 0001 xxxx xxxx xxxx 0101 xxxx :GE */ |
1224 | /* SSUB16 : cccc 0110 0001 xxxx xxxx xxxx 0111 xxxx :GE */ | 1325 | /* SSUB16 : cccc 0110 0001 xxxx xxxx xxxx 0111 xxxx :GE */ |
1225 | /* SADD8 : cccc 0110 0001 xxxx xxxx xxxx 1001 xxxx :GE */ | 1326 | /* SADD8 : cccc 0110 0001 xxxx xxxx xxxx 1001 xxxx :GE */ |
1327 | /* ??? : cccc 0110 0001 xxxx xxxx xxxx 1011 xxxx : */ | ||
1328 | /* ??? : cccc 0110 0001 xxxx xxxx xxxx 1101 xxxx : */ | ||
1226 | /* SSUB8 : cccc 0110 0001 xxxx xxxx xxxx 1111 xxxx :GE */ | 1329 | /* SSUB8 : cccc 0110 0001 xxxx xxxx xxxx 1111 xxxx :GE */ |
1227 | /* QADD16 : cccc 0110 0010 xxxx xxxx xxxx 0001 xxxx : */ | 1330 | /* QADD16 : cccc 0110 0010 xxxx xxxx xxxx 0001 xxxx : */ |
1228 | /* QADDSUBX : cccc 0110 0010 xxxx xxxx xxxx 0011 xxxx : */ | 1331 | /* QADDSUBX : cccc 0110 0010 xxxx xxxx xxxx 0011 xxxx : */ |
1229 | /* QSUBADDX : cccc 0110 0010 xxxx xxxx xxxx 0101 xxxx : */ | 1332 | /* QSUBADDX : cccc 0110 0010 xxxx xxxx xxxx 0101 xxxx : */ |
1230 | /* QSUB16 : cccc 0110 0010 xxxx xxxx xxxx 0111 xxxx : */ | 1333 | /* QSUB16 : cccc 0110 0010 xxxx xxxx xxxx 0111 xxxx : */ |
1231 | /* QADD8 : cccc 0110 0010 xxxx xxxx xxxx 1001 xxxx : */ | 1334 | /* QADD8 : cccc 0110 0010 xxxx xxxx xxxx 1001 xxxx : */ |
1335 | /* ??? : cccc 0110 0010 xxxx xxxx xxxx 1011 xxxx : */ | ||
1336 | /* ??? : cccc 0110 0010 xxxx xxxx xxxx 1101 xxxx : */ | ||
1232 | /* QSUB8 : cccc 0110 0010 xxxx xxxx xxxx 1111 xxxx : */ | 1337 | /* QSUB8 : cccc 0110 0010 xxxx xxxx xxxx 1111 xxxx : */ |
1233 | /* SHADD16 : cccc 0110 0011 xxxx xxxx xxxx 0001 xxxx : */ | 1338 | /* SHADD16 : cccc 0110 0011 xxxx xxxx xxxx 0001 xxxx : */ |
1234 | /* SHADDSUBX : cccc 0110 0011 xxxx xxxx xxxx 0011 xxxx : */ | 1339 | /* SHADDSUBX : cccc 0110 0011 xxxx xxxx xxxx 0011 xxxx : */ |
1235 | /* SHSUBADDX : cccc 0110 0011 xxxx xxxx xxxx 0101 xxxx : */ | 1340 | /* SHSUBADDX : cccc 0110 0011 xxxx xxxx xxxx 0101 xxxx : */ |
1236 | /* SHSUB16 : cccc 0110 0011 xxxx xxxx xxxx 0111 xxxx : */ | 1341 | /* SHSUB16 : cccc 0110 0011 xxxx xxxx xxxx 0111 xxxx : */ |
1237 | /* SHADD8 : cccc 0110 0011 xxxx xxxx xxxx 1001 xxxx : */ | 1342 | /* SHADD8 : cccc 0110 0011 xxxx xxxx xxxx 1001 xxxx : */ |
1343 | /* ??? : cccc 0110 0011 xxxx xxxx xxxx 1011 xxxx : */ | ||
1344 | /* ??? : cccc 0110 0011 xxxx xxxx xxxx 1101 xxxx : */ | ||
1238 | /* SHSUB8 : cccc 0110 0011 xxxx xxxx xxxx 1111 xxxx : */ | 1345 | /* SHSUB8 : cccc 0110 0011 xxxx xxxx xxxx 1111 xxxx : */ |
1346 | /* ??? : cccc 0110 0100 xxxx xxxx xxxx xxx1 xxxx : */ | ||
1239 | /* UADD16 : cccc 0110 0101 xxxx xxxx xxxx 0001 xxxx :GE */ | 1347 | /* UADD16 : cccc 0110 0101 xxxx xxxx xxxx 0001 xxxx :GE */ |
1240 | /* UADDSUBX : cccc 0110 0101 xxxx xxxx xxxx 0011 xxxx :GE */ | 1348 | /* UADDSUBX : cccc 0110 0101 xxxx xxxx xxxx 0011 xxxx :GE */ |
1241 | /* USUBADDX : cccc 0110 0101 xxxx xxxx xxxx 0101 xxxx :GE */ | 1349 | /* USUBADDX : cccc 0110 0101 xxxx xxxx xxxx 0101 xxxx :GE */ |
1242 | /* USUB16 : cccc 0110 0101 xxxx xxxx xxxx 0111 xxxx :GE */ | 1350 | /* USUB16 : cccc 0110 0101 xxxx xxxx xxxx 0111 xxxx :GE */ |
1243 | /* UADD8 : cccc 0110 0101 xxxx xxxx xxxx 1001 xxxx :GE */ | 1351 | /* UADD8 : cccc 0110 0101 xxxx xxxx xxxx 1001 xxxx :GE */ |
1352 | /* ??? : cccc 0110 0101 xxxx xxxx xxxx 1011 xxxx : */ | ||
1353 | /* ??? : cccc 0110 0101 xxxx xxxx xxxx 1101 xxxx : */ | ||
1244 | /* USUB8 : cccc 0110 0101 xxxx xxxx xxxx 1111 xxxx :GE */ | 1354 | /* USUB8 : cccc 0110 0101 xxxx xxxx xxxx 1111 xxxx :GE */ |
1245 | /* UQADD16 : cccc 0110 0110 xxxx xxxx xxxx 0001 xxxx : */ | 1355 | /* UQADD16 : cccc 0110 0110 xxxx xxxx xxxx 0001 xxxx : */ |
1246 | /* UQADDSUBX : cccc 0110 0110 xxxx xxxx xxxx 0011 xxxx : */ | 1356 | /* UQADDSUBX : cccc 0110 0110 xxxx xxxx xxxx 0011 xxxx : */ |
1247 | /* UQSUBADDX : cccc 0110 0110 xxxx xxxx xxxx 0101 xxxx : */ | 1357 | /* UQSUBADDX : cccc 0110 0110 xxxx xxxx xxxx 0101 xxxx : */ |
1248 | /* UQSUB16 : cccc 0110 0110 xxxx xxxx xxxx 0111 xxxx : */ | 1358 | /* UQSUB16 : cccc 0110 0110 xxxx xxxx xxxx 0111 xxxx : */ |
1249 | /* UQADD8 : cccc 0110 0110 xxxx xxxx xxxx 1001 xxxx : */ | 1359 | /* UQADD8 : cccc 0110 0110 xxxx xxxx xxxx 1001 xxxx : */ |
1360 | /* ??? : cccc 0110 0110 xxxx xxxx xxxx 1011 xxxx : */ | ||
1361 | /* ??? : cccc 0110 0110 xxxx xxxx xxxx 1101 xxxx : */ | ||
1250 | /* UQSUB8 : cccc 0110 0110 xxxx xxxx xxxx 1111 xxxx : */ | 1362 | /* UQSUB8 : cccc 0110 0110 xxxx xxxx xxxx 1111 xxxx : */ |
1251 | /* UHADD16 : cccc 0110 0111 xxxx xxxx xxxx 0001 xxxx : */ | 1363 | /* UHADD16 : cccc 0110 0111 xxxx xxxx xxxx 0001 xxxx : */ |
1252 | /* UHADDSUBX : cccc 0110 0111 xxxx xxxx xxxx 0011 xxxx : */ | 1364 | /* UHADDSUBX : cccc 0110 0111 xxxx xxxx xxxx 0011 xxxx : */ |
1253 | /* UHSUBADDX : cccc 0110 0111 xxxx xxxx xxxx 0101 xxxx : */ | 1365 | /* UHSUBADDX : cccc 0110 0111 xxxx xxxx xxxx 0101 xxxx : */ |
1254 | /* UHSUB16 : cccc 0110 0111 xxxx xxxx xxxx 0111 xxxx : */ | 1366 | /* UHSUB16 : cccc 0110 0111 xxxx xxxx xxxx 0111 xxxx : */ |
1255 | /* UHADD8 : cccc 0110 0111 xxxx xxxx xxxx 1001 xxxx : */ | 1367 | /* UHADD8 : cccc 0110 0111 xxxx xxxx xxxx 1001 xxxx : */ |
1368 | /* ??? : cccc 0110 0111 xxxx xxxx xxxx 1011 xxxx : */ | ||
1369 | /* ??? : cccc 0110 0111 xxxx xxxx xxxx 1101 xxxx : */ | ||
1256 | /* UHSUB8 : cccc 0110 0111 xxxx xxxx xxxx 1111 xxxx : */ | 1370 | /* UHSUB8 : cccc 0110 0111 xxxx xxxx xxxx 1111 xxxx : */ |
1371 | if ((insn & 0x0f800010) == 0x06000010) { | ||
1372 | if ((insn & 0x00300000) == 0x00000000 || | ||
1373 | (insn & 0x000000e0) == 0x000000a0 || | ||
1374 | (insn & 0x000000e0) == 0x000000c0) | ||
1375 | return INSN_REJECTED; /* Unallocated space */ | ||
1376 | return prep_emulate_rd12rn16rm0_wflags(insn, asi); | ||
1377 | } | ||
1378 | |||
1257 | /* PKHBT : cccc 0110 1000 xxxx xxxx xxxx x001 xxxx : */ | 1379 | /* PKHBT : cccc 0110 1000 xxxx xxxx xxxx x001 xxxx : */ |
1258 | /* PKHTB : cccc 0110 1000 xxxx xxxx xxxx x101 xxxx : */ | 1380 | /* PKHTB : cccc 0110 1000 xxxx xxxx xxxx x101 xxxx : */ |
1381 | if ((insn & 0x0ff00030) == 0x06800010) | ||
1382 | return prep_emulate_rd12rn16rm0_wflags(insn, asi); | ||
1383 | |||
1259 | /* SXTAB16 : cccc 0110 1000 xxxx xxxx xxxx 0111 xxxx : */ | 1384 | /* SXTAB16 : cccc 0110 1000 xxxx xxxx xxxx 0111 xxxx : */ |
1260 | /* SXTB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */ | 1385 | /* SXTB16 : cccc 0110 1000 1111 xxxx xxxx 0111 xxxx : */ |
1386 | /* ??? : cccc 0110 1001 xxxx xxxx xxxx 0111 xxxx : */ | ||
1261 | /* SXTAB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */ | 1387 | /* SXTAB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */ |
1388 | /* SXTB : cccc 0110 1010 1111 xxxx xxxx 0111 xxxx : */ | ||
1262 | /* SXTAH : cccc 0110 1011 xxxx xxxx xxxx 0111 xxxx : */ | 1389 | /* SXTAH : cccc 0110 1011 xxxx xxxx xxxx 0111 xxxx : */ |
1390 | /* SXTH : cccc 0110 1011 1111 xxxx xxxx 0111 xxxx : */ | ||
1263 | /* UXTAB16 : cccc 0110 1100 xxxx xxxx xxxx 0111 xxxx : */ | 1391 | /* UXTAB16 : cccc 0110 1100 xxxx xxxx xxxx 0111 xxxx : */ |
1392 | /* UXTB16 : cccc 0110 1100 1111 xxxx xxxx 0111 xxxx : */ | ||
1393 | /* ??? : cccc 0110 1101 xxxx xxxx xxxx 0111 xxxx : */ | ||
1264 | /* UXTAB : cccc 0110 1110 xxxx xxxx xxxx 0111 xxxx : */ | 1394 | /* UXTAB : cccc 0110 1110 xxxx xxxx xxxx 0111 xxxx : */ |
1395 | /* UXTB : cccc 0110 1110 1111 xxxx xxxx 0111 xxxx : */ | ||
1265 | /* UXTAH : cccc 0110 1111 xxxx xxxx xxxx 0111 xxxx : */ | 1396 | /* UXTAH : cccc 0110 1111 xxxx xxxx xxxx 0111 xxxx : */ |
1266 | return prep_emulate_rd12rn16rm0_wflags(insn, asi); | 1397 | /* UXTH : cccc 0110 1111 1111 xxxx xxxx 0111 xxxx : */ |
1398 | if ((insn & 0x0f8000f0) == 0x06800070) { | ||
1399 | if ((insn & 0x00300000) == 0x00100000) | ||
1400 | return INSN_REJECTED; /* Unallocated space */ | ||
1401 | |||
1402 | if ((insn & 0x000f0000) == 0x000f0000) | ||
1403 | return prep_emulate_rd12rm0(insn, asi); | ||
1404 | else | ||
1405 | return prep_emulate_rd12rn16rm0_wflags(insn, asi); | ||
1406 | } | ||
1407 | |||
1408 | /* Other instruction encodings aren't yet defined */ | ||
1409 | return INSN_REJECTED; | ||
1267 | } | 1410 | } |
1268 | 1411 | ||
1269 | static enum kprobe_insn __kprobes | 1412 | static enum kprobe_insn __kprobes |
@@ -1273,29 +1416,49 @@ space_cccc_0111__1(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1273 | if ((insn & 0x0ff000f0) == 0x03f000f0) | 1416 | if ((insn & 0x0ff000f0) == 0x03f000f0) |
1274 | return INSN_REJECTED; | 1417 | return INSN_REJECTED; |
1275 | 1418 | ||
1276 | /* USADA8 : cccc 0111 1000 xxxx xxxx xxxx 0001 xxxx */ | ||
1277 | /* USAD8 : cccc 0111 1000 xxxx 1111 xxxx 0001 xxxx */ | ||
1278 | if ((insn & 0x0ff000f0) == 0x07800010) | ||
1279 | return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi); | ||
1280 | |||
1281 | /* SMLALD : cccc 0111 0100 xxxx xxxx xxxx 00x1 xxxx */ | 1419 | /* SMLALD : cccc 0111 0100 xxxx xxxx xxxx 00x1 xxxx */ |
1282 | /* SMLSLD : cccc 0111 0100 xxxx xxxx xxxx 01x1 xxxx */ | 1420 | /* SMLSLD : cccc 0111 0100 xxxx xxxx xxxx 01x1 xxxx */ |
1283 | if ((insn & 0x0ff00090) == 0x07400010) | 1421 | if ((insn & 0x0ff00090) == 0x07400010) |
1284 | return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi); | 1422 | return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi); |
1285 | 1423 | ||
1286 | /* SMLAD : cccc 0111 0000 xxxx xxxx xxxx 00x1 xxxx :Q */ | 1424 | /* SMLAD : cccc 0111 0000 xxxx xxxx xxxx 00x1 xxxx :Q */ |
1425 | /* SMUAD : cccc 0111 0000 xxxx 1111 xxxx 00x1 xxxx :Q */ | ||
1287 | /* SMLSD : cccc 0111 0000 xxxx xxxx xxxx 01x1 xxxx :Q */ | 1426 | /* SMLSD : cccc 0111 0000 xxxx xxxx xxxx 01x1 xxxx :Q */ |
1427 | /* SMUSD : cccc 0111 0000 xxxx 1111 xxxx 01x1 xxxx : */ | ||
1288 | /* SMMLA : cccc 0111 0101 xxxx xxxx xxxx 00x1 xxxx : */ | 1428 | /* SMMLA : cccc 0111 0101 xxxx xxxx xxxx 00x1 xxxx : */ |
1289 | /* SMMLS : cccc 0111 0101 xxxx xxxx xxxx 11x1 xxxx : */ | 1429 | /* SMMUL : cccc 0111 0101 xxxx 1111 xxxx 00x1 xxxx : */ |
1430 | /* USADA8 : cccc 0111 1000 xxxx xxxx xxxx 0001 xxxx : */ | ||
1431 | /* USAD8 : cccc 0111 1000 xxxx 1111 xxxx 0001 xxxx : */ | ||
1290 | if ((insn & 0x0ff00090) == 0x07000010 || | 1432 | if ((insn & 0x0ff00090) == 0x07000010 || |
1291 | (insn & 0x0ff000d0) == 0x07500010 || | 1433 | (insn & 0x0ff000d0) == 0x07500010 || |
1292 | (insn & 0x0ff000d0) == 0x075000d0) | 1434 | (insn & 0x0ff000f0) == 0x07800010) { |
1435 | |||
1436 | if ((insn & 0x0000f000) == 0x0000f000) | ||
1437 | return prep_emulate_rd16rs8rm0_wflags(insn, asi); | ||
1438 | else | ||
1439 | return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi); | ||
1440 | } | ||
1441 | |||
1442 | /* SMMLS : cccc 0111 0101 xxxx xxxx xxxx 11x1 xxxx : */ | ||
1443 | if ((insn & 0x0ff000d0) == 0x075000d0) | ||
1293 | return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi); | 1444 | return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi); |
1294 | 1445 | ||
1295 | /* SMUSD : cccc 0111 0000 xxxx xxxx xxxx 01x1 xxxx : */ | 1446 | /* SBFX : cccc 0111 101x xxxx xxxx xxxx x101 xxxx : */ |
1296 | /* SMUAD : cccc 0111 0000 xxxx 1111 xxxx 00x1 xxxx :Q */ | 1447 | /* UBFX : cccc 0111 111x xxxx xxxx xxxx x101 xxxx : */ |
1297 | /* SMMUL : cccc 0111 0101 xxxx 1111 xxxx 00x1 xxxx : */ | 1448 | if ((insn & 0x0fa00070) == 0x07a00050) |
1298 | return prep_emulate_rd16rs8rm0_wflags(insn, asi); | 1449 | return prep_emulate_rd12rm0(insn, asi); |
1450 | |||
1451 | /* BFI : cccc 0111 110x xxxx xxxx xxxx x001 xxxx : */ | ||
1452 | /* BFC : cccc 0111 110x xxxx xxxx xxxx x001 1111 : */ | ||
1453 | if ((insn & 0x0fe00070) == 0x07c00010) { | ||
1454 | |||
1455 | if ((insn & 0x0000000f) == 0x0000000f) | ||
1456 | return prep_emulate_rd12_modify(insn, asi); | ||
1457 | else | ||
1458 | return prep_emulate_rd12rn0_modify(insn, asi); | ||
1459 | } | ||
1460 | |||
1461 | return INSN_REJECTED; | ||
1299 | } | 1462 | } |
1300 | 1463 | ||
1301 | static enum kprobe_insn __kprobes | 1464 | static enum kprobe_insn __kprobes |
@@ -1309,6 +1472,10 @@ space_cccc_01xx(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1309 | /* STRB : cccc 01xx x1x0 xxxx xxxx xxxx xxxx xxxx */ | 1472 | /* STRB : cccc 01xx x1x0 xxxx xxxx xxxx xxxx xxxx */ |
1310 | /* STRBT : cccc 01x0 x110 xxxx xxxx xxxx xxxx xxxx */ | 1473 | /* STRBT : cccc 01x0 x110 xxxx xxxx xxxx xxxx xxxx */ |
1311 | /* STRT : cccc 01x0 x010 xxxx xxxx xxxx xxxx xxxx */ | 1474 | /* STRT : cccc 01x0 x010 xxxx xxxx xxxx xxxx xxxx */ |
1475 | |||
1476 | if ((insn & 0x00500000) == 0x00500000 && is_r15(insn, 12)) | ||
1477 | return INSN_REJECTED; /* LDRB into PC */ | ||
1478 | |||
1312 | return prep_emulate_ldr_str(insn, asi); | 1479 | return prep_emulate_ldr_str(insn, asi); |
1313 | } | 1480 | } |
1314 | 1481 | ||
@@ -1323,10 +1490,9 @@ space_cccc_100x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1323 | 1490 | ||
1324 | /* LDM(1) : cccc 100x x0x1 xxxx xxxx xxxx xxxx xxxx */ | 1491 | /* LDM(1) : cccc 100x x0x1 xxxx xxxx xxxx xxxx xxxx */ |
1325 | /* STM(1) : cccc 100x x0x0 xxxx xxxx xxxx xxxx xxxx */ | 1492 | /* STM(1) : cccc 100x x0x0 xxxx xxxx xxxx xxxx xxxx */ |
1326 | asi->insn[0] = truecc_insn(insn); | ||
1327 | asi->insn_handler = ((insn & 0x108000) == 0x008000) ? /* STM & R15 */ | 1493 | asi->insn_handler = ((insn & 0x108000) == 0x008000) ? /* STM & R15 */ |
1328 | simulate_stm1_pc : simulate_ldm1stm1; | 1494 | simulate_stm1_pc : simulate_ldm1stm1; |
1329 | return INSN_GOOD; | 1495 | return INSN_GOOD_NO_SLOT; |
1330 | } | 1496 | } |
1331 | 1497 | ||
1332 | static enum kprobe_insn __kprobes | 1498 | static enum kprobe_insn __kprobes |
@@ -1334,58 +1500,117 @@ space_cccc_101x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1334 | { | 1500 | { |
1335 | /* B : cccc 1010 xxxx xxxx xxxx xxxx xxxx xxxx */ | 1501 | /* B : cccc 1010 xxxx xxxx xxxx xxxx xxxx xxxx */ |
1336 | /* BL : cccc 1011 xxxx xxxx xxxx xxxx xxxx xxxx */ | 1502 | /* BL : cccc 1011 xxxx xxxx xxxx xxxx xxxx xxxx */ |
1337 | asi->insn[0] = truecc_insn(insn); | ||
1338 | asi->insn_handler = simulate_bbl; | 1503 | asi->insn_handler = simulate_bbl; |
1339 | return INSN_GOOD; | 1504 | return INSN_GOOD_NO_SLOT; |
1340 | } | 1505 | } |
1341 | 1506 | ||
1342 | static enum kprobe_insn __kprobes | 1507 | static enum kprobe_insn __kprobes |
1343 | space_cccc_1100_010x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | 1508 | space_cccc_11xx(kprobe_opcode_t insn, struct arch_specific_insn *asi) |
1344 | { | 1509 | { |
1510 | /* Coprocessor instructions... */ | ||
1345 | /* MCRR : cccc 1100 0100 xxxx xxxx xxxx xxxx xxxx : (Rd!=Rn) */ | 1511 | /* MCRR : cccc 1100 0100 xxxx xxxx xxxx xxxx xxxx : (Rd!=Rn) */ |
1346 | /* MRRC : cccc 1100 0101 xxxx xxxx xxxx xxxx xxxx : (Rd!=Rn) */ | 1512 | /* MRRC : cccc 1100 0101 xxxx xxxx xxxx xxxx xxxx : (Rd!=Rn) */ |
1347 | insn &= 0xfff00fff; | 1513 | /* LDC : cccc 110x xxx1 xxxx xxxx xxxx xxxx xxxx */ |
1348 | insn |= 0x00001000; /* Rn = r0, Rd = r1 */ | 1514 | /* STC : cccc 110x xxx0 xxxx xxxx xxxx xxxx xxxx */ |
1349 | asi->insn[0] = insn; | 1515 | /* CDP : cccc 1110 xxxx xxxx xxxx xxxx xxx0 xxxx */ |
1350 | asi->insn_handler = (insn & (1 << 20)) ? emulate_mrrc : emulate_mcrr; | 1516 | /* MCR : cccc 1110 xxx0 xxxx xxxx xxxx xxx1 xxxx */ |
1351 | return INSN_GOOD; | 1517 | /* MRC : cccc 1110 xxx1 xxxx xxxx xxxx xxx1 xxxx */ |
1518 | |||
1519 | /* SVC : cccc 1111 xxxx xxxx xxxx xxxx xxxx xxxx */ | ||
1520 | |||
1521 | return INSN_REJECTED; | ||
1352 | } | 1522 | } |
1353 | 1523 | ||
1354 | static enum kprobe_insn __kprobes | 1524 | static unsigned long __kprobes __check_eq(unsigned long cpsr) |
1355 | space_cccc_110x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | ||
1356 | { | 1525 | { |
1357 | /* LDC : cccc 110x xxx1 xxxx xxxx xxxx xxxx xxxx */ | 1526 | return cpsr & PSR_Z_BIT; |
1358 | /* STC : cccc 110x xxx0 xxxx xxxx xxxx xxxx xxxx */ | ||
1359 | insn &= 0xfff0ffff; /* Rn = r0 */ | ||
1360 | asi->insn[0] = insn; | ||
1361 | asi->insn_handler = emulate_ldcstc; | ||
1362 | return INSN_GOOD; | ||
1363 | } | 1527 | } |
1364 | 1528 | ||
1365 | static enum kprobe_insn __kprobes | 1529 | static unsigned long __kprobes __check_ne(unsigned long cpsr) |
1366 | space_cccc_111x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | ||
1367 | { | 1530 | { |
1368 | /* BKPT : 1110 0001 0010 xxxx xxxx xxxx 0111 xxxx */ | 1531 | return (~cpsr) & PSR_Z_BIT; |
1369 | /* SWI : cccc 1111 xxxx xxxx xxxx xxxx xxxx xxxx */ | 1532 | } |
1370 | if ((insn & 0xfff000f0) == 0xe1200070 || | ||
1371 | (insn & 0x0f000000) == 0x0f000000) | ||
1372 | return INSN_REJECTED; | ||
1373 | 1533 | ||
1374 | /* CDP : cccc 1110 xxxx xxxx xxxx xxxx xxx0 xxxx */ | 1534 | static unsigned long __kprobes __check_cs(unsigned long cpsr) |
1375 | if ((insn & 0x0f000010) == 0x0e000000) { | 1535 | { |
1376 | asi->insn[0] = insn; | 1536 | return cpsr & PSR_C_BIT; |
1377 | asi->insn_handler = emulate_none; | 1537 | } |
1378 | return INSN_GOOD; | ||
1379 | } | ||
1380 | 1538 | ||
1381 | /* MCR : cccc 1110 xxx0 xxxx xxxx xxxx xxx1 xxxx */ | 1539 | static unsigned long __kprobes __check_cc(unsigned long cpsr) |
1382 | /* MRC : cccc 1110 xxx1 xxxx xxxx xxxx xxx1 xxxx */ | 1540 | { |
1383 | insn &= 0xffff0fff; /* Rd = r0 */ | 1541 | return (~cpsr) & PSR_C_BIT; |
1384 | asi->insn[0] = insn; | 1542 | } |
1385 | asi->insn_handler = (insn & (1 << 20)) ? emulate_rd12 : emulate_ird12; | 1543 | |
1386 | return INSN_GOOD; | 1544 | static unsigned long __kprobes __check_mi(unsigned long cpsr) |
1545 | { | ||
1546 | return cpsr & PSR_N_BIT; | ||
1547 | } | ||
1548 | |||
1549 | static unsigned long __kprobes __check_pl(unsigned long cpsr) | ||
1550 | { | ||
1551 | return (~cpsr) & PSR_N_BIT; | ||
1552 | } | ||
1553 | |||
1554 | static unsigned long __kprobes __check_vs(unsigned long cpsr) | ||
1555 | { | ||
1556 | return cpsr & PSR_V_BIT; | ||
1557 | } | ||
1558 | |||
1559 | static unsigned long __kprobes __check_vc(unsigned long cpsr) | ||
1560 | { | ||
1561 | return (~cpsr) & PSR_V_BIT; | ||
1562 | } | ||
1563 | |||
1564 | static unsigned long __kprobes __check_hi(unsigned long cpsr) | ||
1565 | { | ||
1566 | cpsr &= ~(cpsr >> 1); /* PSR_C_BIT &= ~PSR_Z_BIT */ | ||
1567 | return cpsr & PSR_C_BIT; | ||
1387 | } | 1568 | } |
1388 | 1569 | ||
1570 | static unsigned long __kprobes __check_ls(unsigned long cpsr) | ||
1571 | { | ||
1572 | cpsr &= ~(cpsr >> 1); /* PSR_C_BIT &= ~PSR_Z_BIT */ | ||
1573 | return (~cpsr) & PSR_C_BIT; | ||
1574 | } | ||
1575 | |||
1576 | static unsigned long __kprobes __check_ge(unsigned long cpsr) | ||
1577 | { | ||
1578 | cpsr ^= (cpsr << 3); /* PSR_N_BIT ^= PSR_V_BIT */ | ||
1579 | return (~cpsr) & PSR_N_BIT; | ||
1580 | } | ||
1581 | |||
1582 | static unsigned long __kprobes __check_lt(unsigned long cpsr) | ||
1583 | { | ||
1584 | cpsr ^= (cpsr << 3); /* PSR_N_BIT ^= PSR_V_BIT */ | ||
1585 | return cpsr & PSR_N_BIT; | ||
1586 | } | ||
1587 | |||
1588 | static unsigned long __kprobes __check_gt(unsigned long cpsr) | ||
1589 | { | ||
1590 | unsigned long temp = cpsr ^ (cpsr << 3); /* PSR_N_BIT ^= PSR_V_BIT */ | ||
1591 | temp |= (cpsr << 1); /* PSR_N_BIT |= PSR_Z_BIT */ | ||
1592 | return (~temp) & PSR_N_BIT; | ||
1593 | } | ||
1594 | |||
1595 | static unsigned long __kprobes __check_le(unsigned long cpsr) | ||
1596 | { | ||
1597 | unsigned long temp = cpsr ^ (cpsr << 3); /* PSR_N_BIT ^= PSR_V_BIT */ | ||
1598 | temp |= (cpsr << 1); /* PSR_N_BIT |= PSR_Z_BIT */ | ||
1599 | return temp & PSR_N_BIT; | ||
1600 | } | ||
1601 | |||
1602 | static unsigned long __kprobes __check_al(unsigned long cpsr) | ||
1603 | { | ||
1604 | return true; | ||
1605 | } | ||
1606 | |||
1607 | static kprobe_check_cc * const condition_checks[16] = { | ||
1608 | &__check_eq, &__check_ne, &__check_cs, &__check_cc, | ||
1609 | &__check_mi, &__check_pl, &__check_vs, &__check_vc, | ||
1610 | &__check_hi, &__check_ls, &__check_ge, &__check_lt, | ||
1611 | &__check_gt, &__check_le, &__check_al, &__check_al | ||
1612 | }; | ||
1613 | |||
1389 | /* Return: | 1614 | /* Return: |
1390 | * INSN_REJECTED If instruction is one not allowed to kprobe, | 1615 | * INSN_REJECTED If instruction is one not allowed to kprobe, |
1391 | * INSN_GOOD If instruction is supported and uses instruction slot, | 1616 | * INSN_GOOD If instruction is supported and uses instruction slot, |
@@ -1401,133 +1626,45 @@ space_cccc_111x(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1401 | enum kprobe_insn __kprobes | 1626 | enum kprobe_insn __kprobes |
1402 | arm_kprobe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi) | 1627 | arm_kprobe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi) |
1403 | { | 1628 | { |
1629 | asi->insn_check_cc = condition_checks[insn>>28]; | ||
1404 | asi->insn[1] = KPROBE_RETURN_INSTRUCTION; | 1630 | asi->insn[1] = KPROBE_RETURN_INSTRUCTION; |
1405 | 1631 | ||
1406 | if ((insn & 0xf0000000) == 0xf0000000) { | 1632 | if ((insn & 0xf0000000) == 0xf0000000) |
1407 | 1633 | ||
1408 | return space_1111(insn, asi); | 1634 | return space_1111(insn, asi); |
1409 | 1635 | ||
1410 | } else if ((insn & 0x0e000000) == 0x00000000) { | 1636 | else if ((insn & 0x0e000000) == 0x00000000) |
1411 | 1637 | ||
1412 | return space_cccc_000x(insn, asi); | 1638 | return space_cccc_000x(insn, asi); |
1413 | 1639 | ||
1414 | } else if ((insn & 0x0e000000) == 0x02000000) { | 1640 | else if ((insn & 0x0e000000) == 0x02000000) |
1415 | 1641 | ||
1416 | return space_cccc_001x(insn, asi); | 1642 | return space_cccc_001x(insn, asi); |
1417 | 1643 | ||
1418 | } else if ((insn & 0x0f000010) == 0x06000010) { | 1644 | else if ((insn & 0x0f000010) == 0x06000010) |
1419 | 1645 | ||
1420 | return space_cccc_0110__1(insn, asi); | 1646 | return space_cccc_0110__1(insn, asi); |
1421 | 1647 | ||
1422 | } else if ((insn & 0x0f000010) == 0x07000010) { | 1648 | else if ((insn & 0x0f000010) == 0x07000010) |
1423 | 1649 | ||
1424 | return space_cccc_0111__1(insn, asi); | 1650 | return space_cccc_0111__1(insn, asi); |
1425 | 1651 | ||
1426 | } else if ((insn & 0x0c000000) == 0x04000000) { | 1652 | else if ((insn & 0x0c000000) == 0x04000000) |
1427 | 1653 | ||
1428 | return space_cccc_01xx(insn, asi); | 1654 | return space_cccc_01xx(insn, asi); |
1429 | 1655 | ||
1430 | } else if ((insn & 0x0e000000) == 0x08000000) { | 1656 | else if ((insn & 0x0e000000) == 0x08000000) |
1431 | 1657 | ||
1432 | return space_cccc_100x(insn, asi); | 1658 | return space_cccc_100x(insn, asi); |
1433 | 1659 | ||
1434 | } else if ((insn & 0x0e000000) == 0x0a000000) { | 1660 | else if ((insn & 0x0e000000) == 0x0a000000) |
1435 | 1661 | ||
1436 | return space_cccc_101x(insn, asi); | 1662 | return space_cccc_101x(insn, asi); |
1437 | 1663 | ||
1438 | } else if ((insn & 0x0fe00000) == 0x0c400000) { | 1664 | return space_cccc_11xx(insn, asi); |
1439 | |||
1440 | return space_cccc_1100_010x(insn, asi); | ||
1441 | |||
1442 | } else if ((insn & 0x0e000000) == 0x0c000000) { | ||
1443 | |||
1444 | return space_cccc_110x(insn, asi); | ||
1445 | |||
1446 | } | ||
1447 | |||
1448 | return space_cccc_111x(insn, asi); | ||
1449 | } | 1665 | } |
1450 | 1666 | ||
1451 | void __init arm_kprobe_decode_init(void) | 1667 | void __init arm_kprobe_decode_init(void) |
1452 | { | 1668 | { |
1453 | find_str_pc_offset(); | 1669 | find_str_pc_offset(); |
1454 | } | 1670 | } |
1455 | |||
1456 | |||
1457 | /* | ||
1458 | * All ARM instructions listed below. | ||
1459 | * | ||
1460 | * Instructions and their general purpose registers are given. | ||
1461 | * If a particular register may not use R15, it is prefixed with a "!". | ||
1462 | * If marked with a "*" means the value returned by reading R15 | ||
1463 | * is implementation defined. | ||
1464 | * | ||
1465 | * ADC/ADD/AND/BIC/CMN/CMP/EOR/MOV/MVN/ORR/RSB/RSC/SBC/SUB/TEQ | ||
1466 | * TST: Rd, Rn, Rm, !Rs | ||
1467 | * BX: Rm | ||
1468 | * BLX(2): !Rm | ||
1469 | * BX: Rm (R15 legal, but discouraged) | ||
1470 | * BXJ: !Rm, | ||
1471 | * CLZ: !Rd, !Rm | ||
1472 | * CPY: Rd, Rm | ||
1473 | * LDC/2,STC/2 immediate offset & unindex: Rn | ||
1474 | * LDC/2,STC/2 immediate pre/post-indexed: !Rn | ||
1475 | * LDM(1/3): !Rn, register_list | ||
1476 | * LDM(2): !Rn, !register_list | ||
1477 | * LDR,STR,PLD immediate offset: Rd, Rn | ||
1478 | * LDR,STR,PLD register offset: Rd, Rn, !Rm | ||
1479 | * LDR,STR,PLD scaled register offset: Rd, !Rn, !Rm | ||
1480 | * LDR,STR immediate pre/post-indexed: Rd, !Rn | ||
1481 | * LDR,STR register pre/post-indexed: Rd, !Rn, !Rm | ||
1482 | * LDR,STR scaled register pre/post-indexed: Rd, !Rn, !Rm | ||
1483 | * LDRB,STRB immediate offset: !Rd, Rn | ||
1484 | * LDRB,STRB register offset: !Rd, Rn, !Rm | ||
1485 | * LDRB,STRB scaled register offset: !Rd, !Rn, !Rm | ||
1486 | * LDRB,STRB immediate pre/post-indexed: !Rd, !Rn | ||
1487 | * LDRB,STRB register pre/post-indexed: !Rd, !Rn, !Rm | ||
1488 | * LDRB,STRB scaled register pre/post-indexed: !Rd, !Rn, !Rm | ||
1489 | * LDRT,LDRBT,STRBT immediate pre/post-indexed: !Rd, !Rn | ||
1490 | * LDRT,LDRBT,STRBT register pre/post-indexed: !Rd, !Rn, !Rm | ||
1491 | * LDRT,LDRBT,STRBT scaled register pre/post-indexed: !Rd, !Rn, !Rm | ||
1492 | * LDRH/SH/SB/D,STRH/SH/SB/D immediate offset: !Rd, Rn | ||
1493 | * LDRH/SH/SB/D,STRH/SH/SB/D register offset: !Rd, Rn, !Rm | ||
1494 | * LDRH/SH/SB/D,STRH/SH/SB/D immediate pre/post-indexed: !Rd, !Rn | ||
1495 | * LDRH/SH/SB/D,STRH/SH/SB/D register pre/post-indexed: !Rd, !Rn, !Rm | ||
1496 | * LDREX: !Rd, !Rn | ||
1497 | * MCR/2: !Rd | ||
1498 | * MCRR/2,MRRC/2: !Rd, !Rn | ||
1499 | * MLA: !Rd, !Rn, !Rm, !Rs | ||
1500 | * MOV: Rd | ||
1501 | * MRC/2: !Rd (if Rd==15, only changes cond codes, not the register) | ||
1502 | * MRS,MSR: !Rd | ||
1503 | * MUL: !Rd, !Rm, !Rs | ||
1504 | * PKH{BT,TB}: !Rd, !Rn, !Rm | ||
1505 | * QDADD,[U]QADD/16/8/SUBX: !Rd, !Rm, !Rn | ||
1506 | * QDSUB,[U]QSUB/16/8/ADDX: !Rd, !Rm, !Rn | ||
1507 | * REV/16/SH: !Rd, !Rm | ||
1508 | * RFE: !Rn | ||
1509 | * {S,U}[H]ADD{16,8,SUBX},{S,U}[H]SUB{16,8,ADDX}: !Rd, !Rn, !Rm | ||
1510 | * SEL: !Rd, !Rn, !Rm | ||
1511 | * SMLA<x><y>,SMLA{D,W<y>},SMLSD,SMML{A,S}: !Rd, !Rn, !Rm, !Rs | ||
1512 | * SMLAL<x><y>,SMLA{D,LD},SMLSLD,SMMULL,SMULW<y>: !RdHi, !RdLo, !Rm, !Rs | ||
1513 | * SMMUL,SMUAD,SMUL<x><y>,SMUSD: !Rd, !Rm, !Rs | ||
1514 | * SSAT/16: !Rd, !Rm | ||
1515 | * STM(1/2): !Rn, register_list* (R15 in reg list not recommended) | ||
1516 | * STRT immediate pre/post-indexed: Rd*, !Rn | ||
1517 | * STRT register pre/post-indexed: Rd*, !Rn, !Rm | ||
1518 | * STRT scaled register pre/post-indexed: Rd*, !Rn, !Rm | ||
1519 | * STREX: !Rd, !Rn, !Rm | ||
1520 | * SWP/B: !Rd, !Rn, !Rm | ||
1521 | * {S,U}XTA{B,B16,H}: !Rd, !Rn, !Rm | ||
1522 | * {S,U}XT{B,B16,H}: !Rd, !Rm | ||
1523 | * UM{AA,LA,UL}L: !RdHi, !RdLo, !Rm, !Rs | ||
1524 | * USA{D8,A8,T,T16}: !Rd, !Rm, !Rs | ||
1525 | * | ||
1526 | * May transfer control by writing R15 (possible mode changes or alternate | ||
1527 | * mode accesses marked by "*"): | ||
1528 | * ALU op (* with s-bit), B, BL, BKPT, BLX(1/2), BX, BXJ, CPS*, CPY, | ||
1529 | * LDM(1), LDM(2/3)*, LDR, MOV, RFE*, SWI* | ||
1530 | * | ||
1531 | * Instructions that do not take general registers, nor transfer control: | ||
1532 | * CDP/2, SETEND, SRS* | ||
1533 | */ | ||
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c index 2ba7deb3072e..1656c87501c0 100644 --- a/arch/arm/kernel/kprobes.c +++ b/arch/arm/kernel/kprobes.c | |||
@@ -134,7 +134,8 @@ static void __kprobes singlestep(struct kprobe *p, struct pt_regs *regs, | |||
134 | struct kprobe_ctlblk *kcb) | 134 | struct kprobe_ctlblk *kcb) |
135 | { | 135 | { |
136 | regs->ARM_pc += 4; | 136 | regs->ARM_pc += 4; |
137 | p->ainsn.insn_handler(p, regs); | 137 | if (p->ainsn.insn_check_cc(regs->ARM_cpsr)) |
138 | p->ainsn.insn_handler(p, regs); | ||
138 | } | 139 | } |
139 | 140 | ||
140 | /* | 141 | /* |
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index 69cfee0fe00f..139e3c827369 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c | |||
@@ -221,7 +221,7 @@ again: | |||
221 | prev_raw_count &= armpmu->max_period; | 221 | prev_raw_count &= armpmu->max_period; |
222 | 222 | ||
223 | if (overflow) | 223 | if (overflow) |
224 | delta = armpmu->max_period - prev_raw_count + new_raw_count; | 224 | delta = armpmu->max_period - prev_raw_count + new_raw_count + 1; |
225 | else | 225 | else |
226 | delta = new_raw_count - prev_raw_count; | 226 | delta = new_raw_count - prev_raw_count; |
227 | 227 | ||
@@ -746,7 +746,8 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs) | |||
746 | 746 | ||
747 | tail = (struct frame_tail __user *)regs->ARM_fp - 1; | 747 | tail = (struct frame_tail __user *)regs->ARM_fp - 1; |
748 | 748 | ||
749 | while (tail && !((unsigned long)tail & 0x3)) | 749 | while ((entry->nr < PERF_MAX_STACK_DEPTH) && |
750 | tail && !((unsigned long)tail & 0x3)) | ||
750 | tail = user_backtrace(tail, entry); | 751 | tail = user_backtrace(tail, entry); |
751 | } | 752 | } |
752 | 753 | ||
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 94bbedbed639..5e1e54197227 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -372,6 +372,8 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start, | |||
372 | if (clone_flags & CLONE_SETTLS) | 372 | if (clone_flags & CLONE_SETTLS) |
373 | thread->tp_value = regs->ARM_r3; | 373 | thread->tp_value = regs->ARM_r3; |
374 | 374 | ||
375 | thread_notify(THREAD_NOTIFY_COPY, thread); | ||
376 | |||
375 | return 0; | 377 | return 0; |
376 | } | 378 | } |
377 | 379 | ||
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 8fe05ad932e4..f29b8a29b174 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -479,7 +479,7 @@ static void broadcast_timer_set_mode(enum clock_event_mode mode, | |||
479 | { | 479 | { |
480 | } | 480 | } |
481 | 481 | ||
482 | static void broadcast_timer_setup(struct clock_event_device *evt) | 482 | static void __cpuinit broadcast_timer_setup(struct clock_event_device *evt) |
483 | { | 483 | { |
484 | evt->name = "dummy_timer"; | 484 | evt->name = "dummy_timer"; |
485 | evt->features = CLOCK_EVT_FEAT_ONESHOT | | 485 | evt->features = CLOCK_EVT_FEAT_ONESHOT | |
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c index 4ad8da15ef2b..af0aaebf4de6 100644 --- a/arch/arm/kernel/sys_oabi-compat.c +++ b/arch/arm/kernel/sys_oabi-compat.c | |||
@@ -311,7 +311,7 @@ asmlinkage long sys_oabi_semtimedop(int semid, | |||
311 | long err; | 311 | long err; |
312 | int i; | 312 | int i; |
313 | 313 | ||
314 | if (nsops < 1) | 314 | if (nsops < 1 || nsops > SEMOPM) |
315 | return -EINVAL; | 315 | return -EINVAL; |
316 | sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL); | 316 | sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL); |
317 | if (!sops) | 317 | if (!sops) |
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index f0000e188c8c..3b54ad19d489 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -410,8 +410,7 @@ static int bad_syscall(int n, struct pt_regs *regs) | |||
410 | struct thread_info *thread = current_thread_info(); | 410 | struct thread_info *thread = current_thread_info(); |
411 | siginfo_t info; | 411 | siginfo_t info; |
412 | 412 | ||
413 | if (current->personality != PER_LINUX && | 413 | if ((current->personality & PER_MASK) != PER_LINUX && |
414 | current->personality != PER_LINUX_32BIT && | ||
415 | thread->exec_domain->handler) { | 414 | thread->exec_domain->handler) { |
416 | thread->exec_domain->handler(n, regs); | 415 | thread->exec_domain->handler(n, regs); |
417 | return regs->ARM_r0; | 416 | return regs->ARM_r0; |
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig index 32f147998cd9..c0deacae778d 100644 --- a/arch/arm/mach-davinci/Kconfig +++ b/arch/arm/mach-davinci/Kconfig | |||
@@ -63,6 +63,7 @@ config MACH_DAVINCI_EVM | |||
63 | depends on ARCH_DAVINCI_DM644x | 63 | depends on ARCH_DAVINCI_DM644x |
64 | select MISC_DEVICES | 64 | select MISC_DEVICES |
65 | select EEPROM_AT24 | 65 | select EEPROM_AT24 |
66 | select I2C | ||
66 | help | 67 | help |
67 | Configure this option to specify the whether the board used | 68 | Configure this option to specify the whether the board used |
68 | for development is a DM644x EVM | 69 | for development is a DM644x EVM |
@@ -72,6 +73,7 @@ config MACH_SFFSDR | |||
72 | depends on ARCH_DAVINCI_DM644x | 73 | depends on ARCH_DAVINCI_DM644x |
73 | select MISC_DEVICES | 74 | select MISC_DEVICES |
74 | select EEPROM_AT24 | 75 | select EEPROM_AT24 |
76 | select I2C | ||
75 | help | 77 | help |
76 | Say Y here to select the Lyrtech Small Form Factor | 78 | Say Y here to select the Lyrtech Small Form Factor |
77 | Software Defined Radio (SFFSDR) board. | 79 | Software Defined Radio (SFFSDR) board. |
@@ -105,6 +107,7 @@ config MACH_DAVINCI_DM6467_EVM | |||
105 | select MACH_DAVINCI_DM6467TEVM | 107 | select MACH_DAVINCI_DM6467TEVM |
106 | select MISC_DEVICES | 108 | select MISC_DEVICES |
107 | select EEPROM_AT24 | 109 | select EEPROM_AT24 |
110 | select I2C | ||
108 | help | 111 | help |
109 | Configure this option to specify the whether the board used | 112 | Configure this option to specify the whether the board used |
110 | for development is a DM6467 EVM | 113 | for development is a DM6467 EVM |
@@ -118,6 +121,7 @@ config MACH_DAVINCI_DM365_EVM | |||
118 | depends on ARCH_DAVINCI_DM365 | 121 | depends on ARCH_DAVINCI_DM365 |
119 | select MISC_DEVICES | 122 | select MISC_DEVICES |
120 | select EEPROM_AT24 | 123 | select EEPROM_AT24 |
124 | select I2C | ||
121 | help | 125 | help |
122 | Configure this option to specify whether the board used | 126 | Configure this option to specify whether the board used |
123 | for development is a DM365 EVM | 127 | for development is a DM365 EVM |
@@ -129,6 +133,7 @@ config MACH_DAVINCI_DA830_EVM | |||
129 | select GPIO_PCF857X | 133 | select GPIO_PCF857X |
130 | select MISC_DEVICES | 134 | select MISC_DEVICES |
131 | select EEPROM_AT24 | 135 | select EEPROM_AT24 |
136 | select I2C | ||
132 | help | 137 | help |
133 | Say Y here to select the TI DA830/OMAP-L137/AM17x Evaluation Module. | 138 | Say Y here to select the TI DA830/OMAP-L137/AM17x Evaluation Module. |
134 | 139 | ||
@@ -205,6 +210,7 @@ config MACH_MITYOMAPL138 | |||
205 | depends on ARCH_DAVINCI_DA850 | 210 | depends on ARCH_DAVINCI_DA850 |
206 | select MISC_DEVICES | 211 | select MISC_DEVICES |
207 | select EEPROM_AT24 | 212 | select EEPROM_AT24 |
213 | select I2C | ||
208 | help | 214 | help |
209 | Say Y here to select the Critical Link MityDSP-L138/MityARM-1808 | 215 | Say Y here to select the Critical Link MityDSP-L138/MityARM-1808 |
210 | System on Module. Information on this SoM may be found at | 216 | System on Module. Information on this SoM may be found at |
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c index 2aa79c54f98e..606a6f27ed6c 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <mach/mux.h> | 29 | #include <mach/mux.h> |
30 | #include <mach/spi.h> | 30 | #include <mach/spi.h> |
31 | 31 | ||
32 | #define MITYOMAPL138_PHY_ID "0:03" | 32 | #define MITYOMAPL138_PHY_ID "" |
33 | 33 | ||
34 | #define FACTORY_CONFIG_MAGIC 0x012C0138 | 34 | #define FACTORY_CONFIG_MAGIC 0x012C0138 |
35 | #define FACTORY_CONFIG_VERSION 0x00010001 | 35 | #define FACTORY_CONFIG_VERSION 0x00010001 |
@@ -414,7 +414,7 @@ static struct resource mityomapl138_nandflash_resource[] = { | |||
414 | 414 | ||
415 | static struct platform_device mityomapl138_nandflash_device = { | 415 | static struct platform_device mityomapl138_nandflash_device = { |
416 | .name = "davinci_nand", | 416 | .name = "davinci_nand", |
417 | .id = 0, | 417 | .id = 1, |
418 | .dev = { | 418 | .dev = { |
419 | .platform_data = &mityomapl138_nandflash_data, | 419 | .platform_data = &mityomapl138_nandflash_data, |
420 | }, | 420 | }, |
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index 625d4b66718b..58a02dc7b15a 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c | |||
@@ -39,7 +39,8 @@ | |||
39 | #define DA8XX_GPIO_BASE 0x01e26000 | 39 | #define DA8XX_GPIO_BASE 0x01e26000 |
40 | #define DA8XX_I2C1_BASE 0x01e28000 | 40 | #define DA8XX_I2C1_BASE 0x01e28000 |
41 | #define DA8XX_SPI0_BASE 0x01c41000 | 41 | #define DA8XX_SPI0_BASE 0x01c41000 |
42 | #define DA8XX_SPI1_BASE 0x01f0e000 | 42 | #define DA830_SPI1_BASE 0x01e12000 |
43 | #define DA850_SPI1_BASE 0x01f0e000 | ||
43 | 44 | ||
44 | #define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000 | 45 | #define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000 |
45 | #define DA8XX_EMAC_MOD_REG_OFFSET 0x2000 | 46 | #define DA8XX_EMAC_MOD_REG_OFFSET 0x2000 |
@@ -762,8 +763,8 @@ static struct resource da8xx_spi0_resources[] = { | |||
762 | 763 | ||
763 | static struct resource da8xx_spi1_resources[] = { | 764 | static struct resource da8xx_spi1_resources[] = { |
764 | [0] = { | 765 | [0] = { |
765 | .start = DA8XX_SPI1_BASE, | 766 | .start = DA830_SPI1_BASE, |
766 | .end = DA8XX_SPI1_BASE + SZ_4K - 1, | 767 | .end = DA830_SPI1_BASE + SZ_4K - 1, |
767 | .flags = IORESOURCE_MEM, | 768 | .flags = IORESOURCE_MEM, |
768 | }, | 769 | }, |
769 | [1] = { | 770 | [1] = { |
@@ -832,5 +833,10 @@ int __init da8xx_register_spi(int instance, struct spi_board_info *info, | |||
832 | 833 | ||
833 | da8xx_spi_pdata[instance].num_chipselect = len; | 834 | da8xx_spi_pdata[instance].num_chipselect = len; |
834 | 835 | ||
836 | if (instance == 1 && cpu_is_davinci_da850()) { | ||
837 | da8xx_spi1_resources[0].start = DA850_SPI1_BASE; | ||
838 | da8xx_spi1_resources[0].end = DA850_SPI1_BASE + SZ_4K - 1; | ||
839 | } | ||
840 | |||
835 | return platform_device_register(&da8xx_spi_device[instance]); | 841 | return platform_device_register(&da8xx_spi_device[instance]); |
836 | } | 842 | } |
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index f68012239641..a3a94e9c9378 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c | |||
@@ -314,7 +314,7 @@ static struct clk timer2_clk = { | |||
314 | .name = "timer2", | 314 | .name = "timer2", |
315 | .parent = &pll1_aux_clk, | 315 | .parent = &pll1_aux_clk, |
316 | .lpsc = DAVINCI_LPSC_TIMER2, | 316 | .lpsc = DAVINCI_LPSC_TIMER2, |
317 | .usecount = 1, /* REVISIT: why can't' this be disabled? */ | 317 | .usecount = 1, /* REVISIT: why can't this be disabled? */ |
318 | }; | 318 | }; |
319 | 319 | ||
320 | static struct clk timer3_clk = { | 320 | static struct clk timer3_clk = { |
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index 5f8a65424184..4c82c2716293 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c | |||
@@ -274,7 +274,7 @@ static struct clk timer2_clk = { | |||
274 | .name = "timer2", | 274 | .name = "timer2", |
275 | .parent = &pll1_aux_clk, | 275 | .parent = &pll1_aux_clk, |
276 | .lpsc = DAVINCI_LPSC_TIMER2, | 276 | .lpsc = DAVINCI_LPSC_TIMER2, |
277 | .usecount = 1, /* REVISIT: why can't' this be disabled? */ | 277 | .usecount = 1, /* REVISIT: why can't this be disabled? */ |
278 | }; | 278 | }; |
279 | 279 | ||
280 | static struct clk_lookup dm644x_clks[] = { | 280 | static struct clk_lookup dm644x_clks[] = { |
diff --git a/arch/arm/mach-davinci/include/mach/debug-macro.S b/arch/arm/mach-davinci/include/mach/debug-macro.S index 9f1befc5ac38..f8b7ea4f6235 100644 --- a/arch/arm/mach-davinci/include/mach/debug-macro.S +++ b/arch/arm/mach-davinci/include/mach/debug-macro.S | |||
@@ -24,6 +24,9 @@ | |||
24 | 24 | ||
25 | #define UART_SHIFT 2 | 25 | #define UART_SHIFT 2 |
26 | 26 | ||
27 | #define davinci_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET) | ||
28 | #define davinci_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET) | ||
29 | |||
27 | .pushsection .data | 30 | .pushsection .data |
28 | davinci_uart_phys: .word 0 | 31 | davinci_uart_phys: .word 0 |
29 | davinci_uart_virt: .word 0 | 32 | davinci_uart_virt: .word 0 |
@@ -34,7 +37,7 @@ davinci_uart_virt: .word 0 | |||
34 | /* Use davinci_uart_phys/virt if already configured */ | 37 | /* Use davinci_uart_phys/virt if already configured */ |
35 | 10: mrc p15, 0, \rp, c1, c0 | 38 | 10: mrc p15, 0, \rp, c1, c0 |
36 | tst \rp, #1 @ MMU enabled? | 39 | tst \rp, #1 @ MMU enabled? |
37 | ldreq \rp, =__virt_to_phys(davinci_uart_phys) | 40 | ldreq \rp, =davinci_uart_v2p(davinci_uart_phys) |
38 | ldrne \rp, =davinci_uart_phys | 41 | ldrne \rp, =davinci_uart_phys |
39 | add \rv, \rp, #4 @ davinci_uart_virt | 42 | add \rv, \rp, #4 @ davinci_uart_virt |
40 | ldr \rp, [\rp, #0] | 43 | ldr \rp, [\rp, #0] |
@@ -48,18 +51,18 @@ davinci_uart_virt: .word 0 | |||
48 | tst \rp, #1 @ MMU enabled? | 51 | tst \rp, #1 @ MMU enabled? |
49 | 52 | ||
50 | /* Copy uart phys address from decompressor uart info */ | 53 | /* Copy uart phys address from decompressor uart info */ |
51 | ldreq \rv, =__virt_to_phys(davinci_uart_phys) | 54 | ldreq \rv, =davinci_uart_v2p(davinci_uart_phys) |
52 | ldrne \rv, =davinci_uart_phys | 55 | ldrne \rv, =davinci_uart_phys |
53 | ldreq \rp, =DAVINCI_UART_INFO | 56 | ldreq \rp, =DAVINCI_UART_INFO |
54 | ldrne \rp, =__phys_to_virt(DAVINCI_UART_INFO) | 57 | ldrne \rp, =davinci_uart_p2v(DAVINCI_UART_INFO) |
55 | ldr \rp, [\rp, #0] | 58 | ldr \rp, [\rp, #0] |
56 | str \rp, [\rv] | 59 | str \rp, [\rv] |
57 | 60 | ||
58 | /* Copy uart virt address from decompressor uart info */ | 61 | /* Copy uart virt address from decompressor uart info */ |
59 | ldreq \rv, =__virt_to_phys(davinci_uart_virt) | 62 | ldreq \rv, =davinci_uart_v2p(davinci_uart_virt) |
60 | ldrne \rv, =davinci_uart_virt | 63 | ldrne \rv, =davinci_uart_virt |
61 | ldreq \rp, =DAVINCI_UART_INFO | 64 | ldreq \rp, =DAVINCI_UART_INFO |
62 | ldrne \rp, =__phys_to_virt(DAVINCI_UART_INFO) | 65 | ldrne \rp, =davinci_uart_p2v(DAVINCI_UART_INFO) |
63 | ldr \rp, [\rp, #4] | 66 | ldr \rp, [\rp, #4] |
64 | str \rp, [\rv] | 67 | str \rp, [\rv] |
65 | 68 | ||
diff --git a/arch/arm/mach-davinci/include/mach/serial.h b/arch/arm/mach-davinci/include/mach/serial.h index 8051110b8ac3..c9e6ce185a66 100644 --- a/arch/arm/mach-davinci/include/mach/serial.h +++ b/arch/arm/mach-davinci/include/mach/serial.h | |||
@@ -22,7 +22,7 @@ | |||
22 | * | 22 | * |
23 | * This area sits just below the page tables (see arch/arm/kernel/head.S). | 23 | * This area sits just below the page tables (see arch/arm/kernel/head.S). |
24 | */ | 24 | */ |
25 | #define DAVINCI_UART_INFO (PHYS_OFFSET + 0x3ff8) | 25 | #define DAVINCI_UART_INFO (PLAT_PHYS_OFFSET + 0x3ff8) |
26 | 26 | ||
27 | #define DAVINCI_UART0_BASE (IO_PHYS + 0x20000) | 27 | #define DAVINCI_UART0_BASE (IO_PHYS + 0x20000) |
28 | #define DAVINCI_UART1_BASE (IO_PHYS + 0x20400) | 28 | #define DAVINCI_UART1_BASE (IO_PHYS + 0x20400) |
diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h index ee8b02ed8011..7bfb827f3fe3 100644 --- a/arch/arm/mach-mmp/include/mach/gpio.h +++ b/arch/arm/mach-mmp/include/mach/gpio.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) | 10 | #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) |
11 | #define GPIO_REG(x) (*((volatile u32 *)(GPIO_REGS_VIRT + (x)))) | 11 | #define GPIO_REG(x) (*((volatile u32 *)(GPIO_REGS_VIRT + (x)))) |
12 | 12 | ||
13 | #define NR_BUILTIN_GPIO (192) | 13 | #define NR_BUILTIN_GPIO IRQ_GPIO_NUM |
14 | 14 | ||
15 | #define gpio_to_bank(gpio) ((gpio) >> 5) | 15 | #define gpio_to_bank(gpio) ((gpio) >> 5) |
16 | #define gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio)) | 16 | #define gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio)) |
diff --git a/arch/arm/mach-mmp/include/mach/mfp-pxa168.h b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h index 4621067c7720..713be155a44d 100644 --- a/arch/arm/mach-mmp/include/mach/mfp-pxa168.h +++ b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h | |||
@@ -8,6 +8,15 @@ | |||
8 | #define MFP_DRIVE_MEDIUM (0x2 << 13) | 8 | #define MFP_DRIVE_MEDIUM (0x2 << 13) |
9 | #define MFP_DRIVE_FAST (0x3 << 13) | 9 | #define MFP_DRIVE_FAST (0x3 << 13) |
10 | 10 | ||
11 | #undef MFP_CFG | ||
12 | #undef MFP_CFG_DRV | ||
13 | |||
14 | #define MFP_CFG(pin, af) \ | ||
15 | (MFP_LPM_INPUT | MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_DRIVE_MEDIUM) | ||
16 | |||
17 | #define MFP_CFG_DRV(pin, af, drv) \ | ||
18 | (MFP_LPM_INPUT | MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_DRIVE_##drv) | ||
19 | |||
11 | /* GPIO */ | 20 | /* GPIO */ |
12 | #define GPIO0_GPIO MFP_CFG(GPIO0, AF5) | 21 | #define GPIO0_GPIO MFP_CFG(GPIO0, AF5) |
13 | #define GPIO1_GPIO MFP_CFG(GPIO1, AF5) | 22 | #define GPIO1_GPIO MFP_CFG(GPIO1, AF5) |
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c index 7f568611547e..6a96911b0ad5 100644 --- a/arch/arm/mach-msm/board-qsd8x50.c +++ b/arch/arm/mach-msm/board-qsd8x50.c | |||
@@ -160,10 +160,7 @@ static struct msm_mmc_platform_data qsd8x50_sdc1_data = { | |||
160 | 160 | ||
161 | static void __init qsd8x50_init_mmc(void) | 161 | static void __init qsd8x50_init_mmc(void) |
162 | { | 162 | { |
163 | if (machine_is_qsd8x50_ffa() || machine_is_qsd8x50a_ffa()) | 163 | vreg_mmc = vreg_get(NULL, "gp5"); |
164 | vreg_mmc = vreg_get(NULL, "gp6"); | ||
165 | else | ||
166 | vreg_mmc = vreg_get(NULL, "gp5"); | ||
167 | 164 | ||
168 | if (IS_ERR(vreg_mmc)) { | 165 | if (IS_ERR(vreg_mmc)) { |
169 | pr_err("vreg get for vreg_mmc failed (%ld)\n", | 166 | pr_err("vreg get for vreg_mmc failed (%ld)\n", |
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c index 56f920c55b6a..38b95e949d13 100644 --- a/arch/arm/mach-msm/timer.c +++ b/arch/arm/mach-msm/timer.c | |||
@@ -269,7 +269,7 @@ int __cpuinit local_timer_setup(struct clock_event_device *evt) | |||
269 | 269 | ||
270 | /* Use existing clock_event for cpu 0 */ | 270 | /* Use existing clock_event for cpu 0 */ |
271 | if (!smp_processor_id()) | 271 | if (!smp_processor_id()) |
272 | return; | 272 | return 0; |
273 | 273 | ||
274 | writel(DGT_CLK_CTL_DIV_4, MSM_TMR_BASE + DGT_CLK_CTL); | 274 | writel(DGT_CLK_CTL_DIV_4, MSM_TMR_BASE + DGT_CLK_CTL); |
275 | 275 | ||
diff --git a/arch/arm/mach-mx3/mach-vpr200.c b/arch/arm/mach-mx3/mach-vpr200.c index 2cf390fbd980..47a69cbc31a8 100644 --- a/arch/arm/mach-mx3/mach-vpr200.c +++ b/arch/arm/mach-mx3/mach-vpr200.c | |||
@@ -257,11 +257,16 @@ static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { | |||
257 | .workaround = FLS_USB2_WORKAROUND_ENGCM09152, | 257 | .workaround = FLS_USB2_WORKAROUND_ENGCM09152, |
258 | }; | 258 | }; |
259 | 259 | ||
260 | static int vpr200_usbh_init(struct platform_device *pdev) | ||
261 | { | ||
262 | return mx35_initialize_usb_hw(pdev->id, | ||
263 | MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY); | ||
264 | } | ||
265 | |||
260 | /* USB HOST config */ | 266 | /* USB HOST config */ |
261 | static const struct mxc_usbh_platform_data usb_host_pdata __initconst = { | 267 | static const struct mxc_usbh_platform_data usb_host_pdata __initconst = { |
262 | .portsc = MXC_EHCI_MODE_SERIAL, | 268 | .init = vpr200_usbh_init, |
263 | .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | | 269 | .portsc = MXC_EHCI_MODE_SERIAL, |
264 | MXC_EHCI_INTERNAL_PHY, | ||
265 | }; | 270 | }; |
266 | 271 | ||
267 | static struct platform_device *devices[] __initdata = { | 272 | static struct platform_device *devices[] __initdata = { |
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c index 10a1bea10548..6206b1191fe8 100644 --- a/arch/arm/mach-mx5/board-mx53_loco.c +++ b/arch/arm/mach-mx5/board-mx53_loco.c | |||
@@ -193,7 +193,7 @@ static iomux_v3_cfg_t mx53_loco_pads[] = { | |||
193 | .wakeup = wake, \ | 193 | .wakeup = wake, \ |
194 | } | 194 | } |
195 | 195 | ||
196 | static const struct gpio_keys_button loco_buttons[] __initconst = { | 196 | static struct gpio_keys_button loco_buttons[] = { |
197 | GPIO_BUTTON(MX53_LOCO_POWER, KEY_POWER, 1, "power", 0), | 197 | GPIO_BUTTON(MX53_LOCO_POWER, KEY_POWER, 1, "power", 0), |
198 | GPIO_BUTTON(MX53_LOCO_UI1, KEY_VOLUMEUP, 1, "volume-up", 0), | 198 | GPIO_BUTTON(MX53_LOCO_UI1, KEY_VOLUMEUP, 1, "volume-up", 0), |
199 | GPIO_BUTTON(MX53_LOCO_UI2, KEY_VOLUMEDOWN, 1, "volume-down", 0), | 199 | GPIO_BUTTON(MX53_LOCO_UI2, KEY_VOLUMEDOWN, 1, "volume-down", 0), |
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c index 1ad97fed1e94..5dcc59d5b9ec 100644 --- a/arch/arm/mach-mxs/clock-mx28.c +++ b/arch/arm/mach-mxs/clock-mx28.c | |||
@@ -295,11 +295,11 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \ | |||
295 | unsigned long diff, parent_rate, calc_rate; \ | 295 | unsigned long diff, parent_rate, calc_rate; \ |
296 | int i; \ | 296 | int i; \ |
297 | \ | 297 | \ |
298 | parent_rate = clk_get_rate(clk->parent); \ | ||
299 | div_max = BM_CLKCTRL_##dr##_DIV >> BP_CLKCTRL_##dr##_DIV; \ | 298 | div_max = BM_CLKCTRL_##dr##_DIV >> BP_CLKCTRL_##dr##_DIV; \ |
300 | bm_busy = BM_CLKCTRL_##dr##_BUSY; \ | 299 | bm_busy = BM_CLKCTRL_##dr##_BUSY; \ |
301 | \ | 300 | \ |
302 | if (clk->parent == &ref_xtal_clk) { \ | 301 | if (clk->parent == &ref_xtal_clk) { \ |
302 | parent_rate = clk_get_rate(clk->parent); \ | ||
303 | div = DIV_ROUND_UP(parent_rate, rate); \ | 303 | div = DIV_ROUND_UP(parent_rate, rate); \ |
304 | if (clk == &cpu_clk) { \ | 304 | if (clk == &cpu_clk) { \ |
305 | div_max = BM_CLKCTRL_CPU_DIV_XTAL >> \ | 305 | div_max = BM_CLKCTRL_CPU_DIV_XTAL >> \ |
@@ -309,6 +309,11 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \ | |||
309 | if (div == 0 || div > div_max) \ | 309 | if (div == 0 || div > div_max) \ |
310 | return -EINVAL; \ | 310 | return -EINVAL; \ |
311 | } else { \ | 311 | } else { \ |
312 | /* \ | ||
313 | * hack alert: this block modifies clk->parent, too, \ | ||
314 | * so the base to use it the grand parent. \ | ||
315 | */ \ | ||
316 | parent_rate = clk_get_rate(clk->parent->parent); \ | ||
312 | rate >>= PARENT_RATE_SHIFT; \ | 317 | rate >>= PARENT_RATE_SHIFT; \ |
313 | parent_rate >>= PARENT_RATE_SHIFT; \ | 318 | parent_rate >>= PARENT_RATE_SHIFT; \ |
314 | diff = parent_rate; \ | 319 | diff = parent_rate; \ |
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index a45cd6409686..512b15204450 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -68,7 +68,7 @@ obj-$(CONFIG_OMAP_SMARTREFLEX) += sr_device.o smartreflex.o | |||
68 | obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3) += smartreflex-class3.o | 68 | obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3) += smartreflex-class3.o |
69 | 69 | ||
70 | AFLAGS_sleep24xx.o :=-Wa,-march=armv6 | 70 | AFLAGS_sleep24xx.o :=-Wa,-march=armv6 |
71 | AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a | 71 | AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec) |
72 | 72 | ||
73 | ifeq ($(CONFIG_PM_VERBOSE),y) | 73 | ifeq ($(CONFIG_PM_VERBOSE),y) |
74 | CFLAGS_pm_bus.o += -DDEBUG | 74 | CFLAGS_pm_bus.o += -DDEBUG |
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c index e964895b80e8..f8ba20a14e62 100644 --- a/arch/arm/mach-omap2/board-rx51.c +++ b/arch/arm/mach-omap2/board-rx51.c | |||
@@ -141,14 +141,19 @@ static void __init rx51_init(void) | |||
141 | static void __init rx51_map_io(void) | 141 | static void __init rx51_map_io(void) |
142 | { | 142 | { |
143 | omap2_set_globals_3xxx(); | 143 | omap2_set_globals_3xxx(); |
144 | rx51_video_mem_init(); | ||
145 | omap34xx_map_common_io(); | 144 | omap34xx_map_common_io(); |
146 | } | 145 | } |
147 | 146 | ||
147 | static void __init rx51_reserve(void) | ||
148 | { | ||
149 | rx51_video_mem_init(); | ||
150 | omap_reserve(); | ||
151 | } | ||
152 | |||
148 | MACHINE_START(NOKIA_RX51, "Nokia RX-51 board") | 153 | MACHINE_START(NOKIA_RX51, "Nokia RX-51 board") |
149 | /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */ | 154 | /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */ |
150 | .boot_params = 0x80000100, | 155 | .boot_params = 0x80000100, |
151 | .reserve = omap_reserve, | 156 | .reserve = rx51_reserve, |
152 | .map_io = rx51_map_io, | 157 | .map_io = rx51_map_io, |
153 | .init_early = rx51_init_early, | 158 | .init_early = rx51_init_early, |
154 | .init_irq = omap_init_irq, | 159 | .init_irq = omap_init_irq, |
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c index 276992d3b7fb..8c965671b4d4 100644 --- a/arch/arm/mach-omap2/clock44xx_data.c +++ b/arch/arm/mach-omap2/clock44xx_data.c | |||
@@ -3116,14 +3116,9 @@ static struct omap_clk omap44xx_clks[] = { | |||
3116 | CLK(NULL, "dsp_fck", &dsp_fck, CK_443X), | 3116 | CLK(NULL, "dsp_fck", &dsp_fck, CK_443X), |
3117 | CLK("omapdss_dss", "sys_clk", &dss_sys_clk, CK_443X), | 3117 | CLK("omapdss_dss", "sys_clk", &dss_sys_clk, CK_443X), |
3118 | CLK("omapdss_dss", "tv_clk", &dss_tv_clk, CK_443X), | 3118 | CLK("omapdss_dss", "tv_clk", &dss_tv_clk, CK_443X), |
3119 | CLK("omapdss_dss", "dss_clk", &dss_dss_clk, CK_443X), | ||
3120 | CLK("omapdss_dss", "video_clk", &dss_48mhz_clk, CK_443X), | 3119 | CLK("omapdss_dss", "video_clk", &dss_48mhz_clk, CK_443X), |
3121 | CLK("omapdss_dss", "fck", &dss_fck, CK_443X), | 3120 | CLK("omapdss_dss", "fck", &dss_dss_clk, CK_443X), |
3122 | /* | 3121 | CLK("omapdss_dss", "ick", &dss_fck, CK_443X), |
3123 | * On OMAP4, DSS ick is a dummy clock; this is needed for compatibility | ||
3124 | * with OMAP2/3. | ||
3125 | */ | ||
3126 | CLK("omapdss_dss", "ick", &dummy_ck, CK_443X), | ||
3127 | CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X), | 3122 | CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X), |
3128 | CLK(NULL, "emif1_fck", &emif1_fck, CK_443X), | 3123 | CLK(NULL, "emif1_fck", &emif1_fck, CK_443X), |
3129 | CLK(NULL, "emif2_fck", &emif2_fck, CK_443X), | 3124 | CLK(NULL, "emif2_fck", &emif2_fck, CK_443X), |
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.c b/arch/arm/mach-omap2/cm2xxx_3xxx.c index 9d0dec806e92..38830d8d4783 100644 --- a/arch/arm/mach-omap2/cm2xxx_3xxx.c +++ b/arch/arm/mach-omap2/cm2xxx_3xxx.c | |||
@@ -247,6 +247,7 @@ struct omap3_cm_regs { | |||
247 | u32 per_cm_clksel; | 247 | u32 per_cm_clksel; |
248 | u32 emu_cm_clksel; | 248 | u32 emu_cm_clksel; |
249 | u32 emu_cm_clkstctrl; | 249 | u32 emu_cm_clkstctrl; |
250 | u32 pll_cm_autoidle; | ||
250 | u32 pll_cm_autoidle2; | 251 | u32 pll_cm_autoidle2; |
251 | u32 pll_cm_clksel4; | 252 | u32 pll_cm_clksel4; |
252 | u32 pll_cm_clksel5; | 253 | u32 pll_cm_clksel5; |
@@ -319,6 +320,15 @@ void omap3_cm_save_context(void) | |||
319 | omap2_cm_read_mod_reg(OMAP3430_EMU_MOD, CM_CLKSEL1); | 320 | omap2_cm_read_mod_reg(OMAP3430_EMU_MOD, CM_CLKSEL1); |
320 | cm_context.emu_cm_clkstctrl = | 321 | cm_context.emu_cm_clkstctrl = |
321 | omap2_cm_read_mod_reg(OMAP3430_EMU_MOD, OMAP2_CM_CLKSTCTRL); | 322 | omap2_cm_read_mod_reg(OMAP3430_EMU_MOD, OMAP2_CM_CLKSTCTRL); |
323 | /* | ||
324 | * As per erratum i671, ROM code does not respect the PER DPLL | ||
325 | * programming scheme if CM_AUTOIDLE_PLL.AUTO_PERIPH_DPLL == 1. | ||
326 | * In this case, even though this register has been saved in | ||
327 | * scratchpad contents, we need to restore AUTO_PERIPH_DPLL | ||
328 | * by ourselves. So, we need to save it anyway. | ||
329 | */ | ||
330 | cm_context.pll_cm_autoidle = | ||
331 | omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE); | ||
322 | cm_context.pll_cm_autoidle2 = | 332 | cm_context.pll_cm_autoidle2 = |
323 | omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE2); | 333 | omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE2); |
324 | cm_context.pll_cm_clksel4 = | 334 | cm_context.pll_cm_clksel4 = |
@@ -441,6 +451,13 @@ void omap3_cm_restore_context(void) | |||
441 | CM_CLKSEL1); | 451 | CM_CLKSEL1); |
442 | omap2_cm_write_mod_reg(cm_context.emu_cm_clkstctrl, OMAP3430_EMU_MOD, | 452 | omap2_cm_write_mod_reg(cm_context.emu_cm_clkstctrl, OMAP3430_EMU_MOD, |
443 | OMAP2_CM_CLKSTCTRL); | 453 | OMAP2_CM_CLKSTCTRL); |
454 | /* | ||
455 | * As per erratum i671, ROM code does not respect the PER DPLL | ||
456 | * programming scheme if CM_AUTOIDLE_PLL.AUTO_PERIPH_DPLL == 1. | ||
457 | * In this case, we need to restore AUTO_PERIPH_DPLL by ourselves. | ||
458 | */ | ||
459 | omap2_cm_write_mod_reg(cm_context.pll_cm_autoidle, PLL_MOD, | ||
460 | CM_AUTOIDLE); | ||
444 | omap2_cm_write_mod_reg(cm_context.pll_cm_autoidle2, PLL_MOD, | 461 | omap2_cm_write_mod_reg(cm_context.pll_cm_autoidle2, PLL_MOD, |
445 | CM_AUTOIDLE2); | 462 | CM_AUTOIDLE2); |
446 | omap2_cm_write_mod_reg(cm_context.pll_cm_clksel4, PLL_MOD, | 463 | omap2_cm_write_mod_reg(cm_context.pll_cm_clksel4, PLL_MOD, |
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index 695279419020..da53ba3917ca 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c | |||
@@ -316,8 +316,14 @@ void omap3_save_scratchpad_contents(void) | |||
316 | omap2_cm_read_mod_reg(WKUP_MOD, CM_CLKSEL); | 316 | omap2_cm_read_mod_reg(WKUP_MOD, CM_CLKSEL); |
317 | prcm_block_contents.cm_clken_pll = | 317 | prcm_block_contents.cm_clken_pll = |
318 | omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); | 318 | omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); |
319 | /* | ||
320 | * As per erratum i671, ROM code does not respect the PER DPLL | ||
321 | * programming scheme if CM_AUTOIDLE_PLL..AUTO_PERIPH_DPLL == 1. | ||
322 | * Then, in anycase, clear these bits to avoid extra latencies. | ||
323 | */ | ||
319 | prcm_block_contents.cm_autoidle_pll = | 324 | prcm_block_contents.cm_autoidle_pll = |
320 | omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_AUTOIDLE_PLL); | 325 | omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE) & |
326 | ~OMAP3430_AUTO_PERIPH_DPLL_MASK; | ||
321 | prcm_block_contents.cm_clksel1_pll = | 327 | prcm_block_contents.cm_clksel1_pll = |
322 | omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL); | 328 | omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL); |
323 | prcm_block_contents.cm_clksel2_pll = | 329 | prcm_block_contents.cm_clksel2_pll = |
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index 8eb3ce1bbfbe..c4d0ae87d62a 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c | |||
@@ -1639,6 +1639,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio1_slaves[] = { | |||
1639 | 1639 | ||
1640 | static struct omap_hwmod omap2420_gpio1_hwmod = { | 1640 | static struct omap_hwmod omap2420_gpio1_hwmod = { |
1641 | .name = "gpio1", | 1641 | .name = "gpio1", |
1642 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
1642 | .mpu_irqs = omap242x_gpio1_irqs, | 1643 | .mpu_irqs = omap242x_gpio1_irqs, |
1643 | .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio1_irqs), | 1644 | .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio1_irqs), |
1644 | .main_clk = "gpios_fck", | 1645 | .main_clk = "gpios_fck", |
@@ -1669,6 +1670,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio2_slaves[] = { | |||
1669 | 1670 | ||
1670 | static struct omap_hwmod omap2420_gpio2_hwmod = { | 1671 | static struct omap_hwmod omap2420_gpio2_hwmod = { |
1671 | .name = "gpio2", | 1672 | .name = "gpio2", |
1673 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
1672 | .mpu_irqs = omap242x_gpio2_irqs, | 1674 | .mpu_irqs = omap242x_gpio2_irqs, |
1673 | .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio2_irqs), | 1675 | .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio2_irqs), |
1674 | .main_clk = "gpios_fck", | 1676 | .main_clk = "gpios_fck", |
@@ -1699,6 +1701,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio3_slaves[] = { | |||
1699 | 1701 | ||
1700 | static struct omap_hwmod omap2420_gpio3_hwmod = { | 1702 | static struct omap_hwmod omap2420_gpio3_hwmod = { |
1701 | .name = "gpio3", | 1703 | .name = "gpio3", |
1704 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
1702 | .mpu_irqs = omap242x_gpio3_irqs, | 1705 | .mpu_irqs = omap242x_gpio3_irqs, |
1703 | .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio3_irqs), | 1706 | .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio3_irqs), |
1704 | .main_clk = "gpios_fck", | 1707 | .main_clk = "gpios_fck", |
@@ -1729,6 +1732,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio4_slaves[] = { | |||
1729 | 1732 | ||
1730 | static struct omap_hwmod omap2420_gpio4_hwmod = { | 1733 | static struct omap_hwmod omap2420_gpio4_hwmod = { |
1731 | .name = "gpio4", | 1734 | .name = "gpio4", |
1735 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
1732 | .mpu_irqs = omap242x_gpio4_irqs, | 1736 | .mpu_irqs = omap242x_gpio4_irqs, |
1733 | .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio4_irqs), | 1737 | .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio4_irqs), |
1734 | .main_clk = "gpios_fck", | 1738 | .main_clk = "gpios_fck", |
@@ -1782,7 +1786,7 @@ static struct omap_hwmod_irq_info omap2420_dma_system_irqs[] = { | |||
1782 | static struct omap_hwmod_addr_space omap2420_dma_system_addrs[] = { | 1786 | static struct omap_hwmod_addr_space omap2420_dma_system_addrs[] = { |
1783 | { | 1787 | { |
1784 | .pa_start = 0x48056000, | 1788 | .pa_start = 0x48056000, |
1785 | .pa_end = 0x4a0560ff, | 1789 | .pa_end = 0x48056fff, |
1786 | .flags = ADDR_TYPE_RT | 1790 | .flags = ADDR_TYPE_RT |
1787 | }, | 1791 | }, |
1788 | }; | 1792 | }; |
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index e6e3810db77f..9682dd519f8d 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c | |||
@@ -1742,6 +1742,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio1_slaves[] = { | |||
1742 | 1742 | ||
1743 | static struct omap_hwmod omap2430_gpio1_hwmod = { | 1743 | static struct omap_hwmod omap2430_gpio1_hwmod = { |
1744 | .name = "gpio1", | 1744 | .name = "gpio1", |
1745 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
1745 | .mpu_irqs = omap243x_gpio1_irqs, | 1746 | .mpu_irqs = omap243x_gpio1_irqs, |
1746 | .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio1_irqs), | 1747 | .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio1_irqs), |
1747 | .main_clk = "gpios_fck", | 1748 | .main_clk = "gpios_fck", |
@@ -1772,6 +1773,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio2_slaves[] = { | |||
1772 | 1773 | ||
1773 | static struct omap_hwmod omap2430_gpio2_hwmod = { | 1774 | static struct omap_hwmod omap2430_gpio2_hwmod = { |
1774 | .name = "gpio2", | 1775 | .name = "gpio2", |
1776 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
1775 | .mpu_irqs = omap243x_gpio2_irqs, | 1777 | .mpu_irqs = omap243x_gpio2_irqs, |
1776 | .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio2_irqs), | 1778 | .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio2_irqs), |
1777 | .main_clk = "gpios_fck", | 1779 | .main_clk = "gpios_fck", |
@@ -1802,6 +1804,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio3_slaves[] = { | |||
1802 | 1804 | ||
1803 | static struct omap_hwmod omap2430_gpio3_hwmod = { | 1805 | static struct omap_hwmod omap2430_gpio3_hwmod = { |
1804 | .name = "gpio3", | 1806 | .name = "gpio3", |
1807 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
1805 | .mpu_irqs = omap243x_gpio3_irqs, | 1808 | .mpu_irqs = omap243x_gpio3_irqs, |
1806 | .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio3_irqs), | 1809 | .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio3_irqs), |
1807 | .main_clk = "gpios_fck", | 1810 | .main_clk = "gpios_fck", |
@@ -1832,6 +1835,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio4_slaves[] = { | |||
1832 | 1835 | ||
1833 | static struct omap_hwmod omap2430_gpio4_hwmod = { | 1836 | static struct omap_hwmod omap2430_gpio4_hwmod = { |
1834 | .name = "gpio4", | 1837 | .name = "gpio4", |
1838 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
1835 | .mpu_irqs = omap243x_gpio4_irqs, | 1839 | .mpu_irqs = omap243x_gpio4_irqs, |
1836 | .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio4_irqs), | 1840 | .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio4_irqs), |
1837 | .main_clk = "gpios_fck", | 1841 | .main_clk = "gpios_fck", |
@@ -1862,6 +1866,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio5_slaves[] = { | |||
1862 | 1866 | ||
1863 | static struct omap_hwmod omap2430_gpio5_hwmod = { | 1867 | static struct omap_hwmod omap2430_gpio5_hwmod = { |
1864 | .name = "gpio5", | 1868 | .name = "gpio5", |
1869 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
1865 | .mpu_irqs = omap243x_gpio5_irqs, | 1870 | .mpu_irqs = omap243x_gpio5_irqs, |
1866 | .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio5_irqs), | 1871 | .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio5_irqs), |
1867 | .main_clk = "gpio5_fck", | 1872 | .main_clk = "gpio5_fck", |
@@ -1915,7 +1920,7 @@ static struct omap_hwmod_irq_info omap2430_dma_system_irqs[] = { | |||
1915 | static struct omap_hwmod_addr_space omap2430_dma_system_addrs[] = { | 1920 | static struct omap_hwmod_addr_space omap2430_dma_system_addrs[] = { |
1916 | { | 1921 | { |
1917 | .pa_start = 0x48056000, | 1922 | .pa_start = 0x48056000, |
1918 | .pa_end = 0x4a0560ff, | 1923 | .pa_end = 0x48056fff, |
1919 | .flags = ADDR_TYPE_RT | 1924 | .flags = ADDR_TYPE_RT |
1920 | }, | 1925 | }, |
1921 | }; | 1926 | }; |
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index b98e2dfcba28..909a84de6682 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -2141,6 +2141,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio1_slaves[] = { | |||
2141 | 2141 | ||
2142 | static struct omap_hwmod omap3xxx_gpio1_hwmod = { | 2142 | static struct omap_hwmod omap3xxx_gpio1_hwmod = { |
2143 | .name = "gpio1", | 2143 | .name = "gpio1", |
2144 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
2144 | .mpu_irqs = omap3xxx_gpio1_irqs, | 2145 | .mpu_irqs = omap3xxx_gpio1_irqs, |
2145 | .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio1_irqs), | 2146 | .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio1_irqs), |
2146 | .main_clk = "gpio1_ick", | 2147 | .main_clk = "gpio1_ick", |
@@ -2177,6 +2178,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio2_slaves[] = { | |||
2177 | 2178 | ||
2178 | static struct omap_hwmod omap3xxx_gpio2_hwmod = { | 2179 | static struct omap_hwmod omap3xxx_gpio2_hwmod = { |
2179 | .name = "gpio2", | 2180 | .name = "gpio2", |
2181 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
2180 | .mpu_irqs = omap3xxx_gpio2_irqs, | 2182 | .mpu_irqs = omap3xxx_gpio2_irqs, |
2181 | .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio2_irqs), | 2183 | .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio2_irqs), |
2182 | .main_clk = "gpio2_ick", | 2184 | .main_clk = "gpio2_ick", |
@@ -2213,6 +2215,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio3_slaves[] = { | |||
2213 | 2215 | ||
2214 | static struct omap_hwmod omap3xxx_gpio3_hwmod = { | 2216 | static struct omap_hwmod omap3xxx_gpio3_hwmod = { |
2215 | .name = "gpio3", | 2217 | .name = "gpio3", |
2218 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
2216 | .mpu_irqs = omap3xxx_gpio3_irqs, | 2219 | .mpu_irqs = omap3xxx_gpio3_irqs, |
2217 | .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio3_irqs), | 2220 | .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio3_irqs), |
2218 | .main_clk = "gpio3_ick", | 2221 | .main_clk = "gpio3_ick", |
@@ -2249,6 +2252,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio4_slaves[] = { | |||
2249 | 2252 | ||
2250 | static struct omap_hwmod omap3xxx_gpio4_hwmod = { | 2253 | static struct omap_hwmod omap3xxx_gpio4_hwmod = { |
2251 | .name = "gpio4", | 2254 | .name = "gpio4", |
2255 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
2252 | .mpu_irqs = omap3xxx_gpio4_irqs, | 2256 | .mpu_irqs = omap3xxx_gpio4_irqs, |
2253 | .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio4_irqs), | 2257 | .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio4_irqs), |
2254 | .main_clk = "gpio4_ick", | 2258 | .main_clk = "gpio4_ick", |
@@ -2285,6 +2289,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio5_slaves[] = { | |||
2285 | 2289 | ||
2286 | static struct omap_hwmod omap3xxx_gpio5_hwmod = { | 2290 | static struct omap_hwmod omap3xxx_gpio5_hwmod = { |
2287 | .name = "gpio5", | 2291 | .name = "gpio5", |
2292 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
2288 | .mpu_irqs = omap3xxx_gpio5_irqs, | 2293 | .mpu_irqs = omap3xxx_gpio5_irqs, |
2289 | .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio5_irqs), | 2294 | .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio5_irqs), |
2290 | .main_clk = "gpio5_ick", | 2295 | .main_clk = "gpio5_ick", |
@@ -2321,6 +2326,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio6_slaves[] = { | |||
2321 | 2326 | ||
2322 | static struct omap_hwmod omap3xxx_gpio6_hwmod = { | 2327 | static struct omap_hwmod omap3xxx_gpio6_hwmod = { |
2323 | .name = "gpio6", | 2328 | .name = "gpio6", |
2329 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
2324 | .mpu_irqs = omap3xxx_gpio6_irqs, | 2330 | .mpu_irqs = omap3xxx_gpio6_irqs, |
2325 | .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio6_irqs), | 2331 | .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio6_irqs), |
2326 | .main_clk = "gpio6_ick", | 2332 | .main_clk = "gpio6_ick", |
@@ -2386,7 +2392,7 @@ static struct omap_hwmod_irq_info omap3xxx_dma_system_irqs[] = { | |||
2386 | static struct omap_hwmod_addr_space omap3xxx_dma_system_addrs[] = { | 2392 | static struct omap_hwmod_addr_space omap3xxx_dma_system_addrs[] = { |
2387 | { | 2393 | { |
2388 | .pa_start = 0x48056000, | 2394 | .pa_start = 0x48056000, |
2389 | .pa_end = 0x4a0560ff, | 2395 | .pa_end = 0x48056fff, |
2390 | .flags = ADDR_TYPE_RT | 2396 | .flags = ADDR_TYPE_RT |
2391 | }, | 2397 | }, |
2392 | }; | 2398 | }; |
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 3e88dd3f8ef3..abc548a0c98d 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -885,7 +885,7 @@ static struct omap_hwmod_ocp_if *omap44xx_dma_system_masters[] = { | |||
885 | static struct omap_hwmod_addr_space omap44xx_dma_system_addrs[] = { | 885 | static struct omap_hwmod_addr_space omap44xx_dma_system_addrs[] = { |
886 | { | 886 | { |
887 | .pa_start = 0x4a056000, | 887 | .pa_start = 0x4a056000, |
888 | .pa_end = 0x4a0560ff, | 888 | .pa_end = 0x4a056fff, |
889 | .flags = ADDR_TYPE_RT | 889 | .flags = ADDR_TYPE_RT |
890 | }, | 890 | }, |
891 | }; | 891 | }; |
diff --git a/arch/arm/mach-omap2/omap_l3_smx.c b/arch/arm/mach-omap2/omap_l3_smx.c index 5f2da7565b68..4321e7938929 100644 --- a/arch/arm/mach-omap2/omap_l3_smx.c +++ b/arch/arm/mach-omap2/omap_l3_smx.c | |||
@@ -196,11 +196,11 @@ static irqreturn_t omap3_l3_app_irq(int irq, void *_l3) | |||
196 | /* No timeout error for debug sources */ | 196 | /* No timeout error for debug sources */ |
197 | } | 197 | } |
198 | 198 | ||
199 | base = ((l3->rt) + (*(omap3_l3_bases[int_type] + err_source))); | ||
200 | |||
201 | /* identify the error source */ | 199 | /* identify the error source */ |
202 | for (err_source = 0; !(status & (1 << err_source)); err_source++) | 200 | for (err_source = 0; !(status & (1 << err_source)); err_source++) |
203 | ; | 201 | ; |
202 | |||
203 | base = l3->rt + *(omap3_l3_bases[int_type] + err_source); | ||
204 | error = omap3_l3_readll(base, L3_ERROR_LOG); | 204 | error = omap3_l3_readll(base, L3_ERROR_LOG); |
205 | 205 | ||
206 | if (error) { | 206 | if (error) { |
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index 30af3351c2d6..49486f522dca 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
@@ -89,6 +89,7 @@ static void omap2_init_processor_devices(void) | |||
89 | if (cpu_is_omap44xx()) { | 89 | if (cpu_is_omap44xx()) { |
90 | _init_omap_device("l3_main_1", &l3_dev); | 90 | _init_omap_device("l3_main_1", &l3_dev); |
91 | _init_omap_device("dsp", &dsp_dev); | 91 | _init_omap_device("dsp", &dsp_dev); |
92 | _init_omap_device("iva", &iva_dev); | ||
92 | } else { | 93 | } else { |
93 | _init_omap_device("l3_main", &l3_dev); | 94 | _init_omap_device("l3_main", &l3_dev); |
94 | } | 95 | } |
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c index 6fb520999b6e..0c1552d9d995 100644 --- a/arch/arm/mach-omap2/voltage.c +++ b/arch/arm/mach-omap2/voltage.c | |||
@@ -114,7 +114,6 @@ static int __init _config_common_vdd_data(struct omap_vdd_info *vdd) | |||
114 | sys_clk_speed /= 1000; | 114 | sys_clk_speed /= 1000; |
115 | 115 | ||
116 | /* Generic voltage parameters */ | 116 | /* Generic voltage parameters */ |
117 | vdd->curr_volt = 1200000; | ||
118 | vdd->volt_scale = vp_forceupdate_scale_voltage; | 117 | vdd->volt_scale = vp_forceupdate_scale_voltage; |
119 | vdd->vp_enabled = false; | 118 | vdd->vp_enabled = false; |
120 | 119 | ||
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c index 6de0ad0eea65..9cdcca597924 100644 --- a/arch/arm/mach-pxa/hx4700.c +++ b/arch/arm/mach-pxa/hx4700.c | |||
@@ -711,7 +711,7 @@ static struct regulator_consumer_supply bq24022_consumers[] = { | |||
711 | static struct regulator_init_data bq24022_init_data = { | 711 | static struct regulator_init_data bq24022_init_data = { |
712 | .constraints = { | 712 | .constraints = { |
713 | .max_uA = 500000, | 713 | .max_uA = 500000, |
714 | .valid_ops_mask = REGULATOR_CHANGE_CURRENT, | 714 | .valid_ops_mask = REGULATOR_CHANGE_CURRENT|REGULATOR_CHANGE_STATUS, |
715 | }, | 715 | }, |
716 | .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers), | 716 | .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers), |
717 | .consumer_supplies = bq24022_consumers, | 717 | .consumer_supplies = bq24022_consumers, |
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h index b024a8b37439..c4639502efca 100644 --- a/arch/arm/mach-pxa/include/mach/gpio.h +++ b/arch/arm/mach-pxa/include/mach/gpio.h | |||
@@ -99,11 +99,24 @@ | |||
99 | #define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2)) | 99 | #define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2)) |
100 | 100 | ||
101 | 101 | ||
102 | #define NR_BUILTIN_GPIO 128 | 102 | #define NR_BUILTIN_GPIO PXA_GPIO_IRQ_NUM |
103 | 103 | ||
104 | #define gpio_to_bank(gpio) ((gpio) >> 5) | 104 | #define gpio_to_bank(gpio) ((gpio) >> 5) |
105 | #define gpio_to_irq(gpio) IRQ_GPIO(gpio) | 105 | #define gpio_to_irq(gpio) IRQ_GPIO(gpio) |
106 | #define irq_to_gpio(irq) IRQ_TO_GPIO(irq) | 106 | |
107 | static inline int irq_to_gpio(unsigned int irq) | ||
108 | { | ||
109 | int gpio; | ||
110 | |||
111 | if (irq == IRQ_GPIO0 || irq == IRQ_GPIO1) | ||
112 | return irq - IRQ_GPIO0; | ||
113 | |||
114 | gpio = irq - PXA_GPIO_IRQ_BASE; | ||
115 | if (gpio >= 2 && gpio < NR_BUILTIN_GPIO) | ||
116 | return gpio; | ||
117 | |||
118 | return -1; | ||
119 | } | ||
107 | 120 | ||
108 | #ifdef CONFIG_CPU_PXA26x | 121 | #ifdef CONFIG_CPU_PXA26x |
109 | /* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted, | 122 | /* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted, |
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h index a4285fc00878..038402404e39 100644 --- a/arch/arm/mach-pxa/include/mach/irqs.h +++ b/arch/arm/mach-pxa/include/mach/irqs.h | |||
@@ -93,9 +93,6 @@ | |||
93 | #define GPIO_2_x_TO_IRQ(x) (PXA_GPIO_IRQ_BASE + (x)) | 93 | #define GPIO_2_x_TO_IRQ(x) (PXA_GPIO_IRQ_BASE + (x)) |
94 | #define IRQ_GPIO(x) (((x) < 2) ? (IRQ_GPIO0 + (x)) : GPIO_2_x_TO_IRQ(x)) | 94 | #define IRQ_GPIO(x) (((x) < 2) ? (IRQ_GPIO0 + (x)) : GPIO_2_x_TO_IRQ(x)) |
95 | 95 | ||
96 | #define IRQ_TO_GPIO_2_x(i) ((i) - PXA_GPIO_IRQ_BASE) | ||
97 | #define IRQ_TO_GPIO(i) (((i) < IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) : IRQ_TO_GPIO_2_x(i)) | ||
98 | |||
99 | /* | 96 | /* |
100 | * The following interrupts are for board specific purposes. Since | 97 | * The following interrupts are for board specific purposes. Since |
101 | * the kernel can only run on one machine at a time, we can re-use | 98 | * the kernel can only run on one machine at a time, we can re-use |
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index a72993dde2b3..9984ef70bd79 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -599,7 +599,7 @@ static struct regulator_consumer_supply bq24022_consumers[] = { | |||
599 | static struct regulator_init_data bq24022_init_data = { | 599 | static struct regulator_init_data bq24022_init_data = { |
600 | .constraints = { | 600 | .constraints = { |
601 | .max_uA = 500000, | 601 | .max_uA = 500000, |
602 | .valid_ops_mask = REGULATOR_CHANGE_CURRENT, | 602 | .valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS, |
603 | }, | 603 | }, |
604 | .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers), | 604 | .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers), |
605 | .consumer_supplies = bq24022_consumers, | 605 | .consumer_supplies = bq24022_consumers, |
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index 6bde5956358d..a4af8c52d7ee 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c | |||
@@ -285,7 +285,7 @@ static inline void pxa25x_init_pm(void) {} | |||
285 | 285 | ||
286 | static int pxa25x_set_wake(struct irq_data *d, unsigned int on) | 286 | static int pxa25x_set_wake(struct irq_data *d, unsigned int on) |
287 | { | 287 | { |
288 | int gpio = IRQ_TO_GPIO(d->irq); | 288 | int gpio = irq_to_gpio(d->irq); |
289 | uint32_t mask = 0; | 289 | uint32_t mask = 0; |
290 | 290 | ||
291 | if (gpio >= 0 && gpio < 85) | 291 | if (gpio >= 0 && gpio < 85) |
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 1cb5d0f9723f..909756eaf4b7 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
@@ -345,7 +345,7 @@ static inline void pxa27x_init_pm(void) {} | |||
345 | */ | 345 | */ |
346 | static int pxa27x_set_wake(struct irq_data *d, unsigned int on) | 346 | static int pxa27x_set_wake(struct irq_data *d, unsigned int on) |
347 | { | 347 | { |
348 | int gpio = IRQ_TO_GPIO(d->irq); | 348 | int gpio = irq_to_gpio(d->irq); |
349 | uint32_t mask; | 349 | uint32_t mask; |
350 | 350 | ||
351 | if (gpio >= 0 && gpio < 128) | 351 | if (gpio >= 0 && gpio < 128) |
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c index 0db2411ef4bb..716662008ce2 100644 --- a/arch/arm/mach-s3c2440/mach-gta02.c +++ b/arch/arm/mach-s3c2440/mach-gta02.c | |||
@@ -409,6 +409,10 @@ struct platform_device s3c24xx_pwm_device = { | |||
409 | .num_resources = 0, | 409 | .num_resources = 0, |
410 | }; | 410 | }; |
411 | 411 | ||
412 | static struct platform_device gta02_dfbmcs320_device = { | ||
413 | .name = "dfbmcs320", | ||
414 | }; | ||
415 | |||
412 | static struct i2c_board_info gta02_i2c_devs[] __initdata = { | 416 | static struct i2c_board_info gta02_i2c_devs[] __initdata = { |
413 | { | 417 | { |
414 | I2C_BOARD_INFO("pcf50633", 0x73), | 418 | I2C_BOARD_INFO("pcf50633", 0x73), |
@@ -523,6 +527,7 @@ static struct platform_device *gta02_devices[] __initdata = { | |||
523 | &s3c_device_iis, | 527 | &s3c_device_iis, |
524 | &samsung_asoc_dma, | 528 | &samsung_asoc_dma, |
525 | &s3c_device_i2c0, | 529 | &s3c_device_i2c0, |
530 | >a02_dfbmcs320_device, | ||
526 | >a02_buttons_device, | 531 | >a02_buttons_device, |
527 | &s3c_device_adc, | 532 | &s3c_device_adc, |
528 | &s3c_device_ts, | 533 | &s3c_device_ts, |
diff --git a/arch/arm/mach-tegra/gpio.c b/arch/arm/mach-tegra/gpio.c index 76a3f654220f..65a1aba6823d 100644 --- a/arch/arm/mach-tegra/gpio.c +++ b/arch/arm/mach-tegra/gpio.c | |||
@@ -257,7 +257,8 @@ static void tegra_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
257 | void tegra_gpio_resume(void) | 257 | void tegra_gpio_resume(void) |
258 | { | 258 | { |
259 | unsigned long flags; | 259 | unsigned long flags; |
260 | int b, p, i; | 260 | int b; |
261 | int p; | ||
261 | 262 | ||
262 | local_irq_save(flags); | 263 | local_irq_save(flags); |
263 | 264 | ||
@@ -280,7 +281,8 @@ void tegra_gpio_resume(void) | |||
280 | void tegra_gpio_suspend(void) | 281 | void tegra_gpio_suspend(void) |
281 | { | 282 | { |
282 | unsigned long flags; | 283 | unsigned long flags; |
283 | int b, p, i; | 284 | int b; |
285 | int p; | ||
284 | 286 | ||
285 | local_irq_save(flags); | 287 | local_irq_save(flags); |
286 | for (b = 0; b < ARRAY_SIZE(tegra_gpio_banks); b++) { | 288 | for (b = 0; b < ARRAY_SIZE(tegra_gpio_banks); b++) { |
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c index 6d7c4eea4dcb..4459470c052d 100644 --- a/arch/arm/mach-tegra/tegra2_clocks.c +++ b/arch/arm/mach-tegra/tegra2_clocks.c | |||
@@ -1362,14 +1362,15 @@ static int tegra_clk_shared_bus_set_rate(struct clk *c, unsigned long rate) | |||
1362 | { | 1362 | { |
1363 | unsigned long flags; | 1363 | unsigned long flags; |
1364 | int ret; | 1364 | int ret; |
1365 | long new_rate = rate; | ||
1365 | 1366 | ||
1366 | rate = clk_round_rate(c->parent, rate); | 1367 | new_rate = clk_round_rate(c->parent, new_rate); |
1367 | if (rate < 0) | 1368 | if (new_rate < 0) |
1368 | return rate; | 1369 | return new_rate; |
1369 | 1370 | ||
1370 | spin_lock_irqsave(&c->parent->spinlock, flags); | 1371 | spin_lock_irqsave(&c->parent->spinlock, flags); |
1371 | 1372 | ||
1372 | c->u.shared_bus_user.rate = rate; | 1373 | c->u.shared_bus_user.rate = new_rate; |
1373 | ret = tegra_clk_shared_bus_update(c->parent); | 1374 | ret = tegra_clk_shared_bus_update(c->parent); |
1374 | 1375 | ||
1375 | spin_unlock_irqrestore(&c->parent->spinlock, flags); | 1376 | spin_unlock_irqrestore(&c->parent->spinlock, flags); |
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index af913741e6ec..6e1907fa94f0 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -178,16 +178,15 @@ static struct i2c_board_info __initdata mop500_i2c0_devices[] = { | |||
178 | .irq = NOMADIK_GPIO_TO_IRQ(217), | 178 | .irq = NOMADIK_GPIO_TO_IRQ(217), |
179 | .platform_data = &mop500_tc35892_data, | 179 | .platform_data = &mop500_tc35892_data, |
180 | }, | 180 | }, |
181 | }; | 181 | /* I2C0 devices only available prior to HREFv60 */ |
182 | |||
183 | /* I2C0 devices only available prior to HREFv60 */ | ||
184 | static struct i2c_board_info __initdata mop500_i2c0_old_devices[] = { | ||
185 | { | 182 | { |
186 | I2C_BOARD_INFO("tps61052", 0x33), | 183 | I2C_BOARD_INFO("tps61052", 0x33), |
187 | .platform_data = &mop500_tps61052_data, | 184 | .platform_data = &mop500_tps61052_data, |
188 | }, | 185 | }, |
189 | }; | 186 | }; |
190 | 187 | ||
188 | #define NUM_PRE_V60_I2C0_DEVICES 1 | ||
189 | |||
191 | static struct i2c_board_info __initdata mop500_i2c2_devices[] = { | 190 | static struct i2c_board_info __initdata mop500_i2c2_devices[] = { |
192 | { | 191 | { |
193 | /* lp5521 LED driver, 1st device */ | 192 | /* lp5521 LED driver, 1st device */ |
@@ -425,6 +424,8 @@ static void __init mop500_uart_init(void) | |||
425 | 424 | ||
426 | static void __init mop500_init_machine(void) | 425 | static void __init mop500_init_machine(void) |
427 | { | 426 | { |
427 | int i2c0_devs; | ||
428 | |||
428 | /* | 429 | /* |
429 | * The HREFv60 board removed a GPIO expander and routed | 430 | * The HREFv60 board removed a GPIO expander and routed |
430 | * all these GPIO pins to the internal GPIO controller | 431 | * all these GPIO pins to the internal GPIO controller |
@@ -448,11 +449,11 @@ static void __init mop500_init_machine(void) | |||
448 | 449 | ||
449 | platform_device_register(&ab8500_device); | 450 | platform_device_register(&ab8500_device); |
450 | 451 | ||
451 | i2c_register_board_info(0, mop500_i2c0_devices, | 452 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
452 | ARRAY_SIZE(mop500_i2c0_devices)); | 453 | if (machine_is_hrefv60()) |
453 | if (!machine_is_hrefv60()) | 454 | i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; |
454 | i2c_register_board_info(0, mop500_i2c0_old_devices, | 455 | |
455 | ARRAY_SIZE(mop500_i2c0_old_devices)); | 456 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
456 | i2c_register_board_info(2, mop500_i2c2_devices, | 457 | i2c_register_board_info(2, mop500_i2c2_devices, |
457 | ARRAY_SIZE(mop500_i2c2_devices)); | 458 | ARRAY_SIZE(mop500_i2c2_devices)); |
458 | } | 459 | } |
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index afe209e1e1f8..74be05f3e03a 100644 --- a/arch/arm/mm/mmap.c +++ b/arch/arm/mm/mmap.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/shm.h> | 7 | #include <linux/shm.h> |
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/io.h> | 9 | #include <linux/io.h> |
10 | #include <linux/personality.h> | ||
10 | #include <linux/random.h> | 11 | #include <linux/random.h> |
11 | #include <asm/cputype.h> | 12 | #include <asm/cputype.h> |
12 | #include <asm/system.h> | 13 | #include <asm/system.h> |
@@ -82,7 +83,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
82 | mm->cached_hole_size = 0; | 83 | mm->cached_hole_size = 0; |
83 | } | 84 | } |
84 | /* 8 bits of randomness in 20 address space bits */ | 85 | /* 8 bits of randomness in 20 address space bits */ |
85 | if (current->flags & PF_RANDOMIZE) | 86 | if ((current->flags & PF_RANDOMIZE) && |
87 | !(current->personality & ADDR_NO_RANDOMIZE)) | ||
86 | addr += (get_random_int() % (1 << 8)) << PAGE_SHIFT; | 88 | addr += (get_random_int() % (1 << 8)) << PAGE_SHIFT; |
87 | 89 | ||
88 | full_search: | 90 | full_search: |
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S index b46eb21f05c7..bf8a1d1cccb6 100644 --- a/arch/arm/mm/proc-arm920.S +++ b/arch/arm/mm/proc-arm920.S | |||
@@ -390,7 +390,7 @@ ENTRY(cpu_arm920_set_pte_ext) | |||
390 | /* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ | 390 | /* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ |
391 | .globl cpu_arm920_suspend_size | 391 | .globl cpu_arm920_suspend_size |
392 | .equ cpu_arm920_suspend_size, 4 * 3 | 392 | .equ cpu_arm920_suspend_size, 4 * 3 |
393 | #ifdef CONFIG_PM | 393 | #ifdef CONFIG_PM_SLEEP |
394 | ENTRY(cpu_arm920_do_suspend) | 394 | ENTRY(cpu_arm920_do_suspend) |
395 | stmfd sp!, {r4 - r7, lr} | 395 | stmfd sp!, {r4 - r7, lr} |
396 | mrc p15, 0, r4, c13, c0, 0 @ PID | 396 | mrc p15, 0, r4, c13, c0, 0 @ PID |
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S index 6a4bdb2c94a7..0ed85d930c09 100644 --- a/arch/arm/mm/proc-arm926.S +++ b/arch/arm/mm/proc-arm926.S | |||
@@ -404,7 +404,7 @@ ENTRY(cpu_arm926_set_pte_ext) | |||
404 | /* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ | 404 | /* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ |
405 | .globl cpu_arm926_suspend_size | 405 | .globl cpu_arm926_suspend_size |
406 | .equ cpu_arm926_suspend_size, 4 * 3 | 406 | .equ cpu_arm926_suspend_size, 4 * 3 |
407 | #ifdef CONFIG_PM | 407 | #ifdef CONFIG_PM_SLEEP |
408 | ENTRY(cpu_arm926_do_suspend) | 408 | ENTRY(cpu_arm926_do_suspend) |
409 | stmfd sp!, {r4 - r7, lr} | 409 | stmfd sp!, {r4 - r7, lr} |
410 | mrc p15, 0, r4, c13, c0, 0 @ PID | 410 | mrc p15, 0, r4, c13, c0, 0 @ PID |
diff --git a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S index 74483d1977fe..184a9c997e36 100644 --- a/arch/arm/mm/proc-sa1100.S +++ b/arch/arm/mm/proc-sa1100.S | |||
@@ -171,7 +171,7 @@ ENTRY(cpu_sa1100_set_pte_ext) | |||
171 | 171 | ||
172 | .globl cpu_sa1100_suspend_size | 172 | .globl cpu_sa1100_suspend_size |
173 | .equ cpu_sa1100_suspend_size, 4*4 | 173 | .equ cpu_sa1100_suspend_size, 4*4 |
174 | #ifdef CONFIG_PM | 174 | #ifdef CONFIG_PM_SLEEP |
175 | ENTRY(cpu_sa1100_do_suspend) | 175 | ENTRY(cpu_sa1100_do_suspend) |
176 | stmfd sp!, {r4 - r7, lr} | 176 | stmfd sp!, {r4 - r7, lr} |
177 | mrc p15, 0, r4, c3, c0, 0 @ domain ID | 177 | mrc p15, 0, r4, c3, c0, 0 @ domain ID |
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S index bfa0c9f611c5..7c99cb4c8e4f 100644 --- a/arch/arm/mm/proc-v6.S +++ b/arch/arm/mm/proc-v6.S | |||
@@ -124,7 +124,7 @@ ENTRY(cpu_v6_set_pte_ext) | |||
124 | /* Suspend/resume support: taken from arch/arm/mach-s3c64xx/sleep.S */ | 124 | /* Suspend/resume support: taken from arch/arm/mach-s3c64xx/sleep.S */ |
125 | .globl cpu_v6_suspend_size | 125 | .globl cpu_v6_suspend_size |
126 | .equ cpu_v6_suspend_size, 4 * 8 | 126 | .equ cpu_v6_suspend_size, 4 * 8 |
127 | #ifdef CONFIG_PM | 127 | #ifdef CONFIG_PM_SLEEP |
128 | ENTRY(cpu_v6_do_suspend) | 128 | ENTRY(cpu_v6_do_suspend) |
129 | stmfd sp!, {r4 - r11, lr} | 129 | stmfd sp!, {r4 - r11, lr} |
130 | mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID | 130 | mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID |
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index c35618e42f6f..babfba09c89f 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -211,7 +211,7 @@ cpu_v7_name: | |||
211 | /* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */ | 211 | /* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */ |
212 | .globl cpu_v7_suspend_size | 212 | .globl cpu_v7_suspend_size |
213 | .equ cpu_v7_suspend_size, 4 * 8 | 213 | .equ cpu_v7_suspend_size, 4 * 8 |
214 | #ifdef CONFIG_PM | 214 | #ifdef CONFIG_PM_SLEEP |
215 | ENTRY(cpu_v7_do_suspend) | 215 | ENTRY(cpu_v7_do_suspend) |
216 | stmfd sp!, {r4 - r11, lr} | 216 | stmfd sp!, {r4 - r11, lr} |
217 | mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID | 217 | mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID |
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S index 63d8b2044e84..596213699f37 100644 --- a/arch/arm/mm/proc-xsc3.S +++ b/arch/arm/mm/proc-xsc3.S | |||
@@ -417,7 +417,7 @@ ENTRY(cpu_xsc3_set_pte_ext) | |||
417 | 417 | ||
418 | .globl cpu_xsc3_suspend_size | 418 | .globl cpu_xsc3_suspend_size |
419 | .equ cpu_xsc3_suspend_size, 4 * 8 | 419 | .equ cpu_xsc3_suspend_size, 4 * 8 |
420 | #ifdef CONFIG_PM | 420 | #ifdef CONFIG_PM_SLEEP |
421 | ENTRY(cpu_xsc3_do_suspend) | 421 | ENTRY(cpu_xsc3_do_suspend) |
422 | stmfd sp!, {r4 - r10, lr} | 422 | stmfd sp!, {r4 - r10, lr} |
423 | mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode | 423 | mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode |
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S index 086038cd86ab..42af97664c9d 100644 --- a/arch/arm/mm/proc-xscale.S +++ b/arch/arm/mm/proc-xscale.S | |||
@@ -395,7 +395,7 @@ ENTRY(xscale_dma_a0_map_area) | |||
395 | teq r2, #DMA_TO_DEVICE | 395 | teq r2, #DMA_TO_DEVICE |
396 | beq xscale_dma_clean_range | 396 | beq xscale_dma_clean_range |
397 | b xscale_dma_flush_range | 397 | b xscale_dma_flush_range |
398 | ENDPROC(xscsale_dma_a0_map_area) | 398 | ENDPROC(xscale_dma_a0_map_area) |
399 | 399 | ||
400 | /* | 400 | /* |
401 | * dma_unmap_area(start, size, dir) | 401 | * dma_unmap_area(start, size, dir) |
@@ -518,7 +518,7 @@ ENTRY(cpu_xscale_set_pte_ext) | |||
518 | 518 | ||
519 | .globl cpu_xscale_suspend_size | 519 | .globl cpu_xscale_suspend_size |
520 | .equ cpu_xscale_suspend_size, 4 * 7 | 520 | .equ cpu_xscale_suspend_size, 4 * 7 |
521 | #ifdef CONFIG_PM | 521 | #ifdef CONFIG_PM_SLEEP |
522 | ENTRY(cpu_xscale_do_suspend) | 522 | ENTRY(cpu_xscale_do_suspend) |
523 | stmfd sp!, {r4 - r10, lr} | 523 | stmfd sp!, {r4 - r10, lr} |
524 | mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode | 524 | mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode |
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c index 7a107246fd98..6cd6d7f686f6 100644 --- a/arch/arm/plat-mxc/gpio.c +++ b/arch/arm/plat-mxc/gpio.c | |||
@@ -295,6 +295,12 @@ static int mxc_gpio_direction_output(struct gpio_chip *chip, | |||
295 | return 0; | 295 | return 0; |
296 | } | 296 | } |
297 | 297 | ||
298 | /* | ||
299 | * This lock class tells lockdep that GPIO irqs are in a different | ||
300 | * category than their parents, so it won't report false recursion. | ||
301 | */ | ||
302 | static struct lock_class_key gpio_lock_class; | ||
303 | |||
298 | int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt) | 304 | int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt) |
299 | { | 305 | { |
300 | int i, j; | 306 | int i, j; |
@@ -311,6 +317,7 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt) | |||
311 | __raw_writel(~0, port[i].base + GPIO_ISR); | 317 | __raw_writel(~0, port[i].base + GPIO_ISR); |
312 | for (j = port[i].virtual_irq_start; | 318 | for (j = port[i].virtual_irq_start; |
313 | j < port[i].virtual_irq_start + 32; j++) { | 319 | j < port[i].virtual_irq_start + 32; j++) { |
320 | irq_set_lockdep_class(j, &gpio_lock_class); | ||
314 | irq_set_chip_and_handler(j, &gpio_irq_chip, | 321 | irq_set_chip_and_handler(j, &gpio_irq_chip, |
315 | handle_level_irq); | 322 | handle_level_irq); |
316 | set_irq_flags(j, IRQF_VALID); | 323 | set_irq_flags(j, IRQF_VALID); |
diff --git a/arch/arm/plat-mxc/ssi-fiq.S b/arch/arm/plat-mxc/ssi-fiq.S index 4ddce565b353..8397a2dd19f2 100644 --- a/arch/arm/plat-mxc/ssi-fiq.S +++ b/arch/arm/plat-mxc/ssi-fiq.S | |||
@@ -124,6 +124,8 @@ imx_ssi_fiq_start: | |||
124 | 1: | 124 | 1: |
125 | @ return from FIQ | 125 | @ return from FIQ |
126 | subs pc, lr, #4 | 126 | subs pc, lr, #4 |
127 | |||
128 | .align | ||
127 | imx_ssi_fiq_base: | 129 | imx_ssi_fiq_base: |
128 | .word 0x0 | 130 | .word 0x0 |
129 | imx_ssi_fiq_rx_buffer: | 131 | imx_ssi_fiq_rx_buffer: |
diff --git a/arch/arm/plat-s5p/pm.c b/arch/arm/plat-s5p/pm.c index d592b6304b48..d15dc47b0e3d 100644 --- a/arch/arm/plat-s5p/pm.c +++ b/arch/arm/plat-s5p/pm.c | |||
@@ -19,17 +19,6 @@ | |||
19 | 19 | ||
20 | #define PFX "s5p pm: " | 20 | #define PFX "s5p pm: " |
21 | 21 | ||
22 | /* s3c_pm_check_resume_pin | ||
23 | * | ||
24 | * check to see if the pin is configured correctly for sleep mode, and | ||
25 | * make any necessary adjustments if it is not | ||
26 | */ | ||
27 | |||
28 | static void s3c_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs) | ||
29 | { | ||
30 | /* nothing here yet */ | ||
31 | } | ||
32 | |||
33 | /* s3c_pm_configure_extint | 22 | /* s3c_pm_configure_extint |
34 | * | 23 | * |
35 | * configure all external interrupt pins | 24 | * configure all external interrupt pins |
diff --git a/arch/arm/plat-samsung/pm-check.c b/arch/arm/plat-samsung/pm-check.c index e4baf76f374a..6b733fafe7cd 100644 --- a/arch/arm/plat-samsung/pm-check.c +++ b/arch/arm/plat-samsung/pm-check.c | |||
@@ -164,7 +164,6 @@ static inline int in_region(void *ptr, int size, void *what, size_t whatsz) | |||
164 | */ | 164 | */ |
165 | static u32 *s3c_pm_runcheck(struct resource *res, u32 *val) | 165 | static u32 *s3c_pm_runcheck(struct resource *res, u32 *val) |
166 | { | 166 | { |
167 | void *save_at = phys_to_virt(s3c_sleep_save_phys); | ||
168 | unsigned long addr; | 167 | unsigned long addr; |
169 | unsigned long left; | 168 | unsigned long left; |
170 | void *stkpage; | 169 | void *stkpage; |
@@ -192,11 +191,6 @@ static u32 *s3c_pm_runcheck(struct resource *res, u32 *val) | |||
192 | goto skip_check; | 191 | goto skip_check; |
193 | } | 192 | } |
194 | 193 | ||
195 | if (in_region(ptr, left, save_at, 32*4 )) { | ||
196 | S3C_PMDBG("skipping %08lx, has save block in\n", addr); | ||
197 | goto skip_check; | ||
198 | } | ||
199 | |||
200 | /* calculate and check the checksum */ | 194 | /* calculate and check the checksum */ |
201 | 195 | ||
202 | calc = crc32_le(~0, ptr, left); | 196 | calc = crc32_le(~0, ptr, left); |
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c index d5b58d31903c..5c0a440d6e16 100644 --- a/arch/arm/plat-samsung/pm.c +++ b/arch/arm/plat-samsung/pm.c | |||
@@ -214,8 +214,9 @@ void s3c_pm_do_restore_core(struct sleep_save *ptr, int count) | |||
214 | * | 214 | * |
215 | * print any IRQs asserted at resume time (ie, we woke from) | 215 | * print any IRQs asserted at resume time (ie, we woke from) |
216 | */ | 216 | */ |
217 | static void s3c_pm_show_resume_irqs(int start, unsigned long which, | 217 | static void __maybe_unused s3c_pm_show_resume_irqs(int start, |
218 | unsigned long mask) | 218 | unsigned long which, |
219 | unsigned long mask) | ||
219 | { | 220 | { |
220 | int i; | 221 | int i; |
221 | 222 | ||
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index bbf3da012afd..f74695075e64 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c | |||
@@ -78,6 +78,14 @@ static void vfp_thread_exit(struct thread_info *thread) | |||
78 | put_cpu(); | 78 | put_cpu(); |
79 | } | 79 | } |
80 | 80 | ||
81 | static void vfp_thread_copy(struct thread_info *thread) | ||
82 | { | ||
83 | struct thread_info *parent = current_thread_info(); | ||
84 | |||
85 | vfp_sync_hwstate(parent); | ||
86 | thread->vfpstate = parent->vfpstate; | ||
87 | } | ||
88 | |||
81 | /* | 89 | /* |
82 | * When this function is called with the following 'cmd's, the following | 90 | * When this function is called with the following 'cmd's, the following |
83 | * is true while this function is being run: | 91 | * is true while this function is being run: |
@@ -104,12 +112,17 @@ static void vfp_thread_exit(struct thread_info *thread) | |||
104 | static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v) | 112 | static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v) |
105 | { | 113 | { |
106 | struct thread_info *thread = v; | 114 | struct thread_info *thread = v; |
115 | u32 fpexc; | ||
116 | #ifdef CONFIG_SMP | ||
117 | unsigned int cpu; | ||
118 | #endif | ||
107 | 119 | ||
108 | if (likely(cmd == THREAD_NOTIFY_SWITCH)) { | 120 | switch (cmd) { |
109 | u32 fpexc = fmrx(FPEXC); | 121 | case THREAD_NOTIFY_SWITCH: |
122 | fpexc = fmrx(FPEXC); | ||
110 | 123 | ||
111 | #ifdef CONFIG_SMP | 124 | #ifdef CONFIG_SMP |
112 | unsigned int cpu = thread->cpu; | 125 | cpu = thread->cpu; |
113 | 126 | ||
114 | /* | 127 | /* |
115 | * On SMP, if VFP is enabled, save the old state in | 128 | * On SMP, if VFP is enabled, save the old state in |
@@ -134,13 +147,20 @@ static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v) | |||
134 | * old state. | 147 | * old state. |
135 | */ | 148 | */ |
136 | fmxr(FPEXC, fpexc & ~FPEXC_EN); | 149 | fmxr(FPEXC, fpexc & ~FPEXC_EN); |
137 | return NOTIFY_DONE; | 150 | break; |
138 | } | ||
139 | 151 | ||
140 | if (cmd == THREAD_NOTIFY_FLUSH) | 152 | case THREAD_NOTIFY_FLUSH: |
141 | vfp_thread_flush(thread); | 153 | vfp_thread_flush(thread); |
142 | else | 154 | break; |
155 | |||
156 | case THREAD_NOTIFY_EXIT: | ||
143 | vfp_thread_exit(thread); | 157 | vfp_thread_exit(thread); |
158 | break; | ||
159 | |||
160 | case THREAD_NOTIFY_COPY: | ||
161 | vfp_thread_copy(thread); | ||
162 | break; | ||
163 | } | ||
144 | 164 | ||
145 | return NOTIFY_DONE; | 165 | return NOTIFY_DONE; |
146 | } | 166 | } |
diff --git a/arch/avr32/include/asm/setup.h b/arch/avr32/include/asm/setup.h index ff5b7cf6be4d..160543dbec7e 100644 --- a/arch/avr32/include/asm/setup.h +++ b/arch/avr32/include/asm/setup.h | |||
@@ -94,6 +94,13 @@ struct tag_ethernet { | |||
94 | 94 | ||
95 | #define ETH_INVALID_PHY 0xff | 95 | #define ETH_INVALID_PHY 0xff |
96 | 96 | ||
97 | /* board information */ | ||
98 | #define ATAG_BOARDINFO 0x54410008 | ||
99 | |||
100 | struct tag_boardinfo { | ||
101 | u32 board_number; | ||
102 | }; | ||
103 | |||
97 | struct tag { | 104 | struct tag { |
98 | struct tag_header hdr; | 105 | struct tag_header hdr; |
99 | union { | 106 | union { |
@@ -102,6 +109,7 @@ struct tag { | |||
102 | struct tag_cmdline cmdline; | 109 | struct tag_cmdline cmdline; |
103 | struct tag_clock clock; | 110 | struct tag_clock clock; |
104 | struct tag_ethernet ethernet; | 111 | struct tag_ethernet ethernet; |
112 | struct tag_boardinfo boardinfo; | ||
105 | } u; | 113 | } u; |
106 | }; | 114 | }; |
107 | 115 | ||
@@ -128,6 +136,7 @@ extern struct tag *bootloader_tags; | |||
128 | 136 | ||
129 | extern resource_size_t fbmem_start; | 137 | extern resource_size_t fbmem_start; |
130 | extern resource_size_t fbmem_size; | 138 | extern resource_size_t fbmem_size; |
139 | extern u32 board_number; | ||
131 | 140 | ||
132 | void setup_processor(void); | 141 | void setup_processor(void); |
133 | 142 | ||
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c index 5c7083916c33..bb0974cce4ac 100644 --- a/arch/avr32/kernel/setup.c +++ b/arch/avr32/kernel/setup.c | |||
@@ -391,6 +391,21 @@ static int __init parse_tag_clock(struct tag *tag) | |||
391 | __tagtable(ATAG_CLOCK, parse_tag_clock); | 391 | __tagtable(ATAG_CLOCK, parse_tag_clock); |
392 | 392 | ||
393 | /* | 393 | /* |
394 | * The board_number correspond to the bd->bi_board_number in U-Boot. This | ||
395 | * parameter is only available during initialisation and can be used in some | ||
396 | * kind of board identification. | ||
397 | */ | ||
398 | u32 __initdata board_number; | ||
399 | |||
400 | static int __init parse_tag_boardinfo(struct tag *tag) | ||
401 | { | ||
402 | board_number = tag->u.boardinfo.board_number; | ||
403 | |||
404 | return 0; | ||
405 | } | ||
406 | __tagtable(ATAG_BOARDINFO, parse_tag_boardinfo); | ||
407 | |||
408 | /* | ||
394 | * Scan the tag table for this tag, and call its parse function. The | 409 | * Scan the tag table for this tag, and call its parse function. The |
395 | * tag table is built by the linker from all the __tagtable | 410 | * tag table is built by the linker from all the __tagtable |
396 | * declarations. | 411 | * declarations. |
diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c index b91b2044af9c..7aa25756412f 100644 --- a/arch/avr32/kernel/traps.c +++ b/arch/avr32/kernel/traps.c | |||
@@ -95,28 +95,6 @@ void _exception(long signr, struct pt_regs *regs, int code, | |||
95 | info.si_code = code; | 95 | info.si_code = code; |
96 | info.si_addr = (void __user *)addr; | 96 | info.si_addr = (void __user *)addr; |
97 | force_sig_info(signr, &info, current); | 97 | force_sig_info(signr, &info, current); |
98 | |||
99 | /* | ||
100 | * Init gets no signals that it doesn't have a handler for. | ||
101 | * That's all very well, but if it has caused a synchronous | ||
102 | * exception and we ignore the resulting signal, it will just | ||
103 | * generate the same exception over and over again and we get | ||
104 | * nowhere. Better to kill it and let the kernel panic. | ||
105 | */ | ||
106 | if (is_global_init(current)) { | ||
107 | __sighandler_t handler; | ||
108 | |||
109 | spin_lock_irq(¤t->sighand->siglock); | ||
110 | handler = current->sighand->action[signr-1].sa.sa_handler; | ||
111 | spin_unlock_irq(¤t->sighand->siglock); | ||
112 | if (handler == SIG_DFL) { | ||
113 | /* init has generated a synchronous exception | ||
114 | and it doesn't have a handler for the signal */ | ||
115 | printk(KERN_CRIT "init has generated signal %ld " | ||
116 | "but has no handler for it\n", signr); | ||
117 | do_exit(signr); | ||
118 | } | ||
119 | } | ||
120 | } | 98 | } |
121 | 99 | ||
122 | asmlinkage void do_nmi(unsigned long ecr, struct pt_regs *regs) | 100 | asmlinkage void do_nmi(unsigned long ecr, struct pt_regs *regs) |
diff --git a/arch/avr32/mach-at32ap/clock.c b/arch/avr32/mach-at32ap/clock.c index 442f08c5e641..86925fd6ea5b 100644 --- a/arch/avr32/mach-at32ap/clock.c +++ b/arch/avr32/mach-at32ap/clock.c | |||
@@ -35,22 +35,30 @@ void at32_clk_register(struct clk *clk) | |||
35 | spin_unlock(&clk_list_lock); | 35 | spin_unlock(&clk_list_lock); |
36 | } | 36 | } |
37 | 37 | ||
38 | struct clk *clk_get(struct device *dev, const char *id) | 38 | static struct clk *__clk_get(struct device *dev, const char *id) |
39 | { | 39 | { |
40 | struct clk *clk; | 40 | struct clk *clk; |
41 | 41 | ||
42 | spin_lock(&clk_list_lock); | ||
43 | |||
44 | list_for_each_entry(clk, &at32_clock_list, list) { | 42 | list_for_each_entry(clk, &at32_clock_list, list) { |
45 | if (clk->dev == dev && strcmp(id, clk->name) == 0) { | 43 | if (clk->dev == dev && strcmp(id, clk->name) == 0) { |
46 | spin_unlock(&clk_list_lock); | ||
47 | return clk; | 44 | return clk; |
48 | } | 45 | } |
49 | } | 46 | } |
50 | 47 | ||
51 | spin_unlock(&clk_list_lock); | ||
52 | return ERR_PTR(-ENOENT); | 48 | return ERR_PTR(-ENOENT); |
53 | } | 49 | } |
50 | |||
51 | struct clk *clk_get(struct device *dev, const char *id) | ||
52 | { | ||
53 | struct clk *clk; | ||
54 | |||
55 | spin_lock(&clk_list_lock); | ||
56 | clk = __clk_get(dev, id); | ||
57 | spin_unlock(&clk_list_lock); | ||
58 | |||
59 | return clk; | ||
60 | } | ||
61 | |||
54 | EXPORT_SYMBOL(clk_get); | 62 | EXPORT_SYMBOL(clk_get); |
55 | 63 | ||
56 | void clk_put(struct clk *clk) | 64 | void clk_put(struct clk *clk) |
@@ -257,15 +265,15 @@ static int clk_show(struct seq_file *s, void *unused) | |||
257 | spin_lock(&clk_list_lock); | 265 | spin_lock(&clk_list_lock); |
258 | 266 | ||
259 | /* show clock tree as derived from the three oscillators */ | 267 | /* show clock tree as derived from the three oscillators */ |
260 | clk = clk_get(NULL, "osc32k"); | 268 | clk = __clk_get(NULL, "osc32k"); |
261 | dump_clock(clk, &r); | 269 | dump_clock(clk, &r); |
262 | clk_put(clk); | 270 | clk_put(clk); |
263 | 271 | ||
264 | clk = clk_get(NULL, "osc0"); | 272 | clk = __clk_get(NULL, "osc0"); |
265 | dump_clock(clk, &r); | 273 | dump_clock(clk, &r); |
266 | clk_put(clk); | 274 | clk_put(clk); |
267 | 275 | ||
268 | clk = clk_get(NULL, "osc1"); | 276 | clk = __clk_get(NULL, "osc1"); |
269 | dump_clock(clk, &r); | 277 | dump_clock(clk, &r); |
270 | clk_put(clk); | 278 | clk_put(clk); |
271 | 279 | ||
diff --git a/arch/avr32/mach-at32ap/extint.c b/arch/avr32/mach-at32ap/extint.c index 47ba4b9b6db1..fbc2aeaebddb 100644 --- a/arch/avr32/mach-at32ap/extint.c +++ b/arch/avr32/mach-at32ap/extint.c | |||
@@ -61,34 +61,34 @@ struct eic { | |||
61 | static struct eic *nmi_eic; | 61 | static struct eic *nmi_eic; |
62 | static bool nmi_enabled; | 62 | static bool nmi_enabled; |
63 | 63 | ||
64 | static void eic_ack_irq(struct irq_chip *d) | 64 | static void eic_ack_irq(struct irq_data *d) |
65 | { | 65 | { |
66 | struct eic *eic = irq_data_get_irq_chip_data(data); | 66 | struct eic *eic = irq_data_get_irq_chip_data(d); |
67 | eic_writel(eic, ICR, 1 << (d->irq - eic->first_irq)); | 67 | eic_writel(eic, ICR, 1 << (d->irq - eic->first_irq)); |
68 | } | 68 | } |
69 | 69 | ||
70 | static void eic_mask_irq(struct irq_chip *d) | 70 | static void eic_mask_irq(struct irq_data *d) |
71 | { | 71 | { |
72 | struct eic *eic = irq_data_get_irq_chip_data(data); | 72 | struct eic *eic = irq_data_get_irq_chip_data(d); |
73 | eic_writel(eic, IDR, 1 << (d->irq - eic->first_irq)); | 73 | eic_writel(eic, IDR, 1 << (d->irq - eic->first_irq)); |
74 | } | 74 | } |
75 | 75 | ||
76 | static void eic_mask_ack_irq(struct irq_chip *d) | 76 | static void eic_mask_ack_irq(struct irq_data *d) |
77 | { | 77 | { |
78 | struct eic *eic = irq_data_get_irq_chip_data(data); | 78 | struct eic *eic = irq_data_get_irq_chip_data(d); |
79 | eic_writel(eic, ICR, 1 << (d->irq - eic->first_irq)); | 79 | eic_writel(eic, ICR, 1 << (d->irq - eic->first_irq)); |
80 | eic_writel(eic, IDR, 1 << (d->irq - eic->first_irq)); | 80 | eic_writel(eic, IDR, 1 << (d->irq - eic->first_irq)); |
81 | } | 81 | } |
82 | 82 | ||
83 | static void eic_unmask_irq(struct irq_chip *d) | 83 | static void eic_unmask_irq(struct irq_data *d) |
84 | { | 84 | { |
85 | struct eic *eic = irq_data_get_irq_chip_data(data); | 85 | struct eic *eic = irq_data_get_irq_chip_data(d); |
86 | eic_writel(eic, IER, 1 << (d->irq - eic->first_irq)); | 86 | eic_writel(eic, IER, 1 << (d->irq - eic->first_irq)); |
87 | } | 87 | } |
88 | 88 | ||
89 | static int eic_set_irq_type(struct irq_chip *d, unsigned int flow_type) | 89 | static int eic_set_irq_type(struct irq_data *d, unsigned int flow_type) |
90 | { | 90 | { |
91 | struct eic *eic = irq_data_get_irq_chip_data(data); | 91 | struct eic *eic = irq_data_get_irq_chip_data(d); |
92 | unsigned int irq = d->irq; | 92 | unsigned int irq = d->irq; |
93 | unsigned int i = irq - eic->first_irq; | 93 | unsigned int i = irq - eic->first_irq; |
94 | u32 mode, edge, level; | 94 | u32 mode, edge, level; |
@@ -191,7 +191,7 @@ static int __init eic_probe(struct platform_device *pdev) | |||
191 | 191 | ||
192 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 192 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
193 | int_irq = platform_get_irq(pdev, 0); | 193 | int_irq = platform_get_irq(pdev, 0); |
194 | if (!regs || !int_irq) { | 194 | if (!regs || (int)int_irq <= 0) { |
195 | dev_dbg(&pdev->dev, "missing regs and/or irq resource\n"); | 195 | dev_dbg(&pdev->dev, "missing regs and/or irq resource\n"); |
196 | return -ENXIO; | 196 | return -ENXIO; |
197 | } | 197 | } |
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c index f308e1ddc629..2e0aa853a4bc 100644 --- a/arch/avr32/mach-at32ap/pio.c +++ b/arch/avr32/mach-at32ap/pio.c | |||
@@ -257,7 +257,7 @@ static void gpio_irq_mask(struct irq_data *d) | |||
257 | pio_writel(pio, IDR, 1 << (gpio & 0x1f)); | 257 | pio_writel(pio, IDR, 1 << (gpio & 0x1f)); |
258 | } | 258 | } |
259 | 259 | ||
260 | static void gpio_irq_unmask(struct irq_data *d)) | 260 | static void gpio_irq_unmask(struct irq_data *d) |
261 | { | 261 | { |
262 | unsigned gpio = irq_to_gpio(d->irq); | 262 | unsigned gpio = irq_to_gpio(d->irq); |
263 | struct pio_device *pio = &pio_dev[gpio >> 5]; | 263 | struct pio_device *pio = &pio_dev[gpio >> 5]; |
diff --git a/arch/avr32/mach-at32ap/pm-at32ap700x.S b/arch/avr32/mach-at32ap/pm-at32ap700x.S index 17503b0ed6c9..f868f4ce761b 100644 --- a/arch/avr32/mach-at32ap/pm-at32ap700x.S +++ b/arch/avr32/mach-at32ap/pm-at32ap700x.S | |||
@@ -53,7 +53,7 @@ cpu_enter_idle: | |||
53 | st.w r8[TI_flags], r9 | 53 | st.w r8[TI_flags], r9 |
54 | unmask_interrupts | 54 | unmask_interrupts |
55 | sleep CPU_SLEEP_IDLE | 55 | sleep CPU_SLEEP_IDLE |
56 | .size cpu_idle_sleep, . - cpu_idle_sleep | 56 | .size cpu_enter_idle, . - cpu_enter_idle |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * Common return path for PM functions that don't run from | 59 | * Common return path for PM functions that don't run from |
diff --git a/arch/blackfin/include/asm/system.h b/arch/blackfin/include/asm/system.h index 19e2c7c3e63a..44bd0cced725 100644 --- a/arch/blackfin/include/asm/system.h +++ b/arch/blackfin/include/asm/system.h | |||
@@ -19,11 +19,11 @@ | |||
19 | * Force strict CPU ordering. | 19 | * Force strict CPU ordering. |
20 | */ | 20 | */ |
21 | #define nop() __asm__ __volatile__ ("nop;\n\t" : : ) | 21 | #define nop() __asm__ __volatile__ ("nop;\n\t" : : ) |
22 | #define mb() __asm__ __volatile__ ("" : : : "memory") | 22 | #define smp_mb() mb() |
23 | #define rmb() __asm__ __volatile__ ("" : : : "memory") | 23 | #define smp_rmb() rmb() |
24 | #define wmb() __asm__ __volatile__ ("" : : : "memory") | 24 | #define smp_wmb() wmb() |
25 | #define set_mb(var, value) do { (void) xchg(&var, value); } while (0) | 25 | #define set_mb(var, value) do { var = value; mb(); } while (0) |
26 | #define read_barrier_depends() do { } while(0) | 26 | #define smp_read_barrier_depends() read_barrier_depends() |
27 | 27 | ||
28 | #ifdef CONFIG_SMP | 28 | #ifdef CONFIG_SMP |
29 | asmlinkage unsigned long __raw_xchg_1_asm(volatile void *ptr, unsigned long value); | 29 | asmlinkage unsigned long __raw_xchg_1_asm(volatile void *ptr, unsigned long value); |
@@ -37,16 +37,16 @@ asmlinkage unsigned long __raw_cmpxchg_4_asm(volatile void *ptr, | |||
37 | unsigned long new, unsigned long old); | 37 | unsigned long new, unsigned long old); |
38 | 38 | ||
39 | #ifdef __ARCH_SYNC_CORE_DCACHE | 39 | #ifdef __ARCH_SYNC_CORE_DCACHE |
40 | # define smp_mb() do { barrier(); smp_check_barrier(); smp_mark_barrier(); } while (0) | 40 | /* Force Core data cache coherence */ |
41 | # define smp_rmb() do { barrier(); smp_check_barrier(); } while (0) | 41 | # define mb() do { barrier(); smp_check_barrier(); smp_mark_barrier(); } while (0) |
42 | # define smp_wmb() do { barrier(); smp_mark_barrier(); } while (0) | 42 | # define rmb() do { barrier(); smp_check_barrier(); } while (0) |
43 | #define smp_read_barrier_depends() do { barrier(); smp_check_barrier(); } while (0) | 43 | # define wmb() do { barrier(); smp_mark_barrier(); } while (0) |
44 | 44 | # define read_barrier_depends() do { barrier(); smp_check_barrier(); } while (0) | |
45 | #else | 45 | #else |
46 | # define smp_mb() barrier() | 46 | # define mb() barrier() |
47 | # define smp_rmb() barrier() | 47 | # define rmb() barrier() |
48 | # define smp_wmb() barrier() | 48 | # define wmb() barrier() |
49 | #define smp_read_barrier_depends() barrier() | 49 | # define read_barrier_depends() do { } while (0) |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | static inline unsigned long __xchg(unsigned long x, volatile void *ptr, | 52 | static inline unsigned long __xchg(unsigned long x, volatile void *ptr, |
@@ -99,10 +99,10 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, | |||
99 | 99 | ||
100 | #else /* !CONFIG_SMP */ | 100 | #else /* !CONFIG_SMP */ |
101 | 101 | ||
102 | #define smp_mb() barrier() | 102 | #define mb() barrier() |
103 | #define smp_rmb() barrier() | 103 | #define rmb() barrier() |
104 | #define smp_wmb() barrier() | 104 | #define wmb() barrier() |
105 | #define smp_read_barrier_depends() do { } while(0) | 105 | #define read_barrier_depends() do { } while (0) |
106 | 106 | ||
107 | struct __xchg_dummy { | 107 | struct __xchg_dummy { |
108 | unsigned long a[100]; | 108 | unsigned long a[100]; |
diff --git a/arch/blackfin/kernel/gptimers.c b/arch/blackfin/kernel/gptimers.c index cdbe075de1dc..8b81dc04488a 100644 --- a/arch/blackfin/kernel/gptimers.c +++ b/arch/blackfin/kernel/gptimers.c | |||
@@ -268,7 +268,7 @@ void disable_gptimers(uint16_t mask) | |||
268 | _disable_gptimers(mask); | 268 | _disable_gptimers(mask); |
269 | for (i = 0; i < MAX_BLACKFIN_GPTIMERS; ++i) | 269 | for (i = 0; i < MAX_BLACKFIN_GPTIMERS; ++i) |
270 | if (mask & (1 << i)) | 270 | if (mask & (1 << i)) |
271 | group_regs[BFIN_TIMER_OCTET(i)]->status |= trun_mask[i]; | 271 | group_regs[BFIN_TIMER_OCTET(i)]->status = trun_mask[i]; |
272 | SSYNC(); | 272 | SSYNC(); |
273 | } | 273 | } |
274 | EXPORT_SYMBOL(disable_gptimers); | 274 | EXPORT_SYMBOL(disable_gptimers); |
diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c index 8c9a43daf80f..cdb4beb6bc8f 100644 --- a/arch/blackfin/kernel/time-ts.c +++ b/arch/blackfin/kernel/time-ts.c | |||
@@ -206,8 +206,14 @@ irqreturn_t bfin_gptmr0_interrupt(int irq, void *dev_id) | |||
206 | { | 206 | { |
207 | struct clock_event_device *evt = dev_id; | 207 | struct clock_event_device *evt = dev_id; |
208 | smp_mb(); | 208 | smp_mb(); |
209 | evt->event_handler(evt); | 209 | /* |
210 | * We want to ACK before we handle so that we can handle smaller timer | ||
211 | * intervals. This way if the timer expires again while we're handling | ||
212 | * things, we're more likely to see that 2nd int rather than swallowing | ||
213 | * it by ACKing the int at the end of this handler. | ||
214 | */ | ||
210 | bfin_gptmr0_ack(); | 215 | bfin_gptmr0_ack(); |
216 | evt->event_handler(evt); | ||
211 | return IRQ_HANDLED; | 217 | return IRQ_HANDLED; |
212 | } | 218 | } |
213 | 219 | ||
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c index 6e17a265c4d3..8bce5ed031e4 100644 --- a/arch/blackfin/mach-common/smp.c +++ b/arch/blackfin/mach-common/smp.c | |||
@@ -109,10 +109,23 @@ static void ipi_flush_icache(void *info) | |||
109 | struct blackfin_flush_data *fdata = info; | 109 | struct blackfin_flush_data *fdata = info; |
110 | 110 | ||
111 | /* Invalidate the memory holding the bounds of the flushed region. */ | 111 | /* Invalidate the memory holding the bounds of the flushed region. */ |
112 | invalidate_dcache_range((unsigned long)fdata, | 112 | blackfin_dcache_invalidate_range((unsigned long)fdata, |
113 | (unsigned long)fdata + sizeof(*fdata)); | 113 | (unsigned long)fdata + sizeof(*fdata)); |
114 | |||
115 | /* Make sure all write buffers in the data side of the core | ||
116 | * are flushed before trying to invalidate the icache. This | ||
117 | * needs to be after the data flush and before the icache | ||
118 | * flush so that the SSYNC does the right thing in preventing | ||
119 | * the instruction prefetcher from hitting things in cached | ||
120 | * memory at the wrong time -- it runs much further ahead than | ||
121 | * the pipeline. | ||
122 | */ | ||
123 | SSYNC(); | ||
114 | 124 | ||
115 | flush_icache_range(fdata->start, fdata->end); | 125 | /* ipi_flaush_icache is invoked by generic flush_icache_range, |
126 | * so call blackfin arch icache flush directly here. | ||
127 | */ | ||
128 | blackfin_icache_flush_range(fdata->start, fdata->end); | ||
116 | } | 129 | } |
117 | 130 | ||
118 | static void ipi_call_function(unsigned int cpu, struct ipi_message *msg) | 131 | static void ipi_call_function(unsigned int cpu, struct ipi_message *msg) |
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 26d851d385bb..29e17907d9f2 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
@@ -343,10 +343,14 @@ | |||
343 | #define __NR_fanotify_init 337 | 343 | #define __NR_fanotify_init 337 |
344 | #define __NR_fanotify_mark 338 | 344 | #define __NR_fanotify_mark 338 |
345 | #define __NR_prlimit64 339 | 345 | #define __NR_prlimit64 339 |
346 | #define __NR_name_to_handle_at 340 | ||
347 | #define __NR_open_by_handle_at 341 | ||
348 | #define __NR_clock_adjtime 342 | ||
349 | #define __NR_syncfs 343 | ||
346 | 350 | ||
347 | #ifdef __KERNEL__ | 351 | #ifdef __KERNEL__ |
348 | 352 | ||
349 | #define NR_syscalls 340 | 353 | #define NR_syscalls 344 |
350 | 354 | ||
351 | #define __ARCH_WANT_IPC_PARSE_VERSION | 355 | #define __ARCH_WANT_IPC_PARSE_VERSION |
352 | #define __ARCH_WANT_OLD_READDIR | 356 | #define __ARCH_WANT_OLD_READDIR |
diff --git a/arch/m68k/kernel/entry_mm.S b/arch/m68k/kernel/entry_mm.S index 1559dea36e55..1359ee659574 100644 --- a/arch/m68k/kernel/entry_mm.S +++ b/arch/m68k/kernel/entry_mm.S | |||
@@ -750,4 +750,8 @@ sys_call_table: | |||
750 | .long sys_fanotify_init | 750 | .long sys_fanotify_init |
751 | .long sys_fanotify_mark | 751 | .long sys_fanotify_mark |
752 | .long sys_prlimit64 | 752 | .long sys_prlimit64 |
753 | .long sys_name_to_handle_at /* 340 */ | ||
754 | .long sys_open_by_handle_at | ||
755 | .long sys_clock_adjtime | ||
756 | .long sys_syncfs | ||
753 | 757 | ||
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S index 79b1ed198c07..9b8393d8adb8 100644 --- a/arch/m68k/kernel/syscalltable.S +++ b/arch/m68k/kernel/syscalltable.S | |||
@@ -358,6 +358,10 @@ ENTRY(sys_call_table) | |||
358 | .long sys_fanotify_init | 358 | .long sys_fanotify_init |
359 | .long sys_fanotify_mark | 359 | .long sys_fanotify_mark |
360 | .long sys_prlimit64 | 360 | .long sys_prlimit64 |
361 | .long sys_name_to_handle_at /* 340 */ | ||
362 | .long sys_open_by_handle_at | ||
363 | .long sys_clock_adjtime | ||
364 | .long sys_syncfs | ||
361 | 365 | ||
362 | .rept NR_syscalls-(.-sys_call_table)/4 | 366 | .rept NR_syscalls-(.-sys_call_table)/4 |
363 | .long sys_ni_syscall | 367 | .long sys_ni_syscall |
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index 02b7a03e4226..8b3db1c587fc 100644 --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c | |||
@@ -300,6 +300,8 @@ void __init paging_init(void) | |||
300 | zones_size[ZONE_DMA] = m68k_memory[i].size >> PAGE_SHIFT; | 300 | zones_size[ZONE_DMA] = m68k_memory[i].size >> PAGE_SHIFT; |
301 | free_area_init_node(i, zones_size, | 301 | free_area_init_node(i, zones_size, |
302 | m68k_memory[i].addr >> PAGE_SHIFT, NULL); | 302 | m68k_memory[i].addr >> PAGE_SHIFT, NULL); |
303 | if (node_present_pages(i)) | ||
304 | node_set_state(i, N_NORMAL_MEMORY); | ||
303 | } | 305 | } |
304 | } | 306 | } |
305 | 307 | ||
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 851b3bf6e962..eccdefe70d4e 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
@@ -6,7 +6,6 @@ config MICROBLAZE | |||
6 | select HAVE_FUNCTION_GRAPH_TRACER | 6 | select HAVE_FUNCTION_GRAPH_TRACER |
7 | select HAVE_DYNAMIC_FTRACE | 7 | select HAVE_DYNAMIC_FTRACE |
8 | select HAVE_FTRACE_MCOUNT_RECORD | 8 | select HAVE_FTRACE_MCOUNT_RECORD |
9 | select USB_ARCH_HAS_EHCI | ||
10 | select ARCH_WANT_OPTIONAL_GPIOLIB | 9 | select ARCH_WANT_OPTIONAL_GPIOLIB |
11 | select HAVE_OPROFILE | 10 | select HAVE_OPROFILE |
12 | select HAVE_ARCH_KGDB | 11 | select HAVE_ARCH_KGDB |
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index b7ed8d7a9b33..b1d126258dee 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
@@ -266,8 +266,10 @@ static void __init setup_bootmem(void) | |||
266 | } | 266 | } |
267 | memset(pfnnid_map, 0xff, sizeof(pfnnid_map)); | 267 | memset(pfnnid_map, 0xff, sizeof(pfnnid_map)); |
268 | 268 | ||
269 | for (i = 0; i < npmem_ranges; i++) | 269 | for (i = 0; i < npmem_ranges; i++) { |
270 | node_set_state(i, N_NORMAL_MEMORY); | ||
270 | node_set_online(i); | 271 | node_set_online(i); |
272 | } | ||
271 | #endif | 273 | #endif |
272 | 274 | ||
273 | /* | 275 | /* |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index b6ff882f695b..8f4d50b0adfa 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -209,7 +209,7 @@ config ARCH_HIBERNATION_POSSIBLE | |||
209 | config ARCH_SUSPEND_POSSIBLE | 209 | config ARCH_SUSPEND_POSSIBLE |
210 | def_bool y | 210 | def_bool y |
211 | depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \ | 211 | depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \ |
212 | PPC_85xx || PPC_86xx || PPC_PSERIES || 44x || 40x | 212 | (PPC_85xx && !SMP) || PPC_86xx || PPC_PSERIES || 44x || 40x |
213 | 213 | ||
214 | config PPC_DCR_NATIVE | 214 | config PPC_DCR_NATIVE |
215 | bool | 215 | bool |
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h index be3cdf9134ce..1833d1a07e79 100644 --- a/arch/powerpc/include/asm/cputable.h +++ b/arch/powerpc/include/asm/cputable.h | |||
@@ -382,10 +382,12 @@ extern const char *powerpc_base_platform; | |||
382 | #define CPU_FTRS_E500_2 (CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \ | 382 | #define CPU_FTRS_E500_2 (CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \ |
383 | CPU_FTR_SPE_COMP | CPU_FTR_MAYBE_CAN_NAP | \ | 383 | CPU_FTR_SPE_COMP | CPU_FTR_MAYBE_CAN_NAP | \ |
384 | CPU_FTR_NODSISRALIGN | CPU_FTR_NOEXECUTE) | 384 | CPU_FTR_NODSISRALIGN | CPU_FTR_NOEXECUTE) |
385 | #define CPU_FTRS_E500MC (CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \ | 385 | #define CPU_FTRS_E500MC (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN | \ |
386 | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_NODSISRALIGN | \ | ||
387 | CPU_FTR_L2CSR | CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \ | 386 | CPU_FTR_L2CSR | CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \ |
388 | CPU_FTR_DBELL) | 387 | CPU_FTR_DBELL) |
388 | #define CPU_FTRS_E5500 (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN | \ | ||
389 | CPU_FTR_L2CSR | CPU_FTR_LWSYNC | CPU_FTR_NOEXECUTE | \ | ||
390 | CPU_FTR_DBELL | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD) | ||
389 | #define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN) | 391 | #define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN) |
390 | 392 | ||
391 | /* 64-bit CPUs */ | 393 | /* 64-bit CPUs */ |
@@ -435,11 +437,15 @@ extern const char *powerpc_base_platform; | |||
435 | #define CPU_FTRS_COMPATIBLE (CPU_FTR_USE_TB | CPU_FTR_PPCAS_ARCH_V2) | 437 | #define CPU_FTRS_COMPATIBLE (CPU_FTR_USE_TB | CPU_FTR_PPCAS_ARCH_V2) |
436 | 438 | ||
437 | #ifdef __powerpc64__ | 439 | #ifdef __powerpc64__ |
440 | #ifdef CONFIG_PPC_BOOK3E | ||
441 | #define CPU_FTRS_POSSIBLE (CPU_FTRS_E5500) | ||
442 | #else | ||
438 | #define CPU_FTRS_POSSIBLE \ | 443 | #define CPU_FTRS_POSSIBLE \ |
439 | (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \ | 444 | (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \ |
440 | CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \ | 445 | CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \ |
441 | CPU_FTRS_POWER7 | CPU_FTRS_CELL | CPU_FTRS_PA6T | \ | 446 | CPU_FTRS_POWER7 | CPU_FTRS_CELL | CPU_FTRS_PA6T | \ |
442 | CPU_FTR_1T_SEGMENT | CPU_FTR_VSX) | 447 | CPU_FTR_1T_SEGMENT | CPU_FTR_VSX) |
448 | #endif | ||
443 | #else | 449 | #else |
444 | enum { | 450 | enum { |
445 | CPU_FTRS_POSSIBLE = | 451 | CPU_FTRS_POSSIBLE = |
@@ -473,16 +479,21 @@ enum { | |||
473 | #endif | 479 | #endif |
474 | #ifdef CONFIG_E500 | 480 | #ifdef CONFIG_E500 |
475 | CPU_FTRS_E500 | CPU_FTRS_E500_2 | CPU_FTRS_E500MC | | 481 | CPU_FTRS_E500 | CPU_FTRS_E500_2 | CPU_FTRS_E500MC | |
482 | CPU_FTRS_E5500 | | ||
476 | #endif | 483 | #endif |
477 | 0, | 484 | 0, |
478 | }; | 485 | }; |
479 | #endif /* __powerpc64__ */ | 486 | #endif /* __powerpc64__ */ |
480 | 487 | ||
481 | #ifdef __powerpc64__ | 488 | #ifdef __powerpc64__ |
489 | #ifdef CONFIG_PPC_BOOK3E | ||
490 | #define CPU_FTRS_ALWAYS (CPU_FTRS_E5500) | ||
491 | #else | ||
482 | #define CPU_FTRS_ALWAYS \ | 492 | #define CPU_FTRS_ALWAYS \ |
483 | (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \ | 493 | (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \ |
484 | CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \ | 494 | CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \ |
485 | CPU_FTRS_POWER7 & CPU_FTRS_CELL & CPU_FTRS_PA6T & CPU_FTRS_POSSIBLE) | 495 | CPU_FTRS_POWER7 & CPU_FTRS_CELL & CPU_FTRS_PA6T & CPU_FTRS_POSSIBLE) |
496 | #endif | ||
486 | #else | 497 | #else |
487 | enum { | 498 | enum { |
488 | CPU_FTRS_ALWAYS = | 499 | CPU_FTRS_ALWAYS = |
@@ -513,6 +524,7 @@ enum { | |||
513 | #endif | 524 | #endif |
514 | #ifdef CONFIG_E500 | 525 | #ifdef CONFIG_E500 |
515 | CPU_FTRS_E500 & CPU_FTRS_E500_2 & CPU_FTRS_E500MC & | 526 | CPU_FTRS_E500 & CPU_FTRS_E500_2 & CPU_FTRS_E500MC & |
527 | CPU_FTRS_E5500 & | ||
516 | #endif | 528 | #endif |
517 | CPU_FTRS_POSSIBLE, | 529 | CPU_FTRS_POSSIBLE, |
518 | }; | 530 | }; |
diff --git a/arch/powerpc/include/asm/pte-common.h b/arch/powerpc/include/asm/pte-common.h index 811f04ac3660..8d1569c29042 100644 --- a/arch/powerpc/include/asm/pte-common.h +++ b/arch/powerpc/include/asm/pte-common.h | |||
@@ -162,7 +162,7 @@ extern unsigned long bad_call_to_PMD_PAGE_SIZE(void); | |||
162 | * on platforms where such control is possible. | 162 | * on platforms where such control is possible. |
163 | */ | 163 | */ |
164 | #if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) ||\ | 164 | #if defined(CONFIG_KGDB) || defined(CONFIG_XMON) || defined(CONFIG_BDI_SWITCH) ||\ |
165 | defined(CONFIG_KPROBES) | 165 | defined(CONFIG_KPROBES) || defined(CONFIG_DYNAMIC_FTRACE) |
166 | #define PAGE_KERNEL_TEXT PAGE_KERNEL_X | 166 | #define PAGE_KERNEL_TEXT PAGE_KERNEL_X |
167 | #else | 167 | #else |
168 | #define PAGE_KERNEL_TEXT PAGE_KERNEL_ROX | 168 | #define PAGE_KERNEL_TEXT PAGE_KERNEL_ROX |
diff --git a/arch/powerpc/include/asm/uninorth.h b/arch/powerpc/include/asm/uninorth.h index ae9c899c8a6d..d12b11d7641e 100644 --- a/arch/powerpc/include/asm/uninorth.h +++ b/arch/powerpc/include/asm/uninorth.h | |||
@@ -60,7 +60,7 @@ | |||
60 | * | 60 | * |
61 | * Obviously, the GART is not cache coherent and so any change to it | 61 | * Obviously, the GART is not cache coherent and so any change to it |
62 | * must be flushed to memory (or maybe just make the GART space non | 62 | * must be flushed to memory (or maybe just make the GART space non |
63 | * cachable). AGP memory itself does't seem to be cache coherent neither. | 63 | * cachable). AGP memory itself doesn't seem to be cache coherent neither. |
64 | * | 64 | * |
65 | * In order to invalidate the GART (which is probably necessary to inval | 65 | * In order to invalidate the GART (which is probably necessary to inval |
66 | * the bridge internal TLBs), the following sequence has to be written, | 66 | * the bridge internal TLBs), the following sequence has to be written, |
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index c9b68d07ac4f..b9602ee06deb 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -1973,7 +1973,7 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
1973 | .pvr_mask = 0xffff0000, | 1973 | .pvr_mask = 0xffff0000, |
1974 | .pvr_value = 0x80240000, | 1974 | .pvr_value = 0x80240000, |
1975 | .cpu_name = "e5500", | 1975 | .cpu_name = "e5500", |
1976 | .cpu_features = CPU_FTRS_E500MC, | 1976 | .cpu_features = CPU_FTRS_E5500, |
1977 | .cpu_user_features = COMMON_USER_BOOKE, | 1977 | .cpu_user_features = COMMON_USER_BOOKE, |
1978 | .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS | | 1978 | .mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS | |
1979 | MMU_FTR_USE_TLBILX, | 1979 | MMU_FTR_USE_TLBILX, |
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c index 3d3d416339dd..5b5e1f002a8e 100644 --- a/arch/powerpc/kernel/crash.c +++ b/arch/powerpc/kernel/crash.c | |||
@@ -163,7 +163,7 @@ static void crash_kexec_prepare_cpus(int cpu) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | /* wait for all the CPUs to hit real mode but timeout if they don't come in */ | 165 | /* wait for all the CPUs to hit real mode but timeout if they don't come in */ |
166 | #if defined(CONFIG_PPC_STD_MMU_64) && defined(CONFIG_SMP) | 166 | #ifdef CONFIG_PPC_STD_MMU_64 |
167 | static void crash_kexec_wait_realmode(int cpu) | 167 | static void crash_kexec_wait_realmode(int cpu) |
168 | { | 168 | { |
169 | unsigned int msecs; | 169 | unsigned int msecs; |
@@ -188,9 +188,7 @@ static void crash_kexec_wait_realmode(int cpu) | |||
188 | } | 188 | } |
189 | mb(); | 189 | mb(); |
190 | } | 190 | } |
191 | #else | 191 | #endif /* CONFIG_PPC_STD_MMU_64 */ |
192 | static inline void crash_kexec_wait_realmode(int cpu) {} | ||
193 | #endif | ||
194 | 192 | ||
195 | /* | 193 | /* |
196 | * This function will be called by secondary cpus or by kexec cpu | 194 | * This function will be called by secondary cpus or by kexec cpu |
@@ -235,7 +233,9 @@ void crash_kexec_secondary(struct pt_regs *regs) | |||
235 | crash_ipi_callback(regs); | 233 | crash_ipi_callback(regs); |
236 | } | 234 | } |
237 | 235 | ||
238 | #else | 236 | #else /* ! CONFIG_SMP */ |
237 | static inline void crash_kexec_wait_realmode(int cpu) {} | ||
238 | |||
239 | static void crash_kexec_prepare_cpus(int cpu) | 239 | static void crash_kexec_prepare_cpus(int cpu) |
240 | { | 240 | { |
241 | /* | 241 | /* |
@@ -255,7 +255,7 @@ void crash_kexec_secondary(struct pt_regs *regs) | |||
255 | { | 255 | { |
256 | cpus_in_sr = CPU_MASK_NONE; | 256 | cpus_in_sr = CPU_MASK_NONE; |
257 | } | 257 | } |
258 | #endif | 258 | #endif /* CONFIG_SMP */ |
259 | 259 | ||
260 | /* | 260 | /* |
261 | * Register a function to be called on shutdown. Only use this if you | 261 | * Register a function to be called on shutdown. Only use this if you |
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c index c00d4ca1ee15..28581f1ad2c0 100644 --- a/arch/powerpc/kernel/ibmebus.c +++ b/arch/powerpc/kernel/ibmebus.c | |||
@@ -527,7 +527,7 @@ static int ibmebus_bus_pm_resume_noirq(struct device *dev) | |||
527 | 527 | ||
528 | #endif /* !CONFIG_SUSPEND */ | 528 | #endif /* !CONFIG_SUSPEND */ |
529 | 529 | ||
530 | #ifdef CONFIG_HIBERNATION | 530 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
531 | 531 | ||
532 | static int ibmebus_bus_pm_freeze(struct device *dev) | 532 | static int ibmebus_bus_pm_freeze(struct device *dev) |
533 | { | 533 | { |
@@ -665,7 +665,7 @@ static int ibmebus_bus_pm_restore_noirq(struct device *dev) | |||
665 | return ret; | 665 | return ret; |
666 | } | 666 | } |
667 | 667 | ||
668 | #else /* !CONFIG_HIBERNATION */ | 668 | #else /* !CONFIG_HIBERNATE_CALLBACKS */ |
669 | 669 | ||
670 | #define ibmebus_bus_pm_freeze NULL | 670 | #define ibmebus_bus_pm_freeze NULL |
671 | #define ibmebus_bus_pm_thaw NULL | 671 | #define ibmebus_bus_pm_thaw NULL |
@@ -676,7 +676,7 @@ static int ibmebus_bus_pm_restore_noirq(struct device *dev) | |||
676 | #define ibmebus_bus_pm_poweroff_noirq NULL | 676 | #define ibmebus_bus_pm_poweroff_noirq NULL |
677 | #define ibmebus_bus_pm_restore_noirq NULL | 677 | #define ibmebus_bus_pm_restore_noirq NULL |
678 | 678 | ||
679 | #endif /* !CONFIG_HIBERNATION */ | 679 | #endif /* !CONFIG_HIBERNATE_CALLBACKS */ |
680 | 680 | ||
681 | static struct dev_pm_ops ibmebus_bus_dev_pm_ops = { | 681 | static struct dev_pm_ops ibmebus_bus_dev_pm_ops = { |
682 | .prepare = ibmebus_bus_pm_prepare, | 682 | .prepare = ibmebus_bus_pm_prepare, |
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c index c834757bebc0..2b97b80d6d7d 100644 --- a/arch/powerpc/kernel/legacy_serial.c +++ b/arch/powerpc/kernel/legacy_serial.c | |||
@@ -330,9 +330,11 @@ void __init find_legacy_serial_ports(void) | |||
330 | if (!parent) | 330 | if (!parent) |
331 | continue; | 331 | continue; |
332 | if (of_match_node(legacy_serial_parents, parent) != NULL) { | 332 | if (of_match_node(legacy_serial_parents, parent) != NULL) { |
333 | index = add_legacy_soc_port(np, np); | 333 | if (of_device_is_available(np)) { |
334 | if (index >= 0 && np == stdout) | 334 | index = add_legacy_soc_port(np, np); |
335 | legacy_serial_console = index; | 335 | if (index >= 0 && np == stdout) |
336 | legacy_serial_console = index; | ||
337 | } | ||
336 | } | 338 | } |
337 | of_node_put(parent); | 339 | of_node_put(parent); |
338 | } | 340 | } |
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c index c4063b7f49a0..822f63008ae1 100644 --- a/arch/powerpc/kernel/perf_event.c +++ b/arch/powerpc/kernel/perf_event.c | |||
@@ -398,6 +398,25 @@ static int check_excludes(struct perf_event **ctrs, unsigned int cflags[], | |||
398 | return 0; | 398 | return 0; |
399 | } | 399 | } |
400 | 400 | ||
401 | static u64 check_and_compute_delta(u64 prev, u64 val) | ||
402 | { | ||
403 | u64 delta = (val - prev) & 0xfffffffful; | ||
404 | |||
405 | /* | ||
406 | * POWER7 can roll back counter values, if the new value is smaller | ||
407 | * than the previous value it will cause the delta and the counter to | ||
408 | * have bogus values unless we rolled a counter over. If a coutner is | ||
409 | * rolled back, it will be smaller, but within 256, which is the maximum | ||
410 | * number of events to rollback at once. If we dectect a rollback | ||
411 | * return 0. This can lead to a small lack of precision in the | ||
412 | * counters. | ||
413 | */ | ||
414 | if (prev > val && (prev - val) < 256) | ||
415 | delta = 0; | ||
416 | |||
417 | return delta; | ||
418 | } | ||
419 | |||
401 | static void power_pmu_read(struct perf_event *event) | 420 | static void power_pmu_read(struct perf_event *event) |
402 | { | 421 | { |
403 | s64 val, delta, prev; | 422 | s64 val, delta, prev; |
@@ -416,10 +435,11 @@ static void power_pmu_read(struct perf_event *event) | |||
416 | prev = local64_read(&event->hw.prev_count); | 435 | prev = local64_read(&event->hw.prev_count); |
417 | barrier(); | 436 | barrier(); |
418 | val = read_pmc(event->hw.idx); | 437 | val = read_pmc(event->hw.idx); |
438 | delta = check_and_compute_delta(prev, val); | ||
439 | if (!delta) | ||
440 | return; | ||
419 | } while (local64_cmpxchg(&event->hw.prev_count, prev, val) != prev); | 441 | } while (local64_cmpxchg(&event->hw.prev_count, prev, val) != prev); |
420 | 442 | ||
421 | /* The counters are only 32 bits wide */ | ||
422 | delta = (val - prev) & 0xfffffffful; | ||
423 | local64_add(delta, &event->count); | 443 | local64_add(delta, &event->count); |
424 | local64_sub(delta, &event->hw.period_left); | 444 | local64_sub(delta, &event->hw.period_left); |
425 | } | 445 | } |
@@ -449,8 +469,9 @@ static void freeze_limited_counters(struct cpu_hw_events *cpuhw, | |||
449 | val = (event->hw.idx == 5) ? pmc5 : pmc6; | 469 | val = (event->hw.idx == 5) ? pmc5 : pmc6; |
450 | prev = local64_read(&event->hw.prev_count); | 470 | prev = local64_read(&event->hw.prev_count); |
451 | event->hw.idx = 0; | 471 | event->hw.idx = 0; |
452 | delta = (val - prev) & 0xfffffffful; | 472 | delta = check_and_compute_delta(prev, val); |
453 | local64_add(delta, &event->count); | 473 | if (delta) |
474 | local64_add(delta, &event->count); | ||
454 | } | 475 | } |
455 | } | 476 | } |
456 | 477 | ||
@@ -458,14 +479,16 @@ static void thaw_limited_counters(struct cpu_hw_events *cpuhw, | |||
458 | unsigned long pmc5, unsigned long pmc6) | 479 | unsigned long pmc5, unsigned long pmc6) |
459 | { | 480 | { |
460 | struct perf_event *event; | 481 | struct perf_event *event; |
461 | u64 val; | 482 | u64 val, prev; |
462 | int i; | 483 | int i; |
463 | 484 | ||
464 | for (i = 0; i < cpuhw->n_limited; ++i) { | 485 | for (i = 0; i < cpuhw->n_limited; ++i) { |
465 | event = cpuhw->limited_counter[i]; | 486 | event = cpuhw->limited_counter[i]; |
466 | event->hw.idx = cpuhw->limited_hwidx[i]; | 487 | event->hw.idx = cpuhw->limited_hwidx[i]; |
467 | val = (event->hw.idx == 5) ? pmc5 : pmc6; | 488 | val = (event->hw.idx == 5) ? pmc5 : pmc6; |
468 | local64_set(&event->hw.prev_count, val); | 489 | prev = local64_read(&event->hw.prev_count); |
490 | if (check_and_compute_delta(prev, val)) | ||
491 | local64_set(&event->hw.prev_count, val); | ||
469 | perf_event_update_userpage(event); | 492 | perf_event_update_userpage(event); |
470 | } | 493 | } |
471 | } | 494 | } |
@@ -1197,7 +1220,7 @@ static void record_and_restart(struct perf_event *event, unsigned long val, | |||
1197 | 1220 | ||
1198 | /* we don't have to worry about interrupts here */ | 1221 | /* we don't have to worry about interrupts here */ |
1199 | prev = local64_read(&event->hw.prev_count); | 1222 | prev = local64_read(&event->hw.prev_count); |
1200 | delta = (val - prev) & 0xfffffffful; | 1223 | delta = check_and_compute_delta(prev, val); |
1201 | local64_add(delta, &event->count); | 1224 | local64_add(delta, &event->count); |
1202 | 1225 | ||
1203 | /* | 1226 | /* |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 375480c56eb9..f33acfd872ad 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -229,6 +229,9 @@ static u64 scan_dispatch_log(u64 stop_tb) | |||
229 | u64 stolen = 0; | 229 | u64 stolen = 0; |
230 | u64 dtb; | 230 | u64 dtb; |
231 | 231 | ||
232 | if (!dtl) | ||
233 | return 0; | ||
234 | |||
232 | if (i == vpa->dtl_idx) | 235 | if (i == vpa->dtl_idx) |
233 | return 0; | 236 | return 0; |
234 | while (i < vpa->dtl_idx) { | 237 | while (i < vpa->dtl_idx) { |
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c index a830c5e80657..bc5f0dc6ae1e 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c | |||
@@ -842,6 +842,7 @@ static void __devinit smp_core99_setup_cpu(int cpu_nr) | |||
842 | mpic_setup_this_cpu(); | 842 | mpic_setup_this_cpu(); |
843 | } | 843 | } |
844 | 844 | ||
845 | #ifdef CONFIG_PPC64 | ||
845 | #ifdef CONFIG_HOTPLUG_CPU | 846 | #ifdef CONFIG_HOTPLUG_CPU |
846 | static int smp_core99_cpu_notify(struct notifier_block *self, | 847 | static int smp_core99_cpu_notify(struct notifier_block *self, |
847 | unsigned long action, void *hcpu) | 848 | unsigned long action, void *hcpu) |
@@ -879,7 +880,6 @@ static struct notifier_block __cpuinitdata smp_core99_cpu_nb = { | |||
879 | 880 | ||
880 | static void __init smp_core99_bringup_done(void) | 881 | static void __init smp_core99_bringup_done(void) |
881 | { | 882 | { |
882 | #ifdef CONFIG_PPC64 | ||
883 | extern void g5_phy_disable_cpu1(void); | 883 | extern void g5_phy_disable_cpu1(void); |
884 | 884 | ||
885 | /* Close i2c bus if it was used for tb sync */ | 885 | /* Close i2c bus if it was used for tb sync */ |
@@ -894,14 +894,14 @@ static void __init smp_core99_bringup_done(void) | |||
894 | set_cpu_present(1, false); | 894 | set_cpu_present(1, false); |
895 | g5_phy_disable_cpu1(); | 895 | g5_phy_disable_cpu1(); |
896 | } | 896 | } |
897 | #endif /* CONFIG_PPC64 */ | ||
898 | |||
899 | #ifdef CONFIG_HOTPLUG_CPU | 897 | #ifdef CONFIG_HOTPLUG_CPU |
900 | register_cpu_notifier(&smp_core99_cpu_nb); | 898 | register_cpu_notifier(&smp_core99_cpu_nb); |
901 | #endif | 899 | #endif |
900 | |||
902 | if (ppc_md.progress) | 901 | if (ppc_md.progress) |
903 | ppc_md.progress("smp_core99_bringup_done", 0x349); | 902 | ppc_md.progress("smp_core99_bringup_done", 0x349); |
904 | } | 903 | } |
904 | #endif /* CONFIG_PPC64 */ | ||
905 | 905 | ||
906 | #ifdef CONFIG_HOTPLUG_CPU | 906 | #ifdef CONFIG_HOTPLUG_CPU |
907 | 907 | ||
@@ -975,7 +975,9 @@ static void pmac_cpu_die(void) | |||
975 | struct smp_ops_t core99_smp_ops = { | 975 | struct smp_ops_t core99_smp_ops = { |
976 | .message_pass = smp_mpic_message_pass, | 976 | .message_pass = smp_mpic_message_pass, |
977 | .probe = smp_core99_probe, | 977 | .probe = smp_core99_probe, |
978 | #ifdef CONFIG_PPC64 | ||
978 | .bringup_done = smp_core99_bringup_done, | 979 | .bringup_done = smp_core99_bringup_done, |
980 | #endif | ||
979 | .kick_cpu = smp_core99_kick_cpu, | 981 | .kick_cpu = smp_core99_kick_cpu, |
980 | .setup_cpu = smp_core99_setup_cpu, | 982 | .setup_cpu = smp_core99_setup_cpu, |
981 | .give_timebase = smp_core99_give_timebase, | 983 | .give_timebase = smp_core99_give_timebase, |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 000724149089..6c42cfde8415 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -287,14 +287,22 @@ static int alloc_dispatch_logs(void) | |||
287 | int cpu, ret; | 287 | int cpu, ret; |
288 | struct paca_struct *pp; | 288 | struct paca_struct *pp; |
289 | struct dtl_entry *dtl; | 289 | struct dtl_entry *dtl; |
290 | struct kmem_cache *dtl_cache; | ||
290 | 291 | ||
291 | if (!firmware_has_feature(FW_FEATURE_SPLPAR)) | 292 | if (!firmware_has_feature(FW_FEATURE_SPLPAR)) |
292 | return 0; | 293 | return 0; |
293 | 294 | ||
295 | dtl_cache = kmem_cache_create("dtl", DISPATCH_LOG_BYTES, | ||
296 | DISPATCH_LOG_BYTES, 0, NULL); | ||
297 | if (!dtl_cache) { | ||
298 | pr_warn("Failed to create dispatch trace log buffer cache\n"); | ||
299 | pr_warn("Stolen time statistics will be unreliable\n"); | ||
300 | return 0; | ||
301 | } | ||
302 | |||
294 | for_each_possible_cpu(cpu) { | 303 | for_each_possible_cpu(cpu) { |
295 | pp = &paca[cpu]; | 304 | pp = &paca[cpu]; |
296 | dtl = kmalloc_node(DISPATCH_LOG_BYTES, GFP_KERNEL, | 305 | dtl = kmem_cache_alloc(dtl_cache, GFP_KERNEL); |
297 | cpu_to_node(cpu)); | ||
298 | if (!dtl) { | 306 | if (!dtl) { |
299 | pr_warn("Failed to allocate dispatch trace log for cpu %d\n", | 307 | pr_warn("Failed to allocate dispatch trace log for cpu %d\n", |
300 | cpu); | 308 | cpu); |
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index f8f7f28c6343..68ca9290df94 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c | |||
@@ -324,6 +324,11 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary) | |||
324 | struct resource rsrc; | 324 | struct resource rsrc; |
325 | const int *bus_range; | 325 | const int *bus_range; |
326 | 326 | ||
327 | if (!of_device_is_available(dev)) { | ||
328 | pr_warning("%s: disabled\n", dev->full_name); | ||
329 | return -ENODEV; | ||
330 | } | ||
331 | |||
327 | pr_debug("Adding PCI host bridge %s\n", dev->full_name); | 332 | pr_debug("Adding PCI host bridge %s\n", dev->full_name); |
328 | 333 | ||
329 | /* Fetch host bridge registers address */ | 334 | /* Fetch host bridge registers address */ |
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c index 14232d57369c..49798532b477 100644 --- a/arch/powerpc/sysdev/fsl_rio.c +++ b/arch/powerpc/sysdev/fsl_rio.c | |||
@@ -1457,7 +1457,6 @@ int fsl_rio_setup(struct platform_device *dev) | |||
1457 | port->ops = ops; | 1457 | port->ops = ops; |
1458 | port->priv = priv; | 1458 | port->priv = priv; |
1459 | port->phys_efptr = 0x100; | 1459 | port->phys_efptr = 0x100; |
1460 | rio_register_mport(port); | ||
1461 | 1460 | ||
1462 | priv->regs_win = ioremap(regs.start, regs.end - regs.start + 1); | 1461 | priv->regs_win = ioremap(regs.start, regs.end - regs.start + 1); |
1463 | rio_regs_win = priv->regs_win; | 1462 | rio_regs_win = priv->regs_win; |
@@ -1504,6 +1503,9 @@ int fsl_rio_setup(struct platform_device *dev) | |||
1504 | dev_info(&dev->dev, "RapidIO Common Transport System size: %d\n", | 1503 | dev_info(&dev->dev, "RapidIO Common Transport System size: %d\n", |
1505 | port->sys_size ? 65536 : 256); | 1504 | port->sys_size ? 65536 : 256); |
1506 | 1505 | ||
1506 | if (rio_register_mport(port)) | ||
1507 | goto err; | ||
1508 | |||
1507 | if (port->host_deviceid >= 0) | 1509 | if (port->host_deviceid >= 0) |
1508 | out_be32(priv->regs_win + RIO_GCCSR, RIO_PORT_GEN_HOST | | 1510 | out_be32(priv->regs_win + RIO_GCCSR, RIO_PORT_GEN_HOST | |
1509 | RIO_PORT_GEN_MASTER | RIO_PORT_GEN_DISCOVERED); | 1511 | RIO_PORT_GEN_MASTER | RIO_PORT_GEN_DISCOVERED); |
diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c index 975e3ab13cb5..8b16c479585b 100644 --- a/arch/s390/crypto/prng.c +++ b/arch/s390/crypto/prng.c | |||
@@ -76,7 +76,7 @@ static void prng_seed(int nbytes) | |||
76 | 76 | ||
77 | /* Add the entropy */ | 77 | /* Add the entropy */ |
78 | while (nbytes >= 8) { | 78 | while (nbytes >= 8) { |
79 | *((__u64 *)parm_block) ^= *((__u64 *)buf+i*8); | 79 | *((__u64 *)parm_block) ^= *((__u64 *)(buf+i)); |
80 | prng_add_entropy(); | 80 | prng_add_entropy(); |
81 | i += 8; | 81 | i += 8; |
82 | nbytes -= 8; | 82 | nbytes -= 8; |
diff --git a/arch/s390/kvm/sie64a.S b/arch/s390/kvm/sie64a.S index 7e9d30d567b0..ab0e041ac54c 100644 --- a/arch/s390/kvm/sie64a.S +++ b/arch/s390/kvm/sie64a.S | |||
@@ -48,10 +48,10 @@ sie_irq_handler: | |||
48 | tm __TI_flags+7(%r2),_TIF_EXIT_SIE | 48 | tm __TI_flags+7(%r2),_TIF_EXIT_SIE |
49 | jz 0f | 49 | jz 0f |
50 | larl %r2,sie_exit # work pending, leave sie | 50 | larl %r2,sie_exit # work pending, leave sie |
51 | stg %r2,__LC_RETURN_PSW+8 | 51 | stg %r2,SPI_PSW+8(0,%r15) |
52 | br %r14 | 52 | br %r14 |
53 | 0: larl %r2,sie_reenter # re-enter with guest id | 53 | 0: larl %r2,sie_reenter # re-enter with guest id |
54 | stg %r2,__LC_RETURN_PSW+8 | 54 | stg %r2,SPI_PSW+8(0,%r15) |
55 | 1: br %r14 | 55 | 1: br %r14 |
56 | 56 | ||
57 | /* | 57 | /* |
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 9217e332b118..ab988135e5c6 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -543,7 +543,6 @@ static void pfault_interrupt(unsigned int ext_int_code, | |||
543 | struct task_struct *tsk; | 543 | struct task_struct *tsk; |
544 | __u16 subcode; | 544 | __u16 subcode; |
545 | 545 | ||
546 | kstat_cpu(smp_processor_id()).irqs[EXTINT_PFL]++; | ||
547 | /* | 546 | /* |
548 | * Get the external interruption subcode & pfault | 547 | * Get the external interruption subcode & pfault |
549 | * initial/completion signal bit. VM stores this | 548 | * initial/completion signal bit. VM stores this |
@@ -553,14 +552,15 @@ static void pfault_interrupt(unsigned int ext_int_code, | |||
553 | subcode = ext_int_code >> 16; | 552 | subcode = ext_int_code >> 16; |
554 | if ((subcode & 0xff00) != __SUBCODE_MASK) | 553 | if ((subcode & 0xff00) != __SUBCODE_MASK) |
555 | return; | 554 | return; |
555 | kstat_cpu(smp_processor_id()).irqs[EXTINT_PFL]++; | ||
556 | 556 | ||
557 | /* | 557 | /* |
558 | * Get the token (= address of the task structure of the affected task). | 558 | * Get the token (= address of the task structure of the affected task). |
559 | */ | 559 | */ |
560 | #ifdef CONFIG_64BIT | 560 | #ifdef CONFIG_64BIT |
561 | tsk = *(struct task_struct **) param64; | 561 | tsk = (struct task_struct *) param64; |
562 | #else | 562 | #else |
563 | tsk = *(struct task_struct **) param32; | 563 | tsk = (struct task_struct *) param32; |
564 | #endif | 564 | #endif |
565 | 565 | ||
566 | if (subcode & 0x0080) { | 566 | if (subcode & 0x0080) { |
diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c index 122ffbd08ce0..0607e4b14b27 100644 --- a/arch/s390/mm/pageattr.c +++ b/arch/s390/mm/pageattr.c | |||
@@ -24,12 +24,13 @@ static void change_page_attr(unsigned long addr, int numpages, | |||
24 | WARN_ON_ONCE(1); | 24 | WARN_ON_ONCE(1); |
25 | continue; | 25 | continue; |
26 | } | 26 | } |
27 | ptep = pte_offset_kernel(pmdp, addr + i * PAGE_SIZE); | 27 | ptep = pte_offset_kernel(pmdp, addr); |
28 | 28 | ||
29 | pte = *ptep; | 29 | pte = *ptep; |
30 | pte = set(pte); | 30 | pte = set(pte); |
31 | ptep_invalidate(&init_mm, addr + i * PAGE_SIZE, ptep); | 31 | ptep_invalidate(&init_mm, addr, ptep); |
32 | *ptep = pte; | 32 | *ptep = pte; |
33 | addr += PAGE_SIZE; | ||
33 | } | 34 | } |
34 | } | 35 | } |
35 | 36 | ||
diff --git a/arch/um/Kconfig.um b/arch/um/Kconfig.um index 90a438acbfaf..b5e675e370c6 100644 --- a/arch/um/Kconfig.um +++ b/arch/um/Kconfig.um | |||
@@ -47,7 +47,7 @@ config HOSTFS | |||
47 | 47 | ||
48 | config HPPFS | 48 | config HPPFS |
49 | tristate "HoneyPot ProcFS (EXPERIMENTAL)" | 49 | tristate "HoneyPot ProcFS (EXPERIMENTAL)" |
50 | depends on EXPERIMENTAL | 50 | depends on EXPERIMENTAL && PROC_FS |
51 | help | 51 | help |
52 | hppfs (HoneyPot ProcFS) is a filesystem which allows UML /proc | 52 | hppfs (HoneyPot ProcFS) is a filesystem which allows UML /proc |
53 | entries to be overridden, removed, or fabricated from the host. | 53 | entries to be overridden, removed, or fabricated from the host. |
diff --git a/arch/um/Kconfig.x86 b/arch/um/Kconfig.x86 index 02fb017fed47..a9da516a5274 100644 --- a/arch/um/Kconfig.x86 +++ b/arch/um/Kconfig.x86 | |||
@@ -4,6 +4,10 @@ menu "UML-specific options" | |||
4 | 4 | ||
5 | menu "Host processor type and features" | 5 | menu "Host processor type and features" |
6 | 6 | ||
7 | config CMPXCHG_LOCAL | ||
8 | bool | ||
9 | default n | ||
10 | |||
7 | source "arch/x86/Kconfig.cpu" | 11 | source "arch/x86/Kconfig.cpu" |
8 | 12 | ||
9 | endmenu | 13 | endmenu |
diff --git a/arch/um/include/asm/bug.h b/arch/um/include/asm/bug.h new file mode 100644 index 000000000000..9e33b864c359 --- /dev/null +++ b/arch/um/include/asm/bug.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_BUG_H | ||
2 | #define __UM_BUG_H | ||
3 | |||
4 | #include <asm-generic/bug.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h index e2cf786bda0a..5bd1bad33fab 100644 --- a/arch/um/include/asm/thread_info.h +++ b/arch/um/include/asm/thread_info.h | |||
@@ -49,7 +49,10 @@ static inline struct thread_info *current_thread_info(void) | |||
49 | { | 49 | { |
50 | struct thread_info *ti; | 50 | struct thread_info *ti; |
51 | unsigned long mask = THREAD_SIZE - 1; | 51 | unsigned long mask = THREAD_SIZE - 1; |
52 | ti = (struct thread_info *) (((unsigned long) &ti) & ~mask); | 52 | void *p; |
53 | |||
54 | asm volatile ("" : "=r" (p) : "0" (&ti)); | ||
55 | ti = (struct thread_info *) (((unsigned long)p) & ~mask); | ||
53 | return ti; | 56 | return ti; |
54 | } | 57 | } |
55 | 58 | ||
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile index 804b28dd0328..b1da91c1b200 100644 --- a/arch/um/sys-i386/Makefile +++ b/arch/um/sys-i386/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ | 5 | obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ |
6 | ptrace_user.o setjmp.o signal.o stub.o stub_segv.o syscalls.o sysrq.o \ | 6 | ptrace_user.o setjmp.o signal.o stub.o stub_segv.o syscalls.o sysrq.o \ |
7 | sys_call_table.o tls.o | 7 | sys_call_table.o tls.o atomic64_cx8_32.o |
8 | 8 | ||
9 | obj-$(CONFIG_BINFMT_ELF) += elfcore.o | 9 | obj-$(CONFIG_BINFMT_ELF) += elfcore.o |
10 | 10 | ||
diff --git a/arch/um/sys-i386/atomic64_cx8_32.S b/arch/um/sys-i386/atomic64_cx8_32.S new file mode 100644 index 000000000000..1e901d3d4a95 --- /dev/null +++ b/arch/um/sys-i386/atomic64_cx8_32.S | |||
@@ -0,0 +1,225 @@ | |||
1 | /* | ||
2 | * atomic64_t for 586+ | ||
3 | * | ||
4 | * Copied from arch/x86/lib/atomic64_cx8_32.S | ||
5 | * | ||
6 | * Copyright © 2010 Luca Barbieri | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/linkage.h> | ||
16 | #include <asm/alternative-asm.h> | ||
17 | #include <asm/dwarf2.h> | ||
18 | |||
19 | .macro SAVE reg | ||
20 | pushl_cfi %\reg | ||
21 | CFI_REL_OFFSET \reg, 0 | ||
22 | .endm | ||
23 | |||
24 | .macro RESTORE reg | ||
25 | popl_cfi %\reg | ||
26 | CFI_RESTORE \reg | ||
27 | .endm | ||
28 | |||
29 | .macro read64 reg | ||
30 | movl %ebx, %eax | ||
31 | movl %ecx, %edx | ||
32 | /* we need LOCK_PREFIX since otherwise cmpxchg8b always does the write */ | ||
33 | LOCK_PREFIX | ||
34 | cmpxchg8b (\reg) | ||
35 | .endm | ||
36 | |||
37 | ENTRY(atomic64_read_cx8) | ||
38 | CFI_STARTPROC | ||
39 | |||
40 | read64 %ecx | ||
41 | ret | ||
42 | CFI_ENDPROC | ||
43 | ENDPROC(atomic64_read_cx8) | ||
44 | |||
45 | ENTRY(atomic64_set_cx8) | ||
46 | CFI_STARTPROC | ||
47 | |||
48 | 1: | ||
49 | /* we don't need LOCK_PREFIX since aligned 64-bit writes | ||
50 | * are atomic on 586 and newer */ | ||
51 | cmpxchg8b (%esi) | ||
52 | jne 1b | ||
53 | |||
54 | ret | ||
55 | CFI_ENDPROC | ||
56 | ENDPROC(atomic64_set_cx8) | ||
57 | |||
58 | ENTRY(atomic64_xchg_cx8) | ||
59 | CFI_STARTPROC | ||
60 | |||
61 | movl %ebx, %eax | ||
62 | movl %ecx, %edx | ||
63 | 1: | ||
64 | LOCK_PREFIX | ||
65 | cmpxchg8b (%esi) | ||
66 | jne 1b | ||
67 | |||
68 | ret | ||
69 | CFI_ENDPROC | ||
70 | ENDPROC(atomic64_xchg_cx8) | ||
71 | |||
72 | .macro addsub_return func ins insc | ||
73 | ENTRY(atomic64_\func\()_return_cx8) | ||
74 | CFI_STARTPROC | ||
75 | SAVE ebp | ||
76 | SAVE ebx | ||
77 | SAVE esi | ||
78 | SAVE edi | ||
79 | |||
80 | movl %eax, %esi | ||
81 | movl %edx, %edi | ||
82 | movl %ecx, %ebp | ||
83 | |||
84 | read64 %ebp | ||
85 | 1: | ||
86 | movl %eax, %ebx | ||
87 | movl %edx, %ecx | ||
88 | \ins\()l %esi, %ebx | ||
89 | \insc\()l %edi, %ecx | ||
90 | LOCK_PREFIX | ||
91 | cmpxchg8b (%ebp) | ||
92 | jne 1b | ||
93 | |||
94 | 10: | ||
95 | movl %ebx, %eax | ||
96 | movl %ecx, %edx | ||
97 | RESTORE edi | ||
98 | RESTORE esi | ||
99 | RESTORE ebx | ||
100 | RESTORE ebp | ||
101 | ret | ||
102 | CFI_ENDPROC | ||
103 | ENDPROC(atomic64_\func\()_return_cx8) | ||
104 | .endm | ||
105 | |||
106 | addsub_return add add adc | ||
107 | addsub_return sub sub sbb | ||
108 | |||
109 | .macro incdec_return func ins insc | ||
110 | ENTRY(atomic64_\func\()_return_cx8) | ||
111 | CFI_STARTPROC | ||
112 | SAVE ebx | ||
113 | |||
114 | read64 %esi | ||
115 | 1: | ||
116 | movl %eax, %ebx | ||
117 | movl %edx, %ecx | ||
118 | \ins\()l $1, %ebx | ||
119 | \insc\()l $0, %ecx | ||
120 | LOCK_PREFIX | ||
121 | cmpxchg8b (%esi) | ||
122 | jne 1b | ||
123 | |||
124 | 10: | ||
125 | movl %ebx, %eax | ||
126 | movl %ecx, %edx | ||
127 | RESTORE ebx | ||
128 | ret | ||
129 | CFI_ENDPROC | ||
130 | ENDPROC(atomic64_\func\()_return_cx8) | ||
131 | .endm | ||
132 | |||
133 | incdec_return inc add adc | ||
134 | incdec_return dec sub sbb | ||
135 | |||
136 | ENTRY(atomic64_dec_if_positive_cx8) | ||
137 | CFI_STARTPROC | ||
138 | SAVE ebx | ||
139 | |||
140 | read64 %esi | ||
141 | 1: | ||
142 | movl %eax, %ebx | ||
143 | movl %edx, %ecx | ||
144 | subl $1, %ebx | ||
145 | sbb $0, %ecx | ||
146 | js 2f | ||
147 | LOCK_PREFIX | ||
148 | cmpxchg8b (%esi) | ||
149 | jne 1b | ||
150 | |||
151 | 2: | ||
152 | movl %ebx, %eax | ||
153 | movl %ecx, %edx | ||
154 | RESTORE ebx | ||
155 | ret | ||
156 | CFI_ENDPROC | ||
157 | ENDPROC(atomic64_dec_if_positive_cx8) | ||
158 | |||
159 | ENTRY(atomic64_add_unless_cx8) | ||
160 | CFI_STARTPROC | ||
161 | SAVE ebp | ||
162 | SAVE ebx | ||
163 | /* these just push these two parameters on the stack */ | ||
164 | SAVE edi | ||
165 | SAVE esi | ||
166 | |||
167 | movl %ecx, %ebp | ||
168 | movl %eax, %esi | ||
169 | movl %edx, %edi | ||
170 | |||
171 | read64 %ebp | ||
172 | 1: | ||
173 | cmpl %eax, 0(%esp) | ||
174 | je 4f | ||
175 | 2: | ||
176 | movl %eax, %ebx | ||
177 | movl %edx, %ecx | ||
178 | addl %esi, %ebx | ||
179 | adcl %edi, %ecx | ||
180 | LOCK_PREFIX | ||
181 | cmpxchg8b (%ebp) | ||
182 | jne 1b | ||
183 | |||
184 | movl $1, %eax | ||
185 | 3: | ||
186 | addl $8, %esp | ||
187 | CFI_ADJUST_CFA_OFFSET -8 | ||
188 | RESTORE ebx | ||
189 | RESTORE ebp | ||
190 | ret | ||
191 | 4: | ||
192 | cmpl %edx, 4(%esp) | ||
193 | jne 2b | ||
194 | xorl %eax, %eax | ||
195 | jmp 3b | ||
196 | CFI_ENDPROC | ||
197 | ENDPROC(atomic64_add_unless_cx8) | ||
198 | |||
199 | ENTRY(atomic64_inc_not_zero_cx8) | ||
200 | CFI_STARTPROC | ||
201 | SAVE ebx | ||
202 | |||
203 | read64 %esi | ||
204 | 1: | ||
205 | testl %eax, %eax | ||
206 | je 4f | ||
207 | 2: | ||
208 | movl %eax, %ebx | ||
209 | movl %edx, %ecx | ||
210 | addl $1, %ebx | ||
211 | adcl $0, %ecx | ||
212 | LOCK_PREFIX | ||
213 | cmpxchg8b (%esi) | ||
214 | jne 1b | ||
215 | |||
216 | movl $1, %eax | ||
217 | 3: | ||
218 | RESTORE ebx | ||
219 | ret | ||
220 | 4: | ||
221 | testl %edx, %edx | ||
222 | jne 2b | ||
223 | jmp 3b | ||
224 | CFI_ENDPROC | ||
225 | ENDPROC(atomic64_inc_not_zero_cx8) | ||
diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c index cae3feb1035e..db75d07c3645 100644 --- a/arch/x86/boot/memory.c +++ b/arch/x86/boot/memory.c | |||
@@ -91,7 +91,7 @@ static int detect_memory_e801(void) | |||
91 | if (oreg.ax > 15*1024) { | 91 | if (oreg.ax > 15*1024) { |
92 | return -1; /* Bogus! */ | 92 | return -1; /* Bogus! */ |
93 | } else if (oreg.ax == 15*1024) { | 93 | } else if (oreg.ax == 15*1024) { |
94 | boot_params.alt_mem_k = (oreg.dx << 6) + oreg.ax; | 94 | boot_params.alt_mem_k = (oreg.bx << 6) + oreg.ax; |
95 | } else { | 95 | } else { |
96 | /* | 96 | /* |
97 | * This ignores memory above 16MB if we have a memory | 97 | * This ignores memory above 16MB if we have a memory |
diff --git a/arch/x86/include/asm/gart.h b/arch/x86/include/asm/gart.h index 43085bfc99c3..156cd5d18d2a 100644 --- a/arch/x86/include/asm/gart.h +++ b/arch/x86/include/asm/gart.h | |||
@@ -66,7 +66,7 @@ static inline void gart_set_size_and_enable(struct pci_dev *dev, u32 order) | |||
66 | * Don't enable translation but enable GART IO and CPU accesses. | 66 | * Don't enable translation but enable GART IO and CPU accesses. |
67 | * Also, set DISTLBWALKPRB since GART tables memory is UC. | 67 | * Also, set DISTLBWALKPRB since GART tables memory is UC. |
68 | */ | 68 | */ |
69 | ctl = DISTLBWALKPRB | order << 1; | 69 | ctl = order << 1; |
70 | 70 | ||
71 | pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl); | 71 | pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl); |
72 | } | 72 | } |
@@ -75,17 +75,17 @@ static inline void enable_gart_translation(struct pci_dev *dev, u64 addr) | |||
75 | { | 75 | { |
76 | u32 tmp, ctl; | 76 | u32 tmp, ctl; |
77 | 77 | ||
78 | /* address of the mappings table */ | 78 | /* address of the mappings table */ |
79 | addr >>= 12; | 79 | addr >>= 12; |
80 | tmp = (u32) addr<<4; | 80 | tmp = (u32) addr<<4; |
81 | tmp &= ~0xf; | 81 | tmp &= ~0xf; |
82 | pci_write_config_dword(dev, AMD64_GARTTABLEBASE, tmp); | 82 | pci_write_config_dword(dev, AMD64_GARTTABLEBASE, tmp); |
83 | 83 | ||
84 | /* Enable GART translation for this hammer. */ | 84 | /* Enable GART translation for this hammer. */ |
85 | pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl); | 85 | pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl); |
86 | ctl |= GARTEN; | 86 | ctl |= GARTEN | DISTLBWALKPRB; |
87 | ctl &= ~(DISGARTCPU | DISGARTIO); | 87 | ctl &= ~(DISGARTCPU | DISGARTIO); |
88 | pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl); | 88 | pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl); |
89 | } | 89 | } |
90 | 90 | ||
91 | static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size) | 91 | static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size) |
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index c4bd267dfc50..a97a240f67f3 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -150,7 +150,7 @@ void setup_IO_APIC_irq_extra(u32 gsi); | |||
150 | extern void ioapic_and_gsi_init(void); | 150 | extern void ioapic_and_gsi_init(void); |
151 | extern void ioapic_insert_resources(void); | 151 | extern void ioapic_insert_resources(void); |
152 | 152 | ||
153 | int io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr); | 153 | int io_apic_setup_irq_pin_once(unsigned int irq, int node, struct io_apic_irq_attr *attr); |
154 | 154 | ||
155 | extern struct IO_APIC_route_entry **alloc_ioapic_entries(void); | 155 | extern struct IO_APIC_route_entry **alloc_ioapic_entries(void); |
156 | extern void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries); | 156 | extern void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries); |
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index fd5a1f365c95..3cce71413d0b 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h | |||
@@ -96,11 +96,15 @@ | |||
96 | #define MSR_IA32_MC0_ADDR 0x00000402 | 96 | #define MSR_IA32_MC0_ADDR 0x00000402 |
97 | #define MSR_IA32_MC0_MISC 0x00000403 | 97 | #define MSR_IA32_MC0_MISC 0x00000403 |
98 | 98 | ||
99 | #define MSR_AMD64_MC0_MASK 0xc0010044 | ||
100 | |||
99 | #define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4*(x)) | 101 | #define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4*(x)) |
100 | #define MSR_IA32_MCx_STATUS(x) (MSR_IA32_MC0_STATUS + 4*(x)) | 102 | #define MSR_IA32_MCx_STATUS(x) (MSR_IA32_MC0_STATUS + 4*(x)) |
101 | #define MSR_IA32_MCx_ADDR(x) (MSR_IA32_MC0_ADDR + 4*(x)) | 103 | #define MSR_IA32_MCx_ADDR(x) (MSR_IA32_MC0_ADDR + 4*(x)) |
102 | #define MSR_IA32_MCx_MISC(x) (MSR_IA32_MC0_MISC + 4*(x)) | 104 | #define MSR_IA32_MCx_MISC(x) (MSR_IA32_MC0_MISC + 4*(x)) |
103 | 105 | ||
106 | #define MSR_AMD64_MCx_MASK(x) (MSR_AMD64_MC0_MASK + (x)) | ||
107 | |||
104 | /* These are consecutive and not in the normal 4er MCE bank block */ | 108 | /* These are consecutive and not in the normal 4er MCE bank block */ |
105 | #define MSR_IA32_MC0_CTL2 0x00000280 | 109 | #define MSR_IA32_MC0_CTL2 0x00000280 |
106 | #define MSR_IA32_MCx_CTL2(x) (MSR_IA32_MC0_CTL2 + (x)) | 110 | #define MSR_IA32_MCx_CTL2(x) (MSR_IA32_MC0_CTL2 + (x)) |
diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index 3d4dab43c994..a50fc9f493b3 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h | |||
@@ -51,7 +51,7 @@ static inline void numa_remove_cpu(int cpu) { } | |||
51 | #endif /* CONFIG_NUMA */ | 51 | #endif /* CONFIG_NUMA */ |
52 | 52 | ||
53 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 53 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
54 | struct cpumask __cpuinit *debug_cpumask_set_cpu(int cpu, int enable); | 54 | void debug_cpumask_set_cpu(int cpu, int node, bool enable); |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | #endif /* _ASM_X86_NUMA_H */ | 57 | #endif /* _ASM_X86_NUMA_H */ |
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c index 86d1ad4962a7..73fb469908c6 100644 --- a/arch/x86/kernel/aperture_64.c +++ b/arch/x86/kernel/aperture_64.c | |||
@@ -499,7 +499,7 @@ out: | |||
499 | * Don't enable translation yet but enable GART IO and CPU | 499 | * Don't enable translation yet but enable GART IO and CPU |
500 | * accesses and set DISTLBWALKPRB since GART table memory is UC. | 500 | * accesses and set DISTLBWALKPRB since GART table memory is UC. |
501 | */ | 501 | */ |
502 | u32 ctl = DISTLBWALKPRB | aper_order << 1; | 502 | u32 ctl = aper_order << 1; |
503 | 503 | ||
504 | bus = amd_nb_bus_dev_ranges[i].bus; | 504 | bus = amd_nb_bus_dev_ranges[i].bus; |
505 | dev_base = amd_nb_bus_dev_ranges[i].dev_base; | 505 | dev_base = amd_nb_bus_dev_ranges[i].dev_base; |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 68df09bba92e..45fd33d1fd3a 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -128,8 +128,8 @@ static int __init parse_noapic(char *str) | |||
128 | } | 128 | } |
129 | early_param("noapic", parse_noapic); | 129 | early_param("noapic", parse_noapic); |
130 | 130 | ||
131 | static int io_apic_setup_irq_pin_once(unsigned int irq, int node, | 131 | static int io_apic_setup_irq_pin(unsigned int irq, int node, |
132 | struct io_apic_irq_attr *attr); | 132 | struct io_apic_irq_attr *attr); |
133 | 133 | ||
134 | /* Will be called in mpparse/acpi/sfi codes for saving IRQ info */ | 134 | /* Will be called in mpparse/acpi/sfi codes for saving IRQ info */ |
135 | void mp_save_irq(struct mpc_intsrc *m) | 135 | void mp_save_irq(struct mpc_intsrc *m) |
@@ -3570,7 +3570,7 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev) | |||
3570 | } | 3570 | } |
3571 | #endif /* CONFIG_HT_IRQ */ | 3571 | #endif /* CONFIG_HT_IRQ */ |
3572 | 3572 | ||
3573 | int | 3573 | static int |
3574 | io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr) | 3574 | io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr) |
3575 | { | 3575 | { |
3576 | struct irq_cfg *cfg = alloc_irq_and_cfg_at(irq, node); | 3576 | struct irq_cfg *cfg = alloc_irq_and_cfg_at(irq, node); |
@@ -3585,8 +3585,8 @@ io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr) | |||
3585 | return ret; | 3585 | return ret; |
3586 | } | 3586 | } |
3587 | 3587 | ||
3588 | static int io_apic_setup_irq_pin_once(unsigned int irq, int node, | 3588 | int io_apic_setup_irq_pin_once(unsigned int irq, int node, |
3589 | struct io_apic_irq_attr *attr) | 3589 | struct io_apic_irq_attr *attr) |
3590 | { | 3590 | { |
3591 | unsigned int id = attr->ioapic, pin = attr->ioapic_pin; | 3591 | unsigned int id = attr->ioapic, pin = attr->ioapic_pin; |
3592 | int ret; | 3592 | int ret; |
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index 0b4be431c620..adee12e0da1f 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
@@ -228,6 +228,7 @@ | |||
228 | #include <linux/kthread.h> | 228 | #include <linux/kthread.h> |
229 | #include <linux/jiffies.h> | 229 | #include <linux/jiffies.h> |
230 | #include <linux/acpi.h> | 230 | #include <linux/acpi.h> |
231 | #include <linux/syscore_ops.h> | ||
231 | 232 | ||
232 | #include <asm/system.h> | 233 | #include <asm/system.h> |
233 | #include <asm/uaccess.h> | 234 | #include <asm/uaccess.h> |
@@ -1238,6 +1239,7 @@ static int suspend(int vetoable) | |||
1238 | 1239 | ||
1239 | local_irq_disable(); | 1240 | local_irq_disable(); |
1240 | sysdev_suspend(PMSG_SUSPEND); | 1241 | sysdev_suspend(PMSG_SUSPEND); |
1242 | syscore_suspend(); | ||
1241 | 1243 | ||
1242 | local_irq_enable(); | 1244 | local_irq_enable(); |
1243 | 1245 | ||
@@ -1255,6 +1257,7 @@ static int suspend(int vetoable) | |||
1255 | apm_error("suspend", err); | 1257 | apm_error("suspend", err); |
1256 | err = (err == APM_SUCCESS) ? 0 : -EIO; | 1258 | err = (err == APM_SUCCESS) ? 0 : -EIO; |
1257 | 1259 | ||
1260 | syscore_resume(); | ||
1258 | sysdev_resume(); | 1261 | sysdev_resume(); |
1259 | local_irq_enable(); | 1262 | local_irq_enable(); |
1260 | 1263 | ||
@@ -1280,6 +1283,7 @@ static void standby(void) | |||
1280 | 1283 | ||
1281 | local_irq_disable(); | 1284 | local_irq_disable(); |
1282 | sysdev_suspend(PMSG_SUSPEND); | 1285 | sysdev_suspend(PMSG_SUSPEND); |
1286 | syscore_suspend(); | ||
1283 | local_irq_enable(); | 1287 | local_irq_enable(); |
1284 | 1288 | ||
1285 | err = set_system_power_state(APM_STATE_STANDBY); | 1289 | err = set_system_power_state(APM_STATE_STANDBY); |
@@ -1287,6 +1291,7 @@ static void standby(void) | |||
1287 | apm_error("standby", err); | 1291 | apm_error("standby", err); |
1288 | 1292 | ||
1289 | local_irq_disable(); | 1293 | local_irq_disable(); |
1294 | syscore_resume(); | ||
1290 | sysdev_resume(); | 1295 | sysdev_resume(); |
1291 | local_irq_enable(); | 1296 | local_irq_enable(); |
1292 | 1297 | ||
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 3ecece0217ef..3532d3bf8105 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -615,6 +615,25 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) | |||
615 | /* As a rule processors have APIC timer running in deep C states */ | 615 | /* As a rule processors have APIC timer running in deep C states */ |
616 | if (c->x86 >= 0xf && !cpu_has_amd_erratum(amd_erratum_400)) | 616 | if (c->x86 >= 0xf && !cpu_has_amd_erratum(amd_erratum_400)) |
617 | set_cpu_cap(c, X86_FEATURE_ARAT); | 617 | set_cpu_cap(c, X86_FEATURE_ARAT); |
618 | |||
619 | /* | ||
620 | * Disable GART TLB Walk Errors on Fam10h. We do this here | ||
621 | * because this is always needed when GART is enabled, even in a | ||
622 | * kernel which has no MCE support built in. | ||
623 | */ | ||
624 | if (c->x86 == 0x10) { | ||
625 | /* | ||
626 | * BIOS should disable GartTlbWlk Errors themself. If | ||
627 | * it doesn't do it here as suggested by the BKDG. | ||
628 | * | ||
629 | * Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=33012 | ||
630 | */ | ||
631 | u64 mask; | ||
632 | |||
633 | rdmsrl(MSR_AMD64_MCx_MASK(4), mask); | ||
634 | mask |= (1 << 10); | ||
635 | wrmsrl(MSR_AMD64_MCx_MASK(4), mask); | ||
636 | } | ||
618 | } | 637 | } |
619 | 638 | ||
620 | #ifdef CONFIG_X86_32 | 639 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index eed3673a8656..e638689279d3 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -586,8 +586,12 @@ static int x86_setup_perfctr(struct perf_event *event) | |||
586 | return -EOPNOTSUPP; | 586 | return -EOPNOTSUPP; |
587 | } | 587 | } |
588 | 588 | ||
589 | /* | ||
590 | * Do not allow config1 (extended registers) to propagate, | ||
591 | * there's no sane user-space generalization yet: | ||
592 | */ | ||
589 | if (attr->type == PERF_TYPE_RAW) | 593 | if (attr->type == PERF_TYPE_RAW) |
590 | return x86_pmu_extra_regs(event->attr.config, event); | 594 | return 0; |
591 | 595 | ||
592 | if (attr->type == PERF_TYPE_HW_CACHE) | 596 | if (attr->type == PERF_TYPE_HW_CACHE) |
593 | return set_ext_hw_attr(hwc, event); | 597 | return set_ext_hw_attr(hwc, event); |
@@ -609,8 +613,8 @@ static int x86_setup_perfctr(struct perf_event *event) | |||
609 | /* | 613 | /* |
610 | * Branch tracing: | 614 | * Branch tracing: |
611 | */ | 615 | */ |
612 | if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) && | 616 | if (attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS && |
613 | (hwc->sample_period == 1)) { | 617 | !attr->freq && hwc->sample_period == 1) { |
614 | /* BTS is not supported by this architecture. */ | 618 | /* BTS is not supported by this architecture. */ |
615 | if (!x86_pmu.bts_active) | 619 | if (!x86_pmu.bts_active) |
616 | return -EOPNOTSUPP; | 620 | return -EOPNOTSUPP; |
@@ -1284,6 +1288,16 @@ static int x86_pmu_handle_irq(struct pt_regs *regs) | |||
1284 | 1288 | ||
1285 | cpuc = &__get_cpu_var(cpu_hw_events); | 1289 | cpuc = &__get_cpu_var(cpu_hw_events); |
1286 | 1290 | ||
1291 | /* | ||
1292 | * Some chipsets need to unmask the LVTPC in a particular spot | ||
1293 | * inside the nmi handler. As a result, the unmasking was pushed | ||
1294 | * into all the nmi handlers. | ||
1295 | * | ||
1296 | * This generic handler doesn't seem to have any issues where the | ||
1297 | * unmasking occurs so it was left at the top. | ||
1298 | */ | ||
1299 | apic_write(APIC_LVTPC, APIC_DM_NMI); | ||
1300 | |||
1287 | for (idx = 0; idx < x86_pmu.num_counters; idx++) { | 1301 | for (idx = 0; idx < x86_pmu.num_counters; idx++) { |
1288 | if (!test_bit(idx, cpuc->active_mask)) { | 1302 | if (!test_bit(idx, cpuc->active_mask)) { |
1289 | /* | 1303 | /* |
@@ -1370,8 +1384,6 @@ perf_event_nmi_handler(struct notifier_block *self, | |||
1370 | return NOTIFY_DONE; | 1384 | return NOTIFY_DONE; |
1371 | } | 1385 | } |
1372 | 1386 | ||
1373 | apic_write(APIC_LVTPC, APIC_DM_NMI); | ||
1374 | |||
1375 | handled = x86_pmu.handle_irq(args->regs); | 1387 | handled = x86_pmu.handle_irq(args->regs); |
1376 | if (!handled) | 1388 | if (!handled) |
1377 | return NOTIFY_DONE; | 1389 | return NOTIFY_DONE; |
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c index 461f62bbd774..cf4e369cea67 100644 --- a/arch/x86/kernel/cpu/perf_event_amd.c +++ b/arch/x86/kernel/cpu/perf_event_amd.c | |||
@@ -8,7 +8,7 @@ static __initconst const u64 amd_hw_cache_event_ids | |||
8 | [ C(L1D) ] = { | 8 | [ C(L1D) ] = { |
9 | [ C(OP_READ) ] = { | 9 | [ C(OP_READ) ] = { |
10 | [ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses */ | 10 | [ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses */ |
11 | [ C(RESULT_MISS) ] = 0x0041, /* Data Cache Misses */ | 11 | [ C(RESULT_MISS) ] = 0x0141, /* Data Cache Misses */ |
12 | }, | 12 | }, |
13 | [ C(OP_WRITE) ] = { | 13 | [ C(OP_WRITE) ] = { |
14 | [ C(RESULT_ACCESS) ] = 0x0142, /* Data Cache Refills :system */ | 14 | [ C(RESULT_ACCESS) ] = 0x0142, /* Data Cache Refills :system */ |
@@ -427,7 +427,9 @@ static __initconst const struct x86_pmu amd_pmu = { | |||
427 | * | 427 | * |
428 | * Exceptions: | 428 | * Exceptions: |
429 | * | 429 | * |
430 | * 0x000 FP PERF_CTL[3], PERF_CTL[5:3] (*) | ||
430 | * 0x003 FP PERF_CTL[3] | 431 | * 0x003 FP PERF_CTL[3] |
432 | * 0x004 FP PERF_CTL[3], PERF_CTL[5:3] (*) | ||
431 | * 0x00B FP PERF_CTL[3] | 433 | * 0x00B FP PERF_CTL[3] |
432 | * 0x00D FP PERF_CTL[3] | 434 | * 0x00D FP PERF_CTL[3] |
433 | * 0x023 DE PERF_CTL[2:0] | 435 | * 0x023 DE PERF_CTL[2:0] |
@@ -448,6 +450,8 @@ static __initconst const struct x86_pmu amd_pmu = { | |||
448 | * 0x0DF LS PERF_CTL[5:0] | 450 | * 0x0DF LS PERF_CTL[5:0] |
449 | * 0x1D6 EX PERF_CTL[5:0] | 451 | * 0x1D6 EX PERF_CTL[5:0] |
450 | * 0x1D8 EX PERF_CTL[5:0] | 452 | * 0x1D8 EX PERF_CTL[5:0] |
453 | * | ||
454 | * (*) depending on the umask all FPU counters may be used | ||
451 | */ | 455 | */ |
452 | 456 | ||
453 | static struct event_constraint amd_f15_PMC0 = EVENT_CONSTRAINT(0, 0x01, 0); | 457 | static struct event_constraint amd_f15_PMC0 = EVENT_CONSTRAINT(0, 0x01, 0); |
@@ -460,18 +464,28 @@ static struct event_constraint amd_f15_PMC53 = EVENT_CONSTRAINT(0, 0x38, 0); | |||
460 | static struct event_constraint * | 464 | static struct event_constraint * |
461 | amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, struct perf_event *event) | 465 | amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, struct perf_event *event) |
462 | { | 466 | { |
463 | unsigned int event_code = amd_get_event_code(&event->hw); | 467 | struct hw_perf_event *hwc = &event->hw; |
468 | unsigned int event_code = amd_get_event_code(hwc); | ||
464 | 469 | ||
465 | switch (event_code & AMD_EVENT_TYPE_MASK) { | 470 | switch (event_code & AMD_EVENT_TYPE_MASK) { |
466 | case AMD_EVENT_FP: | 471 | case AMD_EVENT_FP: |
467 | switch (event_code) { | 472 | switch (event_code) { |
473 | case 0x000: | ||
474 | if (!(hwc->config & 0x0000F000ULL)) | ||
475 | break; | ||
476 | if (!(hwc->config & 0x00000F00ULL)) | ||
477 | break; | ||
478 | return &amd_f15_PMC3; | ||
479 | case 0x004: | ||
480 | if (hweight_long(hwc->config & ARCH_PERFMON_EVENTSEL_UMASK) <= 1) | ||
481 | break; | ||
482 | return &amd_f15_PMC3; | ||
468 | case 0x003: | 483 | case 0x003: |
469 | case 0x00B: | 484 | case 0x00B: |
470 | case 0x00D: | 485 | case 0x00D: |
471 | return &amd_f15_PMC3; | 486 | return &amd_f15_PMC3; |
472 | default: | ||
473 | return &amd_f15_PMC53; | ||
474 | } | 487 | } |
488 | return &amd_f15_PMC53; | ||
475 | case AMD_EVENT_LS: | 489 | case AMD_EVENT_LS: |
476 | case AMD_EVENT_DC: | 490 | case AMD_EVENT_DC: |
477 | case AMD_EVENT_EX_LS: | 491 | case AMD_EVENT_EX_LS: |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 8fc2b2cee1da..e61539b07d2c 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -25,7 +25,7 @@ struct intel_percore { | |||
25 | /* | 25 | /* |
26 | * Intel PerfMon, used on Core and later. | 26 | * Intel PerfMon, used on Core and later. |
27 | */ | 27 | */ |
28 | static const u64 intel_perfmon_event_map[] = | 28 | static u64 intel_perfmon_event_map[PERF_COUNT_HW_MAX] __read_mostly = |
29 | { | 29 | { |
30 | [PERF_COUNT_HW_CPU_CYCLES] = 0x003c, | 30 | [PERF_COUNT_HW_CPU_CYCLES] = 0x003c, |
31 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | 31 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
@@ -391,12 +391,12 @@ static __initconst const u64 nehalem_hw_cache_event_ids | |||
391 | { | 391 | { |
392 | [ C(L1D) ] = { | 392 | [ C(L1D) ] = { |
393 | [ C(OP_READ) ] = { | 393 | [ C(OP_READ) ] = { |
394 | [ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI */ | 394 | [ C(RESULT_ACCESS) ] = 0x010b, /* MEM_INST_RETIRED.LOADS */ |
395 | [ C(RESULT_MISS) ] = 0x0140, /* L1D_CACHE_LD.I_STATE */ | 395 | [ C(RESULT_MISS) ] = 0x0151, /* L1D.REPL */ |
396 | }, | 396 | }, |
397 | [ C(OP_WRITE) ] = { | 397 | [ C(OP_WRITE) ] = { |
398 | [ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI */ | 398 | [ C(RESULT_ACCESS) ] = 0x020b, /* MEM_INST_RETURED.STORES */ |
399 | [ C(RESULT_MISS) ] = 0x0141, /* L1D_CACHE_ST.I_STATE */ | 399 | [ C(RESULT_MISS) ] = 0x0251, /* L1D.M_REPL */ |
400 | }, | 400 | }, |
401 | [ C(OP_PREFETCH) ] = { | 401 | [ C(OP_PREFETCH) ] = { |
402 | [ C(RESULT_ACCESS) ] = 0x014e, /* L1D_PREFETCH.REQUESTS */ | 402 | [ C(RESULT_ACCESS) ] = 0x014e, /* L1D_PREFETCH.REQUESTS */ |
@@ -933,6 +933,16 @@ static int intel_pmu_handle_irq(struct pt_regs *regs) | |||
933 | 933 | ||
934 | cpuc = &__get_cpu_var(cpu_hw_events); | 934 | cpuc = &__get_cpu_var(cpu_hw_events); |
935 | 935 | ||
936 | /* | ||
937 | * Some chipsets need to unmask the LVTPC in a particular spot | ||
938 | * inside the nmi handler. As a result, the unmasking was pushed | ||
939 | * into all the nmi handlers. | ||
940 | * | ||
941 | * This handler doesn't seem to have any issues with the unmasking | ||
942 | * so it was left at the top. | ||
943 | */ | ||
944 | apic_write(APIC_LVTPC, APIC_DM_NMI); | ||
945 | |||
936 | intel_pmu_disable_all(); | 946 | intel_pmu_disable_all(); |
937 | handled = intel_pmu_drain_bts_buffer(); | 947 | handled = intel_pmu_drain_bts_buffer(); |
938 | status = intel_pmu_get_status(); | 948 | status = intel_pmu_get_status(); |
@@ -998,6 +1008,9 @@ intel_bts_constraints(struct perf_event *event) | |||
998 | struct hw_perf_event *hwc = &event->hw; | 1008 | struct hw_perf_event *hwc = &event->hw; |
999 | unsigned int hw_event, bts_event; | 1009 | unsigned int hw_event, bts_event; |
1000 | 1010 | ||
1011 | if (event->attr.freq) | ||
1012 | return NULL; | ||
1013 | |||
1001 | hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; | 1014 | hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; |
1002 | bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); | 1015 | bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); |
1003 | 1016 | ||
@@ -1305,7 +1318,7 @@ static void intel_clovertown_quirks(void) | |||
1305 | * AJ106 could possibly be worked around by not allowing LBR | 1318 | * AJ106 could possibly be worked around by not allowing LBR |
1306 | * usage from PEBS, including the fixup. | 1319 | * usage from PEBS, including the fixup. |
1307 | * AJ68 could possibly be worked around by always programming | 1320 | * AJ68 could possibly be worked around by always programming |
1308 | * a pebs_event_reset[0] value and coping with the lost events. | 1321 | * a pebs_event_reset[0] value and coping with the lost events. |
1309 | * | 1322 | * |
1310 | * But taken together it might just make sense to not enable PEBS on | 1323 | * But taken together it might just make sense to not enable PEBS on |
1311 | * these chips. | 1324 | * these chips. |
@@ -1409,6 +1422,18 @@ static __init int intel_pmu_init(void) | |||
1409 | x86_pmu.percore_constraints = intel_nehalem_percore_constraints; | 1422 | x86_pmu.percore_constraints = intel_nehalem_percore_constraints; |
1410 | x86_pmu.enable_all = intel_pmu_nhm_enable_all; | 1423 | x86_pmu.enable_all = intel_pmu_nhm_enable_all; |
1411 | x86_pmu.extra_regs = intel_nehalem_extra_regs; | 1424 | x86_pmu.extra_regs = intel_nehalem_extra_regs; |
1425 | |||
1426 | if (ebx & 0x40) { | ||
1427 | /* | ||
1428 | * Erratum AAJ80 detected, we work it around by using | ||
1429 | * the BR_MISP_EXEC.ANY event. This will over-count | ||
1430 | * branch-misses, but it's still much better than the | ||
1431 | * architectural event which is often completely bogus: | ||
1432 | */ | ||
1433 | intel_perfmon_event_map[PERF_COUNT_HW_BRANCH_MISSES] = 0x7f89; | ||
1434 | |||
1435 | pr_cont("erratum AAJ80 worked around, "); | ||
1436 | } | ||
1412 | pr_cont("Nehalem events, "); | 1437 | pr_cont("Nehalem events, "); |
1413 | break; | 1438 | break; |
1414 | 1439 | ||
@@ -1425,6 +1450,7 @@ static __init int intel_pmu_init(void) | |||
1425 | 1450 | ||
1426 | case 37: /* 32 nm nehalem, "Clarkdale" */ | 1451 | case 37: /* 32 nm nehalem, "Clarkdale" */ |
1427 | case 44: /* 32 nm nehalem, "Gulftown" */ | 1452 | case 44: /* 32 nm nehalem, "Gulftown" */ |
1453 | case 47: /* 32 nm Xeon E7 */ | ||
1428 | memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids, | 1454 | memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids, |
1429 | sizeof(hw_cache_event_ids)); | 1455 | sizeof(hw_cache_event_ids)); |
1430 | memcpy(hw_cache_extra_regs, nehalem_hw_cache_extra_regs, | 1456 | memcpy(hw_cache_extra_regs, nehalem_hw_cache_extra_regs, |
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c index c2520e178d32..e93fcd55fae1 100644 --- a/arch/x86/kernel/cpu/perf_event_p4.c +++ b/arch/x86/kernel/cpu/perf_event_p4.c | |||
@@ -947,14 +947,23 @@ static int p4_pmu_handle_irq(struct pt_regs *regs) | |||
947 | if (!x86_perf_event_set_period(event)) | 947 | if (!x86_perf_event_set_period(event)) |
948 | continue; | 948 | continue; |
949 | if (perf_event_overflow(event, 1, &data, regs)) | 949 | if (perf_event_overflow(event, 1, &data, regs)) |
950 | p4_pmu_disable_event(event); | 950 | x86_pmu_stop(event, 0); |
951 | } | 951 | } |
952 | 952 | ||
953 | if (handled) { | 953 | if (handled) |
954 | /* p4 quirk: unmask it again */ | ||
955 | apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED); | ||
956 | inc_irq_stat(apic_perf_irqs); | 954 | inc_irq_stat(apic_perf_irqs); |
957 | } | 955 | |
956 | /* | ||
957 | * When dealing with the unmasking of the LVTPC on P4 perf hw, it has | ||
958 | * been observed that the OVF bit flag has to be cleared first _before_ | ||
959 | * the LVTPC can be unmasked. | ||
960 | * | ||
961 | * The reason is the NMI line will continue to be asserted while the OVF | ||
962 | * bit is set. This causes a second NMI to generate if the LVTPC is | ||
963 | * unmasked before the OVF bit is cleared, leading to unknown NMI | ||
964 | * messages. | ||
965 | */ | ||
966 | apic_write(APIC_LVTPC, APIC_DM_NMI); | ||
958 | 967 | ||
959 | return handled; | 968 | return handled; |
960 | } | 969 | } |
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index 706a9fb46a58..e90f08458e6b 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c | |||
@@ -391,7 +391,7 @@ static int ioapic_xlate(struct irq_domain *id, const u32 *intspec, u32 intsize, | |||
391 | 391 | ||
392 | set_io_apic_irq_attr(&attr, idx, line, it->trigger, it->polarity); | 392 | set_io_apic_irq_attr(&attr, idx, line, it->trigger, it->polarity); |
393 | 393 | ||
394 | return io_apic_setup_irq_pin(*out_hwirq, cpu_to_node(0), &attr); | 394 | return io_apic_setup_irq_pin_once(*out_hwirq, cpu_to_node(0), &attr); |
395 | } | 395 | } |
396 | 396 | ||
397 | static void __init ioapic_add_ofnode(struct device_node *np) | 397 | static void __init ioapic_add_ofnode(struct device_node *np) |
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c index 82ada01625b9..b117efd24f71 100644 --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c | |||
@@ -81,6 +81,9 @@ static u32 gart_unmapped_entry; | |||
81 | #define AGPEXTERN | 81 | #define AGPEXTERN |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | /* GART can only remap to physical addresses < 1TB */ | ||
85 | #define GART_MAX_PHYS_ADDR (1ULL << 40) | ||
86 | |||
84 | /* backdoor interface to AGP driver */ | 87 | /* backdoor interface to AGP driver */ |
85 | AGPEXTERN int agp_memory_reserved; | 88 | AGPEXTERN int agp_memory_reserved; |
86 | AGPEXTERN __u32 *agp_gatt_table; | 89 | AGPEXTERN __u32 *agp_gatt_table; |
@@ -212,9 +215,13 @@ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem, | |||
212 | size_t size, int dir, unsigned long align_mask) | 215 | size_t size, int dir, unsigned long align_mask) |
213 | { | 216 | { |
214 | unsigned long npages = iommu_num_pages(phys_mem, size, PAGE_SIZE); | 217 | unsigned long npages = iommu_num_pages(phys_mem, size, PAGE_SIZE); |
215 | unsigned long iommu_page = alloc_iommu(dev, npages, align_mask); | 218 | unsigned long iommu_page; |
216 | int i; | 219 | int i; |
217 | 220 | ||
221 | if (unlikely(phys_mem + size > GART_MAX_PHYS_ADDR)) | ||
222 | return bad_dma_addr; | ||
223 | |||
224 | iommu_page = alloc_iommu(dev, npages, align_mask); | ||
218 | if (iommu_page == -1) { | 225 | if (iommu_page == -1) { |
219 | if (!nonforced_iommu(dev, phys_mem, size)) | 226 | if (!nonforced_iommu(dev, phys_mem, size)) |
220 | return phys_mem; | 227 | return phys_mem; |
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 9559d360fde7..745258dfc4dc 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c | |||
@@ -213,53 +213,48 @@ int early_cpu_to_node(int cpu) | |||
213 | return per_cpu(x86_cpu_to_node_map, cpu); | 213 | return per_cpu(x86_cpu_to_node_map, cpu); |
214 | } | 214 | } |
215 | 215 | ||
216 | struct cpumask __cpuinit *debug_cpumask_set_cpu(int cpu, int enable) | 216 | void debug_cpumask_set_cpu(int cpu, int node, bool enable) |
217 | { | 217 | { |
218 | int node = early_cpu_to_node(cpu); | ||
219 | struct cpumask *mask; | 218 | struct cpumask *mask; |
220 | char buf[64]; | 219 | char buf[64]; |
221 | 220 | ||
222 | if (node == NUMA_NO_NODE) { | 221 | if (node == NUMA_NO_NODE) { |
223 | /* early_cpu_to_node() already emits a warning and trace */ | 222 | /* early_cpu_to_node() already emits a warning and trace */ |
224 | return NULL; | 223 | return; |
225 | } | 224 | } |
226 | mask = node_to_cpumask_map[node]; | 225 | mask = node_to_cpumask_map[node]; |
227 | if (!mask) { | 226 | if (!mask) { |
228 | pr_err("node_to_cpumask_map[%i] NULL\n", node); | 227 | pr_err("node_to_cpumask_map[%i] NULL\n", node); |
229 | dump_stack(); | 228 | dump_stack(); |
230 | return NULL; | 229 | return; |
231 | } | 230 | } |
232 | 231 | ||
232 | if (enable) | ||
233 | cpumask_set_cpu(cpu, mask); | ||
234 | else | ||
235 | cpumask_clear_cpu(cpu, mask); | ||
236 | |||
233 | cpulist_scnprintf(buf, sizeof(buf), mask); | 237 | cpulist_scnprintf(buf, sizeof(buf), mask); |
234 | printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n", | 238 | printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n", |
235 | enable ? "numa_add_cpu" : "numa_remove_cpu", | 239 | enable ? "numa_add_cpu" : "numa_remove_cpu", |
236 | cpu, node, buf); | 240 | cpu, node, buf); |
237 | return mask; | 241 | return; |
238 | } | 242 | } |
239 | 243 | ||
240 | # ifndef CONFIG_NUMA_EMU | 244 | # ifndef CONFIG_NUMA_EMU |
241 | static void __cpuinit numa_set_cpumask(int cpu, int enable) | 245 | static void __cpuinit numa_set_cpumask(int cpu, bool enable) |
242 | { | 246 | { |
243 | struct cpumask *mask; | 247 | debug_cpumask_set_cpu(cpu, early_cpu_to_node(cpu), enable); |
244 | |||
245 | mask = debug_cpumask_set_cpu(cpu, enable); | ||
246 | if (!mask) | ||
247 | return; | ||
248 | |||
249 | if (enable) | ||
250 | cpumask_set_cpu(cpu, mask); | ||
251 | else | ||
252 | cpumask_clear_cpu(cpu, mask); | ||
253 | } | 248 | } |
254 | 249 | ||
255 | void __cpuinit numa_add_cpu(int cpu) | 250 | void __cpuinit numa_add_cpu(int cpu) |
256 | { | 251 | { |
257 | numa_set_cpumask(cpu, 1); | 252 | numa_set_cpumask(cpu, true); |
258 | } | 253 | } |
259 | 254 | ||
260 | void __cpuinit numa_remove_cpu(int cpu) | 255 | void __cpuinit numa_remove_cpu(int cpu) |
261 | { | 256 | { |
262 | numa_set_cpumask(cpu, 0); | 257 | numa_set_cpumask(cpu, false); |
263 | } | 258 | } |
264 | # endif /* !CONFIG_NUMA_EMU */ | 259 | # endif /* !CONFIG_NUMA_EMU */ |
265 | 260 | ||
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index ad091e4cff17..de84cc140379 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c | |||
@@ -454,10 +454,9 @@ void __cpuinit numa_remove_cpu(int cpu) | |||
454 | cpumask_clear_cpu(cpu, node_to_cpumask_map[i]); | 454 | cpumask_clear_cpu(cpu, node_to_cpumask_map[i]); |
455 | } | 455 | } |
456 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 456 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
457 | static void __cpuinit numa_set_cpumask(int cpu, int enable) | 457 | static void __cpuinit numa_set_cpumask(int cpu, bool enable) |
458 | { | 458 | { |
459 | struct cpumask *mask; | 459 | int nid, physnid; |
460 | int nid, physnid, i; | ||
461 | 460 | ||
462 | nid = early_cpu_to_node(cpu); | 461 | nid = early_cpu_to_node(cpu); |
463 | if (nid == NUMA_NO_NODE) { | 462 | if (nid == NUMA_NO_NODE) { |
@@ -467,28 +466,21 @@ static void __cpuinit numa_set_cpumask(int cpu, int enable) | |||
467 | 466 | ||
468 | physnid = emu_nid_to_phys[nid]; | 467 | physnid = emu_nid_to_phys[nid]; |
469 | 468 | ||
470 | for_each_online_node(i) { | 469 | for_each_online_node(nid) { |
471 | if (emu_nid_to_phys[nid] != physnid) | 470 | if (emu_nid_to_phys[nid] != physnid) |
472 | continue; | 471 | continue; |
473 | 472 | ||
474 | mask = debug_cpumask_set_cpu(cpu, enable); | 473 | debug_cpumask_set_cpu(cpu, nid, enable); |
475 | if (!mask) | ||
476 | return; | ||
477 | |||
478 | if (enable) | ||
479 | cpumask_set_cpu(cpu, mask); | ||
480 | else | ||
481 | cpumask_clear_cpu(cpu, mask); | ||
482 | } | 474 | } |
483 | } | 475 | } |
484 | 476 | ||
485 | void __cpuinit numa_add_cpu(int cpu) | 477 | void __cpuinit numa_add_cpu(int cpu) |
486 | { | 478 | { |
487 | numa_set_cpumask(cpu, 1); | 479 | numa_set_cpumask(cpu, true); |
488 | } | 480 | } |
489 | 481 | ||
490 | void __cpuinit numa_remove_cpu(int cpu) | 482 | void __cpuinit numa_remove_cpu(int cpu) |
491 | { | 483 | { |
492 | numa_set_cpumask(cpu, 0); | 484 | numa_set_cpumask(cpu, false); |
493 | } | 485 | } |
494 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 486 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
diff --git a/arch/x86/platform/ce4100/falconfalls.dts b/arch/x86/platform/ce4100/falconfalls.dts index dc701ea58546..e70be38ce039 100644 --- a/arch/x86/platform/ce4100/falconfalls.dts +++ b/arch/x86/platform/ce4100/falconfalls.dts | |||
@@ -74,6 +74,7 @@ | |||
74 | compatible = "intel,ce4100-pci", "pci"; | 74 | compatible = "intel,ce4100-pci", "pci"; |
75 | device_type = "pci"; | 75 | device_type = "pci"; |
76 | bus-range = <1 1>; | 76 | bus-range = <1 1>; |
77 | reg = <0x0800 0x0 0x0 0x0 0x0>; | ||
77 | ranges = <0x2000000 0 0xdffe0000 0x2000000 0 0xdffe0000 0 0x1000>; | 78 | ranges = <0x2000000 0 0xdffe0000 0x2000000 0 0xdffe0000 0 0x1000>; |
78 | 79 | ||
79 | interrupt-parent = <&ioapic2>; | 80 | interrupt-parent = <&ioapic2>; |
@@ -346,7 +347,7 @@ | |||
346 | "pciclass0c03"; | 347 | "pciclass0c03"; |
347 | 348 | ||
348 | reg = <0x16800 0x0 0x0 0x0 0x0>; | 349 | reg = <0x16800 0x0 0x0 0x0 0x0>; |
349 | interrupts = <22 3>; | 350 | interrupts = <22 1>; |
350 | }; | 351 | }; |
351 | 352 | ||
352 | usb@d,1 { | 353 | usb@d,1 { |
@@ -356,7 +357,7 @@ | |||
356 | "pciclass0c03"; | 357 | "pciclass0c03"; |
357 | 358 | ||
358 | reg = <0x16900 0x0 0x0 0x0 0x0>; | 359 | reg = <0x16900 0x0 0x0 0x0 0x0>; |
359 | interrupts = <22 3>; | 360 | interrupts = <22 1>; |
360 | }; | 361 | }; |
361 | 362 | ||
362 | sata@e,0 { | 363 | sata@e,0 { |
@@ -366,7 +367,7 @@ | |||
366 | "pciclass0106"; | 367 | "pciclass0106"; |
367 | 368 | ||
368 | reg = <0x17000 0x0 0x0 0x0 0x0>; | 369 | reg = <0x17000 0x0 0x0 0x0 0x0>; |
369 | interrupts = <23 3>; | 370 | interrupts = <23 1>; |
370 | }; | 371 | }; |
371 | 372 | ||
372 | flash@f,0 { | 373 | flash@f,0 { |
@@ -412,6 +413,7 @@ | |||
412 | #address-cells = <2>; | 413 | #address-cells = <2>; |
413 | #size-cells = <1>; | 414 | #size-cells = <1>; |
414 | compatible = "isa"; | 415 | compatible = "isa"; |
416 | reg = <0xf800 0x0 0x0 0x0 0x0>; | ||
415 | ranges = <1 0 0 0 0 0x100>; | 417 | ranges = <1 0 0 0 0 0x100>; |
416 | 418 | ||
417 | rtc@70 { | 419 | rtc@70 { |
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index 5c0207bf959b..275dbc19e2cf 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c | |||
@@ -97,11 +97,11 @@ static int __init sfi_parse_mtmr(struct sfi_table_header *table) | |||
97 | pentry->freq_hz, pentry->irq); | 97 | pentry->freq_hz, pentry->irq); |
98 | if (!pentry->irq) | 98 | if (!pentry->irq) |
99 | continue; | 99 | continue; |
100 | mp_irq.type = MP_IOAPIC; | 100 | mp_irq.type = MP_INTSRC; |
101 | mp_irq.irqtype = mp_INT; | 101 | mp_irq.irqtype = mp_INT; |
102 | /* triggering mode edge bit 2-3, active high polarity bit 0-1 */ | 102 | /* triggering mode edge bit 2-3, active high polarity bit 0-1 */ |
103 | mp_irq.irqflag = 5; | 103 | mp_irq.irqflag = 5; |
104 | mp_irq.srcbus = 0; | 104 | mp_irq.srcbus = MP_BUS_ISA; |
105 | mp_irq.srcbusirq = pentry->irq; /* IRQ */ | 105 | mp_irq.srcbusirq = pentry->irq; /* IRQ */ |
106 | mp_irq.dstapic = MP_APIC_ALL; | 106 | mp_irq.dstapic = MP_APIC_ALL; |
107 | mp_irq.dstirq = pentry->irq; | 107 | mp_irq.dstirq = pentry->irq; |
@@ -168,10 +168,10 @@ int __init sfi_parse_mrtc(struct sfi_table_header *table) | |||
168 | for (totallen = 0; totallen < sfi_mrtc_num; totallen++, pentry++) { | 168 | for (totallen = 0; totallen < sfi_mrtc_num; totallen++, pentry++) { |
169 | pr_debug("RTC[%d]: paddr = 0x%08x, irq = %d\n", | 169 | pr_debug("RTC[%d]: paddr = 0x%08x, irq = %d\n", |
170 | totallen, (u32)pentry->phys_addr, pentry->irq); | 170 | totallen, (u32)pentry->phys_addr, pentry->irq); |
171 | mp_irq.type = MP_IOAPIC; | 171 | mp_irq.type = MP_INTSRC; |
172 | mp_irq.irqtype = mp_INT; | 172 | mp_irq.irqtype = mp_INT; |
173 | mp_irq.irqflag = 0xf; /* level trigger and active low */ | 173 | mp_irq.irqflag = 0xf; /* level trigger and active low */ |
174 | mp_irq.srcbus = 0; | 174 | mp_irq.srcbus = MP_BUS_ISA; |
175 | mp_irq.srcbusirq = pentry->irq; /* IRQ */ | 175 | mp_irq.srcbusirq = pentry->irq; /* IRQ */ |
176 | mp_irq.dstapic = MP_APIC_ALL; | 176 | mp_irq.dstapic = MP_APIC_ALL; |
177 | mp_irq.dstirq = pentry->irq; | 177 | mp_irq.dstirq = pentry->irq; |
@@ -282,7 +282,7 @@ void __init x86_mrst_early_setup(void) | |||
282 | /* Avoid searching for BIOS MP tables */ | 282 | /* Avoid searching for BIOS MP tables */ |
283 | x86_init.mpparse.find_smp_config = x86_init_noop; | 283 | x86_init.mpparse.find_smp_config = x86_init_noop; |
284 | x86_init.mpparse.get_smp_config = x86_init_uint_noop; | 284 | x86_init.mpparse.get_smp_config = x86_init_uint_noop; |
285 | 285 | set_bit(MP_BUS_ISA, mp_bus_not_pci); | |
286 | } | 286 | } |
287 | 287 | ||
288 | /* | 288 | /* |
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig index 1c7121ba18ff..5cc821cb2e09 100644 --- a/arch/x86/xen/Kconfig +++ b/arch/x86/xen/Kconfig | |||
@@ -39,6 +39,7 @@ config XEN_MAX_DOMAIN_MEMORY | |||
39 | config XEN_SAVE_RESTORE | 39 | config XEN_SAVE_RESTORE |
40 | bool | 40 | bool |
41 | depends on XEN | 41 | depends on XEN |
42 | select HIBERNATE_CALLBACKS | ||
42 | default y | 43 | default y |
43 | 44 | ||
44 | config XEN_DEBUG_FS | 45 | config XEN_DEBUG_FS |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 49dbd78ec3cb..e3c6a06cf725 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -238,6 +238,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, | |||
238 | static __init void xen_init_cpuid_mask(void) | 238 | static __init void xen_init_cpuid_mask(void) |
239 | { | 239 | { |
240 | unsigned int ax, bx, cx, dx; | 240 | unsigned int ax, bx, cx, dx; |
241 | unsigned int xsave_mask; | ||
241 | 242 | ||
242 | cpuid_leaf1_edx_mask = | 243 | cpuid_leaf1_edx_mask = |
243 | ~((1 << X86_FEATURE_MCE) | /* disable MCE */ | 244 | ~((1 << X86_FEATURE_MCE) | /* disable MCE */ |
@@ -249,24 +250,16 @@ static __init void xen_init_cpuid_mask(void) | |||
249 | cpuid_leaf1_edx_mask &= | 250 | cpuid_leaf1_edx_mask &= |
250 | ~((1 << X86_FEATURE_APIC) | /* disable local APIC */ | 251 | ~((1 << X86_FEATURE_APIC) | /* disable local APIC */ |
251 | (1 << X86_FEATURE_ACPI)); /* disable ACPI */ | 252 | (1 << X86_FEATURE_ACPI)); /* disable ACPI */ |
252 | |||
253 | ax = 1; | 253 | ax = 1; |
254 | cx = 0; | ||
255 | xen_cpuid(&ax, &bx, &cx, &dx); | 254 | xen_cpuid(&ax, &bx, &cx, &dx); |
256 | 255 | ||
257 | /* cpuid claims we support xsave; try enabling it to see what happens */ | 256 | xsave_mask = |
258 | if (cx & (1 << (X86_FEATURE_XSAVE % 32))) { | 257 | (1 << (X86_FEATURE_XSAVE % 32)) | |
259 | unsigned long cr4; | 258 | (1 << (X86_FEATURE_OSXSAVE % 32)); |
260 | |||
261 | set_in_cr4(X86_CR4_OSXSAVE); | ||
262 | |||
263 | cr4 = read_cr4(); | ||
264 | 259 | ||
265 | if ((cr4 & X86_CR4_OSXSAVE) == 0) | 260 | /* Xen will set CR4.OSXSAVE if supported and not disabled by force */ |
266 | cpuid_leaf1_ecx_mask &= ~(1 << (X86_FEATURE_XSAVE % 32)); | 261 | if ((cx & xsave_mask) != xsave_mask) |
267 | 262 | cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */ | |
268 | clear_in_cr4(X86_CR4_OSXSAVE); | ||
269 | } | ||
270 | } | 263 | } |
271 | 264 | ||
272 | static void xen_set_debugreg(int reg, unsigned long val) | 265 | static void xen_set_debugreg(int reg, unsigned long val) |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index c82df6c9c0f0..aef7af92b28b 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -565,13 +565,13 @@ pte_t xen_make_pte_debug(pteval_t pte) | |||
565 | if (io_page && | 565 | if (io_page && |
566 | (xen_initial_domain() || addr >= ISA_END_ADDRESS)) { | 566 | (xen_initial_domain() || addr >= ISA_END_ADDRESS)) { |
567 | other_addr = pfn_to_mfn(addr >> PAGE_SHIFT) << PAGE_SHIFT; | 567 | other_addr = pfn_to_mfn(addr >> PAGE_SHIFT) << PAGE_SHIFT; |
568 | WARN(addr != other_addr, | 568 | WARN_ONCE(addr != other_addr, |
569 | "0x%lx is using VM_IO, but it is 0x%lx!\n", | 569 | "0x%lx is using VM_IO, but it is 0x%lx!\n", |
570 | (unsigned long)addr, (unsigned long)other_addr); | 570 | (unsigned long)addr, (unsigned long)other_addr); |
571 | } else { | 571 | } else { |
572 | pteval_t iomap_set = (_pte.pte & PTE_FLAGS_MASK) & _PAGE_IOMAP; | 572 | pteval_t iomap_set = (_pte.pte & PTE_FLAGS_MASK) & _PAGE_IOMAP; |
573 | other_addr = (_pte.pte & PTE_PFN_MASK); | 573 | other_addr = (_pte.pte & PTE_PFN_MASK); |
574 | WARN((addr == other_addr) && (!io_page) && (!iomap_set), | 574 | WARN_ONCE((addr == other_addr) && (!io_page) && (!iomap_set), |
575 | "0x%lx is missing VM_IO (and wasn't fixed)!\n", | 575 | "0x%lx is missing VM_IO (and wasn't fixed)!\n", |
576 | (unsigned long)addr); | 576 | (unsigned long)addr); |
577 | } | 577 | } |
@@ -1473,16 +1473,20 @@ static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd) | |||
1473 | #endif | 1473 | #endif |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | #ifdef CONFIG_X86_32 | ||
1476 | static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte) | 1477 | static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte) |
1477 | { | 1478 | { |
1478 | unsigned long pfn = pte_pfn(pte); | ||
1479 | |||
1480 | #ifdef CONFIG_X86_32 | ||
1481 | /* If there's an existing pte, then don't allow _PAGE_RW to be set */ | 1479 | /* If there's an existing pte, then don't allow _PAGE_RW to be set */ |
1482 | if (pte_val_ma(*ptep) & _PAGE_PRESENT) | 1480 | if (pte_val_ma(*ptep) & _PAGE_PRESENT) |
1483 | pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) & | 1481 | pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) & |
1484 | pte_val_ma(pte)); | 1482 | pte_val_ma(pte)); |
1485 | #endif | 1483 | |
1484 | return pte; | ||
1485 | } | ||
1486 | #else /* CONFIG_X86_64 */ | ||
1487 | static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte) | ||
1488 | { | ||
1489 | unsigned long pfn = pte_pfn(pte); | ||
1486 | 1490 | ||
1487 | /* | 1491 | /* |
1488 | * If the new pfn is within the range of the newly allocated | 1492 | * If the new pfn is within the range of the newly allocated |
@@ -1497,6 +1501,7 @@ static __init pte_t mask_rw_pte(pte_t *ptep, pte_t pte) | |||
1497 | 1501 | ||
1498 | return pte; | 1502 | return pte; |
1499 | } | 1503 | } |
1504 | #endif /* CONFIG_X86_64 */ | ||
1500 | 1505 | ||
1501 | /* Init-time set_pte while constructing initial pagetables, which | 1506 | /* Init-time set_pte while constructing initial pagetables, which |
1502 | doesn't allow RO pagetable pages to be remapped RW */ | 1507 | doesn't allow RO pagetable pages to be remapped RW */ |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index fa0269a99377..90bac0aac3a5 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -227,7 +227,7 @@ char * __init xen_memory_setup(void) | |||
227 | 227 | ||
228 | memcpy(map_raw, map, sizeof(map)); | 228 | memcpy(map_raw, map, sizeof(map)); |
229 | e820.nr_map = 0; | 229 | e820.nr_map = 0; |
230 | xen_extra_mem_start = mem_end; | 230 | xen_extra_mem_start = max((1ULL << 32), mem_end); |
231 | for (i = 0; i < memmap.nr_entries; i++) { | 231 | for (i = 0; i < memmap.nr_entries; i++) { |
232 | unsigned long long end; | 232 | unsigned long long end; |
233 | 233 | ||
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c index d77089df412e..4340ee076bd5 100644 --- a/arch/xtensa/kernel/irq.c +++ b/arch/xtensa/kernel/irq.c | |||
@@ -64,47 +64,41 @@ asmlinkage void do_IRQ(int irq, struct pt_regs *regs) | |||
64 | 64 | ||
65 | int arch_show_interrupts(struct seq_file *p, int prec) | 65 | int arch_show_interrupts(struct seq_file *p, int prec) |
66 | { | 66 | { |
67 | int j; | ||
68 | |||
69 | seq_printf(p, "%*s: ", prec, "NMI"); | ||
70 | for_each_online_cpu(j) | ||
71 | seq_printf(p, "%10u ", nmi_count(j)); | ||
72 | seq_putc(p, '\n'); | ||
73 | seq_printf(p, "%*s: ", prec, "ERR"); | 67 | seq_printf(p, "%*s: ", prec, "ERR"); |
74 | seq_printf(p, "%10u\n", atomic_read(&irq_err_count)); | 68 | seq_printf(p, "%10u\n", atomic_read(&irq_err_count)); |
75 | return 0; | 69 | return 0; |
76 | } | 70 | } |
77 | 71 | ||
78 | static void xtensa_irq_mask(struct irq_chip *d) | 72 | static void xtensa_irq_mask(struct irq_data *d) |
79 | { | 73 | { |
80 | cached_irq_mask &= ~(1 << d->irq); | 74 | cached_irq_mask &= ~(1 << d->irq); |
81 | set_sr (cached_irq_mask, INTENABLE); | 75 | set_sr (cached_irq_mask, INTENABLE); |
82 | } | 76 | } |
83 | 77 | ||
84 | static void xtensa_irq_unmask(struct irq_chip *d) | 78 | static void xtensa_irq_unmask(struct irq_data *d) |
85 | { | 79 | { |
86 | cached_irq_mask |= 1 << d->irq; | 80 | cached_irq_mask |= 1 << d->irq; |
87 | set_sr (cached_irq_mask, INTENABLE); | 81 | set_sr (cached_irq_mask, INTENABLE); |
88 | } | 82 | } |
89 | 83 | ||
90 | static void xtensa_irq_enable(struct irq_chip *d) | 84 | static void xtensa_irq_enable(struct irq_data *d) |
91 | { | 85 | { |
92 | variant_irq_enable(d->irq); | 86 | variant_irq_enable(d->irq); |
93 | xtensa_irq_unmask(d->irq); | 87 | xtensa_irq_unmask(d->irq); |
94 | } | 88 | } |
95 | 89 | ||
96 | static void xtensa_irq_disable(struct irq_chip *d) | 90 | static void xtensa_irq_disable(struct irq_data *d) |
97 | { | 91 | { |
98 | xtensa_irq_mask(d->irq); | 92 | xtensa_irq_mask(d->irq); |
99 | variant_irq_disable(d->irq); | 93 | variant_irq_disable(d->irq); |
100 | } | 94 | } |
101 | 95 | ||
102 | static void xtensa_irq_ack(struct irq_chip *d) | 96 | static void xtensa_irq_ack(struct irq_data *d) |
103 | { | 97 | { |
104 | set_sr(1 << d->irq, INTCLEAR); | 98 | set_sr(1 << d->irq, INTCLEAR); |
105 | } | 99 | } |
106 | 100 | ||
107 | static int xtensa_irq_retrigger(struct irq_chip *d) | 101 | static int xtensa_irq_retrigger(struct irq_data *d) |
108 | { | 102 | { |
109 | set_sr (1 << d->irq, INTSET); | 103 | set_sr (1 << d->irq, INTSET); |
110 | return 1; | 104 | return 1; |
diff --git a/block/blk-core.c b/block/blk-core.c index 90f22cc30799..a2e58eeb3549 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -198,26 +198,13 @@ void blk_dump_rq_flags(struct request *rq, char *msg) | |||
198 | } | 198 | } |
199 | EXPORT_SYMBOL(blk_dump_rq_flags); | 199 | EXPORT_SYMBOL(blk_dump_rq_flags); |
200 | 200 | ||
201 | /* | ||
202 | * Make sure that plugs that were pending when this function was entered, | ||
203 | * are now complete and requests pushed to the queue. | ||
204 | */ | ||
205 | static inline void queue_sync_plugs(struct request_queue *q) | ||
206 | { | ||
207 | /* | ||
208 | * If the current process is plugged and has barriers submitted, | ||
209 | * we will livelock if we don't unplug first. | ||
210 | */ | ||
211 | blk_flush_plug(current); | ||
212 | } | ||
213 | |||
214 | static void blk_delay_work(struct work_struct *work) | 201 | static void blk_delay_work(struct work_struct *work) |
215 | { | 202 | { |
216 | struct request_queue *q; | 203 | struct request_queue *q; |
217 | 204 | ||
218 | q = container_of(work, struct request_queue, delay_work.work); | 205 | q = container_of(work, struct request_queue, delay_work.work); |
219 | spin_lock_irq(q->queue_lock); | 206 | spin_lock_irq(q->queue_lock); |
220 | __blk_run_queue(q, false); | 207 | __blk_run_queue(q); |
221 | spin_unlock_irq(q->queue_lock); | 208 | spin_unlock_irq(q->queue_lock); |
222 | } | 209 | } |
223 | 210 | ||
@@ -233,7 +220,8 @@ static void blk_delay_work(struct work_struct *work) | |||
233 | */ | 220 | */ |
234 | void blk_delay_queue(struct request_queue *q, unsigned long msecs) | 221 | void blk_delay_queue(struct request_queue *q, unsigned long msecs) |
235 | { | 222 | { |
236 | schedule_delayed_work(&q->delay_work, msecs_to_jiffies(msecs)); | 223 | queue_delayed_work(kblockd_workqueue, &q->delay_work, |
224 | msecs_to_jiffies(msecs)); | ||
237 | } | 225 | } |
238 | EXPORT_SYMBOL(blk_delay_queue); | 226 | EXPORT_SYMBOL(blk_delay_queue); |
239 | 227 | ||
@@ -251,7 +239,7 @@ void blk_start_queue(struct request_queue *q) | |||
251 | WARN_ON(!irqs_disabled()); | 239 | WARN_ON(!irqs_disabled()); |
252 | 240 | ||
253 | queue_flag_clear(QUEUE_FLAG_STOPPED, q); | 241 | queue_flag_clear(QUEUE_FLAG_STOPPED, q); |
254 | __blk_run_queue(q, false); | 242 | __blk_run_queue(q); |
255 | } | 243 | } |
256 | EXPORT_SYMBOL(blk_start_queue); | 244 | EXPORT_SYMBOL(blk_start_queue); |
257 | 245 | ||
@@ -298,38 +286,42 @@ void blk_sync_queue(struct request_queue *q) | |||
298 | { | 286 | { |
299 | del_timer_sync(&q->timeout); | 287 | del_timer_sync(&q->timeout); |
300 | cancel_delayed_work_sync(&q->delay_work); | 288 | cancel_delayed_work_sync(&q->delay_work); |
301 | queue_sync_plugs(q); | ||
302 | } | 289 | } |
303 | EXPORT_SYMBOL(blk_sync_queue); | 290 | EXPORT_SYMBOL(blk_sync_queue); |
304 | 291 | ||
305 | /** | 292 | /** |
306 | * __blk_run_queue - run a single device queue | 293 | * __blk_run_queue - run a single device queue |
307 | * @q: The queue to run | 294 | * @q: The queue to run |
308 | * @force_kblockd: Don't run @q->request_fn directly. Use kblockd. | ||
309 | * | 295 | * |
310 | * Description: | 296 | * Description: |
311 | * See @blk_run_queue. This variant must be called with the queue lock | 297 | * See @blk_run_queue. This variant must be called with the queue lock |
312 | * held and interrupts disabled. | 298 | * held and interrupts disabled. |
313 | * | ||
314 | */ | 299 | */ |
315 | void __blk_run_queue(struct request_queue *q, bool force_kblockd) | 300 | void __blk_run_queue(struct request_queue *q) |
316 | { | 301 | { |
317 | if (unlikely(blk_queue_stopped(q))) | 302 | if (unlikely(blk_queue_stopped(q))) |
318 | return; | 303 | return; |
319 | 304 | ||
320 | /* | 305 | q->request_fn(q); |
321 | * Only recurse once to avoid overrunning the stack, let the unplug | ||
322 | * handling reinvoke the handler shortly if we already got there. | ||
323 | */ | ||
324 | if (!force_kblockd && !queue_flag_test_and_set(QUEUE_FLAG_REENTER, q)) { | ||
325 | q->request_fn(q); | ||
326 | queue_flag_clear(QUEUE_FLAG_REENTER, q); | ||
327 | } else | ||
328 | queue_delayed_work(kblockd_workqueue, &q->delay_work, 0); | ||
329 | } | 306 | } |
330 | EXPORT_SYMBOL(__blk_run_queue); | 307 | EXPORT_SYMBOL(__blk_run_queue); |
331 | 308 | ||
332 | /** | 309 | /** |
310 | * blk_run_queue_async - run a single device queue in workqueue context | ||
311 | * @q: The queue to run | ||
312 | * | ||
313 | * Description: | ||
314 | * Tells kblockd to perform the equivalent of @blk_run_queue on behalf | ||
315 | * of us. | ||
316 | */ | ||
317 | void blk_run_queue_async(struct request_queue *q) | ||
318 | { | ||
319 | if (likely(!blk_queue_stopped(q))) | ||
320 | queue_delayed_work(kblockd_workqueue, &q->delay_work, 0); | ||
321 | } | ||
322 | EXPORT_SYMBOL(blk_run_queue_async); | ||
323 | |||
324 | /** | ||
333 | * blk_run_queue - run a single device queue | 325 | * blk_run_queue - run a single device queue |
334 | * @q: The queue to run | 326 | * @q: The queue to run |
335 | * | 327 | * |
@@ -342,7 +334,7 @@ void blk_run_queue(struct request_queue *q) | |||
342 | unsigned long flags; | 334 | unsigned long flags; |
343 | 335 | ||
344 | spin_lock_irqsave(q->queue_lock, flags); | 336 | spin_lock_irqsave(q->queue_lock, flags); |
345 | __blk_run_queue(q, false); | 337 | __blk_run_queue(q); |
346 | spin_unlock_irqrestore(q->queue_lock, flags); | 338 | spin_unlock_irqrestore(q->queue_lock, flags); |
347 | } | 339 | } |
348 | EXPORT_SYMBOL(blk_run_queue); | 340 | EXPORT_SYMBOL(blk_run_queue); |
@@ -991,7 +983,7 @@ void blk_insert_request(struct request_queue *q, struct request *rq, | |||
991 | blk_queue_end_tag(q, rq); | 983 | blk_queue_end_tag(q, rq); |
992 | 984 | ||
993 | add_acct_request(q, rq, where); | 985 | add_acct_request(q, rq, where); |
994 | __blk_run_queue(q, false); | 986 | __blk_run_queue(q); |
995 | spin_unlock_irqrestore(q->queue_lock, flags); | 987 | spin_unlock_irqrestore(q->queue_lock, flags); |
996 | } | 988 | } |
997 | EXPORT_SYMBOL(blk_insert_request); | 989 | EXPORT_SYMBOL(blk_insert_request); |
@@ -1311,7 +1303,15 @@ get_rq: | |||
1311 | 1303 | ||
1312 | plug = current->plug; | 1304 | plug = current->plug; |
1313 | if (plug) { | 1305 | if (plug) { |
1314 | if (!plug->should_sort && !list_empty(&plug->list)) { | 1306 | /* |
1307 | * If this is the first request added after a plug, fire | ||
1308 | * of a plug trace. If others have been added before, check | ||
1309 | * if we have multiple devices in this plug. If so, make a | ||
1310 | * note to sort the list before dispatch. | ||
1311 | */ | ||
1312 | if (list_empty(&plug->list)) | ||
1313 | trace_block_plug(q); | ||
1314 | else if (!plug->should_sort) { | ||
1315 | struct request *__rq; | 1315 | struct request *__rq; |
1316 | 1316 | ||
1317 | __rq = list_entry_rq(plug->list.prev); | 1317 | __rq = list_entry_rq(plug->list.prev); |
@@ -1327,7 +1327,7 @@ get_rq: | |||
1327 | } else { | 1327 | } else { |
1328 | spin_lock_irq(q->queue_lock); | 1328 | spin_lock_irq(q->queue_lock); |
1329 | add_acct_request(q, req, where); | 1329 | add_acct_request(q, req, where); |
1330 | __blk_run_queue(q, false); | 1330 | __blk_run_queue(q); |
1331 | out_unlock: | 1331 | out_unlock: |
1332 | spin_unlock_irq(q->queue_lock); | 1332 | spin_unlock_irq(q->queue_lock); |
1333 | } | 1333 | } |
@@ -2644,6 +2644,7 @@ void blk_start_plug(struct blk_plug *plug) | |||
2644 | 2644 | ||
2645 | plug->magic = PLUG_MAGIC; | 2645 | plug->magic = PLUG_MAGIC; |
2646 | INIT_LIST_HEAD(&plug->list); | 2646 | INIT_LIST_HEAD(&plug->list); |
2647 | INIT_LIST_HEAD(&plug->cb_list); | ||
2647 | plug->should_sort = 0; | 2648 | plug->should_sort = 0; |
2648 | 2649 | ||
2649 | /* | 2650 | /* |
@@ -2668,33 +2669,93 @@ static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b) | |||
2668 | return !(rqa->q <= rqb->q); | 2669 | return !(rqa->q <= rqb->q); |
2669 | } | 2670 | } |
2670 | 2671 | ||
2671 | static void flush_plug_list(struct blk_plug *plug) | 2672 | /* |
2673 | * If 'from_schedule' is true, then postpone the dispatch of requests | ||
2674 | * until a safe kblockd context. We due this to avoid accidental big | ||
2675 | * additional stack usage in driver dispatch, in places where the originally | ||
2676 | * plugger did not intend it. | ||
2677 | */ | ||
2678 | static void queue_unplugged(struct request_queue *q, unsigned int depth, | ||
2679 | bool from_schedule) | ||
2680 | __releases(q->queue_lock) | ||
2681 | { | ||
2682 | trace_block_unplug(q, depth, !from_schedule); | ||
2683 | |||
2684 | /* | ||
2685 | * If we are punting this to kblockd, then we can safely drop | ||
2686 | * the queue_lock before waking kblockd (which needs to take | ||
2687 | * this lock). | ||
2688 | */ | ||
2689 | if (from_schedule) { | ||
2690 | spin_unlock(q->queue_lock); | ||
2691 | blk_run_queue_async(q); | ||
2692 | } else { | ||
2693 | __blk_run_queue(q); | ||
2694 | spin_unlock(q->queue_lock); | ||
2695 | } | ||
2696 | |||
2697 | } | ||
2698 | |||
2699 | static void flush_plug_callbacks(struct blk_plug *plug) | ||
2700 | { | ||
2701 | LIST_HEAD(callbacks); | ||
2702 | |||
2703 | if (list_empty(&plug->cb_list)) | ||
2704 | return; | ||
2705 | |||
2706 | list_splice_init(&plug->cb_list, &callbacks); | ||
2707 | |||
2708 | while (!list_empty(&callbacks)) { | ||
2709 | struct blk_plug_cb *cb = list_first_entry(&callbacks, | ||
2710 | struct blk_plug_cb, | ||
2711 | list); | ||
2712 | list_del(&cb->list); | ||
2713 | cb->callback(cb); | ||
2714 | } | ||
2715 | } | ||
2716 | |||
2717 | void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule) | ||
2672 | { | 2718 | { |
2673 | struct request_queue *q; | 2719 | struct request_queue *q; |
2674 | unsigned long flags; | 2720 | unsigned long flags; |
2675 | struct request *rq; | 2721 | struct request *rq; |
2722 | LIST_HEAD(list); | ||
2723 | unsigned int depth; | ||
2676 | 2724 | ||
2677 | BUG_ON(plug->magic != PLUG_MAGIC); | 2725 | BUG_ON(plug->magic != PLUG_MAGIC); |
2678 | 2726 | ||
2727 | flush_plug_callbacks(plug); | ||
2679 | if (list_empty(&plug->list)) | 2728 | if (list_empty(&plug->list)) |
2680 | return; | 2729 | return; |
2681 | 2730 | ||
2682 | if (plug->should_sort) | 2731 | list_splice_init(&plug->list, &list); |
2683 | list_sort(NULL, &plug->list, plug_rq_cmp); | 2732 | |
2733 | if (plug->should_sort) { | ||
2734 | list_sort(NULL, &list, plug_rq_cmp); | ||
2735 | plug->should_sort = 0; | ||
2736 | } | ||
2684 | 2737 | ||
2685 | q = NULL; | 2738 | q = NULL; |
2739 | depth = 0; | ||
2740 | |||
2741 | /* | ||
2742 | * Save and disable interrupts here, to avoid doing it for every | ||
2743 | * queue lock we have to take. | ||
2744 | */ | ||
2686 | local_irq_save(flags); | 2745 | local_irq_save(flags); |
2687 | while (!list_empty(&plug->list)) { | 2746 | while (!list_empty(&list)) { |
2688 | rq = list_entry_rq(plug->list.next); | 2747 | rq = list_entry_rq(list.next); |
2689 | list_del_init(&rq->queuelist); | 2748 | list_del_init(&rq->queuelist); |
2690 | BUG_ON(!(rq->cmd_flags & REQ_ON_PLUG)); | 2749 | BUG_ON(!(rq->cmd_flags & REQ_ON_PLUG)); |
2691 | BUG_ON(!rq->q); | 2750 | BUG_ON(!rq->q); |
2692 | if (rq->q != q) { | 2751 | if (rq->q != q) { |
2693 | if (q) { | 2752 | /* |
2694 | __blk_run_queue(q, false); | 2753 | * This drops the queue lock |
2695 | spin_unlock(q->queue_lock); | 2754 | */ |
2696 | } | 2755 | if (q) |
2756 | queue_unplugged(q, depth, from_schedule); | ||
2697 | q = rq->q; | 2757 | q = rq->q; |
2758 | depth = 0; | ||
2698 | spin_lock(q->queue_lock); | 2759 | spin_lock(q->queue_lock); |
2699 | } | 2760 | } |
2700 | rq->cmd_flags &= ~REQ_ON_PLUG; | 2761 | rq->cmd_flags &= ~REQ_ON_PLUG; |
@@ -2706,38 +2767,27 @@ static void flush_plug_list(struct blk_plug *plug) | |||
2706 | __elv_add_request(q, rq, ELEVATOR_INSERT_FLUSH); | 2767 | __elv_add_request(q, rq, ELEVATOR_INSERT_FLUSH); |
2707 | else | 2768 | else |
2708 | __elv_add_request(q, rq, ELEVATOR_INSERT_SORT_MERGE); | 2769 | __elv_add_request(q, rq, ELEVATOR_INSERT_SORT_MERGE); |
2709 | } | ||
2710 | 2770 | ||
2711 | if (q) { | 2771 | depth++; |
2712 | __blk_run_queue(q, false); | ||
2713 | spin_unlock(q->queue_lock); | ||
2714 | } | 2772 | } |
2715 | 2773 | ||
2716 | BUG_ON(!list_empty(&plug->list)); | 2774 | /* |
2717 | local_irq_restore(flags); | 2775 | * This drops the queue lock |
2718 | } | 2776 | */ |
2719 | 2777 | if (q) | |
2720 | static void __blk_finish_plug(struct task_struct *tsk, struct blk_plug *plug) | 2778 | queue_unplugged(q, depth, from_schedule); |
2721 | { | ||
2722 | flush_plug_list(plug); | ||
2723 | 2779 | ||
2724 | if (plug == tsk->plug) | 2780 | local_irq_restore(flags); |
2725 | tsk->plug = NULL; | ||
2726 | } | 2781 | } |
2727 | 2782 | ||
2728 | void blk_finish_plug(struct blk_plug *plug) | 2783 | void blk_finish_plug(struct blk_plug *plug) |
2729 | { | 2784 | { |
2730 | if (plug) | 2785 | blk_flush_plug_list(plug, false); |
2731 | __blk_finish_plug(current, plug); | ||
2732 | } | ||
2733 | EXPORT_SYMBOL(blk_finish_plug); | ||
2734 | 2786 | ||
2735 | void __blk_flush_plug(struct task_struct *tsk, struct blk_plug *plug) | 2787 | if (plug == current->plug) |
2736 | { | 2788 | current->plug = NULL; |
2737 | __blk_finish_plug(tsk, plug); | ||
2738 | tsk->plug = plug; | ||
2739 | } | 2789 | } |
2740 | EXPORT_SYMBOL(__blk_flush_plug); | 2790 | EXPORT_SYMBOL(blk_finish_plug); |
2741 | 2791 | ||
2742 | int __init blk_dev_init(void) | 2792 | int __init blk_dev_init(void) |
2743 | { | 2793 | { |
diff --git a/block/blk-exec.c b/block/blk-exec.c index 7482b7fa863b..81e31819a597 100644 --- a/block/blk-exec.c +++ b/block/blk-exec.c | |||
@@ -55,7 +55,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, | |||
55 | WARN_ON(irqs_disabled()); | 55 | WARN_ON(irqs_disabled()); |
56 | spin_lock_irq(q->queue_lock); | 56 | spin_lock_irq(q->queue_lock); |
57 | __elv_add_request(q, rq, where); | 57 | __elv_add_request(q, rq, where); |
58 | __blk_run_queue(q, false); | 58 | __blk_run_queue(q); |
59 | /* the queue is stopped so it won't be plugged+unplugged */ | 59 | /* the queue is stopped so it won't be plugged+unplugged */ |
60 | if (rq->cmd_type == REQ_TYPE_PM_RESUME) | 60 | if (rq->cmd_type == REQ_TYPE_PM_RESUME) |
61 | q->request_fn(q); | 61 | q->request_fn(q); |
diff --git a/block/blk-flush.c b/block/blk-flush.c index eba4a2790c6c..6c9b5e189e62 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c | |||
@@ -218,7 +218,7 @@ static void flush_end_io(struct request *flush_rq, int error) | |||
218 | * request_fn may confuse the driver. Always use kblockd. | 218 | * request_fn may confuse the driver. Always use kblockd. |
219 | */ | 219 | */ |
220 | if (queued) | 220 | if (queued) |
221 | __blk_run_queue(q, true); | 221 | blk_run_queue_async(q); |
222 | } | 222 | } |
223 | 223 | ||
224 | /** | 224 | /** |
@@ -274,7 +274,7 @@ static void flush_data_end_io(struct request *rq, int error) | |||
274 | * the comment in flush_end_io(). | 274 | * the comment in flush_end_io(). |
275 | */ | 275 | */ |
276 | if (blk_flush_complete_seq(rq, REQ_FSEQ_DATA, error)) | 276 | if (blk_flush_complete_seq(rq, REQ_FSEQ_DATA, error)) |
277 | __blk_run_queue(q, true); | 277 | blk_run_queue_async(q); |
278 | } | 278 | } |
279 | 279 | ||
280 | /** | 280 | /** |
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 261c75c665ae..bd236313f35d 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -66,14 +66,14 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count) | |||
66 | 66 | ||
67 | if (rl->count[BLK_RW_SYNC] >= q->nr_requests) { | 67 | if (rl->count[BLK_RW_SYNC] >= q->nr_requests) { |
68 | blk_set_queue_full(q, BLK_RW_SYNC); | 68 | blk_set_queue_full(q, BLK_RW_SYNC); |
69 | } else if (rl->count[BLK_RW_SYNC]+1 <= q->nr_requests) { | 69 | } else { |
70 | blk_clear_queue_full(q, BLK_RW_SYNC); | 70 | blk_clear_queue_full(q, BLK_RW_SYNC); |
71 | wake_up(&rl->wait[BLK_RW_SYNC]); | 71 | wake_up(&rl->wait[BLK_RW_SYNC]); |
72 | } | 72 | } |
73 | 73 | ||
74 | if (rl->count[BLK_RW_ASYNC] >= q->nr_requests) { | 74 | if (rl->count[BLK_RW_ASYNC] >= q->nr_requests) { |
75 | blk_set_queue_full(q, BLK_RW_ASYNC); | 75 | blk_set_queue_full(q, BLK_RW_ASYNC); |
76 | } else if (rl->count[BLK_RW_ASYNC]+1 <= q->nr_requests) { | 76 | } else { |
77 | blk_clear_queue_full(q, BLK_RW_ASYNC); | 77 | blk_clear_queue_full(q, BLK_RW_ASYNC); |
78 | wake_up(&rl->wait[BLK_RW_ASYNC]); | 78 | wake_up(&rl->wait[BLK_RW_ASYNC]); |
79 | } | 79 | } |
@@ -498,7 +498,6 @@ int blk_register_queue(struct gendisk *disk) | |||
498 | { | 498 | { |
499 | int ret; | 499 | int ret; |
500 | struct device *dev = disk_to_dev(disk); | 500 | struct device *dev = disk_to_dev(disk); |
501 | |||
502 | struct request_queue *q = disk->queue; | 501 | struct request_queue *q = disk->queue; |
503 | 502 | ||
504 | if (WARN_ON(!q)) | 503 | if (WARN_ON(!q)) |
@@ -509,8 +508,10 @@ int blk_register_queue(struct gendisk *disk) | |||
509 | return ret; | 508 | return ret; |
510 | 509 | ||
511 | ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue"); | 510 | ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue"); |
512 | if (ret < 0) | 511 | if (ret < 0) { |
512 | blk_trace_remove_sysfs(dev); | ||
513 | return ret; | 513 | return ret; |
514 | } | ||
514 | 515 | ||
515 | kobject_uevent(&q->kobj, KOBJ_ADD); | 516 | kobject_uevent(&q->kobj, KOBJ_ADD); |
516 | 517 | ||
@@ -521,7 +522,7 @@ int blk_register_queue(struct gendisk *disk) | |||
521 | if (ret) { | 522 | if (ret) { |
522 | kobject_uevent(&q->kobj, KOBJ_REMOVE); | 523 | kobject_uevent(&q->kobj, KOBJ_REMOVE); |
523 | kobject_del(&q->kobj); | 524 | kobject_del(&q->kobj); |
524 | blk_trace_remove_sysfs(disk_to_dev(disk)); | 525 | blk_trace_remove_sysfs(dev); |
525 | kobject_put(&dev->kobj); | 526 | kobject_put(&dev->kobj); |
526 | return ret; | 527 | return ret; |
527 | } | 528 | } |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 3be881ec95ad..5b52011e3a40 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -2582,28 +2582,20 @@ static void cfq_put_queue(struct cfq_queue *cfqq) | |||
2582 | } | 2582 | } |
2583 | 2583 | ||
2584 | /* | 2584 | /* |
2585 | * Must always be called with the rcu_read_lock() held | 2585 | * Call func for each cic attached to this ioc. |
2586 | */ | 2586 | */ |
2587 | static void | 2587 | static void |
2588 | __call_for_each_cic(struct io_context *ioc, | 2588 | call_for_each_cic(struct io_context *ioc, |
2589 | void (*func)(struct io_context *, struct cfq_io_context *)) | 2589 | void (*func)(struct io_context *, struct cfq_io_context *)) |
2590 | { | 2590 | { |
2591 | struct cfq_io_context *cic; | 2591 | struct cfq_io_context *cic; |
2592 | struct hlist_node *n; | 2592 | struct hlist_node *n; |
2593 | 2593 | ||
2594 | rcu_read_lock(); | ||
2595 | |||
2594 | hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) | 2596 | hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) |
2595 | func(ioc, cic); | 2597 | func(ioc, cic); |
2596 | } | ||
2597 | 2598 | ||
2598 | /* | ||
2599 | * Call func for each cic attached to this ioc. | ||
2600 | */ | ||
2601 | static void | ||
2602 | call_for_each_cic(struct io_context *ioc, | ||
2603 | void (*func)(struct io_context *, struct cfq_io_context *)) | ||
2604 | { | ||
2605 | rcu_read_lock(); | ||
2606 | __call_for_each_cic(ioc, func); | ||
2607 | rcu_read_unlock(); | 2599 | rcu_read_unlock(); |
2608 | } | 2600 | } |
2609 | 2601 | ||
@@ -2664,7 +2656,7 @@ static void cfq_free_io_context(struct io_context *ioc) | |||
2664 | * should be ok to iterate over the known list, we will see all cic's | 2656 | * should be ok to iterate over the known list, we will see all cic's |
2665 | * since no new ones are added. | 2657 | * since no new ones are added. |
2666 | */ | 2658 | */ |
2667 | __call_for_each_cic(ioc, cic_free_func); | 2659 | call_for_each_cic(ioc, cic_free_func); |
2668 | } | 2660 | } |
2669 | 2661 | ||
2670 | static void cfq_put_cooperator(struct cfq_queue *cfqq) | 2662 | static void cfq_put_cooperator(struct cfq_queue *cfqq) |
@@ -3368,7 +3360,7 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
3368 | cfqd->busy_queues > 1) { | 3360 | cfqd->busy_queues > 1) { |
3369 | cfq_del_timer(cfqd, cfqq); | 3361 | cfq_del_timer(cfqd, cfqq); |
3370 | cfq_clear_cfqq_wait_request(cfqq); | 3362 | cfq_clear_cfqq_wait_request(cfqq); |
3371 | __blk_run_queue(cfqd->queue, false); | 3363 | __blk_run_queue(cfqd->queue); |
3372 | } else { | 3364 | } else { |
3373 | cfq_blkiocg_update_idle_time_stats( | 3365 | cfq_blkiocg_update_idle_time_stats( |
3374 | &cfqq->cfqg->blkg); | 3366 | &cfqq->cfqg->blkg); |
@@ -3383,7 +3375,7 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
3383 | * this new queue is RT and the current one is BE | 3375 | * this new queue is RT and the current one is BE |
3384 | */ | 3376 | */ |
3385 | cfq_preempt_queue(cfqd, cfqq); | 3377 | cfq_preempt_queue(cfqd, cfqq); |
3386 | __blk_run_queue(cfqd->queue, false); | 3378 | __blk_run_queue(cfqd->queue); |
3387 | } | 3379 | } |
3388 | } | 3380 | } |
3389 | 3381 | ||
@@ -3743,7 +3735,7 @@ static void cfq_kick_queue(struct work_struct *work) | |||
3743 | struct request_queue *q = cfqd->queue; | 3735 | struct request_queue *q = cfqd->queue; |
3744 | 3736 | ||
3745 | spin_lock_irq(q->queue_lock); | 3737 | spin_lock_irq(q->queue_lock); |
3746 | __blk_run_queue(cfqd->queue, false); | 3738 | __blk_run_queue(cfqd->queue); |
3747 | spin_unlock_irq(q->queue_lock); | 3739 | spin_unlock_irq(q->queue_lock); |
3748 | } | 3740 | } |
3749 | 3741 | ||
diff --git a/block/elevator.c b/block/elevator.c index 0cdb4e7ebab4..45ca1e34f582 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -642,7 +642,7 @@ void elv_quiesce_start(struct request_queue *q) | |||
642 | */ | 642 | */ |
643 | elv_drain_elevator(q); | 643 | elv_drain_elevator(q); |
644 | while (q->rq.elvpriv) { | 644 | while (q->rq.elvpriv) { |
645 | __blk_run_queue(q, false); | 645 | __blk_run_queue(q); |
646 | spin_unlock_irq(q->queue_lock); | 646 | spin_unlock_irq(q->queue_lock); |
647 | msleep(10); | 647 | msleep(10); |
648 | spin_lock_irq(q->queue_lock); | 648 | spin_lock_irq(q->queue_lock); |
@@ -671,7 +671,8 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where) | |||
671 | q->boundary_rq = rq; | 671 | q->boundary_rq = rq; |
672 | } | 672 | } |
673 | } else if (!(rq->cmd_flags & REQ_ELVPRIV) && | 673 | } else if (!(rq->cmd_flags & REQ_ELVPRIV) && |
674 | where == ELEVATOR_INSERT_SORT) | 674 | (where == ELEVATOR_INSERT_SORT || |
675 | where == ELEVATOR_INSERT_SORT_MERGE)) | ||
675 | where = ELEVATOR_INSERT_BACK; | 676 | where = ELEVATOR_INSERT_BACK; |
676 | 677 | ||
677 | switch (where) { | 678 | switch (where) { |
@@ -695,7 +696,7 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where) | |||
695 | * with anything. There's no point in delaying queue | 696 | * with anything. There's no point in delaying queue |
696 | * processing. | 697 | * processing. |
697 | */ | 698 | */ |
698 | __blk_run_queue(q, false); | 699 | __blk_run_queue(q); |
699 | break; | 700 | break; |
700 | 701 | ||
701 | case ELEVATOR_INSERT_SORT_MERGE: | 702 | case ELEVATOR_INSERT_SORT_MERGE: |
diff --git a/block/genhd.c b/block/genhd.c index b364bd038a18..2dd988723d73 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1588,9 +1588,13 @@ static void disk_events_workfn(struct work_struct *work) | |||
1588 | 1588 | ||
1589 | spin_unlock_irq(&ev->lock); | 1589 | spin_unlock_irq(&ev->lock); |
1590 | 1590 | ||
1591 | /* tell userland about new events */ | 1591 | /* |
1592 | * Tell userland about new events. Only the events listed in | ||
1593 | * @disk->events are reported. Unlisted events are processed the | ||
1594 | * same internally but never get reported to userland. | ||
1595 | */ | ||
1592 | for (i = 0; i < ARRAY_SIZE(disk_uevents); i++) | 1596 | for (i = 0; i < ARRAY_SIZE(disk_uevents); i++) |
1593 | if (events & (1 << i)) | 1597 | if (events & disk->events & (1 << i)) |
1594 | envp[nr_events++] = disk_uevents[i]; | 1598 | envp[nr_events++] = disk_uevents[i]; |
1595 | 1599 | ||
1596 | if (nr_events) | 1600 | if (nr_events) |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index b136c9c1e531..449c556274c0 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -943,6 +943,10 @@ static int acpi_bus_get_flags(struct acpi_device *device) | |||
943 | if (ACPI_SUCCESS(status)) | 943 | if (ACPI_SUCCESS(status)) |
944 | device->flags.lockable = 1; | 944 | device->flags.lockable = 1; |
945 | 945 | ||
946 | /* Power resources cannot be power manageable. */ | ||
947 | if (device->device_type == ACPI_BUS_TYPE_POWER) | ||
948 | return 0; | ||
949 | |||
946 | /* Presence of _PS0|_PR0 indicates 'power manageable' */ | 950 | /* Presence of _PS0|_PR0 indicates 'power manageable' */ |
947 | status = acpi_get_handle(device->handle, "_PS0", &temp); | 951 | status = acpi_get_handle(device->handle, "_PS0", &temp); |
948 | if (ACPI_FAILURE(status)) | 952 | if (ACPI_FAILURE(status)) |
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 821040503154..7025593a58c8 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c | |||
@@ -214,7 +214,7 @@ static int amba_pm_resume_noirq(struct device *dev) | |||
214 | 214 | ||
215 | #endif /* !CONFIG_SUSPEND */ | 215 | #endif /* !CONFIG_SUSPEND */ |
216 | 216 | ||
217 | #ifdef CONFIG_HIBERNATION | 217 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
218 | 218 | ||
219 | static int amba_pm_freeze(struct device *dev) | 219 | static int amba_pm_freeze(struct device *dev) |
220 | { | 220 | { |
@@ -352,7 +352,7 @@ static int amba_pm_restore_noirq(struct device *dev) | |||
352 | return ret; | 352 | return ret; |
353 | } | 353 | } |
354 | 354 | ||
355 | #else /* !CONFIG_HIBERNATION */ | 355 | #else /* !CONFIG_HIBERNATE_CALLBACKS */ |
356 | 356 | ||
357 | #define amba_pm_freeze NULL | 357 | #define amba_pm_freeze NULL |
358 | #define amba_pm_thaw NULL | 358 | #define amba_pm_thaw NULL |
@@ -363,7 +363,7 @@ static int amba_pm_restore_noirq(struct device *dev) | |||
363 | #define amba_pm_poweroff_noirq NULL | 363 | #define amba_pm_poweroff_noirq NULL |
364 | #define amba_pm_restore_noirq NULL | 364 | #define amba_pm_restore_noirq NULL |
365 | 365 | ||
366 | #endif /* !CONFIG_HIBERNATION */ | 366 | #endif /* !CONFIG_HIBERNATE_CALLBACKS */ |
367 | 367 | ||
368 | #ifdef CONFIG_PM | 368 | #ifdef CONFIG_PM |
369 | 369 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 39d829cd82dd..71afe0371311 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -150,7 +150,7 @@ static const struct ata_port_info ahci_port_info[] = { | |||
150 | { | 150 | { |
151 | AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP | | 151 | AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP | |
152 | AHCI_HFLAG_YES_NCQ), | 152 | AHCI_HFLAG_YES_NCQ), |
153 | .flags = AHCI_FLAG_COMMON, | 153 | .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM, |
154 | .pio_mask = ATA_PIO4, | 154 | .pio_mask = ATA_PIO4, |
155 | .udma_mask = ATA_UDMA6, | 155 | .udma_mask = ATA_UDMA6, |
156 | .port_ops = &ahci_ops, | 156 | .port_ops = &ahci_ops, |
@@ -261,6 +261,12 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
261 | { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ | 261 | { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ |
262 | { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* PBG RAID */ | 262 | { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* PBG RAID */ |
263 | { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */ | 263 | { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */ |
264 | { PCI_VDEVICE(INTEL, 0x1e02), board_ahci }, /* Panther Point AHCI */ | ||
265 | { PCI_VDEVICE(INTEL, 0x1e03), board_ahci }, /* Panther Point AHCI */ | ||
266 | { PCI_VDEVICE(INTEL, 0x1e04), board_ahci }, /* Panther Point RAID */ | ||
267 | { PCI_VDEVICE(INTEL, 0x1e05), board_ahci }, /* Panther Point RAID */ | ||
268 | { PCI_VDEVICE(INTEL, 0x1e06), board_ahci }, /* Panther Point RAID */ | ||
269 | { PCI_VDEVICE(INTEL, 0x1e07), board_ahci }, /* Panther Point RAID */ | ||
264 | 270 | ||
265 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 271 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
266 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 272 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 39865009c251..12c5282e7fca 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
@@ -229,6 +229,10 @@ enum { | |||
229 | EM_CTL_ALHD = (1 << 26), /* Activity LED */ | 229 | EM_CTL_ALHD = (1 << 26), /* Activity LED */ |
230 | EM_CTL_XMT = (1 << 25), /* Transmit Only */ | 230 | EM_CTL_XMT = (1 << 25), /* Transmit Only */ |
231 | EM_CTL_SMB = (1 << 24), /* Single Message Buffer */ | 231 | EM_CTL_SMB = (1 << 24), /* Single Message Buffer */ |
232 | EM_CTL_SGPIO = (1 << 19), /* SGPIO messages supported */ | ||
233 | EM_CTL_SES = (1 << 18), /* SES-2 messages supported */ | ||
234 | EM_CTL_SAFTE = (1 << 17), /* SAF-TE messages supported */ | ||
235 | EM_CTL_LED = (1 << 16), /* LED messages supported */ | ||
232 | 236 | ||
233 | /* em message type */ | 237 | /* em message type */ |
234 | EM_MSG_TYPE_LED = (1 << 0), /* LED */ | 238 | EM_MSG_TYPE_LED = (1 << 0), /* LED */ |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 0bc3fd6c3fdb..6f6e7718b05c 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -309,6 +309,14 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
309 | { 0x8086, 0x1d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | 309 | { 0x8086, 0x1d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, |
310 | /* SATA Controller IDE (PBG) */ | 310 | /* SATA Controller IDE (PBG) */ |
311 | { 0x8086, 0x1d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 311 | { 0x8086, 0x1d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
312 | /* SATA Controller IDE (Panther Point) */ | ||
313 | { 0x8086, 0x1e00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
314 | /* SATA Controller IDE (Panther Point) */ | ||
315 | { 0x8086, 0x1e01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
316 | /* SATA Controller IDE (Panther Point) */ | ||
317 | { 0x8086, 0x1e08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
318 | /* SATA Controller IDE (Panther Point) */ | ||
319 | { 0x8086, 0x1e09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
312 | { } /* terminate list */ | 320 | { } /* terminate list */ |
313 | }; | 321 | }; |
314 | 322 | ||
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 26d452339e98..ff9d832a163d 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -109,6 +109,8 @@ static ssize_t ahci_read_em_buffer(struct device *dev, | |||
109 | static ssize_t ahci_store_em_buffer(struct device *dev, | 109 | static ssize_t ahci_store_em_buffer(struct device *dev, |
110 | struct device_attribute *attr, | 110 | struct device_attribute *attr, |
111 | const char *buf, size_t size); | 111 | const char *buf, size_t size); |
112 | static ssize_t ahci_show_em_supported(struct device *dev, | ||
113 | struct device_attribute *attr, char *buf); | ||
112 | 114 | ||
113 | static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); | 115 | static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); |
114 | static DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); | 116 | static DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); |
@@ -116,6 +118,7 @@ static DEVICE_ATTR(ahci_host_version, S_IRUGO, ahci_show_host_version, NULL); | |||
116 | static DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); | 118 | static DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); |
117 | static DEVICE_ATTR(em_buffer, S_IWUSR | S_IRUGO, | 119 | static DEVICE_ATTR(em_buffer, S_IWUSR | S_IRUGO, |
118 | ahci_read_em_buffer, ahci_store_em_buffer); | 120 | ahci_read_em_buffer, ahci_store_em_buffer); |
121 | static DEVICE_ATTR(em_message_supported, S_IRUGO, ahci_show_em_supported, NULL); | ||
119 | 122 | ||
120 | struct device_attribute *ahci_shost_attrs[] = { | 123 | struct device_attribute *ahci_shost_attrs[] = { |
121 | &dev_attr_link_power_management_policy, | 124 | &dev_attr_link_power_management_policy, |
@@ -126,6 +129,7 @@ struct device_attribute *ahci_shost_attrs[] = { | |||
126 | &dev_attr_ahci_host_version, | 129 | &dev_attr_ahci_host_version, |
127 | &dev_attr_ahci_port_cmd, | 130 | &dev_attr_ahci_port_cmd, |
128 | &dev_attr_em_buffer, | 131 | &dev_attr_em_buffer, |
132 | &dev_attr_em_message_supported, | ||
129 | NULL | 133 | NULL |
130 | }; | 134 | }; |
131 | EXPORT_SYMBOL_GPL(ahci_shost_attrs); | 135 | EXPORT_SYMBOL_GPL(ahci_shost_attrs); |
@@ -343,6 +347,24 @@ static ssize_t ahci_store_em_buffer(struct device *dev, | |||
343 | return size; | 347 | return size; |
344 | } | 348 | } |
345 | 349 | ||
350 | static ssize_t ahci_show_em_supported(struct device *dev, | ||
351 | struct device_attribute *attr, char *buf) | ||
352 | { | ||
353 | struct Scsi_Host *shost = class_to_shost(dev); | ||
354 | struct ata_port *ap = ata_shost_to_port(shost); | ||
355 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
356 | void __iomem *mmio = hpriv->mmio; | ||
357 | u32 em_ctl; | ||
358 | |||
359 | em_ctl = readl(mmio + HOST_EM_CTL); | ||
360 | |||
361 | return sprintf(buf, "%s%s%s%s\n", | ||
362 | em_ctl & EM_CTL_LED ? "led " : "", | ||
363 | em_ctl & EM_CTL_SAFTE ? "saf-te " : "", | ||
364 | em_ctl & EM_CTL_SES ? "ses-2 " : "", | ||
365 | em_ctl & EM_CTL_SGPIO ? "sgpio " : ""); | ||
366 | } | ||
367 | |||
346 | /** | 368 | /** |
347 | * ahci_save_initial_config - Save and fixup initial config values | 369 | * ahci_save_initial_config - Save and fixup initial config values |
348 | * @dev: target AHCI device | 370 | * @dev: target AHCI device |
@@ -539,6 +561,27 @@ void ahci_start_engine(struct ata_port *ap) | |||
539 | { | 561 | { |
540 | void __iomem *port_mmio = ahci_port_base(ap); | 562 | void __iomem *port_mmio = ahci_port_base(ap); |
541 | u32 tmp; | 563 | u32 tmp; |
564 | u8 status; | ||
565 | |||
566 | status = readl(port_mmio + PORT_TFDATA) & 0xFF; | ||
567 | |||
568 | /* | ||
569 | * At end of section 10.1 of AHCI spec (rev 1.3), it states | ||
570 | * Software shall not set PxCMD.ST to 1 until it is determined | ||
571 | * that a functoinal device is present on the port as determined by | ||
572 | * PxTFD.STS.BSY=0, PxTFD.STS.DRQ=0 and PxSSTS.DET=3h | ||
573 | * | ||
574 | * Even though most AHCI host controllers work without this check, | ||
575 | * specific controller will fail under this condition | ||
576 | */ | ||
577 | if (status & (ATA_BUSY | ATA_DRQ)) | ||
578 | return; | ||
579 | else { | ||
580 | ahci_scr_read(&ap->link, SCR_STATUS, &tmp); | ||
581 | |||
582 | if ((tmp & 0xf) != 0x3) | ||
583 | return; | ||
584 | } | ||
542 | 585 | ||
543 | /* start DMA */ | 586 | /* start DMA */ |
544 | tmp = readl(port_mmio + PORT_CMD); | 587 | tmp = readl(port_mmio + PORT_CMD); |
@@ -1897,7 +1940,17 @@ static void ahci_pmp_attach(struct ata_port *ap) | |||
1897 | ahci_enable_fbs(ap); | 1940 | ahci_enable_fbs(ap); |
1898 | 1941 | ||
1899 | pp->intr_mask |= PORT_IRQ_BAD_PMP; | 1942 | pp->intr_mask |= PORT_IRQ_BAD_PMP; |
1900 | writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); | 1943 | |
1944 | /* | ||
1945 | * We must not change the port interrupt mask register if the | ||
1946 | * port is marked frozen, the value in pp->intr_mask will be | ||
1947 | * restored later when the port is thawed. | ||
1948 | * | ||
1949 | * Note that during initialization, the port is marked as | ||
1950 | * frozen since the irq handler is not yet registered. | ||
1951 | */ | ||
1952 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) | ||
1953 | writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); | ||
1901 | } | 1954 | } |
1902 | 1955 | ||
1903 | static void ahci_pmp_detach(struct ata_port *ap) | 1956 | static void ahci_pmp_detach(struct ata_port *ap) |
@@ -1913,7 +1966,10 @@ static void ahci_pmp_detach(struct ata_port *ap) | |||
1913 | writel(cmd, port_mmio + PORT_CMD); | 1966 | writel(cmd, port_mmio + PORT_CMD); |
1914 | 1967 | ||
1915 | pp->intr_mask &= ~PORT_IRQ_BAD_PMP; | 1968 | pp->intr_mask &= ~PORT_IRQ_BAD_PMP; |
1916 | writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); | 1969 | |
1970 | /* see comment above in ahci_pmp_attach() */ | ||
1971 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) | ||
1972 | writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); | ||
1917 | } | 1973 | } |
1918 | 1974 | ||
1919 | int ahci_port_resume(struct ata_port *ap) | 1975 | int ahci_port_resume(struct ata_port *ap) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 423c0a6952b2..76c3c15cb1e6 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4139,6 +4139,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4139 | */ | 4139 | */ |
4140 | { "PIONEER DVD-RW DVRTD08", "1.00", ATA_HORKAGE_NOSETXFER }, | 4140 | { "PIONEER DVD-RW DVRTD08", "1.00", ATA_HORKAGE_NOSETXFER }, |
4141 | { "PIONEER DVD-RW DVR-212D", "1.28", ATA_HORKAGE_NOSETXFER }, | 4141 | { "PIONEER DVD-RW DVR-212D", "1.28", ATA_HORKAGE_NOSETXFER }, |
4142 | { "PIONEER DVD-RW DVR-216D", "1.08", ATA_HORKAGE_NOSETXFER }, | ||
4142 | 4143 | ||
4143 | /* End Marker */ | 4144 | /* End Marker */ |
4144 | { } | 4145 | { } |
@@ -5480,7 +5481,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host) | |||
5480 | if (!ap) | 5481 | if (!ap) |
5481 | return NULL; | 5482 | return NULL; |
5482 | 5483 | ||
5483 | ap->pflags |= ATA_PFLAG_INITIALIZING; | 5484 | ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN; |
5484 | ap->lock = &host->lock; | 5485 | ap->lock = &host->lock; |
5485 | ap->print_id = -1; | 5486 | ap->print_id = -1; |
5486 | ap->host = host; | 5487 | ap->host = host; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 88cd22fa65cd..f26f2fe3480a 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -3316,6 +3316,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
3316 | struct ata_eh_context *ehc = &link->eh_context; | 3316 | struct ata_eh_context *ehc = &link->eh_context; |
3317 | struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; | 3317 | struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; |
3318 | enum ata_lpm_policy old_policy = link->lpm_policy; | 3318 | enum ata_lpm_policy old_policy = link->lpm_policy; |
3319 | bool no_dipm = ap->flags & ATA_FLAG_NO_DIPM; | ||
3319 | unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; | 3320 | unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; |
3320 | unsigned int err_mask; | 3321 | unsigned int err_mask; |
3321 | int rc; | 3322 | int rc; |
@@ -3332,7 +3333,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
3332 | */ | 3333 | */ |
3333 | ata_for_each_dev(dev, link, ENABLED) { | 3334 | ata_for_each_dev(dev, link, ENABLED) { |
3334 | bool hipm = ata_id_has_hipm(dev->id); | 3335 | bool hipm = ata_id_has_hipm(dev->id); |
3335 | bool dipm = ata_id_has_dipm(dev->id); | 3336 | bool dipm = ata_id_has_dipm(dev->id) && !no_dipm; |
3336 | 3337 | ||
3337 | /* find the first enabled and LPM enabled devices */ | 3338 | /* find the first enabled and LPM enabled devices */ |
3338 | if (!link_dev) | 3339 | if (!link_dev) |
@@ -3389,7 +3390,8 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
3389 | 3390 | ||
3390 | /* host config updated, enable DIPM if transitioning to MIN_POWER */ | 3391 | /* host config updated, enable DIPM if transitioning to MIN_POWER */ |
3391 | ata_for_each_dev(dev, link, ENABLED) { | 3392 | ata_for_each_dev(dev, link, ENABLED) { |
3392 | if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) { | 3393 | if (policy == ATA_LPM_MIN_POWER && !no_dipm && |
3394 | ata_id_has_dipm(dev->id)) { | ||
3393 | err_mask = ata_dev_set_feature(dev, | 3395 | err_mask = ata_dev_set_feature(dev, |
3394 | SETFEATURES_SATA_ENABLE, SATA_DIPM); | 3396 | SETFEATURES_SATA_ENABLE, SATA_DIPM); |
3395 | if (err_mask && err_mask != AC_ERR_DEV) { | 3397 | if (err_mask && err_mask != AC_ERR_DEV) { |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index 0da0dcc7dd08..a5fdbdcb0faf 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
@@ -33,11 +33,12 @@ | |||
33 | 33 | ||
34 | 34 | ||
35 | #define DRV_NAME "pata_at91" | 35 | #define DRV_NAME "pata_at91" |
36 | #define DRV_VERSION "0.1" | 36 | #define DRV_VERSION "0.2" |
37 | 37 | ||
38 | #define CF_IDE_OFFSET 0x00c00000 | 38 | #define CF_IDE_OFFSET 0x00c00000 |
39 | #define CF_ALT_IDE_OFFSET 0x00e00000 | 39 | #define CF_ALT_IDE_OFFSET 0x00e00000 |
40 | #define CF_IDE_RES_SIZE 0x08 | 40 | #define CF_IDE_RES_SIZE 0x08 |
41 | #define NCS_RD_PULSE_LIMIT 0x3f /* maximal value for pulse bitfields */ | ||
41 | 42 | ||
42 | struct at91_ide_info { | 43 | struct at91_ide_info { |
43 | unsigned long mode; | 44 | unsigned long mode; |
@@ -49,8 +50,18 @@ struct at91_ide_info { | |||
49 | void __iomem *alt_addr; | 50 | void __iomem *alt_addr; |
50 | }; | 51 | }; |
51 | 52 | ||
52 | static const struct ata_timing initial_timing = | 53 | static const struct ata_timing initial_timing = { |
53 | {XFER_PIO_0, 70, 290, 240, 600, 165, 150, 600, 0}; | 54 | .mode = XFER_PIO_0, |
55 | .setup = 70, | ||
56 | .act8b = 290, | ||
57 | .rec8b = 240, | ||
58 | .cyc8b = 600, | ||
59 | .active = 165, | ||
60 | .recover = 150, | ||
61 | .dmack_hold = 0, | ||
62 | .cycle = 600, | ||
63 | .udma = 0 | ||
64 | }; | ||
54 | 65 | ||
55 | static unsigned long calc_mck_cycles(unsigned long ns, unsigned long mck_hz) | 66 | static unsigned long calc_mck_cycles(unsigned long ns, unsigned long mck_hz) |
56 | { | 67 | { |
@@ -109,6 +120,11 @@ static void set_smc_timing(struct device *dev, | |||
109 | /* (CS0, CS1, DIR, OE) <= (CFCE1, CFCE2, CFRNW, NCSX) timings */ | 120 | /* (CS0, CS1, DIR, OE) <= (CFCE1, CFCE2, CFRNW, NCSX) timings */ |
110 | ncs_read_setup = 1; | 121 | ncs_read_setup = 1; |
111 | ncs_read_pulse = read_cycle - 2; | 122 | ncs_read_pulse = read_cycle - 2; |
123 | if (ncs_read_pulse > NCS_RD_PULSE_LIMIT) { | ||
124 | ncs_read_pulse = NCS_RD_PULSE_LIMIT; | ||
125 | dev_warn(dev, "ncs_read_pulse limited to maximal value %lu\n", | ||
126 | ncs_read_pulse); | ||
127 | } | ||
112 | 128 | ||
113 | /* Write timings same as read timings */ | 129 | /* Write timings same as read timings */ |
114 | write_cycle = read_cycle; | 130 | write_cycle = read_cycle; |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index f051cfff18af..9e0e4fc24c46 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -149,6 +149,7 @@ static void platform_device_release(struct device *dev) | |||
149 | 149 | ||
150 | of_device_node_put(&pa->pdev.dev); | 150 | of_device_node_put(&pa->pdev.dev); |
151 | kfree(pa->pdev.dev.platform_data); | 151 | kfree(pa->pdev.dev.platform_data); |
152 | kfree(pa->pdev.mfd_cell); | ||
152 | kfree(pa->pdev.resource); | 153 | kfree(pa->pdev.resource); |
153 | kfree(pa); | 154 | kfree(pa); |
154 | } | 155 | } |
@@ -771,7 +772,7 @@ int __weak platform_pm_resume_noirq(struct device *dev) | |||
771 | 772 | ||
772 | #endif /* !CONFIG_SUSPEND */ | 773 | #endif /* !CONFIG_SUSPEND */ |
773 | 774 | ||
774 | #ifdef CONFIG_HIBERNATION | 775 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
775 | 776 | ||
776 | static int platform_pm_freeze(struct device *dev) | 777 | static int platform_pm_freeze(struct device *dev) |
777 | { | 778 | { |
@@ -909,7 +910,7 @@ static int platform_pm_restore_noirq(struct device *dev) | |||
909 | return ret; | 910 | return ret; |
910 | } | 911 | } |
911 | 912 | ||
912 | #else /* !CONFIG_HIBERNATION */ | 913 | #else /* !CONFIG_HIBERNATE_CALLBACKS */ |
913 | 914 | ||
914 | #define platform_pm_freeze NULL | 915 | #define platform_pm_freeze NULL |
915 | #define platform_pm_thaw NULL | 916 | #define platform_pm_thaw NULL |
@@ -920,7 +921,7 @@ static int platform_pm_restore_noirq(struct device *dev) | |||
920 | #define platform_pm_poweroff_noirq NULL | 921 | #define platform_pm_poweroff_noirq NULL |
921 | #define platform_pm_restore_noirq NULL | 922 | #define platform_pm_restore_noirq NULL |
922 | 923 | ||
923 | #endif /* !CONFIG_HIBERNATION */ | 924 | #endif /* !CONFIG_HIBERNATE_CALLBACKS */ |
924 | 925 | ||
925 | #ifdef CONFIG_PM_RUNTIME | 926 | #ifdef CONFIG_PM_RUNTIME |
926 | 927 | ||
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 052dc53eef38..abe3ab709e87 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -63,6 +63,7 @@ void device_pm_init(struct device *dev) | |||
63 | dev->power.wakeup = NULL; | 63 | dev->power.wakeup = NULL; |
64 | spin_lock_init(&dev->power.lock); | 64 | spin_lock_init(&dev->power.lock); |
65 | pm_runtime_init(dev); | 65 | pm_runtime_init(dev); |
66 | INIT_LIST_HEAD(&dev->power.entry); | ||
66 | } | 67 | } |
67 | 68 | ||
68 | /** | 69 | /** |
@@ -233,7 +234,7 @@ static int pm_op(struct device *dev, | |||
233 | } | 234 | } |
234 | break; | 235 | break; |
235 | #endif /* CONFIG_SUSPEND */ | 236 | #endif /* CONFIG_SUSPEND */ |
236 | #ifdef CONFIG_HIBERNATION | 237 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
237 | case PM_EVENT_FREEZE: | 238 | case PM_EVENT_FREEZE: |
238 | case PM_EVENT_QUIESCE: | 239 | case PM_EVENT_QUIESCE: |
239 | if (ops->freeze) { | 240 | if (ops->freeze) { |
@@ -260,7 +261,7 @@ static int pm_op(struct device *dev, | |||
260 | suspend_report_result(ops->restore, error); | 261 | suspend_report_result(ops->restore, error); |
261 | } | 262 | } |
262 | break; | 263 | break; |
263 | #endif /* CONFIG_HIBERNATION */ | 264 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ |
264 | default: | 265 | default: |
265 | error = -EINVAL; | 266 | error = -EINVAL; |
266 | } | 267 | } |
@@ -308,7 +309,7 @@ static int pm_noirq_op(struct device *dev, | |||
308 | } | 309 | } |
309 | break; | 310 | break; |
310 | #endif /* CONFIG_SUSPEND */ | 311 | #endif /* CONFIG_SUSPEND */ |
311 | #ifdef CONFIG_HIBERNATION | 312 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
312 | case PM_EVENT_FREEZE: | 313 | case PM_EVENT_FREEZE: |
313 | case PM_EVENT_QUIESCE: | 314 | case PM_EVENT_QUIESCE: |
314 | if (ops->freeze_noirq) { | 315 | if (ops->freeze_noirq) { |
@@ -335,7 +336,7 @@ static int pm_noirq_op(struct device *dev, | |||
335 | suspend_report_result(ops->restore_noirq, error); | 336 | suspend_report_result(ops->restore_noirq, error); |
336 | } | 337 | } |
337 | break; | 338 | break; |
338 | #endif /* CONFIG_HIBERNATION */ | 339 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ |
339 | default: | 340 | default: |
340 | error = -EINVAL; | 341 | error = -EINVAL; |
341 | } | 342 | } |
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 4573c83df6dd..abbbd33e8d8a 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c | |||
@@ -258,7 +258,7 @@ void device_set_wakeup_capable(struct device *dev, bool capable) | |||
258 | if (!!dev->power.can_wakeup == !!capable) | 258 | if (!!dev->power.can_wakeup == !!capable) |
259 | return; | 259 | return; |
260 | 260 | ||
261 | if (device_is_registered(dev)) { | 261 | if (device_is_registered(dev) && !list_empty(&dev->power.entry)) { |
262 | if (capable) { | 262 | if (capable) { |
263 | if (wakeup_sysfs_add(dev)) | 263 | if (wakeup_sysfs_add(dev)) |
264 | return; | 264 | return; |
diff --git a/drivers/base/syscore.c b/drivers/base/syscore.c index 90af2943f9e4..c126db3cb7d1 100644 --- a/drivers/base/syscore.c +++ b/drivers/base/syscore.c | |||
@@ -73,6 +73,7 @@ int syscore_suspend(void) | |||
73 | 73 | ||
74 | return ret; | 74 | return ret; |
75 | } | 75 | } |
76 | EXPORT_SYMBOL_GPL(syscore_suspend); | ||
76 | 77 | ||
77 | /** | 78 | /** |
78 | * syscore_resume - Execute all the registered system core resume callbacks. | 79 | * syscore_resume - Execute all the registered system core resume callbacks. |
@@ -95,6 +96,7 @@ void syscore_resume(void) | |||
95 | "Interrupts enabled after %pF\n", ops->resume); | 96 | "Interrupts enabled after %pF\n", ops->resume); |
96 | } | 97 | } |
97 | } | 98 | } |
99 | EXPORT_SYMBOL_GPL(syscore_resume); | ||
98 | #endif /* CONFIG_PM_SLEEP */ | 100 | #endif /* CONFIG_PM_SLEEP */ |
99 | 101 | ||
100 | /** | 102 | /** |
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index 012cba0d6d96..b072648dc3f6 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -115,6 +115,9 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages) | |||
115 | struct agp_memory *new; | 115 | struct agp_memory *new; |
116 | unsigned long alloc_size = num_agp_pages*sizeof(struct page *); | 116 | unsigned long alloc_size = num_agp_pages*sizeof(struct page *); |
117 | 117 | ||
118 | if (INT_MAX/sizeof(struct page *) < num_agp_pages) | ||
119 | return NULL; | ||
120 | |||
118 | new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL); | 121 | new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL); |
119 | if (new == NULL) | 122 | if (new == NULL) |
120 | return NULL; | 123 | return NULL; |
@@ -234,11 +237,14 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge, | |||
234 | int scratch_pages; | 237 | int scratch_pages; |
235 | struct agp_memory *new; | 238 | struct agp_memory *new; |
236 | size_t i; | 239 | size_t i; |
240 | int cur_memory; | ||
237 | 241 | ||
238 | if (!bridge) | 242 | if (!bridge) |
239 | return NULL; | 243 | return NULL; |
240 | 244 | ||
241 | if ((atomic_read(&bridge->current_memory_agp) + page_count) > bridge->max_memory_agp) | 245 | cur_memory = atomic_read(&bridge->current_memory_agp); |
246 | if ((cur_memory + page_count > bridge->max_memory_agp) || | ||
247 | (cur_memory + page_count < page_count)) | ||
242 | return NULL; | 248 | return NULL; |
243 | 249 | ||
244 | if (type >= AGP_USER_TYPES) { | 250 | if (type >= AGP_USER_TYPES) { |
@@ -1089,8 +1095,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type) | |||
1089 | return -EINVAL; | 1095 | return -EINVAL; |
1090 | } | 1096 | } |
1091 | 1097 | ||
1092 | /* AK: could wrap */ | 1098 | if (((pg_start + mem->page_count) > num_entries) || |
1093 | if ((pg_start + mem->page_count) > num_entries) | 1099 | ((pg_start + mem->page_count) < pg_start)) |
1094 | return -EINVAL; | 1100 | return -EINVAL; |
1095 | 1101 | ||
1096 | j = pg_start; | 1102 | j = pg_start; |
@@ -1124,7 +1130,7 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
1124 | { | 1130 | { |
1125 | size_t i; | 1131 | size_t i; |
1126 | struct agp_bridge_data *bridge; | 1132 | struct agp_bridge_data *bridge; |
1127 | int mask_type; | 1133 | int mask_type, num_entries; |
1128 | 1134 | ||
1129 | bridge = mem->bridge; | 1135 | bridge = mem->bridge; |
1130 | if (!bridge) | 1136 | if (!bridge) |
@@ -1136,6 +1142,11 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
1136 | if (type != mem->type) | 1142 | if (type != mem->type) |
1137 | return -EINVAL; | 1143 | return -EINVAL; |
1138 | 1144 | ||
1145 | num_entries = agp_num_entries(); | ||
1146 | if (((pg_start + mem->page_count) > num_entries) || | ||
1147 | ((pg_start + mem->page_count) < pg_start)) | ||
1148 | return -EINVAL; | ||
1149 | |||
1139 | mask_type = bridge->driver->agp_type_to_mask_type(bridge, type); | 1150 | mask_type = bridge->driver->agp_type_to_mask_type(bridge, type); |
1140 | if (mask_type != 0) { | 1151 | if (mask_type != 0) { |
1141 | /* The generic routines know nothing of memory types */ | 1152 | /* The generic routines know nothing of memory types */ |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 84b164d1eb2b..838568a7dbf5 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1280,18 +1280,7 @@ static void unplug_port(struct port *port) | |||
1280 | spin_lock_irq(&pdrvdata_lock); | 1280 | spin_lock_irq(&pdrvdata_lock); |
1281 | list_del(&port->cons.list); | 1281 | list_del(&port->cons.list); |
1282 | spin_unlock_irq(&pdrvdata_lock); | 1282 | spin_unlock_irq(&pdrvdata_lock); |
1283 | #if 0 | ||
1284 | /* | ||
1285 | * hvc_remove() not called as removing one hvc port | ||
1286 | * results in other hvc ports getting frozen. | ||
1287 | * | ||
1288 | * Once this is resolved in hvc, this functionality | ||
1289 | * will be enabled. Till that is done, the -EPIPE | ||
1290 | * return from get_chars() above will help | ||
1291 | * hvc_console.c to clean up on ports we remove here. | ||
1292 | */ | ||
1293 | hvc_remove(port->cons.hvc); | 1283 | hvc_remove(port->cons.hvc); |
1294 | #endif | ||
1295 | } | 1284 | } |
1296 | 1285 | ||
1297 | /* Remove unused data this port might have received. */ | 1286 | /* Remove unused data this port might have received. */ |
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 0fc0a79852de..6db161f64ae0 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c | |||
@@ -32,10 +32,9 @@ static DEFINE_MUTEX(clocks_mutex); | |||
32 | * Then we take the most specific entry - with the following | 32 | * Then we take the most specific entry - with the following |
33 | * order of precedence: dev+con > dev only > con only. | 33 | * order of precedence: dev+con > dev only > con only. |
34 | */ | 34 | */ |
35 | static struct clk *clk_find(const char *dev_id, const char *con_id) | 35 | static struct clk_lookup *clk_find(const char *dev_id, const char *con_id) |
36 | { | 36 | { |
37 | struct clk_lookup *p; | 37 | struct clk_lookup *p, *cl = NULL; |
38 | struct clk *clk = NULL; | ||
39 | int match, best = 0; | 38 | int match, best = 0; |
40 | 39 | ||
41 | list_for_each_entry(p, &clocks, node) { | 40 | list_for_each_entry(p, &clocks, node) { |
@@ -52,27 +51,27 @@ static struct clk *clk_find(const char *dev_id, const char *con_id) | |||
52 | } | 51 | } |
53 | 52 | ||
54 | if (match > best) { | 53 | if (match > best) { |
55 | clk = p->clk; | 54 | cl = p; |
56 | if (match != 3) | 55 | if (match != 3) |
57 | best = match; | 56 | best = match; |
58 | else | 57 | else |
59 | break; | 58 | break; |
60 | } | 59 | } |
61 | } | 60 | } |
62 | return clk; | 61 | return cl; |
63 | } | 62 | } |
64 | 63 | ||
65 | struct clk *clk_get_sys(const char *dev_id, const char *con_id) | 64 | struct clk *clk_get_sys(const char *dev_id, const char *con_id) |
66 | { | 65 | { |
67 | struct clk *clk; | 66 | struct clk_lookup *cl; |
68 | 67 | ||
69 | mutex_lock(&clocks_mutex); | 68 | mutex_lock(&clocks_mutex); |
70 | clk = clk_find(dev_id, con_id); | 69 | cl = clk_find(dev_id, con_id); |
71 | if (clk && !__clk_get(clk)) | 70 | if (cl && !__clk_get(cl->clk)) |
72 | clk = NULL; | 71 | cl = NULL; |
73 | mutex_unlock(&clocks_mutex); | 72 | mutex_unlock(&clocks_mutex); |
74 | 73 | ||
75 | return clk ? clk : ERR_PTR(-ENOENT); | 74 | return cl ? cl->clk : ERR_PTR(-ENOENT); |
76 | } | 75 | } |
77 | EXPORT_SYMBOL(clk_get_sys); | 76 | EXPORT_SYMBOL(clk_get_sys); |
78 | 77 | ||
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 6b396759e7f5..8a781540590c 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c | |||
@@ -1448,7 +1448,7 @@ static const struct of_device_id fsldma_of_ids[] = { | |||
1448 | {} | 1448 | {} |
1449 | }; | 1449 | }; |
1450 | 1450 | ||
1451 | static struct of_platform_driver fsldma_of_driver = { | 1451 | static struct platform_driver fsldma_of_driver = { |
1452 | .driver = { | 1452 | .driver = { |
1453 | .name = "fsl-elo-dma", | 1453 | .name = "fsl-elo-dma", |
1454 | .owner = THIS_MODULE, | 1454 | .owner = THIS_MODULE, |
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 31e71c4fc831..9a8bebcf6b17 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -211,8 +211,6 @@ static int amd64_get_scrub_rate(struct mem_ctl_info *mci) | |||
211 | 211 | ||
212 | scrubval = scrubval & 0x001F; | 212 | scrubval = scrubval & 0x001F; |
213 | 213 | ||
214 | amd64_debug("pci-read, sdram scrub control value: %d\n", scrubval); | ||
215 | |||
216 | for (i = 0; i < ARRAY_SIZE(scrubrates); i++) { | 214 | for (i = 0; i < ARRAY_SIZE(scrubrates); i++) { |
217 | if (scrubrates[i].scrubval == scrubval) { | 215 | if (scrubrates[i].scrubval == scrubval) { |
218 | retval = scrubrates[i].bandwidth; | 216 | retval = scrubrates[i].bandwidth; |
@@ -933,25 +931,74 @@ static int k8_early_channel_count(struct amd64_pvt *pvt) | |||
933 | /* On F10h and later ErrAddr is MC4_ADDR[47:1] */ | 931 | /* On F10h and later ErrAddr is MC4_ADDR[47:1] */ |
934 | static u64 get_error_address(struct mce *m) | 932 | static u64 get_error_address(struct mce *m) |
935 | { | 933 | { |
934 | struct cpuinfo_x86 *c = &boot_cpu_data; | ||
935 | u64 addr; | ||
936 | u8 start_bit = 1; | 936 | u8 start_bit = 1; |
937 | u8 end_bit = 47; | 937 | u8 end_bit = 47; |
938 | 938 | ||
939 | if (boot_cpu_data.x86 == 0xf) { | 939 | if (c->x86 == 0xf) { |
940 | start_bit = 3; | 940 | start_bit = 3; |
941 | end_bit = 39; | 941 | end_bit = 39; |
942 | } | 942 | } |
943 | 943 | ||
944 | return m->addr & GENMASK(start_bit, end_bit); | 944 | addr = m->addr & GENMASK(start_bit, end_bit); |
945 | |||
946 | /* | ||
947 | * Erratum 637 workaround | ||
948 | */ | ||
949 | if (c->x86 == 0x15) { | ||
950 | struct amd64_pvt *pvt; | ||
951 | u64 cc6_base, tmp_addr; | ||
952 | u32 tmp; | ||
953 | u8 mce_nid, intlv_en; | ||
954 | |||
955 | if ((addr & GENMASK(24, 47)) >> 24 != 0x00fdf7) | ||
956 | return addr; | ||
957 | |||
958 | mce_nid = amd_get_nb_id(m->extcpu); | ||
959 | pvt = mcis[mce_nid]->pvt_info; | ||
960 | |||
961 | amd64_read_pci_cfg(pvt->F1, DRAM_LOCAL_NODE_LIM, &tmp); | ||
962 | intlv_en = tmp >> 21 & 0x7; | ||
963 | |||
964 | /* add [47:27] + 3 trailing bits */ | ||
965 | cc6_base = (tmp & GENMASK(0, 20)) << 3; | ||
966 | |||
967 | /* reverse and add DramIntlvEn */ | ||
968 | cc6_base |= intlv_en ^ 0x7; | ||
969 | |||
970 | /* pin at [47:24] */ | ||
971 | cc6_base <<= 24; | ||
972 | |||
973 | if (!intlv_en) | ||
974 | return cc6_base | (addr & GENMASK(0, 23)); | ||
975 | |||
976 | amd64_read_pci_cfg(pvt->F1, DRAM_LOCAL_NODE_BASE, &tmp); | ||
977 | |||
978 | /* faster log2 */ | ||
979 | tmp_addr = (addr & GENMASK(12, 23)) << __fls(intlv_en + 1); | ||
980 | |||
981 | /* OR DramIntlvSel into bits [14:12] */ | ||
982 | tmp_addr |= (tmp & GENMASK(21, 23)) >> 9; | ||
983 | |||
984 | /* add remaining [11:0] bits from original MC4_ADDR */ | ||
985 | tmp_addr |= addr & GENMASK(0, 11); | ||
986 | |||
987 | return cc6_base | tmp_addr; | ||
988 | } | ||
989 | |||
990 | return addr; | ||
945 | } | 991 | } |
946 | 992 | ||
947 | static void read_dram_base_limit_regs(struct amd64_pvt *pvt, unsigned range) | 993 | static void read_dram_base_limit_regs(struct amd64_pvt *pvt, unsigned range) |
948 | { | 994 | { |
995 | struct cpuinfo_x86 *c = &boot_cpu_data; | ||
949 | int off = range << 3; | 996 | int off = range << 3; |
950 | 997 | ||
951 | amd64_read_pci_cfg(pvt->F1, DRAM_BASE_LO + off, &pvt->ranges[range].base.lo); | 998 | amd64_read_pci_cfg(pvt->F1, DRAM_BASE_LO + off, &pvt->ranges[range].base.lo); |
952 | amd64_read_pci_cfg(pvt->F1, DRAM_LIMIT_LO + off, &pvt->ranges[range].lim.lo); | 999 | amd64_read_pci_cfg(pvt->F1, DRAM_LIMIT_LO + off, &pvt->ranges[range].lim.lo); |
953 | 1000 | ||
954 | if (boot_cpu_data.x86 == 0xf) | 1001 | if (c->x86 == 0xf) |
955 | return; | 1002 | return; |
956 | 1003 | ||
957 | if (!dram_rw(pvt, range)) | 1004 | if (!dram_rw(pvt, range)) |
@@ -959,6 +1006,31 @@ static void read_dram_base_limit_regs(struct amd64_pvt *pvt, unsigned range) | |||
959 | 1006 | ||
960 | amd64_read_pci_cfg(pvt->F1, DRAM_BASE_HI + off, &pvt->ranges[range].base.hi); | 1007 | amd64_read_pci_cfg(pvt->F1, DRAM_BASE_HI + off, &pvt->ranges[range].base.hi); |
961 | amd64_read_pci_cfg(pvt->F1, DRAM_LIMIT_HI + off, &pvt->ranges[range].lim.hi); | 1008 | amd64_read_pci_cfg(pvt->F1, DRAM_LIMIT_HI + off, &pvt->ranges[range].lim.hi); |
1009 | |||
1010 | /* Factor in CC6 save area by reading dst node's limit reg */ | ||
1011 | if (c->x86 == 0x15) { | ||
1012 | struct pci_dev *f1 = NULL; | ||
1013 | u8 nid = dram_dst_node(pvt, range); | ||
1014 | u32 llim; | ||
1015 | |||
1016 | f1 = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0x18 + nid, 1)); | ||
1017 | if (WARN_ON(!f1)) | ||
1018 | return; | ||
1019 | |||
1020 | amd64_read_pci_cfg(f1, DRAM_LOCAL_NODE_LIM, &llim); | ||
1021 | |||
1022 | pvt->ranges[range].lim.lo &= GENMASK(0, 15); | ||
1023 | |||
1024 | /* {[39:27],111b} */ | ||
1025 | pvt->ranges[range].lim.lo |= ((llim & 0x1fff) << 3 | 0x7) << 16; | ||
1026 | |||
1027 | pvt->ranges[range].lim.hi &= GENMASK(0, 7); | ||
1028 | |||
1029 | /* [47:40] */ | ||
1030 | pvt->ranges[range].lim.hi |= llim >> 13; | ||
1031 | |||
1032 | pci_dev_put(f1); | ||
1033 | } | ||
962 | } | 1034 | } |
963 | 1035 | ||
964 | static void k8_map_sysaddr_to_csrow(struct mem_ctl_info *mci, u64 sys_addr, | 1036 | static void k8_map_sysaddr_to_csrow(struct mem_ctl_info *mci, u64 sys_addr, |
@@ -1403,12 +1475,8 @@ static int f1x_match_to_this_node(struct amd64_pvt *pvt, unsigned range, | |||
1403 | return -EINVAL; | 1475 | return -EINVAL; |
1404 | } | 1476 | } |
1405 | 1477 | ||
1406 | if (intlv_en && | 1478 | if (intlv_en && (intlv_sel != ((sys_addr >> 12) & intlv_en))) |
1407 | (intlv_sel != ((sys_addr >> 12) & intlv_en))) { | ||
1408 | amd64_warn("Botched intlv bits, en: 0x%x, sel: 0x%x\n", | ||
1409 | intlv_en, intlv_sel); | ||
1410 | return -EINVAL; | 1479 | return -EINVAL; |
1411 | } | ||
1412 | 1480 | ||
1413 | sys_addr = f1x_swap_interleaved_region(pvt, sys_addr); | 1481 | sys_addr = f1x_swap_interleaved_region(pvt, sys_addr); |
1414 | 1482 | ||
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 11be36a311eb..9a666cb985b2 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h | |||
@@ -196,6 +196,9 @@ | |||
196 | 196 | ||
197 | #define DCT_CFG_SEL 0x10C | 197 | #define DCT_CFG_SEL 0x10C |
198 | 198 | ||
199 | #define DRAM_LOCAL_NODE_BASE 0x120 | ||
200 | #define DRAM_LOCAL_NODE_LIM 0x124 | ||
201 | |||
199 | #define DRAM_BASE_HI 0x140 | 202 | #define DRAM_BASE_HI 0x140 |
200 | #define DRAM_LIMIT_HI 0x144 | 203 | #define DRAM_LIMIT_HI 0x144 |
201 | 204 | ||
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index 26343fd46596..29ffa350bfbe 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c | |||
@@ -458,13 +458,13 @@ static ssize_t mci_sdram_scrub_rate_store(struct mem_ctl_info *mci, | |||
458 | return -EINVAL; | 458 | return -EINVAL; |
459 | 459 | ||
460 | new_bw = mci->set_sdram_scrub_rate(mci, bandwidth); | 460 | new_bw = mci->set_sdram_scrub_rate(mci, bandwidth); |
461 | if (new_bw >= 0) { | 461 | if (new_bw < 0) { |
462 | edac_printk(KERN_DEBUG, EDAC_MC, "Scrub rate set to %d\n", new_bw); | 462 | edac_printk(KERN_WARNING, EDAC_MC, |
463 | return count; | 463 | "Error setting scrub rate to: %lu\n", bandwidth); |
464 | return -EINVAL; | ||
464 | } | 465 | } |
465 | 466 | ||
466 | edac_printk(KERN_DEBUG, EDAC_MC, "Error setting scrub rate to: %lu\n", bandwidth); | 467 | return count; |
467 | return -EINVAL; | ||
468 | } | 468 | } |
469 | 469 | ||
470 | /* | 470 | /* |
@@ -483,7 +483,6 @@ static ssize_t mci_sdram_scrub_rate_show(struct mem_ctl_info *mci, char *data) | |||
483 | return bandwidth; | 483 | return bandwidth; |
484 | } | 484 | } |
485 | 485 | ||
486 | edac_printk(KERN_DEBUG, EDAC_MC, "Read scrub rate: %d\n", bandwidth); | ||
487 | return sprintf(data, "%d\n", bandwidth); | 486 | return sprintf(data, "%d\n", bandwidth); |
488 | } | 487 | } |
489 | 488 | ||
diff --git a/drivers/gpio/ml_ioh_gpio.c b/drivers/gpio/ml_ioh_gpio.c index 7f6f01a4b145..0a775f7987c2 100644 --- a/drivers/gpio/ml_ioh_gpio.c +++ b/drivers/gpio/ml_ioh_gpio.c | |||
@@ -116,6 +116,7 @@ static int ioh_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, | |||
116 | reg_val |= (1 << nr); | 116 | reg_val |= (1 << nr); |
117 | else | 117 | else |
118 | reg_val &= ~(1 << nr); | 118 | reg_val &= ~(1 << nr); |
119 | iowrite32(reg_val, &chip->reg->regs[chip->ch].po); | ||
119 | 120 | ||
120 | mutex_unlock(&chip->lock); | 121 | mutex_unlock(&chip->lock); |
121 | 122 | ||
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index 583e92592073..7630ab7b9bec 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -558,7 +558,7 @@ static int __devinit pca953x_probe(struct i2c_client *client, | |||
558 | 558 | ||
559 | ret = gpiochip_add(&chip->gpio_chip); | 559 | ret = gpiochip_add(&chip->gpio_chip); |
560 | if (ret) | 560 | if (ret) |
561 | goto out_failed; | 561 | goto out_failed_irq; |
562 | 562 | ||
563 | if (pdata->setup) { | 563 | if (pdata->setup) { |
564 | ret = pdata->setup(client, chip->gpio_chip.base, | 564 | ret = pdata->setup(client, chip->gpio_chip.base, |
@@ -570,8 +570,9 @@ static int __devinit pca953x_probe(struct i2c_client *client, | |||
570 | i2c_set_clientdata(client, chip); | 570 | i2c_set_clientdata(client, chip); |
571 | return 0; | 571 | return 0; |
572 | 572 | ||
573 | out_failed: | 573 | out_failed_irq: |
574 | pca953x_irq_teardown(chip); | 574 | pca953x_irq_teardown(chip); |
575 | out_failed: | ||
575 | kfree(chip->dyn_pdata); | 576 | kfree(chip->dyn_pdata); |
576 | kfree(chip); | 577 | kfree(chip); |
577 | return ret; | 578 | return ret; |
diff --git a/drivers/gpio/pch_gpio.c b/drivers/gpio/pch_gpio.c index 2c6af8705103..f970a5f3585e 100644 --- a/drivers/gpio/pch_gpio.c +++ b/drivers/gpio/pch_gpio.c | |||
@@ -105,6 +105,7 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, | |||
105 | reg_val |= (1 << nr); | 105 | reg_val |= (1 << nr); |
106 | else | 106 | else |
107 | reg_val &= ~(1 << nr); | 107 | reg_val &= ~(1 << nr); |
108 | iowrite32(reg_val, &chip->reg->po); | ||
108 | 109 | ||
109 | mutex_unlock(&chip->lock); | 110 | mutex_unlock(&chip->lock); |
110 | 111 | ||
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index a6feb78c404c..b493663c7ba7 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
@@ -24,6 +24,7 @@ config DRM_KMS_HELPER | |||
24 | depends on DRM | 24 | depends on DRM |
25 | select FB | 25 | select FB |
26 | select FRAMEBUFFER_CONSOLE if !EXPERT | 26 | select FRAMEBUFFER_CONSOLE if !EXPERT |
27 | select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE | ||
27 | help | 28 | help |
28 | FB and CRTC helpers for KMS drivers. | 29 | FB and CRTC helpers for KMS drivers. |
29 | 30 | ||
@@ -96,6 +97,7 @@ config DRM_I915 | |||
96 | # i915 depends on ACPI_VIDEO when ACPI is enabled | 97 | # i915 depends on ACPI_VIDEO when ACPI is enabled |
97 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick | 98 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick |
98 | select BACKLIGHT_CLASS_DEVICE if ACPI | 99 | select BACKLIGHT_CLASS_DEVICE if ACPI |
100 | select VIDEO_OUTPUT_CONTROL if ACPI | ||
99 | select INPUT if ACPI | 101 | select INPUT if ACPI |
100 | select ACPI_VIDEO if ACPI | 102 | select ACPI_VIDEO if ACPI |
101 | select ACPI_BUTTON if ACPI | 103 | select ACPI_BUTTON if ACPI |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 950720473967..11d7a72c22d9 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -342,9 +342,22 @@ int drm_fb_helper_debug_leave(struct fb_info *info) | |||
342 | } | 342 | } |
343 | EXPORT_SYMBOL(drm_fb_helper_debug_leave); | 343 | EXPORT_SYMBOL(drm_fb_helper_debug_leave); |
344 | 344 | ||
345 | bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper) | ||
346 | { | ||
347 | bool error = false; | ||
348 | int i, ret; | ||
349 | for (i = 0; i < fb_helper->crtc_count; i++) { | ||
350 | struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set; | ||
351 | ret = drm_crtc_helper_set_config(mode_set); | ||
352 | if (ret) | ||
353 | error = true; | ||
354 | } | ||
355 | return error; | ||
356 | } | ||
357 | EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode); | ||
358 | |||
345 | bool drm_fb_helper_force_kernel_mode(void) | 359 | bool drm_fb_helper_force_kernel_mode(void) |
346 | { | 360 | { |
347 | int i = 0; | ||
348 | bool ret, error = false; | 361 | bool ret, error = false; |
349 | struct drm_fb_helper *helper; | 362 | struct drm_fb_helper *helper; |
350 | 363 | ||
@@ -352,12 +365,12 @@ bool drm_fb_helper_force_kernel_mode(void) | |||
352 | return false; | 365 | return false; |
353 | 366 | ||
354 | list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) { | 367 | list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) { |
355 | for (i = 0; i < helper->crtc_count; i++) { | 368 | if (helper->dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
356 | struct drm_mode_set *mode_set = &helper->crtc_info[i].mode_set; | 369 | continue; |
357 | ret = drm_crtc_helper_set_config(mode_set); | 370 | |
358 | if (ret) | 371 | ret = drm_fb_helper_restore_fbdev_mode(helper); |
359 | error = true; | 372 | if (ret) |
360 | } | 373 | error = true; |
361 | } | 374 | } |
362 | return error; | 375 | return error; |
363 | } | 376 | } |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 72730377a01b..12876f2795d2 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -2207,7 +2207,7 @@ void i915_driver_lastclose(struct drm_device * dev) | |||
2207 | drm_i915_private_t *dev_priv = dev->dev_private; | 2207 | drm_i915_private_t *dev_priv = dev->dev_private; |
2208 | 2208 | ||
2209 | if (!dev_priv || drm_core_check_feature(dev, DRIVER_MODESET)) { | 2209 | if (!dev_priv || drm_core_check_feature(dev, DRIVER_MODESET)) { |
2210 | drm_fb_helper_restore(); | 2210 | intel_fb_restore_mode(dev); |
2211 | vga_switcheroo_process_delayed_switch(); | 2211 | vga_switcheroo_process_delayed_switch(); |
2212 | return; | 2212 | return; |
2213 | } | 2213 | } |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 432fc04c6bff..e522c702b04e 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -3771,8 +3771,11 @@ static bool g4x_compute_wm0(struct drm_device *dev, | |||
3771 | int entries, tlb_miss; | 3771 | int entries, tlb_miss; |
3772 | 3772 | ||
3773 | crtc = intel_get_crtc_for_plane(dev, plane); | 3773 | crtc = intel_get_crtc_for_plane(dev, plane); |
3774 | if (crtc->fb == NULL || !crtc->enabled) | 3774 | if (crtc->fb == NULL || !crtc->enabled) { |
3775 | *cursor_wm = cursor->guard_size; | ||
3776 | *plane_wm = display->guard_size; | ||
3775 | return false; | 3777 | return false; |
3778 | } | ||
3776 | 3779 | ||
3777 | htotal = crtc->mode.htotal; | 3780 | htotal = crtc->mode.htotal; |
3778 | hdisplay = crtc->mode.hdisplay; | 3781 | hdisplay = crtc->mode.hdisplay; |
@@ -6215,36 +6218,6 @@ cleanup_work: | |||
6215 | return ret; | 6218 | return ret; |
6216 | } | 6219 | } |
6217 | 6220 | ||
6218 | static void intel_crtc_reset(struct drm_crtc *crtc) | ||
6219 | { | ||
6220 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
6221 | |||
6222 | /* Reset flags back to the 'unknown' status so that they | ||
6223 | * will be correctly set on the initial modeset. | ||
6224 | */ | ||
6225 | intel_crtc->dpms_mode = -1; | ||
6226 | } | ||
6227 | |||
6228 | static struct drm_crtc_helper_funcs intel_helper_funcs = { | ||
6229 | .dpms = intel_crtc_dpms, | ||
6230 | .mode_fixup = intel_crtc_mode_fixup, | ||
6231 | .mode_set = intel_crtc_mode_set, | ||
6232 | .mode_set_base = intel_pipe_set_base, | ||
6233 | .mode_set_base_atomic = intel_pipe_set_base_atomic, | ||
6234 | .load_lut = intel_crtc_load_lut, | ||
6235 | .disable = intel_crtc_disable, | ||
6236 | }; | ||
6237 | |||
6238 | static const struct drm_crtc_funcs intel_crtc_funcs = { | ||
6239 | .reset = intel_crtc_reset, | ||
6240 | .cursor_set = intel_crtc_cursor_set, | ||
6241 | .cursor_move = intel_crtc_cursor_move, | ||
6242 | .gamma_set = intel_crtc_gamma_set, | ||
6243 | .set_config = drm_crtc_helper_set_config, | ||
6244 | .destroy = intel_crtc_destroy, | ||
6245 | .page_flip = intel_crtc_page_flip, | ||
6246 | }; | ||
6247 | |||
6248 | static void intel_sanitize_modesetting(struct drm_device *dev, | 6221 | static void intel_sanitize_modesetting(struct drm_device *dev, |
6249 | int pipe, int plane) | 6222 | int pipe, int plane) |
6250 | { | 6223 | { |
@@ -6281,6 +6254,42 @@ static void intel_sanitize_modesetting(struct drm_device *dev, | |||
6281 | intel_disable_pipe(dev_priv, pipe); | 6254 | intel_disable_pipe(dev_priv, pipe); |
6282 | } | 6255 | } |
6283 | 6256 | ||
6257 | static void intel_crtc_reset(struct drm_crtc *crtc) | ||
6258 | { | ||
6259 | struct drm_device *dev = crtc->dev; | ||
6260 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
6261 | |||
6262 | /* Reset flags back to the 'unknown' status so that they | ||
6263 | * will be correctly set on the initial modeset. | ||
6264 | */ | ||
6265 | intel_crtc->dpms_mode = -1; | ||
6266 | |||
6267 | /* We need to fix up any BIOS configuration that conflicts with | ||
6268 | * our expectations. | ||
6269 | */ | ||
6270 | intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane); | ||
6271 | } | ||
6272 | |||
6273 | static struct drm_crtc_helper_funcs intel_helper_funcs = { | ||
6274 | .dpms = intel_crtc_dpms, | ||
6275 | .mode_fixup = intel_crtc_mode_fixup, | ||
6276 | .mode_set = intel_crtc_mode_set, | ||
6277 | .mode_set_base = intel_pipe_set_base, | ||
6278 | .mode_set_base_atomic = intel_pipe_set_base_atomic, | ||
6279 | .load_lut = intel_crtc_load_lut, | ||
6280 | .disable = intel_crtc_disable, | ||
6281 | }; | ||
6282 | |||
6283 | static const struct drm_crtc_funcs intel_crtc_funcs = { | ||
6284 | .reset = intel_crtc_reset, | ||
6285 | .cursor_set = intel_crtc_cursor_set, | ||
6286 | .cursor_move = intel_crtc_cursor_move, | ||
6287 | .gamma_set = intel_crtc_gamma_set, | ||
6288 | .set_config = drm_crtc_helper_set_config, | ||
6289 | .destroy = intel_crtc_destroy, | ||
6290 | .page_flip = intel_crtc_page_flip, | ||
6291 | }; | ||
6292 | |||
6284 | static void intel_crtc_init(struct drm_device *dev, int pipe) | 6293 | static void intel_crtc_init(struct drm_device *dev, int pipe) |
6285 | { | 6294 | { |
6286 | drm_i915_private_t *dev_priv = dev->dev_private; | 6295 | drm_i915_private_t *dev_priv = dev->dev_private; |
@@ -6330,8 +6339,6 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
6330 | 6339 | ||
6331 | setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, | 6340 | setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, |
6332 | (unsigned long)intel_crtc); | 6341 | (unsigned long)intel_crtc); |
6333 | |||
6334 | intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane); | ||
6335 | } | 6342 | } |
6336 | 6343 | ||
6337 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, | 6344 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index f5b0d8306d83..1d20712d527f 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -338,4 +338,5 @@ extern int intel_overlay_attrs(struct drm_device *dev, void *data, | |||
338 | struct drm_file *file_priv); | 338 | struct drm_file *file_priv); |
339 | 339 | ||
340 | extern void intel_fb_output_poll_changed(struct drm_device *dev); | 340 | extern void intel_fb_output_poll_changed(struct drm_device *dev); |
341 | extern void intel_fb_restore_mode(struct drm_device *dev); | ||
341 | #endif /* __INTEL_DRV_H__ */ | 342 | #endif /* __INTEL_DRV_H__ */ |
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 512782728e51..ec49bae73382 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -264,3 +264,13 @@ void intel_fb_output_poll_changed(struct drm_device *dev) | |||
264 | drm_i915_private_t *dev_priv = dev->dev_private; | 264 | drm_i915_private_t *dev_priv = dev->dev_private; |
265 | drm_fb_helper_hotplug_event(&dev_priv->fbdev->helper); | 265 | drm_fb_helper_hotplug_event(&dev_priv->fbdev->helper); |
266 | } | 266 | } |
267 | |||
268 | void intel_fb_restore_mode(struct drm_device *dev) | ||
269 | { | ||
270 | int ret; | ||
271 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
272 | |||
273 | ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); | ||
274 | if (ret) | ||
275 | DRM_DEBUG("failed to restore crtc mode\n"); | ||
276 | } | ||
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 4256b8ef3947..6b22c1dcc015 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -1151,10 +1151,10 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
1151 | (video_levels->blank << TV_BLANK_LEVEL_SHIFT))); | 1151 | (video_levels->blank << TV_BLANK_LEVEL_SHIFT))); |
1152 | { | 1152 | { |
1153 | int pipeconf_reg = PIPECONF(pipe); | 1153 | int pipeconf_reg = PIPECONF(pipe); |
1154 | int dspcntr_reg = DSPCNTR(pipe); | 1154 | int dspcntr_reg = DSPCNTR(intel_crtc->plane); |
1155 | int pipeconf = I915_READ(pipeconf_reg); | 1155 | int pipeconf = I915_READ(pipeconf_reg); |
1156 | int dspcntr = I915_READ(dspcntr_reg); | 1156 | int dspcntr = I915_READ(dspcntr_reg); |
1157 | int dspbase_reg = DSPADDR(pipe); | 1157 | int dspbase_reg = DSPADDR(intel_crtc->plane); |
1158 | int xpos = 0x0, ypos = 0x0; | 1158 | int xpos = 0x0, ypos = 0x0; |
1159 | unsigned int xsize, ysize; | 1159 | unsigned int xsize, ysize; |
1160 | /* Pipe must be off here */ | 1160 | /* Pipe must be off here */ |
@@ -1378,7 +1378,9 @@ intel_tv_detect(struct drm_connector *connector, bool force) | |||
1378 | if (type < 0) | 1378 | if (type < 0) |
1379 | return connector_status_disconnected; | 1379 | return connector_status_disconnected; |
1380 | 1380 | ||
1381 | intel_tv->type = type; | ||
1381 | intel_tv_find_better_format(connector); | 1382 | intel_tv_find_better_format(connector); |
1383 | |||
1382 | return connector_status_connected; | 1384 | return connector_status_connected; |
1383 | } | 1385 | } |
1384 | 1386 | ||
@@ -1670,8 +1672,7 @@ intel_tv_init(struct drm_device *dev) | |||
1670 | * | 1672 | * |
1671 | * More recent chipsets favour HDMI rather than integrated S-Video. | 1673 | * More recent chipsets favour HDMI rather than integrated S-Video. |
1672 | */ | 1674 | */ |
1673 | connector->polled = | 1675 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
1674 | DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; | ||
1675 | 1676 | ||
1676 | drm_connector_init(dev, connector, &intel_tv_connector_funcs, | 1677 | drm_connector_init(dev, connector, &intel_tv_connector_funcs, |
1677 | DRM_MODE_CONNECTOR_SVIDEO); | 1678 | DRM_MODE_CONNECTOR_SVIDEO); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 8314a49b6b9a..90aef64b76f2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -269,7 +269,7 @@ struct init_tbl_entry { | |||
269 | int (*handler)(struct nvbios *, uint16_t, struct init_exec *); | 269 | int (*handler)(struct nvbios *, uint16_t, struct init_exec *); |
270 | }; | 270 | }; |
271 | 271 | ||
272 | static int parse_init_table(struct nvbios *, unsigned int, struct init_exec *); | 272 | static int parse_init_table(struct nvbios *, uint16_t, struct init_exec *); |
273 | 273 | ||
274 | #define MACRO_INDEX_SIZE 2 | 274 | #define MACRO_INDEX_SIZE 2 |
275 | #define MACRO_SIZE 8 | 275 | #define MACRO_SIZE 8 |
@@ -2011,6 +2011,27 @@ init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2011 | } | 2011 | } |
2012 | 2012 | ||
2013 | static int | 2013 | static int |
2014 | init_jump(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | ||
2015 | { | ||
2016 | /* | ||
2017 | * INIT_JUMP opcode: 0x5C ('\') | ||
2018 | * | ||
2019 | * offset (8 bit): opcode | ||
2020 | * offset + 1 (16 bit): offset (in bios) | ||
2021 | * | ||
2022 | * Continue execution of init table from 'offset' | ||
2023 | */ | ||
2024 | |||
2025 | uint16_t jmp_offset = ROM16(bios->data[offset + 1]); | ||
2026 | |||
2027 | if (!iexec->execute) | ||
2028 | return 3; | ||
2029 | |||
2030 | BIOSLOG(bios, "0x%04X: Jump to 0x%04X\n", offset, jmp_offset); | ||
2031 | return jmp_offset - offset; | ||
2032 | } | ||
2033 | |||
2034 | static int | ||
2014 | init_i2c_if(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2035 | init_i2c_if(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2015 | { | 2036 | { |
2016 | /* | 2037 | /* |
@@ -3659,6 +3680,7 @@ static struct init_tbl_entry itbl_entry[] = { | |||
3659 | { "INIT_ZM_REG_SEQUENCE" , 0x58, init_zm_reg_sequence }, | 3680 | { "INIT_ZM_REG_SEQUENCE" , 0x58, init_zm_reg_sequence }, |
3660 | /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ | 3681 | /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ |
3661 | { "INIT_SUB_DIRECT" , 0x5B, init_sub_direct }, | 3682 | { "INIT_SUB_DIRECT" , 0x5B, init_sub_direct }, |
3683 | { "INIT_JUMP" , 0x5C, init_jump }, | ||
3662 | { "INIT_I2C_IF" , 0x5E, init_i2c_if }, | 3684 | { "INIT_I2C_IF" , 0x5E, init_i2c_if }, |
3663 | { "INIT_COPY_NV_REG" , 0x5F, init_copy_nv_reg }, | 3685 | { "INIT_COPY_NV_REG" , 0x5F, init_copy_nv_reg }, |
3664 | { "INIT_ZM_INDEX_IO" , 0x62, init_zm_index_io }, | 3686 | { "INIT_ZM_INDEX_IO" , 0x62, init_zm_index_io }, |
@@ -3700,8 +3722,7 @@ static struct init_tbl_entry itbl_entry[] = { | |||
3700 | #define MAX_TABLE_OPS 1000 | 3722 | #define MAX_TABLE_OPS 1000 |
3701 | 3723 | ||
3702 | static int | 3724 | static int |
3703 | parse_init_table(struct nvbios *bios, unsigned int offset, | 3725 | parse_init_table(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
3704 | struct init_exec *iexec) | ||
3705 | { | 3726 | { |
3706 | /* | 3727 | /* |
3707 | * Parses all commands in an init table. | 3728 | * Parses all commands in an init table. |
@@ -6333,6 +6354,32 @@ apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf) | |||
6333 | } | 6354 | } |
6334 | } | 6355 | } |
6335 | 6356 | ||
6357 | /* XFX GT-240X-YA | ||
6358 | * | ||
6359 | * So many things wrong here, replace the entire encoder table.. | ||
6360 | */ | ||
6361 | if (nv_match_device(dev, 0x0ca3, 0x1682, 0x3003)) { | ||
6362 | if (idx == 0) { | ||
6363 | *conn = 0x02001300; /* VGA, connector 1 */ | ||
6364 | *conf = 0x00000028; | ||
6365 | } else | ||
6366 | if (idx == 1) { | ||
6367 | *conn = 0x01010312; /* DVI, connector 0 */ | ||
6368 | *conf = 0x00020030; | ||
6369 | } else | ||
6370 | if (idx == 2) { | ||
6371 | *conn = 0x01010310; /* VGA, connector 0 */ | ||
6372 | *conf = 0x00000028; | ||
6373 | } else | ||
6374 | if (idx == 3) { | ||
6375 | *conn = 0x02022362; /* HDMI, connector 2 */ | ||
6376 | *conf = 0x00020010; | ||
6377 | } else { | ||
6378 | *conn = 0x0000000e; /* EOL */ | ||
6379 | *conf = 0x00000000; | ||
6380 | } | ||
6381 | } | ||
6382 | |||
6336 | return true; | 6383 | return true; |
6337 | } | 6384 | } |
6338 | 6385 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c index ce38e97b9428..568caedd7216 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.c +++ b/drivers/gpu/drm/nouveau/nouveau_dma.c | |||
@@ -83,7 +83,7 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
83 | return ret; | 83 | return ret; |
84 | 84 | ||
85 | /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ | 85 | /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ |
86 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, 0xfd0, 0x1000, | 86 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, 0xfe0, 0x1000, |
87 | &chan->m2mf_ntfy); | 87 | &chan->m2mf_ntfy); |
88 | if (ret) | 88 | if (ret) |
89 | return ret; | 89 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 57e5302503db..a76514a209b3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -682,6 +682,9 @@ struct drm_nouveau_private { | |||
682 | /* For PFIFO and PGRAPH. */ | 682 | /* For PFIFO and PGRAPH. */ |
683 | spinlock_t context_switch_lock; | 683 | spinlock_t context_switch_lock; |
684 | 684 | ||
685 | /* VM/PRAMIN flush, legacy PRAMIN aperture */ | ||
686 | spinlock_t vm_lock; | ||
687 | |||
685 | /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */ | 688 | /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */ |
686 | struct nouveau_ramht *ramht; | 689 | struct nouveau_ramht *ramht; |
687 | struct nouveau_gpuobj *ramfc; | 690 | struct nouveau_gpuobj *ramfc; |
@@ -1190,7 +1193,7 @@ extern int nv50_graph_load_context(struct nouveau_channel *); | |||
1190 | extern int nv50_graph_unload_context(struct drm_device *); | 1193 | extern int nv50_graph_unload_context(struct drm_device *); |
1191 | extern int nv50_grctx_init(struct nouveau_grctx *); | 1194 | extern int nv50_grctx_init(struct nouveau_grctx *); |
1192 | extern void nv50_graph_tlb_flush(struct drm_device *dev); | 1195 | extern void nv50_graph_tlb_flush(struct drm_device *dev); |
1193 | extern void nv86_graph_tlb_flush(struct drm_device *dev); | 1196 | extern void nv84_graph_tlb_flush(struct drm_device *dev); |
1194 | extern struct nouveau_enum nv50_data_error_names[]; | 1197 | extern struct nouveau_enum nv50_data_error_names[]; |
1195 | 1198 | ||
1196 | /* nvc0_graph.c */ | 1199 | /* nvc0_graph.c */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 889c4454682e..39aee6d4daf8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -181,13 +181,13 @@ nouveau_fbcon_sync(struct fb_info *info) | |||
181 | OUT_RING (chan, 0); | 181 | OUT_RING (chan, 0); |
182 | } | 182 | } |
183 | 183 | ||
184 | nouveau_bo_wr32(chan->notifier_bo, chan->m2mf_ntfy + 3, 0xffffffff); | 184 | nouveau_bo_wr32(chan->notifier_bo, chan->m2mf_ntfy/4 + 3, 0xffffffff); |
185 | FIRE_RING(chan); | 185 | FIRE_RING(chan); |
186 | mutex_unlock(&chan->mutex); | 186 | mutex_unlock(&chan->mutex); |
187 | 187 | ||
188 | ret = -EBUSY; | 188 | ret = -EBUSY; |
189 | for (i = 0; i < 100000; i++) { | 189 | for (i = 0; i < 100000; i++) { |
190 | if (!nouveau_bo_rd32(chan->notifier_bo, chan->m2mf_ntfy + 3)) { | 190 | if (!nouveau_bo_rd32(chan->notifier_bo, chan->m2mf_ntfy/4 + 3)) { |
191 | ret = 0; | 191 | ret = 0; |
192 | break; | 192 | break; |
193 | } | 193 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 2683377f4131..5045f8b921d6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -398,7 +398,7 @@ nouveau_mem_vram_init(struct drm_device *dev) | |||
398 | dma_bits = 40; | 398 | dma_bits = 40; |
399 | } else | 399 | } else |
400 | if (drm_pci_device_is_pcie(dev) && | 400 | if (drm_pci_device_is_pcie(dev) && |
401 | dev_priv->chipset != 0x40 && | 401 | dev_priv->chipset > 0x40 && |
402 | dev_priv->chipset != 0x45) { | 402 | dev_priv->chipset != 0x45) { |
403 | if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(39))) | 403 | if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(39))) |
404 | dma_bits = 39; | 404 | dma_bits = 39; |
@@ -552,6 +552,7 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
552 | u8 tRC; /* Byte 9 */ | 552 | u8 tRC; /* Byte 9 */ |
553 | u8 tUNK_10, tUNK_11, tUNK_12, tUNK_13, tUNK_14; | 553 | u8 tUNK_10, tUNK_11, tUNK_12, tUNK_13, tUNK_14; |
554 | u8 tUNK_18, tUNK_19, tUNK_20, tUNK_21; | 554 | u8 tUNK_18, tUNK_19, tUNK_20, tUNK_21; |
555 | u8 magic_number = 0; /* Yeah... sorry*/ | ||
555 | u8 *mem = NULL, *entry; | 556 | u8 *mem = NULL, *entry; |
556 | int i, recordlen, entries; | 557 | int i, recordlen, entries; |
557 | 558 | ||
@@ -596,6 +597,12 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
596 | if (!memtimings->timing) | 597 | if (!memtimings->timing) |
597 | return; | 598 | return; |
598 | 599 | ||
600 | /* Get "some number" from the timing reg for NV_40 | ||
601 | * Used in calculations later */ | ||
602 | if(dev_priv->card_type == NV_40) { | ||
603 | magic_number = (nv_rd32(dev,0x100228) & 0x0f000000) >> 24; | ||
604 | } | ||
605 | |||
599 | entry = mem + mem[1]; | 606 | entry = mem + mem[1]; |
600 | for (i = 0; i < entries; i++, entry += recordlen) { | 607 | for (i = 0; i < entries; i++, entry += recordlen) { |
601 | struct nouveau_pm_memtiming *timing = &pm->memtimings.timing[i]; | 608 | struct nouveau_pm_memtiming *timing = &pm->memtimings.timing[i]; |
@@ -635,36 +642,51 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
635 | 642 | ||
636 | /* XXX: I don't trust the -1's and +1's... they must come | 643 | /* XXX: I don't trust the -1's and +1's... they must come |
637 | * from somewhere! */ | 644 | * from somewhere! */ |
638 | timing->reg_100224 = ((tUNK_0 + tUNK_19 + 1) << 24 | | 645 | timing->reg_100224 = (tUNK_0 + tUNK_19 + 1 + magic_number) << 24 | |
639 | tUNK_18 << 16 | | 646 | tUNK_18 << 16 | |
640 | (tUNK_1 + tUNK_19 + 1) << 8 | | 647 | (tUNK_1 + tUNK_19 + 1 + magic_number) << 8; |
641 | (tUNK_2 - 1)); | 648 | if(dev_priv->chipset == 0xa8) { |
649 | timing->reg_100224 |= (tUNK_2 - 1); | ||
650 | } else { | ||
651 | timing->reg_100224 |= (tUNK_2 + 2 - magic_number); | ||
652 | } | ||
642 | 653 | ||
643 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); | 654 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); |
644 | if(recordlen > 19) { | 655 | if(dev_priv->chipset >= 0xa3 && dev_priv->chipset < 0xaa) { |
645 | timing->reg_100228 += (tUNK_19 - 1) << 24; | 656 | timing->reg_100228 |= (tUNK_19 - 1) << 24; |
646 | }/* I cannot back-up this else-statement right now | 657 | } |
647 | else { | 658 | |
648 | timing->reg_100228 += tUNK_12 << 24; | 659 | if(dev_priv->card_type == NV_40) { |
649 | }*/ | 660 | /* NV40: don't know what the rest of the regs are.. |
650 | 661 | * And don't need to know either */ | |
651 | /* XXX: reg_10022c */ | 662 | timing->reg_100228 |= 0x20200000 | magic_number << 24; |
652 | timing->reg_10022c = tUNK_2 - 1; | 663 | } else if(dev_priv->card_type >= NV_50) { |
653 | 664 | /* XXX: reg_10022c */ | |
654 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | | 665 | timing->reg_10022c = tUNK_2 - 1; |
655 | tUNK_13 << 8 | tUNK_13); | 666 | |
656 | 667 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | | |
657 | /* XXX: +6? */ | 668 | tUNK_13 << 8 | tUNK_13); |
658 | timing->reg_100234 = (tRAS << 24 | (tUNK_19 + 6) << 8 | tRC); | 669 | |
659 | timing->reg_100234 += max(tUNK_10,tUNK_11) << 16; | 670 | timing->reg_100234 = (tRAS << 24 | tRC); |
660 | 671 | timing->reg_100234 += max(tUNK_10,tUNK_11) << 16; | |
661 | /* XXX; reg_100238, reg_10023c | 672 | |
662 | * reg: 0x00?????? | 673 | if(dev_priv->chipset < 0xa3) { |
663 | * reg_10023c: | 674 | timing->reg_100234 |= (tUNK_2 + 2) << 8; |
664 | * 0 for pre-NV50 cards | 675 | } else { |
665 | * 0x????0202 for NV50+ cards (empirical evidence) */ | 676 | /* XXX: +6? */ |
666 | if(dev_priv->card_type >= NV_50) { | 677 | timing->reg_100234 |= (tUNK_19 + 6) << 8; |
678 | } | ||
679 | |||
680 | /* XXX; reg_100238, reg_10023c | ||
681 | * reg_100238: 0x00?????? | ||
682 | * reg_10023c: 0x!!??0202 for NV50+ cards (empirical evidence) */ | ||
667 | timing->reg_10023c = 0x202; | 683 | timing->reg_10023c = 0x202; |
684 | if(dev_priv->chipset < 0xa3) { | ||
685 | timing->reg_10023c |= 0x4000000 | (tUNK_2 - 1) << 16; | ||
686 | } else { | ||
687 | /* currently unknown | ||
688 | * 10023c seen as 06xxxxxx, 0bxxxxxx or 0fxxxxxx */ | ||
689 | } | ||
668 | } | 690 | } |
669 | 691 | ||
670 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, | 692 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, |
@@ -675,7 +697,7 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
675 | timing->reg_100238, timing->reg_10023c); | 697 | timing->reg_100238, timing->reg_10023c); |
676 | } | 698 | } |
677 | 699 | ||
678 | memtimings->nr_timing = entries; | 700 | memtimings->nr_timing = entries; |
679 | memtimings->supported = true; | 701 | memtimings->supported = true; |
680 | } | 702 | } |
681 | 703 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_notifier.c b/drivers/gpu/drm/nouveau/nouveau_notifier.c index 7ba3fc0b30c1..5b39718ae1f8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_notifier.c +++ b/drivers/gpu/drm/nouveau/nouveau_notifier.c | |||
@@ -35,19 +35,22 @@ nouveau_notifier_init_channel(struct nouveau_channel *chan) | |||
35 | { | 35 | { |
36 | struct drm_device *dev = chan->dev; | 36 | struct drm_device *dev = chan->dev; |
37 | struct nouveau_bo *ntfy = NULL; | 37 | struct nouveau_bo *ntfy = NULL; |
38 | uint32_t flags; | 38 | uint32_t flags, ttmpl; |
39 | int ret; | 39 | int ret; |
40 | 40 | ||
41 | if (nouveau_vram_notify) | 41 | if (nouveau_vram_notify) { |
42 | flags = NOUVEAU_GEM_DOMAIN_VRAM; | 42 | flags = NOUVEAU_GEM_DOMAIN_VRAM; |
43 | else | 43 | ttmpl = TTM_PL_FLAG_VRAM; |
44 | } else { | ||
44 | flags = NOUVEAU_GEM_DOMAIN_GART; | 45 | flags = NOUVEAU_GEM_DOMAIN_GART; |
46 | ttmpl = TTM_PL_FLAG_TT; | ||
47 | } | ||
45 | 48 | ||
46 | ret = nouveau_gem_new(dev, NULL, PAGE_SIZE, 0, flags, 0, 0, &ntfy); | 49 | ret = nouveau_gem_new(dev, NULL, PAGE_SIZE, 0, flags, 0, 0, &ntfy); |
47 | if (ret) | 50 | if (ret) |
48 | return ret; | 51 | return ret; |
49 | 52 | ||
50 | ret = nouveau_bo_pin(ntfy, flags); | 53 | ret = nouveau_bo_pin(ntfy, ttmpl); |
51 | if (ret) | 54 | if (ret) |
52 | goto out_err; | 55 | goto out_err; |
53 | 56 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 4f00c87ed86e..67a16e01ffa6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
@@ -1039,19 +1039,20 @@ nv_ro32(struct nouveau_gpuobj *gpuobj, u32 offset) | |||
1039 | { | 1039 | { |
1040 | struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; | 1040 | struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; |
1041 | struct drm_device *dev = gpuobj->dev; | 1041 | struct drm_device *dev = gpuobj->dev; |
1042 | unsigned long flags; | ||
1042 | 1043 | ||
1043 | if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { | 1044 | if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { |
1044 | u64 ptr = gpuobj->vinst + offset; | 1045 | u64 ptr = gpuobj->vinst + offset; |
1045 | u32 base = ptr >> 16; | 1046 | u32 base = ptr >> 16; |
1046 | u32 val; | 1047 | u32 val; |
1047 | 1048 | ||
1048 | spin_lock(&dev_priv->ramin_lock); | 1049 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
1049 | if (dev_priv->ramin_base != base) { | 1050 | if (dev_priv->ramin_base != base) { |
1050 | dev_priv->ramin_base = base; | 1051 | dev_priv->ramin_base = base; |
1051 | nv_wr32(dev, 0x001700, dev_priv->ramin_base); | 1052 | nv_wr32(dev, 0x001700, dev_priv->ramin_base); |
1052 | } | 1053 | } |
1053 | val = nv_rd32(dev, 0x700000 + (ptr & 0xffff)); | 1054 | val = nv_rd32(dev, 0x700000 + (ptr & 0xffff)); |
1054 | spin_unlock(&dev_priv->ramin_lock); | 1055 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
1055 | return val; | 1056 | return val; |
1056 | } | 1057 | } |
1057 | 1058 | ||
@@ -1063,18 +1064,19 @@ nv_wo32(struct nouveau_gpuobj *gpuobj, u32 offset, u32 val) | |||
1063 | { | 1064 | { |
1064 | struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; | 1065 | struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; |
1065 | struct drm_device *dev = gpuobj->dev; | 1066 | struct drm_device *dev = gpuobj->dev; |
1067 | unsigned long flags; | ||
1066 | 1068 | ||
1067 | if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { | 1069 | if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { |
1068 | u64 ptr = gpuobj->vinst + offset; | 1070 | u64 ptr = gpuobj->vinst + offset; |
1069 | u32 base = ptr >> 16; | 1071 | u32 base = ptr >> 16; |
1070 | 1072 | ||
1071 | spin_lock(&dev_priv->ramin_lock); | 1073 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
1072 | if (dev_priv->ramin_base != base) { | 1074 | if (dev_priv->ramin_base != base) { |
1073 | dev_priv->ramin_base = base; | 1075 | dev_priv->ramin_base = base; |
1074 | nv_wr32(dev, 0x001700, dev_priv->ramin_base); | 1076 | nv_wr32(dev, 0x001700, dev_priv->ramin_base); |
1075 | } | 1077 | } |
1076 | nv_wr32(dev, 0x700000 + (ptr & 0xffff), val); | 1078 | nv_wr32(dev, 0x700000 + (ptr & 0xffff), val); |
1077 | spin_unlock(&dev_priv->ramin_lock); | 1079 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
1078 | return; | 1080 | return; |
1079 | } | 1081 | } |
1080 | 1082 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c index ac62a1b8c4fc..670e3cb697ec 100644 --- a/drivers/gpu/drm/nouveau/nouveau_perf.c +++ b/drivers/gpu/drm/nouveau/nouveau_perf.c | |||
@@ -134,7 +134,7 @@ nouveau_perf_init(struct drm_device *dev) | |||
134 | case 0x13: | 134 | case 0x13: |
135 | case 0x15: | 135 | case 0x15: |
136 | perflvl->fanspeed = entry[55]; | 136 | perflvl->fanspeed = entry[55]; |
137 | perflvl->voltage = entry[56]; | 137 | perflvl->voltage = (recordlen > 56) ? entry[56] : 0; |
138 | perflvl->core = ROM32(entry[1]) * 10; | 138 | perflvl->core = ROM32(entry[1]) * 10; |
139 | perflvl->memory = ROM32(entry[5]) * 20; | 139 | perflvl->memory = ROM32(entry[5]) * 20; |
140 | break; | 140 | break; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index a33fe4019286..4bce801bc588 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
@@ -55,6 +55,7 @@ nouveau_sgdma_populate(struct ttm_backend *be, unsigned long num_pages, | |||
55 | be->func->clear(be); | 55 | be->func->clear(be); |
56 | return -EFAULT; | 56 | return -EFAULT; |
57 | } | 57 | } |
58 | nvbe->ttm_alloced[nvbe->nr_pages] = false; | ||
58 | } | 59 | } |
59 | 60 | ||
60 | nvbe->nr_pages++; | 61 | nvbe->nr_pages++; |
@@ -427,7 +428,7 @@ nouveau_sgdma_init(struct drm_device *dev) | |||
427 | u32 aper_size, align; | 428 | u32 aper_size, align; |
428 | int ret; | 429 | int ret; |
429 | 430 | ||
430 | if (dev_priv->card_type >= NV_50 || drm_pci_device_is_pcie(dev)) | 431 | if (dev_priv->card_type >= NV_40 && drm_pci_device_is_pcie(dev)) |
431 | aper_size = 512 * 1024 * 1024; | 432 | aper_size = 512 * 1024 * 1024; |
432 | else | 433 | else |
433 | aper_size = 64 * 1024 * 1024; | 434 | aper_size = 64 * 1024 * 1024; |
@@ -457,7 +458,7 @@ nouveau_sgdma_init(struct drm_device *dev) | |||
457 | dev_priv->gart_info.func = &nv50_sgdma_backend; | 458 | dev_priv->gart_info.func = &nv50_sgdma_backend; |
458 | } else | 459 | } else |
459 | if (drm_pci_device_is_pcie(dev) && | 460 | if (drm_pci_device_is_pcie(dev) && |
460 | dev_priv->chipset != 0x40 && dev_priv->chipset != 0x45) { | 461 | dev_priv->chipset > 0x40 && dev_priv->chipset != 0x45) { |
461 | if (nv44_graph_class(dev)) { | 462 | if (nv44_graph_class(dev)) { |
462 | dev_priv->gart_info.func = &nv44_sgdma_backend; | 463 | dev_priv->gart_info.func = &nv44_sgdma_backend; |
463 | align = 512 * 1024; | 464 | align = 512 * 1024; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 5bb2859001e2..a30adec5beaa 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -376,15 +376,11 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
376 | engine->graph.destroy_context = nv50_graph_destroy_context; | 376 | engine->graph.destroy_context = nv50_graph_destroy_context; |
377 | engine->graph.load_context = nv50_graph_load_context; | 377 | engine->graph.load_context = nv50_graph_load_context; |
378 | engine->graph.unload_context = nv50_graph_unload_context; | 378 | engine->graph.unload_context = nv50_graph_unload_context; |
379 | if (dev_priv->chipset != 0x86) | 379 | if (dev_priv->chipset == 0x50 || |
380 | dev_priv->chipset == 0xac) | ||
380 | engine->graph.tlb_flush = nv50_graph_tlb_flush; | 381 | engine->graph.tlb_flush = nv50_graph_tlb_flush; |
381 | else { | 382 | else |
382 | /* from what i can see nvidia do this on every | 383 | engine->graph.tlb_flush = nv84_graph_tlb_flush; |
383 | * pre-NVA3 board except NVAC, but, we've only | ||
384 | * ever seen problems on NV86 | ||
385 | */ | ||
386 | engine->graph.tlb_flush = nv86_graph_tlb_flush; | ||
387 | } | ||
388 | engine->fifo.channels = 128; | 384 | engine->fifo.channels = 128; |
389 | engine->fifo.init = nv50_fifo_init; | 385 | engine->fifo.init = nv50_fifo_init; |
390 | engine->fifo.takedown = nv50_fifo_takedown; | 386 | engine->fifo.takedown = nv50_fifo_takedown; |
@@ -612,6 +608,7 @@ nouveau_card_init(struct drm_device *dev) | |||
612 | spin_lock_init(&dev_priv->channels.lock); | 608 | spin_lock_init(&dev_priv->channels.lock); |
613 | spin_lock_init(&dev_priv->tile.lock); | 609 | spin_lock_init(&dev_priv->tile.lock); |
614 | spin_lock_init(&dev_priv->context_switch_lock); | 610 | spin_lock_init(&dev_priv->context_switch_lock); |
611 | spin_lock_init(&dev_priv->vm_lock); | ||
615 | 612 | ||
616 | /* Make the CRTCs and I2C buses accessible */ | 613 | /* Make the CRTCs and I2C buses accessible */ |
617 | ret = engine->display.early_init(dev); | 614 | ret = engine->display.early_init(dev); |
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index c82db37d9f41..12098bf839c4 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | |||
@@ -581,12 +581,13 @@ static void nv04_dfp_restore(struct drm_encoder *encoder) | |||
581 | int head = nv_encoder->restore.head; | 581 | int head = nv_encoder->restore.head; |
582 | 582 | ||
583 | if (nv_encoder->dcb->type == OUTPUT_LVDS) { | 583 | if (nv_encoder->dcb->type == OUTPUT_LVDS) { |
584 | struct drm_display_mode *native_mode = nouveau_encoder_connector_get(nv_encoder)->native_mode; | 584 | struct nouveau_connector *connector = |
585 | if (native_mode) | 585 | nouveau_encoder_connector_get(nv_encoder); |
586 | call_lvds_script(dev, nv_encoder->dcb, head, LVDS_PANEL_ON, | 586 | |
587 | native_mode->clock); | 587 | if (connector && connector->native_mode) |
588 | else | 588 | call_lvds_script(dev, nv_encoder->dcb, head, |
589 | NV_ERROR(dev, "Not restoring LVDS without native mode\n"); | 589 | LVDS_PANEL_ON, |
590 | connector->native_mode->clock); | ||
590 | 591 | ||
591 | } else if (nv_encoder->dcb->type == OUTPUT_TMDS) { | 592 | } else if (nv_encoder->dcb->type == OUTPUT_TMDS) { |
592 | int clock = nouveau_hw_pllvals_to_clk | 593 | int clock = nouveau_hw_pllvals_to_clk |
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index 2b9984027f41..a19ccaa025b3 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
@@ -469,9 +469,6 @@ nv50_crtc_wait_complete(struct drm_crtc *crtc) | |||
469 | 469 | ||
470 | start = ptimer->read(dev); | 470 | start = ptimer->read(dev); |
471 | do { | 471 | do { |
472 | nv_wr32(dev, 0x61002c, 0x370); | ||
473 | nv_wr32(dev, 0x000140, 1); | ||
474 | |||
475 | if (nv_ro32(disp->ntfy, 0x000)) | 472 | if (nv_ro32(disp->ntfy, 0x000)) |
476 | return 0; | 473 | return 0; |
477 | } while (ptimer->read(dev) - start < 2000000000ULL); | 474 | } while (ptimer->read(dev) - start < 2000000000ULL); |
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.c b/drivers/gpu/drm/nouveau/nv50_evo.c index a2cfaa691e9b..c8e83c1a4de8 100644 --- a/drivers/gpu/drm/nouveau/nv50_evo.c +++ b/drivers/gpu/drm/nouveau/nv50_evo.c | |||
@@ -186,6 +186,7 @@ nv50_evo_channel_init(struct nouveau_channel *evo) | |||
186 | nv_mask(dev, 0x610028, 0x00000000, 0x00010001 << id); | 186 | nv_mask(dev, 0x610028, 0x00000000, 0x00010001 << id); |
187 | 187 | ||
188 | evo->dma.max = (4096/4) - 2; | 188 | evo->dma.max = (4096/4) - 2; |
189 | evo->dma.max &= ~7; | ||
189 | evo->dma.put = 0; | 190 | evo->dma.put = 0; |
190 | evo->dma.cur = evo->dma.put; | 191 | evo->dma.cur = evo->dma.put; |
191 | evo->dma.free = evo->dma.max - evo->dma.cur; | 192 | evo->dma.free = evo->dma.max - evo->dma.cur; |
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c index 8675b00caf18..b02a5b1e7d37 100644 --- a/drivers/gpu/drm/nouveau/nv50_graph.c +++ b/drivers/gpu/drm/nouveau/nv50_graph.c | |||
@@ -503,7 +503,7 @@ nv50_graph_tlb_flush(struct drm_device *dev) | |||
503 | } | 503 | } |
504 | 504 | ||
505 | void | 505 | void |
506 | nv86_graph_tlb_flush(struct drm_device *dev) | 506 | nv84_graph_tlb_flush(struct drm_device *dev) |
507 | { | 507 | { |
508 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 508 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
509 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; | 509 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; |
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv50_instmem.c index a6f8aa651fc6..4f95a1e5822e 100644 --- a/drivers/gpu/drm/nouveau/nv50_instmem.c +++ b/drivers/gpu/drm/nouveau/nv50_instmem.c | |||
@@ -404,23 +404,25 @@ void | |||
404 | nv50_instmem_flush(struct drm_device *dev) | 404 | nv50_instmem_flush(struct drm_device *dev) |
405 | { | 405 | { |
406 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 406 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
407 | unsigned long flags; | ||
407 | 408 | ||
408 | spin_lock(&dev_priv->ramin_lock); | 409 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
409 | nv_wr32(dev, 0x00330c, 0x00000001); | 410 | nv_wr32(dev, 0x00330c, 0x00000001); |
410 | if (!nv_wait(dev, 0x00330c, 0x00000002, 0x00000000)) | 411 | if (!nv_wait(dev, 0x00330c, 0x00000002, 0x00000000)) |
411 | NV_ERROR(dev, "PRAMIN flush timeout\n"); | 412 | NV_ERROR(dev, "PRAMIN flush timeout\n"); |
412 | spin_unlock(&dev_priv->ramin_lock); | 413 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
413 | } | 414 | } |
414 | 415 | ||
415 | void | 416 | void |
416 | nv84_instmem_flush(struct drm_device *dev) | 417 | nv84_instmem_flush(struct drm_device *dev) |
417 | { | 418 | { |
418 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 419 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
420 | unsigned long flags; | ||
419 | 421 | ||
420 | spin_lock(&dev_priv->ramin_lock); | 422 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
421 | nv_wr32(dev, 0x070000, 0x00000001); | 423 | nv_wr32(dev, 0x070000, 0x00000001); |
422 | if (!nv_wait(dev, 0x070000, 0x00000002, 0x00000000)) | 424 | if (!nv_wait(dev, 0x070000, 0x00000002, 0x00000000)) |
423 | NV_ERROR(dev, "PRAMIN flush timeout\n"); | 425 | NV_ERROR(dev, "PRAMIN flush timeout\n"); |
424 | spin_unlock(&dev_priv->ramin_lock); | 426 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
425 | } | 427 | } |
426 | 428 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_vm.c b/drivers/gpu/drm/nouveau/nv50_vm.c index 4fd3432b5b8d..6c2694490741 100644 --- a/drivers/gpu/drm/nouveau/nv50_vm.c +++ b/drivers/gpu/drm/nouveau/nv50_vm.c | |||
@@ -174,10 +174,11 @@ void | |||
174 | nv50_vm_flush_engine(struct drm_device *dev, int engine) | 174 | nv50_vm_flush_engine(struct drm_device *dev, int engine) |
175 | { | 175 | { |
176 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 176 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
177 | unsigned long flags; | ||
177 | 178 | ||
178 | spin_lock(&dev_priv->ramin_lock); | 179 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
179 | nv_wr32(dev, 0x100c80, (engine << 16) | 1); | 180 | nv_wr32(dev, 0x100c80, (engine << 16) | 1); |
180 | if (!nv_wait(dev, 0x100c80, 0x00000001, 0x00000000)) | 181 | if (!nv_wait(dev, 0x100c80, 0x00000001, 0x00000000)) |
181 | NV_ERROR(dev, "vm flush timeout: engine %d\n", engine); | 182 | NV_ERROR(dev, "vm flush timeout: engine %d\n", engine); |
182 | spin_unlock(&dev_priv->ramin_lock); | 183 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
183 | } | 184 | } |
diff --git a/drivers/gpu/drm/nouveau/nvc0_vm.c b/drivers/gpu/drm/nouveau/nvc0_vm.c index 69af0ba7edd3..a179e6c55afb 100644 --- a/drivers/gpu/drm/nouveau/nvc0_vm.c +++ b/drivers/gpu/drm/nouveau/nvc0_vm.c | |||
@@ -104,20 +104,27 @@ nvc0_vm_flush(struct nouveau_vm *vm) | |||
104 | struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem; | 104 | struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem; |
105 | struct drm_device *dev = vm->dev; | 105 | struct drm_device *dev = vm->dev; |
106 | struct nouveau_vm_pgd *vpgd; | 106 | struct nouveau_vm_pgd *vpgd; |
107 | u32 r100c80, engine; | 107 | unsigned long flags; |
108 | u32 engine = (dev_priv->chan_vm == vm) ? 1 : 5; | ||
108 | 109 | ||
109 | pinstmem->flush(vm->dev); | 110 | pinstmem->flush(vm->dev); |
110 | 111 | ||
111 | if (vm == dev_priv->chan_vm) | 112 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
112 | engine = 1; | ||
113 | else | ||
114 | engine = 5; | ||
115 | |||
116 | list_for_each_entry(vpgd, &vm->pgd_list, head) { | 113 | list_for_each_entry(vpgd, &vm->pgd_list, head) { |
117 | r100c80 = nv_rd32(dev, 0x100c80); | 114 | /* looks like maybe a "free flush slots" counter, the |
115 | * faster you write to 0x100cbc to more it decreases | ||
116 | */ | ||
117 | if (!nv_wait_ne(dev, 0x100c80, 0x00ff0000, 0x00000000)) { | ||
118 | NV_ERROR(dev, "vm timeout 0: 0x%08x %d\n", | ||
119 | nv_rd32(dev, 0x100c80), engine); | ||
120 | } | ||
118 | nv_wr32(dev, 0x100cb8, vpgd->obj->vinst >> 8); | 121 | nv_wr32(dev, 0x100cb8, vpgd->obj->vinst >> 8); |
119 | nv_wr32(dev, 0x100cbc, 0x80000000 | engine); | 122 | nv_wr32(dev, 0x100cbc, 0x80000000 | engine); |
120 | if (!nv_wait(dev, 0x100c80, 0xffffffff, r100c80)) | 123 | /* wait for flush to be queued? */ |
121 | NV_ERROR(dev, "vm flush timeout eng %d\n", engine); | 124 | if (!nv_wait(dev, 0x100c80, 0x00008000, 0x00008000)) { |
125 | NV_ERROR(dev, "vm timeout 1: 0x%08x %d\n", | ||
126 | nv_rd32(dev, 0x100c80), engine); | ||
127 | } | ||
122 | } | 128 | } |
129 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); | ||
123 | } | 130 | } |
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index 258fa5e7a2d9..7bd745689097 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "atom.h" | 32 | #include "atom.h" |
33 | #include "atom-names.h" | 33 | #include "atom-names.h" |
34 | #include "atom-bits.h" | 34 | #include "atom-bits.h" |
35 | #include "radeon.h" | ||
35 | 36 | ||
36 | #define ATOM_COND_ABOVE 0 | 37 | #define ATOM_COND_ABOVE 0 |
37 | #define ATOM_COND_ABOVEOREQUAL 1 | 38 | #define ATOM_COND_ABOVEOREQUAL 1 |
@@ -101,7 +102,9 @@ static void debug_print_spaces(int n) | |||
101 | static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | 102 | static uint32_t atom_iio_execute(struct atom_context *ctx, int base, |
102 | uint32_t index, uint32_t data) | 103 | uint32_t index, uint32_t data) |
103 | { | 104 | { |
105 | struct radeon_device *rdev = ctx->card->dev->dev_private; | ||
104 | uint32_t temp = 0xCDCDCDCD; | 106 | uint32_t temp = 0xCDCDCDCD; |
107 | |||
105 | while (1) | 108 | while (1) |
106 | switch (CU8(base)) { | 109 | switch (CU8(base)) { |
107 | case ATOM_IIO_NOP: | 110 | case ATOM_IIO_NOP: |
@@ -112,7 +115,8 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | |||
112 | base += 3; | 115 | base += 3; |
113 | break; | 116 | break; |
114 | case ATOM_IIO_WRITE: | 117 | case ATOM_IIO_WRITE: |
115 | (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1)); | 118 | if (rdev->family == CHIP_RV515) |
119 | (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1)); | ||
116 | ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); | 120 | ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); |
117 | base += 3; | 121 | base += 3; |
118 | break; | 122 | break; |
@@ -131,7 +135,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | |||
131 | case ATOM_IIO_MOVE_INDEX: | 135 | case ATOM_IIO_MOVE_INDEX: |
132 | temp &= | 136 | temp &= |
133 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << | 137 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << |
134 | CU8(base + 2)); | 138 | CU8(base + 3)); |
135 | temp |= | 139 | temp |= |
136 | ((index >> CU8(base + 2)) & | 140 | ((index >> CU8(base + 2)) & |
137 | (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + | 141 | (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + |
@@ -141,7 +145,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | |||
141 | case ATOM_IIO_MOVE_DATA: | 145 | case ATOM_IIO_MOVE_DATA: |
142 | temp &= | 146 | temp &= |
143 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << | 147 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << |
144 | CU8(base + 2)); | 148 | CU8(base + 3)); |
145 | temp |= | 149 | temp |= |
146 | ((data >> CU8(base + 2)) & | 150 | ((data >> CU8(base + 2)) & |
147 | (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + | 151 | (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + |
@@ -151,7 +155,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | |||
151 | case ATOM_IIO_MOVE_ATTR: | 155 | case ATOM_IIO_MOVE_ATTR: |
152 | temp &= | 156 | temp &= |
153 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << | 157 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << |
154 | CU8(base + 2)); | 158 | CU8(base + 3)); |
155 | temp |= | 159 | temp |= |
156 | ((ctx-> | 160 | ((ctx-> |
157 | io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - | 161 | io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index b41ec59c7100..529a3a704731 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -531,6 +531,9 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
531 | pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; | 531 | pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; |
532 | else | 532 | else |
533 | pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV; | 533 | pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV; |
534 | |||
535 | if (rdev->family < CHIP_RV770) | ||
536 | pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; | ||
534 | } else { | 537 | } else { |
535 | pll->flags |= RADEON_PLL_LEGACY; | 538 | pll->flags |= RADEON_PLL_LEGACY; |
536 | 539 | ||
@@ -559,7 +562,6 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
559 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 562 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
560 | if (ss_enabled) { | 563 | if (ss_enabled) { |
561 | if (ss->refdiv) { | 564 | if (ss->refdiv) { |
562 | pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; | ||
563 | pll->flags |= RADEON_PLL_USE_REF_DIV; | 565 | pll->flags |= RADEON_PLL_USE_REF_DIV; |
564 | pll->reference_div = ss->refdiv; | 566 | pll->reference_div = ss->refdiv; |
565 | if (ASIC_IS_AVIVO(rdev)) | 567 | if (ASIC_IS_AVIVO(rdev)) |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 0b0cc74c08c0..e9bc135d9189 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -120,11 +120,16 @@ void evergreen_pm_misc(struct radeon_device *rdev) | |||
120 | struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx]; | 120 | struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx]; |
121 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; | 121 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; |
122 | 122 | ||
123 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { | 123 | if (voltage->type == VOLTAGE_SW) { |
124 | if (voltage->voltage != rdev->pm.current_vddc) { | 124 | if (voltage->voltage && (voltage->voltage != rdev->pm.current_vddc)) { |
125 | radeon_atom_set_voltage(rdev, voltage->voltage); | 125 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); |
126 | rdev->pm.current_vddc = voltage->voltage; | 126 | rdev->pm.current_vddc = voltage->voltage; |
127 | DRM_DEBUG("Setting: v: %d\n", voltage->voltage); | 127 | DRM_DEBUG("Setting: vddc: %d\n", voltage->voltage); |
128 | } | ||
129 | if (voltage->vddci && (voltage->vddci != rdev->pm.current_vddci)) { | ||
130 | radeon_atom_set_voltage(rdev, voltage->vddci, SET_VOLTAGE_TYPE_ASIC_VDDCI); | ||
131 | rdev->pm.current_vddci = voltage->vddci; | ||
132 | DRM_DEBUG("Setting: vddci: %d\n", voltage->vddci); | ||
128 | } | 133 | } |
129 | } | 134 | } |
130 | } | 135 | } |
@@ -348,7 +353,7 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev, | |||
348 | struct drm_display_mode *mode, | 353 | struct drm_display_mode *mode, |
349 | struct drm_display_mode *other_mode) | 354 | struct drm_display_mode *other_mode) |
350 | { | 355 | { |
351 | u32 tmp = 0; | 356 | u32 tmp; |
352 | /* | 357 | /* |
353 | * Line Buffer Setup | 358 | * Line Buffer Setup |
354 | * There are 3 line buffers, each one shared by 2 display controllers. | 359 | * There are 3 line buffers, each one shared by 2 display controllers. |
@@ -358,64 +363,63 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev, | |||
358 | * first display controller | 363 | * first display controller |
359 | * 0 - first half of lb (3840 * 2) | 364 | * 0 - first half of lb (3840 * 2) |
360 | * 1 - first 3/4 of lb (5760 * 2) | 365 | * 1 - first 3/4 of lb (5760 * 2) |
361 | * 2 - whole lb (7680 * 2) | 366 | * 2 - whole lb (7680 * 2), other crtc must be disabled |
362 | * 3 - first 1/4 of lb (1920 * 2) | 367 | * 3 - first 1/4 of lb (1920 * 2) |
363 | * second display controller | 368 | * second display controller |
364 | * 4 - second half of lb (3840 * 2) | 369 | * 4 - second half of lb (3840 * 2) |
365 | * 5 - second 3/4 of lb (5760 * 2) | 370 | * 5 - second 3/4 of lb (5760 * 2) |
366 | * 6 - whole lb (7680 * 2) | 371 | * 6 - whole lb (7680 * 2), other crtc must be disabled |
367 | * 7 - last 1/4 of lb (1920 * 2) | 372 | * 7 - last 1/4 of lb (1920 * 2) |
368 | */ | 373 | */ |
369 | if (mode && other_mode) { | 374 | /* this can get tricky if we have two large displays on a paired group |
370 | if (mode->hdisplay > other_mode->hdisplay) { | 375 | * of crtcs. Ideally for multiple large displays we'd assign them to |
371 | if (mode->hdisplay > 2560) | 376 | * non-linked crtcs for maximum line buffer allocation. |
372 | tmp = 1; /* 3/4 */ | 377 | */ |
373 | else | 378 | if (radeon_crtc->base.enabled && mode) { |
374 | tmp = 0; /* 1/2 */ | 379 | if (other_mode) |
375 | } else if (other_mode->hdisplay > mode->hdisplay) { | ||
376 | if (other_mode->hdisplay > 2560) | ||
377 | tmp = 3; /* 1/4 */ | ||
378 | else | ||
379 | tmp = 0; /* 1/2 */ | ||
380 | } else | ||
381 | tmp = 0; /* 1/2 */ | 380 | tmp = 0; /* 1/2 */ |
382 | } else if (mode) | 381 | else |
383 | tmp = 2; /* whole */ | 382 | tmp = 2; /* whole */ |
384 | else if (other_mode) | 383 | } else |
385 | tmp = 3; /* 1/4 */ | 384 | tmp = 0; |
386 | 385 | ||
387 | /* second controller of the pair uses second half of the lb */ | 386 | /* second controller of the pair uses second half of the lb */ |
388 | if (radeon_crtc->crtc_id % 2) | 387 | if (radeon_crtc->crtc_id % 2) |
389 | tmp += 4; | 388 | tmp += 4; |
390 | WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp); | 389 | WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp); |
391 | 390 | ||
392 | switch (tmp) { | 391 | if (radeon_crtc->base.enabled && mode) { |
393 | case 0: | 392 | switch (tmp) { |
394 | case 4: | 393 | case 0: |
395 | default: | 394 | case 4: |
396 | if (ASIC_IS_DCE5(rdev)) | 395 | default: |
397 | return 4096 * 2; | 396 | if (ASIC_IS_DCE5(rdev)) |
398 | else | 397 | return 4096 * 2; |
399 | return 3840 * 2; | 398 | else |
400 | case 1: | 399 | return 3840 * 2; |
401 | case 5: | 400 | case 1: |
402 | if (ASIC_IS_DCE5(rdev)) | 401 | case 5: |
403 | return 6144 * 2; | 402 | if (ASIC_IS_DCE5(rdev)) |
404 | else | 403 | return 6144 * 2; |
405 | return 5760 * 2; | 404 | else |
406 | case 2: | 405 | return 5760 * 2; |
407 | case 6: | 406 | case 2: |
408 | if (ASIC_IS_DCE5(rdev)) | 407 | case 6: |
409 | return 8192 * 2; | 408 | if (ASIC_IS_DCE5(rdev)) |
410 | else | 409 | return 8192 * 2; |
411 | return 7680 * 2; | 410 | else |
412 | case 3: | 411 | return 7680 * 2; |
413 | case 7: | 412 | case 3: |
414 | if (ASIC_IS_DCE5(rdev)) | 413 | case 7: |
415 | return 2048 * 2; | 414 | if (ASIC_IS_DCE5(rdev)) |
416 | else | 415 | return 2048 * 2; |
417 | return 1920 * 2; | 416 | else |
417 | return 1920 * 2; | ||
418 | } | ||
418 | } | 419 | } |
420 | |||
421 | /* controller not enabled, so no lb used */ | ||
422 | return 0; | ||
419 | } | 423 | } |
420 | 424 | ||
421 | static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev) | 425 | static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev) |
@@ -2576,7 +2580,7 @@ static inline u32 evergreen_get_ih_wptr(struct radeon_device *rdev) | |||
2576 | u32 wptr, tmp; | 2580 | u32 wptr, tmp; |
2577 | 2581 | ||
2578 | if (rdev->wb.enabled) | 2582 | if (rdev->wb.enabled) |
2579 | wptr = rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]; | 2583 | wptr = le32_to_cpu(rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]); |
2580 | else | 2584 | else |
2581 | wptr = RREG32(IH_RB_WPTR); | 2585 | wptr = RREG32(IH_RB_WPTR); |
2582 | 2586 | ||
@@ -3036,9 +3040,6 @@ int evergreen_init(struct radeon_device *rdev) | |||
3036 | { | 3040 | { |
3037 | int r; | 3041 | int r; |
3038 | 3042 | ||
3039 | r = radeon_dummy_page_init(rdev); | ||
3040 | if (r) | ||
3041 | return r; | ||
3042 | /* This don't do much */ | 3043 | /* This don't do much */ |
3043 | r = radeon_gem_init(rdev); | 3044 | r = radeon_gem_init(rdev); |
3044 | if (r) | 3045 | if (r) |
@@ -3150,7 +3151,6 @@ void evergreen_fini(struct radeon_device *rdev) | |||
3150 | radeon_atombios_fini(rdev); | 3151 | radeon_atombios_fini(rdev); |
3151 | kfree(rdev->bios); | 3152 | kfree(rdev->bios); |
3152 | rdev->bios = NULL; | 3153 | rdev->bios = NULL; |
3153 | radeon_dummy_page_fini(rdev); | ||
3154 | } | 3154 | } |
3155 | 3155 | ||
3156 | static void evergreen_pcie_gen2_enable(struct radeon_device *rdev) | 3156 | static void evergreen_pcie_gen2_enable(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index be271c42de4d..6f27593901c7 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -587,7 +587,7 @@ void r600_pm_misc(struct radeon_device *rdev) | |||
587 | 587 | ||
588 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { | 588 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { |
589 | if (voltage->voltage != rdev->pm.current_vddc) { | 589 | if (voltage->voltage != rdev->pm.current_vddc) { |
590 | radeon_atom_set_voltage(rdev, voltage->voltage); | 590 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); |
591 | rdev->pm.current_vddc = voltage->voltage; | 591 | rdev->pm.current_vddc = voltage->voltage; |
592 | DRM_DEBUG_DRIVER("Setting: v: %d\n", voltage->voltage); | 592 | DRM_DEBUG_DRIVER("Setting: v: %d\n", voltage->voltage); |
593 | } | 593 | } |
@@ -2509,9 +2509,6 @@ int r600_init(struct radeon_device *rdev) | |||
2509 | { | 2509 | { |
2510 | int r; | 2510 | int r; |
2511 | 2511 | ||
2512 | r = radeon_dummy_page_init(rdev); | ||
2513 | if (r) | ||
2514 | return r; | ||
2515 | if (r600_debugfs_mc_info_init(rdev)) { | 2512 | if (r600_debugfs_mc_info_init(rdev)) { |
2516 | DRM_ERROR("Failed to register debugfs file for mc !\n"); | 2513 | DRM_ERROR("Failed to register debugfs file for mc !\n"); |
2517 | } | 2514 | } |
@@ -2625,7 +2622,6 @@ void r600_fini(struct radeon_device *rdev) | |||
2625 | radeon_atombios_fini(rdev); | 2622 | radeon_atombios_fini(rdev); |
2626 | kfree(rdev->bios); | 2623 | kfree(rdev->bios); |
2627 | rdev->bios = NULL; | 2624 | rdev->bios = NULL; |
2628 | radeon_dummy_page_fini(rdev); | ||
2629 | } | 2625 | } |
2630 | 2626 | ||
2631 | 2627 | ||
@@ -3235,7 +3231,7 @@ static inline u32 r600_get_ih_wptr(struct radeon_device *rdev) | |||
3235 | u32 wptr, tmp; | 3231 | u32 wptr, tmp; |
3236 | 3232 | ||
3237 | if (rdev->wb.enabled) | 3233 | if (rdev->wb.enabled) |
3238 | wptr = rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]; | 3234 | wptr = le32_to_cpu(rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]); |
3239 | else | 3235 | else |
3240 | wptr = RREG32(IH_RB_WPTR); | 3236 | wptr = RREG32(IH_RB_WPTR); |
3241 | 3237 | ||
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 93f536594c73..ba643b576054 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -177,7 +177,7 @@ void radeon_pm_suspend(struct radeon_device *rdev); | |||
177 | void radeon_pm_resume(struct radeon_device *rdev); | 177 | void radeon_pm_resume(struct radeon_device *rdev); |
178 | void radeon_combios_get_power_modes(struct radeon_device *rdev); | 178 | void radeon_combios_get_power_modes(struct radeon_device *rdev); |
179 | void radeon_atombios_get_power_modes(struct radeon_device *rdev); | 179 | void radeon_atombios_get_power_modes(struct radeon_device *rdev); |
180 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level); | 180 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 voltage_level, u8 voltage_type); |
181 | void rs690_pm_info(struct radeon_device *rdev); | 181 | void rs690_pm_info(struct radeon_device *rdev); |
182 | extern int rv6xx_get_temp(struct radeon_device *rdev); | 182 | extern int rv6xx_get_temp(struct radeon_device *rdev); |
183 | extern int rv770_get_temp(struct radeon_device *rdev); | 183 | extern int rv770_get_temp(struct radeon_device *rdev); |
@@ -767,7 +767,9 @@ struct radeon_voltage { | |||
767 | u8 vddci_id; /* index into vddci voltage table */ | 767 | u8 vddci_id; /* index into vddci voltage table */ |
768 | bool vddci_enabled; | 768 | bool vddci_enabled; |
769 | /* r6xx+ sw */ | 769 | /* r6xx+ sw */ |
770 | u32 voltage; | 770 | u16 voltage; |
771 | /* evergreen+ vddci */ | ||
772 | u16 vddci; | ||
771 | }; | 773 | }; |
772 | 774 | ||
773 | /* clock mode flags */ | 775 | /* clock mode flags */ |
@@ -835,10 +837,12 @@ struct radeon_pm { | |||
835 | int default_power_state_index; | 837 | int default_power_state_index; |
836 | u32 current_sclk; | 838 | u32 current_sclk; |
837 | u32 current_mclk; | 839 | u32 current_mclk; |
838 | u32 current_vddc; | 840 | u16 current_vddc; |
841 | u16 current_vddci; | ||
839 | u32 default_sclk; | 842 | u32 default_sclk; |
840 | u32 default_mclk; | 843 | u32 default_mclk; |
841 | u32 default_vddc; | 844 | u16 default_vddc; |
845 | u16 default_vddci; | ||
842 | struct radeon_i2c_chan *i2c_bus; | 846 | struct radeon_i2c_chan *i2c_bus; |
843 | /* selected pm method */ | 847 | /* selected pm method */ |
844 | enum radeon_pm_method pm_method; | 848 | enum radeon_pm_method pm_method; |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index eb888ee5f674..ca576191d058 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -94,7 +94,7 @@ static void radeon_register_accessor_init(struct radeon_device *rdev) | |||
94 | rdev->mc_rreg = &rs600_mc_rreg; | 94 | rdev->mc_rreg = &rs600_mc_rreg; |
95 | rdev->mc_wreg = &rs600_mc_wreg; | 95 | rdev->mc_wreg = &rs600_mc_wreg; |
96 | } | 96 | } |
97 | if ((rdev->family >= CHIP_R600) && (rdev->family <= CHIP_HEMLOCK)) { | 97 | if (rdev->family >= CHIP_R600) { |
98 | rdev->pciep_rreg = &r600_pciep_rreg; | 98 | rdev->pciep_rreg = &r600_pciep_rreg; |
99 | rdev->pciep_wreg = &r600_pciep_wreg; | 99 | rdev->pciep_wreg = &r600_pciep_wreg; |
100 | } | 100 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 99768d9d91da..f5d12fb103fa 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -2176,24 +2176,27 @@ static void radeon_atombios_add_pplib_thermal_controller(struct radeon_device *r | |||
2176 | } | 2176 | } |
2177 | } | 2177 | } |
2178 | 2178 | ||
2179 | static u16 radeon_atombios_get_default_vddc(struct radeon_device *rdev) | 2179 | static void radeon_atombios_get_default_voltages(struct radeon_device *rdev, |
2180 | u16 *vddc, u16 *vddci) | ||
2180 | { | 2181 | { |
2181 | struct radeon_mode_info *mode_info = &rdev->mode_info; | 2182 | struct radeon_mode_info *mode_info = &rdev->mode_info; |
2182 | int index = GetIndexIntoMasterTable(DATA, FirmwareInfo); | 2183 | int index = GetIndexIntoMasterTable(DATA, FirmwareInfo); |
2183 | u8 frev, crev; | 2184 | u8 frev, crev; |
2184 | u16 data_offset; | 2185 | u16 data_offset; |
2185 | union firmware_info *firmware_info; | 2186 | union firmware_info *firmware_info; |
2186 | u16 vddc = 0; | 2187 | |
2188 | *vddc = 0; | ||
2189 | *vddci = 0; | ||
2187 | 2190 | ||
2188 | if (atom_parse_data_header(mode_info->atom_context, index, NULL, | 2191 | if (atom_parse_data_header(mode_info->atom_context, index, NULL, |
2189 | &frev, &crev, &data_offset)) { | 2192 | &frev, &crev, &data_offset)) { |
2190 | firmware_info = | 2193 | firmware_info = |
2191 | (union firmware_info *)(mode_info->atom_context->bios + | 2194 | (union firmware_info *)(mode_info->atom_context->bios + |
2192 | data_offset); | 2195 | data_offset); |
2193 | vddc = le16_to_cpu(firmware_info->info_14.usBootUpVDDCVoltage); | 2196 | *vddc = le16_to_cpu(firmware_info->info_14.usBootUpVDDCVoltage); |
2197 | if ((frev == 2) && (crev >= 2)) | ||
2198 | *vddci = le16_to_cpu(firmware_info->info_22.usBootUpVDDCIVoltage); | ||
2194 | } | 2199 | } |
2195 | |||
2196 | return vddc; | ||
2197 | } | 2200 | } |
2198 | 2201 | ||
2199 | static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rdev, | 2202 | static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rdev, |
@@ -2203,7 +2206,9 @@ static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rde | |||
2203 | int j; | 2206 | int j; |
2204 | u32 misc = le32_to_cpu(non_clock_info->ulCapsAndSettings); | 2207 | u32 misc = le32_to_cpu(non_clock_info->ulCapsAndSettings); |
2205 | u32 misc2 = le16_to_cpu(non_clock_info->usClassification); | 2208 | u32 misc2 = le16_to_cpu(non_clock_info->usClassification); |
2206 | u16 vddc = radeon_atombios_get_default_vddc(rdev); | 2209 | u16 vddc, vddci; |
2210 | |||
2211 | radeon_atombios_get_default_voltages(rdev, &vddc, &vddci); | ||
2207 | 2212 | ||
2208 | rdev->pm.power_state[state_index].misc = misc; | 2213 | rdev->pm.power_state[state_index].misc = misc; |
2209 | rdev->pm.power_state[state_index].misc2 = misc2; | 2214 | rdev->pm.power_state[state_index].misc2 = misc2; |
@@ -2244,6 +2249,7 @@ static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rde | |||
2244 | rdev->pm.default_sclk = rdev->pm.power_state[state_index].clock_info[0].sclk; | 2249 | rdev->pm.default_sclk = rdev->pm.power_state[state_index].clock_info[0].sclk; |
2245 | rdev->pm.default_mclk = rdev->pm.power_state[state_index].clock_info[0].mclk; | 2250 | rdev->pm.default_mclk = rdev->pm.power_state[state_index].clock_info[0].mclk; |
2246 | rdev->pm.default_vddc = rdev->pm.power_state[state_index].clock_info[0].voltage.voltage; | 2251 | rdev->pm.default_vddc = rdev->pm.power_state[state_index].clock_info[0].voltage.voltage; |
2252 | rdev->pm.default_vddci = rdev->pm.power_state[state_index].clock_info[0].voltage.vddci; | ||
2247 | } else { | 2253 | } else { |
2248 | /* patch the table values with the default slck/mclk from firmware info */ | 2254 | /* patch the table values with the default slck/mclk from firmware info */ |
2249 | for (j = 0; j < mode_index; j++) { | 2255 | for (j = 0; j < mode_index; j++) { |
@@ -2286,6 +2292,8 @@ static bool radeon_atombios_parse_pplib_clock_info(struct radeon_device *rdev, | |||
2286 | VOLTAGE_SW; | 2292 | VOLTAGE_SW; |
2287 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = | 2293 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = |
2288 | le16_to_cpu(clock_info->evergreen.usVDDC); | 2294 | le16_to_cpu(clock_info->evergreen.usVDDC); |
2295 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.vddci = | ||
2296 | le16_to_cpu(clock_info->evergreen.usVDDCI); | ||
2289 | } else { | 2297 | } else { |
2290 | sclk = le16_to_cpu(clock_info->r600.usEngineClockLow); | 2298 | sclk = le16_to_cpu(clock_info->r600.usEngineClockLow); |
2291 | sclk |= clock_info->r600.ucEngineClockHigh << 16; | 2299 | sclk |= clock_info->r600.ucEngineClockHigh << 16; |
@@ -2577,25 +2585,25 @@ union set_voltage { | |||
2577 | struct _SET_VOLTAGE_PARAMETERS_V2 v2; | 2585 | struct _SET_VOLTAGE_PARAMETERS_V2 v2; |
2578 | }; | 2586 | }; |
2579 | 2587 | ||
2580 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level) | 2588 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 voltage_level, u8 voltage_type) |
2581 | { | 2589 | { |
2582 | union set_voltage args; | 2590 | union set_voltage args; |
2583 | int index = GetIndexIntoMasterTable(COMMAND, SetVoltage); | 2591 | int index = GetIndexIntoMasterTable(COMMAND, SetVoltage); |
2584 | u8 frev, crev, volt_index = level; | 2592 | u8 frev, crev, volt_index = voltage_level; |
2585 | 2593 | ||
2586 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) | 2594 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) |
2587 | return; | 2595 | return; |
2588 | 2596 | ||
2589 | switch (crev) { | 2597 | switch (crev) { |
2590 | case 1: | 2598 | case 1: |
2591 | args.v1.ucVoltageType = SET_VOLTAGE_TYPE_ASIC_VDDC; | 2599 | args.v1.ucVoltageType = voltage_type; |
2592 | args.v1.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_ALL_SOURCE; | 2600 | args.v1.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_ALL_SOURCE; |
2593 | args.v1.ucVoltageIndex = volt_index; | 2601 | args.v1.ucVoltageIndex = volt_index; |
2594 | break; | 2602 | break; |
2595 | case 2: | 2603 | case 2: |
2596 | args.v2.ucVoltageType = SET_VOLTAGE_TYPE_ASIC_VDDC; | 2604 | args.v2.ucVoltageType = voltage_type; |
2597 | args.v2.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_SET_VOLTAGE; | 2605 | args.v2.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_SET_VOLTAGE; |
2598 | args.v2.usVoltageLevel = cpu_to_le16(level); | 2606 | args.v2.usVoltageLevel = cpu_to_le16(voltage_level); |
2599 | break; | 2607 | break; |
2600 | default: | 2608 | default: |
2601 | DRM_ERROR("Unknown table version %d, %d\n", frev, crev); | 2609 | DRM_ERROR("Unknown table version %d, %d\n", frev, crev); |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 2ef6d5135064..5f45fa12bb8b 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -1199,7 +1199,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1199 | if (router->ddc_valid || router->cd_valid) { | 1199 | if (router->ddc_valid || router->cd_valid) { |
1200 | radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info); | 1200 | radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info); |
1201 | if (!radeon_connector->router_bus) | 1201 | if (!radeon_connector->router_bus) |
1202 | goto failed; | 1202 | DRM_ERROR("Failed to assign router i2c bus! Check dmesg for i2c errors.\n"); |
1203 | } | 1203 | } |
1204 | switch (connector_type) { | 1204 | switch (connector_type) { |
1205 | case DRM_MODE_CONNECTOR_VGA: | 1205 | case DRM_MODE_CONNECTOR_VGA: |
@@ -1208,7 +1208,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1208 | if (i2c_bus->valid) { | 1208 | if (i2c_bus->valid) { |
1209 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1209 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1210 | if (!radeon_connector->ddc_bus) | 1210 | if (!radeon_connector->ddc_bus) |
1211 | goto failed; | 1211 | DRM_ERROR("VGA: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
1212 | } | 1212 | } |
1213 | radeon_connector->dac_load_detect = true; | 1213 | radeon_connector->dac_load_detect = true; |
1214 | drm_connector_attach_property(&radeon_connector->base, | 1214 | drm_connector_attach_property(&radeon_connector->base, |
@@ -1226,7 +1226,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1226 | if (i2c_bus->valid) { | 1226 | if (i2c_bus->valid) { |
1227 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1227 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1228 | if (!radeon_connector->ddc_bus) | 1228 | if (!radeon_connector->ddc_bus) |
1229 | goto failed; | 1229 | DRM_ERROR("DVIA: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
1230 | } | 1230 | } |
1231 | radeon_connector->dac_load_detect = true; | 1231 | radeon_connector->dac_load_detect = true; |
1232 | drm_connector_attach_property(&radeon_connector->base, | 1232 | drm_connector_attach_property(&radeon_connector->base, |
@@ -1249,7 +1249,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1249 | if (i2c_bus->valid) { | 1249 | if (i2c_bus->valid) { |
1250 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1250 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1251 | if (!radeon_connector->ddc_bus) | 1251 | if (!radeon_connector->ddc_bus) |
1252 | goto failed; | 1252 | DRM_ERROR("DVI: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
1253 | } | 1253 | } |
1254 | subpixel_order = SubPixelHorizontalRGB; | 1254 | subpixel_order = SubPixelHorizontalRGB; |
1255 | drm_connector_attach_property(&radeon_connector->base, | 1255 | drm_connector_attach_property(&radeon_connector->base, |
@@ -1290,7 +1290,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1290 | if (i2c_bus->valid) { | 1290 | if (i2c_bus->valid) { |
1291 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1291 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1292 | if (!radeon_connector->ddc_bus) | 1292 | if (!radeon_connector->ddc_bus) |
1293 | goto failed; | 1293 | DRM_ERROR("HDMI: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
1294 | } | 1294 | } |
1295 | drm_connector_attach_property(&radeon_connector->base, | 1295 | drm_connector_attach_property(&radeon_connector->base, |
1296 | rdev->mode_info.coherent_mode_property, | 1296 | rdev->mode_info.coherent_mode_property, |
@@ -1329,10 +1329,10 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1329 | else | 1329 | else |
1330 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); | 1330 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); |
1331 | if (!radeon_dig_connector->dp_i2c_bus) | 1331 | if (!radeon_dig_connector->dp_i2c_bus) |
1332 | goto failed; | 1332 | DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n"); |
1333 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1333 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1334 | if (!radeon_connector->ddc_bus) | 1334 | if (!radeon_connector->ddc_bus) |
1335 | goto failed; | 1335 | DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
1336 | } | 1336 | } |
1337 | subpixel_order = SubPixelHorizontalRGB; | 1337 | subpixel_order = SubPixelHorizontalRGB; |
1338 | drm_connector_attach_property(&radeon_connector->base, | 1338 | drm_connector_attach_property(&radeon_connector->base, |
@@ -1381,7 +1381,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1381 | if (i2c_bus->valid) { | 1381 | if (i2c_bus->valid) { |
1382 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1382 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1383 | if (!radeon_connector->ddc_bus) | 1383 | if (!radeon_connector->ddc_bus) |
1384 | goto failed; | 1384 | DRM_ERROR("LVDS: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
1385 | } | 1385 | } |
1386 | drm_connector_attach_property(&radeon_connector->base, | 1386 | drm_connector_attach_property(&radeon_connector->base, |
1387 | dev->mode_config.scaling_mode_property, | 1387 | dev->mode_config.scaling_mode_property, |
@@ -1457,7 +1457,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1457 | if (i2c_bus->valid) { | 1457 | if (i2c_bus->valid) { |
1458 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1458 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1459 | if (!radeon_connector->ddc_bus) | 1459 | if (!radeon_connector->ddc_bus) |
1460 | goto failed; | 1460 | DRM_ERROR("VGA: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
1461 | } | 1461 | } |
1462 | radeon_connector->dac_load_detect = true; | 1462 | radeon_connector->dac_load_detect = true; |
1463 | drm_connector_attach_property(&radeon_connector->base, | 1463 | drm_connector_attach_property(&radeon_connector->base, |
@@ -1475,7 +1475,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1475 | if (i2c_bus->valid) { | 1475 | if (i2c_bus->valid) { |
1476 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1476 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1477 | if (!radeon_connector->ddc_bus) | 1477 | if (!radeon_connector->ddc_bus) |
1478 | goto failed; | 1478 | DRM_ERROR("DVIA: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
1479 | } | 1479 | } |
1480 | radeon_connector->dac_load_detect = true; | 1480 | radeon_connector->dac_load_detect = true; |
1481 | drm_connector_attach_property(&radeon_connector->base, | 1481 | drm_connector_attach_property(&radeon_connector->base, |
@@ -1493,7 +1493,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1493 | if (i2c_bus->valid) { | 1493 | if (i2c_bus->valid) { |
1494 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1494 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1495 | if (!radeon_connector->ddc_bus) | 1495 | if (!radeon_connector->ddc_bus) |
1496 | goto failed; | 1496 | DRM_ERROR("DVI: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
1497 | } | 1497 | } |
1498 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { | 1498 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { |
1499 | radeon_connector->dac_load_detect = true; | 1499 | radeon_connector->dac_load_detect = true; |
@@ -1538,7 +1538,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1538 | if (i2c_bus->valid) { | 1538 | if (i2c_bus->valid) { |
1539 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1539 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
1540 | if (!radeon_connector->ddc_bus) | 1540 | if (!radeon_connector->ddc_bus) |
1541 | goto failed; | 1541 | DRM_ERROR("LVDS: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
1542 | } | 1542 | } |
1543 | drm_connector_attach_property(&radeon_connector->base, | 1543 | drm_connector_attach_property(&radeon_connector->base, |
1544 | dev->mode_config.scaling_mode_property, | 1544 | dev->mode_config.scaling_mode_property, |
@@ -1567,9 +1567,4 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1567 | radeon_legacy_backlight_init(radeon_encoder, connector); | 1567 | radeon_legacy_backlight_init(radeon_encoder, connector); |
1568 | } | 1568 | } |
1569 | } | 1569 | } |
1570 | return; | ||
1571 | |||
1572 | failed: | ||
1573 | drm_connector_cleanup(connector); | ||
1574 | kfree(connector); | ||
1575 | } | 1570 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 9e59868d354e..bbcd1dd7bac0 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c | |||
@@ -79,7 +79,7 @@ static bool radeon_fence_poll_locked(struct radeon_device *rdev) | |||
79 | scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | 79 | scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; |
80 | else | 80 | else |
81 | scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | 81 | scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; |
82 | seq = rdev->wb.wb[scratch_index/4]; | 82 | seq = le32_to_cpu(rdev->wb.wb[scratch_index/4]); |
83 | } else | 83 | } else |
84 | seq = RREG32(rdev->fence_drv.scratch_reg); | 84 | seq = RREG32(rdev->fence_drv.scratch_reg); |
85 | if (seq != rdev->fence_drv.last_seq) { | 85 | if (seq != rdev->fence_drv.last_seq) { |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index f0534ef2f331..8a955bbdb608 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -285,4 +285,6 @@ void radeon_gart_fini(struct radeon_device *rdev) | |||
285 | rdev->gart.pages = NULL; | 285 | rdev->gart.pages = NULL; |
286 | rdev->gart.pages_addr = NULL; | 286 | rdev->gart.pages_addr = NULL; |
287 | rdev->gart.ttm_alloced = NULL; | 287 | rdev->gart.ttm_alloced = NULL; |
288 | |||
289 | radeon_dummy_page_fini(rdev); | ||
288 | } | 290 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index ded2a45bc95c..983cbac75af0 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | |||
@@ -1062,7 +1062,7 @@ void radeon_i2c_get_byte(struct radeon_i2c_chan *i2c_bus, | |||
1062 | *val = in_buf[0]; | 1062 | *val = in_buf[0]; |
1063 | DRM_DEBUG("val = 0x%02x\n", *val); | 1063 | DRM_DEBUG("val = 0x%02x\n", *val); |
1064 | } else { | 1064 | } else { |
1065 | DRM_ERROR("i2c 0x%02x 0x%02x read failed\n", | 1065 | DRM_DEBUG("i2c 0x%02x 0x%02x read failed\n", |
1066 | addr, *val); | 1066 | addr, *val); |
1067 | } | 1067 | } |
1068 | } | 1068 | } |
@@ -1084,7 +1084,7 @@ void radeon_i2c_put_byte(struct radeon_i2c_chan *i2c_bus, | |||
1084 | out_buf[1] = val; | 1084 | out_buf[1] = val; |
1085 | 1085 | ||
1086 | if (i2c_transfer(&i2c_bus->adapter, &msg, 1) != 1) | 1086 | if (i2c_transfer(&i2c_bus->adapter, &msg, 1) != 1) |
1087 | DRM_ERROR("i2c 0x%02x 0x%02x write failed\n", | 1087 | DRM_DEBUG("i2c 0x%02x 0x%02x write failed\n", |
1088 | addr, val); | 1088 | addr, val); |
1089 | } | 1089 | } |
1090 | 1090 | ||
@@ -1096,6 +1096,9 @@ void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector) | |||
1096 | if (!radeon_connector->router.ddc_valid) | 1096 | if (!radeon_connector->router.ddc_valid) |
1097 | return; | 1097 | return; |
1098 | 1098 | ||
1099 | if (!radeon_connector->router_bus) | ||
1100 | return; | ||
1101 | |||
1099 | radeon_i2c_get_byte(radeon_connector->router_bus, | 1102 | radeon_i2c_get_byte(radeon_connector->router_bus, |
1100 | radeon_connector->router.i2c_addr, | 1103 | radeon_connector->router.i2c_addr, |
1101 | 0x3, &val); | 1104 | 0x3, &val); |
@@ -1121,6 +1124,9 @@ void radeon_router_select_cd_port(struct radeon_connector *radeon_connector) | |||
1121 | if (!radeon_connector->router.cd_valid) | 1124 | if (!radeon_connector->router.cd_valid) |
1122 | return; | 1125 | return; |
1123 | 1126 | ||
1127 | if (!radeon_connector->router_bus) | ||
1128 | return; | ||
1129 | |||
1124 | radeon_i2c_get_byte(radeon_connector->router_bus, | 1130 | radeon_i2c_get_byte(radeon_connector->router_bus, |
1125 | radeon_connector->router.i2c_addr, | 1131 | radeon_connector->router.i2c_addr, |
1126 | 0x3, &val); | 1132 | 0x3, &val); |
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index bf7d4c061451..871df0376b1c 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
@@ -221,6 +221,19 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
221 | return -EINVAL; | 221 | return -EINVAL; |
222 | } | 222 | } |
223 | break; | 223 | break; |
224 | case RADEON_INFO_NUM_TILE_PIPES: | ||
225 | if (rdev->family >= CHIP_CAYMAN) | ||
226 | value = rdev->config.cayman.max_tile_pipes; | ||
227 | else if (rdev->family >= CHIP_CEDAR) | ||
228 | value = rdev->config.evergreen.max_tile_pipes; | ||
229 | else if (rdev->family >= CHIP_RV770) | ||
230 | value = rdev->config.rv770.max_tile_pipes; | ||
231 | else if (rdev->family >= CHIP_R600) | ||
232 | value = rdev->config.r600.max_tile_pipes; | ||
233 | else { | ||
234 | return -EINVAL; | ||
235 | } | ||
236 | break; | ||
224 | default: | 237 | default: |
225 | DRM_DEBUG_KMS("Invalid request %d\n", info->request); | 238 | DRM_DEBUG_KMS("Invalid request %d\n", info->request); |
226 | return -EINVAL; | 239 | return -EINVAL; |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 5b54268ed6b2..2f46e0c8df53 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -269,7 +269,7 @@ static const struct drm_encoder_helper_funcs radeon_legacy_lvds_helper_funcs = { | |||
269 | .disable = radeon_legacy_encoder_disable, | 269 | .disable = radeon_legacy_encoder_disable, |
270 | }; | 270 | }; |
271 | 271 | ||
272 | #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE | 272 | #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) |
273 | 273 | ||
274 | #define MAX_RADEON_LEVEL 0xFF | 274 | #define MAX_RADEON_LEVEL 0xFF |
275 | 275 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 08de669e025a..86eda1ea94df 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "drmP.h" | 23 | #include "drmP.h" |
24 | #include "radeon.h" | 24 | #include "radeon.h" |
25 | #include "avivod.h" | 25 | #include "avivod.h" |
26 | #include "atom.h" | ||
26 | #ifdef CONFIG_ACPI | 27 | #ifdef CONFIG_ACPI |
27 | #include <linux/acpi.h> | 28 | #include <linux/acpi.h> |
28 | #endif | 29 | #endif |
@@ -535,7 +536,11 @@ void radeon_pm_resume(struct radeon_device *rdev) | |||
535 | /* set up the default clocks if the MC ucode is loaded */ | 536 | /* set up the default clocks if the MC ucode is loaded */ |
536 | if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) { | 537 | if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) { |
537 | if (rdev->pm.default_vddc) | 538 | if (rdev->pm.default_vddc) |
538 | radeon_atom_set_voltage(rdev, rdev->pm.default_vddc); | 539 | radeon_atom_set_voltage(rdev, rdev->pm.default_vddc, |
540 | SET_VOLTAGE_TYPE_ASIC_VDDC); | ||
541 | if (rdev->pm.default_vddci) | ||
542 | radeon_atom_set_voltage(rdev, rdev->pm.default_vddci, | ||
543 | SET_VOLTAGE_TYPE_ASIC_VDDCI); | ||
539 | if (rdev->pm.default_sclk) | 544 | if (rdev->pm.default_sclk) |
540 | radeon_set_engine_clock(rdev, rdev->pm.default_sclk); | 545 | radeon_set_engine_clock(rdev, rdev->pm.default_sclk); |
541 | if (rdev->pm.default_mclk) | 546 | if (rdev->pm.default_mclk) |
@@ -548,6 +553,7 @@ void radeon_pm_resume(struct radeon_device *rdev) | |||
548 | rdev->pm.current_sclk = rdev->pm.default_sclk; | 553 | rdev->pm.current_sclk = rdev->pm.default_sclk; |
549 | rdev->pm.current_mclk = rdev->pm.default_mclk; | 554 | rdev->pm.current_mclk = rdev->pm.default_mclk; |
550 | rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage; | 555 | rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage; |
556 | rdev->pm.current_vddci = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.vddci; | ||
551 | if (rdev->pm.pm_method == PM_METHOD_DYNPM | 557 | if (rdev->pm.pm_method == PM_METHOD_DYNPM |
552 | && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) { | 558 | && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) { |
553 | rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE; | 559 | rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE; |
@@ -585,7 +591,8 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
585 | /* set up the default clocks if the MC ucode is loaded */ | 591 | /* set up the default clocks if the MC ucode is loaded */ |
586 | if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) { | 592 | if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) { |
587 | if (rdev->pm.default_vddc) | 593 | if (rdev->pm.default_vddc) |
588 | radeon_atom_set_voltage(rdev, rdev->pm.default_vddc); | 594 | radeon_atom_set_voltage(rdev, rdev->pm.default_vddc, |
595 | SET_VOLTAGE_TYPE_ASIC_VDDC); | ||
589 | if (rdev->pm.default_sclk) | 596 | if (rdev->pm.default_sclk) |
590 | radeon_set_engine_clock(rdev, rdev->pm.default_sclk); | 597 | radeon_set_engine_clock(rdev, rdev->pm.default_sclk); |
591 | if (rdev->pm.default_mclk) | 598 | if (rdev->pm.default_mclk) |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index bbc9cd823334..c6776e48fdde 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -248,7 +248,7 @@ void radeon_ib_pool_fini(struct radeon_device *rdev) | |||
248 | void radeon_ring_free_size(struct radeon_device *rdev) | 248 | void radeon_ring_free_size(struct radeon_device *rdev) |
249 | { | 249 | { |
250 | if (rdev->wb.enabled) | 250 | if (rdev->wb.enabled) |
251 | rdev->cp.rptr = rdev->wb.wb[RADEON_WB_CP_RPTR_OFFSET/4]; | 251 | rdev->cp.rptr = le32_to_cpu(rdev->wb.wb[RADEON_WB_CP_RPTR_OFFSET/4]); |
252 | else { | 252 | else { |
253 | if (rdev->family >= CHIP_R600) | 253 | if (rdev->family >= CHIP_R600) |
254 | rdev->cp.rptr = RREG32(R600_CP_RB_RPTR); | 254 | rdev->cp.rptr = RREG32(R600_CP_RB_RPTR); |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/r600 b/drivers/gpu/drm/radeon/reg_srcs/r600 index af0da4ae3f55..92f1900dc7ca 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/r600 +++ b/drivers/gpu/drm/radeon/reg_srcs/r600 | |||
@@ -708,6 +708,7 @@ r600 0x9400 | |||
708 | 0x00028D0C DB_RENDER_CONTROL | 708 | 0x00028D0C DB_RENDER_CONTROL |
709 | 0x00028D10 DB_RENDER_OVERRIDE | 709 | 0x00028D10 DB_RENDER_OVERRIDE |
710 | 0x0002880C DB_SHADER_CONTROL | 710 | 0x0002880C DB_SHADER_CONTROL |
711 | 0x00028D28 DB_SRESULTS_COMPARE_STATE0 | ||
711 | 0x00028D2C DB_SRESULTS_COMPARE_STATE1 | 712 | 0x00028D2C DB_SRESULTS_COMPARE_STATE1 |
712 | 0x00028430 DB_STENCILREFMASK | 713 | 0x00028430 DB_STENCILREFMASK |
713 | 0x00028434 DB_STENCILREFMASK_BF | 714 | 0x00028434 DB_STENCILREFMASK_BF |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 876cebc4b8ba..6e3b11e5abbe 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -114,7 +114,7 @@ void rs600_pm_misc(struct radeon_device *rdev) | |||
114 | udelay(voltage->delay); | 114 | udelay(voltage->delay); |
115 | } | 115 | } |
116 | } else if (voltage->type == VOLTAGE_VDDC) | 116 | } else if (voltage->type == VOLTAGE_VDDC) |
117 | radeon_atom_set_voltage(rdev, voltage->vddc_id); | 117 | radeon_atom_set_voltage(rdev, voltage->vddc_id, SET_VOLTAGE_TYPE_ASIC_VDDC); |
118 | 118 | ||
119 | dyn_pwrmgt_sclk_length = RREG32_PLL(DYN_PWRMGT_SCLK_LENGTH); | 119 | dyn_pwrmgt_sclk_length = RREG32_PLL(DYN_PWRMGT_SCLK_LENGTH); |
120 | dyn_pwrmgt_sclk_length &= ~REDUCED_POWER_SCLK_HILEN(0xf); | 120 | dyn_pwrmgt_sclk_length &= ~REDUCED_POWER_SCLK_HILEN(0xf); |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index b974ac7df8df..ef8a5babe9f7 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -106,7 +106,7 @@ void rv770_pm_misc(struct radeon_device *rdev) | |||
106 | 106 | ||
107 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { | 107 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { |
108 | if (voltage->voltage != rdev->pm.current_vddc) { | 108 | if (voltage->voltage != rdev->pm.current_vddc) { |
109 | radeon_atom_set_voltage(rdev, voltage->voltage); | 109 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); |
110 | rdev->pm.current_vddc = voltage->voltage; | 110 | rdev->pm.current_vddc = voltage->voltage; |
111 | DRM_DEBUG("Setting: v: %d\n", voltage->voltage); | 111 | DRM_DEBUG("Setting: v: %d\n", voltage->voltage); |
112 | } | 112 | } |
@@ -1255,9 +1255,6 @@ int rv770_init(struct radeon_device *rdev) | |||
1255 | { | 1255 | { |
1256 | int r; | 1256 | int r; |
1257 | 1257 | ||
1258 | r = radeon_dummy_page_init(rdev); | ||
1259 | if (r) | ||
1260 | return r; | ||
1261 | /* This don't do much */ | 1258 | /* This don't do much */ |
1262 | r = radeon_gem_init(rdev); | 1259 | r = radeon_gem_init(rdev); |
1263 | if (r) | 1260 | if (r) |
@@ -1372,7 +1369,6 @@ void rv770_fini(struct radeon_device *rdev) | |||
1372 | radeon_atombios_fini(rdev); | 1369 | radeon_atombios_fini(rdev); |
1373 | kfree(rdev->bios); | 1370 | kfree(rdev->bios); |
1374 | rdev->bios = NULL; | 1371 | rdev->bios = NULL; |
1375 | radeon_dummy_page_fini(rdev); | ||
1376 | } | 1372 | } |
1377 | 1373 | ||
1378 | static void rv770_pcie_gen2_enable(struct radeon_device *rdev) | 1374 | static void rv770_pcie_gen2_enable(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index 737a2a2e46a5..9d9d92945f8c 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c | |||
@@ -683,22 +683,14 @@ int ttm_get_pages(struct list_head *pages, int flags, | |||
683 | gfp_flags |= GFP_HIGHUSER; | 683 | gfp_flags |= GFP_HIGHUSER; |
684 | 684 | ||
685 | for (r = 0; r < count; ++r) { | 685 | for (r = 0; r < count; ++r) { |
686 | if ((flags & TTM_PAGE_FLAG_DMA32) && dma_address) { | 686 | p = alloc_page(gfp_flags); |
687 | void *addr; | ||
688 | addr = dma_alloc_coherent(NULL, PAGE_SIZE, | ||
689 | &dma_address[r], | ||
690 | gfp_flags); | ||
691 | if (addr == NULL) | ||
692 | return -ENOMEM; | ||
693 | p = virt_to_page(addr); | ||
694 | } else | ||
695 | p = alloc_page(gfp_flags); | ||
696 | if (!p) { | 687 | if (!p) { |
697 | 688 | ||
698 | printk(KERN_ERR TTM_PFX | 689 | printk(KERN_ERR TTM_PFX |
699 | "Unable to allocate page."); | 690 | "Unable to allocate page."); |
700 | return -ENOMEM; | 691 | return -ENOMEM; |
701 | } | 692 | } |
693 | |||
702 | list_add(&p->lru, pages); | 694 | list_add(&p->lru, pages); |
703 | } | 695 | } |
704 | return 0; | 696 | return 0; |
@@ -746,24 +738,12 @@ void ttm_put_pages(struct list_head *pages, unsigned page_count, int flags, | |||
746 | unsigned long irq_flags; | 738 | unsigned long irq_flags; |
747 | struct ttm_page_pool *pool = ttm_get_pool(flags, cstate); | 739 | struct ttm_page_pool *pool = ttm_get_pool(flags, cstate); |
748 | struct page *p, *tmp; | 740 | struct page *p, *tmp; |
749 | unsigned r; | ||
750 | 741 | ||
751 | if (pool == NULL) { | 742 | if (pool == NULL) { |
752 | /* No pool for this memory type so free the pages */ | 743 | /* No pool for this memory type so free the pages */ |
753 | 744 | ||
754 | r = page_count-1; | ||
755 | list_for_each_entry_safe(p, tmp, pages, lru) { | 745 | list_for_each_entry_safe(p, tmp, pages, lru) { |
756 | if ((flags & TTM_PAGE_FLAG_DMA32) && dma_address) { | 746 | __free_page(p); |
757 | void *addr = page_address(p); | ||
758 | WARN_ON(!addr || !dma_address[r]); | ||
759 | if (addr) | ||
760 | dma_free_coherent(NULL, PAGE_SIZE, | ||
761 | addr, | ||
762 | dma_address[r]); | ||
763 | dma_address[r] = 0; | ||
764 | } else | ||
765 | __free_page(p); | ||
766 | r--; | ||
767 | } | 747 | } |
768 | /* Make the pages list empty */ | 748 | /* Make the pages list empty */ |
769 | INIT_LIST_HEAD(pages); | 749 | INIT_LIST_HEAD(pages); |
diff --git a/drivers/gpu/stub/Kconfig b/drivers/gpu/stub/Kconfig index 70e60a4bb678..419917955bf6 100644 --- a/drivers/gpu/stub/Kconfig +++ b/drivers/gpu/stub/Kconfig | |||
@@ -5,6 +5,7 @@ config STUB_POULSBO | |||
5 | # Poulsbo stub depends on ACPI_VIDEO when ACPI is enabled | 5 | # Poulsbo stub depends on ACPI_VIDEO when ACPI is enabled |
6 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick | 6 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick |
7 | select BACKLIGHT_CLASS_DEVICE if ACPI | 7 | select BACKLIGHT_CLASS_DEVICE if ACPI |
8 | select VIDEO_OUTPUT_CONTROL if ACPI | ||
8 | select INPUT if ACPI | 9 | select INPUT if ACPI |
9 | select ACPI_VIDEO if ACPI | 10 | select ACPI_VIDEO if ACPI |
10 | select THERMAL if ACPI | 11 | select THERMAL if ACPI |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 060ef6327876..50e40dbd8bb6 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -110,8 +110,7 @@ config SENSORS_ADM1021 | |||
110 | help | 110 | help |
111 | If you say yes here you get support for Analog Devices ADM1021 | 111 | If you say yes here you get support for Analog Devices ADM1021 |
112 | and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A, | 112 | and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A, |
113 | Genesys Logic GL523SM, National Semiconductor LM84, TI THMC10, | 113 | Genesys Logic GL523SM, National Semiconductor LM84 and TI THMC10. |
114 | and the XEON processor built-in sensor. | ||
115 | 114 | ||
116 | This driver can also be built as a module. If so, the module | 115 | This driver can also be built as a module. If so, the module |
117 | will be called adm1021. | 116 | will be called adm1021. |
@@ -618,10 +617,10 @@ config SENSORS_LM90 | |||
618 | depends on I2C | 617 | depends on I2C |
619 | help | 618 | help |
620 | If you say yes here you get support for National Semiconductor LM90, | 619 | If you say yes here you get support for National Semiconductor LM90, |
621 | LM86, LM89 and LM99, Analog Devices ADM1032 and ADT7461, Maxim | 620 | LM86, LM89 and LM99, Analog Devices ADM1032, ADT7461, and ADT7461A, |
622 | MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659, | 621 | Maxim MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659, |
623 | MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, and Winbond/Nuvoton | 622 | MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, ON Semiconductor NCT1008, |
624 | W83L771W/G/AWG/ASG sensor chips. | 623 | and Winbond/Nuvoton W83L771W/G/AWG/ASG sensor chips. |
625 | 624 | ||
626 | This driver can also be built as a module. If so, the module | 625 | This driver can also be built as a module. If so, the module |
627 | will be called lm90. | 626 | will be called lm90. |
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 250d099ca398..da72dc12068c 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
@@ -1094,6 +1094,7 @@ static struct attribute *lm85_attributes_minctl[] = { | |||
1094 | &sensor_dev_attr_pwm1_auto_pwm_minctl.dev_attr.attr, | 1094 | &sensor_dev_attr_pwm1_auto_pwm_minctl.dev_attr.attr, |
1095 | &sensor_dev_attr_pwm2_auto_pwm_minctl.dev_attr.attr, | 1095 | &sensor_dev_attr_pwm2_auto_pwm_minctl.dev_attr.attr, |
1096 | &sensor_dev_attr_pwm3_auto_pwm_minctl.dev_attr.attr, | 1096 | &sensor_dev_attr_pwm3_auto_pwm_minctl.dev_attr.attr, |
1097 | NULL | ||
1097 | }; | 1098 | }; |
1098 | 1099 | ||
1099 | static const struct attribute_group lm85_group_minctl = { | 1100 | static const struct attribute_group lm85_group_minctl = { |
@@ -1104,6 +1105,7 @@ static struct attribute *lm85_attributes_temp_off[] = { | |||
1104 | &sensor_dev_attr_temp1_auto_temp_off.dev_attr.attr, | 1105 | &sensor_dev_attr_temp1_auto_temp_off.dev_attr.attr, |
1105 | &sensor_dev_attr_temp2_auto_temp_off.dev_attr.attr, | 1106 | &sensor_dev_attr_temp2_auto_temp_off.dev_attr.attr, |
1106 | &sensor_dev_attr_temp3_auto_temp_off.dev_attr.attr, | 1107 | &sensor_dev_attr_temp3_auto_temp_off.dev_attr.attr, |
1108 | NULL | ||
1107 | }; | 1109 | }; |
1108 | 1110 | ||
1109 | static const struct attribute_group lm85_group_temp_off = { | 1111 | static const struct attribute_group lm85_group_temp_off = { |
@@ -1329,11 +1331,11 @@ static int lm85_probe(struct i2c_client *client, | |||
1329 | if (data->type != emc6d103s) { | 1331 | if (data->type != emc6d103s) { |
1330 | err = sysfs_create_group(&client->dev.kobj, &lm85_group_minctl); | 1332 | err = sysfs_create_group(&client->dev.kobj, &lm85_group_minctl); |
1331 | if (err) | 1333 | if (err) |
1332 | goto err_kfree; | 1334 | goto err_remove_files; |
1333 | err = sysfs_create_group(&client->dev.kobj, | 1335 | err = sysfs_create_group(&client->dev.kobj, |
1334 | &lm85_group_temp_off); | 1336 | &lm85_group_temp_off); |
1335 | if (err) | 1337 | if (err) |
1336 | goto err_kfree; | 1338 | goto err_remove_files; |
1337 | } | 1339 | } |
1338 | 1340 | ||
1339 | /* The ADT7463/68 have an optional VRM 10 mode where pin 21 is used | 1341 | /* The ADT7463/68 have an optional VRM 10 mode where pin 21 is used |
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index c43b4e9f96a9..2f94f9504804 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
@@ -49,10 +49,10 @@ | |||
49 | * chips, but support three temperature sensors instead of two. MAX6695 | 49 | * chips, but support three temperature sensors instead of two. MAX6695 |
50 | * and MAX6696 only differ in the pinout so they can be treated identically. | 50 | * and MAX6696 only differ in the pinout so they can be treated identically. |
51 | * | 51 | * |
52 | * This driver also supports the ADT7461 chip from Analog Devices. | 52 | * This driver also supports ADT7461 and ADT7461A from Analog Devices as well as |
53 | * It's supported in both compatibility and extended mode. It is mostly | 53 | * NCT1008 from ON Semiconductor. The chips are supported in both compatibility |
54 | * compatible with LM90 except for a data format difference for the | 54 | * and extended mode. They are mostly compatible with LM90 except for a data |
55 | * temperature value registers. | 55 | * format difference for the temperature value registers. |
56 | * | 56 | * |
57 | * Since the LM90 was the first chipset supported by this driver, most | 57 | * Since the LM90 was the first chipset supported by this driver, most |
58 | * comments will refer to this chipset, but are actually general and | 58 | * comments will refer to this chipset, but are actually general and |
@@ -88,9 +88,10 @@ | |||
88 | * Addresses to scan | 88 | * Addresses to scan |
89 | * Address is fully defined internally and cannot be changed except for | 89 | * Address is fully defined internally and cannot be changed except for |
90 | * MAX6659, MAX6680 and MAX6681. | 90 | * MAX6659, MAX6680 and MAX6681. |
91 | * LM86, LM89, LM90, LM99, ADM1032, ADM1032-1, ADT7461, MAX6649, MAX6657, | 91 | * LM86, LM89, LM90, LM99, ADM1032, ADM1032-1, ADT7461, ADT7461A, MAX6649, |
92 | * MAX6658 and W83L771 have address 0x4c. | 92 | * MAX6657, MAX6658, NCT1008 and W83L771 have address 0x4c. |
93 | * ADM1032-2, ADT7461-2, LM89-1, LM99-1 and MAX6646 have address 0x4d. | 93 | * ADM1032-2, ADT7461-2, ADT7461A-2, LM89-1, LM99-1, MAX6646, and NCT1008D |
94 | * have address 0x4d. | ||
94 | * MAX6647 has address 0x4e. | 95 | * MAX6647 has address 0x4e. |
95 | * MAX6659 can have address 0x4c, 0x4d or 0x4e. | 96 | * MAX6659 can have address 0x4c, 0x4d or 0x4e. |
96 | * MAX6680 and MAX6681 can have address 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, | 97 | * MAX6680 and MAX6681 can have address 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, |
@@ -174,6 +175,7 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680, | |||
174 | static const struct i2c_device_id lm90_id[] = { | 175 | static const struct i2c_device_id lm90_id[] = { |
175 | { "adm1032", adm1032 }, | 176 | { "adm1032", adm1032 }, |
176 | { "adt7461", adt7461 }, | 177 | { "adt7461", adt7461 }, |
178 | { "adt7461a", adt7461 }, | ||
177 | { "lm90", lm90 }, | 179 | { "lm90", lm90 }, |
178 | { "lm86", lm86 }, | 180 | { "lm86", lm86 }, |
179 | { "lm89", lm86 }, | 181 | { "lm89", lm86 }, |
@@ -188,6 +190,7 @@ static const struct i2c_device_id lm90_id[] = { | |||
188 | { "max6681", max6680 }, | 190 | { "max6681", max6680 }, |
189 | { "max6695", max6696 }, | 191 | { "max6695", max6696 }, |
190 | { "max6696", max6696 }, | 192 | { "max6696", max6696 }, |
193 | { "nct1008", adt7461 }, | ||
191 | { "w83l771", w83l771 }, | 194 | { "w83l771", w83l771 }, |
192 | { } | 195 | { } |
193 | }; | 196 | }; |
@@ -1153,6 +1156,11 @@ static int lm90_detect(struct i2c_client *new_client, | |||
1153 | && (reg_config1 & 0x1B) == 0x00 | 1156 | && (reg_config1 & 0x1B) == 0x00 |
1154 | && reg_convrate <= 0x0A) { | 1157 | && reg_convrate <= 0x0A) { |
1155 | name = "adt7461"; | 1158 | name = "adt7461"; |
1159 | } else | ||
1160 | if (chip_id == 0x57 /* ADT7461A, NCT1008 */ | ||
1161 | && (reg_config1 & 0x1B) == 0x00 | ||
1162 | && reg_convrate <= 0x0A) { | ||
1163 | name = "adt7461a"; | ||
1156 | } | 1164 | } |
1157 | } else | 1165 | } else |
1158 | if (man_id == 0x4D) { /* Maxim */ | 1166 | if (man_id == 0x4D) { /* Maxim */ |
diff --git a/drivers/hwmon/pmbus_core.c b/drivers/hwmon/pmbus_core.c index edfb92e41735..196ffafafd88 100644 --- a/drivers/hwmon/pmbus_core.c +++ b/drivers/hwmon/pmbus_core.c | |||
@@ -139,7 +139,6 @@ struct pmbus_data { | |||
139 | * A single status register covers multiple attributes, | 139 | * A single status register covers multiple attributes, |
140 | * so we keep them all together. | 140 | * so we keep them all together. |
141 | */ | 141 | */ |
142 | u8 status_bits; | ||
143 | u8 status[PB_NUM_STATUS_REG]; | 142 | u8 status[PB_NUM_STATUS_REG]; |
144 | 143 | ||
145 | u8 currpage; | 144 | u8 currpage; |
diff --git a/drivers/hwmon/twl4030-madc-hwmon.c b/drivers/hwmon/twl4030-madc-hwmon.c index de5819199e2e..57240740b161 100644 --- a/drivers/hwmon/twl4030-madc-hwmon.c +++ b/drivers/hwmon/twl4030-madc-hwmon.c | |||
@@ -98,7 +98,6 @@ static const struct attribute_group twl4030_madc_group = { | |||
98 | static int __devinit twl4030_madc_hwmon_probe(struct platform_device *pdev) | 98 | static int __devinit twl4030_madc_hwmon_probe(struct platform_device *pdev) |
99 | { | 99 | { |
100 | int ret; | 100 | int ret; |
101 | int status; | ||
102 | struct device *hwmon; | 101 | struct device *hwmon; |
103 | 102 | ||
104 | ret = sysfs_create_group(&pdev->dev.kobj, &twl4030_madc_group); | 103 | ret = sysfs_create_group(&pdev->dev.kobj, &twl4030_madc_group); |
@@ -107,7 +106,7 @@ static int __devinit twl4030_madc_hwmon_probe(struct platform_device *pdev) | |||
107 | hwmon = hwmon_device_register(&pdev->dev); | 106 | hwmon = hwmon_device_register(&pdev->dev); |
108 | if (IS_ERR(hwmon)) { | 107 | if (IS_ERR(hwmon)) { |
109 | dev_err(&pdev->dev, "hwmon_device_register failed.\n"); | 108 | dev_err(&pdev->dev, "hwmon_device_register failed.\n"); |
110 | status = PTR_ERR(hwmon); | 109 | ret = PTR_ERR(hwmon); |
111 | goto err_reg; | 110 | goto err_reg; |
112 | } | 111 | } |
113 | 112 | ||
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index 38319a69bd0a..d6d58684712b 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -232,9 +232,17 @@ static int i2c_inb(struct i2c_adapter *i2c_adap) | |||
232 | * Sanity check for the adapter hardware - check the reaction of | 232 | * Sanity check for the adapter hardware - check the reaction of |
233 | * the bus lines only if it seems to be idle. | 233 | * the bus lines only if it seems to be idle. |
234 | */ | 234 | */ |
235 | static int test_bus(struct i2c_algo_bit_data *adap, char *name) | 235 | static int test_bus(struct i2c_adapter *i2c_adap) |
236 | { | 236 | { |
237 | int scl, sda; | 237 | struct i2c_algo_bit_data *adap = i2c_adap->algo_data; |
238 | const char *name = i2c_adap->name; | ||
239 | int scl, sda, ret; | ||
240 | |||
241 | if (adap->pre_xfer) { | ||
242 | ret = adap->pre_xfer(i2c_adap); | ||
243 | if (ret < 0) | ||
244 | return -ENODEV; | ||
245 | } | ||
238 | 246 | ||
239 | if (adap->getscl == NULL) | 247 | if (adap->getscl == NULL) |
240 | pr_info("%s: Testing SDA only, SCL is not readable\n", name); | 248 | pr_info("%s: Testing SDA only, SCL is not readable\n", name); |
@@ -297,11 +305,19 @@ static int test_bus(struct i2c_algo_bit_data *adap, char *name) | |||
297 | "while pulling SCL high!\n", name); | 305 | "while pulling SCL high!\n", name); |
298 | goto bailout; | 306 | goto bailout; |
299 | } | 307 | } |
308 | |||
309 | if (adap->post_xfer) | ||
310 | adap->post_xfer(i2c_adap); | ||
311 | |||
300 | pr_info("%s: Test OK\n", name); | 312 | pr_info("%s: Test OK\n", name); |
301 | return 0; | 313 | return 0; |
302 | bailout: | 314 | bailout: |
303 | sdahi(adap); | 315 | sdahi(adap); |
304 | sclhi(adap); | 316 | sclhi(adap); |
317 | |||
318 | if (adap->post_xfer) | ||
319 | adap->post_xfer(i2c_adap); | ||
320 | |||
305 | return -ENODEV; | 321 | return -ENODEV; |
306 | } | 322 | } |
307 | 323 | ||
@@ -607,7 +623,7 @@ static int __i2c_bit_add_bus(struct i2c_adapter *adap, | |||
607 | int ret; | 623 | int ret; |
608 | 624 | ||
609 | if (bit_test) { | 625 | if (bit_test) { |
610 | ret = test_bus(bit_adap, adap->name); | 626 | ret = test_bus(adap); |
611 | if (ret < 0) | 627 | if (ret < 0) |
612 | return -ENODEV; | 628 | return -ENODEV; |
613 | } | 629 | } |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 72c0415f6f94..455e909bc768 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -134,10 +134,15 @@ | |||
134 | SMBHSTSTS_BUS_ERR | SMBHSTSTS_DEV_ERR | \ | 134 | SMBHSTSTS_BUS_ERR | SMBHSTSTS_DEV_ERR | \ |
135 | SMBHSTSTS_INTR) | 135 | SMBHSTSTS_INTR) |
136 | 136 | ||
137 | /* Older devices have their ID defined in <linux/pci_ids.h> */ | ||
138 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22 | ||
139 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 | ||
137 | /* Patsburg also has three 'Integrated Device Function' SMBus controllers */ | 140 | /* Patsburg also has three 'Integrated Device Function' SMBus controllers */ |
138 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF0 0x1d70 | 141 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF0 0x1d70 |
139 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1 0x1d71 | 142 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1 0x1d71 |
140 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2 0x1d72 | 143 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2 0x1d72 |
144 | #define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS 0x2330 | ||
145 | #define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30 | ||
141 | 146 | ||
142 | struct i801_priv { | 147 | struct i801_priv { |
143 | struct i2c_adapter adapter; | 148 | struct i2c_adapter adapter; |
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index 0eb1515541e7..2dbba163b102 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* ------------------------------------------------------------------------ * | 1 | /* ------------------------------------------------------------------------ * |
2 | * i2c-parport.c I2C bus over parallel port * | 2 | * i2c-parport.c I2C bus over parallel port * |
3 | * ------------------------------------------------------------------------ * | 3 | * ------------------------------------------------------------------------ * |
4 | Copyright (C) 2003-2010 Jean Delvare <khali@linux-fr.org> | 4 | Copyright (C) 2003-2011 Jean Delvare <khali@linux-fr.org> |
5 | 5 | ||
6 | Based on older i2c-philips-par.c driver | 6 | Based on older i2c-philips-par.c driver |
7 | Copyright (C) 1995-2000 Simon G. Vogl | 7 | Copyright (C) 1995-2000 Simon G. Vogl |
@@ -33,6 +33,8 @@ | |||
33 | #include <linux/i2c-algo-bit.h> | 33 | #include <linux/i2c-algo-bit.h> |
34 | #include <linux/i2c-smbus.h> | 34 | #include <linux/i2c-smbus.h> |
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/list.h> | ||
37 | #include <linux/mutex.h> | ||
36 | #include "i2c-parport.h" | 38 | #include "i2c-parport.h" |
37 | 39 | ||
38 | /* ----- Device list ------------------------------------------------------ */ | 40 | /* ----- Device list ------------------------------------------------------ */ |
@@ -43,10 +45,11 @@ struct i2c_par { | |||
43 | struct i2c_algo_bit_data algo_data; | 45 | struct i2c_algo_bit_data algo_data; |
44 | struct i2c_smbus_alert_setup alert_data; | 46 | struct i2c_smbus_alert_setup alert_data; |
45 | struct i2c_client *ara; | 47 | struct i2c_client *ara; |
46 | struct i2c_par *next; | 48 | struct list_head node; |
47 | }; | 49 | }; |
48 | 50 | ||
49 | static struct i2c_par *adapter_list; | 51 | static LIST_HEAD(adapter_list); |
52 | static DEFINE_MUTEX(adapter_list_lock); | ||
50 | 53 | ||
51 | /* ----- Low-level parallel port access ----------------------------------- */ | 54 | /* ----- Low-level parallel port access ----------------------------------- */ |
52 | 55 | ||
@@ -228,8 +231,9 @@ static void i2c_parport_attach (struct parport *port) | |||
228 | } | 231 | } |
229 | 232 | ||
230 | /* Add the new adapter to the list */ | 233 | /* Add the new adapter to the list */ |
231 | adapter->next = adapter_list; | 234 | mutex_lock(&adapter_list_lock); |
232 | adapter_list = adapter; | 235 | list_add_tail(&adapter->node, &adapter_list); |
236 | mutex_unlock(&adapter_list_lock); | ||
233 | return; | 237 | return; |
234 | 238 | ||
235 | ERROR1: | 239 | ERROR1: |
@@ -241,11 +245,11 @@ ERROR0: | |||
241 | 245 | ||
242 | static void i2c_parport_detach (struct parport *port) | 246 | static void i2c_parport_detach (struct parport *port) |
243 | { | 247 | { |
244 | struct i2c_par *adapter, *prev; | 248 | struct i2c_par *adapter, *_n; |
245 | 249 | ||
246 | /* Walk the list */ | 250 | /* Walk the list */ |
247 | for (prev = NULL, adapter = adapter_list; adapter; | 251 | mutex_lock(&adapter_list_lock); |
248 | prev = adapter, adapter = adapter->next) { | 252 | list_for_each_entry_safe(adapter, _n, &adapter_list, node) { |
249 | if (adapter->pdev->port == port) { | 253 | if (adapter->pdev->port == port) { |
250 | if (adapter->ara) { | 254 | if (adapter->ara) { |
251 | parport_disable_irq(port); | 255 | parport_disable_irq(port); |
@@ -259,14 +263,11 @@ static void i2c_parport_detach (struct parport *port) | |||
259 | 263 | ||
260 | parport_release(adapter->pdev); | 264 | parport_release(adapter->pdev); |
261 | parport_unregister_device(adapter->pdev); | 265 | parport_unregister_device(adapter->pdev); |
262 | if (prev) | 266 | list_del(&adapter->node); |
263 | prev->next = adapter->next; | ||
264 | else | ||
265 | adapter_list = adapter->next; | ||
266 | kfree(adapter); | 267 | kfree(adapter); |
267 | return; | ||
268 | } | 268 | } |
269 | } | 269 | } |
270 | mutex_unlock(&adapter_list_lock); | ||
270 | } | 271 | } |
271 | 272 | ||
272 | static struct parport_driver i2c_parport_driver = { | 273 | static struct parport_driver i2c_parport_driver = { |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 70c30e6bce0b..9a58994ff7ea 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -797,7 +797,8 @@ static int i2c_do_add_adapter(struct i2c_driver *driver, | |||
797 | 797 | ||
798 | /* Let legacy drivers scan this bus for matching devices */ | 798 | /* Let legacy drivers scan this bus for matching devices */ |
799 | if (driver->attach_adapter) { | 799 | if (driver->attach_adapter) { |
800 | dev_warn(&adap->dev, "attach_adapter method is deprecated\n"); | 800 | dev_warn(&adap->dev, "%s: attach_adapter method is deprecated\n", |
801 | driver->driver.name); | ||
801 | dev_warn(&adap->dev, "Please use another way to instantiate " | 802 | dev_warn(&adap->dev, "Please use another way to instantiate " |
802 | "your i2c_client\n"); | 803 | "your i2c_client\n"); |
803 | /* We ignore the return code; if it fails, too bad */ | 804 | /* We ignore the return code; if it fails, too bad */ |
@@ -984,7 +985,8 @@ static int i2c_do_del_adapter(struct i2c_driver *driver, | |||
984 | 985 | ||
985 | if (!driver->detach_adapter) | 986 | if (!driver->detach_adapter) |
986 | return 0; | 987 | return 0; |
987 | dev_warn(&adapter->dev, "detach_adapter method is deprecated\n"); | 988 | dev_warn(&adapter->dev, "%s: detach_adapter method is deprecated\n", |
989 | driver->driver.name); | ||
988 | res = driver->detach_adapter(adapter); | 990 | res = driver->detach_adapter(adapter); |
989 | if (res) | 991 | if (res) |
990 | dev_err(&adapter->dev, "detach_adapter failed (%d) " | 992 | dev_err(&adapter->dev, "detach_adapter failed (%d) " |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index fd1e11799137..a5ec5a7cb381 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1782,7 +1782,6 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
1782 | ide_cd_read_toc(drive, &sense); | 1782 | ide_cd_read_toc(drive, &sense); |
1783 | g->fops = &idecd_ops; | 1783 | g->fops = &idecd_ops; |
1784 | g->flags |= GENHD_FL_REMOVABLE; | 1784 | g->flags |= GENHD_FL_REMOVABLE; |
1785 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
1786 | add_disk(g); | 1785 | add_disk(g); |
1787 | return 0; | 1786 | return 0; |
1788 | 1787 | ||
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c index 2a6bc50e8a41..02caa7dd51c8 100644 --- a/drivers/ide/ide-cd_ioctl.c +++ b/drivers/ide/ide-cd_ioctl.c | |||
@@ -79,6 +79,12 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr) | |||
79 | return CDS_DRIVE_NOT_READY; | 79 | return CDS_DRIVE_NOT_READY; |
80 | } | 80 | } |
81 | 81 | ||
82 | /* | ||
83 | * ide-cd always generates media changed event if media is missing, which | ||
84 | * makes it impossible to use for proper event reporting, so disk->events | ||
85 | * is cleared to 0 and the following function is used only to trigger | ||
86 | * revalidation and never propagated to userland. | ||
87 | */ | ||
82 | unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *cdi, | 88 | unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *cdi, |
83 | unsigned int clearing, int slot_nr) | 89 | unsigned int clearing, int slot_nr) |
84 | { | 90 | { |
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index c4ffd4888939..70ea8763567d 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c | |||
@@ -298,6 +298,12 @@ static unsigned int ide_gd_check_events(struct gendisk *disk, | |||
298 | return 0; | 298 | return 0; |
299 | } | 299 | } |
300 | 300 | ||
301 | /* | ||
302 | * The following is used to force revalidation on the first open on | ||
303 | * removeable devices, and never gets reported to userland as | ||
304 | * genhd->events is 0. This is intended as removeable ide disk | ||
305 | * can't really detect MEDIA_CHANGE events. | ||
306 | */ | ||
301 | ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED; | 307 | ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED; |
302 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; | 308 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; |
303 | 309 | ||
@@ -413,7 +419,6 @@ static int ide_gd_probe(ide_drive_t *drive) | |||
413 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) | 419 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) |
414 | g->flags = GENHD_FL_REMOVABLE; | 420 | g->flags = GENHD_FL_REMOVABLE; |
415 | g->fops = &ide_gd_ops; | 421 | g->fops = &ide_gd_ops; |
416 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
417 | add_disk(g); | 422 | add_disk(g); |
418 | return 0; | 423 | return 0; |
419 | 424 | ||
diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c index 7de4b7ebffc5..d8ca0a0b970d 100644 --- a/drivers/infiniband/hw/qib/qib_iba6120.c +++ b/drivers/infiniband/hw/qib/qib_iba6120.c | |||
@@ -1799,7 +1799,7 @@ static int qib_6120_setup_reset(struct qib_devdata *dd) | |||
1799 | /* | 1799 | /* |
1800 | * Keep chip from being accessed until we are ready. Use | 1800 | * Keep chip from being accessed until we are ready. Use |
1801 | * writeq() directly, to allow the write even though QIB_PRESENT | 1801 | * writeq() directly, to allow the write even though QIB_PRESENT |
1802 | * isn't' set. | 1802 | * isn't set. |
1803 | */ | 1803 | */ |
1804 | dd->flags &= ~(QIB_INITTED | QIB_PRESENT); | 1804 | dd->flags &= ~(QIB_INITTED | QIB_PRESENT); |
1805 | dd->int_counter = 0; /* so we check interrupts work again */ | 1805 | dd->int_counter = 0; /* so we check interrupts work again */ |
diff --git a/drivers/infiniband/hw/qib/qib_iba7220.c b/drivers/infiniband/hw/qib/qib_iba7220.c index 74fe0360bec7..c765a2eb04cf 100644 --- a/drivers/infiniband/hw/qib/qib_iba7220.c +++ b/drivers/infiniband/hw/qib/qib_iba7220.c | |||
@@ -2111,7 +2111,7 @@ static int qib_setup_7220_reset(struct qib_devdata *dd) | |||
2111 | /* | 2111 | /* |
2112 | * Keep chip from being accessed until we are ready. Use | 2112 | * Keep chip from being accessed until we are ready. Use |
2113 | * writeq() directly, to allow the write even though QIB_PRESENT | 2113 | * writeq() directly, to allow the write even though QIB_PRESENT |
2114 | * isn't' set. | 2114 | * isn't set. |
2115 | */ | 2115 | */ |
2116 | dd->flags &= ~(QIB_INITTED | QIB_PRESENT); | 2116 | dd->flags &= ~(QIB_INITTED | QIB_PRESENT); |
2117 | dd->int_counter = 0; /* so we check interrupts work again */ | 2117 | dd->int_counter = 0; /* so we check interrupts work again */ |
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index 55de3cf3441c..6bab3eaea70f 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c | |||
@@ -3299,7 +3299,7 @@ static int qib_do_7322_reset(struct qib_devdata *dd) | |||
3299 | /* | 3299 | /* |
3300 | * Keep chip from being accessed until we are ready. Use | 3300 | * Keep chip from being accessed until we are ready. Use |
3301 | * writeq() directly, to allow the write even though QIB_PRESENT | 3301 | * writeq() directly, to allow the write even though QIB_PRESENT |
3302 | * isn't' set. | 3302 | * isn't set. |
3303 | */ | 3303 | */ |
3304 | dd->flags &= ~(QIB_INITTED | QIB_PRESENT | QIB_BADINTR); | 3304 | dd->flags &= ~(QIB_INITTED | QIB_PRESENT | QIB_BADINTR); |
3305 | dd->flags |= QIB_DOING_RESET; | 3305 | dd->flags |= QIB_DOING_RESET; |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 7f42d3a454d2..88d8e4cb419a 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -39,13 +39,13 @@ struct evdev { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | struct evdev_client { | 41 | struct evdev_client { |
42 | int head; | 42 | unsigned int head; |
43 | int tail; | 43 | unsigned int tail; |
44 | spinlock_t buffer_lock; /* protects access to buffer, head and tail */ | 44 | spinlock_t buffer_lock; /* protects access to buffer, head and tail */ |
45 | struct fasync_struct *fasync; | 45 | struct fasync_struct *fasync; |
46 | struct evdev *evdev; | 46 | struct evdev *evdev; |
47 | struct list_head node; | 47 | struct list_head node; |
48 | int bufsize; | 48 | unsigned int bufsize; |
49 | struct input_event buffer[]; | 49 | struct input_event buffer[]; |
50 | }; | 50 | }; |
51 | 51 | ||
@@ -55,16 +55,25 @@ static DEFINE_MUTEX(evdev_table_mutex); | |||
55 | static void evdev_pass_event(struct evdev_client *client, | 55 | static void evdev_pass_event(struct evdev_client *client, |
56 | struct input_event *event) | 56 | struct input_event *event) |
57 | { | 57 | { |
58 | /* | 58 | /* Interrupts are disabled, just acquire the lock. */ |
59 | * Interrupts are disabled, just acquire the lock. | ||
60 | * Make sure we don't leave with the client buffer | ||
61 | * "empty" by having client->head == client->tail. | ||
62 | */ | ||
63 | spin_lock(&client->buffer_lock); | 59 | spin_lock(&client->buffer_lock); |
64 | do { | 60 | |
65 | client->buffer[client->head++] = *event; | 61 | client->buffer[client->head++] = *event; |
66 | client->head &= client->bufsize - 1; | 62 | client->head &= client->bufsize - 1; |
67 | } while (client->head == client->tail); | 63 | |
64 | if (unlikely(client->head == client->tail)) { | ||
65 | /* | ||
66 | * This effectively "drops" all unconsumed events, leaving | ||
67 | * EV_SYN/SYN_DROPPED plus the newest event in the queue. | ||
68 | */ | ||
69 | client->tail = (client->head - 2) & (client->bufsize - 1); | ||
70 | |||
71 | client->buffer[client->tail].time = event->time; | ||
72 | client->buffer[client->tail].type = EV_SYN; | ||
73 | client->buffer[client->tail].code = SYN_DROPPED; | ||
74 | client->buffer[client->tail].value = 0; | ||
75 | } | ||
76 | |||
68 | spin_unlock(&client->buffer_lock); | 77 | spin_unlock(&client->buffer_lock); |
69 | 78 | ||
70 | if (event->type == EV_SYN) | 79 | if (event->type == EV_SYN) |
diff --git a/drivers/input/input.c b/drivers/input/input.c index d6e8bd8a851c..ebbceedc92f4 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -1746,6 +1746,42 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int | |||
1746 | } | 1746 | } |
1747 | EXPORT_SYMBOL(input_set_capability); | 1747 | EXPORT_SYMBOL(input_set_capability); |
1748 | 1748 | ||
1749 | static unsigned int input_estimate_events_per_packet(struct input_dev *dev) | ||
1750 | { | ||
1751 | int mt_slots; | ||
1752 | int i; | ||
1753 | unsigned int events; | ||
1754 | |||
1755 | if (dev->mtsize) { | ||
1756 | mt_slots = dev->mtsize; | ||
1757 | } else if (test_bit(ABS_MT_TRACKING_ID, dev->absbit)) { | ||
1758 | mt_slots = dev->absinfo[ABS_MT_TRACKING_ID].maximum - | ||
1759 | dev->absinfo[ABS_MT_TRACKING_ID].minimum + 1, | ||
1760 | clamp(mt_slots, 2, 32); | ||
1761 | } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) { | ||
1762 | mt_slots = 2; | ||
1763 | } else { | ||
1764 | mt_slots = 0; | ||
1765 | } | ||
1766 | |||
1767 | events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */ | ||
1768 | |||
1769 | for (i = 0; i < ABS_CNT; i++) { | ||
1770 | if (test_bit(i, dev->absbit)) { | ||
1771 | if (input_is_mt_axis(i)) | ||
1772 | events += mt_slots; | ||
1773 | else | ||
1774 | events++; | ||
1775 | } | ||
1776 | } | ||
1777 | |||
1778 | for (i = 0; i < REL_CNT; i++) | ||
1779 | if (test_bit(i, dev->relbit)) | ||
1780 | events++; | ||
1781 | |||
1782 | return events; | ||
1783 | } | ||
1784 | |||
1749 | #define INPUT_CLEANSE_BITMASK(dev, type, bits) \ | 1785 | #define INPUT_CLEANSE_BITMASK(dev, type, bits) \ |
1750 | do { \ | 1786 | do { \ |
1751 | if (!test_bit(EV_##type, dev->evbit)) \ | 1787 | if (!test_bit(EV_##type, dev->evbit)) \ |
@@ -1793,6 +1829,10 @@ int input_register_device(struct input_dev *dev) | |||
1793 | /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ | 1829 | /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ |
1794 | input_cleanse_bitmasks(dev); | 1830 | input_cleanse_bitmasks(dev); |
1795 | 1831 | ||
1832 | if (!dev->hint_events_per_packet) | ||
1833 | dev->hint_events_per_packet = | ||
1834 | input_estimate_events_per_packet(dev); | ||
1835 | |||
1796 | /* | 1836 | /* |
1797 | * If delay and period are pre-set by the driver, then autorepeating | 1837 | * If delay and period are pre-set by the driver, then autorepeating |
1798 | * is handled by the driver itself and we don't do it in input.c. | 1838 | * is handled by the driver itself and we don't do it in input.c. |
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index 09bef79d9da1..a26922cf0e84 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c | |||
@@ -332,18 +332,20 @@ static int __devinit twl4030_kp_program(struct twl4030_keypad *kp) | |||
332 | static int __devinit twl4030_kp_probe(struct platform_device *pdev) | 332 | static int __devinit twl4030_kp_probe(struct platform_device *pdev) |
333 | { | 333 | { |
334 | struct twl4030_keypad_data *pdata = pdev->dev.platform_data; | 334 | struct twl4030_keypad_data *pdata = pdev->dev.platform_data; |
335 | const struct matrix_keymap_data *keymap_data = pdata->keymap_data; | 335 | const struct matrix_keymap_data *keymap_data; |
336 | struct twl4030_keypad *kp; | 336 | struct twl4030_keypad *kp; |
337 | struct input_dev *input; | 337 | struct input_dev *input; |
338 | u8 reg; | 338 | u8 reg; |
339 | int error; | 339 | int error; |
340 | 340 | ||
341 | if (!pdata || !pdata->rows || !pdata->cols || | 341 | if (!pdata || !pdata->rows || !pdata->cols || !pdata->keymap_data || |
342 | pdata->rows > TWL4030_MAX_ROWS || pdata->cols > TWL4030_MAX_COLS) { | 342 | pdata->rows > TWL4030_MAX_ROWS || pdata->cols > TWL4030_MAX_COLS) { |
343 | dev_err(&pdev->dev, "Invalid platform_data\n"); | 343 | dev_err(&pdev->dev, "Invalid platform_data\n"); |
344 | return -EINVAL; | 344 | return -EINVAL; |
345 | } | 345 | } |
346 | 346 | ||
347 | keymap_data = pdata->keymap_data; | ||
348 | |||
347 | kp = kzalloc(sizeof(*kp), GFP_KERNEL); | 349 | kp = kzalloc(sizeof(*kp), GFP_KERNEL); |
348 | input = input_allocate_device(); | 350 | input = input_allocate_device(); |
349 | if (!kp || !input) { | 351 | if (!kp || !input) { |
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c index 7077f9bf5ead..62bae99424e6 100644 --- a/drivers/input/misc/xen-kbdfront.c +++ b/drivers/input/misc/xen-kbdfront.c | |||
@@ -303,7 +303,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev, | |||
303 | enum xenbus_state backend_state) | 303 | enum xenbus_state backend_state) |
304 | { | 304 | { |
305 | struct xenkbd_info *info = dev_get_drvdata(&dev->dev); | 305 | struct xenkbd_info *info = dev_get_drvdata(&dev->dev); |
306 | int val; | 306 | int ret, val; |
307 | 307 | ||
308 | switch (backend_state) { | 308 | switch (backend_state) { |
309 | case XenbusStateInitialising: | 309 | case XenbusStateInitialising: |
@@ -316,6 +316,17 @@ static void xenkbd_backend_changed(struct xenbus_device *dev, | |||
316 | 316 | ||
317 | case XenbusStateInitWait: | 317 | case XenbusStateInitWait: |
318 | InitWait: | 318 | InitWait: |
319 | ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend, | ||
320 | "feature-abs-pointer", "%d", &val); | ||
321 | if (ret < 0) | ||
322 | val = 0; | ||
323 | if (val) { | ||
324 | ret = xenbus_printf(XBT_NIL, info->xbdev->nodename, | ||
325 | "request-abs-pointer", "1"); | ||
326 | if (ret) | ||
327 | pr_warning("xenkbd: can't request abs-pointer"); | ||
328 | } | ||
329 | |||
319 | xenbus_switch_state(dev, XenbusStateConnected); | 330 | xenbus_switch_state(dev, XenbusStateConnected); |
320 | break; | 331 | break; |
321 | 332 | ||
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c index efa06882de00..45f93d0f5592 100644 --- a/drivers/input/touchscreen/h3600_ts_input.c +++ b/drivers/input/touchscreen/h3600_ts_input.c | |||
@@ -399,31 +399,34 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv) | |||
399 | IRQF_SHARED | IRQF_DISABLED, "h3600_action", &ts->dev)) { | 399 | IRQF_SHARED | IRQF_DISABLED, "h3600_action", &ts->dev)) { |
400 | printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); | 400 | printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); |
401 | err = -EBUSY; | 401 | err = -EBUSY; |
402 | goto fail2; | 402 | goto fail1; |
403 | } | 403 | } |
404 | 404 | ||
405 | if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, | 405 | if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, |
406 | IRQF_SHARED | IRQF_DISABLED, "h3600_suspend", &ts->dev)) { | 406 | IRQF_SHARED | IRQF_DISABLED, "h3600_suspend", &ts->dev)) { |
407 | printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n"); | 407 | printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n"); |
408 | err = -EBUSY; | 408 | err = -EBUSY; |
409 | goto fail3; | 409 | goto fail2; |
410 | } | 410 | } |
411 | 411 | ||
412 | serio_set_drvdata(serio, ts); | 412 | serio_set_drvdata(serio, ts); |
413 | 413 | ||
414 | err = serio_open(serio, drv); | 414 | err = serio_open(serio, drv); |
415 | if (err) | 415 | if (err) |
416 | return err; | 416 | goto fail3; |
417 | 417 | ||
418 | //h3600_flite_control(1, 25); /* default brightness */ | 418 | //h3600_flite_control(1, 25); /* default brightness */ |
419 | input_register_device(ts->dev); | 419 | err = input_register_device(ts->dev); |
420 | if (err) | ||
421 | goto fail4; | ||
420 | 422 | ||
421 | return 0; | 423 | return 0; |
422 | 424 | ||
423 | fail3: free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev); | 425 | fail4: serio_close(serio); |
426 | fail3: serio_set_drvdata(serio, NULL); | ||
427 | free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev); | ||
424 | fail2: free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts->dev); | 428 | fail2: free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts->dev); |
425 | fail1: serio_set_drvdata(serio, NULL); | 429 | fail1: input_free_device(input_dev); |
426 | input_free_device(input_dev); | ||
427 | kfree(ts); | 430 | kfree(ts); |
428 | return err; | 431 | return err; |
429 | } | 432 | } |
diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c index 3790816643be..8497f56f8e46 100644 --- a/drivers/leds/leds-regulator.c +++ b/drivers/leds/leds-regulator.c | |||
@@ -178,6 +178,10 @@ static int __devinit regulator_led_probe(struct platform_device *pdev) | |||
178 | led->cdev.flags |= LED_CORE_SUSPENDRESUME; | 178 | led->cdev.flags |= LED_CORE_SUSPENDRESUME; |
179 | led->vcc = vcc; | 179 | led->vcc = vcc; |
180 | 180 | ||
181 | /* to handle correctly an already enabled regulator */ | ||
182 | if (regulator_is_enabled(led->vcc)) | ||
183 | led->enabled = 1; | ||
184 | |||
181 | mutex_init(&led->mutex); | 185 | mutex_init(&led->mutex); |
182 | INIT_WORK(&led->work, led_work); | 186 | INIT_WORK(&led->work, led_work); |
183 | 187 | ||
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 5ef136cdba91..e5d8904fc8f6 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
@@ -390,13 +390,6 @@ static int raid_is_congested(struct dm_target_callbacks *cb, int bits) | |||
390 | return md_raid5_congested(&rs->md, bits); | 390 | return md_raid5_congested(&rs->md, bits); |
391 | } | 391 | } |
392 | 392 | ||
393 | static void raid_unplug(struct dm_target_callbacks *cb) | ||
394 | { | ||
395 | struct raid_set *rs = container_of(cb, struct raid_set, callbacks); | ||
396 | |||
397 | md_raid5_kick_device(rs->md.private); | ||
398 | } | ||
399 | |||
400 | /* | 393 | /* |
401 | * Construct a RAID4/5/6 mapping: | 394 | * Construct a RAID4/5/6 mapping: |
402 | * Args: | 395 | * Args: |
@@ -487,7 +480,6 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
487 | } | 480 | } |
488 | 481 | ||
489 | rs->callbacks.congested_fn = raid_is_congested; | 482 | rs->callbacks.congested_fn = raid_is_congested; |
490 | rs->callbacks.unplug_fn = raid_unplug; | ||
491 | dm_table_add_target_callbacks(ti->table, &rs->callbacks); | 483 | dm_table_add_target_callbacks(ti->table, &rs->callbacks); |
492 | 484 | ||
493 | return 0; | 485 | return 0; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index b12b3776c0c0..7d6f7f18a920 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -447,48 +447,59 @@ EXPORT_SYMBOL(md_flush_request); | |||
447 | 447 | ||
448 | /* Support for plugging. | 448 | /* Support for plugging. |
449 | * This mirrors the plugging support in request_queue, but does not | 449 | * This mirrors the plugging support in request_queue, but does not |
450 | * require having a whole queue | 450 | * require having a whole queue or request structures. |
451 | * We allocate an md_plug_cb for each md device and each thread it gets | ||
452 | * plugged on. This links tot the private plug_handle structure in the | ||
453 | * personality data where we keep a count of the number of outstanding | ||
454 | * plugs so other code can see if a plug is active. | ||
451 | */ | 455 | */ |
452 | static void plugger_work(struct work_struct *work) | 456 | struct md_plug_cb { |
453 | { | 457 | struct blk_plug_cb cb; |
454 | struct plug_handle *plug = | 458 | mddev_t *mddev; |
455 | container_of(work, struct plug_handle, unplug_work); | 459 | }; |
456 | plug->unplug_fn(plug); | ||
457 | } | ||
458 | static void plugger_timeout(unsigned long data) | ||
459 | { | ||
460 | struct plug_handle *plug = (void *)data; | ||
461 | kblockd_schedule_work(NULL, &plug->unplug_work); | ||
462 | } | ||
463 | void plugger_init(struct plug_handle *plug, | ||
464 | void (*unplug_fn)(struct plug_handle *)) | ||
465 | { | ||
466 | plug->unplug_flag = 0; | ||
467 | plug->unplug_fn = unplug_fn; | ||
468 | init_timer(&plug->unplug_timer); | ||
469 | plug->unplug_timer.function = plugger_timeout; | ||
470 | plug->unplug_timer.data = (unsigned long)plug; | ||
471 | INIT_WORK(&plug->unplug_work, plugger_work); | ||
472 | } | ||
473 | EXPORT_SYMBOL_GPL(plugger_init); | ||
474 | 460 | ||
475 | void plugger_set_plug(struct plug_handle *plug) | 461 | static void plugger_unplug(struct blk_plug_cb *cb) |
476 | { | 462 | { |
477 | if (!test_and_set_bit(PLUGGED_FLAG, &plug->unplug_flag)) | 463 | struct md_plug_cb *mdcb = container_of(cb, struct md_plug_cb, cb); |
478 | mod_timer(&plug->unplug_timer, jiffies + msecs_to_jiffies(3)+1); | 464 | if (atomic_dec_and_test(&mdcb->mddev->plug_cnt)) |
465 | md_wakeup_thread(mdcb->mddev->thread); | ||
466 | kfree(mdcb); | ||
479 | } | 467 | } |
480 | EXPORT_SYMBOL_GPL(plugger_set_plug); | ||
481 | 468 | ||
482 | int plugger_remove_plug(struct plug_handle *plug) | 469 | /* Check that an unplug wakeup will come shortly. |
470 | * If not, wakeup the md thread immediately | ||
471 | */ | ||
472 | int mddev_check_plugged(mddev_t *mddev) | ||
483 | { | 473 | { |
484 | if (test_and_clear_bit(PLUGGED_FLAG, &plug->unplug_flag)) { | 474 | struct blk_plug *plug = current->plug; |
485 | del_timer(&plug->unplug_timer); | 475 | struct md_plug_cb *mdcb; |
486 | return 1; | 476 | |
487 | } else | 477 | if (!plug) |
488 | return 0; | 478 | return 0; |
489 | } | ||
490 | EXPORT_SYMBOL_GPL(plugger_remove_plug); | ||
491 | 479 | ||
480 | list_for_each_entry(mdcb, &plug->cb_list, cb.list) { | ||
481 | if (mdcb->cb.callback == plugger_unplug && | ||
482 | mdcb->mddev == mddev) { | ||
483 | /* Already on the list, move to top */ | ||
484 | if (mdcb != list_first_entry(&plug->cb_list, | ||
485 | struct md_plug_cb, | ||
486 | cb.list)) | ||
487 | list_move(&mdcb->cb.list, &plug->cb_list); | ||
488 | return 1; | ||
489 | } | ||
490 | } | ||
491 | /* Not currently on the callback list */ | ||
492 | mdcb = kmalloc(sizeof(*mdcb), GFP_ATOMIC); | ||
493 | if (!mdcb) | ||
494 | return 0; | ||
495 | |||
496 | mdcb->mddev = mddev; | ||
497 | mdcb->cb.callback = plugger_unplug; | ||
498 | atomic_inc(&mddev->plug_cnt); | ||
499 | list_add(&mdcb->cb.list, &plug->cb_list); | ||
500 | return 1; | ||
501 | } | ||
502 | EXPORT_SYMBOL_GPL(mddev_check_plugged); | ||
492 | 503 | ||
493 | static inline mddev_t *mddev_get(mddev_t *mddev) | 504 | static inline mddev_t *mddev_get(mddev_t *mddev) |
494 | { | 505 | { |
@@ -538,6 +549,7 @@ void mddev_init(mddev_t *mddev) | |||
538 | atomic_set(&mddev->active, 1); | 549 | atomic_set(&mddev->active, 1); |
539 | atomic_set(&mddev->openers, 0); | 550 | atomic_set(&mddev->openers, 0); |
540 | atomic_set(&mddev->active_io, 0); | 551 | atomic_set(&mddev->active_io, 0); |
552 | atomic_set(&mddev->plug_cnt, 0); | ||
541 | spin_lock_init(&mddev->write_lock); | 553 | spin_lock_init(&mddev->write_lock); |
542 | atomic_set(&mddev->flush_pending, 0); | 554 | atomic_set(&mddev->flush_pending, 0); |
543 | init_waitqueue_head(&mddev->sb_wait); | 555 | init_waitqueue_head(&mddev->sb_wait); |
@@ -3158,6 +3170,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len) | |||
3158 | mddev->layout = mddev->new_layout; | 3170 | mddev->layout = mddev->new_layout; |
3159 | mddev->chunk_sectors = mddev->new_chunk_sectors; | 3171 | mddev->chunk_sectors = mddev->new_chunk_sectors; |
3160 | mddev->delta_disks = 0; | 3172 | mddev->delta_disks = 0; |
3173 | mddev->degraded = 0; | ||
3161 | if (mddev->pers->sync_request == NULL) { | 3174 | if (mddev->pers->sync_request == NULL) { |
3162 | /* this is now an array without redundancy, so | 3175 | /* this is now an array without redundancy, so |
3163 | * it must always be in_sync | 3176 | * it must always be in_sync |
@@ -4723,7 +4736,6 @@ static void md_clean(mddev_t *mddev) | |||
4723 | mddev->bitmap_info.chunksize = 0; | 4736 | mddev->bitmap_info.chunksize = 0; |
4724 | mddev->bitmap_info.daemon_sleep = 0; | 4737 | mddev->bitmap_info.daemon_sleep = 0; |
4725 | mddev->bitmap_info.max_write_behind = 0; | 4738 | mddev->bitmap_info.max_write_behind = 0; |
4726 | mddev->plug = NULL; | ||
4727 | } | 4739 | } |
4728 | 4740 | ||
4729 | static void __md_stop_writes(mddev_t *mddev) | 4741 | static void __md_stop_writes(mddev_t *mddev) |
@@ -6688,12 +6700,6 @@ int md_allow_write(mddev_t *mddev) | |||
6688 | } | 6700 | } |
6689 | EXPORT_SYMBOL_GPL(md_allow_write); | 6701 | EXPORT_SYMBOL_GPL(md_allow_write); |
6690 | 6702 | ||
6691 | void md_unplug(mddev_t *mddev) | ||
6692 | { | ||
6693 | if (mddev->plug) | ||
6694 | mddev->plug->unplug_fn(mddev->plug); | ||
6695 | } | ||
6696 | |||
6697 | #define SYNC_MARKS 10 | 6703 | #define SYNC_MARKS 10 |
6698 | #define SYNC_MARK_STEP (3*HZ) | 6704 | #define SYNC_MARK_STEP (3*HZ) |
6699 | void md_do_sync(mddev_t *mddev) | 6705 | void md_do_sync(mddev_t *mddev) |
diff --git a/drivers/md/md.h b/drivers/md/md.h index 52b407369e13..0b1fd3f1d85b 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -29,26 +29,6 @@ | |||
29 | typedef struct mddev_s mddev_t; | 29 | typedef struct mddev_s mddev_t; |
30 | typedef struct mdk_rdev_s mdk_rdev_t; | 30 | typedef struct mdk_rdev_s mdk_rdev_t; |
31 | 31 | ||
32 | /* generic plugging support - like that provided with request_queue, | ||
33 | * but does not require a request_queue | ||
34 | */ | ||
35 | struct plug_handle { | ||
36 | void (*unplug_fn)(struct plug_handle *); | ||
37 | struct timer_list unplug_timer; | ||
38 | struct work_struct unplug_work; | ||
39 | unsigned long unplug_flag; | ||
40 | }; | ||
41 | #define PLUGGED_FLAG 1 | ||
42 | void plugger_init(struct plug_handle *plug, | ||
43 | void (*unplug_fn)(struct plug_handle *)); | ||
44 | void plugger_set_plug(struct plug_handle *plug); | ||
45 | int plugger_remove_plug(struct plug_handle *plug); | ||
46 | static inline void plugger_flush(struct plug_handle *plug) | ||
47 | { | ||
48 | del_timer_sync(&plug->unplug_timer); | ||
49 | cancel_work_sync(&plug->unplug_work); | ||
50 | } | ||
51 | |||
52 | /* | 32 | /* |
53 | * MD's 'extended' device | 33 | * MD's 'extended' device |
54 | */ | 34 | */ |
@@ -199,6 +179,9 @@ struct mddev_s | |||
199 | int delta_disks, new_level, new_layout; | 179 | int delta_disks, new_level, new_layout; |
200 | int new_chunk_sectors; | 180 | int new_chunk_sectors; |
201 | 181 | ||
182 | atomic_t plug_cnt; /* If device is expecting | ||
183 | * more bios soon. | ||
184 | */ | ||
202 | struct mdk_thread_s *thread; /* management thread */ | 185 | struct mdk_thread_s *thread; /* management thread */ |
203 | struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */ | 186 | struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */ |
204 | sector_t curr_resync; /* last block scheduled */ | 187 | sector_t curr_resync; /* last block scheduled */ |
@@ -336,7 +319,6 @@ struct mddev_s | |||
336 | struct list_head all_mddevs; | 319 | struct list_head all_mddevs; |
337 | 320 | ||
338 | struct attribute_group *to_remove; | 321 | struct attribute_group *to_remove; |
339 | struct plug_handle *plug; /* if used by personality */ | ||
340 | 322 | ||
341 | struct bio_set *bio_set; | 323 | struct bio_set *bio_set; |
342 | 324 | ||
@@ -516,7 +498,6 @@ extern int md_integrity_register(mddev_t *mddev); | |||
516 | extern void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev); | 498 | extern void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev); |
517 | extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); | 499 | extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); |
518 | extern void restore_bitmap_write_access(struct file *file); | 500 | extern void restore_bitmap_write_access(struct file *file); |
519 | extern void md_unplug(mddev_t *mddev); | ||
520 | 501 | ||
521 | extern void mddev_init(mddev_t *mddev); | 502 | extern void mddev_init(mddev_t *mddev); |
522 | extern int md_run(mddev_t *mddev); | 503 | extern int md_run(mddev_t *mddev); |
@@ -530,4 +511,5 @@ extern struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, | |||
530 | mddev_t *mddev); | 511 | mddev_t *mddev); |
531 | extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, | 512 | extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, |
532 | mddev_t *mddev); | 513 | mddev_t *mddev); |
514 | extern int mddev_check_plugged(mddev_t *mddev); | ||
533 | #endif /* _MD_MD_H */ | 515 | #endif /* _MD_MD_H */ |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index c2a21ae56d97..2b7a7ff401dc 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -565,12 +565,6 @@ static void flush_pending_writes(conf_t *conf) | |||
565 | spin_unlock_irq(&conf->device_lock); | 565 | spin_unlock_irq(&conf->device_lock); |
566 | } | 566 | } |
567 | 567 | ||
568 | static void md_kick_device(mddev_t *mddev) | ||
569 | { | ||
570 | blk_flush_plug(current); | ||
571 | md_wakeup_thread(mddev->thread); | ||
572 | } | ||
573 | |||
574 | /* Barriers.... | 568 | /* Barriers.... |
575 | * Sometimes we need to suspend IO while we do something else, | 569 | * Sometimes we need to suspend IO while we do something else, |
576 | * either some resync/recovery, or reconfigure the array. | 570 | * either some resync/recovery, or reconfigure the array. |
@@ -600,7 +594,7 @@ static void raise_barrier(conf_t *conf) | |||
600 | 594 | ||
601 | /* Wait until no block IO is waiting */ | 595 | /* Wait until no block IO is waiting */ |
602 | wait_event_lock_irq(conf->wait_barrier, !conf->nr_waiting, | 596 | wait_event_lock_irq(conf->wait_barrier, !conf->nr_waiting, |
603 | conf->resync_lock, md_kick_device(conf->mddev)); | 597 | conf->resync_lock, ); |
604 | 598 | ||
605 | /* block any new IO from starting */ | 599 | /* block any new IO from starting */ |
606 | conf->barrier++; | 600 | conf->barrier++; |
@@ -608,7 +602,7 @@ static void raise_barrier(conf_t *conf) | |||
608 | /* Now wait for all pending IO to complete */ | 602 | /* Now wait for all pending IO to complete */ |
609 | wait_event_lock_irq(conf->wait_barrier, | 603 | wait_event_lock_irq(conf->wait_barrier, |
610 | !conf->nr_pending && conf->barrier < RESYNC_DEPTH, | 604 | !conf->nr_pending && conf->barrier < RESYNC_DEPTH, |
611 | conf->resync_lock, md_kick_device(conf->mddev)); | 605 | conf->resync_lock, ); |
612 | 606 | ||
613 | spin_unlock_irq(&conf->resync_lock); | 607 | spin_unlock_irq(&conf->resync_lock); |
614 | } | 608 | } |
@@ -630,7 +624,7 @@ static void wait_barrier(conf_t *conf) | |||
630 | conf->nr_waiting++; | 624 | conf->nr_waiting++; |
631 | wait_event_lock_irq(conf->wait_barrier, !conf->barrier, | 625 | wait_event_lock_irq(conf->wait_barrier, !conf->barrier, |
632 | conf->resync_lock, | 626 | conf->resync_lock, |
633 | md_kick_device(conf->mddev)); | 627 | ); |
634 | conf->nr_waiting--; | 628 | conf->nr_waiting--; |
635 | } | 629 | } |
636 | conf->nr_pending++; | 630 | conf->nr_pending++; |
@@ -666,8 +660,7 @@ static void freeze_array(conf_t *conf) | |||
666 | wait_event_lock_irq(conf->wait_barrier, | 660 | wait_event_lock_irq(conf->wait_barrier, |
667 | conf->nr_pending == conf->nr_queued+1, | 661 | conf->nr_pending == conf->nr_queued+1, |
668 | conf->resync_lock, | 662 | conf->resync_lock, |
669 | ({ flush_pending_writes(conf); | 663 | flush_pending_writes(conf)); |
670 | md_kick_device(conf->mddev); })); | ||
671 | spin_unlock_irq(&conf->resync_lock); | 664 | spin_unlock_irq(&conf->resync_lock); |
672 | } | 665 | } |
673 | static void unfreeze_array(conf_t *conf) | 666 | static void unfreeze_array(conf_t *conf) |
@@ -729,6 +722,7 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
729 | const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); | 722 | const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); |
730 | const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); | 723 | const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); |
731 | mdk_rdev_t *blocked_rdev; | 724 | mdk_rdev_t *blocked_rdev; |
725 | int plugged; | ||
732 | 726 | ||
733 | /* | 727 | /* |
734 | * Register the new request and wait if the reconstruction | 728 | * Register the new request and wait if the reconstruction |
@@ -820,6 +814,8 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
820 | * inc refcount on their rdev. Record them by setting | 814 | * inc refcount on their rdev. Record them by setting |
821 | * bios[x] to bio | 815 | * bios[x] to bio |
822 | */ | 816 | */ |
817 | plugged = mddev_check_plugged(mddev); | ||
818 | |||
823 | disks = conf->raid_disks; | 819 | disks = conf->raid_disks; |
824 | retry_write: | 820 | retry_write: |
825 | blocked_rdev = NULL; | 821 | blocked_rdev = NULL; |
@@ -925,7 +921,7 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
925 | /* In case raid1d snuck in to freeze_array */ | 921 | /* In case raid1d snuck in to freeze_array */ |
926 | wake_up(&conf->wait_barrier); | 922 | wake_up(&conf->wait_barrier); |
927 | 923 | ||
928 | if (do_sync || !bitmap) | 924 | if (do_sync || !bitmap || !plugged) |
929 | md_wakeup_thread(mddev->thread); | 925 | md_wakeup_thread(mddev->thread); |
930 | 926 | ||
931 | return 0; | 927 | return 0; |
@@ -1516,13 +1512,16 @@ static void raid1d(mddev_t *mddev) | |||
1516 | conf_t *conf = mddev->private; | 1512 | conf_t *conf = mddev->private; |
1517 | struct list_head *head = &conf->retry_list; | 1513 | struct list_head *head = &conf->retry_list; |
1518 | mdk_rdev_t *rdev; | 1514 | mdk_rdev_t *rdev; |
1515 | struct blk_plug plug; | ||
1519 | 1516 | ||
1520 | md_check_recovery(mddev); | 1517 | md_check_recovery(mddev); |
1521 | 1518 | ||
1519 | blk_start_plug(&plug); | ||
1522 | for (;;) { | 1520 | for (;;) { |
1523 | char b[BDEVNAME_SIZE]; | 1521 | char b[BDEVNAME_SIZE]; |
1524 | 1522 | ||
1525 | flush_pending_writes(conf); | 1523 | if (atomic_read(&mddev->plug_cnt) == 0) |
1524 | flush_pending_writes(conf); | ||
1526 | 1525 | ||
1527 | spin_lock_irqsave(&conf->device_lock, flags); | 1526 | spin_lock_irqsave(&conf->device_lock, flags); |
1528 | if (list_empty(head)) { | 1527 | if (list_empty(head)) { |
@@ -1593,6 +1592,7 @@ static void raid1d(mddev_t *mddev) | |||
1593 | } | 1592 | } |
1594 | cond_resched(); | 1593 | cond_resched(); |
1595 | } | 1594 | } |
1595 | blk_finish_plug(&plug); | ||
1596 | } | 1596 | } |
1597 | 1597 | ||
1598 | 1598 | ||
@@ -2039,7 +2039,6 @@ static int stop(mddev_t *mddev) | |||
2039 | 2039 | ||
2040 | md_unregister_thread(mddev->thread); | 2040 | md_unregister_thread(mddev->thread); |
2041 | mddev->thread = NULL; | 2041 | mddev->thread = NULL; |
2042 | blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ | ||
2043 | if (conf->r1bio_pool) | 2042 | if (conf->r1bio_pool) |
2044 | mempool_destroy(conf->r1bio_pool); | 2043 | mempool_destroy(conf->r1bio_pool); |
2045 | kfree(conf->mirrors); | 2044 | kfree(conf->mirrors); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 2da83d566592..8e9462626ec5 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -634,12 +634,6 @@ static void flush_pending_writes(conf_t *conf) | |||
634 | spin_unlock_irq(&conf->device_lock); | 634 | spin_unlock_irq(&conf->device_lock); |
635 | } | 635 | } |
636 | 636 | ||
637 | static void md_kick_device(mddev_t *mddev) | ||
638 | { | ||
639 | blk_flush_plug(current); | ||
640 | md_wakeup_thread(mddev->thread); | ||
641 | } | ||
642 | |||
643 | /* Barriers.... | 637 | /* Barriers.... |
644 | * Sometimes we need to suspend IO while we do something else, | 638 | * Sometimes we need to suspend IO while we do something else, |
645 | * either some resync/recovery, or reconfigure the array. | 639 | * either some resync/recovery, or reconfigure the array. |
@@ -669,15 +663,15 @@ static void raise_barrier(conf_t *conf, int force) | |||
669 | 663 | ||
670 | /* Wait until no block IO is waiting (unless 'force') */ | 664 | /* Wait until no block IO is waiting (unless 'force') */ |
671 | wait_event_lock_irq(conf->wait_barrier, force || !conf->nr_waiting, | 665 | wait_event_lock_irq(conf->wait_barrier, force || !conf->nr_waiting, |
672 | conf->resync_lock, md_kick_device(conf->mddev)); | 666 | conf->resync_lock, ); |
673 | 667 | ||
674 | /* block any new IO from starting */ | 668 | /* block any new IO from starting */ |
675 | conf->barrier++; | 669 | conf->barrier++; |
676 | 670 | ||
677 | /* No wait for all pending IO to complete */ | 671 | /* Now wait for all pending IO to complete */ |
678 | wait_event_lock_irq(conf->wait_barrier, | 672 | wait_event_lock_irq(conf->wait_barrier, |
679 | !conf->nr_pending && conf->barrier < RESYNC_DEPTH, | 673 | !conf->nr_pending && conf->barrier < RESYNC_DEPTH, |
680 | conf->resync_lock, md_kick_device(conf->mddev)); | 674 | conf->resync_lock, ); |
681 | 675 | ||
682 | spin_unlock_irq(&conf->resync_lock); | 676 | spin_unlock_irq(&conf->resync_lock); |
683 | } | 677 | } |
@@ -698,7 +692,7 @@ static void wait_barrier(conf_t *conf) | |||
698 | conf->nr_waiting++; | 692 | conf->nr_waiting++; |
699 | wait_event_lock_irq(conf->wait_barrier, !conf->barrier, | 693 | wait_event_lock_irq(conf->wait_barrier, !conf->barrier, |
700 | conf->resync_lock, | 694 | conf->resync_lock, |
701 | md_kick_device(conf->mddev)); | 695 | ); |
702 | conf->nr_waiting--; | 696 | conf->nr_waiting--; |
703 | } | 697 | } |
704 | conf->nr_pending++; | 698 | conf->nr_pending++; |
@@ -734,8 +728,8 @@ static void freeze_array(conf_t *conf) | |||
734 | wait_event_lock_irq(conf->wait_barrier, | 728 | wait_event_lock_irq(conf->wait_barrier, |
735 | conf->nr_pending == conf->nr_queued+1, | 729 | conf->nr_pending == conf->nr_queued+1, |
736 | conf->resync_lock, | 730 | conf->resync_lock, |
737 | ({ flush_pending_writes(conf); | 731 | flush_pending_writes(conf)); |
738 | md_kick_device(conf->mddev); })); | 732 | |
739 | spin_unlock_irq(&conf->resync_lock); | 733 | spin_unlock_irq(&conf->resync_lock); |
740 | } | 734 | } |
741 | 735 | ||
@@ -762,6 +756,7 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
762 | const unsigned long do_fua = (bio->bi_rw & REQ_FUA); | 756 | const unsigned long do_fua = (bio->bi_rw & REQ_FUA); |
763 | unsigned long flags; | 757 | unsigned long flags; |
764 | mdk_rdev_t *blocked_rdev; | 758 | mdk_rdev_t *blocked_rdev; |
759 | int plugged; | ||
765 | 760 | ||
766 | if (unlikely(bio->bi_rw & REQ_FLUSH)) { | 761 | if (unlikely(bio->bi_rw & REQ_FLUSH)) { |
767 | md_flush_request(mddev, bio); | 762 | md_flush_request(mddev, bio); |
@@ -870,6 +865,8 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
870 | * inc refcount on their rdev. Record them by setting | 865 | * inc refcount on their rdev. Record them by setting |
871 | * bios[x] to bio | 866 | * bios[x] to bio |
872 | */ | 867 | */ |
868 | plugged = mddev_check_plugged(mddev); | ||
869 | |||
873 | raid10_find_phys(conf, r10_bio); | 870 | raid10_find_phys(conf, r10_bio); |
874 | retry_write: | 871 | retry_write: |
875 | blocked_rdev = NULL; | 872 | blocked_rdev = NULL; |
@@ -946,9 +943,8 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
946 | /* In case raid10d snuck in to freeze_array */ | 943 | /* In case raid10d snuck in to freeze_array */ |
947 | wake_up(&conf->wait_barrier); | 944 | wake_up(&conf->wait_barrier); |
948 | 945 | ||
949 | if (do_sync || !mddev->bitmap) | 946 | if (do_sync || !mddev->bitmap || !plugged) |
950 | md_wakeup_thread(mddev->thread); | 947 | md_wakeup_thread(mddev->thread); |
951 | |||
952 | return 0; | 948 | return 0; |
953 | } | 949 | } |
954 | 950 | ||
@@ -1640,9 +1636,11 @@ static void raid10d(mddev_t *mddev) | |||
1640 | conf_t *conf = mddev->private; | 1636 | conf_t *conf = mddev->private; |
1641 | struct list_head *head = &conf->retry_list; | 1637 | struct list_head *head = &conf->retry_list; |
1642 | mdk_rdev_t *rdev; | 1638 | mdk_rdev_t *rdev; |
1639 | struct blk_plug plug; | ||
1643 | 1640 | ||
1644 | md_check_recovery(mddev); | 1641 | md_check_recovery(mddev); |
1645 | 1642 | ||
1643 | blk_start_plug(&plug); | ||
1646 | for (;;) { | 1644 | for (;;) { |
1647 | char b[BDEVNAME_SIZE]; | 1645 | char b[BDEVNAME_SIZE]; |
1648 | 1646 | ||
@@ -1716,6 +1714,7 @@ static void raid10d(mddev_t *mddev) | |||
1716 | } | 1714 | } |
1717 | cond_resched(); | 1715 | cond_resched(); |
1718 | } | 1716 | } |
1717 | blk_finish_plug(&plug); | ||
1719 | } | 1718 | } |
1720 | 1719 | ||
1721 | 1720 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index e867ee42b152..49bf5f891435 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -27,12 +27,12 @@ | |||
27 | * | 27 | * |
28 | * We group bitmap updates into batches. Each batch has a number. | 28 | * We group bitmap updates into batches. Each batch has a number. |
29 | * We may write out several batches at once, but that isn't very important. | 29 | * We may write out several batches at once, but that isn't very important. |
30 | * conf->bm_write is the number of the last batch successfully written. | 30 | * conf->seq_write is the number of the last batch successfully written. |
31 | * conf->bm_flush is the number of the last batch that was closed to | 31 | * conf->seq_flush is the number of the last batch that was closed to |
32 | * new additions. | 32 | * new additions. |
33 | * When we discover that we will need to write to any block in a stripe | 33 | * When we discover that we will need to write to any block in a stripe |
34 | * (in add_stripe_bio) we update the in-memory bitmap and record in sh->bm_seq | 34 | * (in add_stripe_bio) we update the in-memory bitmap and record in sh->bm_seq |
35 | * the number of the batch it will be in. This is bm_flush+1. | 35 | * the number of the batch it will be in. This is seq_flush+1. |
36 | * When we are ready to do a write, if that batch hasn't been written yet, | 36 | * When we are ready to do a write, if that batch hasn't been written yet, |
37 | * we plug the array and queue the stripe for later. | 37 | * we plug the array and queue the stripe for later. |
38 | * When an unplug happens, we increment bm_flush, thus closing the current | 38 | * When an unplug happens, we increment bm_flush, thus closing the current |
@@ -199,14 +199,12 @@ static void __release_stripe(raid5_conf_t *conf, struct stripe_head *sh) | |||
199 | BUG_ON(!list_empty(&sh->lru)); | 199 | BUG_ON(!list_empty(&sh->lru)); |
200 | BUG_ON(atomic_read(&conf->active_stripes)==0); | 200 | BUG_ON(atomic_read(&conf->active_stripes)==0); |
201 | if (test_bit(STRIPE_HANDLE, &sh->state)) { | 201 | if (test_bit(STRIPE_HANDLE, &sh->state)) { |
202 | if (test_bit(STRIPE_DELAYED, &sh->state)) { | 202 | if (test_bit(STRIPE_DELAYED, &sh->state)) |
203 | list_add_tail(&sh->lru, &conf->delayed_list); | 203 | list_add_tail(&sh->lru, &conf->delayed_list); |
204 | plugger_set_plug(&conf->plug); | 204 | else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && |
205 | } else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && | 205 | sh->bm_seq - conf->seq_write > 0) |
206 | sh->bm_seq - conf->seq_write > 0) { | ||
207 | list_add_tail(&sh->lru, &conf->bitmap_list); | 206 | list_add_tail(&sh->lru, &conf->bitmap_list); |
208 | plugger_set_plug(&conf->plug); | 207 | else { |
209 | } else { | ||
210 | clear_bit(STRIPE_BIT_DELAY, &sh->state); | 208 | clear_bit(STRIPE_BIT_DELAY, &sh->state); |
211 | list_add_tail(&sh->lru, &conf->handle_list); | 209 | list_add_tail(&sh->lru, &conf->handle_list); |
212 | } | 210 | } |
@@ -461,7 +459,7 @@ get_active_stripe(raid5_conf_t *conf, sector_t sector, | |||
461 | < (conf->max_nr_stripes *3/4) | 459 | < (conf->max_nr_stripes *3/4) |
462 | || !conf->inactive_blocked), | 460 | || !conf->inactive_blocked), |
463 | conf->device_lock, | 461 | conf->device_lock, |
464 | md_raid5_kick_device(conf)); | 462 | ); |
465 | conf->inactive_blocked = 0; | 463 | conf->inactive_blocked = 0; |
466 | } else | 464 | } else |
467 | init_stripe(sh, sector, previous); | 465 | init_stripe(sh, sector, previous); |
@@ -1470,7 +1468,7 @@ static int resize_stripes(raid5_conf_t *conf, int newsize) | |||
1470 | wait_event_lock_irq(conf->wait_for_stripe, | 1468 | wait_event_lock_irq(conf->wait_for_stripe, |
1471 | !list_empty(&conf->inactive_list), | 1469 | !list_empty(&conf->inactive_list), |
1472 | conf->device_lock, | 1470 | conf->device_lock, |
1473 | blk_flush_plug(current)); | 1471 | ); |
1474 | osh = get_free_stripe(conf); | 1472 | osh = get_free_stripe(conf); |
1475 | spin_unlock_irq(&conf->device_lock); | 1473 | spin_unlock_irq(&conf->device_lock); |
1476 | atomic_set(&nsh->count, 1); | 1474 | atomic_set(&nsh->count, 1); |
@@ -3623,8 +3621,7 @@ static void raid5_activate_delayed(raid5_conf_t *conf) | |||
3623 | atomic_inc(&conf->preread_active_stripes); | 3621 | atomic_inc(&conf->preread_active_stripes); |
3624 | list_add_tail(&sh->lru, &conf->hold_list); | 3622 | list_add_tail(&sh->lru, &conf->hold_list); |
3625 | } | 3623 | } |
3626 | } else | 3624 | } |
3627 | plugger_set_plug(&conf->plug); | ||
3628 | } | 3625 | } |
3629 | 3626 | ||
3630 | static void activate_bit_delay(raid5_conf_t *conf) | 3627 | static void activate_bit_delay(raid5_conf_t *conf) |
@@ -3641,21 +3638,6 @@ static void activate_bit_delay(raid5_conf_t *conf) | |||
3641 | } | 3638 | } |
3642 | } | 3639 | } |
3643 | 3640 | ||
3644 | void md_raid5_kick_device(raid5_conf_t *conf) | ||
3645 | { | ||
3646 | blk_flush_plug(current); | ||
3647 | raid5_activate_delayed(conf); | ||
3648 | md_wakeup_thread(conf->mddev->thread); | ||
3649 | } | ||
3650 | EXPORT_SYMBOL_GPL(md_raid5_kick_device); | ||
3651 | |||
3652 | static void raid5_unplug(struct plug_handle *plug) | ||
3653 | { | ||
3654 | raid5_conf_t *conf = container_of(plug, raid5_conf_t, plug); | ||
3655 | |||
3656 | md_raid5_kick_device(conf); | ||
3657 | } | ||
3658 | |||
3659 | int md_raid5_congested(mddev_t *mddev, int bits) | 3641 | int md_raid5_congested(mddev_t *mddev, int bits) |
3660 | { | 3642 | { |
3661 | raid5_conf_t *conf = mddev->private; | 3643 | raid5_conf_t *conf = mddev->private; |
@@ -3945,6 +3927,7 @@ static int make_request(mddev_t *mddev, struct bio * bi) | |||
3945 | struct stripe_head *sh; | 3927 | struct stripe_head *sh; |
3946 | const int rw = bio_data_dir(bi); | 3928 | const int rw = bio_data_dir(bi); |
3947 | int remaining; | 3929 | int remaining; |
3930 | int plugged; | ||
3948 | 3931 | ||
3949 | if (unlikely(bi->bi_rw & REQ_FLUSH)) { | 3932 | if (unlikely(bi->bi_rw & REQ_FLUSH)) { |
3950 | md_flush_request(mddev, bi); | 3933 | md_flush_request(mddev, bi); |
@@ -3963,6 +3946,7 @@ static int make_request(mddev_t *mddev, struct bio * bi) | |||
3963 | bi->bi_next = NULL; | 3946 | bi->bi_next = NULL; |
3964 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ | 3947 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ |
3965 | 3948 | ||
3949 | plugged = mddev_check_plugged(mddev); | ||
3966 | for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { | 3950 | for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { |
3967 | DEFINE_WAIT(w); | 3951 | DEFINE_WAIT(w); |
3968 | int disks, data_disks; | 3952 | int disks, data_disks; |
@@ -4057,7 +4041,7 @@ static int make_request(mddev_t *mddev, struct bio * bi) | |||
4057 | * add failed due to overlap. Flush everything | 4041 | * add failed due to overlap. Flush everything |
4058 | * and wait a while | 4042 | * and wait a while |
4059 | */ | 4043 | */ |
4060 | md_raid5_kick_device(conf); | 4044 | md_wakeup_thread(mddev->thread); |
4061 | release_stripe(sh); | 4045 | release_stripe(sh); |
4062 | schedule(); | 4046 | schedule(); |
4063 | goto retry; | 4047 | goto retry; |
@@ -4077,6 +4061,9 @@ static int make_request(mddev_t *mddev, struct bio * bi) | |||
4077 | } | 4061 | } |
4078 | 4062 | ||
4079 | } | 4063 | } |
4064 | if (!plugged) | ||
4065 | md_wakeup_thread(mddev->thread); | ||
4066 | |||
4080 | spin_lock_irq(&conf->device_lock); | 4067 | spin_lock_irq(&conf->device_lock); |
4081 | remaining = raid5_dec_bi_phys_segments(bi); | 4068 | remaining = raid5_dec_bi_phys_segments(bi); |
4082 | spin_unlock_irq(&conf->device_lock); | 4069 | spin_unlock_irq(&conf->device_lock); |
@@ -4478,24 +4465,30 @@ static void raid5d(mddev_t *mddev) | |||
4478 | struct stripe_head *sh; | 4465 | struct stripe_head *sh; |
4479 | raid5_conf_t *conf = mddev->private; | 4466 | raid5_conf_t *conf = mddev->private; |
4480 | int handled; | 4467 | int handled; |
4468 | struct blk_plug plug; | ||
4481 | 4469 | ||
4482 | pr_debug("+++ raid5d active\n"); | 4470 | pr_debug("+++ raid5d active\n"); |
4483 | 4471 | ||
4484 | md_check_recovery(mddev); | 4472 | md_check_recovery(mddev); |
4485 | 4473 | ||
4474 | blk_start_plug(&plug); | ||
4486 | handled = 0; | 4475 | handled = 0; |
4487 | spin_lock_irq(&conf->device_lock); | 4476 | spin_lock_irq(&conf->device_lock); |
4488 | while (1) { | 4477 | while (1) { |
4489 | struct bio *bio; | 4478 | struct bio *bio; |
4490 | 4479 | ||
4491 | if (conf->seq_flush != conf->seq_write) { | 4480 | if (atomic_read(&mddev->plug_cnt) == 0 && |
4492 | int seq = conf->seq_flush; | 4481 | !list_empty(&conf->bitmap_list)) { |
4482 | /* Now is a good time to flush some bitmap updates */ | ||
4483 | conf->seq_flush++; | ||
4493 | spin_unlock_irq(&conf->device_lock); | 4484 | spin_unlock_irq(&conf->device_lock); |
4494 | bitmap_unplug(mddev->bitmap); | 4485 | bitmap_unplug(mddev->bitmap); |
4495 | spin_lock_irq(&conf->device_lock); | 4486 | spin_lock_irq(&conf->device_lock); |
4496 | conf->seq_write = seq; | 4487 | conf->seq_write = conf->seq_flush; |
4497 | activate_bit_delay(conf); | 4488 | activate_bit_delay(conf); |
4498 | } | 4489 | } |
4490 | if (atomic_read(&mddev->plug_cnt) == 0) | ||
4491 | raid5_activate_delayed(conf); | ||
4499 | 4492 | ||
4500 | while ((bio = remove_bio_from_retry(conf))) { | 4493 | while ((bio = remove_bio_from_retry(conf))) { |
4501 | int ok; | 4494 | int ok; |
@@ -4525,6 +4518,7 @@ static void raid5d(mddev_t *mddev) | |||
4525 | spin_unlock_irq(&conf->device_lock); | 4518 | spin_unlock_irq(&conf->device_lock); |
4526 | 4519 | ||
4527 | async_tx_issue_pending_all(); | 4520 | async_tx_issue_pending_all(); |
4521 | blk_finish_plug(&plug); | ||
4528 | 4522 | ||
4529 | pr_debug("--- raid5d inactive\n"); | 4523 | pr_debug("--- raid5d inactive\n"); |
4530 | } | 4524 | } |
@@ -5141,8 +5135,6 @@ static int run(mddev_t *mddev) | |||
5141 | mdname(mddev)); | 5135 | mdname(mddev)); |
5142 | md_set_array_sectors(mddev, raid5_size(mddev, 0, 0)); | 5136 | md_set_array_sectors(mddev, raid5_size(mddev, 0, 0)); |
5143 | 5137 | ||
5144 | plugger_init(&conf->plug, raid5_unplug); | ||
5145 | mddev->plug = &conf->plug; | ||
5146 | if (mddev->queue) { | 5138 | if (mddev->queue) { |
5147 | int chunk_size; | 5139 | int chunk_size; |
5148 | /* read-ahead size must cover two whole stripes, which | 5140 | /* read-ahead size must cover two whole stripes, which |
@@ -5159,7 +5151,6 @@ static int run(mddev_t *mddev) | |||
5159 | 5151 | ||
5160 | mddev->queue->backing_dev_info.congested_data = mddev; | 5152 | mddev->queue->backing_dev_info.congested_data = mddev; |
5161 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; | 5153 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; |
5162 | mddev->queue->queue_lock = &conf->device_lock; | ||
5163 | 5154 | ||
5164 | chunk_size = mddev->chunk_sectors << 9; | 5155 | chunk_size = mddev->chunk_sectors << 9; |
5165 | blk_queue_io_min(mddev->queue, chunk_size); | 5156 | blk_queue_io_min(mddev->queue, chunk_size); |
@@ -5192,7 +5183,6 @@ static int stop(mddev_t *mddev) | |||
5192 | mddev->thread = NULL; | 5183 | mddev->thread = NULL; |
5193 | if (mddev->queue) | 5184 | if (mddev->queue) |
5194 | mddev->queue->backing_dev_info.congested_fn = NULL; | 5185 | mddev->queue->backing_dev_info.congested_fn = NULL; |
5195 | plugger_flush(&conf->plug); /* the unplug fn references 'conf'*/ | ||
5196 | free_conf(conf); | 5186 | free_conf(conf); |
5197 | mddev->private = NULL; | 5187 | mddev->private = NULL; |
5198 | mddev->to_remove = &raid5_attrs_group; | 5188 | mddev->to_remove = &raid5_attrs_group; |
@@ -5688,6 +5678,7 @@ static void raid5_quiesce(mddev_t *mddev, int state) | |||
5688 | static void *raid45_takeover_raid0(mddev_t *mddev, int level) | 5678 | static void *raid45_takeover_raid0(mddev_t *mddev, int level) |
5689 | { | 5679 | { |
5690 | struct raid0_private_data *raid0_priv = mddev->private; | 5680 | struct raid0_private_data *raid0_priv = mddev->private; |
5681 | sector_t sectors; | ||
5691 | 5682 | ||
5692 | /* for raid0 takeover only one zone is supported */ | 5683 | /* for raid0 takeover only one zone is supported */ |
5693 | if (raid0_priv->nr_strip_zones > 1) { | 5684 | if (raid0_priv->nr_strip_zones > 1) { |
@@ -5696,6 +5687,9 @@ static void *raid45_takeover_raid0(mddev_t *mddev, int level) | |||
5696 | return ERR_PTR(-EINVAL); | 5687 | return ERR_PTR(-EINVAL); |
5697 | } | 5688 | } |
5698 | 5689 | ||
5690 | sectors = raid0_priv->strip_zone[0].zone_end; | ||
5691 | sector_div(sectors, raid0_priv->strip_zone[0].nb_dev); | ||
5692 | mddev->dev_sectors = sectors; | ||
5699 | mddev->new_level = level; | 5693 | mddev->new_level = level; |
5700 | mddev->new_layout = ALGORITHM_PARITY_N; | 5694 | mddev->new_layout = ALGORITHM_PARITY_N; |
5701 | mddev->new_chunk_sectors = mddev->chunk_sectors; | 5695 | mddev->new_chunk_sectors = mddev->chunk_sectors; |
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 8d563a4f022a..3ca77a2613ba 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
@@ -400,8 +400,6 @@ struct raid5_private_data { | |||
400 | * Cleared when a sync completes. | 400 | * Cleared when a sync completes. |
401 | */ | 401 | */ |
402 | 402 | ||
403 | struct plug_handle plug; | ||
404 | |||
405 | /* per cpu variables */ | 403 | /* per cpu variables */ |
406 | struct raid5_percpu { | 404 | struct raid5_percpu { |
407 | struct page *spare_page; /* Used when checking P/Q in raid6 */ | 405 | struct page *spare_page; /* Used when checking P/Q in raid6 */ |
diff --git a/drivers/media/common/tuners/tda18271-common.c b/drivers/media/common/tuners/tda18271-common.c index 5466d47db899..aae40e52af5b 100644 --- a/drivers/media/common/tuners/tda18271-common.c +++ b/drivers/media/common/tuners/tda18271-common.c | |||
@@ -533,16 +533,7 @@ int tda18271_calc_main_pll(struct dvb_frontend *fe, u32 freq) | |||
533 | if (tda_fail(ret)) | 533 | if (tda_fail(ret)) |
534 | goto fail; | 534 | goto fail; |
535 | 535 | ||
536 | regs[R_MPD] = (0x77 & pd); | 536 | regs[R_MPD] = (0x7f & pd); |
537 | |||
538 | switch (priv->mode) { | ||
539 | case TDA18271_ANALOG: | ||
540 | regs[R_MPD] &= ~0x08; | ||
541 | break; | ||
542 | case TDA18271_DIGITAL: | ||
543 | regs[R_MPD] |= 0x08; | ||
544 | break; | ||
545 | } | ||
546 | 537 | ||
547 | div = ((d * (freq / 1000)) << 7) / 125; | 538 | div = ((d * (freq / 1000)) << 7) / 125; |
548 | 539 | ||
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c index 9ad4454a148d..d884f5eee73c 100644 --- a/drivers/media/common/tuners/tda18271-fe.c +++ b/drivers/media/common/tuners/tda18271-fe.c | |||
@@ -579,8 +579,8 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) | |||
579 | #define RF3 2 | 579 | #define RF3 2 |
580 | u32 rf_default[3]; | 580 | u32 rf_default[3]; |
581 | u32 rf_freq[3]; | 581 | u32 rf_freq[3]; |
582 | u8 prog_cal[3]; | 582 | s32 prog_cal[3]; |
583 | u8 prog_tab[3]; | 583 | s32 prog_tab[3]; |
584 | 584 | ||
585 | i = tda18271_lookup_rf_band(fe, &freq, NULL); | 585 | i = tda18271_lookup_rf_band(fe, &freq, NULL); |
586 | 586 | ||
@@ -602,32 +602,33 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) | |||
602 | return bcal; | 602 | return bcal; |
603 | 603 | ||
604 | tda18271_calc_rf_cal(fe, &rf_freq[rf]); | 604 | tda18271_calc_rf_cal(fe, &rf_freq[rf]); |
605 | prog_tab[rf] = regs[R_EB14]; | 605 | prog_tab[rf] = (s32)regs[R_EB14]; |
606 | 606 | ||
607 | if (1 == bcal) | 607 | if (1 == bcal) |
608 | prog_cal[rf] = tda18271_calibrate_rf(fe, rf_freq[rf]); | 608 | prog_cal[rf] = |
609 | (s32)tda18271_calibrate_rf(fe, rf_freq[rf]); | ||
609 | else | 610 | else |
610 | prog_cal[rf] = prog_tab[rf]; | 611 | prog_cal[rf] = prog_tab[rf]; |
611 | 612 | ||
612 | switch (rf) { | 613 | switch (rf) { |
613 | case RF1: | 614 | case RF1: |
614 | map[i].rf_a1 = 0; | 615 | map[i].rf_a1 = 0; |
615 | map[i].rf_b1 = (s32)(prog_cal[RF1] - prog_tab[RF1]); | 616 | map[i].rf_b1 = (prog_cal[RF1] - prog_tab[RF1]); |
616 | map[i].rf1 = rf_freq[RF1] / 1000; | 617 | map[i].rf1 = rf_freq[RF1] / 1000; |
617 | break; | 618 | break; |
618 | case RF2: | 619 | case RF2: |
619 | dividend = (s32)(prog_cal[RF2] - prog_tab[RF2]) - | 620 | dividend = (prog_cal[RF2] - prog_tab[RF2] - |
620 | (s32)(prog_cal[RF1] + prog_tab[RF1]); | 621 | prog_cal[RF1] + prog_tab[RF1]); |
621 | divisor = (s32)(rf_freq[RF2] - rf_freq[RF1]) / 1000; | 622 | divisor = (s32)(rf_freq[RF2] - rf_freq[RF1]) / 1000; |
622 | map[i].rf_a1 = (dividend / divisor); | 623 | map[i].rf_a1 = (dividend / divisor); |
623 | map[i].rf2 = rf_freq[RF2] / 1000; | 624 | map[i].rf2 = rf_freq[RF2] / 1000; |
624 | break; | 625 | break; |
625 | case RF3: | 626 | case RF3: |
626 | dividend = (s32)(prog_cal[RF3] - prog_tab[RF3]) - | 627 | dividend = (prog_cal[RF3] - prog_tab[RF3] - |
627 | (s32)(prog_cal[RF2] + prog_tab[RF2]); | 628 | prog_cal[RF2] + prog_tab[RF2]); |
628 | divisor = (s32)(rf_freq[RF3] - rf_freq[RF2]) / 1000; | 629 | divisor = (s32)(rf_freq[RF3] - rf_freq[RF2]) / 1000; |
629 | map[i].rf_a2 = (dividend / divisor); | 630 | map[i].rf_a2 = (dividend / divisor); |
630 | map[i].rf_b2 = (s32)(prog_cal[RF2] - prog_tab[RF2]); | 631 | map[i].rf_b2 = (prog_cal[RF2] - prog_tab[RF2]); |
631 | map[i].rf3 = rf_freq[RF3] / 1000; | 632 | map[i].rf3 = rf_freq[RF3] / 1000; |
632 | break; | 633 | break; |
633 | default: | 634 | default: |
diff --git a/drivers/media/common/tuners/tda18271-maps.c b/drivers/media/common/tuners/tda18271-maps.c index e7f84c705da8..3d5b6ab7e332 100644 --- a/drivers/media/common/tuners/tda18271-maps.c +++ b/drivers/media/common/tuners/tda18271-maps.c | |||
@@ -229,8 +229,7 @@ static struct tda18271_map tda18271c2_km[] = { | |||
229 | static struct tda18271_map tda18271_rf_band[] = { | 229 | static struct tda18271_map tda18271_rf_band[] = { |
230 | { .rfmax = 47900, .val = 0x00 }, | 230 | { .rfmax = 47900, .val = 0x00 }, |
231 | { .rfmax = 61100, .val = 0x01 }, | 231 | { .rfmax = 61100, .val = 0x01 }, |
232 | /* { .rfmax = 152600, .val = 0x02 }, */ | 232 | { .rfmax = 152600, .val = 0x02 }, |
233 | { .rfmax = 121200, .val = 0x02 }, | ||
234 | { .rfmax = 164700, .val = 0x03 }, | 233 | { .rfmax = 164700, .val = 0x03 }, |
235 | { .rfmax = 203500, .val = 0x04 }, | 234 | { .rfmax = 203500, .val = 0x04 }, |
236 | { .rfmax = 457800, .val = 0x05 }, | 235 | { .rfmax = 457800, .val = 0x05 }, |
@@ -448,7 +447,7 @@ static struct tda18271_map tda18271c2_rf_cal[] = { | |||
448 | { .rfmax = 150000, .val = 0xb0 }, | 447 | { .rfmax = 150000, .val = 0xb0 }, |
449 | { .rfmax = 151000, .val = 0xb1 }, | 448 | { .rfmax = 151000, .val = 0xb1 }, |
450 | { .rfmax = 152000, .val = 0xb7 }, | 449 | { .rfmax = 152000, .val = 0xb7 }, |
451 | { .rfmax = 153000, .val = 0xbd }, | 450 | { .rfmax = 152600, .val = 0xbd }, |
452 | { .rfmax = 154000, .val = 0x20 }, | 451 | { .rfmax = 154000, .val = 0x20 }, |
453 | { .rfmax = 155000, .val = 0x22 }, | 452 | { .rfmax = 155000, .val = 0x22 }, |
454 | { .rfmax = 156000, .val = 0x24 }, | 453 | { .rfmax = 156000, .val = 0x24 }, |
@@ -459,7 +458,7 @@ static struct tda18271_map tda18271c2_rf_cal[] = { | |||
459 | { .rfmax = 161000, .val = 0x2d }, | 458 | { .rfmax = 161000, .val = 0x2d }, |
460 | { .rfmax = 163000, .val = 0x2e }, | 459 | { .rfmax = 163000, .val = 0x2e }, |
461 | { .rfmax = 164000, .val = 0x2f }, | 460 | { .rfmax = 164000, .val = 0x2f }, |
462 | { .rfmax = 165000, .val = 0x30 }, | 461 | { .rfmax = 164700, .val = 0x30 }, |
463 | { .rfmax = 166000, .val = 0x11 }, | 462 | { .rfmax = 166000, .val = 0x11 }, |
464 | { .rfmax = 167000, .val = 0x12 }, | 463 | { .rfmax = 167000, .val = 0x12 }, |
465 | { .rfmax = 168000, .val = 0x13 }, | 464 | { .rfmax = 168000, .val = 0x13 }, |
@@ -510,7 +509,8 @@ static struct tda18271_map tda18271c2_rf_cal[] = { | |||
510 | { .rfmax = 236000, .val = 0x1b }, | 509 | { .rfmax = 236000, .val = 0x1b }, |
511 | { .rfmax = 237000, .val = 0x1c }, | 510 | { .rfmax = 237000, .val = 0x1c }, |
512 | { .rfmax = 240000, .val = 0x1d }, | 511 | { .rfmax = 240000, .val = 0x1d }, |
513 | { .rfmax = 242000, .val = 0x1f }, | 512 | { .rfmax = 242000, .val = 0x1e }, |
513 | { .rfmax = 244000, .val = 0x1f }, | ||
514 | { .rfmax = 247000, .val = 0x20 }, | 514 | { .rfmax = 247000, .val = 0x20 }, |
515 | { .rfmax = 249000, .val = 0x21 }, | 515 | { .rfmax = 249000, .val = 0x21 }, |
516 | { .rfmax = 252000, .val = 0x22 }, | 516 | { .rfmax = 252000, .val = 0x22 }, |
@@ -624,7 +624,7 @@ static struct tda18271_map tda18271c2_rf_cal[] = { | |||
624 | { .rfmax = 453000, .val = 0x93 }, | 624 | { .rfmax = 453000, .val = 0x93 }, |
625 | { .rfmax = 454000, .val = 0x94 }, | 625 | { .rfmax = 454000, .val = 0x94 }, |
626 | { .rfmax = 456000, .val = 0x96 }, | 626 | { .rfmax = 456000, .val = 0x96 }, |
627 | { .rfmax = 457000, .val = 0x98 }, | 627 | { .rfmax = 457800, .val = 0x98 }, |
628 | { .rfmax = 461000, .val = 0x11 }, | 628 | { .rfmax = 461000, .val = 0x11 }, |
629 | { .rfmax = 468000, .val = 0x12 }, | 629 | { .rfmax = 468000, .val = 0x12 }, |
630 | { .rfmax = 472000, .val = 0x13 }, | 630 | { .rfmax = 472000, .val = 0x13 }, |
diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c index 955254090a0e..03f96d6ca894 100644 --- a/drivers/media/dvb/b2c2/flexcop-pci.c +++ b/drivers/media/dvb/b2c2/flexcop-pci.c | |||
@@ -38,7 +38,7 @@ MODULE_PARM_DESC(debug, | |||
38 | DEBSTATUS); | 38 | DEBSTATUS); |
39 | 39 | ||
40 | #define DRIVER_VERSION "0.1" | 40 | #define DRIVER_VERSION "0.1" |
41 | #define DRIVER_NAME "Technisat/B2C2 FlexCop II/IIb/III Digital TV PCI Driver" | 41 | #define DRIVER_NAME "flexcop-pci" |
42 | #define DRIVER_AUTHOR "Patrick Boettcher <patrick.boettcher@desy.de>" | 42 | #define DRIVER_AUTHOR "Patrick Boettcher <patrick.boettcher@desy.de>" |
43 | 43 | ||
44 | struct flexcop_pci { | 44 | struct flexcop_pci { |
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index fe4f894183ff..ccbd39a38c46 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -362,7 +362,7 @@ config DVB_USB_LME2510 | |||
362 | config DVB_USB_TECHNISAT_USB2 | 362 | config DVB_USB_TECHNISAT_USB2 |
363 | tristate "Technisat DVB-S/S2 USB2.0 support" | 363 | tristate "Technisat DVB-S/S2 USB2.0 support" |
364 | depends on DVB_USB | 364 | depends on DVB_USB |
365 | select DVB_STB0899 if !DVB_FE_CUSTOMISE | 365 | select DVB_STV090x if !DVB_FE_CUSTOMISE |
366 | select DVB_STB6100 if !DVB_FE_CUSTOMISE | 366 | select DVB_STV6110x if !DVB_FE_CUSTOMISE |
367 | help | 367 | help |
368 | Say Y here to support the Technisat USB2 DVB-S/S2 device | 368 | Say Y here to support the Technisat USB2 DVB-S/S2 device |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 97af266d7f1d..65214af5cd74 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
@@ -2162,7 +2162,7 @@ struct dibx000_agc_config dib7090_agc_config[2] = { | |||
2162 | .agc1_pt3 = 98, | 2162 | .agc1_pt3 = 98, |
2163 | .agc1_slope1 = 0, | 2163 | .agc1_slope1 = 0, |
2164 | .agc1_slope2 = 167, | 2164 | .agc1_slope2 = 167, |
2165 | .agc1_pt1 = 98, | 2165 | .agc2_pt1 = 98, |
2166 | .agc2_pt2 = 255, | 2166 | .agc2_pt2 = 255, |
2167 | .agc2_slope1 = 104, | 2167 | .agc2_slope1 = 104, |
2168 | .agc2_slope2 = 0, | 2168 | .agc2_slope2 = 0, |
@@ -2440,11 +2440,11 @@ static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap) | |||
2440 | dib0700_set_i2c_speed(adap->dev, 340); | 2440 | dib0700_set_i2c_speed(adap->dev, 340); |
2441 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]); | 2441 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]); |
2442 | 2442 | ||
2443 | dib7090_slave_reset(adap->fe); | ||
2444 | |||
2445 | if (adap->fe == NULL) | 2443 | if (adap->fe == NULL) |
2446 | return -ENODEV; | 2444 | return -ENODEV; |
2447 | 2445 | ||
2446 | dib7090_slave_reset(adap->fe); | ||
2447 | |||
2448 | return 0; | 2448 | return 0; |
2449 | } | 2449 | } |
2450 | 2450 | ||
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 23640ed44d85..056138f63c7d 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c | |||
@@ -378,7 +378,6 @@ EXPORT_SYMBOL_GPL(media_entity_create_link); | |||
378 | 378 | ||
379 | static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) | 379 | static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) |
380 | { | 380 | { |
381 | const u32 mask = MEDIA_LNK_FL_ENABLED; | ||
382 | int ret; | 381 | int ret; |
383 | 382 | ||
384 | /* Notify both entities. */ | 383 | /* Notify both entities. */ |
@@ -395,7 +394,7 @@ static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) | |||
395 | return ret; | 394 | return ret; |
396 | } | 395 | } |
397 | 396 | ||
398 | link->flags = (link->flags & ~mask) | (flags & mask); | 397 | link->flags = flags; |
399 | link->reverse->flags = link->flags; | 398 | link->reverse->flags = link->flags; |
400 | 399 | ||
401 | return 0; | 400 | return 0; |
@@ -417,6 +416,7 @@ static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) | |||
417 | */ | 416 | */ |
418 | int __media_entity_setup_link(struct media_link *link, u32 flags) | 417 | int __media_entity_setup_link(struct media_link *link, u32 flags) |
419 | { | 418 | { |
419 | const u32 mask = MEDIA_LNK_FL_ENABLED; | ||
420 | struct media_device *mdev; | 420 | struct media_device *mdev; |
421 | struct media_entity *source, *sink; | 421 | struct media_entity *source, *sink; |
422 | int ret = -EBUSY; | 422 | int ret = -EBUSY; |
@@ -424,6 +424,10 @@ int __media_entity_setup_link(struct media_link *link, u32 flags) | |||
424 | if (link == NULL) | 424 | if (link == NULL) |
425 | return -EINVAL; | 425 | return -EINVAL; |
426 | 426 | ||
427 | /* The non-modifiable link flags must not be modified. */ | ||
428 | if ((link->flags & ~mask) != (flags & ~mask)) | ||
429 | return -EINVAL; | ||
430 | |||
427 | if (link->flags & MEDIA_LNK_FL_IMMUTABLE) | 431 | if (link->flags & MEDIA_LNK_FL_IMMUTABLE) |
428 | return link->flags == flags ? 0 : -EINVAL; | 432 | return link->flags == flags ? 0 : -EINVAL; |
429 | 433 | ||
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index dc3f04c52d5e..87bad7678d92 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c | |||
@@ -170,7 +170,7 @@ static int fmr2_setfreq(struct fmr2 *dev) | |||
170 | return 0; | 170 | return 0; |
171 | } | 171 | } |
172 | 172 | ||
173 | /* !!! not tested, in my card this does't work !!! */ | 173 | /* !!! not tested, in my card this doesn't work !!! */ |
174 | static int fmr2_setvolume(struct fmr2 *dev) | 174 | static int fmr2_setvolume(struct fmr2 *dev) |
175 | { | 175 | { |
176 | int vol[16] = { 0x021, 0x084, 0x090, 0x104, | 176 | int vol[16] = { 0x021, 0x084, 0x090, 0x104, |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 4498b944dec8..00f51dd121f3 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -875,7 +875,7 @@ config MX3_VIDEO | |||
875 | config VIDEO_MX3 | 875 | config VIDEO_MX3 |
876 | tristate "i.MX3x Camera Sensor Interface driver" | 876 | tristate "i.MX3x Camera Sensor Interface driver" |
877 | depends on VIDEO_DEV && MX3_IPU && SOC_CAMERA | 877 | depends on VIDEO_DEV && MX3_IPU && SOC_CAMERA |
878 | select VIDEOBUF_DMA_CONTIG | 878 | select VIDEOBUF2_DMA_CONTIG |
879 | select MX3_VIDEO | 879 | select MX3_VIDEO |
880 | ---help--- | 880 | ---help--- |
881 | This is a v4l2 driver for the i.MX3x Camera Sensor Interface | 881 | This is a v4l2 driver for the i.MX3x Camera Sensor Interface |
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c index c6e2ca3b1149..6fbc356113c1 100644 --- a/drivers/media/video/cx18/cx18-streams.c +++ b/drivers/media/video/cx18/cx18-streams.c | |||
@@ -350,9 +350,17 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister) | |||
350 | 350 | ||
351 | /* No struct video_device, but can have buffers allocated */ | 351 | /* No struct video_device, but can have buffers allocated */ |
352 | if (type == CX18_ENC_STREAM_TYPE_IDX) { | 352 | if (type == CX18_ENC_STREAM_TYPE_IDX) { |
353 | /* If the module params didn't inhibit IDX ... */ | ||
353 | if (cx->stream_buffers[type] != 0) { | 354 | if (cx->stream_buffers[type] != 0) { |
354 | cx->stream_buffers[type] = 0; | 355 | cx->stream_buffers[type] = 0; |
355 | cx18_stream_free(&cx->streams[type]); | 356 | /* |
357 | * Before calling cx18_stream_free(), | ||
358 | * check if the IDX stream was actually set up. | ||
359 | * Needed, since the cx18_probe() error path | ||
360 | * exits through here as well as normal clean up | ||
361 | */ | ||
362 | if (cx->streams[type].buffers != 0) | ||
363 | cx18_stream_free(&cx->streams[type]); | ||
356 | } | 364 | } |
357 | continue; | 365 | continue; |
358 | } | 366 | } |
diff --git a/drivers/media/video/cx23885/Kconfig b/drivers/media/video/cx23885/Kconfig index 3b6e7f28568e..caab1bfb79e2 100644 --- a/drivers/media/video/cx23885/Kconfig +++ b/drivers/media/video/cx23885/Kconfig | |||
@@ -22,6 +22,7 @@ config VIDEO_CX23885 | |||
22 | select DVB_CX24116 if !DVB_FE_CUSTOMISE | 22 | select DVB_CX24116 if !DVB_FE_CUSTOMISE |
23 | select DVB_STV0900 if !DVB_FE_CUSTOMISE | 23 | select DVB_STV0900 if !DVB_FE_CUSTOMISE |
24 | select DVB_DS3000 if !DVB_FE_CUSTOMISE | 24 | select DVB_DS3000 if !DVB_FE_CUSTOMISE |
25 | select DVB_STV0367 if !DVB_FE_CUSTOMISE | ||
25 | select MEDIA_TUNER_MT2131 if !MEDIA_TUNER_CUSTOMISE | 26 | select MEDIA_TUNER_MT2131 if !MEDIA_TUNER_CUSTOMISE |
26 | select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE | 27 | select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE |
27 | select MEDIA_TUNER_TDA8290 if !MEDIA_TUNER_CUSTOMISE | 28 | select MEDIA_TUNER_TDA8290 if !MEDIA_TUNER_CUSTOMISE |
diff --git a/drivers/media/video/imx074.c b/drivers/media/video/imx074.c index 1a1169115716..0382ea752e6f 100644 --- a/drivers/media/video/imx074.c +++ b/drivers/media/video/imx074.c | |||
@@ -298,7 +298,7 @@ static unsigned long imx074_query_bus_param(struct soc_camera_device *icd) | |||
298 | static int imx074_set_bus_param(struct soc_camera_device *icd, | 298 | static int imx074_set_bus_param(struct soc_camera_device *icd, |
299 | unsigned long flags) | 299 | unsigned long flags) |
300 | { | 300 | { |
301 | return -1; | 301 | return -EINVAL; |
302 | } | 302 | } |
303 | 303 | ||
304 | static struct soc_camera_ops imx074_ops = { | 304 | static struct soc_camera_ops imx074_ops = { |
diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c index 503bd7922bd6..472a69359e60 100644 --- a/drivers/media/video/omap3isp/isp.c +++ b/drivers/media/video/omap3isp/isp.c | |||
@@ -215,20 +215,21 @@ static u32 isp_set_xclk(struct isp_device *isp, u32 xclk, u8 xclksel) | |||
215 | } | 215 | } |
216 | 216 | ||
217 | switch (xclksel) { | 217 | switch (xclksel) { |
218 | case 0: | 218 | case ISP_XCLK_A: |
219 | isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, | 219 | isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, |
220 | ISPTCTRL_CTRL_DIVA_MASK, | 220 | ISPTCTRL_CTRL_DIVA_MASK, |
221 | divisor << ISPTCTRL_CTRL_DIVA_SHIFT); | 221 | divisor << ISPTCTRL_CTRL_DIVA_SHIFT); |
222 | dev_dbg(isp->dev, "isp_set_xclk(): cam_xclka set to %d Hz\n", | 222 | dev_dbg(isp->dev, "isp_set_xclk(): cam_xclka set to %d Hz\n", |
223 | currentxclk); | 223 | currentxclk); |
224 | break; | 224 | break; |
225 | case 1: | 225 | case ISP_XCLK_B: |
226 | isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, | 226 | isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, |
227 | ISPTCTRL_CTRL_DIVB_MASK, | 227 | ISPTCTRL_CTRL_DIVB_MASK, |
228 | divisor << ISPTCTRL_CTRL_DIVB_SHIFT); | 228 | divisor << ISPTCTRL_CTRL_DIVB_SHIFT); |
229 | dev_dbg(isp->dev, "isp_set_xclk(): cam_xclkb set to %d Hz\n", | 229 | dev_dbg(isp->dev, "isp_set_xclk(): cam_xclkb set to %d Hz\n", |
230 | currentxclk); | 230 | currentxclk); |
231 | break; | 231 | break; |
232 | case ISP_XCLK_NONE: | ||
232 | default: | 233 | default: |
233 | omap3isp_put(isp); | 234 | omap3isp_put(isp); |
234 | dev_dbg(isp->dev, "ISP_ERR: isp_set_xclk(): Invalid requested " | 235 | dev_dbg(isp->dev, "ISP_ERR: isp_set_xclk(): Invalid requested " |
@@ -237,13 +238,13 @@ static u32 isp_set_xclk(struct isp_device *isp, u32 xclk, u8 xclksel) | |||
237 | } | 238 | } |
238 | 239 | ||
239 | /* Do we go from stable whatever to clock? */ | 240 | /* Do we go from stable whatever to clock? */ |
240 | if (divisor >= 2 && isp->xclk_divisor[xclksel] < 2) | 241 | if (divisor >= 2 && isp->xclk_divisor[xclksel - 1] < 2) |
241 | omap3isp_get(isp); | 242 | omap3isp_get(isp); |
242 | /* Stopping the clock. */ | 243 | /* Stopping the clock. */ |
243 | else if (divisor < 2 && isp->xclk_divisor[xclksel] >= 2) | 244 | else if (divisor < 2 && isp->xclk_divisor[xclksel - 1] >= 2) |
244 | omap3isp_put(isp); | 245 | omap3isp_put(isp); |
245 | 246 | ||
246 | isp->xclk_divisor[xclksel] = divisor; | 247 | isp->xclk_divisor[xclksel - 1] = divisor; |
247 | 248 | ||
248 | omap3isp_put(isp); | 249 | omap3isp_put(isp); |
249 | 250 | ||
@@ -285,7 +286,8 @@ static void isp_power_settings(struct isp_device *isp, int idle) | |||
285 | */ | 286 | */ |
286 | void omap3isp_configure_bridge(struct isp_device *isp, | 287 | void omap3isp_configure_bridge(struct isp_device *isp, |
287 | enum ccdc_input_entity input, | 288 | enum ccdc_input_entity input, |
288 | const struct isp_parallel_platform_data *pdata) | 289 | const struct isp_parallel_platform_data *pdata, |
290 | unsigned int shift) | ||
289 | { | 291 | { |
290 | u32 ispctrl_val; | 292 | u32 ispctrl_val; |
291 | 293 | ||
@@ -298,9 +300,9 @@ void omap3isp_configure_bridge(struct isp_device *isp, | |||
298 | switch (input) { | 300 | switch (input) { |
299 | case CCDC_INPUT_PARALLEL: | 301 | case CCDC_INPUT_PARALLEL: |
300 | ispctrl_val |= ISPCTRL_PAR_SER_CLK_SEL_PARALLEL; | 302 | ispctrl_val |= ISPCTRL_PAR_SER_CLK_SEL_PARALLEL; |
301 | ispctrl_val |= pdata->data_lane_shift << ISPCTRL_SHIFT_SHIFT; | ||
302 | ispctrl_val |= pdata->clk_pol << ISPCTRL_PAR_CLK_POL_SHIFT; | 303 | ispctrl_val |= pdata->clk_pol << ISPCTRL_PAR_CLK_POL_SHIFT; |
303 | ispctrl_val |= pdata->bridge << ISPCTRL_PAR_BRIDGE_SHIFT; | 304 | ispctrl_val |= pdata->bridge << ISPCTRL_PAR_BRIDGE_SHIFT; |
305 | shift += pdata->data_lane_shift * 2; | ||
304 | break; | 306 | break; |
305 | 307 | ||
306 | case CCDC_INPUT_CSI2A: | 308 | case CCDC_INPUT_CSI2A: |
@@ -319,6 +321,8 @@ void omap3isp_configure_bridge(struct isp_device *isp, | |||
319 | return; | 321 | return; |
320 | } | 322 | } |
321 | 323 | ||
324 | ispctrl_val |= ((shift/2) << ISPCTRL_SHIFT_SHIFT) & ISPCTRL_SHIFT_MASK; | ||
325 | |||
322 | ispctrl_val &= ~ISPCTRL_SYNC_DETECT_MASK; | 326 | ispctrl_val &= ~ISPCTRL_SYNC_DETECT_MASK; |
323 | ispctrl_val |= ISPCTRL_SYNC_DETECT_VSRISE; | 327 | ispctrl_val |= ISPCTRL_SYNC_DETECT_VSRISE; |
324 | 328 | ||
@@ -658,6 +662,8 @@ int omap3isp_pipeline_pm_use(struct media_entity *entity, int use) | |||
658 | 662 | ||
659 | /* Apply power change to connected non-nodes. */ | 663 | /* Apply power change to connected non-nodes. */ |
660 | ret = isp_pipeline_pm_power(entity, change); | 664 | ret = isp_pipeline_pm_power(entity, change); |
665 | if (ret < 0) | ||
666 | entity->use_count -= change; | ||
661 | 667 | ||
662 | mutex_unlock(&entity->parent->graph_mutex); | 668 | mutex_unlock(&entity->parent->graph_mutex); |
663 | 669 | ||
@@ -872,6 +878,9 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe) | |||
872 | } | 878 | } |
873 | } | 879 | } |
874 | 880 | ||
881 | if (failure < 0) | ||
882 | isp->needs_reset = true; | ||
883 | |||
875 | return failure; | 884 | return failure; |
876 | } | 885 | } |
877 | 886 | ||
@@ -884,7 +893,8 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe) | |||
884 | * single-shot or continuous mode. | 893 | * single-shot or continuous mode. |
885 | * | 894 | * |
886 | * Return 0 if successful, or the return value of the failed video::s_stream | 895 | * Return 0 if successful, or the return value of the failed video::s_stream |
887 | * operation otherwise. | 896 | * operation otherwise. The pipeline state is not updated when the operation |
897 | * fails, except when stopping the pipeline. | ||
888 | */ | 898 | */ |
889 | int omap3isp_pipeline_set_stream(struct isp_pipeline *pipe, | 899 | int omap3isp_pipeline_set_stream(struct isp_pipeline *pipe, |
890 | enum isp_pipeline_stream_state state) | 900 | enum isp_pipeline_stream_state state) |
@@ -895,7 +905,9 @@ int omap3isp_pipeline_set_stream(struct isp_pipeline *pipe, | |||
895 | ret = isp_pipeline_disable(pipe); | 905 | ret = isp_pipeline_disable(pipe); |
896 | else | 906 | else |
897 | ret = isp_pipeline_enable(pipe, state); | 907 | ret = isp_pipeline_enable(pipe, state); |
898 | pipe->stream_state = state; | 908 | |
909 | if (ret == 0 || state == ISP_PIPELINE_STREAM_STOPPED) | ||
910 | pipe->stream_state = state; | ||
899 | 911 | ||
900 | return ret; | 912 | return ret; |
901 | } | 913 | } |
@@ -1481,6 +1493,10 @@ void omap3isp_put(struct isp_device *isp) | |||
1481 | if (--isp->ref_count == 0) { | 1493 | if (--isp->ref_count == 0) { |
1482 | isp_disable_interrupts(isp); | 1494 | isp_disable_interrupts(isp); |
1483 | isp_save_ctx(isp); | 1495 | isp_save_ctx(isp); |
1496 | if (isp->needs_reset) { | ||
1497 | isp_reset(isp); | ||
1498 | isp->needs_reset = false; | ||
1499 | } | ||
1484 | isp_disable_clocks(isp); | 1500 | isp_disable_clocks(isp); |
1485 | } | 1501 | } |
1486 | mutex_unlock(&isp->isp_mutex); | 1502 | mutex_unlock(&isp->isp_mutex); |
diff --git a/drivers/media/video/omap3isp/isp.h b/drivers/media/video/omap3isp/isp.h index cf5214e95a92..2620c405f5e4 100644 --- a/drivers/media/video/omap3isp/isp.h +++ b/drivers/media/video/omap3isp/isp.h | |||
@@ -132,7 +132,6 @@ struct isp_reg { | |||
132 | 132 | ||
133 | /** | 133 | /** |
134 | * struct isp_parallel_platform_data - Parallel interface platform data | 134 | * struct isp_parallel_platform_data - Parallel interface platform data |
135 | * @width: Parallel bus width in bits (8, 10, 11 or 12) | ||
136 | * @data_lane_shift: Data lane shifter | 135 | * @data_lane_shift: Data lane shifter |
137 | * 0 - CAMEXT[13:0] -> CAM[13:0] | 136 | * 0 - CAMEXT[13:0] -> CAM[13:0] |
138 | * 1 - CAMEXT[13:2] -> CAM[11:0] | 137 | * 1 - CAMEXT[13:2] -> CAM[11:0] |
@@ -146,7 +145,6 @@ struct isp_reg { | |||
146 | * ISPCTRL_PAR_BRIDGE_BENDIAN - Big endian | 145 | * ISPCTRL_PAR_BRIDGE_BENDIAN - Big endian |
147 | */ | 146 | */ |
148 | struct isp_parallel_platform_data { | 147 | struct isp_parallel_platform_data { |
149 | unsigned int width; | ||
150 | unsigned int data_lane_shift:2; | 148 | unsigned int data_lane_shift:2; |
151 | unsigned int clk_pol:1; | 149 | unsigned int clk_pol:1; |
152 | unsigned int bridge:4; | 150 | unsigned int bridge:4; |
@@ -262,6 +260,7 @@ struct isp_device { | |||
262 | /* ISP Obj */ | 260 | /* ISP Obj */ |
263 | spinlock_t stat_lock; /* common lock for statistic drivers */ | 261 | spinlock_t stat_lock; /* common lock for statistic drivers */ |
264 | struct mutex isp_mutex; /* For handling ref_count field */ | 262 | struct mutex isp_mutex; /* For handling ref_count field */ |
263 | bool needs_reset; | ||
265 | int has_context; | 264 | int has_context; |
266 | int ref_count; | 265 | int ref_count; |
267 | unsigned int autoidle; | 266 | unsigned int autoidle; |
@@ -311,11 +310,12 @@ int omap3isp_pipeline_set_stream(struct isp_pipeline *pipe, | |||
311 | enum isp_pipeline_stream_state state); | 310 | enum isp_pipeline_stream_state state); |
312 | void omap3isp_configure_bridge(struct isp_device *isp, | 311 | void omap3isp_configure_bridge(struct isp_device *isp, |
313 | enum ccdc_input_entity input, | 312 | enum ccdc_input_entity input, |
314 | const struct isp_parallel_platform_data *pdata); | 313 | const struct isp_parallel_platform_data *pdata, |
314 | unsigned int shift); | ||
315 | 315 | ||
316 | #define ISP_XCLK_NONE -1 | 316 | #define ISP_XCLK_NONE 0 |
317 | #define ISP_XCLK_A 0 | 317 | #define ISP_XCLK_A 1 |
318 | #define ISP_XCLK_B 1 | 318 | #define ISP_XCLK_B 2 |
319 | 319 | ||
320 | struct isp_device *omap3isp_get(struct isp_device *isp); | 320 | struct isp_device *omap3isp_get(struct isp_device *isp); |
321 | void omap3isp_put(struct isp_device *isp); | 321 | void omap3isp_put(struct isp_device *isp); |
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c index 5ff9d14ce710..39d501bda636 100644 --- a/drivers/media/video/omap3isp/ispccdc.c +++ b/drivers/media/video/omap3isp/ispccdc.c | |||
@@ -43,6 +43,12 @@ __ccdc_get_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_fh *fh, | |||
43 | 43 | ||
44 | static const unsigned int ccdc_fmts[] = { | 44 | static const unsigned int ccdc_fmts[] = { |
45 | V4L2_MBUS_FMT_Y8_1X8, | 45 | V4L2_MBUS_FMT_Y8_1X8, |
46 | V4L2_MBUS_FMT_Y10_1X10, | ||
47 | V4L2_MBUS_FMT_Y12_1X12, | ||
48 | V4L2_MBUS_FMT_SGRBG8_1X8, | ||
49 | V4L2_MBUS_FMT_SRGGB8_1X8, | ||
50 | V4L2_MBUS_FMT_SBGGR8_1X8, | ||
51 | V4L2_MBUS_FMT_SGBRG8_1X8, | ||
46 | V4L2_MBUS_FMT_SGRBG10_1X10, | 52 | V4L2_MBUS_FMT_SGRBG10_1X10, |
47 | V4L2_MBUS_FMT_SRGGB10_1X10, | 53 | V4L2_MBUS_FMT_SRGGB10_1X10, |
48 | V4L2_MBUS_FMT_SBGGR10_1X10, | 54 | V4L2_MBUS_FMT_SBGGR10_1X10, |
@@ -1110,21 +1116,38 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc) | |||
1110 | struct isp_parallel_platform_data *pdata = NULL; | 1116 | struct isp_parallel_platform_data *pdata = NULL; |
1111 | struct v4l2_subdev *sensor; | 1117 | struct v4l2_subdev *sensor; |
1112 | struct v4l2_mbus_framefmt *format; | 1118 | struct v4l2_mbus_framefmt *format; |
1119 | const struct isp_format_info *fmt_info; | ||
1120 | struct v4l2_subdev_format fmt_src; | ||
1121 | unsigned int depth_out; | ||
1122 | unsigned int depth_in = 0; | ||
1113 | struct media_pad *pad; | 1123 | struct media_pad *pad; |
1114 | unsigned long flags; | 1124 | unsigned long flags; |
1125 | unsigned int shift; | ||
1115 | u32 syn_mode; | 1126 | u32 syn_mode; |
1116 | u32 ccdc_pattern; | 1127 | u32 ccdc_pattern; |
1117 | 1128 | ||
1118 | if (ccdc->input == CCDC_INPUT_PARALLEL) { | 1129 | pad = media_entity_remote_source(&ccdc->pads[CCDC_PAD_SINK]); |
1119 | pad = media_entity_remote_source(&ccdc->pads[CCDC_PAD_SINK]); | 1130 | sensor = media_entity_to_v4l2_subdev(pad->entity); |
1120 | sensor = media_entity_to_v4l2_subdev(pad->entity); | 1131 | if (ccdc->input == CCDC_INPUT_PARALLEL) |
1121 | pdata = &((struct isp_v4l2_subdevs_group *)sensor->host_priv) | 1132 | pdata = &((struct isp_v4l2_subdevs_group *)sensor->host_priv) |
1122 | ->bus.parallel; | 1133 | ->bus.parallel; |
1134 | |||
1135 | /* Compute shift value for lane shifter to configure the bridge. */ | ||
1136 | fmt_src.pad = pad->index; | ||
1137 | fmt_src.which = V4L2_SUBDEV_FORMAT_ACTIVE; | ||
1138 | if (!v4l2_subdev_call(sensor, pad, get_fmt, NULL, &fmt_src)) { | ||
1139 | fmt_info = omap3isp_video_format_info(fmt_src.format.code); | ||
1140 | depth_in = fmt_info->bpp; | ||
1123 | } | 1141 | } |
1124 | 1142 | ||
1125 | omap3isp_configure_bridge(isp, ccdc->input, pdata); | 1143 | fmt_info = omap3isp_video_format_info |
1144 | (isp->isp_ccdc.formats[CCDC_PAD_SINK].code); | ||
1145 | depth_out = fmt_info->bpp; | ||
1146 | |||
1147 | shift = depth_in - depth_out; | ||
1148 | omap3isp_configure_bridge(isp, ccdc->input, pdata, shift); | ||
1126 | 1149 | ||
1127 | ccdc->syncif.datsz = pdata ? pdata->width : 10; | 1150 | ccdc->syncif.datsz = depth_out; |
1128 | ccdc_config_sync_if(ccdc, &ccdc->syncif); | 1151 | ccdc_config_sync_if(ccdc, &ccdc->syncif); |
1129 | 1152 | ||
1130 | /* CCDC_PAD_SINK */ | 1153 | /* CCDC_PAD_SINK */ |
@@ -1338,7 +1361,7 @@ static int ccdc_sbl_wait_idle(struct isp_ccdc_device *ccdc, | |||
1338 | * @ccdc: Pointer to ISP CCDC device. | 1361 | * @ccdc: Pointer to ISP CCDC device. |
1339 | * @event: Pointing which event trigger handler | 1362 | * @event: Pointing which event trigger handler |
1340 | * | 1363 | * |
1341 | * Return 1 when the event and stopping request combination is satisfyied, | 1364 | * Return 1 when the event and stopping request combination is satisfied, |
1342 | * zero otherwise. | 1365 | * zero otherwise. |
1343 | */ | 1366 | */ |
1344 | static int __ccdc_handle_stopping(struct isp_ccdc_device *ccdc, u32 event) | 1367 | static int __ccdc_handle_stopping(struct isp_ccdc_device *ccdc, u32 event) |
@@ -1618,7 +1641,7 @@ static int ccdc_video_queue(struct isp_video *video, struct isp_buffer *buffer) | |||
1618 | 1641 | ||
1619 | ccdc_set_outaddr(ccdc, buffer->isp_addr); | 1642 | ccdc_set_outaddr(ccdc, buffer->isp_addr); |
1620 | 1643 | ||
1621 | /* We now have a buffer queued on the output, restart the pipeline in | 1644 | /* We now have a buffer queued on the output, restart the pipeline |
1622 | * on the next CCDC interrupt if running in continuous mode (or when | 1645 | * on the next CCDC interrupt if running in continuous mode (or when |
1623 | * starting the stream). | 1646 | * starting the stream). |
1624 | */ | 1647 | */ |
diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c index 2b16988a501d..aba537af87e4 100644 --- a/drivers/media/video/omap3isp/isppreview.c +++ b/drivers/media/video/omap3isp/isppreview.c | |||
@@ -755,7 +755,7 @@ static struct preview_update update_attrs[] = { | |||
755 | * @configs - pointer to update config structure. | 755 | * @configs - pointer to update config structure. |
756 | * @config - return pointer to appropriate structure field. | 756 | * @config - return pointer to appropriate structure field. |
757 | * @bit - for which feature to return pointers. | 757 | * @bit - for which feature to return pointers. |
758 | * Return size of coresponding prev_params member | 758 | * Return size of corresponding prev_params member |
759 | */ | 759 | */ |
760 | static u32 | 760 | static u32 |
761 | __preview_get_ptrs(struct prev_params *params, void **param, | 761 | __preview_get_ptrs(struct prev_params *params, void **param, |
diff --git a/drivers/media/video/omap3isp/ispqueue.c b/drivers/media/video/omap3isp/ispqueue.c index 8fddc5806b0d..9c317148205f 100644 --- a/drivers/media/video/omap3isp/ispqueue.c +++ b/drivers/media/video/omap3isp/ispqueue.c | |||
@@ -339,7 +339,7 @@ static int isp_video_buffer_prepare_user(struct isp_video_buffer *buf) | |||
339 | up_read(¤t->mm->mmap_sem); | 339 | up_read(¤t->mm->mmap_sem); |
340 | 340 | ||
341 | if (ret != buf->npages) { | 341 | if (ret != buf->npages) { |
342 | buf->npages = ret; | 342 | buf->npages = ret < 0 ? 0 : ret; |
343 | isp_video_buffer_cleanup(buf); | 343 | isp_video_buffer_cleanup(buf); |
344 | return -EFAULT; | 344 | return -EFAULT; |
345 | } | 345 | } |
@@ -408,8 +408,8 @@ done: | |||
408 | * isp_video_buffer_prepare_vm_flags - Get VMA flags for a userspace address | 408 | * isp_video_buffer_prepare_vm_flags - Get VMA flags for a userspace address |
409 | * | 409 | * |
410 | * This function locates the VMAs for the buffer's userspace address and checks | 410 | * This function locates the VMAs for the buffer's userspace address and checks |
411 | * that their flags match. The onlflag that we need to care for at the moment is | 411 | * that their flags match. The only flag that we need to care for at the moment |
412 | * VM_PFNMAP. | 412 | * is VM_PFNMAP. |
413 | * | 413 | * |
414 | * The buffer vm_flags field is set to the first VMA flags. | 414 | * The buffer vm_flags field is set to the first VMA flags. |
415 | * | 415 | * |
diff --git a/drivers/media/video/omap3isp/ispresizer.c b/drivers/media/video/omap3isp/ispresizer.c index 653f88ba56db..0bb0f8cd36f5 100644 --- a/drivers/media/video/omap3isp/ispresizer.c +++ b/drivers/media/video/omap3isp/ispresizer.c | |||
@@ -714,19 +714,50 @@ static void resizer_print_status(struct isp_res_device *res) | |||
714 | * iw and ih are the input width and height after cropping. Those equations need | 714 | * iw and ih are the input width and height after cropping. Those equations need |
715 | * to be satisfied exactly for the resizer to work correctly. | 715 | * to be satisfied exactly for the resizer to work correctly. |
716 | * | 716 | * |
717 | * Reverting the equations, we can compute the resizing ratios with | 717 | * The equations can't be easily reverted, as the >> 8 operation is not linear. |
718 | * In addition, not all input sizes can be achieved for a given output size. To | ||
719 | * get the highest input size lower than or equal to the requested input size, | ||
720 | * we need to compute the highest resizing ratio that satisfies the following | ||
721 | * inequality (taking the 4-tap mode width equation as an example) | ||
722 | * | ||
723 | * iw >= (32 * sph + (ow - 1) * hrsz + 16) >> 8 - 7 | ||
724 | * | ||
725 | * (where iw is the requested input width) which can be rewritten as | ||
726 | * | ||
727 | * iw - 7 >= (32 * sph + (ow - 1) * hrsz + 16) >> 8 | ||
728 | * (iw - 7) << 8 >= 32 * sph + (ow - 1) * hrsz + 16 - b | ||
729 | * ((iw - 7) << 8) + b >= 32 * sph + (ow - 1) * hrsz + 16 | ||
730 | * | ||
731 | * where b is the value of the 8 least significant bits of the right hand side | ||
732 | * expression of the last inequality. The highest resizing ratio value will be | ||
733 | * achieved when b is equal to its maximum value of 255. That resizing ratio | ||
734 | * value will still satisfy the original inequality, as b will disappear when | ||
735 | * the expression will be shifted right by 8. | ||
736 | * | ||
737 | * The reverted the equations thus become | ||
718 | * | 738 | * |
719 | * - 8-phase, 4-tap mode | 739 | * - 8-phase, 4-tap mode |
720 | * hrsz = ((iw - 7) * 256 - 16 - 32 * sph) / (ow - 1) | 740 | * hrsz = ((iw - 7) * 256 + 255 - 16 - 32 * sph) / (ow - 1) |
721 | * vrsz = ((ih - 4) * 256 - 16 - 32 * spv) / (oh - 1) | 741 | * vrsz = ((ih - 4) * 256 + 255 - 16 - 32 * spv) / (oh - 1) |
722 | * - 4-phase, 7-tap mode | 742 | * - 4-phase, 7-tap mode |
723 | * hrsz = ((iw - 7) * 256 - 32 - 64 * sph) / (ow - 1) | 743 | * hrsz = ((iw - 7) * 256 + 255 - 32 - 64 * sph) / (ow - 1) |
724 | * vrsz = ((ih - 7) * 256 - 32 - 64 * spv) / (oh - 1) | 744 | * vrsz = ((ih - 7) * 256 + 255 - 32 - 64 * spv) / (oh - 1) |
725 | * | 745 | * |
726 | * The ratios are integer values, and must be rounded down to ensure that the | 746 | * The ratios are integer values, and are rounded down to ensure that the |
727 | * cropped input size is not bigger than the uncropped input size. As the ratio | 747 | * cropped input size is not bigger than the uncropped input size. |
728 | * in 7-tap mode is always smaller than the ratio in 4-tap mode, we can use the | 748 | * |
729 | * 7-tap mode equations to compute a ratio approximation. | 749 | * As the number of phases/taps, used to select the correct equations to compute |
750 | * the ratio, depends on the ratio, we start with the 4-tap mode equations to | ||
751 | * compute an approximation of the ratio, and switch to the 7-tap mode equations | ||
752 | * if the approximation is higher than the ratio threshold. | ||
753 | * | ||
754 | * As the 7-tap mode equations will return a ratio smaller than or equal to the | ||
755 | * 4-tap mode equations, the resulting ratio could become lower than or equal to | ||
756 | * the ratio threshold. This 'equations loop' isn't an issue as long as the | ||
757 | * correct equations are used to compute the final input size. Starting with the | ||
758 | * 4-tap mode equations ensure that, in case of values resulting in a 'ratio | ||
759 | * loop', the smallest of the ratio values will be used, never exceeding the | ||
760 | * requested input size. | ||
730 | * | 761 | * |
731 | * We first clamp the output size according to the hardware capabilitie to avoid | 762 | * We first clamp the output size according to the hardware capabilitie to avoid |
732 | * auto-cropping the input more than required to satisfy the TRM equations. The | 763 | * auto-cropping the input more than required to satisfy the TRM equations. The |
@@ -775,6 +806,8 @@ static void resizer_calc_ratios(struct isp_res_device *res, | |||
775 | unsigned int max_width; | 806 | unsigned int max_width; |
776 | unsigned int max_height; | 807 | unsigned int max_height; |
777 | unsigned int width_alignment; | 808 | unsigned int width_alignment; |
809 | unsigned int width; | ||
810 | unsigned int height; | ||
778 | 811 | ||
779 | /* | 812 | /* |
780 | * Clamp the output height based on the hardware capabilities and | 813 | * Clamp the output height based on the hardware capabilities and |
@@ -786,19 +819,22 @@ static void resizer_calc_ratios(struct isp_res_device *res, | |||
786 | max_height = min_t(unsigned int, max_height, MAX_OUT_HEIGHT); | 819 | max_height = min_t(unsigned int, max_height, MAX_OUT_HEIGHT); |
787 | output->height = clamp(output->height, min_height, max_height); | 820 | output->height = clamp(output->height, min_height, max_height); |
788 | 821 | ||
789 | ratio->vert = ((input->height - 7) * 256 - 32 - 64 * spv) | 822 | ratio->vert = ((input->height - 4) * 256 + 255 - 16 - 32 * spv) |
790 | / (output->height - 1); | 823 | / (output->height - 1); |
824 | if (ratio->vert > MID_RESIZE_VALUE) | ||
825 | ratio->vert = ((input->height - 7) * 256 + 255 - 32 - 64 * spv) | ||
826 | / (output->height - 1); | ||
791 | ratio->vert = clamp_t(unsigned int, ratio->vert, | 827 | ratio->vert = clamp_t(unsigned int, ratio->vert, |
792 | MIN_RESIZE_VALUE, MAX_RESIZE_VALUE); | 828 | MIN_RESIZE_VALUE, MAX_RESIZE_VALUE); |
793 | 829 | ||
794 | if (ratio->vert <= MID_RESIZE_VALUE) { | 830 | if (ratio->vert <= MID_RESIZE_VALUE) { |
795 | upscaled_height = (output->height - 1) * ratio->vert | 831 | upscaled_height = (output->height - 1) * ratio->vert |
796 | + 32 * spv + 16; | 832 | + 32 * spv + 16; |
797 | input->height = (upscaled_height >> 8) + 4; | 833 | height = (upscaled_height >> 8) + 4; |
798 | } else { | 834 | } else { |
799 | upscaled_height = (output->height - 1) * ratio->vert | 835 | upscaled_height = (output->height - 1) * ratio->vert |
800 | + 64 * spv + 32; | 836 | + 64 * spv + 32; |
801 | input->height = (upscaled_height >> 8) + 7; | 837 | height = (upscaled_height >> 8) + 7; |
802 | } | 838 | } |
803 | 839 | ||
804 | /* | 840 | /* |
@@ -854,20 +890,29 @@ static void resizer_calc_ratios(struct isp_res_device *res, | |||
854 | max_width & ~(width_alignment - 1)); | 890 | max_width & ~(width_alignment - 1)); |
855 | output->width = ALIGN(output->width, width_alignment); | 891 | output->width = ALIGN(output->width, width_alignment); |
856 | 892 | ||
857 | ratio->horz = ((input->width - 7) * 256 - 32 - 64 * sph) | 893 | ratio->horz = ((input->width - 7) * 256 + 255 - 16 - 32 * sph) |
858 | / (output->width - 1); | 894 | / (output->width - 1); |
895 | if (ratio->horz > MID_RESIZE_VALUE) | ||
896 | ratio->horz = ((input->width - 7) * 256 + 255 - 32 - 64 * sph) | ||
897 | / (output->width - 1); | ||
859 | ratio->horz = clamp_t(unsigned int, ratio->horz, | 898 | ratio->horz = clamp_t(unsigned int, ratio->horz, |
860 | MIN_RESIZE_VALUE, MAX_RESIZE_VALUE); | 899 | MIN_RESIZE_VALUE, MAX_RESIZE_VALUE); |
861 | 900 | ||
862 | if (ratio->horz <= MID_RESIZE_VALUE) { | 901 | if (ratio->horz <= MID_RESIZE_VALUE) { |
863 | upscaled_width = (output->width - 1) * ratio->horz | 902 | upscaled_width = (output->width - 1) * ratio->horz |
864 | + 32 * sph + 16; | 903 | + 32 * sph + 16; |
865 | input->width = (upscaled_width >> 8) + 7; | 904 | width = (upscaled_width >> 8) + 7; |
866 | } else { | 905 | } else { |
867 | upscaled_width = (output->width - 1) * ratio->horz | 906 | upscaled_width = (output->width - 1) * ratio->horz |
868 | + 64 * sph + 32; | 907 | + 64 * sph + 32; |
869 | input->width = (upscaled_width >> 8) + 7; | 908 | width = (upscaled_width >> 8) + 7; |
870 | } | 909 | } |
910 | |||
911 | /* Center the new crop rectangle. */ | ||
912 | input->left += (input->width - width) / 2; | ||
913 | input->top += (input->height - height) / 2; | ||
914 | input->width = width; | ||
915 | input->height = height; | ||
871 | } | 916 | } |
872 | 917 | ||
873 | /* | 918 | /* |
diff --git a/drivers/media/video/omap3isp/ispstat.h b/drivers/media/video/omap3isp/ispstat.h index 820950c9ef46..d86da94fa50d 100644 --- a/drivers/media/video/omap3isp/ispstat.h +++ b/drivers/media/video/omap3isp/ispstat.h | |||
@@ -131,9 +131,9 @@ struct ispstat { | |||
131 | struct ispstat_generic_config { | 131 | struct ispstat_generic_config { |
132 | /* | 132 | /* |
133 | * Fields must be in the same order as in: | 133 | * Fields must be in the same order as in: |
134 | * - isph3a_aewb_config | 134 | * - omap3isp_h3a_aewb_config |
135 | * - isph3a_af_config | 135 | * - omap3isp_h3a_af_config |
136 | * - isphist_config | 136 | * - omap3isp_hist_config |
137 | */ | 137 | */ |
138 | u32 buf_size; | 138 | u32 buf_size; |
139 | u16 config_counter; | 139 | u16 config_counter; |
diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index 208a7ec739d7..9cd8f1aa567b 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c | |||
@@ -47,29 +47,59 @@ | |||
47 | 47 | ||
48 | static struct isp_format_info formats[] = { | 48 | static struct isp_format_info formats[] = { |
49 | { V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, | 49 | { V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, |
50 | V4L2_MBUS_FMT_Y8_1X8, V4L2_PIX_FMT_GREY, 8, }, | 50 | V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, |
51 | V4L2_PIX_FMT_GREY, 8, }, | ||
52 | { V4L2_MBUS_FMT_Y10_1X10, V4L2_MBUS_FMT_Y10_1X10, | ||
53 | V4L2_MBUS_FMT_Y10_1X10, V4L2_MBUS_FMT_Y8_1X8, | ||
54 | V4L2_PIX_FMT_Y10, 10, }, | ||
55 | { V4L2_MBUS_FMT_Y12_1X12, V4L2_MBUS_FMT_Y10_1X10, | ||
56 | V4L2_MBUS_FMT_Y12_1X12, V4L2_MBUS_FMT_Y8_1X8, | ||
57 | V4L2_PIX_FMT_Y12, 12, }, | ||
58 | { V4L2_MBUS_FMT_SBGGR8_1X8, V4L2_MBUS_FMT_SBGGR8_1X8, | ||
59 | V4L2_MBUS_FMT_SBGGR8_1X8, V4L2_MBUS_FMT_SBGGR8_1X8, | ||
60 | V4L2_PIX_FMT_SBGGR8, 8, }, | ||
61 | { V4L2_MBUS_FMT_SGBRG8_1X8, V4L2_MBUS_FMT_SGBRG8_1X8, | ||
62 | V4L2_MBUS_FMT_SGBRG8_1X8, V4L2_MBUS_FMT_SGBRG8_1X8, | ||
63 | V4L2_PIX_FMT_SGBRG8, 8, }, | ||
64 | { V4L2_MBUS_FMT_SGRBG8_1X8, V4L2_MBUS_FMT_SGRBG8_1X8, | ||
65 | V4L2_MBUS_FMT_SGRBG8_1X8, V4L2_MBUS_FMT_SGRBG8_1X8, | ||
66 | V4L2_PIX_FMT_SGRBG8, 8, }, | ||
67 | { V4L2_MBUS_FMT_SRGGB8_1X8, V4L2_MBUS_FMT_SRGGB8_1X8, | ||
68 | V4L2_MBUS_FMT_SRGGB8_1X8, V4L2_MBUS_FMT_SRGGB8_1X8, | ||
69 | V4L2_PIX_FMT_SRGGB8, 8, }, | ||
51 | { V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, | 70 | { V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, |
52 | V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_PIX_FMT_SGRBG10DPCM8, 8, }, | 71 | V4L2_MBUS_FMT_SGRBG10_1X10, 0, |
72 | V4L2_PIX_FMT_SGRBG10DPCM8, 8, }, | ||
53 | { V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR10_1X10, | 73 | { V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR10_1X10, |
54 | V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_PIX_FMT_SBGGR10, 10, }, | 74 | V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR8_1X8, |
75 | V4L2_PIX_FMT_SBGGR10, 10, }, | ||
55 | { V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG10_1X10, | 76 | { V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG10_1X10, |
56 | V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_PIX_FMT_SGBRG10, 10, }, | 77 | V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG8_1X8, |
78 | V4L2_PIX_FMT_SGBRG10, 10, }, | ||
57 | { V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG10_1X10, | 79 | { V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG10_1X10, |
58 | V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_PIX_FMT_SGRBG10, 10, }, | 80 | V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG8_1X8, |
81 | V4L2_PIX_FMT_SGRBG10, 10, }, | ||
59 | { V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB10_1X10, | 82 | { V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB10_1X10, |
60 | V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_PIX_FMT_SRGGB10, 10, }, | 83 | V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB8_1X8, |
84 | V4L2_PIX_FMT_SRGGB10, 10, }, | ||
61 | { V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR10_1X10, | 85 | { V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR10_1X10, |
62 | V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_PIX_FMT_SBGGR12, 12, }, | 86 | V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR8_1X8, |
87 | V4L2_PIX_FMT_SBGGR12, 12, }, | ||
63 | { V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG10_1X10, | 88 | { V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG10_1X10, |
64 | V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_PIX_FMT_SGBRG12, 12, }, | 89 | V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG8_1X8, |
90 | V4L2_PIX_FMT_SGBRG12, 12, }, | ||
65 | { V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG10_1X10, | 91 | { V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG10_1X10, |
66 | V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_PIX_FMT_SGRBG12, 12, }, | 92 | V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG8_1X8, |
93 | V4L2_PIX_FMT_SGRBG12, 12, }, | ||
67 | { V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB10_1X10, | 94 | { V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB10_1X10, |
68 | V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_PIX_FMT_SRGGB12, 12, }, | 95 | V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB8_1X8, |
96 | V4L2_PIX_FMT_SRGGB12, 12, }, | ||
69 | { V4L2_MBUS_FMT_UYVY8_1X16, V4L2_MBUS_FMT_UYVY8_1X16, | 97 | { V4L2_MBUS_FMT_UYVY8_1X16, V4L2_MBUS_FMT_UYVY8_1X16, |
70 | V4L2_MBUS_FMT_UYVY8_1X16, V4L2_PIX_FMT_UYVY, 16, }, | 98 | V4L2_MBUS_FMT_UYVY8_1X16, 0, |
99 | V4L2_PIX_FMT_UYVY, 16, }, | ||
71 | { V4L2_MBUS_FMT_YUYV8_1X16, V4L2_MBUS_FMT_YUYV8_1X16, | 100 | { V4L2_MBUS_FMT_YUYV8_1X16, V4L2_MBUS_FMT_YUYV8_1X16, |
72 | V4L2_MBUS_FMT_YUYV8_1X16, V4L2_PIX_FMT_YUYV, 16, }, | 101 | V4L2_MBUS_FMT_YUYV8_1X16, 0, |
102 | V4L2_PIX_FMT_YUYV, 16, }, | ||
73 | }; | 103 | }; |
74 | 104 | ||
75 | const struct isp_format_info * | 105 | const struct isp_format_info * |
@@ -86,6 +116,37 @@ omap3isp_video_format_info(enum v4l2_mbus_pixelcode code) | |||
86 | } | 116 | } |
87 | 117 | ||
88 | /* | 118 | /* |
119 | * Decide whether desired output pixel code can be obtained with | ||
120 | * the lane shifter by shifting the input pixel code. | ||
121 | * @in: input pixelcode to shifter | ||
122 | * @out: output pixelcode from shifter | ||
123 | * @additional_shift: # of bits the sensor's LSB is offset from CAMEXT[0] | ||
124 | * | ||
125 | * return true if the combination is possible | ||
126 | * return false otherwise | ||
127 | */ | ||
128 | static bool isp_video_is_shiftable(enum v4l2_mbus_pixelcode in, | ||
129 | enum v4l2_mbus_pixelcode out, | ||
130 | unsigned int additional_shift) | ||
131 | { | ||
132 | const struct isp_format_info *in_info, *out_info; | ||
133 | |||
134 | if (in == out) | ||
135 | return true; | ||
136 | |||
137 | in_info = omap3isp_video_format_info(in); | ||
138 | out_info = omap3isp_video_format_info(out); | ||
139 | |||
140 | if ((in_info->flavor == 0) || (out_info->flavor == 0)) | ||
141 | return false; | ||
142 | |||
143 | if (in_info->flavor != out_info->flavor) | ||
144 | return false; | ||
145 | |||
146 | return in_info->bpp - out_info->bpp + additional_shift <= 6; | ||
147 | } | ||
148 | |||
149 | /* | ||
89 | * isp_video_mbus_to_pix - Convert v4l2_mbus_framefmt to v4l2_pix_format | 150 | * isp_video_mbus_to_pix - Convert v4l2_mbus_framefmt to v4l2_pix_format |
90 | * @video: ISP video instance | 151 | * @video: ISP video instance |
91 | * @mbus: v4l2_mbus_framefmt format (input) | 152 | * @mbus: v4l2_mbus_framefmt format (input) |
@@ -235,6 +296,7 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe) | |||
235 | return -EPIPE; | 296 | return -EPIPE; |
236 | 297 | ||
237 | while (1) { | 298 | while (1) { |
299 | unsigned int shifter_link; | ||
238 | /* Retrieve the sink format */ | 300 | /* Retrieve the sink format */ |
239 | pad = &subdev->entity.pads[0]; | 301 | pad = &subdev->entity.pads[0]; |
240 | if (!(pad->flags & MEDIA_PAD_FL_SINK)) | 302 | if (!(pad->flags & MEDIA_PAD_FL_SINK)) |
@@ -263,6 +325,10 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe) | |||
263 | return -ENOSPC; | 325 | return -ENOSPC; |
264 | } | 326 | } |
265 | 327 | ||
328 | /* If sink pad is on CCDC, the link has the lane shifter | ||
329 | * in the middle of it. */ | ||
330 | shifter_link = subdev == &isp->isp_ccdc.subdev; | ||
331 | |||
266 | /* Retrieve the source format */ | 332 | /* Retrieve the source format */ |
267 | pad = media_entity_remote_source(pad); | 333 | pad = media_entity_remote_source(pad); |
268 | if (pad == NULL || | 334 | if (pad == NULL || |
@@ -278,10 +344,24 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe) | |||
278 | return -EPIPE; | 344 | return -EPIPE; |
279 | 345 | ||
280 | /* Check if the two ends match */ | 346 | /* Check if the two ends match */ |
281 | if (fmt_source.format.code != fmt_sink.format.code || | 347 | if (fmt_source.format.width != fmt_sink.format.width || |
282 | fmt_source.format.width != fmt_sink.format.width || | ||
283 | fmt_source.format.height != fmt_sink.format.height) | 348 | fmt_source.format.height != fmt_sink.format.height) |
284 | return -EPIPE; | 349 | return -EPIPE; |
350 | |||
351 | if (shifter_link) { | ||
352 | unsigned int parallel_shift = 0; | ||
353 | if (isp->isp_ccdc.input == CCDC_INPUT_PARALLEL) { | ||
354 | struct isp_parallel_platform_data *pdata = | ||
355 | &((struct isp_v4l2_subdevs_group *) | ||
356 | subdev->host_priv)->bus.parallel; | ||
357 | parallel_shift = pdata->data_lane_shift * 2; | ||
358 | } | ||
359 | if (!isp_video_is_shiftable(fmt_source.format.code, | ||
360 | fmt_sink.format.code, | ||
361 | parallel_shift)) | ||
362 | return -EPIPE; | ||
363 | } else if (fmt_source.format.code != fmt_sink.format.code) | ||
364 | return -EPIPE; | ||
285 | } | 365 | } |
286 | 366 | ||
287 | return 0; | 367 | return 0; |
diff --git a/drivers/media/video/omap3isp/ispvideo.h b/drivers/media/video/omap3isp/ispvideo.h index 524a1acd0906..911bea64e78a 100644 --- a/drivers/media/video/omap3isp/ispvideo.h +++ b/drivers/media/video/omap3isp/ispvideo.h | |||
@@ -49,6 +49,8 @@ struct v4l2_pix_format; | |||
49 | * bits. Identical to @code if the format is 10 bits wide or less. | 49 | * bits. Identical to @code if the format is 10 bits wide or less. |
50 | * @uncompressed: V4L2 media bus format code for the corresponding uncompressed | 50 | * @uncompressed: V4L2 media bus format code for the corresponding uncompressed |
51 | * format. Identical to @code if the format is not DPCM compressed. | 51 | * format. Identical to @code if the format is not DPCM compressed. |
52 | * @flavor: V4L2 media bus format code for the same pixel layout but | ||
53 | * shifted to be 8 bits per pixel. =0 if format is not shiftable. | ||
52 | * @pixelformat: V4L2 pixel format FCC identifier | 54 | * @pixelformat: V4L2 pixel format FCC identifier |
53 | * @bpp: Bits per pixel | 55 | * @bpp: Bits per pixel |
54 | */ | 56 | */ |
@@ -56,6 +58,7 @@ struct isp_format_info { | |||
56 | enum v4l2_mbus_pixelcode code; | 58 | enum v4l2_mbus_pixelcode code; |
57 | enum v4l2_mbus_pixelcode truncated; | 59 | enum v4l2_mbus_pixelcode truncated; |
58 | enum v4l2_mbus_pixelcode uncompressed; | 60 | enum v4l2_mbus_pixelcode uncompressed; |
61 | enum v4l2_mbus_pixelcode flavor; | ||
59 | u32 pixelformat; | 62 | u32 pixelformat; |
60 | unsigned int bpp; | 63 | unsigned int bpp; |
61 | }; | 64 | }; |
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 95f8b4e11e46..d142b40ea64e 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
@@ -527,7 +527,7 @@ static int fimc_cap_s_fmt_mplane(struct file *file, void *priv, | |||
527 | if (ret) | 527 | if (ret) |
528 | return ret; | 528 | return ret; |
529 | 529 | ||
530 | if (vb2_is_streaming(&fimc->vid_cap.vbq) || fimc_capture_active(fimc)) | 530 | if (vb2_is_busy(&fimc->vid_cap.vbq) || fimc_capture_active(fimc)) |
531 | return -EBUSY; | 531 | return -EBUSY; |
532 | 532 | ||
533 | frame = &ctx->d_frame; | 533 | frame = &ctx->d_frame; |
@@ -539,8 +539,10 @@ static int fimc_cap_s_fmt_mplane(struct file *file, void *priv, | |||
539 | return -EINVAL; | 539 | return -EINVAL; |
540 | } | 540 | } |
541 | 541 | ||
542 | for (i = 0; i < frame->fmt->colplanes; i++) | 542 | for (i = 0; i < frame->fmt->colplanes; i++) { |
543 | frame->payload[i] = pix->plane_fmt[i].bytesperline * pix->height; | 543 | frame->payload[i] = |
544 | (pix->width * pix->height * frame->fmt->depth[i]) >> 3; | ||
545 | } | ||
544 | 546 | ||
545 | /* Output DMA frame pixel size and offsets. */ | 547 | /* Output DMA frame pixel size and offsets. */ |
546 | frame->f_width = pix->plane_fmt[0].bytesperline * 8 | 548 | frame->f_width = pix->plane_fmt[0].bytesperline * 8 |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 6c919b38a3d8..dc91a8511af6 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
@@ -361,10 +361,20 @@ static void fimc_capture_irq_handler(struct fimc_dev *fimc) | |||
361 | { | 361 | { |
362 | struct fimc_vid_cap *cap = &fimc->vid_cap; | 362 | struct fimc_vid_cap *cap = &fimc->vid_cap; |
363 | struct fimc_vid_buffer *v_buf; | 363 | struct fimc_vid_buffer *v_buf; |
364 | struct timeval *tv; | ||
365 | struct timespec ts; | ||
364 | 366 | ||
365 | if (!list_empty(&cap->active_buf_q) && | 367 | if (!list_empty(&cap->active_buf_q) && |
366 | test_bit(ST_CAPT_RUN, &fimc->state)) { | 368 | test_bit(ST_CAPT_RUN, &fimc->state)) { |
369 | ktime_get_real_ts(&ts); | ||
370 | |||
367 | v_buf = active_queue_pop(cap); | 371 | v_buf = active_queue_pop(cap); |
372 | |||
373 | tv = &v_buf->vb.v4l2_buf.timestamp; | ||
374 | tv->tv_sec = ts.tv_sec; | ||
375 | tv->tv_usec = ts.tv_nsec / NSEC_PER_USEC; | ||
376 | v_buf->vb.v4l2_buf.sequence = cap->frame_count++; | ||
377 | |||
368 | vb2_buffer_done(&v_buf->vb, VB2_BUF_STATE_DONE); | 378 | vb2_buffer_done(&v_buf->vb, VB2_BUF_STATE_DONE); |
369 | } | 379 | } |
370 | 380 | ||
@@ -758,7 +768,7 @@ static void fimc_unlock(struct vb2_queue *vq) | |||
758 | mutex_unlock(&ctx->fimc_dev->lock); | 768 | mutex_unlock(&ctx->fimc_dev->lock); |
759 | } | 769 | } |
760 | 770 | ||
761 | struct vb2_ops fimc_qops = { | 771 | static struct vb2_ops fimc_qops = { |
762 | .queue_setup = fimc_queue_setup, | 772 | .queue_setup = fimc_queue_setup, |
763 | .buf_prepare = fimc_buf_prepare, | 773 | .buf_prepare = fimc_buf_prepare, |
764 | .buf_queue = fimc_buf_queue, | 774 | .buf_queue = fimc_buf_queue, |
@@ -927,23 +937,23 @@ int fimc_vidioc_try_fmt_mplane(struct file *file, void *priv, | |||
927 | pix->num_planes = fmt->memplanes; | 937 | pix->num_planes = fmt->memplanes; |
928 | pix->colorspace = V4L2_COLORSPACE_JPEG; | 938 | pix->colorspace = V4L2_COLORSPACE_JPEG; |
929 | 939 | ||
930 | for (i = 0; i < pix->num_planes; ++i) { | ||
931 | int bpl = pix->plane_fmt[i].bytesperline; | ||
932 | 940 | ||
933 | dbg("[%d] bpl: %d, depth: %d, w: %d, h: %d", | 941 | for (i = 0; i < pix->num_planes; ++i) { |
934 | i, bpl, fmt->depth[i], pix->width, pix->height); | 942 | u32 bpl = pix->plane_fmt[i].bytesperline; |
943 | u32 *sizeimage = &pix->plane_fmt[i].sizeimage; | ||
935 | 944 | ||
936 | if (!bpl || (bpl * 8 / fmt->depth[i]) > pix->width) | 945 | if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width)) |
937 | bpl = (pix->width * fmt->depth[0]) >> 3; | 946 | bpl = pix->width; /* Planar */ |
938 | 947 | ||
939 | if (!pix->plane_fmt[i].sizeimage) | 948 | if (fmt->colplanes == 1 && /* Packed */ |
940 | pix->plane_fmt[i].sizeimage = pix->height * bpl; | 949 | (bpl == 0 || ((bpl * 8) / fmt->depth[i]) < pix->width)) |
950 | bpl = (pix->width * fmt->depth[0]) / 8; | ||
941 | 951 | ||
942 | pix->plane_fmt[i].bytesperline = bpl; | 952 | if (i == 0) /* Same bytesperline for each plane. */ |
953 | mod_x = bpl; | ||
943 | 954 | ||
944 | dbg("[%d]: bpl: %d, sizeimage: %d", | 955 | pix->plane_fmt[i].bytesperline = mod_x; |
945 | i, pix->plane_fmt[i].bytesperline, | 956 | *sizeimage = (pix->width * pix->height * fmt->depth[i]) / 8; |
946 | pix->plane_fmt[i].sizeimage); | ||
947 | } | 957 | } |
948 | 958 | ||
949 | return 0; | 959 | return 0; |
@@ -965,7 +975,7 @@ static int fimc_m2m_s_fmt_mplane(struct file *file, void *priv, | |||
965 | 975 | ||
966 | vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); | 976 | vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); |
967 | 977 | ||
968 | if (vb2_is_streaming(vq)) { | 978 | if (vb2_is_busy(vq)) { |
969 | v4l2_err(&fimc->m2m.v4l2_dev, "queue (%d) busy\n", f->type); | 979 | v4l2_err(&fimc->m2m.v4l2_dev, "queue (%d) busy\n", f->type); |
970 | return -EBUSY; | 980 | return -EBUSY; |
971 | } | 981 | } |
@@ -985,8 +995,10 @@ static int fimc_m2m_s_fmt_mplane(struct file *file, void *priv, | |||
985 | if (!frame->fmt) | 995 | if (!frame->fmt) |
986 | return -EINVAL; | 996 | return -EINVAL; |
987 | 997 | ||
988 | for (i = 0; i < frame->fmt->colplanes; i++) | 998 | for (i = 0; i < frame->fmt->colplanes; i++) { |
989 | frame->payload[i] = pix->plane_fmt[i].bytesperline * pix->height; | 999 | frame->payload[i] = |
1000 | (pix->width * pix->height * frame->fmt->depth[i]) / 8; | ||
1001 | } | ||
990 | 1002 | ||
991 | frame->f_width = pix->plane_fmt[0].bytesperline * 8 / | 1003 | frame->f_width = pix->plane_fmt[0].bytesperline * 8 / |
992 | frame->fmt->depth[0]; | 1004 | frame->fmt->depth[0]; |
@@ -1750,7 +1762,7 @@ static int __devexit fimc_remove(struct platform_device *pdev) | |||
1750 | } | 1762 | } |
1751 | 1763 | ||
1752 | /* Image pixel limits, similar across several FIMC HW revisions. */ | 1764 | /* Image pixel limits, similar across several FIMC HW revisions. */ |
1753 | static struct fimc_pix_limit s5p_pix_limit[3] = { | 1765 | static struct fimc_pix_limit s5p_pix_limit[4] = { |
1754 | [0] = { | 1766 | [0] = { |
1755 | .scaler_en_w = 3264, | 1767 | .scaler_en_w = 3264, |
1756 | .scaler_dis_w = 8192, | 1768 | .scaler_dis_w = 8192, |
@@ -1775,6 +1787,14 @@ static struct fimc_pix_limit s5p_pix_limit[3] = { | |||
1775 | .out_rot_en_w = 1280, | 1787 | .out_rot_en_w = 1280, |
1776 | .out_rot_dis_w = 1920, | 1788 | .out_rot_dis_w = 1920, |
1777 | }, | 1789 | }, |
1790 | [3] = { | ||
1791 | .scaler_en_w = 1920, | ||
1792 | .scaler_dis_w = 8192, | ||
1793 | .in_rot_en_h = 1366, | ||
1794 | .in_rot_dis_w = 8192, | ||
1795 | .out_rot_en_w = 1366, | ||
1796 | .out_rot_dis_w = 1920, | ||
1797 | }, | ||
1778 | }; | 1798 | }; |
1779 | 1799 | ||
1780 | static struct samsung_fimc_variant fimc0_variant_s5p = { | 1800 | static struct samsung_fimc_variant fimc0_variant_s5p = { |
@@ -1827,7 +1847,7 @@ static struct samsung_fimc_variant fimc2_variant_s5pv210 = { | |||
1827 | .pix_limit = &s5p_pix_limit[2], | 1847 | .pix_limit = &s5p_pix_limit[2], |
1828 | }; | 1848 | }; |
1829 | 1849 | ||
1830 | static struct samsung_fimc_variant fimc0_variant_s5pv310 = { | 1850 | static struct samsung_fimc_variant fimc0_variant_exynos4 = { |
1831 | .pix_hoff = 1, | 1851 | .pix_hoff = 1, |
1832 | .has_inp_rot = 1, | 1852 | .has_inp_rot = 1, |
1833 | .has_out_rot = 1, | 1853 | .has_out_rot = 1, |
@@ -1840,7 +1860,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv310 = { | |||
1840 | .pix_limit = &s5p_pix_limit[1], | 1860 | .pix_limit = &s5p_pix_limit[1], |
1841 | }; | 1861 | }; |
1842 | 1862 | ||
1843 | static struct samsung_fimc_variant fimc2_variant_s5pv310 = { | 1863 | static struct samsung_fimc_variant fimc2_variant_exynos4 = { |
1844 | .pix_hoff = 1, | 1864 | .pix_hoff = 1, |
1845 | .has_cistatus2 = 1, | 1865 | .has_cistatus2 = 1, |
1846 | .has_mainscaler_ext = 1, | 1866 | .has_mainscaler_ext = 1, |
@@ -1848,7 +1868,7 @@ static struct samsung_fimc_variant fimc2_variant_s5pv310 = { | |||
1848 | .min_out_pixsize = 16, | 1868 | .min_out_pixsize = 16, |
1849 | .hor_offs_align = 1, | 1869 | .hor_offs_align = 1, |
1850 | .out_buf_count = 32, | 1870 | .out_buf_count = 32, |
1851 | .pix_limit = &s5p_pix_limit[2], | 1871 | .pix_limit = &s5p_pix_limit[3], |
1852 | }; | 1872 | }; |
1853 | 1873 | ||
1854 | /* S5PC100 */ | 1874 | /* S5PC100 */ |
@@ -1874,12 +1894,12 @@ static struct samsung_fimc_driverdata fimc_drvdata_s5pv210 = { | |||
1874 | }; | 1894 | }; |
1875 | 1895 | ||
1876 | /* S5PV310, S5PC210 */ | 1896 | /* S5PV310, S5PC210 */ |
1877 | static struct samsung_fimc_driverdata fimc_drvdata_s5pv310 = { | 1897 | static struct samsung_fimc_driverdata fimc_drvdata_exynos4 = { |
1878 | .variant = { | 1898 | .variant = { |
1879 | [0] = &fimc0_variant_s5pv310, | 1899 | [0] = &fimc0_variant_exynos4, |
1880 | [1] = &fimc0_variant_s5pv310, | 1900 | [1] = &fimc0_variant_exynos4, |
1881 | [2] = &fimc0_variant_s5pv310, | 1901 | [2] = &fimc0_variant_exynos4, |
1882 | [3] = &fimc2_variant_s5pv310, | 1902 | [3] = &fimc2_variant_exynos4, |
1883 | }, | 1903 | }, |
1884 | .num_entities = 4, | 1904 | .num_entities = 4, |
1885 | .lclk_frequency = 166000000UL, | 1905 | .lclk_frequency = 166000000UL, |
@@ -1893,8 +1913,8 @@ static struct platform_device_id fimc_driver_ids[] = { | |||
1893 | .name = "s5pv210-fimc", | 1913 | .name = "s5pv210-fimc", |
1894 | .driver_data = (unsigned long)&fimc_drvdata_s5pv210, | 1914 | .driver_data = (unsigned long)&fimc_drvdata_s5pv210, |
1895 | }, { | 1915 | }, { |
1896 | .name = "s5pv310-fimc", | 1916 | .name = "exynos4-fimc", |
1897 | .driver_data = (unsigned long)&fimc_drvdata_s5pv310, | 1917 | .driver_data = (unsigned long)&fimc_drvdata_exynos4, |
1898 | }, | 1918 | }, |
1899 | {}, | 1919 | {}, |
1900 | }; | 1920 | }; |
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 3fe54bf41142..134e86bf6d97 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -922,7 +922,7 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int | |||
922 | /* Try 2560x1920, 1280x960, 640x480, 320x240 */ | 922 | /* Try 2560x1920, 1280x960, 640x480, 320x240 */ |
923 | mf.width = 2560 >> shift; | 923 | mf.width = 2560 >> shift; |
924 | mf.height = 1920 >> shift; | 924 | mf.height = 1920 >> shift; |
925 | ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, video, | 925 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, |
926 | s_mbus_fmt, &mf); | 926 | s_mbus_fmt, &mf); |
927 | if (ret < 0) | 927 | if (ret < 0) |
928 | return ret; | 928 | return ret; |
@@ -1224,7 +1224,7 @@ static int client_s_fmt(struct soc_camera_device *icd, | |||
1224 | struct v4l2_cropcap cap; | 1224 | struct v4l2_cropcap cap; |
1225 | int ret; | 1225 | int ret; |
1226 | 1226 | ||
1227 | ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, video, | 1227 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, |
1228 | s_mbus_fmt, mf); | 1228 | s_mbus_fmt, mf); |
1229 | if (ret < 0) | 1229 | if (ret < 0) |
1230 | return ret; | 1230 | return ret; |
@@ -1254,7 +1254,7 @@ static int client_s_fmt(struct soc_camera_device *icd, | |||
1254 | tmp_h = min(2 * tmp_h, max_height); | 1254 | tmp_h = min(2 * tmp_h, max_height); |
1255 | mf->width = tmp_w; | 1255 | mf->width = tmp_w; |
1256 | mf->height = tmp_h; | 1256 | mf->height = tmp_h; |
1257 | ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, video, | 1257 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, |
1258 | s_mbus_fmt, mf); | 1258 | s_mbus_fmt, mf); |
1259 | dev_geo(dev, "Camera scaled to %ux%u\n", | 1259 | dev_geo(dev, "Camera scaled to %ux%u\n", |
1260 | mf->width, mf->height); | 1260 | mf->width, mf->height); |
@@ -1658,7 +1658,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
1658 | mf.code = xlate->code; | 1658 | mf.code = xlate->code; |
1659 | mf.colorspace = pix->colorspace; | 1659 | mf.colorspace = pix->colorspace; |
1660 | 1660 | ||
1661 | ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, video, try_mbus_fmt, &mf); | 1661 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, try_mbus_fmt, &mf); |
1662 | if (ret < 0) | 1662 | if (ret < 0) |
1663 | return ret; | 1663 | return ret; |
1664 | 1664 | ||
@@ -1682,7 +1682,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
1682 | */ | 1682 | */ |
1683 | mf.width = 2560; | 1683 | mf.width = 2560; |
1684 | mf.height = 1920; | 1684 | mf.height = 1920; |
1685 | ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, video, | 1685 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, |
1686 | try_mbus_fmt, &mf); | 1686 | try_mbus_fmt, &mf); |
1687 | if (ret < 0) { | 1687 | if (ret < 0) { |
1688 | /* Shouldn't actually happen... */ | 1688 | /* Shouldn't actually happen... */ |
diff --git a/drivers/media/video/sh_mobile_csi2.c b/drivers/media/video/sh_mobile_csi2.c index dd1b81b1442b..98b87481fa94 100644 --- a/drivers/media/video/sh_mobile_csi2.c +++ b/drivers/media/video/sh_mobile_csi2.c | |||
@@ -38,6 +38,8 @@ struct sh_csi2 { | |||
38 | void __iomem *base; | 38 | void __iomem *base; |
39 | struct platform_device *pdev; | 39 | struct platform_device *pdev; |
40 | struct sh_csi2_client_config *client; | 40 | struct sh_csi2_client_config *client; |
41 | unsigned long (*query_bus_param)(struct soc_camera_device *); | ||
42 | int (*set_bus_param)(struct soc_camera_device *, unsigned long); | ||
41 | }; | 43 | }; |
42 | 44 | ||
43 | static int sh_csi2_try_fmt(struct v4l2_subdev *sd, | 45 | static int sh_csi2_try_fmt(struct v4l2_subdev *sd, |
@@ -208,6 +210,7 @@ static int sh_csi2_notify(struct notifier_block *nb, | |||
208 | case BUS_NOTIFY_BOUND_DRIVER: | 210 | case BUS_NOTIFY_BOUND_DRIVER: |
209 | snprintf(priv->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s%s", | 211 | snprintf(priv->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s%s", |
210 | dev_name(v4l2_dev->dev), ".mipi-csi"); | 212 | dev_name(v4l2_dev->dev), ".mipi-csi"); |
213 | priv->subdev.grp_id = (long)icd; | ||
211 | ret = v4l2_device_register_subdev(v4l2_dev, &priv->subdev); | 214 | ret = v4l2_device_register_subdev(v4l2_dev, &priv->subdev); |
212 | dev_dbg(dev, "%s(%p): ret(register_subdev) = %d\n", __func__, priv, ret); | 215 | dev_dbg(dev, "%s(%p): ret(register_subdev) = %d\n", __func__, priv, ret); |
213 | if (ret < 0) | 216 | if (ret < 0) |
@@ -215,6 +218,8 @@ static int sh_csi2_notify(struct notifier_block *nb, | |||
215 | 218 | ||
216 | priv->client = pdata->clients + i; | 219 | priv->client = pdata->clients + i; |
217 | 220 | ||
221 | priv->set_bus_param = icd->ops->set_bus_param; | ||
222 | priv->query_bus_param = icd->ops->query_bus_param; | ||
218 | icd->ops->set_bus_param = sh_csi2_set_bus_param; | 223 | icd->ops->set_bus_param = sh_csi2_set_bus_param; |
219 | icd->ops->query_bus_param = sh_csi2_query_bus_param; | 224 | icd->ops->query_bus_param = sh_csi2_query_bus_param; |
220 | 225 | ||
@@ -226,8 +231,10 @@ static int sh_csi2_notify(struct notifier_block *nb, | |||
226 | priv->client = NULL; | 231 | priv->client = NULL; |
227 | 232 | ||
228 | /* Driver is about to be unbound */ | 233 | /* Driver is about to be unbound */ |
229 | icd->ops->set_bus_param = NULL; | 234 | icd->ops->set_bus_param = priv->set_bus_param; |
230 | icd->ops->query_bus_param = NULL; | 235 | icd->ops->query_bus_param = priv->query_bus_param; |
236 | priv->set_bus_param = NULL; | ||
237 | priv->query_bus_param = NULL; | ||
231 | 238 | ||
232 | v4l2_device_unregister_subdev(&priv->subdev); | 239 | v4l2_device_unregister_subdev(&priv->subdev); |
233 | 240 | ||
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 46284489e4eb..3973f9a94753 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -996,10 +996,11 @@ static void soc_camera_free_i2c(struct soc_camera_device *icd) | |||
996 | { | 996 | { |
997 | struct i2c_client *client = | 997 | struct i2c_client *client = |
998 | to_i2c_client(to_soc_camera_control(icd)); | 998 | to_i2c_client(to_soc_camera_control(icd)); |
999 | struct i2c_adapter *adap = client->adapter; | ||
999 | dev_set_drvdata(&icd->dev, NULL); | 1000 | dev_set_drvdata(&icd->dev, NULL); |
1000 | v4l2_device_unregister_subdev(i2c_get_clientdata(client)); | 1001 | v4l2_device_unregister_subdev(i2c_get_clientdata(client)); |
1001 | i2c_unregister_device(client); | 1002 | i2c_unregister_device(client); |
1002 | i2c_put_adapter(client->adapter); | 1003 | i2c_put_adapter(adap); |
1003 | } | 1004 | } |
1004 | #else | 1005 | #else |
1005 | #define soc_camera_init_i2c(icd, icl) (-ENODEV) | 1006 | #define soc_camera_init_i2c(icd, icl) (-ENODEV) |
@@ -1071,6 +1072,9 @@ static int soc_camera_probe(struct device *dev) | |||
1071 | } | 1072 | } |
1072 | } | 1073 | } |
1073 | 1074 | ||
1075 | sd = soc_camera_to_subdev(icd); | ||
1076 | sd->grp_id = (long)icd; | ||
1077 | |||
1074 | /* At this point client .probe() should have run already */ | 1078 | /* At this point client .probe() should have run already */ |
1075 | ret = soc_camera_init_user_formats(icd); | 1079 | ret = soc_camera_init_user_formats(icd); |
1076 | if (ret < 0) | 1080 | if (ret < 0) |
@@ -1092,7 +1096,6 @@ static int soc_camera_probe(struct device *dev) | |||
1092 | goto evidstart; | 1096 | goto evidstart; |
1093 | 1097 | ||
1094 | /* Try to improve our guess of a reasonable window format */ | 1098 | /* Try to improve our guess of a reasonable window format */ |
1095 | sd = soc_camera_to_subdev(icd); | ||
1096 | if (!v4l2_subdev_call(sd, video, g_mbus_fmt, &mf)) { | 1099 | if (!v4l2_subdev_call(sd, video, g_mbus_fmt, &mf)) { |
1097 | icd->user_width = mf.width; | 1100 | icd->user_width = mf.width; |
1098 | icd->user_height = mf.height; | 1101 | icd->user_height = mf.height; |
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 498e6742579e..6dc7196296b3 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -389,7 +389,8 @@ static int v4l2_open(struct inode *inode, struct file *filp) | |||
389 | video_get(vdev); | 389 | video_get(vdev); |
390 | mutex_unlock(&videodev_lock); | 390 | mutex_unlock(&videodev_lock); |
391 | #if defined(CONFIG_MEDIA_CONTROLLER) | 391 | #if defined(CONFIG_MEDIA_CONTROLLER) |
392 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) { | 392 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev && |
393 | vdev->vfl_type != VFL_TYPE_SUBDEV) { | ||
393 | entity = media_entity_get(&vdev->entity); | 394 | entity = media_entity_get(&vdev->entity); |
394 | if (!entity) { | 395 | if (!entity) { |
395 | ret = -EBUSY; | 396 | ret = -EBUSY; |
@@ -415,7 +416,8 @@ err: | |||
415 | /* decrease the refcount in case of an error */ | 416 | /* decrease the refcount in case of an error */ |
416 | if (ret) { | 417 | if (ret) { |
417 | #if defined(CONFIG_MEDIA_CONTROLLER) | 418 | #if defined(CONFIG_MEDIA_CONTROLLER) |
418 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) | 419 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev && |
420 | vdev->vfl_type != VFL_TYPE_SUBDEV) | ||
419 | media_entity_put(entity); | 421 | media_entity_put(entity); |
420 | #endif | 422 | #endif |
421 | video_put(vdev); | 423 | video_put(vdev); |
@@ -437,7 +439,8 @@ static int v4l2_release(struct inode *inode, struct file *filp) | |||
437 | mutex_unlock(vdev->lock); | 439 | mutex_unlock(vdev->lock); |
438 | } | 440 | } |
439 | #if defined(CONFIG_MEDIA_CONTROLLER) | 441 | #if defined(CONFIG_MEDIA_CONTROLLER) |
440 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) | 442 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev && |
443 | vdev->vfl_type != VFL_TYPE_SUBDEV) | ||
441 | media_entity_put(&vdev->entity); | 444 | media_entity_put(&vdev->entity); |
442 | #endif | 445 | #endif |
443 | /* decrease the refcount unconditionally since the release() | 446 | /* decrease the refcount unconditionally since the release() |
@@ -686,7 +689,8 @@ int __video_register_device(struct video_device *vdev, int type, int nr, | |||
686 | 689 | ||
687 | #if defined(CONFIG_MEDIA_CONTROLLER) | 690 | #if defined(CONFIG_MEDIA_CONTROLLER) |
688 | /* Part 5: Register the entity. */ | 691 | /* Part 5: Register the entity. */ |
689 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) { | 692 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev && |
693 | vdev->vfl_type != VFL_TYPE_SUBDEV) { | ||
690 | vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L; | 694 | vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L; |
691 | vdev->entity.name = vdev->name; | 695 | vdev->entity.name = vdev->name; |
692 | vdev->entity.v4l.major = VIDEO_MAJOR; | 696 | vdev->entity.v4l.major = VIDEO_MAJOR; |
@@ -733,7 +737,8 @@ void video_unregister_device(struct video_device *vdev) | |||
733 | return; | 737 | return; |
734 | 738 | ||
735 | #if defined(CONFIG_MEDIA_CONTROLLER) | 739 | #if defined(CONFIG_MEDIA_CONTROLLER) |
736 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) | 740 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev && |
741 | vdev->vfl_type != VFL_TYPE_SUBDEV) | ||
737 | media_device_unregister_entity(&vdev->entity); | 742 | media_device_unregister_entity(&vdev->entity); |
738 | #endif | 743 | #endif |
739 | 744 | ||
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c index c4742fc15529..c9691115f2d2 100644 --- a/drivers/media/video/videobuf-dma-contig.c +++ b/drivers/media/video/videobuf-dma-contig.c | |||
@@ -300,7 +300,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
300 | 300 | ||
301 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 301 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
302 | retval = remap_pfn_range(vma, vma->vm_start, | 302 | retval = remap_pfn_range(vma, vma->vm_start, |
303 | PFN_DOWN(virt_to_phys(mem->vaddr)), | 303 | mem->dma_handle >> PAGE_SHIFT, |
304 | size, vma->vm_page_prot); | 304 | size, vma->vm_page_prot); |
305 | if (retval) { | 305 | if (retval) { |
306 | dev_err(q->dev, "mmap: remap failed with error %d. ", retval); | 306 | dev_err(q->dev, "mmap: remap failed with error %d. ", retval); |
diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index 6698c77e0f64..6ba1461d51ef 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c | |||
@@ -37,6 +37,9 @@ module_param(debug, int, 0644); | |||
37 | #define call_qop(q, op, args...) \ | 37 | #define call_qop(q, op, args...) \ |
38 | (((q)->ops->op) ? ((q)->ops->op(args)) : 0) | 38 | (((q)->ops->op) ? ((q)->ops->op(args)) : 0) |
39 | 39 | ||
40 | #define V4L2_BUFFER_STATE_FLAGS (V4L2_BUF_FLAG_MAPPED | V4L2_BUF_FLAG_QUEUED | \ | ||
41 | V4L2_BUF_FLAG_DONE | V4L2_BUF_FLAG_ERROR) | ||
42 | |||
40 | /** | 43 | /** |
41 | * __vb2_buf_mem_alloc() - allocate video memory for the given buffer | 44 | * __vb2_buf_mem_alloc() - allocate video memory for the given buffer |
42 | */ | 45 | */ |
@@ -51,7 +54,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb, | |||
51 | for (plane = 0; plane < vb->num_planes; ++plane) { | 54 | for (plane = 0; plane < vb->num_planes; ++plane) { |
52 | mem_priv = call_memop(q, plane, alloc, q->alloc_ctx[plane], | 55 | mem_priv = call_memop(q, plane, alloc, q->alloc_ctx[plane], |
53 | plane_sizes[plane]); | 56 | plane_sizes[plane]); |
54 | if (!mem_priv) | 57 | if (IS_ERR_OR_NULL(mem_priv)) |
55 | goto free; | 58 | goto free; |
56 | 59 | ||
57 | /* Associate allocator private data with this plane */ | 60 | /* Associate allocator private data with this plane */ |
@@ -284,7 +287,7 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) | |||
284 | struct vb2_queue *q = vb->vb2_queue; | 287 | struct vb2_queue *q = vb->vb2_queue; |
285 | int ret = 0; | 288 | int ret = 0; |
286 | 289 | ||
287 | /* Copy back data such as timestamp, input, etc. */ | 290 | /* Copy back data such as timestamp, flags, input, etc. */ |
288 | memcpy(b, &vb->v4l2_buf, offsetof(struct v4l2_buffer, m)); | 291 | memcpy(b, &vb->v4l2_buf, offsetof(struct v4l2_buffer, m)); |
289 | b->input = vb->v4l2_buf.input; | 292 | b->input = vb->v4l2_buf.input; |
290 | b->reserved = vb->v4l2_buf.reserved; | 293 | b->reserved = vb->v4l2_buf.reserved; |
@@ -313,7 +316,10 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) | |||
313 | b->m.userptr = vb->v4l2_planes[0].m.userptr; | 316 | b->m.userptr = vb->v4l2_planes[0].m.userptr; |
314 | } | 317 | } |
315 | 318 | ||
316 | b->flags = 0; | 319 | /* |
320 | * Clear any buffer state related flags. | ||
321 | */ | ||
322 | b->flags &= ~V4L2_BUFFER_STATE_FLAGS; | ||
317 | 323 | ||
318 | switch (vb->state) { | 324 | switch (vb->state) { |
319 | case VB2_BUF_STATE_QUEUED: | 325 | case VB2_BUF_STATE_QUEUED: |
@@ -519,6 +525,7 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) | |||
519 | num_buffers = min_t(unsigned int, req->count, VIDEO_MAX_FRAME); | 525 | num_buffers = min_t(unsigned int, req->count, VIDEO_MAX_FRAME); |
520 | memset(plane_sizes, 0, sizeof(plane_sizes)); | 526 | memset(plane_sizes, 0, sizeof(plane_sizes)); |
521 | memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx)); | 527 | memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx)); |
528 | q->memory = req->memory; | ||
522 | 529 | ||
523 | /* | 530 | /* |
524 | * Ask the driver how many buffers and planes per buffer it requires. | 531 | * Ask the driver how many buffers and planes per buffer it requires. |
@@ -560,8 +567,6 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) | |||
560 | ret = num_buffers; | 567 | ret = num_buffers; |
561 | } | 568 | } |
562 | 569 | ||
563 | q->memory = req->memory; | ||
564 | |||
565 | /* | 570 | /* |
566 | * Return the number of successfully allocated buffers | 571 | * Return the number of successfully allocated buffers |
567 | * to the userspace. | 572 | * to the userspace. |
@@ -715,6 +720,8 @@ static int __fill_vb2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b, | |||
715 | 720 | ||
716 | vb->v4l2_buf.field = b->field; | 721 | vb->v4l2_buf.field = b->field; |
717 | vb->v4l2_buf.timestamp = b->timestamp; | 722 | vb->v4l2_buf.timestamp = b->timestamp; |
723 | vb->v4l2_buf.input = b->input; | ||
724 | vb->v4l2_buf.flags = b->flags & ~V4L2_BUFFER_STATE_FLAGS; | ||
718 | 725 | ||
719 | return 0; | 726 | return 0; |
720 | } | 727 | } |
diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index 58205d596138..a790a5f8c06f 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c | |||
@@ -46,7 +46,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) | |||
46 | GFP_KERNEL); | 46 | GFP_KERNEL); |
47 | if (!buf->vaddr) { | 47 | if (!buf->vaddr) { |
48 | dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n", | 48 | dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n", |
49 | buf->size); | 49 | size); |
50 | kfree(buf); | 50 | kfree(buf); |
51 | return ERR_PTR(-ENOMEM); | 51 | return ERR_PTR(-ENOMEM); |
52 | } | 52 | } |
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index d01574d98870..f4c8c844b913 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c | |||
@@ -55,6 +55,19 @@ int mfd_cell_disable(struct platform_device *pdev) | |||
55 | } | 55 | } |
56 | EXPORT_SYMBOL(mfd_cell_disable); | 56 | EXPORT_SYMBOL(mfd_cell_disable); |
57 | 57 | ||
58 | static int mfd_platform_add_cell(struct platform_device *pdev, | ||
59 | const struct mfd_cell *cell) | ||
60 | { | ||
61 | if (!cell) | ||
62 | return 0; | ||
63 | |||
64 | pdev->mfd_cell = kmemdup(cell, sizeof(*cell), GFP_KERNEL); | ||
65 | if (!pdev->mfd_cell) | ||
66 | return -ENOMEM; | ||
67 | |||
68 | return 0; | ||
69 | } | ||
70 | |||
58 | static int mfd_add_device(struct device *parent, int id, | 71 | static int mfd_add_device(struct device *parent, int id, |
59 | const struct mfd_cell *cell, | 72 | const struct mfd_cell *cell, |
60 | struct resource *mem_base, | 73 | struct resource *mem_base, |
@@ -75,7 +88,7 @@ static int mfd_add_device(struct device *parent, int id, | |||
75 | 88 | ||
76 | pdev->dev.parent = parent; | 89 | pdev->dev.parent = parent; |
77 | 90 | ||
78 | ret = platform_device_add_data(pdev, cell, sizeof(*cell)); | 91 | ret = mfd_platform_add_cell(pdev, cell); |
79 | if (ret) | 92 | if (ret) |
80 | goto fail_res; | 93 | goto fail_res; |
81 | 94 | ||
@@ -123,7 +136,6 @@ static int mfd_add_device(struct device *parent, int id, | |||
123 | 136 | ||
124 | return 0; | 137 | return 0; |
125 | 138 | ||
126 | /* platform_device_del(pdev); */ | ||
127 | fail_res: | 139 | fail_res: |
128 | kfree(res); | 140 | kfree(res); |
129 | fail_device: | 141 | fail_device: |
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c index 20e4e9395b61..ecafa4ba238b 100644 --- a/drivers/misc/sgi-gru/grufile.c +++ b/drivers/misc/sgi-gru/grufile.c | |||
@@ -348,15 +348,15 @@ static unsigned long gru_chiplet_cpu_to_mmr(int chiplet, int cpu, int *corep) | |||
348 | 348 | ||
349 | static int gru_irq_count[GRU_CHIPLETS_PER_BLADE]; | 349 | static int gru_irq_count[GRU_CHIPLETS_PER_BLADE]; |
350 | 350 | ||
351 | static void gru_noop(unsigned int irq) | 351 | static void gru_noop(struct irq_data *d) |
352 | { | 352 | { |
353 | } | 353 | } |
354 | 354 | ||
355 | static struct irq_chip gru_chip[GRU_CHIPLETS_PER_BLADE] = { | 355 | static struct irq_chip gru_chip[GRU_CHIPLETS_PER_BLADE] = { |
356 | [0 ... GRU_CHIPLETS_PER_BLADE - 1] { | 356 | [0 ... GRU_CHIPLETS_PER_BLADE - 1] { |
357 | .mask = gru_noop, | 357 | .irq_mask = gru_noop, |
358 | .unmask = gru_noop, | 358 | .irq_unmask = gru_noop, |
359 | .ack = gru_noop | 359 | .irq_ack = gru_noop |
360 | } | 360 | } |
361 | }; | 361 | }; |
362 | 362 | ||
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c index 96c0b34ba8db..657b9f4b6f9b 100644 --- a/drivers/mtd/nand/diskonchip.c +++ b/drivers/mtd/nand/diskonchip.c | |||
@@ -400,7 +400,7 @@ static uint16_t __init doc200x_ident_chip(struct mtd_info *mtd, int nr) | |||
400 | doc200x_hwcontrol(mtd, 0, NAND_CTRL_ALE | NAND_CTRL_CHANGE); | 400 | doc200x_hwcontrol(mtd, 0, NAND_CTRL_ALE | NAND_CTRL_CHANGE); |
401 | doc200x_hwcontrol(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); | 401 | doc200x_hwcontrol(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); |
402 | 402 | ||
403 | /* We can't' use dev_ready here, but at least we wait for the | 403 | /* We can't use dev_ready here, but at least we wait for the |
404 | * command to complete | 404 | * command to complete |
405 | */ | 405 | */ |
406 | udelay(50); | 406 | udelay(50); |
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index a3755ffc03d4..bc8ce48f0778 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c | |||
@@ -2550,7 +2550,6 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, | |||
2550 | const struct parport_pc_via_data *via) | 2550 | const struct parport_pc_via_data *via) |
2551 | { | 2551 | { |
2552 | short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 }; | 2552 | short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 }; |
2553 | struct resource *base_res; | ||
2554 | u32 ite8872set; | 2553 | u32 ite8872set; |
2555 | u32 ite8872_lpt, ite8872_lpthi; | 2554 | u32 ite8872_lpt, ite8872_lpthi; |
2556 | u8 ite8872_irq, type; | 2555 | u8 ite8872_irq, type; |
@@ -2561,8 +2560,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, | |||
2561 | 2560 | ||
2562 | /* make sure which one chip */ | 2561 | /* make sure which one chip */ |
2563 | for (i = 0; i < 5; i++) { | 2562 | for (i = 0; i < 5; i++) { |
2564 | base_res = request_region(inta_addr[i], 32, "it887x"); | 2563 | if (request_region(inta_addr[i], 32, "it887x")) { |
2565 | if (base_res) { | ||
2566 | int test; | 2564 | int test; |
2567 | pci_write_config_dword(pdev, 0x60, | 2565 | pci_write_config_dword(pdev, 0x60, |
2568 | 0xe5000000 | inta_addr[i]); | 2566 | 0xe5000000 | inta_addr[i]); |
@@ -2571,7 +2569,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, | |||
2571 | test = inb(inta_addr[i]); | 2569 | test = inb(inta_addr[i]); |
2572 | if (test != 0xff) | 2570 | if (test != 0xff) |
2573 | break; | 2571 | break; |
2574 | release_region(inta_addr[i], 0x8); | 2572 | release_region(inta_addr[i], 32); |
2575 | } | 2573 | } |
2576 | } | 2574 | } |
2577 | if (i >= 5) { | 2575 | if (i >= 5) { |
@@ -2635,7 +2633,7 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, | |||
2635 | /* | 2633 | /* |
2636 | * Release the resource so that parport_pc_probe_port can get it. | 2634 | * Release the resource so that parport_pc_probe_port can get it. |
2637 | */ | 2635 | */ |
2638 | release_resource(base_res); | 2636 | release_region(inta_addr[i], 32); |
2639 | if (parport_pc_probe_port(ite8872_lpt, ite8872_lpthi, | 2637 | if (parport_pc_probe_port(ite8872_lpt, ite8872_lpthi, |
2640 | irq, PARPORT_DMA_NONE, &pdev->dev, 0)) { | 2638 | irq, PARPORT_DMA_NONE, &pdev->dev, 0)) { |
2641 | printk(KERN_INFO | 2639 | printk(KERN_INFO |
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index c8ff646c0b05..0fa466a91bf4 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig | |||
@@ -88,4 +88,6 @@ config PCI_IOAPIC | |||
88 | depends on HOTPLUG | 88 | depends on HOTPLUG |
89 | default y | 89 | default y |
90 | 90 | ||
91 | select NLS if (DMI || ACPI) | 91 | config PCI_LABEL |
92 | def_bool y if (DMI || ACPI) | ||
93 | select NLS | ||
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 98d61c8e984b..c85f744270a5 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile | |||
@@ -56,10 +56,10 @@ obj-$(CONFIG_TILE) += setup-bus.o setup-irq.o | |||
56 | # ACPI Related PCI FW Functions | 56 | # ACPI Related PCI FW Functions |
57 | # ACPI _DSM provided firmware instance and string name | 57 | # ACPI _DSM provided firmware instance and string name |
58 | # | 58 | # |
59 | obj-$(CONFIG_ACPI) += pci-acpi.o pci-label.o | 59 | obj-$(CONFIG_ACPI) += pci-acpi.o |
60 | 60 | ||
61 | # SMBIOS provided firmware instance and labels | 61 | # SMBIOS provided firmware instance and labels |
62 | obj-$(CONFIG_DMI) += pci-label.o | 62 | obj-$(CONFIG_PCI_LABEL) += pci-label.o |
63 | 63 | ||
64 | # Cardbus & CompactPCI use setup-bus | 64 | # Cardbus & CompactPCI use setup-bus |
65 | obj-$(CONFIG_HOTPLUG) += setup-bus.o | 65 | obj-$(CONFIG_HOTPLUG) += setup-bus.o |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 505c1c7075f0..d552d2c77844 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -1299,7 +1299,7 @@ static void iommu_detach_domain(struct dmar_domain *domain, | |||
1299 | static struct iova_domain reserved_iova_list; | 1299 | static struct iova_domain reserved_iova_list; |
1300 | static struct lock_class_key reserved_rbtree_key; | 1300 | static struct lock_class_key reserved_rbtree_key; |
1301 | 1301 | ||
1302 | static void dmar_init_reserved_ranges(void) | 1302 | static int dmar_init_reserved_ranges(void) |
1303 | { | 1303 | { |
1304 | struct pci_dev *pdev = NULL; | 1304 | struct pci_dev *pdev = NULL; |
1305 | struct iova *iova; | 1305 | struct iova *iova; |
@@ -1313,8 +1313,10 @@ static void dmar_init_reserved_ranges(void) | |||
1313 | /* IOAPIC ranges shouldn't be accessed by DMA */ | 1313 | /* IOAPIC ranges shouldn't be accessed by DMA */ |
1314 | iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START), | 1314 | iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START), |
1315 | IOVA_PFN(IOAPIC_RANGE_END)); | 1315 | IOVA_PFN(IOAPIC_RANGE_END)); |
1316 | if (!iova) | 1316 | if (!iova) { |
1317 | printk(KERN_ERR "Reserve IOAPIC range failed\n"); | 1317 | printk(KERN_ERR "Reserve IOAPIC range failed\n"); |
1318 | return -ENODEV; | ||
1319 | } | ||
1318 | 1320 | ||
1319 | /* Reserve all PCI MMIO to avoid peer-to-peer access */ | 1321 | /* Reserve all PCI MMIO to avoid peer-to-peer access */ |
1320 | for_each_pci_dev(pdev) { | 1322 | for_each_pci_dev(pdev) { |
@@ -1327,11 +1329,13 @@ static void dmar_init_reserved_ranges(void) | |||
1327 | iova = reserve_iova(&reserved_iova_list, | 1329 | iova = reserve_iova(&reserved_iova_list, |
1328 | IOVA_PFN(r->start), | 1330 | IOVA_PFN(r->start), |
1329 | IOVA_PFN(r->end)); | 1331 | IOVA_PFN(r->end)); |
1330 | if (!iova) | 1332 | if (!iova) { |
1331 | printk(KERN_ERR "Reserve iova failed\n"); | 1333 | printk(KERN_ERR "Reserve iova failed\n"); |
1334 | return -ENODEV; | ||
1335 | } | ||
1332 | } | 1336 | } |
1333 | } | 1337 | } |
1334 | 1338 | return 0; | |
1335 | } | 1339 | } |
1336 | 1340 | ||
1337 | static void domain_reserve_special_ranges(struct dmar_domain *domain) | 1341 | static void domain_reserve_special_ranges(struct dmar_domain *domain) |
@@ -1835,7 +1839,7 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw) | |||
1835 | 1839 | ||
1836 | ret = iommu_attach_domain(domain, iommu); | 1840 | ret = iommu_attach_domain(domain, iommu); |
1837 | if (ret) { | 1841 | if (ret) { |
1838 | domain_exit(domain); | 1842 | free_domain_mem(domain); |
1839 | goto error; | 1843 | goto error; |
1840 | } | 1844 | } |
1841 | 1845 | ||
@@ -2213,7 +2217,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw) | |||
2213 | return 0; | 2217 | return 0; |
2214 | } | 2218 | } |
2215 | 2219 | ||
2216 | int __init init_dmars(void) | 2220 | static int __init init_dmars(int force_on) |
2217 | { | 2221 | { |
2218 | struct dmar_drhd_unit *drhd; | 2222 | struct dmar_drhd_unit *drhd; |
2219 | struct dmar_rmrr_unit *rmrr; | 2223 | struct dmar_rmrr_unit *rmrr; |
@@ -2393,8 +2397,15 @@ int __init init_dmars(void) | |||
2393 | * enable translation | 2397 | * enable translation |
2394 | */ | 2398 | */ |
2395 | for_each_drhd_unit(drhd) { | 2399 | for_each_drhd_unit(drhd) { |
2396 | if (drhd->ignored) | 2400 | if (drhd->ignored) { |
2401 | /* | ||
2402 | * we always have to disable PMRs or DMA may fail on | ||
2403 | * this device | ||
2404 | */ | ||
2405 | if (force_on) | ||
2406 | iommu_disable_protect_mem_regions(drhd->iommu); | ||
2397 | continue; | 2407 | continue; |
2408 | } | ||
2398 | iommu = drhd->iommu; | 2409 | iommu = drhd->iommu; |
2399 | 2410 | ||
2400 | iommu_flush_write_buffer(iommu); | 2411 | iommu_flush_write_buffer(iommu); |
@@ -3240,9 +3251,15 @@ static int device_notifier(struct notifier_block *nb, | |||
3240 | if (!domain) | 3251 | if (!domain) |
3241 | return 0; | 3252 | return 0; |
3242 | 3253 | ||
3243 | if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) | 3254 | if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) { |
3244 | domain_remove_one_dev_info(domain, pdev); | 3255 | domain_remove_one_dev_info(domain, pdev); |
3245 | 3256 | ||
3257 | if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) && | ||
3258 | !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY) && | ||
3259 | list_empty(&domain->devices)) | ||
3260 | domain_exit(domain); | ||
3261 | } | ||
3262 | |||
3246 | return 0; | 3263 | return 0; |
3247 | } | 3264 | } |
3248 | 3265 | ||
@@ -3277,12 +3294,21 @@ int __init intel_iommu_init(void) | |||
3277 | if (no_iommu || dmar_disabled) | 3294 | if (no_iommu || dmar_disabled) |
3278 | return -ENODEV; | 3295 | return -ENODEV; |
3279 | 3296 | ||
3280 | iommu_init_mempool(); | 3297 | if (iommu_init_mempool()) { |
3281 | dmar_init_reserved_ranges(); | 3298 | if (force_on) |
3299 | panic("tboot: Failed to initialize iommu memory\n"); | ||
3300 | return -ENODEV; | ||
3301 | } | ||
3302 | |||
3303 | if (dmar_init_reserved_ranges()) { | ||
3304 | if (force_on) | ||
3305 | panic("tboot: Failed to reserve iommu ranges\n"); | ||
3306 | return -ENODEV; | ||
3307 | } | ||
3282 | 3308 | ||
3283 | init_no_remapping_devices(); | 3309 | init_no_remapping_devices(); |
3284 | 3310 | ||
3285 | ret = init_dmars(); | 3311 | ret = init_dmars(force_on); |
3286 | if (ret) { | 3312 | if (ret) { |
3287 | if (force_on) | 3313 | if (force_on) |
3288 | panic("tboot: Failed to initialize DMARs\n"); | 3314 | panic("tboot: Failed to initialize DMARs\n"); |
@@ -3391,6 +3417,11 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain, | |||
3391 | domain->iommu_count--; | 3417 | domain->iommu_count--; |
3392 | domain_update_iommu_cap(domain); | 3418 | domain_update_iommu_cap(domain); |
3393 | spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); | 3419 | spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); |
3420 | |||
3421 | spin_lock_irqsave(&iommu->lock, tmp_flags); | ||
3422 | clear_bit(domain->id, iommu->domain_ids); | ||
3423 | iommu->domains[domain->id] = NULL; | ||
3424 | spin_unlock_irqrestore(&iommu->lock, tmp_flags); | ||
3394 | } | 3425 | } |
3395 | 3426 | ||
3396 | spin_unlock_irqrestore(&device_domain_lock, flags); | 3427 | spin_unlock_irqrestore(&device_domain_lock, flags); |
@@ -3607,9 +3638,9 @@ static int intel_iommu_attach_device(struct iommu_domain *domain, | |||
3607 | 3638 | ||
3608 | pte = dmar_domain->pgd; | 3639 | pte = dmar_domain->pgd; |
3609 | if (dma_pte_present(pte)) { | 3640 | if (dma_pte_present(pte)) { |
3610 | free_pgtable_page(dmar_domain->pgd); | ||
3611 | dmar_domain->pgd = (struct dma_pte *) | 3641 | dmar_domain->pgd = (struct dma_pte *) |
3612 | phys_to_virt(dma_pte_addr(pte)); | 3642 | phys_to_virt(dma_pte_addr(pte)); |
3643 | free_pgtable_page(pte); | ||
3613 | } | 3644 | } |
3614 | dmar_domain->agaw--; | 3645 | dmar_domain->agaw--; |
3615 | } | 3646 | } |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index d86ea8b01137..135df164a4c1 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -781,7 +781,7 @@ static int pci_pm_resume(struct device *dev) | |||
781 | 781 | ||
782 | #endif /* !CONFIG_SUSPEND */ | 782 | #endif /* !CONFIG_SUSPEND */ |
783 | 783 | ||
784 | #ifdef CONFIG_HIBERNATION | 784 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
785 | 785 | ||
786 | static int pci_pm_freeze(struct device *dev) | 786 | static int pci_pm_freeze(struct device *dev) |
787 | { | 787 | { |
@@ -970,7 +970,7 @@ static int pci_pm_restore(struct device *dev) | |||
970 | return error; | 970 | return error; |
971 | } | 971 | } |
972 | 972 | ||
973 | #else /* !CONFIG_HIBERNATION */ | 973 | #else /* !CONFIG_HIBERNATE_CALLBACKS */ |
974 | 974 | ||
975 | #define pci_pm_freeze NULL | 975 | #define pci_pm_freeze NULL |
976 | #define pci_pm_freeze_noirq NULL | 976 | #define pci_pm_freeze_noirq NULL |
@@ -981,7 +981,7 @@ static int pci_pm_restore(struct device *dev) | |||
981 | #define pci_pm_restore NULL | 981 | #define pci_pm_restore NULL |
982 | #define pci_pm_restore_noirq NULL | 982 | #define pci_pm_restore_noirq NULL |
983 | 983 | ||
984 | #endif /* !CONFIG_HIBERNATION */ | 984 | #endif /* !CONFIG_HIBERNATE_CALLBACKS */ |
985 | 985 | ||
986 | #ifdef CONFIG_PM_RUNTIME | 986 | #ifdef CONFIG_PM_RUNTIME |
987 | 987 | ||
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index fe77e8223841..e8c19def1b0f 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -173,7 +173,7 @@ static int pcmcia_access_config(struct pcmcia_device *p_dev, | |||
173 | c = p_dev->function_config; | 173 | c = p_dev->function_config; |
174 | 174 | ||
175 | if (!(c->state & CONFIG_LOCKED)) { | 175 | if (!(c->state & CONFIG_LOCKED)) { |
176 | dev_dbg(&p_dev->dev, "Configuration isn't't locked\n"); | 176 | dev_dbg(&p_dev->dev, "Configuration isn't locked\n"); |
177 | mutex_unlock(&s->ops_mutex); | 177 | mutex_unlock(&s->ops_mutex); |
178 | return -EACCES; | 178 | return -EACCES; |
179 | } | 179 | } |
diff --git a/drivers/pcmcia/pxa2xx_balloon3.c b/drivers/pcmcia/pxa2xx_balloon3.c index 453c54c97612..4c3e94c0ae85 100644 --- a/drivers/pcmcia/pxa2xx_balloon3.c +++ b/drivers/pcmcia/pxa2xx_balloon3.c | |||
@@ -25,6 +25,8 @@ | |||
25 | 25 | ||
26 | #include <mach/balloon3.h> | 26 | #include <mach/balloon3.h> |
27 | 27 | ||
28 | #include <asm/mach-types.h> | ||
29 | |||
28 | #include "soc_common.h" | 30 | #include "soc_common.h" |
29 | 31 | ||
30 | /* | 32 | /* |
@@ -127,6 +129,9 @@ static int __init balloon3_pcmcia_init(void) | |||
127 | { | 129 | { |
128 | int ret; | 130 | int ret; |
129 | 131 | ||
132 | if (!machine_is_balloon3()) | ||
133 | return -ENODEV; | ||
134 | |||
130 | balloon3_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | 135 | balloon3_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); |
131 | if (!balloon3_pcmcia_device) | 136 | if (!balloon3_pcmcia_device) |
132 | return -ENOMEM; | 137 | return -ENOMEM; |
diff --git a/drivers/pcmcia/pxa2xx_trizeps4.c b/drivers/pcmcia/pxa2xx_trizeps4.c index b7e596620db1..b829e655457b 100644 --- a/drivers/pcmcia/pxa2xx_trizeps4.c +++ b/drivers/pcmcia/pxa2xx_trizeps4.c | |||
@@ -69,15 +69,15 @@ static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
69 | for (i = 0; i < ARRAY_SIZE(irqs); i++) { | 69 | for (i = 0; i < ARRAY_SIZE(irqs); i++) { |
70 | if (irqs[i].sock != skt->nr) | 70 | if (irqs[i].sock != skt->nr) |
71 | continue; | 71 | continue; |
72 | if (gpio_request(IRQ_TO_GPIO(irqs[i].irq), irqs[i].str) < 0) { | 72 | if (gpio_request(irq_to_gpio(irqs[i].irq), irqs[i].str) < 0) { |
73 | pr_err("%s: sock %d unable to request gpio %d\n", | 73 | pr_err("%s: sock %d unable to request gpio %d\n", |
74 | __func__, skt->nr, IRQ_TO_GPIO(irqs[i].irq)); | 74 | __func__, skt->nr, irq_to_gpio(irqs[i].irq)); |
75 | ret = -EBUSY; | 75 | ret = -EBUSY; |
76 | goto error; | 76 | goto error; |
77 | } | 77 | } |
78 | if (gpio_direction_input(IRQ_TO_GPIO(irqs[i].irq)) < 0) { | 78 | if (gpio_direction_input(irq_to_gpio(irqs[i].irq)) < 0) { |
79 | pr_err("%s: sock %d unable to set input gpio %d\n", | 79 | pr_err("%s: sock %d unable to set input gpio %d\n", |
80 | __func__, skt->nr, IRQ_TO_GPIO(irqs[i].irq)); | 80 | __func__, skt->nr, irq_to_gpio(irqs[i].irq)); |
81 | ret = -EINVAL; | 81 | ret = -EINVAL; |
82 | goto error; | 82 | goto error; |
83 | } | 83 | } |
@@ -86,7 +86,7 @@ static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
86 | 86 | ||
87 | error: | 87 | error: |
88 | for (; i >= 0; i--) { | 88 | for (; i >= 0; i--) { |
89 | gpio_free(IRQ_TO_GPIO(irqs[i].irq)); | 89 | gpio_free(irq_to_gpio(irqs[i].irq)); |
90 | } | 90 | } |
91 | return (ret); | 91 | return (ret); |
92 | } | 92 | } |
@@ -97,7 +97,7 @@ static void trizeps_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | |||
97 | /* free allocated gpio's */ | 97 | /* free allocated gpio's */ |
98 | gpio_free(GPIO_PRDY); | 98 | gpio_free(GPIO_PRDY); |
99 | for (i = 0; i < ARRAY_SIZE(irqs); i++) | 99 | for (i = 0; i < ARRAY_SIZE(irqs); i++) |
100 | gpio_free(IRQ_TO_GPIO(irqs[i].irq)); | 100 | gpio_free(irq_to_gpio(irqs[i].irq)); |
101 | } | 101 | } |
102 | 102 | ||
103 | static unsigned long trizeps_pcmcia_status[2]; | 103 | static unsigned long trizeps_pcmcia_status[2]; |
@@ -226,6 +226,9 @@ static int __init trizeps_pcmcia_init(void) | |||
226 | { | 226 | { |
227 | int ret; | 227 | int ret; |
228 | 228 | ||
229 | if (!machine_is_trizeps4() && !machine_is_trizeps4wl()) | ||
230 | return -ENODEV; | ||
231 | |||
229 | trizeps_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | 232 | trizeps_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); |
230 | if (!trizeps_pcmcia_device) | 233 | if (!trizeps_pcmcia_device) |
231 | return -ENOMEM; | 234 | return -ENOMEM; |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 2ee442c2a5db..0485e394712a 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -187,7 +187,8 @@ config MSI_LAPTOP | |||
187 | depends on ACPI | 187 | depends on ACPI |
188 | depends on BACKLIGHT_CLASS_DEVICE | 188 | depends on BACKLIGHT_CLASS_DEVICE |
189 | depends on RFKILL | 189 | depends on RFKILL |
190 | depends on SERIO_I8042 | 190 | depends on INPUT && SERIO_I8042 |
191 | select INPUT_SPARSEKMAP | ||
191 | ---help--- | 192 | ---help--- |
192 | This is a driver for laptops built by MSI (MICRO-STAR | 193 | This is a driver for laptops built by MSI (MICRO-STAR |
193 | INTERNATIONAL): | 194 | INTERNATIONAL): |
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 5ea6c3477d17..ac4e7f83ce6c 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c | |||
@@ -89,7 +89,7 @@ MODULE_LICENSE("GPL"); | |||
89 | #define ACERWMID_EVENT_GUID "676AA15E-6A47-4D9F-A2CC-1E6D18D14026" | 89 | #define ACERWMID_EVENT_GUID "676AA15E-6A47-4D9F-A2CC-1E6D18D14026" |
90 | 90 | ||
91 | MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB"); | 91 | MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB"); |
92 | MODULE_ALIAS("wmi:6AF4F258-B401-42Fd-BE91-3D4AC2D7C0D3"); | 92 | MODULE_ALIAS("wmi:6AF4F258-B401-42FD-BE91-3D4AC2D7C0D3"); |
93 | MODULE_ALIAS("wmi:676AA15E-6A47-4D9F-A2CC-1E6D18D14026"); | 93 | MODULE_ALIAS("wmi:676AA15E-6A47-4D9F-A2CC-1E6D18D14026"); |
94 | 94 | ||
95 | enum acer_wmi_event_ids { | 95 | enum acer_wmi_event_ids { |
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index efc776cb0c66..832a3fd7c1c8 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c | |||
@@ -201,8 +201,8 @@ static int asus_wmi_input_init(struct asus_wmi *asus) | |||
201 | if (!asus->inputdev) | 201 | if (!asus->inputdev) |
202 | return -ENOMEM; | 202 | return -ENOMEM; |
203 | 203 | ||
204 | asus->inputdev->name = asus->driver->input_phys; | 204 | asus->inputdev->name = asus->driver->input_name; |
205 | asus->inputdev->phys = asus->driver->input_name; | 205 | asus->inputdev->phys = asus->driver->input_phys; |
206 | asus->inputdev->id.bustype = BUS_HOST; | 206 | asus->inputdev->id.bustype = BUS_HOST; |
207 | asus->inputdev->dev.parent = &asus->platform_device->dev; | 207 | asus->inputdev->dev.parent = &asus->platform_device->dev; |
208 | 208 | ||
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c index 0ddc434fb93b..649dcadd8ea3 100644 --- a/drivers/platform/x86/eeepc-wmi.c +++ b/drivers/platform/x86/eeepc-wmi.c | |||
@@ -67,9 +67,11 @@ static const struct key_entry eeepc_wmi_keymap[] = { | |||
67 | { KE_KEY, 0x82, { KEY_CAMERA } }, | 67 | { KE_KEY, 0x82, { KEY_CAMERA } }, |
68 | { KE_KEY, 0x83, { KEY_CAMERA_ZOOMIN } }, | 68 | { KE_KEY, 0x83, { KEY_CAMERA_ZOOMIN } }, |
69 | { KE_KEY, 0x88, { KEY_WLAN } }, | 69 | { KE_KEY, 0x88, { KEY_WLAN } }, |
70 | { KE_KEY, 0xbd, { KEY_CAMERA } }, | ||
70 | { KE_KEY, 0xcc, { KEY_SWITCHVIDEOMODE } }, | 71 | { KE_KEY, 0xcc, { KEY_SWITCHVIDEOMODE } }, |
71 | { KE_KEY, 0xe0, { KEY_PROG1 } }, /* Task Manager */ | 72 | { KE_KEY, 0xe0, { KEY_PROG1 } }, /* Task Manager */ |
72 | { KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */ | 73 | { KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */ |
74 | { KE_KEY, 0xe8, { KEY_SCREENLOCK } }, | ||
73 | { KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } }, | 75 | { KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } }, |
74 | { KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } }, | 76 | { KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } }, |
75 | { KE_KEY, 0xec, { KEY_CAMERA_UP } }, | 77 | { KE_KEY, 0xec, { KEY_CAMERA_UP } }, |
diff --git a/drivers/platform/x86/intel_pmic_gpio.c b/drivers/platform/x86/intel_pmic_gpio.c index d653104b59cb..464bb3fc4d88 100644 --- a/drivers/platform/x86/intel_pmic_gpio.c +++ b/drivers/platform/x86/intel_pmic_gpio.c | |||
@@ -74,6 +74,19 @@ struct pmic_gpio { | |||
74 | u32 trigger_type; | 74 | u32 trigger_type; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | static void pmic_program_irqtype(int gpio, int type) | ||
78 | { | ||
79 | if (type & IRQ_TYPE_EDGE_RISING) | ||
80 | intel_scu_ipc_update_register(GPIO0 + gpio, 0x20, 0x20); | ||
81 | else | ||
82 | intel_scu_ipc_update_register(GPIO0 + gpio, 0x00, 0x20); | ||
83 | |||
84 | if (type & IRQ_TYPE_EDGE_FALLING) | ||
85 | intel_scu_ipc_update_register(GPIO0 + gpio, 0x10, 0x10); | ||
86 | else | ||
87 | intel_scu_ipc_update_register(GPIO0 + gpio, 0x00, 0x10); | ||
88 | }; | ||
89 | |||
77 | static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 90 | static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) |
78 | { | 91 | { |
79 | if (offset > 8) { | 92 | if (offset > 8) { |
@@ -166,16 +179,38 @@ static int pmic_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | |||
166 | return pg->irq_base + offset; | 179 | return pg->irq_base + offset; |
167 | } | 180 | } |
168 | 181 | ||
182 | static void pmic_bus_lock(struct irq_data *data) | ||
183 | { | ||
184 | struct pmic_gpio *pg = irq_data_get_irq_chip_data(data); | ||
185 | |||
186 | mutex_lock(&pg->buslock); | ||
187 | } | ||
188 | |||
189 | static void pmic_bus_sync_unlock(struct irq_data *data) | ||
190 | { | ||
191 | struct pmic_gpio *pg = irq_data_get_irq_chip_data(data); | ||
192 | |||
193 | if (pg->update_type) { | ||
194 | unsigned int gpio = pg->update_type & ~GPIO_UPDATE_TYPE; | ||
195 | |||
196 | pmic_program_irqtype(gpio, pg->trigger_type); | ||
197 | pg->update_type = 0; | ||
198 | } | ||
199 | mutex_unlock(&pg->buslock); | ||
200 | } | ||
201 | |||
169 | /* the gpiointr register is read-clear, so just do nothing. */ | 202 | /* the gpiointr register is read-clear, so just do nothing. */ |
170 | static void pmic_irq_unmask(struct irq_data *data) { } | 203 | static void pmic_irq_unmask(struct irq_data *data) { } |
171 | 204 | ||
172 | static void pmic_irq_mask(struct irq_data *data) { } | 205 | static void pmic_irq_mask(struct irq_data *data) { } |
173 | 206 | ||
174 | static struct irq_chip pmic_irqchip = { | 207 | static struct irq_chip pmic_irqchip = { |
175 | .name = "PMIC-GPIO", | 208 | .name = "PMIC-GPIO", |
176 | .irq_mask = pmic_irq_mask, | 209 | .irq_mask = pmic_irq_mask, |
177 | .irq_unmask = pmic_irq_unmask, | 210 | .irq_unmask = pmic_irq_unmask, |
178 | .irq_set_type = pmic_irq_type, | 211 | .irq_set_type = pmic_irq_type, |
212 | .irq_bus_lock = pmic_bus_lock, | ||
213 | .irq_bus_sync_unlock = pmic_bus_sync_unlock, | ||
179 | }; | 214 | }; |
180 | 215 | ||
181 | static irqreturn_t pmic_irq_handler(int irq, void *data) | 216 | static irqreturn_t pmic_irq_handler(int irq, void *data) |
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c index de434c6dc2d6..d347116d150e 100644 --- a/drivers/platform/x86/samsung-laptop.c +++ b/drivers/platform/x86/samsung-laptop.c | |||
@@ -571,6 +571,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = { | |||
571 | .callback = dmi_check_cb, | 571 | .callback = dmi_check_cb, |
572 | }, | 572 | }, |
573 | { | 573 | { |
574 | .ident = "R410 Plus", | ||
575 | .matches = { | ||
576 | DMI_MATCH(DMI_SYS_VENDOR, | ||
577 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
578 | DMI_MATCH(DMI_PRODUCT_NAME, "R410P"), | ||
579 | DMI_MATCH(DMI_BOARD_NAME, "R460"), | ||
580 | }, | ||
581 | .callback = dmi_check_cb, | ||
582 | }, | ||
583 | { | ||
574 | .ident = "R518", | 584 | .ident = "R518", |
575 | .matches = { | 585 | .matches = { |
576 | DMI_MATCH(DMI_SYS_VENDOR, | 586 | DMI_MATCH(DMI_SYS_VENDOR, |
@@ -591,12 +601,12 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = { | |||
591 | .callback = dmi_check_cb, | 601 | .callback = dmi_check_cb, |
592 | }, | 602 | }, |
593 | { | 603 | { |
594 | .ident = "N150/N210/N220", | 604 | .ident = "N150/N210/N220/N230", |
595 | .matches = { | 605 | .matches = { |
596 | DMI_MATCH(DMI_SYS_VENDOR, | 606 | DMI_MATCH(DMI_SYS_VENDOR, |
597 | "SAMSUNG ELECTRONICS CO., LTD."), | 607 | "SAMSUNG ELECTRONICS CO., LTD."), |
598 | DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220"), | 608 | DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220/N230"), |
599 | DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220"), | 609 | DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220/N230"), |
600 | }, | 610 | }, |
601 | .callback = dmi_check_cb, | 611 | .callback = dmi_check_cb, |
602 | }, | 612 | }, |
@@ -771,6 +781,7 @@ static int __init samsung_init(void) | |||
771 | 781 | ||
772 | /* create a backlight device to talk to this one */ | 782 | /* create a backlight device to talk to this one */ |
773 | memset(&props, 0, sizeof(struct backlight_properties)); | 783 | memset(&props, 0, sizeof(struct backlight_properties)); |
784 | props.type = BACKLIGHT_PLATFORM; | ||
774 | props.max_brightness = sabi_config->max_brightness; | 785 | props.max_brightness = sabi_config->max_brightness; |
775 | backlight_device = backlight_device_register("samsung", &sdev->dev, | 786 | backlight_device = backlight_device_register("samsung", &sdev->dev, |
776 | NULL, &backlight_ops, | 787 | NULL, &backlight_ops, |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index e642f5f29504..8f709aec4da0 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -138,6 +138,8 @@ MODULE_PARM_DESC(kbd_backlight_timeout, | |||
138 | "1 for 30 seconds, 2 for 60 seconds and 3 to disable timeout " | 138 | "1 for 30 seconds, 2 for 60 seconds and 3 to disable timeout " |
139 | "(default: 0)"); | 139 | "(default: 0)"); |
140 | 140 | ||
141 | static void sony_nc_kbd_backlight_resume(void); | ||
142 | |||
141 | enum sony_nc_rfkill { | 143 | enum sony_nc_rfkill { |
142 | SONY_WIFI, | 144 | SONY_WIFI, |
143 | SONY_BLUETOOTH, | 145 | SONY_BLUETOOTH, |
@@ -771,11 +773,6 @@ static int sony_nc_handles_setup(struct platform_device *pd) | |||
771 | if (!handles) | 773 | if (!handles) |
772 | return -ENOMEM; | 774 | return -ENOMEM; |
773 | 775 | ||
774 | sysfs_attr_init(&handles->devattr.attr); | ||
775 | handles->devattr.attr.name = "handles"; | ||
776 | handles->devattr.attr.mode = S_IRUGO; | ||
777 | handles->devattr.show = sony_nc_handles_show; | ||
778 | |||
779 | for (i = 0; i < ARRAY_SIZE(handles->cap); i++) { | 776 | for (i = 0; i < ARRAY_SIZE(handles->cap); i++) { |
780 | if (!acpi_callsetfunc(sony_nc_acpi_handle, | 777 | if (!acpi_callsetfunc(sony_nc_acpi_handle, |
781 | "SN00", i + 0x20, &result)) { | 778 | "SN00", i + 0x20, &result)) { |
@@ -785,11 +782,18 @@ static int sony_nc_handles_setup(struct platform_device *pd) | |||
785 | } | 782 | } |
786 | } | 783 | } |
787 | 784 | ||
788 | /* allow reading capabilities via sysfs */ | 785 | if (debug) { |
789 | if (device_create_file(&pd->dev, &handles->devattr)) { | 786 | sysfs_attr_init(&handles->devattr.attr); |
790 | kfree(handles); | 787 | handles->devattr.attr.name = "handles"; |
791 | handles = NULL; | 788 | handles->devattr.attr.mode = S_IRUGO; |
792 | return -1; | 789 | handles->devattr.show = sony_nc_handles_show; |
790 | |||
791 | /* allow reading capabilities via sysfs */ | ||
792 | if (device_create_file(&pd->dev, &handles->devattr)) { | ||
793 | kfree(handles); | ||
794 | handles = NULL; | ||
795 | return -1; | ||
796 | } | ||
793 | } | 797 | } |
794 | 798 | ||
795 | return 0; | 799 | return 0; |
@@ -798,7 +802,8 @@ static int sony_nc_handles_setup(struct platform_device *pd) | |||
798 | static int sony_nc_handles_cleanup(struct platform_device *pd) | 802 | static int sony_nc_handles_cleanup(struct platform_device *pd) |
799 | { | 803 | { |
800 | if (handles) { | 804 | if (handles) { |
801 | device_remove_file(&pd->dev, &handles->devattr); | 805 | if (debug) |
806 | device_remove_file(&pd->dev, &handles->devattr); | ||
802 | kfree(handles); | 807 | kfree(handles); |
803 | handles = NULL; | 808 | handles = NULL; |
804 | } | 809 | } |
@@ -808,6 +813,11 @@ static int sony_nc_handles_cleanup(struct platform_device *pd) | |||
808 | static int sony_find_snc_handle(int handle) | 813 | static int sony_find_snc_handle(int handle) |
809 | { | 814 | { |
810 | int i; | 815 | int i; |
816 | |||
817 | /* not initialized yet, return early */ | ||
818 | if (!handles) | ||
819 | return -1; | ||
820 | |||
811 | for (i = 0; i < 0x10; i++) { | 821 | for (i = 0; i < 0x10; i++) { |
812 | if (handles->cap[i] == handle) { | 822 | if (handles->cap[i] == handle) { |
813 | dprintk("found handle 0x%.4x (offset: 0x%.2x)\n", | 823 | dprintk("found handle 0x%.4x (offset: 0x%.2x)\n", |
@@ -1168,6 +1178,9 @@ static int sony_nc_resume(struct acpi_device *device) | |||
1168 | /* re-read rfkill state */ | 1178 | /* re-read rfkill state */ |
1169 | sony_nc_rfkill_update(); | 1179 | sony_nc_rfkill_update(); |
1170 | 1180 | ||
1181 | /* restore kbd backlight states */ | ||
1182 | sony_nc_kbd_backlight_resume(); | ||
1183 | |||
1171 | return 0; | 1184 | return 0; |
1172 | } | 1185 | } |
1173 | 1186 | ||
@@ -1355,6 +1368,7 @@ out_no_enum: | |||
1355 | #define KBDBL_HANDLER 0x137 | 1368 | #define KBDBL_HANDLER 0x137 |
1356 | #define KBDBL_PRESENT 0xB00 | 1369 | #define KBDBL_PRESENT 0xB00 |
1357 | #define SET_MODE 0xC00 | 1370 | #define SET_MODE 0xC00 |
1371 | #define SET_STATE 0xD00 | ||
1358 | #define SET_TIMEOUT 0xE00 | 1372 | #define SET_TIMEOUT 0xE00 |
1359 | 1373 | ||
1360 | struct kbd_backlight { | 1374 | struct kbd_backlight { |
@@ -1377,6 +1391,10 @@ static ssize_t __sony_nc_kbd_backlight_mode_set(u8 value) | |||
1377 | (value << 0x10) | SET_MODE, &result)) | 1391 | (value << 0x10) | SET_MODE, &result)) |
1378 | return -EIO; | 1392 | return -EIO; |
1379 | 1393 | ||
1394 | /* Try to turn the light on/off immediately */ | ||
1395 | sony_call_snc_handle(KBDBL_HANDLER, (value << 0x10) | SET_STATE, | ||
1396 | &result); | ||
1397 | |||
1380 | kbdbl_handle->mode = value; | 1398 | kbdbl_handle->mode = value; |
1381 | 1399 | ||
1382 | return 0; | 1400 | return 0; |
@@ -1458,7 +1476,7 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd) | |||
1458 | { | 1476 | { |
1459 | int result; | 1477 | int result; |
1460 | 1478 | ||
1461 | if (sony_call_snc_handle(0x137, KBDBL_PRESENT, &result)) | 1479 | if (sony_call_snc_handle(KBDBL_HANDLER, KBDBL_PRESENT, &result)) |
1462 | return 0; | 1480 | return 0; |
1463 | if (!(result & 0x02)) | 1481 | if (!(result & 0x02)) |
1464 | return 0; | 1482 | return 0; |
@@ -1501,13 +1519,36 @@ outkzalloc: | |||
1501 | static int sony_nc_kbd_backlight_cleanup(struct platform_device *pd) | 1519 | static int sony_nc_kbd_backlight_cleanup(struct platform_device *pd) |
1502 | { | 1520 | { |
1503 | if (kbdbl_handle) { | 1521 | if (kbdbl_handle) { |
1522 | int result; | ||
1523 | |||
1504 | device_remove_file(&pd->dev, &kbdbl_handle->mode_attr); | 1524 | device_remove_file(&pd->dev, &kbdbl_handle->mode_attr); |
1505 | device_remove_file(&pd->dev, &kbdbl_handle->timeout_attr); | 1525 | device_remove_file(&pd->dev, &kbdbl_handle->timeout_attr); |
1526 | |||
1527 | /* restore the default hw behaviour */ | ||
1528 | sony_call_snc_handle(KBDBL_HANDLER, 0x1000 | SET_MODE, &result); | ||
1529 | sony_call_snc_handle(KBDBL_HANDLER, SET_TIMEOUT, &result); | ||
1530 | |||
1506 | kfree(kbdbl_handle); | 1531 | kfree(kbdbl_handle); |
1507 | } | 1532 | } |
1508 | return 0; | 1533 | return 0; |
1509 | } | 1534 | } |
1510 | 1535 | ||
1536 | static void sony_nc_kbd_backlight_resume(void) | ||
1537 | { | ||
1538 | int ignore = 0; | ||
1539 | |||
1540 | if (!kbdbl_handle) | ||
1541 | return; | ||
1542 | |||
1543 | if (kbdbl_handle->mode == 0) | ||
1544 | sony_call_snc_handle(KBDBL_HANDLER, SET_MODE, &ignore); | ||
1545 | |||
1546 | if (kbdbl_handle->timeout != 0) | ||
1547 | sony_call_snc_handle(KBDBL_HANDLER, | ||
1548 | (kbdbl_handle->timeout << 0x10) | SET_TIMEOUT, | ||
1549 | &ignore); | ||
1550 | } | ||
1551 | |||
1511 | static void sony_nc_backlight_setup(void) | 1552 | static void sony_nc_backlight_setup(void) |
1512 | { | 1553 | { |
1513 | acpi_handle unused; | 1554 | acpi_handle unused; |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index a08561f5349e..efb3b6b9bcdb 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -8618,8 +8618,7 @@ static bool __pure __init tpacpi_is_valid_fw_id(const char* const s, | |||
8618 | tpacpi_is_fw_digit(s[1]) && | 8618 | tpacpi_is_fw_digit(s[1]) && |
8619 | s[2] == t && s[3] == 'T' && | 8619 | s[2] == t && s[3] == 'T' && |
8620 | tpacpi_is_fw_digit(s[4]) && | 8620 | tpacpi_is_fw_digit(s[4]) && |
8621 | tpacpi_is_fw_digit(s[5]) && | 8621 | tpacpi_is_fw_digit(s[5]); |
8622 | s[6] == 'W' && s[7] == 'W'; | ||
8623 | } | 8622 | } |
8624 | 8623 | ||
8625 | /* returns 0 - probe ok, or < 0 - probe error. | 8624 | /* returns 0 - probe ok, or < 0 - probe error. |
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index c29719cacbca..86c9a091a2ff 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c | |||
@@ -1171,16 +1171,17 @@ static int rio_hdid_setup(char *str) | |||
1171 | 1171 | ||
1172 | __setup("riohdid=", rio_hdid_setup); | 1172 | __setup("riohdid=", rio_hdid_setup); |
1173 | 1173 | ||
1174 | void rio_register_mport(struct rio_mport *port) | 1174 | int rio_register_mport(struct rio_mport *port) |
1175 | { | 1175 | { |
1176 | if (next_portid >= RIO_MAX_MPORTS) { | 1176 | if (next_portid >= RIO_MAX_MPORTS) { |
1177 | pr_err("RIO: reached specified max number of mports\n"); | 1177 | pr_err("RIO: reached specified max number of mports\n"); |
1178 | return; | 1178 | return 1; |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | port->id = next_portid++; | 1181 | port->id = next_portid++; |
1182 | port->host_deviceid = rio_get_hdid(port->id); | 1182 | port->host_deviceid = rio_get_hdid(port->id); |
1183 | list_add_tail(&port->node, &rio_mports); | 1183 | list_add_tail(&port->node, &rio_mports); |
1184 | return 0; | ||
1184 | } | 1185 | } |
1185 | 1186 | ||
1186 | EXPORT_SYMBOL_GPL(rio_local_get_device_id); | 1187 | EXPORT_SYMBOL_GPL(rio_local_get_device_id); |
diff --git a/drivers/rapidio/switches/idt_gen2.c b/drivers/rapidio/switches/idt_gen2.c index 095016a9dec1..ac2701b22e71 100644 --- a/drivers/rapidio/switches/idt_gen2.c +++ b/drivers/rapidio/switches/idt_gen2.c | |||
@@ -418,3 +418,4 @@ DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTCPS1848, idtg2_switch_init); | |||
418 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTCPS1616, idtg2_switch_init); | 418 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTCPS1616, idtg2_switch_init); |
419 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTVPS1616, idtg2_switch_init); | 419 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTVPS1616, idtg2_switch_init); |
420 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTSPS1616, idtg2_switch_init); | 420 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTSPS1616, idtg2_switch_init); |
421 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTCPS1432, idtg2_switch_init); | ||
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 09b4437b3e61..39013867cbd6 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
@@ -171,7 +171,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, | |||
171 | err = __rtc_read_alarm(rtc, &alrm); | 171 | err = __rtc_read_alarm(rtc, &alrm); |
172 | 172 | ||
173 | if (!err && !rtc_valid_tm(&alrm.time)) | 173 | if (!err && !rtc_valid_tm(&alrm.time)) |
174 | rtc_set_alarm(rtc, &alrm); | 174 | rtc_initialize_alarm(rtc, &alrm); |
175 | 175 | ||
176 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); | 176 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); |
177 | dev_set_name(&rtc->dev, "rtc%d", id); | 177 | dev_set_name(&rtc->dev, "rtc%d", id); |
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 23719f0acbf6..ef6316acec43 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -375,6 +375,32 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
375 | } | 375 | } |
376 | EXPORT_SYMBOL_GPL(rtc_set_alarm); | 376 | EXPORT_SYMBOL_GPL(rtc_set_alarm); |
377 | 377 | ||
378 | /* Called once per device from rtc_device_register */ | ||
379 | int rtc_initialize_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | ||
380 | { | ||
381 | int err; | ||
382 | |||
383 | err = rtc_valid_tm(&alarm->time); | ||
384 | if (err != 0) | ||
385 | return err; | ||
386 | |||
387 | err = mutex_lock_interruptible(&rtc->ops_lock); | ||
388 | if (err) | ||
389 | return err; | ||
390 | |||
391 | rtc->aie_timer.node.expires = rtc_tm_to_ktime(alarm->time); | ||
392 | rtc->aie_timer.period = ktime_set(0, 0); | ||
393 | if (alarm->enabled) { | ||
394 | rtc->aie_timer.enabled = 1; | ||
395 | timerqueue_add(&rtc->timerqueue, &rtc->aie_timer.node); | ||
396 | } | ||
397 | mutex_unlock(&rtc->ops_lock); | ||
398 | return err; | ||
399 | } | ||
400 | EXPORT_SYMBOL_GPL(rtc_initialize_alarm); | ||
401 | |||
402 | |||
403 | |||
378 | int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled) | 404 | int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled) |
379 | { | 405 | { |
380 | int err = mutex_lock_interruptible(&rtc->ops_lock); | 406 | int err = mutex_lock_interruptible(&rtc->ops_lock); |
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index a0fc4cf42abf..90d866272c8e 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c | |||
@@ -250,6 +250,8 @@ static int bfin_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
250 | bfin_rtc_int_set_alarm(rtc); | 250 | bfin_rtc_int_set_alarm(rtc); |
251 | else | 251 | else |
252 | bfin_rtc_int_clear(~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY)); | 252 | bfin_rtc_int_clear(~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY)); |
253 | |||
254 | return 0; | ||
253 | } | 255 | } |
254 | 256 | ||
255 | static int bfin_rtc_read_time(struct device *dev, struct rtc_time *tm) | 257 | static int bfin_rtc_read_time(struct device *dev, struct rtc_time *tm) |
diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c index 316f484999b5..80f9c88214c5 100644 --- a/drivers/rtc/rtc-coh901331.c +++ b/drivers/rtc/rtc-coh901331.c | |||
@@ -220,6 +220,7 @@ static int __init coh901331_probe(struct platform_device *pdev) | |||
220 | } | 220 | } |
221 | clk_disable(rtap->clk); | 221 | clk_disable(rtap->clk); |
222 | 222 | ||
223 | platform_set_drvdata(pdev, rtap); | ||
223 | rtap->rtc = rtc_device_register("coh901331", &pdev->dev, &coh901331_ops, | 224 | rtap->rtc = rtc_device_register("coh901331", &pdev->dev, &coh901331_ops, |
224 | THIS_MODULE); | 225 | THIS_MODULE); |
225 | if (IS_ERR(rtap->rtc)) { | 226 | if (IS_ERR(rtap->rtc)) { |
@@ -227,11 +228,10 @@ static int __init coh901331_probe(struct platform_device *pdev) | |||
227 | goto out_no_rtc; | 228 | goto out_no_rtc; |
228 | } | 229 | } |
229 | 230 | ||
230 | platform_set_drvdata(pdev, rtap); | ||
231 | |||
232 | return 0; | 231 | return 0; |
233 | 232 | ||
234 | out_no_rtc: | 233 | out_no_rtc: |
234 | platform_set_drvdata(pdev, NULL); | ||
235 | out_no_clk_enable: | 235 | out_no_clk_enable: |
236 | clk_put(rtap->clk); | 236 | clk_put(rtap->clk); |
237 | out_no_clk: | 237 | out_no_clk: |
diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c index 174036dda786..20494b5edc3c 100644 --- a/drivers/rtc/rtc-max8925.c +++ b/drivers/rtc/rtc-max8925.c | |||
@@ -257,6 +257,8 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev) | |||
257 | goto out_irq; | 257 | goto out_irq; |
258 | } | 258 | } |
259 | 259 | ||
260 | dev_set_drvdata(&pdev->dev, info); | ||
261 | |||
260 | info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev, | 262 | info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev, |
261 | &max8925_rtc_ops, THIS_MODULE); | 263 | &max8925_rtc_ops, THIS_MODULE); |
262 | ret = PTR_ERR(info->rtc_dev); | 264 | ret = PTR_ERR(info->rtc_dev); |
@@ -265,7 +267,6 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev) | |||
265 | goto out_rtc; | 267 | goto out_rtc; |
266 | } | 268 | } |
267 | 269 | ||
268 | dev_set_drvdata(&pdev->dev, info); | ||
269 | platform_set_drvdata(pdev, info); | 270 | platform_set_drvdata(pdev, info); |
270 | 271 | ||
271 | return 0; | 272 | return 0; |
diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c index c42006469559..c5ac03793e79 100644 --- a/drivers/rtc/rtc-mc13xxx.c +++ b/drivers/rtc/rtc-mc13xxx.c | |||
@@ -401,6 +401,7 @@ const struct platform_device_id mc13xxx_rtc_idtable[] = { | |||
401 | }, { | 401 | }, { |
402 | .name = "mc13892-rtc", | 402 | .name = "mc13892-rtc", |
403 | }, | 403 | }, |
404 | { } | ||
404 | }; | 405 | }; |
405 | 406 | ||
406 | static struct platform_driver mc13xxx_rtc_driver = { | 407 | static struct platform_driver mc13xxx_rtc_driver = { |
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index de0dd7b1f146..bcae8dd41496 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c | |||
@@ -394,7 +394,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev) | |||
394 | return 0; | 394 | return 0; |
395 | 395 | ||
396 | fail2: | 396 | fail2: |
397 | free_irq(omap_rtc_timer, NULL); | 397 | free_irq(omap_rtc_timer, rtc); |
398 | fail1: | 398 | fail1: |
399 | rtc_device_unregister(rtc); | 399 | rtc_device_unregister(rtc); |
400 | fail0: | 400 | fail0: |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 714964913e5e..b3466c491cd3 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -336,7 +336,6 @@ static void s3c_rtc_release(struct device *dev) | |||
336 | 336 | ||
337 | /* do not clear AIE here, it may be needed for wake */ | 337 | /* do not clear AIE here, it may be needed for wake */ |
338 | 338 | ||
339 | s3c_rtc_setpie(dev, 0); | ||
340 | free_irq(s3c_rtc_alarmno, rtc_dev); | 339 | free_irq(s3c_rtc_alarmno, rtc_dev); |
341 | free_irq(s3c_rtc_tickno, rtc_dev); | 340 | free_irq(s3c_rtc_tickno, rtc_dev); |
342 | } | 341 | } |
@@ -408,7 +407,6 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) | |||
408 | platform_set_drvdata(dev, NULL); | 407 | platform_set_drvdata(dev, NULL); |
409 | rtc_device_unregister(rtc); | 408 | rtc_device_unregister(rtc); |
410 | 409 | ||
411 | s3c_rtc_setpie(&dev->dev, 0); | ||
412 | s3c_rtc_setaie(&dev->dev, 0); | 410 | s3c_rtc_setaie(&dev->dev, 0); |
413 | 411 | ||
414 | clk_disable(rtc_clk); | 412 | clk_disable(rtc_clk); |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 4d2df2f76ea0..475e603fc584 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -2314,15 +2314,14 @@ static void dasd_flush_request_queue(struct dasd_block *block) | |||
2314 | 2314 | ||
2315 | static int dasd_open(struct block_device *bdev, fmode_t mode) | 2315 | static int dasd_open(struct block_device *bdev, fmode_t mode) |
2316 | { | 2316 | { |
2317 | struct dasd_block *block = bdev->bd_disk->private_data; | ||
2318 | struct dasd_device *base; | 2317 | struct dasd_device *base; |
2319 | int rc; | 2318 | int rc; |
2320 | 2319 | ||
2321 | if (!block) | 2320 | base = dasd_device_from_gendisk(bdev->bd_disk); |
2321 | if (!base) | ||
2322 | return -ENODEV; | 2322 | return -ENODEV; |
2323 | 2323 | ||
2324 | base = block->base; | 2324 | atomic_inc(&base->block->open_count); |
2325 | atomic_inc(&block->open_count); | ||
2326 | if (test_bit(DASD_FLAG_OFFLINE, &base->flags)) { | 2325 | if (test_bit(DASD_FLAG_OFFLINE, &base->flags)) { |
2327 | rc = -ENODEV; | 2326 | rc = -ENODEV; |
2328 | goto unlock; | 2327 | goto unlock; |
@@ -2355,21 +2354,28 @@ static int dasd_open(struct block_device *bdev, fmode_t mode) | |||
2355 | goto out; | 2354 | goto out; |
2356 | } | 2355 | } |
2357 | 2356 | ||
2357 | dasd_put_device(base); | ||
2358 | return 0; | 2358 | return 0; |
2359 | 2359 | ||
2360 | out: | 2360 | out: |
2361 | module_put(base->discipline->owner); | 2361 | module_put(base->discipline->owner); |
2362 | unlock: | 2362 | unlock: |
2363 | atomic_dec(&block->open_count); | 2363 | atomic_dec(&base->block->open_count); |
2364 | dasd_put_device(base); | ||
2364 | return rc; | 2365 | return rc; |
2365 | } | 2366 | } |
2366 | 2367 | ||
2367 | static int dasd_release(struct gendisk *disk, fmode_t mode) | 2368 | static int dasd_release(struct gendisk *disk, fmode_t mode) |
2368 | { | 2369 | { |
2369 | struct dasd_block *block = disk->private_data; | 2370 | struct dasd_device *base; |
2370 | 2371 | ||
2371 | atomic_dec(&block->open_count); | 2372 | base = dasd_device_from_gendisk(disk); |
2372 | module_put(block->base->discipline->owner); | 2373 | if (!base) |
2374 | return -ENODEV; | ||
2375 | |||
2376 | atomic_dec(&base->block->open_count); | ||
2377 | module_put(base->discipline->owner); | ||
2378 | dasd_put_device(base); | ||
2373 | return 0; | 2379 | return 0; |
2374 | } | 2380 | } |
2375 | 2381 | ||
@@ -2378,20 +2384,20 @@ static int dasd_release(struct gendisk *disk, fmode_t mode) | |||
2378 | */ | 2384 | */ |
2379 | static int dasd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | 2385 | static int dasd_getgeo(struct block_device *bdev, struct hd_geometry *geo) |
2380 | { | 2386 | { |
2381 | struct dasd_block *block; | ||
2382 | struct dasd_device *base; | 2387 | struct dasd_device *base; |
2383 | 2388 | ||
2384 | block = bdev->bd_disk->private_data; | 2389 | base = dasd_device_from_gendisk(bdev->bd_disk); |
2385 | if (!block) | 2390 | if (!base) |
2386 | return -ENODEV; | 2391 | return -ENODEV; |
2387 | base = block->base; | ||
2388 | 2392 | ||
2389 | if (!base->discipline || | 2393 | if (!base->discipline || |
2390 | !base->discipline->fill_geometry) | 2394 | !base->discipline->fill_geometry) { |
2395 | dasd_put_device(base); | ||
2391 | return -EINVAL; | 2396 | return -EINVAL; |
2392 | 2397 | } | |
2393 | base->discipline->fill_geometry(block, geo); | 2398 | base->discipline->fill_geometry(base->block, geo); |
2394 | geo->start = get_start_sect(bdev) >> block->s2b_shift; | 2399 | geo->start = get_start_sect(bdev) >> base->block->s2b_shift; |
2400 | dasd_put_device(base); | ||
2395 | return 0; | 2401 | return 0; |
2396 | } | 2402 | } |
2397 | 2403 | ||
@@ -2528,7 +2534,6 @@ void dasd_generic_remove(struct ccw_device *cdev) | |||
2528 | dasd_set_target_state(device, DASD_STATE_NEW); | 2534 | dasd_set_target_state(device, DASD_STATE_NEW); |
2529 | /* dasd_delete_device destroys the device reference. */ | 2535 | /* dasd_delete_device destroys the device reference. */ |
2530 | block = device->block; | 2536 | block = device->block; |
2531 | device->block = NULL; | ||
2532 | dasd_delete_device(device); | 2537 | dasd_delete_device(device); |
2533 | /* | 2538 | /* |
2534 | * life cycle of block is bound to device, so delete it after | 2539 | * life cycle of block is bound to device, so delete it after |
@@ -2650,7 +2655,6 @@ int dasd_generic_set_offline(struct ccw_device *cdev) | |||
2650 | dasd_set_target_state(device, DASD_STATE_NEW); | 2655 | dasd_set_target_state(device, DASD_STATE_NEW); |
2651 | /* dasd_delete_device destroys the device reference. */ | 2656 | /* dasd_delete_device destroys the device reference. */ |
2652 | block = device->block; | 2657 | block = device->block; |
2653 | device->block = NULL; | ||
2654 | dasd_delete_device(device); | 2658 | dasd_delete_device(device); |
2655 | /* | 2659 | /* |
2656 | * life cycle of block is bound to device, so delete it after | 2660 | * life cycle of block is bound to device, so delete it after |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 42e1bf35f689..d71511c7850a 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -674,6 +674,36 @@ dasd_device_from_cdev(struct ccw_device *cdev) | |||
674 | return device; | 674 | return device; |
675 | } | 675 | } |
676 | 676 | ||
677 | void dasd_add_link_to_gendisk(struct gendisk *gdp, struct dasd_device *device) | ||
678 | { | ||
679 | struct dasd_devmap *devmap; | ||
680 | |||
681 | devmap = dasd_find_busid(dev_name(&device->cdev->dev)); | ||
682 | if (IS_ERR(devmap)) | ||
683 | return; | ||
684 | spin_lock(&dasd_devmap_lock); | ||
685 | gdp->private_data = devmap; | ||
686 | spin_unlock(&dasd_devmap_lock); | ||
687 | } | ||
688 | |||
689 | struct dasd_device *dasd_device_from_gendisk(struct gendisk *gdp) | ||
690 | { | ||
691 | struct dasd_device *device; | ||
692 | struct dasd_devmap *devmap; | ||
693 | |||
694 | if (!gdp->private_data) | ||
695 | return NULL; | ||
696 | device = NULL; | ||
697 | spin_lock(&dasd_devmap_lock); | ||
698 | devmap = gdp->private_data; | ||
699 | if (devmap && devmap->device) { | ||
700 | device = devmap->device; | ||
701 | dasd_get_device(device); | ||
702 | } | ||
703 | spin_unlock(&dasd_devmap_lock); | ||
704 | return device; | ||
705 | } | ||
706 | |||
677 | /* | 707 | /* |
678 | * SECTION: files in sysfs | 708 | * SECTION: files in sysfs |
679 | */ | 709 | */ |
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index 29143eda9dd9..85dddb1e4126 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c | |||
@@ -239,7 +239,6 @@ static void dasd_ext_handler(unsigned int ext_int_code, | |||
239 | addr_t ip; | 239 | addr_t ip; |
240 | int rc; | 240 | int rc; |
241 | 241 | ||
242 | kstat_cpu(smp_processor_id()).irqs[EXTINT_DSD]++; | ||
243 | switch (ext_int_code >> 24) { | 242 | switch (ext_int_code >> 24) { |
244 | case DASD_DIAG_CODE_31BIT: | 243 | case DASD_DIAG_CODE_31BIT: |
245 | ip = (addr_t) param32; | 244 | ip = (addr_t) param32; |
@@ -250,6 +249,7 @@ static void dasd_ext_handler(unsigned int ext_int_code, | |||
250 | default: | 249 | default: |
251 | return; | 250 | return; |
252 | } | 251 | } |
252 | kstat_cpu(smp_processor_id()).irqs[EXTINT_DSD]++; | ||
253 | if (!ip) { /* no intparm: unsolicited interrupt */ | 253 | if (!ip) { /* no intparm: unsolicited interrupt */ |
254 | DBF_EVENT(DBF_NOTICE, "%s", "caught unsolicited " | 254 | DBF_EVENT(DBF_NOTICE, "%s", "caught unsolicited " |
255 | "interrupt"); | 255 | "interrupt"); |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index db8005d9f2fd..3ebdf5f92f8f 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -2037,7 +2037,7 @@ static void dasd_eckd_check_for_device_change(struct dasd_device *device, | |||
2037 | return; | 2037 | return; |
2038 | 2038 | ||
2039 | /* summary unit check */ | 2039 | /* summary unit check */ |
2040 | if ((sense[7] == 0x0D) && | 2040 | if ((sense[27] & DASD_SENSE_BIT_0) && (sense[7] == 0x0D) && |
2041 | (scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK)) { | 2041 | (scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK)) { |
2042 | dasd_alias_handle_summary_unit_check(device, irb); | 2042 | dasd_alias_handle_summary_unit_check(device, irb); |
2043 | return; | 2043 | return; |
@@ -2053,7 +2053,8 @@ static void dasd_eckd_check_for_device_change(struct dasd_device *device, | |||
2053 | /* loss of device reservation is handled via base devices only | 2053 | /* loss of device reservation is handled via base devices only |
2054 | * as alias devices may be used with several bases | 2054 | * as alias devices may be used with several bases |
2055 | */ | 2055 | */ |
2056 | if (device->block && (sense[7] == 0x3F) && | 2056 | if (device->block && (sense[27] & DASD_SENSE_BIT_0) && |
2057 | (sense[7] == 0x3F) && | ||
2057 | (scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK) && | 2058 | (scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK) && |
2058 | test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) { | 2059 | test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) { |
2059 | if (device->features & DASD_FEATURE_FAILONSLCK) | 2060 | if (device->features & DASD_FEATURE_FAILONSLCK) |
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c index 5505bc07e1e7..19a1ff03d65e 100644 --- a/drivers/s390/block/dasd_genhd.c +++ b/drivers/s390/block/dasd_genhd.c | |||
@@ -73,7 +73,7 @@ int dasd_gendisk_alloc(struct dasd_block *block) | |||
73 | if (base->features & DASD_FEATURE_READONLY || | 73 | if (base->features & DASD_FEATURE_READONLY || |
74 | test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) | 74 | test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) |
75 | set_disk_ro(gdp, 1); | 75 | set_disk_ro(gdp, 1); |
76 | gdp->private_data = block; | 76 | dasd_add_link_to_gendisk(gdp, base); |
77 | gdp->queue = block->request_queue; | 77 | gdp->queue = block->request_queue; |
78 | block->gdp = gdp; | 78 | block->gdp = gdp; |
79 | set_capacity(block->gdp, 0); | 79 | set_capacity(block->gdp, 0); |
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index df9f6999411d..d1e4f2c1264c 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -686,6 +686,9 @@ struct dasd_device *dasd_device_from_cdev(struct ccw_device *); | |||
686 | struct dasd_device *dasd_device_from_cdev_locked(struct ccw_device *); | 686 | struct dasd_device *dasd_device_from_cdev_locked(struct ccw_device *); |
687 | struct dasd_device *dasd_device_from_devindex(int); | 687 | struct dasd_device *dasd_device_from_devindex(int); |
688 | 688 | ||
689 | void dasd_add_link_to_gendisk(struct gendisk *, struct dasd_device *); | ||
690 | struct dasd_device *dasd_device_from_gendisk(struct gendisk *); | ||
691 | |||
689 | int dasd_parse(void); | 692 | int dasd_parse(void); |
690 | int dasd_busid_known(const char *); | 693 | int dasd_busid_known(const char *); |
691 | 694 | ||
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 26075e95b1ba..72261e4c516d 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c | |||
@@ -42,16 +42,22 @@ dasd_ioctl_api_version(void __user *argp) | |||
42 | static int | 42 | static int |
43 | dasd_ioctl_enable(struct block_device *bdev) | 43 | dasd_ioctl_enable(struct block_device *bdev) |
44 | { | 44 | { |
45 | struct dasd_block *block = bdev->bd_disk->private_data; | 45 | struct dasd_device *base; |
46 | 46 | ||
47 | if (!capable(CAP_SYS_ADMIN)) | 47 | if (!capable(CAP_SYS_ADMIN)) |
48 | return -EACCES; | 48 | return -EACCES; |
49 | 49 | ||
50 | dasd_enable_device(block->base); | 50 | base = dasd_device_from_gendisk(bdev->bd_disk); |
51 | if (!base) | ||
52 | return -ENODEV; | ||
53 | |||
54 | dasd_enable_device(base); | ||
51 | /* Formatting the dasd device can change the capacity. */ | 55 | /* Formatting the dasd device can change the capacity. */ |
52 | mutex_lock(&bdev->bd_mutex); | 56 | mutex_lock(&bdev->bd_mutex); |
53 | i_size_write(bdev->bd_inode, (loff_t)get_capacity(block->gdp) << 9); | 57 | i_size_write(bdev->bd_inode, |
58 | (loff_t)get_capacity(base->block->gdp) << 9); | ||
54 | mutex_unlock(&bdev->bd_mutex); | 59 | mutex_unlock(&bdev->bd_mutex); |
60 | dasd_put_device(base); | ||
55 | return 0; | 61 | return 0; |
56 | } | 62 | } |
57 | 63 | ||
@@ -62,11 +68,14 @@ dasd_ioctl_enable(struct block_device *bdev) | |||
62 | static int | 68 | static int |
63 | dasd_ioctl_disable(struct block_device *bdev) | 69 | dasd_ioctl_disable(struct block_device *bdev) |
64 | { | 70 | { |
65 | struct dasd_block *block = bdev->bd_disk->private_data; | 71 | struct dasd_device *base; |
66 | 72 | ||
67 | if (!capable(CAP_SYS_ADMIN)) | 73 | if (!capable(CAP_SYS_ADMIN)) |
68 | return -EACCES; | 74 | return -EACCES; |
69 | 75 | ||
76 | base = dasd_device_from_gendisk(bdev->bd_disk); | ||
77 | if (!base) | ||
78 | return -ENODEV; | ||
70 | /* | 79 | /* |
71 | * Man this is sick. We don't do a real disable but only downgrade | 80 | * Man this is sick. We don't do a real disable but only downgrade |
72 | * the device to DASD_STATE_BASIC. The reason is that dasdfmt uses | 81 | * the device to DASD_STATE_BASIC. The reason is that dasdfmt uses |
@@ -75,7 +84,7 @@ dasd_ioctl_disable(struct block_device *bdev) | |||
75 | * using the BIODASDFMT ioctl. Therefore the correct state for the | 84 | * using the BIODASDFMT ioctl. Therefore the correct state for the |
76 | * device is DASD_STATE_BASIC that allows to do basic i/o. | 85 | * device is DASD_STATE_BASIC that allows to do basic i/o. |
77 | */ | 86 | */ |
78 | dasd_set_target_state(block->base, DASD_STATE_BASIC); | 87 | dasd_set_target_state(base, DASD_STATE_BASIC); |
79 | /* | 88 | /* |
80 | * Set i_size to zero, since read, write, etc. check against this | 89 | * Set i_size to zero, since read, write, etc. check against this |
81 | * value. | 90 | * value. |
@@ -83,6 +92,7 @@ dasd_ioctl_disable(struct block_device *bdev) | |||
83 | mutex_lock(&bdev->bd_mutex); | 92 | mutex_lock(&bdev->bd_mutex); |
84 | i_size_write(bdev->bd_inode, 0); | 93 | i_size_write(bdev->bd_inode, 0); |
85 | mutex_unlock(&bdev->bd_mutex); | 94 | mutex_unlock(&bdev->bd_mutex); |
95 | dasd_put_device(base); | ||
86 | return 0; | 96 | return 0; |
87 | } | 97 | } |
88 | 98 | ||
@@ -191,26 +201,36 @@ static int dasd_format(struct dasd_block *block, struct format_data_t *fdata) | |||
191 | static int | 201 | static int |
192 | dasd_ioctl_format(struct block_device *bdev, void __user *argp) | 202 | dasd_ioctl_format(struct block_device *bdev, void __user *argp) |
193 | { | 203 | { |
194 | struct dasd_block *block = bdev->bd_disk->private_data; | 204 | struct dasd_device *base; |
195 | struct format_data_t fdata; | 205 | struct format_data_t fdata; |
206 | int rc; | ||
196 | 207 | ||
197 | if (!capable(CAP_SYS_ADMIN)) | 208 | if (!capable(CAP_SYS_ADMIN)) |
198 | return -EACCES; | 209 | return -EACCES; |
199 | if (!argp) | 210 | if (!argp) |
200 | return -EINVAL; | 211 | return -EINVAL; |
201 | 212 | base = dasd_device_from_gendisk(bdev->bd_disk); | |
202 | if (block->base->features & DASD_FEATURE_READONLY || | 213 | if (!base) |
203 | test_bit(DASD_FLAG_DEVICE_RO, &block->base->flags)) | 214 | return -ENODEV; |
215 | if (base->features & DASD_FEATURE_READONLY || | ||
216 | test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) { | ||
217 | dasd_put_device(base); | ||
204 | return -EROFS; | 218 | return -EROFS; |
205 | if (copy_from_user(&fdata, argp, sizeof(struct format_data_t))) | 219 | } |
220 | if (copy_from_user(&fdata, argp, sizeof(struct format_data_t))) { | ||
221 | dasd_put_device(base); | ||
206 | return -EFAULT; | 222 | return -EFAULT; |
223 | } | ||
207 | if (bdev != bdev->bd_contains) { | 224 | if (bdev != bdev->bd_contains) { |
208 | pr_warning("%s: The specified DASD is a partition and cannot " | 225 | pr_warning("%s: The specified DASD is a partition and cannot " |
209 | "be formatted\n", | 226 | "be formatted\n", |
210 | dev_name(&block->base->cdev->dev)); | 227 | dev_name(&base->cdev->dev)); |
228 | dasd_put_device(base); | ||
211 | return -EINVAL; | 229 | return -EINVAL; |
212 | } | 230 | } |
213 | return dasd_format(block, &fdata); | 231 | rc = dasd_format(base->block, &fdata); |
232 | dasd_put_device(base); | ||
233 | return rc; | ||
214 | } | 234 | } |
215 | 235 | ||
216 | #ifdef CONFIG_DASD_PROFILE | 236 | #ifdef CONFIG_DASD_PROFILE |
@@ -340,8 +360,8 @@ static int dasd_ioctl_information(struct dasd_block *block, | |||
340 | static int | 360 | static int |
341 | dasd_ioctl_set_ro(struct block_device *bdev, void __user *argp) | 361 | dasd_ioctl_set_ro(struct block_device *bdev, void __user *argp) |
342 | { | 362 | { |
343 | struct dasd_block *block = bdev->bd_disk->private_data; | 363 | struct dasd_device *base; |
344 | int intval; | 364 | int intval, rc; |
345 | 365 | ||
346 | if (!capable(CAP_SYS_ADMIN)) | 366 | if (!capable(CAP_SYS_ADMIN)) |
347 | return -EACCES; | 367 | return -EACCES; |
@@ -350,10 +370,17 @@ dasd_ioctl_set_ro(struct block_device *bdev, void __user *argp) | |||
350 | return -EINVAL; | 370 | return -EINVAL; |
351 | if (get_user(intval, (int __user *)argp)) | 371 | if (get_user(intval, (int __user *)argp)) |
352 | return -EFAULT; | 372 | return -EFAULT; |
353 | if (!intval && test_bit(DASD_FLAG_DEVICE_RO, &block->base->flags)) | 373 | base = dasd_device_from_gendisk(bdev->bd_disk); |
374 | if (!base) | ||
375 | return -ENODEV; | ||
376 | if (!intval && test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) { | ||
377 | dasd_put_device(base); | ||
354 | return -EROFS; | 378 | return -EROFS; |
379 | } | ||
355 | set_disk_ro(bdev->bd_disk, intval); | 380 | set_disk_ro(bdev->bd_disk, intval); |
356 | return dasd_set_feature(block->base->cdev, DASD_FEATURE_READONLY, intval); | 381 | rc = dasd_set_feature(base->cdev, DASD_FEATURE_READONLY, intval); |
382 | dasd_put_device(base); | ||
383 | return rc; | ||
357 | } | 384 | } |
358 | 385 | ||
359 | static int dasd_ioctl_readall_cmb(struct dasd_block *block, unsigned int cmd, | 386 | static int dasd_ioctl_readall_cmb(struct dasd_block *block, unsigned int cmd, |
@@ -372,59 +399,78 @@ static int dasd_ioctl_readall_cmb(struct dasd_block *block, unsigned int cmd, | |||
372 | int dasd_ioctl(struct block_device *bdev, fmode_t mode, | 399 | int dasd_ioctl(struct block_device *bdev, fmode_t mode, |
373 | unsigned int cmd, unsigned long arg) | 400 | unsigned int cmd, unsigned long arg) |
374 | { | 401 | { |
375 | struct dasd_block *block = bdev->bd_disk->private_data; | 402 | struct dasd_block *block; |
403 | struct dasd_device *base; | ||
376 | void __user *argp; | 404 | void __user *argp; |
405 | int rc; | ||
377 | 406 | ||
378 | if (is_compat_task()) | 407 | if (is_compat_task()) |
379 | argp = compat_ptr(arg); | 408 | argp = compat_ptr(arg); |
380 | else | 409 | else |
381 | argp = (void __user *)arg; | 410 | argp = (void __user *)arg; |
382 | 411 | ||
383 | if (!block) | ||
384 | return -ENODEV; | ||
385 | |||
386 | if ((_IOC_DIR(cmd) != _IOC_NONE) && !arg) { | 412 | if ((_IOC_DIR(cmd) != _IOC_NONE) && !arg) { |
387 | PRINT_DEBUG("empty data ptr"); | 413 | PRINT_DEBUG("empty data ptr"); |
388 | return -EINVAL; | 414 | return -EINVAL; |
389 | } | 415 | } |
390 | 416 | ||
417 | base = dasd_device_from_gendisk(bdev->bd_disk); | ||
418 | if (!base) | ||
419 | return -ENODEV; | ||
420 | block = base->block; | ||
421 | rc = 0; | ||
391 | switch (cmd) { | 422 | switch (cmd) { |
392 | case BIODASDDISABLE: | 423 | case BIODASDDISABLE: |
393 | return dasd_ioctl_disable(bdev); | 424 | rc = dasd_ioctl_disable(bdev); |
425 | break; | ||
394 | case BIODASDENABLE: | 426 | case BIODASDENABLE: |
395 | return dasd_ioctl_enable(bdev); | 427 | rc = dasd_ioctl_enable(bdev); |
428 | break; | ||
396 | case BIODASDQUIESCE: | 429 | case BIODASDQUIESCE: |
397 | return dasd_ioctl_quiesce(block); | 430 | rc = dasd_ioctl_quiesce(block); |
431 | break; | ||
398 | case BIODASDRESUME: | 432 | case BIODASDRESUME: |
399 | return dasd_ioctl_resume(block); | 433 | rc = dasd_ioctl_resume(block); |
434 | break; | ||
400 | case BIODASDFMT: | 435 | case BIODASDFMT: |
401 | return dasd_ioctl_format(bdev, argp); | 436 | rc = dasd_ioctl_format(bdev, argp); |
437 | break; | ||
402 | case BIODASDINFO: | 438 | case BIODASDINFO: |
403 | return dasd_ioctl_information(block, cmd, argp); | 439 | rc = dasd_ioctl_information(block, cmd, argp); |
440 | break; | ||
404 | case BIODASDINFO2: | 441 | case BIODASDINFO2: |
405 | return dasd_ioctl_information(block, cmd, argp); | 442 | rc = dasd_ioctl_information(block, cmd, argp); |
443 | break; | ||
406 | case BIODASDPRRD: | 444 | case BIODASDPRRD: |
407 | return dasd_ioctl_read_profile(block, argp); | 445 | rc = dasd_ioctl_read_profile(block, argp); |
446 | break; | ||
408 | case BIODASDPRRST: | 447 | case BIODASDPRRST: |
409 | return dasd_ioctl_reset_profile(block); | 448 | rc = dasd_ioctl_reset_profile(block); |
449 | break; | ||
410 | case BLKROSET: | 450 | case BLKROSET: |
411 | return dasd_ioctl_set_ro(bdev, argp); | 451 | rc = dasd_ioctl_set_ro(bdev, argp); |
452 | break; | ||
412 | case DASDAPIVER: | 453 | case DASDAPIVER: |
413 | return dasd_ioctl_api_version(argp); | 454 | rc = dasd_ioctl_api_version(argp); |
455 | break; | ||
414 | case BIODASDCMFENABLE: | 456 | case BIODASDCMFENABLE: |
415 | return enable_cmf(block->base->cdev); | 457 | rc = enable_cmf(base->cdev); |
458 | break; | ||
416 | case BIODASDCMFDISABLE: | 459 | case BIODASDCMFDISABLE: |
417 | return disable_cmf(block->base->cdev); | 460 | rc = disable_cmf(base->cdev); |
461 | break; | ||
418 | case BIODASDREADALLCMB: | 462 | case BIODASDREADALLCMB: |
419 | return dasd_ioctl_readall_cmb(block, cmd, argp); | 463 | rc = dasd_ioctl_readall_cmb(block, cmd, argp); |
464 | break; | ||
420 | default: | 465 | default: |
421 | /* if the discipline has an ioctl method try it. */ | 466 | /* if the discipline has an ioctl method try it. */ |
422 | if (block->base->discipline->ioctl) { | 467 | if (base->discipline->ioctl) { |
423 | int rval = block->base->discipline->ioctl(block, cmd, argp); | 468 | rc = base->discipline->ioctl(block, cmd, argp); |
424 | if (rval != -ENOIOCTLCMD) | 469 | if (rc == -ENOIOCTLCMD) |
425 | return rval; | 470 | rc = -EINVAL; |
426 | } | 471 | } else |
427 | 472 | rc = -EINVAL; | |
428 | return -EINVAL; | ||
429 | } | 473 | } |
474 | dasd_put_device(base); | ||
475 | return rc; | ||
430 | } | 476 | } |
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index c532ba929ccd..e8f267eb8887 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
@@ -407,8 +407,11 @@ static inline void account_sbals(struct qdio_q *q, int count) | |||
407 | q->q_stats.nr_sbals[pos]++; | 407 | q->q_stats.nr_sbals[pos]++; |
408 | } | 408 | } |
409 | 409 | ||
410 | static void announce_buffer_error(struct qdio_q *q, int count) | 410 | static void process_buffer_error(struct qdio_q *q, int count) |
411 | { | 411 | { |
412 | unsigned char state = (q->is_input_q) ? SLSB_P_INPUT_NOT_INIT : | ||
413 | SLSB_P_OUTPUT_NOT_INIT; | ||
414 | |||
412 | q->qdio_error |= QDIO_ERROR_SLSB_STATE; | 415 | q->qdio_error |= QDIO_ERROR_SLSB_STATE; |
413 | 416 | ||
414 | /* special handling for no target buffer empty */ | 417 | /* special handling for no target buffer empty */ |
@@ -426,6 +429,12 @@ static void announce_buffer_error(struct qdio_q *q, int count) | |||
426 | DBF_ERROR("F14:%2x F15:%2x", | 429 | DBF_ERROR("F14:%2x F15:%2x", |
427 | q->sbal[q->first_to_check]->element[14].flags & 0xff, | 430 | q->sbal[q->first_to_check]->element[14].flags & 0xff, |
428 | q->sbal[q->first_to_check]->element[15].flags & 0xff); | 431 | q->sbal[q->first_to_check]->element[15].flags & 0xff); |
432 | |||
433 | /* | ||
434 | * Interrupts may be avoided as long as the error is present | ||
435 | * so change the buffer state immediately to avoid starvation. | ||
436 | */ | ||
437 | set_buf_states(q, q->first_to_check, state, count); | ||
429 | } | 438 | } |
430 | 439 | ||
431 | static inline void inbound_primed(struct qdio_q *q, int count) | 440 | static inline void inbound_primed(struct qdio_q *q, int count) |
@@ -506,8 +515,7 @@ static int get_inbound_buffer_frontier(struct qdio_q *q) | |||
506 | account_sbals(q, count); | 515 | account_sbals(q, count); |
507 | break; | 516 | break; |
508 | case SLSB_P_INPUT_ERROR: | 517 | case SLSB_P_INPUT_ERROR: |
509 | announce_buffer_error(q, count); | 518 | process_buffer_error(q, count); |
510 | /* process the buffer, the upper layer will take care of it */ | ||
511 | q->first_to_check = add_buf(q->first_to_check, count); | 519 | q->first_to_check = add_buf(q->first_to_check, count); |
512 | atomic_sub(count, &q->nr_buf_used); | 520 | atomic_sub(count, &q->nr_buf_used); |
513 | if (q->irq_ptr->perf_stat_enabled) | 521 | if (q->irq_ptr->perf_stat_enabled) |
@@ -677,8 +685,7 @@ static int get_outbound_buffer_frontier(struct qdio_q *q) | |||
677 | account_sbals(q, count); | 685 | account_sbals(q, count); |
678 | break; | 686 | break; |
679 | case SLSB_P_OUTPUT_ERROR: | 687 | case SLSB_P_OUTPUT_ERROR: |
680 | announce_buffer_error(q, count); | 688 | process_buffer_error(q, count); |
681 | /* process the buffer, the upper layer will take care of it */ | ||
682 | q->first_to_check = add_buf(q->first_to_check, count); | 689 | q->first_to_check = add_buf(q->first_to_check, count); |
683 | atomic_sub(count, &q->nr_buf_used); | 690 | atomic_sub(count, &q->nr_buf_used); |
684 | if (q->irq_ptr->perf_stat_enabled) | 691 | if (q->irq_ptr->perf_stat_enabled) |
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c index 414427d64a8f..607998f0b7d8 100644 --- a/drivers/s390/kvm/kvm_virtio.c +++ b/drivers/s390/kvm/kvm_virtio.c | |||
@@ -381,10 +381,10 @@ static void kvm_extint_handler(unsigned int ext_int_code, | |||
381 | u16 subcode; | 381 | u16 subcode; |
382 | u32 param; | 382 | u32 param; |
383 | 383 | ||
384 | kstat_cpu(smp_processor_id()).irqs[EXTINT_VRT]++; | ||
385 | subcode = ext_int_code >> 16; | 384 | subcode = ext_int_code >> 16; |
386 | if ((subcode & 0xff00) != VIRTIO_SUBCODE_64) | 385 | if ((subcode & 0xff00) != VIRTIO_SUBCODE_64) |
387 | return; | 386 | return; |
387 | kstat_cpu(smp_processor_id()).irqs[EXTINT_VRT]++; | ||
388 | 388 | ||
389 | /* The LSB might be overloaded, we have to mask it */ | 389 | /* The LSB might be overloaded, we have to mask it */ |
390 | vq = (struct virtqueue *)(param64 & ~1UL); | 390 | vq = (struct virtqueue *)(param64 & ~1UL); |
diff --git a/drivers/scsi/device_handler/scsi_dh.c b/drivers/scsi/device_handler/scsi_dh.c index 564e6ecd17c2..0119b8147797 100644 --- a/drivers/scsi/device_handler/scsi_dh.c +++ b/drivers/scsi/device_handler/scsi_dh.c | |||
@@ -394,12 +394,14 @@ int scsi_dh_activate(struct request_queue *q, activate_complete fn, void *data) | |||
394 | unsigned long flags; | 394 | unsigned long flags; |
395 | struct scsi_device *sdev; | 395 | struct scsi_device *sdev; |
396 | struct scsi_device_handler *scsi_dh = NULL; | 396 | struct scsi_device_handler *scsi_dh = NULL; |
397 | struct device *dev = NULL; | ||
397 | 398 | ||
398 | spin_lock_irqsave(q->queue_lock, flags); | 399 | spin_lock_irqsave(q->queue_lock, flags); |
399 | sdev = q->queuedata; | 400 | sdev = q->queuedata; |
400 | if (sdev && sdev->scsi_dh_data) | 401 | if (sdev && sdev->scsi_dh_data) |
401 | scsi_dh = sdev->scsi_dh_data->scsi_dh; | 402 | scsi_dh = sdev->scsi_dh_data->scsi_dh; |
402 | if (!scsi_dh || !get_device(&sdev->sdev_gendev) || | 403 | dev = get_device(&sdev->sdev_gendev); |
404 | if (!scsi_dh || !dev || | ||
403 | sdev->sdev_state == SDEV_CANCEL || | 405 | sdev->sdev_state == SDEV_CANCEL || |
404 | sdev->sdev_state == SDEV_DEL) | 406 | sdev->sdev_state == SDEV_DEL) |
405 | err = SCSI_DH_NOSYS; | 407 | err = SCSI_DH_NOSYS; |
@@ -410,12 +412,13 @@ int scsi_dh_activate(struct request_queue *q, activate_complete fn, void *data) | |||
410 | if (err) { | 412 | if (err) { |
411 | if (fn) | 413 | if (fn) |
412 | fn(data, err); | 414 | fn(data, err); |
413 | return err; | 415 | goto out; |
414 | } | 416 | } |
415 | 417 | ||
416 | if (scsi_dh->activate) | 418 | if (scsi_dh->activate) |
417 | err = scsi_dh->activate(sdev, fn, data); | 419 | err = scsi_dh->activate(sdev, fn, data); |
418 | put_device(&sdev->sdev_gendev); | 420 | out: |
421 | put_device(dev); | ||
419 | return err; | 422 | return err; |
420 | } | 423 | } |
421 | EXPORT_SYMBOL_GPL(scsi_dh_activate); | 424 | EXPORT_SYMBOL_GPL(scsi_dh_activate); |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c index 1c6d2b405eef..d72f1f2b1392 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c | |||
@@ -688,6 +688,13 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc, | |||
688 | goto out; | 688 | goto out; |
689 | } | 689 | } |
690 | 690 | ||
691 | /* Check for overflow and wraparound */ | ||
692 | if (karg.data_sge_offset * 4 > ioc->request_sz || | ||
693 | karg.data_sge_offset > (UINT_MAX / 4)) { | ||
694 | ret = -EINVAL; | ||
695 | goto out; | ||
696 | } | ||
697 | |||
691 | /* copy in request message frame from user */ | 698 | /* copy in request message frame from user */ |
692 | if (copy_from_user(mpi_request, mf, karg.data_sge_offset*4)) { | 699 | if (copy_from_user(mpi_request, mf, karg.data_sge_offset*4)) { |
693 | printk(KERN_ERR "failure at %s:%d/%s()!\n", __FILE__, __LINE__, | 700 | printk(KERN_ERR "failure at %s:%d/%s()!\n", __FILE__, __LINE__, |
@@ -1963,7 +1970,7 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state) | |||
1963 | Mpi2DiagBufferPostReply_t *mpi_reply; | 1970 | Mpi2DiagBufferPostReply_t *mpi_reply; |
1964 | int rc, i; | 1971 | int rc, i; |
1965 | u8 buffer_type; | 1972 | u8 buffer_type; |
1966 | unsigned long timeleft; | 1973 | unsigned long timeleft, request_size, copy_size; |
1967 | u16 smid; | 1974 | u16 smid; |
1968 | u16 ioc_status; | 1975 | u16 ioc_status; |
1969 | u8 issue_reset = 0; | 1976 | u8 issue_reset = 0; |
@@ -1999,6 +2006,8 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state) | |||
1999 | return -ENOMEM; | 2006 | return -ENOMEM; |
2000 | } | 2007 | } |
2001 | 2008 | ||
2009 | request_size = ioc->diag_buffer_sz[buffer_type]; | ||
2010 | |||
2002 | if ((karg.starting_offset % 4) || (karg.bytes_to_read % 4)) { | 2011 | if ((karg.starting_offset % 4) || (karg.bytes_to_read % 4)) { |
2003 | printk(MPT2SAS_ERR_FMT "%s: either the starting_offset " | 2012 | printk(MPT2SAS_ERR_FMT "%s: either the starting_offset " |
2004 | "or bytes_to_read are not 4 byte aligned\n", ioc->name, | 2013 | "or bytes_to_read are not 4 byte aligned\n", ioc->name, |
@@ -2006,13 +2015,23 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state) | |||
2006 | return -EINVAL; | 2015 | return -EINVAL; |
2007 | } | 2016 | } |
2008 | 2017 | ||
2018 | if (karg.starting_offset > request_size) | ||
2019 | return -EINVAL; | ||
2020 | |||
2009 | diag_data = (void *)(request_data + karg.starting_offset); | 2021 | diag_data = (void *)(request_data + karg.starting_offset); |
2010 | dctlprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: diag_buffer(%p), " | 2022 | dctlprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: diag_buffer(%p), " |
2011 | "offset(%d), sz(%d)\n", ioc->name, __func__, | 2023 | "offset(%d), sz(%d)\n", ioc->name, __func__, |
2012 | diag_data, karg.starting_offset, karg.bytes_to_read)); | 2024 | diag_data, karg.starting_offset, karg.bytes_to_read)); |
2013 | 2025 | ||
2026 | /* Truncate data on requests that are too large */ | ||
2027 | if ((diag_data + karg.bytes_to_read < diag_data) || | ||
2028 | (diag_data + karg.bytes_to_read > request_data + request_size)) | ||
2029 | copy_size = request_size - karg.starting_offset; | ||
2030 | else | ||
2031 | copy_size = karg.bytes_to_read; | ||
2032 | |||
2014 | if (copy_to_user((void __user *)uarg->diagnostic_data, | 2033 | if (copy_to_user((void __user *)uarg->diagnostic_data, |
2015 | diag_data, karg.bytes_to_read)) { | 2034 | diag_data, copy_size)) { |
2016 | printk(MPT2SAS_ERR_FMT "%s: Unable to write " | 2035 | printk(MPT2SAS_ERR_FMT "%s: Unable to write " |
2017 | "mpt_diag_read_buffer_t data @ %p\n", ioc->name, | 2036 | "mpt_diag_read_buffer_t data @ %p\n", ioc->name, |
2018 | __func__, diag_data); | 2037 | __func__, diag_data); |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 96d5ad0c1e42..7f636b118287 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -3814,6 +3814,9 @@ static long pmcraid_ioctl_passthrough( | |||
3814 | rc = -EFAULT; | 3814 | rc = -EFAULT; |
3815 | goto out_free_buffer; | 3815 | goto out_free_buffer; |
3816 | } | 3816 | } |
3817 | } else if (request_size < 0) { | ||
3818 | rc = -EINVAL; | ||
3819 | goto out_free_buffer; | ||
3817 | } | 3820 | } |
3818 | 3821 | ||
3819 | /* check if we have any additional command parameters */ | 3822 | /* check if we have any additional command parameters */ |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 6d5c7ff43f5b..e9901b8f8443 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -411,8 +411,6 @@ static void scsi_run_queue(struct request_queue *q) | |||
411 | list_splice_init(&shost->starved_list, &starved_list); | 411 | list_splice_init(&shost->starved_list, &starved_list); |
412 | 412 | ||
413 | while (!list_empty(&starved_list)) { | 413 | while (!list_empty(&starved_list)) { |
414 | int flagset; | ||
415 | |||
416 | /* | 414 | /* |
417 | * As long as shost is accepting commands and we have | 415 | * As long as shost is accepting commands and we have |
418 | * starved queues, call blk_run_queue. scsi_request_fn | 416 | * starved queues, call blk_run_queue. scsi_request_fn |
@@ -435,20 +433,7 @@ static void scsi_run_queue(struct request_queue *q) | |||
435 | continue; | 433 | continue; |
436 | } | 434 | } |
437 | 435 | ||
438 | spin_unlock(shost->host_lock); | 436 | blk_run_queue_async(sdev->request_queue); |
439 | |||
440 | spin_lock(sdev->request_queue->queue_lock); | ||
441 | flagset = test_bit(QUEUE_FLAG_REENTER, &q->queue_flags) && | ||
442 | !test_bit(QUEUE_FLAG_REENTER, | ||
443 | &sdev->request_queue->queue_flags); | ||
444 | if (flagset) | ||
445 | queue_flag_set(QUEUE_FLAG_REENTER, sdev->request_queue); | ||
446 | __blk_run_queue(sdev->request_queue, false); | ||
447 | if (flagset) | ||
448 | queue_flag_clear(QUEUE_FLAG_REENTER, sdev->request_queue); | ||
449 | spin_unlock(sdev->request_queue->queue_lock); | ||
450 | |||
451 | spin_lock(shost->host_lock); | ||
452 | } | 437 | } |
453 | /* put any unprocessed entries back */ | 438 | /* put any unprocessed entries back */ |
454 | list_splice(&starved_list, &shost->starved_list); | 439 | list_splice(&starved_list, &shost->starved_list); |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index e44ff64233fd..e63912510fb9 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -322,14 +322,8 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work) | |||
322 | kfree(evt); | 322 | kfree(evt); |
323 | } | 323 | } |
324 | 324 | ||
325 | if (sdev->request_queue) { | 325 | /* NULL queue means the device can't be used */ |
326 | sdev->request_queue->queuedata = NULL; | 326 | sdev->request_queue = NULL; |
327 | /* user context needed to free queue */ | ||
328 | scsi_free_queue(sdev->request_queue); | ||
329 | /* temporary expedient, try to catch use of queue lock | ||
330 | * after free of sdev */ | ||
331 | sdev->request_queue = NULL; | ||
332 | } | ||
333 | 327 | ||
334 | scsi_target_reap(scsi_target(sdev)); | 328 | scsi_target_reap(scsi_target(sdev)); |
335 | 329 | ||
@@ -937,6 +931,12 @@ void __scsi_remove_device(struct scsi_device *sdev) | |||
937 | if (sdev->host->hostt->slave_destroy) | 931 | if (sdev->host->hostt->slave_destroy) |
938 | sdev->host->hostt->slave_destroy(sdev); | 932 | sdev->host->hostt->slave_destroy(sdev); |
939 | transport_destroy_device(dev); | 933 | transport_destroy_device(dev); |
934 | |||
935 | /* cause the request function to reject all I/O requests */ | ||
936 | sdev->request_queue->queuedata = NULL; | ||
937 | |||
938 | /* Freeing the queue signals to block that we're done */ | ||
939 | scsi_free_queue(sdev->request_queue); | ||
940 | put_device(dev); | 940 | put_device(dev); |
941 | } | 941 | } |
942 | 942 | ||
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index fdf3fa639056..815069d13f9b 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -3816,28 +3816,17 @@ fail_host_msg: | |||
3816 | static void | 3816 | static void |
3817 | fc_bsg_goose_queue(struct fc_rport *rport) | 3817 | fc_bsg_goose_queue(struct fc_rport *rport) |
3818 | { | 3818 | { |
3819 | int flagset; | ||
3820 | unsigned long flags; | ||
3821 | |||
3822 | if (!rport->rqst_q) | 3819 | if (!rport->rqst_q) |
3823 | return; | 3820 | return; |
3824 | 3821 | ||
3822 | /* | ||
3823 | * This get/put dance makes no sense | ||
3824 | */ | ||
3825 | get_device(&rport->dev); | 3825 | get_device(&rport->dev); |
3826 | 3826 | blk_run_queue_async(rport->rqst_q); | |
3827 | spin_lock_irqsave(rport->rqst_q->queue_lock, flags); | ||
3828 | flagset = test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags) && | ||
3829 | !test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags); | ||
3830 | if (flagset) | ||
3831 | queue_flag_set(QUEUE_FLAG_REENTER, rport->rqst_q); | ||
3832 | __blk_run_queue(rport->rqst_q, false); | ||
3833 | if (flagset) | ||
3834 | queue_flag_clear(QUEUE_FLAG_REENTER, rport->rqst_q); | ||
3835 | spin_unlock_irqrestore(rport->rqst_q->queue_lock, flags); | ||
3836 | |||
3837 | put_device(&rport->dev); | 3827 | put_device(&rport->dev); |
3838 | } | 3828 | } |
3839 | 3829 | ||
3840 | |||
3841 | /** | 3830 | /** |
3842 | * fc_bsg_rport_dispatch - process rport bsg requests and dispatch to LLDD | 3831 | * fc_bsg_rport_dispatch - process rport bsg requests and dispatch to LLDD |
3843 | * @q: rport request queue | 3832 | * @q: rport request queue |
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c index 5825370bad25..08de58e7f59f 100644 --- a/drivers/spi/amba-pl022.c +++ b/drivers/spi/amba-pl022.c | |||
@@ -1555,7 +1555,7 @@ static int stop_queue(struct pl022 *pl022) | |||
1555 | * A wait_queue on the pl022->busy could be used, but then the common | 1555 | * A wait_queue on the pl022->busy could be used, but then the common |
1556 | * execution path (pump_messages) would be required to call wake_up or | 1556 | * execution path (pump_messages) would be required to call wake_up or |
1557 | * friends on every SPI message. Do this instead */ | 1557 | * friends on every SPI message. Do this instead */ |
1558 | while (!list_empty(&pl022->queue) && pl022->busy && limit--) { | 1558 | while ((!list_empty(&pl022->queue) || pl022->busy) && limit--) { |
1559 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | 1559 | spin_unlock_irqrestore(&pl022->queue_lock, flags); |
1560 | msleep(10); | 1560 | msleep(10); |
1561 | spin_lock_irqsave(&pl022->queue_lock, flags); | 1561 | spin_lock_irqsave(&pl022->queue_lock, flags); |
diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c index b1a4b9f503ae..871e337c917f 100644 --- a/drivers/spi/dw_spi.c +++ b/drivers/spi/dw_spi.c | |||
@@ -821,7 +821,7 @@ static int stop_queue(struct dw_spi *dws) | |||
821 | 821 | ||
822 | spin_lock_irqsave(&dws->lock, flags); | 822 | spin_lock_irqsave(&dws->lock, flags); |
823 | dws->run = QUEUE_STOPPED; | 823 | dws->run = QUEUE_STOPPED; |
824 | while (!list_empty(&dws->queue) && dws->busy && limit--) { | 824 | while ((!list_empty(&dws->queue) || dws->busy) && limit--) { |
825 | spin_unlock_irqrestore(&dws->lock, flags); | 825 | spin_unlock_irqrestore(&dws->lock, flags); |
826 | msleep(10); | 826 | msleep(10); |
827 | spin_lock_irqsave(&dws->lock, flags); | 827 | spin_lock_irqsave(&dws->lock, flags); |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index 9c74aad6be93..dc25bee8d33f 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
@@ -1493,7 +1493,7 @@ static int stop_queue(struct driver_data *drv_data) | |||
1493 | * execution path (pump_messages) would be required to call wake_up or | 1493 | * execution path (pump_messages) would be required to call wake_up or |
1494 | * friends on every SPI message. Do this instead */ | 1494 | * friends on every SPI message. Do this instead */ |
1495 | drv_data->run = QUEUE_STOPPED; | 1495 | drv_data->run = QUEUE_STOPPED; |
1496 | while (!list_empty(&drv_data->queue) && drv_data->busy && limit--) { | 1496 | while ((!list_empty(&drv_data->queue) || drv_data->busy) && limit--) { |
1497 | spin_unlock_irqrestore(&drv_data->lock, flags); | 1497 | spin_unlock_irqrestore(&drv_data->lock, flags); |
1498 | msleep(10); | 1498 | msleep(10); |
1499 | spin_lock_irqsave(&drv_data->lock, flags); | 1499 | spin_lock_irqsave(&drv_data->lock, flags); |
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index bdb7289a1d22..f706dba165cf 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
@@ -1284,7 +1284,7 @@ static inline int bfin_spi_stop_queue(struct bfin_spi_master_data *drv_data) | |||
1284 | * friends on every SPI message. Do this instead | 1284 | * friends on every SPI message. Do this instead |
1285 | */ | 1285 | */ |
1286 | drv_data->running = false; | 1286 | drv_data->running = false; |
1287 | while (!list_empty(&drv_data->queue) && drv_data->busy && limit--) { | 1287 | while ((!list_empty(&drv_data->queue) || drv_data->busy) && limit--) { |
1288 | spin_unlock_irqrestore(&drv_data->lock, flags); | 1288 | spin_unlock_irqrestore(&drv_data->lock, flags); |
1289 | msleep(10); | 1289 | msleep(10); |
1290 | spin_lock_irqsave(&drv_data->lock, flags); | 1290 | spin_lock_irqsave(&drv_data->lock, flags); |
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index dca4a0bb6ca9..e3786f161bc3 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig | |||
@@ -131,8 +131,6 @@ source "drivers/staging/wlags49_h2/Kconfig" | |||
131 | 131 | ||
132 | source "drivers/staging/wlags49_h25/Kconfig" | 132 | source "drivers/staging/wlags49_h25/Kconfig" |
133 | 133 | ||
134 | source "drivers/staging/samsung-laptop/Kconfig" | ||
135 | |||
136 | source "drivers/staging/sm7xx/Kconfig" | 134 | source "drivers/staging/sm7xx/Kconfig" |
137 | 135 | ||
138 | source "drivers/staging/dt3155v4l/Kconfig" | 136 | source "drivers/staging/dt3155v4l/Kconfig" |
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index eb93012b6f59..f0d5c5315612 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile | |||
@@ -48,7 +48,6 @@ obj-$(CONFIG_XVMALLOC) += zram/ | |||
48 | obj-$(CONFIG_ZCACHE) += zcache/ | 48 | obj-$(CONFIG_ZCACHE) += zcache/ |
49 | obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ | 49 | obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ |
50 | obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ | 50 | obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ |
51 | obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop/ | ||
52 | obj-$(CONFIG_FB_SM7XX) += sm7xx/ | 51 | obj-$(CONFIG_FB_SM7XX) += sm7xx/ |
53 | obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/ | 52 | obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/ |
54 | obj-$(CONFIG_CRYSTALHD) += crystalhd/ | 53 | obj-$(CONFIG_CRYSTALHD) += crystalhd/ |
diff --git a/drivers/staging/rt2860/common/cmm_data_pci.c b/drivers/staging/rt2860/common/cmm_data_pci.c index bef0bbd8cef7..f01a51c381f1 100644 --- a/drivers/staging/rt2860/common/cmm_data_pci.c +++ b/drivers/staging/rt2860/common/cmm_data_pci.c | |||
@@ -444,7 +444,7 @@ int RTMPCheckRxError(struct rt_rtmp_adapter *pAd, | |||
444 | return (NDIS_STATUS_FAILURE); | 444 | return (NDIS_STATUS_FAILURE); |
445 | } | 445 | } |
446 | } | 446 | } |
447 | /* Drop not U2M frames, can't's drop here because we will drop beacon in this case */ | 447 | /* Drop not U2M frames, can't drop here because we will drop beacon in this case */ |
448 | /* I am kind of doubting the U2M bit operation */ | 448 | /* I am kind of doubting the U2M bit operation */ |
449 | /* if (pRxD->U2M == 0) */ | 449 | /* if (pRxD->U2M == 0) */ |
450 | /* return(NDIS_STATUS_FAILURE); */ | 450 | /* return(NDIS_STATUS_FAILURE); */ |
diff --git a/drivers/staging/rt2860/common/cmm_data_usb.c b/drivers/staging/rt2860/common/cmm_data_usb.c index 5637857ae9eb..83a62faa7e57 100644 --- a/drivers/staging/rt2860/common/cmm_data_usb.c +++ b/drivers/staging/rt2860/common/cmm_data_usb.c | |||
@@ -860,7 +860,7 @@ int RTMPCheckRxError(struct rt_rtmp_adapter *pAd, | |||
860 | DBGPRINT_RAW(RT_DEBUG_ERROR, ("received packet too long\n")); | 860 | DBGPRINT_RAW(RT_DEBUG_ERROR, ("received packet too long\n")); |
861 | return NDIS_STATUS_FAILURE; | 861 | return NDIS_STATUS_FAILURE; |
862 | } | 862 | } |
863 | /* Drop not U2M frames, can't's drop here because we will drop beacon in this case */ | 863 | /* Drop not U2M frames, can't drop here because we will drop beacon in this case */ |
864 | /* I am kind of doubting the U2M bit operation */ | 864 | /* I am kind of doubting the U2M bit operation */ |
865 | /* if (pRxD->U2M == 0) */ | 865 | /* if (pRxD->U2M == 0) */ |
866 | /* return(NDIS_STATUS_FAILURE); */ | 866 | /* return(NDIS_STATUS_FAILURE); */ |
diff --git a/drivers/staging/samsung-laptop/Kconfig b/drivers/staging/samsung-laptop/Kconfig deleted file mode 100644 index f27c60864c26..000000000000 --- a/drivers/staging/samsung-laptop/Kconfig +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | config SAMSUNG_LAPTOP | ||
2 | tristate "Samsung Laptop driver" | ||
3 | default n | ||
4 | depends on RFKILL && BACKLIGHT_CLASS_DEVICE && X86 | ||
5 | help | ||
6 | This module implements a driver for the N128 Samsung Laptop | ||
7 | providing control over the Wireless LED and the LCD backlight | ||
8 | |||
9 | To compile this driver as a module, choose | ||
10 | M here: the module will be called samsung-laptop. | ||
diff --git a/drivers/staging/samsung-laptop/Makefile b/drivers/staging/samsung-laptop/Makefile deleted file mode 100644 index 3c6f42045211..000000000000 --- a/drivers/staging/samsung-laptop/Makefile +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop.o | ||
diff --git a/drivers/staging/samsung-laptop/TODO b/drivers/staging/samsung-laptop/TODO deleted file mode 100644 index f7a6d589916e..000000000000 --- a/drivers/staging/samsung-laptop/TODO +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | TODO: | ||
2 | - review from other developers | ||
3 | - figure out ACPI video issues | ||
4 | |||
5 | Please send patches to Greg Kroah-Hartman <gregkh@suse.de> | ||
diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c deleted file mode 100644 index 25294462b8b6..000000000000 --- a/drivers/staging/samsung-laptop/samsung-laptop.c +++ /dev/null | |||
@@ -1,843 +0,0 @@ | |||
1 | /* | ||
2 | * Samsung Laptop driver | ||
3 | * | ||
4 | * Copyright (C) 2009,2011 Greg Kroah-Hartman (gregkh@suse.de) | ||
5 | * Copyright (C) 2009,2011 Novell Inc. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/pci.h> | ||
19 | #include <linux/backlight.h> | ||
20 | #include <linux/fb.h> | ||
21 | #include <linux/dmi.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/rfkill.h> | ||
24 | |||
25 | /* | ||
26 | * This driver is needed because a number of Samsung laptops do not hook | ||
27 | * their control settings through ACPI. So we have to poke around in the | ||
28 | * BIOS to do things like brightness values, and "special" key controls. | ||
29 | */ | ||
30 | |||
31 | /* | ||
32 | * We have 0 - 8 as valid brightness levels. The specs say that level 0 should | ||
33 | * be reserved by the BIOS (which really doesn't make much sense), we tell | ||
34 | * userspace that the value is 0 - 7 and then just tell the hardware 1 - 8 | ||
35 | */ | ||
36 | #define MAX_BRIGHT 0x07 | ||
37 | |||
38 | |||
39 | #define SABI_IFACE_MAIN 0x00 | ||
40 | #define SABI_IFACE_SUB 0x02 | ||
41 | #define SABI_IFACE_COMPLETE 0x04 | ||
42 | #define SABI_IFACE_DATA 0x05 | ||
43 | |||
44 | /* Structure to get data back to the calling function */ | ||
45 | struct sabi_retval { | ||
46 | u8 retval[20]; | ||
47 | }; | ||
48 | |||
49 | struct sabi_header_offsets { | ||
50 | u8 port; | ||
51 | u8 re_mem; | ||
52 | u8 iface_func; | ||
53 | u8 en_mem; | ||
54 | u8 data_offset; | ||
55 | u8 data_segment; | ||
56 | }; | ||
57 | |||
58 | struct sabi_commands { | ||
59 | /* | ||
60 | * Brightness is 0 - 8, as described above. | ||
61 | * Value 0 is for the BIOS to use | ||
62 | */ | ||
63 | u8 get_brightness; | ||
64 | u8 set_brightness; | ||
65 | |||
66 | /* | ||
67 | * first byte: | ||
68 | * 0x00 - wireless is off | ||
69 | * 0x01 - wireless is on | ||
70 | * second byte: | ||
71 | * 0x02 - 3G is off | ||
72 | * 0x03 - 3G is on | ||
73 | * TODO, verify 3G is correct, that doesn't seem right... | ||
74 | */ | ||
75 | u8 get_wireless_button; | ||
76 | u8 set_wireless_button; | ||
77 | |||
78 | /* 0 is off, 1 is on */ | ||
79 | u8 get_backlight; | ||
80 | u8 set_backlight; | ||
81 | |||
82 | /* | ||
83 | * 0x80 or 0x00 - no action | ||
84 | * 0x81 - recovery key pressed | ||
85 | */ | ||
86 | u8 get_recovery_mode; | ||
87 | u8 set_recovery_mode; | ||
88 | |||
89 | /* | ||
90 | * on seclinux: 0 is low, 1 is high, | ||
91 | * on swsmi: 0 is normal, 1 is silent, 2 is turbo | ||
92 | */ | ||
93 | u8 get_performance_level; | ||
94 | u8 set_performance_level; | ||
95 | |||
96 | /* | ||
97 | * Tell the BIOS that Linux is running on this machine. | ||
98 | * 81 is on, 80 is off | ||
99 | */ | ||
100 | u8 set_linux; | ||
101 | }; | ||
102 | |||
103 | struct sabi_performance_level { | ||
104 | const char *name; | ||
105 | u8 value; | ||
106 | }; | ||
107 | |||
108 | struct sabi_config { | ||
109 | const char *test_string; | ||
110 | u16 main_function; | ||
111 | const struct sabi_header_offsets header_offsets; | ||
112 | const struct sabi_commands commands; | ||
113 | const struct sabi_performance_level performance_levels[4]; | ||
114 | u8 min_brightness; | ||
115 | u8 max_brightness; | ||
116 | }; | ||
117 | |||
118 | static const struct sabi_config sabi_configs[] = { | ||
119 | { | ||
120 | .test_string = "SECLINUX", | ||
121 | |||
122 | .main_function = 0x4c49, | ||
123 | |||
124 | .header_offsets = { | ||
125 | .port = 0x00, | ||
126 | .re_mem = 0x02, | ||
127 | .iface_func = 0x03, | ||
128 | .en_mem = 0x04, | ||
129 | .data_offset = 0x05, | ||
130 | .data_segment = 0x07, | ||
131 | }, | ||
132 | |||
133 | .commands = { | ||
134 | .get_brightness = 0x00, | ||
135 | .set_brightness = 0x01, | ||
136 | |||
137 | .get_wireless_button = 0x02, | ||
138 | .set_wireless_button = 0x03, | ||
139 | |||
140 | .get_backlight = 0x04, | ||
141 | .set_backlight = 0x05, | ||
142 | |||
143 | .get_recovery_mode = 0x06, | ||
144 | .set_recovery_mode = 0x07, | ||
145 | |||
146 | .get_performance_level = 0x08, | ||
147 | .set_performance_level = 0x09, | ||
148 | |||
149 | .set_linux = 0x0a, | ||
150 | }, | ||
151 | |||
152 | .performance_levels = { | ||
153 | { | ||
154 | .name = "silent", | ||
155 | .value = 0, | ||
156 | }, | ||
157 | { | ||
158 | .name = "normal", | ||
159 | .value = 1, | ||
160 | }, | ||
161 | { }, | ||
162 | }, | ||
163 | .min_brightness = 1, | ||
164 | .max_brightness = 8, | ||
165 | }, | ||
166 | { | ||
167 | .test_string = "SwSmi@", | ||
168 | |||
169 | .main_function = 0x5843, | ||
170 | |||
171 | .header_offsets = { | ||
172 | .port = 0x00, | ||
173 | .re_mem = 0x04, | ||
174 | .iface_func = 0x02, | ||
175 | .en_mem = 0x03, | ||
176 | .data_offset = 0x05, | ||
177 | .data_segment = 0x07, | ||
178 | }, | ||
179 | |||
180 | .commands = { | ||
181 | .get_brightness = 0x10, | ||
182 | .set_brightness = 0x11, | ||
183 | |||
184 | .get_wireless_button = 0x12, | ||
185 | .set_wireless_button = 0x13, | ||
186 | |||
187 | .get_backlight = 0x2d, | ||
188 | .set_backlight = 0x2e, | ||
189 | |||
190 | .get_recovery_mode = 0xff, | ||
191 | .set_recovery_mode = 0xff, | ||
192 | |||
193 | .get_performance_level = 0x31, | ||
194 | .set_performance_level = 0x32, | ||
195 | |||
196 | .set_linux = 0xff, | ||
197 | }, | ||
198 | |||
199 | .performance_levels = { | ||
200 | { | ||
201 | .name = "normal", | ||
202 | .value = 0, | ||
203 | }, | ||
204 | { | ||
205 | .name = "silent", | ||
206 | .value = 1, | ||
207 | }, | ||
208 | { | ||
209 | .name = "overclock", | ||
210 | .value = 2, | ||
211 | }, | ||
212 | { }, | ||
213 | }, | ||
214 | .min_brightness = 0, | ||
215 | .max_brightness = 8, | ||
216 | }, | ||
217 | { }, | ||
218 | }; | ||
219 | |||
220 | static const struct sabi_config *sabi_config; | ||
221 | |||
222 | static void __iomem *sabi; | ||
223 | static void __iomem *sabi_iface; | ||
224 | static void __iomem *f0000_segment; | ||
225 | static struct backlight_device *backlight_device; | ||
226 | static struct mutex sabi_mutex; | ||
227 | static struct platform_device *sdev; | ||
228 | static struct rfkill *rfk; | ||
229 | |||
230 | static int force; | ||
231 | module_param(force, bool, 0); | ||
232 | MODULE_PARM_DESC(force, | ||
233 | "Disable the DMI check and forces the driver to be loaded"); | ||
234 | |||
235 | static int debug; | ||
236 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
237 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
238 | |||
239 | static int sabi_get_command(u8 command, struct sabi_retval *sretval) | ||
240 | { | ||
241 | int retval = 0; | ||
242 | u16 port = readw(sabi + sabi_config->header_offsets.port); | ||
243 | u8 complete, iface_data; | ||
244 | |||
245 | mutex_lock(&sabi_mutex); | ||
246 | |||
247 | /* enable memory to be able to write to it */ | ||
248 | outb(readb(sabi + sabi_config->header_offsets.en_mem), port); | ||
249 | |||
250 | /* write out the command */ | ||
251 | writew(sabi_config->main_function, sabi_iface + SABI_IFACE_MAIN); | ||
252 | writew(command, sabi_iface + SABI_IFACE_SUB); | ||
253 | writeb(0, sabi_iface + SABI_IFACE_COMPLETE); | ||
254 | outb(readb(sabi + sabi_config->header_offsets.iface_func), port); | ||
255 | |||
256 | /* write protect memory to make it safe */ | ||
257 | outb(readb(sabi + sabi_config->header_offsets.re_mem), port); | ||
258 | |||
259 | /* see if the command actually succeeded */ | ||
260 | complete = readb(sabi_iface + SABI_IFACE_COMPLETE); | ||
261 | iface_data = readb(sabi_iface + SABI_IFACE_DATA); | ||
262 | if (complete != 0xaa || iface_data == 0xff) { | ||
263 | pr_warn("SABI get command 0x%02x failed with completion flag 0x%02x and data 0x%02x\n", | ||
264 | command, complete, iface_data); | ||
265 | retval = -EINVAL; | ||
266 | goto exit; | ||
267 | } | ||
268 | /* | ||
269 | * Save off the data into a structure so the caller use it. | ||
270 | * Right now we only want the first 4 bytes, | ||
271 | * There are commands that need more, but not for the ones we | ||
272 | * currently care about. | ||
273 | */ | ||
274 | sretval->retval[0] = readb(sabi_iface + SABI_IFACE_DATA); | ||
275 | sretval->retval[1] = readb(sabi_iface + SABI_IFACE_DATA + 1); | ||
276 | sretval->retval[2] = readb(sabi_iface + SABI_IFACE_DATA + 2); | ||
277 | sretval->retval[3] = readb(sabi_iface + SABI_IFACE_DATA + 3); | ||
278 | |||
279 | exit: | ||
280 | mutex_unlock(&sabi_mutex); | ||
281 | return retval; | ||
282 | |||
283 | } | ||
284 | |||
285 | static int sabi_set_command(u8 command, u8 data) | ||
286 | { | ||
287 | int retval = 0; | ||
288 | u16 port = readw(sabi + sabi_config->header_offsets.port); | ||
289 | u8 complete, iface_data; | ||
290 | |||
291 | mutex_lock(&sabi_mutex); | ||
292 | |||
293 | /* enable memory to be able to write to it */ | ||
294 | outb(readb(sabi + sabi_config->header_offsets.en_mem), port); | ||
295 | |||
296 | /* write out the command */ | ||
297 | writew(sabi_config->main_function, sabi_iface + SABI_IFACE_MAIN); | ||
298 | writew(command, sabi_iface + SABI_IFACE_SUB); | ||
299 | writeb(0, sabi_iface + SABI_IFACE_COMPLETE); | ||
300 | writeb(data, sabi_iface + SABI_IFACE_DATA); | ||
301 | outb(readb(sabi + sabi_config->header_offsets.iface_func), port); | ||
302 | |||
303 | /* write protect memory to make it safe */ | ||
304 | outb(readb(sabi + sabi_config->header_offsets.re_mem), port); | ||
305 | |||
306 | /* see if the command actually succeeded */ | ||
307 | complete = readb(sabi_iface + SABI_IFACE_COMPLETE); | ||
308 | iface_data = readb(sabi_iface + SABI_IFACE_DATA); | ||
309 | if (complete != 0xaa || iface_data == 0xff) { | ||
310 | pr_warn("SABI set command 0x%02x failed with completion flag 0x%02x and data 0x%02x\n", | ||
311 | command, complete, iface_data); | ||
312 | retval = -EINVAL; | ||
313 | } | ||
314 | |||
315 | mutex_unlock(&sabi_mutex); | ||
316 | return retval; | ||
317 | } | ||
318 | |||
319 | static void test_backlight(void) | ||
320 | { | ||
321 | struct sabi_retval sretval; | ||
322 | |||
323 | sabi_get_command(sabi_config->commands.get_backlight, &sretval); | ||
324 | printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]); | ||
325 | |||
326 | sabi_set_command(sabi_config->commands.set_backlight, 0); | ||
327 | printk(KERN_DEBUG "backlight should be off\n"); | ||
328 | |||
329 | sabi_get_command(sabi_config->commands.get_backlight, &sretval); | ||
330 | printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]); | ||
331 | |||
332 | msleep(1000); | ||
333 | |||
334 | sabi_set_command(sabi_config->commands.set_backlight, 1); | ||
335 | printk(KERN_DEBUG "backlight should be on\n"); | ||
336 | |||
337 | sabi_get_command(sabi_config->commands.get_backlight, &sretval); | ||
338 | printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]); | ||
339 | } | ||
340 | |||
341 | static void test_wireless(void) | ||
342 | { | ||
343 | struct sabi_retval sretval; | ||
344 | |||
345 | sabi_get_command(sabi_config->commands.get_wireless_button, &sretval); | ||
346 | printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]); | ||
347 | |||
348 | sabi_set_command(sabi_config->commands.set_wireless_button, 0); | ||
349 | printk(KERN_DEBUG "wireless led should be off\n"); | ||
350 | |||
351 | sabi_get_command(sabi_config->commands.get_wireless_button, &sretval); | ||
352 | printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]); | ||
353 | |||
354 | msleep(1000); | ||
355 | |||
356 | sabi_set_command(sabi_config->commands.set_wireless_button, 1); | ||
357 | printk(KERN_DEBUG "wireless led should be on\n"); | ||
358 | |||
359 | sabi_get_command(sabi_config->commands.get_wireless_button, &sretval); | ||
360 | printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]); | ||
361 | } | ||
362 | |||
363 | static u8 read_brightness(void) | ||
364 | { | ||
365 | struct sabi_retval sretval; | ||
366 | int user_brightness = 0; | ||
367 | int retval; | ||
368 | |||
369 | retval = sabi_get_command(sabi_config->commands.get_brightness, | ||
370 | &sretval); | ||
371 | if (!retval) { | ||
372 | user_brightness = sretval.retval[0]; | ||
373 | if (user_brightness != 0) | ||
374 | user_brightness -= sabi_config->min_brightness; | ||
375 | } | ||
376 | return user_brightness; | ||
377 | } | ||
378 | |||
379 | static void set_brightness(u8 user_brightness) | ||
380 | { | ||
381 | u8 user_level = user_brightness - sabi_config->min_brightness; | ||
382 | |||
383 | sabi_set_command(sabi_config->commands.set_brightness, user_level); | ||
384 | } | ||
385 | |||
386 | static int get_brightness(struct backlight_device *bd) | ||
387 | { | ||
388 | return (int)read_brightness(); | ||
389 | } | ||
390 | |||
391 | static int update_status(struct backlight_device *bd) | ||
392 | { | ||
393 | set_brightness(bd->props.brightness); | ||
394 | |||
395 | if (bd->props.power == FB_BLANK_UNBLANK) | ||
396 | sabi_set_command(sabi_config->commands.set_backlight, 1); | ||
397 | else | ||
398 | sabi_set_command(sabi_config->commands.set_backlight, 0); | ||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | static const struct backlight_ops backlight_ops = { | ||
403 | .get_brightness = get_brightness, | ||
404 | .update_status = update_status, | ||
405 | }; | ||
406 | |||
407 | static int rfkill_set(void *data, bool blocked) | ||
408 | { | ||
409 | /* Do something with blocked...*/ | ||
410 | /* | ||
411 | * blocked == false is on | ||
412 | * blocked == true is off | ||
413 | */ | ||
414 | if (blocked) | ||
415 | sabi_set_command(sabi_config->commands.set_wireless_button, 0); | ||
416 | else | ||
417 | sabi_set_command(sabi_config->commands.set_wireless_button, 1); | ||
418 | |||
419 | return 0; | ||
420 | } | ||
421 | |||
422 | static struct rfkill_ops rfkill_ops = { | ||
423 | .set_block = rfkill_set, | ||
424 | }; | ||
425 | |||
426 | static int init_wireless(struct platform_device *sdev) | ||
427 | { | ||
428 | int retval; | ||
429 | |||
430 | rfk = rfkill_alloc("samsung-wifi", &sdev->dev, RFKILL_TYPE_WLAN, | ||
431 | &rfkill_ops, NULL); | ||
432 | if (!rfk) | ||
433 | return -ENOMEM; | ||
434 | |||
435 | retval = rfkill_register(rfk); | ||
436 | if (retval) { | ||
437 | rfkill_destroy(rfk); | ||
438 | return -ENODEV; | ||
439 | } | ||
440 | |||
441 | return 0; | ||
442 | } | ||
443 | |||
444 | static void destroy_wireless(void) | ||
445 | { | ||
446 | rfkill_unregister(rfk); | ||
447 | rfkill_destroy(rfk); | ||
448 | } | ||
449 | |||
450 | static ssize_t get_performance_level(struct device *dev, | ||
451 | struct device_attribute *attr, char *buf) | ||
452 | { | ||
453 | struct sabi_retval sretval; | ||
454 | int retval; | ||
455 | int i; | ||
456 | |||
457 | /* Read the state */ | ||
458 | retval = sabi_get_command(sabi_config->commands.get_performance_level, | ||
459 | &sretval); | ||
460 | if (retval) | ||
461 | return retval; | ||
462 | |||
463 | /* The logic is backwards, yeah, lots of fun... */ | ||
464 | for (i = 0; sabi_config->performance_levels[i].name; ++i) { | ||
465 | if (sretval.retval[0] == sabi_config->performance_levels[i].value) | ||
466 | return sprintf(buf, "%s\n", sabi_config->performance_levels[i].name); | ||
467 | } | ||
468 | return sprintf(buf, "%s\n", "unknown"); | ||
469 | } | ||
470 | |||
471 | static ssize_t set_performance_level(struct device *dev, | ||
472 | struct device_attribute *attr, const char *buf, | ||
473 | size_t count) | ||
474 | { | ||
475 | if (count >= 1) { | ||
476 | int i; | ||
477 | for (i = 0; sabi_config->performance_levels[i].name; ++i) { | ||
478 | const struct sabi_performance_level *level = | ||
479 | &sabi_config->performance_levels[i]; | ||
480 | if (!strncasecmp(level->name, buf, strlen(level->name))) { | ||
481 | sabi_set_command(sabi_config->commands.set_performance_level, | ||
482 | level->value); | ||
483 | break; | ||
484 | } | ||
485 | } | ||
486 | if (!sabi_config->performance_levels[i].name) | ||
487 | return -EINVAL; | ||
488 | } | ||
489 | return count; | ||
490 | } | ||
491 | static DEVICE_ATTR(performance_level, S_IWUSR | S_IRUGO, | ||
492 | get_performance_level, set_performance_level); | ||
493 | |||
494 | |||
495 | static int __init dmi_check_cb(const struct dmi_system_id *id) | ||
496 | { | ||
497 | pr_info("found laptop model '%s'\n", | ||
498 | id->ident); | ||
499 | return 0; | ||
500 | } | ||
501 | |||
502 | static struct dmi_system_id __initdata samsung_dmi_table[] = { | ||
503 | { | ||
504 | .ident = "N128", | ||
505 | .matches = { | ||
506 | DMI_MATCH(DMI_SYS_VENDOR, | ||
507 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
508 | DMI_MATCH(DMI_PRODUCT_NAME, "N128"), | ||
509 | DMI_MATCH(DMI_BOARD_NAME, "N128"), | ||
510 | }, | ||
511 | .callback = dmi_check_cb, | ||
512 | }, | ||
513 | { | ||
514 | .ident = "N130", | ||
515 | .matches = { | ||
516 | DMI_MATCH(DMI_SYS_VENDOR, | ||
517 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
518 | DMI_MATCH(DMI_PRODUCT_NAME, "N130"), | ||
519 | DMI_MATCH(DMI_BOARD_NAME, "N130"), | ||
520 | }, | ||
521 | .callback = dmi_check_cb, | ||
522 | }, | ||
523 | { | ||
524 | .ident = "X125", | ||
525 | .matches = { | ||
526 | DMI_MATCH(DMI_SYS_VENDOR, | ||
527 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
528 | DMI_MATCH(DMI_PRODUCT_NAME, "X125"), | ||
529 | DMI_MATCH(DMI_BOARD_NAME, "X125"), | ||
530 | }, | ||
531 | .callback = dmi_check_cb, | ||
532 | }, | ||
533 | { | ||
534 | .ident = "X120/X170", | ||
535 | .matches = { | ||
536 | DMI_MATCH(DMI_SYS_VENDOR, | ||
537 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
538 | DMI_MATCH(DMI_PRODUCT_NAME, "X120/X170"), | ||
539 | DMI_MATCH(DMI_BOARD_NAME, "X120/X170"), | ||
540 | }, | ||
541 | .callback = dmi_check_cb, | ||
542 | }, | ||
543 | { | ||
544 | .ident = "NC10", | ||
545 | .matches = { | ||
546 | DMI_MATCH(DMI_SYS_VENDOR, | ||
547 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
548 | DMI_MATCH(DMI_PRODUCT_NAME, "NC10"), | ||
549 | DMI_MATCH(DMI_BOARD_NAME, "NC10"), | ||
550 | }, | ||
551 | .callback = dmi_check_cb, | ||
552 | }, | ||
553 | { | ||
554 | .ident = "NP-Q45", | ||
555 | .matches = { | ||
556 | DMI_MATCH(DMI_SYS_VENDOR, | ||
557 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
558 | DMI_MATCH(DMI_PRODUCT_NAME, "SQ45S70S"), | ||
559 | DMI_MATCH(DMI_BOARD_NAME, "SQ45S70S"), | ||
560 | }, | ||
561 | .callback = dmi_check_cb, | ||
562 | }, | ||
563 | { | ||
564 | .ident = "X360", | ||
565 | .matches = { | ||
566 | DMI_MATCH(DMI_SYS_VENDOR, | ||
567 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
568 | DMI_MATCH(DMI_PRODUCT_NAME, "X360"), | ||
569 | DMI_MATCH(DMI_BOARD_NAME, "X360"), | ||
570 | }, | ||
571 | .callback = dmi_check_cb, | ||
572 | }, | ||
573 | { | ||
574 | .ident = "R410 Plus", | ||
575 | .matches = { | ||
576 | DMI_MATCH(DMI_SYS_VENDOR, | ||
577 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
578 | DMI_MATCH(DMI_PRODUCT_NAME, "R410P"), | ||
579 | DMI_MATCH(DMI_BOARD_NAME, "R460"), | ||
580 | }, | ||
581 | .callback = dmi_check_cb, | ||
582 | }, | ||
583 | { | ||
584 | .ident = "R518", | ||
585 | .matches = { | ||
586 | DMI_MATCH(DMI_SYS_VENDOR, | ||
587 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
588 | DMI_MATCH(DMI_PRODUCT_NAME, "R518"), | ||
589 | DMI_MATCH(DMI_BOARD_NAME, "R518"), | ||
590 | }, | ||
591 | .callback = dmi_check_cb, | ||
592 | }, | ||
593 | { | ||
594 | .ident = "R519/R719", | ||
595 | .matches = { | ||
596 | DMI_MATCH(DMI_SYS_VENDOR, | ||
597 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
598 | DMI_MATCH(DMI_PRODUCT_NAME, "R519/R719"), | ||
599 | DMI_MATCH(DMI_BOARD_NAME, "R519/R719"), | ||
600 | }, | ||
601 | .callback = dmi_check_cb, | ||
602 | }, | ||
603 | { | ||
604 | .ident = "N150/N210/N220/N230", | ||
605 | .matches = { | ||
606 | DMI_MATCH(DMI_SYS_VENDOR, | ||
607 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
608 | DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220/N230"), | ||
609 | DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220/N230"), | ||
610 | }, | ||
611 | .callback = dmi_check_cb, | ||
612 | }, | ||
613 | { | ||
614 | .ident = "N150P/N210P/N220P", | ||
615 | .matches = { | ||
616 | DMI_MATCH(DMI_SYS_VENDOR, | ||
617 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
618 | DMI_MATCH(DMI_PRODUCT_NAME, "N150P/N210P/N220P"), | ||
619 | DMI_MATCH(DMI_BOARD_NAME, "N150P/N210P/N220P"), | ||
620 | }, | ||
621 | .callback = dmi_check_cb, | ||
622 | }, | ||
623 | { | ||
624 | .ident = "R530/R730", | ||
625 | .matches = { | ||
626 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
627 | DMI_MATCH(DMI_PRODUCT_NAME, "R530/R730"), | ||
628 | DMI_MATCH(DMI_BOARD_NAME, "R530/R730"), | ||
629 | }, | ||
630 | .callback = dmi_check_cb, | ||
631 | }, | ||
632 | { | ||
633 | .ident = "NF110/NF210/NF310", | ||
634 | .matches = { | ||
635 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
636 | DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"), | ||
637 | DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"), | ||
638 | }, | ||
639 | .callback = dmi_check_cb, | ||
640 | }, | ||
641 | { | ||
642 | .ident = "N145P/N250P/N260P", | ||
643 | .matches = { | ||
644 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
645 | DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"), | ||
646 | DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"), | ||
647 | }, | ||
648 | .callback = dmi_check_cb, | ||
649 | }, | ||
650 | { | ||
651 | .ident = "R70/R71", | ||
652 | .matches = { | ||
653 | DMI_MATCH(DMI_SYS_VENDOR, | ||
654 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
655 | DMI_MATCH(DMI_PRODUCT_NAME, "R70/R71"), | ||
656 | DMI_MATCH(DMI_BOARD_NAME, "R70/R71"), | ||
657 | }, | ||
658 | .callback = dmi_check_cb, | ||
659 | }, | ||
660 | { | ||
661 | .ident = "P460", | ||
662 | .matches = { | ||
663 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
664 | DMI_MATCH(DMI_PRODUCT_NAME, "P460"), | ||
665 | DMI_MATCH(DMI_BOARD_NAME, "P460"), | ||
666 | }, | ||
667 | .callback = dmi_check_cb, | ||
668 | }, | ||
669 | { }, | ||
670 | }; | ||
671 | MODULE_DEVICE_TABLE(dmi, samsung_dmi_table); | ||
672 | |||
673 | static int find_signature(void __iomem *memcheck, const char *testStr) | ||
674 | { | ||
675 | int i = 0; | ||
676 | int loca; | ||
677 | |||
678 | for (loca = 0; loca < 0xffff; loca++) { | ||
679 | char temp = readb(memcheck + loca); | ||
680 | |||
681 | if (temp == testStr[i]) { | ||
682 | if (i == strlen(testStr)-1) | ||
683 | break; | ||
684 | ++i; | ||
685 | } else { | ||
686 | i = 0; | ||
687 | } | ||
688 | } | ||
689 | return loca; | ||
690 | } | ||
691 | |||
692 | static int __init samsung_init(void) | ||
693 | { | ||
694 | struct backlight_properties props; | ||
695 | struct sabi_retval sretval; | ||
696 | unsigned int ifaceP; | ||
697 | int i; | ||
698 | int loca; | ||
699 | int retval; | ||
700 | |||
701 | mutex_init(&sabi_mutex); | ||
702 | |||
703 | if (!force && !dmi_check_system(samsung_dmi_table)) | ||
704 | return -ENODEV; | ||
705 | |||
706 | f0000_segment = ioremap_nocache(0xf0000, 0xffff); | ||
707 | if (!f0000_segment) { | ||
708 | pr_err("Can't map the segment at 0xf0000\n"); | ||
709 | return -EINVAL; | ||
710 | } | ||
711 | |||
712 | /* Try to find one of the signatures in memory to find the header */ | ||
713 | for (i = 0; sabi_configs[i].test_string != 0; ++i) { | ||
714 | sabi_config = &sabi_configs[i]; | ||
715 | loca = find_signature(f0000_segment, sabi_config->test_string); | ||
716 | if (loca != 0xffff) | ||
717 | break; | ||
718 | } | ||
719 | |||
720 | if (loca == 0xffff) { | ||
721 | pr_err("This computer does not support SABI\n"); | ||
722 | goto error_no_signature; | ||
723 | } | ||
724 | |||
725 | /* point to the SMI port Number */ | ||
726 | loca += 1; | ||
727 | sabi = (f0000_segment + loca); | ||
728 | |||
729 | if (debug) { | ||
730 | printk(KERN_DEBUG "This computer supports SABI==%x\n", | ||
731 | loca + 0xf0000 - 6); | ||
732 | printk(KERN_DEBUG "SABI header:\n"); | ||
733 | printk(KERN_DEBUG " SMI Port Number = 0x%04x\n", | ||
734 | readw(sabi + sabi_config->header_offsets.port)); | ||
735 | printk(KERN_DEBUG " SMI Interface Function = 0x%02x\n", | ||
736 | readb(sabi + sabi_config->header_offsets.iface_func)); | ||
737 | printk(KERN_DEBUG " SMI enable memory buffer = 0x%02x\n", | ||
738 | readb(sabi + sabi_config->header_offsets.en_mem)); | ||
739 | printk(KERN_DEBUG " SMI restore memory buffer = 0x%02x\n", | ||
740 | readb(sabi + sabi_config->header_offsets.re_mem)); | ||
741 | printk(KERN_DEBUG " SABI data offset = 0x%04x\n", | ||
742 | readw(sabi + sabi_config->header_offsets.data_offset)); | ||
743 | printk(KERN_DEBUG " SABI data segment = 0x%04x\n", | ||
744 | readw(sabi + sabi_config->header_offsets.data_segment)); | ||
745 | } | ||
746 | |||
747 | /* Get a pointer to the SABI Interface */ | ||
748 | ifaceP = (readw(sabi + sabi_config->header_offsets.data_segment) & 0x0ffff) << 4; | ||
749 | ifaceP += readw(sabi + sabi_config->header_offsets.data_offset) & 0x0ffff; | ||
750 | sabi_iface = ioremap_nocache(ifaceP, 16); | ||
751 | if (!sabi_iface) { | ||
752 | pr_err("Can't remap %x\n", ifaceP); | ||
753 | goto exit; | ||
754 | } | ||
755 | if (debug) { | ||
756 | printk(KERN_DEBUG "ifaceP = 0x%08x\n", ifaceP); | ||
757 | printk(KERN_DEBUG "sabi_iface = %p\n", sabi_iface); | ||
758 | |||
759 | test_backlight(); | ||
760 | test_wireless(); | ||
761 | |||
762 | retval = sabi_get_command(sabi_config->commands.get_brightness, | ||
763 | &sretval); | ||
764 | printk(KERN_DEBUG "brightness = 0x%02x\n", sretval.retval[0]); | ||
765 | } | ||
766 | |||
767 | /* Turn on "Linux" mode in the BIOS */ | ||
768 | if (sabi_config->commands.set_linux != 0xff) { | ||
769 | retval = sabi_set_command(sabi_config->commands.set_linux, | ||
770 | 0x81); | ||
771 | if (retval) { | ||
772 | pr_warn("Linux mode was not set!\n"); | ||
773 | goto error_no_platform; | ||
774 | } | ||
775 | } | ||
776 | |||
777 | /* knock up a platform device to hang stuff off of */ | ||
778 | sdev = platform_device_register_simple("samsung", -1, NULL, 0); | ||
779 | if (IS_ERR(sdev)) | ||
780 | goto error_no_platform; | ||
781 | |||
782 | /* create a backlight device to talk to this one */ | ||
783 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
784 | props.type = BACKLIGHT_PLATFORM; | ||
785 | props.max_brightness = sabi_config->max_brightness; | ||
786 | backlight_device = backlight_device_register("samsung", &sdev->dev, | ||
787 | NULL, &backlight_ops, | ||
788 | &props); | ||
789 | if (IS_ERR(backlight_device)) | ||
790 | goto error_no_backlight; | ||
791 | |||
792 | backlight_device->props.brightness = read_brightness(); | ||
793 | backlight_device->props.power = FB_BLANK_UNBLANK; | ||
794 | backlight_update_status(backlight_device); | ||
795 | |||
796 | retval = init_wireless(sdev); | ||
797 | if (retval) | ||
798 | goto error_no_rfk; | ||
799 | |||
800 | retval = device_create_file(&sdev->dev, &dev_attr_performance_level); | ||
801 | if (retval) | ||
802 | goto error_file_create; | ||
803 | |||
804 | exit: | ||
805 | return 0; | ||
806 | |||
807 | error_file_create: | ||
808 | destroy_wireless(); | ||
809 | |||
810 | error_no_rfk: | ||
811 | backlight_device_unregister(backlight_device); | ||
812 | |||
813 | error_no_backlight: | ||
814 | platform_device_unregister(sdev); | ||
815 | |||
816 | error_no_platform: | ||
817 | iounmap(sabi_iface); | ||
818 | |||
819 | error_no_signature: | ||
820 | iounmap(f0000_segment); | ||
821 | return -EINVAL; | ||
822 | } | ||
823 | |||
824 | static void __exit samsung_exit(void) | ||
825 | { | ||
826 | /* Turn off "Linux" mode in the BIOS */ | ||
827 | if (sabi_config->commands.set_linux != 0xff) | ||
828 | sabi_set_command(sabi_config->commands.set_linux, 0x80); | ||
829 | |||
830 | device_remove_file(&sdev->dev, &dev_attr_performance_level); | ||
831 | backlight_device_unregister(backlight_device); | ||
832 | destroy_wireless(); | ||
833 | iounmap(sabi_iface); | ||
834 | iounmap(f0000_segment); | ||
835 | platform_device_unregister(sdev); | ||
836 | } | ||
837 | |||
838 | module_init(samsung_init); | ||
839 | module_exit(samsung_exit); | ||
840 | |||
841 | MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@suse.de>"); | ||
842 | MODULE_DESCRIPTION("Samsung Backlight driver"); | ||
843 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/staging/spectra/ffsport.c b/drivers/staging/spectra/ffsport.c index 20dae73d3b78..506547b603e1 100644 --- a/drivers/staging/spectra/ffsport.c +++ b/drivers/staging/spectra/ffsport.c | |||
@@ -653,7 +653,7 @@ static int SBD_setup_device(struct spectra_nand_dev *dev, int which) | |||
653 | } | 653 | } |
654 | dev->queue->queuedata = dev; | 654 | dev->queue->queuedata = dev; |
655 | 655 | ||
656 | /* As Linux block layer does't support >4KB hardware sector, */ | 656 | /* As Linux block layer doesn't support >4KB hardware sector, */ |
657 | /* Here we force report 512 byte hardware sector size to Kernel */ | 657 | /* Here we force report 512 byte hardware sector size to Kernel */ |
658 | blk_queue_logical_block_size(dev->queue, 512); | 658 | blk_queue_logical_block_size(dev->queue, 512); |
659 | 659 | ||
diff --git a/drivers/staging/tidspbridge/dynload/cload.c b/drivers/staging/tidspbridge/dynload/cload.c index 5cecd237e3f6..fe1ef0addb09 100644 --- a/drivers/staging/tidspbridge/dynload/cload.c +++ b/drivers/staging/tidspbridge/dynload/cload.c | |||
@@ -718,7 +718,7 @@ static void dload_symbols(struct dload_state *dlthis) | |||
718 | * as a temporary for .dllview record construction. | 718 | * as a temporary for .dllview record construction. |
719 | * Allocate storage for the whole table. Add 1 to the section count | 719 | * Allocate storage for the whole table. Add 1 to the section count |
720 | * in case a trampoline section is auto-generated as well as the | 720 | * in case a trampoline section is auto-generated as well as the |
721 | * size of the trampoline section name so DLLView does't get lost. | 721 | * size of the trampoline section name so DLLView doesn't get lost. |
722 | */ | 722 | */ |
723 | 723 | ||
724 | siz = sym_count * sizeof(struct local_symbol); | 724 | siz = sym_count * sizeof(struct local_symbol); |
diff --git a/drivers/staging/tty/specialix.c b/drivers/staging/tty/specialix.c index cb24c6d999db..5c3598ec7456 100644 --- a/drivers/staging/tty/specialix.c +++ b/drivers/staging/tty/specialix.c | |||
@@ -978,7 +978,7 @@ static void sx_change_speed(struct specialix_board *bp, | |||
978 | spin_lock_irqsave(&bp->lock, flags); | 978 | spin_lock_irqsave(&bp->lock, flags); |
979 | sx_out(bp, CD186x_CAR, port_No(port)); | 979 | sx_out(bp, CD186x_CAR, port_No(port)); |
980 | 980 | ||
981 | /* The Specialix board does't implement the RTS lines. | 981 | /* The Specialix board doesn't implement the RTS lines. |
982 | They are used to set the IRQ level. Don't touch them. */ | 982 | They are used to set the IRQ level. Don't touch them. */ |
983 | if (sx_crtscts(tty)) | 983 | if (sx_crtscts(tty)) |
984 | port->MSVR = MSVR_DTR | (sx_in(bp, CD186x_MSVR) & MSVR_RTS); | 984 | port->MSVR = MSVR_DTR | (sx_in(bp, CD186x_MSVR) & MSVR_RTS); |
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 47f8cdb207f1..74273e638c0d 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
@@ -1658,8 +1658,12 @@ static void gsm_queue(struct gsm_mux *gsm) | |||
1658 | 1658 | ||
1659 | if ((gsm->control & ~PF) == UI) | 1659 | if ((gsm->control & ~PF) == UI) |
1660 | gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, gsm->len); | 1660 | gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, gsm->len); |
1661 | /* generate final CRC with received FCS */ | 1661 | if (gsm->encoding == 0){ |
1662 | gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs); | 1662 | /* WARNING: gsm->received_fcs is used for gsm->encoding = 0 only. |
1663 | In this case it contain the last piece of data | ||
1664 | required to generate final CRC */ | ||
1665 | gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs); | ||
1666 | } | ||
1663 | if (gsm->fcs != GOOD_FCS) { | 1667 | if (gsm->fcs != GOOD_FCS) { |
1664 | gsm->bad_fcs++; | 1668 | gsm->bad_fcs++; |
1665 | if (debug & 4) | 1669 | if (debug & 4) |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index cb36b0d4ef3c..62df72d9f0aa 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -382,12 +382,13 @@ static void imx_start_tx(struct uart_port *port) | |||
382 | static irqreturn_t imx_rtsint(int irq, void *dev_id) | 382 | static irqreturn_t imx_rtsint(int irq, void *dev_id) |
383 | { | 383 | { |
384 | struct imx_port *sport = dev_id; | 384 | struct imx_port *sport = dev_id; |
385 | unsigned int val = readl(sport->port.membase + USR1) & USR1_RTSS; | 385 | unsigned int val; |
386 | unsigned long flags; | 386 | unsigned long flags; |
387 | 387 | ||
388 | spin_lock_irqsave(&sport->port.lock, flags); | 388 | spin_lock_irqsave(&sport->port.lock, flags); |
389 | 389 | ||
390 | writel(USR1_RTSD, sport->port.membase + USR1); | 390 | writel(USR1_RTSD, sport->port.membase + USR1); |
391 | val = readl(sport->port.membase + USR1) & USR1_RTSS; | ||
391 | uart_handle_cts_change(&sport->port, !!val); | 392 | uart_handle_cts_change(&sport->port, !!val); |
392 | wake_up_interruptible(&sport->port.state->port.delta_msr_wait); | 393 | wake_up_interruptible(&sport->port.state->port.delta_msr_wait); |
393 | 394 | ||
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 41b6e51188e4..006489d82dc3 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -66,6 +66,7 @@ config USB_ARCH_HAS_EHCI | |||
66 | default y if ARCH_VT8500 | 66 | default y if ARCH_VT8500 |
67 | default y if PLAT_SPEAR | 67 | default y if PLAT_SPEAR |
68 | default y if ARCH_MSM | 68 | default y if ARCH_MSM |
69 | default y if MICROBLAZE | ||
69 | default PCI | 70 | default PCI |
70 | 71 | ||
71 | # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface. | 72 | # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface. |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index a3d2e2399655..96fdfb815f89 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -221,7 +221,7 @@ static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end, | |||
221 | break; | 221 | break; |
222 | case USB_ENDPOINT_XFER_INT: | 222 | case USB_ENDPOINT_XFER_INT: |
223 | type = "Int."; | 223 | type = "Int."; |
224 | if (speed == USB_SPEED_HIGH) | 224 | if (speed == USB_SPEED_HIGH || speed == USB_SPEED_SUPER) |
225 | interval = 1 << (desc->bInterval - 1); | 225 | interval = 1 << (desc->bInterval - 1); |
226 | else | 226 | else |
227 | interval = desc->bInterval; | 227 | interval = desc->bInterval; |
@@ -229,7 +229,8 @@ static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end, | |||
229 | default: /* "can't happen" */ | 229 | default: /* "can't happen" */ |
230 | return start; | 230 | return start; |
231 | } | 231 | } |
232 | interval *= (speed == USB_SPEED_HIGH) ? 125 : 1000; | 232 | interval *= (speed == USB_SPEED_HIGH || |
233 | speed == USB_SPEED_SUPER) ? 125 : 1000; | ||
233 | if (interval % 1000) | 234 | if (interval % 1000) |
234 | unit = 'u'; | 235 | unit = 'u'; |
235 | else { | 236 | else { |
@@ -542,8 +543,9 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, | |||
542 | if (level == 0) { | 543 | if (level == 0) { |
543 | int max; | 544 | int max; |
544 | 545 | ||
545 | /* high speed reserves 80%, full/low reserves 90% */ | 546 | /* super/high speed reserves 80%, full/low reserves 90% */ |
546 | if (usbdev->speed == USB_SPEED_HIGH) | 547 | if (usbdev->speed == USB_SPEED_HIGH || |
548 | usbdev->speed == USB_SPEED_SUPER) | ||
547 | max = 800; | 549 | max = 800; |
548 | else | 550 | else |
549 | max = FRAME_TIME_MAX_USECS_ALLOC; | 551 | max = FRAME_TIME_MAX_USECS_ALLOC; |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 8eed05d23838..77a7faec8d78 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1908,7 +1908,7 @@ void usb_free_streams(struct usb_interface *interface, | |||
1908 | 1908 | ||
1909 | /* Streams only apply to bulk endpoints. */ | 1909 | /* Streams only apply to bulk endpoints. */ |
1910 | for (i = 0; i < num_eps; i++) | 1910 | for (i = 0; i < num_eps; i++) |
1911 | if (!usb_endpoint_xfer_bulk(&eps[i]->desc)) | 1911 | if (!eps[i] || !usb_endpoint_xfer_bulk(&eps[i]->desc)) |
1912 | return; | 1912 | return; |
1913 | 1913 | ||
1914 | hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags); | 1914 | hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 8fb754916c67..93720bdc9efd 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -2285,7 +2285,17 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) | |||
2285 | } | 2285 | } |
2286 | 2286 | ||
2287 | /* see 7.1.7.6 */ | 2287 | /* see 7.1.7.6 */ |
2288 | status = set_port_feature(hub->hdev, port1, USB_PORT_FEAT_SUSPEND); | 2288 | /* Clear PORT_POWER if it's a USB3.0 device connected to USB 3.0 |
2289 | * external hub. | ||
2290 | * FIXME: this is a temporary workaround to make the system able | ||
2291 | * to suspend/resume. | ||
2292 | */ | ||
2293 | if ((hub->hdev->parent != NULL) && hub_is_superspeed(hub->hdev)) | ||
2294 | status = clear_port_feature(hub->hdev, port1, | ||
2295 | USB_PORT_FEAT_POWER); | ||
2296 | else | ||
2297 | status = set_port_feature(hub->hdev, port1, | ||
2298 | USB_PORT_FEAT_SUSPEND); | ||
2289 | if (status) { | 2299 | if (status) { |
2290 | dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n", | 2300 | dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n", |
2291 | port1, status); | 2301 | port1, status); |
diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c index 9abecfddb27d..0111f8a9cf7f 100644 --- a/drivers/usb/gadget/f_audio.c +++ b/drivers/usb/gadget/f_audio.c | |||
@@ -706,6 +706,7 @@ f_audio_unbind(struct usb_configuration *c, struct usb_function *f) | |||
706 | struct f_audio *audio = func_to_audio(f); | 706 | struct f_audio *audio = func_to_audio(f); |
707 | 707 | ||
708 | usb_free_descriptors(f->descriptors); | 708 | usb_free_descriptors(f->descriptors); |
709 | usb_free_descriptors(f->hs_descriptors); | ||
709 | kfree(audio); | 710 | kfree(audio); |
710 | } | 711 | } |
711 | 712 | ||
diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c index 95dd4662d6a8..b3c304290150 100644 --- a/drivers/usb/gadget/f_eem.c +++ b/drivers/usb/gadget/f_eem.c | |||
@@ -314,6 +314,9 @@ eem_unbind(struct usb_configuration *c, struct usb_function *f) | |||
314 | 314 | ||
315 | static void eem_cmd_complete(struct usb_ep *ep, struct usb_request *req) | 315 | static void eem_cmd_complete(struct usb_ep *ep, struct usb_request *req) |
316 | { | 316 | { |
317 | struct sk_buff *skb = (struct sk_buff *)req->context; | ||
318 | |||
319 | dev_kfree_skb_any(skb); | ||
317 | } | 320 | } |
318 | 321 | ||
319 | /* | 322 | /* |
@@ -428,10 +431,11 @@ static int eem_unwrap(struct gether *port, | |||
428 | skb_trim(skb2, len); | 431 | skb_trim(skb2, len); |
429 | put_unaligned_le16(BIT(15) | BIT(11) | len, | 432 | put_unaligned_le16(BIT(15) | BIT(11) | len, |
430 | skb_push(skb2, 2)); | 433 | skb_push(skb2, 2)); |
431 | skb_copy_bits(skb, 0, req->buf, skb->len); | 434 | skb_copy_bits(skb2, 0, req->buf, skb2->len); |
432 | req->length = skb->len; | 435 | req->length = skb2->len; |
433 | req->complete = eem_cmd_complete; | 436 | req->complete = eem_cmd_complete; |
434 | req->zero = 1; | 437 | req->zero = 1; |
438 | req->context = skb2; | ||
435 | if (usb_ep_queue(port->in_ep, req, GFP_ATOMIC)) | 439 | if (usb_ep_queue(port->in_ep, req, GFP_ATOMIC)) |
436 | DBG(cdev, "echo response queue fail\n"); | 440 | DBG(cdev, "echo response queue fail\n"); |
437 | break; | 441 | break; |
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c index aee7e3c53c38..36613b37c504 100644 --- a/drivers/usb/gadget/fsl_qe_udc.c +++ b/drivers/usb/gadget/fsl_qe_udc.c | |||
@@ -1148,6 +1148,12 @@ static int qe_ep_tx(struct qe_ep *ep, struct qe_frame *frame) | |||
1148 | static int txcomplete(struct qe_ep *ep, unsigned char restart) | 1148 | static int txcomplete(struct qe_ep *ep, unsigned char restart) |
1149 | { | 1149 | { |
1150 | if (ep->tx_req != NULL) { | 1150 | if (ep->tx_req != NULL) { |
1151 | struct qe_req *req = ep->tx_req; | ||
1152 | unsigned zlp = 0, last_len = 0; | ||
1153 | |||
1154 | last_len = min_t(unsigned, req->req.length - ep->sent, | ||
1155 | ep->ep.maxpacket); | ||
1156 | |||
1151 | if (!restart) { | 1157 | if (!restart) { |
1152 | int asent = ep->last; | 1158 | int asent = ep->last; |
1153 | ep->sent += asent; | 1159 | ep->sent += asent; |
@@ -1156,9 +1162,18 @@ static int txcomplete(struct qe_ep *ep, unsigned char restart) | |||
1156 | ep->last = 0; | 1162 | ep->last = 0; |
1157 | } | 1163 | } |
1158 | 1164 | ||
1165 | /* zlp needed when req->re.zero is set */ | ||
1166 | if (req->req.zero) { | ||
1167 | if (last_len == 0 || | ||
1168 | (req->req.length % ep->ep.maxpacket) != 0) | ||
1169 | zlp = 0; | ||
1170 | else | ||
1171 | zlp = 1; | ||
1172 | } else | ||
1173 | zlp = 0; | ||
1174 | |||
1159 | /* a request already were transmitted completely */ | 1175 | /* a request already were transmitted completely */ |
1160 | if ((ep->tx_req->req.length - ep->sent) <= 0) { | 1176 | if (((ep->tx_req->req.length - ep->sent) <= 0) && !zlp) { |
1161 | ep->tx_req->req.actual = (unsigned int)ep->sent; | ||
1162 | done(ep, ep->tx_req, 0); | 1177 | done(ep, ep->tx_req, 0); |
1163 | ep->tx_req = NULL; | 1178 | ep->tx_req = NULL; |
1164 | ep->last = 0; | 1179 | ep->last = 0; |
@@ -1191,6 +1206,7 @@ static int qe_usb_senddata(struct qe_ep *ep, struct qe_frame *frame) | |||
1191 | buf = (u8 *)ep->tx_req->req.buf + ep->sent; | 1206 | buf = (u8 *)ep->tx_req->req.buf + ep->sent; |
1192 | if (buf && size) { | 1207 | if (buf && size) { |
1193 | ep->last = size; | 1208 | ep->last = size; |
1209 | ep->tx_req->req.actual += size; | ||
1194 | frame_set_data(frame, buf); | 1210 | frame_set_data(frame, buf); |
1195 | frame_set_length(frame, size); | 1211 | frame_set_length(frame, size); |
1196 | frame_set_status(frame, FRAME_OK); | 1212 | frame_set_status(frame, FRAME_OK); |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 3ed73f49cf18..a01383f71f38 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -386,8 +386,10 @@ ep_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
386 | 386 | ||
387 | /* halt any endpoint by doing a "wrong direction" i/o call */ | 387 | /* halt any endpoint by doing a "wrong direction" i/o call */ |
388 | if (usb_endpoint_dir_in(&data->desc)) { | 388 | if (usb_endpoint_dir_in(&data->desc)) { |
389 | if (usb_endpoint_xfer_isoc(&data->desc)) | 389 | if (usb_endpoint_xfer_isoc(&data->desc)) { |
390 | mutex_unlock(&data->lock); | ||
390 | return -EINVAL; | 391 | return -EINVAL; |
392 | } | ||
391 | DBG (data->dev, "%s halt\n", data->name); | 393 | DBG (data->dev, "%s halt\n", data->name); |
392 | spin_lock_irq (&data->dev->lock); | 394 | spin_lock_irq (&data->dev->lock); |
393 | if (likely (data->ep != NULL)) | 395 | if (likely (data->ep != NULL)) |
diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c index 3e4b35e50c24..68dbcc3e4cc2 100644 --- a/drivers/usb/gadget/pch_udc.c +++ b/drivers/usb/gadget/pch_udc.c | |||
@@ -1608,7 +1608,7 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq, | |||
1608 | return -EINVAL; | 1608 | return -EINVAL; |
1609 | if (!dev->driver || (dev->gadget.speed == USB_SPEED_UNKNOWN)) | 1609 | if (!dev->driver || (dev->gadget.speed == USB_SPEED_UNKNOWN)) |
1610 | return -ESHUTDOWN; | 1610 | return -ESHUTDOWN; |
1611 | spin_lock_irqsave(&ep->dev->lock, iflags); | 1611 | spin_lock_irqsave(&dev->lock, iflags); |
1612 | /* map the buffer for dma */ | 1612 | /* map the buffer for dma */ |
1613 | if (usbreq->length && | 1613 | if (usbreq->length && |
1614 | ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { | 1614 | ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { |
@@ -1625,8 +1625,10 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq, | |||
1625 | DMA_FROM_DEVICE); | 1625 | DMA_FROM_DEVICE); |
1626 | } else { | 1626 | } else { |
1627 | req->buf = kzalloc(usbreq->length, GFP_ATOMIC); | 1627 | req->buf = kzalloc(usbreq->length, GFP_ATOMIC); |
1628 | if (!req->buf) | 1628 | if (!req->buf) { |
1629 | return -ENOMEM; | 1629 | retval = -ENOMEM; |
1630 | goto probe_end; | ||
1631 | } | ||
1630 | if (ep->in) { | 1632 | if (ep->in) { |
1631 | memcpy(req->buf, usbreq->buf, usbreq->length); | 1633 | memcpy(req->buf, usbreq->buf, usbreq->length); |
1632 | req->dma = dma_map_single(&dev->pdev->dev, | 1634 | req->dma = dma_map_single(&dev->pdev->dev, |
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 015118535f77..6dcc1f68fa60 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c | |||
@@ -1083,7 +1083,9 @@ static void irq_device_state(struct r8a66597 *r8a66597) | |||
1083 | 1083 | ||
1084 | if (dvsq == DS_DFLT) { | 1084 | if (dvsq == DS_DFLT) { |
1085 | /* bus reset */ | 1085 | /* bus reset */ |
1086 | spin_unlock(&r8a66597->lock); | ||
1086 | r8a66597->driver->disconnect(&r8a66597->gadget); | 1087 | r8a66597->driver->disconnect(&r8a66597->gadget); |
1088 | spin_lock(&r8a66597->lock); | ||
1087 | r8a66597_update_usb_speed(r8a66597); | 1089 | r8a66597_update_usb_speed(r8a66597); |
1088 | } | 1090 | } |
1089 | if (r8a66597->old_dvsq == DS_CNFG && dvsq != DS_CNFG) | 1091 | if (r8a66597->old_dvsq == DS_CNFG && dvsq != DS_CNFG) |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 98ded66e8d3f..42abd0f603bf 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -1247,24 +1247,27 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
1247 | 1247 | ||
1248 | static void scan_async (struct ehci_hcd *ehci) | 1248 | static void scan_async (struct ehci_hcd *ehci) |
1249 | { | 1249 | { |
1250 | bool stopped; | ||
1250 | struct ehci_qh *qh; | 1251 | struct ehci_qh *qh; |
1251 | enum ehci_timer_action action = TIMER_IO_WATCHDOG; | 1252 | enum ehci_timer_action action = TIMER_IO_WATCHDOG; |
1252 | 1253 | ||
1253 | ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index); | 1254 | ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index); |
1254 | timer_action_done (ehci, TIMER_ASYNC_SHRINK); | 1255 | timer_action_done (ehci, TIMER_ASYNC_SHRINK); |
1255 | rescan: | 1256 | rescan: |
1257 | stopped = !HC_IS_RUNNING(ehci_to_hcd(ehci)->state); | ||
1256 | qh = ehci->async->qh_next.qh; | 1258 | qh = ehci->async->qh_next.qh; |
1257 | if (likely (qh != NULL)) { | 1259 | if (likely (qh != NULL)) { |
1258 | do { | 1260 | do { |
1259 | /* clean any finished work for this qh */ | 1261 | /* clean any finished work for this qh */ |
1260 | if (!list_empty (&qh->qtd_list) | 1262 | if (!list_empty(&qh->qtd_list) && (stopped || |
1261 | && qh->stamp != ehci->stamp) { | 1263 | qh->stamp != ehci->stamp)) { |
1262 | int temp; | 1264 | int temp; |
1263 | 1265 | ||
1264 | /* unlinks could happen here; completion | 1266 | /* unlinks could happen here; completion |
1265 | * reporting drops the lock. rescan using | 1267 | * reporting drops the lock. rescan using |
1266 | * the latest schedule, but don't rescan | 1268 | * the latest schedule, but don't rescan |
1267 | * qhs we already finished (no looping). | 1269 | * qhs we already finished (no looping) |
1270 | * unless the controller is stopped. | ||
1268 | */ | 1271 | */ |
1269 | qh = qh_get (qh); | 1272 | qh = qh_get (qh); |
1270 | qh->stamp = ehci->stamp; | 1273 | qh->stamp = ehci->stamp; |
@@ -1285,9 +1288,9 @@ rescan: | |||
1285 | */ | 1288 | */ |
1286 | if (list_empty(&qh->qtd_list) | 1289 | if (list_empty(&qh->qtd_list) |
1287 | && qh->qh_state == QH_STATE_LINKED) { | 1290 | && qh->qh_state == QH_STATE_LINKED) { |
1288 | if (!ehci->reclaim | 1291 | if (!ehci->reclaim && (stopped || |
1289 | && ((ehci->stamp - qh->stamp) & 0x1fff) | 1292 | ((ehci->stamp - qh->stamp) & 0x1fff) |
1290 | >= (EHCI_SHRINK_FRAMES * 8)) | 1293 | >= EHCI_SHRINK_FRAMES * 8)) |
1291 | start_unlink_async(ehci, qh); | 1294 | start_unlink_async(ehci, qh); |
1292 | else | 1295 | else |
1293 | action = TIMER_ASYNC_SHRINK; | 1296 | action = TIMER_ASYNC_SHRINK; |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index f50e84ac570a..795345ad45e6 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -295,7 +295,7 @@ static void alloc_mem(struct usb_hcd *hcd, struct isp1760_qtd *qtd) | |||
295 | } | 295 | } |
296 | 296 | ||
297 | dev_err(hcd->self.controller, | 297 | dev_err(hcd->self.controller, |
298 | "%s: Can not allocate %lu bytes of memory\n" | 298 | "%s: Cannot allocate %zu bytes of memory\n" |
299 | "Current memory map:\n", | 299 | "Current memory map:\n", |
300 | __func__, qtd->length); | 300 | __func__, qtd->length); |
301 | for (i = 0; i < BLOCKS; i++) { | 301 | for (i = 0; i < BLOCKS; i++) { |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 17a6043c1fa0..958d985f2951 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | #ifdef __LITTLE_ENDIAN | 34 | #ifdef __LITTLE_ENDIAN |
35 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C) | 35 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C) |
36 | #elif __BIG_ENDIAN | 36 | #elif defined(__BIG_ENDIAN) |
37 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C | \ | 37 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C | \ |
38 | USBH_ENABLE_BE) | 38 | USBH_ENABLE_BE) |
39 | #else | 39 | #else |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 1d586d4f7b56..9b166d70ae91 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -84,65 +84,92 @@ int usb_amd_find_chipset_info(void) | |||
84 | { | 84 | { |
85 | u8 rev = 0; | 85 | u8 rev = 0; |
86 | unsigned long flags; | 86 | unsigned long flags; |
87 | struct amd_chipset_info info; | ||
88 | int ret; | ||
87 | 89 | ||
88 | spin_lock_irqsave(&amd_lock, flags); | 90 | spin_lock_irqsave(&amd_lock, flags); |
89 | 91 | ||
90 | amd_chipset.probe_count++; | ||
91 | /* probe only once */ | 92 | /* probe only once */ |
92 | if (amd_chipset.probe_count > 1) { | 93 | if (amd_chipset.probe_count > 0) { |
94 | amd_chipset.probe_count++; | ||
93 | spin_unlock_irqrestore(&amd_lock, flags); | 95 | spin_unlock_irqrestore(&amd_lock, flags); |
94 | return amd_chipset.probe_result; | 96 | return amd_chipset.probe_result; |
95 | } | 97 | } |
98 | memset(&info, 0, sizeof(info)); | ||
99 | spin_unlock_irqrestore(&amd_lock, flags); | ||
96 | 100 | ||
97 | amd_chipset.smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); | 101 | info.smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); |
98 | if (amd_chipset.smbus_dev) { | 102 | if (info.smbus_dev) { |
99 | rev = amd_chipset.smbus_dev->revision; | 103 | rev = info.smbus_dev->revision; |
100 | if (rev >= 0x40) | 104 | if (rev >= 0x40) |
101 | amd_chipset.sb_type = 1; | 105 | info.sb_type = 1; |
102 | else if (rev >= 0x30 && rev <= 0x3b) | 106 | else if (rev >= 0x30 && rev <= 0x3b) |
103 | amd_chipset.sb_type = 3; | 107 | info.sb_type = 3; |
104 | } else { | 108 | } else { |
105 | amd_chipset.smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, | 109 | info.smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, |
106 | 0x780b, NULL); | 110 | 0x780b, NULL); |
107 | if (!amd_chipset.smbus_dev) { | 111 | if (!info.smbus_dev) { |
108 | spin_unlock_irqrestore(&amd_lock, flags); | 112 | ret = 0; |
109 | return 0; | 113 | goto commit; |
110 | } | 114 | } |
111 | rev = amd_chipset.smbus_dev->revision; | 115 | |
116 | rev = info.smbus_dev->revision; | ||
112 | if (rev >= 0x11 && rev <= 0x18) | 117 | if (rev >= 0x11 && rev <= 0x18) |
113 | amd_chipset.sb_type = 2; | 118 | info.sb_type = 2; |
114 | } | 119 | } |
115 | 120 | ||
116 | if (amd_chipset.sb_type == 0) { | 121 | if (info.sb_type == 0) { |
117 | if (amd_chipset.smbus_dev) { | 122 | if (info.smbus_dev) { |
118 | pci_dev_put(amd_chipset.smbus_dev); | 123 | pci_dev_put(info.smbus_dev); |
119 | amd_chipset.smbus_dev = NULL; | 124 | info.smbus_dev = NULL; |
120 | } | 125 | } |
121 | spin_unlock_irqrestore(&amd_lock, flags); | 126 | ret = 0; |
122 | return 0; | 127 | goto commit; |
123 | } | 128 | } |
124 | 129 | ||
125 | amd_chipset.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x9601, NULL); | 130 | info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x9601, NULL); |
126 | if (amd_chipset.nb_dev) { | 131 | if (info.nb_dev) { |
127 | amd_chipset.nb_type = 1; | 132 | info.nb_type = 1; |
128 | } else { | 133 | } else { |
129 | amd_chipset.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, | 134 | info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL); |
130 | 0x1510, NULL); | 135 | if (info.nb_dev) { |
131 | if (amd_chipset.nb_dev) { | 136 | info.nb_type = 2; |
132 | amd_chipset.nb_type = 2; | 137 | } else { |
133 | } else { | 138 | info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, |
134 | amd_chipset.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, | 139 | 0x9600, NULL); |
135 | 0x9600, NULL); | 140 | if (info.nb_dev) |
136 | if (amd_chipset.nb_dev) | 141 | info.nb_type = 3; |
137 | amd_chipset.nb_type = 3; | ||
138 | } | 142 | } |
139 | } | 143 | } |
140 | 144 | ||
141 | amd_chipset.probe_result = 1; | 145 | ret = info.probe_result = 1; |
142 | printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n"); | 146 | printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n"); |
143 | 147 | ||
144 | spin_unlock_irqrestore(&amd_lock, flags); | 148 | commit: |
145 | return amd_chipset.probe_result; | 149 | |
150 | spin_lock_irqsave(&amd_lock, flags); | ||
151 | if (amd_chipset.probe_count > 0) { | ||
152 | /* race - someone else was faster - drop devices */ | ||
153 | |||
154 | /* Mark that we where here */ | ||
155 | amd_chipset.probe_count++; | ||
156 | ret = amd_chipset.probe_result; | ||
157 | |||
158 | spin_unlock_irqrestore(&amd_lock, flags); | ||
159 | |||
160 | if (info.nb_dev) | ||
161 | pci_dev_put(info.nb_dev); | ||
162 | if (info.smbus_dev) | ||
163 | pci_dev_put(info.smbus_dev); | ||
164 | |||
165 | } else { | ||
166 | /* no race - commit the result */ | ||
167 | info.probe_count++; | ||
168 | amd_chipset = info; | ||
169 | spin_unlock_irqrestore(&amd_lock, flags); | ||
170 | } | ||
171 | |||
172 | return ret; | ||
146 | } | 173 | } |
147 | EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info); | 174 | EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info); |
148 | 175 | ||
@@ -284,6 +311,7 @@ EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_enable); | |||
284 | 311 | ||
285 | void usb_amd_dev_put(void) | 312 | void usb_amd_dev_put(void) |
286 | { | 313 | { |
314 | struct pci_dev *nb, *smbus; | ||
287 | unsigned long flags; | 315 | unsigned long flags; |
288 | 316 | ||
289 | spin_lock_irqsave(&amd_lock, flags); | 317 | spin_lock_irqsave(&amd_lock, flags); |
@@ -294,20 +322,23 @@ void usb_amd_dev_put(void) | |||
294 | return; | 322 | return; |
295 | } | 323 | } |
296 | 324 | ||
297 | if (amd_chipset.nb_dev) { | 325 | /* save them to pci_dev_put outside of spinlock */ |
298 | pci_dev_put(amd_chipset.nb_dev); | 326 | nb = amd_chipset.nb_dev; |
299 | amd_chipset.nb_dev = NULL; | 327 | smbus = amd_chipset.smbus_dev; |
300 | } | 328 | |
301 | if (amd_chipset.smbus_dev) { | 329 | amd_chipset.nb_dev = NULL; |
302 | pci_dev_put(amd_chipset.smbus_dev); | 330 | amd_chipset.smbus_dev = NULL; |
303 | amd_chipset.smbus_dev = NULL; | ||
304 | } | ||
305 | amd_chipset.nb_type = 0; | 331 | amd_chipset.nb_type = 0; |
306 | amd_chipset.sb_type = 0; | 332 | amd_chipset.sb_type = 0; |
307 | amd_chipset.isoc_reqs = 0; | 333 | amd_chipset.isoc_reqs = 0; |
308 | amd_chipset.probe_result = 0; | 334 | amd_chipset.probe_result = 0; |
309 | 335 | ||
310 | spin_unlock_irqrestore(&amd_lock, flags); | 336 | spin_unlock_irqrestore(&amd_lock, flags); |
337 | |||
338 | if (nb) | ||
339 | pci_dev_put(nb); | ||
340 | if (smbus) | ||
341 | pci_dev_put(smbus); | ||
311 | } | 342 | } |
312 | EXPORT_SYMBOL_GPL(usb_amd_dev_put); | 343 | EXPORT_SYMBOL_GPL(usb_amd_dev_put); |
313 | 344 | ||
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index a003e79aacdc..627f3438028c 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -846,7 +846,7 @@ static u32 xhci_find_real_port_number(struct xhci_hcd *xhci, | |||
846 | * Skip ports that don't have known speeds, or have duplicate | 846 | * Skip ports that don't have known speeds, or have duplicate |
847 | * Extended Capabilities port speed entries. | 847 | * Extended Capabilities port speed entries. |
848 | */ | 848 | */ |
849 | if (port_speed == 0 || port_speed == -1) | 849 | if (port_speed == 0 || port_speed == DUPLICATE_ENTRY) |
850 | continue; | 850 | continue; |
851 | 851 | ||
852 | /* | 852 | /* |
@@ -974,6 +974,47 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud | |||
974 | return 0; | 974 | return 0; |
975 | } | 975 | } |
976 | 976 | ||
977 | /* | ||
978 | * Convert interval expressed as 2^(bInterval - 1) == interval into | ||
979 | * straight exponent value 2^n == interval. | ||
980 | * | ||
981 | */ | ||
982 | static unsigned int xhci_parse_exponent_interval(struct usb_device *udev, | ||
983 | struct usb_host_endpoint *ep) | ||
984 | { | ||
985 | unsigned int interval; | ||
986 | |||
987 | interval = clamp_val(ep->desc.bInterval, 1, 16) - 1; | ||
988 | if (interval != ep->desc.bInterval - 1) | ||
989 | dev_warn(&udev->dev, | ||
990 | "ep %#x - rounding interval to %d microframes\n", | ||
991 | ep->desc.bEndpointAddress, | ||
992 | 1 << interval); | ||
993 | |||
994 | return interval; | ||
995 | } | ||
996 | |||
997 | /* | ||
998 | * Convert bInterval expressed in frames (in 1-255 range) to exponent of | ||
999 | * microframes, rounded down to nearest power of 2. | ||
1000 | */ | ||
1001 | static unsigned int xhci_parse_frame_interval(struct usb_device *udev, | ||
1002 | struct usb_host_endpoint *ep) | ||
1003 | { | ||
1004 | unsigned int interval; | ||
1005 | |||
1006 | interval = fls(8 * ep->desc.bInterval) - 1; | ||
1007 | interval = clamp_val(interval, 3, 10); | ||
1008 | if ((1 << interval) != 8 * ep->desc.bInterval) | ||
1009 | dev_warn(&udev->dev, | ||
1010 | "ep %#x - rounding interval to %d microframes, ep desc says %d microframes\n", | ||
1011 | ep->desc.bEndpointAddress, | ||
1012 | 1 << interval, | ||
1013 | 8 * ep->desc.bInterval); | ||
1014 | |||
1015 | return interval; | ||
1016 | } | ||
1017 | |||
977 | /* Return the polling or NAK interval. | 1018 | /* Return the polling or NAK interval. |
978 | * | 1019 | * |
979 | * The polling interval is expressed in "microframes". If xHCI's Interval field | 1020 | * The polling interval is expressed in "microframes". If xHCI's Interval field |
@@ -982,7 +1023,7 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud | |||
982 | * The NAK interval is one NAK per 1 to 255 microframes, or no NAKs if interval | 1023 | * The NAK interval is one NAK per 1 to 255 microframes, or no NAKs if interval |
983 | * is set to 0. | 1024 | * is set to 0. |
984 | */ | 1025 | */ |
985 | static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, | 1026 | static unsigned int xhci_get_endpoint_interval(struct usb_device *udev, |
986 | struct usb_host_endpoint *ep) | 1027 | struct usb_host_endpoint *ep) |
987 | { | 1028 | { |
988 | unsigned int interval = 0; | 1029 | unsigned int interval = 0; |
@@ -991,45 +1032,38 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, | |||
991 | case USB_SPEED_HIGH: | 1032 | case USB_SPEED_HIGH: |
992 | /* Max NAK rate */ | 1033 | /* Max NAK rate */ |
993 | if (usb_endpoint_xfer_control(&ep->desc) || | 1034 | if (usb_endpoint_xfer_control(&ep->desc) || |
994 | usb_endpoint_xfer_bulk(&ep->desc)) | 1035 | usb_endpoint_xfer_bulk(&ep->desc)) { |
995 | interval = ep->desc.bInterval; | 1036 | interval = ep->desc.bInterval; |
1037 | break; | ||
1038 | } | ||
996 | /* Fall through - SS and HS isoc/int have same decoding */ | 1039 | /* Fall through - SS and HS isoc/int have same decoding */ |
1040 | |||
997 | case USB_SPEED_SUPER: | 1041 | case USB_SPEED_SUPER: |
998 | if (usb_endpoint_xfer_int(&ep->desc) || | 1042 | if (usb_endpoint_xfer_int(&ep->desc) || |
999 | usb_endpoint_xfer_isoc(&ep->desc)) { | 1043 | usb_endpoint_xfer_isoc(&ep->desc)) { |
1000 | if (ep->desc.bInterval == 0) | 1044 | interval = xhci_parse_exponent_interval(udev, ep); |
1001 | interval = 0; | ||
1002 | else | ||
1003 | interval = ep->desc.bInterval - 1; | ||
1004 | if (interval > 15) | ||
1005 | interval = 15; | ||
1006 | if (interval != ep->desc.bInterval + 1) | ||
1007 | dev_warn(&udev->dev, "ep %#x - rounding interval to %d microframes\n", | ||
1008 | ep->desc.bEndpointAddress, 1 << interval); | ||
1009 | } | 1045 | } |
1010 | break; | 1046 | break; |
1011 | /* Convert bInterval (in 1-255 frames) to microframes and round down to | 1047 | |
1012 | * nearest power of 2. | ||
1013 | */ | ||
1014 | case USB_SPEED_FULL: | 1048 | case USB_SPEED_FULL: |
1049 | if (usb_endpoint_xfer_int(&ep->desc)) { | ||
1050 | interval = xhci_parse_exponent_interval(udev, ep); | ||
1051 | break; | ||
1052 | } | ||
1053 | /* | ||
1054 | * Fall through for isochronous endpoint interval decoding | ||
1055 | * since it uses the same rules as low speed interrupt | ||
1056 | * endpoints. | ||
1057 | */ | ||
1058 | |||
1015 | case USB_SPEED_LOW: | 1059 | case USB_SPEED_LOW: |
1016 | if (usb_endpoint_xfer_int(&ep->desc) || | 1060 | if (usb_endpoint_xfer_int(&ep->desc) || |
1017 | usb_endpoint_xfer_isoc(&ep->desc)) { | 1061 | usb_endpoint_xfer_isoc(&ep->desc)) { |
1018 | interval = fls(8*ep->desc.bInterval) - 1; | 1062 | |
1019 | if (interval > 10) | 1063 | interval = xhci_parse_frame_interval(udev, ep); |
1020 | interval = 10; | ||
1021 | if (interval < 3) | ||
1022 | interval = 3; | ||
1023 | if ((1 << interval) != 8*ep->desc.bInterval) | ||
1024 | dev_warn(&udev->dev, | ||
1025 | "ep %#x - rounding interval" | ||
1026 | " to %d microframes, " | ||
1027 | "ep desc says %d microframes\n", | ||
1028 | ep->desc.bEndpointAddress, | ||
1029 | 1 << interval, | ||
1030 | 8*ep->desc.bInterval); | ||
1031 | } | 1064 | } |
1032 | break; | 1065 | break; |
1066 | |||
1033 | default: | 1067 | default: |
1034 | BUG(); | 1068 | BUG(); |
1035 | } | 1069 | } |
@@ -1041,7 +1075,7 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, | |||
1041 | * transaction opportunities per microframe", but that goes in the Max Burst | 1075 | * transaction opportunities per microframe", but that goes in the Max Burst |
1042 | * endpoint context field. | 1076 | * endpoint context field. |
1043 | */ | 1077 | */ |
1044 | static inline u32 xhci_get_endpoint_mult(struct usb_device *udev, | 1078 | static u32 xhci_get_endpoint_mult(struct usb_device *udev, |
1045 | struct usb_host_endpoint *ep) | 1079 | struct usb_host_endpoint *ep) |
1046 | { | 1080 | { |
1047 | if (udev->speed != USB_SPEED_SUPER || | 1081 | if (udev->speed != USB_SPEED_SUPER || |
@@ -1050,7 +1084,7 @@ static inline u32 xhci_get_endpoint_mult(struct usb_device *udev, | |||
1050 | return ep->ss_ep_comp.bmAttributes; | 1084 | return ep->ss_ep_comp.bmAttributes; |
1051 | } | 1085 | } |
1052 | 1086 | ||
1053 | static inline u32 xhci_get_endpoint_type(struct usb_device *udev, | 1087 | static u32 xhci_get_endpoint_type(struct usb_device *udev, |
1054 | struct usb_host_endpoint *ep) | 1088 | struct usb_host_endpoint *ep) |
1055 | { | 1089 | { |
1056 | int in; | 1090 | int in; |
@@ -1084,7 +1118,7 @@ static inline u32 xhci_get_endpoint_type(struct usb_device *udev, | |||
1084 | * Basically, this is the maxpacket size, multiplied by the burst size | 1118 | * Basically, this is the maxpacket size, multiplied by the burst size |
1085 | * and mult size. | 1119 | * and mult size. |
1086 | */ | 1120 | */ |
1087 | static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, | 1121 | static u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, |
1088 | struct usb_device *udev, | 1122 | struct usb_device *udev, |
1089 | struct usb_host_endpoint *ep) | 1123 | struct usb_host_endpoint *ep) |
1090 | { | 1124 | { |
@@ -1727,12 +1761,12 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, | |||
1727 | * found a similar duplicate. | 1761 | * found a similar duplicate. |
1728 | */ | 1762 | */ |
1729 | if (xhci->port_array[i] != major_revision && | 1763 | if (xhci->port_array[i] != major_revision && |
1730 | xhci->port_array[i] != (u8) -1) { | 1764 | xhci->port_array[i] != DUPLICATE_ENTRY) { |
1731 | if (xhci->port_array[i] == 0x03) | 1765 | if (xhci->port_array[i] == 0x03) |
1732 | xhci->num_usb3_ports--; | 1766 | xhci->num_usb3_ports--; |
1733 | else | 1767 | else |
1734 | xhci->num_usb2_ports--; | 1768 | xhci->num_usb2_ports--; |
1735 | xhci->port_array[i] = (u8) -1; | 1769 | xhci->port_array[i] = DUPLICATE_ENTRY; |
1736 | } | 1770 | } |
1737 | /* FIXME: Should we disable the port? */ | 1771 | /* FIXME: Should we disable the port? */ |
1738 | continue; | 1772 | continue; |
@@ -1831,7 +1865,7 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) | |||
1831 | for (i = 0; i < num_ports; i++) { | 1865 | for (i = 0; i < num_ports; i++) { |
1832 | if (xhci->port_array[i] == 0x03 || | 1866 | if (xhci->port_array[i] == 0x03 || |
1833 | xhci->port_array[i] == 0 || | 1867 | xhci->port_array[i] == 0 || |
1834 | xhci->port_array[i] == -1) | 1868 | xhci->port_array[i] == DUPLICATE_ENTRY) |
1835 | continue; | 1869 | continue; |
1836 | 1870 | ||
1837 | xhci->usb2_ports[port_index] = | 1871 | xhci->usb2_ports[port_index] = |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index ceea9f33491c..a10494c2f3c7 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -114,6 +114,10 @@ static int xhci_pci_setup(struct usb_hcd *hcd) | |||
114 | if (pdev->vendor == PCI_VENDOR_ID_NEC) | 114 | if (pdev->vendor == PCI_VENDOR_ID_NEC) |
115 | xhci->quirks |= XHCI_NEC_HOST; | 115 | xhci->quirks |= XHCI_NEC_HOST; |
116 | 116 | ||
117 | /* AMD PLL quirk */ | ||
118 | if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) | ||
119 | xhci->quirks |= XHCI_AMD_PLL_FIX; | ||
120 | |||
117 | /* Make sure the HC is halted. */ | 121 | /* Make sure the HC is halted. */ |
118 | retval = xhci_halt(xhci); | 122 | retval = xhci_halt(xhci); |
119 | if (retval) | 123 | if (retval) |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index cfc1ad92473f..7437386a9a50 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -93,7 +93,7 @@ dma_addr_t xhci_trb_virt_to_dma(struct xhci_segment *seg, | |||
93 | /* Does this link TRB point to the first segment in a ring, | 93 | /* Does this link TRB point to the first segment in a ring, |
94 | * or was the previous TRB the last TRB on the last segment in the ERST? | 94 | * or was the previous TRB the last TRB on the last segment in the ERST? |
95 | */ | 95 | */ |
96 | static inline bool last_trb_on_last_seg(struct xhci_hcd *xhci, struct xhci_ring *ring, | 96 | static bool last_trb_on_last_seg(struct xhci_hcd *xhci, struct xhci_ring *ring, |
97 | struct xhci_segment *seg, union xhci_trb *trb) | 97 | struct xhci_segment *seg, union xhci_trb *trb) |
98 | { | 98 | { |
99 | if (ring == xhci->event_ring) | 99 | if (ring == xhci->event_ring) |
@@ -107,7 +107,7 @@ static inline bool last_trb_on_last_seg(struct xhci_hcd *xhci, struct xhci_ring | |||
107 | * segment? I.e. would the updated event TRB pointer step off the end of the | 107 | * segment? I.e. would the updated event TRB pointer step off the end of the |
108 | * event seg? | 108 | * event seg? |
109 | */ | 109 | */ |
110 | static inline int last_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, | 110 | static int last_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, |
111 | struct xhci_segment *seg, union xhci_trb *trb) | 111 | struct xhci_segment *seg, union xhci_trb *trb) |
112 | { | 112 | { |
113 | if (ring == xhci->event_ring) | 113 | if (ring == xhci->event_ring) |
@@ -116,7 +116,7 @@ static inline int last_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, | |||
116 | return (trb->link.control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK); | 116 | return (trb->link.control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK); |
117 | } | 117 | } |
118 | 118 | ||
119 | static inline int enqueue_is_link_trb(struct xhci_ring *ring) | 119 | static int enqueue_is_link_trb(struct xhci_ring *ring) |
120 | { | 120 | { |
121 | struct xhci_link_trb *link = &ring->enqueue->link; | 121 | struct xhci_link_trb *link = &ring->enqueue->link; |
122 | return ((link->control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK)); | 122 | return ((link->control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK)); |
@@ -592,7 +592,7 @@ void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, | |||
592 | ep->ep_state |= SET_DEQ_PENDING; | 592 | ep->ep_state |= SET_DEQ_PENDING; |
593 | } | 593 | } |
594 | 594 | ||
595 | static inline void xhci_stop_watchdog_timer_in_irq(struct xhci_hcd *xhci, | 595 | static void xhci_stop_watchdog_timer_in_irq(struct xhci_hcd *xhci, |
596 | struct xhci_virt_ep *ep) | 596 | struct xhci_virt_ep *ep) |
597 | { | 597 | { |
598 | ep->ep_state &= ~EP_HALT_PENDING; | 598 | ep->ep_state &= ~EP_HALT_PENDING; |
@@ -619,6 +619,13 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci, | |||
619 | 619 | ||
620 | /* Only giveback urb when this is the last td in urb */ | 620 | /* Only giveback urb when this is the last td in urb */ |
621 | if (urb_priv->td_cnt == urb_priv->length) { | 621 | if (urb_priv->td_cnt == urb_priv->length) { |
622 | if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { | ||
623 | xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs--; | ||
624 | if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs == 0) { | ||
625 | if (xhci->quirks & XHCI_AMD_PLL_FIX) | ||
626 | usb_amd_quirk_pll_enable(); | ||
627 | } | ||
628 | } | ||
622 | usb_hcd_unlink_urb_from_ep(hcd, urb); | 629 | usb_hcd_unlink_urb_from_ep(hcd, urb); |
623 | xhci_dbg(xhci, "Giveback %s URB %p\n", adjective, urb); | 630 | xhci_dbg(xhci, "Giveback %s URB %p\n", adjective, urb); |
624 | 631 | ||
@@ -1209,7 +1216,7 @@ static unsigned int find_faked_portnum_from_hw_portnum(struct usb_hcd *hcd, | |||
1209 | * Skip ports that don't have known speeds, or have duplicate | 1216 | * Skip ports that don't have known speeds, or have duplicate |
1210 | * Extended Capabilities port speed entries. | 1217 | * Extended Capabilities port speed entries. |
1211 | */ | 1218 | */ |
1212 | if (port_speed == 0 || port_speed == -1) | 1219 | if (port_speed == 0 || port_speed == DUPLICATE_ENTRY) |
1213 | continue; | 1220 | continue; |
1214 | 1221 | ||
1215 | /* | 1222 | /* |
@@ -1235,6 +1242,7 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
1235 | u8 major_revision; | 1242 | u8 major_revision; |
1236 | struct xhci_bus_state *bus_state; | 1243 | struct xhci_bus_state *bus_state; |
1237 | u32 __iomem **port_array; | 1244 | u32 __iomem **port_array; |
1245 | bool bogus_port_status = false; | ||
1238 | 1246 | ||
1239 | /* Port status change events always have a successful completion code */ | 1247 | /* Port status change events always have a successful completion code */ |
1240 | if (GET_COMP_CODE(event->generic.field[2]) != COMP_SUCCESS) { | 1248 | if (GET_COMP_CODE(event->generic.field[2]) != COMP_SUCCESS) { |
@@ -1247,6 +1255,7 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
1247 | max_ports = HCS_MAX_PORTS(xhci->hcs_params1); | 1255 | max_ports = HCS_MAX_PORTS(xhci->hcs_params1); |
1248 | if ((port_id <= 0) || (port_id > max_ports)) { | 1256 | if ((port_id <= 0) || (port_id > max_ports)) { |
1249 | xhci_warn(xhci, "Invalid port id %d\n", port_id); | 1257 | xhci_warn(xhci, "Invalid port id %d\n", port_id); |
1258 | bogus_port_status = true; | ||
1250 | goto cleanup; | 1259 | goto cleanup; |
1251 | } | 1260 | } |
1252 | 1261 | ||
@@ -1258,12 +1267,14 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
1258 | xhci_warn(xhci, "Event for port %u not in " | 1267 | xhci_warn(xhci, "Event for port %u not in " |
1259 | "Extended Capabilities, ignoring.\n", | 1268 | "Extended Capabilities, ignoring.\n", |
1260 | port_id); | 1269 | port_id); |
1270 | bogus_port_status = true; | ||
1261 | goto cleanup; | 1271 | goto cleanup; |
1262 | } | 1272 | } |
1263 | if (major_revision == (u8) -1) { | 1273 | if (major_revision == DUPLICATE_ENTRY) { |
1264 | xhci_warn(xhci, "Event for port %u duplicated in" | 1274 | xhci_warn(xhci, "Event for port %u duplicated in" |
1265 | "Extended Capabilities, ignoring.\n", | 1275 | "Extended Capabilities, ignoring.\n", |
1266 | port_id); | 1276 | port_id); |
1277 | bogus_port_status = true; | ||
1267 | goto cleanup; | 1278 | goto cleanup; |
1268 | } | 1279 | } |
1269 | 1280 | ||
@@ -1335,6 +1346,13 @@ cleanup: | |||
1335 | /* Update event ring dequeue pointer before dropping the lock */ | 1346 | /* Update event ring dequeue pointer before dropping the lock */ |
1336 | inc_deq(xhci, xhci->event_ring, true); | 1347 | inc_deq(xhci, xhci->event_ring, true); |
1337 | 1348 | ||
1349 | /* Don't make the USB core poll the roothub if we got a bad port status | ||
1350 | * change event. Besides, at that point we can't tell which roothub | ||
1351 | * (USB 2.0 or USB 3.0) to kick. | ||
1352 | */ | ||
1353 | if (bogus_port_status) | ||
1354 | return; | ||
1355 | |||
1338 | spin_unlock(&xhci->lock); | 1356 | spin_unlock(&xhci->lock); |
1339 | /* Pass this up to the core */ | 1357 | /* Pass this up to the core */ |
1340 | usb_hcd_poll_rh_status(hcd); | 1358 | usb_hcd_poll_rh_status(hcd); |
@@ -1554,8 +1572,17 @@ td_cleanup: | |||
1554 | 1572 | ||
1555 | urb_priv->td_cnt++; | 1573 | urb_priv->td_cnt++; |
1556 | /* Giveback the urb when all the tds are completed */ | 1574 | /* Giveback the urb when all the tds are completed */ |
1557 | if (urb_priv->td_cnt == urb_priv->length) | 1575 | if (urb_priv->td_cnt == urb_priv->length) { |
1558 | ret = 1; | 1576 | ret = 1; |
1577 | if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { | ||
1578 | xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs--; | ||
1579 | if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs | ||
1580 | == 0) { | ||
1581 | if (xhci->quirks & XHCI_AMD_PLL_FIX) | ||
1582 | usb_amd_quirk_pll_enable(); | ||
1583 | } | ||
1584 | } | ||
1585 | } | ||
1559 | } | 1586 | } |
1560 | 1587 | ||
1561 | return ret; | 1588 | return ret; |
@@ -1675,71 +1702,52 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1675 | struct urb_priv *urb_priv; | 1702 | struct urb_priv *urb_priv; |
1676 | int idx; | 1703 | int idx; |
1677 | int len = 0; | 1704 | int len = 0; |
1678 | int skip_td = 0; | ||
1679 | union xhci_trb *cur_trb; | 1705 | union xhci_trb *cur_trb; |
1680 | struct xhci_segment *cur_seg; | 1706 | struct xhci_segment *cur_seg; |
1707 | struct usb_iso_packet_descriptor *frame; | ||
1681 | u32 trb_comp_code; | 1708 | u32 trb_comp_code; |
1709 | bool skip_td = false; | ||
1682 | 1710 | ||
1683 | ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer); | 1711 | ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer); |
1684 | trb_comp_code = GET_COMP_CODE(event->transfer_len); | 1712 | trb_comp_code = GET_COMP_CODE(event->transfer_len); |
1685 | urb_priv = td->urb->hcpriv; | 1713 | urb_priv = td->urb->hcpriv; |
1686 | idx = urb_priv->td_cnt; | 1714 | idx = urb_priv->td_cnt; |
1715 | frame = &td->urb->iso_frame_desc[idx]; | ||
1687 | 1716 | ||
1688 | if (ep->skip) { | 1717 | /* handle completion code */ |
1689 | /* The transfer is partly done */ | 1718 | switch (trb_comp_code) { |
1690 | *status = -EXDEV; | 1719 | case COMP_SUCCESS: |
1691 | td->urb->iso_frame_desc[idx].status = -EXDEV; | 1720 | frame->status = 0; |
1692 | } else { | 1721 | xhci_dbg(xhci, "Successful isoc transfer!\n"); |
1693 | /* handle completion code */ | 1722 | break; |
1694 | switch (trb_comp_code) { | 1723 | case COMP_SHORT_TX: |
1695 | case COMP_SUCCESS: | 1724 | frame->status = td->urb->transfer_flags & URB_SHORT_NOT_OK ? |
1696 | td->urb->iso_frame_desc[idx].status = 0; | 1725 | -EREMOTEIO : 0; |
1697 | xhci_dbg(xhci, "Successful isoc transfer!\n"); | 1726 | break; |
1698 | break; | 1727 | case COMP_BW_OVER: |
1699 | case COMP_SHORT_TX: | 1728 | frame->status = -ECOMM; |
1700 | if (td->urb->transfer_flags & URB_SHORT_NOT_OK) | 1729 | skip_td = true; |
1701 | td->urb->iso_frame_desc[idx].status = | 1730 | break; |
1702 | -EREMOTEIO; | 1731 | case COMP_BUFF_OVER: |
1703 | else | 1732 | case COMP_BABBLE: |
1704 | td->urb->iso_frame_desc[idx].status = 0; | 1733 | frame->status = -EOVERFLOW; |
1705 | break; | 1734 | skip_td = true; |
1706 | case COMP_BW_OVER: | 1735 | break; |
1707 | td->urb->iso_frame_desc[idx].status = -ECOMM; | 1736 | case COMP_STALL: |
1708 | skip_td = 1; | 1737 | frame->status = -EPROTO; |
1709 | break; | 1738 | skip_td = true; |
1710 | case COMP_BUFF_OVER: | 1739 | break; |
1711 | case COMP_BABBLE: | 1740 | case COMP_STOP: |
1712 | td->urb->iso_frame_desc[idx].status = -EOVERFLOW; | 1741 | case COMP_STOP_INVAL: |
1713 | skip_td = 1; | 1742 | break; |
1714 | break; | 1743 | default: |
1715 | case COMP_STALL: | 1744 | frame->status = -1; |
1716 | td->urb->iso_frame_desc[idx].status = -EPROTO; | 1745 | break; |
1717 | skip_td = 1; | ||
1718 | break; | ||
1719 | case COMP_STOP: | ||
1720 | case COMP_STOP_INVAL: | ||
1721 | break; | ||
1722 | default: | ||
1723 | td->urb->iso_frame_desc[idx].status = -1; | ||
1724 | break; | ||
1725 | } | ||
1726 | } | ||
1727 | |||
1728 | /* calc actual length */ | ||
1729 | if (ep->skip) { | ||
1730 | td->urb->iso_frame_desc[idx].actual_length = 0; | ||
1731 | /* Update ring dequeue pointer */ | ||
1732 | while (ep_ring->dequeue != td->last_trb) | ||
1733 | inc_deq(xhci, ep_ring, false); | ||
1734 | inc_deq(xhci, ep_ring, false); | ||
1735 | return finish_td(xhci, td, event_trb, event, ep, status, true); | ||
1736 | } | 1746 | } |
1737 | 1747 | ||
1738 | if (trb_comp_code == COMP_SUCCESS || skip_td == 1) { | 1748 | if (trb_comp_code == COMP_SUCCESS || skip_td) { |
1739 | td->urb->iso_frame_desc[idx].actual_length = | 1749 | frame->actual_length = frame->length; |
1740 | td->urb->iso_frame_desc[idx].length; | 1750 | td->urb->actual_length += frame->length; |
1741 | td->urb->actual_length += | ||
1742 | td->urb->iso_frame_desc[idx].length; | ||
1743 | } else { | 1751 | } else { |
1744 | for (cur_trb = ep_ring->dequeue, | 1752 | for (cur_trb = ep_ring->dequeue, |
1745 | cur_seg = ep_ring->deq_seg; cur_trb != event_trb; | 1753 | cur_seg = ep_ring->deq_seg; cur_trb != event_trb; |
@@ -1755,7 +1763,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1755 | TRB_LEN(event->transfer_len); | 1763 | TRB_LEN(event->transfer_len); |
1756 | 1764 | ||
1757 | if (trb_comp_code != COMP_STOP_INVAL) { | 1765 | if (trb_comp_code != COMP_STOP_INVAL) { |
1758 | td->urb->iso_frame_desc[idx].actual_length = len; | 1766 | frame->actual_length = len; |
1759 | td->urb->actual_length += len; | 1767 | td->urb->actual_length += len; |
1760 | } | 1768 | } |
1761 | } | 1769 | } |
@@ -1766,6 +1774,35 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1766 | return finish_td(xhci, td, event_trb, event, ep, status, false); | 1774 | return finish_td(xhci, td, event_trb, event, ep, status, false); |
1767 | } | 1775 | } |
1768 | 1776 | ||
1777 | static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, | ||
1778 | struct xhci_transfer_event *event, | ||
1779 | struct xhci_virt_ep *ep, int *status) | ||
1780 | { | ||
1781 | struct xhci_ring *ep_ring; | ||
1782 | struct urb_priv *urb_priv; | ||
1783 | struct usb_iso_packet_descriptor *frame; | ||
1784 | int idx; | ||
1785 | |||
1786 | ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer); | ||
1787 | urb_priv = td->urb->hcpriv; | ||
1788 | idx = urb_priv->td_cnt; | ||
1789 | frame = &td->urb->iso_frame_desc[idx]; | ||
1790 | |||
1791 | /* The transfer is partly done */ | ||
1792 | *status = -EXDEV; | ||
1793 | frame->status = -EXDEV; | ||
1794 | |||
1795 | /* calc actual length */ | ||
1796 | frame->actual_length = 0; | ||
1797 | |||
1798 | /* Update ring dequeue pointer */ | ||
1799 | while (ep_ring->dequeue != td->last_trb) | ||
1800 | inc_deq(xhci, ep_ring, false); | ||
1801 | inc_deq(xhci, ep_ring, false); | ||
1802 | |||
1803 | return finish_td(xhci, td, NULL, event, ep, status, true); | ||
1804 | } | ||
1805 | |||
1769 | /* | 1806 | /* |
1770 | * Process bulk and interrupt tds, update urb status and actual_length. | 1807 | * Process bulk and interrupt tds, update urb status and actual_length. |
1771 | */ | 1808 | */ |
@@ -2024,36 +2061,42 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
2024 | } | 2061 | } |
2025 | 2062 | ||
2026 | td = list_entry(ep_ring->td_list.next, struct xhci_td, td_list); | 2063 | td = list_entry(ep_ring->td_list.next, struct xhci_td, td_list); |
2064 | |||
2027 | /* Is this a TRB in the currently executing TD? */ | 2065 | /* Is this a TRB in the currently executing TD? */ |
2028 | event_seg = trb_in_td(ep_ring->deq_seg, ep_ring->dequeue, | 2066 | event_seg = trb_in_td(ep_ring->deq_seg, ep_ring->dequeue, |
2029 | td->last_trb, event_dma); | 2067 | td->last_trb, event_dma); |
2030 | if (event_seg && ep->skip) { | 2068 | if (!event_seg) { |
2069 | if (!ep->skip || | ||
2070 | !usb_endpoint_xfer_isoc(&td->urb->ep->desc)) { | ||
2071 | /* HC is busted, give up! */ | ||
2072 | xhci_err(xhci, | ||
2073 | "ERROR Transfer event TRB DMA ptr not " | ||
2074 | "part of current TD\n"); | ||
2075 | return -ESHUTDOWN; | ||
2076 | } | ||
2077 | |||
2078 | ret = skip_isoc_td(xhci, td, event, ep, &status); | ||
2079 | goto cleanup; | ||
2080 | } | ||
2081 | |||
2082 | if (ep->skip) { | ||
2031 | xhci_dbg(xhci, "Found td. Clear skip flag.\n"); | 2083 | xhci_dbg(xhci, "Found td. Clear skip flag.\n"); |
2032 | ep->skip = false; | 2084 | ep->skip = false; |
2033 | } | 2085 | } |
2034 | if (!event_seg && | ||
2035 | (!ep->skip || !usb_endpoint_xfer_isoc(&td->urb->ep->desc))) { | ||
2036 | /* HC is busted, give up! */ | ||
2037 | xhci_err(xhci, "ERROR Transfer event TRB DMA ptr not " | ||
2038 | "part of current TD\n"); | ||
2039 | return -ESHUTDOWN; | ||
2040 | } | ||
2041 | 2086 | ||
2042 | if (event_seg) { | 2087 | event_trb = &event_seg->trbs[(event_dma - event_seg->dma) / |
2043 | event_trb = &event_seg->trbs[(event_dma - | 2088 | sizeof(*event_trb)]; |
2044 | event_seg->dma) / sizeof(*event_trb)]; | 2089 | /* |
2045 | /* | 2090 | * No-op TRB should not trigger interrupts. |
2046 | * No-op TRB should not trigger interrupts. | 2091 | * If event_trb is a no-op TRB, it means the |
2047 | * If event_trb is a no-op TRB, it means the | 2092 | * corresponding TD has been cancelled. Just ignore |
2048 | * corresponding TD has been cancelled. Just ignore | 2093 | * the TD. |
2049 | * the TD. | 2094 | */ |
2050 | */ | 2095 | if ((event_trb->generic.field[3] & TRB_TYPE_BITMASK) |
2051 | if ((event_trb->generic.field[3] & TRB_TYPE_BITMASK) | 2096 | == TRB_TYPE(TRB_TR_NOOP)) { |
2052 | == TRB_TYPE(TRB_TR_NOOP)) { | 2097 | xhci_dbg(xhci, |
2053 | xhci_dbg(xhci, "event_trb is a no-op TRB. " | 2098 | "event_trb is a no-op TRB. Skip it\n"); |
2054 | "Skip it\n"); | 2099 | goto cleanup; |
2055 | goto cleanup; | ||
2056 | } | ||
2057 | } | 2100 | } |
2058 | 2101 | ||
2059 | /* Now update the urb's actual_length and give back to | 2102 | /* Now update the urb's actual_length and give back to |
@@ -3126,6 +3169,12 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3126 | } | 3169 | } |
3127 | } | 3170 | } |
3128 | 3171 | ||
3172 | if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs == 0) { | ||
3173 | if (xhci->quirks & XHCI_AMD_PLL_FIX) | ||
3174 | usb_amd_quirk_pll_disable(); | ||
3175 | } | ||
3176 | xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs++; | ||
3177 | |||
3129 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, | 3178 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, |
3130 | start_cycle, start_trb); | 3179 | start_cycle, start_trb); |
3131 | return 0; | 3180 | return 0; |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 196e0181b2ed..81b976e45880 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -550,6 +550,9 @@ void xhci_stop(struct usb_hcd *hcd) | |||
550 | del_timer_sync(&xhci->event_ring_timer); | 550 | del_timer_sync(&xhci->event_ring_timer); |
551 | #endif | 551 | #endif |
552 | 552 | ||
553 | if (xhci->quirks & XHCI_AMD_PLL_FIX) | ||
554 | usb_amd_dev_put(); | ||
555 | |||
553 | xhci_dbg(xhci, "// Disabling event ring interrupts\n"); | 556 | xhci_dbg(xhci, "// Disabling event ring interrupts\n"); |
554 | temp = xhci_readl(xhci, &xhci->op_regs->status); | 557 | temp = xhci_readl(xhci, &xhci->op_regs->status); |
555 | xhci_writel(xhci, temp & ~STS_EINT, &xhci->op_regs->status); | 558 | xhci_writel(xhci, temp & ~STS_EINT, &xhci->op_regs->status); |
@@ -771,7 +774,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
771 | 774 | ||
772 | /* If restore operation fails, re-initialize the HC during resume */ | 775 | /* If restore operation fails, re-initialize the HC during resume */ |
773 | if ((temp & STS_SRE) || hibernated) { | 776 | if ((temp & STS_SRE) || hibernated) { |
774 | usb_root_hub_lost_power(hcd->self.root_hub); | 777 | /* Let the USB core know _both_ roothubs lost power. */ |
778 | usb_root_hub_lost_power(xhci->main_hcd->self.root_hub); | ||
779 | usb_root_hub_lost_power(xhci->shared_hcd->self.root_hub); | ||
775 | 780 | ||
776 | xhci_dbg(xhci, "Stop HCD\n"); | 781 | xhci_dbg(xhci, "Stop HCD\n"); |
777 | xhci_halt(xhci); | 782 | xhci_halt(xhci); |
@@ -2386,10 +2391,18 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
2386 | /* Everything but endpoint 0 is disabled, so free or cache the rings. */ | 2391 | /* Everything but endpoint 0 is disabled, so free or cache the rings. */ |
2387 | last_freed_endpoint = 1; | 2392 | last_freed_endpoint = 1; |
2388 | for (i = 1; i < 31; ++i) { | 2393 | for (i = 1; i < 31; ++i) { |
2389 | if (!virt_dev->eps[i].ring) | 2394 | struct xhci_virt_ep *ep = &virt_dev->eps[i]; |
2390 | continue; | 2395 | |
2391 | xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i); | 2396 | if (ep->ep_state & EP_HAS_STREAMS) { |
2392 | last_freed_endpoint = i; | 2397 | xhci_free_stream_info(xhci, ep->stream_info); |
2398 | ep->stream_info = NULL; | ||
2399 | ep->ep_state &= ~EP_HAS_STREAMS; | ||
2400 | } | ||
2401 | |||
2402 | if (ep->ring) { | ||
2403 | xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i); | ||
2404 | last_freed_endpoint = i; | ||
2405 | } | ||
2393 | } | 2406 | } |
2394 | xhci_dbg(xhci, "Output context after successful reset device cmd:\n"); | 2407 | xhci_dbg(xhci, "Output context after successful reset device cmd:\n"); |
2395 | xhci_dbg_ctx(xhci, virt_dev->out_ctx, last_freed_endpoint); | 2408 | xhci_dbg_ctx(xhci, virt_dev->out_ctx, last_freed_endpoint); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 07e263063e37..ba1be6b7cc6d 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | /* Code sharing between pci-quirks and xhci hcd */ | 31 | /* Code sharing between pci-quirks and xhci hcd */ |
32 | #include "xhci-ext-caps.h" | 32 | #include "xhci-ext-caps.h" |
33 | #include "pci-quirks.h" | ||
33 | 34 | ||
34 | /* xHCI PCI Configuration Registers */ | 35 | /* xHCI PCI Configuration Registers */ |
35 | #define XHCI_SBRN_OFFSET (0x60) | 36 | #define XHCI_SBRN_OFFSET (0x60) |
@@ -232,7 +233,7 @@ struct xhci_op_regs { | |||
232 | * notification type that matches a bit set in this bit field. | 233 | * notification type that matches a bit set in this bit field. |
233 | */ | 234 | */ |
234 | #define DEV_NOTE_MASK (0xffff) | 235 | #define DEV_NOTE_MASK (0xffff) |
235 | #define ENABLE_DEV_NOTE(x) (1 << x) | 236 | #define ENABLE_DEV_NOTE(x) (1 << (x)) |
236 | /* Most of the device notification types should only be used for debug. | 237 | /* Most of the device notification types should only be used for debug. |
237 | * SW does need to pay attention to function wake notifications. | 238 | * SW does need to pay attention to function wake notifications. |
238 | */ | 239 | */ |
@@ -348,6 +349,9 @@ struct xhci_op_regs { | |||
348 | /* Initiate a warm port reset - complete when PORT_WRC is '1' */ | 349 | /* Initiate a warm port reset - complete when PORT_WRC is '1' */ |
349 | #define PORT_WR (1 << 31) | 350 | #define PORT_WR (1 << 31) |
350 | 351 | ||
352 | /* We mark duplicate entries with -1 */ | ||
353 | #define DUPLICATE_ENTRY ((u8)(-1)) | ||
354 | |||
351 | /* Port Power Management Status and Control - port_power_base bitmasks */ | 355 | /* Port Power Management Status and Control - port_power_base bitmasks */ |
352 | /* Inactivity timer value for transitions into U1, in microseconds. | 356 | /* Inactivity timer value for transitions into U1, in microseconds. |
353 | * Timeout can be up to 127us. 0xFF means an infinite timeout. | 357 | * Timeout can be up to 127us. 0xFF means an infinite timeout. |
@@ -601,11 +605,11 @@ struct xhci_ep_ctx { | |||
601 | #define EP_STATE_STOPPED 3 | 605 | #define EP_STATE_STOPPED 3 |
602 | #define EP_STATE_ERROR 4 | 606 | #define EP_STATE_ERROR 4 |
603 | /* Mult - Max number of burtst within an interval, in EP companion desc. */ | 607 | /* Mult - Max number of burtst within an interval, in EP companion desc. */ |
604 | #define EP_MULT(p) ((p & 0x3) << 8) | 608 | #define EP_MULT(p) (((p) & 0x3) << 8) |
605 | /* bits 10:14 are Max Primary Streams */ | 609 | /* bits 10:14 are Max Primary Streams */ |
606 | /* bit 15 is Linear Stream Array */ | 610 | /* bit 15 is Linear Stream Array */ |
607 | /* Interval - period between requests to an endpoint - 125u increments. */ | 611 | /* Interval - period between requests to an endpoint - 125u increments. */ |
608 | #define EP_INTERVAL(p) ((p & 0xff) << 16) | 612 | #define EP_INTERVAL(p) (((p) & 0xff) << 16) |
609 | #define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff)) | 613 | #define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff)) |
610 | #define EP_MAXPSTREAMS_MASK (0x1f << 10) | 614 | #define EP_MAXPSTREAMS_MASK (0x1f << 10) |
611 | #define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK) | 615 | #define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK) |
@@ -1276,6 +1280,7 @@ struct xhci_hcd { | |||
1276 | #define XHCI_LINK_TRB_QUIRK (1 << 0) | 1280 | #define XHCI_LINK_TRB_QUIRK (1 << 0) |
1277 | #define XHCI_RESET_EP_QUIRK (1 << 1) | 1281 | #define XHCI_RESET_EP_QUIRK (1 << 1) |
1278 | #define XHCI_NEC_HOST (1 << 2) | 1282 | #define XHCI_NEC_HOST (1 << 2) |
1283 | #define XHCI_AMD_PLL_FIX (1 << 3) | ||
1279 | /* There are two roothubs to keep track of bus suspend info for */ | 1284 | /* There are two roothubs to keep track of bus suspend info for */ |
1280 | struct xhci_bus_state bus_state[2]; | 1285 | struct xhci_bus_state bus_state[2]; |
1281 | /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */ | 1286 | /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */ |
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 4cbb7e4b368d..74073b363c30 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -14,7 +14,7 @@ config USB_MUSB_HDRC | |||
14 | select TWL4030_USB if MACH_OMAP_3430SDP | 14 | select TWL4030_USB if MACH_OMAP_3430SDP |
15 | select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA | 15 | select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA |
16 | select USB_OTG_UTILS | 16 | select USB_OTG_UTILS |
17 | tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' | 17 | bool 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' |
18 | help | 18 | help |
19 | Say Y here if your system has a dual role high speed USB | 19 | Say Y here if your system has a dual role high speed USB |
20 | controller based on the Mentor Graphics silicon IP. Then | 20 | controller based on the Mentor Graphics silicon IP. Then |
@@ -30,8 +30,8 @@ config USB_MUSB_HDRC | |||
30 | 30 | ||
31 | If you do not know what this is, please say N. | 31 | If you do not know what this is, please say N. |
32 | 32 | ||
33 | To compile this driver as a module, choose M here; the | 33 | # To compile this driver as a module, choose M here; the |
34 | module will be called "musb-hdrc". | 34 | # module will be called "musb-hdrc". |
35 | 35 | ||
36 | choice | 36 | choice |
37 | prompt "Platform Glue Layer" | 37 | prompt "Platform Glue Layer" |
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 52312e8af213..8e2a1ff8a35a 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/cacheflush.h> | 21 | #include <asm/cacheflush.h> |
22 | 22 | ||
23 | #include "musb_core.h" | 23 | #include "musb_core.h" |
24 | #include "musbhsdma.h" | ||
24 | #include "blackfin.h" | 25 | #include "blackfin.h" |
25 | 26 | ||
26 | struct bfin_glue { | 27 | struct bfin_glue { |
@@ -332,6 +333,27 @@ static int bfin_musb_set_mode(struct musb *musb, u8 musb_mode) | |||
332 | return -EIO; | 333 | return -EIO; |
333 | } | 334 | } |
334 | 335 | ||
336 | static int bfin_musb_adjust_channel_params(struct dma_channel *channel, | ||
337 | u16 packet_sz, u8 *mode, | ||
338 | dma_addr_t *dma_addr, u32 *len) | ||
339 | { | ||
340 | struct musb_dma_channel *musb_channel = channel->private_data; | ||
341 | |||
342 | /* | ||
343 | * Anomaly 05000450 might cause data corruption when using DMA | ||
344 | * MODE 1 transmits with short packet. So to work around this, | ||
345 | * we truncate all MODE 1 transfers down to a multiple of the | ||
346 | * max packet size, and then do the last short packet transfer | ||
347 | * (if there is any) using MODE 0. | ||
348 | */ | ||
349 | if (ANOMALY_05000450) { | ||
350 | if (musb_channel->transmit && *mode == 1) | ||
351 | *len = *len - (*len % packet_sz); | ||
352 | } | ||
353 | |||
354 | return 0; | ||
355 | } | ||
356 | |||
335 | static void bfin_musb_reg_init(struct musb *musb) | 357 | static void bfin_musb_reg_init(struct musb *musb) |
336 | { | 358 | { |
337 | if (ANOMALY_05000346) { | 359 | if (ANOMALY_05000346) { |
@@ -430,6 +452,8 @@ static const struct musb_platform_ops bfin_ops = { | |||
430 | 452 | ||
431 | .vbus_status = bfin_musb_vbus_status, | 453 | .vbus_status = bfin_musb_vbus_status, |
432 | .set_vbus = bfin_musb_set_vbus, | 454 | .set_vbus = bfin_musb_set_vbus, |
455 | |||
456 | .adjust_channel_params = bfin_musb_adjust_channel_params, | ||
433 | }; | 457 | }; |
434 | 458 | ||
435 | static u64 bfin_dmamask = DMA_BIT_MASK(32); | 459 | static u64 bfin_dmamask = DMA_BIT_MASK(32); |
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c index de55a3c3259a..ab434fbd8c35 100644 --- a/drivers/usb/musb/cppi_dma.c +++ b/drivers/usb/musb/cppi_dma.c | |||
@@ -597,12 +597,12 @@ cppi_next_tx_segment(struct musb *musb, struct cppi_channel *tx) | |||
597 | length = min(n_bds * maxpacket, length); | 597 | length = min(n_bds * maxpacket, length); |
598 | } | 598 | } |
599 | 599 | ||
600 | DBG(4, "TX DMA%d, pktSz %d %s bds %d dma 0x%x len %u\n", | 600 | DBG(4, "TX DMA%d, pktSz %d %s bds %d dma 0x%llx len %u\n", |
601 | tx->index, | 601 | tx->index, |
602 | maxpacket, | 602 | maxpacket, |
603 | rndis ? "rndis" : "transparent", | 603 | rndis ? "rndis" : "transparent", |
604 | n_bds, | 604 | n_bds, |
605 | addr, length); | 605 | (unsigned long long)addr, length); |
606 | 606 | ||
607 | cppi_rndis_update(tx, 0, musb->ctrl_base, rndis); | 607 | cppi_rndis_update(tx, 0, musb->ctrl_base, rndis); |
608 | 608 | ||
@@ -820,7 +820,7 @@ cppi_next_rx_segment(struct musb *musb, struct cppi_channel *rx, int onepacket) | |||
820 | length = min(n_bds * maxpacket, length); | 820 | length = min(n_bds * maxpacket, length); |
821 | 821 | ||
822 | DBG(4, "RX DMA%d seg, maxp %d %s bds %d (cnt %d) " | 822 | DBG(4, "RX DMA%d seg, maxp %d %s bds %d (cnt %d) " |
823 | "dma 0x%x len %u %u/%u\n", | 823 | "dma 0x%llx len %u %u/%u\n", |
824 | rx->index, maxpacket, | 824 | rx->index, maxpacket, |
825 | onepacket | 825 | onepacket |
826 | ? (is_rndis ? "rndis" : "onepacket") | 826 | ? (is_rndis ? "rndis" : "onepacket") |
@@ -829,7 +829,8 @@ cppi_next_rx_segment(struct musb *musb, struct cppi_channel *rx, int onepacket) | |||
829 | musb_readl(tibase, | 829 | musb_readl(tibase, |
830 | DAVINCI_RXCPPI_BUFCNT0_REG + (rx->index * 4)) | 830 | DAVINCI_RXCPPI_BUFCNT0_REG + (rx->index * 4)) |
831 | & 0xffff, | 831 | & 0xffff, |
832 | addr, length, rx->channel.actual_len, rx->buf_len); | 832 | (unsigned long long)addr, length, |
833 | rx->channel.actual_len, rx->buf_len); | ||
833 | 834 | ||
834 | /* only queue one segment at a time, since the hardware prevents | 835 | /* only queue one segment at a time, since the hardware prevents |
835 | * correct queue shutdown after unexpected short packets | 836 | * correct queue shutdown after unexpected short packets |
@@ -1039,9 +1040,9 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch) | |||
1039 | if (!completed && (bd->hw_options & CPPI_OWN_SET)) | 1040 | if (!completed && (bd->hw_options & CPPI_OWN_SET)) |
1040 | break; | 1041 | break; |
1041 | 1042 | ||
1042 | DBG(5, "C/RXBD %08x: nxt %08x buf %08x " | 1043 | DBG(5, "C/RXBD %llx: nxt %08x buf %08x " |
1043 | "off.len %08x opt.len %08x (%d)\n", | 1044 | "off.len %08x opt.len %08x (%d)\n", |
1044 | bd->dma, bd->hw_next, bd->hw_bufp, | 1045 | (unsigned long long)bd->dma, bd->hw_next, bd->hw_bufp, |
1045 | bd->hw_off_len, bd->hw_options, | 1046 | bd->hw_off_len, bd->hw_options, |
1046 | rx->channel.actual_len); | 1047 | rx->channel.actual_len); |
1047 | 1048 | ||
@@ -1111,11 +1112,12 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch) | |||
1111 | musb_ep_select(cppi->mregs, rx->index + 1); | 1112 | musb_ep_select(cppi->mregs, rx->index + 1); |
1112 | csr = musb_readw(regs, MUSB_RXCSR); | 1113 | csr = musb_readw(regs, MUSB_RXCSR); |
1113 | if (csr & MUSB_RXCSR_DMAENAB) { | 1114 | if (csr & MUSB_RXCSR_DMAENAB) { |
1114 | DBG(4, "list%d %p/%p, last %08x%s, csr %04x\n", | 1115 | DBG(4, "list%d %p/%p, last %llx%s, csr %04x\n", |
1115 | rx->index, | 1116 | rx->index, |
1116 | rx->head, rx->tail, | 1117 | rx->head, rx->tail, |
1117 | rx->last_processed | 1118 | rx->last_processed |
1118 | ? rx->last_processed->dma | 1119 | ? (unsigned long long) |
1120 | rx->last_processed->dma | ||
1119 | : 0, | 1121 | : 0, |
1120 | completed ? ", completed" : "", | 1122 | completed ? ", completed" : "", |
1121 | csr); | 1123 | csr); |
@@ -1167,8 +1169,11 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id) | |||
1167 | tx = musb_readl(tibase, DAVINCI_TXCPPI_MASKED_REG); | 1169 | tx = musb_readl(tibase, DAVINCI_TXCPPI_MASKED_REG); |
1168 | rx = musb_readl(tibase, DAVINCI_RXCPPI_MASKED_REG); | 1170 | rx = musb_readl(tibase, DAVINCI_RXCPPI_MASKED_REG); |
1169 | 1171 | ||
1170 | if (!tx && !rx) | 1172 | if (!tx && !rx) { |
1173 | if (cppi->irq) | ||
1174 | spin_unlock_irqrestore(&musb->lock, flags); | ||
1171 | return IRQ_NONE; | 1175 | return IRQ_NONE; |
1176 | } | ||
1172 | 1177 | ||
1173 | DBG(4, "CPPI IRQ Tx%x Rx%x\n", tx, rx); | 1178 | DBG(4, "CPPI IRQ Tx%x Rx%x\n", tx, rx); |
1174 | 1179 | ||
@@ -1199,7 +1204,7 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id) | |||
1199 | */ | 1204 | */ |
1200 | if (NULL == bd) { | 1205 | if (NULL == bd) { |
1201 | DBG(1, "null BD\n"); | 1206 | DBG(1, "null BD\n"); |
1202 | tx_ram->tx_complete = 0; | 1207 | musb_writel(&tx_ram->tx_complete, 0, 0); |
1203 | continue; | 1208 | continue; |
1204 | } | 1209 | } |
1205 | 1210 | ||
@@ -1452,7 +1457,7 @@ static int cppi_channel_abort(struct dma_channel *channel) | |||
1452 | * compare mode by writing 1 to the tx_complete register. | 1457 | * compare mode by writing 1 to the tx_complete register. |
1453 | */ | 1458 | */ |
1454 | cppi_reset_tx(tx_ram, 1); | 1459 | cppi_reset_tx(tx_ram, 1); |
1455 | cppi_ch->head = 0; | 1460 | cppi_ch->head = NULL; |
1456 | musb_writel(&tx_ram->tx_complete, 0, 1); | 1461 | musb_writel(&tx_ram->tx_complete, 0, 1); |
1457 | cppi_dump_tx(5, cppi_ch, " (done teardown)"); | 1462 | cppi_dump_tx(5, cppi_ch, " (done teardown)"); |
1458 | 1463 | ||
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 630ae7f3cd4c..f10ff00ca09e 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1030,6 +1030,7 @@ static void musb_shutdown(struct platform_device *pdev) | |||
1030 | struct musb *musb = dev_to_musb(&pdev->dev); | 1030 | struct musb *musb = dev_to_musb(&pdev->dev); |
1031 | unsigned long flags; | 1031 | unsigned long flags; |
1032 | 1032 | ||
1033 | pm_runtime_get_sync(musb->controller); | ||
1033 | spin_lock_irqsave(&musb->lock, flags); | 1034 | spin_lock_irqsave(&musb->lock, flags); |
1034 | musb_platform_disable(musb); | 1035 | musb_platform_disable(musb); |
1035 | musb_generic_disable(musb); | 1036 | musb_generic_disable(musb); |
@@ -1040,6 +1041,7 @@ static void musb_shutdown(struct platform_device *pdev) | |||
1040 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | 1041 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); |
1041 | musb_platform_exit(musb); | 1042 | musb_platform_exit(musb); |
1042 | 1043 | ||
1044 | pm_runtime_put(musb->controller); | ||
1043 | /* FIXME power down */ | 1045 | /* FIXME power down */ |
1044 | } | 1046 | } |
1045 | 1047 | ||
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 4bd9e2145ee4..0e053b587960 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -261,6 +261,7 @@ enum musb_g_ep0_state { | |||
261 | * @try_ilde: tries to idle the IP | 261 | * @try_ilde: tries to idle the IP |
262 | * @vbus_status: returns vbus status if possible | 262 | * @vbus_status: returns vbus status if possible |
263 | * @set_vbus: forces vbus status | 263 | * @set_vbus: forces vbus status |
264 | * @channel_program: pre check for standard dma channel_program func | ||
264 | */ | 265 | */ |
265 | struct musb_platform_ops { | 266 | struct musb_platform_ops { |
266 | int (*init)(struct musb *musb); | 267 | int (*init)(struct musb *musb); |
@@ -274,6 +275,10 @@ struct musb_platform_ops { | |||
274 | 275 | ||
275 | int (*vbus_status)(struct musb *musb); | 276 | int (*vbus_status)(struct musb *musb); |
276 | void (*set_vbus)(struct musb *musb, int on); | 277 | void (*set_vbus)(struct musb *musb, int on); |
278 | |||
279 | int (*adjust_channel_params)(struct dma_channel *channel, | ||
280 | u16 packet_sz, u8 *mode, | ||
281 | dma_addr_t *dma_addr, u32 *len); | ||
277 | }; | 282 | }; |
278 | 283 | ||
279 | /* | 284 | /* |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 98519c5d8b5c..6dfbf9ffd7a6 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -535,7 +535,7 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
535 | is_dma = 1; | 535 | is_dma = 1; |
536 | csr |= MUSB_TXCSR_P_WZC_BITS; | 536 | csr |= MUSB_TXCSR_P_WZC_BITS; |
537 | csr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_P_UNDERRUN | | 537 | csr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_P_UNDERRUN | |
538 | MUSB_TXCSR_TXPKTRDY); | 538 | MUSB_TXCSR_TXPKTRDY | MUSB_TXCSR_AUTOSET); |
539 | musb_writew(epio, MUSB_TXCSR, csr); | 539 | musb_writew(epio, MUSB_TXCSR, csr); |
540 | /* Ensure writebuffer is empty. */ | 540 | /* Ensure writebuffer is empty. */ |
541 | csr = musb_readw(epio, MUSB_TXCSR); | 541 | csr = musb_readw(epio, MUSB_TXCSR); |
@@ -1296,7 +1296,7 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request) | |||
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | /* if the hardware doesn't have the request, easy ... */ | 1298 | /* if the hardware doesn't have the request, easy ... */ |
1299 | if (musb_ep->req_list.next != &request->list || musb_ep->busy) | 1299 | if (musb_ep->req_list.next != &req->list || musb_ep->busy) |
1300 | musb_g_giveback(musb_ep, request, -ECONNRESET); | 1300 | musb_g_giveback(musb_ep, request, -ECONNRESET); |
1301 | 1301 | ||
1302 | /* ... else abort the dma transfer ... */ | 1302 | /* ... else abort the dma transfer ... */ |
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index 0144a2d481fd..d281792db05c 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c | |||
@@ -169,6 +169,14 @@ static int dma_channel_program(struct dma_channel *channel, | |||
169 | BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN || | 169 | BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN || |
170 | channel->status == MUSB_DMA_STATUS_BUSY); | 170 | channel->status == MUSB_DMA_STATUS_BUSY); |
171 | 171 | ||
172 | /* Let targets check/tweak the arguments */ | ||
173 | if (musb->ops->adjust_channel_params) { | ||
174 | int ret = musb->ops->adjust_channel_params(channel, | ||
175 | packet_sz, &mode, &dma_addr, &len); | ||
176 | if (ret) | ||
177 | return ret; | ||
178 | } | ||
179 | |||
172 | /* | 180 | /* |
173 | * The DMA engine in RTL1.8 and above cannot handle | 181 | * The DMA engine in RTL1.8 and above cannot handle |
174 | * DMA addresses that are not aligned to a 4 byte boundary. | 182 | * DMA addresses that are not aligned to a 4 byte boundary. |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 25cb8b0003b1..57a27fa954b4 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -259,9 +259,10 @@ static int musb_otg_notifications(struct notifier_block *nb, | |||
259 | case USB_EVENT_VBUS: | 259 | case USB_EVENT_VBUS: |
260 | DBG(4, "VBUS Connect\n"); | 260 | DBG(4, "VBUS Connect\n"); |
261 | 261 | ||
262 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
262 | if (musb->gadget_driver) | 263 | if (musb->gadget_driver) |
263 | pm_runtime_get_sync(musb->controller); | 264 | pm_runtime_get_sync(musb->controller); |
264 | 265 | #endif | |
265 | otg_init(musb->xceiv); | 266 | otg_init(musb->xceiv); |
266 | break; | 267 | break; |
267 | 268 | ||
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index d6384e4aeef9..f7e04bf34a13 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c | |||
@@ -93,6 +93,8 @@ static int __init ux500_probe(struct platform_device *pdev) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | musb->dev.parent = &pdev->dev; | 95 | musb->dev.parent = &pdev->dev; |
96 | musb->dev.dma_mask = pdev->dev.dma_mask; | ||
97 | musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; | ||
96 | 98 | ||
97 | glue->dev = &pdev->dev; | 99 | glue->dev = &pdev->dev; |
98 | glue->musb = musb; | 100 | glue->musb = musb; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index a973c7a29d6e..4de6ef0ae52a 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -151,6 +151,8 @@ static struct ftdi_sio_quirk ftdi_stmclite_quirk = { | |||
151 | * /sys/bus/usb/ftdi_sio/new_id, then send patch/report! | 151 | * /sys/bus/usb/ftdi_sio/new_id, then send patch/report! |
152 | */ | 152 | */ |
153 | static struct usb_device_id id_table_combined [] = { | 153 | static struct usb_device_id id_table_combined [] = { |
154 | { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) }, | ||
155 | { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) }, | ||
154 | { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, | 156 | { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, |
155 | { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, | 157 | { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, |
156 | { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, | 158 | { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, |
@@ -525,6 +527,7 @@ static struct usb_device_id id_table_combined [] = { | |||
525 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, | 527 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, |
526 | { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, | 528 | { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, |
527 | { USB_DEVICE(OCT_VID, OCT_US101_PID) }, | 529 | { USB_DEVICE(OCT_VID, OCT_US101_PID) }, |
530 | { USB_DEVICE(OCT_VID, OCT_DK201_PID) }, | ||
528 | { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID), | 531 | { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID), |
529 | .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk }, | 532 | .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk }, |
530 | { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID), | 533 | { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID), |
@@ -787,6 +790,8 @@ static struct usb_device_id id_table_combined [] = { | |||
787 | { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), | 790 | { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), |
788 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 791 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
789 | { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) }, | 792 | { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) }, |
793 | { USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) }, | ||
794 | { USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) }, | ||
790 | { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) }, | 795 | { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) }, |
791 | { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) }, | 796 | { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) }, |
792 | { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, | 797 | { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index c543e55bafba..efffc23723bd 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -300,6 +300,8 @@ | |||
300 | * Hameg HO820 and HO870 interface (using VID 0x0403) | 300 | * Hameg HO820 and HO870 interface (using VID 0x0403) |
301 | */ | 301 | */ |
302 | #define HAMEG_HO820_PID 0xed74 | 302 | #define HAMEG_HO820_PID 0xed74 |
303 | #define HAMEG_HO730_PID 0xed73 | ||
304 | #define HAMEG_HO720_PID 0xed72 | ||
303 | #define HAMEG_HO870_PID 0xed71 | 305 | #define HAMEG_HO870_PID 0xed71 |
304 | 306 | ||
305 | /* | 307 | /* |
@@ -572,6 +574,7 @@ | |||
572 | /* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */ | 574 | /* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */ |
573 | /* Also rebadged as Dick Smith Electronics (Aus) XH6451 */ | 575 | /* Also rebadged as Dick Smith Electronics (Aus) XH6451 */ |
574 | /* Also rebadged as SIIG Inc. model US2308 hardware version 1 */ | 576 | /* Also rebadged as SIIG Inc. model US2308 hardware version 1 */ |
577 | #define OCT_DK201_PID 0x0103 /* OCT DK201 USB docking station */ | ||
575 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ | 578 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ |
576 | 579 | ||
577 | /* | 580 | /* |
@@ -1141,3 +1144,12 @@ | |||
1141 | #define QIHARDWARE_VID 0x20B7 | 1144 | #define QIHARDWARE_VID 0x20B7 |
1142 | #define MILKYMISTONE_JTAGSERIAL_PID 0x0713 | 1145 | #define MILKYMISTONE_JTAGSERIAL_PID 0x0713 |
1143 | 1146 | ||
1147 | /* | ||
1148 | * CTI GmbH RS485 Converter http://www.cti-lean.com/ | ||
1149 | */ | ||
1150 | /* USB-485-Mini*/ | ||
1151 | #define FTDI_CTI_MINI_PID 0xF608 | ||
1152 | /* USB-Nano-485*/ | ||
1153 | #define FTDI_CTI_NANO_PID 0xF60B | ||
1154 | |||
1155 | |||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 75c7f456eed5..d77ff0435896 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -407,6 +407,10 @@ static void option_instat_callback(struct urb *urb); | |||
407 | /* ONDA MT825UP HSDPA 14.2 modem */ | 407 | /* ONDA MT825UP HSDPA 14.2 modem */ |
408 | #define ONDA_MT825UP 0x000b | 408 | #define ONDA_MT825UP 0x000b |
409 | 409 | ||
410 | /* Samsung products */ | ||
411 | #define SAMSUNG_VENDOR_ID 0x04e8 | ||
412 | #define SAMSUNG_PRODUCT_GT_B3730 0x6889 | ||
413 | |||
410 | /* some devices interfaces need special handling due to a number of reasons */ | 414 | /* some devices interfaces need special handling due to a number of reasons */ |
411 | enum option_blacklist_reason { | 415 | enum option_blacklist_reason { |
412 | OPTION_BLACKLIST_NONE = 0, | 416 | OPTION_BLACKLIST_NONE = 0, |
@@ -968,6 +972,7 @@ static const struct usb_device_id option_ids[] = { | |||
968 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, | 972 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, |
969 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ | 973 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
970 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ | 974 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ |
975 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730/GT-B3710 LTE USB modem.*/ | ||
971 | { } /* Terminating entry */ | 976 | { } /* Terminating entry */ |
972 | }; | 977 | }; |
973 | MODULE_DEVICE_TABLE(usb, option_ids); | 978 | MODULE_DEVICE_TABLE(usb, option_ids); |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 8858201eb1d3..54a9dab1f33b 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -111,7 +111,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
111 | ifnum = intf->desc.bInterfaceNumber; | 111 | ifnum = intf->desc.bInterfaceNumber; |
112 | dbg("This Interface = %d", ifnum); | 112 | dbg("This Interface = %d", ifnum); |
113 | 113 | ||
114 | data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), | 114 | data = kzalloc(sizeof(struct usb_wwan_intf_private), |
115 | GFP_KERNEL); | 115 | GFP_KERNEL); |
116 | if (!data) | 116 | if (!data) |
117 | return -ENOMEM; | 117 | return -ENOMEM; |
@@ -134,8 +134,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
134 | usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) { | 134 | usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) { |
135 | dbg("QDL port found"); | 135 | dbg("QDL port found"); |
136 | 136 | ||
137 | if (serial->interface->num_altsetting == 1) | 137 | if (serial->interface->num_altsetting == 1) { |
138 | return 0; | 138 | retval = 0; /* Success */ |
139 | break; | ||
140 | } | ||
139 | 141 | ||
140 | retval = usb_set_interface(serial->dev, ifnum, 1); | 142 | retval = usb_set_interface(serial->dev, ifnum, 1); |
141 | if (retval < 0) { | 143 | if (retval < 0) { |
@@ -145,7 +147,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
145 | retval = -ENODEV; | 147 | retval = -ENODEV; |
146 | kfree(data); | 148 | kfree(data); |
147 | } | 149 | } |
148 | return retval; | ||
149 | } | 150 | } |
150 | break; | 151 | break; |
151 | 152 | ||
@@ -166,6 +167,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
166 | "Could not set interface, error %d\n", | 167 | "Could not set interface, error %d\n", |
167 | retval); | 168 | retval); |
168 | retval = -ENODEV; | 169 | retval = -ENODEV; |
170 | kfree(data); | ||
169 | } | 171 | } |
170 | } else if (ifnum == 2) { | 172 | } else if (ifnum == 2) { |
171 | dbg("Modem port found"); | 173 | dbg("Modem port found"); |
@@ -177,7 +179,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
177 | retval = -ENODEV; | 179 | retval = -ENODEV; |
178 | kfree(data); | 180 | kfree(data); |
179 | } | 181 | } |
180 | return retval; | ||
181 | } else if (ifnum==3) { | 182 | } else if (ifnum==3) { |
182 | /* | 183 | /* |
183 | * NMEA (serial line 9600 8N1) | 184 | * NMEA (serial line 9600 8N1) |
@@ -191,6 +192,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
191 | "Could not set interface, error %d\n", | 192 | "Could not set interface, error %d\n", |
192 | retval); | 193 | retval); |
193 | retval = -ENODEV; | 194 | retval = -ENODEV; |
195 | kfree(data); | ||
194 | } | 196 | } |
195 | } | 197 | } |
196 | break; | 198 | break; |
@@ -199,12 +201,27 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
199 | dev_err(&serial->dev->dev, | 201 | dev_err(&serial->dev->dev, |
200 | "unknown number of interfaces: %d\n", nintf); | 202 | "unknown number of interfaces: %d\n", nintf); |
201 | kfree(data); | 203 | kfree(data); |
202 | return -ENODEV; | 204 | retval = -ENODEV; |
203 | } | 205 | } |
204 | 206 | ||
207 | /* Set serial->private if not returning -ENODEV */ | ||
208 | if (retval != -ENODEV) | ||
209 | usb_set_serial_data(serial, data); | ||
205 | return retval; | 210 | return retval; |
206 | } | 211 | } |
207 | 212 | ||
213 | static void qc_release(struct usb_serial *serial) | ||
214 | { | ||
215 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); | ||
216 | |||
217 | dbg("%s", __func__); | ||
218 | |||
219 | /* Call usb_wwan release & free the private data allocated in qcprobe */ | ||
220 | usb_wwan_release(serial); | ||
221 | usb_set_serial_data(serial, NULL); | ||
222 | kfree(priv); | ||
223 | } | ||
224 | |||
208 | static struct usb_serial_driver qcdevice = { | 225 | static struct usb_serial_driver qcdevice = { |
209 | .driver = { | 226 | .driver = { |
210 | .owner = THIS_MODULE, | 227 | .owner = THIS_MODULE, |
@@ -222,7 +239,7 @@ static struct usb_serial_driver qcdevice = { | |||
222 | .chars_in_buffer = usb_wwan_chars_in_buffer, | 239 | .chars_in_buffer = usb_wwan_chars_in_buffer, |
223 | .attach = usb_wwan_startup, | 240 | .attach = usb_wwan_startup, |
224 | .disconnect = usb_wwan_disconnect, | 241 | .disconnect = usb_wwan_disconnect, |
225 | .release = usb_wwan_release, | 242 | .release = qc_release, |
226 | #ifdef CONFIG_PM | 243 | #ifdef CONFIG_PM |
227 | .suspend = usb_wwan_suspend, | 244 | .suspend = usb_wwan_suspend, |
228 | .resume = usb_wwan_resume, | 245 | .resume = usb_wwan_resume, |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index a2e5b5100ab4..0f4e8c942f9e 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -1648,7 +1648,9 @@ pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data) | |||
1648 | 1648 | ||
1649 | switch (val) { | 1649 | switch (val) { |
1650 | case CPUFREQ_PRECHANGE: | 1650 | case CPUFREQ_PRECHANGE: |
1651 | if (!fbi->overlay[0].usage && !fbi->overlay[1].usage) | 1651 | #ifdef CONFIG_FB_PXA_OVERLAY |
1652 | if (!(fbi->overlay[0].usage || fbi->overlay[1].usage)) | ||
1653 | #endif | ||
1652 | set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE); | 1654 | set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE); |
1653 | break; | 1655 | break; |
1654 | 1656 | ||
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 4fb5b2bf2348..4bcc8b82640b 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -590,15 +590,10 @@ static struct virtio_config_ops virtio_pci_config_ops = { | |||
590 | 590 | ||
591 | static void virtio_pci_release_dev(struct device *_d) | 591 | static void virtio_pci_release_dev(struct device *_d) |
592 | { | 592 | { |
593 | struct virtio_device *dev = container_of(_d, struct virtio_device, dev); | 593 | struct virtio_device *dev = container_of(_d, struct virtio_device, |
594 | dev); | ||
594 | struct virtio_pci_device *vp_dev = to_vp_device(dev); | 595 | struct virtio_pci_device *vp_dev = to_vp_device(dev); |
595 | struct pci_dev *pci_dev = vp_dev->pci_dev; | ||
596 | 596 | ||
597 | vp_del_vqs(dev); | ||
598 | pci_set_drvdata(pci_dev, NULL); | ||
599 | pci_iounmap(pci_dev, vp_dev->ioaddr); | ||
600 | pci_release_regions(pci_dev); | ||
601 | pci_disable_device(pci_dev); | ||
602 | kfree(vp_dev); | 597 | kfree(vp_dev); |
603 | } | 598 | } |
604 | 599 | ||
@@ -681,6 +676,12 @@ static void __devexit virtio_pci_remove(struct pci_dev *pci_dev) | |||
681 | struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); | 676 | struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); |
682 | 677 | ||
683 | unregister_virtio_device(&vp_dev->vdev); | 678 | unregister_virtio_device(&vp_dev->vdev); |
679 | |||
680 | vp_del_vqs(&vp_dev->vdev); | ||
681 | pci_set_drvdata(pci_dev, NULL); | ||
682 | pci_iounmap(pci_dev, vp_dev->ioaddr); | ||
683 | pci_release_regions(pci_dev); | ||
684 | pci_disable_device(pci_dev); | ||
684 | } | 685 | } |
685 | 686 | ||
686 | #ifdef CONFIG_PM | 687 | #ifdef CONFIG_PM |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index cc2f73e03475..b0043fb26a4d 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -371,6 +371,7 @@ void *virtqueue_detach_unused_buf(struct virtqueue *_vq) | |||
371 | /* detach_buf clears data, so grab it now. */ | 371 | /* detach_buf clears data, so grab it now. */ |
372 | buf = vq->data[i]; | 372 | buf = vq->data[i]; |
373 | detach_buf(vq, i); | 373 | detach_buf(vq, i); |
374 | vq->vring.avail->idx--; | ||
374 | END_USE(vq); | 375 | END_USE(vq); |
375 | return buf; | 376 | return buf; |
376 | } | 377 | } |
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index 35a0d12dad73..5fd020da7c55 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -35,6 +35,7 @@ | |||
35 | * document number 324645-001, 324646-001: Cougar Point (CPT) | 35 | * document number 324645-001, 324646-001: Cougar Point (CPT) |
36 | * document number TBD : Patsburg (PBG) | 36 | * document number TBD : Patsburg (PBG) |
37 | * document number TBD : DH89xxCC | 37 | * document number TBD : DH89xxCC |
38 | * document number TBD : Panther Point | ||
38 | */ | 39 | */ |
39 | 40 | ||
40 | /* | 41 | /* |
@@ -153,6 +154,38 @@ enum iTCO_chipsets { | |||
153 | TCO_PBG1, /* Patsburg */ | 154 | TCO_PBG1, /* Patsburg */ |
154 | TCO_PBG2, /* Patsburg */ | 155 | TCO_PBG2, /* Patsburg */ |
155 | TCO_DH89XXCC, /* DH89xxCC */ | 156 | TCO_DH89XXCC, /* DH89xxCC */ |
157 | TCO_PPT0, /* Panther Point */ | ||
158 | TCO_PPT1, /* Panther Point */ | ||
159 | TCO_PPT2, /* Panther Point */ | ||
160 | TCO_PPT3, /* Panther Point */ | ||
161 | TCO_PPT4, /* Panther Point */ | ||
162 | TCO_PPT5, /* Panther Point */ | ||
163 | TCO_PPT6, /* Panther Point */ | ||
164 | TCO_PPT7, /* Panther Point */ | ||
165 | TCO_PPT8, /* Panther Point */ | ||
166 | TCO_PPT9, /* Panther Point */ | ||
167 | TCO_PPT10, /* Panther Point */ | ||
168 | TCO_PPT11, /* Panther Point */ | ||
169 | TCO_PPT12, /* Panther Point */ | ||
170 | TCO_PPT13, /* Panther Point */ | ||
171 | TCO_PPT14, /* Panther Point */ | ||
172 | TCO_PPT15, /* Panther Point */ | ||
173 | TCO_PPT16, /* Panther Point */ | ||
174 | TCO_PPT17, /* Panther Point */ | ||
175 | TCO_PPT18, /* Panther Point */ | ||
176 | TCO_PPT19, /* Panther Point */ | ||
177 | TCO_PPT20, /* Panther Point */ | ||
178 | TCO_PPT21, /* Panther Point */ | ||
179 | TCO_PPT22, /* Panther Point */ | ||
180 | TCO_PPT23, /* Panther Point */ | ||
181 | TCO_PPT24, /* Panther Point */ | ||
182 | TCO_PPT25, /* Panther Point */ | ||
183 | TCO_PPT26, /* Panther Point */ | ||
184 | TCO_PPT27, /* Panther Point */ | ||
185 | TCO_PPT28, /* Panther Point */ | ||
186 | TCO_PPT29, /* Panther Point */ | ||
187 | TCO_PPT30, /* Panther Point */ | ||
188 | TCO_PPT31, /* Panther Point */ | ||
156 | }; | 189 | }; |
157 | 190 | ||
158 | static struct { | 191 | static struct { |
@@ -244,6 +277,38 @@ static struct { | |||
244 | {"Patsburg", 2}, | 277 | {"Patsburg", 2}, |
245 | {"Patsburg", 2}, | 278 | {"Patsburg", 2}, |
246 | {"DH89xxCC", 2}, | 279 | {"DH89xxCC", 2}, |
280 | {"Panther Point", 2}, | ||
281 | {"Panther Point", 2}, | ||
282 | {"Panther Point", 2}, | ||
283 | {"Panther Point", 2}, | ||
284 | {"Panther Point", 2}, | ||
285 | {"Panther Point", 2}, | ||
286 | {"Panther Point", 2}, | ||
287 | {"Panther Point", 2}, | ||
288 | {"Panther Point", 2}, | ||
289 | {"Panther Point", 2}, | ||
290 | {"Panther Point", 2}, | ||
291 | {"Panther Point", 2}, | ||
292 | {"Panther Point", 2}, | ||
293 | {"Panther Point", 2}, | ||
294 | {"Panther Point", 2}, | ||
295 | {"Panther Point", 2}, | ||
296 | {"Panther Point", 2}, | ||
297 | {"Panther Point", 2}, | ||
298 | {"Panther Point", 2}, | ||
299 | {"Panther Point", 2}, | ||
300 | {"Panther Point", 2}, | ||
301 | {"Panther Point", 2}, | ||
302 | {"Panther Point", 2}, | ||
303 | {"Panther Point", 2}, | ||
304 | {"Panther Point", 2}, | ||
305 | {"Panther Point", 2}, | ||
306 | {"Panther Point", 2}, | ||
307 | {"Panther Point", 2}, | ||
308 | {"Panther Point", 2}, | ||
309 | {"Panther Point", 2}, | ||
310 | {"Panther Point", 2}, | ||
311 | {"Panther Point", 2}, | ||
247 | {NULL, 0} | 312 | {NULL, 0} |
248 | }; | 313 | }; |
249 | 314 | ||
@@ -363,6 +428,38 @@ static DEFINE_PCI_DEVICE_TABLE(iTCO_wdt_pci_tbl) = { | |||
363 | { ITCO_PCI_DEVICE(0x1d40, TCO_PBG1)}, | 428 | { ITCO_PCI_DEVICE(0x1d40, TCO_PBG1)}, |
364 | { ITCO_PCI_DEVICE(0x1d41, TCO_PBG2)}, | 429 | { ITCO_PCI_DEVICE(0x1d41, TCO_PBG2)}, |
365 | { ITCO_PCI_DEVICE(0x2310, TCO_DH89XXCC)}, | 430 | { ITCO_PCI_DEVICE(0x2310, TCO_DH89XXCC)}, |
431 | { ITCO_PCI_DEVICE(0x1e40, TCO_PPT0)}, | ||
432 | { ITCO_PCI_DEVICE(0x1e41, TCO_PPT1)}, | ||
433 | { ITCO_PCI_DEVICE(0x1e42, TCO_PPT2)}, | ||
434 | { ITCO_PCI_DEVICE(0x1e43, TCO_PPT3)}, | ||
435 | { ITCO_PCI_DEVICE(0x1e44, TCO_PPT4)}, | ||
436 | { ITCO_PCI_DEVICE(0x1e45, TCO_PPT5)}, | ||
437 | { ITCO_PCI_DEVICE(0x1e46, TCO_PPT6)}, | ||
438 | { ITCO_PCI_DEVICE(0x1e47, TCO_PPT7)}, | ||
439 | { ITCO_PCI_DEVICE(0x1e48, TCO_PPT8)}, | ||
440 | { ITCO_PCI_DEVICE(0x1e49, TCO_PPT9)}, | ||
441 | { ITCO_PCI_DEVICE(0x1e4a, TCO_PPT10)}, | ||
442 | { ITCO_PCI_DEVICE(0x1e4b, TCO_PPT11)}, | ||
443 | { ITCO_PCI_DEVICE(0x1e4c, TCO_PPT12)}, | ||
444 | { ITCO_PCI_DEVICE(0x1e4d, TCO_PPT13)}, | ||
445 | { ITCO_PCI_DEVICE(0x1e4e, TCO_PPT14)}, | ||
446 | { ITCO_PCI_DEVICE(0x1e4f, TCO_PPT15)}, | ||
447 | { ITCO_PCI_DEVICE(0x1e50, TCO_PPT16)}, | ||
448 | { ITCO_PCI_DEVICE(0x1e51, TCO_PPT17)}, | ||
449 | { ITCO_PCI_DEVICE(0x1e52, TCO_PPT18)}, | ||
450 | { ITCO_PCI_DEVICE(0x1e53, TCO_PPT19)}, | ||
451 | { ITCO_PCI_DEVICE(0x1e54, TCO_PPT20)}, | ||
452 | { ITCO_PCI_DEVICE(0x1e55, TCO_PPT21)}, | ||
453 | { ITCO_PCI_DEVICE(0x1e56, TCO_PPT22)}, | ||
454 | { ITCO_PCI_DEVICE(0x1e57, TCO_PPT23)}, | ||
455 | { ITCO_PCI_DEVICE(0x1e58, TCO_PPT24)}, | ||
456 | { ITCO_PCI_DEVICE(0x1e59, TCO_PPT25)}, | ||
457 | { ITCO_PCI_DEVICE(0x1e5a, TCO_PPT26)}, | ||
458 | { ITCO_PCI_DEVICE(0x1e5b, TCO_PPT27)}, | ||
459 | { ITCO_PCI_DEVICE(0x1e5c, TCO_PPT28)}, | ||
460 | { ITCO_PCI_DEVICE(0x1e5d, TCO_PPT29)}, | ||
461 | { ITCO_PCI_DEVICE(0x1e5e, TCO_PPT30)}, | ||
462 | { ITCO_PCI_DEVICE(0x1e5f, TCO_PPT31)}, | ||
366 | { 0, }, /* End of list */ | 463 | { 0, }, /* End of list */ |
367 | }; | 464 | }; |
368 | MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl); | 465 | MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl); |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 42d6c930cc87..33167b43ac7e 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -912,8 +912,7 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn, | |||
912 | unsigned long irqflags, | 912 | unsigned long irqflags, |
913 | const char *devname, void *dev_id) | 913 | const char *devname, void *dev_id) |
914 | { | 914 | { |
915 | unsigned int irq; | 915 | int irq, retval; |
916 | int retval; | ||
917 | 916 | ||
918 | irq = bind_evtchn_to_irq(evtchn); | 917 | irq = bind_evtchn_to_irq(evtchn); |
919 | if (irq < 0) | 918 | if (irq < 0) |
@@ -955,8 +954,7 @@ int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, | |||
955 | irq_handler_t handler, | 954 | irq_handler_t handler, |
956 | unsigned long irqflags, const char *devname, void *dev_id) | 955 | unsigned long irqflags, const char *devname, void *dev_id) |
957 | { | 956 | { |
958 | unsigned int irq; | 957 | int irq, retval; |
959 | int retval; | ||
960 | 958 | ||
961 | irq = bind_virq_to_irq(virq, cpu); | 959 | irq = bind_virq_to_irq(virq, cpu); |
962 | if (irq < 0) | 960 | if (irq < 0) |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 95143dd6904d..a2eee574784e 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/sysrq.h> | 8 | #include <linux/sysrq.h> |
9 | #include <linux/stop_machine.h> | 9 | #include <linux/stop_machine.h> |
10 | #include <linux/freezer.h> | 10 | #include <linux/freezer.h> |
11 | #include <linux/syscore_ops.h> | ||
11 | 12 | ||
12 | #include <xen/xen.h> | 13 | #include <xen/xen.h> |
13 | #include <xen/xenbus.h> | 14 | #include <xen/xenbus.h> |
@@ -61,7 +62,7 @@ static void xen_post_suspend(int cancelled) | |||
61 | xen_mm_unpin_all(); | 62 | xen_mm_unpin_all(); |
62 | } | 63 | } |
63 | 64 | ||
64 | #ifdef CONFIG_HIBERNATION | 65 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
65 | static int xen_suspend(void *data) | 66 | static int xen_suspend(void *data) |
66 | { | 67 | { |
67 | struct suspend_info *si = data; | 68 | struct suspend_info *si = data; |
@@ -70,8 +71,13 @@ static int xen_suspend(void *data) | |||
70 | BUG_ON(!irqs_disabled()); | 71 | BUG_ON(!irqs_disabled()); |
71 | 72 | ||
72 | err = sysdev_suspend(PMSG_FREEZE); | 73 | err = sysdev_suspend(PMSG_FREEZE); |
74 | if (!err) { | ||
75 | err = syscore_suspend(); | ||
76 | if (err) | ||
77 | sysdev_resume(); | ||
78 | } | ||
73 | if (err) { | 79 | if (err) { |
74 | printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", | 80 | printk(KERN_ERR "xen_suspend: system core suspend failed: %d\n", |
75 | err); | 81 | err); |
76 | return err; | 82 | return err; |
77 | } | 83 | } |
@@ -95,6 +101,7 @@ static int xen_suspend(void *data) | |||
95 | xen_timer_resume(); | 101 | xen_timer_resume(); |
96 | } | 102 | } |
97 | 103 | ||
104 | syscore_resume(); | ||
98 | sysdev_resume(); | 105 | sysdev_resume(); |
99 | 106 | ||
100 | return 0; | 107 | return 0; |
@@ -173,7 +180,7 @@ out: | |||
173 | #endif | 180 | #endif |
174 | shutting_down = SHUTDOWN_INVALID; | 181 | shutting_down = SHUTDOWN_INVALID; |
175 | } | 182 | } |
176 | #endif /* CONFIG_HIBERNATION */ | 183 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ |
177 | 184 | ||
178 | struct shutdown_handler { | 185 | struct shutdown_handler { |
179 | const char *command; | 186 | const char *command; |
@@ -202,7 +209,7 @@ static void shutdown_handler(struct xenbus_watch *watch, | |||
202 | { "poweroff", do_poweroff }, | 209 | { "poweroff", do_poweroff }, |
203 | { "halt", do_poweroff }, | 210 | { "halt", do_poweroff }, |
204 | { "reboot", do_reboot }, | 211 | { "reboot", do_reboot }, |
205 | #ifdef CONFIG_HIBERNATION | 212 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
206 | { "suspend", do_suspend }, | 213 | { "suspend", do_suspend }, |
207 | #endif | 214 | #endif |
208 | {NULL, NULL}, | 215 | {NULL, NULL}, |
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index 0ee594569dcc..85b67ffa2a43 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -286,11 +286,9 @@ static struct p9_fid *v9fs_fid_clone_with_uid(struct dentry *dentry, uid_t uid) | |||
286 | 286 | ||
287 | struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) | 287 | struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) |
288 | { | 288 | { |
289 | int err, flags; | 289 | int err; |
290 | struct p9_fid *fid; | 290 | struct p9_fid *fid; |
291 | struct v9fs_session_info *v9ses; | ||
292 | 291 | ||
293 | v9ses = v9fs_dentry2v9ses(dentry); | ||
294 | fid = v9fs_fid_clone_with_uid(dentry, 0); | 292 | fid = v9fs_fid_clone_with_uid(dentry, 0); |
295 | if (IS_ERR(fid)) | 293 | if (IS_ERR(fid)) |
296 | goto error_out; | 294 | goto error_out; |
@@ -299,17 +297,8 @@ struct p9_fid *v9fs_writeback_fid(struct dentry *dentry) | |||
299 | * dirty pages. We always request for the open fid in read-write | 297 | * dirty pages. We always request for the open fid in read-write |
300 | * mode so that a partial page write which result in page | 298 | * mode so that a partial page write which result in page |
301 | * read can work. | 299 | * read can work. |
302 | * | ||
303 | * we don't have a tsyncfs operation for older version | ||
304 | * of protocol. So make sure the write back fid is | ||
305 | * opened in O_SYNC mode. | ||
306 | */ | 300 | */ |
307 | if (!v9fs_proto_dotl(v9ses)) | 301 | err = p9_client_open(fid, O_RDWR); |
308 | flags = O_RDWR | O_SYNC; | ||
309 | else | ||
310 | flags = O_RDWR; | ||
311 | |||
312 | err = p9_client_open(fid, flags); | ||
313 | if (err < 0) { | 302 | if (err < 0) { |
314 | p9_client_clunk(fid); | 303 | p9_client_clunk(fid); |
315 | fid = ERR_PTR(err); | 304 | fid = ERR_PTR(err); |
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index 9665c2b840e6..e5ebedfc5ed8 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h | |||
@@ -116,7 +116,6 @@ struct v9fs_session_info { | |||
116 | struct list_head slist; /* list of sessions registered with v9fs */ | 116 | struct list_head slist; /* list of sessions registered with v9fs */ |
117 | struct backing_dev_info bdi; | 117 | struct backing_dev_info bdi; |
118 | struct rw_semaphore rename_sem; | 118 | struct rw_semaphore rename_sem; |
119 | struct p9_fid *root_fid; /* Used for file system sync */ | ||
120 | }; | 119 | }; |
121 | 120 | ||
122 | /* cache_validity flags */ | 121 | /* cache_validity flags */ |
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index b6a3b9f7fe4d..e022890c6f40 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c | |||
@@ -126,7 +126,9 @@ static int v9fs_lookup_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
126 | retval = v9fs_refresh_inode_dotl(fid, inode); | 126 | retval = v9fs_refresh_inode_dotl(fid, inode); |
127 | else | 127 | else |
128 | retval = v9fs_refresh_inode(fid, inode); | 128 | retval = v9fs_refresh_inode(fid, inode); |
129 | if (retval <= 0) | 129 | if (retval == -ENOENT) |
130 | return 0; | ||
131 | if (retval < 0) | ||
130 | return retval; | 132 | return retval; |
131 | } | 133 | } |
132 | out_valid: | 134 | out_valid: |
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index ffbb113d5f33..82a7c38ddad0 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
@@ -811,7 +811,7 @@ v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd) | |||
811 | fid = v9fs_fid_lookup(dentry); | 811 | fid = v9fs_fid_lookup(dentry); |
812 | if (IS_ERR(fid)) { | 812 | if (IS_ERR(fid)) { |
813 | __putname(link); | 813 | __putname(link); |
814 | link = ERR_PTR(PTR_ERR(fid)); | 814 | link = ERR_CAST(fid); |
815 | goto ndset; | 815 | goto ndset; |
816 | } | 816 | } |
817 | retval = p9_client_readlink(fid, &target); | 817 | retval = p9_client_readlink(fid, &target); |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index f3eed3383e4f..feef6cdc1fd2 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -154,6 +154,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, | |||
154 | retval = PTR_ERR(inode); | 154 | retval = PTR_ERR(inode); |
155 | goto release_sb; | 155 | goto release_sb; |
156 | } | 156 | } |
157 | |||
157 | root = d_alloc_root(inode); | 158 | root = d_alloc_root(inode); |
158 | if (!root) { | 159 | if (!root) { |
159 | iput(inode); | 160 | iput(inode); |
@@ -185,21 +186,10 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, | |||
185 | p9stat_free(st); | 186 | p9stat_free(st); |
186 | kfree(st); | 187 | kfree(st); |
187 | } | 188 | } |
188 | v9fs_fid_add(root, fid); | ||
189 | retval = v9fs_get_acl(inode, fid); | 189 | retval = v9fs_get_acl(inode, fid); |
190 | if (retval) | 190 | if (retval) |
191 | goto release_sb; | 191 | goto release_sb; |
192 | /* | 192 | v9fs_fid_add(root, fid); |
193 | * Add the root fid to session info. This is used | ||
194 | * for file system sync. We want a cloned fid here | ||
195 | * so that we can do a sync_filesystem after a | ||
196 | * shrink_dcache_for_umount | ||
197 | */ | ||
198 | v9ses->root_fid = v9fs_fid_clone(root); | ||
199 | if (IS_ERR(v9ses->root_fid)) { | ||
200 | retval = PTR_ERR(v9ses->root_fid); | ||
201 | goto release_sb; | ||
202 | } | ||
203 | 193 | ||
204 | P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); | 194 | P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); |
205 | return dget(sb->s_root); | 195 | return dget(sb->s_root); |
@@ -210,11 +200,15 @@ close_session: | |||
210 | v9fs_session_close(v9ses); | 200 | v9fs_session_close(v9ses); |
211 | kfree(v9ses); | 201 | kfree(v9ses); |
212 | return ERR_PTR(retval); | 202 | return ERR_PTR(retval); |
203 | |||
213 | release_sb: | 204 | release_sb: |
214 | /* | 205 | /* |
215 | * we will do the session_close and root dentry | 206 | * we will do the session_close and root dentry release |
216 | * release in the below call. | 207 | * in the below call. But we need to clunk fid, because we haven't |
208 | * attached the fid to dentry so it won't get clunked | ||
209 | * automatically. | ||
217 | */ | 210 | */ |
211 | p9_client_clunk(fid); | ||
218 | deactivate_locked_super(sb); | 212 | deactivate_locked_super(sb); |
219 | return ERR_PTR(retval); | 213 | return ERR_PTR(retval); |
220 | } | 214 | } |
@@ -232,7 +226,7 @@ static void v9fs_kill_super(struct super_block *s) | |||
232 | P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s); | 226 | P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s); |
233 | 227 | ||
234 | kill_anon_super(s); | 228 | kill_anon_super(s); |
235 | p9_client_clunk(v9ses->root_fid); | 229 | |
236 | v9fs_session_cancel(v9ses); | 230 | v9fs_session_cancel(v9ses); |
237 | v9fs_session_close(v9ses); | 231 | v9fs_session_close(v9ses); |
238 | kfree(v9ses); | 232 | kfree(v9ses); |
@@ -285,14 +279,6 @@ done: | |||
285 | return res; | 279 | return res; |
286 | } | 280 | } |
287 | 281 | ||
288 | static int v9fs_sync_fs(struct super_block *sb, int wait) | ||
289 | { | ||
290 | struct v9fs_session_info *v9ses = sb->s_fs_info; | ||
291 | |||
292 | P9_DPRINTK(P9_DEBUG_VFS, "v9fs_sync_fs: super_block %p\n", sb); | ||
293 | return p9_client_sync_fs(v9ses->root_fid); | ||
294 | } | ||
295 | |||
296 | static int v9fs_drop_inode(struct inode *inode) | 282 | static int v9fs_drop_inode(struct inode *inode) |
297 | { | 283 | { |
298 | struct v9fs_session_info *v9ses; | 284 | struct v9fs_session_info *v9ses; |
@@ -307,6 +293,51 @@ static int v9fs_drop_inode(struct inode *inode) | |||
307 | return 1; | 293 | return 1; |
308 | } | 294 | } |
309 | 295 | ||
296 | static int v9fs_write_inode(struct inode *inode, | ||
297 | struct writeback_control *wbc) | ||
298 | { | ||
299 | int ret; | ||
300 | struct p9_wstat wstat; | ||
301 | struct v9fs_inode *v9inode; | ||
302 | /* | ||
303 | * send an fsync request to server irrespective of | ||
304 | * wbc->sync_mode. | ||
305 | */ | ||
306 | P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode); | ||
307 | v9inode = V9FS_I(inode); | ||
308 | if (!v9inode->writeback_fid) | ||
309 | return 0; | ||
310 | v9fs_blank_wstat(&wstat); | ||
311 | |||
312 | ret = p9_client_wstat(v9inode->writeback_fid, &wstat); | ||
313 | if (ret < 0) { | ||
314 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); | ||
315 | return ret; | ||
316 | } | ||
317 | return 0; | ||
318 | } | ||
319 | |||
320 | static int v9fs_write_inode_dotl(struct inode *inode, | ||
321 | struct writeback_control *wbc) | ||
322 | { | ||
323 | int ret; | ||
324 | struct v9fs_inode *v9inode; | ||
325 | /* | ||
326 | * send an fsync request to server irrespective of | ||
327 | * wbc->sync_mode. | ||
328 | */ | ||
329 | P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode); | ||
330 | v9inode = V9FS_I(inode); | ||
331 | if (!v9inode->writeback_fid) | ||
332 | return 0; | ||
333 | ret = p9_client_fsync(v9inode->writeback_fid, 0); | ||
334 | if (ret < 0) { | ||
335 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); | ||
336 | return ret; | ||
337 | } | ||
338 | return 0; | ||
339 | } | ||
340 | |||
310 | static const struct super_operations v9fs_super_ops = { | 341 | static const struct super_operations v9fs_super_ops = { |
311 | .alloc_inode = v9fs_alloc_inode, | 342 | .alloc_inode = v9fs_alloc_inode, |
312 | .destroy_inode = v9fs_destroy_inode, | 343 | .destroy_inode = v9fs_destroy_inode, |
@@ -314,17 +345,18 @@ static const struct super_operations v9fs_super_ops = { | |||
314 | .evict_inode = v9fs_evict_inode, | 345 | .evict_inode = v9fs_evict_inode, |
315 | .show_options = generic_show_options, | 346 | .show_options = generic_show_options, |
316 | .umount_begin = v9fs_umount_begin, | 347 | .umount_begin = v9fs_umount_begin, |
348 | .write_inode = v9fs_write_inode, | ||
317 | }; | 349 | }; |
318 | 350 | ||
319 | static const struct super_operations v9fs_super_ops_dotl = { | 351 | static const struct super_operations v9fs_super_ops_dotl = { |
320 | .alloc_inode = v9fs_alloc_inode, | 352 | .alloc_inode = v9fs_alloc_inode, |
321 | .destroy_inode = v9fs_destroy_inode, | 353 | .destroy_inode = v9fs_destroy_inode, |
322 | .sync_fs = v9fs_sync_fs, | ||
323 | .statfs = v9fs_statfs, | 354 | .statfs = v9fs_statfs, |
324 | .drop_inode = v9fs_drop_inode, | 355 | .drop_inode = v9fs_drop_inode, |
325 | .evict_inode = v9fs_evict_inode, | 356 | .evict_inode = v9fs_evict_inode, |
326 | .show_options = generic_show_options, | 357 | .show_options = generic_show_options, |
327 | .umount_begin = v9fs_umount_begin, | 358 | .umount_begin = v9fs_umount_begin, |
359 | .write_inode = v9fs_write_inode_dotl, | ||
328 | }; | 360 | }; |
329 | 361 | ||
330 | struct file_system_type v9fs_fs_type = { | 362 | struct file_system_type v9fs_fs_type = { |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index f34078d702d3..303983fabfd6 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -941,9 +941,13 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
941 | current->mm->start_stack = bprm->p; | 941 | current->mm->start_stack = bprm->p; |
942 | 942 | ||
943 | #ifdef arch_randomize_brk | 943 | #ifdef arch_randomize_brk |
944 | if ((current->flags & PF_RANDOMIZE) && (randomize_va_space > 1)) | 944 | if ((current->flags & PF_RANDOMIZE) && (randomize_va_space > 1)) { |
945 | current->mm->brk = current->mm->start_brk = | 945 | current->mm->brk = current->mm->start_brk = |
946 | arch_randomize_brk(current->mm); | 946 | arch_randomize_brk(current->mm); |
947 | #ifdef CONFIG_COMPAT_BRK | ||
948 | current->brk_randomized = 1; | ||
949 | #endif | ||
950 | } | ||
947 | #endif | 951 | #endif |
948 | 952 | ||
949 | if (current->personality & MMAP_PAGE_ZERO) { | 953 | if (current->personality & MMAP_PAGE_ZERO) { |
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index de34bfad9ec3..5d505aaa72fb 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -178,16 +178,17 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name, | |||
178 | 178 | ||
179 | if (value) { | 179 | if (value) { |
180 | acl = posix_acl_from_xattr(value, size); | 180 | acl = posix_acl_from_xattr(value, size); |
181 | if (acl == NULL) { | 181 | if (acl) { |
182 | value = NULL; | 182 | ret = posix_acl_valid(acl); |
183 | size = 0; | 183 | if (ret) |
184 | goto out; | ||
184 | } else if (IS_ERR(acl)) { | 185 | } else if (IS_ERR(acl)) { |
185 | return PTR_ERR(acl); | 186 | return PTR_ERR(acl); |
186 | } | 187 | } |
187 | } | 188 | } |
188 | 189 | ||
189 | ret = btrfs_set_acl(NULL, dentry->d_inode, acl, type); | 190 | ret = btrfs_set_acl(NULL, dentry->d_inode, acl, type); |
190 | 191 | out: | |
191 | posix_acl_release(acl); | 192 | posix_acl_release(acl); |
192 | 193 | ||
193 | return ret; | 194 | return ret; |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 3458b5725540..8f4b81de3ae2 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -718,7 +718,7 @@ struct btrfs_space_info { | |||
718 | u64 total_bytes; /* total bytes in the space, | 718 | u64 total_bytes; /* total bytes in the space, |
719 | this doesn't take mirrors into account */ | 719 | this doesn't take mirrors into account */ |
720 | u64 bytes_used; /* total bytes used, | 720 | u64 bytes_used; /* total bytes used, |
721 | this does't take mirrors into account */ | 721 | this doesn't take mirrors into account */ |
722 | u64 bytes_pinned; /* total bytes pinned, will be freed when the | 722 | u64 bytes_pinned; /* total bytes pinned, will be freed when the |
723 | transaction finishes */ | 723 | transaction finishes */ |
724 | u64 bytes_reserved; /* total bytes the allocator has reserved for | 724 | u64 bytes_reserved; /* total bytes the allocator has reserved for |
@@ -740,8 +740,10 @@ struct btrfs_space_info { | |||
740 | */ | 740 | */ |
741 | unsigned long reservation_progress; | 741 | unsigned long reservation_progress; |
742 | 742 | ||
743 | int full; /* indicates that we cannot allocate any more | 743 | int full:1; /* indicates that we cannot allocate any more |
744 | chunks for this space */ | 744 | chunks for this space */ |
745 | int chunk_alloc:1; /* set if we are allocating a chunk */ | ||
746 | |||
745 | int force_alloc; /* set if we need to force a chunk alloc for | 747 | int force_alloc; /* set if we need to force a chunk alloc for |
746 | this space */ | 748 | this space */ |
747 | 749 | ||
@@ -2576,6 +2578,11 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode, | |||
2576 | int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, | 2578 | int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, |
2577 | struct inode *inode, u64 start, u64 end); | 2579 | struct inode *inode, u64 start, u64 end); |
2578 | int btrfs_release_file(struct inode *inode, struct file *file); | 2580 | int btrfs_release_file(struct inode *inode, struct file *file); |
2581 | void btrfs_drop_pages(struct page **pages, size_t num_pages); | ||
2582 | int btrfs_dirty_pages(struct btrfs_root *root, struct inode *inode, | ||
2583 | struct page **pages, size_t num_pages, | ||
2584 | loff_t pos, size_t write_bytes, | ||
2585 | struct extent_state **cached); | ||
2579 | 2586 | ||
2580 | /* tree-defrag.c */ | 2587 | /* tree-defrag.c */ |
2581 | int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, | 2588 | int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8f1d44ba332f..228cf36ece83 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2824,6 +2824,7 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, | |||
2824 | 2824 | ||
2825 | spin_lock(&delayed_refs->lock); | 2825 | spin_lock(&delayed_refs->lock); |
2826 | if (delayed_refs->num_entries == 0) { | 2826 | if (delayed_refs->num_entries == 0) { |
2827 | spin_unlock(&delayed_refs->lock); | ||
2827 | printk(KERN_INFO "delayed_refs has NO entry\n"); | 2828 | printk(KERN_INFO "delayed_refs has NO entry\n"); |
2828 | return ret; | 2829 | return ret; |
2829 | } | 2830 | } |
@@ -3057,7 +3058,7 @@ static int btrfs_cleanup_transaction(struct btrfs_root *root) | |||
3057 | btrfs_destroy_pinned_extent(root, | 3058 | btrfs_destroy_pinned_extent(root, |
3058 | root->fs_info->pinned_extents); | 3059 | root->fs_info->pinned_extents); |
3059 | 3060 | ||
3060 | t->use_count = 0; | 3061 | atomic_set(&t->use_count, 0); |
3061 | list_del_init(&t->list); | 3062 | list_del_init(&t->list); |
3062 | memset(t, 0, sizeof(*t)); | 3063 | memset(t, 0, sizeof(*t)); |
3063 | kmem_cache_free(btrfs_transaction_cachep, t); | 3064 | kmem_cache_free(btrfs_transaction_cachep, t); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index f619c3cb13b7..cd52f7f556ef 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -33,6 +33,25 @@ | |||
33 | #include "locking.h" | 33 | #include "locking.h" |
34 | #include "free-space-cache.h" | 34 | #include "free-space-cache.h" |
35 | 35 | ||
36 | /* control flags for do_chunk_alloc's force field | ||
37 | * CHUNK_ALLOC_NO_FORCE means to only allocate a chunk | ||
38 | * if we really need one. | ||
39 | * | ||
40 | * CHUNK_ALLOC_FORCE means it must try to allocate one | ||
41 | * | ||
42 | * CHUNK_ALLOC_LIMITED means to only try and allocate one | ||
43 | * if we have very few chunks already allocated. This is | ||
44 | * used as part of the clustering code to help make sure | ||
45 | * we have a good pool of storage to cluster in, without | ||
46 | * filling the FS with empty chunks | ||
47 | * | ||
48 | */ | ||
49 | enum { | ||
50 | CHUNK_ALLOC_NO_FORCE = 0, | ||
51 | CHUNK_ALLOC_FORCE = 1, | ||
52 | CHUNK_ALLOC_LIMITED = 2, | ||
53 | }; | ||
54 | |||
36 | static int update_block_group(struct btrfs_trans_handle *trans, | 55 | static int update_block_group(struct btrfs_trans_handle *trans, |
37 | struct btrfs_root *root, | 56 | struct btrfs_root *root, |
38 | u64 bytenr, u64 num_bytes, int alloc); | 57 | u64 bytenr, u64 num_bytes, int alloc); |
@@ -3019,7 +3038,8 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, | |||
3019 | found->bytes_readonly = 0; | 3038 | found->bytes_readonly = 0; |
3020 | found->bytes_may_use = 0; | 3039 | found->bytes_may_use = 0; |
3021 | found->full = 0; | 3040 | found->full = 0; |
3022 | found->force_alloc = 0; | 3041 | found->force_alloc = CHUNK_ALLOC_NO_FORCE; |
3042 | found->chunk_alloc = 0; | ||
3023 | *space_info = found; | 3043 | *space_info = found; |
3024 | list_add_rcu(&found->list, &info->space_info); | 3044 | list_add_rcu(&found->list, &info->space_info); |
3025 | atomic_set(&found->caching_threads, 0); | 3045 | atomic_set(&found->caching_threads, 0); |
@@ -3150,7 +3170,7 @@ again: | |||
3150 | if (!data_sinfo->full && alloc_chunk) { | 3170 | if (!data_sinfo->full && alloc_chunk) { |
3151 | u64 alloc_target; | 3171 | u64 alloc_target; |
3152 | 3172 | ||
3153 | data_sinfo->force_alloc = 1; | 3173 | data_sinfo->force_alloc = CHUNK_ALLOC_FORCE; |
3154 | spin_unlock(&data_sinfo->lock); | 3174 | spin_unlock(&data_sinfo->lock); |
3155 | alloc: | 3175 | alloc: |
3156 | alloc_target = btrfs_get_alloc_profile(root, 1); | 3176 | alloc_target = btrfs_get_alloc_profile(root, 1); |
@@ -3160,7 +3180,8 @@ alloc: | |||
3160 | 3180 | ||
3161 | ret = do_chunk_alloc(trans, root->fs_info->extent_root, | 3181 | ret = do_chunk_alloc(trans, root->fs_info->extent_root, |
3162 | bytes + 2 * 1024 * 1024, | 3182 | bytes + 2 * 1024 * 1024, |
3163 | alloc_target, 0); | 3183 | alloc_target, |
3184 | CHUNK_ALLOC_NO_FORCE); | ||
3164 | btrfs_end_transaction(trans, root); | 3185 | btrfs_end_transaction(trans, root); |
3165 | if (ret < 0) { | 3186 | if (ret < 0) { |
3166 | if (ret != -ENOSPC) | 3187 | if (ret != -ENOSPC) |
@@ -3239,31 +3260,56 @@ static void force_metadata_allocation(struct btrfs_fs_info *info) | |||
3239 | rcu_read_lock(); | 3260 | rcu_read_lock(); |
3240 | list_for_each_entry_rcu(found, head, list) { | 3261 | list_for_each_entry_rcu(found, head, list) { |
3241 | if (found->flags & BTRFS_BLOCK_GROUP_METADATA) | 3262 | if (found->flags & BTRFS_BLOCK_GROUP_METADATA) |
3242 | found->force_alloc = 1; | 3263 | found->force_alloc = CHUNK_ALLOC_FORCE; |
3243 | } | 3264 | } |
3244 | rcu_read_unlock(); | 3265 | rcu_read_unlock(); |
3245 | } | 3266 | } |
3246 | 3267 | ||
3247 | static int should_alloc_chunk(struct btrfs_root *root, | 3268 | static int should_alloc_chunk(struct btrfs_root *root, |
3248 | struct btrfs_space_info *sinfo, u64 alloc_bytes) | 3269 | struct btrfs_space_info *sinfo, u64 alloc_bytes, |
3270 | int force) | ||
3249 | { | 3271 | { |
3250 | u64 num_bytes = sinfo->total_bytes - sinfo->bytes_readonly; | 3272 | u64 num_bytes = sinfo->total_bytes - sinfo->bytes_readonly; |
3273 | u64 num_allocated = sinfo->bytes_used + sinfo->bytes_reserved; | ||
3251 | u64 thresh; | 3274 | u64 thresh; |
3252 | 3275 | ||
3253 | if (sinfo->bytes_used + sinfo->bytes_reserved + | 3276 | if (force == CHUNK_ALLOC_FORCE) |
3254 | alloc_bytes + 256 * 1024 * 1024 < num_bytes) | 3277 | return 1; |
3278 | |||
3279 | /* | ||
3280 | * in limited mode, we want to have some free space up to | ||
3281 | * about 1% of the FS size. | ||
3282 | */ | ||
3283 | if (force == CHUNK_ALLOC_LIMITED) { | ||
3284 | thresh = btrfs_super_total_bytes(&root->fs_info->super_copy); | ||
3285 | thresh = max_t(u64, 64 * 1024 * 1024, | ||
3286 | div_factor_fine(thresh, 1)); | ||
3287 | |||
3288 | if (num_bytes - num_allocated < thresh) | ||
3289 | return 1; | ||
3290 | } | ||
3291 | |||
3292 | /* | ||
3293 | * we have two similar checks here, one based on percentage | ||
3294 | * and once based on a hard number of 256MB. The idea | ||
3295 | * is that if we have a good amount of free | ||
3296 | * room, don't allocate a chunk. A good mount is | ||
3297 | * less than 80% utilized of the chunks we have allocated, | ||
3298 | * or more than 256MB free | ||
3299 | */ | ||
3300 | if (num_allocated + alloc_bytes + 256 * 1024 * 1024 < num_bytes) | ||
3255 | return 0; | 3301 | return 0; |
3256 | 3302 | ||
3257 | if (sinfo->bytes_used + sinfo->bytes_reserved + | 3303 | if (num_allocated + alloc_bytes < div_factor(num_bytes, 8)) |
3258 | alloc_bytes < div_factor(num_bytes, 8)) | ||
3259 | return 0; | 3304 | return 0; |
3260 | 3305 | ||
3261 | thresh = btrfs_super_total_bytes(&root->fs_info->super_copy); | 3306 | thresh = btrfs_super_total_bytes(&root->fs_info->super_copy); |
3307 | |||
3308 | /* 256MB or 5% of the FS */ | ||
3262 | thresh = max_t(u64, 256 * 1024 * 1024, div_factor_fine(thresh, 5)); | 3309 | thresh = max_t(u64, 256 * 1024 * 1024, div_factor_fine(thresh, 5)); |
3263 | 3310 | ||
3264 | if (num_bytes > thresh && sinfo->bytes_used < div_factor(num_bytes, 3)) | 3311 | if (num_bytes > thresh && sinfo->bytes_used < div_factor(num_bytes, 3)) |
3265 | return 0; | 3312 | return 0; |
3266 | |||
3267 | return 1; | 3313 | return 1; |
3268 | } | 3314 | } |
3269 | 3315 | ||
@@ -3273,10 +3319,9 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans, | |||
3273 | { | 3319 | { |
3274 | struct btrfs_space_info *space_info; | 3320 | struct btrfs_space_info *space_info; |
3275 | struct btrfs_fs_info *fs_info = extent_root->fs_info; | 3321 | struct btrfs_fs_info *fs_info = extent_root->fs_info; |
3322 | int wait_for_alloc = 0; | ||
3276 | int ret = 0; | 3323 | int ret = 0; |
3277 | 3324 | ||
3278 | mutex_lock(&fs_info->chunk_mutex); | ||
3279 | |||
3280 | flags = btrfs_reduce_alloc_profile(extent_root, flags); | 3325 | flags = btrfs_reduce_alloc_profile(extent_root, flags); |
3281 | 3326 | ||
3282 | space_info = __find_space_info(extent_root->fs_info, flags); | 3327 | space_info = __find_space_info(extent_root->fs_info, flags); |
@@ -3287,21 +3332,40 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans, | |||
3287 | } | 3332 | } |
3288 | BUG_ON(!space_info); | 3333 | BUG_ON(!space_info); |
3289 | 3334 | ||
3335 | again: | ||
3290 | spin_lock(&space_info->lock); | 3336 | spin_lock(&space_info->lock); |
3291 | if (space_info->force_alloc) | 3337 | if (space_info->force_alloc) |
3292 | force = 1; | 3338 | force = space_info->force_alloc; |
3293 | if (space_info->full) { | 3339 | if (space_info->full) { |
3294 | spin_unlock(&space_info->lock); | 3340 | spin_unlock(&space_info->lock); |
3295 | goto out; | 3341 | return 0; |
3296 | } | 3342 | } |
3297 | 3343 | ||
3298 | if (!force && !should_alloc_chunk(extent_root, space_info, | 3344 | if (!should_alloc_chunk(extent_root, space_info, alloc_bytes, force)) { |
3299 | alloc_bytes)) { | ||
3300 | spin_unlock(&space_info->lock); | 3345 | spin_unlock(&space_info->lock); |
3301 | goto out; | 3346 | return 0; |
3347 | } else if (space_info->chunk_alloc) { | ||
3348 | wait_for_alloc = 1; | ||
3349 | } else { | ||
3350 | space_info->chunk_alloc = 1; | ||
3302 | } | 3351 | } |
3352 | |||
3303 | spin_unlock(&space_info->lock); | 3353 | spin_unlock(&space_info->lock); |
3304 | 3354 | ||
3355 | mutex_lock(&fs_info->chunk_mutex); | ||
3356 | |||
3357 | /* | ||
3358 | * The chunk_mutex is held throughout the entirety of a chunk | ||
3359 | * allocation, so once we've acquired the chunk_mutex we know that the | ||
3360 | * other guy is done and we need to recheck and see if we should | ||
3361 | * allocate. | ||
3362 | */ | ||
3363 | if (wait_for_alloc) { | ||
3364 | mutex_unlock(&fs_info->chunk_mutex); | ||
3365 | wait_for_alloc = 0; | ||
3366 | goto again; | ||
3367 | } | ||
3368 | |||
3305 | /* | 3369 | /* |
3306 | * If we have mixed data/metadata chunks we want to make sure we keep | 3370 | * If we have mixed data/metadata chunks we want to make sure we keep |
3307 | * allocating mixed chunks instead of individual chunks. | 3371 | * allocating mixed chunks instead of individual chunks. |
@@ -3327,9 +3391,10 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans, | |||
3327 | space_info->full = 1; | 3391 | space_info->full = 1; |
3328 | else | 3392 | else |
3329 | ret = 1; | 3393 | ret = 1; |
3330 | space_info->force_alloc = 0; | 3394 | |
3395 | space_info->force_alloc = CHUNK_ALLOC_NO_FORCE; | ||
3396 | space_info->chunk_alloc = 0; | ||
3331 | spin_unlock(&space_info->lock); | 3397 | spin_unlock(&space_info->lock); |
3332 | out: | ||
3333 | mutex_unlock(&extent_root->fs_info->chunk_mutex); | 3398 | mutex_unlock(&extent_root->fs_info->chunk_mutex); |
3334 | return ret; | 3399 | return ret; |
3335 | } | 3400 | } |
@@ -5303,11 +5368,13 @@ loop: | |||
5303 | 5368 | ||
5304 | if (allowed_chunk_alloc) { | 5369 | if (allowed_chunk_alloc) { |
5305 | ret = do_chunk_alloc(trans, root, num_bytes + | 5370 | ret = do_chunk_alloc(trans, root, num_bytes + |
5306 | 2 * 1024 * 1024, data, 1); | 5371 | 2 * 1024 * 1024, data, |
5372 | CHUNK_ALLOC_LIMITED); | ||
5307 | allowed_chunk_alloc = 0; | 5373 | allowed_chunk_alloc = 0; |
5308 | done_chunk_alloc = 1; | 5374 | done_chunk_alloc = 1; |
5309 | } else if (!done_chunk_alloc) { | 5375 | } else if (!done_chunk_alloc && |
5310 | space_info->force_alloc = 1; | 5376 | space_info->force_alloc == CHUNK_ALLOC_NO_FORCE) { |
5377 | space_info->force_alloc = CHUNK_ALLOC_LIMITED; | ||
5311 | } | 5378 | } |
5312 | 5379 | ||
5313 | if (loop < LOOP_NO_EMPTY_SIZE) { | 5380 | if (loop < LOOP_NO_EMPTY_SIZE) { |
@@ -5393,7 +5460,8 @@ again: | |||
5393 | */ | 5460 | */ |
5394 | if (empty_size || root->ref_cows) | 5461 | if (empty_size || root->ref_cows) |
5395 | ret = do_chunk_alloc(trans, root->fs_info->extent_root, | 5462 | ret = do_chunk_alloc(trans, root->fs_info->extent_root, |
5396 | num_bytes + 2 * 1024 * 1024, data, 0); | 5463 | num_bytes + 2 * 1024 * 1024, data, |
5464 | CHUNK_ALLOC_NO_FORCE); | ||
5397 | 5465 | ||
5398 | WARN_ON(num_bytes < root->sectorsize); | 5466 | WARN_ON(num_bytes < root->sectorsize); |
5399 | ret = find_free_extent(trans, root, num_bytes, empty_size, | 5467 | ret = find_free_extent(trans, root, num_bytes, empty_size, |
@@ -5405,7 +5473,7 @@ again: | |||
5405 | num_bytes = num_bytes & ~(root->sectorsize - 1); | 5473 | num_bytes = num_bytes & ~(root->sectorsize - 1); |
5406 | num_bytes = max(num_bytes, min_alloc_size); | 5474 | num_bytes = max(num_bytes, min_alloc_size); |
5407 | do_chunk_alloc(trans, root->fs_info->extent_root, | 5475 | do_chunk_alloc(trans, root->fs_info->extent_root, |
5408 | num_bytes, data, 1); | 5476 | num_bytes, data, CHUNK_ALLOC_FORCE); |
5409 | goto again; | 5477 | goto again; |
5410 | } | 5478 | } |
5411 | if (ret == -ENOSPC && btrfs_test_opt(root, ENOSPC_DEBUG)) { | 5479 | if (ret == -ENOSPC && btrfs_test_opt(root, ENOSPC_DEBUG)) { |
@@ -7991,6 +8059,10 @@ static noinline int relocate_one_extent(struct btrfs_root *extent_root, | |||
7991 | u64 group_start = group->key.objectid; | 8059 | u64 group_start = group->key.objectid; |
7992 | new_extents = kmalloc(sizeof(*new_extents), | 8060 | new_extents = kmalloc(sizeof(*new_extents), |
7993 | GFP_NOFS); | 8061 | GFP_NOFS); |
8062 | if (!new_extents) { | ||
8063 | ret = -ENOMEM; | ||
8064 | goto out; | ||
8065 | } | ||
7994 | nr_extents = 1; | 8066 | nr_extents = 1; |
7995 | ret = get_new_locations(reloc_inode, | 8067 | ret = get_new_locations(reloc_inode, |
7996 | extent_key, | 8068 | extent_key, |
@@ -8109,13 +8181,15 @@ int btrfs_set_block_group_ro(struct btrfs_root *root, | |||
8109 | 8181 | ||
8110 | alloc_flags = update_block_group_flags(root, cache->flags); | 8182 | alloc_flags = update_block_group_flags(root, cache->flags); |
8111 | if (alloc_flags != cache->flags) | 8183 | if (alloc_flags != cache->flags) |
8112 | do_chunk_alloc(trans, root, 2 * 1024 * 1024, alloc_flags, 1); | 8184 | do_chunk_alloc(trans, root, 2 * 1024 * 1024, alloc_flags, |
8185 | CHUNK_ALLOC_FORCE); | ||
8113 | 8186 | ||
8114 | ret = set_block_group_ro(cache); | 8187 | ret = set_block_group_ro(cache); |
8115 | if (!ret) | 8188 | if (!ret) |
8116 | goto out; | 8189 | goto out; |
8117 | alloc_flags = get_alloc_profile(root, cache->space_info->flags); | 8190 | alloc_flags = get_alloc_profile(root, cache->space_info->flags); |
8118 | ret = do_chunk_alloc(trans, root, 2 * 1024 * 1024, alloc_flags, 1); | 8191 | ret = do_chunk_alloc(trans, root, 2 * 1024 * 1024, alloc_flags, |
8192 | CHUNK_ALLOC_FORCE); | ||
8119 | if (ret < 0) | 8193 | if (ret < 0) |
8120 | goto out; | 8194 | goto out; |
8121 | ret = set_block_group_ro(cache); | 8195 | ret = set_block_group_ro(cache); |
@@ -8128,7 +8202,8 @@ int btrfs_force_chunk_alloc(struct btrfs_trans_handle *trans, | |||
8128 | struct btrfs_root *root, u64 type) | 8202 | struct btrfs_root *root, u64 type) |
8129 | { | 8203 | { |
8130 | u64 alloc_flags = get_alloc_profile(root, type); | 8204 | u64 alloc_flags = get_alloc_profile(root, type); |
8131 | return do_chunk_alloc(trans, root, 2 * 1024 * 1024, alloc_flags, 1); | 8205 | return do_chunk_alloc(trans, root, 2 * 1024 * 1024, alloc_flags, |
8206 | CHUNK_ALLOC_FORCE); | ||
8132 | } | 8207 | } |
8133 | 8208 | ||
8134 | /* | 8209 | /* |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 20ddb28602a8..ba41da59e31b 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -690,6 +690,15 @@ static void cache_state(struct extent_state *state, | |||
690 | } | 690 | } |
691 | } | 691 | } |
692 | 692 | ||
693 | static void uncache_state(struct extent_state **cached_ptr) | ||
694 | { | ||
695 | if (cached_ptr && (*cached_ptr)) { | ||
696 | struct extent_state *state = *cached_ptr; | ||
697 | *cached_ptr = NULL; | ||
698 | free_extent_state(state); | ||
699 | } | ||
700 | } | ||
701 | |||
693 | /* | 702 | /* |
694 | * set some bits on a range in the tree. This may require allocations or | 703 | * set some bits on a range in the tree. This may require allocations or |
695 | * sleeping, so the gfp mask is used to indicate what is allowed. | 704 | * sleeping, so the gfp mask is used to indicate what is allowed. |
@@ -940,10 +949,10 @@ static int clear_extent_new(struct extent_io_tree *tree, u64 start, u64 end, | |||
940 | } | 949 | } |
941 | 950 | ||
942 | int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end, | 951 | int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end, |
943 | gfp_t mask) | 952 | struct extent_state **cached_state, gfp_t mask) |
944 | { | 953 | { |
945 | return set_extent_bit(tree, start, end, EXTENT_UPTODATE, 0, NULL, | 954 | return set_extent_bit(tree, start, end, EXTENT_UPTODATE, 0, |
946 | NULL, mask); | 955 | NULL, cached_state, mask); |
947 | } | 956 | } |
948 | 957 | ||
949 | static int clear_extent_uptodate(struct extent_io_tree *tree, u64 start, | 958 | static int clear_extent_uptodate(struct extent_io_tree *tree, u64 start, |
@@ -1012,8 +1021,7 @@ int unlock_extent_cached(struct extent_io_tree *tree, u64 start, u64 end, | |||
1012 | mask); | 1021 | mask); |
1013 | } | 1022 | } |
1014 | 1023 | ||
1015 | int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end, | 1024 | int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask) |
1016 | gfp_t mask) | ||
1017 | { | 1025 | { |
1018 | return clear_extent_bit(tree, start, end, EXTENT_LOCKED, 1, 0, NULL, | 1026 | return clear_extent_bit(tree, start, end, EXTENT_LOCKED, 1, 0, NULL, |
1019 | mask); | 1027 | mask); |
@@ -1735,6 +1743,9 @@ static void end_bio_extent_readpage(struct bio *bio, int err) | |||
1735 | 1743 | ||
1736 | do { | 1744 | do { |
1737 | struct page *page = bvec->bv_page; | 1745 | struct page *page = bvec->bv_page; |
1746 | struct extent_state *cached = NULL; | ||
1747 | struct extent_state *state; | ||
1748 | |||
1738 | tree = &BTRFS_I(page->mapping->host)->io_tree; | 1749 | tree = &BTRFS_I(page->mapping->host)->io_tree; |
1739 | 1750 | ||
1740 | start = ((u64)page->index << PAGE_CACHE_SHIFT) + | 1751 | start = ((u64)page->index << PAGE_CACHE_SHIFT) + |
@@ -1749,9 +1760,20 @@ static void end_bio_extent_readpage(struct bio *bio, int err) | |||
1749 | if (++bvec <= bvec_end) | 1760 | if (++bvec <= bvec_end) |
1750 | prefetchw(&bvec->bv_page->flags); | 1761 | prefetchw(&bvec->bv_page->flags); |
1751 | 1762 | ||
1763 | spin_lock(&tree->lock); | ||
1764 | state = find_first_extent_bit_state(tree, start, EXTENT_LOCKED); | ||
1765 | if (state && state->start == start) { | ||
1766 | /* | ||
1767 | * take a reference on the state, unlock will drop | ||
1768 | * the ref | ||
1769 | */ | ||
1770 | cache_state(state, &cached); | ||
1771 | } | ||
1772 | spin_unlock(&tree->lock); | ||
1773 | |||
1752 | if (uptodate && tree->ops && tree->ops->readpage_end_io_hook) { | 1774 | if (uptodate && tree->ops && tree->ops->readpage_end_io_hook) { |
1753 | ret = tree->ops->readpage_end_io_hook(page, start, end, | 1775 | ret = tree->ops->readpage_end_io_hook(page, start, end, |
1754 | NULL); | 1776 | state); |
1755 | if (ret) | 1777 | if (ret) |
1756 | uptodate = 0; | 1778 | uptodate = 0; |
1757 | } | 1779 | } |
@@ -1764,15 +1786,16 @@ static void end_bio_extent_readpage(struct bio *bio, int err) | |||
1764 | test_bit(BIO_UPTODATE, &bio->bi_flags); | 1786 | test_bit(BIO_UPTODATE, &bio->bi_flags); |
1765 | if (err) | 1787 | if (err) |
1766 | uptodate = 0; | 1788 | uptodate = 0; |
1789 | uncache_state(&cached); | ||
1767 | continue; | 1790 | continue; |
1768 | } | 1791 | } |
1769 | } | 1792 | } |
1770 | 1793 | ||
1771 | if (uptodate) { | 1794 | if (uptodate) { |
1772 | set_extent_uptodate(tree, start, end, | 1795 | set_extent_uptodate(tree, start, end, &cached, |
1773 | GFP_ATOMIC); | 1796 | GFP_ATOMIC); |
1774 | } | 1797 | } |
1775 | unlock_extent(tree, start, end, GFP_ATOMIC); | 1798 | unlock_extent_cached(tree, start, end, &cached, GFP_ATOMIC); |
1776 | 1799 | ||
1777 | if (whole_page) { | 1800 | if (whole_page) { |
1778 | if (uptodate) { | 1801 | if (uptodate) { |
@@ -1811,6 +1834,7 @@ static void end_bio_extent_preparewrite(struct bio *bio, int err) | |||
1811 | 1834 | ||
1812 | do { | 1835 | do { |
1813 | struct page *page = bvec->bv_page; | 1836 | struct page *page = bvec->bv_page; |
1837 | struct extent_state *cached = NULL; | ||
1814 | tree = &BTRFS_I(page->mapping->host)->io_tree; | 1838 | tree = &BTRFS_I(page->mapping->host)->io_tree; |
1815 | 1839 | ||
1816 | start = ((u64)page->index << PAGE_CACHE_SHIFT) + | 1840 | start = ((u64)page->index << PAGE_CACHE_SHIFT) + |
@@ -1821,13 +1845,14 @@ static void end_bio_extent_preparewrite(struct bio *bio, int err) | |||
1821 | prefetchw(&bvec->bv_page->flags); | 1845 | prefetchw(&bvec->bv_page->flags); |
1822 | 1846 | ||
1823 | if (uptodate) { | 1847 | if (uptodate) { |
1824 | set_extent_uptodate(tree, start, end, GFP_ATOMIC); | 1848 | set_extent_uptodate(tree, start, end, &cached, |
1849 | GFP_ATOMIC); | ||
1825 | } else { | 1850 | } else { |
1826 | ClearPageUptodate(page); | 1851 | ClearPageUptodate(page); |
1827 | SetPageError(page); | 1852 | SetPageError(page); |
1828 | } | 1853 | } |
1829 | 1854 | ||
1830 | unlock_extent(tree, start, end, GFP_ATOMIC); | 1855 | unlock_extent_cached(tree, start, end, &cached, GFP_ATOMIC); |
1831 | 1856 | ||
1832 | } while (bvec >= bio->bi_io_vec); | 1857 | } while (bvec >= bio->bi_io_vec); |
1833 | 1858 | ||
@@ -2016,14 +2041,17 @@ static int __extent_read_full_page(struct extent_io_tree *tree, | |||
2016 | while (cur <= end) { | 2041 | while (cur <= end) { |
2017 | if (cur >= last_byte) { | 2042 | if (cur >= last_byte) { |
2018 | char *userpage; | 2043 | char *userpage; |
2044 | struct extent_state *cached = NULL; | ||
2045 | |||
2019 | iosize = PAGE_CACHE_SIZE - page_offset; | 2046 | iosize = PAGE_CACHE_SIZE - page_offset; |
2020 | userpage = kmap_atomic(page, KM_USER0); | 2047 | userpage = kmap_atomic(page, KM_USER0); |
2021 | memset(userpage + page_offset, 0, iosize); | 2048 | memset(userpage + page_offset, 0, iosize); |
2022 | flush_dcache_page(page); | 2049 | flush_dcache_page(page); |
2023 | kunmap_atomic(userpage, KM_USER0); | 2050 | kunmap_atomic(userpage, KM_USER0); |
2024 | set_extent_uptodate(tree, cur, cur + iosize - 1, | 2051 | set_extent_uptodate(tree, cur, cur + iosize - 1, |
2025 | GFP_NOFS); | 2052 | &cached, GFP_NOFS); |
2026 | unlock_extent(tree, cur, cur + iosize - 1, GFP_NOFS); | 2053 | unlock_extent_cached(tree, cur, cur + iosize - 1, |
2054 | &cached, GFP_NOFS); | ||
2027 | break; | 2055 | break; |
2028 | } | 2056 | } |
2029 | em = get_extent(inode, page, page_offset, cur, | 2057 | em = get_extent(inode, page, page_offset, cur, |
@@ -2063,14 +2091,17 @@ static int __extent_read_full_page(struct extent_io_tree *tree, | |||
2063 | /* we've found a hole, just zero and go on */ | 2091 | /* we've found a hole, just zero and go on */ |
2064 | if (block_start == EXTENT_MAP_HOLE) { | 2092 | if (block_start == EXTENT_MAP_HOLE) { |
2065 | char *userpage; | 2093 | char *userpage; |
2094 | struct extent_state *cached = NULL; | ||
2095 | |||
2066 | userpage = kmap_atomic(page, KM_USER0); | 2096 | userpage = kmap_atomic(page, KM_USER0); |
2067 | memset(userpage + page_offset, 0, iosize); | 2097 | memset(userpage + page_offset, 0, iosize); |
2068 | flush_dcache_page(page); | 2098 | flush_dcache_page(page); |
2069 | kunmap_atomic(userpage, KM_USER0); | 2099 | kunmap_atomic(userpage, KM_USER0); |
2070 | 2100 | ||
2071 | set_extent_uptodate(tree, cur, cur + iosize - 1, | 2101 | set_extent_uptodate(tree, cur, cur + iosize - 1, |
2072 | GFP_NOFS); | 2102 | &cached, GFP_NOFS); |
2073 | unlock_extent(tree, cur, cur + iosize - 1, GFP_NOFS); | 2103 | unlock_extent_cached(tree, cur, cur + iosize - 1, |
2104 | &cached, GFP_NOFS); | ||
2074 | cur = cur + iosize; | 2105 | cur = cur + iosize; |
2075 | page_offset += iosize; | 2106 | page_offset += iosize; |
2076 | continue; | 2107 | continue; |
@@ -2650,7 +2681,7 @@ int extent_readpages(struct extent_io_tree *tree, | |||
2650 | prefetchw(&page->flags); | 2681 | prefetchw(&page->flags); |
2651 | list_del(&page->lru); | 2682 | list_del(&page->lru); |
2652 | if (!add_to_page_cache_lru(page, mapping, | 2683 | if (!add_to_page_cache_lru(page, mapping, |
2653 | page->index, GFP_KERNEL)) { | 2684 | page->index, GFP_NOFS)) { |
2654 | __extent_read_full_page(tree, page, get_extent, | 2685 | __extent_read_full_page(tree, page, get_extent, |
2655 | &bio, 0, &bio_flags); | 2686 | &bio, 0, &bio_flags); |
2656 | } | 2687 | } |
@@ -2789,9 +2820,12 @@ int extent_prepare_write(struct extent_io_tree *tree, | |||
2789 | iocount++; | 2820 | iocount++; |
2790 | block_start = block_start + iosize; | 2821 | block_start = block_start + iosize; |
2791 | } else { | 2822 | } else { |
2792 | set_extent_uptodate(tree, block_start, cur_end, | 2823 | struct extent_state *cached = NULL; |
2824 | |||
2825 | set_extent_uptodate(tree, block_start, cur_end, &cached, | ||
2793 | GFP_NOFS); | 2826 | GFP_NOFS); |
2794 | unlock_extent(tree, block_start, cur_end, GFP_NOFS); | 2827 | unlock_extent_cached(tree, block_start, cur_end, |
2828 | &cached, GFP_NOFS); | ||
2795 | block_start = cur_end + 1; | 2829 | block_start = cur_end + 1; |
2796 | } | 2830 | } |
2797 | page_offset = block_start & (PAGE_CACHE_SIZE - 1); | 2831 | page_offset = block_start & (PAGE_CACHE_SIZE - 1); |
@@ -3457,7 +3491,7 @@ int set_extent_buffer_uptodate(struct extent_io_tree *tree, | |||
3457 | num_pages = num_extent_pages(eb->start, eb->len); | 3491 | num_pages = num_extent_pages(eb->start, eb->len); |
3458 | 3492 | ||
3459 | set_extent_uptodate(tree, eb->start, eb->start + eb->len - 1, | 3493 | set_extent_uptodate(tree, eb->start, eb->start + eb->len - 1, |
3460 | GFP_NOFS); | 3494 | NULL, GFP_NOFS); |
3461 | for (i = 0; i < num_pages; i++) { | 3495 | for (i = 0; i < num_pages; i++) { |
3462 | page = extent_buffer_page(eb, i); | 3496 | page = extent_buffer_page(eb, i); |
3463 | if ((i == 0 && (eb->start & (PAGE_CACHE_SIZE - 1))) || | 3497 | if ((i == 0 && (eb->start & (PAGE_CACHE_SIZE - 1))) || |
@@ -3885,6 +3919,12 @@ static void move_pages(struct page *dst_page, struct page *src_page, | |||
3885 | kunmap_atomic(dst_kaddr, KM_USER0); | 3919 | kunmap_atomic(dst_kaddr, KM_USER0); |
3886 | } | 3920 | } |
3887 | 3921 | ||
3922 | static inline bool areas_overlap(unsigned long src, unsigned long dst, unsigned long len) | ||
3923 | { | ||
3924 | unsigned long distance = (src > dst) ? src - dst : dst - src; | ||
3925 | return distance < len; | ||
3926 | } | ||
3927 | |||
3888 | static void copy_pages(struct page *dst_page, struct page *src_page, | 3928 | static void copy_pages(struct page *dst_page, struct page *src_page, |
3889 | unsigned long dst_off, unsigned long src_off, | 3929 | unsigned long dst_off, unsigned long src_off, |
3890 | unsigned long len) | 3930 | unsigned long len) |
@@ -3892,10 +3932,12 @@ static void copy_pages(struct page *dst_page, struct page *src_page, | |||
3892 | char *dst_kaddr = kmap_atomic(dst_page, KM_USER0); | 3932 | char *dst_kaddr = kmap_atomic(dst_page, KM_USER0); |
3893 | char *src_kaddr; | 3933 | char *src_kaddr; |
3894 | 3934 | ||
3895 | if (dst_page != src_page) | 3935 | if (dst_page != src_page) { |
3896 | src_kaddr = kmap_atomic(src_page, KM_USER1); | 3936 | src_kaddr = kmap_atomic(src_page, KM_USER1); |
3897 | else | 3937 | } else { |
3898 | src_kaddr = dst_kaddr; | 3938 | src_kaddr = dst_kaddr; |
3939 | BUG_ON(areas_overlap(src_off, dst_off, len)); | ||
3940 | } | ||
3899 | 3941 | ||
3900 | memcpy(dst_kaddr + dst_off, src_kaddr + src_off, len); | 3942 | memcpy(dst_kaddr + dst_off, src_kaddr + src_off, len); |
3901 | kunmap_atomic(dst_kaddr, KM_USER0); | 3943 | kunmap_atomic(dst_kaddr, KM_USER0); |
@@ -3970,7 +4012,7 @@ void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset, | |||
3970 | "len %lu len %lu\n", dst_offset, len, dst->len); | 4012 | "len %lu len %lu\n", dst_offset, len, dst->len); |
3971 | BUG_ON(1); | 4013 | BUG_ON(1); |
3972 | } | 4014 | } |
3973 | if (dst_offset < src_offset) { | 4015 | if (!areas_overlap(src_offset, dst_offset, len)) { |
3974 | memcpy_extent_buffer(dst, dst_offset, src_offset, len); | 4016 | memcpy_extent_buffer(dst, dst_offset, src_offset, len); |
3975 | return; | 4017 | return; |
3976 | } | 4018 | } |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index f62c5442835d..af2d7179c372 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -208,7 +208,7 @@ int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, | |||
208 | int bits, int exclusive_bits, u64 *failed_start, | 208 | int bits, int exclusive_bits, u64 *failed_start, |
209 | struct extent_state **cached_state, gfp_t mask); | 209 | struct extent_state **cached_state, gfp_t mask); |
210 | int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end, | 210 | int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end, |
211 | gfp_t mask); | 211 | struct extent_state **cached_state, gfp_t mask); |
212 | int set_extent_new(struct extent_io_tree *tree, u64 start, u64 end, | 212 | int set_extent_new(struct extent_io_tree *tree, u64 start, u64 end, |
213 | gfp_t mask); | 213 | gfp_t mask); |
214 | int set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end, | 214 | int set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end, |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index e621ea54a3fd..75899a01dded 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -104,7 +104,7 @@ static noinline int btrfs_copy_from_user(loff_t pos, int num_pages, | |||
104 | /* | 104 | /* |
105 | * unlocks pages after btrfs_file_write is done with them | 105 | * unlocks pages after btrfs_file_write is done with them |
106 | */ | 106 | */ |
107 | static noinline void btrfs_drop_pages(struct page **pages, size_t num_pages) | 107 | void btrfs_drop_pages(struct page **pages, size_t num_pages) |
108 | { | 108 | { |
109 | size_t i; | 109 | size_t i; |
110 | for (i = 0; i < num_pages; i++) { | 110 | for (i = 0; i < num_pages; i++) { |
@@ -127,16 +127,13 @@ static noinline void btrfs_drop_pages(struct page **pages, size_t num_pages) | |||
127 | * this also makes the decision about creating an inline extent vs | 127 | * this also makes the decision about creating an inline extent vs |
128 | * doing real data extents, marking pages dirty and delalloc as required. | 128 | * doing real data extents, marking pages dirty and delalloc as required. |
129 | */ | 129 | */ |
130 | static noinline int dirty_and_release_pages(struct btrfs_root *root, | 130 | int btrfs_dirty_pages(struct btrfs_root *root, struct inode *inode, |
131 | struct file *file, | 131 | struct page **pages, size_t num_pages, |
132 | struct page **pages, | 132 | loff_t pos, size_t write_bytes, |
133 | size_t num_pages, | 133 | struct extent_state **cached) |
134 | loff_t pos, | ||
135 | size_t write_bytes) | ||
136 | { | 134 | { |
137 | int err = 0; | 135 | int err = 0; |
138 | int i; | 136 | int i; |
139 | struct inode *inode = fdentry(file)->d_inode; | ||
140 | u64 num_bytes; | 137 | u64 num_bytes; |
141 | u64 start_pos; | 138 | u64 start_pos; |
142 | u64 end_of_last_block; | 139 | u64 end_of_last_block; |
@@ -149,7 +146,7 @@ static noinline int dirty_and_release_pages(struct btrfs_root *root, | |||
149 | 146 | ||
150 | end_of_last_block = start_pos + num_bytes - 1; | 147 | end_of_last_block = start_pos + num_bytes - 1; |
151 | err = btrfs_set_extent_delalloc(inode, start_pos, end_of_last_block, | 148 | err = btrfs_set_extent_delalloc(inode, start_pos, end_of_last_block, |
152 | NULL); | 149 | cached); |
153 | if (err) | 150 | if (err) |
154 | return err; | 151 | return err; |
155 | 152 | ||
@@ -992,9 +989,9 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file, | |||
992 | } | 989 | } |
993 | 990 | ||
994 | if (copied > 0) { | 991 | if (copied > 0) { |
995 | ret = dirty_and_release_pages(root, file, pages, | 992 | ret = btrfs_dirty_pages(root, inode, pages, |
996 | dirty_pages, pos, | 993 | dirty_pages, pos, copied, |
997 | copied); | 994 | NULL); |
998 | if (ret) { | 995 | if (ret) { |
999 | btrfs_delalloc_release_space(inode, | 996 | btrfs_delalloc_release_space(inode, |
1000 | dirty_pages << PAGE_CACHE_SHIFT); | 997 | dirty_pages << PAGE_CACHE_SHIFT); |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index f561c953205b..63731a1fb0a1 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -508,6 +508,7 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
508 | struct inode *inode; | 508 | struct inode *inode; |
509 | struct rb_node *node; | 509 | struct rb_node *node; |
510 | struct list_head *pos, *n; | 510 | struct list_head *pos, *n; |
511 | struct page **pages; | ||
511 | struct page *page; | 512 | struct page *page; |
512 | struct extent_state *cached_state = NULL; | 513 | struct extent_state *cached_state = NULL; |
513 | struct btrfs_free_cluster *cluster = NULL; | 514 | struct btrfs_free_cluster *cluster = NULL; |
@@ -517,13 +518,13 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
517 | u64 start, end, len; | 518 | u64 start, end, len; |
518 | u64 bytes = 0; | 519 | u64 bytes = 0; |
519 | u32 *crc, *checksums; | 520 | u32 *crc, *checksums; |
520 | pgoff_t index = 0, last_index = 0; | ||
521 | unsigned long first_page_offset; | 521 | unsigned long first_page_offset; |
522 | int num_checksums; | 522 | int index = 0, num_pages = 0; |
523 | int entries = 0; | 523 | int entries = 0; |
524 | int bitmaps = 0; | 524 | int bitmaps = 0; |
525 | int ret = 0; | 525 | int ret = 0; |
526 | bool next_page = false; | 526 | bool next_page = false; |
527 | bool out_of_space = false; | ||
527 | 528 | ||
528 | root = root->fs_info->tree_root; | 529 | root = root->fs_info->tree_root; |
529 | 530 | ||
@@ -551,24 +552,31 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
551 | return 0; | 552 | return 0; |
552 | } | 553 | } |
553 | 554 | ||
554 | last_index = (i_size_read(inode) - 1) >> PAGE_CACHE_SHIFT; | 555 | num_pages = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> |
556 | PAGE_CACHE_SHIFT; | ||
555 | filemap_write_and_wait(inode->i_mapping); | 557 | filemap_write_and_wait(inode->i_mapping); |
556 | btrfs_wait_ordered_range(inode, inode->i_size & | 558 | btrfs_wait_ordered_range(inode, inode->i_size & |
557 | ~(root->sectorsize - 1), (u64)-1); | 559 | ~(root->sectorsize - 1), (u64)-1); |
558 | 560 | ||
559 | /* We need a checksum per page. */ | 561 | /* We need a checksum per page. */ |
560 | num_checksums = i_size_read(inode) / PAGE_CACHE_SIZE; | 562 | crc = checksums = kzalloc(sizeof(u32) * num_pages, GFP_NOFS); |
561 | crc = checksums = kzalloc(sizeof(u32) * num_checksums, GFP_NOFS); | ||
562 | if (!crc) { | 563 | if (!crc) { |
563 | iput(inode); | 564 | iput(inode); |
564 | return 0; | 565 | return 0; |
565 | } | 566 | } |
566 | 567 | ||
568 | pages = kzalloc(sizeof(struct page *) * num_pages, GFP_NOFS); | ||
569 | if (!pages) { | ||
570 | kfree(crc); | ||
571 | iput(inode); | ||
572 | return 0; | ||
573 | } | ||
574 | |||
567 | /* Since the first page has all of our checksums and our generation we | 575 | /* Since the first page has all of our checksums and our generation we |
568 | * need to calculate the offset into the page that we can start writing | 576 | * need to calculate the offset into the page that we can start writing |
569 | * our entries. | 577 | * our entries. |
570 | */ | 578 | */ |
571 | first_page_offset = (sizeof(u32) * num_checksums) + sizeof(u64); | 579 | first_page_offset = (sizeof(u32) * num_pages) + sizeof(u64); |
572 | 580 | ||
573 | /* Get the cluster for this block_group if it exists */ | 581 | /* Get the cluster for this block_group if it exists */ |
574 | if (!list_empty(&block_group->cluster_list)) | 582 | if (!list_empty(&block_group->cluster_list)) |
@@ -590,20 +598,18 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
590 | * after find_get_page at this point. Just putting this here so people | 598 | * after find_get_page at this point. Just putting this here so people |
591 | * know and don't freak out. | 599 | * know and don't freak out. |
592 | */ | 600 | */ |
593 | while (index <= last_index) { | 601 | while (index < num_pages) { |
594 | page = grab_cache_page(inode->i_mapping, index); | 602 | page = grab_cache_page(inode->i_mapping, index); |
595 | if (!page) { | 603 | if (!page) { |
596 | pgoff_t i = 0; | 604 | int i; |
597 | 605 | ||
598 | while (i < index) { | 606 | for (i = 0; i < num_pages; i++) { |
599 | page = find_get_page(inode->i_mapping, i); | 607 | unlock_page(pages[i]); |
600 | unlock_page(page); | 608 | page_cache_release(pages[i]); |
601 | page_cache_release(page); | ||
602 | page_cache_release(page); | ||
603 | i++; | ||
604 | } | 609 | } |
605 | goto out_free; | 610 | goto out_free; |
606 | } | 611 | } |
612 | pages[index] = page; | ||
607 | index++; | 613 | index++; |
608 | } | 614 | } |
609 | 615 | ||
@@ -631,7 +637,12 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
631 | offset = start_offset; | 637 | offset = start_offset; |
632 | } | 638 | } |
633 | 639 | ||
634 | page = find_get_page(inode->i_mapping, index); | 640 | if (index >= num_pages) { |
641 | out_of_space = true; | ||
642 | break; | ||
643 | } | ||
644 | |||
645 | page = pages[index]; | ||
635 | 646 | ||
636 | addr = kmap(page); | 647 | addr = kmap(page); |
637 | entry = addr + start_offset; | 648 | entry = addr + start_offset; |
@@ -708,23 +719,6 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
708 | 719 | ||
709 | bytes += PAGE_CACHE_SIZE; | 720 | bytes += PAGE_CACHE_SIZE; |
710 | 721 | ||
711 | ClearPageChecked(page); | ||
712 | set_page_extent_mapped(page); | ||
713 | SetPageUptodate(page); | ||
714 | set_page_dirty(page); | ||
715 | |||
716 | /* | ||
717 | * We need to release our reference we got for grab_cache_page, | ||
718 | * except for the first page which will hold our checksums, we | ||
719 | * do that below. | ||
720 | */ | ||
721 | if (index != 0) { | ||
722 | unlock_page(page); | ||
723 | page_cache_release(page); | ||
724 | } | ||
725 | |||
726 | page_cache_release(page); | ||
727 | |||
728 | index++; | 722 | index++; |
729 | } while (node || next_page); | 723 | } while (node || next_page); |
730 | 724 | ||
@@ -734,7 +728,11 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
734 | struct btrfs_free_space *entry = | 728 | struct btrfs_free_space *entry = |
735 | list_entry(pos, struct btrfs_free_space, list); | 729 | list_entry(pos, struct btrfs_free_space, list); |
736 | 730 | ||
737 | page = find_get_page(inode->i_mapping, index); | 731 | if (index >= num_pages) { |
732 | out_of_space = true; | ||
733 | break; | ||
734 | } | ||
735 | page = pages[index]; | ||
738 | 736 | ||
739 | addr = kmap(page); | 737 | addr = kmap(page); |
740 | memcpy(addr, entry->bitmap, PAGE_CACHE_SIZE); | 738 | memcpy(addr, entry->bitmap, PAGE_CACHE_SIZE); |
@@ -745,64 +743,58 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
745 | crc++; | 743 | crc++; |
746 | bytes += PAGE_CACHE_SIZE; | 744 | bytes += PAGE_CACHE_SIZE; |
747 | 745 | ||
748 | ClearPageChecked(page); | ||
749 | set_page_extent_mapped(page); | ||
750 | SetPageUptodate(page); | ||
751 | set_page_dirty(page); | ||
752 | unlock_page(page); | ||
753 | page_cache_release(page); | ||
754 | page_cache_release(page); | ||
755 | list_del_init(&entry->list); | 746 | list_del_init(&entry->list); |
756 | index++; | 747 | index++; |
757 | } | 748 | } |
758 | 749 | ||
750 | if (out_of_space) { | ||
751 | btrfs_drop_pages(pages, num_pages); | ||
752 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0, | ||
753 | i_size_read(inode) - 1, &cached_state, | ||
754 | GFP_NOFS); | ||
755 | ret = 0; | ||
756 | goto out_free; | ||
757 | } | ||
758 | |||
759 | /* Zero out the rest of the pages just to make sure */ | 759 | /* Zero out the rest of the pages just to make sure */ |
760 | while (index <= last_index) { | 760 | while (index < num_pages) { |
761 | void *addr; | 761 | void *addr; |
762 | 762 | ||
763 | page = find_get_page(inode->i_mapping, index); | 763 | page = pages[index]; |
764 | |||
765 | addr = kmap(page); | 764 | addr = kmap(page); |
766 | memset(addr, 0, PAGE_CACHE_SIZE); | 765 | memset(addr, 0, PAGE_CACHE_SIZE); |
767 | kunmap(page); | 766 | kunmap(page); |
768 | ClearPageChecked(page); | ||
769 | set_page_extent_mapped(page); | ||
770 | SetPageUptodate(page); | ||
771 | set_page_dirty(page); | ||
772 | unlock_page(page); | ||
773 | page_cache_release(page); | ||
774 | page_cache_release(page); | ||
775 | bytes += PAGE_CACHE_SIZE; | 767 | bytes += PAGE_CACHE_SIZE; |
776 | index++; | 768 | index++; |
777 | } | 769 | } |
778 | 770 | ||
779 | btrfs_set_extent_delalloc(inode, 0, bytes - 1, &cached_state); | ||
780 | |||
781 | /* Write the checksums and trans id to the first page */ | 771 | /* Write the checksums and trans id to the first page */ |
782 | { | 772 | { |
783 | void *addr; | 773 | void *addr; |
784 | u64 *gen; | 774 | u64 *gen; |
785 | 775 | ||
786 | page = find_get_page(inode->i_mapping, 0); | 776 | page = pages[0]; |
787 | 777 | ||
788 | addr = kmap(page); | 778 | addr = kmap(page); |
789 | memcpy(addr, checksums, sizeof(u32) * num_checksums); | 779 | memcpy(addr, checksums, sizeof(u32) * num_pages); |
790 | gen = addr + (sizeof(u32) * num_checksums); | 780 | gen = addr + (sizeof(u32) * num_pages); |
791 | *gen = trans->transid; | 781 | *gen = trans->transid; |
792 | kunmap(page); | 782 | kunmap(page); |
793 | ClearPageChecked(page); | ||
794 | set_page_extent_mapped(page); | ||
795 | SetPageUptodate(page); | ||
796 | set_page_dirty(page); | ||
797 | unlock_page(page); | ||
798 | page_cache_release(page); | ||
799 | page_cache_release(page); | ||
800 | } | 783 | } |
801 | BTRFS_I(inode)->generation = trans->transid; | ||
802 | 784 | ||
785 | ret = btrfs_dirty_pages(root, inode, pages, num_pages, 0, | ||
786 | bytes, &cached_state); | ||
787 | btrfs_drop_pages(pages, num_pages); | ||
803 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0, | 788 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0, |
804 | i_size_read(inode) - 1, &cached_state, GFP_NOFS); | 789 | i_size_read(inode) - 1, &cached_state, GFP_NOFS); |
805 | 790 | ||
791 | if (ret) { | ||
792 | ret = 0; | ||
793 | goto out_free; | ||
794 | } | ||
795 | |||
796 | BTRFS_I(inode)->generation = trans->transid; | ||
797 | |||
806 | filemap_write_and_wait(inode->i_mapping); | 798 | filemap_write_and_wait(inode->i_mapping); |
807 | 799 | ||
808 | key.objectid = BTRFS_FREE_SPACE_OBJECTID; | 800 | key.objectid = BTRFS_FREE_SPACE_OBJECTID; |
@@ -853,6 +845,7 @@ out_free: | |||
853 | BTRFS_I(inode)->generation = 0; | 845 | BTRFS_I(inode)->generation = 0; |
854 | } | 846 | } |
855 | kfree(checksums); | 847 | kfree(checksums); |
848 | kfree(pages); | ||
856 | btrfs_update_inode(trans, root, inode); | 849 | btrfs_update_inode(trans, root, inode); |
857 | iput(inode); | 850 | iput(inode); |
858 | return ret; | 851 | return ret; |
@@ -1775,10 +1768,13 @@ void btrfs_remove_free_space_cache(struct btrfs_block_group_cache *block_group) | |||
1775 | 1768 | ||
1776 | while ((node = rb_last(&block_group->free_space_offset)) != NULL) { | 1769 | while ((node = rb_last(&block_group->free_space_offset)) != NULL) { |
1777 | info = rb_entry(node, struct btrfs_free_space, offset_index); | 1770 | info = rb_entry(node, struct btrfs_free_space, offset_index); |
1778 | unlink_free_space(block_group, info); | 1771 | if (!info->bitmap) { |
1779 | if (info->bitmap) | 1772 | unlink_free_space(block_group, info); |
1780 | kfree(info->bitmap); | 1773 | kmem_cache_free(btrfs_free_space_cachep, info); |
1781 | kmem_cache_free(btrfs_free_space_cachep, info); | 1774 | } else { |
1775 | free_bitmap(block_group, info); | ||
1776 | } | ||
1777 | |||
1782 | if (need_resched()) { | 1778 | if (need_resched()) { |
1783 | spin_unlock(&block_group->tree_lock); | 1779 | spin_unlock(&block_group->tree_lock); |
1784 | cond_resched(); | 1780 | cond_resched(); |
@@ -2308,7 +2304,7 @@ int btrfs_trim_block_group(struct btrfs_block_group_cache *block_group, | |||
2308 | start = entry->offset; | 2304 | start = entry->offset; |
2309 | bytes = min(entry->bytes, end - start); | 2305 | bytes = min(entry->bytes, end - start); |
2310 | unlink_free_space(block_group, entry); | 2306 | unlink_free_space(block_group, entry); |
2311 | kfree(entry); | 2307 | kmem_cache_free(btrfs_free_space_cachep, entry); |
2312 | } | 2308 | } |
2313 | 2309 | ||
2314 | spin_unlock(&block_group->tree_lock); | 2310 | spin_unlock(&block_group->tree_lock); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5cc64ab9c485..7cd8ab0ef04d 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -954,6 +954,7 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page, | |||
954 | 1, 0, NULL, GFP_NOFS); | 954 | 1, 0, NULL, GFP_NOFS); |
955 | while (start < end) { | 955 | while (start < end) { |
956 | async_cow = kmalloc(sizeof(*async_cow), GFP_NOFS); | 956 | async_cow = kmalloc(sizeof(*async_cow), GFP_NOFS); |
957 | BUG_ON(!async_cow); | ||
957 | async_cow->inode = inode; | 958 | async_cow->inode = inode; |
958 | async_cow->root = root; | 959 | async_cow->root = root; |
959 | async_cow->locked_page = locked_page; | 960 | async_cow->locked_page = locked_page; |
@@ -1770,9 +1771,12 @@ static int btrfs_finish_ordered_io(struct inode *inode, u64 start, u64 end) | |||
1770 | add_pending_csums(trans, inode, ordered_extent->file_offset, | 1771 | add_pending_csums(trans, inode, ordered_extent->file_offset, |
1771 | &ordered_extent->list); | 1772 | &ordered_extent->list); |
1772 | 1773 | ||
1773 | btrfs_ordered_update_i_size(inode, 0, ordered_extent); | 1774 | ret = btrfs_ordered_update_i_size(inode, 0, ordered_extent); |
1774 | ret = btrfs_update_inode(trans, root, inode); | 1775 | if (!ret) { |
1775 | BUG_ON(ret); | 1776 | ret = btrfs_update_inode(trans, root, inode); |
1777 | BUG_ON(ret); | ||
1778 | } | ||
1779 | ret = 0; | ||
1776 | out: | 1780 | out: |
1777 | if (nolock) { | 1781 | if (nolock) { |
1778 | if (trans) | 1782 | if (trans) |
@@ -2590,6 +2594,13 @@ static void fill_inode_item(struct btrfs_trans_handle *trans, | |||
2590 | struct btrfs_inode_item *item, | 2594 | struct btrfs_inode_item *item, |
2591 | struct inode *inode) | 2595 | struct inode *inode) |
2592 | { | 2596 | { |
2597 | if (!leaf->map_token) | ||
2598 | map_private_extent_buffer(leaf, (unsigned long)item, | ||
2599 | sizeof(struct btrfs_inode_item), | ||
2600 | &leaf->map_token, &leaf->kaddr, | ||
2601 | &leaf->map_start, &leaf->map_len, | ||
2602 | KM_USER1); | ||
2603 | |||
2593 | btrfs_set_inode_uid(leaf, item, inode->i_uid); | 2604 | btrfs_set_inode_uid(leaf, item, inode->i_uid); |
2594 | btrfs_set_inode_gid(leaf, item, inode->i_gid); | 2605 | btrfs_set_inode_gid(leaf, item, inode->i_gid); |
2595 | btrfs_set_inode_size(leaf, item, BTRFS_I(inode)->disk_i_size); | 2606 | btrfs_set_inode_size(leaf, item, BTRFS_I(inode)->disk_i_size); |
@@ -2618,6 +2629,11 @@ static void fill_inode_item(struct btrfs_trans_handle *trans, | |||
2618 | btrfs_set_inode_rdev(leaf, item, inode->i_rdev); | 2629 | btrfs_set_inode_rdev(leaf, item, inode->i_rdev); |
2619 | btrfs_set_inode_flags(leaf, item, BTRFS_I(inode)->flags); | 2630 | btrfs_set_inode_flags(leaf, item, BTRFS_I(inode)->flags); |
2620 | btrfs_set_inode_block_group(leaf, item, BTRFS_I(inode)->block_group); | 2631 | btrfs_set_inode_block_group(leaf, item, BTRFS_I(inode)->block_group); |
2632 | |||
2633 | if (leaf->map_token) { | ||
2634 | unmap_extent_buffer(leaf, leaf->map_token, KM_USER1); | ||
2635 | leaf->map_token = NULL; | ||
2636 | } | ||
2621 | } | 2637 | } |
2622 | 2638 | ||
2623 | /* | 2639 | /* |
@@ -4207,10 +4223,8 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, | |||
4207 | struct btrfs_key found_key; | 4223 | struct btrfs_key found_key; |
4208 | struct btrfs_path *path; | 4224 | struct btrfs_path *path; |
4209 | int ret; | 4225 | int ret; |
4210 | u32 nritems; | ||
4211 | struct extent_buffer *leaf; | 4226 | struct extent_buffer *leaf; |
4212 | int slot; | 4227 | int slot; |
4213 | int advance; | ||
4214 | unsigned char d_type; | 4228 | unsigned char d_type; |
4215 | int over = 0; | 4229 | int over = 0; |
4216 | u32 di_cur; | 4230 | u32 di_cur; |
@@ -4253,27 +4267,19 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, | |||
4253 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); | 4267 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); |
4254 | if (ret < 0) | 4268 | if (ret < 0) |
4255 | goto err; | 4269 | goto err; |
4256 | advance = 0; | ||
4257 | 4270 | ||
4258 | while (1) { | 4271 | while (1) { |
4259 | leaf = path->nodes[0]; | 4272 | leaf = path->nodes[0]; |
4260 | nritems = btrfs_header_nritems(leaf); | ||
4261 | slot = path->slots[0]; | 4273 | slot = path->slots[0]; |
4262 | if (advance || slot >= nritems) { | 4274 | if (slot >= btrfs_header_nritems(leaf)) { |
4263 | if (slot >= nritems - 1) { | 4275 | ret = btrfs_next_leaf(root, path); |
4264 | ret = btrfs_next_leaf(root, path); | 4276 | if (ret < 0) |
4265 | if (ret) | 4277 | goto err; |
4266 | break; | 4278 | else if (ret > 0) |
4267 | leaf = path->nodes[0]; | 4279 | break; |
4268 | nritems = btrfs_header_nritems(leaf); | 4280 | continue; |
4269 | slot = path->slots[0]; | ||
4270 | } else { | ||
4271 | slot++; | ||
4272 | path->slots[0]++; | ||
4273 | } | ||
4274 | } | 4281 | } |
4275 | 4282 | ||
4276 | advance = 1; | ||
4277 | item = btrfs_item_nr(leaf, slot); | 4283 | item = btrfs_item_nr(leaf, slot); |
4278 | btrfs_item_key_to_cpu(leaf, &found_key, slot); | 4284 | btrfs_item_key_to_cpu(leaf, &found_key, slot); |
4279 | 4285 | ||
@@ -4282,7 +4288,7 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, | |||
4282 | if (btrfs_key_type(&found_key) != key_type) | 4288 | if (btrfs_key_type(&found_key) != key_type) |
4283 | break; | 4289 | break; |
4284 | if (found_key.offset < filp->f_pos) | 4290 | if (found_key.offset < filp->f_pos) |
4285 | continue; | 4291 | goto next; |
4286 | 4292 | ||
4287 | filp->f_pos = found_key.offset; | 4293 | filp->f_pos = found_key.offset; |
4288 | 4294 | ||
@@ -4335,6 +4341,8 @@ skip: | |||
4335 | di_cur += di_len; | 4341 | di_cur += di_len; |
4336 | di = (struct btrfs_dir_item *)((char *)di + di_len); | 4342 | di = (struct btrfs_dir_item *)((char *)di + di_len); |
4337 | } | 4343 | } |
4344 | next: | ||
4345 | path->slots[0]++; | ||
4338 | } | 4346 | } |
4339 | 4347 | ||
4340 | /* Reached end of directory/root. Bump pos past the last item. */ | 4348 | /* Reached end of directory/root. Bump pos past the last item. */ |
@@ -4527,14 +4535,17 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
4527 | BUG_ON(!path); | 4535 | BUG_ON(!path); |
4528 | 4536 | ||
4529 | inode = new_inode(root->fs_info->sb); | 4537 | inode = new_inode(root->fs_info->sb); |
4530 | if (!inode) | 4538 | if (!inode) { |
4539 | btrfs_free_path(path); | ||
4531 | return ERR_PTR(-ENOMEM); | 4540 | return ERR_PTR(-ENOMEM); |
4541 | } | ||
4532 | 4542 | ||
4533 | if (dir) { | 4543 | if (dir) { |
4534 | trace_btrfs_inode_request(dir); | 4544 | trace_btrfs_inode_request(dir); |
4535 | 4545 | ||
4536 | ret = btrfs_set_inode_index(dir, index); | 4546 | ret = btrfs_set_inode_index(dir, index); |
4537 | if (ret) { | 4547 | if (ret) { |
4548 | btrfs_free_path(path); | ||
4538 | iput(inode); | 4549 | iput(inode); |
4539 | return ERR_PTR(ret); | 4550 | return ERR_PTR(ret); |
4540 | } | 4551 | } |
@@ -4721,9 +4732,10 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, | |||
4721 | inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, | 4732 | inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, |
4722 | dentry->d_name.len, dir->i_ino, objectid, | 4733 | dentry->d_name.len, dir->i_ino, objectid, |
4723 | BTRFS_I(dir)->block_group, mode, &index); | 4734 | BTRFS_I(dir)->block_group, mode, &index); |
4724 | err = PTR_ERR(inode); | 4735 | if (IS_ERR(inode)) { |
4725 | if (IS_ERR(inode)) | 4736 | err = PTR_ERR(inode); |
4726 | goto out_unlock; | 4737 | goto out_unlock; |
4738 | } | ||
4727 | 4739 | ||
4728 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | 4740 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); |
4729 | if (err) { | 4741 | if (err) { |
@@ -4782,9 +4794,10 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, | |||
4782 | inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, | 4794 | inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, |
4783 | dentry->d_name.len, dir->i_ino, objectid, | 4795 | dentry->d_name.len, dir->i_ino, objectid, |
4784 | BTRFS_I(dir)->block_group, mode, &index); | 4796 | BTRFS_I(dir)->block_group, mode, &index); |
4785 | err = PTR_ERR(inode); | 4797 | if (IS_ERR(inode)) { |
4786 | if (IS_ERR(inode)) | 4798 | err = PTR_ERR(inode); |
4787 | goto out_unlock; | 4799 | goto out_unlock; |
4800 | } | ||
4788 | 4801 | ||
4789 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | 4802 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); |
4790 | if (err) { | 4803 | if (err) { |
@@ -4834,9 +4847,6 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
4834 | if (inode->i_nlink == ~0U) | 4847 | if (inode->i_nlink == ~0U) |
4835 | return -EMLINK; | 4848 | return -EMLINK; |
4836 | 4849 | ||
4837 | btrfs_inc_nlink(inode); | ||
4838 | inode->i_ctime = CURRENT_TIME; | ||
4839 | |||
4840 | err = btrfs_set_inode_index(dir, &index); | 4850 | err = btrfs_set_inode_index(dir, &index); |
4841 | if (err) | 4851 | if (err) |
4842 | goto fail; | 4852 | goto fail; |
@@ -4852,6 +4862,9 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
4852 | goto fail; | 4862 | goto fail; |
4853 | } | 4863 | } |
4854 | 4864 | ||
4865 | btrfs_inc_nlink(inode); | ||
4866 | inode->i_ctime = CURRENT_TIME; | ||
4867 | |||
4855 | btrfs_set_trans_block_group(trans, dir); | 4868 | btrfs_set_trans_block_group(trans, dir); |
4856 | ihold(inode); | 4869 | ihold(inode); |
4857 | 4870 | ||
@@ -4989,6 +5002,8 @@ static noinline int uncompress_inline(struct btrfs_path *path, | |||
4989 | inline_size = btrfs_file_extent_inline_item_len(leaf, | 5002 | inline_size = btrfs_file_extent_inline_item_len(leaf, |
4990 | btrfs_item_nr(leaf, path->slots[0])); | 5003 | btrfs_item_nr(leaf, path->slots[0])); |
4991 | tmp = kmalloc(inline_size, GFP_NOFS); | 5004 | tmp = kmalloc(inline_size, GFP_NOFS); |
5005 | if (!tmp) | ||
5006 | return -ENOMEM; | ||
4992 | ptr = btrfs_file_extent_inline_start(item); | 5007 | ptr = btrfs_file_extent_inline_start(item); |
4993 | 5008 | ||
4994 | read_extent_buffer(leaf, tmp, ptr, inline_size); | 5009 | read_extent_buffer(leaf, tmp, ptr, inline_size); |
@@ -5221,7 +5236,7 @@ again: | |||
5221 | btrfs_mark_buffer_dirty(leaf); | 5236 | btrfs_mark_buffer_dirty(leaf); |
5222 | } | 5237 | } |
5223 | set_extent_uptodate(io_tree, em->start, | 5238 | set_extent_uptodate(io_tree, em->start, |
5224 | extent_map_end(em) - 1, GFP_NOFS); | 5239 | extent_map_end(em) - 1, NULL, GFP_NOFS); |
5225 | goto insert; | 5240 | goto insert; |
5226 | } else { | 5241 | } else { |
5227 | printk(KERN_ERR "btrfs unknown found_type %d\n", found_type); | 5242 | printk(KERN_ERR "btrfs unknown found_type %d\n", found_type); |
@@ -5428,17 +5443,30 @@ out: | |||
5428 | } | 5443 | } |
5429 | 5444 | ||
5430 | static struct extent_map *btrfs_new_extent_direct(struct inode *inode, | 5445 | static struct extent_map *btrfs_new_extent_direct(struct inode *inode, |
5446 | struct extent_map *em, | ||
5431 | u64 start, u64 len) | 5447 | u64 start, u64 len) |
5432 | { | 5448 | { |
5433 | struct btrfs_root *root = BTRFS_I(inode)->root; | 5449 | struct btrfs_root *root = BTRFS_I(inode)->root; |
5434 | struct btrfs_trans_handle *trans; | 5450 | struct btrfs_trans_handle *trans; |
5435 | struct extent_map *em; | ||
5436 | struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; | 5451 | struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; |
5437 | struct btrfs_key ins; | 5452 | struct btrfs_key ins; |
5438 | u64 alloc_hint; | 5453 | u64 alloc_hint; |
5439 | int ret; | 5454 | int ret; |
5455 | bool insert = false; | ||
5440 | 5456 | ||
5441 | btrfs_drop_extent_cache(inode, start, start + len - 1, 0); | 5457 | /* |
5458 | * Ok if the extent map we looked up is a hole and is for the exact | ||
5459 | * range we want, there is no reason to allocate a new one, however if | ||
5460 | * it is not right then we need to free this one and drop the cache for | ||
5461 | * our range. | ||
5462 | */ | ||
5463 | if (em->block_start != EXTENT_MAP_HOLE || em->start != start || | ||
5464 | em->len != len) { | ||
5465 | free_extent_map(em); | ||
5466 | em = NULL; | ||
5467 | insert = true; | ||
5468 | btrfs_drop_extent_cache(inode, start, start + len - 1, 0); | ||
5469 | } | ||
5442 | 5470 | ||
5443 | trans = btrfs_join_transaction(root, 0); | 5471 | trans = btrfs_join_transaction(root, 0); |
5444 | if (IS_ERR(trans)) | 5472 | if (IS_ERR(trans)) |
@@ -5454,10 +5482,12 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode, | |||
5454 | goto out; | 5482 | goto out; |
5455 | } | 5483 | } |
5456 | 5484 | ||
5457 | em = alloc_extent_map(GFP_NOFS); | ||
5458 | if (!em) { | 5485 | if (!em) { |
5459 | em = ERR_PTR(-ENOMEM); | 5486 | em = alloc_extent_map(GFP_NOFS); |
5460 | goto out; | 5487 | if (!em) { |
5488 | em = ERR_PTR(-ENOMEM); | ||
5489 | goto out; | ||
5490 | } | ||
5461 | } | 5491 | } |
5462 | 5492 | ||
5463 | em->start = start; | 5493 | em->start = start; |
@@ -5467,9 +5497,15 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode, | |||
5467 | em->block_start = ins.objectid; | 5497 | em->block_start = ins.objectid; |
5468 | em->block_len = ins.offset; | 5498 | em->block_len = ins.offset; |
5469 | em->bdev = root->fs_info->fs_devices->latest_bdev; | 5499 | em->bdev = root->fs_info->fs_devices->latest_bdev; |
5500 | |||
5501 | /* | ||
5502 | * We need to do this because if we're using the original em we searched | ||
5503 | * for, we could have EXTENT_FLAG_VACANCY set, and we don't want that. | ||
5504 | */ | ||
5505 | em->flags = 0; | ||
5470 | set_bit(EXTENT_FLAG_PINNED, &em->flags); | 5506 | set_bit(EXTENT_FLAG_PINNED, &em->flags); |
5471 | 5507 | ||
5472 | while (1) { | 5508 | while (insert) { |
5473 | write_lock(&em_tree->lock); | 5509 | write_lock(&em_tree->lock); |
5474 | ret = add_extent_mapping(em_tree, em); | 5510 | ret = add_extent_mapping(em_tree, em); |
5475 | write_unlock(&em_tree->lock); | 5511 | write_unlock(&em_tree->lock); |
@@ -5687,8 +5723,7 @@ must_cow: | |||
5687 | * it above | 5723 | * it above |
5688 | */ | 5724 | */ |
5689 | len = bh_result->b_size; | 5725 | len = bh_result->b_size; |
5690 | free_extent_map(em); | 5726 | em = btrfs_new_extent_direct(inode, em, start, len); |
5691 | em = btrfs_new_extent_direct(inode, start, len); | ||
5692 | if (IS_ERR(em)) | 5727 | if (IS_ERR(em)) |
5693 | return PTR_ERR(em); | 5728 | return PTR_ERR(em); |
5694 | len = min(len, em->len - (start - em->start)); | 5729 | len = min(len, em->len - (start - em->start)); |
@@ -5851,8 +5886,10 @@ again: | |||
5851 | } | 5886 | } |
5852 | 5887 | ||
5853 | add_pending_csums(trans, inode, ordered->file_offset, &ordered->list); | 5888 | add_pending_csums(trans, inode, ordered->file_offset, &ordered->list); |
5854 | btrfs_ordered_update_i_size(inode, 0, ordered); | 5889 | ret = btrfs_ordered_update_i_size(inode, 0, ordered); |
5855 | btrfs_update_inode(trans, root, inode); | 5890 | if (!ret) |
5891 | btrfs_update_inode(trans, root, inode); | ||
5892 | ret = 0; | ||
5856 | out_unlock: | 5893 | out_unlock: |
5857 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, ordered->file_offset, | 5894 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, ordered->file_offset, |
5858 | ordered->file_offset + ordered->len - 1, | 5895 | ordered->file_offset + ordered->len - 1, |
@@ -5938,7 +5975,7 @@ static struct bio *btrfs_dio_bio_alloc(struct block_device *bdev, | |||
5938 | 5975 | ||
5939 | static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, | 5976 | static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, |
5940 | int rw, u64 file_offset, int skip_sum, | 5977 | int rw, u64 file_offset, int skip_sum, |
5941 | u32 *csums) | 5978 | u32 *csums, int async_submit) |
5942 | { | 5979 | { |
5943 | int write = rw & REQ_WRITE; | 5980 | int write = rw & REQ_WRITE; |
5944 | struct btrfs_root *root = BTRFS_I(inode)->root; | 5981 | struct btrfs_root *root = BTRFS_I(inode)->root; |
@@ -5949,13 +5986,24 @@ static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, | |||
5949 | if (ret) | 5986 | if (ret) |
5950 | goto err; | 5987 | goto err; |
5951 | 5988 | ||
5952 | if (write && !skip_sum) { | 5989 | if (skip_sum) |
5990 | goto map; | ||
5991 | |||
5992 | if (write && async_submit) { | ||
5953 | ret = btrfs_wq_submit_bio(root->fs_info, | 5993 | ret = btrfs_wq_submit_bio(root->fs_info, |
5954 | inode, rw, bio, 0, 0, | 5994 | inode, rw, bio, 0, 0, |
5955 | file_offset, | 5995 | file_offset, |
5956 | __btrfs_submit_bio_start_direct_io, | 5996 | __btrfs_submit_bio_start_direct_io, |
5957 | __btrfs_submit_bio_done); | 5997 | __btrfs_submit_bio_done); |
5958 | goto err; | 5998 | goto err; |
5999 | } else if (write) { | ||
6000 | /* | ||
6001 | * If we aren't doing async submit, calculate the csum of the | ||
6002 | * bio now. | ||
6003 | */ | ||
6004 | ret = btrfs_csum_one_bio(root, inode, bio, file_offset, 1); | ||
6005 | if (ret) | ||
6006 | goto err; | ||
5959 | } else if (!skip_sum) { | 6007 | } else if (!skip_sum) { |
5960 | ret = btrfs_lookup_bio_sums_dio(root, inode, bio, | 6008 | ret = btrfs_lookup_bio_sums_dio(root, inode, bio, |
5961 | file_offset, csums); | 6009 | file_offset, csums); |
@@ -5963,7 +6011,8 @@ static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode, | |||
5963 | goto err; | 6011 | goto err; |
5964 | } | 6012 | } |
5965 | 6013 | ||
5966 | ret = btrfs_map_bio(root, rw, bio, 0, 1); | 6014 | map: |
6015 | ret = btrfs_map_bio(root, rw, bio, 0, async_submit); | ||
5967 | err: | 6016 | err: |
5968 | bio_put(bio); | 6017 | bio_put(bio); |
5969 | return ret; | 6018 | return ret; |
@@ -5985,23 +6034,30 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, | |||
5985 | int nr_pages = 0; | 6034 | int nr_pages = 0; |
5986 | u32 *csums = dip->csums; | 6035 | u32 *csums = dip->csums; |
5987 | int ret = 0; | 6036 | int ret = 0; |
6037 | int async_submit = 0; | ||
5988 | int write = rw & REQ_WRITE; | 6038 | int write = rw & REQ_WRITE; |
5989 | 6039 | ||
5990 | bio = btrfs_dio_bio_alloc(orig_bio->bi_bdev, start_sector, GFP_NOFS); | ||
5991 | if (!bio) | ||
5992 | return -ENOMEM; | ||
5993 | bio->bi_private = dip; | ||
5994 | bio->bi_end_io = btrfs_end_dio_bio; | ||
5995 | atomic_inc(&dip->pending_bios); | ||
5996 | |||
5997 | map_length = orig_bio->bi_size; | 6040 | map_length = orig_bio->bi_size; |
5998 | ret = btrfs_map_block(map_tree, READ, start_sector << 9, | 6041 | ret = btrfs_map_block(map_tree, READ, start_sector << 9, |
5999 | &map_length, NULL, 0); | 6042 | &map_length, NULL, 0); |
6000 | if (ret) { | 6043 | if (ret) { |
6001 | bio_put(bio); | 6044 | bio_put(orig_bio); |
6002 | return -EIO; | 6045 | return -EIO; |
6003 | } | 6046 | } |
6004 | 6047 | ||
6048 | if (map_length >= orig_bio->bi_size) { | ||
6049 | bio = orig_bio; | ||
6050 | goto submit; | ||
6051 | } | ||
6052 | |||
6053 | async_submit = 1; | ||
6054 | bio = btrfs_dio_bio_alloc(orig_bio->bi_bdev, start_sector, GFP_NOFS); | ||
6055 | if (!bio) | ||
6056 | return -ENOMEM; | ||
6057 | bio->bi_private = dip; | ||
6058 | bio->bi_end_io = btrfs_end_dio_bio; | ||
6059 | atomic_inc(&dip->pending_bios); | ||
6060 | |||
6005 | while (bvec <= (orig_bio->bi_io_vec + orig_bio->bi_vcnt - 1)) { | 6061 | while (bvec <= (orig_bio->bi_io_vec + orig_bio->bi_vcnt - 1)) { |
6006 | if (unlikely(map_length < submit_len + bvec->bv_len || | 6062 | if (unlikely(map_length < submit_len + bvec->bv_len || |
6007 | bio_add_page(bio, bvec->bv_page, bvec->bv_len, | 6063 | bio_add_page(bio, bvec->bv_page, bvec->bv_len, |
@@ -6015,7 +6071,7 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, | |||
6015 | atomic_inc(&dip->pending_bios); | 6071 | atomic_inc(&dip->pending_bios); |
6016 | ret = __btrfs_submit_dio_bio(bio, inode, rw, | 6072 | ret = __btrfs_submit_dio_bio(bio, inode, rw, |
6017 | file_offset, skip_sum, | 6073 | file_offset, skip_sum, |
6018 | csums); | 6074 | csums, async_submit); |
6019 | if (ret) { | 6075 | if (ret) { |
6020 | bio_put(bio); | 6076 | bio_put(bio); |
6021 | atomic_dec(&dip->pending_bios); | 6077 | atomic_dec(&dip->pending_bios); |
@@ -6052,8 +6108,9 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip, | |||
6052 | } | 6108 | } |
6053 | } | 6109 | } |
6054 | 6110 | ||
6111 | submit: | ||
6055 | ret = __btrfs_submit_dio_bio(bio, inode, rw, file_offset, skip_sum, | 6112 | ret = __btrfs_submit_dio_bio(bio, inode, rw, file_offset, skip_sum, |
6056 | csums); | 6113 | csums, async_submit); |
6057 | if (!ret) | 6114 | if (!ret) |
6058 | return 0; | 6115 | return 0; |
6059 | 6116 | ||
@@ -6148,6 +6205,7 @@ static ssize_t check_direct_IO(struct btrfs_root *root, int rw, struct kiocb *io | |||
6148 | unsigned long nr_segs) | 6205 | unsigned long nr_segs) |
6149 | { | 6206 | { |
6150 | int seg; | 6207 | int seg; |
6208 | int i; | ||
6151 | size_t size; | 6209 | size_t size; |
6152 | unsigned long addr; | 6210 | unsigned long addr; |
6153 | unsigned blocksize_mask = root->sectorsize - 1; | 6211 | unsigned blocksize_mask = root->sectorsize - 1; |
@@ -6162,8 +6220,22 @@ static ssize_t check_direct_IO(struct btrfs_root *root, int rw, struct kiocb *io | |||
6162 | addr = (unsigned long)iov[seg].iov_base; | 6220 | addr = (unsigned long)iov[seg].iov_base; |
6163 | size = iov[seg].iov_len; | 6221 | size = iov[seg].iov_len; |
6164 | end += size; | 6222 | end += size; |
6165 | if ((addr & blocksize_mask) || (size & blocksize_mask)) | 6223 | if ((addr & blocksize_mask) || (size & blocksize_mask)) |
6166 | goto out; | 6224 | goto out; |
6225 | |||
6226 | /* If this is a write we don't need to check anymore */ | ||
6227 | if (rw & WRITE) | ||
6228 | continue; | ||
6229 | |||
6230 | /* | ||
6231 | * Check to make sure we don't have duplicate iov_base's in this | ||
6232 | * iovec, if so return EINVAL, otherwise we'll get csum errors | ||
6233 | * when reading back. | ||
6234 | */ | ||
6235 | for (i = seg + 1; i < nr_segs; i++) { | ||
6236 | if (iov[seg].iov_base == iov[i].iov_base) | ||
6237 | goto out; | ||
6238 | } | ||
6167 | } | 6239 | } |
6168 | retval = 0; | 6240 | retval = 0; |
6169 | out: | 6241 | out: |
@@ -7206,9 +7278,10 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
7206 | dentry->d_name.len, dir->i_ino, objectid, | 7278 | dentry->d_name.len, dir->i_ino, objectid, |
7207 | BTRFS_I(dir)->block_group, S_IFLNK|S_IRWXUGO, | 7279 | BTRFS_I(dir)->block_group, S_IFLNK|S_IRWXUGO, |
7208 | &index); | 7280 | &index); |
7209 | err = PTR_ERR(inode); | 7281 | if (IS_ERR(inode)) { |
7210 | if (IS_ERR(inode)) | 7282 | err = PTR_ERR(inode); |
7211 | goto out_unlock; | 7283 | goto out_unlock; |
7284 | } | ||
7212 | 7285 | ||
7213 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | 7286 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); |
7214 | if (err) { | 7287 | if (err) { |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index cfc264fefdb0..ffb48d6c5433 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -2287,7 +2287,7 @@ long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg) | |||
2287 | struct btrfs_ioctl_space_info space; | 2287 | struct btrfs_ioctl_space_info space; |
2288 | struct btrfs_ioctl_space_info *dest; | 2288 | struct btrfs_ioctl_space_info *dest; |
2289 | struct btrfs_ioctl_space_info *dest_orig; | 2289 | struct btrfs_ioctl_space_info *dest_orig; |
2290 | struct btrfs_ioctl_space_info *user_dest; | 2290 | struct btrfs_ioctl_space_info __user *user_dest; |
2291 | struct btrfs_space_info *info; | 2291 | struct btrfs_space_info *info; |
2292 | u64 types[] = {BTRFS_BLOCK_GROUP_DATA, | 2292 | u64 types[] = {BTRFS_BLOCK_GROUP_DATA, |
2293 | BTRFS_BLOCK_GROUP_SYSTEM, | 2293 | BTRFS_BLOCK_GROUP_SYSTEM, |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 58e7de9cc90c..0ac712efcdf2 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -159,7 +159,7 @@ enum { | |||
159 | Opt_compress_type, Opt_compress_force, Opt_compress_force_type, | 159 | Opt_compress_type, Opt_compress_force, Opt_compress_force_type, |
160 | Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, | 160 | Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, |
161 | Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, | 161 | Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, |
162 | Opt_enospc_debug, Opt_err, | 162 | Opt_enospc_debug, Opt_subvolrootid, Opt_err, |
163 | }; | 163 | }; |
164 | 164 | ||
165 | static match_table_t tokens = { | 165 | static match_table_t tokens = { |
@@ -189,6 +189,7 @@ static match_table_t tokens = { | |||
189 | {Opt_clear_cache, "clear_cache"}, | 189 | {Opt_clear_cache, "clear_cache"}, |
190 | {Opt_user_subvol_rm_allowed, "user_subvol_rm_allowed"}, | 190 | {Opt_user_subvol_rm_allowed, "user_subvol_rm_allowed"}, |
191 | {Opt_enospc_debug, "enospc_debug"}, | 191 | {Opt_enospc_debug, "enospc_debug"}, |
192 | {Opt_subvolrootid, "subvolrootid=%d"}, | ||
192 | {Opt_err, NULL}, | 193 | {Opt_err, NULL}, |
193 | }; | 194 | }; |
194 | 195 | ||
@@ -232,6 +233,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
232 | break; | 233 | break; |
233 | case Opt_subvol: | 234 | case Opt_subvol: |
234 | case Opt_subvolid: | 235 | case Opt_subvolid: |
236 | case Opt_subvolrootid: | ||
235 | case Opt_device: | 237 | case Opt_device: |
236 | /* | 238 | /* |
237 | * These are parsed by btrfs_parse_early_options | 239 | * These are parsed by btrfs_parse_early_options |
@@ -388,7 +390,7 @@ out: | |||
388 | */ | 390 | */ |
389 | static int btrfs_parse_early_options(const char *options, fmode_t flags, | 391 | static int btrfs_parse_early_options(const char *options, fmode_t flags, |
390 | void *holder, char **subvol_name, u64 *subvol_objectid, | 392 | void *holder, char **subvol_name, u64 *subvol_objectid, |
391 | struct btrfs_fs_devices **fs_devices) | 393 | u64 *subvol_rootid, struct btrfs_fs_devices **fs_devices) |
392 | { | 394 | { |
393 | substring_t args[MAX_OPT_ARGS]; | 395 | substring_t args[MAX_OPT_ARGS]; |
394 | char *opts, *orig, *p; | 396 | char *opts, *orig, *p; |
@@ -429,6 +431,18 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags, | |||
429 | *subvol_objectid = intarg; | 431 | *subvol_objectid = intarg; |
430 | } | 432 | } |
431 | break; | 433 | break; |
434 | case Opt_subvolrootid: | ||
435 | intarg = 0; | ||
436 | error = match_int(&args[0], &intarg); | ||
437 | if (!error) { | ||
438 | /* we want the original fs_tree */ | ||
439 | if (!intarg) | ||
440 | *subvol_rootid = | ||
441 | BTRFS_FS_TREE_OBJECTID; | ||
442 | else | ||
443 | *subvol_rootid = intarg; | ||
444 | } | ||
445 | break; | ||
432 | case Opt_device: | 446 | case Opt_device: |
433 | error = btrfs_scan_one_device(match_strdup(&args[0]), | 447 | error = btrfs_scan_one_device(match_strdup(&args[0]), |
434 | flags, holder, fs_devices); | 448 | flags, holder, fs_devices); |
@@ -736,6 +750,7 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, | |||
736 | fmode_t mode = FMODE_READ; | 750 | fmode_t mode = FMODE_READ; |
737 | char *subvol_name = NULL; | 751 | char *subvol_name = NULL; |
738 | u64 subvol_objectid = 0; | 752 | u64 subvol_objectid = 0; |
753 | u64 subvol_rootid = 0; | ||
739 | int error = 0; | 754 | int error = 0; |
740 | 755 | ||
741 | if (!(flags & MS_RDONLY)) | 756 | if (!(flags & MS_RDONLY)) |
@@ -743,7 +758,7 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, | |||
743 | 758 | ||
744 | error = btrfs_parse_early_options(data, mode, fs_type, | 759 | error = btrfs_parse_early_options(data, mode, fs_type, |
745 | &subvol_name, &subvol_objectid, | 760 | &subvol_name, &subvol_objectid, |
746 | &fs_devices); | 761 | &subvol_rootid, &fs_devices); |
747 | if (error) | 762 | if (error) |
748 | return ERR_PTR(error); | 763 | return ERR_PTR(error); |
749 | 764 | ||
@@ -807,15 +822,17 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, | |||
807 | s->s_flags |= MS_ACTIVE; | 822 | s->s_flags |= MS_ACTIVE; |
808 | } | 823 | } |
809 | 824 | ||
810 | root = get_default_root(s, subvol_objectid); | ||
811 | if (IS_ERR(root)) { | ||
812 | error = PTR_ERR(root); | ||
813 | deactivate_locked_super(s); | ||
814 | goto error_free_subvol_name; | ||
815 | } | ||
816 | /* if they gave us a subvolume name bind mount into that */ | 825 | /* if they gave us a subvolume name bind mount into that */ |
817 | if (strcmp(subvol_name, ".")) { | 826 | if (strcmp(subvol_name, ".")) { |
818 | struct dentry *new_root; | 827 | struct dentry *new_root; |
828 | |||
829 | root = get_default_root(s, subvol_rootid); | ||
830 | if (IS_ERR(root)) { | ||
831 | error = PTR_ERR(root); | ||
832 | deactivate_locked_super(s); | ||
833 | goto error_free_subvol_name; | ||
834 | } | ||
835 | |||
819 | mutex_lock(&root->d_inode->i_mutex); | 836 | mutex_lock(&root->d_inode->i_mutex); |
820 | new_root = lookup_one_len(subvol_name, root, | 837 | new_root = lookup_one_len(subvol_name, root, |
821 | strlen(subvol_name)); | 838 | strlen(subvol_name)); |
@@ -836,6 +853,13 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, | |||
836 | } | 853 | } |
837 | dput(root); | 854 | dput(root); |
838 | root = new_root; | 855 | root = new_root; |
856 | } else { | ||
857 | root = get_default_root(s, subvol_objectid); | ||
858 | if (IS_ERR(root)) { | ||
859 | error = PTR_ERR(root); | ||
860 | deactivate_locked_super(s); | ||
861 | goto error_free_subvol_name; | ||
862 | } | ||
839 | } | 863 | } |
840 | 864 | ||
841 | kfree(subvol_name); | 865 | kfree(subvol_name); |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 5b158da7e0bb..c571734d5e5a 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -32,10 +32,8 @@ | |||
32 | 32 | ||
33 | static noinline void put_transaction(struct btrfs_transaction *transaction) | 33 | static noinline void put_transaction(struct btrfs_transaction *transaction) |
34 | { | 34 | { |
35 | WARN_ON(transaction->use_count == 0); | 35 | WARN_ON(atomic_read(&transaction->use_count) == 0); |
36 | transaction->use_count--; | 36 | if (atomic_dec_and_test(&transaction->use_count)) { |
37 | if (transaction->use_count == 0) { | ||
38 | list_del_init(&transaction->list); | ||
39 | memset(transaction, 0, sizeof(*transaction)); | 37 | memset(transaction, 0, sizeof(*transaction)); |
40 | kmem_cache_free(btrfs_transaction_cachep, transaction); | 38 | kmem_cache_free(btrfs_transaction_cachep, transaction); |
41 | } | 39 | } |
@@ -60,14 +58,14 @@ static noinline int join_transaction(struct btrfs_root *root) | |||
60 | if (!cur_trans) | 58 | if (!cur_trans) |
61 | return -ENOMEM; | 59 | return -ENOMEM; |
62 | root->fs_info->generation++; | 60 | root->fs_info->generation++; |
63 | cur_trans->num_writers = 1; | 61 | atomic_set(&cur_trans->num_writers, 1); |
64 | cur_trans->num_joined = 0; | 62 | cur_trans->num_joined = 0; |
65 | cur_trans->transid = root->fs_info->generation; | 63 | cur_trans->transid = root->fs_info->generation; |
66 | init_waitqueue_head(&cur_trans->writer_wait); | 64 | init_waitqueue_head(&cur_trans->writer_wait); |
67 | init_waitqueue_head(&cur_trans->commit_wait); | 65 | init_waitqueue_head(&cur_trans->commit_wait); |
68 | cur_trans->in_commit = 0; | 66 | cur_trans->in_commit = 0; |
69 | cur_trans->blocked = 0; | 67 | cur_trans->blocked = 0; |
70 | cur_trans->use_count = 1; | 68 | atomic_set(&cur_trans->use_count, 1); |
71 | cur_trans->commit_done = 0; | 69 | cur_trans->commit_done = 0; |
72 | cur_trans->start_time = get_seconds(); | 70 | cur_trans->start_time = get_seconds(); |
73 | 71 | ||
@@ -88,7 +86,7 @@ static noinline int join_transaction(struct btrfs_root *root) | |||
88 | root->fs_info->running_transaction = cur_trans; | 86 | root->fs_info->running_transaction = cur_trans; |
89 | spin_unlock(&root->fs_info->new_trans_lock); | 87 | spin_unlock(&root->fs_info->new_trans_lock); |
90 | } else { | 88 | } else { |
91 | cur_trans->num_writers++; | 89 | atomic_inc(&cur_trans->num_writers); |
92 | cur_trans->num_joined++; | 90 | cur_trans->num_joined++; |
93 | } | 91 | } |
94 | 92 | ||
@@ -145,7 +143,7 @@ static void wait_current_trans(struct btrfs_root *root) | |||
145 | cur_trans = root->fs_info->running_transaction; | 143 | cur_trans = root->fs_info->running_transaction; |
146 | if (cur_trans && cur_trans->blocked) { | 144 | if (cur_trans && cur_trans->blocked) { |
147 | DEFINE_WAIT(wait); | 145 | DEFINE_WAIT(wait); |
148 | cur_trans->use_count++; | 146 | atomic_inc(&cur_trans->use_count); |
149 | while (1) { | 147 | while (1) { |
150 | prepare_to_wait(&root->fs_info->transaction_wait, &wait, | 148 | prepare_to_wait(&root->fs_info->transaction_wait, &wait, |
151 | TASK_UNINTERRUPTIBLE); | 149 | TASK_UNINTERRUPTIBLE); |
@@ -181,6 +179,7 @@ static struct btrfs_trans_handle *start_transaction(struct btrfs_root *root, | |||
181 | { | 179 | { |
182 | struct btrfs_trans_handle *h; | 180 | struct btrfs_trans_handle *h; |
183 | struct btrfs_transaction *cur_trans; | 181 | struct btrfs_transaction *cur_trans; |
182 | int retries = 0; | ||
184 | int ret; | 183 | int ret; |
185 | 184 | ||
186 | if (root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) | 185 | if (root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) |
@@ -204,7 +203,7 @@ again: | |||
204 | } | 203 | } |
205 | 204 | ||
206 | cur_trans = root->fs_info->running_transaction; | 205 | cur_trans = root->fs_info->running_transaction; |
207 | cur_trans->use_count++; | 206 | atomic_inc(&cur_trans->use_count); |
208 | if (type != TRANS_JOIN_NOLOCK) | 207 | if (type != TRANS_JOIN_NOLOCK) |
209 | mutex_unlock(&root->fs_info->trans_mutex); | 208 | mutex_unlock(&root->fs_info->trans_mutex); |
210 | 209 | ||
@@ -224,10 +223,18 @@ again: | |||
224 | 223 | ||
225 | if (num_items > 0) { | 224 | if (num_items > 0) { |
226 | ret = btrfs_trans_reserve_metadata(h, root, num_items); | 225 | ret = btrfs_trans_reserve_metadata(h, root, num_items); |
227 | if (ret == -EAGAIN) { | 226 | if (ret == -EAGAIN && !retries) { |
227 | retries++; | ||
228 | btrfs_commit_transaction(h, root); | 228 | btrfs_commit_transaction(h, root); |
229 | goto again; | 229 | goto again; |
230 | } else if (ret == -EAGAIN) { | ||
231 | /* | ||
232 | * We have already retried and got EAGAIN, so really we | ||
233 | * don't have space, so set ret to -ENOSPC. | ||
234 | */ | ||
235 | ret = -ENOSPC; | ||
230 | } | 236 | } |
237 | |||
231 | if (ret < 0) { | 238 | if (ret < 0) { |
232 | btrfs_end_transaction(h, root); | 239 | btrfs_end_transaction(h, root); |
233 | return ERR_PTR(ret); | 240 | return ERR_PTR(ret); |
@@ -327,7 +334,7 @@ int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid) | |||
327 | goto out_unlock; /* nothing committing|committed */ | 334 | goto out_unlock; /* nothing committing|committed */ |
328 | } | 335 | } |
329 | 336 | ||
330 | cur_trans->use_count++; | 337 | atomic_inc(&cur_trans->use_count); |
331 | mutex_unlock(&root->fs_info->trans_mutex); | 338 | mutex_unlock(&root->fs_info->trans_mutex); |
332 | 339 | ||
333 | wait_for_commit(root, cur_trans); | 340 | wait_for_commit(root, cur_trans); |
@@ -457,18 +464,14 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
457 | wake_up_process(info->transaction_kthread); | 464 | wake_up_process(info->transaction_kthread); |
458 | } | 465 | } |
459 | 466 | ||
460 | if (lock) | ||
461 | mutex_lock(&info->trans_mutex); | ||
462 | WARN_ON(cur_trans != info->running_transaction); | 467 | WARN_ON(cur_trans != info->running_transaction); |
463 | WARN_ON(cur_trans->num_writers < 1); | 468 | WARN_ON(atomic_read(&cur_trans->num_writers) < 1); |
464 | cur_trans->num_writers--; | 469 | atomic_dec(&cur_trans->num_writers); |
465 | 470 | ||
466 | smp_mb(); | 471 | smp_mb(); |
467 | if (waitqueue_active(&cur_trans->writer_wait)) | 472 | if (waitqueue_active(&cur_trans->writer_wait)) |
468 | wake_up(&cur_trans->writer_wait); | 473 | wake_up(&cur_trans->writer_wait); |
469 | put_transaction(cur_trans); | 474 | put_transaction(cur_trans); |
470 | if (lock) | ||
471 | mutex_unlock(&info->trans_mutex); | ||
472 | 475 | ||
473 | if (current->journal_info == trans) | 476 | if (current->journal_info == trans) |
474 | current->journal_info = NULL; | 477 | current->journal_info = NULL; |
@@ -1178,7 +1181,7 @@ int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans, | |||
1178 | /* take transaction reference */ | 1181 | /* take transaction reference */ |
1179 | mutex_lock(&root->fs_info->trans_mutex); | 1182 | mutex_lock(&root->fs_info->trans_mutex); |
1180 | cur_trans = trans->transaction; | 1183 | cur_trans = trans->transaction; |
1181 | cur_trans->use_count++; | 1184 | atomic_inc(&cur_trans->use_count); |
1182 | mutex_unlock(&root->fs_info->trans_mutex); | 1185 | mutex_unlock(&root->fs_info->trans_mutex); |
1183 | 1186 | ||
1184 | btrfs_end_transaction(trans, root); | 1187 | btrfs_end_transaction(trans, root); |
@@ -1237,7 +1240,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1237 | 1240 | ||
1238 | mutex_lock(&root->fs_info->trans_mutex); | 1241 | mutex_lock(&root->fs_info->trans_mutex); |
1239 | if (cur_trans->in_commit) { | 1242 | if (cur_trans->in_commit) { |
1240 | cur_trans->use_count++; | 1243 | atomic_inc(&cur_trans->use_count); |
1241 | mutex_unlock(&root->fs_info->trans_mutex); | 1244 | mutex_unlock(&root->fs_info->trans_mutex); |
1242 | btrfs_end_transaction(trans, root); | 1245 | btrfs_end_transaction(trans, root); |
1243 | 1246 | ||
@@ -1259,7 +1262,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1259 | prev_trans = list_entry(cur_trans->list.prev, | 1262 | prev_trans = list_entry(cur_trans->list.prev, |
1260 | struct btrfs_transaction, list); | 1263 | struct btrfs_transaction, list); |
1261 | if (!prev_trans->commit_done) { | 1264 | if (!prev_trans->commit_done) { |
1262 | prev_trans->use_count++; | 1265 | atomic_inc(&prev_trans->use_count); |
1263 | mutex_unlock(&root->fs_info->trans_mutex); | 1266 | mutex_unlock(&root->fs_info->trans_mutex); |
1264 | 1267 | ||
1265 | wait_for_commit(root, prev_trans); | 1268 | wait_for_commit(root, prev_trans); |
@@ -1300,14 +1303,14 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1300 | TASK_UNINTERRUPTIBLE); | 1303 | TASK_UNINTERRUPTIBLE); |
1301 | 1304 | ||
1302 | smp_mb(); | 1305 | smp_mb(); |
1303 | if (cur_trans->num_writers > 1) | 1306 | if (atomic_read(&cur_trans->num_writers) > 1) |
1304 | schedule_timeout(MAX_SCHEDULE_TIMEOUT); | 1307 | schedule_timeout(MAX_SCHEDULE_TIMEOUT); |
1305 | else if (should_grow) | 1308 | else if (should_grow) |
1306 | schedule_timeout(1); | 1309 | schedule_timeout(1); |
1307 | 1310 | ||
1308 | mutex_lock(&root->fs_info->trans_mutex); | 1311 | mutex_lock(&root->fs_info->trans_mutex); |
1309 | finish_wait(&cur_trans->writer_wait, &wait); | 1312 | finish_wait(&cur_trans->writer_wait, &wait); |
1310 | } while (cur_trans->num_writers > 1 || | 1313 | } while (atomic_read(&cur_trans->num_writers) > 1 || |
1311 | (should_grow && cur_trans->num_joined != joined)); | 1314 | (should_grow && cur_trans->num_joined != joined)); |
1312 | 1315 | ||
1313 | ret = create_pending_snapshots(trans, root->fs_info); | 1316 | ret = create_pending_snapshots(trans, root->fs_info); |
@@ -1394,6 +1397,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1394 | 1397 | ||
1395 | wake_up(&cur_trans->commit_wait); | 1398 | wake_up(&cur_trans->commit_wait); |
1396 | 1399 | ||
1400 | list_del_init(&cur_trans->list); | ||
1397 | put_transaction(cur_trans); | 1401 | put_transaction(cur_trans); |
1398 | put_transaction(cur_trans); | 1402 | put_transaction(cur_trans); |
1399 | 1403 | ||
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h index 229a594cacd5..e441acc6c584 100644 --- a/fs/btrfs/transaction.h +++ b/fs/btrfs/transaction.h | |||
@@ -27,11 +27,11 @@ struct btrfs_transaction { | |||
27 | * total writers in this transaction, it must be zero before the | 27 | * total writers in this transaction, it must be zero before the |
28 | * transaction can end | 28 | * transaction can end |
29 | */ | 29 | */ |
30 | unsigned long num_writers; | 30 | atomic_t num_writers; |
31 | 31 | ||
32 | unsigned long num_joined; | 32 | unsigned long num_joined; |
33 | int in_commit; | 33 | int in_commit; |
34 | int use_count; | 34 | atomic_t use_count; |
35 | int commit_done; | 35 | int commit_done; |
36 | int blocked; | 36 | int blocked; |
37 | struct list_head list; | 37 | struct list_head list; |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index c50271ad3157..f997ec0c1ba4 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -2209,8 +2209,10 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans, | |||
2209 | 2209 | ||
2210 | log = root->log_root; | 2210 | log = root->log_root; |
2211 | path = btrfs_alloc_path(); | 2211 | path = btrfs_alloc_path(); |
2212 | if (!path) | 2212 | if (!path) { |
2213 | return -ENOMEM; | 2213 | err = -ENOMEM; |
2214 | goto out_unlock; | ||
2215 | } | ||
2214 | 2216 | ||
2215 | di = btrfs_lookup_dir_item(trans, log, path, dir->i_ino, | 2217 | di = btrfs_lookup_dir_item(trans, log, path, dir->i_ino, |
2216 | name, name_len, -1); | 2218 | name, name_len, -1); |
@@ -2271,6 +2273,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans, | |||
2271 | } | 2273 | } |
2272 | fail: | 2274 | fail: |
2273 | btrfs_free_path(path); | 2275 | btrfs_free_path(path); |
2276 | out_unlock: | ||
2274 | mutex_unlock(&BTRFS_I(dir)->log_mutex); | 2277 | mutex_unlock(&BTRFS_I(dir)->log_mutex); |
2275 | if (ret == -ENOSPC) { | 2278 | if (ret == -ENOSPC) { |
2276 | root->fs_info->last_trans_log_full_commit = trans->transid; | 2279 | root->fs_info->last_trans_log_full_commit = trans->transid; |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 309a57b9fc85..c7367ae5a3e6 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -155,6 +155,15 @@ static noinline int run_scheduled_bios(struct btrfs_device *device) | |||
155 | unsigned long limit; | 155 | unsigned long limit; |
156 | unsigned long last_waited = 0; | 156 | unsigned long last_waited = 0; |
157 | int force_reg = 0; | 157 | int force_reg = 0; |
158 | struct blk_plug plug; | ||
159 | |||
160 | /* | ||
161 | * this function runs all the bios we've collected for | ||
162 | * a particular device. We don't want to wander off to | ||
163 | * another device without first sending all of these down. | ||
164 | * So, setup a plug here and finish it off before we return | ||
165 | */ | ||
166 | blk_start_plug(&plug); | ||
158 | 167 | ||
159 | bdi = blk_get_backing_dev_info(device->bdev); | 168 | bdi = blk_get_backing_dev_info(device->bdev); |
160 | fs_info = device->dev_root->fs_info; | 169 | fs_info = device->dev_root->fs_info; |
@@ -294,6 +303,7 @@ loop_lock: | |||
294 | spin_unlock(&device->io_lock); | 303 | spin_unlock(&device->io_lock); |
295 | 304 | ||
296 | done: | 305 | done: |
306 | blk_finish_plug(&plug); | ||
297 | return 0; | 307 | return 0; |
298 | } | 308 | } |
299 | 309 | ||
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index a5303b871b13..cfd660550ded 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c | |||
@@ -180,11 +180,10 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
180 | struct btrfs_path *path; | 180 | struct btrfs_path *path; |
181 | struct extent_buffer *leaf; | 181 | struct extent_buffer *leaf; |
182 | struct btrfs_dir_item *di; | 182 | struct btrfs_dir_item *di; |
183 | int ret = 0, slot, advance; | 183 | int ret = 0, slot; |
184 | size_t total_size = 0, size_left = size; | 184 | size_t total_size = 0, size_left = size; |
185 | unsigned long name_ptr; | 185 | unsigned long name_ptr; |
186 | size_t name_len; | 186 | size_t name_len; |
187 | u32 nritems; | ||
188 | 187 | ||
189 | /* | 188 | /* |
190 | * ok we want all objects associated with this id. | 189 | * ok we want all objects associated with this id. |
@@ -204,34 +203,24 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
204 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); | 203 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); |
205 | if (ret < 0) | 204 | if (ret < 0) |
206 | goto err; | 205 | goto err; |
207 | advance = 0; | 206 | |
208 | while (1) { | 207 | while (1) { |
209 | leaf = path->nodes[0]; | 208 | leaf = path->nodes[0]; |
210 | nritems = btrfs_header_nritems(leaf); | ||
211 | slot = path->slots[0]; | 209 | slot = path->slots[0]; |
212 | 210 | ||
213 | /* this is where we start walking through the path */ | 211 | /* this is where we start walking through the path */ |
214 | if (advance || slot >= nritems) { | 212 | if (slot >= btrfs_header_nritems(leaf)) { |
215 | /* | 213 | /* |
216 | * if we've reached the last slot in this leaf we need | 214 | * if we've reached the last slot in this leaf we need |
217 | * to go to the next leaf and reset everything | 215 | * to go to the next leaf and reset everything |
218 | */ | 216 | */ |
219 | if (slot >= nritems-1) { | 217 | ret = btrfs_next_leaf(root, path); |
220 | ret = btrfs_next_leaf(root, path); | 218 | if (ret < 0) |
221 | if (ret) | 219 | goto err; |
222 | break; | 220 | else if (ret > 0) |
223 | leaf = path->nodes[0]; | 221 | break; |
224 | nritems = btrfs_header_nritems(leaf); | 222 | continue; |
225 | slot = path->slots[0]; | ||
226 | } else { | ||
227 | /* | ||
228 | * just walking through the slots on this leaf | ||
229 | */ | ||
230 | slot++; | ||
231 | path->slots[0]++; | ||
232 | } | ||
233 | } | 223 | } |
234 | advance = 1; | ||
235 | 224 | ||
236 | btrfs_item_key_to_cpu(leaf, &found_key, slot); | 225 | btrfs_item_key_to_cpu(leaf, &found_key, slot); |
237 | 226 | ||
@@ -250,7 +239,7 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
250 | 239 | ||
251 | /* we are just looking for how big our buffer needs to be */ | 240 | /* we are just looking for how big our buffer needs to be */ |
252 | if (!size) | 241 | if (!size) |
253 | continue; | 242 | goto next; |
254 | 243 | ||
255 | if (!buffer || (name_len + 1) > size_left) { | 244 | if (!buffer || (name_len + 1) > size_left) { |
256 | ret = -ERANGE; | 245 | ret = -ERANGE; |
@@ -263,6 +252,8 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
263 | 252 | ||
264 | size_left -= name_len + 1; | 253 | size_left -= name_len + 1; |
265 | buffer += name_len + 1; | 254 | buffer += name_len + 1; |
255 | next: | ||
256 | path->slots[0]++; | ||
266 | } | 257 | } |
267 | ret = total_size; | 258 | ret = total_size; |
268 | 259 | ||
diff --git a/fs/cifs/README b/fs/cifs/README index fe1683590828..74ab165fc646 100644 --- a/fs/cifs/README +++ b/fs/cifs/README | |||
@@ -685,22 +685,6 @@ LinuxExtensionsEnabled If set to one then the client will attempt to | |||
685 | support and want to map the uid and gid fields | 685 | support and want to map the uid and gid fields |
686 | to values supplied at mount (rather than the | 686 | to values supplied at mount (rather than the |
687 | actual values, then set this to zero. (default 1) | 687 | actual values, then set this to zero. (default 1) |
688 | Experimental When set to 1 used to enable certain experimental | ||
689 | features (currently enables multipage writes | ||
690 | when signing is enabled, the multipage write | ||
691 | performance enhancement was disabled when | ||
692 | signing turned on in case buffer was modified | ||
693 | just before it was sent, also this flag will | ||
694 | be used to use the new experimental directory change | ||
695 | notification code). When set to 2 enables | ||
696 | an additional experimental feature, "raw ntlmssp" | ||
697 | session establishment support (which allows | ||
698 | specifying "sec=ntlmssp" on mount). The Linux cifs | ||
699 | module will use ntlmv2 authentication encapsulated | ||
700 | in "raw ntlmssp" (not using SPNEGO) when | ||
701 | "sec=ntlmssp" is specified on mount. | ||
702 | This support also requires building cifs with | ||
703 | the CONFIG_CIFS_EXPERIMENTAL configuration flag. | ||
704 | 688 | ||
705 | These experimental features and tracing can be enabled by changing flags in | 689 | These experimental features and tracing can be enabled by changing flags in |
706 | /proc/fs/cifs (after the cifs module has been installed or built into the | 690 | /proc/fs/cifs (after the cifs module has been installed or built into the |
diff --git a/fs/cifs/cache.c b/fs/cifs/cache.c index e654dfd092c3..53d57a3fe427 100644 --- a/fs/cifs/cache.c +++ b/fs/cifs/cache.c | |||
@@ -50,7 +50,7 @@ void cifs_fscache_unregister(void) | |||
50 | */ | 50 | */ |
51 | struct cifs_server_key { | 51 | struct cifs_server_key { |
52 | uint16_t family; /* address family */ | 52 | uint16_t family; /* address family */ |
53 | uint16_t port; /* IP port */ | 53 | __be16 port; /* IP port */ |
54 | union { | 54 | union { |
55 | struct in_addr ipv4_addr; | 55 | struct in_addr ipv4_addr; |
56 | struct in6_addr ipv6_addr; | 56 | struct in6_addr ipv6_addr; |
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 65829d32128c..30d01bc90855 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c | |||
@@ -423,7 +423,6 @@ static const struct file_operations cifs_lookup_cache_proc_fops; | |||
423 | static const struct file_operations traceSMB_proc_fops; | 423 | static const struct file_operations traceSMB_proc_fops; |
424 | static const struct file_operations cifs_multiuser_mount_proc_fops; | 424 | static const struct file_operations cifs_multiuser_mount_proc_fops; |
425 | static const struct file_operations cifs_security_flags_proc_fops; | 425 | static const struct file_operations cifs_security_flags_proc_fops; |
426 | static const struct file_operations cifs_experimental_proc_fops; | ||
427 | static const struct file_operations cifs_linux_ext_proc_fops; | 426 | static const struct file_operations cifs_linux_ext_proc_fops; |
428 | 427 | ||
429 | void | 428 | void |
@@ -441,8 +440,6 @@ cifs_proc_init(void) | |||
441 | proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops); | 440 | proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops); |
442 | proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops); | 441 | proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops); |
443 | proc_create("OplockEnabled", 0, proc_fs_cifs, &cifs_oplock_proc_fops); | 442 | proc_create("OplockEnabled", 0, proc_fs_cifs, &cifs_oplock_proc_fops); |
444 | proc_create("Experimental", 0, proc_fs_cifs, | ||
445 | &cifs_experimental_proc_fops); | ||
446 | proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs, | 443 | proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs, |
447 | &cifs_linux_ext_proc_fops); | 444 | &cifs_linux_ext_proc_fops); |
448 | proc_create("MultiuserMount", 0, proc_fs_cifs, | 445 | proc_create("MultiuserMount", 0, proc_fs_cifs, |
@@ -469,7 +466,6 @@ cifs_proc_clean(void) | |||
469 | remove_proc_entry("OplockEnabled", proc_fs_cifs); | 466 | remove_proc_entry("OplockEnabled", proc_fs_cifs); |
470 | remove_proc_entry("SecurityFlags", proc_fs_cifs); | 467 | remove_proc_entry("SecurityFlags", proc_fs_cifs); |
471 | remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs); | 468 | remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs); |
472 | remove_proc_entry("Experimental", proc_fs_cifs); | ||
473 | remove_proc_entry("LookupCacheEnabled", proc_fs_cifs); | 469 | remove_proc_entry("LookupCacheEnabled", proc_fs_cifs); |
474 | remove_proc_entry("fs/cifs", NULL); | 470 | remove_proc_entry("fs/cifs", NULL); |
475 | } | 471 | } |
@@ -550,45 +546,6 @@ static const struct file_operations cifs_oplock_proc_fops = { | |||
550 | .write = cifs_oplock_proc_write, | 546 | .write = cifs_oplock_proc_write, |
551 | }; | 547 | }; |
552 | 548 | ||
553 | static int cifs_experimental_proc_show(struct seq_file *m, void *v) | ||
554 | { | ||
555 | seq_printf(m, "%d\n", experimEnabled); | ||
556 | return 0; | ||
557 | } | ||
558 | |||
559 | static int cifs_experimental_proc_open(struct inode *inode, struct file *file) | ||
560 | { | ||
561 | return single_open(file, cifs_experimental_proc_show, NULL); | ||
562 | } | ||
563 | |||
564 | static ssize_t cifs_experimental_proc_write(struct file *file, | ||
565 | const char __user *buffer, size_t count, loff_t *ppos) | ||
566 | { | ||
567 | char c; | ||
568 | int rc; | ||
569 | |||
570 | rc = get_user(c, buffer); | ||
571 | if (rc) | ||
572 | return rc; | ||
573 | if (c == '0' || c == 'n' || c == 'N') | ||
574 | experimEnabled = 0; | ||
575 | else if (c == '1' || c == 'y' || c == 'Y') | ||
576 | experimEnabled = 1; | ||
577 | else if (c == '2') | ||
578 | experimEnabled = 2; | ||
579 | |||
580 | return count; | ||
581 | } | ||
582 | |||
583 | static const struct file_operations cifs_experimental_proc_fops = { | ||
584 | .owner = THIS_MODULE, | ||
585 | .open = cifs_experimental_proc_open, | ||
586 | .read = seq_read, | ||
587 | .llseek = seq_lseek, | ||
588 | .release = single_release, | ||
589 | .write = cifs_experimental_proc_write, | ||
590 | }; | ||
591 | |||
592 | static int cifs_linux_ext_proc_show(struct seq_file *m, void *v) | 549 | static int cifs_linux_ext_proc_show(struct seq_file *m, void *v) |
593 | { | 550 | { |
594 | seq_printf(m, "%d\n", linuxExtEnabled); | 551 | seq_printf(m, "%d\n", linuxExtEnabled); |
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c index 4dfba8283165..33d221394aca 100644 --- a/fs/cifs/cifs_spnego.c +++ b/fs/cifs/cifs_spnego.c | |||
@@ -113,7 +113,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo) | |||
113 | MAX_MECH_STR_LEN + | 113 | MAX_MECH_STR_LEN + |
114 | UID_KEY_LEN + (sizeof(uid_t) * 2) + | 114 | UID_KEY_LEN + (sizeof(uid_t) * 2) + |
115 | CREDUID_KEY_LEN + (sizeof(uid_t) * 2) + | 115 | CREDUID_KEY_LEN + (sizeof(uid_t) * 2) + |
116 | USER_KEY_LEN + strlen(sesInfo->userName) + | 116 | USER_KEY_LEN + strlen(sesInfo->user_name) + |
117 | PID_KEY_LEN + (sizeof(pid_t) * 2) + 1; | 117 | PID_KEY_LEN + (sizeof(pid_t) * 2) + 1; |
118 | 118 | ||
119 | spnego_key = ERR_PTR(-ENOMEM); | 119 | spnego_key = ERR_PTR(-ENOMEM); |
@@ -153,7 +153,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo) | |||
153 | sprintf(dp, ";creduid=0x%x", sesInfo->cred_uid); | 153 | sprintf(dp, ";creduid=0x%x", sesInfo->cred_uid); |
154 | 154 | ||
155 | dp = description + strlen(description); | 155 | dp = description + strlen(description); |
156 | sprintf(dp, ";user=%s", sesInfo->userName); | 156 | sprintf(dp, ";user=%s", sesInfo->user_name); |
157 | 157 | ||
158 | dp = description + strlen(description); | 158 | dp = description + strlen(description); |
159 | sprintf(dp, ";pid=0x%x", current->pid); | 159 | sprintf(dp, ";pid=0x%x", current->pid); |
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index fc0fd4fde306..23d43cde4306 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c | |||
@@ -90,7 +90,7 @@ cifs_mapchar(char *target, const __u16 src_char, const struct nls_table *cp, | |||
90 | case UNI_COLON: | 90 | case UNI_COLON: |
91 | *target = ':'; | 91 | *target = ':'; |
92 | break; | 92 | break; |
93 | case UNI_ASTERIK: | 93 | case UNI_ASTERISK: |
94 | *target = '*'; | 94 | *target = '*'; |
95 | break; | 95 | break; |
96 | case UNI_QUESTION: | 96 | case UNI_QUESTION: |
@@ -264,40 +264,40 @@ cifs_strndup_from_ucs(const char *src, const int maxlen, const bool is_unicode, | |||
264 | * names are little endian 16 bit Unicode on the wire | 264 | * names are little endian 16 bit Unicode on the wire |
265 | */ | 265 | */ |
266 | int | 266 | int |
267 | cifsConvertToUCS(__le16 *target, const char *source, int maxlen, | 267 | cifsConvertToUCS(__le16 *target, const char *source, int srclen, |
268 | const struct nls_table *cp, int mapChars) | 268 | const struct nls_table *cp, int mapChars) |
269 | { | 269 | { |
270 | int i, j, charlen; | 270 | int i, j, charlen; |
271 | int len_remaining = maxlen; | ||
272 | char src_char; | 271 | char src_char; |
273 | __u16 temp; | 272 | __le16 dst_char; |
273 | wchar_t tmp; | ||
274 | 274 | ||
275 | if (!mapChars) | 275 | if (!mapChars) |
276 | return cifs_strtoUCS(target, source, PATH_MAX, cp); | 276 | return cifs_strtoUCS(target, source, PATH_MAX, cp); |
277 | 277 | ||
278 | for (i = 0, j = 0; i < maxlen; j++) { | 278 | for (i = 0, j = 0; i < srclen; j++) { |
279 | src_char = source[i]; | 279 | src_char = source[i]; |
280 | switch (src_char) { | 280 | switch (src_char) { |
281 | case 0: | 281 | case 0: |
282 | put_unaligned_le16(0, &target[j]); | 282 | put_unaligned(0, &target[j]); |
283 | goto ctoUCS_out; | 283 | goto ctoUCS_out; |
284 | case ':': | 284 | case ':': |
285 | temp = UNI_COLON; | 285 | dst_char = cpu_to_le16(UNI_COLON); |
286 | break; | 286 | break; |
287 | case '*': | 287 | case '*': |
288 | temp = UNI_ASTERIK; | 288 | dst_char = cpu_to_le16(UNI_ASTERISK); |
289 | break; | 289 | break; |
290 | case '?': | 290 | case '?': |
291 | temp = UNI_QUESTION; | 291 | dst_char = cpu_to_le16(UNI_QUESTION); |
292 | break; | 292 | break; |
293 | case '<': | 293 | case '<': |
294 | temp = UNI_LESSTHAN; | 294 | dst_char = cpu_to_le16(UNI_LESSTHAN); |
295 | break; | 295 | break; |
296 | case '>': | 296 | case '>': |
297 | temp = UNI_GRTRTHAN; | 297 | dst_char = cpu_to_le16(UNI_GRTRTHAN); |
298 | break; | 298 | break; |
299 | case '|': | 299 | case '|': |
300 | temp = UNI_PIPE; | 300 | dst_char = cpu_to_le16(UNI_PIPE); |
301 | break; | 301 | break; |
302 | /* | 302 | /* |
303 | * FIXME: We can not handle remapping backslash (UNI_SLASH) | 303 | * FIXME: We can not handle remapping backslash (UNI_SLASH) |
@@ -305,17 +305,17 @@ cifsConvertToUCS(__le16 *target, const char *source, int maxlen, | |||
305 | * as they use backslash as separator. | 305 | * as they use backslash as separator. |
306 | */ | 306 | */ |
307 | default: | 307 | default: |
308 | charlen = cp->char2uni(source+i, len_remaining, | 308 | charlen = cp->char2uni(source + i, srclen - i, &tmp); |
309 | &temp); | 309 | dst_char = cpu_to_le16(tmp); |
310 | |||
310 | /* | 311 | /* |
311 | * if no match, use question mark, which at least in | 312 | * if no match, use question mark, which at least in |
312 | * some cases serves as wild card | 313 | * some cases serves as wild card |
313 | */ | 314 | */ |
314 | if (charlen < 1) { | 315 | if (charlen < 1) { |
315 | temp = 0x003f; | 316 | dst_char = cpu_to_le16(0x003f); |
316 | charlen = 1; | 317 | charlen = 1; |
317 | } | 318 | } |
318 | len_remaining -= charlen; | ||
319 | /* | 319 | /* |
320 | * character may take more than one byte in the source | 320 | * character may take more than one byte in the source |
321 | * string, but will take exactly two bytes in the | 321 | * string, but will take exactly two bytes in the |
@@ -324,9 +324,8 @@ cifsConvertToUCS(__le16 *target, const char *source, int maxlen, | |||
324 | i += charlen; | 324 | i += charlen; |
325 | continue; | 325 | continue; |
326 | } | 326 | } |
327 | put_unaligned_le16(temp, &target[j]); | 327 | put_unaligned(dst_char, &target[j]); |
328 | i++; /* move to next char in source string */ | 328 | i++; /* move to next char in source string */ |
329 | len_remaining--; | ||
330 | } | 329 | } |
331 | 330 | ||
332 | ctoUCS_out: | 331 | ctoUCS_out: |
diff --git a/fs/cifs/cifs_unicode.h b/fs/cifs/cifs_unicode.h index 7fe6b52df507..644dd882a560 100644 --- a/fs/cifs/cifs_unicode.h +++ b/fs/cifs/cifs_unicode.h | |||
@@ -44,7 +44,7 @@ | |||
44 | * reserved symbols (along with \ and /), otherwise illegal to store | 44 | * reserved symbols (along with \ and /), otherwise illegal to store |
45 | * in filenames in NTFS | 45 | * in filenames in NTFS |
46 | */ | 46 | */ |
47 | #define UNI_ASTERIK (__u16) ('*' + 0xF000) | 47 | #define UNI_ASTERISK (__u16) ('*' + 0xF000) |
48 | #define UNI_QUESTION (__u16) ('?' + 0xF000) | 48 | #define UNI_QUESTION (__u16) ('?' + 0xF000) |
49 | #define UNI_COLON (__u16) (':' + 0xF000) | 49 | #define UNI_COLON (__u16) (':' + 0xF000) |
50 | #define UNI_GRTRTHAN (__u16) ('>' + 0xF000) | 50 | #define UNI_GRTRTHAN (__u16) ('>' + 0xF000) |
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index a51585f9852b..d1a016be73ba 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -30,12 +30,13 @@ | |||
30 | #include <linux/ctype.h> | 30 | #include <linux/ctype.h> |
31 | #include <linux/random.h> | 31 | #include <linux/random.h> |
32 | 32 | ||
33 | /* Calculate and return the CIFS signature based on the mac key and SMB PDU */ | 33 | /* |
34 | /* the 16 byte signature must be allocated by the caller */ | 34 | * Calculate and return the CIFS signature based on the mac key and SMB PDU. |
35 | /* Note we only use the 1st eight bytes */ | 35 | * The 16 byte signature must be allocated by the caller. Note we only use the |
36 | /* Note that the smb header signature field on input contains the | 36 | * 1st eight bytes and that the smb header signature field on input contains |
37 | sequence number before this function is called */ | 37 | * the sequence number before this function is called. Also, this function |
38 | 38 | * should be called with the server->srv_mutex held. | |
39 | */ | ||
39 | static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu, | 40 | static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu, |
40 | struct TCP_Server_Info *server, char *signature) | 41 | struct TCP_Server_Info *server, char *signature) |
41 | { | 42 | { |
@@ -209,8 +210,10 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu, | |||
209 | cpu_to_le32(expected_sequence_number); | 210 | cpu_to_le32(expected_sequence_number); |
210 | cifs_pdu->Signature.Sequence.Reserved = 0; | 211 | cifs_pdu->Signature.Sequence.Reserved = 0; |
211 | 212 | ||
213 | mutex_lock(&server->srv_mutex); | ||
212 | rc = cifs_calculate_signature(cifs_pdu, server, | 214 | rc = cifs_calculate_signature(cifs_pdu, server, |
213 | what_we_think_sig_should_be); | 215 | what_we_think_sig_should_be); |
216 | mutex_unlock(&server->srv_mutex); | ||
214 | 217 | ||
215 | if (rc) | 218 | if (rc) |
216 | return rc; | 219 | return rc; |
@@ -469,15 +472,15 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses, char *ntlmv2_hash, | |||
469 | return rc; | 472 | return rc; |
470 | } | 473 | } |
471 | 474 | ||
472 | /* convert ses->userName to unicode and uppercase */ | 475 | /* convert ses->user_name to unicode and uppercase */ |
473 | len = strlen(ses->userName); | 476 | len = strlen(ses->user_name); |
474 | user = kmalloc(2 + (len * 2), GFP_KERNEL); | 477 | user = kmalloc(2 + (len * 2), GFP_KERNEL); |
475 | if (user == NULL) { | 478 | if (user == NULL) { |
476 | cERROR(1, "calc_ntlmv2_hash: user mem alloc failure\n"); | 479 | cERROR(1, "calc_ntlmv2_hash: user mem alloc failure\n"); |
477 | rc = -ENOMEM; | 480 | rc = -ENOMEM; |
478 | goto calc_exit_2; | 481 | goto calc_exit_2; |
479 | } | 482 | } |
480 | len = cifs_strtoUCS((__le16 *)user, ses->userName, len, nls_cp); | 483 | len = cifs_strtoUCS((__le16 *)user, ses->user_name, len, nls_cp); |
481 | UniStrupr(user); | 484 | UniStrupr(user); |
482 | 485 | ||
483 | crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, | 486 | crypto_shash_update(&ses->server->secmech.sdeschmacmd5->shash, |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index f2970136d17d..5c412b33cd7c 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -53,7 +53,6 @@ int cifsFYI = 0; | |||
53 | int cifsERROR = 1; | 53 | int cifsERROR = 1; |
54 | int traceSMB = 0; | 54 | int traceSMB = 0; |
55 | unsigned int oplockEnabled = 1; | 55 | unsigned int oplockEnabled = 1; |
56 | unsigned int experimEnabled = 0; | ||
57 | unsigned int linuxExtEnabled = 1; | 56 | unsigned int linuxExtEnabled = 1; |
58 | unsigned int lookupCacheEnabled = 1; | 57 | unsigned int lookupCacheEnabled = 1; |
59 | unsigned int multiuser_mount = 0; | 58 | unsigned int multiuser_mount = 0; |
@@ -127,6 +126,7 @@ cifs_read_super(struct super_block *sb, void *data, | |||
127 | kfree(cifs_sb); | 126 | kfree(cifs_sb); |
128 | return rc; | 127 | return rc; |
129 | } | 128 | } |
129 | cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages; | ||
130 | 130 | ||
131 | #ifdef CONFIG_CIFS_DFS_UPCALL | 131 | #ifdef CONFIG_CIFS_DFS_UPCALL |
132 | /* copy mount params to sb for use in submounts */ | 132 | /* copy mount params to sb for use in submounts */ |
@@ -409,8 +409,8 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) | |||
409 | 409 | ||
410 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER) | 410 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER) |
411 | seq_printf(s, ",multiuser"); | 411 | seq_printf(s, ",multiuser"); |
412 | else if (tcon->ses->userName) | 412 | else if (tcon->ses->user_name) |
413 | seq_printf(s, ",username=%s", tcon->ses->userName); | 413 | seq_printf(s, ",username=%s", tcon->ses->user_name); |
414 | 414 | ||
415 | if (tcon->ses->domainName) | 415 | if (tcon->ses->domainName) |
416 | seq_printf(s, ",domain=%s", tcon->ses->domainName); | 416 | seq_printf(s, ",domain=%s", tcon->ses->domainName); |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 17afb0fbcaed..a5d1106fcbde 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -37,10 +37,9 @@ | |||
37 | 37 | ||
38 | #define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1) | 38 | #define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1) |
39 | #define MAX_SERVER_SIZE 15 | 39 | #define MAX_SERVER_SIZE 15 |
40 | #define MAX_SHARE_SIZE 64 /* used to be 20, this should still be enough */ | 40 | #define MAX_SHARE_SIZE 80 |
41 | #define MAX_USERNAME_SIZE 32 /* 32 is to allow for 15 char names + null | 41 | #define MAX_USERNAME_SIZE 256 /* reasonable maximum for current servers */ |
42 | termination then *2 for unicode versions */ | 42 | #define MAX_PASSWORD_SIZE 512 /* max for windows seems to be 256 wide chars */ |
43 | #define MAX_PASSWORD_SIZE 512 /* max for windows seems to be 256 wide chars */ | ||
44 | 43 | ||
45 | #define CIFS_MIN_RCV_POOL 4 | 44 | #define CIFS_MIN_RCV_POOL 4 |
46 | 45 | ||
@@ -92,7 +91,8 @@ enum statusEnum { | |||
92 | CifsNew = 0, | 91 | CifsNew = 0, |
93 | CifsGood, | 92 | CifsGood, |
94 | CifsExiting, | 93 | CifsExiting, |
95 | CifsNeedReconnect | 94 | CifsNeedReconnect, |
95 | CifsNeedNegotiate | ||
96 | }; | 96 | }; |
97 | 97 | ||
98 | enum securityEnum { | 98 | enum securityEnum { |
@@ -274,7 +274,7 @@ struct cifsSesInfo { | |||
274 | int capabilities; | 274 | int capabilities; |
275 | char serverName[SERVER_NAME_LEN_WITH_NULL * 2]; /* BB make bigger for | 275 | char serverName[SERVER_NAME_LEN_WITH_NULL * 2]; /* BB make bigger for |
276 | TCP names - will ipv6 and sctp addresses fit? */ | 276 | TCP names - will ipv6 and sctp addresses fit? */ |
277 | char userName[MAX_USERNAME_SIZE + 1]; | 277 | char *user_name; |
278 | char *domainName; | 278 | char *domainName; |
279 | char *password; | 279 | char *password; |
280 | struct session_key auth_key; | 280 | struct session_key auth_key; |
@@ -817,7 +817,6 @@ GLOBAL_EXTERN unsigned int multiuser_mount; /* if enabled allows new sessions | |||
817 | have the uid/password or Kerberos credential | 817 | have the uid/password or Kerberos credential |
818 | or equivalent for current user */ | 818 | or equivalent for current user */ |
819 | GLOBAL_EXTERN unsigned int oplockEnabled; | 819 | GLOBAL_EXTERN unsigned int oplockEnabled; |
820 | GLOBAL_EXTERN unsigned int experimEnabled; | ||
821 | GLOBAL_EXTERN unsigned int lookupCacheEnabled; | 820 | GLOBAL_EXTERN unsigned int lookupCacheEnabled; |
822 | GLOBAL_EXTERN unsigned int global_secflags; /* if on, session setup sent | 821 | GLOBAL_EXTERN unsigned int global_secflags; /* if on, session setup sent |
823 | with more secure ntlmssp2 challenge/resp */ | 822 | with more secure ntlmssp2 challenge/resp */ |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 2644a5d6cc67..df959bae6728 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -142,9 +142,9 @@ cifs_reconnect_tcon(struct cifsTconInfo *tcon, int smb_command) | |||
142 | */ | 142 | */ |
143 | while (server->tcpStatus == CifsNeedReconnect) { | 143 | while (server->tcpStatus == CifsNeedReconnect) { |
144 | wait_event_interruptible_timeout(server->response_q, | 144 | wait_event_interruptible_timeout(server->response_q, |
145 | (server->tcpStatus == CifsGood), 10 * HZ); | 145 | (server->tcpStatus != CifsNeedReconnect), 10 * HZ); |
146 | 146 | ||
147 | /* is TCP session is reestablished now ?*/ | 147 | /* are we still trying to reconnect? */ |
148 | if (server->tcpStatus != CifsNeedReconnect) | 148 | if (server->tcpStatus != CifsNeedReconnect) |
149 | break; | 149 | break; |
150 | 150 | ||
@@ -729,7 +729,7 @@ CIFSSMBEcho(struct TCP_Server_Info *server) | |||
729 | return rc; | 729 | return rc; |
730 | 730 | ||
731 | /* set up echo request */ | 731 | /* set up echo request */ |
732 | smb->hdr.Tid = cpu_to_le16(0xffff); | 732 | smb->hdr.Tid = 0xffff; |
733 | smb->hdr.WordCount = 1; | 733 | smb->hdr.WordCount = 1; |
734 | put_unaligned_le16(1, &smb->EchoCount); | 734 | put_unaligned_le16(1, &smb->EchoCount); |
735 | put_bcc_le(1, &smb->hdr); | 735 | put_bcc_le(1, &smb->hdr); |
@@ -1884,10 +1884,10 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | |||
1884 | __constant_cpu_to_le16(CIFS_WRLCK)) | 1884 | __constant_cpu_to_le16(CIFS_WRLCK)) |
1885 | pLockData->fl_type = F_WRLCK; | 1885 | pLockData->fl_type = F_WRLCK; |
1886 | 1886 | ||
1887 | pLockData->fl_start = parm_data->start; | 1887 | pLockData->fl_start = le64_to_cpu(parm_data->start); |
1888 | pLockData->fl_end = parm_data->start + | 1888 | pLockData->fl_end = pLockData->fl_start + |
1889 | parm_data->length - 1; | 1889 | le64_to_cpu(parm_data->length) - 1; |
1890 | pLockData->fl_pid = parm_data->pid; | 1890 | pLockData->fl_pid = le32_to_cpu(parm_data->pid); |
1891 | } | 1891 | } |
1892 | } | 1892 | } |
1893 | 1893 | ||
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 6e2b2addfc78..4bc862a80efa 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -199,8 +199,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
199 | } | 199 | } |
200 | spin_unlock(&GlobalMid_Lock); | 200 | spin_unlock(&GlobalMid_Lock); |
201 | 201 | ||
202 | while ((server->tcpStatus != CifsExiting) && | 202 | while (server->tcpStatus == CifsNeedReconnect) { |
203 | (server->tcpStatus != CifsGood)) { | ||
204 | try_to_freeze(); | 203 | try_to_freeze(); |
205 | 204 | ||
206 | /* we should try only the port we connected to before */ | 205 | /* we should try only the port we connected to before */ |
@@ -212,7 +211,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
212 | atomic_inc(&tcpSesReconnectCount); | 211 | atomic_inc(&tcpSesReconnectCount); |
213 | spin_lock(&GlobalMid_Lock); | 212 | spin_lock(&GlobalMid_Lock); |
214 | if (server->tcpStatus != CifsExiting) | 213 | if (server->tcpStatus != CifsExiting) |
215 | server->tcpStatus = CifsGood; | 214 | server->tcpStatus = CifsNeedNegotiate; |
216 | spin_unlock(&GlobalMid_Lock); | 215 | spin_unlock(&GlobalMid_Lock); |
217 | } | 216 | } |
218 | } | 217 | } |
@@ -248,24 +247,24 @@ static int check2ndT2(struct smb_hdr *pSMB, unsigned int maxBufSize) | |||
248 | total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount); | 247 | total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount); |
249 | data_in_this_rsp = get_unaligned_le16(&pSMBt->t2_rsp.DataCount); | 248 | data_in_this_rsp = get_unaligned_le16(&pSMBt->t2_rsp.DataCount); |
250 | 249 | ||
251 | remaining = total_data_size - data_in_this_rsp; | 250 | if (total_data_size == data_in_this_rsp) |
252 | |||
253 | if (remaining == 0) | ||
254 | return 0; | 251 | return 0; |
255 | else if (remaining < 0) { | 252 | else if (total_data_size < data_in_this_rsp) { |
256 | cFYI(1, "total data %d smaller than data in frame %d", | 253 | cFYI(1, "total data %d smaller than data in frame %d", |
257 | total_data_size, data_in_this_rsp); | 254 | total_data_size, data_in_this_rsp); |
258 | return -EINVAL; | 255 | return -EINVAL; |
259 | } else { | ||
260 | cFYI(1, "missing %d bytes from transact2, check next response", | ||
261 | remaining); | ||
262 | if (total_data_size > maxBufSize) { | ||
263 | cERROR(1, "TotalDataSize %d is over maximum buffer %d", | ||
264 | total_data_size, maxBufSize); | ||
265 | return -EINVAL; | ||
266 | } | ||
267 | return remaining; | ||
268 | } | 256 | } |
257 | |||
258 | remaining = total_data_size - data_in_this_rsp; | ||
259 | |||
260 | cFYI(1, "missing %d bytes from transact2, check next response", | ||
261 | remaining); | ||
262 | if (total_data_size > maxBufSize) { | ||
263 | cERROR(1, "TotalDataSize %d is over maximum buffer %d", | ||
264 | total_data_size, maxBufSize); | ||
265 | return -EINVAL; | ||
266 | } | ||
267 | return remaining; | ||
269 | } | 268 | } |
270 | 269 | ||
271 | static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB) | 270 | static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB) |
@@ -421,7 +420,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
421 | pdu_length = 4; /* enough to get RFC1001 header */ | 420 | pdu_length = 4; /* enough to get RFC1001 header */ |
422 | 421 | ||
423 | incomplete_rcv: | 422 | incomplete_rcv: |
424 | if (echo_retries > 0 && | 423 | if (echo_retries > 0 && server->tcpStatus == CifsGood && |
425 | time_after(jiffies, server->lstrp + | 424 | time_after(jiffies, server->lstrp + |
426 | (echo_retries * SMB_ECHO_INTERVAL))) { | 425 | (echo_retries * SMB_ECHO_INTERVAL))) { |
427 | cERROR(1, "Server %s has not responded in %d seconds. " | 426 | cERROR(1, "Server %s has not responded in %d seconds. " |
@@ -808,8 +807,7 @@ static int | |||
808 | cifs_parse_mount_options(char *options, const char *devname, | 807 | cifs_parse_mount_options(char *options, const char *devname, |
809 | struct smb_vol *vol) | 808 | struct smb_vol *vol) |
810 | { | 809 | { |
811 | char *value; | 810 | char *value, *data, *end; |
812 | char *data; | ||
813 | unsigned int temp_len, i, j; | 811 | unsigned int temp_len, i, j; |
814 | char separator[2]; | 812 | char separator[2]; |
815 | short int override_uid = -1; | 813 | short int override_uid = -1; |
@@ -852,6 +850,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
852 | if (!options) | 850 | if (!options) |
853 | return 1; | 851 | return 1; |
854 | 852 | ||
853 | end = options + strlen(options); | ||
855 | if (strncmp(options, "sep=", 4) == 0) { | 854 | if (strncmp(options, "sep=", 4) == 0) { |
856 | if (options[4] != 0) { | 855 | if (options[4] != 0) { |
857 | separator[0] = options[4]; | 856 | separator[0] = options[4]; |
@@ -881,7 +880,8 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
881 | /* null user, ie anonymous, authentication */ | 880 | /* null user, ie anonymous, authentication */ |
882 | vol->nullauth = 1; | 881 | vol->nullauth = 1; |
883 | } | 882 | } |
884 | if (strnlen(value, 200) < 200) { | 883 | if (strnlen(value, MAX_USERNAME_SIZE) < |
884 | MAX_USERNAME_SIZE) { | ||
885 | vol->username = value; | 885 | vol->username = value; |
886 | } else { | 886 | } else { |
887 | printk(KERN_WARNING "CIFS: username too long\n"); | 887 | printk(KERN_WARNING "CIFS: username too long\n"); |
@@ -916,6 +916,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
916 | the only illegal character in a password is null */ | 916 | the only illegal character in a password is null */ |
917 | 917 | ||
918 | if ((value[temp_len] == 0) && | 918 | if ((value[temp_len] == 0) && |
919 | (value + temp_len < end) && | ||
919 | (value[temp_len+1] == separator[0])) { | 920 | (value[temp_len+1] == separator[0])) { |
920 | /* reinsert comma */ | 921 | /* reinsert comma */ |
921 | value[temp_len] = separator[0]; | 922 | value[temp_len] = separator[0]; |
@@ -1472,7 +1473,7 @@ srcip_matches(struct sockaddr *srcaddr, struct sockaddr *rhs) | |||
1472 | static bool | 1473 | static bool |
1473 | match_port(struct TCP_Server_Info *server, struct sockaddr *addr) | 1474 | match_port(struct TCP_Server_Info *server, struct sockaddr *addr) |
1474 | { | 1475 | { |
1475 | unsigned short int port, *sport; | 1476 | __be16 port, *sport; |
1476 | 1477 | ||
1477 | switch (addr->sa_family) { | 1478 | switch (addr->sa_family) { |
1478 | case AF_INET: | 1479 | case AF_INET: |
@@ -1765,6 +1766,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) | |||
1765 | module_put(THIS_MODULE); | 1766 | module_put(THIS_MODULE); |
1766 | goto out_err_crypto_release; | 1767 | goto out_err_crypto_release; |
1767 | } | 1768 | } |
1769 | tcp_ses->tcpStatus = CifsNeedNegotiate; | ||
1768 | 1770 | ||
1769 | /* thread spawned, put it on the list */ | 1771 | /* thread spawned, put it on the list */ |
1770 | spin_lock(&cifs_tcp_ses_lock); | 1772 | spin_lock(&cifs_tcp_ses_lock); |
@@ -1808,7 +1810,9 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol) | |||
1808 | break; | 1810 | break; |
1809 | default: | 1811 | default: |
1810 | /* anything else takes username/password */ | 1812 | /* anything else takes username/password */ |
1811 | if (strncmp(ses->userName, vol->username, | 1813 | if (ses->user_name == NULL) |
1814 | continue; | ||
1815 | if (strncmp(ses->user_name, vol->username, | ||
1812 | MAX_USERNAME_SIZE)) | 1816 | MAX_USERNAME_SIZE)) |
1813 | continue; | 1817 | continue; |
1814 | if (strlen(vol->username) != 0 && | 1818 | if (strlen(vol->username) != 0 && |
@@ -1851,6 +1855,8 @@ cifs_put_smb_ses(struct cifsSesInfo *ses) | |||
1851 | cifs_put_tcp_session(server); | 1855 | cifs_put_tcp_session(server); |
1852 | } | 1856 | } |
1853 | 1857 | ||
1858 | static bool warned_on_ntlm; /* globals init to false automatically */ | ||
1859 | |||
1854 | static struct cifsSesInfo * | 1860 | static struct cifsSesInfo * |
1855 | cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info) | 1861 | cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info) |
1856 | { | 1862 | { |
@@ -1906,9 +1912,11 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info) | |||
1906 | else | 1912 | else |
1907 | sprintf(ses->serverName, "%pI4", &addr->sin_addr); | 1913 | sprintf(ses->serverName, "%pI4", &addr->sin_addr); |
1908 | 1914 | ||
1909 | if (volume_info->username) | 1915 | if (volume_info->username) { |
1910 | strncpy(ses->userName, volume_info->username, | 1916 | ses->user_name = kstrdup(volume_info->username, GFP_KERNEL); |
1911 | MAX_USERNAME_SIZE); | 1917 | if (!ses->user_name) |
1918 | goto get_ses_fail; | ||
1919 | } | ||
1912 | 1920 | ||
1913 | /* volume_info->password freed at unmount */ | 1921 | /* volume_info->password freed at unmount */ |
1914 | if (volume_info->password) { | 1922 | if (volume_info->password) { |
@@ -1923,6 +1931,15 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info) | |||
1923 | } | 1931 | } |
1924 | ses->cred_uid = volume_info->cred_uid; | 1932 | ses->cred_uid = volume_info->cred_uid; |
1925 | ses->linux_uid = volume_info->linux_uid; | 1933 | ses->linux_uid = volume_info->linux_uid; |
1934 | |||
1935 | /* ntlmv2 is much stronger than ntlm security, and has been broadly | ||
1936 | supported for many years, time to update default security mechanism */ | ||
1937 | if ((volume_info->secFlg == 0) && warned_on_ntlm == false) { | ||
1938 | warned_on_ntlm = true; | ||
1939 | cERROR(1, "default security mechanism requested. The default " | ||
1940 | "security mechanism will be upgraded from ntlm to " | ||
1941 | "ntlmv2 in kernel release 2.6.41"); | ||
1942 | } | ||
1926 | ses->overrideSecFlg = volume_info->secFlg; | 1943 | ses->overrideSecFlg = volume_info->secFlg; |
1927 | 1944 | ||
1928 | mutex_lock(&ses->session_mutex); | 1945 | mutex_lock(&ses->session_mutex); |
@@ -2276,7 +2293,7 @@ static int | |||
2276 | generic_ip_connect(struct TCP_Server_Info *server) | 2293 | generic_ip_connect(struct TCP_Server_Info *server) |
2277 | { | 2294 | { |
2278 | int rc = 0; | 2295 | int rc = 0; |
2279 | unsigned short int sport; | 2296 | __be16 sport; |
2280 | int slen, sfamily; | 2297 | int slen, sfamily; |
2281 | struct socket *socket = server->ssocket; | 2298 | struct socket *socket = server->ssocket; |
2282 | struct sockaddr *saddr; | 2299 | struct sockaddr *saddr; |
@@ -2361,7 +2378,7 @@ generic_ip_connect(struct TCP_Server_Info *server) | |||
2361 | static int | 2378 | static int |
2362 | ip_connect(struct TCP_Server_Info *server) | 2379 | ip_connect(struct TCP_Server_Info *server) |
2363 | { | 2380 | { |
2364 | unsigned short int *sport; | 2381 | __be16 *sport; |
2365 | struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&server->dstaddr; | 2382 | struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&server->dstaddr; |
2366 | struct sockaddr_in *addr = (struct sockaddr_in *)&server->dstaddr; | 2383 | struct sockaddr_in *addr = (struct sockaddr_in *)&server->dstaddr; |
2367 | 2384 | ||
@@ -2826,7 +2843,7 @@ try_mount_again: | |||
2826 | 2843 | ||
2827 | remote_path_check: | 2844 | remote_path_check: |
2828 | /* check if a whole path (including prepath) is not remote */ | 2845 | /* check if a whole path (including prepath) is not remote */ |
2829 | if (!rc && cifs_sb->prepathlen && tcon) { | 2846 | if (!rc && tcon) { |
2830 | /* build_path_to_root works only when we have a valid tcon */ | 2847 | /* build_path_to_root works only when we have a valid tcon */ |
2831 | full_path = cifs_build_path_to_root(cifs_sb, tcon); | 2848 | full_path = cifs_build_path_to_root(cifs_sb, tcon); |
2832 | if (full_path == NULL) { | 2849 | if (full_path == NULL) { |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index c27d236738fc..faf59529e847 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -575,8 +575,10 @@ reopen_error_exit: | |||
575 | 575 | ||
576 | int cifs_close(struct inode *inode, struct file *file) | 576 | int cifs_close(struct inode *inode, struct file *file) |
577 | { | 577 | { |
578 | cifsFileInfo_put(file->private_data); | 578 | if (file->private_data != NULL) { |
579 | file->private_data = NULL; | 579 | cifsFileInfo_put(file->private_data); |
580 | file->private_data = NULL; | ||
581 | } | ||
580 | 582 | ||
581 | /* return code from the ->release op is always ignored */ | 583 | /* return code from the ->release op is always ignored */ |
582 | return 0; | 584 | return 0; |
@@ -970,6 +972,9 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file, | |||
970 | total_written += bytes_written) { | 972 | total_written += bytes_written) { |
971 | rc = -EAGAIN; | 973 | rc = -EAGAIN; |
972 | while (rc == -EAGAIN) { | 974 | while (rc == -EAGAIN) { |
975 | struct kvec iov[2]; | ||
976 | unsigned int len; | ||
977 | |||
973 | if (open_file->invalidHandle) { | 978 | if (open_file->invalidHandle) { |
974 | /* we could deadlock if we called | 979 | /* we could deadlock if we called |
975 | filemap_fdatawait from here so tell | 980 | filemap_fdatawait from here so tell |
@@ -979,31 +984,14 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file, | |||
979 | if (rc != 0) | 984 | if (rc != 0) |
980 | break; | 985 | break; |
981 | } | 986 | } |
982 | if (experimEnabled || (pTcon->ses->server && | 987 | |
983 | ((pTcon->ses->server->secMode & | 988 | len = min((size_t)cifs_sb->wsize, |
984 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) | 989 | write_size - total_written); |
985 | == 0))) { | 990 | /* iov[0] is reserved for smb header */ |
986 | struct kvec iov[2]; | 991 | iov[1].iov_base = (char *)write_data + total_written; |
987 | unsigned int len; | 992 | iov[1].iov_len = len; |
988 | 993 | rc = CIFSSMBWrite2(xid, pTcon, open_file->netfid, len, | |
989 | len = min((size_t)cifs_sb->wsize, | 994 | *poffset, &bytes_written, iov, 1, 0); |
990 | write_size - total_written); | ||
991 | /* iov[0] is reserved for smb header */ | ||
992 | iov[1].iov_base = (char *)write_data + | ||
993 | total_written; | ||
994 | iov[1].iov_len = len; | ||
995 | rc = CIFSSMBWrite2(xid, pTcon, | ||
996 | open_file->netfid, len, | ||
997 | *poffset, &bytes_written, | ||
998 | iov, 1, 0); | ||
999 | } else | ||
1000 | rc = CIFSSMBWrite(xid, pTcon, | ||
1001 | open_file->netfid, | ||
1002 | min_t(const int, cifs_sb->wsize, | ||
1003 | write_size - total_written), | ||
1004 | *poffset, &bytes_written, | ||
1005 | write_data + total_written, | ||
1006 | NULL, 0); | ||
1007 | } | 995 | } |
1008 | if (rc || (bytes_written == 0)) { | 996 | if (rc || (bytes_written == 0)) { |
1009 | if (total_written) | 997 | if (total_written) |
@@ -1240,12 +1228,6 @@ static int cifs_writepages(struct address_space *mapping, | |||
1240 | } | 1228 | } |
1241 | 1229 | ||
1242 | tcon = tlink_tcon(open_file->tlink); | 1230 | tcon = tlink_tcon(open_file->tlink); |
1243 | if (!experimEnabled && tcon->ses->server->secMode & | ||
1244 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) { | ||
1245 | cifsFileInfo_put(open_file); | ||
1246 | kfree(iov); | ||
1247 | return generic_writepages(mapping, wbc); | ||
1248 | } | ||
1249 | cifsFileInfo_put(open_file); | 1231 | cifsFileInfo_put(open_file); |
1250 | 1232 | ||
1251 | xid = GetXid(); | 1233 | xid = GetXid(); |
@@ -1980,6 +1962,24 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, | |||
1980 | return total_read; | 1962 | return total_read; |
1981 | } | 1963 | } |
1982 | 1964 | ||
1965 | /* | ||
1966 | * If the page is mmap'ed into a process' page tables, then we need to make | ||
1967 | * sure that it doesn't change while being written back. | ||
1968 | */ | ||
1969 | static int | ||
1970 | cifs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | ||
1971 | { | ||
1972 | struct page *page = vmf->page; | ||
1973 | |||
1974 | lock_page(page); | ||
1975 | return VM_FAULT_LOCKED; | ||
1976 | } | ||
1977 | |||
1978 | static struct vm_operations_struct cifs_file_vm_ops = { | ||
1979 | .fault = filemap_fault, | ||
1980 | .page_mkwrite = cifs_page_mkwrite, | ||
1981 | }; | ||
1982 | |||
1983 | int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma) | 1983 | int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma) |
1984 | { | 1984 | { |
1985 | int rc, xid; | 1985 | int rc, xid; |
@@ -1991,6 +1991,8 @@ int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma) | |||
1991 | cifs_invalidate_mapping(inode); | 1991 | cifs_invalidate_mapping(inode); |
1992 | 1992 | ||
1993 | rc = generic_file_mmap(file, vma); | 1993 | rc = generic_file_mmap(file, vma); |
1994 | if (rc == 0) | ||
1995 | vma->vm_ops = &cifs_file_vm_ops; | ||
1994 | FreeXid(xid); | 1996 | FreeXid(xid); |
1995 | return rc; | 1997 | return rc; |
1996 | } | 1998 | } |
@@ -2007,6 +2009,8 @@ int cifs_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
2007 | return rc; | 2009 | return rc; |
2008 | } | 2010 | } |
2009 | rc = generic_file_mmap(file, vma); | 2011 | rc = generic_file_mmap(file, vma); |
2012 | if (rc == 0) | ||
2013 | vma->vm_ops = &cifs_file_vm_ops; | ||
2010 | FreeXid(xid); | 2014 | FreeXid(xid); |
2011 | return rc; | 2015 | return rc; |
2012 | } | 2016 | } |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index e8804d373404..ce417a9764a3 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -239,7 +239,7 @@ CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon, | |||
239 | if (rc != 0) | 239 | if (rc != 0) |
240 | return rc; | 240 | return rc; |
241 | 241 | ||
242 | if (file_info.EndOfFile != CIFS_MF_SYMLINK_FILE_SIZE) { | 242 | if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) { |
243 | CIFSSMBClose(xid, tcon, netfid); | 243 | CIFSSMBClose(xid, tcon, netfid); |
244 | /* it's not a symlink */ | 244 | /* it's not a symlink */ |
245 | return -EINVAL; | 245 | return -EINVAL; |
@@ -316,7 +316,7 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr, | |||
316 | if (rc != 0) | 316 | if (rc != 0) |
317 | goto out; | 317 | goto out; |
318 | 318 | ||
319 | if (file_info.EndOfFile != CIFS_MF_SYMLINK_FILE_SIZE) { | 319 | if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) { |
320 | CIFSSMBClose(xid, pTcon, netfid); | 320 | CIFSSMBClose(xid, pTcon, netfid); |
321 | /* it's not a symlink */ | 321 | /* it's not a symlink */ |
322 | goto out; | 322 | goto out; |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 2a930a752a78..0c684ae4c071 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -100,6 +100,7 @@ sesInfoFree(struct cifsSesInfo *buf_to_free) | |||
100 | memset(buf_to_free->password, 0, strlen(buf_to_free->password)); | 100 | memset(buf_to_free->password, 0, strlen(buf_to_free->password)); |
101 | kfree(buf_to_free->password); | 101 | kfree(buf_to_free->password); |
102 | } | 102 | } |
103 | kfree(buf_to_free->user_name); | ||
103 | kfree(buf_to_free->domainName); | 104 | kfree(buf_to_free->domainName); |
104 | kfree(buf_to_free); | 105 | kfree(buf_to_free); |
105 | } | 106 | } |
@@ -520,7 +521,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
520 | (struct smb_com_transaction_change_notify_rsp *)buf; | 521 | (struct smb_com_transaction_change_notify_rsp *)buf; |
521 | struct file_notify_information *pnotify; | 522 | struct file_notify_information *pnotify; |
522 | __u32 data_offset = 0; | 523 | __u32 data_offset = 0; |
523 | if (pSMBr->ByteCount > sizeof(struct file_notify_information)) { | 524 | if (get_bcc_le(buf) > sizeof(struct file_notify_information)) { |
524 | data_offset = le32_to_cpu(pSMBr->DataOffset); | 525 | data_offset = le32_to_cpu(pSMBr->DataOffset); |
525 | 526 | ||
526 | pnotify = (struct file_notify_information *) | 527 | pnotify = (struct file_notify_information *) |
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 16765703131b..f6728eb6f4b9 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -219,12 +219,12 @@ static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, | |||
219 | bcc_ptr++; | 219 | bcc_ptr++; |
220 | } */ | 220 | } */ |
221 | /* copy user */ | 221 | /* copy user */ |
222 | if (ses->userName == NULL) { | 222 | if (ses->user_name == NULL) { |
223 | /* null user mount */ | 223 | /* null user mount */ |
224 | *bcc_ptr = 0; | 224 | *bcc_ptr = 0; |
225 | *(bcc_ptr+1) = 0; | 225 | *(bcc_ptr+1) = 0; |
226 | } else { | 226 | } else { |
227 | bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->userName, | 227 | bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->user_name, |
228 | MAX_USERNAME_SIZE, nls_cp); | 228 | MAX_USERNAME_SIZE, nls_cp); |
229 | } | 229 | } |
230 | bcc_ptr += 2 * bytes_ret; | 230 | bcc_ptr += 2 * bytes_ret; |
@@ -244,12 +244,11 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, | |||
244 | /* copy user */ | 244 | /* copy user */ |
245 | /* BB what about null user mounts - check that we do this BB */ | 245 | /* BB what about null user mounts - check that we do this BB */ |
246 | /* copy user */ | 246 | /* copy user */ |
247 | if (ses->userName == NULL) { | 247 | if (ses->user_name != NULL) |
248 | /* BB what about null user mounts - check that we do this BB */ | 248 | strncpy(bcc_ptr, ses->user_name, MAX_USERNAME_SIZE); |
249 | } else { | 249 | /* else null user mount */ |
250 | strncpy(bcc_ptr, ses->userName, MAX_USERNAME_SIZE); | 250 | |
251 | } | 251 | bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE); |
252 | bcc_ptr += strnlen(ses->userName, MAX_USERNAME_SIZE); | ||
253 | *bcc_ptr = 0; | 252 | *bcc_ptr = 0; |
254 | bcc_ptr++; /* account for null termination */ | 253 | bcc_ptr++; /* account for null termination */ |
255 | 254 | ||
@@ -405,8 +404,8 @@ static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, | |||
405 | /* BB spec says that if AvId field of MsvAvTimestamp is populated then | 404 | /* BB spec says that if AvId field of MsvAvTimestamp is populated then |
406 | we must set the MIC field of the AUTHENTICATE_MESSAGE */ | 405 | we must set the MIC field of the AUTHENTICATE_MESSAGE */ |
407 | ses->ntlmssp->server_flags = le32_to_cpu(pblob->NegotiateFlags); | 406 | ses->ntlmssp->server_flags = le32_to_cpu(pblob->NegotiateFlags); |
408 | tioffset = cpu_to_le16(pblob->TargetInfoArray.BufferOffset); | 407 | tioffset = le32_to_cpu(pblob->TargetInfoArray.BufferOffset); |
409 | tilen = cpu_to_le16(pblob->TargetInfoArray.Length); | 408 | tilen = le16_to_cpu(pblob->TargetInfoArray.Length); |
410 | if (tilen) { | 409 | if (tilen) { |
411 | ses->auth_key.response = kmalloc(tilen, GFP_KERNEL); | 410 | ses->auth_key.response = kmalloc(tilen, GFP_KERNEL); |
412 | if (!ses->auth_key.response) { | 411 | if (!ses->auth_key.response) { |
@@ -523,14 +522,14 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer, | |||
523 | tmp += len; | 522 | tmp += len; |
524 | } | 523 | } |
525 | 524 | ||
526 | if (ses->userName == NULL) { | 525 | if (ses->user_name == NULL) { |
527 | sec_blob->UserName.BufferOffset = cpu_to_le32(tmp - pbuffer); | 526 | sec_blob->UserName.BufferOffset = cpu_to_le32(tmp - pbuffer); |
528 | sec_blob->UserName.Length = 0; | 527 | sec_blob->UserName.Length = 0; |
529 | sec_blob->UserName.MaximumLength = 0; | 528 | sec_blob->UserName.MaximumLength = 0; |
530 | tmp += 2; | 529 | tmp += 2; |
531 | } else { | 530 | } else { |
532 | int len; | 531 | int len; |
533 | len = cifs_strtoUCS((__le16 *)tmp, ses->userName, | 532 | len = cifs_strtoUCS((__le16 *)tmp, ses->user_name, |
534 | MAX_USERNAME_SIZE, nls_cp); | 533 | MAX_USERNAME_SIZE, nls_cp); |
535 | len *= 2; /* unicode is 2 bytes each */ | 534 | len *= 2; /* unicode is 2 bytes each */ |
536 | sec_blob->UserName.BufferOffset = cpu_to_le32(tmp - pbuffer); | 535 | sec_blob->UserName.BufferOffset = cpu_to_le32(tmp - pbuffer); |
diff --git a/fs/dcache.c b/fs/dcache.c index ad25c4cec7d5..22a0ef41bad1 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -99,12 +99,9 @@ static struct kmem_cache *dentry_cache __read_mostly; | |||
99 | static unsigned int d_hash_mask __read_mostly; | 99 | static unsigned int d_hash_mask __read_mostly; |
100 | static unsigned int d_hash_shift __read_mostly; | 100 | static unsigned int d_hash_shift __read_mostly; |
101 | 101 | ||
102 | struct dcache_hash_bucket { | 102 | static struct hlist_bl_head *dentry_hashtable __read_mostly; |
103 | struct hlist_bl_head head; | ||
104 | }; | ||
105 | static struct dcache_hash_bucket *dentry_hashtable __read_mostly; | ||
106 | 103 | ||
107 | static inline struct dcache_hash_bucket *d_hash(struct dentry *parent, | 104 | static inline struct hlist_bl_head *d_hash(struct dentry *parent, |
108 | unsigned long hash) | 105 | unsigned long hash) |
109 | { | 106 | { |
110 | hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES; | 107 | hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES; |
@@ -112,16 +109,6 @@ static inline struct dcache_hash_bucket *d_hash(struct dentry *parent, | |||
112 | return dentry_hashtable + (hash & D_HASHMASK); | 109 | return dentry_hashtable + (hash & D_HASHMASK); |
113 | } | 110 | } |
114 | 111 | ||
115 | static inline void spin_lock_bucket(struct dcache_hash_bucket *b) | ||
116 | { | ||
117 | bit_spin_lock(0, (unsigned long *)&b->head.first); | ||
118 | } | ||
119 | |||
120 | static inline void spin_unlock_bucket(struct dcache_hash_bucket *b) | ||
121 | { | ||
122 | __bit_spin_unlock(0, (unsigned long *)&b->head.first); | ||
123 | } | ||
124 | |||
125 | /* Statistics gathering. */ | 112 | /* Statistics gathering. */ |
126 | struct dentry_stat_t dentry_stat = { | 113 | struct dentry_stat_t dentry_stat = { |
127 | .age_limit = 45, | 114 | .age_limit = 45, |
@@ -167,8 +154,8 @@ static void d_free(struct dentry *dentry) | |||
167 | if (dentry->d_op && dentry->d_op->d_release) | 154 | if (dentry->d_op && dentry->d_op->d_release) |
168 | dentry->d_op->d_release(dentry); | 155 | dentry->d_op->d_release(dentry); |
169 | 156 | ||
170 | /* if dentry was never inserted into hash, immediate free is OK */ | 157 | /* if dentry was never visible to RCU, immediate free is OK */ |
171 | if (hlist_bl_unhashed(&dentry->d_hash)) | 158 | if (!(dentry->d_flags & DCACHE_RCUACCESS)) |
172 | __d_free(&dentry->d_u.d_rcu); | 159 | __d_free(&dentry->d_u.d_rcu); |
173 | else | 160 | else |
174 | call_rcu(&dentry->d_u.d_rcu, __d_free); | 161 | call_rcu(&dentry->d_u.d_rcu, __d_free); |
@@ -330,28 +317,19 @@ static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent) | |||
330 | */ | 317 | */ |
331 | void __d_drop(struct dentry *dentry) | 318 | void __d_drop(struct dentry *dentry) |
332 | { | 319 | { |
333 | if (!(dentry->d_flags & DCACHE_UNHASHED)) { | 320 | if (!d_unhashed(dentry)) { |
334 | if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED)) { | 321 | struct hlist_bl_head *b; |
335 | bit_spin_lock(0, | 322 | if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED)) |
336 | (unsigned long *)&dentry->d_sb->s_anon.first); | 323 | b = &dentry->d_sb->s_anon; |
337 | dentry->d_flags |= DCACHE_UNHASHED; | 324 | else |
338 | hlist_bl_del_init(&dentry->d_hash); | ||
339 | __bit_spin_unlock(0, | ||
340 | (unsigned long *)&dentry->d_sb->s_anon.first); | ||
341 | } else { | ||
342 | struct dcache_hash_bucket *b; | ||
343 | b = d_hash(dentry->d_parent, dentry->d_name.hash); | 325 | b = d_hash(dentry->d_parent, dentry->d_name.hash); |
344 | spin_lock_bucket(b); | 326 | |
345 | /* | 327 | hlist_bl_lock(b); |
346 | * We may not actually need to put DCACHE_UNHASHED | 328 | __hlist_bl_del(&dentry->d_hash); |
347 | * manipulations under the hash lock, but follow | 329 | dentry->d_hash.pprev = NULL; |
348 | * the principle of least surprise. | 330 | hlist_bl_unlock(b); |
349 | */ | 331 | |
350 | dentry->d_flags |= DCACHE_UNHASHED; | 332 | dentry_rcuwalk_barrier(dentry); |
351 | hlist_bl_del_rcu(&dentry->d_hash); | ||
352 | spin_unlock_bucket(b); | ||
353 | dentry_rcuwalk_barrier(dentry); | ||
354 | } | ||
355 | } | 333 | } |
356 | } | 334 | } |
357 | EXPORT_SYMBOL(__d_drop); | 335 | EXPORT_SYMBOL(__d_drop); |
@@ -1304,7 +1282,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) | |||
1304 | dname[name->len] = 0; | 1282 | dname[name->len] = 0; |
1305 | 1283 | ||
1306 | dentry->d_count = 1; | 1284 | dentry->d_count = 1; |
1307 | dentry->d_flags = DCACHE_UNHASHED; | 1285 | dentry->d_flags = 0; |
1308 | spin_lock_init(&dentry->d_lock); | 1286 | spin_lock_init(&dentry->d_lock); |
1309 | seqcount_init(&dentry->d_seq); | 1287 | seqcount_init(&dentry->d_seq); |
1310 | dentry->d_inode = NULL; | 1288 | dentry->d_inode = NULL; |
@@ -1606,10 +1584,9 @@ struct dentry *d_obtain_alias(struct inode *inode) | |||
1606 | tmp->d_inode = inode; | 1584 | tmp->d_inode = inode; |
1607 | tmp->d_flags |= DCACHE_DISCONNECTED; | 1585 | tmp->d_flags |= DCACHE_DISCONNECTED; |
1608 | list_add(&tmp->d_alias, &inode->i_dentry); | 1586 | list_add(&tmp->d_alias, &inode->i_dentry); |
1609 | bit_spin_lock(0, (unsigned long *)&tmp->d_sb->s_anon.first); | 1587 | hlist_bl_lock(&tmp->d_sb->s_anon); |
1610 | tmp->d_flags &= ~DCACHE_UNHASHED; | ||
1611 | hlist_bl_add_head(&tmp->d_hash, &tmp->d_sb->s_anon); | 1588 | hlist_bl_add_head(&tmp->d_hash, &tmp->d_sb->s_anon); |
1612 | __bit_spin_unlock(0, (unsigned long *)&tmp->d_sb->s_anon.first); | 1589 | hlist_bl_unlock(&tmp->d_sb->s_anon); |
1613 | spin_unlock(&tmp->d_lock); | 1590 | spin_unlock(&tmp->d_lock); |
1614 | spin_unlock(&inode->i_lock); | 1591 | spin_unlock(&inode->i_lock); |
1615 | security_d_instantiate(tmp, inode); | 1592 | security_d_instantiate(tmp, inode); |
@@ -1789,7 +1766,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, | |||
1789 | unsigned int len = name->len; | 1766 | unsigned int len = name->len; |
1790 | unsigned int hash = name->hash; | 1767 | unsigned int hash = name->hash; |
1791 | const unsigned char *str = name->name; | 1768 | const unsigned char *str = name->name; |
1792 | struct dcache_hash_bucket *b = d_hash(parent, hash); | 1769 | struct hlist_bl_head *b = d_hash(parent, hash); |
1793 | struct hlist_bl_node *node; | 1770 | struct hlist_bl_node *node; |
1794 | struct dentry *dentry; | 1771 | struct dentry *dentry; |
1795 | 1772 | ||
@@ -1813,7 +1790,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, | |||
1813 | * | 1790 | * |
1814 | * See Documentation/filesystems/path-lookup.txt for more details. | 1791 | * See Documentation/filesystems/path-lookup.txt for more details. |
1815 | */ | 1792 | */ |
1816 | hlist_bl_for_each_entry_rcu(dentry, node, &b->head, d_hash) { | 1793 | hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { |
1817 | struct inode *i; | 1794 | struct inode *i; |
1818 | const char *tname; | 1795 | const char *tname; |
1819 | int tlen; | 1796 | int tlen; |
@@ -1908,7 +1885,7 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name) | |||
1908 | unsigned int len = name->len; | 1885 | unsigned int len = name->len; |
1909 | unsigned int hash = name->hash; | 1886 | unsigned int hash = name->hash; |
1910 | const unsigned char *str = name->name; | 1887 | const unsigned char *str = name->name; |
1911 | struct dcache_hash_bucket *b = d_hash(parent, hash); | 1888 | struct hlist_bl_head *b = d_hash(parent, hash); |
1912 | struct hlist_bl_node *node; | 1889 | struct hlist_bl_node *node; |
1913 | struct dentry *found = NULL; | 1890 | struct dentry *found = NULL; |
1914 | struct dentry *dentry; | 1891 | struct dentry *dentry; |
@@ -1935,7 +1912,7 @@ struct dentry *__d_lookup(struct dentry *parent, struct qstr *name) | |||
1935 | */ | 1912 | */ |
1936 | rcu_read_lock(); | 1913 | rcu_read_lock(); |
1937 | 1914 | ||
1938 | hlist_bl_for_each_entry_rcu(dentry, node, &b->head, d_hash) { | 1915 | hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { |
1939 | const char *tname; | 1916 | const char *tname; |
1940 | int tlen; | 1917 | int tlen; |
1941 | 1918 | ||
@@ -2086,13 +2063,13 @@ again: | |||
2086 | } | 2063 | } |
2087 | EXPORT_SYMBOL(d_delete); | 2064 | EXPORT_SYMBOL(d_delete); |
2088 | 2065 | ||
2089 | static void __d_rehash(struct dentry * entry, struct dcache_hash_bucket *b) | 2066 | static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b) |
2090 | { | 2067 | { |
2091 | BUG_ON(!d_unhashed(entry)); | 2068 | BUG_ON(!d_unhashed(entry)); |
2092 | spin_lock_bucket(b); | 2069 | hlist_bl_lock(b); |
2093 | entry->d_flags &= ~DCACHE_UNHASHED; | 2070 | entry->d_flags |= DCACHE_RCUACCESS; |
2094 | hlist_bl_add_head_rcu(&entry->d_hash, &b->head); | 2071 | hlist_bl_add_head_rcu(&entry->d_hash, b); |
2095 | spin_unlock_bucket(b); | 2072 | hlist_bl_unlock(b); |
2096 | } | 2073 | } |
2097 | 2074 | ||
2098 | static void _d_rehash(struct dentry * entry) | 2075 | static void _d_rehash(struct dentry * entry) |
@@ -2131,7 +2108,7 @@ EXPORT_SYMBOL(d_rehash); | |||
2131 | */ | 2108 | */ |
2132 | void dentry_update_name_case(struct dentry *dentry, struct qstr *name) | 2109 | void dentry_update_name_case(struct dentry *dentry, struct qstr *name) |
2133 | { | 2110 | { |
2134 | BUG_ON(!mutex_is_locked(&dentry->d_inode->i_mutex)); | 2111 | BUG_ON(!mutex_is_locked(&dentry->d_parent->d_inode->i_mutex)); |
2135 | BUG_ON(dentry->d_name.len != name->len); /* d_lookup gives this */ | 2112 | BUG_ON(dentry->d_name.len != name->len); /* d_lookup gives this */ |
2136 | 2113 | ||
2137 | spin_lock(&dentry->d_lock); | 2114 | spin_lock(&dentry->d_lock); |
@@ -3025,7 +3002,7 @@ static void __init dcache_init_early(void) | |||
3025 | 3002 | ||
3026 | dentry_hashtable = | 3003 | dentry_hashtable = |
3027 | alloc_large_system_hash("Dentry cache", | 3004 | alloc_large_system_hash("Dentry cache", |
3028 | sizeof(struct dcache_hash_bucket), | 3005 | sizeof(struct hlist_bl_head), |
3029 | dhash_entries, | 3006 | dhash_entries, |
3030 | 13, | 3007 | 13, |
3031 | HASH_EARLY, | 3008 | HASH_EARLY, |
@@ -3034,7 +3011,7 @@ static void __init dcache_init_early(void) | |||
3034 | 0); | 3011 | 0); |
3035 | 3012 | ||
3036 | for (loop = 0; loop < (1 << d_hash_shift); loop++) | 3013 | for (loop = 0; loop < (1 << d_hash_shift); loop++) |
3037 | INIT_HLIST_BL_HEAD(&dentry_hashtable[loop].head); | 3014 | INIT_HLIST_BL_HEAD(dentry_hashtable + loop); |
3038 | } | 3015 | } |
3039 | 3016 | ||
3040 | static void __init dcache_init(void) | 3017 | static void __init dcache_init(void) |
@@ -3057,7 +3034,7 @@ static void __init dcache_init(void) | |||
3057 | 3034 | ||
3058 | dentry_hashtable = | 3035 | dentry_hashtable = |
3059 | alloc_large_system_hash("Dentry cache", | 3036 | alloc_large_system_hash("Dentry cache", |
3060 | sizeof(struct dcache_hash_bucket), | 3037 | sizeof(struct hlist_bl_head), |
3061 | dhash_entries, | 3038 | dhash_entries, |
3062 | 13, | 3039 | 13, |
3063 | 0, | 3040 | 0, |
@@ -3066,7 +3043,7 @@ static void __init dcache_init(void) | |||
3066 | 0); | 3043 | 0); |
3067 | 3044 | ||
3068 | for (loop = 0; loop < (1 << d_hash_shift); loop++) | 3045 | for (loop = 0; loop < (1 << d_hash_shift); loop++) |
3069 | INIT_HLIST_BL_HEAD(&dentry_hashtable[loop].head); | 3046 | INIT_HLIST_BL_HEAD(dentry_hashtable + loop); |
3070 | } | 3047 | } |
3071 | 3048 | ||
3072 | /* SLAB cache for __getname() consumers */ | 3049 | /* SLAB cache for __getname() consumers */ |
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index d2a70a4561f9..b8d5c8091024 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -1452,6 +1452,25 @@ static void set_default_header_data(struct ecryptfs_crypt_stat *crypt_stat) | |||
1452 | crypt_stat->metadata_size = ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; | 1452 | crypt_stat->metadata_size = ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; |
1453 | } | 1453 | } |
1454 | 1454 | ||
1455 | void ecryptfs_i_size_init(const char *page_virt, struct inode *inode) | ||
1456 | { | ||
1457 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat; | ||
1458 | struct ecryptfs_crypt_stat *crypt_stat; | ||
1459 | u64 file_size; | ||
1460 | |||
1461 | crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat; | ||
1462 | mount_crypt_stat = | ||
1463 | &ecryptfs_superblock_to_private(inode->i_sb)->mount_crypt_stat; | ||
1464 | if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) { | ||
1465 | file_size = i_size_read(ecryptfs_inode_to_lower(inode)); | ||
1466 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) | ||
1467 | file_size += crypt_stat->metadata_size; | ||
1468 | } else | ||
1469 | file_size = get_unaligned_be64(page_virt); | ||
1470 | i_size_write(inode, (loff_t)file_size); | ||
1471 | crypt_stat->flags |= ECRYPTFS_I_SIZE_INITIALIZED; | ||
1472 | } | ||
1473 | |||
1455 | /** | 1474 | /** |
1456 | * ecryptfs_read_headers_virt | 1475 | * ecryptfs_read_headers_virt |
1457 | * @page_virt: The virtual address into which to read the headers | 1476 | * @page_virt: The virtual address into which to read the headers |
@@ -1482,6 +1501,8 @@ static int ecryptfs_read_headers_virt(char *page_virt, | |||
1482 | rc = -EINVAL; | 1501 | rc = -EINVAL; |
1483 | goto out; | 1502 | goto out; |
1484 | } | 1503 | } |
1504 | if (!(crypt_stat->flags & ECRYPTFS_I_SIZE_INITIALIZED)) | ||
1505 | ecryptfs_i_size_init(page_virt, ecryptfs_dentry->d_inode); | ||
1485 | offset += MAGIC_ECRYPTFS_MARKER_SIZE_BYTES; | 1506 | offset += MAGIC_ECRYPTFS_MARKER_SIZE_BYTES; |
1486 | rc = ecryptfs_process_flags(crypt_stat, (page_virt + offset), | 1507 | rc = ecryptfs_process_flags(crypt_stat, (page_virt + offset), |
1487 | &bytes_read); | 1508 | &bytes_read); |
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index bd3cafd0949d..e70282775e2c 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
@@ -269,6 +269,7 @@ struct ecryptfs_crypt_stat { | |||
269 | #define ECRYPTFS_ENCFN_USE_MOUNT_FNEK 0x00000800 | 269 | #define ECRYPTFS_ENCFN_USE_MOUNT_FNEK 0x00000800 |
270 | #define ECRYPTFS_ENCFN_USE_FEK 0x00001000 | 270 | #define ECRYPTFS_ENCFN_USE_FEK 0x00001000 |
271 | #define ECRYPTFS_UNLINK_SIGS 0x00002000 | 271 | #define ECRYPTFS_UNLINK_SIGS 0x00002000 |
272 | #define ECRYPTFS_I_SIZE_INITIALIZED 0x00004000 | ||
272 | u32 flags; | 273 | u32 flags; |
273 | unsigned int file_version; | 274 | unsigned int file_version; |
274 | size_t iv_bytes; | 275 | size_t iv_bytes; |
@@ -295,6 +296,8 @@ struct ecryptfs_crypt_stat { | |||
295 | struct ecryptfs_inode_info { | 296 | struct ecryptfs_inode_info { |
296 | struct inode vfs_inode; | 297 | struct inode vfs_inode; |
297 | struct inode *wii_inode; | 298 | struct inode *wii_inode; |
299 | struct mutex lower_file_mutex; | ||
300 | atomic_t lower_file_count; | ||
298 | struct file *lower_file; | 301 | struct file *lower_file; |
299 | struct ecryptfs_crypt_stat crypt_stat; | 302 | struct ecryptfs_crypt_stat crypt_stat; |
300 | }; | 303 | }; |
@@ -626,6 +629,7 @@ struct ecryptfs_open_req { | |||
626 | int ecryptfs_interpose(struct dentry *hidden_dentry, | 629 | int ecryptfs_interpose(struct dentry *hidden_dentry, |
627 | struct dentry *this_dentry, struct super_block *sb, | 630 | struct dentry *this_dentry, struct super_block *sb, |
628 | u32 flags); | 631 | u32 flags); |
632 | void ecryptfs_i_size_init(const char *page_virt, struct inode *inode); | ||
629 | int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | 633 | int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, |
630 | struct dentry *lower_dentry, | 634 | struct dentry *lower_dentry, |
631 | struct inode *ecryptfs_dir_inode); | 635 | struct inode *ecryptfs_dir_inode); |
@@ -757,7 +761,8 @@ int ecryptfs_privileged_open(struct file **lower_file, | |||
757 | struct dentry *lower_dentry, | 761 | struct dentry *lower_dentry, |
758 | struct vfsmount *lower_mnt, | 762 | struct vfsmount *lower_mnt, |
759 | const struct cred *cred); | 763 | const struct cred *cred); |
760 | int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry); | 764 | int ecryptfs_get_lower_file(struct dentry *ecryptfs_dentry); |
765 | void ecryptfs_put_lower_file(struct inode *inode); | ||
761 | int | 766 | int |
762 | ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes, | 767 | ecryptfs_write_tag_70_packet(char *dest, size_t *remaining_bytes, |
763 | size_t *packet_size, | 768 | size_t *packet_size, |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index cedc913d11ba..566e5472f78c 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -191,10 +191,10 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
191 | | ECRYPTFS_ENCRYPTED); | 191 | | ECRYPTFS_ENCRYPTED); |
192 | } | 192 | } |
193 | mutex_unlock(&crypt_stat->cs_mutex); | 193 | mutex_unlock(&crypt_stat->cs_mutex); |
194 | rc = ecryptfs_init_persistent_file(ecryptfs_dentry); | 194 | rc = ecryptfs_get_lower_file(ecryptfs_dentry); |
195 | if (rc) { | 195 | if (rc) { |
196 | printk(KERN_ERR "%s: Error attempting to initialize " | 196 | printk(KERN_ERR "%s: Error attempting to initialize " |
197 | "the persistent file for the dentry with name " | 197 | "the lower file for the dentry with name " |
198 | "[%s]; rc = [%d]\n", __func__, | 198 | "[%s]; rc = [%d]\n", __func__, |
199 | ecryptfs_dentry->d_name.name, rc); | 199 | ecryptfs_dentry->d_name.name, rc); |
200 | goto out_free; | 200 | goto out_free; |
@@ -202,9 +202,9 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
202 | if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE) | 202 | if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE) |
203 | == O_RDONLY && (file->f_flags & O_ACCMODE) != O_RDONLY) { | 203 | == O_RDONLY && (file->f_flags & O_ACCMODE) != O_RDONLY) { |
204 | rc = -EPERM; | 204 | rc = -EPERM; |
205 | printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs " | 205 | printk(KERN_WARNING "%s: Lower file is RO; eCryptfs " |
206 | "file must hence be opened RO\n", __func__); | 206 | "file must hence be opened RO\n", __func__); |
207 | goto out_free; | 207 | goto out_put; |
208 | } | 208 | } |
209 | ecryptfs_set_file_lower( | 209 | ecryptfs_set_file_lower( |
210 | file, ecryptfs_inode_to_private(inode)->lower_file); | 210 | file, ecryptfs_inode_to_private(inode)->lower_file); |
@@ -232,10 +232,11 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
232 | "Plaintext passthrough mode is not " | 232 | "Plaintext passthrough mode is not " |
233 | "enabled; returning -EIO\n"); | 233 | "enabled; returning -EIO\n"); |
234 | mutex_unlock(&crypt_stat->cs_mutex); | 234 | mutex_unlock(&crypt_stat->cs_mutex); |
235 | goto out_free; | 235 | goto out_put; |
236 | } | 236 | } |
237 | rc = 0; | 237 | rc = 0; |
238 | crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED); | 238 | crypt_stat->flags &= ~(ECRYPTFS_I_SIZE_INITIALIZED |
239 | | ECRYPTFS_ENCRYPTED); | ||
239 | mutex_unlock(&crypt_stat->cs_mutex); | 240 | mutex_unlock(&crypt_stat->cs_mutex); |
240 | goto out; | 241 | goto out; |
241 | } | 242 | } |
@@ -245,6 +246,8 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | |||
245 | "[0x%.16lx] size: [0x%.16llx]\n", inode, inode->i_ino, | 246 | "[0x%.16lx] size: [0x%.16llx]\n", inode, inode->i_ino, |
246 | (unsigned long long)i_size_read(inode)); | 247 | (unsigned long long)i_size_read(inode)); |
247 | goto out; | 248 | goto out; |
249 | out_put: | ||
250 | ecryptfs_put_lower_file(inode); | ||
248 | out_free: | 251 | out_free: |
249 | kmem_cache_free(ecryptfs_file_info_cache, | 252 | kmem_cache_free(ecryptfs_file_info_cache, |
250 | ecryptfs_file_to_private(file)); | 253 | ecryptfs_file_to_private(file)); |
@@ -254,17 +257,13 @@ out: | |||
254 | 257 | ||
255 | static int ecryptfs_flush(struct file *file, fl_owner_t td) | 258 | static int ecryptfs_flush(struct file *file, fl_owner_t td) |
256 | { | 259 | { |
257 | int rc = 0; | 260 | return file->f_mode & FMODE_WRITE |
258 | struct file *lower_file = NULL; | 261 | ? filemap_write_and_wait(file->f_mapping) : 0; |
259 | |||
260 | lower_file = ecryptfs_file_to_lower(file); | ||
261 | if (lower_file->f_op && lower_file->f_op->flush) | ||
262 | rc = lower_file->f_op->flush(lower_file, td); | ||
263 | return rc; | ||
264 | } | 262 | } |
265 | 263 | ||
266 | static int ecryptfs_release(struct inode *inode, struct file *file) | 264 | static int ecryptfs_release(struct inode *inode, struct file *file) |
267 | { | 265 | { |
266 | ecryptfs_put_lower_file(inode); | ||
268 | kmem_cache_free(ecryptfs_file_info_cache, | 267 | kmem_cache_free(ecryptfs_file_info_cache, |
269 | ecryptfs_file_to_private(file)); | 268 | ecryptfs_file_to_private(file)); |
270 | return 0; | 269 | return 0; |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index f99051b7adab..4d4cc6a90cd5 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -168,19 +168,18 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry) | |||
168 | "context; rc = [%d]\n", rc); | 168 | "context; rc = [%d]\n", rc); |
169 | goto out; | 169 | goto out; |
170 | } | 170 | } |
171 | rc = ecryptfs_init_persistent_file(ecryptfs_dentry); | 171 | rc = ecryptfs_get_lower_file(ecryptfs_dentry); |
172 | if (rc) { | 172 | if (rc) { |
173 | printk(KERN_ERR "%s: Error attempting to initialize " | 173 | printk(KERN_ERR "%s: Error attempting to initialize " |
174 | "the persistent file for the dentry with name " | 174 | "the lower file for the dentry with name " |
175 | "[%s]; rc = [%d]\n", __func__, | 175 | "[%s]; rc = [%d]\n", __func__, |
176 | ecryptfs_dentry->d_name.name, rc); | 176 | ecryptfs_dentry->d_name.name, rc); |
177 | goto out; | 177 | goto out; |
178 | } | 178 | } |
179 | rc = ecryptfs_write_metadata(ecryptfs_dentry); | 179 | rc = ecryptfs_write_metadata(ecryptfs_dentry); |
180 | if (rc) { | 180 | if (rc) |
181 | printk(KERN_ERR "Error writing headers; rc = [%d]\n", rc); | 181 | printk(KERN_ERR "Error writing headers; rc = [%d]\n", rc); |
182 | goto out; | 182 | ecryptfs_put_lower_file(ecryptfs_dentry->d_inode); |
183 | } | ||
184 | out: | 183 | out: |
185 | return rc; | 184 | return rc; |
186 | } | 185 | } |
@@ -226,11 +225,9 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
226 | struct dentry *lower_dir_dentry; | 225 | struct dentry *lower_dir_dentry; |
227 | struct vfsmount *lower_mnt; | 226 | struct vfsmount *lower_mnt; |
228 | struct inode *lower_inode; | 227 | struct inode *lower_inode; |
229 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat; | ||
230 | struct ecryptfs_crypt_stat *crypt_stat; | 228 | struct ecryptfs_crypt_stat *crypt_stat; |
231 | char *page_virt = NULL; | 229 | char *page_virt = NULL; |
232 | u64 file_size; | 230 | int put_lower = 0, rc = 0; |
233 | int rc = 0; | ||
234 | 231 | ||
235 | lower_dir_dentry = lower_dentry->d_parent; | 232 | lower_dir_dentry = lower_dentry->d_parent; |
236 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt( | 233 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt( |
@@ -277,14 +274,15 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
277 | rc = -ENOMEM; | 274 | rc = -ENOMEM; |
278 | goto out; | 275 | goto out; |
279 | } | 276 | } |
280 | rc = ecryptfs_init_persistent_file(ecryptfs_dentry); | 277 | rc = ecryptfs_get_lower_file(ecryptfs_dentry); |
281 | if (rc) { | 278 | if (rc) { |
282 | printk(KERN_ERR "%s: Error attempting to initialize " | 279 | printk(KERN_ERR "%s: Error attempting to initialize " |
283 | "the persistent file for the dentry with name " | 280 | "the lower file for the dentry with name " |
284 | "[%s]; rc = [%d]\n", __func__, | 281 | "[%s]; rc = [%d]\n", __func__, |
285 | ecryptfs_dentry->d_name.name, rc); | 282 | ecryptfs_dentry->d_name.name, rc); |
286 | goto out_free_kmem; | 283 | goto out_free_kmem; |
287 | } | 284 | } |
285 | put_lower = 1; | ||
288 | crypt_stat = &ecryptfs_inode_to_private( | 286 | crypt_stat = &ecryptfs_inode_to_private( |
289 | ecryptfs_dentry->d_inode)->crypt_stat; | 287 | ecryptfs_dentry->d_inode)->crypt_stat; |
290 | /* TODO: lock for crypt_stat comparison */ | 288 | /* TODO: lock for crypt_stat comparison */ |
@@ -302,18 +300,7 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
302 | } | 300 | } |
303 | crypt_stat->flags |= ECRYPTFS_METADATA_IN_XATTR; | 301 | crypt_stat->flags |= ECRYPTFS_METADATA_IN_XATTR; |
304 | } | 302 | } |
305 | mount_crypt_stat = &ecryptfs_superblock_to_private( | 303 | ecryptfs_i_size_init(page_virt, ecryptfs_dentry->d_inode); |
306 | ecryptfs_dentry->d_sb)->mount_crypt_stat; | ||
307 | if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) { | ||
308 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) | ||
309 | file_size = (crypt_stat->metadata_size | ||
310 | + i_size_read(lower_dentry->d_inode)); | ||
311 | else | ||
312 | file_size = i_size_read(lower_dentry->d_inode); | ||
313 | } else { | ||
314 | file_size = get_unaligned_be64(page_virt); | ||
315 | } | ||
316 | i_size_write(ecryptfs_dentry->d_inode, (loff_t)file_size); | ||
317 | out_free_kmem: | 304 | out_free_kmem: |
318 | kmem_cache_free(ecryptfs_header_cache_2, page_virt); | 305 | kmem_cache_free(ecryptfs_header_cache_2, page_virt); |
319 | goto out; | 306 | goto out; |
@@ -322,6 +309,8 @@ out_put: | |||
322 | mntput(lower_mnt); | 309 | mntput(lower_mnt); |
323 | d_drop(ecryptfs_dentry); | 310 | d_drop(ecryptfs_dentry); |
324 | out: | 311 | out: |
312 | if (put_lower) | ||
313 | ecryptfs_put_lower_file(ecryptfs_dentry->d_inode); | ||
325 | return rc; | 314 | return rc; |
326 | } | 315 | } |
327 | 316 | ||
@@ -538,8 +527,6 @@ static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
538 | dget(lower_dentry); | 527 | dget(lower_dentry); |
539 | rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry); | 528 | rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry); |
540 | dput(lower_dentry); | 529 | dput(lower_dentry); |
541 | if (!rc) | ||
542 | d_delete(lower_dentry); | ||
543 | fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); | 530 | fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); |
544 | dir->i_nlink = lower_dir_dentry->d_inode->i_nlink; | 531 | dir->i_nlink = lower_dir_dentry->d_inode->i_nlink; |
545 | unlock_dir(lower_dir_dentry); | 532 | unlock_dir(lower_dir_dentry); |
@@ -610,8 +597,8 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
610 | fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode); | 597 | fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode); |
611 | out_lock: | 598 | out_lock: |
612 | unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry); | 599 | unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry); |
613 | dput(lower_new_dentry->d_parent); | 600 | dput(lower_new_dir_dentry); |
614 | dput(lower_old_dentry->d_parent); | 601 | dput(lower_old_dir_dentry); |
615 | dput(lower_new_dentry); | 602 | dput(lower_new_dentry); |
616 | dput(lower_old_dentry); | 603 | dput(lower_old_dentry); |
617 | return rc; | 604 | return rc; |
@@ -759,8 +746,11 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, | |||
759 | 746 | ||
760 | if (unlikely((ia->ia_size == i_size))) { | 747 | if (unlikely((ia->ia_size == i_size))) { |
761 | lower_ia->ia_valid &= ~ATTR_SIZE; | 748 | lower_ia->ia_valid &= ~ATTR_SIZE; |
762 | goto out; | 749 | return 0; |
763 | } | 750 | } |
751 | rc = ecryptfs_get_lower_file(dentry); | ||
752 | if (rc) | ||
753 | return rc; | ||
764 | crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; | 754 | crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; |
765 | /* Switch on growing or shrinking file */ | 755 | /* Switch on growing or shrinking file */ |
766 | if (ia->ia_size > i_size) { | 756 | if (ia->ia_size > i_size) { |
@@ -838,6 +828,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, | |||
838 | lower_ia->ia_valid &= ~ATTR_SIZE; | 828 | lower_ia->ia_valid &= ~ATTR_SIZE; |
839 | } | 829 | } |
840 | out: | 830 | out: |
831 | ecryptfs_put_lower_file(inode); | ||
841 | return rc; | 832 | return rc; |
842 | } | 833 | } |
843 | 834 | ||
@@ -913,7 +904,13 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) | |||
913 | 904 | ||
914 | mount_crypt_stat = &ecryptfs_superblock_to_private( | 905 | mount_crypt_stat = &ecryptfs_superblock_to_private( |
915 | dentry->d_sb)->mount_crypt_stat; | 906 | dentry->d_sb)->mount_crypt_stat; |
907 | rc = ecryptfs_get_lower_file(dentry); | ||
908 | if (rc) { | ||
909 | mutex_unlock(&crypt_stat->cs_mutex); | ||
910 | goto out; | ||
911 | } | ||
916 | rc = ecryptfs_read_metadata(dentry); | 912 | rc = ecryptfs_read_metadata(dentry); |
913 | ecryptfs_put_lower_file(inode); | ||
917 | if (rc) { | 914 | if (rc) { |
918 | if (!(mount_crypt_stat->flags | 915 | if (!(mount_crypt_stat->flags |
919 | & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) { | 916 | & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) { |
@@ -927,10 +924,17 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) | |||
927 | goto out; | 924 | goto out; |
928 | } | 925 | } |
929 | rc = 0; | 926 | rc = 0; |
930 | crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED); | 927 | crypt_stat->flags &= ~(ECRYPTFS_I_SIZE_INITIALIZED |
928 | | ECRYPTFS_ENCRYPTED); | ||
931 | } | 929 | } |
932 | } | 930 | } |
933 | mutex_unlock(&crypt_stat->cs_mutex); | 931 | mutex_unlock(&crypt_stat->cs_mutex); |
932 | if (S_ISREG(inode->i_mode)) { | ||
933 | rc = filemap_write_and_wait(inode->i_mapping); | ||
934 | if (rc) | ||
935 | goto out; | ||
936 | fsstack_copy_attr_all(inode, lower_inode); | ||
937 | } | ||
934 | memcpy(&lower_ia, ia, sizeof(lower_ia)); | 938 | memcpy(&lower_ia, ia, sizeof(lower_ia)); |
935 | if (ia->ia_valid & ATTR_FILE) | 939 | if (ia->ia_valid & ATTR_FILE) |
936 | lower_ia.ia_file = ecryptfs_file_to_lower(ia->ia_file); | 940 | lower_ia.ia_file = ecryptfs_file_to_lower(ia->ia_file); |
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c index 0851ab6980f5..69f994a7d524 100644 --- a/fs/ecryptfs/kthread.c +++ b/fs/ecryptfs/kthread.c | |||
@@ -44,7 +44,7 @@ static struct task_struct *ecryptfs_kthread; | |||
44 | * @ignored: ignored | 44 | * @ignored: ignored |
45 | * | 45 | * |
46 | * The eCryptfs kernel thread that has the responsibility of getting | 46 | * The eCryptfs kernel thread that has the responsibility of getting |
47 | * the lower persistent file with RW permissions. | 47 | * the lower file with RW permissions. |
48 | * | 48 | * |
49 | * Returns zero on success; non-zero otherwise | 49 | * Returns zero on success; non-zero otherwise |
50 | */ | 50 | */ |
@@ -141,8 +141,8 @@ int ecryptfs_privileged_open(struct file **lower_file, | |||
141 | int rc = 0; | 141 | int rc = 0; |
142 | 142 | ||
143 | /* Corresponding dput() and mntput() are done when the | 143 | /* Corresponding dput() and mntput() are done when the |
144 | * persistent file is fput() when the eCryptfs inode is | 144 | * lower file is fput() when all eCryptfs files for the inode are |
145 | * destroyed. */ | 145 | * released. */ |
146 | dget(lower_dentry); | 146 | dget(lower_dentry); |
147 | mntget(lower_mnt); | 147 | mntget(lower_mnt); |
148 | flags |= IS_RDONLY(lower_dentry->d_inode) ? O_RDONLY : O_RDWR; | 148 | flags |= IS_RDONLY(lower_dentry->d_inode) ? O_RDONLY : O_RDWR; |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index fdb2eb0ad09e..89b93389af8e 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
@@ -96,7 +96,7 @@ void __ecryptfs_printk(const char *fmt, ...) | |||
96 | } | 96 | } |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * ecryptfs_init_persistent_file | 99 | * ecryptfs_init_lower_file |
100 | * @ecryptfs_dentry: Fully initialized eCryptfs dentry object, with | 100 | * @ecryptfs_dentry: Fully initialized eCryptfs dentry object, with |
101 | * the lower dentry and the lower mount set | 101 | * the lower dentry and the lower mount set |
102 | * | 102 | * |
@@ -104,42 +104,70 @@ void __ecryptfs_printk(const char *fmt, ...) | |||
104 | * inode. All I/O operations to the lower inode occur through that | 104 | * inode. All I/O operations to the lower inode occur through that |
105 | * file. When the first eCryptfs dentry that interposes with the first | 105 | * file. When the first eCryptfs dentry that interposes with the first |
106 | * lower dentry for that inode is created, this function creates the | 106 | * lower dentry for that inode is created, this function creates the |
107 | * persistent file struct and associates it with the eCryptfs | 107 | * lower file struct and associates it with the eCryptfs |
108 | * inode. When the eCryptfs inode is destroyed, the file is closed. | 108 | * inode. When all eCryptfs files associated with the inode are released, the |
109 | * file is closed. | ||
109 | * | 110 | * |
110 | * The persistent file will be opened with read/write permissions, if | 111 | * The lower file will be opened with read/write permissions, if |
111 | * possible. Otherwise, it is opened read-only. | 112 | * possible. Otherwise, it is opened read-only. |
112 | * | 113 | * |
113 | * This function does nothing if a lower persistent file is already | 114 | * This function does nothing if a lower file is already |
114 | * associated with the eCryptfs inode. | 115 | * associated with the eCryptfs inode. |
115 | * | 116 | * |
116 | * Returns zero on success; non-zero otherwise | 117 | * Returns zero on success; non-zero otherwise |
117 | */ | 118 | */ |
118 | int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry) | 119 | static int ecryptfs_init_lower_file(struct dentry *dentry, |
120 | struct file **lower_file) | ||
119 | { | 121 | { |
120 | const struct cred *cred = current_cred(); | 122 | const struct cred *cred = current_cred(); |
121 | struct ecryptfs_inode_info *inode_info = | 123 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); |
122 | ecryptfs_inode_to_private(ecryptfs_dentry->d_inode); | 124 | struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); |
123 | int rc = 0; | 125 | int rc; |
124 | 126 | ||
125 | if (!inode_info->lower_file) { | 127 | rc = ecryptfs_privileged_open(lower_file, lower_dentry, lower_mnt, |
126 | struct dentry *lower_dentry; | 128 | cred); |
127 | struct vfsmount *lower_mnt = | 129 | if (rc) { |
128 | ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry); | 130 | printk(KERN_ERR "Error opening lower file " |
131 | "for lower_dentry [0x%p] and lower_mnt [0x%p]; " | ||
132 | "rc = [%d]\n", lower_dentry, lower_mnt, rc); | ||
133 | (*lower_file) = NULL; | ||
134 | } | ||
135 | return rc; | ||
136 | } | ||
129 | 137 | ||
130 | lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); | 138 | int ecryptfs_get_lower_file(struct dentry *dentry) |
131 | rc = ecryptfs_privileged_open(&inode_info->lower_file, | 139 | { |
132 | lower_dentry, lower_mnt, cred); | 140 | struct ecryptfs_inode_info *inode_info = |
133 | if (rc) { | 141 | ecryptfs_inode_to_private(dentry->d_inode); |
134 | printk(KERN_ERR "Error opening lower persistent file " | 142 | int count, rc = 0; |
135 | "for lower_dentry [0x%p] and lower_mnt [0x%p]; " | 143 | |
136 | "rc = [%d]\n", lower_dentry, lower_mnt, rc); | 144 | mutex_lock(&inode_info->lower_file_mutex); |
137 | inode_info->lower_file = NULL; | 145 | count = atomic_inc_return(&inode_info->lower_file_count); |
138 | } | 146 | if (WARN_ON_ONCE(count < 1)) |
147 | rc = -EINVAL; | ||
148 | else if (count == 1) { | ||
149 | rc = ecryptfs_init_lower_file(dentry, | ||
150 | &inode_info->lower_file); | ||
151 | if (rc) | ||
152 | atomic_set(&inode_info->lower_file_count, 0); | ||
139 | } | 153 | } |
154 | mutex_unlock(&inode_info->lower_file_mutex); | ||
140 | return rc; | 155 | return rc; |
141 | } | 156 | } |
142 | 157 | ||
158 | void ecryptfs_put_lower_file(struct inode *inode) | ||
159 | { | ||
160 | struct ecryptfs_inode_info *inode_info; | ||
161 | |||
162 | inode_info = ecryptfs_inode_to_private(inode); | ||
163 | if (atomic_dec_and_mutex_lock(&inode_info->lower_file_count, | ||
164 | &inode_info->lower_file_mutex)) { | ||
165 | fput(inode_info->lower_file); | ||
166 | inode_info->lower_file = NULL; | ||
167 | mutex_unlock(&inode_info->lower_file_mutex); | ||
168 | } | ||
169 | } | ||
170 | |||
143 | static struct inode *ecryptfs_get_inode(struct inode *lower_inode, | 171 | static struct inode *ecryptfs_get_inode(struct inode *lower_inode, |
144 | struct super_block *sb) | 172 | struct super_block *sb) |
145 | { | 173 | { |
diff --git a/fs/ecryptfs/super.c b/fs/ecryptfs/super.c index bacc882e1ae4..245b517bf1b6 100644 --- a/fs/ecryptfs/super.c +++ b/fs/ecryptfs/super.c | |||
@@ -55,6 +55,8 @@ static struct inode *ecryptfs_alloc_inode(struct super_block *sb) | |||
55 | if (unlikely(!inode_info)) | 55 | if (unlikely(!inode_info)) |
56 | goto out; | 56 | goto out; |
57 | ecryptfs_init_crypt_stat(&inode_info->crypt_stat); | 57 | ecryptfs_init_crypt_stat(&inode_info->crypt_stat); |
58 | mutex_init(&inode_info->lower_file_mutex); | ||
59 | atomic_set(&inode_info->lower_file_count, 0); | ||
58 | inode_info->lower_file = NULL; | 60 | inode_info->lower_file = NULL; |
59 | inode = &inode_info->vfs_inode; | 61 | inode = &inode_info->vfs_inode; |
60 | out: | 62 | out: |
@@ -77,8 +79,7 @@ static void ecryptfs_i_callback(struct rcu_head *head) | |||
77 | * | 79 | * |
78 | * This is used during the final destruction of the inode. All | 80 | * This is used during the final destruction of the inode. All |
79 | * allocation of memory related to the inode, including allocated | 81 | * allocation of memory related to the inode, including allocated |
80 | * memory in the crypt_stat struct, will be released here. This | 82 | * memory in the crypt_stat struct, will be released here. |
81 | * function also fput()'s the persistent file for the lower inode. | ||
82 | * There should be no chance that this deallocation will be missed. | 83 | * There should be no chance that this deallocation will be missed. |
83 | */ | 84 | */ |
84 | static void ecryptfs_destroy_inode(struct inode *inode) | 85 | static void ecryptfs_destroy_inode(struct inode *inode) |
@@ -86,16 +87,7 @@ static void ecryptfs_destroy_inode(struct inode *inode) | |||
86 | struct ecryptfs_inode_info *inode_info; | 87 | struct ecryptfs_inode_info *inode_info; |
87 | 88 | ||
88 | inode_info = ecryptfs_inode_to_private(inode); | 89 | inode_info = ecryptfs_inode_to_private(inode); |
89 | if (inode_info->lower_file) { | 90 | BUG_ON(inode_info->lower_file); |
90 | struct dentry *lower_dentry = | ||
91 | inode_info->lower_file->f_dentry; | ||
92 | |||
93 | BUG_ON(!lower_dentry); | ||
94 | if (lower_dentry->d_inode) { | ||
95 | fput(inode_info->lower_file); | ||
96 | inode_info->lower_file = NULL; | ||
97 | } | ||
98 | } | ||
99 | ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); | 91 | ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); |
100 | call_rcu(&inode->i_rcu, ecryptfs_i_callback); | 92 | call_rcu(&inode->i_rcu, ecryptfs_i_callback); |
101 | } | 93 | } |
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h index e25e99bf7ee1..d0f53538a57f 100644 --- a/fs/ext4/ext4_jbd2.h +++ b/fs/ext4/ext4_jbd2.h | |||
@@ -86,8 +86,8 @@ | |||
86 | 86 | ||
87 | #ifdef CONFIG_QUOTA | 87 | #ifdef CONFIG_QUOTA |
88 | /* Amount of blocks needed for quota update - we know that the structure was | 88 | /* Amount of blocks needed for quota update - we know that the structure was |
89 | * allocated so we need to update only inode+data */ | 89 | * allocated so we need to update only data block */ |
90 | #define EXT4_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0) | 90 | #define EXT4_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 1 : 0) |
91 | /* Amount of blocks needed for quota insert/delete - we do some block writes | 91 | /* Amount of blocks needed for quota insert/delete - we do some block writes |
92 | * but inode, sb and group updates are done only once */ | 92 | * but inode, sb and group updates are done only once */ |
93 | #define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\ | 93 | #define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\ |
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index 4673bc05274f..e9473cbe80df 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c | |||
@@ -125,9 +125,11 @@ extern int ext4_flush_completed_IO(struct inode *inode) | |||
125 | * the parent directory's parent as well, and so on recursively, if | 125 | * the parent directory's parent as well, and so on recursively, if |
126 | * they are also freshly created. | 126 | * they are also freshly created. |
127 | */ | 127 | */ |
128 | static void ext4_sync_parent(struct inode *inode) | 128 | static int ext4_sync_parent(struct inode *inode) |
129 | { | 129 | { |
130 | struct writeback_control wbc; | ||
130 | struct dentry *dentry = NULL; | 131 | struct dentry *dentry = NULL; |
132 | int ret = 0; | ||
131 | 133 | ||
132 | while (inode && ext4_test_inode_state(inode, EXT4_STATE_NEWENTRY)) { | 134 | while (inode && ext4_test_inode_state(inode, EXT4_STATE_NEWENTRY)) { |
133 | ext4_clear_inode_state(inode, EXT4_STATE_NEWENTRY); | 135 | ext4_clear_inode_state(inode, EXT4_STATE_NEWENTRY); |
@@ -136,8 +138,17 @@ static void ext4_sync_parent(struct inode *inode) | |||
136 | if (!dentry || !dentry->d_parent || !dentry->d_parent->d_inode) | 138 | if (!dentry || !dentry->d_parent || !dentry->d_parent->d_inode) |
137 | break; | 139 | break; |
138 | inode = dentry->d_parent->d_inode; | 140 | inode = dentry->d_parent->d_inode; |
139 | sync_mapping_buffers(inode->i_mapping); | 141 | ret = sync_mapping_buffers(inode->i_mapping); |
142 | if (ret) | ||
143 | break; | ||
144 | memset(&wbc, 0, sizeof(wbc)); | ||
145 | wbc.sync_mode = WB_SYNC_ALL; | ||
146 | wbc.nr_to_write = 0; /* only write out the inode */ | ||
147 | ret = sync_inode(inode, &wbc); | ||
148 | if (ret) | ||
149 | break; | ||
140 | } | 150 | } |
151 | return ret; | ||
141 | } | 152 | } |
142 | 153 | ||
143 | /* | 154 | /* |
@@ -176,7 +187,7 @@ int ext4_sync_file(struct file *file, int datasync) | |||
176 | if (!journal) { | 187 | if (!journal) { |
177 | ret = generic_file_fsync(file, datasync); | 188 | ret = generic_file_fsync(file, datasync); |
178 | if (!ret && !list_empty(&inode->i_dentry)) | 189 | if (!ret && !list_empty(&inode->i_dentry)) |
179 | ext4_sync_parent(inode); | 190 | ret = ext4_sync_parent(inode); |
180 | goto out; | 191 | goto out; |
181 | } | 192 | } |
182 | 193 | ||
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index ad8e303c0d29..f2fa5e8a582c 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2502,6 +2502,7 @@ static int ext4_da_get_block_prep(struct inode *inode, sector_t iblock, | |||
2502 | * for partial write. | 2502 | * for partial write. |
2503 | */ | 2503 | */ |
2504 | set_buffer_new(bh); | 2504 | set_buffer_new(bh); |
2505 | set_buffer_mapped(bh); | ||
2505 | } | 2506 | } |
2506 | return 0; | 2507 | return 0; |
2507 | } | 2508 | } |
@@ -4429,8 +4430,8 @@ void ext4_truncate(struct inode *inode) | |||
4429 | Indirect chain[4]; | 4430 | Indirect chain[4]; |
4430 | Indirect *partial; | 4431 | Indirect *partial; |
4431 | __le32 nr = 0; | 4432 | __le32 nr = 0; |
4432 | int n; | 4433 | int n = 0; |
4433 | ext4_lblk_t last_block; | 4434 | ext4_lblk_t last_block, max_block; |
4434 | unsigned blocksize = inode->i_sb->s_blocksize; | 4435 | unsigned blocksize = inode->i_sb->s_blocksize; |
4435 | 4436 | ||
4436 | trace_ext4_truncate_enter(inode); | 4437 | trace_ext4_truncate_enter(inode); |
@@ -4455,14 +4456,18 @@ void ext4_truncate(struct inode *inode) | |||
4455 | 4456 | ||
4456 | last_block = (inode->i_size + blocksize-1) | 4457 | last_block = (inode->i_size + blocksize-1) |
4457 | >> EXT4_BLOCK_SIZE_BITS(inode->i_sb); | 4458 | >> EXT4_BLOCK_SIZE_BITS(inode->i_sb); |
4459 | max_block = (EXT4_SB(inode->i_sb)->s_bitmap_maxbytes + blocksize-1) | ||
4460 | >> EXT4_BLOCK_SIZE_BITS(inode->i_sb); | ||
4458 | 4461 | ||
4459 | if (inode->i_size & (blocksize - 1)) | 4462 | if (inode->i_size & (blocksize - 1)) |
4460 | if (ext4_block_truncate_page(handle, mapping, inode->i_size)) | 4463 | if (ext4_block_truncate_page(handle, mapping, inode->i_size)) |
4461 | goto out_stop; | 4464 | goto out_stop; |
4462 | 4465 | ||
4463 | n = ext4_block_to_path(inode, last_block, offsets, NULL); | 4466 | if (last_block != max_block) { |
4464 | if (n == 0) | 4467 | n = ext4_block_to_path(inode, last_block, offsets, NULL); |
4465 | goto out_stop; /* error */ | 4468 | if (n == 0) |
4469 | goto out_stop; /* error */ | ||
4470 | } | ||
4466 | 4471 | ||
4467 | /* | 4472 | /* |
4468 | * OK. This truncate is going to happen. We add the inode to the | 4473 | * OK. This truncate is going to happen. We add the inode to the |
@@ -4493,7 +4498,13 @@ void ext4_truncate(struct inode *inode) | |||
4493 | */ | 4498 | */ |
4494 | ei->i_disksize = inode->i_size; | 4499 | ei->i_disksize = inode->i_size; |
4495 | 4500 | ||
4496 | if (n == 1) { /* direct blocks */ | 4501 | if (last_block == max_block) { |
4502 | /* | ||
4503 | * It is unnecessary to free any data blocks if last_block is | ||
4504 | * equal to the indirect block limit. | ||
4505 | */ | ||
4506 | goto out_unlock; | ||
4507 | } else if (n == 1) { /* direct blocks */ | ||
4497 | ext4_free_data(handle, inode, NULL, i_data+offsets[0], | 4508 | ext4_free_data(handle, inode, NULL, i_data+offsets[0], |
4498 | i_data + EXT4_NDIR_BLOCKS); | 4509 | i_data + EXT4_NDIR_BLOCKS); |
4499 | goto do_indirects; | 4510 | goto do_indirects; |
@@ -4553,6 +4564,7 @@ do_indirects: | |||
4553 | ; | 4564 | ; |
4554 | } | 4565 | } |
4555 | 4566 | ||
4567 | out_unlock: | ||
4556 | up_write(&ei->i_data_sem); | 4568 | up_write(&ei->i_data_sem); |
4557 | inode->i_mtime = inode->i_ctime = ext4_current_time(inode); | 4569 | inode->i_mtime = inode->i_ctime = ext4_current_time(inode); |
4558 | ext4_mark_inode_dirty(handle, inode); | 4570 | ext4_mark_inode_dirty(handle, inode); |
@@ -5398,13 +5410,12 @@ static int ext4_indirect_trans_blocks(struct inode *inode, int nrblocks, | |||
5398 | /* if nrblocks are contiguous */ | 5410 | /* if nrblocks are contiguous */ |
5399 | if (chunk) { | 5411 | if (chunk) { |
5400 | /* | 5412 | /* |
5401 | * With N contiguous data blocks, it need at most | 5413 | * With N contiguous data blocks, we need at most |
5402 | * N/EXT4_ADDR_PER_BLOCK(inode->i_sb) indirect blocks | 5414 | * N/EXT4_ADDR_PER_BLOCK(inode->i_sb) + 1 indirect blocks, |
5403 | * 2 dindirect blocks | 5415 | * 2 dindirect blocks, and 1 tindirect block |
5404 | * 1 tindirect block | ||
5405 | */ | 5416 | */ |
5406 | indirects = nrblocks / EXT4_ADDR_PER_BLOCK(inode->i_sb); | 5417 | return DIV_ROUND_UP(nrblocks, |
5407 | return indirects + 3; | 5418 | EXT4_ADDR_PER_BLOCK(inode->i_sb)) + 4; |
5408 | } | 5419 | } |
5409 | /* | 5420 | /* |
5410 | * if nrblocks are not contiguous, worse case, each block touch | 5421 | * if nrblocks are not contiguous, worse case, each block touch |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 056474b7b8e0..8553dfb310af 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -242,27 +242,44 @@ static void ext4_put_nojournal(handle_t *handle) | |||
242 | * journal_end calls result in the superblock being marked dirty, so | 242 | * journal_end calls result in the superblock being marked dirty, so |
243 | * that sync() will call the filesystem's write_super callback if | 243 | * that sync() will call the filesystem's write_super callback if |
244 | * appropriate. | 244 | * appropriate. |
245 | * | ||
246 | * To avoid j_barrier hold in userspace when a user calls freeze(), | ||
247 | * ext4 prevents a new handle from being started by s_frozen, which | ||
248 | * is in an upper layer. | ||
245 | */ | 249 | */ |
246 | handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks) | 250 | handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks) |
247 | { | 251 | { |
248 | journal_t *journal; | 252 | journal_t *journal; |
253 | handle_t *handle; | ||
249 | 254 | ||
250 | if (sb->s_flags & MS_RDONLY) | 255 | if (sb->s_flags & MS_RDONLY) |
251 | return ERR_PTR(-EROFS); | 256 | return ERR_PTR(-EROFS); |
252 | 257 | ||
253 | vfs_check_frozen(sb, SB_FREEZE_TRANS); | ||
254 | /* Special case here: if the journal has aborted behind our | ||
255 | * backs (eg. EIO in the commit thread), then we still need to | ||
256 | * take the FS itself readonly cleanly. */ | ||
257 | journal = EXT4_SB(sb)->s_journal; | 258 | journal = EXT4_SB(sb)->s_journal; |
258 | if (journal) { | 259 | handle = ext4_journal_current_handle(); |
259 | if (is_journal_aborted(journal)) { | 260 | |
260 | ext4_abort(sb, "Detected aborted journal"); | 261 | /* |
261 | return ERR_PTR(-EROFS); | 262 | * If a handle has been started, it should be allowed to |
262 | } | 263 | * finish, otherwise deadlock could happen between freeze |
263 | return jbd2_journal_start(journal, nblocks); | 264 | * and others(e.g. truncate) due to the restart of the |
265 | * journal handle if the filesystem is forzen and active | ||
266 | * handles are not stopped. | ||
267 | */ | ||
268 | if (!handle) | ||
269 | vfs_check_frozen(sb, SB_FREEZE_TRANS); | ||
270 | |||
271 | if (!journal) | ||
272 | return ext4_get_nojournal(); | ||
273 | /* | ||
274 | * Special case here: if the journal has aborted behind our | ||
275 | * backs (eg. EIO in the commit thread), then we still need to | ||
276 | * take the FS itself readonly cleanly. | ||
277 | */ | ||
278 | if (is_journal_aborted(journal)) { | ||
279 | ext4_abort(sb, "Detected aborted journal"); | ||
280 | return ERR_PTR(-EROFS); | ||
264 | } | 281 | } |
265 | return ext4_get_nojournal(); | 282 | return jbd2_journal_start(journal, nblocks); |
266 | } | 283 | } |
267 | 284 | ||
268 | /* | 285 | /* |
@@ -2975,6 +2992,12 @@ static int ext4_register_li_request(struct super_block *sb, | |||
2975 | mutex_unlock(&ext4_li_info->li_list_mtx); | 2992 | mutex_unlock(&ext4_li_info->li_list_mtx); |
2976 | 2993 | ||
2977 | sbi->s_li_request = elr; | 2994 | sbi->s_li_request = elr; |
2995 | /* | ||
2996 | * set elr to NULL here since it has been inserted to | ||
2997 | * the request_list and the removal and free of it is | ||
2998 | * handled by ext4_clear_request_list from now on. | ||
2999 | */ | ||
3000 | elr = NULL; | ||
2978 | 3001 | ||
2979 | if (!(ext4_li_info->li_state & EXT4_LAZYINIT_RUNNING)) { | 3002 | if (!(ext4_li_info->li_state & EXT4_LAZYINIT_RUNNING)) { |
2980 | ret = ext4_run_lazyinit_thread(); | 3003 | ret = ext4_run_lazyinit_thread(); |
@@ -3385,6 +3408,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3385 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); | 3408 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); |
3386 | spin_lock_init(&sbi->s_next_gen_lock); | 3409 | spin_lock_init(&sbi->s_next_gen_lock); |
3387 | 3410 | ||
3411 | init_timer(&sbi->s_err_report); | ||
3412 | sbi->s_err_report.function = print_daily_error_info; | ||
3413 | sbi->s_err_report.data = (unsigned long) sb; | ||
3414 | |||
3388 | err = percpu_counter_init(&sbi->s_freeblocks_counter, | 3415 | err = percpu_counter_init(&sbi->s_freeblocks_counter, |
3389 | ext4_count_free_blocks(sb)); | 3416 | ext4_count_free_blocks(sb)); |
3390 | if (!err) { | 3417 | if (!err) { |
@@ -3646,9 +3673,6 @@ no_journal: | |||
3646 | "Opts: %s%s%s", descr, sbi->s_es->s_mount_opts, | 3673 | "Opts: %s%s%s", descr, sbi->s_es->s_mount_opts, |
3647 | *sbi->s_es->s_mount_opts ? "; " : "", orig_data); | 3674 | *sbi->s_es->s_mount_opts ? "; " : "", orig_data); |
3648 | 3675 | ||
3649 | init_timer(&sbi->s_err_report); | ||
3650 | sbi->s_err_report.function = print_daily_error_info; | ||
3651 | sbi->s_err_report.data = (unsigned long) sb; | ||
3652 | if (es->s_error_count) | 3676 | if (es->s_error_count) |
3653 | mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */ | 3677 | mod_timer(&sbi->s_err_report, jiffies + 300*HZ); /* 5 minutes */ |
3654 | 3678 | ||
@@ -3672,6 +3696,7 @@ failed_mount_wq: | |||
3672 | sbi->s_journal = NULL; | 3696 | sbi->s_journal = NULL; |
3673 | } | 3697 | } |
3674 | failed_mount3: | 3698 | failed_mount3: |
3699 | del_timer(&sbi->s_err_report); | ||
3675 | if (sbi->s_flex_groups) { | 3700 | if (sbi->s_flex_groups) { |
3676 | if (is_vmalloc_addr(sbi->s_flex_groups)) | 3701 | if (is_vmalloc_addr(sbi->s_flex_groups)) |
3677 | vfree(sbi->s_flex_groups); | 3702 | vfree(sbi->s_flex_groups); |
@@ -4138,6 +4163,11 @@ static int ext4_sync_fs(struct super_block *sb, int wait) | |||
4138 | /* | 4163 | /* |
4139 | * LVM calls this function before a (read-only) snapshot is created. This | 4164 | * LVM calls this function before a (read-only) snapshot is created. This |
4140 | * gives us a chance to flush the journal completely and mark the fs clean. | 4165 | * gives us a chance to flush the journal completely and mark the fs clean. |
4166 | * | ||
4167 | * Note that only this function cannot bring a filesystem to be in a clean | ||
4168 | * state independently, because ext4 prevents a new handle from being started | ||
4169 | * by @sb->s_frozen, which stays in an upper layer. It thus needs help from | ||
4170 | * the upper layer. | ||
4141 | */ | 4171 | */ |
4142 | static int ext4_freeze(struct super_block *sb) | 4172 | static int ext4_freeze(struct super_block *sb) |
4143 | { | 4173 | { |
@@ -4614,11 +4644,24 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, | |||
4614 | 4644 | ||
4615 | static int ext4_quota_off(struct super_block *sb, int type) | 4645 | static int ext4_quota_off(struct super_block *sb, int type) |
4616 | { | 4646 | { |
4647 | struct inode *inode = sb_dqopt(sb)->files[type]; | ||
4648 | handle_t *handle; | ||
4649 | |||
4617 | /* Force all delayed allocation blocks to be allocated. | 4650 | /* Force all delayed allocation blocks to be allocated. |
4618 | * Caller already holds s_umount sem */ | 4651 | * Caller already holds s_umount sem */ |
4619 | if (test_opt(sb, DELALLOC)) | 4652 | if (test_opt(sb, DELALLOC)) |
4620 | sync_filesystem(sb); | 4653 | sync_filesystem(sb); |
4621 | 4654 | ||
4655 | /* Update modification times of quota files when userspace can | ||
4656 | * start looking at them */ | ||
4657 | handle = ext4_journal_start(inode, 1); | ||
4658 | if (IS_ERR(handle)) | ||
4659 | goto out; | ||
4660 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
4661 | ext4_mark_inode_dirty(handle, inode); | ||
4662 | ext4_journal_stop(handle); | ||
4663 | |||
4664 | out: | ||
4622 | return dquot_quota_off(sb, type); | 4665 | return dquot_quota_off(sb, type); |
4623 | } | 4666 | } |
4624 | 4667 | ||
@@ -4714,9 +4757,8 @@ out: | |||
4714 | if (inode->i_size < off + len) { | 4757 | if (inode->i_size < off + len) { |
4715 | i_size_write(inode, off + len); | 4758 | i_size_write(inode, off + len); |
4716 | EXT4_I(inode)->i_disksize = inode->i_size; | 4759 | EXT4_I(inode)->i_disksize = inode->i_size; |
4760 | ext4_mark_inode_dirty(handle, inode); | ||
4717 | } | 4761 | } |
4718 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
4719 | ext4_mark_inode_dirty(handle, inode); | ||
4720 | mutex_unlock(&inode->i_mutex); | 4762 | mutex_unlock(&inode->i_mutex); |
4721 | return len; | 4763 | return len; |
4722 | } | 4764 | } |
diff --git a/fs/fhandle.c b/fs/fhandle.c index bf93ad2bee07..6b088641f5bf 100644 --- a/fs/fhandle.c +++ b/fs/fhandle.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/exportfs.h> | 7 | #include <linux/exportfs.h> |
8 | #include <linux/fs_struct.h> | 8 | #include <linux/fs_struct.h> |
9 | #include <linux/fsnotify.h> | 9 | #include <linux/fsnotify.h> |
10 | #include <linux/personality.h> | ||
10 | #include <asm/uaccess.h> | 11 | #include <asm/uaccess.h> |
11 | #include "internal.h" | 12 | #include "internal.h" |
12 | 13 | ||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
11 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
12 | #include <linux/mmzone.h> | ||
12 | #include <linux/time.h> | 13 | #include <linux/time.h> |
13 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
14 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
@@ -39,14 +40,17 @@ int sysctl_nr_open_max = 1024 * 1024; /* raised later */ | |||
39 | */ | 40 | */ |
40 | static DEFINE_PER_CPU(struct fdtable_defer, fdtable_defer_list); | 41 | static DEFINE_PER_CPU(struct fdtable_defer, fdtable_defer_list); |
41 | 42 | ||
42 | static inline void *alloc_fdmem(unsigned int size) | 43 | static void *alloc_fdmem(unsigned int size) |
43 | { | 44 | { |
44 | void *data; | 45 | /* |
45 | 46 | * Very large allocations can stress page reclaim, so fall back to | |
46 | data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN); | 47 | * vmalloc() if the allocation size will be considered "large" by the VM. |
47 | if (data != NULL) | 48 | */ |
48 | return data; | 49 | if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) { |
49 | 50 | void *data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN); | |
51 | if (data != NULL) | ||
52 | return data; | ||
53 | } | ||
50 | return vmalloc(size); | 54 | return vmalloc(size); |
51 | } | 55 | } |
52 | 56 | ||
diff --git a/fs/filesystems.c b/fs/filesystems.c index 751d6b255a12..0845f84f2a5f 100644 --- a/fs/filesystems.c +++ b/fs/filesystems.c | |||
@@ -110,14 +110,13 @@ int unregister_filesystem(struct file_system_type * fs) | |||
110 | *tmp = fs->next; | 110 | *tmp = fs->next; |
111 | fs->next = NULL; | 111 | fs->next = NULL; |
112 | write_unlock(&file_systems_lock); | 112 | write_unlock(&file_systems_lock); |
113 | synchronize_rcu(); | ||
113 | return 0; | 114 | return 0; |
114 | } | 115 | } |
115 | tmp = &(*tmp)->next; | 116 | tmp = &(*tmp)->next; |
116 | } | 117 | } |
117 | write_unlock(&file_systems_lock); | 118 | write_unlock(&file_systems_lock); |
118 | 119 | ||
119 | synchronize_rcu(); | ||
120 | |||
121 | return -EINVAL; | 120 | return -EINVAL; |
122 | } | 121 | } |
123 | 122 | ||
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index c71995b111bf..0f5c4f9d5d62 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c | |||
@@ -884,8 +884,8 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping, | |||
884 | } | 884 | } |
885 | 885 | ||
886 | brelse(dibh); | 886 | brelse(dibh); |
887 | gfs2_trans_end(sdp); | ||
888 | failed: | 887 | failed: |
888 | gfs2_trans_end(sdp); | ||
889 | if (al) { | 889 | if (al) { |
890 | gfs2_inplace_release(ip); | 890 | gfs2_inplace_release(ip); |
891 | gfs2_quota_unlock(ip); | 891 | gfs2_quota_unlock(ip); |
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 5c356d09c321..f789c5732b7c 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -1506,7 +1506,7 @@ struct inode *gfs2_dir_search(struct inode *dir, const struct qstr *name) | |||
1506 | inode = gfs2_inode_lookup(dir->i_sb, | 1506 | inode = gfs2_inode_lookup(dir->i_sb, |
1507 | be16_to_cpu(dent->de_type), | 1507 | be16_to_cpu(dent->de_type), |
1508 | be64_to_cpu(dent->de_inum.no_addr), | 1508 | be64_to_cpu(dent->de_inum.no_addr), |
1509 | be64_to_cpu(dent->de_inum.no_formal_ino)); | 1509 | be64_to_cpu(dent->de_inum.no_formal_ino), 0); |
1510 | brelse(bh); | 1510 | brelse(bh); |
1511 | return inode; | 1511 | return inode; |
1512 | } | 1512 | } |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index b2682e073eee..e48310885c48 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -617,18 +617,51 @@ static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
617 | return generic_file_aio_write(iocb, iov, nr_segs, pos); | 617 | return generic_file_aio_write(iocb, iov, nr_segs, pos); |
618 | } | 618 | } |
619 | 619 | ||
620 | static void empty_write_end(struct page *page, unsigned from, | 620 | static int empty_write_end(struct page *page, unsigned from, |
621 | unsigned to) | 621 | unsigned to, int mode) |
622 | { | 622 | { |
623 | struct gfs2_inode *ip = GFS2_I(page->mapping->host); | 623 | struct inode *inode = page->mapping->host; |
624 | struct gfs2_inode *ip = GFS2_I(inode); | ||
625 | struct buffer_head *bh; | ||
626 | unsigned offset, blksize = 1 << inode->i_blkbits; | ||
627 | pgoff_t end_index = i_size_read(inode) >> PAGE_CACHE_SHIFT; | ||
624 | 628 | ||
625 | zero_user(page, from, to-from); | 629 | zero_user(page, from, to-from); |
626 | mark_page_accessed(page); | 630 | mark_page_accessed(page); |
627 | 631 | ||
628 | if (!gfs2_is_writeback(ip)) | 632 | if (page->index < end_index || !(mode & FALLOC_FL_KEEP_SIZE)) { |
629 | gfs2_page_add_databufs(ip, page, from, to); | 633 | if (!gfs2_is_writeback(ip)) |
634 | gfs2_page_add_databufs(ip, page, from, to); | ||
635 | |||
636 | block_commit_write(page, from, to); | ||
637 | return 0; | ||
638 | } | ||
639 | |||
640 | offset = 0; | ||
641 | bh = page_buffers(page); | ||
642 | while (offset < to) { | ||
643 | if (offset >= from) { | ||
644 | set_buffer_uptodate(bh); | ||
645 | mark_buffer_dirty(bh); | ||
646 | clear_buffer_new(bh); | ||
647 | write_dirty_buffer(bh, WRITE); | ||
648 | } | ||
649 | offset += blksize; | ||
650 | bh = bh->b_this_page; | ||
651 | } | ||
630 | 652 | ||
631 | block_commit_write(page, from, to); | 653 | offset = 0; |
654 | bh = page_buffers(page); | ||
655 | while (offset < to) { | ||
656 | if (offset >= from) { | ||
657 | wait_on_buffer(bh); | ||
658 | if (!buffer_uptodate(bh)) | ||
659 | return -EIO; | ||
660 | } | ||
661 | offset += blksize; | ||
662 | bh = bh->b_this_page; | ||
663 | } | ||
664 | return 0; | ||
632 | } | 665 | } |
633 | 666 | ||
634 | static int needs_empty_write(sector_t block, struct inode *inode) | 667 | static int needs_empty_write(sector_t block, struct inode *inode) |
@@ -643,7 +676,8 @@ static int needs_empty_write(sector_t block, struct inode *inode) | |||
643 | return !buffer_mapped(&bh_map); | 676 | return !buffer_mapped(&bh_map); |
644 | } | 677 | } |
645 | 678 | ||
646 | static int write_empty_blocks(struct page *page, unsigned from, unsigned to) | 679 | static int write_empty_blocks(struct page *page, unsigned from, unsigned to, |
680 | int mode) | ||
647 | { | 681 | { |
648 | struct inode *inode = page->mapping->host; | 682 | struct inode *inode = page->mapping->host; |
649 | unsigned start, end, next, blksize; | 683 | unsigned start, end, next, blksize; |
@@ -668,7 +702,9 @@ static int write_empty_blocks(struct page *page, unsigned from, unsigned to) | |||
668 | gfs2_block_map); | 702 | gfs2_block_map); |
669 | if (unlikely(ret)) | 703 | if (unlikely(ret)) |
670 | return ret; | 704 | return ret; |
671 | empty_write_end(page, start, end); | 705 | ret = empty_write_end(page, start, end, mode); |
706 | if (unlikely(ret)) | ||
707 | return ret; | ||
672 | end = 0; | 708 | end = 0; |
673 | } | 709 | } |
674 | start = next; | 710 | start = next; |
@@ -682,7 +718,9 @@ static int write_empty_blocks(struct page *page, unsigned from, unsigned to) | |||
682 | ret = __block_write_begin(page, start, end - start, gfs2_block_map); | 718 | ret = __block_write_begin(page, start, end - start, gfs2_block_map); |
683 | if (unlikely(ret)) | 719 | if (unlikely(ret)) |
684 | return ret; | 720 | return ret; |
685 | empty_write_end(page, start, end); | 721 | ret = empty_write_end(page, start, end, mode); |
722 | if (unlikely(ret)) | ||
723 | return ret; | ||
686 | } | 724 | } |
687 | 725 | ||
688 | return 0; | 726 | return 0; |
@@ -731,7 +769,7 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len, | |||
731 | 769 | ||
732 | if (curr == end) | 770 | if (curr == end) |
733 | to = end_offset; | 771 | to = end_offset; |
734 | error = write_empty_blocks(page, from, to); | 772 | error = write_empty_blocks(page, from, to, mode); |
735 | if (!error && offset + to > inode->i_size && | 773 | if (!error && offset + to > inode->i_size && |
736 | !(mode & FALLOC_FL_KEEP_SIZE)) { | 774 | !(mode & FALLOC_FL_KEEP_SIZE)) { |
737 | i_size_write(inode, offset + to); | 775 | i_size_write(inode, offset + to); |
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index f07643e21bfa..7a4fb630a320 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -93,14 +93,12 @@ static unsigned int gl_hash(const struct gfs2_sbd *sdp, | |||
93 | 93 | ||
94 | static inline void spin_lock_bucket(unsigned int hash) | 94 | static inline void spin_lock_bucket(unsigned int hash) |
95 | { | 95 | { |
96 | struct hlist_bl_head *bl = &gl_hash_table[hash]; | 96 | hlist_bl_lock(&gl_hash_table[hash]); |
97 | bit_spin_lock(0, (unsigned long *)bl); | ||
98 | } | 97 | } |
99 | 98 | ||
100 | static inline void spin_unlock_bucket(unsigned int hash) | 99 | static inline void spin_unlock_bucket(unsigned int hash) |
101 | { | 100 | { |
102 | struct hlist_bl_head *bl = &gl_hash_table[hash]; | 101 | hlist_bl_unlock(&gl_hash_table[hash]); |
103 | __bit_spin_unlock(0, (unsigned long *)bl); | ||
104 | } | 102 | } |
105 | 103 | ||
106 | static void gfs2_glock_dealloc(struct rcu_head *rcu) | 104 | static void gfs2_glock_dealloc(struct rcu_head *rcu) |
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 3754e3cbf02b..25eeb2bcee47 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
@@ -385,6 +385,10 @@ static int trans_go_demote_ok(const struct gfs2_glock *gl) | |||
385 | static void iopen_go_callback(struct gfs2_glock *gl) | 385 | static void iopen_go_callback(struct gfs2_glock *gl) |
386 | { | 386 | { |
387 | struct gfs2_inode *ip = (struct gfs2_inode *)gl->gl_object; | 387 | struct gfs2_inode *ip = (struct gfs2_inode *)gl->gl_object; |
388 | struct gfs2_sbd *sdp = gl->gl_sbd; | ||
389 | |||
390 | if (sdp->sd_vfs->s_flags & MS_RDONLY) | ||
391 | return; | ||
388 | 392 | ||
389 | if (gl->gl_demote_state == LM_ST_UNLOCKED && | 393 | if (gl->gl_demote_state == LM_ST_UNLOCKED && |
390 | gl->gl_state == LM_ST_SHARED && ip) { | 394 | gl->gl_state == LM_ST_SHARED && ip) { |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 97d54a28776a..9134dcb89479 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -40,37 +40,61 @@ struct gfs2_inum_range_host { | |||
40 | u64 ir_length; | 40 | u64 ir_length; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | struct gfs2_skip_data { | ||
44 | u64 no_addr; | ||
45 | int skipped; | ||
46 | int non_block; | ||
47 | }; | ||
48 | |||
43 | static int iget_test(struct inode *inode, void *opaque) | 49 | static int iget_test(struct inode *inode, void *opaque) |
44 | { | 50 | { |
45 | struct gfs2_inode *ip = GFS2_I(inode); | 51 | struct gfs2_inode *ip = GFS2_I(inode); |
46 | u64 *no_addr = opaque; | 52 | struct gfs2_skip_data *data = opaque; |
47 | 53 | ||
48 | if (ip->i_no_addr == *no_addr) | 54 | if (ip->i_no_addr == data->no_addr) { |
55 | if (data->non_block && | ||
56 | inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) { | ||
57 | data->skipped = 1; | ||
58 | return 0; | ||
59 | } | ||
49 | return 1; | 60 | return 1; |
50 | 61 | } | |
51 | return 0; | 62 | return 0; |
52 | } | 63 | } |
53 | 64 | ||
54 | static int iget_set(struct inode *inode, void *opaque) | 65 | static int iget_set(struct inode *inode, void *opaque) |
55 | { | 66 | { |
56 | struct gfs2_inode *ip = GFS2_I(inode); | 67 | struct gfs2_inode *ip = GFS2_I(inode); |
57 | u64 *no_addr = opaque; | 68 | struct gfs2_skip_data *data = opaque; |
58 | 69 | ||
59 | inode->i_ino = (unsigned long)*no_addr; | 70 | if (data->skipped) |
60 | ip->i_no_addr = *no_addr; | 71 | return -ENOENT; |
72 | inode->i_ino = (unsigned long)(data->no_addr); | ||
73 | ip->i_no_addr = data->no_addr; | ||
61 | return 0; | 74 | return 0; |
62 | } | 75 | } |
63 | 76 | ||
64 | struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr) | 77 | struct inode *gfs2_ilookup(struct super_block *sb, u64 no_addr) |
65 | { | 78 | { |
66 | unsigned long hash = (unsigned long)no_addr; | 79 | unsigned long hash = (unsigned long)no_addr; |
67 | return ilookup5(sb, hash, iget_test, &no_addr); | 80 | struct gfs2_skip_data data; |
81 | |||
82 | data.no_addr = no_addr; | ||
83 | data.skipped = 0; | ||
84 | data.non_block = 0; | ||
85 | return ilookup5(sb, hash, iget_test, &data); | ||
68 | } | 86 | } |
69 | 87 | ||
70 | static struct inode *gfs2_iget(struct super_block *sb, u64 no_addr) | 88 | static struct inode *gfs2_iget(struct super_block *sb, u64 no_addr, |
89 | int non_block) | ||
71 | { | 90 | { |
91 | struct gfs2_skip_data data; | ||
72 | unsigned long hash = (unsigned long)no_addr; | 92 | unsigned long hash = (unsigned long)no_addr; |
73 | return iget5_locked(sb, hash, iget_test, iget_set, &no_addr); | 93 | |
94 | data.no_addr = no_addr; | ||
95 | data.skipped = 0; | ||
96 | data.non_block = non_block; | ||
97 | return iget5_locked(sb, hash, iget_test, iget_set, &data); | ||
74 | } | 98 | } |
75 | 99 | ||
76 | /** | 100 | /** |
@@ -111,19 +135,20 @@ static void gfs2_set_iop(struct inode *inode) | |||
111 | * @sb: The super block | 135 | * @sb: The super block |
112 | * @no_addr: The inode number | 136 | * @no_addr: The inode number |
113 | * @type: The type of the inode | 137 | * @type: The type of the inode |
138 | * non_block: Can we block on inodes that are being freed? | ||
114 | * | 139 | * |
115 | * Returns: A VFS inode, or an error | 140 | * Returns: A VFS inode, or an error |
116 | */ | 141 | */ |
117 | 142 | ||
118 | struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type, | 143 | struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type, |
119 | u64 no_addr, u64 no_formal_ino) | 144 | u64 no_addr, u64 no_formal_ino, int non_block) |
120 | { | 145 | { |
121 | struct inode *inode; | 146 | struct inode *inode; |
122 | struct gfs2_inode *ip; | 147 | struct gfs2_inode *ip; |
123 | struct gfs2_glock *io_gl = NULL; | 148 | struct gfs2_glock *io_gl = NULL; |
124 | int error; | 149 | int error; |
125 | 150 | ||
126 | inode = gfs2_iget(sb, no_addr); | 151 | inode = gfs2_iget(sb, no_addr, non_block); |
127 | ip = GFS2_I(inode); | 152 | ip = GFS2_I(inode); |
128 | 153 | ||
129 | if (!inode) | 154 | if (!inode) |
@@ -185,11 +210,12 @@ struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr, | |||
185 | { | 210 | { |
186 | struct super_block *sb = sdp->sd_vfs; | 211 | struct super_block *sb = sdp->sd_vfs; |
187 | struct gfs2_holder i_gh; | 212 | struct gfs2_holder i_gh; |
188 | struct inode *inode; | 213 | struct inode *inode = NULL; |
189 | int error; | 214 | int error; |
190 | 215 | ||
216 | /* Must not read in block until block type is verified */ | ||
191 | error = gfs2_glock_nq_num(sdp, no_addr, &gfs2_inode_glops, | 217 | error = gfs2_glock_nq_num(sdp, no_addr, &gfs2_inode_glops, |
192 | LM_ST_SHARED, LM_FLAG_ANY, &i_gh); | 218 | LM_ST_EXCLUSIVE, GL_SKIP, &i_gh); |
193 | if (error) | 219 | if (error) |
194 | return ERR_PTR(error); | 220 | return ERR_PTR(error); |
195 | 221 | ||
@@ -197,7 +223,7 @@ struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr, | |||
197 | if (error) | 223 | if (error) |
198 | goto fail; | 224 | goto fail; |
199 | 225 | ||
200 | inode = gfs2_inode_lookup(sb, DT_UNKNOWN, no_addr, 0); | 226 | inode = gfs2_inode_lookup(sb, DT_UNKNOWN, no_addr, 0, 1); |
201 | if (IS_ERR(inode)) | 227 | if (IS_ERR(inode)) |
202 | goto fail; | 228 | goto fail; |
203 | 229 | ||
@@ -843,7 +869,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | |||
843 | goto fail_gunlock2; | 869 | goto fail_gunlock2; |
844 | 870 | ||
845 | inode = gfs2_inode_lookup(dir->i_sb, IF2DT(mode), inum.no_addr, | 871 | inode = gfs2_inode_lookup(dir->i_sb, IF2DT(mode), inum.no_addr, |
846 | inum.no_formal_ino); | 872 | inum.no_formal_ino, 0); |
847 | if (IS_ERR(inode)) | 873 | if (IS_ERR(inode)) |
848 | goto fail_gunlock2; | 874 | goto fail_gunlock2; |
849 | 875 | ||
diff --git a/fs/gfs2/inode.h b/fs/gfs2/inode.h index 3e00a66e7cbd..099ca305e518 100644 --- a/fs/gfs2/inode.h +++ b/fs/gfs2/inode.h | |||
@@ -97,7 +97,8 @@ err: | |||
97 | } | 97 | } |
98 | 98 | ||
99 | extern struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type, | 99 | extern struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type, |
100 | u64 no_addr, u64 no_formal_ino); | 100 | u64 no_addr, u64 no_formal_ino, |
101 | int non_block); | ||
101 | extern struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr, | 102 | extern struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr, |
102 | u64 *no_formal_ino, | 103 | u64 *no_formal_ino, |
103 | unsigned int blktype); | 104 | unsigned int blktype); |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 42ef24355afb..d3c69eb91c74 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -430,7 +430,7 @@ static int gfs2_lookup_root(struct super_block *sb, struct dentry **dptr, | |||
430 | struct dentry *dentry; | 430 | struct dentry *dentry; |
431 | struct inode *inode; | 431 | struct inode *inode; |
432 | 432 | ||
433 | inode = gfs2_inode_lookup(sb, DT_DIR, no_addr, 0); | 433 | inode = gfs2_inode_lookup(sb, DT_DIR, no_addr, 0, 0); |
434 | if (IS_ERR(inode)) { | 434 | if (IS_ERR(inode)) { |
435 | fs_err(sdp, "can't read in %s inode: %ld\n", name, PTR_ERR(inode)); | 435 | fs_err(sdp, "can't read in %s inode: %ld\n", name, PTR_ERR(inode)); |
436 | return PTR_ERR(inode); | 436 | return PTR_ERR(inode); |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index cf930cd9664a..6fcae8469f6d 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -945,7 +945,7 @@ static void try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, u64 skip | |||
945 | /* rgblk_search can return a block < goal, so we need to | 945 | /* rgblk_search can return a block < goal, so we need to |
946 | keep it marching forward. */ | 946 | keep it marching forward. */ |
947 | no_addr = block + rgd->rd_data0; | 947 | no_addr = block + rgd->rd_data0; |
948 | goal++; | 948 | goal = max(block + 1, goal + 1); |
949 | if (*last_unlinked != NO_BLOCK && no_addr <= *last_unlinked) | 949 | if (*last_unlinked != NO_BLOCK && no_addr <= *last_unlinked) |
950 | continue; | 950 | continue; |
951 | if (no_addr == skip) | 951 | if (no_addr == skip) |
@@ -971,7 +971,7 @@ static void try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, u64 skip | |||
971 | found++; | 971 | found++; |
972 | 972 | ||
973 | /* Limit reclaim to sensible number of tasks */ | 973 | /* Limit reclaim to sensible number of tasks */ |
974 | if (found > 2*NR_CPUS) | 974 | if (found > NR_CPUS) |
975 | return; | 975 | return; |
976 | } | 976 | } |
977 | 977 | ||
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index a4e23d68a398..b9f28e66dad1 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -1318,15 +1318,17 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt) | |||
1318 | 1318 | ||
1319 | static void gfs2_evict_inode(struct inode *inode) | 1319 | static void gfs2_evict_inode(struct inode *inode) |
1320 | { | 1320 | { |
1321 | struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; | 1321 | struct super_block *sb = inode->i_sb; |
1322 | struct gfs2_sbd *sdp = sb->s_fs_info; | ||
1322 | struct gfs2_inode *ip = GFS2_I(inode); | 1323 | struct gfs2_inode *ip = GFS2_I(inode); |
1323 | struct gfs2_holder gh; | 1324 | struct gfs2_holder gh; |
1324 | int error; | 1325 | int error; |
1325 | 1326 | ||
1326 | if (inode->i_nlink) | 1327 | if (inode->i_nlink || (sb->s_flags & MS_RDONLY)) |
1327 | goto out; | 1328 | goto out; |
1328 | 1329 | ||
1329 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 1330 | /* Must not read inode block until block type has been verified */ |
1331 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, &gh); | ||
1330 | if (unlikely(error)) { | 1332 | if (unlikely(error)) { |
1331 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); | 1333 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); |
1332 | goto out; | 1334 | goto out; |
@@ -1336,6 +1338,12 @@ static void gfs2_evict_inode(struct inode *inode) | |||
1336 | if (error) | 1338 | if (error) |
1337 | goto out_truncate; | 1339 | goto out_truncate; |
1338 | 1340 | ||
1341 | if (test_bit(GIF_INVALID, &ip->i_flags)) { | ||
1342 | error = gfs2_inode_refresh(ip); | ||
1343 | if (error) | ||
1344 | goto out_truncate; | ||
1345 | } | ||
1346 | |||
1339 | ip->i_iopen_gh.gh_flags |= GL_NOCACHE; | 1347 | ip->i_iopen_gh.gh_flags |= GL_NOCACHE; |
1340 | gfs2_glock_dq_wait(&ip->i_iopen_gh); | 1348 | gfs2_glock_dq_wait(&ip->i_iopen_gh); |
1341 | gfs2_holder_reinit(LM_ST_EXCLUSIVE, LM_FLAG_TRY_1CB | GL_NOCACHE, &ip->i_iopen_gh); | 1349 | gfs2_holder_reinit(LM_ST_EXCLUSIVE, LM_FLAG_TRY_1CB | GL_NOCACHE, &ip->i_iopen_gh); |
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 20af62f4304b..6e28000a4b21 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -105,6 +105,8 @@ static int journal_submit_commit_record(journal_t *journal, | |||
105 | int ret; | 105 | int ret; |
106 | struct timespec now = current_kernel_time(); | 106 | struct timespec now = current_kernel_time(); |
107 | 107 | ||
108 | *cbh = NULL; | ||
109 | |||
108 | if (is_journal_aborted(journal)) | 110 | if (is_journal_aborted(journal)) |
109 | return 0; | 111 | return 0; |
110 | 112 | ||
@@ -806,7 +808,7 @@ wait_for_iobuf: | |||
806 | if (err) | 808 | if (err) |
807 | __jbd2_journal_abort_hard(journal); | 809 | __jbd2_journal_abort_hard(journal); |
808 | } | 810 | } |
809 | if (!err && !is_journal_aborted(journal)) | 811 | if (cbh) |
810 | err = journal_wait_on_commit_record(journal, cbh); | 812 | err = journal_wait_on_commit_record(journal, cbh); |
811 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | 813 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, |
812 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && | 814 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && |
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index aba8ebaec25c..e0ec3db1c395 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -2413,10 +2413,12 @@ const char *jbd2_dev_to_name(dev_t device) | |||
2413 | new_dev = kmalloc(sizeof(struct devname_cache), GFP_KERNEL); | 2413 | new_dev = kmalloc(sizeof(struct devname_cache), GFP_KERNEL); |
2414 | if (!new_dev) | 2414 | if (!new_dev) |
2415 | return "NODEV-ALLOCFAILURE"; /* Something non-NULL */ | 2415 | return "NODEV-ALLOCFAILURE"; /* Something non-NULL */ |
2416 | bd = bdget(device); | ||
2416 | spin_lock(&devname_cache_lock); | 2417 | spin_lock(&devname_cache_lock); |
2417 | if (devcache[i]) { | 2418 | if (devcache[i]) { |
2418 | if (devcache[i]->device == device) { | 2419 | if (devcache[i]->device == device) { |
2419 | kfree(new_dev); | 2420 | kfree(new_dev); |
2421 | bdput(bd); | ||
2420 | ret = devcache[i]->devname; | 2422 | ret = devcache[i]->devname; |
2421 | spin_unlock(&devname_cache_lock); | 2423 | spin_unlock(&devname_cache_lock); |
2422 | return ret; | 2424 | return ret; |
@@ -2425,7 +2427,6 @@ const char *jbd2_dev_to_name(dev_t device) | |||
2425 | } | 2427 | } |
2426 | devcache[i] = new_dev; | 2428 | devcache[i] = new_dev; |
2427 | devcache[i]->device = device; | 2429 | devcache[i]->device = device; |
2428 | bd = bdget(device); | ||
2429 | if (bd) { | 2430 | if (bd) { |
2430 | bdevname(bd, devcache[i]->devname); | 2431 | bdevname(bd, devcache[i]->devname); |
2431 | bdput(bd); | 2432 | bdput(bd); |
diff --git a/fs/namei.c b/fs/namei.c index e6cd6113872c..54fc993e3027 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -697,6 +697,7 @@ static __always_inline void set_root_rcu(struct nameidata *nd) | |||
697 | do { | 697 | do { |
698 | seq = read_seqcount_begin(&fs->seq); | 698 | seq = read_seqcount_begin(&fs->seq); |
699 | nd->root = fs->root; | 699 | nd->root = fs->root; |
700 | nd->seq = __read_seqcount_begin(&nd->root.dentry->d_seq); | ||
700 | } while (read_seqcount_retry(&fs->seq, seq)); | 701 | } while (read_seqcount_retry(&fs->seq, seq)); |
701 | } | 702 | } |
702 | } | 703 | } |
diff --git a/fs/namespace.c b/fs/namespace.c index 7dba2ed03429..d99bcf59e4c2 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -1030,18 +1030,6 @@ const struct seq_operations mounts_op = { | |||
1030 | .show = show_vfsmnt | 1030 | .show = show_vfsmnt |
1031 | }; | 1031 | }; |
1032 | 1032 | ||
1033 | static int uuid_is_nil(u8 *uuid) | ||
1034 | { | ||
1035 | int i; | ||
1036 | u8 *cp = (u8 *)uuid; | ||
1037 | |||
1038 | for (i = 0; i < 16; i++) { | ||
1039 | if (*cp++) | ||
1040 | return 0; | ||
1041 | } | ||
1042 | return 1; | ||
1043 | } | ||
1044 | |||
1045 | static int show_mountinfo(struct seq_file *m, void *v) | 1033 | static int show_mountinfo(struct seq_file *m, void *v) |
1046 | { | 1034 | { |
1047 | struct proc_mounts *p = m->private; | 1035 | struct proc_mounts *p = m->private; |
@@ -1085,10 +1073,6 @@ static int show_mountinfo(struct seq_file *m, void *v) | |||
1085 | if (IS_MNT_UNBINDABLE(mnt)) | 1073 | if (IS_MNT_UNBINDABLE(mnt)) |
1086 | seq_puts(m, " unbindable"); | 1074 | seq_puts(m, " unbindable"); |
1087 | 1075 | ||
1088 | if (!uuid_is_nil(mnt->mnt_sb->s_uuid)) | ||
1089 | /* print the uuid */ | ||
1090 | seq_printf(m, " uuid:%pU", mnt->mnt_sb->s_uuid); | ||
1091 | |||
1092 | /* Filesystem specific data */ | 1076 | /* Filesystem specific data */ |
1093 | seq_puts(m, " - "); | 1077 | seq_puts(m, " - "); |
1094 | show_type(m, sb); | 1078 | show_type(m, sb); |
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 89fc160fd5b0..1f063bacd285 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
@@ -119,7 +119,7 @@ Elong: | |||
119 | } | 119 | } |
120 | 120 | ||
121 | #ifdef CONFIG_NFS_V4 | 121 | #ifdef CONFIG_NFS_V4 |
122 | static rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *flavors, struct inode *inode) | 122 | static rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *flavors) |
123 | { | 123 | { |
124 | struct gss_api_mech *mech; | 124 | struct gss_api_mech *mech; |
125 | struct xdr_netobj oid; | 125 | struct xdr_netobj oid; |
@@ -166,7 +166,7 @@ static int nfs_negotiate_security(const struct dentry *parent, | |||
166 | } | 166 | } |
167 | flavors = page_address(page); | 167 | flavors = page_address(page); |
168 | ret = secinfo(parent->d_inode, &dentry->d_name, flavors); | 168 | ret = secinfo(parent->d_inode, &dentry->d_name, flavors); |
169 | *flavor = nfs_find_best_sec(flavors, dentry->d_inode); | 169 | *flavor = nfs_find_best_sec(flavors); |
170 | put_page(page); | 170 | put_page(page); |
171 | } | 171 | } |
172 | 172 | ||
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index e1c261ddd65d..c4a69833dd0d 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -47,6 +47,7 @@ enum nfs4_client_state { | |||
47 | NFS4CLNT_LAYOUTRECALL, | 47 | NFS4CLNT_LAYOUTRECALL, |
48 | NFS4CLNT_SESSION_RESET, | 48 | NFS4CLNT_SESSION_RESET, |
49 | NFS4CLNT_RECALL_SLOT, | 49 | NFS4CLNT_RECALL_SLOT, |
50 | NFS4CLNT_LEASE_CONFIRM, | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | enum nfs4_session_state { | 53 | enum nfs4_session_state { |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 9bf41eab3e46..69c0f3c5ee7a 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/nfs4.h> | 46 | #include <linux/nfs4.h> |
47 | #include <linux/nfs_fs.h> | 47 | #include <linux/nfs_fs.h> |
48 | #include <linux/nfs_page.h> | 48 | #include <linux/nfs_page.h> |
49 | #include <linux/nfs_mount.h> | ||
49 | #include <linux/namei.h> | 50 | #include <linux/namei.h> |
50 | #include <linux/mount.h> | 51 | #include <linux/mount.h> |
51 | #include <linux/module.h> | 52 | #include <linux/module.h> |
@@ -443,8 +444,8 @@ static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res * | |||
443 | if (res->sr_status == 1) | 444 | if (res->sr_status == 1) |
444 | res->sr_status = NFS_OK; | 445 | res->sr_status = NFS_OK; |
445 | 446 | ||
446 | /* -ERESTARTSYS can result in skipping nfs41_sequence_setup */ | 447 | /* don't increment the sequence number if the task wasn't sent */ |
447 | if (!res->sr_slot) | 448 | if (!RPC_WAS_SENT(task)) |
448 | goto out; | 449 | goto out; |
449 | 450 | ||
450 | /* Check the SEQUENCE operation status */ | 451 | /* Check the SEQUENCE operation status */ |
@@ -2185,9 +2186,14 @@ static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, | |||
2185 | struct nfs4_exception exception = { }; | 2186 | struct nfs4_exception exception = { }; |
2186 | int err; | 2187 | int err; |
2187 | do { | 2188 | do { |
2188 | err = nfs4_handle_exception(server, | 2189 | err = _nfs4_lookup_root(server, fhandle, info); |
2189 | _nfs4_lookup_root(server, fhandle, info), | 2190 | switch (err) { |
2190 | &exception); | 2191 | case 0: |
2192 | case -NFS4ERR_WRONGSEC: | ||
2193 | break; | ||
2194 | default: | ||
2195 | err = nfs4_handle_exception(server, err, &exception); | ||
2196 | } | ||
2191 | } while (exception.retry); | 2197 | } while (exception.retry); |
2192 | return err; | 2198 | return err; |
2193 | } | 2199 | } |
@@ -2208,25 +2214,47 @@ out: | |||
2208 | return ret; | 2214 | return ret; |
2209 | } | 2215 | } |
2210 | 2216 | ||
2211 | /* | 2217 | static int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle, |
2212 | * get the file handle for the "/" directory on the server | ||
2213 | */ | ||
2214 | static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, | ||
2215 | struct nfs_fsinfo *info) | 2218 | struct nfs_fsinfo *info) |
2216 | { | 2219 | { |
2217 | int i, len, status = 0; | 2220 | int i, len, status = 0; |
2218 | rpc_authflavor_t flav_array[NFS_MAX_SECFLAVORS + 2]; | 2221 | rpc_authflavor_t flav_array[NFS_MAX_SECFLAVORS]; |
2219 | 2222 | ||
2220 | flav_array[0] = RPC_AUTH_UNIX; | 2223 | len = gss_mech_list_pseudoflavors(&flav_array[0]); |
2221 | len = gss_mech_list_pseudoflavors(&flav_array[1]); | 2224 | flav_array[len] = RPC_AUTH_NULL; |
2222 | flav_array[1+len] = RPC_AUTH_NULL; | 2225 | len += 1; |
2223 | len += 2; | ||
2224 | 2226 | ||
2225 | for (i = 0; i < len; i++) { | 2227 | for (i = 0; i < len; i++) { |
2226 | status = nfs4_lookup_root_sec(server, fhandle, info, flav_array[i]); | 2228 | status = nfs4_lookup_root_sec(server, fhandle, info, flav_array[i]); |
2227 | if (status != -EPERM) | 2229 | if (status == -NFS4ERR_WRONGSEC || status == -EACCES) |
2228 | break; | 2230 | continue; |
2231 | break; | ||
2229 | } | 2232 | } |
2233 | /* | ||
2234 | * -EACCESS could mean that the user doesn't have correct permissions | ||
2235 | * to access the mount. It could also mean that we tried to mount | ||
2236 | * with a gss auth flavor, but rpc.gssd isn't running. Either way, | ||
2237 | * existing mount programs don't handle -EACCES very well so it should | ||
2238 | * be mapped to -EPERM instead. | ||
2239 | */ | ||
2240 | if (status == -EACCES) | ||
2241 | status = -EPERM; | ||
2242 | return status; | ||
2243 | } | ||
2244 | |||
2245 | /* | ||
2246 | * get the file handle for the "/" directory on the server | ||
2247 | */ | ||
2248 | static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, | ||
2249 | struct nfs_fsinfo *info) | ||
2250 | { | ||
2251 | int status = nfs4_lookup_root(server, fhandle, info); | ||
2252 | if ((status == -NFS4ERR_WRONGSEC) && !(server->flags & NFS_MOUNT_SECFLAVOUR)) | ||
2253 | /* | ||
2254 | * A status of -NFS4ERR_WRONGSEC will be mapped to -EPERM | ||
2255 | * by nfs4_map_errors() as this function exits. | ||
2256 | */ | ||
2257 | status = nfs4_find_root_sec(server, fhandle, info); | ||
2230 | if (status == 0) | 2258 | if (status == 0) |
2231 | status = nfs4_server_capabilities(server, fhandle); | 2259 | status = nfs4_server_capabilities(server, fhandle); |
2232 | if (status == 0) | 2260 | if (status == 0) |
@@ -3723,21 +3751,20 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, | |||
3723 | sizeof(setclientid.sc_uaddr), "%s.%u.%u", | 3751 | sizeof(setclientid.sc_uaddr), "%s.%u.%u", |
3724 | clp->cl_ipaddr, port >> 8, port & 255); | 3752 | clp->cl_ipaddr, port >> 8, port & 255); |
3725 | 3753 | ||
3726 | status = rpc_call_sync(clp->cl_rpcclient, &msg, 0); | 3754 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
3727 | if (status != -NFS4ERR_CLID_INUSE) | 3755 | if (status != -NFS4ERR_CLID_INUSE) |
3728 | break; | 3756 | break; |
3729 | if (signalled()) | 3757 | if (loop != 0) { |
3758 | ++clp->cl_id_uniquifier; | ||
3730 | break; | 3759 | break; |
3731 | if (loop++ & 1) | 3760 | } |
3732 | ssleep(clp->cl_lease_time / HZ + 1); | 3761 | ++loop; |
3733 | else | 3762 | ssleep(clp->cl_lease_time / HZ + 1); |
3734 | if (++clp->cl_id_uniquifier == 0) | ||
3735 | break; | ||
3736 | } | 3763 | } |
3737 | return status; | 3764 | return status; |
3738 | } | 3765 | } |
3739 | 3766 | ||
3740 | static int _nfs4_proc_setclientid_confirm(struct nfs_client *clp, | 3767 | int nfs4_proc_setclientid_confirm(struct nfs_client *clp, |
3741 | struct nfs4_setclientid_res *arg, | 3768 | struct nfs4_setclientid_res *arg, |
3742 | struct rpc_cred *cred) | 3769 | struct rpc_cred *cred) |
3743 | { | 3770 | { |
@@ -3752,7 +3779,7 @@ static int _nfs4_proc_setclientid_confirm(struct nfs_client *clp, | |||
3752 | int status; | 3779 | int status; |
3753 | 3780 | ||
3754 | now = jiffies; | 3781 | now = jiffies; |
3755 | status = rpc_call_sync(clp->cl_rpcclient, &msg, 0); | 3782 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
3756 | if (status == 0) { | 3783 | if (status == 0) { |
3757 | spin_lock(&clp->cl_lock); | 3784 | spin_lock(&clp->cl_lock); |
3758 | clp->cl_lease_time = fsinfo.lease_time * HZ; | 3785 | clp->cl_lease_time = fsinfo.lease_time * HZ; |
@@ -3762,26 +3789,6 @@ static int _nfs4_proc_setclientid_confirm(struct nfs_client *clp, | |||
3762 | return status; | 3789 | return status; |
3763 | } | 3790 | } |
3764 | 3791 | ||
3765 | int nfs4_proc_setclientid_confirm(struct nfs_client *clp, | ||
3766 | struct nfs4_setclientid_res *arg, | ||
3767 | struct rpc_cred *cred) | ||
3768 | { | ||
3769 | long timeout = 0; | ||
3770 | int err; | ||
3771 | do { | ||
3772 | err = _nfs4_proc_setclientid_confirm(clp, arg, cred); | ||
3773 | switch (err) { | ||
3774 | case 0: | ||
3775 | return err; | ||
3776 | case -NFS4ERR_RESOURCE: | ||
3777 | /* The IBM lawyers misread another document! */ | ||
3778 | case -NFS4ERR_DELAY: | ||
3779 | err = nfs4_delay(clp->cl_rpcclient, &timeout); | ||
3780 | } | ||
3781 | } while (err == 0); | ||
3782 | return err; | ||
3783 | } | ||
3784 | |||
3785 | struct nfs4_delegreturndata { | 3792 | struct nfs4_delegreturndata { |
3786 | struct nfs4_delegreturnargs args; | 3793 | struct nfs4_delegreturnargs args; |
3787 | struct nfs4_delegreturnres res; | 3794 | struct nfs4_delegreturnres res; |
@@ -4786,7 +4793,7 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred) | |||
4786 | init_utsname()->domainname, | 4793 | init_utsname()->domainname, |
4787 | clp->cl_rpcclient->cl_auth->au_flavor); | 4794 | clp->cl_rpcclient->cl_auth->au_flavor); |
4788 | 4795 | ||
4789 | status = rpc_call_sync(clp->cl_rpcclient, &msg, 0); | 4796 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
4790 | if (!status) | 4797 | if (!status) |
4791 | status = nfs4_check_cl_exchange_flags(clp->cl_exchange_flags); | 4798 | status = nfs4_check_cl_exchange_flags(clp->cl_exchange_flags); |
4792 | dprintk("<-- %s status= %d\n", __func__, status); | 4799 | dprintk("<-- %s status= %d\n", __func__, status); |
@@ -4869,7 +4876,8 @@ int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo) | |||
4869 | .rpc_client = clp->cl_rpcclient, | 4876 | .rpc_client = clp->cl_rpcclient, |
4870 | .rpc_message = &msg, | 4877 | .rpc_message = &msg, |
4871 | .callback_ops = &nfs4_get_lease_time_ops, | 4878 | .callback_ops = &nfs4_get_lease_time_ops, |
4872 | .callback_data = &data | 4879 | .callback_data = &data, |
4880 | .flags = RPC_TASK_TIMEOUT, | ||
4873 | }; | 4881 | }; |
4874 | int status; | 4882 | int status; |
4875 | 4883 | ||
@@ -5171,7 +5179,7 @@ static int _nfs4_proc_create_session(struct nfs_client *clp) | |||
5171 | nfs4_init_channel_attrs(&args); | 5179 | nfs4_init_channel_attrs(&args); |
5172 | args.flags = (SESSION4_PERSIST | SESSION4_BACK_CHAN); | 5180 | args.flags = (SESSION4_PERSIST | SESSION4_BACK_CHAN); |
5173 | 5181 | ||
5174 | status = rpc_call_sync(session->clp->cl_rpcclient, &msg, 0); | 5182 | status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
5175 | 5183 | ||
5176 | if (!status) | 5184 | if (!status) |
5177 | /* Verify the session's negotiated channel_attrs values */ | 5185 | /* Verify the session's negotiated channel_attrs values */ |
@@ -5194,20 +5202,10 @@ int nfs4_proc_create_session(struct nfs_client *clp) | |||
5194 | int status; | 5202 | int status; |
5195 | unsigned *ptr; | 5203 | unsigned *ptr; |
5196 | struct nfs4_session *session = clp->cl_session; | 5204 | struct nfs4_session *session = clp->cl_session; |
5197 | long timeout = 0; | ||
5198 | int err; | ||
5199 | 5205 | ||
5200 | dprintk("--> %s clp=%p session=%p\n", __func__, clp, session); | 5206 | dprintk("--> %s clp=%p session=%p\n", __func__, clp, session); |
5201 | 5207 | ||
5202 | do { | 5208 | status = _nfs4_proc_create_session(clp); |
5203 | status = _nfs4_proc_create_session(clp); | ||
5204 | if (status == -NFS4ERR_DELAY) { | ||
5205 | err = nfs4_delay(clp->cl_rpcclient, &timeout); | ||
5206 | if (err) | ||
5207 | status = err; | ||
5208 | } | ||
5209 | } while (status == -NFS4ERR_DELAY); | ||
5210 | |||
5211 | if (status) | 5209 | if (status) |
5212 | goto out; | 5210 | goto out; |
5213 | 5211 | ||
@@ -5248,7 +5246,7 @@ int nfs4_proc_destroy_session(struct nfs4_session *session) | |||
5248 | msg.rpc_argp = session; | 5246 | msg.rpc_argp = session; |
5249 | msg.rpc_resp = NULL; | 5247 | msg.rpc_resp = NULL; |
5250 | msg.rpc_cred = NULL; | 5248 | msg.rpc_cred = NULL; |
5251 | status = rpc_call_sync(session->clp->cl_rpcclient, &msg, 0); | 5249 | status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
5252 | 5250 | ||
5253 | if (status) | 5251 | if (status) |
5254 | printk(KERN_WARNING | 5252 | printk(KERN_WARNING |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index a6804f704d9d..036f5adc9e1f 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -64,10 +64,15 @@ static LIST_HEAD(nfs4_clientid_list); | |||
64 | 64 | ||
65 | int nfs4_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) | 65 | int nfs4_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) |
66 | { | 66 | { |
67 | struct nfs4_setclientid_res clid; | 67 | struct nfs4_setclientid_res clid = { |
68 | .clientid = clp->cl_clientid, | ||
69 | .confirm = clp->cl_confirm, | ||
70 | }; | ||
68 | unsigned short port; | 71 | unsigned short port; |
69 | int status; | 72 | int status; |
70 | 73 | ||
74 | if (test_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state)) | ||
75 | goto do_confirm; | ||
71 | port = nfs_callback_tcpport; | 76 | port = nfs_callback_tcpport; |
72 | if (clp->cl_addr.ss_family == AF_INET6) | 77 | if (clp->cl_addr.ss_family == AF_INET6) |
73 | port = nfs_callback_tcpport6; | 78 | port = nfs_callback_tcpport6; |
@@ -75,10 +80,14 @@ int nfs4_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) | |||
75 | status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, port, cred, &clid); | 80 | status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, port, cred, &clid); |
76 | if (status != 0) | 81 | if (status != 0) |
77 | goto out; | 82 | goto out; |
83 | clp->cl_clientid = clid.clientid; | ||
84 | clp->cl_confirm = clid.confirm; | ||
85 | set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); | ||
86 | do_confirm: | ||
78 | status = nfs4_proc_setclientid_confirm(clp, &clid, cred); | 87 | status = nfs4_proc_setclientid_confirm(clp, &clid, cred); |
79 | if (status != 0) | 88 | if (status != 0) |
80 | goto out; | 89 | goto out; |
81 | clp->cl_clientid = clid.clientid; | 90 | clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); |
82 | nfs4_schedule_state_renewal(clp); | 91 | nfs4_schedule_state_renewal(clp); |
83 | out: | 92 | out: |
84 | return status; | 93 | return status; |
@@ -230,13 +239,18 @@ int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) | |||
230 | { | 239 | { |
231 | int status; | 240 | int status; |
232 | 241 | ||
242 | if (test_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state)) | ||
243 | goto do_confirm; | ||
233 | nfs4_begin_drain_session(clp); | 244 | nfs4_begin_drain_session(clp); |
234 | status = nfs4_proc_exchange_id(clp, cred); | 245 | status = nfs4_proc_exchange_id(clp, cred); |
235 | if (status != 0) | 246 | if (status != 0) |
236 | goto out; | 247 | goto out; |
248 | set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); | ||
249 | do_confirm: | ||
237 | status = nfs4_proc_create_session(clp); | 250 | status = nfs4_proc_create_session(clp); |
238 | if (status != 0) | 251 | if (status != 0) |
239 | goto out; | 252 | goto out; |
253 | clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); | ||
240 | nfs41_setup_state_renewal(clp); | 254 | nfs41_setup_state_renewal(clp); |
241 | nfs_mark_client_ready(clp, NFS_CS_READY); | 255 | nfs_mark_client_ready(clp, NFS_CS_READY); |
242 | out: | 256 | out: |
@@ -1584,20 +1598,23 @@ static int nfs4_recall_slot(struct nfs_client *clp) { return 0; } | |||
1584 | */ | 1598 | */ |
1585 | static void nfs4_set_lease_expired(struct nfs_client *clp, int status) | 1599 | static void nfs4_set_lease_expired(struct nfs_client *clp, int status) |
1586 | { | 1600 | { |
1587 | if (nfs4_has_session(clp)) { | 1601 | switch (status) { |
1588 | switch (status) { | 1602 | case -NFS4ERR_CLID_INUSE: |
1589 | case -NFS4ERR_DELAY: | 1603 | case -NFS4ERR_STALE_CLIENTID: |
1590 | case -NFS4ERR_CLID_INUSE: | 1604 | clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); |
1591 | case -EAGAIN: | 1605 | break; |
1592 | break; | 1606 | case -NFS4ERR_DELAY: |
1607 | case -ETIMEDOUT: | ||
1608 | case -EAGAIN: | ||
1609 | ssleep(1); | ||
1610 | break; | ||
1593 | 1611 | ||
1594 | case -EKEYEXPIRED: | 1612 | case -EKEYEXPIRED: |
1595 | nfs4_warn_keyexpired(clp->cl_hostname); | 1613 | nfs4_warn_keyexpired(clp->cl_hostname); |
1596 | case -NFS4ERR_NOT_SAME: /* FixMe: implement recovery | 1614 | case -NFS4ERR_NOT_SAME: /* FixMe: implement recovery |
1597 | * in nfs4_exchange_id */ | 1615 | * in nfs4_exchange_id */ |
1598 | default: | 1616 | default: |
1599 | return; | 1617 | return; |
1600 | } | ||
1601 | } | 1618 | } |
1602 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); | 1619 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); |
1603 | } | 1620 | } |
@@ -1607,7 +1624,7 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
1607 | int status = 0; | 1624 | int status = 0; |
1608 | 1625 | ||
1609 | /* Ensure exclusive access to NFSv4 state */ | 1626 | /* Ensure exclusive access to NFSv4 state */ |
1610 | for(;;) { | 1627 | do { |
1611 | if (test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) { | 1628 | if (test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) { |
1612 | /* We're going to have to re-establish a clientid */ | 1629 | /* We're going to have to re-establish a clientid */ |
1613 | status = nfs4_reclaim_lease(clp); | 1630 | status = nfs4_reclaim_lease(clp); |
@@ -1691,7 +1708,7 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
1691 | break; | 1708 | break; |
1692 | if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0) | 1709 | if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0) |
1693 | break; | 1710 | break; |
1694 | } | 1711 | } while (atomic_read(&clp->cl_count) > 1); |
1695 | return; | 1712 | return; |
1696 | out_error: | 1713 | out_error: |
1697 | printk(KERN_WARNING "Error: state manager failed on NFSv4 server %s" | 1714 | printk(KERN_WARNING "Error: state manager failed on NFSv4 server %s" |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index dddfb5795d7b..c3ccd2c46834 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -1452,26 +1452,25 @@ static void encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args, | |||
1452 | 1452 | ||
1453 | static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req, struct compound_hdr *hdr) | 1453 | static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req, struct compound_hdr *hdr) |
1454 | { | 1454 | { |
1455 | uint32_t attrs[2] = {0, 0}; | 1455 | uint32_t attrs[2] = { |
1456 | FATTR4_WORD0_RDATTR_ERROR, | ||
1457 | FATTR4_WORD1_MOUNTED_ON_FILEID, | ||
1458 | }; | ||
1456 | uint32_t dircount = readdir->count >> 1; | 1459 | uint32_t dircount = readdir->count >> 1; |
1457 | __be32 *p; | 1460 | __be32 *p; |
1458 | 1461 | ||
1459 | if (readdir->plus) { | 1462 | if (readdir->plus) { |
1460 | attrs[0] |= FATTR4_WORD0_TYPE|FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE| | 1463 | attrs[0] |= FATTR4_WORD0_TYPE|FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE| |
1461 | FATTR4_WORD0_FSID|FATTR4_WORD0_FILEHANDLE; | 1464 | FATTR4_WORD0_FSID|FATTR4_WORD0_FILEHANDLE|FATTR4_WORD0_FILEID; |
1462 | attrs[1] |= FATTR4_WORD1_MODE|FATTR4_WORD1_NUMLINKS|FATTR4_WORD1_OWNER| | 1465 | attrs[1] |= FATTR4_WORD1_MODE|FATTR4_WORD1_NUMLINKS|FATTR4_WORD1_OWNER| |
1463 | FATTR4_WORD1_OWNER_GROUP|FATTR4_WORD1_RAWDEV| | 1466 | FATTR4_WORD1_OWNER_GROUP|FATTR4_WORD1_RAWDEV| |
1464 | FATTR4_WORD1_SPACE_USED|FATTR4_WORD1_TIME_ACCESS| | 1467 | FATTR4_WORD1_SPACE_USED|FATTR4_WORD1_TIME_ACCESS| |
1465 | FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY; | 1468 | FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY; |
1466 | dircount >>= 1; | 1469 | dircount >>= 1; |
1467 | } | 1470 | } |
1468 | attrs[0] |= FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID; | 1471 | /* Use mounted_on_fileid only if the server supports it */ |
1469 | attrs[1] |= FATTR4_WORD1_MOUNTED_ON_FILEID; | 1472 | if (!(readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)) |
1470 | /* Switch to mounted_on_fileid if the server supports it */ | 1473 | attrs[0] |= FATTR4_WORD0_FILEID; |
1471 | if (readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID) | ||
1472 | attrs[0] &= ~FATTR4_WORD0_FILEID; | ||
1473 | else | ||
1474 | attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; | ||
1475 | 1474 | ||
1476 | p = reserve_space(xdr, 12+NFS4_VERIFIER_SIZE+20); | 1475 | p = reserve_space(xdr, 12+NFS4_VERIFIER_SIZE+20); |
1477 | *p++ = cpu_to_be32(OP_READDIR); | 1476 | *p++ = cpu_to_be32(OP_READDIR); |
@@ -3140,7 +3139,7 @@ static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitma | |||
3140 | goto out_overflow; | 3139 | goto out_overflow; |
3141 | xdr_decode_hyper(p, fileid); | 3140 | xdr_decode_hyper(p, fileid); |
3142 | bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; | 3141 | bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; |
3143 | ret = NFS_ATTR_FATTR_FILEID; | 3142 | ret = NFS_ATTR_FATTR_MOUNTED_ON_FILEID; |
3144 | } | 3143 | } |
3145 | dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid); | 3144 | dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid); |
3146 | return ret; | 3145 | return ret; |
@@ -4002,7 +4001,6 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, | |||
4002 | { | 4001 | { |
4003 | int status; | 4002 | int status; |
4004 | umode_t fmode = 0; | 4003 | umode_t fmode = 0; |
4005 | uint64_t fileid; | ||
4006 | uint32_t type; | 4004 | uint32_t type; |
4007 | 4005 | ||
4008 | status = decode_attr_type(xdr, bitmap, &type); | 4006 | status = decode_attr_type(xdr, bitmap, &type); |
@@ -4101,13 +4099,10 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, | |||
4101 | goto xdr_error; | 4099 | goto xdr_error; |
4102 | fattr->valid |= status; | 4100 | fattr->valid |= status; |
4103 | 4101 | ||
4104 | status = decode_attr_mounted_on_fileid(xdr, bitmap, &fileid); | 4102 | status = decode_attr_mounted_on_fileid(xdr, bitmap, &fattr->mounted_on_fileid); |
4105 | if (status < 0) | 4103 | if (status < 0) |
4106 | goto xdr_error; | 4104 | goto xdr_error; |
4107 | if (status != 0 && !(fattr->valid & status)) { | 4105 | fattr->valid |= status; |
4108 | fattr->fileid = fileid; | ||
4109 | fattr->valid |= status; | ||
4110 | } | ||
4111 | 4106 | ||
4112 | xdr_error: | 4107 | xdr_error: |
4113 | dprintk("%s: xdr returned %d\n", __func__, -status); | 4108 | dprintk("%s: xdr returned %d\n", __func__, -status); |
@@ -4838,17 +4833,21 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | |||
4838 | struct nfs4_secinfo_flavor *sec_flavor; | 4833 | struct nfs4_secinfo_flavor *sec_flavor; |
4839 | int status; | 4834 | int status; |
4840 | __be32 *p; | 4835 | __be32 *p; |
4841 | int i; | 4836 | int i, num_flavors; |
4842 | 4837 | ||
4843 | status = decode_op_hdr(xdr, OP_SECINFO); | 4838 | status = decode_op_hdr(xdr, OP_SECINFO); |
4839 | if (status) | ||
4840 | goto out; | ||
4844 | p = xdr_inline_decode(xdr, 4); | 4841 | p = xdr_inline_decode(xdr, 4); |
4845 | if (unlikely(!p)) | 4842 | if (unlikely(!p)) |
4846 | goto out_overflow; | 4843 | goto out_overflow; |
4847 | res->flavors->num_flavors = be32_to_cpup(p); | ||
4848 | 4844 | ||
4849 | for (i = 0; i < res->flavors->num_flavors; i++) { | 4845 | res->flavors->num_flavors = 0; |
4846 | num_flavors = be32_to_cpup(p); | ||
4847 | |||
4848 | for (i = 0; i < num_flavors; i++) { | ||
4850 | sec_flavor = &res->flavors->flavors[i]; | 4849 | sec_flavor = &res->flavors->flavors[i]; |
4851 | if ((char *)&sec_flavor[1] - (char *)res > PAGE_SIZE) | 4850 | if ((char *)&sec_flavor[1] - (char *)res->flavors > PAGE_SIZE) |
4852 | break; | 4851 | break; |
4853 | 4852 | ||
4854 | p = xdr_inline_decode(xdr, 4); | 4853 | p = xdr_inline_decode(xdr, 4); |
@@ -4857,13 +4856,15 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | |||
4857 | sec_flavor->flavor = be32_to_cpup(p); | 4856 | sec_flavor->flavor = be32_to_cpup(p); |
4858 | 4857 | ||
4859 | if (sec_flavor->flavor == RPC_AUTH_GSS) { | 4858 | if (sec_flavor->flavor == RPC_AUTH_GSS) { |
4860 | if (decode_secinfo_gss(xdr, sec_flavor)) | 4859 | status = decode_secinfo_gss(xdr, sec_flavor); |
4861 | break; | 4860 | if (status) |
4861 | goto out; | ||
4862 | } | 4862 | } |
4863 | res->flavors->num_flavors++; | ||
4863 | } | 4864 | } |
4864 | 4865 | ||
4865 | return 0; | 4866 | out: |
4866 | 4867 | return status; | |
4867 | out_overflow: | 4868 | out_overflow: |
4868 | print_overflow_msg(__func__, xdr); | 4869 | print_overflow_msg(__func__, xdr); |
4869 | return -EIO; | 4870 | return -EIO; |
@@ -6408,7 +6409,9 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, | |||
6408 | if (decode_getfattr_attrs(xdr, bitmap, entry->fattr, entry->fh, | 6409 | if (decode_getfattr_attrs(xdr, bitmap, entry->fattr, entry->fh, |
6409 | entry->server, 1) < 0) | 6410 | entry->server, 1) < 0) |
6410 | goto out_overflow; | 6411 | goto out_overflow; |
6411 | if (entry->fattr->valid & NFS_ATTR_FATTR_FILEID) | 6412 | if (entry->fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) |
6413 | entry->ino = entry->fattr->mounted_on_fileid; | ||
6414 | else if (entry->fattr->valid & NFS_ATTR_FATTR_FILEID) | ||
6412 | entry->ino = entry->fattr->fileid; | 6415 | entry->ino = entry->fattr->fileid; |
6413 | 6416 | ||
6414 | entry->d_type = DT_UNKNOWN; | 6417 | entry->d_type = DT_UNKNOWN; |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index d9ab97269ce6..ff681ab65d31 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -1004,6 +1004,7 @@ pnfs_set_layoutcommit(struct nfs_write_data *wdata) | |||
1004 | { | 1004 | { |
1005 | struct nfs_inode *nfsi = NFS_I(wdata->inode); | 1005 | struct nfs_inode *nfsi = NFS_I(wdata->inode); |
1006 | loff_t end_pos = wdata->args.offset + wdata->res.count; | 1006 | loff_t end_pos = wdata->args.offset + wdata->res.count; |
1007 | bool mark_as_dirty = false; | ||
1007 | 1008 | ||
1008 | spin_lock(&nfsi->vfs_inode.i_lock); | 1009 | spin_lock(&nfsi->vfs_inode.i_lock); |
1009 | if (!test_and_set_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags)) { | 1010 | if (!test_and_set_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags)) { |
@@ -1011,13 +1012,18 @@ pnfs_set_layoutcommit(struct nfs_write_data *wdata) | |||
1011 | get_lseg(wdata->lseg); | 1012 | get_lseg(wdata->lseg); |
1012 | wdata->lseg->pls_lc_cred = | 1013 | wdata->lseg->pls_lc_cred = |
1013 | get_rpccred(wdata->args.context->state->owner->so_cred); | 1014 | get_rpccred(wdata->args.context->state->owner->so_cred); |
1014 | mark_inode_dirty_sync(wdata->inode); | 1015 | mark_as_dirty = true; |
1015 | dprintk("%s: Set layoutcommit for inode %lu ", | 1016 | dprintk("%s: Set layoutcommit for inode %lu ", |
1016 | __func__, wdata->inode->i_ino); | 1017 | __func__, wdata->inode->i_ino); |
1017 | } | 1018 | } |
1018 | if (end_pos > wdata->lseg->pls_end_pos) | 1019 | if (end_pos > wdata->lseg->pls_end_pos) |
1019 | wdata->lseg->pls_end_pos = end_pos; | 1020 | wdata->lseg->pls_end_pos = end_pos; |
1020 | spin_unlock(&nfsi->vfs_inode.i_lock); | 1021 | spin_unlock(&nfsi->vfs_inode.i_lock); |
1022 | |||
1023 | /* if pnfs_layoutcommit_inode() runs between inode locks, the next one | ||
1024 | * will be a noop because NFS_INO_LAYOUTCOMMIT will not be set */ | ||
1025 | if (mark_as_dirty) | ||
1026 | mark_inode_dirty_sync(wdata->inode); | ||
1021 | } | 1027 | } |
1022 | EXPORT_SYMBOL_GPL(pnfs_set_layoutcommit); | 1028 | EXPORT_SYMBOL_GPL(pnfs_set_layoutcommit); |
1023 | 1029 | ||
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 2b8e9a5e366a..e288f06d3fa7 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -1004,6 +1004,7 @@ static int nfs_parse_security_flavors(char *value, | |||
1004 | return 0; | 1004 | return 0; |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | mnt->flags |= NFS_MOUNT_SECFLAVOUR; | ||
1007 | mnt->auth_flavor_len = 1; | 1008 | mnt->auth_flavor_len = 1; |
1008 | return 1; | 1009 | return 1; |
1009 | } | 1010 | } |
@@ -1976,6 +1977,15 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data) | |||
1976 | if (error < 0) | 1977 | if (error < 0) |
1977 | goto out; | 1978 | goto out; |
1978 | 1979 | ||
1980 | /* | ||
1981 | * noac is a special case. It implies -o sync, but that's not | ||
1982 | * necessarily reflected in the mtab options. do_remount_sb | ||
1983 | * will clear MS_SYNCHRONOUS if -o sync wasn't specified in the | ||
1984 | * remount options, so we have to explicitly reset it. | ||
1985 | */ | ||
1986 | if (data->flags & NFS_MOUNT_NOAC) | ||
1987 | *flags |= MS_SYNCHRONOUS; | ||
1988 | |||
1979 | /* compare new mount options with old ones */ | 1989 | /* compare new mount options with old ones */ |
1980 | error = nfs_compare_remount_data(nfss, data); | 1990 | error = nfs_compare_remount_data(nfss, data); |
1981 | out: | 1991 | out: |
@@ -2235,8 +2245,7 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type, | |||
2235 | if (!s->s_root) { | 2245 | if (!s->s_root) { |
2236 | /* initial superblock/root creation */ | 2246 | /* initial superblock/root creation */ |
2237 | nfs_fill_super(s, data); | 2247 | nfs_fill_super(s, data); |
2238 | nfs_fscache_get_super_cookie( | 2248 | nfs_fscache_get_super_cookie(s, data->fscache_uniq, NULL); |
2239 | s, data ? data->fscache_uniq : NULL, NULL); | ||
2240 | } | 2249 | } |
2241 | 2250 | ||
2242 | mntroot = nfs_get_root(s, mntfh, dev_name); | 2251 | mntroot = nfs_get_root(s, mntfh, dev_name); |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index af0c6279a4a7..3bd5d7e80f6c 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -542,11 +542,15 @@ nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, u | |||
542 | if (!nfs_need_commit(nfsi)) | 542 | if (!nfs_need_commit(nfsi)) |
543 | return 0; | 543 | return 0; |
544 | 544 | ||
545 | spin_lock(&inode->i_lock); | ||
545 | ret = nfs_scan_list(nfsi, dst, idx_start, npages, NFS_PAGE_TAG_COMMIT); | 546 | ret = nfs_scan_list(nfsi, dst, idx_start, npages, NFS_PAGE_TAG_COMMIT); |
546 | if (ret > 0) | 547 | if (ret > 0) |
547 | nfsi->ncommit -= ret; | 548 | nfsi->ncommit -= ret; |
549 | spin_unlock(&inode->i_lock); | ||
550 | |||
548 | if (nfs_need_commit(NFS_I(inode))) | 551 | if (nfs_need_commit(NFS_I(inode))) |
549 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); | 552 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); |
553 | |||
550 | return ret; | 554 | return ret; |
551 | } | 555 | } |
552 | #else | 556 | #else |
@@ -676,7 +680,6 @@ static int nfs_writepage_setup(struct nfs_open_context *ctx, struct page *page, | |||
676 | req = nfs_setup_write_request(ctx, page, offset, count); | 680 | req = nfs_setup_write_request(ctx, page, offset, count); |
677 | if (IS_ERR(req)) | 681 | if (IS_ERR(req)) |
678 | return PTR_ERR(req); | 682 | return PTR_ERR(req); |
679 | nfs_mark_request_dirty(req); | ||
680 | /* Update file length */ | 683 | /* Update file length */ |
681 | nfs_grow_file(page, offset, count); | 684 | nfs_grow_file(page, offset, count); |
682 | nfs_mark_uptodate(page, req->wb_pgbase, req->wb_bytes); | 685 | nfs_mark_uptodate(page, req->wb_pgbase, req->wb_bytes); |
@@ -1414,8 +1417,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata) | |||
1414 | task->tk_pid, task->tk_status); | 1417 | task->tk_pid, task->tk_status); |
1415 | 1418 | ||
1416 | /* Call the NFS version-specific code */ | 1419 | /* Call the NFS version-specific code */ |
1417 | if (NFS_PROTO(data->inode)->commit_done(task, data) != 0) | 1420 | NFS_PROTO(data->inode)->commit_done(task, data); |
1418 | return; | ||
1419 | } | 1421 | } |
1420 | 1422 | ||
1421 | void nfs_commit_release_pages(struct nfs_write_data *data) | 1423 | void nfs_commit_release_pages(struct nfs_write_data *data) |
@@ -1483,9 +1485,7 @@ int nfs_commit_inode(struct inode *inode, int how) | |||
1483 | res = nfs_commit_set_lock(NFS_I(inode), may_wait); | 1485 | res = nfs_commit_set_lock(NFS_I(inode), may_wait); |
1484 | if (res <= 0) | 1486 | if (res <= 0) |
1485 | goto out_mark_dirty; | 1487 | goto out_mark_dirty; |
1486 | spin_lock(&inode->i_lock); | ||
1487 | res = nfs_scan_commit(inode, &head, 0, 0); | 1488 | res = nfs_scan_commit(inode, &head, 0, 0); |
1488 | spin_unlock(&inode->i_lock); | ||
1489 | if (res) { | 1489 | if (res) { |
1490 | int error; | 1490 | int error; |
1491 | 1491 | ||
diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c index 0c6d81670137..7c831a2731fa 100644 --- a/fs/nfsd/lockd.c +++ b/fs/nfsd/lockd.c | |||
@@ -38,7 +38,6 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp) | |||
38 | exp_readlock(); | 38 | exp_readlock(); |
39 | nfserr = nfsd_open(rqstp, &fh, S_IFREG, NFSD_MAY_LOCK, filp); | 39 | nfserr = nfsd_open(rqstp, &fh, S_IFREG, NFSD_MAY_LOCK, filp); |
40 | fh_put(&fh); | 40 | fh_put(&fh); |
41 | rqstp->rq_client = NULL; | ||
42 | exp_readunlock(); | 41 | exp_readunlock(); |
43 | /* We return nlm error codes as nlm doesn't know | 42 | /* We return nlm error codes as nlm doesn't know |
44 | * about nfsd, but nfsd does know about nlm.. | 43 | * about nfsd, but nfsd does know about nlm.. |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 4b36ec3eb8ea..4cf04e11c66c 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -258,6 +258,7 @@ static void nfs4_put_deleg_lease(struct nfs4_file *fp) | |||
258 | if (atomic_dec_and_test(&fp->fi_delegees)) { | 258 | if (atomic_dec_and_test(&fp->fi_delegees)) { |
259 | vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease); | 259 | vfs_setlease(fp->fi_deleg_file, F_UNLCK, &fp->fi_lease); |
260 | fp->fi_lease = NULL; | 260 | fp->fi_lease = NULL; |
261 | fput(fp->fi_deleg_file); | ||
261 | fp->fi_deleg_file = NULL; | 262 | fp->fi_deleg_file = NULL; |
262 | } | 263 | } |
263 | } | 264 | } |
@@ -397,9 +398,12 @@ static void unhash_generic_stateid(struct nfs4_stateid *stp) | |||
397 | 398 | ||
398 | static void free_generic_stateid(struct nfs4_stateid *stp) | 399 | static void free_generic_stateid(struct nfs4_stateid *stp) |
399 | { | 400 | { |
400 | int oflag = nfs4_access_bmap_to_omode(stp); | 401 | int oflag; |
401 | 402 | ||
402 | nfs4_file_put_access(stp->st_file, oflag); | 403 | if (stp->st_access_bmap) { |
404 | oflag = nfs4_access_bmap_to_omode(stp); | ||
405 | nfs4_file_put_access(stp->st_file, oflag); | ||
406 | } | ||
403 | put_nfs4_file(stp->st_file); | 407 | put_nfs4_file(stp->st_file); |
404 | kmem_cache_free(stateid_slab, stp); | 408 | kmem_cache_free(stateid_slab, stp); |
405 | } | 409 | } |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 2e1cebde90df..129f3c9f62d5 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1363,7 +1363,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1363 | goto out; | 1363 | goto out; |
1364 | if (!(iap->ia_valid & ATTR_MODE)) | 1364 | if (!(iap->ia_valid & ATTR_MODE)) |
1365 | iap->ia_mode = 0; | 1365 | iap->ia_mode = 0; |
1366 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE); | 1366 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC); |
1367 | if (err) | 1367 | if (err) |
1368 | goto out; | 1368 | goto out; |
1369 | 1369 | ||
@@ -1385,6 +1385,13 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1385 | if (IS_ERR(dchild)) | 1385 | if (IS_ERR(dchild)) |
1386 | goto out_nfserr; | 1386 | goto out_nfserr; |
1387 | 1387 | ||
1388 | /* If file doesn't exist, check for permissions to create one */ | ||
1389 | if (!dchild->d_inode) { | ||
1390 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE); | ||
1391 | if (err) | ||
1392 | goto out; | ||
1393 | } | ||
1394 | |||
1388 | err = fh_compose(resfhp, fhp->fh_export, dchild, fhp); | 1395 | err = fh_compose(resfhp, fhp->fh_export, dchild, fhp); |
1389 | if (err) | 1396 | if (err) |
1390 | goto out; | 1397 | goto out; |
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index b68f87a83924..938387a10d5d 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
@@ -1019,7 +1019,7 @@ struct ocfs2_xattr_entry { | |||
1019 | __le16 xe_name_offset; /* byte offset from the 1st entry in the | 1019 | __le16 xe_name_offset; /* byte offset from the 1st entry in the |
1020 | local xattr storage(inode, xattr block or | 1020 | local xattr storage(inode, xattr block or |
1021 | xattr bucket). */ | 1021 | xattr bucket). */ |
1022 | __u8 xe_name_len; /* xattr name len, does't include prefix. */ | 1022 | __u8 xe_name_len; /* xattr name len, doesn't include prefix. */ |
1023 | __u8 xe_type; /* the low 7 bits indicate the name prefix | 1023 | __u8 xe_type; /* the low 7 bits indicate the name prefix |
1024 | * type and the highest bit indicates whether | 1024 | * type and the highest bit indicates whether |
1025 | * the EA is stored in the local storage. */ | 1025 | * the EA is stored in the local storage. */ |
diff --git a/fs/partitions/ldm.c b/fs/partitions/ldm.c index b10e3540d5b7..ce4f62440425 100644 --- a/fs/partitions/ldm.c +++ b/fs/partitions/ldm.c | |||
@@ -1299,6 +1299,11 @@ static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags) | |||
1299 | 1299 | ||
1300 | BUG_ON (!data || !frags); | 1300 | BUG_ON (!data || !frags); |
1301 | 1301 | ||
1302 | if (size < 2 * VBLK_SIZE_HEAD) { | ||
1303 | ldm_error("Value of size is to small."); | ||
1304 | return false; | ||
1305 | } | ||
1306 | |||
1302 | group = get_unaligned_be32(data + 0x08); | 1307 | group = get_unaligned_be32(data + 0x08); |
1303 | rec = get_unaligned_be16(data + 0x0C); | 1308 | rec = get_unaligned_be16(data + 0x0C); |
1304 | num = get_unaligned_be16(data + 0x0E); | 1309 | num = get_unaligned_be16(data + 0x0E); |
@@ -1306,6 +1311,10 @@ static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags) | |||
1306 | ldm_error ("A VBLK claims to have %d parts.", num); | 1311 | ldm_error ("A VBLK claims to have %d parts.", num); |
1307 | return false; | 1312 | return false; |
1308 | } | 1313 | } |
1314 | if (rec >= num) { | ||
1315 | ldm_error("REC value (%d) exceeds NUM value (%d)", rec, num); | ||
1316 | return false; | ||
1317 | } | ||
1309 | 1318 | ||
1310 | list_for_each (item, frags) { | 1319 | list_for_each (item, frags) { |
1311 | f = list_entry (item, struct frag, list); | 1320 | f = list_entry (item, struct frag, list); |
@@ -1334,10 +1343,9 @@ found: | |||
1334 | 1343 | ||
1335 | f->map |= (1 << rec); | 1344 | f->map |= (1 << rec); |
1336 | 1345 | ||
1337 | if (num > 0) { | 1346 | data += VBLK_SIZE_HEAD; |
1338 | data += VBLK_SIZE_HEAD; | 1347 | size -= VBLK_SIZE_HEAD; |
1339 | size -= VBLK_SIZE_HEAD; | 1348 | |
1340 | } | ||
1341 | memcpy (f->data+rec*(size-VBLK_SIZE_HEAD)+VBLK_SIZE_HEAD, data, size); | 1349 | memcpy (f->data+rec*(size-VBLK_SIZE_HEAD)+VBLK_SIZE_HEAD, data, size); |
1342 | 1350 | ||
1343 | return true; | 1351 | return true; |
diff --git a/fs/proc/base.c b/fs/proc/base.c index dd6628d3ba42..dfa532730e55 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -3124,11 +3124,16 @@ static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldi | |||
3124 | /* for the /proc/ directory itself, after non-process stuff has been done */ | 3124 | /* for the /proc/ directory itself, after non-process stuff has been done */ |
3125 | int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir) | 3125 | int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir) |
3126 | { | 3126 | { |
3127 | unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY; | 3127 | unsigned int nr; |
3128 | struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode); | 3128 | struct task_struct *reaper; |
3129 | struct tgid_iter iter; | 3129 | struct tgid_iter iter; |
3130 | struct pid_namespace *ns; | 3130 | struct pid_namespace *ns; |
3131 | 3131 | ||
3132 | if (filp->f_pos >= PID_MAX_LIMIT + TGID_OFFSET) | ||
3133 | goto out_no_task; | ||
3134 | nr = filp->f_pos - FIRST_PROCESS_ENTRY; | ||
3135 | |||
3136 | reaper = get_proc_task(filp->f_path.dentry->d_inode); | ||
3132 | if (!reaper) | 3137 | if (!reaper) |
3133 | goto out_no_task; | 3138 | goto out_no_task; |
3134 | 3139 | ||
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index 9eead2c796b7..fbb0b478a346 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c | |||
@@ -112,6 +112,7 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) | |||
112 | SetPageDirty(page); | 112 | SetPageDirty(page); |
113 | 113 | ||
114 | unlock_page(page); | 114 | unlock_page(page); |
115 | put_page(page); | ||
115 | } | 116 | } |
116 | 117 | ||
117 | return 0; | 118 | return 0; |
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 919f0de29d8f..e6493cac193d 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h | |||
@@ -23,6 +23,12 @@ | |||
23 | #ifndef __UBIFS_DEBUG_H__ | 23 | #ifndef __UBIFS_DEBUG_H__ |
24 | #define __UBIFS_DEBUG_H__ | 24 | #define __UBIFS_DEBUG_H__ |
25 | 25 | ||
26 | /* Checking helper functions */ | ||
27 | typedef int (*dbg_leaf_callback)(struct ubifs_info *c, | ||
28 | struct ubifs_zbranch *zbr, void *priv); | ||
29 | typedef int (*dbg_znode_callback)(struct ubifs_info *c, | ||
30 | struct ubifs_znode *znode, void *priv); | ||
31 | |||
26 | #ifdef CONFIG_UBIFS_FS_DEBUG | 32 | #ifdef CONFIG_UBIFS_FS_DEBUG |
27 | 33 | ||
28 | /** | 34 | /** |
@@ -270,11 +276,6 @@ void dbg_dump_tnc(struct ubifs_info *c); | |||
270 | void dbg_dump_index(struct ubifs_info *c); | 276 | void dbg_dump_index(struct ubifs_info *c); |
271 | void dbg_dump_lpt_lebs(const struct ubifs_info *c); | 277 | void dbg_dump_lpt_lebs(const struct ubifs_info *c); |
272 | 278 | ||
273 | /* Checking helper functions */ | ||
274 | typedef int (*dbg_leaf_callback)(struct ubifs_info *c, | ||
275 | struct ubifs_zbranch *zbr, void *priv); | ||
276 | typedef int (*dbg_znode_callback)(struct ubifs_info *c, | ||
277 | struct ubifs_znode *znode, void *priv); | ||
278 | int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | 279 | int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, |
279 | dbg_znode_callback znode_cb, void *priv); | 280 | dbg_znode_callback znode_cb, void *priv); |
280 | 281 | ||
@@ -295,7 +296,6 @@ int dbg_check_idx_size(struct ubifs_info *c, long long idx_size); | |||
295 | int dbg_check_filesystem(struct ubifs_info *c); | 296 | int dbg_check_filesystem(struct ubifs_info *c); |
296 | void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, | 297 | void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, |
297 | int add_pos); | 298 | int add_pos); |
298 | int dbg_check_lprops(struct ubifs_info *c); | ||
299 | int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode, | 299 | int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode, |
300 | int row, int col); | 300 | int row, int col); |
301 | int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode, | 301 | int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode, |
@@ -401,58 +401,94 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c); | |||
401 | #define DBGKEY(key) ((char *)(key)) | 401 | #define DBGKEY(key) ((char *)(key)) |
402 | #define DBGKEY1(key) ((char *)(key)) | 402 | #define DBGKEY1(key) ((char *)(key)) |
403 | 403 | ||
404 | #define ubifs_debugging_init(c) 0 | 404 | static inline int ubifs_debugging_init(struct ubifs_info *c) { return 0; } |
405 | #define ubifs_debugging_exit(c) ({}) | 405 | static inline void ubifs_debugging_exit(struct ubifs_info *c) { return; } |
406 | 406 | static inline const char *dbg_ntype(int type) { return ""; } | |
407 | #define dbg_ntype(type) "" | 407 | static inline const char *dbg_cstate(int cmt_state) { return ""; } |
408 | #define dbg_cstate(cmt_state) "" | 408 | static inline const char *dbg_jhead(int jhead) { return ""; } |
409 | #define dbg_jhead(jhead) "" | 409 | static inline const char * |
410 | #define dbg_get_key_dump(c, key) ({}) | 410 | dbg_get_key_dump(const struct ubifs_info *c, |
411 | #define dbg_dump_inode(c, inode) ({}) | 411 | const union ubifs_key *key) { return ""; } |
412 | #define dbg_dump_node(c, node) ({}) | 412 | static inline void dbg_dump_inode(const struct ubifs_info *c, |
413 | #define dbg_dump_lpt_node(c, node, lnum, offs) ({}) | 413 | const struct inode *inode) { return; } |
414 | #define dbg_dump_budget_req(req) ({}) | 414 | static inline void dbg_dump_node(const struct ubifs_info *c, |
415 | #define dbg_dump_lstats(lst) ({}) | 415 | const void *node) { return; } |
416 | #define dbg_dump_budg(c) ({}) | 416 | static inline void dbg_dump_lpt_node(const struct ubifs_info *c, |
417 | #define dbg_dump_lprop(c, lp) ({}) | 417 | void *node, int lnum, |
418 | #define dbg_dump_lprops(c) ({}) | 418 | int offs) { return; } |
419 | #define dbg_dump_lpt_info(c) ({}) | 419 | static inline void |
420 | #define dbg_dump_leb(c, lnum) ({}) | 420 | dbg_dump_budget_req(const struct ubifs_budget_req *req) { return; } |
421 | #define dbg_dump_znode(c, znode) ({}) | 421 | static inline void |
422 | #define dbg_dump_heap(c, heap, cat) ({}) | 422 | dbg_dump_lstats(const struct ubifs_lp_stats *lst) { return; } |
423 | #define dbg_dump_pnode(c, pnode, parent, iip) ({}) | 423 | static inline void dbg_dump_budg(struct ubifs_info *c) { return; } |
424 | #define dbg_dump_tnc(c) ({}) | 424 | static inline void dbg_dump_lprop(const struct ubifs_info *c, |
425 | #define dbg_dump_index(c) ({}) | 425 | const struct ubifs_lprops *lp) { return; } |
426 | #define dbg_dump_lpt_lebs(c) ({}) | 426 | static inline void dbg_dump_lprops(struct ubifs_info *c) { return; } |
427 | 427 | static inline void dbg_dump_lpt_info(struct ubifs_info *c) { return; } | |
428 | #define dbg_walk_index(c, leaf_cb, znode_cb, priv) 0 | 428 | static inline void dbg_dump_leb(const struct ubifs_info *c, |
429 | #define dbg_old_index_check_init(c, zroot) 0 | 429 | int lnum) { return; } |
430 | #define dbg_save_space_info(c) ({}) | 430 | static inline void |
431 | #define dbg_check_space_info(c) 0 | 431 | dbg_dump_znode(const struct ubifs_info *c, |
432 | #define dbg_check_old_index(c, zroot) 0 | 432 | const struct ubifs_znode *znode) { return; } |
433 | #define dbg_check_cats(c) 0 | 433 | static inline void dbg_dump_heap(struct ubifs_info *c, |
434 | #define dbg_check_ltab(c) 0 | 434 | struct ubifs_lpt_heap *heap, |
435 | #define dbg_chk_lpt_free_spc(c) 0 | 435 | int cat) { return; } |
436 | #define dbg_chk_lpt_sz(c, action, len) 0 | 436 | static inline void dbg_dump_pnode(struct ubifs_info *c, |
437 | #define dbg_check_synced_i_size(inode) 0 | 437 | struct ubifs_pnode *pnode, |
438 | #define dbg_check_dir_size(c, dir) 0 | 438 | struct ubifs_nnode *parent, |
439 | #define dbg_check_tnc(c, x) 0 | 439 | int iip) { return; } |
440 | #define dbg_check_idx_size(c, idx_size) 0 | 440 | static inline void dbg_dump_tnc(struct ubifs_info *c) { return; } |
441 | #define dbg_check_filesystem(c) 0 | 441 | static inline void dbg_dump_index(struct ubifs_info *c) { return; } |
442 | #define dbg_check_heap(c, heap, cat, add_pos) ({}) | 442 | static inline void dbg_dump_lpt_lebs(const struct ubifs_info *c) { return; } |
443 | #define dbg_check_lprops(c) 0 | 443 | |
444 | #define dbg_check_lpt_nodes(c, cnode, row, col) 0 | 444 | static inline int dbg_walk_index(struct ubifs_info *c, |
445 | #define dbg_check_inode_size(c, inode, size) 0 | 445 | dbg_leaf_callback leaf_cb, |
446 | #define dbg_check_data_nodes_order(c, head) 0 | 446 | dbg_znode_callback znode_cb, |
447 | #define dbg_check_nondata_nodes_order(c, head) 0 | 447 | void *priv) { return 0; } |
448 | #define dbg_force_in_the_gaps_enabled 0 | 448 | static inline void dbg_save_space_info(struct ubifs_info *c) { return; } |
449 | #define dbg_force_in_the_gaps() 0 | 449 | static inline int dbg_check_space_info(struct ubifs_info *c) { return 0; } |
450 | #define dbg_failure_mode 0 | 450 | static inline int dbg_check_lprops(struct ubifs_info *c) { return 0; } |
451 | 451 | static inline int | |
452 | #define dbg_debugfs_init() 0 | 452 | dbg_old_index_check_init(struct ubifs_info *c, |
453 | #define dbg_debugfs_exit() | 453 | struct ubifs_zbranch *zroot) { return 0; } |
454 | #define dbg_debugfs_init_fs(c) 0 | 454 | static inline int |
455 | #define dbg_debugfs_exit_fs(c) 0 | 455 | dbg_check_old_index(struct ubifs_info *c, |
456 | struct ubifs_zbranch *zroot) { return 0; } | ||
457 | static inline int dbg_check_cats(struct ubifs_info *c) { return 0; } | ||
458 | static inline int dbg_check_ltab(struct ubifs_info *c) { return 0; } | ||
459 | static inline int dbg_chk_lpt_free_spc(struct ubifs_info *c) { return 0; } | ||
460 | static inline int dbg_chk_lpt_sz(struct ubifs_info *c, | ||
461 | int action, int len) { return 0; } | ||
462 | static inline int dbg_check_synced_i_size(struct inode *inode) { return 0; } | ||
463 | static inline int dbg_check_dir_size(struct ubifs_info *c, | ||
464 | const struct inode *dir) { return 0; } | ||
465 | static inline int dbg_check_tnc(struct ubifs_info *c, int extra) { return 0; } | ||
466 | static inline int dbg_check_idx_size(struct ubifs_info *c, | ||
467 | long long idx_size) { return 0; } | ||
468 | static inline int dbg_check_filesystem(struct ubifs_info *c) { return 0; } | ||
469 | static inline void dbg_check_heap(struct ubifs_info *c, | ||
470 | struct ubifs_lpt_heap *heap, | ||
471 | int cat, int add_pos) { return; } | ||
472 | static inline int dbg_check_lpt_nodes(struct ubifs_info *c, | ||
473 | struct ubifs_cnode *cnode, int row, int col) { return 0; } | ||
474 | static inline int dbg_check_inode_size(struct ubifs_info *c, | ||
475 | const struct inode *inode, | ||
476 | loff_t size) { return 0; } | ||
477 | static inline int | ||
478 | dbg_check_data_nodes_order(struct ubifs_info *c, | ||
479 | struct list_head *head) { return 0; } | ||
480 | static inline int | ||
481 | dbg_check_nondata_nodes_order(struct ubifs_info *c, | ||
482 | struct list_head *head) { return 0; } | ||
483 | |||
484 | static inline int dbg_force_in_the_gaps(void) { return 0; } | ||
485 | #define dbg_force_in_the_gaps_enabled 0 | ||
486 | #define dbg_failure_mode 0 | ||
487 | |||
488 | static inline int dbg_debugfs_init(void) { return 0; } | ||
489 | static inline void dbg_debugfs_exit(void) { return; } | ||
490 | static inline int dbg_debugfs_init_fs(struct ubifs_info *c) { return 0; } | ||
491 | static inline int dbg_debugfs_exit_fs(struct ubifs_info *c) { return 0; } | ||
456 | 492 | ||
457 | #endif /* !CONFIG_UBIFS_FS_DEBUG */ | 493 | #endif /* !CONFIG_UBIFS_FS_DEBUG */ |
458 | #endif /* !__UBIFS_DEBUG_H__ */ | 494 | #endif /* !__UBIFS_DEBUG_H__ */ |
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 28be1e6a65e8..b286db79c686 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
@@ -1312,6 +1312,9 @@ int ubifs_fsync(struct file *file, int datasync) | |||
1312 | 1312 | ||
1313 | dbg_gen("syncing inode %lu", inode->i_ino); | 1313 | dbg_gen("syncing inode %lu", inode->i_ino); |
1314 | 1314 | ||
1315 | if (inode->i_sb->s_flags & MS_RDONLY) | ||
1316 | return 0; | ||
1317 | |||
1315 | /* | 1318 | /* |
1316 | * VFS has already synchronized dirty pages for this inode. Synchronize | 1319 | * VFS has already synchronized dirty pages for this inode. Synchronize |
1317 | * the inode unless this is a 'datasync()' call. | 1320 | * the inode unless this is a 'datasync()' call. |
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index 4d0cb1241460..40fa780ebea7 100644 --- a/fs/ubifs/log.c +++ b/fs/ubifs/log.c | |||
@@ -175,26 +175,6 @@ void ubifs_add_bud(struct ubifs_info *c, struct ubifs_bud *bud) | |||
175 | } | 175 | } |
176 | 176 | ||
177 | /** | 177 | /** |
178 | * ubifs_create_buds_lists - create journal head buds lists for remount rw. | ||
179 | * @c: UBIFS file-system description object | ||
180 | */ | ||
181 | void ubifs_create_buds_lists(struct ubifs_info *c) | ||
182 | { | ||
183 | struct rb_node *p; | ||
184 | |||
185 | spin_lock(&c->buds_lock); | ||
186 | p = rb_first(&c->buds); | ||
187 | while (p) { | ||
188 | struct ubifs_bud *bud = rb_entry(p, struct ubifs_bud, rb); | ||
189 | struct ubifs_jhead *jhead = &c->jheads[bud->jhead]; | ||
190 | |||
191 | list_add_tail(&bud->list, &jhead->buds_list); | ||
192 | p = rb_next(p); | ||
193 | } | ||
194 | spin_unlock(&c->buds_lock); | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * ubifs_add_bud_to_log - add a new bud to the log. | 178 | * ubifs_add_bud_to_log - add a new bud to the log. |
199 | * @c: UBIFS file-system description object | 179 | * @c: UBIFS file-system description object |
200 | * @jhead: journal head the bud belongs to | 180 | * @jhead: journal head the bud belongs to |
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 936f2cbfe6b6..3dbad6fbd1eb 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
@@ -317,6 +317,32 @@ int ubifs_recover_master_node(struct ubifs_info *c) | |||
317 | goto out_free; | 317 | goto out_free; |
318 | } | 318 | } |
319 | memcpy(c->rcvrd_mst_node, c->mst_node, UBIFS_MST_NODE_SZ); | 319 | memcpy(c->rcvrd_mst_node, c->mst_node, UBIFS_MST_NODE_SZ); |
320 | |||
321 | /* | ||
322 | * We had to recover the master node, which means there was an | ||
323 | * unclean reboot. However, it is possible that the master node | ||
324 | * is clean at this point, i.e., %UBIFS_MST_DIRTY is not set. | ||
325 | * E.g., consider the following chain of events: | ||
326 | * | ||
327 | * 1. UBIFS was cleanly unmounted, so the master node is clean | ||
328 | * 2. UBIFS is being mounted R/W and starts changing the master | ||
329 | * node in the first (%UBIFS_MST_LNUM). A power cut happens, | ||
330 | * so this LEB ends up with some amount of garbage at the | ||
331 | * end. | ||
332 | * 3. UBIFS is being mounted R/O. We reach this place and | ||
333 | * recover the master node from the second LEB | ||
334 | * (%UBIFS_MST_LNUM + 1). But we cannot update the media | ||
335 | * because we are being mounted R/O. We have to defer the | ||
336 | * operation. | ||
337 | * 4. However, this master node (@c->mst_node) is marked as | ||
338 | * clean (since the step 1). And if we just return, the | ||
339 | * mount code will be confused and won't recover the master | ||
340 | * node when it is re-mounter R/W later. | ||
341 | * | ||
342 | * Thus, to force the recovery by marking the master node as | ||
343 | * dirty. | ||
344 | */ | ||
345 | c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); | ||
320 | } else { | 346 | } else { |
321 | /* Write the recovered master node */ | 347 | /* Write the recovered master node */ |
322 | c->max_sqnum = le64_to_cpu(mst->ch.sqnum) - 1; | 348 | c->max_sqnum = le64_to_cpu(mst->ch.sqnum) - 1; |
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index eed0fcff8d73..d3d6d365bfc1 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c | |||
@@ -59,6 +59,7 @@ enum { | |||
59 | * @new_size: truncation new size | 59 | * @new_size: truncation new size |
60 | * @free: amount of free space in a bud | 60 | * @free: amount of free space in a bud |
61 | * @dirty: amount of dirty space in a bud from padding and deletion nodes | 61 | * @dirty: amount of dirty space in a bud from padding and deletion nodes |
62 | * @jhead: journal head number of the bud | ||
62 | * | 63 | * |
63 | * UBIFS journal replay must compare node sequence numbers, which means it must | 64 | * UBIFS journal replay must compare node sequence numbers, which means it must |
64 | * build a tree of node information to insert into the TNC. | 65 | * build a tree of node information to insert into the TNC. |
@@ -80,6 +81,7 @@ struct replay_entry { | |||
80 | struct { | 81 | struct { |
81 | int free; | 82 | int free; |
82 | int dirty; | 83 | int dirty; |
84 | int jhead; | ||
83 | }; | 85 | }; |
84 | }; | 86 | }; |
85 | }; | 87 | }; |
@@ -159,6 +161,11 @@ static int set_bud_lprops(struct ubifs_info *c, struct replay_entry *r) | |||
159 | err = PTR_ERR(lp); | 161 | err = PTR_ERR(lp); |
160 | goto out; | 162 | goto out; |
161 | } | 163 | } |
164 | |||
165 | /* Make sure the journal head points to the latest bud */ | ||
166 | err = ubifs_wbuf_seek_nolock(&c->jheads[r->jhead].wbuf, r->lnum, | ||
167 | c->leb_size - r->free, UBI_SHORTTERM); | ||
168 | |||
162 | out: | 169 | out: |
163 | ubifs_release_lprops(c); | 170 | ubifs_release_lprops(c); |
164 | return err; | 171 | return err; |
@@ -627,10 +634,6 @@ static int replay_bud(struct ubifs_info *c, int lnum, int offs, int jhead, | |||
627 | ubifs_assert(sleb->endpt - offs >= used); | 634 | ubifs_assert(sleb->endpt - offs >= used); |
628 | ubifs_assert(sleb->endpt % c->min_io_size == 0); | 635 | ubifs_assert(sleb->endpt % c->min_io_size == 0); |
629 | 636 | ||
630 | if (sleb->endpt + c->min_io_size <= c->leb_size && !c->ro_mount) | ||
631 | err = ubifs_wbuf_seek_nolock(&c->jheads[jhead].wbuf, lnum, | ||
632 | sleb->endpt, UBI_SHORTTERM); | ||
633 | |||
634 | *dirty = sleb->endpt - offs - used; | 637 | *dirty = sleb->endpt - offs - used; |
635 | *free = c->leb_size - sleb->endpt; | 638 | *free = c->leb_size - sleb->endpt; |
636 | 639 | ||
@@ -653,12 +656,14 @@ out_dump: | |||
653 | * @sqnum: sequence number | 656 | * @sqnum: sequence number |
654 | * @free: amount of free space in bud | 657 | * @free: amount of free space in bud |
655 | * @dirty: amount of dirty space from padding and deletion nodes | 658 | * @dirty: amount of dirty space from padding and deletion nodes |
659 | * @jhead: journal head number for the bud | ||
656 | * | 660 | * |
657 | * This function inserts a reference node to the replay tree and returns zero | 661 | * This function inserts a reference node to the replay tree and returns zero |
658 | * in case of success or a negative error code in case of failure. | 662 | * in case of success or a negative error code in case of failure. |
659 | */ | 663 | */ |
660 | static int insert_ref_node(struct ubifs_info *c, int lnum, int offs, | 664 | static int insert_ref_node(struct ubifs_info *c, int lnum, int offs, |
661 | unsigned long long sqnum, int free, int dirty) | 665 | unsigned long long sqnum, int free, int dirty, |
666 | int jhead) | ||
662 | { | 667 | { |
663 | struct rb_node **p = &c->replay_tree.rb_node, *parent = NULL; | 668 | struct rb_node **p = &c->replay_tree.rb_node, *parent = NULL; |
664 | struct replay_entry *r; | 669 | struct replay_entry *r; |
@@ -688,6 +693,7 @@ static int insert_ref_node(struct ubifs_info *c, int lnum, int offs, | |||
688 | r->flags = REPLAY_REF; | 693 | r->flags = REPLAY_REF; |
689 | r->free = free; | 694 | r->free = free; |
690 | r->dirty = dirty; | 695 | r->dirty = dirty; |
696 | r->jhead = jhead; | ||
691 | 697 | ||
692 | rb_link_node(&r->rb, parent, p); | 698 | rb_link_node(&r->rb, parent, p); |
693 | rb_insert_color(&r->rb, &c->replay_tree); | 699 | rb_insert_color(&r->rb, &c->replay_tree); |
@@ -712,7 +718,7 @@ static int replay_buds(struct ubifs_info *c) | |||
712 | if (err) | 718 | if (err) |
713 | return err; | 719 | return err; |
714 | err = insert_ref_node(c, b->bud->lnum, b->bud->start, b->sqnum, | 720 | err = insert_ref_node(c, b->bud->lnum, b->bud->start, b->sqnum, |
715 | free, dirty); | 721 | free, dirty, b->bud->jhead); |
716 | if (err) | 722 | if (err) |
717 | return err; | 723 | return err; |
718 | } | 724 | } |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index c75f6133206c..04ad07f4fcc3 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1257,12 +1257,12 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1257 | goto out_free; | 1257 | goto out_free; |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | err = alloc_wbufs(c); | ||
1261 | if (err) | ||
1262 | goto out_cbuf; | ||
1263 | |||
1260 | sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id); | 1264 | sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id); |
1261 | if (!c->ro_mount) { | 1265 | if (!c->ro_mount) { |
1262 | err = alloc_wbufs(c); | ||
1263 | if (err) | ||
1264 | goto out_cbuf; | ||
1265 | |||
1266 | /* Create background thread */ | 1266 | /* Create background thread */ |
1267 | c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name); | 1267 | c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name); |
1268 | if (IS_ERR(c->bgt)) { | 1268 | if (IS_ERR(c->bgt)) { |
@@ -1631,12 +1631,6 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1631 | if (err) | 1631 | if (err) |
1632 | goto out; | 1632 | goto out; |
1633 | 1633 | ||
1634 | err = alloc_wbufs(c); | ||
1635 | if (err) | ||
1636 | goto out; | ||
1637 | |||
1638 | ubifs_create_buds_lists(c); | ||
1639 | |||
1640 | /* Create background thread */ | 1634 | /* Create background thread */ |
1641 | c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name); | 1635 | c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name); |
1642 | if (IS_ERR(c->bgt)) { | 1636 | if (IS_ERR(c->bgt)) { |
@@ -1671,14 +1665,25 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1671 | if (err) | 1665 | if (err) |
1672 | goto out; | 1666 | goto out; |
1673 | 1667 | ||
1668 | dbg_gen("re-mounted read-write"); | ||
1669 | c->remounting_rw = 0; | ||
1670 | |||
1674 | if (c->need_recovery) { | 1671 | if (c->need_recovery) { |
1675 | c->need_recovery = 0; | 1672 | c->need_recovery = 0; |
1676 | ubifs_msg("deferred recovery completed"); | 1673 | ubifs_msg("deferred recovery completed"); |
1674 | } else { | ||
1675 | /* | ||
1676 | * Do not run the debugging space check if the were doing | ||
1677 | * recovery, because when we saved the information we had the | ||
1678 | * file-system in a state where the TNC and lprops has been | ||
1679 | * modified in memory, but all the I/O operations (including a | ||
1680 | * commit) were deferred. So the file-system was in | ||
1681 | * "non-committed" state. Now the file-system is in committed | ||
1682 | * state, and of course the amount of free space will change | ||
1683 | * because, for example, the old index size was imprecise. | ||
1684 | */ | ||
1685 | err = dbg_check_space_info(c); | ||
1677 | } | 1686 | } |
1678 | |||
1679 | dbg_gen("re-mounted read-write"); | ||
1680 | c->remounting_rw = 0; | ||
1681 | err = dbg_check_space_info(c); | ||
1682 | mutex_unlock(&c->umount_mutex); | 1687 | mutex_unlock(&c->umount_mutex); |
1683 | return err; | 1688 | return err; |
1684 | 1689 | ||
@@ -1733,7 +1738,6 @@ static void ubifs_remount_ro(struct ubifs_info *c) | |||
1733 | if (err) | 1738 | if (err) |
1734 | ubifs_ro_mode(c, err); | 1739 | ubifs_ro_mode(c, err); |
1735 | 1740 | ||
1736 | free_wbufs(c); | ||
1737 | vfree(c->orph_buf); | 1741 | vfree(c->orph_buf); |
1738 | c->orph_buf = NULL; | 1742 | c->orph_buf = NULL; |
1739 | kfree(c->write_reserve_buf); | 1743 | kfree(c->write_reserve_buf); |
@@ -1761,10 +1765,12 @@ static void ubifs_put_super(struct super_block *sb) | |||
1761 | * of the media. For example, there will be dirty inodes if we failed | 1765 | * of the media. For example, there will be dirty inodes if we failed |
1762 | * to write them back because of I/O errors. | 1766 | * to write them back because of I/O errors. |
1763 | */ | 1767 | */ |
1764 | ubifs_assert(atomic_long_read(&c->dirty_pg_cnt) == 0); | 1768 | if (!c->ro_error) { |
1765 | ubifs_assert(c->budg_idx_growth == 0); | 1769 | ubifs_assert(atomic_long_read(&c->dirty_pg_cnt) == 0); |
1766 | ubifs_assert(c->budg_dd_growth == 0); | 1770 | ubifs_assert(c->budg_idx_growth == 0); |
1767 | ubifs_assert(c->budg_data_growth == 0); | 1771 | ubifs_assert(c->budg_dd_growth == 0); |
1772 | ubifs_assert(c->budg_data_growth == 0); | ||
1773 | } | ||
1768 | 1774 | ||
1769 | /* | 1775 | /* |
1770 | * The 'c->umount_lock' prevents races between UBIFS memory shrinker | 1776 | * The 'c->umount_lock' prevents races between UBIFS memory shrinker |
diff --git a/fs/xattr.c b/fs/xattr.c index a19acdb81cd1..f1ef94974dea 100644 --- a/fs/xattr.c +++ b/fs/xattr.c | |||
@@ -666,7 +666,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz | |||
666 | handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); | 666 | handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); |
667 | if (!handler) | 667 | if (!handler) |
668 | return -EOPNOTSUPP; | 668 | return -EOPNOTSUPP; |
669 | return handler->set(dentry, name, value, size, 0, handler->flags); | 669 | return handler->set(dentry, name, value, size, flags, handler->flags); |
670 | } | 670 | } |
671 | 671 | ||
672 | /* | 672 | /* |
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 5ea402023ebd..9ef9ed2cfe2e 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -293,7 +293,6 @@ xfs_buf_allocate_memory( | |||
293 | size_t nbytes, offset; | 293 | size_t nbytes, offset; |
294 | gfp_t gfp_mask = xb_to_gfp(flags); | 294 | gfp_t gfp_mask = xb_to_gfp(flags); |
295 | unsigned short page_count, i; | 295 | unsigned short page_count, i; |
296 | pgoff_t first; | ||
297 | xfs_off_t end; | 296 | xfs_off_t end; |
298 | int error; | 297 | int error; |
299 | 298 | ||
@@ -333,7 +332,6 @@ use_alloc_page: | |||
333 | return error; | 332 | return error; |
334 | 333 | ||
335 | offset = bp->b_offset; | 334 | offset = bp->b_offset; |
336 | first = bp->b_file_offset >> PAGE_SHIFT; | ||
337 | bp->b_flags |= _XBF_PAGES; | 335 | bp->b_flags |= _XBF_PAGES; |
338 | 336 | ||
339 | for (i = 0; i < bp->b_page_count; i++) { | 337 | for (i = 0; i < bp->b_page_count; i++) { |
@@ -657,8 +655,6 @@ xfs_buf_readahead( | |||
657 | xfs_off_t ioff, | 655 | xfs_off_t ioff, |
658 | size_t isize) | 656 | size_t isize) |
659 | { | 657 | { |
660 | struct backing_dev_info *bdi; | ||
661 | |||
662 | if (bdi_read_congested(target->bt_bdi)) | 658 | if (bdi_read_congested(target->bt_bdi)) |
663 | return; | 659 | return; |
664 | 660 | ||
@@ -919,8 +915,6 @@ xfs_buf_lock( | |||
919 | 915 | ||
920 | if (atomic_read(&bp->b_pin_count) && (bp->b_flags & XBF_STALE)) | 916 | if (atomic_read(&bp->b_pin_count) && (bp->b_flags & XBF_STALE)) |
921 | xfs_log_force(bp->b_target->bt_mount, 0); | 917 | xfs_log_force(bp->b_target->bt_mount, 0); |
922 | if (atomic_read(&bp->b_io_remaining)) | ||
923 | blk_flush_plug(current); | ||
924 | down(&bp->b_sema); | 918 | down(&bp->b_sema); |
925 | XB_SET_OWNER(bp); | 919 | XB_SET_OWNER(bp); |
926 | 920 | ||
@@ -1309,8 +1303,6 @@ xfs_buf_iowait( | |||
1309 | { | 1303 | { |
1310 | trace_xfs_buf_iowait(bp, _RET_IP_); | 1304 | trace_xfs_buf_iowait(bp, _RET_IP_); |
1311 | 1305 | ||
1312 | if (atomic_read(&bp->b_io_remaining)) | ||
1313 | blk_flush_plug(current); | ||
1314 | wait_for_completion(&bp->b_iowait); | 1306 | wait_for_completion(&bp->b_iowait); |
1315 | 1307 | ||
1316 | trace_xfs_buf_iowait_done(bp, _RET_IP_); | 1308 | trace_xfs_buf_iowait_done(bp, _RET_IP_); |
@@ -1747,8 +1739,8 @@ xfsbufd( | |||
1747 | do { | 1739 | do { |
1748 | long age = xfs_buf_age_centisecs * msecs_to_jiffies(10); | 1740 | long age = xfs_buf_age_centisecs * msecs_to_jiffies(10); |
1749 | long tout = xfs_buf_timer_centisecs * msecs_to_jiffies(10); | 1741 | long tout = xfs_buf_timer_centisecs * msecs_to_jiffies(10); |
1750 | int count = 0; | ||
1751 | struct list_head tmp; | 1742 | struct list_head tmp; |
1743 | struct blk_plug plug; | ||
1752 | 1744 | ||
1753 | if (unlikely(freezing(current))) { | 1745 | if (unlikely(freezing(current))) { |
1754 | set_bit(XBT_FORCE_SLEEP, &target->bt_flags); | 1746 | set_bit(XBT_FORCE_SLEEP, &target->bt_flags); |
@@ -1764,16 +1756,15 @@ xfsbufd( | |||
1764 | 1756 | ||
1765 | xfs_buf_delwri_split(target, &tmp, age); | 1757 | xfs_buf_delwri_split(target, &tmp, age); |
1766 | list_sort(NULL, &tmp, xfs_buf_cmp); | 1758 | list_sort(NULL, &tmp, xfs_buf_cmp); |
1759 | |||
1760 | blk_start_plug(&plug); | ||
1767 | while (!list_empty(&tmp)) { | 1761 | while (!list_empty(&tmp)) { |
1768 | struct xfs_buf *bp; | 1762 | struct xfs_buf *bp; |
1769 | bp = list_first_entry(&tmp, struct xfs_buf, b_list); | 1763 | bp = list_first_entry(&tmp, struct xfs_buf, b_list); |
1770 | list_del_init(&bp->b_list); | 1764 | list_del_init(&bp->b_list); |
1771 | xfs_bdstrat_cb(bp); | 1765 | xfs_bdstrat_cb(bp); |
1772 | count++; | ||
1773 | } | 1766 | } |
1774 | if (count) | 1767 | blk_finish_plug(&plug); |
1775 | blk_flush_plug(current); | ||
1776 | |||
1777 | } while (!kthread_should_stop()); | 1768 | } while (!kthread_should_stop()); |
1778 | 1769 | ||
1779 | return 0; | 1770 | return 0; |
@@ -1793,6 +1784,7 @@ xfs_flush_buftarg( | |||
1793 | int pincount = 0; | 1784 | int pincount = 0; |
1794 | LIST_HEAD(tmp_list); | 1785 | LIST_HEAD(tmp_list); |
1795 | LIST_HEAD(wait_list); | 1786 | LIST_HEAD(wait_list); |
1787 | struct blk_plug plug; | ||
1796 | 1788 | ||
1797 | xfs_buf_runall_queues(xfsconvertd_workqueue); | 1789 | xfs_buf_runall_queues(xfsconvertd_workqueue); |
1798 | xfs_buf_runall_queues(xfsdatad_workqueue); | 1790 | xfs_buf_runall_queues(xfsdatad_workqueue); |
@@ -1807,6 +1799,8 @@ xfs_flush_buftarg( | |||
1807 | * we do that after issuing all the IO. | 1799 | * we do that after issuing all the IO. |
1808 | */ | 1800 | */ |
1809 | list_sort(NULL, &tmp_list, xfs_buf_cmp); | 1801 | list_sort(NULL, &tmp_list, xfs_buf_cmp); |
1802 | |||
1803 | blk_start_plug(&plug); | ||
1810 | while (!list_empty(&tmp_list)) { | 1804 | while (!list_empty(&tmp_list)) { |
1811 | bp = list_first_entry(&tmp_list, struct xfs_buf, b_list); | 1805 | bp = list_first_entry(&tmp_list, struct xfs_buf, b_list); |
1812 | ASSERT(target == bp->b_target); | 1806 | ASSERT(target == bp->b_target); |
@@ -1817,10 +1811,10 @@ xfs_flush_buftarg( | |||
1817 | } | 1811 | } |
1818 | xfs_bdstrat_cb(bp); | 1812 | xfs_bdstrat_cb(bp); |
1819 | } | 1813 | } |
1814 | blk_finish_plug(&plug); | ||
1820 | 1815 | ||
1821 | if (wait) { | 1816 | if (wait) { |
1822 | /* Expedite and wait for IO to complete. */ | 1817 | /* Wait for IO to complete. */ |
1823 | blk_flush_plug(current); | ||
1824 | while (!list_empty(&wait_list)) { | 1818 | while (!list_empty(&wait_list)) { |
1825 | bp = list_first_entry(&wait_list, struct xfs_buf, b_list); | 1819 | bp = list_first_entry(&wait_list, struct xfs_buf, b_list); |
1826 | 1820 | ||
diff --git a/fs/xfs/linux-2.6/xfs_message.c b/fs/xfs/linux-2.6/xfs_message.c index 508e06fd7d1e..9f76cceb678d 100644 --- a/fs/xfs/linux-2.6/xfs_message.c +++ b/fs/xfs/linux-2.6/xfs_message.c | |||
@@ -28,53 +28,49 @@ | |||
28 | /* | 28 | /* |
29 | * XFS logging functions | 29 | * XFS logging functions |
30 | */ | 30 | */ |
31 | static int | 31 | static void |
32 | __xfs_printk( | 32 | __xfs_printk( |
33 | const char *level, | 33 | const char *level, |
34 | const struct xfs_mount *mp, | 34 | const struct xfs_mount *mp, |
35 | struct va_format *vaf) | 35 | struct va_format *vaf) |
36 | { | 36 | { |
37 | if (mp && mp->m_fsname) | 37 | if (mp && mp->m_fsname) { |
38 | return printk("%sXFS (%s): %pV\n", level, mp->m_fsname, vaf); | 38 | printk("%sXFS (%s): %pV\n", level, mp->m_fsname, vaf); |
39 | return printk("%sXFS: %pV\n", level, vaf); | 39 | return; |
40 | } | ||
41 | printk("%sXFS: %pV\n", level, vaf); | ||
40 | } | 42 | } |
41 | 43 | ||
42 | int xfs_printk( | 44 | void xfs_printk( |
43 | const char *level, | 45 | const char *level, |
44 | const struct xfs_mount *mp, | 46 | const struct xfs_mount *mp, |
45 | const char *fmt, ...) | 47 | const char *fmt, ...) |
46 | { | 48 | { |
47 | struct va_format vaf; | 49 | struct va_format vaf; |
48 | va_list args; | 50 | va_list args; |
49 | int r; | ||
50 | 51 | ||
51 | va_start(args, fmt); | 52 | va_start(args, fmt); |
52 | 53 | ||
53 | vaf.fmt = fmt; | 54 | vaf.fmt = fmt; |
54 | vaf.va = &args; | 55 | vaf.va = &args; |
55 | 56 | ||
56 | r = __xfs_printk(level, mp, &vaf); | 57 | __xfs_printk(level, mp, &vaf); |
57 | va_end(args); | 58 | va_end(args); |
58 | |||
59 | return r; | ||
60 | } | 59 | } |
61 | 60 | ||
62 | #define define_xfs_printk_level(func, kern_level) \ | 61 | #define define_xfs_printk_level(func, kern_level) \ |
63 | int func(const struct xfs_mount *mp, const char *fmt, ...) \ | 62 | void func(const struct xfs_mount *mp, const char *fmt, ...) \ |
64 | { \ | 63 | { \ |
65 | struct va_format vaf; \ | 64 | struct va_format vaf; \ |
66 | va_list args; \ | 65 | va_list args; \ |
67 | int r; \ | ||
68 | \ | 66 | \ |
69 | va_start(args, fmt); \ | 67 | va_start(args, fmt); \ |
70 | \ | 68 | \ |
71 | vaf.fmt = fmt; \ | 69 | vaf.fmt = fmt; \ |
72 | vaf.va = &args; \ | 70 | vaf.va = &args; \ |
73 | \ | 71 | \ |
74 | r = __xfs_printk(kern_level, mp, &vaf); \ | 72 | __xfs_printk(kern_level, mp, &vaf); \ |
75 | va_end(args); \ | 73 | va_end(args); \ |
76 | \ | ||
77 | return r; \ | ||
78 | } \ | 74 | } \ |
79 | 75 | ||
80 | define_xfs_printk_level(xfs_emerg, KERN_EMERG); | 76 | define_xfs_printk_level(xfs_emerg, KERN_EMERG); |
@@ -88,7 +84,7 @@ define_xfs_printk_level(xfs_info, KERN_INFO); | |||
88 | define_xfs_printk_level(xfs_debug, KERN_DEBUG); | 84 | define_xfs_printk_level(xfs_debug, KERN_DEBUG); |
89 | #endif | 85 | #endif |
90 | 86 | ||
91 | int | 87 | void |
92 | xfs_alert_tag( | 88 | xfs_alert_tag( |
93 | const struct xfs_mount *mp, | 89 | const struct xfs_mount *mp, |
94 | int panic_tag, | 90 | int panic_tag, |
@@ -97,7 +93,6 @@ xfs_alert_tag( | |||
97 | struct va_format vaf; | 93 | struct va_format vaf; |
98 | va_list args; | 94 | va_list args; |
99 | int do_panic = 0; | 95 | int do_panic = 0; |
100 | int r; | ||
101 | 96 | ||
102 | if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) { | 97 | if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) { |
103 | xfs_printk(KERN_ALERT, mp, | 98 | xfs_printk(KERN_ALERT, mp, |
@@ -110,12 +105,10 @@ xfs_alert_tag( | |||
110 | vaf.fmt = fmt; | 105 | vaf.fmt = fmt; |
111 | vaf.va = &args; | 106 | vaf.va = &args; |
112 | 107 | ||
113 | r = __xfs_printk(KERN_ALERT, mp, &vaf); | 108 | __xfs_printk(KERN_ALERT, mp, &vaf); |
114 | va_end(args); | 109 | va_end(args); |
115 | 110 | ||
116 | BUG_ON(do_panic); | 111 | BUG_ON(do_panic); |
117 | |||
118 | return r; | ||
119 | } | 112 | } |
120 | 113 | ||
121 | void | 114 | void |
diff --git a/fs/xfs/linux-2.6/xfs_message.h b/fs/xfs/linux-2.6/xfs_message.h index e77ffa16745b..f1b3fc1b6c4e 100644 --- a/fs/xfs/linux-2.6/xfs_message.h +++ b/fs/xfs/linux-2.6/xfs_message.h | |||
@@ -3,32 +3,34 @@ | |||
3 | 3 | ||
4 | struct xfs_mount; | 4 | struct xfs_mount; |
5 | 5 | ||
6 | extern int xfs_printk(const char *level, const struct xfs_mount *mp, | 6 | extern void xfs_printk(const char *level, const struct xfs_mount *mp, |
7 | const char *fmt, ...) | 7 | const char *fmt, ...) |
8 | __attribute__ ((format (printf, 3, 4))); | 8 | __attribute__ ((format (printf, 3, 4))); |
9 | extern int xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...) | 9 | extern void xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...) |
10 | __attribute__ ((format (printf, 2, 3))); | 10 | __attribute__ ((format (printf, 2, 3))); |
11 | extern int xfs_alert(const struct xfs_mount *mp, const char *fmt, ...) | 11 | extern void xfs_alert(const struct xfs_mount *mp, const char *fmt, ...) |
12 | __attribute__ ((format (printf, 2, 3))); | 12 | __attribute__ ((format (printf, 2, 3))); |
13 | extern int xfs_alert_tag(const struct xfs_mount *mp, int tag, | 13 | extern void xfs_alert_tag(const struct xfs_mount *mp, int tag, |
14 | const char *fmt, ...) | 14 | const char *fmt, ...) |
15 | __attribute__ ((format (printf, 3, 4))); | 15 | __attribute__ ((format (printf, 3, 4))); |
16 | extern int xfs_crit(const struct xfs_mount *mp, const char *fmt, ...) | 16 | extern void xfs_crit(const struct xfs_mount *mp, const char *fmt, ...) |
17 | __attribute__ ((format (printf, 2, 3))); | 17 | __attribute__ ((format (printf, 2, 3))); |
18 | extern int xfs_err(const struct xfs_mount *mp, const char *fmt, ...) | 18 | extern void xfs_err(const struct xfs_mount *mp, const char *fmt, ...) |
19 | __attribute__ ((format (printf, 2, 3))); | 19 | __attribute__ ((format (printf, 2, 3))); |
20 | extern int xfs_warn(const struct xfs_mount *mp, const char *fmt, ...) | 20 | extern void xfs_warn(const struct xfs_mount *mp, const char *fmt, ...) |
21 | __attribute__ ((format (printf, 2, 3))); | 21 | __attribute__ ((format (printf, 2, 3))); |
22 | extern int xfs_notice(const struct xfs_mount *mp, const char *fmt, ...) | 22 | extern void xfs_notice(const struct xfs_mount *mp, const char *fmt, ...) |
23 | __attribute__ ((format (printf, 2, 3))); | 23 | __attribute__ ((format (printf, 2, 3))); |
24 | extern int xfs_info(const struct xfs_mount *mp, const char *fmt, ...) | 24 | extern void xfs_info(const struct xfs_mount *mp, const char *fmt, ...) |
25 | __attribute__ ((format (printf, 2, 3))); | 25 | __attribute__ ((format (printf, 2, 3))); |
26 | 26 | ||
27 | #ifdef DEBUG | 27 | #ifdef DEBUG |
28 | extern int xfs_debug(const struct xfs_mount *mp, const char *fmt, ...) | 28 | extern void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...) |
29 | __attribute__ ((format (printf, 2, 3))); | 29 | __attribute__ ((format (printf, 2, 3))); |
30 | #else | 30 | #else |
31 | #define xfs_debug(mp, fmt, ...) (0) | 31 | static inline void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...) |
32 | { | ||
33 | } | ||
32 | #endif | 34 | #endif |
33 | 35 | ||
34 | extern void assfail(char *expr, char *f, int l); | 36 | extern void assfail(char *expr, char *f, int l); |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 1ba5c451da36..b38e58d02299 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -816,75 +816,6 @@ xfs_setup_devices( | |||
816 | return 0; | 816 | return 0; |
817 | } | 817 | } |
818 | 818 | ||
819 | /* | ||
820 | * XFS AIL push thread support | ||
821 | */ | ||
822 | void | ||
823 | xfsaild_wakeup( | ||
824 | struct xfs_ail *ailp, | ||
825 | xfs_lsn_t threshold_lsn) | ||
826 | { | ||
827 | /* only ever move the target forwards */ | ||
828 | if (XFS_LSN_CMP(threshold_lsn, ailp->xa_target) > 0) { | ||
829 | ailp->xa_target = threshold_lsn; | ||
830 | wake_up_process(ailp->xa_task); | ||
831 | } | ||
832 | } | ||
833 | |||
834 | STATIC int | ||
835 | xfsaild( | ||
836 | void *data) | ||
837 | { | ||
838 | struct xfs_ail *ailp = data; | ||
839 | xfs_lsn_t last_pushed_lsn = 0; | ||
840 | long tout = 0; /* milliseconds */ | ||
841 | |||
842 | while (!kthread_should_stop()) { | ||
843 | /* | ||
844 | * for short sleeps indicating congestion, don't allow us to | ||
845 | * get woken early. Otherwise all we do is bang on the AIL lock | ||
846 | * without making progress. | ||
847 | */ | ||
848 | if (tout && tout <= 20) | ||
849 | __set_current_state(TASK_KILLABLE); | ||
850 | else | ||
851 | __set_current_state(TASK_INTERRUPTIBLE); | ||
852 | schedule_timeout(tout ? | ||
853 | msecs_to_jiffies(tout) : MAX_SCHEDULE_TIMEOUT); | ||
854 | |||
855 | /* swsusp */ | ||
856 | try_to_freeze(); | ||
857 | |||
858 | ASSERT(ailp->xa_mount->m_log); | ||
859 | if (XFS_FORCED_SHUTDOWN(ailp->xa_mount)) | ||
860 | continue; | ||
861 | |||
862 | tout = xfsaild_push(ailp, &last_pushed_lsn); | ||
863 | } | ||
864 | |||
865 | return 0; | ||
866 | } /* xfsaild */ | ||
867 | |||
868 | int | ||
869 | xfsaild_start( | ||
870 | struct xfs_ail *ailp) | ||
871 | { | ||
872 | ailp->xa_target = 0; | ||
873 | ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild/%s", | ||
874 | ailp->xa_mount->m_fsname); | ||
875 | if (IS_ERR(ailp->xa_task)) | ||
876 | return -PTR_ERR(ailp->xa_task); | ||
877 | return 0; | ||
878 | } | ||
879 | |||
880 | void | ||
881 | xfsaild_stop( | ||
882 | struct xfs_ail *ailp) | ||
883 | { | ||
884 | kthread_stop(ailp->xa_task); | ||
885 | } | ||
886 | |||
887 | |||
888 | /* Catch misguided souls that try to use this interface on XFS */ | 819 | /* Catch misguided souls that try to use this interface on XFS */ |
889 | STATIC struct inode * | 820 | STATIC struct inode * |
890 | xfs_fs_alloc_inode( | 821 | xfs_fs_alloc_inode( |
@@ -1191,22 +1122,12 @@ xfs_fs_sync_fs( | |||
1191 | return -error; | 1122 | return -error; |
1192 | 1123 | ||
1193 | if (laptop_mode) { | 1124 | if (laptop_mode) { |
1194 | int prev_sync_seq = mp->m_sync_seq; | ||
1195 | |||
1196 | /* | 1125 | /* |
1197 | * The disk must be active because we're syncing. | 1126 | * The disk must be active because we're syncing. |
1198 | * We schedule xfssyncd now (now that the disk is | 1127 | * We schedule xfssyncd now (now that the disk is |
1199 | * active) instead of later (when it might not be). | 1128 | * active) instead of later (when it might not be). |
1200 | */ | 1129 | */ |
1201 | wake_up_process(mp->m_sync_task); | 1130 | flush_delayed_work_sync(&mp->m_sync_work); |
1202 | /* | ||
1203 | * We have to wait for the sync iteration to complete. | ||
1204 | * If we don't, the disk activity caused by the sync | ||
1205 | * will come after the sync is completed, and that | ||
1206 | * triggers another sync from laptop mode. | ||
1207 | */ | ||
1208 | wait_event(mp->m_wait_single_sync_task, | ||
1209 | mp->m_sync_seq != prev_sync_seq); | ||
1210 | } | 1131 | } |
1211 | 1132 | ||
1212 | return 0; | 1133 | return 0; |
@@ -1490,9 +1411,6 @@ xfs_fs_fill_super( | |||
1490 | spin_lock_init(&mp->m_sb_lock); | 1411 | spin_lock_init(&mp->m_sb_lock); |
1491 | mutex_init(&mp->m_growlock); | 1412 | mutex_init(&mp->m_growlock); |
1492 | atomic_set(&mp->m_active_trans, 0); | 1413 | atomic_set(&mp->m_active_trans, 0); |
1493 | INIT_LIST_HEAD(&mp->m_sync_list); | ||
1494 | spin_lock_init(&mp->m_sync_lock); | ||
1495 | init_waitqueue_head(&mp->m_wait_single_sync_task); | ||
1496 | 1414 | ||
1497 | mp->m_super = sb; | 1415 | mp->m_super = sb; |
1498 | sb->s_fs_info = mp; | 1416 | sb->s_fs_info = mp; |
@@ -1799,6 +1717,38 @@ xfs_destroy_zones(void) | |||
1799 | } | 1717 | } |
1800 | 1718 | ||
1801 | STATIC int __init | 1719 | STATIC int __init |
1720 | xfs_init_workqueues(void) | ||
1721 | { | ||
1722 | /* | ||
1723 | * max_active is set to 8 to give enough concurency to allow | ||
1724 | * multiple work operations on each CPU to run. This allows multiple | ||
1725 | * filesystems to be running sync work concurrently, and scales with | ||
1726 | * the number of CPUs in the system. | ||
1727 | */ | ||
1728 | xfs_syncd_wq = alloc_workqueue("xfssyncd", WQ_CPU_INTENSIVE, 8); | ||
1729 | if (!xfs_syncd_wq) | ||
1730 | goto out; | ||
1731 | |||
1732 | xfs_ail_wq = alloc_workqueue("xfsail", WQ_CPU_INTENSIVE, 8); | ||
1733 | if (!xfs_ail_wq) | ||
1734 | goto out_destroy_syncd; | ||
1735 | |||
1736 | return 0; | ||
1737 | |||
1738 | out_destroy_syncd: | ||
1739 | destroy_workqueue(xfs_syncd_wq); | ||
1740 | out: | ||
1741 | return -ENOMEM; | ||
1742 | } | ||
1743 | |||
1744 | STATIC void | ||
1745 | xfs_destroy_workqueues(void) | ||
1746 | { | ||
1747 | destroy_workqueue(xfs_ail_wq); | ||
1748 | destroy_workqueue(xfs_syncd_wq); | ||
1749 | } | ||
1750 | |||
1751 | STATIC int __init | ||
1802 | init_xfs_fs(void) | 1752 | init_xfs_fs(void) |
1803 | { | 1753 | { |
1804 | int error; | 1754 | int error; |
@@ -1813,10 +1763,14 @@ init_xfs_fs(void) | |||
1813 | if (error) | 1763 | if (error) |
1814 | goto out; | 1764 | goto out; |
1815 | 1765 | ||
1816 | error = xfs_mru_cache_init(); | 1766 | error = xfs_init_workqueues(); |
1817 | if (error) | 1767 | if (error) |
1818 | goto out_destroy_zones; | 1768 | goto out_destroy_zones; |
1819 | 1769 | ||
1770 | error = xfs_mru_cache_init(); | ||
1771 | if (error) | ||
1772 | goto out_destroy_wq; | ||
1773 | |||
1820 | error = xfs_filestream_init(); | 1774 | error = xfs_filestream_init(); |
1821 | if (error) | 1775 | if (error) |
1822 | goto out_mru_cache_uninit; | 1776 | goto out_mru_cache_uninit; |
@@ -1833,6 +1787,10 @@ init_xfs_fs(void) | |||
1833 | if (error) | 1787 | if (error) |
1834 | goto out_cleanup_procfs; | 1788 | goto out_cleanup_procfs; |
1835 | 1789 | ||
1790 | error = xfs_init_workqueues(); | ||
1791 | if (error) | ||
1792 | goto out_sysctl_unregister; | ||
1793 | |||
1836 | vfs_initquota(); | 1794 | vfs_initquota(); |
1837 | 1795 | ||
1838 | error = register_filesystem(&xfs_fs_type); | 1796 | error = register_filesystem(&xfs_fs_type); |
@@ -1850,6 +1808,8 @@ init_xfs_fs(void) | |||
1850 | xfs_filestream_uninit(); | 1808 | xfs_filestream_uninit(); |
1851 | out_mru_cache_uninit: | 1809 | out_mru_cache_uninit: |
1852 | xfs_mru_cache_uninit(); | 1810 | xfs_mru_cache_uninit(); |
1811 | out_destroy_wq: | ||
1812 | xfs_destroy_workqueues(); | ||
1853 | out_destroy_zones: | 1813 | out_destroy_zones: |
1854 | xfs_destroy_zones(); | 1814 | xfs_destroy_zones(); |
1855 | out: | 1815 | out: |
@@ -1866,6 +1826,7 @@ exit_xfs_fs(void) | |||
1866 | xfs_buf_terminate(); | 1826 | xfs_buf_terminate(); |
1867 | xfs_filestream_uninit(); | 1827 | xfs_filestream_uninit(); |
1868 | xfs_mru_cache_uninit(); | 1828 | xfs_mru_cache_uninit(); |
1829 | xfs_destroy_workqueues(); | ||
1869 | xfs_destroy_zones(); | 1830 | xfs_destroy_zones(); |
1870 | } | 1831 | } |
1871 | 1832 | ||
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index 9cf35a688f53..e4f9c1b0836c 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "xfs_log.h" | 22 | #include "xfs_log.h" |
23 | #include "xfs_inum.h" | 23 | #include "xfs_inum.h" |
24 | #include "xfs_trans.h" | 24 | #include "xfs_trans.h" |
25 | #include "xfs_trans_priv.h" | ||
25 | #include "xfs_sb.h" | 26 | #include "xfs_sb.h" |
26 | #include "xfs_ag.h" | 27 | #include "xfs_ag.h" |
27 | #include "xfs_mount.h" | 28 | #include "xfs_mount.h" |
@@ -39,6 +40,8 @@ | |||
39 | #include <linux/kthread.h> | 40 | #include <linux/kthread.h> |
40 | #include <linux/freezer.h> | 41 | #include <linux/freezer.h> |
41 | 42 | ||
43 | struct workqueue_struct *xfs_syncd_wq; /* sync workqueue */ | ||
44 | |||
42 | /* | 45 | /* |
43 | * The inode lookup is done in batches to keep the amount of lock traffic and | 46 | * The inode lookup is done in batches to keep the amount of lock traffic and |
44 | * radix tree lookups to a minimum. The batch size is a trade off between | 47 | * radix tree lookups to a minimum. The batch size is a trade off between |
@@ -431,62 +434,12 @@ xfs_quiesce_attr( | |||
431 | xfs_unmountfs_writesb(mp); | 434 | xfs_unmountfs_writesb(mp); |
432 | } | 435 | } |
433 | 436 | ||
434 | /* | 437 | static void |
435 | * Enqueue a work item to be picked up by the vfs xfssyncd thread. | 438 | xfs_syncd_queue_sync( |
436 | * Doing this has two advantages: | 439 | struct xfs_mount *mp) |
437 | * - It saves on stack space, which is tight in certain situations | ||
438 | * - It can be used (with care) as a mechanism to avoid deadlocks. | ||
439 | * Flushing while allocating in a full filesystem requires both. | ||
440 | */ | ||
441 | STATIC void | ||
442 | xfs_syncd_queue_work( | ||
443 | struct xfs_mount *mp, | ||
444 | void *data, | ||
445 | void (*syncer)(struct xfs_mount *, void *), | ||
446 | struct completion *completion) | ||
447 | { | ||
448 | struct xfs_sync_work *work; | ||
449 | |||
450 | work = kmem_alloc(sizeof(struct xfs_sync_work), KM_SLEEP); | ||
451 | INIT_LIST_HEAD(&work->w_list); | ||
452 | work->w_syncer = syncer; | ||
453 | work->w_data = data; | ||
454 | work->w_mount = mp; | ||
455 | work->w_completion = completion; | ||
456 | spin_lock(&mp->m_sync_lock); | ||
457 | list_add_tail(&work->w_list, &mp->m_sync_list); | ||
458 | spin_unlock(&mp->m_sync_lock); | ||
459 | wake_up_process(mp->m_sync_task); | ||
460 | } | ||
461 | |||
462 | /* | ||
463 | * Flush delayed allocate data, attempting to free up reserved space | ||
464 | * from existing allocations. At this point a new allocation attempt | ||
465 | * has failed with ENOSPC and we are in the process of scratching our | ||
466 | * heads, looking about for more room... | ||
467 | */ | ||
468 | STATIC void | ||
469 | xfs_flush_inodes_work( | ||
470 | struct xfs_mount *mp, | ||
471 | void *arg) | ||
472 | { | ||
473 | struct inode *inode = arg; | ||
474 | xfs_sync_data(mp, SYNC_TRYLOCK); | ||
475 | xfs_sync_data(mp, SYNC_TRYLOCK | SYNC_WAIT); | ||
476 | iput(inode); | ||
477 | } | ||
478 | |||
479 | void | ||
480 | xfs_flush_inodes( | ||
481 | xfs_inode_t *ip) | ||
482 | { | 440 | { |
483 | struct inode *inode = VFS_I(ip); | 441 | queue_delayed_work(xfs_syncd_wq, &mp->m_sync_work, |
484 | DECLARE_COMPLETION_ONSTACK(completion); | 442 | msecs_to_jiffies(xfs_syncd_centisecs * 10)); |
485 | |||
486 | igrab(inode); | ||
487 | xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_inodes_work, &completion); | ||
488 | wait_for_completion(&completion); | ||
489 | xfs_log_force(ip->i_mount, XFS_LOG_SYNC); | ||
490 | } | 443 | } |
491 | 444 | ||
492 | /* | 445 | /* |
@@ -496,9 +449,10 @@ xfs_flush_inodes( | |||
496 | */ | 449 | */ |
497 | STATIC void | 450 | STATIC void |
498 | xfs_sync_worker( | 451 | xfs_sync_worker( |
499 | struct xfs_mount *mp, | 452 | struct work_struct *work) |
500 | void *unused) | ||
501 | { | 453 | { |
454 | struct xfs_mount *mp = container_of(to_delayed_work(work), | ||
455 | struct xfs_mount, m_sync_work); | ||
502 | int error; | 456 | int error; |
503 | 457 | ||
504 | if (!(mp->m_flags & XFS_MOUNT_RDONLY)) { | 458 | if (!(mp->m_flags & XFS_MOUNT_RDONLY)) { |
@@ -508,73 +462,106 @@ xfs_sync_worker( | |||
508 | error = xfs_fs_log_dummy(mp); | 462 | error = xfs_fs_log_dummy(mp); |
509 | else | 463 | else |
510 | xfs_log_force(mp, 0); | 464 | xfs_log_force(mp, 0); |
511 | xfs_reclaim_inodes(mp, 0); | ||
512 | error = xfs_qm_sync(mp, SYNC_TRYLOCK); | 465 | error = xfs_qm_sync(mp, SYNC_TRYLOCK); |
466 | |||
467 | /* start pushing all the metadata that is currently dirty */ | ||
468 | xfs_ail_push_all(mp->m_ail); | ||
513 | } | 469 | } |
514 | mp->m_sync_seq++; | 470 | |
515 | wake_up(&mp->m_wait_single_sync_task); | 471 | /* queue us up again */ |
472 | xfs_syncd_queue_sync(mp); | ||
516 | } | 473 | } |
517 | 474 | ||
518 | STATIC int | 475 | /* |
519 | xfssyncd( | 476 | * Queue a new inode reclaim pass if there are reclaimable inodes and there |
520 | void *arg) | 477 | * isn't a reclaim pass already in progress. By default it runs every 5s based |
478 | * on the xfs syncd work default of 30s. Perhaps this should have it's own | ||
479 | * tunable, but that can be done if this method proves to be ineffective or too | ||
480 | * aggressive. | ||
481 | */ | ||
482 | static void | ||
483 | xfs_syncd_queue_reclaim( | ||
484 | struct xfs_mount *mp) | ||
521 | { | 485 | { |
522 | struct xfs_mount *mp = arg; | ||
523 | long timeleft; | ||
524 | xfs_sync_work_t *work, *n; | ||
525 | LIST_HEAD (tmp); | ||
526 | |||
527 | set_freezable(); | ||
528 | timeleft = xfs_syncd_centisecs * msecs_to_jiffies(10); | ||
529 | for (;;) { | ||
530 | if (list_empty(&mp->m_sync_list)) | ||
531 | timeleft = schedule_timeout_interruptible(timeleft); | ||
532 | /* swsusp */ | ||
533 | try_to_freeze(); | ||
534 | if (kthread_should_stop() && list_empty(&mp->m_sync_list)) | ||
535 | break; | ||
536 | 486 | ||
537 | spin_lock(&mp->m_sync_lock); | 487 | /* |
538 | /* | 488 | * We can have inodes enter reclaim after we've shut down the syncd |
539 | * We can get woken by laptop mode, to do a sync - | 489 | * workqueue during unmount, so don't allow reclaim work to be queued |
540 | * that's the (only!) case where the list would be | 490 | * during unmount. |
541 | * empty with time remaining. | 491 | */ |
542 | */ | 492 | if (!(mp->m_super->s_flags & MS_ACTIVE)) |
543 | if (!timeleft || list_empty(&mp->m_sync_list)) { | 493 | return; |
544 | if (!timeleft) | ||
545 | timeleft = xfs_syncd_centisecs * | ||
546 | msecs_to_jiffies(10); | ||
547 | INIT_LIST_HEAD(&mp->m_sync_work.w_list); | ||
548 | list_add_tail(&mp->m_sync_work.w_list, | ||
549 | &mp->m_sync_list); | ||
550 | } | ||
551 | list_splice_init(&mp->m_sync_list, &tmp); | ||
552 | spin_unlock(&mp->m_sync_lock); | ||
553 | 494 | ||
554 | list_for_each_entry_safe(work, n, &tmp, w_list) { | 495 | rcu_read_lock(); |
555 | (*work->w_syncer)(mp, work->w_data); | 496 | if (radix_tree_tagged(&mp->m_perag_tree, XFS_ICI_RECLAIM_TAG)) { |
556 | list_del(&work->w_list); | 497 | queue_delayed_work(xfs_syncd_wq, &mp->m_reclaim_work, |
557 | if (work == &mp->m_sync_work) | 498 | msecs_to_jiffies(xfs_syncd_centisecs / 6 * 10)); |
558 | continue; | ||
559 | if (work->w_completion) | ||
560 | complete(work->w_completion); | ||
561 | kmem_free(work); | ||
562 | } | ||
563 | } | 499 | } |
500 | rcu_read_unlock(); | ||
501 | } | ||
564 | 502 | ||
565 | return 0; | 503 | /* |
504 | * This is a fast pass over the inode cache to try to get reclaim moving on as | ||
505 | * many inodes as possible in a short period of time. It kicks itself every few | ||
506 | * seconds, as well as being kicked by the inode cache shrinker when memory | ||
507 | * goes low. It scans as quickly as possible avoiding locked inodes or those | ||
508 | * already being flushed, and once done schedules a future pass. | ||
509 | */ | ||
510 | STATIC void | ||
511 | xfs_reclaim_worker( | ||
512 | struct work_struct *work) | ||
513 | { | ||
514 | struct xfs_mount *mp = container_of(to_delayed_work(work), | ||
515 | struct xfs_mount, m_reclaim_work); | ||
516 | |||
517 | xfs_reclaim_inodes(mp, SYNC_TRYLOCK); | ||
518 | xfs_syncd_queue_reclaim(mp); | ||
519 | } | ||
520 | |||
521 | /* | ||
522 | * Flush delayed allocate data, attempting to free up reserved space | ||
523 | * from existing allocations. At this point a new allocation attempt | ||
524 | * has failed with ENOSPC and we are in the process of scratching our | ||
525 | * heads, looking about for more room. | ||
526 | * | ||
527 | * Queue a new data flush if there isn't one already in progress and | ||
528 | * wait for completion of the flush. This means that we only ever have one | ||
529 | * inode flush in progress no matter how many ENOSPC events are occurring and | ||
530 | * so will prevent the system from bogging down due to every concurrent | ||
531 | * ENOSPC event scanning all the active inodes in the system for writeback. | ||
532 | */ | ||
533 | void | ||
534 | xfs_flush_inodes( | ||
535 | struct xfs_inode *ip) | ||
536 | { | ||
537 | struct xfs_mount *mp = ip->i_mount; | ||
538 | |||
539 | queue_work(xfs_syncd_wq, &mp->m_flush_work); | ||
540 | flush_work_sync(&mp->m_flush_work); | ||
541 | } | ||
542 | |||
543 | STATIC void | ||
544 | xfs_flush_worker( | ||
545 | struct work_struct *work) | ||
546 | { | ||
547 | struct xfs_mount *mp = container_of(work, | ||
548 | struct xfs_mount, m_flush_work); | ||
549 | |||
550 | xfs_sync_data(mp, SYNC_TRYLOCK); | ||
551 | xfs_sync_data(mp, SYNC_TRYLOCK | SYNC_WAIT); | ||
566 | } | 552 | } |
567 | 553 | ||
568 | int | 554 | int |
569 | xfs_syncd_init( | 555 | xfs_syncd_init( |
570 | struct xfs_mount *mp) | 556 | struct xfs_mount *mp) |
571 | { | 557 | { |
572 | mp->m_sync_work.w_syncer = xfs_sync_worker; | 558 | INIT_WORK(&mp->m_flush_work, xfs_flush_worker); |
573 | mp->m_sync_work.w_mount = mp; | 559 | INIT_DELAYED_WORK(&mp->m_sync_work, xfs_sync_worker); |
574 | mp->m_sync_work.w_completion = NULL; | 560 | INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); |
575 | mp->m_sync_task = kthread_run(xfssyncd, mp, "xfssyncd/%s", mp->m_fsname); | 561 | |
576 | if (IS_ERR(mp->m_sync_task)) | 562 | xfs_syncd_queue_sync(mp); |
577 | return -PTR_ERR(mp->m_sync_task); | 563 | xfs_syncd_queue_reclaim(mp); |
564 | |||
578 | return 0; | 565 | return 0; |
579 | } | 566 | } |
580 | 567 | ||
@@ -582,7 +569,9 @@ void | |||
582 | xfs_syncd_stop( | 569 | xfs_syncd_stop( |
583 | struct xfs_mount *mp) | 570 | struct xfs_mount *mp) |
584 | { | 571 | { |
585 | kthread_stop(mp->m_sync_task); | 572 | cancel_delayed_work_sync(&mp->m_sync_work); |
573 | cancel_delayed_work_sync(&mp->m_reclaim_work); | ||
574 | cancel_work_sync(&mp->m_flush_work); | ||
586 | } | 575 | } |
587 | 576 | ||
588 | void | 577 | void |
@@ -601,6 +590,10 @@ __xfs_inode_set_reclaim_tag( | |||
601 | XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino), | 590 | XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino), |
602 | XFS_ICI_RECLAIM_TAG); | 591 | XFS_ICI_RECLAIM_TAG); |
603 | spin_unlock(&ip->i_mount->m_perag_lock); | 592 | spin_unlock(&ip->i_mount->m_perag_lock); |
593 | |||
594 | /* schedule periodic background inode reclaim */ | ||
595 | xfs_syncd_queue_reclaim(ip->i_mount); | ||
596 | |||
604 | trace_xfs_perag_set_reclaim(ip->i_mount, pag->pag_agno, | 597 | trace_xfs_perag_set_reclaim(ip->i_mount, pag->pag_agno, |
605 | -1, _RET_IP_); | 598 | -1, _RET_IP_); |
606 | } | 599 | } |
@@ -1017,7 +1010,13 @@ xfs_reclaim_inodes( | |||
1017 | } | 1010 | } |
1018 | 1011 | ||
1019 | /* | 1012 | /* |
1020 | * Shrinker infrastructure. | 1013 | * Inode cache shrinker. |
1014 | * | ||
1015 | * When called we make sure that there is a background (fast) inode reclaim in | ||
1016 | * progress, while we will throttle the speed of reclaim via doiing synchronous | ||
1017 | * reclaim of inodes. That means if we come across dirty inodes, we wait for | ||
1018 | * them to be cleaned, which we hope will not be very long due to the | ||
1019 | * background walker having already kicked the IO off on those dirty inodes. | ||
1021 | */ | 1020 | */ |
1022 | static int | 1021 | static int |
1023 | xfs_reclaim_inode_shrink( | 1022 | xfs_reclaim_inode_shrink( |
@@ -1032,10 +1031,15 @@ xfs_reclaim_inode_shrink( | |||
1032 | 1031 | ||
1033 | mp = container_of(shrink, struct xfs_mount, m_inode_shrink); | 1032 | mp = container_of(shrink, struct xfs_mount, m_inode_shrink); |
1034 | if (nr_to_scan) { | 1033 | if (nr_to_scan) { |
1034 | /* kick background reclaimer and push the AIL */ | ||
1035 | xfs_syncd_queue_reclaim(mp); | ||
1036 | xfs_ail_push_all(mp->m_ail); | ||
1037 | |||
1035 | if (!(gfp_mask & __GFP_FS)) | 1038 | if (!(gfp_mask & __GFP_FS)) |
1036 | return -1; | 1039 | return -1; |
1037 | 1040 | ||
1038 | xfs_reclaim_inodes_ag(mp, SYNC_TRYLOCK, &nr_to_scan); | 1041 | xfs_reclaim_inodes_ag(mp, SYNC_TRYLOCK | SYNC_WAIT, |
1042 | &nr_to_scan); | ||
1039 | /* terminate if we don't exhaust the scan */ | 1043 | /* terminate if we don't exhaust the scan */ |
1040 | if (nr_to_scan > 0) | 1044 | if (nr_to_scan > 0) |
1041 | return -1; | 1045 | return -1; |
diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/linux-2.6/xfs_sync.h index 32ba6628290c..e3a6ad27415f 100644 --- a/fs/xfs/linux-2.6/xfs_sync.h +++ b/fs/xfs/linux-2.6/xfs_sync.h | |||
@@ -32,6 +32,8 @@ typedef struct xfs_sync_work { | |||
32 | #define SYNC_WAIT 0x0001 /* wait for i/o to complete */ | 32 | #define SYNC_WAIT 0x0001 /* wait for i/o to complete */ |
33 | #define SYNC_TRYLOCK 0x0002 /* only try to lock inodes */ | 33 | #define SYNC_TRYLOCK 0x0002 /* only try to lock inodes */ |
34 | 34 | ||
35 | extern struct workqueue_struct *xfs_syncd_wq; /* sync workqueue */ | ||
36 | |||
35 | int xfs_syncd_init(struct xfs_mount *mp); | 37 | int xfs_syncd_init(struct xfs_mount *mp); |
36 | void xfs_syncd_stop(struct xfs_mount *mp); | 38 | void xfs_syncd_stop(struct xfs_mount *mp); |
37 | 39 | ||
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 254ee062bd7d..69228aa8605a 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -461,12 +461,10 @@ xfs_qm_dqflush_all( | |||
461 | struct xfs_quotainfo *q = mp->m_quotainfo; | 461 | struct xfs_quotainfo *q = mp->m_quotainfo; |
462 | int recl; | 462 | int recl; |
463 | struct xfs_dquot *dqp; | 463 | struct xfs_dquot *dqp; |
464 | int niters; | ||
465 | int error; | 464 | int error; |
466 | 465 | ||
467 | if (!q) | 466 | if (!q) |
468 | return 0; | 467 | return 0; |
469 | niters = 0; | ||
470 | again: | 468 | again: |
471 | mutex_lock(&q->qi_dqlist_lock); | 469 | mutex_lock(&q->qi_dqlist_lock); |
472 | list_for_each_entry(dqp, &q->qi_dqlist, q_mplist) { | 470 | list_for_each_entry(dqp, &q->qi_dqlist, q_mplist) { |
@@ -1314,14 +1312,9 @@ xfs_qm_dqiter_bufs( | |||
1314 | { | 1312 | { |
1315 | xfs_buf_t *bp; | 1313 | xfs_buf_t *bp; |
1316 | int error; | 1314 | int error; |
1317 | int notcommitted; | ||
1318 | int incr; | ||
1319 | int type; | 1315 | int type; |
1320 | 1316 | ||
1321 | ASSERT(blkcnt > 0); | 1317 | ASSERT(blkcnt > 0); |
1322 | notcommitted = 0; | ||
1323 | incr = (blkcnt > XFS_QM_MAX_DQCLUSTER_LOGSZ) ? | ||
1324 | XFS_QM_MAX_DQCLUSTER_LOGSZ : blkcnt; | ||
1325 | type = flags & XFS_QMOPT_UQUOTA ? XFS_DQ_USER : | 1318 | type = flags & XFS_QMOPT_UQUOTA ? XFS_DQ_USER : |
1326 | (flags & XFS_QMOPT_PQUOTA ? XFS_DQ_PROJ : XFS_DQ_GROUP); | 1319 | (flags & XFS_QMOPT_PQUOTA ? XFS_DQ_PROJ : XFS_DQ_GROUP); |
1327 | error = 0; | 1320 | error = 0; |
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h index c9446f1c726d..567b29b9f1b3 100644 --- a/fs/xfs/quota/xfs_qm.h +++ b/fs/xfs/quota/xfs_qm.h | |||
@@ -65,11 +65,6 @@ extern kmem_zone_t *qm_dqtrxzone; | |||
65 | * block in the dquot/xqm code. | 65 | * block in the dquot/xqm code. |
66 | */ | 66 | */ |
67 | #define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1 | 67 | #define XFS_DQUOT_CLUSTER_SIZE_FSB (xfs_filblks_t)1 |
68 | /* | ||
69 | * When doing a quotacheck, we log dquot clusters of this many FSBs at most | ||
70 | * in a single transaction. We don't want to ask for too huge a log reservation. | ||
71 | */ | ||
72 | #define XFS_QM_MAX_DQCLUSTER_LOGSZ 3 | ||
73 | 68 | ||
74 | typedef xfs_dqhash_t xfs_dqlist_t; | 69 | typedef xfs_dqhash_t xfs_dqlist_t; |
75 | 70 | ||
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c index 0d62a07b7fd8..2dadb15d5ca9 100644 --- a/fs/xfs/quota/xfs_qm_syscalls.c +++ b/fs/xfs/quota/xfs_qm_syscalls.c | |||
@@ -313,14 +313,12 @@ xfs_qm_scall_quotaon( | |||
313 | { | 313 | { |
314 | int error; | 314 | int error; |
315 | uint qf; | 315 | uint qf; |
316 | uint accflags; | ||
317 | __int64_t sbflags; | 316 | __int64_t sbflags; |
318 | 317 | ||
319 | flags &= (XFS_ALL_QUOTA_ACCT | XFS_ALL_QUOTA_ENFD); | 318 | flags &= (XFS_ALL_QUOTA_ACCT | XFS_ALL_QUOTA_ENFD); |
320 | /* | 319 | /* |
321 | * Switching on quota accounting must be done at mount time. | 320 | * Switching on quota accounting must be done at mount time. |
322 | */ | 321 | */ |
323 | accflags = flags & XFS_ALL_QUOTA_ACCT; | ||
324 | flags &= ~(XFS_ALL_QUOTA_ACCT); | 322 | flags &= ~(XFS_ALL_QUOTA_ACCT); |
325 | 323 | ||
326 | sbflags = 0; | 324 | sbflags = 0; |
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index 4bc3c649aee4..27d64d752eab 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
@@ -2395,17 +2395,33 @@ xfs_free_extent( | |||
2395 | memset(&args, 0, sizeof(xfs_alloc_arg_t)); | 2395 | memset(&args, 0, sizeof(xfs_alloc_arg_t)); |
2396 | args.tp = tp; | 2396 | args.tp = tp; |
2397 | args.mp = tp->t_mountp; | 2397 | args.mp = tp->t_mountp; |
2398 | |||
2399 | /* | ||
2400 | * validate that the block number is legal - the enables us to detect | ||
2401 | * and handle a silent filesystem corruption rather than crashing. | ||
2402 | */ | ||
2398 | args.agno = XFS_FSB_TO_AGNO(args.mp, bno); | 2403 | args.agno = XFS_FSB_TO_AGNO(args.mp, bno); |
2399 | ASSERT(args.agno < args.mp->m_sb.sb_agcount); | 2404 | if (args.agno >= args.mp->m_sb.sb_agcount) |
2405 | return EFSCORRUPTED; | ||
2406 | |||
2400 | args.agbno = XFS_FSB_TO_AGBNO(args.mp, bno); | 2407 | args.agbno = XFS_FSB_TO_AGBNO(args.mp, bno); |
2408 | if (args.agbno >= args.mp->m_sb.sb_agblocks) | ||
2409 | return EFSCORRUPTED; | ||
2410 | |||
2401 | args.pag = xfs_perag_get(args.mp, args.agno); | 2411 | args.pag = xfs_perag_get(args.mp, args.agno); |
2402 | if ((error = xfs_alloc_fix_freelist(&args, XFS_ALLOC_FLAG_FREEING))) | 2412 | ASSERT(args.pag); |
2413 | |||
2414 | error = xfs_alloc_fix_freelist(&args, XFS_ALLOC_FLAG_FREEING); | ||
2415 | if (error) | ||
2403 | goto error0; | 2416 | goto error0; |
2404 | #ifdef DEBUG | 2417 | |
2405 | ASSERT(args.agbp != NULL); | 2418 | /* validate the extent size is legal now we have the agf locked */ |
2406 | ASSERT((args.agbno + len) <= | 2419 | if (args.agbno + len > |
2407 | be32_to_cpu(XFS_BUF_TO_AGF(args.agbp)->agf_length)); | 2420 | be32_to_cpu(XFS_BUF_TO_AGF(args.agbp)->agf_length)) { |
2408 | #endif | 2421 | error = EFSCORRUPTED; |
2422 | goto error0; | ||
2423 | } | ||
2424 | |||
2409 | error = xfs_free_ag_extent(tp, args.agbp, args.agno, args.agbno, len, 0); | 2425 | error = xfs_free_ag_extent(tp, args.agbp, args.agno, args.agbno, len, 0); |
2410 | error0: | 2426 | error0: |
2411 | xfs_perag_put(args.pag); | 2427 | xfs_perag_put(args.pag); |
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index 46cc40131d4a..576fdfe81d60 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c | |||
@@ -198,6 +198,41 @@ xfs_inode_item_size( | |||
198 | } | 198 | } |
199 | 199 | ||
200 | /* | 200 | /* |
201 | * xfs_inode_item_format_extents - convert in-core extents to on-disk form | ||
202 | * | ||
203 | * For either the data or attr fork in extent format, we need to endian convert | ||
204 | * the in-core extent as we place them into the on-disk inode. In this case, we | ||
205 | * need to do this conversion before we write the extents into the log. Because | ||
206 | * we don't have the disk inode to write into here, we allocate a buffer and | ||
207 | * format the extents into it via xfs_iextents_copy(). We free the buffer in | ||
208 | * the unlock routine after the copy for the log has been made. | ||
209 | * | ||
210 | * In the case of the data fork, the in-core and on-disk fork sizes can be | ||
211 | * different due to delayed allocation extents. We only log on-disk extents | ||
212 | * here, so always use the physical fork size to determine the size of the | ||
213 | * buffer we need to allocate. | ||
214 | */ | ||
215 | STATIC void | ||
216 | xfs_inode_item_format_extents( | ||
217 | struct xfs_inode *ip, | ||
218 | struct xfs_log_iovec *vecp, | ||
219 | int whichfork, | ||
220 | int type) | ||
221 | { | ||
222 | xfs_bmbt_rec_t *ext_buffer; | ||
223 | |||
224 | ext_buffer = kmem_alloc(XFS_IFORK_SIZE(ip, whichfork), KM_SLEEP); | ||
225 | if (whichfork == XFS_DATA_FORK) | ||
226 | ip->i_itemp->ili_extents_buf = ext_buffer; | ||
227 | else | ||
228 | ip->i_itemp->ili_aextents_buf = ext_buffer; | ||
229 | |||
230 | vecp->i_addr = ext_buffer; | ||
231 | vecp->i_len = xfs_iextents_copy(ip, ext_buffer, whichfork); | ||
232 | vecp->i_type = type; | ||
233 | } | ||
234 | |||
235 | /* | ||
201 | * This is called to fill in the vector of log iovecs for the | 236 | * This is called to fill in the vector of log iovecs for the |
202 | * given inode log item. It fills the first item with an inode | 237 | * given inode log item. It fills the first item with an inode |
203 | * log format structure, the second with the on-disk inode structure, | 238 | * log format structure, the second with the on-disk inode structure, |
@@ -213,7 +248,6 @@ xfs_inode_item_format( | |||
213 | struct xfs_inode *ip = iip->ili_inode; | 248 | struct xfs_inode *ip = iip->ili_inode; |
214 | uint nvecs; | 249 | uint nvecs; |
215 | size_t data_bytes; | 250 | size_t data_bytes; |
216 | xfs_bmbt_rec_t *ext_buffer; | ||
217 | xfs_mount_t *mp; | 251 | xfs_mount_t *mp; |
218 | 252 | ||
219 | vecp->i_addr = &iip->ili_format; | 253 | vecp->i_addr = &iip->ili_format; |
@@ -320,22 +354,8 @@ xfs_inode_item_format( | |||
320 | } else | 354 | } else |
321 | #endif | 355 | #endif |
322 | { | 356 | { |
323 | /* | 357 | xfs_inode_item_format_extents(ip, vecp, |
324 | * There are delayed allocation extents | 358 | XFS_DATA_FORK, XLOG_REG_TYPE_IEXT); |
325 | * in the inode, or we need to convert | ||
326 | * the extents to on disk format. | ||
327 | * Use xfs_iextents_copy() | ||
328 | * to copy only the real extents into | ||
329 | * a separate buffer. We'll free the | ||
330 | * buffer in the unlock routine. | ||
331 | */ | ||
332 | ext_buffer = kmem_alloc(ip->i_df.if_bytes, | ||
333 | KM_SLEEP); | ||
334 | iip->ili_extents_buf = ext_buffer; | ||
335 | vecp->i_addr = ext_buffer; | ||
336 | vecp->i_len = xfs_iextents_copy(ip, ext_buffer, | ||
337 | XFS_DATA_FORK); | ||
338 | vecp->i_type = XLOG_REG_TYPE_IEXT; | ||
339 | } | 359 | } |
340 | ASSERT(vecp->i_len <= ip->i_df.if_bytes); | 360 | ASSERT(vecp->i_len <= ip->i_df.if_bytes); |
341 | iip->ili_format.ilf_dsize = vecp->i_len; | 361 | iip->ili_format.ilf_dsize = vecp->i_len; |
@@ -445,19 +465,12 @@ xfs_inode_item_format( | |||
445 | */ | 465 | */ |
446 | vecp->i_addr = ip->i_afp->if_u1.if_extents; | 466 | vecp->i_addr = ip->i_afp->if_u1.if_extents; |
447 | vecp->i_len = ip->i_afp->if_bytes; | 467 | vecp->i_len = ip->i_afp->if_bytes; |
468 | vecp->i_type = XLOG_REG_TYPE_IATTR_EXT; | ||
448 | #else | 469 | #else |
449 | ASSERT(iip->ili_aextents_buf == NULL); | 470 | ASSERT(iip->ili_aextents_buf == NULL); |
450 | /* | 471 | xfs_inode_item_format_extents(ip, vecp, |
451 | * Need to endian flip before logging | 472 | XFS_ATTR_FORK, XLOG_REG_TYPE_IATTR_EXT); |
452 | */ | ||
453 | ext_buffer = kmem_alloc(ip->i_afp->if_bytes, | ||
454 | KM_SLEEP); | ||
455 | iip->ili_aextents_buf = ext_buffer; | ||
456 | vecp->i_addr = ext_buffer; | ||
457 | vecp->i_len = xfs_iextents_copy(ip, ext_buffer, | ||
458 | XFS_ATTR_FORK); | ||
459 | #endif | 473 | #endif |
460 | vecp->i_type = XLOG_REG_TYPE_IATTR_EXT; | ||
461 | iip->ili_format.ilf_asize = vecp->i_len; | 474 | iip->ili_format.ilf_asize = vecp->i_len; |
462 | vecp++; | 475 | vecp++; |
463 | nvecs++; | 476 | nvecs++; |
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index dc1882adaf54..751e94fe1f77 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c | |||
@@ -204,7 +204,6 @@ xfs_bulkstat( | |||
204 | xfs_agi_t *agi; /* agi header data */ | 204 | xfs_agi_t *agi; /* agi header data */ |
205 | xfs_agino_t agino; /* inode # in allocation group */ | 205 | xfs_agino_t agino; /* inode # in allocation group */ |
206 | xfs_agnumber_t agno; /* allocation group number */ | 206 | xfs_agnumber_t agno; /* allocation group number */ |
207 | xfs_daddr_t bno; /* inode cluster start daddr */ | ||
208 | int chunkidx; /* current index into inode chunk */ | 207 | int chunkidx; /* current index into inode chunk */ |
209 | int clustidx; /* current index into inode cluster */ | 208 | int clustidx; /* current index into inode cluster */ |
210 | xfs_btree_cur_t *cur; /* btree cursor for ialloc btree */ | 209 | xfs_btree_cur_t *cur; /* btree cursor for ialloc btree */ |
@@ -463,7 +462,6 @@ xfs_bulkstat( | |||
463 | mp->m_sb.sb_inopblog); | 462 | mp->m_sb.sb_inopblog); |
464 | } | 463 | } |
465 | ino = XFS_AGINO_TO_INO(mp, agno, agino); | 464 | ino = XFS_AGINO_TO_INO(mp, agno, agino); |
466 | bno = XFS_AGB_TO_DADDR(mp, agno, agbno); | ||
467 | /* | 465 | /* |
468 | * Skip if this inode is free. | 466 | * Skip if this inode is free. |
469 | */ | 467 | */ |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 25efa9b8a602..b612ce4520ae 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -761,7 +761,7 @@ xfs_log_need_covered(xfs_mount_t *mp) | |||
761 | break; | 761 | break; |
762 | case XLOG_STATE_COVER_NEED: | 762 | case XLOG_STATE_COVER_NEED: |
763 | case XLOG_STATE_COVER_NEED2: | 763 | case XLOG_STATE_COVER_NEED2: |
764 | if (!xfs_trans_ail_tail(log->l_ailp) && | 764 | if (!xfs_ail_min_lsn(log->l_ailp) && |
765 | xlog_iclogs_empty(log)) { | 765 | xlog_iclogs_empty(log)) { |
766 | if (log->l_covered_state == XLOG_STATE_COVER_NEED) | 766 | if (log->l_covered_state == XLOG_STATE_COVER_NEED) |
767 | log->l_covered_state = XLOG_STATE_COVER_DONE; | 767 | log->l_covered_state = XLOG_STATE_COVER_DONE; |
@@ -801,7 +801,7 @@ xlog_assign_tail_lsn( | |||
801 | xfs_lsn_t tail_lsn; | 801 | xfs_lsn_t tail_lsn; |
802 | struct log *log = mp->m_log; | 802 | struct log *log = mp->m_log; |
803 | 803 | ||
804 | tail_lsn = xfs_trans_ail_tail(mp->m_ail); | 804 | tail_lsn = xfs_ail_min_lsn(mp->m_ail); |
805 | if (!tail_lsn) | 805 | if (!tail_lsn) |
806 | tail_lsn = atomic64_read(&log->l_last_sync_lsn); | 806 | tail_lsn = atomic64_read(&log->l_last_sync_lsn); |
807 | 807 | ||
@@ -1239,7 +1239,7 @@ xlog_grant_push_ail( | |||
1239 | * the filesystem is shutting down. | 1239 | * the filesystem is shutting down. |
1240 | */ | 1240 | */ |
1241 | if (!XLOG_FORCED_SHUTDOWN(log)) | 1241 | if (!XLOG_FORCED_SHUTDOWN(log)) |
1242 | xfs_trans_ail_push(log->l_ailp, threshold_lsn); | 1242 | xfs_ail_push(log->l_ailp, threshold_lsn); |
1243 | } | 1243 | } |
1244 | 1244 | ||
1245 | /* | 1245 | /* |
@@ -3407,6 +3407,17 @@ xlog_verify_dest_ptr( | |||
3407 | xfs_emerg(log->l_mp, "%s: invalid ptr", __func__); | 3407 | xfs_emerg(log->l_mp, "%s: invalid ptr", __func__); |
3408 | } | 3408 | } |
3409 | 3409 | ||
3410 | /* | ||
3411 | * Check to make sure the grant write head didn't just over lap the tail. If | ||
3412 | * the cycles are the same, we can't be overlapping. Otherwise, make sure that | ||
3413 | * the cycles differ by exactly one and check the byte count. | ||
3414 | * | ||
3415 | * This check is run unlocked, so can give false positives. Rather than assert | ||
3416 | * on failures, use a warn-once flag and a panic tag to allow the admin to | ||
3417 | * determine if they want to panic the machine when such an error occurs. For | ||
3418 | * debug kernels this will have the same effect as using an assert but, unlinke | ||
3419 | * an assert, it can be turned off at runtime. | ||
3420 | */ | ||
3410 | STATIC void | 3421 | STATIC void |
3411 | xlog_verify_grant_tail( | 3422 | xlog_verify_grant_tail( |
3412 | struct log *log) | 3423 | struct log *log) |
@@ -3414,17 +3425,22 @@ xlog_verify_grant_tail( | |||
3414 | int tail_cycle, tail_blocks; | 3425 | int tail_cycle, tail_blocks; |
3415 | int cycle, space; | 3426 | int cycle, space; |
3416 | 3427 | ||
3417 | /* | ||
3418 | * Check to make sure the grant write head didn't just over lap the | ||
3419 | * tail. If the cycles are the same, we can't be overlapping. | ||
3420 | * Otherwise, make sure that the cycles differ by exactly one and | ||
3421 | * check the byte count. | ||
3422 | */ | ||
3423 | xlog_crack_grant_head(&log->l_grant_write_head, &cycle, &space); | 3428 | xlog_crack_grant_head(&log->l_grant_write_head, &cycle, &space); |
3424 | xlog_crack_atomic_lsn(&log->l_tail_lsn, &tail_cycle, &tail_blocks); | 3429 | xlog_crack_atomic_lsn(&log->l_tail_lsn, &tail_cycle, &tail_blocks); |
3425 | if (tail_cycle != cycle) { | 3430 | if (tail_cycle != cycle) { |
3426 | ASSERT(cycle - 1 == tail_cycle); | 3431 | if (cycle - 1 != tail_cycle && |
3427 | ASSERT(space <= BBTOB(tail_blocks)); | 3432 | !(log->l_flags & XLOG_TAIL_WARN)) { |
3433 | xfs_alert_tag(log->l_mp, XFS_PTAG_LOGRES, | ||
3434 | "%s: cycle - 1 != tail_cycle", __func__); | ||
3435 | log->l_flags |= XLOG_TAIL_WARN; | ||
3436 | } | ||
3437 | |||
3438 | if (space > BBTOB(tail_blocks) && | ||
3439 | !(log->l_flags & XLOG_TAIL_WARN)) { | ||
3440 | xfs_alert_tag(log->l_mp, XFS_PTAG_LOGRES, | ||
3441 | "%s: space > BBTOB(tail_blocks)", __func__); | ||
3442 | log->l_flags |= XLOG_TAIL_WARN; | ||
3443 | } | ||
3428 | } | 3444 | } |
3429 | } | 3445 | } |
3430 | 3446 | ||
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h index ffae692c9832..5864850e9e34 100644 --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h | |||
@@ -144,6 +144,7 @@ static inline uint xlog_get_client_id(__be32 i) | |||
144 | #define XLOG_RECOVERY_NEEDED 0x4 /* log was recovered */ | 144 | #define XLOG_RECOVERY_NEEDED 0x4 /* log was recovered */ |
145 | #define XLOG_IO_ERROR 0x8 /* log hit an I/O error, and being | 145 | #define XLOG_IO_ERROR 0x8 /* log hit an I/O error, and being |
146 | shutdown */ | 146 | shutdown */ |
147 | #define XLOG_TAIL_WARN 0x10 /* log tail verify warning issued */ | ||
147 | 148 | ||
148 | #ifdef __KERNEL__ | 149 | #ifdef __KERNEL__ |
149 | /* | 150 | /* |
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index a62e8971539d..19af0ab0d0c6 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
@@ -203,12 +203,9 @@ typedef struct xfs_mount { | |||
203 | struct mutex m_icsb_mutex; /* balancer sync lock */ | 203 | struct mutex m_icsb_mutex; /* balancer sync lock */ |
204 | #endif | 204 | #endif |
205 | struct xfs_mru_cache *m_filestream; /* per-mount filestream data */ | 205 | struct xfs_mru_cache *m_filestream; /* per-mount filestream data */ |
206 | struct task_struct *m_sync_task; /* generalised sync thread */ | 206 | struct delayed_work m_sync_work; /* background sync work */ |
207 | xfs_sync_work_t m_sync_work; /* work item for VFS_SYNC */ | 207 | struct delayed_work m_reclaim_work; /* background inode reclaim */ |
208 | struct list_head m_sync_list; /* sync thread work item list */ | 208 | struct work_struct m_flush_work; /* background inode flush */ |
209 | spinlock_t m_sync_lock; /* work item list lock */ | ||
210 | int m_sync_seq; /* sync thread generation no. */ | ||
211 | wait_queue_head_t m_wait_single_sync_task; | ||
212 | __int64_t m_update_flags; /* sb flags we need to update | 209 | __int64_t m_update_flags; /* sb flags we need to update |
213 | on the next remount,rw */ | 210 | on the next remount,rw */ |
214 | struct shrinker m_inode_shrink; /* inode reclaim shrinker */ | 211 | struct shrinker m_inode_shrink; /* inode reclaim shrinker */ |
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c index 12aff9584e29..acdb92f14d51 100644 --- a/fs/xfs/xfs_trans_ail.c +++ b/fs/xfs/xfs_trans_ail.c | |||
@@ -28,74 +28,138 @@ | |||
28 | #include "xfs_trans_priv.h" | 28 | #include "xfs_trans_priv.h" |
29 | #include "xfs_error.h" | 29 | #include "xfs_error.h" |
30 | 30 | ||
31 | STATIC void xfs_ail_splice(struct xfs_ail *, struct list_head *, xfs_lsn_t); | 31 | struct workqueue_struct *xfs_ail_wq; /* AIL workqueue */ |
32 | STATIC void xfs_ail_delete(struct xfs_ail *, xfs_log_item_t *); | ||
33 | STATIC xfs_log_item_t * xfs_ail_min(struct xfs_ail *); | ||
34 | STATIC xfs_log_item_t * xfs_ail_next(struct xfs_ail *, xfs_log_item_t *); | ||
35 | 32 | ||
36 | #ifdef DEBUG | 33 | #ifdef DEBUG |
37 | STATIC void xfs_ail_check(struct xfs_ail *, xfs_log_item_t *); | 34 | /* |
38 | #else | 35 | * Check that the list is sorted as it should be. |
36 | */ | ||
37 | STATIC void | ||
38 | xfs_ail_check( | ||
39 | struct xfs_ail *ailp, | ||
40 | xfs_log_item_t *lip) | ||
41 | { | ||
42 | xfs_log_item_t *prev_lip; | ||
43 | |||
44 | if (list_empty(&ailp->xa_ail)) | ||
45 | return; | ||
46 | |||
47 | /* | ||
48 | * Check the next and previous entries are valid. | ||
49 | */ | ||
50 | ASSERT((lip->li_flags & XFS_LI_IN_AIL) != 0); | ||
51 | prev_lip = list_entry(lip->li_ail.prev, xfs_log_item_t, li_ail); | ||
52 | if (&prev_lip->li_ail != &ailp->xa_ail) | ||
53 | ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) <= 0); | ||
54 | |||
55 | prev_lip = list_entry(lip->li_ail.next, xfs_log_item_t, li_ail); | ||
56 | if (&prev_lip->li_ail != &ailp->xa_ail) | ||
57 | ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) >= 0); | ||
58 | |||
59 | |||
60 | #ifdef XFS_TRANS_DEBUG | ||
61 | /* | ||
62 | * Walk the list checking lsn ordering, and that every entry has the | ||
63 | * XFS_LI_IN_AIL flag set. This is really expensive, so only do it | ||
64 | * when specifically debugging the transaction subsystem. | ||
65 | */ | ||
66 | prev_lip = list_entry(&ailp->xa_ail, xfs_log_item_t, li_ail); | ||
67 | list_for_each_entry(lip, &ailp->xa_ail, li_ail) { | ||
68 | if (&prev_lip->li_ail != &ailp->xa_ail) | ||
69 | ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) <= 0); | ||
70 | ASSERT((lip->li_flags & XFS_LI_IN_AIL) != 0); | ||
71 | prev_lip = lip; | ||
72 | } | ||
73 | #endif /* XFS_TRANS_DEBUG */ | ||
74 | } | ||
75 | #else /* !DEBUG */ | ||
39 | #define xfs_ail_check(a,l) | 76 | #define xfs_ail_check(a,l) |
40 | #endif /* DEBUG */ | 77 | #endif /* DEBUG */ |
41 | 78 | ||
79 | /* | ||
80 | * Return a pointer to the first item in the AIL. If the AIL is empty, then | ||
81 | * return NULL. | ||
82 | */ | ||
83 | static xfs_log_item_t * | ||
84 | xfs_ail_min( | ||
85 | struct xfs_ail *ailp) | ||
86 | { | ||
87 | if (list_empty(&ailp->xa_ail)) | ||
88 | return NULL; | ||
89 | |||
90 | return list_first_entry(&ailp->xa_ail, xfs_log_item_t, li_ail); | ||
91 | } | ||
92 | |||
93 | /* | ||
94 | * Return a pointer to the last item in the AIL. If the AIL is empty, then | ||
95 | * return NULL. | ||
96 | */ | ||
97 | static xfs_log_item_t * | ||
98 | xfs_ail_max( | ||
99 | struct xfs_ail *ailp) | ||
100 | { | ||
101 | if (list_empty(&ailp->xa_ail)) | ||
102 | return NULL; | ||
103 | |||
104 | return list_entry(ailp->xa_ail.prev, xfs_log_item_t, li_ail); | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * Return a pointer to the item which follows the given item in the AIL. If | ||
109 | * the given item is the last item in the list, then return NULL. | ||
110 | */ | ||
111 | static xfs_log_item_t * | ||
112 | xfs_ail_next( | ||
113 | struct xfs_ail *ailp, | ||
114 | xfs_log_item_t *lip) | ||
115 | { | ||
116 | if (lip->li_ail.next == &ailp->xa_ail) | ||
117 | return NULL; | ||
118 | |||
119 | return list_first_entry(&lip->li_ail, xfs_log_item_t, li_ail); | ||
120 | } | ||
42 | 121 | ||
43 | /* | 122 | /* |
44 | * This is called by the log manager code to determine the LSN | 123 | * This is called by the log manager code to determine the LSN of the tail of |
45 | * of the tail of the log. This is exactly the LSN of the first | 124 | * the log. This is exactly the LSN of the first item in the AIL. If the AIL |
46 | * item in the AIL. If the AIL is empty, then this function | 125 | * is empty, then this function returns 0. |
47 | * returns 0. | ||
48 | * | 126 | * |
49 | * We need the AIL lock in order to get a coherent read of the | 127 | * We need the AIL lock in order to get a coherent read of the lsn of the last |
50 | * lsn of the last item in the AIL. | 128 | * item in the AIL. |
51 | */ | 129 | */ |
52 | xfs_lsn_t | 130 | xfs_lsn_t |
53 | xfs_trans_ail_tail( | 131 | xfs_ail_min_lsn( |
54 | struct xfs_ail *ailp) | 132 | struct xfs_ail *ailp) |
55 | { | 133 | { |
56 | xfs_lsn_t lsn; | 134 | xfs_lsn_t lsn = 0; |
57 | xfs_log_item_t *lip; | 135 | xfs_log_item_t *lip; |
58 | 136 | ||
59 | spin_lock(&ailp->xa_lock); | 137 | spin_lock(&ailp->xa_lock); |
60 | lip = xfs_ail_min(ailp); | 138 | lip = xfs_ail_min(ailp); |
61 | if (lip == NULL) { | 139 | if (lip) |
62 | lsn = (xfs_lsn_t)0; | ||
63 | } else { | ||
64 | lsn = lip->li_lsn; | 140 | lsn = lip->li_lsn; |
65 | } | ||
66 | spin_unlock(&ailp->xa_lock); | 141 | spin_unlock(&ailp->xa_lock); |
67 | 142 | ||
68 | return lsn; | 143 | return lsn; |
69 | } | 144 | } |
70 | 145 | ||
71 | /* | 146 | /* |
72 | * xfs_trans_push_ail | 147 | * Return the maximum lsn held in the AIL, or zero if the AIL is empty. |
73 | * | ||
74 | * This routine is called to move the tail of the AIL forward. It does this by | ||
75 | * trying to flush items in the AIL whose lsns are below the given | ||
76 | * threshold_lsn. | ||
77 | * | ||
78 | * the push is run asynchronously in a separate thread, so we return the tail | ||
79 | * of the log right now instead of the tail after the push. This means we will | ||
80 | * either continue right away, or we will sleep waiting on the async thread to | ||
81 | * do its work. | ||
82 | * | ||
83 | * We do this unlocked - we only need to know whether there is anything in the | ||
84 | * AIL at the time we are called. We don't need to access the contents of | ||
85 | * any of the objects, so the lock is not needed. | ||
86 | */ | 148 | */ |
87 | void | 149 | static xfs_lsn_t |
88 | xfs_trans_ail_push( | 150 | xfs_ail_max_lsn( |
89 | struct xfs_ail *ailp, | 151 | struct xfs_ail *ailp) |
90 | xfs_lsn_t threshold_lsn) | ||
91 | { | 152 | { |
92 | xfs_log_item_t *lip; | 153 | xfs_lsn_t lsn = 0; |
154 | xfs_log_item_t *lip; | ||
93 | 155 | ||
94 | lip = xfs_ail_min(ailp); | 156 | spin_lock(&ailp->xa_lock); |
95 | if (lip && !XFS_FORCED_SHUTDOWN(ailp->xa_mount)) { | 157 | lip = xfs_ail_max(ailp); |
96 | if (XFS_LSN_CMP(threshold_lsn, ailp->xa_target) > 0) | 158 | if (lip) |
97 | xfsaild_wakeup(ailp, threshold_lsn); | 159 | lsn = lip->li_lsn; |
98 | } | 160 | spin_unlock(&ailp->xa_lock); |
161 | |||
162 | return lsn; | ||
99 | } | 163 | } |
100 | 164 | ||
101 | /* | 165 | /* |
@@ -236,16 +300,57 @@ out: | |||
236 | } | 300 | } |
237 | 301 | ||
238 | /* | 302 | /* |
239 | * xfsaild_push does the work of pushing on the AIL. Returning a timeout of | 303 | * splice the log item list into the AIL at the given LSN. |
240 | * zero indicates that the caller should sleep until woken. | ||
241 | */ | 304 | */ |
242 | long | 305 | static void |
243 | xfsaild_push( | 306 | xfs_ail_splice( |
244 | struct xfs_ail *ailp, | 307 | struct xfs_ail *ailp, |
245 | xfs_lsn_t *last_lsn) | 308 | struct list_head *list, |
309 | xfs_lsn_t lsn) | ||
246 | { | 310 | { |
247 | long tout = 0; | 311 | xfs_log_item_t *next_lip; |
248 | xfs_lsn_t last_pushed_lsn = *last_lsn; | 312 | |
313 | /* If the list is empty, just insert the item. */ | ||
314 | if (list_empty(&ailp->xa_ail)) { | ||
315 | list_splice(list, &ailp->xa_ail); | ||
316 | return; | ||
317 | } | ||
318 | |||
319 | list_for_each_entry_reverse(next_lip, &ailp->xa_ail, li_ail) { | ||
320 | if (XFS_LSN_CMP(next_lip->li_lsn, lsn) <= 0) | ||
321 | break; | ||
322 | } | ||
323 | |||
324 | ASSERT(&next_lip->li_ail == &ailp->xa_ail || | ||
325 | XFS_LSN_CMP(next_lip->li_lsn, lsn) <= 0); | ||
326 | |||
327 | list_splice_init(list, &next_lip->li_ail); | ||
328 | } | ||
329 | |||
330 | /* | ||
331 | * Delete the given item from the AIL. Return a pointer to the item. | ||
332 | */ | ||
333 | static void | ||
334 | xfs_ail_delete( | ||
335 | struct xfs_ail *ailp, | ||
336 | xfs_log_item_t *lip) | ||
337 | { | ||
338 | xfs_ail_check(ailp, lip); | ||
339 | list_del(&lip->li_ail); | ||
340 | xfs_trans_ail_cursor_clear(ailp, lip); | ||
341 | } | ||
342 | |||
343 | /* | ||
344 | * xfs_ail_worker does the work of pushing on the AIL. It will requeue itself | ||
345 | * to run at a later time if there is more work to do to complete the push. | ||
346 | */ | ||
347 | STATIC void | ||
348 | xfs_ail_worker( | ||
349 | struct work_struct *work) | ||
350 | { | ||
351 | struct xfs_ail *ailp = container_of(to_delayed_work(work), | ||
352 | struct xfs_ail, xa_work); | ||
353 | long tout; | ||
249 | xfs_lsn_t target = ailp->xa_target; | 354 | xfs_lsn_t target = ailp->xa_target; |
250 | xfs_lsn_t lsn; | 355 | xfs_lsn_t lsn; |
251 | xfs_log_item_t *lip; | 356 | xfs_log_item_t *lip; |
@@ -256,15 +361,15 @@ xfsaild_push( | |||
256 | 361 | ||
257 | spin_lock(&ailp->xa_lock); | 362 | spin_lock(&ailp->xa_lock); |
258 | xfs_trans_ail_cursor_init(ailp, cur); | 363 | xfs_trans_ail_cursor_init(ailp, cur); |
259 | lip = xfs_trans_ail_cursor_first(ailp, cur, *last_lsn); | 364 | lip = xfs_trans_ail_cursor_first(ailp, cur, ailp->xa_last_pushed_lsn); |
260 | if (!lip || XFS_FORCED_SHUTDOWN(mp)) { | 365 | if (!lip || XFS_FORCED_SHUTDOWN(mp)) { |
261 | /* | 366 | /* |
262 | * AIL is empty or our push has reached the end. | 367 | * AIL is empty or our push has reached the end. |
263 | */ | 368 | */ |
264 | xfs_trans_ail_cursor_done(ailp, cur); | 369 | xfs_trans_ail_cursor_done(ailp, cur); |
265 | spin_unlock(&ailp->xa_lock); | 370 | spin_unlock(&ailp->xa_lock); |
266 | *last_lsn = 0; | 371 | ailp->xa_last_pushed_lsn = 0; |
267 | return tout; | 372 | return; |
268 | } | 373 | } |
269 | 374 | ||
270 | XFS_STATS_INC(xs_push_ail); | 375 | XFS_STATS_INC(xs_push_ail); |
@@ -301,13 +406,13 @@ xfsaild_push( | |||
301 | case XFS_ITEM_SUCCESS: | 406 | case XFS_ITEM_SUCCESS: |
302 | XFS_STATS_INC(xs_push_ail_success); | 407 | XFS_STATS_INC(xs_push_ail_success); |
303 | IOP_PUSH(lip); | 408 | IOP_PUSH(lip); |
304 | last_pushed_lsn = lsn; | 409 | ailp->xa_last_pushed_lsn = lsn; |
305 | break; | 410 | break; |
306 | 411 | ||
307 | case XFS_ITEM_PUSHBUF: | 412 | case XFS_ITEM_PUSHBUF: |
308 | XFS_STATS_INC(xs_push_ail_pushbuf); | 413 | XFS_STATS_INC(xs_push_ail_pushbuf); |
309 | IOP_PUSHBUF(lip); | 414 | IOP_PUSHBUF(lip); |
310 | last_pushed_lsn = lsn; | 415 | ailp->xa_last_pushed_lsn = lsn; |
311 | push_xfsbufd = 1; | 416 | push_xfsbufd = 1; |
312 | break; | 417 | break; |
313 | 418 | ||
@@ -319,7 +424,7 @@ xfsaild_push( | |||
319 | 424 | ||
320 | case XFS_ITEM_LOCKED: | 425 | case XFS_ITEM_LOCKED: |
321 | XFS_STATS_INC(xs_push_ail_locked); | 426 | XFS_STATS_INC(xs_push_ail_locked); |
322 | last_pushed_lsn = lsn; | 427 | ailp->xa_last_pushed_lsn = lsn; |
323 | stuck++; | 428 | stuck++; |
324 | break; | 429 | break; |
325 | 430 | ||
@@ -374,9 +479,23 @@ xfsaild_push( | |||
374 | wake_up_process(mp->m_ddev_targp->bt_task); | 479 | wake_up_process(mp->m_ddev_targp->bt_task); |
375 | } | 480 | } |
376 | 481 | ||
482 | /* assume we have more work to do in a short while */ | ||
483 | tout = 10; | ||
377 | if (!count) { | 484 | if (!count) { |
378 | /* We're past our target or empty, so idle */ | 485 | /* We're past our target or empty, so idle */ |
379 | last_pushed_lsn = 0; | 486 | ailp->xa_last_pushed_lsn = 0; |
487 | |||
488 | /* | ||
489 | * Check for an updated push target before clearing the | ||
490 | * XFS_AIL_PUSHING_BIT. If the target changed, we've got more | ||
491 | * work to do. Wait a bit longer before starting that work. | ||
492 | */ | ||
493 | smp_rmb(); | ||
494 | if (ailp->xa_target == target) { | ||
495 | clear_bit(XFS_AIL_PUSHING_BIT, &ailp->xa_flags); | ||
496 | return; | ||
497 | } | ||
498 | tout = 50; | ||
380 | } else if (XFS_LSN_CMP(lsn, target) >= 0) { | 499 | } else if (XFS_LSN_CMP(lsn, target) >= 0) { |
381 | /* | 500 | /* |
382 | * We reached the target so wait a bit longer for I/O to | 501 | * We reached the target so wait a bit longer for I/O to |
@@ -384,7 +503,7 @@ xfsaild_push( | |||
384 | * start the next scan from the start of the AIL. | 503 | * start the next scan from the start of the AIL. |
385 | */ | 504 | */ |
386 | tout = 50; | 505 | tout = 50; |
387 | last_pushed_lsn = 0; | 506 | ailp->xa_last_pushed_lsn = 0; |
388 | } else if ((stuck * 100) / count > 90) { | 507 | } else if ((stuck * 100) / count > 90) { |
389 | /* | 508 | /* |
390 | * Either there is a lot of contention on the AIL or we | 509 | * Either there is a lot of contention on the AIL or we |
@@ -396,14 +515,61 @@ xfsaild_push( | |||
396 | * continuing from where we were. | 515 | * continuing from where we were. |
397 | */ | 516 | */ |
398 | tout = 20; | 517 | tout = 20; |
399 | } else { | ||
400 | /* more to do, but wait a short while before continuing */ | ||
401 | tout = 10; | ||
402 | } | 518 | } |
403 | *last_lsn = last_pushed_lsn; | 519 | |
404 | return tout; | 520 | /* There is more to do, requeue us. */ |
521 | queue_delayed_work(xfs_syncd_wq, &ailp->xa_work, | ||
522 | msecs_to_jiffies(tout)); | ||
523 | } | ||
524 | |||
525 | /* | ||
526 | * This routine is called to move the tail of the AIL forward. It does this by | ||
527 | * trying to flush items in the AIL whose lsns are below the given | ||
528 | * threshold_lsn. | ||
529 | * | ||
530 | * The push is run asynchronously in a workqueue, which means the caller needs | ||
531 | * to handle waiting on the async flush for space to become available. | ||
532 | * We don't want to interrupt any push that is in progress, hence we only queue | ||
533 | * work if we set the pushing bit approriately. | ||
534 | * | ||
535 | * We do this unlocked - we only need to know whether there is anything in the | ||
536 | * AIL at the time we are called. We don't need to access the contents of | ||
537 | * any of the objects, so the lock is not needed. | ||
538 | */ | ||
539 | void | ||
540 | xfs_ail_push( | ||
541 | struct xfs_ail *ailp, | ||
542 | xfs_lsn_t threshold_lsn) | ||
543 | { | ||
544 | xfs_log_item_t *lip; | ||
545 | |||
546 | lip = xfs_ail_min(ailp); | ||
547 | if (!lip || XFS_FORCED_SHUTDOWN(ailp->xa_mount) || | ||
548 | XFS_LSN_CMP(threshold_lsn, ailp->xa_target) <= 0) | ||
549 | return; | ||
550 | |||
551 | /* | ||
552 | * Ensure that the new target is noticed in push code before it clears | ||
553 | * the XFS_AIL_PUSHING_BIT. | ||
554 | */ | ||
555 | smp_wmb(); | ||
556 | ailp->xa_target = threshold_lsn; | ||
557 | if (!test_and_set_bit(XFS_AIL_PUSHING_BIT, &ailp->xa_flags)) | ||
558 | queue_delayed_work(xfs_syncd_wq, &ailp->xa_work, 0); | ||
405 | } | 559 | } |
406 | 560 | ||
561 | /* | ||
562 | * Push out all items in the AIL immediately | ||
563 | */ | ||
564 | void | ||
565 | xfs_ail_push_all( | ||
566 | struct xfs_ail *ailp) | ||
567 | { | ||
568 | xfs_lsn_t threshold_lsn = xfs_ail_max_lsn(ailp); | ||
569 | |||
570 | if (threshold_lsn) | ||
571 | xfs_ail_push(ailp, threshold_lsn); | ||
572 | } | ||
407 | 573 | ||
408 | /* | 574 | /* |
409 | * This is to be called when an item is unlocked that may have | 575 | * This is to be called when an item is unlocked that may have |
@@ -615,7 +781,6 @@ xfs_trans_ail_init( | |||
615 | xfs_mount_t *mp) | 781 | xfs_mount_t *mp) |
616 | { | 782 | { |
617 | struct xfs_ail *ailp; | 783 | struct xfs_ail *ailp; |
618 | int error; | ||
619 | 784 | ||
620 | ailp = kmem_zalloc(sizeof(struct xfs_ail), KM_MAYFAIL); | 785 | ailp = kmem_zalloc(sizeof(struct xfs_ail), KM_MAYFAIL); |
621 | if (!ailp) | 786 | if (!ailp) |
@@ -624,15 +789,9 @@ xfs_trans_ail_init( | |||
624 | ailp->xa_mount = mp; | 789 | ailp->xa_mount = mp; |
625 | INIT_LIST_HEAD(&ailp->xa_ail); | 790 | INIT_LIST_HEAD(&ailp->xa_ail); |
626 | spin_lock_init(&ailp->xa_lock); | 791 | spin_lock_init(&ailp->xa_lock); |
627 | error = xfsaild_start(ailp); | 792 | INIT_DELAYED_WORK(&ailp->xa_work, xfs_ail_worker); |
628 | if (error) | ||
629 | goto out_free_ailp; | ||
630 | mp->m_ail = ailp; | 793 | mp->m_ail = ailp; |
631 | return 0; | 794 | return 0; |
632 | |||
633 | out_free_ailp: | ||
634 | kmem_free(ailp); | ||
635 | return error; | ||
636 | } | 795 | } |
637 | 796 | ||
638 | void | 797 | void |
@@ -641,124 +800,6 @@ xfs_trans_ail_destroy( | |||
641 | { | 800 | { |
642 | struct xfs_ail *ailp = mp->m_ail; | 801 | struct xfs_ail *ailp = mp->m_ail; |
643 | 802 | ||
644 | xfsaild_stop(ailp); | 803 | cancel_delayed_work_sync(&ailp->xa_work); |
645 | kmem_free(ailp); | 804 | kmem_free(ailp); |
646 | } | 805 | } |
647 | |||
648 | /* | ||
649 | * splice the log item list into the AIL at the given LSN. | ||
650 | */ | ||
651 | STATIC void | ||
652 | xfs_ail_splice( | ||
653 | struct xfs_ail *ailp, | ||
654 | struct list_head *list, | ||
655 | xfs_lsn_t lsn) | ||
656 | { | ||
657 | xfs_log_item_t *next_lip; | ||
658 | |||
659 | /* | ||
660 | * If the list is empty, just insert the item. | ||
661 | */ | ||
662 | if (list_empty(&ailp->xa_ail)) { | ||
663 | list_splice(list, &ailp->xa_ail); | ||
664 | return; | ||
665 | } | ||
666 | |||
667 | list_for_each_entry_reverse(next_lip, &ailp->xa_ail, li_ail) { | ||
668 | if (XFS_LSN_CMP(next_lip->li_lsn, lsn) <= 0) | ||
669 | break; | ||
670 | } | ||
671 | |||
672 | ASSERT((&next_lip->li_ail == &ailp->xa_ail) || | ||
673 | (XFS_LSN_CMP(next_lip->li_lsn, lsn) <= 0)); | ||
674 | |||
675 | list_splice_init(list, &next_lip->li_ail); | ||
676 | return; | ||
677 | } | ||
678 | |||
679 | /* | ||
680 | * Delete the given item from the AIL. Return a pointer to the item. | ||
681 | */ | ||
682 | STATIC void | ||
683 | xfs_ail_delete( | ||
684 | struct xfs_ail *ailp, | ||
685 | xfs_log_item_t *lip) | ||
686 | { | ||
687 | xfs_ail_check(ailp, lip); | ||
688 | list_del(&lip->li_ail); | ||
689 | xfs_trans_ail_cursor_clear(ailp, lip); | ||
690 | } | ||
691 | |||
692 | /* | ||
693 | * Return a pointer to the first item in the AIL. | ||
694 | * If the AIL is empty, then return NULL. | ||
695 | */ | ||
696 | STATIC xfs_log_item_t * | ||
697 | xfs_ail_min( | ||
698 | struct xfs_ail *ailp) | ||
699 | { | ||
700 | if (list_empty(&ailp->xa_ail)) | ||
701 | return NULL; | ||
702 | |||
703 | return list_first_entry(&ailp->xa_ail, xfs_log_item_t, li_ail); | ||
704 | } | ||
705 | |||
706 | /* | ||
707 | * Return a pointer to the item which follows | ||
708 | * the given item in the AIL. If the given item | ||
709 | * is the last item in the list, then return NULL. | ||
710 | */ | ||
711 | STATIC xfs_log_item_t * | ||
712 | xfs_ail_next( | ||
713 | struct xfs_ail *ailp, | ||
714 | xfs_log_item_t *lip) | ||
715 | { | ||
716 | if (lip->li_ail.next == &ailp->xa_ail) | ||
717 | return NULL; | ||
718 | |||
719 | return list_first_entry(&lip->li_ail, xfs_log_item_t, li_ail); | ||
720 | } | ||
721 | |||
722 | #ifdef DEBUG | ||
723 | /* | ||
724 | * Check that the list is sorted as it should be. | ||
725 | */ | ||
726 | STATIC void | ||
727 | xfs_ail_check( | ||
728 | struct xfs_ail *ailp, | ||
729 | xfs_log_item_t *lip) | ||
730 | { | ||
731 | xfs_log_item_t *prev_lip; | ||
732 | |||
733 | if (list_empty(&ailp->xa_ail)) | ||
734 | return; | ||
735 | |||
736 | /* | ||
737 | * Check the next and previous entries are valid. | ||
738 | */ | ||
739 | ASSERT((lip->li_flags & XFS_LI_IN_AIL) != 0); | ||
740 | prev_lip = list_entry(lip->li_ail.prev, xfs_log_item_t, li_ail); | ||
741 | if (&prev_lip->li_ail != &ailp->xa_ail) | ||
742 | ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) <= 0); | ||
743 | |||
744 | prev_lip = list_entry(lip->li_ail.next, xfs_log_item_t, li_ail); | ||
745 | if (&prev_lip->li_ail != &ailp->xa_ail) | ||
746 | ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) >= 0); | ||
747 | |||
748 | |||
749 | #ifdef XFS_TRANS_DEBUG | ||
750 | /* | ||
751 | * Walk the list checking lsn ordering, and that every entry has the | ||
752 | * XFS_LI_IN_AIL flag set. This is really expensive, so only do it | ||
753 | * when specifically debugging the transaction subsystem. | ||
754 | */ | ||
755 | prev_lip = list_entry(&ailp->xa_ail, xfs_log_item_t, li_ail); | ||
756 | list_for_each_entry(lip, &ailp->xa_ail, li_ail) { | ||
757 | if (&prev_lip->li_ail != &ailp->xa_ail) | ||
758 | ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) <= 0); | ||
759 | ASSERT((lip->li_flags & XFS_LI_IN_AIL) != 0); | ||
760 | prev_lip = lip; | ||
761 | } | ||
762 | #endif /* XFS_TRANS_DEBUG */ | ||
763 | } | ||
764 | #endif /* DEBUG */ | ||
diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h index 35162c238fa3..6b164e9e9a1f 100644 --- a/fs/xfs/xfs_trans_priv.h +++ b/fs/xfs/xfs_trans_priv.h | |||
@@ -65,16 +65,22 @@ struct xfs_ail_cursor { | |||
65 | struct xfs_ail { | 65 | struct xfs_ail { |
66 | struct xfs_mount *xa_mount; | 66 | struct xfs_mount *xa_mount; |
67 | struct list_head xa_ail; | 67 | struct list_head xa_ail; |
68 | uint xa_gen; | ||
69 | struct task_struct *xa_task; | ||
70 | xfs_lsn_t xa_target; | 68 | xfs_lsn_t xa_target; |
71 | struct xfs_ail_cursor xa_cursors; | 69 | struct xfs_ail_cursor xa_cursors; |
72 | spinlock_t xa_lock; | 70 | spinlock_t xa_lock; |
71 | struct delayed_work xa_work; | ||
72 | xfs_lsn_t xa_last_pushed_lsn; | ||
73 | unsigned long xa_flags; | ||
73 | }; | 74 | }; |
74 | 75 | ||
76 | #define XFS_AIL_PUSHING_BIT 0 | ||
77 | |||
75 | /* | 78 | /* |
76 | * From xfs_trans_ail.c | 79 | * From xfs_trans_ail.c |
77 | */ | 80 | */ |
81 | |||
82 | extern struct workqueue_struct *xfs_ail_wq; /* AIL workqueue */ | ||
83 | |||
78 | void xfs_trans_ail_update_bulk(struct xfs_ail *ailp, | 84 | void xfs_trans_ail_update_bulk(struct xfs_ail *ailp, |
79 | struct xfs_log_item **log_items, int nr_items, | 85 | struct xfs_log_item **log_items, int nr_items, |
80 | xfs_lsn_t lsn) __releases(ailp->xa_lock); | 86 | xfs_lsn_t lsn) __releases(ailp->xa_lock); |
@@ -98,12 +104,13 @@ xfs_trans_ail_delete( | |||
98 | xfs_trans_ail_delete_bulk(ailp, &lip, 1); | 104 | xfs_trans_ail_delete_bulk(ailp, &lip, 1); |
99 | } | 105 | } |
100 | 106 | ||
101 | void xfs_trans_ail_push(struct xfs_ail *, xfs_lsn_t); | 107 | void xfs_ail_push(struct xfs_ail *, xfs_lsn_t); |
108 | void xfs_ail_push_all(struct xfs_ail *); | ||
109 | xfs_lsn_t xfs_ail_min_lsn(struct xfs_ail *ailp); | ||
110 | |||
102 | void xfs_trans_unlocked_item(struct xfs_ail *, | 111 | void xfs_trans_unlocked_item(struct xfs_ail *, |
103 | xfs_log_item_t *); | 112 | xfs_log_item_t *); |
104 | 113 | ||
105 | xfs_lsn_t xfs_trans_ail_tail(struct xfs_ail *ailp); | ||
106 | |||
107 | struct xfs_log_item *xfs_trans_ail_cursor_first(struct xfs_ail *ailp, | 114 | struct xfs_log_item *xfs_trans_ail_cursor_first(struct xfs_ail *ailp, |
108 | struct xfs_ail_cursor *cur, | 115 | struct xfs_ail_cursor *cur, |
109 | xfs_lsn_t lsn); | 116 | xfs_lsn_t lsn); |
@@ -112,11 +119,6 @@ struct xfs_log_item *xfs_trans_ail_cursor_next(struct xfs_ail *ailp, | |||
112 | void xfs_trans_ail_cursor_done(struct xfs_ail *ailp, | 119 | void xfs_trans_ail_cursor_done(struct xfs_ail *ailp, |
113 | struct xfs_ail_cursor *cur); | 120 | struct xfs_ail_cursor *cur); |
114 | 121 | ||
115 | long xfsaild_push(struct xfs_ail *, xfs_lsn_t *); | ||
116 | void xfsaild_wakeup(struct xfs_ail *, xfs_lsn_t); | ||
117 | int xfsaild_start(struct xfs_ail *); | ||
118 | void xfsaild_stop(struct xfs_ail *); | ||
119 | |||
120 | #if BITS_PER_LONG != 64 | 122 | #if BITS_PER_LONG != 64 |
121 | static inline void | 123 | static inline void |
122 | xfs_trans_ail_copy_lsn( | 124 | xfs_trans_ail_copy_lsn( |
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index f22e7fe4b6db..ade09d7b4271 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
@@ -118,6 +118,7 @@ int drm_fb_helper_setcolreg(unsigned regno, | |||
118 | unsigned transp, | 118 | unsigned transp, |
119 | struct fb_info *info); | 119 | struct fb_info *info); |
120 | 120 | ||
121 | bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper); | ||
121 | void drm_fb_helper_restore(void); | 122 | void drm_fb_helper_restore(void); |
122 | void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, | 123 | void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, |
123 | uint32_t fb_width, uint32_t fb_height); | 124 | uint32_t fb_width, uint32_t fb_height); |
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h index 3bce1a4fc305..7aa5dddb2098 100644 --- a/include/drm/radeon_drm.h +++ b/include/drm/radeon_drm.h | |||
@@ -909,6 +909,7 @@ struct drm_radeon_cs { | |||
909 | #define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */ | 909 | #define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */ |
910 | #define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */ | 910 | #define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */ |
911 | #define RADEON_INFO_NUM_BACKENDS 0x0a /* DB/backends for r600+ - need for OQ */ | 911 | #define RADEON_INFO_NUM_BACKENDS 0x0a /* DB/backends for r600+ - need for OQ */ |
912 | #define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */ | ||
912 | 913 | ||
913 | struct drm_radeon_info { | 914 | struct drm_radeon_info { |
914 | uint32_t request; | 915 | uint32_t request; |
diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h index e612575a2596..b4326bfa684f 100644 --- a/include/linux/bit_spinlock.h +++ b/include/linux/bit_spinlock.h | |||
@@ -23,11 +23,11 @@ static inline void bit_spin_lock(int bitnum, unsigned long *addr) | |||
23 | preempt_disable(); | 23 | preempt_disable(); |
24 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | 24 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
25 | while (unlikely(test_and_set_bit_lock(bitnum, addr))) { | 25 | while (unlikely(test_and_set_bit_lock(bitnum, addr))) { |
26 | while (test_bit(bitnum, addr)) { | 26 | preempt_enable(); |
27 | preempt_enable(); | 27 | do { |
28 | cpu_relax(); | 28 | cpu_relax(); |
29 | preempt_disable(); | 29 | } while (test_bit(bitnum, addr)); |
30 | } | 30 | preempt_disable(); |
31 | } | 31 | } |
32 | #endif | 32 | #endif |
33 | __acquire(bitlock); | 33 | __acquire(bitlock); |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 32176cc8e715..2ad95fa1d130 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -388,20 +388,19 @@ struct request_queue | |||
388 | #define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */ | 388 | #define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */ |
389 | #define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */ | 389 | #define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */ |
390 | #define QUEUE_FLAG_DEAD 5 /* queue being torn down */ | 390 | #define QUEUE_FLAG_DEAD 5 /* queue being torn down */ |
391 | #define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ | 391 | #define QUEUE_FLAG_ELVSWITCH 6 /* don't use elevator, just do FIFO */ |
392 | #define QUEUE_FLAG_ELVSWITCH 7 /* don't use elevator, just do FIFO */ | 392 | #define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */ |
393 | #define QUEUE_FLAG_BIDI 8 /* queue supports bidi requests */ | 393 | #define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */ |
394 | #define QUEUE_FLAG_NOMERGES 9 /* disable merge attempts */ | 394 | #define QUEUE_FLAG_SAME_COMP 9 /* force complete on same CPU */ |
395 | #define QUEUE_FLAG_SAME_COMP 10 /* force complete on same CPU */ | 395 | #define QUEUE_FLAG_FAIL_IO 10 /* fake timeout */ |
396 | #define QUEUE_FLAG_FAIL_IO 11 /* fake timeout */ | 396 | #define QUEUE_FLAG_STACKABLE 11 /* supports request stacking */ |
397 | #define QUEUE_FLAG_STACKABLE 12 /* supports request stacking */ | 397 | #define QUEUE_FLAG_NONROT 12 /* non-rotational device (SSD) */ |
398 | #define QUEUE_FLAG_NONROT 13 /* non-rotational device (SSD) */ | ||
399 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ | 398 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ |
400 | #define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ | 399 | #define QUEUE_FLAG_IO_STAT 13 /* do IO stats */ |
401 | #define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ | 400 | #define QUEUE_FLAG_DISCARD 14 /* supports DISCARD */ |
402 | #define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ | 401 | #define QUEUE_FLAG_NOXMERGES 15 /* No extended merges */ |
403 | #define QUEUE_FLAG_ADD_RANDOM 18 /* Contributes to random pool */ | 402 | #define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */ |
404 | #define QUEUE_FLAG_SECDISCARD 19 /* supports SECDISCARD */ | 403 | #define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */ |
405 | 404 | ||
406 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 405 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
407 | (1 << QUEUE_FLAG_STACKABLE) | \ | 406 | (1 << QUEUE_FLAG_STACKABLE) | \ |
@@ -697,8 +696,9 @@ extern void blk_start_queue(struct request_queue *q); | |||
697 | extern void blk_stop_queue(struct request_queue *q); | 696 | extern void blk_stop_queue(struct request_queue *q); |
698 | extern void blk_sync_queue(struct request_queue *q); | 697 | extern void blk_sync_queue(struct request_queue *q); |
699 | extern void __blk_stop_queue(struct request_queue *q); | 698 | extern void __blk_stop_queue(struct request_queue *q); |
700 | extern void __blk_run_queue(struct request_queue *q, bool force_kblockd); | 699 | extern void __blk_run_queue(struct request_queue *q); |
701 | extern void blk_run_queue(struct request_queue *); | 700 | extern void blk_run_queue(struct request_queue *); |
701 | extern void blk_run_queue_async(struct request_queue *q); | ||
702 | extern int blk_rq_map_user(struct request_queue *, struct request *, | 702 | extern int blk_rq_map_user(struct request_queue *, struct request *, |
703 | struct rq_map_data *, void __user *, unsigned long, | 703 | struct rq_map_data *, void __user *, unsigned long, |
704 | gfp_t); | 704 | gfp_t); |
@@ -857,26 +857,39 @@ extern void blk_put_queue(struct request_queue *); | |||
857 | struct blk_plug { | 857 | struct blk_plug { |
858 | unsigned long magic; | 858 | unsigned long magic; |
859 | struct list_head list; | 859 | struct list_head list; |
860 | struct list_head cb_list; | ||
860 | unsigned int should_sort; | 861 | unsigned int should_sort; |
861 | }; | 862 | }; |
863 | struct blk_plug_cb { | ||
864 | struct list_head list; | ||
865 | void (*callback)(struct blk_plug_cb *); | ||
866 | }; | ||
862 | 867 | ||
863 | extern void blk_start_plug(struct blk_plug *); | 868 | extern void blk_start_plug(struct blk_plug *); |
864 | extern void blk_finish_plug(struct blk_plug *); | 869 | extern void blk_finish_plug(struct blk_plug *); |
865 | extern void __blk_flush_plug(struct task_struct *, struct blk_plug *); | 870 | extern void blk_flush_plug_list(struct blk_plug *, bool); |
866 | 871 | ||
867 | static inline void blk_flush_plug(struct task_struct *tsk) | 872 | static inline void blk_flush_plug(struct task_struct *tsk) |
868 | { | 873 | { |
869 | struct blk_plug *plug = tsk->plug; | 874 | struct blk_plug *plug = tsk->plug; |
870 | 875 | ||
871 | if (unlikely(plug)) | 876 | if (plug) |
872 | __blk_flush_plug(tsk, plug); | 877 | blk_flush_plug_list(plug, false); |
878 | } | ||
879 | |||
880 | static inline void blk_schedule_flush_plug(struct task_struct *tsk) | ||
881 | { | ||
882 | struct blk_plug *plug = tsk->plug; | ||
883 | |||
884 | if (plug) | ||
885 | blk_flush_plug_list(plug, true); | ||
873 | } | 886 | } |
874 | 887 | ||
875 | static inline bool blk_needs_flush_plug(struct task_struct *tsk) | 888 | static inline bool blk_needs_flush_plug(struct task_struct *tsk) |
876 | { | 889 | { |
877 | struct blk_plug *plug = tsk->plug; | 890 | struct blk_plug *plug = tsk->plug; |
878 | 891 | ||
879 | return plug && !list_empty(&plug->list); | 892 | return plug && (!list_empty(&plug->list) || !list_empty(&plug->cb_list)); |
880 | } | 893 | } |
881 | 894 | ||
882 | /* | 895 | /* |
@@ -1314,6 +1327,11 @@ static inline void blk_flush_plug(struct task_struct *task) | |||
1314 | { | 1327 | { |
1315 | } | 1328 | } |
1316 | 1329 | ||
1330 | static inline void blk_schedule_flush_plug(struct task_struct *task) | ||
1331 | { | ||
1332 | } | ||
1333 | |||
1334 | |||
1317 | static inline bool blk_needs_flush_plug(struct task_struct *tsk) | 1335 | static inline bool blk_needs_flush_plug(struct task_struct *tsk) |
1318 | { | 1336 | { |
1319 | return false; | 1337 | return false; |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index f2afed4fa945..19d90a55541d 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -197,7 +197,7 @@ struct dentry_operations { | |||
197 | * typically using d_splice_alias. */ | 197 | * typically using d_splice_alias. */ |
198 | 198 | ||
199 | #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ | 199 | #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ |
200 | #define DCACHE_UNHASHED 0x0010 | 200 | #define DCACHE_RCUACCESS 0x0010 /* Entry has ever been RCU-visible */ |
201 | #define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 | 201 | #define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 |
202 | /* Parent inode is watched by inotify */ | 202 | /* Parent inode is watched by inotify */ |
203 | 203 | ||
@@ -384,7 +384,7 @@ extern struct dentry *dget_parent(struct dentry *dentry); | |||
384 | 384 | ||
385 | static inline int d_unhashed(struct dentry *dentry) | 385 | static inline int d_unhashed(struct dentry *dentry) |
386 | { | 386 | { |
387 | return (dentry->d_flags & DCACHE_UNHASHED); | 387 | return hlist_bl_unhashed(&dentry->d_hash); |
388 | } | 388 | } |
389 | 389 | ||
390 | static inline int d_unlinked(struct dentry *dentry) | 390 | static inline int d_unlinked(struct dentry *dentry) |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index e2768834f397..32a4423710f5 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -197,7 +197,6 @@ struct dm_target { | |||
197 | struct dm_target_callbacks { | 197 | struct dm_target_callbacks { |
198 | struct list_head list; | 198 | struct list_head list; |
199 | int (*congested_fn) (struct dm_target_callbacks *, int); | 199 | int (*congested_fn) (struct dm_target_callbacks *, int); |
200 | void (*unplug_fn)(struct dm_target_callbacks *); | ||
201 | }; | 200 | }; |
202 | 201 | ||
203 | int dm_register_target(struct target_type *t); | 202 | int dm_register_target(struct target_type *t); |
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index df29c8fde36b..8847c8c29791 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h | |||
@@ -117,7 +117,7 @@ static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, | |||
117 | unsigned long end, | 117 | unsigned long end, |
118 | long adjust_next) | 118 | long adjust_next) |
119 | { | 119 | { |
120 | if (!vma->anon_vma || vma->vm_ops || vma->vm_file) | 120 | if (!vma->anon_vma || vma->vm_ops) |
121 | return; | 121 | return; |
122 | __vma_adjust_trans_huge(vma, start, end, adjust_next); | 122 | __vma_adjust_trans_huge(vma, start, end, adjust_next); |
123 | } | 123 | } |
diff --git a/include/linux/input.h b/include/linux/input.h index f3a7794a18c4..771d6d85667d 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -167,6 +167,7 @@ struct input_keymap_entry { | |||
167 | #define SYN_REPORT 0 | 167 | #define SYN_REPORT 0 |
168 | #define SYN_CONFIG 1 | 168 | #define SYN_CONFIG 1 |
169 | #define SYN_MT_REPORT 2 | 169 | #define SYN_MT_REPORT 2 |
170 | #define SYN_DROPPED 3 | ||
170 | 171 | ||
171 | /* | 172 | /* |
172 | * Keys and buttons | 173 | * Keys and buttons |
@@ -553,8 +554,8 @@ struct input_keymap_entry { | |||
553 | #define KEY_DVD 0x185 /* Media Select DVD */ | 554 | #define KEY_DVD 0x185 /* Media Select DVD */ |
554 | #define KEY_AUX 0x186 | 555 | #define KEY_AUX 0x186 |
555 | #define KEY_MP3 0x187 | 556 | #define KEY_MP3 0x187 |
556 | #define KEY_AUDIO 0x188 | 557 | #define KEY_AUDIO 0x188 /* AL Audio Browser */ |
557 | #define KEY_VIDEO 0x189 | 558 | #define KEY_VIDEO 0x189 /* AL Movie Browser */ |
558 | #define KEY_DIRECTORY 0x18a | 559 | #define KEY_DIRECTORY 0x18a |
559 | #define KEY_LIST 0x18b | 560 | #define KEY_LIST 0x18b |
560 | #define KEY_MEMO 0x18c /* Media Select Messages */ | 561 | #define KEY_MEMO 0x18c /* Media Select Messages */ |
@@ -603,8 +604,9 @@ struct input_keymap_entry { | |||
603 | #define KEY_FRAMEFORWARD 0x1b5 | 604 | #define KEY_FRAMEFORWARD 0x1b5 |
604 | #define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ | 605 | #define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ |
605 | #define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ | 606 | #define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ |
606 | #define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */ | 607 | #define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */ |
607 | #define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */ | 608 | #define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */ |
609 | #define KEY_IMAGES 0x1ba /* AL Image Browser */ | ||
608 | 610 | ||
609 | #define KEY_DEL_EOL 0x1c0 | 611 | #define KEY_DEL_EOL 0x1c0 |
610 | #define KEY_DEL_EOS 0x1c1 | 612 | #define KEY_DEL_EOS 0x1c1 |
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h index b3ac06a4435d..318bb82325a6 100644 --- a/include/linux/input/mt.h +++ b/include/linux/input/mt.h | |||
@@ -48,6 +48,12 @@ static inline void input_mt_slot(struct input_dev *dev, int slot) | |||
48 | input_event(dev, EV_ABS, ABS_MT_SLOT, slot); | 48 | input_event(dev, EV_ABS, ABS_MT_SLOT, slot); |
49 | } | 49 | } |
50 | 50 | ||
51 | static inline bool input_is_mt_axis(int axis) | ||
52 | { | ||
53 | return axis == ABS_MT_SLOT || | ||
54 | (axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST); | ||
55 | } | ||
56 | |||
51 | void input_mt_report_slot_state(struct input_dev *dev, | 57 | void input_mt_report_slot_state(struct input_dev *dev, |
52 | unsigned int tool_type, bool active); | 58 | unsigned int tool_type, bool active); |
53 | 59 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index 7f675aa81d87..04f32a3eb26b 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -137,8 +137,6 @@ enum { | |||
137 | ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */ | 137 | ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */ |
138 | ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */ | 138 | ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */ |
139 | ATA_DFLAG_AN = (1 << 7), /* AN configured */ | 139 | ATA_DFLAG_AN = (1 << 7), /* AN configured */ |
140 | ATA_DFLAG_HIPM = (1 << 8), /* device supports HIPM */ | ||
141 | ATA_DFLAG_DIPM = (1 << 9), /* device supports DIPM */ | ||
142 | ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */ | 140 | ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */ |
143 | ATA_DFLAG_CFG_MASK = (1 << 12) - 1, | 141 | ATA_DFLAG_CFG_MASK = (1 << 12) - 1, |
144 | 142 | ||
@@ -198,6 +196,7 @@ enum { | |||
198 | * management */ | 196 | * management */ |
199 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity | 197 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity |
200 | * led */ | 198 | * led */ |
199 | ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */ | ||
201 | 200 | ||
202 | /* bits 24:31 of ap->flags are reserved for LLD specific flags */ | 201 | /* bits 24:31 of ap->flags are reserved for LLD specific flags */ |
203 | 202 | ||
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h index 5bad17d1acde..31f9d75adc5b 100644 --- a/include/linux/list_bl.h +++ b/include/linux/list_bl.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _LINUX_LIST_BL_H | 2 | #define _LINUX_LIST_BL_H |
3 | 3 | ||
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <linux/bit_spinlock.h> | ||
5 | 6 | ||
6 | /* | 7 | /* |
7 | * Special version of lists, where head of the list has a lock in the lowest | 8 | * Special version of lists, where head of the list has a lock in the lowest |
@@ -114,6 +115,16 @@ static inline void hlist_bl_del_init(struct hlist_bl_node *n) | |||
114 | } | 115 | } |
115 | } | 116 | } |
116 | 117 | ||
118 | static inline void hlist_bl_lock(struct hlist_bl_head *b) | ||
119 | { | ||
120 | bit_spin_lock(0, (unsigned long *)b); | ||
121 | } | ||
122 | |||
123 | static inline void hlist_bl_unlock(struct hlist_bl_head *b) | ||
124 | { | ||
125 | __bit_spin_unlock(0, (unsigned long *)b); | ||
126 | } | ||
127 | |||
117 | /** | 128 | /** |
118 | * hlist_bl_for_each_entry - iterate over list of given type | 129 | * hlist_bl_for_each_entry - iterate over list of given type |
119 | * @tpos: the type * to use as a loop cursor. | 130 | * @tpos: the type * to use as a loop cursor. |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 5a5ce7055839..5e9840f50980 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -216,7 +216,7 @@ static inline void mem_cgroup_del_lru_list(struct page *page, int lru) | |||
216 | return ; | 216 | return ; |
217 | } | 217 | } |
218 | 218 | ||
219 | static inline inline void mem_cgroup_rotate_reclaimable_page(struct page *page) | 219 | static inline void mem_cgroup_rotate_reclaimable_page(struct page *page) |
220 | { | 220 | { |
221 | return ; | 221 | return ; |
222 | } | 222 | } |
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h index ad1b19aa6508..aef23309a742 100644 --- a/include/linux/mfd/core.h +++ b/include/linux/mfd/core.h | |||
@@ -86,16 +86,25 @@ extern int mfd_clone_cell(const char *cell, const char **clones, | |||
86 | */ | 86 | */ |
87 | static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev) | 87 | static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev) |
88 | { | 88 | { |
89 | return pdev->dev.platform_data; | 89 | return pdev->mfd_cell; |
90 | } | 90 | } |
91 | 91 | ||
92 | /* | 92 | /* |
93 | * Given a platform device that's been created by mfd_add_devices(), fetch | 93 | * Given a platform device that's been created by mfd_add_devices(), fetch |
94 | * the .mfd_data entry from the mfd_cell that created it. | 94 | * the .mfd_data entry from the mfd_cell that created it. |
95 | * Otherwise just return the platform_data pointer. | ||
96 | * This maintains compatibility with platform drivers whose devices aren't | ||
97 | * created by the mfd layer, and expect platform_data to contain what would've | ||
98 | * otherwise been in mfd_data. | ||
95 | */ | 99 | */ |
96 | static inline void *mfd_get_data(struct platform_device *pdev) | 100 | static inline void *mfd_get_data(struct platform_device *pdev) |
97 | { | 101 | { |
98 | return mfd_get_cell(pdev)->mfd_data; | 102 | const struct mfd_cell *cell = mfd_get_cell(pdev); |
103 | |||
104 | if (cell) | ||
105 | return cell->mfd_data; | ||
106 | else | ||
107 | return pdev->dev.platform_data; | ||
99 | } | 108 | } |
100 | 109 | ||
101 | extern int mfd_add_devices(struct device *parent, int id, | 110 | extern int mfd_add_devices(struct device *parent, int id, |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 692dbae6ffa7..2348db26bc3d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -137,7 +137,8 @@ extern unsigned int kobjsize(const void *objp); | |||
137 | #define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ) | 137 | #define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ) |
138 | 138 | ||
139 | /* | 139 | /* |
140 | * special vmas that are non-mergable, non-mlock()able | 140 | * Special vmas that are non-mergable, non-mlock()able. |
141 | * Note: mm/huge_memory.c VM_NO_THP depends on this definition. | ||
141 | */ | 142 | */ |
142 | #define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP) | 143 | #define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP) |
143 | 144 | ||
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 216cea5db0aa..87694ca86914 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -47,6 +47,7 @@ struct nfs_client { | |||
47 | 47 | ||
48 | #ifdef CONFIG_NFS_V4 | 48 | #ifdef CONFIG_NFS_V4 |
49 | u64 cl_clientid; /* constant */ | 49 | u64 cl_clientid; /* constant */ |
50 | nfs4_verifier cl_confirm; /* Clientid verifier */ | ||
50 | unsigned long cl_state; | 51 | unsigned long cl_state; |
51 | 52 | ||
52 | spinlock_t cl_lock; | 53 | spinlock_t cl_lock; |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 78b101e487ea..890dce242639 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -50,6 +50,7 @@ struct nfs_fattr { | |||
50 | } du; | 50 | } du; |
51 | struct nfs_fsid fsid; | 51 | struct nfs_fsid fsid; |
52 | __u64 fileid; | 52 | __u64 fileid; |
53 | __u64 mounted_on_fileid; | ||
53 | struct timespec atime; | 54 | struct timespec atime; |
54 | struct timespec mtime; | 55 | struct timespec mtime; |
55 | struct timespec ctime; | 56 | struct timespec ctime; |
@@ -83,6 +84,7 @@ struct nfs_fattr { | |||
83 | #define NFS_ATTR_FATTR_PRECHANGE (1U << 18) | 84 | #define NFS_ATTR_FATTR_PRECHANGE (1U << 18) |
84 | #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ | 85 | #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ |
85 | #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */ | 86 | #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */ |
87 | #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21) | ||
86 | 88 | ||
87 | #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ | 89 | #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ |
88 | | NFS_ATTR_FATTR_MODE \ | 90 | | NFS_ATTR_FATTR_MODE \ |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 4e2c9150a785..8abe8d78c4bf 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -2477,15 +2477,12 @@ | |||
2477 | #define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 | 2477 | #define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 |
2478 | #define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 | 2478 | #define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 |
2479 | #define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 | 2479 | #define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 |
2480 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22 | ||
2481 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MIN 0x1c41 | 2480 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MIN 0x1c41 |
2482 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MAX 0x1c5f | 2481 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MAX 0x1c5f |
2483 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 | ||
2484 | #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_0 0x1d40 | 2482 | #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_0 0x1d40 |
2485 | #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_1 0x1d41 | 2483 | #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_1 0x1d41 |
2486 | #define PCI_DEVICE_ID_INTEL_DH89XXCC_LPC_MIN 0x2310 | 2484 | #define PCI_DEVICE_ID_INTEL_DH89XXCC_LPC_MIN 0x2310 |
2487 | #define PCI_DEVICE_ID_INTEL_DH89XXCC_LPC_MAX 0x231f | 2485 | #define PCI_DEVICE_ID_INTEL_DH89XXCC_LPC_MAX 0x231f |
2488 | #define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS 0x2330 | ||
2489 | #define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 | 2486 | #define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 |
2490 | #define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 | 2487 | #define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 |
2491 | #define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 | 2488 | #define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 |
@@ -2696,7 +2693,6 @@ | |||
2696 | #define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 | 2693 | #define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 |
2697 | #define PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MIN 0x3b00 | 2694 | #define PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MIN 0x3b00 |
2698 | #define PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MAX 0x3b1f | 2695 | #define PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MAX 0x3b1f |
2699 | #define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30 | ||
2700 | #define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f | 2696 | #define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f |
2701 | #define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 | 2697 | #define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 |
2702 | #define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 | 2698 | #define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 |
diff --git a/include/linux/pid.h b/include/linux/pid.h index 31afb7ecbe1f..cdced84261d7 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h | |||
@@ -117,7 +117,7 @@ extern struct pid *find_vpid(int nr); | |||
117 | */ | 117 | */ |
118 | extern struct pid *find_get_pid(int nr); | 118 | extern struct pid *find_get_pid(int nr); |
119 | extern struct pid *find_ge_pid(int nr, struct pid_namespace *); | 119 | extern struct pid *find_ge_pid(int nr, struct pid_namespace *); |
120 | int next_pidmap(struct pid_namespace *pid_ns, int last); | 120 | int next_pidmap(struct pid_namespace *pid_ns, unsigned int last); |
121 | 121 | ||
122 | extern struct pid *alloc_pid(struct pid_namespace *ns); | 122 | extern struct pid *alloc_pid(struct pid_namespace *ns); |
123 | extern void free_pid(struct pid *pid); | 123 | extern void free_pid(struct pid *pid); |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index d96db9825708..744942c95fec 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <linux/device.h> | 14 | #include <linux/device.h> |
15 | #include <linux/mod_devicetable.h> | 15 | #include <linux/mod_devicetable.h> |
16 | 16 | ||
17 | struct mfd_cell; | ||
18 | |||
17 | struct platform_device { | 19 | struct platform_device { |
18 | const char * name; | 20 | const char * name; |
19 | int id; | 21 | int id; |
@@ -23,6 +25,9 @@ struct platform_device { | |||
23 | 25 | ||
24 | const struct platform_device_id *id_entry; | 26 | const struct platform_device_id *id_entry; |
25 | 27 | ||
28 | /* MFD cell pointer */ | ||
29 | struct mfd_cell *mfd_cell; | ||
30 | |||
26 | /* arch specific additions */ | 31 | /* arch specific additions */ |
27 | struct pdev_archdata archdata; | 32 | struct pdev_archdata archdata; |
28 | }; | 33 | }; |
diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h index 369e19d3750b..7f1183dcd119 100644 --- a/include/linux/posix-clock.h +++ b/include/linux/posix-clock.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
25 | #include <linux/poll.h> | 25 | #include <linux/poll.h> |
26 | #include <linux/posix-timers.h> | 26 | #include <linux/posix-timers.h> |
27 | #include <linux/rwsem.h> | ||
27 | 28 | ||
28 | struct posix_clock; | 29 | struct posix_clock; |
29 | 30 | ||
@@ -104,7 +105,7 @@ struct posix_clock_operations { | |||
104 | * @ops: Functional interface to the clock | 105 | * @ops: Functional interface to the clock |
105 | * @cdev: Character device instance for this clock | 106 | * @cdev: Character device instance for this clock |
106 | * @kref: Reference count. | 107 | * @kref: Reference count. |
107 | * @mutex: Protects the 'zombie' field from concurrent access. | 108 | * @rwsem: Protects the 'zombie' field from concurrent access. |
108 | * @zombie: If 'zombie' is true, then the hardware has disappeared. | 109 | * @zombie: If 'zombie' is true, then the hardware has disappeared. |
109 | * @release: A function to free the structure when the reference count reaches | 110 | * @release: A function to free the structure when the reference count reaches |
110 | * zero. May be NULL if structure is statically allocated. | 111 | * zero. May be NULL if structure is statically allocated. |
@@ -117,7 +118,7 @@ struct posix_clock { | |||
117 | struct posix_clock_operations ops; | 118 | struct posix_clock_operations ops; |
118 | struct cdev cdev; | 119 | struct cdev cdev; |
119 | struct kref kref; | 120 | struct kref kref; |
120 | struct mutex mutex; | 121 | struct rw_semaphore rwsem; |
121 | bool zombie; | 122 | bool zombie; |
122 | void (*release)(struct posix_clock *clk); | 123 | void (*release)(struct posix_clock *clk); |
123 | }; | 124 | }; |
diff --git a/include/linux/rio.h b/include/linux/rio.h index 4e37a7cfa726..4d50611112ba 100644 --- a/include/linux/rio.h +++ b/include/linux/rio.h | |||
@@ -396,7 +396,7 @@ union rio_pw_msg { | |||
396 | }; | 396 | }; |
397 | 397 | ||
398 | /* Architecture and hardware-specific functions */ | 398 | /* Architecture and hardware-specific functions */ |
399 | extern void rio_register_mport(struct rio_mport *); | 399 | extern int rio_register_mport(struct rio_mport *); |
400 | extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); | 400 | extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); |
401 | extern void rio_close_inb_mbox(struct rio_mport *, int); | 401 | extern void rio_close_inb_mbox(struct rio_mport *, int); |
402 | extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int); | 402 | extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int); |
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h index 7410d3365e2a..0cee0152aca9 100644 --- a/include/linux/rio_ids.h +++ b/include/linux/rio_ids.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #define RIO_DID_IDTCPS6Q 0x035f | 35 | #define RIO_DID_IDTCPS6Q 0x035f |
36 | #define RIO_DID_IDTCPS10Q 0x035e | 36 | #define RIO_DID_IDTCPS10Q 0x035e |
37 | #define RIO_DID_IDTCPS1848 0x0374 | 37 | #define RIO_DID_IDTCPS1848 0x0374 |
38 | #define RIO_DID_IDTCPS1432 0x0375 | ||
38 | #define RIO_DID_IDTCPS1616 0x0379 | 39 | #define RIO_DID_IDTCPS1616 0x0379 |
39 | #define RIO_DID_IDTVPS1616 0x0377 | 40 | #define RIO_DID_IDTVPS1616 0x0377 |
40 | #define RIO_DID_IDTSPS1616 0x0378 | 41 | #define RIO_DID_IDTSPS1616 0x0378 |
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 2ca7e8a78060..877ece45426f 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
@@ -228,6 +228,8 @@ extern int rtc_read_alarm(struct rtc_device *rtc, | |||
228 | struct rtc_wkalrm *alrm); | 228 | struct rtc_wkalrm *alrm); |
229 | extern int rtc_set_alarm(struct rtc_device *rtc, | 229 | extern int rtc_set_alarm(struct rtc_device *rtc, |
230 | struct rtc_wkalrm *alrm); | 230 | struct rtc_wkalrm *alrm); |
231 | extern int rtc_initialize_alarm(struct rtc_device *rtc, | ||
232 | struct rtc_wkalrm *alrm); | ||
231 | extern void rtc_update_irq(struct rtc_device *rtc, | 233 | extern void rtc_update_irq(struct rtc_device *rtc, |
232 | unsigned long num, unsigned long events); | 234 | unsigned long num, unsigned long events); |
233 | 235 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4ec2c027e92c..18d63cea2848 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1254,6 +1254,9 @@ struct task_struct { | |||
1254 | #endif | 1254 | #endif |
1255 | 1255 | ||
1256 | struct mm_struct *mm, *active_mm; | 1256 | struct mm_struct *mm, *active_mm; |
1257 | #ifdef CONFIG_COMPAT_BRK | ||
1258 | unsigned brk_randomized:1; | ||
1259 | #endif | ||
1257 | #if defined(SPLIT_RSS_COUNTING) | 1260 | #if defined(SPLIT_RSS_COUNTING) |
1258 | struct task_rss_stat rss_stat; | 1261 | struct task_rss_stat rss_stat; |
1259 | #endif | 1262 | #endif |
diff --git a/include/linux/security.h b/include/linux/security.h index ca02f1716736..8ce59ef3e5af 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -1456,7 +1456,7 @@ struct security_operations { | |||
1456 | struct inode *new_dir, struct dentry *new_dentry); | 1456 | struct inode *new_dir, struct dentry *new_dentry); |
1457 | int (*inode_readlink) (struct dentry *dentry); | 1457 | int (*inode_readlink) (struct dentry *dentry); |
1458 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); | 1458 | int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); |
1459 | int (*inode_permission) (struct inode *inode, int mask); | 1459 | int (*inode_permission) (struct inode *inode, int mask, unsigned flags); |
1460 | int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); | 1460 | int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); |
1461 | int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); | 1461 | int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); |
1462 | int (*inode_setxattr) (struct dentry *dentry, const char *name, | 1462 | int (*inode_setxattr) (struct dentry *dentry, const char *name, |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index d81db8012c63..f73c482ec9c6 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -127,13 +127,16 @@ struct rpc_task_setup { | |||
127 | #define RPC_TASK_KILLED 0x0100 /* task was killed */ | 127 | #define RPC_TASK_KILLED 0x0100 /* task was killed */ |
128 | #define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */ | 128 | #define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */ |
129 | #define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ | 129 | #define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */ |
130 | #define RPC_TASK_SENT 0x0800 /* message was sent */ | ||
131 | #define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ | ||
130 | 132 | ||
131 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) | 133 | #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) |
132 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) | 134 | #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) |
133 | #define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) | 135 | #define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) |
134 | #define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) | 136 | #define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) |
135 | #define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) | 137 | #define RPC_IS_SOFT(t) ((t)->tk_flags & (RPC_TASK_SOFT|RPC_TASK_TIMEOUT)) |
136 | #define RPC_IS_SOFTCONN(t) ((t)->tk_flags & RPC_TASK_SOFTCONN) | 138 | #define RPC_IS_SOFTCONN(t) ((t)->tk_flags & RPC_TASK_SOFTCONN) |
139 | #define RPC_WAS_SENT(t) ((t)->tk_flags & RPC_TASK_SENT) | ||
137 | 140 | ||
138 | #define RPC_TASK_RUNNING 0 | 141 | #define RPC_TASK_RUNNING 0 |
139 | #define RPC_TASK_QUEUED 1 | 142 | #define RPC_TASK_QUEUED 1 |
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 5a89e3612875..083ffea7ba18 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -249,6 +249,8 @@ extern void hibernation_set_ops(const struct platform_hibernation_ops *ops); | |||
249 | extern int hibernate(void); | 249 | extern int hibernate(void); |
250 | extern bool system_entering_hibernation(void); | 250 | extern bool system_entering_hibernation(void); |
251 | #else /* CONFIG_HIBERNATION */ | 251 | #else /* CONFIG_HIBERNATION */ |
252 | static inline void register_nosave_region(unsigned long b, unsigned long e) {} | ||
253 | static inline void register_nosave_region_late(unsigned long b, unsigned long e) {} | ||
252 | static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } | 254 | static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } |
253 | static inline void swsusp_set_page_free(struct page *p) {} | 255 | static inline void swsusp_set_page_free(struct page *p) {} |
254 | static inline void swsusp_unset_page_free(struct page *p) {} | 256 | static inline void swsusp_unset_page_free(struct page *p) {} |
@@ -297,14 +299,7 @@ static inline bool pm_wakeup_pending(void) { return false; } | |||
297 | 299 | ||
298 | extern struct mutex pm_mutex; | 300 | extern struct mutex pm_mutex; |
299 | 301 | ||
300 | #ifndef CONFIG_HIBERNATION | 302 | #ifndef CONFIG_HIBERNATE_CALLBACKS |
301 | static inline void register_nosave_region(unsigned long b, unsigned long e) | ||
302 | { | ||
303 | } | ||
304 | static inline void register_nosave_region_late(unsigned long b, unsigned long e) | ||
305 | { | ||
306 | } | ||
307 | |||
308 | static inline void lock_system_sleep(void) {} | 303 | static inline void lock_system_sleep(void) {} |
309 | static inline void unlock_system_sleep(void) {} | 304 | static inline void unlock_system_sleep(void) {} |
310 | 305 | ||
diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h index 7054a7a8065e..de5c15921025 100644 --- a/include/linux/v4l2-mediabus.h +++ b/include/linux/v4l2-mediabus.h | |||
@@ -47,7 +47,7 @@ enum v4l2_mbus_pixelcode { | |||
47 | V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007, | 47 | V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007, |
48 | V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008, | 48 | V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008, |
49 | 49 | ||
50 | /* YUV (including grey) - next is 0x2013 */ | 50 | /* YUV (including grey) - next is 0x2014 */ |
51 | V4L2_MBUS_FMT_Y8_1X8 = 0x2001, | 51 | V4L2_MBUS_FMT_Y8_1X8 = 0x2001, |
52 | V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002, | 52 | V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002, |
53 | V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003, | 53 | V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003, |
@@ -60,6 +60,7 @@ enum v4l2_mbus_pixelcode { | |||
60 | V4L2_MBUS_FMT_Y10_1X10 = 0x200a, | 60 | V4L2_MBUS_FMT_Y10_1X10 = 0x200a, |
61 | V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b, | 61 | V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b, |
62 | V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c, | 62 | V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c, |
63 | V4L2_MBUS_FMT_Y12_1X12 = 0x2013, | ||
63 | V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f, | 64 | V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f, |
64 | V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010, | 65 | V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010, |
65 | V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011, | 66 | V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011, |
@@ -67,9 +68,11 @@ enum v4l2_mbus_pixelcode { | |||
67 | V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d, | 68 | V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d, |
68 | V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e, | 69 | V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e, |
69 | 70 | ||
70 | /* Bayer - next is 0x3013 */ | 71 | /* Bayer - next is 0x3015 */ |
71 | V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001, | 72 | V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001, |
73 | V4L2_MBUS_FMT_SGBRG8_1X8 = 0x3013, | ||
72 | V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002, | 74 | V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002, |
75 | V4L2_MBUS_FMT_SRGGB8_1X8 = 0x3014, | ||
73 | V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b, | 76 | V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b, |
74 | V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c, | 77 | V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c, |
75 | V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009, | 78 | V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009, |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index aa6c393b7ae9..be82c8ead1af 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -308,6 +308,7 @@ struct v4l2_pix_format { | |||
308 | #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ | 308 | #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ |
309 | #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ | 309 | #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ |
310 | #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ | 310 | #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ |
311 | #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */ | ||
311 | #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ | 312 | #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ |
312 | 313 | ||
313 | /* Palette formats */ | 314 | /* Palette formats */ |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 461c0119664f..2b3831b58aa4 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
@@ -58,6 +58,13 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | |||
58 | UNEVICTABLE_PGCLEARED, /* on COW, page truncate */ | 58 | UNEVICTABLE_PGCLEARED, /* on COW, page truncate */ |
59 | UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */ | 59 | UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */ |
60 | UNEVICTABLE_MLOCKFREED, | 60 | UNEVICTABLE_MLOCKFREED, |
61 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
62 | THP_FAULT_ALLOC, | ||
63 | THP_FAULT_FALLBACK, | ||
64 | THP_COLLAPSE_ALLOC, | ||
65 | THP_COLLAPSE_ALLOC_FAILED, | ||
66 | THP_SPLIT, | ||
67 | #endif | ||
61 | NR_VM_EVENT_ITEMS | 68 | NR_VM_EVENT_ITEMS |
62 | }; | 69 | }; |
63 | 70 | ||
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h index bd102cf509ac..d61febfb1668 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h | |||
@@ -163,7 +163,7 @@ v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev); | |||
163 | ({ \ | 163 | ({ \ |
164 | struct v4l2_subdev *__sd; \ | 164 | struct v4l2_subdev *__sd; \ |
165 | __v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd, cond, o, \ | 165 | __v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd, cond, o, \ |
166 | f, args...); \ | 166 | f , ##args); \ |
167 | }) | 167 | }) |
168 | 168 | ||
169 | /* Call the specified callback for all subdevs matching grp_id (if 0, then | 169 | /* Call the specified callback for all subdevs matching grp_id (if 0, then |
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h index cdf2e8ac4309..d2df55b0c213 100644 --- a/include/net/9p/9p.h +++ b/include/net/9p/9p.h | |||
@@ -139,8 +139,6 @@ do { \ | |||
139 | */ | 139 | */ |
140 | 140 | ||
141 | enum p9_msg_t { | 141 | enum p9_msg_t { |
142 | P9_TSYNCFS = 0, | ||
143 | P9_RSYNCFS, | ||
144 | P9_TLERROR = 6, | 142 | P9_TLERROR = 6, |
145 | P9_RLERROR, | 143 | P9_RLERROR, |
146 | P9_TSTATFS = 8, | 144 | P9_TSTATFS = 8, |
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index 85c1413f054d..051a99f79769 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
@@ -218,8 +218,8 @@ void p9_client_disconnect(struct p9_client *clnt); | |||
218 | void p9_client_begin_disconnect(struct p9_client *clnt); | 218 | void p9_client_begin_disconnect(struct p9_client *clnt); |
219 | struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, | 219 | struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, |
220 | char *uname, u32 n_uname, char *aname); | 220 | char *uname, u32 n_uname, char *aname); |
221 | struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, | 221 | struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname, |
222 | int clone); | 222 | char **wnames, int clone); |
223 | int p9_client_open(struct p9_fid *fid, int mode); | 223 | int p9_client_open(struct p9_fid *fid, int mode); |
224 | int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, | 224 | int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, |
225 | char *extension); | 225 | char *extension); |
@@ -230,7 +230,6 @@ int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode, | |||
230 | gid_t gid, struct p9_qid *qid); | 230 | gid_t gid, struct p9_qid *qid); |
231 | int p9_client_clunk(struct p9_fid *fid); | 231 | int p9_client_clunk(struct p9_fid *fid); |
232 | int p9_client_fsync(struct p9_fid *fid, int datasync); | 232 | int p9_client_fsync(struct p9_fid *fid, int datasync); |
233 | int p9_client_sync_fs(struct p9_fid *fid); | ||
234 | int p9_client_remove(struct p9_fid *fid); | 233 | int p9_client_remove(struct p9_fid *fid); |
235 | int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, | 234 | int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, |
236 | u64 offset, u32 count); | 235 | u64 offset, u32 count); |
diff --git a/include/trace/events/block.h b/include/trace/events/block.h index 78f18adb49c8..bf366547da25 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h | |||
@@ -401,9 +401,9 @@ TRACE_EVENT(block_plug, | |||
401 | 401 | ||
402 | DECLARE_EVENT_CLASS(block_unplug, | 402 | DECLARE_EVENT_CLASS(block_unplug, |
403 | 403 | ||
404 | TP_PROTO(struct request_queue *q), | 404 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), |
405 | 405 | ||
406 | TP_ARGS(q), | 406 | TP_ARGS(q, depth, explicit), |
407 | 407 | ||
408 | TP_STRUCT__entry( | 408 | TP_STRUCT__entry( |
409 | __field( int, nr_rq ) | 409 | __field( int, nr_rq ) |
@@ -411,7 +411,7 @@ DECLARE_EVENT_CLASS(block_unplug, | |||
411 | ), | 411 | ), |
412 | 412 | ||
413 | TP_fast_assign( | 413 | TP_fast_assign( |
414 | __entry->nr_rq = q->rq.count[READ] + q->rq.count[WRITE]; | 414 | __entry->nr_rq = depth; |
415 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | 415 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); |
416 | ), | 416 | ), |
417 | 417 | ||
@@ -419,31 +419,19 @@ DECLARE_EVENT_CLASS(block_unplug, | |||
419 | ); | 419 | ); |
420 | 420 | ||
421 | /** | 421 | /** |
422 | * block_unplug_timer - timed release of operations requests in queue to device driver | 422 | * block_unplug - release of operations requests in request queue |
423 | * @q: request queue to unplug | ||
424 | * | ||
425 | * Unplug the request queue @q because a timer expired and allow block | ||
426 | * operation requests to be sent to the device driver. | ||
427 | */ | ||
428 | DEFINE_EVENT(block_unplug, block_unplug_timer, | ||
429 | |||
430 | TP_PROTO(struct request_queue *q), | ||
431 | |||
432 | TP_ARGS(q) | ||
433 | ); | ||
434 | |||
435 | /** | ||
436 | * block_unplug_io - release of operations requests in request queue | ||
437 | * @q: request queue to unplug | 423 | * @q: request queue to unplug |
424 | * @depth: number of requests just added to the queue | ||
425 | * @explicit: whether this was an explicit unplug, or one from schedule() | ||
438 | * | 426 | * |
439 | * Unplug request queue @q because device driver is scheduled to work | 427 | * Unplug request queue @q because device driver is scheduled to work |
440 | * on elements in the request queue. | 428 | * on elements in the request queue. |
441 | */ | 429 | */ |
442 | DEFINE_EVENT(block_unplug, block_unplug_io, | 430 | DEFINE_EVENT(block_unplug, block_unplug, |
443 | 431 | ||
444 | TP_PROTO(struct request_queue *q), | 432 | TP_PROTO(struct request_queue *q, unsigned int depth, bool explicit), |
445 | 433 | ||
446 | TP_ARGS(q) | 434 | TP_ARGS(q, depth, explicit) |
447 | ); | 435 | ); |
448 | 436 | ||
449 | /** | 437 | /** |
diff --git a/init/Kconfig b/init/Kconfig index 56240e724d9a..d886b1e9278e 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -924,14 +924,6 @@ menuconfig EXPERT | |||
924 | environments which can tolerate a "non-standard" kernel. | 924 | environments which can tolerate a "non-standard" kernel. |
925 | Only use this if you really know what you are doing. | 925 | Only use this if you really know what you are doing. |
926 | 926 | ||
927 | config EMBEDDED | ||
928 | bool "Embedded system" | ||
929 | select EXPERT | ||
930 | help | ||
931 | This option should be enabled if compiling the kernel for | ||
932 | an embedded system so certain expert options are available | ||
933 | for configuration. | ||
934 | |||
935 | config UID16 | 927 | config UID16 |
936 | bool "Enable 16-bit UID system calls" if EXPERT | 928 | bool "Enable 16-bit UID system calls" if EXPERT |
937 | depends on ARM || BLACKFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && COMPAT) || UML || (X86_64 && IA32_EMULATION) | 929 | depends on ARM || BLACKFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && COMPAT) || UML || (X86_64 && IA32_EMULATION) |
@@ -1104,6 +1096,14 @@ config AIO | |||
1104 | by some high performance threaded applications. Disabling | 1096 | by some high performance threaded applications. Disabling |
1105 | this option saves about 7k. | 1097 | this option saves about 7k. |
1106 | 1098 | ||
1099 | config EMBEDDED | ||
1100 | bool "Embedded system" | ||
1101 | select EXPERT | ||
1102 | help | ||
1103 | This option should be enabled if compiling the kernel for | ||
1104 | an embedded system so certain expert options are available | ||
1105 | for configuration. | ||
1106 | |||
1107 | config HAVE_PERF_EVENTS | 1107 | config HAVE_PERF_EVENTS |
1108 | bool | 1108 | bool |
1109 | help | 1109 | help |
@@ -1226,6 +1226,7 @@ config SLAB | |||
1226 | per cpu and per node queues. | 1226 | per cpu and per node queues. |
1227 | 1227 | ||
1228 | config SLUB | 1228 | config SLUB |
1229 | depends on BROKEN || NUMA || !DISCONTIGMEM | ||
1229 | bool "SLUB (Unqueued Allocator)" | 1230 | bool "SLUB (Unqueued Allocator)" |
1230 | help | 1231 | help |
1231 | SLUB is a slab allocator that minimizes cache line usage | 1232 | SLUB is a slab allocator that minimizes cache line usage |
diff --git a/kernel/futex.c b/kernel/futex.c index dfb924ffe65b..fe28dc282eae 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -1886,7 +1886,7 @@ retry: | |||
1886 | restart->futex.val = val; | 1886 | restart->futex.val = val; |
1887 | restart->futex.time = abs_time->tv64; | 1887 | restart->futex.time = abs_time->tv64; |
1888 | restart->futex.bitset = bitset; | 1888 | restart->futex.bitset = bitset; |
1889 | restart->futex.flags = flags; | 1889 | restart->futex.flags = flags | FLAGS_HAS_TIMEOUT; |
1890 | 1890 | ||
1891 | ret = -ERESTART_RESTARTBLOCK; | 1891 | ret = -ERESTART_RESTARTBLOCK; |
1892 | 1892 | ||
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 9017478c5d4c..87fdb3f8db14 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -81,7 +81,11 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = | |||
81 | } | 81 | } |
82 | }; | 82 | }; |
83 | 83 | ||
84 | static int hrtimer_clock_to_base_table[MAX_CLOCKS]; | 84 | static int hrtimer_clock_to_base_table[MAX_CLOCKS] = { |
85 | [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME, | ||
86 | [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC, | ||
87 | [CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME, | ||
88 | }; | ||
85 | 89 | ||
86 | static inline int hrtimer_clockid_to_base(clockid_t clock_id) | 90 | static inline int hrtimer_clockid_to_base(clockid_t clock_id) |
87 | { | 91 | { |
@@ -1722,10 +1726,6 @@ static struct notifier_block __cpuinitdata hrtimers_nb = { | |||
1722 | 1726 | ||
1723 | void __init hrtimers_init(void) | 1727 | void __init hrtimers_init(void) |
1724 | { | 1728 | { |
1725 | hrtimer_clock_to_base_table[CLOCK_REALTIME] = HRTIMER_BASE_REALTIME; | ||
1726 | hrtimer_clock_to_base_table[CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC; | ||
1727 | hrtimer_clock_to_base_table[CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME; | ||
1728 | |||
1729 | hrtimer_cpu_notify(&hrtimers_nb, (unsigned long)CPU_UP_PREPARE, | 1729 | hrtimer_cpu_notify(&hrtimers_nb, (unsigned long)CPU_UP_PREPARE, |
1730 | (void *)(long)smp_processor_id()); | 1730 | (void *)(long)smp_processor_id()); |
1731 | register_cpu_notifier(&hrtimers_nb); | 1731 | register_cpu_notifier(&hrtimers_nb); |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 55936f9cb251..87b77de03dd3 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/vmalloc.h> | 33 | #include <linux/vmalloc.h> |
34 | #include <linux/swap.h> | 34 | #include <linux/swap.h> |
35 | #include <linux/kmsg_dump.h> | 35 | #include <linux/kmsg_dump.h> |
36 | #include <linux/syscore_ops.h> | ||
36 | 37 | ||
37 | #include <asm/page.h> | 38 | #include <asm/page.h> |
38 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
@@ -1532,6 +1533,11 @@ int kernel_kexec(void) | |||
1532 | local_irq_disable(); | 1533 | local_irq_disable(); |
1533 | /* Suspend system devices */ | 1534 | /* Suspend system devices */ |
1534 | error = sysdev_suspend(PMSG_FREEZE); | 1535 | error = sysdev_suspend(PMSG_FREEZE); |
1536 | if (!error) { | ||
1537 | error = syscore_suspend(); | ||
1538 | if (error) | ||
1539 | sysdev_resume(); | ||
1540 | } | ||
1535 | if (error) | 1541 | if (error) |
1536 | goto Enable_irqs; | 1542 | goto Enable_irqs; |
1537 | } else | 1543 | } else |
@@ -1546,6 +1552,7 @@ int kernel_kexec(void) | |||
1546 | 1552 | ||
1547 | #ifdef CONFIG_KEXEC_JUMP | 1553 | #ifdef CONFIG_KEXEC_JUMP |
1548 | if (kexec_image->preserve_context) { | 1554 | if (kexec_image->preserve_context) { |
1555 | syscore_resume(); | ||
1549 | sysdev_resume(); | 1556 | sysdev_resume(); |
1550 | Enable_irqs: | 1557 | Enable_irqs: |
1551 | local_irq_enable(); | 1558 | local_irq_enable(); |
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 27960f114efd..8e81a9860a0d 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -364,6 +364,7 @@ void perf_cgroup_switch(struct task_struct *task, int mode) | |||
364 | } | 364 | } |
365 | 365 | ||
366 | if (mode & PERF_CGROUP_SWIN) { | 366 | if (mode & PERF_CGROUP_SWIN) { |
367 | WARN_ON_ONCE(cpuctx->cgrp); | ||
367 | /* set cgrp before ctxsw in to | 368 | /* set cgrp before ctxsw in to |
368 | * allow event_filter_match() to not | 369 | * allow event_filter_match() to not |
369 | * have to pass task around | 370 | * have to pass task around |
@@ -2423,6 +2424,14 @@ static void perf_event_enable_on_exec(struct perf_event_context *ctx) | |||
2423 | if (!ctx || !ctx->nr_events) | 2424 | if (!ctx || !ctx->nr_events) |
2424 | goto out; | 2425 | goto out; |
2425 | 2426 | ||
2427 | /* | ||
2428 | * We must ctxsw out cgroup events to avoid conflict | ||
2429 | * when invoking perf_task_event_sched_in() later on | ||
2430 | * in this function. Otherwise we end up trying to | ||
2431 | * ctxswin cgroup events which are already scheduled | ||
2432 | * in. | ||
2433 | */ | ||
2434 | perf_cgroup_sched_out(current); | ||
2426 | task_ctx_sched_out(ctx, EVENT_ALL); | 2435 | task_ctx_sched_out(ctx, EVENT_ALL); |
2427 | 2436 | ||
2428 | raw_spin_lock(&ctx->lock); | 2437 | raw_spin_lock(&ctx->lock); |
@@ -2447,6 +2456,9 @@ static void perf_event_enable_on_exec(struct perf_event_context *ctx) | |||
2447 | 2456 | ||
2448 | raw_spin_unlock(&ctx->lock); | 2457 | raw_spin_unlock(&ctx->lock); |
2449 | 2458 | ||
2459 | /* | ||
2460 | * Also calls ctxswin for cgroup events, if any: | ||
2461 | */ | ||
2450 | perf_event_context_sched_in(ctx, ctx->task); | 2462 | perf_event_context_sched_in(ctx, ctx->task); |
2451 | out: | 2463 | out: |
2452 | local_irq_restore(flags); | 2464 | local_irq_restore(flags); |
diff --git a/kernel/pid.c b/kernel/pid.c index 02f221274265..57a8346a270e 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -217,11 +217,14 @@ static int alloc_pidmap(struct pid_namespace *pid_ns) | |||
217 | return -1; | 217 | return -1; |
218 | } | 218 | } |
219 | 219 | ||
220 | int next_pidmap(struct pid_namespace *pid_ns, int last) | 220 | int next_pidmap(struct pid_namespace *pid_ns, unsigned int last) |
221 | { | 221 | { |
222 | int offset; | 222 | int offset; |
223 | struct pidmap *map, *end; | 223 | struct pidmap *map, *end; |
224 | 224 | ||
225 | if (last >= PID_MAX_LIMIT) | ||
226 | return -1; | ||
227 | |||
225 | offset = (last + 1) & BITS_PER_PAGE_MASK; | 228 | offset = (last + 1) & BITS_PER_PAGE_MASK; |
226 | map = &pid_ns->pidmap[(last + 1)/BITS_PER_PAGE]; | 229 | map = &pid_ns->pidmap[(last + 1)/BITS_PER_PAGE]; |
227 | end = &pid_ns->pidmap[PIDMAP_ENTRIES]; | 230 | end = &pid_ns->pidmap[PIDMAP_ENTRIES]; |
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 4603f08dc47b..6de9a8fc3417 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -18,9 +18,13 @@ config SUSPEND_FREEZER | |||
18 | 18 | ||
19 | Turning OFF this setting is NOT recommended! If in doubt, say Y. | 19 | Turning OFF this setting is NOT recommended! If in doubt, say Y. |
20 | 20 | ||
21 | config HIBERNATE_CALLBACKS | ||
22 | bool | ||
23 | |||
21 | config HIBERNATION | 24 | config HIBERNATION |
22 | bool "Hibernation (aka 'suspend to disk')" | 25 | bool "Hibernation (aka 'suspend to disk')" |
23 | depends on SWAP && ARCH_HIBERNATION_POSSIBLE | 26 | depends on SWAP && ARCH_HIBERNATION_POSSIBLE |
27 | select HIBERNATE_CALLBACKS | ||
24 | select LZO_COMPRESS | 28 | select LZO_COMPRESS |
25 | select LZO_DECOMPRESS | 29 | select LZO_DECOMPRESS |
26 | ---help--- | 30 | ---help--- |
@@ -85,7 +89,7 @@ config PM_STD_PARTITION | |||
85 | 89 | ||
86 | config PM_SLEEP | 90 | config PM_SLEEP |
87 | def_bool y | 91 | def_bool y |
88 | depends on SUSPEND || HIBERNATION || XEN_SAVE_RESTORE | 92 | depends on SUSPEND || HIBERNATE_CALLBACKS |
89 | 93 | ||
90 | config PM_SLEEP_SMP | 94 | config PM_SLEEP_SMP |
91 | def_bool y | 95 | def_bool y |
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index aeabd26e3342..50aae660174d 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -273,8 +273,11 @@ static int create_image(int platform_mode) | |||
273 | local_irq_disable(); | 273 | local_irq_disable(); |
274 | 274 | ||
275 | error = sysdev_suspend(PMSG_FREEZE); | 275 | error = sysdev_suspend(PMSG_FREEZE); |
276 | if (!error) | 276 | if (!error) { |
277 | error = syscore_suspend(); | 277 | error = syscore_suspend(); |
278 | if (error) | ||
279 | sysdev_resume(); | ||
280 | } | ||
278 | if (error) { | 281 | if (error) { |
279 | printk(KERN_ERR "PM: Some system devices failed to power down, " | 282 | printk(KERN_ERR "PM: Some system devices failed to power down, " |
280 | "aborting hibernation\n"); | 283 | "aborting hibernation\n"); |
@@ -407,8 +410,11 @@ static int resume_target_kernel(bool platform_mode) | |||
407 | local_irq_disable(); | 410 | local_irq_disable(); |
408 | 411 | ||
409 | error = sysdev_suspend(PMSG_QUIESCE); | 412 | error = sysdev_suspend(PMSG_QUIESCE); |
410 | if (!error) | 413 | if (!error) { |
411 | error = syscore_suspend(); | 414 | error = syscore_suspend(); |
415 | if (error) | ||
416 | sysdev_resume(); | ||
417 | } | ||
412 | if (error) | 418 | if (error) |
413 | goto Enable_irqs; | 419 | goto Enable_irqs; |
414 | 420 | ||
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 2814c32aed51..8935369d503a 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -164,8 +164,11 @@ static int suspend_enter(suspend_state_t state) | |||
164 | BUG_ON(!irqs_disabled()); | 164 | BUG_ON(!irqs_disabled()); |
165 | 165 | ||
166 | error = sysdev_suspend(PMSG_SUSPEND); | 166 | error = sysdev_suspend(PMSG_SUSPEND); |
167 | if (!error) | 167 | if (!error) { |
168 | error = syscore_suspend(); | 168 | error = syscore_suspend(); |
169 | if (error) | ||
170 | sysdev_resume(); | ||
171 | } | ||
169 | if (!error) { | 172 | if (!error) { |
170 | if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) { | 173 | if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) { |
171 | error = suspend_ops->enter(state); | 174 | error = suspend_ops->enter(state); |
diff --git a/kernel/sched.c b/kernel/sched.c index 48013633d792..312f8b95c2d4 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -4111,20 +4111,20 @@ need_resched: | |||
4111 | try_to_wake_up_local(to_wakeup); | 4111 | try_to_wake_up_local(to_wakeup); |
4112 | } | 4112 | } |
4113 | deactivate_task(rq, prev, DEQUEUE_SLEEP); | 4113 | deactivate_task(rq, prev, DEQUEUE_SLEEP); |
4114 | |||
4115 | /* | ||
4116 | * If we are going to sleep and we have plugged IO queued, make | ||
4117 | * sure to submit it to avoid deadlocks. | ||
4118 | */ | ||
4119 | if (blk_needs_flush_plug(prev)) { | ||
4120 | raw_spin_unlock(&rq->lock); | ||
4121 | blk_schedule_flush_plug(prev); | ||
4122 | raw_spin_lock(&rq->lock); | ||
4123 | } | ||
4114 | } | 4124 | } |
4115 | switch_count = &prev->nvcsw; | 4125 | switch_count = &prev->nvcsw; |
4116 | } | 4126 | } |
4117 | 4127 | ||
4118 | /* | ||
4119 | * If we are going to sleep and we have plugged IO queued, make | ||
4120 | * sure to submit it to avoid deadlocks. | ||
4121 | */ | ||
4122 | if (prev->state != TASK_RUNNING && blk_needs_flush_plug(prev)) { | ||
4123 | raw_spin_unlock(&rq->lock); | ||
4124 | blk_flush_plug(prev); | ||
4125 | raw_spin_lock(&rq->lock); | ||
4126 | } | ||
4127 | |||
4128 | pre_schedule(rq, prev); | 4128 | pre_schedule(rq, prev); |
4129 | 4129 | ||
4130 | if (unlikely(!rq->nr_running)) | 4130 | if (unlikely(!rq->nr_running)) |
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 7f00772e57c9..6fa833ab2cb8 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -2104,21 +2104,20 @@ balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest, | |||
2104 | enum cpu_idle_type idle, int *all_pinned, | 2104 | enum cpu_idle_type idle, int *all_pinned, |
2105 | int *this_best_prio, struct cfs_rq *busiest_cfs_rq) | 2105 | int *this_best_prio, struct cfs_rq *busiest_cfs_rq) |
2106 | { | 2106 | { |
2107 | int loops = 0, pulled = 0, pinned = 0; | 2107 | int loops = 0, pulled = 0; |
2108 | long rem_load_move = max_load_move; | 2108 | long rem_load_move = max_load_move; |
2109 | struct task_struct *p, *n; | 2109 | struct task_struct *p, *n; |
2110 | 2110 | ||
2111 | if (max_load_move == 0) | 2111 | if (max_load_move == 0) |
2112 | goto out; | 2112 | goto out; |
2113 | 2113 | ||
2114 | pinned = 1; | ||
2115 | |||
2116 | list_for_each_entry_safe(p, n, &busiest_cfs_rq->tasks, se.group_node) { | 2114 | list_for_each_entry_safe(p, n, &busiest_cfs_rq->tasks, se.group_node) { |
2117 | if (loops++ > sysctl_sched_nr_migrate) | 2115 | if (loops++ > sysctl_sched_nr_migrate) |
2118 | break; | 2116 | break; |
2119 | 2117 | ||
2120 | if ((p->se.load.weight >> 1) > rem_load_move || | 2118 | if ((p->se.load.weight >> 1) > rem_load_move || |
2121 | !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) | 2119 | !can_migrate_task(p, busiest, this_cpu, sd, idle, |
2120 | all_pinned)) | ||
2122 | continue; | 2121 | continue; |
2123 | 2122 | ||
2124 | pull_task(busiest, p, this_rq, this_cpu); | 2123 | pull_task(busiest, p, this_rq, this_cpu); |
@@ -2153,9 +2152,6 @@ out: | |||
2153 | */ | 2152 | */ |
2154 | schedstat_add(sd, lb_gained[idle], pulled); | 2153 | schedstat_add(sd, lb_gained[idle], pulled); |
2155 | 2154 | ||
2156 | if (all_pinned) | ||
2157 | *all_pinned = pinned; | ||
2158 | |||
2159 | return max_load_move - rem_load_move; | 2155 | return max_load_move - rem_load_move; |
2160 | } | 2156 | } |
2161 | 2157 | ||
@@ -3127,6 +3123,8 @@ find_busiest_group(struct sched_domain *sd, int this_cpu, | |||
3127 | if (!sds.busiest || sds.busiest_nr_running == 0) | 3123 | if (!sds.busiest || sds.busiest_nr_running == 0) |
3128 | goto out_balanced; | 3124 | goto out_balanced; |
3129 | 3125 | ||
3126 | sds.avg_load = (SCHED_LOAD_SCALE * sds.total_load) / sds.total_pwr; | ||
3127 | |||
3130 | /* | 3128 | /* |
3131 | * If the busiest group is imbalanced the below checks don't | 3129 | * If the busiest group is imbalanced the below checks don't |
3132 | * work because they assumes all things are equal, which typically | 3130 | * work because they assumes all things are equal, which typically |
@@ -3151,7 +3149,6 @@ find_busiest_group(struct sched_domain *sd, int this_cpu, | |||
3151 | * Don't pull any tasks if this group is already above the domain | 3149 | * Don't pull any tasks if this group is already above the domain |
3152 | * average load. | 3150 | * average load. |
3153 | */ | 3151 | */ |
3154 | sds.avg_load = (SCHED_LOAD_SCALE * sds.total_load) / sds.total_pwr; | ||
3155 | if (sds.this_load >= sds.avg_load) | 3152 | if (sds.this_load >= sds.avg_load) |
3156 | goto out_balanced; | 3153 | goto out_balanced; |
3157 | 3154 | ||
@@ -3340,6 +3337,7 @@ redo: | |||
3340 | * still unbalanced. ld_moved simply stays zero, so it is | 3337 | * still unbalanced. ld_moved simply stays zero, so it is |
3341 | * correctly treated as an imbalance. | 3338 | * correctly treated as an imbalance. |
3342 | */ | 3339 | */ |
3340 | all_pinned = 1; | ||
3343 | local_irq_save(flags); | 3341 | local_irq_save(flags); |
3344 | double_rq_lock(this_rq, busiest); | 3342 | double_rq_lock(this_rq, busiest); |
3345 | ld_moved = move_tasks(this_rq, this_cpu, busiest, | 3343 | ld_moved = move_tasks(this_rq, this_cpu, busiest, |
diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c index 25028dd4fa18..c340ca658f37 100644 --- a/kernel/time/posix-clock.c +++ b/kernel/time/posix-clock.c | |||
@@ -19,7 +19,6 @@ | |||
19 | */ | 19 | */ |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/file.h> | 21 | #include <linux/file.h> |
22 | #include <linux/mutex.h> | ||
23 | #include <linux/posix-clock.h> | 22 | #include <linux/posix-clock.h> |
24 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
25 | #include <linux/syscalls.h> | 24 | #include <linux/syscalls.h> |
@@ -34,19 +33,19 @@ static struct posix_clock *get_posix_clock(struct file *fp) | |||
34 | { | 33 | { |
35 | struct posix_clock *clk = fp->private_data; | 34 | struct posix_clock *clk = fp->private_data; |
36 | 35 | ||
37 | mutex_lock(&clk->mutex); | 36 | down_read(&clk->rwsem); |
38 | 37 | ||
39 | if (!clk->zombie) | 38 | if (!clk->zombie) |
40 | return clk; | 39 | return clk; |
41 | 40 | ||
42 | mutex_unlock(&clk->mutex); | 41 | up_read(&clk->rwsem); |
43 | 42 | ||
44 | return NULL; | 43 | return NULL; |
45 | } | 44 | } |
46 | 45 | ||
47 | static void put_posix_clock(struct posix_clock *clk) | 46 | static void put_posix_clock(struct posix_clock *clk) |
48 | { | 47 | { |
49 | mutex_unlock(&clk->mutex); | 48 | up_read(&clk->rwsem); |
50 | } | 49 | } |
51 | 50 | ||
52 | static ssize_t posix_clock_read(struct file *fp, char __user *buf, | 51 | static ssize_t posix_clock_read(struct file *fp, char __user *buf, |
@@ -156,7 +155,7 @@ static int posix_clock_open(struct inode *inode, struct file *fp) | |||
156 | struct posix_clock *clk = | 155 | struct posix_clock *clk = |
157 | container_of(inode->i_cdev, struct posix_clock, cdev); | 156 | container_of(inode->i_cdev, struct posix_clock, cdev); |
158 | 157 | ||
159 | mutex_lock(&clk->mutex); | 158 | down_read(&clk->rwsem); |
160 | 159 | ||
161 | if (clk->zombie) { | 160 | if (clk->zombie) { |
162 | err = -ENODEV; | 161 | err = -ENODEV; |
@@ -172,7 +171,7 @@ static int posix_clock_open(struct inode *inode, struct file *fp) | |||
172 | fp->private_data = clk; | 171 | fp->private_data = clk; |
173 | } | 172 | } |
174 | out: | 173 | out: |
175 | mutex_unlock(&clk->mutex); | 174 | up_read(&clk->rwsem); |
176 | return err; | 175 | return err; |
177 | } | 176 | } |
178 | 177 | ||
@@ -211,25 +210,20 @@ int posix_clock_register(struct posix_clock *clk, dev_t devid) | |||
211 | int err; | 210 | int err; |
212 | 211 | ||
213 | kref_init(&clk->kref); | 212 | kref_init(&clk->kref); |
214 | mutex_init(&clk->mutex); | 213 | init_rwsem(&clk->rwsem); |
215 | 214 | ||
216 | cdev_init(&clk->cdev, &posix_clock_file_operations); | 215 | cdev_init(&clk->cdev, &posix_clock_file_operations); |
217 | clk->cdev.owner = clk->ops.owner; | 216 | clk->cdev.owner = clk->ops.owner; |
218 | err = cdev_add(&clk->cdev, devid, 1); | 217 | err = cdev_add(&clk->cdev, devid, 1); |
219 | if (err) | ||
220 | goto no_cdev; | ||
221 | 218 | ||
222 | return err; | 219 | return err; |
223 | no_cdev: | ||
224 | mutex_destroy(&clk->mutex); | ||
225 | return err; | ||
226 | } | 220 | } |
227 | EXPORT_SYMBOL_GPL(posix_clock_register); | 221 | EXPORT_SYMBOL_GPL(posix_clock_register); |
228 | 222 | ||
229 | static void delete_clock(struct kref *kref) | 223 | static void delete_clock(struct kref *kref) |
230 | { | 224 | { |
231 | struct posix_clock *clk = container_of(kref, struct posix_clock, kref); | 225 | struct posix_clock *clk = container_of(kref, struct posix_clock, kref); |
232 | mutex_destroy(&clk->mutex); | 226 | |
233 | if (clk->release) | 227 | if (clk->release) |
234 | clk->release(clk); | 228 | clk->release(clk); |
235 | } | 229 | } |
@@ -238,9 +232,9 @@ void posix_clock_unregister(struct posix_clock *clk) | |||
238 | { | 232 | { |
239 | cdev_del(&clk->cdev); | 233 | cdev_del(&clk->cdev); |
240 | 234 | ||
241 | mutex_lock(&clk->mutex); | 235 | down_write(&clk->rwsem); |
242 | clk->zombie = true; | 236 | clk->zombie = true; |
243 | mutex_unlock(&clk->mutex); | 237 | up_write(&clk->rwsem); |
244 | 238 | ||
245 | kref_put(&clk->kref, delete_clock); | 239 | kref_put(&clk->kref, delete_clock); |
246 | } | 240 | } |
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 61d7d59f4a1a..2ad39e556cb4 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
@@ -141,7 +141,7 @@ if FTRACE | |||
141 | config FUNCTION_TRACER | 141 | config FUNCTION_TRACER |
142 | bool "Kernel Function Tracer" | 142 | bool "Kernel Function Tracer" |
143 | depends on HAVE_FUNCTION_TRACER | 143 | depends on HAVE_FUNCTION_TRACER |
144 | select FRAME_POINTER if !ARM_UNWIND && !S390 | 144 | select FRAME_POINTER if !ARM_UNWIND && !S390 && !MICROBLAZE |
145 | select KALLSYMS | 145 | select KALLSYMS |
146 | select GENERIC_TRACER | 146 | select GENERIC_TRACER |
147 | select CONTEXT_SWITCH_TRACER | 147 | select CONTEXT_SWITCH_TRACER |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 7aa40f8e182d..6957aa298dfa 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -850,29 +850,21 @@ static void blk_add_trace_plug(void *ignore, struct request_queue *q) | |||
850 | __blk_add_trace(bt, 0, 0, 0, BLK_TA_PLUG, 0, 0, NULL); | 850 | __blk_add_trace(bt, 0, 0, 0, BLK_TA_PLUG, 0, 0, NULL); |
851 | } | 851 | } |
852 | 852 | ||
853 | static void blk_add_trace_unplug_io(void *ignore, struct request_queue *q) | 853 | static void blk_add_trace_unplug(void *ignore, struct request_queue *q, |
854 | unsigned int depth, bool explicit) | ||
854 | { | 855 | { |
855 | struct blk_trace *bt = q->blk_trace; | 856 | struct blk_trace *bt = q->blk_trace; |
856 | 857 | ||
857 | if (bt) { | 858 | if (bt) { |
858 | unsigned int pdu = q->rq.count[READ] + q->rq.count[WRITE]; | 859 | __be64 rpdu = cpu_to_be64(depth); |
859 | __be64 rpdu = cpu_to_be64(pdu); | 860 | u32 what; |
860 | 861 | ||
861 | __blk_add_trace(bt, 0, 0, 0, BLK_TA_UNPLUG_IO, 0, | 862 | if (explicit) |
862 | sizeof(rpdu), &rpdu); | 863 | what = BLK_TA_UNPLUG_IO; |
863 | } | 864 | else |
864 | } | 865 | what = BLK_TA_UNPLUG_TIMER; |
865 | |||
866 | static void blk_add_trace_unplug_timer(void *ignore, struct request_queue *q) | ||
867 | { | ||
868 | struct blk_trace *bt = q->blk_trace; | ||
869 | |||
870 | if (bt) { | ||
871 | unsigned int pdu = q->rq.count[READ] + q->rq.count[WRITE]; | ||
872 | __be64 rpdu = cpu_to_be64(pdu); | ||
873 | 866 | ||
874 | __blk_add_trace(bt, 0, 0, 0, BLK_TA_UNPLUG_TIMER, 0, | 867 | __blk_add_trace(bt, 0, 0, 0, what, 0, sizeof(rpdu), &rpdu); |
875 | sizeof(rpdu), &rpdu); | ||
876 | } | 868 | } |
877 | } | 869 | } |
878 | 870 | ||
@@ -1015,9 +1007,7 @@ static void blk_register_tracepoints(void) | |||
1015 | WARN_ON(ret); | 1007 | WARN_ON(ret); |
1016 | ret = register_trace_block_plug(blk_add_trace_plug, NULL); | 1008 | ret = register_trace_block_plug(blk_add_trace_plug, NULL); |
1017 | WARN_ON(ret); | 1009 | WARN_ON(ret); |
1018 | ret = register_trace_block_unplug_timer(blk_add_trace_unplug_timer, NULL); | 1010 | ret = register_trace_block_unplug(blk_add_trace_unplug, NULL); |
1019 | WARN_ON(ret); | ||
1020 | ret = register_trace_block_unplug_io(blk_add_trace_unplug_io, NULL); | ||
1021 | WARN_ON(ret); | 1011 | WARN_ON(ret); |
1022 | ret = register_trace_block_split(blk_add_trace_split, NULL); | 1012 | ret = register_trace_block_split(blk_add_trace_split, NULL); |
1023 | WARN_ON(ret); | 1013 | WARN_ON(ret); |
@@ -1032,8 +1022,7 @@ static void blk_unregister_tracepoints(void) | |||
1032 | unregister_trace_block_rq_remap(blk_add_trace_rq_remap, NULL); | 1022 | unregister_trace_block_rq_remap(blk_add_trace_rq_remap, NULL); |
1033 | unregister_trace_block_bio_remap(blk_add_trace_bio_remap, NULL); | 1023 | unregister_trace_block_bio_remap(blk_add_trace_bio_remap, NULL); |
1034 | unregister_trace_block_split(blk_add_trace_split, NULL); | 1024 | unregister_trace_block_split(blk_add_trace_split, NULL); |
1035 | unregister_trace_block_unplug_io(blk_add_trace_unplug_io, NULL); | 1025 | unregister_trace_block_unplug(blk_add_trace_unplug, NULL); |
1036 | unregister_trace_block_unplug_timer(blk_add_trace_unplug_timer, NULL); | ||
1037 | unregister_trace_block_plug(blk_add_trace_plug, NULL); | 1026 | unregister_trace_block_plug(blk_add_trace_plug, NULL); |
1038 | unregister_trace_block_sleeprq(blk_add_trace_sleeprq, NULL); | 1027 | unregister_trace_block_sleeprq(blk_add_trace_sleeprq, NULL); |
1039 | unregister_trace_block_getrq(blk_add_trace_getrq, NULL); | 1028 | unregister_trace_block_getrq(blk_add_trace_getrq, NULL); |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 140dce750450..14733d4d156b 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -430,9 +430,12 @@ static int watchdog_enable(int cpu) | |||
430 | p = kthread_create(watchdog, (void *)(unsigned long)cpu, "watchdog/%d", cpu); | 430 | p = kthread_create(watchdog, (void *)(unsigned long)cpu, "watchdog/%d", cpu); |
431 | if (IS_ERR(p)) { | 431 | if (IS_ERR(p)) { |
432 | printk(KERN_ERR "softlockup watchdog for %i failed\n", cpu); | 432 | printk(KERN_ERR "softlockup watchdog for %i failed\n", cpu); |
433 | if (!err) | 433 | if (!err) { |
434 | /* if hardlockup hasn't already set this */ | 434 | /* if hardlockup hasn't already set this */ |
435 | err = PTR_ERR(p); | 435 | err = PTR_ERR(p); |
436 | /* and disable the perf event */ | ||
437 | watchdog_nmi_disable(cpu); | ||
438 | } | ||
436 | goto out; | 439 | goto out; |
437 | } | 440 | } |
438 | kthread_bind(p, cpu); | 441 | kthread_bind(p, cpu); |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 8859a41806dd..e3378e8d3a5c 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -1291,8 +1291,14 @@ __acquires(&gcwq->lock) | |||
1291 | return true; | 1291 | return true; |
1292 | spin_unlock_irq(&gcwq->lock); | 1292 | spin_unlock_irq(&gcwq->lock); |
1293 | 1293 | ||
1294 | /* CPU has come up in between, retry migration */ | 1294 | /* |
1295 | * We've raced with CPU hot[un]plug. Give it a breather | ||
1296 | * and retry migration. cond_resched() is required here; | ||
1297 | * otherwise, we might deadlock against cpu_stop trying to | ||
1298 | * bring down the CPU on non-preemptive kernel. | ||
1299 | */ | ||
1295 | cpu_relax(); | 1300 | cpu_relax(); |
1301 | cond_resched(); | ||
1296 | } | 1302 | } |
1297 | } | 1303 | } |
1298 | 1304 | ||
diff --git a/lib/kstrtox.c b/lib/kstrtox.c index 05672e819f8c..a235f3cc471c 100644 --- a/lib/kstrtox.c +++ b/lib/kstrtox.c | |||
@@ -49,12 +49,9 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res) | |||
49 | val = *s - '0'; | 49 | val = *s - '0'; |
50 | else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f') | 50 | else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f') |
51 | val = _tolower(*s) - 'a' + 10; | 51 | val = _tolower(*s) - 'a' + 10; |
52 | else if (*s == '\n') { | 52 | else if (*s == '\n' && *(s + 1) == '\0') |
53 | if (*(s + 1) == '\0') | 53 | break; |
54 | break; | 54 | else |
55 | else | ||
56 | return -EINVAL; | ||
57 | } else | ||
58 | return -EINVAL; | 55 | return -EINVAL; |
59 | 56 | ||
60 | if (val >= base) | 57 | if (val >= base) |
diff --git a/lib/test-kstrtox.c b/lib/test-kstrtox.c index 325c2f9ecebd..d55769d63cb8 100644 --- a/lib/test-kstrtox.c +++ b/lib/test-kstrtox.c | |||
@@ -315,12 +315,12 @@ static void __init test_kstrtou64_ok(void) | |||
315 | {"65537", 10, 65537}, | 315 | {"65537", 10, 65537}, |
316 | {"2147483646", 10, 2147483646}, | 316 | {"2147483646", 10, 2147483646}, |
317 | {"2147483647", 10, 2147483647}, | 317 | {"2147483647", 10, 2147483647}, |
318 | {"2147483648", 10, 2147483648}, | 318 | {"2147483648", 10, 2147483648ULL}, |
319 | {"2147483649", 10, 2147483649}, | 319 | {"2147483649", 10, 2147483649ULL}, |
320 | {"4294967294", 10, 4294967294}, | 320 | {"4294967294", 10, 4294967294ULL}, |
321 | {"4294967295", 10, 4294967295}, | 321 | {"4294967295", 10, 4294967295ULL}, |
322 | {"4294967296", 10, 4294967296}, | 322 | {"4294967296", 10, 4294967296ULL}, |
323 | {"4294967297", 10, 4294967297}, | 323 | {"4294967297", 10, 4294967297ULL}, |
324 | {"9223372036854775806", 10, 9223372036854775806ULL}, | 324 | {"9223372036854775806", 10, 9223372036854775806ULL}, |
325 | {"9223372036854775807", 10, 9223372036854775807ULL}, | 325 | {"9223372036854775807", 10, 9223372036854775807ULL}, |
326 | {"9223372036854775808", 10, 9223372036854775808ULL}, | 326 | {"9223372036854775808", 10, 9223372036854775808ULL}, |
@@ -369,12 +369,12 @@ static void __init test_kstrtos64_ok(void) | |||
369 | {"65537", 10, 65537}, | 369 | {"65537", 10, 65537}, |
370 | {"2147483646", 10, 2147483646}, | 370 | {"2147483646", 10, 2147483646}, |
371 | {"2147483647", 10, 2147483647}, | 371 | {"2147483647", 10, 2147483647}, |
372 | {"2147483648", 10, 2147483648}, | 372 | {"2147483648", 10, 2147483648LL}, |
373 | {"2147483649", 10, 2147483649}, | 373 | {"2147483649", 10, 2147483649LL}, |
374 | {"4294967294", 10, 4294967294}, | 374 | {"4294967294", 10, 4294967294LL}, |
375 | {"4294967295", 10, 4294967295}, | 375 | {"4294967295", 10, 4294967295LL}, |
376 | {"4294967296", 10, 4294967296}, | 376 | {"4294967296", 10, 4294967296LL}, |
377 | {"4294967297", 10, 4294967297}, | 377 | {"4294967297", 10, 4294967297LL}, |
378 | {"9223372036854775806", 10, 9223372036854775806LL}, | 378 | {"9223372036854775806", 10, 9223372036854775806LL}, |
379 | {"9223372036854775807", 10, 9223372036854775807LL}, | 379 | {"9223372036854775807", 10, 9223372036854775807LL}, |
380 | }; | 380 | }; |
@@ -418,10 +418,10 @@ static void __init test_kstrtou32_ok(void) | |||
418 | {"65537", 10, 65537}, | 418 | {"65537", 10, 65537}, |
419 | {"2147483646", 10, 2147483646}, | 419 | {"2147483646", 10, 2147483646}, |
420 | {"2147483647", 10, 2147483647}, | 420 | {"2147483647", 10, 2147483647}, |
421 | {"2147483648", 10, 2147483648}, | 421 | {"2147483648", 10, 2147483648U}, |
422 | {"2147483649", 10, 2147483649}, | 422 | {"2147483649", 10, 2147483649U}, |
423 | {"4294967294", 10, 4294967294}, | 423 | {"4294967294", 10, 4294967294U}, |
424 | {"4294967295", 10, 4294967295}, | 424 | {"4294967295", 10, 4294967295U}, |
425 | }; | 425 | }; |
426 | TEST_OK(kstrtou32, u32, "%u", test_u32_ok); | 426 | TEST_OK(kstrtou32, u32, "%u", test_u32_ok); |
427 | } | 427 | } |
diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c index ea5fa4fe9d67..a6cdc969ea42 100644 --- a/lib/xz/xz_dec_lzma2.c +++ b/lib/xz/xz_dec_lzma2.c | |||
@@ -969,6 +969,9 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s, | |||
969 | */ | 969 | */ |
970 | tmp = b->in[b->in_pos++]; | 970 | tmp = b->in[b->in_pos++]; |
971 | 971 | ||
972 | if (tmp == 0x00) | ||
973 | return XZ_STREAM_END; | ||
974 | |||
972 | if (tmp >= 0xE0 || tmp == 0x01) { | 975 | if (tmp >= 0xE0 || tmp == 0x01) { |
973 | s->lzma2.need_props = true; | 976 | s->lzma2.need_props = true; |
974 | s->lzma2.need_dict_reset = false; | 977 | s->lzma2.need_dict_reset = false; |
@@ -1001,9 +1004,6 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s, | |||
1001 | lzma_reset(s); | 1004 | lzma_reset(s); |
1002 | } | 1005 | } |
1003 | } else { | 1006 | } else { |
1004 | if (tmp == 0x00) | ||
1005 | return XZ_STREAM_END; | ||
1006 | |||
1007 | if (tmp > 0x02) | 1007 | if (tmp > 0x02) |
1008 | return XZ_DATA_ERROR; | 1008 | return XZ_DATA_ERROR; |
1009 | 1009 | ||
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 0a619e0e2e0b..83326ad66d9b 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -244,24 +244,28 @@ static ssize_t single_flag_show(struct kobject *kobj, | |||
244 | struct kobj_attribute *attr, char *buf, | 244 | struct kobj_attribute *attr, char *buf, |
245 | enum transparent_hugepage_flag flag) | 245 | enum transparent_hugepage_flag flag) |
246 | { | 246 | { |
247 | if (test_bit(flag, &transparent_hugepage_flags)) | 247 | return sprintf(buf, "%d\n", |
248 | return sprintf(buf, "[yes] no\n"); | 248 | !!test_bit(flag, &transparent_hugepage_flags)); |
249 | else | ||
250 | return sprintf(buf, "yes [no]\n"); | ||
251 | } | 249 | } |
250 | |||
252 | static ssize_t single_flag_store(struct kobject *kobj, | 251 | static ssize_t single_flag_store(struct kobject *kobj, |
253 | struct kobj_attribute *attr, | 252 | struct kobj_attribute *attr, |
254 | const char *buf, size_t count, | 253 | const char *buf, size_t count, |
255 | enum transparent_hugepage_flag flag) | 254 | enum transparent_hugepage_flag flag) |
256 | { | 255 | { |
257 | if (!memcmp("yes", buf, | 256 | unsigned long value; |
258 | min(sizeof("yes")-1, count))) { | 257 | int ret; |
258 | |||
259 | ret = kstrtoul(buf, 10, &value); | ||
260 | if (ret < 0) | ||
261 | return ret; | ||
262 | if (value > 1) | ||
263 | return -EINVAL; | ||
264 | |||
265 | if (value) | ||
259 | set_bit(flag, &transparent_hugepage_flags); | 266 | set_bit(flag, &transparent_hugepage_flags); |
260 | } else if (!memcmp("no", buf, | 267 | else |
261 | min(sizeof("no")-1, count))) { | ||
262 | clear_bit(flag, &transparent_hugepage_flags); | 268 | clear_bit(flag, &transparent_hugepage_flags); |
263 | } else | ||
264 | return -EINVAL; | ||
265 | 269 | ||
266 | return count; | 270 | return count; |
267 | } | 271 | } |
@@ -680,8 +684,11 @@ int do_huge_pmd_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
680 | return VM_FAULT_OOM; | 684 | return VM_FAULT_OOM; |
681 | page = alloc_hugepage_vma(transparent_hugepage_defrag(vma), | 685 | page = alloc_hugepage_vma(transparent_hugepage_defrag(vma), |
682 | vma, haddr, numa_node_id(), 0); | 686 | vma, haddr, numa_node_id(), 0); |
683 | if (unlikely(!page)) | 687 | if (unlikely(!page)) { |
688 | count_vm_event(THP_FAULT_FALLBACK); | ||
684 | goto out; | 689 | goto out; |
690 | } | ||
691 | count_vm_event(THP_FAULT_ALLOC); | ||
685 | if (unlikely(mem_cgroup_newpage_charge(page, mm, GFP_KERNEL))) { | 692 | if (unlikely(mem_cgroup_newpage_charge(page, mm, GFP_KERNEL))) { |
686 | put_page(page); | 693 | put_page(page); |
687 | goto out; | 694 | goto out; |
@@ -909,11 +916,13 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
909 | new_page = NULL; | 916 | new_page = NULL; |
910 | 917 | ||
911 | if (unlikely(!new_page)) { | 918 | if (unlikely(!new_page)) { |
919 | count_vm_event(THP_FAULT_FALLBACK); | ||
912 | ret = do_huge_pmd_wp_page_fallback(mm, vma, address, | 920 | ret = do_huge_pmd_wp_page_fallback(mm, vma, address, |
913 | pmd, orig_pmd, page, haddr); | 921 | pmd, orig_pmd, page, haddr); |
914 | put_page(page); | 922 | put_page(page); |
915 | goto out; | 923 | goto out; |
916 | } | 924 | } |
925 | count_vm_event(THP_FAULT_ALLOC); | ||
917 | 926 | ||
918 | if (unlikely(mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL))) { | 927 | if (unlikely(mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL))) { |
919 | put_page(new_page); | 928 | put_page(new_page); |
@@ -1390,6 +1399,7 @@ int split_huge_page(struct page *page) | |||
1390 | 1399 | ||
1391 | BUG_ON(!PageSwapBacked(page)); | 1400 | BUG_ON(!PageSwapBacked(page)); |
1392 | __split_huge_page(page, anon_vma); | 1401 | __split_huge_page(page, anon_vma); |
1402 | count_vm_event(THP_SPLIT); | ||
1393 | 1403 | ||
1394 | BUG_ON(PageCompound(page)); | 1404 | BUG_ON(PageCompound(page)); |
1395 | out_unlock: | 1405 | out_unlock: |
@@ -1398,6 +1408,9 @@ out: | |||
1398 | return ret; | 1408 | return ret; |
1399 | } | 1409 | } |
1400 | 1410 | ||
1411 | #define VM_NO_THP (VM_SPECIAL|VM_INSERTPAGE|VM_MIXEDMAP|VM_SAO| \ | ||
1412 | VM_HUGETLB|VM_SHARED|VM_MAYSHARE) | ||
1413 | |||
1401 | int hugepage_madvise(struct vm_area_struct *vma, | 1414 | int hugepage_madvise(struct vm_area_struct *vma, |
1402 | unsigned long *vm_flags, int advice) | 1415 | unsigned long *vm_flags, int advice) |
1403 | { | 1416 | { |
@@ -1406,11 +1419,7 @@ int hugepage_madvise(struct vm_area_struct *vma, | |||
1406 | /* | 1419 | /* |
1407 | * Be somewhat over-protective like KSM for now! | 1420 | * Be somewhat over-protective like KSM for now! |
1408 | */ | 1421 | */ |
1409 | if (*vm_flags & (VM_HUGEPAGE | | 1422 | if (*vm_flags & (VM_HUGEPAGE | VM_NO_THP)) |
1410 | VM_SHARED | VM_MAYSHARE | | ||
1411 | VM_PFNMAP | VM_IO | VM_DONTEXPAND | | ||
1412 | VM_RESERVED | VM_HUGETLB | VM_INSERTPAGE | | ||
1413 | VM_MIXEDMAP | VM_SAO)) | ||
1414 | return -EINVAL; | 1423 | return -EINVAL; |
1415 | *vm_flags &= ~VM_NOHUGEPAGE; | 1424 | *vm_flags &= ~VM_NOHUGEPAGE; |
1416 | *vm_flags |= VM_HUGEPAGE; | 1425 | *vm_flags |= VM_HUGEPAGE; |
@@ -1426,11 +1435,7 @@ int hugepage_madvise(struct vm_area_struct *vma, | |||
1426 | /* | 1435 | /* |
1427 | * Be somewhat over-protective like KSM for now! | 1436 | * Be somewhat over-protective like KSM for now! |
1428 | */ | 1437 | */ |
1429 | if (*vm_flags & (VM_NOHUGEPAGE | | 1438 | if (*vm_flags & (VM_NOHUGEPAGE | VM_NO_THP)) |
1430 | VM_SHARED | VM_MAYSHARE | | ||
1431 | VM_PFNMAP | VM_IO | VM_DONTEXPAND | | ||
1432 | VM_RESERVED | VM_HUGETLB | VM_INSERTPAGE | | ||
1433 | VM_MIXEDMAP | VM_SAO)) | ||
1434 | return -EINVAL; | 1439 | return -EINVAL; |
1435 | *vm_flags &= ~VM_HUGEPAGE; | 1440 | *vm_flags &= ~VM_HUGEPAGE; |
1436 | *vm_flags |= VM_NOHUGEPAGE; | 1441 | *vm_flags |= VM_NOHUGEPAGE; |
@@ -1564,10 +1569,14 @@ int khugepaged_enter_vma_merge(struct vm_area_struct *vma) | |||
1564 | * page fault if needed. | 1569 | * page fault if needed. |
1565 | */ | 1570 | */ |
1566 | return 0; | 1571 | return 0; |
1567 | if (vma->vm_file || vma->vm_ops) | 1572 | if (vma->vm_ops) |
1568 | /* khugepaged not yet working on file or special mappings */ | 1573 | /* khugepaged not yet working on file or special mappings */ |
1569 | return 0; | 1574 | return 0; |
1570 | VM_BUG_ON(is_linear_pfn_mapping(vma) || is_pfn_mapping(vma)); | 1575 | /* |
1576 | * If is_pfn_mapping() is true is_learn_pfn_mapping() must be | ||
1577 | * true too, verify it here. | ||
1578 | */ | ||
1579 | VM_BUG_ON(is_linear_pfn_mapping(vma) || vma->vm_flags & VM_NO_THP); | ||
1571 | hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; | 1580 | hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; |
1572 | hend = vma->vm_end & HPAGE_PMD_MASK; | 1581 | hend = vma->vm_end & HPAGE_PMD_MASK; |
1573 | if (hstart < hend) | 1582 | if (hstart < hend) |
@@ -1784,9 +1793,11 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
1784 | node, __GFP_OTHER_NODE); | 1793 | node, __GFP_OTHER_NODE); |
1785 | if (unlikely(!new_page)) { | 1794 | if (unlikely(!new_page)) { |
1786 | up_read(&mm->mmap_sem); | 1795 | up_read(&mm->mmap_sem); |
1796 | count_vm_event(THP_COLLAPSE_ALLOC_FAILED); | ||
1787 | *hpage = ERR_PTR(-ENOMEM); | 1797 | *hpage = ERR_PTR(-ENOMEM); |
1788 | return; | 1798 | return; |
1789 | } | 1799 | } |
1800 | count_vm_event(THP_COLLAPSE_ALLOC); | ||
1790 | if (unlikely(mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL))) { | 1801 | if (unlikely(mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL))) { |
1791 | up_read(&mm->mmap_sem); | 1802 | up_read(&mm->mmap_sem); |
1792 | put_page(new_page); | 1803 | put_page(new_page); |
@@ -1816,12 +1827,15 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
1816 | (vma->vm_flags & VM_NOHUGEPAGE)) | 1827 | (vma->vm_flags & VM_NOHUGEPAGE)) |
1817 | goto out; | 1828 | goto out; |
1818 | 1829 | ||
1819 | /* VM_PFNMAP vmas may have vm_ops null but vm_file set */ | 1830 | if (!vma->anon_vma || vma->vm_ops) |
1820 | if (!vma->anon_vma || vma->vm_ops || vma->vm_file) | ||
1821 | goto out; | 1831 | goto out; |
1822 | if (is_vma_temporary_stack(vma)) | 1832 | if (is_vma_temporary_stack(vma)) |
1823 | goto out; | 1833 | goto out; |
1824 | VM_BUG_ON(is_linear_pfn_mapping(vma) || is_pfn_mapping(vma)); | 1834 | /* |
1835 | * If is_pfn_mapping() is true is_learn_pfn_mapping() must be | ||
1836 | * true too, verify it here. | ||
1837 | */ | ||
1838 | VM_BUG_ON(is_linear_pfn_mapping(vma) || vma->vm_flags & VM_NO_THP); | ||
1825 | 1839 | ||
1826 | pgd = pgd_offset(mm, address); | 1840 | pgd = pgd_offset(mm, address); |
1827 | if (!pgd_present(*pgd)) | 1841 | if (!pgd_present(*pgd)) |
@@ -2054,13 +2068,16 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages, | |||
2054 | progress++; | 2068 | progress++; |
2055 | continue; | 2069 | continue; |
2056 | } | 2070 | } |
2057 | /* VM_PFNMAP vmas may have vm_ops null but vm_file set */ | 2071 | if (!vma->anon_vma || vma->vm_ops) |
2058 | if (!vma->anon_vma || vma->vm_ops || vma->vm_file) | ||
2059 | goto skip; | 2072 | goto skip; |
2060 | if (is_vma_temporary_stack(vma)) | 2073 | if (is_vma_temporary_stack(vma)) |
2061 | goto skip; | 2074 | goto skip; |
2062 | 2075 | /* | |
2063 | VM_BUG_ON(is_linear_pfn_mapping(vma) || is_pfn_mapping(vma)); | 2076 | * If is_pfn_mapping() is true is_learn_pfn_mapping() |
2077 | * must be true too, verify it here. | ||
2078 | */ | ||
2079 | VM_BUG_ON(is_linear_pfn_mapping(vma) || | ||
2080 | vma->vm_flags & VM_NO_THP); | ||
2064 | 2081 | ||
2065 | hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; | 2082 | hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; |
2066 | hend = vma->vm_end & HPAGE_PMD_MASK; | 2083 | hend = vma->vm_end & HPAGE_PMD_MASK; |
@@ -2151,8 +2168,11 @@ static void khugepaged_do_scan(struct page **hpage) | |||
2151 | #ifndef CONFIG_NUMA | 2168 | #ifndef CONFIG_NUMA |
2152 | if (!*hpage) { | 2169 | if (!*hpage) { |
2153 | *hpage = alloc_hugepage(khugepaged_defrag()); | 2170 | *hpage = alloc_hugepage(khugepaged_defrag()); |
2154 | if (unlikely(!*hpage)) | 2171 | if (unlikely(!*hpage)) { |
2172 | count_vm_event(THP_COLLAPSE_ALLOC_FAILED); | ||
2155 | break; | 2173 | break; |
2174 | } | ||
2175 | count_vm_event(THP_COLLAPSE_ALLOC); | ||
2156 | } | 2176 | } |
2157 | #else | 2177 | #else |
2158 | if (IS_ERR(*hpage)) | 2178 | if (IS_ERR(*hpage)) |
@@ -2192,8 +2212,11 @@ static struct page *khugepaged_alloc_hugepage(void) | |||
2192 | 2212 | ||
2193 | do { | 2213 | do { |
2194 | hpage = alloc_hugepage(khugepaged_defrag()); | 2214 | hpage = alloc_hugepage(khugepaged_defrag()); |
2195 | if (!hpage) | 2215 | if (!hpage) { |
2216 | count_vm_event(THP_COLLAPSE_ALLOC_FAILED); | ||
2196 | khugepaged_alloc_sleep(); | 2217 | khugepaged_alloc_sleep(); |
2218 | } else | ||
2219 | count_vm_event(THP_COLLAPSE_ALLOC); | ||
2197 | } while (unlikely(!hpage) && | 2220 | } while (unlikely(!hpage) && |
2198 | likely(khugepaged_enabled())); | 2221 | likely(khugepaged_enabled())); |
2199 | return hpage; | 2222 | return hpage; |
@@ -2210,8 +2233,11 @@ static void khugepaged_loop(void) | |||
2210 | while (likely(khugepaged_enabled())) { | 2233 | while (likely(khugepaged_enabled())) { |
2211 | #ifndef CONFIG_NUMA | 2234 | #ifndef CONFIG_NUMA |
2212 | hpage = khugepaged_alloc_hugepage(); | 2235 | hpage = khugepaged_alloc_hugepage(); |
2213 | if (unlikely(!hpage)) | 2236 | if (unlikely(!hpage)) { |
2237 | count_vm_event(THP_COLLAPSE_ALLOC_FAILED); | ||
2214 | break; | 2238 | break; |
2239 | } | ||
2240 | count_vm_event(THP_COLLAPSE_ALLOC); | ||
2215 | #else | 2241 | #else |
2216 | if (IS_ERR(hpage)) { | 2242 | if (IS_ERR(hpage)) { |
2217 | khugepaged_alloc_sleep(); | 2243 | khugepaged_alloc_sleep(); |
diff --git a/mm/memory.c b/mm/memory.c index 9da8cab1b1b0..607098d47e74 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1410,6 +1410,13 @@ no_page_table: | |||
1410 | return page; | 1410 | return page; |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr) | ||
1414 | { | ||
1415 | return (vma->vm_flags & VM_GROWSDOWN) && | ||
1416 | (vma->vm_start == addr) && | ||
1417 | !vma_stack_continue(vma->vm_prev, addr); | ||
1418 | } | ||
1419 | |||
1413 | /** | 1420 | /** |
1414 | * __get_user_pages() - pin user pages in memory | 1421 | * __get_user_pages() - pin user pages in memory |
1415 | * @tsk: task_struct of target task | 1422 | * @tsk: task_struct of target task |
@@ -1488,7 +1495,6 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1488 | vma = find_extend_vma(mm, start); | 1495 | vma = find_extend_vma(mm, start); |
1489 | if (!vma && in_gate_area(mm, start)) { | 1496 | if (!vma && in_gate_area(mm, start)) { |
1490 | unsigned long pg = start & PAGE_MASK; | 1497 | unsigned long pg = start & PAGE_MASK; |
1491 | struct vm_area_struct *gate_vma = get_gate_vma(mm); | ||
1492 | pgd_t *pgd; | 1498 | pgd_t *pgd; |
1493 | pud_t *pud; | 1499 | pud_t *pud; |
1494 | pmd_t *pmd; | 1500 | pmd_t *pmd; |
@@ -1513,10 +1519,11 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1513 | pte_unmap(pte); | 1519 | pte_unmap(pte); |
1514 | return i ? : -EFAULT; | 1520 | return i ? : -EFAULT; |
1515 | } | 1521 | } |
1522 | vma = get_gate_vma(mm); | ||
1516 | if (pages) { | 1523 | if (pages) { |
1517 | struct page *page; | 1524 | struct page *page; |
1518 | 1525 | ||
1519 | page = vm_normal_page(gate_vma, start, *pte); | 1526 | page = vm_normal_page(vma, start, *pte); |
1520 | if (!page) { | 1527 | if (!page) { |
1521 | if (!(gup_flags & FOLL_DUMP) && | 1528 | if (!(gup_flags & FOLL_DUMP) && |
1522 | is_zero_pfn(pte_pfn(*pte))) | 1529 | is_zero_pfn(pte_pfn(*pte))) |
@@ -1530,12 +1537,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1530 | get_page(page); | 1537 | get_page(page); |
1531 | } | 1538 | } |
1532 | pte_unmap(pte); | 1539 | pte_unmap(pte); |
1533 | if (vmas) | 1540 | goto next_page; |
1534 | vmas[i] = gate_vma; | ||
1535 | i++; | ||
1536 | start += PAGE_SIZE; | ||
1537 | nr_pages--; | ||
1538 | continue; | ||
1539 | } | 1541 | } |
1540 | 1542 | ||
1541 | if (!vma || | 1543 | if (!vma || |
@@ -1549,6 +1551,13 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1549 | continue; | 1551 | continue; |
1550 | } | 1552 | } |
1551 | 1553 | ||
1554 | /* | ||
1555 | * If we don't actually want the page itself, | ||
1556 | * and it's the stack guard page, just skip it. | ||
1557 | */ | ||
1558 | if (!pages && stack_guard_page(vma, start)) | ||
1559 | goto next_page; | ||
1560 | |||
1552 | do { | 1561 | do { |
1553 | struct page *page; | 1562 | struct page *page; |
1554 | unsigned int foll_flags = gup_flags; | 1563 | unsigned int foll_flags = gup_flags; |
@@ -1631,6 +1640,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1631 | flush_anon_page(vma, page, start); | 1640 | flush_anon_page(vma, page, start); |
1632 | flush_dcache_page(page); | 1641 | flush_dcache_page(page); |
1633 | } | 1642 | } |
1643 | next_page: | ||
1634 | if (vmas) | 1644 | if (vmas) |
1635 | vmas[i] = vma; | 1645 | vmas[i] = vma; |
1636 | i++; | 1646 | i++; |
@@ -3386,7 +3396,7 @@ int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3386 | * run pte_offset_map on the pmd, if an huge pmd could | 3396 | * run pte_offset_map on the pmd, if an huge pmd could |
3387 | * materialize from under us from a different thread. | 3397 | * materialize from under us from a different thread. |
3388 | */ | 3398 | */ |
3389 | if (unlikely(__pte_alloc(mm, vma, pmd, address))) | 3399 | if (unlikely(pmd_none(*pmd)) && __pte_alloc(mm, vma, pmd, address)) |
3390 | return VM_FAULT_OOM; | 3400 | return VM_FAULT_OOM; |
3391 | /* if an huge pmd materialized from under us just retry later */ | 3401 | /* if an huge pmd materialized from under us just retry later */ |
3392 | if (unlikely(pmd_trans_huge(*pmd))) | 3402 | if (unlikely(pmd_trans_huge(*pmd))) |
@@ -3678,7 +3688,7 @@ static int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm, | |||
3678 | */ | 3688 | */ |
3679 | #ifdef CONFIG_HAVE_IOREMAP_PROT | 3689 | #ifdef CONFIG_HAVE_IOREMAP_PROT |
3680 | vma = find_vma(mm, addr); | 3690 | vma = find_vma(mm, addr); |
3681 | if (!vma) | 3691 | if (!vma || vma->vm_start > addr) |
3682 | break; | 3692 | break; |
3683 | if (vma->vm_ops && vma->vm_ops->access) | 3693 | if (vma->vm_ops && vma->vm_ops->access) |
3684 | ret = vma->vm_ops->access(vma, addr, buf, | 3694 | ret = vma->vm_ops->access(vma, addr, buf, |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index a2acaf820fe5..9ca1d604f7cd 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -375,7 +375,7 @@ void online_page(struct page *page) | |||
375 | #endif | 375 | #endif |
376 | 376 | ||
377 | #ifdef CONFIG_FLATMEM | 377 | #ifdef CONFIG_FLATMEM |
378 | max_mapnr = max(page_to_pfn(page), max_mapnr); | 378 | max_mapnr = max(pfn, max_mapnr); |
379 | #endif | 379 | #endif |
380 | 380 | ||
381 | ClearPageReserved(page); | 381 | ClearPageReserved(page); |
diff --git a/mm/mlock.c b/mm/mlock.c index 2689a08c79af..6b55e3efe0df 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
@@ -135,13 +135,6 @@ void munlock_vma_page(struct page *page) | |||
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr) | ||
139 | { | ||
140 | return (vma->vm_flags & VM_GROWSDOWN) && | ||
141 | (vma->vm_start == addr) && | ||
142 | !vma_stack_continue(vma->vm_prev, addr); | ||
143 | } | ||
144 | |||
145 | /** | 138 | /** |
146 | * __mlock_vma_pages_range() - mlock a range of pages in the vma. | 139 | * __mlock_vma_pages_range() - mlock a range of pages in the vma. |
147 | * @vma: target vma | 140 | * @vma: target vma |
@@ -188,12 +181,6 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma, | |||
188 | if (vma->vm_flags & VM_LOCKED) | 181 | if (vma->vm_flags & VM_LOCKED) |
189 | gup_flags |= FOLL_MLOCK; | 182 | gup_flags |= FOLL_MLOCK; |
190 | 183 | ||
191 | /* We don't try to access the guard page of a stack vma */ | ||
192 | if (stack_guard_page(vma, start)) { | ||
193 | addr += PAGE_SIZE; | ||
194 | nr_pages--; | ||
195 | } | ||
196 | |||
197 | return __get_user_pages(current, mm, addr, nr_pages, gup_flags, | 184 | return __get_user_pages(current, mm, addr, nr_pages, gup_flags, |
198 | NULL, NULL, nonblocking); | 185 | NULL, NULL, nonblocking); |
199 | } | 186 | } |
@@ -259,7 +259,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk) | |||
259 | * randomize_va_space to 2, which will still cause mm->start_brk | 259 | * randomize_va_space to 2, which will still cause mm->start_brk |
260 | * to be arbitrarily shifted | 260 | * to be arbitrarily shifted |
261 | */ | 261 | */ |
262 | if (mm->start_brk > PAGE_ALIGN(mm->end_data)) | 262 | if (current->brk_randomized) |
263 | min_brk = mm->start_brk; | 263 | min_brk = mm->start_brk; |
264 | else | 264 | else |
265 | min_brk = mm->end_data; | 265 | min_brk = mm->end_data; |
@@ -1814,11 +1814,14 @@ static int expand_downwards(struct vm_area_struct *vma, | |||
1814 | size = vma->vm_end - address; | 1814 | size = vma->vm_end - address; |
1815 | grow = (vma->vm_start - address) >> PAGE_SHIFT; | 1815 | grow = (vma->vm_start - address) >> PAGE_SHIFT; |
1816 | 1816 | ||
1817 | error = acct_stack_growth(vma, size, grow); | 1817 | error = -ENOMEM; |
1818 | if (!error) { | 1818 | if (grow <= vma->vm_pgoff) { |
1819 | vma->vm_start = address; | 1819 | error = acct_stack_growth(vma, size, grow); |
1820 | vma->vm_pgoff -= grow; | 1820 | if (!error) { |
1821 | perf_event_mmap(vma); | 1821 | vma->vm_start = address; |
1822 | vma->vm_pgoff -= grow; | ||
1823 | perf_event_mmap(vma); | ||
1824 | } | ||
1822 | } | 1825 | } |
1823 | } | 1826 | } |
1824 | vma_unlock_anon_vma(vma); | 1827 | vma_unlock_anon_vma(vma); |
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 6a819d1b2c7d..f52e85c80e8d 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -84,24 +84,6 @@ static bool has_intersects_mems_allowed(struct task_struct *tsk, | |||
84 | #endif /* CONFIG_NUMA */ | 84 | #endif /* CONFIG_NUMA */ |
85 | 85 | ||
86 | /* | 86 | /* |
87 | * If this is a system OOM (not a memcg OOM) and the task selected to be | ||
88 | * killed is not already running at high (RT) priorities, speed up the | ||
89 | * recovery by boosting the dying task to the lowest FIFO priority. | ||
90 | * That helps with the recovery and avoids interfering with RT tasks. | ||
91 | */ | ||
92 | static void boost_dying_task_prio(struct task_struct *p, | ||
93 | struct mem_cgroup *mem) | ||
94 | { | ||
95 | struct sched_param param = { .sched_priority = 1 }; | ||
96 | |||
97 | if (mem) | ||
98 | return; | ||
99 | |||
100 | if (!rt_task(p)) | ||
101 | sched_setscheduler_nocheck(p, SCHED_FIFO, ¶m); | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | * The process p may have detached its own ->mm while exiting or through | 87 | * The process p may have detached its own ->mm while exiting or through |
106 | * use_mm(), but one or more of its subthreads may still have a valid | 88 | * use_mm(), but one or more of its subthreads may still have a valid |
107 | * pointer. Return p, or any of its subthreads with a valid ->mm, with | 89 | * pointer. Return p, or any of its subthreads with a valid ->mm, with |
@@ -190,10 +172,13 @@ unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, | |||
190 | 172 | ||
191 | /* | 173 | /* |
192 | * The baseline for the badness score is the proportion of RAM that each | 174 | * The baseline for the badness score is the proportion of RAM that each |
193 | * task's rss and swap space use. | 175 | * task's rss, pagetable and swap space use. |
194 | */ | 176 | */ |
195 | points = (get_mm_rss(p->mm) + get_mm_counter(p->mm, MM_SWAPENTS)) * 1000 / | 177 | points = get_mm_rss(p->mm) + p->mm->nr_ptes; |
196 | totalpages; | 178 | points += get_mm_counter(p->mm, MM_SWAPENTS); |
179 | |||
180 | points *= 1000; | ||
181 | points /= totalpages; | ||
197 | task_unlock(p); | 182 | task_unlock(p); |
198 | 183 | ||
199 | /* | 184 | /* |
@@ -452,13 +437,6 @@ static int oom_kill_task(struct task_struct *p, struct mem_cgroup *mem) | |||
452 | set_tsk_thread_flag(p, TIF_MEMDIE); | 437 | set_tsk_thread_flag(p, TIF_MEMDIE); |
453 | force_sig(SIGKILL, p); | 438 | force_sig(SIGKILL, p); |
454 | 439 | ||
455 | /* | ||
456 | * We give our sacrificial lamb high priority and access to | ||
457 | * all the memory it needs. That way it should be able to | ||
458 | * exit() and clear out its resources quickly... | ||
459 | */ | ||
460 | boost_dying_task_prio(p, mem); | ||
461 | |||
462 | return 0; | 440 | return 0; |
463 | } | 441 | } |
464 | #undef K | 442 | #undef K |
@@ -482,7 +460,6 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, | |||
482 | */ | 460 | */ |
483 | if (p->flags & PF_EXITING) { | 461 | if (p->flags & PF_EXITING) { |
484 | set_tsk_thread_flag(p, TIF_MEMDIE); | 462 | set_tsk_thread_flag(p, TIF_MEMDIE); |
485 | boost_dying_task_prio(p, mem); | ||
486 | return 0; | 463 | return 0; |
487 | } | 464 | } |
488 | 465 | ||
@@ -556,7 +533,6 @@ void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask) | |||
556 | */ | 533 | */ |
557 | if (fatal_signal_pending(current)) { | 534 | if (fatal_signal_pending(current)) { |
558 | set_thread_flag(TIF_MEMDIE); | 535 | set_thread_flag(TIF_MEMDIE); |
559 | boost_dying_task_prio(current, NULL); | ||
560 | return; | 536 | return; |
561 | } | 537 | } |
562 | 538 | ||
@@ -712,7 +688,6 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, | |||
712 | */ | 688 | */ |
713 | if (fatal_signal_pending(current)) { | 689 | if (fatal_signal_pending(current)) { |
714 | set_thread_flag(TIF_MEMDIE); | 690 | set_thread_flag(TIF_MEMDIE); |
715 | boost_dying_task_prio(current, NULL); | ||
716 | return; | 691 | return; |
717 | } | 692 | } |
718 | 693 | ||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2747f5e5abc1..9f8a97b9a350 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3176,7 +3176,7 @@ static __init_refok int __build_all_zonelists(void *data) | |||
3176 | * Called with zonelists_mutex held always | 3176 | * Called with zonelists_mutex held always |
3177 | * unless system_state == SYSTEM_BOOTING. | 3177 | * unless system_state == SYSTEM_BOOTING. |
3178 | */ | 3178 | */ |
3179 | void build_all_zonelists(void *data) | 3179 | void __ref build_all_zonelists(void *data) |
3180 | { | 3180 | { |
3181 | set_zonelist_order(); | 3181 | set_zonelist_order(); |
3182 | 3182 | ||
diff --git a/mm/shmem.c b/mm/shmem.c index 58da7c150ba6..8fa27e4e582a 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -421,7 +421,8 @@ static swp_entry_t *shmem_swp_alloc(struct shmem_inode_info *info, unsigned long | |||
421 | * a waste to allocate index if we cannot allocate data. | 421 | * a waste to allocate index if we cannot allocate data. |
422 | */ | 422 | */ |
423 | if (sbinfo->max_blocks) { | 423 | if (sbinfo->max_blocks) { |
424 | if (percpu_counter_compare(&sbinfo->used_blocks, (sbinfo->max_blocks - 1)) > 0) | 424 | if (percpu_counter_compare(&sbinfo->used_blocks, |
425 | sbinfo->max_blocks - 1) >= 0) | ||
425 | return ERR_PTR(-ENOSPC); | 426 | return ERR_PTR(-ENOSPC); |
426 | percpu_counter_inc(&sbinfo->used_blocks); | 427 | percpu_counter_inc(&sbinfo->used_blocks); |
427 | spin_lock(&inode->i_lock); | 428 | spin_lock(&inode->i_lock); |
@@ -1397,7 +1398,8 @@ repeat: | |||
1397 | shmem_swp_unmap(entry); | 1398 | shmem_swp_unmap(entry); |
1398 | sbinfo = SHMEM_SB(inode->i_sb); | 1399 | sbinfo = SHMEM_SB(inode->i_sb); |
1399 | if (sbinfo->max_blocks) { | 1400 | if (sbinfo->max_blocks) { |
1400 | if ((percpu_counter_compare(&sbinfo->used_blocks, sbinfo->max_blocks) > 0) || | 1401 | if (percpu_counter_compare(&sbinfo->used_blocks, |
1402 | sbinfo->max_blocks) >= 0 || | ||
1401 | shmem_acct_block(info->flags)) { | 1403 | shmem_acct_block(info->flags)) { |
1402 | spin_unlock(&info->lock); | 1404 | spin_unlock(&info->lock); |
1403 | error = -ENOSPC; | 1405 | error = -ENOSPC; |
diff --git a/mm/vmscan.c b/mm/vmscan.c index c7f5a6d4b75b..f6b435c80079 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/memcontrol.h> | 41 | #include <linux/memcontrol.h> |
42 | #include <linux/delayacct.h> | 42 | #include <linux/delayacct.h> |
43 | #include <linux/sysctl.h> | 43 | #include <linux/sysctl.h> |
44 | #include <linux/oom.h> | ||
44 | 45 | ||
45 | #include <asm/tlbflush.h> | 46 | #include <asm/tlbflush.h> |
46 | #include <asm/div64.h> | 47 | #include <asm/div64.h> |
@@ -1988,17 +1989,12 @@ static bool zone_reclaimable(struct zone *zone) | |||
1988 | return zone->pages_scanned < zone_reclaimable_pages(zone) * 6; | 1989 | return zone->pages_scanned < zone_reclaimable_pages(zone) * 6; |
1989 | } | 1990 | } |
1990 | 1991 | ||
1991 | /* | 1992 | /* All zones in zonelist are unreclaimable? */ |
1992 | * As hibernation is going on, kswapd is freezed so that it can't mark | ||
1993 | * the zone into all_unreclaimable. It can't handle OOM during hibernation. | ||
1994 | * So let's check zone's unreclaimable in direct reclaim as well as kswapd. | ||
1995 | */ | ||
1996 | static bool all_unreclaimable(struct zonelist *zonelist, | 1993 | static bool all_unreclaimable(struct zonelist *zonelist, |
1997 | struct scan_control *sc) | 1994 | struct scan_control *sc) |
1998 | { | 1995 | { |
1999 | struct zoneref *z; | 1996 | struct zoneref *z; |
2000 | struct zone *zone; | 1997 | struct zone *zone; |
2001 | bool all_unreclaimable = true; | ||
2002 | 1998 | ||
2003 | for_each_zone_zonelist_nodemask(zone, z, zonelist, | 1999 | for_each_zone_zonelist_nodemask(zone, z, zonelist, |
2004 | gfp_zone(sc->gfp_mask), sc->nodemask) { | 2000 | gfp_zone(sc->gfp_mask), sc->nodemask) { |
@@ -2006,13 +2002,11 @@ static bool all_unreclaimable(struct zonelist *zonelist, | |||
2006 | continue; | 2002 | continue; |
2007 | if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) | 2003 | if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) |
2008 | continue; | 2004 | continue; |
2009 | if (zone_reclaimable(zone)) { | 2005 | if (!zone->all_unreclaimable) |
2010 | all_unreclaimable = false; | 2006 | return false; |
2011 | break; | ||
2012 | } | ||
2013 | } | 2007 | } |
2014 | 2008 | ||
2015 | return all_unreclaimable; | 2009 | return true; |
2016 | } | 2010 | } |
2017 | 2011 | ||
2018 | /* | 2012 | /* |
@@ -2108,6 +2102,14 @@ out: | |||
2108 | if (sc->nr_reclaimed) | 2102 | if (sc->nr_reclaimed) |
2109 | return sc->nr_reclaimed; | 2103 | return sc->nr_reclaimed; |
2110 | 2104 | ||
2105 | /* | ||
2106 | * As hibernation is going on, kswapd is freezed so that it can't mark | ||
2107 | * the zone into all_unreclaimable. Thus bypassing all_unreclaimable | ||
2108 | * check. | ||
2109 | */ | ||
2110 | if (oom_killer_disabled) | ||
2111 | return 0; | ||
2112 | |||
2111 | /* top priority shrink_zones still had more to do? don't OOM, then */ | 2113 | /* top priority shrink_zones still had more to do? don't OOM, then */ |
2112 | if (scanning_global_lru(sc) && !all_unreclaimable(zonelist, sc)) | 2114 | if (scanning_global_lru(sc) && !all_unreclaimable(zonelist, sc)) |
2113 | return 1; | 2115 | return 1; |
diff --git a/mm/vmstat.c b/mm/vmstat.c index 772b39b87d95..897ea9e88238 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -321,9 +321,12 @@ static inline void mod_state(struct zone *zone, | |||
321 | /* | 321 | /* |
322 | * The fetching of the stat_threshold is racy. We may apply | 322 | * The fetching of the stat_threshold is racy. We may apply |
323 | * a counter threshold to the wrong the cpu if we get | 323 | * a counter threshold to the wrong the cpu if we get |
324 | * rescheduled while executing here. However, the following | 324 | * rescheduled while executing here. However, the next |
325 | * will apply the threshold again and therefore bring the | 325 | * counter update will apply the threshold again and |
326 | * counter under the threshold. | 326 | * therefore bring the counter under the threshold again. |
327 | * | ||
328 | * Most of the time the thresholds are the same anyways | ||
329 | * for all cpus in a zone. | ||
327 | */ | 330 | */ |
328 | t = this_cpu_read(pcp->stat_threshold); | 331 | t = this_cpu_read(pcp->stat_threshold); |
329 | 332 | ||
@@ -945,7 +948,16 @@ static const char * const vmstat_text[] = { | |||
945 | "unevictable_pgs_cleared", | 948 | "unevictable_pgs_cleared", |
946 | "unevictable_pgs_stranded", | 949 | "unevictable_pgs_stranded", |
947 | "unevictable_pgs_mlockfreed", | 950 | "unevictable_pgs_mlockfreed", |
951 | |||
952 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
953 | "thp_fault_alloc", | ||
954 | "thp_fault_fallback", | ||
955 | "thp_collapse_alloc", | ||
956 | "thp_collapse_alloc_failed", | ||
957 | "thp_split", | ||
948 | #endif | 958 | #endif |
959 | |||
960 | #endif /* CONFIG_VM_EVENTS_COUNTERS */ | ||
949 | }; | 961 | }; |
950 | 962 | ||
951 | static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, | 963 | static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, |
diff --git a/net/9p/client.c b/net/9p/client.c index 48b8e084e710..77367745be9b 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -929,15 +929,15 @@ error: | |||
929 | } | 929 | } |
930 | EXPORT_SYMBOL(p9_client_attach); | 930 | EXPORT_SYMBOL(p9_client_attach); |
931 | 931 | ||
932 | struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, | 932 | struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname, |
933 | int clone) | 933 | char **wnames, int clone) |
934 | { | 934 | { |
935 | int err; | 935 | int err; |
936 | struct p9_client *clnt; | 936 | struct p9_client *clnt; |
937 | struct p9_fid *fid; | 937 | struct p9_fid *fid; |
938 | struct p9_qid *wqids; | 938 | struct p9_qid *wqids; |
939 | struct p9_req_t *req; | 939 | struct p9_req_t *req; |
940 | int16_t nwqids, count; | 940 | uint16_t nwqids, count; |
941 | 941 | ||
942 | err = 0; | 942 | err = 0; |
943 | wqids = NULL; | 943 | wqids = NULL; |
@@ -955,7 +955,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, | |||
955 | fid = oldfid; | 955 | fid = oldfid; |
956 | 956 | ||
957 | 957 | ||
958 | P9_DPRINTK(P9_DEBUG_9P, ">>> TWALK fids %d,%d nwname %d wname[0] %s\n", | 958 | P9_DPRINTK(P9_DEBUG_9P, ">>> TWALK fids %d,%d nwname %ud wname[0] %s\n", |
959 | oldfid->fid, fid->fid, nwname, wnames ? wnames[0] : NULL); | 959 | oldfid->fid, fid->fid, nwname, wnames ? wnames[0] : NULL); |
960 | 960 | ||
961 | req = p9_client_rpc(clnt, P9_TWALK, "ddT", oldfid->fid, fid->fid, | 961 | req = p9_client_rpc(clnt, P9_TWALK, "ddT", oldfid->fid, fid->fid, |
@@ -1220,27 +1220,6 @@ error: | |||
1220 | } | 1220 | } |
1221 | EXPORT_SYMBOL(p9_client_fsync); | 1221 | EXPORT_SYMBOL(p9_client_fsync); |
1222 | 1222 | ||
1223 | int p9_client_sync_fs(struct p9_fid *fid) | ||
1224 | { | ||
1225 | int err = 0; | ||
1226 | struct p9_req_t *req; | ||
1227 | struct p9_client *clnt; | ||
1228 | |||
1229 | P9_DPRINTK(P9_DEBUG_9P, ">>> TSYNC_FS fid %d\n", fid->fid); | ||
1230 | |||
1231 | clnt = fid->clnt; | ||
1232 | req = p9_client_rpc(clnt, P9_TSYNCFS, "d", fid->fid); | ||
1233 | if (IS_ERR(req)) { | ||
1234 | err = PTR_ERR(req); | ||
1235 | goto error; | ||
1236 | } | ||
1237 | P9_DPRINTK(P9_DEBUG_9P, "<<< RSYNCFS fid %d\n", fid->fid); | ||
1238 | p9_free_req(clnt, req); | ||
1239 | error: | ||
1240 | return err; | ||
1241 | } | ||
1242 | EXPORT_SYMBOL(p9_client_sync_fs); | ||
1243 | |||
1244 | int p9_client_clunk(struct p9_fid *fid) | 1223 | int p9_client_clunk(struct p9_fid *fid) |
1245 | { | 1224 | { |
1246 | int err; | 1225 | int err; |
diff --git a/net/9p/protocol.c b/net/9p/protocol.c index 8a4084fa8b5a..b58a501cf3d1 100644 --- a/net/9p/protocol.c +++ b/net/9p/protocol.c | |||
@@ -265,7 +265,7 @@ p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt, | |||
265 | } | 265 | } |
266 | break; | 266 | break; |
267 | case 'T':{ | 267 | case 'T':{ |
268 | int16_t *nwname = va_arg(ap, int16_t *); | 268 | uint16_t *nwname = va_arg(ap, uint16_t *); |
269 | char ***wnames = va_arg(ap, char ***); | 269 | char ***wnames = va_arg(ap, char ***); |
270 | 270 | ||
271 | errcode = p9pdu_readf(pdu, proto_version, | 271 | errcode = p9pdu_readf(pdu, proto_version, |
@@ -468,7 +468,8 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt, | |||
468 | case 'E':{ | 468 | case 'E':{ |
469 | int32_t cnt = va_arg(ap, int32_t); | 469 | int32_t cnt = va_arg(ap, int32_t); |
470 | const char *k = va_arg(ap, const void *); | 470 | const char *k = va_arg(ap, const void *); |
471 | const char *u = va_arg(ap, const void *); | 471 | const char __user *u = va_arg(ap, |
472 | const void __user *); | ||
472 | errcode = p9pdu_writef(pdu, proto_version, "d", | 473 | errcode = p9pdu_writef(pdu, proto_version, "d", |
473 | cnt); | 474 | cnt); |
474 | if (!errcode && pdu_write_urw(pdu, k, u, cnt)) | 475 | if (!errcode && pdu_write_urw(pdu, k, u, cnt)) |
@@ -495,7 +496,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt, | |||
495 | } | 496 | } |
496 | break; | 497 | break; |
497 | case 'T':{ | 498 | case 'T':{ |
498 | int16_t nwname = va_arg(ap, int); | 499 | uint16_t nwname = va_arg(ap, int); |
499 | const char **wnames = va_arg(ap, const char **); | 500 | const char **wnames = va_arg(ap, const char **); |
500 | 501 | ||
501 | errcode = p9pdu_writef(pdu, proto_version, "w", | 502 | errcode = p9pdu_writef(pdu, proto_version, "w", |
diff --git a/net/9p/trans_common.c b/net/9p/trans_common.c index d47880e971dd..e883172f9aa2 100644 --- a/net/9p/trans_common.c +++ b/net/9p/trans_common.c | |||
@@ -66,7 +66,7 @@ p9_payload_gup(struct p9_req_t *req, size_t *pdata_off, int *pdata_len, | |||
66 | uint32_t pdata_mapped_pages; | 66 | uint32_t pdata_mapped_pages; |
67 | struct trans_rpage_info *rpinfo; | 67 | struct trans_rpage_info *rpinfo; |
68 | 68 | ||
69 | *pdata_off = (size_t)req->tc->pubuf & (PAGE_SIZE-1); | 69 | *pdata_off = (__force size_t)req->tc->pubuf & (PAGE_SIZE-1); |
70 | 70 | ||
71 | if (*pdata_off) | 71 | if (*pdata_off) |
72 | first_page_bytes = min(((size_t)PAGE_SIZE - *pdata_off), | 72 | first_page_bytes = min(((size_t)PAGE_SIZE - *pdata_off), |
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index e8f046b07182..244e70742183 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -326,8 +326,11 @@ req_retry_pinned: | |||
326 | outp = pack_sg_list_p(chan->sg, out, VIRTQUEUE_NUM, | 326 | outp = pack_sg_list_p(chan->sg, out, VIRTQUEUE_NUM, |
327 | pdata_off, rpinfo->rp_data, pdata_len); | 327 | pdata_off, rpinfo->rp_data, pdata_len); |
328 | } else { | 328 | } else { |
329 | char *pbuf = req->tc->pubuf ? req->tc->pubuf : | 329 | char *pbuf; |
330 | req->tc->pkbuf; | 330 | if (req->tc->pubuf) |
331 | pbuf = (__force char *) req->tc->pubuf; | ||
332 | else | ||
333 | pbuf = req->tc->pkbuf; | ||
331 | outp = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, pbuf, | 334 | outp = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, pbuf, |
332 | req->tc->pbuf_size); | 335 | req->tc->pbuf_size); |
333 | } | 336 | } |
@@ -352,8 +355,12 @@ req_retry_pinned: | |||
352 | in = pack_sg_list_p(chan->sg, out+inp, VIRTQUEUE_NUM, | 355 | in = pack_sg_list_p(chan->sg, out+inp, VIRTQUEUE_NUM, |
353 | pdata_off, rpinfo->rp_data, pdata_len); | 356 | pdata_off, rpinfo->rp_data, pdata_len); |
354 | } else { | 357 | } else { |
355 | char *pbuf = req->tc->pubuf ? req->tc->pubuf : | 358 | char *pbuf; |
356 | req->tc->pkbuf; | 359 | if (req->tc->pubuf) |
360 | pbuf = (__force char *) req->tc->pubuf; | ||
361 | else | ||
362 | pbuf = req->tc->pkbuf; | ||
363 | |||
357 | in = pack_sg_list(chan->sg, out+inp, VIRTQUEUE_NUM, | 364 | in = pack_sg_list(chan->sg, out+inp, VIRTQUEUE_NUM, |
358 | pbuf, req->tc->pbuf_size); | 365 | pbuf, req->tc->pbuf_size); |
359 | } | 366 | } |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 50af02737a3d..5a80f41c0cba 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -579,9 +579,15 @@ static void __kick_osd_requests(struct ceph_osd_client *osdc, | |||
579 | 579 | ||
580 | list_for_each_entry_safe(req, nreq, &osd->o_linger_requests, | 580 | list_for_each_entry_safe(req, nreq, &osd->o_linger_requests, |
581 | r_linger_osd) { | 581 | r_linger_osd) { |
582 | __unregister_linger_request(osdc, req); | 582 | /* |
583 | * reregister request prior to unregistering linger so | ||
584 | * that r_osd is preserved. | ||
585 | */ | ||
586 | BUG_ON(!list_empty(&req->r_req_lru_item)); | ||
583 | __register_request(osdc, req); | 587 | __register_request(osdc, req); |
584 | list_move(&req->r_req_lru_item, &osdc->req_unsent); | 588 | list_add(&req->r_req_lru_item, &osdc->req_unsent); |
589 | list_add(&req->r_osd_item, &req->r_osd->o_requests); | ||
590 | __unregister_linger_request(osdc, req); | ||
585 | dout("requeued lingering %p tid %llu osd%d\n", req, req->r_tid, | 591 | dout("requeued lingering %p tid %llu osd%d\n", req, req->r_tid, |
586 | osd->o_osd); | 592 | osd->o_osd); |
587 | } | 593 | } |
@@ -798,7 +804,7 @@ static void __register_request(struct ceph_osd_client *osdc, | |||
798 | req->r_request->hdr.tid = cpu_to_le64(req->r_tid); | 804 | req->r_request->hdr.tid = cpu_to_le64(req->r_tid); |
799 | INIT_LIST_HEAD(&req->r_req_lru_item); | 805 | INIT_LIST_HEAD(&req->r_req_lru_item); |
800 | 806 | ||
801 | dout("register_request %p tid %lld\n", req, req->r_tid); | 807 | dout("__register_request %p tid %lld\n", req, req->r_tid); |
802 | __insert_request(osdc, req); | 808 | __insert_request(osdc, req); |
803 | ceph_osdc_get_request(req); | 809 | ceph_osdc_get_request(req); |
804 | osdc->num_requests++; | 810 | osdc->num_requests++; |
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index fce9bd3bd3fe..5c04f3e42704 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
@@ -667,7 +667,7 @@ MODULE_AUTHOR("James Chapman <jchapman@katalix.com>"); | |||
667 | MODULE_DESCRIPTION("L2TP over IP"); | 667 | MODULE_DESCRIPTION("L2TP over IP"); |
668 | MODULE_VERSION("1.0"); | 668 | MODULE_VERSION("1.0"); |
669 | 669 | ||
670 | /* Use the value of SOCK_DGRAM (2) directory, because __stringify does't like | 670 | /* Use the value of SOCK_DGRAM (2) directory, because __stringify doesn't like |
671 | * enums | 671 | * enums |
672 | */ | 672 | */ |
673 | MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, 2, IPPROTO_L2TP); | 673 | MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, 2, IPPROTO_L2TP); |
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index dff27d5e22fd..61b1f5ada96a 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -554,7 +554,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_send_failed( | |||
554 | memcpy(&ssf->ssf_info, &chunk->sinfo, sizeof(struct sctp_sndrcvinfo)); | 554 | memcpy(&ssf->ssf_info, &chunk->sinfo, sizeof(struct sctp_sndrcvinfo)); |
555 | 555 | ||
556 | /* Per TSVWG discussion with Randy. Allow the application to | 556 | /* Per TSVWG discussion with Randy. Allow the application to |
557 | * resemble a fragmented message. | 557 | * reassemble a fragmented message. |
558 | */ | 558 | */ |
559 | ssf->ssf_info.sinfo_flags = chunk->chunk_hdr->flags; | 559 | ssf->ssf_info.sinfo_flags = chunk->chunk_hdr->flags; |
560 | 560 | ||
diff --git a/net/sunrpc/Kconfig b/net/sunrpc/Kconfig index 8873fd8ddacd..b2198e65d8bb 100644 --- a/net/sunrpc/Kconfig +++ b/net/sunrpc/Kconfig | |||
@@ -18,14 +18,13 @@ config SUNRPC_XPRT_RDMA | |||
18 | If unsure, say N. | 18 | If unsure, say N. |
19 | 19 | ||
20 | config RPCSEC_GSS_KRB5 | 20 | config RPCSEC_GSS_KRB5 |
21 | tristate | 21 | tristate "Secure RPC: Kerberos V mechanism" |
22 | depends on SUNRPC && CRYPTO | 22 | depends on SUNRPC && CRYPTO |
23 | prompt "Secure RPC: Kerberos V mechanism" if !(NFS_V4 || NFSD_V4) | 23 | depends on CRYPTO_MD5 && CRYPTO_DES && CRYPTO_CBC && CRYPTO_CTS |
24 | depends on CRYPTO_ECB && CRYPTO_HMAC && CRYPTO_SHA1 && CRYPTO_AES | ||
25 | depends on CRYPTO_ARC4 | ||
24 | default y | 26 | default y |
25 | select SUNRPC_GSS | 27 | select SUNRPC_GSS |
26 | select CRYPTO_MD5 | ||
27 | select CRYPTO_DES | ||
28 | select CRYPTO_CBC | ||
29 | help | 28 | help |
30 | Choose Y here to enable Secure RPC using the Kerberos version 5 | 29 | Choose Y here to enable Secure RPC using the Kerberos version 5 |
31 | GSS-API mechanism (RFC 1964). | 30 | GSS-API mechanism (RFC 1964). |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index f3914d0c5079..339ba64cce1e 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -520,7 +520,7 @@ gss_refresh_upcall(struct rpc_task *task) | |||
520 | warn_gssd(); | 520 | warn_gssd(); |
521 | task->tk_timeout = 15*HZ; | 521 | task->tk_timeout = 15*HZ; |
522 | rpc_sleep_on(&pipe_version_rpc_waitqueue, task, NULL); | 522 | rpc_sleep_on(&pipe_version_rpc_waitqueue, task, NULL); |
523 | return 0; | 523 | return -EAGAIN; |
524 | } | 524 | } |
525 | if (IS_ERR(gss_msg)) { | 525 | if (IS_ERR(gss_msg)) { |
526 | err = PTR_ERR(gss_msg); | 526 | err = PTR_ERR(gss_msg); |
@@ -563,10 +563,12 @@ retry: | |||
563 | if (PTR_ERR(gss_msg) == -EAGAIN) { | 563 | if (PTR_ERR(gss_msg) == -EAGAIN) { |
564 | err = wait_event_interruptible_timeout(pipe_version_waitqueue, | 564 | err = wait_event_interruptible_timeout(pipe_version_waitqueue, |
565 | pipe_version >= 0, 15*HZ); | 565 | pipe_version >= 0, 15*HZ); |
566 | if (pipe_version < 0) { | ||
567 | warn_gssd(); | ||
568 | err = -EACCES; | ||
569 | } | ||
566 | if (err) | 570 | if (err) |
567 | goto out; | 571 | goto out; |
568 | if (pipe_version < 0) | ||
569 | warn_gssd(); | ||
570 | goto retry; | 572 | goto retry; |
571 | } | 573 | } |
572 | if (IS_ERR(gss_msg)) { | 574 | if (IS_ERR(gss_msg)) { |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index e7a96e478f63..8d83f9d48713 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -1508,7 +1508,10 @@ call_timeout(struct rpc_task *task) | |||
1508 | if (clnt->cl_chatty) | 1508 | if (clnt->cl_chatty) |
1509 | printk(KERN_NOTICE "%s: server %s not responding, timed out\n", | 1509 | printk(KERN_NOTICE "%s: server %s not responding, timed out\n", |
1510 | clnt->cl_protname, clnt->cl_server); | 1510 | clnt->cl_protname, clnt->cl_server); |
1511 | rpc_exit(task, -EIO); | 1511 | if (task->tk_flags & RPC_TASK_TIMEOUT) |
1512 | rpc_exit(task, -ETIMEDOUT); | ||
1513 | else | ||
1514 | rpc_exit(task, -EIO); | ||
1512 | return; | 1515 | return; |
1513 | } | 1516 | } |
1514 | 1517 | ||
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 9494c3767356..ce5eb68a9664 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -906,6 +906,7 @@ void xprt_transmit(struct rpc_task *task) | |||
906 | } | 906 | } |
907 | 907 | ||
908 | dprintk("RPC: %5u xmit complete\n", task->tk_pid); | 908 | dprintk("RPC: %5u xmit complete\n", task->tk_pid); |
909 | task->tk_flags |= RPC_TASK_SENT; | ||
909 | spin_lock_bh(&xprt->transport_lock); | 910 | spin_lock_bh(&xprt->transport_lock); |
910 | 911 | ||
911 | xprt->ops->set_retrans_timeout(task); | 912 | xprt->ops->set_retrans_timeout(task); |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 659326c3e895..006ad817cd5f 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -332,7 +332,7 @@ static int conf_choice(struct menu *menu) | |||
332 | } | 332 | } |
333 | if (!child) | 333 | if (!child) |
334 | continue; | 334 | continue; |
335 | if (line[strlen(line) - 1] == '?') { | 335 | if (line[0] && line[strlen(line) - 1] == '?') { |
336 | print_help(child); | 336 | print_help(child); |
337 | continue; | 337 | continue; |
338 | } | 338 | } |
diff --git a/security/capability.c b/security/capability.c index 2984ea4f776f..bbb51156261b 100644 --- a/security/capability.c +++ b/security/capability.c | |||
@@ -181,7 +181,7 @@ static int cap_inode_follow_link(struct dentry *dentry, | |||
181 | return 0; | 181 | return 0; |
182 | } | 182 | } |
183 | 183 | ||
184 | static int cap_inode_permission(struct inode *inode, int mask) | 184 | static int cap_inode_permission(struct inode *inode, int mask, unsigned flags) |
185 | { | 185 | { |
186 | return 0; | 186 | return 0; |
187 | } | 187 | } |
diff --git a/security/security.c b/security/security.c index 101142369db4..4ba6d4cc061f 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -518,16 +518,14 @@ int security_inode_permission(struct inode *inode, int mask) | |||
518 | { | 518 | { |
519 | if (unlikely(IS_PRIVATE(inode))) | 519 | if (unlikely(IS_PRIVATE(inode))) |
520 | return 0; | 520 | return 0; |
521 | return security_ops->inode_permission(inode, mask); | 521 | return security_ops->inode_permission(inode, mask, 0); |
522 | } | 522 | } |
523 | 523 | ||
524 | int security_inode_exec_permission(struct inode *inode, unsigned int flags) | 524 | int security_inode_exec_permission(struct inode *inode, unsigned int flags) |
525 | { | 525 | { |
526 | if (unlikely(IS_PRIVATE(inode))) | 526 | if (unlikely(IS_PRIVATE(inode))) |
527 | return 0; | 527 | return 0; |
528 | if (flags) | 528 | return security_ops->inode_permission(inode, MAY_EXEC, flags); |
529 | return -ECHILD; | ||
530 | return security_ops->inode_permission(inode, MAY_EXEC); | ||
531 | } | 529 | } |
532 | 530 | ||
533 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr) | 531 | int security_inode_setattr(struct dentry *dentry, struct iattr *attr) |
diff --git a/security/selinux/avc.c b/security/selinux/avc.c index 9da6420e2056..1d027e29ce8d 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c | |||
@@ -471,6 +471,7 @@ static void avc_audit_post_callback(struct audit_buffer *ab, void *a) | |||
471 | * @avd: access vector decisions | 471 | * @avd: access vector decisions |
472 | * @result: result from avc_has_perm_noaudit | 472 | * @result: result from avc_has_perm_noaudit |
473 | * @a: auxiliary audit data | 473 | * @a: auxiliary audit data |
474 | * @flags: VFS walk flags | ||
474 | * | 475 | * |
475 | * Audit the granting or denial of permissions in accordance | 476 | * Audit the granting or denial of permissions in accordance |
476 | * with the policy. This function is typically called by | 477 | * with the policy. This function is typically called by |
@@ -481,9 +482,10 @@ static void avc_audit_post_callback(struct audit_buffer *ab, void *a) | |||
481 | * be performed under a lock, to allow the lock to be released | 482 | * be performed under a lock, to allow the lock to be released |
482 | * before calling the auditing code. | 483 | * before calling the auditing code. |
483 | */ | 484 | */ |
484 | void avc_audit(u32 ssid, u32 tsid, | 485 | int avc_audit(u32 ssid, u32 tsid, |
485 | u16 tclass, u32 requested, | 486 | u16 tclass, u32 requested, |
486 | struct av_decision *avd, int result, struct common_audit_data *a) | 487 | struct av_decision *avd, int result, struct common_audit_data *a, |
488 | unsigned flags) | ||
487 | { | 489 | { |
488 | struct common_audit_data stack_data; | 490 | struct common_audit_data stack_data; |
489 | u32 denied, audited; | 491 | u32 denied, audited; |
@@ -515,11 +517,24 @@ void avc_audit(u32 ssid, u32 tsid, | |||
515 | else | 517 | else |
516 | audited = requested & avd->auditallow; | 518 | audited = requested & avd->auditallow; |
517 | if (!audited) | 519 | if (!audited) |
518 | return; | 520 | return 0; |
521 | |||
519 | if (!a) { | 522 | if (!a) { |
520 | a = &stack_data; | 523 | a = &stack_data; |
521 | COMMON_AUDIT_DATA_INIT(a, NONE); | 524 | COMMON_AUDIT_DATA_INIT(a, NONE); |
522 | } | 525 | } |
526 | |||
527 | /* | ||
528 | * When in a RCU walk do the audit on the RCU retry. This is because | ||
529 | * the collection of the dname in an inode audit message is not RCU | ||
530 | * safe. Note this may drop some audits when the situation changes | ||
531 | * during retry. However this is logically just as if the operation | ||
532 | * happened a little later. | ||
533 | */ | ||
534 | if ((a->type == LSM_AUDIT_DATA_FS) && | ||
535 | (flags & IPERM_FLAG_RCU)) | ||
536 | return -ECHILD; | ||
537 | |||
523 | a->selinux_audit_data.tclass = tclass; | 538 | a->selinux_audit_data.tclass = tclass; |
524 | a->selinux_audit_data.requested = requested; | 539 | a->selinux_audit_data.requested = requested; |
525 | a->selinux_audit_data.ssid = ssid; | 540 | a->selinux_audit_data.ssid = ssid; |
@@ -529,6 +544,7 @@ void avc_audit(u32 ssid, u32 tsid, | |||
529 | a->lsm_pre_audit = avc_audit_pre_callback; | 544 | a->lsm_pre_audit = avc_audit_pre_callback; |
530 | a->lsm_post_audit = avc_audit_post_callback; | 545 | a->lsm_post_audit = avc_audit_post_callback; |
531 | common_lsm_audit(a); | 546 | common_lsm_audit(a); |
547 | return 0; | ||
532 | } | 548 | } |
533 | 549 | ||
534 | /** | 550 | /** |
@@ -793,6 +809,7 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, | |||
793 | * @tclass: target security class | 809 | * @tclass: target security class |
794 | * @requested: requested permissions, interpreted based on @tclass | 810 | * @requested: requested permissions, interpreted based on @tclass |
795 | * @auditdata: auxiliary audit data | 811 | * @auditdata: auxiliary audit data |
812 | * @flags: VFS walk flags | ||
796 | * | 813 | * |
797 | * Check the AVC to determine whether the @requested permissions are granted | 814 | * Check the AVC to determine whether the @requested permissions are granted |
798 | * for the SID pair (@ssid, @tsid), interpreting the permissions | 815 | * for the SID pair (@ssid, @tsid), interpreting the permissions |
@@ -802,14 +819,19 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, | |||
802 | * permissions are granted, -%EACCES if any permissions are denied, or | 819 | * permissions are granted, -%EACCES if any permissions are denied, or |
803 | * another -errno upon other errors. | 820 | * another -errno upon other errors. |
804 | */ | 821 | */ |
805 | int avc_has_perm(u32 ssid, u32 tsid, u16 tclass, | 822 | int avc_has_perm_flags(u32 ssid, u32 tsid, u16 tclass, |
806 | u32 requested, struct common_audit_data *auditdata) | 823 | u32 requested, struct common_audit_data *auditdata, |
824 | unsigned flags) | ||
807 | { | 825 | { |
808 | struct av_decision avd; | 826 | struct av_decision avd; |
809 | int rc; | 827 | int rc, rc2; |
810 | 828 | ||
811 | rc = avc_has_perm_noaudit(ssid, tsid, tclass, requested, 0, &avd); | 829 | rc = avc_has_perm_noaudit(ssid, tsid, tclass, requested, 0, &avd); |
812 | avc_audit(ssid, tsid, tclass, requested, &avd, rc, auditdata); | 830 | |
831 | rc2 = avc_audit(ssid, tsid, tclass, requested, &avd, rc, auditdata, | ||
832 | flags); | ||
833 | if (rc2) | ||
834 | return rc2; | ||
813 | return rc; | 835 | return rc; |
814 | } | 836 | } |
815 | 837 | ||
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index f9c3764e4859..f7cf0ea6faea 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1446,8 +1446,11 @@ static int task_has_capability(struct task_struct *tsk, | |||
1446 | } | 1446 | } |
1447 | 1447 | ||
1448 | rc = avc_has_perm_noaudit(sid, sid, sclass, av, 0, &avd); | 1448 | rc = avc_has_perm_noaudit(sid, sid, sclass, av, 0, &avd); |
1449 | if (audit == SECURITY_CAP_AUDIT) | 1449 | if (audit == SECURITY_CAP_AUDIT) { |
1450 | avc_audit(sid, sid, sclass, av, &avd, rc, &ad); | 1450 | int rc2 = avc_audit(sid, sid, sclass, av, &avd, rc, &ad, 0); |
1451 | if (rc2) | ||
1452 | return rc2; | ||
1453 | } | ||
1451 | return rc; | 1454 | return rc; |
1452 | } | 1455 | } |
1453 | 1456 | ||
@@ -1467,7 +1470,8 @@ static int task_has_system(struct task_struct *tsk, | |||
1467 | static int inode_has_perm(const struct cred *cred, | 1470 | static int inode_has_perm(const struct cred *cred, |
1468 | struct inode *inode, | 1471 | struct inode *inode, |
1469 | u32 perms, | 1472 | u32 perms, |
1470 | struct common_audit_data *adp) | 1473 | struct common_audit_data *adp, |
1474 | unsigned flags) | ||
1471 | { | 1475 | { |
1472 | struct inode_security_struct *isec; | 1476 | struct inode_security_struct *isec; |
1473 | struct common_audit_data ad; | 1477 | struct common_audit_data ad; |
@@ -1487,7 +1491,7 @@ static int inode_has_perm(const struct cred *cred, | |||
1487 | ad.u.fs.inode = inode; | 1491 | ad.u.fs.inode = inode; |
1488 | } | 1492 | } |
1489 | 1493 | ||
1490 | return avc_has_perm(sid, isec->sid, isec->sclass, perms, adp); | 1494 | return avc_has_perm_flags(sid, isec->sid, isec->sclass, perms, adp, flags); |
1491 | } | 1495 | } |
1492 | 1496 | ||
1493 | /* Same as inode_has_perm, but pass explicit audit data containing | 1497 | /* Same as inode_has_perm, but pass explicit audit data containing |
@@ -1504,7 +1508,7 @@ static inline int dentry_has_perm(const struct cred *cred, | |||
1504 | COMMON_AUDIT_DATA_INIT(&ad, FS); | 1508 | COMMON_AUDIT_DATA_INIT(&ad, FS); |
1505 | ad.u.fs.path.mnt = mnt; | 1509 | ad.u.fs.path.mnt = mnt; |
1506 | ad.u.fs.path.dentry = dentry; | 1510 | ad.u.fs.path.dentry = dentry; |
1507 | return inode_has_perm(cred, inode, av, &ad); | 1511 | return inode_has_perm(cred, inode, av, &ad, 0); |
1508 | } | 1512 | } |
1509 | 1513 | ||
1510 | /* Check whether a task can use an open file descriptor to | 1514 | /* Check whether a task can use an open file descriptor to |
@@ -1540,7 +1544,7 @@ static int file_has_perm(const struct cred *cred, | |||
1540 | /* av is zero if only checking access to the descriptor. */ | 1544 | /* av is zero if only checking access to the descriptor. */ |
1541 | rc = 0; | 1545 | rc = 0; |
1542 | if (av) | 1546 | if (av) |
1543 | rc = inode_has_perm(cred, inode, av, &ad); | 1547 | rc = inode_has_perm(cred, inode, av, &ad, 0); |
1544 | 1548 | ||
1545 | out: | 1549 | out: |
1546 | return rc; | 1550 | return rc; |
@@ -2103,7 +2107,7 @@ static inline void flush_unauthorized_files(const struct cred *cred, | |||
2103 | file = file_priv->file; | 2107 | file = file_priv->file; |
2104 | inode = file->f_path.dentry->d_inode; | 2108 | inode = file->f_path.dentry->d_inode; |
2105 | if (inode_has_perm(cred, inode, | 2109 | if (inode_has_perm(cred, inode, |
2106 | FILE__READ | FILE__WRITE, NULL)) { | 2110 | FILE__READ | FILE__WRITE, NULL, 0)) { |
2107 | drop_tty = 1; | 2111 | drop_tty = 1; |
2108 | } | 2112 | } |
2109 | } | 2113 | } |
@@ -2635,7 +2639,7 @@ static int selinux_inode_follow_link(struct dentry *dentry, struct nameidata *na | |||
2635 | return dentry_has_perm(cred, NULL, dentry, FILE__READ); | 2639 | return dentry_has_perm(cred, NULL, dentry, FILE__READ); |
2636 | } | 2640 | } |
2637 | 2641 | ||
2638 | static int selinux_inode_permission(struct inode *inode, int mask) | 2642 | static int selinux_inode_permission(struct inode *inode, int mask, unsigned flags) |
2639 | { | 2643 | { |
2640 | const struct cred *cred = current_cred(); | 2644 | const struct cred *cred = current_cred(); |
2641 | struct common_audit_data ad; | 2645 | struct common_audit_data ad; |
@@ -2657,7 +2661,7 @@ static int selinux_inode_permission(struct inode *inode, int mask) | |||
2657 | 2661 | ||
2658 | perms = file_mask_to_av(inode->i_mode, mask); | 2662 | perms = file_mask_to_av(inode->i_mode, mask); |
2659 | 2663 | ||
2660 | return inode_has_perm(cred, inode, perms, &ad); | 2664 | return inode_has_perm(cred, inode, perms, &ad, flags); |
2661 | } | 2665 | } |
2662 | 2666 | ||
2663 | static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr) | 2667 | static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr) |
@@ -3205,7 +3209,7 @@ static int selinux_dentry_open(struct file *file, const struct cred *cred) | |||
3205 | * new inode label or new policy. | 3209 | * new inode label or new policy. |
3206 | * This check is not redundant - do not remove. | 3210 | * This check is not redundant - do not remove. |
3207 | */ | 3211 | */ |
3208 | return inode_has_perm(cred, inode, open_file_to_av(file), NULL); | 3212 | return inode_has_perm(cred, inode, open_file_to_av(file), NULL, 0); |
3209 | } | 3213 | } |
3210 | 3214 | ||
3211 | /* task security operations */ | 3215 | /* task security operations */ |
diff --git a/security/selinux/include/avc.h b/security/selinux/include/avc.h index 5615081b73ec..e77b2ac2908b 100644 --- a/security/selinux/include/avc.h +++ b/security/selinux/include/avc.h | |||
@@ -54,11 +54,11 @@ struct avc_cache_stats { | |||
54 | 54 | ||
55 | void __init avc_init(void); | 55 | void __init avc_init(void); |
56 | 56 | ||
57 | void avc_audit(u32 ssid, u32 tsid, | 57 | int avc_audit(u32 ssid, u32 tsid, |
58 | u16 tclass, u32 requested, | 58 | u16 tclass, u32 requested, |
59 | struct av_decision *avd, | 59 | struct av_decision *avd, |
60 | int result, | 60 | int result, |
61 | struct common_audit_data *a); | 61 | struct common_audit_data *a, unsigned flags); |
62 | 62 | ||
63 | #define AVC_STRICT 1 /* Ignore permissive mode. */ | 63 | #define AVC_STRICT 1 /* Ignore permissive mode. */ |
64 | int avc_has_perm_noaudit(u32 ssid, u32 tsid, | 64 | int avc_has_perm_noaudit(u32 ssid, u32 tsid, |
@@ -66,9 +66,17 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, | |||
66 | unsigned flags, | 66 | unsigned flags, |
67 | struct av_decision *avd); | 67 | struct av_decision *avd); |
68 | 68 | ||
69 | int avc_has_perm(u32 ssid, u32 tsid, | 69 | int avc_has_perm_flags(u32 ssid, u32 tsid, |
70 | u16 tclass, u32 requested, | 70 | u16 tclass, u32 requested, |
71 | struct common_audit_data *auditdata); | 71 | struct common_audit_data *auditdata, |
72 | unsigned); | ||
73 | |||
74 | static inline int avc_has_perm(u32 ssid, u32 tsid, | ||
75 | u16 tclass, u32 requested, | ||
76 | struct common_audit_data *auditdata) | ||
77 | { | ||
78 | return avc_has_perm_flags(ssid, tsid, tclass, requested, auditdata, 0); | ||
79 | } | ||
72 | 80 | ||
73 | u32 avc_policy_seqno(void); | 81 | u32 avc_policy_seqno(void); |
74 | 82 | ||
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index c6f8fcadae07..400a5d5cde61 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -686,7 +686,7 @@ static int smack_inode_rename(struct inode *old_inode, | |||
686 | * | 686 | * |
687 | * Returns 0 if access is permitted, -EACCES otherwise | 687 | * Returns 0 if access is permitted, -EACCES otherwise |
688 | */ | 688 | */ |
689 | static int smack_inode_permission(struct inode *inode, int mask) | 689 | static int smack_inode_permission(struct inode *inode, int mask, unsigned flags) |
690 | { | 690 | { |
691 | struct smk_audit_info ad; | 691 | struct smk_audit_info ad; |
692 | 692 | ||
@@ -696,6 +696,10 @@ static int smack_inode_permission(struct inode *inode, int mask) | |||
696 | */ | 696 | */ |
697 | if (mask == 0) | 697 | if (mask == 0) |
698 | return 0; | 698 | return 0; |
699 | |||
700 | /* May be droppable after audit */ | ||
701 | if (flags & IPERM_FLAG_RCU) | ||
702 | return -ECHILD; | ||
699 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_FS); | 703 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_FS); |
700 | smk_ad_setfield_u_fs_inode(&ad, inode); | 704 | smk_ad_setfield_u_fs_inode(&ad, inode); |
701 | return smk_curacc(smk_of_inode(inode), mask, &ad); | 705 | return smk_curacc(smk_of_inode(inode), mask, &ad); |
diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c index 58804c7acfcf..fd2188c3df2b 100644 --- a/sound/aoa/codecs/tas.c +++ b/sound/aoa/codecs/tas.c | |||
@@ -170,7 +170,7 @@ static void tas_set_volume(struct tas *tas) | |||
170 | /* analysing the volume and mixer tables shows | 170 | /* analysing the volume and mixer tables shows |
171 | * that they are similar enough when we shift | 171 | * that they are similar enough when we shift |
172 | * the mixer table down by 4 bits. The error | 172 | * the mixer table down by 4 bits. The error |
173 | * is minuscule, in just one item the error | 173 | * is miniscule, in just one item the error |
174 | * is 1, at a value of 0x07f17b (mixer table | 174 | * is 1, at a value of 0x07f17b (mixer table |
175 | * value is 0x07f17a) */ | 175 | * value is 0x07f17a) */ |
176 | tmp = tas_gaintable[left]; | 176 | tmp = tas_gaintable[left]; |
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index 33f0ba5559a7..62e959120c44 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c | |||
@@ -44,10 +44,10 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_adb = { | |||
44 | .channels_min = 1, | 44 | .channels_min = 1, |
45 | .channels_max = 2, | 45 | .channels_max = 2, |
46 | .buffer_bytes_max = 0x10000, | 46 | .buffer_bytes_max = 0x10000, |
47 | .period_bytes_min = 0x1, | 47 | .period_bytes_min = 0x20, |
48 | .period_bytes_max = 0x1000, | 48 | .period_bytes_max = 0x1000, |
49 | .periods_min = 2, | 49 | .periods_min = 2, |
50 | .periods_max = 32, | 50 | .periods_max = 1024, |
51 | }; | 51 | }; |
52 | 52 | ||
53 | #ifndef CHIP_AU8820 | 53 | #ifndef CHIP_AU8820 |
@@ -140,6 +140,9 @@ static int snd_vortex_pcm_open(struct snd_pcm_substream *substream) | |||
140 | SNDRV_PCM_HW_PARAM_PERIOD_BYTES)) < 0) | 140 | SNDRV_PCM_HW_PARAM_PERIOD_BYTES)) < 0) |
141 | return err; | 141 | return err; |
142 | 142 | ||
143 | snd_pcm_hw_constraint_step(runtime, 0, | ||
144 | SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 64); | ||
145 | |||
143 | if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) { | 146 | if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) { |
144 | #ifndef CHIP_AU8820 | 147 | #ifndef CHIP_AU8820 |
145 | if (VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_A3D) { | 148 | if (VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_A3D) { |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 430f41db6044..759ade12e758 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -937,6 +937,7 @@ void snd_hda_shutup_pins(struct hda_codec *codec) | |||
937 | } | 937 | } |
938 | EXPORT_SYMBOL_HDA(snd_hda_shutup_pins); | 938 | EXPORT_SYMBOL_HDA(snd_hda_shutup_pins); |
939 | 939 | ||
940 | #ifdef SND_HDA_NEEDS_RESUME | ||
940 | /* Restore the pin controls cleared previously via snd_hda_shutup_pins() */ | 941 | /* Restore the pin controls cleared previously via snd_hda_shutup_pins() */ |
941 | static void restore_shutup_pins(struct hda_codec *codec) | 942 | static void restore_shutup_pins(struct hda_codec *codec) |
942 | { | 943 | { |
@@ -953,6 +954,7 @@ static void restore_shutup_pins(struct hda_codec *codec) | |||
953 | } | 954 | } |
954 | codec->pins_shutup = 0; | 955 | codec->pins_shutup = 0; |
955 | } | 956 | } |
957 | #endif | ||
956 | 958 | ||
957 | static void init_hda_cache(struct hda_cache_rec *cache, | 959 | static void init_hda_cache(struct hda_cache_rec *cache, |
958 | unsigned int record_size); | 960 | unsigned int record_size); |
@@ -1329,6 +1331,7 @@ static void purify_inactive_streams(struct hda_codec *codec) | |||
1329 | } | 1331 | } |
1330 | } | 1332 | } |
1331 | 1333 | ||
1334 | #ifdef SND_HDA_NEEDS_RESUME | ||
1332 | /* clean up all streams; called from suspend */ | 1335 | /* clean up all streams; called from suspend */ |
1333 | static void hda_cleanup_all_streams(struct hda_codec *codec) | 1336 | static void hda_cleanup_all_streams(struct hda_codec *codec) |
1334 | { | 1337 | { |
@@ -1340,6 +1343,7 @@ static void hda_cleanup_all_streams(struct hda_codec *codec) | |||
1340 | really_cleanup_stream(codec, p); | 1343 | really_cleanup_stream(codec, p); |
1341 | } | 1344 | } |
1342 | } | 1345 | } |
1346 | #endif | ||
1343 | 1347 | ||
1344 | /* | 1348 | /* |
1345 | * amp access functions | 1349 | * amp access functions |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 52928d9a72da..c82979a8cd09 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1704,11 +1704,11 @@ static void alc_apply_fixup(struct hda_codec *codec, int action) | |||
1704 | codec->chip_name, fix->type); | 1704 | codec->chip_name, fix->type); |
1705 | break; | 1705 | break; |
1706 | } | 1706 | } |
1707 | if (!fix[id].chained) | 1707 | if (!fix->chained) |
1708 | break; | 1708 | break; |
1709 | if (++depth > 10) | 1709 | if (++depth > 10) |
1710 | break; | 1710 | break; |
1711 | id = fix[id].chain_id; | 1711 | id = fix->chain_id; |
1712 | } | 1712 | } |
1713 | } | 1713 | } |
1714 | 1714 | ||
@@ -5645,6 +5645,7 @@ static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, | |||
5645 | static struct snd_pci_quirk beep_white_list[] = { | 5645 | static struct snd_pci_quirk beep_white_list[] = { |
5646 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), | 5646 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
5647 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), | 5647 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
5648 | SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1), | ||
5648 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), | 5649 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
5649 | {} | 5650 | {} |
5650 | }; | 5651 | }; |
@@ -9863,6 +9864,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = { | |||
9863 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | 9864 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
9864 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), | 9865 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
9865 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), | 9866 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
9867 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), | ||
9866 | 9868 | ||
9867 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), | 9869 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
9868 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), | 9870 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
@@ -10699,7 +10701,6 @@ enum { | |||
10699 | PINFIX_LENOVO_Y530, | 10701 | PINFIX_LENOVO_Y530, |
10700 | PINFIX_PB_M5210, | 10702 | PINFIX_PB_M5210, |
10701 | PINFIX_ACER_ASPIRE_7736, | 10703 | PINFIX_ACER_ASPIRE_7736, |
10702 | PINFIX_GIGABYTE_880GM, | ||
10703 | }; | 10704 | }; |
10704 | 10705 | ||
10705 | static const struct alc_fixup alc882_fixups[] = { | 10706 | static const struct alc_fixup alc882_fixups[] = { |
@@ -10731,13 +10732,6 @@ static const struct alc_fixup alc882_fixups[] = { | |||
10731 | .type = ALC_FIXUP_SKU, | 10732 | .type = ALC_FIXUP_SKU, |
10732 | .v.sku = ALC_FIXUP_SKU_IGNORE, | 10733 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
10733 | }, | 10734 | }, |
10734 | [PINFIX_GIGABYTE_880GM] = { | ||
10735 | .type = ALC_FIXUP_PINS, | ||
10736 | .v.pins = (const struct alc_pincfg[]) { | ||
10737 | { 0x14, 0x1114410 }, /* set as speaker */ | ||
10738 | { } | ||
10739 | } | ||
10740 | }, | ||
10741 | }; | 10735 | }; |
10742 | 10736 | ||
10743 | static struct snd_pci_quirk alc882_fixup_tbl[] = { | 10737 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
@@ -10745,7 +10739,6 @@ static struct snd_pci_quirk alc882_fixup_tbl[] = { | |||
10745 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), | 10739 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), |
10746 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | 10740 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
10747 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), | 10741 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
10748 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", PINFIX_GIGABYTE_880GM), | ||
10749 | {} | 10742 | {} |
10750 | }; | 10743 | }; |
10751 | 10744 | ||
@@ -14868,6 +14861,23 @@ static void alc269_fixup_hweq(struct hda_codec *codec, | |||
14868 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); | 14861 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
14869 | } | 14862 | } |
14870 | 14863 | ||
14864 | static void alc271_fixup_dmic(struct hda_codec *codec, | ||
14865 | const struct alc_fixup *fix, int action) | ||
14866 | { | ||
14867 | static struct hda_verb verbs[] = { | ||
14868 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, | ||
14869 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, | ||
14870 | {} | ||
14871 | }; | ||
14872 | unsigned int cfg; | ||
14873 | |||
14874 | if (strcmp(codec->chip_name, "ALC271X")) | ||
14875 | return; | ||
14876 | cfg = snd_hda_codec_get_pincfg(codec, 0x12); | ||
14877 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED) | ||
14878 | snd_hda_sequence_write(codec, verbs); | ||
14879 | } | ||
14880 | |||
14871 | enum { | 14881 | enum { |
14872 | ALC269_FIXUP_SONY_VAIO, | 14882 | ALC269_FIXUP_SONY_VAIO, |
14873 | ALC275_FIXUP_SONY_VAIO_GPIO2, | 14883 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
@@ -14876,6 +14886,7 @@ enum { | |||
14876 | ALC269_FIXUP_ASUS_G73JW, | 14886 | ALC269_FIXUP_ASUS_G73JW, |
14877 | ALC269_FIXUP_LENOVO_EAPD, | 14887 | ALC269_FIXUP_LENOVO_EAPD, |
14878 | ALC275_FIXUP_SONY_HWEQ, | 14888 | ALC275_FIXUP_SONY_HWEQ, |
14889 | ALC271_FIXUP_DMIC, | ||
14879 | }; | 14890 | }; |
14880 | 14891 | ||
14881 | static const struct alc_fixup alc269_fixups[] = { | 14892 | static const struct alc_fixup alc269_fixups[] = { |
@@ -14929,7 +14940,11 @@ static const struct alc_fixup alc269_fixups[] = { | |||
14929 | .v.func = alc269_fixup_hweq, | 14940 | .v.func = alc269_fixup_hweq, |
14930 | .chained = true, | 14941 | .chained = true, |
14931 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 | 14942 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
14932 | } | 14943 | }, |
14944 | [ALC271_FIXUP_DMIC] = { | ||
14945 | .type = ALC_FIXUP_FUNC, | ||
14946 | .v.func = alc271_fixup_dmic, | ||
14947 | }, | ||
14933 | }; | 14948 | }; |
14934 | 14949 | ||
14935 | static struct snd_pci_quirk alc269_fixup_tbl[] = { | 14950 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
@@ -14938,6 +14953,7 @@ static struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
14938 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), | 14953 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
14939 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | 14954 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
14940 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), | 14955 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
14956 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), | ||
14941 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), | 14957 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
14942 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), | 14958 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
14943 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), | 14959 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
@@ -18782,6 +18798,8 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = { | |||
18782 | ALC662_3ST_6ch_DIG), | 18798 | ALC662_3ST_6ch_DIG), |
18783 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), | 18799 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
18784 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), | 18800 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
18801 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", | ||
18802 | ALC662_3ST_6ch_DIG), | ||
18785 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), | 18803 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
18786 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), | 18804 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
18787 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), | 18805 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
@@ -19455,7 +19473,7 @@ enum { | |||
19455 | ALC662_FIXUP_IDEAPAD, | 19473 | ALC662_FIXUP_IDEAPAD, |
19456 | ALC272_FIXUP_MARIO, | 19474 | ALC272_FIXUP_MARIO, |
19457 | ALC662_FIXUP_CZC_P10T, | 19475 | ALC662_FIXUP_CZC_P10T, |
19458 | ALC662_FIXUP_GIGABYTE, | 19476 | ALC662_FIXUP_SKU_IGNORE, |
19459 | }; | 19477 | }; |
19460 | 19478 | ||
19461 | static const struct alc_fixup alc662_fixups[] = { | 19479 | static const struct alc_fixup alc662_fixups[] = { |
@@ -19484,20 +19502,17 @@ static const struct alc_fixup alc662_fixups[] = { | |||
19484 | {} | 19502 | {} |
19485 | } | 19503 | } |
19486 | }, | 19504 | }, |
19487 | [ALC662_FIXUP_GIGABYTE] = { | 19505 | [ALC662_FIXUP_SKU_IGNORE] = { |
19488 | .type = ALC_FIXUP_PINS, | 19506 | .type = ALC_FIXUP_SKU, |
19489 | .v.pins = (const struct alc_pincfg[]) { | 19507 | .v.sku = ALC_FIXUP_SKU_IGNORE, |
19490 | { 0x14, 0x1114410 }, /* set as speaker */ | ||
19491 | { } | ||
19492 | } | ||
19493 | }, | 19508 | }, |
19494 | }; | 19509 | }; |
19495 | 19510 | ||
19496 | static struct snd_pci_quirk alc662_fixup_tbl[] = { | 19511 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
19497 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), | 19512 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
19513 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), | ||
19498 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), | 19514 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
19499 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), | 19515 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
19500 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", ALC662_FIXUP_GIGABYTE), | ||
19501 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), | 19516 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
19502 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), | 19517 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
19503 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), | 19518 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 1371b57c11e8..0997031c48d2 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -1292,14 +1292,18 @@ static void notify_aa_path_ctls(struct hda_codec *codec) | |||
1292 | { | 1292 | { |
1293 | int i; | 1293 | int i; |
1294 | struct snd_ctl_elem_id id; | 1294 | struct snd_ctl_elem_id id; |
1295 | const char *labels[] = {"Mic", "Front Mic", "Line"}; | 1295 | const char *labels[] = {"Mic", "Front Mic", "Line", "Rear Mic"}; |
1296 | struct snd_kcontrol *ctl; | ||
1296 | 1297 | ||
1297 | memset(&id, 0, sizeof(id)); | 1298 | memset(&id, 0, sizeof(id)); |
1298 | id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; | 1299 | id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; |
1299 | for (i = 0; i < ARRAY_SIZE(labels); i++) { | 1300 | for (i = 0; i < ARRAY_SIZE(labels); i++) { |
1300 | sprintf(id.name, "%s Playback Volume", labels[i]); | 1301 | sprintf(id.name, "%s Playback Volume", labels[i]); |
1301 | snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE, | 1302 | ctl = snd_hda_find_mixer_ctl(codec, id.name); |
1302 | &id); | 1303 | if (ctl) |
1304 | snd_ctl_notify(codec->bus->card, | ||
1305 | SNDRV_CTL_EVENT_MASK_VALUE, | ||
1306 | &ctl->id); | ||
1303 | } | 1307 | } |
1304 | } | 1308 | } |
1305 | 1309 | ||
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index f7cd346fd727..f5ccdbf7ebc6 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c | |||
@@ -308,8 +308,6 @@ static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) | |||
308 | snd_soc_dapm_add_routes(dapm, jz4740_codec_dapm_routes, | 308 | snd_soc_dapm_add_routes(dapm, jz4740_codec_dapm_routes, |
309 | ARRAY_SIZE(jz4740_codec_dapm_routes)); | 309 | ARRAY_SIZE(jz4740_codec_dapm_routes)); |
310 | 310 | ||
311 | snd_soc_dapm_new_widgets(codec); | ||
312 | |||
313 | jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 311 | jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
314 | 312 | ||
315 | return 0; | 313 | return 0; |
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index a54d2a5b28f6..4d9fb279e146 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c | |||
@@ -927,7 +927,7 @@ static struct platform_driver sn95031_codec_driver = { | |||
927 | .owner = THIS_MODULE, | 927 | .owner = THIS_MODULE, |
928 | }, | 928 | }, |
929 | .probe = sn95031_device_probe, | 929 | .probe = sn95031_device_probe, |
930 | .remove = sn95031_device_remove, | 930 | .remove = __devexit_p(sn95031_device_remove), |
931 | }; | 931 | }; |
932 | 932 | ||
933 | static int __init sn95031_init(void) | 933 | static int __init sn95031_init(void) |
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index ae1cadfae84c..f52b623bb692 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -247,8 +247,6 @@ static int wm8903_volatile_register(struct snd_soc_codec *codec, unsigned int re | |||
247 | case WM8903_REVISION_NUMBER: | 247 | case WM8903_REVISION_NUMBER: |
248 | case WM8903_INTERRUPT_STATUS_1: | 248 | case WM8903_INTERRUPT_STATUS_1: |
249 | case WM8903_WRITE_SEQUENCER_4: | 249 | case WM8903_WRITE_SEQUENCER_4: |
250 | case WM8903_POWER_MANAGEMENT_3: | ||
251 | case WM8903_POWER_MANAGEMENT_2: | ||
252 | case WM8903_DC_SERVO_READBACK_1: | 250 | case WM8903_DC_SERVO_READBACK_1: |
253 | case WM8903_DC_SERVO_READBACK_2: | 251 | case WM8903_DC_SERVO_READBACK_2: |
254 | case WM8903_DC_SERVO_READBACK_3: | 252 | case WM8903_DC_SERVO_READBACK_3: |
@@ -875,34 +873,40 @@ SND_SOC_DAPM_MIXER("Left Speaker Mixer", WM8903_POWER_MANAGEMENT_4, 1, 0, | |||
875 | SND_SOC_DAPM_MIXER("Right Speaker Mixer", WM8903_POWER_MANAGEMENT_4, 0, 0, | 873 | SND_SOC_DAPM_MIXER("Right Speaker Mixer", WM8903_POWER_MANAGEMENT_4, 0, 0, |
876 | right_speaker_mixer, ARRAY_SIZE(right_speaker_mixer)), | 874 | right_speaker_mixer, ARRAY_SIZE(right_speaker_mixer)), |
877 | 875 | ||
878 | SND_SOC_DAPM_PGA_S("Left Headphone Output PGA", 0, WM8903_ANALOGUE_HP_0, | 876 | SND_SOC_DAPM_PGA_S("Left Headphone Output PGA", 0, WM8903_POWER_MANAGEMENT_2, |
879 | 4, 0, NULL, 0), | 877 | 1, 0, NULL, 0), |
880 | SND_SOC_DAPM_PGA_S("Right Headphone Output PGA", 0, WM8903_ANALOGUE_HP_0, | 878 | SND_SOC_DAPM_PGA_S("Right Headphone Output PGA", 0, WM8903_POWER_MANAGEMENT_2, |
881 | 0, 0, NULL, 0), | 879 | 0, 0, NULL, 0), |
882 | 880 | ||
883 | SND_SOC_DAPM_PGA_S("Left Line Output PGA", 0, WM8903_ANALOGUE_LINEOUT_0, 4, 0, | 881 | SND_SOC_DAPM_PGA_S("Left Line Output PGA", 0, WM8903_POWER_MANAGEMENT_3, 1, 0, |
884 | NULL, 0), | 882 | NULL, 0), |
885 | SND_SOC_DAPM_PGA_S("Right Line Output PGA", 0, WM8903_ANALOGUE_LINEOUT_0, 0, 0, | 883 | SND_SOC_DAPM_PGA_S("Right Line Output PGA", 0, WM8903_POWER_MANAGEMENT_3, 0, 0, |
886 | NULL, 0), | 884 | NULL, 0), |
887 | 885 | ||
888 | SND_SOC_DAPM_PGA_S("HPL_RMV_SHORT", 4, WM8903_ANALOGUE_HP_0, 7, 0, NULL, 0), | 886 | SND_SOC_DAPM_PGA_S("HPL_RMV_SHORT", 4, WM8903_ANALOGUE_HP_0, 7, 0, NULL, 0), |
889 | SND_SOC_DAPM_PGA_S("HPL_ENA_OUTP", 3, WM8903_ANALOGUE_HP_0, 6, 0, NULL, 0), | 887 | SND_SOC_DAPM_PGA_S("HPL_ENA_OUTP", 3, WM8903_ANALOGUE_HP_0, 6, 0, NULL, 0), |
890 | SND_SOC_DAPM_PGA_S("HPL_ENA_DLY", 1, WM8903_ANALOGUE_HP_0, 5, 0, NULL, 0), | 888 | SND_SOC_DAPM_PGA_S("HPL_ENA_DLY", 2, WM8903_ANALOGUE_HP_0, 5, 0, NULL, 0), |
889 | SND_SOC_DAPM_PGA_S("HPL_ENA", 1, WM8903_ANALOGUE_HP_0, 4, 0, NULL, 0), | ||
891 | SND_SOC_DAPM_PGA_S("HPR_RMV_SHORT", 4, WM8903_ANALOGUE_HP_0, 3, 0, NULL, 0), | 890 | SND_SOC_DAPM_PGA_S("HPR_RMV_SHORT", 4, WM8903_ANALOGUE_HP_0, 3, 0, NULL, 0), |
892 | SND_SOC_DAPM_PGA_S("HPR_ENA_OUTP", 3, WM8903_ANALOGUE_HP_0, 2, 0, NULL, 0), | 891 | SND_SOC_DAPM_PGA_S("HPR_ENA_OUTP", 3, WM8903_ANALOGUE_HP_0, 2, 0, NULL, 0), |
893 | SND_SOC_DAPM_PGA_S("HPR_ENA_DLY", 1, WM8903_ANALOGUE_HP_0, 1, 0, NULL, 0), | 892 | SND_SOC_DAPM_PGA_S("HPR_ENA_DLY", 2, WM8903_ANALOGUE_HP_0, 1, 0, NULL, 0), |
893 | SND_SOC_DAPM_PGA_S("HPR_ENA", 1, WM8903_ANALOGUE_HP_0, 0, 0, NULL, 0), | ||
894 | 894 | ||
895 | SND_SOC_DAPM_PGA_S("LINEOUTL_RMV_SHORT", 4, WM8903_ANALOGUE_LINEOUT_0, 7, 0, | 895 | SND_SOC_DAPM_PGA_S("LINEOUTL_RMV_SHORT", 4, WM8903_ANALOGUE_LINEOUT_0, 7, 0, |
896 | NULL, 0), | 896 | NULL, 0), |
897 | SND_SOC_DAPM_PGA_S("LINEOUTL_ENA_OUTP", 3, WM8903_ANALOGUE_LINEOUT_0, 6, 0, | 897 | SND_SOC_DAPM_PGA_S("LINEOUTL_ENA_OUTP", 3, WM8903_ANALOGUE_LINEOUT_0, 6, 0, |
898 | NULL, 0), | 898 | NULL, 0), |
899 | SND_SOC_DAPM_PGA_S("LINEOUTL_ENA_DLY", 1, WM8903_ANALOGUE_LINEOUT_0, 5, 0, | 899 | SND_SOC_DAPM_PGA_S("LINEOUTL_ENA_DLY", 2, WM8903_ANALOGUE_LINEOUT_0, 5, 0, |
900 | NULL, 0), | ||
901 | SND_SOC_DAPM_PGA_S("LINEOUTL_ENA", 1, WM8903_ANALOGUE_LINEOUT_0, 4, 0, | ||
900 | NULL, 0), | 902 | NULL, 0), |
901 | SND_SOC_DAPM_PGA_S("LINEOUTR_RMV_SHORT", 4, WM8903_ANALOGUE_LINEOUT_0, 3, 0, | 903 | SND_SOC_DAPM_PGA_S("LINEOUTR_RMV_SHORT", 4, WM8903_ANALOGUE_LINEOUT_0, 3, 0, |
902 | NULL, 0), | 904 | NULL, 0), |
903 | SND_SOC_DAPM_PGA_S("LINEOUTR_ENA_OUTP", 3, WM8903_ANALOGUE_LINEOUT_0, 2, 0, | 905 | SND_SOC_DAPM_PGA_S("LINEOUTR_ENA_OUTP", 3, WM8903_ANALOGUE_LINEOUT_0, 2, 0, |
904 | NULL, 0), | 906 | NULL, 0), |
905 | SND_SOC_DAPM_PGA_S("LINEOUTR_ENA_DLY", 1, WM8903_ANALOGUE_LINEOUT_0, 1, 0, | 907 | SND_SOC_DAPM_PGA_S("LINEOUTR_ENA_DLY", 2, WM8903_ANALOGUE_LINEOUT_0, 1, 0, |
908 | NULL, 0), | ||
909 | SND_SOC_DAPM_PGA_S("LINEOUTR_ENA", 1, WM8903_ANALOGUE_LINEOUT_0, 0, 0, | ||
906 | NULL, 0), | 910 | NULL, 0), |
907 | 911 | ||
908 | SND_SOC_DAPM_SUPPLY("DCS Master", WM8903_DC_SERVO_0, 4, 0, NULL, 0), | 912 | SND_SOC_DAPM_SUPPLY("DCS Master", WM8903_DC_SERVO_0, 4, 0, NULL, 0), |
@@ -1037,10 +1041,14 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
1037 | { "Left Speaker PGA", NULL, "Left Speaker Mixer" }, | 1041 | { "Left Speaker PGA", NULL, "Left Speaker Mixer" }, |
1038 | { "Right Speaker PGA", NULL, "Right Speaker Mixer" }, | 1042 | { "Right Speaker PGA", NULL, "Right Speaker Mixer" }, |
1039 | 1043 | ||
1040 | { "HPL_ENA_DLY", NULL, "Left Headphone Output PGA" }, | 1044 | { "HPL_ENA", NULL, "Left Headphone Output PGA" }, |
1041 | { "HPR_ENA_DLY", NULL, "Right Headphone Output PGA" }, | 1045 | { "HPR_ENA", NULL, "Right Headphone Output PGA" }, |
1042 | { "LINEOUTL_ENA_DLY", NULL, "Left Line Output PGA" }, | 1046 | { "HPL_ENA_DLY", NULL, "HPL_ENA" }, |
1043 | { "LINEOUTR_ENA_DLY", NULL, "Right Line Output PGA" }, | 1047 | { "HPR_ENA_DLY", NULL, "HPR_ENA" }, |
1048 | { "LINEOUTL_ENA", NULL, "Left Line Output PGA" }, | ||
1049 | { "LINEOUTR_ENA", NULL, "Right Line Output PGA" }, | ||
1050 | { "LINEOUTL_ENA_DLY", NULL, "LINEOUTL_ENA" }, | ||
1051 | { "LINEOUTR_ENA_DLY", NULL, "LINEOUTR_ENA" }, | ||
1044 | 1052 | ||
1045 | { "HPL_DCS", NULL, "DCS Master" }, | 1053 | { "HPL_DCS", NULL, "DCS Master" }, |
1046 | { "HPR_DCS", NULL, "DCS Master" }, | 1054 | { "HPR_DCS", NULL, "DCS Master" }, |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 3290333b2bb9..84e1bd1d2822 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -3261,20 +3261,36 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3261 | wm8994_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 3261 | wm8994_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
3262 | 3262 | ||
3263 | /* Latch volume updates (right only; we always do left then right). */ | 3263 | /* Latch volume updates (right only; we always do left then right). */ |
3264 | snd_soc_update_bits(codec, WM8994_AIF1_DAC1_LEFT_VOLUME, | ||
3265 | WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU); | ||
3264 | snd_soc_update_bits(codec, WM8994_AIF1_DAC1_RIGHT_VOLUME, | 3266 | snd_soc_update_bits(codec, WM8994_AIF1_DAC1_RIGHT_VOLUME, |
3265 | WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU); | 3267 | WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU); |
3268 | snd_soc_update_bits(codec, WM8994_AIF1_DAC2_LEFT_VOLUME, | ||
3269 | WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU); | ||
3266 | snd_soc_update_bits(codec, WM8994_AIF1_DAC2_RIGHT_VOLUME, | 3270 | snd_soc_update_bits(codec, WM8994_AIF1_DAC2_RIGHT_VOLUME, |
3267 | WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU); | 3271 | WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU); |
3272 | snd_soc_update_bits(codec, WM8994_AIF2_DAC_LEFT_VOLUME, | ||
3273 | WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU); | ||
3268 | snd_soc_update_bits(codec, WM8994_AIF2_DAC_RIGHT_VOLUME, | 3274 | snd_soc_update_bits(codec, WM8994_AIF2_DAC_RIGHT_VOLUME, |
3269 | WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU); | 3275 | WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU); |
3276 | snd_soc_update_bits(codec, WM8994_AIF1_ADC1_LEFT_VOLUME, | ||
3277 | WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU); | ||
3270 | snd_soc_update_bits(codec, WM8994_AIF1_ADC1_RIGHT_VOLUME, | 3278 | snd_soc_update_bits(codec, WM8994_AIF1_ADC1_RIGHT_VOLUME, |
3271 | WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU); | 3279 | WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU); |
3280 | snd_soc_update_bits(codec, WM8994_AIF1_ADC2_LEFT_VOLUME, | ||
3281 | WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU); | ||
3272 | snd_soc_update_bits(codec, WM8994_AIF1_ADC2_RIGHT_VOLUME, | 3282 | snd_soc_update_bits(codec, WM8994_AIF1_ADC2_RIGHT_VOLUME, |
3273 | WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU); | 3283 | WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU); |
3284 | snd_soc_update_bits(codec, WM8994_AIF2_ADC_LEFT_VOLUME, | ||
3285 | WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU); | ||
3274 | snd_soc_update_bits(codec, WM8994_AIF2_ADC_RIGHT_VOLUME, | 3286 | snd_soc_update_bits(codec, WM8994_AIF2_ADC_RIGHT_VOLUME, |
3275 | WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU); | 3287 | WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU); |
3288 | snd_soc_update_bits(codec, WM8994_DAC1_LEFT_VOLUME, | ||
3289 | WM8994_DAC1_VU, WM8994_DAC1_VU); | ||
3276 | snd_soc_update_bits(codec, WM8994_DAC1_RIGHT_VOLUME, | 3290 | snd_soc_update_bits(codec, WM8994_DAC1_RIGHT_VOLUME, |
3277 | WM8994_DAC1_VU, WM8994_DAC1_VU); | 3291 | WM8994_DAC1_VU, WM8994_DAC1_VU); |
3292 | snd_soc_update_bits(codec, WM8994_DAC2_LEFT_VOLUME, | ||
3293 | WM8994_DAC2_VU, WM8994_DAC2_VU); | ||
3278 | snd_soc_update_bits(codec, WM8994_DAC2_RIGHT_VOLUME, | 3294 | snd_soc_update_bits(codec, WM8994_DAC2_RIGHT_VOLUME, |
3279 | WM8994_DAC2_VU, WM8994_DAC2_VU); | 3295 | WM8994_DAC2_VU, WM8994_DAC2_VU); |
3280 | 3296 | ||
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 7b6b3c18e299..4005e9af5d61 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -740,12 +740,12 @@ static const struct snd_soc_dapm_route analogue_routes[] = { | |||
740 | 740 | ||
741 | { "SPKL", "Input Switch", "MIXINL" }, | 741 | { "SPKL", "Input Switch", "MIXINL" }, |
742 | { "SPKL", "IN1LP Switch", "IN1LP" }, | 742 | { "SPKL", "IN1LP Switch", "IN1LP" }, |
743 | { "SPKL", "Output Switch", "Left Output Mixer" }, | 743 | { "SPKL", "Output Switch", "Left Output PGA" }, |
744 | { "SPKL", NULL, "TOCLK" }, | 744 | { "SPKL", NULL, "TOCLK" }, |
745 | 745 | ||
746 | { "SPKR", "Input Switch", "MIXINR" }, | 746 | { "SPKR", "Input Switch", "MIXINR" }, |
747 | { "SPKR", "IN1RP Switch", "IN1RP" }, | 747 | { "SPKR", "IN1RP Switch", "IN1RP" }, |
748 | { "SPKR", "Output Switch", "Right Output Mixer" }, | 748 | { "SPKR", "Output Switch", "Right Output PGA" }, |
749 | { "SPKR", NULL, "TOCLK" }, | 749 | { "SPKR", NULL, "TOCLK" }, |
750 | 750 | ||
751 | { "SPKL Boost", "Direct Voice Switch", "Direct Voice" }, | 751 | { "SPKL Boost", "Direct Voice Switch", "Direct Voice" }, |
@@ -767,8 +767,8 @@ static const struct snd_soc_dapm_route analogue_routes[] = { | |||
767 | { "SPKOUTRP", NULL, "SPKR Driver" }, | 767 | { "SPKOUTRP", NULL, "SPKR Driver" }, |
768 | { "SPKOUTRN", NULL, "SPKR Driver" }, | 768 | { "SPKOUTRN", NULL, "SPKR Driver" }, |
769 | 769 | ||
770 | { "Left Headphone Mux", "Mixer", "Left Output Mixer" }, | 770 | { "Left Headphone Mux", "Mixer", "Left Output PGA" }, |
771 | { "Right Headphone Mux", "Mixer", "Right Output Mixer" }, | 771 | { "Right Headphone Mux", "Mixer", "Right Output PGA" }, |
772 | 772 | ||
773 | { "Headphone PGA", NULL, "Left Headphone Mux" }, | 773 | { "Headphone PGA", NULL, "Left Headphone Mux" }, |
774 | { "Headphone PGA", NULL, "Right Headphone Mux" }, | 774 | { "Headphone PGA", NULL, "Right Headphone Mux" }, |
diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c index b2e9198a983a..d567c322a2fb 100644 --- a/sound/soc/mid-x86/sst_platform.c +++ b/sound/soc/mid-x86/sst_platform.c | |||
@@ -116,18 +116,20 @@ struct snd_soc_dai_driver sst_platform_dai[] = { | |||
116 | static inline void sst_set_stream_status(struct sst_runtime_stream *stream, | 116 | static inline void sst_set_stream_status(struct sst_runtime_stream *stream, |
117 | int state) | 117 | int state) |
118 | { | 118 | { |
119 | spin_lock(&stream->status_lock); | 119 | unsigned long flags; |
120 | spin_lock_irqsave(&stream->status_lock, flags); | ||
120 | stream->stream_status = state; | 121 | stream->stream_status = state; |
121 | spin_unlock(&stream->status_lock); | 122 | spin_unlock_irqrestore(&stream->status_lock, flags); |
122 | } | 123 | } |
123 | 124 | ||
124 | static inline int sst_get_stream_status(struct sst_runtime_stream *stream) | 125 | static inline int sst_get_stream_status(struct sst_runtime_stream *stream) |
125 | { | 126 | { |
126 | int state; | 127 | int state; |
128 | unsigned long flags; | ||
127 | 129 | ||
128 | spin_lock(&stream->status_lock); | 130 | spin_lock_irqsave(&stream->status_lock, flags); |
129 | state = stream->stream_status; | 131 | state = stream->stream_status; |
130 | spin_unlock(&stream->status_lock); | 132 | spin_unlock_irqrestore(&stream->status_lock, flags); |
131 | return state; | 133 | return state; |
132 | } | 134 | } |
133 | 135 | ||
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c index 38aac7d57a59..9c7e8b48aed6 100644 --- a/sound/soc/samsung/pcm.c +++ b/sound/soc/samsung/pcm.c | |||
@@ -350,8 +350,8 @@ static int s3c_pcm_set_fmt(struct snd_soc_dai *cpu_dai, | |||
350 | ctl = readl(regs + S3C_PCM_CTL); | 350 | ctl = readl(regs + S3C_PCM_CTL); |
351 | 351 | ||
352 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | 352 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
353 | case SND_SOC_DAIFMT_NB_NF: | 353 | case SND_SOC_DAIFMT_IB_NF: |
354 | /* Nothing to do, NB_NF by default */ | 354 | /* Nothing to do, IB_NF by default */ |
355 | break; | 355 | break; |
356 | default: | 356 | default: |
357 | dev_err(pcm->dev, "Unsupported clock inversion!\n"); | 357 | dev_err(pcm->dev, "Unsupported clock inversion!\n"); |
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 0c9997e2d8c0..23c0e83d4c19 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -1200,10 +1200,11 @@ static int fsi_probe(struct platform_device *pdev) | |||
1200 | master->fsib.master = master; | 1200 | master->fsib.master = master; |
1201 | 1201 | ||
1202 | pm_runtime_enable(&pdev->dev); | 1202 | pm_runtime_enable(&pdev->dev); |
1203 | pm_runtime_resume(&pdev->dev); | ||
1204 | dev_set_drvdata(&pdev->dev, master); | 1203 | dev_set_drvdata(&pdev->dev, master); |
1205 | 1204 | ||
1205 | pm_runtime_get_sync(&pdev->dev); | ||
1206 | fsi_soft_all_reset(master); | 1206 | fsi_soft_all_reset(master); |
1207 | pm_runtime_put_sync(&pdev->dev); | ||
1207 | 1208 | ||
1208 | ret = request_irq(irq, &fsi_interrupt, IRQF_DISABLED, | 1209 | ret = request_irq(irq, &fsi_interrupt, IRQF_DISABLED, |
1209 | id_entry->name, master); | 1210 | id_entry->name, master); |
@@ -1218,8 +1219,17 @@ static int fsi_probe(struct platform_device *pdev) | |||
1218 | goto exit_free_irq; | 1219 | goto exit_free_irq; |
1219 | } | 1220 | } |
1220 | 1221 | ||
1221 | return snd_soc_register_dais(&pdev->dev, fsi_soc_dai, ARRAY_SIZE(fsi_soc_dai)); | 1222 | ret = snd_soc_register_dais(&pdev->dev, fsi_soc_dai, |
1223 | ARRAY_SIZE(fsi_soc_dai)); | ||
1224 | if (ret < 0) { | ||
1225 | dev_err(&pdev->dev, "cannot snd dai register\n"); | ||
1226 | goto exit_snd_soc; | ||
1227 | } | ||
1228 | |||
1229 | return ret; | ||
1222 | 1230 | ||
1231 | exit_snd_soc: | ||
1232 | snd_soc_unregister_platform(&pdev->dev); | ||
1223 | exit_free_irq: | 1233 | exit_free_irq: |
1224 | free_irq(irq, master); | 1234 | free_irq(irq, master); |
1225 | exit_iounmap: | 1235 | exit_iounmap: |
@@ -1238,12 +1248,11 @@ static int fsi_remove(struct platform_device *pdev) | |||
1238 | 1248 | ||
1239 | master = dev_get_drvdata(&pdev->dev); | 1249 | master = dev_get_drvdata(&pdev->dev); |
1240 | 1250 | ||
1241 | snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(fsi_soc_dai)); | 1251 | free_irq(master->irq, master); |
1242 | snd_soc_unregister_platform(&pdev->dev); | ||
1243 | |||
1244 | pm_runtime_disable(&pdev->dev); | 1252 | pm_runtime_disable(&pdev->dev); |
1245 | 1253 | ||
1246 | free_irq(master->irq, master); | 1254 | snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(fsi_soc_dai)); |
1255 | snd_soc_unregister_platform(&pdev->dev); | ||
1247 | 1256 | ||
1248 | iounmap(master->base); | 1257 | iounmap(master->base); |
1249 | kfree(master); | 1258 | kfree(master); |
@@ -1321,3 +1330,4 @@ module_exit(fsi_mobile_exit); | |||
1321 | MODULE_LICENSE("GPL"); | 1330 | MODULE_LICENSE("GPL"); |
1322 | MODULE_DESCRIPTION("SuperH onchip FSI audio driver"); | 1331 | MODULE_DESCRIPTION("SuperH onchip FSI audio driver"); |
1323 | MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); | 1332 | MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); |
1333 | MODULE_ALIAS("platform:fsi-pcm-audio"); | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b76b74db0968..d8562ce4de7a 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -629,6 +629,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
629 | runtime->hw.rates |= codec_dai_drv->capture.rates; | 629 | runtime->hw.rates |= codec_dai_drv->capture.rates; |
630 | } | 630 | } |
631 | 631 | ||
632 | ret = -EINVAL; | ||
632 | snd_pcm_limit_hw_rates(runtime); | 633 | snd_pcm_limit_hw_rates(runtime); |
633 | if (!runtime->hw.rates) { | 634 | if (!runtime->hw.rates) { |
634 | printk(KERN_ERR "asoc: %s <-> %s No matching rates\n", | 635 | printk(KERN_ERR "asoc: %s <-> %s No matching rates\n", |
@@ -640,7 +641,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
640 | codec_dai->name, cpu_dai->name); | 641 | codec_dai->name, cpu_dai->name); |
641 | goto config_err; | 642 | goto config_err; |
642 | } | 643 | } |
643 | if (!runtime->hw.channels_min || !runtime->hw.channels_max) { | 644 | if (!runtime->hw.channels_min || !runtime->hw.channels_max || |
645 | runtime->hw.channels_min > runtime->hw.channels_max) { | ||
644 | printk(KERN_ERR "asoc: %s <-> %s No matching channels\n", | 646 | printk(KERN_ERR "asoc: %s <-> %s No matching channels\n", |
645 | codec_dai->name, cpu_dai->name); | 647 | codec_dai->name, cpu_dai->name); |
646 | goto config_err; | 648 | goto config_err; |
@@ -2060,6 +2062,7 @@ const struct dev_pm_ops snd_soc_pm_ops = { | |||
2060 | .resume = snd_soc_resume, | 2062 | .resume = snd_soc_resume, |
2061 | .poweroff = snd_soc_poweroff, | 2063 | .poweroff = snd_soc_poweroff, |
2062 | }; | 2064 | }; |
2065 | EXPORT_SYMBOL_GPL(snd_soc_pm_ops); | ||
2063 | 2066 | ||
2064 | /* ASoC platform driver */ | 2067 | /* ASoC platform driver */ |
2065 | static struct platform_driver soc_driver = { | 2068 | static struct platform_driver soc_driver = { |
diff --git a/sound/soc/tegra/harmony.c b/sound/soc/tegra/harmony.c index 8585957477eb..556a57133925 100644 --- a/sound/soc/tegra/harmony.c +++ b/sound/soc/tegra/harmony.c | |||
@@ -370,6 +370,7 @@ static struct platform_driver tegra_snd_harmony_driver = { | |||
370 | .driver = { | 370 | .driver = { |
371 | .name = DRV_NAME, | 371 | .name = DRV_NAME, |
372 | .owner = THIS_MODULE, | 372 | .owner = THIS_MODULE, |
373 | .pm = &snd_soc_pm_ops, | ||
373 | }, | 374 | }, |
374 | .probe = tegra_snd_harmony_probe, | 375 | .probe = tegra_snd_harmony_probe, |
375 | .remove = __devexit_p(tegra_snd_harmony_remove), | 376 | .remove = __devexit_p(tegra_snd_harmony_remove), |
diff --git a/sound/usb/format.c b/sound/usb/format.c index 5b792d2c8061..f079b5e2ab28 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c | |||
@@ -176,9 +176,11 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof | |||
176 | if (!rate) | 176 | if (!rate) |
177 | continue; | 177 | continue; |
178 | /* C-Media CM6501 mislabels its 96 kHz altsetting */ | 178 | /* C-Media CM6501 mislabels its 96 kHz altsetting */ |
179 | /* Terratec Aureon 7.1 USB C-Media 6206, too */ | ||
179 | if (rate == 48000 && nr_rates == 1 && | 180 | if (rate == 48000 && nr_rates == 1 && |
180 | (chip->usb_id == USB_ID(0x0d8c, 0x0201) || | 181 | (chip->usb_id == USB_ID(0x0d8c, 0x0201) || |
181 | chip->usb_id == USB_ID(0x0d8c, 0x0102)) && | 182 | chip->usb_id == USB_ID(0x0d8c, 0x0102) || |
183 | chip->usb_id == USB_ID(0x0ccd, 0x00b1)) && | ||
182 | fp->altsetting == 5 && fp->maxpacksize == 392) | 184 | fp->altsetting == 5 && fp->maxpacksize == 392) |
183 | rate = 96000; | 185 | rate = 96000; |
184 | /* Creative VF0470 Live Cam reports 16 kHz instead of 8kHz */ | 186 | /* Creative VF0470 Live Cam reports 16 kHz instead of 8kHz */ |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index ec07e62e53f3..1b94ec3a3368 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -533,6 +533,7 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev, | |||
533 | 533 | ||
534 | case USB_ID(0x0d8c, 0x0102): | 534 | case USB_ID(0x0d8c, 0x0102): |
535 | /* C-Media CM6206 / CM106-Like Sound Device */ | 535 | /* C-Media CM6206 / CM106-Like Sound Device */ |
536 | case USB_ID(0x0ccd, 0x00b1): /* Terratec Aureon 7.1 USB */ | ||
536 | return snd_usb_cm6206_boot_quirk(dev); | 537 | return snd_usb_cm6206_boot_quirk(dev); |
537 | 538 | ||
538 | case USB_ID(0x133e, 0x0815): | 539 | case USB_ID(0x133e, 0x0815): |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 17d1dcb3c667..416538248a4b 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -163,6 +163,7 @@ static void config_attr(struct perf_evsel *evsel, struct perf_evlist *evlist) | |||
163 | struct perf_event_attr *attr = &evsel->attr; | 163 | struct perf_event_attr *attr = &evsel->attr; |
164 | int track = !evsel->idx; /* only the first counter needs these */ | 164 | int track = !evsel->idx; /* only the first counter needs these */ |
165 | 165 | ||
166 | attr->inherit = !no_inherit; | ||
166 | attr->read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | | 167 | attr->read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | |
167 | PERF_FORMAT_TOTAL_TIME_RUNNING | | 168 | PERF_FORMAT_TOTAL_TIME_RUNNING | |
168 | PERF_FORMAT_ID; | 169 | PERF_FORMAT_ID; |
@@ -251,6 +252,9 @@ static void open_counters(struct perf_evlist *evlist) | |||
251 | { | 252 | { |
252 | struct perf_evsel *pos; | 253 | struct perf_evsel *pos; |
253 | 254 | ||
255 | if (evlist->cpus->map[0] < 0) | ||
256 | no_inherit = true; | ||
257 | |||
254 | list_for_each_entry(pos, &evlist->entries, node) { | 258 | list_for_each_entry(pos, &evlist->entries, node) { |
255 | struct perf_event_attr *attr = &pos->attr; | 259 | struct perf_event_attr *attr = &pos->attr; |
256 | /* | 260 | /* |
@@ -271,8 +275,7 @@ static void open_counters(struct perf_evlist *evlist) | |||
271 | retry_sample_id: | 275 | retry_sample_id: |
272 | attr->sample_id_all = sample_id_all_avail ? 1 : 0; | 276 | attr->sample_id_all = sample_id_all_avail ? 1 : 0; |
273 | try_again: | 277 | try_again: |
274 | if (perf_evsel__open(pos, evlist->cpus, evlist->threads, group, | 278 | if (perf_evsel__open(pos, evlist->cpus, evlist->threads, group) < 0) { |
275 | !no_inherit) < 0) { | ||
276 | int err = errno; | 279 | int err = errno; |
277 | 280 | ||
278 | if (err == EPERM || err == EACCES) { | 281 | if (err == EPERM || err == EACCES) { |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index e2109f9b43eb..03f0e45f1479 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -167,16 +167,17 @@ static int create_perf_stat_counter(struct perf_evsel *evsel) | |||
167 | attr->read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | | 167 | attr->read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | |
168 | PERF_FORMAT_TOTAL_TIME_RUNNING; | 168 | PERF_FORMAT_TOTAL_TIME_RUNNING; |
169 | 169 | ||
170 | attr->inherit = !no_inherit; | ||
171 | |||
170 | if (system_wide) | 172 | if (system_wide) |
171 | return perf_evsel__open_per_cpu(evsel, evsel_list->cpus, false, false); | 173 | return perf_evsel__open_per_cpu(evsel, evsel_list->cpus, false); |
172 | 174 | ||
173 | attr->inherit = !no_inherit; | ||
174 | if (target_pid == -1 && target_tid == -1) { | 175 | if (target_pid == -1 && target_tid == -1) { |
175 | attr->disabled = 1; | 176 | attr->disabled = 1; |
176 | attr->enable_on_exec = 1; | 177 | attr->enable_on_exec = 1; |
177 | } | 178 | } |
178 | 179 | ||
179 | return perf_evsel__open_per_thread(evsel, evsel_list->threads, false, false); | 180 | return perf_evsel__open_per_thread(evsel, evsel_list->threads, false); |
180 | } | 181 | } |
181 | 182 | ||
182 | /* | 183 | /* |
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c index 1b2106c58f66..11e3c8458362 100644 --- a/tools/perf/builtin-test.c +++ b/tools/perf/builtin-test.c | |||
@@ -290,7 +290,7 @@ static int test__open_syscall_event(void) | |||
290 | goto out_thread_map_delete; | 290 | goto out_thread_map_delete; |
291 | } | 291 | } |
292 | 292 | ||
293 | if (perf_evsel__open_per_thread(evsel, threads, false, false) < 0) { | 293 | if (perf_evsel__open_per_thread(evsel, threads, false) < 0) { |
294 | pr_debug("failed to open counter: %s, " | 294 | pr_debug("failed to open counter: %s, " |
295 | "tweak /proc/sys/kernel/perf_event_paranoid?\n", | 295 | "tweak /proc/sys/kernel/perf_event_paranoid?\n", |
296 | strerror(errno)); | 296 | strerror(errno)); |
@@ -303,7 +303,7 @@ static int test__open_syscall_event(void) | |||
303 | } | 303 | } |
304 | 304 | ||
305 | if (perf_evsel__read_on_cpu(evsel, 0, 0) < 0) { | 305 | if (perf_evsel__read_on_cpu(evsel, 0, 0) < 0) { |
306 | pr_debug("perf_evsel__open_read_on_cpu\n"); | 306 | pr_debug("perf_evsel__read_on_cpu\n"); |
307 | goto out_close_fd; | 307 | goto out_close_fd; |
308 | } | 308 | } |
309 | 309 | ||
@@ -365,7 +365,7 @@ static int test__open_syscall_event_on_all_cpus(void) | |||
365 | goto out_thread_map_delete; | 365 | goto out_thread_map_delete; |
366 | } | 366 | } |
367 | 367 | ||
368 | if (perf_evsel__open(evsel, cpus, threads, false, false) < 0) { | 368 | if (perf_evsel__open(evsel, cpus, threads, false) < 0) { |
369 | pr_debug("failed to open counter: %s, " | 369 | pr_debug("failed to open counter: %s, " |
370 | "tweak /proc/sys/kernel/perf_event_paranoid?\n", | 370 | "tweak /proc/sys/kernel/perf_event_paranoid?\n", |
371 | strerror(errno)); | 371 | strerror(errno)); |
@@ -418,7 +418,7 @@ static int test__open_syscall_event_on_all_cpus(void) | |||
418 | continue; | 418 | continue; |
419 | 419 | ||
420 | if (perf_evsel__read_on_cpu(evsel, cpu, 0) < 0) { | 420 | if (perf_evsel__read_on_cpu(evsel, cpu, 0) < 0) { |
421 | pr_debug("perf_evsel__open_read_on_cpu\n"); | 421 | pr_debug("perf_evsel__read_on_cpu\n"); |
422 | err = -1; | 422 | err = -1; |
423 | break; | 423 | break; |
424 | } | 424 | } |
@@ -529,7 +529,7 @@ static int test__basic_mmap(void) | |||
529 | 529 | ||
530 | perf_evlist__add(evlist, evsels[i]); | 530 | perf_evlist__add(evlist, evsels[i]); |
531 | 531 | ||
532 | if (perf_evsel__open(evsels[i], cpus, threads, false, false) < 0) { | 532 | if (perf_evsel__open(evsels[i], cpus, threads, false) < 0) { |
533 | pr_debug("failed to open counter: %s, " | 533 | pr_debug("failed to open counter: %s, " |
534 | "tweak /proc/sys/kernel/perf_event_paranoid?\n", | 534 | "tweak /proc/sys/kernel/perf_event_paranoid?\n", |
535 | strerror(errno)); | 535 | strerror(errno)); |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index fc1273e976c5..7e3d6e310bf8 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -845,9 +845,10 @@ static void start_counters(struct perf_evlist *evlist) | |||
845 | } | 845 | } |
846 | 846 | ||
847 | attr->mmap = 1; | 847 | attr->mmap = 1; |
848 | attr->inherit = inherit; | ||
848 | try_again: | 849 | try_again: |
849 | if (perf_evsel__open(counter, top.evlist->cpus, | 850 | if (perf_evsel__open(counter, top.evlist->cpus, |
850 | top.evlist->threads, group, inherit) < 0) { | 851 | top.evlist->threads, group) < 0) { |
851 | int err = errno; | 852 | int err = errno; |
852 | 853 | ||
853 | if (err == EPERM || err == EACCES) { | 854 | if (err == EPERM || err == EACCES) { |
diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c index 9fea75535221..96bee5c46008 100644 --- a/tools/perf/util/cgroup.c +++ b/tools/perf/util/cgroup.c | |||
@@ -13,7 +13,7 @@ cgroupfs_find_mountpoint(char *buf, size_t maxlen) | |||
13 | { | 13 | { |
14 | FILE *fp; | 14 | FILE *fp; |
15 | char mountpoint[MAX_PATH+1], tokens[MAX_PATH+1], type[MAX_PATH+1]; | 15 | char mountpoint[MAX_PATH+1], tokens[MAX_PATH+1], type[MAX_PATH+1]; |
16 | char *token, *saved_ptr; | 16 | char *token, *saved_ptr = NULL; |
17 | int found = 0; | 17 | int found = 0; |
18 | 18 | ||
19 | fp = fopen("/proc/mounts", "r"); | 19 | fp = fopen("/proc/mounts", "r"); |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index d852cefa20de..45da8d186b49 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include "evlist.h" | 12 | #include "evlist.h" |
13 | #include "evsel.h" | 13 | #include "evsel.h" |
14 | #include "util.h" | 14 | #include "util.h" |
15 | #include "debug.h" | ||
15 | 16 | ||
16 | #include <sys/mman.h> | 17 | #include <sys/mman.h> |
17 | 18 | ||
@@ -250,15 +251,19 @@ int perf_evlist__alloc_mmap(struct perf_evlist *evlist) | |||
250 | return evlist->mmap != NULL ? 0 : -ENOMEM; | 251 | return evlist->mmap != NULL ? 0 : -ENOMEM; |
251 | } | 252 | } |
252 | 253 | ||
253 | static int __perf_evlist__mmap(struct perf_evlist *evlist, int cpu, int prot, | 254 | static int __perf_evlist__mmap(struct perf_evlist *evlist, struct perf_evsel *evsel, |
254 | int mask, int fd) | 255 | int cpu, int prot, int mask, int fd) |
255 | { | 256 | { |
256 | evlist->mmap[cpu].prev = 0; | 257 | evlist->mmap[cpu].prev = 0; |
257 | evlist->mmap[cpu].mask = mask; | 258 | evlist->mmap[cpu].mask = mask; |
258 | evlist->mmap[cpu].base = mmap(NULL, evlist->mmap_len, prot, | 259 | evlist->mmap[cpu].base = mmap(NULL, evlist->mmap_len, prot, |
259 | MAP_SHARED, fd, 0); | 260 | MAP_SHARED, fd, 0); |
260 | if (evlist->mmap[cpu].base == MAP_FAILED) | 261 | if (evlist->mmap[cpu].base == MAP_FAILED) { |
262 | if (evlist->cpus->map[cpu] == -1 && evsel->attr.inherit) | ||
263 | ui__warning("Inherit is not allowed on per-task " | ||
264 | "events using mmap.\n"); | ||
261 | return -1; | 265 | return -1; |
266 | } | ||
262 | 267 | ||
263 | perf_evlist__add_pollfd(evlist, fd); | 268 | perf_evlist__add_pollfd(evlist, fd); |
264 | return 0; | 269 | return 0; |
@@ -312,7 +317,8 @@ int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite) | |||
312 | if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, | 317 | if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, |
313 | FD(first_evsel, cpu, 0)) != 0) | 318 | FD(first_evsel, cpu, 0)) != 0) |
314 | goto out_unmap; | 319 | goto out_unmap; |
315 | } else if (__perf_evlist__mmap(evlist, cpu, prot, mask, fd) < 0) | 320 | } else if (__perf_evlist__mmap(evlist, evsel, cpu, |
321 | prot, mask, fd) < 0) | ||
316 | goto out_unmap; | 322 | goto out_unmap; |
317 | 323 | ||
318 | if ((evsel->attr.read_format & PERF_FORMAT_ID) && | 324 | if ((evsel->attr.read_format & PERF_FORMAT_ID) && |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 662596afd7f1..d6fd59beb860 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -175,7 +175,7 @@ int __perf_evsel__read(struct perf_evsel *evsel, | |||
175 | } | 175 | } |
176 | 176 | ||
177 | static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, | 177 | static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, |
178 | struct thread_map *threads, bool group, bool inherit) | 178 | struct thread_map *threads, bool group) |
179 | { | 179 | { |
180 | int cpu, thread; | 180 | int cpu, thread; |
181 | unsigned long flags = 0; | 181 | unsigned long flags = 0; |
@@ -192,19 +192,6 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, | |||
192 | 192 | ||
193 | for (cpu = 0; cpu < cpus->nr; cpu++) { | 193 | for (cpu = 0; cpu < cpus->nr; cpu++) { |
194 | int group_fd = -1; | 194 | int group_fd = -1; |
195 | /* | ||
196 | * Don't allow mmap() of inherited per-task counters. This | ||
197 | * would create a performance issue due to all children writing | ||
198 | * to the same buffer. | ||
199 | * | ||
200 | * FIXME: | ||
201 | * Proper fix is not to pass 'inherit' to perf_evsel__open*, | ||
202 | * but a 'flags' parameter, with 'group' folded there as well, | ||
203 | * then introduce a PERF_O_{MMAP,GROUP,INHERIT} enum, and if | ||
204 | * O_MMAP is set, emit a warning if cpu < 0 and O_INHERIT is | ||
205 | * set. Lets go for the minimal fix first tho. | ||
206 | */ | ||
207 | evsel->attr.inherit = (cpus->map[cpu] >= 0) && inherit; | ||
208 | 195 | ||
209 | for (thread = 0; thread < threads->nr; thread++) { | 196 | for (thread = 0; thread < threads->nr; thread++) { |
210 | 197 | ||
@@ -253,7 +240,7 @@ static struct { | |||
253 | }; | 240 | }; |
254 | 241 | ||
255 | int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, | 242 | int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, |
256 | struct thread_map *threads, bool group, bool inherit) | 243 | struct thread_map *threads, bool group) |
257 | { | 244 | { |
258 | if (cpus == NULL) { | 245 | if (cpus == NULL) { |
259 | /* Work around old compiler warnings about strict aliasing */ | 246 | /* Work around old compiler warnings about strict aliasing */ |
@@ -263,19 +250,19 @@ int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, | |||
263 | if (threads == NULL) | 250 | if (threads == NULL) |
264 | threads = &empty_thread_map.map; | 251 | threads = &empty_thread_map.map; |
265 | 252 | ||
266 | return __perf_evsel__open(evsel, cpus, threads, group, inherit); | 253 | return __perf_evsel__open(evsel, cpus, threads, group); |
267 | } | 254 | } |
268 | 255 | ||
269 | int perf_evsel__open_per_cpu(struct perf_evsel *evsel, | 256 | int perf_evsel__open_per_cpu(struct perf_evsel *evsel, |
270 | struct cpu_map *cpus, bool group, bool inherit) | 257 | struct cpu_map *cpus, bool group) |
271 | { | 258 | { |
272 | return __perf_evsel__open(evsel, cpus, &empty_thread_map.map, group, inherit); | 259 | return __perf_evsel__open(evsel, cpus, &empty_thread_map.map, group); |
273 | } | 260 | } |
274 | 261 | ||
275 | int perf_evsel__open_per_thread(struct perf_evsel *evsel, | 262 | int perf_evsel__open_per_thread(struct perf_evsel *evsel, |
276 | struct thread_map *threads, bool group, bool inherit) | 263 | struct thread_map *threads, bool group) |
277 | { | 264 | { |
278 | return __perf_evsel__open(evsel, &empty_cpu_map.map, threads, group, inherit); | 265 | return __perf_evsel__open(evsel, &empty_cpu_map.map, threads, group); |
279 | } | 266 | } |
280 | 267 | ||
281 | static int perf_event__parse_id_sample(const union perf_event *event, u64 type, | 268 | static int perf_event__parse_id_sample(const union perf_event *event, u64 type, |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 6710ab538342..f79bb2c09a6c 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -81,11 +81,11 @@ void perf_evsel__free_id(struct perf_evsel *evsel); | |||
81 | void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads); | 81 | void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads); |
82 | 82 | ||
83 | int perf_evsel__open_per_cpu(struct perf_evsel *evsel, | 83 | int perf_evsel__open_per_cpu(struct perf_evsel *evsel, |
84 | struct cpu_map *cpus, bool group, bool inherit); | 84 | struct cpu_map *cpus, bool group); |
85 | int perf_evsel__open_per_thread(struct perf_evsel *evsel, | 85 | int perf_evsel__open_per_thread(struct perf_evsel *evsel, |
86 | struct thread_map *threads, bool group, bool inherit); | 86 | struct thread_map *threads, bool group); |
87 | int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, | 87 | int perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, |
88 | struct thread_map *threads, bool group, bool inherit); | 88 | struct thread_map *threads, bool group); |
89 | 89 | ||
90 | #define perf_evsel__match(evsel, t, c) \ | 90 | #define perf_evsel__match(evsel, t, c) \ |
91 | (evsel->attr.type == PERF_TYPE_##t && \ | 91 | (evsel->attr.type == PERF_TYPE_##t && \ |
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index a9f2d7e1204d..f5e38451fdc5 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c | |||
@@ -498,11 +498,11 @@ static PyObject *pyrf_evsel__open(struct pyrf_evsel *pevsel, | |||
498 | struct cpu_map *cpus = NULL; | 498 | struct cpu_map *cpus = NULL; |
499 | struct thread_map *threads = NULL; | 499 | struct thread_map *threads = NULL; |
500 | PyObject *pcpus = NULL, *pthreads = NULL; | 500 | PyObject *pcpus = NULL, *pthreads = NULL; |
501 | int group = 0, overwrite = 0; | 501 | int group = 0, inherit = 0; |
502 | static char *kwlist[] = {"cpus", "threads", "group", "overwrite", NULL, NULL}; | 502 | static char *kwlist[] = {"cpus", "threads", "group", "inherit", NULL, NULL}; |
503 | 503 | ||
504 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOii", kwlist, | 504 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOii", kwlist, |
505 | &pcpus, &pthreads, &group, &overwrite)) | 505 | &pcpus, &pthreads, &group, &inherit)) |
506 | return NULL; | 506 | return NULL; |
507 | 507 | ||
508 | if (pthreads != NULL) | 508 | if (pthreads != NULL) |
@@ -511,7 +511,8 @@ static PyObject *pyrf_evsel__open(struct pyrf_evsel *pevsel, | |||
511 | if (pcpus != NULL) | 511 | if (pcpus != NULL) |
512 | cpus = ((struct pyrf_cpu_map *)pcpus)->cpus; | 512 | cpus = ((struct pyrf_cpu_map *)pcpus)->cpus; |
513 | 513 | ||
514 | if (perf_evsel__open(evsel, cpus, threads, group, overwrite) < 0) { | 514 | evsel->attr.inherit = inherit; |
515 | if (perf_evsel__open(evsel, cpus, threads, group) < 0) { | ||
515 | PyErr_SetFromErrno(PyExc_OSError); | 516 | PyErr_SetFromErrno(PyExc_OSError); |
516 | return NULL; | 517 | return NULL; |
517 | } | 518 | } |
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c index 8c17a8730e4a..15633d608133 100644 --- a/tools/perf/util/ui/browsers/annotate.c +++ b/tools/perf/util/ui/browsers/annotate.c | |||
@@ -256,10 +256,9 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, | |||
256 | int refresh) | 256 | int refresh) |
257 | { | 257 | { |
258 | struct objdump_line *pos, *n; | 258 | struct objdump_line *pos, *n; |
259 | struct annotation *notes = symbol__annotation(sym); | 259 | struct annotation *notes; |
260 | struct annotate_browser browser = { | 260 | struct annotate_browser browser = { |
261 | .b = { | 261 | .b = { |
262 | .entries = ¬es->src->source, | ||
263 | .refresh = ui_browser__list_head_refresh, | 262 | .refresh = ui_browser__list_head_refresh, |
264 | .seek = ui_browser__list_head_seek, | 263 | .seek = ui_browser__list_head_seek, |
265 | .write = annotate_browser__write, | 264 | .write = annotate_browser__write, |
@@ -281,6 +280,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, | |||
281 | 280 | ||
282 | ui_helpline__push("Press <- or ESC to exit"); | 281 | ui_helpline__push("Press <- or ESC to exit"); |
283 | 282 | ||
283 | notes = symbol__annotation(sym); | ||
284 | |||
284 | list_for_each_entry(pos, ¬es->src->source, node) { | 285 | list_for_each_entry(pos, ¬es->src->source, node) { |
285 | struct objdump_line_rb_node *rbpos; | 286 | struct objdump_line_rb_node *rbpos; |
286 | size_t line_len = strlen(pos->line); | 287 | size_t line_len = strlen(pos->line); |
@@ -291,6 +292,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, | |||
291 | rbpos->idx = browser.b.nr_entries++; | 292 | rbpos->idx = browser.b.nr_entries++; |
292 | } | 293 | } |
293 | 294 | ||
295 | browser.b.entries = ¬es->src->source, | ||
294 | browser.b.width += 18; /* Percentage */ | 296 | browser.b.width += 18; /* Percentage */ |
295 | ret = annotate_browser__run(&browser, evidx, refresh); | 297 | ret = annotate_browser__run(&browser, evidx, refresh); |
296 | list_for_each_entry_safe(pos, n, ¬es->src->source, node) { | 298 | list_for_each_entry_safe(pos, n, ¬es->src->source, node) { |
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index 798efdca3ead..5d767c622dfc 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
@@ -851,7 +851,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, | |||
851 | goto out_free_stack; | 851 | goto out_free_stack; |
852 | case 'a': | 852 | case 'a': |
853 | if (browser->selection == NULL || | 853 | if (browser->selection == NULL || |
854 | browser->selection->map == NULL || | 854 | browser->selection->sym == NULL || |
855 | browser->selection->map->dso->annotate_warned) | 855 | browser->selection->map->dso->annotate_warned) |
856 | continue; | 856 | continue; |
857 | goto do_annotate; | 857 | goto do_annotate; |